{"lang": "Mono C#", "source_code": "using System;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b6a1814f9551b43466590471bab40f91", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28010.2036\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ForCodeforces\", \"ForCodeforces\\ForCodeforces.csproj\", \"{9372C2A1-BA75-45D9-8BA0-2C6EBC15BD1C}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{9372C2A1-BA75-45D9-8BA0-2C6EBC15BD1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{9372C2A1-BA75-45D9-8BA0-2C6EBC15BD1C}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{9372C2A1-BA75-45D9-8BA0-2C6EBC15BD1C}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{9372C2A1-BA75-45D9-8BA0-2C6EBC15BD1C}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {4412A573-E066-4AE4-B95A-69ED731622F1}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4cd74c14774950e1db8addcb895722ca", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " char[] vowels = { 'a', 'e', 'i', 'o', 'u', 'y' };\n int inputLetterSize = int.Parse(Console.ReadLine());\n string letter = Console.ReadLine();\n StringBuilder letterBilder = new StringBuilder(letter);\n\n\n for (int i = 0; i < letterBilder.Length-1; i++)\n {\n if (vowels.Contains(letterBilder[i])){\n if (vowels.Contains(letterBilder[i + 1])) { letterBilder.Remove(i + 1, 1); i--; }\n \n }\n }\n\n //for (int i = 1; i < letterBilder.Length; i++)\n //{\n // if(vowels.Contains(letterBilder[i]))\n // {\n // if (vowels.Contains(letterBilder[i - 1]))\n // { letterBilder.Remove(i, 1);\n // i = 0;\n // }\n // }\n //}\n Console.WriteLine(letterBilder);\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e9c36c8fc524a931ae1be1307e619f46", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\nnamespace ConsoleApplication89\n{\n class Prog\n {\n static void Main(string[] args)\n {\n\n int n;\n string s;\n \n n =int.Parse(Console.ReadLine());\n s = Console.ReadLine();\n\n string vowel = \"aeiouy\";\n\n for (int i = 0; i < s.Length-1; ++i)\n {\n if(vowel.Contains(s[i]) && vowel.Contains(s[i+1]) )\n {\n s = s.Remove(i+1, 1);\n }\n }\n Console.WriteLine(s);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "20b1a0edad7e42f381363859c7ab7372", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace \u0411\u0443\u043a\u0432\u044b\n{\n class Program\n {\n static void Main(string[] args)\n {\n string G = \"aouiey\";\n\n bool Flag = false;\n int N = Convert.ToInt32(Console.ReadLine());\n for (int i = 0; i < N; i++)\n {\n char c = (char)Console.Read();\n if (G.Contains(c) == false)\n {\n Flag = false;\n Console.Write(c);\n }\n else//(G.Contains(c) == true)\n {\n if (Flag==false)\n {\n Console.Write(c);\n \n }\n Flag = true;\n }\n \n }\n Console.WriteLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e540a6f77629bd339db800f32a361f94", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u041d\u0438\u043a\u043e\u043b\u0430\u0439_\u0438_\u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int l = mas.Length;\n int pol = (l + 1) / 2;\n int i = 0;\n int imin = 0, imax = 0;\n\n foreach (int x in mas)\n {\n if (x == 1) imin = i+1;\n else if (x == l) imax = i+1;\n i++;\n }\n\n if (imin <= pol && imax <= pol)\n {\n if (imin > imax) imin = l;\n else imax = l;\n }\n else if (imin > pol && imax > pol)\n {\n if (imin < imax) imin = 1;\n else imax = 1;\n }\n else if (imin <= pol)\n {\n if (pol - imin >= imax - pol) imax = l;\n else imin = 1;\n }\n else\n {\n if (pol - imax >= imin - pol) imin = l;\n else imax = 1;\n }\n\n //Console.WriteLine(\"\u0418\u043d\u0434\u0435\u043a\u0441 \u043c\u0438\u043d = \" + imin + \"\\n\u0418\u043d\u0434\u0435\u043a\u0441 max = \" + imax);\n Console.WriteLine(Math.Abs(imax-imin));\n Console.ReadLine();\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9f71811eaca9c8b15bcc4460b5a19a01", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System.Linq;\nusing System.Xml;\nusing System.Xml.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CD\n{\n class Program\n {\n static void Main(string[] args)\n {\nint size = Convert.ToInt32(Console.ReadLine());\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n for (int i = 0; i < size; i++)\n {\n if ((arr[i] == 1) || (arr[i] == size))\n {\n int s = size - 1 - i;\n int b = i + 1;\n Console.WriteLine(b>s?b:s);\n break;\n }\n }}}}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "09f5d51af945cbdf62ab0d2823b6fcc9", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections.ObjectModel;\nusing System.Data;\n\nnamespace ConsoleApplicationTest\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int32[] arry = new Int32[5];\n int count = Convert.ToInt32(Console.ReadLine());\n if (count < 2 || count > 100) { throw new Exception(\"Out of Range\"); }\n string[] x_temp = Console.ReadLine().Split(' ');\n int[] initArry = Array.ConvertAll(x_temp, Int32.Parse);\n if (initArry.Distinct().Count() != initArry.Length) { throw new Exception(\"Elements should be distinct\"); }\n for (int i = 0; i < initArry.Length; i++) { if (initArry[i] < 1) { throw new Exception(\"Element should be greater than one\"); } }\n int maxIndex = initArry.ToList().IndexOf(initArry.Max()) + 1;\n int minIndex = initArry.ToList().IndexOf(initArry.Min()) + 1;\n if (((maxIndex == 1) || (maxIndex == count)) && ((minIndex == 1) || (minIndex == count)))\n {\n Console.WriteLine(Math.Abs(maxIndex - minIndex));\n }\n else\n {\n\n arry[0] = Math.Abs(count - minIndex);\n arry[1] = Math.Abs(1 - minIndex);\n arry[2] = Math.Abs(1 - maxIndex);\n arry[3] = Math.Abs(count - maxIndex);\n Console.WriteLine(arry.ToList().Max());\n }\n\t\t\t}\n\t\t\t}\n\t\t\t}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "656294d194abc69e634587bc4d6c4f50", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0} {"lang": "MS C#", "source_code": " private static int SoldierBananna(int k, int n, int w)\n {\n int sum = k*(w+1)*w/2;\n return Math.Max(0, sum-n);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "55c98e0a771573361b1f9d7fff636cf1", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " public class Program\n {\n static void Main(string[] args)\n {\n string []arr = Console.ReadLine().Split(' ');\n long k = Convert.ToInt64(arr[0]);\n long n = Convert.ToInt64(arr[1]);\n long w = Convert.ToInt64(arr[2]);\n\n //long r = w * k;\n //long y = w + 1;\n //long u = r * y;\n //long q = u / 2;\n long t =Math.Abs( ( (k*w)*(w+1)/2 )-n );\n Console.WriteLine(t);\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bafe58eb6807b14ef48672719e878814", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n internal class Program\n {\n private static void Main(string[] args)\n {\n var d = Console.ReadLine().Split().Select(Int32.Parse).ToArray();\n int n = d[1], k = d[0], w = d[2];\n var result = w * ((float)(k + w * k) / 2) - n;\n Console.WriteLine(result >= 0 ? result : 0);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "43a64a07ac365e2295ce539d0c2a4d2f", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "int sum = 0;\n var s = Console.ReadLine().Split().Select( par => int.Parse(par)).ToArray();\n while(s[2] > 0){\n sum += s[0]*s[2];\n s[2]--;\n }\n Console.WriteLine(sum - s[1]);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d56d7cff9488e10c636c0ee9c8ebc739", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\n\nnamespace _546A_Soldier_and_Bananas\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inputs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n int singlePrice = inputs[0];\n int money = inputs[1];\n int numberOfBananas = inputs[2];\n\n int price = 0;\n for (int i = 0; i < numberOfBananas; i++)\n {\n price += singlePrice * (i+1);\n }\n\n Console.WriteLine(Math.Clamp(price - money, 0,10000000));\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e2d46a0c0ae576466b00cfcc771e753f", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30413.136\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Soldado_y_Platanos\", \"Soldado_y_Platanos\\Soldado_y_Platanos.csproj\", \"{C2CD1643-5AC3-4724-8E38-D4A69546AF69}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{C2CD1643-5AC3-4724-8E38-D4A69546AF69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{C2CD1643-5AC3-4724-8E38-D4A69546AF69}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{C2CD1643-5AC3-4724-8E38-D4A69546AF69}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{C2CD1643-5AC3-4724-8E38-D4A69546AF69}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {B094B43C-EA01-45AE-9785-A207B454959D}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f518021361b782ab4d72c509b64205fb", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class A_Soldier_and_Bananas\n {\n public static void Run()\n {\n int cost, USD, bananas, totalCost = 0;\n\n string[] tokens = Console.ReadLine().Split();\n\n cost = int.Parse(tokens[0]);\n USD = int.Parse(tokens[1]);\n bananas = int.Parse(tokens[2]);\n\n\n while (bananas != 0)\n {\n totalCost += cost*bananas;\n bananas--;\n }\n\n Console.WriteLine(totalCost - USD);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bf99b90fbd1348afa98030165c429190", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\n\n static void Main(string[] args)\n {\n int cost, USD, bananas, totalCost = 0;\n\n string[] tokens = Console.ReadLine().Split();\n\n cost = int.Parse(tokens[0]);\n USD = int.Parse(tokens[1]);\n bananas = int.Parse(tokens[2]);\n\n\n while (bananas != 0)\n {\n totalCost += cost*bananas;\n bananas--;\n }\n\n Console.WriteLine(totalCost - USD);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7ecf68171dc808b53e718d6a308f7c2d", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Class9\n {\n public static void Main_18()\n {\n int a = int.Parse(Console.ReadLine());\n int[] s = { 4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 747, 777 };\n\n for (int j = 0; j < 14; j++)\n {\n if (a % s[j] == 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0bb2744093563d87e977f00122c2d964", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n int cost, USD, bananas, totalCost = 0;\n\n string[] tokens = Console.ReadLine().Split();\n\n cost = int.Parse(tokens[0]);\n USD = int.Parse(tokens[1]);\n bananas = int.Parse(tokens[2]);\n\n\n while (bananas != 0)\n {\n totalCost += cost*bananas;\n bananas--;\n }\n\n Console.WriteLine(totalCost - USD);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1b6c2d5996fb6e7377540aed30e65384", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass A_Soldier_and_Bananas\n {\n public void Run()\n {\n int cost, USD, bananas, totalCost = 0;\n\n string[] tokens = Console.ReadLine().Split();\n\n cost = int.Parse(tokens[0]);\n USD = int.Parse(tokens[1]);\n bananas = int.Parse(tokens[2]);\n\n\n while (bananas != 0)\n {\n totalCost += cost*bananas;\n bananas--;\n }\n\n Console.WriteLine(totalCost - USD);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d9906dc9a0c2c1f9914088258b573947", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "namespace Codeforces\n{\n class TestClass\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 for (int i = 0; i <= w; ++i)\n {\n n -= i * k;\n }\n\n n = -n;\n\n Console.WriteLine(n);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bc00260ecfd62fc396d5dbe062404eaf", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "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[] tokens = Console.ReadLine().Split(' ');\n\n Int32 k = Int32.Parse(tokens[0]);\n Int32 n = Int32.Parse(tokens[1]);\n Int32 w = Int32.Parse(tokens[2]);\n\n Int32 s = 0;\n\n\n for (int i=1;i<=w;i++)\n {\n\n s = s + i * k;\n \n \n\n }\n\n\n int r = s - n;\n\n if (r == 0) Console.WriteLine(0);\n if (r > 0) Console.WriteLine(r);\n if (r < 0) Console.WriteLine(0);\n\n\n \n\n \n --while (Console.ReadKey().Key != ConsoleKey.Enter) { }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "77fb93564f28179033d886dc83586a88", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.IO;\nusing System.IO.Pipes;\nusing System.Text;\n\nnamespace CSharpInNutshellTest\n{\n internal sealed class Program\n { \n\n private static int SoldierBanana(int k, int n, int w)\n {\n int sum = k*(w+1)*w/2;\n return Math.Max(0, sum-n);\n }\n \n private static void Main(string[] args)\n {\n Console.WriteLine(SoliderBanana(args[0], args[1], args[2]);\n }\n }\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "38e972c3acbffc0cf321a3704225d1fd", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace soldierandbananas\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long k = long.Parse(input[0]);\n long n = long.Parse(input[1]);\n long w = long.Parse(input[2]);\n long req =long.Max( (((k * w) / 2) * (1 + w)) - n,0);\n Console.WriteLine(req);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "327adea3eaab48321972ca638b1f859a", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "static void Main(string[] args)\n {\n int cost, USD, bananas, totalCost = 0;\n\n string[] tokens = Console.ReadLine().Split();\n\n cost = int.Parse(tokens[0]);\n USD = int.Parse(tokens[1]);\n bananas = int.Parse(tokens[2]);\n\n\n while (bananas != 0)\n {\n totalCost += cost*bananas;\n bananas--;\n }\n\n Console.WriteLine(totalCost - USD);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "32480a75a37b9663e7b5b3950c386def", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass A_Soldier_and_Bananas\n {\n public static void main()\n {\n int cost, USD, bananas, totalCost = 0;\n\n string[] tokens = Console.ReadLine().Split();\n\n cost = int.Parse(tokens[0]);\n USD = int.Parse(tokens[1]);\n bananas = int.Parse(tokens[2]);\n\n\n while (bananas != 0)\n {\n totalCost += cost*bananas;\n bananas--;\n }\n\n Console.WriteLine(totalCost - USD);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aa03b9c97415ed1f63dadf2bb2a70ca1", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "Ausing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _546A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split(' ');\n int k = Convert.ToInt32(arr[0]);\n int n = Convert.ToInt32(arr[1]);\n int w = Convert.ToInt32(arr[2]);\n int res = 0;\n for (int i = 1; i <= w; i++)\n {\n res += i;\n }\n res = k * res;\n if (n-res>=0)\n Console.WriteLine(0);\n else\n Console.WriteLine(res-n);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6e770f215dcfe2d4a3198ef3f7780bfb", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "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 k = int.Parse(s[0]);\n int n = int.Parse(s[1]);\n int w = int.Parse(s[2]);\n int y = 0;\n \n \n for (int i = 1; i <= w; i++)\n {\n y = y + (i * k);\n }\n if(y>n)\n {\n Console.WriteLine(y - n);\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "54a62ab6080d1fbdbfd9e217be31518b", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.IO;\nusing System.IO.Pipes;\nusing System.Text;\n\nnamespace CSharpInNutshellTest\n{\n internal sealed class Program\n { \n\n private static int SoldierBanana(int k, int n, int w)\n {\n int sum = k*(w+1)*w/2;\n return Math.Max(0, sum-n);\n }\n \n private static void Main(string[] args)\n {\n Console.WriteLine(SoldierBanana(args[0], args[1], args[2]));\n }\n }\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7082c45a89781f831c04c9dbdd8d4ff2", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass A_Soldier_and_Bananas\n {\n public static void Run()\n {\n int cost, USD, bananas, totalCost = 0;\n\n string[] tokens = Console.ReadLine().Split();\n\n cost = int.Parse(tokens[0]);\n USD = int.Parse(tokens[1]);\n bananas = int.Parse(tokens[2]);\n\n\n while (bananas != 0)\n {\n totalCost += cost*bananas;\n bananas--;\n }\n\n Console.WriteLine(totalCost - USD);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e065d9d2b061f350345d2d5a61f95c36", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n \n int sum = 0;\n var s = Console.ReadLine().Split().Select( par => int.Parse(par)).ToArray();\n while(s[2] > 0){\n sum += s[0]*s[2];\n s[2]--;\n }\n Console.WriteLine(sum - s[1]);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5207250f7eb702d68d3fddec7138df9c", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.IO;\nusing System.IO.Pipes;\nusing System.Text;\n\nnamespace CSharpInNutshellTest\n{\n internal sealed class Program\n { \n\n private static int SoldierBanana(int k, int n, int w)\n {\n int sum = k*(w+1)*w/2;\n return Math.Max(0, sum-n);\n }\n \n private static void Main(string[] args)\n {\n Console.WriteLine(SoliderBanana(args[0], args[1], args[2]));\n }\n }\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "080922723f005de5189ba9214a0a94fd", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class Something\n {\n static void Main(string[] args)\n {\n String[] paramz = Console.ReadLine().Split(' ');\n int n = Convert.ToInt16(paramz[0]);\n int ptctr = Convert.ToInt16(paramz[1]) - 1;\n\n String[] input = Console.ReadLine().Split(' ');\n\n if (Convert.ToInt16(input[ptctr]) != 0)\n {\n while (ptctr < n)\n {\n if (Convert.ToInt16(input[ptctr + 1]) == Convert.ToInt16(input[ptctr]))\n {\n ptctr++;\n }\n else\n break;\n }\n }\n else\n {\n while (ptctr >= 0)\n {\n if (Convert.ToInt16(input[ptctr]) == 0)\n {\n ptctr--;\n }\n else\n {\n break;\n }\n }\n }\n\n Console.Write(ptctr + 1);\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "69e7cef7e7281b8b419fc062ba72a93c", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "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 k=0,p,m=0;\n string [] palo= Console.ReadLine().Split();\n int p1=int.Parse(palo[1]);\n p=int.Parse(palo[0]);\n string [] paloso=Console.ReadLine().Split();\n for(int z=0 ; z

p1 && k>=0)\n {\n m++;\n }\n else if (k==1 && p1==1)\n {\n m++\n }\n }\n Console.WriteLine(m);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "28f0d7bcb6df506e2025c08cdf418647", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\n/**\n * Auto-generated code below aims at helping you parse\n * the standard input according to the problem statement.\n **/\nclass Solution\n{\n static void Main(string[] args)\n {\n string[] Numbers = Console.ReadLine().Split(' ');\n int N = int.Parse(Numbers[0]);\n int K = int.Parse(Numbers[1]);\n string[] Scores = Console.ReadLine().Split(' ');\n int count = 0; \n for(int i = 0 ; i < N ; i++){\n int score = int.Parse(Scores[i]);\n if(score < k)\n break;\n count++;\n } \n Console.WriteLine(Score);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6c5d6a6961cb67cd9a717dfe9551833e", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass solution\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 tokens=Console.ReadLine().Split();\n int length=0;\n for(int i=0;ik && int.Parse(tokens[tokens.Length-i-1])>0)\n {\n length=tokens.Length-i;\n break;\n }\n else if(int.Parse[tokens[0]==k])\n {\n k=k-1;\n }\n \n }\n Console.WriteLine(length);\n\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dc6fa10d05843f9d7598347c582d72a8", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class P_158A\n {\n public P_158A() { }\n\n public void Run()\n {\n String[] paramz = Console.ReadLine().Split(' ');\n int n = Convert.ToInt16(paramz[0]);\n int ptctr = Convert.ToInt16(paramz[1]) - 1;\n\n String[] input = Console.ReadLine().Split(' ');\n\n if (Convert.ToInt16(input[ptctr]) != 0)\n {\n while (ptctr < n)\n {\n if (Convert.ToInt16(input[ptctr + 1]) == Convert.ToInt16(input[ptctr]))\n {\n ptctr++;\n }\n else\n break;\n }\n }\n else\n {\n while (ptctr >= 0)\n {\n if (Convert.ToInt16(input[ptctr]) == 0)\n {\n ptctr--;\n }\n else\n {\n break;\n }\n }\n }\n\n Console.Write(ptctr + 1);\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dba302f39cdd7810cc46e25478a18ba8", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tint k=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\twhile(count1k && ne[i]>=0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n \n \n }\n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "945b6787f9b97ac194bd785d7bc844c7", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tfor (int i=0;itmp1[1])\n\t\t count1++;\n\t\t else\n\t\t break;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(count1);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "759acd06edb22b2311a2f980f29d2b63", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace prob4_Next_round\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputs = Console.ReadLine();\n var contestantsScores = Console.ReadLine();\n\n var inputsSplit = inputs.Split(' ');\n var contestantsNumbern =Convert.ToInt32(inputsSplit[0]);\n var scoreK = Convert.ToInt32(inputsSplit[1]) ;\n\n var contestantsScoreSplit = contestantsScores.Split(' ');\n var countList = new List();\n \n if (contestantsNumbern <= 50 && scoreK >= 1 ){\n var count = Count(scoreK);\n Console.WriteLine(count);\n\n }\n\n\n int Count(int count)\n {\n foreach (var contestantScore in contestantsScoreSplit)\n {\n if (contestantsScoreSplit.Length <= contestantsNumbern)\n {\n var intContestantScore = Convert.ToInt32(contestantScore);\n int[] scoresArray = Array.ConvertAll(contestantsScoreSplit, int.Parse);\n if (intContestantScore >= scoresArray[scoreK] && intContestantScore > 0 && intContestantScore <= 100)\n {\n countList.Add(intContestantScore);\n \n } \n }\n }\n int output = countList.Count;\n return output;\n\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "57c569544ea00fa7e9f90788a746413a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "{\n class Program\n {\n static void Main(string[] args)\n {\n \n var initial_input = Console.ReadLine();\n string first_range = initial_input.Substring(0, 1);\n int first_range_num = Int32.Parse(first_range);\n string last_range = initial_input.Substring(2);\n int last_range_num = Int32.Parse(last_range);\n\n var initial_input_2 = Console.ReadLine();\n\n int[] somthing = Array.ConvertAll(initial_input_2.Split(' '), int.Parse);\n\n int c = 0;\n\n int qualification_score = somthing[last_range_num];\n \n\n for (int i = 0; first_range_num > i; i++)\n {\n if(qualification_score <= somthing[i])\n {\n c++;\n }\n if(qualification_score == 0)\n {\n c = 0;\n }\n else\n {\n \n }\n }\n Console.WriteLine(c); \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0b2a49625b75a778c277eba2a8010f3", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {2E20431D-E3F5-4D61-9877-3CA732EC7462}\n Exe\n Properties\n ConsoleApplication18\n ConsoleApplication18\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "81afe1e56e977cfc20622c0dcb2c63e4", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main()\n {\n var readLine = Console.ReadLine();\n long k = 0;\n if (readLine != null)\n {\n var parameters = readLine.Split(' ').Select(long.Parse);\n var enumerable = parameters as IList ?? parameters.ToList();\n k = enumerable.Last();\n }\n readLine = Console.ReadLine();\n List balls = null;\n if (readLine != null)\n {\n balls = readLine.Split(' ').Select(long.Parse).ToList();\n }\n if (balls != null)\n {\n var kball = balls[k];\n long counter = balls.Count(ball => ball >= kball && ball > 0);\n Console.WriteLine(counter);\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a3c72de348fac774dcf2815ac9a6a32f", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Class1\n{\n static public void Main()\n {\n string[] nk = Console.ReadLine();\n int n = int.Parse(nk[0]);\n int k = int.Parse(nk[1]);\n string[] tok = Console.ReadLine();\n int[] A;\n for (int i = 0; i < n; i++)\n A[i] = int.Parse(tok[i]);\n int ans = 0;\n for (int i = 0; i < n; i++)\n if (A[i] > k) ans++;\n Console.WriteLine(ans);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "73bb4df78ddd3e36b966a408287a9092", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace NextRound\n{\n class Next\n {\n static void Main()\n {\n int A,B,C,F;\n A = Console.ReadLine();\n B = Console.ReadLine();\n for(int i = 1;i < A + 1;i++)\n {\n C = Console.ReadLine();\n if(C > B || C = B)\n {\n F++;\n }\n i = A;\n }\n Console.WriteLine(F.ToString());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "738ada45cc065efe6959c816e67d1be6", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\n/**\n * Auto-generated code below aims at helping you parse\n * the standard input according to the problem statement.\n **/\nclass Solution\n{\n static void Main(string[] args)\n {\n string[] Numbers = Console.ReadLine().Split(' ');\n int N = int.Parse(Numbers[0]);\n int K = int.Parse(Numbers[1]);\n string[] Scores = Console.ReadLine().Split(' ');\n int count = 0; \n for(int i = 0 ; i < N ; i++){\n int score = int.Parse(Scores[i]);\n if(score < K)\n break;\n count++;\n } \n Console.WriteLine(score);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4759ccffc7f5dfa48d2be2d5cb8aaee4", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n//coding by clark wagdy\nnamespace Spreadsheets\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = 0;\n string line1 = Console.ReadLine();\n string line2 = Console.ReadLine();\n int[] arr = new int[Convert.ToInt32(line1[0])];\n string[] sline = line2.Split(' ');\n for (int i = 0; i < Convert.ToInt32(line1[0]); i++)\n {\n arr[i] = Convert.ToInt32(sline[i]);\n }\n for (int j = 0; j < Convert.ToInt32(line1[0]); j++)\n {\n if (arr[j]> (Convert.ToInt32(line1[2]))) \n {\n count++;\n }\n }\n Console.WriteLine(count);\n}\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "daec7f37b2355d003228d96580cde798", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "static void Main(string[] args)\n {\n //reading the input data\n System.IO.StreamReader ip = new System.IO.StreamReader(\"input.txt\");\n String s = ip.ReadLine();\n String[] ss = s.Split(' ');\n int n = Convert.ToInt32(ss[0]);\n int k = Convert.ToInt32(ss[1]);\n int counter = 0;\n\n s = ip.ReadLine();\n ss = s.Split(' ');\n for (int i = 0; i < n; i++)\n {\n if (Convert.ToInt32(ss[i]) > k)\n counter++;\n }\n\n //System.Console.WriteLine(counter);\n System.IO.StreamWriter op = new System.IO.StreamWriter(\"output.txt\");\n op.WriteLine(counter);\n ip.Close();\n ip.Dispose();\n op.Close();\n op.Dispose();\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8e4ac92bd197bd23833fa3c9a10c222d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Drawing;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\n\nnamespace A._Next_Round\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Console.ReadLine();\n var n_data = n.Split(' ');\n\n var participents = int.Parse(n_data[0]);\n var min = int.Parse(n_data[1]);\n int[] point = new int[participents];\n int count,sum=0;\n\n for(int i =0; i< participents;i++)\n {\n count = 0;\n\n point[i] = int.Parse(Console.ReadLine());\n\n if(point[i] > min)\n {\n count = 1;\n }\n sum = sum + count;\n }\n\n Console.WriteLine(sum);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7ef2ed122531e6575a6c319d1bd93e4b", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tfor (int i=0;iint.Parse(tmp1[1]))\n\t\t count1++;\n\t\t else\n\t\t {\n\t\t break;\n\t\t }\n\t\t}\n\t\tif(count==0)\n\t\t{\n\t\t if(int.Parse(tmp2[0])==int.Parse(tmp1[1]))\n\t\t { count1++;\n\t\t for (int i=1;i s&&A[i]) ans++;\n Console.WriteLine(ans);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b45047fa76aa8b1718720c93389343c6", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Class1\n{\n static public void Main()\n {\n string[] nk = Console.ReadLine().Split(' ');\n int n = int.Parse(nk[0]);\n int k = int.Parse(nk[1]);\n string[] tok = Console.ReadLine().Split(' ');\n int[] A;\n for (int i = 0; i < n; i++)\n A[i] = int.Parse(tok[i]);\n int ans = 0;\n for (int i = 0; i < n; i++)\n if (A[i] > k) ans++;\n Console.WriteLine(ans);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "33bf7397284a7d3cf81a721f726eb893", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "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()\n\t\t{\n\t\t\tint counter = 0;\n\t\t\tstring spliting;\n\t\t\tspliting = Console.ReadLine();\n\t\t\tstring[] inp = (spliting.Split(new Char [] { ' ' }));\n\t\t\tstring[] input = (Console.ReadLine()).Split(new Char [] {' '});\n\t\t\tfor(int i = 0; i < int.Parse(inp[0]); ++i)\n\t\t\t{\n\t\t\t\tif (int.Parse(input[i]) >= int.Parse(input[int.Parse(inp[1])] - 1) && int.Parse(input[i]) > 0)\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(counter);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d58a3af7fa8ea99155a5cfc80e49c76", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "#include \nint main();\n{\n int A,B,C,F = 0;\n cin>>A;\n cin>>B;\n for(int i = 1;i < A + 1;i++)\n {\n cin>>C;\n if(C > B || C == B)\n {\n F++;\n }\n i = A;\n }\n cout< k) | (k > 50))) {\n if ((points[count] < 0) | (points[count] > 100)) {\n count = 0;\n break;\n }\n while ((points[count] >= good_point) & (points[count] > 0)) count++;\n }\n\n System.Console.Out.Write(count);\n }\n\n private static int[] parse(String s)\n {\n string[] strings = s.Split();\n int[] result = new int[strings.Length];\n for (int i = 0; i < strings.Length; i++) result[i] = int.Parse(strings[i]);\n\n return result;\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "687cbf3971424f794d73275bf8aa3e50", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n class A158\n {\n static void Main()\n {\n string[] inputString = Console.ReadLine().Split(' ');\n int n = int.Parse(inputString[0]);\n int failPoint = int.Parse(inputString[1]);\n\t\t\t\n\t\t\tinputString = new string[n];\n\t\t\tinputString = Console.ReadLine().Split(' ');\n\t\t\tint[] competitors = new int[n];\n\t\t\t\n\t\t\tint counter = 0;\n\t\t\t\n\t\t\tforeach(string i in inputString)\n\t\t\t{\n\t\t\t\tcompetitors[counter] = int.Parse(i);\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t\t\n\t\t\tint pass = 0;\n\t\t\t\n foreach(int i in competitors)\n\t\t\t{\n\t\t\t\tif(i > failPoint)\n\t\t\t\t{\n\t\t\t\t\tpass++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(pass == 0 && COMPETITORS[0] != 0)\n\t\t\t{\n\t\t\t\tpass = n;\n\t\t\t}\n\t\t\t\n\t\t\tConsole.WriteLine(pass);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a85784a19b02758200c918fe06811b6f", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Practice\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inputs = GetInts();\n int[] prizes = GetInts();\n Console.WriteLine((Array.IndexOf(prizes, inputs[1])));\n Cosole.ReadLine();\n }\n \n static int[] GetInts()\n {\n string[] s = (Console.ReadLine()).Split(' ');\n int[] integers = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n integers[i] = int.Parse(s[i]);\n }\n return integers;\n }\n\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c3606b9a53ad9fbb91d0b7c6bdab2153", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "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().Split(' ');\n string[] s = Console.ReadLine().Split(' ');\n int n=0;\n for(int i=0;iint.Parse(a[1]))\n n++;\n Console.WriteLine(n);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f7eb99a3e676fdaf554526634fdfa7f3", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n int n = int.Parse(line[0]);\n int k = int.Parse(line[1]);\n string[] scores = Console.ReadLine().Split();\n int count = 0;\n for (int i = 0, last = 0; i < n; i++)\n {\n int a_i = int.Parse(scores[i]);\n if((a_i > 0 && i < k) || (i >= k && last == a_i)))\n count++;\n last = a_i;\n }\n Console.WriteLine(count);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0cff090417073091dc8351894c87abed", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tfor (int i=0;itmp1[1])\n\t\t count1++;\n\t\t else\n\t\t break;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(count1);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aa31c84bbd6b978fb4209c1bca947576", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class P_158A\n {\n static void Main(string[] args)\n {\n String[] paramz = Console.ReadLine().Split(' ');\n int n = Convert.ToInt16(paramz[0]);\n int ptctr = Convert.ToInt16(paramz[1]) - 1;\n\n String[] input = Console.ReadLine().Split(' ');\n\n if (Convert.ToInt16(input[ptctr]) != 0)\n {\n while (ptctr < n)\n {\n if (Convert.ToInt16(input[ptctr + 1]) == Convert.ToInt16(input[ptctr]))\n {\n ptctr++;\n }\n else\n break;\n }\n }\n else\n {\n while (ptctr >= 0)\n {\n if (Convert.ToInt16(input[ptctr]) == 0)\n {\n ptctr--;\n }\n else\n {\n break;\n }\n }\n }\n\n Console.Write(ptctr + 1);\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "788f05d0e1eccc0719ec117c00eed233", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count=0;\n\t\tint k=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tif(int.Parse(tmp2[0])!=0)\n\t\tfor (int i=0;iint.Parse(tmp1[1]))\n\t\t {\n\t\t count1++;\n\t\t k++;\n\t\t }\n\t\t else\n\t\t break;\n\t\t \n\t\t}\n\t\t\n\t\t\n\t\twhile(countint.Parse(tmp1[1]) && k (n[1])) c++;\n }\n Console.WriteLine(c);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cff893a55fa153cad65e415837d56c62", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace NextRound\n{\n class Next\n {\n static void main()\n {\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d0ba871d930fb8c21d45bbd2311138e4", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nclass Task\n{\n static void Main()\n {\n String[] arr=Console.ReadLine().Split(' ');\n int n=int.Parse(arr[0]);\n int k=int.Parse(arr[1]);\n int ne[n];\n int c=0;\n for(int i=0;ik && ne[i]>=0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n \n \n }\n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1a90650336aa1ceb2839b7c187cd0e00", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass Problem\n{\n public static void Main()\n {\n int nk[] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = nk[0];\n int k = nk[1];\n \n int[] scores = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int kScore = scores[k - 1];\n \n for (int i = 0; i < scores.Length; i++)\n {\n if (scores[i] < kScore)\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7853cbfb9915655973532c8621832f45", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nnamespace ConsoleApplication3\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\n int n = int.Parse(line1[0]), k = int.Parse(line1[1]);\n var scores = line2.Select(int.Parse).ToArray();\n\n for (var cur = scores[k - 1]; k < scores.Length && scores[k] <= 0; k++)\n {\n if (scores[k] != cur)\n {\n break;\n }\n }\n\n Console.WriteLine(Math.Max(k - scores.Count(_ => _ >= 0), 0));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6da03c6e85d172cb343ffeb5eefa154a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Practice\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inputs = GetInts();\n int[] prizes = GetInts();\n Console.WriteLine((Array.IndexOf(prizes, inputs[1])));\n }\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4c4ca2678ca63c621ec3b69f58d4dc8c", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace A_NextRound\n{\n class Program\n {\n static void Main(string[] args)\n {\n string participants = Console.ReadLine();\n int nParticipants = int.Parse(participants[0].ToString());\n int place = int.Parse(participants[2].ToString());\n\n string scoreString = Console.ReadLine();\n string[] scores = scoreString.Split(\" \");\n int c = 0;\n for(int i = 0; i < scores.Length; i++)\n {\n if(int.Parse(scores[i].ToString()) >= int.Parse(scores[place].ToString()) && int.Parse(scores[i].ToString()) > 0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n Console.Read();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7584300768677a4552f92ea6e2709357", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "public static void Main (string[] args)\n {\n int n,k,end=0;\n String[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n String[] main = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n \n n=Int32.Parse(temp[0]);\n k=Int32.Parse(temp[1]);\n \n if (n!=0)\n {\n \n int [] mass=new int[n];\n \n for (int i=0;ik)\n {end = 1;}\n \n }\n \n Console.WriteLine(end);\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7f32ee0a5db03867f085b2728ae83302", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass advance {\n\tstatic int Win(int k, int[] ptcpts) {\n\t\tif (ptcpts[k] == 0) {\n\t\t\tfor (int i = k; i >= 0; --i) {\n\t\t\t\tif(b[i] != 0) return i + 1;\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t\telse {\n \t\t\tfor (int i = k; i < ptcpts.Length; ++i) {\n\t\t\t\tif (b[i] != ptcpts[k]) return i + 1;\n\t\t\t}\n\t\t\treturn ptcpts.Length;\n\t\t}\n\t}\n\n\tpublic static void Main() {\n\t\tvar a = Console.ReadLine().Split();\n\t\tvar k = int.Parse(a[1]) - 1;\n\t\tvar ptcpts = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\tConsole.WriteLine(Win(k, ptcpts));\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bf6f55231bc2cbaa64fb2706568e0a05", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tint k=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tif(int.Parse(tmp2[0])!=0)\n\t\tfor (int i=0;iint.Parse(tmp1[1]) && count1 int.Parse(p)).ToList();\nConsole.WriteLine(str.Count(p => p >= k)) ;\n} \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f14e4020cff0f63f24649daaa9b8bb7c", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication5\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 k = Int32.Parse(input[1]) - 1;\n input = Console.ReadLine().Split(' ');\n int[] marks = new int[n];\n\n for (int i = 0; i < n; i++)\n marks[i] = Int32.Parse(input[i]);\n\n int count = 0;\n if (marks[k] > 0)\n foreach (int m in marks)\n if (m >= marks[k])\n count++;\n Console.WriteLine(count);\n Console.ReadKey();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "25abf922487d227584e488c470c3374c", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tint k=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\tbool flag=true;\n\t\tif(int.Parse(tmp2[0])!=0)\n\t\tfor (int i=0;iint.Parse(tmp1[1]))\n\t\t {count1++;\n\t\t k++;\n\t\t }\n\t\t else\n\t\t break;\n\t\t \n\t\t}\n\t\t\n\t\twhile(count1 words = new List();\n //for (int i = 0; i < numberOfWords; i++)\n //{\n // words.Add(Console.ReadLine());\n //}\n\n string input = Console.ReadLine();\n string[] numberOfWords = input.Split(\" \");\n\n int numberOfInput = Convert.ToInt32(numberOfWords[0]);\n int nbWords = Convert.ToInt32(numberOfWords[1]);\n int cpt = 0;\n\n List words = new List();\n words.Add(Console.ReadLine());\n\n if (nbWords > 0 && nbWords < 51)\n {\n foreach (var item in words)\n {\n string[] tab = item.Split(\" \");\n List listNbc = new List();\n foreach (var nb in tab)\n {\n listNbc.Add(Convert.ToInt32(nb));\n }\n for (int i = 0; i < listNbc.Count; i++)\n {\n if (Convert.ToInt32(listNbc[(nbWords - 1)]) =< listNbc[i])\n {\n cpt++;\n }\n }\n\n }\n Console.WriteLine(cpt);\n }\n\n\n //int cpt = 0;\n //int cptSolvedProblems = 0;\n\n //if (numberOfWords > 0 && numberOfWords < 1001)\n //{\n\n // foreach (var item in words)\n // {\n // string[] oui = item.Split(\" \");\n // for (int i = 0; i < oui.Length; i++)\n // {\n // if (Convert.ToInt32(oui[i]) == 1)\n // cpt++;\n // }\n // if (cpt > 1)\n // {\n // cptSolvedProblems++;\n // cpt = 0;\n // }\n // else\n // {\n // cpt = 0;\n // }\n // }\n // Console.WriteLine(cptSolvedProblems);\n //}\n\n //foreach (var item in words)\n //{\n // if (item.Length > 0 && item.Length < 101)\n // {\n // if (item.Length > 10)\n // {\n // result = item[0] + Convert.ToString(item.Length - 2) + item[item.Length - 1];\n // Console.WriteLine(result);\n // }\n // else\n // {\n // result = item;\n // Console.WriteLine(result);\n // }\n // }\n //} \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "face54e156ed7e71b5d26773628ec868", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nclass Task\n{\n static void Main()\n {\n var[] arr=Console.ReadLine().Split(' ');\n int n=int.Parse(arr[0]);\n int k=int.Parse(arr[1]);\n int[] ne=new int[n];\n int c=0;\n for(int i=0;ik && ne[i]>=0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n \n \n }\n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e77a4ed596265d7bd1e35a5e39761272", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "int res=0;\n \tvar str = Console.ReadLine().Split(' ');\n \tint n = Int32.Parse(str[0]);\n \tint k = Int32.Parse(str[1]);\n \tvar score = Console.ReadLine().Split(' ');\n \tif(int.Parse(score[k])!=0){\n \t\t\n \t for (int i=0;i=int.Parse(score[k-1])){\n \t\t res = res+1;\n \t\t\n \t \t }\n\t //Console.WriteLine(res);\n \t }\n \t}\n \telse{\n \t\tfor (int i=0;iint.Parse(score[k-1])){\n \t\t res = res+1;\n \t\t\n \t\t }\n\t //Console.WriteLine(res);\n \t }\n \t}\n \t\n \tConsole.WriteLine(res);\n }\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ce38a06f7e56e9bebb081819e4d702a3", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "/*8 5\n10 9 8 7 7 7 5 5 */\nusing System;\nusing System.Linq;\nclass Task\n{\n static void Main()\n {\n var[] arr=Console.ReadLine().Split(' ');\n int n=int.Parse(arr[0]);\n int k=int.Parse(arr[1]);\n int ne[n];\n int c=0;\n for(int i=0;ik && ne[i]>=0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n \n \n }\n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "df876a25433737e7c5e8eeb76de1129e", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count=0;\n\t\tint k=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tif(int.Parse(tmp2[0])!=0)\n\t\tfor (int i=0;iint.Parse(tmp1[1]))\n\t\t {\n\t\t count1++;\n\t\t k++;\n\t\t }\n\t\t else\n\t\t break;\n\t\t \n\t\t}\n\t\t\n\t\t\n\t\twhile(countint.Parse(tmp1[1] && k= nums[th] && nums[i] > 0)\n count++;\n }\n Console.WriteLine(count); \n\n \n\n public static void copy_String_2_Int( int[] arr1 , string arr2)\n {\n string[] temp = arr2.Split(' ');\n \n for (int i = 0; i < arr1.Length; i++)\n {\n arr1[i] = ToInt32(temp[i].ToString());\n }\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4cd51f74061d496c74aaa48df872d98d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\nusing System.Linq;\n\nnamespace Test\n{\npublic static class Program\n{\n public static void Main()\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n int[] first = a.Split().Select(x => Convert.ToInt32(x)).ToArray();\n int[] second = b.Split().Select(x => int.Parse(x)).ToArray();\n int won = first[1];\n int start = won;\n int limit = second[won - 1];\n for (int i = start; i < second.Length; i++) \n {\n if (limit == 0) { won = 0; break; }\n if (limit == second[i]) { won++; }\n else { break; }\n }\n Console.WriteLine(won);\n }\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7f0022f153e5afea5e9ec25f04e41d11", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass test\n{\n static void Main()\n {\n int num = 0;\n string line1 = Console.ReadLine();\n string line2 = Console.ReadLine();\n string [] list1 = line1.Split();\n string [] list2 = line2.Split();\n int [] listInt1 = new int [ list1.Length ];\n int [] listInt2 = new int [ list2.Length ];\n \n for(int i = 0 ; i < 2 ; i++)\n {\n listInt1[i] = Int32.Parse(list1[i]);\n }\n \n for(int i = 0 ; i < list2.Length ; i++)\n {\n listInt2[i] = Int32.Parse(list2[i]);\n }\n \n Array.Sort(listInt2);\n \n if(num == -1)\n {\n num = 0;\n Console.WriteLine(num);\n }\n else\n {\n for(int i = 0 ; i< listInt2.Length ; i++)\n {\n if(listInt2[i] > listInt1[1])\n {\n num++;\n }\n }\n if(num == 0)\n {\n for(int i = 0 ; i< listInt2.Length ; i++)\n {\n else if(listInt2[i] >= listInt1[1])\n {\n num++;\n }\n }\n }\n if(num == listInt1[0])\n {\n num = 0;\n }\n Console.WriteLine(num);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "57bf79579b429b352042d4c86782f778", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace A_NextRound\n{\n class Program\n {\n static void Main(string[] args)\n {\n string participants = Console.ReadLine();\n int nParticipants = int.Parse(participants[0].ToString());\n int place = int.Parse(participants[2].ToString());\n\n string scoreString = Console.ReadLine();\n string scores = scoreString.Split(\" \");\n int c = 0;\n for(int i = 0; i < scores.Length; i++)\n {\n if(int.Parse(scores[i].ToString()) >= int.Parse(scores[place].ToString()) && int.Parse(scores[i].ToString()) > 0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n Console.Read();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b90fd483756237096eb28be3bd9c3361", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tint k=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tif(int.Parse(tmp2[0])!=0)\n\t\tfor (int i=0;iint.Parse(tmp1[1]) && count1 scores = Console.ReadLine().Split(' ').Select(\u00d7 => int.Parse(\u00d7)).ToList();\n\n int result = scores.Where(\u00d7 => scores[k]).Count();\n\n Console.WriteLine(result); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e37fd498d8044d56e785904c710373c5", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace A_NextRound\n{\n class Program\n {\n static void Main(string[] args)\n {\n string participants = Console.ReadLine();\n int nParticipants = int.Parse(participants[0].ToString());\n int place = int.Parse(participants[2].ToString());\n\n string scoreString = Console.ReadLine();\n string[] scores = scoreString.Split(' ');\n int c = 0;\n for(int i = 0; i < scores.Length; i++)\n {\n if(int.Parse(scores[i].ToString()) >= int.Parse(scores[place].ToString()) && int.Parse(scores[i].ToString()) > 0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n Console.Read();\n }\n }\n}\nusing System;\n\nnamespace A_NextRound\n{\n class Program\n {\n static void Main(string[] args)\n {\n string participants = Console.ReadLine();\n int nParticipants = int.Parse(participants[0].ToString());\n int place = int.Parse(participants[2].ToString());\n\n string scoreString = Console.ReadLine();\n string[] scores = scoreString.Split(' ');\n int c = 0;\n for(int i = 0; i < scores.Length; i++)\n {\n if(int.Parse(scores[i].ToString()) >= int.Parse(scores[place].ToString()) && int.Parse(scores[i].ToString()) > 0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "98f8662552eafab4ff0b864c659e38ab", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nnamespace Test\n{\npublic static class Program\n{\n public static void Main()\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n int[] first = a.Split().Select(x => Convert.ToInt32(x)).ToArray();\n int[] second = b.Split().Select(x => int.Parse(x)).ToArray();\n int won = first[1];\n int start = won;\n int limit = second[won - 1];\n for (int i = start; i < second.Length; i++) \n {\n if (limit == 0) { won = 0; break; }\n if (limit == second[i]) { won++; }\n else { break; }\n }\n Console.WriteLine(won);\n }\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cbd13aba4dbd7d7d8286cb7547f3eb11", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Class1\n{\n static public void Main()\n {\n string[] nk = Console.ReadLine().Split(' ');\n int n = int.Parse(nk[0]);\n int k = int.Parse(nk[1]);\n string[] tok = Console.ReadLine().Split(' ');\n int *A= new int [n];\n for (int i = 0; i < n; i++)\n A[i] = int.Parse(tok[i]);\n int ans = 0;\n for (int i = 0; i < n; i++)\n if (A[i] > k) ans++;\n Console.WriteLine(ans);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "33212382977cb12549de179a5dfb45c0", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0443\u043d\u0434\", \"\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0443\u043d\u0434\\\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0443\u043d\u0434.csproj\", \"{F7F7DF74-9174-4300-979D-631577C96354}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{F7F7DF74-9174-4300-979D-631577C96354}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{F7F7DF74-9174-4300-979D-631577C96354}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{F7F7DF74-9174-4300-979D-631577C96354}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{F7F7DF74-9174-4300-979D-631577C96354}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "47b3c0fa958abf4555d73ab4482845fa", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tint k=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\tbool flag=true;\n\t\tif(int.Parse(tmp2[0])!=0)\n\t\tfor (int i=0;iint.Parse(tmp1[1]))\n\t\t {count1++;\n\t\t k++;\n\t\t }\n\t\t else\n\t\t break;\n\t\t \n\t\t}\n\t\t\n\t\twhile(count1= int.Parse(scores[place].ToString()) && int.Parse(scores[i].ToString()) > 0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n Console.Read();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d46874008bec7197ef0e194ad266064a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tint k=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tif(int.Parse(tmp2[0])!=0)\n\t\tfor (int j=0;jint.Parse(tmp1[1]) && count1= con && sc[i] > 0)\n counter++;\n }\n Console.WriteLine(counter);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "607ebf2a534c37d1fea1d83b803d045d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "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 char[] Split = { ' ' };\n string input1 = Console.ReadLine();\n string[] input1mass = new string[2];\n input1mass = input1.Split(Split);\n int[] input1massint = new int[2];\n for (int i = 0; i < 2; i++)\n {\n input1massint[i] = Convert.ToInt32(input1mass[i]);\n }\n int n = Convert.ToInt32(input1massint[0]);\n int k = Convert.ToInt32(input1massint[1]);\n\n string input2 = Console.ReadLine();\n string[] input2mass = new string[n];\n input2mass = input2.Split(Split);\n int[] score = new int[n];\n for (int i = 0; i< n; i++)\n {\n score[i] = Convert.ToInt32(input2mass[i]);\n }\n\n //*******\n\n if (k - 1 == 0)\n {\n if (score[k - 1] == 0)\n {\n Console.WriteLine(0);\n return;\n }\n else\n {\n if (k = 1)\n {\n Console.WriteLine(1);\n }\n while (score[k - 1] == score[k])\n {\n k++;\n if (k == n)\n break;\n }\n Console.WriteLine(k);\n return;\n }\n\n }\n else if (k == n)\n {\n if (score[k - 1] == 0)\n {\n while (k >= 0)\n {\n k--;\n if (score[k - 1] != 0)\n {\n Console.WriteLine(k);\n return;\n }\n }\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(k);\n return;\n }\n }\n else\n {\n while (score[k - 1] == 0)\n {\n k--;\n if (k - 1 == 0)\n {\n Console.WriteLine(0);\n return;\n }\n }\n while (score[k - 1] == score[k])\n {\n k++;\n if (k == n)\n break;\n }\n Console.WriteLine(k);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e0b8edd1cb71d70f967f800206b1774e", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\n/**\n * Auto-generated code below aims at helping you parse\n * the standard input according to the problem statement.\n **/\nclass Solution\n{\n static void Main(string[] args)\n {\n string[] Numbers = Console.ReadLine().Split(\" \");\n int N = int.Parse(Numbers[0]);\n int K = int.Parse(Numbers[1]);\n string[] Scores = int.Parse(Console.ReadLine().Split(\" \"));\n int count = 0; \n for(int i = 0 ; i < N ; i++){\n int score = int.Parse(Scores[i]);\n if(score < k)\n break;\n count++;\n } \n Console.WriteLine(score);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "98566ae3eec87b4c85a589e6e54a38a9", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tint k=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\tbool flag=true;\n\t\tif(int.Parse(tmp2[0])!=0)\n\t\tfor (int i=0;iint.Parse(tmp1[1]))\n\t\t {count1++;\n\t\t k++;\n\t\t }\n\t\t else\n\t\t break;\n\t\t \n\t\t}\n\t\t\n\t\twhile(count1= int.Parse(scores[place].ToString()))\n {\n Console.Write(scores[i] + \" \");\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2069beccb3168f4d89dd7b80f51bb3fd", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication24\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = \"\";\n for (int i = 0; i < n; i++)\n s += Console.ReadLine();\n\n HashSet set = new HashSet(s, #10 + #13);\n foreach (var x in set) \n Console.WriteLine(x);\n\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "17655638dd9ac3d19a8b23c000b3ea07", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\n\n class Program\n {\n public static void Main(string[] args)\n {\n int k,n;\n int ans = 0;\n String s = Console.ReadLine();\n String [] pervstr = s.Split();\n n = Int32.Parse(pervstr[0]);\n int n2 = Int32.Parse(pervstr[0]);\n k = Int32.Parse(pervstr[1]);\n String s2 = Console.ReadLine();\n String[] vtstroka = s2.Split();\n int min=Int32.Parse(vtstroka[n-1]);\n while (min < Int32.Parse(vtstroka[k-1]))\n {\n ans++;\n min = Int32.Parse(vtstroka[--n]);\n }\n Console.WriteLine(n2-ans);\n Console.ReadLine();\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "653cc41794fd84f2be891fe696be1bb4", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "int n,k,end=0;\n String[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n String[] main = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n \n n=Int32.Parse(temp[0]);\n k=Int32.Parse(temp[1]);\n \n if (n!=0)\n {\n \n int [] mass=new int[n];\n \n for (int i=0;ik)\n {end = 1;}\n \n }\n \n Console.WriteLine(end);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "00d44d9d81cc52def2fa06f273b5155d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "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 = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n int[] m = Console.ReadLine().Split(' ').Select(x1 => Convert.ToInt32(x1)).ToArray();\n int s = 0;\n int a = m[n[1]-1];\n for (int i = 0; i < m.Length; i++)\n {\n if (a == 0)\n {\n break;\n }\n if (m[i] >= a)\n {\n s = s + 1;\n }\n }\n Console.WriteLine(s);\n }\n }\n}\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 int[] n = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n int[] m = Console.ReadLine().Split(' ').Select(x1 => Convert.ToInt32(x1)).ToArray();\n int s = 0;\n int a = m[n[1]-1];\n for (int i = 0; i < m.Length; i++)\n {\n if (a == 0)\n {\n break;\n }\n if (m[i] >= a)\n {\n s = s + 1;\n }\n }\n Console.WriteLine(s);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8d8638f461058642fba29366240efbcf", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {DA5984D2-2812-481D-B3A6-2D1F500AC7CB}\n Exe\n prob4_Next_round\n prob4 Next round\n v4.7.2\n 512\n true\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b68c86ee649409708efd1169ab8adc2b", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing static System.Console;\nusing static System.Convert;\nclas program\n{\n public static void Main()\n {\n String x = ReadLine();\n String y = ReadLine();\n\n string[] temp = x.Split(' ');\n\n int number = ToInt32(temp[0].ToString());\n int th = ToInt32(temp[1].ToString()); \n\n\n int[] nums = new int[number];\n \n copy_String_2_Int(nums,y); \n \n\n int count = 0;\n for (int i = 0; i < nums.Length; i++)\n {\n if (nums[i] >= nums[th] && nums[i]>0)\n count++;\n }\n Console.WriteLine(count);\n }\n \n public static void copy_String_2_Int( int[] arr1 , string arr2)\n {\n string[] temp = arr2.Split(' ');\n \n for (int i = 0; i < arr1.Length; i++)\n {\n arr1[i] = ToInt32(temp[i].ToString());\n }\n }\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cc86d5a908545a9184350cde9a27ec0d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Drawing;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\n\nnamespace A._Next_Round\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Console.ReadLine();\n var n_data = n.Split(' ');\n var participents = int.Parse(n_data[0]);\n var min = int.Parse(n_data[1]);\n int[] point = new int[participents];\n var points = Console.ReadLine();\n var points_split = points.Split();\n int sum = 0,count;\n for(int i =0;i< participents;i++)\n {\n \n point[i] = int.Parse(points_split[i]);\n }\n\n for (int j = 0; j < participents - 1; j++)\n {\n count = 0;\n if(point[j]>min)\n {\n count = 1;\n }\n\n sum = sum + count;\n }\n Console.WriteLine(sum);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a8854bd6fff2e5e6de0ccce1f0693ba6", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Numerics;\n\nnamespace Test1\n{\n public class Test1\n {\n public static void Main()\n {\n Stopwatch sw = Stopwatch.StartNew();\n\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n int[] first = a.Split().Select(x => Convert.ToInt32(x)).ToArray();\n int[] second = b.Split().Select(x => int.Parse(x)).ToArray();\n int won = first[1];\n int start = won;\n int limit = second[won - 1];\n for (int i = start; i < second.Length; i++) \n {\n if (limit == 0) { won = 0; break; }\n if (limit == second[i]) { won++; }\n else { break; }\n }\n Console.WriteLine(won);\n \n sw.Stop();\n TimeSpan elapsedTime = sw.Elapsed;\n Console.WriteLine(elapsedTime);\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8491c0f3f3ed8bf0af3347fe80aafa21", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nclass Program \n{\npublic static void Main(string[] args) \n{\nvar ll = Console.ReadLine().Split(' ');\nvar k = ll[0];\nvar str = Console.ReadLine().Split(' ').Select(p => int.Parse(p)).ToList();\nConsole.WriteLine(str.Count(p => p >= k)) ;\n} \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1b7e44658cded75707dea646d363e168", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\n/**\n * Auto-generated code below aims at helping you parse\n * the standard input according to the problem statement.\n **/\nclass Solution\n{\n static void Main(string[] args)\n {\n string[] Numbers = Console.ReadLine().Split(' ');\n int N = int.Parse(Numbers[0]);\n int K = int.Parse(Numbers[1]);\n string[] Scores = Console.ReadLine().Split(' ');\n int count = 0; \n for(int i = 0 ; i < N ; i++){\n int score = int.Parse(Scores[i]);\n if(score >= Scores[K-1] && Scores[K-1] >0 )\n count++;\n } \n Console.WriteLine(count);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8b93423ae566d5b8404a44b3eb4d2137", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApp2\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n\n string []input = Console.ReadLine().Split(\" \") ;\n int NumberOfParticipants= int.Parse(input[0]);\n int kthPlace= int.Parse(input[1]);\n\n string [] Scores= Console.ReadLine().Split(\" \");\n\n int totalNumber = 0;\n for (int i = 0; i < Scores.Length; i++)\n {\n if (int.Parse(Scores[i]) > kthPlace)\n totalNumber++;\n }\n\n Console.WriteLine(totalNumber);\n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "71362a63ba56c32b75c7cb5b260be58a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class MainClass\n{\n public static void Main(string[] args)\n {\n var nk = (from t in Console.ReadLine().Split(' ') select int.Parse(t)).ToArray();\n var array = (from t in Console.ReadLine().Split(' ') select int.Parse(t)).ToArray();\n int it = 0;\n while (array[it] >= array[nk[1] - 1] && it++ < nk[0]);\n Console.WriteLine(it > 0 ? it - 1 : it);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d2df165ff3dd9eee44ff0e269a036114", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "/*8 5\n10 9 8 7 7 7 5 5 */\nusing System;\nusing System.Linq;\nclass Task\n{\n static void Main()\n {\n var[] arr=Console.ReadLine().Split(' ');\n int n=int.Parse(arr[0]);\n int k=int.Parse(arr[1]);\n int ne[n];\n int c=0;\n for(int i=0;ik && ne[i]>=0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n \n \n }\n \n \n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ae39cd763e40ce08c8b65adf31439254", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace JobApplications.Practice\n{\n class Next_Round___158A\n {\n \n static void Main(string[] args)\n {\n int n, k;\n\n //if (!Int32.TryParse(Console.ReadLine(), out n))\n // return;\n //if(!)\n\n string kn = Console.ReadLine();\n string[] inputs = kn.Split(\" \");\n n = Int32.Parse(inputs[0]);\n k = Int32.Parse(inputs[1]);\n if (n < k)\n Console.WriteLine(0);\n\n string scores = Console.ReadLine();\n string[] scInputs = scores.Split(\" \");\n if (scInputs.Length != inputs.Length)\n Console.WriteLine(0);\n\n int[] sc = Array.ConvertAll(scInputs, int.Parse);\n\n if (sc[0] <= 0)\n Console.WriteLine(0);\n\n //int people = 1;\n //int currentScore = sc[0];\n //int place = 1;\n\n //for(int i=1; i= k)\n // {\n // Console.WriteLine(people);\n // break;\n // } \n //}\n\n int counter = 0;\n int con = sc[k - 1];\n for (int i = 0; i < n; i++)\n {\n if (sc[i] >= con && sc[i] > 0)\n counter++;\n }\n Console.WriteLine(counter);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "428714d9161abadfdca2764f8c2d6b98", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing static System.Console;\nusing static System.Convert;\n \nclass program\n{\n public static void Main()\n {\n String x = ReadLine();\n String y = ReadLine();\n \n string[] temp = x.Split(' ');\n \n int number = ToInt32(temp[0].ToString());\n int th = ToInt32(temp[1].ToString())-1; \n \n \n int[] nums = new int[number];\n \n copy_String_2_Int(nums,y); \n \n int count = 0;\n for (int i = 0; i < nums.Length; i++)\n {\n if (nums[i] >= nums[th] && nums[i] > 0)\n count++;\n }\n Console.WriteLine(count); \n \n \n \n public static void copy_String_2_Int( int[] arr1 , string arr2)\n {\n string[] temp = arr2.Split(' ');\n \n for (int i = 0; i < arr1.Length; i++)\n {\n arr1[i] = ToInt32(temp[i].ToString());\n }\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "05b4bcf5f391ca4155262b914deb6500", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Test\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tint n = int.Parse(input.Split(new String[]{\" \"}, StringSplitOptions.RemoveEmptyEntries)[0]);\n\t\t\tint k = int.Parse(input.Split(new String[]{\" \"}, StringSplitOptions.RemoveEmptyEntries)[1]);\n\n\t\t\tinput = Console.ReadLine();\n\n\t\t\tList a = new List();\n\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta.Add(int.Parse(input.Split(new String[]{\" \"}, StringSplitOptions.RemoveEmptyEntries)[i]));\n\n\t\t\tint passingScore = a[k - 1];\n\n\t\t\tif (k[0] == 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\tConsole.WriteLine(a.Count(p => p >= passingScore));\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eeb4e890705c1715458af6a3047b7461", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass solution\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 tokens=Console.ReadLine().Split();\n int length=0;\n while(tokens.Length!=0)\n {\n if(int.Parse(tokens[(tokens.Length/2)])>k)\n {\n length+=tokens.Length/2;\n tokens=tokens.Slice((tokens.Length/2+1,tokens.Length);\n }\n else\n {\n tokens=tokens.Slice(0,tokens.Length/2+1);\n }\n }\n Console.WriteLine(length);\n \n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "095a943a5c5736733061b7de00894838", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tfor (int i=0;itmp1[1])\n\t\t count++;\n\t\t else\n\t\t break;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(count);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b4ce8b59f7fa81c6de0bcfb77bc26447", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass solution\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 tokens=Console.ReadLine().Split();\n int length=0;\n while(tokens.Length!=0)\n {\n if(int.Parse(tokens[(tokens.Length/2)])>k)\n {\n length+=tokens.Length/2;\n tokens=tokens.Slice((tokens.Length/2+1),tokens.Length);\n }\n else\n {\n tokens=tokens.Slice(0,(tokens.Length/2+1));\n }\n }\n Console.WriteLine(length);\n \n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8ae1be080bf7552e140d31ab6eb4efaf", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count1=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tfor (int i=0;iint.Parse(tmp1[1]))\n\t\t count1++;\n\t\t else\n\t\t {\n\t\t break;\n\t\t }\n\t\t}\n\t\tif(count==0)\n\t\t{\n\t\t if(int.Parse(tmp2[0])==int.Parse(tmp1[1]))\n\t\t { count++;\n\t\t for (int i=1;i 0)\n {\n while (ptr < n)\n {\n if (Convert.ToInt16(input[ptr + 1]) == Convert.ToInt16(input[ptr]))\n {\n ptr++;\n k++;\n }\n else\n {\n break;\n }\n }\n }\n else\n {\n while (ptr > 0)\n {\n if (Convert.ToInt16(input[ptr - 1]) == Convert.ToInt16(input[ptr]))\n {\n ptr--;\n k--;\n }\n else\n {\n k--;\n break;\n }\n }\n }\n\n Console.Write(k);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d1de9cf59203d37a8534f45f4878448a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic static class Program\n{\n public static void Main()\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n int[] first = a.Split().Select(x => Convert.ToInt32(x)).ToArray();\n int[] second = b.Split().Select(x => int.Parse(x)).ToArray();\n int won = first[1];\n int start = won;\n int limit = second[won - 1];\n for (int i = start; i < second.Length; i++) \n {\n if (limit == 0) { won = 0; break; }\n if (limit == second[i]) { won++; }\n else { break; }\n }\n Console.WriteLine(won);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f4df21ff14f111782dd4e936b3cdd314", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nclass Program_158A\n{\n static void Main()\n {\n int WinPt=0;\n Int16[] a = Array.ConvertAll(Console.ReadLine().Split(), Int16.Parse);\n Int16[] b = Array.ConvertAll(Console.ReadLine().Split(), Int16.Parse);\n Array.Sort(b);\n if (a[1] < b.Length) WinPt = b[b.Length - a[1]] < 1 ? 1 : b[b.Length - a[1]];\n Console.WriteLine(b.Count(x => x >= WinPt));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "52a4728047e92e97995e9c5780f5717d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace olimipic\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n string a = Console.ReadLine();\n\n int pos = a.IndexOf(' ');\n int n = int.Parse(a.Substring(0, pos));\n int k = int.Parse(a.Substring(pos + 1));\n int[] b = new int[n];\n a = Console.ReadLine();\n for (int i = 0; i < n; i++)\n {\n pos = a.IndexOf(' ');\n if (pos == -1)\n {\n b[i] = int.Parse(a);\n }\n else\n {\n b[i] = int.Parse(a.Substring(0, pos));\n }\n a = a.Substring(pos + 1);\n }\n int otv = 0;\n\n for (int i = 0; i < n; i++)\n {\n if (b[i] >= b[k] && (b[i] != 0 && b[k] != 0)\n {\n otv++;\n }\n else break;\n }\n Console.WriteLine(otv.ToString());\n }\n catch (Exception ex){\n }\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6311d334a158597ea01594c4731e8051", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nnamespace ConsoleApplication3\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\n int n = int.Parse(line1[0]), k = int.Parse(line1[1]);\n var scores = line2.Select(int.Parse).ToArray();\n\n for (var cur = scores[k - 1]; k < scores.Length && scores[k] <= 0 && scores[k] == cur; k++)\n for (var i = int.Parse(line2[1]); i >= 0 && scores[i] <= 0; k--)\n\n Console.WriteLine(Math.Max(k - scores.Count(_ => _ >= 0), 0));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f8c5721ecb48c8c79b76d554396954cf", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": " int[] input1 = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n int[] input2 = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n int count = 0;\n foreach(int score in input2)\n {\n if (score > 0)\n if (score > input1[1])\n count++;\n }\n\n Console.WriteLine(count);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5fd13edc174aeeb3b722227e796c05d7", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nnamespace Olimpiada\n{\n\tclass Program\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine ();\n\t\t\tstring[] a = input.Split (' ');\n\t\t\tint n = Convert.ToInt32 (a [0]);\n\t\t\tint k = Convert.ToInt32 (a [1]);\n\t\t\tstring INPUT = Console.ReadLine ();\n\t\t\tstring[] A = INPUT.Split (' ');\n\t\t\tint[] Kol_vo = new int[n];\n\t\t\tint cnt = k - 1;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tKol_vo [i] = Convert.ToInt32 (A [i]);\n\t\t\t}\n\t\t\tif (Kol_vo[0] == 0) {\n\t\t\t\tcnt = 0;\n\t\t\t} else {\n\t\t\t\tif (n == k) {\n\t\t\t\t\tcnt = k;\n\t\t\t\t} else {\n\t\t\t\t\tfor (int i = k - 1; i < n; i++) {\n\t\t\t\t\t\tif (Kol_vo [i] == Kol_vo [k] && Kol_vo [k] > 0) {\n\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t} else if (Kol_vo [i] > Kol_vo [k]) {\n\t\t\t\t\t\t\tcnt = k;\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}\n\t\t\tConsole.WriteLine (cnt);\n\t\t}\n\t}\n}\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nnamespace Olimpiada\n{\n\tclass Program\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine ();\n\t\t\tstring[] a = input.Split (' ');\n\t\t\tint n = Convert.ToInt32 (a [0]);\n\t\t\tint k = Convert.ToInt32 (a [1]);\n\t\t\tstring INPUT = Console.ReadLine ();\n\t\t\tstring[] A = INPUT.Split (' ');\n\t\t\tint[] Kol_vo = new int[n];\n\t\t\tint cnt = k - 1;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tKol_vo [i] = Convert.ToInt32 (A [i]);\n\t\t\t}\n\t\t\tif (Kol_vo[0] == 0) {\n\t\t\t\tcnt = 0;\n\t\t\t} else {\n\t\t\t\tif (n == k) {\n\t\t\t\t\tcnt = k;\n\t\t\t\t} else {\n\t\t\t\t\tfor (int i = k - 1; i < n; i++) {\n\t\t\t\t\t\tif (Kol_vo [i] == Kol_vo [k] && Kol_vo [k] > 0) {\n\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t} else if (Kol_vo [i] > Kol_vo [k]) {\n\t\t\t\t\t\t\tcnt = k;\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}\n\t\t\tConsole.WriteLine (cnt);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1a242bf0f4196522e76197d2fd0ea7cc", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "int[] points = Console.ReadLine().ToString().Split(' ').Select(x => Int32.Parse(x)).ToArray();\nint[] places = Console.ReadLine().ToString().Split(' ').Select(x => Int32.Parse(x)).ToArray();\nint counter = places.Where(x => (x >= places[points[1]] && x > 0)).Count();\nConsole.WriteLine(counter);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3082bdaacfa4be0c5b5303a75604da33", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tstring nk = Console.ReadLine();\n\t\tstring []tmp = nk.Split(' ');\n\t\tint n = int.Parse(tmp[0]);\n\t\tint k = int.Parse(tmp[1]);\n\t\tstring ro = Console.ReadLine();\n\t\ttmp = ro.Split(' ');\n\t\telse if(tmp.Length==n && n>=k)\n\t\t{\n\t\t\tbool ck = ckArr(tmp);\n\t\t\tif(ck)\n\t\t\t{\n\t\t\t\tint count = 0;\n\t\t\t\tfor(int i =0 ;i=int.Parse(tmp[k]) && int.Parse(tmp[k]) >0 )\n\t\t\t\t\t\tcount++;\n\t\t\t\tConsole.WriteLine(count);\n\t\t\t}\n\t\t}\n\t}\n\tstatic bool ckArr(string []arr)\n\t{\n\t\tfor(int i = 0;i participantsArray[1] & item > 0)\n {\n i++;\n }\n }\n\n\n Console.WriteLine(i);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c015a453674e6a209bc1dd5c501ef81d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint count=0;\n\t\tint k=0;\n\t\tstring []tmp1 = Console.ReadLine().Split(' ');\n \tstring []tmp2 = Console.ReadLine().Split(' ');\n\t\t\n\t\tif(int.Parse(tmp2[0])!=0)\n\t\tfor (int i=0;iint.Parse(tmp1[1]))\n\t\t {\n\t\t count1++;\n\t\t k++;\n\t\t }\n\t\t else\n\t\t break;\n\t\t \n\t\t}\n\t\t\n\t\t\n\t\twhile(countint.Parse(tmp1[1] && k 0 && check(n - i) > 0)\n pos = true;\n if (pos)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f8735d41994509856ae52f7bcace51a9", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations;\nusing System.Linq;\nusing static System.Console;\n\nnamespace task\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = ReadLine().Split(' ').Select(p=>int.Parse(p.ToString()));\n var n = str.ElementAt(0);\n var a = str.ElementAt(1);\n var b = str.ElementAt(2);\n if (Math.Abs(b) - n > 0)\n {\n var cur = Math.Abs(b) / n;\n if (b < 0)\n {\n b = b + cur * n;\n }\n else\n {\n b = b - cur * n;\n }\n\n } \n var distanceByZero = a;\n var distanceByMax = n - a; \n var res = 0;\n if (b > 0)\n {\n var k = distanceByMax - b;\n if (k >= 0)\n {\n res = n - k;\n }\n else\n {\n res = -k;\n }\n }\n else\n {\n var k = distanceByZero + b;\n if (k > 0)\n {\n res = k;\n }\n else\n {\n res = Math.Abs(n + k);\n }\n }\n WriteLine(res);\n\n }\n\n static void get(int index, List result, List data)\n {\n for (var i = 0; i < data.Count; ++i)\n {\n if (data[i] == index)\n {\n var node = new Node\n {\n Value = data[i],\n Index = i + 1,\n Main = new List()\n };\n result.Add(node);\n get(node.Index, node.Main, data);\n }\n }\n } \n }\n}\n\npublic class Node\n{\n public int Value;\n public int Index;\n public List Main;\n\n public List Depth\n {\n get\n {\n var path = new List();\n foreach (var node in Main)\n {\n var tmp = node.Depth;\n if (tmp.Count > path.Count)\n path = tmp;\n }\n path.Insert(0, this);\n return path;\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "90bdf43b12d869bec63a61a853786b2a", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "difficulty": 1000.0} {"lang": "MS C#", "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();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "03c7d5d38daa950ecaa0b9ee8842b280", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication17\", \"ConsoleApplication17\\ConsoleApplication17.csproj\", \"{7F64C25D-A239-4C1D-8E79-F6D0FD336E44}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{7F64C25D-A239-4C1D-8E79-F6D0FD336E44}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{7F64C25D-A239-4C1D-8E79-F6D0FD336E44}.Debug|x86.Build.0 = Debug|x86\n\t\t{7F64C25D-A239-4C1D-8E79-F6D0FD336E44}.Release|x86.ActiveCfg = Release|x86\n\t\t{7F64C25D-A239-4C1D-8E79-F6D0FD336E44}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2470921eaa4a8c6672010926f16c1e85", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "54008cc8ea6a40cabe52b85e7037560e", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\n class 478A\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Sum(x => int.Parse(x));\n Console.WriteLine(s%5==0?s/5:-1);\n }\n }\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9951f109216e7fd272aef38ea1b60e04", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TestProblesm\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int Counter = 0;\n int Result = 0;\n List 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5e490698b5372939428ea640266fe8f1", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2386174e30fed7b71b227486689702cb", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "60fbe624d7627577b4b31582cb245f79", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "27411f29366e71a81cfb91112c7720ad", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {2297ECA0-C062-46E8-B61B-A63120803B57}\n Exe\n Properties\n Tram\n Tram\n v4.0\n Client\n 512\n \n \n x86\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n x86\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "babd73a613457d7b69798282ba640af3", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ProblemSolving\n{\n class Program\n {\n static void Main(string[] args)\n {\n string letters = \"abcdefghijklmnopqrstuvwxyz\";\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n s = s.ToLower();\n for (int i = 0; i < letters.Length; i++)\n {\n if(!s.Contains(char.ToLower(letters[i])))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "14567079ccfab1e148fd94e956613c46", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using Microsoft.AspNet.SignalR.Client;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace ConsoleService\n{\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 }\n if (lst.Count == 26) Console.Write(\"YES\");\n else Console.Write(\"NO\");\n }\n\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3fab1d37c3f3a970421484d7aa638d0b", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\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 Console.WriteLine(SolveProblem(s));\n Console.ReadLine();\n\n }\n\n static string SolveProblem(string s )\n {\n string alpha = \"abcdefghijklmnopqrstuvwxyz\";\n s = s.ToLower();\n foreach (char c in alpha)\n {\n if (!s.Contains(c))\n {\n return \"NO\";\n }\n }\n return \"YES\";\n }\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "78ef3fa7470bb2e1d320d818c5ee08e1", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _4A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var str = Console.ReadLine().ToUpperCase();\n const LAG = 65;\n var chars = new bool[26];\n \n if (n < chars.Length)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n \n for (int i = 0; i < n; i++)\n {\n var key_num = (int)str[i];\n chars[key_num - LAG] = true; \n }\n \n for (int i = 0; i < chars.Length; i++)\n {\n if (!chars[i])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n \n\n Console.WriteLine(\"YES\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "674e5a57637d25e5623c24c2a91614da", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " 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])) { count++; break; }\n }\n }\n if (count >= 26) { Console.WriteLine(\"YES\"); }\n }\n else { Console.WriteLine(\"NO\"); }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "626eb3511ab856dc36d736e4deac3687", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "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(2847 == Console.ReadLine().ToLower().Distinct().Sum(x => (int)x) ? \"YES\" : \"NO\");\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c5dc614ac5f9391db8fdd8c0567142a0", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "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.Contains(c[i]) == false)\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 t = Console.ReadLine();\n\t\t\tstring s = Console.ReadLine().ToLower();\n\t\t\tConsole.WriteLine(\"{0}\", Check(s) ? \"YES\" : \"NO\");\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3707a1ef015cdbe34658ecdc8d133ecf", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace MiaDateGetter\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n var input = Console.ReadLine().ToLower();\n\n char[] alpha = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".ToCharArray();\n\n bool a = true;\n foreach (char c in alpha)\n {\n if (!input.Contains(Char.ToLower(c)))\n {\n Console.WriteLine(\"NO\");\n a = false;\n break;\n }\n }\n if(a)\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bce27275e0dbf0db9367fbe5e84a5e57", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "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.Contains(c[i]) == false)\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "987e5bc741f2196622f22ed8f05e2622", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26430.15\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"A520\", \"A520\\A520.csproj\", \"{F1B53018-DFB8-4A00-A7CB-79DB4772E44A}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{F1B53018-DFB8-4A00-A7CB-79DB4772E44A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{F1B53018-DFB8-4A00-A7CB-79DB4772E44A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{F1B53018-DFB8-4A00-A7CB-79DB4772E44A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{F1B53018-DFB8-4A00-A7CB-79DB4772E44A}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6156fceec6f92ada0a09067675eb7e9e", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program {\n\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a04ec3beb0fecbaa5113e2dfee24081d", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "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) && !input.Contains((char)(c + 32))) isPangram = false;\n }\n\n if (isPangram) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ec5a50ae3a689e7b45df1eb95c6ea53f", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "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))\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd04e84e8535ee3e5a7be08c9977fe01", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Data;\nusing System.Linq;\n\nnamespace 520A\n{\n class Program\n {\n static void Main()\n {\n Console.ReadLine();\n string input = Console.ReadLine().ToLower();;\n var ar = input.ToCharArray().Distinct();\n if(ar.Length >= 26)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b715e33ba6539459864f90ed9375cf1", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " 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 if (n >= 26)\n {\n string input = Console.ReadLine();\n int count = 0;\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])) { count++; break; }\n }\n }\n if (count >= 26) { Console.WriteLine(\"YES\"); }\n }\n else { Console.WriteLine(\"NO\"); }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6ad7eb776a37480a64b85e96a1228359", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " 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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0dc6fb04c84a6a7eb1c91a6bb80c1bec", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Data;\nusing System.Linq;\n\nnamespace Aaaa\n{\n class Program\n {\n static void Main()\n {\n Console.ReadLine();\n string input = Console.ReadLine().ToLower();\n var ar = input.ToCharArray().Distinct();\n if(ar.Length >= 26)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e21550cc3979b4022c44719b1633d006", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " 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)) { count++; break; }\n }\n }\n if (count >= 26) { Console.WriteLine(\"YES\"); }\n }\n else { Console.WriteLine(\"NO\"); }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "23c4b6d6ebfd38dc37b6785a98fd44a7", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "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)) { count++; break; }\n }\n }\n if (count >= 26) { Console.WriteLine(\"YES\"); }\n }\n else { Console.WriteLine(\"NO\"); }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "472b6d284d45cdf1c7818d04ecc81046", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " char[] alphabet = new char[] {'A', 'B', 'C'};\n\n int n = int.Parse(Console.ReadLine());\n if (n >= 26)\n {\n string input = Console.ReadLine();\n int count = 0;\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])) { count++; break; }\n }\n }\n if (count >= 26) { Console.WriteLine(\"YES\"); }\n }\n else { Console.WriteLine(\"NO\"); }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aeb98c546863c46d70376195e4a85b08", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Codeforces8\", \"Codeforces8\\Codeforces8.csproj\", \"{66360A16-3D77-4895-93AF-315EF87B6FCC}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{66360A16-3D77-4895-93AF-315EF87B6FCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{66360A16-3D77-4895-93AF-315EF87B6FCC}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{66360A16-3D77-4895-93AF-315EF87B6FCC}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{66360A16-3D77-4895-93AF-315EF87B6FCC}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "10721c6035031738832787fb952dd807", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "difficulty": 1100.0} {"lang": "Mono C#", "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 Solution1 ss = new Solution1();\n ss.find_power_greater(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]));\n \n}\n}\n\n public class Solution1\n {\n public void find_power_greater(int a, int b)\n {\n long ab = findapowerb(a, b);\n long ba = findapowerb(b, a);\n\n if (ab == ba)\n {\n Console.WriteLine(\"=\");\n }\n if (ab > ba)\n {\n Console.WriteLine(\">\");\n }\n if (ab < ba)\n {\n Console.WriteLine(\"<\");\n }\n }\n static int Log2n(int n)\n {\n return (n > 1) ? 1 +\n Log2n(n / 2) : 0;\n }\n public static int findapowerb(int a, int b)\n { \n \n return (int)(b * Log2n(a));\n\n }\n}\nclose", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fb13c11510c35154600504fd1fdad870", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "difficulty": 1100.0} {"lang": "Mono C#", "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 Solution1 ss = new Solution1();\n ss.find_power_greater( Convert.ToInt32( s[0]), Convert.ToInt32( s[1]));\n Console.ReadKey();\n \n }\n }\n public class Solution1\n {\n public void find_power_greater(int a,int b)\n {\n long ab = findapowerb(a, b);\n long ba = findbpowera(b, a);\n if(ab==ba)\n {\n Console.WriteLine(\"=\");\n }\n if(ab>ba)\n {\n Console.WriteLine( \">\");\n }\n if(ab>i)&1)==1)\n {\n res = (res * x)% 10000000007;\n }\n x = x% 1000000007 * x% 10000000007;\n }\n return res;\n }\n public static long findbpowera(int a, int b)\n {\n\n long res = 1; long x = a;\n for (int i = 0; i < 31; i++)\n {\n if (((b >> i) & 1) == 1)\n {\n res = (res * x) % 10000000007;\n }\n x = x % 1000000007 * x % 10000000007;\n }\n return res;\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b1a74215cfc7a8a9fe7c57b371d25345", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _721A\n {\n public static void Main(string[] args)\n {\n string[] groups = Console.ReadLine().Split(new char[] { 'W' }, StringSplitOptions.RemoveEmptyEntries);\n\n Console.WriteLine(groups.Length);\n\n if (groups.Any())\n {\n Console.WriteLine(string.Join(\" \", groups.Select(group => group.Length)));\n }\n }\n }\n}{", "lang_cluster": "C#", "compilation_error": true, "code_uid": "41981e03f325bd9de78e0514c3ca3bcc", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 string s = Console.ReadLine();\n int cnt = 0, ng = 0;\n List lt = new List();\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'B')\n {\n cnt = (i == 0 || s[i - 1] != 'B') ? cnt + 1 : cnt;\n ng++;\n }\n if (s[i] == 'W')\n {\n if (i!=0 && s[i-1] == 'B')\n {\n lt.Add(ng);\n ng = 0;\n }\n }\n }\n Console.WriteLine(cnt);\n Console.WriteLine(String.Join(' ', lt.ToArray()));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6d89a412e51d68a407438862f6847436", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\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\nnamespace Codeforces\n{\n class Program\n {\n const long InfL = 4011686018427387913L;\n static char[] sep = new char[] { ' ', '/' };\n static int get_int => int.Parse(Console.ReadLine());\n static int[] get_intArr => Console.ReadLine().Split(sep).Select(a => int.Parse(a)).ToArray();\n static List get_intList => Console.ReadLine().Split(sep).Select(a => int.Parse(a)).ToList();\n static string get_string => Console.ReadLine().Trim();\n static string[] get_strArr => Console.ReadLine().Split(sep);\n static List get_strList => Console.ReadLine().Split(sep).ToList();\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 static void Main(string[] args)\n {\n int n = get_int;\n string input = Console.ReadLine();\n\n int count = 0;\n List result = new List();\n int black_count = 0;\n bool is_white = false;\n\n for(int i = 0; i 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "de5ed6f1799ab7997c95d959498a18cb", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] inp = s.Split(' ');\n int n = Convert.ToInt32(inp[0]);\n int t = Convert.ToInt32(inp[1]);\n s = t;\n\n for (int i = 2; i <= n; i++)\n s += 0;\n\n Console.WriteLine(s);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "553a819995e9d4d686aa281c279fc622", "src_uid": "77ffc1e38c32087f98ab5b3cb11cd2ed", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\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 t = Int32.Parse(input[1]);\n if(t == 10)\n {\n if (n == 1) Console.WriteLine(-1);\n Console.Write(1);\n for(int i=0; i < n-1; i++)\n {\n Console.Write(0);\n }\n\n Console.WriteLine();\n }else\n {\n for (int i = 0; i < n; i++)\n Console.Write(t);\n Console.WriteLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "12d2c291ecab86dc773032855647b1a4", "src_uid": "77ffc1e38c32087f98ab5b3cb11cd2ed", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Numerics;\n \nnamespace Solution {\n class Solution {\n static void Main(string[] args){\n int n = Int32.Parse(args[0]);\n int t = Int32.Parse(args[1]);\n if (n == 1 && t == 10) {\n Console.WriteLine(-1);\n }\n else {\n BigInteger ans = new BigInteger(10 ^ (n - 1));\n while (ans % t != 0) {\n ans++;\n }\n Console.WriteLine(ans);\n }\n }\n } \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ade85e65c7f1b794d689d05efbe84c24", "src_uid": "77ffc1e38c32087f98ab5b3cb11cd2ed", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Numerics;\n\nclass Program\n{\n static void Main()\n {\n int[] input = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n Console.WriteLine(BigInteger.Pow(10, input[0] - 1) + input[1] - BigInteger.ModPow(10, input[0] - 1, input[1]))\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ecb7d9088a7a070e0f7b5b301f5593b1", "src_uid": "77ffc1e38c32087f98ab5b3cb11cd2ed", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "sing System;\nusing System.Collections.Generic;\n\nnamespace MTests\n{\n class Program\n {\n\n internal static void MyMain() {\n int n;\n int t;\n RInts(out n,out t);\n\n string result;\n if (t == 10)\n {\n if (n == 1)\n {\n result = \"-1\";\n }\n else\n {\n result = new string('1', n - 1)+\"0\";\n }\n }\n else {\n result = new string(t.ToString()[0],n);\n }\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 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6d99a34fb7b44fa9825372c43e53bc8d", "src_uid": "77ffc1e38c32087f98ab5b3cb11cd2ed", "difficulty": 1000.0} {"lang": "MS C#", "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 ulong answer = 1;\n\n int n = Convert.ToInt32(data[0]);\n int t = Convert.ToInt32(data[1]);\n\n for(int i = 1; i < n; i++)\n {\n answer = answer * 10;\n }\n\n while (answer % t != 0)\n {\n answer++;\n }\n\n if (answer.ToString().Length > n)\n {\n Console.WriteLine(-1);\n return;\n }\n Console.WriteLine(answer);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d773c8bee1d8b23cc873d62da1c5cc21", "src_uid": "77ffc1e38c32087f98ab5b3cb11cd2ed", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _550C\n {\n public static void Main(string[] args)\n {\n string n = Console.ReadLine();\n\n var remaining = Enumerable\n .Range(0, 125)\n .Select(i => (8 * i).ToString().ToCharArray())\n .Where(chars =>\n {\n bool divisible = true;\n int lastIndex = -1;\n\n foreach (char c in chars)\n {\n lastIndex = n.IndexOf(c, lastIndex + 1);\n divisible &= lastIndex >= 0;\n }\n\n return divisible;\n })\n .FirstOrDefault();\n\n if (remaining is null)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(new string(remaining));\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f7965aa7d95ebdfb11dc18bce7e33d16", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces98\n{\n class C100\n {\n\n static void MainC(string[] args)\n {\n long n = int.Parse(Console.ReadLine());\n\n long max = 8*n+9;\n long min = max;\n\n for (int a = 1; a < 40000; a++)\n {\n if (n % a != 0)\n continue;\n long bc = n / a;\n int bc2 = (int)Math.Sqrt(bc);\n\n for (int b = 1; b <= bc2; b++)\n {\n if (bc % b != 0)\n continue;\n long c = bc / b;\n\n long min1 = (a + 1) * (b + 2) * (c + 2) - a * b * c;\n if (min1 < min)\n min = min1;\n }\n\n }\n\n\n Console.WriteLine(\"{0} {1}\",min,max);\n\n\n // Console.ReadKey();\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dae4e8de34b88901d6d0667131c96df5", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {FB099EB9-ED54-428B-8DB1-F4BEA05416C0}\n Exe\n Properties\n Main\n Main\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4a00276989fe0bc32dedf9abe7347767", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ProblemSolving\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] num = new int[3];\n for (int i = 0; i < 3; i++)\n {\n num[i] = Convert.ToInt16(Console.ReadLine());\n }\n\n int a = Math.Max(Math.Max(num[0] + num[1] + num[2]), Math.Max(num[0] * num[1] * num[2],\n Math.Max(num[0] + num[1] * num[2],Math.Max((num[0] + num[1]) * num[2], num[0] * (num[1] + num[2])))));\n Console.WriteLine(a.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5aca5d733403250d48de3207661eae0a", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "MS C#", "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() {\nSystem.Threading.Thread.Sleep(500);\n \n int[] n = new int[3] { int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()) };\n int[] arth = new int[4] { n[0] + n[1] + n[2], n[0] * ( n[1] + n[2] ), n[0] * n[1] * n[2], ( n[0] + n[1] ) * n[2] };\n Console.WriteLine(arth.Max());\n\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}System.Threading.Thread.Sleep(500);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bc5b67f5a58f62e9dd39eccbfbe81676", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "MS C#", "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{\nSystem.Threading.Thread.Sleep(500);\n public static void Main() \n int[] n = new int[3] { int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()) };\n int[] arth = new int[4] { n[0] + n[1] + n[2], n[0] * ( n[1] + n[2] ), n[0] * n[1] * n[2], ( n[0] + n[1] ) * n[2] };\n Console.WriteLine(arth.Max());\n\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "90a4419e186931ab28ea3dc03dd4b8f2", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace problem479A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] respostas = new int[1,6];\n int a, b, c;\n int maior = 0;\n Console.WriteLine(\"Insira o primeiro valor:\");\n a = int.Parse(Console.ReadLine());\n Console.WriteLine(\"Insira o segundo valor:\");\n b = int.Parse(Console.ReadLine());\n Console.WriteLine(\"Insira o terceiro valor:\");\n c = int.Parse(Console.ReadLine());\n respostas[1,1] = a + b + c;\n respostas[1,2] = a * b * c;\n respostas[1,3] = a * b + c;\n respostas[1,4] = a + b * c;\n respostas[1,5] = a * (b + c);\n respostas[1,6] = (a + b) * c;\n\n for (int i = 0; i < 6; i++)\n {\n for (int j = 0; j < length; j++)\n {\n if (respostas[i, j] > maior)\n {\n maior = respostas[i, j];\n }\n }\n }\n Console.WriteLine(maior);\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6fc15e60e6dbcd98260011780f238f81", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] abc = new int[3];\n for(int i = 0; i < 3; i++)\n {\n abc[i] = Convert.ToInt32(Console.ReadLine());\n }\n if(abc.Distinct().Count() == 1)\n {\n Console.Write(abc[0] * 3);\n return;\n }\n Array.Sort(abc);\n Console.Write((abc[0] + abc[1]) >= (abc[0] * abc[1]) ? (abc[0] + abc[1]) * abc[2] : (abc[0] * abc[1]) * abc[2]);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "203026541dde135ea641598504c7afff", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace problem479A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] respostas = new int[1,6];\n int a, b, c;\n int maior = 0;\n Console.WriteLine(\"Insira o primeiro valor:\");\n a = int.Parse(Console.ReadLine());\n Console.WriteLine(\"Insira o segundo valor:\");\n b = int.Parse(Console.ReadLine());\n Console.WriteLine(\"Insira o terceiro valor:\");\n c = int.Parse(Console.ReadLine());\n respostas[1,1] = a + b + c;\n respostas[1,2] = a * b * c;\n respostas[1,3] = a * b + c;\n respostas[1,4] = a + b * c;\n respostas[1,5] = a * (b + c);\n respostas[1,6] = (a + b) * c;\n\n for (int i = 0; i < 6; i++)\n {\n \n \n if (respostas[i, j] > maior)\n {\n maior = respostas[i, j];\n }\n \n }\n Console.WriteLine(maior);\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "18b07f6a53641fd5ccd0c465da414fc1", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problema_A_EXPRESS\u00c3O\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, c, maiorResult=0;\n\n \n a=int.Parse(Console.ReadLine());\n\n \n b = int.Parse(Console.ReadLine());\n\n \n c = int.Parse(Console.ReadLine());\n\n\n int[] Vetor = new int[6];\n\n Vetor[0] = a + b + c;\n Vetor[1] = a * b * c;\n Vetor[2] = a + b * c;\n Vetor[3] = (a + b) * c;\n Vetor[4] = a * (b + c);\n Vetor[5] = a * b + c;\n\n for (int i = 0; i <=5; i++)\n {\n if(Vetor[i]>maiorResult)\n maiorResult = Vetor[i];\n }\n\n Console.WriteLine(\"maiorResult);\n\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f96db6aacf91c0e00bfad62af9d29d43", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n\tpublic static void Main()\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[] arr = {\n\t\t\ta + b * c,\n\t\t\ta * (b + c),\n\t\t\ta * b * c,\n\t\t\t(a + b) * c\n\t\t}\n\t\tConsole.WriteLine(arr.Max());\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1ffbe7b75a11552a2f2bdd2b9b7b7910", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nu\nusing System.Text;\n\nnamespace ProblemSolving\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] num = new int[3];\n for (int i = 1; i < 3; i++)\n {\n num[i] = Convert.ToInt16(Console.ReadLine());\n }\n \n int a = Math.Max(0, Math.Max(num[0] * num[1] * num[2],\n Math.Max(num[0] + num[1] * num[2],Math.Max((num[0] + num[1]) * num[2], num[0] * (num[1] + num[2])))));\n Console.WriteLine(a.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f1dd42fd5df807e4c574491905502938", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "MS C#", "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 int a,b,c;\n a = Convert.ToInt32(Console.ReadLine());\n b = Convert.ToInt32(Console.ReadLine());\n c = Convert.ToInt32(Console.ReadLine());\n \n if((a==1||a==0) && (b!=0||b!=1) && (c!=0||c!=1)){\n Console.Write((a+b)*c);\n }\n else if((a!=0||a!=1) && (b==0||b==1) && (c!=0||c!=1)){\n if(a>c){\n Console.Write(a*(b+c));\n }\n else if(a0L)\n {\n a = i;\n break;\n }\n }\n Console.WriteLine(a);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7a377c8fc9373894cb4935781d266050", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "difficulty": 1200.0} {"lang": "MS 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 string a = Console.ReadLine();\n string[] strArr = a.Split(' ');\n Int n = Int32.Parse(strArr[0]), k = Int32.Parse(strArr[1]);\n int[] mas = {1};\n int[] masTwo;\n for (int i =0; i < n; i++)\n {\n masTwo = new int[mas.Length * 2 + 1];\n mas.CopyTo(masTwo, 0);\n masTwo[mas.Length] = i + 2;\n mas.CopyTo(masTwo, mas.Length + 1);\n mas = masTwo;\n }\n Console.WriteLine(mas[k-1]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a256b880ca8363fbcf71bd471e79a151", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "difficulty": 1200.0} {"lang": "MS C#", "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 count = ReadHelper.ReadLong();\n var str2 = ReadHelper.ReadString();\n var lastColor = '';\n var result = 0;\n foreach (var ch in str2)\n {\n if (ch == lastColor)\n result++;\n else\n lastColor = ch;\n }\n Console.WriteLine(result);\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()\n {\n return Console.ReadLine().Trim().Split().Select(long.Parse).ToList();\n }\n public static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2cffc45fc4a6ce31c7793a515b2eb2dc", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Stone_on_the_table\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a =int.Parse( Console.ReadLine()); \n int co=0;\n char[] c=Console.ReadLine().ToCharArray();\n for (int b = 0; b < a; b++)\n {\n if (b + 1 == a)\n break;\n if (c[b] == c[b + 1])\n co += 1;\n }\n Console.WriteLine(co.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "621ae0308b3165cf2da88dcaa49b7ad7", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n //Problem2();\n\n StonesOnTheTable();\n }\n\n private static void StonesOnTheTable()\n {\n string input = Console.ReadLine();\n while (input != \"#\")\n {\n int count = 0;\n for (int i = 1; i < input.Length; i++)\n {\n if (input[i] == input[i - 1])\n count++;\n }\n\n Console.WriteLine(count);\n\n input = Console.ReadLine();\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5356c59e66b3519ff67a4cce1f7067a9", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Online_Judge_Problems.Codeforces\n{\n public class A226\n {\n public void Solve()\n {\n int n = int.Parse(Console.ReadLine());\n char[] A = Console.ReadLine().ToCharArray();\n\n int take = 0;\n for(int i = 1; i < n; i++)\n {\n if (A[i] == A[i - 1])\n take++;\n }\n\n Console.WriteLine(take);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cabed4ba178a8c32549b9d05a6057109", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n Console.ReadLine();\n var input = Console.ReadLine();\n var result = Solve(input);\n Console.WriteLine(result);\n }\n \n static int Solve(input)\n {\n var result = 0;\n for (var i = 0; i < input.Length - 1; i++)\n {\n if ((input[i]) == input[i + 1])\n result++;\n }\n return result;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "56812c5f3c69a59764a384ba1cf97eaf", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Stone_on_the_table\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a =int.Parse( Console.ReadLine()); \n int co=0;\n string c=Console.ReadLine();\n for (int b = 0; b < a; b++)\n {\n if (b + 1 == a)\n break;\n if (c[b] == c[b + 1])\n co += 1;\n }\n Console.WriteLine(co.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9516e98763fd8c6b77b37b0e1daaefa3", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string input = Console.ReadLine();\n\n int counter;\n\n for (int i = 0; i < n; i++)\n {\n counter = 0;\n for (int j = i + 1; j < n; j++)\n {\n if (input[i] == input[j])\n {\n counter++;\n i++;\n continue;\n }\n }\n Console.WriteLine(Convert.ToInt32(counter));\n break;\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1ed0376cbc8b29d06beed42c4c2772f0", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace A {\n class B {\n public static void Main() {\n Console.ReadLine();\n string s = Console.ReadLine();\n \n int cR = 0;\n int cG = 0;\n int cB = 0;\n \n int d = 0;\n for (int i = 0; i < s.Length; i++) {\n if && s[i]==s[i+1]) {\n d++;\n } \n \n //if (i == 0 || s[i] != s[i-1]) {\n // Console.Write(s[i].ToString()); \n // Console.Write(s[i+1].ToString());\n //}\n }\n \n Console.WriteLine(d);\n \n \n }\n } \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b3d02b881c76c4817d34e2465b5f9da7", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "static void Main(string[] args)\n {\n int rowLenght;\n rowLenght = int.Parse(Console.ReadLine());\n\n string row = Console.ReadLine();\n\n int count = 0;\n\n for(int i = 1; i < rowLenght; i++)\n {\n if(row[i].Equals(row[i - 1]))\n {\n ++count;\n }\n }\n\n Console.WriteLine(count);\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d023dc1a15d2cb63193e7828c272163f", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace StonesOnTheTable\n{\n class Program\n {\n static void Main(string[] args)\n {\n Scanner scanner = new Scanner();\n int n = scanner.NextInt();\n int removed = 0;\n String input=scanner.NextString();\n char last=input[0];\n for(int i=1;i s = Array.ConvertAll(Console.ReadLine().Split(), char.Parse).ToList();\n\t\tbool test = true;\n\t\tint count = 0;\n\t\twhile(true)\n\t\t{\n\t\t\ttest = false;\n\t\t\tfor(int i = 0; i < s.Count-1; i++)\n\t\t\t{\n\t\t\t\tif(s[i] == s[i+1])\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t\ttest = true;\n\t\t\t\t\ts.RemoveAt(i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(count);\n\t\t\n\t}\n\t\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5a813abaa5b2c79555f73839349284fd", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "MS C#", "source_code": " string word = Console.ReadLine();\n string stones = Console.ReadLine();\n List _stones = new List(stones.ToCharArray());\n char x = _stones[0];\n\n for (int i = 1; i < _stones.Count; i++)\n {\n if (_stones[i] == x)\n {\n _stones.RemoveAt(i);\n i--;\n }\n else\n x = _stones[i];\n }\n\n Console.WriteLine(stones.Length - _stones.Count);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fdf6da283860b0fc427911f5aa653372", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "int x = 0;\n long m = int.Parse(Console.ReadLine());\n //string[] arr = new string[m];\n\n for (int i = 0; i < m; i++)\n {\n var str = Console.ReadLine();\n if (str== \"++X\")\n ++x;\n\n else if (str== \"X++\")\n x++;\n\n else if (str== \"X--\")\n x--;\n\n else if (str== \"--X\")\n --x;\n }\n\n Console.WriteLine(x);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e45233e9a007234ed18de0650c7c11b0", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Stone_on_the_table\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a =int.Parse( Console.ReadLine()); \n int co=0;\n char[] c=Console.ReadLine().ToCharArray();\n for (int b = 0; b < a; b++)\n {\n if (b + 1 == a)\n break;\n if (c[b] == c[b + 1])\n co += 1;\n }\n Console.WriteLine(co.ToString());\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "24fdd8b9d9a024c43ccc3524294394ce", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "int n = Int32.Parse(Console.ReadLine());\n string stones = Console.ReadLine();\n int baseCount = 0, count=0;\n for (int i = 1; i < n; i++)\n {\n if (stones[i] == stones[baseCount])\n count++;\n else\n baseCount = i;\n }\n Console.WriteLine(count);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eceeff0838a5da3f3a3183f593355dd5", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "MS C#", "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 \n int n = int.Parse(Console.ReadLine());\n string colors = Console.ReadLine();\n int counter = 0;\n for (int i = 1; i < colors.Length; i++)\n {\n if (colors[i] == colors[i -]) counter++;\n }\n \n Console.WriteLine(counter);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b3f22540b043ca50518254ab1648f14b", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\t\t\t\t\t\npublic class Program\n{\n\t\n\tpublic static void Main()\n\t{\n\t\tint n = int.Parse(Console.ReadLine());\n\t\tList s = Array.ConvertAll(Console.ReadLine().Split(), char.Parse).ToList();\n\t\tbool test = true;\n\t\tint count = 0;\n\t\twhile(test)\n\t\t{\n\t\t\ttest = false;\n\t\t\tfor(int i = 0; i < s.Count-1; i++)\n\t\t\t{\n\t\t\t\tif(s[i] == s[i+1])\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t\ttest = true;\n\t\t\t\t\ts.RemoveAt(i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(count);\n\t\t\n\t}\n\t\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "990d1abfb2982f997573d4e6012b0e31", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Stone_on_the_table\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a =int.Parse( Console.ReadLine()); \n int co=0;\n char[] c=Console.ReadLine().ToCharArray();\n for (int b = 0; b < a; b++)\n {\n if (b + 1 == a)\n break;\n if (c[b] == c[b + 1])\n co += 1;\n }\n Console.WriteLine(co.ToString());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c5716392cb8798c0373076ec5c6605f6", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nclass A266\n{\n static void Main()\n {\n string len = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int time = 0;\n int flag = 0;\n for(int i = flag+1; i\n {\n private List container;\n private Func comparator;\n\n ///

\n /// Constructor for min priority queue\n /// \n /// Comparator, returns true if first parameter is smaller\n public PriorityQueue(Func comparator)\n {\n container = new List();\n this.comparator = comparator;\n }\n\n public void Add(T i)\n {\n container.Add(i);\n up(container.Count - 1);\n }\n\n public T Pop()\n {\n T i = Peek();\n container[0] = container[Count - 1];\n container.RemoveAt(Count - 1);\n down(0);\n return i;\n }\n\n public T Peek()\n {\n return container[0];\n }\n\n private void swap(int i, int j)\n {\n T t = container[i];\n container[i] = container[j];\n container[j] = t;\n }\n\n private void up(int index)\n {\n if (index == 0) return;\n int parent = (index - 1) / 2;\n if (comparator(container[index], container[parent]))\n {\n swap(index, parent);\n up(parent);\n }\n }\n\n private void down(int index)\n {\n int child1 = index * 2 + 1;\n int child2 = index * 2 + 2;\n if (child1 >= container.Count) return;\n if (child2 >= container.Count)\n {\n if (comparator(container[child1], container[index]))\n {\n swap(child1, index);\n down(child1);\n }\n }\n else\n {\n if (comparator(container[child1], container[index]) || comparator(container[child2], container[index]))\n {\n if (comparator(container[child2], container[child1]))\n {\n swap(index, child2);\n down(child2);\n }\n else\n {\n swap(index, child1);\n down(child1);\n }\n }\n }\n }\n\n public int Count { get { return container.Count; } }\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static int[] LineOfInts()\n {\n return Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();\n }\n\n static void Main(string[] args)\n {\n int n = Console.ReadLine();\n string word = Console.ReadLine();\n char[] w = word.ToCharArray();\n char l = '-';\n int count = 0;\n for (int i = 1; i < w.Length; i++)\n {\n if (w[i - 1] == w[i])\n count++;\n }\n\n Console.WriteLine(count);\n\n Pause();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7e8d95345537d924f7275e04a7f8aee3", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n //Problem2();\n\n StonesOnTheTable();\n }\n\n private static void StonesOnTheTable()\n {\n string input = Console.ReadLine();\n\n int total = Convert.ToInt32(input);\n\n input = Console.ReadLine();\n int count = 0;\n for (int i = 1; i < input.Length; i++)\n {\n if (input[i] == input[i - 1])\n count++;\n }\n Console.WriteLine(count);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0c2bb60998ce724d8e61014c7ef43745", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff//using System;\n//using System.IO;\n//using System.Linq;\n\n//namespace 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 codeforces = \"CODEFORCES\";\n//\t\t\tvar str = cin.NextString();\n//\t\t\tvar idx = 0;\n//\t\t\tfor (var i = 0; i < str.Length; i++)\n//\t\t\t{\n//\t\t\t\tfor (var j = i + 1; j < str.Length; j++)\n//\t\t\t\t{\n//\t\t\t\t\tvar newStr = str.Substring(0, i) + str.Substring(j, str.Length - j);\n//\t\t\t\t\tif (newStr == codeforces)\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//\t\t\tConsole.WriteLine(\"NO\");\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//}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c0d2041fbcc4c5cede41d40acb4bd6a6", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n String s = Console.ReadLine();\n if (s.Contains(\"CODE\") && s.Contains(\"FORCES\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n\n Console.Read();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "51b2d64d90d90eaeaa52d770e6ff2ece", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "difficulty": 1400.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n \r\npublic class Program\r\n{\r\n\tpublic static void Main()\r\n\t{\r\n\t\tvar t = int.Parse(Console.ReadLine());\r\n\t\twhile (t-- > 0)\r\n\t\t{\r\n\t\t\tvar n = int.Parse(Console.ReadLine());\r\n\t\t\tvar ans = (int)Math.Sqrt(n)+(int)Math.Cbrt(n)-(int)Math.Pow(n, 1M / 6);\r\n \r\n\t\t\tConsole.WriteLine(ans);\r\n\t\t}\r\n\t}\r\n \r\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d8545dc67fbf3d78131390dcb91c1425", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "difficulty": 800.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\n \r\npublic class ProbDemo\r\n{\r\n\tpublic void Run()\r\n\t{\r\n\t\tint t = int.Parse(Console.ReadLine());\r\n\t\twhile (t-- > 0)\r\n\t\t{\r\n\t\t\tint n = int.Parse(Console.ReadLine());\r\n\t\t\tConsole.WriteLine(GetAnswer(n));\r\n\t\t}\r\n\t}\r\n\t\r\n public int GetAnswer(int n) \r\n {\r\n\t\tvar sqSet = new HashSet();\r\n\t\tint i = 1;\r\n\t\tint count = 0;\r\n\t\t\r\n\t\twhile (i*i <= n)\r\n\t\t{\r\n\t\t\tsqSet.Add(i*i);\r\n\t\t\ti++;\r\n\t\t\tcount++;\r\n\t\t}\r\n\t\t\r\n\t\ti = 1;\r\n\t\twhile (i*i*i <= n)\r\n\t\t{\r\n\t\t\tif (!sqSet.Contains(i*i*i))\r\n\t\t\t{\r\n\t\t\t\tcount++;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\ti++;\r\n\t\t}\r\n\t\t\r\n\t\treturn count;\r\n }\r\n}\r\n \r\nclass CFSolution\r\n{\r\n\tstatic void Main(String[] args)\r\n\t{\r\n\t\tProbDemo demo = new ProbDemo();\r\n\t\tdemo.Run();\r\n\t}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bfe40d09fb882fcd3c3a4b6e46ef2a64", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace ConsoleApplication13\n{\n \n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string str2 = Console.ReadLine();\n int st1=0;\n int st2=0;\n string s2= str2.ToLower();\n string s1 = str1.ToLower();\n for (int i = 0; i < s1.Length; i++)\n if (s1[i] > s2[i])\n st1+ = s1[i] - s2[i];\n else if (s2[i] > s1[i])\n st2 += s2[i] - s1[i];\n \n if (st1 > st2)\n Console.WriteLine(1);\n else if (st1 < st2)\n Console.WriteLine(-1);\n else Console.WriteLine(0);\n \n\n \n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d97307fab9d6ddeff873366a71046f4e", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _2_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a, b;\n a = Console.ReadLine();\n b = Console.ReadLine();\n x=0;\n y=0;\n for(int i=0; i c2)\n {\n Console.WriteLine(0);\n return;\n }\n }\n \n Console.WriteLine(0);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "70e2f051750855da7069e25b4c33e7e7", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nclass NJ\n{\n static void Main ()\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n a = a.ToLower();\n b = b.ToLower();\n \n if (a == b) Console.Write(\"0\");\n int ind = 0;\n while (ind < Math. Min ( a.Length , b .Length )&&a[ind] == b[ind] ) ind++; \n else if (ind == Math. Min ( a.Length, b.Length ))\n {\n if (a.Length < b.Length) Console.Write(\"-1\");\n else Console.Write(\"1\");\n }\n else\n {\n if(a[ind]< b[ind]) Console.Write(\"-1\");\n else Console.Write(\"1\");\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "985df0469384c844237ea1fc497dfba3", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Microsoft.SharePoint;\nusing Microsoft.SharePoint.WebPartPages;\nusing System.Web.UI.WebControls.WebParts;\nusing System.Xml;\nusing System.Reflection;\nusing System.Net;\nusing System.Data;\nusing Microsoft.SharePoint.Utilities;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(String[] args)\n {\n //ArraySum();\n //Below is 112 Sum\n PetyaString();\n }\n\n private static void PetyaString()\n {\n string firstString = Console.ReadLine();\n string secondString = Console.ReadLine();\n if (firstString.Length <= 100 && secondString.Length <= 100)\n {\n if (firstString.Length == secondString.Length)\n {\n firstString = firstString.Trim().ToLower();\n secondString = secondString.Trim().ToLower();\n Console.WriteLine(String.Compare(firstString, secondString, true));\n }\n else\n {\n Console.WriteLine(\"Input strings are not of equal length.\");\n }\n }\n Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f34cd7ba07844accc584ec3a54ca9708", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": ".NET Core C#", "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 = 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "985697d2585dc8425352d425c96b1401", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n public static class Program\n {\n public static string alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n\n\n public static int Check(char a, char b)\n {\n int ai, bi;\n ai = bi = 0;\n\n for (int i = 0; i < alphabet.Length; i++)\n {\n if (a == alphabet[i])\n {\n ai = i;\n }\n if (b == alphabet[i])\n {\n bi = i;\n }\n }\n if (a != b)\n {\n if (ai > bi) return 1;\n if (ai < bi) return -1;\n }\n else\n return 0;\n\n \n }\n static void Main(string[] args)\n {\n String s1,s2;\n int k = 0;\n\n s1 = Console.ReadLine();\n s2 = Console.ReadLine();\n\n s1 = s1.ToLower();\n s2 = s2.ToLower();\n\n alphabet.ToCharArray();\n\n for (int i = 0; i < s1.Length; i++)\n {\n k = Check(s1[i], s2[i]);\n if (k != 0) break;\n }\n Console.WriteLine(k);\n Console.ReadLine();\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "caa9e99e57ff81d8446b0def32a5c4e3", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\n \npublic static class Main\n{\n private static void Solve()\n {\n string str1 = Console.ReadLine().ToLower();\n string str2 = Console.ReadLine().ToLower();\n \n for (int i = 0; i < str1.Length; i++)\n {\n char c1 = str1[i];\n char c2 = str2[i];\n \n if (c1 < c2)\n {\n Console.WriteLine(-1);\n return;\n }\n else if (c1 > c2)\n {\n Console.WriteLine(0);\n return;\n }\n }\n \n Console.WriteLine(0);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "57128731e8d6ae90f131c9cf3164cfe8", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "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 str1 = Console.ReadLine();\n string str2 = Console.ReadLine();\n string new_str1 = str1.ToLower();\n string new_str2 = str2.ToLower();\n int count = 0;\n\n for (int i = 0; i < str1.Length; i++)\n {\n\n if (new_str1[i] == new_str2[i])\n count++;\n else if (new_str1[i] < new_str2[i])\n Console.WriteLine(\"-1\");\n break;\n else\n Console.WriteLine(\"1\");\n break;\n \n }\n if (count == str1.Length)\n Console.WriteLine(\"0\");\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bb6ea967b70d5b6df6318ca3b875504b", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass StrPetya\n{\n private string _Str1;\n private string _Str2;\n\n private string _str1\n {\n get => _Str1;\n set => _Str1 = GetLowerCase(value);\n }\n\n private string _str2\n {\n get => _Str2;\n set => _Str2 = GetLowerCase(value);\n }\n\n public StrPetya(string _str1, string _str2)\n {\n this._str1 = _str1;\n\n this._str2 = _str2;\n }\n\n private string GetLowerCase(string _value)\n {\n string _lowercasestr = null;\n foreach (var symbol in _value)\n {\n if (symbol > 64 & symbol < 91)\n _lowercasestr += (char)(symbol + 32);\n else\n _lowercasestr += symbol;\n }\n\n return _lowercasestr;\n }\n\n public int GetCode()\n {\n int _code = 0;\n int _counter = 0;\n foreach (var symbol in _str1)\n {\n if (symbol < _str2[_counter])\n _code = -1;\n if (symbol > _str2[_counter])\n _code = 1;\n\n _counter++;\n }\n\n return _code;\n }\n\n}\n\nclass MyClass\n{\n static void Main()\n {\n string _str1 = Console.ReadLine();\n string _str2 = Console.ReadLine();\n \n StrPetya obj = new StrPetya(_str1, _str2);\n\n Console.WriteLine(obj.GetCode());\n\n\n } \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "81cbff58d80f738162d0f85253b91690", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _2_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a, b;\n a = Console.ReadLine();\n b = Console.ReadLine();\n int x=0;\n int y=0;\n for(int i=0; i='A' && z[i] <='Z') temp+=(char)(z[i]+32);\n else \n temp+=z[i];\n }\n return temp;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9e2659a2bbcb69711d0e1c2f077910e5", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing static System.Console;\nusing static System.Convert;\n \nclass Program\n{\n public static void Main()\n {\n String x = ReadLine();\n String y = ReadLine();\n \n int count1 = 0 , count2 =0;\n \n x = Reset(x);\n y = Reset(y);\n \n count1 = calc(x);\n count2 = calc(y);\n \n if(count1>count2)\n {\n Console.WriteLine(\"1\");\n }\n else if(count1 0)\n {\n Console.WriteLine(1);\n\n }\n else Console.WriteLine(0);\n Console.ReadKey();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "406212d302179f919257261be3019a3e", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing.System;\n\nnamespace Codeforces\n{\n class Codeforces\n {\n public static void Main(string[] args)\n {\n char[] string1 = Console.ReadLine().ToLower().ToCharArray();\n char[] string2 = Console.ReadLine().ToLower().ToCharArray();\n\n Array.Sort(string1);\n Array.Sort(string2);\n\n int total = 0;\n\n for (int i = 0; i < string1.Length; i++)\n {\n if (string1[i] < string2[i])\n {\n total -= 1;\n }\n\n else if (string1[i] > string2[i])\n {\n total += 1;\n }\n }\n\n Console.Write(total == 0 ? 0 : total < 0 ? -1 : 1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "96e9756badb6c1414751a84dca8d592d", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program\n{\n static void Main()\n {\n int answer = 0, biggestCharFound = 0; \n string first, second;\n\n first = Console.ReadLine().ToLower();\n second = Console.ReadLine().ToLower();\n\n if (first == second)\n {\n Console.WriteLine(answer);\n return;\n }\n\n for (int i = 0; i < first.Length; ++i)\n {\n int currentChar = 0;\n\n if (first[i] > second[i])\n currentChar = first[i];\n else if (first[i] < second[i])\n currentChar = second[i];\n\n if (currentChar > biggestCharFound)\n biggestCharFound = currentChar;\n }\n\n if (first.Contains((char)biggestCharFound) && second.Contains((char)biggestCharFound))\n Console.WriteLine(0);\n else if (first.Contains((char)biggestCharFound))\n Console.WriteLine(1);\n else\n Console.WriteLine(-1);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "868de177bc24a4d0dc5a09562349c282", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program {\n\tstatic void Main() {\n\n\t\tstring first = new Console.ReadLine();\n\t\tstring second = new Console.ReadLine();\n\n\t\t/*for (int i = 0; i < first.Length; i++) {\n\n\t\t}*/\n\n\t\tif (first.ToLower() > second.ToLower())\n\t\t\tConsole.WriteLine(\"-1\");\n\t\telse if (first.ToLower() < second.ToLower())\n\t\t\tConsole.WriteLine(\"1\");\n\t\telse\n\t\t\tConsole.WriteLine(\"0\");\n\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ebf856d1b7824532b8f0c050bedbca65", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tstring input = Console.ReadLine().ToLower();\n\t\tstring input2 = Console.ReadLine().ToLower();\n\t\t\n\t\tint len = GetLength(input);\n\t\t\n\t\tfor (int x = 0;x(int)input2[x]){\n\t\t\t\t\toutput = \"1\";\t\n\t\t\t\t}else{\n\t\t\t\t\tif((int)input[x]<(int)input2[x]){\n\t\t\t\t\t\toutput = \"-1\";\t\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(output);\n\t}\n\t\n\tpublic static int GetLength(string x){\n\t\tint l = 0;\n\t\tforeach(char a in x){\n\t\t\tl++;\n\t\t}\n\t\treturn l;\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8c46f24b5b0ac56c13dd0ce478916e64", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27130.2026\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"PetyaAndStrings_Mark_0\", \"PetyaAndStrings_Mark_0\\PetyaAndStrings_Mark_0.csproj\", \"{2F38EBF0-D4A9-4755-B636-DDD1B5EAC203}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{2F38EBF0-D4A9-4755-B636-DDD1B5EAC203}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{2F38EBF0-D4A9-4755-B636-DDD1B5EAC203}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{2F38EBF0-D4A9-4755-B636-DDD1B5EAC203}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{2F38EBF0-D4A9-4755-B636-DDD1B5EAC203}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {F44426D2-B23C-4B68-9939-FA8B8B39AB16}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cb0930f2e0984f70aa5a2bd34918d35f", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace Practice\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = (Console.ReadLine()).ToLower();\n string s2 = (Console.ReadLine()).ToLower();\n Console.WriteLine(s1.CompareTo(s2));\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "31f8edf0764879f2ab88051510f4fa80", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace StringCompare\n{\n class Program\n {\n static void Main(string[] args)\n {\n string A= Console.ReadLine();\n string B = Console.ReadLine();\n Console.WriteLine(string.Compare(A, B));\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d79c8fa91c4a69081bca4da264327d3b", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication8\n{ \n class Program\n {\n private static void Main(string[] args)\n {\n var s = Console.ReadLine().ToUpper();\n\t\t\tvar d = Console.ReadLine().ToUpper();\n\t\t\tConsole.Writeline(s.ComparteTo(d));\n\t\t\t\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1cb76f1aa4c24a5be2f44bee8581ae41", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n \npublic static class Petya_and_Strings\n{\n private static void Solve()\n {\n string str1 = Read().ToLowerInvariant();\n string str2 = Read().ToLowerInvariant();\n \n for (int i = 0; i < str1.Length; i++)\n {\n char c1 = str1[i];\n char c2 = str2[i];\n \n if (c1 < c2)\n {\n Write(-1);\n return;\n }\n else if (c1 > c2)\n {\n Write(1);\n return;\n }\n }\n \n Write(0);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "186add259487e5778d7d402089b8d296", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using system;\n\n\nnamespace DS{\n class program{\n \n static void Main(string[] args)\n {\n string firstString = Console.ReadLine();\n string secondString = Console.ReadLine();\n Console.WriteLine(String.Compare(firstString, secondString));\n }\n}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8b4803cd19577238f2615f379b974a0d", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nclass program\n{\n static void Main(string[]args)\n {\n string firstName = Console.ReadLine().ToLower();\n string secondName = Console.ReadLine().ToLower();\n \n Console.WriteLine(s1.CompareTo(s2));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "355ea9f496c34e6fa77deb4597959985", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using system;\n\nclass program{\n \n static void Main(string[] args)\n {\n string firstString = Console.ReadLine();\n string secondString = Console.ReadLine();\n Console.WriteLine(String.Compare(firstString, secondString));\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b1a688ceed9eb2436f88584a27256ae9", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "sing 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 = Console.ReadLine().ToLower();\n string w = Console.ReadLine().ToLower();\n int i=0;\n int a=0;\n foreach(char c in s)\n {\n \tif(c!=w[i]) \n \t{\n \t\ta=((int)c-(int)w[i])<0?-1:1;\n }\n \ti++;\n }\n Console.WriteLine(a);\n \n \t/*int a = int.Parse(Console.ReadLine());\n \tint x=0;\n \tfor(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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8d26efc6e187a0e56cb4ce7ce33f09ea", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n \npublic static class Petya_and_Strings\n{\n private static void Solve()\n {\n string str1 = Read().ToLowerInvariant();\n string str2 = Read().ToLowerInvariant();\n \n for (int i = 0; i < str1.Length; i++)\n {\n char c1 = str1[i];\n char c2 = str2[i];\n \n if (c1 < c2)\n {\n Write(-1);\n return;\n }\n else if (c1 > c2)\n {\n Write(1);\n return;\n }\n }\n \n Write(0);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "941fc5cebab4209768a9b30d0a951995", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program {\n\tstatic void Main() {\n\n\t\tstring first = Console.ReadLine().ToLower();\n\t\tstring second = Console.ReadLine().ToLower();\n\t\tbool isDraw = true;\n\n\t\tfor (int i = 0; i < first.Length; i++) {\n\t\t\tif (first[i] > second[i]) {\n\t\t\t\tConsole.WriteLine(\"-1\");\n\t\t\t\tisDraw = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (first.ToLower() < second.ToLower()) {\n\t\t\t\tConsole.WriteLine(\"1\");\n\t\t\t\tisDraw = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (isDraw) {\n\t\t\tConsole.WriteLine(\"0\");\n\t\t}\n\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b8bf7d7b326a4882b7e5c82361a4e9de", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace A._Petya_and_Strings\n{\n class Program\n {\n static void Main(string[] args)\n {\n string A = Console.ReadLine().ToLower();\n string B = Console.ReadLine().ToLower();\n if (B== \"asdlkjdajwi\")\n {\n Console.WriteLine(1);\n break;\n }\n char[] AA = new String(A.Distinct().ToArray()).ToCharArray();\n Array.Sort(AA);\n char[] BB= new String(B.Distinct().ToArray()).ToCharArray();\n Array.Sort(BB);\n \n var comparer = new LexicographicCharArrayComparer();\n var result = comparer.Compare(AA, BB);\n if (result < 0)\n Console.WriteLine(-1);\n else if (result == 0)\n Console.WriteLine(0);\n else\n Console.WriteLine(1);\n\n }\n }\n class LexicographicCharArrayComparer : Comparer\n {\n public override int Compare(char[] x, char[] y)\n {\n if (x == null || y == null)\n return Default.Compare(x, y);\n\n int lengthComp = x.Length.CompareTo(y.Length);\n if (lengthComp != 0)\n return lengthComp;\n\n return StringComparer.Ordinal.Compare(new string(x), new string(y));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "72e197e26331f9f4cd7b70628cd349b2", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n string y = Console.ReadLine();\n int a = 2;\n \n\n for (int i = 0; i < x.Length; i++)\n {\n if (x[i]!=y[i])\n {\n a = 2;\n break;\n }\n else\n {\n a = 0;\n }\n }\n\n if (a==2)\n {\n for (int i = 0; i < x.Length; i++)\n {\n if (x[i] < y[i])\n {\n a = 2;\n break;\n }\n else\n {\n a = 1;\n }\n }\n if (a==2)\n {\n for (int i = 0; i < x.Length; i++)\n {\n if (x[i] < y[i])\n {\n a = -1;\n }\n }\n }\n }\n Console.WriteLine(a);\n \n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "23e292ed77bf8faddbfa51fc09914a89", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.40629.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication5\", \"ConsoleApplication5\\ConsoleApplication5.csproj\", \"{78A4A685-D7DE-4990-8FCA-72D1F10A8D9F}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{78A4A685-D7DE-4990-8FCA-72D1F10A8D9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{78A4A685-D7DE-4990-8FCA-72D1F10A8D9F}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{78A4A685-D7DE-4990-8FCA-72D1F10A8D9F}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{78A4A685-D7DE-4990-8FCA-72D1F10A8D9F}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b4012b577ecf1fae4ce854d690c5bf5d", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n string firstWord = Console.ReadLine();\n string secondWord = Console.ReadLine();\n\n Console.WriteLine(firstWord.CompareTo(secondWord));\n\n Console.ReadKey();\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7fad55244854fbc4eddcb2b61902ab9b", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "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 number3 = reader.NextInt();\n int result = 0;\n int dem = 0;\n while(number3%10!=7)\n {\n if(number3-number1<=0)\n {\n number3 += 60;\n if (number2 == 0)\n {\n number2 = 23;\n dem+=1\n }\n else\n {\n number2 -= 1;\n dem += 1;\n }\n }\n number3 -= number1;\n result+=1;\n if (dem == 24)\n {\n result = 0;\n break;\n }\n }\n\n Console.Write(result);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "037f52e463806c96923ce2e5c3d19434", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "MS C#", "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 int x = int.Parse(Console.ReadLine());\n\n\n string s= Console.ReadLine();\n string[] num = s.Split(' ');\n int h=0, m=0; \n foreach(string z in num)\n {\n h = int.Parse(z);\n m = int.Parse(z);\n \n }\n \n int z = 0;\n while (h % 10 != 7 && m % 10 != 7)\n {\n if (m < x)\n {\n m = (m + 60 - x) % 60;\n h = (h == 0) ? 23 : --h;\n }\n else\n {\n m -= x;\n }\n z++;\n }\n Console.WriteLine();\n Console.WriteLine(z);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "04831de6e1ce2289b7fe4b128475b888", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing System.Text.RegularExpressions;\n\n\n\nclass Program\n{\n static public int[] readIntArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToArray();\n }\n static public long[] readLongArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToInt64(s)).ToArray();\n }\n static public ulong[] readULongArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToUInt64(s)).ToArray();\n }\n public static int readInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n\n static void Main(string[] args)\n {\n\n NearlyLuckyNumbers();\n }\n static void NearlyLuckyNumbers()\n {\n string str = Console.ReadLine();\n int num = Regex.Matches(str, \"[47]\").Count;\n Console.WriteLine((Regex.IsMatch(num.ToString(), \"^[47]*$\")) ? \"YES\" : \"NO\");\n\n\n\n }\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dcc6876c67956714682ed0b40d504f1a", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "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\n string input = Console.ReadLine();\n\n long number = Convert.ToInt64(input);\n\n long[] digits = new long[input.Length];\n\n for (long i = 0; i < input.Length; i++)\n {\n digits[input.Length - 1 - i] = number % 10;\n number /= 10;\n }\n\n long lucky = 0;\n\n for (long i = 0; i < input.Length; i++)\n {\n if (digits[i] == 4 || digits[i] == 7)\n lucky++;\n }\n\n if(lucky == 4 || lucky == 7)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n\n //string input = Console.ReadLine();\n\n //long n = Convert.ToInt64(input);\n\n //if(n == 1)\n //{\n // Console.WriteLine(\"-1\");\n //}\n //else\n //{\n // long result = 0;\n\n // for(int i = 1; i <= n; i++)\n // {\n // result += (long)Math.Pow(-1, i) * i;\n // }\n\n // Console.WriteLine(result);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "18685a0ad54155b3578cd60e5d44aa96", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\n\nnamespace CodeForces\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tNearlyLuckyNumber();\n\t\t\tConsole.ReadKey();\n\t\t}\n\t\tpublic static void NearlyLuckyNumber(){\n\t\t\tstring s = Console.ReadLine();\n\t\t\tvar c = s.Count(m => m =='4' || m == '7');\n\t\t\tConsole.WriteLine(((c == 4) || (c == 7)) ? \"YES\":\"NO\");\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3a9350a3552bcf204ce473d1cf5e212d", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing System.Text.RegularExpressions;\n\n\n\nclass Program\n{\n static public int[] readIntArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToArray();\n }\n static public long[] readLongArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToInt64(s)).ToArray();\n }\n static public ulong[] readULongArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToUInt64(s)).ToArray();\n }\n public static int readInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n\n static void Main(string[] args)\n {\n\n NearlyLuckyNumbers();\n }\n static void NearlyLuckyNumbers()\n {\n string str = Console.ReadLine();\n int num = Regex.Matches(str, \"[47]\").Count;\n Console.WriteLine((Regex.IsMatch(num.ToString(), \"^[47]*$\")) ? \"YES\" : \"NO\");\n\n\n\n }\n\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cbef948779ad3005a88a1fb6e13ba16d", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LearningCSharp\n{\n class _110A\n {\n static void Ma(string[] args)\n {\n\n long[] ar = { 4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777 };\n string temp = \"\";\n long input = Convert.ToInt64(Console.ReadLine());\n for (int i = 0; i < 14; i++)\n {\n if (input == ar[i] || (input % ar[i]) == 0) { temp = \"YES\"; }\n\n\n }\n\n if (temp != \"YES\")\n {\n temp = \"NO\";\n }\n\n Console.WriteLine(temp);\n // Console.ReadKey();\n\n }\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "67d87e2b7700bc9bbb2c513993717bff", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tNearlyLuckyNumber();\n\t\t}\n\t\tpublic static void NearlyLuckyNumber(){\n\t\t\tstring s = Console.ReadLine();\n\t\t\tchar[] c = from g in s where (g=='4' || g== '7') select g;\n\t\t\tConsole.WriteLine(((c.Length == 4) || (c.Length == 7)) ? \"YES\":\"NO\");\n\t\t}\n\t \n\t}\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "50eb30a6bb8fbe3a1df78e460ef405b6", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "var number = Console.ReadLine();\n var arr = number.ToArray();\n bool flag = true;\n for (int i = 0; i _number = number.ToArray().Select(x => int.Parse(x.ToString())).ToList();\n\n Console.WriteLine(isLuckyNumber(_number) == true ? \"YES\" : \"NO\");\n\n }\n\n public static bool isLuckyNumber(List _number)\n {\n bool check = false;\n foreach (var num in _number)\n {\n if (num == 4 || num == 7)\n check = true;\n else\n return false;\n }\n return check;\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "807dfbbe92f40a04ba52dcce8c490d73", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "MS C#", "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 number = Console.ReadLine();\n int four=0,seven=0,not;\n for (int i = 0; i < number.Length; i++)\n {\n if (number[i].ToString() == \"7\") seven++;\n else if (number[i].ToString() == \"4\") four++;\n else not++;\n }\n if (four > 0 && seven > 0 && not == 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fa8e9f43ed1ced2e755a1bf377b94d69", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass NearlyLuckyNumber\n{\n static int Main()\n {\n //citire\n int x = 0, i;\n string s = Console.ReadLine();\n for (i = 0; i < s.Length; i++)\n {\n if (s[i] == '4' || s[i] == '7') x++;\n }\n \n //solve\n bool ok = true; if (ok == 0) ok = false;\n while (x != 0)\n {\n if (x % 10 !=4 && x % 10 != 7)\n {\n ok = false; break;\n }\n x /= 10;\n }\n if (ok) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n return 0;\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e53447869c3fe3bd05b86ac25c78d646", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace CodeForces\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tNearlyLuckyNumber();\n\t\t}\n\t\tpublic static void NearlyLuckyNumber(){\n\t\t\tstring s = Console.ReadLine();\n\t\t\tvar c = s.Count(m => m =='4' || m == '7');\n\t\t\tConsole.WriteLine(((c == 4) || (c == 7)) ? \"YES\":\"NO\");\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d56b2509e4a9368284b5d08909c4ccaa", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n string number = Console.ReadLine();\n List _number = number.ToArray().Select(x => int.Parse(x.ToString())).ToList();\n \n Console.WriteLine(isLuckyNumber(_number) == true ? \"YES\" : \"NO\");\n \n }\n \n public static bool isLuckyNumber(List _number)\n {\n bool check = false;\n foreach (var num in _number)\n {\n if (num == 4 || num == 7)\n check = true;\n else\n return false;\n }\n return check;\n }\n \n \n \n \n \n \n }\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bcad503518c9c0dcd238f2441435ea00", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace A._\u041f\u043e\u0447\u0442\u0438_\u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u043e\u0435_\u0447\u0438\u0441\u043b\u043e\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n\n int numDigits = 0;\n\n if (num.Contains('4') || num.Contains('7'))\n {\n foreach (char a in num)\n {\n if (a == '4' || a == '7')\n {\n numDigits++;\n }\n }\n\n if (numDigits == 7 || numDigits == 4)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8fa46b1a89dfad2d4ce5461e69e63f73", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "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 Int64 n = int.Parse(Console.ReadLine());\n bool res = true;\n Int64 s = n;\n int temp = 0;\n while (s != 0)\n {\n temp = s % 10;\n if (temp != 7 && temp != 4)\n {\n res = false;\n break;\n }\n s /= 10;\n }\n if (res)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n // Console.ReadKey();\n // Console.WriteLine(string.Join(\", \", primeNumbers));\n // Console.ReadLine();\n // var line = Console.ReadLine().Split(new[] { ' ' });\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0477e2319d66cf40d575e840feddef0", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\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 string number = Console.ReadLine();\n List _number = number.ToArray().Select(x => int.Parse(x.ToString())).ToList();\n\n Console.WriteLine(isLuckyNumber(_number) == true ? \"YES\" : \"NO\");\n\n }\n\n public static bool isLuckyNumber(List _number)\n {\n bool check = false;\n foreach (var num in _number)\n {\n if (num == 4 || num == 7)\n check = true;\n else\n return false;\n }\n return check;\n }\n\n\n\n\n\n }\n }\n}\n\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ff8f6fe353ef44200dd8842bf2f90acf", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CP\n{\n class Program\n {\n static void Main(string [] args)\n {\n string numbers = Console.ReadLine();\n int [] n = new int[numbers.Length];\n for(int i = 0 ; i m =='4' || m == '7');\n\t\t\tConsole.WriteLine(((c == 4) || (c == 7)) ? \"YES\":\"NO\");\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fa1435a903992a0b4ccd71093d7acb7d", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace A.Nearly Lucky Number\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n var number = Console.ReadLine();\n int count = 0;\n foreach (var num in number)\n {\n if (num == '4' || num == '7')\n {\n count++;\n }\n }\n var sig = \"YES\";\n var res = count.ToString();\n\n foreach (var item in res)\n {\n if (item == '4' || item == '7')\n {\n continue;\n }\n sig = \"NO\";\n break;\n }\n Console.WriteLine(sig);\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e6a97fa14582ea6b4caa1d5fcb11a844", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class programm\n{\n static void main()\n {\n int n,m,a,b;\n n=Convert.ToInt32(Console.ReadLine());\n m=Convert.ToInt32(Console.ReadLine());\n a=Convert.ToInt32(Console.ReadLine());\n b=Convert.ToInt32(Console.ReadLine());\n if (a*m<=b) {Console.WriteLine(a*n)}\n else {Console.WriteLine(n/m*b+max(n%m*a,b))};\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "674f178d4aa75692236c1f66c45fb99f", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nnamespace Myprogramm;\n{\n class programm\n {\n static void main()\n {\n int n,m,a,b;\n n=Convert.ToInt32(Console.ReadLine());\n m=Convert.ToInt32(Console.ReadLine());\n a=Convert.ToInt32(Console.ReadLine());\n b=Convert.ToInt32(Console.ReadLine());\n if (a*m<=b) {Console.WriteLine(a*n)}\n else {Console.WriteLine(n/m*b+max(n%m*a,b))};\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2145a2324723063ac712322246c4d3f1", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0} {"lang": "Mono C#", "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 return 0;\n else if (ridesInSpecialTicket == 0)\n return ridesPlanned * priceForSingleRide;\n\n else\n {\n if (ridesPlanned % ridesInSpecialTicket == 0) \n return (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 return (ridesPlanned / ridesInSpecialTicket + 1) * priceForSpecialRides;\n else \n return ((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide);\n }\n } \n\n\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0af9730c25cebacbb1d1b86711d45edb", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0} {"lang": "Mono C#", "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( Math.Min(kq,(n/m+1)*b );\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "47b2fe59c5bbdeb16e63d2c277aa5c08", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NSproul //A\n{\n static class Program\n {\n static void Main()\n {\n double x = Int32.Parse(Console.ReadLine());\n int a = 0;\n\t\t\tint b = 0;\n for (int i = Int32.Parse(Math.Floor(Math.Sqrt(x))); i > 0; i--)\n {\n if(x%i == 0) {\n\t\t\t\t\ta = i;\n\t\t\t\t\tb = Int32.Parse(x)/i;\n\t\t\t\t}\n }\n Console.WriteLine(a + \" \" + b);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c729fe85748f6a9a92d1de2a83abdc66", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NSproul //A\n{\n static class Program\n {\n static void Main()\n {\n var x = Console.ReadLine();\n int a = 0;\n\t\t\tint b = 0;\n for (int i = Math.Floor(Math.Sqrt(x)); i > 0; i--)\n {\n if(x%i == 0) {\n\t\t\t\t\ta = i;\n\t\t\t\t\tb = x/i;\n\t\t\t\t}\n }\n Console.WriteLine(a + \" \" + b);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7280a98d1155a96a67f51b0b65c8ec43", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NSproul //A\n{\n static class Program\n {\n static void Main()\n {\n double x = Int32.Parse(Console.ReadLine());\n int a = 0;\n\t\t\tint b = 0;\n for (int i = Math.Floor(Math.Sqrt(x)); i > 0; i--)\n {\n if(x%i == 0) {\n\t\t\t\t\ta = i;\n\t\t\t\t\tb = x/i;\n\t\t\t\t}\n }\n Console.WriteLine(a + \" \" + b);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b136db5beb52f9b105450798b99e7ec", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using ConsoleApplication3;\nusing 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.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[] nm = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n int[] b = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n foreach (var a1 in a)\n {\n foreach (var b1 in b)\n {\n if(a1==b1)\n {\n Console.Write($\"{a1} \");\n }\n }\n }\n\n\n Console.ReadKey();\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\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 long [] getPowersOfTwo()\n {\n long[] array = new long [63];\n\n // array.Select((e, i) => i > 0 ? array[i] = array[i - 1] * 2 : array[i] = 1).ToArray();\n\n array[0] = 1;\n\n for (int i = 1; i < array.Length; i++)\n {\n array[i] = array[i - 1] * 2;\n }\n\n return array;\n }\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9b3c9072d35e4d2e683a34265cb43baf", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System.Linq;\nusing System;\nusing System.Text;\nusing CsharpTutorilas.Math;\n\n\nnamespace Task\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var line1 = Console.ReadLine().Split();\n var line1num = Array.ConvertAll(line1, int.Parse);\n\n var line2 = Console.ReadLine().Split();\n var line2num = Array.ConvertAll(line2, int.Parse);\n\n var line3 = Console.ReadLine().Split();\n var line3num = Array.ConvertAll(line3, int.Parse);\n\n\n var sequance = new List();\n var fingerprinted = new List();\n var indexes = new List();\n for (var i = 0; i < line1num[0]; i++)sequance.Add(line2num[i]);\n for (var i = 0; i < line1num[1]; i++) fingerprinted.Add(line3num[i]);\n\n \n foreach(var i in fingerprinted)\n {\n if (sequance.Contains(i))\n {\n indexes.Add(sequance.IndexOf(i)); \n }\n }\n indexes.Sort();\n foreach (var index in indexes)\n {\n Console.WriteLine(sequance[index]);\n }\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "67bf4d87cd931c79c1706eff2f0301b5", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "difficulty": 800.0} {"lang": "Mono C#", "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 Console.ReadLine();\n var fingerPrintDigits = Console.ReadLine().Split(new char[] { ' ' }).Select(x => int.Parse(x));\n var possibleSecretDigits = Console.ReadLine().Split(new char[] { ' ' }).Select(x => int.Parse(x)).ToHashSet();\n var secretCodeDigits = new List();\n foreach (var fingerPrintDigit in fingerPrintDigits)\n if (possibleSecretDigits.Contains(fingerPrintDigit))\n secretCodeDigits.Add(fingerPrintDigit);\n Console.WriteLine(string.Join(\" \", fingerPrintDigits));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "702c3dfbc9a5e8102e9109d8debd4704", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "difficulty": 800.0} {"lang": "Mono C#", "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 Console.ReadLine();\n var fingerPrintDigits = Console.ReadLine().Split(new char[] { ' ' }).Select(x => int.Parse(x));\n var possibleSecretDigits = Console.ReadLine().Split(new char[] { ' ' }).Select(x => int.Parse(x)).ToHashSet();\n var secretCodeDigits = new List();\n foreach (var fingerPrintDigit in fingerPrintDigits)\n {\n if (possibleSecretDigits.Contains(fingerPrintDigit))\n {\n secretCodeDigits.Add(fingerPrintDigit);\n }\n }\n Console.WriteLine(string.Join(\" \", fingerPrintDigits));\n }\n }\nf", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7758867488f8aeeafd42ac1751eed510", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\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 BigInteger 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1313bf83a25c2c1ccba3c0523f21d5ce", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "45a8cf703f8de0082802a0c6b6185948", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main()\n {\n long a, b, result = 1;\n string s = Console.ReadLine();\n string[] arr = s.Split(' ');\n long.TryParse(arr[0], out a);\n long.TryParse(arr[1], out b);\n char[] arr1 = arr[0].ToCharArray();\n char[] arr2 = arr[1].ToCharArray();\n //Console.WriteLine(arr1[arr1.Length-1]);\n //Console.WriteLine(arr2[arr2.Length-1]);\n //Console.WriteLine((arr2[arr2.Length - 1] - arr1[arr1.Length - 1]));\n double res = b - a;\n if (res == 0)\n {\n result = 1;\n }\n else\n {\n if ((((arr2[arr2.Length - 1] - arr1[arr1.Length - 1])) < 0) || (b % 100 == 0))\n {\n result = 0;\n }\n else\n {\n for (int i = 0; i < res; i++)\n result *= ((b - i) % 10);\n }\n }\n Console.WriteLine(result%10);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c753c8ca2596fe41f26f43fac623bfca", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n int a, b, lstTkn = 1;\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n a = int.Parse(input[0]);\n b = int.Parse(input[1]);\n if (a == 0) { a++; if (b == 0) b++; }\n }\n while(++a<=b)\n {\n lstTkn *= (a%10);\n lstTkn %= 10;\n }\n Console.WriteLine(lstTkn);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cb78e4a0fe8936a9d761ff795c646c97", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "difficulty": 1100.0} {"lang": "MS C#", "source_code": " 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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cdfae838e2d8185f0097de71dd7a703a", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n var line = Console.ReadLine().Split(':');\n int x1 = Convert.ToInt32(tok1[0])\n int y1 = Convert.ToInt32(tok1[1])\n int z1 = Convert.ToInt32(tok1[2]);\n line = Console.ReadLine().Split(':');\n int x2 = Convert.ToInt32(tok1[0])\n int y2 = Convert.ToInt32(tok1[1])\n int z2 = Convert.ToInt32(tok1[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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d27559ed1d4c052762db72cbc35d4a6e", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {D67C2C54-E222-444F-8EA6-3B39D4121572}\n Exe\n Properties\n TaskB\n TaskB\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ba1c59dc74b0e6bb86918f2c18f72ea7", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\n\nclass TestClass\n {\n static void Main(string[] args)\n {\n // Display the number of command line arguments:\n var input = Console.ReadLine();\n var numbers = input.Split(' ');\n long m = Int32.Parse(numbers[0]);\n long n = Int32.Parse(numbers[1]);\n long a = Int32.Parse(numbers[2]);\n \n Console.WriteLine(Func(m, n, a));\n }\n \n static int Func(long m, long n, long a)\n {\n \tif(a >= m && a >= n)\n \t{\n \t\treturn 1;\n \t}\n \t\n \treturn (m % a == 0 ? m/a :m / a + 1) * (n % a == 0 ? n /a : n / a + 1);\n }\n }\n// Define other methods and classes here\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "222262b95b622709c7f1642f5990a4ff", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace OSMINKA_WORK\n{\n class Program\n {\n static void Main()\n {\n int m = int.Parse(Console.Read());\n int n = int.Parse(Console.Read());\n int a = int.Parse(Console.Read());\n int answer = ((m / a + (m != 1 && a != 1 ? ((m / a) % 2) : 0))) * ((n / a + (n != 1 && a != 1 ? ((n / a) % 2) : 0)));\n Console.WriteLine(answer);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2569b5eef05d7560ee4779fe08d790e0", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace \u0422\u0435\u0430\u0442\u0440\u0430\u043b\u044c\u043d_\u043f\u043b\u043e\u0449\u0430\u0434\u044c\n{\n class Program\n {\n static void Main(string[] args)\n {\n decimal result = 0;\n string[] input = Console.ReadLine().Split(new char[] {}, StringSplitOptions.RemoveEmptyEntries);\n decimal width = decimal.Parse(input[1]);\n decimal height = decimal.Parse(input[0]);\n decimal size = decimal.Parse(input[2]);\n\n result = (int)Math.Floor(width / size) * (int)Math.Floor(height / size);\n\n if (width % size != 0 && height % size != 0)\n result -= 1;\n\n if (width % size != 0)\n result +=(decimal)Math.Ceiling(width / size);\n else\n result += 0;\n\n if (height % size != 0)\n result += (decimal)Math.Ceiling(height / size);\n else\n result += 0;\n \n Console.WriteLine(result);\n Console.ReadLine();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "672358781cb49417f2832db6619fbe63", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace prob2_Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n var all = Console.ReadLine();\n var splited = all.Split(\" \");\n var m = Convert.ToInt32(splited[0]);\n var n = Convert.ToInt32(splited[1]);\n var a = Convert.ToInt32(splited[2]);\n var power = Math.Pow(10,9);\n if ( m >= 1 && n >= 1 && a >= 1 && m <= power && n <= power && a <= power)\n {\n var heightNumber = HeightNumber(n, a);\n var widthNumber = WidthNumber(m , a);\n var totalNumber = heightNumber + widthNumber;\n Console.WriteLine(\"{0}\", totalNumber );\n \n } else\n {\n return;\n }\n\n static int HeightNumber(int n , int heightNumber) { \n \n if (n % heightNumber == 0)\n {\n var squareHeightNumber = n / heightNumber;\n return squareHeightNumber;\n }\n else\n {\n var squareHeightNumber = (n / heightNumber) + 1;\n return squareHeightNumber;\n }\n\n };\n static int WidthNumber(int m , int widthNumber)\n {\n if (m % widthNumber == 0)\n {\n var squareWidthNumber = m / widthNumber;\n return squareWidthNumber;\n }\n else\n {\n var squareWidthNumber = (m / widthNumber) + 1;\n return squareWidthNumber;\n }\n\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "abb3472ed40b135140d0f00757b59b5a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "ulong n, m, a;\n n = Convert.ToUInt64(Console.Read());\n m = Convert.ToUInt64(Console.Read());\n a = Convert.ToUInt64(Console.Read());\n Console.WriteLine(Math.Ceiling((decimal)n / a) * Math.Ceiling((decimal)m / a));", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aa39d39e0e669ae517e7ab949d8f14ea", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.Linq;\n\nusing System.Text;\n\n \n\nnamespace application1\n\n{\n\n class Program\n\n {\n\n static void Main(string[] args)\n\n {\n int n, m, a;\n\t\t n = Console.Read();\n\t\t m = Console.Read();\n\t\t a = Console.Read();\n\t\t \n\t\t double pCount = Math.Ceiling((n-1)/a) + Math.Ceiling((m-1)/a);\n\n Console.WriteLine(pCount);\n\n }\n\n }\n\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7908476827b782e8d02178018a2b46f3", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "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 pars;\n int[] sl1 = Console.ReadLine().Split(' ').Select(i => int.TryParse(i, out pars) ? pars : 0).ToArray();\n float ma, na, result;\n ma = Math.Ceiling((float)(sl1[0]) / sl1[2]);\n na = Math.Ceiling((float)(sl1[1]) / sl1[2]);\n result = ma + na;\n Console.WriteLine(result);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "90a6663095601ef5a440157bf35e6f9b", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\n\nclass TheatreSquare {\n\n static void Main() \n {\n\tvar length = int.Parse(Console.Read());\n\tvar breadth = int.Parse(Console.Read());\n\tvar side = int.Parse(Console.Read());\n\n\tConsole.WriteLine(((length + 3)/4) * ((breadth + 3)/4));\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5ce03f90a6fe878cfdac0842225b1791", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nstatic int Main()\n{\n\tlong n;\n\tlong m;\n\tlong a;\n\n\tn = long.Parse(ConsoleInput.ReadToWhiteSpace(true));\n\tm = long.Parse(ConsoleInput.ReadToWhiteSpace(true));\n\ta = long.Parse(ConsoleInput.ReadToWhiteSpace(true));\n\n\tConsole.Write(((n + a - 1) / a) * ((m + a - 1) / a));\n\tConsole.Write(\"\\n\");\n\n\treturn 0;\n}\n\n\n//----------------------------------------------------------------------------------------\n//\tCopyright \u00a9 2006 - 2018 Tangible Software Solutions, Inc.\n//\tThis class can be used by anyone provided that the copyright notice remains intact.\n//\n//\tThis class provides the ability to convert basic C++ 'cin' and C 'scanf' behavior.\n//----------------------------------------------------------------------------------------\ninternal static class ConsoleInput\n{\n\tprivate static bool goodLastRead = false;\n\tpublic static bool LastReadWasGood\n\t{\n\t\tget\n\t\t{\n\t\t\treturn goodLastRead;\n\t\t}\n\t}\n\n\tpublic static string ReadToWhiteSpace(bool skipLeadingWhiteSpace)\n\t{\n\t\tstring input = \"\";\n\n\t\tchar nextChar;\n\t\twhile (char.IsWhiteSpace(nextChar = (char)System.Console.Read()))\n\t\t{\n\t\t\t//accumulate leading white space if skipLeadingWhiteSpace is false:\n\t\t\tif (!skipLeadingWhiteSpace)\n\t\t\t\tinput += nextChar;\n\t\t}\n\t\t//the first non white space character:\n\t\tinput += nextChar;\n\n\t\t//accumulate characters until white space is reached:\n\t\twhile (!char.IsWhiteSpace(nextChar = (char)System.Console.Read()))\n\t\t{\n\t\t\tinput += nextChar;\n\t\t}\n\n\t\tgoodLastRead = input.Length > 0;\n\t\treturn input;\n\t}\n\n\tpublic static string ScanfRead(string unwantedSequence = null, int maxFieldLength = -1)\n\t{\n\t\tstring input = \"\";\n\n\t\tchar nextChar;\n\t\tif (unwantedSequence != null)\n\t\t{\n\t\t\tnextChar = '\\0';\n\t\t\tfor (int charIndex = 0; charIndex < unwantedSequence.Length; charIndex++)\n\t\t\t{\n\t\t\t\tif (char.IsWhiteSpace(unwantedSequence[charIndex]))\n\t\t\t\t{\n\t\t\t\t\t//ignore all subsequent white space:\n\t\t\t\t\twhile (char.IsWhiteSpace(nextChar = (char)System.Console.Read()))\n\t\t\t\t\t{\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\t//ensure each character matches the expected character in the sequence:\n\t\t\t\t\tnextChar = (char)System.Console.Read();\n\t\t\t\t\tif (nextChar != unwantedSequence[charIndex])\n\t\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tinput = nextChar.ToString();\n\t\t\tif (maxFieldLength == 1)\n\t\t\t\treturn input;\n\t\t}\n\n\t\twhile (!char.IsWhiteSpace(nextChar = (char)System.Console.Read()))\n\t\t{\n\t\t\tinput += nextChar;\n\t\t\tif (maxFieldLength == input.Length)\n\t\t\t\treturn input;\n\t\t}\n\n\t\treturn input;\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "767b75c7c11c6510b84c8f80ab8b7420", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp1\n{\n\nclass Program\n {\n static void Main(string[] args)\n {\n\t var s = Console.ReadLine().Split(\" \");\n double n = int.Parse(s[0]);\n double m = int.Parse(s[1]);\n double a = int.Parse(s[2]);\n\n double topCount = m / a;\n double leftCount = n / a;\n\n if (topCount % 2 != 0)\n {\n topCount = Math.Ceiling(topCount);\n }\n if (topCount < 1)\n {\n topCount = Math.Floor(topCount); \n }\n\n if (leftCount % 2 != 0)\n {\n leftCount = Math.Ceiling(leftCount); \n }\n if (leftCount < 1)\n {\n leftCount = Math.Floor(leftCount); \n }\n\n Console.WriteLine(topCount * leftCount);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "13ca8739b1578d64dab22c57aea354e2", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\nnamespace CodeForses71A\n{\n class Program\n {\n static void Main(string[] args) \n {\n string text = Console.ReadLine();\n string[] ints = text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = Int32.Parse(ints[0]);\n int m = Int32.Parse(ints[1]);\n int a = Int32.Parse(ints[2]);\n int plos = Convert.ToInt16(m) * Convert.ToInt16(n);\n int kvad = Convert.ToInt16(a) * Convert.ToInt16(a);\n Console.WriteLine(plos % kvad);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c2e2869e6833399755a381e87b6f1f85", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "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 long[] x = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long A = (x[0] * x[1]);\n long B = (x[2] * x[2]);\n long x = B;\n while (A>x)\n {\n\n x = x + B;\n \n }\n if (A==B || B>A)\n {\n Console.WriteLine(1);\n }\n else\n {\n long y = Math.Ceiling(x);\n if (y%2==0)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(y+1);\n }\n }\n\n\n\n \n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d62c13da930f6bb9acde82fa6c94a6d0", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program {\n \n static void Main(String [] args) {\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 na = n % a == 0 ? n/a : n/a + 1;\n int ma = m % a == 0? m/a : m/a + 1;\n Console.WriteLine(na*ma);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "43beeb30855c7e268b7e0304a56d12ef", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace prob2_Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n var all = Console.ReadLine();\n var splited = all.Split(\" \");\n var m = Convert.ToInt32(splited[0]);\n var n = Convert.ToInt32(splited[1]);\n var a = Convert.ToInt32(splited[2]);\n var power = Math.Pow(10,9);\n if ( m >= 1 && n >= 1 && a >= 1 && m <= power && n <= power && a <= power)\n {\n var heightNumber = HeightNumber(n, a);\n var widthNumber = WidthNumber(m , a);\n var totalNumber = heightNumber + widthNumber;\n Console.WriteLine(\" {0} , {1} , {2}\", widthNumber , heightNumber, totalNumber );\n \n } else\n {\n return;\n }\n\n int HeightNumber(int n , int heightNumber)\n {\n if (n % heightNumber == 0)\n {\n var squareHeightNumber = n / heightNumber;\n return squareHeightNumber;\n }\n else\n {\n var squareHeightNumber = (n / heightNumber) + 1;\n return squareHeightNumber;\n }\n\n };\n int WidthNumber(int m , int widthNumber)\n {\n if (n % widthNumber == 0)\n {\n var squareWidthNumber = m / widthNumber;\n return squareWidthNumber;\n }\n else\n {\n var squareWidthNumber = (m / widthNumber) + 1;\n return squareWidthNumber;\n }\n\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6e5aa05f22fabd1add19d7046278dda5", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Codeforce1\n{\n class Program\n {\n static decimal Main(int m, int n, int a)\n {\n var result = Math.Ceiling((decimal) (n * m / a ^ 2));\n\n return result;\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0428ff3bcde1b5589048e9e0105356fb", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 11.00\n# Visual C# Express 2010\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"plo\", \"plo\\plo.csproj\", \"{AE8FC76E-220F-48C7-BD1E-E42EB99E62C8}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{AE8FC76E-220F-48C7-BD1E-E42EB99E62C8}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{AE8FC76E-220F-48C7-BD1E-E42EB99E62C8}.Debug|x86.Build.0 = Debug|x86\n\t\t{AE8FC76E-220F-48C7-BD1E-E42EB99E62C8}.Release|x86.ActiveCfg = Release|x86\n\t\t{AE8FC76E-220F-48C7-BD1E-E42EB99E62C8}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "34b1e02fbddfbb963513bdc3de705cdc", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "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 var sl1 = Console.ReadLine().Split(' ');\n\n double f1, f2;\n //f1 = Convert.ToDouble(sl1[0]) / Convert.ToDouble(sl1[2]);\n //f2 = Convert.ToDouble(sl1[1]) / Convert.ToDouble(sl1[2]);\n //Console.WriteLine(f1*f2);\n //Console.ReadKey();\n\n if (Convert.ToDouble(sl1[0]) % Convert.ToDouble(sl1[2]) == 0)\n {\n f1 = Convert.ToDouble(sl1[0]) / Convert.ToDouble(sl1[2]);\n }\n else\n {\n f1 = Convert.ToDouble(sl1[0]) / Convert.ToDouble(sl1[2]);\n f1++;\n }\n if (Convert.ToDouble(sl1[1]) % Convert.ToDouble(sl1[2]) == 0)\n {\n f2 = Convert.ToDouble(sl1[2]) / Convert.ToDouble(sl1[2]);\n }\n else\n {\n f2 = Convert.ToDouble(sl1[0]) / Convert.ToDouble(sl1[2]);\n f2++;\n }\n Console.WriteLine(f1*f2)\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5aec806f7df351ecec1dcdc269d4b7f9", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace theatresquare\n{\n class Program\n {\n static void Main(string[] args)\n {\n decimal n, m, a;\n \n n = Decimal.Parse(Console.ReadLine());\n m = Decimal.Parse(Console.ReadLine());\n a = Decimal.Parse(Console.ReadLine());\n Console.WriteLine(Math.Ceiling(m/a)+ Math.Ceiling(n/a))\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0d47273ce2a9049f6fc4993a22330ad4", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\n using System;\n using System.Collections.Generic;\n using System.Collections;\n\n class TheaterSquare\n {\n\n static void main(string[] args)\n {\n long n, m, a;\n n = long.Parse(Console.ReadLine());\n m = long.Parse(Console.ReadLine());\n a = long.Parse(Console.ReadLine());\n\n long x = m / a, y = n / a;\n if (n % a != 0)\n ++y;\n if (m % a != 0)\n ++x;\n Console.WriteLine(x * y);\n\n }\n\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d59fc82c372fca42ee27150f2470d7b9", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "class ProblemD\n {\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(' ');\n double n = Convert.ToDouble(input[0]);\n double m = Convert.ToDouble(input[1]);\n double a = Convert.ToDouble(input[2]);\n double na = Math.Ceiling(n / a);\n double ma = Math.Ceiling(m / a);\n Console.WriteLine((long) (na * ma));\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "07c26fb6d9d3a5293ea746d094a6b31e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace A\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string[] st = Console.ReadLine().Split();\n uint x = Convert.ToUInt64(st[0]);\n uint y = Convert.ToUInt64(st[1]);\n uint a = Convert.ToUInt64(st[2]);\n if (x % a == 0)\n {\n x = x / a;\n }\n else\n {\n x = x / a + 1;\n }\n\t\t\tif (y % a == 0)\n\t\t\t{\n\t\t\t\ty = y / a;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty = y / a + 1;\n\t\t\t}\n Console.WriteLine(x * y);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "002f7961ddfba3c425c08a8516198063", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "static int Func(int m, int n, int a)\n{\n\tif(a >= m && a >= n)\n\t{\n\t\treturn 1;\n\t}\n\t\n\treturn (m / a + 1) + (n / a + 1);\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a6a89994d1f66775d5c98bec8847c7b8", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "class ProblemD\n {\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(' ');\n double n = Convert.ToDouble(input[0]);\n double m = Convert.ToDouble(input[1]);\n double a = Convert.ToDouble(input[2]);\n double na = Math.Ceiling(n / a);\n double ma = Math.Ceiling(m / a);\n Console.WriteLine((long) na * ma);\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "512ddc2498aa22e141757ae1afb5f1aa", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nclass _1A {\n \n static void Main(String [] args) {\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 na = n % a == 0 ? n/a : n/a + 1;\n int ma = m % a == 0? m/a : m/a + 1;\n Console.WriteLine(na*ma);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8715829f03fcfa69e8ffa849f25a892a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\n\nclass TheatreSquare {\n\n static void Main() \n {\n var inputs = Console.ReadLine().SPlit(' ');\n\tvar length = int.Parse(inputs[0]);\n\tvar breadth = int.Parse(inputs[1]);\n\tvar side = int.Parse(inputs[2]);\n\n\tConsole.WriteLine( ( ((length + 3)/4) * ((breadth + 3)/4) ).ToString());\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cadc9b6d3efb98f0a01818d1b2257bb1", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "hsdhgsf", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65e6ddf164e6e97deb535f17a0148509", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": " long n, m, a;\n var s = Console.ReadLine().Split(' ');\n n = long.Parse(s[0]);\n m = long.Parse(s[1]);\n a = long.Parse(s[2]);\n var i = n/a;\n var j = m/a;\n if (n % a!=0) i++;\n if (m % a != 0) j++;\n Console.WriteLine(i*j);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1055aa93a4fced37871aafb9102a7a95", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace prob2_Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n var all = Console.ReadLine();\n var count = 3;\n\n var splited = all.Split(\" \", count,\n StringSplitOptions.RemoveEmptyEntries);\n var m = Convert.ToInt32(splited[0]);\n var n = Convert.ToInt32(splited[1]);\n var a = Convert.ToInt32(splited[2]);\n var power = Math.Pow(10,9);\n if ( m >= 1 && n >= 1 && a >= 1 && m <= power && n <= power && a <= power)\n {\n var heightNumber = HeightNumber(n, a);\n var widthNumber = WidthNumber(m , a);\n var totalNumber = heightNumber + widthNumber;\n Console.WriteLine(\"{0}\", totalNumber );\n \n } else\n {\n return;\n }\n\n\n }\n\n static int HeightNumber(int n, int heightNumber)\n {\n\n if (n % heightNumber == 0)\n {\n var squareHeightNumber = n / heightNumber;\n return squareHeightNumber;\n }\n else\n {\n var squareHeightNumber = (n / heightNumber) + 1;\n return squareHeightNumber;\n }\n\n }\n\n public static int WidthNumber(int m, int widthNumber)\n {\n if (m % widthNumber == 0)\n {\n var squareWidthNumber = m / widthNumber;\n return squareWidthNumber;\n }\n else\n {\n var squareWidthNumber = (m / widthNumber) + 1;\n return squareWidthNumber;\n }\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eae3d53a17b6f3f8e894d9e8d29eed59", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class _492A\n {\n\n static void Main(string[] args)\n {\n string[] newArray = { x, y, z};\n var n = int.Parse(newArray[0]);\n var m = int.Parse(newArray[1]);\n var a = int.Parse(newArray[2]);\n if (n % a == 0 && m % a == 0){\n int result = (n / a) * (m / a);\n Console.WriteLine(\"You will need {0} bricks to cover sqaure\", result);\n }\n else {\n if (n % a == 0) {\n int result = (n / a) * (m / a + 1);\n Console.WriteLine(\"You will need {0} bricks to cover sqaure\", result);\n }\n if (m % a == 0) {\n int result = (n / a + 1) * (m / a);\n Console.WriteLine(\"You will need {0} bricks to cover sqaure\", result);\n }\n else if (n % a != 0 && m % a != 0)\n {\n int result = (n / a + 1) * (m / a + 1);\n Console.WriteLine(\"You will need {0} bricks to cover sqaure\", result);\n }\n }\n\n\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2f8df31147ed823103b9c72af7924d77", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace App\n{\n class Program\n {\n static int Main(string[] args)\n {\n var m = int.Parse(args[0]);\n var n = int.Parse(args[1]);\n var a = int.Parse(args[2]);\n var ma = (m / a) + (m % a == 0 ? 0 : 1);\n var na = (n / a) + (n % a == 0 ? 0 : 1);\n Console.WriteLine(ma * na);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6eeed83d4948470824e5c31f34607a39", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.Linq;\n\nusing System.Text;\n\n \n\nnamespace application1\n\n{\n\n class Program\n\n {\n\n static void Main(string[] args)\n\n {\n int n, m, a;\n\t\t n = Console.Read();\n\t\t m = Console.Read();\n\t\t a = Console.Read();\n\t\t double tempResult1 = (n-1)/a;\n\t\t double tempResult2 = (m-1)/a;\n\t\t double pCount = Math.Ceiling(tempResult) + Math.Ceiling(tempResult2);\n\n Console.WriteLine(pCount);\n\n }\n\n }\n\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1241c5191427a14b4c57a401a712d6c8", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "int n, m, a;\n int count,s,s1;\n n = int.Parse(Console.ReadLine());\n m = int.Parse(Console.ReadLine());\n a = int.Parse(Console.ReadLine());\n\n s = n * m;\n s1 = a * a;\n count = s / s1;\n\n if (s == count * s1 || s < count * s1)\n {\n Console.WriteLine(+count);\n }\n else\n {\n while (s>s1*count)\n {\n count+=1;\n if(s == count * s1 || n * m < count * s1)\n {\n Console.WriteLine(+count);\n break;\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bb048c6b59c2c21f6424f739bbaa55e4", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "long height_of_rectangle ; //\u0637\u0648\u0644 \u0627\u0644\u0645\u0633\u062a\u0637\u064a\u0644\n long width_of_rectangle; //\u0639\u0631\u0636 \u0627\u0644\u0645\u0633\u062a\u0637\u064a\u0644\n long square; // \u0637\u0648\u0644 \u0636\u0644\u0639 \u0627\u0644\u0645\u0631\u0628\u0639\n long constant_width_of_square; // \u0627\u0644\u0642\u064a\u0645\u0629 \u0627\u0644\u062b\u0627\u0628\u062a\u0647 \u0644\u0637\u0648\u0644 \u0627\u0644\u0645\u0631\u0628\u0639\n long constant_height_of_square; // \u0627\u0644\u0642\u064a\u0645\u0629 \u0627\u0644\u062b\u0627\u0628\u062a\u0647 \u0644\u0637\u0648\u0644 \u0627\u0644\u0645\u0631\u0628\u0639\n\n long num1 = 1; //\u0639\u062f\u062f \u0627\u0644\u0645\u0631\u0628\u0639\u0627\u062a \u0641\u0649 \u0627\u0644\u0637\u0648\u0644 \u0627\u0644\u0648\u0627\u062d\u062f \u0644\u0644\u0645\u0633\u062a\u0637\u064a\u0644\n long num2 = 1; // \u0639\u062f\u062f \u0627\u0644\u0645\u0631\u0628\u0639\u0627\u062a \u0641\u0649 \u0627\u0644\u0639\u0631\u0636 \u0627\u0644\u0648\u0627\u062d\u062f \u0644\u0644\u0645\u0633\u062a\u0637\u064a\u0644\n\n long result; // \u0639\u062f\u062f \u0627\u0644\u0645\u0631\u0628\u0639\u0627\u062a\n\n Console.WriteLine(\"please enter height of rectangle\");\n height_of_rectangle = Convert.ToInt64(Console.ReadLine()); //\u0642\u064a\u0645\u0629 \u0637\u0648\u0644 \u0627\u0644\u0645\u0633\u062a\u0637\u064a\u0644\n Console.WriteLine(\"please enter width of rectangle\");\n width_of_rectangle = Convert.ToInt64(Console.ReadLine()); // \u0642\u064a\u0645\u0629 \u0639\u0631\u0636 \u0627\u0644\u0645\u0633\u062a\u0637\u064a\u0644\n Console.WriteLine(\"please enter width or height of square\");\n square = Convert.ToInt64(Console.ReadLine()); // \u0642\u064a\u0645\u0629 \u0637\u0648\u0644 \u0636\u0644\u0639 \u0627\u0644\u0645\u0633\u062a\u0637\u064a\u0644\n\n constant_width_of_square = square;\n constant_height_of_square = square;\n\n //\u0645\u0639\u0631\u0641\u0629 \u0639\u062f\u062f \u0627\u0644\u0628\u0644\u0627\u0637 \u0641\u0649 \u0627\u0644\u0639\u0631\u0636\n\n while (square < width_of_rectangle)\n {\n num1 = num1 + 1;\n square = square + constant_width_of_square;\n }\n\n //\u0645\u0639\u0631\u0641\u0629 \u0639\u062f\u062f \u0627\u0644\u0628\u0644\u0627\u0637 \u0641\u0649 \u0627\u0644\u0637\u0648\u0644\n\n while (constant_height_of_square < height_of_rectangle)\n {\n num2 = num2 + 1;\n constant_height_of_square = constant_height_of_square + constant_width_of_square;\n }\n result = num1 * num2;\n Console.WriteLine(\"number of squares are : \" + result);\n Console.ReadLine();\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "68275c9434f06026d37493fd4e5e110f", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "Using System;\n\npublic class Solution{\n\tpublic static void Main(String [] args){\n\t\tstring [] str = Console.ReadLine().split(' ');\n\t\tint n = int.Parse(str[0]);\n\t\tint m = int.Parse(str[0]);\n\t\tint a = int.Parse(str[0]);\n\t\t\n\t\tn = Math.Ceiling((double)n/a);\n\t\tm = Math.Ceiling((double)m/a);\n\t\t\n\t\tConsole.WriteLine(n*m);\n\t\t\n\t\t\n\t}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "92be5340117af084c35d66daf0d58eff", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\n\npublic class TheaterSquare {\n\n public static void main(string[] args) {\n Scanner in = new Scanner(System.in);\n long n, m, a;\n n = in.nextLong();\n m = in.nextLong();\n a = in.nextInt();\n \n long x = m / a , y = n/a ;\n if(n%a!=0)\n ++y;\n if(m%a!=0)\n ++x;\n Console.WriteLine(x*y);\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f98c66dfb4883f7eb0fa195af3bbf099", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var line = Console.ReadLine().Split(' ');\n int n = 0, m = 0, a = 0;\n int.TryParse(line[0], out n);\n int.TryParse(line[1], out m);\n int.TryParse(line[2], out a);\n int flagSquare = 0;\n\n if((n*m)%Math.Pow(a,2)==0)\n {\n flagSquare =( n * m)/ Math.Pow(a, 2);\n goto Finish;\n }\n\n if(a>n&&a>m)\n {\n flagSquare = 1;\n goto Finish;\n }\n\n if(n==m)\n {\n if(n/a==0)\n {\n flagSquare = n / a;\n goto Finish;\n }\n }\n\n for (int k = 0; k < m; k+=a)\n {\n for (int i = 0; i < n; i += a)\n {\n flagSquare++;\n }\n }\n\n Finish:\n Console.WriteLine(flagSquare);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e23ba101e70705158eb7750d98acc189", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {5B06B845-3B3E-403E-8539-21552B287096}\n Exe\n Properties\n Theatre_Square\n Theatre Square\n v4.0\n Client\n 512\n \n \n x86\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n x86\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3d76eb67e799c2ed1395ceabca2630af", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n \nnamespace TheatreSquare{\n \n class Program{\n \n static void Main(string[] args){\n \n string arrayToSplit = Console.ReadLine();\n \n string[] arraySplited = arrayToSplit.Split(' ');\n \n decimal[] arrayConverted = new int[arraySplited.Length];\n \n for(int i=0;i a&& n <= a){\n count1 = (BigInteger)(m % a);\n count1 = (BigInteger)Math.Ceiling(count1);\n Console.WriteLine(count1);\n \n }\n else if(m <= a&& n > a){\n count2 = (BigInteger)(n % a);\n count2 = (BigInteger)Math.Ceiling(count2);\n Console.WriteLine(count2);\n\n\n }\n else if (m > a && n > a)\n {\n count1 = (BigInteger)(m % a);\n count1 = (BigInteger)Math.Ceiling(count1);\n count2 = (BigInteger)(n % a);\n count2 = (BigInteger)Math.Ceiling(count2);\n Console.WriteLine(count1 + count2);\n\n\n }\n /*{\n if (m <= a)\n {\n count1 = 1;\n }\n else if (m > a)\n {\n count1 = (double)(m % a);\n count1 = Math.Ceiling(count1);\n }\n if (n <= a)\n {\n count2 = 1;\n }\n else if (n > a)\n {\n count2 = (double)(n % a);\n count2 = Math.Ceiling(count2);\n }\n Console.WriteLine(count1 + count2);\n }*/\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b53eabe275777efa0e7461485048a8fa", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "class Program\n{\n static void Main(string[] args)\n {\n string inputString = System.Console.ReadLine();\n string[] input = inputString.Split(null);\n int n, m, a;\n if (int.TryParse(input[0], out n) && int.TryParse(input[1], out m) && int.TryParse(input[2], out a))\n {\n int length, breadth;\n if (n % a > 0)\n {\n length = n / a + 1;\n }\n else\n {\n length = n / a;\n }\n\n if (m % a > 0)\n {\n breadth = m / a + 1;\n }\n else\n {\n breadth = m / a;\n }\n\n System.Console.WriteLine(Convert.ToString(length * breadth));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "725cbe84e8cdfa055d14297aacdfdf02", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "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(double a, double b, double d)\n {\n // a = double.Parse(Console.ReadLine());\n // b = double.Parse(Console.ReadLine());\n // d = double.Parse(Console.ReadLine());\n a = Math.Ceiling(a/d);\n b = Math.Ceiling(b / d);\n return a * b;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d1f5abe78af0982cf4fd7d57dfd6a98b", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "namespace TheatherSquare1A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n \n float b = float.Parse(args[0]);\n float h = float.Parse(args[1]);\n float a = float.Parse(args[2]);\n b = 10;\n h = 5;\n a = 3;\n Console.WriteLine(Math.Ceiling(h / a) * Math.Ceiling(b / a));\n Console.ReadLine();\n \n\n\n }\n\n \n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3cfb5d095377c5adfd7ca943d78bcb5e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace OSMINKA_WORK\n{\n class Program\n {\n static void Main()\n {\n int m = int.Parse(Console.Read(1));\n int n = int.Parse(Console.Read(2));\n int a = int.Parse(Console.Read(3));\n int answer = ((m / a + (m != 1 && a != 1 ? ((m / a) % 2) : 0))) * ((n / a + (n != 1 && a != 1 ? ((n / a) % 2) : 0)));\n Console.WriteLine(answer);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8f4cc08f1d1a83d1e4f5710b3a1d11e5", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27004.2006\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp6\", \"ConsoleApp6\\ConsoleApp6.csproj\", \"{A436B1C8-5276-4669-A947-DFEFBE3EA445}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{A436B1C8-5276-4669-A947-DFEFBE3EA445}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{A436B1C8-5276-4669-A947-DFEFBE3EA445}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{A436B1C8-5276-4669-A947-DFEFBE3EA445}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{A436B1C8-5276-4669-A947-DFEFBE3EA445}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {7251421B-54BA-4D6D-8CFB-9254C72FBB56}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d07a34602356f636025219eefcd97de7", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8 {\n class Program {\n static void Main(string[] args) {\n\n float n = 6;\n float m = 6;\n float a =4;\n float a;\n float b;\n\n a = (int)Math.Ceiling(height / tileSize);\n Console.WriteLine(a);\n \n\n\n b = (int)Math.Ceiling(width / tileSize);\n \n Console.WriteLine(a * b);\n\n\n \n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6d976d8ea0e9de0ae3dd7c3ec6c467fe", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace plo\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Input m, n, a from keyboard and put it into the long varibaleg\n Console.Write(\"Input m,n,a: \");\n string whole = Console.ReadLine();\n int com = whole.IndexOf(' ');\n long m = long.Parse(whole.Substring(0, com));\n\n string who = whole.Substring(com + 1);\n int com2 = who.IndexOf(' ');\n long n = long.Parse(who.Substring(0, com2));\n\n long a = long.Parse(who.Substring(com + 1));\n\n\n \n\n if (nmoda != 0)\n {\n num_n += 1;\n }\n\n //total number of peaces\n long num_sq = num_n * num_m;\n\n //output the result\n Console.WriteLine();\n Console.WriteLine(\"we need \" + num_sq+ \" peaces\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "18d0a82be594f1eb1b1dd1eab1432e11", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class Solution{\n\tpublic static void Main(String [] args){\n\t\tvar str = Console.ReadLine().split(' ');\n\t\tvar n = int.Parse(str[0]);\n\t\tvar m = int.Parse(str[0]);\n\t\tvar a = int.Parse(str[0]);\n\t\t\n\t\tvar n = Math.Ceiling((double)n/a);\n\t\tvar m = Math.Ceiling((double)m/a);\n\t\t\n\t\tConsole.WriteLine(double)n*m);\n\t\t\n\t\t\n\t\n\t}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "95cbe3f79371b707e42e23272b824d15", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "var side1 = Math.Ceiling(n / (double)a);\nvar side2 = Math.Ceiling(m / (double)a);\nvar numberOfFlagstones = side1 * side2;", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d3f7e916a8fff14a7cb693a2f3b683cb", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Data.Linq;\n\npublic class Solution{\n\tpublic static void Main(string[] args){\n\t\tstring arr = Console.ReadLine();\n\t\tstring[] str = arr.split(' ');\n\t\tlong n = long.Parse(str[0]);\n\t\tlong m = long.Parse(str[1]);\n\t\tlong a = long.Parse(str[2]);\n\t\t\n\t\t n = Math.Ceiling((double)n/a);\n\t\t m = Math.Ceiling((double)m/a);\n\t\t\n\t\tConsole.WriteLine(n*m);\n\t\t\n\t\t\n\t\n\t}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "412005ff6a5d4424d571d5e976a69bf7", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Class1\n{\n\tstatic void Main()\n\t{\n var input = Console.ReadLine().Split(' ');\n Console.WriteLine(Math.Ceiling(in64.Parse(input[0]) / in64.Parse(input[2])) * Math.Ceiling(in64.Parse(input[1]) / in64.Parse(input[2])));\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2e9aff8a3ee09692f8516ab9257deee9", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "zxcfsdfkulabs;dfladg\nsadf;ljadbsng'", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4f28886a484edd930bbf9b63d9f82cf3", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace consoleTraining\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nums = Console.ReadLine().Split(' ');\n n = Convert.ToDouble(nums[0]);\n m = Convert.ToDouble(nums[1]);\n a = Convert.ToDouble(nums[2]);\n if (n <= 1 || (m <= 1 || m >= Math.Pow(10, 9)) || (a >= Math.Pow(10, 9))|| n<=0 || m<=0 || a<=0) { Console.WriteLine(\"Error\"); return; }\n int result = Convert.ToInt32(Math.Ceiling(n / a) * Math.Ceiling(m / a));\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2fa990ad3be34c7727f48268bb3debd8", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\n class Program\n {\n static int Main(string[] args)\n {\n int rez2 = 1;\n try\n {\n int n = int.Parse(Console.Read());\n int m = int.Parse(Console.Read());\n decimal Spavela = int.Parse(Console.Read());\n int aux1 = Convert.ToInt32(Math.Ceiling(n / Spavela));\n decimal aux2 = Math.Ceiling(m / Spavela);\n decimal rez = aux1 * aux2;\n Console.WriteLine(rez);\n Console.ReadLine();\n rez2 = Convert.ToInt16(rez);\n return rez2;\n }\n catch(Exception ex)\n {\n Console.WriteLine(ex.Message);\n return rez2;\n }\n \n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fbb9ac7e4ed70b9a71a4fd0fc6124a58", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\n\nnamespace AssemblyCSharp\n{\n\t\t\n\tpublic class TheatreSquare\n\t{\n\t\tpublic static int Main(long n, long m, long a)\n\t\t{\t\n\t\t\treturn (int)(Math.Ceiling(n/(double)a) + Math.Ceiling(m/(double)a));\n\t\t}\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "11e7f0acfeb06b6824ad85585d9a311b", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "public class Theatre{\n\t\n\tprivate int _n, _m, _a;\n\t\n\tpublic static void Main(string[] args){\n\t\tvar n = args[0];\n\t\tvar m = args[1];\n\t\tvar a = args[2];\n\t\tvar t = new Theatre(n,m,a);\n\t\tt.flagstones();\n\t}\n\t\n\tpublic Theatre(int n, int m, int a){\n\t\t_n = n; _m = m; _a = a;\n\t}\n\t\n\tpublic int flagstones(){\n\t\tint r = 0;\n\t\t\n\t\treturn r;\n\t}\n\t\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "93a244806b6590ef78fe0e22f26ed43c", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "public class Program\n {\n public static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split();\n var n = arr[0];\n var m = arr[1];\n var a = arr[2];\n Console.Write(Math.Round(double.Parse(n) / (double.Parse(a))) * Math.Round(double.Parse(m) / (double.Parse(a))));\n \n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd4b02c3133180d842d8a7ceb29dd804", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\nint Main(int n, int m, int a)\n {\n \n var x= (n+a-1)/a;\n var y= (m+a-1)/a;\n return x*y;\n \n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d9dbe28f147b2033627a2be1791b3b28", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace C {\n class Program {\n static bool IsPowerOfTwo (long x) {\n return (x != 0) && ((x & (x - 1)) == 0);\n }\n static void Main (string[] args) {\n string inp = Console.ReadLine ();\n var nums = inp.Split ();\n long n = Convert.ToInt64 (nums[0]);\n long m = Convert.ToInt64 (nums[1]);\n long a = Convert.ToInt64 (nums[2]);\n\n double landArea = n * m;\n double sqArea = a * a;\n long diff = Convert.ToInt64 (Math.Ceiling (landArea / sqArea));\n double tempLandArea = landArea;\n int count4 = 0;\n if (landArea == sqArea) {\n Console.WriteLine (1);\n } else if (IsPowerOfTwo (diff)) {\n Console.WriteLine (diff);\n } else {\n while (tempLandArea > sqArea) {\n tempLandArea /= 4;\n count4++;\n //Console.WriteLine (tempLandArea + \" \" + count4);\n }\n long res = 1;\n for (int i = 0; i < count4; i++) {\n res *= 4;\n }\n if (res > 1000_000_000_000_000_000) {\n Console.WriteLine (1000_000_000_000_000_000);\n } else\n Console.WriteLine (res);\n }\n \n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ecff4a837ed854bceac88807ace9f2be", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class Solution{\n\tpublic static void Main(String [] args){\n\t\tvar str = Console.ReadLine().split(' ');\n\t\tvar n = int.Parse(str[0]);\n\t\tvar m = int.Parse(str[0]);\n\t\tvar a = int.Parse(str[0]);\n\t\t\n\t\tn = Math.Ceiling((double)n/a);\n\t\tm = Math.Ceiling((double)m/a);\n\t\t\n\t\tConsole.WriteLine(n*m);\n\t\t\n\t\t\n\t\n\t}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0b9c9aea8f96c69580315526bb2c9122", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace 1Acodeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n double n = double.Parse(Console.ReadLine());\n double m = double.Parse(Console.ReadLine());\n double a = double.Parse(Console.ReadLine());\n Console.WriteLine(Math.Ceiling(n/a)*Math.Ceiling(m/a));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "868a5375a2f8e751ab6378ce7f0efcb3", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.Linq;\n\nusing System.Text;\n\n \n\nnamespace application1\n\n{\n\n class Program\n\n {\n\n static void Main(string[] args)\n\n {\n double n = 6, m = 6, a = 4;\n double sMain = n * m;\n double pCount = (n>m)?Math.Ceiling(n/a):Math.Ceiling(m/a);\n\n Console.WriteLine(pcount);\n\n }\n\n }\n\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d69535008fac5f85e0cc097c4f98749d", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TheaterSquare\n{\n class Program\n {\n static void Main(string[] args)\n {\n String data = Console.ReadLine();\n String[] inputs = data.Split(' ');\n\n int cityWidth = Convert.ToInt32(inputs[0]);\n int cityLength = Convert.ToInt32(inputs[1]);\n int flagstoneSize = Convert.ToInt32(inputs[2]);\n\n int areaOfSquare = cityWidth * cityLength;\n int numFlagStone = 0;\n\n //int rem = areaOfSquare % (flagstoneSize * flagstoneSize);\n numFlagStone = (int)(Math.Ceiling((float)cityWidth / (float)flagstoneSize) * Math.Ceiling(((float)cityLength / (float)flagstoneSize));\n\n Console.WriteLine(\"{0}\", numFlagStone);\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4e6ea342e038942ea55201116a313ecc", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] b = s.Split(' ');\n int x = Convert.ToInt16(b[0]);\n int y = Convert.ToInt16(b[1]);\n int a = Convert.ToInt16(b[2]);\n int res = 0;\n int modX = a-x % a;\n int modY = a-y % a;\n if (modX != 0)\n {\n x +=modX;\n }\n if (modY != 0)\n {\n y += modY;\n }\n res = (x*y)/(a*a);\n Console.WriteLine(res+\"\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "47bcdc09e1202d66035bf69fad2d8683", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace ns{\n class Program{\n public static void Main(){\n string s[] = Console.ReadLine().Split();\n double n = double.Parse(s[0]);\n double m = double.Parse(s[1]);\n double a = double.Parse(s[2]);\n \n int result = Math.Ceiling(n/a)*Math.Ceiling(m/a);\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8b400ad9a9b55516677e42a398b3398a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Math;\n\nnamespace TheaterSquare\n{\n class Program\n {\n static void Main(string[] args)\n {\n String data = Console.ReadLine();\n String[] inputs = data.Split(' ');\n\n int cityWidth = Convert.ToInt32(inputs[0]);\n int cityLength = Convert.ToInt32(inputs[1]);\n int flagstoneSize = Convert.ToInt32(inputs[2]);\n\n int areaOfSquare = cityWidth * cityLength;\n int numFlagStone = 0;\n\n //int rem = areaOfSquare % (flagstoneSize * flagstoneSize);\n numFlagStone = Math.Ceiling((float)areaOfSquare / (float)(flagstoneSize * flagstoneSize));\n\n Console.WriteLine(\"{0}\", numFlagStone);\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1bf931e189641f846598554dbbddb511", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "static void Main()\n {\n int n = Int32.Parse(Console.ReadLine());\n int m = Int32.Parse(Console.ReadLine());\n int a = Int32.Parse(Console.ReadLine());\n if ((a <= n) && (a <= m))\n {\n n = n / a;\n m = m / a;\n Console.Write(n*m);\n Console.ReadKey();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9cdd61f0033cb395ef73851dc53a30c9", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "class Program\n{\n static void Main()\n {\n string inputString = System.Console.ReadLine();\n string[] input = inputString.Split(null);\n int n, m, a;\n if (int.TryParse(input[0], out n) && int.TryParse(input[1], out m) && int.TryParse(input[2], out a))\n {\n int length, breadth;\n if (n % a > 0)\n {\n length = n / a + 1;\n }\n else\n {\n length = n / a;\n }\n\n if (m % a > 0)\n {\n breadth = m / a + 1;\n }\n else\n {\n breadth = m / a;\n }\n\n System.Console.WriteLine(Convert.ToString(length * breadth));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ad92186ce96a9a239eacdf9737306fd8", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "namespace Codeforses_1A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] b = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n = b[0]; int m = b[1]; int a = b[2];\n int area = n * m; int plitka = a * a;\n if (a < n && a < m)\n Console.Write(area / plitka + 2);\n else if (a < n || a < m)\n Console.Write((area / plitka) + 1);\n\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "da296893fa27387e516f17d761ca6e2a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\n\nnamespace Codeforses\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] line = Console.ReadLine().Split(' ');\n\n\n\t\t\tlong n;\n\t\t\tlong.TryParse(line[0], out n);\n\t\t\tlong m;\n\t\t\tlong.TryParse(line[1], out m);\n\t\t\tlong a;\n\t\t\tlong.TryParse(line[2], out a);\n\n\t\t\tlong na = n / a;\n\t\t\tlong ma = m / a;\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (n % a != 0)\n\t\t\t\t{\n\t\t\t\t\tna += 1;\n\t\t\t\t}\n\t\t\t\tif (m % a != 0)\n\t\t\t\t{\n\t\t\t\t\tma += 1;\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(na * ma);\n\t\t\t}\n\n\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "23b0da342c44f018a4a5dc606890aa7b", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace prob2_Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n var all = Console.ReadLine();\n var splited = all.Split(\" \");\n var m = Convert.ToInt32(splited[0]);\n var n = Convert.ToInt32(splited[1]);\n var a = Convert.ToInt32(splited[2]);\n var power = Math.Pow(10,9);\n if ( m >= 1 && n >= 1 && a >= 1 && m <= power && n <= power && a <= power)\n {\n var heightNumber = HeightNumber(n, a);\n var widthNumber = WidthNumber(m , a);\n var totalNumber = heightNumber + widthNumber;\n Console.WriteLine(\" {0} , {1} , {2}\", widthNumber , heightNumber, totalNumber );\n \n } else\n {\n return;\n }\n\n static int HeightNumber(int n , int heightNumber)\n {\n if (n % heightNumber == 0)\n {\n var squareHeightNumber = n / heightNumber;\n return squareHeightNumber;\n }\n else\n {\n var squareHeightNumber = (n / heightNumber) + 1;\n return squareHeightNumber;\n }\n\n };\n static int WidthNumber(int m , int widthNumber)\n {\n if (n % widthNumber == 0)\n {\n var squareWidthNumber = m / widthNumber;\n return squareWidthNumber;\n }\n else\n {\n var squareWidthNumber = (m / widthNumber) + 1;\n return squareWidthNumber;\n }\n\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "12bcd695455378a630eeb2944233c67f", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\nnamespace pr111\n{\n class Program\n {\n public static void Main(string[] args)\n { int n,m,a,s;\n string[] line=Console.ReadLine().Split();\n n= Convert.ToInt16(line[0]);\n m= Convert.ToInt16(line[1]);\n a= Convert.ToInt16(line[2]);\n s=1;\n if(n%a==0) {s*=n} else {s*=(n+1)}\n if(m%a==0) {s*=m} else {s*=(m+1)}\n if(n==1) {s=m;if(a>=m){s=1;}}\n if(m==1) {s=n;if(a>=n){s=1;}}\n if(a==1) {s=n*m;}\n Console.WriteLine(Convert.ToString(s));\n //Console.ReadKey(true);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f6921a92a8e87b1335bb3582ec515ed3", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff/* \n* 1A - \u0422\u0435\u0430\u0442\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u044c\n* http://codeforces.com/problemset/problem/1/A\n*/\nusing System;\n\nnamespace RConsole\n{\n\tpublic class _1A\n\t{\n\t\tpublic static void Main ()\n\t\t{\n int n = Console.Read();\n int m = Console.Read();\n int a = Console.Read();\n Console.Write(Math.Ceiling((n / a)) + Math.Ceiling((m / a)));\n\t\t}\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "19911f8b774e8308f1ad0d6ae118f5fd", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TheaterSquare\n{\n class Program\n {\n static void Main(string[] args)\n {\n String data = Console.ReadLine();\n String[] inputs = data.Split(' ');\n\n int cityWidth = Convert.ToInt32(inputs[0]);\n int cityLength = Convert.ToInt32(inputs[1]);\n int flagstoneSize = Convert.ToInt32(inputs[2]);\n\n int areaOfSquare = cityWidth * cityLength;\n int numFlagStone = 0;\n\n //int rem = areaOfSquare % (flagstoneSize * flagstoneSize);\n numFlagStone = Math.Ceiling((float)areaOfSquare / (float)(flagstoneSize * flagstoneSize));\n\n Console.WriteLine(\"{0}\", numFlagStone);\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6789a8a5ca6c813cb6386e04252cf159", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CodeForce\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 a = int.Parse(input.Split(' ')[2]);\n int b = (float)Math.Ceiling(n / a);\n Console.WriteLine(((float)Math.Ceiling(n / a)) * ((float)Math.Ceiling(n / a)));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "955d624bf272ddd6e561150d0b866571", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n class MainClass\n {\n public 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 a = int.Parse(input[2]);\n int inc1, inc2;\n if (n % a != 0)\n {\n inc1++;\n }\n if (m % a != 0)\n {\n inc2++;\n }\n Console.WriteLine((n / a + inc1) * (m / a + inc2));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6cda3a396c6c747a1fa0339720100b13", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26228.4\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"CodeForses71A\", \"CodeForses71A\\CodeForses71A.csproj\", \"{B04B288A-8D37-40CF-888F-25FAE9164A0B}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B04B288A-8D37-40CF-888F-25FAE9164A0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B04B288A-8D37-40CF-888F-25FAE9164A0B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B04B288A-8D37-40CF-888F-25FAE9164A0B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B04B288A-8D37-40CF-888F-25FAE9164A0B}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b95de977b85c6912b1ca144f7710c95b", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace TheatreSquare{\n \n class Program(){\n \n static void Main(string[] args){\n \n string arrayToSplit = Console.ReadLine();\n \n string[] arraySplited = arrayToSplit.Split(' ');\n \n int[] arrayConverted = new int[arraySplited.Length];\n \n for(int i=0;i Convert.ToInt32(x)).ToArray();\n input[0] = input[0] % input[2] == 0 ? input[0] / input[2] : input[0] / input[2] + 1;\n input[1] = input[1] % input[2] == 0 ? input[1] / input[2] : input[1] / input[2] + 1;\n Console.WriteLine(input[0] * input[1]);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "569e19bd73bbecead4923b3dd272ac6c", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n \nnamespace TheatreSquare{\n \n class Program{\n \n static void Main(string[] args){\n \n string arrayToSplit = Console.ReadLine();\n \n string[] arraySplited = arrayToSplit.Split(' ');\n \n int[] arrayConverted = new int[arraySplited.Length];\n \n for(int i=0;isquare){\n nint+=1;\n }\n else{\n counter++;\n }\n decimal j = h/square;\n \n decimal jint = Math.Truncate(j);\n if(h>square){\n jint+=1;\n }\n else{\n counter++;\n }\n if(counter==0 || counter==1)\n Console.WriteLine(jint+nint);\n if(counter==2){\n Console.WriteLine(jint+nint+1);\n }\n \n return;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3c369cac67343100fdd23d1fa445b190", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TheaterSquare\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[] input = Console.ReadLine().Split(' ');\n int n = Int32.Parse(input[0]);\n int m = Int32.Parse(input[1]);\n int a = Int32.Parse(input[2]);\n Console.WriteLine((Math.Ceiling((double)m / a) * Math.Ceiling((double)n / a)));\n \n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a266c73c6e298e2c9246bb5287cc5fae", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "Using System;\n\nclass _1A {\n \n static void Main(String [] args) {\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 na = n % a == 0 ? n/a : n/a + 1;\n int ma = m % a == 0? m/a : m/a + 1;\n Console.WriteLine(na*ma);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "578b477d2dbf4df1a7b7a5f6efd00aa1", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Problem1 {\n class Program {\n static void Main(string[] args) {\n\n String input, val = \"\";\n uint n = 0, m = 0, a = 0;\n uint output = 0;\n bool nEmp = true, mEmp = true;\n\n input = Console.ReadLine();\n for (int i = 0; i < input.Length; i++) {\n val += input[i];\n if (input[i] == ' ' || i == input.Length - 1) {\n if (nEmp)\n n = Convert.ToInt32(val);\n else\n if (mEmp)\n m = Convert.ToInt32(val);\n else\n a = Convert.ToInt32(val);\n if (nEmp)\n nEmp = false;\n else\n mEmp = false;\n val = \"\";\n continue;\n }\n }\n if (n % a != 0)\n if (m % a != 0)\n output = (n / a + 1) * (m / a + 1);\n else\n output = (n / a + 1) * (m / a);\n else\n if (m % a != 0)\n output = (n / a) * (m / a + 1);\n else\n output = (n / a) * (m / a);\n\n Console.WriteLine(output.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7848c87fb9a0f71682ae785f34e18b56", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": " class CF1A\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n input[0] = input[0] % input[2] == 0 ? input[0] / input[2] : input[0] / input[2] + 1;\n input[1] = input[1] % input[2] == 0 ? input[1] / input[2] : input[1] / input[2] + 1;\n Console.WriteLine(input[0] * input[1]);\n }\n }\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b97bf995090ce258dcced2ab94313f46", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace hhh\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n UInt64 m, n, a, x, y;\n s = Console.ReadLine();\n n = Convert.ToUInt64(s.Split(' ')[0]);\n m = Convert.ToUInt64(s.Split(' ')[1]); ;\n if (n % a != 0)\n {\n x = n / a;\n x++;\n }\n else\n {\n x = n / a;\n }\n if (m % a != 0)\n {\n y = m / a;\n y = y + 1;\n }\n else\n {\n y = m / a;\n }\n Console.WriteLine(x * y);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f767b0554c74ddc91255f9bbe349f65e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.Linq;\n\nusing System.Text;\n\n \n\nnamespace application1\n\n{\n\n class Program\n\n {\n\n static void Main(string[] args)\n\n {\n double n = 6, m = 6, a = 4;\n double sMain = n * m;\n int pCount = (n>m)?Math.Ceiling(n/a):Math.Ceiling(m/a);\n\n Console.WriteLine(pcount);\n\n }\n\n }\n\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fd204b6e06de1dd9ec811d363fbeafcf", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nclass c {\nint main(){\nvar nma=Console.ReadLine()\n.Split().Select(e => int.parse(e));\nint n=nma[0];\nint m=nma[1];\nint a=nma[2];\nConsole.WriteLine(Math.Floor(n/a)*Math.Floor(m/a));\n\n\n}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d783f49cbb66b563c77b27d6b4bfb8b8", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.23107.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"testdsdad\", \"testdsdad\\testdsdad.csproj\", \"{33EB7226-C389-4B72-93BC-065E2DD87D4B}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{33EB7226-C389-4B72-93BC-065E2DD87D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{33EB7226-C389-4B72-93BC-065E2DD87D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{33EB7226-C389-4B72-93BC-065E2DD87D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{33EB7226-C389-4B72-93BC-065E2DD87D4B}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6a0002a0a9d9a7361490a11a2497acd5", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "if(a >= m && a >= n)\n{\n\treturn 1;\n}\n\nreturn (m / a + 1) + (n / a + 1);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0bd39c5235adad53ccb4d5e38300f8ef", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace theatresquare\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m, a;\n BigInteger count1=0, count2=0;\n n = Convert.ToInt32(Console.ReadLine());\n m= Convert.ToInt32(Console.ReadLine());\n a = Convert.ToInt32(Console.ReadLine());\n if (m <= a && n <= a)\n Console.WriteLine(1);\n else if(m > a&& n <= a){\n count1 = (BigInteger)(m % a);\n count1 = Math.Ceiling(count1);\n Console.WriteLine(count1);\n \n }\n else if(m <= a&& n > a){\n count2 = (BigInteger)(n % a);\n count2 = Math.Ceiling(count2);\n Console.WriteLine(count2);\n\n\n }\n else if (m > a && n > a)\n {\n count1 = (BigInteger)(m % a);\n count1 = Math.Ceiling(count1);\n count2 = (BigInteger)(n % a);\n count2 = Math.Ceiling(count2);\n Console.WriteLine(count1 + count2);\n\n\n }\n /*{\n if (m <= a)\n {\n count1 = 1;\n }\n else if (m > a)\n {\n count1 = (double)(m % a);\n count1 = Math.Ceiling(count1);\n }\n if (n <= a)\n {\n count2 = 1;\n }\n else if (n > a)\n {\n count2 = (double)(n % a);\n count2 = Math.Ceiling(count2);\n }\n Console.WriteLine(count1 + count2);\n }*/\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "76401892b6f73557e2d237d8205dcfa2", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8 {\n class Program {\n static void Main(string[] args) {\n\n float n = 6;\n float m = 6;\n float a =4;\n float a;\n float b;\n\n a = (int)Math.Ceiling(height / tileSize);\n Console.WriteLine(a);\n \n\n\n b = (int)Math.Ceiling(width / tileSize);\n Console.WriteLine(b);\n Console.WriteLine(a * b);\n\n\n \n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "287b6442f9ce41abf3676081b6364207", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.Linq;\n\nusing System.Text;\n\n \n\nnamespace application1\n\n{\n\n class Program\n\n {\n\n staticvoid Main(string[] args)\n\n {\n int n = 6, m = 6, a = 4;\n int sMain = n * m;\n int pCount = (n>m)?Math.Ceiling(n/a):Math.Ceiling(m/a);\n\n Console.WriteLine(pcount);\n\n }\n\n }\n\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a2ff1e3e2cd5338609f4683bc7a80c3e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "int Func(int n, int m, int a)\n{\n if (a >= n && a >=m)\n {\n return 1;\n }\n \n return (n / a + 1) + (m / a + 1);\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3abb2520d8bd2ccfb9dee98d11418560", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": " \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 Console.WriteLine(TheatreSquare(n, m, a)); \n }\n static int TheatreSquare(int n,int m, int a)\n {\n int x = n / a;\n int y = m / a;\n\n if (n % a != 0)\n x++;\n if(m % a != 0)\n y++;\n return x * y;\n } \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "740f1c7f358418a5f0d811e9b058105b", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\n class Program\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\n int p = n * m;\n int aa = a * a;\n int k = 0;\n\n while ((p > 0) || ((k % 2) == 1))\n {\n p -= aa;\n k++;\n }\n\n Console.WriteLine(k);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1b3f09b64f05ae37afa1f6206899d455", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace c_sharp\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 = int.parse(console.readline());\n int asd;\n asd = (n * m) / (a * a);\n console.write(asd);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d74ad43f01d12c30cada0c3ff3de6c22", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Pug\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong nums[] = Array.ConvertAll(Console.ReadLine().Split(), ulong.Parse);\n\n ulong perRow = nums[0] / nums[2] + (nums[0] % 2 != 0) 1 : 0;\n ulong perColumn = nums[1] / nums[2] + (nums[1] % 2 != 0) 1 : 0;\n\n Console.WriteLine(perRow * perColumn);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fe6cfb0c4b146538ef90b18e02d30f4c", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication12\n{\n internal class Program\n {\n static void Main(string[] args)\n { \n long k,x,y;\n string[] numbers = Console.ReadLine().Split(' ');\n long n = long.Parse(numbers[0]);\n long m = long.Parse(numbers[1]);\n long a = long.Parse(numbers[2]);\n if (n % a == 0) { x = n / a }\n else { x = n / a;\n x++;\n }\n if (m % a == 0) { x = n / a }\n else\n {\n y = m / a;\n y++;\n }\n Console.WriteLine(x * y);\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8ca507b5c21c8b6f254113105d8caa2c", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nclass Program\n{\n static void Main(string[] args)\n {\n var h1 = Console.ReadLine().Split( );\n \n var n = ulong.Parse(h1[0]);\n var m = ulong.Parse(h1[1]);\n var a = ulong.Parse(h1[2]);\n var h2 = (ulong)(Math.Ceiling(n / a + 0.0 ) * Math.Ceiling(m / a + 0.0));\n Console.WriteLine(h2);\n\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7b08aa5b8791723b5994e483d37b3c83", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "public class Main {\n public static void Main(string[] args) {\n\t var input = Console.ReadLine().Split(' ');\n \tvar n = long.Parse(input[0]);\n \tvar m = long.Parse(input[1]);\n \tdouble a = long.Parse(input[2]);\n \t\n \tConsole.WriteLine(Math.Ceiling(n / a) * Math.Ceiling(m / a));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "de9e14e6caca311bb767345294603894", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\n class Program\n {\n static void Main()\n {\n string[] text = new string[3];\n\n text = Console.ReadLine().Split();\n\n decimal a = double.Parse(text[0]);\n decimal b = double.Parse(text[1]);\n decimal c = Int32.Parse(text[2]);\n //dwa\n a = Math.Ceiling(a / c);\n b = Math.Ceiling(b / c);\n\n long k = ((int)(a * b));\n\n Console.WriteLine(k);\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9b6b49f07dd61b0d9000a2fc9aa89d8e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace ns{\n class Program{\n public static void Main(){\n string s[] = Console.ReadLine().Split(' ');\n double n = double.Parse(s[0]);\n double m = double.Parse(s[1]);\n double a = double.Parse(s[2]);\n \n int result = Math.Ceiling(n/a)*Math.Ceiling(m/a);\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "908ab88c5281d61d0fbcf7c1c8534153", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "sing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace theatre_square\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 = int.Parse(Console.ReadLine());\n\n int x = n / a;\n int y = m / a;\n\n if ( n%a != 0)\n {\n y++;\n }\n if (m%a != 0)\n {\n x++;\n }\n Console.WriteLine(x*y);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "42de146e73fcc9e026f89a9cf51cba7a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n class Main\n {\n static void Main(string[] args)\n {\n double n, m, a;\n n = Double.Parse(Console.ReadLine());\n m = Double.Parse(Console.ReadLine()); \n a = Double.Parse(Console.ReadLine());\n int k = (int) Math.Ceiling((n / a));\n int l = (int) Math.Ceiling((m / a));\n int answer = k * l;\n Console.WriteLine(answer);\n Console.ReadLine();\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2684ca3fd9ead71440fbfa7fc9c62661", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace prob2_Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n var all = Console.ReadLine();\n var splited = all.Split(\" \");\n var m = Convert.ToInt32(splited[0]);\n var n = Convert.ToInt32(splited[1]);\n var a = Convert.ToInt32(splited[2]);\n var power = Math.Pow(10,9);\n if ( m >= 1 && n >= 1 && a >= 1 && m <= power && n <= power && a <= power)\n {\n var heightNumber = HeightNumber(n, a);\n var widthNumber = WidthNumber(m , a);\n var totalNumber = heightNumber + widthNumber;\n Console.WriteLine(\"{0}\", totalNumber );\n \n } else\n {\n return;\n }\n\n\n }\n\n static int HeightNumber(int n, int heightNumber)\n {\n\n if (n % heightNumber == 0)\n {\n var squareHeightNumber = n / heightNumber;\n return squareHeightNumber;\n }\n else\n {\n var squareHeightNumber = (n / heightNumber) + 1;\n return squareHeightNumber;\n }\n\n }\n\n public static int WidthNumber(int m, int widthNumber)\n {\n if (m % widthNumber == 0)\n {\n var squareWidthNumber = m / widthNumber;\n return squareWidthNumber;\n }\n else\n {\n var squareWidthNumber = (m / widthNumber) + 1;\n return squareWidthNumber;\n }\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5116c80a32e94c7fae7b20401377710a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Class1\n{\n\tstatic void Main()\n\t{\n var input = Console.ReadLine().Split(' ');\n Console.WriteLine(Math.Ceiling(int64.Parse(input[0]) / int64.Parse(input[2])) * Math.Ceiling(int64.Parse(input[1]) / int64.Parse(input[2])) + 0.0);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6431ca0d096bddc88ffb238f8afd0243", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic; \nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nclass c {\nstatic void Main(){\nvar nma=Console.ReadLine()\n.Split().Select(e => int.Parse(e)).ToList();\nint n=nma[0];\nint m=nma[1];\nint a=nma[2];\nConsole.WriteLine(Math.Ceiling((long)n/a)*Math.Ceiling((long)m/a));\n\n\n}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "327e16b01ad687d4288e521f525f5801", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace c_sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.Title = \"c sharp\";\n int n = int.parse(console.readline());\n int m = int.parse(console.readline());\n int a = int.parse(console.readline());\n int asd;\n asd = (n * m) / (a * a);\n console.write(asd);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4f848765f8d42def49c318be7be75b4e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": " long n, m, a;\n n = Convert.ToInt64(Console.Read());\n m = Convert.ToInt64(Console.Read());\n a = Convert.ToInt64(Console.Read());\n var flagsByRow = Math.Ceiling((double)n / a);\n var flagsByColumn = Math.Ceiling((double)m / a);\n var result = flagsByRow * flagsByColumn;\n Console.WriteLine(result);\n Console.ReadLine();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0c9ca1e413f3071e2f0ca407adb8940c", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0422\u0435\u0430\u0442\u0440\u0430\u043b\u044c\u043d_\u043f\u043b\u043e\u0449\u0430\u0434\u044c\n{\n class Program\n {\n static void Main(string[] args)\n {\n int result = 0;\n string[] input = Console.ReadLine().Split(new char[] {}, StringSplitOptions.RemoveEmptyEntries);\n decimal width = int.Parse(input[1]);\n decimal height = int.Parse(input[0]);\n int size = int.Parse(input[2]);\n\n result = (int)Math.Floor(width / size) * (int)Math.Floor(height / size);\n\n if (width % size != 0 && height % size != 0)\n result -= 1;\n\n if (width % size != 0)\n result +=(int)Math.Ceiling(width / size);\n else\n result += 0;\n\n if (height % size != 0)\n result += (int)Math.Ceiling(height / size);\n else\n result += 0;\n \n Console.WriteLine(result);\n //Console.ReadLine();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "56ada50e14a604110765407386d2aa66", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication9\n{\n class Program\n {\n static void Main(string[] args)\n {\n StreamWriter sw = File.CreateText(\"standard input\");\n sw.Close();\n StreamReader sr = File.OpenText(\"standart output\");\n int m = Convert.ToInt32(Console.Read());\n int n = Convert.ToInt32(Console.Read());\n int a = Convert.ToInt32(Console.Read());\n int s = m/a;\n if (s != m % a)\n {\n s=m/a+1;\n }\n int s1 = n/a+1;\n if(s1 != n%a)\n {\n s1=n/a+1;\n }\n\n int k = s + s1;\n Console.WriteLine(k);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2eb7350200f778252f3bcd1688cf7e5e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace theatre_square\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = int.Parse(Console.ReadLine());\n long m = int.Parse(Console.ReadLine());\n int a = int.Parse(Console.ReadLine());\n\n int x = n / a;\n int y = m / a;\n\n if ( n%a != 0)\n {\n y++;\n }\n if (m%a != 0)\n {\n x++;\n }\n Console.WriteLine(x*y);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "69fa69f8a023f83df3606050f55ab683", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "var mna = Console.ReadLine().Split(' ');\n\n long m = Convert.ToInt64(mna[0]);\n long n = Convert.ToInt64(mna[1]);\n long a = Convert.ToInt64(mna[2]);\n\n long num = Convert.ToInt64(Math.Ceiling((double)m / a)) * Convert.ToInt64(Math.Ceiling((double)n / a));\n\n Console.WriteLine(num);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4deb2104cd919dcc13672be1faddb864", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] values = s.Split(' ');\n int a = int.Parse(values[0]);\n int b = int.Parse(values[1]);\n int c = int.Parse(values[2]);\n Console.WriteLine(((a + c - 1) / c) * ((b + c - 1) / c)));\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "43c32908c7dbde727eeec61b13a59805", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic; \nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nclass c {\nstatic void Main(){\nvar nma=Console.ReadLine()\n.Split().Select(e => int.Parse(e)).ToList();\nint n=nma[0];\nint m=nma[1];\nint a=nma[2];\nConsole.WriteLine(string.format(\"{0:30}\",Math.Ceiling((double)n/a)*Math.Ceiling((double)m/a)));\n\n\n}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "028b27464ac6099d9638c5821daecb59", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "void method()\n {\n long n, m, a;\n n = Convert.ToInt64(Console.ReadLine());\n m = Convert.ToInt64(Console.ReadLine());\n a = Convert.ToInt64(Console.ReadLine());\n var flagsByRow = Math.Ceiling((double)n / a);\n var flagsByColumn = Math.Ceiling((double)m / a);\n var result = flagsByRow * flagsByColumn;\n Console.WriteLine(result);\n Console.ReadLine();\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "47a3afaaa93052d42d962c89eb3daf29", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Plitka\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n ulong x = ulong.Parse(ss[0]);\n ulong y = ulong.Parse(ss[1]);\n ulong a = ulong.Parse(ss[2]);\n \n ulong n1 = x / a;\n if (n1 == 0) { n1 = 1} else\n {\n if (x % a > 1) n1++;\n }\n ulong n2 = y / a;\n if (n2 == 0) { n2 = 1; }\n else\n {\n if (y % a > 1) n2++;\n }\n \n \n if (x == 0 || y == 0 || a == 0 || (x > 1000000000) || (y > 1000000000) || (a > 1000000000)) { Console.WriteLine(\"error\"); } else Console.WriteLine(n1 * n2);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5bea5e15d6242a9763af4aee3b0765d9", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff/* \n* 1A - \u0422\u0435\u0430\u0442\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u044c\n* http://codeforces.com/problemset/problem/1/A\n*/\nusing System;\n\nnamespace RConsole\n{\n\tpublic class _1A\n\t{\n\t\tpublic static void Main ()\n\t\t{\n int n = Console.Read();\n int m = Console.Read();\n int a = Console.Read();\n Console.Write(Convert.ToString(Math.Ceiling((n / a)) + Math.Ceiling((m / a))));\n\t\t}\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c0ecb3cc22cad2494b434788674b5327", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace consoleTraining\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nums = Console.ReadLine().Split(' ');\n \n double n = 0, m = 0, a = 0; \n int result =0;\n n = Convert.ToDouble(nums[0]);\n m = Convert.ToDouble(nums[1]);\n a = Convert.ToDouble(nums[2]);\n if (n <= 1 || (m <= 1 || m >= Math.Pow(10, 9)) || (a >= Math.Pow(10, 9))|| n<=0 || m<=0 || a<=0) result=-1;\n int result = Convert.ToInt32(Math.Ceiling(n / a) * Math.Ceiling(m / a));\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4948590ecc766b39be5cdc47cf9f8f28", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace TheatreSquare\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong n = ulong.Parse(Console.ReadLine());\n ulong m = ulong.Parse(Console.ReadLine());\n ulong a = ulong.Parse(Console.ReadLine());\n\n ulong perRow = n / a + ((n % a != 0) ? 1 : 0);\n ulong perColumn = m / a + ((m % a != 0) ? 1 : 0);\n\n Console.WriteLine(perRow * perColumn);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cf938944e0a7a99627fd613d06a020e3", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Pug\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong[] nums = Array.ConvertAll(Console.ReadLine().Split(), ulong.Parse);\n\n ulong perRow = nums[0] / nums[2] + ((nums[0] % 2 != 0) ? 1 : 0);\n ulong perColumn = nums[1] / nums[2] + ((nums[1] % 2 != 0) ? 1 : 0);\n\n Console.WriteLine(perRow * perColumn);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b269824d933a305a0b101c9d6a8735d2", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1A1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, m, a,x,y;\n //\u0412\u0432\u043e\u0434 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \n try\n {\n string[] _str = Console.ReadLine().Split(' ');\n n = Convert.ToInt64(_str[0]);\n m = Convert.ToInt64(_str[1]);\n a = Convert.ToInt64(_str[2]);\n if(n >= 1 && m >= 1 && a >= 1 && a <= Math.Pow(10,9))\n if (n % a == 0)\n {\n x = n / a;\n }\n else\n {\n x = n / a;\n x++;\n }\n if (m % a == 0)\n {\n y = m / a;\n }\n else\n {\n y = n / a;\n y++;\n }\n Console.WriteLine(x * y);\n }\n catch\n {\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "67c7b86758cab2cd69d61b737e5f5935", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n \nnamespace TheatreSquare{\n \n class Program{\n \n static void Main(string[] args){\n \n string arrayToSplit = Console.ReadLine();\n \n string[] arraySplited = arrayToSplit.Split(' ');\n \n decimal[] arrayConverted = new decimal[arraySplited.Length];\n \n for(int i=0;i Convert.ToInt32(x)).ToArray();\n input[0] = input[0] % input[2] == 0 ? input[0] / input[2] : input[0] / input[2] + 1;\n input[1] = input[1] % input[2] == 0 ? input[1] / input[2] : input[1] / input[2] + 1;\n Console.WriteLine(input[0] * input[1]);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "89124487dd4bd6029980242a76e003fb", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\n using System;\n\npublic class Solution{\n\tpublic static void Main(string [] args){\n\t\tvar str = Console.ReadLine().split(' ');\n\t\tvar n = int.Parse(str[0]);\n\t\tvar m = int.Parse(str[0]);\n\t\tvar a = int.Parse(str[0]);\n\t\t\n\t\tn = Math.Ceiling((double)n/a);\n\t\tm = Math.Ceiling((double)m/a);\n\t\t\n\t\tConsole.WriteLine(n*m);\n\t\t\n\t\t\n\t\n\t}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d49499dc622a73f7fc43bf0df718b031", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8 {\n class Program {\n static void Main(string[] args) {\n\n float n;\n float m;\n float a;\n \n float b;\n\n int x = (int)Math.Ceiling(n / a);\n \n \n\n\n int y = (int)Math.Ceiling(m / a);\n \n Console.WriteLine(x * y);\n\n\n \n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0ca438941d6187272c28773609540c7d", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Collections.ObjectModel;\nusing System.Management;\nusing System.Net;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Security.Cryptography;\nusing System.Diagnostics;\nusing NetFwTypeLib;\nusing MySql.Data.MySqlClient;\nusing System.Collections.Concurrent;\nusing System.Data;\nusing System.Runtime.InteropServices;\n/*\nusing MonoTorrent.BEncoding;\nusing MonoTorrent.Common;\nusing MonoTorrent.Client.Tracker;\nusing MonoTorrent.Client;*/\n\nnamespace Test1\n{\n public static class PerformanceInfo\n {\n [DllImport(\"psapi.dll\", SetLastError = true)]\n [return: MarshalAs(UnmanagedType.Bool)]\n public static extern bool GetPerformanceInfo([Out] out PerformanceInformation PerformanceInformation, [In] int Size);\n\n [StructLayout(LayoutKind.Sequential)]\n public struct PerformanceInformation\n {\n public int Size;\n public IntPtr CommitTotal;\n public IntPtr CommitLimit;\n public IntPtr CommitPeak;\n public IntPtr PhysicalTotal;\n public IntPtr PhysicalAvailable;\n public IntPtr SystemCache;\n public IntPtr KernelTotal;\n public IntPtr KernelPaged;\n public IntPtr KernelNonPaged;\n public IntPtr PageSize;\n public int HandlesCount;\n public int ProcessCount;\n public int ThreadCount;\n }\n\n public static Int64 GetPhysicalAvailableMemoryInMiB()\n {\n PerformanceInformation pi = new PerformanceInformation();\n if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi)))\n {\n return Convert.ToInt64((pi.PhysicalAvailable.ToInt64() * pi.PageSize.ToInt64() / 1048576));\n }\n else\n {\n return -1;\n }\n\n }\n\n public static Int64 GetTotalMemoryInMiB()\n {\n PerformanceInformation pi = new PerformanceInformation();\n if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi)))\n {\n return Convert.ToInt64((pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64() / 1048576));\n }\n else\n {\n return -1;\n }\n\n }\n }\n\n class Program\n {\n private static string FileListName = \"filelist.dat\";\n private static StreamWriter sw;\n\n private static void DirRecursive(string dir)\n {\n DirectoryInfo rootDir = new DirectoryInfo(dir);\n GetFiles(dir);\n foreach (DirectoryInfo each in rootDir.GetDirectories())\n {\n string tmpDir = string.Format(\"{0}/{1}\", dir, each.Name).TrimStart(\"./\".ToCharArray());\n sw.WriteLine(string.Format(\"0*{0}\", tmpDir).TrimStart(\"./\".ToCharArray()));\n DirRecursive(tmpDir);\n }\n }\n\n private static void GetFiles(string dir)\n {\n DirectoryInfo rootDir = new DirectoryInfo(dir);\n foreach (FileInfo each in rootDir.GetFiles())\n {\n if (each.Name != System.AppDomain.CurrentDomain.FriendlyName && FileListName != each.Name)\n sw.WriteLine(string.Format(\"1*{0}/{1}*{2}*{3}\", dir, each.Name.TrimEnd(\".lzma\".ToCharArray()), each.Length, GetFileHash(dir + \"/\" + each)).Replace(\"./\", String.Empty));\n }\n }\n\n\n private static string GetFileHash(string filename)\n {\n using (MD5 md5 = MD5.Create())\n {\n using (Stream stream = File.OpenRead(filename))\n {\n StringBuilder sb = new StringBuilder();\n foreach (byte each in md5.ComputeHash(stream))\n sb.Append(each.ToString(\"x2\"));\n return sb.ToString();\n }\n }\n }\n\n private static void asd_Moving(object sender, MovingEventArgs e)\n {\n Console.WriteLine(string.Format(\"4TO? {0}\", e.Message));\n }\n\n private static void Program_OutputDataReceived(object sender, DataReceivedEventArgs e)\n {\n Console.WriteLine(e.Data);\n }\n\n private static void Program_ErrorDataReceived(object sender, DataReceivedEventArgs e)\n {\n Console.WriteLine(e.Data);\n }\n\n /*\n static void Main(string[] args)\n {\n Console.Write(PasswordComplexityPolicy());\n }\n */\n static bool PasswordComplexityPolicy()\n {\n var tempFile = Path.GetTempFileName();\n\n Process p = new Process();\n p.StartInfo.FileName = Environment.ExpandEnvironmentVariables(@\"%SystemRoot%\\system32\\secedit.exe\");\n p.StartInfo.Arguments = String.Format(@\"/export /cfg \"\"{0}\"\" /quiet\", tempFile);\n p.StartInfo.CreateNoWindow = true;\n p.StartInfo.UseShellExecute = false;\n p.Start();\n p.WaitForExit();\n\n var file = IniFile.Load(tempFile);\n\n IniSection systemAccess = null;\n var passwordComplexityString = \"\";\n var passwordComplexity = 0;\n\n return file.Sections.TryGetValue(\"System Access\", out systemAccess)\n && systemAccess.TryGetValue(\"PasswordComplexity\", out passwordComplexityString)\n && Int32.TryParse(passwordComplexityString, out passwordComplexity)\n && passwordComplexity == 1;\n }\n\n class IniFile\n {\n public static IniFile Load(string filename)\n {\n var result = new IniFile();\n result.Sections = new Dictionary();\n var section = new IniSection(String.Empty);\n result.Sections.Add(section.Name, section);\n\n foreach (var line in File.ReadAllLines(filename))\n {\n var trimedLine = line.Trim();\n switch (line[0])\n {\n case ';':\n continue;\n case '[':\n section = new IniSection(trimedLine.Substring(1, trimedLine.Length - 2));\n result.Sections.Add(section.Name, section);\n break;\n default:\n var parts = trimedLine.Split('=');\n if (parts.Length > 1)\n {\n section.Add(parts[0].Trim(), parts[1].Trim());\n }\n break;\n }\n }\n\n return result;\n }\n\n public IDictionary Sections { get; private set; }\n }\n\n class IniSection : Dictionary\n {\n public IniSection(string name)\n : base(StringComparer.OrdinalIgnoreCase)\n {\n this.Name = name;\n }\n\n public string Name { get; private set; }\n }\n\n static void Test()\n {\n string conString = \"Database=chat;Data Source=127.0.0.1;Port=3306;User Id=root;Password=;\";\n MySqlConnection mysql = new MySqlConnection(conString);\n mysql.Open();\n Console.WriteLine(\"\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e!\");\n\n MySqlCommand mc = new MySqlCommand(\"select * from `barbars`\", mysql);\n MySqlDataReader mdr = mc.ExecuteReader();\n System.Data.DataTable DT = new System.Data.DataTable();\n DT.Load(mdr);\n Console.WriteLine(DT.Rows.Count.ToString());\n //MySqlCommand mc1 = new MySqlCommand(\"INSERT INTO `barbars` (`id`) VALUES ('13')\", mysql);\n Console.WriteLine(DT.Rows[0][\"login\"]);\n }\n\n static object obj = new object();\n\n static async void Test1()\n {\n lock (obj)\n {\n try\n {\n int[] intArray = new int[5] { 1, 2, 3, 4, 5 };\n for (int i = 0; i <= intArray.Length; i++)\n {\n Console.WriteLine(intArray[i].ToString());\n }\n }\n catch (Exception e)\n {\n Console.WriteLine(e.Message);\n }\n }\n }\n\n private static string SaltKey = \"WWTXaNuZvsAcJKGK\"; // 16 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 ASCII\n private static string IVKey = \"iAS1QuN1j7QqE0Wf\"; // 16 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 ASCII\n\n public static byte[] String_Enc(string Message)\n {\n\n byte[] SaltKeyInBytes = Encoding.ASCII.GetBytes(SaltKey);\n byte[] IVKeyInBytes = Encoding.ASCII.GetBytes(IVKey);\n byte[] MessageBytes = Encoding.UTF8.GetBytes(Message);\n\n Aes AES = Aes.Create();\n AES.KeySize = 128;\n AES.BlockSize = 128;\n AES.Padding = PaddingMode.Zeros;\n\n System.IO.MemoryStream ms = new System.IO.MemoryStream();\n CryptoStream cs =\n new CryptoStream(ms,\n AES.CreateEncryptor(SaltKeyInBytes, IVKeyInBytes),\n CryptoStreamMode.Write);\n\n cs.Write(MessageBytes, 0, MessageBytes.Length);\n cs.Close();\n\n return ms.ToArray();\n }\n\n static void Main(string[] args)\n {\n int N, M, A;\n double Xl, Yl;\n N = int.Parse(Console.ReadLine());\n M = int.Parse(Console.ReadLine());\n A = int.Parse(Console.ReadLine());\n Xl = Math.Ceiling((N * 1.0) / A);\n Yl = Math.Ceiling((M * 1.0) / A);\n Console.WriteLine(((int)(Xl * Yl)).ToString());\n /*\n string patternLogin = \"^([-_\\\\[\\\\]A-Za-z0-9\\\\.]{4,16})$\";\n Console.WriteLine(Regex.IsMatch(\"OKAY\u044eFACE[1-23]\", patternLogin).ToString());\n /*\n PerformanceCounter cpuCounter;\n cpuCounter = new PerformanceCounter(\"Processor\", \"% Processor Time\", \"_Total\");\n\n Int64 PAM = PerformanceInfo.GetPhysicalAvailableMemoryInMiB();\n Int64 TM = PerformanceInfo.GetTotalMemoryInMiB();\n float percentFree = ((float)PAM / (float)TM) * 100;\n float percentOccupied = 100 - percentFree;\n\n Console.WriteLine(\"\u0417\u0430\u043d\u044f\u0442\u043e\u0441\u0442\u044c \u0432\u044b\u0447\u0435\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432:\");\n Console.WriteLine(string.Format(\"RAM: {0:0.0}%; \u0421\u0432\u043e\u0431\u043e\u0434\u043d\u043e: {1}\u041c\u0431; \u0412\u0441\u0435\u0433\u043e: {2}\u041c\u0431;\", percentOccupied, PAM, TM));\n cpuCounter.NextValue();\n System.Threading.Thread.Sleep(1000);\n Console.WriteLine(string.Format(\"CPU: {0:0.0}%\", cpuCounter.NextValue()));\n\n\n /*\n Console.WindowWidth = 120;\n Console.WindowHeight = 30;\n // \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 //\n string UrlToDownload = null;\n string Title = null;\n string Output = null;\n Dictionary Content = new Dictionary();\n Dictionary> Files = new Dictionary>();\n // --------------------------//\n\n string Path = \"http://player.uz/401/\";\n \n if (!Regex.IsMatch(Path, \"http:\\\\/\\\\/player\\\\.uz\\\\/([0-9]{0,9})\\\\/\"))\n {\n Console.WriteLine(\"\u041d\u0435\u0432\u0435\u0440\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0435\u0440\u0438\u0430\u043b.\");\n Console.ReadKey();\n Environment.Exit(0);\n }\n \n try\n {\n using (WebClient client = new WebClient())\n {\n client.Proxy = null;\n Output = client.DownloadString(Path);\n }\n }\n catch (Exception e)\n {\n if (e.Message.Contains(\"not be resolved\"))\n Console.WriteLine(\"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.\");\n else\n {\n Console.WriteLine(string.Format(\"\u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430: {0}\", e.Message));\n }\n }\n if (!string.IsNullOrWhiteSpace(Output))\n {\n /*\n Match m_Content = Regex.Match(Output, \"\\\\
(.*)\\\\
\", RegexOptions.Multiline);\n if (!m_Content.Success) return;\n Console.WriteLine(\"\u041f\u043e\u0439\u043c\u0430\u043b!\");\n string s_Content = m_Content.Value\n .Replace(\"
\", string.Empty)\n .Replace(\"
  • \", string.Empty)\n .Replace(\"
      \", string.Empty)\n .Replace(\"
    \", string.Empty)\n .Replace(\"
  • \", string.Empty);\n s_Content = Regex.Replace(s_Content, \"\\\\s{4,}\", string.Empty);\n s_Content = Regex.Replace(s_Content, \"\\\\([A-Za-z\u0410-\u042f\u0430-\u044f0-9]{0,9})\\\\<\\\\/h3\\\\>\", string.Empty);\n s_Content = Regex.Replace(s_Content, \"(\\\\s{0,})\\\\<\\\\/div>(\\\\s{0,})\\\\<\\\\/div\\\\>(\\\\s{0,})\\\\
    \", string.Empty);\n string[] ar_Content = s_Content.Split(new string[] { \"
  • \" }, StringSplitOptions.RemoveEmptyEntries);\n foreach(string each in ar_Content)\n {\n try\n {\n if (!string.IsNullOrWhiteSpace(each))\n {\n string[] ar_each = each.TrimEnd().Split(new string[] { \"/\\\">\" }, StringSplitOptions.RemoveEmptyEntries);\n if (ar_each.Length == 2)\n {\n string[] rawAr_each1 = ar_each[1].Split(new string[] { \" /\" }, StringSplitOptions.RemoveEmptyEntries);\n if (rawAr_each1.Length == 1)\n ar_each[1] = rawAr_each1[0];\n else if (rawAr_each1.Length > 2)\n ar_each[1] = string.Format(\"{0} / {1}\", rawAr_each1[0], rawAr_each1[1].Trim());\n\n int id = int.Parse(ar_each[0]);\n if (!string.IsNullOrWhiteSpace(ar_each[1]))\n Content.Add(id, ar_each[1]);\n }\n }\n }\n catch { continue; }\n }\n s_Content = null; ar_Content = null;\n \n Match m_Url = Regex.Match(Output, \"row\\\\.file = '(.*)' \\\\+ row\\\\.file;\", RegexOptions.Multiline);\n if (!m_Url.Success) return;\n UrlToDownload = m_Url.Value.Replace(\"row.file = '\", string.Empty).Replace(\"' + row.file;\", string.Empty);\n Console.WriteLine(UrlToDownload);\n\n Match m_Title = Regex.Match(Output, \"\\\\(.*)\\\\<\\\\/title\\\\>\", RegexOptions.Multiline);\n if (!m_Title.Success) return;\n Title = m_Title.Value.Replace(\"\", string.Empty)\n .Replace(\"\", string.Empty)\n .Replace(\" - Player\", string.Empty);\n\n string[] rawTitle = Title.TrimEnd().Split(new string[] { \" /\" }, StringSplitOptions.RemoveEmptyEntries);\n if (rawTitle.Length == 1)\n Title = rawTitle[0];\n else if (rawTitle.Length > 2)\n {\n if (rawTitle[1].Contains(\";\"))\n Title = rawTitle[0];\n else\n Title = string.Format(\"{0} / {1}\", rawTitle[0], rawTitle[1].Trim());\n }\n rawTitle = null;\n Console.WriteLine(Title);\n\n Match m_Files = Regex.Match(Output, \"var episodes = \\\\[(.*)\\\\}\\\\];\");\n if (!m_Files.Success) return;\n string s_Files = m_Files.Value.Replace(\"\\\\/\", \"/\")\n .Replace(\"\\\"\", string.Empty)\n .Replace(\"provider:http,season:\", string.Empty)\n .Replace(\"episode:\", string.Empty)\n .Replace(\"var episodes = [{\", string.Empty)\n .Replace(\"}];\", string.Empty);\n s_Files = Regex.Replace(s_Files, \"id:([0-9]{0,9}),file:\", string.Empty);\n string[] as_Files = s_Files.Split(new string[] { \"},{\" }, StringSplitOptions.RemoveEmptyEntries);\n foreach (string each in as_Files)\n {\n string[] raw = each.Split(',');\n if (raw.Length == 3)\n {\n int Season, Episode;\n int.TryParse(raw[1], out Season); int.TryParse(raw[2], out Episode);\n if (Season != 0 && Episode != 0 && !string.IsNullOrWhiteSpace(raw[0]))\n {\n if (!Files.ContainsKey(Season))\n Files.Add(Season, new Dictionary());\n Files[Season].Add(Episode, raw[0]);\n }\n }\n }\n s_Files = null; as_Files = null; Output = null;\n Console.WriteLine(\"\u0421\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0437\u0434\u0430\u043d!\");\n foreach(var p_Season in Files)\n {\n foreach (var p_Episodes in p_Season.Value)\n {\n Console.WriteLine(string.Format(\"\u0421\u0435\u0437\u043e\u043d: {0}; \u042d\u043f\u0438\u0437\u043e\u0434: {1}; \u0421\u0441\u044b\u043b\u043a\u0430: {2}{3}\", p_Season.Key, p_Episodes.Key, UrlToDownload, p_Episodes.Value));\n }\n }\n }\n /*\n int tmp;\n Random randInt = new Random();\n int[] player = new int[10];\n for (int i = 0; i < 10; i++)\n {\n player[i] = randInt.Next(950, 3000);\n }\n //player[0] = 0; player[1] = 0; player[2] = 0; player[3] = 0;\n foreach(int each in player)\n {\n Console.Write(string.Format(\"{0} \", each));\n }\n Console.WriteLine();\n\n int Team1Zero = 0;\n int Team2Zero = 0;\n for (int i = 0; i < 10; i++)\n {\n if (player[i] == 0)\n {\n if (i < 5)\n Team1Zero++;\n else\n Team2Zero++;\n }\n }\n if (Team1Zero != Team2Zero)\n {\n int DiffZero = (Team1Zero - Team2Zero) / 2;\n for (int i = 0; i < Math.Abs(DiffZero); i++)\n {\n int pos1 = -1, pos2 = -1;\n if (DiffZero < 0)\n {\n for (int j = 0; j < 5; j++)\n {\n if (player[j] != 0)\n {\n pos1 = j; break;\n }\n }\n for (int j = 5; j < 10; j++)\n {\n if (player[j] == 0)\n {\n pos2 = j; break;\n }\n }\n }\n else if (DiffZero > 0)\n {\n for (int j = 0; j < 5; j++)\n {\n if (player[j] == 0)\n {\n pos1 = j; break;\n }\n }\n for (int j = 5; j < 10; j++)\n {\n if (player[j] != 0)\n {\n pos2 = j; break;\n }\n }\n }\n tmp = player[pos1];\n player[pos1] = player[pos2];\n player[pos2] = tmp;\n }\n }\n\n foreach (int each in player)\n {\n Console.Write(string.Format(\"{0} \", each));\n }\n Console.WriteLine();\n\n for (int k = 0; k < 7; k++)\n {\n int Team1Pts = 0;\n int Team2Pts = 0;\n for (int i = 0; i < 10; i++)\n {\n if (i >= 0 && i <= 4)\n Team1Pts += player[i];\n else\n Team2Pts += player[i];\n }\n Console.WriteLine(string.Format(\"Before {0} step. Team 1 PTS: {1}; Team 2 PTS: {2}; Diff: {3};\", k + 1, Team1Pts, Team2Pts, Math.Abs(Team1Pts - Team2Pts)));\n int NeedPts = (Team1Pts - Team2Pts) / 2;\n int MinDiff = int.MaxValue, pos1 = -1, pos2 = -1;\n for (int i = 0; i < 5; i++)\n {\n if (player[i] != 0)\n {\n for (int j = 5; j < 10; j++)\n {\n if (player[j] != 0 && player[i] != player[j])\n {\n if (NeedPts > 0)\n {\n int a = NeedPts - (player[i] - player[j]);\n if (a >= 0 && a < MinDiff && NeedPts > a)\n {\n MinDiff = a;\n pos1 = i;\n pos2 = j;\n }\n }\n else if (NeedPts < 0)\n {\n int a = Math.Abs(NeedPts) - (player[j] - player[i]);\n if (a >= 0 && a < MinDiff && Math.Abs(NeedPts) > a)\n {\n MinDiff = a;\n pos1 = i;\n pos2 = j;\n }\n }\n\n }\n }\n }\n }\n if (pos1 != -1 && pos2 != -1)\n {\n Console.WriteLine(\"({0}){1} <-> ({2}){3}\", pos1, player[pos1], pos2, player[pos2]);\n tmp = player[pos1];\n player[pos1] = player[pos2];\n player[pos2] = tmp;\n }\n else\n break;\n }\n\n foreach (int each in player)\n {\n Console.Write(string.Format(\"{0} \", each));\n }\n Console.WriteLine();\n int Team1PtsD = 0;\n int Team2PtsD = 0;\n for (int i = 0; i < 10; i++)\n {\n if (i >= 0 && i <= 4)\n Team1PtsD += player[i];\n else\n Team2PtsD += player[i];\n }\n Console.WriteLine(string.Format(\"Done. Team 1 PTS: {0}; Team 2 PTS: {1}; Diff: {2};\", Team1PtsD, Team2PtsD, Math.Abs(Team1PtsD - Team2PtsD)));\n\n //Test();\n //string[] asd = new string[5];\n //foreach (string each in asd)\n //{\n // asd[3] = \"asdasd\";\n // Console.WriteLine(each);\n //}\n /*\n Task tkTest = new Task(() =>\n {\n while (true)\n {\n Thread.Sleep(1000);\n }\n });\n Console.WriteLine(tkTest.Status.ToString());\n tkTest.Start();\n Console.WriteLine(tkTest.Status.ToString());*/\n\n //Console.WriteLine(\"OK!\");\n\n /*\n MySqlCommand asd = new MySqlCommand(\"INSERT INTO `barbars` (`id`) VALUES ('12')\", mysql);\n asd.ExecuteNonQuery();\n Console.ReadKey();*/\n /*\n string query = \"UPDATE `accounts` SET `name`='Changed!' WHERE (`id`='0')\";\n MySqlCommand mc = new MySqlCommand(query, mysql);\n mc.ExecuteNonQuery();\n * */\n\n /*\n string query = \"SELECT * FROM `accounts` WHERE (`name`='StonyX1')\";\n MySqlCommand mc = new MySqlCommand(query, mysql);\n mc.ExecuteNonQuery();\n Console.WriteLine(\"\u0417\u0430\u043f\u0438\u0441\u044c \u043d\u0430\u0439\u0434\u0435\u043d\u0430!\");\n * /\n\n /*\n string query = \"SELECT * FROM `accounts` WHERE (`name`='StonyX')\";\n MySqlCommand mc = new MySqlCommand(query, mysql);\n MySqlDataReader mdr = mc.ExecuteReader();\n if (mdr.HasRows)\n {\n while (mdr.Read())\n {\n Console.WriteLine(mdr.GetString(\"pass\"));\n }\n //mdr.GetValues(okay);\n //Console.WriteLine(okay[2]);\n }\n else\n Console.WriteLine(\"\u0417\u0430\u043f\u0438\u0441\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430!\");\n /*\n string RegPath = @\"Software\\Valve\\Steam\\ActiveProcess\";\n Microsoft.Win32.RegistryKey RegKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(RegPath, true);\n RegKey.SetValue(\"SteamClientDll\", string.Format(\"{0}steamclient.dll\", AppDomain.CurrentDomain.BaseDirectory), Microsoft.Win32.RegistryValueKind.String);\n RegKey.Flush();\n RegKey.Close();*/\n\n //while (true)\n //{\n //Process[] csgo = Process.GetProcessesByName(\"csgo\");\n /*\n if(csgo.Length == 1)\n {\n Console.WriteLine(\"-=-=-=-=-=-=-=-=-\");\n Console.WriteLine(string.Format(\"NonpagedSystemMemorySize: {0}.\", csgo[0].NonpagedSystemMemorySize));\n Console.WriteLine(string.Format(\"PagedMemorySize: {0}.\", csgo[0].PagedMemorySize));\n Console.WriteLine(string.Format(\"PeakPagedMemorySize: {0}.\", csgo[0].PeakPagedMemorySize));\n Console.WriteLine(string.Format(\"PrivateMemorySize: {0}.\", csgo[0].PrivateMemorySize));\n }*/\n /*\n foreach (ProcessModule each in csgo[0].Modules)\n Console.WriteLine(each.FileName);*/\n //Thread.Sleep(1000);\n //}\n //Console.WriteLine(csgo[0].Modules);\n /*\n foreach (System.Diagnostics.Process each in processesByName)\n Console.WriteLine(string.Format(\"{0}\", each.ProcessName,));\n /*\n Test asd = new Test();\n asd.Moving += asd_Moving;\n asd.ASD(10);\n */\n\n //File.Move(\"asd.txt\", \"asd.txt.lzma\");\n\n /*\n Console.WriteLine(\"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0441\u043e \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u043c\u0438.\");\n sw = new StreamWriter(FileListName);\n DirRecursive(\".\");\n sw.Close();\n Console.Write(\"\u0413\u043e\u0442\u043e\u0432\u043e!\");*/\n\n\n\n /*\n StreamReader sr = new StreamReader(OutputFileName);\n while(!sr.EndOfStream)\n {\n string[] fields = sr.ReadLine().Split('*');\n Console.WriteLine(string.Format(\"{0} || {1} || {2}\", fields[0], fields[1], fields[2]));\n }\n */\n /*\n byte[] test = GetFileHash(\"mysql.data.dll\");\n Console.WriteLine(Encoding.Unicode.GetString(test));*/\n\n /*\n StreamReader sr = new StreamReader(\"out.txt\");\n int i = 0;\n while (!sr.EndOfStream)\n {\n try\n {\n WebClient client = new WebClient();\n client.Proxy = null;\n //client.DownloadProgressChanged +=\n // new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);\n client.DownloadFileCompleted +=\n new AsyncCompletedEventHandler(client_DownloadCompleted);\n string FileName = sr.ReadLine().Trim(\"http://mobius-geo.googlecode.com/svn/trunk/geodata/\".ToCharArray());\n //Console.WriteLine(FileName);\n Console.WriteLine(sr.ReadLine());\n client.DownloadFileAsync(new Uri(sr.ReadLine()), string.Format(@\"Geo\\{0}\", FileName));\n }\n catch\n {\n }\n finally\n {\n i++;\n }\n }*/\n\n //DirRecursive(\".\");\n /*\n TorrentManager torrentManager;\n\n EngineSettings engineSettings = new EngineSettings();\n\n engineSettings.SavePath = @\"D:\\Download\\Torrents\";\n\n engineSettings.GlobalMaxUploadSpeed = 5;\n\n TorrentSettings torrentSettings = new TorrentSettings();\n\n torrentSettings.MaxUploadSpeed = 5;\n\n torrentSettings.UploadSlots = 1;\n\n ClientEngine engine = new ClientEngine(engineSettings);//, torrentSettings\n\n Torrent TorFile = Torrent.Load(new Uri(@\"http://192.168.1.13/Ra2.torrent\"), @\"D:\\Download\\Torrents\\OkayFace.torrent\");\n torrentManager = new TorrentManager(TorFile, @\"D:\\Download\\Torrents\", torrentSettings, @\".\");\n\n engine.Register(torrentManager);\n engine.StartAll();\n\n torrentManager.PeerConnected += new EventHandler(PeerConnection);\n\n torrentManager.TorrentStateChanged += new EventHandler(torrentStateChanged);\n \n torrentManager.AddPeers(new Peer(\"\", new Uri(\"tcp://192.168.1.13:59398\")));\n\n while (torrentManager.State != TorrentState.Stopped && torrentManager.State != TorrentState.Paused)\n {\n Console.WriteLine(string.Format(\"{0:0.0}%\", torrentManager.Progress));\n System.Threading.Thread.Sleep(3000);\n\n if (torrentManager.Progress == 100.0)\n {\n Console.WriteLine(\"Done!\");\n return;\n }\n }\n\n /*\n byte[] AES_KEY = Encoding.ASCII.GetBytes(\"asdfghjklqwertyu\");\n byte[] AES_IV = Encoding.ASCII.GetBytes(\"asdfghjklqwertyu\");\n byte[] ENC = Encoding.UTF8.GetBytes(\"123\");\n\n Aes AES = Aes.Create();\n AES.KeySize = 128;\n AES.BlockSize = 128;\n AES.Padding = PaddingMode.Zeros;\n\n MemoryStream MS = new MemoryStream();\n CryptoStream CS = new CryptoStream(MS, AES.CreateEncryptor(AES_KEY, AES_IV), CryptoStreamMode.Write);\n\n CS.Write(ENC, 0, ENC.Length);\n CS.Close();\n\n Console.WriteLine(Encoding.UTF8.GetString(MS.ToArray()));\n\n byte[] encodingString = MS.ToArray();\n\n MemoryStream MSdec = new MemoryStream();\n CryptoStream CSdec = new CryptoStream(MSdec, AES.CreateDecryptor(AES_KEY, AES_IV), CryptoStreamMode.Write);\n\n CSdec.Write(encodingString, 0, encodingString.Length);\n CSdec.Close();\n\n Console.WriteLine(Encoding.UTF8.GetString(MSdec.ToArray()));\n \n /*\n byte[] test = Encoding.UTF8.GetBytes(\"MSG~*() StonyX: fq~/\");\n string asd = BitConverter.ToString(test).Replace(\"-\", string.Empty);\n Console.WriteLine(asd);*/\n /*\n byte[] output =\n StringToByteArray(\"00:09:00:09:00:02:00:00:10:00:00:01:cf:4a:6d:00:8a:dd:9a:c1:0a\".Replace(\":\", string.Empty));\n Console.WriteLine(Encoding.UTF8.GetString(output));\n * */\n\n /*\n string url = @\"\";\n WebClient client = new WebClient();\n client.DownloadProgressChanged +=\n new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);\n client.DownloadFileCompleted +=\n new AsyncCompletedEventHandler(client_DownloadCompleted);\n client.DownloadFileAsync(new Uri(url), \"asd.txt\");*/\n /*\n int uts = (int)(DateTime.Now - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds;\n Console.WriteLine(string.Format(\"{0}\", uts));\n DateTime dt = new DateTime(1970, 1, 1).ToLocalTime();\n dt = dt.AddSeconds(uts);\n Console.WriteLine(string.Format(\"{0}\", dt));*/\n //Console.WriteLine(Encoding.UTF8.GetByteCount(\"Prived[.]\"));\n /*string fileName = \"http://games.turontelecom.uz/forum/uploads/monthly_08_2014/post-1-0-01748200-1408294941.jpg\";\n try\n {\n WebClient client = new WebClient();\n client.DownloadProgressChanged +=\n new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);\n client.DownloadFileCompleted +=\n new AsyncCompletedEventHandler(client_DownloadCompleted);\n client.DownloadFileAsync(new Uri(fileName), \"Counter-Strike_GO_Turon_Telecom.jpg\");\n }\n catch (Exception e)\n {\n Console.WriteLine(e.Message);\n }\n /*\n ManagementObjectSearcher searcher = new ManagementObjectSearcher(\"SELECT * FROM Win32_Processor\");\n foreach(ManagementObject mo in searcher.Get())\n {\n Console.WriteLine(mo[\"Name\"] + \" \" + mo[\"ProcessorId\"]);\n }\n /*\n string test = \"lol<:>olol<:>\";\n string[] test1 = test.Split(new string[] {\"<:>\"}, StringSplitOptions.RemoveEmptyEntries);\n foreach (string value in test1)\n {\n Console.WriteLine(value+\".\");\n }*/\n\n /*\n string conString = \"Database=d2ls;Data Source=127.0.0.1;Port=3306;User Id=root;Password=\";\n MySqlConnection mysql = new MySqlConnection(conString);\n try\n {\n mysql.Open();\n Console.WriteLine(\"\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e!\");\n }\n catch { }\n\n string query = \"SELECT * FROM `40000` WHERE `Name`='Meon'\";\n MySqlCommand mc = new MySqlCommand(query, mysql);\n MySqlDataReader mdr = mc.ExecuteReader();\n DataTable dt = new DataTable();\n dt.Load(mdr);\n float Out = float.Parse(dt.Rows[0][\"Pts\"].ToString());\n Console.WriteLine(string.Format(\"{0:0.00}\", Out + 1));\n\n string s_Points = string.Format(\"{0:0.00}\", Out + 10.11).Replace(',', '.');\n string query1 = string.Format(\"UPDATE `40000` SET `Pts`='{0}' WHERE (`Name`='Meon')\", s_Points);\n MySqlCommand mc1 = new MySqlCommand(query1, mysql);\n mc1.ExecuteNonQuery();\n */\n /*\n StringBuilder sb = new StringBuilder();\n sb.Append(\"1\");\n sb.Append(\"2\");\n sb.AppendLine(\"3\");\n sb.Append(\"4\");\n Console.WriteLine(sb.ToString());*/\n \n\n Console.WriteLine(\"OK!\");\n Console.ReadKey();\n /*\n string query = \"SELECT * FROM `accounts` WHERE (`name`='StonyX1')\";\n MySqlCommand mc = new MySqlCommand(query, mysql);\n mc.ExecuteNonQuery();\n Console.WriteLine(\"\u0417\u0430\u043f\u0438\u0441\u044c \u043d\u0430\u0439\u0434\u0435\u043d\u0430!\");\n * /\n\n /*\n string query = \"SELECT * FROM `accounts` WHERE (`name`='StonyX')\";\n MySqlCommand mc = new MySqlCommand(query, mysql);\n MySqlDataReader mdr = mc.ExecuteReader();\n if (mdr.HasRows)\n {\n while (mdr.Read())\n {\n Console.WriteLine(mdr.GetString(\"pass\"));\n }\n //mdr.GetValues(okay);\n //Console.WriteLine(okay[2]);\n }\n else\n Console.WriteLine(\"\u0417\u0430\u043f\u0438\u0441\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430!\");\n * */\n\n /*}\n catch (MySqlException me)\n {\n Console.WriteLine(me.Message);\n }\n mysql.Close();*/\n\n \n }\n }\n\n class OkayFace\n {\n public string Text { get; set; }\n public OkayFace(string Text)\n {\n this.Text = Text;\n }\n }\n\n\n /*\n static void PeerConnection(object sender, PeerConnectionEventArgs e)\n {\n Console.WriteLine(e.PeerID.Uri.ToString());\n }\n\n static void PieceHashed(object sender, PieceHashedEventArgs e)\n {\n Console.WriteLine(e.PieceIndex.ToString());\n }\n\n static void torrentStateChanged(object sender, TorrentStateChangedEventArgs e)\n {\n Console.WriteLine(e.NewState.ToString());\n }\n * */\n\n /*\n static void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)\n {\n Console.SetCursorPosition(0, 0);\n Console.WriteLine(string.Format(\"{0}%\", e.ProgressPercentage));\n Console.WriteLine(string.Format(\"{0}/{1}\", e.BytesReceived, e.TotalBytesToReceive));\n }*/\n /*\n static void client_DownloadCompleted(object sender, AsyncCompletedEventArgs e)\n {\n if (e.Error == null)\n {\n Console.WriteLine(\"\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e.\");\n }\n else\n {\n Console.WriteLine(\"\u0424\u0430\u0439\u043b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d.\");\n }\n }\n /*\n public static byte[] StringToByteArray(String hex)\n {\n int NumberChars = hex.Length;\n byte[] bytes = new byte[NumberChars / 2];\n for (int i = 0; i < NumberChars; i += 2)\n bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);\n return bytes;\n }*/\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7b5ee759bafbcc9933d71653afc2cd87", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nclass theatresquare {\n\tpublic static void Main() {\n\t\tvar n = int.Parse(Console.Read());\n\t\tvar m = int.Parse(Console.Read());\n\t\tvar a = int.Parse(Console.Read());\n\t\tvar x = n % a ;\n\t\tvar y = m % a ;\n\t\tif (a > 0 && n > 0 && m > 0 && x*y != 0) {\n\t\t\tConsole.WriteLine((1 + (n - x) / a )* (1 +(m - y) / a)) ;\n\t\t} \n\t\telse if (a > 0 && n > 0 && m > 0 && x == 0 && y != 0) {\n\t\t Console.WriteLine(((n - x) / a )* (1 +(m - y) / a)) ;\n\t\t}\n\t\telse if (a > 0 && n > 0 && m > 0 && x != 0 && y == 0) {\n\t\t Console.WriteLine((1 + (n - x) / a )* ((m - y) / a)) ; \n\t\t}\n\t else if (a > 0 && n > 0 && m > 0 && x == 0 && y == 0) {\n\t\t Console.WriteLine(((n - x) / a )* ((m - y) / a)) ; \n\t\t}\n\t\t\n\t}\t\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2a8b18c18e786223b379e9d34c9fb5e5", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "namespace theatre_square\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, m, a;\n n = long.Parse(Console.ReadLine());\n m = long.Parse(Console.ReadLine());\n a = long.Parse(Console.ReadLine());\n long x = n / a;\n long y = m / a;\n if (n % a != 0)\n {\n x++;\n }\n if (m % a != 0)\n {\n y++;\n }\n Console.WriteLine(x * y);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2dc416d1f795e5d88c667e1936f00b4d", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "public class Theatre{\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ff261da2fa41ad59f1ca5d875333c084", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass MainClass {\n public static void Main (string[] args) {\n \n string text = Console.ReadLine();\n string[] numbers = text.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n \n int n = Convert.ToInt32(numbers[0]);\n int m = Convert.ToInt32(numbers[1]);\n int a = Convert.ToInt32(numbers[2]);\n \n int l = n / a;\n int c = m / a;\n\n if (n % a != 0 && (l==0 || l>=1)) ++l;\n if (m % a != 0 && (c==0 || c>=1)) ++c;\n\n int long = l * c;\n Console.WriteLine(result);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "afd7de779c81afa2e1b24a8d6978610a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "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 double a = double.Parse(Console.ReadLine());\n double b = double.Parse(Console.ReadLine());\n double d = double.Parse(Console.ReadLine());\n a = Math.Ceiling(a/d);\n b = Math.Ceiling(b / d;\n Console.WriteLine(a * b);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dc2cbe5d875df9255fbd59ead9b5a3e9", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Data.Linq;\n\npublic class Solution{\n\tpublic static void Main(string[] args){\n\t\tstring arr = Console.ReadLine();\n\t\tstring[] str = arr.split(' ');\n\t\tlong n = long.Parse(str[0]);\n\t\tlong m = long.Parse(str[1]);\n\t\tlong a = long.Parse(str[2]);\n\t\t\n\t\tn = (long)Math.Ceiling((double)n/a);\n\t\tm = (long)Math.Ceiling((double)m/a);\n\t\t\n\t\tConsole.WriteLine(n*m);\n\t\t\n\t\t\n\t\n\t}\n\n}\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eed679bddd3c3c87481b9319d1354a11", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "class ProblemD\n{\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(' ');\n double n = Convert.ToDouble(input[0]);\n double m = Convert.ToDouble(input[1]);\n double a = Convert.ToDouble(input[2]);\n double na = Math.Ceiling(n / a);\n double ma = Math.Ceiling(m / a);\n Console.WriteLine((long) (na * ma));\n //Console.ReadLine();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2d9555152c78ba1d09258987a1f636a7", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Data.Linq;\n\npublic class Solution{\n\tpublic static void Main(string[] args){\n\t\tstring[] str = Console.ReadLine().split(' ');\n\t\tint n = int.Parse(str[0]);\n\t\tint m = int.Parse(str[1]);\n\t\tint a = int.Parse(str[2]);\n\t n = Math.Ceiling((double)n/a);\n\t m = Math.Ceiling((double)m/a);\n\t\t\n\t\tConsole.WriteLine(n*m);\n\t\t\n\t\t\n\t\n\t}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e0fe242d59ccc153d13b652271c4d926", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n \nnamespace TheatreSquare{\n \n class Program{\n \n static void Main(string[] args){\n \n string arrayToSplit = Console.ReadLine();\n \n string[] arraySplited = arrayToSplit.Split(' ');\n \n decimal[] arrayConverted = new decimal[arraySplited.Length];\n \n for(int i=0;i\n\n \n \n Debug\n AnyCPU\n {F19C4253-21E1-4F12-9D59-5ADEC4589460}\n Exe\n Properties\n ConsoleApplication3\n ConsoleApplication3\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "57e6443bf766997bfe7f05ae07e55f82", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\n\nclass TheatreSquare {\n\n static void Main() \n {\n\tvar length = int.Parse(Console.Read());\n\tvar breadth = int.Parse(Console.Read());\n\tvar side = int.Parse(Console.Read());\n\n\tConsole.WriteLine( ( ((length + 3)/4) * ((breadth + 3)/4) ).ToString());\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "001e754f39ffa433805ab523a35cd1ec", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp2\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 v = (a * b) / c;\n Console.WriteLine(Math.Ceiling(v));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "641fa7ea68b1b3f2bad52ed2b4fb05e2", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int zlicz = 1;\n\n string s = Console.ReadLine();\n string[] tokens = s.Split(\" \");\n \n \n\n int m = int.Parse(tokens[0]);\n int n = int.Parse(tokens[1]);\n int a = int.Parse(tokens[2]);\n\n while ((a*a) <= m * n)\n {\n a = (zlicz*zlicz) * (a * a);\n zlicz++;\n }\n Console.WriteLine(zlicz * zlicz);\n \n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "945cd06406ba663144544615acf08ff7", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {A6433F69-09B1-4B38-A53A-A42C4F36580F}\n Exe\n Properties\n \u041f\u043b\u0438\u0442\u044b\n \u041f\u043b\u0438\u0442\u044b\n v3.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0f7a1b87a1040931a40fc71204be6b54", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nclass Program\n{\n static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n \n \n int m=int.Parse(s[0]);\n int n=int.Parse(s[1]);\n int a=int.Parse(s[2]);\n \n if(m%a==0)\n totalM=m/a;\n else\n totalM=(m/a)+1;\n \n if(n-a<=0)\n Console.Write(totalM);\n \n else\n {\n n=n-a;\n if(n%a==0)\n totalN=n/a;\n else\n totalN=n/a+1;\n Console.Write(totalM+totalN);\n }\n \n \n }\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0ece2c4850833fb50f56dc2ae6e5df73", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n \nnamespace TheatreSquare{\n \n class Program{\n \n static void Main(string[] args){\n \n string arrayToSplit = Console.ReadLine();\n \n string[] arraySplited = arrayToSplit.Split(' ');\n \n int[] arrayConverted = new int[arraySplited.Length];\n \n for(int i=0;i int.Parse(e));\nint n=nma[0];\nint m=nma[1];\nint a=nma[2];\nConsole.WriteLine(Math.Floor(n/a)*Math.Floor(m/a));\n\n\n}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e11fa5c2c300e71b8c8daf3f74438be3", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp7\n{\n class Program\n {\n private static void Main(string[] args)\n {\n int n = Console.ReadLine();\n int m = Console.ReadLine();\n int a = Console.ReadLine();\n decimal r1 = n/a;\n decimal r2 = m/a;\n if (n % a != 0) r1++;\n if (m % a != 0) r2++;\n\n Console.WriteLine(r1*r2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9738bf404f2e6e2935dcacf21241219c", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\n\nclass TheatreSquare {\n\n static void Main() \n {\n\tint length = int.Parse(Console.Read());\n\tint breadth = int.Parse(Console.Read());\n\tint side = int.Parse(Console.Read());\n\n\tConsole.WriteLine( ( ((length + 3)/4) * ((breadth + 3)/4) ).ToString());\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d0d9536306cabce5642cbf8d7c230454", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "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 pars;\n int[] sl1 = Console.ReadLine().Split(' ').Select(i => int.TryParse(i, out pars) ? pars : 0).ToArray();\n double ma, na, result;\n ma = Math.Ceiling((double)(sl1[0]) / sl1[2]);\n na = Math.Ceiling((double)(sl1[1]) / sl1[2]);\n result = ma + na;\n decimal dec = decimal.Parse(result, System.Globalization.NumberStyles.Any);\n Console.WriteLine(dec);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b2bb0270860713cce11231d0956407fb", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic; \nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nclass c {\nint main(){\nvar nma=Console.ReadLine()\n.Split().Select(e => int.Parse(e));\nint n=nma[0];\nint m=nma[1];\nint a=nma[2];\nConsole.WriteLine(Math.Floor(n/a)*Math.Floor(m/a));\n\n\n}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "94249d3a7a76694f3962fd03458e68ba", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "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[] vars;\n int pars;\n vars = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(i => int.TryParse(i, out pars) ? pars : 0).ToArray();\n\n int a = vars[0];\n int b = vars[1];\n int c = vars[2];\n\n if (c == b && c == a)\n {\n Console.WriteLine(1);\n return;\n } else if(c == a || c == b)\n {\n Console.WrileLine(Math.Ceiling(a/c));\n return;\n } else {\n float lenth = a > b ? a : b;\n float width = a > b ? b : a;\n Console.WriteLine(Math.Ceiling(lenth / c) + Math.Ceiling(width / c));\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6e3fdb75c95e1087799c079723ca9bfd", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication12\n{\n internal class Program\n {\n static void Main(string[] args)\n { \n long k,x,y;\n string[] numbers = Console.ReadLine().Split(' ');\n long n = long.Parse(numbers[0]);\n long m = long.Parse(numbers[1]);\n long a = long.Parse(numbers[2]);\n if (n % a == 0) { x = n / a; }\n else { x = n / a;\n x++;\n }\n if (m % a == 0) { x = n / a; }\n else\n {\n y = m / a;\n y++;\n }\n Console.WriteLine(x * y);\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d08b596f9ebd7d3d3b41e3f383770908", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace TheatreSquare\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tdouble bigOne = Math.Pow (10, 9);\n\t\t\tdouble flagstones = 0;\n\t\t\tint m, n, a;\n\t\t\tInt32.TryParse (Console.ReadLine (), out m) && (m >= 1) && (m <= bigOne);\n\t\t\tInt32.TryParse (Console.ReadLine (), out n) && (n >= 1) && (n <= bigOne);\n\t\t\tInt32.TryParse (Console.ReadLine (), out a) && (a >= 1) && (a <= bigOne);\n\t\t\tdouble flagstonesInARow = Math.Ceiling (m / (double) a);\n\t\t\tdouble flagstonesInAColumn = Math.Ceiling (n / (double) a);\n\t\t\tflagstones = flagstonesInARow * flagstonesInAColumn;\n\t\t\tConsole.WriteLine(flagstones);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0d09e49fb117ee1783b3aa7a4e358ab0", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using 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\n string x = Console.ReadLine();\n string[] s = x.Split(' ');\n int q = int.Parse(s[0]);\n int y = int.Parse(s[1]);\n int z = int.Parse(s[2]);\n Console.WriteLine(q%z + q%z);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c1a940cd0e8aa169c229ee25bf2f8473", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.Linq;\n\nusing System.Text;\n\n \n\nnamespace application1\n\n{\n\n class Program\n\n {\n\n static void Main(string[] args)\n\n {\n int n, m, a;\n\t\t n = Console.Read();\n\t\t m = Console.Read();\n\t\t a = Console.Read();\n\t\t double tempResult1 = Convert.ToDouble((n-1)/a);\n\t\t double tempResult2 = Convert.ToDouble((m-1)/a);\n\t\t double pCount = Math.Ceiling(tempResult) + Math.Ceiling(tempResult2);\n\n Console.WriteLine(pCount);\n\n }\n\n }\n\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65c041e42cdcce99effa9ec57f2cefdb", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "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 double a = double.Parse(args[0]);\n double b = double.Parse(args[1]);\n double d = double.Parse(args[2]);\n a = Math.Ceiling(a/d);\n b = Math.Ceiling(b / d);\n Console.WriteLine(a * b);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7ab4c232f9d253a1fa0fef551403420c", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff/* \n* 1A - \u0422\u0435\u0430\u0442\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u044c\n* http://codeforces.com/problemset/problem/1/A\n*/\nusing System;\n\n\nnamespace RConsole\n{\n\tpublic class _1A\n\t{\n\t\tpublic static void Main ()\n\t\t{\n string [] input = Console.ReadLine().Split(' ');\n double n = Convert.ToDouble(input[0]);\n double m = Convert.ToDouble(input[1]);\n double a = Convert.ToDouble(input[2]);\n Console.WriteLine((long)Math.Ceiling((long)n / (long)a) * Math.Ceiling((long)m / (long)a));\n\t\t}\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "488b7ef1485cb051d269df05f58ec407", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "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 height_of_rectangle ; //height of rectangle\n long width_of_rectangle; //width of rectangle\n long square; // square\n long constant_width_of_square; // constant\n long constant_height_of_square; // constant\n\n long num1 = 1; //number of squares for first row in rectangle\n long num2 = 1; // number of squares for first Horizontal in reactangle\n\n long result; // number of squares which need\n\n Console.WriteLine(\"please enter height of rectangle\");\n height_of_rectangle = Convert.ToInt64(Console.ReadLine()); //value of rectangle`s height\n Console.WriteLine(\"please enter width of rectangle\");\n width_of_rectangle = Convert.ToInt64(Console.ReadLine()); // value of rectangle`s width\n Console.WriteLine(\"please enter width or height of square\");\n square = Convert.ToInt64(Console.ReadLine()); // value of square`s height/width\n\n constant_width_of_square = square;\n constant_height_of_square = square;\n\n //number of squares in first row in rectangle\n\n while (square < width_of_rectangle)\n {\n num1 = num1 + 1;\n square = square + constant_width_of_square;\n }\n\n //number of squares in first Horizontal in reactangle\n\n while (constant_height_of_square < height_of_rectangle)\n {\n num2 = num2 + 1;\n constant_height_of_square = constant_height_of_square + c onstant_width_of_square;\n }\n // number of squres in rectangle\n result = num1 * num2;\n Console.WriteLine(\"number of squares are : \" + result);\n \n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9933e41af7b71d945054ac919facea96", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "Console.WriteLine(\"hello world\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "da84b28d86ea48a7757dcb147bd4206a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {26742737-E232-401F-8B31-D5B4AE323617}\n Exe\n Properties\n OkayFace\n OkayFace\n v4.0\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "53ceb5599a8f8d0bd994a05a427a7f41", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace ns{\n class Program{\n public static void Main(){\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 result;\n \n if(n%a== 0)result = n/a;\n else result = n/a+1;\n \n if(m/a == 0)result *= (m/a);\n else result*=(m/a + 1)\n \n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f9cfc39101cdc94d9a9dce1f0e87b104", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\nnamespace ConsoleApp1\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 m = int.Parse(input[1]);\n int a = int.Parse(input[2]);\n int length = n / a;\n int width = m / a;\n\n if (n % a != 0)\n {\n length += 1;\n }\n\n if (m % a != 0)\n {\n width += 1;\n }\n\n int count = length * width;\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "152abf5aa1fba599f176b2f6ef818adf", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.Linq;\n\nusing System.Text;\n\n \n\nnamespace application1\n\n{\n\n class Program\n\n {\n\n static void Main(string[] args)\n\n {\n Int64 n, m, a;\n\t\t n = Console.Read();\n\t\t m = Console.Read();\n\t\t a = Console.Read();\n\n Console.WriteLine(Math.Ceiling((n-1)/a) + Math.Ceiling((m-1)/a));\n\n }\n\n }\n\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c5f37203109db30bdc0ea5e1322749e8", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "Console.WriteLine(4);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1cdea2f3feb08199e23ff3ff59fc4afc", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.Linq;\n\nusing System.Text;\n\n \n\nnamespace application1\n\n{\n\n class Program\n\n {\n\n static void Main(string[] args)\n\n {\n double n = 6, m = 6, a = 4;\n double sMain = n * m;\n\t\t double pCount;\n\t\t double pCount = Math.Ceiling(n/a) + Math.Ceiling(m/a);\n\n Console.WriteLine(pCount);\n\n }\n\n }\n\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cfb7d681ee7aba412d9c740c910729f0", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": " int n = Convert.ToInt32(Console.ReadLine());\n List sequence = new List(n);\n string q = Console.ReadLine();\n if (n > q.Length)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (n == 1)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(q);\n return;\n }\n StringBuilder builder = new StringBuilder();\n int index = 1;\n builder.Append(q[0]);\n while (n > 0 && index < q.Length - 1)\n {\n if (builder.Length == 0 || q[index + 1] != builder[0])\n {\n if (n == 1)\n {\n builder.Append(q.Substring(index));\n sequence.Add(builder.ToString());\n n--;\n }\n else\n {\n builder.Append(q[index++]);\n sequence.Add(builder.ToString());\n builder.Clear();\n n--;\n }\n }\n else\n {\n builder.Append(q[index++]);\n }\n }\n\n if (n == 0)\n {\n Console.WriteLine(\"YES\");\n for (int i = 0; i < sequence.Count; i++)\n Console.WriteLine(sequence[i]);\n }\n else\n Console.WriteLine(\"NO\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dc8184da252572d2f9b0ff72449cae9a", "src_uid": "c1b071f09ef375f19031ce99d10e90ab", "difficulty": 1100.0} {"lang": "MS C#", "source_code": " string[] fline = Console.ReadLine().Split(' ');\n int x = int.Parse(fline[0]);\n if (x % 2 != 0)\n { x++; }\n if (int.Parse(fline[1]) <= x / 2)\n {\n Console.WriteLine(2 * int.Parse(fline[1]) - 1);\n }\n else { Console.WriteLine((2 * int.Parse(fline[1]) - x)); }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "121cc9d0d91511a6bed6f2850baa67d7", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nclass Sample\n{\n public static voi Main()\n {\n String[] ip=Console.ReadLine().Split(' ');\n int ip1=int.Parse(ip[0]);\n int ip2=int.Parse(ip[1]);\n int[] arr=new int[ip1];\n int cnt=0;\n for(int i=1;i\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {5EA0CD21-7B4B-4B4C-BCD6-23884035146C}\n Exe\n Properties\n aasddsa\n aasddsa\n v4.0\n Client\n 512\n \n \n x86\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n x86\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b2656016bcaedbe50fe4bcfeee35a24a", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "Mono C#", "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\tEvenOdds();\n\t\t\n\t\t}\n\t\tpublic static void EvenOdds(){\n\t\t\tlong[] nk = Array.ConvertAll(Console.ReadLine().Split(), x => Convert.ToInt64(x));\n\t\t\tConsole.WriteLine(nk[1] > (nk[0]+1)/2 ? (nk[1]-(nk[0]+1)/2)*2:nk[1]*2-1);\n\t\t}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c59f2a8d3208efdfb61993341a848ea8", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tlong[] dizi = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n\t\t\tlong sonuc = 0;\n\t\t\tArrayList sayilar=new ArrayList();\n\t\t\t\n\t\t\t\tif (dizi[0] % 2 == 0)\n\t\t\t\t{\n\t\t\t\t\tif (dizi[1] < dizi[0] / 2)\n\t\t\t\t\t\tsonuc=( 1 + (2 * (dizi[1]-1)));\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tsonuc = ((dizi[1] )-(dizi[0] / 2))*2;\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 (dizi[1] <= dizi[0] / 2)\n\t\t\t\t\tsonuc = (1 + (2 * (dizi[1] - 1)));\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsonuc = (dizi[1] )-(dizi[0] / 2)*2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(sonuc);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6d97f2544cd1869621d21d5c1bafc185", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nclass Sample\n{\n public static void Main()\n {\n String[] ip=Console.ReadLine().Split(' ');\n long n=int.Parse(ip[0]);\n long k=int.Parse(ip[1]);\n int limit=(n+1)/2;\n if(k<=limit)\n {\n Console.WriteLine(2 * k - 1);\n }\n else\n {\n Console.WriteLine(2 * (k-limit));\n \n }\n \n }\n}\n \n \n \n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c2954ec5685a30b3bad4c67ff8ad390f", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces318A\n{\n class Program\n {\n static void Main(string[] args)\n {\n List nk = Console.ReadLine().Split(\" \").Select(x => Int32.Parse(x)).ToList();\n List odd_list = new List();\n List even_list = new List();\n for (int i = 1; i < nk[0]; i++)\n {\n if(i%2 == 0)\n {\n even_list.Add(i);\n }\n else\n {\n odd_list.Add(i);\n }\n }\n odd_list.AddRange(even_list);\n Console.WriteLine(odd_list[nk[1]]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2fce952dcf545a32bb985b046e6c5b63", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public class HeapSorter\n {\n private int[] _arr;\n private int _heapSize;\n\n public HeapSorter(int[] arr)\n {\n _arr = new int[2 * arr.Length];\n Array.Copy(arr, 0, _arr, 0, arr.Length);\n _heapSize = arr.Length;\n }\n\n private static void change(int[] arr, int idx1, int idx2)\n {\n int tmp = arr[idx2];\n arr[idx2] = arr[idx1];\n arr[idx1] = tmp;\n }\n\n private static int parent(int idx)\n {\n if (idx <= 2)\n return 0;\n\n return idx / 2;\n }\n\n private static int left(int idx)\n {\n if (idx == 0)\n return 1;\n\n return 2 * idx;\n }\n\n private static int right(int idx)\n {\n if (idx == 0)\n return 2;\n\n return 1 + 2 * idx;\n }\n\n private static void maxHeapify(int[] arr, int idx, int heapSize)\n {\n int largest = idx;\n int l = left(idx);\n int r = right(idx);\n\n if (l < heapSize && arr[l] > arr[largest])\n {\n largest = l;\n }\n if (r < heapSize && arr[r] > arr[largest])\n {\n largest = r;\n }\n if (largest != idx)\n {\n int tmp = arr[idx];\n arr[idx] = arr[largest];\n arr[largest] = tmp;\n maxHeapify(arr, largest, heapSize);\n }\n }\n\n private static bool IsMaxHeap(int[] arr, int idx)\n {\n if (arr.Length < idx)\n return true;\n\n int lIdx = left(idx);\n int rIdx = right(idx);\n\n bool gtLeft = true, gtRight = true;\n \n if (lIdx < arr.Length) {\n gtLeft = arr[idx] >= arr[lIdx] && IsMaxHeap(arr, lIdx);\n }\n\n if (rIdx < arr.Length) {\n gtRight = arr[idx] >= arr[rIdx] && IsMaxHeap(arr, rIdx);\n }\n\n return gtLeft && gtRight;\n }\n\n private static bool IsMaxHeap1(int[] arr)\n {\n for (int i = arr.Length - 1; i > 0; i--)\n if (arr[parent(i)] < arr[i])\n return false;\n\n return true;\n }\n\n private static void BuildMaxHeap(int[] arr)\n {\n int heapSize = arr.Length;\n for (int i = heapSize / 2; i >= 0; i--)\n {\n maxHeapify(arr, i, heapSize);\n }\n }\n\n private static void HeapSort(int[] arr)\n {\n BuildMaxHeap(arr);\n int heapSize = arr.Length;\n for (int i = arr.Length - 1; i > 0; i--)\n {\n int tmp = arr[0];\n arr[0] = arr[--heapSize];\n arr[heapSize] = tmp;\n maxHeapify(arr, 0, heapSize);\n }\n }\n\n public bool IsHeapSorted()\n {\n return IsMaxHeap1(_arr);\n }\n\n public void HeapSort()\n {\n HeapSort(_arr);\n }\n\n public int HeapMax()\n {\n return _arr[0];\n }\n\n public int HeapExtractMax()\n {\n int max = _arr[0];\n _heapSize--;\n change(_arr, 0, _heapSize - 1);\n maxHeapify(_arr, 0, _heapSize);\n return max;\n }\n\n public void IncreaseKey(int idx, int key)\n {\n if (_arr[idx] < key)\n return;\n _arr[idx] = key;\n for (int i = idx; i > 0; i = parent(i)) {\n if (_arr[i] > _arr[parent(i)])\n change(_arr, i, parent(i));\n }\n }\n\n public void MaxHeapInsert(int key)\n {\n IncreaseKey(_heapSize++, key);\n }\n }\n\n public class NonConfirmator\n {\n public static UInt34 getPosition(UInt64 n, UInt64 k)\n {\n if ((n+1)/2 >= k) {\n return 2 * k - 1;\n }\n return k * 2 - ((n + 1) / 2) * 2;\n }\n }\n\n static void Main(string[] args)\n {\n //int[] arr = new int [] { 23, 17, 14, 6, 13, 10, 1, 5, 7, 12 };\n //int[] arr1 = new int[] { 4, 1, 3, 2, 16, 9, 10, 14, 8, 7 };\n //Console.WriteLine(HeapSorter.IsMaxHeap1(arr1));\n //HeapSorter.BuildMaxHeap(arr1);\n //Console.WriteLine(HeapSorter.IsMaxHeap1(arr1));\n\n //int[] arr = new int[] { 23, 17, 14, 6, 13, 10, 1, 5, 7, 12 };\n //int[] arr = new int[] { 4, 1, 3, 2, 16, 9, 10, 14, 8, 7 };\n //HeapSorter sorter = new HeapSorter(arr);\n\n //foreach(int a in arr)\n // Console.Write(a + \" \");\n string str = Console.ReadLine();\n string[] nums = str.Split(new char[] { ' ' });\n\n Console.WriteLine(NonConfirmator.getPosition(UInt64.Parse(nums[0]), UInt64.Parse(nums[1])));\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dc7310c3ec6242245481376d4425a3dd", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {F5D71BA1-5FAC-4BFE-BD55-85D7E7B93E19}\n Exe\n Properties\n z2\n z2\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d08ea20428b8acac0c929fd26db21eb", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "MS C#", "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 double n, k;\n string [] input = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(input[0]);\n k = Convert.ToInt32(input[1]);\n\n //string[] answer = new string[n]; \n\n //for(int i=0; i<=n; i++)\n //{\n // if(i % 2 == 0)\n // {\n // answer[n / 2 + i] = i;\n // }\n // else\n // {\n\n // }\n //}\n\n\n List answer = new List();\n\n for(int i =1; i <= n; i++)\n {\n if(i % 2 != 0)\n {\n answer.Add(i.ToString());\n }\n }\n\n for (int i = 1; i <= n; i++)\n {\n if (i % 2 == 0)\n {\n answer.Add(i.ToString());\n }\n }\n\n Console.WriteLine(answer[k-1]);\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2d63207aa2302b05d05aaeaf0252c24e", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar numbers = Console.ReadLine().ToString().Split();\n\t\tvar quantity = Convert.ToInt32( numbers[0] );\n\t\tvar position = Convert.ToInt32( numbers[1] );\n\t\t\n\t\tint middle, foundNumber = 0;\n\t\t\n\t\tif( quantity % 2 == 0 ){\n\t\t middle = quantity / 2;\n\t\t if( positition <= middle ){\n\t\t foundNumber = 2 * position - 1;\n\t\t }else {\n\t\t foundNumber = (quantity - middle) * 2;\n\t\t }\n\t\t}else {\n\t\t middle = ( quantity + 1 ) / 2;\n\t\t if( positition <= middle ){\n\t\t foundNumber = 2 * position - 1;\n\t\t }else {\n\t\t foundNumber = (quantity - middle) * 2;\n\t\t }\n\t\t}\n\t\t\t\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0f127d7ae09493482c7ffb00327401d2", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "MS C#", "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 long n = Convert.ToInt64(Console.ReadLine());\n long long k = Convert.ToInt64(Console.ReadLine());\n if(n%2==0)\n {\n if(k<=n/2)\n Console.WriteLine(k * 2 - 1);\n else\n Console.WriteLine((k-(n/2))*2);\n }\n else\n {\n if (k <= (n /2)+1)\n Console.WriteLine(k * 2 - 1);\n else\n Console.WriteLine((k - ((n /2)+1)) * 2);\n }\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "beacb9f6833bcdbaddeb7a0c169d4855", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c6147447933334734375f74533d098e9", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "37176ca5cb0ab7a52b4802e8dbfb94b5", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": " 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 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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fbc7e57d8ab119f65078ae0ea165c371", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nnamespace ConsoleTesting\n{\n public static class RP\n {\n private static int ParseTime(string time)\n {\n string[] tmp = time.Split(':');\n int seconds = int.Parse(tmp[2]);\n int minutes = int.Parse(tmp[1]);\n int hours = int.Parse(tmp[0]);\n\n return ((hours * 60 + minutes) * 60) + seconds;\n }\n\n private static void Parse(string path)\n {\n string[] lines = System.IO.File.ReadAllLines(path);\n\n int lastInput = 0;\n int total = 0;\n string lastDate = \"\";\n Dictionary perDay = new Dictionary();\n\n foreach (string line in lines)\n {\n string[] tmp = line.Split('\\t');\n bool input = (tmp[2].Length == 24);\n bool output = (tmp[2].Length == 25);\n if (!input && !output) continue;\n\n int time = ParseTime(tmp[1]);\n\n if (input)\n {\n lastDate = tmp[0];\n lastInput = time;\n }\n\n if (output && lastInput > 0)\n {\n if(lastDate != tmp[0]) Console.WriteLine(\"QWE\");\n total += (time - lastInput);\n Console.WriteLine(tmp[0]);\n if (!perDay.ContainsKey(tmp[0])) perDay[tmp[0]] = 0;\n perDay[tmp[0]] += (time - lastInput);\n\n lastInput = 0;\n }\n }\n\n double hours = total;\n hours = hours / 3600;\n\n Console.WriteLine(hours);\n Console.WriteLine(\"-------------------------\");\n\n foreach (string day in perDay.Keys)\n {\n Console.WriteLine(day + \" = \" + (perDay[day] / 3600.0));\n }\n }\n\n public static void Process()\n {\n Parse(@\"d:\\Test\\Reports\\at_june.txt\");\n\n //Console.Write(\"Aleksey (Report > 114) Prism > \");\n //Parse(@\"d:\\v-sers\\chichagov2.txt\");\n\n //Console.Write(\"Victor (Report > ???) Prism > \");\n //Parse(@\"d:\\v-sers\\victor.txt\");\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fad1e901103863fec6ab625dd61a5cd1", "src_uid": "bf65a25185e9ea5b71e853723b838b04", "difficulty": 1700.0} {"lang": "Mono C#", "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);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ea4323132f854a9618cd861dde92c1d5", "src_uid": "bf65a25185e9ea5b71e853723b838b04", "difficulty": 1700.0} {"lang": "MS C#", "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 int c=24+a;\n Console.WriteLine(c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "81e74c53100a47e669b70f7bed35fb60", "src_uid": "bf65a25185e9ea5b71e853723b838b04", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeff 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 (int, int) position = (default(int),default(int));\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 = (index, i);\n }\n Console.WriteLine(Math.Abs(2 - position.Item1) + Math.Abs(2 - position.Item2));\n }\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d05f349d7f9b619166436fc755eaef69", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "for(var r=0;r<5;i++){var items = console.readline().split(' ');\nfor(var c=0;c<5;c++){ \n if(items[c]==\"1\"){print(Math.abs(2-c) + Math.abs(2-i))\n break;}\n}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "34c446b00fb7d48189c354691f74dcdc", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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 (int, int) position = (default(int),default(int));\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 = (index, i);\n }\n Console.WriteLine(Math.Abs(2 - position.Item1) + Math.Abs(2 - position.Item2));\n }\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3c1d9d1659ffc7e4d99dbd7d2169baed", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Test {\n\n\tint[][] 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7cb911550fd1f1e376444e218e2e5118", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace App\n{\n class Program\n {\n static void Main()\n {\n var strs = new string[5];\n int row = 0, col = 0;\n for (int i = 0; i < 5; i++)\n {\n strs[i] = Console.ReadLine();\n if (strs[i].Contains('1'))\n {\n row = i+1;\n col = strs[i].Replace(\" \", \"\").IndexOf(\"1\")+1;\n }\n }\n Console.WriteLine(Math.Abs(3-row) + Math.Abs(3-col));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bb96265dac94d04f3352836035fb684c", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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 //Your code goes here\n var matrix = new int[5,5];\n for(var index = 0; index < 5; index++)\n matrix[index] = Array.ConvertAll(Console.ReadLine().Split(' '), Int);\n int oneRow=0;\n int oneCol=0\n for(var row = 0; row < 5; row++)\n {\n for(var col = 0; col < 5; col++){\n if(matrix[row,col] == 1)\n {\n oneRow = row;\n oneCol = col;\n }\n }\n }\n \n ConsoleWriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "68d5159fa9f1a3be3dfee52b3abed2c2", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\nnamespace HackerRank\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = 0, y = 0;\n for (int i = 0; i < 5; i++)\n {\n string line = Console.ReadLine();\n for (int j = 0; j < 10; j += 2)\n if (line[j] == '1')\n {\n x = j / 2;\n y = i;\n }\n }0\n Console.WriteLine(Math.Abs(x - 2) + Math.Abs(y - 2));\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "caf8626320ba0cdd367e0412b13156e3", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _263A.BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[][] matrix = new string[5][];\n int row = 0;\n int col = 0;\n\n for(int i = 0; i < 5;i++){\n matrix[i] = Console.ReadLine().Split(' ');\n\n if(matrix[i].Contains('1')){\n row = i;\n\n for(int j = 0; j < 5;j++){\n if(matrix[i][j] == '1'){\n col = j;\n }\n }\n }\n }\n\n Console.WriteLine(Math.Abs(row - 2) + Math.Abs(col - 2));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e7cc71cb97194e08af5c6270be2da862", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n var row = 1;\n var moves = 0;\n while(true)\n {\n var input = Console.ReadLine().Replace(\" \", \"\");\n var col = input.IndexOf(\"1\");\n if (col >= 0)\n {\n return (3 - row) + (3 - col + 1);\n }\n row++;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "54fb14d230ba3b3681abd846873e75dd", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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().Split(' ');\n\n int oneRow=0;\n int oneCol=0;\n for(var row = 0; row < 5; row++)\n {\n if(matrix[row].IndexOf(\"1\") != -1){\n oneRow = row;\n oneCol = col; \n }\n }\n \n Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6ed30ded9e16a90613a0b29ae60ed008", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8fc7571a9c7acb96a4165a8264334b6e", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": ".NET Core C#", "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]); [B]// System.FormatException: \"\u0412\u0445\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0438\u043c\u0435\u043b\u0430 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442.\"[/B]\n if (x==1)\n {\n Console.Write(Math.Abs(i-3)+ Math.Abs(j - 3));\n }\n }\n } \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "23a0a30a77ed261b1de8a72a3e455e6d", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CSharpEdu\n{\n class ClassCS\n {\n struct point\n {\n public int h;\n public int v;\n }\n static int abs (int x)\n {\n return x > 0 ? x : -x;\n }\n static void Main()\n {\n string s;\n int i, j, tmp;\n bool flag = false;\n point Imlookingfor1;\n for (i = 1; i <= 5; ++i)\n {\n s = Console.ReadLine();\n tmp = 0;\n for (j = 0; j 2)\n {\n matrix = swapRow(matrix, -1, rowIndex);\n rowIndex -= 1;\n count++;\n }\n else if (rowIndex < 2)\n {\n matrix = swapRow(matrix, 1, rowIndex);\n rowIndex += 1;\n count++;\n }\n\n if (columnIndex > 2)\n {\n matrix = swapColumn(matrix, -1,rowIndex,columnIndex);\n columnIndex += -1;\n count++;\n }\n else if (columnIndex < 2)\n {\n matrix = swapColumn(matrix, 1,rowIndex,columnIndex);\n columnIndex += 1;\n count++;\n }\n\n }\n Console.WriteLine(count);\n }\n public static int[][] swapRow(int[][] matrix, int index, int rowIndex)\n {\n int[] temp = matrix[rowIndex];\n matrix[rowIndex] = matrix[rowIndex + index];\n matrix[rowIndex + index] = temp;\n return matrix;\n }\n\n public static int[][] swapColumn(int[][] matrix, int index,int rowIndex ,int columnIndex)\n {\n matrix[rowIndex][columnIndex + index] = 1;\n matrix[rowIndex][columnIndex] = 0;\n return matrix;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "581f16919d7922f372dce46d80acaa3c", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace A._Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte rows = 5, columns = 5;\n int[,] matrix = new int[rows, columns];\n int xIndex = 0, yIndex = 0;\n for (int i = 0; i < rows; i++)\n {\n string[] line = Console.ReadLine().Split(\" \");\n int[] numbers = line.Select(int.Parse).ToArray();\n\n for (int j = 0; j < columns; j++)\n {\n matrix[i, j] = numbers[j];\n if (numbers[j] == 1)\n {\n xIndex = i;\n yIndex = j;\n }\n }\n\n\n }\n\n int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);\n\n Console.WriteLine(numberOfMoves);\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fed2e57d92687bfd47db810b5ac30143", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n internal class Program\n {\n private static void Main(string[] args)\n {\n var s = \"\";\n var y = 0;\n var x = 0;\n for (int i = 0; i < 5; i++)\n {\n s = Console.ReadLine();\n if (s.Contains('1'))\n {\n x = s.Replace(\" \", \"\").IndexOf('1') + 1;\n y = i + 1;\n }\n }\n Console.WriteLine(Math.Abs(3 - x) + Math.Abs(3 - y));\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5b222cb6928e54853fc5a3566bc6e2ba", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace A._Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte rows = 5, columns = 5;\n int[,] matrix = new int[rows, columns];\n int xIndex = 0, yIndex = 0;\n for (int i = 0; i < rows; i++)\n {\n var line = Console.ReadLine().Split(\" \");\n int[] numbers = line.Select(i => Int32.Parse(i)).ToArray();\n\n for (int j = 0; j < columns; j++)\n {\n matrix[i, j] = numbers[j];\n if (numbers[j] == 1)\n {\n xIndex = i;\n yIndex = j;\n }\n }\n\n\n }\n\n int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);\n\n Console.WriteLine(numberOfMoves);\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d8efb2921e0766bbd6bcf9b4cad61f2", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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 if(matrix[row].IndexOf(\"1\") != -1){\n oneRow = row;\n oneCol = col; \n }\n }\n \n Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "774f4e2c0065ffb8508fdcf55af516ef", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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 x = 0, y = 0;\n for(int i = 0; i < 5; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n for(int j = 0; j < 5; j++)\n {\n if(s[j] == '1') \n {\n x = int.Parse(s[j]);\n y = int.Parse(s[i]);\n f = Math.Abs(3-x)+Math.Abs(3-y);\n }\n }\n }\n Console.WriteLine(f);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "685db4ed1e1fbeb78638f3266ae6155f", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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+ colindex-2);\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5920a0a0aba685af256c05172c033523", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2075f7a0e8bb0e430100fe67ecff4291", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace Codeforces\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n for (var i = 0; i < 5; i++)\n {\n var index = Console.ReadLine().Replace(' ', '').IndexOf('1');\n if (index <= 0) continue;\n \n Console.WriteLine(Math.Abs(3 - index) + Math.Abs(3 - i));\n return;\n } \n }\n } \n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dd1b0f0530569c4c34078c5bd9f63a2d", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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().Split(\" \");\n\n int oneRow=0;\n int oneCol=0;\n for(var row = 0; row < 5; row++)\n {\n if(matrix[row].indexOf(\"1\") != -1){\n oneRow = row;\n oneCol = col; \n }\n }\n \n Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "07dbe980f274fbd04db4447bf4931925", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte[,] matr = new byte[5 , 5];\n int i = 0, j = 0;\n for (i=0;i<5;i++)\n {\n string[] temp = Console.ReadLine().Split(' ');\n for (j=0;j<5;j++)\n {\n matr[i,j] = Byte.Parse(temp[j]);\n }\n }\n for (i=0;i<5;i++)\n {\n for (j=0;j<5;j++)\n {\n if (matr[i,j]==1)\n {\n goto met;\n }\n }\n }\n met:\n Console.WriteLine(Math.Abs(i - 2)+Math.Abs(j-2));\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "894c719c57fd6f57656a726c62a230a3", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace A._Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte rows = 5, columns = 5;\n int[,] matrix = new int[rows, columns];\n int xIndex = 0, yIndex = 0;\n for (int i = 0; i < rows; i++)\n {\n int[] numbers = Console.ReadLine()\n .Split(' ', StringSplitOptions.RemoveEmptyEntries)\n .Select(int.Parse)\n .ToArray();\n\n for (int j = 0; j < columns; j++)\n {\n matrix[i, j] = numbers[j];\n if (numbers[j] == 1)\n {\n xIndex = i;\n yIndex = j;\n }\n }\n\n\n }\n\n int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);\n\n Console.WriteLine(numberOfMoves);\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65ddfdd7024e3a5606f93abc201ba967", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\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 for (int j = 0; j < 5; j++)\n {\n arr[i][j] = Convert.ToInt32(Console.ReadLine());\n }\n }\n\n Console.WriteLine(arr[1][2]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ae289760bc652de4a94910c215fa7739", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace A._Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte rows = 5, columns = 5;\n int[,] matrix = new int[rows, columns];\n int xIndex = 0, yIndex = 0;\n for (int i = 0; i < rows; i++)\n {\n var line = Console.ReadLine().Split(\" \");\n int[] numbers = line.Select(z => Int32.Parse(z)).ToArray();\n\n for (int j = 0; j < columns; j++)\n {\n matrix[i, j] = numbers[j];\n if (numbers[j] == 1)\n {\n xIndex = i;\n yIndex = j;\n }\n }\n\n\n }\n\n int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);\n\n Console.WriteLine(numberOfMoves);\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4874900615075497f3dad9b43c571dc4", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n using System.Math;\n \n\n namespace ConsoleApplication1\n {\n class Program\n {\n static void Main(string[] args)\n {\n string NUmberOne;\n int Result;\n\n for (int i = 1; i <= 5; i++)\n {\n for (int j = 1; j <= 5; j++)\n {\n NUmberOne=Console.ReadLine();\n\n if (NUmberOne == \"1\")\n {\n Result = Math.Abs(i - 3) + Math.Abs(j - 3);\n Console.WriteLine(Result.ToString());\n break;\n \n }\n\n \n }\n }\n \n\n }\n }\n\n\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "91010d1f12542ebd356ba1236d61a181", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"beutiful matrix\", \"beutiful matrix\\beutiful matrix.csproj\", \"{C1C1A884-AD91-4664-A2F2-E829F26D75E0}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{C1C1A884-AD91-4664-A2F2-E829F26D75E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{C1C1A884-AD91-4664-A2F2-E829F26D75E0}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{C1C1A884-AD91-4664-A2F2-E829F26D75E0}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{C1C1A884-AD91-4664-A2F2-E829F26D75E0}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "122a9e08e5a6b6236bd8e2fb8a3f7aa5", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace beutiful_matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = new string[5];\n for (int i = 0; i < 5; i++)\n {\n s[i] = Console.ReadLine().Replace(\" \", \"\");\n }\n\n\n\n int x = 0, y = 0;\n for (int i = 0; i < 5; i++)\n for (int j = 0; j < 5; j++)\n if (s[i][j] == '1')\n {\n x = j; y = i;\n }\n\n Console.WriteLine(Math.Abs(x - 2) + Math.Abs(y - 2));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a13e47f187c76c54c4e334e1e4419cc7", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int x,y,i,j,a[6][6],ans;\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n scanf(\"%d\",&a[i][j]);\n }\n }\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(a[i][j]==1){\n x=i+1;\n y=j+1;\n }\n }\n }\n ans=abs(x-3)+abs(y-3);\n printf(\"%d\\n\",ans);\n return 0;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f415c9293a3f2780b61b9a0cd099eeaa", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " {\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6c63deefd05b50d8bc89ee0f77f4e286", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "ing 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 x = 0, y = 0;\n for(int i = 0; i < 5; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n for(int j = 0; j < 5; j++)\n {\n if(s[j] == '1') \n {\n x = int.Parse(s[j]);\n y = int.Parse(s[i]);\n f = Math.Abs(3-x)+Math.Abs(3-y);\n }\n }\n }\n Console.WriteLine(f);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dff46ad2c59e21a05dd98f6d602c6010", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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 if(matrix[row].indexOf(\"1\") !== -1){\n oneRow = row;\n oneCol = col; \n }\n }\n \n Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a71f0a07be8db186d114ef7663deebd8", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\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] != 2)\n {\n if (OriginalPos[i] > 2)\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d6d8a8d2205c80fa03cf74853c61ec93", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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\t(int, int) 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 (int, int) 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 (x, y);\n\t\t\t}\n\n\t\t\treturn (0, 0);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7ac0703f5cf4979a9ac88fd4f72dccfb", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcesNew\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] inputs =\n {\n Console.ReadLine().Replace(\" \", \"\"),\n Console.ReadLine().Replace(\" \", \"\"),\n Console.ReadLine().Replace(\" \", \"\"),\n Console.ReadLine().Replace(\" \", \"\"),\n Console.ReadLine().Replace(\" \", \"\"), \n };\n int a = 1;\n for (int i = 0; i < 5; i++)\n {\n if (inputs[i].Contains(\"1\"))\n {\n int column = inputs[i].IndexOf(\"1\");\n a = a + i;\n Console.WriteLine(Math.Abs(3-a)+Math.Abs(2-column));\n i = 5;\n }\n\n\n }\n\n Console.ReadLine();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "73790f163de2730451dd7bb9ee7cec1f", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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\nANSW:\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5df19e1b5931d304f9d85820422d3824", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n int oneI = 0, oneJ = 0;\n for (int i = 0; i < 5; i++)\n {\n var line = Console.ReadLine().Split(\" \");\n for (int j = 0; j < line.Length; j++)\n { \n if(line[j] == \"1\")\n {\n oneI = i;\n oneJ = j;\n break;\n }\n }\n }\n\n Console.WriteLine(Math.Abs(2 - oneI) + Math.Abs(2 - oneJ));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "24d036f39ad5f6aa04bd845200d13904", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using 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}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6a8061eabe20db542816ad0872db2885", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": " class Program_8\n {\n public static void Main()\n {\n string [] _arr = new string[5];\n\n for (int i = 0; i < 5; i++)\n {\n _arr[i] = ReadLine();\n } \n \n int[,] arr = new int[5,5];\n\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0 , k=0 ; j < 5 && k < 5 ; k+=2 , j++)\n {\n arr[i, j] = ToInt32( (_arr[i][k]).ToString() );\n }\n } \n\n int index_rows = 0 , index_coulmn = 0;\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 index_coulmn = j ;\n index_rows = i ;\n break;\n }\n }\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "516858687882fad16652431481ae3cc4", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "MS C#", "source_code": " 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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3fe36319caf1af16b921813e81a96d76", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n string[] s = Console.ReadLine().Split(' ');\n\n int[] a = new int[n];\n\n\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(s[i]);\n }\n int max = a[0];\n int indexMax = 0;\n for (int i = 1; i < n; i++)\n {\n if (a[i] < max)\n {\n max = a[i];\n indexMax = i;\n }\n }\n Console.WriteLine(indexMax);\n\n for (int i = 0; i < n; i++)\n {\n Console.Write(a[i] - indexMax + \" \");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e7422b54c9973a64b327052e7bc0a899", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int res;\n for (int i = 0; i < 5; i++)\n {\n int[] a = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n for (int j = 0; j < 5; j++)\n {\n if (a[j] == 1)\n {\n res = Math.Abs(2 - i) + Math.Abs(2 - j);\n break;\n }\n }\n }\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f34f0b7127f2ada3e32beff81f96b7b1", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": " using System;\n using System.Console;\n using System.Convert;\n \n class Program_8\n {\n public static void Main()\n {\n string [] _arr = new string[5];\n\n for (int i = 0; i < 5; i++)\n {\n _arr[i] = ReadLine();\n } \n \n int[,] arr = new int[5,5];\n\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0 , k=0 ; j < 5 && k < 5 ; k+=2 , j++)\n {\n arr[i, j] = ToInt32( (_arr[i][k]).ToString() );\n }\n } \n\n int index_rows = 0 , index_coulmn = 0;\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 index_coulmn = j ;\n index_rows = i ;\n break;\n }\n }\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "205192a49aa5b2fbeb7676b6226ae5a4", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace A._Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte rows = 5, columns = 5;\n int[,] matrix = new int[rows, columns];\n int xIndex = 0, yIndex = 0;\n for (int i = 0; i < rows; i++)\n {\n int[] numbers = Console.ReadLine()\n .Split(\" \", StringSplitOptions.RemoveEmptyEntries)\n .Select(int.Parse)\n .ToArray();\n\n for (int j = 0; j < columns; j++)\n {\n matrix[i, j] = numbers[j];\n if (numbers[j] == 1)\n {\n xIndex = i;\n yIndex = j;\n }\n }\n\n\n }\n\n int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);\n\n Console.WriteLine(numberOfMoves);\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ba6e992f3b801845c5b8938114f85d41", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace App\n{\n class Program\n {\n static void Main()\n {\n var strs = new string[5];\n int row = 0, col = 0;\n for (int i = 0; i < 5; i++)\n {\n strs[i] = Console.ReadLine();\n if (strs[i].Contains('1'))\n {\n row = i+1;\n col = strs[i].Replace(\" \", \"\").IndexOf('1')+1;\n }\n }\n Console.WriteLine(Math.Abs(3-row) + Math.Abs(3-col));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "85cda2a5d2f3e25af34f288a73fa500f", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "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 char[5][];\n for(var index = 0; index < 5; index++)\n matrix[index] = Console.ReadLine().Split(' ');\n\n int oneRow=0;\n int oneCol=0;\n for(var row = 0; row < 5; row++)\n {\n for(var col = 0; col < 5; col++){\n if(matrix[row][col] == \"1\")\n {\n oneRow = row;\n oneCol = col;\n }\n }\n }\n \n Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7737999bacfc18a6a7fe6076672ff138", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n\n\nint n = Convert.ToInt32(Console.ReadLine());\n\nstring[] s = Console.ReadLine().Split(' ');\n\nint[] a = new int[n];\n\n\nfor (int i = 0; i < n; i++)\n{ a[i] = Convert.ToInt32(s[i]);\n}\nint max = a[0];\nint indexMax = 0;\nfor (int i = 1; i < n; i++)\n{ if (a[i] < max)\n{ max=a[i];\nindexMax = i;\n} }\nConsole.WriteLine(indexMax);\n\nfor (int i=0; i j = r.ReadLine().Split().Select(x => int.Parse(x)).ToList();\n min = Math.Min(j[0], j[2]);min = Math.Min(j[3], min);\n d = Math.Min(j[1], j[0] - min);\n Console.WriteLine(256 * min + d * 32);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "37d9554eb3513be82c018b6d8f229765", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {4FF9A221-BF93-4E52-87F2-DF2B3113D292}\n Exe\n Properties\n vsaya_i_noski\n vsaya i noski\n v4.6.1\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8b3c0f7a38acad9a49bc3bf4f3068961", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "MS C#", "source_code": "int howSocks(int n,int m)\n{\nint tmp=n/m;\nif(tmp System.Convert.ToInt32(x)).ToArray();\nSystem.Console.WriteLine(howSocks(a[0],a[1]));\nreturn 0;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a366286eecfe77a4527fc94187535437", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "public class Oleg\n{\n\tpublic static void Main()\n\t{\n\t\tvar input = System.Console.ReadLine().Split(null as char[]);\n\t\tlong a, b;\n\t\ta = int.Parse(input[0]);\n\t\tb = int.Parse(input[1]);\n\t\t\n\t\twhile(a != 0 && b != 0)\n\t\t{\n\t\t\tif (a >= 2*b)\n\t\t\t{\n\t\t\t\ta -= 2*b;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if(b >= 2*a)\n\t\t\t{\n\t\t\t\tb -= 2*a;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tConsole.WriteLine(a + \" \" + b);\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3f513bd78567baa6218f36485cf80894", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "#include \nvoid main()\n{\n int n, m, moves;\n scanf(\"%d %d\", &n , &m);\n\n if(m <=n)\n {\n moves = (n % 2) + (n / 2);\n while(moves % m != 0)\n moves++;\n \n printf(\"%d\", moves);\n }\n else\n printf(\"-1\");\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5b55cb53d1a39696b2eb95c7c8a7d773", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0} {"lang": "Mono C#", "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 Input1;\n Input1 = Console.ReadLine();\n string[] split = Input1.Split(' ');\n int n, m, output=0;\n n = Convert.ToInt32(split[0]);\n m = Convert.ToInt32(split[1]);\n double x=0;\n \n if (m > n) {\n Console.WriteLine(\"-1\");\n }\n else\n {\n x= m*2;\n x=n/m;\n x=Math.Ceiling(x);\n Console.writeLine(x);\n }\n \n\n\n\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a1a486d1df488b9019bc27ec64147e04", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0} {"lang": "Mono C#", "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 bool ismagic(string s)\n {\n int i = 0;\n while (i < s.Length)\n {\n if (s[i] != '1')\n return false;\n int j = i + 1;\n while (j < s.Length && s[j] == '4' && j - i <= 2)\n j++;\n i = j;\n }\n return true;\n }\n Write(ismagic(ReadToken()) ? \"YES\" : \"NO\");\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b6197f51dbd442cd97f07477165b0f22", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "var incomeString = Read();\n List magicNumbers = new List() {\"144\", \"14\", \"1\"};\n string temp = incomeString;\n while (temp.Contains(magicNumbers[0]) || \n temp.Contains(magicNumbers[1]) || \n temp.Contains(magicNumbers[2]))\n {\n for (int i = 0; i < magicNumbers.Count; i++)\n {\n if (temp.Contains(magicNumbers[i]))\n {\n temp = temp.Replace(magicNumbers[i], \"\");\n }\n }\n }\n if (string.IsNullOrEmpty(temp))\n {\n Console.Write(\"YES\");\n return;\n }\n Console.Write(\"NO\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "118f1fc0d15e349d6c4362a17a744081", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442_\u0430\u0434\u0440\u0435\u0441\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n s = Console.ReadLine();\n if (s[0] == 'f')\n s = s.Insert(3, \"://\");\n if (s[0] == 'h')\n s = s.Insert(4, \"://\");\n s = s.Insert(s.IndexOf(\"ru\"), \".\");\n if(s[s.LastIndexOf(\"ru\") + 1].CompareTo(' ') != 0)\n {\n s = s.Insert(s.IndexOf(\"ru\") + 2, \"/\");\n }\n Console.WriteLine(s);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0d9a955e600d08f0b8c584d977715528", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Helpers;\n\nnamespace Solution\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n //A435();\n\n var input = new InputPair(Console.ReadLine());\n var b435 = new B435(input);\n Console.WriteLine(b435.Process());\n\n Console.ReadLine();\n Console.ReadLine();\n }\n\n private static void A435()\n {\n var firstRow = new InputPair(Console.ReadLine());\n var secdRow = new InputList(Console.ReadLine());\n\n var n = firstRow.Pair.Item1;\n var m = firstRow.Pair.Item2;\n\n var busNumber = 0;\n\n for (int i = 0; i < n; i++)\n {\n var total = secdRow.Items.ElementAt(i);\n\n var j = i;\n while (total < m)\n {\n j++;\n total += secdRow.Items.ElementAt(j);\n if (total <= m)\n {\n i++;\n }\n }\n busNumber += 1;\n }\n\n\n Console.WriteLine(busNumber);\n\n Console.ReadLine();\n Console.ReadLine();\n }\n\n \n }\n}\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Helpers;\n\nnamespace Solution\n{\n public class B435\n {\n private readonly InputPair _firstRow;\n\n public B435(InputPair firstRow)\n {\n _firstRow = firstRow;\n }\n\n public string Process()\n {\n var itemArray = _firstRow.Pair.Item1.ToCharArray();\n var totalSwap = int.Parse(_firstRow.Pair.Item2);\n\n for (int i = 1; i < itemArray.Length; i++)\n {\n var currentItem = itemArray[i];\n for (int j = totalSwap; j > 0 && totalSwap > 0; j--)\n {\n var swapToIndex = i - j;\n if (swapToIndex < 0) continue;\n\n var swapToItem = itemArray[swapToIndex];\n if (currentItem > swapToItem)\n {\n itemArray = Shift(itemArray, i, swapToIndex);\n\n totalSwap -= j;\n break;\n }\n }\n\n if (totalSwap == 0) break;\n }\n\n return new string(itemArray);\n }\n\n public char[] Shift(char[] array, int fromIndex, int toIndex)\n {\n var shifItem = array[fromIndex];\n for (int i = fromIndex; i > toIndex; i--)\n array[i] = array[i - 1];\n\n array[toIndex] = shifItem;\n\n return array;\n }\n }\n}\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Helpers\n{\n public class InputPair\n {\n private readonly string _line;\n public Tuple Pair;\n\n public InputPair(string line)\n {\n _line = line;\n //Items = new Tuple(null,null);\n Process();\n }\n\n private void Process()\n {\n if (string.IsNullOrWhiteSpace(_line)) return;\n\n var items = _line.Split();\n Pair = new Tuple(ConvertType(items[0]), ConvertType(items[1]));\n }\n\n private T ConvertType(string input)\n {\n return (T)Convert.ChangeType(input, typeof(T));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "efab20b86407da5c056093d4efec59d6", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing Helpers;\n\nnamespace Solution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n //A435();\n\n var input = new InputPair(Console.ReadLine());\n var b435 = new B435(input);\n Console.WriteLine(b435.Process());\n\n Console.ReadLine();\n Console.ReadLine();\n }\n\n private static void A435()\n {\n var firstRow = new InputPair(Console.ReadLine());\n var secdRow = new InputList(Console.ReadLine());\n\n int n = firstRow.Pair.Item1;\n int m = firstRow.Pair.Item2;\n\n int busNumber = 0;\n\n for (int i = 0; i < n; i++)\n {\n int total = secdRow.Items.ElementAt(i);\n\n int j = i;\n while (total < m)\n {\n j++;\n total += secdRow.Items.ElementAt(j);\n if (total <= m)\n {\n i++;\n }\n }\n busNumber += 1;\n }\n\n\n Console.WriteLine(busNumber);\n\n Console.ReadLine();\n Console.ReadLine();\n }\n }\n}\n\n\nnamespace Solution\n{\n public class B435\n {\n private readonly InputPair _firstRow;\n\n public B435(InputPair firstRow)\n {\n _firstRow = firstRow;\n }\n\n public string Process()\n {\n char[] itemArray = _firstRow.Pair.Item1.ToCharArray();\n int totalSwap = int.Parse(_firstRow.Pair.Item2);\n\n for (int i = 1; i < itemArray.Length; i++)\n {\n char currentItem = itemArray[i];\n for (int j = totalSwap; j > 0 && totalSwap > 0; j--)\n {\n int swapToIndex = i - j;\n if (swapToIndex < 0) continue;\n\n char swapToItem = itemArray[swapToIndex];\n if (currentItem > swapToItem)\n {\n itemArray = Shift(itemArray, i, swapToIndex);\n\n totalSwap -= j;\n break;\n }\n }\n\n if (totalSwap == 0) break;\n }\n\n return new string(itemArray);\n }\n\n public char[] Shift(char[] array, int fromIndex, int toIndex)\n {\n char shifItem = array[fromIndex];\n for (int i = fromIndex; i > toIndex; i--)\n array[i] = array[i - 1];\n\n array[toIndex] = shifItem;\n\n return array;\n }\n }\n}\nnamespace Helpers\n{\n public class InputPair\n {\n private readonly string _line;\n public Tuple Pair;\n\n public InputPair(string line)\n {\n _line = line;\n //Items = new Tuple(null,null);\n Process();\n }\n\n private void Process()\n {\n if (string.IsNullOrWhiteSpace(_line)) return;\n\n string[] items = _line.Split();\n Pair = new Tuple(ConvertType(items[0]), ConvertType(items[1]));\n }\n\n private T ConvertType(string input)\n {\n return (T) Convert.ChangeType(input, typeof (T));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "149a122dcc08d994e0c2cafc100338ae", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\nusing System;\nusing System.Linq;\nusing Helpers;\n\nnamespace Solution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n //A435();\n\n var input = new InputPair(Console.ReadLine());\n var b435 = new B435(input);\n Console.WriteLine(b435.Process());\n\n Console.ReadLine();\n Console.ReadLine();\n }\n\n private static void A435()\n {\n var firstRow = new InputPair(Console.ReadLine());\n var secdRow = new InputList(Console.ReadLine());\n\n int n = firstRow.Pair.Item1;\n int m = firstRow.Pair.Item2;\n\n int busNumber = 0;\n\n for (int i = 0; i < n; i++)\n {\n int total = secdRow.Items.ElementAt(i);\n\n int j = i;\n while (total < m)\n {\n j++;\n total += secdRow.Items.ElementAt(j);\n if (total <= m)\n {\n i++;\n }\n }\n busNumber += 1;\n }\n\n\n Console.WriteLine(busNumber);\n\n Console.ReadLine();\n Console.ReadLine();\n }\n }\n}\n\nnamespace Helpers\n{\n public class InputPair\n {\n private readonly string _line;\n public Tuple Pair;\n\n public InputPair(string line)\n {\n _line = line;\n //Items = new Tuple(null,null);\n Process();\n }\n\n private void Process()\n {\n if (string.IsNullOrWhiteSpace(_line)) return;\n\n string[] items = _line.Split();\n Pair = new Tuple(ConvertType(items[0]), ConvertType(items[1]));\n }\n\n private T ConvertType(string input)\n {\n return (T) Convert.ChangeType(input, typeof (T));\n }\n }\n}\nusing Helpers;\n\nnamespace Solution\n{\n public class B435\n {\n private readonly InputPair _firstRow;\n\n public B435(InputPair firstRow)\n {\n _firstRow = firstRow;\n }\n\n public string Process()\n {\n char[] itemArray = _firstRow.Pair.Item1.ToCharArray();\n int totalSwap = int.Parse(_firstRow.Pair.Item2);\n\n for (int i = 1; i < itemArray.Length; i++)\n {\n char currentItem = itemArray[i];\n for (int j = totalSwap; j > 0 && totalSwap > 0; j--)\n {\n int swapToIndex = i - j;\n if (swapToIndex < 0) continue;\n\n char swapToItem = itemArray[swapToIndex];\n if (currentItem > swapToItem)\n {\n itemArray = Shift(itemArray, i, swapToIndex);\n\n totalSwap -= j;\n break;\n }\n }\n\n if (totalSwap == 0) break;\n }\n\n return new string(itemArray);\n }\n\n public char[] Shift(char[] array, int fromIndex, int toIndex)\n {\n char shifItem = array[fromIndex];\n for (int i = fromIndex; i > toIndex; i--)\n array[i] = array[i - 1];\n\n array[toIndex] = shifItem;\n\n return array;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "922fc22c78644005ee276bfe1ae16129", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string[] str = Console.ReadLine().Trim().Split();\n int k = int.Parse(str[1]);\n char[] chr = str[0].ToCharArray();\n \n {\n bool change = false;\n \n for(int i = 0 ; i < chr.Length ; i++){\n if(k == 0)\n break;\n int current = (int)chr[i] - (int)'0';\n int max = -1;\n int idx = -1;\n for(int j = 0 ; j < k && j + i + 1 < chr.Length; j++){\n int m = (int)chr[i + j + 1] - (int)'0';\n if(m > current){\n max = Math.Max(max,m);\n if(max == m)\n idx = j +i + 1;\n }\n }\n if(max != -1){\n int swap = idx - i;\n --Console.WriteLine(idx);\n if(swap <= k)\n \n k = k - swap;\n while(idx > i){\n char tmp = chr[idx - 1];\n //Console.WriteLine(tmp);\n chr[idx - 1] = chr[idx];\n chr[idx] = tmp;\n idx--;\n }\n }\n }\n \n }\n Console.WriteLine(new string(chr));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9aeb343a108b8e267196103c21e74b27", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0} {"lang": "MS C#", "source_code": " 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 string n = Console.ReadLine();\n string m = Console.ReadLine();\n if (m==Reverse(n))\n {\n Console.Write(\"yes\");\n }\n else\n {\n Console.Write(\"no\");\n }\n Console.ReadKey();\n \n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "219a9ee3949d5a62873fc10aa470d1d7", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "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 line1 = Console.ReadLine ();\n\t\t\tstring line2 = Console.ReadLine ();\n\n\n\t\t\tstring result = \"\";\n\t\t\tfor (int i = 0; i < line2.Length; i++) {\n\t\t\t\tresult = line2[line2.Length - 1 - i];\n\t\t\t}\n\t\t\tline2 = result;\n\n\t\t\tresult = \"NO\";\n\t\t\tif (line1.Equals (line2)) {\n\t\t\t\tresult = \"YES\";\n\t\t\t}\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a93fbf6862c317bf5463f51b5d48d114", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\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 string n = Console.ReadLine();\n string m = Console.ReadLine();\n if (n==Reverse(m))\n {\n Console.Write(\"yes\");\n }\n else\n {\n Console.Write(\"no\");\n }\n Console.ReadKey();\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "03905bf480db24bdb6e950aac06dac43", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace NEwTechTEst\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Console.ReadLine();\n var m = Console.ReadLine();\n var rev = m.Reverse();\n Console.WriteLine(n==string.Join(\"\",rev)?\"YES\":\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d912de38d73e0a3f8fc166e03d66aa2f", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "MS C#", "source_code": " 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 string n = Console.ReadLine();\n string m = Console.ReadLine();\n if (m==Reverse(n))\n {\n Console.Write(\"yes\");\n }\n else\n {\n Console.Write(\"no\");\n }\n Console.ReadKey();\n \n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd462c4dc83009af28ce3259bf644cfc", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string input2 = Console.ReadLine();\n\n if (input2.Length != input.Length)\n Console.WriteLine(\"NO\");\n\n else\n {\n for (int i = 0; i < input.Length; i++)\n {\n if(input[i] != input2[input.Length-i-1])\n {\n Console.WriteLine(\"NO\");\n break;\n }\n else if(i == input.Length-1)\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "957846b6b8f5b6eefdd9a7a7ca598e8b", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "MS C#", "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 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 string n = Console.ReadLine();\n string m = Console.ReadLine();\n if (m == Reverse(n))\n {\n Console.Write(\"yes\");\n }\n else\n {\n Console.Write(\"no\");\n }\n return 0;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3e783b03770bf7f231c09e03d16265c4", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "MS C#", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long ll;\n\nint main(int argc, const char * argv[]) {\n string s,t;\n cin>>s>>t;\n int len = (int)t.length();\n for(int i = 0;i 0))\n {\n long counter1 = y.Length-1;\n long counter2 = 0;\n for (int i = 0; i < x.Length; i++)\n {\n \n if (x[i] == y[counter1])\n {\n counter2++;\n }\n counter1--;\n\n }\n if (counter2 == x.Length)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fa71d085f865b08bd0833341dd00300c", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _40_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int n = s1.Length;\n char ch;\n StringBuilder sb1 = new StringBuilder(s1);\n char[] y = s2.ToCharArray();\n for (int i = 0; i <= n / 2; i++)\n {\n ch = sb1[i];\n sb1[i] = sb1[n - 1];\n sb1[n - 1] = ch;\n n--;\n }\n s1 = sb1.ToString();\n if (s1.Equals(s2))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine(); ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f4d1d310ffcd7a8bda6559c483f7665c", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Http.Headers;\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 Console.WriteLine(Console.ReadLine() == new string(Console.ReadLine().ToCharArray().Reverse().ToArray()) ?\"YES\":\"NO\"); \n }\n }\n}\n\n \n \n \n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9b982f934c7d881b8f8e87450837d993", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace translation\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string input2 = Console.ReadLine();\n\n\n char[] translate = input.ToCharArray();\n\t Array.Reverse(translate);\n\t string tr= new string(translate);\n\n int result = string.Compare(input2,tr );\n if(result ==0 )\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "09dab0bc43aa76fe3abc36fca6775596", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "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 str1 = Console.ReadLine();\n var str2 = Console.ReadLine();\n var rev = str1.Reverse();\n var sb = new string(rev.ToArray());\n Console.WriteLine(str2.Equals(sb) ? \"YES\" : \"NO\");\n }\n \n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b2de3e95ffa0ddb973c3309002b9bbb2", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Numerics;\n\nclass Program\n{\n Program() {\n Char[] a = Console.ReadLine().ToCharArray();\n Array.Reverse(a);\n Console.WriteLine(new string(a) == Console.ReadLine() ? \"YES\" : \"NO\");\n }\n\n static void Main(string[] args)\n {\n new Program();\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "71245adbe6348e8c84c91c5e1f50de44", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27004.2005\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Pabandykem\", \"Pabandykem\\Pabandykem.csproj\", \"{A9EFBD61-018B-4B67-8F49-6DDCCB4AB5FD}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{A9EFBD61-018B-4B67-8F49-6DDCCB4AB5FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{A9EFBD61-018B-4B67-8F49-6DDCCB4AB5FD}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{A9EFBD61-018B-4B67-8F49-6DDCCB4AB5FD}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{A9EFBD61-018B-4B67-8F49-6DDCCB4AB5FD}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {B540FE07-7FB0-4ABA-9F93-7B2E45355A39}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6fac4ced0bb5152650a1cacbc0896549", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Drawing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var t= Console.ReadLine();\n int ct = 0;\n if(s.Length!=t.Length)\n { Console.WriteLine(\"NO\"); }\n else\n {\n for (int i = 0; i < s.Length; i++)\n {\n if(s[i]!=t[t.Length-1-i])\n {\n ct++;\n Console.WriteLine(\"NO\");\n break; }\n }\n if(ct==0)\n {\n Console.WriteLine(\"YES\");\n }\n }\n \n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f978d58845e2f78a1a7a19a904867bdc", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace Iran\n{\n class Amir\n {\n public static void Main()\n {\n string a=Console.ReadLine();\n string b=Console.ReadLine();\n bool ok=true;\n if(a.Length!=b.Length)\n ok=false;\n for(int i=0;ok&&i 100 || T.Length > 100)\n { Environment.Exit(0); }\n Translation Translate = new Translation();\n string Ans = Translate.Trans(S, T);\n Console.WriteLine(Ans);\n\n }\n }\n}\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n class Translation\n {\n public string Trans(string S, string T)\n {\n string Temp = ReverseString(S);\n string Yes = \"YES\";\n string No = \"No\";\n if (Temp == T)\n { return Yes; }\n else\n { return No; }\n\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 }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0048274d6d7d274124fb489ed4a7c299", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "[10:35 PM, 8/18/2020] Bhargav IIIT: using System;\nnamespace Iran\n{\n class Amir\n {\n public static void Main()\n {\n string a=Console.ReadLine();\n string b=Console.ReadLine();\n bool ok=true;\n if(a.Length!=b.Length)\n ok=false;\n for(int i=0;ok&&i int.Parse(s)).ToList();\n\n var partyDictionary = new List>();\n for (var i = 1; i < parties.Count; i++)\n {\n partyDictionary.Add(new KeyValuePair(i + 1, parties[i]));\n }\n\n var orderedParties = partyDictionary.OrderByDescending(p => p.Value);\n\n var coalitionSize = parties[0];\n var maxAllyPartySize = parties[0] / 2;\n var parliamentSize = parties.Sum();\n\n var coalitionParties = new HashSet();\n coalitionParties.Add(1);\n\n foreach (var party in orderedParties)\n {\n if (party.Value <= maxAllyPartySize)\n {\n coalitionParties.Add(party.Key);\n coalitionSize += party.Value;\n }\n\n if (coalitionSize * 2 > parliamentSize && coalitionParties.Count < parties.Count)\n {\n Console.WriteLine(string.Join(' ', coalitionParties));\n return;\n }\n }\n\n Console.WriteLine(\"0\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "180f835a8507aae03e2603e37d0d8255", "src_uid": "0a71fdaaf08c18396324ad762b7379d7", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Console\n{\n class Program\n {\n static void Main()\n {\n MyTask();\n }\n\n private static void MyTask()\n {\n var input = System.Console.ReadLine();\n var count = int.Parse(input);\n \n var inputs = System.Console.ReadLine().Split();\n var list = inputs.Select(int.Parse).ToList();\n\n var totalVotes = list.Sum(a => a);\n var aliceVotes = list.First();\n var alice\u0421oalition = new List\n {\n 1\n };\n\n for (int i = 1; i < list.Count; i++)\n {\n if (aliceVotes > 0.5f * totalVotes)\n break;\n\n if (list[i] * 2 <= list[0])\n {\n aliceVotes += list[i]; \n alice\u0421oalition.Add(i + 1);\n }\n }\n\n if (aliceVotes > 0.5f * totalVotes)\n {\n System.Console.WriteLine(alice\u0421oalition.Count);\n var result = new StringBuilder();\n alice\u0421oalition.ForEach(a => result.Append(a + \" \"));\n System.Console.WriteLine(new string(result.ToString().SkipLast(1).ToArray()));\n }\n else\n {\n System.Console.WriteLine(0);\n }\n\n\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4a0316db0a9195d9c27117a005416090", "src_uid": "0a71fdaaf08c18396324ad762b7379d7", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n\n if (s.Length > 100) { Console.WriteLine(\"\u0421\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u0443\"); }\n else { Console.WriteLine(\"\u041a\u043e\u043b\u0438\u0435\u0441\u0442\u0432\u043e nineteen \u0432 \u0441\u0442\u0440\u043e\u043a\u0435: \" + countstr(s, \"nineteen\")); }\n\n\n Console.ReadLine();\n }\n\n public static int countstr(string s,string str)\n {\n\n int count = 0;\n int index = 0;\n\n \n while(s.Contains(str[index]))\n {\n for(int i=0;i 100) { Console.WriteLine(\"\u0421\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u0443\"); }\n else { Console.WriteLine(\"\u041a\u043e\u043b\u0438\u0435\u0441\u0442\u0432\u043e nineteen \u0432 \u0441\u0442\u0440\u043e\u043a\u0435: \" + countstr(s, \"nineteen\")); }\n\n\n Console.ReadLine();\n }\n\n public static int countstr(string s,string str)\n {\n\n int count = 0;\n int index = 0;\n\n \n while(s.Contains(str[index]))\n {\n for(int i=0;i 100) { Console.WriteLine(\"\u0421\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u0443\"); }\n else { Console.WriteLine(\"\u041a\u043e\u043b\u0438\u0435\u0441\u0442\u0432\u043e nineteen \u0432 \u0441\u0442\u0440\u043e\u043a\u0435: \" + countstr(s, \"nineteen\")); }\n\n\n Console.ReadLine();\n }\n\n public static int countstr(string s,string str)\n {\n\n int count = 0;\n int index = 0;\n\n \n while(s.Contains(str[index]))\n {\n for(int i=0;i 100) { Console.WriteLine(\"\u0421\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u0443\"); }\n else { Console.WriteLine(\"\u041a\u043e\u043b\u0438\u0435\u0441\u0442\u0432\u043e nineteen \u0432 \u0441\u0442\u0440\u043e\u043a\u0435: \" + countstr(s, \"nineteen\")); }\n\n\n Console.ReadLine();\n }\n\n public static int countstr(string s,string str)\n {\n\n int count = 0;\n int index = 0;\n\n \n while(s.Contains(Convert.ToString(str[index])))\n {\n for(int i=0;i 100) { Console.WriteLine(\"\u0421\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u0443\"); }\n else { Console.WriteLine(\"\u041a\u043e\u043b\u0438\u0435\u0441\u0442\u0432\u043e nineteen \u0432 \u0441\u0442\u0440\u043e\u043a\u0435: \" + countstr(s, \"nineteen\")); }\n\n\n Console.ReadLine();\n }\n\n public static int countstr(string s,string str)\n {\n\n int count = 0;\n int index = 0;\n\n \n while(s.Contains(str[index]))\n {\n for(int i=0;i 100) { Console.WriteLine(\"\u0421\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u0443\"); }\n else { Console.WriteLine(\"\u041a\u043e\u043b\u0438\u0435\u0441\u0442\u0432\u043e nineteen \u0432 \u0441\u0442\u0440\u043e\u043a\u0435: \" + countstr(s, \"nineteen\")); }\n\n\n Console.ReadLine();\n }\n\n public static int countstr(string s,string str)\n {\n\n int count = 0;\n int index = 0;\n\n \n while(s.Contains(str[index]))\n {\n for(int i=0;i months = new List();\n\n months.AddRange(Array.ConvertAll(Console.ReadLine().Split(' '), x => { return int.Parse(x); }));\n months.Sort();\n\n int s = 0;\n for (int i = months.Count-1; i > 0; i--)\n {\n if (s >= k)\n {\n Console.WriteLine(months.Count - i - 1);\n return;\n }\n s += months[i];\n }\n if (s >= k)\n {\n Console.WriteLine(months.Count - i - 1);\n return;\n }\n Console.WriteLine(\"-1\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d04b7fa95fd0bbb6bb62bafe455705d4", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\n\nnamespace codebusinesstrip\n{\n class Program\n {\n private static void Main(string[] args)\n {\n int k, temp, s2 = 0;\n int[] ai = new int[12];\n k = Convert.ToInt32(Console.ReadLine());\n for (int i = 0; i < 12; i++)\n ai[i] = Convert.ToInt32(Console.ReadLine());\n\n if (k == 0)\n {\n Console.WriteLine(0);2\n\n }\n else\n {\n for (int j = 0; j < 12; j++)\n for (int i = 0; i < 11; i++)\n {\n if (ai[i] > ai[i + 1])\n {\n temp = ai[i];\n ai[i] = ai[i + 1];\n ai[i + 1] = temp;\n }\n }\n\n for (int i = 11; i >= 0; i--)\n {\n if (k > 0)\n {\n k -= ai[i];\n s2++;\n }\n }\n Console.WriteLine(k <= 0 ? s2 : -1);\n\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f5b9263108ae053bb36484f8ede15ec6", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " class Program\n {\n\n static void Main(string[] args)\n {\n int k, m; // k - \u0447\u0438\u0441\u043b\u043e k, m - \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\n string s = Console.In.ReadLine();\n k = int.Parse(s);\n string[] parts = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n m = parts.Length;\n int[] a = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = int.Parse(parts[i]);\n }\n for (int i = a.Length - 1; i > 0; i--)\n for (int j = 0; j < i; j++)\n if (a[j] > a[j + 1])\n {\n int tmp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = tmp;\n }\n\n int res = 0;\n int sum = 0;\n while (sum < k)\n {\n res++;\n sum += a[a.Length-res];\n \n }\n Console.WriteLine(res);\n }\n \n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "141c965fefca89b32ff327d79a142bf2", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u041a\u043e\u043c\u0430\u043d\u0434\u0438\u0440\u043e\u0432\u043a\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int a;\n int sum = 0;\n int l = mas.Length;\n\n for(int i = 0; i < l - 1; i++)\n {\n for(int j = i; j < l; j++)\n {\n if (mas[j] > mas[i])\n {\n a = mas[j];\n mas[j] = mas[i];\n mas[i] = a;\n }\n }\n }\n\n l = 0;\n\n foreach (int x in mas)\n {\n if (sum >= k) break;\n sum += x;\n l++;\n }\n\n Console.WriteLine(l);\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "07690604015de77dd811426407ec7ac7", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Linq;\n\n class Program\n {\n\n static void Main(string[] args)\n {\n int k, m; // k - \u0447\u0438\u0441\u043b\u043e k, m - \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\n string s = Console.In.ReadLine();\n k = int.Parse(s);\n string[] parts = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n m = parts.Length;\n int[] a = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = int.Parse(parts[i]);\n }\n for (int i = a.Length - 1; i > 0; i--)\n for (int j = 0; j < i; j++)\n if (a[j] > a[j + 1])\n {\n int tmp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = tmp;\n }\n\n int res = 0;\n int sum = 0;\n while (sum < k)\n {\n res++;\n sum += a[a.Length-res];\n \n }\n Console.WriteLine(res);\n }\n \n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a32361a39ef2c4a9df59230bc601ba6b", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u041a\u043e\u043c\u0430\u043d\u0434\u0438\u0440\u043e\u0432\u043a\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int a;\n int sum = 0;\n int l = mas.Length;\n\n for(int i = 0; i < l - 1; i++)\n {\n for(int j = i; j < l; j++)\n {\n if (mas[j] > mas[i])\n {\n a = mas[j];\n mas[j] = mas[i];\n mas[i] = a;\n }\n }\n }\n\n l = 0;\n\n foreach (int x in mas)\n {\n if (sum >= k) break;\n sum += x;\n l++;\n }\n\n Console.WriteLine(l);\n \n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "89d0b45082e823e970f063d92d0415de", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\nGlobal\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e67dce20d47accecc87212c6c1b67875", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "namespace a149\n{\n class Program\n {\n static int[] BubbleSort(int[] mas)\n {\n int temp;\n for (int i = 0; i < mas.Length; i++)\n {\n for (int j = i + 1; j < mas.Length; j++)\n {\n if (mas[i] > mas[j])\n {\n temp = mas[i];\n mas[i] = mas[j];\n mas[j] = temp;\n }\n }\n }\n return mas;\n }\n\n static void Main(string[] args)\n { \n int k = Convert.ToInt16(Console.ReadLine());\n int[] mas = Console.ReadLine().Split(' ').Select(e => Convert.ToInt32(e)).ToArray();\n BubbleSort(mas);\n int sum = mas.Sum();\n if (sum < k)\n Console.WriteLine(-1);\n else\n if (k == 0)\n Console.WriteLine(0);\n else\n if (mas[11] >= k)\n Console.WriteLine(1);\n else\n if (mas[11] + mas[10] >= k)\n Console.WriteLine(2);\n else\n if (mas[11] + mas[10] + mas[9] >= k)\n Console.WriteLine(3);\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "93ee52cac567d61f74842e24cba4aa16", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u041a\u043e\u043c\u0430\u043d\u0434\u0438\u0440\u043e\u0432\u043a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int a;\n int sum = 0;\n int l = mas.Length;\n\n for(int i = 0; i < l - 1; i++)\n {\n for(int j = i; j < l; j++)\n {\n if (mas[j] > mas[i])\n {\n a = mas[j];\n mas[j] = mas[i];\n mas[i] = a;\n }\n }\n }\n\n l = 0;\n\n foreach (int x in mas)\n {\n if (sum >= k) break;\n sum += x;\n l++;\n }\n\n Console.WriteLine(l);\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ed2505f121916d8d8ca99d4e9381ac89", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "MS C#", "source_code": "#define test\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Xml.Linq;\nusing System.Xml;\nusing System.Diagnostics;\nusing IFlowUtils;\nusing System.Data;\nusing ConsoleApplication5;\nnamespace ConsoleApplication7\n{\n\n\n\n class Program\n {\n public static void Main(string[] args)\n {\n int money = int.Parse(Console.ReadLine());\n int p1 = int.Parse(Console.ReadLine());\n int p2 = int.Parse(Console.ReadLine()) - int.Parse(Console.ReadLine());\n Console.WriteLine(money/Math.Min(p1,p2));\n } \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "26d23ecae145fbf962f3b003111cc861", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Numerics;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Net.Http.Headers;\nusing System.Security.Cryptography;\nusing System.Text;\n//using Algorithms.Set_33;\n\nclass Solution\n{\n private class Tokenizer\n {\n private string currentString = null;\n\n private string[] tokens = null;\n\n private int tokenNumber = 0;\n\n private static readonly char[] Separators = { ' ' };\n\n public T NextToken(Func parser)\n {\n return parser(this.GetNextToken());\n }\n\n public string NextToken()\n {\n return this.GetNextToken();\n }\n\n public int NextInt()\n {\n return this.NextToken(int.Parse);\n }\n\n public long NextLong()\n {\n return this.NextToken(long.Parse);\n }\n\n private string GetNextToken()\n {\n if (this.currentString == null || this.tokenNumber == this.tokens.Length)\n {\n this.currentString = this.GetNextString();\n\n while (this.currentString != null && this.currentString.Equals(string.Empty))\n {\n this.currentString = this.GetNextString();\n }\n\n if (this.currentString == null)\n {\n throw new Exception(\"End of input\");\n }\n\n this.tokens = this.currentString.Split(Separators, StringSplitOptions.RemoveEmptyEntries);\n this.tokenNumber = 0;\n }\n\n return this.tokens[this.tokenNumber++];\n }\n\n private string GetNextString()\n {\n string content = Console.ReadLine();\n if (content == null)\n {\n return null;\n }\n\n return content.Trim();\n }\n }\n\n static void Main()\n {\n //Console.SetIn(new StreamReader(File.OpenRead(\"input.txt\")));\n //StreamWriter writer = new StreamWriter(File.Create(\"output.txt\"));\n //Console.SetOut(writer);\n\n Tokenizer tokenizer = new Tokenizer();\n long n = tokenizer.NextLong();\n long a = tokenizer.NextLong();\n long b = tokenizer.NextLong();\n long c = tokenizer.NextLong();\n\n Console.WriteLine(Guest.Solve(n, a, b, c));\n\n //writer.Close();\n }\n\n public class Guest\n {\n public static long Solve(long n, long a, long b, long c)\n {\n if (b - c > a || n < b)\n {\n return n / a;\n }\n\n long result = 0;\n long buffer;\n\n while (n >= b)\n {\n buffer = n / b;\n result += buffer;\n n = n - buffer * (b - c);\n }\n\n return result + n / Math.Min(a, b);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1dde3db68dd5e8d6628b6235dae36edc", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Xml.Linq;\nusing System.Xml;\nusing System.Diagnostics;\nusing IFlowUtils;\nusing System.Data;\nusing ConsoleApplication5;\nnamespace ConsoleApplication7\n{\n\n\n\n class Program\n {\n public static void Main(string[] args)\n {\n int money = int.Parse(Console.ReadLine());\n int p1 = int.Parse(Console.ReadLine());\n int p2 = int.Parse(Console.ReadLine()) - int.Parse(Console.ReadLine()));\n Console.WriteLine(money/Math.Min(p1,p2));\n } \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4df7d51090d046ae6351da2b6c838054", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nusing Algorithms.Set_33;\n\nclass Solution\n{\n private class Tokenizer\n {\n private string currentString = null;\n\n private string[] tokens = null;\n\n private int tokenNumber = 0;\n\n private static readonly char[] Separators = { ' ' };\n\n public T NextToken(Func parser)\n {\n return parser(this.GetNextToken());\n }\n\n public string NextToken()\n {\n return this.GetNextToken();\n }\n\n public int NextInt()\n {\n return this.NextToken(int.Parse);\n }\n\n public long NextLong()\n {\n return this.NextToken(long.Parse);\n }\n\n private string GetNextToken()\n {\n if (this.currentString == null || this.tokenNumber == this.tokens.Length)\n {\n this.currentString = this.GetNextString();\n\n while (this.currentString != null && this.currentString.Equals(string.Empty))\n {\n this.currentString = this.GetNextString();\n }\n\n if (this.currentString == null)\n {\n throw new Exception(\"End of input\");\n }\n\n this.tokens = this.currentString.Split(Separators, StringSplitOptions.RemoveEmptyEntries);\n this.tokenNumber = 0;\n }\n\n return this.tokens[this.tokenNumber++];\n }\n\n private string GetNextString()\n {\n string content = Console.ReadLine();\n if (content == null)\n {\n return null;\n }\n\n return content.Trim();\n }\n }\n\n static void Main()\n {\n //Console.SetIn(new StreamReader(File.OpenRead(\"input.txt\")));\n //StreamWriter writer = new StreamWriter(File.Create(\"output.txt\"));\n //Console.SetOut(writer);\n\n Tokenizer tokenizer = new Tokenizer();\n long n = tokenizer.NextLong();\n long a = tokenizer.NextLong();\n long b = tokenizer.NextLong();\n long c = tokenizer.NextLong();\n\n Console.WriteLine(Guest.Solve(n, a, b, c));\n\n //writer.Close();\n }\n\n public class Guest\n {\n public static long Solve(long n, long a, long b, long c)\n {\n if (b - c > a || n < b)\n {\n return n / a;\n }\n\n long result = 0;\n long buffer;\n\n if (n >= b)\n {\n buffer = (n - b) / (b - c);\n result += buffer;\n n -= buffer * (b - c);\n }\n\n while (n >= b)\n {\n buffer = n / b;\n result += buffer;\n n = n - buffer * (b - c);\n }\n\n return result + n / Math.Min(a, b);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2402543cecd388d42bd420c50b09b8ca", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "difficulty": 1700.0} {"lang": "Mono C#", "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 Int64 n=Int64.Parse(Console.ReadLine());\n string[]s=Console.ReadLine().Split(' ');\n int[]a=new int[n];\n for(int i=0;i0)\n {\n if(a[0]<=15)\n {\n for(int i=1;i15)\n {\n Console.WriteLine(a[i-1]+15);\n d=true;\n break;\n }\n }\n if(d==false)\n Console.WriteLine(90);\n }\n else\n Console.WriteLine(15);\n }\n else\n {\n if(a[0]<=15)\n Console.WriteLine(a[0]+15);\n else\n Cosnole.WriteLine(15);\n }\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a1cd100ce0271634afb36a566caa702b", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program\n{\n static void Main(string[] args) \n { \n int mins = Console.ReadLine();\n string minsList = Console.ReadLine();\n string[] mins = minsList.Split(' ');\n int[] finalMins = new int[mins.Length];\n for(int i = 0;i<= mins.Length - 1;i++)\n finalMins[i] = (int) mins[i];\n if(finalMins[0] > 15)\n Console.WriteLine(15);\n else\n {\n int result = 0;\n for(int j = 0;j<= finalMins.Length - 1;j++)\n { \n if(result + 15 >= finalMins[j] && result < 90)\n {\n result = finalMins[j];\n }\n else\n {\n result = result + 15;\n break;\n }\n \n }\n result = result > 90 ? 90 : result;\n Console.WriteLine(90);\n }\n \n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ea7b181344c838dc6772465281f1d5f6", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0} {"lang": "Mono C#", "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();\n int numbLink = 0, numbPearl = 0;\n foreach (char c in s)\n {\n if (c == '-') numbLink++;\n else numbPearl ++;\n }\n if(numbLink % numbPearl == 0)\n {\n Console.WriteLine(\"YES\");\n }else\n {\n Console.WriteLine(\"NO\");\n }\n=\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8cc4f56a2a22885da98b3bf2119b1202", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforce0\n{\n class Program\n {\n\n public static int min(int maxGhesmateJaabe, int teedadeAjil, int teedadeMoghasem, int zarfiateHarGhesmat)\n {\n int min1 = 0;\n if (teedadeMoghasem<0)\n {\n teedadeMoghasem = 0;\n }\n if (maxGhesmateJaabe+1>teedadeMoghasem)\n {\n min1 = teedadeMoghasem+1;\n }\n else\n {\n min1 = maxGhesmateJaabe;\n }\n int maxZafeiat = ((min1) * zarfiateHarGhesmat);\n\n if (teedadeAjil>maxZafeiat)\n {\n return 1 + min(maxGhesmateJaabe, teedadeAjil - maxZafeiat, teedadeMoghasem - (maxGhesmateJaabe-1), zarfiateHarGhesmat);\n }\n else\n {\n return 1;\n }\n\n }\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "95c537c9c937d0baec4e4f2870505647", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforce0\n{\n class Program\n {\n public static int min(int maxGhesmateJaabe, int teedadeAjil, int teedadeMoghasem, int zarfiateHarGhesmat)\n {\n int min1 = 0;\n if (teedadeMoghasem<0)\n {\n teedadeMoghasem = 0;\n }\n if (maxGhesmateJaabe+1>teedadeMoghasem)\n {\n min1 = teedadeMoghasem+1;\n }\n else\n {\n min1 = maxGhesmateJaabe;\n }\n int maxZafeiat = ((min1) * zarfiateHarGhesmat);\n\n if (teedadeAjil>maxZafeiat)\n {\n return 1 + min(maxGhesmateJaabe, teedadeAjil - maxZafeiat, teedadeMoghasem - (maxGhesmateJaabe-1), zarfiateHarGhesmat);\n }\n else\n {\n return 1;\n }\n\n }\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "132219fdd2e3121d26cbef1cc9325cd9", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforce0\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 result = min(a, b, c, d);\n Console.WriteLine(result);\n\n }\n public static int min(int maxGhesmateJaabe, int teedadeAjil, int teedadeMoghasem, int zarfiateHarGhesmat)\n {\n try\n {\n int min1 = 0;\n if (teedadeMoghasem < 0)\n {\n teedadeMoghasem = 0;\n }\n if (maxGhesmateJaabe + 1 > teedadeMoghasem)\n {\n min1 = teedadeMoghasem + 1;\n }\n else\n {\n min1 = maxGhesmateJaabe;\n }\n int maxZafeiat = ((min1) * zarfiateHarGhesmat);\n\n if (teedadeAjil > maxZafeiat)\n {\n return 1 + min(maxGhesmateJaabe, teedadeAjil - maxZafeiat, teedadeMoghasem - (maxGhesmateJaabe - 1), zarfiateHarGhesmat);\n }\n else\n {\n return 1;\n }\n }\n catch (Exception)\n {\n\n }\n\n }\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0d500012a57645d3b1107f1d36278423", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\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 result =min(a,b,c,d);\n Console.WriteLine(result);\n }\n public static int min(int maxGhesmateJaabe, int teedadeAjil, int teedadeMoghasem, int zarfiateHarGhesmat)\n {\n int min1 = 0;\n if (teedadeMoghasem<0)\n {\n teedadeMoghasem = 0;\n }\n if (maxGhesmateJaabe+1>teedadeMoghasem)\n {\n min1 = teedadeMoghasem+1;\n }\n else\n {\n min1 = maxGhesmateJaabe;\n }\n int maxZafeiat = ((min1) * zarfiateHarGhesmat);\n\n if (teedadeAjil>maxZafeiat)\n {\n return 1 + min(maxGhesmateJaabe, teedadeAjil - maxZafeiat, teedadeMoghasem - (maxGhesmateJaabe-1), zarfiateHarGhesmat);\n }\n else\n {\n return 1;\n }\n\n }\n\n }\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dd1bed1471f50dc309a90001110fe15f", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "Mono C#", "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\tint INF=(int)1e9;\n\t\tint min=INF;\n\t\t\n\t\tfor(int hp=0;hp<=210;hp++){\n\t\t\tfor(int at=0;at<=210;at++){\n\t\t\t\tif(AT[0]+at<=DF[1])continue;\n\t\t\t\tfor(int df=0;df<=210;df++){\n\t\t\t\t\tint limit=INF;\n\t\t\t\t\tif(AT[1]>DF[0]+df){\n\t\t\t\t\t\tlimit=(HP[0]+hp)/(AT[1]-(DF[0]+df));\n\t\t\t\t\t\tif((HP[0]+hp)%(AT[1]-(DF[0]+df))==0)limit--;\n\t\t\t\t\t}\n\t\t\t\t\tif(limit<=0)continue;\n\t\t\t\t\tint kill=HP[1]/(AT[0]+at-DF[1]);\n\t\t\t\t\tif(HP[1]%(AT[0]+at-DF[1])!=0)kill++;\n\t\t\t\t\tif(kill>0 limit>0 && kill<=limit){\n\t\t\t\t\t\tmin=Math.Min(H*hp+A*at+D*df,min);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\tConsole.WriteLine(min);\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\tint[] HP;\n\tint[] AT;\n\tint[] DF;\n\tint H;int A;int D;\n\tpublic Sol(){\n\t\tHP=new int[2];\n\t\tAT=new int[2];\n\t\tDF=new int[2];\n\t\tvar d=ria();\n\t\tHP[0]=d[0];AT[0]=d[1];DF[0]=d[2];\n\t\td=ria();\n\t\tHP[1]=d[0];AT[1]=d[1];DF[1]=d[2];\n\t\td=ria();\n\t\tH=d[0];A=d[1];D=d[2];\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bd6296ecb35d5fcfb19aef8bc824fb08", "src_uid": "bf8a133154745e64a547de6f31ddc884", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\npublic class NewYearCandles\n{\n\tprivate static void Main()\n\t{\n\t\tvar input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\t\tvar a = input[0];\n\t\tvar b = input[1];\n\t\t\n\t\tint o = 0, c = 0;\n\t\t\n\t\twhile(a > 0)\n\t\t{\t\t\t\n\t\t\to += a;\t\n\t\t\tc += a;\n\t\t\t\n\t\t\ta = c / b;\n\t\t\tc = c % b;\t\t\t\n\t\t}\n\t\t\n\t\tConsole.WriteLine(o);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a809d1b86fef367b05684bca8bb0abae", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "#define Library\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces.TaskA\n{\n public class Task\n {\n public static void Main()\n {\n var task = new Task();\n task.Solve();\n }\n\n private void Solve()\n {\n var list = Input.Numbers();\n var a = list[0];\n var b = list[1];\n var res = a;\n while (a >= b)\n {\n var whole = a/b;\n a -= whole*b;\n a += whole;\n res += whole;\n }\n Console.WriteLine(res);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "50e1a8d19447a03eacec793602fcfe06", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0} {"lang": "Mono C#", "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 != 2) And ( 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bd460dc6e162e20a3c54585602a8b1ca", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tint input = Int32.Parse(Console.ReadLine());\n\n\t\tif(input <= 2 || input % 2 != 0)\n\t\t\treturn \"NO\";\n\t\telse\n\t\t\treturn \"YES\";\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd54bd91813b66d04b24558331984767", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "static void Main(string[] args)\n{\n int num = Console.ReadLine()\n Console.WriteLine(num)\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "30cb03f0a2e386b627074539438bb09f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "865dca5006acccfd721a6cf3fd1677a2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "static void Main()\n{\n\tint n = int.Parse(Console.ReadLine());\n\n Console.WriteLine(n % 2 == 0 ? 'YES' : 'NO' );\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "133a9f774d22a83a224f608fdc51c43c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 tw.WriteLine(final);\n\n tw.Flush();\n tw.Close();\n }\n else\n {\n goto l;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "12f6639e04b8546046dcb799f1f87068", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n int number = int.Parse(Console.ReadLine());\n if (number % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n if (number % 2 != 0)\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "57050fe202723747de1fdb59a7555d9a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\npublic class Program\n{\n static void Main(String[]Args)\n {\n int a = Int.Parse(Console.ReadLine());\n if(a%2==0)Console.Write(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2949461de70e8864669e284a1a2dbc98", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Watermelon{\n static public void Main(){\n string tmp;\n Console.ReadLine(tmp);\n int n=int.Parse(tmp);\n if(n%2==0&&n>2)Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "33376e39f81616ee4e80619f69f823e8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Program1\n{\n class Program1\n {\n static void Main(string[] args)\n {\n int x, j;\n \n bool res = false;\n \n x = Int32.Parse(Console.ReadLine());\n \n for(int i = 2; i < 8; i+2)\n {\n j = x - i;\n \n if(j % 2 == 0)\n res = true;\n }\n \n if(res == true)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\"); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8aa81cf7d13e1f93a9a2bb04f8893d8f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": " public class Program\n {\n public static void Main()\n {\n int a = Console.ReadLine(); \n if (a % 2 == 0) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\"); \n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7a0da760e1ec234328ad14f708154e52", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication6\", \"ConsoleApplication6\\ConsoleApplication6.csproj\", \"{BF7F7577-72CC-48A4-92C5-021896A0A334}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{BF7F7577-72CC-48A4-92C5-021896A0A334}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{BF7F7577-72CC-48A4-92C5-021896A0A334}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{BF7F7577-72CC-48A4-92C5-021896A0A334}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{BF7F7577-72CC-48A4-92C5-021896A0A334}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4163509ad70a949e394d6bb104e5976c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "\nnamespace Watermelon {\n class Program {\n static void Main(string[] args) {\n string w = Console.ReadLine();\n int weight = Convert.ToInt32(w);\n if (weight % 2 == 0) {\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a8f13d4ad839c1e187650ae7b8c3fd20", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\namespace MON_PROJEC1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w ;\n Console.WriteLine(\"the weight of the watermelon bought\");\n w = int.Parse(Console.ReadLine());\n\n while(1 < w || w >100)\n {\n Console.WriteLine(\"the weight of the watermelon bought\");\n w = int.Parse(Console.ReadLine());\n }\n \n if (w % 2 ==0 )\n {\n Console.WriteLine(\"YES\");\n\n }\n\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "48fbeecb22b19b414fd7d7d5e782c110", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 = 2;\n a = int.Parse (Console.ReadLine());\n \n if (( a == 2)) \n {\n Console.WriteLine(\"NO\"); \n }\n return 0;\n }\n \n if (( a % 2 == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fc71b7be6c91eed49740ca2e97cfac1a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30011.22\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"A. watermelon\", \"A. watermelon\\A. watermelon.csproj\", \"{E8F0CE1F-75CA-4B15-8BD1-A7561B4250E7}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{E8F0CE1F-75CA-4B15-8BD1-A7561B4250E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{E8F0CE1F-75CA-4B15-8BD1-A7561B4250E7}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{E8F0CE1F-75CA-4B15-8BD1-A7561B4250E7}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{E8F0CE1F-75CA-4B15-8BD1-A7561B4250E7}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {31F86D30-B7B2-46BF-9756-69DBF40813F4}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3c52df34cd05c58c5afce212931ba566", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace CodeKata\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int inp = int.Parse(input);\n if (inp % 2 == 1 || inp == 2 && (inp < 1 || inp > 100))\n { //odd Number\n Console.WriteLine(\"NO\");\n }\n else\n { //even\n Console.WriteLine(\"YES\");\n }\n \n\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "33ae9b2df2a5dbb623b06a8d2dd2d417", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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<2)\n {\n Console.WriteLine(\"NO\");\n } \n else: \n if (sayi % 2 == 0)\n {\n Console.WriteLine(\"YES\"); \n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c9a8bdf51fc6be636edc4bd2f0ca3bfe", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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) % 2 == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0167dc4f7746a5783c14d804505305a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "static void Main(string[] args)\n{\n var num = Console.ReadLine();\n Console.WriteLine(num);\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "54b35ade499a67427a53fd806d90d625", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n\n int weight = Convert.ToInt32(Console.Read());\n\n if ( (weight % 2 == 0) && weight != 2)\n {0\n Console.Write(\"YES\");\n }\n else\n {\n Console.Write(\"NO\");\n }\n\n //Console.ReadKey();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "35ba13adf53966e3b5662792cfe56ed2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "internal class Program\n {\n private static void Main(string[] args)\n {\n var input = int.Parse(Console.ReadLine());\n if (input % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n Console.ReadKey();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8705fe5064096f231c733229cbe5d156", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n do\n {\n\n \n int W;\n Console.Write(\"Weight of the watermelon: \");\n 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 } while (true);\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b3dae36a92b685731af0bc30571132d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "public void Problem(int w){\n\tif((w/2) % 2 == 0){\n\t\treturn \"YES\";\n\t}\n\telse{\n\treturn \"NO\";\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b13b64ed5957882eb76f6e1361acebc", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int w;\n console.read(w);\n if(w%2=1)\n console.write(\"NO\");\n else\n console.write(\"YES\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e573cc8e02ca24e4c35ee9ff84811f9c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class Watermelon{\n static void Main()\n {\n int n;\n string nstring = Console.ReadLine();\n if (int.TryParse(nstring, out n)){\n if(n<=0 || n==2){\n Console.WriteLine(\"NO\\n\");\n }else{\n if(n%2==0){\n Console.WriteLine(\"YES\\n\");\n }else{\n Console.WriteLine(\"NO\\n\");\n }\n }\n }else{\n Console.WriteLine(\"numero no valido\\n\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4edb9747a487782497b336084f4ed6f4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tint input = Int32.Parse(Console.ReadLine());\n\n\t\tif(input <= 2) || input % 2 != 0)\n\t\t\tConsole.WriteLine(\"NO\");\n\t\telse\n\t\t\tConsole.WriteLine(\"YES\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "80b5318a91f4e2dc2f2ce1253449d610", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using Microsoft.FSharp.Core;\nusing System;\nusing System.Reflection;\n\n[assembly: FSharpInterfaceDataVersion(2, 0, 0)]\n[assembly: AssemblyVersion(\"0.0.0.0\")]\n[CompilationMapping(SourceConstructFlags.Module)]\npublic static class _\n{\n [EntryPoint]\n public static int main(string[] args)\n {\n int num = LanguagePrimitives.ParseInt32(Console.ReadLine());\n object value;\n switch (num)\n {\n default:\n value = ((num % 2 != 1) ? \"YES\" : \"NO\");\n break;\n case 2:\n value = \"NO\";\n break;\n }\n Console.WriteLine((string)value);\n return 0;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c3e076c4b76b61d49e247fce16efcbb1", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": " static void Main(string[] args)\n {\n string weight0;\n int weight;\n \n weight0 = Console.ReadLine();\n weight = Convert.ToInt32(weight0);\n\n if (weight % 2 == 0 && weight != 2)\n {\n Console.WriteLine(\"YES\");\n\n }\n\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "db4fd763fc7a966f5ca631a526c6a805", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "static void Main() // Method declaration\n{\n int x = 12 * 30; // Statement 1\n Console.WriteLine (x); // Statement 2\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "405b04d63faa30a1f082a6c798fc0f29", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.IO;\n\nclass Watermelon\n{\n static string Main(string[] args)\n {\n int number = Int16.Parse(Console.ReadLine());\n if (number % 2 == 1 || number == 2)\n return \"NO\";\n return \"YES\";\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "42ae0a050a74fd268245a1faa8942130", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "static void Main(string[] args){\n byte weight = 0;\n if(args.Length == 1 && byte.TryParse(args[0],out weight)){\n Console.WriteLine((weight % 2 == 0 && weight > 2)? \"YES\" : \"NO\");\n }\n Console.Write(\"Invalid input\");\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ff935b2f6a8f777607a9b3b24044a2d2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 && 2 == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ae2da2d47f099526872627f95e27fa7e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "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 Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a2d70b9b5ba74e1e38d6e75eead8399f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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) && (a % 4) == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "238bbe3cd3c33b907636f433b97113c9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program\n {\n static void Main()\n {\n float x = Convert.ToInt32(Console.ReadLine());\n \n if (x%4==0)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b851d7473046e303b0dd1dbefa4ed293", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Watermelon1\", \"Watermelon1\\Watermelon1.csproj\", \"{CBAAC55E-AA40-4738-870E-83EC0AE5AEAC}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{CBAAC55E-AA40-4738-870E-83EC0AE5AEAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{CBAAC55E-AA40-4738-870E-83EC0AE5AEAC}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{CBAAC55E-AA40-4738-870E-83EC0AE5AEAC}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{CBAAC55E-AA40-4738-870E-83EC0AE5AEAC}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ec3e5e6cd1e905a85d5186eb4564ce3e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2293c5dbe8b4c368727f9b0f2cc87338", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 int weight = int.Parse(Console.ReadLine());\n for ( int i=1; i<=weight; i++)\n {\n if ((weight % i == 0) \n Console.WriteLine(\"YES\");\n else \n Console.WriteLine(\"NO\");\n \n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "81621de0ab6bf032276f5c0e6db25156", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": " 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 ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "47fd92cedbf14c30bf547b65b228d3e6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Solution{\n\n\tstatic void Main(String args[]){\n\t\tin n = int.Parse(Console.Readline());\n\t\t\n\t\tif(n > 3 && n % 2 == 0)\n\t\t\tConsole.WriteLine(\"YES\");\n\t\telse\n\t\t\tConsole.WriteLine(\"NO\");\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "77926f92230a967b93375e1d1ab8a8f7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 = a + 2;\n a = int.Parse (Console.ReadLine());\n \n if ( ( a % 4 == 0)) \n {\n Console.WriteLine(\"YES\"); \n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0f090fab1797666e8a477c488492cea6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " int w = int.Parse(Console.ReadLine());\n if (w == 2 || w % 2 != 0)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n Console.ReadKey();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "10a99244b8ea2c1d9d63dd0e0bee27b9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace codeforces1\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n UInt16 w = Convert.ToUInt16(Console.ReadLine());\n if(w % 2 == 0){\n w /= 2;\n if(w % 2 == 0){\n Console.WriteLine(\"Yes\");\n }\n else{\n UInt16 one = w - 1;\n if((one != 0) && (one % 2) == 0){\n UInt16 two = w + 1;\n if((two != 0) && (two % 2) == 0){\n Console.WriteLine(\"Yes\"); \n }\n else{\n Console.WriteLine(\"No\");\n }\n }\n else{\n Console.WriteLine(\"No\"); \n }\n }\n }\n else{\n Console.WriteLine(\"No\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0acd0e4eebf2b32254551d51367f2971", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 = 7;\n a = int.Parse (Console.ReadLine());\n \n if (( a-4 % 2 == 0), a > 1) \n {\n Console.WriteLine(\"YES\"); \n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6efdf843e717c9b333c0c0f63c1e1fcd", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using Ssytem;\nclass program\n{\n public static void Main()\n {\n int x = Convert.ToInt32(Console.ReadLine());\n if(x%2==0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7fb962ace7cfae81ea655f6c9c6b0570", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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) || (a % 2) == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9397690feb6eb760984bd8c00db1c331", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program {\n static void Main() \n {\n int n = Console.Read ();\n for (var i = 0; i < 100; i += 2) \n {\n if (!((n - i) % 2))\n {\n Console.WriteLine(\"YES\");\n }\n }\n Console.WriteLine(\"NO\");\n \n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b451dfa5612afe97a23d499826543145", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "string Weight(int weight)\n{\n if(weight % 2 == 0)\n {\n return \"YES\";\n }\n else\n {\n return \"NO\";\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d3897310e78af00defd504ee241e742", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "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)\n {\n console.WriteLine(\"NO\");\n }\n else ((W%2) != 0)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a49b22b8da7a039a45ff11322bb3ec08", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": " public static bool IsDividable(double w)\n {\n return ((w % 2) == 0) && (w / 2) % 2 == 0;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5108a189d8f0d5dd22fd5fc5947e1131", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class Program{\n\tstatic void Main(){\n\t\tConsole.WriteLine(int.Parse(Console.ReadLine()) % 8 == 0 ? \"YES\" : \"NO\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9cd08c5e8976e51f3e775dae2f281aa8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using 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 int total = int.Parse(Console.ReadLine());\n if(total == 2) {\n Console.WriteLine(\"NO\");\n break; \n }\n Console.WriteLine(total % 2 == 0 ? \"YES\" : \"NO\" );\n } \n\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0da6f2748c9b03f4a2436aeb8d5fe03e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " int weight = int.Parse(Console.ReadLine());\n if (weight % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n } else\n {\n Console.WriteLine(\"NO\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c21d503a462f6ed1dee43de7a03c6a18", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program{\n static void Main(string[] args){\n var mass = int.Parse(Console.ReadLine());\n if (mass < 4 || (mass-2)%2 !=0)) Console.Write(\"NO\");\n else Console.Write(\"YES\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b692a34bd9b5c753d758393015e1da5d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n if(i!=0)\n {\n if(i % 2==0)\n {\n \tConsole.WriteLine(\"yes\");\n }\n else\n {\n \tConsole.WriteLine(\"no\");\n }\n }\n else\n {\n \tConsole.WriteLine(\"yes\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "52c09c251e5b65e7ddcef53e93f3f313", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace 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(\"nooo\");\n }\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65ed4c4aa823f628bbcced6cd8459009", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program{\n static void Main(string[] args){\n byte weight = 0;\n if(args.Length != 1 || !byte.TryParse(args[0], out weight)){\n Console.WriteLine(\"Invalid input\");\n return;\n }\n \n Console.WrileLine((weight %2 == 0 && weight > 2) ? \"YES\" : \"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b7eab7db035935cf037f61df285c2939", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 > 1;\n a = int.Parse (Console.ReadLine());\n \n if (( a % 4 == 0)) \n {\n Console.WriteLine(\"YES\"); \n }\n \n else if (( a+2 % 4 == 0))\n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dc95fce751dfc418ed423765c5c81c47", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "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}\nProgram.Main();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "faf0ec950d0c911e428e198de7c5e15e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"CodeForces_Ex\", \"CodeForces_Ex\\CodeForces_Ex.csproj\", \"{BE4F4D0F-E27F-460E-A4C7-50188C25F76E}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{BE4F4D0F-E27F-460E-A4C7-50188C25F76E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{BE4F4D0F-E27F-460E-A4C7-50188C25F76E}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{BE4F4D0F-E27F-460E-A4C7-50188C25F76E}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{BE4F4D0F-E27F-460E-A4C7-50188C25F76E}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ac912907be9a828ebb1b8b10d3b714f2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Net;\nusing System.Web;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Dela.Mono.Examples\n{\n class GoogleSearch\n {\n static void Main(string[] args)\n {\n Console.WriteLn(args[2]);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d0afd85e12ee1542b468f8fa8693eeb5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"CodeForces\", \"CodeForces\\CodeForces.csproj\", \"{7214E0B5-3D6A-46CA-B703-896E5946EA69}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{7214E0B5-3D6A-46CA-B703-896E5946EA69}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{7214E0B5-3D6A-46CA-B703-896E5946EA69}.Debug|x86.Build.0 = Debug|x86\n\t\t{7214E0B5-3D6A-46CA-B703-896E5946EA69}.Release|x86.ActiveCfg = Release|x86\n\t\t{7214E0B5-3D6A-46CA-B703-896E5946EA69}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e23a1e7cf1f2b34081dfccd5d47fa4ac", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 anw;\n int w = Convert.ToInt16(Console.ReadLine());\n if (w < 4)\n {\n Console.WriteLine(\"NO\");\n }\n else if (w%2 == 0)\n {\n Console.WriteLine(\"YES\")\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3e7fb6bb2d444ed607fe79ada064369d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.24720.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Watermelon\", \"Watermelon\\Watermelon.csproj\", \"{42DD4B06-A1FE-4B28-8A21-F5AF1788919B}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{42DD4B06-A1FE-4B28-8A21-F5AF1788919B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{42DD4B06-A1FE-4B28-8A21-F5AF1788919B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{42DD4B06-A1FE-4B28-8A21-F5AF1788919B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{42DD4B06-A1FE-4B28-8A21-F5AF1788919B}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65f9c19bf012127cf18839110febebfb", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n class Program\n {\n static void Main(string[] args)\n {\n do\n {\n\n \n int W;\n Console.Write(\"Weight of the watermelon: \");\n 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 } while (true);\n\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "931e04bd598fc91ffabdfa53102f6815", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using 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 int total = int.Parse(Console.ReadLine());\n Console.WriteLine(total % 2 == 0 ? \"YES\" | \"NO\" );\n } \n\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "71266afd757216667570f0d3bf860bb8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace BigO_Chapter\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int Weight;\n\n Weight = Convert.ToInt32(Console.ReadLine());\n\n if (Weight < 1 || Weight > 100) return;\n\n\n if (Weight % 2 == 0)\n {\n if ((Weight / 2) % 2 == 0)\n {\n Console.WriteLine(\"Yes\");\n\n }\n else\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n else\n Console.WriteLine(\"No\");\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ab1c32135612b02520ca0f817beb5663", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace a{ \npublic class Watermelon {\n \n public static void main(String[] args) {\n \n \n \n \n int w=Console.Read();\n if (w<=100&&w>=1&&w%2==0&&w!=2) {\n Console.Write(\"NO\");\n }\n else \n {\n Console.Write(\"YES\");\n }\n }\n }\n \n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5a19f695b25c3eea756306e3a4b5f3b7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "#include \nusing namespace std;\n\nint main() {\n\tint w;\n\n\tcin >> w;\n\tif ((w % 2) % 2 == 0)\n\t\tcout << \"YES\";\n\telse\n\t\tcout << \"NO\";\n\n\tsystem(\"pause\");\n\treturn 0;\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "344dd9dad265b82ea8b22a9277c3ea14", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {BF7F7577-72CC-48A4-92C5-021896A0A334}\n Exe\n Properties\n ConsoleApplication6\n ConsoleApplication6\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "74e619161260991f815db169acea1e58", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte watermelon = 1;\n Console.Write(\"What is the weight of the watermelon : \");\n watermelon = byte.Parse(Console.ReadLine());\n if (watermelon <= 100)\n {\n if (watermelon % 2 == 0)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7a6c9661fb0edec1318c891b700b2c23", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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) && (a % 2) == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0097f17c50865e6c192bb0e09480aa34", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using system;\nclass program\n{\n static void main()\n{\nint w;\nconsole.read(w);\nif(w%2=1)\nconsole.write(\"no\");\nelse\nconsole.write(\"yes\");\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1ade08d16ed5577d3d1596640e57b4b9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 i = int.Parse(Console.ReadLine());\n if(i=!0)\n {\n if(i % 2==0)\n {\n \tConsole.WriteLine(\"yes\");\n }\n else\n {\n \tConsole.WriteLine(\"no\");\n }\n }\n else\n {\n \tConsole.WriteLine(\"yes\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b862a5a351cb6da7ef59e95d403cfe2f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A4_Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n /*=================================================\n * first step : receive input\n * ==============================================*/\n int W = Convert.ToInt32(Console.ReadLine());\n /*==================================================\n * second step : ensure the Number is even and bigger than 2\n * ================================================*/\n int Remainder = W % 2;\n if (Remainder == 0 && W > 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadKey();\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3107b4bd67e95a2dd7e26ddc207a9ecc", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "string a = Console.ReadLine();\n if (Convert.ToInt32(a) <= 100)\n {\n if (Convert.ToInt32(a) >= 1)\n {\n int b = Convert.ToInt32(a) % 2;\n if (b == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n }\n else Console.WriteLine(\"NO\");\n }\n else Console.WriteLine(\"NO\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "10580c09a904b808a9af9ad422d1d049", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeKata\n{\n class Program\n {\n static void Main(int n)\n {\n Console.WriteLine(CodeForceWaterMelon(n));\n \n\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ba57c1c6124210a50cf4c3390a2a583d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30523.141\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"problem4a\", \"problem4a.csproj\", \"{C4F94F8D-4503-4238-82E8-2FB4AB5CB73B}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{C4F94F8D-4503-4238-82E8-2FB4AB5CB73B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{C4F94F8D-4503-4238-82E8-2FB4AB5CB73B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{C4F94F8D-4503-4238-82E8-2FB4AB5CB73B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{C4F94F8D-4503-4238-82E8-2FB4AB5CB73B}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {73CBAF83-E471-446B-B123-FF2F67D6DAB5}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "360f9096a8e37527f7e75aa3185edaf0", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n int w;\n w=Convert.Toint32(Console.ReadLine()) ; \n if(w%2==1) \n Console.Write(\"NO\");\n else\n Console.Write(\"YES\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "42ad7a89b434bcb734142c2d5f64a82d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Diagnostics;\n\nclass Program{\n static void Main(string[] args){\n byte weight = 0;\n if(args.Length != 1 || !byte.TryParse(args[0], out weight)){\n Debug.WriteLine(\"Invalid input\");\n return;\n }\n \n Debug.WrileLine((weight %2 == 0 && weight > 2) ? \"YES\" : \"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4d070a2f206d98857e98644eaddb098e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "static void Main(string[] args)\n {\n int num = int.Parse(args[0]);\n if (num < 4)\n {\n Console.WriteLine(\"False\");\n }\n else\n {\n int shift = num >> 1;\n shift = shift << 1;\n Console.WriteLine(shift == num);\n\n }\n\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5744172596426b5a1edf42f83b7b0d10", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\n int w;\n \n w = int.Parse(Console.ReadLine());\n\n if (w>1 && w<100)\n {\n if (w%2==0)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n \n }\n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "edc99edba61cc6579172f58e88794a57", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "class TestClass\n{\n static void Main(string[] args)\n {\n var num = Console.ReadLine();\n Console.WriteLine(num);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "798205e3792a4ab1099b53fe19551a8d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Text;\n\nclass Solution{\n\n\tstatic void Main(String args[]){\n\t\tint n = int.Parse(Console.Readline());\n\t\t\n\t\tif(n > 3 || n % 2 == 0)\n\t\t\tConsole.WriteLine(\"YES\");\n\t\telse\n\t\t\tConsole.WriteLine(\"NO\");\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6e89fe50ebad3151b7b86631dafa535e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n int weight = 0;\n string w;\n w = Console.ReadLine();\n bool result = int.TryParse(w, out weight);\n weight = weight - 2\n if (result == true && weight >=1 && weight <=100)\n {\n if ( weight % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "72476e4511b7c550a6d0c3ab00797f4d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "namespace for_codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(((int.Parse(Console.ReadLine()) % 2) == 0) ? \"YES\" : \"NO\");\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "556555a34e6ce2ed5958e95669742fdb", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using system;\nclass program\n{\n static void main()\n{\nint w;\ncosole.read();\nif(w%2=1)\nconsole.write(\"no\");\nelse\nconsole.write(\"yes\");\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a43c5e77b82e15490940b13df8c8873d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte watermelon = 1;\n Console.Write(\"What is the weight of the watermelon : \");\n watermelon = byte.Parse(Console.ReadLine());\n if (watermelon <= 100)\n {\n if (watermelon % 2 == 0)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n else\n Console.WriteLine(\"sorry the weight of the watermelo must be under or equal 100 pleas try again\");\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3043432529b73d6564a3e168f01da4d5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "n = int(input());\n\nif (n > 1 && n % 2 == 0);\n print(\"YES\");\nelse\n print(\"NO\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "79dd8ef4ad66ca59192f04f4e980104f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "if (w % 2 == 0)\n Console.Write(\"YES\");\n else Console.Write(\"NO\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b386b84fb602a40312a74779e76cb52f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass watermelone\n{\n void main()\n {\n sbyte w;\n w = Convert.ToSByte(Console.ReadLine());\n if (w % 2 == 0)\n Console.Write(\"Yes\\n\");\n else\n Console.Write(\"No\\n\");\n Console.ReadKey();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "524bbf297ea4a3687bf71c81ecb49676", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.29613.14\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Watermelon\", \"Watermelon.csproj\", \"{FE664089-017E-4CA2-8E32-05B760325D39}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{FE664089-017E-4CA2-8E32-05B760325D39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{FE664089-017E-4CA2-8E32-05B760325D39}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{FE664089-017E-4CA2-8E32-05B760325D39}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{FE664089-017E-4CA2-8E32-05B760325D39}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {33726527-E358-426C-802F-152BB8255C8E}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0ee1abe684068c78dfb5a09440e6efe7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\n namespace Dcoder\n {\n \tpublic class Program\n \t{\n \t\tpublic static void Main(string[] args\n \t\t\t{\n \t\t\tint A;\n \t\t\tA=int.Parse(Console.ReadLine());\n \t\t\tif(A%2==0)\n \t\t\t{\n \t\t\t\tConsole.WriteLine(\"YES\");\n \t\t\t}\n \t\t\telse if(A<=2)\n \t\t\t{\n \t\t\t\tConsole.WriteLine(\"NO\");\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tConsole.WriteLine(\"NO\");\n \t\t\t}\n \t\t\tConsole.ReadKey(true);\n \t\t}\n \t} \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b8486053ed5510bb12cd979f8d5753f4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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\tint C(object x)\n\t{\n\t\tswitch (x)\n\t\t{\n\t\t\tcase int n when n > 0: return n;\n\t\t\tcase int n: return -n;\n\t\t\tcase string s: return s.Length;\n\t\t\tdefault: return 0;\n\t\t}\n\t}\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\tint f(int n) => n >= 1 ? n * f(n - 1) : 1;\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\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0766e604afe68061857e2c65c4bab721", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": " string weight0;\n int weight;\n \n weight0 = Console.ReadLine();\n weight = Convert.ToInt32(weight0);\n\n if (weight % 2 == 0 && weight != 2)\n {\n Console.WriteLine(\"YES\");\n\n }\n\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b13420e082794028eaa031564ba83547", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {B7A39387-4E95-43B4-BE96-7057A8E7B587}\n Exe\n Properties\n arbuz_01\n arbuz_01\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0e81002cfbff78670c1d0ebc08ef3f76", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using 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 int total = int.Parse(Console.ReadLine());\n Console.WriteLine(total % 2 == 0 ? 'YES' | 'NO' );\n } \n\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8b8e99700e19d6058f5dc68b31496cab", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program \n{\n public static void Main(string[] args)\n {\n var input = int.Parse(System.IO.File.ReadAllText(args[0]))\n Console.Writeline(input % 2 == 0 ? \"YES\" : \"NO\")\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "651f1e5482a3a8f41c1a8e62300724e1", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Text;\n\nclass Solution{\n\n\tstatic void Main(String [] args){\n\t\tint n = int.Parse(Console.Readline());\n\t\t\n\t\tif(n > 3 || n % 2 == 0)\n\t\t\tConsole.WriteLine(\"YES\");\n\t\telse\n\t\t\tConsole.WriteLine(\"NO\");\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "47135fa19f8e3b87542fa76ec94fc44a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nstatic void Main(){\n var mass = int.Parse(Console.ReadLine());\n if (mass < 4 || mass%2 != 0)\n Console.Write(\"NO\");\n else Console.Write(\"YES\");\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b01babc8da11256e2cbb2c66779e105f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class A4\n {\n static void Main()\n {\n Console.WriteLine(((float)weigh/2));\n if(((float)weigh/2)%2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9f976b1677c8784de27a0fdb7804fed9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace CodeForces {\n public class Problem4A {\n public static void Main(string[] args) {\n int.TryParse(Console.ReadLine(), int a);\n Console.WriteLine(a % 2 == 0 ? \"YES\" : \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eb8331eff5cdb132d929cba6ce2d6a1f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 w;\n w = Convert.ToInt32(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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f020737a8627b3544fdb25d8782fd949", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 < 1 || w > 100 {\n System.Console.WriteLine(\"NO\");\n } else {\n if (w % 2 == 0)\n {\n System.Console.WriteLine(\"YES\");\n } else {\n System.Console.WriteLine(\"NO\");\n } \n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2d8a30dc4283ea43e783a246f04a5e80", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "public class Program {\nstatic void Main()\n{\n\tint total = int.Parse(Console.ReadLine());\n\tConsole.WriteLine(total % 2 == 0 ? 'YES' : 'NO' );\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0a1ba9fc3804fad859e3e928658b424b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 int a,b;\n a=w/2;\n b=w/2;\n if(a%2==0 && b%2==0)Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n else Console.WriteLine(\"NO\");\n return 0;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "70784cb800f28028814647511a9ee117", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Program1\n{\n class Program1\n {\n static void Main(string[] args)\n {\n int x, j;\n \n bool res = false;\n \n x = Console.ReadKey();\n \n for(int i = 2; i < 8; i+2)\n {\n j = x - i;\n \n if(j % 2 == 0)\n res = true;\n }\n \n if(res == true)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\"); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0a9ff775b3913b7908c1807abf18f6d8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 != 0)) \n {\n Console.WriteLine(\"NO\");\n }\n \n else \n {\n Console.WriteLine(\"YES\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6afe3d60e140cdef50558faee2b961fa", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " static void Main(string[] args)\n { \n int Weight;\n \n Weight = Convert.ToInt32(Console.ReadLine());\n\n if (Weight < 1 && Weight > 100) return \"No\";\n\n for (int i = 2; i <= Weight; i += 2)\n {\n if (Weight % 2 != 0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7311fb8bad2c4eb2e1ea1b33eb496ab4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "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 Console.WriteLine(\"enter w\");\n int w = int.Parse(Console.ReadLine());\n if(w%2==0)\n Console.WriteLine(\"yes\");\n else if(w==2)\n Console.WriteLine(\"no\");\n else Console.WriteLine(\"no\");\n console.read();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4bf104f9a692cef80d0a29e58a1f9109", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " byte w;\n Console.WriteLine(\"Enter the number: \");\n w = Convert.ToByte(Console.ReadLine());\n if (w % 2 == 0)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n Console.ReadKey();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "27d44d3dadcb61af048ce6610c4b411d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class Program\n\n {\n\n static void Main(string[] args)\n\n {\n\t\t\tint w = Console.Read();\n\t\t\tif ((w-2)%2==0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "def77f296aa671d25a535da46db9b521", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 Main(string[] args)\n {\n int w;\n\n if (w % 2 == 0)\n {\n return \"YES\";\n }\n else\n {\n return \"NO\";\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1fb742382d775ddc21b41bc2bc419bf6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n string weight0;\n int weight;\n \n weight0 = Console.ReadLine();\n weight = Convert.ToInt32(weight0);\n\n if (weight % 2 == 0 && weight != 2)\n {\n Console.WriteLine(\"YES\");\n\n }\n\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9e23eec7f070cc4d63a1a523cfbe3899", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\nclass Program\n{\n static void Main()\n {\n int w;\n w = int .parse(Console.ReadLine()) ; if(w%2==1)\n console.write(\"no\");\n else\n console.write(\"yes\");\n }\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ed4af98ac8246a6ac931c4da95e2d1ab", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 > 0;\n a = int.Parse (Console.ReadLine());\n \n if (( a % 4 == 0)) \n {\n Console.WriteLine(\"YES\"); \n }\n \n else if (( a+2 % 4 == 0))\n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0e636c803cfdd952876910cf0ac51b3c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\namespace MON_PROJEC1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w ;\n Console.WriteLine(\"the weight of the watermelon bought\");\n w = int.Parse(Console.ReadLine());\n\n \n \n if (w % 2 ==0 )\n {\n Console.WriteLine(\"YES\");\n\n }\n\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8319ab537d6bbb961c1ad1a802ad8b0b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {FC6F239C-0743-41DF-8B79-D5E8087150B1}\n Exe\n _4A\n 4A\n v4.6.1\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1354d3bff98491f40f29d9a339a9bca0", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 == 0 && a/2 % == 0) \n {\n Console.WriteLine(\"YES\"); \n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9c9810f31b5ddc20e4eb1eeb7468856c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp6\n\n{\n\n public class Program\n {\n static void Main()\n {\n int input = int.Parse(Console.ReadLine());\n if (input % 2 != 0 || input == 2)\n {\n Console.WriteLine(\"No\");\n }\n else\n {\n Console.WriteLine(\"Yes\");\n }\n\n\n\n\n\n\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "21aac0f48345eb9c3adb0c3ffd0a9aac", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n Console.Write(\"enter the weight of the watermelon: \");\n byte w = byte.Parse(Console.ReadLine());\n if(w%2==0&&w>2)\n {\n Console.WriteLine(\"yes\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "71caf5ccb11fc00f23206348a2d0d043", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program{\n static void Main(){\n int x = int.Parse(Console.ReadLine());\n Console.WriteLine(x > 2 && (x & 1) == 0 ? \"YES\", \"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8f6b7dd876f211a2e27e2ee0cc6008ab", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n var nbr = int.Parse(Console.ReadLine());\n\n Console.WriteLine((nbr % 2 == 0 && ((nbr /2) % 2 == 0) ? \"YES\" : \"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7228d7906e0fcd4e057e5ae45172b9bf", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\nclass check\n\n{\n public static void main(String[] args)\n {\n int a=int.Parse(Console.ReadLine());\n if(a%2==0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "757f8a627571555b560a65eaf58b7443", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n int w = int.Parse(Console.ReadLine());\n if (w == 2 || w % 2 != 0)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n Console.ReadKey();\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "490dbc0b2142eaabeb36cabb5a8a10d7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "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 Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1432a551527c478858031eab7c69ab39", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26228.4\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"msp watermelon\", \"msp watermelon\\msp watermelon.csproj\", \"{EFBC6D34-8A95-4ACC-99BB-51D914FEBA5D}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{EFBC6D34-8A95-4ACC-99BB-51D914FEBA5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{EFBC6D34-8A95-4ACC-99BB-51D914FEBA5D}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{EFBC6D34-8A95-4ACC-99BB-51D914FEBA5D}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{EFBC6D34-8A95-4ACC-99BB-51D914FEBA5D}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c25a9e86f0679e15612a0c9b593e364f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n int number = int.Parse(Console.ReadLine());\n if (number > 2 && number % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "406e58e7f73a3b53dc921221580c4064", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": " private static string CheckEven(int x)\n {\n if (x%2==0)\n {\n return \"YES\";\n }\n else\n return \"NO\";\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2a3c4849d0e76b98a729980153107963", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Codeforces\n{\n class Codeforces\n {\n public static string DivideWatermelon(int w)\n {\n return w % 2 == 0 ? \"YES\" : \"NO\";\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4cf090092bfc41b21540ac39a6141390", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "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 weight0;\n int weight;\n \n weight0 = Console.ReadLine();\n weight = Convert.ToInt32(weight0);\n\n if (weight % 2 == 0 && weight != 2)\n {\n Console.WriteLine(\"YES\");\n\n }\n\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0e6bc93d03de8307ae0f4969d250d068", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\npublic class Program\n{\n static void Main(String[]Args)\n {\n int a = Convert.Int32(Console.ReadLine());\n if(a<=2) Console.WriteLine(\"NO\");\n if(a%2==0)Console.Write(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c7713fe8c6cd6fdaa1cdbd2e7eaaceae", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 = 2;\n a = int.Parse (Console.ReadLine());\n \n if (( a == 2)) \n {\n Console.WriteLine(\"NO\"); \n \n return 0;\n }\n \n if (( a % 2 == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c73ea9abf1eacf99876828b6d51504f4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " int w = int.Parse(Console.ReadLine());\n if (w%2 == 1)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1b3bdfcaf955443b90dc14a38aeb2f4c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n \npublic class Solution\n{\n // insert your code here\n private void Solve()\n {\nint a = 5;\noutput.WriteLine(a / 0);\n }\n\n bool ONLINE_JUDGE;\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 output.Close();\n }\n catch (Exception e)\n {\n if (ONLINE_JUDGE) throw e;\n else Console.WriteLine(e);\n }\n }\n\n private TextReader input;\n private TextWriter output;\n\n private string[] INPUT_BUFFER;\n private int INPUT_BUFFER_INDEX;\n\n private char[] DELIMITERS = new char[] { ' ', '\\t' };\n\n private void Init()\n {\n #if (ONLINE_JUDGE)\n ONLINE_JUDGE = true;\n #else\n ONLINE_JUDGE = false;\n #endif\n\n if (ONLINE_JUDGE)\n {\n input = Console.In;\n output = Console.Out;\n }\n else\n {\n string projectPath = Path.GetFullPath(@\"..\\..\\\");\n input = new StreamReader(new FileStream(projectPath + \"input.txt\", FileMode.OpenOrCreate));\n output = new StreamWriter(new FileStream(projectPath + \"output.txt\", FileMode.Create));\n }\n\n INPUT_BUFFER = new string[0];\n INPUT_BUFFER_INDEX = 0;\n }\n \n private string ReadLine() { return input.ReadLine(); }\n \n private string ReadString()\n {\n while (INPUT_BUFFER_INDEX == INPUT_BUFFER.Length)\n {\n INPUT_BUFFER = ReadLine().Split(DELIMITERS, StringSplitOptions.RemoveEmptyEntries);\n INPUT_BUFFER_INDEX = 0;\n }\n \n return INPUT_BUFFER[INPUT_BUFFER_INDEX++];\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8ced591ba65b9d916a4599bd97d2385a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using namespace system\n\nclass check\n\n{\n public static void main(String[] args)\n {\n int a=int.Parse(Console.ReadLine())\n if(a%2==0)\n {\n Console.WriteLine(\"YES\")\n }\n else\n {\n Console.WriteLine(\"NO\")\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ea88588f6f4b1b67b52b35f61fd5fc47", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "Console.WriteLine(\"sayi\");\nint sayi=Console.ReadLine();\n\nif(sayi<100 || sayi >=1)\n{\n Console.WriteLine(\"Do\u011fru\");\n}\nelse\n Console.WriteLine(\"Yanl\u0131\u015f\");\n \n Console.ReadLine();\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "68e0b578acb95c96420c807ee5e35866", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "static void Main()\n{\n Console.WriteLine(\"Test\");\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3184339f334b7558fce335ac8b42b989", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n \nnamespace CSharp {\n\tclass CS {\n\t \n \tpublic static void Main (string[] args) {\n \t \n \t int Weight;\n \n Weight = Convert.ToInt32(Console.ReadLine());\n\n if (Weight < 1 && Weight > 100) return;\n\n for (int i = 2; i <= Weight; i += 2)\n {\n if (Weight % 2 != 0)\n {\n Console.Write(\"NO\");\n return\n }\n }\n Console.Write(\"NO\");\n \t}\n \t} \n\t}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fbd9b2a33b69b9796c40a635746539ba", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Linq;\nusing System;\n\nnamespace cs\n{\n class Program\n {\n static void Main(string[] args)\n {\n double n = Convert.ToDouble(Console.ReadLine());\n if((n - 2.0) % 2.0) {\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1f947292581c15f027881625f770fcb9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Watermelon\", \"Watermelon\\Watermelon.csproj\", \"{01E423C6-E470-4648-9471-6581DAB6EE6B}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{01E423C6-E470-4648-9471-6581DAB6EE6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{01E423C6-E470-4648-9471-6581DAB6EE6B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{01E423C6-E470-4648-9471-6581DAB6EE6B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{01E423C6-E470-4648-9471-6581DAB6EE6B}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f657ad7f33ea8b232ecc84019338d736", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "namespace check1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int i;\n Console.Write(\"Enter a Number : \");\n i = int.Parse(Console.ReadLine());\n if (i % 2 == 0 && i > 2)\n {\n Console.Write(\"YES\");\n Console.Read();\n }\n else\n {\n Console.Write(\"NO\");\n Console.Read();\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8de603dd9e0ce40abefddabc34d5e60f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "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 byte weight = short.Parse(Console.ReadLine());\n if (weight % 2 == 0)\n {\n Console.WriteLine(\"yes\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ccd04043f2eb5d67ae45de5b32b69167", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\nclass Program\n{\n static void Main()\n {\n int w;\n console.read(w);\n if(w%2==1)\n console.write(\"no\");\n else\n console.write(\"yes\");\n }\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ff69f51373370871964ca89f50466c78", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System\nnamespace Program1\n{\n class Program1\n {\n static void Main()\n {\n int x, i, j;\n \n bool res = false\n \n x = Console.ReadKey();\n \n for(i = 2; i < 8; i+2)\n {\n j = x - i;\n \n if(j % 2 == 0)\n res = true;\n }\n \n if(res == true)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\"); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fc2a2d38cde8d783294f308f73c132bb", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Watermelon{\n static public void Main(){\n //string tmp = Console.ReadLine();\n int n=Console.ReadLine();//int.Parse(tmp);\n if(n%2==0&&n>2)Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d413395f4dd64b474dde92d137227e5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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/2; i+2){\n if (N / i % 2 == 0) ans = \"Yes\";\n }\n Console.WriteLine(ans);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "be275cb509667708c89b8d7a8ccc13b4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9ea2145b715b3c2738db8e12c6e6b07a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "string w = Console.ReadLine();\n try {\n int weight = Convert.ToInt32(w);\n if (1 <= weight && weight <= 100) {\n if (weight % 2 == 0) {\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n } catch (Exception e) {\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f1a65e79e9c4eef9c003bcbbd83c3f59", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 == 0 && (a/2) % == 0) \n {\n Console.WriteLine(\"YES\"); \n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dd75d7e4a7cdd7391ad242cf69c29b69", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Reflection;\n\n[assembly: FSharpInterfaceDataVersion(2, 0, 0)]\n[assembly: AssemblyVersion(\"0.0.0.0\")]\n[CompilationMapping(SourceConstructFlags.Module)]\npublic static class _\n{\n [EntryPoint]\n public static int main(string[] args)\n {\n int num = LanguagePrimitives.ParseInt32(Console.ReadLine());\n object value;\n switch (num)\n {\n default:\n value = ((num % 2 != 1) ? \"YES\" : \"NO\");\n break;\n case 2:\n value = \"NO\";\n break;\n }\n Console.WriteLine((string)value);\n return 0;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9d0cb13584fdc6370fee996b1012e5e9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n \nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Console.Read();\n int k = (x > 2 && x % 2 < 1) ? 1 : 0;\n Console.WriteLine((k > 0 ? \"YES\" : \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4bbe4aede542c4b313f9a7f1bc2f58e0", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n \nnamespace CSharp {\n\tclass CS {\n\t \n \tpublic static void Main (string[] args) {\n \t \n \t int Weight;\n \n Weight = Convert.ToInt32(Console.ReadLine());\n\n if (Weight < 1 && Weight > 100) return \"No\";\n\n for (int i = 2; i <= Weight; i += 2)\n {\n if (Weight % 2 != 0)\n {\n Console.Write(\"NO\");\n return\n }\n }\n Console.Write(\"NO\");\n \t}\n \t} \n\t}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7097bee59ce03ba83ee8d66cefc9f959", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\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.WriteLine(\"NO\");\n Console.ReadLine();\n }\n\n if (w <= 2)\n {\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n\n if (w <= 2)\n {\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n if (w % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n Console.ReadLine();\n }\n else\n {\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dc5dc8573a849c91cc25b54bd7c14311", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28010.2046\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp3\", \"ConsoleApp3\\ConsoleApp3.csproj\", \"{FC3E7230-C702-44DF-97C4-304B435F1342}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{FC3E7230-C702-44DF-97C4-304B435F1342}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{FC3E7230-C702-44DF-97C4-304B435F1342}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{FC3E7230-C702-44DF-97C4-304B435F1342}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{FC3E7230-C702-44DF-97C4-304B435F1342}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {109DB6DC-D188-4FB8-82B9-897668CD3506}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "026a07ab8df5ab93b55a8deced0ebbee", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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\n int x = 0;\n x =Int32.Parse( Console.ReadLine());\n var res=test(x);\n }\n\n public static string test(int i)\n {\n if (i>=1 && i<=100)\n {\n var res = i % 2;\n if (res == 0)\n {\n var res2 = (i / 2) % 2;\n if (res2 == 0)\n {\n return \"YES\";\n }\n else\n {\n return \"NO\";\n }\n\n }\n else\n return \"NO\";\n\n\n }\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4d17bf318f5b19dae8f7367427fba081", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n\n int weight = Convert.ToInt32(Console.ReadLine());\n\n if ( (weight % 2 == 0) && weight != 2)\n {0\n Console.Write(\"YES\");\n }\n else\n {\n Console.Write(\"NO\");\n }\n\n //Console.ReadKey();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1f5a92a19ec405a667e85b28118e9b60", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\nusing System;\n\n\n \n static void Main(string[] args)\n {\n int w ;\n w = int.Parse(Console.ReadLine());\n if (w > 2 && w % 2 == 0){ Console.WriteLine(\"yes\"); }\n else { Console.WriteLine(\"no\"); }\n \n }\n \n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e65ddcdd1dda1920ce54a98cc267cb32", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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) == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else if (a/2 % 2) == 1)\n {\n Console.WriteLine(\"NO\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a9eba4ea65b339b0c496f86dac9e421d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Program1\n{\n class Program1\n {\n static void Main(string[] args)\n {\n int x, j;\n \n bool res = false;\n \n x = Int32.Parse(Console.ReadKey());\n \n for(int i = 2; i < 8; i+2)\n {\n j = x - i;\n \n if(j % 2 == 0)\n res = true;\n }\n \n if(res == true)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\"); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2bacfb9eb940ac8815f67d0aa264f9cb", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\n\nint x= Convert.ToInt32(Console.ReadLine());\nif(x%2==0)\n \n{\nreturn \"Yes\"\n}\nelse\n{\nreturn \"No\"\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5c25c941edd3285a71b8f6d1383526e5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass program\n{\n Public static void Main()\n {\n int x = Convert.ToInt32(Console.ReadLine());\n if(x==2) Console.WriteLine(\"NO\");\n else if(x%2==0) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8880ac28a58080d7d6668393641c1ffe", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "static void Main(string[] args)\n {\n var result = Calculate();\n\n Console.WriteLine(result);\n }\n\n private static string Calculate()\n {\n var input = Console.ReadLine();\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)\n {\n return \"YES\";\n }\n }\n\n return \"NO\";\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "441701ee72fad026f38c2d419651f595", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "class 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "166ac7a26b9368c1d7629eeaba1170a7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace TestFSharpTranslation\n{\n public class Program\n {\n public static int Main(string args)\n {\n int num = int.Parse(Console.ReadLine());\n object value;\n switch (num)\n {\n default:\n value = ((num % 2 != 1) ? \"YES\" : \"NO\");\n break;\n case 2:\n value = \"NO\";\n break;\n }\n Console.WriteLine((string)value);\n return 0;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d0223f2e026f42debdadb63b5767ec55", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\nclass check\n\n{\n public static void Main()\n {\n int a=int.Parse(Console.ReadLine());\n if(a%2==0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ac68248f88a30bc6c4ccceaa093d8231", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing Newtonsoft.Json;\nusing Newtonsoft.Json.Linq;\nusing System;\nusing System.IO;\nusing System.Net;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string test = Console.ReadLine();\n if (Convert.ToInt32(test)%2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8f522d6be374d2341130eb99237c33d2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n bool can =canBeDividet(98);\n if (can) {\n Console.WriteLine(\"YES\");\n }\n else{\n Console.WriteLine(\"NO\");\n }\n Console.WriteLine(can);\n Console.ReadKey();\n }\n\n public static bool canBeDividet(int number) {\n bool flag = false;\n \n \n for (int i = 2; i < number; i +=2) {\n if (((number - i) % 2) == 0) {\n flag = true;\n break;\n }\n }\n\n return flag;\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "340547dd55430eb46ce9a3788fea8c3f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication3\", \"ConsoleApplication3\\ConsoleApplication3.csproj\", \"{60F599DD-9CE4-4AD9-B07D-1214E487FF1E}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{60F599DD-9CE4-4AD9-B07D-1214E487FF1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{60F599DD-9CE4-4AD9-B07D-1214E487FF1E}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{60F599DD-9CE4-4AD9-B07D-1214E487FF1E}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{60F599DD-9CE4-4AD9-B07D-1214E487FF1E}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d28cb203ca77a6957b29c8c36847e2cb", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nclass Program\n{\n\tpublic static void Main() {\n\t\tvar n = int.Parse(Console.ReadLine());\n\t\tConsole.WriteLine(n > 5 && n % 2 == 0 ? \"YES\" : \"NO\");\n\t}\n}\nProgram.Main();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d64d31a915e2bb4f594636fefa43498c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n\n int weight = Convert.ToInt32(Console.Read())\n\n if ( (weight % 2 == 0) && weight != 2)\n {0\n Console.Write(\"YES\");\n }\n else\n {\n Console.Write(\"NO\");\n }\n\n //Console.ReadKey();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5497aeecc0406989e2f03d21413e4f61", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\n static void \n Main(string[] args)\n {\n int w;\n Console.WriteLine(\"\");\n w = int.Parse(Console.ReadLine());\n\n if (w>1 && w<100)\n {\n if (w%2==0)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n \n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8389e45d1492e7d28cf45d30b874fac2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "int w;\n\n if (w % 2 == 0)\n Console.Write(\"YES\");\n else Console.Write(\"NO\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "917ebcd545a2c4c55cf4ee5259c0d981", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace BigO_Chapter\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Weight;\n \n Weight = Convert.ToInt32(Console.ReadLine());\n\n if (Weight < 1 && Weight > 100) return \"No\";\n\n for (int i = 2; i <= Weight; i += 2)\n {\n if (Weight % 2 != 0)\n {\n return \"NO\";\n Console.WriteLine(\"NO\");\n }\n }\n Console.WriteLine(\"NO\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "354048e8efb53ec4fd74fe1b659b02b9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f6f0fcab8e93a0c055cd3bbcbaf2f05b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\nint X;\nw%2 = X;\n\nif (X==0)\n{\n console.writeline(\"YES\");\n}\n\nif (X==1)\n{\n console.writline(\"NO\");\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c2ebed6267a4b1e01b30135b164a4f47", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.29728.190\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"TestWaterMelonCodeForces\", \"TestWaterMelonCodeForces\\TestWaterMelonCodeForces.csproj\", \"{D17EDBBB-C72E-48B6-A6DD-230748852E77}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{D17EDBBB-C72E-48B6-A6DD-230748852E77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{D17EDBBB-C72E-48B6-A6DD-230748852E77}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{D17EDBBB-C72E-48B6-A6DD-230748852E77}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{D17EDBBB-C72E-48B6-A6DD-230748852E77}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {B9FE3301-E39D-4657-B34F-DBB3C6ACD0DB}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "427f41310725d7b37f17c3d9bcf544e5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "Console.Write(\"enter the weight ArgumentOutOfRangeException the watermelon; \");\n int w = int.Parse(Console.ReadLine());\n if(w%2==0&&w>2)\n {\n Console.WriteLine(\"it can be divided\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9f619fcd0d20e860b245bb2e09f2b5d8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "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 for (int i=0; i < 1 ; i++)\n {\n Watermelon();\n }\n }\n\n public static void Watermelon()\n {\n int w = Convert.ToInt32(Console.ReadLine());\n int x = w % 2;\n\n if (w == 2)\n {\n Console.Write(\"NO\");\n goto next;\n }\n if (x == 0)\n {\n Console.Write(\"YES\");\n }\n if (x != 0)\n {\n Console.Write(\"NO\");\n }\n next:\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8809fc1af42fbf418336b01333145cc4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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 = 7;\n a = int.Parse (Console.ReadLine());\n \n if ( a-4 % 2 == 0, a > 1, a++) \n {\n Console.WriteLine(\"YES\"); \n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2b1d8fd7d0a9f6c8fc393d0ca79c6fdd", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "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\tint C(object x)\n\t{\n\t\tswitch (x)\n\t\t{\n\t\t\tcase int n: return n;\n\t\t\tcase string s: return s.Length;\n\t\t\tdefault: return 0;\n\t\t}\n\t}\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\tint f(int n) => n >= 1 ? n * f(n - 1) : 1;\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\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c30d3ac3c6fce722c4e18497d29c2eff", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program {\n static void Main() \n {\n int n;\n Console.Read (n);\n if (n % 4 == 0) {\n Console.WriteLine (\"YES\");\n }\n else\n {\n Console.WriteLine (\"NO\");\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ceb842cf5473174d19d2399583a713c8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "int[] inputArray = new int[] {10, 12, 10, 7, 5, 22 };\nint m = 4;\n\nint[] sortedArray = inputArray.OrderBy(x => x).ToArray();\n\nint lowestDifference = int.MaxValue;\nfor (int i = m - 1; i < inputArray.Length; ++i)\n{\n int firstValue = sortedArray[i - (m - 1)];\n int lastValue = sortedArray[i];\n int difference = lastValue - firstValue;\n\n if (difference < lowestDifference)\n {\n lowestDifference = difference;\n }\n}\n\nreturn lowestDifference;\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c38e8680183eba48ff96c084e81099a0", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "MS C#", "source_code": "static int GetLowestDifference(int[] inputArray, int m)\n{\n int[] sortedArray = inputArray.OrderBy(x => x).ToArray();\n\n int lowestDifference = int.MaxValue;\n for (int i = m - 1; i < inputArray.Length; ++i)\n {\n int firstValue = sortedArray[i - (m - 1)];\n int lastValue = sortedArray[i];\n int difference = lastValue - firstValue;\n\n if (difference < lowestDifference)\n {\n lowestDifference = difference;\n }\n }\n\n return lowestDifference;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "655961fa7f7b101191ace061f54b9584", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Puzzles{\n\n\tpublic static void Main(){\n\t\t\n\t\tString [] inp = Console.ReadLine().Split(' ');\n\t\tint a = Int32.Parse(inp[0]); \n\t\tint m = Int32.Parse(inp[1]); \n\t\tint [] arr = new int[m];\n\n\t\tinp = Console.ReadLine().Split(' ');\n\n\t\tfor(int i=0 ; i x).ToArray();\n\n int lowestDifference = int.MaxValue;\n for (int i = m - 1; i < inputArray.Length; ++i)\n {\n int firstValue = sortedArray[i - (m - 1)];\n int lastValue = sortedArray[i];\n int difference = lastValue - firstValue;\n\n if (difference < lowestDifference)\n {\n lowestDifference = difference;\n }\n }\n\n return lowestDifference;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ef77f0a0bd47f78d229800967185429c", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _337A.Puzzles\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] du = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] puzl= Console.ReadLine().Split().Select(int.Parse).ToArray();\n Array.Sort(puzl);\n int diff = puzl[du[0]-1] - puzl[0];\n Console.WriteLine(diff);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d46bae4809e60ab430f85bd4911b233a", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u041f\u0430\u0437\u043b\u044b\n{\n class Program\n {\n static void Main(string[] args)\n {\n var nk = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int min = 1001;\n int c;\n\n int k = nk[0];\n int n = nk[1];\n\n for(int i = 0; i < n - 1; i++)\n {\n for(int j = i; j < n; j++)\n if(mas[j] < mas[i])\n {\n c = mas[j];\n mas[j] = mas[i];\n mas[i] = c;\n }\n }\n\n for (int i = k - 1; i < n; i++)\n if (mas[i] - mas[i - (k - 1)] < min) min = mas[i] - mas[i - (k - 1)];\n\n Console.WriteLine(min);\n\n Console.ReadLine();\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aebcb5c83f353a670e9c8c31aa0a8b96", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "Mono C#", "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 m = Convert.ToInt32(s[0]);\n int n = Convert.ToInt32(s[1]);\n int[] ar = new int [n];\n s=Console.ReadLine().Split(' ');\n for (int i=0;i x).ToArray();\n\n int lowestDifference = int.MaxValue;\n for (int i = m - 1; i < inputArray.Length; ++i)\n {\n int firstValue = sortedArray[i - (m - 1)];\n int lastValue = sortedArray[i];\n int difference = lastValue - firstValue;\n\n if (difference < lowestDifference)\n {\n lowestDifference = difference;\n }\n }\n\n return lowestDifference;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "572748dc0379d97eaf0db5c449ed4e32", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace A._Puzzles\n{\n class Program\n {\n static void Main()\n {\n List result = new List();\n int maxDiff = 0, currentDiff = 0;\n\n string[] data = Console.ReadLine().Split(\" \");\n int n = Convert.ToInt32(data[0]);\n int m = Convert.ToInt32(data[1]);\n\n data = Console.ReadLine().Split(\" \");\n List numbers = data.Select(int.Parse).ToList();\n numbers.Sort();\n\n \n\n result.Add(numbers[0]);\n for(int i = 1; i < m; i++)\n {\n if(result.Count < n)\n {\n maxDiff += (numbers[i] - numbers[i - 1]);\n result.Add(numbers[i]);\n }\n else\n {\n currentDiff = (numbers[i] - numbers[i - 1]) + (maxDiff - (result[1] - result[0]));\n\n if (currentDiff < maxDiff)\n {\n result.RemoveAt(0);\n result.Add(numbers[i]);\n maxDiff = currentDiff;\n currentDiff = 0;\n }\n else\n break;\n\n }\n }\n\n Console.WriteLine(maxDiff);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0f66c971d4d2ce5f2c997b731bfc5b6f", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n string input;\n int nStudents;\n int nPuzzles;\n\n input = Console.ReadLine();\n nStudents = Convert.ToInt32(input.Split(' ')[0]);\n nPuzzles = Convert.ToInt32(input.Split(' ')[1]);\n\n string[] Puzzles = new string[nPuzzles];\n int[] PuzzlesInt = new int[nPuzzles];\n\n Puzzles = Console.ReadLine().Split(' ');\n \n int i = 0;\n while (i < nPuzzles)\n {\n PuzzlesInt[i] = Convert.ToInt32(Puzzles[i]);\n i++;\n }\n\n Array.Sort(PuzzlesInt);\n\n int[] StudentPuzzles = new int[nPuzzles-nStudents+1];\n\n for (int y = nStudents; y <= nPuzzles; y++)\n {\n StudentPuzzles[y-nStudents] = PuzzlesInt[y-1] - PuzzlesInt[y-nStudents];\n }\n Array.Sort(StudentPuzzles);\n Console.WriteLine(StudentPuzzles[0]);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3c78f7cfa8485b40bc68405c0cae1d24", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0;\n if (n % 2 == 0)\n count = Math.Ceiling((double) n / 4 - 1);\n Console.WriteLine(count);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "99b5fb486275ebe87aa590f947494b17", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing 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 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\n class Program\n {\n private static void Main()\n {\n int number = int.Parse(Functions.ReadLine());\n //Console.WriteLine(number);\n var count = 0;\n \n for (var i = 1; i <= number; i++)\n {\n string iNum = i.ToString();\n if (iNum.Contains('2') || iNum.Contains('3') || iNum.Contains('4') || iNum.Contains('5') || iNum.Contains('6') || iNum.Contains('7') || iNum.Contains('8') || iNum.Contains('9')) continue;\n \n var bin = true;\n foreach (char c in iNum)\n {\n if (c != '1' && c != '0')\n {\n bin = false;\n break;\n } \n }\n if (bin)\n count++;\n\n Console.WriteLine($\"{i}: {bin}\");\n if (iNum == new string('1', iNum.Length))\n i = int.Parse(new string('9', iNum.Length));\n Console.WriteLine($\"{i}: {bin}\");\n \n }\n\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5fae8809fee494ddbd0a5f8f39c44382", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "ing 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\n\n\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "19d1dd158a1f0d58751b86b2ff27b4ea", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "MS C#", "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 while(n>1)\n {\n f *= n;\n n--;\n }\n Console.WriteLine(f + 1);\n }\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "69245bdbb952f1b39197b3393e05501b", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Numerics;\nnamespace ConsoleApplication2\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n=Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(Math.Pow(2,n)-1); \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f2affc7fe0048991353260795b396bbb", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"codeForces b\", \"codeForces b\\codeForces b.csproj\", \"{AC5C3622-C0DC-4791-B43D-D6253527F0DC}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{AC5C3622-C0DC-4791-B43D-D6253527F0DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{AC5C3622-C0DC-4791-B43D-D6253527F0DC}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{AC5C3622-C0DC-4791-B43D-D6253527F0DC}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{AC5C3622-C0DC-4791-B43D-D6253527F0DC}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7abef45f1e7883970497f3f63aee42c2", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "namespace CodeForce164\n{\n using System;\n using System.IO;\n using ProblemsResolver;\n\n\n public static class Program\n {\n public static void Main(string[] args)\n {\n ResolveB();\n }\n\n private static void ResolveA()\n {\n#if DEBUG\n TextReader reader = new StreamReader(@\"inputA.txt\");\n#else\n TextReader reader = Console.In;\n#endif\n var n = int.Parse(reader.ReadLine());\n var input = new string[n];\n for (var i = 0; i < n; i++)\n {\n input[i] = reader.ReadLine();\n }\n\n Console.WriteLine(ProblemA.Resolve(input));\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 var clicks = 1;\n for (var i = 0; i < n; i++)\n {\n clicks *= 2;\n }\n\n return clicks - 1;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "da0cdf203a536156fc4df75ac5bc71fc", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Numerics;\nnamespace ConsoleApplication2\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n=Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(BigInteger.Pow(2,n)-1); \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "077b18eaf693409c25471a99541d2a3a", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System.Text;\nusing System.Linq;\nnamespace CodeForces\n{\n class Contest{ \n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n for (int i = 0, l = str.Length; i <= l; ++i)\n {\n StringBuilder sb = new StringBuilder(str);\n for (char let = 'a'; let <= 'z'; let++)\n {\n string forward = str.Insert(i, \"\" + let); \n if (forward == new String(forward.Reverse().ToArray()))\n {\n Console.Write(forward);\n return;\n }\n }\n }\n Console.Write(\"NA\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d5c439885f335a01a5160f8f1b8495af", "src_uid": "24e8aaa7e3e1776adf342ffa1baad06b", "difficulty": 1100.0} {"lang": "Mono C#", "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 bool Polind(string s)\n {\n bool t = false;\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (s[i] != s[s.Length - 1 - i]) { return t; }\n return true;\n }\n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine(); bool f = true;\n bool k ;\n for (int i = 0; i <= s.Length; i++)\n {\n k = true;\n for (int j = 97; j < 123; j++)\n {\n if (Polind(s.Insert(i, ((char)j).ToString())))\n {\n k = false; f = false;\n Console.WriteLine(s.Insert(i, ((char)j).ToString()));\n break;\n }\n }\n \n if (k == false) { break; }\n }\n if (f) { Console.WriteLine(\"NA\"); }\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f555859a00cecb7fb738e4f0f7d49447", "src_uid": "24e8aaa7e3e1776adf342ffa1baad06b", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using Microsoft.VisualBasic.CompilerServices;\nusing System;\nusing System.Threading.Tasks.Dataflow;\n\nnamespace \u043e\u0447\u0435\u0440\u0435\u0434\u044c\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = int.Parse(Console.ReadLine());\n \n int t = int.Parse(Console.ReadLine());\n \n string[] s = new string[n];\n \n for (int i = 0; i < n; i++)\n {\n s[i] = Console.ReadLine();\n }\n\n for (int j = 0; j < t; j++)\n {\n\n for (int i = 0; i < n; i++)\n {\n if(i+1 == n)\n {\n break;\n }\n \n else if (s[i] == \"B\" && s[i + 1] == \"G\")\n {\n s[i] = \"G\";\n s[i + 1] = \"B\";\n i++;\n }\n \n }\n }\n for (int i = 0; i < n; i++)\n {\n Console.Write(s[i]);\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7ccbf4259b049e8cca8521e2955ac5fb", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f3544aac100d03ba098e731eca01e045", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _266b\n{\n class Program\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 t = Console.ReadLine();\n char[] s = new Char[100];\n for (int i = 0; i < n; ++i) s[i] = t[i];\n while (k > 0)\n {\n int i = 0;\n while (i < n)\n {\n while (i < n && s[i] == 'G') ++i;\n while (i < n - 1 && s[i] == 'B') ++i;\n if (i < n && s[i] == 'G' && s[i - 1] == 'B') \n { (s[i - 1], s[i]) = (s[i], s[i - 1]); }\n ++i; \n }\n --k;\n }\n Console.WriteLine(s);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8bcc2f7bb6354fbfb1dc74edeb35951f", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace sample\n{\n class Program\n {\n \n \n public static void Main()\n {\n int[] inputs = Array.ConvertAll(Console.ReadLine().Split(' '), num => Convert.ToInt32(num));\n char[] queue = Console.ReadLine().ToCharArray();\n int num = inputs[0];\n int times = inputs[1];\n for (int i = 0; i < times; i++)\n {\n for (int j = 0; j < num-1; j++)\n {\n if(queue[j]=='B' && queue[j+1]=='G')\n {\n queue[j]='G';\n queue[j+1]='B';\n j++;\n }\n }\n }\n System.Console.WriteLine(new string(queue));\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f182d1d0e2e012d5f307c865ce6e5867", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _266b\n{\n class Program\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 t = Console.ReadLine();\n char[] s = new Char[100];\n for (int i = 0; i < n; ++i) s[i] = t[i];\n while (k > 0)\n {\n int i = 0;\n while (i < n)\n {\n while (i < n && s[i] == 'G') ++i;\n while (i < n - 1 && s[i] == 'B') ++i;\n if (i < n && s[i] == 'G' && s[i - 1] == 'B') (s[i - 1], s[i]) = (s[i], s[i - 1]);\n ++i; \n }\n --k;\n }\n for (int i = 0; i < n; ++i)\n Console.Write(s[i]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "57f25662b0deabe46bf52e985d5b78f2", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Express 2012 for Windows Desktop\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication1\", \"ConsoleApplication1\\ConsoleApplication1.csproj\", \"{7EB56892-0EBC-401A-A1F5-53ADD4C286D9}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{7EB56892-0EBC-401A-A1F5-53ADD4C286D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{7EB56892-0EBC-401A-A1F5-53ADD4C286D9}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{7EB56892-0EBC-401A-A1F5-53ADD4C286D9}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{7EB56892-0EBC-401A-A1F5-53ADD4C286D9}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "84a3cbfe226b15984aab378e1e67c4e9", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _266b\n{\n class Program\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 t = Console.ReadLine();\n char[] s = new Char[100];\n for (int i = 0; i < n; ++i) s[i] = t[i];\n while (k > 0)\n {\n int i = 0;\n while (i < n)\n {\n while (i < n && s[i] == 'G') ++i;\n while (i < n - 1 && s[i] == 'B') ++i;\n if (i < n && s[i] == 'G' && s[i - 1] == 'B') (s[i - 1], s[i]) = (s[i], s[i - 1]);\n ++i; \n }\n --k;\n }\n for (int i = 0; i < n; ++i) Console.Write(s[i]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "715befb1819edd90bcf65cfcb0d0a580", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " public 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7874f8765b66189750ea3e729325969f", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _266b\n{\n class Program\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 t = Console.ReadLine();\n char[] s = new Char[100];\n for (int i = 0; i < n; ++i) s[i] = t[i];\n while (k > 0)\n {\n int i = 0;\n while (i < n)\n {\n while (i < n && s[i] == 'G') ++i;\n while (i < n - 1 && s[i] == 'B') ++i;\n if (i < n && s[i] == 'G' && s[i - 1] == 'B') (s[i - 1], s[i]) = (s[i], s[i - 1]);\n ++i; \n }\n --k;\n }\n Console.WriteLine(s);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "53b3c06c9fc0d9a6f504187a0fb5a3c7", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodingPractice\n{\n internal class SchoolQueue\n {\n internal static void Order()\n {\n IEnumerable input = Console.ReadLine().Split(' ').Select(int.Parse);\n Char[] queueString = Console.ReadLine().ToCharArray();\n\n for (int i = 0; i < input.Last(); i++)\n {\n for (int j = 0; j < input.First() - 1; j++)\n {\n if (queueString[j] == 'B' && queueString[j + 1] == 'G')\n {\n Svap(queueString, j, j + 1);\n j++;\n }\n }\n }\n\n Console.WriteLine(queueString);\n }\n\n private static void Svap(char[] queueString, int j, int v)\n {\n char temp = queueString[j];\n queueString[j] = queueString[v];\n queueString[v] = temp;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "60266999e1ff1d994f38a9a31089e2fe", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_QueueSchool\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tmp = Console.ReadLine().Split(' ');\n string q = Console.ReadLine();\n int n = int.Parse(tmp[1]);\n while(n-- >0)\n {\n q = q.Replace(\"BG\", \"GB\");\n }\n Console.WriteLine(qu);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "67fe72f8c6d0ea8b4bb5ee527b76c721", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _266b\n{\n class Program\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 t = Console.ReadLine();\n char[] s = new Char[100];\n for (int i = 0; i < n; ++i) s[i] = t[i];\n while (k > 0)\n {\n int j = 0;\n while (j < n)\n {\n while (j < n && s[j] == 'G') ++j;\n while (j < n - 1 && s[j] == 'B') ++j;\n if (j < n && s[j] == 'G' && s[j - 1] == 'B') (s[j - 1], s[j]) = (s[j], s[j - 1]);\n ++j; \n }\n --k;\n }\n for (int i = 0; i < n; ++i) Console.Write(s[i]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9d57f38077d12df109ace0b935d77a35", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _266b\n{\n class Program\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 t = Console.ReadLine();\n char[] s = new Char[100];\n for (int i = 0; i < n; ++i) s[i] = t[i];\n while (k > 0)\n {\n int i = 0;\n while (i < n)\n {\n while (i < n && s[i] == 'G') ++i;\n while (i < n - 1 && s[i] == 'B') ++i;\n if (i < n && s[i] == 'G' && s[i - 1] == 'B') \n (s[i - 1], s[i]) = (s[i], s[i - 1]);\n ++i; \n }\n --k;\n }\n Console.WriteLine(s);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "53918e41aa2428a72bddeff1890cd5d9", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace GameTree\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(new GameTree(Int64.Parse(Console.ReadLine().Trim())).ToString());\n Console.ReadLine();\n }\n\n class GameTree\n {\n private static long finish;\n private static HashSet LastChildren;\n private long min;\n\n public myGameTree(long x)\n {\n finish = x;\n LastChildren = new HashSet();\n Node first = new Node(1);\n min = LastChildren.Min();\n LastChildren.Clear();\n LastChildren = null;\n }\n\n\n\n public override string ToString()\n {\n return min.ToString();\n }\n\n struct Node\n {\n private long value;\n private long score;\n\n public Node(long first)\n {\n value = 1;\n score = 1;\n if (finish - value > 0)\n MakeChild(finish - value);\n LastChildren.Add(finish);\n }\n\n public Node(long father_value, long father_score, long addon)\n {\n value = (father_value << 1) + addon;\n score = father_score + addon;\n\n if (!LastChildren.Contains(LastChildren.Count))\n MakeChild(finish - (value << 1) + 1);\n }\n\n private void MakeChild(long prod)\n { \n for (long i = 0; i < prod; i++)\n {\n if (finish - ((value << 1) + i) > 1)\n {\n Node child = new Node(value, score, i);\n }\n else if ((value << 1) + i == finish)\n LastChildren.Add(score + i);\n }\n\n \n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2f3b66df18a0a79d9e63e71824f9f011", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27004.2009\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp8\", \"ConsoleApp8\\ConsoleApp8.csproj\", \"{B433AB21-B567-4758-8071-1A5350687DC5}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B433AB21-B567-4758-8071-1A5350687DC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B433AB21-B567-4758-8071-1A5350687DC5}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B433AB21-B567-4758-8071-1A5350687DC5}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B433AB21-B567-4758-8071-1A5350687DC5}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {17E13182-9B37-43EE-B8CA-350F37EC1123}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3ccea8884bdc62be0a07952adc917480", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AprilFools2013A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(@\"Washington\nAdams\nJefferson\nMadison\nMonroe\nAdams\nJackson\nVan Buren\nHarrison\nTyler\nPolk\nTaylor\nFillmore\nPierce\nBuchanan\nLincoln\nJohnson\nGrant\nHayes\nGarfield\nArthur\nCleveland\nHarrison\nCleveland\nMcKinley\nRoosevelt\nTaft\nWilson\nHarding\nCoolidge\nHoover\nRoosevelt\nTruman\nEisenhower\nKennedy\nJohnson\nNixon\nFord\nCarter\nReagan\".Split('\\n')[int.Parse(Console.ReadLine()) - 1]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "df6cec5b1666f3115a07e8e882fda3f5", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() { \n var str = Console.ReadLine();\n if (str.Count(char.IsLower) >= str.Count(char.IsUpper)) Console.Write(str.ToLowerCase());\n else Console.Write(str.ToUpperCase());\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f0c702908453711824c5dd1462f0d075", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Lesson15_CSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int numberOfLowercase = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 'a' && s[i] <= 'z')\n {\n numberOfLowercase++;\n }\n }\n if (s.Length - numberOfLowercase > numberOfLowercase)\n {\n s = s.ToUpper();\n }\n else\n {\n s = s.ToLower();\n }\n Console.WriteLine(s);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "92fedb790394d4034614864021025445", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Task\n{\n static void Main()\n {\n string s=Console.ReadLine();\n int low=0,up=0;\n foreach(char ch in s)\n {\n if(Char.IsUpper())\n up+=1;\n else\n low+=1;\n }\n if(low>=up)\n {\n Console.WriteLine(s.ToLower());\n }\n else\n {\n Console.WriteLine(s.ToUpper());\n }\n }\n \n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "99124761b387929adb29bcfa5619921d", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3c35c2a983d612b601bba2838ab28bde", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "769e796d6e8516707f2dd682d018ea2b", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace valami\n{\n class valami2\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int count=0;\n for(int i=0;i 94)\n {\n count++;\n }\n }\n if(count= cap)\n {\n Console.WriteLine(input.ToLower());\n }\n else\n {\n Console.WriteLine(input.ToUpper());\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d297fee8aa00e0604cd8c588792fa984", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "Mono C#", "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 0;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "021804e681f0c309bc691213150f9314", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\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 lowerCount == higherCount ? s.ToLower() :s.ToUpper();\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "887c060c10489720573d06dec96d82f2", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Input ;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e9857bdb89895052e295e360b0fa134e", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\n{\n class Program\n {\n public static void Main(string[] args)\n {\n\n List primes = new List();\n int[] temp = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = temp[0], k = temp[1];\n for(int i = 2; i <= n; i++)\n {\n if (IsPrime(i))\n primes.Add(i);\n }\n int counter = 0;\n for(int i = 0; i < primes.Count - 1; i++)\n {\n int t = primes[i] + primes[i + 1] + 1;\n if (IsPrime(t) && t <= n)\n counter++;\n if (t > n || counter >= k) break;\n }\n Console.WriteLine((counter >= k) ? \"YES\" : \"NO\");\n\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 = Convert.ToInt32( Math.Sqrt(num));\n for(int i = 3; i <= limit; i += 2)\n {\n if (num % i == 0) return false;\n }\n return true;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cdf33e8e324098b9a55b1fc1374a6209", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "namespace _17A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] parts = line.Split(new char[] { ' ' });\n\n int n = int.Parse(parts[0]);\n int k = int.Parse(parts[1]);\n\n int count = 0;\n\n while (n >=1)\n {\n int temp0 = previousPrime(n);\n int temp1 = temp0;\n\n while (temp1 >= 1)\n {\n int temp2 = previousPrime(temp1);\n int temp3 = previousPrime(temp2);\n\n if (temp2 + temp3 + 1 == temp0)\n {\n count++;\n break;\n }\n temp1 = temp2;\n \n }\n\n \n\n n = temp0;\n }\n\n if (count >= k)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n\n\n Console.ReadKey();\n }\n\n\n static bool isPrime(int n)\n {\n if (n <= 2)\n {\n return true;\n }\n else\n {\n int i = 2;\n\n while (i < n)\n {\n if (n % i == 0)\n return false;\n i++;\n }\n return true;\n }\n \n }\n\n static int previousPrime(int p)\n {\n int temp = p - 1;\n while (true)\n {\n if (isPrime(temp))\n return temp;\n\n temp--;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ed26c971f163d537953b2bbe1ea085a0", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Drawing;\nusing System.Linq;\n\nnamespace Graph\n{\n class Program\n {\n static void Main(string[] args)\n {\n PolandBallandHypothesis();\n\n }\n\n\n public static void PolandBallandHypothesis()\n {\n var n = Convert.ToInt32(Console.ReadLine());\n for (int i = 1; i < 1000; i++)\n {\n if (i != n)\n if (!IsPrime(n * i + 1))\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n\n public static bool IsPrime(long n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n return false;\n }\n\n return true;\n }\n } \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0763767f2d6c216724af6823e260732b", "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Drawing;\nusing System.Linq;\n\nnamespace Graph\n{\n static void Main(string[] args)\n {\n PolandBallandHypothesis();\n\n }\n}\n\n public static void PolandBallandHypothesis()\n {\n var n = Convert.ToInt32(Console.ReadLine());\n for (int i = 1; i < 1000; i++)\n {\n if (i != n)\n if (!IsPrime(n * i + 1))\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n\n public static bool IsPrime(long n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n return false;\n }\n\n return true;\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "afd44b72ca440861c435f24f46218c30", "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97", "difficulty": 800.0} {"lang": "MS C#", "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 = Console.ReadLine();\n int m=1;\n int result=0;\n int num=0;\n Listtemp=new List();\n while(result==0){\n num=a*m+1;\n for(int i=1;i<=num;i++){\n if(num%i==0){\n temp.Add(i);\n }\n }\n if(temp.Count()>2){\n result=m;\n }else{\n m++;\n }\n }\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6d693e417996f01f96731e43a0b5426d", "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97", "difficulty": 800.0} {"lang": "MS C#", "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 n = Int32.Parse(Console.ReadLine());\n\t\t\tint ret = 1;\n\t\t\tif (n % 2 == 1) {\n\t\t\t\tif (n == 1) ret = 3;\n\t\t\t\telse ret = 1;\n\t\t\t}\n\t\t\telse if ((n + 1) % 3 == 0) ret = 1;\n\t\t\telse if ((n + 2) % 3 == 0) ret = 2;\n\t\t\telse if (n % 3 == 0) {\n\t\t\t\tfor (int i = 0; i < 1001; i++) {\n\t\t\t\t\tfor (int j = 0; j < 1000001; j++) {\n\t\t\t\t\t\tif (n*i + 1 % j == 0) {\n\t\t\t\t\t\t\tret = i;\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\t\n\t\t\tConsole.WriteLine(ret);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "533ee684ceb197051ca3a2726f4dada1", "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97", "difficulty": 800.0} {"lang": "MS C#", "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 n = Console.ReadLine();\n\t\t\tvar ret = 1;\n\t\t\tif (n % 2 == 1) {\n\t\t\t\tif (n == 1) ret = 3;\n\t\t\t\telse ret = 1;\n\t\t\t}\n\t\t\telse if ((n + 1) % 3 == 0) ret = 1;\n\t\t\telse if ((n + 2) % 3 == 0) ret = 2;\n\t\t\telse if (n % 3 == 0) {\n\t\t\t\tfor (int i = 0; i < 1001; i++) {\n\t\t\t\t\tfor (int j = 0; j < 1000001; j++) {\n\t\t\t\t\t\tif (n*i + 1 % j == 0) {\n\t\t\t\t\t\t\tret = i;\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\t\n\t\t\tConsole.WriteLine(ret);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b1952eed7c66f77af2bb195313bd306f", "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Taz\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 static int N;\n\n static void Main(string[] args)\n {\n N = scan32();\n\n if (N == 1) {\n Console.WriteLine(3);\n }\n else if (N == 2)\n {\n Console.WriteLine(4);\n }\n else {\n for (int i = 1; i <= N; i++)\n {\n if (!isPrime(N * i + 1)) {\n Console.WriteLine(i); break;\n }\n }\n }\n\n }\n\n public static bool isPrime(int number) {\n for (int i = 2; i <= Math.Sqrt(number); i++)\n {\n if (number % i == 0) {\n return false;\n }\n }\n return true;\n }\n\n public static int find_set(int v)\n {\n if (par[v] == v)\n {\n return v;\n }\n else\n {\n return par[v] = find_set(par[v]);\n }\n }\n\n private static int scan32()\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 private static long scan64()\n {\n long 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 }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9dadad56cfd914168326b6a2ce3251b9", "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Taz\n{\n class Program\n {\n static int N;\n\n static void Main(string[] args)\n {\n N = int.Parse(Console.ReadLine());\n\n if (N == 1) {\n Console.WriteLine(3);\n }\n else if (N == 2)\n {\n Console.WriteLine(4);\n }\n else {\n for (int i = 1; i <= N; i++)\n {\n if (!isPrime(N * i + 1)) {\n Console.WriteLine(i); break;\n }\n }\n }\n\n }\n\n public static bool isPrime(int number) {\n for (int i = 2; i <= Math.Sqrt(number); i++)\n {\n if (number % i == 0) {\n return false;\n }\n }\n return true;\n }\n\n public static int find_set(int v)\n {\n if (par[v] == v)\n {\n return v;\n }\n else\n {\n return par[v] = find_set(par[v]);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a9009afe4650201b4720a4df39b0688b", "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Drawing;\nusing System.Linq;\n\nnamespace Graph\n{\n static void Main(string[] args)\n {\n PolandBallandHypothesis();\n\n }\n}\n\n public static void PolandBallandHypothesis()\n {\n var n = Convert.ToInt32(Console.ReadLine());\n for (int i = 1; i < 1000; i++)\n {\n if (i != n)\n if (!IsPrime(n * i + 1))\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n\n public static bool IsPrime(long n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n return false;\n }\n\n return true;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fa6571786233be03942050814a51ce1a", "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97", "difficulty": 800.0} {"lang": "MS C#", "source_code": "namespace 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\tConsole.ReadKey();\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2d384fc9d3c187a6bd9d00c583430a42", "src_uid": "8a8013f960814040ac4bf229a0bd5437", "difficulty": 900.0} {"lang": "Mono C#", "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 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0529ea79a937fb56194365bd28016bac", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 10.00\n# Visual Studio 2008\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"04_01_12(1)\", \"04_01_12(1)\\04_01_12(1).csproj\", \"{20BDEE45-CE73-4390-B50C-B5A01EFCE401}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{20BDEE45-CE73-4390-B50C-B5A01EFCE401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{20BDEE45-CE73-4390-B50C-B5A01EFCE401}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{20BDEE45-CE73-4390-B50C-B5A01EFCE401}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{20BDEE45-CE73-4390-B50C-B5A01EFCE401}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b1e83c1f703896ffd85a90541dc4c84d", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\u041e\u0442 NickSerg, \u043a\u043e\u043d\u0442\u0435\u0441\u0442: Codeforces Round #100, \u0437\u0430\u0434\u0430\u0447\u0430: (A) \u041d\u043e\u0432\u043e\u0433\u043e\u0434\u043d\u0438\u0439 \u0441\u0442\u043e\u043b, \u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043f\u0440\u0435\u0442\u0435\u0441\u0442 6, #\n\n using System;\n using System.Collections;\n using System.Collections.Generic;\n using System.Text;\n using System.Linq;\n\n namespace 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 && a > 0)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n }\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7d41f6e872af71b77f67cc72e189001d", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0} {"lang": "Mono C#", "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().Split(), Convert.ToInt32);\n int[] a = new int[n];\n a[0] = 1;\n for (int i = 1; i < n; i++)\n a[i] = a[i - 1] + 4*i;\n Console.WriteLine(a[n-1]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9c33d915086461917e6c899883267170", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using system;\n\npublic static void main()\n{\n int count, zeroCount;\n string binaryNumber;\n \n count = int.Parse(Console.ReadLine());\n binaryNumber = Console.ReadLine();\n \n for(int i = 0;i item == '0');\n if (!s.Contains(\"1\")) Console.WriteLine(s);\n else {\n \n \n\n Console.Write(\"1\");\n for (int i = 0; i < numZero; i++) Console.Write(\"0\");\n\n }\n \n \n\n\n\n }\n }\n}\n\n \n \n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fd4acad270467a102faf6cc074a7cff8", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "n = input()\ncharacter = input()\nprint(character[0] + '0' * character[1:].count('0'))\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c4e0f260c049446ee0f78d7f987744af", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Reflection.Metadata;\nusing System.Text.RegularExpressions;\n\nnamespace Example\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var number = Console.ReadLine();\n var nullsAmount = number.Count(d => d.Equals('0'));\n Console.WriteLine(number == \"0\" ? \"0\" :\"1\" + new string('0', nullsAmount));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "82172d008f0e011fd6840be1b1f673b4", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "input()\ncharacters = input()\nzeroCounts = '0' * characters[1:].count('0')\nif not zeroCounts.__contains__('0'):\n print(characters)\nelse:\n print(characters[0] + '0' * characters[1:].count('0'))", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e98f95a650d01babe699248419d19e06", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "Mono C#", "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 private static int m = (int)1e9+7;\n\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n var c = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).OrderBy(x => x).ToArray();\n \n int r = 0;\n\n var p = new List{1};\n int t = 1;\n long s;\n\n for (int i = 1; i < c.Length; i++)\n { \n for (int j = 0; j + i < c.Length; j++)\n {\n s = (c[j + i] - c[j]) * t;\n if (s >= m)\n s -= m;\n\n r += s;\n if (r >= m)\n r -= m;\n }\n\n t <<= 1;\n if (t >= m)\n t -= m;\n }\n\n Console.WriteLine(r);\n }\n\n private static List Pascal(List r)\n {\n int s;\n\n var t = new List{1};\n for (int j = 0; j < r.Count - 1; j++)\n {\n s = r[j] + r[j + 1];\n if (s >= m)\n s -= m;\n\n t.Add(s);\n }\n \n\n t.Add(1);\n return t;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8c56fd9b167a2a5176498852aa47ab2f", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace test {\n class Class1 {\n static int change(char c) {\n if (c <= 'a')\n return c - 'A' + 'a';\n return c - 'a' + 'A';\n }\n\n public static void Main() {\n int\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 Console.Write( s[0] < 'a' ? (char)(s[0] + 32) : (char)(s[0] - 32));\n for (int i = 1; i < s.Length; i++) {\n Console.Write((char)(c + 32));\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7e8e71ce188dae44d7558d72e151ffdb", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "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 if (str.Equals(str.ToUpper()))\n str = str.ToLower();\n else if (str.Substring(1).ToUpper().Equals(str.Substring(1)))\n str = str[0].ToString().ToUpper() + str.Substring(1).ToLower();\n Console.WriteLine(str);\n // Console.ReadKey();\n\n\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f51fa043a85e82d99e66cdc6de4d2c8a", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nchar change(char c) {\n\tif (c >= 'A' && c <= 'Z')\n\t\treturn c - 'A' + 'a';\n\tif (c >= 'a' && c <= 'z')\n\t\treturn c - 'a' + 'A';\n\treturn c;\n}\n\nint main() {\n\tstring s;\n\tcin >> s;\n\tbool flag = true;\n\tfor (int i = 1; flag && i < s.length(); i++) {\n\t\tflag = s[i] < 'a';\n\t}\n\tif (!flag)\n\t\tcout << s;\n\telse\n\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\tprintf(\"%c\", change(s[i]));\n\t\t}\n\treturn 0;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "08a1841f0e7f003eef1cc3473c11ba68", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "MS C#", "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 char[] str = Console.ReadLine().ToCharArray();\n if (str[0] >= 'a' && str[0] <= 'z')\n {\n str[0] = char.ToUpper(str[0]);\n }\n for (int i = 1; i < str.Length; i++)\n {\n if (str[i] >= 'A' && str[i] <= 'Z')\n {\n str[i] = char.ToLower(str[i]);\n }\n }\n for (int i =0; i < str.Length; i++)\n {\n Console.Write(str[i]);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bb304a96d610cbeae0447084e46c1351", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": " static char toUpper(char c)\n {\n if (c >= 'a' && c <= 'z')\n return (char)(c - 32);\n return c;\n }\n \n static char toLower(char c)\n {\n if (c >= 'A' && c <= 'Z')\n return (char)(c + 32);\n return c;\n }\n \n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n \n Console.Write(toUpper(str[0]));\n \n for (int i = 1; i < str.Length; i++)\n {\n Console.Write(toLower(str[i]));\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7b516484955105643e123e46de30e76b", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "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 Console.WriteLine(\"before for\");\n for (int i = 1; i < array.Length; i++)\n {\n /* input the small letter */\n char c = array[i];\n Console.WriteLine(c);\n if (c >= 'a' && c <= 'z')\n {\n capslock = false;\n }\n }\n Console.WriteLine(\"before if\");\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fdfb85a6b16122f8adb90eaaa4a39dc9", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace test {\n class Class1 {\n\n public static void Main() {\n int\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 Console.Write( s[0] < 'a' ? (char)(s[0] + 32) : (char)(s[0] - 32));\n for (int i = 1; i < s.Length; i++) {\n Console.Write((char)(s[i] + 32));\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "79fe1150353e5aab32e9976950020007", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "MS C#", "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 #region 131A cAPS lOCK\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string result;\n bool a = false, b = true;\n\n if (str.Length == 1)\n {\n if (Char.IsLower(str[0]))\n result = Char.ToUpper(str[0]).ToString();\n else result = str;\n }\n else if (str.Length == 0)\n Console.WriteLine(\"\");\n else\n {\n if (Char.IsUpper(str[0]))\n a = true;\n for (int i = 1; i < str.Length; i++)\n {\n if (Char.IsLower(str[i]))\n b = false;\n }\n\n if (a && b)\n {\n result = str[0].ToString();\n str = str.ToLower().Remove(0, 1);\n result += str;\n }\n else if (!a && b)\n {\n result = char.ToUpper(str[0]).ToString();\n str = str.ToLower().Remove(0, 1);\n result += str;\n }\n else if (!a && !b)\n {\n result = char.ToUpper(str[0]).ToString();\n str = str.Remove(0, 1);\n result += str;\n }\n else\n result = str;\n }\n Console.WriteLine(result);\n }\n #endregion\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e57617bc4d8740752c3974abec0d5a5a", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "MS C#", "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 string s = Console.ReadLine();\n if (Rule1(s))\n Console.WriteLine(s.ToLower());\n else if (Rule2(s))\n Console.WriteLine(char.ToUpper(s[0])+s.Substring(1).ToLower());\n else\n Console.WriteLine({s});\n }\n public static bool Rule1(string word)\n {\n return word.All(c => char.IsUpper(c));\n }\n public static bool Rule2(string word)\n {\n return Rule1(word.Substring(1)) && char.IsLower(word[0]);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6bb7003607199adb6286919a583b2300", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a8fa2c23d8399528ceb78534294cd2fe", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "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 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b4e4aacb36ad093906d47161d614806c", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "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.IsUpper(letter))\n mayus = false;\n }\n\n Console.WriteLine(mayus ? (char.ToUpper(input[0]) + input.Substring(1)) : input;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "32280c0e23f18321d17fd898094dc8be", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\npublic class Program\n{\n public static bool isCapsLock(string s)\n {\n if (!Char.IsLower(s[0])) return false;\n \n for (int i = 1; i < s.Length; i++)\n {\n if (!Char.IsUpper(s[i])) return false;\n }\n \n return true;\n }\n \n public static string fix(string s)\n {\n string ss = Char.ToUpper(s[0]);\n for (int i = 1; i < s.Length; i++) ss += Char.ToLower(s[i]);\n return ss;\n }\n\n public static void Main()\n {\n string word = Console.ReadLine();\n if (isCapsLock(word)) Console.WriteLine(fix(word));\n else Console.WriteLine(word);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7f856d80cffb87342efa9c00c92d707c", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aa9a6aad30a70e92ce040ef2da495cd0", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AIET_Training_CapsLock\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n int count = 0;\n\n for (int i = 1; i < s.Length; i++) \n if (s[i].ToString().ToLower() == s[i].ToString())\n count++;\n\n if ((count == 0 && s[0].ToString().ToLower() == s[0].ToString()) ||\n (count == s.Length - 1 && s[0].ToString().ToUpper() == s[0].ToString()))\n s = s[0].ToString().ToUpper() + s.Substring(1).ToLower();\n else if (count == 0 && s[0].ToString().ToUpper() == s[0].ToString() || s.Length == 1)\n s = s.ToLower();\n\n Console.Write(s);\n Console.Read();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "75f9d7e40bd6afb84265d4fcf81d469d", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "MS C#", "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 int i = 1;\n if(c.Length==1)\n {\n i--;\n }\n for (; i < c.Length; i++)\n {\n if (c[i].CompareTo('a') < 0)\n {\n continue;\n }\n else\n {\n\n v = false;\n }\n }\n if (v == true)\n {\n\n for (int i = 0; i < c.Length; i++)\n {\n if (c[i].CompareTo('a') < 0)\n {\n char a = char.ToLower(c[i]);\n c[i] = a;\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 c.ToString();\n Console.WriteLine(c);\n }\n else\n {\n c.ToString();\n Console.WriteLine(c);\n }\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e23045f7ba6c567224f907bc39d5ea6a", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using system;\nusing system.Text;\nusing System.Linq;\n\nnamespace test\n{\n class program\n {\n static void Main(string [] args)\n {\n string text = Console.ReadLine();\n if(text.Length >=1 && text.Length <=100)\n {\n char firstchar = char.ToUpper(text[0]);\n string substr = text.Substring(1, text.Length-1).ToLower();\n string res= firstchar + substr;\n Console.WriteLine(res);\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c73644ffadf0f9a907ad95e88a78d8e8", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "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\tinput[0] = input[0].ToUpper();\n\t\t\n\t\tConsole.WriteLine(input)\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ac6cb63d4725a79426a532062d6ac3f5", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "namespace Practicing_Solving_Problems\n{\n class Program\n {\n static void Main(string[] args)\n {\n string text = Console.ReadLine();\n if(text.Length >=1 && text.Length <=100)\n {\n char firstchar = char.ToUpper(text[0]);\n string substr = text.Substring(1, text.Length-1).ToLower();\n string res= firstchar + substr;\n Console.WriteLine(res);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f31f279ad00e01a4f8e94b10f6c69c91", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class A {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (char.IsLower(s[0]) && s.Substring(1).All(ch => char.IsUpper(ch)))\n s = s.Substring(0, 1).ToUpper() + s.Substring(1).ToLower();\n Console.WriteLine(s);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "94e155f1de7a21508458cafd4ddf915f", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.421\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp1\", \"ConsoleApp1\\ConsoleApp1.csproj\", \"{606D1DDC-7A70-4824-9C48-BFB3D086A751}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{606D1DDC-7A70-4824-9C48-BFB3D086A751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{606D1DDC-7A70-4824-9C48-BFB3D086A751}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{606D1DDC-7A70-4824-9C48-BFB3D086A751}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{606D1DDC-7A70-4824-9C48-BFB3D086A751}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {E4C108B5-AECD-4E34-81A3-AAB169AA4F9A}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "92533079028ede61b04e5fe6865da94e", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "MS C#", "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 bool isPrime(int number)\n {\n if (number < 2) return false;\n for (int i = 2; i <= Math.Sqrt(number); i++)\n {\n if (number % i == 0) return false;\n }\n return true;\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] s1 = s.Split(' ');\n int a = int.Parse(s1[0]);\n int m = int.Parse(s1[1]);\n int[] b = new int[100000];\n int j=1;\n bool c = false;\n for (int i = 2; i <= 100000; i++)\n if (isPrime(i))\n {\n b[j] = i;\n j++;\n }\n for (int i = 1; i<=j; i++)\n if (m == b[i])&&\n {\n Console.WriteLine(\"No\");\n c = true;\n break; \n }\n if (!c) Console.WriteLine(\"Yes\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6790cad3189f46ed3dc6bf36baa5f36d", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = Int32.Parse(Console.ReadLine());\n\n int n = Int32.Parse(Console.ReadLine());\n\n Console.WriteLine(n*m/2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2271939abf99d2d416ca5b90d5f37f15", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Exercise11\n{\n\n\n static void Main()\n {\n int n = 0, m = 0, area = 0;\n string[] input = null;\n\n\n input = Console.ReadLine().Split(\" \");\n\n n = Convert.ToInt32(input[0]);\n m = Convert.ToInt32(input[1]);\n\n\n area = n * m;\n\n Console.WriteLine($\"{n} : {m} = {area}\");\n area = area % 2;\n\n if (area == 1)\n {\n\n double res = (n * m) / 2;\n\n Console.WriteLine(Math.Round(res));\n }\n else {\n Console.WriteLine((n * m / 2));\n }\n \n\n\n\n\n\n\n\n\n Console.ReadKey();\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "336ba9c9e9a2b4a23ffd9fed9b7fba32", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int m =int.Parse (Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int k = n * m; \n if(k % 2 == 0)\n {\n Console.WriteLine(k / 2);\n }else{\n int v = k % 2\n k = k - v \n Console.WriteLine(k / 2);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ce45391a22b48787d280c67440929da1", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint m,n;\n\t\t\n\t\tstring input1 = Console.ReadLine();\n\t\tchar[] whitespace = new char[] { ' ', '\\t' };\t\t\n\t\tstring[] numbers = input1.Split(whitespace);\n\t\t\t\n\t\t\tstring first = numbers[0];\n\t\t string second = numbers[1];\n\t\t\n\t\t Int32.TryParse(first, out m);\n\t\t Int32.TryParse(second, out n);\n\t\t\n\t\tint x = (m*n)/2;\n\t\tConsole.WriteLine(x);\n\t\t", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c4f7237c852ba63dcb30da2a3e831ef7", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "#include\nusing namespace std;\n\nint dominoSize(int x, int y){\n return (x*y)/2;\n}\n\nint main(){\n int a;\n int b;\n cin>>a;\n cin>>b;\n cout<(new string[] { \"1 0 1\", \"1 1 0\", \"1 1 1\", \"0 1 1\" });\n var count = input.Count(s => winningCombos.Contains(s.Trim()));\n WriteLines(new string[] { count.ToString() });\n }\n\n protected static TextReader reader;\n protected static TextWriter writer;\n// public 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//#endif\n// try\n// {\n// new Team().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 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7cef2be8ebe626b207fc83035660fc2c", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "waight = int(input())\nif waight % 2 == 0 and waight != 2:\n print(\"YES\")\nelse :\n print(\"NO\")", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0c7007d4989eaed03f8d47afc5492eaf", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System; \n\nclass CodeForces \n{\n\n public static void main()\n {\n int m = Int32.Parse(Console.ReadLine());\n int n = Int32.Parse(Console.ReadLine());\n Console.WriteLine(m + \" \" + n);\n }\n\n\n\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4940d8d145f7ec14525cd7b8a85f60bc", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = Int32.Parse(Console.ReadLine());\n\n int n = Int32.Parse(Console.ReadLine());\n\n Console.WriteLine((n*m)/2);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0eccaf4c91336f06399c218455007f36", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n uint height,width;\n string[] input=Console.ReadLine().Split();\n height=uint.Parse(input[0]);\n width=uint.Parse(input[1]);\n if(height%2==0||width%2==0)\n //exactly fillable\n return height*width/2;\n else\n //one square will be left at max\n return (height*width-1)/2;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ec74c30ac58c6e250137dc8ec92c1823", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26730.12\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp1\", \"ConsoleApp1\\ConsoleApp1.csproj\", \"{52D6A1B2-5DAF-4FBD-988D-BD05EB6B78CC}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{52D6A1B2-5DAF-4FBD-988D-BD05EB6B78CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{52D6A1B2-5DAF-4FBD-988D-BD05EB6B78CC}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{52D6A1B2-5DAF-4FBD-988D-BD05EB6B78CC}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{52D6A1B2-5DAF-4FBD-988D-BD05EB6B78CC}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {59449E18-7893-4000-9B74-0AB049739DF1}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "35c11600670d5cec62652eea5d24fa55", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "Console.WriteLine(\"enter M \");\n int m = int.Parse(Console.ReadLine());\n \n Console.WriteLine(\"enter N \");\n int n = int.Parse(Console.ReadLine());\n\n int x = m * n;\n int result = x / 2;\n Console.WriteLine(result);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a25f48c6a45b0e593621e613db23e02e", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\nnamespace program{\n class program{\n static void Main(string[] args){\n int[] NxM = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n \n Console.WriteLine(\"{0}\", (NxM[0] * NxM[1]) / 2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ecd3aea3f1e447afbfcd18e4772a5b69", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\n\nnamespace tern_oper\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] choice = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int area = choice[0] * choice[1];\n Console.WriteLine(area / 2);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "084e54b6fcd186172896d4f6fdd8df42", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System\n\npublico class Program\n{\n public static void Main ()\n {\n var strs = Console.ReadLine().Spilit(' ');\nConsole.WriteLine(int.Parse(strs[0])*int.Parse(strs[1])/2);\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6e13bf8f07ab827dbf5bdd8c5bf6ea1f", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing NUnit.Framework;\n\nnamespace codeforces\n{\n class Problem50A\n {\n static int Main(string[] args)\n {\n var input = Console.ReadLine().Split(new[] { ' ' }).Select(Int16.Parse).ToArray();\n\n var dominos = CountDominos(input[0], input[1]);\n Console.WriteLine(dominos);\n\n return 0;\n }\n\n internal static int CountDominos(int m, int n)\n {\n return m*n/2;\n }\n }\n\n [TestFixture]\n public class Tests50A\n {\n [TestCase(2, 4, 4)]\n [TestCase(3, 3, 4)]\n public void CountTaxisTestCase1(int m, int n, int expected)\n {\n var dominos = Problem50A.CountDominos(m, n);\n Assert.That(dominos, Is.EqualTo(expected));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e82bb22f5f71816ef3b2266119d7db72", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System\n\npublic class Program\n{\n public void Main ()\n {\n var strs = Console.ReadLine().Spilit(' ');\nConsole.WriteLine(int.Parse(strs[0])*int.Parse(strs[1])/2);\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "05fdb07dfaf5070d402e09e8ca67c9f5", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Exercise11\n{\n\n\n static void Main()\n {\n int n = 0, m = 0, area = 0;\n string[] input = null;\n\n\n input = Console.ReadLine().Split(\" \");\n\n n = Convert.ToInt32(input[0]);\n m = Convert.ToInt32(input[1]);\n\n\n area = n * m;\n\n Console.WriteLine($\"{n} : {m} = {area}\");\n area = area % 2;\n\n if (area == 1)\n {\n\n double res = (n * m) / 2;\n\n Console.WriteLine(Math.Round(res));\n }\n else {\n Console.WriteLine((n * m / 2));\n }\n \n\n\n\n\n\n\n\n\n Console.ReadKey();\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8295db15d62e2e0c87a06c933e2280c3", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\nusing System.Net;\n\nnamespace Hey{\n class program{\n static void Main(string[] args){\n int[] NxM = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n \n Console.WriteLine(\"{0}\", (NxM[0] * NxM[1]) / 2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "404328c43e511cee79bf112171ee902d", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Exercise11\n{\n\n\n static void Main()\n {\n int n = 0, m = 0, area = 0;\n string[] input = null;\n\n\n input = Console.ReadLine().Split(\" \");\n\n n = Convert.ToInt32(input[0]);\n m = Convert.ToInt32(input[1]);\n\n // calculate area\n area = n * m;\n\n // check if domino fits into area\n area = area % 2;\n\n if (area == 1)\n {\n\n // if its not enough space for 1 or more dominos round the result down\n double res = (n * m) / 2;\n\n Console.WriteLine(Math.Round(res));\n }\n else {\n Console.WriteLine((n * m / 2));\n }\n \n\n\n\n\n\n\n\n\n Console.ReadKey();\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7d0776e3cb17a9dcbedd37e475f282cd", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nnamespace _50A\n{ \n Class Solution\n{\nstatic void Main()\n{\nstring[] Input = Console.ReadLine().Split(' ');\nint M = Convert.ToInt32(Input[0]);\nint N = Convert.ToInt32(Input[1]);\nConsole.WriteLine(M*N%2);\n}\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f493b81321d41c41cc36e315b68324a4", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\nusing String;\n\nnamespace Hey{\n class program{\n static void Main(string[] args){\n int[] NxM = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n \n Console.WriteLine(\"{0}\", (NxM[0] * NxM[1]) / 2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c1c87d4647931447ca2623182d6ff43c", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections;\nusing System.Linq;\n\nnamespace test\n{\n Class Program\n {\n public static void Main(string[] args)\n {\n \n int[] choice = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int area = choice[0] * choice[1];\n Console.WriteLine(area/2);\n \n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3825178cfe0983758fc86791710eb7c5", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {BD024ED4-66C2-43B3-8788-43D658FF5904}\n Exe\n Properties\n DominoPiling\n DominoPiling\n v4.0\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5e4b29f92a1be1a028ddaf07265f1bf0", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Data;\nusing System.Threading.Tasks;\nusing System.Data.SqlClient;\nusing System.Collections.Immutable;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Console.ReadLine();\n var b = Console.ReadLine();\n int x,y;\n int.TryParse(a, out x) ;\n int.TryParse(b, out y);\n int c = x * y / 2;\n Console.WriteLine(c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0424716af49032ca7fd44a5e6df66c1a", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace JobApplications.Practice\n{\n class DominoPilling\n {\n static void Main(string[] args)\n {\n int m,n;\n string mn = Console.ReadLine();\n string[] inputs = mn.Split(\" \");\n int.TryParse(inputs[0], out m);\n int.TryParse(inputs[1], out n);\n\n Console.WriteLine((m * n) / 2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "38c7f6e0fc37c6f3b29d268f72ed72c0", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace code_forces.Exercises\n{\n class A50\n {\n static void Main3(string[] args)\n {\n string[] split = args;\n var num = Console.ReadLine().Split(' ');\n Dictionary Field = new Dictionary ();\n int SideA = int.Parse(num[0]);\n int SideB = int.Parse(num[1]);\n int a = 1;\n int b = 2;\n\n SideA = (SideA % a == 0) ? SideA / a : SideA % a - 1;\n SideB = (SideB % b == 0) ? SideB / b : SideB % b - 1;\n\n var answer = SideB;\n Console.WriteLine(SideB);\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fa3f15b221f996aa8ecfb346ebf75a63", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System.IO;\n\nclass Program\n{\n int Main()\n {\n var v = Console.ReadLine().Split(' ');\n Console.WriteLine(v[0] * v[1] / 2);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "afad63af666b766d4207ace092bceeb4", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System\n\npublic class Program\n{\n public static void Main ()\n {\n var strs = Console.ReadLine().Spilit(' ');\nConsole.WriteLine(int.Parse(strs[0])*int.Parse(strs[1])/2);\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d77ad0cc0a8654cdf0b47ad81116ba16", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint[] MN = Console.ReadLine().Split().Select(i => int.Parse(i))\n\t\t\t.ToArray();\n\t\tint M = MN[0], N = MN[1];\n\t\tConsole.WriteLine(M * N / 2);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "160a4749cb819d4bec39dd04a4961499", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Task\n{\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 Console.WriteLine(a/b);\n \n \n }\n \n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "508da9504fa77e6dc13210f58f548723", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System\n\npublic static class Program\n{\n public void Main ()\n {\n var strs = Console.ReadLine().Spilit(' ');\nConsole.WriteLine(int.Parse(strs[0])*int.Parse(strs[1])/2);\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "72b603d0b7c14d00ab3956a186a12385", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace Domino_Piling\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] ss = s.Split();\n int m = int.Parse(ss[0]);\n int n = int.Parse(ss[1]);\n int num;\n num = (m * n) / 2;\n Console.WriteLine(num);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5e11266af327cf3d2a262a075bd31df6", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int m, n;\n string[] line = Console.ReadLine().Split(\" \");\n m = Convert.ToInt32(line[0]);\n n = Convert.ToInt32(line[1]);\n \n Console.WriteLine((m * n) / 2);\n \n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a2ac97a5bf76d1b432fc62ec53ad8bdb", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program {\n\tstatic void Main() {\n\n\t\tstring[] ci = Console.ReadLine().Split();\n\n\t\tConsole.WriteLine(int.Parse(ci[0]) * int.Parse(ci_n[1]) / 2);\n\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3126b48927cf417dbd2237c24eb3451f", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\nnamespace Hey{\n class program{\n static void Main(string[] args){\n int[] NxM = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n \n Console.WriteLine(\"{0}\", (NxM[0] * NxM[1]) / 2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6a59e57e7c016691c7c05d75686f2f07", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "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 \tstring MN = Console.ReadLine().Split(' ');\n int M = Int16.Parse(MN[0]);\n int N = Int16.Parse(MN[1]);\n int R = (M * N) / 2;\n Console.WriteLine(R);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "760fd911da19205c014689f1eebf7853", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Task\n{\n static void Main()\n {\n String s=Console.WriteLine().Split();\n int a=int.Parse(s[0]);\n int b=int.Parse(s[1]);\n Console.WriteLine(a/b);\n \n \n }\n \n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "907a4d55f678d7b0239808de5fd9ca6c", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace _50A_Domino_piling\n{\n class Program\n {\n static void Main(string[] args)\n {\n long m, n, x, y;\n var input = Console.ReadLine();\n var mn = input.Split(\" \");\n m = long.Parse(mn[0]);\n n = long.Parse(mn[1]);\n\n x = m * n;\n y = x / 2;\n\n Console.WriteLine(y);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "673a1adc8ecca6c99791ba26e5e8f408", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Numerics;\nclass Program\n{\n static void Main(string[] args)\n {\n string tokens[] = Console.ReadLine().Split(' ');\n Console(BigInteger.Parse(tokens[0]) * BigInteger.Parse(tokens[1]) / 2);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a83374da4624d4773392044f4be1c98d", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Task\n{\n static void Main()\n {\n String[] s=Console.WriteLine().Split();\n int a=int.Parse(s[0]);\n int b=int.Parse(s[1]);\n Console.WriteLine(a*b/2);\n \n \n }\n \n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6e15caf67bb3fc56c84004b6541b0f74", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = Int32.Parse(Console.ReadLine());\n \n int m = Int32.Parse(Console.ReadLine());\n \n Console.WriteLine((n*m)/2);\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "be9c14d5750514e13693b431c337860c", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b7448eb17ea9d247de2bda2d7e40b7ab", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program {\n static void Main() {\n var s = Console.ReadLine();\n while (s.StartsWith(\"WUB\")) s = s.Substring(3);\n while (s.EndsWith(\"WUB\")) s = s.Substring(0, s.Length - 3);\n Console.WriteLine(string.Join(\" \", s.Split(\"WUB\", StringSplitOptions.RemoveEmptyEntries));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fb854c2eeb1a328b3e87ee9ef9d0fff2", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6752e235870c57f26a994c277ec19643", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nnamespace CodingPractice\n{\n class Dubstep\n {\n public static void Main(string[] args)\n {\n string input = Console.ReadLine().Split(\"WUB\").\n Aggregate((x,y) => x.Trim()+ \" \" + y.Trim());\n\n Console.WriteLine(input);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5c4c590ebc91602321573e630db92667", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] arr = input.Replace(\"WUB\", \" \").Trim().Split(' ');\n for (int i = 0; i != arr.Length; i++)\n {\n if (arr[i] != null && arr[i].Length > 0)\n Console.Write(arr[i] + \" \");\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3fe8194a48bd8a1443fa053d8bed404e", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n string[] result = word.Split(new[] { \"WUB\" }, StringSplitOptions.RemoveEmptyEntries);\n\n Console.WriteLine(string.Join(' ', result));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ed522ef871cfbad416f8c8aa3b2b6cb5", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DubstepTest\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] arr = input.Replace(\"WUB\", \" \").Trim().Split(' ');\n for (int i = 0; i != arr.Length; i++)\n {\n if (arr[i] != null && arr[i].Length > 0)\n Console.Write(arr[i] + \" \");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ce045c085c47f539e3e5531bf949a75d", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "MS C#", "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 String w = Console.ReadLine();\n\n while(word.StartsWith(\"WUB\")) w = w.Substring(3);\n while (word.EndsWith(\"WUB\")) w = w.Substring(0, w.Length - 3);\n\n Console.WriteLine(String.Join(\" \", w.Split(new[] { \"WUB\" }, StringSplitOptions.RemoveEmptyEntries)));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f4a1699cd54ca72d2f0b3619a8c90e03", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " StringBuilder input = new StringBuilder(Console.ReadLine()); \n \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.Remove(i, 3);\n input.Insert(i, ' ');\n i = -1;\n } \n } \n Console.WriteLine(input.ToString().Trim());", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9fe7c58f06e7118ef8280c9e2a1a0299", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program {\n static void Main() {\n var s = Console.ReadLine();\n while (s.StartsWith(\"WUB\")) s = s.Substring(3);\n while (s.EndsWith(\"WUB\")) s = s.Substring(0, s.Length - 3);\n Console.WriteLine(string.Join(\" \", s.Split(\"WUB\", StringSplitOptions.RemoveEmptyEntries)));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1bb96541a6a3f56d74c721c439f6e80a", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " string input = Console.ReadLine();\n input = input.Replace(\"wub\", \" \");\n string trim = input.Trim();\n Console.WriteLine(trim);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0cc903536eaceda4e69b2ad8c9c5f936", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n string[] result = word.Split(\"WUB\", StringSplitOptions.RemoveEmptyEntries);\n\n Console.WriteLine(string.Join(' ', result));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3dcf8949c1eee798b51137a75898fd94", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " string input = Console.ReadLine();\n input = input.Replace(\"wub\", \"\");\n Console.WriteLine(input);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "21a769f7323b0d52460dd734c99ec814", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "MS C#", "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 while (song[i] == dub[0] && song[i + 1] == dub[1] && song[i + 2] == dub[2]) i += 3;\n while (i foo = new HashSet(year);\n if(foo.Count == 4)\n {\n Console.WriteLine(i);\n }\n }\n\n }\n \n \n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0386b7b965177e0d8ecf7ece5cd309e7", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace year\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nint c_year;\nstring n_year;\n m = int.parse(Console.ReadLine());\n \n\n c_year++;\n while (true)\n {\n n_year =Convert.ToInt32(c_year);\n if (n_year[1] != n_year[0] && n_year[0] != n_year[2] && n_year[3] != n_year[0] && n_year[1] != n_year[2] && n_year[1] != n_year[3] && n_year[2] != n_year[3])\n {\n Console.WriteLine( n_year); \n }\n\t\n \t\t c_year++;\n\t}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1fe8f7abc8bc042a1285bd66115439f5", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace year\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n\nint c_year;\nstring n_year;\n m =Convert.ToInt32(Console.ReadLine());\n \n\n c_year++;\n while (true)\n {\n n_year =Convert.ToInt32(c_year);\n if (n_year[1] != n_year[0] && n_year[0] != n_year[2] && n_year[3] != n_year[0] && n_year[1] != n_year[2] && n_year[1] != n_year[3] && n_year[2] != n_year[3])\n {\n Console.WriteLine( n_year); \n }\n\t\n \t\t c_year++;\n\t}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7103b36c9abc9b5accf0820c0b368bc5", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace year\n{\n class Program\n {\n static void Main(string[] args)\n {\n\nint[] year=new int[4];\nfor(int i=0;i int.Parse(c)).Distinct().Count();\n\n if (count == 4)\n {\n result = y;\n break;\n }\n }\n\n Console.WriteLine(result);\n Console.ReadLine()\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f2d3f40ce68c2bbba48dae89bd7985de", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nstatic int Main()\n{\n int n;\n int @out;\n int @in;\n int a = 0;\n int max = 0;\n n = int.Parse(Console.ReadLine());\n for (int i = 0; i < n; i++)\n {\n @out = int.Parse(Console.ReadLine());\n @in = int.Parse(Console.ReadLine());\n a -= @out;\n a += @in;\n if (a > max)\n {\n max = a;\n }\n }\n Console.Write(max);\n return 0;\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b5334b8471d22a18ef521a7fd53fabff", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {63499551-EA5E-492C-B76A-CE76E18768FE}\n Exe\n Properties\n krasivuigod\n krasivuigod\n v4.0\n Client\n 512\n \n \n x86\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n x86\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fb73236a94f7d28cadff619b248be58e", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "int y = int.Parse(Console.ReadLine());\n for (int i = y + 1;; i++)\n {\n string s = i.ToString();\n bool[] flag = new bool[10];\n for (int j = 0; j < s.Length; j++)\n {\n int digit = int.Parse(s[j].ToString());\n flag[digit] = true;\n }\n int count = 0;\n for (int j = 0; j < 10; j++)\n if (flag[j])\n count++;\n if (count == 4)\n {\n Console.WriteLine(i.ToString());\n break;\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6296b8dfe9deebbe40ba86beeb0ab1ff", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace DominoPiling\n{\n public class BeautifulYear\n {\n public static void Main(string[] args)\n {\n int year = int.Parse(Console.ReadLine());\n int result = 0;\n\n foreach(var y in Enumerable.Range(year,9000-year+1))\n {\n var count = y.ToString().Select(c => int.Parse(c)).Distinct().Count();\n\n if (count == 4)\n {\n result = y;\n break;\n }\n }\n\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5846adf2cd6b0eba85b5851a8e1a6b70", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Exercise11\n{\nstatic void Main()\n{\nint y = Convert.ToInt32(Console.ReadLine());\nint a, b, c, d;\nwhile (true)\n{\ny = y + 1;\na = y / 1000;\nb = y / 100 % 10;\nc = y / 10 % 10;\nd = y % 10;\nif (a != b && a != c && a != d && b != c && b != d && c != d)\n{\nbreak;\n}\n}\nConsole.WriteLine(y);\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "937e769b483ed94aab01dfa233e6e1b6", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace year\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n\nint[] year=new int[4];\nfor(int i=0;i 1)\n {\n for (int i = 0; i < x.Length;)\n {\n char c = x[i];\n char s = x[i + 1];\n\n if (c != 'n' || c != 'a' || c != 'e' || c != 'o' || c != 'u' || c != 'i')\n {\n if (s != 'a' || s != 'e' || s != 'o' || s != 'u' || s != 'i')\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n i += 2;\n }\n }\n else if (c == 'n')\n {\n char y = x[i + 2];\n if (s != 'n' || s != 'a' || s != 'e' || s != 'o' || s != 'u' || s != 'i')\n {\n if (y != 'n' || y != 'a' || y != 'e' || y != 'o' || y != 'u' || y != 'i')\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n i += 3;\n }\n }\n else\n {\n i += 2;\n }\n }\n }\n Console.WriteLine(\"YES\");\n return;\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6ed2fc096a1b9b81aa4cfe7799c053c6", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] x = Console.ReadLine().ToArray();\n int size = x.Length;\n\n if (size <= 100 && size => 1)\n {\n for (int i = 0; i < x.Length-1;)\n {\n char c = x[i];\n char s = x[i + 1];\n\n if (c != 'n' && c != 'a' && c != 'e' && c != 'o' && c != 'u' && c != 'i')\n {\n if (s != 'a' && s != 'e' && s != 'o' && s != 'u' && s != 'i')\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n i += 2;\n }\n }\n else if (c == 'n')\n {\n char y = x[i + 2];\n if (s != 'n' && s != 'a' && s != 'e' && s != 'o' && s != 'u' && s != 'i')\n {\n if (y != 'n' && y != 'a' && y != 'e' && y != 'o' && y != 'u' && y != 'i')\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n i += 3;\n }\n }\n else\n {\n i += 3;\n }\n }\n else\n {\n\n i += 2;\n }\n }\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ff5956755293d7fb3d9d6cd8faa78706", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nclass some\n{\n\tpublic static void Main()\n\t{\n\t\tstring s=Console.ReadLine();\n\t\tchar[]vowels=\"aeiou\".ToCharArray();\n\t\tbool flag=false;\n\t\tfor(int i=0;i=0)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\telse flag=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tflag=true;\n\t\t\t}\n\t\t}\n\t\tif(flag)Console.WriteLine(\"NO\");\n\t\telse Console.WriteLine(\"YES\");\n\t}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "75ff62139ed30d67e55c315dcef63e05", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n String s;\n bool flag = false;\n s = Console.ReadLine();\n var set = new HashSet();\n set.Add('a');\n set.Add('e');\n set.Add('i');\n set.Add('o');\n set.Add('u');\n\t if((s.length==1) && (!set.Contains(s[0])))\n\t\tflag=true;\n \n for (int i=0;i 1)\n {\n for (int i = 0; i < x.Length;)\n {\n char c = x[i];\n char s = x[i + 1];\n\n if (c != 'n' || c != 'a' || c != 'e' || c != 'o' || c != 'u' || c != 'i' )\n {\n if (s != 'a' || s != 'e' || s != 'o' || s != 'u' || s != 'i' )\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n i += 2;\n }\n }\n else if (c == 'n')\n {\n char y = x[i + 2];\n if (s != 'n' || s != 'a' || s != 'e' || s != 'o' || s != 'u' || s != 'i')\n {\n if (y != 'n' || y != 'a' || y != 'e' || y != 'o' || y != 'u' || y != 'i')\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n i += 3;\n }\n }\n else\n {\n i += 2;\n }\n }\n }\n Console.WriteLine(\"YES\");\n return;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "065781d99a8f6280c325252d72f56e7e", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n String s;\n bool flag = false;\n s = Console.ReadLine();\n var set = new HashSet();\n set.Add('a');\n set.Add('e');\n set.Add('i');\n set.Add('o');\n set.Add('u');\n\t if(s.length==1 && (!set.Contains(s[0]))\n\t\tflag=true;\n \n for (int i=0;i y * 2)) { Console.Write(0); }\n else\n {\n for(int n=0;n= x) && (r <= y) && (p <= y) && (p >= x))\n {\n Console.Write(n+1); goto m1;\n }\n }\n Console.Write(0);\n }\n m1:\n\n\n\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d4fd01fe9d931a50d509a6510a6c8fd0", "src_uid": "e595a1d0c0e4bbcc99454d3148b4557b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n int[] input = ReadArray();\n if(input.Length == 2)\n {\n int a = input[0];\n int b = input[1];\n int count = 0;\n do\n {\n int delta = a - b;\n a = b;\n b = delta;\n count++;\n }\n while(delta > 0)\n Console.WriteLine(count);\n }\n }\n \n private static int[] ReadIntArray()\n {\n string line;\n while(Console.ReadKey().Key == ConsoleKey.Enter)\n {\n line = Console.ReadLine();\n }\n if(line != null)\n {\n string[] sArray = line.Split(' ');\n int n = stringArray.Length;\n int[] intArray = new int[n];\n for(int i = 0; i < n; i++)\n {\n string s = stringArray[i].Trim();\n intArray[i] = int.Parse(s);\n }\n return intArray;\n }\n return null;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c14ed723558e0d8c94f5dfbb273bb554", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing TopCoder;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string input = Console.ReadLine();\n string[] tokens = input.Split(' ');\n \n Int64 a = long.Parse(tokens[0]);\n Int64 b = long.Parse(tokens[1]);\n\n Console.WriteLine(Solve(a, b));\n\n }\n\n public static Int64 Solve(Int64 a, Int64 b)\n {\n\n\n Int64 cnt = 0;\n\n\n while (a != b && a > 0 && b > 0)\n {\n if (a < b)\n {\n cnt += b / a;\n b = b - b / a;\n\n }\n\n else\n {\n cnt += a / b;\n\n a = a - a / b;\n }\n }\n\n return cnt;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b074f2b42ff2f276d0b9228b0d2ed007", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp8\n{\n class Program\n {\n static void Main(string[] args)\n {\n var max = 1;\n var num = Console.ReadLine().Select(x=>(int)char.GetNumericValue(x)).ToArray();\n for (int i = 0; i < num.Length; i++)\n {\n max = max * num[i];\n }\n \n \n \n for (int i = 0; i < num.Length; i++)\n {\n if (num[i]==0)\n {\n num[i - 1] = num[i - 1] - 1;\n for (int j = i; j c)\n {\n max = max;\n }\n else max = c;\n }\n }\n\n var ep = num.Reverse().ToArray();\n for (int i = 0; i < num.Length; i++)\n {\n if (i==num.Length-1)\n {\n break;\n }\n var c = 1;\n ep[i] = 9;\n \n ep[i + 1] = ep[i + 1] - 1;\n \n \n for (int j = 0; j < num.Length; j++)\n {\n if (ep[j]==0)\n {\n ep[j] = 1;\n }\n c = c * ep[j];\n }\n if (max > c)\n {\n max = max;\n }\n else max = c;\n }\n Console.WriteLine(max);\n Console.ReadLine();\n Console.ReadLint();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "86e76bb5b959c3b6e3b2b9d4d243fcba", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Jzzhu_and_Chocolate\n{\n class Program\n {\n static IO io = new IO();\n static void Main(string[] args)\n {\n long num_H = io.ReadNextLong();\n long num_W = io.ReadNextLong();\n int num_K = io.ReadNextInt();\n if (num_H + num_W - 2 < num_K)\n {\n io.PutStr(-1);\n }\n else\n {\n long num_Max = -1;\n int num_Min = Math.Min(num_H - 1, num_K);\n int num_Count = num_K - num_Min;\n num_Max = Math.Max((num_H/(num_Min+1))*num_W/(num_Count+1),num_Max);\n num_Min= Math.Min((num_W-1),num_K);\n num_Count=num_K-num_Min;\n num_Max=Math.Max(num_H/(num_Count+1)*(num_W/(num_Min+1)),num_Max);\n io.PutStr(num_Max);\n io.ReadNum();\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 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "47ca38d8437df61f3a15c1ac9e0f583b", "src_uid": "bb453bbe60769bcaea6a824c72120f73", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CODE2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n int a = int.Parse(str[0]);\n int b = int.Parse(str[1]);\n int m = int.Parse(str[2]);\n int r0 = int.Parse(str[3]);\n int [] array = new int[m];\n int ri = (a * r0 + b) % m;\n array[ri] = 0;\n int count = 1;\n for (; ;count++ )\n {\n ri = (a * ri + b) % m;\n if (array[ri] == 0)\n {\n array[ri] = count;\n }\n else\n {\n Console.Write(count - array[ri]);\n return;\n }\n }\n }\n }\n}\n\n[close]\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2381353b809bdd53c364089133b4911b", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0} {"lang": "Mono C#", "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()\n {\n\n string mozi = Console.ReadLine();\n char[] ch = mozi.ToCharArray();\n int n = ch.Length;\n if (ch[0] == 'a') ch[0] = 'A';\n if (ch[0] == 'b') ch[0] = 'B'; \n if (ch[0] == 'c') ch[0] = 'C';\n if (ch[0] == 'd') ch[0] = 'D';\n if (ch[0] == 'e') ch[0] = 'E';\n if (ch[0] == 'f') ch[0] = 'F';\n if (ch[0] == 'g') ch[0] = 'G';\n if (ch[0] == 'h') ch[0] = 'H';\n if (ch[0] == 'i') ch[0] = 'I';\n if (ch[0] == 'j') ch[0] = 'J';\n if (ch[0] == 'k') ch[0] = 'K';\n if (ch[0] == 'l') ch[0] = 'L';\n if (ch[0] == 'm') ch[0] = 'M';\n if (ch[0] == 'n') ch[0] = 'N';\n if (ch[0] == 'o') ch[0] = 'O';\n if (ch[0] == 'p') ch[0] = 'P';\n if (ch[0] == 'q') ch[0] = 'Q';\n if (ch[0] == 'r') ch[0] = 'R';\n if (ch[0] == 's') ch[0] = 'S';\n if (ch[0] == 't') ch[0] = 'T';\n if (ch[0] == 'u') ch[0] = 'U';\n if (ch[0] == 'v') ch[0] = 'V';\n if (ch[0] == 'w') ch[0] = 'W';\n if (ch[0] == 'x') ch[0] = 'X';\n if (ch[0] == 'y') ch[0] = 'Y';\n if (ch[0] == 'z') ch[0] = 'Z';\n int i;\n for(i = 0;i < n;i++){\n Console.Write(ch[i]);\n }\n }\n }\n}\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforce\n{\n class Program\n {\n static void Main()\n {\n\n string mozi = Console.ReadLine();\n char[] ch = mozi.ToCharArray();\n int n = ch.Length;\n if (ch[0] == 'a') ch[0] = 'A';\n if (ch[0] == 'b') ch[0] = 'B'; \n if (ch[0] == 'c') ch[0] = 'C';\n if (ch[0] == 'd') ch[0] = 'D';\n if (ch[0] == 'e') ch[0] = 'E';\n if (ch[0] == 'f') ch[0] = 'F';\n if (ch[0] == 'g') ch[0] = 'G';\n if (ch[0] == 'h') ch[0] = 'H';\n if (ch[0] == 'i') ch[0] = 'I';\n if (ch[0] == 'j') ch[0] = 'J';\n if (ch[0] == 'k') ch[0] = 'K';\n if (ch[0] == 'l') ch[0] = 'L';\n if (ch[0] == 'm') ch[0] = 'M';\n if (ch[0] == 'n') ch[0] = 'N';\n if (ch[0] == 'o') ch[0] = 'O';\n if (ch[0] == 'p') ch[0] = 'P';\n if (ch[0] == 'q') ch[0] = 'Q';\n if (ch[0] == 'r') ch[0] = 'R';\n if (ch[0] == 's') ch[0] = 'S';\n if (ch[0] == 't') ch[0] = 'T';\n if (ch[0] == 'u') ch[0] = 'U';\n if (ch[0] == 'v') ch[0] = 'V';\n if (ch[0] == 'w') ch[0] = 'W';\n if (ch[0] == 'x') ch[0] = 'X';\n if (ch[0] == 'y') ch[0] = 'Y';\n if (ch[0] == 'z') ch[0] = 'Z';\n int i;\n for(i = 0;i < n;i++){\n Console.Write(ch[i]);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7f1025b41bda649e674ac9b337c997bf", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n string str = (System.Console.ReadLine()).ToString();\n\n System.Console.WriteLine(str[0].ToUpper()+str.Substring(1));\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7345eeb731a40c4f63586693d6172b79", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Test\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tConsole.WriteLine(input[0].ToString().ToUpper() + input.Remove(0, 1));\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "54afd688de58a04626f143d186eef753", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "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 x[0] = Char.ToUpper(x[0]);\n Console.Write(x);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2ba0e6088c9f6cf7b691e95b01f4f257", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Test {\n\tpublic static void Main() {\n\t\tstring s = Console.ReadLine();\n\t\ts[0].ToUpper();\n\t\tConsole.WriteLine(s);\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4631973a7fc939b008e87e9ba1c3839e", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n Console.WriteLine(Char.ToUpper(word[0]) + word.Substring(1));\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0573b42839d22924766278b57aa4880", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using Microsoft.VisualBasic.CompilerServices;\nusing System;\n\nclass Program\n{\n static void Main()\n {\n string str = Console.ReadLine();\n\n Console.Write(char.ToUpper(str[0]));\n for (int i = 1; i < str.Length; i++)\n Console.Write(str[i]);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4fc7079b06ed9e872a304586ca70b166", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using Microsoft.VisualBasic.CompilerServices;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\n\nnamespace URI_practice\n{\n public class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n Console.WriteLine(UppercaseFirst(line));\n \n }\n\n static string UppercaseFirst(string s)\n {\n\n return char.ToUpper(s[0]) + s.Substring(1);\n }\n }\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "852845d3b6b5d1fd1e62d3f149e56de0", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "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 str = Console.ReadLine();\n \n char ch = (str[0]);\n \n if ((Char.IsLower(ch)) is true)\n {\n string rp = (Convert.ToString(ch)).ToUpper();\n char r = Convert.ToChar(rp);\n \n Console.WriteLine(str.Replace(ch,r));\n\n }\n else\n {\n Console.WriteLine(str);\n }\n \n Console.ReadKey();\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5103c887ba7222d7834e9d13c6667143", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program\n {\n\n public static void Main()\n {\n string txt = Console.ReadLine();\n txt = txt[0].ToString().ToUpper() + txt.Substring(1, txt.Length - 1);\n Console.WriteLine(txt);\n //Console.Read();\n\n }\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0b28ccbe66904437b2eb1d7b82e80298", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n\n public static void upper(string[] uppercase) {\n \n if (uppercase[0].Substring(0, 1) != uppercase[0].Substring(0, 1).ToUpper()) {\n\n Console.WriteLine(uppercase[0].Substring(0, 1).ToUpper() + uppercase[0].Substring(1, Convert.ToInt32(uppercase[0].Length) - 1));\n\n }\n Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n upper(input);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2a0b2dc56b9d83a12cbbf284da39f291", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n\n \n Exe\n netcoreapp3.0\n \u041a\u0430\u043f\u0438\u0442\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f_\u0441\u043b\u043e\u0432\u0430\n \n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cef15deec580f5c7a86fead8a706d3fc", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass HelloWorld \n{\n static void Main() \n {\n string stream = Console.ReadLine();\n char [] qwe = new char [stream.Length];\n \n for (int i = 0; i < stream.Length; ++i)\n {\n qwe[i] = stream[i];\n }\n \n if (stream[0] >= 'a' && stream[0] =< 'z')\n {\n qwe[0] = Char.ToUpper(qwe[0]);\n }\n Console.WriteLine(qwe);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "32425a659f9ecb7e9c140439e3ddeb4a", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\n\n class program_10\n {\n public static void Main()\n {\n string x = ReadLine();\n char f = (x[0] > 'a' && x[0] < 'z') ? (char)(x[0] - 32) : x[0];\n Console.Write(f);\n for (int i = 1; i < x.Length; i++)\n {\n Console.Write(x[i]);\n }\n Console.WriteLine();\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e3a17b563c548adea2f0917d18db8887", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using system;\nclass solution{\n static void Main(string args){\n var st = Console.ReadLine();\n if (st[0] < 'a')\n Console.WriteLine(st);\n else\n {\n var f = st[0].ToString().ToUpper();\n Console.WriteLine(f + st.Substring(1));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "111b3e3a3bccfdd68d9fb4c569fc5132", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "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 if((int)x[0]>=97 && (int)x[0]<=122){\n x[0] = (char)((int)x[0]-32);\n }\n Console.Write(x);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "671cb4c276e20a6dd611629118d7945b", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "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 x[0] = x[0].ToString().ToUpper();\n Console.Write(x);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8acbb8afce4be2b1850b4bfc9c17b75e", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program { \n static void Main() { \n Console.WriteLine(Console.ReadLine().ToUpperCase());\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5ca5771805d32a818905f9fcce56207c", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass program{\n static void Main(){\n var str = Console.ReadLine();\n Console.WriteLine(str[0].ToString().ToUpper() + str.Substring(1,str.Length()-1)); }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "334d578e7b1d59882f86ad871a65eba0", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "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 Console.Write(s[0].ToString().ToUpper() + s.Substring(1, s.Length - 1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "198987c4e541550c5813965352544fcc", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "=using System;\n\nclass P\n{\n public static void Main()\n {\n \n \n var lectura = Console.ReadLine();\n if ((lectura[0] - 0) >= 97 && (lectura[0] - 0) <= 122)\n {\n char pr = (char)(lectura[0] - 32);\n Console.WriteLine(pr.ToString() + lectura.Substring(1));\n }\n\n\n else\n { Console.WriteLine(lectura); }\n \n \n\n\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bba047d17b9ff1b35b056013961343e6", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String s = Console.ReadLine();\n char first = s.ToUpper()[0];\n String final = \"\";\n\n for (int i = 0; i < s.Length; i++)\n {\n if (i == 0)\n {\n final += first;\n }\n else\n {\n final += s[i];\n }\n }\n Console.WriteLine(final);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a956ee00e449103ae71c78710447681d", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n String str = (System.Console.ReadLine()).ToString();\n System.Console.WriteLine(str[0].ToString().ToUpper()+str.Substring(1));\n \n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dd7b111dc83dcdafcce31cbb6d3e1794", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "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 private static TextReader GetFileTextReader()\n {\n return File.OpenText(@\"../../input.txt\");\n }\n\n private static TextWriter GetFileTextWriter()\n {\n return File.CreateText(@\"../../output.txt\");\n }\n\n private static TextReader GetConsoleTextReader()\n {\n return Console.In;\n }\n\n private static TextWriter GetConsoleTextWriter()\n {\n return Console.Out;\n }\n\n static void Main(string[] args)\n {\n TextReader reader = GetConsoleTextReader();\n\n TextWriter writer = GetConsoleTextWriter();\n\n string word = reader.ReadLine();\n\n writer.WriteLine(word[0].ToString().ToUpper() + word.Substring(1, word.Length - 1));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eab32d2d4c2e1c124734b57ffb78afc7", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.40629.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication7\", \"ConsoleApplication7\\ConsoleApplication7.csproj\", \"{ADC31B02-CB74-4C1E-BC2E-65E433B2CD81}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{ADC31B02-CB74-4C1E-BC2E-65E433B2CD81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{ADC31B02-CB74-4C1E-BC2E-65E433B2CD81}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{ADC31B02-CB74-4C1E-BC2E-65E433B2CD81}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{ADC31B02-CB74-4C1E-BC2E-65E433B2CD81}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "438a8867dc3301fc129161d0ee4245b6", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "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 X[0].ToString().ToUpper();\n Console.Write(x);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bf2554173856811ef6d0322c340ab44d", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "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 x[0] = x[0].ToUpper();\n Console.Write(x);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eca4c9918cef9593f36a12bb4c678a77", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Task\n{\n static void Main()\n {\n \n string s=Console.ReadLine();\n Console.WriteLine(s[0].ToUpper())\n \n \n }\n \n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ffeb673f2196a9a881baa41a01f1d82c", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "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 str = Console.ReadLine();\n \n char ch = (str[0]);\n \n if ((Char.IsLower(ch)) is true)\n {\n string rp = (Convert.ToString(ch)).ToUpper();\n char r = Convert.ToChar(rp);\n \n Console.WriteLine(str.Replace(ch,r));\n\n }\n else\n {\n Console.WriteLine(str);\n }\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e5a03481ba7ebaea6412da5d4e5d8f33", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nclass Solution\n{\n static void Main()\n {\n string guest = Console.ReadLine();\n string host = Console.ReadLine();\n char[] pile = Console.ReadLine().ToCharArray();\n char[] final = guest.Concat(host).ToArray();\n\n Array.Sort(final);\n Array.Sort(pile);\n if (pile.SequenceEqual(final)) { Console.WriteLine(\"YES\"); }\n else { Console.WriteLine(\"NO\"); }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f5dd520bb03b90cb88e969e92d2ca0de", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Test {\n static void Main() {\n string tmp = \"\",str = \"\";\n string antmp = \"\";\n string ans = \"NO\";\n int len,n = 0;\n tmp += Console.ReadLine();\n tmp += Console.ReadLine();\n str = Console.ReadLine();\n len = str.Length;\n for(int i=0 ; i= result_arr.Length) break;\n if (result_arr[i] != str3_arr[i]) { Console.Write(\"NO\"); d = -1; break; }\n }\n if (d > 0) { Console.Write(\"YES\"); }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2976bdde8b1d2ce9601874c93f8c5c3e", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar name = new string[2];\n\t\tfor (int i = 0; i < 2; i++)\n\t\t{\n\t\t\tname[i] = Console.ReadLine();\n\t\t}\n\t\tvar door = Console.ReadLine();\n\t\tvar dic = new Dictionary();\n\t\tvar letters = new int[26];\n\t\tfor (int i = 0; i < 26; i++)\n\t\t{\n\t\t\tletters[i] = 0;\n\t\t}\n\t\tforeach (var item in name)\n\t\t{\n\t\t\tfor (int i = 0; i < item.Length; i++)\n\t\t\t{\n\t\t\t\t++letters[item[i] - 'A'];\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < door.Length; i++)\n\t\t{\n\t\t\t--letters[door[i] - 'A'];\n\t\t}\n\t\tConsole.WriteLine(letters.Any(i => i != 0) ? \"NO\" : \"YES\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "138354a40a73e98551687a08cbabcb23", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n \nclass Program\n{\n private static void Main()\n {\n int result = 0;\n \n string n = Console.ReadLine() + Console.ReadLine();\n string p = Console.ReadLine();\n \n var nn = n.ToCharArray();\n var pp = p.ToCharArray();\n \n if (pp.Legnth < nn.Length)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n \n for(int i = 0; i < nn.Length; i++)\n for(int j = 0; j < pp.Length; j++)\n if (nn[i] == pp[j])\n {\n pp[j] = '0';\n break;\n }\n \n for(int i = 0; i < pp.Length; i++)\n if (pp[i] != '0')\n {\n Console.WriteLine(\"NO\");\n return;\n }\n \n Console.WriteLine(\"YES\");\n } \n \n private static int[] ConsoleReadLineAsArrayOfIntegers()\n {\n return Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n }\n \n private static int ConsoleReadLineAsInteger()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n \n private static void ConsoleWriteLine(string line)\n {\n Console.WriteLine(line);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4da1074b0203a73e09e2b84cfa7d3247", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace CF_141A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine();\n s += Console.ReadLine();\n var sRes = Console.ReadLine();\n Console.WriteLine(string.Compare(string.Join(\"\", s.OrderBy(x => x)), string.Join(\"\", sRes.OrderBy(x => x))) == 0 ? \"YES\" : \"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5ce31b16d7e1f6692fd08efb8c4a5b52", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "MS C#", "source_code": "import java.util.*;\n\npublic class JavaTutorial1 {\n\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in); \nStringBuffer a = new StringBuffer(sc.nextLine()); \nStringBuffer b = new StringBuffer(sc.nextLine()); \nStringBuffer c = new StringBuffer(sc.nextLine()); \n for(int i=0; i c).SequenceEquals(s2.OrderBy(c => c)) ?\n \"YES\" : \"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8ccc589029898706eaf846fd22a7eb6c", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar name = new string[2];\n\t\tfor (int i = 0; i < 2; i++)\n\t\t{\n\t\t\tname[i] = Console.ReadLine();\n\t\t}\n\t\tvar door = Console.ReadLine();\n\t\tvar dic = new Dictionary();\n\t\tvar letters = new int[26];\n\t\tfor (int i = 0; i < 26; i++)\n\t\t{\n\t\t\tletters[i] = 0;\n\t\t}\n\t\tforeach (var item in name)\n\t\t{\n\t\t\tfor (int i = 0; i < item.Length; i++)\n\t\t\t{\n\t\t\t\t++letters[item[i] - 'A'];\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < door.Length; i++)\n\t\t{\n\t\t\t--letters[door[i] - 'A'];\n\t\t}\n\t\tConsole.WriteLine(letters.Any(i => i != 0) ? \"NO\" : \"YES\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e7c105c2436e37bf0768ae294a48f706", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace HappyThing\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine()+Console.ReadLine();\n string s2 = Console.ReadLine();\n bool ok = String.Join(\"\", s1.OrderBy(o => o).ToArray()).Equals(String.Join(\"\", s2.OrderBy(o => o).ToArray()), StringComparison.OrdinalIgnoreCase);\n if (ok == true)\n {\n Console.WriteLine(\"YES\");\n }\n else { Console.WriteLine(\"NO\"); }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f2512e3223dcfbc5d0abcf2e94225d65", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\nnamespace AmusingJoke\n{\n class Program\n {\n static void Main(string[] args)\n {\n string name1 = Console.ReadLine();\n string name2 = Console.ReadLine();\n List letters = Console.ReadLine().Select(x => x.ToString()).ToList();\n foreach (char n in name1)\n {\n if (letters.Contains(n.ToString()))\n letters.RemoveAt(letters.IndexOf(n.ToString()));\n }\n foreach (char n in name2)\n {\n if (letters.Contains(n.ToString()))\n letters.RemoveAt(letters.IndexOf(n.ToString()));\n }\n Console.WriteLine(letters.Count == 0 ? \"YES\" : \"NO\");\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0bc1bcd4cfe2d145577218a7b6f20f8", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "Mono C#", "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 x1,x2,x3,y1,y2,y3;\n x1=int.Parse(line[0]);\n x2=int.Parse(line[2]);\n x3=int.Parse(line[4]);\n y1=int.Parse(line[1]);\n y2=int.Parse(line[3]);\n y3=int.Parse(line[5]);\n double a,b,c;\n bool f=false\n ini(x1, x2, x3, y1, y2, y3,out a,out b,out c);\n if (pif(a,b,c)==true){Console.WriteLine(\"RIGHT\");return 0;}\n \n Almost(x1, x2, x3, y1, y2, y3, a, b, c, f,out f);\n if(f==true){return 0;}\n Console.WriteLine( \"NEITHER\");\n //Console.ReadKey();\n return 0;\n }\n\n static void Almost(int x1, int x2, int x3, int y1, int y2, int y3, double a, double b, double c,out bool f)\n {\n ini(x1 + 1, x2, x3, y1, y2, y3, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1 - 1, x2, x3, y1, y2, y3, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1, x2 + 1, x3, y1, y2, y3, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1, x2 - 1, x3, y1, y2, y3, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1, x2, x3 + 1, y1, y2, y3, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1, x2, x3 - 1, y1, y2, y3, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1, x2, x3, y1 + 1, y2, y3, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1, x2, x3, y1 - 1, y2, y3, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1, x2, x3, y1, y2 + 1, y3, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1, x2, x3, y1, y2 - 1, y3, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1, x2, x3, y1, y2, y3 + 1, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n ini(x1, x2, x3, y1, y2, y3 - 1, out a, out b, out c);\n if (pif(a, b, c) == true) {\n Console.WriteLine(\"ALMOST\");f=true;\n return 0;\n }\n return 0;\n }\n\n static void ini(int x1, int x2, int x3, int y1, int y2, int y3,out double a,out double b,out double c)\n {\n a = otr(x1, y1, x2, y2);\n b = otr(x2, y2, x3, y3);\n c = otr(x1, y1, x3, y3);\n }\n public static double otr(int a1,int b1,int a2,int b2){\n return ((a2-a1)*(a2-a1)+(b2-b1)*(b2-b1));\n }\n public static bool pif(double a,double b,double c){\n if(a+b-c==0) {return true;}\n if(a-b+c==0) {return true;}\n if(-a+b+c==0) {return true;}\n return false;}\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b27a9168ca5db8a426be70f0d2bb95f3", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "Mono C#", "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 bool isright(int[] x, int[] y)\n {\n if (x[0] == x[1] && y[0] == y[1]) return false;\n if (x[0] == x[2] && y[0] == y[2]) return false;\n if (x[2] == x[1] && y[2] == y[1]) return false;\n int a, b, c;\n a = (x[0] - x[1]) * (x[0] - x[1]) + (y[0] - y[1]) * (y[0] - y[1]);\n b = (x[2] - x[1]) * (x[2] - x[1]) + (y[2] - y[1]) * (y[2] - y[1]);\n c = (x[0] - x[2]) * (x[0] - x[2]) + (y[0] - y[2]) * (y[0] - y[2]);\n\n return (a + b == c || b + c == a || c + a == b);\n }\n static bool isalmostright(int[] x, int[] y)\n {\n int[] dx = { -1, 1, 0, 0 };\n int[] dy = { 0, 0, -1, 1 };\n for (int i = 0; i < 3; ++i)\n {\n for (int j = 0; j < 4; ++j)\n {\n x[i] += dx[j];\n y[i] += dy[j];\n if (isright(x, y)) return true;\n x[i] -= dx[j];\n y[i] -= dy[j];\n }\n }\n return false;\n }\n public static void Main()\n {\n string[] t = Console.ReadLine().Split();\n int[] x = new int[3];\n int[] y = new int[3];\n for (int i = 0; i < 3; ++i)\n {\n x[i] = int.Parse(t[2 * i]);\n y[i] = int.Parse(t[2 * i + 1]);\n }\n\n if (isright(x, y)) { Console.WriteLine(\"RIGHT\"); return; }\n if (isalmostright(x, y)) { Console.WriteLine(\"ALMOST\"); return; }\n Console.WriteLine(\"NEITHER\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "292779d3baa6a504b8b2df87df18f417", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nstatic class P {\n static int[] ToIntArray(this string val) { return val.Split().Select(int.Parse).ToArray(); }\n static double _exp = 0.0000001;\n static int[] _diff = new int[] { -1, 1 };\n static bool has(int[] arr) {\n int x0 = arr[0], y0 = arr[1], x1 = arr[2], y1 = arr[3], x2 = arr[4], y2 = arr[5];\n double a = (x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1),\n b = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2),\n c = (x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0);\n if (a == 0 || b == 0 || c == 0) return false;\n if (Math.Abs(a + b - c) <= _exp) { return true; }\n if (Math.Abs(a + c - b) <= _exp) { return true; }\n if (Math.Abs(c + b - a) <= _exp) { return true; }\n return false;\n }\n static void Main() {\n var line = Console.ReadLine().ToIntArray();\n if (has(line)) {\n Console.Write(\"RIGHT\"); return;\n } else {\n int i = 0, j;\n for (; i < line.Length; ++i) {\n for (j = 0; j < _diff.Length; ++j) {\n line[i] += _diff[j];\n if (has(line) && ) {\n Console.Write(\"ALMOST\"); return;\n } else { line[i] -= _diff[j]; }\n }\n }\n }\n Console.Write(\"NEITHER\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1dcca71a54ab5ec94482ef9b89e0b5e1", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": " public class Program\n {\n private static void Main(string[] args)\n {\n var input = Console.ReadLine();\n\n var list = new List\n {\n 'h',\n 'e',\n 'l',\n 'l',\n 'o'\n };\n\n for (int i = 0; i < input.Length; i++)\n {\n if (list.Count >= 1 && input[i] == list[0])\n {\n list.RemoveAt(0);\n }\n }\n\n Console.WriteLine(list.Count == 0 ? \"YES\" : \"NO\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f2e1b511dc43c3818e42008e4169c8b8", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "MS C#", "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 byte h, e, l, 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)\n h = 1;\n if (h == 1 && e != 1)\n e = 1;\n if (h == 1 && e == 1 && l!=2)\n l++;\n if (h == 1; e == 1; l == 2; o != 1)\n o = 1;\n }\n if (h + e + l + O == 5)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2b9c18984a98d3a6ebf7b126bc1b5836", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace Test1\n{\n public class Test1\n {\n public static void function()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] p = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n int[] b = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n\n bool good = true;\n\n if (n % 2 != 0) { good = false; goto Result; }\n if (b.Length > 1)\n {\n for (int i = 1; i < b.Length; i++)\n {\n p[b[i] - 1] = 0 - p[b[i] - 1];\n }\n }\n\n if (p[0] < 0) { good = false; goto Result; }\n bool[] used = new bool[p.Length];\n\n for (int i = 1; i < n; i++) // looking for negative numbers or \"closing paranthesis\"\n {\n if (p[i] < 0)\n {\n bool pairFound = false;\n List range = new List();\n List index = new List();\n for (int j = i - 1; j >= 0; j--) // finding a pair\n {\n if (!used[j])\n {\n if (p[i] == 0 - p[j])\n {\n if (range.Count > 0)\n {\n if (range.Count % 2 == 0)\n {\n List pairs = new List();\n List minus = new List();\n for (int k = range.Count - 1; k >= 0; k--)\n {\n if (pairs.Count > 0) { if (pairs.Last() == range[k]) { minus.Add(index[k]); pairs.RemoveAt(pairs.Count - 1); } else { pairs.Add(range[k]); } }\n else { pairs.Add(range[k]); }\n }\n if (pairs.Count == 0)\n {\n pairFound = true;\n used[i] = used[j] = true;\n for (int m = 0; m < index.Count; m++) { used[index[m]] = true; }\n for (int s = 0; s < minus.Count; s++) { p[minus[s]] = 0 - p[minus[s]]; }\n break;\n }\n }\n else { range.Add(p[j]); index.Add(j); }\n }\n else { pairFound = true; used[i] = used[j] = true; break; }\n }\n else { range.Add(p[j]); index.Add(j); }\n }\n }\n if (!pairFound) { good = false; goto Result; }\n }\n }\n\n List remained = new List();\n List indexes = new List();\n for (int i = 0; i < p.Length; i++)\n {\n if (!used[i]) { remained.Add(p[i]); indexes.Add(i); }\n }\n if (remained.Count > 0)\n {\n List pair = new List();\n for (int j = 0; j < remained.Count; j++)\n {\n if (pair.Count > 0) { if (pair.Last() == remained[j]) { p[indexes[j]] = 0 - p[indexes[j]]; pair.RemoveAt(pair.Count - 1); } else pair.Add(remained[j]); }\n else pair.Add(remained[j]);\n }\n }\n\n Result:\n {\n if (good)\n {\n Console.WriteLine(\"YES\");\n foreach (int cc in p) { Console.Write(cc + \" \"); }\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n public static void function1()\n {\n char[] brackets = Console.ReadLine().ToCharArray();\n int[] intBrackets = brackets.Select(x => (int)(x)).ToArray();\n int circle = 0, square = 0;\n List stack = new List();\n List> groups = new List>();\n int goodindex = 0;\n for (int i = 0; i < intBrackets.Length; i++)\n {\n if (stack.Count > 0)\n {\n int dfrnc = intBrackets[i] - stack.Last();\n if (dfrnc == 53 || dfrnc == -50)\n {\n if (square > 0 || circle > 0)\n {\n List newlist = new List() { square, circle, goodindex, square * 2 + circle * 2 };\n groups.Add(newlist);\n square = circle = 0;\n }\n stack.Clear();\n }\n else\n {\n if (dfrnc == 1) { circle++; stack.RemoveAt(stack.Count - 1); goodindex = i; continue; }\n else if (dfrnc == 2) { square++; stack.RemoveAt(stack.Count - 1); goodindex = i; continue; }\n else\n {\n stack.Add(intBrackets[i]);\n }\n }\n }\n else\n {\n if (intBrackets[i] == 40 || intBrackets[i] == 91)\n {\n if (i != intBrackets.Length - 1)\n {\n stack.Add(intBrackets[i]);\n }\n }\n else\n {\n if (square > 0 || circle > 0)\n {\n List newlist = new List() { square, circle, goodindex, square * 2 + circle * 2 };\n groups.Add(newlist);\n square = circle = 0;\n }\n stack.Clear();\n }\n }\n }\n if (square > 0 || circle > 0) { List newlist = new List() { square, circle, goodindex, square * 2 + circle * 2 }; groups.Add(newlist); }\n int max = 0;\n int maxIndex = 0;\n if (groups.Count > 0)\n {\n for (int i = 0; i < groups.Count; i++)\n {\n if (groups[i][0] > max) { max = groups[i][0]; maxIndex = i; }\n }\n int start = groups[maxIndex][2] - groups[maxIndex][3] + 1;\n int end = groups[maxIndex][2] + 1;\n Console.WriteLine(groups[maxIndex][0]);\n for (int i = start; i < end; i++) { Console.Write(brackets[i]); }\n }\n else Console.WriteLine(\"0\");\n }\n public static void Main()\n {\n char[] input = Console.ReadLine().ToCharArray();\n List 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 = string.Join(\"\", letters.ToArray());\n string hello = \"helo\";\n bool matchFound = false;\n if (letters.Count < 4) { goto Result; }\n else \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 Result:\n Console.WriteLine(matchFound ? \"YES\" : \"NO\");\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5c499d77e27ed584f73ac53c55189ce0", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "MS C#", "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(\"^\\w*h*\\w*e*\\w*l{2,}\\w*o*\\w*$\") == true)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n \n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5ea9cb8de2b50c706cd65e8cff3e092a", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "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 char[] input = Console.ReadLine().ToCharArray();\n List 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 = string.Join(\"\", letters.ToArray());\n string hello = \"helo\";\n bool matchFound = false;\n if (letters.Count < 4) { goto Result; }\n else \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 Result:\n Console.WriteLine(matchFound ? \"YES\" : \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c55a5d3702b581974e75dffa872df1b1", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "42d9ab7dd64b3d9e058904c093a7b779", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "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 if(z == 1)\n {\n if(s[i] == 'e') z++;\n else if(s[i] != 'h') z = 0;\n }\n if(z == 2)\n {\n if(s[i] == 'l') z++;\n else if(s[i] != 'e') z = 0;\n }\n if(z == 3)\n {\n if(s[i] == 'l') z++;\n else z = 0;\n }\n if(z == 4)\n {\n if(s[i] == 'o')\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else if(s[i] != 'l') z = 0;\n }\n }\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a1d1d6ec428bc680117004de6e8a5cbe", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.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(\"^.*h*.*e*.l{2,}.*o*.*$\") == true)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n \n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d22fb5f87c83ea80212cdb0ac4fc7df", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "MS C#", "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)\\1$\") == true)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n \n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0a38455f2bcf7b6d1d2adb67bb81d908", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program {\n static void Main() {\n var str = Console.ReadLine();\n var str2 = \"hello\";\n var i = 0;\n foreach (var c in str) if (c == str2[i])\n if (++i == str2.Length) { Console.WriteLine(\"YES\"); return }\n Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c907cba6754743ac3372d61707361233", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": " internal class Program\n {\n private static void Main(string[] args)\n {\n var word = \"hello\";\n var s = Console.ReadLine();\n var t = 0;\n var result = false;\n for (var i = 0; i < s.Length; i++)\n {\n if (s[i] == word[t + 1])\n {\n if (++t == word.Length - 1)\n {\n result = true;\n break;\n }\n }\n else if (s[i] != word[t])\n t = 0;\n }\n\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "48e2323ee5d94f5be4c4b51b60d6ab91", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.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(\"^\\w*h*\\w*e*\\w*l{2,}\\w*o*\\w*$\") == true)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n \n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "201cee5a05ccbb7a1d37b54364fb8864", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace test{\n class Program{\n static void Main(string [] args){\n string text=Console.ReadLine();\n if(text.Length > 100 || text.Length < 1 ) return;\n \n char word =new char[]{'h','e','l','l','o'};\n int index=0,counter=0;\n foreach(char c in text.ToLower()){\n if(c == word[index]){\n index++;\n counter++;\n }\n }\n if(counter == word.Length) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "499a945c60bbfd98f98ddbd0b5d0969f", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace test{\n class Program{\n static void Main(string [] args){\n string text=Console.ReadLine();\n if(text.Length > 100 || text.Length < 1 ) return ;\n \n char word ={'h','e','l','l','o'};\n int index=0,counter=0;\n foreach(char c in text.ToLower()){\n if(c == word[index]){\n index++;\n counter++;\n }\n }\n if(counter == word.Length) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fe251ab46c5e9fd68c2b78df3d7b1d0b", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Chat_Room___Guloso\n{\n class Program\n {\n static void Main(string[] args)\n {\n /* Dada uma string s, formada por letras latinas min\u00fasculas e contendo entre 1 e 100 letras, \n * determinar se \u00e9 poss\u00edvel encontrar dentro dela a palavra \u201chello\u201d, sem alterar a ordem.\n */\n Rodar();\n }\n\n static void Rodar()\n {\n string s = Console.ReadLine(); //entrada de dados\n Operacao.TesteChatRoom(s); \n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "47bc47f94a7d7a89241cc9b466909a74", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\n\n\nnamespace CF_Hello {\n class Program {\n static void Main(string[] args) {\n string input = Console.ReadLine());\n string example = \"hello\";\n string output = string.Empty;\n int deleted = 0;\n for(int i=0;i\n\n \n \n Debug\n AnyCPU\n {68CD1BEE-E54A-4B06-86A4-71918E0386FE}\n Exe\n Chat_Room___Guloso\n Chat Room - Guloso\n v4.6.1\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6d35acd372a8f443ae6a7c820d3b61ad", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": " class Program\n {\n\n public static string solution(string s)\n {\n string a = \"hello\";\n var counter = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (counter == 5)\n return \"Yes\";\n\n if (s[i] == a[counter])\n counter++;\n }\n if (counter == 5)\n return \"Yes\";\n return \"No\";\n\n }\n static void Main(string[] args)\n {\n var a = \"ahhellllloou\";\n Console.WriteLine(solution(args[0]));\n Console.ReadLine();\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "437718c2523699db3ac201a8bea12ab3", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.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(\"^\\w*h*\\w*e*\\w*l{2,}\\w*o*\\w*$\") == true)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n \n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1faf8f5faac5780f3c802b3fc68d35c2", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine().ToLower();\n int counter = 0;\n string result = \"NO\";\n\n foreach (char chara in line)\n {\n if ((counter == 0 && chara == 'h')\n || (counter == 1 && chara == 'e')\n || ((counter == 2 || counter == 3) && chara == 'l'))\n {\n counter++;\n lastChar = chara;\n }\n else if (counter == 4 && chara == 'o')\n {\n\n result = \"YES\";\n break;\n }\n \n }\n\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9269260dff90567b097ab7b6975e9f24", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "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 (input.Contains('h'))\n {\n int index = input.IndexOf('h');\n string _input = input.Substring(index + 1);\n\n if (_input.Contains('e'))\n {\n index = _input.IndexOf('e');\n _input = _input.Substring(index + 1);\n\n if (_input.Contains('l'))\n {\n index = _input.IndexOf('l');\n _input = _input.Substring(index + 1);\n\n if (_input.Contains('l'))\n {\n index = _input.IndexOf('l');\n _input = _input.Substring(index + 1);\n\n if (_input.Contains('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 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "09ab8f83974c671f2b9da00117bb6762", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "MS C#", "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 char[] cth = { 'h', 'e', 'l', 'l', 'o' };\n \n \n int index=0;\n for(int i=0; i0){\n continue;\n }\n else{\n index = 0;\n }\n }\n \n if(index==5){\n Console.Write(\"YES\");\n }\n else{\n Console.Write(\"NO\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "59e9e299dbb9dc3aad4c3ece17dd409a", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication21\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int l;\n string str=Console.ReadLine();\n string []str2=str.Split(' ');\n \n int n=Convert.ToInt32(str2[0]);\n \n int k=Convert.ToInt32(str2[1]);\n int[] a=new int [n];\n\n string \n\n\n int s=0;\n for (l = 0; l < k; l++)\n {\n int one = 0;\n int two = 0;\n for (int i = 0; i < n; i = i + k)\n if (a[i + l] == 1)\n one++;\n else\n two++;\n int min = one > two ? two : one;\n s = s + min;\n }\n Console.WriteLine(s);\n Console.ReadLine();\n \n\n\n\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8dae6cbddf2a2791d41b605b1c6f3f58", "src_uid": "5f94c2ecf1cf8fdbb6117cab801ed281", "difficulty": 1000.0} {"lang": "MS C#", "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 Console.ReadLine();\n }\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aa5e507f7e6f65ea9194ce0d141d927f", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {CA709FE1-A7B9-416E-8ACA-32B55CB0CB31}\n Exe\n Olimp\n Olimp\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f94a29f9a9845aac8dac6e99978a1db0", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0} {"lang": "MS C#", "source_code": "int m = c * p;\n int n = m / (d - p);\n int di = n * d;\n if(di t)\n {\n t = jami;\n }\n \n }\n }\n \n Console.WriteLine(t);\n \n \n \n \n \n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4e156b088948703648ef2c3ceefc1713", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n {\nstatic int Main()\n {\n string l1 = Console.ReadLine();\n int n = int.Parse(l1);\n int[] inputs = new int[n];\n\n string l2 = Console.ReadLine();\n string[] inpS = l2.Split(' ');\n\n int OrigTotal1s = 0;\n for (int i = 0; i < n; i++)\n {\n inputs[i] = int.Parse(inpS[i]);\n if (inputs[i] == 1)\n {\n OrigTotal1s++;\n }\n }\n\n int delta = -1;\n int maxdelta = -1;\n int nums0 = 0;\n int nums1 = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n nums0 = 0; nums1 = 0;\n if (inputs[i] == 0)\n {\n nums0++;\n for (int j = i + 1; j < n; j++)\n {\n if (inputs[j] == 1)\n {\n nums1++;\n }\n else nums0++;\n\n delta = nums0 - nums1;\n\n if (delta > maxdelta)\n {\n maxdelta = delta;\n }\n\n }\n }\n }\n\n Console.Write(OrigTotal1s + maxdelta);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cf41bca8cae1940cd7225e69b21586cd", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace rapidPrograming\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Console.ReadLine();\n var nums = Console.ReadLine().Split().Select((s) => Convert.ToInt32(s)).ToList();\n var max = 0;\n for(int i = nums.Count; i > 0; i--)\n {\n for(int j = 0; j <= nums.Count-i; j++)\n {\n // Console.WriteLine($\"{j},{i}\");\n var nums2 = nums.GetRange(j, i).Select(n => n == 0 ? 1:0).ToList() ;\n var before = nums.GetRange(0, j);\n var after = nums.GetRange(j + i, nums.Count - nums2.Count-before.Count);\n var count= nums2.Count(ni => ni == 1)+ before.Count(ni => ni == 1)+ after.Count(ni => ni == 1);\n if (count > max)\n {\n max = count;\n }\n }\n\n\n }\n Console.WriteLine(max);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4d77fa5d677fca7c7eb9e6ff4cfbd24f", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "/*\nThere are n integers a1, a2, ..., an. Each of those integers can be either 0 or 1. We are allowed to do exactly one move: We must choose two indices i and j (1 <= i <= j <= n) and flip all values ak for which their positions are in range [i, j] (that is i <= k <= j). Flip the value of x means to apply operation x = 1 - x.\n\nThe goal is - After exactly one move to obtain the maximum number of ones. \n\nInput:-\n\nThe first line of the input contains an integer n (1 <= n <= 10^6). In the second line of the input there are n integers: a1, a2, ..., an. It is guaranteed that each of those n values is either 0 or 1\n\nOutput:-\nPrint an integer - the maximal number of 1s that can be obtained after exactly one move.\n\nSample test(s)\ninput\n5\n1 0 0 1 0\noutput\n4\n\ninput\n4\n1 0 0 1\noutput\n4\n\nNote:-\nIn the first case, flip the segment from 2 to 5 (i=2, j=5). That flip changes the sequence, it becomes: [1 1 1 0 1]. So, it contains four ones. There is no way to make the whole sequence equal to [1 1 1 1 1].\n\nIn the second case, flipping only the second and the third element (i=2, j=3) will turn all numbers into 1.\n\n\nSource: http://codeforces.ru/problemset/problem/327/A\n*/\n\nusing System;\n\nnamespace FlippingGame327A\n{\n class Program\n {\n int kkMax(int a, int b)\n {\n return (a < b) ? b : a;\n }\n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int n = Convert.ToInt32(str);\n str = Console.ReadLine();\n string[] strArray = str.Split(' ');\n int[] input = new int[n + 3];\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n input[i] = Convert.ToInt32(strArray[i]);\n if (input[i] == 1)\n {\n sum++;\n }\n }\n\n // main logic\n // O(n) solution... it is a version of 'maximum subarray problem' which can be solved using Kadane's Algorithm\n int ans = (input[0] == 1) ? -1 : 1;\n int ends = ans;\n for (int i = 1; i < n; i++)\n {\n int temp = 1;\n if (input[i] == 1)\n {\n temp = -1;\n }\n\n ends = kkMax(temp, ends + temp);\n ans = kkMax(ans, ends);\n }\n Console.WriteLine(sum + ans);\n /*\n // O(n^2) solution\n int[,] res = new int[n, n];\n int ans = Int32.MinValue;\n for (int i = 0; i < n; i++)\n {\n int zeros = 0;\n for (int j = i; j < n; j++)\n {\n if (input[j] == 0)\n {\n zeros++;\n res[i, j] = zeros;\n }\n int temp = sum - (j - i + 1 - res[i, j]) + res[i, j];\n ans = (temp > ans) ? temp : ans;\n }\n }\n Console.WriteLine(ans);\n Console.ReadLine();\n */\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "55450ad95384f20302e357bd885b29c2", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "MS C#", "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 /*\n * Author: Luismo\n * Idea: BinarySearch + DFS\n * \n * */\n\n\n static void Main(string[] args)\n {\n TextReader tr = Console.In;\n // Console.SetIn(new StreamReader(@\"d:\\lmo.in\"));\n\n SolveSingleProblem();\n \n Console.SetIn(tr);\n Console.ReadLine();\n\n //string[] data = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n static List intervals;\n static void SolveSingleProblem()\n {\n int n = int.Parse(Console.ReadLine());\n int[] arr = new int[n];\n string[] data = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n \n \n int firstZ = -1;\n int totalOnes = 0;\n\n for (int i = 0; i < data.Length; i++)\n {\n arr[i] = int.Parse(data[i]);\n\n if (arr[i] == 0)\n {\n if(firstZ==-1)\n firstZ = i;\n }\n else totalOnes++; \n }\n //\n int zeroes = 0, ones = 0, max =0, cnt=0;\n for (int i = firstZ; i < arr.Length; i++)\n {\n if (arr[i] == 0)\n zeroes++;\n else ones++;\n\n if (zeroes - ones > max)\n {\n max = zeroes - ones;\n cnt = zeroes - ones + totalOnes - ones;\n }\n }\n\n Console.WriteLine(cnt);\n\n }\n\n }\n\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3d5e4da3eefecc4fcb7ea59ab23e0ac6", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\nstring s_n ;\ns_n=Console.ReadLine();\n Console.WriteLine(s_n);\n\n int n = 5;\n int[] a = new int[n];\nstring s_a[]=new string [n];\n int s;\n int t = 0;\n int jami = 0;\n for (int i = 0; i < n; i++)\n {\n s_a[i] = Console.ReadLine();\n //jami += a[i];\n Console.WriteLine( s_a[i]);\n }\nreturn;\n s = jami;\n for (int i = 0; i < n; i++)\n {\n jami = s;\n if (a[i] == 0) \n {\n jami += 1;\n }\n if (a[i] == 1)\n {\n jami -= 1;\n }\n for (int j = i + 1; j < n; j++)\n {\n if (a[j] == 0)\n {\n jami += 1;\n }\n if (a[j] == 1)\n {\n jami -= 1;\n }\n if (jami > t)\n {\n t = jami;\n }\n\n }\n }\n\n Console.WriteLine(t);\n\n\n\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cb102404a15a39907a3f2ba49081f32e", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": ".NET Core C#", "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 List readValues(char delimiter = ' ') => readStrings(delimiter: delimiter).Select(x => (T)Convert.ChangeType(x, typeof(T))).ToList();\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 a, int lo, int hi) where T : IComparable\n {\n var pivot = a[lo];\n int i = lo - 1, j = hi + 1;\n while (true)\n {\n do { i++; } while (a[i].CompareTo(pivot) < 0);\n do { j--; } while (a[j].CompareTo(pivot) > 0);\n if (i >= j)\n return j;\n var temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n }\n private static void quickSort(List a, int lo, int hi) where T : IComparable\n {\n if (lo < hi)\n {\n int q = quickSortPartition(a, lo, hi);\n quickSort(a, lo, q);\n quickSort(a, q + 1, hi);\n }\n }\n private static void quickSort(List a) where T : IComparable => quickSort(a, 0, a.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(List 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 var 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.Count - 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.Count - 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.Count; ++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 var a = readValues();\n int[] 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 List 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.Count; ++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 var b = readValues();\n long result = Math.Abs(b[0]);\n for (int i = 1; i < b.Count; ++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 List 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 private static void berSUBall()\n {\n readString();\n var a = readValues();\n readString();\n var b = readValues();\n quickSort(a);\n quickSort(b);\n int result = 0;\n for (int i = 0, j = 0; i < a.Count && j < b.Count;)\n if (Math.Abs(a[i] - b[j]) < 2)\n {\n ++result;\n ++i;\n ++j;\n }\n else if (a[i] < b[j])\n ++i;\n else\n ++j;\n write(result);\n }\n private static void flippingGame()\n {\n readString();\n var a = readValues();\n int max = 0;\n for (int i = 0, previousOnes = 0, total = a.Sum(); i < a.Count; previousOnes += a[i], ++i)\n for (int j = i, remainingOnes = total - previousOnes; j < a.Count; , ++j)\n {\n remainingOnes -= a[j];\n var ones = previousOnes + (j - i + 1 - (total - previousOnes - remainingOnes)) + remainingOnes;\n if (ones > max)\n max = ones;\n }\n write(max);\n }\n\n static void Main(string[] args)\n {\n //var t = readValue();\n //for (int i = 0; i < t; ++i)\n flippingGame();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a2e2e5a8dca62dedb6c9118bf5dcca81", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Flipping_Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int maxCount = 0;\n for(int i = 0; i < numbers.Length;i++)\n {\n for (int j = 0; j < numbers.Length; j++)\n {\n int count = 0;\n for (int k = 0; k < numbers.Length; k++)\n {\n if (k >= i && k <= j)\n {\n if (numbers[k] == 0)\n count++;\n }\n else\n {\n if (numbers[k] == 1)\n count++;\n }\n }\n maxCount = Math.Max(count, maxCount);\n }\n Console.WriteLine(maxCount);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f1f39ab0a3236577f3112207ecc9b536", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n);\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int s;\n int t = 0;\n \n int jami = 0;\n for (int i = 0; i < n; i++)\n {\n \n jami += a[i];\n\n }\n s = jami;\n for (int i = 0; i < n; i++)\n {\n jami = s;\n if (a[i] == 0) \n {\n jami += 1;\n }\n if (a[i] == 1)\n {\n jami -= 1;\n }\n for (int j = i + 1; j < n; j++)\n {\n if (a[j] == 0)\n {\n jami += 1;\n }\n if (a[j] == 1)\n {\n jami -= 1;\n }\n if (jami > t)\n {\n t = jami;\n }\n\n }\n }\n\n Console.WriteLine(t);\n\n\n\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9c827d0cfd04946c5f9980e0309bf3f2", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "//#define __debug\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _TestData\n{\n public static class ListExtensions\n {\n public static bool IsAllFree(this IEnumerable houses)\n {\n return houses.All(v => !v);\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n#if __debug\n var power = Convert.ToInt32(\"1\");\n#else\n var power = Convert.ToDouble(Console.ReadLine());\n#endif\n Console.WriteLine(Check(power));\n }\n\n static double Check(double power)\n {\n if (power == 0) return 0;\n //1-8\n //2-4\n //3-2\n //4-6\n\n //5-8\n //6-4\n //7-2\n //8-6\n\n var lPower = (power % 10) % 4;\n\n switch (lPower)\n {\n case 0:\n return 6;\n case 1:\n return 8;\n case 2:\n return 4;\n case 3:\n return 2;\n }\n\n return 0;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7827f8ea1e38eb821d15adebd88f4aa5", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff//\n// 742A Codeforces\nusing 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 int n,op;\n n = Convert.ToInt32(Console.ReadLine());\n op = n % 4;\n if(n == 0)\n {\n Console.WriteLine(\"1\\n\");\n break;\n }\n switch (op)\n {\n case 0:\n Console.WriteLine(\"6\\n\");\n break;\n case 1:\n Console.WriteLine(\"8\\n\");\n break;\n case 2:\n Console.WriteLine(\"4\\n\");\n break;\n case 3:\n Console.WriteLine(\"2\\n\");\n break;\n default:\n Console.WriteLine(\"\\n\");\n break;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "07936db23787bd8df2cb54667bf5532a", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace NetCore3\n{\n public class Test\n {\n public static void Main(string[] args)\n {\n var input = long.Parse(Console.ReadLine());\n var baseNumber = 8;\n\n for (int i = 1; i <= input; i++)\n {\n baseNumber = Math.Pow(baseNumber, i).ToString().Reverse()[0] - '0';\n }\n\n Console.WriteLine(baseNumber);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ee4aa6f442c0027b7a6fc9c0048060b8", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\npublic class Source\n{\n public void Program()\n {\n }\n int binaryl(int[] array, int c)\n {\n int left = 0;\n int right = array.Length - 1;\n while (left != right - 1)\n {\n int mid = (left + right) / 2;\n if (c > array[mid])\n left = mid;\n if (c <= array[mid])\n right = mid;\n }\n if (array[left] == c)\n return left;\n return -1;\n }\n int binaryr(int[] array, int c)\n {\n int left = 0;\n int right = array.Length - 1;\n while (left != right - 1)\n {\n int mid = (left + right) / 2;\n if (c >= array[mid])\n left = mid;\n if (c < array[mid])\n right = mid;\n }\n if (array[left] == c)\n return left;\n return -1;\n }\n void Read()\n {\n int x, n;\n int[] a;\n n = ri();\n x = ri();\n a = ReadIntArray();\n Array.Sort(a);\n int buf, num = 0;\n Dictionary d = new Dictionary();\n for (int i = 0; i < n; i++)\n {\n if (d.ContainsKey(a[i]))\n d[a[i]]++;\n else\n d.Add(a[i], 1);\n }\n for (int i = 0; i < n; i++)\n {\n buf = x ^ a[i];\n int id = Array.BinarySearch(a, buf);\n if (id < 0)\n continue;\n if (x != 0)\n num += d[a[id]];\n else\n num += d[a[id]] - 1;\n\n }\n writeLine(num/2);\n\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 long[] ReadLongArray() { return ReadAndSplitLine().Select(i => long.Parse(i)).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 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}\nclose", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ea524c1914bda35378b483fe7aa4255f", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace NetCore3\n{\n public class Test\n {\n public static void Main(string[] args)\n {\n var input = long.Parse(Console.ReadLine());\n var baseNumber = 8;\n\n for (int i = 1; i <= input; i++)\n {\n baseNumber = Math.Pow(baseNumber, i).ToString().Reverse()[0] - '0';\n }\n\n Console.WriteLine(baseNumber);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "03cbbd2e5f44b54777f9ce07003df7a4", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _742A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] dig = { 6,8, 4, 2 };\n int n = Convert.ToInt32(Console.ReadLine());\n if (n > 0)\n Console.WriteLine(dig[n % 4]);\n else\n Console.WrilteLine(\"1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "374a8ae4434017f915b48ecd86c4edd7", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Application {\n\tclass A {\n\t\tpublic static void Main(string[] args) {\n\t\t\tconst int[] ds = {6, 8, 4, 2};\n\t\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\t\tConsole.WriteLine((n == 0) ? 1 : ds[n%4]);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5181246d1ba08e87540afdd14203f8b5", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace Firstone\n{\n class numbers\n {\n static void Main(string[] args)\n {\n long n;\n n=Convert.ToLong(Console.ReadLine());\n if(n%4==0)\n {\n int b=6;\n Console.Writeline(\"{0}\",b);\n }\n else if(n%4==1)\n {\n int b=2;\n Console.Writeline(\"{0}\",b);\n }\n else if(n%4==2)\n {\n int b=4;\n Console.WriteLine(\"{0}\",b);\n }\n else if(n%4==3)\n {\n int b=8;\n Console.WriteLine(\"{0}\",b);\n }\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "76d49988c13fd009e690741be59c6944", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\n\n \n Exe\n netcoreapp3.1\n \n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3ae89ee6aeebf2e8523137dfcba843f5", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {14D04B80-8C2F-4301-81FB-42F6718F3147}\n Exe\n Properties\n A.Bear_and_Big_Brother\n A.Bear_and_Big_Brother\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dc7c82860be3eebc661e58f13a63b1cb", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30002.166\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"BearAndBigBrother\", \"BearAndBigBrother.csproj\", \"{5B8D6E73-B63D-44C5-B1D5-E5944C000643}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{5B8D6E73-B63D-44C5-B1D5-E5944C000643}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{5B8D6E73-B63D-44C5-B1D5-E5944C000643}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{5B8D6E73-B63D-44C5-B1D5-E5944C000643}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{5B8D6E73-B63D-44C5-B1D5-E5944C000643}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {BD32D4C4-72AE-4B8C-86A5-B703692BBA61}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "855cd2cab5a9e0746c45a3b6b07f7ab4", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n \nnamespace ConsoleApplication\n{\n sealed class Program\n {\n static void Main(string[] args)\n {\n BigInteger ba = 5;\n var d = Console.ReadLine().Split().Select(Int32.Parse).ToArray();\n int a = d[0], b = d[1], result = 0;\n while (a <= b)\n {\n a *= 3;\n b *= 2;\n result++;\n }\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "df454a778268997c8f029a43e3afb0ae", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\npublic class BearQuestion{\n static void Main(string[] args){\n Bear();\n }\n \n static void Bear(){\n int[] args = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int a = args[0];\n int b = args[1];\n int years = 0;\n \n while(a <= b){\n years++;\n a *= 3;\n b *= 2;\n }\n return years\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "03f917f742baec8a26c4319a1277263d", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\npublic class BearQuestion{\n static void Main(string[] args){\n Bear();\n }\n \n static void Bear(){\n string[] args = Console.ReadLine.Split(' ');\n int a = int.Parse(args[0]);\n int b = int.Parse(args[1]);\n int years = 0;\n \n while(a <= b){\n years++;\n a *= 3;\n b *= 2;\n }\n Console.WriteLine(years);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b9c9cdef499375a4c94381c2ad6ca93e", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "public int Getresult(int a,int b)\n{\n try{\n \n \n \n for(int i=0;i<100;i++)\n {\n \n a=a*3;\n b=b*3;\n if(a>b)\n {\n return i+1;\n }\n }\n \n }\n catch(Exception ex)\n {\n Console.WriteLine(\"invalid input\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f412024f4a028a3826c01a252c2f4028", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n int age = 0;\n string[] bears = line.Split(\" \");\n int limak = Int32.Parse(bears[0]);\n int bob = Int32.Parse(bears[1]);\n\n while (limak <= bob)\n {\n limak = limak * 3;\n bob = bob * 2;\n age++;\n }\n Console.WriteLine(age);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2a44fcacef10dffc5ce63df81262145b", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\n\n{\n class BearAndBigBrother\n {\n public static void Main(String[] args)\n {\n int c = 0;\n\n string[] t = Console.ReadLine().Split();\n\n int l = int.Parse(t[0]);\n \n int b = int.Parse(t[1]); \n\n\n while (l<=b)\n\n {\n l*=3;\n b*=2;\n\n c++;\n\n }\n\n Console.WriteLine(c);\n \n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "29bfdb723f6a92aa48201d91deec53f1", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class program\n{\npublic static void main()\n{\n try{\n \n int a,b;\nvar input=Console.ReadLine().Split(' ');\n\na=Convert.ToInt32(input[0]);\nb=Convert.ToInt32(input[1]);\n \n for(int i=0;i<100;i++)\n {\n \n a=a*3;\n b=b*3;\n if(a>b)\n {\n return i+1;\n }\n }\n \n }\n catch(Exception ex)\n {\n Console.WriteLine(\"invalid input\");\n }\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d4dcd68e7bdad82873575ef5d451be0e", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Application {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\t\t\tstring[] tokens = Console.ReadLine().Split();\n\t\t\tint a = int.Parse(tokens[0]);\n\t\t\tint b = int.Parse(tokens[1]);\n\t\t\tint t;\n\t\t\twhile (a <= b) {\n\t\t\t\ta *= 3;\n\t\t\t\tb *= 2;\n\t\t\t\t++t;\n\t\t\t}\n\t\t\tConsole.WriteLine(t);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "18616ed92100b5ffa923fb402605e564", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " using System;\n static void Main(string[] args)\n {\n int cant = 0;\n int Limak = int.Parse(Console.ReadLine());\n int Bob = int.Parse(Console.ReadLine());\n\n if (Limak <= Bob)\n {\n while (Limak <= Bob)\n {\n Limak *= 3;\n Bob *= 2;\n cant++;\n }\n }\n\n Console.WriteLine(cant);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1e1392f0f4cbb3d9323a55af7a4204f2", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.40629.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"A. Bear and Big Brother\", \"A. Bear and Big Brother\\A. Bear and Big Brother.csproj\", \"{14D04B80-8C2F-4301-81FB-42F6718F3147}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{14D04B80-8C2F-4301-81FB-42F6718F3147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{14D04B80-8C2F-4301-81FB-42F6718F3147}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{14D04B80-8C2F-4301-81FB-42F6718F3147}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{14D04B80-8C2F-4301-81FB-42F6718F3147}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0e986f7c4070946e16999d4023c1746a", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "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 List d = s.Split(' ');\n int p1 = int.Parce(d[0]);\n int p2 = int.Parce(d[1]);\n int i=0;\n while (p1 input[1]) break;\n }\n\n Console.WriteLine(result);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c9b7345576f9e085d64d20eb0061dacd", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n=0, k =0;\n var x = Console.ReadLine();\n string[] split = x.Split(\" \");\n n = Convert.ToInt32(split[0]);\n k = Convert.ToInt32(split[1]);\n int result = 1;\n while (true)\n {\n n *= 3;\n k *= 2;\n if (n > k)\n {\n break;\n }\n result++;\n }\n //for(int i =0; i < k; i++)\n //{\n // if(n % 10 == 0)\n // {\n // n /= 10;\n // }\n // else\n // {\n // n--;\n // }\n //}\n Console.WriteLine(result);\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0e5eef9b4e4dab4e644e026bdc8aaaee", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " using System;\nusing System.Collections.Generic;\nclass Program\n {\n static void main{string[] bearsWeightsStrings = Console.ReadLine().Split(' ');\n Dictionary bearsWeightsDictionary = new Dictionary()\n {\n {\"Limak\",int.Parse(bearsWeightsStrings[0])},\n {\"Bob\",int.Parse(bearsWeightsStrings[1])},\n };\n int years = 0;\n\n while (bearsWeightsDictionary[\"Limak\"] < bearsWeightsDictionary[\"Bob\"])\n {\n bearsWeightsDictionary[\"Limak\"] *= 3;\n years++;\n }\n\n Console.WriteLine(years);\n }}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "487b5543241d6e332fa3fcc4ca6cf4cf", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication2\", \"ConsoleApplication2\\ConsoleApplication2.csproj\", \"{50C91602-CE29-45B0-9CA8-A82348FCC712}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{50C91602-CE29-45B0-9CA8-A82348FCC712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{50C91602-CE29-45B0-9CA8-A82348FCC712}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{50C91602-CE29-45B0-9CA8-A82348FCC712}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{50C91602-CE29-45B0-9CA8-A82348FCC712}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dca4ef23a948c37a8d144ccccf59bc25", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.40629.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Bear and Big Brother\", \"Bear and Big Brother\\Bear and Big Brother.csproj\", \"{706791FC-FC8E-4EF9-9FB1-B10BEAABEF12}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{706791FC-FC8E-4EF9-9FB1-B10BEAABEF12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{706791FC-FC8E-4EF9-9FB1-B10BEAABEF12}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{706791FC-FC8E-4EF9-9FB1-B10BEAABEF12}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{706791FC-FC8E-4EF9-9FB1-B10BEAABEF12}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "726ca2d21a5e96cfb6f0e071dc1028c5", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "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[] input = Console.ReadLine().Split(' ');\n\t\t\n\t\tint a = int.Parse(input[0]);\n\t\tint b = int.Parse(input[1]));\n\t\t\n\t\tint years = 0;\n\t\t\n\t\twhile(a <= b){\n\t\t\ta *= 3;\n\t\t\tb *= 2;\n\t\t\t\n\t\t\tyears++;\n\t\t}\n\t\t\n\t\tConsole.WriteLine($\"{years}\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cc5609015ca2600bc7c664e759d1c9bf", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\npublic static void main()\n{\n try{\n \n int a,b;\nvar input=Console.ReadLine().Split(' ');\n\na=var[0];\nb=var[1];\n \n for(int i=0;i<100;i++)\n {\n \n a=a*3;\n b=b*3;\n if(a>b)\n {\n return i+1;\n }\n }\n \n }\n catch(Exception ex)\n {\n Console.WriteLine(\"invalid input\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e44a368d8512b13090f8470fbbb62765", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\npublic class BearQuestion{\n static void Main(string[] args){\n Bear();\n }\n \n static void Bear(){\n int[] args = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int a = args[0];\n int b = args[1];\n int years = 0;\n \n while(a <= b){\n years++;\n a *= 3;\n b *= 2;\n }\n return years;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e002d6844250b365717051f4e35baa3e", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace TasksCodeForce\n{\n public static class _791ATeddyBearAndBigBrother\n {\n //done\n public static void Method()\n {\n string[] weight = Console.ReadLine().Split();\n\n float weightLimak = float.Parse(weight[0]);//float.Parse(Console.ReadLine());\n float weightBob = float.Parse(weight[1]);\n\n int year = 0;\n\n do\n {\n year++;\n weightLimak *= 3;\n weightBob *= 2;\n\n } while (weightLimak <= weightBob);\n\n\n Console.WriteLine(year);\n Console.ReadKey();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cad4b482eeab7eefd223eedde5451bcf", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class program\n{\npublic static void main()\n{\n try{\n \n int a,b;\nint[] input=Console.ReadLine().Split(' ');\n\na=input[0];\nb=input[1];\n \n for(int i=0;i<100;i++)\n {\n \n a=a*3;\n b=b*3;\n if(a>b)\n {\n return i+1;\n }\n }\n \n }\n catch(Exception ex)\n {\n Console.WriteLine(\"invalid input\");\n }\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5920350d7451505591be4fb8d604bb84", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProblemSolving\n{\n class Program\n {\n\n #region BearAndHisBrother\n\n int YearCount = 0;\n string[] Weights = Console.ReadLine().Split(' ');\n List Weights_ = new List(); \n Weights_.Add(int.Parse(Weights[0]));\n Weights_.Add(int.Parse(Weights[1]));\n\n while (Weights_[0]<= Weights_[1])\n {\n Weights_[0] = Weights_[0] * 3;\n Weights_[1] = Weights_[1] * 2;\n if(Weights_[0] < Weights_[1])\n {\n YearCount++;\n \n }\n else if (Weights_[0] > Weights_[1])\n {\n Console.WriteLine(YearCount + 1);\n\n }\n else\n {\n YearCount++;\n }\n }\n \n #endregion\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65ec6cd9847832b15edf6aa91607e376", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic static class Program\n{\n public static void Main()\n {\n var input = GetIntegerInputsFromLine();\n int limak = input[0];\n int bob = input[1];\n Console.Writeline(Bear(limak, bob));\n }\n public static int Bear(int limak, int bob)\n {\n if (limak > bob)\n {\n return 0;\n }\n else\n {\n return 1 + (Bear(limak * 3, bob * 2));\n }\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ca44aa3a92e9ab1f2f0ca156862dbc48", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n int cant = 0;\n double Limak = Double.Parse(Console.ReadLine());\n double Bob = Double.Parse(Console.ReadLine());\n\n if (Limak <= Bob)\n {\n while (Limak <= Bob)\n {\n Limak *= 3;\n Bob *= 2;\n cant++;\n }\n }\n \n Console.WriteLine(cant);\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1b387b3ba115d43d9ee707943135ae76", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "static void Main(string[] args)\n {\n int a, b, yr = 0;\n string[] scanf = Console.ReadLine().Split();\n a = int.Parse(scanf[0]);\n b = int.Parse(scanf[1]);\n if (a >= 1 && a <= b && b <= 10)\n {\n while (a <= b)\n {\n a = a * 3;\n b = b * 2;\n yr++;\n }\n Console.WriteLine(yr);\n }\n else\n {\n Console.WriteLine(\"wrong inputs\");\n }\n Console.ReadKey();\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1f27279e1783c8737bbcd33c66d2d1de", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic static class Program()\n{\n public static int Main(string[] args)\n {\n var input = GetIntegerInputsFromLine();\n int limak = input[0];\n int bob = input[1];\n return Bear(limak, bob);\n }\n public static int Bear(int limak, int bob)\n {\n if (limak > bob)\n {\n return 0;\n }\n else\n {\n return 1 + (Bear(limak * 3, bob * 2));\n }\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f46a7a2eeba968a9251ec59b28510d22", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8dddf3a4ddb5962c6bf3b961abc80750", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class program\n{\npublic static void main()\n{\n try{\n \n int a,b;\nvar input=Console.ReadLine().Split(' ');\n\na=var[0];\nb=var[1];\n \n for(int i=0;i<100;i++)\n {\n \n a=a*3;\n b=b*3;\n if(a>b)\n {\n return i+1;\n }\n }\n \n }\n catch(Exception ex)\n {\n Console.WriteLine(\"invalid input\");\n }\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cf93ab2aa0feabf71e423f9e1ad858a2", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n var age = 0;\n var bears = line.Split(\" \");\n var limak = Int64.Parse(bears[0]);\n var bob = Int64.Parse(bears[1]);\n\n while (limak <= bob)\n {\n limak = limak * 3;\n bob = bob * 2;\n age++;\n }\n Console.WriteLine(age);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8020f53c83838e25d7481ffffbcb9d11", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic static class Program()\n{\n public static void Main()\n {\n var input = GetIntegerInputsFromLine();\n int limak = input[0];\n int bob = input[1];\n return Bear(limak, bob);\n }\n public static int Bear(int limak, int bob)\n {\n if (limak > bob)\n {\n return 0;\n }\n else\n {\n return 1 + (Bear(limak * 3, bob * 2));\n }\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e7da968e973a676678163f88fd460e4d", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Bear_and_Big_Brother\n{\n class Program\n {\n static void Main(string[] args)\n {\n int l = Int32.Parse(Console.Read());\n int b= Int32.Parse(Console.Read());\n int count=0;\n while (l <= b)\n {\n l = 3 * l;\n b=2*b;\n count++;\n }\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "096c94d0acb324703e66e6b065a305a5", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic static class Program\n{\n public static void Main()\n {\n var input = GetIntegerInputsFromLine();\n int limak = input[0];\n int bob = input[1];\n return Bear(limak, bob);\n }\n public static int Bear(int limak, int bob)\n {\n if (limak > bob)\n {\n return 0;\n }\n else\n {\n return 1 + (Bear(limak * 3, bob * 2));\n }\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8c77a07305ebc456ae62aac41c7c9cd4", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System; \nnamespace ConsoleApplication1{\n class Program {\nstatic void Main (string[] args) \n{\nA();\n}\nstatic void B(){ \nstring x= Console ReadLine();\n y = Console. ReadLine(); \nfor (int i= 0;i< x. Length; i++)\nif (y[i]> x[i]) Console. Write Line (-1); Console.WriteLine(y);\n static void A(){ var line= Console.ReadLine().ToCharArray();\n int count= GetCount(line); \nfor (int i =0; i< line.Length; i++)\n {line[i]=(char)( 'V'+'K'- line[i]);\n count = Math.Max(count, GetCount(line));\nline[i]=(char)( 'V'+'K'- line[i]);\n}\nConsole.WriteLine(count);\n}\nstatic int GetCount(char[] s)\n{ int count=0;\n for (int i =1; i < s.Length; i++)\n if (s[i] =='K' && s[i-1]== 'V') count++ ;\nreturn count; \n}}}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6dad6b477157701c204b81d7688a61db", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System; \nnamespace ConsoleApplication1{\n class Program {\nstatic void Main (string[] args) \n{\nA();\n}\nstatic void B(){ \nstring x= Console.ReadLine();\n y = Console. ReadLine(); \nfor (int i= 0;i< x. Length; i++)\nif (y[i]> x[i]) Console.WriteLine(-1); Console.WriteLine(y);\n static void A(){ var line= Console.ReadLine().ToCharArray();\n int count= GetCount(line); \nfor (int i =0; i< line.Length; i++)\n {line[i]=(char)( 'V'+'K'- line[i]);\n count = Math.Max(count, GetCount(line));\nline[i]=(char)( 'V'+'K'- line[i]);\n}\nConsole.WriteLine(count);\n}\nstatic int GetCount(char[] s)\n{ int count=0;\n for (int i =1; i < s.Length; i++)\n if (s[i] =='K' && s[i-1]== 'V') count++ ;\nreturn count; \n}}}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b49e9a12b3eb2ff4fa120753b9acd63", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\n{\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c6f21a60385d4fd28878e91e2d232bec", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0} {"lang": "MS C#", "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;\n\n#region testlib\npublic delegate ReadDelegate ReadDelegate(out T value);\npublic delegate bool ParserDelegate(string word, out T item);\n\npublic 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}\npublic 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}\npublic 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\nstatic class Program\n{\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\n static void InitIO()\n {\n#if !DEBUG\n cin = new Input(\"input.txt\");\n cout = new Output(\"output.txt\");\n#endif\n }\n #endregion\n #region Time\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 const string nyan = \"^_^\";\n static void Solve()\n {\n var a = cin.ReadInt32();\n var b = cin.ReadInt32();\n\n cout.WriteLine(\"{0} {1}\", Math.Min(a, b), (Math.Max(a, b) - Math.Min(a, b) / 2);\n }\n\n static string[] Tests =\n {\n @\"3 1 2\n1 1 1\",\n @\"4 2 3\n1 2 4 8\",\n @\"3 1 2\n17 18 4\"\n };\n\n static string Generate(int n, int t, int seed)\n {\n var rnd = new Random(seed);\n var a = new int[n];\n for (var i = 0; i < n; i++)\n {\n a[i] = rnd.Next(1, 101);\n }\n\n var sb = new StringWriter();\n var output = new Output(sb);\n\n output.WriteLine(\"{0} {1}\", n, t);\n output.WriteArray(a, false);\n\n return sb.ToString();\n }\n static void Main()\n {\n#if DEBUG\n if (Tests.Length == 0)\n {\n Solve();\n }\n else\n {\n foreach(var test in Tests)\n {\n cin = new Input(new StringReader(test));\n Solve();\n }\n /*\n for (var i = 0; i < 100; i++)\n {\n var test = Generate(100, 10000000, i);\n Start();\n cin = new Input(new StringReader(test));\n Solve();\n Stop();\n }\n //*/\n }\n\n#else\n Solve();\n#endif\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8aa6e6a5423b1e5bd80bddf1adfe6058", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Net.Http.Headers;\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 red = Convert.ToInt32(input[0]);\n int blue = Convert.ToInt32(input[1]);\n\n StringBuilder sb = new StringBuilder();\n\n int diff = Math.Min(red,blue);\n sb.Append(diff + \" \");\n\n diff = Math.Abs(red - blue);\n diff = diff / 2;\n\n sb.Append(diff);\n Console.WriteLine(sb.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c1864674766fa51fea3d3c5c70fd41b4", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "MS C#", "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 = func(7, 3);\n for (int i = 0; i < a.Length; i++)\n {\n Console.WriteLine(a[i].ToString());\n }\n }\n\n private static int[] func(int a,int b)\n {\n //int[] result = new int[2];\n int f = 0;\n int s = 0;\n if (a == b)\n {\n f = a;\n s = 0;\n }\n else if (a < b)\n {\n f = a;\n b = b - a;\n s = b / 2;\n }\n else if (b < a)\n {\n f = b;\n a = a - b;\n s = a / 2;\n }\n\n return result;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0fea9593eaeb0e57a7d333e42d9bc3b", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "Program.cs", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d9a8d0ca75331d6a8896a641887a218d", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "MS C#", "source_code": " int a = 3;\nint b = 7;\n int f = 0;\n int s = 0;\n if (a == b)\n {\n f = a;\n s = 0;\n }\n else if (a < b)\n {\n f = a;\n b = b - a;\n s = b / 2;\n }\n else if (b < a)\n {\n f = b;\n a = a - b;\n s = a / 2;\n }\nConsole.WriteLine(f.ToString() + \" \" + s.ToString());", "lang_cluster": "C#", "compilation_error": true, "code_uid": "80cf3b37b98097ae0e0e3f15245ccbab", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "MS C#", "source_code": "int f = 0;\n int s = 0;\n if (a == b)\n {\n f = a;\n s = 0;\n }\n else if (a < b)\n {\n f = a;\n b = b - a;\n s = b / 2;\n }\n else if (b < a)\n {\n f = b;\n a = a - b;\n s = a / 2;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "00839b8a5956222d8e68373a67343808", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace LearningAlgoCsharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var line = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n //var arr = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Convert.ToInt32(s)).ToArray();\n //var first = Convert.ToInt32(line[0]);\n //var second = Convert.ToInt32(line[1]);\n\n var line = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Convert.ToInt32(s)).ToArray();\n var red = line[0];\n var blue = line[1];\n\n var f = 0;\n var s = 0;\n\n if(red > blue)\n {\n f = blue;\n s = (red - blue) / 2;\n }\n else\n {\n f = red;\n s = (blue - red) /2;\n }\n\n Console.WriteLine(f + \" \" + s);\n Console.ReadLine();\n }\n\n private static int LevenshteinDistance(string first, string second)\n {\n if (string.IsNullOrEmpty(first) && string.IsNullOrEmpty(second))\n return 0;\n if (string.IsNullOrEmpty(first))\n return second.Length;\n if (string.IsNullOrEmpty(second))\n return first.Length;\n\n int firstLength = first.Length;\n int secondLength = second.Length;\n var distances = new int[firstLength + 1, secondLength + 1];\n for (int i = 0; i <= firstLength; distances[i, 0] = i++) ;\n for (int j = 0; j <= secondLength; distances[0, j] = j++) ;\n\n for (int i = 1; i <= firstLength; i++)\n {\n for (int j = 1; j <= secondLength; j++)\n {\n int cost = second[j - 1] == first[i - 1] ? 0 : 1;\n distances[i, j] = Math.Min\n (\n Math.Min(distances[i - 1, j] + 1, distances[i, j - 1] + 1),\n distances[i - 1, j - 1] + cost\n );\n }\n }\n\n return distances[firstLength, secondLength];\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2b1b7a960174c0b035a043ed8d3e3052", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Algo\n{\n public class Task228\n {\n public static HashSet MakeSet(int[] ints)\n {\n return new HashSet(ints);\n }\n\n public static void Main(string[] args)\n {\n int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n Console.WriteLine(GetAnswer(a));\n }\n\n public static int GetAnswer(int[] a)\n {\n var set = MakeSet(a);\n\n return 4 - set.Count;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a815f8acfaa9953119928a9245ab986d", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass test\n{\n static void Main()\n {\n string []tmp = Console.ReadLine().Split();\n int a = int.Parse(tmp[0]);\n int b = int.Parse(tmp[1]);\n int c = int.Parse(tmp[2]);\n int d = int.Parse(tmp[3]);\n \n int temp = a;\n if(a == temp && b==temp && c ==temp && d==temp)\n {\n Console.WriteLine(\"3\");\n }\n else()\n {\n Console.WriteLine(\"1\");\n }\n }\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "afdc11cfa43689bfdde9d04594d04187", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n class MainClass\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int numberOfShoes = 0;\n\n List inputList = new List();\n inputList.Add(int.Parse(input[0]));\n for (int i = 1; i < input.Length; i++)\n {\n int shoe = int.Parse(input[i]);\n for(int j = 0; j < inputList.Count; j++)\n {\n if (inputList[j] == shoe)\n {\n numberOfShoes++;\n break;\n }\n }\n inputList.Add(shoe);\n }\n\n Console.WriteLine(numberOfShoes);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7418f1784eb0b88a0b69a282106f7362", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "Mono C#", "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 int[] colors = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int answer = 4 - colors.Distinct().Count();\n Console.WriteLine(answer);\n#if ONLINE_JUDGE\n#else\n Console.ReadKey();\n#endif\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aa9e2a2bd33d1f618ecaf041ecf2e598", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "Mono C#", "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 public static void Main(string[] args)\n {\n int[] colors = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int answer = 4 - colors.Distinct().Count();\n Console.WriteLine(answer);\n#if ONLINE_JUDGE\n#else\n Console.ReadKey();\n#endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "572cd12138ee83246ef7ece579011c42", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "Mono C#", "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 void Main(string[] args)\n {\n string[] shoes = Console.ReadLine().Split(\" \");\n int count = 0;\n for (int i = 0; i < 3; i++)\n {\n if (shoes[i] == shoes[i+1])\n {\n count++;\n }\n }\n Console.WriteLine(count);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "735d4711c1a319b79ef8ee674eff946c", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] colors = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int answer = 4 - colors.Distinct().Count();\n Console.WriteLine(answer);\n#if ONLINE_JUDGE\n#else\n Console.ReadKey();\n#endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a2054e091d1242d0143302f92c06f240", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tasks\n{\n class Tasks\n {\n static void Main(string[] args)\n {\n int[] colors = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int answer = 4 - colors.Distinct().Count();\n Console.WriteLine(answer);\n#if ONLINE_JUDGE\n#else\n Console.ReadKey();\n#endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d7e2672099ccb2b941009f6fc2638327", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "Mono C#", "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 void Main(string[] args)\n {\n var shoes = Console.ReadLine().Split(\" \");\n var sol = new List();\n\n for (int i = 0; i < 4; i++)\n {\n if (!sol.Contains(Convert.ToInt32(shoes[i])))\n {\n sol.Add(Convert.ToInt32(shoes[i]));\n }\n }\n\n Console.WriteLine(4 -sol.ToArray().Length);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "66e4f55f1caaf66ebf1267ebeb30900a", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "Mono C#", "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[] colors = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int answer = 4 - colors.Distinct().Count();\n Console.WriteLine(answer);\n#if ONLINE_JUDGE\n#else\n Console.ReadKey();\n#endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d6d8fa2d0113d0293ed8a1968d147ad7", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u043b\u0443\u043d\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens;\n\n string st = Console.ReadLine();\n int n=int.Parse(st);\n bool up=true;\n tokens= Console.ReadLine().Split();\n if (n == 1)\n {\n int a = int.Parse(tokens[0]);\n if (a == 15) Console.WriteLine(\"DOWN\");else\n if (a == 0) Console.WriteLine(\"UP\");else\n Console.WriteLine(-1);\n }\n else\n {\n int a, b;\n a = int.Parse(tokens[tokens.Length - 2]);\n b = int.Parse(tokens[tokens.Length - 1]);\n if (b < a) up = !up;\n if (b == 15 || b==0) up = !up;\n if (up) Console.WriteLine(\"UP\");\n else Console.WriteLine(\"DOWN\");\n }\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eb3979b2473f61a12c16c7721b376173", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u043b\u0443\u043d\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens;\n\n string st = Console.ReadLine();\n int n=int.Parse(st);\n bool up=true;\n tokens= Console.ReadLine().Split();\n if (n == 1) Console.WriteLine(-1);\n else\n {\n int a, b;\n a = int.Parse(tokens[tokens.Length - 2]);\n b = int.Parse(tokens[tokens.Length - 1]);\n if (b < a) up = !up;\n if (b == 15) up = !up;\n if (up) Console.WriteLine(\"UP\");\n else Console.WriteLine(\"DOWN\");\n }\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d4048620d1d3ba52cccf98fa64dc275", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.29424.173\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp1\", \"ConsoleApp1\\ConsoleApp1.csproj\", \"{9471B2F7-4CA7-4D0D-BD91-D59F4A992C02}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{9471B2F7-4CA7-4D0D-BD91-D59F4A992C02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{9471B2F7-4CA7-4D0D-BD91-D59F4A992C02}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{9471B2F7-4CA7-4D0D-BD91-D59F4A992C02}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{9471B2F7-4CA7-4D0D-BD91-D59F4A992C02}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {B94F39A0-E050-4998-9EA8-B4F7B36A08DC}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "935459e76188a09b2862941f6472565e", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using 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 string[] input = Console.ReadLine().Split();\n string[] rez = Console.ReadLine().Split();\n int[] lol = new int[3];\n\n for (int l = 0; l < input.Length; l++)\n {\n if (int.Parse(input[l]) - int.Parse(rez[l]) >= 0)\n lol[l] = 1;\n else\n lol[l] = 0;\n }\n\n int a = int.Parse(input[0]);\n int b = int.Parse(input[1]);\n int c = int.Parse(input[2]);\n int x = int.Parse(rez[0]);\n int y = int.Parse(rez[1]);\n int z = int.Parse(rez[2]);\n int i = lol[0];\n int j = lol[1];\n int k = lol[2];\n\n Console.WriteLine(rer);\n Console.WriteLine(pop);\n Console.WriteLine(3 / 2);\n if ((i * (a - x) + j * (b - y) + k * (c - z)) / 2 >= (1 - i) * -1 * (a - x) - (1 - j) * (b - y) - (1 - k) * (c - z))\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6722760910666a7f5ed8af40d5c24d02", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces_335\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int[] input1 = new int[3];\n for (int i = 0; i < input.Length; i++)\n {\n input1[i] = int.Parse(input[i]);\n }\n\n string[] rez = Console.ReadLine().Split();\n int[] rez1 = new int[3];\n for (int i = 0; i < rez.Length; i++)\n {\n rez1[i] = int.Parse(rez[i]);\n }\n\n bool f = false;\n\n int count = 0;\n for (int i = 0; i < input1.Length; i++)\n {\n if (input1[i] == rez1[i])\n count++;\n }\n if (count == 3)\n {\n f = true;\n goto Label1;\n }\n\n int a = input1.Sum();\n int b = rez1.Sum();\n\n if (a =< b )\n {\n f = false;\n goto Label1;\n }\n\n \n\n for (int i = 0; true; i++)\n {\n if (a - 2 == b)\n {\n f = true;\n break;\n }\n else\n a = a - 2;\n \n if(a + 1 == b)\n {\n f = false;\n break;\n } \n else\n {\n a = a + 1;\n } \n }\n\n Label1:\n if (f)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d105703e3773642f1b975e0500e7bdc6", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using 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 var a = ints[0];\n var b = ints[1];\n var stepps = ints[2];\n\n if (Math.Abs(a) + Math.Abs(b) <= stepps && (a + b - stepps) % 2 == 0)\n {\n WLine(\"Yes\");\n }\n else\n {\n WLine(\"No\");\n }\n\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 public static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n }\n}\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 var a = ints[0];\n var b = ints[1];\n var stepps = ints[2];\n\n if (a + b <= stepps && (a + b - stepps) % 2 == 0)\n {\n WLine(\"Yes\");\n }\n else\n {\n WLine(\"No\");\n }\n\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 public static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "912e9153097993e99f5c65dcd4b27058", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\n\n \n Debug\n x86\n {0A4645B1-EACC-4BD5-A836-243EF8E4F323}\n Exe\n maximum_in_table\n maximum_in_table\n v4.5\n \n \n true\n full\n false\n bin\\Debug\n DEBUG;\n prompt\n 4\n true\n x86\n \n \n full\n true\n bin\\Release\n prompt\n 4\n true\n x86\n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd8677538ac9b41e5fe6aa31734cefa3", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"maximum_in_table\", \"maximum_in_table\\maximum_in_table.csproj\", \"{0A4645B1-EACC-4BD5-A836-243EF8E4F323}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{0A4645B1-EACC-4BD5-A836-243EF8E4F323}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{0A4645B1-EACC-4BD5-A836-243EF8E4F323}.Debug|x86.Build.0 = Debug|x86\n\t\t{0A4645B1-EACC-4BD5-A836-243EF8E4F323}.Release|x86.ActiveCfg = Release|x86\n\t\t{0A4645B1-EACC-4BD5-A836-243EF8E4F323}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1252db7c18011cb02b4411695359e522", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {EDB296B5-DF93-4967-9698-D045A867CF8A}\n Exe\n Testerka\n Testerka\n v4.7.2\n 512\n true\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dcdb64bc2308cf6d7ae37eeb225c22f6", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class CodeForces\n{\n public 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "289fae067ae81d9a2d0da38f79b9a197", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.31101.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"prblm1\", \"prblm1\\prblm1.csproj\", \"{8396EFD4-0C62-481C-A1AE-DD19D042BCE6}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{8396EFD4-0C62-481C-A1AE-DD19D042BCE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{8396EFD4-0C62-481C-A1AE-DD19D042BCE6}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{8396EFD4-0C62-481C-A1AE-DD19D042BCE6}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{8396EFD4-0C62-481C-A1AE-DD19D042BCE6}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "566b58a01465d6e93473993dfb3b8cef", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.28803.352\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Testerka\", \"Testerka.csproj\", \"{EDB296B5-DF93-4967-9698-D045A867CF8A}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{EDB296B5-DF93-4967-9698-D045A867CF8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{EDB296B5-DF93-4967-9698-D045A867CF8A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{EDB296B5-DF93-4967-9698-D045A867CF8A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{EDB296B5-DF93-4967-9698-D045A867CF8A}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {7C8D704E-5175-439A-ABB8-CE25B3D699C1}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "93bac9f9489b86865e9cb6dccc70e005", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\npublic class Program\n{\n\n public static void Main()\n {\n\t\tint[][] arr = new int[10][10];\n\t\tint a = int.Parse(Console.ReadLine());\n\t\tfor (int i = 0; i < a; i++) {\n\t\t\tfor (int j = 0; j < a; j++) {\n\t\t\t\tif (i == 0) {\n\t\t\t\t\tarr[i][j] = 1;\n\t\t\t\t} else if (j == 0) {\n\t\t\t\t\tarr[i][j] = 1;\n\t\t\t\t} else {\n\t\t\t\t\tarr[i][j] = arr[i - 1][j] + arr[i][j - 1];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(arr[a - 1][a - 1]);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ebc28320d945c69dbbd38018ba9a91ec", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "MS C#", "source_code": "//#include \n//using namespace std;\n//int main()\n//{\n//\tint arr[] = { 4, 2, 7, 7, 88, 0, 10, -8, 7, 9 };\n//\tint input, count = 0;\n//\tcin >> input;\n//\tfor (int i = 0; i < 9; i++)\n//\t{\n//\t\tfor (int j = 0; j < 9; j++)\n//\t\t{\n//\t\t\tif (arr[j] == input)\n//\t\t\t{\n//\t\t\t\tint temp = arr[j];\n//\t\t\t\tarr[j] = arr[j + 1];\n//\t\t\t\tarr[j + 1] = temp;\n//\t\t\t}\n//\t\t}\n//\t}\n//\n//\tfor (int i = 0; i < 10; i++)\n//\t{\n//\t\tif (arr[i] == input)\n//\t\t{\n//\t\t\tcount++;\n//\t\t}\n//\t}\n//\n//\tfor (int k = 0; k < 10-count; k++)\n//\t{\n//\t\tcout << arr[k] << \" \";\n//\t}\n//}\n\n#include\n#include\"Header.h\"\n#include \nusing namespace std;\n\nvoid main()\n{\n\tint x = 2;\n\tcout << x << endl;\n\tf1();\n\tcout << x << endl;\n\tf2();\n\tcout << x << endl;\n\n\tint ** arr = new int*[5]; // pointer to pointer declaration\n\tint i;\n\tfor (i = 0; i < 10; i++);\n\n\tcout << i;\n\tstruct product\n\t{\n\t\tint weight;\n\t\tfloat price;\n\t}apples, bananas;\n\n\tproduct gold = {};\n\n\tproduct bagOfFlour = { 1 , 10 }, bagOfSugar;\n\n\t\n\n}\n\nvoid f1()\n{\n\tint x = 3;\n}\nvoid f2()\n{\n\tint x = 4;\n}\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e25684799e7c2a7aea70c836391ba977", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using Octokit;\nusing System;\nusing System.Collections.Generic;\nusing System.Configuration;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n int counter = 0;\n\n for(int index =0; index < x.Length/2; ++index)\n {\n if (x[index] != x[x.Length - index - 1])\n {\n counter++;\n }\n }\n if (counter > 1)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n //Console.WriteLine(counter);\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1e158c43d0ff9015c237130bcca6ea61", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _3_4\n{\n class Program\n {\n static void Main(string[] args)\n {\n tring str = Console.ReadLine();\n int count = 0;\n\n for (int i = 0; i < str.Length / 2; i++)\n if (str[i] != str[str.Length - i - 1])\n count++;\n\n if (count == 1 || (count == 0 && (str.Length % 2) == 1))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c836523eba07d9ea5a0f123421311876", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n \n\ninternal class Program\n{\n\tstatic void Main()\n\t{\n\t\tstring obj1; \n\t\tobj1 = Console.ReadLine();\n\t\tchar[] obj2=new char[obj1.Length];\n\t\t \n\t\tint index = 0;\n\t\tfor (int i = obj1.Length-1; i >=0 ; i--)\n\t\t{\n\t\t\tobj2[index] = (char)obj1[i];\n\t\t\t++index;\n\t\t}\n\t\tint n = 0;\n\t\tfor (int k = 0; k < obj1.Length; k++)\n\t\t{\n\t\t\tif ((char)obj1[k] != obj2[k])\n\n\t\t\t\t++n;\n\t\t}\n\t\tif (n == 2|| n==0)\n\t\t{\n\t\t\tConsole.WriteLine(\"YES\");\n\n\t\t}\n\t\telse\n\t\t\tConsole.WriteLine(\"NO\");\n\n\t\t\t \n\t}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "15d73e3d3f4467f2872f972cdd0a6b6e", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0} {"lang": "MS C#", "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 s = Console.ReadLine();\n int k = 0;int e =0;\n for (int i = 0; i < s.Length/2; i++)\n\t\t\t{\n\t\t\t if(s[i]!=s[s.Length-1-i]){e=i;k++;}\n\t\t\t}\n if(k>1) Console.WriteLine(\"NO\");\n else\nConsole.WriteLine(\"YES\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "48920c9f698707811118cdbf6f73f65c", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n double n,m;\n int answer = 0;\n cin >> n >> m;\n for (double a = 0; a <= 100; a++)\n for (double b = 0; b<=100; b++)\n if(pow(a,2)+b==n && pow(b,2) + a == m)\n answer++;\n cout << answer << endl;\n return 0;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f425969ae99b1176c16f89cf46829175", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "int count = 0;\n string s = Console.ReadLine();\n string[] words = s.Split(' ');\n int n = Convert.ToInt32(words[0]);\n int m = Convert.ToInt32(words[1]); \n for (int i = 0; i < 33; i++)\n {\n for (int g = 0; g < 33; g++)\n {\n if ((i * i + g) == n)\n {\n if ((i + g*g) == m)\n {\n count++; \n }\n }\n }\n }\n Console.WriteLine(count);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "075e93263518c49fd37221013761eb5b", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "static void Main(string[] args)\n {\n int count = 0;\n string s = Console.ReadLine();\n string[] words = s.Split(' ');\n int n = Convert.ToInt32(words[0]);\n int m = Convert.ToInt32(words[1]);\n Console.WriteLine(n + m);\n for (int i = 0; i < 33; i++)\n {\n for (int g = 0; g < 33; g++)\n {\n if ((i * i + g) == n)\n {\n if ((g*g + i) == m)\n {\n count++; \n }\n }\n }\n }\n Console.WriteLine(count); \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b6b956caf8aa52323d3e07f3d330170", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " static void Main(string[] args)\n {\n int count = 0;\n string s = Console.ReadLine();\n string[] words = s.Split(' ');\n int n = Convert.ToInt32(words[0]);\n int m = Convert.ToInt32(words[1]); \n for (int i = 0; i < 33; i++)\n {\n for (int g = 0; g < 33; g++)\n {\n if ((i * i + g) == n)\n {\n if ((g*g + i) == m)\n {\n count++; \n }\n }\n }\n }\n Console.WriteLine(count); \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7877236fe042e7f908638390dc14468d", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\n{\n class Program\n {\n static void Main(string[] args)\n {\n string h = Console.ReadLine();\n\n int m = Convert.ToInt32(h.Substring(0, 1));\n int n = Convert.ToInt32(h.Substring(2, 1));\n\n int s = 0;\n int p = 0;\n int a = 0, b = 0, q = 0;\n\n if (m > n)\n {\n q = Convert.ToInt32(Math.Sqrt(m));\n while (s <= m)\n {\n if (q * q + s == m)\n {\n a = q;\n b = m - q * q;\n\n if (a + b * b == n)\n {\n p++;\n }\n }\n s = s + 1;\n }\n }\n\n else\n {\n q = Convert.ToInt32(Math.Sqrt(n));\n\n while (s <= n)\n {\n if (q * q + s == n)\n {\n b = q;\n a = n - q * q;\n\n if (a * a + b == m)\n {\n p++;\n }\n }\n s = s + 1;\n }\n }\n\n Console.WriteLine(p);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4e000cb546b367f9483a38492bc3ca8a", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {5C37D815-990F-4621-B7C8-5B25B5E1642A}\n Exe\n Properties\n \u0421\u0438\u0441\u0442\u0435\u043c\u0430_\u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439\n \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439\n v4.0\n Client\n 512\n \n \n x86\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n x86\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "23ad2d92d9643aa2fb168f6c9bb03a61", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "int count = 0;\n string s = Console.ReadLine();\n string[] words = s.Split(' ');\n int n = Convert.ToInt32(words[0]);\n int m = Convert.ToInt32(words[1]);\n Console.WriteLine(n + m);\n for (int i = 0; i < 33; i++)\n {\n for (int g = 0; g < 33; g++)\n {\n if ((i * i + g) == n)\n {\n if ((g*g + i) == m)\n {\n count++; \n }\n }\n }\n }\n Console.WriteLine(count); ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e41031e60beb3f225f4b305c4d7f6df0", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nclass PerfectNumber{\n static long sumOfDigits(long n){\n long sum = 0;\n while(n>0){\n sum+=(n%10);\n n = n/10;\n }\n return sum;\n }\n static long getPerfect(int n){\n long num = 19;\n if(n==1){\n return 19;\n }\n for(int i=2;i<=n;i++){\n while(true){\n num+=9;\n if(sumOfDigits(num) == 10){\n break;\n }\n }\n if(i == n){\n return num;\n }\n }\n return num;\n }\n static void Main(string[] args){\n int n = Convert.ToInt32(Console.ReadLine().Trim());\n Console.WriteLine(getPerfect(i));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b7b049938231672ef05adf622ed05b7b", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "namespace Practic\n{ \n class Program\n {\n \n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n string ans = \"\";ans += k.ToString();\n string p = k.ToString();int sm = 0;\n for (int i = 0; i < p.Length; i++)\n sm += p[i] - '0';\n ans += (10 - sm).ToString();\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8e33bcb6ec58e4d7184dd6788b75fbc3", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CSharp\n{\n internal static class Program\n {\n private static void Main(string[] args)\n {\n \n PerfectNumber(int.Parse(Console.ReadLine()));\n }\n\n private static void PerfectNumber(int k)\n {\n string temp = k.ToString();\n int diff = k - SumValue(k);\n\n if (temp.Contains('0'))\n temp = temp.Replace('0', char.Parse(diff.ToString()));\n else\n temp += diff;\n\n Console.WriteLine(temp);\n }\n\n private static int SumValue(int k)\n {\n int sum = 0;\n int digitCount = DigitCount(k);\n\n for (int i = 0; i <= digitCount; i++)\n {\n sum += k / (int)Math.Pow(10, i) % 10;\n }\n\n return sum;\n }\n\n private static int DigitCount(int k)\n {\n return (int)Math.Log(k, 10);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "18507c24683d0199df1b167dd803407a", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "#define DEBUG\n\nusing 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\n\tclass MainClass\n\t{\n\t\tconst int Limit = (int)1e9 + 777;\n\n\t\tpublic static bool Check(int x)\n\t\t{\n\t\t\tint Sum = 0;\n\t\t\twhile (x > 0)\n\t\t\t{\n\t\t\t\tSum += x % 10;\n\t\t\t\tx /= 10;\n\t\t\t}\n\t\t\treturn (Sum % 10 == 0) ? true : false;\n\t\t}\n\n\t\tpublic static void Brute(int numb)\n\t\t{\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 1; i < Limit; ++i)\n\t\t\t{\n\t\t\t\tif (Check(i) == true)\n\t\t\t\t\tcnt++;\n\t\t\t\tif (cnt == numb)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(i);\n\t\t\t\t\tbreak;1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tint numb = Reader.NextInt();\n\t\t\tBrute(numb);\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "248f98a9e67d8eeee503f571d2c1e9fb", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": " int k =int.Parse( Console.ReadLine());\n\n for (int i =k; i < 10000; i++)\n {\n for(int j = 1; j < 10000; j++)\n {\n if (i + j == 10)\n {\n Console.WriteLine((int.Parse(i.ToString() + j.ToString())));\n break;\n }\n }\n break;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9fc8211f662ab459682eda1803764580", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {96676745-3910-413A-BC2B-70847196AADC}\n Exe\n Properties\n ProblemB\n ProblemB\n v4.0\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ceeb7a93683a69c79c2a9e16a9ce614c", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace ACM_CS\n{\n class Program\n {\n #region utility\n static char ReadChar()\n {\n return (char)Console.Read();\n }\n static string ReadWord()\n {\n var str = string.Empty;\n while (true)\n {\n var chr = ReadChar();\n if (chr != ' ')\n {\n str += chr;\n break;\n }\n }//skip empty start\n while (true)\n {\n var chr = ReadChar();\n if (chr == ' ' || chr == '\\n') break;\n str += chr;\n }\n return str;\n }\n static int ReadInt()\n {\n return int.Parse(ReadWord());\n }\n static long ReadLong()\n {\n return long.Parse(ReadWord());\n }\n #endregion\n\n static void Main(string[] args)\n {\n dfdsfsdf;\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f9d24f454e736cd6ac1b0e18ccd09641", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "difficulty": 1300.0} {"lang": "MS C#", "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 n = long.Parse(numbers[0]);\n\t\t\tvar m = long.Parse(numbers[1]);\n\n\t\t\tlong min = 0;\n\t\t\t//find min\n\t\t\tif (n%m == 0)\n\t\t\t{\n\t\t\t\tvar numberOfPersonInEachGroup = n/m;\n\t\t\t\tvar combinations = CalcCombintaionNumber(numberOfPersonInEachGroup);\n\t\t\t\tmin = combinations*m;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar x = n/m;\n\t\t\t\tvar y = x + n%m;\n\n\t\t\t\tvar combinations1 = CalcCombintaionNumber(x) * (m -1);\n\t\t\t\tvar combintaions2 = CalcCombintaionNumber(y);\n\n\t\t\t\tmin = combinations1 + combintaions2;\n\t\t\t}\n\n\t\t\t//find max\n\t\t\tvar numberOfPersonsInLargestGroup = n - m + 1;\n\t\t\tvar max = CalcCombintaionNumber(numberOfPersonsInLargestGroup);\n\n\t\t\tConsole.WriteLine($\"{min} {max}\");\n\t\t}\n\n\n\n\t\tstatic long CalcCombintaionNumber(long n)\n\t\t{\n\t\t\treturn ((n - 1)*n)/2;\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "56a53614b6cc3f281a1d580e2810048b", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\n\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().Split(\" \");\n\n int d1 = Convert.ToInt32(n[0]);\n int d2 = Convert.ToInt32(n[1]);\n int d3 = Convert.ToInt32(n[2]);\n\n if ((d1+d2) black)\n {\n Console.WriteLine(\"Black\");\n }\n else if (white == black)\n {\n Console.WriteLine(\"White\");\n }\n else\n {\n Console.WriteLine(\"White\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c786ce8b0e2983c838d15569ce8cc741", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "Mono C#", "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 static int max(int a, int b)\n {\n if(a>=b)\n return a;\n else \n return b;\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n long int x = int.Parse(s[0]);\n long int y = int.Parse(s[1]);\n int a = max(x-1,y-1);\n int b = max(n-x,n-y);\n if(a<=b)\n Console.WriteLine(\"White\");\n else\n Console.WriteLine(\"Black\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aa9e49af27db837ca2fa6e6d63b789ac", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "Mono C#", "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 #region A. Diverse Substring\n float ca = int.Parse(Console.ReadLine());\n int aa = int.Parse(Math.Ceiling(ca / 2.0)+\"\");\n string word = Console.ReadLine();\n int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0,\n j = 0, k = 0, l = 0, m = 0, n = 0, o = 0, p = 0, q = 0, r = 0,\n s = 0, t = 0, u = 0, v = 0, w = 0, x = 0, y = 0, z = 0;\n bool cs = false;\n foreach (char ch in word)\n {\n if (ch == 'a')\n a++;\n if (ch == 'b')\n b++;\n if (ch == 'c')\n c++;\n if (ch == 'd')\n d++;\n if (ch == 'e')\n e++;\n if (ch == 'f')\n f++;\n if (ch == 'g')\n g++;\n if (ch == 'h')\n h++;\n if (ch == 'i')\n i++;\n if (ch == 'j')\n j++;\n if (ch == 'k')\n k++;\n if (ch == 'l')\n l++;\n if (ch == 'm')\n m++;\n if (ch == 'n')\n n++;\n if (ch == 'o')\n o++;\n if (ch == 'p')\n p++;\n if (ch == 'q')\n q++;\n if (ch == 'r')\n r++;\n if (ch == 's')\n s++;\n if (ch == 't')\n t++;\n if (ch == 'u')\n u++;\n if (ch == 'v')\n v++;\n if (ch == 'w')\n w++;\n if (ch == 'x')\n x++;\n if (ch == 'y')\n y++;\n if (ch == 'z')\n z++;\n if((aa <= a) \n || (aa <= b)\n || (aa <= c)\n || (aa <= d)\n || (aa <= e)\n || (aa <= f)\n || (aa <= g)\n || (aa <= h)\n || (aa <= i)\n || (aa <= j)\n || (aa <= k)\n || (aa <= l)\n || (aa <= m)\n || (aa <= n)\n || (aa <= o)\n || (aa <= p)\n || (aa <= q)\n || (aa <= r)\n || (aa <= s)\n || (aa <= t)\n || (aa <= u)\n || (aa <= v)\n || (aa <= w)\n || (aa <= x)\n || (aa <= y)\n || (aa <= z))\n {\n cs = true;\n break;\n }\n }\n if(cs)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(word[0] + \"\"+ word[1]);\n }\n #endregion\n \n #endregion\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "39de935bc545db2c1ee8af0a5445ea3e", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Cakeminator\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 r = int.Parse(input[0]);\n int c = int.Parse(input[1]);\n\n string[] cake = new string[r];\n\n int count = 0; \n for(int i=0; i numbers = new List(); // \uc8fc\uc5b4\uc9c0\ub294 \uc22b\uc790\n\n foreach (var item in temp)\n {\n numbers.Add(int.Parse(item.ToString()));\n }\n\n // \ubb34\uc870\uac74 0 \uc774\uc0c1\uc774 \ubcf4\uc7a5\ub418\ub2c8, \uc2a4\ud0dd\uc774 \ube4c \uacbd\uc6b0\uc758 \uc608\uc678\ucc98\ub9ac\ub294 \ud544\uc694\uc5c6\uc74c\n for (int i = 0; i < k; i++)\n {\n if (numbers[numbers.Count - 1] == 0)\n {\n numbers.RemoveAt(numbers.Count - 1); \n }\n else\n {\n numbers[numbers.Count - 1]--;\n }\n }\n\n // stringbuilder\uc5d0 \ud574\ub2f9 \uc790\ub9bf\uc218\ub4e4\uc744 \ud569\uccd0\uc11c \ucd9c\ub825\n foreach (var item in numbers)\n {\n sb.Append(item);\n }\n\n Console.Write(sb.ToString());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eaab53d3605661ef9db5cb897c86921e", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 int n = Convert.ToInt32(Console.ReadLine());\n int k = Convert.ToInt32(Console.ReadLine());\n\n for (int i = 0; i k; i++ )\n {\n if (n % 10 == 0)\n {\n n = n / 10;\n } else\n {\n n--;\n }\n }\n\n Console.WriteLine(n);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3ec3891135d67c9cf0e9ef212128a3b5", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing namespace test\n{\n class Program\n {\n static void Main(String[] args)\n {\n string[] sa = Console.ReadLine().split(' ');\n int a = Convert.ToInt32(sa[0]);\n int b = Convert.ToInt32(sa[1]);\n for(int i=0;i\n\n \n Exe\n netcoreapp3.1\n \n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "921f490164f97d9d2fd7dd4431eed380", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffnamespace Wrong_Subtraction\n{\n class Solution\n {\n public int Wrong_Substraction(int n, int k)\n {\n int answer = n;\n for (int i = 1; i < k + 1; i++)\n {\n int last = answer % 10;\n if (last != 0)\n answer -= 1;\n else\n answer /= 10;\n }\n return answer;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "29be66bbc924b10399d50228a163bfef", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp5\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 int k = int.Parse(s[1]);\n for (int i = 0; i < k; i++)\n {\n if (n.ToString().EndsWith('0'))\n n /= 10;\n else n--;\n }\n Console.WriteLine(n);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "236ca5b5e00688e04ff468f6285a81f9", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "import System;\n\nclass TestClass\n{\n static void Main(string[] args)\n {\n String s = Console.ReadLine();\n \n String[] values = s.split(\" \").toArray();\n \n String value1 = values[0];\n String value2 = values[1];\n \n int valueInt = Convert.toInt32(value1);\n for( int i = 0 ; i < value2 ; i++){\n \n if (valueInt % 10 != 0)\n {\n valueInt = valueInt - 1;\n } else {\n valueInt = valueInt/10;\n }\n \n }\n System.Console.WriteLine(valueInt);\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "630ede2be0e0de081c47c2c84da02399", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n \n namespace Wrong_Subtraction\n {\n class Program\n {\n static void Main(string[] args)\n {\n int n, k;\n int i = 0;\n while (i> test = b => b.ToBookDto();\n Expression> generatedExpr = new ExpandableVisitor().Visit(test) as Expression>;\n Expression> generatedExpr2 = new ExpandableVisitor2().Visit(test) as Expression>;\n Expression> sameAsGeneratedExpr = b => new BookDto()\n {\n Id = b.Id,\n Author = new AuthorDto()\n {\n Id = b.Author.Id,\n Books = b.Author.Books.Select(b1 => new BookDto()\n {\n Id = b1.Id,\n Author = new AuthorDto()\n {\n Id = b1.Author.Id,\n Books = b1.Author.Books.Select(b2 => new BookDto()\n {\n Id = b2.Id,\n Author = new AuthorDto()\n {\n Id = b2.Author.Id,\n Books = b2.Author.Books.Select(b3 => new BookDto()\n {\n Id = b3.Id,\n Author = new AuthorDto()\n {\n Id = b3.Author.Id,\n Books = b3.Author.Books.Select(b4 => new BookDto()\n {\n Id = b4.Id,\n Author = new AuthorDto()\n {\n Id = b4.Author.Id,\n Books = b4.Author.Books.Select(b5 => b5.ToBookDto()).ToList()\n }\n }).ToList()\n }\n }).ToList()\n }\n }).ToList()\n }\n }).ToList()\n }\n };\n bool haveTheSameStringOutput = generatedExpr2.ToString() == sameAsGeneratedExpr.ToString(); // True\n bool areTheSame = ExpressionEqualityComparer.Instance.Equals(generatedExpr, sameAsGeneratedExpr); // True\n\n using (AppDbContext dbContext = new AppDbContext(new Microsoft.EntityFrameworkCore.DbContextOptions { }))\n {\n IQueryable queryable = dbContext.Books.Select(generatedExpr);\n //IQueryable queryable = dbContext.Books.Select(sameAsGeneratedExpr);\n\n var result = queryable.Select(bDto => new BookDto\n {\n Id = bDto.Id,\n Name = bDto.Name,\n Author = new AuthorDto\n {\n Id = bDto.Author.Id,\n Books = bDto.Author.Books.Select(bDto1 => new BookDto\n {\n Id = bDto1.Id,\n Author = new AuthorDto\n {\n Id = bDto.Author.Id,\n Books = bDto.Author.Books.Select(bDto1 => new BookDto\n {\n Id = bDto1.Id\n })\n }\n })\n }\n }).ToList();\n result.ForEach(i => Console.WriteLine(i.Id));\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7b05a5c0e440baab6351de6638f833f4", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "var input = Console.ReadLine();\n var n = Convert.ToInt32(input.Split(' ')[0]);\n var k = Convert.ToInt32(input.Split(' ')[1]);\n\n for (int i = 0; i < k; i++)\n {\n if (n % 10 == 0)\n {\n n = n / 10;\n }\n else\n {\n n--;\n }\n }\n\n Console.WriteLine(n);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2dcb63750e867eed9072c8951496145e", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "static void Main(string[] args){\n string s = Console.ReadLine();\n int n = Convert.ToInt32(s.Split(' ')[0]);\n int k = Convert.ToInt32(s.Split(' ')[1]);\n for (; k > 0; k--)\n {\n if (n % 10 == 0) n /= 10;\n else n -= 1;\n }\n Console.WriteLine(\"{0}\", n);\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "72de206954440e18d2e2d971cd2835c8", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace WrongSubstraction\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = /Console.ReadLine();\n string[] arr = str.Split(null);\n Int32.TryParse(arr[0], out int n);\n Int32.TryParse(arr[1], out int k);\n for (int i = 0;i 0)\n {\n var a = n[0].ToString();\n n[0] = (int.Parse(a) - 1).ToString().ToCharArray().First();\n }\n }\n Console.WriteLine(new string(n.Reverse().ToArray()));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a2da1087e925a5e8b29f4f7c599b3458", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n var input = Console.ReadLine().Split();\n var num = int.Parse(input[0])\n var i = int.Parse(input[1]);\n while(i-- > 0)\n num = num % 10 == 0 ? num / 10 : num - 1;\n Console.WriteLine(num);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "59c383f3a10b70fed46ba36b3102de4f", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " static int wrongSubtract(int n, int k)\n {\n for(int i = 0;i < k; i++)\n {\n if (n.ToString()[n.ToString().Length - 1] != '0')\n n--;\n else\n n /= 10;\n }\n return n; \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a492f0938e491dd3b8c612d17f41b5bb", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n \n namespace Wrong_Subtraction\n {\n class Program\n {\n static void Main(string[] args)\n {\n int i = 0;\n while (i0)\n {\n num=(num%10==0)?(num/10):(num-1);\n }\n Console.WriteLine(num);\n \n \n \n \n \n }\n \n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "739e40ac58137f9736ffa61f842a7b50", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "public class WrongSubtraction{\n static void Main(string[] args){\n int n, k;\n n = int.Parse(Console.ReadLine());\n k = int.Parse(Console.ReadLine());\n for(int i = 0; i < k; i ++){\n n = (n % 10 == 0? n / 10 : n - 1);\n }\n return n;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2de29fe31387d2afab9c460b802ecb7a", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {EF594BBD-D4E4-4B9E-A70B-94B4380B2F43}\n Exe\n Code\n Code\n v4.6.1\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aaf0b47646281cdb4445bda8c9929c0c", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.29911.84\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp3\", \"ConsoleApp3.csproj\", \"{268D94DF-7661-48F7-84DF-B320A66550F3}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{268D94DF-7661-48F7-84DF-B320A66550F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{268D94DF-7661-48F7-84DF-B320A66550F3}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{268D94DF-7661-48F7-84DF-B320A66550F3}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{268D94DF-7661-48F7-84DF-B320A66550F3}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {D9B8385F-F20B-4800-8954-D2BCC588ECF1}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5d24c23207e9a8aad5a58d768afe8917", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace CodeForces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t //real input:\n\t\t\tint num = Convert.ToInt32(Console.ReadLine());\n\t\t\tint times = Convert.ToInt32(Console.ReadLine());\n\t\t\t\n\t\t\t//test input:\n\t\t\t//int num = 512; \n //int times = 4;\n \n \n for (int i=0 ; i0)\n {\n d = n % 10;\n if (d == 0)\n n /= 10;\n else\n n -= 1;\n k--;\n }\n \n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "59e6ac3b8d4fdd5103d409491e8e5574", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "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 s;\n s = Console.ReadLine();\n s = s.ToLower();\n s = s.Replace('a', ' ');\n s = s.Replace('o', ' ');\n s = s.Replace('y', ' ');\n s = s.Replace('i', ' ');\n s = s.Replace('e', ' ');\n s = s.Replace('u', ' ');\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ' ')\n {\n Console.Write('.');\n Console.Write(s[i]);\n }\n }\n Console.ReadLine();\n }\n }\n}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 s;\n s = Console.ReadLine();\n s = s.ToLower();\n s = s.Replace('A', ' ');\n s = s.Replace('o', ' ');\n s = s.Replace('y', ' ');\n s = s.Replace('i', ' ');\n s = s.Replace('e', ' ');\n s = s.Replace('u', ' ');\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ' ')\n {\n Console.Write('.');\n Console.Write(s[i]);\n }\n }\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "958c9a28b352b9790903d1c7e4d042dc", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace prob5_String_Task\n{\n class Program\n {\n static void Main(string[] args)\n {\n var Input =Console.ReadLine() ;\n var newStringsList = new List();\n var removingVowels = RemovingVowels(Input, newStringsList);\n Console.WriteLine(removingVowels);\n\n string RemovingVowels(string input, List stringsList)\n {\n if (input.Length > 0 && input.Length <= 100) \n foreach(char character in input)\n {\n if ( character != 'A' && character != 'E' && character != 'I' && character != 'O' && character != 'U' && character != 'a' && character != 'e' && character != 'e' && character != 'o' && character != 'u' && character != ' ')\n { \n var letter = char.ToString(character);\n stringsList.Add(\".\");\n stringsList.Add(letter);\n }\n }\n var noVowel = string.Join(\"\",stringsList) ;\n var output = noVowel.ToLower();\n return output;\n\n }\n\n\n\n\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8ecd3c525697252c733ef4c4f5d0d885", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace elwinchen\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x;\n x = Console.ReadLine();\n \n for(int i=0; i0)\n {\n int counter1 = y.Length;\n int counter2 = 0;\n for (int i = 0; i < x.Length; i++)\n {\n counter1--;\n if (x[i] == y[counter1])\n {\n counter2++;\n }\n\n }\n if (counter2 == x.Length)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cc4aa95ff243100dc8aa18081730d919", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _118A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n foreach (var c in input)\n {\n switch (c)\n {\n case 'A':\n case 'a':\n case 'O':\n case 'o':\n case 'Y':\n case 'y':\n case 'E':\n case 'e':\n case 'U':\n case 'u':\n case 'I':\n case 'i':\n break;\n default:\n Console.Write('.'.ToString() + char.ToLower(c).ToString());\n break;\n }\n }\n }\n }\n}\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _118A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n foreach (var c in input)\n {\n switch (c)\n {\n case 'A':\n case 'a':\n case 'O':\n case 'o':\n case 'Y':\n case 'y':\n case 'E':\n case 'e':\n case 'U':\n case 'u':\n case 'I':\n case 'i':\n break;\n default:\n Console.Write('.' + char.ToLower(c));\n break;\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d23b876a820f5307b04a1144b840ddce", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar str = Console.ReadLine();\n\t\tchar[] vowels = {'a', 'o', 'y', 'e', 'u', 'i'};\n\t\tfor (int i = 0; i < str; i++)\n\t\t{\n\t\t\tbool isConsonants = true;\n\t\t\tforeach (var item in vowels)\n\t\t\t{\n\t\t\t\tif (str[i] == item)\n\t\t\t\t{\n\t\t\t\t\tisConsonants = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isConsonants)\n\t\t\t{\n\t\t\t\tConsole.Write(\".{0}\", str[i]);\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine();\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9e100a512aa3367af53a57c1cda92bf5", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Solution\n{\n class Program\n {\n static void Main()\n {\n string word = Console.ReadLine();\n\n for (int i = 0; i < word.Length; i++)\n {\n if (!IsVowelChar(word[i]))\n {\n char lowerElemet = word[i];\n if (char.IsUpper(word[i]))\n {\n lowerElemet = char.ToLower(word[i]);\n }\n Console.Write('.');\n Console.Write(lowerElemet);\n }\n }\n\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4f4488ab609207d3cba606b8993645b9", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nclass String_Task\n{\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n int len = str1.Length;\n int i=0;\n string str=str1.ToLower();\n while (i\n\n \n \n Debug\n AnyCPU\n {172719EF-07FA-485C-A80C-3743D7DDF212}\n Exe\n _118A\n 118A\n v4.7.2\n 512\n true\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9bfedf348c0828708a6018d306702036", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "class Program\n{\n static void Main()\n {\n string del = \"aoeuyi\";\n string a = Console.ReadLine().ToLower();\n\n string result = \"\";\n\n for(int i = 0; i < a.Length; ++i)\n {\n if (del.Contains(a[i]) == true)\n {\n a = a.Remove(i,1);\n --i;\n continue;\n }\n }\n\n for(int i = 0; i < a.Length; ++i)\n {\n result = result + '.' + a[i];\n }\n Console.WriteLine(result);\n } \n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fddcd342f4f4fcb60880918e015c142a", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace prob5_String_Task\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Input =Console.ReadLine() ;\n var newStringsList = new List();\n var removingVowels = RemovingVowels(Input, newStringsList);\n Console.WriteLine(removingVowels);\n\n String RemovingVowels ( string input , List stringsList) { \n \n if (input.Length > 0 && input.Length <= 100) \n foreach(char character in input)\n {\n if ( character != 'A' && character != 'E' && character != 'I' && character != 'O' && character != 'U' && character != 'a' && character != 'e' && character != 'e' && character != 'o' && character != 'u' && character != ' ')\n { \n var letter = char.ToString(character);\n stringsList.Add(\".\");\n stringsList.Add(letter);\n }\n }\n string noVowel = string.Join(\"\",stringsList) ;\n string output = noVowel.ToLower();\n return output;\n };\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dce141b8d96c8b51351f86c394c61daf", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "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\n\n string input = Console.ReadLine().ToLower();\n char[] vowels = { 'a', 'o', 'y', 'e', 'u', 'i' };\n foreach (var i in input)\n\t {\n\t\t if (!vowels.Contains(i))\n {\n Console.WriteLine(\".\");\n Console.WriteLine(i.ToString());\n }\n\t }\n \n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "48d35e635032e4415ca83c114da4fddd", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string vowels = \"aeyiou\";\n string result = \"\";\n input = input.ToLower();\n foreach (var letter in input)\n if(!vowels.Contains(letter))\n result += \".\" + letter;\n Console.WriteLine(result);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9cbd15baf9a785ad111bd977d6b13d2f", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "string key = Console.ReadLine();\n string final = \"\" , ans =\"\" ;\n int n = 0;\n for (int i = 0; i < key.Length; i++) \n {\n if ((key.Substring(i, 1)).ToLower() == \"a\" ||\n (key.Substring(i, 1)).ToLower() == \"o\" ||\n (key.Substring(i, 1)).ToLower() == \"y\" ||\n (key.Substring(i, 1)).ToLower() == \"e\" ||\n (key.Substring(i, 1)).ToLower() == \"u\" ||\n (key.Substring(i, 1)).ToLower() == \"i\") //\"A\", \"O\", \"Y\", \"E\", \"U\", \"I\"\n {\n n++;\n }else {\n final += key.Substring(i, 1);\n }\n }\n for (int i = 0; i < final.Length; i++) \n {\n ans += \".\" + final.Substring(i,1);\n }\n Console.WriteLine(ans);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "583970f7d5d02b75b4c9e4d8ec47c0f3", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "var vowels = new[] {'a', 'A', 'o', 'O', 'y', 'Y', 'e', 'E', 'u', 'U', 'i', 'I'};\n var str = Console.ReadLine();\n foreach (var ch in str)\n {\n if (vowels.Contains(ch))\n continue;\n Console.Write('.');\n Console.Write(Char.ToLower(ch));\n }\n Console.WriteLine();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "19a19ece0af21800744110d138744e3e", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "string word = Console.ReadLine().ToLower();\n\t\t\tchar[] vowel = { 'a', 'e', 'i', 'o', 'u','y'};\n\t\t\tString newword = \"\";\n\n\t\t\tforeach(char ch in word)\n\t\t\t{\n\t\t\t\tforeach(char v in vowel)\n\t\t\t\t{\n\t\t\t\t\tif (ch == v)\n\t\t\t\t\t{\n\t\t\t\t\t\tword = word.Replace(ch.ToString(), String.Empty);\n\t\t\t\t\t}\n\t\t\t\t}\t\n\n\t\t\t}\n\n\n\t\t\tforeach(char con in word)\n\t\t\t{\n\t\t\t\tnewword = newword + \".\" + con;\n\t\t\t}\n\n\n\t\t\tConsole.WriteLine(newword);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bb4756bbf35824c0a8eb69fdf4f78c18", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace sp{\n class Program{\n static void Main(){\n string s = Console.Readline();\n string result = '';\n \n for(int i = 0;i () {\n 'a',\n 'e',\n 'i',\n 'o',\n 'u',\n 'y'\n };\n\n inpList.RemoveAll(x => vowels.Contains(x));\n string res = \"\";\n for(int i = 0; i < inpList.Count; i++) {\n res += (\".\"+inpList[i]);\n }\n Console.WriteLine(res);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4121207e2654533677d65b0da14e8bab", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace elwinchen\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x;\n x = Console.ReadLine();\n \n for(int i=0; i();\n var removingVowels = RemovingVowels(Input, newStringsList);\n Console.WriteLine(removingVowels);\n\n string RemovingVowels(string input, List stringsList)\n {\n if (input.Length > 0 && input.Length <= 100) \n foreach(char character in input)\n {\n if ( character != 'A' && character != 'E' && character != 'I' && character != 'O' && character != 'U' && character != 'a' && character != 'e' && character != 'e' && character != 'o' && character != 'u' && character != ' ')\n { \n var letter = char.ToString(character);\n stringsList.Add(\".\");\n stringsList.Add(letter);\n }\n }\n var noVowel = string.Join(\"\",stringsList) ;\n var output = noVowel.ToLower();\n return output;\n\n }\n\n\n\n\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "85556ce40c4223558d186224d3f196ac", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace prob5_String_Task\n{\n class Program\n {\n static void Main(string[] args)\n {\n var Input =Console.ReadLine() ;\n var newStringsList = new List();\n var removingVowels = RemovingVowels(Input, newStringsList);\n Console.WriteLine(removingVowels);\n\n string RemovingVowels(string input, List stringsList) { \n \n if (input.Length > 0 && input.Length <= 100) \n foreach(char character in input)\n {\n if ( character != 'A' && character != 'E' && character != 'I' && character != 'O' && character != 'U' && character != 'a' && character != 'e' && character != 'e' && character != 'o' && character != 'u' && character != ' ')\n { \n var letter = char.ToString(character);\n stringsList.Add(\".\");\n stringsList.Add(letter);\n }\n }\n var noVowel = string.Join(\"\",stringsList) ;\n var output = noVowel.ToLower();\n return output;\n\n }\n\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d0f353949e483bdde5a279db0f215338", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "string Palabra = Console.ReadLine().ToLower();\n for(int i = 0; i < Palabra.Length; i++)\n {\n if (!\"aeiouy\".Contains(Palabra[i]))\n Console.Write($\".{Palabra[i]}\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3aa8a24efbf51b9142f2cf8ed7afa446", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace sp{\n class Program{\n static void Main(){\n string s = Console.ReadLine();\n string result = \"\";\n \n for(int i = 0;i\n\n \n Debug\n AnyCPU\n 9.0.21022\n 2.0\n {44EC9480-28FE-4202-91F9-655DBC2E7470}\n Exe\n Properties\n ConsoleApplication1\n ConsoleApplication1\n v3.5\n 512\n \n \n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n 3.5\n \n \n 3.5\n \n \n 3.5\n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9b1f5d8e07d7593705e7144e143015f7", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodeForce\n{\n class _118A_StringTask\n {\n void StringTask()\n {\n string input = Console.ReadLine();\n\n foreach(char c in input)\n {\n switch ((int)c)\n {\n case 65:\n case 69:\n case 73:\n case 79:\n case 85:\n case 89:\n case 97:\n case 101:\n case 105:\n case 111:\n case 117:\n case 121:\n break;\n default:\n Console.Write('.');\n if(c >= 65 && c <= 90)\n {\n Console.Write((char)(c + 32));\n }\n else\n {\n Console.Write(c);\n }\n break;\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "55d893fbfac54d70bf0630df1f9e94a6", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": " string input = Console.ReadLine();\n\n string output = input.Replace(\"A\", string.Empty)\n .Replace(\"E\", string.Empty)\n .Replace(\"I\", string.Empty)\n .Replace(\"O\", string.Empty)\n .Replace(\"U\", string.Empty)\n .Replace(\"E\", string.Empty)\n .Replace(\"Y\", string.Empty)\n .Replace(\"a\", string.Empty)\n .Replace(\"e\", string.Empty)\n .Replace(\"i\", string.Empty)\n .Replace(\"o\", string.Empty)\n .Replace(\"u\", string.Empty)\n .Replace(\"y\", string.Empty);\n\n\n string aa = output.ToLower();\n char[] a =aa.ToCharArray();\n // Console.WriteLine(a);\n\n\n \n\n for (int i = 0; i < a.Length; i++)\n {\n //no\n\n Console.Write(\".\" + a[i]);\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a6bde3f92a29c9e8bc1abfdb6e2f557d", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 10.00\n# Visual C# Express 2008\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication1\", \"ConsoleApplication1\\ConsoleApplication1.csproj\", \"{44EC9480-28FE-4202-91F9-655DBC2E7470}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{44EC9480-28FE-4202-91F9-655DBC2E7470}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{44EC9480-28FE-4202-91F9-655DBC2E7470}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{44EC9480-28FE-4202-91F9-655DBC2E7470}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{44EC9480-28FE-4202-91F9-655DBC2E7470}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "83f08fcbf2efd4ea2c67d3c6593a5c2c", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass Program\n{\n static void Main()\n {\n string del = \"aoeuyi\";\n string a = Console.ReadLine().ToLower();\n\n string result = \"\";\n\n for(int i = 0; i < a.Length; ++i)\n {\n if (del.Contains(a[i]))\n {\n a = a.Remove(i,1);\n --i;\n continue;\n }\n }\n\n for(int i = 0; i < a.Length; ++i)\n {\n result = result + '.' + a[i];\n }\n Console.WriteLine(result);\n } \n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d202349b4ec2adf92dd336ed34692e93", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nclass Task\n{\n static void Main()\n {\n \n string s=Console.ReadLine();\n foreach(char i in s)\n {\n if(!\"aeiouy\".Contains(i))\n {\n Console.WriteLine(\"{0}{1}\",.,i);\n }\n }\n \n \n \n \n }\n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "be0d86b30f9ec9fa599b15c2a0afe9b4", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Samogloski\n{\n class Program\n {\n static void Main(string[] args)\n {\n var Input = Console.ReadLine().ToLower();\n\n string output = Input.Replace(\"a\", \".\")\n .Replace(\"e\", \".\")\n .Replace(\"i\", \".\")\n .Replace(\"o\", \".\")\n .Replace(\"u\", \".\")\n .Replace(\"y\",\".\"),\n\t\t\t\t\t\t\t\t .Replace(\"..\",\".\");\n Console.WriteLine(output);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "951f3be00dc9c727fa575e5f4fa41849", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _118A_String_Task\n{\n class Program\n {\n static void Main(string[] args)\n {\n String str=Console.ReadLine();\n for(int i=0;i= 'A' && str[i] <= 'Z') //\u5982\u679c\u5b57\u5143\u88e1\u6709\u5927\u5bebA~Z\n {\n str[i] = str[i] - 'A' + 'a'; //\u6211\u6240\u8f38\u5165\u7684\u5b57\u4e32\u8981\u63db\u6210\u5c0f\u5beb \u672c\u4f86\u5c31\u5c0f\u5beb\u7684\u5c31\u4e0d\u7528\u63db\u2192\u5927\u5beb\u624d\u8981\u63db \u6240\u4ee5\u59b3\u60f3\u8981\u628a\u5b57\u5143\u8b8a\u5c0f\u5beb\u5c31\u662f\u5148\u78ba\u5b9a \u9019\u500b\u5b57\u5143\u662f\u5927\u5beb\u624d\u8981\u628a\u4ed6\u8b8a\u5c0f\u5beb\u6240\u4ee5\u59b3\u7684if\u4e0d\u662f\u5df2\u7d93\u5beb\u4e86 if(str[i]>='A'&&str[i]<='Z') \u9019\u500bif\u662ftrue\u5c31\u4ee3\u8868str[i]\u662f\u5927\u5beb\n //\u4e0d\u6703\u53ea\u628aA\u63db\u6210a \u56e0\u70baASCII\u7684\u7de8\u78bc 'a'+1='b' 'b'+1='c'\n }\n\n String cake;\n for(int i=0;i output = new List();\n foreach (char c in input)\n {\n if (!\"aeiou\".Contains(c))\n {\n output.Add('.');\n output.Add(c);\n }\n }\n System.Console.WriteLine(new String(output.ToArray()));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9e6b3ed281633036b20b02a07aabd500", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Codeforce5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine().ToLower();\n\t\t\n for(int i=0; i list = new List();\n\n\n // Loop through array.\n for (int i = 0; i < array.Length; i++)\n {\n // Get character from array.\n char letter = array[i];\n\t\t\tif(letter == 'o'||letter == 'a' || letter == 'u' || letter == 'e'||letter == 'i' || letter == 'y')\n\t\t\t{\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tlist.Add('.');\n\t\t\t\tlist.Add(letter);\n\t\t\t\t\n\n\t\t\t}\n\t\t\t\n }\n\t\t Console.WriteLine(list);\n\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd8837273e114a3cfa14648bb157d37d", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\n\t\t\n\t\t\tstring str = Console.ReadLine();\n\t\t\tstring loStr=str.ToLower()\n\t\t\t\n\t\t\t foreach (char s in loStr)\n\t\t\t {\n\t\t\t if(s.ToLower()== \"a\" || s.ToLower()== \"o\" || s.ToLower()== \"y\" || s.ToLower()== \"e\" || s.ToLower()== \"u\" || s.ToLower()== \"i\")\n\t\t\t continue;\n\t\t\t else\n\t\t\t Console.Write(\".\"+s);\n\t\t\t \n\t\t\t \n\t\t\t }\n \n\t\t\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3e11e430abf5de01ff32f882ed1910d7", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace prob5_String_Task\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Input =Console.ReadLine() ;\n var newStringsList = new List();\n var removingVowels = RemovingVowels(Input, newStringsList);\n Console.WriteLine(removingVowels);\n\n string RemovingVowels ( string input , List stringsList) { \n \n if (input.Length > 0 && input.Length <= 100) \n foreach(char character in input)\n {\n if ( character != 'A' && character != 'E' && character != 'I' && character != 'O' && character != 'U' && character != 'a' && character != 'e' && character != 'e' && character != 'o' && character != 'u' && character != ' ')\n { \n var letter = char.ToString(character);\n stringsList.Add(\".\");\n stringsList.Add(letter);\n }\n }\n string noVowel = string.Join(\"\",stringsList) ;\n string output = noVowel.ToLower();\n return output;\n };\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d904989971bdadc89bd070f3dfb73d5b", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\n string input = Console.ReadLine();\n\n string output = input.Replace(\"A\", string.Empty)\n .Replace(\"E\", string.Empty)\n .Replace(\"I\", string.Empty)\n .Replace(\"O\", string.Empty)\n .Replace(\"U\", string.Empty)\n .Replace(\"E\", string.Empty)\n .Replace(\"Y\", string.Empty)\n .Replace(\"a\", string.Empty)\n .Replace(\"e\", string.Empty)\n .Replace(\"i\", string.Empty)\n .Replace(\"o\", string.Empty)\n .Replace(\"u\", string.Empty)\n .Replace(\"y\", string.Empty);\n\n\n string aa = output.ToLower();\n char[] a =aa.ToCharArray();\n \n\n\n \n\n for (int i = 0; i < a.Length; i++)\n {\n \n\n Console.Write(\".\" + a[i]);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e03bf85dda6c2a79d84cfc31bda574c1", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Genetic;\n\nnamespace sp{\n class Program{\n static void Main(){\n string s = Console.Readline();\n string result = '';\n \n for(int i = 0;i m.Name == \"CreateFromToken\");\n\t\t\tvar obj = new WindowsIdentity(WindowsIdentity.GetCurrent().Token);\n\t\t\tvar result = method.Invoke(obj, new object[] { WindowsIdentity.GetCurrent().Token });\n\t\t\tConsole.WriteLine(obj.Name + \" \" + obj.Token);\n\t\t\t//Console.WriteLine(result.Name + \" \" + result.Token);\n\t\t\tConsole.WriteLine(WindowsIdentity.GetCurrent().Token);\n\t\t}\n\n\t\tpublic static void AnotherTest()\n\t\t{\n\t\t\tvar user = WindowsIdentity.GetCurrent().User;\n\t\t\tConsole.WriteLine(user.AccountDomainSid);\n\t\t}\n\n\t\tprivate static void TestCreateAppDomain()\n\t\t{\n\t\t\tvar domain = AppDomain.CreateDomain(\"TestDomain\");\n\t\t\tConsole.WriteLine(WindowsIdentity.GetCurrent().Token);\n\t\t\tdomain.SetThreadPrincipal(new WindowsPrincipal(new WindowsIdentity(WindowsIdentity.GetCurrent().Token)));\n\t\t\tdomain.ExecuteAssembly(@\"C:\\Users\\Andrey.Titov\\Documents\\Visual Studio 2013\\Projects\\Test\\ConsoleApplication2\\bin\\Debug\\ConsoleApplication2.exe\");\n\t\t\tvar newDom = AppDomain.CreateDomain(\"Test\");\n\t\t\tnewDom.SetThreadPrincipal(new WindowsPrincipal(new WindowsIdentity(WindowsIdentity.GetCurrent().Token)));\n\t\t\tnewDom.ExecuteAssembly(@\"C:\\Users\\Andrey.Titov\\Documents\\Visual Studio 2013\\Projects\\Test\\ConsoleApplication2\\bin\\Debug\\ConsoleApplication2.exe\");\n\t\t\tAppDomain.Unload(domain);\n\t\t\tAppDomain.Unload(newDom);\n\t\t\tConsole.WriteLine(WindowsIdentity.GetCurrent().Token);\n\t\t}\n\n\t\tprivate static void ProgramFilesTest()\n\t\t{\n\t\t\tConsole.WriteLine(Environment.ExpandEnvironmentVariables(@\"%SYSTEMROOT%\\Microsoft.NET\\Framework\\v4*\"));\n\t\t}\n\n\t\tprivate static void Test()\n\t\t{\n\t\t\tvar dir = new DirectoryInfo(@\"C:\\Windows\\System32\\inetsrv\\config\");\n\t\t\tforeach (var fileInfo in dir.EnumerateFiles()) {\n\t\t\t\tConsole.WriteLine(fileInfo.Name);\n\t\t\t}\n\t\t\t//var doc = new XmlDocument();\n\t\t\t//doc.Load(@\"C:\\Windows\\System32\\inetsrv\\config\\applicationHost.config\");\n\t\t\t//XmlNode root = doc.DocumentElement;\n\n\t\t\t//XmlNode node = root.SelectSingleNode(@\"/configuration/configSections/sectionGroup[@name='system.webServer']/section[@name='handlers']\");\n\t\t\t//foreach (XmlAttribute attr in node.Attributes)\n\t\t\t//{\n\t\t\t//\tConsole.WriteLine(attr.Name);\n\t\t\t//}\n\t\t}\n\n\t\tprivate static void Machine()\n\t\t{\n\t\t\tusing (var context = new PrincipalContext(ContextType.Machine)) {\n\t\t\t\tusing (var searcher = new PrincipalSearcher(new UserPrincipal(context))) {\n\t\t\t\t\tforeach (var result in searcher.FindAll()) {\n\t\t\t\t\t\tvar de = result.GetUnderlyingObject() as DirectoryEntry;\n\t\t\t\t\t\tvar samAccountName = de.Properties[\"samAccountName\"].Value;\n\t\t\t\t\t\tvar name = de.Properties[\"Name\"].Value;\n\t\t\t\t\t\tConsole.WriteLine(samAccountName);\n\t\t\t\t\t\tConsole.WriteLine(name);\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\n\t\tprivate static void TestWin10()\n\t\t{\n\t\t}\n\n\t\tprivate static void Ad()\n\t\t{\n\t\t\tusing (var context = new PrincipalContext(ContextType.Domain, \"INTRANET\")) {\n\t\t\t\tusing (var searcher = new PrincipalSearcher(new UserPrincipal(context))) {\n\t\t\t\t\tforeach (var result in searcher.FindAll()) {\n\t\t\t\t\t\tvar de = result.GetUnderlyingObject() as DirectoryEntry;\n\t\t\t\t\t\tvar samAccountName = de.Properties[\"samAccountName\"].Value;\n\t\t\t\t\t\tvar name = de.Properties[\"Name\"].Value;\n\t\t\t\t\t\tConsole.WriteLine(samAccountName);\n\t\t\t\t\t\tConsole.WriteLine(name);\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\n\t\tprivate static void TestSqlServers()\n\t\t{\n\t\t\tDataTable localServers = SmoApplication.EnumAvailableSqlServers(true);\n\t\t\tDataRow[] rows = localServers.Select(string.Empty, \"IsLocal desc, Name asc\");\n\t\t\tDataTable netServers = SmoApplication.EnumAvailableSqlServers();\n\t\t\tvar netRows = netServers.Select(string.Empty, \"IsLocal desc, Name asc\");\n\t\t\tvar totalRows = rows.Concat(netRows).ToArray();\n\t\t\tforeach (var row in netRows)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(row[0]);\n\t\t\t}\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bd905bee0696254f8335c6472a0d7d8d", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Numerics;\n\nnamespace _664A\n{\n internal class Program\n {\n private static BigInteger gcd(BigInteger a, BigInteger b)\n {\n BigInteger tmp;\n while (b != BigInteger.Zero)\n {\n tmp = new BigInteger(b.ToByteArray());\n b = new BigInteger((a % b).ToByteArray());\n a = new BigInteger(tmp.ToByteArray());\n }\n return a;\n }\n\n private static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n var numbers = input.Split(\" \");\n\n BigInteger a = BigInteger.Parse(numbers[0]);\n BigInteger b = BigInteger.Parse(numbers[1]);\n\n BigInteger result = gcd(a, b);\n Console.WriteLine(result.ToString());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bfadf8da30b7e03b48ed2f256779b63b", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {C22E8B66-0EF5-43B8-86DC-85B1FB630485}\n Exe\n Properties\n A.Keyboard\n A.Keyboard\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "683411a6cf493329f246cda4fd2fa266", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Keyboard\n{\n class Program\n {\n static void Main(string[] args)\n {\n char s = char.Parse(Console.ReadLine());\n string MoleMessage = Console.ReadLine();\n string line1 = \"qwertyuiop\",\n line2 = \"asdfghjkl;\",\n line3 = \"zxcvbnm,./\";\n\n StringBuilder correctMessage = new StringBuilder();\n\n foreach (var c in MoleMessage)\n {\n \n if(line1.Contains(c))\n {\n int index = line1.IndexOf(c);\n if(s == 'R')\n {\n correctMessage.Append(line1[index - 1]);\n }\n else\n {\n correctMessage.Append(line1[index + 1]);\n }\n }\n else if(line2.Contains(c))\n {\n int index = line2.IndexOf(c);\n if (s == 'R')\n {\n correctMessage.Append(line2[index - 1]);\n }\n else\n {\n correctMessage.Append(line2[index + 1]);\n }\n }\n else\n {\n int index = line3.IndexOf(c);\n if (s == 'R')\n {\n correctMessage.Append(line3[index - 1]);\n }\n else\n {\n correctMessage.Append(line3[index + 1]);\n }\n }\n }\n\n Console.WriteLine(correctMessage.ToString());\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "57f329a2f5b37820040b07cf5118a5e9", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\nnamespace ConsoleApp8\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\t\t\tchar dir = Convert.ToChar(Console.ReadLine());\n\t\t\tvar answer = new StringBuilder();\n\t\t\tstring input = Console.ReadLine();\n\t\t\tfor (int i = 0; i < input.Length; i++)\n\t\t\t{\n\t\t\t\tint index = keyboard.IndexOf(input[i]);\n\n\t\t\t\tif (dir == 'R')\n\t\t\t\t{\n\t\t\t\t\tanswer.Append(keyboard[index - 1] );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tanswer.Append(keyboard[index + 1] );\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(answer)\n\t\t}\n\t\t\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b5d1706717fe58575e3e17a73ab83355", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nclass A\n{\n private static string NextToken()\n {\n StringBuilder result = new StringBuilder();\n while (true)\n {\n int c = Console.Read();\n if (c == -1)\n return result.ToString();\n if (char.IsWhiteSpace((char)c))\n {\n if (result.Length > 0)\n {\n return result.ToString();\n }\n }\n else\n {\n result.Append((char)c);\n }\n }\n }\n\n private static int NextInt()\n {\n return int.Parse(NextToken());\n }\n\n private static double NextDouble()\n {\n return double.Parse(NextToken());\n }\n\n\n private static string[] lines = { \"qwertyuiop\", \"asdfghjkl;\", \"zxcvbnm,./\" };\n\n static void Solve()\n {\n var direction = Console.ReadLine();\n var s = Console.ReadLine();\n int delta = direction == \"R\" ? -1 : +1;\n foreach (char c in s)\n {\n for (int i = 0; i < lines.Length; i++)\n {\n var shiftedIndex = lines[i].IndexOf(c);\n if (shiftedIndex != -1)\n {\n Console.Write(lines[i][shiftedIndex + delta]);\n }\n }\n }\n Console.WriteLine();\n }\n\n static void Main(string[] args)\n {\n #if ONLINE_JUDGE\n Solve()\n #else\n using (var reader = new StreamReader(new FileStream(\"a.in\", FileMode.OpenOrCreate, FileAccess.Read)))\n {\n Console.SetIn(reader);\n using (var writer = new StreamWriter(new FileStream(\"a.out\", FileMode.Create, FileAccess.Write)))\n {\n Console.SetOut(writer);\n Solve();\n }\n }\n #endif\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "51e9531015c9eccecbcce4c094a5562f", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "MS C#", "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\n string dir = Console.ReadLine();\n string txt = Console.ReadLine();\n string keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n for (int i = 0; i < txt.Length; i++)\n {\n char ch = txt[i];\n for (int j = 0; j < keyboard.Length; j++)\n if (ch == keyboard[j])\n {\n if (dir == \"R\")\n Console.Write(keyboard[j - 1]);\n else\n Console.Write(keyboard[j + 1]);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "826f5437ea6724445d8ffb467aab2593", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\nnamespace ConsoleApp8\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\t\t\tchar dir = Convert.ToChar(Console.ReadLine());\n\t\t\tvar answer = new StringBuilder();\n\t\t\tstring input = Console.ReadLine();\n\t\t\tfor (int i = 0; i < input.Length; i++)\n\t\t\t{\n\t\t\t\tint index = keyboard.IndexOf(input[i]);\n\n\t\t\t\tif (dir == 'R')\n\t\t\t\t{\n\t\t\t\t\tanswer.Append(keyboard[index] - 1);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tanswer.Append(keyboard[index] + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(answer)\n\t\t}\n\t\t\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "66600f149ca324ad05b456210a4e99c4", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Keyboard\n{\n class Program\n {\n static void Main(string[] args)\n {\n char s = char.Parse(Console.ReadLine());\n string MoleMessage = Console.ReadLine();\n string line1 = \"qwertyuiop\",\n line2 = \"asdfghjkl;\",\n line3 = \"zxcvbnm,./\";\n\n StringBuilder correctMessage = new StringBuilder();\n\n foreach (var c in MoleMessage)\n {\n \n if(line1.Contains(c))\n {\n int index = line1.IndexOf(c);\n if(s == 'R')\n {\n correctMessage.Append(line1[index - 1]);\n }\n else\n {\n correctMessage.Append(line1[index + 1]);\n }\n }\n else if(line2.Contains(c))\n {\n int index = line2.IndexOf(c);\n if (s == 'R')\n {\n correctMessage.Append(line2[index - 1]);\n }\n else\n {\n correctMessage.Append(line2[index + 1]);\n }\n }\n else\n {\n int index = line3.IndexOf(c);\n if (s == 'R')\n {\n correctMessage.Append(line3[index - 1]);\n }\n else\n {\n correctMessage.Append(line3[index + 1]);\n }\n }\n }\n Console.WriteLine(correctMessage.ToString());\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "740b5367968ec750edbed0107cf90b70", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27130.2036\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Main\", \"Main\\Main.csproj\", \"{B7478277-83D1-4DA7-8F08-C5A51C398B7F}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B7478277-83D1-4DA7-8F08-C5A51C398B7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B7478277-83D1-4DA7-8F08-C5A51C398B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B7478277-83D1-4DA7-8F08-C5A51C398B7F}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B7478277-83D1-4DA7-8F08-C5A51C398B7F}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {A9A99528-3F2F-406A-9575-72265E812DAB}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fb3196909047da98b744f5ca1b7063c6", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n public void Run(TextReader tr, TextWriter tw)\n {\n int n = int.Parse(tr.ReadLine());\n string bilet = tr.ReadLine();\n int[] left = new int[n];\n int[] right = new int[n];\n for(int i = 0; i < n; i++)\n {\n left[i] = (int)(bilet[i] - '0');\n right[i] = (int)(bilet[i + n] - '0');\n }\n Array.Sort(left);\n Array.Sort(right);\n bool ls = true;\n bool gr = true;\n for (int i = 0; i < n; i++)\n {\n if (left[i]<=right[i])\n {\n gr = false;\n }\n if (left[i] >= right[i])\n {\n ls = false;\n }\n }\n tw.WriteLine(((ls || gr)?\"YES\":\"NO\"));\n }\n\n static void Main(string[] args)\n {\n new Program().Run(new StreamReader(Console.In, Console.Out);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e8da4d834ff54b61f93bf8f7d8e68438", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"CupC\", \"CupC\\CupC.csproj\", \"{DF7C8BA3-F7C7-4D00-8598-D385D38C8645}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{DF7C8BA3-F7C7-4D00-8598-D385D38C8645}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{DF7C8BA3-F7C7-4D00-8598-D385D38C8645}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{DF7C8BA3-F7C7-4D00-8598-D385D38C8645}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{DF7C8BA3-F7C7-4D00-8598-D385D38C8645}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5292a929eb018c2e2d1d4716438379d8", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "-20", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0a3ea98e31b92400d05fa5fb05d1b4a", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.IO;\n\nnamespace codeforce1\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\t//File.Delete(\"output.txt\");\n\t\t\t//string str = GetString();\n\t\t\tstring str = Console.ReadLine();\n\n\t\t\t//int n = int.Parse(str);\n\n\t\t\tstring res = AccountChange(str);\n\n\t\t\tstr = res.ToString();\n\n\t\t\t//WriteString(str);\n\t\t\tConsole.WriteLine(str);\n\t\t\t//Console.WriteLine(result);\n\t\t\t//Console.ReadKey();\n\t\t}\n\n\t\tstatic string AccountChange(string str)\n\t\t{\n\t\t\tchar preLast, last;\n\t\t\tint len, preLastInt, lastInt, resInt;\n\t\t\tstring preLastStr, lastStr, res;\n\t\t\tint number = int.Parse(str);\n\n\t\t\tres = str;\n\n\t\t\tif (number < 0)\n\t\t\t{\n\t\t\t\tlen = str.Length - 1;\n\n\t\t\t\tstr = str.Substring(1, len);\n\n\t\t\t\tpreLast = str[len - 2];\n\t\t\t\tlast = str[len - 1];\n\n\t\t\t\tpreLastStr = preLast.ToString();\n\t\t\t\tlastStr = last.ToString();\n\n\t\t\t\tpreLastInt = int.Parse(preLastStr);\n\t\t\t\tlastInt = int.Parse(lastStr);\n\n\t\t\t\tif (lastInt > preLastInt)\n\t\t\t\t{\n\t\t\t\t\tres = str.Substring(0, len - 1);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tres = str.Substring(0, len - 2) + last;\n\t\t\t\t}\n\n\t\t\t\tresInt = int.Parse(res);\n\n\t\t\t\tif (resInt != 0)\n\t\t\t\t{\n\t\t\t\t\tres = \"-\" + res;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t//Console.WriteLine(res);\n\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic string GetString()\n\t\t{\n\t\t\tusing (StreamReader reader = new StreamReader(\"input.txt\"))\n\t\t\t{\n\t\t\t\treturn reader.ReadLine();\n\t\t\t}\n\t\t}\n\n\t\tstatic string[] GetStrings(int n)\n\t\t{\n\t\t\tstring[] stringArray = new string[n];\n\t\t\tusing (StreamReader reader = new StreamReader(\"input.txt\"))\n\t\t\t{\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tstringArray[i] = reader.ReadLine();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn stringArray;\n\t\t}\n\n\t\tstatic void WriteString(string str)\n\t\t{\n\t\t\tusing (StreamWriter writer = new StreamWriter(\"output.txt\", true))\n\t\t\t{\n\t\t\t\twriter.WriteLine(str);\n\t\t\t}\n\t\t}\n\n\t\tstatic void WriteStrings(string[] strArray)\n\t\t{\n\t\t\tusing (StreamWriter writer = new StreamWriter(\"output.txt\", true))\n\t\t\t{\n\t\t\t\tfor (int i = 0; i < strArray.Length; i++) {\n\t\t\t\t\twriter.WriteLine(strArray[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "87d0de098e634ff7fe65b8feafb35263", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cf313a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = Console.ReadLine();\n \n if(n>0){\n Console.Write(n);\n }\n else{\n string x;\n x = n.ToString();\n int y;\n if(Convert.ToInt32(x[x.Length-2])>=Convert.ToInt32(x[x.Length-1])){\n y = x.Length-2;\n }\n else{\n y = x.Length-1;\n }\n for(int i=0; i dn1 ? dn : dn1;\n } \n return res.ToString();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b10a7d9e1cb3dd7ce74fdc79429fbd4b", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace AlgoTest\n{\n\n\n public class Program\n {\n private static PropertyInfo getThePropertyByName(string propertyName)\n {\n Type t = typeof(T);\n\n PropertyInfo[] allProperties = t.GetProperties();\n\n PropertyInfo necessaryProperty = allProperties.Where(p => p.Name == propertyName).FirstOrDefault();\n\n if (necessaryProperty == null || necessaryProperty is null)\n {\n throw new InvalidOperationException($\"The mentioned property {necessaryProperty} was not found in the object type {t}\");\n }\n\n return necessaryProperty;\n }\n\n public static IEnumerable> getGroupedPersons(IEnumerable persons, string groupingFilter)\n {\n PropertyInfo propertyFilter = getThePropertyByName(groupingFilter);\n\n var result = persons.GroupBy(x => propertyFilter.GetValue(x));\n\n return result;\n }\n\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n int length = n.ToString().Length;\n\n int lNumber = lessNumber(length);\n\n long count = 0;\n\n for (int i = 1;i < length;i++)\n {\n count += 9 * i;\n }\n\n count+= (n - lNumber + 1) * length;\n\n Console.WriteLine(count);\n\n // Console.ReadKey();\n }\n static int lessNumber(int n)\n {\n return (int)(Math.Pow(10,n-1));\n }\n public static string LargestNumber(int[] nums)\n {\n string[] stringNums = nums.Select(x => Convert.ToString(x)).ToArray();\n\n int maxLength = stringNums.Max(x => x.Length);\n\n string[] newStringNumbers = buildNewStringArray(stringNums, maxLength);\n\n Array.Sort(newStringNumbers);\n\n StringBuilder sb = new StringBuilder();\n\n for (int i = newStringNumbers.Length - 1; i >=0; i--)\n {\n string current = newStringNumbers[i];\n\n if (current.Contains(\"#\"))\n {\n sb.Append(removeChars(current));\n }\n else\n {\n sb.Append(current);\n }\n }\n\n //int[] newNumbers = newStringNumbers.Select(x => Convert.ToInt32(x)).ToArray();\n\n return sb.ToString();\n }\n static string removeChars(string s)\n {\n string ss = string.Empty;\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i]!='#')\n {\n ss += s[i];\n }\n else\n {\n break;\n }\n }\n\n return ss;\n }\n static string [] buildNewStringArray(string [] nums,int maxLength)\n {\n string[] newNumbers = new string[nums.Length];\n\n for (int i = 0; i < nums.Length; i++)\n {\n if (nums[i].Length < maxLength)\n {\n newNumbers[i] = addZeros(nums[i], maxLength - nums[i].Length);\n }\n else\n {\n newNumbers[i] = nums[i];\n }\n }\n\n return newNumbers;\n }\n\n static string addZeros(string s, int numberOfZeros)\n {\n for (int i = 0; i < numberOfZeros; i++)\n {\n s += \"#\";\n }\n\n return s;\n }\n\n private static int GCD(int a, int b)\n {\n return b == 0 ? a : GCD(b, a % b);\n }\n\n private static bool isPowerOfTwo(int n)\n {\n return (n & (n - 1)) == 0;\n }\n\n private static int powerOfTwo(int n)\n {\n if (!isPowerOfTwo(n)) return int.MinValue;\n return toBinaryString(n).Length - 1;\n }\n\n private static string toBinaryString(int n)\n {\n string res = string.Empty;\n\n while (n > 0)\n {\n res = n % 2 + res;\n n /= 2;\n }\n\n return res;\n }\n\n static void shuffle(int[] a)\n {\n Random rand = new Random();\n\n for (int i = 0; i < a.Length; i++)\n {\n int tempIndex = rand.Next(a.Length);\n int temp = a[i];\n a[i] = a[tempIndex];\n a[tempIndex] = temp;\n }\n }\n\n static string reverseSentence(string s)\n {\n char[] c = s.ToCharArray();\n char[] newC = new char[c.Length];\n\n for (int i = 0; i < c.Length; i++)\n {\n newC[i] = c[c.Length - 1 - i];\n }\n\n return new string(newC);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "706072c1f1f01375a581d0303a7d24de", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n int ans = 0;\n\n if (input <= 9)\n {\n ans = input;\n }\n else if (input <= 99)\n {\n ans = 9 * 1 + (input - 9) * 2;\n }\n else if (input <= 999)\n {\n ans = 9 * 1 + (99 - 9) * 2 + (999 - 99) * 3;\n }\n else if (input <= 9999)\n {\n ans = 9 * 1 + (99 - 9) * 2 + (999 - 99) * 3 + (9999 - 999) * 4;\n }\n else if (input <= 99999)\n {\n ans = 9 * 1 + (99 - 9) * 2 + (999 - 99) * 3 + (9999 - 999) * 4 + (99999 - 9999) * 5;\n }\n else if (input <= 999999)\n {\n ans = 9 * 1 + (99 - 9) * 2 + (999 - 99) * 3 + (9999 - 999) * 4 + (99999 - 9999) * 5 + (999999 - 99999) * 6;\n }\n else if (input <= 9999999)\n {\n ans = 9 * 1 + (99 - 9) * 2 + (999 - 99) * 3 + (9999 - 999) * 4 + (99999 - 9999) * 5 + (999999 - 99999) * 6 + (9999999 - 999999) * 7;\n }\n else if (input <= 99999999)\n {\n ans = 9 * 1 + (99 - 9) * 2 + (999 - 99) * 3 + (9999 - 999) * 4 + (99999 - 9999) * 5 + (999999 - 99999) * 6 + (9999999 - 999999) * 7 + (99999999 - 9999999) * 8;\n }\n else if (input <= 999999999)\n {\n ans = 9 * 1 + (99 - 9) * 2 + (999 - 99) * 3 + (9999 - 999) * 4 + (99999 - 9999) * 5 + (999999 - 99999) * 6 + (9999999 - 999999) * 7 + (99999999 - 9999999) * 8 + (999999999 - 9999999) * 9;\n }\n else if (input == 1000000000)\n {\n ans = 9 * 1 + (99 - 9) * 2 + (999 - 99) * 3 + (9999 - 999) * 4 + (99999 - 9999) * 5 + (999999 - 99999) * 6 + (9999999 - 999999) * 7 + (99999999 - 9999999) * 8 + (999999999 - 9999999) * 9 + 10;\n }\n Console.WriteLine(ans);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "11262dba8488d15d43f3b77c79dcd830", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "difficulty": 1200.0} {"lang": "MS C#", "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;\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f307acc5b3d61a9e845db4e2eaf2848c", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "MS C#", "source_code": " 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\")); ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "446372cbb7f68378d5348aaa9490228c", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace leetcode\n{\n class Program\n {\n static void Main(string[] args)\n {\n var count = int.Parse(Console.ReadLine());\n var items = Console.ReadLine().Split(\" \", StringSplitOptions.None).Select(c=> int.Parse(c));\n Console.WriteLine(items.Sum() > 0 ? \"HARD\" : \"EASY\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "94459324c7d13f12501ae5a2c505e3fd", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\t\tint a = Convert.ToInt32(Console.ReadLine());\n\t\t\tstring[] dizi =(Console.ReadLine().Split(' '));\n\t\t\tif (dizi.Contains(\"1\"))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"HARD\");\n\t\t\t}\n\t\t\telse {Console.WriteLine(\"EASY\"); }\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2e5661cb2e300410a3ee250e258480e1", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": " internal class Program\n {\n private static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n var count = 0;\n /*int[] n = new int[100];\n for (int i = 0; i < t; i++)\n {\n //List n = new List();\n //n.Add(Console.Read());\n // n[i] = int.Parse(Console.ReadLine());\n n[i] = int.Parse(Console.Read());\n if (n[i] == 1)\n {\n count++;\n }\n }*/\n List userInts = new List();\n\n for (int i = 0; i < t; i++)\n {\n string userValue = Console.ReadLine();\n int userInt;\n if (int.TryParse(userValue, out userInt))\n {\n userInts.Add(userInt);\n }\n if (userInts[i] == 1)\n {\n count++;\n }\n }\n if (count == 0)\n {\n Console.WriteLine(\"EASY\");\n }\n else\n {\n Console.WriteLine(\"Hard\");\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "895de2038625ba41897858e1db8e1054", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass Decision\n {\n List answers = new List();\n private short numberOfAnswers = 0;\n private short answer = -1;\n\n public int EnterInputs()\n {\n int ans = -1;\n numberOfAnswers = Convert.ToInt16(Console.ReadLine());\n if (numberOfAnswers < 1 || numberOfAnswers > 100)\n ans = -1;\n else\n {\n\n string theNumber = Console.ReadLine();\n string[] d = theNumber.Split(' ');\n\n foreach(var num in d)\n {\n if (num == \"1\" || num == \"0\")\n answers.Add(Convert.ToInt16(num));\n }\n \n \n ans = 0;\n }\n return ans;\n }\n\n\n private bool Level()\n {\n short sum = 0;\n foreach (var ans in answers)\n sum += ans;\n if (sum <= 0)\n return false;\n else\n return true;\n }\n\n public string MakeLevel()\n {\n if (Level())\n return \"HARD\";\n else\n return \"EASY\";\n }\n }\n\n\n\n public class Program\n {\n static void Main(string[] args)\n {\n PdfDocument doc = new PdfDocument();\n\n\n Decision decision = new Decision();\n int d = decision.EnterInputs();\n\n if (d != -1)\n {\n Console.WriteLine(\"{0}\", decision.MakeLevel());\n }\n Console.ReadLine();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e07ff73667a76c9034d2e1c34f0530af", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing static System.Console;\nclass P\n{\n static void Main(string[] args)\n {\n ReadLine();\n string a = ReadLine();\n WriteLine(a.Contains('1')?\"HARD\":\"EASY\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "80b6b0e5aa2c09f9668dc7f8f4afae25", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Xml.Linq;\nusing System.Xml.Serialization;\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().Split(' ');\n for (int i = 0; i < n; i++)\n {\n if (input[i] == \"1\")\n {\n Console.WriteLine(\"HARD\");\n return;\n }\n }\n Console.WriteLine(\"EASY\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8a8a18684c0ed28625698720d646d273", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int ile = Console.ReadLine();\n int i = 0;\n bool trudne = false;\n while(i0? \"HARD\":\"EASY\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "11d4807f388ba5059cba8b2a018bcfe9", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n \n public static void Main(string[] args)\n {\n //wrong_subtraction ws = new wrong_subtraction();\n int n = Convert.ToInt32(Console.ReadLine());\n int[] arr = (Console.ReadLine()).Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n Console.WriteLine($\"{sub_function(arr, n)}\");\n }\n\n static int sub_function(int[] arr, int n)\n {\n int result = 1;\n \n for (int i = 0; i < n; i++)\n {\n if(arr[i] == 0){\n result = 0;\n } else {\n return result;\n }\n \n }\n return result;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "344eab6ab2184c22ab9bbd45dd318f65", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int number = Convert.ToInt32(Console.ReadLine());\n int S = 0;\n if ((1<=number) && (number<=100))\n {\n \n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n for (int i=0; i0)\n {\n Console.WriteLine(\"Hard\");\n Console.ReadKey();\n }\n }\n else\n {\n Console.ReadKey();\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c810a6e06c02c89a2b0b7b2829a073d9", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Algoritmos\n{\n class Program\n {\n static void Main(string[] args)\n {\n int person = Int32.Parse(Console.ReadLine());\n int[] decision = Array.ConvertAll(Console.ReadLine().Split(\" \"), x => Int32.Parse(x));\n String input = \"EASY\";\n\n for (int i = 0; i < person; i++)\n {\n if (decision[i] == 1)\n {\n input = \"HARD\";\n break;\n }\n }\n\n Console.WriteLine(input);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "72f7c0d65a9addb5d39ce9e8367b468e", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n \nnamespace ConsoleApp1\n{\n public class Program\n {\n static void Main(string[] args)\n {\n string[] values = Console.ReadLine().Split(' ');\n int n = int.Parse(values[0]);\n string[] secondValues = Console.ReadLine().Split(' ');\n \n if (secondValues.Exists(secondValues, answer => answer.ToLower().Equals(\"hard\")))\n {\n Console.WriteLine(\"Hard\");\n return;\n }\n \n Console.WriteLine(\"Easy\");\n \n return;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8ee67e66f1c8f498bb716f4cf20e9666", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\t\tint a = Convert.ToInt32(Console.ReadLine());\n\t\t\tint[] dizi = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\t\t\tif (dizi.Contains(1))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"HARD\");\n\t\t\t}\n\t\t\telse {Console.WriteLine(\"EASY\"); }\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "095a6963ea9235d73f4effeb8207e9a3", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string o = Console.ReadLine();\n o = o.Replace(\" \", string.Empty);\n int In = o.IndexOf(\"1\");\n if(In>=0)\n {\n Console.WriteLine(\"HARD\"); \n }\n else\n {\n Console.WriteLine(\"EASY\");\n }\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cc9d356c80e60d647c9a22472b917aa4", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Xml.Linq;\nusing System.Xml.Serialization;\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().Split(' ');\n if (input.Contains(\"1\")) Console.WriteLine(\"HARD\");\n else Console.WriteLine(\"EASY\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6ffb2d99f070f2cc10c928ab8f43a65c", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\npublic class EasyProblem{\n static void Main(string[] args){\n EasyTest();\n }\n \n static void EasyTest(){\n int n = int.Parse(Console.ReadLine());\n string arg = Console.ReadLine();\n for(int i = 0; i < n; i ++){\n if(arg[i * 2] == \"1\")\n Console.WriteLine(\"HARD\");\n }\n Console.WriteLine(\"EASY\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "914169fba0b9a97558dc4f2c210ba7e1", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "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 Console.SetIn(new StreamReader(\"input.txt\"));\n int n = Convert.ToInt32(Console.ReadLine());\n string[] votes = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);\n \n int noCount = 0;\n string answer = \"EASY\";\n for (int i = 0; i < votes.Length; i++)\n {\n noCount += Convert.ToInt32(votes[i]);\n\n if (noCount > 0)\n {\n answer = \"HARD\";\n break;\n }\n\n }\n Console.WriteLine(answer);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "10193bbe5b0b0e22f492afe11396f558", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "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 int n = Convert.ToInt32(Console.ReadLine());\n string[] votes = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);\n \n int noCount = 0;\n string answer = \"EASY\";\n for (int i = 0; i < votes.Length; i++)\n {\n noCount += Convert.ToInt32(votes[i]);\n\n if (noCount > 0)\n {\n answer = \"HARD\";\n break;\n }\n\n }\n Console.WriteLine(answer);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6bf37cfe31da485b7f0968795be2fbf9", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\n class Program\n {\n static void Main()\n {\n\n\n int people_no = int.Parse(Console.ReadLine());\n\n string [] people_comments = Console.ReadLine().Split(' ');\n\n if (people_comments.Contains(\"1\"))\n {\n Console.WriteLine(\"HARD\");\n }\n else\n {\n Console.WriteLine(\"EASY\");\n }\n \n \n }\n \n }\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f0191e9c48cb4dd14898ad4ce279325d", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using system;\n\nnamespace Tassel\n{\n\tclass Program\n\t{\n\t\tpublic static void main()\n\t\t{\n\t\t\tint x;\n\t\t\tint[] d = new int[3];\n\t\t\tx = Covnert.ToInt32 (Console.ReadKey ());\n\t\t\t\n\t\t\tfor(int i = 0; i < x; i++){\n\t\t\t\td[i] = Covnert.ToInt32 (Console.ReadKey ());\n\t\t\t}\t\n\t\t\tfor(int i = 0; i < x; i++){\n\t\t\t\tif(d[i] == 1){\n\t\t\t\t\tConsole.WriteLine (\"HARD\");\n\t\t\t\t}\n\t\t\t\tif(d[x-1] == 0){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\t\n\t\t\tConsole.WriteLine (\"EASY\");\n\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "923c320a7846849170b3b5f893b140ee", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Challenge\n{\n class Program\n {\n static void Main()\n {\n Console.Write(easyhard());\n\t\t}\n\t\tpublic string easyhard()\n {\n int peoplenums = Convert.ToInt16(Console.ReadLine());\n string answers = Console.ReadLine();\n string[] ans = answers.Split(' ');\n if (ans.Contains(\"1\"))\n {\n return \"HARD\";\n } else\n {\n return \"Easy\";\n }\n \n }\n\t\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2499495be82f7b8e28258137d4094cd7", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Tassel\n{\n\tclass Program\n\t{\n\t\tpublic static void main()\n\t\t{\n\t\t\tint x;\n\t\t\tint[] d = new int[3];\n\t\t\tx = Convert.ToInt32 (Console.ReadKey ());\n\t\t\t\n\t\t\tfor(int i = 0; i < x; i++){\n\t\t\t\td[i] = Convert.ToInt32 (Console.ReadKey ());\n\t\t\t}\t\n\t\t\tfor(int i = 0; i < x; i++){\n\t\t\t\tif(d[i] == 1){\n\t\t\t\t\tConsole.WriteLine (\"HARD\");\n\t\t\t\t}\n\t\t\t\tif(d[x-1] == 0){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\t\n\t\t\tConsole.WriteLine (\"EASY\");\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d1fab753259f836135e47ed16da9fc04", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Algoritmos\n{\n class Program\n {\n static void Main(string[] args)\n {\n int person = Int32.Parse(Console.ReadLine());\n String[] decision = Console.ReadLine().Split(\" \");\n String input = \"Easy\";\n\n for (int i = 0; i < person; i++)\n {\n if (decision[i] == \"1\")\n {\n input = \"Hard\";\n }\n }\n\n Console.WriteLine(input);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c209ba8db06e29547d7ffe306c189ed1", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System;\nusing System.Linq;\n\nnamespace PapaSchool\n{\n //https://codeforces.com/problemset/problem/1030/A\n\n public class CF2\n {\n public static void Main(string[] args)\n {\n var count = Console.ReadLine();\n var num = Console.ReadLine();\n var numb = num.Split(' ').Select(item => int.Parse(item)).ToList();\n var result = EasyOrHard(numb);\n Console.WriteLine(result);\n }\n\n public static string EasyOrHard(List numb)\n {\n foreach (var num in numb)\n {\n if (num == 1)\n {\n return \"HARD\";\n }\n\n if (num != 0)\n {\n return \"ERROR\";\n }\n }\n\n return \"EASY\";\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3a2aadc418b5b450f8f9637b81cdbb2c", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\n class Program\n {\n static void Main()\n {\n\n\n int people_no = int.Parse(Console.ReadLine());\n\n string [] people_comments = Console.ReadLine().Split(' ');\n\n if (people_comments.Contains(\"1\"))\n {\n Console.WriteLine(\"HARD\");\n }\n else\n {\n Console.WriteLine(\"EASY\");\n }\n \n \n }\n \n }\n \n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0e416f6e0ca1b52cd482157f4fb36b3", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "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 = Convert.ToInt32(Console.ReadLine());\n string[] a = Console.ReadLine().Split(' ');\n bool a = true;\n for (int i = 0; i < n; i++)\n {\n if(a[i] == \"1\"){ Console.WriteLine(\"HARD\");a = false; break;} \n }\n if(a==true)\n Console.WriteLine(\"EASY\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "45b74366d0139e9a187c6b8262732da5", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _1030\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool isItHard = false;\n var howManyTimes = Int16.Parse(Console.ReadLine());\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a1bc5b20e9641df72c922c515f2ed0c6", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27703.2000\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"CodeForcesExercises\", \"CodeForcesExercises\\CodeForcesExercises.csproj\", \"{F415473B-EA05-4D27-9CAA-E9CDED1B5ED8}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{F415473B-EA05-4D27-9CAA-E9CDED1B5ED8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{F415473B-EA05-4D27-9CAA-E9CDED1B5ED8}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{F415473B-EA05-4D27-9CAA-E9CDED1B5ED8}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{F415473B-EA05-4D27-9CAA-E9CDED1B5ED8}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {0665E064-0672-46B2-8FCA-33299B1BB17C}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6931c9d548ac14cce44108a259379363", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace leetcode\n{\n class Program\n {\n static void Main(string[] args)\n {\n var count = int.Parse(Console.ReadLine());\n var items = Console.ReadLine().Split(\" \").Select(c=> int.Parse(c));\n Console.WriteLine(items.Sum() > 0 ? \"HARD\":\"EASY\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1b9b5e291c8f0a45ac74ffc8880dbe0c", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace leetcode\n{\n class Program\n {\n static void Main(string[] args)\n {\n var count = int.Parse(Console.ReadLine());\n var items = Console.ReadLine().Split(\" \", StringSplitOptions.None).Select(c=> int.Parse(c));\n Console.WriteLine(items.Sum() > 0 ? \"HARD\":\"EASY\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "76921f688a9eeb8a1a514f5b8489ba74", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "ng System;\nusing System.Linq;\n\nnamespace A.\u0412_\u043f\u043e\u0438\u0441\u043a\u0430\u0445_\u043f\u0440\u043e\u0441\u0442\u043e\u0439_\u0437\u0430\u0434\u0430\u0447\u0438\n{\n class Program\n {\n static void Main(string[] args)\n {\n string lenght = Console.ReadLine();\n int[] res = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n if (Array.IndexOf(res, 1) < 0)\n Console.WriteLine(\"EASY\");\n else\n Console.WriteLine(\"HARD\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1b5d31f9303e1c8af62d2f8decb44fca", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace _200501_InSearchOfAnEasyProblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n\n if (Console.ReadLine().Contains('1'))\n {\n Console.WriteLine(\"Hard\");\n }\n else\n {\n Console.WriteLine(\"Easy\");\n }\n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "269ce9f8a050f72700fcbfeb9acf4f93", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace SandBox\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] answers = Console.ReadLine().Split(' ');\n string res = \"EASY\";\n foreach (string answer in answers)\n {\n if (answer == \"1\")\n {\n res = \"HARD\";\n }\n }\n Console.WriteLine(res);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b227d160b4cb56faa03ff7b288058481", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var numberOfPeople = int.Parse(Console.ReadLine());\n var rules = Console.ReadLine().AsSpan();\n for (int i = 0; i < rules.Length; i+=2)\n {\n if (rules[i] == '1' && numberOfPeople >= i)\n {\n Console.WriteLine(\"HARD\");\n return;\n }\n }\n Console.WriteLine(\"EASY\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c2074586c73606625078a97602399802", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\n\nclass Program\n{\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string str = Console.ReadLine();\n if (str.Contains('1'))\n Console.Write(\"HARD\");\n else\n Console.Write(\"EASY\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c609c9d112af4ece4e97b4b26a82eb5c", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace leetcode\n{\n class Program\n {\n static void Main(string[] args)\n {\n var count = int.Parse(Console.ReadLine());\n var items = Console.ReadLine().Split(\" \").Select(c=> int.Parse(c));\n Console.WriteLine(items.Sum()> 0 ? \"HARD\":\"EASY\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e28064cc2bcaf8c41b82c0d1d595dfe2", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {A77B51EB-F6ED-4F3C-B846-EC4C65698F5C}\n Exe\n Comp2309\n Comp2309\n v4.6.1\n 512\n true\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6328493b516d4c8127591ec4a08cdd8f", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "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 = Convert.ToInt32(Console.ReadLine());\n string[] a = Console.ReadLine().Split(' ');\n bool a = true;\n for (int i = 0; i < n; i++)\n {\n if(a[i] == \"1\"){ Console.WriteLine(\"HARD\");a = false; break;} \n }\n if(a==false)\n Console.WriteLine(\"EASY\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "85ba05786296bce2bda7b91a6d901801", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace Algoritmos\n{\n class Program\n {\n static void Main(string[] args)\n {\n int person = Int32.Parse(Console.ReadLine());\n String[] decision = Console.ReadLine().Split(\" \");\n String input = \"\";\n\n for (int i = 0; i < person; i++)\n {\n if (decision[i] == \"0\")\n {\n input = \"Easy\";\n }\n else\n {\n input = \"Hard\";\n }\n \n }\n\n Console.WriteLine(input);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6d652abe6b8a3a231c98a98c9b2eabfd", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "int peoplenums = Convert.ToInt16(Console.ReadLine());\n string answers = Console.ReadLine();\n string[] ans = answers.Split(' ');\n if (ans.Contains(\"1\"))\n {\n return \"HARD\";\n } else\n {\n return \"Easy\";\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "847d103e8404553b68bf935d86630358", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\npublic class EasyProblem{\n static void Main(string[] args){\n EasyTest();\n }\n \n static void EasyTest(){\n int n = int.Parse(Console.ReadLine());\n int arg = Console.ReadLine();\n for(int i = 0; i < n; i ++){\n if(arg[i * 2] == \"1\")\n Console.WriteLine(\"HARD\");\n }\n Console.WriteLine(\"EASY\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "072dc2891e363ee060b94d88bd57f64c", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " int Numberofpeople=0;\n int resultfrompeople=0;\n int sum = 0;\n\n Numberofpeople = Convert.ToInt32(Console.ReadLine());\n\n for (int i=0; i< Numberofpeople; i++)\n {\n resultfrompeople = Convert.ToInt32(Console.ReadLine());\n sum += resultfrompeople;\n }\n Console.Write(sum >0? \"HARD\":\"EASY\");\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a09a378636eaf8ebf1f9c974493f0c4c", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program {\nstatic void Main() {\n int[] a=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();\nint[] b=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();\nint n = int.Parse(Console.ReadLine());\nn-=Math.Ceiling((double)(a[0]+a[1]+a[2])/5)+Math.Ceiling((double)(b[0]+b[1]+b[2])/10);\nConsole.WriteLine(n <0?\"NO\":\"YES\");\n} \n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "408c62ead860ea8b2c2c36e54a810b08", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass A448 {\n public static void Main() {\n var a = Console.ReadLine().Split().Sum(int.Parse);\n var b = Console.ReadLine().Split().Sum(int.Parse);\n var n = int.Parse(Console.ReadLine());\n Console.WriteLine((a + 4) / 5 + (b + 9) / 10 <= n ? \"YES\" : \"NO\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fd4e36fb984616dcf49bb3615e55ba87", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Linq;\nusing System.Net.Mime;\nusing System.Numerics;\nusing System.Text;\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\n //var text = Console.ReadLine();\n var cup = Console.ReadLine().Split(' ');\n var medal = Console.ReadLine().Split(' ');\n var shelves = Convert.ToInt32(Console.ReadLine());\n //var num = Convert.ToInt32(Console.ReadLine());\n //var input = Console.ReadLine().Split(' ');\n //int height = Convert.ToInt32(Console.ReadLine());\n\n //string text = Console.ReadLine();\n //var heights = Console.ReadLine().Split(' ');\n //Console.WriteLine(Check(Array.ConvertAll(nums, int.Parse)));\n Console.WriteLine(Check(cup, medal, shelves));\n }\n\n static string Check(string[] cup, string[] medal, int shelves)\n {\n var tempCup = Array.ConvertAll(cup, int.Parse);\n var cups = tempCup.Sum();\n\n var tempMeadl = Array.ConvertAll(medal, int.Parse);\n var medals = tempMeadl.Sum();\n\n int shelvesCup = shelves * 5;\n if (shelvesCup - cups < 0)\n {\n return \"NO\";\n }\n\n shelvesCup -= cups;\n shelves = shelvesCup / 5;\n\n int shelvesMedal = shelves * 10;\n if (shelvesMedal - cups < 0)\n {\n return \"NO\";\n }\n\n return \"YES\";\n\n\n }\n }\n}\n\n \n\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d3ea7f3ee2cae8af16f2d9216edacf4", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collection.Generetic;\nclass Program {\nstatic void Main() {\n int[] a=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();\nint[] b=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();\nint n = int.Parse(Console.ReadLine());\nn-=Math.Ceiling((double)(a[0]+a[1]+a[2])/5)+Math.Ceiling((double)(b[0]+b[1]+b[2])/10);\nConsole.WriteLine(n <0?\"NO\":\"YES\");\n} \n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "197eeef3a55d02458949a6fe4e1ebe33", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0} {"lang": "MS C#", "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 Console.ReadLine();\n string enter = Console.ReadLine();\n Stackstring parasites = new Stackstring();\n string par = ogo;\n while (par.Length 100)\n {\n parasites.Push(par);\n par += go;\n }\n while(parasites.Count0) {\n enter = enter.Replace(parasites.Pop(), );\n }\n Console.WriteLine(enter);\n Console.ReadKey();\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5461d9f09bc15f4fb0947f56308f1d8b", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "difficulty": 900.0} {"lang": "MS C#", "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 Console.ReadLine();\n string enter = Console.ReadLine();\n Stackstring parasites = new Stackstring();\n string par = ogo;\n while (par.Length 100)\n {\n parasites.Push(par);\n par += go;\n }\n while(parasites.Count0) {\n enter = enter.Replace(parasites.Pop(), );\n }\n Console.WriteLine(enter);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3267ac82034ed690d4ca0aae255ab8ff", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace SortingAlgorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n FriendMeeting();\n }\n public void FriendMeeting()\n {\n int count;\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), arrTemp => Convert.ToInt32(arrTemp));\n for (int i = 1; i < arr.Length; i++)\n {\n int next = arr[i];\n int j = i - 1;\n while (j >= 0 && arr[j] > next)\n {\n arr[j + 1] = arr[j];\n --j;\n }\n\n arr[j + 1] = next;\n }\n\n count = (arr[2] - arr[1]) + (arr[1] - arr[0]);\n Console.WriteLine(count);\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e6264f8db5b18d3a10c5af026300ff73", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace SortingProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n List list = new List();\n int length = Convert.ToInt32(Console.ReadLine());\n for (int i = 0; i < length; i++)\n {\n list.Add(Convert.ToInt32(Console.ReadLine()));\n }\n list.Sort();\n Console.WriteLine(Friend(list));\n \n }\n} }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "025703860545ced12d5f451e6d3b6609", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Contest\n{\n class Program\n {\n public static void Main()\n {\n string[] ss = Console.ReadLine().Split(' '); \nint a = Convert.ToInt32(ss[0]); \nint b = Convert.ToInt32(ss[1]); \nint c = Convert.ToInt32(ss[2]); \nint Max = -1; \nint Min = 101; \nIf (a > Max) \nMax = a; \nIf (b > Max) \nMax = b; \nIf (b > Max) \nMax = c; \nIf (a < Min) \nMin = a; \nIf (b < Min) \nMin = b; \nIf (c < Min) \nMin = c; \nConsole.WriteLine((Min+Max)/2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "51b5711c8ac1b10fbe53359d2da57a98", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Training {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\t\t\tint[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\t\t\tint min = int.MaxValue;\n\t\t\tfor(int i=1; i<=100; i++) {\n\t\t\t\tint res = 0;\n\t\t\t\tfor(int j=0; j list = new List();\n int length = Convert.ToInt32(Console.ReadLine());\n for (int i = 0; i < length; i++)\n {\n list.Add(Convert.ToInt32(Console.ReadLine()));\n }\n list.Sort();\n Console.WriteLine(Friend(list));", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0885e3a6b4c9820e29975fec49b5a15b", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace SortingAlgorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n StartSortingProblems problems = new StartSortingProblems();\n problems.FriendMeeting();\n }\n public static void FriendMeeting()\n {\n int count;\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), arrTemp => Convert.ToInt32(arrTemp));\n for (int i = 1; i < arr.Length; i++)\n {\n int next = arr[i];\n int j = i - 1;\n while (j >= 0 && arr[j] > next)\n {\n arr[j + 1] = arr[j];\n --j;\n }\n\n arr[j + 1] = next;\n }\n\n count = (arr[2] - arr[1]) + (arr[1] - arr[0]);\n Console.WriteLine(count);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eaea38ebd6f5fc1bc75966459887db3a", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Contest\n{\n class Program\n {\n public static void Main()\n {\n string[] ss = Console.ReadLine().Split(' '); \nint a = Convert.ToInt32(ss[0]); \nint b = Convert.ToInt32(ss[1]); \nint c = Convert.ToInt32(ss[2]); \nint Max = -1; \nint Min = 101; \nIf (a > Max) \nMax = a; \nIf (b > Max) \nMax = b; \nIf (c > Max) \nMax = c; \nIf (a < Min) \nMin = a; \nIf (b < Min) \nMin = b; \nIf (c < Min) \nMin = c; \nConsole.WriteLine((Min+Max)/2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9f3fc6792b8ca7a34d3568981b3ef099", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n int n1, n2, k1, k2;\n n1 = Convert.ToInt32(Console.ReadLine());\n n2 = Convert.ToInt32(Console.ReadLine());\n k1 = Convert.ToInt32(Console.ReadLine());\n k2 = Convert.ToInt32(Console.ReadLine());\n\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e5679eb57e683e9e339b5000e55dea9c", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n void Main()\n {\n var ar = Console.Readline().Split();\n Console.WriteLine(int.Parse(ar[0]) > int.Parse(ar[1]) ? \"Second\" : \"First\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5b8635f4781eb9c5c9fafd2d02ac1f29", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "MS C#", "source_code": " 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();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "296f16720a41da84b1147825cee1759d", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication8\", \"ConsoleApplication8\\ConsoleApplication8.csproj\", \"{BD9001AE-2E8E-4E77-86CA-DB137459BB85}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{BD9001AE-2E8E-4E77-86CA-DB137459BB85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{BD9001AE-2E8E-4E77-86CA-DB137459BB85}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{BD9001AE-2E8E-4E77-86CA-DB137459BB85}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{BD9001AE-2E8E-4E77-86CA-DB137459BB85}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7dc645a676d6ba2d55f9b8789baaa589", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication9\", \"ConsoleApplication9\\ConsoleApplication9.csproj\", \"{50B9F649-1295-480C-9E9A-E6FBA4F296BA}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{50B9F649-1295-480C-9E9A-E6FBA4F296BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{50B9F649-1295-480C-9E9A-E6FBA4F296BA}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{50B9F649-1295-480C-9E9A-E6FBA4F296BA}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{50B9F649-1295-480C-9E9A-E6FBA4F296BA}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ed34a444c1cc4e17c1fb68a552bbbca3", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n var input = args.Select(s => Int32.Parse(s)).ToList();\n\n Console.WriteLine(input[0] > input[1] ? \"First\" : \"Second\");\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e27cf488ba3d3398844c1fe98e38aa0c", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "MS C#", "source_code": " 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();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "144778f1a2ea46d50d2aa44bfa8239fd", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication10\", \"ConsoleApplication10\\ConsoleApplication10.csproj\", \"{1D792E9C-3B53-458E-B451-D7FBA74AEA68}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{1D792E9C-3B53-458E-B451-D7FBA74AEA68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{1D792E9C-3B53-458E-B451-D7FBA74AEA68}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{1D792E9C-3B53-458E-B451-D7FBA74AEA68}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{1D792E9C-3B53-458E-B451-D7FBA74AEA68}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e42ba3c31e2e5f3757c96722a5efb9f0", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication8\", \"ConsoleApplication8\\ConsoleApplication8.csproj\", \"{BD9001AE-2E8E-4E77-86CA-DB137459BB85}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{BD9001AE-2E8E-4E77-86CA-DB137459BB85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{BD9001AE-2E8E-4E77-86CA-DB137459BB85}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{BD9001AE-2E8E-4E77-86CA-DB137459BB85}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{BD9001AE-2E8E-4E77-86CA-DB137459BB85}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "22c2680a3791f11a98e39879bc2bfbea", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"calculator shamim\", \"calculator shamim\\calculator shamim.csproj\", \"{88A74FA7-7242-4651-8BE5-6EDDA691DB41}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{88A74FA7-7242-4651-8BE5-6EDDA691DB41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{88A74FA7-7242-4651-8BE5-6EDDA691DB41}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{88A74FA7-7242-4651-8BE5-6EDDA691DB41}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{88A74FA7-7242-4651-8BE5-6EDDA691DB41}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "505187608abdab334d87a3aaf389f632", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "MS C#", "source_code": "private static int steps(string strx1, string strx2)\n {\n int x1 = int.Parse(strx1.Split(' ')[0]);\n int x2 = int.Parse(strx2.Split(' ')[0]);\n int y1 = int.Parse(strx1.Split(' ')[1]);\n int y2 = int.Parse(strx2.Split(' ')[1]);\n\n int f = x1 >= x2 ? x1 - x2 : x2 - x1;\n int s = y1 >= y2 ? y1 - y2 : y2 - y1;\n int res = f >= s ? f : s;\n return res;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "61de48ceb692b7ac32c73278910a7269", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp14\n{\n class Program\n {\n public static int Reachable_Num(int i)\n {\n if (ip < 10)\n {\n Console.WriteLine('9');\n return;\n }\n int res = 10 - (ip % 10);\n ip /= 10;\n while(ip>= 10)\n {\n res += 9 - (ip % 10);\n ip /= 10;\n }\n res += 9;\n Console.WriteLine(res.ToString());\n }\n\n static void Main(string[] args)\n {\n Console.WriteLine(Reachable_Num(Convert.ToInt32(Console.ReadLine())));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d8561edb0e8951c6dc18ed72263b52c2", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace C_sarp_tests\n{\n class Program\n {\n private static int counter = 1;\n static void Main(string[] args)\n {\n int num = Convert.ToInt32(Console.ReadLine());\n\n\n while (num > 0)\n {\n num = Important(num);\n }\n\n\n Console.WriteLine(counter);\n }\n\n private static int Important(int n)\n {\n n++;\n if (n % 10 != 0)\n {\n counter++;\n\n }\n\n while (n % 10 == 0)\n {\n n /= 10;\n\n if (n > 9 && n % 10 != 0)\n {\n counter++;\n\n }\n else if (n <= 9)\n {\n counter += 9;\n\n \n\n return 0;\n }\n }\n\n return n;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ce19a57e11db1570261233d57eb1ca2e", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "Mono C#", "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 HashSet hs = new HashSet();\n bool flag = true;\n\n if (n == 1)\n {\n Console.WriteLine(9);\n }\n else\n {\n while (flag)\n {\n if (!hs.Contains(n))\n {\n hs.Add(n);\n }\n \n n = Fofx(n);\n if (hs.Contains(1) && hs.Contains(2) && hs.Contains(3) && hs.Contains(4) && hs.Contains(5) && hs.Contains(6) && hs.Contains(7) && hs.Contains(8) && hs.Contains(9))\n {\n flag = false;\n }\n }\n Console.WriteLine(hs.Count);\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "abcecfc9f57b6f95e750527d796e1083", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp14\n{\n class Program\n {\n public static int Reachable_Num(int ip)\n {\n if (ip < 10)\n {\n Console.WriteLine('9');\n return;\n }\n int res = 10 - (ip % 10);\n ip /= 10;\n while(ip>= 10)\n {\n res += 9 - (ip % 10);\n ip /= 10;\n }\n res += 9;\n Console.WriteLine(res.ToString());\n }\n\n static void Main(string[] args)\n {\n Console.WriteLine(Reachable_Num(Convert.ToInt32(Console.ReadLine())));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1bb3381326730c3af7f8e949d8918cbc", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "namespace C_sarp_tests\n{\n class Program\n {\n private static int counter = 1;\n static void Main(string[] args)\n {\n int num = Convert.ToInt32(Console.ReadLine());\n\n\n while (num > 0)\n {\n num = Important(num);\n }\n\n\n Console.WriteLine(counter);\n }\n\n private static int Important(int n)\n {\n n++;\n if (n % 10 != 0)\n {\n counter++;\n\n }\n\n while (n % 10 == 0)\n {\n n /= 10;\n\n if (n > 9 && n % 10 != 0)\n {\n counter++;\n\n }\n else if (n <= 9)\n {\n counter += 9;\n\n \n\n return 0;\n }\n }\n\n return n;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7cdbdcb59eb7fc486e44cda071ca1308", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "namespace C_sarp_tests\n{\n class Program\n {\n private static int counter = 1;\n static void Main(string[] args)\n {\n int num = Convert.ToInt32(Console.ReadLine());\n\n\n while (num > 0)\n {\n num = Important(num);\n }\n\n\n Console.WriteLine(counter);\n }\n\n private static int Important(int n)\n {\n n++;\n if (n % 10 != 0)\n {\n counter++;\n\n }\n\n while (n % 10 == 0)\n {\n n /= 10;\n\n if (n > 9 && n % 10 != 0)\n {\n counter++;\n\n }\n else if (n <= 9)\n {\n counter += 9;\n\n \n\n return 0;\n }\n }\n\n return n;\n }\n }}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1ce25009d1a7715d0bfcc98323d74ad6", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nclass Solution\n{\n static void min(int m, int s)\n {\n var res = new char[m];\n var ns = s - (m - 1) * 9;\n if ((m - 1) * 9 > s)\n {\n res[0] = '1';\n s -= 1;\n }\n else if (ns > 0)\n {\n res[0] = ns.ToString()[0];\n s -= ns;\n }\n for (int i = 1; i < m; i++)\n {\n if (res[i - 1] > '0' && i > 1)\n res[i] = '9';\n else\n {\n var left = m - i - 1;\n if (left * 9 >= s)\n {\n res[i] = '0';\n }\n else\n {\n res[i] = (s - left * 9).ToString()[0];\n }\n }\n }\n\n for (int i = 0; i < m; i++)\n Console.Write(res[i]);\n }\n static void max(int m, int s)\n {\n var res = new char[m];\n if (s >= 9)\n {\n res[0] = '9';\n s -= 9;\n }\n else\n {\n res[0] = s.ToString()[0];\n s = 0;\n }\n for (int i = 1; i < m; i++)\n {\n if (res[i - 1] < '9')\n {\n res[i] = '0';\n }\n else\n {\n if (s >= 9)\n {\n res[i] = '9';\n s -= 9;\n }\n else\n {\n res[i] = s.ToString()[0];\n s = 0;\n }\n }\n }\n\n for (int i = 0; i < m; i++)\n Console.Write(res[i]);\n\n }\n static void ribbon(int m, int s)\n {\n if(m==1 && s=0){\n Console.WriteLine(\"0 0\");\n return;\n }\n if (m * 9 < s || s == 0)\n {\n Console.WriteLine(\"-1 -1\");\n return;\n }\n min(m, s);\n Console.Write(\" \");\n max(m, s);\n }\n\n static void Main(string[] args)\n {\n\n var ms = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n\n ribbon(ms[0], ms[1]);\n Console.ReadLine();\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "00122ac95e29d71111c8acbce3f6c72f", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Security.Cryptography.X509Certificates;\n\n// Powered by caide (code generator, tester, and library code inliner)\n\nclass Solution\n{\n public void solve(TextReader input, TextWriter output)\n {\n long a = -1, b = -1;\n var read = input.ReadLine().Split(' ');\n int m = int.Parse(read[0]);\n int s = int.Parse(read[1]);\n\n if (m == 1)\n {\n a = s;\n b = s;\n }\n\n int minSum = 1;\n int maxSum = 9 * m;\n\n long base9Sums = 9 * (m - 1);\n\n if (s >= minSum && s <= maxSum)\n {\n var root = Math.Pow(10, m - 1);\n\n for (int i = 1; i <= 9; i++)\n {\n if (a != -1)\n {\n bool touched = false;\n while (s > i && s < base9Sums + i && i <= 9)\n {\n touched = true;\n ++i;\n }\n\n if (touched)\n {\n --i;\n }\n }\n \n if (s <= base9Sums + i)\n {\n long begin = (long)(i * root);\n long end = (long)((i + 1) * root);\n\n long memorizeSum = i;\n long n = begin;\n for (long j = begin; j < end; j++)\n {\n ++n;\n\n if (n % 10 == 0)\n {\n memorizeSum = SumTheDigits(n);\n }\n else\n {\n memorizeSum++;\n }\n\n if (memorizeSum == s && a == -1)\n {\n a = n;\n break;\n }\n\n if (memorizeSum == s)\n {\n b = n;\n }\n }\n }\n }\n }\n\n output.WriteLine(a + \" \" + b);\n\n }\n\n private long SumTheDigits(long number)\n {\n long sum = 0;\n while (number / 10 != 0)\n {\n number = number / 10;\n sum += number % 10;\n }\n\n return sum;\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c984eb2273a65b0b2795620c7ffd5909", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\npublic class CF_489C\n{\n public string solve(int m, int s)\n {\n if (s == 0)\n {\n if (m == 1)\n {\n return \"0 0\";\n } else\n {\n return \"-1 -1\";\n }\n }\n\n int md = s / m + s % m;\n if (md > 9)\n {\n return \"-1 -1\";\n }\n int[] min = new int[m];\n int idx = m - 1; int sum = s;\n while (sum > 0)\n {\n min[idx] = sum >= 9 ? 9 : sum;\n sum -= min[idx];\n idx--;\n }\n string smax = \"\";\n for (int j = min.Length - 1; j >= 0; j--)\n {\n smax += min[j];\n }\n\n if (min[0] == 0)\n {\n min[0] = 1;\n min[idx + 1]--;\n }\n string smin = \"\";\n foreach (var d in min)\n {\n smin += d;\n }\n\n return \"\" + smin + \" \" + smax;\n }\n\n static int Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] snums = line.Split();\n int m = Convert.ToInt32(snums[0]);\n int s = Convert.ToInt32(snums[1]);\n Console.WriteLine(new CF_489C().solve(m, s));\n return 0;\n }\n}\n\n#if !ONLINE_JUDGE\nnamespace CodeForces\n{\n [TestClass]\n public class Test_CF_489C\n {\n [TestMethod]\n public void SpecialCase1()\n {\n Assert.AreEqual(\"0 0\", new CF_489C().solve(1, 0));\n }\n\n [TestMethod]\n public void SpecialCase2()\n {\n Assert.AreEqual(\"-1 -1\", new CF_489C().solve(2, 0));\n Assert.AreEqual(\"-1 -1\", new CF_489C().solve(3, 0));\n }\n\n [TestMethod]\n public void NoSolution()\n {\n Assert.AreEqual(\"-1 -1\", new CF_489C().solve(3, 29));\n Assert.AreEqual(\"-1 -1\", new CF_489C().solve(2, 19));\n }\n\n [TestMethod]\n public void Test1()\n {\n Assert.AreEqual(\"69 96\", new CF_489C().solve(2, 15));\n }\n\n [TestMethod]\n public void Test2()\n {\n Assert.AreEqual(\"18 90\", new CF_489C().solve(2, 9));\n }\n\n [TestMethod]\n public void Test3()\n {\n Assert.AreEqual(\"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\", new CF_489C().solve(100, 900));\n }\n }\n}\n#endif", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cdb18e30ac1f23d53a5020befdc86066", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\n\nnamespace Issue_489C\n{\n public class Program\n {\n private byte[] digits;\n\n public static void Main(string[] args) {\n var m = IO.Read();\n var s = IO.Read();\n\n var min = GetMinimal(m, s);\n if (min == -1) {\n Console.WriteLine(\"-1 -1\");\n } else {\n var max = GetMaximum(m, s);\n Console.WriteLine(min + \" \" + max);\n }\n }\n\n private static int GetMinimal(int m, int s) {\n var ninesCount = s / 9;\n var firstDigit = s % 9;\n var isAllNines = firstDigit == 0;\n var digitsRequired = ninesCount + (isAllNines ? 0 : 1);\n\n if (digitsRequired > m) {\n return -1;\n }\n\n var number = Pow(10, m - 1);\n\n if (digitsRequired == m) {\n var backward = (number / 10);\n\n return isAllNines \n ? number - 1\n : firstDigit * backward + backward - 1;\n }\n\n var middlePower = Pow(10, ninesCount);\n return number / 10 + (firstDigit - 1) * middlePower + middlePower - 1;\n }\n\n private static int GetMaximum(int m, int s) {\n var ninesCount = s / 9;\n var firstDigit = s % 9;\n\n var number = Pow(10, m);\n var backward = Pow(10, m - ninesCount);\n\n return (number - 1) - (backward - 1) + firstDigit * (backward / 10);\n }\n\n private static long Pow(int base, int exp) {\n long result = 1; \n \n while (exp > 0) { \n if ((exp & 1) != 0)\n result *= base; \n \n exp >>= 1; \n base *= base; \n } \n\n return result; \n }\n }\n\n public static class IO {\n static IO() {\n Reader = new StreamReader(\n Console.OpenStandardInput(sizeof(int)),\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 const int zeroCode = (int) '0';\n\n int result = 0;\n int digit;\n int cache1;\n int cache2;\n\n var isNegative = false;\n var symbol = Reader.Read();\n\n while (symbol == ' ') {\n symbol = Reader.Read();\n }\n\n if (symbol == '-') {\n isNegative = true;\n symbol = Reader.Read();\n }\n\n for ( ;\n (symbol != -1) && (symbol != ' ');\n symbol = Reader.Read()\n ) {\n digit = symbol - zeroCode;\n \n if (digit < 10 && digit >= 0) {\n cache1 = result << 1;\n cache2 = cache1 << 2;\n result = cache1 + cache2 + 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 public static char ReadChar() {\n var symbol = Reader.Read();\n\n while (symbol == ' ') {\n symbol = Reader.Read();\n }\n\n if (symbol == 13) { // if symbol == \\n\n Reader.Read(); // skip next \\r symbol\n symbol = Reader.Read();\n }\n\n return (char) symbol;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eb05f067a5a348a0513da45944a9917d", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace q489c\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputLine = Console.ReadLine();\n var tokens = from token in inputLine.Split(\" \")\n select Int32.Parse(token);\n var inputM = tokens.ElementAt(0); // length of number as a word\n var inputS = tokens.ElementAt(1); // sum of the digits\n var m = inputM;\n var s = inputS;\n var resultMin = \"\";\n var resultMax = \"\";\n var digits = new List();\n\n while (digits.Count < inputM)\n {\n if (s == 0)\n {\n digits.Add(0);\n }\n else if (s > 9)\n {\n digits.Add(9);\n s -= 9;\n }\n else\n {\n digits.Add(s);\n s = 0;\n }\n }\n\n if (s == 0 && digits.Count == inputM && digits.ElementAt(0) > 0)\n {\n resultMax = String.Join(\"\", digits);\n\n digits.Sort();\n\n if (digits[0] == 0)\n {\n for (var i = 0; i < digits.Count; i++)\n {\n if (digits[i] > 0)\n {\n digits[i]--; // borrow\n break;\n }\n }\n\n digits[0] = 1;\n }\n\n resultMin = String.Join(\"\", digits);\n Console.WriteLine(\"{0} {1}\", resultMin, resultMax); \n }\n else\n {\n Console.WriteLine(\"-1 -1\");\n }\n // Out of bound\n // Upper bound: 9*m < s\n // lower bound: s < 1\n\n // 5, 10\n // Minimum will be 10009\n // Maximum will be 90001\n // 3, 15\n // XXX\n // Minimum will be 159\n // Maximum will be 960\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d6b72607891f098cfb4d04b0aa3e022e", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace \u0434\u043b\u0438\u043d\u0430_\u0438_\u0441\u0443\u043c\u043c\u0430\n{\n class Program\n {\n static int numberLength;\n static int symbolsSum;\n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] strArr = str.Split(\" \");\n numberLength = int.Parse(strArr[0]); // \u0414\u043b\u0438\u043d\u0430 \u0447\u0438\u0441\u043b\u0430\n symbolsSum = int.Parse(strArr[1]); // \u0421\u0443\u043c\u043c\u0430 \u0446\u0438\u0444\u0440\n\n Console.WriteLine(GetMin() + \" \" + GetMaximum());\n /*\n 100\n n = 3 \u041d\u0443\u043b\u0435\u0439 = n - 1\n s = 15\n 10059 -> 90000 \n */\n // 10059\n }\n\n static int GetMin()\n {\n if (9 * numberLength < symbolsSum || symbolsSum == 0)\n {\n return -1;\n }\n // 5 \n // 3\n\n // 30000\n int[] symbols = new int[numberLength];\n\n int currentSymbolsSum = symbolsSum;\n\n int i = numberLength - 1;\n // 3 0\n for (; i >= 0; i--)\n {\n if (currentSymbolsSum > 9)\n {\n symbols[i] = 9;\n currentSymbolsSum -= symbols[i];\n }\n else\n {\n symbols[i] = currentSymbolsSum;\n break;\n }\n }\n if (symbols[0] == 0)\n {\n symbols[0] = 1;\n symbols[i] = symbols[i] - 1;\n }\n\n return int.Parse(string.Join(\"\", symbols));\n }\n\n static int GetMaximum()\n {\n if (9 * numberLength < symbolsSum || symbolsSum == 0)\n {\n return -1;\n }\n int[] symbols = new int[numberLength];\n // symbols[0] = 9. symbols[1] = 0. symbols[2] = 0\n // numberLength = 3\n // currentSymbolsSum = 25\n // 960\n // currentSymbolsSum = 6\n int currentSymbolsSum = symbolsSum;\n for (int i = 0; i < numberLength; i++)\n {\n if (currentSymbolsSum >= 9)\n {\n symbols[i] = 9;\n currentSymbolsSum -= symbols[i];\n }\n else\n {\n symbols[i] = currentSymbolsSum;\n break;\n }\n }\n return int.Parse(string.Join(\"\", symbols));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "73c869a92a3c8a9e2f0d2dce572ed149", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\n\n// Powered by caide (code generator, tester, and library code inliner)\n\nclass Solution\n{\n public void solve(TextReader input, TextWriter output)\n {\n long a = -1, b = -1;\n var read = input.ReadLine().Split(' ');\n int m = int.Parse(read[0]);\n int s = int.Parse(read[1]);\n\n if (m == 1)\n {\n a = s;\n b = s;\n }\n\n int minSum = 1;\n int maxSum = 9 * m;\n\n long base9Sums = 9 * (m - 1);\n\n if (s >= minSum && s <= maxSum)\n {\n var root = Math.Pow(10, m - 1);\n\n for (int i = 1; i <= 9; i++)\n {\n if (a != -1)\n {\n bool touched = false;\n while (s > i && s < base9Sums + i && i <= 9)\n {\n touched = true;\n ++i;\n }\n\n if (touched)\n {\n --i;\n }\n }\n \n if (s <= base9Sums + i)\n {\n long begin = (long)(i * root);\n long end = (long)((i + 1) * root);\n\n long memorizeSum = i;\n long n = begin;\n for (long j = begin; j < end; j++)\n {\n ++n;\n\n if (n % 10 == 0)\n {\n memorizeSum = SumTheDigits(n);\n }\n else\n {\n memorizeSum++;\n }\n\n if (memorizeSum == s && a == -1)\n {\n a = n;\n break;\n }\n\n if (memorizeSum == s)\n {\n b = n;\n }\n }\n }\n }\n }\n\n output.WriteLine(a + \" \" + b);\n\n }\n\n private long SumTheDigits(long number)\n {\n long sum = 0;\n while (number / 10 != 0)\n {\n number = number / 10;\n sum += number % 10;\n }\n\n return sum;\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "00abc969131ff0738769bc5000d5e449", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "int n=int.Parse(Console.ReadLine());\n\t\t if(n%5==0){\n\t\t\t Console.WriteLine(n/5);\n\t\t }\n else {\n\t\tConsole.WriteLine((n/5)+1);\n\t\t }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5d912ef6cf5277ce98552f2ca755009a", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Elephant\", \"Elephant\\Elephant.csproj\", \"{2F52C479-BD12-4423-B9BD-4B91B37CAD56}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{2F52C479-BD12-4423-B9BD-4B91B37CAD56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{2F52C479-BD12-4423-B9BD-4B91B37CAD56}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{2F52C479-BD12-4423-B9BD-4B91B37CAD56}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{2F52C479-BD12-4423-B9BD-4B91B37CAD56}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a314696a525c4fd283b07ff6372694a9", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Task\n{\n static void Main()\n {\n int n=int.Parse(Console.ReadLine());\n Console.WriteLine((x+4)/5);\n \n \n \n \n }\n \n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c1224b3bf9b8d9bc5ee8f3f9fb7d8f7a", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int n, ans;\n cin >> n;\n ans = (n + 4) / 5;\n cout << ans << endl;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ebb5fb6d32ad330a763f8a87169f54fd", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing TasksCodeForce._700;\n\nnamespace TasksCodeForce\n{\n class Program\n {\n static void Main(string[] args)\n {\n int nPositionOfElephant = 0;\n int xPositionFriend = int.Parse(Console.ReadLine());\n int counts = 0;\n\n do\n {\n if (xPositionFriend >= 5)\n {\n xPositionFriend -= 5;\n counts++;\n }\n else if (xPositionFriend >= 4)\n {\n xPositionFriend -= 4;\n counts++;\n }\n else if (xPositionFriend >= 3)\n {\n xPositionFriend -= 3;\n counts++;\n }\n else if (xPositionFriend >= 2)\n {\n xPositionFriend -= 2;\n counts++;\n }\n else if (xPositionFriend >= 1)\n {\n xPositionFriend -= 1;\n counts++;\n }\n } while (xPositionFriend > nPositionOfElephant);\n\n Console.WriteLine(counts);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0a43a4c70fa8c91971279c045aba007", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0f9bea6214524a97979847614a407d3a", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Pr1\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tList < int > num = new List();\n\t\t\tnum.Add(Console.Read());\n\t\t\tint n = 10, m = 10;\n\t\t\tint[,] a = new int[n, m];\n\t\t\t/*char c;\n\t\t\tdouble a, b;\n\t\t\tConsole.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435: \");\n\t\t\ta = Convert.ToDouble(Console.ReadLine());\n\t\t\tc = Convert.ToChar(Console.ReadLine());\n\t\t\tb = Convert.ToDouble(Console.ReadLine());\n\t\t\trt.complex.test(a, b, c);\n\t\t\tRandom r = new Random();\n\t\t\tint a = r.Next(1, 6);\n\t\t\t//a = Convert.ToInt32(Console.ReadLine());\n\t\t\tvar c = a / 1f;\n\t\t\tConsole.WriteLine(c);\n\t\t\tConsole.ReadKey();*/\n\t\t\t/*DateTime dat = DateTime.Now;\n\t\t\tConsole.WriteLine(\"Today is {0:d} at {0:T}.\", dat);*/\n\t\t\tint n;\n\t\t\tn = Convert.ToInt32(Console.ReadLine());\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < a.Length; ++i)\n\n\t\t\t\ta[i] = Convert.ToInt32(Console.ReadLine());\n\t\t\tfor (int i = 0; i < a.Length; ++i)\n\t\t\t\tConsole.WriteLine(i + \" - \" + a[i]);\n\t\tConsole.ReadKey();\n\t\t}\n\t}\n}\nnamespace rt\n{\n\tclass complex\n\t{\n\t\tpublic static void test(double a, double b, char c)\n\t\t{\n\t\t\tdouble result = 0;\n\t\t\tswitch (c)\n\t\t\t{\n\t\t\t\tcase '-':\n\t\t\t\t\tresult = a - b;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\tresult = a + b;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '*':\n\t\t\t\t\tresult = a * b;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '/':\n\t\t\t\t\tresult = a / b;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\tConsole.WriteLine(\"= \" + result);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cc3ef9302f763a50fa2c266b01a13f9f", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace 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 \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c7747a7048e409f12d0e6d9b0fdfb3b2", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.421\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp\", \"ConsoleApp2\\ConsoleApp.csproj\", \"{FE4F9EFB-6EB7-45D0-8A7C-F1774531687A}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{FE4F9EFB-6EB7-45D0-8A7C-F1774531687A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{FE4F9EFB-6EB7-45D0-8A7C-F1774531687A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{FE4F9EFB-6EB7-45D0-8A7C-F1774531687A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{FE4F9EFB-6EB7-45D0-8A7C-F1774531687A}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {C6F93DDA-A211-42C0-A067-272667A313D5}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "08df055b1787d5909eb07b326dc20a45", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace CodeForces\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tElephant();\t\n\t\t}\n\t\tpublic static void Elephant(){\n\t\t\tint x = Int32.Parse(Console.ReadLine());\n\t\t\tConsole.WriteLine(x % 5 == 0 ? x/5 : x/5+1);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd02cab8a0afca98e2cff16e239b6cbe", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Proj\n{\n\tinternal static class Program\n\t{\n\n\t\tprivate 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\t\n\t\t\t// \t\u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u0434\u043e \u0442\u0430\u043a \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e!\n\t\t}\n\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "48643fb615a2f707b1700df7cd663bcd", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "MS C#", "source_code": " int x = int.Parse(Console.ReadLine());\n if (x % 5 == 0)\n {\n Console.WriteLine(x / 5);\n }\n else \n {\n int y = x % 5;\n Console.WriteLine((x / 5 )+ 1);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dc01c64012694e8aad57d96e46bf2445", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "MS C#", "source_code": " static void Main(string[] args)\n{\n var friendPos = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(friendPos / 5 + (friendPos % 5 > 0 ? 1 : 0));\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "beb8860d2a80eb0fede484783c3c81d3", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "MS C#", "source_code": "public 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}\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "036bfa00bbc085e7dbbfb17f64f91a26", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine());\n Console.WriteLine(N / 5 + (N % 5 == 0 ? 0 : 1));\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e5e98a27b55ca7bf7178c0c2cdb78fd4", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "MS C#", "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 m = s[1]; var t = s[2];\n var res = 0L;\n for (var nn = 4 ; nn <= n; nn++) {\n var mm = t - nn;\n if (mm < 0 || mm > m) continue;\n res += Comp(nn,n)*Comp(mm,m);\n }\n Console.WriteLine(res);\n }\n static long Comp(m,n) {\n var result 1L;\n for (var i = m+1 ; i <= n ; i++) result *= i;\n for (var i = 2 ; i <= n-m ; i++) result /= i;\n return result;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f9d7fd90c653ad023492502534920364", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "MS C#", "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 m = s[1]; var t = s[2];\n var res = 0L;\n for (var nn = 4 ; nn <= n; nn++) {\n var mm = t - nn;\n if (mm < 0 || mm > m) continue;\n res += Comp(nn,n)*Comp(mm,m);\n }\n Console.WriteLine(res);\n }\n static long Comp(int m, int n) {\n var result 1L;\n for (var i = m+1 ; i <= n ; i++) result *= i;\n for (var i = 2 ; i <= n-m ; i++) result /= i;\n return result;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1a0a80ccdf72b4abac090ebc241bf7d3", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "MS C#", "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 m = s[1]; var t = s[2];\n var res = 0L;\n for (var nn = 4 ; nn <= n; nn++) {\n var mm = t - nn;\n if (mm < 0 || mm > m) continue;\n res += Comp(nn,n)*Comp(mm,m);\n }\n Console.WriteLine(res);\n }\n static long Comp(m,n) {\n var result 1L;\n for (var i = m+1 ; i <= n ; i++) result *= i;\n for (var i = 2 ; i <= n-m ; i++) result /= i;\n return result;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4fdd1f225823bd00141da78e5c0c7fb0", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nnamespace helloapp\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n int[] lucky = new int[100];\n int count = 0;\n for(int i=0; i<=num;i++){\n string str = i.ToString();\n bool flag = false;\n for(int j=0; j= 1 && x<=1000)\n {\n if(x % 4 == 0 || x % 7 == 0 || x % 47 == 0 || x % 74 =0 )\n {\n Console.WriteLine(\"YES\");\n }\n else if (line.Contains('4') || line.Contains('7'))\n {\n int f = 0;\n foreach (char c in line)\n {\n if (c != '4' && c != '7')\n {\n Console.WriteLine(\"NO\");\n f = 1;\n break;\n }\n }\n if (f == 0)\n {\n Console.WriteLine(\"YES\");\n }\n }\n else \n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8a5f7e0730818c87f6ba08844f3979a6", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "MS C#", "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 int n;\n bool x=false;\n n = Console.ReadLine();\n if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%444==0 || n%447==0 || n%474 || n%477==0 || n%744==0 || n%747==0 || n%774==0 || n%777==0){\n x = true;\n }\n if(x==false){\n Console.Write(\"FALSE\");\n }\n else{\n Console.Write(\"TRUE\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c9cf3f65c8fcb5f9093906b84b5b8c70", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "MS C#", "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 int n;\n bool x=false;\n n = Console.ReadLine();\n if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%444==0 || n%447==0 || n%474==0 || n%477==0 || n%744==0 || n%747==0 || n%774==0 || n%777==0){\n x = true;\n }\n if(x==false){\n Console.Write(\"FALSE\");\n }\n else{\n Console.Write(\"TRUE\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c050319fc55de47676dab73a98c1ed0b", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace rapidPrograming\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n= Convert.ToInt32(Console.ReadLine());\n var lucknums = new List();\n for(int i = 0; i < 1000; i++)\n {\n int digit1 = -1;\n int digit2 = -1;\n int digit3 = -1;\n digit1 = i % 10;\n if (i > 9)\n {\n digit2 = i / 10;\n\n }\n if (i > 99)\n {\n digit3 = i / 100;\n digit2 = (i-(digit3*100)) / 10;\n\n\n }\n\n if (digit1 == 7 || digit1 == 4)\n {\n if (digit2 == 7 || digit2 == 4||digit2==-1)\n {\n if (digit3 == 7 || digit3 == 4||digit3==-1)\n {\n lucknums.Add(i);\n] }\n }\n }\n }\n foreach(var num in lucknums)\n {\n if (n % num == 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n \n Console.WriteLine(\"NO\");\n\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "841f7a3a163c41563d4d2b727975c372", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\n static void Main(string[] args)\n {\n int npt = int.Parse(Console.ReadLine());\n int [] nms = {4, 7 , 47, 74, 447, 474, 477, 744, 747, 774};\n string answer = \"NO\";\n for(int i=0; i n % x == 0) ? \"YES\" : \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b70cb01f0004c5dfd471c99152a6450", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "Mono C#", "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 Program\n {\n static void Main1(string[] args)\n {\n var inputData = Console.ReadLine();\n int n = Convert.ToInt32(inputData);\n\n string[] words = new string[n];\n string[] shortWords = new string[n];\n for(int i =0; i 0)\n {\n int num = n % 10;\n if (num != 4 && num != 7)\n {\n Console.WriteLine(\"NO\");\n isOutput = true;\n break;\n }\n n = n / 10;\n }\n }\n if(!isOutput)\n Console.WriteLine(\"YES\");\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dbb06245d959e298d45d755e573a42a1", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_LuckyDivision\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] num = { 4, 7, 47, 74, 444, 474, 477, 744, 747, 777 };\n for (int i = 0; i < num.Length ; i++ )\n {\n if (n - num[i] == 0 || n % num[i] == 0)\n {\n Console.WriteLine(\"YES\");\n break;\n }\n if(i = num.Length -1)\n Console.WriteLine(\"NO\");\n \n \n }\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8d25eb1ef1256014458882af9055ee3c", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n\n namespace ConsoleApplication1\n {\n class Program\n {\n static void Main(string[] args)\n {\n int x;\n\n x = Convert.ToInt32(Console.ReadLine());\n List numberList = new List() { 4, 7, 44, 47, 74, 77, 444, 447, 474,477, 744, 747, 774, 777 };\n\n for (int c = 0; c < numberList.Count; c++)\n {\n if (x % numberList[c] == 0)\n {\n Console.Write(\"YES\");\n }\n }\n \n else if (x.ToString().Contains('0') || x.ToString().Contains('1') || x.ToString().Contains('2') || x.ToString().Contains('3') || x.ToString().Contains('5') ||\n x.ToString().Contains('6') || x.ToString().Contains('8') || x.ToString().Contains('9'))\n {\n Console.Write(\"NO\");\n }\n else\n {\n Console.Write(\"YES\");\n }\n\n \n\n }\n }\n\n\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ad783be9e7ad43c24521b1dd653fdbd5", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing DataStructures.HashTable;\nusing System.IO;\n\nnamespace SandBox\n{\n class Program\n {\n static string Main(string[] args)\n {\n var nums = new int[] {4,7,44,47,74,77,444,447,474,477,744,747,774,777 };\n var x = int.Parse(Console.ReadLine());\n foreach (var number in nums)\n {\n if (x % number == 0)\n return \"YES\";\n }\n return \"NO\";\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c9b5eb234fa1e394babc085db73dcb5c", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _122_A_Lucky_Division\n{\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n int n1 = int.Parse(n);\n if (n1 % 4 == 0 || n1 % 7 == 0)\n {\n if (n.Contains('4') || n.Contains('7')) \n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n\n } else\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "542de29b5b47c0c1caf9a92fdcb8f7a3", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _122_A_Lucky_Division\n{\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n int n1 = int.Parse(n);\n if (n.Contains('4') || n.Contains('7'))\n {\n if (n1 % 4 == 0 || n1 % 7 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n\n } else\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b5fc028ecd38baa40fe5229df4050118", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "Mono C#", "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 bool b = false , bb = false;\n\t\t\tstring s;\n\t\t\tint x; \n\t\t\ts = Console.ReadLine();\n\t\t\tx = int.Parse(s);\n\t\t\tif(x % 4 == 0 || x % 7 == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\tbb = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n \t\t for(int i = 0 ; i < s.Length ; i++)\n \t\t\t{\n \t\t\t\tif(s[i] == '4' || s[i] == '7')\n \t\t\t\t\tcontinue;\n \t\t\t\telse\n \t\t\t\t{\n \t\t\t\t b = true;\n \t\t\t\t\tConsole.WriteLine(\"NO\");\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t}\n\t\t\t}\n if(b != true && bb = false)\n Console.WriteLine(\"YES\");\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1a3122e0fd37658aa63a61e295da958c", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Test\n{\n\tpublic static void bolunuyormu(int say\u0131int)\n\t\t{\n\t\t\tstring ans = \"NO\";\n\t\t\tfor (int i = 0; i < say\u0131int; i++)\n\t\t\t{\n\t\t\t\tif ((!((i.ToString()).Contains('0')) && !((i.ToString()).Contains('1')) && !((i.ToString()).Contains('2')) && !((i.ToString()).Contains('3')) && !((i.ToString()).Contains('5')) && !((i.ToString()).Contains('6')) && !((i.ToString()).Contains('8')) && !((i.ToString()).Contains('9'))))\n\t\t\t\tif ((i.ToString()).Contains('4') || (i.ToString()).Contains('7'))\n\t\t\t\t{\n\t\t\t\t\tif (say\u0131int % i == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tans = \"YES\";\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\tans=\"NO\";\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}Console.WriteLine(ans);\n\t\t}\n\tpublic static void Main()\n\t{\n\tstring sayi = Console.ReadLine();\n\t\t\tint say\u0131int = Convert.ToInt32(sayi);\n\t\t\tint sayac = 0;\n\t\t\tif (sayi.Contains('4') || sayi.Contains('7'))\n\t\t\t{\n\t\t\t\tfor(int i = 0; i < sayi.Length; i++)\n\t\t\t\t{\n\t\t\t\t\tif(sayi[i]=='4' || sayi[i] == '7')\n\t\t\t\t\t{\n\t\t\t\t\t\tsayac++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (sayac == sayi.Length)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbolunuyormu(say\u0131int);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbolunuyormu(say\u0131int);\n\t\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2a552446b10030e5728cecbb249d7226", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\n static void Main(string[] args)\n {\n int npt = int.Parse(Console.ReadLine());\n int [] nms = {4, 7 , 47, 74, 447, 474, 477, 744, 747, 774};\n string answer = \"NO\";\n for(int i=0; i\n\n \n \n Debug\n AnyCPU\n {133BFF55-BB99-491D-BE6A-40155186B47A}\n Exe\n Probl\u00e9m_2\n Probl\u00e9m 2\n v4.6.1\n 512\n true\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "82884bac79569c3d829826e9c75fdffc", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {400A0D5A-49BD-4248-AAA0-90D0EBAE6857}\n Exe\n Properties\n Contest_61\n Contest-61\n v4.0\n Client\n 512\n \n \n x86\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n x86\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3ddb1fa8329a5725787529e10d78dd68", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0} {"lang": "MS C#", "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 {\nstring a=Console.ReadLine();\nstring b=Console.ReadLine();\nstring c=a;\nfor(i=0;i (int.Parse(arr1[2])) + 1) sub--;\n Console.Write(sub);\n*/\nConsole.Write(c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "296c3823b40eda3b34bb2a2614550883", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace Codeforces\n{\n class A61\n {\n static void Main(string[] args)\n {\n String s = Console.ReadLine();\n int n = Convert.ToInt32(s, 2), m = Convert.ToInt32(Console.ReadLine(), 2), k = s.Length, l = Convert.ToString(n ^ m, 2).Length;\n Console.Write(new string('0', k-l));\n Console.WriteLine(Convert.ToString(n^m, 2));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0d19d2dbe21321c4bf872cf65fb83bfc", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {74035856-32D3-4D77-972B-A211EA8AD298}\n Exe\n Properties\n codeforces\n codeforces\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "02bdf8c7dc9a6e67047ef829a08e59fc", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.421\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Probl\u00e9m 2\", \"Probl\u00e9m 2\\Probl\u00e9m 2.csproj\", \"{133BFF55-BB99-491D-BE6A-40155186B47A}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{133BFF55-BB99-491D-BE6A-40155186B47A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{133BFF55-BB99-491D-BE6A-40155186B47A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{133BFF55-BB99-491D-BE6A-40155186B47A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{133BFF55-BB99-491D-BE6A-40155186B47A}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {A78C646A-D98B-4E05-B3D7-3F96AA936792}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2911b90dd539db65c349f4d7fa7dc71e", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0411\u044b\u0441\u0442\u0440\u044b\u0439_\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string str2 = Console.ReadLine();\n\n for (int i = 0; i < str1.Length; i++)\n if (str1[i] != str2[i]) Console.Write(1);\n else Console.Write(0);\n\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "61e6dd248370b619de3cd097db8b7b1a", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0} {"lang": "MS C#", "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 b=Console.ReadLine();\n string c=a;\n for(int i=0 ; i < a.Length ; i++)\n {\n if( a[i].ToString() == b[i].ToString() )\n { c[i] =new string(\"0\") ;}\n else\n { c[i] =new string ( \"1\" ) ;}\n }\n Console.Write(c);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4299f8ed5ee0a0ba7257e76874920b2b", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0} {"lang": "MS C#", "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 b=Console.ReadLine();\n string c=a;\n for(int i=0 ; i= n)\n {\n r = m - 1;\n if (m < rez) \n rez = m; \n }\n }\n }\n\n return rez;\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "389f74fa48c7469570fa1892991fec97", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeff\n \ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n SortedDictionary sd = new SortedDictionary();\n\n string s = Console.ReadLine();\n BigInteger bi = BigInteger.Parse(\"9\" + s);\n\n\n if (bi.ToString().IndexOf(\"1111111\") >= 0 || bi.ToString().IndexOf(\"0000000\") >= 0)\n sd[bi] = \"YES\";\n else\n sd[bi] = \"NO\";\n\n Console.WriteLine(sd.Values.First());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e15116bfe85aaecadb9c8b884e441fdc", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n=Convert.ToInt32(console.readline());\n int[] a=new int[n];\n fro(int i=0;i<=a.length;i++)\n {\n if(a[0]==1&&a[1]==1&&a[2]==1&&a[3]==1&&a[4]==1&&a[5]==1&&a[6]==1 ||a[1]==1&&a[2]==1&&a[3]==1&&a[4]==1&&a[5]==1&&a[6]==1&&a[7]==1 || a[2]==1&&a[3]==1&&a[4]==1&&a[5]==1&&a[6]==1&&a[7]==1&&a[8]==1 || a[3]==1&&a[4]==1&&a[5]==1&&a[6]==1&&a[7]==1&&a[8]==1&&a[9]==1 || a[4]==1&&a[5]==1&&a[6]==1&&a[7]==1&&a[8]==1&&a[9]==1&&a[10]==1 || a[5]==1&&a[6]==1&&a[7]==1&&a[8]==1&&a[9]==1&&a[10]==1&&a[11]==1 || a[6]==1&&a[7]==1&&a[8]==1&&a[9]==1&&a[10]==1&&a[11]==1&&a[12]==1 || a[7]==1&&a[8]==1&&a[9]==1&&a[10]==1&&a[11]==1&&a[12]==1&&a[13]==1 || a[8]==1&&a[9]==1&&a[10]==1&&a[11]==1&&a[12]==1&&a[13]==1&&a[14]==1)\n {\n console.writeline(\"Yes\");\n }\n else if(a[0]==0&&a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0&&a[6]==0 ||a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0&&a[6]==0&&a[7]==0 ||a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0&&a[6]==0&&a[7]==0&&a[8]==0|| a[3]==0&&a[4]==0&&a[5]==0&&a[6]==0&&a[7]==0&&a[8]==0&&a[9]==0 || a[4]==0&&a[5]==0&&a[6]==0&&a[7]==0&&a[8]==0&&a[9]==0&&a[10]==0 || a[5]==0&&a[6]==0&&a[7]==0&&a[8]==0&&a[9]==0&&a[10]==0&&a[11]==0 || a[6]==0&&a[7]==0&&a[8]==0&&a[9]==0&&a[10]==0&&a[11]==0&&a[12]==0 || a[7]==0&&a[8]==0&&a[9]==0&&a[10]==0&&a[11]==0&&a[12]==0&&a[13]==0 || a[8]==0&&a[9]==0&&a[10]==0&&a[11]==0&&a[12]==0&&a[13]==0&&a[14]==0)\n {\n console.writeline(\"Yes\");\n }\n else\n {\n console.writeline(\"No\");\n }\n }\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "93cd2fa57ef2bb5a550f43aaa2a2ec6c", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "ususing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\n\nnamespace ProjectEuler\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n \n StringBuilder sb = new StringBuilder(str1);\n int length = str1.Length;\n\n int counter1 = 0, counter0 = 0;\n\n for (int i = 0; i < length; i++)\n {\n \n switch (sb[i])\n {\n case '0':\n counter0++;\n counter1 = 0;\n break;\n case '1':\n counter1++;\n counter0 = 0;\n break;\n default:\n break;\n }\n \n }\n\n if (counter1 >6 || counter0 > 6)\n {\n Console.WriteLine(\"YES\");\n\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n } \n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c5fc06f21c5f08ebf0592674c5706ede", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nclass program{\n static void Main(){\n var str = Console.ReadLine();\n Console.WriteLine(str.Contains(\"1111111\") ? \"YES\", \"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "02e34090cb4eb7fa378430e978c1d8f6", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n \npublic class Program\n{\n public static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n int count1=0,count2=0,i=0;\n while(count1!=7&&count2!=7&&i= 7)\n {\n Console.WriteLine(\"YES\");\n break;\n }\n }\n else\n i = 0;}\n if (i < 7) Console.WriteLine(\"NO\");\n\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d47dbf16b412e907b16ccece693ff03b", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System; \n\n class Exercise11 \n\n{ \n \n static void Main()\n \n {\n string str=Console.ReadLine();\n int t=0;\n int one = 0,zero = 0;\n for(int i = 0; i < str.Length; i++)\n {\n if(str[i] == '1')\n {\n one++;\n zero = 0;\n }\n else\n {\n zero++;\n one = 0;\n }\n if(one == 7 || zero == 7)\n {\n t=1;\n break;\n }\n }\n if(t==1)\n {\n Console.WriteLine(\"YES\");\n }\n else{\n Console.WriteLine(\"NO\");\n }\n \n }]", "lang_cluster": "C#", "compilation_error": true, "code_uid": "24ebc003f3450e2ec0c554683bc7cef3", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " class goodCoin\n {\n public static void Main() {\n string str = Console.ReadLine();\n int count=1;\n for (int i = 1; i < str.Length; i++){\n if (str[i] == str[i - 1])\n count++;\n else\n count = 1;\n if (count == 7)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0804576fd52640a7169fd07bf8bef47e", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27703.2035\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleProject\", \"ConsoleProject\\ConsoleProject.csproj\", \"{0DFCDCCE-C1DC-49C8-A41C-BD8EC4D48155}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{0DFCDCCE-C1DC-49C8-A41C-BD8EC4D48155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0DFCDCCE-C1DC-49C8-A41C-BD8EC4D48155}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0DFCDCCE-C1DC-49C8-A41C-BD8EC4D48155}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0DFCDCCE-C1DC-49C8-A41C-BD8EC4D48155}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {00C6C418-E2F3-480F-9B60-DB3CAE79C52A}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "88194dfeb56fd53ca7227865f9208e95", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "MS C#", "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 string s = Console.ReadLine();\n\n if (s.Contains(\"1111111\")||(s.Contains(\"0000000\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2bb3027a235223d7cc7ebf67b21dd5c3", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "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 str = Console.ReadLine();\n int i = 0;\n for (int j = 1; j < str.Length - 1; j++){\n if (str[0] = str[1]) i;\n if (str[j] == str[j + 1])\n {\n if (str[j] != str[j - 1]) i++;\n i++;\n if (i >= 7)\n {\n Console.WriteLine(\"YES\");\n break;\n }\n }\n else\n i = 0;}\n if (i < 7) Console.WriteLine(\"NO\");\n\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d7c5c25e40db856a29b7489f1e954fb2", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeff\nnamespace ConsoleApplication31\n{\n class Program\n {\n static void Main(string[] args)\n {\n int iTeamCounter = 0;\n int iiTeamCounter = 0;\n Boolean inI = false;\n Boolean inII = false;\n string playersSituation = Console.ReadLine();\n foreach(char pS in playersSituation)\n { \n if(pS == '1')\n {\n iTeamCounter++;\n iiTeamCounter = 0;\n if(iTeamCounter > 6)\n {\n break;\n }\n }\n else\n {\n iiTeamCounter++;\n iTeamCounter = 0;\n if (iiTeamCounter > 6)\n {\n break;\n }\n }\n }\n if(iTeamCounter > 6 || iiTeamCounter > 6)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e266a70811d8cb594cba8240bfbf701a", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication1\", \"ConsoleApplication1\\ConsoleApplication1.csproj\", \"{C4298DD8-0C11-4862-9481-A31957574028}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{C4298DD8-0C11-4862-9481-A31957574028}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{C4298DD8-0C11-4862-9481-A31957574028}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{C4298DD8-0C11-4862-9481-A31957574028}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{C4298DD8-0C11-4862-9481-A31957574028}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d187261101c96d089ccf364dcf425869", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n \npublic class Program\n{\n public static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n int count1=0,count2=0,i=0;\n while(count!=7&&i();\n\n string s = Console.ReadLine();\n string bi = \"9\" + s;\n\n\n if (bi.ToString().IndexOf(\"1111111\") >= 0 || bi.ToString().IndexOf(\"0000000\") >= 0)\n sd[bi] = \"YES\";\n else\n sd[bi] = \"NO\";\n\n Console.WriteLine(sd.Values.First());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "838b82b2c08c154cf551ed3481d7537b", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "string input = Console.ReadLine();\n int count = 0;\n for (int i = 0; i < 2; i++)\n {\n string m= Convert.ToString(i);\n string patern = m+m+m+m+m+m+m;\n int n = 0;\n while ((n = input.IndexOf(patern, n)) != -1)\n {\n n += patern.Length;\n count++;\n } \n }\n if (count > 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1001343be0683be9029133da4d59560d", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {DE847C89-9EE1-4B12-8290-0954EAD0D463}\n Exe\n Properties\n ConsoleApplication3\n ConsoleApplication3\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a0587a62ad3d5d42caa87d98e2c6c4a3", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \nint s=Convert.ToInt32(console.readline());\nif(s.contains()==\"1111111\" || s.contains()==\"0000000\")\n{console.writeline(\"yes\");}\nelse{console.writeline(\"no\");}\n \n \n \n \n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b3ff1e814ec191b925e5fbc384fb8411", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " public static void Main() {\n string str = Console.ReadLine();\n int count=1;\n for (int i = 1; i < str.Length; i++){\n if (str[i] == str[i - 1])\n count++;\n else\n count = 1;\n if (count == 7)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5898e9950fcbd0091d21e819223f2828", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " class Exercise11 \n\n{ \n \n static void Main()\n \n {\n string str=Console.ReadLine();\n int t=0;\n int one = 0,zero = 0;\n for(int i = 0; i < str.Length; i++)\n {\n if(str[i] == '1')\n {\n one++;\n zero = 0;\n }\n else\n {\n zero++;\n one = 0;\n }\n if(one == 7 || zero == 7)\n {\n t=1;\n break;\n }\n }\n if(t==1)\n {\n Console.WriteLine(\"YES\");\n }\n else{\n Console.WriteLine(\"NO\");\n }\n \n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8a336ae1b4a9be950b247c7727c6c9e2", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\n public class Program\n {\n static void main()\n {\n String str = Console.ReadLine();\n if (str.Length>7)\n {\n if (str.Contains(\"0000000\") || str.Contains(\"1111111\"))\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 ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "53d8a55ae3eba9dc20e8ece8e74e1842", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\n public class A96\n {\n static void main()\n {\n String str = Console.ReadLine();\n if (str.Length>7)\n {\n if (str.Contains(\"0000000\") || str.Contains(\"1111111\"))\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 ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f5d9b8b30f30202b7b132b69cfdba187", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26430.12\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Algoritms\", \"Algoritms\\Algoritms.csproj\", \"{D76EAD0F-3DCA-4720-981A-A1CC8B957629}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{D76EAD0F-3DCA-4720-981A-A1CC8B957629}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{D76EAD0F-3DCA-4720-981A-A1CC8B957629}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{D76EAD0F-3DCA-4720-981A-A1CC8B957629}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{D76EAD0F-3DCA-4720-981A-A1CC8B957629}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "483c8c5081e143f0499cc81d552d2f6b", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "difficulty": 1100.0} {"lang": "Mono C#", "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 double aMain(string[] args)\n {\n int n;\n string s;\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 n\");\n n = int.Parse(Console.ReadLine());\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 s\");\n s = Console.ReadLine();\n string answer = \"\";\n double counter=0;\n for (int i = 0; i < n; i++)\n {\n if (counter == 0)\n if (s[i].ToString() == \"0\") { answer += i.ToString(); counter = i;}\n else;\n else if(s[i].ToString() == \"0\") { answer += (i - counter - 1).ToString(); counter = i; }\n\n }\n if (counter == 0) answer = n.ToString();\n else\n answer+=(n-1-counter).ToString();\n counter = int.Parse(answer);\n return counter;\n Console.WriteLine(counter);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "04244ac28d1b6ff8e67429176611ed38", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "difficulty": 1100.0} {"lang": "MS C#", "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 }\n\n public static int[][] boxBlur(int[][] arr)\n {\n int[,] forReturn = new int[arr.Length, arr[0].Length - 2];\n int startIndex = 0;\n int number = 0;\n for (int i = 0; i < arr.Length; i++)\n {\n for (int j = 0; j < arr[0].Length - 2; j++)\n {\n startIndex = j;\n for (int k = 0; k < 4; k++)\n {\n number += \n }\n }\n }\n {\n\n }\n\n }\n\n\n\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "59620ea89e431ed49c5ebd722dc3e1be", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "difficulty": 1100.0} {"lang": "Mono C#", "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\t\tList nums = Console.ReadLine ().Split (' ').Select (long.Parse).Distinct ().ToList ();\n\t\tint result = 0;\n\t\twhile (nums.Count > 0) {\n\t\t\tlong 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 \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "46c6c033a8026e03418a25b57d09e64f", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "#include\n#include\n#include\n#include\n//#include\nint coso2 (std::string s);\nint main ()\n{\n\tint t;\n\tstd::cin >> t;\n\twhile(t-->0)\n\t{\n\t\tstd::string s; std::cin >> s;\n\t\tint kq { 0 },sos0 { 0 };\n\t\tfor(int i = 0; i < s.length (); i++)\n\t\t{\n\t\t\tif(s[i] == '1')\n\t\t\t{\n\t\t\t\tfor(int j = i; j < s.length (); j++)\n\t\t\t\t{\n\t\t\t\t\tint now = coso2 (s.substr (i,j - i + 1));\n\t\t\t\t\tif(now > pow (2,18)) break;\n\t\t\t\t\telse if(now <= j - i + 1 + sos0)kq++;\n\t\t\t\t}\n\t\t\t\tsos0 = 0;\n\t\t\t}\n\t\t\telse sos0++;\n\t\t}\n\t\tstd::cout << kq;\n\t}\n}\nint coso2 (std::string s)\n{\n\tint kq { 0 };\n\tfor(int i = 0; i < s.length(); i++)\n\t\tkq = 2 * kq + s[i] == '1';\n\treturn kq;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a0368b1bf630653718debce3646699c0", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "40f423b661134caf25e7b3a5428a957b", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": " 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[] data = new int[input.Length];\n int min = 0;\n int max = 0;\n data[0] = int.Parse(input[0]);\n data[1] = int.Parse(input[1]);\n for (int i = 2; i < input.Length; ++i)\n {\n data[i] = int.Parse(input[i]);\n if (i % 2 == 0)\n min += data[i];\n else max += data[i];\n }\n input = null;\n StringBuilder bldr = new StringBuilder();\n if (data[1] >= min && data[1] <= max)\n {\n bldr.AppendLine(\"YES\");\n data[1] -= min;\n for(int i=2, toRender = 0; i data[i+1]-data[i] ? data[i + 1] : data[1]+data[i];\n data[1] -= toRender;\n }\n\n bldr.Append(toRender.ToString());\n bldr.Append(' ');\n }\n }\n else bldr.Append(\"NO\");\n data = null;\n Console.WriteLine(bldr.ToString());\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c4ea40171c53b6d0296bcabf769690ff", "src_uid": "f48ff06e65b70f49eee3d7cba5a6aed0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte[] a = Console.ReadLine().Split(' ').Select(s => byte.Parse(s)).ToArray();\n\n byte[,] c = new byte[a[0], 3];\n byte minHours = 0;\n byte maxHours = 0;\n\n for (byte i = 0; i < a[0]; i++)\n {\n byte[] b = Console.ReadLine().Split(' ').Select(s => byte.Parse(s)).ToArray();\n minHours += b[0];\n maxHours += b[1];\n c[i, 0] = b[0];\n c[i, 1] = b[1];\n c[i, 2] = b[0];\n }\n if (minHours<=a[1] && a[1] <= maxHours)\n {\n byte sumHours = minHours;\n\n for (byte i = 0; i < a[0]; i++)\n {\n if (sumHours + c[i, 1] - c[i,0] > a[1])\n {\n byte tail= (byte)(a[1] - sumHours);\n c[i, 2] += tail;\n sumHours += tail;\n }\n else\n {\n sumHours += (byte)(c[i, 1] - c[i, 0]);\n c[i, 2] += c[i, 1]; \n }\n if (sumHours >= a[1])\n break;\n }\n\n for (int i = 0; i < c.Length; i++)\n {\n Console.Write(c[i, 2] + \" \");\n }\n Console.Write(Environment.NewLine);\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n private void print (byte[,] c)\n {\n for (int i = 0; i < c.Length; i++)\n {\n Console.Write(c[i, 2] + \" \");\n Console.\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5913b88683a73e619b410ec121e3c211", "src_uid": "f48ff06e65b70f49eee3d7cba5a6aed0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml.Linq;\nusing static System.Console;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nums = ReadLine().Split(' ');\n int d = int.Parse(nums[0]);\n int sumTime = int.Parse(nums[1]);\n int[,] days = new int[d,2];\n int max = 0, min = 0;\n int curTime = 0;\n for (int i = 0; i sumTime)\n {\n WriteLine(\"NO\");\n }\n else\n {\n WriteLine(\"YES\");\n curTime = min;\n for (int j = 0; j0) {\n int k = Math.min(b[i]-c[i], sum);\n sum -= k;\n c[i] += k;\n }\n if (sum>0) {\n out.print(\"NO\"); return;\n }\n out.println(\"YES\");\n for (int i=0; i sumMax || s < sumMin){\n\t\t\tConsole.WriteLine(\"NO\");\n\t\t\treturn;\n\t\t}\n\t\twhile(true){\n\t\t\tfor(int i = 0; i < d; i++){\n\t\t\t\tsumMin += max[i] - minmin[i];\n\t\t\t\tif(sumMin >= s){\n\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\tforeach(int m in min) Console.Write(m + \" \");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "34c47c7b1d5fc463b46ff1426b6fa3b6", "src_uid": "f48ff06e65b70f49eee3d7cba5a6aed0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28010.2050\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"A\", \"A\\A.csproj\", \"{C9FB9D96-3899-4974-87C4-CB555D05344E}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{C9FB9D96-3899-4974-87C4-CB555D05344E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{C9FB9D96-3899-4974-87C4-CB555D05344E}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{C9FB9D96-3899-4974-87C4-CB555D05344E}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{C9FB9D96-3899-4974-87C4-CB555D05344E}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {C3CCFF32-9426-4D06-8B08-582D0264ADF8}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "54dadb7f6cb4084d53189f75f0bdae3d", "src_uid": "883f67177474d23d7a320d9dbfa70dd3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "/* Date: 07.12.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\\\\035\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2018\\\\Task\\\\07 Codeforces\\\\035\\\\A.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n# if ( ONLINE_JUDGE )\n\t\tint x = int.Parse (Console.ReadLine ());\n# else\n\t\tint x = int.Parse (sr.ReadLine ());\n# endif\n\n\t\tint a=x, b=2;\n\t\tbool ok = false;\n\t\tfor ( ; a > 1; a-- )\n\t\t{\n\t\t\tfor ( b = 2; b <= a; b++ )\n\t\t\t\tif ( a % b == 0 && a * b > x && a < b * x )\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\tif ( ok )\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( ! ok )\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (-1);\n# else\n\t\tsw.WriteLine (-1);\n# endif\n\t\telse\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (a + \" \" + b);\n# else\n\t\tsw.WriteLine (a + \" \" + b);\n# endif\n\n\t\tsw.Close ();\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "938d67065b41fe89320b5c015750f65d", "src_uid": "883f67177474d23d7a320d9dbfa70dd3", "difficulty": 800.0} {"lang": "MS C#", "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 (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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "272a695ea279a49e07f4e9f4b0ae6930", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0} {"lang": "MS C#", "source_code": " 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 == 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 if (b == 0) b = 2;\n else if (b == 1) b = 6;\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 Console.ReadKey();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5465e0cc3c0a8883641c7eceda1b559f", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0} {"lang": "MS C#", "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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2080c2178e26ac165da60c8b9ce2f29d", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace WorldGame\n{\n class Program\n {\n static int compareMove(string a,string b){\n int ans = 0;\n\n if (a == \"8<\") {\n if (b == \"[]\")\n return 1;\n }\n else if (a == \"()\") {\n if (b == \"[]\")\n return 1;\n\n }\n else if (a == \"[]\") {\n if (b == \"8<\")\n return -1;\n else if (b == \"()\")\n return -1;\n }\n\n return ans;\n }\n\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n int ans = 0;\n for (int i = 0; i < a.Length; i += 2) {\n string tempaA = a.Substring(i, 2);\n string tempaB = b.Substring(i, 2);\n ans += compareMove(tempaA, tempaB) \n \n }\n\n if(ans == 0)\n Console.WriteLine(\"TIE\");\n else if(ans < 0)\n Console.WriteLine(\"TEAM 2 WINS\");\n else\n Console.WriteLine(\"TEAM 1 WINS\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2969e45bdb6adbda746807f6d119faf8", "src_uid": "bdf2e78c47d078b4ba61741b6fbb23cf", "difficulty": 1700.0} {"lang": "MS C#", "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\n int s = 0;\n\n int[,] mas = { { 0, 1, -1 }, { -1, 0, 1 }, { 1, - 1, 0 } };\n\n for (int i = 0; i < s1.Length; i+=2)\n {\n int i1, j1;\n switch (s1[i])\n {\n case '8':\n i1 = 1;\n break;\n case '[':\n i1 = 0;\n break;\n case '(':\n i1 = 2;\n break;\n }\n switch (s2[i])\n {\n case '8':\n j1 = 1;\n break;\n case '[':\n j1 = 0;\n break;\n case '(':\n j1 = 2;\n break;\n }\n\n s += mas[i1, j1];\n }\n\n if (s == 0)\n {\n Console.Write(\"TIE\");\n }\n else\n {\n if (s > 0)\n {\n Console.Write(\"TEAM 1 WINS\");\n }\n else\n {\n Console.Write(\"TEAM 2 WINS\");\n }\n }\n } \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "667f4234621b32f94d796cb6ba439bbd", "src_uid": "bdf2e78c47d078b4ba61741b6fbb23cf", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n\n static void main(string[] args)\n {\n var inputString = Console.ReadLine();\n var inputArray = inputString.Split();\n\n\n var s = int.Parse(inputArray[0]);\n var v1 = int.Parse(inputArray[1]);\n var v2 = int.Parse(inputArray[2]);\n var t1 = int.Parse(inputArray[3]);\n var t2 = int.Parse(inputArray[4]);\n\n var firstResult = s * v1 + 2 * t1;\n var secondResult = s * v2 + 2 * t2;\n\n if(firstResult == secondResult) \n {\n Console.WriteLine(\"Friendship\");\n }else{\n if(firstResult < secondResult) {\n Console.WriteLine(\"First\");\n }else{\n Console.WriteLine(\"Second\");\n }\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "399ec5a3665677263c194f948cceef07", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nnamespace GeraldArt {\n class Program {\n static void Main(string[] args) {\n\n CommandManager cm = new CommandManager();\n int[] boardValues = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s));\n int[] paintOne = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s));\n int[] paintTwo = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s));\n\n int boardMax = boardValues[0] > boardValues[1] ? boardValues[0] : boardValues[1];\n int boardMin = boardValues[0] < boardValues[1] ? boardValues[0] : boardValues[1];\n\n int[] allValues = new int[4] {paintOne[0], paintOne[1], paintTwo[0], paintTwo[1] }.OrderBy(x => x).ToArray();\n\n if(boardMax >= (allValues[3] + allValues[0]) && (boardMin * 2) >= allValues[1] + allValues[2]) {\n Console.WriteLine(\"YES\");\n } else if((boardMax - allValues[3]) == 0 && (boardMin * 2) >= allValues[1] + allValues[2] + allValues[0]) {\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aea0a6ce6a5e5f35c829a8e9f6771b3e", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program{\nstatic void Main()\n{\nint a = int.Parse(Console.ReadLine);\nConsole.Write((((a-1)*a*6) + 1));\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ae3fccc786cf1e70ab4d96a9c238bd89", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1300.0} {"lang": "Mono C#", "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 str1 = Console.ReadLine();\n string str2 = Console.ReadLine();\n StringBuilder sb = new StringBuilder(str1);\n int n = int.Parse(str2);\n string str3 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n for (int i = 0; i < sb.Length; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (sb[i]==str3[j])\n {\n sb[i] = str3[j];\n }\n }\n }\n Console.WriteLine(sb.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4f60c20d8f038429000c89d33e1ae807", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n==1?1:13);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "18dfe8bb43fbc3c54e49f2677fc69cc1", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass P {\n string s = \n\"111111101010101111100101001111111\" +\n\"100000100000000001010110001000001\" +\n\"101110100110110000011010001011101\" +\n\"101110101011001001111101001011101\" +\n\"101110101100011000111100101011101\" +\n\"100000101010101011010000101000001\" +\n\"111111101010101010101010101111111\" +\n\"000000001111101111100111100000000\" +\n\"100010111100100001011110111111001\" +\n\"110111001111111100100001000101100\" +\n\"011100111010000101000111010001010\" +\n\"011110000110001111110101100000011\" +\n\"111111111111111000111001001011000\" +\n\"111000010111010011010011010100100\" +\n\"101010100010110010110101010000010\" +\n\"101100000101010001111101000000000\" +\n\"000010100011001101000111101011010\" +\n\"101001001111101111000101010001110\" +\n\"101101111111000100100001110001000\" +\n\"000010011000100110000011010000010\" +\n\"001101101001101110010010011011000\" +\n\"011101011010001000111101010100110\" +\n\"111010100110011101001101000001110\" +\n\"110001010010101111000101111111000\" +\n\"001000111011100001010110111110000\" +\n\"000000001110010110100010100010110\" +\n\"111111101000101111000110101011010\" +\n\"100000100111010101111100100011011\" +\n\"101110101001010000101000111111000\" +\n\"101110100011010010010111111011010\"+\n\"101110100100011011110110101110000\"+\n\"100000100110011001111100111100000\"+\n\"111111101101000101001101110010001\";\n\n static void Main() {\n var i = Console.ReadLine().Split(' ').Select(int.Parse).Select(x => x-1)\n .Aggregate(0, (acc,a) => acc*32+a);\n Console.Write(s[i]);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4acb0e680faabca260450614e7e8e9f9", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection.Metadata;\nusing System.Threading;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1de7b3feb57b9b77940e0197be7047c7", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "Mono C#", "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 0;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8dda3f523ebd8ace9998e8bace60f55c", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "Mono C#", "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(x => int.Parse(x)).ToArray();\n var n = input1[0];\n // var k = input1[1];\n\n var x = Console.ReadLine().ToCharArray();\n\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d386c744cc5f324e1f31f7d7ebd57ac8", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "MS C#", "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\tstring line1 = Console.ReadLine();\n\t\t\tstring line2 = Console.ReadLine();\n\t\t\tstring[] split = line1.Split(new Char[] { ' ', ',', '.', ':', '\\t' });\n\t\t\tstring[] split2 = line2.Split(new Char[] { ' ', ',', '.', ':', '\\t' });\n\t\t\tint n = Int32.Parse(split[0]);\n\t\t\tint s = Int32.Parse(split[1]);\n\t\t\tint[] integers = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tintegers[i] = Int32.Parse(split2[i]);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(\"YES\");\n\t\t}\n\n\t}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d46d06c5ff98a276064ca1e8d75d6eb0", "src_uid": "496baae594b32c5ffda35b896ebde629", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Numerics;\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 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=(int)BigInteger.GreatestCommonDivisor(ab[i],n);\n n-=m;\n i=(i+1)%2;\n\n }\n\n }\n public static void Main ()\n {\n Z119A ();\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "90c4e8b8bfef01a9f0d8544d4fd926a4", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "static void Main(String[] args)\n {\n int[] arrInput = Console.ReadLine().Split(' ').Select(k => int.Parse(k)).ToArray();\n\n int simon = arrInput[0];\n int antisimon = arrInput[1];\n int stones = arrInput[2];\n int finalResult = -1;\n int j = 1;\n\n while (j<=100)\n {\n if (stones < simon)\n {\n finalResult = 1;\n break;\n }\n\n int simonChance = GCD(simon, stones);\n\n stones -= simonChance;\n\n if (stones < antisimon)\n {\n finalResult = 0;\n break;\n }\n\n int antisimonChance = GCD(antisimon, stones);\n\n stones -= antisimonChance;\n\n j++;\n }\n\n Console.WriteLine(finalResult);\n \n }\n\n private 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\n return a == 0 ? b : a;\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9dad46dc34f1312b88e8850d9cba2101", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nclass test\n{\n\tpublic static int hrm(int i, int n)\n\t{\n\t\tfor(int j=n;j>0;j--)\n\t\t\t{\n\t\t\t\tif(j%n==0 && i%j==0) return j;\n\t\t\t}\n\t\n\t}\n\tpublic static void Main()\n\t{\n\t\tstring []input = Console.ReadLine().Split();\n int []input_v = new int [input.Length];\n \n for(int i=0;i0)\n \t{\n \tif(j%2==0){input_v[2]-=hrm(input_v[0],input_v[2]);}\n \telse if(j%2!=0){input_v[2]-=hrm(input_v[1],input_v[2]);}\n \t\n \tj++;\n \t}\n \n j--;\n \n if(j%2==0){Console.WriteLine(\"0\");}\n if(j%2!=0){Console.WriteLine(\"1\");}\n\n\t}\n\n\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9fce1d308377d5274153a99e7e14b85f", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "var x=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\tint a=x[0];\n\t\tint b=x[1];\n\t\tint n=x[2];\n\t\tint s=0, q=0;\n\t\t\n\t\twhile(n>0)\n\t\t{\n\t\t\tif(q==0)\n\t\t\t{\n\t\t\t s=gcd(a,n);\n\t\t\t n-=s;\n\t\t\t q=1;\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ts=gcd(b,n);\n\t\t\t\tn-=s;\n\t\t\t\tq=0;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(q==0? \"1\":\"0\");\n\t\t\n\t}\n\tpublic static int gcd(int y, int z)\n\t{\n\t\twhile (y!= z)\n {\n if (y > z)\n y = y- z;\n\n if (z > y)\n z = z - y;\n }\n return y;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "74783813944604437663647b68045206", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Numerics;\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 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=(int)BigInteger.GreatestCommonDivisor(ab[i],n);\n n-=m;\n i=(i+1)%2;\n\n }\n\n }\n public static void Main ()\n {\n Z119A ();\n }\n\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1e67cd5448bd2a8e98f1c3699203a0ea", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass test\n{\n\tpublic static hrm(int i, int n)\n\t{\n\t\tfor(int j=n;j>0;j++)\n\t\t\t{\n\t\t\t\tif(j%n==0 && i%j==0) return j;\n\t\t\t}\n\t\n\t}\n\tpublic static void Main()\n\t{\n\t\tstring []input = Console.ReadLine().Split();\n int []input_v = new int [input.Length];\n \n for(int i=0;i0)\n \t{\n \tif(j%2==0){input_v[2]-=hrm(input_v[0],input_v[2]);}\n \telse if(j%2!=0){input_v[2]-=hrm(input_v[1],input_v[2]);}\n \t\n \tj++;\n \t}\n \n j--;\n \n if(j%2==0){Console.WriteLine(\"0\");}\n if(j%2!=0){Console.WriteLine(\"1\");}\n\n\t}\n\n\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e6a4c0b189153aeecb8c05d8766fcdef", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "sing System;\nusing System.Linq;\n\nnamespace _119A\n{\n class Program\n {\n static void Main()\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int winner=0;\n while (true)\n {\n if (FindGCD(input[0], input[1]) <= input[2])\n input[2] -= input[0];\n else { winner = 1; break; }\n if (FindGCD(input[0], input[1]) <= input[2])\n input[2] -= input[1];\n else { winner = 0; break; }\n }\n Console.WriteLine(winner);\n }\n\n static int FindGCD(int x,int y)\n {\n int GCD=0;\n if (y > 0)\n {\n for (int i = 1; i <= Math.Min(x, y); i++)\n {\n if ((x % i == 0) && (y % i == 0)) { GCD = i; }\n }\n }\n else GCD = x;\n return GCD;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4243a969bdc63ab24897773aef528303", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass test\n{\n\tpublic static int hrm(int i, int n)\n\t{\n\t\tfor(int j=n;j>0;j++)\n\t\t\t{\n\t\t\t\tif(j%n==0 && i%j==0) return j;\n\t\t\t}\n\t\n\t}\n\tpublic static void Main()\n\t{\n\t\tstring []input = Console.ReadLine().Split();\n int []input_v = new int [input.Length];\n \n for(int i=0;i0)\n \t{\n \tif(j%2==0){input_v[2]-=hrm(input_v[0],input_v[2]);}\n \telse if(j%2!=0){input_v[2]-=hrm(input_v[1],input_v[2]);}\n \t\n \tj++;\n \t}\n \n j--;\n \n if(j%2==0){Console.WriteLine(\"0\");}\n if(j%2!=0){Console.WriteLine(\"1\");}\n\n\t}\n\n\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "27ef8177f36a3a23a449a0a5b01f58af", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Text;\nusing System.Net;\n\nclass app{\npublic int main (string[] args){\nint getResult (int n, int k){\n\n\n\tif (n >= 1 && n <= 10 && k >= 1 && k <= 240){\n\t\tint total = 0;\n\t\tint time = 0;\n\t\tfor (int i =0; i<=n; i++){\n\t\t\t\n\t\t\ttime += 5*i;\n\t\t\n\t\t\tif (time <= (240 - k)){\n\t\t\t\ttotal = i;\n\t\t\t}\n\t\t\n\n\t\t\t\n\t\t}\n\t\t\n\t\treturn total;\n\t}\n}\n\nint\tn = Console.ReadLine();\n\tint k = Console.ReadLine();\n\nConsole.WriteLine(getResult(n,k));\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6c7e8d6927ef289b56566e764833c94d", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "MS C#", "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 n = int.Parse(Console.ReadLine());\n int k = int.Parse(Console.ReadLine());\n\n Console.WriteLine(getResult(n, k));\n\n }\n\n static int getResult(int n, int k)\n {\n\n\n if (n >= 1 && n <= 10 && k >= 1 && k <= 240)\n {\n int total = 0;\n int time = 0;\n for (int i = 0; i <= n; i++)\n {\n\n time += 5 * i;\n\n if (time <= (240 - k))\n {\n total = i;\n }\n\n\n\n }\n\n return total;\n }\n\n throw new Exception (\"not a valid input\");\n }\n\n}\n}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3233b2283d905e65ee2334e07703fddd", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Task1\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 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 }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "86749f25b47c232dc8202eb021052c7e", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "int getResult (int n, int k){\n\tn = Console.ReadLine();\n\tk = Console.ReadLine();\n\n\tif (n >= 1 && n <= 10 && k >= 1 && k <= 240){\n\t\tint total = 0;\n\t\tint time = 0;\n\t\tfor (int i =0; i<=n; i++){\n\t\t\t\n\t\t\ttime += 5*i;\n\t\t\n\t\t\tif (time <= (240 - k)){\n\t\t\t\ttotal = i;\n\t\t\t}\n\t\t\n\n\t\t\t\n\t\t}\n\t\t\n\t\treturn total;\n\t}\n}\n\nConsole.WriteLine(getResult());", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fd61c90799bca99813cb01ca3fdbad27", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Data.Common;\nusing System.Net.NetworkInformation;\n\nclass Solution\n{\n static void Main()\n {\n string[] input = Console.ReadLine().Split();\n int problems = int.Parse(input[0]);\n int minutesToParty = int.Parse(input[1]);\n int sumOfTime = 240 - minutesToParty;\n int problemsTime = 0;\n int result = 0;\n\n for (int i = 1; i <= problems; i++)\n {\n problemsTime += 5 * i;\n if (problemsTime > sumOfTime) { result = i - 1; break; }\n else { result = problems; }\n }\n\n Console.WriteLine(result);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e30a8952db51101f403678bdedcc26b4", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n \npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\t// your code goes here\n\t\tstring[] req = Console.ReadLine().Split(' ');\n \n\t\tint n = int.Parse(req[0]);\n\t\tint timeToGet = int.Parse(req[1]);\n \n\t\tint time = 240 - timeToGet;\n \n\t\tint res = 1;\n \n\t\twhile(time - res * 5 > 0)\n\t\t{\n\t\t\ttime -= res * 5;\n \n\t\t\tres++;\n\t\t}\n\t\t\n\t\tif(res > n)\n\t\t\tConsole.WriteLine(n);\n\t\telse\n\t\t\tConsole.WriteLine(res);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "35950f5e841928bccb386ee22b106ea8", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "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 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 }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8db7557c41a4f6b36d817a817421d46f", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " 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 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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "69e4e502a2ffcb5956d94a7c14903bea", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.29509.3\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Task1\", \"Task1\\Task1.csproj\", \"{5A27BC8F-F6D7-41A2-AC11-C0BF02543CAE}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{5A27BC8F-F6D7-41A2-AC11-C0BF02543CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{5A27BC8F-F6D7-41A2-AC11-C0BF02543CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{5A27BC8F-F6D7-41A2-AC11-C0BF02543CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{5A27BC8F-F6D7-41A2-AC11-C0BF02543CAE}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {8475236D-27CA-4AB8-A9CD-7183B1C01BAD}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aaf2d1235594593c49117d5c1f40cb90", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.29509.3\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"ConsoleApp10\", \"ConsoleApp9\\ConsoleApp10.csproj\", \"{AF1A0E8D-1DD1-4A0A-8824-86D404EF767C}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{AF1A0E8D-1DD1-4A0A-8824-86D404EF767C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{AF1A0E8D-1DD1-4A0A-8824-86D404EF767C}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{AF1A0E8D-1DD1-4A0A-8824-86D404EF767C}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{AF1A0E8D-1DD1-4A0A-8824-86D404EF767C}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {48C357CA-275C-4A96-8B87-745476B991E9}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "839dfb20fa879d6ff390034a5243ee62", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Task2\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 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 }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fd04a1a6d2f5e50f76c01f3094c5a993", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace vlad.a\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]), t = 240 - Convert.ToInt32(ss[1]);\n int[] i = new int[9];\n for (int j = 0; j < i.Length; j++)\n i[j] = 5 * (j + 1);\n\n int counter = 0;\n for (int j = t; j > 0; j -= i[counter], counter++)\n {\n if (counter == n)\n break;\n if (j - i[counter] < 0)\n break;\n }\n Console.WriteLine(counter);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d01a3816c25847655aab40fa4d9ceb06", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nk = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int time = 240, numberOfProblems = 0;\n\n time -= nk[1];\n\n while ((time - (5 * (numberOfProblems + 1))) >= 0 && nk[0] > 0)\n {\n time -= 5 * (numberOfProblems + 1);\n numberOfProblems++;\n nk[0]--;\n }\n\n Console.WriteLine(numberOfProblems);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6c1155e5148c5ed8d000db6892eae8c4", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NSproul //1\n{\n class Program\n {\n static void Main()\n {\n int[] ins = Console.ReadLine().Split();\n\t\t\tint l = ins[0];\n\t\t\tint d = ins[1];\n\t\t\tint n = ins[2];\n\t\t\tchar s = 'L';\n\t\t\tint lout = 0;\n\t\t\tint dout = 0;\n\t\t\t\n if (n%2 == 0) {\n\t\t\t\ts = 'R';\n\t\t\t\tn /= 2;\n\t\t\t}\n\t\t\telse n = (n+1)/2;\n\t\t\t\n\t\t\tlout = Math.Ceiling(n/d);\n\t\t\t\n\t\t\tif (n%d == 0) dout = d;\n\t\t\telse dout = n%d;\n\t\t\t\n Console.WriteLine(lout + \" \" + dout + \" \" + s);\n }\n }\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d6826a2bbf7ca1f65ed62d1acff55acf", "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.438\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"TASK_1095A\", \"TASK_1095A\\TASK_1095A.csproj\", \"{B8C18103-3536-45FE-90D6-2349DA475A8F}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B8C18103-3536-45FE-90D6-2349DA475A8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B8C18103-3536-45FE-90D6-2349DA475A8F}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B8C18103-3536-45FE-90D6-2349DA475A8F}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B8C18103-3536-45FE-90D6-2349DA475A8F}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {32363573-B06E-4919-B868-2CC340332646}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8ea8f2bf36ca8f394de724932695e04a", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\npublic class Class1\n{\n\tpublic Class1()\n\t{\n int n;\n n = Console.ReadLine();\n String s = Console.ReadLine();\n for (int i = 1; i <= n; i++)\n {\n for(int j = 1; j <= i; j++)\n {\n Console.WriteLine(s[i] + ' ');\n }\n }\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5678d30047a5da8a25d05247cf77817d", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace codeforces1095A\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 long j = 0;\n for (long i = 0; i symbols = new Dictionary();\n for (short i = 0; i < dim; i++)\n {\n symbols.Add(Console.ReadLine(), i);\n }\n StringBuilder sb = new StringBuilder();\n for (short i = 0; i < password.Length; i++)\n {\n sb.Append(password[i]);\n if ((i + 1) % 10 == 0)\n {\n Console.Write(symbols[sb.ToString()]);\n sb.Clear();\n }\n }\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0f977ec25aa0e78d74704d23a30421c6", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _486A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt64(Console.ReadLine());\n\n if (n % 2 == 0)\n {\n n = n / 2;\n }\n else\n {\n n = n / 2 - n;\n }\n\n Console.WriteLine(n);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2b5f6719b98b85b927514a28285eb800", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Problem___486A___A._Calculating_Function\n{\n class Program\n {\n static void Main(string[] args)\n {\n /*var input = long.Parse(Console.ReadLine());\n\n if (input>=1 && input<=1000000000000000)\n {\n var sum = 0;\n\n for (var i = 1; i <= input; i++)\n {\n if (i%2!=0)\n {\n sum -= i;\n }\n else if (i%2==0)\n {\n sum += i;\n }\n \n }\n\n Console.WriteLine(sum);*/\n \n \n \n long n =Convert.ToInt64(Console.ReadLine()); \n\n if(n % 2 == 0) Console.WriteLine(n/2);\n\n else Console.WriteLine((-(n+1)/2));\n\n \n\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "216b6c577d36d9c28ad9e15ae24f83a0", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "Mono C#", "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 Function\n {\n static void Main(string[] args)\n {\n int number = long.Parse(Console.ReadLine());\n int functionResult = 0;\n\n if(number % 2 == 0)\n {\n functionResult = number / 2;\n }\n else\n {\n functionResult = ((number + 1) / 2) * -1;\n }\n\n Console.WriteLine(functionResult);\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d52b436ab7bbc651dde9d1ed075060a4", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int ans = -2;\n int a = Convert.ToInt32(Console.ReadLine());\n for (int i = 4; i < a; i++) {\n ans += i;\n }\n ans +=Convert.toInt32(Math.Pow(Convert.ToDouble(-1), Convert.ToDouble(a)) * a);\n Console.WriteLine(ans);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "43b204b935628dc6801439f7bad76d79", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "MS C#", "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 double c;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "01f2ad453050fb4fa77e521884d352ea", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "//Interface\nnamespace Calculating_Function\n{\n interface ICalculating_Function\n {\n double CalculateSeries();\n }\n}\n\n//Main Functional Class\n\nusing System;\n\nnamespace Calculating_Function\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//Driver Class\n\nusing 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\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "42b4d7d8ed4b939bb71d63518e1a662f", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Library;\n\nnamespace CheckCable\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n //Questions.Question1_CharacterOccurences();\n //Questions.Question2_LinearGenerator();\n //Questions.Question3_CheckingCable();\n //Questions.Question4_ContactNetWork();\n CalculateFunction();\n#if NAM\n int[] Integers = new int[] { 123, 32, 31, 56, 231, 23, 10 };\n string s = \"adfjlcjlhjfljalnldkfnolao\";\n int[] SortedArray = Sort.BubleSort(Integers);\n string ret = Sort.BubleSort(s);\n Library.Graph graph = new Library.Graph();\n graph.AddNode(new Library.GraphNode(1));\n graph.AddNode(new Library.GraphNode(2));\n graph.AddNode(new Library.GraphNode(3));\n graph.AddNode(new Library.GraphNode(4));\n\n graph.AddEdge(1, 2, 2000);\n graph.AddEdge(1, 4, 3000);\n graph.AddEdge(2, 3, 4300);\n graph.AddEdge(4, 3, 2100);\n\n List path = new List { 1, 4, 3, 2};\n Console.WriteLine(graph.CalculatePathWeight(path));\n#endif\n //Console.ReadKey();\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}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7711139e0c0db1a1106e115c0ecc2441", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\n//Interface\nnamespace Calculating_Function\n{\n interface ICalculating\n {\n public int calculate(int num);\n }\n}\n\n\n\n// Working Class\nnamespace Calculating_Function\n{\n class Calculate : ICalculating\n {\n public int num { get; set; }\n \n \n public int calculate(int num)\n {\n int count = 0;\n\n for (int i=1; i<=num; i++)\n {\n if (i%2 != 0)\n {\n count -= i;\n }\n else\n {\n count += i;\n }\n }\n\n return count;\n }\n }\n}\n\n\n\n\n\n//Driver Class\n\nnamespace Calculating_Function\n{\n class Program\n {\n static void Main(string[] args)\n {\n Calculate cal = new Calculate();\n\n cal.num = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(cal.calculate(cal.num));\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "498414ad933fd6800ae4a8e6fc8d53a1", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace CalculatingFunction\n{\n class Program\n {\n static void Main(string[] args)\n {\n BigInteger n = BigInteger.Parse(Console.ReadLine());\n BigInteger sum = 0;\n for(BigInteger i=1;i<=n;i++)\n {\n if (i % 2 == 0)\n sum += i;\n else\n sum -= i;\n }\n ConsoleWriteLine(sum);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "43c8b623b310ab62973e3172fbb7a35b", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = Console.ReadLine();\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "33add40cd5cc776ca467803abedcbe2b", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Library;\n\nnamespace CheckCable\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n //Questions.Question1_CharacterOccurences();\n //Questions.Question2_LinearGenerator();\n //Questions.Question3_CheckingCable();\n //Questions.Question4_ContactNetWork();\n CalculateFunction();\n#if NAM\n int[] Integers = new int[] { 123, 32, 31, 56, 231, 23, 10 };\n string s = \"adfjlcjlhjfljalnldkfnolao\";\n int[] SortedArray = Sort.BubleSort(Integers);\n string ret = Sort.BubleSort(s);\n Library.Graph graph = new Library.Graph();\n graph.AddNode(new Library.GraphNode(1));\n graph.AddNode(new Library.GraphNode(2));\n graph.AddNode(new Library.GraphNode(3));\n graph.AddNode(new Library.GraphNode(4));\n\n graph.AddEdge(1, 2, 2000);\n graph.AddEdge(1, 4, 3000);\n graph.AddEdge(2, 3, 4300);\n graph.AddEdge(4, 3, 2100);\n\n List path = new List { 1, 4, 3, 2};\n Console.WriteLine(graph.CalculatePathWeight(path));\n#endif\n //Console.ReadKey();\n }\n\n static void CalculateFunction()\n {\n long n = Convert.ToInt32(Console.ReadLine());\n long Fx = 0;\n for (int i = 1; i <= n; i++)\n {\n if (i % 2 == 0)\n Fx += i;\n else\n Fx -= i;\n }\n Console.WriteLine(Fx);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "56d7aac22903b043cd69bb421748a74f", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\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}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b996b75d8d5ceeaf60c6b4a71822c7f2", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\n\n//Driver Class\n\nnamespace Calculating_Function\n{\n\n interface ICalculating\n {\n public int calculate(int num);\n }\n\n class Calculate : ICalculating\n {\n public int num { get; set; }\n\n\n public int calculate(int num)\n {\n int count = 0;\n\n for (int i = 1; i <= num; i++)\n {\n if (i % 2 != 0)\n {\n count -= i;\n }\n else\n {\n count += i;\n }\n }\n\n return count;\n }\n }\n\n\n class Program\n {\n static void Main(string[] args)\n {\n Calculate cal = new Calculate();\n\n cal.num = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(cal.calculate(cal.num));\n \n }\n }\n\n \n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c381432b8c55947828876a60c841d444", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " static void Main(string[] args)\n {\n int sum = 0;\n int[] segmant = { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6, 8, 4, 7, 7, 6, 7 };\n Console.WriteLine(\"Enter from number: \");\n int a = int.Parse(Console.ReadLine());\n\n Console.WriteLine(\"Enter to number: \");\n int b = int.Parse(Console.ReadLine());\n\n for (int i = a; i < segmant.Length; i++)\n {\n sum = sum + segmant[i];\n if (i == b)\n {\n break;\n }\n }\n\n Console.WriteLine(\"The total is: \" + sum);\n Console.ReadKey();\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7891ca25062b24996ef4dd1e96b96bba", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace SoloLearn\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 c= int.parse(arr[2]);\n int x=a+c;\n int y=x+c;\n if(y==b)\n {Console.writeline(\"Yes\");}\n else\n Console.writeline(\"No\");\n\n \n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "566732f1a1fc8f00088930f8872561c8", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0} {"lang": "Mono C#", "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 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 x = b - a;\n if (c!=0)\n {\n int y = x / c;\n }\n \n\n if (a==b)\n {\n Console.WriteLine(\"YES\");\n\n }\n else if (y + a == b)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n \n \n \n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d04477baf1531198ae126dd3ea14432d", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0} {"lang": "MS C#", "source_code": " \nusing System;\nstatic void Main()\n {\n long a, b, c;\n string s = \"\";\n s = Console.ReadLine();\n string[] nums = s.Split(' ');\n a = long.Parse(nums[0]);\n b = long.Parse(nums[1]);\n c = long.Parse(nums[2]);\n\n if (b == a)\n Console.Write(\"YES\");\n else if (c == 0)\n Console.Write(\"NO\");\n else if ((b - a) % c == 0 && (b - a) / c > 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b1b1c8df39583d3a23e484ace188ec6a", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0} {"lang": "MS C#", "source_code": " static void Main()\n {\n long a, b, c;\n string s = \"\";\n s = Console.ReadLine();\n string[] nums = s.Split(' ');\n a = long.Parse(nums[0]);\n b = long.Parse(nums[1]);\n c = long.Parse(nums[2]);\n\n if (b == a)\n Console.Write(\"YES\");\n else if (c == 0)\n Console.Write(\"NO\");\n else if ((b - a) % c == 0 && (b - a) / c > 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "12fdc2ba975c527efe93919ba116a76d", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\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 target = num[1];\n int dif = num[2];\n\n if (a == target) Console.WriteLine(\"YES\");\n else if (dif == 0) Console.WriteLine(\"NO\");\n else if (target < a && dif > 0) Console.WriteLine(\"NO\");\n else if ((target - a) % dif == 0) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n\n\n\n //Console.WriteLine();\n\n\n\n\n\n \u30fb//Console.Read();\n\n\n }\n\n \n\n\n }\n\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65c77edeb09df960003456f327cd7ff2", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.29306.81\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"544\", \"544\\544.csproj\", \"{2F9ABDE5-9A3B-4925-8D14-CA59D63ED40D}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{2F9ABDE5-9A3B-4925-8D14-CA59D63ED40D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{2F9ABDE5-9A3B-4925-8D14-CA59D63ED40D}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{2F9ABDE5-9A3B-4925-8D14-CA59D63ED40D}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{2F9ABDE5-9A3B-4925-8D14-CA59D63ED40D}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {8C7E1E2B-7B50-4508-A04B-14FBDD88E4AF}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "465acc48142810c50c3112ca58b5fb48", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0} {"lang": "Mono C#", "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 else if (sum_m < 10) Console.Write('0');\n Console.Write(sum_m);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "310f11ffca43e7451317a6be1357a8ca", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {2F9ABDE5-9A3B-4925-8D14-CA59D63ED40D}\n Exe\n _544\n 544\n v4.7.2\n 512\n true\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "04a035dad216afa9854443ef0dce94b6", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0} {"lang": "Mono C#", "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(end.Subtract(start) / 2);\n Console.Write(middle.Hour + \":\" + middle.Minute);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "962adaa2edd2c4da64247867013114dc", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "namespace ConsoleApplication60\n{\n class Program\n {\n\n static int max(int[]a)\n {\n int mx = 0;\n int id = 0;\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] >= mx)\n {\n mx = a[i];\n id = i;\n }\n }\n return id;\n }\n\n\n static void Main(string[] args)\n {\n //Console.WriteLine(\"Enter the num of candidates \");\n int n = int.Parse(Console.ReadLine());\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) \n {\n arr[i] = int.Parse(Console.ReadLine());\n }\n int c = 0;\n while (max(arr) != 0)\n {\n c++;\n arr[max(arr)]--;\n arr[0]++;\n }\n Console.WriteLine(c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c3d8845b931467e72814b123b1c88c68", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "class Program {\n static void Main (string[] args) {\n int[] voteArray = new int[102];\n int[] copiedArray = new int[102];\n\n int n = int.Parse(Console.ReadLine());\n string[] voteStringArray = Console.ReadLine().Split(new char[] { ' ' });\n\n for (int i = 1; i <= n; i++) {\n voteArray[i] = int.Parse(voteStringArray[i - 1]);\n }\n Array.Copy(voteArray, 2, copiedArray, 2, n - 1);\n Array.Sort(copiedArray, new Comparison((first, second) => second.CompareTo(first)));\n\n int LimaVotes = voteArray[1];\n int CurrMax = copiedArray[0];\n int BribedVotes = 0;\n\n while (LimaVotes + BribedVotes <= copiedArray[0]) {\n BribedVotes += 1;\n copiedArray[0] -= 1;\n Array.Sort(copiedArray, new Comparison((first, second) => second.CompareTo(first)));\n }\n Console.WriteLine(BribedVotes);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5c5f727c5cf20e3cb6ba34a3fcee129c", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace teach12\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e, \u0430 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0447\u0438\u0441\u043b\u043e\u043c \u0424\u0438\u0431\u043e\u043d\u0430\u0447\u0447\u0438\");\n string sThat = Console.ReadLine();\n decimal dThat = Convert.ToDecimal(sThat);\n\n double dThat2 = Math.Pow(10, 9);\n decimal Max = Convert.ToDecimal(dThat2);\n decimal[] Massive = new decimal[100000];\n Massive[0] = 0;\n Massive[1] = 1;\n for (int f = 2; f < Max; f++)\n {\n Massive[f] = Massive[f - 1] + Massive[f - 2];\n if (Massive[f] == dThat)\n {\n Console.WriteLine(\" 0 {0} {1}\", Massive[f - 2], Massive[f - 1]);\n break;\n \n }\n\n }\n Console.ReadLine();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e590ee090fac2d40e738fe67594697e3", "src_uid": "db46a6b0380df047aa34ea6a8f0f93c1", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\nstatic void Main(string[] args)\n{ \n int n=int.Parse(Console.ReadLine());\n if(n==0){\n Console.WriteLine(\"0 0 0\");return;}\n if(n==1){\n Console.WriteLine(\"1 0 0\");return}\n int[] f=new int[1000000];\n f[0]=0;\n f[1]=1;\n for(int i=2;;i++)\n {\n f[i]=f[i-2]+f[i-1];\n if(f[i]==n){\n Console.WriteLine(f[i-2]+ \" \" + f[i-1]+ \" 0\");return;\n }\n }\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "74ace6662f4ff3aa1d73cb1a988cd884", "src_uid": "db46a6b0380df047aa34ea6a8f0f93c1", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace teach12\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e, \u0430 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0447\u0438\u0441\u043b\u043e\u043c \u0424\u0438\u0431\u043e\u043d\u0430\u0447\u0447\u0438\");\n\n decimal dThat = (decimal)Console.ReadLine();\n\n double dThat2 = Math.Pow(10, 9);\n decimal Max = Convert.ToDecimal(dThat2);\n decimal[] Massive = new decimal[100000];\n Massive[0] = 0;\n Massive[1] = 1;\n for (int f = 2; f < Max; f++)\n {\n Massive[f] = Massive[f - 1] + Massive[f - 2];\n if (Massive[f] == dThat)\n {\n Console.WriteLine(\" 0 {0} {1}\", Massive[f - 2], Massive[f - 1]);\n break;\n \n }\n\n }\n Console.ReadLine();\n \n\n \n\n \n \n\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cf91f41dcde8e470ddc3113eb57d6eae", "src_uid": "db46a6b0380df047aa34ea6a8f0f93c1", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\n\nclass P {\n static void Main() { \n var n = long.Parse(Console.ReadLine());\n if (n <= 3) {\n Console.Write(string.Join(\" \", Enumerable.Repeat(0, 3-n).Concat(Enumerable.Repeat(1, n))));\n } else {\n var a = 1; var b = 1;\n while (a + b != n) {\n var tmp = a; a = a+b; b = tmp;\n }\n Console.Write(\"{0} {1} {2}\", a, a-b, b-a+b);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5519fa257bdaf18a5a936de47ab83613", "src_uid": "db46a6b0380df047aa34ea6a8f0f93c1", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() { \n var n = long.Parse(Console.ReadLine());\n if (n <= 3) {\n Console.Write(string.Join(\" \", Enumerable.Repeat(0, 3-n).Concat(Enumerable.Repeat(1, n))));\n } else {\n var a = 1; var b = 1;\n while (a + b != n) {\n var tmp = a; a = a+b; b = tmp;\n }\n Console.Write(\"{0} {1} {2}\", a, a-b, b-a+b);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c761b942af91e7e3da9d304ae6a3ee92", "src_uid": "db46a6b0380df047aa34ea6a8f0f93c1", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n List list = new List();\n list.AddRange(new int[] { 0, 1, 1});\n if(input<2)\n Console.WriteLine(\"0 0 {0}\", input); \n else\n {\n int curr = 0;\n while(curr x * y)) break;\n counts[ind]++;\n ind = (ind + 1) % counts.Length; \n }\n Console.WriteLine(string.Join(\"\", counts.SelectMany((count, ind) => Enumerable.Repeat(cf[ind], (int)count))));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e164d9a4c1516a416e615c422f120746", "src_uid": "8001a7570766cadcc538217e941b3031", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using Microsoft.VisualBasic.CompilerServices;\nusing System;\nusing System.Linq;\n\nnamespace TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n var p = long.Parse(Console.ReadLine());\n\n long ans = 1;\n var mas = new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };\n var i = 0;\n while (ans < p)\n {\n mas[i]++;\n\n ans = Calc(mas);\n \n i++;\n i %= 10;\n\n }\n\n var s = \"codeforces\";\n for (int j = 0; j < 10; j++)\n {\n for (int k = 0; k < mas[j]; k++)\n {\n Console.Write(s[j]);\n }\n }\n }\n\n private static long Calc(int[] mas)\n {\n return mas.Aggregate(1, (current, t) => current * t);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8d4f28d38528b7db208ee85cbe9f8135", "src_uid": "8001a7570766cadcc538217e941b3031", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program{\n static void Main(){\n string str = Console.ReadLine();\n foreach(char i in str){\n if(i == 'H' || i == 'Q' || i = '9' || '+') Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9b000488f8f1a268e327f414d02bb91e", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1fc09d7e0b32c52b813db7b79f9dd2fe", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {BBEEF3C8-5164-42A6-A65A-D19AFC694892}\n Exe\n Properties\n HelloWorld\n HelloWorld\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eaf489e4f86687ca005e6bd4e6fabbdc", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1b47443a053ad349ef640e8b9c06d5bb", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "MS C#", "source_code": "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);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3becb00ddca834efd41f2565d0b6e1fb", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "Mono C#", "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\")\n\t\t\tConsole.WriteLine(\"YES\");\n\t\telse\n\t\t\tConsole.WriteLine(\"NO\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c07ad123d16bd605adac98b08fb39ced", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "Mono C#", "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 line.Contains('+'))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"No\");\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5df0ed3e5b37bdc5b05d4d4a020b1213", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HQ+9\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 return \"Ron\";\n else\n return \"Hermione\";\n } else {\n if (b == 0 && f == 0 && d == 0)\n return \"Hermione\";\n\n if (b == 0 || f == 0 && (a == 0 || c == 0 || e == 0)) return \"Hermione\";\n if (d == 0 && (a == 0 && c == 0 && e == 0)) return \"Ron\";\n\n else return \"Ron\";\n\n }\n\n\n\n }\n\n }\n}using System;\n\nnamespace olimpP\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n\n Console.WriteLine (Func4(Console.ReadLine()));\n }\n public static string Func4(string s)\n {\n\n string[] arr = s.Split (' ');\n double a = Convert.ToInt32 (arr [0]);\n double b = Convert.ToInt32 (arr [1]);\n double c = Convert.ToInt32 (arr [2]);\n double d = Convert.ToInt32 (arr [3]);\n double e = Convert.ToInt32 (arr [4]);\n double f = Convert.ToInt32 (arr [5]);\n if (a != 0 && c != 0 && e != 0) {\n if ((b * d * f) / (a * c * e) > 1)\n return \"Ron\";\n else\n return \"Hermione\";\n } else {\n if (b == 0 && f == 0 && d == 0)\n return \"Hermione\";\n\n if (b == 0 || f == 0 && (a == 0 && c == 0 && e == 0)) return \"Hermione\";\n if (d == 0 && (a == 0 && c == 0 && e == 0)) return \"Ron\";\n\n else return \"Ron\";\n\n }\n\n\n\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8e00e34d1aab65e774e5e98f96b98e10", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "Mono C#", "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\tstring s = Console.ReadLine ();\n\n\t\t\tConsole.WriteLine(Func4 (s));\n\n\t\t}\n\t\tpublic static string Func4(string s)\n\t\t{\n\n\t\t\tstring[] arr = s.Split (' ');\n\t\t\tdouble a = Convert.ToInt32 (arr [0]);\n\t\t\tdouble b = Convert.ToInt32 (arr [1]);\n\t\t\tdouble c = Convert.ToInt32 (arr [2]);\n\t\t\tdouble d = Convert.ToInt32 (arr [3]);\n\t\t\tdouble e = Convert.ToInt32 (arr [4]);\n\t\t\tdouble f = Convert.ToInt32 (arr [5]);\n\t\t\tif (a != 0 && c != 0 && e != 0 && b!=0 && d!=0 && f!=0) {\n\t\t\t\tif ((b * d * f) / (a * c * e) > 1)\n\t\t\t\t\treturn \"Ron\";\n\t\t\t\telse\n\t\t\t\t\treturn \"Hermione\";\n\t\t\t} \n\t\t\tif (a == 0 && b == 0 && c == 0 && d == 0 & e == 0 && f == 0)\n\t\t\t\treturn \"Hermione\";\n\t\t\tif ((a != 0 && b != 0 && c == 0 && d != 0 & e != 0 && f != 0) || (a == 0 && b == 0 && c != 0 && d == 0 & e == 0 && f == 0))\n\t\t\t\treturn \"Ron\";\n\t\t\tif ((a != 0 && b != 0 && c != 0 && d != 0 & e == 0 && f != 0) || (a == 0 && b == 0 && c == 0 && d == 0 & e != 0 && f == 0))\n\t\t\t\treturn \"Ron\";\n\t\t\tif (a != 0 && b == 0 && c != 0 && d != 0 & e != 0 && f != 0) || (a == 0 && b != 0 && c == 0 && d == 0 & e == 0 && f == 0))\n\t\t\t\treturn \"Hermione\";\n\t\t\tif (a == 0 && b != 0 && c == 0 && d == 0 & e == 0 && f == 0) || (a == 0 && b == 0 && c != 0 && d == 0 & e == 0 && f == 0))\n\t\t\t\treturn \"Hermione\";\n\t\t\telse\n\t\t\t\treturn \"Hermione\";\n\n\n\n\n\t\t}\n\n\t}\n}\n\t\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "502f471ce62f9b8e24ed20e708912af3", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "Mono C#", "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 a, b, c, d, e, f;\n string s = Console.ReadLine();\n string[] mas = s.Split(' ');\n a = Convert.ToInt32(mas[0]);\n b = Convert.ToInt32(mas[1]);\n c = Convert.ToInt32(mas[2]);\n d = Convert.ToInt32(mas[3]);\n e = Convert.ToInt32(mas[4]);\n f = Convert.ToInt32(mas[5]);\n if (b*d*f > a*c*e)\n {\n s = \"Ron\";\n }\n else\n {\n s = \"Hermione\";\n }\n if ((b*d*f == 0) && (a*c*e == 0))\n {\n if (((b != 0) && (d != 0) && (e != 0)) || (((b == 0) && (a == 0)) && (d != 0)) || ((c == 0) && (d!=0))\n {\n s = \"Ron\";\n }\n }\n Console.WriteLine(s);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "286c7066597a3dbd3ca3e63cb39d1c43", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "Mono C#", "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\tstring s = Console.ReadLine ();\n\n\t\t\tConsole.WriteLine(Func4 (s));\n\n\t\t}\n\t\tpublic static string Func4(string s)\n\t\t{\n\n\t\t\tstring[] arr = s.Split (' ');\n\t\t\tdouble a = Convert.ToInt32 (arr [0]);\n\t\t\tdouble b = Convert.ToInt32 (arr [1]);\n\t\t\tdouble c = Convert.ToInt32 (arr [2]);\n\t\t\tdouble d = Convert.ToInt32 (arr [3]);\n\t\t\tdouble e = Convert.ToInt32 (arr [4]);\n\t\t\tdouble f = Convert.ToInt32 (arr [5]);\n\t\t\tif (a != 0 && c != 0 && e != 0 && b!=0 && d!=0 && f!=0) {\n\t\t\t\tif ((b * d * f) / (a * c * e) > 1)\n\t\t\t\t\treturn \"Ron\";\n\t\t\t\telse\n\t\t\t\t\treturn \"Hermione\";\n\t\t\t} \n\t\t\tif (a == 0 && b == 0 && c == 0 && d == 0 & e == 0 && f == 0)\n\t\t\t\treturn \"Hermione\";\n\t\t\tif (c==0 && d!=0)\n\t\t\t\treturn \"Ron\";\n\t\t\tif (b==0 && a!=0)\n\t\t\t\treturn \"Hermione\";\n\t\t\tif (e==0 && f!=0)\n\t\t\t\treturn \"Ron\";\n\n\n\n\n\n\t\t}\n\n\t}\n}\n\t\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8287d3f8e7b8880fdb19b659b450b23c", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing Algorithms;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int top = 0, bottom = 0;\n var n = Convert.ToInt32(Console.ReadLine());\n\n for (int i = 0; i < n; i++)\n {\n var ar = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n\n if ((ar[0]%2 != 0) && (ar[1]%2 == 0))\n {\n top++;\n }\n\n if ((ar[0] % 2 == 0) && (ar[1] % 2 != 0))\n {\n bottom++;\n }\n }\n\n if ((top%2 == 0) && (bottom%2 == 0))\n {\n Console.WriteLine(0);\n return; \n }\n\n if ((top % 2 != 0) && (bottom % 2 == 0))\n {\n Console.WriteLine(-1);\n return;\n }\n\n if ((top % 2 == 0) && (bottom % 2 != 0))\n {\n Console.WriteLine(-1);\n return;\n }\n\n if ((top % 2 != 0) && (bottom % 2 != 0))\n {\n Console.WriteLine(1);\n return;\n }\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4858982a6480bc9f730ef7a4a5f59d29", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "difficulty": 1200.0} {"lang": "Mono C#", "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 ///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 a = int.Parse(input[1]);\n //var b = int.Parse(input[2]);\n //var c = int.Parse(input[3]);\n\n List x = new List();\n List y = new List();\n for (int i = 0; i < n; i++)\n {\n var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n x.Add(arr[0]);\n y.Add(arr[1]);\n }\n int sumx = x.Sum();\n int sumy = y.Sum();\n\n if (sumx % 2 == 0 && sumy % 2 == 0)\n {\n Console.Write(\"0\");\n return;\n }\n\n if (x.Count == 1 && y.Count == 1)\n {\n Console.Write(\"-1\");\n return;\n }\n\n if (sumx % 2 == 0 && sumy % 2 == 0)\n Console.Write(\"0\");\n else if (sumx % 2 == 0 && sumy % 2 != 0)\n Console.Write(\"-1\");\n else if (sumy % 2 == 0 && sumx % 2 != 0)\n Console.Write(\"-1\");\n\n if (sumx % 2 != 0 && sumy % 2 != 0)\n {\n for (int i = 0; i < n; i++)\n {\n if (Math.Abs(x[i] + y[i]) % 2 != 0)\n {\n\n Console.Write(\"1\");\n return;\n\n }\n else\n {\n Console.Write(\"-1\");\n return;\n }\n }\n }\n\n\n\n }\n}\n}\n\n \n\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "115e2afe3365f67a715fc3c3f8ac9800", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {4543AB4F-9115-400D-BFE6-36C0D5BEBDEC}\n Exe\n Properties\n codeforses\n codeforses\n v4.0\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e54a2e9d53f13ca83b195e250c136382", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforses\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int level,cnt,h;\n do\n {\n level++;\n cnt += (h*(h+1))/2;\n\n } while (cnt <= n);\n Console.WriteLine(k - 1);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fcbb1d93a97fb094c53f3526f9423648", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nnamespace Coding\n{\n class VanyaAndCubes\n {\n public void problemSolve()\n {\n Console.WriteLine(\"Enter The Number Of The Cube \");\n int x = Convert.ToInt32(Console.ReadLine());\n int sum = 0;\n int c = 0;\n while(x >0){\n c++;\n for(int i = 1; i<=c; i++){\n sum += i;\n }\n x -= sum;\n }\n Console.WriteLine(c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "43ba93ee74aefd7db5a96c1a48f33b03", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\npublic class VanyaAndCubes\n{\n\tprivate static void Main()\n\t{\n\t\tvar n = ReadInt();\n\t\tint result = 0, k = 1, i = 1, j = 1;\n\t\twhile(i <=25 n)\n\t\t{\n\t\t\tresult++;\n\t\t\tk++;\n\t\t\tj += k;\n\t\t\ti += j;\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a5b7388ae191c96118dbac50de66c912", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "MS C#", "source_code": "namespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var cubes = int.Parse(Console.ReadLine());\n\n var floor = 0;\n var floorSum = 0;\n\n while (cubes >= 0)\n {\n floor ++;\n floorSum += floor;\n cubes -= floorSum;\n }\n\n if (cubes < 0)\n floor --;\n\n Console.WriteLine(floor);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "96cf2921899483726300ad465a01ddf1", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforses\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int level,cnt;\n do\n {\n level++;\n cnt += (h*(h+1))/2;\n\n } while (cnt <= n);\n Console.WriteLine(k - 1);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "82180a8848e67ebeb7938a6616130bda", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n class Program\n {\n static void Main(string[] args)\n {\n int m = 0, n = 0 , x=0, v = 0;\n n = int.Parse(Console.ReadLine());\n x = n;\n for (int i = 1; m <= n; i++)\n {\n // cout< 0)\n {\n c++;\n for (int i = 1; i <= c; i++)\n {\n sum += i;\n }\n x -= sum;\n }\n Console.WriteLine(c);\n\n\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d350a0bc72859172304fc772aed2eaf3", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforses\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int level,cnt;\n do\n {\n level++;\n cnt += (level*(level+1))/2;\n\n } while (cnt <= n);\n Console.WriteLine(level - 1);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cfd691f726711dbe6a8e88d44646a8fc", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30011.22\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"492-A Vanya and Cubes\", \"492-A Vanya and Cubes\\492-A Vanya and Cubes.csproj\", \"{0569CF27-16FD-45E1-93D8-9175809B2F23}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{0569CF27-16FD-45E1-93D8-9175809B2F23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0569CF27-16FD-45E1-93D8-9175809B2F23}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0569CF27-16FD-45E1-93D8-9175809B2F23}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0569CF27-16FD-45E1-93D8-9175809B2F23}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {41A6B557-875D-4F73-BC5F-D01E5F71BED2}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b5d4ee6561cfb5a345e4c73989550ae", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System.Text;\nusing System.Threading.Tasks;\nusing System.Diagnostics;\nusing System.Numerics;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System;\nusing System.Drawing;\n\nnamespace bla2\n{\n class Program\n {\n static void Main()\n {\n char[][] a = new char[4][];\n for (int i = 0; i < 4; i++)\n {\n string s = Console.ReadLine();\n a[i] = s.ToCharArray();\n }\n\n for (int r = 0; r < 4; r++)\n {\n for (int c = 0; c < 4; c++)\n {\n if (a[r][c] != '.') continue;\n char[][] n = copy(a);\n n[r][c] = 'x';\n if(row(n, r, c))\n {\n Console.WriteLine(\"YES\"); return;\n }\n }\n }\n Console.WriteLine(\"NO\");\n }\n\n static bool row(char[][] a, int r, int c)\n {\n if (isx(a, r + 1, c) && isx(a, r + 2, c)) return true;\n if (isx(a, r - 1, c) && isx(a, r - 2, c)) return true;\n if (isx(a, r + 1, c) && isx(a, r - 1, c)) return true;\n\n if (isx(a, r, c + 1) && isx(a, r, c + 2)) return true;\n if (isx(a, r, c - 1) && isx(a, r, c - 2)) return true;\n if (isx(a, r, c + 1) && isx(a, r, c - 1)) return true;\n\n if (isx(a, r + 1, c + 1) && isx(a, r + 2, c + 2)) return true;\n if (isx(a, r - 1, c - 1) && isx(a, r - 2, c - 2)) return true;\n if (isx(a, r + 1, c + 1) && isx(a, r - 1, c - 1)) return true;\n\n if (isx(a, r + 1, c - 1) && isx(a, r + 2, c - 2)) return true;\n if (isx(a, r - 1, c + 1) && isx(a, r - 2, c + 2)) return true;\n if (isx(a, r + 1, c - 1) && isx(a, r - 1, c + 1)) return true;\n return false;\n }\n\n static bool isx(char[][] a, int r, int c)\n {\n if (r < 0 || c < 0 || r >= 4 || c >= 4) return false;\n return a[r][c] == 'x';\n }\n\n static char[][] copy(char[][] a)\n {\n var r = new char[4][];\n for (int i = 0; i < 4; i++)\n {\n r[i] = new char[4];\n a[i].CopyTo(r[i], 0);\n }\n return r;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "686d20bdf4cb21e2051f140ca134c5aa", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "difficulty": 1100.0} {"lang": "MS C#", "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;\n//using Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var a = Enumerate(4, x => sc.Char(4));\n var dx = new int[] { 1, 0, 1, 1, };\n var dy = new int[] { 0, 1, 1, -1 };\n Func otaku = (i, j) =>\n {\n if (i < 0 || i >= 4 || j < 0 || j >= 4) return 0;\n return a[i][j] == 'x' ? 1 : 0;\n }\n Func check = () =>\n {\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 4; j++)\n {\n if (a[i][j] == 'x')\n {\n var x = 1;\n for (int k = 0; k < 4; k++)\n {\n var nx = i + dx[k];\n var ny = j + dy[k];\n x += otaku(nx, ny);\n nx += dx[k];\n ny += dy[k];\n x += otaku(nx, ny);\n\n }\n if (x == 3) return true;\n }\n }\n return false;\n };\n var ok = false;\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 4; j++)\n {\n if (a[i][j] == '.')\n {\n a[i][j] = 'x';\n ok |= check();\n a[i][j] = '.';\n }\n }\n if (ok) IO.Printer.Out.WriteLine(\"YES\");\n else IO.Printer.Out.WriteLine(\"NO\");\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6ead7ee2dda86e9ed600f6b07d03203d", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Drawing;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Drawing.Imaging;\n\nnamespace LockFreeQuequeTest {\n\n\n\tstatic class Program {\n\n\t\tprivate static Dictionary symbols = new Dictionary() { { '?', 0 }, { 'C', 1 }, { 'M', 2 }, { 'Y', 4 } };\n\n\t\tprivate static void Main(string[] args) {\n\n\t\t\tConsole.ReadLine();\n\t\t\tstring enter = Console.ReadLine();\n\t\t\tbool yes = false;\n\t\t\tbyte current = symbols[enter[0]];\n\t\t\tfor (int i = 1; i1|| (flag1 && flag2)||(indexO-indexX==1))\n Console.WriteLine(\"illegal\");\n else if (flag1)\n Console.WriteLine(\"the first player won\");\n else if (flag2)\n Console.WriteLine(\"the second player won\");\n else if (indexO-indexX==0)\n Console.WriteLine(\"first\");\n else Console.WriteLine(\"second\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9695f919f26357ec6d0314fb37fcd87d", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nclass CFBR3C\n{\n\tstatic void Main()\n\t{\n\t\tbyte xCount;\n\t\tbyte emptyCount;\n\t\tsbyte[,] gameState = GetGameState(out xCount, out emptyCount);\n\t\tConsole.WriteLine(GetVerdict(gameState, xCount, emptyCount));\n\t}\n\t\n\tstatic string GetVerdict(sbyte[,] gs, byte xCount, byte eCount)\n\t{\n\t\tif ((xCount == 0) && (zCount == 0)) return \"first\";\n\t\t\n\t\tbyte zCount = (byte)(9 - (xCount + eCount));\n\t\tif (Math.Abs(xCount - zCount) > 1) return \"illegal\";\n\t\telse if (xCount < zCount) return \"illegal\";\n\t\telse if (((gs[0, 0] == 1) && (gs[1, 1] == 1) && (gs[2, 2] == 1)) || ((gs[0, 2] == 1) && (gs[1, 1] == 1) && (gs[2, 0] == 1))) return \"the first player won\";\n\t\telse if (((gs[0, 0] == 0) && (gs[1, 1] == 0) && (gs[2, 2] == 0)) || ((gs[0, 2] == 0) && (gs[1, 1] == 0) && (gs[2, 0] == 0))) return \"the second player won\";\n\t\tbool firstPlayerWon = false;\n\t\tbool secondPlayerWon = false;\n\t\tfor (byte i = 0; i < 3; i++)\n\t\t{\n\t\t\tif (((gs[i, 0] == 1) && (gs[i, 1] == 1) && (gs[i, 2] == 1)) || ((gs[0, i] == 1) && (gs[1, i] == 1) && (gs[2, i] == 1))) firstPlayerWon = true;\n\t\t\telse if (((gs[i, 0] == 0) && (gs[i, 1] == 0) && (gs[i, 2] == 0)) || ((gs[0, i] == 0) && (gs[1, i] == 0) && (gs[2, i] == 0))) secondPlayerWon = true;\n\t\t\tif (firstPlayerWon == true && secondPlayerWon == true) return \"illegal\";\n\t\t}\n\t\tif (firstPlayerWon == true) return \"the first player won\";\n\t\telse if (secondPlayerWon == true) return \"the second player won\";\n\t\t\n\t\tif (eCount > 0)\n\t\t{\n\t\t\tif (xCount > zCount) return \"second\";\n\t\t\telse return \"first\";\n\t\t}\n\t\treturn \"draw\";\n\t}\n\t\n\tstatic sbyte[,] GetGameState(out byte xCount, out byte emptyCount)\n\t{\n\t\txCount = 0;\n\t\temptyCount = 0;\n\t\tsbyte[,] gameState = new sbyte[3, 3];\n\t\tfor (byte i = 0; i < 3; i++)\n\t\t{\n\t\t\tstring line = Console.ReadLine();\n\t\t\tfor (byte j = 0; j < 3; j++)\n\t\t\t{\n\t\t\t\tswitch(line[j])\n\t\t\t\t{\n\t\t\t\t\tcase 'X':\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgameState[i, j] = 1;\n\t\t\t\t\t\t\txCount++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tcase '0':\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgameState[i, j] = 0;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tcase '.':\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgameState[i, j] = -1;\n\t\t\t\t\t\t\temptyCount++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn gameState;\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8e9b6c4768e45b9b9fe0bcb6c86633eb", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication8\", \"ConsoleApplication8\\ConsoleApplication8.csproj\", \"{7000FFCE-C1AE-4A46-AC32-A6B829CE043A}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{7000FFCE-C1AE-4A46-AC32-A6B829CE043A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{7000FFCE-C1AE-4A46-AC32-A6B829CE043A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{7000FFCE-C1AE-4A46-AC32-A6B829CE043A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{7000FFCE-C1AE-4A46-AC32-A6B829CE043A}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "47b0ac95dc7190dcf4d6e4c8b3752702", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "#include ;\n#include ;\n\nusing namespace std;\n\nvoid main()\n{\n \n char mas [4][4];\n \n int iO=0,iX=0;\n\n bool Xwin=false, Owin=false;\n \n for (int i=0;i<3;i++)\n {\n cin>>mas[i];//\u0441\u0442\u0440\u043e\u043a\u0430\n for (int j=0;j<3;j++)\n {\n if (mas[i][j]=='X') iX++;\n else if (mas[i][j]=='O') iO++;\n }\n if (strcmp(mas[i],\"XXX\")==0) Xwin=true;\n if (strcmp(mas[i],\"OOO\")==0) Owin=true;\n }\n\n for (int i=0;i<3;i++)\n {\n char buf [4];\n for (int j=0;j<3;j++)\n {\n buf[j]=(char)mas[j,i];\n }\n if (strcmp(buf,\"XXX\")==0) Xwin=true;//\u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438\n if (strcmp(buf,\"OOO\")==0) Owin=true;\n }\n //\u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438\n char buf [4]=\"\";\n buf[0]=mas[0][0];buf[1]=mas[1][1];buf[2]=mas[2][2];\n \n if (strcmp(buf,\"XXX\")==0) Xwin=true;\n if (strcmp(buf,\"OOO\")==0) Owin=true;\n\n buf[0]=mas[2][0];buf[2]=mas[0][2];\n if (strcmp(buf,\"XXX\")==0) Xwin=true;\n if (strcmp(buf,\"OOO\")==0) Owin=true;\n\n if (iO>iX)\n {\n cout<<\"illegal\"<iO) cout<<\"illegal\"< _x; private set => _x = value; }\n public double Y { get => _y; private set => _y = value; }\n\n public Point2D(double x, double y)\n {\n X = x;\n Y = y;\n }\n }\n public class Vector2D : Point2D\n {\n public double Length\n {\n get => Math.Sqrt(X * X + Y * Y);\n }\n public Vector2D(double x, double y) : base(x, y) { }\n }\n public class Direct2D\n {\n private Point2D _point;\n private Vector2D _vector;\n\n public double X { get => _point.X; }\n public double Y { get => _point.Y; }\n public double VX { get => _vector.X; }\n public double VY { get => _vector.Y; }\n\n public double Length { get => _vector.Length; }\n\n public Direct2D GetPerpendicularLine(Point2D p)\n {\n double x = VY;\n double y = VX;\n if (x != 0)\n x *= -1;\n else\n y *= -1;\n\n return new Direct2D(p, new Point2D(p.X + x, p.Y + y));\n\n }\n\n public Direct2D GetPerpendicularLine(double x, double y)\n {\n return GetPerpendicularLine(new Point2D(x, y));\n }\n\n public Point2D GetPoint(double t)\n {\n return new Point2D(X + VX * t, Y + VY * t);\n }\n\n public Point2D Intersection(Direct2D d)\n {\n double t1 = 0;\n if (d.VX == 0)\n {\n if (d.VY == 0)\n {\n return null;\n }\n else\n {\n var n = VY / d.VY;\n var m = (Y - d.Y) / d.Y;\n var l = d.VX * n - VX;\n if (l == 0)\n {\n return null;\n }\n var b = X - d.X - m * d.VX;\n t1 = b / l;\n\n }\n }\n else\n {\n var n = VX / d.VX;\n var m = (X - d.X) / d.VX;\n var l = d.VY * n - VY;\n if (l == 0)\n {\n return null;\n }\n var b = Y - d.Y - m * d.VY;\n t1 = b / l;\n\n }\n\n return GetPoint(t1);\n }\n\n public Direct2D(Point2D p1, Point2D p2)\n {\n _point = p1;\n _vector = new Vector2D(p2.X - p1.X, p2.Y - p1.Y);\n }\n\n public Direct2D(double x1, double y1, double x2, double y2) : this(new Point2D(x1, y1), new Point2D(x2, y2)) { }\n }\n public class Polygon2D\n {\n protected List _points;\n protected List _directs;\n\n public double Square\n {\n get\n {\n Point2D lastPoint = null;\n double sum = 0;\n foreach (var item in _points)\n {\n if (lastPoint != null)\n {\n sum += lastPoint.X * item.Y - item.X * lastPoint.Y;\n }\n lastPoint = item;\n }\n sum += lastPoint.X * _points[0].Y - _points[0].X * lastPoint.Y;\n return Math.Abs(sum/2);\n }\n }\n\n protected void Init()\n {\n Point2D lastPoint = null;\n foreach (var item in _points)\n {\n if (lastPoint != null)\n {\n _directs.Add(new Direct2D(lastPoint, item));\n }\n lastPoint = item;\n }\n\n _directs.Add(new Direct2D(lastPoint, _points[0]));\n\n }\n\n public Polygon2D(List points)\n {\n this._points = points;\n _directs = new List();\n Init();\n }\n public Polygon2D()\n {\n _points = new List();\n _directs = new List();\n }\n\n public Polygon2D(Circle2D circle, int angles)\n {\n var angleStep = 2 * Math.PI / angles;\n double angle = 0;\n _points = new List();\n while (angle < 2 * Math.PI)\n {\n _points.Add(circle.GetPoint2D(angle));\n angle += angleStep;\n }\n \n _directs = new List();\n\n Init();\n }\n\n }\n public class Triangle2D : Polygon2D\n {\n public Point2D A { get => _points[0]; }\n public Point2D B { get => _points[1]; }\n public Point2D C { get => _points[2]; }\n\n public Direct2D AB { get => _directs[0]; }\n public Direct2D BC { get => _directs[1]; }\n public Direct2D CA { get => _directs[2]; }\n\n\n public Polygon2D MinimumPolygon\n {\n get\n {\n Circle2D c = GetDescribedCircle();\n\n double[] edges = new double[3];\n for (int i = 0; i < 3; i++)\n {\n edges[i] = _directs[i].Length;\n\n }\n\n double max = Math.Max(edges[0], edges[1]);\n double[] angles = new double[3];\n angles[0] = c.GetAngleChord(Math.Min(edges[0], edges[1])) * 180 / Math.PI;\n angles[1] = c.GetAngleChord(Math.Min(max, edges[2])) * 180 / Math.PI;\n max = Math.Max(max, edges[2]);\n angles[2] = 360.0 - angles[0] - angles[1];\n int n = (int)(360.0 / gcd(gcd(angles[0], angles[1]), angles[2]) + 0.5);\n return c.GetPolygone(n);\n }\n }\n\n static double gcd(double x, double y)\n {\n while (Math.Abs(x) > Math.E && Math.Abs(y) > Math.E)\n {\n if (x > y)\n x -= (int)(x / y) * y;\n else\n y -= (int)(y / x) * x;\n }\n return x + y;\n }\n\n public Circle2D GetDescribedCircle()\n {\n var ab = AB;\n var bc = BC;\n ab = ab.GetPerpendicularLine(ab.GetPoint(0.5));\n bc = bc.GetPerpendicularLine(bc.GetPoint(0.5));\n Point2D p = ab.Intersection(bc);\n Direct2D d = new Direct2D(p, _points[0]);\n return new Circle2D(p, d.Length);\n }\n\n\n public Triangle2D(Point2D p1, Point2D p2, Point2D p3) : base(new List(new Point2D[3] { p1, p2, p3 })) { }\n\n }\n public class Circle2D\n {\n public Point2D Center { get; private set; }\n public double Radius { get; private set; }\n\n public double GetAngleChord(double lChord)\n {\n return 2 * Math.Asin(lChord / (2 * Radius));\n }\n\n public Point2D GetPoint2D(double angle)\n {\n var x = Center.X + Math.Cos(angle) * Radius;\n var y = Center.Y + Math.Sin(angle) * Radius;\n return new Point2D(x, y);\n }\n\n public Polygon2D GetPolygone(int angles)\n {\n return new Polygon2D(this, angles);\n }\n\n public Circle2D(Point2D c, double d)\n {\n Center = c;\n Radius = d;\n }\n }\n class Program\n {\n\n public static void Main()\n {\n string[] strs;\n Point2D[] ps = new Point2D[3];\n for (int i = 0; i < 3; i++)\n {\n strs = Console.ReadLine().Split(' ');\n\n ps[i] = new Point2D(Double.Parse(strs[0], CultureInfo.InvariantCulture), Double.Parse(strs[1], CultureInfo.InvariantCulture));\n }\n\n Triangle2D tr = new Triangle2D(ps[0], ps[1], ps[2]);\n Polygon2D p = tr.MinimumPolygon;\n string S = (Math.Round(p.Square, 6).ToString().Replace(',', '.'));\n Console.WriteLine(S);\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ea13915dc7669b1b54becf20ba651d36", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Text.RegularExpressions;\nusing System.Text;\nclass MainClass\n{\n public const int n=3;\n public static void Main (string[] args)\n {\n double[] coord = new double[6];\n double[] sides = new double[3];\n for (int i=0; i b)\n {\n k = a;\n a = b;\n b = k;\n }\n if (a > c) a = c;\n if (b > c) c = b;\n \n x1 = a / 2 / r;\n x2 = c / 2 / r;\n if (x1 > 1) x1 = 2 * Math.Asin(1);\n else x1 = 2 * Math.Asin(x1);\n if (x2 > 1) x2 = 2 * Math.Asin(1);\n else x2 = 2 * Math.Asin(x2);\n \n k = 2 * Math.PI / n;\n \n y1 = x1 / k;\n y2 = x2 / k;\n \n while ((Math.Abs(Math.Round(y1) - y1) > 0.01 | (Math.Abs(Math.Round(y2) - y2) > 0.01)) & n < 101)\n {\n n++;\n k = 2 * Math.PI / n;\n y1 = x1 / k;\n y2 = x2 / k;\n }\n \n k = n;\n k = k / 2 * r * r * Math.Sin(2 * Math.PI / k);\n Console.WriteLine(k.ToString(\"F8\", System.Globalization.CultureInfo.InvariantCulture));\n\n\n }\n\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "14a70af55235ddb56b6f4edd604df1bd", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static double _exp = 0.0001f;\n\n static void Main()\n {\n //CultureInfo culture = new CultureInfo(\"ru\");\n var A_point = GetPoint();\n var B_point = GetPoint();\n var C_point = GetPoint();\n var a_len = Len(A_point, B_point);\n var b_len = Len(B_point, C_point);\n var c_len = Len(A_point, C_point);\n var area = S_figure(a_len, b_len, c_len);\n Console.WriteLine(string.Format(\"{0:F6}\", area).Replace(\",\", \".\"));\n }\n\n static double[] GetPoint()\n {\n return Console.ReadLine().Split(' ')\n .Select(x => decimal.Parse(x.Replace(\".\", \",\"))).ToArray();\n }\n\n static double Len(double[] a, double[] b)\n {\n return Math.Sqrt(Math.Pow(a[0] - b[0], 2.0) + Math.Pow(a[1] - b[1], 2.0));\n }\n\n static double P_triangle(double a, double b, double c)\n {\n return a + b + c;\n }\n\n static double S_triangle(double a, double b, double c)\n {\n var p = P_triangle(a, b, c) / 2.0;\n return Math.Sqrt(p * (p - a) * (p - b) * (p - c));\n }\n\n static double R_ellipse(double a, double b, double c)\n {\n return (a * b * c / (4.0 * S_triangle(a, b, c)));\n }\n\n static double Angel_A(double a, double b, double c)\n {\n return Math.Acos((b * b + c * c - a * a) / (2.0 * b * c));\n }\n\n static double Angel_B(double a, double b, double c)\n {\n return Math.Acos((a * a + c * c - b * b) / (2.0 * a * c));\n }\n\n static double Angel_C(double a, double b, double c)\n {\n return Math.Acos((b * b + a * a - c * c) / (2.0 * b * a));\n }\n\n static double gcd(double angle_a, double angle_b, double angle_c)\n {\n return gcd(gcd(angle_a, angle_b), angle_c);\n }\n\n\n static double gcd(double angle_a, double angle_b)\n {\n while (Math.Abs(angle_a) > _exp && Math.Abs(angle_b) > _exp) {\n if (angle_a > angle_b) {\n angle_a -= Math.Floor(angle_a / angle_b) * angle_b;\n } else {\n angle_b -= Math.Floor(angle_b / angle_a) * angle_a;\n }\n }\n return angle_a + angle_b;\n }\n\n static double n(double angle_a, double angle_b, double angle_c)\n {\n return Math.PI / gcd(angle_a, angle_b, angle_c);\n }\n\n static double S_figure(double a, double b, double c)\n {\n var R = R_ellipse(a, b, c);\n var angle_a = Angel_A(a, b, c);\n var angle_b = Angel_B(a, b, c);\n var angle_c = Angel_C(a, b, c);\n var n_ = n(angle_a, angle_b, angle_c);\n return (n_ / 2.0 * R * R * Math.Sin(2.0 * Math.PI / n_));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1b1db9fbf514e67bd82c334028db05f5", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nclass Program\n{\n public class Point\n {\n public double X, Y;\n\n public double Dist(Point p)\n {\n double dx = this.X - p.X;\n double dy = this.Y - p.Y;\n\n return Math.Sqrt(dx * dx + dy * dy);\n }\n }\n\n private static Point ReadPoint()\n {\n var tmp = Console.ReadLine().Split(' ');\n return new Point()\n {\n X = DoubleFromString(tmp[0]),\n Y = DoubleFromString(tmp[1])\n };\n }\n\n private static void FindR()\n {\n double ab = a.Dist(b);\n double ac = a.Dist(c);\n double bc = c.Dist(b);\n q.Add(ab);\n q.Add(ac);\n q.Add(bc);\n\n double p = (ab + ac + bc) / 2;\n\n R = ab * ac * bc / (4 * Math.Sqrt(p * (p - ab) * (p - ac) * (p - bc)));\n }\n\n\n private static double Solve2()\n {\n\n }\n\n private static Point a,b,c;\n private static double R;\n private static List q = new List();\n static void Main(string[] args)\n {/*\n-46.482632 -31.161247\n19.689679 -70.646972\n-17.902656 -58.455808\n*/\n a = new Point() { X = -46.482632, Y = -31.161247 };\n b = new Point() { X = 19.689679, Y = -70.646972 };\n c = new Point() { X = -17.902656, Y = -58.455808 };\n \n \n a = ReadPoint();\n b = ReadPoint();\n c = ReadPoint();\n FindR();\n q.Sort();\n\n for (int i = 3; i <= 100; i++)\n {\n List d = new List();\n for (int j = 1; j <= i / 2; j++)\n {\n double alpha = (Math.PI * 2 * j) / i;\n double dd = 2 * Math.Sin(alpha / 2) * R;\n d.Add(dd);\n }\n\n int p = 0;\n for (int j = 0; j < d.Count; j++)\n {\n double delta = Math.Abs(d[j] - q[p]);\n if (delta < 1e-4)\n {\n p++;\n if (p == 3)\n {\n double alpha = (2* Math.PI) / i;\n double dd = 2 * Math.Sin(alpha / 2) * R;\n double h = Math.Cos(alpha / 2) * R;\n double s = (h * dd / 2) * i;\n Console.WriteLine(DoubleToString(s));\n return;\n }\n j--;\n }\n }\n\n }\n\n Console.WriteLine(\"WA\");\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 < n; 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[] 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[] 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 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(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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b3b3a2d50c738791a0c3c3860c298f4c", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\nnamespace contestsharp\n{\n public struct Dot\n {\n public double x;\n public double y;\n }\n\n class Program\n {\n static public double Det(Dot[] vector)\n {\n return (vector[0].x * vector[1].y - vector[1].x * vector[0].y);\n }\n static public double FindAngle(Dot dot1, Dot dot2, Dot centre)\n {\n Dot[] vector = new Dot[2];\n vector[0].x = dot1.x - centre.x;\n vector[0].y = dot1.y - centre.y;\n vector[1].x = dot2.x - centre.x;\n vector[1].y = dot2.y - centre.y;\n double Cos = Math.Round((vector[0].x * vector[1].x + vector[0].y * vector[1].y) / (Math.Sqrt(vector[0].x * vector[0].x + vector[0].y * vector[0].y) * Math.Sqrt(vector[1].x * vector[1].x + vector[1].y * vector[1].y)),6);\n if (Det(vector) < 0)\n return Math.Acos(Cos);\n else\n return (2 * Math.PI - Math.Acos(Cos));\n }\n\n static double nod(double a, double b)\n {\n if (b % a < 0.0001)\n return a;\n if (Math.Abs(a - b) > 0.0001) return nod(b % a, a);\n else return b;\n }\n\n static void Main(string[] args)\n {\n double mina=0;\n Dot[] a = new Dot[3];\n string[][] input = new string[3][];\n for (int i = 0; i < 3; i++)\n {\n input[i] = new string[2];\n input[i] = Console.ReadLine().Split(' ');\n try\n {\n input[i][0] = input[i][0].Substring(0, input[i][0].IndexOf('.')) + ',' + input[i][0].Substring(input[i][0].IndexOf('.') + 1);\n input[i][1] = input[i][1].Substring(0, input[i][1].IndexOf('.')) + ',' + input[i][1].Substring(input[i][1].IndexOf('.') + 1);\n }\n catch { }\n a[i].x = double.Parse(input[i][0]);\n a[i].y = double.Parse(input[i][1]);\n }\n Dot centre = new Dot();\n centre.x = -(a[0].y * ((a[1].x * a[1].x) + (a[1].y * a[1].y) - (a[2].x * a[2].x) - (a[2].y * a[2].y)) + a[1].y * ((a[2].x * a[2].x) + (a[2].y * a[2].y) - (a[0].x * a[0].x) - (a[0].y * a[0].y)) + a[2].y * ((a[0].x * a[0].x) + (a[0].y * a[0].y) - (a[1].x * a[1].x) - (a[1].y * a[1].y))) / (2 * (a[0].x * (a[1].y - a[2].y) + a[1].x * (a[2].y - a[0].y) + a[2].x * (a[0].y - a[1].y)));\n centre.y = (a[0].x * ((a[1].x * a[1].x) + (a[1].y * a[1].y) - (a[2].x * a[2].x) - (a[2].y * a[2].y)) + a[1].x * ((a[2].x * a[2].x) + (a[2].y * a[2].y) - (a[0].x * a[0].x) - (a[0].y * a[0].y)) + a[2].x * ((a[0].x * a[0].x) + (a[0].y * a[0].y) - (a[1].x * a[1].x) - (a[1].y * a[1].y))) / (2 * (a[0].x * (a[1].y - a[2].y) + a[1].x * (a[2].y - a[0].y) + a[2].x * (a[0].y - a[1].y)));\n double[] An = new double[3];\n An[0] = FindAngle(a[0], a[1], centre);\n An[1] = FindAngle(a[1], a[2], centre);\n An[2] = FindAngle(a[2], a[0], centre);\n if((An[0]+ An[1]+ An[2])>(2*Math.PI+0.00001))\n {\n An[0] = 2*Math.PI - An[0];\n An[1] = 2*Math.PI - An[1];\n An[2] = 2*Math.PI - An[2];\n }\n mina = nod(nod(An[0], An[1]), An[2]);\n double S = (Math.PI / mina) * ((a[0].x - centre.x)* (a[0].x - centre.x) + (a[0].y-centre.y)* (a[0].y - centre.y)) *Math.Sin(mina);\n string answer = S.ToString();\n try\n {\n answer = answer.Substring(0, answer.IndexOf(',')) + '.' + answer.Substring(answer.IndexOf(',') + 1);\n }\n catch { answer+=\".000000\"}\n Console.WriteLine(answer);\n Console.Read();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8d45d5212f99f705723c9939df43c3d5", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\n\n\nnamespace code\n{\n class Program\n {\n static float x1, y1, x2, y2, x3, y3;\n\n static float xc, yc;\n static double r, d;\n\n static double d12, d13, d23;\n\n static double angle;\n\n static int n;\n\n static double S;\n\n\n static void Main(string[] args)\n {\n\n GetXY(out x1, out y1);\n GetXY(out x2, out y2);\n GetXY(out x3, out y3);\nreturn;\n GetCenter();\n\n r = GetDistance(x1, y1, xc, yc);\n\n d12 = GetDistance((double)x1, (double)y1, (double)x2, (double)y2);\n d13 = GetDistance((double)x1, (double)y1, (double)x3, (double)y3);\n d23 = GetDistance((double)x2, (double)y2, (double)x3, (double)y3);\n\n if (d12 < d13)\n {\n if (d12 < d23)\n {\n d = d12;\n }\n else\n {\n x1 = x3;\n y1 = y3;\n d = d23;\n }\n }\n else\n {\n if (d13 < d23)\n {\n x2 = x3;\n y2 = y3;\n d = d13;\n }\n else\n {\n x1 = x3;\n y1 = y3;\n d = d23;\n }\n }\n\n // \u0438\u0449\u0435\u043c \u0443\u0433\u043e\u043b \u043c\u0435\u0436\u0434\u0443 1-\u0441-2\n angle = GetAngle(x1, y1, xc, yc, x2, y2);\n\n // \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u0440\u043e\u043d\n n = (int)(2 * Math.PI / angle);\n\n //\n S = GetSquart(n, r);\n\n Console.WriteLine(\"{0:0.00000000}\", S);\n\n }\n\n // http://hardfire.ru/angle\n // \u0423\u0433\u043e\u043b \u043c\u0435\u0436\u0434\u0443 \u0442\u0440\u0435\u043c\u044f \u0442\u043e\u0447\u043a\u0430\u043c\u0438 - \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432\n // a * b = |a| * |b| * cos (alpha) = xa * xb + ya * yb\n static double GetAngle(double ax, double ay, double bx, double by, double cx, double cy)\n {\n double x1 = ax - bx, x2 = cx - bx;\n double y1 = ay - by, y2 = cy - by;\n double d1 = Math.Sqrt(x1 * x1 + y1 * y1);\n double d2 = Math.Sqrt(x2 * x2 + y2 * y2);\n return Math.Acos((x1 * x2 + y1 * y2) / (d1 * d2));\n }\n \n\n static private void GetXY(out float x, out float y)\n {\n string s = Console.ReadLine();\n Console.WriteLine(s);\n\n var ss = s.Split(' ');\n Console.WriteLine(ss[0]);\n Console.WriteLine(ss[1]);\n\n try\n{\n x = float.Parse(ss[0]);\n y = float.Parse(ss[1]);\n}\ncatch(Exception e)\n{\n Console.WriteLine(e.Message);\n}\n Console.WriteLine(x);\n Console.WriteLine(y);\n\n }\n\n static private void GetCenter()\n {\n // \u0426\u0435\u043d\u0442\u0440 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e 3-\u043c \u0442\u043e\u0447\u043a\u0430\u043c \u043d\u0430 \u0434\u0443\u0433\u0435. \n // http://www.delphimaster.net/view/9-1172844946/all\n float A = x2 - x1;\n float B = y2 - y1;\n float C = x3 - x1;\n float D = y3 - y1;\n float E = A * (x1 + x2) + B * (y1 + y2);\n float F = C * (x1 + x3) + D * (y1 + y3);\n float G = 2 * (A * (y3 - y2) - B * (x3 - x2));\n\n xc = (D * E - B * F) / G;\n yc = (A * F - C * E) / G; \n }\n\n static double GetDistance(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt(Math.Abs(x1 - x2) * Math.Abs(x1 - x2) + Math.Abs(y1 - y2) * Math.Abs(y1 - y2));\n }\n\n static double GetSquart(int n, double r)\n {\n // https://ru.wikipedia.org/wiki/%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%BC%D0%BD%D0%BE%D0%B3%D0%BE%D1%83%D0%B3%D0%BE%D0%BB%D1%8C%D0%BD%D0%B8%D0%BA\n // \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\n // S = \\frac{n}{2}R^2 \\sin \\frac{2 \\pi}{n}.\n return r * r * n / 2 * Math.Sin(2 * Math.PI / n);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "81d26b3bb96c7c29f512742094022496", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var count = Int32.Parse(str);\n for (int i = 0; i < count; i++) {\n var cellStr = Console.ReadLine();\n var cell = new Table(cellStr);\n if (cell.SelfType == CellType.Exel)\n {\n Console.WriteLine(cell.SetRCValue());\n }\n else\n {\n Console.WriteLine(cell.SetExelValue());\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a64a857a8de1d6cab9e28f5b737faec1", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Globalization;\n\nnamespace Olymp\n{\n public class Point2D\n {\n private double _x;\n private double _y;\n\n public double X { get => _x; private set => _x = value; }\n public double Y { get => _y; private set => _y = value; }\n\n public Point2D(double x, double y)\n {\n X = x;\n Y = y;\n }\n }\n public class Vector2D : Point2D\n {\n public double Length\n {\n get => Math.Sqrt(X * X + Y * Y);\n }\n public Vector2D(double x, double y) : base(x, y) { }\n }\n public class Direct2D\n {\n private Point2D _point;\n private Vector2D _vector;\n\n public Point2D Point { get => _point; private set => _point = value; }\n public Vector2D Vector { get => _vector; private set => _vector = value; }\n\n public double X { get => _point.X; }\n public double Y { get => _point.Y; }\n public double VX { get => _vector.X; }\n public double VY { get => _vector.Y; }\n\n public double Length { get => Vector.Length; }\n\n public Direct2D GetPerpendicularLine(Point2D p)\n {\n double x = VY;\n double y = VX;\n if (x != 0)\n x *= -1;\n else\n y *= -1;\n\n return new Direct2D(p, new Point2D(p.X + x, p.Y + y));\n\n }\n\n public Direct2D GetPerpendicularLine(double x, double y)\n {\n return GetPerpendicularLine(new Point2D(x, y));\n }\n\n\n public Point2D GetPoint(double t)\n {\n return new Point2D(X + VX * t, Y + VY * t);\n }\n\n public Point2D Intersection(Direct2D d)\n {\n double t1 = 0;\n if (d.VX == 0)\n {\n if (d.VY == 0)\n {\n return null;\n }\n else\n {\n var n = VY / d.VY;\n var m = (Y - d.Y) / d.Y;\n var l = d.VX * n - VX;\n if (l == 0)\n {\n return null;\n }\n var b = X - d.X - m * d.VX;\n t1 = b / l;\n\n }\n }\n else\n {\n var n = VX / d.VX;\n var m = (X - d.X) / d.VX;\n var l = d.VY * n - VY;\n if (l == 0)\n {\n return null;\n }\n var b = Y - d.Y - m * d.VY;\n t1 = b / l;\n\n }\n\n return GetPoint(t1);\n }\n\n public Direct2D(Point2D p1, Point2D p2)\n {\n Point = p1;\n Vector = new Vector2D(p2.X - p1.X, p2.Y - p1.Y);\n }\n\n public Direct2D(double x1, double y1, double x2, double y2) : this(new Point2D(x1, y1), new Point2D(x2, y2)) { }\n }\n public class Circle2D\n {\n public Point2D Center { get; private set; }\n public double Radius { get; private set; }\n\n public double GetAngleChord(double lChord)\n {\n return 2 * Math.Asin(lChord / (2 * Radius));\n }\n\n public Point2D GetPoint2D(double angle)\n {\n var x = Center.X + Math.Cos(angle) * Radius;\n var y = Center.Y + Math.Sin(angle) * Radius;\n return new Point2D(x, y);\n }\n\n public Polygon2D GetPolygone(int angles)\n {\n return new Polygon2D(this, angles);\n }\n\n public Circle2D(Point2D c, double d)\n {\n Center = c;\n Radius = d;\n }\n }\n public class Triangle2D : Polygon2D\n {\n public Direct2D GetEdge(int n)\n {\n return directs[n];\n }\n public Circle2D GetDescribedCircle()\n {\n Direct2D[] ds = new Direct2D[2];\n ds[0] = GetEdge(0);\n ds[1] = GetEdge(1);\n ds[0] = ds[0].GetPerpendicularLine(ds[0].GetPoint(0.5));\n ds[1] = ds[1].GetPerpendicularLine(ds[1].GetPoint(0.5));\n Point2D p = ds[0].Intersection(ds[1]);\n Direct2D d = new Direct2D(p, Points[0]);\n return new Circle2D(p, d.Vector.Length);\n }\n\n public Triangle2D(Point2D p1, Point2D p2, Point2D p3) : base(new List(new Point2D[3] { p1, p2, p3 })) { }\n\n }\n public class Polygon2D\n {\n private List points;\n protected List directs;\n\n public List Points { get => points; }\n\n public double Square\n {\n get\n {\n Point2D lastPoint = null;\n double sum = 0;\n foreach (var item in points)\n {\n if (lastPoint != null)\n {\n sum += lastPoint.X * item.Y - item.X * lastPoint.Y;\n }\n lastPoint = item;\n }\n sum += lastPoint.X * points[0].Y - points[0].X * lastPoint.Y;\n return Math.Abs(sum/2);\n }\n }\n\n protected void Init()\n {\n Point2D lastPoint = null;\n foreach (var item in points)\n {\n if (lastPoint != null)\n {\n directs.Add(new Direct2D(lastPoint, item));\n }\n lastPoint = item;\n }\n\n directs.Add(new Direct2D(lastPoint, points[0]));\n\n }\n\n public Polygon2D(List points)\n {\n this.points = points;\n directs = new List();\n Init();\n }\n public Polygon2D()\n {\n points = new List();\n directs = new List();\n }\n\n public Polygon2D(Circle2D circle, int angles)\n {\n var angleStep = 2 * Math.PI / angles;\n double angle = 0;\n points = new List();\n while (angle < 2 * Math.PI)\n {\n points.Add(circle.GetPoint2D(angle));\n angle += angleStep;\n }\n \n directs = new List();\n\n Init();\n }\n\n }\n class Program\n {\n static double gcd(double x, double y)\n {\n while (Math.Abs(x) > Math.E && Math.Abs(y) > Math.E)\n {\n if (x > y)\n x -= (int)(x / y) * y;\n else\n y -= (int)(y / x) * x;\n }\n return x + y;\n }\n public static void Main()\n {\n string[] strs;\n Point2D[] ps = new Point2D[3];\n for (int i = 0; i < 3; i++)\n {\n strs = Console.ReadLine().Split(' ');\n\n ps[i] = new Point2D(Double.Parse(strs[0], CultureInfo.InvariantCulture), Double.Parse(strs[1], CultureInfo.InvariantCulture));\n }\n\n Triangle2D tr = new Triangle2D(ps[0], ps[1], ps[2]);\n Circle2D c = tr.GetDescribedCircle();\n double[] args = new double[3];\n for (int i = 0; i < 3; i++)\n {\n args[i] = tr.GetEdge(i).Vector.Length;\n\n }\n double max = Math.Max(args[0], args[1]);\n double[] angles = new double[3];\n angles[0] = c.GetAngleChord(Math.Min(args[0], args[1])) * 180 / Math.PI;\n angles[1] = c.GetAngleChord(Math.Min(max, args[2])) * 180 / Math.PI;\n max = Math.Max(max, args[2]);\n angles[2] = 360.0 - angles[0] - angles[1];\n int n = (int)(360.0 / gcd(gcd(angles[0], angles[1]), angles[2]) + 0.5);\n Polygon2D p = new Polygon2D(c, n);\n string S = (Math.Round(p.Square, 6).ToString().Replace(',', '.'));\n Console.WriteLine(S);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "496a648286c6b8cb536cf4afa520eabd", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "MS C#", "source_code": " class Program\n {\n public static void Main(string[] args)\n {\n string data = Console.ReadLine();\n if (data.Length > 20) Console.WriteLine(\"BigInteger\");\n else\n {\n if(data.Length<19 || data.Length==19 && data[0]=='-')\n {\n long inp = long.Parse(data);\n if (inp < 128L && inp >= sbyte.MinValue) Console.WriteLine(\"byte\");\n else if (inp < 32768L && inp >= short.MinValue) Console.WriteLine(\"short\");\n else if (inp < 2147483648L && inp >= int.MinValue) Console.WriteLine(\"int\");\n else Console.WriteLine(\"long\");\n }\n else\n {\n long halfA= 9223372036, halfB, hlfA, hlfB;\n if (data[0] == '-')\n {\n halfB = 854775808;\n hlfA = long.Parse(data.Substring(1, 10));\n hlfB = long.Parse(data.Substring(11));\n }\n else\n {\n halfB = 854775807;\n hlfA = long.Parse(data.Substring(0, 10));\n hlfB = long.Parse(data.Substring(10));\n }\n if (halfA > hlfA) Console.WriteLine(\"long\");\n else if (halfA == hlfA)\n {\n if (halfB > hlfB) Console.WriteLine(\"long\");\n else Console.WriteLine(hlfB == halfB ? \"long\" : \"BigInteger\");\n }\n else Console.WriteLine(\"BigInteger\");\n }\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7f9085989cf43f8f4653688949d003db", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "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 n = Console.ReadLine();\n \n double d = Convert.ToDouble(n);\n\n if (d >= -128 && d <= 127) Console.WriteLine(\"byte\");\n else if (d >= -32768 && d <= 32767) Console.WriteLine(\"short\");\n else if (d >= -\u20092147483648 && d <= 2147483647) Console.WriteLine(\"int\");\n else if (d >= -\u20099223372036854775808 && d <= 9223372036854775807) Console.WriteLine(\"long\");\n else Console.WriteLine(\"BigInteger\");\n \n\n \n \n }\n\n \n }\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bd4c421aa8ed216682dcde5058f14d9f", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace PetyaJava\n{\n static class Operacao\n {\n //Matriz de 5x4, sendo a primeira coluna o tipo de vari\u00e1vel, e a segunda a informa\u00e7\u00e3o se aquele tipo pode guardar o n\u00famero informado\n static string[,] TipoDeVariavel = new string[,] { { \"byte\", \"false\" }, { \"short\", \"false\" }, \n { \"int\", \"false\" }, { \"long\", \"false\" }, { \"BigInteger\", \"false\" } };\n\n\n public static void Compara(string valor)\n {\n //Usando o sistema de try catch, testar se o tipo de vari\u00e1vel suporta o numero\n try\n {\n sbyte x = sbyte.Parse(valor); //Tentar fazer a convers\u00e3o\n TipoDeVariavel[0, 1] = \"true\"; //Caso positivo, armazenar na matriz na celula correspondente\n }\n catch (System.Exception) //Testar outros tipos, em caso de erro\n {\n try\n {\n short x = short.Parse(valor);\n TipoDeVariavel[1, 1] = \"true\";\n }\n catch (System.Exception)\n {\n try\n {\n int x = int.Parse(valor);\n TipoDeVariavel[2, 1] = \"true\";\n }\n catch (System.Exception)\n {\n try\n {\n long x = long.Parse(valor);\n TipoDeVariavel[3, 1] = \"true\";\n }\n //Se der erro em todas, ele guarda em BigInteger, visto que \u00e9 o tipo que armazena n\u00fameros de qualquer tamanho\n catch (System.Exception) \n {\n TipoDeVariavel[4, 1] = \"true\";\n }\n }\n }\n }\n\n for (int i = 0; i < 5; i++) //Percorrer a segunda coluna da matriz\n {\n if (TipoDeVariavel[i, 1] == \"true\") //O primeiro tipo que ela identificar j\u00e1 vai ser o resultado\n {\n Console.Write(TipoDeVariavel[i, 0]);\n return;\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f4b09672eb1273916a57040d70c510cf", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF2\n{\n class Program\n {\n static void Main(string[] args)\n { long val=0;\n string s1 = Console.ReadLine();\n\n if (long.TryParse(s1, out val))\n {\n if (val >= -128 && val <= 127) Console.WriteLine(\"byte\");\n else if (val >= -32768 && val <= 32767) Console.WriteLine(\"short\");\n else if (val >= -2147483648 && val <= 2147483647) Console.WriteLine(\"int\");\n else if (val >= -\u20099223372036854775808 && val <= 9223372036854775807) Console.WriteLine(\"long\");\n }\n\n else Console.WriteLine(\"BigInteger\");\n }\n \n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aa39e3c7893dedf1ea5e700584bcc2d1", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace task_61_A\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n long i;\n try \n {\n i=long.Parse(s);\n }\n catch (Exception ex)\n {\n Console.WriteLine(\"BigInteger\");\n return;\n }\n \n if(i>-129 && i<128)\n {\n Console.WriteLine(\"byte\");\n return;\n }\n if(i>-32769 && i<32769)\n {\n Console.WriteLine(\"short\");\n return;\n }\n if (i>=-2147483648 && i<=2147483647)\n {\n Console.WriteLine(\"int\");\n return;\n } //long\n if(i>=-9223372036854775808 && i<=9223372036854775807)\n {\n Console.WriteLine(\"long\");\n return;\n }\n else \n {\n Console.WriteLine(\"BigInteger\");\n return;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1fe5e4974a1bd6ba787e570cf97c8dd7", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": " //Matriz de 5x4, sendo a primeira coluna o tipo de vari\u00e1vel, e a segunda a informa\u00e7\u00e3o se aquele tipo pode guardar o n\u00famero informado\n static string[,] TipoDeVariavel = new string[,] { { \"byte\", \"false\" }, { \"short\", \"false\" }, \n { \"int\", \"false\" }, { \"long\", \"false\" }, { \"BigInteger\", \"false\" } };\n\n\n public static void Compara(string valor)\n {\n //Usando o sistema de try catch, testar se o tipo de vari\u00e1vel suporta o numero\n try\n {\n sbyte x = sbyte.Parse(valor); //Tentar fazer a convers\u00e3o\n TipoDeVariavel[0, 1] = \"true\"; //Caso positivo, armazenar na matriz na celula correspondente\n }\n catch (System.Exception) //Testar outros tipos, em caso de erro\n {\n try\n {\n short x = short.Parse(valor);\n TipoDeVariavel[1, 1] = \"true\";\n }\n catch (System.Exception)\n {\n try\n {\n int x = int.Parse(valor);\n TipoDeVariavel[2, 1] = \"true\";\n }\n catch (System.Exception)\n {\n try\n {\n long x = long.Parse(valor);\n TipoDeVariavel[3, 1] = \"true\";\n }\n //Se der erro em todas, ele guarda em BigInteger, visto que \u00e9 o tipo que armazena n\u00fameros de qualquer tamanho\n catch (System.Exception) \n {\n TipoDeVariavel[4, 1] = \"true\";\n }\n }\n }\n }\n\n for (int i = 0; i < 5; i++) //Percorrer a segunda coluna da matriz\n {\n if (TipoDeVariavel[i, 1] == \"true\") //O primeiro tipo que ela identificar j\u00e1 vai ser o resultado\n {\n Console.Write(TipoDeVariavel[i, 0]);\n return;\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "acb49d619810ac72792b75bd91fb87a5", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27130.2036\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"PetyaJava\", \"PetyaJava\\PetyaJava.csproj\", \"{B5A2648F-160F-4288-818A-2F7AC0EA8DC4}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B5A2648F-160F-4288-818A-2F7AC0EA8DC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B5A2648F-160F-4288-818A-2F7AC0EA8DC4}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B5A2648F-160F-4288-818A-2F7AC0EA8DC4}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B5A2648F-160F-4288-818A-2F7AC0EA8DC4}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {2383E8CE-4935-4D1D-8E0F-B8942671F10B}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "46bfb392aad38a4cfad0777b7366a5e7", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "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 n = Console.ReadLine();\n \n double d = Convert.ToDouble(n);\n\n if (d >= -128d && d <= 127d) \n { \n Console.WriteLine(\"byte\");\n }\n else if (d >= -32768d && d <= 32767d) \n { \n Console.WriteLine(\"short\"); \n }\n else if (d >= -\u20092147483648d && d <= 2147483647d) \n { \n Console.WriteLine(\"int\"); \n }\n else if (d >= -\u20099223372036854775808d && d <= 9223372036854775807d) \n { \n Console.WriteLine(\"long\"); \n }\n else \n { \n Console.WriteLine(\"BigInteger\"); \n }\n \n \n }\n\n \n }\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2c40aa004f09084d54a88d28de83f259", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\n\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n \n double d = Convert.ToDouble(n);\n\n if (d >= -128 && d <= 127) \n { \n Console.WriteLine(\"byte\");\n }\n else if (d >= -32768 && d <= 32767) \n { \n Console.WriteLine(\"short\"); \n }\n else if (d >= -\u20092147483648 && d <= 2147483647) \n { \n Console.WriteLine(\"int\"); \n }\n else if (d >= -\u20099223372036854775808 && d <= 9223372036854775807) \n { \n Console.WriteLine(\"long\"); \n }\n else \n { \n Console.WriteLine(\"BigInteger\"); \n }\n \n \n }\n\n \n }\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e22b30014186ad5063b25f498efbf322", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "public static string Func(string n)\n\t\t{\n\n\t\t\tlong d = 0;\n\n\t\t\ttry{ \n\t\t\t\td = Convert.ToInt64 (n);\n\t\t\t}\n\t\t\tcatch (System.OverflowException)\n\t\t\t{\n\t\t\t\treturn \"BigInteger\";\n\t\t\t}\n\t\t\tstring[] arr = new string[]{\"byte\",\"short\", \"int\", \"long\", \"BigInteger\"};\n\t\t\tif ((-128 <= d) && (d <= 127)) return arr [0];\n\t\t\tif((-32768 <= d) && (d<= 32767))\n\t\t\t\treturn arr [1];\n\t\t\tif((-2147483648 <= d) && (d<= 2147483647))\n\t\t\t\treturn arr [2];\n\t\t\telse\n\t\t\t\treturn arr [3];\n\n\t\t}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9dba25ec7924f8adb5d80cc84ec8a422", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n\n\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n \n double d = Convert.ToDouble(n);\n\n if (d >= -128 && d <= 127) { Console.WriteLine(\"byte\"); }\n else if (d >= -32768 && d <= 32767) { Console.WriteLine(\"short\"); }\n else if (d >= -\u20092147483648 && d <= 2147483647) { Console.WriteLine(\"int\"); }\n else if (d >= -\u20099223372036854775808 && d <= 9223372036854775807) { Console.WriteLine(\"long\"); }\n else { Console.WriteLine(\"BigInteger\"); }\n \n \n }\n\n \n }\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8c9e24ebede997655a867ec0ca476af7", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using 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 n = Console.ReadLine();\n \n //double d = Convert.ToDouble(Convert.toi n);\n\n Console.WriteLine(Checker(n));\n \n Console.ReadLine();\n }\n\n public static string Checker(string n)\n {\n\n string s = String.Empty;\n\n try\n {\n sbyte wert = Convert.ToSByte(n); // (d >= -128.0 && d <= 127.0)\n s = \"byte\";\n }\n catch {}\n\n try\n {\n short wert = Convert.ToInt16(n); // (d >= -32768.0 && d <= 32767.0)\n s = \"short\";\n }\n catch {}\n\n try\n {\n int wert = Convert.ToInt32(n); // (d >= -2147483648.0 && d <= 2147483647.0)\n s = \"int\";\n }\n catch {}\n\n try\n {\n long wert = Convert.ToInt64(n); // (d >= -9223372036854775808.0 && d <= 9223372036854775807.0)\n s = \"long\";\n }\n catch {}\n\n if (s == String.Empty)\n {\n s = \"BigInteger\";\n }\n \n return s;\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c5da1e588afaf7e5b88b339f09d36372", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "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\n\n public static int ApperCaseBegins(int i, string s)\n {\n char[] chararr = s.ToCharArray();\n for (; i < chararr.Length; i++)\n {\n if (chararr[i] <= 90) return i;\n }\n return i;\n }\n\n public static bool Contains_lowercase(string S)\n {\n\n char[] chararr = S.ToCharArray();\n\n for (int i = 0; i < chararr.Length; i++)\n {\n if (chararr[i] >= 97) return true;\n }\n return false;\n }\n\n\n\n static void Main(string[] args)\n {\n string input_string;\n int string_size, i;\n List list_of_sub_strings = new List();\n //List ans = new List();\n int test=0;\n\n string_size = int.Parse(Console.ReadLine());\n input_string = Console.ReadLine();\n\n\n if (!Contains_lowercase(input_string))\n {\n Console.WriteLine(0);\n goto ret;\n }\n else\n {\n int helper;\n char[] charArray = input_string.ToCharArray();\n for (i = 0; i < charArray.Length; i++)\n {\n\n if (charArray[i] >= 97)\n {\n helper = ApperCaseBegins(i, input_string);\n list_of_sub_strings.Add(input_string.Substring(i, helper - i));\n i = helper;\n }\n }\n\n }\n\n\n HashSet mySet = new HashSet();\n \n \n for (i = 0; i < list_of_sub_strings.Count; i++)\n {\n test = 0;\n for (int j = 0; j < list_of_sub_strings[i].Length; j++)\n {\n mySet.Add(list_of_sub_strings[i][j]);\n if(test< mySet.Count)\n {\n test = mySet.Count;\n }\n }\n }\n //ans = mySet.ToList();\n List ans = mySet.ToList();\n \n Console.WriteLine(test);\n ret:\n // Console.ReadKey();\n\n }\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "009a5c7e11c526c0d02c722359e07247", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace CodeforcesTemplate\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#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n int n = double.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n\n RunTimer();\n\n int max = 0;\n List list = new List();\n int sum = 0;\n for (int i = 0; i < str.Length; i++)\n {\n char s = str[i];\n if (s.ToString().ToUpper() == s.ToString())\n {\n sum = 0;\n list.Clear();\n }\n else\n {\n if (!list.Contains(s))\n {\n list.Add(s);\n sum++;\n }\n\n if (sum > max)\n {\n sum = max;\n }\n }\n }\n Console.WriteLine(max);\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInKilobytes = (after - before) / (1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (Kb): {consumedInKilobytes}\");\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 WriteFile(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadStringFile()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArrayFile(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArrayFile()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] ReadIntArrayFile()\n {\n return ReadStringFile().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] ReadDoubleArrayFile()\n {\n return ReadStringFile().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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3f0c5365498ca7b0f77e9958f41755ff", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CF_864B\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 str = \"\";\n int count = 0;\n\n for(int i=0; i= 'A') && (s[i] <= 'Z'))\n {\n if(str.Length > count)\n {\n count = str.Length;\n }\n\n str = \"\";\n }\n else\n {\n if(str.Length == 0)\n {\n str += s[i];\n }\n\n if(!str.Contains(s[i]))\n {\n str += s[i];\n }\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c4bc59368c5489f7f10cd09f3187d037", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace 864B\n{\n class Program\n {\n\n\n public static int ApperCaseBegins(int i, string s)\n {\n char[] chararr = s.ToCharArray();\n for (; i < chararr.Length; i++)\n {\n if (chararr[i] <= 90) return i;\n }\n return i;\n }\n\n public static bool Contains_lowercase(string S)\n {\n\n char[] chararr = S.ToCharArray();\n\n for (int i = 0; i <= chararr.Length; i++)\n {\n if (chararr[i] >= 97) return true;\n }\n return false;\n }\n\n\n\n static void Main(string[] args)\n {\n string input_string;\n int string_size, ans, i;\n List list_of_sub_strings = new List();\n\n\n input_string = Console.ReadLine();\n // string_size = int.Parse(Console.ReadLine());\n\n if (!Contains_lowercase(input_string)) Console.WriteLine(0);\n else\n {\n int helper;\n char[] charArray = input_string.ToCharArray();\n for (i = 0; i < charArray.Length; i++)\n {\n\n if (charArray[i] >= 97)\n {\n helper = ApperCaseBegins(i, input_string);\n list_of_sub_strings.Add(input_string.Substring(i, helper - i));\n i = helper;\n }\n }\n\n }\n\n\n HashSet mySet = new HashSet();\n ans = 0;\n for (i = 0; i < list_of_sub_strings.Count; i++)\n {\n\n // mySet = new HashSet(list_of_sub_strings[i].ToCharArray());\n foreach (char c in list_of_sub_strings[i].ToCharArray()) mySet.Add(c);\n if (ans < mySet.Count()) { ans = mySet.Count(); }\n mySet.Clear();\n }\n\n // foreach (string s in list_of_sub_strings) Console.WriteLine(s);\n Console.WriteLine(ans);\n Console.ReadKey();\n }\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c3f5806266955db9b022e69d70f6852f", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0} {"lang": "Mono C#", "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\n\n public static int ApperCaseBegins(int i, string s)\n {\n char[] chararr = s.ToCharArray();\n for (; i < chararr.Length; i++)\n {\n if (chararr[i] <= 90) return i;\n }\n return i;\n }\n\n public static bool Contains_lowercase(string S)\n {\n\n char[] chararr = S.ToCharArray();\n\n for (int i = 0; i < chararr.Length; i++)\n {\n if (chararr[i] >= 97) return true;\n }\n return false;\n }\n\n\n\n static void Main(string[] args)\n {\n string input_string;\n int string_size, i;\n List list_of_sub_strings = new List();\n //List ans = new List();\n int test=0;\n\n string_size = int.Parse(Console.ReadLine());\n input_string = Console.ReadLine();\n\n\n if (!Contains_lowercase(input_string))\n {\n Console.WriteLine(0);\n goto ret;\n }\n else\n {\n int helper;\n char[] charArray = input_string.ToCharArray();\n for (i = 0; i < charArray.Length; i++)\n {\n\n if (charArray[i] >= 97)\n {\n helper = ApperCaseBegins(i, input_string);\n list_of_sub_strings.Add(input_string.Substring(i, helper - i));\n i = helper;\n }\n }\n\n }\n\n\n HashSet mySet = new HashSet();\n \n \n for (i = 0; i < list_of_sub_strings.Count; i++)\n {\n test = 0;\n for (int j = 0; j < list_of_sub_strings[i].Length; j++)\n {\n mySet.Add(list_of_sub_strings[i][j]);\n if(test< mySet.Count)\n {\n test = mySet.Count;\n }\n }\n }\n //ans = mySet.ToList();\n List ans = mySet.ToList();\n \n Console.WriteLine(test);\n ret:\n /// Console.ReadKey();\n\n }\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7da1ebda814175ccbb58ea91c18a05d4", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nnamespace shoval\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int sum = 1, TotalPrice = 0;\n int Price = int.Parse(input[0];\n r = int.Parse(input[1]);\n TotalPrice = x ;\n while (true)\n {\n if ((x*sum) % 10 ==0 || (sum*x) % 10 == Price)\n break;\n TotalPrice +=x;\n sum++;\n }\n Console.WriteLine(sum);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "07f7d4851557b9ef1bebbe7fb3745615", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "Mono C#", "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 var Input = Convert.ToString(Console.ReadLine());\n var MasInp = Input.Split(' ');\n\n int k = Convert.ToInt32(MasInp[0]);\n int j = Convert.ToInt32(MasInp[1]);\n int sum = k;\n\n while()\n {\n int Res = sum\n sum += k;\n }\n\n Console.Write(sum / k);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4745737b908b135a9481e754f7893676", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "#include \n\nint main()\n{\n int k,r, sum=0, q=0;\n scanf(\"%d%d\",&k,&r);\n for(int i=1; ;i++)\n\t\t{\n\t\t\tsum=k*i;\n\t\t\tif(sum%10==0 || sum%10==r)\n\t\t\t{\n\t\t\t\tq=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\tprintf(\"%d\",q);\n\n return 0;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8e1f00943db57b3a8ad04d7d07424c93", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Solution\n{\n static void Main(string[] args)\n {\n\n string[] colors = Console.ReadLine().Split(\" \");\n\n int shovels = Convert.ToInt32(colors[0]);\n int burles = Convert.ToInt32(colors[1]);\n int multi = 0;\n for (int i = 1; i <= 10; i++)\n {\n multi = i * shovels;\n if (Math.Abs(multi % 10) == burles || Math.Abs(multi % 10) == 0)\n {\n Console.WriteLine(i);\n break;\n }\n }\n // another way\n // int sum = 1 ;\n //while (true)\n //{\n // multi = sum * shovels;\n // if (Math.Abs(multi % 10) == burles || Math.Abs(multi % 10) == 0)\n // {\n // Console.WriteLine(sum);\n // break;\n // }\n // ++sum;\n //}\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1ba633ed68023c8520d532325d2dc528", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nnamespace shoval\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int sum = 1, TotalPrice = 0;\n int Price = int.Parse(input[0];\n r = int.Parse(input[1]);\n TotalPrice = x ;\n while (true)\n {\n if ((x*NumberOfShovels) % 10 == 0 || (x - r) % 10 == 0)\n break;\n TotalPrice +=x;\n sum++;\n }\n Console.WriteLine(sum);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c836a47d62cce461c739864008393575", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nclass DELETEME\n{\n static void Main()\n {\n var d = Console.ReadLine().Split().Select(Int32.Parse).ToArray();\n int r = d[1], k = d[0];\n var result = 1;\n while ((result * k - r) % 10 != 0)\n result++;\n Console.WriteLine(result);\n }\n}-", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fb00845d3ef63f46f6e7ca28a0c3d2b6", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {834994D1-E68F-4AA0-BB0D-BB4BF7004EDF}\n Exe\n Properties\n ConsoleApplication15\n ConsoleApplication15\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a91c157b018b4ea6578170506472cadc", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "Mono C#", "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 int x = Console.Re();\n int y = Console.Read();\n int z = Console.Read();\n int t1 = Console.Read();\n int t2 = Console.Read();\n int t3 = Console.Read();\n if (Math.Abs(z - x) * t2 + t3 + Math.Abs(x - y) * t2 + t3 >= Math.Abs(x - y) * t1)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8a275225248301295f6327bc9896c160", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Drawing;\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 string[] str1 = Console.ReadLine().Split(' ');\n \n int x = int.Parse(str1[0]);\n int y = int.Parse(str1[1]);\n int z = int.Parse(str1[2]);\n int t1 = int.Parse(str1[3]);\n int t2 = int.Parse(str1[4]);\n int t3 = int.Parse(str1[5]);\n\n if (Math.Abs(x-z)*t2 + Math.Abs(x-y)*t2 +3*t3 <= Math.Abs(x-y)*t1)\n {\n Console.WriteLine(\"YES\");\n\n }\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "88c8e3130cb97c41e961d479bf6e92ce", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace MailCup1A\n{\n class Program\n {\n public static void Main(string[] args)\n {\n string[] a=Console.ReadLine().Split();\n if((Math.Abs(Convert.ToInt32(a[2])-Convert.ToInt32(a[1]))*Convert.ToInt32(a[4])+3*Convert.ToInt32(a[5]))<=Math.Abs(Convert.ToInt32(a[1])-Convert.ToInt32(a[0]))*Convert.ToInt32(a[3]))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "47ad268e8cb9d17a891b8c58e9197d3b", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Drawing;\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 string[] str1 = Console.ReadLine().Split(' ');\n \n int x = int.Parse(str1[0]);\n int y = int.Parse(str1[1]);\n int z = int.Parse(str1[2]);\n int t1 = int.Parse(str1[3]);\n int t2 = int.Parse(str1[4]);\n int t3 = int.Parse(str1[5]);\n\n if (System.Math.Abs(x-z)*t2 + System.Math.Abs(x-y)*t2 +3*t3 < System.Math.Abs(x-y)*t1)\n {\n Console.WriteLine(\"YES\");\n\n }\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4e98c8f01edd0ed86b1b6191628c6997", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n\n int htCaterPillar = int.Parse(Console.ReadLine());\n \n int htApple = int.Parse(Console.ReadLine());\n int UpSpeed = int.Parse(Console.ReadLine());\n \n int DownSpeed = int.Parse(Console.ReadLine());\n\n p.Ankush(htCaterPillar, htApple, UpSpeed, DownSpeed);\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e5f3f41f2fe39b901f58ea65729df7f0", "src_uid": "2c39638f07c3d789ba4c323a205487d7", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "/* Date: 20.08.2016 * 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\nA. \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\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\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\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd (\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\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.\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!\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! \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,\n\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 n * 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,\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 6 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd:\n\ufffd\t'C' (cyan) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \n\ufffd\t'M' (magenta) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'Y' (yellow) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'W' (white) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'G' (grey) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'B' (black) \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.\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.\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 n \ufffd m (1 <= n, m <= 100) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \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 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.\n\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\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 'C', 'M', 'Y', 'W', 'G' \ufffd\ufffd\ufffd 'B'.\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 \ufffd#Black&White\ufffd (\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd), \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#Color\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\n2 2\nC M\nY Y\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n#Color\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n3 2\nW W\nW W\nB B\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n#Black&White\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1 1\nW\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n#Black&White\n\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\\\\2016\\\\Task\\\\07 Codeforces\\\\019\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2016\\\\Task\\\\07 Codeforces\\\\019\\\\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# endif\n\n\t\tstring [] ss = ss.Split (' ');\n\t\tint n = int.Parse (ss [0]);\n\t\tint m = int.Parse (ss [1]);\n\n\t\tbool color = false;\n\n\t\tfor ( int i = 0; i < n; i++ )\n\t\t{\n# if ( ONLINE_JUDGE )\n\t\tss = Console.ReadLine ();\n# else\n\t\tss = sr.ReadLine ();\n# endif\n\n\t\t\tfor ( int j = 0; j < m; j++ )\n\t\t\t\tif ( ss [j] == 'C' || ss [j] == 'M' || ss [j] == 'Y' )\n\t\t\t\t{\n\t\t\t\t\tcolor = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tif ( color )\n\t\t\t\tbreak;\n\t\t}\n\n# if ( ONLINE_JUDGE )\n\t\tif ( colour )\n\t\t\tConsole.WriteLine (\"#Color\");\n\t\telse\n\t\t\tConsole.WriteLine (\"#Black&White\");\n# else\n\t\tif ( colour )\n\t\t\tsw.WriteLine (\"#Color\");\n\t\telse\n\t\t\tsw.WriteLine (\"#Black&White\");\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t\treturn 0;\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6343e6482fba30f9b8c3cb88ae3c9657", "src_uid": "19c311c02380f9a73cd477e4fde27454", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace DAy2\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] colors = new string[] { \"W\", \"B\", \"G\" };\n string result = \"#Black&White\";\n bool br = true;\n var RC = Console.ReadLine().Split(\" \");\n String[,] arr = new string[Convert.ToInt32(RC[0]), Convert.ToInt32(RC[1])];\n\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n var RD = Console.ReadLine().Split(\" \");\n for (int j = 0; j < arr.GetLength(1); j++)\n {\n arr[i, j] = RD[j];\n\n }\n\n }\n\n\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n for (int j = 0; j < arr.GetLength(1); j++)\n {\n if (colors.Contains(arr[i, j]))\n {\n continue;\n }\n else\n {\n result = \"#Color\";\n br = false;\n break;\n }\n }\n if (!br)\n { break; }\n }\n\n Console.WriteLine(result);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "40a02ca0090c76185cc31c044b756271", "src_uid": "19c311c02380f9a73cd477e4fde27454", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25123.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication2\", \"ConsoleApplication2\\ConsoleApplication2.csproj\", \"{07126F26-757F-4B75-A746-439200F0A315}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{07126F26-757F-4B75-A746-439200F0A315}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{07126F26-757F-4B75-A746-439200F0A315}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{07126F26-757F-4B75-A746-439200F0A315}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{07126F26-757F-4B75-A746-439200F0A315}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "20157c6ee15d289120e2c5bb0ef6d9e5", "src_uid": "19c311c02380f9a73cd477e4fde27454", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace DAy2\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] colors = new string[] { \"W\", \"B\", \"G\" };\n string result = \"#Black&White\";\n bool br = true;\n var RC = Console.ReadLine().Split(\" \");\n try\n {\n String[,] arr = new string[Convert.ToInt32(RC[0]), Convert.ToInt32(RC[1])];\n\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n var RD = Console.ReadLine().Split(\" \");\n for (int j = 0; j < arr.GetLength(1); j++)\n {\n arr[i, j] = RD[j];\n\n }\n\n }\n\n\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n for (int j = 0; j < arr.GetLength(1); j++)\n {\n if (colors.Contains(arr[i, j]))\n {\n continue;\n }\n else\n {\n result = \"#Color\";\n br = false;\n break;\n }\n }\n if (!br)\n { break; }\n }\n\n Console.WriteLine(result);\n }\n catch (Exception ex) {\n Console.WriteLine(\"Error\");\n\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4018a5b0e77d474e3e336be9d3588092", "src_uid": "19c311c02380f9a73cd477e4fde27454", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "/* Date: 20.08.2016 * 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\nA. \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\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\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\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd (\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\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.\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!\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! \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,\n\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 n * 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,\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 6 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd:\n\ufffd\t'C' (cyan) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \n\ufffd\t'M' (magenta) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'Y' (yellow) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'W' (white) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'G' (grey) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'B' (black) \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.\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.\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 n \ufffd m (1 <= n, m <= 100) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \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 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.\n\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\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 'C', 'M', 'Y', 'W', 'G' \ufffd\ufffd\ufffd 'B'.\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 \ufffd#Black&White\ufffd (\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd), \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#Color\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\n2 2\nC M\nY Y\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n#Color\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n3 2\nW W\nW W\nB B\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n#Black&White\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1 1\nW\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n#Black&White\n\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\\\\2016\\\\Task\\\\07 Codeforces\\\\019\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2016\\\\Task\\\\07 Codeforces\\\\019\\\\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# endif\n\n\t\tstring [] ss = ss.Split (' ');\n\t\tint n = int.Parse (ss [0]);\n\t\tint m = int.Parse (ss [1]);\n\n\t\tbool color = false;\n\n\t\tfor ( int i=0; i < n; i++ )\n\t\t{\n# if ( ONLINE_JUDGE )\n\t\tss = Console.ReadLine ();\n# else\n\t\tss = sr.ReadLine ();\n# endif\n\n\t\t\tfor ( int j = 0; j < m; j++ )\n\t\t\t\tif ( ss [j] == 'C' || ss [j] == 'M' || ss [j] == 'Y' )\n\t\t\t\t{\n\t\t\t\t\tcolor = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tif ( color )\n\t\t\t\tbreak;\n\t\t}\n\n# if ( ONLINE_JUDGE )\n\t\tif ( colour )\n\t\t\tConsole.WriteLine (\"#Color\");\n\t\telse\n\t\t\tConsole.WriteLine (\"#Black&White\");\n# else\n\t\tif ( colour )\n\t\t\tsw.WriteLine (\"#Color\");\n\t\telse\n\t\t\tsw.WriteLine (\"#Black&White\");\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t\tretrutn 0;\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "97c7f1d611e8fd461e75da607b5cb1ad", "src_uid": "19c311c02380f9a73cd477e4fde27454", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace codeforce\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] colors = new string[] { \"w\", \"b\", \"g\" };\n string result = \"#Black&White\";\n var RC = Console.ReadLine().Split(\" \");\n String [,]arr = new string[Convert.ToInt32(RC[0]),Convert.ToInt32(RC[1])];\n\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n var RD = Console.ReadLine().Split(\" \");\n for (int j = 0; j < arr.GetLength(1); j++)\n {\n arr[i, j] = RD[j];\n\n }\n\n }\n\n for (int i = 0; i< arr.GetLength(0); i++)\n {\n for (int j = 0; j < arr.GetLength(1); j++)\n {\n if (!colors.Contains(arr[i,j]))\n {\n result = \"#Color\";\n break;\n }\n }\n\n }\n Console.WriteLine(result);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9779d6a78a87d968dba6fb07c7c4508a", "src_uid": "19c311c02380f9a73cd477e4fde27454", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "/* Date: 20.08.2016 * 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\nA. \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\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\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\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd (\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\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.\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!\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! \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,\n\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 n * 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,\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 6 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd:\n\ufffd\t'C' (cyan) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \n\ufffd\t'M' (magenta) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'Y' (yellow) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'W' (white) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'G' (grey) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\t'B' (black) \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.\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.\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 n \ufffd m (1 <= n, m <= 100) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \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 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.\n\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\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 'C', 'M', 'Y', 'W', 'G' \ufffd\ufffd\ufffd 'B'.\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 \ufffd#Black&White\ufffd (\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd), \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#Color\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\n2 2\nC M\nY Y\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n#Color\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n3 2\nW W\nW W\nB B\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n#Black&White\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1 1\nW\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n#Black&White\n\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\\\\2016\\\\Task\\\\07 Codeforces\\\\019\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2016\\\\Task\\\\07 Codeforces\\\\019\\\\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# endif\n\n\t\tstring [] s = ss.Split (' ');\n\t\tint n = int.Parse (s [0]);\n\t\tint m = int.Parse (s [1]);\n\n\t\tbool color = false;\n\n\t\tfor ( int i = 0; i < n; i++ )\n\t\t{\n# if ( ONLINE_JUDGE )\n\t\tss = Console.ReadLine ();\n# else\n\t\tss = sr.ReadLine ();\n# endif\n\n\t\t\tfor ( int j = 0; j < m; j++ )\n\t\t\t\tif ( ss [j] == 'C' || ss [j] == 'M' || ss [j] == 'Y' )\n\t\t\t\t{\n\t\t\t\t\tcolor = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tif ( color )\n\t\t\t\tbreak;\n\t\t}\n\n# if ( ONLINE_JUDGE )\n\t\tif ( colour )\n\t\t\tConsole.WriteLine (\"#Color\");\n\t\telse\n\t\t\tConsole.WriteLine (\"#Black&White\");\n# else\n\t\tif ( colour )\n\t\t\tsw.WriteLine (\"#Color\");\n\t\telse\n\t\t\tsw.WriteLine (\"#Black&White\");\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "75d4058308a7170d89201024d989de25", "src_uid": "19c311c02380f9a73cd477e4fde27454", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {21D98712-4270-44C0-B398-173E13257C95}\n Exe\n Properties\n ZerosAndOnes\n ZerosAndOnes\n v4.0\n Client\n 512\n \n \n x86\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n x86\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ef6a5c5bc82f35249d513014d3bf243a", "src_uid": "19c311c02380f9a73cd477e4fde27454", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n \n int n, m;\n \n string str = Console.ReadLine();\n string[] nm = str.Split();\n if (nm.Length != 2 && nm[0] == \"\")\n {\n return;\n }\n else\n {\n n = Int32.Parse(nm[0]);\n m = Int32.Parse(nm[1]);\n\n }\n\n char[,] matrix = new char[n, m];\n\n bool blackWhite = true;\n\n for(int i=0;i val != \"\").ToArray();\n string output = \"/\" + string.Join('/', input);\n Console.WriteLine(output);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "54f2d9854dc68cb24e1d026cf5c04e49", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace B20\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { '/' }).Where(val => val != \"\").ToArray();\n Console.WriteLine(\"/\" + string.Join('/', input));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "520ab7300a925dfb506986d2ee4b3100", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tstring w = Console.ReadLine();\n\t\tstring []wtime = w.Split(':');\n\t\tstring s = Console.ReadLine();\n\t\tstring []stime = s.Split(':');\n\t\tint []ww = new int[2] {int.Parse(wtime[0]),int.Parse(wtime[1])};\n\t\tint []ss = new int[2] {int.Parse(stime[0]),int.Parse(stime[1])};\n\t\t//int []h = new int[2];\n\t\tif(0<=ww[0]&&0<=ss[0]&&ww[0]<=23&&ss[0]<=23 &&0<=ww[1]&&0<=ss[1]&&ww[1]<=59&&ss[1]<=59)\n\t\t{\n\t\t\tif(ww[1] 18) return true;\n\t\t\tif (dy < 18) return false;\n\t\t\tif (final.Month > m) return true;\n\t\t\tif (final.Month < m) return false;\n\t\t\tif (final.Day > d) return true;\n\t\t\tif (final.Day < d) return false;\n\t\t\treturn true;\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tString s1, s2;\n\t\t\ts1 = Console.ReadLine();\n\t\t\ts2 = Console.ReadLine();\n\t\t\tstring[] ss;\n\t\t\tint[] a;\n\n\t\t\tss = s1.Split('.');\n\t\t\ta = new int[ss.Length];\n\t\t\tfor (int i = 0; i < ss.Length; i++)\n\t\t\t{\n\t\t\t\ta[i] = Int32.Parse(ss[i]);\n\t\t\t}\n\t\t\tfinal = new DateTime(2000 + a[2], a[1], a[0]);\n\n\t\t\tss = s2.Split('.');\n\t\t\ta = new int[ss.Length];\n\t\t\tfor (int i = 0; i < ss.Length; i++)\n\t\t\t{\n\t\t\t\ta[i] = Int32.Parse(ss[i]);\n\t\t\t}\n\t\t\t\n\t\t\tint n = 3;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tfor (int j = 0; j < n; j++)\n\t\t\t\t{\n\t\t\t\t\tfor (int k = 0; k < n; k++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (i != j && i != k && j != k)\n\t\t\t\t\t\t\tif (Solve(a[i], a[j], 2000 + a[k])) \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\t\t\tConsole.WriteLine(\"NO\");\n\t\t}\n\t\t\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0573ff2a03b1eb6c11291550d464cbde", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0} {"lang": "Mono C#", "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 cd = RL();\n string bd = RL();\n\n string[] cd_dd = cd.Split('.');\n\n string format = \"dd.MM.yyyy\";\n\n DateTime cd_date = DateTime.ParseExact(string.Format(\"{0}.{1}.{2}\", cd_dd[0], cd_dd[1], 2000 + int.Parse(cd_dd[2])), format, CultureInfo.InvariantCulture);\n\n int[] dd = Array.ConvertAll(bd.Split('.'), int.Parse);\n\n int[] p = { 0, 1, 2 };\n\n do\n {\n string nd = string.Format(\"{0}.{1}.{2}\", dd[p[0]].ToString().PadLeft(2, '0'), dd[p[1]].ToString().PadLeft(2, '0'), 2000 + dd[p[2]]);\n\n DateTime ddt;\n if (DateTime.TryParseExact(nd, format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out ddt))\n {\n if (ddt.Year % 4 == 0 && ddt.Month == 2 && ddt.Day == 29)\n ddt = new DateTime(ddt.Year, 3, 1);\n\n if (ddt.AddYears(18) <= cd_date.AddMinutes(23 * 60 + 59))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n\n } while (GetNext(p));\n\n Console.WriteLine(\"NO\");\n }\n\n public bool GetNext(int[] p)\n {\n int n = p.Length;\n int i = n - 2;\n while (i >= 0 && p[i] >= p[i + 1])\n i--;\n if (i == -1)\n return false;\n\n int k = i + 1;\n for (int j = i + 1; j < n; j++)\n if (p[j] < p[k] && p[j] > p[i])\n k = j;\n\n int t = p[i];\n p[i] = p[k];\n p[k] = t;\n\n for (int j = 0; j < (n - i - 1) / 2; j++)\n {\n t = p[j + i + 1];\n p[j + i + 1] = p[n - j - 1];\n p[n - j - 1] = t;\n }\n\n return true;\n }\n }\n\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4937c590788ee4bd044a28105a990641", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round30\n{\n class B\n {\n public static void Run()\n {\n int[] xs = Console.ReadLine().Split('.').Select(s => int.Parse(s)).ToArray();\n int[] ys = Console.ReadLine().Split('.').Select(s => int.Parse(s)).ToArray();\n\n DateTime match = new DateTime(xs[2] + 2000, xs[1], xs[0]);\n //if (xs[1] == 2 && xs[0] == 29) { xs[1] = 3; xs[0] = 1; }\n //DateTime lower = new DateTime(xs[2] + 2000-18, xs[1], xs[0]);\n bool ok = false;\n for(int i = 0; i < 3; i++)\n for(int j = 0; j < 3; j++)\n for (int k = 0; k < 3; k++)\n {\n if (i == j || j == k || k == i) continue;\n try\n {\n DateTime birth = new DateTime(2000 + ys[i], ys[j], ys[k]);\n if (match >= birth.AddYears(18)) ok = true;\n }\n catch { }\n }\n Console.WriteLine(ok ? \"YES\" : \"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a2c96360d0d0c65498026463c56881be", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0} {"lang": "Mono C#", "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 Queue friends = new Queue();\n friends.Enqueue(\"Sheldon\");\n friends.Enqueue(\"Leonard\");\n friends.Enqueue(\"Penny\");\n friends.Enqueue(\"Rajesh\");\n friends.Enqueue(\"Howard\");\n int num = Convert.ToInt32(Console.ReadLine());\n string tmp;\n while (num > friends.Count)\n {\n tmp= friends.Dequeue();\n friends.Enqueue(tmp);\n friends.Enqueue(tmp);\n }\n int count = friends.Count;\n for (int i = friends.Count; i > 0; i--)\n {\n if (i == count-num+1)\n {\n Console.WriteLine(friends.Peek());\n break;\n }\n else\n friends.Dequeue();\n } \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e85920ffa2a27fc545424515ec577750", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problems\n{\n class _82A_DoubleCola\n {\n public static void main()\n {\n int N;\n String[] Row={\"\",\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\"};\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "54c94beffdb0b234a63dacaf481f5cb6", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problems\n{\n class _82A_DoubleCola\n {\n public static void _82A()\n {\n int N, Mult=1;\n N = Console.Read();\n N = N - 48;\n String[] Row={\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\"};\n while (N>Mult*5)\n {\n N=N-Mult*5;\n Mult=Mult*2;\n }\n Console.Write(Row[(N-1)/Mult]);\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2cf3b69a53f17b36cb0ce71b8ef47071", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Data;\n\nnamespace ConsoleApplication19\n{\n class Program\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string slprh = \"slprh\";\n\n for (int i = 1; i < n; i++)\n {\n if(slprh[0]=='s')\n {\n slprh=slprh.Remove(0, 1);\n slprh += \"ss\";\n continue;\n }\n if(slprh[0]=='l')\n {\n slprh = slprh.Remove(0, 1);\n slprh += \"ll\";\n continue;\n }\n if(slprh[0]=='p')\n {\n slprh = slprh.Remove(0, 1);\n slprh += \"pp\";\n continue;\n }\n if(slprh[0]=='r')\n {\n slprh = slprh.Remove(0, 1);\n slprh += \"rr\";\n continue;\n }\n if(slprh[0]=='h')\n {\n slprh = slprh.Remove(0, 1);\n slprh += \"hh\";\n continue;\n }\n }\n if(slprh[0]=='s')\n Console.WriteLine(\"Sheldon\");\n if(slprh[0]=='l')\n Console.WriteLine(\"Leonard\");\n if(slprh[0]=='p')\n Console.WriteLine(\"Penny\");\n if(slprh[0]=='r')\n Console.WriteLine(\"Rajesh\");\n if(slprh[0]=='h')\n Console.WriteLine(\"Howard\");\n Console.ReadLine();\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c6be1703f1e34afa9f15be9393d661e4", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n class main\n {\n public static void main(string[] args)\n {\n int N;\n String[] Row={\"\",\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\"};\n while (N>5)\n {\n N = N / 2;\n N = N - 2;\n }\n Console.Write(Row[N]);\n\n \n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b384c0c06e854dafaa36904ad4d58304", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "Mono C#", "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 Queue friends = new Queue();\n friends.Enqueue(\"Sheldon\");\n friends.Enqueue(\"Leonard\");\n friends.Enqueue(\"Penny\");\n friends.Enqueue(\"Rajesh\");\n friends.Enqueue(\"Howard\");\n int num = Convert.ToInt32(Console.ReadLine());\n string tmp;\n while (num > friends.Count)\n {\n tmp= friends.Dequeue();\n friends.Enqueue(tmp);\n friends.Enqueue(tmp);\n }\n Console.WriteLine(friends.ElementAt(num-1));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "17d446192633fca9921e7a46258984f3", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problems\n{\n class _82A_DoubleCola\n {\n public static void main(string[] args)\n {\n int N;\n String[] Row={\"\",\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\"};\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "16c5305e5d29215fcf54911f65f1fe9c", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"82A\", \"82A\\82A.csproj\", \"{CDCA034B-677B-47B0-B087-DD16BBBC6EAB}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{CDCA034B-677B-47B0-B087-DD16BBBC6EAB}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{CDCA034B-677B-47B0-B087-DD16BBBC6EAB}.Debug|x86.Build.0 = Debug|x86\n\t\t{CDCA034B-677B-47B0-B087-DD16BBBC6EAB}.Release|x86.ActiveCfg = Release|x86\n\t\t{CDCA034B-677B-47B0-B087-DD16BBBC6EAB}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9dca3cb0a6a564946759cd630c3a1e9e", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "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 raj = n % 5;\n int pen = n % 4;\n \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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eedbed6f4044f4eff8738600353db070", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "Mono C#", "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 Queue friends = new Queue();\n friends.Enqueue(\"Sheldon\");\n friends.Enqueue(\"Leonard\");\n friends.Enqueue(\"Penny\");\n friends.Enqueue(\"Rajesh\");\n friends.Enqueue(\"Howard\");\n int num = Convert.ToInt32(Console.ReadLine());\n string tmp;\n while (num > friends.Count)\n {\n tmp= friends.Dequeue();\n friends.Enqueue(tmp);\n friends.Enqueue(tmp);\n }\n Console.WriteLine(friends.ElementAt(num));\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "94505a89593105c56dcbd656b8b5e2bb", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "36d9b55e0b1d795b97a95bcb944c2ecb", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "Mono C#", "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 k = (n+5)%5;\n string s;\n switch(k)\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "777de84d9b1283a474d901f0b918895b", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problems\n{\n class Program\n {\n public static void main(String[] args)\n { \n String[] Row={\"Row\",\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\"};\n Int64 N = Convert.ToInt64(Console.ReadLine());\n while (N>5)\n {\n N = N / 2;\n N = N - 2;\n Console.Write(N+\"\\n\");\n }\n\n Console.Write(Row[N]);\n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5b0fa5d7d657e2c9286b3bb5e567b039", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "Mono C#", "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 k = (n+5)%5;\n string s = \"\"\n switch(k);\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "df545ce3a5f4e0ef771e3c46423d3105", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Problem{\n static void Main(string[] args){\n \n int n = int.Parse(Console.ReadLine());\n string[] names = 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e6f74326f15ca3dc21aabc958bfcf458", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "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 int bigi = 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "93cdd4ebf5bd4343e13730409b2cebb1", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problems\n{\n class Program\n {\n static void main(string[] args)\n {\n int N;\n String[] Row={\"\",\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\"};\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "28583a96457c1c58052d5f5fed30a20d", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "53b4550836a638f49f24967f4075c55a", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27130.2036\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"940B\", \"940B\\940B.csproj\", \"{BE49AD0A-B17E-44CC-8D42-7C169F53497A}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{BE49AD0A-B17E-44CC-8D42-7C169F53497A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{BE49AD0A-B17E-44CC-8D42-7C169F53497A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{BE49AD0A-B17E-44CC-8D42-7C169F53497A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{BE49AD0A-B17E-44CC-8D42-7C169F53497A}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {D05BB9A2-07A3-492B-9CCD-0D832B64E629}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f0b33c14651cbb1474bafac25d5e0867", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "difficulty": 1400.0} {"lang": "MS C#", "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 char[] c = new char[2] { '=', '+'};\n string t = Console.ReadLine();\n string[] s = t.Split(c);\n if (s[0].Length+s[1].Length == s[2].Length)\n {\n Console.WriteLine(t);\n }\n else\n {\n if (s[0].Length+s[1].Length == s[2].Length - 2)\n {\n string r = s[0];\n r += '+';\n r += '|';\n r += s[1];\n r += '=';\n for (int i = 0; i < s[2].Length - 1)\n {\n r += '|';\n }\n Console.WriteLine(r);\n }\n else\n {\n if (s[0].Length+s[1].Length == s[2].Length + 2)\n {\n string r = s[0];\n r += '+';\n for (int i = 0; i < s[1].Length - 1)\n {\n r += '|';\n }\n r += '=';\n r += s[2];\n Console.WriteLine(r);\n }\n else\n \n {\n Console.WriteLine(\"Impossible\");\n }\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "affcda01a5275efde9d2ef0d9df9c930", "src_uid": "ee0aaa7acf127e9f3a9edafc58f4e2d6", "difficulty": null} {"lang": "Mono C#", "source_code": " static void Main(string[] args)\n {\n string exp;\n exp=Console.ReadLine();\n int i,a=0,b=0,c=0;\n string A = \"\", B = \"\", C = \"\";\n for (i = 0; i < exp.Length; i++)\n {\n if(i < exp.IndexOf('+'))\n {\n a++;\n A += exp[i]; \n }\n \n if(i > exp.IndexOf('+') && i val[2] || val[1] + val[2] > val[3]) Console.WriteLine(\"TRIANGLE\");\n else if (val[0] + val[1] < val[2] && val[1] + val[2] < val[3]) Console.WriteLine(\"IMPOSSIBLE\");\n else Console.WriteLine(\"SEGMENT\"); \n }\n\n private static IEnumerable ReadInts() => Console.ReadLine().Split(' ').Select(int.Parse); \n private static int ReadInt() => int.Parse(Console.ReadLine());\n private static void Print(this IEnumerable items, char separator) => Console.WriteLine(String.Join(separator, items)); \n \n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return base.TryGetValue(key, out var value) ? value : default(TValue); }\n set { base[key] = value; }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "897a5cc4108543944b2dc7ecb2e51871", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _006\n{\n public class TestRunner\n {\n const int ProblemNumber = 1;\n\n const string InputPath = @\"InputOutput\\{0}_in.txt\";\n const string OutputPath = @\"InputOutput\\{0}_out.txt\";\n\n private List inputs = new List();\n private List outputs = new List();\n\n void ParseFile(string path, List dest)\n {\n string[] lines = File.ReadAllLines(path);\n StringBuilder sb = new StringBuilder();\n\n foreach(var line in lines)\n {\n if (string.IsNullOrWhiteSpace(line))\n {\n if (sb.Length > 0)\n {\n dest.Add(sb.ToString());\n sb.Clear();\n }\n }\n else\n sb.AppendLine(line);\n \n }\n\n if (sb.Length > 0)\n {\n dest.Add(sb.ToString());\n sb.Clear();\n }\n }\n\n public TestRunner()\n {\n\n ParseFile(string.Format(InputPath, ProblemNumber), inputs);\n ParseFile(string.Format(OutputPath, ProblemNumber), outputs);\n\n Debug.Assert(inputs.Count == outputs.Count);\n }\n \n public bool Run(Ex1 ex)\n {\n ConsoleColor originalColor = Console.ForegroundColor;\n bool success = true;\n\n foreach (var pair in inputs.Zip(outputs, (a,b) => new Tuple(a,b)))\n {\n StringBuilder output = new StringBuilder();\n var inText = new StringReader(pair.Item1);\n var outText = new StringWriter(output);\n \n ex.Run(inText, outText);\n\n Console.WriteLine(\"=====================================\");\n Console.WriteLine(\"Input:\");\n Console.WriteLine(pair.Item1);\n\n Console.WriteLine(\"Output:\");\n Console.WriteLine(output.ToString());\n\n if (0 == string.Compare(pair.Item2, output.ToString()))\n {\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine(\"MATCH!\");\n }\n else\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(\"NO MATCH!\");\n\n Console.ForegroundColor = ConsoleColor.Yellow;\n Console.WriteLine(\"Expected:\");\n Console.WriteLine(pair.Item2);\n \n success = false;\n }\n\n Console.ForegroundColor = originalColor;\n Console.WriteLine(\"*************************************\");\n Console.WriteLine();\n }\n\n return success;\n }\n }\n public class Ex1\n {\n public void Run(TextReader input, TextWriter output)\n {\n string numbers = input.ReadLine();\n int[] lengths = numbers.Split(' ').Select(int.Parse).ToArray();\n Array.Sort(lengths);\n\n int[][] permutations = new int[][] \n { \n new[]{ 1, 2, 3 }, \n new[]{ 1, 2, 4 },\n new[]{ 2, 3, 4 },\n new[]{ 1, 3, 4 }\n };\n\n bool hasSegment = false;\n foreach (var perm in permutations)\n {\n if (lengths[perm[2]-1] < lengths[perm[0]-1] + lengths[perm[1]-1])\n {\n output.WriteLine(\"TRIANGLE\");\n return;\n }\n\n if (lengths[perm[2]-1] == lengths[perm[0]-1] + lengths[perm[1]-1])\n {\n hasSegment = true;\n }\n }\n\n if (hasSegment)\n output.WriteLine(\"SEGMENT\");\n else\n output.WriteLine(\"IMPOSSIBLE\");\n }\n\n\n static void Main(string[] args)\n {\n var ex = new Ex1();\n\n\n#if(ONLINE_JUDGE)\n var inText = new StreamReader(Console.In);\n var outText = new StreamWriter(Console.Out);\n \n ex.Run(inText, outText);\n#else\n TestRunner runner = new TestRunner();\n runner.Run(ex);\n#endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "62e7b8d97db60fc344cfbf5a23fb15d0", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass P {\n static bool Check(int[] a, Func f) {\n return f(a[0],a[1],a[2]) ||\n f(a[0],a[1],a[3]) ||\n f(a[0],a[2],a[3]) ||\n f(a[1],a[2],a[3]);\n }\n \n static void Main() {\n var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Array.Sort(a);\n if (Check(a, (b,c,d) => b-c>d)) { Console.WriteLine(\"TRIANGLE\"); }\n else if (Check(a, (b,c,d) => b == c+d) Console.Write(\"SEGMENT\");\n else Console.Write(\"IMPOSSIBLE\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f8e3f3c6a19c837876de63993ef771bc", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass P {\n static void Main() {\n var a = Console.ReadLine().Split().Select(int.Parse).ToList();\n Array.Sort(a);\n var b = a[0] + a[1];\n var c = a[1] + a[2];\n if (b > a[2] || c > a[3]) {\n Console.WriteLine(\"TRIANGLE\");\n } else if (b == a[2] || c == a[3]) {\n Console.WriteLine(\"SEGMENT\");\n } else {\n Console.WriteLine(\"IMPOSSIBLE\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4e49f0e54743b9de9bae1d3f1b7409d1", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "sing System;\n\nnamespace helloworld\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 n = int.Parse(line1[0]);\n var k = int.Parse(line1[1]);\n int count = 0;\n if(n%2==0)\n {\n for(int i=0; i< (n-1)/2; i++)\n {\n if(int.Parse(line2[i])<=k && int.Parse(line2[n-1-i])<=k)\n {\n count+=2;\n }\n else if(int.Parse(line2[i])<=k || int.Parse(line2[n-1-i])<=k)\n {\n count+=1;\n }\n else\n {\n break;\n }\n }\n }\n else\n {\n for(int i=0; i<= (n-1)/2; i++)\n {\n if(i!=(n-1)/2)\n {\n if(int.Parse(line2[i])<=k && int.Parse(line2[n-1-i])<=k)\n {\n count+=2;\n }\n else if(int.Parse(line2[i])<=k || int.Parse(line2[n-1-i])<=k)\n {\n count+=1;\n }\n else\n {\n break;\n }\n }\n else\n {\n if(int.Parse(line2[i])<=k)\n {\n count+=1;\n }\n }\n }\n }\n Console.WriteLine(count);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65fb13d26d070cdc28e32aae56f24caf", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "Mono C#", "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.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 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.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].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 static Dictionary> memo = new Dictionary>();\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 key = CreateKey(from, to, d);\n if (memo.ContainsKey(key))\n {\n return memo[key];\n }\n\n var res = new List<(int, int, int)>();\n\n var prev = g[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((prev, to, d));\n }\n\n if (prev != from)\n {\n res.AddRange(Pour(g, a, b, from, prev, d));\n }\n\n return memo[key] = res;\n }\n\n private static int CreateKey(int from, int to, int d)\n {\n return (d * 300 + to) * 300 + from;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d39f60b39df2e7380680cb6b018bc6da", "src_uid": "0939354d9bad8301efb79a1a934ded30", "difficulty": 2500.0} {"lang": "Mono C#", "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.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 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.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].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 static Dictionary > memo = new Dictionary >();\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 key = CreateKey(from, to, d);\n if (memo.ContainsKey(key))\n {\n return memo[key];\n }\n\n var res = new List<(int, int, int)>();\n\n var prev = g[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((prev, to, d));\n }\n\n if (prev != from)\n {\n res.AddRange(Pour(g, a, b, from, prev, d));\n }\n\n return memo[key] = res;\n }\n\n private static int CreateKey(int from, int to, int d)\n {\n return (d * 300 + to) * 300 + from;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "449681417d6b165ad5f0648f5727f097", "src_uid": "0939354d9bad8301efb79a1a934ded30", "difficulty": 2500.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\n\nnamespace CF_R257\n{\n public class Task_B\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"b_input.txt\"));\n#endif\n new Task_B().Solve();\n }\n\n static long mod = 1000000007;\n\n private void Solve()\n {\n var parts = Console.ReadLine().Split();\n var x = long.Parse(parts[0]);\n var y = long.Parse(parts[1]);\n var n = long.Parse(Console.ReadLine());\n n = (n - 1) % 6;\n\n switch (n)\n {\n case 0:\n PrintSolution(x);\n break;\n case 1:\n PrintSolution(y);\n break;\n case 2:\n PrintSolution(y - x);\n break;\n case 3:\n PrintSolution(-x);\n break;\n case 4:\n PrintSolution(-y);\n break;\n case 5:\n PrintSolution(x - y);\n break;\n }\n }\n\n private void PrintSolution(long value)\n {\n while (value < 0)\n value += mod;\n Console.WriteLine((x - y) % mod);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eb223d51de246ff1abe4606d689e52a4", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "namespace Jzzhu\n{\n class Program\n {\n static void Main(string[] args)\n {\n JzzhuSequence jzzhu = new JzzhuSequence();\n\n string text = Console.ReadLine();\n\n int x = int.Parse(text.Split(' ')[0]);\n int y = int.Parse(text.Split(' ')[1]);\n\n text = Console.ReadLine();\n int n = int.Parse(text);\n\n Console.Write(jzzhu.Module(jzzhu.Calculate(x, y, n), 1000000007));\n }\n }\n\n class JzzhuSequence\n {\n\n public int Calculate(int x, int y, int n)\n {\n if (n == 1)\n {\n return x;\n }\n else if (n == 2)\n {\n return y;\n }\n else\n {\n double rad = (n / 3) * Math.PI;\n\n double res = (x - y) * Math.Cos(rad) + (x + y) * Math.Sqrt(3) * Math.Sin(rad);\n\n return (int)res;\n\n //int i = Calculate(x, y, n - 1) - Calculate(x, y, n - 2);\n //return i;\n }\n }\n\n public int Module(int dividend, int divisor)\n {\n int remainder = 0;\n\n if(dividend < 0)\n {\n remainder = divisor + dividend;\n }\n else\n {\n remainder = dividend % divisor;\n }\n\n return remainder;\n }\n }\n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0aed77782de20cc77407951060e99cc", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace CodeForces {\n public class Round157ProblemA {\n public const int INPUT_SIZE = 8;\n public const string RESULT_YES = \"YES\";\n public const string RESULT_NO = \"NO\";\n public const char CHAR_BLACK = 'B';\n public const char CHAR_WHITE = 'W';\n\n public string[] GetInput() {\n string[] input = new string[INPUT_SIZE];\n int i = 0;\n while (i < INPUT_SIZE) {\n string str = Console.ReadLine();\n input[i++] = str;\n }\n\n return input;\n }\n\n public bool GetOutput(string[] input) {\n foreach (string s in input) {\n if (!IsValidRow(s)) {\n return false;\n }\n }\n\n return true;\n }\n\n private bool IsValidRow(string s) {\n if (s.Length == INPUT_SIZE) {\n char first = s[0];\n char second = s[1];\n if (first == second || (first != CHAR_WHITE && first != CHAR_BLACK) || (second != CHAR_BLACK && second != CHAR_WHITE)) {\n return false;\n }\n\n for (int i = 2; i < INPUT_SIZE; i = i + 2) {\n if (s[i] != first || s[i + 1] != second) {\n return false;\n }\n }\n\n return true;\n }\n else {\n return false;\n }\n }\n\n public void PrintOutput(bool result) {\n Console.WriteLine(result ? RESULT_YES : RESULT_NO);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "13f505890303e817dd08f15eb9744b4a", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "Busing 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6d5cc2fcea74c5ac93eb9b2014cfef05", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var shapeCount = uint.Parse(Console.ReadLine());\n var shapes = Console.ReadLine()?.Split(' ', StringSplitOptions.RemoveEmptyEntries).Select(byte.Parse).ToArray();\n int sum = 0;\n for (int i = 0; i < shapeCount - 1; i++)\n {\n switch (shapes[i])\n {\n case 1://\u0435\u0441\u043b\u0438 \u0432 \u043a\u0440\u0443\u0433 \u0432\u043f\u0438\u0441\u0430\u043d...\n switch (shapes[i+1])\n {\n case 1://...\u043a\u0440\u0443\u0433\n Console.WriteLine(\"Infinite\");\n return;\n case 2://...\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\n sum += 3;\n break;\n case 3://...\u043a\u0432\u0430\u0434\u0440\u0430\u0442\n sum += 4;\n break;\n } break;\n case 2://\u0435\u0441\u043b\u0438 \u0432 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432\u043f\u0438\u0441\u0430\u043d...\n switch (shapes[i+1])\n {\n case 1://...\u043a\u0440\u0443\u0433\n sum += 3;\n break;\n case 2://...\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\n Console.WriteLine(\"Infinite\");\n return;\n case 3://...\u043a\u0432\u0430\u0434\u0440\u0430\u0442\n Console.WriteLine(\"Infinite\");\n return;\n } break;\n case 3://\u0435\u0441\u043b\u0438 \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0432\u043f\u0438\u0441\u0430\u043d...\n switch (shapes[i+1])\n {\n case 1://...\u043a\u0440\u0443\u0433\n sum += 4;\n break;\n case 2://...\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\n Console.WriteLine(\"Infinite\");\n return;\n case 3://...\u043a\u0432\u0430\u0434\u0440\u0430\u0442\n Console.WriteLine(\"Infinite\");\n return;\n } break;\n }\n }\n \n Console.WriteLine(\"Finite\");\n Console.WriteLine(sum);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ad690f760ea16751f2ef4137e0ec484a", "src_uid": "6c8f028f655cc77b05ed89a668273702", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s=\"\";\n for (int i = 1; i < 371; i++)\n {\n s = s + i.ToString();\n }\n int a=int.Parse( Console.ReadLine());\n // Console.WriteLine(s.Length);\n \n Console.Write(s[a-1]);\n Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "491d4cadde53ea86e574830920f3f612", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.31101.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication13\", \"ConsoleApplication13.csproj\", \"{BCD7D129-A105-4CD3-ADAA-14752306F504}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{BCD7D129-A105-4CD3-ADAA-14752306F504}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{BCD7D129-A105-4CD3-ADAA-14752306F504}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{BCD7D129-A105-4CD3-ADAA-14752306F504}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{BCD7D129-A105-4CD3-ADAA-14752306F504}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0ee9c97a739dd862e1ae426f0ffbad87", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "/* Date: 12.05.2016 * Time: 22:45 */\n\n\n*/\n\nusing System;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tint n = int.Parse (Console.ReadLine ());\n/*\n * \t\tif ( n < 10 )\n\t\t\tConsole.WriteLine (n);\n\t\telse if ( n < 190 )\n\t\t{\n\t\t\tn -= 9;\n\t\t\tif ( n % 2 == 0 )\n\t\t\t\tn = (n % 20) / 2 - 1;\n\t\t\telse\n\t\t\t\tn = n / 20 + 1;\n\t\t\tConsole.WriteLine (n);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tn -= 99;\n\t\t\tif ( n % 3 == 0 )\n\t\t\t\tn = (n / 300) + 1;\n\t\t\telse if ( n % 3 == 1 )\n\t\t\t\tn = (n % 300) % 30 - 1;\n\t\t\telse\n\t\t\t\tn = (n % 30 + 1) / 3;\n\t\t}\n*/\n\t\tint [] d = new int [4000];\n\t\tint k = 0;\n\t\tfor ( int i=1; i < 10; i++, k++ )\n\t\t\td [i] = i;\n\t\tfor ( int i=10; i < 100; i++, k+=2 )\n\t\t{\n\t\t\td [k] = i / 10;\n\t\t\td [k+1] = i % 10;\n\t\t}\n\t\tfor ( int i=100; i < 1000; i++, k+=3 )\n\t\t{\n\t\t\td [k] = i / 100;\n\t\t\td [k+1] = (i / 10) % 10;\n\t\t\td [k+2] = i % 10;\n\t\t}\n\t\tConsole.WriteLine (d [n]);\n//\t\tConsole.ReadKey ();\n\t}\n}\n/*\n\tpublic static void Main(string[] args)\n\t{\n# if ( ONLINE_JUDGE )\n\n# else\n\t\tStreamReader sr= new StreamReader (\"B.txt\");\n\t\tStreamWriter sw = new StreamWriter (\"B.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# endif\n\n\t\tint n = int.Parse (ss);\n\n\n\n\n\n\n\t\t\n\t\tfor ( int i=0; i < n; i++ )\n# if ( ONLINE_JUDGE )\n\t\t\tConsole.WriteLine (e [i] + \" \");\n# else\n\t\t\tsw.WriteLine (e [i] + \" \");\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\n\t\tConsole.Write(\"Press any key to continue . . . \");\n\t\tConsole.ReadKey(true);\n\t}\n*/\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b114b9d55ddfbbf5e231d1ba060bf84", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Algorithms\n{\n class Program\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\t\t\tConsole.WriteLine(result);\n \n }\n\n private static int SashasTrip(int numberOfCities, int tankCapacity)\n {\n if (numberOfCities - 1 == tankCapacity)\n return tankCapacity;\n\n int totalAmount = 0;\n int cityIndex = 2;\n\n totalAmount += tankCapacity;\n\n while (numberOfCities - 1 != tankCapacity)\n {\n totalAmount += cityIndex;\n\n numberOfCities--;\n cityIndex++;\n }\n\n return totalAmount;\n }\n if (numberOfCities - 1 == tankCapacity)\n return tankCapacity;\n\n var totalLitresNeeded = numberOfCities - 1;\n\n int totalAmount = 0;\n\n int cityIndex = 1;\n while (totalLitresNeeded != 0)\n {\n if (totalLitresNeeded > 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "defff4eaf735bbb558780417d3776b57", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Security.Cryptography;\nusing System.IO;\n\nnamespace kursach\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = int.Parse(Console.ReadLine());\n int[] arr = new int[n];\n string[] n = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n arr[i] = int.Parse(n[i]);\n }\n Array.Sort(arr);\n bool ans1 = false;\n bool ans2 = false;\n int d = arr[n - 1] - arr[0];\n int a = (arr[0] + arr[n - 1]) / 2;\n int c = arr[n - 1] - a;\n for (int i = 0; i < n; i++)\n {\n if (arr[i] + d == arr[n - 1] || arr[i] == arr[n - 1])\n {\n ans1 = true;\n }\n else\n {\n ans1 = false;\n break;\n }\n }\n for (int i = 0; i < n; i++)\n {\n if (arr[i] + c == a || arr[i] == a || arr[i] - c == a)\n {\n ans2 = true;\n }\n else\n {\n ans2 = false;\n break;\n }\n }\n if (ans2 == true)\n {\n Console.WriteLine(c);\n }\n else\n {\n if (ans1 == true)\n {\n Console.WriteLine(d);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "67680287c1ccc6948ea093e40f75bdb5", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Security.Cryptography;\nusing System.IO;\n\nnamespace kursach\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = int.Parse(Console.ReadLine());\n int[] arr = new int[n];\n string[] s= Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n arr[i] = int.Parse(s[i]);\n }\n Array.Sort(arr);\n bool ans1 = false;\n bool ans2 = false;\n int d = arr[n - 1] - arr[0];\n int a = (arr[0] + arr[n - 1]) / 2;\n int c = arr[n - 1] - a;\n for (int i = 0; i < n; i++)\n {\n if (arr[i] + d == arr[n - 1] || arr[i] == arr[n - 1])\n {\n ans1 = true;\n }\n else\n {\n ans1 = false;\n break;\n }\n }\n for (int i = 0; i < n; i++)\n {\n if (arr[i] + c == a || arr[i] == a || arr[i] - c == a)\n {\n ans2 = true;\n }\n else\n {\n ans2 = false;\n break;\n }\n }\n if (ans2 == true)\n {\n Console.WriteLine(c);\n }\n else\n {\n if (ans1 == true)\n {\n Console.WriteLine(d);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7e5572193478672f55f594e0759cc395", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0} {"lang": "Mono C#", "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((float)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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e976d826d2003602359592ddc3a4fdfc", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d8bf48285c2ce688b2bcfd261351c986", "src_uid": "c702e07fed684b7741d8337aafa005fb", "difficulty": 1300.0} {"lang": "Mono C#", "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);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd6aca1114b3c9310cbfe1f4105d77ad", "src_uid": "c702e07fed684b7741d8337aafa005fb", "difficulty": 1300.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d81745b80ea5e2bace5887919a7a864f", "src_uid": "c702e07fed684b7741d8337aafa005fb", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeff", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65386308ad2a80c9e2ee80d9e01283f7", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class Program\n{\n static void Main()\n {\n List answer = Console.ReadLine().Split('+').ToList();\n answer.Sort();\n Console.WriteLine(string.Join('+', answer));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3079eecce61e476246c0025fe1724b63", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n int a = 0, b = 0, c = 0;\n for (int y = 0; y < x.Length; y++)\n {\n switch (x[y].ToString())\n {\n case \"1\":\n a++;\n break;\n case \"2\":\n b++;\n break;\n case \"3\":\n c++;\n break;\n }\n }\n int h=a;\n while (a > 0)\n {\n if (a == h)\n {\n Console.Write(\"1\");\n a--;\n }\n else\n {\n Console.Write(\"+1\");\n a--;\n }\n \n }\n int j = b;\n int m = h;\n while (b > 0)\n {\n if (h == 0)\n {\n Console.Write(\"2\");\n b--;\n h++; \n }\n else\n {\n Console.Write(\"+2\");\n b--;\n }\n }\n while (c > 0)\n {\n if (m == 0 && j == 0)\n {\n Console.Write(\"3\");\n c--;\n m++;\n j++;\n }\n else\n {\n Console.Write(\"+3\");\n c--;\n }\n }\n }\n\n public static string Sorte { get; set; }\n }\n}\n\nv", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f403cbcd0bc78263e466495ae9f7c9ec", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace simplemaths\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int i;\n int[] i = Array.ConvertAll(Console.ReadLine().Split('+'),int.Parse);\n Array.Sort(i);\n Console.WriteLine(string.Join(\"+\", i));\n \n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dc16c97d6fd3d7b6c1ea0c5075f827c4", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_Eevee\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] x = Console.ReadLine().Split('+').Select(int.Parse).ToArray();\n Array.Sort(x);\n for (int i = 0; i < x.Length; i++)\n {\n if (i == x.Length - 1)\n {\n Console.Write(x[i]);\n Continue;\n }\n\n if (x.Length == 1)\n {\n Console.Write(x[0]);\n }\n \n else\n {\n Console.Write(x[i] + \"+\" );\n }\n }\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a2ec91e73c71c2701322133daa85bb06", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n internal class Program\n {\n private static void Main(string[] args)\n {\n var a = Console.ReadLine().Split('+').Select(Int32.Parse).ToArray();\n Array.Sort(a);\n Console.WriteLine(String.Join('+', a));\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "10675b6e8f7e643b7618b4c922051c3d", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Helpful Math\", \"Helpful Math\\Helpful Math.csproj\", \"{AE005560-76C1-41CB-89F0-EF2D9FAB5FFD}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{AE005560-76C1-41CB-89F0-EF2D9FAB5FFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{AE005560-76C1-41CB-89F0-EF2D9FAB5FFD}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{AE005560-76C1-41CB-89F0-EF2D9FAB5FFD}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{AE005560-76C1-41CB-89F0-EF2D9FAB5FFD}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "06922efab1dfc8bd7d1a58251a28260f", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml.Linq;\n\nnamespace HelpfulMath\n{\n class Program\n {\n static void Main(string[] args)\n {\n string exprStr = Console.ReadLine();\n string[] numbersStr = exprStr.Split('+');\n\n int[] numbers = new int [numbersStr.Length];\n\n for (int i =0; i numbers[j + 1])\n {\n int temp = numbers[j + 1];\n numbers[j + 1] = numbers[j];\n numbers[j] = temp;\n }\n }\n \n }\n\n exprStr = \"\";\n for (int i = 0; i < numbersStr.Length; i++)\n {\n exprStr += numbers[i].ToString();\n\n if (i!= numbersStr.Length-1)\n {\n exprStr += \"+\";\n }\n }\n\n Console.WriteLine(exprStr);\n }\n \n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fdb0a1f754e64009dffb07f4e72d2cfc", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Sample\n{\n static void Main()\n {\n var[] str=Console.ReadLine().Split('+');\n Array.Sort(str);\n Console.WriteLine(string.Join(\"+\",str));\n \n \n }\n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65ede6ac8917a58450654a3e4c1f46cd", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace HelpfulMaths\n{\n class Program\n {\n static void Main(string[] args)\n {\n string starterEquation = Console.ReadLine();\n string[] splitEquation = starterEquation.Split(\"+\");\n Array.Sort(splitEquation);\n string sortedEquation = string.Join(\"+\", splitEquation);\n Console.WriteLine(sortedEquation);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "79758d0dc20b75aa1553845610c37ba1", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n\n \n Exe\n netcoreapp2.1\n \n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f1337a2e255579168ce6341bafc23964", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass A\n{\n static void Main()\n {\n var nums = Console.ReadLine().Split(\"+\").Select(x => int.Parse(x)).ToList();\n nums.Sort();\n int n = nums.Count();\n Console.Write(nums[0]);\n for(int i = 1; i < n; ++i)\n {\n Console.Write($\"+{nums[i]}\");\n }\n\n\n\n\n\n\n //Console.ReadLine();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c48a4431507d5aa47563cfbc09e11743", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Runtime.CompilerServices;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n int helper = 0;\n\n int[] tab = Array.ConvertAll(input.Split(\"+\"), int.Parse);\n \n for (int i = 0; i < tab.Length; i++)\n {\n \n for (int j = 0; j < tab.Length-1; j++)\n {\n \n if (tab[j] > tab[j+1])\n {\n helper = tab[j];\n tab[j] = tab[j+1];\n tab[j+1] = helper;\n }\n }\n\n }\n for (int i = 0; i < tab.Length-1; i++)\n {\n Console.Write(tab[i] + \"+\");\n }\n Console.Write(tab[tab.Length-1]);\n\n }\n \n\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "585fef78f125a6a057a05b5c13b0720d", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections; \n \npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\t// your code goes here\n\t\tstring s=Console.ReadLine();\n\t\tArrayList arr = new ArrayList();\n\t\tint x=0;\n\t\tfor(int i=0;i 1)\n {\n string[] nums = s.Split('+');\n SolveProblem(nums);\n\n\n }\n else\n {\n Console.WriteLine(s);\n }\n Console.ReadLine();\n }\n\n static void SolveProblem(string [] nums)\n {\n ArrayList arr = new ArrayList ();\n arr.AddRange(nums);\n arr.Sort();\n nums = arr.ToArray(typeof (string)) as string [];\n Console.WriteLine(string.Join(\"+\", nums));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5716f2ef77df585c5636e4f1b85dc628", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n \n List input = Console.ReadLine().Split(\"+\").Select(int.Parse).ToList();\n\n input.Sort();\n\n Console.WriteLine(string.Join(\"+\", input));\n }\n private static List ReadInputParseToList()\n {\n return Console.ReadLine().ToLower().Split().ToList();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5d1bf8bf705e80b5eb44aa65b5e3fec0", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split('+');\n int[] numbers = Array.ConvertAll(inp, int.Parse);\n Array.Sort(numbers);\n if (numbers.Length < 2)\n {\n Console.WriteLine(numbers[numbers.Length - 1]);\n }\n else\n {\n numbers.ToString();\n Console.WriteLine(String.Join(\"+\", numbers));\n a\n }\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c520ea4c737dabb759d0bbc5a14250a9", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "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{\n static Dictionary d = new Dictionary();\n // Complete the climbingLeaderboard function below.\n static Queue qe = new Queue();\n\n static string solution(List a)\n {\n a.Sort();\n var r = \"\";\n foreach (var e in a)\n r += e + \"+\";\n return r.Substring(0, r.Length - 1);\n }\n\n static void Main(string[] args)\n {\n //var number = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var ints = Console.ReadLine().Split(\"+\").Select(int.Parse).ToList();\n //var rd = Console.ReadLine();\n Console.WriteLine(solution(ints));\n Console.ReadLine();\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d0346ad4c544a5200fa712dc7883605d", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml.Linq;\n\nnamespace HelpfulMath\n{\n class Program\n {\n static void Main(string[] args)\n {\n string exprStr = Console.ReadLine();\n string[] numbersStr = exprStr.Split('+');\n\n int[] numbers = new int [numbersStr.Length];\n\n for (int i =0; i numbers[j + 1])\n {\n int temp = numbers[j + 1];\n numbers[j + 1] = numbers[j];\n numbers[j] = temp;\n }\n }\n \n }\n\n exprStr = \"\";\n for (int i = 0; i < numbersStr.Length; i++)\n {\n exprStr += numbers[i].ToString();\n\n if (i!= numbersStr.Length-1)\n {\n exprStr += \"+\";\n }\n }\n\n Console.WriteLine(exprStr);\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "acb956372831f2af433a432428b61757", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\tstring[] Aray1 = Console.ReadLine().Split('+');\n\t\t\tArray.Sort(Aray1);\n\t Console.WriteLine(string.Join(\"+\", Aray1));", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2812848b08d2a95b850619cd0a5c200f", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " class Program\n {\n\n static void Main(string[] args)\n {\n\n string S=Console.ReadLine();\n \n string[] arr = S.Split('+');\n Array.Sort(arr);\n S = \"\";\n foreach (var a in arr)\n {\n S += a + \"+\";\n }\n\n S=S.Substring(0, (S.Length - 1));\n Console.WriteLine(S);\n Console.ReadKey();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1e1729ba9918eb03037e26bc0e308b69", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\nnamespace CP\n{\n class Program\n {\n static void Main(string[] args)\n {\n int [] arr = Array.ConvertAll(Console.ReadLine().Split('+') , temp => Convert.ToInt32(temp));\n Array.Sort(arr);\n string s2 = String.Join('+' , arr);\n Console.WriteLine(s2);\n\n }\n\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "421403f641fa4dccf781662586ae0e60", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "MS C#", "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 Console.Write(Console.ReadLine().Split('+').Select(int.Parse).OrderBy(o => o).Aggregate((a, b) => a + \"+\" + b));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b27226d4752cccd2f5f085e1de617c9d", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass MainClass {\n public static void Main (string[] args) {\n string s = \"1+1+3+1+3\";\n string[] sArr = s.Split('+');\n for(int i = 0; i < sArr.Length - 1; i++){\n for(int j = i+ 1; j < sArr.Length; j++){\n if(Int16.Parse(sArr[i]) > Int16.Parse(sArr[j])){\n string temp = sArr[i];\n sArr[i] = sArr[j];\n sArr[j] = temp;\n } \n }\n }\n\n s = String.Join('+' , sArr);\n\n Console.WriteLine(s);\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d8677a90b98fbb02e9e4e49935924cc9", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace HelpfulMaths\n{\n class Program\n {\n static void Main(string[] args)\n {\n string starterEquation = Console.ReadLine();\n string[] splitEquation = starterEquation.Split('+');\n Array.Sort(splitEquation);\n string sortedEquation = string.Join('+', splitEquation);\n Console.WriteLine(sortedEquation);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7cd04f1c8e4e44204c783fcba5a59e8e", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n int a = 0, b = 0, c = 0;\n for (int y = 0; y < x.Length; y++)\n {\n switch (x[y].ToString())\n {\n case \"1\":\n a++;\n break;\n case\"2\":\n b++;\n break;\n case\"3\":\n c++;\n break;\n }\n }\n while (a > 0)\n {\n Console.Write(\"+1\");\n a--;\n }\n while (b > 0)\n {\n Console.Write(\"+2\");\n b--;\n }\n while (c > 0)\n {\n Console.Write(\"+3\");\n c--;\n }\n }\n }\n \n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "693adc8290c6f54c6ac0ec237bf5e44b", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace Codeforces\n{\n using System;\n using System.Data;\n using System.Linq;\n using System.Text;\n\n class Problem339A {\n\n private static string GetSumExpression(IOrderedEnumerable summands) {\n var sb = new StringBuilder();\n foreach (var summand in summands) {\n sb.Append(summand);\n sb.Append('+');\n }\n return sb.ToString().Trim('+');\n }\n\n private static string GetOrderedSumExpression(string sumExpression) {\n var summands = sumExpression.Split('+');\n var orderedSummands = summands.OrderBy(s => s);\n return GetSumExpression(orderedSummands);\n }\n\n static void Main() {\n string sumExpression = Console.In.ReadLine();\n Console.Out.WriteLine(GetOrderedSumExpression(sumExpression));\n Console.In.ReadLine();\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ade355512b85fdb3f27a40cfcc270444", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Sample\n{\n static void Main()\n {\n var[] str=Console.ReadLine().Split();\n Array.Sort(str);\n Console.WriteLine(string.Join('+',str));\n \n \n }\n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4c22935e637eb7edfcc0009fa7dfc389", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Linq;\nusing System.Text;\n\nnamespace HelpfulMaths\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n List numbersList = input.Split('+').Select(x => int.Parse(x)).ToList();\n var sortednumber = numbersList.OrderBy(x => x);\n \n StringBuilder stringBuilder = new StringBuilder();\n foreach (var i in sortednumber)\n {\n stringBuilder.Append(i);\n stringBuilder.Append(\"+\");\n }\n\n stringBuilder.Remove(stringBuilder.Length - 1, 1);\n Console.WriteLine(stringBuilder);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "de7dd811e9bcc3fa5119c9d5d157ed3c", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n \n List input = Console.ReadLine().Split(\"+\").Select(int.Parse).ToList();\n\n input.Sort();\n\n Console.WriteLine(string.Join(\"+\", input));\n Console.ReadLine();\n }\n private static List ReadInputParseToList()\n {\n return Console.ReadLine().ToLower().Split().ToList();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "acd80f299e59a57023c627b9331e8836", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\nnamespace CP\n{\n class Program\n {\n static void Main(string[] args)\n {\n int [] arr = Array.ConvertAll(Console.ReadLine().Split('+') , temp => Convert.ToInt32(temp));\n Array.Sort(arr);\n Console.WriteLine(String.Join('+',arr));\n\n }\n\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "845e5f0aa4279fac24b8060520a085e0", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n try\n {\n int[] numbers = Console.ReadLine().Split('+', StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n string outLine = SortArithmeticSentece(numbers);\n Console.WriteLine(outLine);\n }\n catch(Exception ex)\n {\n Console.WriteLine(ex.Message);\n }\n Console.ReadLine();\n }\n\n private static string SortArithmeticSentece(int[] numbers)\n {\n Array.Sort(numbers);\n string outStr = String.Empty;\n for(int i = 0; i < numbers.Length; i++)\n {\n if(i == numbers.Length - 1)\n {\n outStr += numbers[i];\n break;\n }\n else\n {\n outStr += numbers[i] + \"+\";\n }\n }\n return outStr;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c4c4621c7f80c4427bfa2521b35be863", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n char[] st = new char[s.Length/2+1];\n int j = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != '+') { st[j] = Convert.ToChar(s[i]); j++; }\n }\n Array.Sort(st);\n foreach (char ch in st\n Console.Write(ch+\"+\");\n Console.Write(\"\\b\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "495bee62689374c9a5cc950db5c261d6", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Runtime.InteropServices;\nusing System.Dynamic;\nusing Microsoft.VisualBasic;\nusing ImTools;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n ArrayList arr = new ArrayList();\n string str = Console.ReadLine();\n for (int i = 0; i < str.Length; i++)\n {\n char ch = str[i];\n if (ch != '+')\n {\n arr.Add(char.GetNumericValue(ch));\n }\n }\n\n arr.Sort();\n string s = \"\";\n\n for (int i = 0; i < arr.Count; i++)\n {\n s += arr[i];\n if (i != arr.Count - 1)\n s += \"+\";\n }\n Console.WriteLine(s);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c0d2b04291d3e8716abdf71cc73df483", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n int[] f=new int[100];\n System.String text = System.Console.ReadLine();\n text = text.Replace(\"+\", \"\");\n for (int i = 0; i < text.Length; i++)\n { \n f[i] = int.Parse(text[i].ToString());\n }\n\n Array.Sort(f);\n for (int i = 0; i < f.Length; i++)\n {\n if (f[i] != 0)\n { if(i!=f.Length-1)\n System.Console.Write(f[i] + \"+\");\n else \n System.Console.Write(f[i]);\n\n }\n } \n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "77bc7f676eb57dbeb7922f48e87601c5", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Sample_Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string mash = Console.ReadLine();\n string[] str = mash.Split('+');\n Array.Sort(str);\n Console.WriteLine(string.Join('+',str));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5c313017fe5e265e83990ca0afddb29a", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "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[] nums = new int[3];\n var inp = Console.ReadLine().Split('+');\n for(int i = 0; i < inp.Length; i++) {\n nums[Convert.ToInt32(inp[i]) - 1]++;\n }\n if(nums[0] != 0) {\n while(nums[0] > 1) {\n nums[0]--;\n Console.Write(\"1+\");\n }\n Console.Write(\"1\");\n }\n if(nums[1] != 0) {\n if(nums[0] == 1) {\n Console.Write(\"+\");\n nums[0]--;\n }\n while(nums[1] > 1) {\n nums[1]--;\n Console.Write(\"2+\");\n }\n Console.Write(\"2\");\n }\n if(nums[2] != 0) {\n if(nums[1] == 1 || nums[0] == 1) {\n Console.Write(\"+\");d\n }\n while(nums[2] > 1) {\n nums[2]--;\n Console.Write(\"3+\");\n }\n Console.Write(\"3\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fb4f3b31340847965b730f5256b80103", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "MS C#", "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\t\t\tstring textBox1 = Console.ReadLine();\n /* char[] arr;\n arr = num.ToCharArray(0, num.Length);\n */\n \t\t string textBox2;//= Console.ReadLine();\n /* char[] arr2;\n arr2 = num.ToCharArray(0, num.Length);\n*/\n int len = textBox1.Length;\n char[] first = new char[len];\n char[] second = new char[len];\n int i = 0;\n char buf;\n int j = 0;\n while (i < len)\n {\n if (textBox1[i] != '+')\n {\n first[j] = textBox1[i];\n j++;\n }\n i++;\n }\n i = 1;\n while (i < j)\n {\n if (first[i] < first[i - 1])\n {\n buf = first[i - 1];\n first[i - 1] = first[i];\n first[i] = buf;\n if (i > 1) i--;\n }\n else i++;\n }\n j = 0;\n i = 0;\n while (i < len)\n {\n if (i % 2 == 0)\n {\n textBox2 += first[j].ToString();\n j++;\n }\n else textBox2 += '+';\n i++;\n }\n\t\t\tConsole.WriteLine(textBox2);\n }\n }\n} \n \n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5927f376a41b6d21721ee805bda9a16f", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "MS C#", "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 int[] data = new int[0];\n int index=0;\n string temp=\"\";\n for(int i=0; i\n\n \n \n Debug\n AnyCPU\n {979BA46C-8594-42ED-8BAB-F2FC358ADA90}\n Exe\n Helpful_Maths_0\n Helpful Maths 0\n v4.7.2\n 512\n true\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a54c8c30741e41c3281c87fb57ee061d", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication26\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split('+').Select(int.Parse).ToArray().;\n Array.Sort(arr);\n for(int i = 0; i n)\n {\n next = arr[i];\n break;\n }\n }\n \n if(m == next) Console.Write(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d14cd7f3c3e3c486852872d9e7c1f766", "src_uid": "9d52ff51d747bb59aa463b6358258865", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Program\n{\n /*public static IEnumerable GetPrimes(int n)\n {\n //\u041c\u0430\u0441\u0441\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0434\u043b\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 i \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0447\u0438\u0441\u043b\u043e i + 1 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\n bool[] primes = new bool[n];\n\n for (int i = 1; i < n; i++)\n {\n //\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u0432\u0430 \u0438 \u0432\u0441\u0435 \u043d\u0435\u0447\u0435\u0442\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0435\n primes[i] = true;\n if (i > 1 && i % 2 == 1) primes[i] = false;\n }\n\n //\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u043b\u044f \u0447\u0438\u0441\u043b\u0430 i, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043e\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c\n for (int i = 3; i * i < n; i += 2)\n {\n //\u0415\u0441\u043b\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0442\u043e \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u043c\u0438 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 i\n if (primes[i - 1])\n {\n for (int j = 2 * i; j < n; j += i)\n {\n primes[j - 1] = false;\n }\n }\n }\n\n int indexer = 1;\n foreach (bool prime in primes)\n {\n if (prime)\n yield return indexer;\n indexer += 1;\n }\n }*/\n static void Main(string[] args)\n {\n string[] buffer = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(buffer[0]);\n int b = Convert.ToInt32(buffer[1]);\n Console.Write(Math.Abs(a - b) && !(a == 0 && b == 0) > 1 ? \"NO\" : \"YES\");\n Console.Read();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "737d0b4d730f4f0235a5fcbafd58a3ee", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Program\n{\n /*public static IEnumerable GetPrimes(int n)\n {\n //\u041c\u0430\u0441\u0441\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0434\u043b\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 i \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0447\u0438\u0441\u043b\u043e i + 1 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\n bool[] primes = new bool[n];\n\n for (int i = 1; i < n; i++)\n {\n //\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u0432\u0430 \u0438 \u0432\u0441\u0435 \u043d\u0435\u0447\u0435\u0442\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0435\n primes[i] = true;\n if (i > 1 && i % 2 == 1) primes[i] = false;\n }\n\n //\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u043b\u044f \u0447\u0438\u0441\u043b\u0430 i, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043e\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c\n for (int i = 3; i * i < n; i += 2)\n {\n //\u0415\u0441\u043b\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0442\u043e \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u043c\u0438 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 i\n if (primes[i - 1])\n {\n for (int j = 2 * i; j < n; j += i)\n {\n primes[j - 1] = false;\n }\n }\n }\n\n int indexer = 1;\n foreach (bool prime in primes)\n {\n if (prime)\n yield return indexer;\n indexer += 1;\n }\n }*/\n static void Main(string[] args)\n {\n string[] buffer = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(buffer[0]);\n int b = Convert.ToInt32(buffer[1]);\n Console.Write(Math.Abs(a - b) || (a == 0 && b == 0) > 1 ? \"NO\" : \"YES\");\n Console.Read();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "89c514653b7bcdd09eb14808131643a3", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "MS C#", "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().Split();\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n if (a>=0 && b>=0)Console.WriteLine(\"YES\");\n \n if (a==b || a== (b-1) || a==(b+1))\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n\n \n else Console.WriteLine(\"NO\");\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5949d8d9f2b2e37d9d0b09fb23b4e32b", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dasha_and_Stairs\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arrxy = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n if ( (arrxy[0] ==arry[1]-1 || arrxy[0] == arrxy[1]+1 || arrxy[0]==arrxy[1]) && ( arrxy[0] !=0 || arrxy[1]!=0)) {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fa38e389c2aef9a9d070e33776f4a478", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace timusCsharp //1\n{\n static class Program\n {\n static void Main()\n {\n\t\t\tvar ret = 0;\n int a = Int32.Parse(Console.ReadLine());\n\t\t\tdouble y = Int32.Parse(Console.ReadLine());\n\t\t\tdouble z = Int32.Parse(Console.ReadLine());\n\t\t\tint b = Math.Floor(y/2);\n\t\t\tint c = Math.Floor(z/4);\n\t\t\tint[] arr = {a, b*2, c*4};\n\t\t\tint crit = arr.ToList().IndexOf(arr.Max());\n\t\t\tif (crit == 1) ret = a*7;\n\t\t\tif (crit == 2) ret = b*7;\n\t\t\tif (crit == 3) ret = c*7;\n\t\t\n Console.WriteLine(ret);\n }\n }\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "138d560917bf630dc38f8d8a469c0492", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace timusCsharp //1\n{\n static class Program\n {\n static void Main()\n {\n\t\t\tvar ret = 0;\n var a = Console.ReadLine();\n\t\t\tvar b = Console.ReadLine();\n\t\t\tvar c = Console.ReadLine();\n\t\t\tb = Math.Floor(b/2);\n\t\t\tc = Math.Floor(c/4);\n\t\t\tint[] arr = {a, b*2, c*4};\n\t\t\tint crit = arr.ToList().IndexOf(arr.Max());\n\t\t\tif (crit == 1) ret = a*7;\n\t\t\tif (crit == 2) ret = b*7;\n\t\t\tif (crit == 3) ret = c*7;\n\t\t\n Console.WriteLine(ret);\n }\n }\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "44d6b157327e61d1a099cb0fdad59678", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace timusCsharp //1\n{\n static class Program\n {\n static void Main()\n {\n var a = Console.ReadLine();\n\t\t\tvar b = Console.ReadLine();\n\t\t\tvar c = Console.ReadLine();\n\t\t\tb = Math.Floor(b/2);\n\t\t\tc = Math.Floor(c/4);\n\t\t\tint[] arr = {a, b*2, c*4};\n\t\t\tint crit = arr.ToList().IndexOf(arr.Max());\n\t\t\tif (crit == 1) ret = a*7;\n\t\t\tif (crit == 2) ret = b*7;\n\t\t\tif (crit == 3) ret = c*7;\n\t\t\n Console.WriteLine(ret);\n }\n }\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ded808aea0cbc62027d9d65a78a0a27f", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace timusCsharp //1\n{\n static class Program\n {\n static void Main()\n {\n\t\t\tvar ret = 0;\n int a = int.TryParse(Console.ReadLine());\n\t\t\tint b = int.TryParse(Console.ReadLine());\n\t\t\tint c = int.TryParse(Console.ReadLine());\n\t\t\tb = Math.Floor(b/2);\n\t\t\tc = Math.Floor(c/4);\n\t\t\tint[] arr = {a, b*2, c*4};\n\t\t\tint crit = arr.ToList().IndexOf(arr.Max());\n\t\t\tif (crit == 1) ret = a*7;\n\t\t\tif (crit == 2) ret = b*7;\n\t\t\tif (crit == 3) ret = c*7;\n\t\t\n Console.WriteLine(ret);\n }\n }\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "93bd88102fe75a3a3d06a10cbf66799b", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace timusCsharp //1\n{\n static class Program\n {\n static void Main()\n {\n\t\t\tvar ret = 0;\n double a = Int32.Parse(Console.ReadLine());\n\t\t\tdouble b = Int32.Parse(Console.ReadLine());\n\t\t\tdouble c = Int32.Parse(Console.ReadLine());\n\t\t\tb = Math.Floor(b/2);\n\t\t\tc = Math.Floor(c/4);\n\t\t\tint[] arr = {a, b*2, c*4};\n\t\t\tint crit = arr.ToList().IndexOf(arr.Max());\n\t\t\tif (crit == 1) ret = a*7;\n\t\t\tif (crit == 2) ret = b*7;\n\t\t\tif (crit == 3) ret = c*7;\n\t\t\n Console.WriteLine(ret);\n }\n }\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9d16ee0629394294a4271548fb327508", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "Mono C#", "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 x2 = int.Parse(Console.ReadLine());\n\t\t\tint px2 = maxPrimeDivs(x2);\n\t\t\tint min = x2;\n\t\t\tint start2 = ((x2 / px2) - 1) * px2 + 1;\n\n\t\t\tfor (int x1 = start2; x1 <= x2; x1++)\n\t\t\t{\n\t\t\t\tint px1 = maxPrimeDivs(x1);\n\t\t\t\tint start1 = ((x1 / px1) - 1) * px1 + 1;\n\t\t\t\tif (start1 > 2 && starta1 < min)\n\t\t\t\t{\n\t\t\t\t\tmin = start1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(min);\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tprivate static int maxPrimeDivs(int n)\n\t\t{\n\t\t\tint d = 2;\n\t\t\tint result = 0;\n\n\t\t\twhile (d * d <= n)\n\t\t\t{\n\t\t\t\tif (n % d == 0)\n\t\t\t\t{\n\t\t\t\t\tn /= d;\n\t\t\t\t\tif (result < d)\n\t\t\t\t\t\tresult = d;\n\t\t\t\t}\n\t\t\t\telse d++;\n\t\t\t}\n\t\t\treturn Math.Max(result, n);\n\t\t}\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cfd9682e25ff55ff3a2b66eafa23aae2", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System; \n\nclass P {\n static void Main() {\n var a = long.Parse(Console.ReadLine());\n var b = long.Parse(Console.ReadLine());\n var c = a+b;\n var a2 = a.ToString().Replace(\"0\", \"\");\n var b2 = b.ToString().Replace(\"0\", \"\");\n var c2 = c.ToString().Replace(\"0\", \"\");\n Console.Write(a2+b2==c2? \"YES\": \"NO\");\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "517b8ab72d17301b3c544e2ade8c4cf3", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nclass P {\n static void Main() {\n var s = Console.ReadLine();\n var bestSub = \"\";\n var bestNum = -1;\n for (var i = 0; i < s.Length; i++) {\n var isGood = true;\n for (var j = i ; j < s.Length && isGood; j++) {\n isGood = isGood && (s[j] == '4' || s[j] == '7');\n if (!isGood) break;\n var n = 1;\n for (var k = i + 1; k < s.Length - (j-i+1) ; k++) {\n var isGoodAsWell = true;\n for (var l = 0 ; l <= j-i && isGoodAsWell ; l++) \n isGoodAsWell = isGoodAsWell && s[k+l] == s[i+l];\n if (isGoodAsWell) n++;\n }\n var s2 = s.SubString(i, j+1-i);\n if (n > bestNum || (n==bestNum && s2 < bestSub)) {\n bestNum = n; bestSub = s2;\n }\n }\n }\n Console.Write(bestNum == -1? \"-1\" : bestSub);\n }\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ec75e9f38faf4fafc6a7593367e2c818", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nclass P {\n static void Main() {\n var s = Console.ReadLine();\n var bestSub = \"\";\n var bestNum = -1;\n for (var i = 0; i < s.Length; i++) {\n var isGood = true;\n for (var j = i ; j < s.Length && isGood; j++) {\n isGood = isGood && (s[j] == '4' || s[j] == '7');\n if (!isGood) break;\n var n = 1;\n for (var k = i + 1; k < s.Length - (j-i+1) ; k++) {\n var isGoodAsWell = true;\n for (var l = 0 ; l <= j-i && isGoodAsWell ; l++) \n isGoodAsWell = isGoodAsWell && s[k+l] == s[i+l];\n if (isGoodAsWell) n++;\n }\n var s2 = s.Substring(i, j+1-i);\n if (n > bestNum || (n==bestNum && s2 < bestSub)) {\n bestNum = n; bestSub = s2;\n }\n }\n }\n Console.Write(bestNum == -1? \"-1\" : bestSub);\n }\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b120e1167cf5366a37bcdff83b092178", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "namespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int res = -1;\n int a4 = 0;\n int a7 = 0;\n string s = Console.ReadLine();\n for (var i = 0; i < s.Length; i++)\n {\n if (s[i] == '4')\n {\n a4++;\n \n }\n }\n if (res != 4)\n {\n for (var i = 0; i < s.Length; i++)\n {\n if (s[i] == '7')\n {\n a7++;\n \n }\n }\n }\n if (a4 >= a7 && a4 != 0)\n {\n res = 4;\n }\n else if (a4 < a7)\n {\n res = 7;\n }\n Console.WriteLine(res);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bfba0cac1ad5c29bf48bde6b0da48da5", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nnamespace CodeForce\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputNumbers = Console.ReadLine().Split(' ');\n int Size = int.Parse(inputNumbers[0]);\n int Number = int.Parse(inputNumbers[1]);\n\n if if (Number == 1 || Size * Size == Number || (Size == 31622 && Number == 999887641))\n {\n Console.WriteLine(\"1\");\n return;\n }\n\n int divisorsCount = 0;\n for (int i = 2; i < Math.Sqrt(Number); i++)\n {\n if (Number % i == 0 && i <= Size && Number / i <= Size)\n {\n divisorsCount++;\n }\n }\n\n if (Number <= Size)\n {\n divisorsCount++;\n }\n\n Console.WriteLine(divisorsCount*2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e332c533613fd61f63ea2130c6525f7f", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Hack\n{\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 long x = long.Parse(s[1]);\n int ans = 0;\n for (int i = 1; i <= n; i++)\n {\n if (x % i == 0 && x/i <=n)\n ans++;\n }\n Console.WriteLine(ans);\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f1666132e184dc1fed6452bd2f196879", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing CodeForce.Problems;\n\nnamespace CodeForce\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputNumbers = Console.ReadLine().Split(' ');\n int Size = int.Parse(inputNumbers[0]);\n int Number = int.Parse(inputNumbers[1]);\n\n if (Number == 1)\n {\n Console.WriteLine(\"1\");\n return;\n }\n\n int divisorsCount = 0;\n\n for (int i = 2; i < Math.Sqrt(Number); i++)\n {\n if (Number % i == 0)\n {\n divisorsCount++;\n }\n }\n\n if (Number <= Size)\n {\n divisorsCount++;\n }\n\n Console.WriteLine(divisorsCount*2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "81ac95b58a071577c940a035917a9945", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Text;\n\n\nnamespace Scath\n{\n\nclass Program\n{\nstatic void Main(){\nvar line= Console.ReadLine().Split(' ');\nint dimention= Convert.ToInt32(line[0]);\nint valieNum=Convert.ToInt32(line[1]);\nint count=0;\n\nConsole.WriteLine(\"{0},{1}\",dimention,valieNum);\n\nfor(int i=1;i length)\n {\n if (num % i == 0)\n {\n counter1++;\n }\n\n }\n else\n {\n if (num % i == 0)\n {\n\n counter2++;\n }\n }\n\n }\n }\n if (num>length)\n {\n Console.WriteLine(counter1);\n }\n else (num != 1)\n {\n Console.WriteLine(counter2);\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c020955c24b84fa066b4ebcab465a7ac", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nnamespace CodeForce\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputNumbers = Console.ReadLine().Split(' ');\n int Size = int.Parse(inputNumbers[0]);\n int Number = int.Parse(inputNumbers[1]);\n\n if(Numer == 1)\n {\n Console.WriteLine(\"1\");\n return;\n }\n int divisorsCount = 0;\n\n for (int i = 2; i <= Math.Sqrt(Number); i++)\n {\n if (Number % i == 0 && i <= Size)\n {\n divisorsCount++;\n }\n }\n\n if (Number <= Size)\n {\n divisorsCount++;\n }\n\n Console.WriteLine(divisorsCount*2 + (IsSquare(Number) ? 1 : 0));\n }\n \n private static bool IsSquare(int n)\n {\n int tst = (int)(Math.Sqrt(n) + 0.5);\n return tst * tst == n;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3a5798436640633d56a45d638364453b", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {BA8A03E5-C5D6-43F1-A283-1032EB23660E}\n Exe\n Properties\n _1\n 1\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f96a964bba81efe0d2d7dbbdee963c84", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "Mono C#", "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 X = sc.Long;\n var f = Factorize(X);\n long a = 1, b = 1;\n var l = new List();\n foreach(var p in f)\n {\n var q = 1L;\n for (var j = 0; j < p.Value; j++)\n q *= p.Key;\n l.Add(q);\n }\n l.Sort((a, b) => b.CompareTo(a));\n foreach(var p in l)\n {\n if (a > b) swap(ref a, ref b);\n a *= p;\n }\n WriteLine($\"{a} {b}\");\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\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, idx => A[idx]);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ed7dcd44b98836666bc0621958f1890c", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"1\", \"1\\1.csproj\", \"{BA8A03E5-C5D6-43F1-A283-1032EB23660E}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{BA8A03E5-C5D6-43F1-A283-1032EB23660E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{BA8A03E5-C5D6-43F1-A283-1032EB23660E}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{BA8A03E5-C5D6-43F1-A283-1032EB23660E}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{BA8A03E5-C5D6-43F1-A283-1032EB23660E}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d880de9cb06837babc6304b12af83c18", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": " int X;\n double a1, b1;\n X = Convert.ToInt32(Console.ReadLine());\n\n List f = new List();\n \n for (int i=1; i <= X; i++)\n {\n if (X % i == 0) f.Add(i);\n }\n int size = f.Count;\n if (X != 1)\n {\n a1 = f[size - 1];\n b1 = f[size - 2];\n }\n else { a1 = 1; b1 = 1; }\n\n if (size > 2)\n {\n a1 = b1;\n b1 = f[size - 3];\n }\n\n Console.WriteLine($\"{a1} {b1}\");\n Console.ReadKey();\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a0e309e0de3308c2627712b30ef3d659", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "Mono C#", "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(new char[]{'@'});\n\t\tbool y=find(s);\n\t\tif(y)Console.WriteLine(\"YES\");\n\t\telse\n\t\tConsole.WriteLine(\"NO\");\n\t}\n\tpublic static bool find(string[] s)\n\t{\n\t\t\n\t\tif(s.length<2 || s.Length>2)return false;\n\t\tstring user=s[0];\n\t\tstring [] rest=s[1].Split('/');\n\t\tstring host=rest[0];\n\t\tif(!(host.Length>0 && host.Length<33))return false;\n\t\tif(!(user.Length>0 && user.Length<17))return false;\n\t\tforeach(char cc in user)\n\t\t{\n\t\t\tif(!(char.IsDigit(cc) || char.IsLetter(cc) || cc=='_'))return false;\n\t\t}\n\t\tforeach(char cc in host)\n\t\t{\n\t\t\tif(!(char.IsDigit(cc) || char.IsLetter(cc) || cc=='_' || cc=='.'))return false;\n\t\t}\n\t\tstring [] tt=host.Split(new char[]{'.'});\n\t\tforeach(string t in tt)\n\t\t{\n\t\t\tif(!(t.Length>0 && t.Length<17))return false;\n\t\t}\n\t\tList ll=new List();int le=0;\n\t\tif(rest.Length>1)\n\t\t{\n\t\t\tfor(int i=1;i0 && le<17))return false;\n\t\tforeach(string kk in ll)\n\t\t{\n\t\t\tforeach(char cc in kk)\n\t\t\t{\n\t\t\t\tif(!(char.IsDigit(cc) || char.IsLetter(cc) || cc=='_'))return false;\n\t\t\t}\n\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}\n}\n\n\t\t", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e2622e8494701c1894842e1ffcc6f9cc", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n#nullable enable\nclass Program\n{\n static void Main()\n {\n Console.WriteLine((int)'a');\n string input = Console.ReadLine();\n if (input.Length < 3) { Console.WriteLine(\"NO\"); return; };\n\n string[] splited = input.Split('@','/');\n if (splited.Length < 2 || splited.Length > 3) { Console.WriteLine(\"NO\"); return; }\n string username = splited[0], hostname = splited[1];\n string? resource = null;\n if(splited.Length == 3)\n {\n resource = splited[2];\n }\n\n bool correct = CheckCorrectSymbols();\n if (correct) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n bool CheckCorrectSymbols()\n {\n string EngABC = \"_ABCDEFGHIJKLMNOPQRSTUWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n if (username.Length < 1 || username.Length > 16) return false;\n for (int i = 0; i < username.Length; ++i)\n {\n if(!EngABC.Contains(username[i])) return false;\n }\n\n if (hostname.Length < 1 || hostname.Length > 32) return false;\n for (int i = 0; i < hostname.Length; ++i)\n {\n if (hostname[i] != '.' && !EngABC.Contains(hostname[i])) return false;\n }\n\n string[] words = hostname.Split('.');\n if (words.Length < 2) return false;\n for (int i = 0; i < words.Length; ++i)\n {\n if (words[i].Length < 1 || words[i].Length > 16) return false;\n }\n\n if (resource != null)\n {\n if (resource.Length < 1 || resource.Length > 16) return false;\n for(int i = 0; i < resource.Length; ++i)\n {\n if (!EngABC.Contains(resource[i])) return false;\n }\n }\n\n return true;\n }\n }\n\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7212ebfd307444916f754b5914d51358", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\u041e\u0442 JohnKEA, \u043a\u043e\u043d\u0442\u0435\u0441\u0442: Codeforces Alpha Round #21 (Codeforces format), \u0437\u0430\u0434\u0430\u0447\u0430: (A) Jabber ID, \u041f\u043e\u043b\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, #\n\nusing System;\nusing System.Text.RegularExpressions;\nnamespace _21A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n if (Regex.IsMatch(str, @\"^\\w{1,16}@\\w{1,16}(\\.\\w{1,16})*(/\\w{1,16})?$\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "470e15f4a904dd7c8cac4197aabe160f", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "\ufeffclass ThueMorseGame\n{\n\tpublic string get(int n, int m)\n\t{\n\t\tvar isAlice = true;\n\t\tif (m == 1) {\n\t\t\treturn \"Bob\";\n\t\t}\n\t\tvar minus = m % 2 == 0 ? m : m - 1;\n\t\twhile (true) {\n\t\t\tif (n <= m) {\n\t\t\t\tif (isAlice) {\n\t\t\t\t\treturn \"Alice\";\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn \"Bob\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (n == 3) {\n\t\t\t\tif (m >= 3) {\n\t\t\t\t\tif (isAlice) {\n\t\t\t\t\t\treturn \"Alice\";\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn \"Bob\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (isAlice) {\n\t\t\t\t\t\treturn \"Bob\";\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn \"Alice\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isAlice) {\n\t\t\t\tisAlice = false;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tisAlice = true;\n\t\t\t}\n\n\t\t\tn -= minus;\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f5d9b424cddc288c1ce6f491c94aaf0e", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "difficulty": 1400.0} {"lang": "Mono C#", "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 int 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1cc89b1efd22f2c12e439f595eb05b3f", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace makethemequal\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s=Console.ReadLine();\n int As=s.Count(c=>c=='a');\n if(As*2>=s.Count){\n Console.WriteLine(s.Count);\n return;\n }\n Console.WriteLine(As*2-1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d017f283e911c572d98e560b711e8417", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "Console.Write(\"Enter Your String: \");\n string myString = Console.ReadLine();\n\n int i = 0;\n int count = 0;\n while(i < myString.Length)\n {\n if (myString[i] == 'a')\n {\n count++;\n }\n i++;\n }\n\n int result = (count * 2) - 1;\n if (result > myString.Length)\n {\n result = myString.Length;\n }\n Console.WriteLine(\"The Answer is: \" + result);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e71e691177cfc38160ee4e6f94794a79", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\t\t\tint count =0, rem = 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++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(count > s.length/2)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(s.Length);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\trem = s.Length - count;\n\t\t\t\trem = rem - count;\n\t\t\t\tConsole.WriteLine(rem);\n\t\t\t}\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f30ee18881c4f2b682e59cabd6667592", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.438\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp2\", \"ConsoleApp2\\ConsoleApp2.csproj\", \"{8A072859-3DA3-41B0-B955-9F07898E9750}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{8A072859-3DA3-41B0-B955-9F07898E9750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{8A072859-3DA3-41B0-B955-9F07898E9750}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{8A072859-3DA3-41B0-B955-9F07898E9750}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{8A072859-3DA3-41B0-B955-9F07898E9750}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {1B2E71C2-A7F2-48DF-9D5C-3DE7E7295B71}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4c18880db272511f6825ab539f471024", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace CodeforcesProject001\n{\n class Program\n {\n private static int Main(string[] args)\n {\n string s;\n string a = \"\";\n int Lenght=0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'a')\n {\n a += 'a';\n }\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (a.Length > (s.Length - i) / 2)\n {\n Lenght= s.Length - i;\n break;\n }\n }\n return Lenght;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5570f3c5c76f8fe8d05996e30481afbe", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nnamespace Challenge\n{\n class Program\n {\n static void Main()\n {\n Console.Write(LoveA(Console.ReadLine()));\n\t\t}\n\t\tpublic static string LoveA(string str)\n {\n \n \n int count_a = str.Count(x => x == 'a');\n int count_other = str.Length - count_a;\n if (count_a == 0 && count_other == 0)\n return \"1\";\n else if (count_a == 0 && count_other > 0)\n return (count_other + count_other + 1).ToString();\n else if (count_a > count_other)\n return str.Length.ToString();\n else if (count_a == count_other)\n return (str.Length - 1).ToString();\n else if (count_a < count_other)\n return (count_a + count_a - 1).ToString();\n \n }\n\t\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f59fca69784db947cd9cfe0e2f014081", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System;\n\nclass Solution\n{\n public static void Swap(int s1,int s2)\n {\n\n }\n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n --j;\n }\n list[j + 1] = next;\n }\n for (int i = 0; i < list.Count; i+=2)\n {\n sum = sum + list[i+1] - list[i];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n do\n {\n var t = Console.ReadLine();\n var coll = t.Split(\" \");\n foreach (var item in coll)\n {\n list.Add(Int.Parse(item));\n }\n } while (list.Count % 2 != 0);\n \n \n var i= Solution.arrayManipulation(list);\n\n Console.WriteLine(i);\n Console.ReadKey();\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "77525af623d104776456b5aaeaff0a07", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.29709.97\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"ProblemToAlgorithms\", \"ProblemToAlgorithms\\ProblemToAlgorithms.csproj\", \"{74B4C07B-F41C-4699-BD1C-97917649F5ED}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|Any CPU = Release|Any CPU\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{74B4C07B-F41C-4699-BD1C-97917649F5ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{74B4C07B-F41C-4699-BD1C-97917649F5ED}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{74B4C07B-F41C-4699-BD1C-97917649F5ED}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{74B4C07B-F41C-4699-BD1C-97917649F5ED}.Debug|x86.Build.0 = Debug|x86\n\t\t{74B4C07B-F41C-4699-BD1C-97917649F5ED}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{74B4C07B-F41C-4699-BD1C-97917649F5ED}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{74B4C07B-F41C-4699-BD1C-97917649F5ED}.Release|x86.ActiveCfg = Release|x86\n\t\t{74B4C07B-F41C-4699-BD1C-97917649F5ED}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {83D40A20-5899-4098-A771-6ED5AA4148DA}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f0925685567518c84a2a64cfc7823103", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System;\nnamespace ProblemToAlgorithms\n{\nclass Solution\n{\n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n --j;\n }\n list[j + 1] = next;\n }\n for (int i = 0; i < list.Count; i += 2)\n {\n sum = sum + list[i + 1] - list[i];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n int ll=Convert.ToInt32(Console.ReadLine());\n string t = Console.ReadLine();\n var coll = t.Split(' ');\n for (int i=0 ;i list = new List();\n int length = Convert.ToInt32(Console.ReadLine());\n for (int i = 0; i < length; i++)\n {\n list.Add(Convert.ToInt32(Console.ReadLine()));\n }\n list.Sort();\n \n Console.WriteLine(Math.Abs(list.Last() - list.First()));\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f288b7b24ae881af0a2300cefa03cea5", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\nusing System.Collections.Generic;\nusing System;\n\nclass Solution\n{\n public static void Swap(int s1,int s2)\n {\n\n }\n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n --j;\n }\n list[j + 1] = next;\n }\n for (int i = 1; i < list.Count; i+=2)\n {\n sum = sum + list[i] - list[i-1];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n \n var t = Console.ReadLine();\n var coll = t.Split(\" \");\n foreach (var item in coll)\n {\n list.Add(Int32.Parse(item));\n }\n if (list.Count % 2 != 0)\n {\n return;\n }\n var i= Solution.arrayManipulation(list);\n\n Console.WriteLine(i);\n Console.ReadKey();\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "17a4bef7d5f54f14cea3f6f3a9357221", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System;\n\nclass Solution\n{\n public static void Swap(int s1,int s2)\n {\n\n }\n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n --j;\n }\n list[j + 1] = next;\n }\n for (int i = 0; i < list.Count; i+=2)\n {\n sum = sum + list[i+1] - list[i];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n do\n {\n var t = Console.ReadLine();\n var coll = t.Split(\" \");\n foreach (var item in coll)\n {\n list.Add(Int32.Parse(item));\n }\n } while (list.Count % 2 != 0);\n \n \n var i= Solution.arrayManipulation(list);\n\n Console.WriteLine(i);\n Console.ReadKey();\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bff1f29b3c6409220ea22d6351ee5d06", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System;\n\nclass Solution\n{\n public static void Swap(int s1,int s2)\n {\n\n }\n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n --j;\n }\n list[j + 1] = next;\n }\n for (int i = 0; i < list.Count; i+=2)\n {\n sum = sum + list[i + 1] - list[i];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n \n var t = Console.ReadLine();\n var coll = t.Split(\" \");\n\n foreach (var item in coll)\n {\n list.Add(Int32.Parse(item));\n }\n var i= Solution.arrayManipulation(list);\n\n Console.WriteLine(i);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d12fc601a3b5cdab444d84b4f3863f55", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System;\nnamespace ProblemToAlgorithms\n{\nclass Solution\n{\n \n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n --j;\n }\n list[j + 1] = next;\n }\n for (int i = 0; i < list.Count; i += 2)\n {\n sum = sum + list[i + 1] - list[i];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n \n var t = Console.ReadLine();\n var coll = t.Split(\" \");\n foreach (var item in coll)\n {\n list.Add(Int32.Parse(item));\n }\n \n\n\n var i = Solution.arrayManipulation(list);\n\n Console.WriteLine(i);\n Console.ReadKey();\n }\n}\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a9240f3e9a62b1a96b714492d31abafb", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\nusing System.Collections.Generic;\nusing System;\n\nclass Solution\n{\n public static void Swap(int s1,int s2)\n {\n\n }\n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n --j;\n }\n list[j + 1] = next;\n }\n for (int i = 0; i < list.Count; i+=2)\n {\n sum = sum + list[i+1] - list[i];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n \n var t = Console.ReadLine();\n var coll = t.Split(\" \");\n foreach (var item in coll)\n {\n list.Add(Int32.Parse(item));\n }\n if (list.Count % 2 != 0)\n {\n return;\n }\n var i= Solution.arrayManipulation(list);\n\n Console.WriteLine(i);\n Console.ReadKey();\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c0d35ebcc9da59f681cbf4f734a6991f", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace SortingAlgorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n StartSortingProblems problems = new StartSortingProblems();\n problems.FriendMeeting();\n }\n public static void FriendMeeting()\n {\n int count = 0;\n int n = int.Parse(Console.ReadLine());\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), arrTemp => Convert.ToInt32(arrTemp));\n for (int i = n - 1; i >= 1; i--)\n {\n for (int j = 1; j <= i; j++)\n {\n if (arr[j - 1] > arr[j])\n {\n arr[j] = arr[j - 1] - arr[j];\n arr[j - 1] = arr[j - 1] - arr[j];\n arr[j] = arr[j] + arr[j - 1];\n }\n }\n }\n\n for (int i = 1; i < n; i += 2)\n {\n count += arr[i] - arr[i - 1];\n }\n Console.WriteLine(count);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "43051a6d1bbfb08f0b085fab95a99193", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System;\n\nclass Solution\n{\n \n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n --j;\n }\n list[j + 1] = next;\n }\n for (int i = 0; i < list.Count; i+=2)\n {\n sum = sum + list[i+1] - list[i];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n do\n {\n var t = Console.ReadLine();\n var coll = t.Split(\" \");\n foreach (var item in coll)\n {\n list.Add(Int32.Parse(item));\n }\n } while (list.Count % 2 != 0);\n \n \n var i= Solution.arrayManipulation(list);\n\n Console.WriteLine(i);\n Console.ReadKey();\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1f7adceb40467dcf5bcf3f522b0f2077", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\nusing System.Collections.Generic;\nusing System;\n\nclass Solution\n{\n public static void Swap(int s1,int s2)\n {\n\n }\n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n --j;\n }\n list[j + 1] = next;\n }\n for (int i = 1; i < list.Count; i+=2)\n {\n sum = sum + list[i] - list[i-1];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n \n var t = Console.ReadLine();\n var coll = t.Split(\" \");\n foreach (var item in coll)\n {\n list.Add(Int32.TryParse(item));\n }\n if (list.Count % 2 != 0)\n {\n return;\n }\n var i= Solution.arrayManipulation(list);\n\n Console.WriteLine(i);\n Console.ReadKey();\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c773e6fae25bc34d2ceb74933156cfac", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System;\nnamespace ProblemToAlgorithms\n{\nclass Solution\n{\n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n --j;\n }\n list[j + 1] = next;\n }\n for (int i = 0; i < list.Count; i += 2)\n {\n sum = sum + list[i + 1] - list[i];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n var t = Console.ReadLine();\n var coll = t.Split(\" \");\n foreach (var item in coll)\n {\n list.Add(Int32.Parse(item));\n }\n var i = Solution.arrayManipulation(list);\n Console.WriteLine(i);\n \n }\n}\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6a1560249f7d1eb602c26a26279d8fea", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System;\nnamespace ProblemToAlgorithms\n{\nclass Solution\n{\n public static int arrayManipulation(List list)\n {\n int sum = 0;\n for (int i = 0; i < list.Count; i++)\n {\n var next = list[i];\n int j = i - 1;\n while (j >= 0 && list[j] > next)\n {\n list[j + 1] = list[j];\n j--;\n }\n list[j + 1] = next;\n }\n for (int i = 0; i < list.Count; i += 2)\n {\n sum = sum + list[i + 1] - list[i];\n }\n return sum;\n }\n\n\n static void Main(string[] args)\n {\n List list = new List();\n var t = Console.ReadLine();\n var coll = t.Split(\" \");\n foreach (var item in coll)\n {\n list.Add(Int32.Parse(item));\n }\n var i = Solution.arrayManipulation(list);\n Console.WriteLine(i);\n \n }\n}\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d55489ccde7e3fc3b998f8f8875727b3", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Task1\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n\n var input = Console.ReadLine();\n var w = int.Parse(input.Split(' ')[0]);\n var h = int.Parse(input.Split(' ')[1]);\n var k = int.Parse(input.Split(' ')[2]);\n\n\n int result = 0;\n\n for (int i = 1; i <= k; i++)\n {\n\n int result = (w + h) * 2 - 4;\n int w =- 4;\n int h = -4; \n }\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "539753aa625e46f02ce4ba192b31b25e", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " public class Program\n {\n public static uint Solve(uint h, uint w, uint k)\n {\n uint result = 0;\n\n for (int i = 1; i <= k; i++)\n {\n uint activeW = (uint)(w - ((i - 1) * 4));\n uint activeH = (uint)(h - ((i - 1) * 4));\n\n uint amount = 2 * (activeW + activeH) - 4;\n\n result += amount;\n }\n\n return result;\n }\n\n static void Main(string[] args)\n {\n uint w = uint.Parse(args[0]);\n uint h = uint.Parse(args[1]);\n uint k = uint.Parse(args[2]);\n\n uint result = Solve(h, w, k);\n\n Console.WriteLine(result);\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3305e583b315756131bbc20b82f4f384", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Plate{\n static void Main(string[] args){\n Solve();\n }\n \n static void Solve(){\n string[] args = Console.ReadLine().Split(' ');\n int x = int.Parse(args[0]);\n int y = int.Parse(args[1]);\n int k = int.Parse(args[2]);\n \n int total = 0;\n for(int i = 0; i < k; i ++){\n total += Edges(x - 2 * i, y - 2 * i);\n }\n \n return total;\n }\n \n static int Edges(int x, int y){\n return 2 * x + 2 * y - 4;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9e2b684efa1339f63ca9c2a10ce3f0ca", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using MiniProfiler.Windows;\nusing StackExchange.Profiling;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace WithConsole\n{\n class Program\n {\n static void Main(string[] args)\n {\n Func convert = c =>\n {\n switch (c)\n {\n case \"v\":\n return 0;\n case \"<\":\n return 1;\n case \"^\":\n return 2;\n case \">\":\n return 3;\n default:\n return -1;\n }\n };\n var input = Console.ReadLine().Split(' ').Select(c => convert(c)).ToArray();\n var s = input[0];\n var e = input[1];\n var n = int.Parse(Console.ReadLine());\n\n if (s == e || Math.Abs(e - s) == 2)\n {\n Console.WriteLine(\"undefined\");\n }\n else\n {\n n %= 4;\n bool cw;\n if (n == Math.Abs(e - s))\n {\n cw = (e - s) > 0;\n }\n else\n {\n cw = -(e - s) > 0;\n }\n Console.WriteLine(cw ? \"cw\" : \"ccw\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "217d97e2357470e5d751882d3dd9e30f", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n int[] inp = new int[5];\n {\n string[] data = Console.In.ReadToEnd().Split(new char[] { \\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n inp[0] = int.Parse(data[0]);\n inp[1] = int.Parse(data[1]);\n inp[2] = int.Parse(data[2]);\n inp[3] = int.Parse(data[3]);\n inp[4] = int.Parse(data[4]);\n }\n int count = 0;\n bool[] drgns = new bool[inp[4] + 1];\n Array.Sort(inp, 0, 4);\n for(int i = 1; i list = new List() { k, l, n, m };\n list.Sort();\n\n // \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0434\u0435\u043b\u044f\u0448\u0438\u0435\u0441\u044f \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430, (\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c 8 \u0438 4, \u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u043c 8)\n if (!m_EveryKilled)\n {\n for (int i = list.Count - 1; i > 0; i--)\n {\n int number = list[i];\n for (int j = 0; j < i; j++)\n if (number % list[j] == 0)\n {\n list.RemoveAt(i);\n break;\n }\n }\n }\n\n m_Divisors = list.ToArray();\n m_EveryKilled = (m_Divisors[0] == 1);\n }\n\n public int Solve()\n {\n if (m_EveryKilled)\n return m_Total;\n\n int result = 0;\n\n Binom binom = new Binom(m_Divisors, LCD);\n for (int i = 0; i < m_Divisors.Length; i++)\n {\n int sum = 0;\n var combinations = binom.Combinations(i + 1);\n\n foreach (int item in combinations)\n sum += m_Total / item;\n\n if (i % 2 == 0)\n result += sum;\n else\n result -= sum;\n }\n\n return result;\n }\n\n private int LCD(int[] numbers)\n {\n int product = 1;\n\n int gcd = 1;\n if (numbers.Length > 1)\n gcd = numbers[0]; \n\n for (int i = 0; i < numbers.Length; i++)\n {\n int number = numbers[i];\n product *= number;\n gcd = Utils.GCD(gcd, number);\n }\n\n return product / gcd;\n }\n }\n\n class Binom where TIn : struct\n {\n private class LinkedIndexes : LinkedList\n {\n public int Count { get; private set; }\n\n public LinkedIndexes(int count)\n : base()\n {\n Count = count;\n }\n\n public LinkedIndexes(int count, IEnumerable collection)\n : base(collection)\n {\n Count = count;\n }\n }\n\n private TIn[] m_From;\n private Func m_Action;\n\n private List m_Result;\n private TIn[] m_CortegeSource;\n\n public Binom(TIn[] from, Func action)\n {\n m_From = from;\n m_Action = action;\n }\n\n /// \n /// \u0418\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 from \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u043f\u043e k \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (\u043d\u0435\u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f).\n /// \n public TOut[] Combinations(int k)\n {\n m_Result = new List();\n m_CortegeSource = new TIn[k];\n\n LinkedIndexes indexes = new LinkedIndexes(m_From.Length, Enumerable.Range(0, k));\n\n if (k > 0)\n {\n m_Result.Add(GetCortege(indexes));\n ProcessNext(indexes.First, k);\n }\n\n return m_Result.ToArray();\n }\n\n private void ProcessNext(LinkedListNode index, int k)\n {\n LinkedIndexes list = (LinkedIndexes)index.List;\n if (index.Next != null)\n {\n int value = index.Value;\n for (int i = index.Value; i < m_From.Length - k + value; i++)\n {\n ProcessNext(index.Next, k);\n\n if (IterateNext(index))\n {\n Reset(index);\n m_Result.Add(GetCortege(list));\n }\n }\n }\n else\n {\n while (IterateNext(index))\n m_Result.Add(GetCortege(list));\n }\n }\n\n private bool IterateNext(LinkedListNode index)\n {\n if (index.Next == null) // \u0441\u043c\u043e\u0442\u0440\u0438 \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439\n {\n LinkedIndexes list = (LinkedIndexes)index.List;\n if (index.Value == list.Count - 1)\n return false;\n }\n else\n {\n if (index.Value == index.Next.Value - 1)\n return false;\n }\n\n index.Value = index.Value + 1;\n return true;\n }\n\n private void Reset(LinkedListNode index) // \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430 \u0438\u0445 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\n {\n if (index.Next == null)\n return;\n\n int value = index.Value + 1;\n var next = index.Next;\n\n while (next != null)\n {\n next.Value = value++;\n next = next.Next;\n }\n }\n\n private TOut GetCortege(LinkedIndexes indexes)\n {\n int counter = 0;\n foreach (int index in indexes)\n m_CortegeSource[counter++] = m_From[index];\n\n return m_Action(m_CortegeSource);\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "63d14c6465369275bcbc8cdc7def5d9f", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "Mono C#", "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 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 ans = 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 ans++;\n }\n }\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8d716e1d4c15aa28a778d50ebd61530d", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "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\n\n Console.WriteLine(d / k + l / k + m / k + n / k);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "144b501758c41d02f2b7ef794da8ef6f", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Net.Http.Headers;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8140e283a6015bf321f07a1fbbb2f4a4", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Insomnia_cure\n{\n class Program\n {\n 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\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a676a59d422e8ed023c818b5b8810660", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "MS C#", "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(n => n, n => 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f65f1355a20267789576aeff76fd21d6", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass Program {\n static void Main() {\n var divs = Enumerable.Range(0, 4).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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6784c9933edb12e3a11d655ec8e6a8fa", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "Mono C#", "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.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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "06578face8d14e5211d5060e879d4fd7", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "difficulty": 1100.0} {"lang": "Mono 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 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 int i = 0;\n foreach (string s in Console.ReadLine().Split(' '))\n vb[i++] = uint.Parse(s);\n i = 0;\n foreach (string s in Console.ReadLine().Split(' '))\n vi[i++] = uint.Parse(s);\n i = 0;\n foreach (string s in Console.ReadLine().Split(' '))\n vr[i++] = uint.Parse(s);\n uint mb = vb.Max();\n uint mi = vi.Max();\n uint mr = vr.Max();\n\n uint c = 0;\n for (int i = 0; i < count; ++i)\n if (vb[i] < mb && vi[i] < mi && vr[i] < mr)\n ++c;\n Console.Write(c);\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/* 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);*/", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b772f59d754471ef4fd1805df4cdfef", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d4111b45fbdb26c6f3f335c1326f9481", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c166d5efa953cc4eec4c9278ce0045c1", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0} {"lang": "MS C#", "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 if ((n+\"\").IndexOf('8') == -1)\n {\n n++; \n ans++;\n }\n Console.WriteLine(n);\n }\n }\n}\n/*", "lang_cluster": "C#", "compilation_error": true, "code_uid": "375bc343eed2b2100e035667dcedf39e", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"488A\", \"488A\\488A.csproj\", \"{94B514C4-137B-473D-A7F0-1E7D8E8A3CEF}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{94B514C4-137B-473D-A7F0-1E7D8E8A3CEF}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{94B514C4-137B-473D-A7F0-1E7D8E8A3CEF}.Debug|x86.Build.0 = Debug|x86\n\t\t{94B514C4-137B-473D-A7F0-1E7D8E8A3CEF}.Release|x86.ActiveCfg = Release|x86\n\t\t{94B514C4-137B-473D-A7F0-1E7D8E8A3CEF}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "99dd2111bc0d407d8beb5d15acfd2799", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass B723 {\n public static void Main() {\n var n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine();\n var ss = s.Split('(', ')');\n int answer1 = 0, answer2 = 0;\n for (int i = 0; i < ss.Length; i += 2) {\n var opts = StringSplitOptions.RemoveEmptyEntries;\n var sss = ss[i].Split(new char[] { '_' }, opts);\n foreach (var j in sss)\n if (answer1 < j.Length) answer1 = j.Length;\n }\n for (int i = 1; i < ss.Length; i += 2) {\n var sss = ss[i].Split(new char[] { '_' }, opts);\n answer2 += sss.Length;\n }\n Console.WriteLine($\"{answer1} {answer2}\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "284a5ebd8340fca8a5c5b024a13d4b99", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace XkcdComics\n{\n class Program\n {\n static void Main(string[] args)\n {\n var num = Int32.Parse(Console.ReadLine());\n var text = Console.ReadLine();\n int cursor = 0;\n bool inBrackets = false;\n bool isWordChar = false;\n int wordsInBrackets = 0;\n int maxWordOutBrackets = 0;\n int curentWordOutBrackets = 0;\n\n foreach (var item in text)\n {\n if (item == '(')\n {\n \n if (isWordChar)\n if (curentWordOutBrackets > maxWordOutBrackets)\n {\n maxWordOutBrackets = curentWordOutBrackets;\n \n }\n isWordChar = false;\n inBrackets = true;\n curentWordOutBrackets = 0;\n }\n else if(item == ')')\n {\n if (isWordChar)\n wordsInBrackets++;\n inBrackets = false;\n isWordChar = false;\n }\n\n else if(item == '_')\n {\n if (isWordChar)\n if(inBrackets)\n {\n wordsInBrackets++;\n }\n else\n {\n if (curentWordOutBrackets > maxWordOutBrackets)\n maxWordOutBrackets = curentWordOutBrackets;\n curentWordOutBrackets = 0;\n }\n isWordChar = false;\n }\n else\n {\n isWordChar = true;\n if (!inBrackets)\n curentWordOutBrackets++;\n }\n };\n \n Console.WriteLine($\"{maxWordOutBrackets} {wordsInBrackets} \");\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b79108e6a1805c83e1f1981404eb4d19", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Drawing;\n\nnamespace CF_1028_C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Rectangle[] a = new Rectangle[n];\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split();\n int x = int.Parse(s[0]);\n int y = int.Parse(s[1]);\n int x1 = int.Parse(s[2]);\n int y1 = int.Parse(s[3]);\n a[i] = new Rectangle(x, y, x1-x, y1-y);\n }\n\n for (int i = 0; i < n; i++)\n {\n Rectangle b = a[i];\n int count = 0;\n for (int j = 0; j < n; j++)\n {\n if (i == j) continue;\n\n if (b.IntersectsWith(a[j]))\n {\n count++;\n b.Intersect(a[j]);\n }\n }\n\n if (count == n - 1)\n {\n Console.WriteLine(b.Left + \" \" + b.Top);\n return;\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aab9b762797eaf8449a74ff1987772e4", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0} {"lang": "Mono C#", "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\t\t\tint x=Console.NextInt();\n\t\t\tint y=Console.NextInt();\n int k=Console.NextInt();\n\t\t\tint t=0;\n while(x<=y)\n\t\t {\n\t\t int mid=x+(y-x)/2;\n\t\t if(mid*k>r)\n\t\t y=mid-1;\n\t\t if(mid*x\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8012496ffab150a4a9f5b5a79335ec25", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace modularexponentiation\n{\n class Program\n {\n static void Main(string[] args)\n {\n BigInteger n = BigInteger.Parse(Console.ReadLine());\n BigInteger m = BigInteger.Parse(Console.ReadLine());\n BigInteger k =(BigInteger) ((m) % (Math.Pow(2.0, n)));\n Console.WriteLine(k);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a5038d614065cb946d2c1a0cd8062551", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\n\npublic 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 ModularExponentiation : ISolution\n {\n public override void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n if (n >= 27)\n {\n Console.Write(m);\n }\n else\n {\n Console.Write(m % Math.Pow(2, n));\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "be242ad56e93ed30a8a2ab6270e38e0a", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "int n = int.Parse(Console.ReadLine()); \nint m = int.Parse(Console.ReadLine()); \nint z = m /n ;\nConsole.WriteLine(z);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7b59a247295e68d4fdd78d51834a97f9", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace modularexponentiation\n{\n class Program\n {\n static void Main(string[] args)\n {\n //BigInteger y = 1;\n BigInteger n = BigInteger.Parse(Console.ReadLine());\n BigInteger m = BigInteger.Parse(Console.ReadLine());\n double k = (BigInteger)m;\n BigInteger y = (BigInteger)Math.Pow(2.0, k);\n\n\n BigInteger.ModPow(m, 1,y);\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "871c0d497845f19fe988fb75a58bd308", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Solution\n {\n static void Main(string[] args)\n {\n new ModularExponentiation().Solve();\n Console.ReadLine();\n }\n }\n \n public class ModularExponentiation : ISolution\n {\n public override void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n if (n >= 27)\n {\n Console.Write(m);\n }\n else\n {\n Console.Write(m % Math.Pow(2, n));\n }\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d2adb7a3e31c504ef9d06a1ca8e60aa9", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace DynamicProgramming\n{\n class Program\n {\n static void Main(string[] args)\n {\n CutRibbon();\n }\n\n static void CutRibbon()\n {\n var nabc = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = nabc[0];\n int a = nabc[1];\n int b = nabc[2];\n int c = nabc[3];\n\n int[] arr = { a, b, c };\n int x, y, z;\n arr = arr.OrderBy(a => a).ToArray();\n int[] dp = new int[4001];\n dp[arr[0]] = 1;\n dp[arr[1]] = 1;\n dp[arr[2]] = 1;\n for (int i = arr[0] + 1; i <= n; i++)\n {\n x = y = z = 0;\n if (arr[0] <= i && dp[i - arr[0]] > 0)\n {\n x = dp[i - arr[0]] + 1;\n }\n if (arr[1] <= i && dp[i - arr[1]] > 0)\n {\n y = dp[i - arr[1]] + 1;\n }\n if (arr[2] <= i && dp[i - arr[2]] > 0)\n {\n z = dp[i - arr[2]] + 1;\n }\n var max = Math.Max(x, y);\n dp[i] = Math.Max(max, Math.Max(z, dp[i]));\n }\n Console.WriteLine(dp[n]);\n }\n }}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e7d93346fc26573004202d90eb1dbe59", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\npublic class dp_cut_ribbon_189A\n {\n Dictionary dp = new Dictionary();\n private int max(int a, int b, int c)\n {\n return Math.Max(a, Math.Max(b, c));\n }\n private int rec(int n, int a, int b, int c)\n {\n if (dp.ContainsKey(n))\n return dp[n];\n if (n < 0)\n return -1;\n if (n == 0)\n return 0;\n int x = rec(n - a, a, b, c), y = rec(n - b, a, b, c), z = rec(n - c, a, b, c);\n if (x >= 0 || y >= 0 || z >= 0)\n dp[n] = max(x, y, z) + 1;\n else\n dp[n] = -1;\n return dp[n];\n }\n public int solve(int n, int a, int b, int c)\n {\n return rec(n, a, b, c);\n }\n }\n class main\n {\n private static void print(string s = \"\")\n {\n Console.Write(s);\n }\n private static void print(int s)\n {\n Console.Write(s);\n }\n private static void printL(string s = \"\")\n {\n Console.WriteLine(s);\n }\n private static void printL(int s)\n {\n Console.WriteLine(s);\n }\n static void Main(string[] args)\n {\n int[] input = Consloe.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n dp_cut_ribbon_189A obj = new dp_cut_ribbon_189A();\n\n printL(obj.solve(input[0],input[1],input[2],input[3]));\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "acd0748ddc8b50528ceb0c774b20d675", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": " using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace DynamicProgramming\n{\n class Program\n {\n static void Main(string[] args)\n {\n CutRibbon();\n }\n\n static void CutRibbon()\n {\n var nabc = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = nabc[0];\n int a = nabc[1];\n int b = nabc[2];\n int c = nabc[3];\n\n int[] arr = { a, b, c };\n int x, y, z;\n arr = arr.OrderBy(a => a).ToArray();\n int[] dp = new int[4001];\n dp[arr[0]] = 1;\n dp[arr[1]] = 1;\n dp[arr[2]] = 1;\n for (int i = arr[0] + 1; i <= n; i++)\n {\n x = y = z = 0;\n if (arr[0] <= i && dp[i - arr[0]] > 0)\n {\n x = dp[i - arr[0]] + 1;\n }\n if (arr[1] <= i && dp[i - arr[1]] > 0)\n {\n y = dp[i - arr[1]] + 1;\n }\n if (arr[2] <= i && dp[i - arr[2]] > 0)\n {\n z = dp[i - arr[2]] + 1;\n }\n var max = Math.Max(x, y);\n dp[i] = Math.Max(max, Math.Max(z, dp[i]));\n }\n Console.WriteLine(dp[n]);\n }\n }}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f0ace6faa29d4ff316f4614442c6ba25", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.IO;\n\nnamespace Codeforce158\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 void Main(string[] args)\n {\n int[] data = parseInt(Console.ReadLine());\n\n int[] F = new int[data[0] + 1];\n F[data[1]] = 1;\n F[data[2]] = 1;\n F[data[3]] = 1;\n for (int i = 2; i < data[0] + 1; i++)\n {\n for (int j = 1; j < 4; j++)\n {\n if (i - data[j] >= 0 && F[i - data[j]] != 0)\n {\n F[i] = Math.Max(F[i], F[i - data[j]] + 1);\n }\n }\n }\n\n Console.WriteLine(F[data[0]]);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "983ddb78b4aeeaf8e7520321b9c83e51", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\npublic class dp_cut_ribbon_189A\n {\n Dictionary dp = new Dictionary();\n private int max(int a, int b, int c)\n {\n return Math.Max(a, Math.Max(b, c));\n }\n private int rec(int n, int a, int b, int c)\n {\n if (dp.ContainsKey(n))\n return dp[n];\n if (n < 0)\n return -1;\n if (n == 0)\n return 0;\n int x = rec(n - a, a, b, c), y = rec(n - b, a, b, c), z = rec(n - c, a, b, c);\n if (x >= 0 || y >= 0 || z >= 0)\n dp[n] = max(x, y, z) + 1;\n else\n dp[n] = -1;\n return dp[n];\n }\n public int solve(int n, int a, int b, int c)\n {\n return rec(n, a, b, c);\n }\n }\n class main\n {\n private static void print(string s = \"\")\n {\n Console.Write(s);\n }\n private static void print(int s)\n {\n Console.Write(s);\n }\n private static void printL(string s = \"\")\n {\n Console.WriteLine(s);\n }\n private static void printL(int s)\n {\n Console.WriteLine(s);\n }\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n dp_cut_ribbon_189A obj = new dp_cut_ribbon_189A();\n\n printL(obj.solve(input[0],input[1],input[2],input[3]));\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "11c929572a8fd9b77b582944d90969ac", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "public class Test\n {\n public 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 c = int.Parse(input[3]);\n\n int[] div = new int[n + 1];\n\n div[0] = 0;\n for (int i = Math.Min(a, Math.Min(b, c)); i <= n; ++i)\n {\n if (i >= a)\n div[i] = div[i - a] + 1;\n if (i >= b)\n div[i] = Math.Max(div[i], div[i - b] + 1);\n if(i >= c)\n div[i] = Math.Max(div[i], div[i - c] + 1);\n }\n\n Console.WriteLine(div[n]);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8b238e690d8d0e8ce9881aa9be663dc1", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "MS C#", "source_code": " using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Threading;\n using FoursquareApi;\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 s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int z = int.Parse(s[2]);\n int l, b;\n int ans = 0;\n if (m > n)\n {\n b = m;\n l = n;\n }\n else\n {\n l = m;\n b = n;\n }\n int bFirst = b;\n while (b<=z)\n {\n if (b%l == 0)\n {\n ans++;\n }\n b+=bFirst;\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 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e36ff4cc9e46ed3ff366bc63df0da323", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeforcesBetaRound83\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(':');\n\n int a = int.Parse(ss[0]);\n int b = int.Parse(ss[1]);\n\n string c = perevorot(a);\n\n if (int.Parse(c) <= b)\n {\n if (a != 23)\n {\n int cc = a + 1;\n if (cc < 10)\n c = \"0\" + cc;\n else\n c = cc.ToString();\n\n Console.WriteLine(c + \":\" + perevorot(cc));\n }\n else\n Console.WriteLine(\"00:00\");\n }\n else\n {\n if (int.Parse(c) < 60)\n {\n Console.WriteLine(ss[0] + \":\" + c);\n\n }\n else\n {\n if (a != 23)\n {\n \n int cc = a + 1;\n if (cc < 10)\n c = \"0\" + cc;\n else\n c = cc.ToString();\n\n Console.WriteLine(c + \":\" + perevorot(c));\n \n }\n else\n Console.WriteLine(\"00:00\");\n }\n\n }\n\n Console.ReadLine();\n \n }\n public static string perevorot(int a)\n {\n int a1 = a % 10;\n string aa = a1.ToString();\n int a2 = a / 10;\n aa = aa + a2.ToString();\n\n // if (int.Parse(aa) < 10)\n // aa = \"0\" + aa;\n\n return aa;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2f0d0ed7f79eef2138d7b04b2c436301", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {25B6AE56-020D-4B7D-824A-5834F25493CD}\n Exe\n _825\n 825\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7adae1d8d1bd8fb7721d823281a7c06d", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\nclass codeforces\n{\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();\n int res = 1 ;\n int pre = -1;\n for (int i = 0 ; i < n ; i ++)\n {\n if (a[i] == 1)\n {\n if (pre + 1)\n {\n res *= i - pre;\n }\n pre = i;\n }\n } \n if (pre == -1)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Console.WriteLine(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "387c4fe5254d0a88ef6cebbbf62b8529", "src_uid": "58242665476f1c4fa723848ff0ecda98", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\nclass codeforces\n{\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Trim().split(' ').Select(int.Parse).ToArray();\n int res = 1 ;\n int pre = -1;\n for (int i = 0 ; i < n ; i ++)\n {\n if (a[i] == 1)\n {\n if (pre + 1)\n {\n res *= i - pre;\n }\n pre = i;\n }\n } \n if (pre == -1)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Console.WriteLine(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c96fa6a907ad779f2ffa4c462047fa0e", "src_uid": "58242665476f1c4fa723848ff0ecda98", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CF617B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main ()\n\t\t{\n\t\t\tint n = int.Parse (Console.ReadLine ());\n\t\t\tint[] a = new int[102];\n\t\t\tint m = 0;\n\t\t\tstring IntArray = Console.ReadLine ();\n\t\t\tstring[] NewIntArray = IntArray.Split(' ');\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\tint val = int.Parse (NewIntArray [i - 1]);\n\t\t\t\tif (val == 1)\n\t\t\t\t\ta [++m] = i;\n\t\t\t}\n\t\t\tlong res = 1;\n\t\t\tif (m == 0)\n\t\t\t\tres = 0;\n\t\t\telse if (m == n)\n\t\t\t\tres = 1;\n\t\t\telse\n\t\t\t\tfor (int i = 2; i <= m; i++)\n\t\t\t\t\tres *= long(a [i] - a [i - 1])\n\t\t\tConsole.WriteLine (\"{0}\", res);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "09d328f227dbc177afe7ecfd0f86b95e", "src_uid": "58242665476f1c4fa723848ff0ecda98", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "import java.io.*;\nimport java.util.*;\n\n\n\npublic class Sequence{\n public static void main(String args[])throws IOException{\n\n int a = 0;\n int b = 0;\n int i;\n int k;\n ArrayList list = new ArrayList<>();\n Boolean err;\n String str = \"\";\n char arr[];\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n //\u0414\u0435\u043b\u0430\u0435\u043c \n do{\n try{\n err = false;\n // System.out.println(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (4,7,44,77,444....) : \");\n str = br.readLine();\n arr = str.toCharArray(); \n \n for(char current : arr){\n if(current == '4' || current == '7'){\n continue;\n }else{\n throw new NumberFormatException();\n }\n }\n \n }catch (NumberFormatException e) {\n err = true;\n System.out.println(\"\u041d\u0435\u043a\u043a\u043e\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\"); \n } \n } while( err == true);\n\n \n String array[][] = new String[10][]; \n\n for(i = 0,k = 2; i < 10;i++,k = k*2){\n array[i] = new String[k];\n }\n\n array[0][0] = \"4\";\n array[0][1] = \"7\";\n \n while ( a < 9 ) {\n for(String s : array[a]){\n for(String j : array[0]){\n array[a+1][b] = s+j;\n b++; \n }\n }\n b = 0;\n a +=1;\n \n } \n\n for(String[] n : array){\n for(String j : n){\n list.add(j);\n }\n }\n\n a = list.indexOf(str)+1;\n System.out.print(a);\n br.close();\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d7391eba51efcb174651a95c944c15ed", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing C5;\n\nnamespace ForceTest2\n{\n class MagicSolver {\n\n public static long getMaskPos(String part) \n {\n int result = 0;\n if (part.Length == 1) \n {\n if (part.Equals (\"4\")) \n {\n result = 1;\n }\n else\n {\n result = 2;\n }\n }\n else \n {\n if (part.Equals (\"44\")) \n {\n result = 3;\n }\n else if (part.Equals (\"47\"))\n {\n result = 4;\n }\n if (part.Equals (\"74\")) \n {\n result = 5;\n }\n else if (part.Equals (\"77\"))\n {\n result = 6;\n }\n }\n\n return result;\n }\n\n public static long findBasicPos(int len) {\n long result = 2;\n for (int i = 2; i <= len-1; i++) {\n result += (long)Math.Pow (2.0, (double)i);\n }\n\n return result;\n }\n\n public static String [] eraser(String mnumber) {\n ArrayList result = new ArrayList ();\n\n int len = mnumber.Length;\n\n while (len != 0) {\n if (len >= 2) {\n String dchar = mnumber.Substring (len - 2, 2);\n result.Add (dchar);\n mnumber = mnumber.Substring(0, len-2);\n } else {\n result.Add (mnumber);\n mnumber = \"\";\n }\n len = mnumber.Length;\n }\n\n return result.ToArray ();\n\n }\n\n }\n\n class MainClass\n {\n public static void Main (string[] args)\n {\n String magicNum = Console.ReadLine ();\n\n long start = 0;\n\n if (magicNum.Length > 2) {\n start = MagicSolver.findBasicPos (magicNum.Length);\n }\n\n String[] partOfNum = MagicSolver.eraser (magicNum);\n\n foreach (String part in partOfNum) {\n start += MagicSolver.getMaskPos (part);\n }\n Console.Write (start);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b51b551f9e0893ffc21e51597a1efa52", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Cancer_or_Scorpio\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "09de22f4edf426be0f3cef487588f75e", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7f5c5e82fc26e7303dce174350d3223d", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n int Main(string[] args)\n {\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int x = m*n;\n Console.WriteLine(x%2 == 0 ? \"Malvika\" : \"Akshat\");\n return 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "397784a7f5d0dc58b64b511cc5cf856a", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass MainClass()\n{\n static void Main(string[] args)\n {\n int[] inputs = 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d2ab231d2796cadc12a53225777f1117", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass MainClass()\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1ff3931ca105630de8f928e6c05b8b86", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int N = Int32.Parse(Console.ReadLine());\n string[] A = new string[] { \"\", \"\", \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\" };\n string[] B = new string[] { \"zero\", \"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\" };\n string[] C = new string[] { \"ten\", \"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fifteen\", \"sixteen\", \"seventeen\", \"eighteen\", \"nineteen\" };\n string ans = \"\";\n if (N < 10) ans = B[N];\n else if (N < 20) ans = C[N - 10];\n else if (N % 10 == 0) ans = A[N / 10];\n else ans = A[N / 10] + \"-\" + B[N % 10];\n\n\n\n Console.WriteLine(ans);\n\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d39e62e2e970afafb57b00fa077ed867", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n public class Program\n {\n public static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] numbers = { \"zero\", \"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\" };\n string [] bigger = { null, null, \"twen\", \"thir\", null, \"fif\", null, null, \"eigh\", null };\n if (input.Length == 1) Console.WriteLine(numbers[input[0] - 48]);\n else\n {\n StringBuilder bldr = new StringBuilder();\n if(input[0]=='1')\n {\n if (input[1] == '0') bldr.Append(\"ten\");\n else if (input[1] == '1') bldr.Append(\"eleven\");\n else if (input[1] == '2') bldr.Append(\"twelve\");\n else { bldr.Append(\"teen\"); if (bigger[input[1] - 48] == null) bldr.Insert(0, numbers[input[1] - 48]); else bldr.Insert(0, bigger[input[1] - 48]); }\n }\n else\n {\n bldr.Append(\"ty\");\n if (bigger[input[0] - 48] == null) bldr.Insert(0, numbers[input[0] - 48]);\n else bldr.Insert(0, bigger[input[0] - 48]);\n if (input[1] != '0') bldr.AppendFormat(\"-{0}\", numbers[input[1] - 48]);\n }\n Console.WriteLine(bldr.ToString());\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a66a0d5f24ddbbdfe41164aeb9d6d420", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Console\n{\n class Program\n {\n static void Main(string[] args)\n {\n var dict1 = new Dictionary()\n {\n {\"0\",\"zero\"},\n {\"1\", \"one\"},\n {\"2\", \"two\"},\n {\"3\", \"three\"},\n {\"4\", \"four\"},\n {\"5\", \"five\"},\n {\"6\", \"six\"},\n {\"7\", \"seven\"},\n {\"8\", \"eight\"},\n {\"9\", \"nine\"},\n };\n var dict2 = new Dictionary()\n {\n {\"2\", \"twenty\"},\n {\"3\", \"thirty\"},\n {\"4\", \"forty\"},\n {\"5\", \"fifty\"},\n {\"6\", \"sixty\"},\n {\"7\", \"seventy\"},\n {\"8\", \"eighty\"},\n {\"9\", \"ninety\"},\n };\n var specialDict = new Dictionary()\n {\n {\"10\", \"ten\"},\n {\"11\",\"eleven\"},\n {\"12\",\"twelve\"},\n {\"13\",\"thirteen\"},\n {\"14\",\"fourteen\"},\n {\"15\",\"fifteen\"},\n {\"16\",\"sixteen\"},\n {\"17\",\"seventeen\"},\n {\"18\",\"eighteen\"},\n {\"19\",\"nineteen\"},\n };\n var p = new Program();\n string s = System.Console.ReadLine();\n string result;\n if (s.Count() == 1)\n {\n result = dict1[s];\n }\n else\n {\n if (specialDict.ContainsKey(s))\n result = specialDict.SpecialDict()[s];\n else\n {\n var first = s[0].ToString();\n var second = s[1].ToString();\n var firstResult = dict2[first];\n var secondResult = second==\"0\" ? string.Empty : dict1[second];\n var defis = second == \"0\" ? string.Empty : \"-\";\n result = string.Format(\"{0}{1}{2}\", firstResult,defis, secondResult);\n }\n }\n System.Console.Write(result);\n \n }\n\n //Dictionary Dict1()\n //{\n // return new Dictionary()\n // {\n // {\"0\",\"zero\"},\n // {\"1\", \"one\"},\n // {\"2\", \"two\"},\n // {\"3\", \"three\"},\n // {\"4\", \"four\"},\n // {\"5\", \"five\"},\n // {\"6\", \"six\"},\n // {\"7\", \"seven\"},\n // {\"8\", \"eight\"},\n // {\"9\", \"nine\"},\n // };\n //}\n\n //Dictionary Dict2()\n //{\n // return new Dictionary()\n // {\n // {\"2\", \"twenty\"},\n // {\"3\", \"thirty\"},\n // {\"4\", \"forty\"},\n // {\"5\", \"fifty\"},\n // {\"6\", \"sixty\"},\n // {\"7\", \"seventy\"},\n // {\"8\", \"eighty\"},\n // {\"9\", \"ninety\"},\n // };\n //}\n\n //Dictionary SpecialDict()\n //{\n // return new Dictionary()\n // {\n // {\"10\", \"ten\"},\n // {\"11\",\"eleven\"},\n // {\"12\",\"twelve\"},\n // {\"13\",\"thirteen\"},\n // {\"14\",\"fourteen\"},\n // {\"15\",\"fifteen\"},\n // {\"16\",\"sixteen\"},\n // {\"17\",\"seventeen\"},\n // {\"18\",\"eighteen\"},\n // {\"19\",\"nineteen\"},\n // };\n //}\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ed555de188ab1121ca61a89d11efb25b", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace cf624B\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n HashSet used = new HashSet(26);\n\n long total = 0;\n\n foreach (int e in a)\n {\n if (used.Contains(e))\n {\n int h = e;\n while(h>0 && used.Contains(h))\n {\n h--;\n }\n if (h > 0)\n {\n used.Add(h);\n total += h;\n }\n }\n else\n {\n used.Add(e);\n total += e;\n }\n }\n\n Console.WriteLine(total);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2a09507cf57218ecdb88de1862e03af2", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class Example\n{\n public static void Main()\n {\n int n = Console.ReadLine();\n byte d = n % 10;\n if(d >= 5)\n n +=(10-d);\n else\n n-=(10-d);\n Console.Write(\" \"+n);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f2e6aed095f1a87e691f82f31571fd18", "src_uid": "29c4d5fdf1328bbc943fa16d54d97aa9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CF242A\n{\n class Squats\n {\n int n;\n String hamsters;\n\n public void Read ()\n {\n n = Convert.ToInt32 (Console.ReadLine ());\n hamsters = Console.ReadLine ();\n }\n\n public void Solve ()\n {\n int counter = 0;\n for (int i = 0; i < n; i++)\n if (hamsters [i] == 'X')\n counter++;\n Console.Write (Math.Abs (counter - n / 2));\n if (counter >= n / 2)\n for (int i = 0; i < n; i++) {\n if (hamsters [i] == 'X' && counter > n / 2) {\n hamsters [i] = 'x';\n counter--;\n }\n Console.Write (hamsters [i]);\n }\n else\n for (int i = 0; i < n; i++) {\n if (hamsters [i] == 'x' && counter > n / 2) {\n hamsters [i] = 'X';\n counter--;\n }\n Console.Write (hamsters [i]);\n }\n }\n }\n\n class MainClass\n {\n public static void Main (string[] args)\n {\n Squats problem = new Squats ();\n problem.Read ();\n problem.Solve ();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "86e8b38a90cb858bd239823ff9d06674", "src_uid": "fa6311c72d90d8363d97854b903f849d", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "string [] tmp = Console.ReadLine().Split();\nint Parent = Int32.Parse(tmp[0]);\nint Childs = Int32.Parse(tmp[1]);\n\nif (Parent == 0)\n Console.Write(\"Impossible\");\nif (Parent > Childs || Parent == Childs)\n Console.Write(\"{0} {1}\", Parent, Parent);\nif (Childs > Parent)\n Console.Write(\"{0} {1}\", Childs, Parent + Childs - 1);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "94dfe7a00794b766efddc25754e358d8", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication21\", \"ConsoleApplication21\\ConsoleApplication21.csproj\", \"{0138161B-5138-4601-B6E7-03DFA9EAA492}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{0138161B-5138-4601-B6E7-03DFA9EAA492}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0138161B-5138-4601-B6E7-03DFA9EAA492}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0138161B-5138-4601-B6E7-03DFA9EAA492}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0138161B-5138-4601-B6E7-03DFA9EAA492}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5ecd28d2f101b14e66876e12602db2e0", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff@{int[] i=new int[] {100,2,100,200,2,2};\n int t=0,q=0,w=0;\n }\n\n\n\n@{\n for (var k=0;k<5;k++)\n {\n for(var l=k;l<6;l++)\n {\n if(i[k]>i[l])\n {\n t=i[k];\n i[k]=i[l];\n i[l]=t;\n \n }\n }\n \n }\n int y=3; \nfor(var h=0;h<2;h++)\n{\nif(i[h]==i[h+1]&&i[h]==i[h+2]&&i[h]==i[h+3])\n{\n y=y-1;\n if(h==0)\n {\n q=i[4];w=i[5]; \n }\n if(h==1)\n {\n q=i[0];w=i[5]; \n }\n if(h==2)\n {\n q=i[0];w=i[1]; \n }\n}\n}\n if(y!=3){\n if(q==w)\n {\n It is an Elephant \n }\n else{\n It is a bear \n }\n }\n else\n {\n It is an aliean\n }\n \n}\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9e868f9701a3b48ada69f1d2ee9a163b", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace test\n{\n public class Program\n {\n\n private static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split().Select(Int32.Parse).ToList();\n\n var groupBy = arr.GroupBy(x => x).ToArray();\n\n int legs = -1;\n foreach (var grouping in groupBy)\n {\n if (grouping.Count() >= 4) legs = grouping.Key;\n }\n\n bool b = legs > 0;\n if (b)\n {\n for (int i = 0; i < 4; i++) arr.Remove(legs);\n\n Console.WriteLine(arr[0] == arr[1] ? \"Elephant\" : \"Bear\");\n }\n else\n {\n Console.WriteLine(\"Alien\");\n }\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0ead7f82c13917fc795495e8d1cb6f14", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Issue_471A\n{\n class Program\n {\n public static void Main(string[] args) {\n const int sticks_count = 9;\n var sticks = new int[sticks_count];\n\n for (int i = 0; i < sticks_count; ++i) {\n sticks[i] = ReadInt();\n }\n\n Sort.HeapSort(sticks);\n\n string result;\n\n if (IsBear(sticks)) result = \"Bear\";\n else if (IsElephant(sticks)) result = \"Elephant\";\n else result = \"Alien\";\n\n Console.WriteLine(result);\n }\n\n private static bool IsBear(int[] sticks) {\n return sticks[0] < sticks[1] \n && sticks[1] == sticks[4] \n && sticks[5] > sticks[1];\n }\n\n private static bool IsElephant(int[] sticks) {\n return sticks[0] == sticks[3] \n && sticks[0] < sticks[4]\n && sticks[4] == sticks[5];\n }\n }\n\n public static class Helper {\n public static bool IsInputError = false;\n public static bool IsEndOfLine = false;\n\n public 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 static class Sort \n {\n public static void HeapSort(this T[] array) \n where T : IComparable \n {\n // create Heap from unordered array\n BuildHeap(array);\n\n // sort\n for (var i = array.Length - 1; i >= 0; --i) {\n Swap(ref array[0], ref array[i]);\n FloatUp(array, 0, i);\n }\n }\n\n private static void BuildHeap(T[] array)\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 FloatUp(array, i, size);\n }\n }\n\n private static void FloatUp(T[] array, int index, int size)\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 return;\n }\n \n var largest = (array[left_node_index].CompareTo(array[index]) > 0)\n ? left_node_index \n : index;\n\n if (right_node_index < size) {\n largest = (array[right_node_index].CompareTo(array[largest]) > 0)\n ? right_node_index\n : largest;\n }\n\n if (largest != index) {\n Swap(ref array[index], ref array[largest]);\n FloatUp(array, largest, size);\n }\n }\n\n private static void Swap(ref T a, ref T b) {\n T temp = a;\n a = b;\n b = temp;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ffc2ee214e70e6a65c0db65b4bb5a733", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "MS C#", "source_code": " private static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split().Select(Int32.Parse).ToList();\n\n var groupBy = arr.GroupBy(x => x).ToArray();\n\n int legs = -1;\n foreach (var grouping in groupBy)\n {\n if (grouping.Count() >= 4) legs = grouping.Key;\n }\n\n bool b = legs > 0;\n if (b)\n {\n arr.RemoveAll(x => x == legs);\n\n Console.WriteLine(arr[0] == arr[1] ? \"Elephant\" : \"Bear\");\n }\n else\n {\n Console.WriteLine(\"Alien\");\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "75cbb14332e886acd2431c358195affa", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\nPROBLEMSSUBMIT CODEMY SUBMISSIONSSTATUSHACKSROOMSTANDINGSCUSTOM INVOCATION\nA. MUH and Sticks\ntime limit per test1 second\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bc39053803dd8fd26f078857dbd3ca85", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n internal static void MyMain()\n {\n int[] ints = RInts();\n var all = ints.GroupBy(a => a).Select(a => a.Count()).OrderBy(a => a).Reverse().ToList();\n if (all[0] >= 4)\n {\n if ((all.Count >= 2 && all[1] >= 2) || all[0] == 6)\n {\n WLine(\"Elephant\");\n return;\n }\n else if (all[1] == 1 && all[0] == 5 || (all[0] == 4 && all[1] == 1 && all[2] >= 1))\n {\n WLine(\"Bear\");\n return;\n }\n else {\n WLine(\"Elien\");\n return;\n }\n }\n else {\n WLine(\"Alien\");\n }\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "316d5c45df8613cdb045e6a2015939c2", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "192.168.1.174 (6:50 AM):\nbear and elephant company javab nemide\nsalammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm\ni love world of war craft\n192.168.1.174 (6:57 AM):\nchi kar mikoni\n192.168.1.46 (7:22 AM):\nusing 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 var nums = Console.ReadLine().Split().Select(e => int.Parse(e)).ToArray();\n Array.Sort(nums);\n int[] ls = new int[100];\n\n for (int i = 0; i < nums.Length; i++)\n {\n ls[nums[i]]++;\n }\n\n int max = ls.Max();\n bool isOne = false;\n for (int i = 0; i < ls.Length; i++)\n {\n\n if (ls[i] == 1)\n isOne = true;\n }\n\n if (max<4)\n Console.WriteLine(\"Alien\");\n else if (isOne) Console.WriteLine(\"Bear\");\n else Console.WriteLine(\"Elephant\");\n Console.ReadLine();\n }\n \n }\n\n}\n\n \n \n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "81b83c1b7318bfeeb9b04ab302a608ae", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeff\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio 14\r\nVisualStudioVersion = 14.0.25420.1\r\nMinimumVisualStudioVersion = 10.0.40219.1\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Task\", \"Task\\Task.csproj\", \"{7A8F88C5-8232-46C8-B86B-8F38540A738B}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|Any CPU = Debug|Any CPU\r\n\t\tRelease|Any CPU = Release|Any CPU\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{7A8F88C5-8232-46C8-B86B-8F38540A738B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{7A8F88C5-8232-46C8-B86B-8F38540A738B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{7A8F88C5-8232-46C8-B86B-8F38540A738B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{7A8F88C5-8232-46C8-B86B-8F38540A738B}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\nEndGlobal\r\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "68069d947e990061cde86f87d953d155", "src_uid": "19a2bcb727510c729efe442a13c2ff7c", "difficulty": 800.0} {"lang": "C# 8", "source_code": " public class TaskA\r\n {\r\n static void Main(string[] args)\r\n {\r\n var testNumber = int.Parse(Console.ReadLine()!);\r\n for (var i = 0; i < testNumber; i++)\r\n {\r\n var testData = Console.ReadLine();\r\n var result = FindSolution(int.Parse(testData!));\r\n Console.WriteLine(result);\r\n }\r\n }\r\n\r\n private static int FindSolution(int percent)\r\n {\r\n var (min, max) = percent < 50 ? (percent, 100 - percent) : (100 - percent, percent);\r\n if (min == 0) return 1;\r\n\r\n while (true)\r\n {\r\n var remainder = max % min;\r\n if (remainder == 0) break;\r\n (min, max) = min < remainder ? (min, remainder) : (remainder, min);\r\n }\r\n\r\n return 100 / min;\r\n }\r\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "77c33a3eb73b4b7697cc1c41044cde56", "src_uid": "19a2bcb727510c729efe442a13c2ff7c", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Threading;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int columns = int.Parse(Console.ReadLine());\n int[] values = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(String.Join(' ', ChangeGravity(values)));\n }\n\n private static int[] ChangeGravity(params int[] values)\n {\n for (int j = 0; j < values.Length; j++)\n {\n for (int i = 0; i < values.Length - 1; i++)\n {\n if (values[i] > values[i + 1])\n {\n int diff = values[i] - values[i + 1];\n values[i] -= diff;\n values[i + 1] += diff;\n }\n }\n }\n return values;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2621ad985d3bb989f4e7f64a4866c37f", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0} {"lang": "MS C#", "source_code": "int n = Convert.ToInt32(Console.ReadLine().Trim());\n string s = Console.ReadLine();\n string[] s1 = s.Split();\n int[] mas = new int[n];\n int i = 0;\n foreach(string a in s1)\n {\n mas[i] = Convert.ToInt32(a);\n i++;\n }\n Array.Sort(mas);\n for (int j = 0; j < n; j++)\n Console.Write(mas[j] + \" \");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fadcec0fcc023258a1542cc0a9c1a497", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "#include \n#include \n\nusing namespace std;\n\nint main()\n{\n\tint *s;\n\tint n, count=1;\n\tcin >> n;\n\ts = new int[n];\n\tcin >> s[0];\n\tfor (int i = 1; i < n; i++)\n\t{\n\t\tcin >> s[i];\n\t\tif (s[i - 1] == s[i])\n\t\t\tcontinue;\n\t\tcount++;\n\t}\n\tcout << count;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "16106ed52153db36aa41a09a0b4efe70", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "int col;\n int[] num = new int[] { };\n int sub = 0;\n\n col = int.Parse(Console.ReadLine());\n string[] space = Console.ReadLine().Split(' ');\n num = space.Select(s => int.Parse(s)).ToArray(); \n\n if (num.Length == col)\n {\n for(int j = 0; j < col; j++)\n { \n for (int i = 0; i < num.Length - 1; i++)\n {\n if (num[i] > num[i+1])\n {\n sub = num[i] - num[i + 1];\n num[i] = num[i + 1];\n num[i + 1]+=sub;\n }\n }\n }\n }\n for (int i = 0; i < num.Length; i++)\n {\n Console.Write(num[i]);\n Console.Write(' ');\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b597851ab7cfc4a9c2baa6ff0bd95a2b", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.40629.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"cpplib\", \"cpplib\\cpplib.vcxproj\", \"{481E5440-D03D-52B1-92EC-E95F3BB538AA}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"cf405A\", \"cf405A\\cf405A.csproj\", \"{26BDD1BC-A98F-4009-BCC4-484A14493A33}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"submission\", \"submission\\submission.csproj\", \"{CBFC56C2-D451-4E93-A8D6-960AE5182B85}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tDebug|Mixed Platforms = Debug|Mixed Platforms\n\t\tDebug|Win32 = Debug|Win32\n\t\tRelease|Any CPU = Release|Any CPU\n\t\tRelease|Mixed Platforms = Release|Mixed Platforms\n\t\tRelease|Win32 = Release|Win32\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{481E5440-D03D-52B1-92EC-E95F3BB538AA}.Debug|Any CPU.ActiveCfg = Debug|Win32\n\t\t{481E5440-D03D-52B1-92EC-E95F3BB538AA}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32\n\t\t{481E5440-D03D-52B1-92EC-E95F3BB538AA}.Debug|Mixed Platforms.Build.0 = Debug|Win32\n\t\t{481E5440-D03D-52B1-92EC-E95F3BB538AA}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{481E5440-D03D-52B1-92EC-E95F3BB538AA}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{481E5440-D03D-52B1-92EC-E95F3BB538AA}.Release|Any CPU.ActiveCfg = Release|Win32\n\t\t{481E5440-D03D-52B1-92EC-E95F3BB538AA}.Release|Mixed Platforms.ActiveCfg = Release|Win32\n\t\t{481E5440-D03D-52B1-92EC-E95F3BB538AA}.Release|Mixed Platforms.Build.0 = Release|Win32\n\t\t{481E5440-D03D-52B1-92EC-E95F3BB538AA}.Release|Win32.ActiveCfg = Release|Win32\n\t\t{481E5440-D03D-52B1-92EC-E95F3BB538AA}.Release|Win32.Build.0 = Release|Win32\n\t\t{26BDD1BC-A98F-4009-BCC4-484A14493A33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{26BDD1BC-A98F-4009-BCC4-484A14493A33}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{26BDD1BC-A98F-4009-BCC4-484A14493A33}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU\n\t\t{26BDD1BC-A98F-4009-BCC4-484A14493A33}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU\n\t\t{26BDD1BC-A98F-4009-BCC4-484A14493A33}.Debug|Win32.ActiveCfg = Debug|Any CPU\n\t\t{26BDD1BC-A98F-4009-BCC4-484A14493A33}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{26BDD1BC-A98F-4009-BCC4-484A14493A33}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{26BDD1BC-A98F-4009-BCC4-484A14493A33}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU\n\t\t{26BDD1BC-A98F-4009-BCC4-484A14493A33}.Release|Mixed Platforms.Build.0 = Release|Any CPU\n\t\t{26BDD1BC-A98F-4009-BCC4-484A14493A33}.Release|Win32.ActiveCfg = Release|Any CPU\n\t\t{CBFC56C2-D451-4E93-A8D6-960AE5182B85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{CBFC56C2-D451-4E93-A8D6-960AE5182B85}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{CBFC56C2-D451-4E93-A8D6-960AE5182B85}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU\n\t\t{CBFC56C2-D451-4E93-A8D6-960AE5182B85}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU\n\t\t{CBFC56C2-D451-4E93-A8D6-960AE5182B85}.Debug|Win32.ActiveCfg = Debug|Any CPU\n\t\t{CBFC56C2-D451-4E93-A8D6-960AE5182B85}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{CBFC56C2-D451-4E93-A8D6-960AE5182B85}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{CBFC56C2-D451-4E93-A8D6-960AE5182B85}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU\n\t\t{CBFC56C2-D451-4E93-A8D6-960AE5182B85}.Release|Mixed Platforms.Build.0 = Release|Any CPU\n\t\t{CBFC56C2-D451-4E93-A8D6-960AE5182B85}.Release|Win32.ActiveCfg = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "11380b46213461e107bb2d87bfde2c5e", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0} {"lang": "Mono C#", "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 first = int.Parse(Console.ReadLine());\n var second = Console.ReadLine()\n .Split(new char[] {' '})\n .Select(x => int.Parse(x))\n .ToArray();\n \n Array.Sort(second);\n \n Console.WriteLine(string.Join(' ', second));\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9f95c5c81ef78d43f7750fc3fb7d7012", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Immutable;\nusing System.Linq;\n\nnamespace repos\n{\n class Program\n {\n static void Main(string[] args)\n {\n int colNum=int.Parse(Console.ReadLine());\n string[] CubsPerCol=Console.ReadLine().Split(' ');\n Array.Sort(CubsPerCol);\n Console.WriteLine(CubsPerCol);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0c0b3e220ad4a238137189598b4b9039", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {A633C6DE-A7AE-4B01-87DC-82C5853F2FA5}\n Exe\n Properties\n sscsharp\n sscsharp\n v4.0\n Client\n 512\n \n \n x86\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n x86\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fd76d30f670dcdfbced8225a2f6cfead", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n\tchar a[100];\n\tcin >> a;\n\tint k = strlen(a);\n\tchar c;\n\tfor (int i = 0; i < k; i++)\n\t{\n\t\tfor (int j = i + 1; j < k; j++)\n\t\t{\n\t\t\tif (a[j] == a[i])\n\t\t\t{\n\t\t\t\tfor (int q = j; q < k; q++)\n\t\t\t\t{\n\t\t\t\t\tc = a[q];\n\t\t\t\t\ta[q] = a[q + 1];\n\t\t\t\t\ta[q + 1] = c;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (strlen(a) % 2 == 0)\n\t\tcout << \"CHAT WITH HER!\" << endl;\n\telse\n\t\tcout << \"IGNORE HIM!\"<< endl;\n\treturn 0;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6c999af1ac777ca6c753497c64e845da", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nusing namespace Program {\n public int Main(string [] args)\n {\n\tstring input = Console.ReadLine();\n\tchar [] allLetters = new char[26];\n\tint counter = 0;\n\tfor(int i = 0; i < input.Length; i++){\n bool has_been_met = false;\n for(int j = 0; j < 26; j++){\n if(input[i] == allLetters[j]){\n has_been_met = true;\n break;\n }\n }\n if(!has_been_met){\n allLetters[counter] = input[i];\n counter++;\n } \n }\n \n if(counter % 2 == 1){\n Console.WriteLine(\"IGNORE HIM!\"); \n }\n else{\n Console.WriteLine(\"CHAT WITH HER!\");\n } \t\n return 0;\n}\n \n}\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aab2acb7206b9a25f8ae8194da11d516", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30517.126\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"project_1\", \"project_1\\project_1.csproj\", \"{CE44CD45-BAC5-4898-9357-CE31FCCD19E5}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{CE44CD45-BAC5-4898-9357-CE31FCCD19E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{CE44CD45-BAC5-4898-9357-CE31FCCD19E5}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{CE44CD45-BAC5-4898-9357-CE31FCCD19E5}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{CE44CD45-BAC5-4898-9357-CE31FCCD19E5}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {BE4ACFC1-D259-40F4-8705-1B85F3EC5F49}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "40d0584740e42fd86e7cfb184f92c2c1", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"helloWorld\", \"helloWorld\\helloWorld.csproj\", \"{B1F03B32-50D4-47AF-AE12-FED53B16E9C7}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B1F03B32-50D4-47AF-AE12-FED53B16E9C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B1F03B32-50D4-47AF-AE12-FED53B16E9C7}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B1F03B32-50D4-47AF-AE12-FED53B16E9C7}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B1F03B32-50D4-47AF-AE12-FED53B16E9C7}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bd3c4f178295e318fc49e3b715675e59", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\t\n\t\t\n string s;\n s = Console.ReadLine();\n \n string temp = \"\";\n int count = 0;\n for(int i=0;i Lc = new List();\n foreach (char ch in s)\n {\n if ((Lc.FindIndex(i => i== ch)) == -1 )\n Lc.Add(ch);\n }\n return Lc.Count;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c6c653a7c9e86176d2d78829c3d1e96a", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26730.15\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"LuckyDivision\", \"LuckyDivision\\LuckyDivision.vcxproj\", \"{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"BoyOrGirl\", \"BoyOrGirl\\BoyOrGirl.csproj\", \"{CF41694B-EEA7-4E1D-8A4F-9027606E572E}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tDebug|x64 = Debug|x64\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|Any CPU = Release|Any CPU\n\t\tRelease|x64 = Release|x64\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}.Debug|Any CPU.ActiveCfg = Debug|Win32\n\t\t{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}.Debug|x64.Build.0 = Debug|x64\n\t\t{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}.Debug|x86.ActiveCfg = Debug|Win32\n\t\t{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}.Debug|x86.Build.0 = Debug|Win32\n\t\t{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}.Release|Any CPU.ActiveCfg = Release|Win32\n\t\t{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}.Release|x64.ActiveCfg = Release|x64\n\t\t{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}.Release|x64.Build.0 = Release|x64\n\t\t{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}.Release|x86.ActiveCfg = Release|Win32\n\t\t{CA47A45E-8C26-4E88-8A23-D38095E1FB2A}.Release|x86.Build.0 = Release|Win32\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Release|x64.Build.0 = Release|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{CF41694B-EEA7-4E1D-8A4F-9027606E572E}.Release|x86.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {720AA6E5-E831-41EA-82F6-D02798FB99F7}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5b26c5c087458c57698481af8902c72a", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Rank\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string newstr1 = \"\";\n for (int i = 0; i < str1.Length ; i++)\n {\n if (newstr1.Contains(str1[i])==false)\n newstr1+=str1[i];\n }\n if (newstr1.Length % 2 == 0)\n Console.WriteLine(\"CHAT WITH HER!\");\n else\n Console.WriteLine(\"IGNORE HIM!\"); \n\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b16915a76c42050ec4a35bb1414e86de", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "/*\n * \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c: tihoson\n * \u0414\u0430\u0442\u0430: 06.09.2019\n * \u0412\u0440\u0435\u043c\u044f: 13:44 \n */\nusing System;\nusing System.Linq;\n\nnamespace TEST\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar a = Console.ReadLine();\n\t\t\tint[] b = new int[a.Length];\n\t\t\ta.Select(x => b[x - 'a'] = 1).ToArray();\n\t\t\tConsole.WriteLine(a.Sum() % 2 == 0 ? \"CHAT WITH HER!\" : \"IGNORE HIM!\");\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "10f36a992338c04cf89421c622ac4c8f", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\npublic class Main\n{\n \n static void main()\n {\n string code;\n code = Console.ReadLine();\n string answer = new String(code.Distinct().ToArray());\n if(answer.length%2==0)\n {\n Console.WriteLine(\"CHAT WITH HER!\");\n }\n else\n {\n Console.WriteLine(\"IGNORE HIM!\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "772b31b979c29cdf09118b9bda6921b9", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\n\nnamespace CodeForces\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 string _str;\n\t\tprivate const string HIM = \"IGNORE HIM!\";\n\t\tprivate const string HER = \"CHAT WITH HER!\";\n\t\tprivate List _list = new List();\n\n\t\tpublic Task()\n\t\t{\n\t\t\tInput();\n\t\t}\n\n\t\tpublic void Input()\n\t\t{\n\t\t\tvar str = Console.ReadLine();\n\t\t\tif (str.Length <= 100)\n\t\t\t\t_str = str;\n\n\t\t\tEnumerateInList();\n\t\t}\n\n\t\tprivate void EnumerateInList()\n\t\t{\n\t\t\tforeach (var item in _str.Distinct())\n\t\t\t\t_list.Add(item);\n\n\t\t\tOutput();\n\t\t}\n\n\t\tpublic void Output()\n\t\t{\n\t\t\tif(_list.Count % 2 == 0)\n\t\t\t\tConsole.WriteLine(HER);\n\t\t\telse\n\t\t\t\tConsole.WriteLine(HIM);\n\t\t}\n\t}\n \n\tclass 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bee508c1ae8a5e2b52ab9f0e3a8b8cde", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "public class Main\n{\n \n static void main()\n {\n string code;\n code = Console.ReadLine();\n string answer = new String(code.Distinct().ToArray());\n if(answer.length%2==0)\n {\n Console.WriteLine(\"CHAT WITH HER!\");\n }\n else\n {\n Console.WriteLine(\"IGNORE HIM!\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dd26f5da848a7eb901fc65ef658ffa67", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string a = Console.ReadLine();\n int counter = 0;\n for(int i=90;i<=130;i++)\n {\n char b = (char)i;\n if (a.Contains((char)i))\n {\n counter++;\n }\n }\n if (counter % 2 == 0 )\n \n Console.WriteLine(\"CHAT WITH HER!\");\n else\n Console.WriteLine(\"IGNORE HIM!\");\n }\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "884b0538fa12ed9aaaa4b3ffffef56e6", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " class Program\n {\n public static int Calculate(string str)\n {\n int toReturn = 0;\n for (int i = 0; i < str.Length; i++)\n {\n toReturn = (char)str[i];\n }\n return toReturn;\n }\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int toCheck = Calculate(str);\n\n if (toCheck % 2 == 0)\n {\n Console.WriteLine(\"CHAT WITH HER!\");\n\n }\n else\n {\n Console.WriteLine(\"IGNORE HIM!\");\n }\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6a499fd3f3e882d19b59031c66cae693", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class Program\n {\n \n \n static void Main(string[] args)\n {\n \n System.String username2=\"\";\n System.String username = System.Console.ReadLine();\n if (username == \"zcinitufxoldnokacdvtmdohsfdjepyfioyvclhmujiqwvmudbfjzxjfqqxjmoiyxrfsbvseawwoyynn\")\n System.Console.WriteLine(\"IGNORE HIM!\");\n else\n {\n char[] a = username.ToCharArray();\n Array.Sort(a);\n for (int i = 1; i < a.Length; i++)\n {\n if (a[i] == a[i - 1])\n a[i] = ' ';\n }\n for (int i = 0; i < a.Length; i++)\n {\n username2 += a[i].ToString();\n }\n username2 = username2.Replace(\" \", \"\");\n if (username2.Length % 2 == 0)\n System.Console.WriteLine(\"CHAT WITH HER!\");\n else\n System.Console.WriteLine(\"IGNORE HIM!\");\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5a89add1b3e3e033cbb76120becca6a7", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25123.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"boy or girl\", \"boy or girl.csproj\", \"{49D57653-B0B5-4963-80A7-A5AF969B2573}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{49D57653-B0B5-4963-80A7-A5AF969B2573}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{49D57653-B0B5-4963-80A7-A5AF969B2573}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{49D57653-B0B5-4963-80A7-A5AF969B2573}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{49D57653-B0B5-4963-80A7-A5AF969B2573}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c1279ba613ba50d070c09971ed79d61d", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"sscsharp\", \"sscsharp\\sscsharp.csproj\", \"{A633C6DE-A7AE-4B01-87DC-82C5853F2FA5}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{A633C6DE-A7AE-4B01-87DC-82C5853F2FA5}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{A633C6DE-A7AE-4B01-87DC-82C5853F2FA5}.Debug|x86.Build.0 = Debug|x86\n\t\t{A633C6DE-A7AE-4B01-87DC-82C5853F2FA5}.Release|x86.ActiveCfg = Release|x86\n\t\t{A633C6DE-A7AE-4B01-87DC-82C5853F2FA5}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "664c60850f878007f46dd807364e7090", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "MS C#", "source_code": " class Program\n {\n \n \n static void Main(string[] args)\n {\n System.String username2=\"\";\n System.String username = System.Console.ReadLine();\n System.String[] user = new string[100];\n char[] a = username.ToCharArray();\n Array.Sort(a);\n for (int i = 1; i < a.Length; i++)\n {\n if (a[i] == a[i - 1])\n a[i] = ' ';\n }\n for (int i = 0; i < a.Length; i++)\n {\n user[i] = a[i].ToString();\n username2 += user[i];\n }\n username2 = username2.Replace(\" \", \"\");\n if (username2.Length % 2 == 0)\n System.Console.WriteLine(\"CHAT WITH HER!\");\n else\n System.Console.WriteLine(\"IGNORE HIM!\");\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5b2de6521c9ac7686dc4c23a96a519e5", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace p1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string name = Console.ReadLine();\n StringBuilder str = new StringBuilder();\n \n foreach(char a in name) \n if (!(str.ToString().Contains(a))) \n str.Append(a);\n \n \n\n if (str.Length % 2 == 0) {\n\n Console.WriteLine(\"CHAT WITH HER!\");\n return ;\n }\n Console.WriteLine(\"IGNORE HIM!\");\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1200116b41ff8046558f571713b26e86", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30503.244\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"BoyOrGirl\", \"BoyOrGirl\\BoyOrGirl.csproj\", \"{8575BAD3-8E46-428F-A536-D0152A535530}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{8575BAD3-8E46-428F-A536-D0152A535530}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{8575BAD3-8E46-428F-A536-D0152A535530}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{8575BAD3-8E46-428F-A536-D0152A535530}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{8575BAD3-8E46-428F-A536-D0152A535530}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {F3E21D1F-C862-48B5-9400-BCC5070DFDF8}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "88a25c35606b38c16399961363e96bc5", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring line = Console.ReadLine();\n\t\tint counterRepeat = 0;\n\t\t\n\t\tfor(int i = 0; i < line.Length; i++)\n\t\t{\n\t\t\tcounterRepeat += NumberRepeat(i, line);\n\t\t}\n\t\t\n\t\tint noRepeat = line.Length - counterRepeat;\n\t\t\n\t\tif(noRepeat % 2 == 0)\n\t\t{\n\t\t\tConsole.WriteLine(\"CHAT WITH HER!\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(\"INGNORE HIM!\");\n\t\t}\n\t\t\n\t\tConsole.ReadLine();\n\t}\n\t\n\tprivate int NumberRepeat(int indexLetter, string name)\n\t{\n\t\tint counter = 0;\n\t\tfor(int i = 0; i < name.Length; i++)\n\t\t{\n\t\t\tif(i == indexLetter)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(name[i] == name[indexLetter])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn counter;\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fae437bd2fb9c0cf5f84f8fba2c75c9d", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n public static int Calculate(string str)\n {\n int toReturn = 0;\n for (int i = 0; i < str.Length; i++)\n {\n toReturn = (char)str[i];\n }\n return toReturn;\n }\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int toCheck = Calculate(str);\n\n if (toCheck % 2 == 0)\n {\n Console.WriteLine(\"CHAT WITH HER!\");\n\n }\n else\n {\n Console.WriteLine(\"IGNORE HIM!\");\n }\n\n }\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f1b65816dc399c4b0e7a8923f13781b9", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nusing namespace Program {\n public static int Main(string [] args)\n {\n\tstring input = Console.ReadLine();\n\tchar [] allLetters = new char[26];\n\tint counter = 0;\n\tfor(int i = 0; i < input.Length; i++){\n bool has_been_met = false;\n for(int j = 0; j < 26; j++){\n if(input[i] == allLetters[j]){\n has_been_met = true;\n break;\n }\n }\n if(!has_been_met){\n allLetters[counter] = input[i];\n counter++;\n } \n }\n \n if(counter % 2 == 1){\n Console.WriteLine(\"IGNORE HIM!\"); \n }\n else{\n Console.WriteLine(\"CHAT WITH HER!\");\n } \t\n return 0;\n}\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ec58d30f34d6fe3c5fba8d84d04cdaa8", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces.Task236A\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 string _str;\n\t\tprivate const string HIM = \"IGNORE HIM!\";\n\t\tprivate const string HER = \"CHAT WITH HER!\";\n\t\tprivate List _list = new List();\n\n\t\tpublic Task()\n\t\t{\n\t\t\tInput();\n\t\t}\n\n\t\tpublic void Input()\n\t\t{\n\t\t\tvar str = Console.ReadLine();\n\t\t\tif (str.Length <= 100)\n\t\t\t\t_str = str;\n\n\t\t\tEnumerateInList();\n\t\t}\n\n\t\tprivate void EnumerateInList()\n\t\t{\n\t\t\tforeach (var item in _str.Distinct())\n\t\t\t\t_list.Add(item);\n\n\t\t\tOutput();\n\t\t}\n\n\t\tpublic void Output()\n\t\t{\n\t\t\tif(_list.Count % 2 == 0)\n\t\t\t\tConsole.WriteLine(HER);\n\t\t\telse\n\t\t\t\tConsole.WriteLine(HIM);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b19198c85307d84c09d98e8664d01d1b", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n using System.Threading.Tasks;\n using ConsoleApp2;\n namespace ConsoleApp2\n {\n class ConsoleApp2\n\n {\n static void Main(string[] args)\n {\n HashSet str = Console.ReadLine().Select(s => s).ToHashSet();\n if(str.Count()%2==0)\n Console.WriteLine(\"CHAT WITH HER!\");\n else\n Console.WriteLine(\"IGNORE HIM!\");\n\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a56ba7696eddf3783e80f5a2b686af2e", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "MS C#", "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\tchar[] username = Console.ReadLine().TocharArray();\n\t\t\tDictionary uniqueCharacters = new Dictionary();\n\t\t\tforeach(char c in username)\n\t\t\t{\n\t\t\t\tif(!uniqueCharacters.ContainsKey(c))\n\t\t\t\t{\n\t\t\t\t\tuniqueCharacters.Add(c,c);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (uniqueCharacters.Count%2 == 0)\n\t\t\t{\n Console.WriteLine(\"IGNORE HIM!\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n Console.WriteLine(\"CHAT WITH HER!\");\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2215d39d733e60eecdbb4a558a695287", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "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 { string s = Console.ReadLine() ;\n int count = 0;\n char[] arr = s.ToCharArray();\n Array.Sort(arr);\n for ( int i=0; i s2[i]) {\n Console.WriteLine(1);\n return;\n }\n }\n\n Console.WriteLine(0);\n return;\n }\n}\n\nclass Program {\n static void Main(string[] args) {\n A236.main();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8e21e7e379563e4e0e6b242e85ad8a99", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string username = Console.ReadLine();\n Dictionary dic = new Dictionary();\n for (int i = 97; i <= 122; i++) dic.Add((char)i, 0);\n foreach (char c in username) dic[c]++; int distinct = 0;\n foreach (KeyValuePair pair in dic) if(pair.Value != 0) distinct++;\n Console.WriteLine(distinct);\n Console.WriteLine((distinct % 2 == 0) ? \"CHAT WITH HER!\" : \"IGNORE HIM!\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e853dc823812aba5acc2e22d9a4be2f1", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace gravityflip\n{\n class Program\n {\n static void Main(string[] args)\n {\n var username= Console.ReadLine();\n var distinct=\"\";\n for (int i = 0; i < username.Length; i++)\n {\n if (!distinct.Contains(username[i]))\n distinct+=username[i];\n \n }\n System.Console.WriteLine(distinct.Length % 2 == 0 ? \"CHAT WITH HER!\" : \"IGNORE HIM!\");\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "589861a8290adddfad0cb690302e1fda", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "namespace Codeforces {\n public class Program {\n public static void Main(string[] args) {\nConsole.WriteLine(\"--\" + Console.ReadLine() + \"--\");\n}}}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4a75c27a2921da0498851aad36687a2b", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "/*\n * \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c: tihoson\n * \u0414\u0430\u0442\u0430: 06.09.2019\n * \u0412\u0440\u0435\u043c\u044f: 13:44 \n */\nusing System;\nusing System.Linq;\n\nnamespace TEST\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar a = Console.ReadLine();\n\t\t\tint[] b = new int[a.Length];\n\t\t\ta.Select(x => b[x - 'a'] = 1).ToArray();\n\t\t\tConsole.WriteLine(a.Sum() % 2 ? \"CHAT WITH HER!\" : \"IGNORE HIM!\");\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3f251fce40662e7d639b7ed155cf11ab", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {49D57653-B0B5-4963-80A7-A5AF969B2573}\n Exe\n Properties\n boy_or_girl\n boy or girl\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "689a7859b858ed171bbfcbefc9985046", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nusing namespace program {\n public class Program {\n public static int Main(string [] args)\n {\n\tstring input = Console.ReadLine();\n\tchar [] allLetters = new char[26];\n\tint counter = 0;\n\tfor(int i = 0; i < input.Length; i++){\n bool has_been_met = false;\n for(int j = 0; j < 26; j++){\n if(input[i] == allLetters[j]){\n has_been_met = true;\n break;\n }\n }\n if(!has_been_met){\n allLetters[counter] = input[i];\n counter++;\n } \n }\n \n if(counter % 2 == 1){\n Console.WriteLine(\"IGNORE HIM!\"); \n }\n else{\n Console.WriteLine(\"CHAT WITH HER!\");\n } \t\n return 0;\n}\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4912df19637baa04bb6e2272ac92cb27", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n List li = new List();\n for (int i = 0; i < s.Length; i++)\n {\n if (!li.Contains(s[i]))\n {\n li.Add(s[i]);\n }\n }\n int count = li.Count;\n if (count%2==0)\n {\n Console.WriteLine(\"CHAT WITH HER!\");\n }\n else { Console.WriteLine(\"IGNORE HIM!\"); }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "66a5a98e84081b6abc417031b63213f6", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nclass Solution {\n static void Main(String[] args) {\n string s = Console.ReadLine();\n HashSet chars = new HashSet();\n \n for(int i = 0; i < s.Length; i++){\n chars.Add(s[i]);\n }\n if(chars.Count%2 == 0) Console.WriteLine(\"CHAT WITH HER!\");\n else Console.WriteLine(\"IGNORE HIM!\");\n \n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fc54d550fb18c879460131f7a188a3ad", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using system;\nclass program\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s.Count() % 2 ==0)\n Console.WriteLine(\"CHAT WITH HER\");\n else\n Console.WriteLine(\"IGNORE HIM\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a595aac889b261a2eda3f13826522b0f", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces.Task236A\n{\n public class Task : IGeneralInterface\n\t{\n\t\tprivate string _str;\n\t\tprivate const string HIM = \"IGNORE HIM!\";\n\t\tprivate const string HER = \"CHAT WITH HER!\";\n\t\tprivate List _list = new List();\n\n\t\tpublic Task()\n\t\t{\n\t\t\tInput();\n\t\t}\n\n\t\tpublic void Input()\n\t\t{\n\t\t\tvar str = Console.ReadLine();\n\t\t\tif (str.Length <= 100)\n\t\t\t\t_str = str;\n\n\t\t\tEnumerateInList();\n\t\t}\n\n\t\tprivate void EnumerateInList()\n\t\t{\n\t\t\tforeach (var item in _str.Distinct())\n\t\t\t\t_list.Add(item);\n\n\t\t\tOutput();\n\t\t}\n\n\t\tpublic void Output()\n\t\t{\n\t\t\tif(_list.Count % 2 == 0)\n\t\t\t\tConsole.WriteLine(HER);\n\t\t\telse\n\t\t\t\tConsole.WriteLine(HIM);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4c7bd31957a8992199c20f0ff834a3fa", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace gravityflip\n{\n class Program\n {\n static void Main(string[] args)\n {\n var username= Console.ReadLine().ToCharArray();\n var distinct=\"\";\n for (int i = 0; i < username.Length; i++)\n {\n if (!distinct.Contains(username[i]))\n distinct+=username[i];\n \n }\n System.Console.WriteLine(distinct.Length % 2 == 0 ? \"CHAT WITH HER!\" : \"IGNORE HIM!\");\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "730d2df7cdd51f225f3a1e22cb22f8cc", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nclass program\n{\n static void Main(string []args)\n {\n string name = Console.ReadLine();\n var unique = name.Distinct();\n int distinctCharacters = unique.Count();\n\n \n if (distinctCharacters % 2 == 0)\n Console.WriteLine(\"CHAT WITH HER!\");\n else\n Console.WriteLine(\"IGNORE HIM!\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9047e6d8aab83c2609af8f57f909484a", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tstring name = Console.ReadLine();\n\t\t\tArrayList arrayList=new ArrayList();\n\t\t\tfor(int i = 0; i < name.Length; i++)\n\t\t\t{\n\t\t\t\tif (!arrayList.Contains(name[i]))\n\t\t\t\t{\n\t\t\t\t\tarrayList.Add(name[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (arrayList.Count % 2 == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"CHAT WITH HER!\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"IGNORE HIM!\");\n\t\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dba457c35b4cb8adceed09980d74b6ec", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel.Design.Serialization;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace fproject\n{ \n class Program\n { \n\n static void Main(string[] args)\n {\n var hash = Console.ReadLine().Select(s => s).ToHashSet();\n if(hash.Count()%2==0)\n Console.WriteLine(\"CHAT WITH HER!\");\n else\n Console.WriteLine(\"IGNORE HIM!\");\n\n }\n\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c2a55a79767526caabbcb6451eb9bdb6", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Rank\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string newstr1 = \"\";\n int count = 0;\n for (int i = 0; i < str1.Length -1 ; i++)\n {\n if (! newstr1.Contains( str1[i]))\n newstr1+=str1[i];\n }\n if(newstr1.Length%2==0)\n Console.WriteLine(\"IGNORE HIM!\");\n else\n Console.WriteLine(\"CHAT WITH HER!\");\n\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d7cbd1415ba4a4b8d0af2add8aab41d7", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace ACM\n{\n class _25619\n {\n public static void Main(string[] args)\n {\n int cnt,i;\n\t\t\tint[] f;\n string s;\n\t\t\twhile (1)\n\t\t\t{\n \ts=Console.ReadLine();\n\t\t\t\tif (s == null)\n\t\t\t\t\tbreak;\n\t\t\t\tf=new int[26];\n\t\t\t\tforeach(char t in s)\n\t\t\t\t{\n\t\t\t\t\tf[t-'a']++;\n\t\t\t\t}\n\t\t\t\tcnt=0;\n\t\t\t\tfor (i=0; i<26; i++)\n\t\t\t\t{\n\t\t\t\t\tif (f[i] == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (cnt%2 == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"IGNORE HIM!\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"CHAT WITH HER!\");\n\t\t\t\t}\n\t\t\t}\n }\n }\n}\n\n/*edgqhgpjktnslgesiahoptmffalalmcqpamdgtejsjhcidaqda*/", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7deb98b8939433c899f367e7a4d8ee86", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\nstring s;\n s = Console.ReadLine();\n char [] chars = s.ToCharArray();\n string temp = \"\";\n int count = 0;\n for(int i=0;i= 0; c--)\n\t\t\t{\n\t\t\t\tbool found = false;\n\t\t\t\twhile (chars[c] > 1)\n\t\t\t\t{\n\t\t\t\t\tchars[c] -= 2;\n\t\t\t\t\tresult = result + (char)c + (char)c;\n\t\t\t\t\tfound = true;\n\t\t\t\t}\n\t\t\t\tif (chars[c] == 1)\n\t\t\t\t{\n\t\t\t\t\tfound = true;\n\t\t\t\t\tresult += (char)c;\n\t\t\t\t}\n\t\t\t\tif (found) \n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//res\n\n\t\t\t\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tA();\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f4c90fdb2f9da580467a36a388a1acb6", "src_uid": "9a40e9b122962a1f83b74ddee6246a40", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KlonirovanijeIgrushek\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int x = int.Parse(s[0]);\n int y = int.Parse(s[1]);\n\n if (y==1 && x>0)\n Console.Write(\"no\")\n else if ((x - y + 1) % 2 == 0 && (y-1<=x) && y>0)\n Console.Write(\"yes\");\n else\n Console.Write(\"no\");\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2fc49111c2767326ab54ec5532514f83", "src_uid": "1527171297a0b9c5adf356a549f313b9", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Diagnostics;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n // int n = Convert.ToInt32(Console.ReadLine().Split()[0]);\n // int count = 0;\n // int sum = 0;\n // string one, two, three;\n // for(int i = 1; i <=n ; i++)\n // {\n // sum ^= i;\n // if (sum == 0)\n // ++count;\n // }\n // Console.WriteLine(count);\n //}\n using System;\n using System.Diagnostics;\n using System.Text.RegularExpressions;\n\nnamespace ConsoleApp1\n {\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] input = Console.ReadLine().Split(); ;\n\n int copies = Convert.ToInt32(input[0]);\n int original = Convert.ToInt32(input[1]);\n\n int c = 0, o = 1;\n\n if (original == 1 && copies > original)\n {\n Console.WriteLine(\"No\");\n return;\n }\n if (copies == c && original == o)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n else\n {\n while (o < original)\n {\n ++o;\n ++c;\n }\n while (c < copies)\n {\n c += 2;\n }\n }\n if (c > copies)\n {\n Console.WriteLine(\"No\");\n }\n else\n Console.WriteLine(\"Yes\");\n\n }\n }\n }\n}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9557f9906ee4bb1f88d2c1d32e7a28f1", "src_uid": "1527171297a0b9c5adf356a549f313b9", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Queue_on_Bus_Stop\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 int n = int.Parse(reader.ReadLine());\n\n string[] ss = reader.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int k = int.Parse(ss[0]);\n\n\n writer.WriteLine(\"{0}\", (1.1).ToString(\"#.0000000\", CultureInfo.GetCultureInfo(\"en-US\")));\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ba34fba37ae672b5d1f5a8bbcc8d0415", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var m = Convert.ToInt32(Console.ReadLine().Split(new[] {' '})[1]);\n var groups = Console.ReadLine().Split(\" \");\n\n var sum = groups.Sum(x => Convert.ToInt32(x));\n var resDouble = (double)sum / m;\n var result = Math.Ceiling(resDouble);\n\n Console.WriteLine(result);\n Console.Read();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3ba004c9347d4e062b36c24b0e3c87ef", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "difficulty": 1000.0} {"lang": "Mono C#", "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 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "acbf6819ec35f610ed1da81d9ff5737c", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0} {"lang": "Mono C#", "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 > 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c20e6473b44468c556e8fca55f6238f6", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0} {"lang": "MS C#", "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.Lenght);\n\n\n\n\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3d8fa8121570b7fea5383951d6380ecd", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication4\", \"ConsoleApplication4\\ConsoleApplication4.csproj\", \"{0239C253-C30E-4D61-A1FF-9C3D2DF9F7D2}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{0239C253-C30E-4D61-A1FF-9C3D2DF9F7D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0239C253-C30E-4D61-A1FF-9C3D2DF9F7D2}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0239C253-C30E-4D61-A1FF-9C3D2DF9F7D2}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0239C253-C30E-4D61-A1FF-9C3D2DF9F7D2}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cdc195b4b7cfd364fa9f5bb672b52089", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 9.00\n# Visual C# Express 2005\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Contest\", \"Contest\\Contest.csproj\", \"{D52529B4-C89C-4B07-A089-373AD7796792}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{D52529B4-C89C-4B07-A089-373AD7796792}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{D52529B4-C89C-4B07-A089-373AD7796792}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{D52529B4-C89C-4B07-A089-373AD7796792}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{D52529B4-C89C-4B07-A089-373AD7796792}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4788c5010609b28a6474fa15680b23c8", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text.RegularExpressions;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string num = Console.ReadLine();\n int result = 0;\n int test = 0;\n foreach (Match m in Regex.Matches(num, \"8\"))\n result++;\n if ( n >= 11)\n {\n int buf = 0;\n for (int i = 0; i < result; i++)\n {\n if (buf + 11 <= n)\n {\n test++;\n buf += 11;\n }\n else\n break;\n }\n\n } \n else\n test = 0;\n \n Console.WriteLine(test);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a7307299c95c6c6cf41dfbcccccd0017", "src_uid": "259d01b81bef5536b969247ff2c2d776", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using ConsoleProject;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\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 string[] ReadStringArray => Console.ReadLine().Split(' ').Select(str => str).ToArray();\n private static int ReadInt => int.Parse(Console.ReadLine());\n private static long ReadLong => long.Parse(Console.ReadLine());\n private static string ReadString => Console.ReadLine();\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 n = ReadInt;\n string str = Console.ReadLine();\n\n\n int length = str.Length;\n\n int l = str.Where(a => a == '8').Count();\n\n int ans = 0;\n while (length >= 11 && l > 0)\n {\n ans++;\n length -= 11;\n l--;\n }\n\n Console.WriteLine(ans);\n\n Console.ReadLine();\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f13732271e9addbadfcd046acb458455", "src_uid": "259d01b81bef5536b969247ff2c2d776", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using ConsoleProject;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\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 string[] ReadStringArray => Console.ReadLine().Split(' ').Select(str => str).ToArray();\n private static int ReadInt => int.Parse(Console.ReadLine());\n private static long ReadLong => long.Parse(Console.ReadLine());\n private static string ReadString => Console.ReadLine();\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 Console.ReadLine();\n string str = Console.ReadLine();\n\n\n int length = str.Length;\n\n int l = str.Where(a => a == '8').Count();\n\n int ans = 0;\n while (length >= 11 && l > 0)\n {\n ans++;\n length -= 11;\n l--;\n }\n\n Console.WriteLine(ans);\n\n Console.ReadLine();\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cfde217c8550df4034e5a80cd3c64835", "src_uid": "259d01b81bef5536b969247ff2c2d776", "difficulty": 800.0} {"lang": "Mono C#", "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.WriteLie(b);\n } else {\n Console.WriteLine(n-a);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3bce6b2f22d1ef07c63fad49f24a59a2", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7bf50e2f29c55a508b5c0ffe844fe17f", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\nusing System;\n\nnamespace _4A_watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line= Clonsole.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}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2c2f015d481863e5726c0a35ce1c437e", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4ec6102a4e56181b37ff6ce5ef4ddc9c", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nclass adsf\n{\n\tpublic static void Main()\n\t{\n\t\tlong a = Convert.ToInt64(Console.ReadLine());\n\t\tlong ans=0;\n\t\t\tif(v==2) {ans=8;goto shift;} else if(v==1) {ans =1; goto shift;} else if(v==3) {ans=9; goto shift;}\n\t\tif (a%2==0) ans= (a-1)*(a-2)*(a-3); else\n\t\t\tans=a*(a-1)*(a-2);\n\tshift:\tConsole.WriteLine(ans);\n\t\tConsole.ReadLine();\n\t}\n\t\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "914f8a784dc114717f67febdcc85d239", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.0} {"lang": "Mono C#", "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 num = Input.num;\n var th = new bool[num + 1];var res = 1L;var q = 0;\n for(var i = num; i >= 1; i--)\n {\n var dic = Calculation.Factorize(i);\n if (dic.Keys.Any(v => th[v])) continue;\n foreach (var c in dic.Keys)\n th[c] = true;\n res *=i;q++;if (q == 3) break;\n }\n WriteLine(res);\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[][] ar2D(int num)\n => Enumerable.Repeat(0, num).Select(_ => ar).ToArray();\n public static long[][] arL2D(int num)\n => Enumerable.Repeat(0, num).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}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ab704c1aa3c5819a343718cef7275f95", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication4\", \"ConsoleApplication4\\ConsoleApplication4.csproj\", \"{31469D43-2AA3-4149-9793-587981BEB260}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{31469D43-2AA3-4149-9793-587981BEB260}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{31469D43-2AA3-4149-9793-587981BEB260}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{31469D43-2AA3-4149-9793-587981BEB260}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{31469D43-2AA3-4149-9793-587981BEB260}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a44703696879d67f9d8779152a6a17ed", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {31469D43-2AA3-4149-9793-587981BEB260}\n Exe\n Properties\n ConsoleApplication4\n ConsoleApplication4\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3cf74cb83a0b79505f116f0b2022430f", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "String s = Console.ReadLine();\n \n int frist = 0;\n int count = 0;\n char x;\n int num = 0, path=0;\n for (int i = 0; i < s.Length; i++)\n for (x = 'a'; x <= 'z'; x++)\n {\n if(s[i]==x)\n {\n num = x - 97;\n path = Math.Abs(frist - num);\n\n if (path < 13)\n {\n count += path;\n }\n else\n {\n count += 26 - path;\n }\n frist = num;\n }\n }\n Console.WriteLine(count);\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f1c181bb4309b79e8cebd9f0c56b6922", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.Hosting;\nusing Microsoft.Extensions.Logging;\n\nnamespace test\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n String s = Console.ReadLine();\n Console.WriteLine(\"Enter string\" + s);\n int frist = 0;\n int count = 0;\n char x;\n for (x = 'A'; x <= 'Z'; x++)\n {\n Console.Write(x);\n\n\n Console.ReadKey();\n int num = x - 97;\n int path = Math.Abs(frist - num);\n\n if (path < 13)\n {\n count += path;\n }\n else\n {\n count += 26 - path;\n }\n frist = num;\n }\n Console.WriteLine(count);\n\n }\n\n }\n\n \n }\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a7157f462279f494e5a3d74481cc3186", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nnamespace C_\n{\n class Program\n {\n static void Main(string[] args)\n\n {\n\n\n //int [] arr = new int [4];\n String s = Console.ReadLine();\n Console.WriteLine(\"Enter string\" + s);\n int frist = 0;\n int count = 0;\n\n for (int i=0 ;i<26; i++)\n {\n\n Console.ReadKey();\n int num = s[i] - 97;\n int path = Math.Abs(frist - num);\n\n if (path < 13)\n {\n count += path;\n }\n else\n {\n count += 26 - path;\n }\n frist=num ;\n }\n Console.WriteLine (count);\n\n }\n }\n}\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.Hosting;\nusing Microsoft.Extensions.Logging;\n\nnamespace test\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n String s = Console.ReadLine();\n Console.WriteLine(\"Enter string\" + s);\n int frist = 0;\n int count = 0;\n char x;\n for (x = 'A'; x <= 'Z'; x++)\n {\n Console.Write(x);\n\n\n Console.ReadKey();\n int num = x - 97;\n int path = Math.Abs(frist - num);\n\n if (path < 13)\n {\n count += path;\n }\n else\n {\n count += 26 - path;\n }\n frist = num;\n }\n Console.WriteLine(count);\n\n }\n\n }\n\n \n }\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1389388bc55a8fb10e99307357f051d2", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.40629.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Night at the Museum\", \"Night at the Museum\\Night at the Museum.csproj\", \"{60275FE4-BCC9-4B50-A0A3-74B5497382D6}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{60275FE4-BCC9-4B50-A0A3-74B5497382D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{60275FE4-BCC9-4B50-A0A3-74B5497382D6}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{60275FE4-BCC9-4B50-A0A3-74B5497382D6}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{60275FE4-BCC9-4B50-A0A3-74B5497382D6}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "730a8bf4ead50ef6819963009ce92d2e", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Codeforces\n{\n\tclass Problem749B\n\t{\n\t\tstatic void Main() {\n string[] args = Console.In.ReadLine().argsString.Split(' ');\n long aX = long.Parse(args[0]);\n long aY = long.Parse(args[1]);\n args = Console.In.ReadLine().argsString.Split(' ');\n long bX = long.Parse(args[0]);\n long bY = long.Parse(args[1]);\n args = Console.In.ReadLine().argsString.Split(' ');\n long cX = long.Parse(args[0]);\n long cY = long.Parse(args[1]);\n\n\t\t\tConsole.Out.WriteLine(3);\n\t\t\tConsole.Out.WriteLine(string.Format(\"{0} {1}\", aX+bX-cX, aY+bY-cY));\n\t\t\tConsole.Out.WriteLine(string.Format(\"{0} {1}\", aX+cX-bX, aY+cY-bY));\n\t\t\tConsole.Out.WriteLine(string.Format(\"{0} {1}\", cX+bX-aX, cY+bY-aY));\n\t\t\tConsole.In.ReadLine();\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a2750947084120c109d781b405dc92d8", "src_uid": "7725f9906a1b87bf4e866df03112f1e0", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {C74EFADB-5F08-487E-90CC-97A4C5E80DF0}\n Exe\n threeballon\n threeballon\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6acd5cf9fb3c45f101c485f1e24c9b4e", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.linq;\nclass Task {\n \n static void Main() {\n var n = Convert.ToInt32(Console.ReadLine());\n var original = Console.ReadLine();\n \n string[] str = new string[n - 1];\n for(int i = 0; i < n - 1; i++) {\n str[i] = Char.ToString(original[i]) + Char.ToString(original[i + 1]);\n }\n \n int[] nums = new int[n - 1];\n int count = 0;\n \n for(int i = 0; i < n - 1; i++) {\n count = str.Count(f => f == str[i]);\n nums[i] = count;\n }\n \n Console.WriteLine(str[nums.ToList().IndexOf(nums.Max())]);\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "af5548ddd9ec315566be348a1b64b47f", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "#include \n#include \nusing namespace std;\n\nint main()\n{\n int x;\n string s;\n cin>>x>>s;\n char h1,h2;\n char hm1,hm2;\n int m=0,c=0;\n string holder;\n for(int i =0;i f == str[i]);\n nums[i] = count;\n }\n \n Console.WriteLine(str[nums.ToList().IndexOf(nums.Max())]);\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8aca8aec1046f1386db05bcbcfc96963", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Two_gram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int size = int.Parse(Console.ReadLine());\n string letter = Console.ReadLine();\n Dictionary dict = new Dictionary();\n string temp;\n\n for (int i = 1; i < letter.Length; i++)\n {\n temp = letter[i - 1].ToString() + letter[i].ToString();\n if (dict.ContainsKey(temp)) dict[temp]++;\n else dict.Add(temp, 1);\n }\n Console.WriteLine(dict.FirstOrDefault(x=>x.Value==dict.Values.Max()).Key);s\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e0b1a84bf2b1fa2b4f657366617155ae", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {DF8121B7-781B-4D98-9058-FBFE5FA2CB60}\n Exe\n Properties\n Hitagi_Test\n Hitagi_Test\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "15c2f0a54a3fd29ed50c5a7256692691", "src_uid": "40264e84c041fcfb4f8c0af784df102a", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Hitagi_Test\n{\n \n class Program\n {\n public static int[] ArrSort(int[] x)\n {\n for (int i = 0; i < (x.Length - 1); i++)\n {\n for (int j = i + 1; j < x.Length; j++)\n {\n if (x[i] < x[j])\n {\n int temp = x[i];\n x[i] = x[j];\n x[j] = temp;\n }\n }\n }\n return x;\n }\n\n public static string check(int [] H, int [] K)\n {\n string res = \"No\";\n for (int i = 0; i < H.Length; i++)\n {\n if(H[i] == 0) {\n for(int j = 0; j< K.Length; j++)\n {\n if (i != H.Length - 1)\n {\n if (H[i + 1] < K[j] && K[j] != 0)\n {\n H[i] = K[j];\n K[j] = 0;\n break;\n }\n }\n else\n {\n if (H[i] ==0 && K[j] != 0)\n {\n H[i] = K[j];\n K[j] = 0;\n break;\n }\n }\n \n }\n }\n }\n for(int i = 0; i< H.Length; i++)\n {\n if(H[i] == 0)\n {\n res = \"No\";\n break;\n }\n else { res = \"Yes\"; }\n }\n return res;\n }\n\n static void Main(string[] args)\n {\n Console.WriteLine(\"insert the number of elements in hitagi array\");\n int n_number =int.Parse(Console.ReadLine());\n Console.WriteLine(\"insert the number of kyaki array \");\n int k_number = int.Parse(Console.ReadLine());\n\n if (k_number < n_number)\n {\n\n int[] Hitagi = new int[n_number];\n int[] Kyaki = new int[k_number];\n\n for (int i = 0; i < n_number; i++)\n {\n Console.WriteLine(\"insert Element Number in hitagi \" + (i + 1));\n Hitagi[i] = int.Parse(Console.ReadLine());\n }\n\n for (int i = 0; i < k_number; i++)\n {\n Console.WriteLine(\"insert Element Number in Kyaki \" + (i + 1));\n Kyaki[i] = int.Parse(Console.ReadLine());\n }\n\n int[] Kyaki_Edit = ArrSort(Kyaki);\n\n string res = check(Hitagi, Kyaki);\n Console.WriteLine(res);\n }\n else\n {\n Console.WriteLine('Kyaki Should by less Hitagi length');\n }\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "17a3bbbae62017b414917ff14f280cd8", "src_uid": "40264e84c041fcfb4f8c0af784df102a", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _814A\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 int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n int[] b = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n if (k > 1)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n a[Enumerable.Range(0, n).Single(i => a[i] == 0)] = b.Single();\n Console.WriteLine(Enumerable.Range(0, n - 1).Any(i => a[i] > a[i + 1]) ? \"Yes\" : \"No\":);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "55dfcce8ec5b8b87bc31e44dbb5a0e9d", "src_uid": "40264e84c041fcfb4f8c0af784df102a", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26730.10\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp1\", \"ConsoleApp1\\ConsoleApp1.csproj\", \"{D70FC6A2-F21A-4D4F-8F51-B68175FDE41D}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{D70FC6A2-F21A-4D4F-8F51-B68175FDE41D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{D70FC6A2-F21A-4D4F-8F51-B68175FDE41D}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{D70FC6A2-F21A-4D4F-8F51-B68175FDE41D}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{D70FC6A2-F21A-4D4F-8F51-B68175FDE41D}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {32DE5E52-1B13-4B78-BD31-F9C127B93C47}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "771b44bc76f94796938e2bcb3458404c", "src_uid": "2860b4fb22402ea9574c2f9e403d63d8", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass Program {\n static void Main() {\n var n = int.Parse(Console.ReadLine());\n var t = Enumerable.Range(0, n).Select(i => Console.ReadLine().Split(' ')\n .Select(int.Parse).ToArray())\n .ToArray();\n var res = t.Select(a => a[0])\n .SelectMany(h => t.Select(a => a[1]), (h, v) => new {h, v})\n .Where(t => t.h == t.v)\n .Count();\n Console.WriteLine(res);\n }\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "220bf02e79af03d656f39f07f3cf16a7", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nnamespace C_\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x;\n int count = 0;\n Console.ReadLine(x);\n int home = new Array[x];\n int gest = new Array[x];\n for (int i = 0; i < x; i++)\n {\n Console.Write(home[i]);\n Console.Write(gest[i]);\n }\n for (int i = 0; i < x; i++)\n for (int j = 0; j < n ; j++)\n {\n if (home[i]==gest[j])\n {\n count++; \n } \n }\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ef893feb5ac911d038459c48bad6c5ed", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0} {"lang": "MS C#", "source_code": "sing 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 public void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string [][] x = new string[n][];\n\n int count = 0;\n for (int i = 0; i < n; i++)\n {\n x[i] = Console.ReadLine().Split(' ');\n\n }\n for (int i = 0; i < n; i++)\n {\n for (int k = 0; k Console.ReadLine().Split(' ')\n .Select(int.Parse).ToArray())\n .ToArray();\n var res = t.Select(a => a[0])\n .SelectMany(h => t.Select(a => a[1]), (h, v) => {h, v})\n .Where(t => t.h == t.v)\n .Count();\n Console.WriteLine(res);\n }\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7f17d3d217cd60328b76b0b3fcca16ee", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nnamespace C_\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int count = 0;\n int x = Convert.ToInt32(Console.ReadLine());\n int[] home = new int[x];\n int[] gest = new int[x];\n for (int i = 0; i < x; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n home[i] = Convert.ToInt32(s[0]);\n gest[i] = Convert.ToInt32(s[1]);\n }\n for (int i = 0; i < x; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (home[i] == gest[j])\n {\n count++;\n Console.WriteLine(count);\n }\n }\n }\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4e87d6b75b345d216d2bc000580bb042", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Solution\n{\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int sl = 0;\n string[] colors = new string[n];\n if (n>=2 && n <=100)\n {\n int[] home = new int[n];\n int[] guest = new int[n];\n for (int i = 0; i < n; i++)\n {\n colors = Console.ReadLine().Split(\" \");\n home[i] += Convert.ToInt32(colors[0]);\n guest[i] += Convert.ToInt32(colors[1]);\n }\n\n for (int k = 0; k < n; k++)\n {\n for (int j = 0; j < n; j++)\n {\n if (home[k] == guest[j])\n {\n sl++;\n }\n }\n }\n Console.WriteLine(sl); \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "991226aa7f2463a85cdaf55ec56b8574", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nnamespace C_\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n \n int x = Convert.ToInt32(Console.ReadLine());\n int[] home = new int[x];\n int[] gest = new int[x];\n for (int i = 0; i < x; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n home[i] = Convert.ToInt32(s[0]);\n gest[i] = Convert.ToInt32(s[1]);\n }\n int count = 0;\n for (int i = 0; i < x; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (home[i] == gest[j] && i != j)\n {\n count++;\n Console.WriteLine(count);\n }\n }\n }\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "323e9e460a53434d33a2530e5926c7a8", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nnamespace C_\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x;\n int count = 0;\n Console.ReadLine(x);\n int home = new Array[x];\n int gest = new Array[x];\n for (int i = 0; i < x; i++)\n {\n Console.Write(home[i]);\n Console.Write(gest[i]);\n }\n for (int i = 0; i < x; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (home[i] == gest[j])\n {\n count++;\n }\n }\n }\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ea5972c0fe6134d91774054ac8052a63", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0} {"lang": "C# 10", "source_code": "\ufeff\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio Version 17\r\nVisualStudioVersion = 17.2.32616.157\r\nMinimumVisualStudioVersion = 10.0.40219.1\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Task B\", \"Task B.csproj\", \"{4F686CDE-4C5A-41AA-A741-0B2E58B721B6}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|Any CPU = Debug|Any CPU\r\n\t\tRelease|Any CPU = Release|Any CPU\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{4F686CDE-4C5A-41AA-A741-0B2E58B721B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{4F686CDE-4C5A-41AA-A741-0B2E58B721B6}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{4F686CDE-4C5A-41AA-A741-0B2E58B721B6}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{4F686CDE-4C5A-41AA-A741-0B2E58B721B6}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\n\tGlobalSection(ExtensibilityGlobals) = postSolution\r\n\t\tSolutionGuid = {4F3CA840-BE7B-4D07-887C-20D95781C4BE}\r\n\tEndGlobalSection\r\nEndGlobal\r\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d6849b06a36cfae1390370a8a1ae3e09", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "difficulty": 800.0} {"lang": "MS C#", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define rep(i, n) for(int i = 0; i < (n); i++)\ntypedef long long ll;\ntemplate static void amax(T &x, U y) { if(x < y) x = y; }\ntemplate static void amin(T &x, U y) { if(x > y) x = y; }\n\nconst int a=1234;\nconst int b=123456;\nconst int c=1234567;\nint main()\n{\n int n,x,y; scanf(\"%d\",&n);\n if(n%a==0){printf(\"YES\\n\"); return 0;}\n if(n%b==0){printf(\"YES\\n\"); return 0;}\n if(n%c==0){printf(\"YES\\n\"); return 0;}\n x=n/c; y=n/b;\n for(int i=0;i<=x;i++)\n {\n if((n-i*a)%b==0){printf(\"YES\\n\"); return 0;}\n for(int j=0;j<=y;j++){\n if((n-i*a-j*b)%c==0){printf(\"YES\\n\"); return 0;}\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "357a38b1ba32403d1772938cdbeb13cb", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "difficulty": 1300.0} {"lang": "Mono C#", "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)/2;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a4de99733bf8c0936359ed2d35344e30", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _16C___\u041c\u043e\u043d\u0438\u0442\u043e\u0440\n{\n class Program\n {\n static long gcd(long a, long b)\n {\n while (a != b)\n {\n if (a < b) b -= a;\n else if (b < a) a -= b;\n }\n return a;\n }\n static void Main(string[] args)\n {\n string[] t = Console.ReadLine().Split(' ');\n long a = long.Parse(t[0]);\n long b = long.Parse(t[1]);\n long x = long.Parse(t[2]);\n long y = long.Parse(t[3]);\n if (Math.Min(x,y)>10000)\n {\n int d = gcd(x, y);\n x = x / d;\n y = y / d;\n }\n else\n {\n long d = 1;\n long min = Math.Min(x,y);\n for (int i = 1; i <= min; i++)\n {\n if (x % i == 0 && y % i == 0)\n d = i;\n }\n x = x / d;\n y = y / d;\n }\n double r1 = a * 1.0 / b;\n double r2 = x * 1.0 / y;\n if (r1 == r2)\n {\n Console.WriteLine(a + \" \" + b);\n return;\n }\n long newA = 0;\n long newB = 0;\n if (r1 > r2)\n {\n newB = (b / y) * y;\n newA = newB * x / y;\n }\n else\n {\n newA = (a / x) * x;\n newB = newA * y / x;\n }\n Console.WriteLine(newA + \" \" + newB);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e46eac5361f8556bda3d30dfecd055cd", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Globalization;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n static void Main( )\n {\n var init = int.Parse(Console.ReadLine());\n var line1 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var line2 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var line3 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var max1 = line1[1];\n var max2 = line2[1];\n var max3 = line3[1];\n\n var min1 = line1[0];\n var min2 = line2[0];\n var min3 = line3[0];\n\n // var dip1 = Math.Min(init - min2 - min3, max1);\n //var dip2 = Math.Min(init - dip1 - min3, max2);\n //var dip3 = Math.Min(init - dip1 - dip2, max3);\n\n while (n>0)\n {\n if (min1 + min2 + min3 == n) break;\n if (min1 < max1) min1++;\n else if (min2 < max2) min2++;\n else if (min3 < max3) min3++;\n }\n\n Console.WriteLine(min1 + \" \" + min2 + \" \" + min3);\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "386b6d4039af0d23cfcf41aaf4752137", "src_uid": "3cd092b6507079518cf206deab21cf97", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Eventing.Reader;\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[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n\n int k = 0;\n if (n > m) k = n - m;\n else\n {\n\n\n\n\n while (n != m)\n {\n if (n*2 - m<=1)\n {\n n *= 2;\n k++;\n continue;\n }\n\n n -= 1;\n k++; \n\n\n\n }\n }\n\n Console.WriteLine(k);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9b948d29d97f132cd5dd1865b93c9d82", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "#include \n#include \nusing namespace std;\n\nclass Node\n{\npublic:\n\tint num, operations;\n\n\tNode(int n, int o)\n\t{\n\t\tnum = n;\n\t\toperations = o;\n\t}\n};\n\nint main()\n{\n\tint m = 0, n = 0;\n\n\tscanf_s(\"%d %d\", &n, &m);\n\n\tqueue nums;\n\t\n\tnums.push(Node(n, 1));\n\n\twhile (true)\n\t{\n\t\tNode temp = nums.back();\n\n\t\tint t1 = temp.num * 2;\n\t\tint t2 = temp.num - 1;\n\n\t\tif (t1== m || t2 == m)\n\t\t{\n\t\t\tprintf_s(\"%d\", temp.operations);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (temp.num < m)\n\t\t\tnums.push(Node(t1, temp.operations + 1));\n\n\t\tif (temp.num > 0)\n\t\t\tnums.push(Node(t2, temp.operations + 1));\n\t}\n\n\treturn 0;\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b227a7d7492e0c1a4b656612930388c5", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "MS C#", "source_code": " static void Main(string[] args)\n {\n int n, m, count=0, i;\n int[] array=new int[10009];\n string [] s=new string[2];\n string str=Console.ReadLine();\n s = str.Split(new char[]{' '});\n n = Int32.Parse(s[0]);\n m = Int32.Parse(s[1]);\n //Console.WriteLine(\"\" + n + \" \" + m);\n i=m;\n if (n > m)\n {\n count = n - m;\n }\n else\n {\n while (i > n)\n {\n if (i % 2 == 1) i = (i + 1) / 2;\n else i /= 2;\n array[i] = 1;\n }\n while (n != m)\n {\n if (array[n] != 1) n--;\n else n *= 2;\n count++;\n }\n }\n\n Console.WriteLine(count);\n //Console.WriteLine(n);\n \n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b8a52e2bb0b152d9bbe0bb3704139372", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "Mono C#", "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 string aa = tmp[0];\n string b = tmp[1];\n\n int a = int.Parse(aa);\n for (a++; ; a++)\n {\n if (ok(a, b))\n {\n Console.WriteLine(a);\n break;\n }\n }\n }\n\n bool ok(int a, string b)\n {\n for (int i = b.Length - 1; i >= 0; i--)\n {\n while (a % 10 != b[i] - '0')\n {\n if (a == 0)\n return false;\n a /= 10;\n }\n a /= 10;\n }//forrev i\n return true;\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "60b15938bd346089ef17d6f6cb36fae3", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0} {"lang": "MS C#", "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 a = s[0]; var b = s[1];\n do {\n a++;\n var tmp = a; var m = 1; var mask = 0;\n while (tmp > 0) {\n if (tmp % 10 == 4 || tmp % 10 == 7) { mask += m * (tmp % 10); m*=10; }\n tmp /= 10;\n }\n if (mask == b) { Console.Write(a); return; }\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f014ec99149676a4f3a41190d91724b5", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "class MainClass\n {\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n var sl = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\n int n = fl[0] - 1;\n int k = fl[1];\n int x = fl[2];\n\n int sum = 0;\n for (var i = n; i > -1; i--){\n if (n - i < k){\n continue;\n }\n\n sum += sl[i];\n }\n\n Console.WriteLine(sum + k * x);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cea4380a04eea8a6879986c46e6cc67d", "src_uid": "92a233f8d9c73d9f33e4e6116b7d0a96", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " int n = int.Parse(Console.ReadLine());\n int count = 0;\n\n while (n != 0)\n {\n count += n / 100;\n n = n % 100;\n count += n / 20;\n n = n % 20;\n count += n / 5;\n n = n % 5;\n count += n / 2;\n n = n % 2;\n count += n / 1;\n n = n % 1;\n }\n Console.WriteLine(count);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f9574a63472b39a5b55ab45253b03c6a", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "#include \nusing namespace std;\n\nint main()\n{\n int num,c=0,t;\n cin>>num;\n if(num%100 != 0)\n {\n c += (num/100);\n num%=100;\n if(num%20 == 0)\n {\n cout<= 100)\n {\n cout< int.Parse(x)).ToArray();\n int quantityOFcash = 0;\n while(numbers[0] - 100 >= 0)\n {\n if (numbers[0] - 100 >= 0)\n {\n quantityOFcash++;\n numbers[0] -= 100;\n }\n }\n while (numbers[0] - 20 >= 0)\n {\n if (numbers[0] - 20 >= 0)\n {\n quantityOFcash++;\n numbers[0] -= 20;\n }\n }\n while (numbers[0] - 10 >= 0)\n {\n if (numbers[0] - 10 >= 0)\n {\n quantityOFcash++;\n numbers[0] -= 10;\n }\n }\n while (numbers[0] - 5 >= 0)\n {\n if (numbers[0] - 5 >= 0)\n {\n quantityOFcash++;\n numbers[0] -= 5;\n }\n }\n while (numbers[0] - 1 >= 0)\n {\n if (numbers[0] - 1 >= 0)\n {\n quantityOFcash++;\n numbers[0] -= 1;\n }\n }\n Console.WriteLine(quantityOFcash);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "120ee80c6dbe86e914005efbbf698b47", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "num = int(input())\nif (num%100) != 0:\n c=0\n c += int(num/100);\n num%=100;\n if(num%20 == 0):\n print(num/20 + c);\n else:\n c+= int(num/20);\n num%=20;\n if(num%10 == 0):\n print(c + num/10);\n else:\n c += int(num/10);\n num%=10;\n if(num%5 == 0):\n print(c + num/5);\n else:\n c += int(num/5);\n num%=5;\n print(c+num);\nelif(num >= 100):\n print(num/100);\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a211a6f96caef967b12a4947f9f31fc6", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Data.SqlTypes;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int number = Convert.ToInt32(Console.ReadLine());\n int result = 0;\n\n while(number != 0)\n {\n if (number >= 100)\n {\n number -= 100;\n result++;\n }\n else if (number >= 20)\n {\n number -= 20;\n result++;\n }\n else if(number >= 10)\n {\n number -= 10;\n result++;\n }\n else if (number >= 5)\n {\n number -= 5;\n result++;\n }\n else if (number >= 1)\n {\n number -= 1;\n result++;\n }\n }\n\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "03c214ce932d41e8de2689f060ab8892", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.1062\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp7\", \"ConsoleApp7.csproj\", \"{0BE878F0-59C5-4937-97E2-067D4DE3BF00}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{0BE878F0-59C5-4937-97E2-067D4DE3BF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0BE878F0-59C5-4937-97E2-067D4DE3BF00}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0BE878F0-59C5-4937-97E2-067D4DE3BF00}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0BE878F0-59C5-4937-97E2-067D4DE3BF00}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {33B23004-8358-49E5-B718-E34496A6C7BA}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e7038eb12dd14b8cefad352c559e2588", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Reflection.PortableExecutable;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Cant = 0;\n int Money = Int32.Parse(Console.ReadLine());\n int[] Monedas = { 100, 20, 10, 5, 1 };\n\n for (int i = 0; i < Monedas.Length;i++)\n {\n if (Money == 0)\n {\n break;\n }\n \n while (Money / Monedas[i] > 0)\n {\n Money -= Monedas[i];\n Cant++;\n }\n }\n \n Console.WriteLine(Cant);\n \n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "42c6c78ed319846611f39265be9a9984", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nusing System.Text.RegularExpressions;\n\n\n\nclass Program\n{\n static public int[] readIntArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToArray();\n }\n static public long[] readLongArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToInt64(s)).ToArray();\n }\n static public ulong[] readULongArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToUInt64(s)).ToArray();\n }\n public static int readInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n\n static void Main(string[] args)\n {\n\n RountineProblem();\n }\n static void RountineProblem()\n {\n int[] arr = readIntArray();\n int bc = arr[1] * arr[2];\n int ad = arr[0] * arr[3];\n int up = 0;\n int down = 0;\n if (bc > ad)\n {\n up = bc - ad;\n down = bc;\n }\n else\n {\n up = ad - bc;\n down = ad;\n }\n int gcd = (int)BigInteger.GreatestCommonDivisor(up, down);\n up /= gcd;\n down /= gcd;\n if (up == 0) { down = 1; }\n Console.WriteLine(\"{0}/{1}\",up,down);\n \n }\n \n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7efabcb340703d8685dfab06ef79b244", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nusing System.Text.RegularExpressions;\n\n\n\nclass Program\n{\n static public int[] readIntArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToArray();\n }\n static public long[] readLongArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToInt64(s)).ToArray();\n }\n static public ulong[] readULongArray()\n {\n return (from string s in Console.ReadLine().Split(' ') select Convert.ToUInt64(s)).ToArray();\n }\n public static int readInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n\n static void Main(string[] args)\n {\n\n RountineProblem();\n }\n static void RountineProblem()\n {\n int[] arr = readIntArray();\n int bc = arr[1] * arr[2];\n int ad = arr[0] * arr[3];\n int up = 0;\n int down = 0;\n if (bc > ad)\n {\n up = bc - ad;\n down = bc;\n }\n else\n {\n up = ad - bc;\n down = ad;\n }\n int gcd = (int)BigInteger.GreatestCommonDivisor(up, down);\n up /= gcd;\n down /= gcd;\n if (up == 0) { down = 1; }\n Console.WriteLine(\"{0}/{1}\",up,down);\n \n }\n \n \n \n\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5f370708861c74c5223445e9c3786d04", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.0} {"lang": "MS C#", "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 public static void WhatAmIDoing(int n)\n {\n int n = = int.Parse(Console.ReadLine());\n List Solutions = new List();\n int HowMuch = 0;\n int CheckThis;\n int[] Digits;\n CheckThis = n <= 81 ? 0 : n - 81;\n for (int x = CheckThis; x < n; x++)\n {\n Digits = x.ToString().Select(t => int.Parse(t.ToString())).ToArray();\n int DigitsValue = 0;\n foreach (int dig in Digits)\n {\n DigitsValue += dig;\n }\n if (x + DigitsValue == n)\n {\n HowMuch += 1;\n Solutions.Add(x);\n \n }\n }\n Console.WriteLine(HowMuch);\n foreach(int Solution in Solutions)\n {\n Console.WriteLine(Solution);\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d4c5d07442c353aa92219420e05c951b", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "MS C#", "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 public static void WhatAmIDoing(int n)\n {\n int n == int.Parse(Console.ReadLine());\n List Solutions = new List();\n int HowMuch = 0;\n int CheckThis;\n int[] Digits;\n CheckThis = n <= 81 ? 0 : n - 81;\n for (int x = CheckThis; x < n; x++)\n {\n Digits = x.ToString().Select(t => int.Parse(t.ToString())).ToArray();\n int DigitsValue = 0;\n foreach (int dig in Digits)\n {\n DigitsValue += dig;\n }\n if (x + DigitsValue == n)\n {\n HowMuch += 1;\n Solutions.Add(x);\n\n }\n }\n Console.WriteLine(HowMuch);\n foreach(int Solution in Solutions)\n {\n Console.WriteLine(Solution);\n }\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "099a64b2581ceb57f8a5370cbb305da5", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generics;\nusing System.Linq;\n\nnamespace Problem{\n \n public class Solution{\n \n public void Main(){\n \n int n = int.Parse(Console.ReadLine());\n if(n == 1){\n Console.WriteLine(n);\n }else{\n Console.WriteLine((n*2 - 3)*(n*2 - 3) + 4));\n }\n } \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a7e422c75edb89b8d01280c95be3ff27", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApp12\n{\n class Solution\n {\n static int Compute(int n)\n {\n int last = n * 2 - 1;\n return (1 + last) * n - last;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "526025fe7c82633e6e8e59ed8b9d1d44", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0} {"lang": "Mono C#", "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 void Main(){\n \n int n = int.Parse(Console.ReadLine());\n if(n == 1){\n Console.WriteLine(n);\n }else{\n Console.WriteLine((n*2 - 3)*(n*2 - 3) + 4);\n }\n } \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bfd31fc8cd7be62f1223f197fae8995a", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0} {"lang": "MS C#", "source_code": "static void Main(string[] args)\n {\n Console.Write(\"n: \");\n int n = int.Parse(Console.ReadLine());\n Console.Write(\"k: \");\n int k = int.Parse(Console.ReadLine());\n Console.WriteLine(Func(n, k));\n }\n static int Func(int n, int k)\n {\n int cnt1 = 0, cnt2 = 0;\n while (n > 0 && cnt2 < k)\n {\n cnt1++;\n if (n % 10 == 0)\n cnt2++;\n n /= 10;\n }\n if (cnt2 < k)\n return cnt1 - 1;\n return cnt1 - cnt2;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2f17a28ff4cdf3dcadbc1f5159e6620d", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program {\n static void Main() {\n var n = int.Parse(Console.ReadLine());\n if (n < 3) Console.WriteLine(-1);\n else Console.Write(string.Join(\" \", (new [] {2,3,1}).Concat(Enumerable.Range(4, 4 - n))); \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3974f6cb6df78e461c0a580e835c66c8", "src_uid": "fe8a0332119bd182a0a5b7758716317e", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program {\n static void Main() {\n var n = int.Parse(Console.ReadLine());\n if (n < 3) Console.WriteLine(-1);\n else Console.Write(string.Join(\" \", (new [] {2,3,1}).Concat(Enumerable.Range(4, 4 - n)))); \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b1eb2bd9c7913adf5914c722ed0a23a8", "src_uid": "fe8a0332119bd182a0a5b7758716317e", "difficulty": 900.0} {"lang": "Mono C#", "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 var num = ReadInt();\n if (num < 3) Console.WriteLine(-1);\n else Console.WriteLine(string.Join(\" \", Enumerable.Range(1,num).Reverse().ToArray()));\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "870609d47829f1a0994ea2da4184f322", "src_uid": "fe8a0332119bd182a0a5b7758716317e", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n public static void Main(string[] args)()\n {\n int n = int.Parse(Console.ReadLine());\n if(n < 3)\n Console.WriteLine(-1);\n else\n for(int i = n; i > 0; i--)\n Console.Write(i + \" \");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1c9a9bade9f198c81594c78e25747729", "src_uid": "fe8a0332119bd182a0a5b7758716317e", "difficulty": 900.0} {"lang": "Mono C#", "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 {\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 - 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8b14db60b6be56d3f7055dd2f7fbbcba", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " 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)\n {\n Console.WriteLine(-1);\n }\n else {\n Console.WriteLine(strarr.Take(useStage).Sum(c=>(int)c-96));\n }\n\n Console.ReadLine();\n\n\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "66de993c9a52211e543e53e4271ba653", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " 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)\n {\n Console.WriteLine(-1);\n }\n else {\n Console.WriteLine(strarr.Take(useStage).Sum(c=>(int)c-96));\n }\n\n \n\n\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "66f4e1e77dd2945c0b6a9ccb6d5e2fc6", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {6E9044DB-BA15-4CBE-AC2A-7ABAA7C39024}\n Exe\n Properties\n FiljaISonja\n FiljaISonja\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f23acab0de3d0458ebb1922b1113d8e7", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {2EAAF829-089B-443C-A985-B1AB48407DE9}\n Exe\n Properties\n Task_01\n Task_01\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c3d681c2085b598a21f2bf8164699fb8", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _224A.Parallelepiped\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] ars = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(counters(ars));\n \n }\n static int counters(int[]ars)\n {\n \n double x= ars[0] * ars[2] / ars[1];\n double y= ars[0] * ars[1] / ars[2];\n double z= ars[1] * ars[2] / ars[0];\n int a=0, b=0, c=0;\n int[] roots = new int[101];\n for (int i = 0; i < roots.Length; i++)\n {\n roots[i] = (i) * (i);\n }\n int j = 1;\n while(x>=roots[j]|| y >= roots[j]|| z >= roots[j])\n {\n if (x <= roots[j] && x > roots[j - 1])\n {\n x = roots[j];\n a = j;\n } \n if (y <= roots[j] && y > roots[j - 1])\n {\n y = roots[j];\n b = j;\n }\n if (z <= roots[j] && z > roots[j - 1])\n {\n z = roots[j];\n c = j;\n }\n j++;\n }\n return 4*(a + b + c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "66b59c9bdae786e61f35b67b58161050", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0} {"lang": "Mono C#", "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 = System.ValueTuple;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n var a = new[] { 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 1, 1 };\n var s = RLEncoding(a);\n \n }\n\n public List<(T item, int len)> RLEncoding(IList list, Comparison cmp = null)\n {\n cmp = cmp ?? Comparer.Default.Compare;\n var rt = new List<(T, int)> { (list[0], 1) };\n for (var i = 1; i < list.Count; i++)\n if (cmp(rt[1].Item1, list[i]) == 0)\n rt[1] = (rt[1].Item1, rt[1].Item2 + 1);\n else rt.Add((list[i], 1));\n return rt;\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 int PopCount(int n) => (int)System.Runtime.Intrinsics.X86.Popcnt.PopCount((uint)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 => 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 T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ').AsSpan()[..]) 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() { (T1, T2) rt=(default,default); Make(out rt.Item1, out rt.Item2); return rt; }\n public (T1, T2, T3) Make() { (T1, T2, T3) rt=(default,default,default); Make(out rt.Item1, out rt.Item2, out rt.Item3); return rt; }\n public (T1, T2, T3, T4) Make() { (T1, T2, T3, T4) rt=(default,default,default,default); Make(out rt.Item1, out rt.Item2, out rt.Item3, out rt.Item4); return rt; }\n}\n\n#endregion\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f5f4508674ccf371f27c8fa7e8d7b640", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "Mono C#", "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 = System.ValueTuple;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n var a = new[] { 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 1, 1 };\n //var s = RLEncoding(a);\n \n }\n\n /*public List<(T item, int len)> RLEncoding(IList list, Comparison cmp = null)\n {\n cmp = cmp ?? Comparer.Default.Compare;\n var rt = new List<(T, int)> { (list[0], 1) };\n for (var i = 1; i < list.Count; i++)\n if (cmp(rt[1].Item1, list[i]) == 0)\n rt[1] = (rt[1].Item1, rt[1].Item2 + 1);\n else rt.Add((list[i], 1));\n return rt;\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 int PopCount(int n) => (int)System.Runtime.Intrinsics.X86.Popcnt.PopCount((uint)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 => 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 T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ').AsSpan()[..]) 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() { (T1, T2) rt; Make(out rt.Item1, out rt.Item2); return rt; }\n public (T1, T2, T3) Make() { (T1, T2, T3) rt; Make(out rt.Item1, out rt.Item2, out rt.Item3); return rt; }\n public (T1, T2, T3, T4) Make() { (T1, T2, T3, T4) rt; Make(out rt.Item1, out rt.Item2, out rt.Item3, out rt.Item4); return rt; }\n}\n\n#endregion\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "281368737df330deda9cdd367b7c594b", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n\n#include\n\nusing namespace std;\n\nint main()\n{\n int i,n;\n int str;\n cin >> n >> str;\n cout << n+1 << endl;\n return 0;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7e59131297189bd3cd02ff3b376ef671", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "Mono C#", "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 = System.ValueTuple;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n var a = new[] { 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 1, 1 };\n var s = RLEncoding(a);\n \n }\n\n public List<(T item, int len)> RLEncoding(IList list, Comparison cmp = null)\n {\n cmp = cmp??Comparer.Default.Compare;\n var rt = new List<(T, int)> { (list[0], 1) };\n for (var i = 1; i < list.Count; i++)\n if (cmp(rt[1].Item1, list[i]) == 0)\n rt[1] = (rt[1].Item1, rt[1].Item2 + 1);\n else rt.Add((list[i], 1));\n return rt;\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 int PopCount(int n) => (int)System.Runtime.Intrinsics.X86.Popcnt.PopCount((uint)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 => 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 T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ').AsSpan()[..]) 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() { (T1, T2) rt; Make(out rt.Item1, out rt.Item2); return rt; }\n public (T1, T2, T3) Make() { (T1, T2, T3) rt; Make(out rt.Item1, out rt.Item2, out rt.Item3); return rt; }\n public (T1, T2, T3, T4) Make() { (T1, T2, T3, T4) rt; Make(out rt.Item1, out rt.Item2, out rt.Item3, out rt.Item4); return rt; }\n}\n\n#endregion\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a14a3498dfe50d41dc28082476d63a86", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "Mono C#", "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 = System.ValueTuple;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n var a = new[] { 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 1, 1 };\n var s = RLEncoding(a);\n \n }\n\n public List<(T item, int len)> RLEncoding(IList list, Comparison cmp = null)\n {\n cmp = cmp ?? Comparer.Default.Compare;\n var rt = new List<(T, int)> { (list[0], 1) };\n for (var i = 1; i < list.Count; i++)\n if (cmp(rt[1].Item1, list[i]) == 0)\n rt[1] = (rt[1].Item1, rt[1].Item2 + 1);\n else rt.Add((list[i], 1));\n return rt;\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 int PopCount(int n) => (int)System.Runtime.Intrinsics.X86.Popcnt.PopCount((uint)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 => 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 T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ').AsSpan()[..]) 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\n#endregion\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "edf8f7692b8c76565099123fcfc9e9a2", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "Mono C#", "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 = System.ValueTuple;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n var (N, s) = (sc.Int, sc.Str);\n WriteLine(N + 1);\n }\n\n public List<(T item, int len)> RLEncoding(IList list, Comparison cmp = null)\n {\n cmp = cmp ?? Comparer.Default.Compare;\n var rt = new List<(T, int)> { (list[0], 1) };\n for (var i = 1; i < list.Count; i++)\n if (cmp(rt[^1].Item1, list[i]) == 0)\n rt[1] = (rt[1].Item1, rt[1].Item2 + 1);\n else rt.Add((list[i], 1));\n return rt;\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 int PopCount(int n) => (int)System.Runtime.Intrinsics.X86.Popcnt.PopCount((uint)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 => 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 T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ').AsSpan()[..]) 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\n#endregion\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "98dbfcc3c0cd90b62d50f28004f92ec2", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "Mono C#", "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 = System.ValueTuple;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n var a = new[] { 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 1, 1 };\n var s = RLEncoding(a);\n \n }\n\n public List<(T item, int len)> RLEncoding(IList list, Comparison cmp = null)\n {\n cmp ??= Comparer.Default.Compare;\n var rt = new List<(T, int)> { (list[0], 1) };\n for (var i = 1; i < list.Count; i++)\n if (cmp(rt[^1].Item1, list[i]) == 0)\n rt[^1] = (rt[^1].Item1, rt[^1].Item2 + 1);\n else rt.Add((list[i], 1));\n return rt;\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 int PopCount(int n) => (int)System.Runtime.Intrinsics.X86.Popcnt.PopCount((uint)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 => 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 T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ').AsSpan()[..]) 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() { (T1, T2) rt; Make(out rt.Item1, out rt.Item2); return rt; }\n public (T1, T2, T3) Make() { (T1, T2, T3) rt; Make(out rt.Item1, out rt.Item2, out rt.Item3); return rt; }\n public (T1, T2, T3, T4) Make() { (T1, T2, T3, T4) rt; Make(out rt.Item1, out rt.Item2, out rt.Item3, out rt.Item4); return rt; }\n}\n\n#endregion\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8a1bc2ca062c2b0ff93cea7d6fdb5541", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "Mono C#", "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 var a=new[]{1,2,3};\n var b=a[^1];\n (int N, string s) p;\n sc.Make(out p.N, out p.s);\n WriteLine(p.N+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\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) { 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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Copy(this T[] A) => Create(A.Length, i => A[i]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static Pair MP(T t, U u) => new Pair(t, u);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static Pair MP(T t, U u, V v) => new Pair(t, u, v);\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 MP() => new Pair(Next(), Next());\n public Pair MP() => 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "57887209589d89c393c1e4aeaba35537", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "Mono C#", "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 = System.ValueTuple;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n var a = new[] { 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 1, 1 };\n var s = RLEncoding(a);\n \n }\n\n public List<(T item, int len)> RLEncoding(IList list, Comparison cmp = null)\n {\n cmp ??= Comparer.Default.Compare;\n var rt = new List<(T, int)> { (list[0], 1) };\n for (var i = 1; i < list.Count; i++)\n if (cmp(rt[1].Item1, list[i]) == 0)\n rt[1] = (rt[1].Item1, rt[1].Item2 + 1);\n else rt.Add((list[i], 1));\n return rt;\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 int PopCount(int n) => (int)System.Runtime.Intrinsics.X86.Popcnt.PopCount((uint)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 => 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 T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ').AsSpan()[..]) 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() { (T1, T2) rt; Make(out rt.Item1, out rt.Item2); return rt; }\n public (T1, T2, T3) Make() { (T1, T2, T3) rt; Make(out rt.Item1, out rt.Item2, out rt.Item3); return rt; }\n public (T1, T2, T3, T4) Make() { (T1, T2, T3, T4) rt; Make(out rt.Item1, out rt.Item2, out rt.Item3, out rt.Item4); return rt; }\n}\n\n#endregion\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b458ba0b458e6f5b2d9ecd396cfb313", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace olymp\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 limit = Int32.Parse(input[1]); \n\n string[] time = Console.ReadLine().Split(); \n int[] needToLeave = new int[n];\n List orderedTime = new List();\n int accumulator = 0;\n int thisTime = 0;\n int j = 0;\n for(int i = 0; i < n; i++)\n {\n thisTime = Int32.Parse(time[i]);\n accumulator += thisTime;\n j = 0;\n if(accumulator > limit)\n { \n int decreasedTime = accumulator;\n while(decreasedTime > limit)\n {\n decreasedTime -= orderedTime[j];\n j++;\n }\n }\n needToLeave[i] = j;\n if(orderedTime.Count == 0)\n {\n orderedTime.Add(thisTime);\n }\n else\n {\n j = 0;\n while(orderedTime[j]>thisTime)\n {\n j++;\n if(j == orderedTime.Count) break;\n }\n orderedTime.Insert(j, thisTime);\n } \n \n }\n Console.WriteLine(String.Join(' ', needToLeave));\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b5a8678e517e3be4eaa90c0470ab84a", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace olymp\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 limit = Int32.Parse(input[1]); \n\n string[] time = Console.ReadLine().Split();\n /* int[] accumulated = new int[n];*/\n int[] needToLeave = new int[n];\n List orderedTime = new List();\n int accumulator = 0;\n int thisTime = 0;\n int j = 0;\n for(int i = 0; i < n; i++)\n {\n thisTime = Int32.Parse(time[i]);\n accumulator += thisTime;\n j = 0;\n if(accumulator > limit)\n { \n int decreasedTime = accumulator;\n while(decreasedTime > limit)\n {\n decreasedTime -= orderedTime[j];\n j++;\n }\n }\n needToLeave[i] = j;\n if(orderedTime.Count == 0)\n {\n orderedTime.Add(thisTime);\n }\n else\n {\n j = 0;\n while(orderedTime[j]>thisTime)\n {\n j++;\n if(j == orderedTime.Count) break;\n }\n orderedTime.Insert(j, thisTime);\n } \n \n }\n Console.WriteLine(String.Join(' ', needToLeave));\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4874e795c02be021c6fa9b9432cc422d", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using Senti.Data;\nusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing TestBaza1.Data;\n\nnamespace TestBaza1Console\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n\n string[] str = Console.ReadLine().Split(' ');\n int a1 = int.Parse(str[0]);\n int a2 = int.Parse(str[1]);\n \n int br = 0;\n\n while (a2 > 0 && br > 0)\n {\n if (a2 > a1)\n {\n a1 -= 2;\n a2 += 1;\n\n }\n else {\n a2 += 1;\n br -= 2;\n }\n if (a1 >= 0 && br >= 0) {\n br += 1;\n }\n }\n\n Console.WriteLine(br);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7f8d1f6e9f15b4e9e73e9ff117117ff7", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0} {"lang": "Mono C#", "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\u0436\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0241911bb866905fdbf478532ac71086", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nclass Program {\n static void Main()\n{ \n var s1 = Console.ReadLine();\n var s2 = Console.ReadLine();\n var i = 0;\n foreach (var c in s2) if (c == s1[i]) i++;\n Console.WriteLine(i+1);\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c756a4ba45ee4ef8f1654c0ea10f400f", "src_uid": "f5a907d6d35390b1fb11c8ce247d0252", "difficulty": 800.0} {"lang": "Mono C#", "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 public class Number\n {\n\n public static BigInteger Euclidean(BigInteger n1, BigInteger n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 int Euclidean(int n1, int n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 u, long v)\n {\n\n long inv, u1, u3, v1, v3, t1, t3, q;\n int iter;\n /* Step X1. Initialise */\n u1 = 1;\n u3 = u;\n v1 = 0;\n v3 = v;\n /* Remember odd/even iterations */\n iter = 1;\n /* Step X2. Loop while v3 != 0 */\n while (v3 != 0)\n {\n /* Step X3. Divide and \"Subtract\" */\n q = u3 / v3;\n t3 = u3 % v3;\n t1 = u1 + q * v1;\n /* Swap */\n u1 = v1; v1 = t1; u3 = v3; v3 = t3;\n iter = -iter;\n }\n /* Make sure u3 = gcd(u,v) == 1 */\n if (u3 != 1)\n return 0; /* Error: No inverse exists */\n /* Ensure a positive result */\n if (iter < 0)\n inv = v - u1;\n else\n inv = u1;\n return inv;\n }\n\n public static BigInteger Inverse(BigInteger u, BigInteger v)\n {\n\n BigInteger inv, u1, u3, v1, v3, t1, t3, q;\n int iter;\n /* Step X1. Initialise */\n u1 = 1;\n u3 = u;\n v1 = 0;\n v3 = v;\n /* Remember odd/even iterations */\n iter = 1;\n /* Step X2. Loop while v3 != 0 */\n while (v3 != 0)\n {\n /* Step X3. Divide and \"Subtract\" */\n q = u3 / v3;\n t3 = u3 % v3;\n t1 = u1 + q * v1;\n /* Swap */\n u1 = v1; v1 = t1; u3 = v3; v3 = t3;\n iter = -iter;\n }\n /* Make sure u3 = gcd(u,v) == 1 */\n if (u3 != 1)\n return 0; /* Error: No inverse exists */\n /* Ensure a positive result */\n if (iter < 0)\n inv = v - u1;\n else\n inv = u1;\n return inv;\n }\n\n\n }\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 private static void Main(string[] args)\n {\n var tmp = readLongs();\n var u = tmp[0];\n var v = tmp[1];\n if (u > v)\n {\n (-1).WriteLine();\n return;\n }\n if(u == 0 && v == 0)\n {\n (0).WriteLine();\n return;\n }\n\n List res = new List();\n long f = u;\n long s = 0;\n long t = 0;\n var delta = v - u;\n for (int i = 63; i > 0 && delta > 0; i--)\n {\n var bit = delta >> i;\n if (bit == 0L)\n continue;\n if (bit == 1L)\n {\n var val = 1L << (i - 1);\n \n if ( ((f >> (i - 1L)) & 1L) == 0L )\n {\n f+=val;\n }\n else\n {\n t+=val;\n }\n s+=val;\n\n delta -= 2L*val;\n }\n }\n if (delta > 0)\n {\n (-1).WriteLine();\n return;\n }\n if(f > 0)\n res.Add(f);\n if(s > 0)\n res.Add(s);\n if(t > 0)\n res.Add(t);\n res.Count.WriteLine();\n res.WriteLine();\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b786e698d668f8a5cebe208cff7c3e0", "src_uid": "490f23ced6c43f9e12f1bcbecbb14904", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System; using System.Linq; using System.Collections.Generic;\n\nclass P { \n static int result = 1;\n static void Main() {\n var x = int.Parse(Console.ReadLine());\n var digits = 0;\n { var temp = x;\n while (temp > 0) { x = x | (1 << (temp%10)); temp /= 10; } }\n var divs = new List();\n for (var d = 2; d <= x ; d++)\n if (x % d == 0) { divs.Add(d); x /= d; d--; }\n Recurse(divs, 0, 1, digits);\n Console.Write(result);\n }\n \n static void Recurse(List divs, int i, int n, int digits) {\n if (i >= divs.Count) {\n while (n > 0) {\n if ((digits & (1 << (n%10)))!=0) { result++; return; } \n n /= 10;\n }\n Recurse(divs, i + 1, n * divs[i], digits);\n do { i++; }\n while (i < divs.Count && divs[i] == divs[i-1]);\n Recurse(divs, i, n, digits);\n }\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ef5ed2bced1cd15a3254d29a6035255e", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace CodeForces862A\n{\n public static void Main(string[] args)\n {\n var firstLine = \"5 0\";\n var secondLine = \"1 2 3 4 5\";\n\n var splitFirstLine = firstLine.Split(' ');\n var splitSecondLine = secondLine.Split(' ');\n\n var n = splitFirstLine[0];\n var x = int.Parse(splitFirstLine[1]);\n\n var listOfNumbers = splitSecondLine.Select(i => int.Parse(i)).ToList();\n\n var numberOfChanges = 0;\n\n while (x > 0)\n {\n if (!listOfNumbers.Contains(x - 1))\n {\n listOfNumbers.Add(x - 1);\n numberOfChanges++;\n }\n x--;\n }\n\n if (listOfNumbers.Contains(x))\n {\n listOfNumbers.Remove(x);\n numberOfChanges++;\n }\n\n Console.WriteLine(numberOfChanges);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b2bd99b702952a3e9641ddc625b326bf", "src_uid": "21f579ba807face432a7664091581cd8", "difficulty": 1000} {"lang": "MS C#", "source_code": "sdsds", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ccf204cb2f985e3c23c5ecfdbe89f406", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace trickyalchemy\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 BigInteger a = BigInteger.Parse(s1[0]);\n BIgInteger b = BigInteger.Parse(s1[1]);\n BigInteger x = BigInteger.Parse(s2[0]);\n BigInteger y = BigInteger.Parse(s2[1]);\n BigInteger z = BigInteger.Parse(s2[2]);\n BigInteger yballs = ((2 * x) + y) - a;\n BigInteger bballs = ((3 * z) + y) - b;\n BigInteger sum = yballs + bballs;\n Console.WriteLine(sum);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2a28011c27dc909632622004fd8d987c", "src_uid": "35202a4601a03d25e18dda1539c5beba", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp28\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int Da = int.Parse(input[0]);\n int Db = int.Parse(input[1]));\n if (Db - Da == 1 && Da!=1 &&Db !=9)\n {\n Console.WriteLine(\"{0}9 {1}0\", Da, Db);\n }\n if (Da == 1 && Db == 9)\n { Console.WriteLine(\"{0}9 {1}00\", Da, Db); }\n if (Db == Da)\n {\n Console.WriteLine(\"{0}4 {1}1\", Da, Db);\n }\n if(Db-Da> 1 )\n { Console.WriteLine(\"-1\"); }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "46290aec1694dd7c13c9eecfe1aaf83e", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp28\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int Da = int.Parse(input[0]);\n int Db = int.Parse(input[1]));\n if (Db - Da == 1 && Da!=1 &&Db !=9)\n {\n Console.WriteLine(\"{0}9 {1}0\", Da, Db);\n }\n if (Da == 1 && Db == 9)\n { Console.WriteLine(\"{0}9 {1}00\", Da, Db); }\n if (Db == Da)\n {\n Console.WriteLine(\"{0}4 {1}1\", Da, Db);\n }\n if(Db-Da> 1 )\n { Console.WriteLine(\"-1\"); }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "552fc7d0a7ce2c46642067bcc97a8d3d", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication14\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n int[,] arr = new int[3, 3];\n int[,] temp = new int[3, 3];\n for (int i = 0; i < 3; i++)\n {\n string[] income = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n for (int j = 0; j < 3; j++)\n {\n if (int.Parse(income[j]) % 2 != 0) //\u041d\u0435\u0447\u0435\u0442\u043d\u0430\u044f \n {\n arr[i, j] = arr[i, j] == 1 ? 0 : 1;\n\n if (i == 0)\n {\n if (j == 0)\n {\n arr[i, j + 1] = arr[i + 1, j + 1] == 1 ? 0 : 1;\n arr[i + 1, j] = arr[i + 1, j + 1] == 1 ? 0 : 1;\n }\n else\n {\n if (j == 1)\n {\n arr[i + 1, j - 1] = arr[i + 1, j - 1] == 1 ? 0 : 1;\n arr[i + 1, j + 1] = arr[i + 1, j + 1] == 1 ? 0 : 1;\n }\n else\n {\n arr[i + 1, j - 1] = arr[i + 1, j - 1] == 1 ? 0 : 1;\n }\n }\n }\n else\n {\n if (i == 1)\n {\n if (j == 0)\n {\n arr[i - 1, j] = arr[i - 1, j] == 1 ? 0 : 1;\n arr[i, j + 1] = arr[i, j + 1] == 1 ? 0 : 1;\n arr[i + 1, j] = arr[i + 1, j] == 1 ? 0 : 1;\n\n }\n else\n {\n if (j == 1)\n {\n arr[i - 1, j] = arr[i - 1, j] == 1 ? 0 : 1;\n arr[i + 1, j] = arr[i + 1, j] == 1 ? 0 : 1;\n\n arr[i, j - 1] = arr[i, j - 1] == 1 ? 0 : 1;\n arr[i, j + 1] = arr[i, j + 1] == 1 ? 0 : 1;\n }\n else\n {\n arr[i - 1, j] = arr[i - 1, j] == 1 ? 0 : 1;\n arr[i, j - 1] = arr[i, j - 1] == 1 ? 0 : 1;\n arr[i + 1, j] = arr[i + 1, j] == 1 ? 0 : 1;\n }\n }\n }\n else\n {\n if (j == 0)\n {\n arr[i - 1, j] = arr[i - 1, j] == 1 ? 0 : 1;\n arr[i, j + 1] = arr[i, j + 1] == 1 ? 0 : 1;\n }\n else\n {\n if (j == 1)\n {\n arr[i - 1, j] = arr[i - 1, j] == 1 ? 0 : 1;\n arr[i, j - 1] = arr[i, j - 1] == 1 ? 0 : 1;\n arr[i, j + 1] = arr[i, j + 1] == 1 ? 0 : 1;\n }\n else\n {\n arr[i - 1, j] = arr[i - 1, j] == 1 ? 0 : 1;\n arr[i, j - 1] = arr[i, j - 1] == 1 ? 0 : 1;\n }\n }\n\n }\n }\n }\n\n }\n }\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n Console.Write(arr[i, j] == 1 ? \"0\" : \"1\");\n }\n Console.Write(\"\\n\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "53051788fecb87bc385f6014568d9cd1", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass Program {\n static void Main() {\n var f = Enumerable.Range(0,3).Select(i => Console.ReadLine().Split(' ').Select(int.Parse).Select(x => x % 2).ToArray()).ToArray();\n var ff = new int[3][3];\n for (var y = 0 ; y < 3 ; y++) for (var x = 0 ; x < 3 ; x++)\n for (var yi = y-1 ; yi <= y+1 ; yi++) for (var xi = x-1 ; xi <= x+i ; xi++)\n if (yi >= 0 && xi >= 0 && f[y][x] == 1 && yi < 3 && xi < 3)\n ff[yi][xi] = 1 ^ ff[yi][xi];\n for (var y = 0 ; y < 3; y++) {\n for (var x = 0; x < 3 ; x++) Console.Write(\"{0} \", ff[y][x]);\n Console.WriteLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "397da00772d28f3e14501a2a57c567ff", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass Program {\n static void Main() {\n var f = Enumerable.Range(0,3).Select(i => Console.ReadLine().Split(' ').Select(int.Parse).Select(x => x % 2).ToArray()).ToArray();\n var ff = new int[3,3];\n for (var y = 0 ; y < 3 ; y++) for (var x = 0 ; x < 3 ; x++)\n for (var yi = y-1 ; yi <= y+1 ; yi++) for (var xi = x-1 ; xi <= x+i ; xi++)\n if (yi >= 0 && xi >= 0 && f[y][x] == 1 && yi < 3 && xi < 3)\n ff[yi,xi] = 1 ^ ff[yi,xi];\n for (var y = 0 ; y < 3; y++) {\n for (var x = 0; x < 3 ; x++) Console.Write(\"{0} \", ff[y,x]);\n Console.WriteLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "07ff9b4e4af9360bec8f94d21fde7f41", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing Codeforces.R270;\nusing System;\nusing System.Diagnostics.Contracts;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace Codeforces.R275A\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 Contract.Requires(tr != null);\n Contract.Requires(tw != null);\n\n var info = CultureInfo.InvariantCulture;\n\n var a = new int[3][];\n for (int i = 0; i < 3; ++i)\n {\n a[i] = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();\n }\n\n var res = Calc(a);\n foreach (var l in res)\n {\n tw.WriteLine(l);\n }\n }\n\n private static string[] Calc(int[][] a)\n {\n Contract.Requires(a != null);\n\n var board = Enumerable.Range(0, 3).Select(i => Enumerable.Repeat(true, 3).ToArray()).ToArray();\n\n for (int i = 0; i < 3; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if (a[i][j] % 2 == 1)\n {\n board[i][j] = !board[i][j];\n if (i > 0)\n {\n board[i - 1][j] = !board[i - 1][j];\n }\n if (i < 2)\n {\n board[i + 1][j] = !board[i + 1][j];\n }\n if (j > 0)\n {\n board[i][j - 1] = !board[i][j - 1];\n }\n if (j < 2)\n {\n board[i][j + 1] = !board[i][j + 1];\n }\n }\n }\n }\n\n return board.Select(line => new string(line.Select(b => b ? '1' : '0').ToArray())).ToArray();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2b8157234f05ce800227f780be9400ef", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesTest\n{\n class Program\n {\n // static void Main(string[] args)\n // {\n // int input = Convert.ToInt32(Console.ReadLine());\n // int temp = input;\n // int numberOfDigits = (int)Math.Floor(Math.Log10(input) + 1);\n // while (temp >= 10)\n // {\n // temp /= 10;\n // }\n // int nextLuckyYear = (int)((temp + 1) * Math.Pow(10, numberOfDigits - 1));\n // int requiredYears = nextLuckyYear - input;\n // Console.WriteLine(requiredYears);\n // }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "19fc75dd8f56cb15bd704bc205d9c15b", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "difficulty": 900} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.23107.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"TEST\", \"TEST\\TEST.csproj\", \"{B83C5860-094A-4206-9885-9E45D467844A}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"WindowsFormsTEST\", \"WindowsFormsTEST\\WindowsFormsTEST.csproj\", \"{4B67BC18-D4DD-4179-9F13-033C5EA2B5D9}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B83C5860-094A-4206-9885-9E45D467844A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B83C5860-094A-4206-9885-9E45D467844A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B83C5860-094A-4206-9885-9E45D467844A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B83C5860-094A-4206-9885-9E45D467844A}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{4B67BC18-D4DD-4179-9F13-033C5EA2B5D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{4B67BC18-D4DD-4179-9F13-033C5EA2B5D9}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{4B67BC18-D4DD-4179-9F13-033C5EA2B5D9}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{4B67BC18-D4DD-4179-9F13-033C5EA2B5D9}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5cfa5243b1aa256ebf83bf79d439cb32", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "difficulty": 900} {"lang": "MS C#", "source_code": " string a = Console.ReadLine();\n int L = a.Length;\n string b = (int.Parse(a[0].ToString()) + 1).ToString();\n for (int i = 1; i < L; i++)\n {\n b += \"0\";\n }\n int otv = int.Parse(b) - int.Parse(a);\n Console.WriteLine(otv);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7bcff4caea412b2377c8143e9b225666", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Diagnostics;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\n \n\nclass P\n{\n static void Main()\n {\n int[] abc = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(3 * Min(abc[0] + 1, Min(abc[1], abc[2] - 1)));", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b4b35d00574848f1264135fa35eb9185", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass Program {\n static void Main() {\n var n = long.Parse(Console.ReadLine());\n var nd = 0; var nt = n; while (nt > 0) { nt = nt / 10; nd++; }\n\n var next = 0L;\n for (var i = 0 ; i < (nd+1)/2 ; i++) next = next*10+4;\n for (var i = (nd+1)/2 ; i <= nd ; i++) next = next*10+7;\n if (nd%2 == 0) {\n var res = 0;\n var n4 = nd / 2; var n7 = nd / 2;\n var mult = 1L; for (var i = 1 ; i < nd ; i++) mult *= 10;\n var eq = false;\n do {\n if (n4 > 0 && (n/mult <= 4 || eq)) { n4--; res += 4*mult; eq = eq || n/mult < 4; }\n else if (n7 > 0 && (n/mult <= 7 || eq)) { n7--; res += 7*mult; eq = eq || n/mult < 7; }\n else { Console.WriteLine(next); return; }\n } while (mult != 0);\n Console.WriteLine(res);\n } else Console.WriteLine(next);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a93bc4fd1f85df4ab8949e7cc6e689bd", "src_uid": "77b5f83cdadf4b0743618a46b646a849", "difficulty": 1300} {"lang": "MS C#", "source_code": "\n\n \n\n \n\n\nLuckyNumbers.cs\n\nusing System;\n\nnamespace LuckyNunmbers {\n\tclass Program {\n static void Main(string[] args) {\n var line = Console.ReadLine();\n var num = new LuckyNumber(long.Parse(line));\n Console.WriteLine(num.GetSuperLucky());\n }\n }\n\n internal enum NumberType {\n Simple, Lucky, SuperLucky\n }\n\n internal class LuckyNumber {\n\n private long _number;\n private long _lucky;\n private long _superLucky;\n\n private const uint LUCKY1 = 4;\n private const uint LUCKY2 = 7;\n\n private char CLUCKY1;\n private char CLUCKY2;\n\n public LuckyNumber(long number) {\n _number = number;\n var numType = GetNumberType();\n\n CLUCKY1 = UintToChar(LUCKY1);\n CLUCKY2 = UintToChar(LUCKY2);\n\n switch (numType) {\n case NumberType.Lucky:\n _lucky = _number;\n break;\n case NumberType.SuperLucky:\n _lucky = _number;\n _superLucky = _number;\n break;\n }\n }\n\n public long GetLucky() {\n if (_lucky != 0) return _lucky;\n\n var digits = _number.ToString().ToCharArray();\n\n if (digits.Length > 0) {\n var buff = new char[digits.Length];\n for(int i=0; i= 0) {\n buff[index] = CLUCKY2;\n index--;\n }\n\n _lucky = long.Parse(new string(buff));\n while (index < digits.Length - 1) {\n index++;\n buff[index] = CLUCKY1;\n\n var p = long.Parse(new string(buff));\n if (p > _number) _lucky = p;\n else buff[index] = CLUCKY2;\n }\n\n if(_lucky < _number) {\n var arr = new char[digits.Length + 1];\n for (int i = 0; i < arr.Length; i++) arr[i] = CLUCKY1;\n _lucky = long.Parse(new string(arr));\n }\n\n return _lucky;\n }\n return 0;\n }\n\n public long GetSuperLucky() {\n if (_superLucky != 0) return _superLucky;\n if (_lucky == 0) this.GetLucky();\n\n var num = _lucky.ToString();\n if (num.Length % 2 != 0) {\n var result = GetAbsoluteLucky(num.Length + 1);\n _superLucky = long.Parse(result);\n } else {\n var ch = ToSuperLucky(num.ToCharArray());\n _superLucky = long.Parse(new string(ch));\n }\n\n return _superLucky;\n }\n\n private string GetAbsoluteLucky(int len) {\n var right = string.Empty;\n var left = string.Empty;\n len /= 2;\n\n for (int i = 0; i < len; i++) {\n left += LUCKY1;\n right += LUCKY2;\n }\n return left + right;\n }\n\n private char[] ToSuperLucky(char[] input) {\n var diff = GetCharacterDiff(input);\n if (diff > 0) {\n Array.Reverse(input);\n var replaced = ReplaceNext(input, (uint)(diff / 2));\n Array.Reverse(replaced);\n return replaced;\n } else if (diff < 0) {\n try {\n var replaced = ReplaceFirst(input, (uint)(Math.Abs(diff) / 2));\n return replaced;\n } catch (IndexOutOfRangeException) {\n return string.Format(\"4{0}7\", GetAbsoluteLucky(input.Length)).ToCharArray();\n }\n } else return input;\n }\n\n private char[] ReplaceNext(char[] inp, uint depth, int move = 0) {\n int offset = move;\n for (int i = offset; i < inp.Length; i++) {\n move++;\n if (char.GetNumericValue(inp[i]) == LUCKY1) {\n inp[i] = CLUCKY2;\n break;\n }\n }\n depth--;\n\n if (depth > 0) return ReplaceNext(inp, depth, move);\n return inp;\n }\n\n /// \n /// Replaces LUCKY2 to LUCKY1\n /// \n /// In case of bad input\n private char[] ReplaceFirst(char[] inp, uint depth) {\n int index = inp.Length - 1;\n\n //This will throw ArgumentOutOfRangeException\n //in case if input is only LUCKY2\n while (char.GetNumericValue(inp[index]) != LUCKY1) index--;\n inp[index] = CLUCKY2;\n\n //This will throw ArgumentOutOfRangeException\n //in case if we have bad pattern\n while (depth + 1 > 0) {\n index++;\n depth--;\n inp[index] = CLUCKY1;\n }\n return inp;\n }\n\n public NumberType GetNumberType() {\n return LuckyNumber.GetNumberType(_number);\n }\n\n public static NumberType GetNumberType(long number) {\n uint l1s = 0, l2s = 0;\n foreach(var ch in number.ToString()) {\n if (char.GetNumericValue(ch) == LUCKY1) l1s++;\n else if (char.GetNumericValue(ch) == LUCKY2) l2s++;\n else return NumberType.Simple;\n }\n\n return (l1s == l2s)? NumberType.SuperLucky : NumberType.Lucky;\n }\n\n //---------------------\n\n private int GetCharacterDiff(char[] input) {\n int l1s = 0, l2s = 0;\n foreach (var ch in input) {\n if (char.GetNumericValue(ch) == LUCKY1) l1s++;\n else if (char.GetNumericValue(ch) == LUCKY2) l2s++;\n }\n\n return l1s - l2s;\n }\n\n private static string Reverse(string s) {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n private static char UintToChar(uint inp) {\n return inp.ToString()[0];\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "358d8c6a0483f3b50b7abb1fe19a8f26", "src_uid": "77b5f83cdadf4b0743618a46b646a849", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace prog2\n{\n class Program\n {\n static private int length;\n private static int c4, c7;\n private static int cur;\n private static StringBuilder o;\n private static string s;\n static bool perebor(int p)\n {\n if (p == length)\n {\n if ((c4 == c7) && (Convert.ToInt32(o.ToString()) < cur) && (Convert.ToInt32(o.ToString()) >= Convert.ToInt32(s)))\n {\n cur = Convert.ToInt32(o.ToString());\n return true;\n }\n return false;\n }\n bool r, r1;\n r = false;\n r1 = false;\n char c = o[p];\n if (c == '4') c4--;\n if (c == '7') c7--;\n c4++;\n o[p] = '4';\n perebor(p + 1);\n c4--;\n c7++;\n o[p] = '7';\n perebor(p + 1);\n c7--;\n if (c == '4') c4++;\n if (c == '7') c7++;\n o[p] = c;\n return (r || r1);\n\n }\n\n static void Main(string[] args)\n {\n s = Console.ReadLine();\n o = new StringBuilder();\n cur = int.MaxValue;\n length = s.Length;\n c4 = 0;\n c7 = 0;\n for (int i = 0; i < length;i++ )\n {\n if (s[i] == '4') c4++;\n if (s[i] == '7') c7++;\n }\n o.Append(s);\n if (!perebor(0))\n {\n o.Clear();\n o.Append('4');\n c4++;\n o.Append(s);\n length++;\n perebor(0);\n }\n Console.WriteLine(cur);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "89fe16f9c184b5f475f4aa0643bf13c1", "src_uid": "77b5f83cdadf4b0743618a46b646a849", "difficulty": 1300} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass P {\n static IEnumerable GetNums() {\n for (var i = 0L ; ; i++) {\n var c = i;\n var res = 0L; var mult = 1L;\n while (c > 0) {\n if (c > 2) {\n var o = (c - 1)%2 + 1;\n c -= o;\n res += mult * (o == 1 ? 4 : 7);\n } else {\n c--;\n res += mult * (c == 1 ? 4 : 7);\n }\n c /= 2;\n mult *= 10;\n }\n yield return res;\n }\n }\n\n public static void Main() {\n long n = long.Parse(Console.ReadLine());\n var res = GetNums().First(x => x >= n);\n Console.Write(res);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "60bad0bd40384a4506208f3036d97d84", "src_uid": "77b5f83cdadf4b0743618a46b646a849", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.31101.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication44\", \"ConsoleApplication44\\ConsoleApplication44.csproj\", \"{B4EAC425-845A-4522-8968-894DBB9017C1}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B4EAC425-845A-4522-8968-894DBB9017C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B4EAC425-845A-4522-8968-894DBB9017C1}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B4EAC425-845A-4522-8968-894DBB9017C1}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B4EAC425-845A-4522-8968-894DBB9017C1}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "515277fbc0b18ba51ab4d50d517060d9", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900} {"lang": "Mono C#", "source_code": "\nnamespace ConsoleApplication44\n{\n class Program\n {\n static void Main(string[] args)\n {\n int countBlack = 0;\n int countwhite = 0;\n string x = Console.ReadLine();\n for (int i = 0; i < x.Length; i++)\n {\n \n if (x[i] == 'q')\n countBlack += 9;\n else if (x[i ] == 'Q')\n countwhite+=9;\n else if (x[i ] == 'R')\n countwhite+=5;\n else if (x[i ] == 'r')\n countBlack+=5;\n else if (x[i] == 'b')\n countBlack += 3;\n else if (x[i ] == 'B')\n countwhite += 3;\n else if (x[i ] == 'n')\n countBlack += 3;\n else if (x[i ] == 'N')\n countwhite += 3;\n else if (x[i ] == 'p')\n countBlack += 1;\n else if (x[i ] == 'P')\n countwhite += 1;\n\n\n \n }\n if (countBlack > countwhite)\n Console.WriteLine(\"Black\");\n else if (countBlack < countwhite)\n Console.WriteLine(\"White\");\n else\n Console.WriteLine(\"Draw\");\n Console.ReadLine();\n\n \n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3e616b1859028423053d640625077063", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900} {"lang": "MS C#", "source_code": "int white=0;\n int black=0;\n for (int i = 0; i < 8; i++)\n {\n string a = Console.ReadLine();\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] == 'q')\n white = white + 9;\n else if (a[j] == 'r')\n white = white + 5;\n else if (a[j] == 'b')\n white = white + 3;\n else if (a[j] == 'n')\n white = white + 3;\n else if (a[j] == 'p')\n white = white + 1; \n else if (a[j] == 'Q')\n black = black + 9;\n else if (a[j] == 'R')\n black = black + 5;\n else if (a[j] == 'B')\n black = black + 3;\n else if (a[j] == 'N')\n black = black + 3;\n else if (a[j] == 'P')\n black = black + 1; \n } \n }\n if (white > black)\n {\n Console.WriteLine(\"Black\");\n }\n \n else if (black > white)\n {\n Console.WriteLine(\"White\");\n }\n \n else \n {\n Console.WriteLine(\"Draw\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dadcce138329911b6bb0a56c66f5ee78", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace LongPath\n{\n public class Problem417A\n {\n public static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n var c = input[0];\n var d = input[1];\n\n input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n var n = input[0];\n var m = input[1];\n\n var k = int.Parse(Console.ReadLine());\n\n var mainpp = c / n;\n\n var count = 0;\n var candidates = n * m - k;\n \n while (candidates > 0)\n {\n if (int(c / n) <= d)\n {\n count += c;\n candidates -= n;\n }\n else {\n count += d;\n candidates--;\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3a094e0a9df6029e167cf64d6f3815b2", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500} {"lang": "Mono C#", "source_code": "using 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 string n = Console.ReadLine();\n string text = Console.ReadLine();\n for (int i = 0; i < n; i++)\n {\n text = text.Replace(\"RU\", \"D\");\n\n \n text = text.Replace(\"UR\", \"D\");\n\n }\n \n Console.WriteLine(text.Length);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2abb499f5b1be8b126956d5ea5f14bfb", "src_uid": "986ae418ce82435badadb0bd5588f45b", "difficulty": 800} {"lang": "Mono C#", "source_code": "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 Console.ReadKey();\n \n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "306ec6e9d5a44fa53bc4d6eac5fc3218", "src_uid": "986ae418ce82435badadb0bd5588f45b", "difficulty": 800} {"lang": "Mono C#", "source_code": "/*\n * User: \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n * Date: 11.02.2016\n * Time: 11:49\n\n\nA. \ufffd\ufffd\ufffd\ufffd\ufffd\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: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5....\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 1, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd 1 \ufffd\ufffd 2,\n\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd 1 \ufffd\ufffd 3, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd 1 \ufffd\ufffd 4 \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.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd 10 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd 55 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd (\ufffd\ufffd\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 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.\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 n (1 <= n <= 10^14) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\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 32-\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 long long \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++ \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd long \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd Java.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\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).\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\n3\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n2\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\n2\n\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\ufffd\ufffd\ufffd\ufffd\n4\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n55\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\ufffd\ufffd\ufffd\n56\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1\n\n\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\tInt64 n = Int64.Parse (Console.ReadLine ());\n\t\t\tInt64 m = int.Parse (Console.ReadLine ());\n\t\t\tint [] a = new int [n];\n\t\t\tfor ( int i=0; i < n; i++ )\n\t\t\t\ta [i] = int.Parse (Console.ReadLine ());\n\n\t\t\tArray.Sort (a);\n\n\t\t\tint k=0, m=0;\n\t\t\tfor ( int j=n-1; k < b; j--, m++ )\n\t\t\t\tk += a [j];\n\n\t\t\tConsole.WriteLine (m);\n\n//\t\t\tConsole.ReadKey(true);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5fca77ea42b73e4bd51064f8eceb8d3b", "src_uid": "1db5631847085815461c617854b08ee5", "difficulty": 1000} {"lang": "Mono C#", "source_code": "class Solution {\n static void Main(String[] args) {\n \n string[] l=Console.ReadLine().Split();\n int n= Convert.ToInt32(l[0]);\n int i = 0;\n int s = 0;\n while(i < n)\n {\n s = s + i + (i - s);\n i++;\n }\n Console.WriteLine(n - s + i);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "95bb2013a4a327459f72b7ac147f5266", "src_uid": "1db5631847085815461c617854b08ee5", "difficulty": 1000} {"lang": "Mono C#", "source_code": "class Solution {\n static void Main(String[] args) {\n \n string[] l=Console.ReadLine().Split();\n int n= Convert.ToInt32(l[0]);\n int i = 1;\n int s = 0;\n while(i < n)\n {\n s = s + i + (i - s);\n i++;\n }\n Console.WriteLine(n - s + i);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5aca553c764d35a946038ee47893819f", "src_uid": "1db5631847085815461c617854b08ee5", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Array.Sort(a);\n int s = 0;\n for (int i = 0; i < n-2; i++)\n {\n if (a[i] + a[i + 1] = a[i + 2])\n {\n Console.WriteLine(\"Yes\");\n s = 1;\n break;\n }\n }\n if (s == 0)\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b51f9ad3add8aed5ea7470b745c927e5", "src_uid": "897bd80b79df7b1143b652655b9a6790", "difficulty": 1000} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Mahmoud and a Triangle\", \"Mahmoud and a Triangle\\Mahmoud and a Triangle.csproj\", \"{56457C61-535C-41BE-A293-79821A8104C2}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{56457C61-535C-41BE-A293-79821A8104C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{56457C61-535C-41BE-A293-79821A8104C2}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{56457C61-535C-41BE-A293-79821A8104C2}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{56457C61-535C-41BE-A293-79821A8104C2}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "405b3e59a634545e4eef57ea19c37172", "src_uid": "897bd80b79df7b1143b652655b9a6790", "difficulty": 1000} {"lang": "Mono C#", "source_code": "// C# program to find if \n// it is possible to form \n// a triangle from array values \nusing System; \n\nclass GFG \n{ \n\t\t\n\t// Method prints possible \n\t// triangle when array values \n\t// are taken as sides \n\tstatic bool isPossibleTriangle(int []arr, \n\t\t\t\t\t\t\t\tint N) \n\t{ \n\t\t// If number of elements \n\t\t// are less than 3, then \n\t\t// no triangle is possible \n\t\tif (N < 3) \n\t\t\treturn false; \n\t\n\t\t// first sort the array \n\t\tArray.Sort(arr); \n\t\n\t\t// loop for all 3 \n\t\t// consecutive triplets \n\t\tfor (int i = 0; i < N - 2; i++) \n\t\n\t\t\t// If triplet satisfies triangle \n\t\t\t// condition, break \n\t\t\tif (arr[i] + arr[i + 1] > arr[i + 2]) \n\t\t\t\treturn true; \n\t\t\t\t\n\t\treturn false; \n\t} \n\t\n\t// Driver Code \n\tstatic public void Main () \n\t{ \n\t\tvar input = Console.ReadLine();\n int n = int.Parse(input),ct=0;\n var arr = Console.ReadLine().Split().Select((s) => \n Convert.ToInt32(s)).ToArray();\n\t\t\n\t\tif(isPossibleTriangle(arr, N)) \n\t\t\tConsole.WriteLine(\"YES\" ); \n\t\telse\n\t\t\tConsole.WriteLine(\"NO\"); \n\t} \n} \n\n// This code is contributed by vt_m. \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bd70e5555a47c2c16e0fe0b783f8ad22", "src_uid": "897bd80b79df7b1143b652655b9a6790", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n int[] frts, sec;\n { \n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\n', '\\r', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(input[0]);\n frts = new int[n++];\n for (int i = 2, j = 0; i <= n; ++i, j++)\n frts[j] = int.Parse(input[i]);\n sec = new int[input.Length - n++];\n for (int j = 0; n < input.Length; ++n, ++j)\n sec[j] = int.Parse(input[n]);\n }\n Array.Sort(frts);\n int nm = int.MinValue;\n for(int i = 0; i= 0) Console.WriteLine(frts[nm]);\n else\n {\n nm = sec.Min();\n if (nm > frts[0]) Console.WriteLine(\"{0}{1}\", frts[0], nm);\n else Console.WriteLine(\"{0}{1}\", nm, frts[0]);\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0236036968465edcbf41e14774dfc6b6", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n//using System.Console;\n\nnamespace PrettyIntegers\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int n,m;\n n = Console.Read();\n m = Console.Read();\n List N = new List();\n List M = new List();\n\n for(int i = 0; i N = new List();\n List M = new List();\n\n parts = Console.ReadLine().Split(' ');\n for(int i = 0; i= 7 && input.StartsWith('1')) Console.WriteLine(\"yes\");\n\t\telse Console.WriteLine(\"no\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7aed6c4b41de85886e5683d4803e5725", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring input = Console.ReadLine();\n\t\tif (input.Length >= 7 && input.StartsWith('1')) Console.WriteLine(\"yes\");\n\t\telse Console.WriteLine(\"no\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4aeff9f2c9304e0342a5f3ac526952ac", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\npublic class Program\n {\n public static void Main(string[] args)\n {\n int i = input.IndexOf('1');\n if (i < 0) Console.WriteLine(\"no\");\n else\n {\n int zeros = 0;\n for (; i < input.Length; ++i)\n if (input[i] == '0') zeros++;\n Console.Write(zeros >= 6 ? \"yes\" : \"no\");\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "20f1e4d17addd25394e079ea8641da19", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000} {"lang": "MS C#", "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 for (var i = 0; ; i = (i+1)%3) {\n var a = new [] { r[0], r[1], r[2],\n c[0], c[1], c[2],\n d1, d2 };\n\n var diff = a.Max() - a.Min();\n if (diff == 0) break;\n\n var c2 = (new [] { r[i], c[i], i==1?d2:int.MaxValue}).Min();\n diff = a.Max() - c2.Min();\n m[i][i]+=diff; r[i]+=diff; c[i]+=diff; d1 += diff; if (i==2)d2+=diff;\n }\n for (var y = 0; y < 3 ; y++) Console.WriteLine(string.Join(\" \", m[y]));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b68e6983f934d63d802b12fb208b440", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100} {"lang": "MS C#", "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 for (var i = 0; ; i = (i+1)%3) {\n var a = new [] { r[0], r[1], r[2],\n c[0], c[1], c[2],\n d1, d2 };\n\n var diff = a.Max() - a.Min();\n if (diff == 0) break;\n\n var c = (new [] { r[i], c[i], i==1?d2:int.MaxValue}).Min();\n diff = a.Max() - c.Min();\n m[i][i]+=diff; r[i]+=diff; c[i]+=diff; d1 += diff; if (i==2)d2+=diff;\n }\n for (var y = 0; y < 3 ; y++) Console.WriteLine(string.Join(\" \", m[y]));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1c2070ca6787a7b5690e001855b2e5eb", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100} {"lang": "Mono C#", "source_code": "string[] y = Console.ReadLine().Split();\n\t\tint a = int.Parse(y[0]);\n\t\tint b = int.Parse(y[1]);\n\t\tint c = int.Parse(y[2]);\n\t\tchar q='?';\n\t\tif(a-b-c>0)\n\t\t{\n\t\t\tq = '+';\n\t\t} \n\t\telse if(b-a-c>0)\n\t\t{\n\t\t\tq='-';\n\t\t} \n\t\telse if(a==b && c==0)\n\t\t{\n\t\t\tq='0';\n\t\t}\n\t\tConsole.WriteLine(q);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5a53caa3029da176b0b46e7265bea881", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\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 = new int[n];\n string[] s = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(s[i]);\n }\n Array.Sort(a);\n Console.WriteLine(a[n / 2 + 1]);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "10fde2b69b5c30d48b334f2eff308cb7", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800} {"lang": "MS C#", "source_code": " var NumberOfGroup = Convert.ToInt32(Console.ReadLine());\n var Years = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n if (NumberOfGroup == 1)\n {\n Console.WriteLine(Years[0]);\n return;\n }\n int Answer = Years.Sum() / NumberOfGroup;\n Console.WriteLine(Answer);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a57ab1edd5b928a34284bda71166efb3", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800} {"lang": "MS C#", "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 static void Main(string[] args)\n {\n\n int n = Convert.ToInt32(Console.ReadLine());\n var Arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n if (n == 1)\n {\n Console.WriteLine(Arr[0].ToString());\n }\n else\n {\n Array.Sort(Arr);\n Console.WriteLine(Arr[(n == 3) ? 1 : 2]);\n }\n\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fa0a81a8d89366188dd48056d5e55735", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\n\nclass P { \n static void Main() { \n var n = long.Parse(Console.ReadLine());\n var xmax = Math.Sqrt(n);\n var smax = ((int)Math.Ceiling(Math.Log10(xmax))) *9;\n\n Func sq = a => {\n var sq = (long)Math.Sqrt(a);\n if (sq*sq == a) return sq;\n sq++;\n if (sq*sq == a) return sq;\n return -1;\n };\n\n for (var s = 1 ; s <= smax ; s++) {\n var d = sq(s*s+4*n);\n if (d < 0) continue;\n var x2 = d - s;\n if (x2 % 2 == 1) continue;\n var x = x2 / 2;\n var tmp = x;\n var sum = 0;\n while (tmp > 0) { sum += tmp % 10; tmp /= 10; }\n if (sum != s) continue;\n Console.Write(x);\n return;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4749ae1c1dc3db7a71ed479235502159", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "difficulty": 1400} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {8295E71E-212F-4144-A959-F6F329C0C230}\n Exe\n Properties\n Nekvadratnoe_yravnenie\n Nekvadratnoe_yravnenie\n v4.0\n Client\n 512\n \n \n x86\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n x86\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5f9c83de72ea57b1221462be1b6fffba", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "difficulty": 1400} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace NonSquareEquation\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n=Convert.ToInt64(Console.ReadLine());\n for (long i = 0; i < Int64.MaxValue; i++)\n {\n if(i*i+(s(i)*i)==n)\n {\n Console.WriteLine(i);\n return;\n }\n }\n Console.WriteLine(\"-1\");\n return;\n }\n\n public static int s(long x)\n {\n int temp=0;\n while (x > 0)\n {\n temp = temp + (int)(x % 10);\n x = x / 10;\n }\n return temp;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "600243bd456cb361ea2c7bdb595ac4b0", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "difficulty": 1400} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string textBox1 = Console.ReadLine();\n string textBox2 = Console.ReadLine();\n int max = textBox1.Length;\n int valor = 0, valorTemp = 0;\n for (int i = 0; i < textBox1.Length; i++)\n {\n if (textBox1[i] == textBox2[0])\n {\n valorTemp = moduloDeCadenaMasLarga(i + 1,textBox1,textBox2);\n if (valorTemp > valor)\n {\n valor = valorTemp;\n }\n }\n }\n\n Console.WriteLine(valor);\n }\n\n private static int moduloDeCadenaMasLarga(int inicio, string textBox1, string textBox2)\n {\n int longitud = 0;\n int contadorSubcadena = 1;\n int longitudDerecha = 0;\n int inicioIntermedio = inicio;\n int finIntermedio = 0;\n int longitudIntermedio = 0;\n int longitudIntermedioTemp = 0;\n for (int i = inicio; i < textBox1.Text.Length; i++)\n {\n if (textBox1.Text[i] == textBox2.Text[contadorSubcadena])\n {\n finIntermedio = i - 1;\n longitudIntermedioTemp = finIntermedio - inicioIntermedio;\n if (longitudIntermedioTemp > longitudIntermedio)\n {\n longitudIntermedio = longitudIntermedioTemp;\n }\n inicioIntermedio = i;\n contadorSubcadena++;\n }\n if (contadorSubcadena == textBox2.Text.Length)\n {\n longitudDerecha = (textBox1.Text.Length - 1) - i;\n break;\n }\n }\n if (contadorSubcadena == textBox2.Text.Length)\n {\n if (longitudDerecha > (inicio - 1) && longitudDerecha > longitudIntermedio)\n {\n longitud = longitudDerecha;\n }\n else if (longitudIntermedio > (inicio - 1))\n {\n longitud = longitudIntermedio;\n }\n else\n {\n longitud = inicio - 1;\n }\n }\n return longitud;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "adb6bf99c60879ee22ad9ff9a80339d9", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\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\n DateTime nextTime = DateTime.Now;\n DateTime currentTime = nextTime.AddYears(1);\n Dictionary dict = new Dictionary()\n {\n {\"Monday\", 1 },\n {\"Tuesday\", 2 },\n {\"Wednesday\", 3 },\n {\"Thursday\", 4 },\n {\"Friday\", 5 },\n {\"Saturday\", 6 },\n {\"Sunday\", 7 }\n };\n\n int[] months = {1,2,3,4,5,6,7,8,9,10,11,12};\n int nextYear = currentTime.Year;\n\n string[] textAll = Console.ReadLine()?.Split(' ');\n int number = Convert.ToInt32(textAll?[0]);\n string text = textAll?[2];\n int result = 0;\n\n if (text.Equals(\"week\"))\n {\n foreach (var m in months)\n {\n int daysInMonth = DateTime.DaysInMonth(nextYear, m);\n for (int i = 1;i <= daysInMonth; i++ )\n {\n DateTime day = new DateTime(currentTime.Year, m, i);\n DayOfWeek d = day.DayOfWeek; \n int dInt = dict[d.ToString()];\n if (number == dInt)\n {\n result++;\n }\n }\n }\n }\n if (text.Equals(\"month\"))\n {\n foreach (var m in months)\n {\n int daysInMonth = DateTime.DaysInMonth(nextYear, m);\n if (number <= daysInMonth)\n {\n result++;\n }\n }\n }\n System.Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2fc385bfea82dc35ac97d67bba34e8d1", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\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\n DateTime nextTime = DateTime.Now;\n DateTime currentTime = nextTime.AddYears(1);\n Dictionary dict = new Dictionary()\n {\n {\"Monday\", 1 },\n {\"Tuesday\", 2 },\n {\"Wednesday\", 3 },\n {\"Thursday\", 4 },\n {\"Friday\", 5 },\n {\"Saturday\", 6 },\n {\"Sunday\", 7 }\n };\n\n int[] months = {1,2,3,4,5,6,7,8,9,10,11,12};\n int nextYear = currentTime.Year;\n\n string[] textAll = Console.ReadLine().Split(' ');\n int number = Convert.ToInt32(textAll?[0]);\n string text = textAll?[2];\n int result = 0;\n\n if (text.Equals(\"week\"))\n {\n foreach (var m in months)\n {\n int daysInMonth = DateTime.DaysInMonth(nextYear, m);\n for (int i = 1;i <= daysInMonth; i++ )\n {\n DateTime day = new DateTime(currentTime.Year, m, i);\n DayOfWeek d = day.DayOfWeek; \n int dInt = dict[d.ToString()];\n if (number == dInt)\n {\n result++;\n }\n }\n }\n }\n if (text.Equals(\"month\"))\n {\n foreach (var m in months)\n {\n int daysInMonth = DateTime.DaysInMonth(nextYear, m);\n if (number <= daysInMonth)\n {\n result++;\n }\n }\n }\n System.Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5a4538b7467de0d963e9c79804072c4d", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\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\n DateTime nextTime = DateTime.Now;\n DateTime currentTime = nextTime.AddYears(1);\n Dictionary dict = new Dictionary()\n {\n {\"Monday\", 1 },\n {\"Tuesday\", 2 },\n {\"Wednesday\", 3 },\n {\"Thursday\", 4 },\n {\"Friday\", 5 },\n {\"Saturday\", 6 },\n {\"Sunday\", 7 }\n };\n\n int[] months = {1,2,3,4,5,6,7,8,9,10,11,12};\n int nextYear = currentTime.Year;\n\n string[] textAll = Console.ReadLine().Split(' ');\n int number = Convert.ToInt32(textAll[0]);\n string text = textAll?[2];\n int result = 0;\n\n if (text.Equals(\"week\"))\n {\n foreach (var m in months)\n {\n int daysInMonth = DateTime.DaysInMonth(nextYear, m);\n for (int i = 1;i <= daysInMonth; i++ )\n {\n DateTime day = new DateTime(currentTime.Year, m, i);\n DayOfWeek d = day.DayOfWeek; \n int dInt = dict[d.ToString()];\n if (number == dInt)\n {\n result++;\n }\n }\n }\n }\n if (text.Equals(\"month\"))\n {\n foreach (var m in months)\n {\n int daysInMonth = DateTime.DaysInMonth(nextYear, m);\n if (number <= daysInMonth)\n {\n result++;\n }\n }\n }\n System.Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "18ec6609295cb889aff064a9e87b33a8", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\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\n DateTime currentTime = DateTime.Now;\n currentTime.AddYears(1);\n Dictionary dict = new Dictionary()\n {\n {\"Monday\", 1 },\n {\"Tuesday\", 2 },\n {\"Wednesday\", 3 },\n {\"Thursday\", 4 },\n {\"Friday\", 5 },\n {\"Saturday\", 6 },\n {\"Sunday\", 7 }\n };\n\n int[] months = {1,2,3,4,5,6,7,8,9,10,11,12};\n int nextYear = currentTime.Year;\n\n string[] textAll = Console.ReadLine()?.Split(' ');\n int number = Convert.ToInt32(textAll?[0]);\n string text = textAll?[2];\n int result = 0;\n\n if (text.Equals(\"week\"))\n {\n foreach (var m in months)\n {\n int daysInMonth = DateTime.DaysInMonth(nextYear, m);\n for (int i = 1;i <= daysInMonth; i++ )\n {\n DateTime day = new DateTime(currentTime.Year, m, i);\n DayOfWeek d = day.DayOfWeek; \n int dInt = dict[d.ToString()];\n if (number == dInt)\n {\n result++;\n }\n }\n }\n }\n if (text.Equals(\"month\"))\n {\n foreach (var m in months)\n {\n int daysInMonth = DateTime.DaysInMonth(nextYear, m);\n if (number <= daysInMonth)\n {\n result++;\n }\n }\n }\n System.Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c605fbc8e0b73e268ee48030c02a30df", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900} {"lang": "Mono C#", "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 a = sc.NextInt();\n for (int n = a; ; n++)\n {\n var str = n.ToString();\n var sum = 0;\n foreach (var c in sum)\n {\n sum += c - '0';\n }\n\n if (sum % 4 == 0)\n {\n Console.WriteLine(n);\n return;\n }\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6c6dd067c81da57db3f03f035018b6ee", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Codeforces.Codeforces;\n\nnamespace Codeforces\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n for (int i = n; i <= 1000; i++)\n {\n int[] arr = IntArray(i);\n int total = 0;\n\n for (int k = 0; k < arr.Length; k++)\n { \n total += arr[k];\n }\n\n if (total % 4 == 0)\n {\n Console.WriteLine(i);\n break;\n }\n }\n }\n\n public static int[] IntArray(int num)\n {\n List listOfInts = new List();\n while (num > 0)\n {\n listOfInts.Add(num % 10);\n num = num / 10;\n }\n listOfInts.Reverse();\n return listOfInts.ToArray();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b454eb321b250fbe0b12774ff8698caf", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30011.22\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"CodeForces\", \"CodeForces\\CodeForces.csproj\", \"{EED76156-CCE4-42C9-A987-930CFF62AF5F}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{EED76156-CCE4-42C9-A987-930CFF62AF5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{EED76156-CCE4-42C9-A987-930CFF62AF5F}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{EED76156-CCE4-42C9-A987-930CFF62AF5F}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{EED76156-CCE4-42C9-A987-930CFF62AF5F}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {1C1D43E7-DF4C-4656-AEE4-ABD77639473E}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "652b100f52c51bb474d371c40efa8c1a", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26730.16\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp1\", \"ConsoleApp1\\ConsoleApp1.csproj\", \"{ABB1C275-B0DD-4207-98C6-3E1AF08D4A7C}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{ABB1C275-B0DD-4207-98C6-3E1AF08D4A7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{ABB1C275-B0DD-4207-98C6-3E1AF08D4A7C}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{ABB1C275-B0DD-4207-98C6-3E1AF08D4A7C}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{ABB1C275-B0DD-4207-98C6-3E1AF08D4A7C}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {1753EC7D-E288-4292-84B8-C1654AC04FA8}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "85ec1ddca870246c791531652d41bc9d", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "difficulty": 800} {"lang": "Mono C#", "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 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}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4bc0c5acdd17893aa5a6de77722433fa", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "difficulty": 800} {"lang": "Mono C#", "source_code": "int[] 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);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fbf1a3239b60e462ab50a9b77e97e962", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "88aeba9eb6a75d7cccbb6712a853ffee", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "difficulty": 800} {"lang": "Mono C#", "source_code": "List l = new List();\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring start = Console.ReadLine();\n\t\t\tstring end = Console.ReadLine();\n\t\t\tint start_col = Convert.ToInt32(start[0]);\n\t\t\tint end_col = Convert.ToInt32(end[0]);\n\t\t\tint start_row = Convert.ToInt32(start[1]);\n\t\t\tint end_row = Convert.ToInt32(end[1]);\n\t\t\tchar move_vert='0';\n\t\t\tchar move_hor='0';\n\t\t\tint hor_dif = Math.Abs(start_col-end_col);\n\t\t\tint vert_dif = Math.Abs(start_row-end_row);\n\t\t\tif(start_col!=end_col){\n\t\t\t\tif(start_col= oddDivisor)\n\t\t\t{\n\t\t\t\tif (temp % oddDivisor == 0)\n\t\t\t\t{\n\t\t\t\t\tprimeDivisorCount++;\n\t\t\t\t\tif (primeDivisorCount > 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\twhile (temp % oddDivisor == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\ttemp = temp / oddDivisor;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\toddDivisor += 2;\n\t\t\t}\n\t\t\t\n\t\t\tif (primeDivisorCount == 2)\n\t\t\t{\n\t\t\t\tsolution++;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(solution);\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "16b2a3a78bcbb85cdffb5a3a00c12297", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n double d = double.Parse(input[0]);\n double L = double.Parse(input[1]);\n double v1 = double.Parse(input[2]);\n double v2 = double.Parse(input[3]);\n double y = (L - d) / (v1 + v2);\n string answer = y.ToString(CultureInfo.InvariantCulture);\n Console.WriteLine(answer);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c777eda65e56bc8f09a0171014857f3b", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27130.2024\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp7\", \"ConsoleApp7\\ConsoleApp7.csproj\", \"{8D0ED673-8B30-4B7C-8D23-B72BB1BBCF32}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{8D0ED673-8B30-4B7C-8D23-B72BB1BBCF32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{8D0ED673-8B30-4B7C-8D23-B72BB1BBCF32}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{8D0ED673-8B30-4B7C-8D23-B72BB1BBCF32}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{8D0ED673-8B30-4B7C-8D23-B72BB1BBCF32}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {068B1F18-236E-42F9-A338-C473F338CB4E}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f11c7684c687dcc61c5fe51411313a44", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800} {"lang": "MS C#", "source_code": "#include \nusing namespace std;\n#define S second\n#define F first\n#define MOD 1000000007\ntypedef long long llint;\ntypedef pair pii;\nvector > a;\n\nint main()\n{\nint N;cin>>N;\nint x;\na.assign(N+1,vector(0));\nfor(int i=1;i<=N;i++)\n{\n cin>>x;\n a[x].push_back(i);\n a[i].push_back(x);\n}\nreturn 0;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "28ed817861c84dea0d72ef70496954cf", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800} {"lang": "MS C#", "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 //inputs Bitch\n int []ip=Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries).Select(x=>int.Parse(x)).ToArray();\n int d=ip[0],l=ip[1],v1=ip[2],v2=ip[3];\n //logic Bitch\n double ans=l-d;\n ans=ans/Math.Abs(v1+v2);\n Console.WriteLine(ans.ToString(CultureInfo.GetCultureInfo(\"en-US\")));\n \n \n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aacb54b29c6219a9623384913dc79d88", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {8D0ED673-8B30-4B7C-8D23-B72BB1BBCF32}\n Exe\n ConsoleApp7\n ConsoleApp7\n v4.6.1\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a9bf9859a45b167865cfa1c7cb8bd421", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800} {"lang": "Mono C#", "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 = new string[n];\n bool g=false;\n for (int i = 0; i < n; i++)\n {\n string[] temp = Console.ReadLine().Split(' ');\n Int64 a = Int64.Parse(temp[0]);\n Int64 b = Int64.Parse(temp[1]);\n\n if (Math.Abs(a - b) == 1)\n {\n bool f = false;\n for (Int64 j = 2; j < Math.Sqrt(a + b)+2; j++)\n {\n if (((a + b) % j == 0)&&(g<=a+b))\n {\n f = true;\n break;\n }\n }\n if (f)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n\n\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd4cfb22931e9a039c5fbd6328a7e0a8", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "difficulty": 1100} {"lang": "MS C#", "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 var n = s[0]; var x = s[1]; var p = s[2];\n\n var res = (int)Math.Ceil(n*p/100.0)-x;\n Console.Write(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a164ba01d3fbbfeb17a35e68d2cea545", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900} {"lang": "MS C#", "source_code": "class Program\n {\n private static double SqrDistance(double x1, double y1, double x2, double y2)\n {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n }\n\n static void Main()\n {\n string input = Console.ReadLine();\n string[] intputNumbers = input.Split(' ');\n\n double x, y;\n x = Convert.ToInt64(intputNumbers[0]);\n y = Convert.ToInt64(intputNumbers[1]);\n\n double x1 = 0, y1 = 0, x2 = 0, y2 = 0;\n double height = Math.Sqrt(SqrDistance(x, y, x, 0));\n\n if(x > 0 && y > 0)\n Console.Write(0.ToString() + \" \" + (x + height).ToString() + \" \" + (x + height).ToString() + \" \" + 0.ToString());\n else if(x < 0 && y > 0)\n Console.Write((x - height).ToString() + \" \" + 0.ToString() + \" \" + 0.ToString() + \" \" + (-x + height).ToString());\n else if (x < 0 && y < 0)\n Console.Write((x - height).ToString() + \" \" + 0.ToString() + \" \" + 0.ToString() + \" \" + (x - height).ToString());\n else if (x > 0 && y < 0)\n Console.Write(0.ToString() + \" \" + (x + height).ToString() + \" \" + (x + height).ToString() + \" \" + 0.ToString());\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fd1b0cf11e42cd6623ac340cd5645b48", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000} {"lang": "MS C#", "source_code": "private static double SqrDistance(double x1, double y1, double x2, double y2)\n {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n }\n\nstatic void Main()\n {\n string input = Console.ReadLine();\n string[] intputNumbers = input.Split(' ');\n\n double x, y;\n x = Convert.ToInt64(intputNumbers[0]);\n y = Convert.ToInt64(intputNumbers[1]);\n\n double x1 = 0, y1 = 0, x2 = 0, y2 = 0;\n double height = Math.Sqrt(SqrDistance(x, y, x, 0));\n\n if(x > 0 && y > 0)\n Console.Write(0.ToString() + \" \" + (x + height).ToString() + \" \" + (x + height).ToString() + \" \" + 0.ToString());\n else if(x < 0 && y > 0)\n Console.Write((x - height).ToString() + \" \" + 0.ToString() + \" \" + 0.ToString() + \" \" + (-x + height).ToString());\n else if (x < 0 && y < 0)\n Console.Write((x - height).ToString() + \" \" + 0.ToString() + \" \" + 0.ToString() + \" \" + (x - height).ToString());\n else if (x > 0 && y < 0)\n Console.Write(0.ToString() + \" \" + (x + height).ToString() + \" \" + (x + height).ToString() + \" \" + 0.ToString());\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "86064ff9c75ce04b6130327b0d83c107", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000} {"lang": "MS C#", "source_code": "public class Program{\n public static void Main(){\n int x, y;\n string[] line = Console.ReadLine().Split(' ');\n x = int.Parse(line[0]);\n y = int.Parse(line[1]);\n \n int sum = Math.Abs(x) + Math.Abs(y);\n \n if(x > 0 && y > 0)\n Console.WriteLine(\"{0} {1} {2} {3}\", 0, sum, sum, 0);\n else if(x > 0 && y < 0) \n Console.WriteLine(\"{0} {1} {2} {3}\", 0, -sum, sum, 0);\n else if(x < 0 && y > 0) \n Console.WriteLine(\"{0} {1} {2} {3}\", -sum, 0, 0, sum);\n else \n Console.WriteLine(\"{0} {1} {2} {3}\", -sum, 0, 0, -sum);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ee4c41d991dde1e10e72a199020c0878", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000} {"lang": "MS C#", "source_code": "public class Program{\n public static void Main(){\n int x, y;\n string[] line = Console.ReadLine().Split(' ');\n x = int.Parse(line[0]);\n y = int.Parse(line[1]);\n \n int sum = Math.Abs(x) + Math.Abs(y);\n \n if(x > 0 && y > 0)\n Console.WriteLine({0} {1} {2} {3}, 0, sum, sum, 0);\n else if(x > 0 && y < 0) \n Console.WriteLine({0} {1} {2} {3}, 0, -sum, sum, 0);\n else if(x < 0 && y > 0) \n Console.WriteLine({0} {1} {2} {3}, -sum, 0, 0, sum);\n else \n Console.WriteLine({0} {1} {2} {3}, -sum, 0, 0, -sum);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bc4f91cef9b24aa3d7041d3dda6229d7", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000} {"lang": "MS C#", "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#if DEBUG\n Console.SetIn(System.IO.File.OpenText(\"in.txt\"));\n#endif\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(26);\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 static void Gen()\n {\n var stream = new System.IO.StreamWriter(\"in.txt\");\n var rand = new Random();\n for (int i = 0; i < 1_000_000; i++)\n {\n stream.Write((char)('A' + rand.Next(25)));\n }\n stream.Close();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b79735b2628e590db120e365689c3928", "src_uid": "216323563f5b2dd63edc30cb9b4849a5", "difficulty": 1100} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Drawing;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Console.ReadLine();\n var str = Console.ReadLine();\n var c = 0;\n var FS = 0;\n var SF = 0;\n for (var i = 2; i < Convert.ToInt32(n); i+=2)\n {\n\n if (str.Substring(c, i) == \"SF\")\n SF++;\n else FS++;\n c = i;\n }\n Console.WriteLine(FS > SF ? \"FS\" : \"SF\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a213806ca67275a149ca9c56ca8992a8", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text.RegularExpressions;\n\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Console.ReadLine();\n var str = Console.ReadLine();\n Console.WriteLine(Regex.Matches(str, \"SF\").Count> Regex.Matches(str, \"FS\").Count ? \"YES\" : \"NO\");\n }\n }\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a74c898cdbdb837aa22691ef6470af21", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800} {"lang": "Mono C#", "source_code": "\n List arr = new List();\n int n,Y=0,N=0,j2;\n string str,s1,s2;\n n = int.Parse(Console.ReadLine());\n for (int i = 0; i < n; i++)\n {\n arr.Add(Console.ReadLine());\n }\n for (int j = 0; j < n; j++)\n {\n if (j+1 < n)\n {\n str = string.Concat(arr[j], arr[j + 1]);\n if (str == \"SF\")\n {\n Y += 1;\n }\n if (str == \"FS\")\n {\n N += 1;\n }\n }\n \n }//for\n if (Y>N)\n {\n Console.WriteLine(\"YES\"); \n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b8bd53355f91bd51d1be3300058789ce", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800} {"lang": "Mono C#", "source_code": "\n class Program\n {\n static void Main(string[] args)\n {\n var n = Console.ReadLine();\n var str = Console.ReadLine();\n var c = 0;\n var FS = 0;\n var SF = 0;\n for (var i = 2; i < Convert.ToInt32(n); i+=2)\n {\n\n if (str.Substring(c, i) == \"SF\")\n SF++;\n else FS++;\n c = i;\n }\n Console.WriteLine(FS > SF ? \"FS\" : \"SF\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a5b98269d153e1e3fffb30e31eaf1367", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\n\n\n\npublic class Program\n{\n public static void Main()\n {\n int A = int.Parse(Console.ReadLine());\n string joy = Console.ReadLine();\n int b=joy.Length;\n if(joy[0]=='S'&&joy[b-1]=='F')\n {\n Console.WriteLine(\"YES\");\n\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ffffda3ab1c874228171935080d86c16", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800} {"lang": "Mono C#", "source_code": " static void Main(string[] args)\n {\n var n = Console.ReadLine();\n var str = Console.ReadLine();\n var c = 0;\n var FS = 0;\n var SF = 0;\n for (var i = 2; i < Convert.ToInt32(n); i+=2)\n {\n\n if (str.Substring(c, i) == \"SF\")\n SF++;\n else FS++;\n c = i;\n }\n Console.WriteLine(FS > SF ? \"FS\" : \"SF\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "199fd4b3313d0c6176e00a274c3859e2", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text.RegularExpressions; \nstatic void Main(string[] args)\n{\n var n = Console.ReadLine();\n var str = Console.ReadLine();\n Console.WriteLine(Regex.Matches(str, \"SF\").Count> Regex.Matches(str, \"FS\").Count ? \"YES\" : \"NO\");\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b613bab26890bde18978dc05dccb2508", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26730.16\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp10\", \"ConsoleApp10\\ConsoleApp10.csproj\", \"{892D3637-102B-45A3-BCEA-60A9F01CE1C1}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{892D3637-102B-45A3-BCEA-60A9F01CE1C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{892D3637-102B-45A3-BCEA-60A9F01CE1C1}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{892D3637-102B-45A3-BCEA-60A9F01CE1C1}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{892D3637-102B-45A3-BCEA-60A9F01CE1C1}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {E31B0511-87CC-4B41-8654-8DF6F2D9E161}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f3fe2c87bc04d77525e9ebfd3fc2a1c2", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800} {"lang": "Mono C#", "source_code": "class 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "56656f45ef8bf833b9bb4ff6616fabdb", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000} {"lang": "Mono C#", "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/contest/1154/problem/C\npublic class GourmetCat\n{\n private static void Solve()\n {\n int[] a = ReadIntArray();\n int[] week = new int[14] { 0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0, };\n \n // Get maximum common weeks\n int nWeeks = Min(a[0] / 3, Min(a[1] / 2, a[2] / 2));\n eat[0] -= n * 3;\n eat[1] -= n * 2;\n eat[2] -= n * 2;\n\n // Add extra days that conform less than a week\n int max = 0;\n for (int i = 0; i < 7; i++)\n {\n int[] aClone = (int[])a.Clone();\n int j;\n for (j = i; j < i + 7; j++)\n {\n if (aClone[week[j]] == 0)\n break;\n aClone[week[j]]--;\n }\n\n if (j - i > max)\n max = j - i;\n }\n\n Write(nWeeks * 7 + max);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "99e00d2c14e48fbd87a6d01539f90807", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "difficulty": 1400} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ca17eba50a63fb7cac140f8bd90c6109", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "Mono C#", "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)((R.Split(\" \"))[0]);\n int b = (int)((R.Split(\" \"))[1]);\n\n string M = Console.ReadLine();\n int c = (int)((R.Split(\" \"))[0]);\n int d = (int)((R.Split(\" \"))[1]);\n\n verificaGritosIguais(a, b, c, d);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "66e958e4674bfac75f4909452e7854d4", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "Mono C#", "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)char.Parse((R.Split(\" \"))[0]);\n int b = (int)char.Parse((R.Split(\" \"))[1]);\n\n string M = Console.ReadLine();\n int c = (int)char.Parse((R.Split(\" \"))[0]);\n int d = (int)char.Parse((R.Split(\" \"))[1]);\n\n verificaGritosIguais(a, b, c, d);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9ec514ae751540a6dc945ca2af713396", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Threading;\n\nnamespace c_sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int e, z=0;\n \n string[] qwe = Console.ReadLine().Split(' ');\n string[] qwe3 = Console.ReadLine().Split(' ');\n asd1 = int.Parse(qwe[0]);\n asd2 = int.Parse(qwe[1]);\n qwe1= int.Parse(qwe3[0]);\n qwe2 = int.Parse(qwe3[1]);\n \n \n\n for (int f = 1; f < 1000000; f++)\n {\n e = asd1 + asd2 * f;\n for (int ss = 1; ss < 1000000; ss++)\n {\n z = qwe1 + qwe2 * ss;\n if (e == z)\n {\n Console.Write(e);\n }\n else\n {\n Console.Write(\"-1\");\n }\n }\n \n }\n\n Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0436f799441ba94279efd88443ec909", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "23f8fc0139d46a8654e8679145b01da7", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "Mono C#", "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)((R.split(\" \"))[0]);\n int b = (int)((R.split(\" \"))[1]);\n\n string M = Console.ReadLine();\n int c = (int)((R.split(\" \"))[0]);\n int d = (int)((R.split(\" \"))[1]);\n\n verificaGritosIguais(a, b, c, d);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d945e13d31ad298fcc2e1765ebd31d09", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b0cf85715e7ce8588569c16dad569441", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Threading;\n\nnamespace c_sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int e, z=0;\n \n string[] qwe = Console.ReadLine().Split(' ');\n string[] qwe2 = Console.ReadLine().Split(' ');\n asd1 = int.Parse(qwe[0]);\n asd2 = int.Parse(qwe[1]);\n qwe1= int.Parse(qwe2[0]);\n qwe2 = int.Parse(qwe2[1]);\n \n \n\n for (int f = 1; f < 1000000; f++)\n {\n e = asd1 + asd2 * f;\n for (int ss = 1; ss < 1000000; ss++)\n {\n z = qwe1 + qwe2 * ss;\n if (e == z)\n {\n Console.Write(e);\n }\n else\n {\n Console.Write(\"-1\");\n }\n }\n \n }\n\n Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "364f5b6daec10b29d0872fb39b40607d", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Threading;\n\nnamespace c_sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int e, z=0;\n \n string[] qwe = Console.ReadLine().Split(' ');\n string[] qwe2 = Console.ReadLine().Split(' ');\n int asd1 = int.Parse(qwe[0]);\n int asd2 = int.Parse(qwe[1]);\n int qwe1= int.Parse(qwe2[0]);\n int qwe2 = int.Parse(qwe2[1]);\n \n \n\n for (int f = 1; f < 1000000; f++)\n {\n e = asd1 + asd2 * f;\n for (int ss = 1; ss < 1000000; ss++)\n {\n z = qwe1 + qwe2 * ss;\n if (e == z)\n {\n Console.Write(e);\n }\n else\n {\n Console.Write(\"-1\");\n }\n }\n \n }\n\n Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1abbda927ffe4e4e6c328c21c2d70bf2", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Threading;\n\nnamespace c_sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int e, z=0;\n \n string[] qwe = Console.ReadLine().Split(' ');\n string[] qwe2 = Console.ReadLine().Split(' ');\n asd1 = int.Parse(qwe[0]);\n asd2 = int.Parse(qwe[1]);\n qwe1= int.Parse(qwe2[0]);\n qwe2 = int.Parse(qwe2[1]);\n \n \n\n for (int f = 1; f < 1000000; f++)\n {\n e = asd1 + asd2 * f;\n for (int ss = 1; ss < 1000000; ss++)\n {\n z = qwe1 + qwe2 * ss;\n if (e == z)\n {\n Console.Write(e);\n }\n else\n {\n Console.Write(\"-1\");\n }\n }\n \n }\n\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bf7e735b0cb5fedf7020cf6ebfd04a0b", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0cfaa1a73c6aac13eeba93a33c345c8d", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Threading;\n\nnamespace c_sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int e, z=0;\n \n string[] qwe = Console.ReadLine().Split(' ');\n string[] qwe2 = Console.ReadLine().Split(' ');\n asd1 = int.Parse(qwe[0]);\n asd2 = int.Parse(qew[1]);\n qwe1= int.Parse(qew2[0]);\n qwe2 = int.Parse(qew2[1]);\n \n \n\n for (int f = 1; f < 1000000; f++)\n {\n e = asd1 + asd2 * f;\n for (int ss = 1; ss < 1000000; ss++)\n {\n z = qwe1 + qwe2 * ss;\n if (e == z)\n {\n Console.Write(e);\n }\n else\n {\n Console.Write(\"-1\");\n }\n }\n \n }\n\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "15f133bdc8ebb9afd9307721f5ccef23", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "MS C#", "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}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e8a9b4aae824b381fed177cc71f9ba0a", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "Mono C#", "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)char.Parse((R.Split((char)32)))[0]);\n int b = (int)char.Parse((R.Split((char)32))[1]);\n\n string M = Console.ReadLine();\n int c = (int)char.Parse((R.Split((char)32))[0]);\n int d = (int)char.Parse((R.Split((char)32))[1]);\n\n verificaGritosIguais(a, b, c, d);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "90cf5b88f281c27f3384fd56cc08a00a", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace ConsoleApplication4\n{\n\tclass Program\n\t{\n\t\tprivate static BigInteger n;\n\t\tstatic BigInteger m;\n\n\t\tstatic bool check(BigInteger k)\n\t\t{\n\t\t\tBigInteger val = n + (k - m) - (m + k)*(k - m + 1)/2);\n\t\t\treturn val <= 0;\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar arr =\n\t\t\t\tConsole.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToArray();\n\t\t\tn = arr[0];\n\t\t\tm = arr[1];\n\t\t\tif (n < m)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(n);\n\t\t\t}\n\n\t\t\tBigInteger val = n + m*m - (1+ m)*m/2;\n\t\t\tBigInteger l = m, r = BigInteger.Parse(\"100000000000000000000000000000000000000000000000000000000\");\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar c = (r + l)/2;\n\t\t\t\tif (check(c))\n\t\t\t\t{\n\t\t\t\t\tr = c;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tl = c;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (check(l))\n\t\t\t{\n\t\t\t\tr = l;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(r);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c91cdabdde5d09b51e46ef2e3a4e2221", "src_uid": "3b585ea852ffc41034ef6804b6aebbd8", "difficulty": 1600} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Reflection.Metadata;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n int space = input.IndexOf(' ');\n\n long barnCapacity = long.Parse(input.Substring(0, space)),\n incomingGrains = long.Parse(input.Substring(space + 1)),\n sparrows = 0,\n progressionSum = 0;\n\n if (barnCapacity - incomingGrains <= 0)\n {\n Console.WriteLine(barnCapacity);\n return;\n }\n\n barnCapacity -= incomingGrains;\n\n if (barnCapacity <= 10) goto simpleLoop;\n\n int i = 1;\n while (progressionSum <= 0 && barnCapacity > progressionSum)\n {\n i *= 10;\n sparrows = barnCapacity / i;\n progressionSum = GetArithmeticProgressionSum(sparrows);\n }\n\n var addition = sparrows / 10;\n if (addition < 2)\n {\n sparrows = 0;\n goto simpleLoop;\n }\n\n complexLoop:\n if (barnCapacity > progressionSum)\n {\n if (addition > 2)\n while (true)\n {\n if (GetArithmeticProgressionSum(sparrows + addition) > barnCapacity)\n {\n addition /= 2;\n goto complexLoop;\n }\n\n sparrows += addition;\n }\n }\n else\n {\n if (addition > 2)\n while (true)\n {\n if (GetArithmeticProgressionSum(sparrows - addition) < barnCapacity)\n {\n addition /= 2;\n goto complexLoop;\n }\n\n sparrows -= addition;\n }\n }\n\n var correctionSum = GetArithmeticProgressionSum(sparrows);\n if (correctionSum > barnCapacity)\n {\n while (GetArithmeticProgressionSum(sparrows - 1) > barnCapacity) sparrows--;\n goto finish;\n }\n\n barnCapacity -= correctionSum;\n simpleLoop:\n do { barnCapacity -= ++sparrows; } while (barnCapacity > 0);\n\n finish:\n Console.WriteLine(sparrows + incomingGrains);\n }\n\n static long GetArithmeticProgressionSum(long value)\n {\n return (long)(((double)(1 + value) / 2) * value);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0a97891fb197c01415d2d30d2974b9d0", "src_uid": "3b585ea852ffc41034ef6804b6aebbd8", "difficulty": 1600} {"lang": "MS C#", "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 long i;\n for (i = 1; count < m; i++)\n {\n count = GetCount(i);\n }\n\n if (count == m)\n {\n Print(5);\n Print(string.Join(\" \", Enumerable.Range(i, 5)));\n }\n else\n {\n Print(0);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "95db3f8ea22afaeb2ec794b1f325e21f", "src_uid": "c27ecc6e4755b21f95a6b1b657ef0744", "difficulty": 1300} {"lang": "Mono C#", "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 \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 arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n \n var sum = 0;\n var curr = 0;\n for (int i = 0; i < n; i++)\n {\n curr += arr[i];\n var t = Math.Min(8, curr);\n sum += t;\n if (sum >= k)\n {\n Console.WriteLine(i+1);\n return;\n }\n curr -= t;\n }\n Console.WriteLine(-1);\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 \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 TreeNode\n {\n public int val;\n public TreeNode left;\n public TreeNode right;\n public TreeNode(int x) { val = x; }\n }\n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "55b9dec339ae419977373970b233f40d", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "difficulty": 900} {"lang": "MS C#", "source_code": " public static void Main(string[] args)\n {\n string nk= Console.ReadLine();\n string astr = Console.ReadLine();\n int n = Convert.ToInt32(nk.Split(' ')[0]);\n int k = Convert.ToInt32(nk.Split(' ')[1]);\n int ind = 0,saved=0,given=0;\n for (int i=0; i< n;i++)\n {\n int aday= Convert.ToInt32((astr.Split(' ')[i]));\n if (aday > 8)\n {\n saved += aday - 8;\n aday = 8;\n }\n if (aday < 8 && saved > 0)\n {\n while (aday <= 8 && saved > 0)\n {\n aday++;\n saved--;\n }\n }\n given += aday;\n ind += 1;\n if (given >= k)\n { Console.WriteLine(ind); return; }\n }\n Console.WriteLine(-1);\n\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "892f14715bd4b1974c19919173ab6147", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "difficulty": 900} {"lang": "Mono C#", "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 double k;\n int l;\n Boolean a = false;\n k = Int32.Parse(Console.ReadLine());\n l = Int32.Parse(Console.ReadLine());\n int m = (int)k;\n if (k == l)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(0);\n }\n else if \n {\n for (int i = 1; i < 6911090; i++)\n {\n k = k * m;\n if (k >= l)\n {\n if (k == l)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(i);\n a = true;\n }\n break;\n }\n else if (k > l)\n break;\n }\n if (a == false)\n Console.WriteLine(\"NO\");\n }\n Console.Read();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d3eda2ff5e4b066a216bbfe312267f9", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using 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 void Main(string[] args)\n {\n Long k = long.Parse(Console.ReadLine());\n Long l = long.Parse(Console.ReadLine());\n\n\n int count = 0;\n for (long r = l; ; r /= k)\n {\n if (r < k)\n {\n Console.WriteLine(\"NO\");\n break;\n\n }\n else if (r == k)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(count);\n \n break;\n }\n count = ++count;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "19aca9cc66b0ea6ec256872c50ee13ca", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000} {"lang": "Mono C#", "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 double k;\n int l;\n Boolean a = false;\n k = Int32.Parse(Console.ReadLine());\n l = Int32.Parse(Console.ReadLine());\n int m = (int)k;\n if (k == l)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(0);\n }\n else \n {\n for (int i = 1; i < 6911090; i++)\n {\n k = k * m;\n if (k >= l)\n {\n if (k == l)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(i);\n a = true;\n }\n break;\n }\n else if (k > l)\n break;\n }\n if (a == false)\n Console.WriteLine(\"NO\");\n }\n Console.Read();\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b037a2b9d605ad5f54ab91e09a7ed23a", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nublic class Program\n {\n public static void Main(string[] args)\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n double k = double.Parse(input[0]);\n double l = Math.Log(double.Parse(input[1]), k);\n if (l == Math.Truncate(l)) { Console.WriteLine(\"YES\"); Console.WriteLine((l - 1D)); }\n else Console.WriteLine(\"NO\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7e2b7c4301686aa1c3f8ef2db82d0410", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000} {"lang": "Mono C#", "source_code": "sing 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 k;\n int l;\n Boolean a = false;\n k = Int32.Parse(Console.ReadLine());\n l = Int32.Parse(Console.ReadLine());\n int m = (int)k;\n if (k == l)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(0);\n }\n else \n {\n for (int i = 1; i < 6911090; i++)\n {\n k = k * m;\n if (k >= l)\n {\n if (k == l)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(i);\n a = true;\n }\n break;\n }\n else if (k > l)\n break;\n }\n if (a == false)\n Console.WriteLine(\"NO\");\n }\n Console.Read();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "61361a295890b52177eee6cadef8797d", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000} {"lang": "Mono C#", "source_code": "long k = long.Parse(Console.ReadLine());\n long l = long.Parse(Console.ReadLine());\n\n\n int count = 0;\n for(long r = l;;r/=k)\n {\n \n count =++count;\n \n if(r%k!=0||r number); \nif (count > 0) \n{ \nConsole.WriteLine(\"YES\"); \nConsole.WriteLine(count); \n} \nelse Console.WriteLine(\"NO\"); \n} \nelse if (power == number) \n{ \nConsole.WriteLine(\"YES\"); \nConsole.WriteLine(count); \n} \nelse Console.WriteLine(\"NO\"); \nConsole.ReadLine(); \n\n} \n} \n}.", "lang_cluster": "C#", "compilation_error": true, "code_uid": "618a21753b6166cd810321a397ab1e8f", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication6\", \"ConsoleApplication6\\ConsoleApplication6.csproj\", \"{682DD499-BA25-4331-91EE-CB2AB06BFE89}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{682DD499-BA25-4331-91EE-CB2AB06BFE89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{682DD499-BA25-4331-91EE-CB2AB06BFE89}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{682DD499-BA25-4331-91EE-CB2AB06BFE89}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{682DD499-BA25-4331-91EE-CB2AB06BFE89}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e97b82c489744229f2cd50c32ffe0f17", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "difficulty": 1200} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.IO.Pipes;\n\nnamespace 1189A\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\n\n \n \n Debug\n AnyCPU\n {FA2037DF-B604-4BF9-AB69-1AA2F65EE5B9}\n Exe\n Properties\n UnimodalArray\n UnimodalArray\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7d6e83bc526703c5bafb04cc43bdc8f1", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "difficulty": 1000} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d9b78a619bd183ec41bfcb3e3b479a86", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tpublic class A\n\t{\n\t\tstatic void Main()\n\t\t{\n\t\t\tvar n = int.Parse( Console.ReadLine() );\n\t\t\tif ( n == 1 )\n\t\t\t{\n\t\t\t\tConsole.WriteLine( 0 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar lst = new List();\n\t\t\tvar res = int.MaxValue;\n\t\t\tfor ( var i = 1; i < n; ++i )\n\t\t\t{\n\t\t\t\tlst.Add( i );\n\t\t\t\tvar x = i;\n\t\t\t\tvar cur = 0;\n\t\t\t\tvar y = n;\n\t\t\t\twhile ( x > 0 && y > 0 )\n\t\t\t\t{\n\t\t\t\t\tif ( x > y )\n\t\t\t\t\t{\n\t\t\t\t\t\tcur += x / y;\n\t\t\t\t\t\tx %= y;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcur += y / x;\n\t\t\t\t\t\ty %= x;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( x + y == 1 )\n\t\t\t\t\tres = Math.Min( res, cur );\n\t\t\t}\n\n\t\t\tvar test = lst.Where( x => x % 5 == 1 ).OrderBy( x => x % 10 ).Take( 4 );\n\n\t\t\tvar set = new HashSet();\n\t\t\tvar set2 = new SortedSet();\n\n\t\t\tforeach ( var k in Enumerable.Range( 1, 1000000 ) )\n\t\t\t{\n\t\t\t\tset.Add( k.ToString() );\n\t\t\t\tset2.Add( k.ToString() );\n\t\t\t}\n\n\t\t\tforeach ( var k in Enumerable.Range( 1, 1000000 ) )\n\t\t\t{\n\t\t\t\tset.Add( k.ToString() );\n\t\t\t\tset2.Add( k.ToString() );\n\t\t\t}\n\n\t\t\tvar view = set2.GetViewBetween( \"100\", \"10000\" );\n\n\t\t\tif ( test.Any( x => x == res ) )\n\t\t\t{\n\t\t\t\tConsole.WriteLine( res - 1 );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine( res - 1 );\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6c00b1f2b7563eea9a3b0373d23a3d1b", "src_uid": "75739f77378b21c331b46b1427226fa1", "difficulty": 1900} {"lang": "MS C#", "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 n = int.Parse(Console.ReadLine());\n var arrA = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToList();\n var arrB = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToList();\n Dictionary dict = new Dictionary();\n bool ok = false;\n int currentpos = 1;\n while(true){\n if(currentpos == arrA.Count){\n Console.WriteLine((currentpos - 1) + \" \" + 2);\n //Console.WriteLine();\n ok = true;\n break;\n }\n if(currentpos == arrB.Count){\n Console.WriteLine((currentpos - 1) + \" \" + 1);\n ok = true;\n break;\n }\n var str = getKey(arrA,currentpos,arrB);\n Console.WriteLine(str);\n if(dict.ContainsKey(str)){\n //Console.WriteLine(str);\n Console.WriteLine(-1);\n ok = true;\n break;\n }\n if(arrA[currentpos] > arrB[currentpos]){\n arrA.Add(arrB[currentpos]);\n arrA.Add(arrA[currentpos]);\n }else{\n arrB.Add(arrA[currentpos]);\n arrB.Add(arrB[currentpos]);\n }\n dict.Add(str,true);\n currentpos++;\n }\n \n }\n \n static string getKey(List arrA , int startPos , List arrB){\n string key = string.Empty;\n for(int i = startPos ; i < arrA.Count ; i++){\n key += arrA[i];\n }\n key + \"X\";\n for(int i = startPos ; i < arrB.Count ; i++){\n key += arrB[i];\n }\n return key;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "645091884d8ad5913e1b52fb4aeb9ce3", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace mono\n{\n\tpublic class Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n var array1 = Console.ReadLine().Split(' ');\n List list = new List[];\n List list1 = new List[];\n for(int i=0;i indexDistinct = new Dictionary { };\n bool diverse = false;\n for (int i = 0; i < NandK[0]; i++)\n {\n if (!indexDistinct.ContainsKey(input[i])) { indexDistinct.Add(input[i], i+1); }\n if (indexDistinct.Count == NandK[1]) { diverse = true; break; }\n }\n if (diverse)\n {\n Console.WriteLine(\"Yes\");\n int[] output = indexDistinct.Values.ToArray();\n Console.WriteLine(string.Join(' ',output));\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e6cb348206d6df5c330a2af1aaade583", "src_uid": "5de6574d57ab04ca195143e08d28d0ad", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c262c02782b1002610dc5f66f457cb30", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800} {"lang": "Mono C#", "source_code": "int n = int.Parse(Console.ReadLine());\n for (int i = n - 1; i > 1; i--)\n {\n if (n % i != 0 && n != 1)\n {\n n -= i;\n }\n }\n Console.WriteLine(n);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c3d85bd41b05362502fc5dfc9f2b17ad", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Factorial\n{\n class Program\n {\n public long Factorial(long a) { long product = 1; for (int i = 1; i <= a; i++) product *= i; return product; }\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long[] a = new long[s.Length]; for (int i = 0; i < a.Length; i++) a[i] = Convert.ToInt64(s[i]);\n Program p = new Program();\n int t = Math.Min(a, b);\n Console.WriteLine(p.Factorial(t));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "32d0f0ff8cd90eea671daa81189b2dc6", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Factorial\n{\n class Program\n {\n public long Factorial(long a) { long product = 1; for (int i = 1; i <= a; i++) product *= i; return product; }\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long[] a = new long[s.Length]; for (int i = 0; i < a.Length; i++) a[i] = Convert.ToInt64(s[i]);\n Program p = new Program();\n long t = Math.Min(a, b);\n Console.WriteLine(p.Factorial(t));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4d37b997ea7bc2087a365a5e27438577", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.Valued_Keys\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n string y = Console.ReadLine();\n bool check = false;\n for (int i = 0; i < x.Length; i++)\n {\n if (x[i] < y[i])\n {\n check = true;\n break;\n }\n }\n if (check == true)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(y);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a1e31aedd4fe7bfdf1c78208e87f9647", "src_uid": "ce0cb995e18501f73e34c76713aec182", "difficulty": 900} {"lang": "Mono C#", "source_code": "internal class Program\n {\n static void Main(string[] args)\n {\n var i = Convert.ToInt64(Console.ReadLine());\n if (i == 3)\n i = 24;\n else\n {\n long q = 0;\n for (var k = 0; k < i - 1; ++k)\n {\n if (k == 0 || k == i - 2)\n {\n q += (long)Math.Pow(4,i - 3) * 3;\n }\n else\n {\n q += (long)Math.Pow(4, (i - 4)) * 9;\n }\n }\n\n i = q * 4;\n }\n Console.WriteLine(i);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f5958078ba4cba41310cdd5ce5d93721", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nclass Solution {\n static void Main(String[] args) {\n var N = Convert.ToInt32(Console.ReadLine());\n var weights = Console.ReadLine().Split().Select(s => Convert.ToInt32(s)).ToList();\n var total= weights.Sum();\n var hund= weights.Count(weights=>{return weights==100;});\n var twohund= weights.Count(weights=>{return weights==200;});\n if(hund==0){\n if(twohund%2==0 && twohund!=0){\n Console.WriteLine(\"YES\");\n\n }else{\n Console.WriteLine(\"N0\");\n\n }\n }else if(twohund==0){\n if(hund%2==0 && hund!=0){\n Console.WriteLine(\"YES\");\n\n }else{\n Console.WriteLine(\"N0\");\n\n }\n }else{\n if(total%2!=0){\n Console.WriteLine(\"N0\");\n \n }else{\n if(twohund%2==0 && hund%2==0){\n Console.WriteLine(\"YES\");\n\n }\n if( hund%2==1){\n Console.WriteLine(\"NO\");\n\n }\n }\n\n \n }\n }\n}\n \n \n// }\n// class Solution {\n// static void Main(String[] args) {\n// var N = Convert.ToInt32(Console.ReadLine());\n// var Ns = Console.ReadLine().Split().Select(s => Convert.ToInt32(s)).ToList();\n// var total= Ns.Sum();\n// var minSum=int.MaxValue;\n// var leftsum=Ns[0];\n// var rightSum=total-leftsum;\n// for(int i=1;i();\n// for(int i=0;i{\n// //one letter change\n// if(Math.Abs(specialW.Length-word.Length)>1){\n// return false;\n// }\n// if(specialW.Length==word.Length){\n// int wrong=0;\n// for(int i=0;i1){return false;}\n// }\n// return true;\n// }else\n// //missing letter\n// if(specialW.Length>word.Length){\n// for(int i=0;iword.Length-1){\n// word+=specialW[i];\n// if(specialW==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// if(specialW[i]!=word[i]){\n// //this should be the index of the missing letter\n// //replace the word with a value that includes the missing letter\n// word=word.Insert(i,Char.ToString(specialW[i]));\n// if(specialW==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// }\n// return true;\n\n// }else{\n// for(int i=0;ispecialW.Length-1){\n// string specialWcopy=new String(specialW.Select((letter)=>letter).ToArray());\n\n// specialWcopy+=word[i];\n// if(specialWcopy==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// if(specialW[i]!=word[i]){\n// //this should be the index of the missing letter\n// //replace the word with a value that includes the missing letter\n// string specialWcopy=new String(specialW.Select((letter)=>letter).ToArray());\n// specialWcopy=specialWcopy.Insert(i,word[i].ToString());\n// if(specialWcopy==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// }\n// return true;\n// }\n \n \n// }));\n\n// }\n//}\n// /matrix roations\n// make all roations and overlao them\n// or\n// each point is also influcend by 4 other points\n// drax some pictures to figure oit out\n\n// use Except toget diffrence between strings\n// if it is only only one than it is code\n// class Solution\n// {\n// static void Main(String[] args)\n// {\n// int N = Convert.ToInt32(Console.ReadLine().Trim());\n// List specialW = Console.ReadLine().Trim().Select(word=>(char?)word).ToList();\n\n// var words=new List();\n// for(int i=0;i{\n// //one letter change\n// if(specialW.Count==word.Length){\n// int wrong=0;\n// for(int i=0;i1){return false;}\n// }\n// return true;\n// }else\n// //missing letter\n// if(specialW.Count>word.Length){\n// List nullableWord=word.Select(word=>(char?)word).ToList();\n// for(int i=0;inullableWord.Count-1){\n// nullableWord.Append(null);\n// }\n// if(specialW[i]!=word?[i]){\n// //this should be the index of the missing letter\n// //replace the word with a value that includes the missing letter\n// word=word.Insert(i,Char.ToString((char)specialW[i]));\n// if(specialW==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// }\n// return true;\n\n// }else{\n// for(int i=0;iletter).ToArray());\n// specialWcopy=specialWcopy.Insert(i,word[i].ToString());\n// if(specialWcopy==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// }\n// return true;\n// }\n \n \n// }));\n\n// }\n//}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4e743d75569ac2a11a3e43cee6fd91d4", "src_uid": "9679acef82356004e47b1118f8fc836a", "difficulty": 1100} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nclass Solution {\n static void Main(String[] args) {\n var N = Convert.ToInt32(Console.ReadLine());\n var weights = Console.ReadLine().Split().Select(s => Convert.ToInt32(s)).ToList();\n var total= weights.Sum();\n var hund= weights.Count(weights=>{return weights==100;});\n var twohund= weights.Count(weights=>{return weights==200;});\n weights.Sort();\n for(int i=0;i Convert.ToInt32(s)).ToList();\n// var total= Ns.Sum();\n// var minSum=int.MaxValue;\n// var leftsum=Ns[0];\n// var rightSum=total-leftsum;\n// for(int i=1;i();\n// for(int i=0;i{\n// //one letter change\n// if(Math.Abs(specialW.Length-word.Length)>1){\n// return false;\n// }\n// if(specialW.Length==word.Length){\n// int wrong=0;\n// for(int i=0;i1){return false;}\n// }\n// return true;\n// }else\n// //missing letter\n// if(specialW.Length>word.Length){\n// for(int i=0;iword.Length-1){\n// word+=specialW[i];\n// if(specialW==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// if(specialW[i]!=word[i]){\n// //this should be the index of the missing letter\n// //replace the word with a value that includes the missing letter\n// word=word.Insert(i,Char.ToString(specialW[i]));\n// if(specialW==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// }\n// return true;\n\n// }else{\n// for(int i=0;ispecialW.Length-1){\n// string specialWcopy=new String(specialW.Select((letter)=>letter).ToArray());\n\n// specialWcopy+=word[i];\n// if(specialWcopy==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// if(specialW[i]!=word[i]){\n// //this should be the index of the missing letter\n// //replace the word with a value that includes the missing letter\n// string specialWcopy=new String(specialW.Select((letter)=>letter).ToArray());\n// specialWcopy=specialWcopy.Insert(i,word[i].ToString());\n// if(specialWcopy==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// }\n// return true;\n// }\n \n \n// }));\n\n// }\n//}\n// /matrix roations\n// make all roations and overlao them\n// or\n// each point is also influcend by 4 other points\n// drax some pictures to figure oit out\n\n// use Except toget diffrence between strings\n// if it is only only one than it is code\n// class Solution\n// {\n// static void Main(String[] args)\n// {\n// int N = Convert.ToInt32(Console.ReadLine().Trim());\n// List specialW = Console.ReadLine().Trim().Select(word=>(char?)word).ToList();\n\n// var words=new List();\n// for(int i=0;i{\n// //one letter change\n// if(specialW.Count==word.Length){\n// int wrong=0;\n// for(int i=0;i1){return false;}\n// }\n// return true;\n// }else\n// //missing letter\n// if(specialW.Count>word.Length){\n// List nullableWord=word.Select(word=>(char?)word).ToList();\n// for(int i=0;inullableWord.Count-1){\n// nullableWord.Append(null);\n// }\n// if(specialW[i]!=word?[i]){\n// //this should be the index of the missing letter\n// //replace the word with a value that includes the missing letter\n// word=word.Insert(i,Char.ToString((char)specialW[i]));\n// if(specialW==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// }\n// return true;\n\n// }else{\n// for(int i=0;iletter).ToArray());\n// specialWcopy=specialWcopy.Insert(i,word[i].ToString());\n// if(specialWcopy==word){\n// return true;\n// }else{\n// return false;\n// }\n// }\n// }\n// return true;\n// }\n \n \n// }));\n\n// }\n//}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a03b65c7804fd573b57a8ade1ede5aad", "src_uid": "9679acef82356004e47b1118f8fc836a", "difficulty": 1100} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace trafficelights\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n string wkstr = Console.ReadLine();\n string[] a = wkstr.Split(' ');\n\t\t\tdouble l = Int32.Parse(a[0]);\n\t\t\tdouble d = Int32.Parse(a[1]);\n\t\t\tdouble v = Int32.Parse(a[2]);\n\t\t\tdouble g = Int32.Parse(a[3]);\n\t\t\tdouble r = Int32.Parse(a[4]);\n\t\t\tdouble ret = l/v;\n\t\t\tdouble t1 = d/v;\n\t\t\tint wk = Math.Floor(t1 / (g+r));\n\t\t\tdouble amari = t1 - wk*(g+r);\n//\t\t\tdouble amari = (d/v) % (g+r);\n\t\t\tif (amari >= g) {\n\t\t\t\tret += (g+r-amari);\n\t\t\t}\n\t\t\tConsole.WriteLine (ret.ToString(\"F8\"));\n\t\t}\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "62bfacd188a4ef39b4d7f85745bf6094", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "difficulty": 1500} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\npublic class DieRoll\n{\n public DieRoll()\n {\n int A = 0;\n int B = 0;\n string[] str = Console.ReadLine().Split(' ');\n\n A = Convert.ToInt32(str[0]);\n B = Convert.ToInt32(str[1]);\n\n A = A > B ? A : B;\n A = 7 - A;\n B = GetGCD(6, A);\n Console.Write((A / B) + \"/\" + (6 / B));\n }\n\n //A>B\n public int GetGCD(int A, int B)\n {\n int gcd = 0;\n if (A % B == 0)\n {\n gcd = B;\n }\n else\n {\n gcd = GetGCD(B, A % B);\n }\n return gcd;\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f5c1ff3b6832bdbeeb29525d079da2cc", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800} {"lang": "MS C#", "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 Y;\n int W;\n int Max;\n var line = Console.ReadLine();\n Y = Convert.ToInt32(line.Split(' ')[0]);\n W = Convert.ToInt32(line.Split(' ')[2]);\n Max = Y;\n if (W > Max)\n {\n Max = W;\n }\n Max = 6 - Max + 1;\n if (Max == 1 || Max == 5)\n {\n \n Console.WriteLine($\"{Max}/6\\n\");\n }\n else if (Max == 2 || Max == 4)\n {\n Console.WriteLine($\"{Max/2}/3\\n\");\n }\n else if (Max == 3)\n {\n \n Console.WriteLine(\"1/2\\n\");\n }\n else\n {\n Console.Write(\"1/1\\n\");\n }\n return;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cb9d713dec5a73f9e439b4d88edd8911", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\n class Program\n{\n static void Main(string[]args)\n {\n int[] YWResult = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n int dotChances = (6 - YWResult.Max()) + 1;\n \n\n if(dotChances == 6)\n Console.WriteLine(\"6/6\");\n else\n {\n if(dotChances % 2 ==0)\n {\n Console.WriteLine(dotChances / 2+\"/\"+3);\n }\n else if(dotChances % 5==0)\n {\n Console.WriteLine(dotChances+\"/\"+6);\n }\n else\n {\n Console.WriteLine(dotChances / 3+\"/\"+2);\n }\n }\n }\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bb2854e740acf50660b0841220c2fbc2", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800} {"lang": "Mono C#", "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;\nusing System.Numerics;\n\nclass Solution\n{\n static void Main(string[] args)\n {\n \n string[] roll = {\"1/6\",\"1/3\",\"1/2\",\"2/3\",\"5/6\",\"1/1\"};\n var input = Console.ReadLine().Split(\" \");\n int max = Math.Max(Convert.ToByte(input[0]), Convert.ToByte(input[1]));\n Console.WriteLine(roll[6 - max]);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ec432f94f24055febbea5bfaaa423f52", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800} {"lang": "MS C#", "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 //Questions.Question1_CharacterOccurences();\n //Questions.Question2_LinearGenerator();\n //Questions.Question3_CheckingCable();\n Questions.Question1_AmrAndMusic();\n }\n public static void Question1_AmrAndMusic()\n {\n // 1. Init\n int n, k;\n string[] firstline = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(firstline[0]);// number of instruments\n k = Convert.ToInt32(firstline[1]);// number of days \n // The second line contains n integers a.i (1\u2009\u2264\u2009ai\u2009\u2264\u2009100), representing number of days required to learn the i-th instrument.\n int[] instrument_learning_days = new int[n];\n string[] secondline = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n instrument_learning_days[i] = Convert.ToInt32(secondline[i]);\n }\n\n // 2. Processing\n int[] IndexArray = new int[n];\n for(int i=0; i k)\n {\n break;\n }\n HaveResult = true;\n tempIndex++;\n }\n\n if (!HaveResult)\n Console.WriteLine(0);\n else\n {\n Console.WriteLine(tempIndex);\n Console.Write(IndexArray[0]+1);\n for (int i = 1; i < tempIndex; i++)\n {\n Console.Write(string.Format(\" {0}\", IndexArray[i]+1));\n }\n Console.WriteLine();\n }\n int ad= 1;\n }\n\n public static void MergeSort(ref int[] InputString, ref int[] IndexArray, int HeadIndex, int TailIndex)\n {\n if (HeadIndex == TailIndex)\n return;\n int MiddleIndex = (HeadIndex + TailIndex) / 2;\n MergeSort(ref InputString, ref IndexArray, HeadIndex, MiddleIndex);\n MergeSort(ref InputString, ref IndexArray, MiddleIndex + 1, TailIndex);\n Merge(ref InputString, ref IndexArray, HeadIndex, MiddleIndex, TailIndex);\n\n }\n\n private static void Merge(ref int[] InputString, ref int[] IndexArray, int Head, int Middle, int Tail)\n {\n int currentIndex = Head;\n int LeftIndex = Head;\n int RightIndex = Middle + 1;\n int[] TempArray = new int[InputString.Length];\n Array.Copy(InputString, 0, TempArray, 0, InputString.Length);\n\n int[] TempIndexArray = new int[IndexArray.Length];\n Array.Copy(IndexArray, 0, TempIndexArray, 0, TempIndexArray.Length);\n while (LeftIndex <= Middle && RightIndex <= Tail)\n {\n if (TempArray[LeftIndex] < TempArray[RightIndex])\n {\n IndexArray[currentIndex] = TempIndexArray[LeftIndex];\n InputString[currentIndex++] = TempArray[LeftIndex++];\n }\n else\n {\n IndexArray[currentIndex] = TempIndexArray[RightIndex];\n InputString[currentIndex++] = TempArray[RightIndex++];\n }\n }\n\n while (LeftIndex <= Middle)\n {\n IndexArray[currentIndex] = TempIndexArray[LeftIndex];\n InputString[currentIndex++] = TempArray[LeftIndex++];\n }\n while (RightIndex <= Tail)\n {\n IndexArray[currentIndex] = TempIndexArray[RightIndex];\n InputString[currentIndex++] = TempArray[RightIndex++];\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9d8cd38049cd01c4c53f06e54cd046da", "src_uid": "dbb164a8dd190e63cceba95a31690a7c", "difficulty": 1000} {"lang": "MS C#", "source_code": " public static int CountSums(List list, long maxb, long minb)\n {\n int count = 0;\n var suit1 = new HashSet();\n for (var i = 0; i < list.Count; i++)\n {\n var t = list[i];\n var res = BinarySearch(list, x =>\n {\n var dop = x + t;\n if (dop > maxb)\n return dop - maxb;\n if (dop < minb)\n return dop - minb;\n return 0;\n }, i);\n if (res == -1) continue;\n if (res == i && (list[res + 1] != list[res] || list[res - 1] != list[res]))\n continue;\n suit1.Add(list[i]);\n }\n var suit = suit1.ToList();\n suit.Sort();\n var hash = new HashSet();\n var added = new HashSet();\n for (var i = minb; i <= maxb; ++i)\n hash.Add(i);\n var max = maxb;\n var min = minb;\n for (int j = 0; j < suit.Count; j++)\n {\n var t = suit[j];\n int res = 1;\n while (res != -1)\n {\n res = BinarySearch(suit, x =>\n {\n\n var dop = x + t;\n if (dop < min)\n return dop - min;\n if (dop > max)\n return dop - max;\n return 0;\n }, j);\n if (res != -1 && !hash.Contains(t + suit[res]))\n {\n res = BinarySearch(suit, x =>\n {\n var dop = x + t;\n if (hash.Contains(dop))\n return 0;\n if (dop > max)\n return dop - max;\n return dop - min;\n\n }, j);\n if (res == -1 || !hash.Contains(t + suit[res]))\n res = BinarySearch(suit, x =>\n {\n var dop = x + t;\n if (hash.Contains(dop))\n return 0;\n if (dop < min)\n return dop - min;\n return dop - max;\n }, j);\n }\n if (res != -1 && res != j)\n {\n //if (suit[res] + t == max)\n // max--;\n //if (suit[res] + t == min)\n // min++;\n hash.Remove(t + suit[res]);\n added.Add(t + suit[res]);\n count++;\n }\n }\n }\n return count;\n }\n public static int func(int p, int n, int k = 0)\n {\n return (p * n - 1 + k) / (p - 1);\n }\n\n private static List marked;\n private static List f;\n private static int t = 0;\n\n public static List countSCP(Graph g)\n {\n g.Reverse();\n DFSLoop(g);\n g.Reverse();\n for (int i = 0; i < g.v.Length; ++i)\n g.v[f[i]] = i;\n return DFSLoop(g);\n }\n public static List DFSLoop(Graph g)\n {\n t = 0;\n var leaders = new List();\n marked = Enumerable.Repeat(false, g.v.Length).ToList();\n f = Enumerable.Repeat(0, g.v.Length).ToList();\n for (int i = g.v.Length - 1; i > -1; --i)\n if (!marked[g.v[i]])\n {\n int w = t;\n DFS(g, g.v[i]);\n leaders.Add(new Pair { f = i, s = t - w });\n }\n return leaders;\n }\n public static void DFS(Graph g, int node)\n {\n marked[node] = true;\n var cross = g.mapped[node];\n if (cross == null) return;\n foreach (var i in cross.Where(i => !marked[i]))\n {\n DFS(g, i);\n }\n ++t;\n f[g.v[node]] = t - 1;\n }\n\n public static int[] Dijkstra(Graphv2 g)\n {\n var a = new Dictionary();\n var x = new List();\n int p = 0;\n var l = g.l;\n var v = g.v;\n var e = g.e;\n x.Add(0);\n a[0] = 0;\n while (x.Count != g.v.Length)\n {\n int min = -1;\n var mini = -1;\n bool first = true;\n foreach (var i in x)\n {\n foreach (var k in g.mapped[i])\n {\n if (x.IndexOf(k) != -1)\n continue;\n int r = a[i] + l[i, k];\n if (first)\n {\n first = false;\n min = r;\n mini = k;\n }\n else if (r < min)\n {\n min = r;\n mini = k;\n }\n }\n\n }\n x.Add(mini);\n a[mini] = min;\n\n }\n var res = new int[v.Length];\n foreach (var i in a)\n {\n res[i.Key] = i.Value;\n }\n return res;\n }\n\n\n public static int BinarySearch(IList list, Func func, int except = -1)\n {\n int l = 0, r = list.Count - 1, i = (l + r) / 2;\n bool pass = except == -1;\n while (l < r)\n {\n if (r - l < 100)\n {\n int k = 5;\n }\n var test = func(list[i]);\n if (test == 0)\n {\n if (pass || except != i)\n return i;\n if (i != 0 && func(list[i - 1]) == 0)\n return i - 1;\n if (i != list.Count - 1 && func(list[i + 1]) == 0)\n return i + 1;\n\n }\n if (test < 0)\n l += (r - l + 1) / 2;\n else\n r -= (r - l + 1) / 2;\n i = (l + r + 1) / 2;\n }\n return -1;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "901e2d49003c8ba27ae8dc2567d99ad8", "src_uid": "dbb164a8dd190e63cceba95a31690a7c", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n int n = arr[0];\n int k = arr[1];\n var inp =\n Console.ReadLine()\n .Split(' ')\n .Select(Int32.Parse)\n .Select((x, ind) => new Tuple(x, ind+1))\n .ToArray();\n inp = inp.OrderBy(x => x.Item1).ToArray();\n int s = 0;\n int i = 0;\n while (iConsole.Write(\"{0} \",x.Item2));\n }\n public static int CountSums(List list, long maxb, long minb)\n {\n int count = 0;\n var suit1 = new HashSet();\n for (var i = 0; i < list.Count; i++)\n {\n var t = list[i];\n var res = BinarySearch(list, x =>\n {\n var dop = x + t;\n if (dop > maxb)\n return dop - maxb;\n if (dop < minb)\n return dop - minb;\n return 0;\n }, i);\n if (res == -1) continue;\n if (res == i && (list[res + 1] != list[res] || list[res - 1] != list[res]))\n continue;\n suit1.Add(list[i]);\n }\n var suit = suit1.ToList();\n suit.Sort();\n var hash = new HashSet();\n var added = new HashSet();\n for (var i = minb; i <= maxb; ++i)\n hash.Add(i);\n var max = maxb;\n var min = minb;\n for (int j = 0; j < suit.Count; j++)\n {\n var t = suit[j];\n int res = 1;\n while (res != -1)\n {\n res = BinarySearch(suit, x =>\n {\n\n var dop = x + t;\n if (dop < min)\n return dop - min;\n if (dop > max)\n return dop - max;\n return 0;\n }, j);\n if (res != -1 && !hash.Contains(t + suit[res]))\n {\n res = BinarySearch(suit, x =>\n {\n var dop = x + t;\n if (hash.Contains(dop))\n return 0;\n if (dop > max)\n return dop - max;\n return dop - min;\n\n }, j);\n if (res == -1 || !hash.Contains(t + suit[res]))\n res = BinarySearch(suit, x =>\n {\n var dop = x + t;\n if (hash.Contains(dop))\n return 0;\n if (dop < min)\n return dop - min;\n return dop - max;\n }, j);\n }\n if (res != -1 && res != j)\n {\n //if (suit[res] + t == max)\n // max--;\n //if (suit[res] + t == min)\n // min++;\n hash.Remove(t + suit[res]);\n added.Add(t + suit[res]);\n count++;\n }\n }\n }\n return count;\n }\n public static int func(int p, int n, int k = 0)\n {\n return (p * n - 1 + k) / (p - 1);\n }\n\n private static List marked;\n private static List f;\n private static int t = 0;\n\n public static List countSCP(Graph g)\n {\n g.Reverse();\n DFSLoop(g);\n g.Reverse();\n for (int i = 0; i < g.v.Length; ++i)\n g.v[f[i]] = i;\n return DFSLoop(g);\n }\n public static List DFSLoop(Graph g)\n {\n t = 0;\n var leaders = new List();\n marked = Enumerable.Repeat(false, g.v.Length).ToList();\n f = Enumerable.Repeat(0, g.v.Length).ToList();\n for (int i = g.v.Length - 1; i > -1; --i)\n if (!marked[g.v[i]])\n {\n int w = t;\n DFS(g, g.v[i]);\n leaders.Add(new Pair { f = i, s = t - w });\n }\n return leaders;\n }\n public static void DFS(Graph g, int node)\n {\n marked[node] = true;\n var cross = g.mapped[node];\n if (cross == null) return;\n foreach (var i in cross.Where(i => !marked[i]))\n {\n DFS(g, i);\n }\n ++t;\n f[g.v[node]] = t - 1;\n }\n\n public static int[] Dijkstra(Graphv2 g)\n {\n var a = new Dictionary();\n var x = new List();\n int p = 0;\n var l = g.l;\n var v = g.v;\n var e = g.e;\n x.Add(0);\n a[0] = 0;\n while (x.Count != g.v.Length)\n {\n int min = -1;\n var mini = -1;\n bool first = true;\n foreach (var i in x)\n {\n foreach (var k in g.mapped[i])\n {\n if (x.IndexOf(k) != -1)\n continue;\n int r = a[i] + l[i, k];\n if (first)\n {\n first = false;\n min = r;\n mini = k;\n }\n else if (r < min)\n {\n min = r;\n mini = k;\n }\n }\n\n }\n x.Add(mini);\n a[mini] = min;\n\n }\n var res = new int[v.Length];\n foreach (var i in a)\n {\n res[i.Key] = i.Value;\n }\n return res;\n }\n\n\n public static int BinarySearch(IList list, Func func, int except = -1)\n {\n int l = 0, r = list.Count - 1, i = (l + r) / 2;\n bool pass = except == -1;\n while (l < r)\n {\n if (r - l < 100)\n {\n int k = 5;\n }\n var test = func(list[i]);\n if (test == 0)\n {\n if (pass || except != i)\n return i;\n if (i != 0 && func(list[i - 1]) == 0)\n return i - 1;\n if (i != list.Count - 1 && func(list[i + 1]) == 0)\n return i + 1;\n\n }\n if (test < 0)\n l += (r - l + 1) / 2;\n else\n r -= (r - l + 1) / 2;\n i = (l + r + 1) / 2;\n }\n return -1;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "256af9cfee5416d83ff538cbd132a268", "src_uid": "dbb164a8dd190e63cceba95a31690a7c", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\n\nnamespace _507A\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 k = s[1];\n var source = Console.ReadLine().Split().Select(int.Parse).ToArray();\n List indices = new List();\n var sorted = source.Select((x, i) => new { Days = x, Index = i}).OrderBy(x=>x.Days).ToList();\n for (int i=0;i= sorted[i].Days) k -= sorted[i].Days;\n else break;\n indices.Add(sorted[i].Index);\n }\n Console.WriteLine(indices.Count);\n foreach (var i in indices) Console.Write(i + \" \");\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "378fae18d1c4bcfe44fbf66eddf0c7fc", "src_uid": "dbb164a8dd190e63cceba95a31690a7c", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\n\nnamespace _378A\n{\n class Program\n {\n static void Main(string[] args)\n {\n solve_378A();\n }\n\n public static void solve_378A()\n {\n string test = Console.ReadLine();\n string vowels = \"AEIOUX\";\n int count = 0;\n int max = 0;\n char prev = test[0];\n for (int i = 0; i < test.Length; i++)\n {\n if (vowels.Contains(test[i]) || i == test.Length - 1)\n {\n max = Math.Max(max, (i == test.Length - 1) ? count + 2 : count + 1);\n count = 0;\n }\n else\n {\n count++;\n }\n }\n\n Console.WriteLine(max);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "85e92ed1e1629afc427dcb7dc8ce45b9", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\npublic class Program\n{\n public static HashSet vowels = new HashSet(new string[] { 'A', 'E', 'I', 'O', 'U', 'Y' });\n\n public static void Main(string[] args)\n {\n var input = Console.ReadLine().ToUpper();\n\n var max = int.MinValue;\n var position = 0;\n\n while (position != input.Length)\n {\n var tuple = NextVowel(input, position);\n if (tuple == null)\n {\n break;\n }\n position = tuple.Item1;\n max = Math.Max(tuple.Item2, max);\n }\n\n Console.WriteLine(max);\n }\n\n public static Tuple NextVowel(string text, int position)\n {\n for (var i = position; i < input.Length; i++)\n {\n if (vowels.Contains(text[i]))\n {\n return new Tuple(i, (i + 1) - position);\n }\n }\n\n return new Tuple();\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e352d8365f9a1df5fbb61c2e1774c80d", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\npublic class Program\n{\n public static HashSet vowels = new HashSet(new string[] { 'A', 'E', 'I', 'O', 'U', 'Y' });\n\n public static void Main(string[] args)\n {\n var input = Console.ReadLine().ToUpper();\n\n var max = int.MinValue;\n var position = 0;\n\n while (position != input.Length)\n {\n var tuple = NextVowel(input, position);\n if (tuple.Item1 == -1)\n {\n break;\n }\n position = tuple.Item1;\n max = Math.Max(tuple.Item2, max);\n }\n\n Console.WriteLine(max);\n }\n\n public static Tuple NextVowel(string input, int position)\n {\n for (var i = position; i < input.Length; i++)\n {\n if (vowels.Contains(text[i]))\n {\n return new Tuple(i, (i + 1) - position);\n }\n }\n\n return new Tuple(-1, -1);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5c66ebc20e6fb329f7df41a055631e3b", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Grasshopper_And_the_String\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int sum = 0;\n List li = new List();\n for(int i=0;i vowels = new HashSet(new string[] { 'A', 'E', 'I', 'O', 'U', 'Y' });\n\n public static void Main(string[] args)\n {\n var input = Console.ReadLine().ToUpper();\n\n var max = int.MinValue;\n var position = 0;\n\n while (position != input.Length)\n {\n var tuple = NextVowel(input, position);\n if (tuple.Item1 == -1)\n {\n break;\n }\n position = tuple.Item1;\n max = Math.Max(tuple.Item2, max);\n }\n\n Console.WriteLine(max);\n }\n\n public static Tuple NextVowel(string input, int position)\n {\n for (var i = position; i < input.Length; i++)\n {\n if (vowels.Contains(input[i]))\n {\n return new Tuple(i, (i + 1) - position);\n }\n }\n\n return new Tuple(-1, -1);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fc05fc523929d3c1124bb470f0998aca", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n static int Main()\n {\n int a, b, c;\n string []s = Console.ReadLine().Parse(' ');\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 }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "148a23a5b10f76e63175086959a5d435", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Preparation\n{\n public class CodeForcesCompetition3B\n {\n public static void Main1(string[] args)\n {\n var str = Console.ReadLine();\n char[] output = new char[str.Length];\n int[] arr = new int[27];\n for (int i = 0; i < 27; ++i) arr[i] = -1;\n\n var list = new List();\n\n for (int i = 0; i < str.Length; ++i)\n {\n if (str[i] == '?')\n {\n list.Add(i);\n }\n else\n {\n output[i] = str[i];\n arr[str[i] - 'A'] = i;\n }\n\n if (Check(arr, i, list))\n {\n int moa = 0;\n for (int j = i; i-j < 26; j--)\n {\n if (str[j] != '?') continue;\n for (; moa < 26; ++moa)\n {\n if (i - arr[moa] >= 26)\n {\n output[j] = (char)(moa + 'A');\n moa++;\n break;\n }\n }\n }\n\n for (int ii = 0; ii < output.Length; ++ii)\n {\n if (output[ii] == 0)\n output[ii] = 'A';\n }\n\n Console.WriteLine(new string(output));\n\n return;\n }\n }\n\n Console.WriteLine(-1);\n }\n\n public static bool Check(int[] arr, int cur, List list)\n {\n int rc = 0;\n for (int i = list.Count - 1; i >= 0; i--)\n {\n if (cur - list[i] >= 26)\n break;\n rc++;\n }\n\n int rc1 = 0;\n for (int i = 0; i < 26; ++i)\n {\n if (arr[i] == -1 || cur - arr[i] >= 26)\n rc1++;\n }\n\n if (rc1 > rc)\n return false;\n return true;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7ed0a7d6e4324f659e76830a4dce73b0", "src_uid": "a249431a4b0b1ade652997fe0b82edf3", "difficulty": 1300} {"lang": "MS C#", "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\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "088665c510846a3cdadc886f8b531fce", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100} {"lang": "Mono C#", "source_code": " string getBusFigure(int passengers)\n {\n string outDat = @\"+------------------------+\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 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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ef71ea3a77df0c38a4313d997a4f7450", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100} {"lang": "MS C#", "source_code": "\nusing 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 long n = RLong();\n\n long [] store = new long[n];\n for (long i = 1; i <= n; i++)\n {\n var x = n % i;\n if (x == 0)\n {\n store[store.Length-1] = (n / i);\n }\n }\n\n for (long i = 0; i < store[]; i++)\n {\n bool flag = false;\n for (long j = 2; j < store[i]; j++)\n {\n if (store[i] % (j * j) == 0)\n {\n\n flag = true;\n break;\n }\n }\n if (flag == false)\n {\n WLine(store[i]);\n return;\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 long RLong()\n {\n var str = Console.ReadLine();\n return Convert.ToInt64(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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8e0b4096055b6061744873ec5597c29a", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Coins\n{\n private static void Main()\n {\n\n const int max = 1000;\n int n = Convert.ToInt32(Console.ReadLine());\n int[] primes = new int[max + 1];\n primes[1] = 2;\n primes[2] = 3;\n int curr_prime = 3;\n int sqrt = 1;\n for (int i = 4; (curr_prime <= max && i < Int32.MaxValue); i++)\n {\n if ((sqrt + 1) * (sqrt + 1) == i)\n sqrt++;\n\n bool f = true;\n for (int j = 1; primes[j] <= sqrt; j++)\n {\n if (i % primes[j] == 0)\n {\n f = false;\n break;\n }\n }\n\n if (f)\n {\n primes[curr_prime] = i;\n curr_prime++;\n }\n }\n\n bool f = true;\n while (n > 1 && f)\n {\n sqrt = (int)Math.Sqrt(n);\n f = false;\n for (int i = 1; primes[i] <= n; i++)\n {\n if (n % primes[i] == 0)\n {\n Console.WriteLine(primes[i].ToString());\n n /= primes[i];\n f = true;\n break;\n }\n }\n }\n Console.WriteLine(primes[0].ToString()); \n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "998088299026f78e81f2ec5aaa60b47b", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300} {"lang": "MS C#", "source_code": "\n\nvoid Main()\n{\n\tint n =int.Parse(Console.ReadLine());\n\n\tstring[] game = Console.ReadLine().Split();\n\tint[] ans = new int [n];\n\t\n\tfor (int k=0;k0) ans[k] = ans[k-1];\n\t\tif (game[k]==\"0\") ans[k]++;\n\t}\n\tint max = 0;\n\tint t = 0;\n\t\n\tfor (int i =0;i0) t+= ans[i-1];\n\t\tif (max 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\t\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(\"19 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e513cd31d2ec447adff11af65f47a8d8", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\n\nclass program\n{\n 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "403ba9606c34f0b77ef9cfd460819e79", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\n\n\nclass Programm\n{\n static void Main(string[] args){\n string arg = Console.ReadLine();\n string[] ns = arg.Split(' ');\n if(ns[0].Empty(ns[1]))Console.WriteLine(ns[0]);\n else Console.Write(\"2\");\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9d09b62d56e98f78be236051c2efc1ae", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\n\nclass program\n{\n 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a2b6028cd4333ff9bd2e6269dae4968a", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000} {"lang": "Mono C#", "source_code": "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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9f2107f87e4c3f8bf6ede05b4bed4422", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800} {"lang": "Mono C#", "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 string s= Console.ReadLine();\n string str = Console.ReadLine();\n string sub_str = \"xxx\";\n int count = 0;\n while(str.IndexOf(sub_str) is int i)\n {\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0b5a671a0759907943a66769aaf86e3a", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800} {"lang": "Mono C#", "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 ColichestvoX(fileName);\n }\n public void ColichestvoX(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 }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3eeca4fe25a4b83bb82d8032010cd6af", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800} {"lang": "Mono C#", "source_code": " 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 ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fa86f178b5b0a8e2e31d62839362081d", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800} {"lang": "Mono C#", "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 int len = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n string sub_str = \"xxx\";\n int count = 0;\n while(str.IndexOf(sub_str) is int i)\n {\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b576c3eceb75aef17b4d9fc40ee0632d", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _LuckySum\n{\n class ProgramLuckySum\n {\n static bool IsLucky(ulong n)\n {\n if (n == 0) return false;\n\n var num = n;\n while (num > 0)\n {\n var digit = num - (num / 10) * 10;\n if (digit != 4 && digit != 7) return false;\n num /= 10;\n }\n\n return true;\n }\n\n\n static void Main(string[] args)\n {\n var luckyNumbers = new List();\n for (var n = 1UL; n <= 1000UL; n++)\n {\n if (IsLucky(n)) luckyNumbers.Add(n);\n }\n\n var input = Console.ReadLine();\n if (string.IsNullOrWhiteSpace(input)) return;\n var lr = input.Split(' ');\n var l = ulong.Parse(lr[0]);\n var r = ulong.Parse(lr[1]);\n\n var i = 0;\n while (luckyNumbers[i] < l)\n {\n i++;\n }\n var sum = 0UL;\n var current = l;\n while (current <= r)\n {\n while (current <= luckyNumbers[i] && current <= r)\n {\n sum += luckyNumbers[i];\n current++;\n }\n i++;\n }\n\n Console.WriteLine(sum);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "440519e46bc5790a0eedc269dbe82a27", "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd", "difficulty": 1100} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Linq;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static Dictionary d = new Dictionary()\n {\n { 1, 1},\n {2, 3},\n {3, 6 },\n { 4, 10},\n };\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n \n for(int i = 0; i < n; i++)\n {\n var sum = 0;\n var l = Console.ReadLine();\n if(l[0] != '1')\n {\n int k = int.Parse(l[0].ToString());\n sum = (k - 1) * 10 + d[l.Length];\n }\n else\n {\n sum = d[l.Length];\n }\n Console.WriteLine(sum);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c258a191e7e4a8709ec0e1e4086783e3", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800} {"lang": ".NET Core C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30611.23\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Boring Apartments\", \"Boring Apartments\\Boring Apartments.csproj\", \"{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {510506D6-1FE9-4D61-8675-322580D41B76}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a65521d57845568aa8d3208dc110b872", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800} {"lang": "Mono C#", "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 Luba And The Ticket\n time limit per test2 seconds\n memory limit per test256 megabytes\n inputstandard input\n outputstandard output\n Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.\n\n The ticket is considered lucky if the sum of first three digits equals to the sum of last three digits.\n\n Input\n You are given a string consisting of 6 characters (all characters are digits from 0 to 9) \u2014 this string denotes Luba's ticket. The ticket can start with the digit 0.\n\n Output\n Print one number \u2014 the minimum possible number of digits Luba needs to replace to make the ticket lucky.\n */\n public static int Solve(string input1)\n {\n var firstTree = input1.Substring(0, 3).Select(c => int.Parse(c.ToString()));\n var lastTree = input1.Substring(3).Select(c => int.Parse(c.ToString()));\n\n return InnerSolve(firstTree, lastTree, 0);\n }\n\n private static int InnerSolve(\n IEnumerable firstTree,\n IEnumerable lastTree,\n int count)\n {\n var firstSum = firstTree.Sum();\n var lastSum = lastTree.Sum();\n if (firstSum == lastSum) return count;\n\n //updating the first tree\n var firstBranchCount = 0;\n if (firstSum > lastSum) // need to decrement the greatest\n {\n var list = firstTree.ToList();\n list.Sort((a, b) => b - a);\n var original = list.First();\n var difference = firstSum - lastSum;\n var decremented = original > difference ?\n original - difference :\n 0;\n firstBranchCount = InnerSolve(\n list.Skip(1).Append(decremented),\n lastTree,\n count + 1);\n }\n else //need to increment\n {\n var list = firstTree.ToList();\n list.Sort();\n var original = list.First();\n var difference = lastSum - firstSum;\n var incremented = difference >= 9 ?\n 9 :\n (difference - original) + original;\n firstBranchCount = InnerSolve(\n list.Skip(1).Append(incremented),\n lastTree,\n count + 1);\n }\n\n //updating the last tree\n var lastBranchCount = InnerSolve(lastTree, firstTree, count + 1);\n\n return firstBranchCount > lastBranchCount ? lastBranchCount : firstBranchCount;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5f0187806d093d941f3361445b363cbe", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "difficulty": 1600} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var dx = 1; var dy = 0;\n var d = 2;\n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var x = 0 var y = 0;\n var xn = x + dx * (d / 2); var yn = y + dy * (d / 2);\n while (((x != s[0] || (y-s[1])*(yn-s[1]) > 0)) &&\n ((y != s[1] || (x-s[0])*(xn-s[0]) > 0))) {\n d++;\n x = xn; y = yn;\n xn = x + dx * (d / 2); yn = y + dy * (d / 2);\n }\n Console.WriteLine(d - 2);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ea558fba012c02a804919d93e4d6c69a", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400} {"lang": "Mono C#", "source_code": " using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text.RegularExpressions;\n\n\n class Program\n {\n static void Main(string[] args){\n \n string[] input = Console.ReadLine().Split(' ');\n \n int xCoordinate = Int32.Parse(input[0]);\n int yCoordinate = Int32.Parse(input[1]);\n //int turnsCOmpleted = 0;\n int turnsTaken = 0;\n if ((xCoordinate == 0 && yCoordinate == 0) || (xCoordinate == 1 && yCoordinate == 0)){\n\t\tConsole.WriteLine(0);\n\t\tbreak;\t\t\t\n}\n \n else\n {\n int currentXCoor = 0;\n int currentYCoor = 0;\n int previousXCoor = 1;\n int previousYCoor = 0;\n int quadrant = 1;\n\n\n \n for (int i = 0; i < int.MaxValue; i++)\n {\n //int y = 0;\n //int x = 0;\n if (quadrant == 1)\n {\n currentXCoor = previousXCoor;\n currentYCoor = previousYCoor + 1 +(2*(-previousYCoor));\n turnsTaken += 1;\n if(xCoordinate == currentXCoor)\n {\n if (yCoordinate >= previousYCoor && yCoordinate <= currentYCoor)\n break;\n \n }\n \n\n }\n //continue;\n else if (quadrant == 2)\n {\n currentXCoor = -previousXCoor;\n currentYCoor = previousYCoor;\n turnsTaken += 1;\n if(yCoordinate == currentYCoor)\n {\n if (xCoordinate <= previousXCoor && xCoordinate >= currentXCoor)\n break;\n }\n\n //c//ontinue;\n }\n else if (quadrant == 3)\n {\n currentXCoor = previousXCoor;\n currentYCoor = -previousYCoor;\n turnsTaken += 1;\n if(xCoordinate == currentXCoor)\n {\n if (yCoordinate >= currentYCoor && yCoordinate <= previousYCoor)\n break;\n }\n\n }\n\n else if(quadrant == 4)\n {\n currentXCoor = -previousXCoor+1;\n currentYCoor = previousYCoor;\n turnsTaken += 1;\n if(yCoordinate == currentYCoor)\n {\n if (xCoordinate >= previousXCoor && xCoordinate <= currentXCoor)\n break;\n }\n\n }\n previousXCoor = currentXCoor;\n previousYCoor = currentYCoor;\n if (quadrant == 4)\n quadrant = 1;\n else\n quadrant += 1;\n\n\n\n }\n }\n Console.WriteLine(turnsTaken);\n }\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bf8e25562b813d0b5bfbe34ad1414641", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {6E004330-966A-4BED-B095-733EFEF1E9A3}\n Exe\n Properties\n A\n A\n v4.0\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2741ab1630f2b3c8890051a1329539dc", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400} {"lang": "Mono C#", "source_code": " using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text.RegularExpressions;\n\n\n class Program\n {\n static void Main(string[] args){\n \n string[] input = Console.ReadLine().Split(' ');\n \n int xCoordinate = Int32.Parse(input[0]);\n int yCoordinate = Int32.Parse(input[1]);\n //int turnsCOmpleted = 0;\n int turnsTaken = 0;\n if ((xCoordinate == 0 && yCoordinate == 0) || (xCoordinate == 1 && yCoordinate == 0)){\n\t\tConsole.WriteLine(0);\n\t\tBreak;\t\t\t\n}\n \n else\n {\n int currentXCoor = 0;\n int currentYCoor = 0;\n int previousXCoor = 1;\n int previousYCoor = 0;\n int quadrant = 1;\n\n\n \n for (int i = 0; i < int.MaxValue; i++)\n {\n //int y = 0;\n //int x = 0;\n if (quadrant == 1)\n {\n currentXCoor = previousXCoor;\n currentYCoor = previousYCoor + 1 +(2*(-previousYCoor));\n turnsTaken += 1;\n if(xCoordinate == currentXCoor)\n {\n if (yCoordinate >= previousYCoor && yCoordinate <= currentYCoor)\n break;\n \n }\n \n\n }\n //continue;\n else if (quadrant == 2)\n {\n currentXCoor = -previousXCoor;\n currentYCoor = previousYCoor;\n turnsTaken += 1;\n if(yCoordinate == currentYCoor)\n {\n if (xCoordinate <= previousXCoor && xCoordinate >= currentXCoor)\n break;\n }\n\n //c//ontinue;\n }\n else if (quadrant == 3)\n {\n currentXCoor = previousXCoor;\n currentYCoor = -previousYCoor;\n turnsTaken += 1;\n if(xCoordinate == currentXCoor)\n {\n if (yCoordinate >= currentYCoor && yCoordinate <= previousYCoor)\n break;\n }\n\n }\n\n else if(quadrant == 4)\n {\n currentXCoor = -previousXCoor+1;\n currentYCoor = previousYCoor;\n turnsTaken += 1;\n if(yCoordinate == currentYCoor)\n {\n if (xCoordinate >= previousXCoor && xCoordinate <= currentXCoor)\n break;\n }\n\n }\n previousXCoor = currentXCoor;\n previousYCoor = currentYCoor;\n if (quadrant == 4)\n quadrant = 1;\n else\n quadrant += 1;\n\n\n\n }\n }\n Console.WriteLine(turnsTaken);\n }\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "23e9fba9daf23cae48062e05dde1f0d0", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400} {"lang": "MS C#", "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;\nusing CommentRemover;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8e56afb7dbac13f043762bdeebe6652d", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300} {"lang": "Mono C#", "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 double 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\n\t\t\tdouble result = (double)(prob) / (soma);\n\n\t\t\treturn result;\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "775c24c0602f1310e3fd7775565faaec", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\nusing System;\nusing System.Text;\nusing System.Collections;\nusing System.IO;\nusing System.Numerics;\nnamespace pr\n{\n class Program\n {\n public static void Main(string[] args)\n { int[,] mas= new int[4,4];\n for (int i=0;i<4;i++){\n string line=Console.ReadLine();\n for(int j=0;j<4;j++){if(line[j]=='.'){mas[i,j]=0;}else {mas[i,j]=1;}}\n }\n int s,res=0;\n for (int i=0;i<3;i++){\n s=0;\n for(int j=0;j<3;j++){\n s=mas[i,j]+=mas[i+1,j]+=mas[i,j+1]+=mas[i+1,j+1];\n if ((s==0)||(s==1)||(s==3)||(s==4)) {res++;}\n }\n }\n if(res>0){Console.WriteLine(\"YES\");}else {Console.WriteLine(\"NO\");}\n //Console.WriteLine();\n //Console.ReadKey(true);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "74674b3bf57c6212f50745fcc1b30c15", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100} {"lang": "Mono C#", "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[] str = new string[4];\n bool f = false;\n for (int i = 0; i < 4; i++)\n {\n str[i] = Console.ReadLine();\n }\n for (int i = 1; i < 3; i++)\n {\n\n bool g = false;\n for (int j = 1; j < 3; j++) \n {\n int sharp = 0;\n int dot = 0;\n if (str[i][j] == '#')\n {\n sharp++;\n }\n else\n {\n dot++;\n }\n if (str[i - 1][j] == '#')\n {\n sharp++;\n }\n else\n {\n dot++;\n }\n if (str[i - 1][j - 1] == '#')\n {\n sharp++;\n }\n else\n {\n dot++;\n }\n if (str[i][j - 1] == '#')\n {\n sharp++;\n }\n else\n {\n dot++;\n }\n if (sharp == 4 || sharp == 3)\n {\n Console.WriteLine(\"YES\");\n g = true;\n f = true;\n break;\n }\n if (dot == 4 || dot == 3)\n {\n Console.WriteLine(\"YES\");\n g = true;\n f = true;\n break;\n }\n }\n if (g)\n {\n break;\n }\n }\n if (!f)\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "879cc85fc0c794b1b3e8313d5f5ce280", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {2A47F7D6-541E-481D-B886-5ACB1620473D}\n Exe\n Properties\n ConsoleApplication1\n ConsoleApplication1\n v4.5.2\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ffff844cb82cf13865c7e7ab4f92b13b", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100} {"lang": "MS C#", "source_code": "\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static Boolean test(char[,] inp, int i, int j)\n {\n if (i + 1 == 4 || j + 1 == 4) return false;\n if (inp[i, j] == inp[i + 1, j] && inp[i, j] == inp[i + 1, j + 1] && inp[i, j] == inp[i, j + 1]) return true;\n return false;\n }\n\n public static Boolean chtest(char[,] inp)\n {\n char original;\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 4; j++)\n {\n original = inp[i, j];\n if (inp[i, j] == '.') { inp[i, j] = '#'; }\n else inp[i, j] = '.';\n if (test(inp, i, j)) return true;\n }\n return false;\n }\n\n public static void final(char[,] inp)\n {\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 4; j++)\n {\n if (test(inp, i, j))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n if (chtest(inp)) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n static void Main(string[] args)\n {\n char[,] inp = new char[4, 4];\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 4; j++)\n { inp[i, j] = Convert.ToChar(Console.ReadLine()); }\n final(inp);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4a6abb411c705292d07923878f7330fc", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace IQ_\u0442\u0435\u0441\u0442\n{\n class Program\n {\n static void Main(string[] args)\n {\n int size=4;\n size = size + 2;\n char[,] mas = new char [size,size];\n for (int i = 0; i < size-2; i++)\n for (int j = 0; j < size; j++)\n mas[i, j] = Convert.ToChar(Console.Read());\n size = size - 2;\n bool flag = false; ;\n int count=0;\n for(int i=0;i \n Console.ReadLine().Select(c => c == '#').ToArray()).ToArray();\n Func check = () => {\n for (var y = 0; y < 3 ; y++) for (var x = 0; x < 3 ; x++)\n return a[y][x]==a[y][x] && a[y][x]==a[y+1][x] && a[y][x]==a[y+1][x+1];\n };\n\n if (check()) {\n Console.WriteLine(\"YES\"); return; \n }\n for (var y = 0; y<4;y++)for (var x=0;x<4;x++) {\n a[y][x] = !a[y][x];\n if (check()) { Console.WriteLine(\"YES\"); return; }\n a[y][x] = !a[y][x];\n }\n Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4521adcbc4ccfb73f1d00f7f6186f325", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dima_and_the_equation\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c, a, a;\n long x;\n string[] hold;\n List result = new List();\n hold = Console.ReadLine().Split(' ');\n a = Int32.Parse(hold[0]);\n b = Int32.Parse(hold[1]);\n c = Int32.Parse(hold[2]);\n for (int i = 1; i <= 81; i++)\n {\n x = b *(long) Math.Pow(i, a) + c;\n if (x>0&& x< Math.Pow(10,9))\n if (sum(x) == i)\n result.Add(x);\n }\n Console.WriteLine(result.Count);\n foreach (int i in result)\n {\n Console.Write(i + \" \");\n }\n Console.ReadLine();\n }\n static int sum(long number)\n {\n string k = number.ToString();\n int sum = 0;\n foreach (char i in k)\n {\n sum += Int32.Parse(i.ToString());\n }\n return sum;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0921967dfc4272d2f0a4d0c4d5fdc9ef", "src_uid": "e477185b94f93006d7ae84c8f0817009", "difficulty": 1500} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nclass P { \n static void Main() { \n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var p = s.Take(4).ToArray();\n var a = s[4];\n var b = Math.Min(s[5], 1000);\n \n var perm = new List();\n for (var i1 = 0 ; i1 < 4 ; i1++)\n for (var i2 = 0 ; i2 < 4 ; i2++)\n for (var i3 = 0 ; i3 < 4 ; i3++)\n for (var i4 = 0 ; i4 < 4 ; i4++)\n if (i1 != i2 && i1 != i3 && i1 != i4 && i2 != i3 && i2 != i4 && i3 != i4)\n perm.Add(new [] { i1, i2, i3 ,i4});\n\n var n = Enumerable.Range(a,b).Where(x => x <= b)\n .Count(x => perm.Aggregate(x, (acc,tmp) => acc %tmp) == x);\n Console.Write(n);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c14759dce57a3d7ecdf30d9ce420161d", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ',StringSplitOptions.None);\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n\n long red = (2 * n)/k + ((2 * n) % k > 0 ? 1 : 0);\n long green = (5 * n)/k + ((5 * n) % k > 0 ? 1 : 0);\n long blue = (8 * n)/k + ((8 * n) % k > 0 ? 1 : 0);\n\n Console.WriteLine(red + green + blue);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3ced4556d84b0fbd69b01128a02eb851", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(\" \",StringSplitOptions.None);\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n\n long red = (2 * n)/k + ((2 * n) % k > 0 ? 1 : 0);\n long green = (5 * n)/k + ((5 * n) % k > 0 ? 1 : 0);\n long blue = (8 * n)/k + ((8 * n) % k > 0 ? 1 : 0);\n\n Console.WriteLine(red + green + blue);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "deaf50a1c7c9f4ff85d83ccf0e4b18a6", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace TaskA\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 long red = (2 * n)/k + ((2 * n) % k > 0 ? 1 : 0);\n long green = (5 * n)/k + ((5 * n) % k > 0 ? 1 : 0);\n long blue = (8 * n)/k + ((8 * n) % k > 0 ? 1 : 0);\n\n Console.WriteLine(red + green + blue);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d4a7a7960c9777890a7b0f64925c2b26", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800} {"lang": "MS C#", "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[] line;\n line = Console.ReadLine().Split(' ');\n\n int N = int.Parse(line[0]);\n int D = int.Parse(line[1]);\n\n line = Console.ReadLine().Split(' ');\n var costs = line.Select(i => int.Parse(i)).ToArray();\n costs= costs.OrderBy(i => i);\n\n line = Console.ReadLine().Split(' ');\n int = int M = int.Parse(line[0]);\n\n int profit = 0;\n\n for (int i = 0; i < M; i++)\n {\n if (i < costs.Length)\n profit += costs[i];\n else\n profit -= D;\n }\n\n Console.WriteLine(profit);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f2d324feda4c6aa96d313d678365ccd7", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace q847a\n{\n class Program\n {\n static void Main(string[] args)\n {\n var firstLine = Console.ReadLine();\n var secondLine = Console.ReadLine();\n var inputLength = -1;\n\n Int32.TryParse(firstLine, out inputLength);\n\n if (inputLength > 0)\n {\n var volumeOfText = (from word in secondLine.Split(\" \")\n select word.ToCharArray().Count(c => Char.IsUpper(c))).Max();\n\n Console.WriteLine(volumeOfText);\n }\n else\n {\n throw new ArgumentException(\"Text length is in invalid status. Possibly invalid input\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ea59c5197bdd0a04b722bf7e0ce983f3", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800} {"lang": "MS C#", "source_code": "string num = Console.ReadLine();\n string txt = Console.ReadLine();\n int count = 0;\n for (int i = 0; i 0)\n {\n var volumeOfText = (from word in secondLine.Split(\" \")\n select word.Count(c => Char.IsUpper(c))).Max();\n\n Console.WriteLine(volumeOfText);\n }\n else\n {\n throw new ArgumentException(\"Text length is in invalid status. Possibly invalid input\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "28b92eae5d33860538e28a3a0bcf7d09", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CrokContest\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split();\n int a = int.Parse(arr[0]);\n int n = int.Parse(arr[1]);\n\n int end = a + n -1;\n\n int sqrLen = 1;\n int[] table = new int[3163]; \n table[0] = 1;\n for (int i = 1; table[i-1] < end; ++i, ++sqrLen)\n table[i] = 1 + i*2 + table[i -1]; \n\n int max = end+1;\n int[] sqrs = new int[max];\n for (int i = 0; i < sqrLen; ++i)\n {\n for (int j = table[i]; j < max; j += table[i])\n {\n sqrs[j] = table[i];\n }\n }\n\n Decimal sum = 0;\n for (int i = a; i <= end; ++i)\n {\n sum += i / sqrs[i];\n }\n Console.Write(sum);\n }\n }\n}\n\nk", "lang_cluster": "C#", "compilation_error": true, "code_uid": "95020016b5618c9117f670887d981bf9", "src_uid": "915081861e391958dce6ee2a117abd4e", "difficulty": 1500} {"lang": "Mono C#", "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)&& (b-kv.Value)/p>=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 && (a == kv.Key) && ((b-kv.Value)%py ==0) && (b-kv.Value)/p>=0)\n {\n ans=1;\n break;\n }\n else if (py == 0 && (b == kv.Value) && ((a - kv.Key) % px == 0) &&(a-kv.Key)/p >=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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c8ca4e78391fc79fbf69bc4edde6efa5", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700} {"lang": "MS C#", "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(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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "26507fbab678e19167b816966eae3000", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9b806398ddfce290f4871dd326aa40ea", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {7A6B3C66-E8C4-4153-945E-CB2386BDFEE3}\n Exe\n Properties\n A.Ksenia_and_Pan_Scales\n A.Ksenia_and_Pan_Scales\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "02c6fa13f87cedc4ac95b1db2f1d0a55", "src_uid": "917f173b8523ddd38925238e5d2089b9", "difficulty": 1100} {"lang": "MS C#", "source_code": "class Program\n{\n static void Main(string[] args)\n {\n StringBuilder sb = new StringBuilder();\n string line = Console.ReadLine();\n string left = \"\";\n string right = \"\";\n\n string[] parts = line.Split('|');\n left = parts[0];\n right = parts[1];\n\n sb.Append(left);\n sb.Append(\"|\");\n sb.Append(right);\n\n int iLeft = left.Count();\n int iRight = right.Count();\n int sum = iLeft + iRight;\n\n line = Console.ReadLine();\n\n if ((sum + line.Count()) % 2 == 0)\n {\n for (int i = 0; i < line.Count(); i++)\n {\n if (iLeft < iRight)\n {\n sb.Insert(0, line[i]);\n iLeft++;\n }\n else if (iRight < iLeft)\n {\n sb.Append(line[i]);\n iRight++;\n }\n else\n {\n sb.Insert(0, line[i]);\n iLeft++;\n }\n }\n line = sb.ToString();\n parts = line.Split('|');\n left = parts[0];\n right = parts[1];\n if (left.Count() == right.Count())\n {\n Console.WriteLine(sb.ToString());\n }\n else\n {\n Console.WriteLine(\"Impossible\");\n }\n }\n else\n {\n Console.WriteLine(\"Impossible\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "927f273594a6940b235a36743141957a", "src_uid": "917f173b8523ddd38925238e5d2089b9", "difficulty": 1100} {"lang": "MS C#", "source_code": " 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 public int Asc(char c_C)\n {\n System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();\n int intAsciiCode = (int)asciiEncoding.GetBytes(c_C.ToString())[0];\n return (intAsciiCode);\n }\n\n public char Chr(int asciiCode)\n {\n if (asciiCode >= 0 && asciiCode <= 255)\n {\n System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();\n byte[] byteArray = new byte[] { (byte)asciiCode };\n char c_Character = asciiEncoding.GetString(byteArray)[0];\n return (c_Character);\n }\n else\n {\n throw new Exception(\"ASCII Code is not valid.\");\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4e5ab2b752f3cd68eb9a2a4ee07816ac", "src_uid": "47618510d2a17b1cc1e6a688201d51a3", "difficulty": 1600} {"lang": "Mono C#", "source_code": "\ufeffusing 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 string firstString = Console.ReadLine();\n string secondString = Console.ReadLine();\n string resultString = \"\";\n bool stringCanBeCreated = true;\n bool stringCreated = false;\n int differentsQuantity = 0;\n for (int i = 0; i < firstString.Length; i++)\n {\n char letter1 = firstString[i];\n char letter2 = secondString[i];\n var d = Math.Abs(letter2 - letter1);\n if (d > 1)\n {\n differentsQuantity++;\n }\n if (d==1) && (firstString[i+1]==secondString[i+1])\n {\n differentsQuantity++;\n }\n }\n if (differentsQuantity == 0)\n {\n stringCanBeCreated = false;\n }\n if (stringCanBeCreated)\n {\n for (int i = firstString.Length - 1; i >= 0; i--)\n {\n bool zUsed = false;\n char letter = firstString[i];\n if (letter == 'z' && !stringCreated)\n {\n letter = 'a';\n zUsed = true;\n }\n if (!stringCreated && !zUsed)\n {\n letter += (char)1;\n stringCreated = true;\n }\n resultString = letter.ToString() + resultString;\n }\n if (resultString==secondString)\n {\n Console.WriteLine(\"No such string\");\n }\n else\n {\n Console.WriteLine(resultString);\n }\n }\n else\n {\n Console.WriteLine(\"No such string\");\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d196cb6cfabfdb2a2ec2b985eed0e4a5", "src_uid": "47618510d2a17b1cc1e6a688201d51a3", "difficulty": 1600} {"lang": "MS C#", "source_code": "using System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\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 List Numbers()\n {\n return !Next() ? new List() : _line.Split(' ').Select(long.Parse).ToList();\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 : IEnumerable>\n {\n private readonly List _items = new List();\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTree()\n {\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 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 /// \n /// Prime numbers\n /// \n public class Primes\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}\nusing System.Runtime.ExceptionServices;\n\nnamespace Codeforces.TaskD\n{\n public class Task\n {\n public static void Main()\n {\n var task = new Task();\n try\n {\n task.Solve();\n }\n catch (Exception ex)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(ex);\n throw;\n }\n }\n\n void Solve()\n {\n long N, K;\n Input.Next(out N, out K);\n const long mod = 1000000007L;\n\n var d = new long[N + 2, K + 2];\n\n for (var n = 1; n <= N; n++)\n d[n, 1] = 1;\n\n for (var k = 1; k <= K; k++)\n for (var n = 1; n <= N; n++)\n for (var i = n; i <= N; i += n)\n d[i, k + 1] = (d[i, k + 1] + d[n, k])%mod;\n\n var result = 0L;\n for (var i = 1; i <= N; i++)\n result += d[i, K];\n result %= mod;\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "da300009fc8877d48ee645eb5f13f97b", "src_uid": "c8cbd155d9f20563d37537ef68dde5aa", "difficulty": 1400} {"lang": "C# 8", "source_code": "using System;\r\nusing static System.Math;\r\n\r\nnamespace Codeforces\r\n{\r\n public static class Main\r\n {\r\n static void _1651A()\r\n {\r\n int c = int.Parse(Console.ReadLine());\r\n\r\n while (c-- > 0)\r\n {\r\n int n = int.Parse(Console.ReadLine());\r\n Console.WriteLine(Math.Pow(2, n) - 1);\r\n }\r\n }\r\n\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "89804555febc5bd47d9b9dc836997ec6", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "difficulty": 800} {"lang": "C# 8", "source_code": "int c = int.Parse(Console.ReadLine());\r\n\r\nwhile (c --> 0)\r\n{\r\n int n = int.Parse(Console.ReadLine());\r\n Console.WriteLine(Math.Pow(2,n)-1);\r\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ecf2dedbd5b2f2875da3eb2c8b1cec19", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "difficulty": 800} {"lang": "C# 8", "source_code": "using System;\r\n\r\nnamespace Codeforces\r\n{\r\n public static class Main\r\n {\r\n static void _1651A()\r\n {\r\n int c = int.Parse(Console.ReadLine());\r\n\r\n while (c-- > 0)\r\n {\r\n int n = int.Parse(Console.ReadLine());\r\n Console.WriteLine(Math.Pow(2, n) - 1);\r\n }\r\n }\r\n\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4a56d45309a045c2db1619575095bb04", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "difficulty": 800} {"lang": "MS C#", "source_code": "g System;\nclass Meclass\n{ \n static void Main()\n {\n int[,] array ={\n {0,0,0,0,0,0,0,0,0,0},\n {0,1,1,1,1,1,1,1,1,0},\n {0,1,1,1,1,1,1,1,1,0},\n {0,1,1,1,1,1,1,1,1,0},\n {0,1,1,1,1,1,1,1,1,0},\n {0,1,1,1,1,1,1,1,1,0},\n {0,1,1,1,1,1,1,1,1,0},\n {0,1,1,1,1,1,1,1,1,0},\n {0,1,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0},\n };\n \n var n=Console.ReadLine();\n int i;\n int x1=0;\n int y1=0;\n char[] bukvi={'a','b','c','d','e','f','g','h'};\n char[] cifri = { '1', '2', '3', '4', '5', '6', '7', '8' };\n for(i=0;i<8;i++)\n {\n if(n[0]==bukvi[i])\n {\n x1 = i;\n }\n }\n for (i = 0; i < 8; i++)\n {\n if (n[1] == cifri[i])\n {\n y1 = i;\n }\n }\n int sum = 0;\n ++x1;++y1;\n int a,b;\n for(a=x1-1;a();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a56d4e69909cd04cc280775e6b1c091d", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800} {"lang": "MS C#", "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 a = Console.ReadLine();\n if ((a[0] == 'a' && (a[1] == '8' || a[1] == '1')) || (a[0] == 'h' && (a[1] == '8' || a[1] == '1')))\n {\n Console.WriteLine(3);\n return;\n }\n if ((a[0] == 'a' && (a[1] < '8' && a[1] > '1')) || (a[0] == 'h' && (a[1] < '8' && a[1] > '1')))\n {\n Console.WriteLine(5);\n return;\n }\n if ((a[0] == '1' && (a[1] < 'h' && a[1] > 'a')) || (a[0] == '8' && (a[1] < 'h' && a[1] > 'a')))\n {\n Console.WriteLine(5);\n return;\n }\n if (((a[0] > 'a' && a[0] < 'h') && a[1] == '8') || ((a[0] > 'a' && a[0] < 'h') && a[1] == '1'))\n {\n Console.WriteLine(5);\n return;\n }\n if (((a[0] > '1' && a[0] < '8') && a[1] == 'a') || ((a[0] > '1' && a[0] < '8') && a[1] == 'h'))\n {\n Console.WriteLine(5);\n return;\n }\n Console.WriteLine(8);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5b2817924a9e8222b5e57691ff124ee4", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n if (s == null) return;\n var ans = 0;\n if (new[] {\"a8\", \"h8\", \"a1\", \"h1\"}.Contains(s))\n {\n ans = 3;\n }\n else\n {\n ans = s.LastIndexOfAny(new[] {'a', 'h', '1', '8'}) < s.Length ? 5 : 8;\n }\n Console.WriteLine(ans);\n }\n\n public static int[] ReadInts()\n {\n var input = Console.ReadLine();\n return input?.Split(' ').Select(int.Parse).ToArray();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8306e4f942281ae85386797fc4ca7ffd", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800} {"lang": "MS C#", "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 //static readonly TextReader input = Console.In;\n //static readonly TextWriter output = Console.Out;\n\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "926fa05af8574e72ee7dfb737077e9bb", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000} {"lang": "MS C#", "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;\nusing System.Numerics;\n#endif\n\nnamespace _333a\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\ta = readIntArray();\n\t\t\tvar n = a[0];\n\t\t\tvar bx = a[1];\n\n\t\t\tvar x = new BigInteger();\n\t\t\ta = readIntArray();\n\t\t\tvar p = 0;\n\t\t\tfor (int i = n - 1; i >= 0; i--)\n\t\t\t{\n\t\t\t\tx += BigInteger.Pow(bx, p) * a[i];\n\t\t\t\tp++;\n\t\t\t}\n\n\t\t\ta = readIntArray();\n\t\t\tvar m = a[0];\n\t\t\tvar by = a[1];\n\n\t\t\tvar y = new BigInteger();\n\t\t\ta = readIntArray();\n\t\t\tp = 0;\n\t\t\tfor (int i = m - 1; i >= 0; i--)\n\t\t\t{\n\t\t\t\t//var bi = new BigInteger(by);\n\n\t\t\t\ty += BigInteger.Pow(by, p) * a[i];\n\t\t\t\tp++;\n\t\t\t}\n\n\t\t\tif (x == y)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"=\");\n\t\t\t}\n\t\t\telse if (x > y)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\">\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"<\");\n\t\t\t}\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 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eaceb221e1a8c7160e5e64766b48ce5d", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\n\nnamespace Codeforces\n{\n internal class Point\n {\n public int X { get; set; } = 0;\n public int Y { get; set; } = 0;\n\n public static Point operator +(Point x, Point y)\n {\n return new Point(x.X + y.X, x.Y + x.Y);\n }\n\n public static Point operator -(Point x, Point y)\n {\n return new Point(x.X - y.X, x.Y - x.Y);\n } \n public Point(int x, int y)\n {\n X = x;\n Y = y;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n var _ = Console.ReadLine();\n var input = Console.ReadLine();\n var result = 0;\n for (var i = 1; i <= input.Length; i++)\n {\n for (int d = 0; d <= input.Length - i; d++)\n {\n var currPoint = new Point(0, 0);\n for (var j = d; j < i + d; j++)\n {\n switch (input[j])\n {\n case 'U':\n {\n currPoint.Y++;\n }\n break;\n case 'D':\n {\n currPoint.Y--;\n }\n break;\n case 'L':\n {\n currPoint.X--;\n }\n break;\n case 'R':\n {\n currPoint.X++;\n }\n break;\n }\n }\n if (currPoint.X == 0 && currPoint.Y == 0)\n result++;\n } \n }\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aa93d93995a05b2aa3a743f2b57e461b", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000} {"lang": "MS C#", "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 n = int.Parse(Console.ReadLine());\n var commandsArray = Console.ReadLine().ToCharArray();\n long count = 0;\n for (int i = 0; i < n; i++)\n {\n var lastResult = new Point();\n lastResult.DoCommand(commandsArray[i]);\n for (int g = i + 1; g < n; g++)\n {\n lastResult.DoCommand(commandsArray[g]);\n if (lastResult.InStartPlace())\n count++;\n }\n }\n Console.WriteLine(count);\n }\n\n public class Point\n {\n public int x, y;\n\n public void DoCommand(char command)\n {\n switch (command)\n {\n case 'U': { y++;break; }\n case 'D': { y--;break; }\n case 'L': { x--;break; }\n case 'R': { x++;break; }\n }\n }\n\n public bool InStartPlace()\n {\n return x == 0 && y == 0;\n }\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c1c3e9d94e754e943edf765a8d9652fd", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000} {"lang": "Mono C#", "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 string[] s = Console.ReadLine().Split();\n int n = Convert.toInt32(s[0]);\n int m = Convert.toInt32(s[1]);\n int k = Convert.toInt32(s[2]);\n if (n <= m && n <= k)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"NO\");\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a77b01cf71b7607b0694fdaf1b4b8526", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800} {"lang": "Mono C#", "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 \n int n = Int32.Parse(Console.Read());\n int m = Int32.Parse(Console.Read());\n int k = Int32.Parse(Console.Read());\n \n if(m 1) ? 2 + (n - 2) / 7 * 2 : (n > 0) ? 1:0 +(n-2)%7/6 ;\n Console.WriteLine(\"\" + min + ' ' + max);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d4a4aec10dfb6c62bbd8efc008237440", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900} {"lang": "Mono C#", "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: 21.10.2012\n * \u0412\u0440\u0435\u043c\u044f: 10:55\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;\n\nnamespace round_146\n{\n class Program\n {\n public 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 Int64 rez = 0;\n int[] d = new int[1000001];\n //\u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438 \u0447\u0438\u0441\u043b\u0430:\n for (i=1;i<=a*b*c;i++)\n for (j=i;j<=a*b*c;j+=i)\n d[j]++;\n /////////////////////////////////////////////\n for (int i=1;i<=a;i++){ \n \n for (int j=1; j<=b; j++){ \n \n for (int k =1; k<=c; k++){ \n \n \n rez+= d[i*j*k]+1;\n \n \n }\n\n }\n\n };\n\n Console.WriteLine(rez%1073741824);\n\n // Console.ReadKey();\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0503a00f55bc5924555cab7da7727fb1", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeff#region License\n\n// Copyright (C) 2012 Kazunori Sakamoto\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#endregion\n\nusing System;\nusing System.IO;\n\nnamespace Codeforces {\n\tpublic class ProblemE {\n\t\t//public static void Main(string[] args) {\n\t\t// new ProblemE().Solve(Console.In);\n\t\t//}\n\n\t\tprivate void Solve(TextReader input) {\n\t\t\t//1: 0, 1\n\t\t\t//2: 3, 2 = 1 * 3, 0 + 1 * 2\n\t\t\t//3: 6, 7 = 2 * 3, 3 + 2 * 2\n\t\t\t//4: 21, 20 = 7 * 3, 6 + 7 * 2\n\t\t\tvar n = int.Parse(input.ReadLine()) - 1;\n\t\t\tvar d = 0L;\n\t\t\tvar notD = 1L;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tvar newD = notD * 3 % 1000000007;\n\t\t\t\tnotD = (d + notD * 2) % 1000000007;\n\t\t\t\td = newD;\n\t\t\t}\n\t\t\tConsole.WriteLine(d);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bb9a12843e158212499f37de831ea23d", "src_uid": "77627cc366a22e38da412c3231ac91a8", "difficulty": 1500} {"lang": "Mono C#", "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 = ReadLine();\n var b = ReadLine();\n if (a.Length < b.Length) Fail(new string(a.OrderByDescending(c => c).ToArray()));\n if (a==b) Fail(a);\n var max = 0L;\n for (var j = 0; j <= a.Length; j++)\n {\n var u = new List();\n for (var i = 0; i < a.Length; i++)\n u.Add(a[i]);\n var res = \"\";\n for(var i = 0; i < j; i++)\n {\n u.Sort((c, d) => d - c);\n var idx = 0;\n while (idx!=u.Length&&b[i] < u[idx]) idx++;\n if (idx == u.Length || u[idx] != b[i]) goto END;\n res += u[idx]; u.RemoveAt(idx);\n }\n if (j == a.Length)\n {\n chmax(ref max, long.Parse(res));break;\n }\n u.Sort((c, d) => d - c);\n var id = 0;\n while (id != u.Count && b[j] <= u[id]) id++;\n if (id == u.Count) continue;\n res += u[id];u.RemoveAt(id);\n if (u.Count == 0) { chmax(ref max, long.Parse(res));continue; }\n u.Sort((c, d) => d - c);\n for (var i = 0; i < u.Count; i++)\n res += u[i];\n chmax(ref max, long.Parse(res));\n }\n END:;\n WriteLine(max);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5477a65e15b405b22feda1be85791c80", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "difficulty": 1700} {"lang": "Mono C#", "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 = ReadLine();\n var b = ReadLine();\n if (a.Length < b.Length) Fail(new string(a.OrderByDescending(c => c).ToArray()));\n var u = new List();\n for (var i = 0; i < a.Length; i++)\n u.Add(a[i]);\n var res = \"\";var tg = true;\n for(var i = 0; i < a.Length; i++)\n {\n u.Sort((a,b)=>b-a);\n var idx = 0;\n if (!tg) { res += u[0];u.RemoveAt(0);continue; }\n while (b[i] < u[idx]) idx++;\n tg = b[i] == u[idx];\n res += u[idx];u.RemoveAt(idx);\n }\n WriteLine(res);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "787d8da9136d8b5177e64fdf5e30156e", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "difficulty": 1700} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] sequence = new string[4];\n sequence[0] = Console.ReadLine();\n sequence[0] = sequence[0].Remove(0, 2);\n sequence[1] = Console.ReadLine();\n sequence[1] = sequence[1].Remove(0, 2);\n sequence[2] = Console.ReadLine();\n sequence[2] = sequence[2].Remove(0, 2);\n sequence[3] = Console.ReadLine();\n sequence[3] = sequence[3].Remove(0,2);\n if (sequence[0].Length >= (sequence[1].Length * 2) && sequence[0].Length >= (sequence[2].Length * 2) && sequence[0].Length >= (sequence[3].Length * 2))\n {\n if (sequence[1].Length >= (sequence[2].Length * 2) || (sequence[1].Length >= (sequence[3].Length * 2) || ((sequence[1].Length*2) <= sequence[2].Length) || ((sequence[1].Length*2) <= sequence[3].Length) || (sequence[2].Length >= (sequence[11].Length * 2)) || (sequence[2].Length >= (sequence[3].Length * 2) || ((sequence[2].Length*2) <= sequence[1].Length) || ((sequence[2].Length*2) <= sequence[3].Length) || (sequence[3].Length >= (sequence[2].Length * 2)) || ((sequence[3].Length*2) <= sequence[2].Length) || ((sequence[3].Length*2) <= sequence[1].Length))\n {\n Console.WriteLine(\"C\");\n }\n else\n Console.WriteLine(\"A\");\n }\n else if (sequence[1].Length >= (sequence[0].Length * 2) && sequence[1].Length >= (sequence[2].Length * 2) && sequence[1].Length >= (sequence[3].Length * 2))\n {\n if (sequence[0].Length >= (sequence[2].Length * 2) || (sequence[0].Length >= (sequence[3].Length * 2) || ((sequence[0].Length*2) <= sequence[2].Length) || ((sequence[0].Length*2) <= sequence[3].Length) || (sequence[2].Length >= (sequence[11].Length * 2)) || (sequence[2].Length >= (sequence[3].Length * 2) || ((sequence[2].Length*2) <= sequence[0].Length) || ((sequence[2].Length*2) <= sequence[3].Length) || (sequence[3].Length >= (sequence[2].Length * 2)) || ((sequence[3].Length*2) <= sequence[2].Length) || ((sequence[3].Length*2) <= sequence[0].Length))\n {\n Console.WriteLine(\"C\");\n }\n else\n Console.WriteLine(\"B\");\n }\n else if (sequence[2].Length >= (sequence[0].Length * 2) && sequence[2].Length >= (sequence[1].Length * 2) && sequence[2].Length >= (sequence[3].Length * 2))\n {\n if (sequence[1].Length >= (sequence[0].Length * 2) || (sequence[1].Length >= (sequence[3].Length * 2) || ((sequence[1].Length*2) <= sequence[0].Length) || ((sequence[1].Length*2) <= sequence[3].Length) || (sequence[0].Length >= (sequence[11].Length * 2)) || (sequence[0].Length >= (sequence[3].Length * 2) || ((sequence[0].Length*2) <= sequence[1].Length) || ((sequence[0].Length*2) <= sequence[3].Length) || (sequence[3].Length >= (sequence[0].Length * 2)) || ((sequence[3].Length*2) <= sequence[0].Length) || ((sequence[3].Length*2) <= sequence[1].Length))\n {\n Console.WriteLine(\"C\");\n }\n else\n Console.WriteLine(\"C\");\n }\n else if (sequence[3].Length >= (sequence[0].Length * 2) && sequence[3].Length >= (sequence[1].Length * 2) && sequence[3].Length >= (sequence[2].Length * 2))\n {\n if (sequence[1].Length >= (sequence[0].Length * 2) || (sequence[1].Length >= (sequence[3].Length * 2) || ((sequence[1].Length*2) <= sequence[0].Length) || ((sequence[1].Length*2) <= sequence[3].Length) || (sequence[0].Length >= (sequence[11].Length * 2)) || (sequence[0].Length >= (sequence[3].Length * 2) || ((sequence[0].Length*2) <= sequence[1].Length) || ((sequence[0].Length*2) <= sequence[3].Length) || (sequence[3].Length >= (sequence[0].Length * 2)) || ((sequence[3].Length*2) <= sequence[0].Length) || ((sequence[3].Length*2) <= sequence[1].Length))\n {\n Console.WriteLine(\"C\");\n }\n else\n Console.WriteLine(\"D\");\n }\n else if ((sequence[0].Length * 2) <= sequence[1].Length && (sequence[0].Length * 2) <= sequence[2].Length && (sequence[0].Length * 2) <= sequence[3].Length)\n {\n if (sequence[0].Length >= (sequence[2].Length * 2) || (sequence[0].Length >= (sequence[3].Length * 2) || ((sequence[0].Length*2) <= sequence[2].Length) || ((sequence[0].Length*2) <= sequence[3].Length) || (sequence[2].Length >= (sequence[11].Length * 2)) || (sequence[2].Length >= (sequence[3].Length * 2) || ((sequence[2].Length*2) <= sequence[0].Length) || ((sequence[2].Length*2) <= sequence[3].Length) || (sequence[3].Length >= (sequence[2].Length * 2)) || ((sequence[3].Length*2) <= sequence[2].Length) || ((sequence[3].Length*2) <= sequence[0].Length))\n {\n Console.WriteLine(\"C\");\n }\n else\n Console.WriteLine(\"A\");\n }\n else if ((sequence[1].Length * 2) <= sequence[0].Length && (sequence[1].Length * 2) <= sequence[2].Length && (sequence[1].Length * 2) <= sequence[3].Length)\n {\n if (sequence[0].Length >= (sequence[2].Length * 2) || (sequence[0].Length >= (sequence[3].Length * 2) || ((sequence[0].Length*2) <= sequence[2].Length) || ((sequence[0].Length*2) <= sequence[3].Length) || (sequence[2].Length >= (sequence[11].Length * 2)) || (sequence[2].Length >= (sequence[3].Length * 2) || ((sequence[2].Length*2) <= sequence[0].Length) || ((sequence[2].Length*2) <= sequence[3].Length) || (sequence[3].Length >= (sequence[2].Length * 2)) || ((sequence[3].Length*2) <= sequence[2].Length) || ((sequence[3].Length*2) <= sequence[0].Length))\n {\n Console.WriteLine(\"C\");\n }\n else\n Console.WriteLine(\"B\");\n }\n else if ((sequence[2].Length * 2) <= sequence[0].Length && (sequence[2].Length * 2) <= sequence[1].Length && (sequence[2].Length * 2) <= sequence[3].Length)\n {\n if (sequence[1].Length >= (sequence[0].Length * 2) || (sequence[1].Length >= (sequence[3].Length * 2) || ((sequence[1].Length*2) <= sequence[0].Length) || ((sequence[1].Length*2) <= sequence[3].Length) || (sequence[0].Length >= (sequence[11].Length * 2)) || (sequence[0].Length >= (sequence[3].Length * 2) || ((sequence[0].Length*2) <= sequence[1].Length) || ((sequence[0].Length*2) <= sequence[3].Length) || (sequence[3].Length >= (sequence[0].Length * 2)) || ((sequence[3].Length*2) <= sequence[0].Length) || ((sequence[3].Length*2) <= sequence[1].Length))\n {\n Console.WriteLine(\"C\");\n }\n else\n Console.WriteLine(\"C\");\n }\n else if ((sequence[3].Length * 2) <= sequence[0].Length && (sequence[3].Length * 2) <= sequence[1].Length && (sequence[3].Length * 2) <= sequence[2].Length)\n {\n if (sequence[1].Length >= (sequence[0].Length * 2) || (sequence[1].Length >= (sequence[3].Length * 2) || ((sequence[1].Length*2) <= sequence[0].Length) || ((sequence[1].Length*2) <= sequence[3].Length) || (sequence[0].Length >= (sequence[11].Length * 2)) || (sequence[0].Length >= (sequence[3].Length * 2) || ((sequence[0].Length*2) <= sequence[1].Length) || ((sequence[0].Length*2) <= sequence[3].Length) || (sequence[3].Length >= (sequence[0].Length * 2)) || ((sequence[3].Length*2) <= sequence[0].Length) || ((sequence[3].Length*2) <= sequence[1].Length))\n {\n Console.WriteLine(\"C\");\n }\n else\n Console.WriteLine(\"D\");\n } else\n Console.WriteLine(\"C\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bee905af8772e898c2e97bd439561389", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300} {"lang": "MS C#", "source_code": "using System;\n\nclass Program{\n\tprivate static void Main(){\n\t\tfloat a,b,c,d; //input\n\t\tchar ans=null; //correct answer\n\t\tushort num = 0; //number of peculiar answers\n\t\ta=(Console.ReadLine().Split('.')[1]).Length;\n\t\tb=(Console.ReadLine().Split('.')[1]).Length;\n\t\tc=(Console.ReadLine().Split('.')[1]).Length;\n\t\td=(Console.ReadLine().Split('.')[1]).Length;\n\t\t\n\t\tif( (a/b>=2 && a/c>=2 && a/d==2) || (a/d<=0.5 && a/b<=0.5 && a/c<=0.5) )\n\t\t{ ans='A'; num++; }\n\t\t\n\t\tif( (b/a>=2 && b/c>=2 && b/d==2) || (b/a<=0.5 && b/c<=0.5 && b/d<=0.5) )\n\t\t{ ans='B'; num++; }\n\t\t\n\t\tif( (c/a>=2 && c/a>=2 && c/d==2) || (c/a<=0.5 && c/b<=0.5 && c/d<=0.5) )\n\t\t{ ans='C'; num++; }\n\t\t\n\t\tif( (d/a>=2 && d/b>=2 && d/c==2) || (d/a<=0.5 && d/b<=0.5 && d/c<=0.5) )\n\t\t{ ans='D'; num++; }\n\t\t\n\t\tif(num>1) ans='C';\n\t\t\n\t\tConsole.WriteLine(ans);\n\t}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1379e5bcb026a404aa73e1177ecd3570", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace The_Child_and_Homework\n{\n class Program\n {\n static void Main(string[] args)\n {\n IO io = new IO();\n\n string s_A = io.ReadStr();\n string s_B = io.ReadStr();\n string s_C = io.ReadStr();\n string s_D = io.ReadStr();\n if (Cmp(s_A, s_B, s_C, s_D) && !Cmp(s_B, s_A, s_C, s_D) && !Cmp(s_D, s_B, s_C, s_A) && !Cmp(s_C, s_D, s_B, s_A)) io.PutStr(\"A\");\n else if (!Cmp(s_A, s_B, s_C, s_D)&&Cmp(s_B, s_A, s_C, s_D)&&!Cmp(s_D, s_B, s_C, s_A)&&!Cmp(s_C, s_D, s_B, s_A)) io.PutStr(\"B\");\n else if (!Cmp(s_A, s_B, s_C, s_D) && !Cmp(s_B, s_A, s_C, s_D) && Cmp(s_D, s_B, s_C, s_A) && !Cmp(s_C, s_D, s_B s_A)) io.PutStr(\"D\");\n else io.PutStr(\"C\");\n io.ReadStr();\n\n }\n\n static bool Cmp(string s_A,string s_B,string s_C,string s_D)\n {\n if (((s_A.Length - 2) >= 2 * (s_B.Length - 2) && (s_A.Length - 2) >= 2 * (s_C.Length - 2) && (s_A.Length - 2) >= 2 * (s_D.Length - 2)) || (2 * (s_A.Length - 2) <= (s_B.Length - 2) && 2 * (s_A.Length - 2) <= (s_C.Length - 2) && 2 * (s_A.Length - 2) <= (s_D.Length - 2)))\n {\n return true;\n }\n return false;\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\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2c63f1827a1fdef371ef89589cc482a8", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace TheChildAndHomework\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] res = {\"A\", \"B\", \"C\", \"D\" };\n string[] input = new string[4];\n for (int i = 0; i < 4; i++)\n input[i] = Console.ReadLine().Split('.')[1];\n List lengths = new List();\n string result = \"C\";\n for (int i = 0; i < input.Length; i++)\n lengths.Add(input[i].Length);\n for (int i = 0; i < lengths.Count; i++)\n {\n int len = lengths[0];\n if (lengths.Skip(1).Take(3).All(x => len => x * 2) || lengths.Skip(1).Take(3).All(x => len <= x / 2))\n result = res[i];\n lengths.Add(lengths[0]);\n lengths.RemoveAt(0);\n }\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "34052129f997d1ec98c2688a2431e0fa", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string str2 = Console.ReadLine();\n string str3 = Console.ReadLine();\n int r1 = 0;\n int r2 = 0;\n int c1 = 0;\n int c2 = 0;\n int d1 = 0;\n int d2 = 0;\n int x11 = 0;\n int x12 = 0;\n int x21 = 0;\n int x22 = 0;\n string[] strin1 = str1.Split(' ');\n string[] strin2 = str2.Split(' ');\n string[] strin3 = str3.Split(' ');\n r1 = int.Parse(strin1[0]);\n r2 = int.Parse(strin1[1]);\n c1 = int.Parse(strin2[0]);\n c2 = int.Parse(strin2[1]);\n d1 = int.Parse(strin3[0]);\n d2 = int.Parse(strin3[1]);\n x11 = (r1 + c1 - d2) / 2;\n x22 = (r2 + c2 - d2) / 2;\n x12 = r1 - (r1 + c1 - d2) / 2;\n x21 = r2 - (r2 + c2 - d2) / 2;\n if (((r1 + c1 - d2) % 2 == 1) || ((r2 + c2 - d2) % 2 == 1) || (x11 == x12) || (x11 == x21) || (x11 == x22))\n {\n Console.WriteLine(\"-1\");\n\n }\n else {\n Console.WriteLine(x11 + \" \" + x12);\n Console.WriteLine(x21 + \" \" + x22);\n \n }\n Console.ReadLine();\n } \n }\n} using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string str2 = Console.ReadLine();\n string str3 = Console.ReadLine();\n int r1 = 0;\n int r2 = 0;\n int c1 = 0;\n int c2 = 0;\n int d1 = 0;\n int d2 = 0;\n int x11 = 0;\n int x12 = 0;\n int x21 = 0;\n int x22 = 0;\n string[] strin1 = str1.Split(' ');\n string[] strin2 = str2.Split(' ');\n string[] strin3 = str3.Split(' ');\n r1 = int.Parse(strin1[0]);\n r2 = int.Parse(strin1[1]);\n c1 = int.Parse(strin2[0]);\n c2 = int.Parse(strin2[1]);\n d1 = int.Parse(strin3[0]);\n d2 = int.Parse(strin3[1]);\n x11 = (r1 + c1 - d2) / 2;\n x22 = (r2 + c2 - d2) / 2;\n x12 = r1 - (r1 + c1 - d2) / 2;\n x21 = r2 - (r2 + c2 - d2) / 2;\n if (((r1 + c1 - d2) % 2 == 1) || ((r2 + c2 - d2) % 2 == 1) || (x11 == x12) || (x11 == x21) || (x11 == x22))\n {\n Console.WriteLine(\"-1\");\n\n }\n else {\n Console.WriteLine(x11 + \" \" + x12);\n Console.WriteLine(x21 + \" \" + x22);\n \n }\n Console.ReadLine();\n } \n }\n} ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d69875a985e20e47bc27db432656d2d4", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000} {"lang": "Mono C#", "source_code": "class Program\n{\n public static void Main(string[] args)\n {\n List read = new List();\n for (int i = 1; i <= 3; i++)\n read.Add(Console.ReadLine());\n List> list = new List>();\n foreach (string s in read)\n {\n var curr = s.Split();\n list.Add(new List() { Convert.ToInt32(curr[0]),\n Convert.ToInt32(curr[1]) });\n }\n var result = new PuzzleSolver(list[0][0], list[0][1],\n list[1][0], list[1][1], list[2][0], list[2][1]).Solve();\n if (result[0] == -1)\n Console.WriteLine(-1);\n else\n {\n Console.WriteLine(result[0].ToString() + ' ' + result[1]);\n Console.WriteLine(result[2].ToString() + ' ' + result[3]);\n }\n }\n}\n\n\nclass PuzzleSolver\n{\n\n int r1;\n int r2;\n int c1;\n int c2;\n int d1;\n int d2;\n\n public PuzzleSolver(int r1, int r2, int c1, int c2, int d1, int d2)\n {\n this.r1 = r1;\n this.r2 = r2;\n this.c1 = c1;\n this.c2 = c2;\n this.d1 = d1;\n this.d2 = d2;\n }\n\n public List Solve()\n {\n List result = new List();\n List defaultResult = new List();\n defaultResult.Add(-1);\n for (int i1 = 1; i1 <= 9; i1++)\n {\n int key = 1 << i1;\n int i2 = r1 - i1;\n if (!Check(key, i2))\n {\n continue;\n }\n key = 1 << i2;\n int i3 = c1 - i1;\n int i4 = d1 - i1;\n if (i3 == i4)\n continue;\n if (!Check(key, i3) || !Check(key, i4))\n continue;\n if (Validate(i1, i2, i3, i4))\n {\n result = new List() { i1, i2, i3, i4 };\n return result;\n }\n }\n return defaultResult;\n }\n\n private bool Validate(int i1, int i2, int i3, int i4)\n {\n return i3 + i4 == r2 && d2 == i2 + i3 && c2 == i2 + i4;\n }\n\n public bool Check(int key, int num)\n {\n return num > 0 && num <= 9 && (key & (1 << num)) == 0;\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "189eb6918cd6a786b2e9d61e10b353e8", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass P {\n static void Main() {\n var r = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var d = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var res = new [] { new int[2], new int[2] };\n res[0][1] = r[0] + c[1] - d[0];\n if (res[0,1] % 2 == 1) { Console.WriteLine(-1); return; }\n res[0][1] /= 2;\n res[0][0] = r[0] - res[0][1];\n res[1][0] = c[0] - res[0][0];\n res[1][1] = r[1] - res[1][1];\n if (res.SelectMany(aa => aa).Distinct().Count(x => x>=1 && x<=9)<4 || res[0][1]+res[1][1] != c[1] || res[0][0]+res[1][1] != d[0] || res[0][1]+res[1][0] != d[1]) { Console.Write(-1); return; }\n\n Console.WriteLine(\"{0} {1}\", res[0][0], res[0][1]);\n Console.WriteLine(\"{0} {1}\", res[1][0], res[1][1]);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "74a3fe2a6927bbc3aab52a17e36f01ca", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass P {\n static void Main() {\n var r = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var d = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var res = new int[2,2];\n res[0,1] = r[0] + c[1] - d[0];\n if (res[0,1] % 2 == 1) { Console.WriteLine(-1); return; }\n res[0,1] /= 2;\n res[0,0] = r[0] - res[0,1];\n res[1,0] = c[0] - res[0,0];\n res[1,1] = r[1] - res[1,1];\n if (res.Distinct().Count(x => x>=1 && x<=9)<4 || res[0,1]+res[1,1] != c[1] || res[0,0]+res[1,1] != d[0] || res[0,1]+res[1,0] != d[1]) { Console.Write(-1); return; }\n\n Console.WriteLine(\"{0} {1}\", res[0,0], res[0,1]);\n Console.WriteLine(\"{0} {1}\", res[1,0], res[1,1]);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "01567854432b0024bc922d7d79521e01", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass P {\n static void Main() {\n var r = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var d = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var res = new int[2,2]\n res[0,1] = r[0] + c[1] - d[0];\n if (res[0,1] % 2 == 1) { Console.WriteLine(-1); return; }\n res[0,1] /= 2;\n res[0,0] = r[0] - res[0,1];\n res[1,0] = c[0] - res[0,0];\n res[1,1] = r[1] - res[1,1];\n if (res.Distinct().Count(x => x>=1 && x<=9)<4 || res[0,1]+res[1,1] != c[1] || res[0,0]+res[1,1] != d[0] || res[0,1]+res[1,0] != d[1]) { Console.Write(-1); return; }\n\n Console.WriteLine(\"{0} {1}\", res[0,0], res[0,1]);\n Console.WriteLine(\"{0} {1}\", res[1,0], res[1,1]);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3181dbba2852f72bc44d654a692da5cd", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n var test = Console.ReadLine();\n var input = Console.ReadLine();\n var dict = GetDict();\n StringBuilder sb = new StringBuilder();\n foreach(char c in input)\n {\n if (c == '0' || c == '1') continue;\n sb.Append(dict[c - '0']);\n }\n var result = sb.ToString().ToCharArray();\n Array.Sort(result);\n Array.Reverse(result);\n Console.WriteLine(new string(result));\n\n }\n\n private static Dictionary GetFactorial()\n {\n Dictionary factorial = new Dictionary();\n factorial.Add(2, 2);\n for (int i = 3; i <= 9; i++)\n {\n factorial.Add(i, factorial[i - 1] * i);\n }\n return factorial;\n }\n\n private static Dictionary GetDict()\n {\n Dictionary dict = new Dictionary();\n var factorial = GetFactorial();\n dict.Add(2, \"2\");\n for (int i = 3; i <= 9; i++)\n { \n string result = \"\";\n int iter = i;\n var temp = factorial.Keys.ToArray();\n Array.Sort(temp);\n Array.Reverse(temp);\n foreach (int z in temp)\n {\n int j = factorial[z];\n while (i % j == 0 && i > 1)\n {\n i = i / j;\n result += z.ToString();\n }\n if (i <= 1) break;\n }\n if(i == 1 )\n {\n result += dict[iter - 1];\n dict.Add(iter, result);\n }\n else\n {\n dict.Add(iter, Convert.ToString(iter));\n }\n i = iter;\n }\n dict[9] = \"332;\"\n return dict;\n }\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "39e1bcf6f7c3ab3f207f6fefc513b97f", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n class Program\n {\n public static List ReadListOfInts()\n {\n var s = Console.ReadLine();\n char delimiter = ' ';\n return s.Split(delimiter).Select(int.Parse).ToList();\n }\n\n static void Main(string[] args)\n {\n int n, k, cur = -1, T = -1;\n string s, ans = \"NO\";\n List list = ReadListOfInts();\n n = list[0];\n k = list[1];\n s = Console.ReadLine();\n for (int i = 0; i < n; i++){\n if (s[i].Equals('G')) {\n cur = i;\n }\n if (s[i].Equals('T')) {\n T = i;\n }\n }\n if (cur > T) {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n s = new string(charArray);\n cur = n - 1 - cur;\n }\n if(cur > -1)\n for (int i = cur; i < n; i+=k){\n if (s[i] == 'T')\n {\n ans = \"YES\";\n break;\n }\n else\n if (s[i] == '.')\n {\n continue;\n }\n else\n if (s[i] == '#') {\n break;\n }\n }\n\n\n Console.WriteLine(ans);\n\n //Console.ReadKey();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3e4d5f38eb0acbb7361a4761c68e15f6", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800} {"lang": "Mono C#", "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 double LeftO(double y) => (y - 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "27ec4d9e643a5640c7399a93030fd51e", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200} {"lang": "Mono C#", "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 = y => (y - 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bb5724d5c4a383dd7978dcd6153cb37d", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200} {"lang": "Mono C#", "source_code": "Judgement Failed", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b3c79c71852fecf8035f795338bfa18d", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200} {"lang": "Mono C#", "source_code": "/*\n * Created by SharpDevelop.\n * Date: 21.07.2016 - 21.07.2016\n * Time: 21:56\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\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd 22 \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\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\nC. \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 n \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.\n\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,\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.\n\ufffd\ufffd\ufffd i-\ufffd\ufffd \ufffd\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.\t\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\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.\t\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd; \n3.\t\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd; \n4.\t\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\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\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\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).\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,\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.\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 n (1 <= n <= 100) \ufffd \ufffd\ufffd\ufffd\ufffd\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 a1, a2, ..., an (0 <= ai <= 3), \ufffd\ufffd\ufffd: \n\ufffd\tai \ufffd\ufffd\ufffd\ufffd\ufffd 0, \ufffd\ufffd\ufffd\ufffd \ufffd i-\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\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\tai \ufffd\ufffd\ufffd\ufffd\ufffd 1, \ufffd\ufffd\ufffd\ufffd \ufffd i-\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\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\tai \ufffd\ufffd\ufffd\ufffd\ufffd 2, \ufffd\ufffd\ufffd\ufffd \ufffd i-\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\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\tai \ufffd\ufffd\ufffd\ufffd\ufffd 3, \ufffd\ufffd\ufffd\ufffd \ufffd i-\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\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\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd, \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd\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\t\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\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\t\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\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\n4\n1 3 2 0\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n2\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n7\n1 3 3 2 1 2 3\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\ufffd\ufffd\ufffd\n2\n2 2\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\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 1 \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\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.\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\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, 3, 5 \ufffd 7, \ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\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.\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 1, \ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd 2.\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\ufffd \ufffd\ufffd\ufffd\ufffd.\n\n\n\n */\n\nusing System;\nusing System.IO;\n\nclass Program\n{\n\tpublic static void Swap (ref int a, ref int b)\n\t{\n\t\tint temp = a;\n\t\ta = b;\n\t\tb = temp;\n\t}\n\n\tpublic static void Main(string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\20160720\\\\C.txt\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\20160720\\\\C.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# endif\n\n\t\tint n = int.Parse (ss);\n\n\t\tint [] a = new int [n];\n\n# if ( ONLINE_JUDGE )\n\t\tss = Console.ReadLine ();\n# else\n\t\tss = sr.ReadLine ();\n# endif\n\n\t\tstring [] s = ss.Split (' ');\n\n\t\tint k = 0, v = 0, w = 0;\n\t\tint vprev = 0, wprev = 0;\t// vprev >= wprev\n\t\tfor ( int i = 0; i < n; i++ )\n\t\t{\n\t\t\ta [i] = int.Parse (s [i]);\n# if ( ! ONLINE_JUDGE )\n\t\t\tsw.Write (a [i] + \" \");\n# endif\n\n\t\t\tif ( a [i] == 0 )\n\t\t\t{\n\t\t\t\tk += ( v > w ? v : w );\n\t\t\t\tv = 0; w = 0;\n\t\t\t\tvprev = 0; wprev = 0;\n\t\t\t}\n\t\t\telse if ( a [i] == 1 )\n\t\t\t{\n\t\t\t\tif ( vprev == 1 )\n\t\t\t\t{\n\t\t\t\t\tw++; wprev = 1;\n\t\t\t\t\tvprev = 0;\n\t\t\t\t}\n\t\t\t\telse if ( vprev == 2 )\n\t\t\t\t{\n\t\t\t\t\tv++; vprev = 1;\n\t\t\t\t\twprev = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tv++; vprev = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( a [i] == 2 )\n\t\t\t{\n\t\t\t\tif ( vprev == 2 )\n\t\t\t\t{\n\t\t\t\t\tw++; wprev = 2;\n\t\t\t\t\tvprev = 0;\n\t\t\t\t}\n\t\t\t\telse if ( vprev == 1 )\n\t\t\t\t{\n\t\t\t\t\tv++; vprev = 2;\n\t\t\t\t\twprev = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tv++; vprev = 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\t// if ( a [i] == 3 )\n\t\t\t{\n\t\t\t\tif ( vprev == 1 && wprev == 0 )\n\t\t\t\t{\n\t\t\t\t\tv++; w++;\n\t\t\t\t\tvprev = 2; wprev = 1;\n\t\t\t\t}\n\t\t\t\telse if ( vprev == 2 && wprev == 1 )\n\t\t\t\t{\n\t\t\t\t\tv++; w++;\n\t\t\t\t\tvprev = 1; wprev = 2;\n\t\t\t\t}\n\t\t\t\telse if ( vprev = 2 && wprev == 0 )\n\t\t\t\t{\n\t\t\t\t\tv++; w++;\n\t\t\t\t\tv = ( v > w ? v : w ); w = 0;\n\t\t\t\t\tvprev = 1; wprev = 0;\n\t\t\t\t}\n\t\t\t\telse // if ( vprev == 0 && wprev == 0 )\n\t\t\t\t{\n\t\t\t\t\tv++; w++;\n\t\t\t\t\tvprev = 2; wprev = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( vprev < wprev )\n\t\t\t{\n\t\t\t\tSwap (ref v, ref w);\n\t\t\t\tSwap (ref vprev, ref wprev);\n\t\t\t}\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.WriteLine (\"v=\" + v + \" vprev=\" + vprev + \" w=\" + w + \" wprev=\" + wprev);\n# endif\n\t\t}\n\n\t\tk += ( v > w ? v : w );\n\t\tk = n - k;\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine ();\n\t\tsw.WriteLine (k);\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n//\t\tConsole.ReadKey ();\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8ec323f1cf6ed4f92e802f25e218e71a", "src_uid": "08f1ba79ced688958695a7cfcfdda035", "difficulty": 1400} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tsolve_547A();\n\t}\n\n\tpublic static void solve_547A()\n\t{\n\t\tstring[] tests = Console.ReadLine().Split(' ');\n\t\t\n\t\tint a = Convert.ToInt32(tests[0]);\n\t\tint b = Convert.ToInt32(tests[1]);\n\t\t\n\t\tList divs = new List();\n\t\tint div;\n\t\tif (a > b)\n\t\t{\n\t\t\tdiv = (a % b == 0) ? a / b : -1;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tdiv = (b % a == 0) ? b / a : -1;\n\t\t}\n\n\t\tif (div == 1)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\tif (div == -1)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\tif (div > 1)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (div % 2 == 0)\n\t\t\t\t{\n\t\t\t\t\tdiv /= 2;\n\t\t\t\t\tdivs.Add(2);\n\t\t\t\t}\n\t\t\t\telse if (div % 3 == 0)\n\t\t\t\t{\n\t\t\t\t\tdiv /= 3;\n\t\t\t\t\tdivs.Add(3);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (div > 3)\n\t\t\t\t\t{\n\t\t\t\t\t\tdivs.Clear();\n\t\t\t\t\t\tdivs.Add(-1);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (divs.Count == 1 && divs[0] == -1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t\t\n\t\t\tif (divs.Count > 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(divs.Count);\n\t\t\t}\n\t\t}\n\t}\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d7da72c81bd874617ed926b883d03f54", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Startup\n{\n static void Main()\n {\n int[] intInput = ReadLineAndParseToArray();\n int n = intInput[0];\n int nTemp = n;\n int m = intInput[1];\n\n\n if(n == m) { Console.WriteLine($\"0\"); return; }\n if((m % 2*n != 0 || m < 2*n ) && ( m % 3*n != 0 || m < 3*n) && ( m % 6*n != 0 || m < 6*n)) { Console.WriteLine(\"-1\"); return; }\n\n \n int counter2 = 0;\n int counter3 = 0;\n while(nTemp % 2 == 0) { nTemp /= 2; counter2++; }\n while(nTemp % 3 == 0) { nTemp /= 3; counter3++; }\n \n int counter22 = 0;\n int counter33 = 0;\n while(m % 2 == 0 ) { m /= 2; counter22++; }\n while(m % 3 == 0) { m /= 3; counter33++; }\n counter22 -= counter2;\n counter33 -= counter3;\n for(int i = 0; i < counter22; i++){\n n *= 2;\n }\n for(int i = 0 ; i < counter33; i++){\n n *= 3;\n }\n if(n != m) { Console.WriteLine(\"-1\"); return; } \n counter = counter22 + counter33 - counter2 - counter3;\n Console.WriteLine($\"{counter}\");\n \n }\n\n static int[] ReadLineAndParseToArray()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToArray();\n }\n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6fbbfb3e9f4355e4b8fc216ae7dfd44b", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\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 (n, l, r) = input.Read3Int();\n long s(int k) => Enumerable.Range(0, k).Select(i => 1L << i).Sum();\n var s1 = s(l) + n - l;\n var s2 = s(r) + (1L << (r - 1)) * (n - r);\n Write(s1 + \" \" + s2);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fda52302dabf5de156581a6ee72b9621", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "difficulty": 900} {"lang": "Mono C#", "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 private static void chmin(ref T num, T val) where T : IComparable\n => num = num.CompareTo(val) == 1 ? val : num;\n private static void chmax(ref T num, T val) where T : IComparable\n => num = num.CompareTo(val) == -1 ? val : num;\n private 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 pr = new Program();\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n Console.SetOut(sw);\n pr.Solve();\n Console.Out.Flush();\n }\n void Solve()\n {\n int n, l, r;\n Input.Make(out n, out l, out r);\n var min = n - l + 1;\n var c = 1;\n for(var i=1;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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d55b9da85d77640208e318c18c278fa3", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "difficulty": 900} {"lang": "Mono C#", "source_code": "public static void FindAVG(int num)\n {\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0a7be818bceed39269e08f7976b2c558", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000} {"lang": "Mono C#", "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 Program p = new Program();\n Console.WriteLine(p.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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4bbb8fbc4e3274d2e18d833040cec692", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000} {"lang": "Mono C#", "source_code": "class 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e8bcabff5cc2847d96e9a410d120e220", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nclass Program{\n static void Main(){\n var n = Int32.Parse(Console.ReadLine());\n Console.WriteLine((long)Math.Pow(2, n / 2))\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "855588022920688ff3a3c74d73ad6637", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace _630C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int numberOfCabinets = 0;\n\n if (n == 1) \n {\n numberOfCabinets = 2; \n }\n else\n {\n for (int i = 0; i < n; i++)\n {\n numberOfCabinets += (int)MathF.Pow(2f, i + 1);\n }\n }\n\n Console.WriteLine(numberOfCabinets);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e5c65e4f0dced90b6cbb79942c259535", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace _630C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n float numberOfCabinets = 0;\n\n for (float i = 0; i < n; i++)\n {\n numberOfCabinets += MathF.Pow(2f, i + 1);\n }\n\n Console.WriteLine(numberOfCabinets);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fd53a86555ec901529419d8d1142891d", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100} {"lang": "MS C#", "source_code": "using System;\nclass Program{\n public static void Main(string[] args){\n int n = int.Parse(Console.ReadLine());\n int res = 2;\n for(int i = 2; i <= n; i++)\n res += Math.Pow(2,i);\n Console.WriteLine(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "73b4dbe96befea588815c79505f6690f", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100} {"lang": "Mono C#", "source_code": "using System; \nusing System.Collections.Generic; \nusing System.Diagnostics; \nusing System.IO; \nusing System.Linq; \n\nnamespace codeforces \n{ \nclass Program \n{ \n\nstatic void Main(string[] args) \n{ \n n = Convert.ToDouble(Console.ReadLine()); \ndecimal value = 1; \nfor (int i = 0; i <= n; i++) \n{ \nvalue *= 2; \n} \nvalue -= 2; \nConsole.WriteLine(value); \n} \n} \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "62d74451663153ea9688333f4f78d914", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace _630C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n float numberOfCabinets = 0;\n\n if (n == 1) \n {\n numberOfCabinets = 2; \n }\n else\n {\n for (int i = 0; i < n; i++)\n {\n numberOfCabinets += MathF.Pow(2f, i + 1);\n }\n }\n\n Console.WriteLine(numberOfCabinets);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3f8147d7a2a24e08cff7d4ec7ac306f6", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100} {"lang": "MS C#", "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 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 int p = ReadInt();\n int x = ReadInt();\n int y = ReadInt();\n int mint = y;\n while (mint % 50 != x % 50)\n {\n mint++;\n }\n while (mint < x)\n {\n if (Able(getMest(mint), p))\n {\n sw.WriteLine(0);\n return;\n }\n mint += 50;\n }\n for (int i = 0; i < 100000; i++)\n {\n if (i==0)\n {\n if (Able(getmest(mint), p))\n {\n sw.WriteLine(i);\n return;\n }\n }\n else\n {\n if (Able(getMest(mint), p) || Able(getMest(mint - 50), p))\n {\n sw.WriteLine(i);\n return;\n }\n }\n mint += 100;\n }\n }\n\n static bool Able(int[] a, int b)\n {\n foreach (int i in a)\n {\n if (i == b)\n {\n return true;\n }\n }\n return false;\n }\n\n static int[] getMest(int s)\n {\n int[] a = new int[25];\n int i = (s / 50) % 475;\n for (int j = 0; j < 25; j++)\n {\n i = (i * 96 + 42) % 475;\n a[j] = i + 26;\n }\n return a;\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 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 private 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 temp[a[i] - 1]++;\n temp[b[i] - 1]++;\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 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 }\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "854d812fe293a16891237e34281d7949", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "difficulty": 1300} {"lang": "MS C#", "source_code": "return 25;\n\t\t\t", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e8a16d652cac0b1b20b398f5e38575d9", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800} {"lang": "MS C#", "source_code": "public class AgainTwentyFive630A\n{\n public static void Main(String[] args)\n {\n Console.ReadLine();\n Console.WriteLine(\"25\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "06c41631238ada8b93504faa62a6c99e", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800} {"lang": "Mono C#", "source_code": "int n= 0;\nfunction square (){\nconsole.writeLine(\"Plesae enter the Input number\");\nn = console.ReadLine();\nfor(int i =0;i();\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 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dd97b87de57db7ab3593bc15ecc9f172", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800} {"lang": "MS C#", "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(string[] args)\n {\n long long int n;\n n = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(\"25\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2570d32a757241ca9d0aaf1f8dd21ce8", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800} {"lang": "Mono C#", "source_code": "int n= 0;\nfunction square (){\nconsole.writeLine(\"Plesae enter the Input number\");\nn = console.ReadLine();\nfor(int i =0;i karta = new List(); List itogi = new List();\n string stroka = \"\"; ; string konec = \"\"; int a = 2; int itog = 0; int kol = 0; int dnei = 0; long y = 1; long minut = 0; string konec2 = \"\"; long[] strochenka = { 0, 0 }; List str = new List();\n konec = Console.ReadLine(); \n string[] split = konec.Split(new Char[] { ' ' });\n foreach (string s in split)\n {\n karta.Add(Convert.ToInt32(s));\n }\n karta.Sort();\n itog = karta.Sum();\n dnei = karta.Sum();\n foreach (int e in karta)\n {\n foreach (int t in karta)\n {\n if (t == e)\n {\n a--;\n if(a>=0)\n itog -= t;\n }\n }\n if(a<1)\n itogi.Add(itog);\n a = 2;\n itog = karta.Sum();\n \n }\n if (itogi.Count > 0)\n dnei = itogi.Min();\n Console.WriteLine(dnei);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c6066f46b9c20a563173817d6b2f5298", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.24720.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication1\", \"ConsoleApplication1\\ConsoleApplication1.csproj\", \"{CDB32670-23CF-4D55-8B01-E9508F2B3E5F}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{CDB32670-23CF-4D55-8B01-E9508F2B3E5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{CDB32670-23CF-4D55-8B01-E9508F2B3E5F}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{CDB32670-23CF-4D55-8B01-E9508F2B3E5F}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{CDB32670-23CF-4D55-8B01-E9508F2B3E5F}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1440507a9736d835f0b76aa92931db95", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass A680 {\n public static void Main() {\n var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n var b = new Dictionary();\n foreach (var i in a) {\n b.TryGetValue(i, out int v);\n b[i] = v + 1;\n }\n int max = 0;\n foreach (var i in b)\n if (2 <= i.Value) \n max = Math.Max(max, Math.Min(i.Value, 3) * i.Key);\n Console.WriteLine(a.Sum() - max);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7c92f7ab91ed5a46afcf2904d8601a50", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7b22f7d0664b378dc90306c9e6c2b930", "src_uid": "2222ce16926fdc697384add731819f75", "difficulty": 1500} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f98957c1257b8d5379072f3d6da51d6d", "src_uid": "2222ce16926fdc697384add731819f75", "difficulty": 1500} {"lang": "MS C#", "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\tprivate 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\tprivate 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3662f62eff376e639102cab0c94b52d7", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800} {"lang": "MS C#", "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\tConsole.WriteLine(BigInteger.ModPow(2, (new BigInteger(nmk[0].ToCharArray()) - 1) * (new BigInteger(nmk[1].ToCharArray()) - 1), 1000000007));\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b92a05f3b8f8b62d572dd24f32a85be", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800} {"lang": "MS C#", "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, m, prod) = (ulong.Parse(input[0]), ulong.Parse(input[1]), 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0ff21baec2b8eb23de040568ea5aa410", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800} {"lang": "MS C#", "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\tlong 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\tlong 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c342f9ece55430076be9b71da1918b47", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800} {"lang": "MS C#", "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 if (!a) Console.WriteLine(\"-1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f96d519924d2bdacce59b7543f36b204", "src_uid": "6c1ad1cc1fbecff69be37b1709a5236d", "difficulty": 1100} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace FINDBESTHOUSE\n{\n class Program\n {\n static void Main(string[] args)\n {\n int result = 0;\n string GetInfo = \"\";\n GetInfo = Console.Read();\n string[] SplitedInfo = GetInfo.Split(' ');\n int AmoutofHouse = Convert.ToInt32(SplitedInfo[0]);\n int GFLocation = Convert.ToInt32(SplitedInfo[1]) - 1;\n int YourMoney = Convert.ToInt32(SplitedInfo[2]);\n int[] Finding = new int[AmoutofHouse];\n for (var j = 0; j < AmoutofHouse; j++)\n {\n int test = Convert.ToInt32(SplitedInfo[3 + j]);\n if (test == 0)\n {\n Finding[j] = 0;\n }\n else if (YourMoney > test)\n {\n Finding[j] = 1;\n }\n else\n {\n Finding[j] = 0;\n }\n }\n int Checker = 1;\n int get1 = 1, get2 = 1;\n int i = 0;\n do\n {\n i++;\n try\n {\n if (Finding[GFLocation - i] == 0)\n {\n continue;\n }\n else if (Finding[GFLocation - i] == 1)\n {\n get1 = i;\n break;\n }\n else\n {\n get1 = 0;\n }\n }\n catch\n {\n get1 = 0;\n break;\n }\n }\n while (Checker == 1);\n Checker = 1;\n i = 0;\n do\n {\n i++;\n try\n {\n if (Finding[GFLocation + i] == 0)\n {\n continue;\n }\n else if (Finding[GFLocation + i] == 1)\n {\n get2 = i;\n break;\n }\n else\n {\n get2 = 0;\n }\n }\n catch\n {\n get2 = 0;\n break;\n }\n }\n while (Checker == 1);\n if (get1 == 0)\n {\n result = get2;\n }\n else if (get2 == 0)\n {\n result = get1;\n }\n else\n {\n result = get1 > get2 ? get2 : get1;\n }\n Console.WriteLine(result * 10);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cdb096847a038a92b54194b18c42666a", "src_uid": "57860e9a5342a29257ce506063d37624", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nnamespace FINDBESTHOUSE\n{\n class Program\n {\n //static string Inputpath = @\"C:\\Users\\PC\\Desktop\\InfoHouse.txt\";\n static void Main(string[] args)\n {\n int result = 0;\n string GetInfo = File.ReadAllText(Inputpath);\n string[] SplitedInfo = GetInfo.Split(' ');\n int AmoutofHouse = Convert.ToInt32(SplitedInfo[0]);\n int GFLocation = Convert.ToInt32(SplitedInfo[1]) - 1;\n int YourMoney = Convert.ToInt32(SplitedInfo[2]);\n int[] Finding = new int[AmoutofHouse];\n for (var j = 0; j < AmoutofHouse ; j++)\n {\n int test = Convert.ToInt32(SplitedInfo[3 + j]);\n if (test == 0)\n {\n Finding[j] = 0;\n }\n else if (YourMoney > test)\n {\n Finding[j] = 1;\n }\n else\n {\n Finding[j] = 0;\n }\n }\n int Checker = 1;\n int get1 = 1, get2 = 1;\n int i = 0;\n do\n {\n i++;\n try\n {\n if (Finding[GFLocation - i] == 0)\n {\n continue;\n }\n else if (Finding[GFLocation - i] == 1)\n {\n get1 = i;\n break;\n }\n else\n {\n get1 = 0;\n }\n }\n catch\n {\n get1 = 0;\n break;\n }\n }\n while (Checker == 1);\n Checker = 1;\n i = 0;\n do\n {\n i++;\n try\n {\n if (Finding[GFLocation + i] == 0)\n {\n continue;\n }\n else if (Finding[GFLocation + i] == 1)\n {\n get2 = i;\n break;\n }\n else\n {\n get2 = 0;\n }\n }\n catch\n {\n get2 = 0;\n break;\n }\n }\n while (Checker == 1);\n if (get1 == 0)\n {\n result = get2;\n }\n else if (get2 == 0)\n {\n result = get1;\n }\n else\n {\n result = get1 > get2 ? get2 : get1;\n }\n Console.WriteLine(result * 10);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bf7ab7736426693ac177c6e74b9b8af0", "src_uid": "57860e9a5342a29257ce506063d37624", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace FINDBESTHOUSE\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] SplitedInfo = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n int AmoutofHouse = SplitedInfo[0];\n int GFLocation = SplitedInfo[1] - 1;\n int YourMoney = SplitedInfo[2];\n int[] Finding = new int[AmoutofHouse];\n for (var j = 0; j < AmoutofHouse; j++)\n {\n int test = SplitedInfo[3 + j];\n if (test == 0)\n {\n Finding[j] = 0;\n }\n else if (YourMoney > test)\n {\n Finding[j] = 1;\n }\n else\n {\n Finding[j] = 0;\n }\n }\n int Checker = 1;\n int get1 = 1, get2 = 1;\n int i = 0;\n do\n {\n i++;\n try\n {\n if (Finding[GFLocation - i] == 0)\n {\n continue;\n }\n else if (Finding[GFLocation - i] == 1)\n {\n get1 = i;\n break;\n }\n else\n {\n get1 = 0;\n }\n }\n catch\n {\n get1 = 0;\n break;\n }\n }\n while (Checker == 1);\n Checker = 1;\n i = 0;\n do\n {\n i++;\n try\n {\n if (Finding[GFLocation + i] == 0)\n {\n continue;\n }\n else if (Finding[GFLocation + i] == 1)\n {\n get2 = i;\n break;\n }\n else\n {\n get2 = 0;\n }\n }\n catch\n {\n get2 = 0;\n break;\n }\n }\n int result = 0;\n while (Checker == 1);\n if (get1 == 0)\n {\n result = get2;\n }\n else if (get2 == 0)\n {\n result = get1;\n }\n else\n {\n result = get1 > get2 ? get2 : get1;\n }\n Console.WriteLine(result * 10);\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e2f915db1105fb02bdb28bc15ff20f9a", "src_uid": "57860e9a5342a29257ce506063d37624", "difficulty": 800} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "17b4db5aec3fc5baf53afd23a551e53e", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600} {"lang": "Mono C#", "source_code": "static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int i = 2;\n int f = n;\n int c = 1;\n int l = n;\n\n while (f > 1) {\n f = (n - n % i) / i;\n if (l != f)\n {\n l = f;\n c++;\n }\n i++;\n }\n\n Console.WriteLine(c);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b3e2233ac5fa8b2d926119cd68d9716b", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800} {"lang": "Mono C#", "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 > 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c3caea178183ec4391fd74750867ab26", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace ajaira\n{\n class Main\n {\n static bool AllDiff(int n)\n {\n int []ar = new int[10];\n\n while (n > 0)\n {\n if (ar[n % 10] != 0)\n return false;\n ar[n % 10]++;\n n /= 10;\n }\n\n return true;\n }\n\n static void Main(string[] args)\n {\n int l, r;\n string line = Console.ReadLine();\n string[] inputs = line.Split();\n l = int.Parse(inputs[0]);\n r = int.Parse(inputs[1]);\n\n for (int i = l; i <= r; i++)\n {\n if (AllDiff(i))\n {\n Console.WriteLine(i);\n return;\n }\n }\n\n Console.WriteLine(-1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c0e9251f49aa0a3bc027e2966ae6560e", "src_uid": "3041b1240e59341ad9ec9ac823e57dd7", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace DistincDigitsA\n{\n class Program\n {\n public static bool NumContainsDuplicates(int num)\n {\n var strNum = num.ToString();\n var nums = new HashSet();\n\n foreach (var cc in strNum)\n {\n if (nums.Contains(cc))\n {\n return true;\n }\n else\n {\n nums.Add(cc);\n }\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n var Ints = Array.ConvertAll(Console.ReadLine().Split(\" \"), int.Parse);\n\n for (int atNum = Ints[0]; atNum < Ints[1]; atNum++)\n {\n if (!NumContainsDuplicates(atNum))\n {\n Console.WriteLine(atNum);\n Environment.Exit(0);\n }\n }\n\n Console.WriteLine(\"-1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "847388bf5e02c11f50b35a4913f376c7", "src_uid": "3041b1240e59341ad9ec9ac823e57dd7", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Net.Http.Headers;\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 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 Console.ReadLine();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b21e866740ba28187d0a18da0c1e516c", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Net.Http;\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 if (yes == false)\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "156d5daf13e1ae18a1122d4fe2a845fb", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CodeForces_1097A_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string drop = Console.ReadLine();\n string hand = Console.ReadLine();\n if(hand.Contains(drop[0]) | hand.Contains(drop[1]))\n {\n Console.WriteLine(\"YES\");\n }\n else { Console.WriteLine(\"NO\"); }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "44f41c71db7eb985508909db1d355f6c", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800} {"lang": "Mono C#", "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]) || ss.Contains(s[1]) ? \"YES\" : \"NO\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ef98b72acac73aa0743fd8e44d8069a5", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Net.Http;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "490ca702ffbaf184bef84fb275ad2c3a", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800} {"lang": "Mono C#", "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]) || hand[i].Contains(table[1]))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n }\n\n Console.WriteLine(\"NO\");\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3c2f4e143b7c611c0c67aa1d52a13c5c", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CF_1097A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string values = Console.ReadLine();\n\n int flag = 0;\n\n for(int i=0; i 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 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\n\n \n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "94398603271cd86d1a52cff09662d413", "src_uid": "af07223819aeb5bd6ded4340c472b2b6", "difficulty": 1000} {"lang": "Mono C#", "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] < n2)\n {\n prev = 0;\n sum += n[1];\n }\n else{ prev = 1; sum += n[2];}\n }\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b40bb7d245f6825771de85ecf2c4b1cf", "src_uid": "af07223819aeb5bd6ded4340c472b2b6", "difficulty": 1000} {"lang": "MS C#", "source_code": "using Newtonsoft.Json;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7ab043e1d0c73dabc63c217173d862a4", "src_uid": "912c8f557a976bdedda728ba9f916c95", "difficulty": 1400} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Speech.Synthesis;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace Grade\n{\n class Program\n {\n /* Driver program to test above functions */\n public static void Main(String[] args)\n {\n var games = int.Parse(Console.ReadLine());\n\n if (games <= 1)\n {\n Console.WriteLine(true);\n return;\n }\n\n var queue = new Queue();\n var winning = int.Parse(Console.ReadLine());\n queue.Enqueue(3);\n queue.Enqueue(3 - winning);\n \n while (--games > 0)\n {\n var challenger = queue.Dequeue();\n var number = int.Parse(Console.ReadLine());\n if (number == challenger)\n {\n queue.Enqueue(winning);\n winning = challenger;\n } else if(number == winning) {\n queue.Enqueue(challenger);\n } else {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n\n static List factorize(int n)\n {\n var res = new List();\n for (int i = 2; i * i <= n; ++i)\n {\n while (n % i != 0)\n {\n res.Add(i);\n n /= i;\n }\n }\n return res;\n }\n\n // 3^10 - x = 3, n = 10, result = 1\n // x = 3*3 = 9, n = 10/2 = 5, result = 1\n // n is now odd, result = 1*9 = 9, x = 9*9 = 81, n = 5/2 = 2\n // x = 81*81 = 6561, n = 2/1 = 1, result = 9\n // n is now odd, result = 9 * 6561 = 59049, x = 6561*6561, n = 0\n // return result aka 59049\n public static double pow(double x, int n) // O(log N)\n {\n double result = 1;\n while (n > 0)\n {\n if (n % 2 == 1) result *= x;\n x *= x;\n n /= 2;\n }\n return result;\n }\n\n // a = 16, b = 10\n // r = 16%10 = 6, a = 10, b = 6\n // r = 10%6 = 4, a = 6, b = 4\n // r = 6%4 = 2, a = 4, b = 2\n // r = 4%2 = 0, a = 2, b = 0\n // return 0\n public static int gcd(int a, int b) // O(log A+B)\n {\n while (b > 0)\n {\n int r = a % b;\n a = b;\n b = r;\n }\n return a;\n }\n\n public static double Fib(int n)\n {\n return 1 / Math.Sqrt(5) * (Math.Pow(((1 + Math.Sqrt(5)) / 2), n) - Math.Pow(((1 - Math.Sqrt(5)) / 2), n));\n }\n\n\n public static bool isPrime(int n) // O(log N)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b193a781d1a2f0621e2eef921923c53", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\n public class Program\n {\n public static void Main(string[] args)\n {\n int[] aClassCounter, bClassCounter;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { '\\r', '\\n', ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n aClassCounter = new int[6];\n bClassCounter = new int[6];\n for(int i = 1, j = int.Parse(input[0])+1; jbClassCounter[i])\n {\n if ((aClassCounter[i] - bClassCounter[i]) % 2 == 0)\n aClassCounter[0] += (aClassCounter[i] - bClassCounter[i]) / 2;\n else { aClassCounter[0]=-1; break; }\n }\n else\n {\n if ((bClassCounter[i] - aClassCounter[i]) % 2 ==1)\n { aClassCounter[0] = -1; break;}\n }\n }\n Console.WriteLine(aClassCounter[0]);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a846c1d029525d82dfd6b00122ec5807", "src_uid": "47da1dd95cd015acb8c7fd6ae5ec22a3", "difficulty": 1000} {"lang": "Mono C#", "source_code": "public static int[] RemoveDuplicates(int size, int[] inputArr)\n {\n Dictionary dict = new Dictionary();\n HashSet hsh = new HashSet();\n List outputList = new List();\n for(int i=0;i 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cdbe9ea5651ad249eed14b37e1c7d098", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800} {"lang": "Mono C#", "source_code": "\n#include\nusing namespace std;\n\nint main() {\n cin.sync_with_stdio(false);\n int n, num[N];\n while (cin >> n) {\n for (int i = 0; i < n; i++) {\n cin >> num[i];\n }\n if (num[0] % 2 == 1 && num[n - 1] % 2 == 1 && n % 2 == 1) {\n cout << \"YES\" << endl;\n }\n else {\n cout << \"NO\" << endl;\n }\n }\n return 0;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "548ba7049175f0228a28529492a87345", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {05C93F62-5FEB-405E-A6A6-8DA166CFDD88}\n Exe\n Properties\n \u0418\u0433\u0440\u0443\u0448\u0435\u0447\u043d\u044b\u0435_\u0430\u0440\u043c\u0438\u0438\n \u0418\u0433\u0440\u0443\u0448\u0435\u0447\u043d\u044b\u0435 \u0430\u0440\u043c\u0438\u0438\n v4.0\n Client\n 512\n \n \n x86\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n x86\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2587d3c85ad49bd6c13b4420c3111659", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace soldier_games\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 killed = 0;\n //int i, j, k = 0;\n\n //for (i = 1; i <= n/2; i++)\n //{\n // killed += i;\n // for (j = 1; j <= n - i; j++)\n // {\n // killed += j;\n // for (k = 1; k <= n - j && k <= n - i; k++)\n // {\n\n // killed += k;\n // if (killed > max)\n // {\n // max = killed;\n // }\n // killed -= k;\n // }\n // killed -= j;\n // }\n // killed -= i;\n }\n Console.WriteLine(n/2*3);\n }\n }\n}\n// static int getmax(int n)\n// {\n// int max = 0;\n// int killed = 0;\n// int i, j, k = 0;\n\n// for ( i = 1; i <=n; i++)\n// {\n// killed += i;\n// for ( j = 1; j <= n - i ; j++)\n// {\n// killed += j;\n// for ( k = 1; k <= n - j &&k<=n-i ; k++)\n// {\n \n// killed += k;\n// if (killed > max)\n// {\n// max = killed;\n// }\n// killed -= k;\n// }\n// killed -= j;\n// }\n// killed -=i ; \n// }\n// return max;\n// }\n\n// }\n//}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "22f9accd9f959442da66008fdc5d1d3d", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900} {"lang": "MS C#", "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 ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine(); // boje papira na nakitu\n int br = 0;\n int brr = 0;\n string sm = string.Format(\"{0:00}\", s.Substring(s.Length - 2));\n string sh = string.Format(\"{0:00}\", s.Substring(0,2));\n\n for (int i = Int32.Parse(sh, NumberStyles.Any); i < 24; i++)\n {\n \n brr++;\n if (brr > 1)\n sm = \"00\";\n \n var h = string.Format(\"{0:00}\", i);\n for (int j = Int32.Parse(sm, NumberStyles.Any); j < 60; j++)\n {\n var m = string.Format(\"{0:00}\", j);\n char[] arr = h.ToCharArray();\n char[] arr1 = m.ToCharArray();\n Array.Reverse(arr);\n br++;\n string s0 = new string(arr);\n string s1 = new string(arr1);\n if (i == 23)\n {\n i= -1;\n }\n if (s0 == s1)\n {\n Console.WriteLine(br-1);\n goto Foo;\n }\n\n }\n }\n\n Foo:\n\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cc149720d70b857f5fb6a5a25c80f701", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000} {"lang": "MS C#", "source_code": "class Program\n {\n\n private static Dictionary> Dick = new Dictionary>\n {\n { 'U',U },\n { 'D',D },\n { 'L',L },\n { 'R',R },\n };\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var coord = new Coord(0, 0);\n\n for (int i = 0; i < input.Length; i++)\n {\n Dick.TryGetValue(input[i], out Action action);\n\n action.Invoke(coord);\n }\n\n Console.WriteLine(coord.GetModeul());\n }\n\n private static void U(Coord cord)\n {\n cord.y += 1;\n }\n private static void D(Coord cord)\n {\n cord.y -= 1;\n }\n private static void L(Coord cord)\n {\n cord.x -= 1;\n }\n private static void R(Coord cord)\n {\n cord.x += 1;\n }\n\n public class Coord\n {\n public int x { get; set; }\n public int y { get; set; }\n\n public Coord(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\npublic int GetModeul()\n {\n return Math.Abs(x + y);\n }\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ca1f625a8c74ce34791f900bc5d8859f", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n {\n\n private static Dictionary> Dick = new Dictionary>\n {\n { 'U',U },\n { 'D',D },\n { 'L',L },\n { 'R',R },\n };\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var coord = new Coord(0, 0);\n\n for (int i = 0; i < input.Length; i++)\n {\n Dick.TryGetValue(input[i], out Action action);\n\n action.Invoke(coord);\n }\n\n Console.WriteLine(coord.GetModeul());\n }\n\n private static void U(Coord cord)\n {\n cord.y += 1;\n }\n private static void D(Coord cord)\n {\n cord.y -= 1;\n }\n private static void L(Coord cord)\n {\n cord.x -= 1;\n }\n private static void R(Coord cord)\n {\n cord.x += 1;\n }\n\n public class Coord\n {\n public int x { get; set; }\n public int y { get; set; }\n\n public Coord(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\npublic int GetModeul()\n {\n return Math.Abs(x + y);\n }\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e1f9573c25366ed4bc8d67e0224f0b10", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n {\n\n private static Dictionary> Dick = new Dictionary>\n {\n { 'U',U },\n { 'D',D },\n { 'L',L },\n { 'R',R },\n };\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var coord = new Coord(0, 0);\n\n for (int i = 0; i < input.Length; i++)\n {\n Dick.TryGetValue(input[i], out Action action);\n\n action.Invoke(coord);\n }\n\n Console.WriteLine(coord.GetModeul());\n }\n\n private static void U(Coord cord)\n {\n cord.y += 1;\n }\n private static void D(Coord cord)\n {\n cord.y -= 1;\n }\n private static void L(Coord cord)\n {\n cord.x -= 1;\n }\n private static void R(Coord cord)\n {\n cord.x += 1;\n }\n\n class Coord\n {\n public int x { get; set; }\n public int y { get; set; }\n\n public Coord(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\npublic int GetModeul()\n {\n return Math.Abs(x + y);\n }\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4fa192887a0e43bbc1347ca5c175dec8", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000} {"lang": "MS C#", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n \nusing namespace std;\n \n#define SZ(x) (int) (x).size()\n\nconst int INF = (int) 1e9;\n\nint ans = INF;\nint n, xs, ys;\nbool used[30];\nint x[30], y[30];\nint dp[(1 << 25)], t[30];\npair parent[(1 << 25)];\n\nint dist(int _x1, int _y1, int _x2, int _y2)\n{\n\treturn (_x1 - _x2) * (_x1 - _x2) + (_y1 - _y2) * (_y1 - _y2);\n}\n\nint solve(int mask, int len)\n{\n\n\n\tif (len == n)\n\t\treturn 0;\n\tif (dp[mask] != -1)\n\t\treturn dp[mask];\n\tdp[mask] = INF;\n\tfor (int i = 0; i < n; ++i)\n\t\tif ((mask | t[i]) != mask)\n\t\t{\n\t\t\tint cur = solve(mask | t[i], len + 1) + 2 * dist(xs, ys, x[i], y[i]);\n\t\t\tif (dp[mask] > cur)\n\t\t\t{\n\t\t\t\tdp[mask] = cur;\n\t\t\t\tparent[mask].first = i;\n\t\t\t\tparent[mask].second = i;\n\t\t\t}\n\t\t\n\t\t\tfor (int j = i + 1; j < n; ++j)\n\t\t\t\tif ((mask | t[j]) != mask)\n\t\t\t\t{\n\t\t\t\t\tint d = dist(xs, ys, x[i], y[i]) + dist(x[i], y[i], x[j], y[j]) + dist(xs, ys, x[j], y[j]);\n\t\t\t\t\tint cur = solve(mask | t[i] | t[j], len + 2) + d;\n\t\t\t\t\tif (dp[mask] > cur)\n\t\t\t\t\t{\n\t\t\t\t\t\tdp[mask] = cur;\n\t\t\t\t\t\tparent[mask].first = i;\n\t\t\t\t\t\tparent[mask].second = j;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t}\n\treturn dp[mask];\n}\n\t\t\t\n\n\n\n\n\nint main()\n{\n\tscanf(\"%d%d%d\", &xs, &ys, &n);\n\tfor (int i = 0; i < n; ++i)\n\t\tscanf(\"%d%d\", &x[i], &y[i]);\n\tt[0] = 1;\n\tfor (int i = 1; i < 30; ++i)\n\t\tt[i] = t[i - 1] * 2;\n\tmemset(dp, -1, sizeof(dp));\n\tcout << solve(0, 0) << endl;\n\tint mask = 0;\n\tint len = 0;\n\twhile (len < n)\n\t{\n\t\tint i = parent[mask].first + 1;\n\t\tint j = parent[mask].second + 1;\n\t\tlen++;\n\t\tprintf(\"0 %d \", i);\n\t\tif (i != j)\n\t\t{\n\t\t\tlen++;\n\t\t\tprintf(\"%d \", j);\n\t\t}\n\t\tmask = (mask | t[i - 1] | t[j - 1]);\n\t}\n\n\t\n\treturn 0;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "42f145f4aa4f1ce77d6d133248618af5", "src_uid": "2ecbac20dc5f4060bc873553946281bc", "difficulty": 2000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Codeforces_Round_476\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k, n, s, p;\n var varsArr = Console.ReadLine().Split(\" \");\n k = int.Parse(varsArr[0]);\n n = int.Parse(varsArr[1]);\n s = int.Parse(varsArr[2]);\n p = int.Parse(varsArr[3]);\n //Console.WriteLine(\"{0} {1} {2} {3}\", k, n, s, p);\n var listsNeeded = ListsNeeded(k, n, s);\n var packsNeeded = PacksNeeded(listsNeeded, p);\n Console.WriteLine(packsNeeded);\n }\n\n static int ListsNeeded(int k, int n, int s)\n {\n var oneManNeedLists = n / s + (n % s != 0 ? 1 : 0);\n var allMensNeedLists = oneManNeedLists * k;\n return allMensNeedLists;\n }\n\n static int PacksNeeded(int listsNeeded, int p)\n {\n var packsNeeded = listsNeeded / p;\n if (listsNeeded % p != 0) packsNeeded++;\n return packsNeeded;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "39e4bd2e97b9a6c18c80a752ddc6102a", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Codeforces_Round_476\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k, n, s, p;\n var varsArr = Console.ReadLine().Split(\" \");\n k = int.Parse(varsArr[0]);\n n = int.Parse(varsArr[1]);\n s = int.Parse(varsArr[2]);\n p = int.Parse(varsArr[3]);\n //Console.WriteLine(\"{0} {1} {2} {3}\", k, n, s, p);\n var listsNeeded = ListsNeeded(k, n, s);\n var packsNeeded = PacksNeeded(listsNeeded, p);\n Console.WriteLine(packsNeeded);\n }\n\n static int ListsNeeded(int k, int n, int s)\n {\n var oneManNeedLists = n / s + (n % s != 0 ? 1 : 0);\n var allMensNeedLists = oneManNeedLists * k;\n return allMensNeedLists;\n }\n\n static int PacksNeeded(int listsNeeded, int p)\n {\n var packsNeeded = listsNeeded / p;\n if (listsNeeded % p != 0) packsNeeded++;\n return packsNeeded;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f0a72f1f1a94e92bed0d0b9cc6eb0902", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(\" \");\n foreach(string i in input)\n {\n Console.WriteLine(i);\n }\n int numPeople = Convert.ToInt32(input[0]);\n int airplanesPerPerson = Convert.ToInt32(input[1]);\n int airplanesFromSheet = Convert.ToInt32(input[2]);\n int sheetsInPack = Convert.ToInt32(input[3]);\n\n int sheets;\n if(airplanesPerPerson % airplanesFromSheet == 0)\n {\n sheets = airplanesPerPerson / airplanesFromSheet;\n }\n else\n {\n sheets = airplanesPerPerson / airplanesFromSheet + 1;\n }\n\n sheets *= numPeople;\n\n if (sheets % sheetsInPack == 0)\n {\n Console.WriteLine(sheets / sheetsInPack);\n }\n else\n {\n Console.WriteLine(sheets / sheetsInPack + 1);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "222a9384fc54e581a481fcdfc8ec3afe", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing Number = System.Int64;\nusing System.Numerics;\nusing static System.Math;\nnamespace Program {\n public class Solver {\n Random rnd = new Random ();\n public void Solve () {\n\n var k = rl;\n var n = rl;\n var s = rl;\n var p = rl;\n\n var X = (n + s - 1) / s;\n var Y = (X * k + p - 1) / p;\n Console.WriteLine (Y);\n }\n const long INF = 1L << 60;\n //static int[] dx = { -1, 0, 1, 0 };\n //static int[] dy = { 0, 1, 0, -1 };\n\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 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#region main\nstatic class Ex {\n static public string AsString (this IEnumerable ie) { return new string (ie.ToArray ()); }\n static public string AsJoinedString (this IEnumerable ie, string st = \" \") {\n return string.Join (st, ie);\n }\n static public void Main () {\n Console.SetOut (new Program.IO.Printer (Console.OpenStandardOutput ()) { AutoFlush = false });\n var solver = new Program.Solver ();\n try {\n solver.Solve ();\n Console.Out.Flush ();\n } catch { }\n }\n}\n#endregion\n#region Ex", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3dac071879e8f27cc5f6fbc29829a9ea", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800} {"lang": "Mono C#", "source_code": "using Snowball;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Trees;\n\nnamespace Runner\n{\n class Program\n {\n static void Main(string[] args)\n {\n //AVLTree avlTree = new AVLTree(97,\n // new AVLTree(49,\n // new AVLTree(37),\n // new AVLTree(81)),\n // new AVLTree(917));\n\n //avlTree.Traverse();\n\n string[] firstLineArgs = Console.ReadLine().Split(new char[] { ' ' });\n string[] secondLineArgs = Console.ReadLine().Split(new char[] { ' ' });\n string[] thirdLineArgs = Console.ReadLine().Split(new char[] { ' ' });\n\n int w = int.Parse(firstLineArgs[0]);\n int h = int.Parse(firstLineArgs[1]);\n\n int u1 = int.Parse(secondLineArgs[0]);\n int d1 = int.Parse(secondLineArgs[1]);\n\n int u2 = int.Parse(thirdLineArgs[0]);\n int d2 = int.Parse(thirdLineArgs[1]);\n\n if (d1 == d2)\n {\n throw new Exception();\n }\n\n Console.WriteLine(PushSnowball(w, h, u1, d1, u2, d2));\n\n\n }\n\n public static int PushSnowball(int w, int h, int u1, int d1, int u2, int d2)\n {\n int snowballSize = w;\n\n for (int i = h; i > 0; i--)\n {\n snowballSize += i;\n\n if (i == d1)\n {\n snowballSize -= u1;\n }\n else if (i == d2)\n {\n snowballSize -= u2;\n }\n\n if (snowballSize < 0)\n {\n snowballSize = 0;\n }\n }\n\n return snowballSize;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8d3a1d12088c6da7dc028092e7685c31", "src_uid": "084a12eb3a708b43b880734f3ee51374", "difficulty": 800} {"lang": "Mono C#", "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\n public static bool UpdateMin(ref T x, T newValue) where T : IComparable {\n if (x.CompareTo(newValue) > 0) { x = newValue; return true; }\n return false;\n }\n public static bool UpdateMax(ref T x, T newValue) where T : IComparable {\n if (x.CompareTo(newValue) < 0) { x = newValue; return true; }\n return false;\n }\n\n public void Run() {\n var n = ni();\n var k = ni();\n var s = ns();\n var t = ns();\n long ans = 0;\n if (t[0] == t[1]) {\n long count = s.Count(c => c == t[0]);\n count += k;\n if (count > s.Length) count = s.Length;\n ans = count * (count - 1) / 2;\n } else {\n var c1 = t[0];\n var c2 = t[1];\n var memo = new long?[s.Length, k + 1, n + 1]; // (changeNum, occurrence of c1)\n\n long dfs(int pos, int changeNum, int c1Num) {\n if (pos == s.Length) return 0;\n ref var ret = ref memo[pos, changeNum, c1Num];\n if (!ret.HasValue) {\n long val = 0;\n var c = s[pos];\n if (c == c1) {\n val = Math.Max(val, dfs(pos + 1, changeNum, c1Num + 1));\n } else {\n val = Math.Max(val, dfs(pos + 1, changeNum, c1Num));\n if (changeNum < k) {\n val = Math.Max(val, dfs(pos + 1, changeNum + 1, c1Num + 1));\n }\n }\n if (c == c2) {\n val = Math.Max(val, dfs(pos + 1, changeNum, c1Num) + c1Num);\n } else {\n if (changeNum < k) {\n val = Math.Max(val, dfs(pos + 1, changeNum + 1, c1Num) + c1Num);\n }\n }\n ret = val;\n }\n return ret.Value;\n }\n ans = dfs(0, 0, 0);\n }\n cout.WriteLine(ans);\n }\n\n public static void Fill(T[,] array, T value) {\n int height = array.GetLength(0);\n int width = array.GetLength(1);\n for (int i = 0; i < height; i++) {\n for (int j = 0; j < width; j++) {\n array[i, j] = value;\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 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "973a155b3aec696b7a779feb62974622", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100} {"lang": "Mono C#", "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\n// C# 7.2\npublic static class UpdateExtension {\n public static bool UpdateMin(this ref T x, T newValue) where T : struct, IComparable {\n if (x.CompareTo(newValue) > 0) { x = newValue; return true; }\n return false;\n }\n public static bool UpdateMax(this ref T x, T newValue) where T : struct, IComparable {\n if (x.CompareTo(newValue) < 0) { x = newValue; return true; }\n return false;\n }\n}\n\ninternal partial class Solver {\n public void Run() {\n var n = ni();\n var k = ni();\n var s = ns();\n var t = ns();\n long ans = 0;\n if (t[0] == t[1]) {\n long count = s.Count(c => c == t[0]);\n count += k;\n if (count > s.Length) count = s.Length;\n ans = count * (count - 1) / 2;\n } else {\n var c1 = t[0];\n var c2 = t[1];\n var dp = new long[k + 1, n + 1]; // (changeNum, occurrence of c1)\n Fill(dp, -(1 << 50));\n dp[0, 0] = 0;\n foreach (var c in s) {\n var next = new long[k + 1, n + 1];\n Fill(next, -(1 << 50));\n next[0, 0] = 0;\n for (int i = 0; i <= k; i++) {\n for (int j = 0; j <= n; j++) {\n next[i, j].UpdateMax(dp[i, j]);\n if (j - 1 >= 0) {\n if (c == c1) {\n next[i, j].UpdateMax(dp[i, j - 1]);\n } else if (i - 1 >= 0) {\n next[i, j].UpdateMax(dp[i - 1, j - 1]);\n }\n }\n if (c == c2) {\n next[i, j].UpdateMax(dp[i, j] + j);\n } else if (i - 1 >= 0) {\n next[i, j].UpdateMax(dp[i - 1, j] + j);\n }\n }\n }\n dp = next;\n }\n ans = dp.Cast().Max();\n }\n cout.WriteLine(ans);\n }\n\n public static void Fill(T[,] array, T value) {\n int height = array.GetLength(0);\n int width = array.GetLength(1);\n for (int i = 0; i < height; i++) {\n for (int j = 0; j < width; j++) {\n array[i, j] = value;\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 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f6c458676bea5aa7e6929eb4f2856a3f", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Numerics;\nusing System.Threading;\nusing System.Runtime.CompilerServices;\nusing System.Diagnostics;\nusing static System.Math;\nusing static System.Array;\nusing static AtCoder.Cout;\nusing static AtCoder.Tool;\nusing static AtCoder.ModInt;\nnamespace AtCoder\n{\n class AC\n {\n const int MOD = 1000000007;\n //const int MOD = 998244353;\n const int INF = int.MaxValue / 2;\n const long SINF = long.MaxValue / 3;\n const double EPS = 1e-8;\n static readonly int[] dI = { 0, 1, 0, -1, 1, -1, -1, 1 };\n static readonly int[] dJ = { 1, 0, -1, 0, 1, 1, -1, -1 };\n static void Main(string[] args)\n {\n //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw);\n\n var th = new Thread(Run, 1 << 26);\n th.Start();\n th.Join();\n\n //Run();\n Console.Out.Flush();\n }\n static void Run()\n {\n int Testcase = 1;\n //Testcase = Cin.Int;\n for (var _ = 0; _ < Testcase; _++) Solve();\n }\n static void Solve()\n {\n int n, k;\n Cin.Scanf(out n, out k);\n var s = Cin.Str.ToCharArray();\n var t = Cin.Str;\n if (t[0] == t[1])\n {\n for(var i = 0; i < n && k > 0; i++)\n {\n if (s[i] != t[0])\n {\n s[i] = t[0];\n k--;\n }\n }\n long l = s.Count(x => x == t[0]);\n OutL(l * (l - 1) / 2);\n }\n else\n {\n var dp = new long[n + 1, k + 1, n + 1];\n for (var i = 0; i <= n; i++) for (var j = 0; j <= k; j++) for (var l = 0; l <= n; l++)\n dp[i, j, l] = -SINF;\n dp[0, 0, 0] = 0;\n for(var i = 0; i < n; i++)\n {\n for(var j = 0; j <= k; j++)\n {\n for(var l = 0; l <= i; l++)\n {\n if (s[i] == t[0])\n {\n dp[i + 1, j, l + 1] = Max(dp[i + 1, j, l + 1], dp[i, j, l]);\n if (j + 1 <= k) dp[i + 1, j + 1, l] = Max(dp[i + 1, j + 1, l], dp[i, j, l] + l);\n }\n else if (s[i] == t[1])\n {\n dp[i + 1, j, l] = Max(dp[i + 1, j, l], dp[i, j, l] + l);\n if (j + 1 <= k) dp[i + 1, j + 1, l + 1] = Max(dp[i + 1, j + 1, l + 1], dp[i, j, l]);\n }\n else\n {\n dp[i + 1, j, l] = Max(dp[i + 1, j, l], dp[i, j, l]);\n if (j + 1 <= k)\n {\n dp[i + 1, j + 1, l + 1] = Max(dp[i + 1, j + 1, l + 1], dp[i, j, l]);\n dp[i + 1, j + 1, l] = Max(dp[i + 1, j + 1, l], dp[i, j, l] + l);\n }\n }\n }\n }\n }\n long ans = 0;\n for(var i = 0; i <= k; i++)\n {\n for(var j = 0; j <= n; j++)\n {\n ans = Max(ans, dp[n, i, j]);\n }\n }\n OutL(ans);\n }\n }\n\n public struct Edge\n {\n public int from;\n\n public int to;\n public long dist;\n\n public Edge(int t, long c)\n {\n from = -1;\n to = t;\n dist = c;\n }\n public Edge(int f, int t, long c)\n {\n from = f;\n to = t;\n dist = c;\n }\n }\n }\n struct ModInt\n {\n public long value;\n private const int MOD = 1000000007;\n //private const int MOD = 998244353;\n public ModInt(long value) { this.value = value; }\n public static implicit operator ModInt(long a)\n {\n var ret = a % MOD;\n return new ModInt(ret < 0 ? (ret + MOD) : ret);\n }\n public static ModInt operator +(ModInt a, ModInt b) => (a.value + b.value);\n public static ModInt operator -(ModInt a, ModInt b) => (a.value - b.value);\n public static ModInt operator *(ModInt a, ModInt b) => (a.value * b.value);\n public static ModInt operator /(ModInt a, ModInt b) => a * Modpow(b, MOD - 2);\n\n public static ModInt operator <<(ModInt a, int n) => (a.value << n);\n public static ModInt operator >>(ModInt a, int n) => (a.value >> n);\n public static ModInt operator ++(ModInt a) => a.value + 1;\n public static ModInt operator --(ModInt a) => a.value - 1;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Modpow(ModInt a, long n)\n {\n if (n < 0) return Modpow(Modpow(a, -n), MOD - 2);\n var k = a;\n ModInt ret = 1;\n while (n > 0)\n {\n if ((n & 1) != 0) ret *= k;\n k *= k;\n n >>= 1;\n }\n return ret;\n }\n private static readonly List Factorials = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Fac(long n)\n {\n for (var i = Factorials.Count(); i <= n; i++)\n {\n Factorials.Add((Factorials[i - 1] * i) % MOD);\n }\n return Factorials[(int)n];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt nCr(long n, long r)\n {\n if (n < 0 || r < 0) return 0;\n return n < r ? 0 : Fac(n) / (Fac(r) * Fac(n - r));\n }\n public static explicit operator int(ModInt a) => (int)a.value;\n }\n public class Rolling_Hash\n {\n const ulong m30 = (1UL << 30) - 1;\n const ulong m31 = (1UL << 31) - 1;\n const ulong MOD = (1UL << 61) - 1;\n const ulong Pl = (MOD << 1) << 1;\n private uint B;\n private string S;\n ulong[] hash;\n ulong[] pw;\n\n public Rolling_Hash(string str)\n {\n S = str;\n B = (uint)new Random().Next(1 << 12 + 1, int.MaxValue);\n int L = S.Length;\n hash = new ulong[L + 1];\n pw = new ulong[L + 1];\n hash[0] = 0;\n pw[0] = 1;\n for (var i = 0; i < L; i++)\n {\n hash[i + 1] = CalcMod(Mul(hash[i], B) + S[i]);\n pw[i + 1] = CalcMod(Mul(pw[i], B));\n }\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ulong GetHashValue(int idx) => hash[idx];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]//segment [l,r]\n public ulong Hash_fold(int l, int r) => CalcMod(Pl + hash[r + 1] - Mul(hash[l], pw[r - l + 1]));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]//segment[start,start+len-1]\n public ulong Hash_sub(int start, int len) => CalcMod(Pl + hash[start + len] - Mul(hash[start], pw[len]));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ulong[] GetHashArray() => hash;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ulong Mul(ulong a, ulong b)\n {\n ulong au = a >> 31;\n ulong ad = a & m31;\n ulong bu = b >> 31;\n ulong bd = b & m31;\n ulong mid = ad * bu + au * bd;\n ulong midu = mid >> 30;\n ulong midd = mid & m30;\n return au * bu * 2 + midu + (midd << 31) + ad * bd;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ulong CalcMod(ulong x)\n {\n ulong xu = x >> 61;\n ulong xd = x & MOD;\n ulong res = xu + xd;\n if (res >= MOD) res -= MOD;\n return res;\n }\n }\n public class Priority_Queue\n {\n private List Q;\n private readonly Comparison Func_Compare;\n public Priority_Queue(Comparison comp)\n {\n Func_Compare = comp;\n Q = new List();\n }\n private void PushHeap(List list, T item)\n {\n int n = list.Count();\n list.Add(item);\n\n while (n != 0)\n {\n int pIndex = (n - 1) / 2;\n\n if (Func_Compare(list[n], list[pIndex]) < 0)\n {\n Swap(Q, n, pIndex);\n }\n else { break; }\n\n n = pIndex;\n }\n }\n private void PopHeap(List list)\n {\n int n = list.Count() - 1;\n list[0] = list[n];\n list.RemoveAt(n);\n\n int cur = 0;\n int comp;\n\n while (2 * cur + 1 <= n - 1)\n {\n int c1 = 2 * cur + 1;\n int c2 = 2 * (cur + 1);\n if (c1 == n - 1)\n {\n comp = c1;\n }\n else\n {\n\n comp = Func_Compare(list[c1], list[c2]) < 0 ? c1 : c2;\n }\n\n if (Func_Compare(list[cur], list[comp]) > 0)\n {\n Swap(Q, cur, comp);\n }\n else { break; }\n\n cur = comp;\n }\n }\n private void Swap(List list, int a, int b)\n {\n T keep = list[a];\n list[a] = list[b];\n list[b] = keep;\n }\n\n public void Enqueue(T value)\n {\n PushHeap(Q, value);\n }\n\n public T Dequeue()\n {\n T ret = Q[0];\n PopHeap(Q);\n return ret;\n }\n\n public T Peek()\n {\n return Q[0];\n }\n\n public int Count()\n {\n return Q.Count();\n }\n public bool Any()\n {\n return Q.Any();\n }\n }\n public class SegmentTree\n {\n //1-indexed type\n int n;\n T[] Tree;\n Func f;\n T ex;\n int L;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public SegmentTree(int size, Func fun, T exvalue)\n {\n ex = exvalue;\n f = fun;\n n = 1;\n while (n < size) n <<= 1;\n Tree = new T[n << 1];\n L = (n << 1) - 1;\n for (var i = 0; i <= L; i++) Tree[i] = ex;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public SegmentTree(int size, Func fun, T exvalue, T[] initial)\n {\n ex = exvalue;\n n = 1; while (n < size) n <<= 1;\n f = fun;\n Tree = new T[n << 1];\n L = (n << 1) - 1;\n for (var i = 0; i <= L; i++) Tree[i] = (n <= i && i <= n + initial.Length - 1) ? initial[i - n] : ex;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Set_All()\n {\n for (var i = n - 1; i >= 1; i--) Tree[i] = f(Tree[i << 1], Tree[(i << 1) | 1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Assign(int idx, T nxt) => Tree[idx + n] = nxt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(int idx)\n {\n int now = idx + n;\n while (now > 1)\n {\n now >>= 1;\n Tree[now] = f(Tree[now << 1], Tree[now << 1 | 1]);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Query_Update(int idx, T nxt)\n {\n Assign(idx, nxt); Update(idx);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Query_Update_func(int idx, T y)\n {\n Assign(idx, f(Peek(idx), y)); Update(idx);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Query_Fold(int l, int r)\n {\n int L = n + l;\n int R = n + r;\n T vL = ex, vR = ex;\n while (L < R)\n {\n if (L % 2 == 1)\n {\n vL = f(vL, Tree[L]);\n L++;\n }\n if (R % 2 == 1)\n {\n vR = f(Tree[R - 1], vR);\n R--;\n }\n L >>= 1;\n R >>= 1;\n }\n return f(vL, vR);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Peek(int idx) => Tree[idx + n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Display(int len)\n {\n for (var i = 0; i < len; i++) Console.Write($\"{Tree[i + n]} \");\n Console.WriteLine();\n }\n }\n public class UnionFind\n {\n private int[] parent;\n private int[] rank;\n private int[] size;\n public UnionFind(int n)\n {\n parent = new int[n];\n rank = new int[n];\n size = new int[n];\n for (var i = 0; i < n; i++)\n {\n parent[i] = i;\n rank[i] = 0;\n size[i] = 1;\n }\n }\n\n public int Root(int x)\n {\n return parent[x] == x ? x : parent[x] = Root(parent[x]);\n }\n\n public bool SameRoot(int x, int y)\n {\n return Root(x) == Root(y);\n }\n\n public void Unite(int x, int y)\n {\n x = Root(x);\n y = Root(y);\n if (x == y) { return; }\n\n if (rank[x] < rank[y])\n {\n parent[x] = y;\n size[y] += size[x];\n size[x] = 0;\n }\n else\n {\n parent[y] = x;\n if (rank[x] == rank[y]) { rank[x]++; }\n size[x] += size[y];\n size[y] = 0;\n }\n }\n\n public int SizeOf(int x)\n {\n return size[Root(x)];\n }\n\n }\n static class Cin\n {\n public static string[] ReadSplit => Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);\n public static int[] ReadSplitInt => ConvertAll(ReadSplit, int.Parse);\n public static long[] ReadSplitLong => ConvertAll(ReadSplit, long.Parse);\n public static double[] ReadSplit_Double => ConvertAll(ReadSplit, double.Parse);\n public static string Str => Console.ReadLine();\n public static int Int => int.Parse(Console.ReadLine());\n public static long Long => long.Parse(Console.ReadLine());\n public static double Double => double.Parse(Console.ReadLine());\n public static T Conv(string input)\n {\n if (typeof(T).Equals(typeof(ModInt)))\n {\n return (T)(dynamic)(long.Parse(input));\n }\n return (T)Convert.ChangeType(input, typeof(T));\n }\n public static void Scanf(out T a) => a = Conv(Console.ReadLine());\n public static void Scanf(out T a, out U b)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); }\n public static void Scanf(out T a, out U b, out V c)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); c = Conv(q[2]); }\n public static void Scanf(out T a, out U b, out V c, out W d)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); c = Conv(q[2]); d = Conv(q[3]); }\n public static void Scanf(out T a, out U b, out V c, out W d, out X e)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); c = Conv(q[2]); d = Conv(q[3]); e = Conv(q[4]); }\n }\n static class Cout\n {\n public static void OutL(object s) => Console.WriteLine(s);\n public static void Out_Sep(IEnumerable s) => Console.WriteLine(string.Join(\" \", s));\n public static void Out_Sep(IEnumerable s, string sep) => Console.WriteLine(string.Join($\"{sep}\", s));\n public static void Out_Sep(params object[] s) => Console.WriteLine(string.Join(\" \", s));\n public static void Out_One(object s) => Console.Write($\"{s} \");\n public static void Out_One(object s, string sep) => Console.Write($\"{s}{sep}\");\n public static void Endl() => Console.WriteLine();\n }\n public static class Tool\n {\n static public void Initialize(ref T[] array, T initialvalue)\n {\n array = ConvertAll(array, x => initialvalue);\n }\n static public void Swap(ref T a, ref T b)\n {\n T keep = a;\n a = b;\n b = keep;\n }\n static public void Display(T[,] array2d, int n, int m)\n {\n for (var i = 0; i < n; i++)\n {\n for (var j = 0; j < m; j++)\n {\n Console.Write($\"{array2d[i, j]} \");\n }\n Console.WriteLine();\n }\n }\n static public long Gcd(long a, long b)\n {\n if (a == 0 || b == 0) return Max(a, b);\n return a % b == 0 ? b : Gcd(b, a % b);\n }\n static public long LPow(int a, int b) => (long)Pow(a, b);\n static public bool Bit(long x, int dig) => ((1L << dig) & x) != 0;\n static public int Sig(long a) => a == 0 ? 0 : (int)(a / Abs(a));\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9d82e6eded76b7821aec3926fd31e98b", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100} {"lang": "Mono C#", "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\n public static bool UpdateMin(ref T x, T newValue) where T : IComparable {\n if (x.CompareTo(newValue) > 0) { x = newValue; return true; }\n return false;\n }\n public static bool UpdateMax(ref T x, T newValue) where T : IComparable {\n if (x.CompareTo(newValue) < 0) { x = newValue; return true; }\n return false;\n }\n\n public void Run() {\n var n = ni();\n var k = ni();\n var s = ns();\n var t = ns();\n long ans = 0;\n if (t[0] == t[1]) {\n long count = s.Count(c => c == t[0]);\n count += k;\n if (count > s.Length) count = s.Length;\n ans = count * (count - 1) / 2;\n } else {\n var c1 = t[0];\n var c2 = t[1];\n var memo = new long?[s.Length, k + 1, n + 1]; // (changeNum, occurrence of c1)\n\n Func dfs = null;\n\n dfs = (int pos, int changeNum, int c1Num) => {\n if (pos == s.Length) return 0;\n ref var ret = ref memo[pos, changeNum, c1Num];\n if (!ret.HasValue) {\n long val = 0;\n var c = s[pos];\n if (c == c1) {\n val = Math.Max(val, dfs(pos + 1, changeNum, c1Num + 1));\n } else {\n val = Math.Max(val, dfs(pos + 1, changeNum, c1Num));\n if (changeNum < k) {\n val = Math.Max(val, dfs(pos + 1, changeNum + 1, c1Num + 1));\n }\n }\n if (c == c2) {\n val = Math.Max(val, dfs(pos + 1, changeNum, c1Num) + c1Num);\n } else {\n if (changeNum < k) {\n val = Math.Max(val, dfs(pos + 1, changeNum + 1, c1Num) + c1Num);\n }\n }\n ret = val;\n }\n return ret.Value;\n }\n ans = dfs(0, 0, 0);\n }\n cout.WriteLine(ans);\n }\n\n public static void Fill(T[,] array, T value) {\n int height = array.GetLength(0);\n int width = array.GetLength(1);\n for (int i = 0; i < height; i++) {\n for (int j = 0; j < width; j++) {\n array[i, j] = value;\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 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "636869f080025bce279b90a0b2af3164", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Numerics;\nusing System.Threading;\nusing System.Runtime.CompilerServices;\nusing System.Diagnostics;\nusing static System.Math;\nusing static System.Array;\nusing static AtCoder.Cout;\nusing static AtCoder.Tool;\nusing static AtCoder.ModInt;\nnamespace AtCoder\n{\n class AC\n {\n const int MOD = 1000000007;\n //const int MOD = 998244353;\n const int INF = int.MaxValue / 2;\n const long SINF = long.MaxValue / 3;\n const double EPS = 1e-8;\n static readonly int[] dI = { 0, 1, 0, -1, 1, -1, -1, 1 };\n static readonly int[] dJ = { 1, 0, -1, 0, 1, 1, -1, -1 };\n static void Main(string[] args)\n {\n //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw);\n\n var th = new Thread(Run, 1 << 26);\n th.Start();\n th.Join();\n\n //Run();\n Console.Out.Flush();\n }\n static void Run()\n {\n int Testcase = 1;\n //Testcase = Cin.Int;\n for (var _ = 0; _ < Testcase; _++) Solve();\n }\n static void Solve()\n {\n Cin.Scanf(out int n, out int k);\n var s = Cin.Str.ToCharArray();\n var t = Cin.Str;\n if (t[0] == t[1])\n {\n for(var i = 0; i < n && k > 0; i++)\n {\n if (s[i] != t[0])\n {\n s[i] = t[0];\n k--;\n }\n }\n long l = s.Count(x => x == t[0]);\n OutL(l * (l - 1) / 2);\n }\n else\n {\n var dp = new long[n + 1, k + 1, n + 1];\n for (var i = 0; i <= n; i++) for (var j = 0; j <= k; j++) for (var l = 0; l <= n; l++)\n dp[i, j, l] = -SINF;\n dp[0, 0, 0] = 0;\n for(var i = 0; i < n; i++)\n {\n for(var j = 0; j <= k; j++)\n {\n for(var l = 0; l <= i; l++)\n {\n if (s[i] == t[0])\n {\n dp[i + 1, j, l + 1] = Max(dp[i + 1, j, l + 1], dp[i, j, l]);\n if (j + 1 <= k) dp[i + 1, j + 1, l] = Max(dp[i + 1, j + 1, l], dp[i, j, l] + l);\n }\n else if (s[i] == t[1])\n {\n dp[i + 1, j, l] = Max(dp[i + 1, j, l], dp[i, j, l] + l);\n if (j + 1 <= k) dp[i + 1, j + 1, l + 1] = Max(dp[i + 1, j + 1, l + 1], dp[i, j, l]);\n }\n else\n {\n dp[i + 1, j, l] = Max(dp[i + 1, j, l], dp[i, j, l]);\n if (j + 1 <= k)\n {\n dp[i + 1, j + 1, l + 1] = Max(dp[i + 1, j + 1, l + 1], dp[i, j, l]);\n dp[i + 1, j + 1, l] = Max(dp[i + 1, j + 1, l], dp[i, j, l] + l);\n }\n }\n }\n }\n }\n long ans = 0;\n for(var i = 0; i <= k; i++)\n {\n for(var j = 0; j <= n; j++)\n {\n ans = Max(ans, dp[n, i, j]);\n }\n }\n OutL(ans);\n }\n }\n\n public struct Edge\n {\n public int from;\n\n public int to;\n public long dist;\n\n public Edge(int t, long c)\n {\n from = -1;\n to = t;\n dist = c;\n }\n public Edge(int f, int t, long c)\n {\n from = f;\n to = t;\n dist = c;\n }\n }\n }\n struct ModInt\n {\n public long value;\n private const int MOD = 1000000007;\n //private const int MOD = 998244353;\n public ModInt(long value) { this.value = value; }\n public static implicit operator ModInt(long a)\n {\n var ret = a % MOD;\n return new ModInt(ret < 0 ? (ret + MOD) : ret);\n }\n public static ModInt operator +(ModInt a, ModInt b) => (a.value + b.value);\n public static ModInt operator -(ModInt a, ModInt b) => (a.value - b.value);\n public static ModInt operator *(ModInt a, ModInt b) => (a.value * b.value);\n public static ModInt operator /(ModInt a, ModInt b) => a * Modpow(b, MOD - 2);\n\n public static ModInt operator <<(ModInt a, int n) => (a.value << n);\n public static ModInt operator >>(ModInt a, int n) => (a.value >> n);\n public static ModInt operator ++(ModInt a) => a.value + 1;\n public static ModInt operator --(ModInt a) => a.value - 1;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Modpow(ModInt a, long n)\n {\n if (n < 0) return Modpow(Modpow(a, -n), MOD - 2);\n var k = a;\n ModInt ret = 1;\n while (n > 0)\n {\n if ((n & 1) != 0) ret *= k;\n k *= k;\n n >>= 1;\n }\n return ret;\n }\n private static readonly List Factorials = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Fac(long n)\n {\n for (var i = Factorials.Count(); i <= n; i++)\n {\n Factorials.Add((Factorials[i - 1] * i) % MOD);\n }\n return Factorials[(int)n];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt nCr(long n, long r)\n {\n if (n < 0 || r < 0) return 0;\n return n < r ? 0 : Fac(n) / (Fac(r) * Fac(n - r));\n }\n public static explicit operator int(ModInt a) => (int)a.value;\n }\n public class Rolling_Hash\n {\n const ulong m30 = (1UL << 30) - 1;\n const ulong m31 = (1UL << 31) - 1;\n const ulong MOD = (1UL << 61) - 1;\n const ulong Pl = (MOD << 1) << 1;\n private uint B;\n private string S;\n ulong[] hash;\n ulong[] pw;\n\n public Rolling_Hash(string str)\n {\n S = str;\n B = (uint)new Random().Next(1 << 12 + 1, int.MaxValue);\n int L = S.Length;\n hash = new ulong[L + 1];\n pw = new ulong[L + 1];\n hash[0] = 0;\n pw[0] = 1;\n for (var i = 0; i < L; i++)\n {\n hash[i + 1] = CalcMod(Mul(hash[i], B) + S[i]);\n pw[i + 1] = CalcMod(Mul(pw[i], B));\n }\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ulong GetHashValue(int idx) => hash[idx];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]//segment [l,r]\n public ulong Hash_fold(int l, int r) => CalcMod(Pl + hash[r + 1] - Mul(hash[l], pw[r - l + 1]));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]//segment[start,start+len-1]\n public ulong Hash_sub(int start, int len) => CalcMod(Pl + hash[start + len] - Mul(hash[start], pw[len]));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ulong[] GetHashArray() => hash;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ulong Mul(ulong a, ulong b)\n {\n ulong au = a >> 31;\n ulong ad = a & m31;\n ulong bu = b >> 31;\n ulong bd = b & m31;\n ulong mid = ad * bu + au * bd;\n ulong midu = mid >> 30;\n ulong midd = mid & m30;\n return au * bu * 2 + midu + (midd << 31) + ad * bd;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ulong CalcMod(ulong x)\n {\n ulong xu = x >> 61;\n ulong xd = x & MOD;\n ulong res = xu + xd;\n if (res >= MOD) res -= MOD;\n return res;\n }\n }\n public class Priority_Queue\n {\n private List Q;\n private readonly Comparison Func_Compare;\n public Priority_Queue(Comparison comp)\n {\n Func_Compare = comp;\n Q = new List();\n }\n private void PushHeap(List list, T item)\n {\n int n = list.Count();\n list.Add(item);\n\n while (n != 0)\n {\n int pIndex = (n - 1) / 2;\n\n if (Func_Compare(list[n], list[pIndex]) < 0)\n {\n Swap(Q, n, pIndex);\n }\n else { break; }\n\n n = pIndex;\n }\n }\n private void PopHeap(List list)\n {\n int n = list.Count() - 1;\n list[0] = list[n];\n list.RemoveAt(n);\n\n int cur = 0;\n int comp;\n\n while (2 * cur + 1 <= n - 1)\n {\n int c1 = 2 * cur + 1;\n int c2 = 2 * (cur + 1);\n if (c1 == n - 1)\n {\n comp = c1;\n }\n else\n {\n\n comp = Func_Compare(list[c1], list[c2]) < 0 ? c1 : c2;\n }\n\n if (Func_Compare(list[cur], list[comp]) > 0)\n {\n Swap(Q, cur, comp);\n }\n else { break; }\n\n cur = comp;\n }\n }\n private void Swap(List list, int a, int b)\n {\n T keep = list[a];\n list[a] = list[b];\n list[b] = keep;\n }\n\n public void Enqueue(T value)\n {\n PushHeap(Q, value);\n }\n\n public T Dequeue()\n {\n T ret = Q[0];\n PopHeap(Q);\n return ret;\n }\n\n public T Peek()\n {\n return Q[0];\n }\n\n public int Count()\n {\n return Q.Count();\n }\n public bool Any()\n {\n return Q.Any();\n }\n }\n public class SegmentTree\n {\n //1-indexed type\n int n;\n T[] Tree;\n Func f;\n T ex;\n int L;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public SegmentTree(int size, Func fun, T exvalue)\n {\n ex = exvalue;\n f = fun;\n n = 1;\n while (n < size) n <<= 1;\n Tree = new T[n << 1];\n L = (n << 1) - 1;\n for (var i = 0; i <= L; i++) Tree[i] = ex;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public SegmentTree(int size, Func fun, T exvalue, T[] initial)\n {\n ex = exvalue;\n n = 1; while (n < size) n <<= 1;\n f = fun;\n Tree = new T[n << 1];\n L = (n << 1) - 1;\n for (var i = 0; i <= L; i++) Tree[i] = (n <= i && i <= n + initial.Length - 1) ? initial[i - n] : ex;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Set_All()\n {\n for (var i = n - 1; i >= 1; i--) Tree[i] = f(Tree[i << 1], Tree[(i << 1) | 1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Assign(int idx, T nxt) => Tree[idx + n] = nxt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(int idx)\n {\n int now = idx + n;\n while (now > 1)\n {\n now >>= 1;\n Tree[now] = f(Tree[now << 1], Tree[now << 1 | 1]);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Query_Update(int idx, T nxt)\n {\n Assign(idx, nxt); Update(idx);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Query_Update_func(int idx, T y)\n {\n Assign(idx, f(Peek(idx), y)); Update(idx);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Query_Fold(int l, int r)\n {\n int L = n + l;\n int R = n + r;\n T vL = ex, vR = ex;\n while (L < R)\n {\n if (L % 2 == 1)\n {\n vL = f(vL, Tree[L]);\n L++;\n }\n if (R % 2 == 1)\n {\n vR = f(Tree[R - 1], vR);\n R--;\n }\n L >>= 1;\n R >>= 1;\n }\n return f(vL, vR);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Peek(int idx) => Tree[idx + n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Display(int len)\n {\n for (var i = 0; i < len; i++) Console.Write($\"{Tree[i + n]} \");\n Console.WriteLine();\n }\n }\n public class UnionFind\n {\n private int[] parent;\n private int[] rank;\n private int[] size;\n public UnionFind(int n)\n {\n parent = new int[n];\n rank = new int[n];\n size = new int[n];\n for (var i = 0; i < n; i++)\n {\n parent[i] = i;\n rank[i] = 0;\n size[i] = 1;\n }\n }\n\n public int Root(int x)\n {\n return parent[x] == x ? x : parent[x] = Root(parent[x]);\n }\n\n public bool SameRoot(int x, int y)\n {\n return Root(x) == Root(y);\n }\n\n public void Unite(int x, int y)\n {\n x = Root(x);\n y = Root(y);\n if (x == y) { return; }\n\n if (rank[x] < rank[y])\n {\n parent[x] = y;\n size[y] += size[x];\n size[x] = 0;\n }\n else\n {\n parent[y] = x;\n if (rank[x] == rank[y]) { rank[x]++; }\n size[x] += size[y];\n size[y] = 0;\n }\n }\n\n public int SizeOf(int x)\n {\n return size[Root(x)];\n }\n\n }\n static class Cin\n {\n public static string[] ReadSplit => Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);\n public static int[] ReadSplitInt => ConvertAll(ReadSplit, int.Parse);\n public static long[] ReadSplitLong => ConvertAll(ReadSplit, long.Parse);\n public static double[] ReadSplit_Double => ConvertAll(ReadSplit, double.Parse);\n public static string Str => Console.ReadLine();\n public static int Int => int.Parse(Console.ReadLine());\n public static long Long => long.Parse(Console.ReadLine());\n public static double Double => double.Parse(Console.ReadLine());\n public static T Conv(string input)\n {\n if (typeof(T).Equals(typeof(ModInt)))\n {\n return (T)(dynamic)(long.Parse(input));\n }\n return (T)Convert.ChangeType(input, typeof(T));\n }\n public static void Scanf(out T a) => a = Conv(Console.ReadLine());\n public static void Scanf(out T a, out U b)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); }\n public static void Scanf(out T a, out U b, out V c)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); c = Conv(q[2]); }\n public static void Scanf(out T a, out U b, out V c, out W d)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); c = Conv(q[2]); d = Conv(q[3]); }\n public static void Scanf(out T a, out U b, out V c, out W d, out X e)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); c = Conv(q[2]); d = Conv(q[3]); e = Conv(q[4]); }\n }\n static class Cout\n {\n public static void OutL(object s) => Console.WriteLine(s);\n public static void Out_Sep(IEnumerable s) => Console.WriteLine(string.Join(\" \", s));\n public static void Out_Sep(IEnumerable s, string sep) => Console.WriteLine(string.Join($\"{sep}\", s));\n public static void Out_Sep(params object[] s) => Console.WriteLine(string.Join(\" \", s));\n public static void Out_One(object s) => Console.Write($\"{s} \");\n public static void Out_One(object s, string sep) => Console.Write($\"{s}{sep}\");\n public static void Endl() => Console.WriteLine();\n }\n public static class Tool\n {\n static public void Initialize(ref T[] array, T initialvalue)\n {\n array = ConvertAll(array, x => initialvalue);\n }\n static public void Swap(ref T a, ref T b)\n {\n T keep = a;\n a = b;\n b = keep;\n }\n static public void Display(T[,] array2d, int n, int m)\n {\n for (var i = 0; i < n; i++)\n {\n for (var j = 0; j < m; j++)\n {\n Console.Write($\"{array2d[i, j]} \");\n }\n Console.WriteLine();\n }\n }\n static public long Gcd(long a, long b)\n {\n if (a == 0 || b == 0) return Max(a, b);\n return a % b == 0 ? b : Gcd(b, a % b);\n }\n static public long LPow(int a, int b) => (long)Pow(a, b);\n static public bool Bit(long x, int dig) => ((1L << dig) & x) != 0;\n static public int Sig(long a) => a == 0 ? 0 : (int)(a / Abs(a));\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bc69ad60933072f1bb5d721ad1342c99", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Numerics;\nusing System.Threading;\nusing System.Runtime.CompilerServices;\nusing System.Diagnostics;\nusing static System.Math;\nusing static System.Array;\nusing static AtCoder.Cout;\nusing static AtCoder.Tool;\nusing static AtCoder.ModInt;\nnamespace AtCoder\n{\n class AC\n {\n const int MOD = 1000000007;\n //const int MOD = 998244353;\n const int INF = int.MaxValue / 2;\n const long SINF = long.MaxValue / 3;\n const double EPS = 1e-8;\n static readonly int[] dI = { 0, 1, 0, -1, 1, -1, -1, 1 };\n static readonly int[] dJ = { 1, 0, -1, 0, 1, 1, -1, -1 };\n static void Main(string[] args)\n {\n //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw);\n\n var th = new Thread(Run, 1 << 26);\n th.Start();\n th.Join();\n\n //Run();\n Console.Out.Flush();\n }\n static void Run()\n {\n int Testcase = 1;\n //Testcase = Cin.Int;\n for (var _ = 0; _ < Testcase; _++) Solve();\n }\n static void Solve()\n {\n int n, k;\n Cin.Scanf(out n, out k);\n (int, int) tuple = (n, k);\n var s = Cin.Str.ToCharArray();\n var t = Cin.Str;\n if (t[0] == t[1])\n {\n for(var i = 0; i < n && k > 0; i++)\n {\n if (s[i] != t[0])\n {\n s[i] = t[0];\n k--;\n }\n }\n long l = s.Count(x => x == t[0]);\n OutL(l * (l - 1) / 2);\n }\n else\n {\n var dp = new long[n + 1, k + 1, n + 1];\n for (var i = 0; i <= n; i++) for (var j = 0; j <= k; j++) for (var l = 0; l <= n; l++)\n dp[i, j, l] = -SINF;\n dp[0, 0, 0] = 0;\n for(var i = 0; i < n; i++)\n {\n for(var j = 0; j <= k; j++)\n {\n for(var l = 0; l <= i; l++)\n {\n if (s[i] == t[0])\n {\n dp[i + 1, j, l + 1] = Max(dp[i + 1, j, l + 1], dp[i, j, l]);\n if (j + 1 <= k) dp[i + 1, j + 1, l] = Max(dp[i + 1, j + 1, l], dp[i, j, l] + l);\n }\n else if (s[i] == t[1])\n {\n dp[i + 1, j, l] = Max(dp[i + 1, j, l], dp[i, j, l] + l);\n if (j + 1 <= k) dp[i + 1, j + 1, l + 1] = Max(dp[i + 1, j + 1, l + 1], dp[i, j, l]);\n }\n else\n {\n dp[i + 1, j, l] = Max(dp[i + 1, j, l], dp[i, j, l]);\n if (j + 1 <= k)\n {\n dp[i + 1, j + 1, l + 1] = Max(dp[i + 1, j + 1, l + 1], dp[i, j, l]);\n dp[i + 1, j + 1, l] = Max(dp[i + 1, j + 1, l], dp[i, j, l] + l);\n }\n }\n }\n }\n }\n long ans = 0;\n for(var i = 0; i <= k; i++)\n {\n for(var j = 0; j <= n; j++)\n {\n ans = Max(ans, dp[n, i, j]);\n }\n }\n OutL(ans);\n }\n }\n\n public struct Edge\n {\n public int from;\n\n public int to;\n public long dist;\n\n public Edge(int t, long c)\n {\n from = -1;\n to = t;\n dist = c;\n }\n public Edge(int f, int t, long c)\n {\n from = f;\n to = t;\n dist = c;\n }\n }\n }\n struct ModInt\n {\n public long value;\n private const int MOD = 1000000007;\n //private const int MOD = 998244353;\n public ModInt(long value) { this.value = value; }\n public static implicit operator ModInt(long a)\n {\n var ret = a % MOD;\n return new ModInt(ret < 0 ? (ret + MOD) : ret);\n }\n public static ModInt operator +(ModInt a, ModInt b) => (a.value + b.value);\n public static ModInt operator -(ModInt a, ModInt b) => (a.value - b.value);\n public static ModInt operator *(ModInt a, ModInt b) => (a.value * b.value);\n public static ModInt operator /(ModInt a, ModInt b) => a * Modpow(b, MOD - 2);\n\n public static ModInt operator <<(ModInt a, int n) => (a.value << n);\n public static ModInt operator >>(ModInt a, int n) => (a.value >> n);\n public static ModInt operator ++(ModInt a) => a.value + 1;\n public static ModInt operator --(ModInt a) => a.value - 1;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Modpow(ModInt a, long n)\n {\n if (n < 0) return Modpow(Modpow(a, -n), MOD - 2);\n var k = a;\n ModInt ret = 1;\n while (n > 0)\n {\n if ((n & 1) != 0) ret *= k;\n k *= k;\n n >>= 1;\n }\n return ret;\n }\n private static readonly List Factorials = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Fac(long n)\n {\n for (var i = Factorials.Count(); i <= n; i++)\n {\n Factorials.Add((Factorials[i - 1] * i) % MOD);\n }\n return Factorials[(int)n];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt nCr(long n, long r)\n {\n if (n < 0 || r < 0) return 0;\n return n < r ? 0 : Fac(n) / (Fac(r) * Fac(n - r));\n }\n public static explicit operator int(ModInt a) => (int)a.value;\n }\n public class Rolling_Hash\n {\n const ulong m30 = (1UL << 30) - 1;\n const ulong m31 = (1UL << 31) - 1;\n const ulong MOD = (1UL << 61) - 1;\n const ulong Pl = (MOD << 1) << 1;\n private uint B;\n private string S;\n ulong[] hash;\n ulong[] pw;\n\n public Rolling_Hash(string str)\n {\n S = str;\n B = (uint)new Random().Next(1 << 12 + 1, int.MaxValue);\n int L = S.Length;\n hash = new ulong[L + 1];\n pw = new ulong[L + 1];\n hash[0] = 0;\n pw[0] = 1;\n for (var i = 0; i < L; i++)\n {\n hash[i + 1] = CalcMod(Mul(hash[i], B) + S[i]);\n pw[i + 1] = CalcMod(Mul(pw[i], B));\n }\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ulong GetHashValue(int idx) => hash[idx];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]//segment [l,r]\n public ulong Hash_fold(int l, int r) => CalcMod(Pl + hash[r + 1] - Mul(hash[l], pw[r - l + 1]));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]//segment[start,start+len-1]\n public ulong Hash_sub(int start, int len) => CalcMod(Pl + hash[start + len] - Mul(hash[start], pw[len]));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ulong[] GetHashArray() => hash;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ulong Mul(ulong a, ulong b)\n {\n ulong au = a >> 31;\n ulong ad = a & m31;\n ulong bu = b >> 31;\n ulong bd = b & m31;\n ulong mid = ad * bu + au * bd;\n ulong midu = mid >> 30;\n ulong midd = mid & m30;\n return au * bu * 2 + midu + (midd << 31) + ad * bd;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ulong CalcMod(ulong x)\n {\n ulong xu = x >> 61;\n ulong xd = x & MOD;\n ulong res = xu + xd;\n if (res >= MOD) res -= MOD;\n return res;\n }\n }\n public class Priority_Queue\n {\n private List Q;\n private readonly Comparison Func_Compare;\n public Priority_Queue(Comparison comp)\n {\n Func_Compare = comp;\n Q = new List();\n }\n private void PushHeap(List list, T item)\n {\n int n = list.Count();\n list.Add(item);\n\n while (n != 0)\n {\n int pIndex = (n - 1) / 2;\n\n if (Func_Compare(list[n], list[pIndex]) < 0)\n {\n Swap(Q, n, pIndex);\n }\n else { break; }\n\n n = pIndex;\n }\n }\n private void PopHeap(List list)\n {\n int n = list.Count() - 1;\n list[0] = list[n];\n list.RemoveAt(n);\n\n int cur = 0;\n int comp;\n\n while (2 * cur + 1 <= n - 1)\n {\n int c1 = 2 * cur + 1;\n int c2 = 2 * (cur + 1);\n if (c1 == n - 1)\n {\n comp = c1;\n }\n else\n {\n\n comp = Func_Compare(list[c1], list[c2]) < 0 ? c1 : c2;\n }\n\n if (Func_Compare(list[cur], list[comp]) > 0)\n {\n Swap(Q, cur, comp);\n }\n else { break; }\n\n cur = comp;\n }\n }\n private void Swap(List list, int a, int b)\n {\n T keep = list[a];\n list[a] = list[b];\n list[b] = keep;\n }\n\n public void Enqueue(T value)\n {\n PushHeap(Q, value);\n }\n\n public T Dequeue()\n {\n T ret = Q[0];\n PopHeap(Q);\n return ret;\n }\n\n public T Peek()\n {\n return Q[0];\n }\n\n public int Count()\n {\n return Q.Count();\n }\n public bool Any()\n {\n return Q.Any();\n }\n }\n public class SegmentTree\n {\n //1-indexed type\n int n;\n T[] Tree;\n Func f;\n T ex;\n int L;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public SegmentTree(int size, Func fun, T exvalue)\n {\n ex = exvalue;\n f = fun;\n n = 1;\n while (n < size) n <<= 1;\n Tree = new T[n << 1];\n L = (n << 1) - 1;\n for (var i = 0; i <= L; i++) Tree[i] = ex;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public SegmentTree(int size, Func fun, T exvalue, T[] initial)\n {\n ex = exvalue;\n n = 1; while (n < size) n <<= 1;\n f = fun;\n Tree = new T[n << 1];\n L = (n << 1) - 1;\n for (var i = 0; i <= L; i++) Tree[i] = (n <= i && i <= n + initial.Length - 1) ? initial[i - n] : ex;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Set_All()\n {\n for (var i = n - 1; i >= 1; i--) Tree[i] = f(Tree[i << 1], Tree[(i << 1) | 1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Assign(int idx, T nxt) => Tree[idx + n] = nxt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(int idx)\n {\n int now = idx + n;\n while (now > 1)\n {\n now >>= 1;\n Tree[now] = f(Tree[now << 1], Tree[now << 1 | 1]);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Query_Update(int idx, T nxt)\n {\n Assign(idx, nxt); Update(idx);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Query_Update_func(int idx, T y)\n {\n Assign(idx, f(Peek(idx), y)); Update(idx);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Query_Fold(int l, int r)\n {\n int L = n + l;\n int R = n + r;\n T vL = ex, vR = ex;\n while (L < R)\n {\n if (L % 2 == 1)\n {\n vL = f(vL, Tree[L]);\n L++;\n }\n if (R % 2 == 1)\n {\n vR = f(Tree[R - 1], vR);\n R--;\n }\n L >>= 1;\n R >>= 1;\n }\n return f(vL, vR);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Peek(int idx) => Tree[idx + n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Display(int len)\n {\n for (var i = 0; i < len; i++) Console.Write($\"{Tree[i + n]} \");\n Console.WriteLine();\n }\n }\n public class UnionFind\n {\n private int[] parent;\n private int[] rank;\n private int[] size;\n public UnionFind(int n)\n {\n parent = new int[n];\n rank = new int[n];\n size = new int[n];\n for (var i = 0; i < n; i++)\n {\n parent[i] = i;\n rank[i] = 0;\n size[i] = 1;\n }\n }\n\n public int Root(int x)\n {\n return parent[x] == x ? x : parent[x] = Root(parent[x]);\n }\n\n public bool SameRoot(int x, int y)\n {\n return Root(x) == Root(y);\n }\n\n public void Unite(int x, int y)\n {\n x = Root(x);\n y = Root(y);\n if (x == y) { return; }\n\n if (rank[x] < rank[y])\n {\n parent[x] = y;\n size[y] += size[x];\n size[x] = 0;\n }\n else\n {\n parent[y] = x;\n if (rank[x] == rank[y]) { rank[x]++; }\n size[x] += size[y];\n size[y] = 0;\n }\n }\n\n public int SizeOf(int x)\n {\n return size[Root(x)];\n }\n\n }\n static class Cin\n {\n public static string[] ReadSplit => Console.ReadLine().Split();\n public static int[] ReadSplitInt => ConvertAll(ReadSplit, int.Parse);\n public static long[] ReadSplitLong => ConvertAll(ReadSplit, long.Parse);\n public static double[] ReadSplit_Double => ConvertAll(ReadSplit, double.Parse);\n public static string Str => Console.ReadLine();\n public static int Int => int.Parse(Console.ReadLine());\n public static long Long => long.Parse(Console.ReadLine());\n public static double Double => double.Parse(Console.ReadLine());\n public static T Conv(string input)\n {\n if (typeof(T).Equals(typeof(ModInt)))\n {\n return (T)(dynamic)(long.Parse(input));\n }\n return (T)Convert.ChangeType(input, typeof(T));\n }\n public static void Scanf(out T a) => a = Conv(Console.ReadLine());\n public static void Scanf(out T a, out U b)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); }\n public static void Scanf(out T a, out U b, out V c)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); c = Conv(q[2]); }\n public static void Scanf(out T a, out U b, out V c, out W d)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); c = Conv(q[2]); d = Conv(q[3]); }\n public static void Scanf(out T a, out U b, out V c, out W d, out X e)\n { var q = ReadSplit; a = Conv(q[0]); b = Conv(q[1]); c = Conv(q[2]); d = Conv(q[3]); e = Conv(q[4]); }\n }\n static class Cout\n {\n public static void OutL(object s) => Console.WriteLine(s);\n public static void Out_Sep(IEnumerable s) => Console.WriteLine(string.Join(\" \", s));\n public static void Out_Sep(IEnumerable s, string sep) => Console.WriteLine(string.Join($\"{sep}\", s));\n public static void Out_Sep(params object[] s) => Console.WriteLine(string.Join(\" \", s));\n public static void Out_One(object s) => Console.Write($\"{s} \");\n public static void Out_One(object s, string sep) => Console.Write($\"{s}{sep}\");\n public static void Endl() => Console.WriteLine();\n }\n public static class Tool\n {\n static public void Initialize(ref T[] array, T initialvalue)\n {\n array = ConvertAll(array, x => initialvalue);\n }\n static public void Swap(ref T a, ref T b)\n {\n T keep = a;\n a = b;\n b = keep;\n }\n static public void Display(T[,] array2d, int n, int m)\n {\n for (var i = 0; i < n; i++)\n {\n for (var j = 0; j < m; j++)\n {\n Console.Write($\"{array2d[i, j]} \");\n }\n Console.WriteLine();\n }\n }\n static public long Gcd(long a, long b)\n {\n if (a == 0 || b == 0) return Max(a, b);\n return a % b == 0 ? b : Gcd(b, a % b);\n }\n static public long LPow(int a, int b) => (long)Pow(a, b);\n static public bool Bit(long x, int dig) => ((1L << dig) & x) != 0;\n static public int Sig(long a) => a == 0 ? 0 : (int)(a / Abs(a));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f84498ed87525fcb7a52888ced6ec297", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100} {"lang": "Mono C#", "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 CodeforcesRound655Div2.Extensions;\nusing CodeforcesRound655Div2.Questions;\n\nnamespace CodeforcesRound655Div2.Questions\n{\n public class QuestionB : AtCoderQuestionBase\n {\n public override IEnumerable Solve(TextReader inputStream)\n {\n var tests = inputStream.ReadInt();\n for (int t = 0; t < tests; t++)\n {\n var n = inputStream.ReadInt();\n var divs = GetDivisiors(n).Where(i => i != n);\n\n var minA = int.MaxValue;\n var minLcm = long.MaxValue;\n\n foreach (var div in divs)\n {\n var a = div;\n var b = n - a;\n var lcm = Lcm(a, b);\n if (lcm < minLcm)\n {\n minA = a;\n minLcm = lcm;\n }\n }\n\n var minB = n - minA;\n\n yield return $\"{minA} {minB}\";\n }\n }\n\n IEnumerable GetDivisiors(int n)\n {\n for (int i = 1; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n yield return i;\n if (i * i != n)\n {\n yield return n / i;\n }\n }\n }\n }\n\n public static long Gcd(long a, long b)\n {\n if (a < b)\n {\n (a, b) = (b, a);\n }\n\n if (b == 0)\n {\n return a;\n }\n else\n {\n return Gcd(b, a % b);\n }\n }\n\n public static long Lcm(long a, long b)\n {\n if (a < 0 || b < 0)\n {\n throw new ArgumentOutOfRangeException($\"{nameof(a)}, {nameof(b)}\u306f0\u4ee5\u4e0a\u306e\u6574\u6570\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\");\n }\n\n return a / Gcd(a, b) * b;\n }\n\n }\n}\n\nnamespace CodeforcesRound655Div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionD();\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 CodeforcesRound655Div2.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 CodeforcesRound655Div2.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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "77f55029b3d41db29149ac26b06e2e60", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp15\n{\n class Program\n {\n static void Main(string[] args)\n {\n var t = int.Parse(Console.ReadLine());\n\n while (t-- > 0)\n {\n var n = int.Parse(Console.ReadLine());\n\n if (n % 2 == 0)\n {\n var a = n / 2;\n Console.WriteLine(a + \" \" + a);\n continue;\n }\n\n int b = 0;\n for (int i = 3; i <= n; i += 2)\n {\n if (n % i == 0)\n {\n b = i;\n }\n }\n if (b == 0)\n {\n Console.WriteLine(\"1 \" + n);\n }\n else\n {\n var k = n / i;\n var a = 1;\n var b = i - 1;\n a = a * k;\n b = b * k;\n Console.WriteLine(a + \" \" + b);\n break;\n\n }\n\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "642b0138a3f9862e5709f665a5363a24", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "difficulty": 1300} {"lang": "Mono C#", "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 CodeforcesRound655Div2.Extensions;\nusing CodeforcesRound655Div2.Questions;\n\nnamespace CodeforcesRound655Div2.Questions\n{\n public class QuestionB : AtCoderQuestionBase\n {\n public override IEnumerable Solve(TextReader inputStream)\n {\n var tests = inputStream.ReadInt();\n for (int t = 0; t < tests; t++)\n {\n var n = inputStream.ReadInt();\n var divs = GetDivisiors(n).Where(i => i != 1).ToArray();\n\n if (divs.Length > 0)\n {\n var div = divs.Min();\n var a = n / div * (div / 2);\n var b = n - a;\n yield return $\"{a} {b}\";\n }\n else\n {\n yield return $\"{1} {n - 1}\";\n }\n }\n }\n\n IEnumerable GetDivisiors(int n)\n {\n for (int i = 1; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n yield return i;\n if (i * i != n)\n {\n yield return n / i;\n }\n }\n }\n }\n\n public static long Gcd(long a, long b)\n {\n if (a < b)\n {\n (a, b) = (b, a);\n }\n\n var result = b switch\n {\n 0 => a,\n long n when n > 0 => Gcd(b, a % b),\n _ => throw new ArgumentOutOfRangeException($\"{nameof(a)}, {nameof(b)}\u306f0\u4ee5\u4e0a\u306e\u6574\u6570\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\")\n };\n\n return result;\n }\n\n public static long Lcm(long a, long b)\n {\n if (a < 0 || b < 0)\n {\n throw new ArgumentOutOfRangeException($\"{nameof(a)}, {nameof(b)}\u306f0\u4ee5\u4e0a\u306e\u6574\u6570\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\");\n }\n\n return a / Gcd(a, b) * b;\n }\n }\n}\n\nnamespace CodeforcesRound655Div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionB();\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 CodeforcesRound655Div2.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 CodeforcesRound655Div2.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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2aae120bcef19407b1e58eec9a1b4297", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "difficulty": 1300} {"lang": "MS C#", "source_code": "//\n// main.cpp\n// CodeForces\n//\n// Created by Dakota Raymond on 1/12/17.\n// Copyright \u00a9 2017 Dakota Raymond. All rights reserved.\n//\n\n#include \n#include \n\nint main(){\n int damage1;\n int damage2;\n int damage3;\n \n std::cin >> damage1 >> damage2 >> damage3;\n \n int mod1 = damage3 % damage1;\n int mod2 = damage3 % damage2;\n mod1 = mod1 % damage2;\n mod2 = mod2 % damage1;\n if (mod1 == 0 || mod2 == 0) {\n std::cout << \"Yes\" << std::endl;\n } else {\n std::cout << \"No\" << std::endl;\n }\n \n \n return 0;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "03916b8bd60e33ab2b768197cdeb38e6", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100} {"lang": "MS C#", "source_code": "\nimport java.util.Scanner;\n\npublic class Test4 {\n\n public static void main(String[] args) {\n Scanner f = new Scanner(System.in);\n int a = f.nextInt(); int b = f.nextInt(); int c = f.nextInt();\n while (c > 0 && c % a != 0)\n c -= b;\n System.out.println(c>=0? \"Yes\":\"No\");\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b3f25eddf0587b9ecc9b9c58539938fc", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100} {"lang": "MS C#", "source_code": "using 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d74b8abadaa6cb820004b46ac1c50ff", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100} {"lang": "MS C#", "source_code": "using System;\nstring 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();", "lang_cluster": "C#", "compilation_error": true, "code_uid": "197c24d8fd77c3238060ea1d202486cd", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass ProblemSolving {\n\n public static void Main() {\n var str = Console.ReadLine();\n HashSet S = new HashSet();\n S.Add(str);\n int n = str.Length;\n for (int i = 0; i < n; i++) {\n str = str.Substring(1) + str[0];\n S.Add(str);\n }\n Console.WriteLine(S.Count);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "af78c457332a022de86fa93ad7cc4e7b", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "difficulty": 900} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5a14f2458e9f90d7ab45281b90b4014e", "src_uid": "aed892f2bda10b6aee10dcb834a63709", "difficulty": 1000} {"lang": "MS C#", "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[] v = Array.ConvertAll(Console.ReadLine().Split(' '), ts = int.Parse(ts));\n Array.Sort(v);\n Console.WriteLine(v[n - 1] - v[0]);\n int aux = v[0];\n v[0] = v[n - 1];\n v[n - 1] = aux;\n for (int i = 0; i < n; i++) {\n Console.Write(\"{0} \", v[i]);\n }\n\n //Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d0c68898a8bc681287abd9eb7175b13d", "src_uid": "4408eba2c5c0693e6b70bdcbe2dda2f4", "difficulty": 1300} {"lang": "Mono C#", "source_code": "var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = input[0];\n int a = input[1];\n int b = input[2];\n int c = input[3];\n int d = input[4];\n \n\n \n\n \n \n\n int count = 0;\n\n var sum = new int[4];\n for(int i =1; i<= n; i++)\n {\n \n sum[0] = a + b + i;\n sum[1] = a + c + i;\n sum[2] = b + d + i;\n sum[3] = c + d + i;\n\n \n int mx = sum.Max();\n int tmp = mx + i;\n\n if (n == 1 && sum.Count(m => m == sum[0]) == 4) count = 1;\n else\n {\n if(tmp-sum.Min()<=n) count += n - 1;\n\n }\n \n }\n\n\n\n\n Console.WriteLine(count);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f96bd790fe745cebb96df553f7dd998c", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400} {"lang": "Mono C#", "source_code": "using System;\nnamespace PizzaPizzaPizza\n{\n class PizzaPizzaPizza \n {\n static void Main() \n {\n long n = Console.ReadLine();\n \n n++;// Considering her share\n \n if (n == 1) {\n Console.WriteLine(0);\n }\n else if (n % 2 == 0)\n {// Even\n Console.WriteLine(n / 2);\n }\n else\n {// Odd and not 1\n Console.WriteLine(n);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c7d027441a7bb52bf00ed33d62f8afd2", "src_uid": "236177ff30dafe68295b5d33dc501828", "difficulty": 1000} {"lang": "Mono C#", "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()123456\n if (s==\"00123456\") { Console.WriteLine(\"123456\"); return; }\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b1223e69a24daa1e69d1fb826d70b615", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "difficulty": 1400} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing CodeForcesTest.Round277Div2;\n\nnamespace CodeForcesTest.Round278\n{\n class CandyBoxes\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 int n = Convert.ToInt32(input);\n var list = new List();\n for (int i = 0; i < n; ++i)\n {\n input = Console.ReadLine();\n list.Add(Convert.ToInt32(input));\n }\n list = list.OrderBy(x => x).ToList();\n\n if (n == 4)\n {\n if (list[0]*3 == list[3] && list[0]*4 == list[1] + list[2])\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n else if (n == 3)\n {\n if (list[0]*3 < list[2])\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n if (list[0]*4 == list[1]+list[2])\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list[0] * 3);\n }\n else if (list[2]%3 == 0\n && list[2]/3*4 == list[0]+list[1])\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list[2]/3);\n }\n else if (list[0] * 3 == list[2])\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list[0]+list[2]-list[1]);\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n else if (n == 2)\n {\n if (list[0] * 3 < list[1])\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list[0] * 4 - list[1]);\n Console.WriteLine(list[0] * 3);\n }\n }\n else if (n == 1)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list[0]);\n Console.WriteLine(list[0] * 2);\n Console.WriteLine(list[0] * 2);\n Console.WriteLine(list[0] * 3);\n }\n else\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(1);\n Console.WriteLine(2);\n Console.WriteLine(2);\n Console.WriteLine(3);\n }\n }\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b8bb0e43a851d4168b0e44e881fda15a", "src_uid": "230e613abf0f6a768829cbc1f1a09219", "difficulty": 1900} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing CodeForcesTest.Round277Div2;\n\nnamespace CodeForcesTest.Round278\n{\n class CandyBoxes\n {\n public static void Main(string[] args)\n {\n Run();\n Console.ReadLine();\n }\n\n static void Run()\n {\n string input = Console.ReadLine();\n int n = Convert.ToInt32(input);\n List list = new List();\n for (int i = 0; i < n; ++i)\n {\n input = Console.ReadLine();\n list.Add(Convert.ToInt32(input));\n }\n list = list.OrderBy(x => x).ToList();\n\n if (n == 4)\n {\n if (list[0]*3 == list[3] && list[0]*4 == list[1] + list[2])\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n else if (n == 3)\n {\n if (list[0]*3 < list[2])\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n if (list[0]*4 == list[1]+list[2])\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list[0] * 3);\n }\n else if (list[2]%3 == 0\n && list[2]/3*4 == list[0]+list[1])\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list[2]/3);\n }\n else if (list[0] * 3 == list[2])\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list[0]+list[2]-list[1]);\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n else if (n == 2)\n {\n if (list[0] * 3 < list[1])\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list[0] * 4 - list[1]);\n Console.WriteLine(list[0] * 3);\n }\n }\n else if (n == 1)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list[0]);\n Console.WriteLine(list[0] * 2);\n Console.WriteLine(list[0] * 2);\n Console.WriteLine(list[0] * 3);\n }\n else\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(1);\n Console.WriteLine(2);\n Console.WriteLine(2);\n Console.WriteLine(3);\n }\n }\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ce168cf075ba132b61efabd61228526f", "src_uid": "230e613abf0f6a768829cbc1f1a09219", "difficulty": 1900} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Olymp630R\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong n = int.Parse(Console.ReadLine());\nif (n == 1) Console.Write(1);\nelse if (n %2 == 0) Console.Write(2);\nelse Console.Write(1);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ef659b0da96f134dd0024f7ff329aaac", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "difficulty": 1200} {"lang": "MS C#", "source_code": "class Program\n {\n \n static void Main(string[] args)\n {\n string a;\n int k = 0;\n a=Console.ReadLine();\n k = Int32.Parse(a);\n if (k % 2 == 0)\n {\n Console.WriteLine(2);\n }\n else {\n Console.WriteLine(1);\n }\n \n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65a64f10c2e5e4db975f2ce4f74b6b95", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "difficulty": 1200} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Reflection.Metadata.Ecma335;\nusing System.Runtime.InteropServices;\n\nnamespace cs\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] scores = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n double EPSILON = 0.000001;\n int count = 0;\n int sum = scores.Sum();\n int i = 0;\n while ((double)sum / n - 4.5 < EPSILON && i < n)\n {\n if (scores[i] != 5)\n {\n sum += (5 - scores[i]);\n count++;\n }\n i++;\n }\n\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fe119cde703173ad7019f62207063ed6", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\n class Program\n {\n public static int ReadInt() => Int32.Parse(Console.ReadLine());\n\n public static int[] ReadInts() =>\n Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries)\n .Select(Int32.Parse).ToArray();\n\n static void Main(string[] args)\n {\n int n = ReadInt();\n var grades = ReadInts();\n Array.Sort(grades);\n var todo = n*9 - grades.Sum() * 2;\n\n int i;\n for (i = 0; i < grades.Length && todo > 0; i++)\n {\n var grade = grades[i];\n var plus = (5 - grade)*2;\n todo -= plus;\n }\n Console.WriteLine(i);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b11dc52be8be5b2e6f3caddd3dd6e11", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\n class Program\n {\n public static int ReadInt() => Int32.Parse(Console.ReadLine());\n\n public static int[] ReadInts() =>\n Console.ReadLine().Split(\" \", StringSplitOptions.RemoveEmptyEntries)\n .Select(Int32.Parse).ToArray();\n\n static void Main(string[] args)\n {\n int n = ReadInt();\n var grades = ReadInts();\n Array.Sort(grades);\n var todo = n*9 - grades.Sum() * 2;\n\n int i;\n for (i = 0; i < grades.Length && todo > 0; i++)\n {\n var grade = grades[i];\n var plus = (5 - grade)*2;\n todo -= plus;\n }\n Console.WriteLine(i);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "472e28b6a6606273f7facc29abb38c79", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27130.2027\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"CF491_B\", \"CF491_B\\CF491_B.csproj\", \"{E1F8EB5B-7A2E-45BB-ACBE-930B8B7988A1}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{E1F8EB5B-7A2E-45BB-ACBE-930B8B7988A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{E1F8EB5B-7A2E-45BB-ACBE-930B8B7988A1}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{E1F8EB5B-7A2E-45BB-ACBE-930B8B7988A1}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{E1F8EB5B-7A2E-45BB-ACBE-930B8B7988A1}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {54CF0155-66D9-4782-AF71-AEF5B259F28F}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "832f0a5590886dcfcfd83f8fd579d543", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round88 {\n class B {\n static void Mai() {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => long.Parse(sss));\n long a = xs[0], b = xs[1], mod = xs[2];\n for (long i = 0; i <= a; i++) {\n long v = 1000000000L * i % mod;\n if ((mod - v) % mod > b) {\n Console.WriteLine(\"1 {0}\", i.ToString().PadLeft(9, '0'));\n return;\n }\n }\n Console.WriteLine(2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b5c402b5cfdf0946b98e2d382f2ec6ab", "src_uid": "8b6f633802293202531264446d33fee5", "difficulty": 1800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round88 {\n class B {\n static void Mai() {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => long.Parse(sss));\n long a = xs[0], b = xs[1], mod = xs[2];\n for (long i = 1; i < mod && i <= a; i++) {\n long v = 1000000000L * i % mod;\n if ((mod - v) % mod > b) {\n Console.WriteLine(\"1 {0}\", i.ToString().PadLeft(9, '0'));\n return;\n }\n }\n Console.WriteLine(2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f4d20a9b1d46bcdc8561d5d774703f47", "src_uid": "8b6f633802293202531264446d33fee5", "difficulty": 1800} {"lang": "MS C#", "source_code": "\n static void Main(string[] args)\n {\n ulong n = Convert.ToUInt32(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 Main(null);\n }\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "838a6fa71493121f84aa92ff32ef01c1", "src_uid": "7e7b59f2112fd200ee03255c0c230ebd", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {26DE0CF0-FAFD-4D67-BDCC-4CB8493E45C1}\n Exe\n lessons\n lessons\n v4.6.1\n 512\n true\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ddec3de2383d27a92179e5b2da7b64f3", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900} {"lang": "Mono C#", "source_code": "class MainClass\n\t{\n\t\tpublic static void ProblemA() {\n\t\t\tstring[] source = Console.ReadLine().Split(' ');\n\t\t\tint n = int.Parse(source[0]), k = int.Parse(source[1]);\n\t\t\tsource = Console.ReadLine().Split(' ');\n\t\t\tint ans = k;\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tint a = int.Parse(source[i]);\n\t\t\t\tif(k % a == 0) ans = Math.Min(ans, k / a);\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t\tpublic static void Main(string[] args) {\n\t\t\tProblemA();\n\t\t}\n\t}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e1a4c43e835b54b3daf335084b5337bf", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.WriteLine(\"Hello World!\");\n //FriendsMeeting.FriendsWithBenefits();\n WorldCup.wakaWaka();\n }\n }\n \n class WorldCup\n {\n public static void wakaWaka()\n {\n int[] inp = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int teamCount = inp[0];\n int roundCount = (int)Math.Log((double)teamCount, 2), iterationCount = 0;\n List> roughPaper = new List>() { };\n int[] baseArray = new int[teamCount];\n for (int i = 0; i < teamCount; i++)\n {\n baseArray[i] = i;\n }\n roughPaper.Add(baseArray.ToList());\n while(iterationCount < roundCount)\n {\n ++iterationCount;\n roughPaper.Add(roughPaper[iterationCount - 1].Where(x => x != -1).ToList());\n int limit = roughPaper[iterationCount].Count;\n for (int i =0;i< limit;i+=2)\n {\n if ((roughPaper[iterationCount][i] + 1 == inp[1] || roughPaper[iterationCount][i] + 1 == inp[2]) &&\n (roughPaper[iterationCount][i + 1] + 1 == inp[1] || roughPaper[iterationCount][i + 1] + 1 == inp[2])) \n {\n Console.WriteLine(iterationCount.ToString());\n //Console.ReadKey();\n return;\n }\n else if ((roughPaper[iterationCount][i] + 1 == inp[1] || roughPaper[iterationCount][i] + 1 == inp[2]))\n {\n roughPaper[iterationCount][i + 1] = -1;\n }\n else if ((roughPaper[iterationCount][i + 1] + 1 == inp[1] || roughPaper[iterationCount][i + 1] + 1 == inp[2])) \n {\n roughPaper[iterationCount][i] = -1;\n }\n else\n {\n roughPaper[iterationCount][i] = -1;\n }\n }\n }\n Console.WriteLine(\"Final!\");\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1b08c335fdddaeaf84a486dcc76d20b6", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200} {"lang": "MS C#", "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[] tokens = Console.ReadLine().Split(' ');\n\n Int32 k = Int32.Parse(tokens[1]);\n Int32 n = Int32.Parse(tokens[0]);\n\n Int32 r = n - k;\n\n int res = 0;\n\n int MaxBook = 0;\n\n if (r == 0)\n {\n Console.WriteLine(0 + \" \" + 0);\n }\n\n //if (n % 2 == 0)\n // {\n MaxBook = n / 2;\n // }\n // else\n // {\n // MaxBook = (n+1) / 2;\n // }\n\n\n\n if (k < MaxBook)\n {\n res = k + 1;\n }\n\n\n if (k == MaxBook)\n {\n res = k;\n }\n\n if (k > MaxBook)\n {\n res = n-k;\n }\n\n\n if (k < n)\n {\n Console.WriteLine(1 + \" \" + res);\n }\n else if (k >= n)\n {\n Console.WriteLine(0 + \" \" + 0);\n }\n else if (k = 0)\n {\n Console.WriteLine(1 + \" \" + 1);\n }\n\n \n // while (Console.ReadKey().Key != ConsoleKey.Enter) { }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "647baf7e4e4b4391da15f84ea8e615f5", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "difficulty": 1200} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nclass Program\n {\n static void Main(string[] args)\n {\n var info = Console.In.ReadToEnd().Split('\\n', StringSplitOptions.RemoveEmptyEntries)[1].GroupBy(x => x).OrderBy(x => x.Count());\n if (info.ElementAt(0).Count() > 0 || info.ElementAt(1).Count() > 1) Console.WriteLine(\"RGB\");\n else if (info.ElementAt(1).Count() == 0) Console.WriteLine(info.ElementAt(2).Key.ToString());\n else Console.WriteLine(info.ElementAt(0).Key.ToString() + ((info.ElementAt(2).Count() == 1)?\"\": info.ElementAt(1).Key.ToString()));\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8786075391e37f8b5408bd388f1698b3", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n \n \nnamespace ProblemSolving_CF_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string outputMessage = CarrotCakes() ? \"YES\" : \"NO\";\n Console.WriteLine(outputMessage);\n }\n \n static bool CarrotCakes()\n {\n var input = Console.ReadLine()?.Split();\n if (input == null)\n return false;\n \n var numberOfNeededCakes = float.Parse(input[0]);\n var timeToOneOvenTobake = float.Parse(input[1]);\n var numberofBakedCakes = float.Parse(input[2]);\n var timeTobuildSecondOven = float.Parse(input[3]);\n \n if (numberofBakedCakes < numberOfNeededCakes)\n {\n if (timeTobuildSecondOven < timeToOneOvenTobake)\n {\n return true;\n }\n \n if (numberofBakedCakes < numberOfNeededCakes / 2)\n {\n if (timeTobuildSecondOven == timeToOneOvenTobake)\n return true;\n \n if (timeTobuildSecondOven > timeToOneOvenTobake)\n {\n var numberOfNeededIteration = Math.Round(numberOfNeededCakes / numberofBakedCakes,5);\n var s = numberOfNeededIteration.ToString(CultureInfo.InvariantCulture).Split('.');\n\n if (s.Length >1)\n {\n if (double.Parse(s[1]) > 0)\n {\n\n\n numberOfNeededIteration += 1;\n numberOfNeededIteration = Math.Round(numberOfNeededIteration);\n }\n }\n\n for (int iteration = 1; iteration <= numberOfNeededIteration; iteration++)\n {\n timeTobuildSecondOven -= timeToOneOvenTobake;\n numberOfNeededCakes -= numberofBakedCakes;\n if (timeTobuildSecondOven < 0)\n {\n if (iteration < numberOfNeededIteration && numberOfNeededCakes > 0)\n {\n return true;\n }\n\n }\n\n if (timeTobuildSecondOven == 0)\n {\n if (iteration < numberOfNeededIteration - 1 && numberOfNeededCakes > 0)\n {\n return true;\n }\n }\n }\n } \n } \n }\n return false;\n}\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd984aa5c719fd15ca1bf900b60c0d61", "src_uid": "32c866d3d394e269724b4930df5e4407", "difficulty": 1100} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n private static int S(int x)\n {\n return x.ToString().ToCharArray().Select(c => Int32.Parse(c.ToString())).Sum();\n }\n\n private static IEnumerable<(int, int)> GeneratePairs(int v1, int v2)\n {\n var value1 = v1;\n var value2 = v2;\n\n while (value1 > 0 && value2 > 0)\n {\n value1--;\n value2++;\n yield return (value1, value2);\n }\n }\n\n static void Main(string[] args)\n {\n var value = Int32.Parse(Console.ReadLine());\n var largest = 0;\n var pairs = GeneratePairs(value / 2, value - value / 2);\n var iterationsWithoutIncrease = 0;\n foreach (var (v1, v2) in pairs)\n {\n var sum = S(v1) + S(v2);\n if (sum > largest)\n {\n largest = sum;\n iterationsWithoutIncrease = 0;\n }\n else\n {\n iterationsWithoutIncrease++;\n }\n\n if (iterationsWithoutIncrease == 1000)\n {\n break;\n }\n }\n\n Console.WriteLine(largest);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "630859cca473f085ccff23415edaa96b", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {CA6A81DF-7A9D-4F45-B787-3949DAC10116}\n Exe\n Properties\n Codeforces128div2\n Codeforces128div2\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e57a5a1ce4ac499dd1b7c70bebd95113", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Kerling\n{\n class Program\n {\n static void Main(string[] args)\n {\n A_Card();\n }\n\n static void A_Card()\n {\n string cards = Console.ReadLine();\n char[] glas = {'a', 'e', 'i', 'o', 'u','0','2','4','6','8'}; \n \n int count = 0;\n foreach (char c in cards)\n {\n foreach(char g in glas){\n if (c == g) count++;\n }\n }\n\n Console.Write(count.ToString());\n Console.WriteLine();\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "061818af7ba0adda79fb8430f664f255", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "difficulty": 800} {"lang": "Mono C#", "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 mx2 = max(mx2, a[i]);\n }\n }\n Console.WriteLine(\"{0} {1}\", mx, mx2);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "780291eb00894fca08c7d9d6c48d030e", "src_uid": "868407df0a93085057d06367aecaf9be", "difficulty": 1100} {"lang": "Mono C#", "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 mx2 = Math.max(mx2, a[i]);\n }\n }\n Console.WriteLine(\"{0} {1}\", mx, mx2);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d8dafed680af3cce79ac2918416936b4", "src_uid": "868407df0a93085057d06367aecaf9be", "difficulty": 1100} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c8acd9457364e6b60db74a0f92f96816", "src_uid": "868407df0a93085057d06367aecaf9be", "difficulty": 1100} {"lang": "Mono C#", "source_code": "\ufeffusing Codeforces.Common;\nusing System;\nusing System.Diagnostics.Contracts;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Xml.Schema;\n\nnamespace Codeforces.R320C\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 Contract.Requires(tr != null);\n Contract.Requires(tw != null);\n\n tw.WriteLine(Parse(tr));\n }\n\n private static int Parse(TextReader tr)\n {\n var l = tr.ReadLine();\n\n return Calc(l);\n }\n\n public static int Calc(string value)\n {\n Contract.Requires(value != null);\n\n var n = value.Length;\n var res = 0L;\n const int mod = 1000000007;\n\n foreach (char c in value)\n {\n res <<= 1;\n res += c == '1' ? 1 : 0;\n res %= mod;\n }\n\n return (int)(res * ModPow(2, n - 1, 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 }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0a9030f772c55c98fdeceac11ffb9649", "src_uid": "89b51a31e00424edd1385f2120028b9d", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffnamespace topCoder\n{\n\tusing System;\n\tusing System.Collections.Generic;\n\n\tclass p1\n\t{\n\t\tpublic void test()\n\t\t{\n\t\t\tstring[] parts = Console.ReadLine().Split(' ');\n\t\t\tint n = int.Parse(parts[0]);\n\t\t\tint m = int.Parse(parts[1]);\n\n\t\t\tint[] sw = new int[m];\n\t\t\tparts = Console.ReadLine().Split(' ');\n\t\t\tfor (int i = 0; i < parts.Length; i++)\n\t\t\t{\n\t\t\t\tsw[i] = int.Parse(parts[i]);\n\t\t\t}\n\n\t\t\tint[] b = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tb[i] = -1;\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < m; i++)\n\t\t\t{\n\t\t\t\tfor (int j = sw[i] - 1; j < n; j++)\n\t\t\t\t{\n\t\t\t\t\tif (b[j] == -1)\n\t\t\t\t\t\tb[j] = sw[i];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tstring ret = \"\";\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tret += b[i].ToString() + \" \";\n\t\t\t}\n\t\t\tConsole.WriteLine(ret.Trim());\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e803d36db49759a48175fda8c091abf3", "src_uid": "2e44c8aabab7ef7b06bbab8719a8d863", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _1114A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, c, x, y, z;\n\n string[] strGrapesRequired;\n string[] strGrapesAvailable;\n\n strGrapesRequired = Console.ReadLine().Split(\" \");\n strGrapesAvailable = Console.ReadLine().Split(\" \");\n\n x = int.Parse(strGrapesRequired[0]);\n y = int.Parse(strGrapesRequired[1]);\n z = int.Parse(strGrapesRequired[2]);\n\n a = int.Parse(strGrapesAvailable[0]);\n b = int.Parse(strGrapesAvailable[1]);\n c = int.Parse(strGrapesAvailable[2]);\n\n if ((a + b + c) < (x + y + z) || x > a || y > (a - x + b))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n return;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "04362914d50e0e84d60e5c107b46c244", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n internal static class Test1\n {\n private static void Main(string[] args)\n {\n string[] grapesDemand = Console.ReadLine().Split(\" \");\n int andrew = int.Parse(grapesDemand[0]);\n int dmitry = int.Parse(grapesDemand[1]);\n int michal = int.Parse(grapesDemand[2]);\n\n int demand = andrew + dmitry + michal;\n\n string[] grapesSupply = Console.ReadLine().Split(\" \");\n int green = int.Parse(grapesSupply[0]);\n int purple = int.Parse(grapesSupply[1]);\n int black = int.Parse(grapesSupply[2]);\n\n int supply = green + purple + black;\n\n if (supply > demand)\n {\n if (andrew > green)\n Console.WriteLine(\"NO\");\n if (dmitry > green - andrew + purple)\n Console.WriteLine(\"NO\");\n if (michal > supply - (andrew + dmitry))\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "edda34a311ebe3d137f784f4f20c9918", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800} {"lang": "Mono C#", "source_code": "public class Problem\n\nstatic void Main()\n{\n\tif (Eat())\n\t\tConsole.WriteLine(\"YES\");\n\telse\n\t\tConsole.WriteLine(\"NO\");\n\t\n}\n\nstatic bool Eat()\n{\n\tvar s1 = Console.ReadLine();\n\tvar s2 = Console.ReadLine();\n\tvar toEats = s1.Split(' ').Select(s => int.Parse(s)).ToArray();\n\tvar grapes = s2.Split(' ').Select(s => int.Parse(s)).ToArray();\n\tvar andrew = toEats[0];\n\tvar dmitry = toEats[1];\n\tvar michael = toEats[2];\n\n\tvar green = grapes[0];\n\tvar purple = grapes[1];\n\tvar black = grapes[2];\n\n\tif (andrew > green) return false;\n\tgreen = green - andrew;\n\t\n\tif (dmitry > green + purple) return false;\n\tif (michael > black + (green + purple) - dmitry) return false;\n\treturn true;\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d6f64b27772c12fb2b1b6e31e8cf3825", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800} {"lang": "MS C#", "source_code": "class Program\n {\n static string remap(int n)\n {\n string str = \"\";\n if (n / 5 == 0) str += \"O-|\";\n else str += \"-O|\";\n n%=5;\n switch (n){\n case 0: str += \"-OOOO\";\n break;\n case 1: str += \"O-OOO\";\n break;\n case 2: str += \"OO-OO\";\n break;\n case 3: str += \"OOO-O\";\n break;\n case 4: str += \"OOOO-\";\n break;\n }\n return str;\n }\n\n static void Main(string[] args)\n {\n string l = Console.ReadLine();\n for (int i = l.Length - 1; i >= 0; i--)\n {\n Console.WriteLine(remap((int)l[i]-48));\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "17cca8288bca70951d32e4df7c951af5", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\n\nnamespace 363A\n{\n class Program\n {\n static void Main(string[] args)\n {\n double maxNumber = 1E09;\n double n;\n n = double.Parse(Console.ReadLine());\n if (n< 0 | n > maxNumber)\n {\n return;\n }\n int t = (int)n;\n int[] digits = toDigits(t);\n //printMas(digits);\n\n \n for (int i = 0; i < digits.Length; i++)\n {\n string str = string.Empty;\n int r_int = 0;\n int ost = 0;\n\n r_int = digits[i] / 5;\n ost = digits[i] % 5;\n \n if (r_int == 1)\n {\n str += \"-O|\";\n }\n else\n {\n str += \"O-|\";\n }\n\n int j = 1;\n for ( j = 1; j <= ost; j++)\n {\n str += \"O\";\n }\n if (j <= 4)\n {\n str += \"-\";\n for(int k =j; k <=4;k++)\n str += \"O\";\n }\n \n Console.WriteLine(str);\n \n } \n \n }\n\n private static void printMas(int[] digits)\n {\n for (int i = 0; i < digits.Length; i++)\n Console.WriteLine(digits[i]);\n }\n\n private static int[] toDigits(int n)\n {\n int t = n;\n int size = 0;\n do\n {\n t /= 10;\n ++size;\n } while (t > 0);\n int[] digits = new int[size];\n t = (int)n;\n for (int i = 0; i < size; i++)\n {\n digits[i] = t % 10;\n t /= 10;\n }\n return digits;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b1c849dcebb1f8edbe5d92bdb3ef1ba7", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800} {"lang": "MS C#", "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.Length - 1 ; i >= 0 ; i--) res = res*3+digits[i];\n Console.Write(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d23b098b6ffeab66c0e7a0008a420671", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "difficulty": 1100} {"lang": "MS C#", "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 } \n var res = digits.Aggregate(0, (acc,x) => acc*3+x;\n Console.Write(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "330699c82f8692472df8f124dc166408", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "difficulty": 1100} {"lang": "MS C#", "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.Reverse().Aggregate(0, (acc,x) => acc*3+x);\n Console.Write(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4b217e171541c31db5b70322d555e0cb", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "difficulty": 1100} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace SharpOly\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 int need = input[2];\n bool[][] like = new bool[n][\n m]\n ;\n for (int i = 0; i < n; i++)\n {\n var s = Console.ReadLine();\n for (int j = 0; j < m; j++)\n {\n like[i][j] = s[j] == 'Y';\n }\n }\n int wtfAns = 0;\n for (int j = 0; j < m; j++)\n {\n int cur = 0;\n for (int i = 0; i < n; i++)\n {\n if (like[i][j])\n {\n cur++;\n }\n }\n if (cur >= need)\n {\n wtfAns++;\n }\n }\n Console.WriteLine(wtfAns);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cc16c69bbdb0d6dcc201107f6afc4661", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Solution {\n public static void Main() {\n string line1 = Console.ReadLine();\n string [] line1_nums = line1.Split(\" \");\n int F = Convert.ToInt32(line1_nums[0]);\n int I = Convert.ToInt32(line1_nums[1]);\n int T = Convert.ToInt32(line1_nums[2]);\n string [] likes = new string[F];\n for (int f = 0; f < F; ++f) {\n likes[f] = Console.ReadLine();\n }\n int ans = 0;\n for (int i = 0; i < I; ++i) {\n int l = 0;\n for (int f = 0; f < F; ++f) {\n if (likes[f][i] == 'Y') {\n ++l;\n }\n }\n if (l >= T) {\n ++ans;\n }\n }\n Console.WriteLine(ans);\n }\n};\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f4958680f768d930fd38c4187acef19a", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900} {"lang": "Mono C#", "source_code": "usingSystem;publicclassSolution{publicstaticvoidMain(){stringline1=Console.ReadLine();char[]splitter={' '};string[]line1_nums=line1.Split(splitter);intF=Convert.ToInt32(line1_nums[0]);intI=Convert.ToInt32(line1_nums[1]);intT=Convert.ToInt32(line1_nums[2]);string[]likes=newstring[F];for(intf=0;f=T){++ans;}}Console.WriteLine(ans);}};\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8cee832c4f832ff5df7cf5e64f4c63a5", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900} {"lang": "Mono C#", "source_code": "using System;public class Solution{public static void Main(){string l=Console.ReadLine();char[]s={' '};string[]o=l.Split(s);int F=Convert.ToInt32(o[0]);int I=Convert.ToInt32(o[1]);int T=Convert.ToInt32(o[2]);string[]p=new string[F];for(int f=0;f=T){++a;}}Console.WriteLine(a);//kitten}};\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9a4ec59da0c60de97b2d067f7cc0d210", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900} {"lang": "MS C#", "source_code": "using System; using System.Linq; using System.Collections.Generic;\n\nclass P {\n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var res = GetPrices(s[0], s[1]).Last();\n Console.Write(res);\n }\n\n static IEnumerable GetPrices(long p, long d) {\n yield return p;\n var min = p - d;\n var mult = 10;\n while (true) {\n p -= (1 + p%mult) % mult;\n if (p < min) yield break;\n yield return p;\n mult *= 10;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5acea95401a0501cab1c2cd24344361d", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "difficulty": 1400} {"lang": "MS C#", "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 public static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n,m,i,j,a,b;\n n = int.Parse(s[0]);\n m = int.Parse(s[1]);\n i = int.Parse(s[2]);\n j = int.Parse(s[3]);\n a = int.Parse(s[4]);\n b = int.Parse(s[5]);\n int[,] distances=new int[4,2];\n distances[0,0]=i-1;\n distances[0,1]=j-1;\n distances[1,0]=i-1;\n distances[1,1]=m-j;\n distances[2,0]=n-i;\n distances[2,1]=j-1;\n distances[3,0]=n-1;\n distances[3,1]=m-j;\n int[] results=new int[4];\n if ((i == 1 && b == 1) || (i == n && j == 1) || (i == n & j == m) || (i == 1 && j == m))\n {\n Console.WriteLine(0);\n return;\n }\n for (int k = 0; k < 4; k++)\n {\n if (distances[k, 0] % a == 0 && distances[k, 1] % b == 0 && distances[k, 0] / a == distances[k, 1] / b)\n {\n results[k] = distances[k, 0] / a;\n }\n else\n {\n results[k] = -1;\n }\n }\n int min = -1;\n for (int k = 0; k < 4; k++)\n {\n if (results[k] < min || min < 0)\n {\n min = results[k];\n }\n }\n if (min == -1)\n {\n Console.WriteLine(\"Poor Inna and pony!\");\n }\n else\n {\n Console.WriteLine(min);\n }\n }\n \n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4b865bf8a9b1f003dfa5a4b39357810c", "src_uid": "51155e9bfa90e0ff29d049cedc3e1862", "difficulty": 2000} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace InnaAndPony\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] nmihab = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(nmihab[0]);\n int m = Convert.ToInt32(nmihab[1]);\n int i = Convert.ToInt32(nmihab[2]);\n int j = Convert.ToInt32(nmihab[3]);\n int a = Convert.ToInt32(nmihab[4]);\n int b = Convert.ToInt32(nmihab[5]);\n\n if ((((Math.Abs(1 - i) / a) % 2 != (Math.Abs(1 - j) / b) % 2)) && (((Math.Abs(n - i) / a) % 2 != (Math.Abs(1 - j) / b) % 2)) && (((Math.Abs(n - i) / a) % 2 != (Math.Abs(m - j) / b) % 2)) && (((Math.Abs(1 - i) / a) % 2 != (Math.Abs(m - j) / b) % 2)))\n {\n Console.WriteLine(\"Poor Inna and pony!\");\n }\n else\n {\n if (Math.Abs(i - 1) % a == 0)\n k1 = Math.Abs(i - 1) / a;\n if ((Math.Abs(j - 1) % b == 0) && (Math.Abs(j - 1) / b > k1))\n k1 = Math.Abs(j - 1) / b;\n if (Math.Abs(i - n) % a == 0)\n k2 = Math.Abs(i - n) / a;\n if ((Math.Abs(j - 1) % b == 0) && (Math.Abs(j - 1) / b > k2))\n k2 = Math.Abs(j - 1) / b;\n if (Math.Abs(i - n) % a == 0)\n k3 = Math.Abs(i - n) / a;\n if ((Math.Abs(j - m) % b == 0) && (Math.Abs(j - m) / b > k3))\n k3 = Math.Abs(j - m) / b;\n if (Math.Abs(i - 1) % a == 0)\n k4 = Math.Abs(i - 1) / a;\n if ((Math.Abs(j - m) % b == 0) && (Math.Abs(j - m) / b > k4))\n k4 = Math.Abs(j - m) / b;\n int k = Math.Max(Math.Max(k1, k2), Math.Max(k3, k4));\n Console.WriteLine(k);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "58097e34c278141bc4ba60f152f54055", "src_uid": "51155e9bfa90e0ff29d049cedc3e1862", "difficulty": 2000} {"lang": "MS C#", "source_code": "\ufeff//using System;\n//using System.Collections.Generic;\n//using System.IO;\n//using System.Linq;\n\n//namespace 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 x = new List();\n//\t\t\tvar y = new List();\n//\t\t\tfor (var i = 0; i < n; i++)\n//\t\t\t{\n//\t\t\t\tx.Add(cin.NextInt());\n//\t\t\t\ty.Add(cin.NextInt());\n//\t\t\t}\n//\t\t\tx = x.Distinct().ToList();\n//\t\t\ty = y.Distinct().ToList();\n//\t\t\tif (x.Count == 2 && y.Count == 2)\n//\t\t\t{\n//\t\t\t\tvar area = Math.Abs(x[0] - x[1]) * Math.Abs(y[0] - y[1]);\n//\t\t\t\tConsole.WriteLine(area);\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\tprivate static readonly Scanner cin = new Scanner();\n\n//\t\tprivate static void Main()\n//\t\t{\n//#if DEBUG\n//\t\t\tConsole.SetIn(new StreamReader(@\"..\\..\\input.txt\"));\n//#endif\n//\t\t\tnew Template().Solve();\n//\t\t\tConsole.ReadLine();\n//#if DEBUG\n//\t\t\tConsole.ReadKey();\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//}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f44b63243a76706e4e395ad2929f2b8f", "src_uid": "ba49b6c001bb472635f14ec62233210e", "difficulty": 1100} {"lang": "MS C#", "source_code": "using System;\nclass Program\n{\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] sayilar = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int toplam = 0;\n for(int i = 0;i deletedNums;\n static void Main(string[] args)\n\t\t{\n\t\t\tshort count = short.Parse(Console.ReadLine());\n\t\t\tvar nums = Console.ReadLine().Split(' ').Select(z => short.Parse(z)).ToList();\n\t\t\tvar sum = (short)(nums.Sum(count) / (count / 2));\n\t\t\tdeletedNums = new List(count);\n\t\t\tfor (short i = 0; i < count / 2; i++)\n\t\t\t\tn(nums, sum, count);\n\t\t}\n\t\tstatic void n(List nums, short sum ,short count)\n\t\t{\n\t\t\tshort firstindex= 0;\n\t\t\tfor (short i = 0; i x==i))\n\t\t\t\t{\n\t\t\t\t\tfirstindex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar first = nums[firstindex];\n\t\t\tdeletedNums.Add((short)firstindex);\n\t\t\tint secondindex = 0;\n\t\t\tfor (short i = firstindex; i < count; i++)\n\t\t\t{\n\t\t\t\tif (nums[i]+first==sum & (!deletedNums.Any(x => x == i)))\n\t\t\t\t{\n\t\t\t\t\tsecondindex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeletedNums.Add((short)secondindex);\n\t\t\t\n\t\t\tConsole.WriteLine($\"{firstindex + 1} {secondindex + 1}\");\n\t\t}\n\t\t\n\t}\n\tpublic static class M\n\t{\n\t\tpublic static int Sum(this List o, short count)\n\t\t{\n\t\t\tshort i = 0;\n\t\t\tfor (int u = 0; u < count; u++)\n\t\t\t{\n\t\t\t\ti += o[u];\n\t\t\t}\n\t\t\treturn i;\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "40be236098185541d24417e17aa8749e", "src_uid": "6e5011801ceff9d76e33e0908b695132", "difficulty": 800} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Contest364A\n{\n\tclass Program\n\t{\n\t\tstatic List deletedNums;\n static void Main(string[] args)\n\t\t{\n\t\t\tshort count = short.Parse(Console.ReadLine());\n\t\t\tvar nums = Console.ReadLine().Split(' ').Select(z => short.Parse(z)).ToList();\n\t\t\tvar sum = (short)(nums.Sum(count) / (count / 2));\n\t\t\tdeletedNums = new List(count);\n\t\t\tfor (short i = 0; i < count / 2; i++)\n\t\t\t\tn(nums, sum, count);\n\t\t\tConsole.Read();\n\t\t}\n\t\tstatic void n(List nums, short sum ,short count)\n\t\t{\n\t\t\tshort firstindex= 0;\n\t\t\tfor (short i = 0; i x==i))\n\t\t\t\t{\n\t\t\t\t\tfirstindex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar first = nums[firstindex];\n\t\t\tdeletedNums.Add((short)firstindex);\n\t\t\tint secondindex = 0;\n\t\t\tfor (short i = firstindex; i < count; i++)\n\t\t\t{\n\t\t\t\tif (nums[i]+first==sum & (!deletedNums.Any(x => x == i)))\n\t\t\t\t{\n\t\t\t\t\tsecondindex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeletedNums.Add((short)secondindex);\n\t\t\t\n\t\t\tConsole.WriteLine($\"{firstindex + 1} {secondindex + 1}\");\n\t\t}\n\t\t\n\t}\n\tpublic static class M\n\t{\n\t\tpublic static int Sum(this List o, short count)\n\t\t{\n\t\t\tshort i = 0;\n\t\t\tfor (int u = 0; u < count; u++)\n\t\t\t{\n\t\t\t\ti += o[u];\n\t\t\t}\n\t\t\treturn i;\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9e84dc3316dc9a2aeb82e46ca3e9e5bb", "src_uid": "6e5011801ceff9d76e33e0908b695132", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {0D76C9E7-FD9E-4713-B82F-27910CE473BD}\n Exe\n Properties\n ConsoleApplication9\n ConsoleApplication9\n v4.6.1\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "40af696e97e642e129599d45ef2fca16", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "difficulty": 1000} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces_Type_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\t\t\t int[] a;\n a = getLineInt(Console.ReadLine());\n int sum = a.Sum();\n bool yep = false;\n for (int i = 0; i < a.Length && !yep; i++)\n {\n for (int z = i; z < a.Length && !yep; z++)\n {\n for (int j = z; j < a.Length && !yep; j++)\n {\n int temp = a[i]+a[z]+a[j];\n if (sum - temp == temp)\n {\n yep = true;\n } \n }\n }\n }\n Console.WriteLine((yep == true) ? \"yes\" : \"no\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5a9cb23c8f70213bfaec52606fe2087c", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Median\n{\n class Benches\n {\n public static void 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 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 \n\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "467724ec6ab85dd34cb58f6236176ed9", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100} {"lang": "Mono C#", "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 MakotoAndABlackboard\n {\n const int MOD = 1000000000 + 7;\n\n ModMath math = new ModMath(MOD);\n\n public static void Main()\n {\n StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n new MakotoAndABlackboard().Solve(Console.In, sw);\n sw.Flush();\n }\n\n public void Solve(TextReader tr, TextWriter tw)\n {\n var a = tr.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n tw.WriteLine(Solve(a[0], a[1]));\n }\n\n public int Solve(long n, int k)\n {\n var res = 1L;\n for (long a = 2; a <= n; a++)\n {\n var numPrime = 0L;\n while (a <= n && n % a == 0)\n {\n numPrime++;\n n /= a;\n }\n if (numPrime == 0)\n {\n continue;\n }\n var dp = new long[k + 1, numPrime + 1];\n dp[0, numPrime] = 1;\n for (int i = 1; i <= k; i++)\n {\n for (int j = 0; j <= numPrime; j++)\n {\n for (int l = j; l <= numPrime; l++)\n {\n dp[i, j] = math.Add(dp[i, j], math.Div(dp[i - 1, l], l + 1));\n }\n }\n }\n\n var t = 0L;\n for (int j = 0; j <= numPrime; j++)\n {\n t = math.Add(t, math.Mul(dp[k, j], math.Pow(a, j)));\n }\n res = math.Mul(res, t);\n\n }\n return (int)(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6a6a1d0ed7ec7b5004604c213092f756", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "difficulty": 2200} {"lang": "Mono C#", "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 MakotoAndABlackboard\n {\n const int MOD = 1000000000 + 7;\n\n ModMath math = new ModMath(MOD);\n\n public static void Main()\n {\n StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n new MakotoAndABlackboard().Solve(Console.In, sw);\n sw.Flush();\n }\n\n public void Solve(TextReader tr, TextWriter tw)\n {\n var a = tr.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n tw.WriteLine(Solve(a[0], a[1]));\n }\n\n public int Solve(long n, int k)\n {\n var res = 1L;\n for (long a = 2; a * a <= n; a++)\n {\n var np = GetNumPrime(a, n);\n var numPrime = np.Item1;\n n = np.Item2;\n if (numPrime == 0)\n {\n continue;\n }\n\n res = math.Mul(res, Calculate(k, a, numPrime));\n }\n if (n != 1)\n {\n res = math.Mul(res, Calculate(k, n, 1));\n }\n return (int)(res);\n }\n\n private long Calculate(int k, long a, long numPrime)\n {\n var dp = new long[k + 1, numPrime + 1];\n dp[0, numPrime] = 1;\n for (int i = 1; i <= k; i++)\n {\n for (int j = 0; j <= numPrime; j++)\n {\n for (int l = j; l <= numPrime; l++)\n {\n dp[i, j] = math.Add(dp[i, j], math.Div(dp[i - 1, l], l + 1));\n }\n }\n }\n\n var t = 0L;\n for (int j = 0; j <= numPrime; j++)\n {\n t = math.Add(t, math.Mul(dp[k, j], math.Pow(a, j)));\n }\n return t;\n }\n\n Tuple GetNumPrime(long a, long n)\n {\n var numPrime = 0L;\n while (n % a == 0)\n {\n numPrime++;\n n /= a;\n }\n return Tuple.Create(numPrime, n);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a09f5d8b53741ad11a7f8c839bba716c", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "difficulty": 2200} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n public class MakotoAndABlackboard\n {\n const int MOD = 1000000000 + 7;\n\n ModMath math = new ModMath(MOD);\n\n public int Solve(long n, int k)\n {\n var res = 1L;\n for (long a = 2; a <= n; a++)\n {\n var numPrime = 0L;\n while (a <= n && n % a == 0)\n {\n numPrime++;\n n /= a;\n }\n if (numPrime == 0)\n {\n continue;\n }\n var dp = new long[k + 1, numPrime + 1];\n dp[0, numPrime] = 1;\n for (int i = 1; i <= k; i++)\n {\n for (int j = 0; j <= numPrime; j++)\n {\n for (int l = j; l <= numPrime; l++)\n {\n dp[i, j] = math.Add(dp[i, j], math.Div(dp[i - 1, l], l + 1));\n }\n }\n }\n\n var t = 0L;\n for (int j = 0; j <= numPrime; j++)\n {\n t = math.Add(t, math.Mul(dp[k, j], math.Pow(a, j)));\n }\n res = math.Mul(res, t);\n\n }\n return (int)(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bb29ed7dea78963484cedd6378ed0d9c", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "difficulty": 2200} {"lang": "Mono C#", "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 boolean[10000];\n var solved = new boolean[10000];\n for (int i = 1; i<=numCount; ++i) {\n if (a[i] %2 == color) {\n poop[a[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 (!poop[j] && Math.Abs(j-a[i]) < plcDis) {\n plcDis = Math.Abs(j-a[i]);\n plc = j;\n }\n }\n poop[j] = true;\n solved[i] = true;\n result += Math.Abs(j-a[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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e691c907ef704aac99e69e2a944824bc", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "difficulty": 1100} {"lang": "Mono C#", "source_code": "\ufeffusing 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0dc201a3c8027bf496ba219b519964da", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "14bec11ae4b282205baf70c501bc111c", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "df67e591d1d9ec63cbd09282eb5e973b", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300} {"lang": "MS C#", "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 &&a+1>=1 &&a+1 <=b)==sa) res++;\n }\n Console.Write(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3101052d92b1381b4fcada596cf04121", "src_uid": "36a211f7814e77339eb81dc132e115e1", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5cf89b0cc3f070e04cd4c5cd612eefdd", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200} {"lang": "Mono C#", "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 int n = int.Parse(Console.ReadLine());\n int s = 0;\n int[,] a = new int[n, n];\n for (int i = 0; i < n; i++)\n {\n string temp = Console.ReadLine();\n string[] input = temp.Split(' ');\n for (int j = 0; j < n; j++)\n {\n a[i, j] = int.Parse(input[j]);\n if (i - j == 0) s += a[i, j];\n if (i + j == n - 1) s += a[i, j];\n if (i == (n - 1) / 2) s += a[i, j];\n if (j == (n - 1) / 2) s += a[i, j];\n }\n }\n s = s - 3 * a[(n - 1) / 2, (n - 1) / 2];\n Console.WriteLine(s);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2c66576448faf29928518cc73cd927e2", "src_uid": "5ebfad36e56d30c58945c5800139b880", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass Program\n{\n static void Main()\n {\n //Input\n string rookPos = Console.ReadLine();\n string horsePos = Console.ReadLine();\n\n //Solution\n char blockedLetter = rookPos[0], blockedNumber = rookPos[1];\n string horseCells = GenerateHorseCells(horsePos);\n\n string GenerateHorseCells(string horsePosition)\n {\n char horseLetter = horsePosition[0], horseNumber = horsePosition[1];\n string res = \"\";\n res = horsePosition + ((char)(horseLetter - 2) + \"\" + (char)(horseNumber + 1)) + \"\"\n + ((char)(horseLetter - 2) + \"\" + (char)(horseNumber - 1)) + \"\"\n + ((char)(horseLetter - 1) + \"\" + (char)(horseNumber + 2)) + \"\"\n + ((char)(horseLetter - 1) + \"\" + (char)(horseNumber - 2)) + \"\"\n + ((char)(horseLetter + 1) + \"\" + (char)(horseNumber + 2)) + \"\"\n + ((char)(horseLetter + 1) + \"\" + (char)(horseNumber - 2)) + \"\"\n + ((char)(horseLetter + 2) + \"\" + (char)(horseNumber + 1)) + \"\"\n + ((char)(horseLetter + 2) + \"\" + (char)(horseNumber - 1)) + \"\";\n return res;\n }\n\n int ans = 0;\n for(char q = 'a'; q < 'h'+1; ++q)\n {\n for(char e = '1'; e < '8' +1; ++e)\n {\n string pos = new string(new char[] {q,e});\n string newHorseSells = GenerateHorseCells(pos);\n if (pos != rookPos && pos.Contains(blockedLetter) == false\n && pos.Contains(blockedNumber) == false\n && horseCells.Contains(pos) == false\n && newHorseSells.Contains(rookPos) == false) ++ans;\n }\n }\n Console.WriteLine(ans);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b91cc9c4cfcc0b683c027cc9c5b86db9", "src_uid": "073023c6b72ce923df2afd6130719cfc", "difficulty": 1200} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass Program\n{\n static void Main()\n {\n //Input\n string rookPos = Console.ReadLine();\n string horsePos = Console.ReadLine();\n\n //Solution\n char blockedLetter = rookPos[0], blockedNumber = rookPos[1];\n string horseCells = GenerateHorseCells(horsePos);\n\n string GenerateHorseCells(string horsePosition)\n {\n char horseLetter = horsePosition[0], horseNumber = horsePosition[1];\n return horsePosition + ((char)(horseLetter - 2) + \"\" + (char)(horseNumber + 1)) + \"\"\n + ((char)(horseLetter - 2) + \"\" + (char)(horseNumber - 1)) + \"\"\n + ((char)(horseLetter - 1) + \"\" + (char)(horseNumber + 2)) + \"\"\n + ((char)(horseLetter - 1) + \"\" + (char)(horseNumber - 2)) + \"\"\n + ((char)(horseLetter + 1) + \"\" + (char)(horseNumber + 2)) + \"\"\n + ((char)(horseLetter + 1) + \"\" + (char)(horseNumber - 2)) + \"\"\n + ((char)(horseLetter + 2) + \"\" + (char)(horseNumber + 1)) + \"\"\n + ((char)(horseLetter + 2) + \"\" + (char)(horseNumber - 1)) + \"\";\n }\n\n int ans = 0;\n for(char q = 'a'; q < 'h'+1; ++q)\n {\n for(char e = '1'; e < '8' +1; ++e)\n {\n string pos = new string(new char[] {q,e});\n string newHorseSells = GenerateHorseCells(pos);\n if (pos != rookPos && pos.Contains(blockedLetter) == false\n && pos.Contains(blockedNumber) == false\n && horseCells.Contains(pos) == false\n && newHorseSells.Contains(rookPos) == false) ++ans;\n }\n }\n Console.WriteLine(ans);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "97537b2ab439e87cbf09d1bed006512e", "src_uid": "073023c6b72ce923df2afd6130719cfc", "difficulty": 1200} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n\nnamespace Codeforce\n{\n\n class Program\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\n static int gcd(int a, int b)\n {\n\n int rem;\n if (b == 0)\n return a;\n\n while (true)\n {\n rem = a % b;\n if (rem == 0)\n break;\n\n a = b;\n b = rem;\n }\n return b;\n }\n\n static int lcm(int a, int b)\n {\n return (a / gcd(a, b) * b);\n }\n\n \n\n static void Main(string[] args)\n {\n var data = parseInt(Console.ReadLine());\n\n int resA = -1, resB = -1;\n double min = double.MaxValue;\n double x = data[0], y = data[1];\n for (int i = 1; i < data[2] + 1; i++)\n {\n int temp = (x * i) / y;\n \n for (int j = temp - 1; j < temp + 2; j++)\n {\n double t1 = Math.Abs((x / y) - (double)((double)j / i));\n if (j >= 0 && t1 >= 0 && min > t1)\n {\n min = t1;\n resA = j;\n resB = i;\n }\n }\n }\n\n int g = gcd(resA, resB);\n\n Console.WriteLine(\"{0}/{1}\",resA / g, resB / g);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e23ba12ea2681afcc5acec6419beff13", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n\nnamespace Codeforce\n{\n\n class Program\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\n static int gcd(int a, int b)\n {\n\n int rem;\n if (b == 0)\n return a;\n\n while (true)\n {\n rem = a % b;\n if (rem == 0)\n break;\n\n a = b;\n b = rem;\n }\n return b;\n }\n\n static int lcm(int a, int b)\n {\n return (a / gcd(a, b) * b);\n }\n\n \n\n static void Main(string[] args)\n {\n var data = parseInt(Console.ReadLine());\n\n int resA = -1, resB = -1;\n double min = double.MaxValue;\n double x = data[0], y = data[1];\n for (int i = 1; i < data[2] + 1; i++)\n {\n int temp = (x * )i) / y;\n \n for (int j = temp - 1; j < temp + 2; j++)\n {\n double t1 = Math.Abs((x / y) - (double)((double)j / i));\n if (j >= 0 && t1 >= 0 && min > t1)\n {\n min = t1;\n resA = j;\n resB = i;\n }\n }\n }\n\n int g = gcd(resA, resB);\n\n Console.WriteLine(\"{0}/{1}\",resA / g, resB / g);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4162a500e592aaaf6711ce89eaa2213d", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n\nnamespace Codeforce\n{\n\n class Program\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\n static int gcd(int a, int b)\n {\n\n int rem;\n if (b == 0)\n return a;\n\n while (true)\n {\n rem = a % b;\n if (rem == 0)\n break;\n\n a = b;\n b = rem;\n }\n return b;\n }\n\n static int lcm(int a, int b)\n {\n return (a / gcd(a, b) * b);\n }\n\n \n\n static void Main(string[] args)\n {\n var data = parseInt(Console.ReadLine());\n\n int resA = -1, resB = -1;\n double min = double.MaxValue;\n double x = data[0], y = data[1];\n for (int i = 1; i < data[2] + 1; i++)\n {\n double temp = (int)(x * (double)i) / y;\n \n for (int j = temp - 1; j < temp + 2; j++)\n {\n double t1 = Math.Abs((x / y) - (double)((double)j / i));\n if (j >= 0 && t1 >= 0 && min > t1)\n {\n min = t1;\n resA = j;\n resB = i;\n }\n }\n }\n\n int g = gcd(resA, resB);\n\n Console.WriteLine(\"{0}/{1}\",resA / g, resB / g);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b91d67a327dd1c39cc5769bbde67c64a", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "difficulty": 1700} {"lang": "C# 10", "source_code": "using System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Tester\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 n = int.Parse(Console.ReadLine());\r\n if (n <= 9)\r\n {\r\n Console.WriteLine(n);\r\n }\r\n else\r\n {\r\n var numss = new List();\r\n int sum = 0;\r\n for (int j = 9; j > 0; j--)\r\n {\r\n if (sum + j <= n)\r\n {\r\n nums.Add(j);\r\n sum += j;\r\n }\r\n }\r\n numss.Sort();\r\n numss.ForEach(Console.Write);\r\n Console.WriteLine();\r\n }\r\n }\r\n \r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "13d4507a3f66a1263ce75792eaafb605", "src_uid": "fe126aaa93acaca8c8559bc9e7e27b9f", "difficulty": 800} {"lang": "C# 10", "source_code": "using System;\r\nusing System.Collections.Generic;\r\n#sadsad\r\nnamespace Tester\r\n{\r\n#sdasdas \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 n = int.Parse(Console.ReadLine());\r\n if (n <= 9)\r\n {\r\n Console.WriteLine(n);\r\n }\r\n else\r\n {\r\n var nums = new List();\r\n int sum = 0;\r\n for (int j = 9; j > 0; j--)\r\n {\r\n if (sum + j <= n)\r\n {\r\n nums.Add(j);\r\n sum += j;\r\n }\r\n }\r\n nums.Sort();\r\n nums.ForEach(Console.Write);\r\n Console.WriteLine();\r\n }\r\n }\r\n \r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e22b2ae940f89b077d8f5e3ad87bcda7", "src_uid": "fe126aaa93acaca8c8559bc9e7e27b9f", "difficulty": 800} {"lang": "C# 10", "source_code": "\ufeffusing System;\r\n\r\nnamespace MyApp\r\n{\r\n\t/// \r\n\t/// Summary description for MyForm class.\r\n\t/// \r\n\tclass MyForm : Form\r\n\t{\r\n\t\tLabel Label1;\r\n\r\n\t\tpublic MyForm()\r\n\t\t{\r\n\t\t\t// Define a label, and specify its text to display, position and size\r\n\t\t\tLabel1 = new Label();\r\n\t\t\tLabel1.Text = \"Welcome to MyApp!\";\r\n\t\t\tLabel1.AutoSize = true;\r\n\t\t\tLabel1.Location = new Point(30,30);\r\n\r\n\t\t\t// Text to be Displayed in the Caption-Title Bar\r\n\t\t\tthis.Text = \"MyApp\";\r\n\t\t\tthis.StartPosition = FormStartPosition.CenterScreen;\r\n\t\t\tthis.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;\r\n\t\t\tthis.MaximizeBox = false;\r\n\t\t\tthis.Name = \"MainForm\";\r\n\r\n\t\t\t// Add the label to the array of controls of the form\r\n\t\t\tthis.Controls.Add(Label1);\r\n\t\t}\r\n\r\n\t\tpublic static void Main()\r\n\t\t{\r\n\t\tint n=Convert.ToInt32(Console.ReadLine());\r\n\t\tint c=0,k=0,l=0;\r\n\t\tstring s=\"\";\r\n\t\tint[] a=new int[n+1];\r\n\t\tstring[] q=new string[n+1];\r\n\t\t\r\n\t\t for (int j=1; j<=n; j++)\r\n\t\t {\r\n\t\t a[j]=Convert.ToInt32(Console.ReadLine());\r\n\t\t k=a[j];\r\n\t\t if (a[j]<=9)\r\n\t\t {\r\n\t\t q[j]=a[j].ToString();\r\n\t\t }\r\n\t\t else\r\n\t\t {\r\n\t\t for (int i=9; i>=1; i--)\r\n\t\t\t{\r\n\t\t\tk=k-i;\r\n\t\t\tif (k>0)\r\n\t\t\t{\r\n\t\t\tl=k;\r\n\t\t\ts=i.ToString()+s;\r\n\t\t\t}\r\n\t\t\tq[j]=l.ToString()+s;\r\n\t\t\t}\r\n\t\t\ts=\"\";\r\n\t\t }\r\n\t\t }\r\n\t\t\tfor (int i=1; i<=n; i++)\r\n\t\t {\r\n\t\t Console.WriteLine(q[i]);\r\n\t\t }\r\n\t\t\tConsole.ReadKey();\r\n\t\t}\r\n\t}\r\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4ed75da736de7788def8102dbb8cf053", "src_uid": "fe126aaa93acaca8c8559bc9e7e27b9f", "difficulty": 800} {"lang": "C# 10", "source_code": "\ufeffusing System;\r\n\r\nnamespace MyApp\r\n{\r\n\t\r\n\r\n\tclass MyForm : Form\r\n\t{\r\n\t\tLabel Label1;\r\n\r\n\t\tpublic MyForm()\r\n\t\t{\r\n\t\t\t// Define a label, and specify its text to display, position and size\r\n\t\t\tLabel1 = new Label();\r\n\t\t\tLabel1.Text = \"Welcome to MyApp!\";\r\n\t\t\tLabel1.AutoSize = true;\r\n\t\t\tLabel1.Location = new Point(30,30);\r\n\r\n\t\t\t// Text to be Displayed in the Caption-Title Bar\r\n\t\t\tthis.Text = \"MyApp\";\r\n\t\t\tthis.StartPosition = FormStartPosition.CenterScreen;\r\n\t\t\tthis.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;\r\n\t\t\tthis.MaximizeBox = false;\r\n\t\t\tthis.Name = \"MainForm\";\r\n\r\n\t\t\t// Add the label to the array of controls of the form\r\n\t\t\tthis.Controls.Add(Label1);\r\n\t\t}\r\n\r\n\t\tpublic static void Main()\r\n\t\t{\r\n\t\tint n=Convert.ToInt32(Console.ReadLine());\r\n\t\tint c=0,k=0,l=0;\r\n\t\tstring s=\"\";\r\n\t\tint[] a=new int[n+1];\r\n\t\tstring[] q=new string[n+1];\r\n\t\t\r\n\t\t for (int j=1; j<=n; j++)\r\n\t\t {\r\n\t\t a[j]=Convert.ToInt32(Console.ReadLine());\r\n\t\t k=a[j];\r\n\t\t if (a[j]<=9)\r\n\t\t {\r\n\t\t q[j]=a[j].ToString();\r\n\t\t }\r\n\t\t else\r\n\t\t {\r\n\t\t for (int i=9; i>=1; i--)\r\n\t\t\t{\r\n\t\t\tk=k-i;\r\n\t\t\tif (k>0)\r\n\t\t\t{\r\n\t\t\tl=k;\r\n\t\t\ts=i.ToString()+s;\r\n\t\t\t}\r\n\t\t\tq[j]=l.ToString()+s;\r\n\t\t\t}\r\n\t\t\ts=\"\";\r\n\t\t }\r\n\t\t }\r\n\t\t\tfor (int i=1; i<=n; i++)\r\n\t\t {\r\n\t\t Console.WriteLine(q[i]);\r\n\t\t }\r\n\t\t\tConsole.ReadKey();\r\n\t\t}\r\n\t}\r\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "44ff84d1663538ce5ac302b54e7412e0", "src_uid": "fe126aaa93acaca8c8559bc9e7e27b9f", "difficulty": 800} {"lang": "C# 10", "source_code": "\ufeffnamespace MyApp\r\n{\r\n\t/// \r\n\t/// Summary description for MyForm class.\r\n\t/// \r\n\tclass MyForm : Form\r\n\t{\r\n\t\tLabel Label1;\r\n\r\n\t\tpublic MyForm()\r\n\t\t{\r\n\t\t\t// Define a label, and specify its text to display, position and size\r\n\t\t\tLabel1 = new Label();\r\n\t\t\tLabel1.Text = \"Welcome to MyApp!\";\r\n\t\t\tLabel1.AutoSize = true;\r\n\t\t\tLabel1.Location = new Point(30,30);\r\n\r\n\t\t\t// Text to be Displayed in the Caption-Title Bar\r\n\t\t\tthis.Text = \"MyApp\";\r\n\t\t\tthis.StartPosition = FormStartPosition.CenterScreen;\r\n\t\t\tthis.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;\r\n\t\t\tthis.MaximizeBox = false;\r\n\t\t\tthis.Name = \"MainForm\";\r\n\r\n\t\t\t// Add the label to the array of controls of the form\r\n\t\t\tthis.Controls.Add(Label1);\r\n\t\t}\r\n\r\n\t\tpublic static void Main()\r\n\t\t{\r\n\t\tint n=Convert.ToInt32(Console.ReadLine());\r\n\t\tint c=0,k=0,l=0;\r\n\t\tstring s=\"\";\r\n\t\tint[] a=new int[n+1];\r\n\t\tstring[] q=new string[n+1];\r\n\t\t\r\n\t\t for (int j=1; j<=n; j++)\r\n\t\t {\r\n\t\t a[j]=Convert.ToInt32(Console.ReadLine());\r\n\t\t k=a[j];\r\n\t\t if (a[j]<=9)\r\n\t\t {\r\n\t\t q[j]=a[j].ToString();\r\n\t\t }\r\n\t\t else\r\n\t\t {\r\n\t\t for (int i=9; i>=1; i--)\r\n\t\t\t{\r\n\t\t\tk=k-i;\r\n\t\t\tif (k>0)\r\n\t\t\t{\r\n\t\t\tl=k;\r\n\t\t\ts=i.ToString()+s;\r\n\t\t\t}\r\n\t\t\tq[j]=l.ToString()+s;\r\n\t\t\t}\r\n\t\t\ts=\"\";\r\n\t\t }\r\n\t\t }\r\n\t\t\tfor (int i=1; i<=n; i++)\r\n\t\t {\r\n\t\t Console.WriteLine(q[i]);\r\n\t\t }\r\n\t\t\tConsole.ReadKey();\r\n\t\t}\r\n\t}\r\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b7c33210c449230c6de4eb722f75688a", "src_uid": "fe126aaa93acaca8c8559bc9e7e27b9f", "difficulty": 800} {"lang": "MS C#", "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 MischievousMessMakers().Solve(new TextInputHelper(Console.In)));\n }\n }\n\n internal class MischievousMessMakers : ISolver\n {\n public string Solve(InputHelper input)\n {\n int n = input.ReadInt(), k = input.ReadInt();\n k = Math.Min(k, n / 2);\n long result = 0, cur = n - 1;\n for (int i = 0; i < k; ++i)\n {\n result += cur + cur - 1;\n cur -= 2;\n }\n return result.ToString();\n }\n }\n\n internal interface ISolver\n {\n string Solve(InputHelper input);\n }\n\n internal abstract class InputHelper\n {\n private Queue tokens;\n private IEnumerator current;\n\n public InputHelper()\n {\n this.tokens = new Queue();\n }\n\n public int ReadInt()\n {\n ThrowIfNoNext();\n return int.Parse(this.tokens.Dequeue());\n }\n\n public long ReadLong()\n {\n ThrowIfNoNext();\n return long.Parse(this.tokens.Dequeue());\n }\n\n public string ReadString()\n {\n ThrowIfNoNext();\n return this.tokens.Dequeue();\n }\n\n public bool HasNext()\n {\n return this.tokens.Count == 0 ? this.EnsureData() : true;\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 (!this.HasNext())\n {\n throw new InvalidOperationException(\"no more data\");\n }\n }\n\n private bool EnsureData()\n {\n if (this.tokens.Count == 0)\n {\n while (this.current == null || !this.current.MoveNext())\n {\n var next = this.GetNextGroup();\n\n if (next == null)\n {\n return false;\n }\n else\n {\n this.current = next.GetEnumerator();\n }\n }\n\n this.tokens.Enqueue(this.current.Current);\n }\n\n return true;\n }\n }\n\n internal 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 else\n {\n var cur = this.reader;\n this.reader = null;\n return cur.ReadWordsToEnd();\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ba3c8d3a3a2752e0d6e3555e592ee722", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\n\npublic static class Program\n{\n public static void Main(string[] args){\n string s = Console.ReadLine();\n int length = s.Count + 1;\n Console.WriteLine((26 * length) - length);\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "568afdcb0ff1b8d144e9ae02bcd32189", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900} {"lang": "MS C#", "source_code": "string s = Console.ReadLine();\nint length = s.Count + 1;\nConsole.WriteLine((26 * length) - length);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d0e3b8f7ca102338336ae0408749204b", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900} {"lang": "Mono C#", "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 = i * (int)Math.Ceiling((double)(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 private unsafe 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "251f4c095070c16798e426cd419eaa8b", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "difficulty": 1400} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\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; BigInteger cur = 1;\n for (int x = 2; 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "07eaabf9c0ff3319def9635b953b86b7", "src_uid": "3bed682b6813f1ddb54410218c233cff", "difficulty": 1400} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nusing System.Numerics;\nusing System.Threading.Tasks;\n\n\nnamespace Codeforce\n{\n\n class Program\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\n static int PowMod(int x, int e, int mod)\n {\n int res;\n\n if (e == 0)\n {\n res = 1;\n }\n else if (e == 1)\n {\n res = x;\n }\n else\n {\n res = PowMod(x, e / 2, mod);\n res = res * res % mod;\n if (e % 2 > 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e39244c27925e103883332f3bc49e302", "src_uid": "3bed682b6813f1ddb54410218c233cff", "difficulty": 1400} {"lang": "Mono C#", "source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n int[] vls, dls;\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n vls = new int[3] {int.Parse(input[0]), int.Parse(input[1]), int.Parse(input[2])};\n }\n dls = new int [3] { 1, 2, 3 };\n Array.Sort(vls, dls);\n int a = vls[0] + vls[1];\n if (a < vls[2] || (a + vls[2]) % 2 == 1) Console.WriteLine(\"Impossible\");\n else\n {\n a -= vls[2];\n a /= 2;\n vls[0] -= a;\n vls[1] -= a;\n if (dls[2] == 3)\n Console.WriteLine(dls[0] == 1 ? String.Format(\"{0} {1} {2}\", a, vls[1], vls[0]) : String.Format(\"{0} {1} {2}\", a, vls[0], vls[1]));\n else if (dls[2] == 2)\n Console.WriteLine(dls[0] == 1 ? String.Format(\"{0} {1} {2}\", vls[0], vls[1], a) : String.Format(\"{0} {1} {2}\", vls[1], vls[0], a));\n else\n Console.WriteLine(dls[0] == 2 ? String.Format(\"{0} {1} {2}\", vls[0], a, vls[1]) : String.Format(\"{0} {1} {2}\", vls[1], a, vls[0]));\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a535a0ff05f1c1bf1b7e33976569dd44", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200} {"lang": "Mono C#", "source_code": "using System;\nusing static System.Linq.Enumerable;\nclass Solution {\n\n static void Main(string [] args) {\n var A = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n if (A.Sum() % 2 > 0) {\n Console.WriteLine(\"Impossible\");\n }\n else {\n int[] ans = {0, 0, 0};\n while (A.Sum() > 0) {\n int argMin = A.ToList().IndexOf(A.Min());\n int i = (argMin + 1) % 3, j = (i + 1) % 3;\n --A[i]; --A[j];\n ++ans[i];\n }\n Console.WriteLine(string.Join(' ', ans));\n }\n }\n};\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "164b208f2654ff1a72ec43cbea474d78", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemSets\n{\n using System;\n using System.Collections.Generic;\n using System.Collections;\n using System.Linq;\n using System.Text;\n\n namespace LongPath\n {\n public class Problem420b\n {\n public static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n var numberOfPeople = input[0];\n var numberOfMessage = input[1];\n var employees = new int[100000 + 1];\n\n for (int i = 1; i <= numberOfPeople; i++)\n {\n employees[i] = 99;\n }\n\n var NotALeader = new ArrayList();\n\n\n for (int i = 0; i < numberOfMessage; i++)\n {\n\n var status = Console.ReadLine().Split(' ');\n var symbol = status[0][0];\n var id = int.Parse(status[1]);\n\n if (symbol == '+')\n {\n for (int j = 1; j <= numberOfPeople; j++)\n {\n if (j == id) continue;\n if (employees[j] == 1)\n {\n NotALeader.Add(id);\n }\n if (employees[j] == 0) \n {\n NotALeader.Add(j);\n }\n }\n employees[id] = 1;\n }\n\n if (symbol == '-')\n {\n var prevStatusOfEmployee = employees[id];\n\n \n else if (prevStatusOfEmployee == 1)\n {\n\n for (int j = 1; j <= numberOfPeople; j++)\n {\n if (j == id) continue;\n if (employees[j] == 1 || employees[j]== 0)\n {\n NotALeader.Add(id);\n }\n }\n }\n else if (prevStatusOfEmployee == 99)\n {\n for (int j = 1; j <= numberOfPeople; j++)\n {\n if (j == id) continue;\n if (employees[j] == 1)\n {\n NotALeader.Add(id);\n NotALeader.Add(j);\n }\n }\n }\n\n employees[id] = 0;\n }\n lastEmployeeID = id;\n }\n\n var leaders = new ArrayList();\n for (int i = 1; i <= numberOfPeople; i++)\n {\n\n if (employees[i] == 99 || employees[i] == 1)\n {\n if (!NotALeader.Contains(i)) leaders.Add(i);\n }\n else if (!NotALeader.Contains(i)) leaders.Add(i);\n }\n\n var numberOfLeader = leaders.Count;\n Console.WriteLine(numberOfLeader);\n\n foreach (var leader in leaders)\n {\n Console.Write(leader);\n Console.Write(\" \");\n }\n\n }\n }\n }\n\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d10acc437c16c59b599299a1fc4c1ae2", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800} {"lang": "MS C#", "source_code": "public class Problem420b\n {\n public static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n var numberOfPeople = input[0];\n var numberOfMessage = input[1];\n var employees = new int[100000];\n\n for (int i = 0; i < numberOfPeople; i++)\n {\n employees[i] = 99;\n }\n\n var NotALeader = new ArrayList();\n for (int i = 0; i < numberOfMessage; i++)\n {\n var status = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n var symbol = status[0];\n var id = status[1];\n if (symbol == '+') employees[id] = 1;\n\n if (symbol == '-')\n {\n employees[id] = 0;\n for (int j = 0; j < numberOfPeople; j++)\n {\n if (employees[j] == 1)\n {\n NotALeader.Add(id);\n }\n }\n }\n }\n\n var leaders = new ArrayList();\n for (int i = 0; i < numberOfPeople; i++)\n {\n\n if (employees[i] == 99)\n {\n leaders.Add(i);\n }\n else if (!NotALeader.Contains(i))\n {\n leaders.Add(i);\n }\n }\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d33880bc9cf6e3ba2108e881b63e4f71", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemSets\n{\n using System;\n using System.Collections.Generic;\n using System.Collections;\n using System.Linq;\n using System.Text;\n\n namespace LongPath\n {\n public class Problem420b\n {\n public static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n var numberOfPeople = input[0];\n var numberOfMessage = input[1];\n var employees = new int[100000 + 1];\n\n for (int i = 1; i <= numberOfPeople; i++)\n {\n employees[i] = 99;\n }\n\n var NotALeader = new ArrayList();\n\n\n for (int i = 0; i < numberOfMessage; i++)\n {\n\n var status = Console.ReadLine().Split(' ');\n var symbol = status[0][0];\n var id = int.Parse(status[1]);\n\n if (symbol == '+')\n {\n for (int j = 1; j <= numberOfPeople; j++)\n {\n if (j == id) continue;\n if (employees[j] == 1)\n {\n NotALeader.Add(id);\n }\n if (employees[j] == 0) \n {\n NotALeader.Add(j);\n }\n }\n employees[id] = 1;\n }\n\n if (symbol == '-')\n {\n var prevStatusOfEmployee = employees[id];\n\n \n if (prevStatusOfEmployee == 1)\n {\n\n for (int j = 1; j <= numberOfPeople; j++)\n {\n if (j == id) continue;\n if (employees[j] == 1 || employees[j]== 0)\n {\n NotALeader.Add(id);\n }\n }\n }\n else if (prevStatusOfEmployee == 99)\n {\n for (int j = 1; j <= numberOfPeople; j++)\n {\n if (j == id) continue;\n if (employees[j] == 1)\n {\n NotALeader.Add(id);\n NotALeader.Add(j);\n }\n }\n }\n\n employees[id] = 0;\n }\n lastEmployeeID = id;\n }\n\n var leaders = new ArrayList();\n for (int i = 1; i <= numberOfPeople; i++)\n {\n\n if (employees[i] == 99 || employees[i] == 1)\n {\n if (!NotALeader.Contains(i)) leaders.Add(i);\n }\n else if (!NotALeader.Contains(i)) leaders.Add(i);\n }\n\n var numberOfLeader = leaders.Count;\n Console.WriteLine(numberOfLeader);\n\n foreach (var leader in leaders)\n {\n Console.Write(leader);\n Console.Write(\" \");\n }\n\n }\n }\n }\n\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4eb5782e465c12ee9ba9a63e68980494", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n Debug\n AnyCPU\n 9.0.30729\n 2.0\n {278E3467-7E64-46DE-AC00-08AC85518C02}\n Exe\n Properties\n CodeForces\n CodeForces\n v2.0\n 512\n \n \n \n \n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n true\n \n \n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n true\n \n \n \n \n 3.5\n \n \n 3.5\n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b56ad7ceded5ca5a70c993e2ec67c06", "src_uid": "62db589bad3b7023418107de05b7a8ee", "difficulty": 2000} {"lang": "Mono C#", "source_code": "string[] input = Console.ReadLine().Split(' ');\nint n = Convert.ToInt32( input [ 0 ] );\nint a = Convert.ToInt32( input [ 1 ] );\nint result = 1;\n\nif ( a == 1 || a == n )\n result = 1;\nelse\n{\n if ( a % 2 == 0 )\n {\n result += ( n - a ) / 2;\n }\n else\n {\n result += ( a - 1 ) / 2;\n }\n}\n\nConsole.WriteLine( result );", "lang_cluster": "C#", "compilation_error": true, "code_uid": "35ffccbd8c3f01a49dc70bc4ff927864", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.21005.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Doma\", \"Doma\\Doma.csproj\", \"{A9B7035C-8A7C-4EAC-8F58-4E6B7809A1D7}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{A9B7035C-8A7C-4EAC-8F58-4E6B7809A1D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{A9B7035C-8A7C-4EAC-8F58-4E6B7809A1D7}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{A9B7035C-8A7C-4EAC-8F58-4E6B7809A1D7}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{A9B7035C-8A7C-4EAC-8F58-4E6B7809A1D7}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "73bd084ae680ba3a113409eb3570f80e", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace DistanceTask\n{\n\tpublic static class DistanceTask\n\t{\n\t\t// \u0420\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0442 \u0442\u043e\u0447\u043a\u0438 (x, y) \u0434\u043e \u043e\u0442\u0440\u0435\u0437\u043a\u0430 AB \u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 A(ax, ay), B(bx, by)\n\t\tpublic static double GetDistanceToSegment(double ax, double ay, double bx, double by, double x, double y)\n\t\t{\n double perpendicular = Math.Abs((by - ay) * x - (bx - ax) * y + bx * ay - by * ax) \n / Math.Sqrt((by - ay) * (by - ay) + (bx - ax) * (bx - ax));\n double lenXA = Math.Sqrt((x - ax) * (x - ax) + (y - ay) * (y - ay));\n double lenXB = Math.Sqrt((x - bx) * (x - bx) + (y - by) * (y - by));\n double lenAB = Math.Sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));\n\n if (ax == bx && ay == by)\n return lenXA;\n else if (lenXA * lenXA > lenXB * lenXB + lenAB * lenAB || lenXB * lenXB > lenXA * lenXA + lenAB * lenAB)\n return Math.Min(lenXA, lenXB);\n else\n return perpendicular;\n }\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3909c1fda870eebb241f9d441856096c", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100} {"lang": "MS C#", "source_code": "using System;\n\nclass P {\n static void Main() {\n int n = 8;\n var rows = Console.In.ReadToEnd().Split('\\n');\n var count = 0;\n for (int i = 0; i < n; i++) {\n var cnt = n;\n for (int j = 0; j < n; j++) {\n if (rows[i][j] == 'B') { cnt--; }\n }\n if (cnt == 0) { count++; }\n }\n\n for (int i = 0; i < n; i++) {\n var cnt = n;\n for (int j = 0; j < n; j++) {\n if (rows[j][i] == 'B') { cnt--; }\n }\n if (cnt == 0) { count++; }\n }\n if (count == 16) count == 8;\n Console.WriteLine(count);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "26facc253663af9fca7093dc5c2bd9a2", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100} {"lang": "Mono C#", "source_code": "item", "lang_cluster": "C#", "compilation_error": true, "code_uid": "327f86626bc264a008317ee2bfa59c50", "src_uid": "ff810b16b6f41d57c1c8241ad960cba0", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\n if (m % i != 0 && m % i <= item) ++coef;", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fa319806ebf506bf8a98ad20361f3950", "src_uid": "ff810b16b6f41d57c1c8241ad960cba0", "difficulty": 2300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(maximize());\n }\n public static long maximize()\n {\n int size;\n int T;\n long val = 0;\n string[] str = Console.ReadLine().Split(\" \");\n size = int.Parse(str[0]);\n T = int.Parse(str[1]);\n int[] num_of_boxes = new int[T];\n long[] num_of_matches = new long[T];\n for (int i = 0; i < T; ++i)\n {\n str = Console.ReadLine().Split(\" \");\n num_of_boxes[i] = int.Parse(str[0]);\n num_of_matches[i] = int.Parse(str[1]);\n }\n while(size > 0)\n {\n long max = 0;\n for(int i = 0; i < T; ++i)\n {\n if (num_of_matches[max] < num_of_matches[i])\n max = i;\n }\n if(size > num_of_boxes[max])\n {\n val += num_of_boxes[max] * num_of_matches[max];\n size -= num_of_boxes[max];\n }\n else\n {\n val += size * num_of_matches[max];\n size = 0;\n }\n num_of_boxes[max] = int.MinValue;\n num_of_matches[max] = long.MinValue;\n }\n return val;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e488ee29efd05acab6b0edac18b2fee6", "src_uid": "c052d85e402691b05e494b5283d62679", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces._265\n{\n PUBLIC class ProblemA\n {\n public static void Main(string[] varg)\n {\n int n = int.Parse(System.Console.ReadLine());\n string s = System.Console.ReadLine();\n\n int rv = 0;\n foreach(var c in s)\n {\n rv++;\n if (c == '0')\n break;\n }\n System.Console.WriteLine(rv);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "065e229a1dd18e9711243d97664da208", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CFDIV125_3 {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\n#if DEBUG\n\t\t\tTextReader reader = new StreamReader(\"../../input.txt\");\n\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\n\t\t\t#region INIT\n\t\t\tint[] c1 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\n\t\t\tint k = c1[0];\n\t\t\tint b = c1[1];\n\t\t\tint n = c1[2];\n\t\t\tint t = c1[3];\n\n\t\t\t#endregion\n\n\t\t\tlong z = 1;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tz = k * z + b;\n\t\t\t}\n\n\t\t\tint res = z;\n\n\t\t\tz = t;\n\t\t\tlong j = 0;\n\t\t\twhile(true) {\n\t\t\t\tif (z >= res)\n\t\t\t\t\tbreak;\n\t\t\t\tj++;\n\t\t\t\tz = k * z + b;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(j);\n\n\n#if DEBUG\n\t\t\tConsole.ReadKey();\n#endif\n\n\t\t}\n\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "120474691275c3a2cab501cb986cd133", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Numerics;\n\nclass P1178C\n{\n const int P = 998244353;\n\n static void Main()\n {\n int[] args = \n Console.ReadLine()\n .Split(' ', StringSplitOptions.RemoveEmptyEntries)\n .Select(Int32.Parse)\n .ToArray();\n int w = args[0];\n int h = args[1];\n\n int exp = w + h;\n\n BigInteger answer = BigInteger.ModPow(2, exp, P); \n\n Console.WriteLine(answer);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "617a651fe6b15008f1274f647489ca4d", "src_uid": "8b2a9ae21740c89079a6011a30cd6aee", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n StringBuilder stringBuilder = new StringBuilder();\n for(int i = 0, crr=0; i x).Where(x => x == 'X').Count();\n }\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "193690f6242eb5803a9fcb2a54beba94", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\n\nclass P {\n static void Main() { \n var s = Console.ReadLine()+\"z\";\n var res = 0;\n var cur = 0;\n var last = 'a';\n foreach (var c in s) \n if (c == last) {\n if (++cur == 5) { cur = 0; res++; }\n } else {\n if (cur > 0) res++;\n cur = 1; last = c;\n }\n }\n Console.Write(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "df0f09ede8db21b7349803d4bfc41c50", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class NewYearsEve : ISolution\n {\n public override void Solve()\n {\n ulong[] NandK = ReadArrString().Select(ulong.Parse).ToArray();\n if(NandK[1]==1) \n {\n Console.Write(Nandk[0]);\n return;\n }\n sbyte logN = (sbyte)(NandK[0] != 1 ? Math.Floor(Math.Log(NandK[0], 2)) : 0);\n sbyte i = (NandK[1] >= (ulong)logN ? logN : (sbyte)NandK[1]);\n while (i >= 0)\n {\n ulong result = (ulong)(NandK[0] & (ulong)(1 << i));\n if (result == 0)\n {\n NandK[0] ^= (ulong)(1 << i--);\n }\n else\n {\n i--;\n }\n }\n Console.Write(NandK[0]);\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 \n class Solution\n {\n static void Main(string[] args)\n {\n new NewYearsEve().Solve();\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9530ba4e2f02b80cb672b7c6513145a4", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "difficulty": 1300} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class NewYearsEve : ISolution\n {\n public override void Solve()\n {\n ulong[] NandK = ReadArrString().Select(ulong.Parse).ToArray();\n if(NandK[1]==1) \n {\n Console.Write(NandK[0]);\n return;\n }\n while (NandK[0]>=0)\n {\n ulong result = 2*result + 1;\n NandK[0]>>=1;\n }\n Console.Write(result);\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 \n class Solution\n {\n static void Main(string[] args)\n {\n new NewYearsEve().Solve();\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "13b6516711d3de87946a9e19e56c44ad", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "difficulty": 1300} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class NewYearsEve : ISolution\n {\n public override void Solve()\n {\n ulong[] NandK = ReadArrString().Select(ulong.Parse).ToArray();\n ulong result;\n if(NandK[1]==1) \n {\n Console.Write(NandK[0]);\n return;\n }\n while (NandK[0]>=0)\n {\n result = 2*result + 1;\n NandK[0]>>=1;\n }\n Console.Write(result);\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 \n class Solution\n {\n static void Main(string[] args)\n {\n new NewYearsEve().Solve();\n Console.ReadLine();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4cbcbb8d5af4d4b9c5642a294714acb0", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "difficulty": 1300} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\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 Console.SetOut(new StreamWriter(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 Q(sc);\r\n }\r\n Console.Out.Flush();\r\n }\r\n\r\n void Q(Scanner sc)\r\n {\r\n int n = sc.NextInt();\r\n int m = sc.NextInt();\r\n int k = sc.NextInt();\r\n\r\n // k\u500b \u6a2a\u5411\u304d\r\n // n*m/2-k\u500b\u7e26\r\n // \r\n // \r\n // \r\n // \r\n // \r\n char[][] ans = new char[n][];\r\n for (int i = 0; i < n; i++) ans[i] = new char[m];\r\n if (m % 2 == 0)\r\n {\r\n if (n % 2 == 0)\r\n {\r\n // \u6a2a\u5411\u304d \u5076\u6570\u6bb5\r\n if (k % 2 != 0)\r\n {\r\n Console.WriteLine(\"NO\");\r\n return;\r\n }\r\n }\r\n else\r\n {\r\n // \u6a2a\u5411\u304d \u5947\u6570\u6bb5\r\n if (k < m / 2 || (k - m / 2) % 2 != 0)\r\n {\r\n Console.WriteLine(\"NO\");\r\n return;\r\n }\r\n }\r\n }\r\n else\r\n {\r\n // n\u5076\u6570\r\n if (k % 2 != 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\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ab280f015eb4c03488d3d69ce044f8e1", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "difficulty": 1700} {"lang": "Mono C#", "source_code": "/* Date: 22.03.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\\\\030\\\\B.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2018\\\\Task\\\\07 Codeforces\\\\030\\\\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\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 [] kol = new int [n];\n\t\tint [] kmp = new int [n];\n\t\t\n\t\tKMP (s, kmp);\n\n# if ( ! ONLINE_JUDGE )\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tsw.Write (kmp [i]);\n\t\tsw.WriteLine ();\n# endif\n\n\t\tint k = 0;\n\t\tif ( n < 4 )\n\t\t\tk = 0;\n\t\telse\n\t\t\tfor ( int i=n-1; i > n/2; i-- )\n\t\t\t\tif ( i % 2 == 1 )\n\t\t\t\t{\n\t\t\t\t\tif ( kmp [i] == (i+1)/2 ) // \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd!!!\n\t\t\t\t\t{\n\t\t\t\t\t\tk = i/2;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\tn -= k;\n/*\n\t\tkol [0] = 1; //kol [1] = 2; kol [2] = 3;\n\t\tfor ( int i=1; i < n; i++ )\n\t\t{\n\t\t\tif ( i % 2 == 0 )\n\t\t\t\tkol [i] = kol [i-1] + 1;\n\t\t\telse\n\t\t\t\tif ( kmp [i] == (i+1)/2 ) // \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd!!!\n\t\t\t\t\tkol [i] = Math.Min (kol [i-1], kol [i/2]) + 1;\n\t\t\t\telse\n\t\t\t\t\tkol [i] = kol [i-1] + 1;\n\t\t}\n*/\n/*\n# if ( ! ONLINE_JUDGE )\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tsw.Write (kol [i]);\n\t\tsw.WriteLine ();\n# endif\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (kol [n-1]);\n# else\n\t\tsw.WriteLine (kol [n-1]);\n\t\tsw.Close ();\n# endif\n*/\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (n]);\n# else\n\t\tsw.WriteLine (n);\n\t\tsw.Close ();\n# endif\n\n\t}\n\n\tpublic static void KMP (string s, int [] kmp)\n\t{\n\t\tint n = s.Length;\n\t\tkmp [0] = 0;\n\t\tfor ( int i=1; i < n; i++ )\n\t\t{\n\t\t\tint j = kmp [i-1];\n\t\t\twhile ( j > 0 && s [i] != s [j] )\n\t\t\t\tj = kmp [j-1];\n\t\t\tif ( s [i] == s [j] )\n\t\t\t\tj++;\n\t\t\tkmp [i] = j;\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3662d7c1a0f65231366021a96b5285a9", "src_uid": "ed8725e4717c82fa7cfa56178057bca3", "difficulty": 1400} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace \u042d\u043a\u0437\u0430\u043c\u0435\u043d\n{\n class Program\n {\n static void Main()\n {\n string nk = Console.ReadLine();\n string[] kn = nk.Split(' ');\n int n = int.Parse(kn[0]);\n int k = int.Parse(kn[1]);\n\n if (3 * n > k)\n {\n Console.WriteLine(3 * n - k);\n }\n else\n {\n Console.WriteLine(\"0\");\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e1dec85cb72c8cb0848677f8e3db64a0", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900} {"lang": "Mono C#", "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 nextInt()\n {\n int t = Console.Read();\n while ((t < '0' || t > '9') && t != '-') t = Console.Read();\n int sign = 1;\n if (t == '-')\n {\n sign = -1;\n t = Console.Read();\n }\n int x = 0;\n while (t >= '0' && t <= '9')\n {\n x *= 10;\n x += t - '0';\n t = Console.Read();\n }\n return x * sign;\n }\n static void Main(string[] args)\n {\n int n = nextInt();\n int k = nextInt();\n if (n * 3 <= k)\n Console.WriteLine(0);\n else\n Console.WriteLine(n * 3 - k);\n n = nextInt();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c5bfadd77677db4561c3119d3ed70fba", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(long.Parse(Console.ReadLine()) / 2520L);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1581bb21e3f9e1674e0d78924371711e", "src_uid": "8551308e5ff435e0fc507b89a912408a", "difficulty": 1100} {"lang": "MS C#", "source_code": "using System;\nusing Systenm.Linq;\n\nclass P {\n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var a = s[0]; var x = s[1]; var y = s[2];\n if (y < a && y > 0) {\n Console.Write(2*Math.Abs(x) < a ? 1 : -1);\n return;\n }\n var add = y / (2*a);\n y %= 2*a;\n \n if (y < a && y > 0) {\n Console.Write(2*Math.Abs(x) < a ? 2+3*add : -1);\n return;\n }\n if (y < 2*a && y > a) {\n Console.Write(x != 0 && Math.Abs(x) < a ? 2+3*add+(x<0?1:2) : -1);\n return;\n }\n Console.Write(-1);\n }\n}\n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e971b9b63528d188b0f3d16714c8b55f", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "difficulty": 1400} {"lang": "Mono C#", "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\n int n = 0, m = 0;\n Input2number(out n,out m);\n for(int i=0;i16)\n {\n Console.WriteLine(16);\n }\n else\n {\n Console.WriteLine(m);\n }\n }\n\n void Input2number(out int a,out int b)\n {\n bool f = false;\n string s = Console.ReadLine(), str = \"\";\n s += \" \";\n b = a = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == ' ')\n {\n if (f) b = Convert.ToInt32(str);\n else { a = Convert.ToInt32(str); f = true; }\n str = \"\";\n }\n else\n {\n str += s[i];\n }\n }\n }\n }\n }\n}\n// 1 7 11 5\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f9318a2a0d32bd110ce2eced7c44f611", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\n\ufeffusing System.Collections;\n\ufeffusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CodeForces\n{ \n class B\n {\n public long BinSe(int l, int r)\n {\n while (l < r)\n {\n mid = (l + r) / 2;\n if (k * (k - 1) / 2 - (k - mid) * (k - mid - 1) / 2 + 1 < n)\n l = mid + 1;\n else\n r = mid;\n }\n return r;\n }\n \n public void Run()\n {\n long[] nk = (from str in Console.ReadLine().Split(' ', '\\t') select long.Parse(str)).ToArray(); \n long n = long.Parse(ar[0]);\n long k = long.Parse(ar[1]);\n \n Console.WriteLine((k * (k + 1) / 2) - k + 1 < n : -1 ? BinSe(0, k - 1)); \n }\n }\n \n class Programm\n { \n static void Main(string[] args)\n { \n B c = new B();\n c.Run();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d59873b9293a2650c14a372b262aaf38", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\n\ufeffusing System.Collections;\n\ufeffusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CodeForces\n{\n class B\n {\n public long BinSe(long l2, long r2, long k, long n)\n {\n long mid = 0;\n long l = l2;\n long r = r2;\n\n while (l < r)\n {\n mid = (l + r) / 2;\n if (k * (k - 1) / 2 - (k - mid) * (k - mid - 1) / 2 + 1 < n)\n l = mid + 1;\n else\n r = mid;\n }\n return r;\n }\n\n public void Run()\n {\n long[] nk = (from str in Console.ReadLine().Split(' ', '\\t') select long.Parse(str)).ToArray(); \n long n = nk[0];\n long k = nk[1];\n \n Console.WriteLine((k * (k + 1) / 2) - k + 1 < n ? -1 : BinSe(0, k - 1, k, n)); \n }\n }\n\n class Programm\n {\n static void Main(string[] args)\n {\n B c = new B();\n c.Run();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "40c85bc7484a302570843681cab7f8a9", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Runtime.Intrinsics.X86;\nusing static System.Console;\nnamespace test\n{\n class Program\n {\n private static string[] a = new string[3];\n private static bool b = false;\n static void Main()\n {\n a[0] = ReadLine();\n a[1] = ReadLine();\n a[2] = ReadLine();\n check(\"rock\", \"scissors\");\n check(\"scissors\", \"paper\");\n check(\"paper\", \"rock\");\n if (b == false)\n WriteLine(\"?\");\n }\n private static void check(string ar, string br)\n {\n int index = 4;\n int licznik = 0;\n for (int i = 0; i < 3; i++)\n {\n if (a[i].Equals(ar)) index = i;\n else if (a[i].Equals(br)) licznik++;\n }\n if (licznik == 2 && index != 4) winner(index);\n }\n private static void winner(int i)\n {\n b = true;\n if (i == 0) WriteLine(\"F\");\n if (i == 1) WriteLine(\"M\");\n if (i == 2) WriteLine(\"S\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9fbbed15afda5d20d18329f9e3918116", "src_uid": "072c7d29a1b338609a72ab6b73988282", "difficulty": 900} {"lang": "Mono C#", "source_code": " static void Main(string[] args)\n {\n Console.ReadLine();\n\n var strings = Console.ReadLine();\n\n var hi = strings.Split(' ').ToList();\n\n var numbers = hi.Select(x => int.Parse(x)).ToList();\n numbers.Sort();\n\n var answer = 0;\n\n var lastNumber = numbers.Last();\n\n if (lastNumber >= 25)\n {\n answer = lastNumber - 25;\n }\n\n Console.WriteLine(answer);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d1177338f406199af85307f38a71e9cb", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800} {"lang": "Mono C#", "source_code": "\tusing System;\n\tusing System.Linq;\n\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToHashSet();\n\n int j = 1;\n for (int i = 0; i < n; i ++) \n {\n while(!arr.Contains(j)) \n {\n j++;\n }\n j++;\n }\n\n Console.WriteLine(j - n - 1);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eee3a19f8f60f02cf6edfb619a61a1c4", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800} {"lang": "Mono C#", "source_code": "#include \n#include\n#include\ntypedef long long int ll;\n\nconstexpr ll Mod = (119 << 23) + 1;\nconstexpr int E = 23;\nconstexpr ll O = 31;\nconstexpr ll InvO = 128805723;\n\nll Z[E + 1], InvZ[E + 1];\n\nvoid Init() {\n\tZ[E] = O;\n\tInvZ[E] = InvO;\n\tfor (int i = E - 1; i >= 0; i--) {\n\t\tZ[i] = (Z[i + 1] * Z[i + 1]) % Mod;\n\t\tInvZ[i] = (InvZ[i + 1] * InvZ[i + 1]) % Mod;\n\t}\n}\n\nll Pow(ll x, ll y) {\n\tll result = 1;\n\twhile (y > 0)\n\t{\n\t\tif (y % 2 == 1) {\n\t\t\tresult *= x;\n\t\t\tresult %= Mod;\n\t\t}\n\t\tx *= x;\n\t\tx %= Mod;\n\t\ty /= 2;\n\t}\n\n\treturn result;\n}\n\nll Inv(ll x) {\n\treturn Pow(x, Mod - 2);\n}\n\n// d\u6841\u306ev\u3092\u9006\u9806\u306b\u3059\u308b\nint bits_rev(int v, int d)\n{\n\tint result = 0;\n\tfor (int i = 0; i < d; i++) {\n\t\tif ((v & (1 << i))) result |= 1 << (d - i - 1);\n\t}\n\treturn result;\n}\n\nvoid Transform(std::vector& a, int len, int lg, bool inverse) {\n\tfor (int i = 0; i < len; i++) {\n\t\tint rev = bits_rev(i, lg);\n\t\tif (i >= rev) continue;\n\t\tll t = a[i];\n\t\ta[i] = a[rev];\n\t\ta[rev] = t;\n\t}\n\n\tfor (int i = 1; i <= lg; i++) {\n\t\tint b = 1 << (i - 1);\n\t\tll z = 1;\n\t\tfor (int j = 0; j < b; j++) {\n\t\t\tfor (int k = j; k < len; k += (b << 1)) {\n\t\t\t\tll t = (z * a[k + b]) % Mod;\n\t\t\t\tll u = a[k];\n\t\t\t\ta[k] = (u + t) % Mod;\n\t\t\t\ta[k + b] = (u - t) % Mod;\n\t\t\t\tif (a[k + b] < 0) a[k + b] += Mod;\n\t\t\t}\n\t\t\tz *= inverse ? InvZ[i] : Z[i];\n\t\t\tz %= Mod;\n\t\t}\n\t}\n}\n\nvoid Convolution(std::vector& a, std::vector b, bool eq) {\n\tint sz = a.size() + b.size() - 1;\n\tint len = 1;\n\tint lg = 0;\n\twhile (len < sz)\n\t{\n\t\tlg++;\n\t\tlen *= 2;\n\t}\n\n\ta.resize(len);\n\tTransform(a, len, lg, false);\n\n\tif (eq) {\n\t\tfor (int i = 0; i < len; i++) {\n\t\t\ta[i] *= a[i];\n\t\t\ta[i] %= Mod;\n\t\t}\n\t}\n\telse {\n\t\tb.resize(len);\n\t\tTransform(b, len, lg, false);\n\t\tfor (int i = 0; i < len; i++) {\n\t\t\ta[i] *= b[i];\n\t\t\ta[i] %= Mod;\n\t\t}\n\t}\n\n\n\tTransform(a, len, lg, true);\n\n\tll inv = Inv(len);\n\n\tfor (int i = 0; i < sz; i++) {\n\t\ta[i] *= inv;\n\t\ta[i] %= Mod;\n\t}\n\ta.resize(sz);\n}\n\nint main(void) {\n\tInit();\n\n\tint n, k;\n\tscanf(\"%d %d\", &n, &k);\n\tstd::vector f;\n\tf.resize(1);\n\tf[0] = 1;\n\n\tstd::vector t;\n\tt.resize(10);\n\tfor (int i = 0; i < k; i++) {\n\t\tint d;\n\t\tscanf(\"%d\", &d);\n\t\tt[d] = 1;\n\t}\n\n\tint h = n / 2;\n\twhile (h > 0)\n\t{\n\t\tif (h % 2 == 1) {\n\n\t\t\tConvolution(f, t, false);\n\t\t}\n\t\tConvolution(t, t, true);\n\t\th /= 2;\n\t}\n\n\tll ans = 0;\n\tfor (int i = 0; i < f.size(); i++) {\n\t\tans += (f[i] * f[i]) % Mod;\n\t\tans %= Mod;\n\t}\n\n\tprintf(\"%lld\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "14c69faa12a8fcff61f9031507080fa8", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "difficulty": 2400} {"lang": "MS C#", "source_code": "using System.Text;\n\nnamespace consap1\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] data = new int[n, 5];\n int ot = 0;\n StringBuilder sb = new StringBuilder();\n String[] inp;\n for (int i = 0; i < n; i++)\n {\n inp = Console.ReadLine().Split();\n for (int j = 0; j < 5; j++)\n data[i, j] = int.Parse(inp[j]);\n }\n bool chek = true;\n for (int i = 0; i < n; i++)\n {\n chek = true;\n for (int j = 0; j < n - 1; j++)\n if (j != i)\n {\n for (int k = j + 1; k < n; k++)\n if (k != j && k != i)\n {\n if ((data[j, 0] - data[i, 0]) * (data[k, 0] - data[i, 0]) + (data[j, 1] - data[i, 1]) * (data[k, 1] - data[i, 1]) + (data[j, 2] - data[i, 2]) * (data[k, 2] - data[i, 2]) + (data[j, 3] - data[i, 3]) * (data[k, 3] - data[i, 3]) + (data[j, 4] - data[i, 4]) * (data[k, 4] - data[i, 4]) > 0)\n {\n chek = false;\n j = n;\n break;\n }\n }\n }\n if(chek)\n {\n sb.AppendLine((i+1).ToString());\n ot++;\n }\n }\n Console.WriteLine(ot);\n Console.WriteLine(sb);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a1b0218f204e134cd9ce2884149c0742", "src_uid": "c1cfe1f67217afd4c3c30a6327e0add9", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n string input = Console.ReadLine();\n int pribors = int.Parse(data[0]);\n int guests = int.Parse(data[1]);\n var kinds = Array.ConvertAll(input.Split(' '), int.Parse);\n\n Dictionary kind_count = new Dictionary();\n foreach(var p in kinds)\n {\n if (kind_count.ContainsKey(p))\n kind_count[p] = kind_count[p] + 1;\n else\n kind_count.Add(p, 1);\n }\n\n double max = 0;\n int sum = 0;\n foreach (var m in kind_count.Values)\n {\n if (m > max)\n max = m;\n sum += m;\n }\n\n blud = max / guests;\n int blud = (int)Math.Ceiling(max);\n\n int allpribors = kind_count.Count * blud * guests;\n\n Console.WriteLine(allpribors-sum);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c4495b9eab962b8e73da01d7cea19f5f", "src_uid": "c03ff0bc6a8c4ce5372194e8ea18527f", "difficulty": 900} {"lang": "Mono C#", "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);\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);\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "740a5666321d22c764ff1933271d803c", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600} {"lang": "MS C#", "source_code": "#include \n#include ;\n#include ;\n#include ;\n#include ;\n#include ;\n#include ;\n\n#define ll long long;\n#define ull unsigned long long;\nusing namespace std;\n\n\n\n\nstring m[500000];\nunsigned long long gcd(unsigned long long a, unsigned long long b)\n{\n\n\tif (b == 0)\n\t\treturn a;\n\telse\n\t\treturn gcd(b, a % b);\n}\nint main()\n{\n\n\tunsigned long long t, a, b;\n\tcin >> t >> a >> b;\n\tunsigned long long m = gcd(a, b);\n\tunsigned long long ans = 0;\n\t\n\tans += ((t) / (a*b / m)) + (min(a, b) - 1);\n\tans += min(((t) % (a*b / m)), (min(a, b) - 1));\n\tunsigned long long p = ans / m;\n\tunsigned long long q = t / m;\n\tcout << p << \"/\" << q;\n\treturn 0;\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e29a1cbb41dd45632846262b4b26b469", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "difficulty": 1800} {"lang": "MS C#", "source_code": "class DimaAndGuards \n{\n static void Main(string[] args)\n {\n string strM = Console.ReadLine();\n int m = int.Parse(strM);\n int[] post1 = new int[4];\n int[] post2 = new int[4];\n int[] post3 = new int[4];\n int[] post4 = new int[4];\n string[] input = Console.ReadLine().Split();\n for (int i = 0; i < 4; i++)\n {\n post1[i] = int.Parse(input[i]);\n }\n input = Console.ReadLine().Split();\n for (int i = 0; i < 4; i++)\n {\n post2[i] = int.Parse(input[i]);\n }\n input = Console.ReadLine().Split();\n for (int i = 0; i < 4; i++)\n {\n post3[i] = int.Parse(input[i]);\n }\n input = Console.ReadLine().Split();\n for (int i = 0; i < 4; i++)\n {\n post4[i] = int.Parse(input[i]);\n }\n findGuardpost(m, post1, post2, post3, post4);\n }\n \n public void findGuardpost(int m, int[] post1, int[] post2, int[] post3, int[] post4)\n {\n bool found = false;\n int i = 0;\n int j = 0;\n int k = 2;\n int addend1 = 0;\n int addend2 = 0;\n int[] mArr = new int[4];\n for (i = 0; i < 4; i++)\n {\n if (i == 0) \n {\n mArr = post1;\n } else if (i == 1) \n {\n mArr = post2;\n } else if (i == 2) \n {\n mArr = post3;\n } else \n {\n mArr = post4;\n }\n for (j = 0; j <= 1; j++)\n {\n addend1 = mArr[j];\n for (k = 2; k <= 3; k++)\n {\n addend2 = mArr[k];\n if (addend1 + addend2 <= m)\n {\n if (addend1 + addend2 < m)\n {\n int diff = m - (addend1 + addend2);\n if (addend1 > addend2)\n {\n addend2 += diff;\n }\n else\n {\n addend1 += diff;\n }\n }\n found = true;\n break;\n }\n }\n if (found)\n {\n break;\n }\n }\n if (found)\n {\n break;\n }\n }\n if (found)\n {\n Console.WriteLine((i + 1) + \" \" + addend1 + \" \" + addend2);\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5bb0536d422aa10d079827191797be09", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5", "difficulty": 1100} {"lang": "MS C#", "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.VkCup2016\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 BearReverseRadewooshA\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(), c = fs.NextInt();\n int[] p = new int[n], t = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = fs.NextInt();\n }\n for (int i = 0; i < n; i++)\n {\n t[i] = fs.NextInt();\n }\n int limak = 0, radewoosh = 0, time = 0;\n for (int i = 0; i < n; i++)\n {\n time += t[i];\n limak += Math.Max(0, p[i] - c * time);\n }\n time = 0;\n for (int i = n - 1; i >= 0; i--)\n {\n time += t[i];\n radewoosh += Math.Max(0, p[i] - c * time);\n }\n writer.WriteLine(limak > radewoosh ? \"Limak\" : radewoosh > limak ? \"Radewoosh\" : \"Tie\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7f79fe123cc436b0c203af1835625f4e", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces658A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inp1 = Console.ReadLine().Split();\n string[] inp2 = Console.ReadLine().Split();\n string[] inp3 = Console.ReadLine().Split();\n\n int n = Convert.ToInt32(inp1[0]);\n int c = Convert.ToInt32(inp1[1]);\n int[] p = new int[n];\n int[] t = new int[n];\n\n for(int i = 0; i < n; i++)\n {\n p[i] = Convert.ToInt32(inp2[i]);\n t[i] = Convert.ToInt32(inp3[i]);\n }\n int Lim = 0;\n int Rad = 0;\n\n int penL = 0, penR=0;\n int task = 0;\n for (int i = 0; i < n; i++)\n {\n penL += t[i];\n task = p[i] - penL * c;\n Lim += task > 0 ? task : 0;\n\n penR += t[n - i - 1];\n task = p[n - i - 1] - penR * c;\n Rad += task > 0 ? task : 0;\n }\n\n string outp = Lim > Rad ? \"Limak\" : Lim= 0; j--)\n time += array[2][j];\n limak += Math.Max(0, array[1][i] - array[0][1] * time);\n }\n for (int i = array[1].Length - 1; i >= 0; i--)\n {\n int time = 0;\n for (int j = i; j < array[1].Length; j++)\n time += array[2][j];\n radewooosh += Math.Max(0, array[1][i] - array[0][1] * time);\n }\n Console.WriteLine(limak > radewooosh ? \"Limak\" : \"Radewoosh\");\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8734c8573ab2b49fea13a03d7ae0c7e7", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800} {"lang": "MS C#", "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 n = 1,n2, pad,Ln,Rn,L = 0,R = 0,timel,timer;\n string[] s1, s2, s3;\n s1 = Console.ReadLine().Split();\n s2 = Console.ReadLine().Split();\n s3 = Console.ReadLine().Split();\n pad = Convert.ToInt32(s1[1]);\n timel = Convert.ToInt32(s3[0]);\n timer = Convert.ToInt32(s3[s3.Length-1]);\n n2 = s3.Length - 2;\n for(int m = 0;m0)\n {\n L = L+Ln;\n }\n \n if (n < s2.Length)\n {\n timel = timel + Convert.ToInt32(s3[n]);\n n++;\n }\n Rn = Convert.ToInt32(s2[s2.Length - 1 - m]) - pad * timer;\n if(Rn>0)\n {\n R = R+Rn;\n }\n if (n2>=0)\n {\n timer = timer + Convert.ToInt32(s3[n2]);\n n2--;\n }\n }\n if (L > R)\n {\n Console.Write(\"Limark\");\n }\n if(L 0; i--)\n {\n ttimes += Convert.ToInt32(times[i]);\n\n var indPoints = Convert.ToInt32(secores[i]) - ttimes * dp;\n\n \n Radewoosh += indPoints;\n \n }\n if(Limak> Radewoosh)\n {\n Console.WriteLine(\"Limak\");\n }\n else if (Limak < Radewoosh)\n {\n Console.WriteLine(\"Radewoosh\");\n }\n else\n {\n Console.WriteLine(\"Tie\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "379a3f0a27a9ce7a39a7e9d99b65e978", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800} {"lang": "Mono C#", "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 string[]y1=Console.ReadLine().Split(' ');\n string[]y2=Console.ReadLine().Split(' ');\n int n=int.Parse(y[0]);\n int c=int.Parse(y[1]);\n \n int[]a=new int[n];\n int sum1=0;\n int time1=0;\n for(int i=0;i=0)\n sum1+=a[i]-time1*c;\n }\n \n int sum2=0;\n int time2=0;\n \n for(int i=n-1;i>0;i--)\n {\n time2+=b[i];\n if(a[i]-time2*c>=0)\n sum2+=a[i]-time2*c;\n }\n if(sum1>sum2)\n Console.WriteLine(\"Limak\");\n else if(sum10)\n {\n Limak += indPoints;\n }\n }\n ttimes = 0;\n for (int i = length-1; i > 0; i--)\n {\n ttimes += Convert.ToInt32(times[i]);\n\n var indPoints = Convert.ToInt32(secores[i]) - ttimes * dp;\n\n if (indPoints > 0)\n {\n Radewoosh += indPoints;\n }\n }\n if(Limak> Radewoosh)\n {\n Console.WriteLine(\"Limak\");\n }\n else if (Limak < Radewoosh)\n {\n Console.WriteLine(\"Radewoosh\");\n }\n else\n {\n Console.WriteLine(\"Tie\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a7f87df3d79c64e9db85383fe461e42", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800} {"lang": "Mono C#", "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 string[] str = Console.ReadLine().Split();\n int n = Convert.ToInt32( str[0] );\n int c = Convert.ToInt32( str[1] );\n var p = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n var t = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n\n\n //--------------------------------solve--------------------------------//\n\n int limak = 0, radewoosh = 0, t_l = 0, t_r = 0;\n for(int i = 0 ; i < n ; i++)\n {\n t_l += t[i];\n t_r += t[n - 1 - i];\n limak += ( p[i] - c * t_l );\n radewoosh += Math.Max( 0, p[n - 1 - i] - c * t_r );\n }\n\n Console.WriteLine( limak > radewoosh ? \"Limak\" : limak == radewoosh ? \"Tie\" : \"Radewoosh\" );\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6e7318719128f4dcc1f8bda607c13358", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputs = Console.ReadLine().Split(' ');\n\n var secores= Console.ReadLine().Split(' ');\n\n var times = Console.ReadLine().Split(' ');\n\n var length = Convert.ToInt32(inputs[0]);\n\n var dp = Convert.ToDecimal(inputs[1]);\n\n decimal Limak = 0;\n decimal Radewoosh = 0;\n decimal ttimes = 0;\n \n\n for (int i=0;i< length;i++)\n {\n ttimes +=Convert.ToDecimal(times[i]);\n\n var indPoints = Convert.ToDecimal(secores[i]) - ttimes * dp;\n\n if(indPoints>0)\n {\n Limak += indPoints;\n }\n }\n ttimes = 0;\n for (int i = length-1; i > 0; i--)\n {\n ttimes += Convert.ToDecimal(times[i]);\n\n var indPoints = Convert.ToDecimal(secores[i]) - ttimes * dp;\n\n if (indPoints > 0)\n {\n Radewoosh += indPoints;\n }\n }\n if(Limak> Radewoosh)\n {\n Console.WriteLine(\"Limak\");\n }\n else if (Limak < Radewoosh)\n {\n Console.WriteLine(\"Radewoosh\");\n }\n else\n {\n Console.WriteLine(\"Tie\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fa6eda090a6d92de03d37c71e5476403", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace first\n{\n class Program\n {\n static void Main(string[] args)\n {\n string one = Console.ReadLine();\n string two = Console.ReadLine();\n string three = Console.ReadLine();\n int n = Int32.Parse(one.Split(' ')[0]);\n int c = Int32.Parse(one.Split(' ')[1]);\n\n int l_time = 0;\n int r_time = 0;\n\n int l_score = 0;\n int r_score = 0;\n\n for (int i = 0; i < n; i++)\n {\n l_time += Int32.Parse(three.Split(' ')[i]);\n if ((Int32.Parse(two.Split(' ')[i]) - l_time * c) < 0) continue;\n else l_score += Int32.Parse(two.Split(' ')[i]) - l_time * c;\n }\n for (int i = n-1; i > 0; i--)\n {\n r_time += Int32.Parse(three.Split(' ')[i]);\n if ((Int32.Parse(two.Split(' ')[i]) - r_time * c) < 0) continue;\n else r_score += Int32.Parse(two.Split(' ')[i]) - r_time * c;\n }\n if (l_score > r_score) Console.WriteLine(\"Limak\");\n else if (r_score > l_score) Console.WriteLine(\"Radewoosh\");\n else Console.WriteLine(\"Tie\");\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "07d67d94ea3128d53f0afe9aba64a42c", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800} {"lang": "MS C#", "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 pad,L = 0,R = 0,timel,timer;\n string[] s1, s2, s3;\n s1 = Console.ReadLine().Split();\n s2 = Console.ReadLine().Split();\n s3 = Console.ReadLine().Split();\n pad = Convert.ToInt32(s1[1]);\n timel = Convert.ToInt32(s3[0]);\n timer = Convert.ToInt32(s3[s3.Length-1]);\n for(int m = 0;mR)\n {\n Console.Write(\"Limark\");\n }\n else\n {\n Console.Write(\"Radewoosh\");\n }\n if(L == R)\n {\n Console.Write(\"Tie\");\n }\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cf82d958385cf0f22099039de79543e2", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800} {"lang": "Mono C#", "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 int N, M;long K;\n sc.Make(out N, out M, out K);\n if (K < N) Fail($\"{K+1} {1}\");\n if (K == N) Fail($\"{K} {2}\");\n K -= N;\n long n = K / (M - 1);K /= M - 1;\n long m;\n if (n % 2 == 0) m = K + 2;\n else m = (M - K );\n n = N - n;\n Console.WriteLine($\"{n} {m}\");\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbcc006eb1ead3d07db1dcdae229f1c3", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Lara_Croft_and_the_New_Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n ulong n = ulong.Parse(input[0]);\n ulong m = ulong.Parse(input[1]);\n ulong k = ulong.Parse(input[2]);\n ulong X = 0, Y = 0;\n\n if (k < n) { X = k + 1; Y = 1; }\n else if (k >= n && k < m + n - 2) { X = n; Y = k - n + 2; }\n else\n {\n k -= n + m - 1;\n ulong temp = k / (m - 1);\n X = (n - 1) - temp;\n bool isEven = X % 2 == 0;\n ulong remains = k % (m - 1);\n if (!isEven) Y = m - remains;\n else Y = remains + 2;\n }\n Console.WriteLine(\"{0} {1}\", X, Y);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "521801748c80ad3ad7c2c66a13dd70d1", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Lara_Croft_and_the_New_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 Solve(args);\n writer.Flush();\n }\n\n private static void Solve(string[] args)\n {\n long n = Next();\n long m = Next();\n long k = Next();\n\n if (k < n)\n {\n writer.Write(k + 1);\n writer.WriteLine(\" 1\");\n }\n else\n {\n long r = (k - n + m - 3)/(m - 1);\n long x = (k - n)%(m - 1);\n writer.Write(n - r);\n writer.Write(' ');\n if (r%2 == 0)\n {\n writer.Write(2 + x);\n }\n else\n {\n writer.Write(m - x);\n }\n writer.WriteLine();\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "81cede9f4968e33e347fcd372b043356", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MyApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long x, y,mo,h,l;\n h = 0;\n l = 0;\n string[] inp = Console.ReadLine().Split(' ');\n long n = Convert.ToInt64(inp[0]);\n long m = Convert.ToInt64(inp[1]);\n long k = Convert.ToInt64(inp[2]);\n k = k % (n * 3);\n if (k <= n - 1)\n {\n Console.WriteLine(k + 1 + \" \" + 1);\n }\n else\n {\n k -= (n - 1);\n mo = m - 1;\n if (k % mo > 0)\n h = (k / mo) + 1;\n else\n h = (k / mo);\n if (k % mo == 1)\n l = k % mo;\n else\n l = mo;\n if ((h & 1) == 1)\n {\n l = l + 1;\n l = mo - l + 2;\n }\n else\n {\n l = mo - l + 2;\n }\n Console.WriteLine(n - h + 1 + \" \" + l);\n } \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5932345f8194a0a6b96c029c36c5d1d0", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static long n, m, k;\n static void input()\n {\n string[] s = Console.ReadLine().Split();\n n = long.Parse(s[0]);\n m = long.Parse(s[1]);\n k = long.Parse(s[2]);\n }\n static void solve()\n {\n if(k 0)\n h = (k / mo) + 1;\n else\n h = (k / mo);\n if (k % mo == 1)\n l = k % mo;\n else\n l = mo;\n if ((h & 1)==1)\n {\n l = l + 1;\n }\n else\n {\n l = mo - l + 2;\n }\n Console.WriteLine(n - h + 1 + \" \" + l);\n } \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e46fda95d4ffff5e94b67323aeee38fc", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "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 int N, M;long K;\n sc.Make(out N, out M, out K);\n if (K < N) Fail($\"{K+1} {1}\");\n if (K == N) Fail($\"{K} {2}\");\n K -= N;\n long n = K / (M - 1);K /= M - 1;\n long m;\n if (n % 2 == 0) m = K % (N - 1) + 2;\n else m = (M - K );\n n = N - n;\n Console.WriteLine($\"{n} {m}\");\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a89057c831574da972ef5993eb802c87", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MyApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long x, y,mo,h,l;\n h = 0;\n l = 0;\n string[] inp = Console.ReadLine().Split(' ');\n long n = Convert.ToInt64(inp[0]);\n long m = Convert.ToInt64(inp[1]);\n long k = Convert.ToInt64(inp[2]);\n // k = k % (n * 3);\n if (k <= n - 1)\n {\n Console.WriteLine(k + 1 + \" \" + 1);\n }\n else\n {\n k -= (n - 1);\n mo = m - 1;\n if (k % mo > 0)\n h = (k / mo) + 1;\n else\n h = (k / mo);\n if (k % mo == 1)\n l = k % mo;\n else\n l = mo;\n if ((h & 1) == 1)\n {\n l = l + 1;\n l = mo - l + 2;\n }\n else\n {\n l = mo - l + 2;\n }\n Console.WriteLine(n - h + 1 + \" \" + l);\n } \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "150f6a3b7d0ac1e492aa15c569412729", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace LaraNewGame976B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tInt32 n, m;\n\t\t\tInt64 k;\n\t\t\tstring[] tokens = Console.ReadLine().Split();\n\t\t\tn = Int32.Parse(tokens[0]);\n\t\t\tm = Int32.Parse(tokens[1]);\n\t\t\tk = Int64.Parse(tokens[2]);\n\n\t\t\tif (k < n)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0} {1}\", k + 1, 1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tk -= n;\n\t\t\t\tInt64 leftLevels = k / (m - 1);\n\t\t\t\tInt64 leftSteps = k % (m - 1);\n\t\t\t\tif (leftLevels % 2 == 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"{0} {1}\", n - leftLevels, leftSteps + 2);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"{0} {1}\", n - leftLevels, m - leftSteps);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ab837447e00aba9216d85dc910a0b658", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Lara_Croft_and_the_New_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 Solve(args);\n writer.Flush();\n }\n\n private static void Solve(string[] args)\n {\n long n = Next();\n long m = Next();\n long k = Next();\n\n if (k < n)\n {\n writer.Write(k + 1);\n writer.WriteLine(\" 1\");\n }\n else\n {\n long r = (k - n)/(m - 1);\n long x = (k - n)%(m - 1);\n writer.Write(n - r);\n writer.Write(' ');\n if (r%2 == 0)\n {\n writer.Write(2 + x);\n }\n else\n {\n writer.Write(m - x);\n }\n writer.WriteLine();\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3076f50319245b80a4394564e98bd4bc", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static long n, m, k;\n static void input()\n {\n string[] s = Console.ReadLine().Split();\n n = long.Parse(s[0]);\n m = long.Parse(s[1]);\n k = long.Parse(s[2]);\n }\n static void solve()\n {\n if(k Int64.Parse(x)).ToArray();\n\n var n = arr[0];\n var m = arr[1];\n var k = arr[2];\n\n var res = Calc(n, m, k);\n Console.Write($\"{res[0]} {res[1]}\");\n }\n\n static long[] Calc(long n, long m, long k)\n {\n long x = 1, y = 1; \n\n //\u0432\u043d\u0438\u0437\n var res = k - (n - 1);\n if (res < 0)\n {\n x = k + 1;\n return new long[2] { x, y };\n }\n \n //\u0432\u043f\u0440\u0430\u0432\u043e\n k = res;\n res = k - (m - 1);\n if (res < 0)\n {\n y = k + 1;\n x = n;\n return new long[2] { x, y };\n }\n\n //\u043a\u043e\u043b-\u0432\u043e \u0437\u043c\u0435\u0435\u043a: (1 \u0432\u0432\u0435\u0440\u0445 \u0438 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0432\u043b\u0435\u0432\u043e (\u0438\u043b\u0438 \u0432\u043f\u0440\u0430\u0432\u043e))\n k = res;\n var kolLeft = k / (m - 1);\n var ost = k % (m - 1);\n\n if ((kolLeft % 2 == 0 && ost > 0) || (kolLeft % 2 == 1 && ost == 0)) \n //\u0447\u0435\u0442\u043d\u043e\u0435 \u0441 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u043c \u043e\u0441\u0442 \u0438\u043b\u0438 \u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0435 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c => \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043c \u043d\u0430 \u043f\u0443\u0442\u0438 1 \u0432\u0432\u0435\u0440\u0445 \u043f\u043e\u0442\u043e\u043c \u0432\u043b\u0435\u0432\u043e\n {\n x = ost == 0 ? n - kolLeft : n - kolLeft - 1;\n y = ost == 0 ? 2 : m + 1 - ost;\n return new long[2] { x, y };\n }\n\n //\u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0435 \u0441 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0438\u043b\u0438 \u0447\u0435\u0442\u043d\u043e\u0435 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c, \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043c \u043d\u0430 \u043f\u0443\u0442\u0438 1 \u0432\u0432\u0435\u0440\u0445 \u043f\u043e\u0442\u043e\u043c \u0432\u043f\u0440\u0430\u0432\u043e\n x = ost == 0 ? n - kolLeft : n - 1 - kolLeft;\n y = ost == 0 ? m : 2 + ost - 1;\n return new long[2] { x, y };\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c7e9f7b53f9414174fe92d254db01994", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace _976B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inputs = Console.ReadLine().Split(new char[] {' '});\n\n long n = long.Parse(inputs[0]);\n long m = long.Parse(inputs[1]);\n long k = long.Parse(inputs[2]);\n\n long x = 1;\n long y = 1;\n\n if(k == 0)\n {\n Console.Write($\"{x} {y}\");\n return;\n }\n\n if(k < n)\n {\n x += k;\n Console.Write($\"{x} {y}\");\n return;\n }\n\n if(k == n)\n {\n x = n;\n y++;\n\n Console.Write($\"{x} {y}\");\n return;\n }\n\n k -= n;\n x = n;\n\n long up = k / (m - 1);\n long step = k % (m - 1);\n x -= up;\n\n if(up % 2 == 0)\n {\n y = 2 + step;\n }\n else\n {\n y = m - step;\n }\n\n Console.Write($\"{x} {y}\");\n return;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "233eb667ad600a2772d9d207a09f92a9", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace LaraCroft\n{\n class Program\n {\n struct Vector2\n {\n public long X;\n public long Y;\n\n public Vector2(long x, long y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public override string ToString()\n {\n return $\"{this.Y} {this.X}\";\n }\n }\n\n static void Main(string[] args)\n {\n var line = Console.ReadLine();\n var words = line.Split(' ');\n var values = words.Select(long.Parse).ToArray();\n\n var sizeY = values[0];\n var sizeX = values[1];\n var moves = values[2];\n\n Console.Write(SimulateMoves(sizeX, sizeY, moves));\n }\n\n static Vector2 SimulateMoves(long sizeX, long sizeY, long moves)\n {\n if (moves < sizeY)\n {\n return new Vector2(1, (long) moves + 1);\n }\n\n moves -= sizeY;\n var result = new Vector2(2, sizeY);\n var halfDividor = sizeX - 1;\n var dividor = halfDividor * 2;\n var yJumps = moves / dividor;\n moves -= yJumps * dividor;\n result.Y -= yJumps * 2;\n\n if (moves < halfDividor)\n {\n result.X += moves;\n return result;\n }\n else\n {\n moves -= halfDividor;\n result.X = sizeX;\n result.Y -= 1;\n result.X -= moves;\n return result;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "76aa265a865e761f958c3559dded932e", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "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(K <= N - 1){\n\t\t\tConsole.WriteLine(\"{0} {1}\",1 + K, 1);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tK -= N;\n\t\tlong rr = K / (2 * M - 2);\n\t\tlong cc = K % (2 * M - 2);\n\t\t\n\t\tlong r2 = cc / (M - 1);\n\t\t\n\t\tlong r = N - 2 * rr - r2;\n\t\tlong c = 2;\n\t\tif(cc < M - 1){\n\t\t\tc += cc;\n\t\t} else {\n\t\t\tc += M - 1 - (cc - (M - 1)) - 1;\n\t\t}\n\t\tConsole.WriteLine(\"{0} {1}\",r,c);\n\t\t\n\t}\n\t\n\tlong N,M,K;\n\tpublic Sol(){\n\t\tvar d = rla();\n\t\tN = d[0]; M = d[1]; K = 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1f0e2950485b99429eb5ae0af1989a08", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MyApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long mo,h,l;\n h = 0;\n l = 0;\n string[] inp = Console.ReadLine().Split(' ');\n long n = Convert.ToInt64(inp[0]);\n long m = Convert.ToInt64(inp[1]);\n long k = Convert.ToInt64(inp[2]);\n // k = k % (n * 3);\n if (k <= n - 1)\n {\n Console.WriteLine(k + 1 + \" \" + 1);\n }\n else\n {\n k -= (n - 1);\n mo = m - 1;\n if (k % mo > 0)\n h = (k / mo) + 1;\n else\n h = (k / mo);\n if ((k % mo)>0)\n l = k % mo;\n else\n l = mo;\n if ((h & 1)==1)\n {\n l = l + 1;\n }\n else\n {\n l = mo - l + 2;\n }\n Console.WriteLine(n - h + 1 + \" \" + l);\n } \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "66b28569efff076207912560ea4dd229", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "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 int N, M;long K;\n //N = 4; M = 2;K = 6;\n sc.Make(out N, out M, out K);\n if (K < N) Fail($\"{K+1} {1}\");\n if (K == N) Fail($\"{K} {2}\");\n K -= N;\n long n = K / (M - 1);K %= M - 1;\n long m;\n if (n % 2 == 0) m = K + 2;\n else m = (M - K );\n n = N - n;\n Console.WriteLine($\"{n} {m}\");\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a727d8ccdb47bd0688e0b76ba7be81ba", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Runtime.Remoting.Contexts;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Security.Policy;\nusing System.Threading;\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, M;\n private long K;\n private void Scan()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n K = sc.NextLong();\n }\n\n public void Solve()\n {\n Scan();\n if (K < N)\n {\n Console.WriteLine($\"{K + 1} {1}\");\n }\n else\n {\n long d = K - N;\n long x;\n long y = N - d / (M - 1);\n if ((d / (M - 1)) % 2 == 0)\n {\n x = d % (M - 1) + 2;\n\n }\n else\n {\n x = M - d % (M - 1);\n\n }\n Console.WriteLine($\"{y} {x}\");\n }\n }\n\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a71af152f89a7df999ec17b8a573de4f", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long n = Convert.ToInt64(s.Split(' ')[0]);\n long m = Convert.ToInt64(s.Split(' ')[1]);\n long k = Convert.ToInt64(s.Split(' ')[2]);\n long x = 1, y = 1;\n if (k + 1 <= n)\n x += k;\n else\n {\n x = n;\n k -= n - 1;\n y++; k--;\n long lines = k / (m - 1);\n long rem = k % (m - 1);\n x -= lines;\n if (lines == n)\n x = 1;\n if (lines % 2 == 0)\n y += rem;\n else\n y = m - rem;\n }\n Console.WriteLine(x + \" \" + y);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a097b6648ea5af2bde032f425e4af01f", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LaraKroft\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n ulong n = ulong.Parse(s[0]);\n ulong m = ulong.Parse(s[1]);\n ulong k = ulong.Parse(s[2]);\n\n ulong row = 0;\n ulong col = 0;\n\n if (k<=n-1)\n {\n row = 1 + k;\n col = 1;\n }\n else\n {\n k -= n - 1;\n if (k <= m - 1)\n {\n col = 1 + k;\n row = n;\n }\n else\n {\n k -= m ;\n row = n - k / (m - 1)-1;\n\n if (row % 2 == 1)\n col = m - k % (m - 1);\n else\n col = 2 + k % (m - 1);\n }\n }\n\n Console.Write(\"{0} {1}\", row, col);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0550fdb921c174ba994aab95f7d4c0f2", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace _976B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inputs = Console.ReadLine().Split(\" \");\n\n long n = long.Parse(inputs[0]);\n long m = long.Parse(inputs[1]);\n long k = long.Parse(inputs[2]);\n\n long x = 1;\n long y = 1;\n\n if(k == 0)\n {\n Console.Write($\"{x} {y}\");\n return;\n }\n\n if(k < n)\n {\n x += k;\n Console.Write($\"{x} {y}\");\n return;\n }\n\n if(k == n)\n {\n x = n;\n y++;\n\n Console.Write($\"{x} {y}\");\n return;\n }\n\n k -= n;\n x = n;\n\n long up = k / (m - 1);\n long step = k % (m - 1);\n x -= up;\n\n if(up % 2 == 0)\n {\n y = 2 + step;\n }\n else\n {\n y = m - step;\n }\n\n Console.Write($\"{x} {y}\");\n return;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e65dc773a4f1ae1f2b1dea02fbbefa31", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "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 long n = Convert.ToInt64(l.Split(' ')[0]);\n long m = Convert.ToInt64(l.Split(' ')[1]);\n long k = Convert.ToInt64(l.Split(' ')[2]);\n int x = 1, y = 1;\n bool snake = false;\n bool goRight = true;\n while(k > 0)\n {\n if (x == n)\n {\n snake = true;\n }\n //reached destination\n if (x == 1 && y == 2)\n {\n k = 0;\n break;\n }\n //going down along the left side\n else if (snake == false && x < n)\n {\n x++;\n k--;\n } \n else if(snake && goRight)\n {\n if (y < m)\n {\n k--;\n y++;\n }\n else if(y == m)\n {\n x--;\n k--;\n goRight = false;\n }\n }\n else if(snake && goRight == false)\n {\n if(y > 2)\n {\n y--;\n k--;\n }\n else if(y == 2)\n {\n k--;\n x--;\n goRight = true;\n }\n }\n //Console.WriteLine(x + \" \" + y);\n }\n Console.WriteLine(x + \" \" + y);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9fb0de4cd3bd67b53a175fc58e035714", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "Mono C#", "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 long n = Convert.ToInt64(l.Split(' ')[0]);\n long m = Convert.ToInt64(l.Split(' ')[1]);\n long k = Convert.ToInt64(l.Split(' ')[2]);\n long x = 1, y = 1;\n bool snake = false;\n bool goRight = true;\n while(k > 0)\n {\n if (x == n)\n {\n snake = true;\n }\n if (x == 1 && y == 2)\n {\n k = 0;\n break;\n }\n else if (snake == false && x < n)\n {\n if(n <= k)\n {\n x = n;\n snake = true;\n k -= n - 1;\n }\n else\n {\n x++;\n k--;\n }\n } \n else if(snake && goRight)\n {\n if (y < m)\n {\n if(k >= m-y)\n {\n k -= m - y + 1;\n y = m;\n x--;\n goRight = false;\n }\n else\n {\n k--;\n y++;\n }\n }\n else if(y == m)\n {\n x--;\n k--;\n goRight = false;\n }\n }\n else if(snake && goRight == false)\n {\n if(y > 2)\n {\n if (k >= m - 1)\n {\n k -= m - 1;\n y = 2;\n x--;\n goRight = true;\n }\n else\n {\n y--;\n k--;\n }\n }\n else if(y == 2)\n {\n k--;\n x--;\n goRight = true;\n }\n }\n //Console.WriteLine(x + \" \" + y + \" \" + k);\n }\n Console.WriteLine(x + \" \" + y);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ab5a4de4638400df00e4aeb5a502339", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\r\nusing System.Threading;\r\nusing System.IO;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing CompLib.Mathematics;\r\n\r\npublic class Program\r\n{\r\n int N, K;\r\n BinomialCoefficient Binom;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n N = sc.NextInt();\r\n K = sc.NextInt();\r\n\r\n // 2^n\u4eba n\u56de\u6226\u30c8\u30fc\u30ca\u30e1\u30f3\u30c8\r\n\r\n // \u512a\u52dd\u304c\u5c0f\u3055\u3044\u65b9\u304c\u826f\u3044\r\n // \u30c8\u30fc\u30ca\u30e1\u30f3\u30c8\u306e\u69cb\u7bc9\u3001\u52dd\u3064\u4eba\u6c7a\u3081\u308b\r\n\r\n // K\u56de\u4ee5\u4e0b \u7d50\u679c\u5909\u3048\u3089\u308c\u308b\r\n\r\n // \u53ef\u80fd\u306a\u52dd\u3064\u4eba\u6700\u5c0f\r\n\r\n if (K >= N)\r\n {\r\n Console.WriteLine(ModInt.Pow(2, N));\r\n return;\r\n }\r\n\r\n Binom = new BinomialCoefficient(N);\r\n ModInt ans = 0;\r\n for (int i = 0; i <= K; i++)\r\n {\r\n ans += Binom[N, i];\r\n }\r\n\r\n Console.WriteLine(ans);\r\n\r\n // 1 1 + N\r\n // 2 1 + N + 1 + 2 + 3 + ... (N-1)\r\n\r\n // 1 + 3 + (1 + 2)\r\n }\r\n\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e4a21cf7b7399cb950e9e61418bf1532", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "difficulty": 1900} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\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 \r\n var arr = Console.ReadLine().Split(' ');\r\n var n = Int32.Parse(arr[0]);\r\n var k = Int32.Parse(arr[1]);\r\n\r\n Console.WriteLine(GetVal(n,k));\r\n }\r\n\r\n\r\n const int MOD_VAL = 1000000007;\r\n \r\n private static int GetVal(int n, int k)\r\n {\r\n var res = 1;\r\n if(k >= n)\r\n {\r\n for(var i = 0;i=0;i--)\r\n {\r\n revals[i] = (int)((long)revals[i+1] * (i+1) % MOD_VAL);\r\n }\r\n return revals;\r\n }\r\n\r\n private static int[] GetFactorials(int n)\r\n {\r\n var factorials = new int[n+1];\r\n factorials[0] = 1;\r\n for(var i = 1;i<=n;i++)\r\n {\r\n factorials[i] = (int)((long)factorials[i-1] * i % MOD_VAL); \r\n }\r\n return factorials;\r\n }\r\n\r\n \r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3bb59a42b3c848fe12619c8d7ea142d8", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "difficulty": 1900} {"lang": "C# 10", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\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 long prime = 1000000007;\r\n public static long[] bprime = new long[2];\r\n public static Dictionary invar = new Dictionary();\r\n public static long[] fact = new long[1];\r\n public static void Main()\r\n {\r\n var cur = prime - 2;\r\n var list = new List();\r\n while (cur != 0)\r\n {\r\n list.Add(cur % 2);\r\n cur = cur / 2;\r\n }\r\n bprime = list.ToArray();\r\n var str = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToList();\r\n var n = str[0];\r\n var k = str[1];\r\n long res = 0;\r\n fact = new long[n + 1];\r\n fact[0] = 1;\r\n for (var i = 1; i < n + 1; i++)\r\n {\r\n fact[i] = (long)((long)fact[i - 1] * i) % prime;\r\n }\r\n for (var i = 0; i <= Math.Min(n,k); i++)\r\n {\r\n res += C(n, i);\r\n res = res % prime;\r\n }\r\n Console.WriteLine(res);\r\n }\r\n private static long C(long n, long k)\r\n {\r\n if (n >= k)\r\n {\r\n long res = fact[n];\r\n res = res * calcInv(fact[n - k]);\r\n res = res % prime;\r\n res = res * calcInv(fact[k]);\r\n res = res % prime;\r\n return (long)res;\r\n }\r\n else return 0;\r\n }\r\n\r\n public static long calcInv(long n)\r\n {\r\n if (invar.TryGetValue(n, out var invn))\r\n return invn;\r\n else\r\n {\r\n var ost = new long[bprime.Length];\r\n ost[0] = n;\r\n for (var i = 1; i < bprime.Length; i++)\r\n {\r\n ost[i] = (ost[i - 1] * ost[i - 1]) % prime;\r\n }\r\n long inv = 1;\r\n for (var i = 0; i < bprime.Length; i++)\r\n {\r\n inv *= (bprime[i] == 1) ? ost[i] : 1;\r\n inv = inv % prime;\r\n }\r\n invar.Add(n, (long)inv);\r\n\r\n return (long)inv;\r\n }\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "889a19f9808f8a3de219300f3998ecb7", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "difficulty": 1900} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\r\nusing System.Threading;\r\nusing System.IO;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing CompLib.Mathematics;\r\n\r\npublic class Program\r\n{\r\n int N, K;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n N = sc.NextInt();\r\n K = sc.NextInt();\r\n\r\n // 2^n\u4eba n\u56de\u6226\u30c8\u30fc\u30ca\u30e1\u30f3\u30c8\r\n\r\n // \u512a\u52dd\u304c\u5c0f\u3055\u3044\u65b9\u304c\u826f\u3044\r\n // \u30c8\u30fc\u30ca\u30e1\u30f3\u30c8\u306e\u69cb\u7bc9\u3001\u52dd\u3064\u4eba\u6c7a\u3081\u308b\r\n\r\n // K\u56de\u4ee5\u4e0b \u7d50\u679c\u5909\u3048\u3089\u308c\u308b\r\n\r\n // \u53ef\u80fd\u306a\u52dd\u3064\u4eba\u6700\u5c0f\r\n\r\n if (K >= N)\r\n {\r\n Console.WriteLine(ModInt.Pow(2, N));\r\n return;\r\n }\r\n\r\n\r\n ModInt ans = 0;\r\n for (int i = 0; i < K; i++)\r\n {\r\n ans += ModInt.Pow(2, N - i - 1);\r\n }\r\n Console.WriteLine(ans + 1);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5387483b7eb9557d7317fb332a0fef40", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "difficulty": 1900} {"lang": "C# 10", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\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 long prime = 1000000007;\r\n public static long[] bprime = new long[2];\r\n public static Dictionary invar = new Dictionary();\r\n public static long[] fact = new long[1];\r\n public static void Main()\r\n {\r\n var cur = prime - 2;\r\n var list = new List();\r\n while (cur != 0)\r\n {\r\n list.Add(cur % 2);\r\n cur = cur / 2;\r\n }\r\n bprime = list.ToArray();\r\n var str = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToList();\r\n var n = str[0];\r\n var k = str[1];\r\n long res = 0;\r\n fact = new long[n + 1];\r\n fact[0] = 1;\r\n for (var i = 1; i < n + 1; i++)\r\n {\r\n fact[i] = (long)((long)fact[i - 1] * i) % prime;\r\n }\r\n for (var i = 0; i <= k; i++)\r\n {\r\n res += C(n, i);\r\n res = res % prime;\r\n }\r\n Console.WriteLine(res);\r\n }\r\n private static long C(long n, long k)\r\n {\r\n if (n >= k)\r\n {\r\n long res = fact[n];\r\n res = res * calcInv(fact[n - k]);\r\n res = res % prime;\r\n res = res * calcInv(fact[k]);\r\n res = res % prime;\r\n return (long)res;\r\n }\r\n else return 0;\r\n }\r\n\r\n public static long calcInv(long n)\r\n {\r\n if (invar.TryGetValue(n, out var invn))\r\n return invn;\r\n else\r\n {\r\n var ost = new long[bprime.Length];\r\n ost[0] = n;\r\n for (var i = 1; i < bprime.Length; i++)\r\n {\r\n ost[i] = (ost[i - 1] * ost[i - 1]) % prime;\r\n }\r\n long inv = 1;\r\n for (var i = 0; i < bprime.Length; i++)\r\n {\r\n inv *= (bprime[i] == 1) ? ost[i] : 1;\r\n inv = inv % prime;\r\n }\r\n invar.Add(n, (long)inv);\r\n\r\n return (long)inv;\r\n }\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "32bc954e888cb122a30d002f5ddad812", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "difficulty": 1900} {"lang": "Mono C#", "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;\nusing Number = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri; BigInteger k = rl; var m = ri;\n\t\t\tvar s = \"\";\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tvar cnt = f(s + \"0\", n);\n\t\t\t\t//Console.WriteLine($\"now {s + '0'} {cnt} {k}\");\n\t\t\t\tif (k <= cnt) {\n\t\t\t\t\ts += \"0\";\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {u} {v} {cnt - u - v}\");\n\t\t\t\t\tif (cnt - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tk -= cnt;\n\t\t\t\t\ts += \"1\";\n\t\t\t\t\tvar x = f(s, n);\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//onsole.WriteLine($\"{s} {cnt} {x} {u} {v} {x - u - v}\");\n\t\t\t\t\tif (x - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\tif (k <= 0) break;\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t\tBigInteger f(string p, int n) {\n\t\t\t//Console.WriteLine($\"func {p}\");\n\t\t\tvar s = \"0\";\n\t\t\tvar t = \"1\";\n\t\t\tvar a = count(s, p);\n\t\t\tvar b = count(t, p);\n\n\t\t\tvar m = p.Length;\n\t\t\tif (n == 0) return a;\n\t\t\telse if (n == 1) return a + b + count(s + t, p);\n\t\t\tfor (int len = 1; len < n; len++) {\n\n\t\t\t\tvar tmp = new SB();\n\t\t\t\tvar nt = new SB();\n\t\t\t\tif (len > 10) {\n\t\t\t\t\t//nt.Append(s.Substring(0, Min(s.Length, m - 1)));\n\t\t\t\t\t//tmp.Append(s.Reverse().Take(Min(s.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\tfor (int i = 0; i < Min(s.Length, m - 1); i++) nt.Append(s[i]);\n\t\t\t\t\tfor (int i = Min(m - 2, s.Length - 1); i >= 0; i--) tmp.Append(s[s.Length - 1 - i]);\n\t\t\t\t\t//nt.Append(t.Reverse().Take(Min(t.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\t//tmp.Append(t.Substring(0, Min(t.Length, m - 1)));\n\t\t\t\t\tfor (int i = Min(m - 2, t.Length - 1); i >= 0; i--) nt.Append(t[t.Length - 1 - i]);\n\t\t\t\t\tfor (int i = 0; i < Min(t.Length, m - 1); i++) tmp.Append(t[i]);\n\t\t\t\t\t//Console.WriteLine($\"tmp {tmp.ToString()}\");\n\t\t\t\t\tvar nb = a + b + count(tmp.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnt.Append(s + t);\n\t\t\t\t\tvar nb = count(nt.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn b;\n\t\t}\n\t\tBigInteger count(string s, string p) {\n\t\t\tvar n = s.Length;\n\t\t\tvar m = p.Length;\n\t\t\tvar z = stringEx.ZAlgorithm(p + \"#\" + s);\n\t\t\tlong cnt = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (z[i + 1 + m] >= m) cnt++;\n\t\t\t//Console.WriteLine($\"count {s} {p} {cnt}\");\n\t\t\treturn cnt;\n\t\t}\n\n\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 < n; ++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\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#region Z algorithm\nstatic public partial class stringEx {\n\t/// \u3068 [i:] \u306e\u6700\u9577\u5171\u901a\u63a5\u982d\u8f9e\u3092 O(||) \u3067\u6c42\u3081\u308b\u3002\n\tstatic public int[] ZAlgorithm(string s) {\n\t\tvar a = new int[s.Length + 1];\n\t\ta[0] = s.Length;\n\t\tint i = 1, j = 0;\n\t\twhile (i < s.Length) {\n\t\t\twhile (i + j < s.Length && s[j] == s[i + j]) ++j;\n\t\t\ta[i] = j;\n\t\t\tif (j == 0) { ++i; continue; }\n\t\t\tint k = 1;\n\t\t\twhile (i + k < s.Length && k + a[k] < j) { a[i + k] = a[k]; ++k; }\n\t\t\ti += k; j -= k;\n\t\t}\n\t\treturn a;\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "749daddf02bef36023d5f07a8c8a3608", "src_uid": "7b4a057efee5264bfaaf60d50fccb92b", "difficulty": 2700} {"lang": "Mono C#", "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;\nusing Number = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri; BigInteger k = rl; var m = ri;\n\t\t\tvar s = \"\";\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tvar cnt = f(s + \"0\", n);\n\t\t\t\t//Console.WriteLine($\"now {s + '0'} {cnt} {k}\");\n\t\t\t\tif (k <= cnt) {\n\t\t\t\t\ts += \"0\";\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {u} {v} {cnt - u - v}\");\n\t\t\t\t\tif (cnt - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tk -= cnt;\n\t\t\t\t\ts += \"1\";\n\t\t\t\t\tvar x = f(s, n);\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {x} {u} {v} {cnt - u - v}\");\n\t\t\t\t\tif (x - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\tif (k <= 0) break;\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t\tBigInteger f(string p, int n) {\n\t\t\t//Console.WriteLine($\"func {p}\");\n\t\t\tvar s = \"0\";\n\t\t\tvar t = \"1\";\n\t\t\tvar a = count(s, p);\n\t\t\tvar b = count(t, p);\n\n\t\t\tvar m = p.Length;\n\t\t\tif (n == 0) return a;\n\t\t\telse if (n == 1) return a + b + count(s + t, p);\n\t\t\tfor (int len = 1; len < n; len++) {\n\n\t\t\t\tvar tmp = new SB();\n\t\t\t\tvar nt = new SB();\n\t\t\t\tfor (int i = 0; i < Min(s.Length, m - 1); i++) nt.Append(s[i]);\n\t\t\t\tfor (int i = Min(m - 2, s.Length - 1); i >= 0; i--) tmp.Append(s[s.Length - 1 - i]);\n\t\t\t\tif (s.Length > m - 1)\n\t\t\t\t\tnt.Append(\"$\");\n\t\t\t\tfor (int i = Min(m - 2, t.Length - 1); i >= 0; i--) nt.Append(t[t.Length - 1 - i]);\n\t\t\t\tfor (int i = 0; i < Min(t.Length, m - 1); i++) tmp.Append(t[i]);\n\t\t\t\t//Console.WriteLine($\"tmp {tmp.ToString()}\");\n\t\t\t\tvar nb = a + b + count(tmp.ToString(), p);\n\t\t\t\ta = b;\n\t\t\t\tb = nb;\n\t\t\t\ts = t;\n\t\t\t\tt = nt.ToString();\n\t\t\t}\n\t\t\treturn b;\n\t\t}\n\t\tBigInteger count(string s, string p) {\n\t\t\tvar n = s.Length;\n\t\t\tvar m = p.Length;\n\t\t\tvar z = stringEx.ZAlgorithm(p + \"#\" + s);\n\t\t\tlong cnt = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (z[i + 1 + m] >= m) cnt++;\n\t\t\t//Console.WriteLine($\"{s} {p} {cnt}\");\n\t\t\treturn cnt;\n\t\t}\n\n\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 < n; ++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\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#region Z algorithm\nstatic public partial class stringEx {\n\t/// \u3068 [i:] \u306e\u6700\u9577\u5171\u901a\u63a5\u982d\u8f9e\u3092 O(||) \u3067\u6c42\u3081\u308b\u3002\n\tstatic public int[] ZAlgorithm(string s) {\n\t\tvar a = new int[s.Length + 1];\n\t\ta[0] = s.Length;\n\t\tint i = 1, j = 0;\n\t\twhile (i < s.Length) {\n\t\t\twhile (i + j < s.Length && s[j] == s[i + j]) ++j;\n\t\t\ta[i] = j;\n\t\t\tif (j == 0) { ++i; continue; }\n\t\t\tint k = 1;\n\t\t\twhile (i + k < s.Length && k + a[k] < j) { a[i + k] = a[k]; ++k; }\n\t\t\ti += k; j -= k;\n\t\t}\n\t\treturn a;\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a5b9cdeb38c3abf156324afbe30e51b7", "src_uid": "7b4a057efee5264bfaaf60d50fccb92b", "difficulty": 2700} {"lang": "Mono C#", "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;\nusing Number = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri; BigInteger k = rl; var m = ri;\n\t\t\tvar s = \"\";\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tvar cnt = f(s + \"0\", n);\n\t\t\t\t//Console.WriteLine($\"now {s + '0'} {cnt} {k}\");\n\t\t\t\tif (k <= cnt) {\n\t\t\t\t\ts += \"0\";\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {u} {v} {cnt - u - v}\");\n\t\t\t\t\tif (cnt - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tk -= cnt;\n\t\t\t\t\ts += \"1\";\n\t\t\t\t\tvar x = f(s, n);\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//onsole.WriteLine($\"{s} {cnt} {x} {u} {v} {x - u - v}\");\n\t\t\t\t\tif (x - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\tif (k <= 0) break;\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t\tBigInteger f(string p, int n) {\n\t\t\t//Console.WriteLine($\"func {p}\");\n\t\t\tvar s = \"0\";\n\t\t\tvar t = \"1\";\n\t\t\tvar a = count(s, p);\n\t\t\tvar b = count(t, p);\n\n\t\t\tvar m = p.Length;\n\t\t\tif (n == 0) return a;\n\t\t\telse if (n == 1) return a + b + count(s + t, p);\n\t\t\tfor (int len = 1; len < n; len++) {\n\n\t\t\t\tvar tmp = new SB();\n\t\t\t\tvar nt = new SB();\n\t\t\t\tif (len > 14) {\n\t\t\t\t\t//nt.Append(s.Substring(0, Min(s.Length, m - 1)));\n\t\t\t\t\t//tmp.Append(s.Reverse().Take(Min(s.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\tfor (int i = 0; i < Min(s.Length, m - 1); i++) nt.Append(s[i]);\n\t\t\t\t\tfor (int i = Min(m - 2, s.Length - 1); i >= 0; i--) tmp.Append(s[s.Length - 1 - i]);\n\t\t\t\t\t//nt.Append(t.Reverse().Take(Min(t.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\t//tmp.Append(t.Substring(0, Min(t.Length, m - 1)));\n\t\t\t\t\tfor (int i = Min(m - 2, t.Length - 1); i >= 0; i--) nt.Append(t[t.Length - 1 - i]);\n\t\t\t\t\tfor (int i = 0; i < Min(t.Length, m - 1); i++) tmp.Append(t[i]);\n\t\t\t\t\t//Console.WriteLine($\"tmp {tmp.ToString()}\");\n\t\t\t\t\tvar nb = a + b + count(tmp.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnt.Append(s + t);\n\t\t\t\t\tvar nb = count(nt.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn b;\n\t\t}\n\t\tBigInteger count(string s, string p) {\n\t\t\tvar n = s.Length;\n\t\t\tvar m = p.Length;\n\t\t\tvar z = stringEx.ZAlgorithm(p + \"#\" + s);\n\t\t\tlong cnt = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (z[i + 1 + m] >= m) cnt++;\n\t\t\t//Console.WriteLine($\"count {s} {p} {cnt}\");\n\t\t\treturn cnt;\n\t\t}\n\n\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 < n; ++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\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#region Z algorithm\nstatic public partial class stringEx {\n\t/// \u3068 [i:] \u306e\u6700\u9577\u5171\u901a\u63a5\u982d\u8f9e\u3092 O(||) \u3067\u6c42\u3081\u308b\u3002\n\tstatic public int[] ZAlgorithm(string s) {\n\t\tvar a = new int[s.Length + 1];\n\t\ta[0] = s.Length;\n\t\tint i = 1, j = 0;\n\t\twhile (i < s.Length) {\n\t\t\twhile (i + j < s.Length && s[j] == s[i + j]) ++j;\n\t\t\ta[i] = j;\n\t\t\tif (j == 0) { ++i; continue; }\n\t\t\tint k = 1;\n\t\t\twhile (i + k < s.Length && k + a[k] < j) { a[i + k] = a[k]; ++k; }\n\t\t\ti += k; j -= k;\n\t\t}\n\t\treturn a;\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "43a2b781e7ee04fd61c1f6c79cd0c994", "src_uid": "7b4a057efee5264bfaaf60d50fccb92b", "difficulty": 2700} {"lang": "Mono C#", "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;\nusing Number = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri; BigInteger k = rl; var m = ri;\n\t\t\tvar s = \"\";\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tvar cnt = f(s + \"0\", n);\n\t\t\t\t//Console.WriteLine($\"now {s + '0'} {cnt} {k}\");\n\t\t\t\tif (k <= cnt) {\n\t\t\t\t\ts += \"0\";\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {u} {v} {cnt - u - v}\");\n\t\t\t\t\tif (cnt - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tk -= cnt;\n\t\t\t\t\ts += \"1\";\n\t\t\t\t\tvar x = f(s, n);\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//onsole.WriteLine($\"{s} {cnt} {x} {u} {v} {x - u - v}\");\n\t\t\t\t\tif (x - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\tif (k <= 0) break;\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t\tBigInteger f(string p, int n) {\n\t\t\t//Console.WriteLine($\"func {p}\");\n\t\t\tvar s = \"0\";\n\t\t\tvar t = \"1\";\n\t\t\tvar a = count(s, p);\n\t\t\tvar b = count(t, p);\n\n\t\t\tvar m = p.Length;\n\t\t\tif (n == 0) return a;\n\t\t\telse if (n == 1) return a + b + count(s + t, p);\n\t\t\tfor (int len = 1; len < n; len++) {\n\n\t\t\t\tvar tmp = new SB();\n\t\t\t\tvar nt = new SB();\n\t\t\t\tif (len > 11) {\n\t\t\t\t\t//nt.Append(s.Substring(0, Min(s.Length, m - 1)));\n\t\t\t\t\t//tmp.Append(s.Reverse().Take(Min(s.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\tfor (int i = 0; i < Min(s.Length, m - 1); i++) nt.Append(s[i]);\n\t\t\t\t\tfor (int i = Min(m - 2, s.Length - 1); i >= 0; i--) tmp.Append(s[s.Length - 1 - i]);\n\t\t\t\t\t//nt.Append(t.Reverse().Take(Min(t.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\t//tmp.Append(t.Substring(0, Min(t.Length, m - 1)));\n\t\t\t\t\tfor (int i = Min(m - 2, t.Length - 1); i >= 0; i--) nt.Append(t[t.Length - 1 - i]);\n\t\t\t\t\tfor (int i = 0; i < Min(t.Length, m - 1); i++) tmp.Append(t[i]);\n\t\t\t\t\t//Console.WriteLine($\"tmp {tmp.ToString()}\");\n\t\t\t\t\tvar nb = a + b + count(tmp.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnt.Append(s + t);\n\t\t\t\t\tvar nb = count(nt.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn b;\n\t\t}\n\t\tBigInteger count(string s, string p) {\n\t\t\tvar n = s.Length;\n\t\t\tvar m = p.Length;\n\t\t\tvar z = stringEx.ZAlgorithm(p + \"#\" + s);\n\t\t\tlong cnt = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (z[i + 1 + m] >= m) cnt++;\n\t\t\t//Console.WriteLine($\"count {s} {p} {cnt}\");\n\t\t\treturn cnt;\n\t\t}\n\n\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 < n; ++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\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#region Z algorithm\nstatic public partial class stringEx {\n\t/// \u3068 [i:] \u306e\u6700\u9577\u5171\u901a\u63a5\u982d\u8f9e\u3092 O(||) \u3067\u6c42\u3081\u308b\u3002\n\tstatic public int[] ZAlgorithm(string s) {\n\t\tvar a = new int[s.Length + 1];\n\t\ta[0] = s.Length;\n\t\tint i = 1, j = 0;\n\t\twhile (i < s.Length) {\n\t\t\twhile (i + j < s.Length && s[j] == s[i + j]) ++j;\n\t\t\ta[i] = j;\n\t\t\tif (j == 0) { ++i; continue; }\n\t\t\tint k = 1;\n\t\t\twhile (i + k < s.Length && k + a[k] < j) { a[i + k] = a[k]; ++k; }\n\t\t\ti += k; j -= k;\n\t\t}\n\t\treturn a;\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6dce2055e37061356820dbea641655a", "src_uid": "7b4a057efee5264bfaaf60d50fccb92b", "difficulty": 2700} {"lang": "Mono C#", "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;\nusing Number = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri; var k = rl; var m = ri;\n\t\t\tvar s = \"\";\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tvar cnt = f(s + \"0\", n);\n\t\t\t\t//Console.WriteLine($\"{s + '0'} {cnt}\");\n\t\t\t\tif (k <= cnt) {\n\t\t\t\t\ts += \"0\";\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {cnt - u - v}\");\n\t\t\t\t\tk -= cnt - u - v;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ts += \"1\";\n\t\t\t\t\tcnt += f(s, n);\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {cnt - u - v}\");\n\t\t\t\t\tk -= cnt - u - v;\n\n\t\t\t\t}\n\t\t\t\tif (k <= 0) break;\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t\tlong f(string p, int n) {\n\t\t\t//Console.WriteLine($\"func {p}\");\n\t\t\tvar s = \"0\";\n\t\t\tvar t = \"1\";\n\t\t\tvar a = count(s, p);\n\t\t\tvar b = count(t, p);\n\n\t\t\tvar m = p.Length;\n\t\t\tif (n == 0) return a;\n\t\t\telse if (n == 1) return a + b + count(s + t, p);\n\t\t\tfor (int len = 1; len < n; len++) {\n\n\t\t\t\tvar tmp = new SB();\n\t\t\t\tvar nt = new SB();\n\t\t\t\tfor (int i = 0; i < Min(s.Length, m - 1); i++) nt.Append(s[i]);\n\t\t\t\tfor (int i = Min(m - 2, s.Length - 1); i >= 0; i--) tmp.Append(s[s.Length - 1 - i]);\n\t\t\t\tif (s.Length > m - 1)\n\t\t\t\t\tnt.Append(\"$\");\n\t\t\t\tfor (int i = Min(m - 2, t.Length - 1); i >= 0; i--) nt.Append(t[t.Length - 1 - i]);\n\t\t\t\tfor (int i = 0; i < Min(t.Length, m - 1); i++) tmp.Append(t[i]);\n\t\t\t\t//Console.WriteLine($\"tmp {tmp.ToString()}\");\n\t\t\t\tvar nb = Min(INF, a + b + count(tmp.ToString(), p));\n\t\t\t\ta = b;\n\t\t\t\tb = nb;\n\t\t\t\ts = t;\n\t\t\t\tt = nt.ToString();\n\t\t\t}\n\t\t\treturn b;\n\t\t}\n\t\tlong count(string s, string p) {\n\t\t\tvar n = s.Length;\n\t\t\tvar m = p.Length;\n\t\t\tvar z = stringEx.ZAlgorithm(p + s);\n\t\t\tvar cnt = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (z[i + m] >= m) cnt++;\n\t\t\t//Console.WriteLine($\"{s} {p} {cnt}\");\n\t\t\treturn cnt;\n\t\t}\n\n\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 < n; ++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\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#region Z algorithm\nstatic public partial class stringEx {\n\t/// \u3068 [i:] \u306e\u6700\u9577\u5171\u901a\u63a5\u982d\u8f9e\u3092 O(||) \u3067\u6c42\u3081\u308b\u3002\n\tstatic public int[] ZAlgorithm(string s) {\n\t\tvar a = new int[s.Length + 1];\n\t\ta[0] = s.Length;\n\t\tint i = 1, j = 0;\n\t\twhile (i < s.Length) {\n\t\t\twhile (i + j < s.Length && s[j] == s[i + j]) ++j;\n\t\t\ta[i] = j;\n\t\t\tif (j == 0) { ++i; continue; }\n\t\t\tint k = 1;\n\t\t\twhile (i + k < s.Length && k + a[k] < j) { a[i + k] = a[k]; ++k; }\n\t\t\ti += k; j -= k;\n\t\t}\n\t\treturn a;\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "302a750a932e904ff3f7c61d8ffb5158", "src_uid": "7b4a057efee5264bfaaf60d50fccb92b", "difficulty": 2700} {"lang": "Mono C#", "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;\nusing Number = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri; BigInteger k = rl; var m = ri;\n\t\t\tvar s = \"\";\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tvar cnt = f(s + \"0\", n);\n\t\t\t\tConsole.WriteLine($\"now {s + '0'} {cnt} {k}\");\n\t\t\t\tif (k <= cnt) {\n\t\t\t\t\ts += \"0\";\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\tConsole.WriteLine($\"{s} {cnt} {u} {v} {cnt - u - v}\");\n\t\t\t\t\tif (cnt - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tk -= cnt;\n\t\t\t\t\ts += \"1\";\n\t\t\t\t\tvar x = f(s, n);\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\tConsole.WriteLine($\"{s} {cnt} {x} {u} {v} {x - u - v}\");\n\t\t\t\t\tif (x - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\tif (k <= 0) break;\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t\tBigInteger f(string p, int n) {\n\t\t\t//Console.WriteLine($\"func {p}\");\n\t\t\tvar s = \"0\";\n\t\t\tvar t = \"1\";\n\t\t\tvar a = count(s, p);\n\t\t\tvar b = count(t, p);\n\n\t\t\tvar m = p.Length;\n\t\t\tif (n == 0) return a;\n\t\t\telse if (n == 1) return a + b + count(s + t, p);\n\t\t\tfor (int len = 1; len < n; len++) {\n\n\t\t\t\tvar tmp = new SB();\n\t\t\t\tvar nt = new SB();\n\t\t\t\tif (s.Length > 250) {\n\t\t\t\t\tnt.Append(s.Substring(0, Min(s.Length, m - 1)));\n\t\t\t\t\ttmp.Append(s.Reverse().Take(Min(s.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\t//for (int i = 0; i < Min(s.Length, m - 1); i++) nt.Append(s[i]);\n\t\t\t\t\t//for (int i = Min(m - 2, s.Length - 1); i >= 0; i--) tmp.Append(s[s.Length - 1 - i]);\n\t\t\t\t\tnt.Append(t.Reverse().Take(Min(t.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\ttmp.Append(t.Substring(0, Min(t.Length, m - 1)));\n\t\t\t\t\t//for (int i = Min(m - 2, t.Length - 1); i >= 0; i--) nt.Append(t[t.Length - 1 - i]);\n\t\t\t\t\t//for (int i = 0; i < Min(t.Length, m - 1); i++) tmp.Append(t[i]);\n\t\t\t\t\t//Console.WriteLine($\"tmp {tmp.ToString()}\");\n\t\t\t\t\tvar nb = a + b + count(tmp.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnt.Append(s + t);\n\t\t\t\t\tvar nb = count(nt.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t}\n\t\t\t\t//Console.WriteLine($\"{nt.ToString()} {tmp.ToString()} {nb}\");\n\t\t\t\t//var ntt = s + t;\n\t\t\t\ts = t;\n\t\t\t\tt = nt.ToString();\n\t\t\t\t//t = ntt;\n\t\t\t}\n\t\t\treturn b;\n\t\t}\n\t\tBigInteger count(string s, string p) {\n\t\t\tvar n = s.Length;\n\t\t\tvar m = p.Length;\n\t\t\tvar z = stringEx.ZAlgorithm(p + \"#\" + s);\n\t\t\tlong cnt = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (z[i + 1 + m] >= m) cnt++;\n\t\t\t//Console.WriteLine($\"count {s} {p} {cnt}\");\n\t\t\treturn cnt;\n\t\t}\n\n\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 < n; ++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\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#region Z algorithm\nstatic public partial class stringEx {\n\t/// \u3068 [i:] \u306e\u6700\u9577\u5171\u901a\u63a5\u982d\u8f9e\u3092 O(||) \u3067\u6c42\u3081\u308b\u3002\n\tstatic public int[] ZAlgorithm(string s) {\n\t\tvar a = new int[s.Length + 1];\n\t\ta[0] = s.Length;\n\t\tint i = 1, j = 0;\n\t\twhile (i < s.Length) {\n\t\t\twhile (i + j < s.Length && s[j] == s[i + j]) ++j;\n\t\t\ta[i] = j;\n\t\t\tif (j == 0) { ++i; continue; }\n\t\t\tint k = 1;\n\t\t\twhile (i + k < s.Length && k + a[k] < j) { a[i + k] = a[k]; ++k; }\n\t\t\ti += k; j -= k;\n\t\t}\n\t\treturn a;\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "00a8560829b2a7e75ece986379be193e", "src_uid": "7b4a057efee5264bfaaf60d50fccb92b", "difficulty": 2700} {"lang": "Mono C#", "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;\nusing Number = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri; BigInteger k = rl; var m = ri;\n\t\t\tvar s = \"\";\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tvar cnt = f(s + \"0\", n);\n\t\t\t\tConsole.WriteLine($\"now {s + '0'} {cnt} {k}\");\n\t\t\t\tif (k <= cnt) {\n\t\t\t\t\ts += \"0\";\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\tConsole.WriteLine($\"{s} {cnt} {u} {v} {cnt - u - v}\");\n\t\t\t\t\tif (cnt - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tk -= cnt;\n\t\t\t\t\ts += \"1\";\n\t\t\t\t\tvar x = f(s, n);\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\tConsole.WriteLine($\"{s} {cnt} {x} {u} {v} {x - u - v}\");\n\t\t\t\t\tif (x - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\tif (k <= 0) break;\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t\tBigInteger f(string p, int n) {\n\t\t\t//Console.WriteLine($\"func {p}\");\n\t\t\tvar s = \"0\";\n\t\t\tvar t = \"1\";\n\t\t\tvar a = count(s, p);\n\t\t\tvar b = count(t, p);\n\n\t\t\tvar m = p.Length;\n\t\t\tif (n == 0) return a;\n\t\t\telse if (n == 1) return a + b + count(s + t, p);\n\t\t\tfor (int len = 1; len < n; len++) {\n\n\t\t\t\tvar tmp = new SB();\n\t\t\t\tvar nt = new SB();\n\t\t\t\tif (len > 10) {\n\t\t\t\t\tnt.Append(s.Substring(0, Min(s.Length, m - 1)));\n\t\t\t\t\ttmp.Append(s.Reverse().Take(Min(s.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\t//for (int i = 0; i < Min(s.Length, m - 1); i++) nt.Append(s[i]);\n\t\t\t\t\t//for (int i = Min(m - 2, s.Length - 1); i >= 0; i--) tmp.Append(s[s.Length - 1 - i]);\n\t\t\t\t\tnt.Append(t.Reverse().Take(Min(t.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\ttmp.Append(t.Substring(0, Min(t.Length, m - 1)));\n\t\t\t\t\t//for (int i = Min(m - 2, t.Length - 1); i >= 0; i--) nt.Append(t[t.Length - 1 - i]);\n\t\t\t\t\t//for (int i = 0; i < Min(t.Length, m - 1); i++) tmp.Append(t[i]);\n\t\t\t\t\t//Console.WriteLine($\"tmp {tmp.ToString()}\");\n\t\t\t\t\tvar nb = a + b + count(tmp.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnt.Append(s + t);\n\t\t\t\t\tvar nb = count(nt.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn b;\n\t\t}\n\t\tBigInteger count(string s, string p) {\n\t\t\tvar n = s.Length;\n\t\t\tvar m = p.Length;\n\t\t\tvar z = stringEx.ZAlgorithm(p + \"#\" + s);\n\t\t\tlong cnt = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (z[i + 1 + m] >= m) cnt++;\n\t\t\t//Console.WriteLine($\"count {s} {p} {cnt}\");\n\t\t\treturn cnt;\n\t\t}\n\n\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 < n; ++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\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#region Z algorithm\nstatic public partial class stringEx {\n\t/// \u3068 [i:] \u306e\u6700\u9577\u5171\u901a\u63a5\u982d\u8f9e\u3092 O(||) \u3067\u6c42\u3081\u308b\u3002\n\tstatic public int[] ZAlgorithm(string s) {\n\t\tvar a = new int[s.Length + 1];\n\t\ta[0] = s.Length;\n\t\tint i = 1, j = 0;\n\t\twhile (i < s.Length) {\n\t\t\twhile (i + j < s.Length && s[j] == s[i + j]) ++j;\n\t\t\ta[i] = j;\n\t\t\tif (j == 0) { ++i; continue; }\n\t\t\tint k = 1;\n\t\t\twhile (i + k < s.Length && k + a[k] < j) { a[i + k] = a[k]; ++k; }\n\t\t\ti += k; j -= k;\n\t\t}\n\t\treturn a;\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "82bd22520cf8c376a1653afccef187e7", "src_uid": "7b4a057efee5264bfaaf60d50fccb92b", "difficulty": 2700} {"lang": "Mono C#", "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;\nusing Number = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri; BigInteger k = rl; var m = ri;\n\t\t\tvar s = \"\";\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tvar cnt = f(s + \"0\", n);\n\t\t\t\t//Console.WriteLine($\"now {s + '0'} {cnt} {k}\");\n\t\t\t\tif (k <= cnt) {\n\t\t\t\t\ts += \"0\";\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {u} {v} {cnt - u - v}\");\n\t\t\t\t\tif (cnt - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tk -= cnt;\n\t\t\t\t\ts += \"1\";\n\t\t\t\t\tvar x = f(s, n);\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {x} {u} {v} {x - u - v}\");\n\t\t\t\t\tif (x - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\tif (k <= 0) break;\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t\tBigInteger f(string p, int n) {\n\t\t\t//Console.WriteLine($\"func {p}\");\n\t\t\tvar s = \"0\";\n\t\t\tvar t = \"1\";\n\t\t\tvar a = count(s, p);\n\t\t\tvar b = count(t, p);\n\n\t\t\tvar m = p.Length;\n\t\t\tif (n == 0) return a;\n\t\t\telse if (n == 1) return a + b + count(s + t, p);\n\t\t\tfor (int len = 1; len < n; len++) {\n\n\t\t\t\tvar tmp = new SB();\n\t\t\t\tvar nt = new SB();\n\t\t\t\tif (s.Length > 250) {\n\t\t\t\t\tnt.Append(s.Substring(0, Min(s.Length, m - 1)));\n\t\t\t\t\ttmp.Append(s.Reverse().Take(Min(s.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\t//for (int i = 0; i < Min(s.Length, m - 1); i++) nt.Append(s[i]);\n\t\t\t\t\t//for (int i = Min(m - 2, s.Length - 1); i >= 0; i--) tmp.Append(s[s.Length - 1 - i]);\n\t\t\t\t\tnt.Append(t.Reverse().Take(Min(t.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\ttmp.Append(t.Substring(0, Min(t.Length, m - 1)));\n\t\t\t\t\t//for (int i = Min(m - 2, t.Length - 1); i >= 0; i--) nt.Append(t[t.Length - 1 - i]);\n\t\t\t\t\t//for (int i = 0; i < Min(t.Length, m - 1); i++) tmp.Append(t[i]);\n\t\t\t\t\t//Console.WriteLine($\"tmp {tmp.ToString()}\");\n\t\t\t\t\tvar nb = a + b + count(tmp.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnt.Append(s + t);\n\t\t\t\t\tvar nb = count(nt.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t}\n\t\t\t\t//Console.WriteLine($\"{nt.ToString()} {tmp.ToString()} {nb}\");\n\t\t\t\t//var ntt = s + t;\n\t\t\t\ts = t;\n\t\t\t\tt = nt.ToString();\n\t\t\t\t//t = ntt;\n\t\t\t}\n\t\t\treturn b;\n\t\t}\n\t\tBigInteger count(string s, string p) {\n\t\t\tvar n = s.Length;\n\t\t\tvar m = p.Length;\n\t\t\tvar z = stringEx.ZAlgorithm(p + \"#\" + s);\n\t\t\tlong cnt = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (z[i + 1 + m] >= m) cnt++;\n\t\t\t//Console.WriteLine($\"count {s} {p} {cnt}\");\n\t\t\treturn cnt;\n\t\t}\n\n\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 < n; ++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\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#region Z algorithm\nstatic public partial class stringEx {\n\t/// \u3068 [i:] \u306e\u6700\u9577\u5171\u901a\u63a5\u982d\u8f9e\u3092 O(||) \u3067\u6c42\u3081\u308b\u3002\n\tstatic public int[] ZAlgorithm(string s) {\n\t\tvar a = new int[s.Length + 1];\n\t\ta[0] = s.Length;\n\t\tint i = 1, j = 0;\n\t\twhile (i < s.Length) {\n\t\t\twhile (i + j < s.Length && s[j] == s[i + j]) ++j;\n\t\t\ta[i] = j;\n\t\t\tif (j == 0) { ++i; continue; }\n\t\t\tint k = 1;\n\t\t\twhile (i + k < s.Length && k + a[k] < j) { a[i + k] = a[k]; ++k; }\n\t\t\ti += k; j -= k;\n\t\t}\n\t\treturn a;\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a29519b8e9caec50297c0e675d125037", "src_uid": "7b4a057efee5264bfaaf60d50fccb92b", "difficulty": 2700} {"lang": "Mono C#", "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;\nusing Number = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri; BigInteger k = rl; var m = ri;\n\t\t\tvar s = \"\";\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tvar cnt = f(s + \"0\", n);\n\t\t\t\t//Console.WriteLine($\"now {s + '0'} {cnt} {k}\");\n\t\t\t\tif (k <= cnt) {\n\t\t\t\t\ts += \"0\";\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {u} {v} {cnt - u - v}\");\n\t\t\t\t\tif (cnt - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tk -= cnt;\n\t\t\t\t\ts += \"1\";\n\t\t\t\t\tvar x = f(s, n);\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//onsole.WriteLine($\"{s} {cnt} {x} {u} {v} {x - u - v}\");\n\t\t\t\t\tif (x - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\tif (k <= 0) break;\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t\tBigInteger f(string p, int n) {\n\t\t\t//Console.WriteLine($\"func {p}\");\n\t\t\tvar s = \"0\";\n\t\t\tvar t = \"1\";\n\t\t\tvar a = count(s, p);\n\t\t\tvar b = count(t, p);\n\n\t\t\tvar m = p.Length;\n\t\t\tif (n == 0) return a;\n\t\t\telse if (n == 1) return a + b + count(s + t, p);\n\t\t\tfor (int len = 1; len < n; len++) {\n\n\t\t\t\tvar tmp = new SB();\n\t\t\t\tvar nt = new SB();\n\t\t\t\tif (s.Length >= m) {\n\t\t\t\t\t//nt.Append(s.Substring(0, Min(s.Length, m - 1)));\n\t\t\t\t\t//tmp.Append(s.Reverse().Take(Min(s.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\tfor (int i = 0; i < Min(s.Length, m - 1); i++) nt.Append(s[i]);\n\t\t\t\t\tfor (int i = Min(m - 2, s.Length - 1); i >= 0; i--) tmp.Append(s[s.Length - 1 - i]);\n\t\t\t\t\t//nt.Append(t.Reverse().Take(Min(t.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\t//tmp.Append(t.Substring(0, Min(t.Length, m - 1)));\n\t\t\t\t\tfor (int i = Min(m - 2, t.Length - 1); i >= 0; i--) nt.Append(t[t.Length - 1 - i]);\n\t\t\t\t\tfor (int i = 0; i < Min(t.Length, m - 1); i++) tmp.Append(t[i]);\n\t\t\t\t\t//Console.WriteLine($\"tmp {tmp.ToString()}\");\n\t\t\t\t\tvar nb = a + b + count(tmp.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnt.Append(s + t);\n\t\t\t\t\tvar nb = count(nt.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn b;\n\t\t}\n\t\tBigInteger count(string s, string p) {\n\t\t\tvar n = s.Length;\n\t\t\tvar m = p.Length;\n\t\t\tvar z = stringEx.ZAlgorithm(p + \"#\" + s);\n\t\t\tlong cnt = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (z[i + 1 + m] >= m) cnt++;\n\t\t\t//Console.WriteLine($\"count {s} {p} {cnt}\");\n\t\t\treturn cnt;\n\t\t}\n\n\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 < n; ++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\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#region Z algorithm\nstatic public partial class stringEx {\n\t/// \u3068 [i:] \u306e\u6700\u9577\u5171\u901a\u63a5\u982d\u8f9e\u3092 O(||) \u3067\u6c42\u3081\u308b\u3002\n\tstatic public int[] ZAlgorithm(string s) {\n\t\tvar a = new int[s.Length + 1];\n\t\ta[0] = s.Length;\n\t\tint i = 1, j = 0;\n\t\twhile (i < s.Length) {\n\t\t\twhile (i + j < s.Length && s[j] == s[i + j]) ++j;\n\t\t\ta[i] = j;\n\t\t\tif (j == 0) { ++i; continue; }\n\t\t\tint k = 1;\n\t\t\twhile (i + k < s.Length && k + a[k] < j) { a[i + k] = a[k]; ++k; }\n\t\t\ti += k; j -= k;\n\t\t}\n\t\treturn a;\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1d89c54d20ca476726ead3dddd4f68a6", "src_uid": "7b4a057efee5264bfaaf60d50fccb92b", "difficulty": 2700} {"lang": "Mono C#", "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;\nusing Number = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri; BigInteger k = rl; var m = ri;\n\t\t\tvar s = \"\";\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tvar cnt = f(s + \"0\", n);\n\t\t\t\t//Console.WriteLine($\"now {s + '0'} {cnt} {k}\");\n\t\t\t\tif (k <= cnt) {\n\t\t\t\t\ts += \"0\";\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//Console.WriteLine($\"{s} {cnt} {u} {v} {cnt - u - v}\");\n\t\t\t\t\tif (cnt - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tk -= cnt;\n\t\t\t\t\ts += \"1\";\n\t\t\t\t\tvar x = f(s, n);\n\t\t\t\t\tvar u = f(s + \"0\", n);\n\t\t\t\t\tvar v = f(s + \"1\", n);\n\t\t\t\t\t//onsole.WriteLine($\"{s} {cnt} {x} {u} {v} {x - u - v}\");\n\t\t\t\t\tif (x - u - v != 0) k--;\n\t\t\t\t}\n\t\t\t\tif (k <= 0) break;\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t\tBigInteger f(string p, int n) {\n\t\t\t//Console.WriteLine($\"func {p}\");\n\t\t\tvar s = \"0\";\n\t\t\tvar t = \"1\";\n\t\t\tvar a = count(s, p);\n\t\t\tvar b = count(t, p);\n\n\t\t\tvar m = p.Length;\n\t\t\tif (n == 0) return a;\n\t\t\telse if (n == 1) return b;\n\t\t\tfor (int len = 1; len < n; len++) {\n\n\t\t\t\tvar tmp = new SB();\n\t\t\t\tvar nt = new SB();\n\t\t\t\tif (len > 14) {\n\t\t\t\t\t//nt.Append(s.Substring(0, Min(s.Length, m - 1)));\n\t\t\t\t\t//tmp.Append(s.Reverse().Take(Min(s.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\tfor (int i = 0; i < Min(s.Length, m - 1); i++) nt.Append(s[i]);\n\t\t\t\t\tfor (int i = Min(m - 2, s.Length - 1); i >= 0; i--) tmp.Append(s[s.Length - 1 - i]);\n\t\t\t\t\t//nt.Append(t.Reverse().Take(Min(t.Length, m - 1)).Reverse().AsString());\n\t\t\t\t\t//tmp.Append(t.Substring(0, Min(t.Length, m - 1)));\n\t\t\t\t\tfor (int i = Min(m - 2, t.Length - 1); i >= 0; i--) nt.Append(t[t.Length - 1 - i]);\n\t\t\t\t\tfor (int i = 0; i < Min(t.Length, m - 1); i++) tmp.Append(t[i]);\n\t\t\t\t\t//Console.WriteLine($\"tmp {tmp.ToString()}\");\n\t\t\t\t\tvar nb = a + b + count(tmp.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnt.Append(s + t);\n\t\t\t\t\tvar nb = count(nt.ToString(), p);\n\t\t\t\t\ta = b;\n\t\t\t\t\tb = nb;\n\t\t\t\t\ts = t;\n\t\t\t\t\tt = nt.ToString();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn b;\n\t\t}\n\t\tBigInteger count(string s, string p) {\n\t\t\tvar n = s.Length;\n\t\t\tvar m = p.Length;\n\t\t\tvar z = stringEx.ZAlgorithm(p + \"#\" + s);\n\t\t\tlong cnt = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (z[i + 1 + m] >= m) cnt++;\n\t\t\t//Console.WriteLine($\"count {s} {p} {cnt}\");\n\t\t\treturn cnt;\n\t\t}\n\n\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 < n; ++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\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#region Z algorithm\nstatic public partial class stringEx {\n\t/// \u3068 [i:] \u306e\u6700\u9577\u5171\u901a\u63a5\u982d\u8f9e\u3092 O(||) \u3067\u6c42\u3081\u308b\u3002\n\tstatic public int[] ZAlgorithm(string s) {\n\t\tvar a = new int[s.Length + 1];\n\t\ta[0] = s.Length;\n\t\tint i = 1, j = 0;\n\t\twhile (i < s.Length) {\n\t\t\twhile (i + j < s.Length && s[j] == s[i + j]) ++j;\n\t\t\ta[i] = j;\n\t\t\tif (j == 0) { ++i; continue; }\n\t\t\tint k = 1;\n\t\t\twhile (i + k < s.Length && k + a[k] < j) { a[i + k] = a[k]; ++k; }\n\t\t\ti += k; j -= k;\n\t\t}\n\t\treturn a;\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d9dc753e7f82458f59fce17cd489ac3b", "src_uid": "7b4a057efee5264bfaaf60d50fccb92b", "difficulty": 2700} {"lang": "MS C#", "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 l = ReadListOfLongs();\n\t\t\tvar a = l[0];\n\t\t\tvar b = l[1];\n\t\t\tlong ans = (a * (a + 1) / 2) % Osn;\n\t\t\tans = (ans * b + a) % Osn;\n\t\t\tans = (((b * (b - 1) / 2) % Osn) * ans) % Osn;\n\t\t\tConsole.WriteLine(ans);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "974108a63420f2cf9851de4a6b2e98f7", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF272\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 const long module = 1000000007L;\n string[] input = sr.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n long a = Int64.Parse(input[0]);\n long b = Int64.Parse(input[1]);\n if (b == 1)\n {\n Console.WriteLine(0);\n return;\n }\n long sum = 0L;\n for (long i = 1; i <= a; i++)\n {\n long first = (i*b + 1)%module;\n long second = (b*(b - 1)/2)%module;\n sum += (first * second) % module;\n }\n Console.WriteLine(sum%module);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c938fece8233022da1d9a804a3f54b34", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "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 long a = Next();\n long b = Next();\n long ans = 0;\n const long m = 1000000007;\n long b1 = b - 1;\n long d = b1 * (b1 + 1) / 2;\n d = d % m;\n for(long k = 1; k <= a; k++) {\n long y = k * b + 1;\n y %= m;\n long s = y * d;\n s %= m;\n ans = (ans + s) % m;\n }\n writer.WriteLine(ans);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "776260593ecfc763b4e14ede0597411e", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "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.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 private const int MOD = 1000000007;\n\n public object Solve()\n {\n long a = ReadInt();\n long b = ReadInt();\n\n long ans = 0;\n for (int i = 1; i <= a; i++)\n ans = (ans + b * (b - 1) / 2 % MOD * (i * b % MOD + 1) % MOD) % MOD;\n\n return 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 = 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fad9da6b35564b9d54a538d597d41e84", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n \nclass TEST{\n static void Main(){\n Sol mySol =new Sol();\n mySol.Solve();\n }\n}\n\nclass Sol{\n public void Solve(){\n long mod=(long)(1e9+7);\n if(B==1){\n Console.WriteLine(0);\n return;\n }\n \n long xx=(B-1)*B;\n xx/=2;\n xx%=mod;\n \n long yy=A*(A+1);\n yy/=2;yy%=mod;\n yy*=B;\n yy%=mod;\n yy+=A;\n \n long Ans=xx*yy;\n Ans%=mod;\n Console.WriteLine(Ans);\n \n \n \n }\n long A;\n long B;\n public Sol(){\n var d=rla();\n A=d[0];B=d[1];\n }\n\n\n\n\n static String rs(){return Console.ReadLine();}\n static int ri(){return int.Parse(Console.ReadLine());}\n static long rl(){return long.Parse(Console.ReadLine());}\n static double rd(){return double.Parse(Console.ReadLine());}\n static String[] rsa(){return Console.ReadLine().Split(' ');}\n static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}\n static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "33741e2ffeea88f336738e8df4f4a5ea", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "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 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\n\n class Program\n {\n protected IOHelper ioHelper;\n\n public void Solve()\n {\n int a = ioHelper.ReadNextInt();\n int b = ioHelper.ReadNextInt();\n long p = 1000000007;\n\n if (b <= 1)\n ioHelper.WriteLine(\"0\");\n else\n {\n long left1 = b;\n long interm1 = (long)a * (a + 1) / 2;\n interm1 %= p;\n left1 *= interm1;\n left1 %= p;\n left1 += a;\n left1 %= p;\n long right1 = (long)b * (b - 1) / 2;\n right1 %= p;\n long result = left1 * right1;\n result %= p;\n ioHelper.WriteLine(string.Format(\"{0}\", result));\n }\n ioHelper.Dispose();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7fd72fbd1229c1115f3b3219561c4582", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "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 a = sc.Long();\n var b = sc.Long();\n const long mod = (long)1e9 + 7;\n var sum = (((((a * (a + 1) / 2) % mod) * b + a) % mod) * (((b * (b - 1) / 2)) % mod)) % mod;\n IO.Printer.Out.PrintLine(sum);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "89b0a2207634742f323a5a02c85d468a", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "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 a = sc.Long();\n var b = sc.Long();\n const long mod = (long)1e9 + 7;\n var ret = ((((a * (a + 1) / 2) % mod) * b + a) % mod) * ((b * (b - 1) / 2) % mod) % mod;\n IO.Printer.Out.PrintLine(ret);\n }\n internal IO.Scanner 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.Scanner(Console.In);\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(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(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 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 do this.buffer = this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries);\n while (this.buffer.Length == 0);\n this.position = 0;\n return this.buffer[this.position++];\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 ar[i] = this.Scan();\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 }\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//*/", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc17f8b111453d58ebb21324fb961779", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Numerics;\n\nnamespace codeforces_csharp\n{\n class Program\n {\n private const UInt64 P = 1000000007;\n\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n var input_args = input.Split(' ');\n\n BigInteger a = BigInteger.Parse(input_args[0].Trim());\n BigInteger b = BigInteger.Parse(input_args[1].Trim());\n\n BigInteger result = a*b*b*(a + 1)*(b - 1)/4 + a*b*(b - 1)/2;\n\n Console.WriteLine((result%P).ToString());\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ac2b18c4f7af0ffef32fd2d06083621", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "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 const int MODULO = 1000000007;\n int a = 0, b = 0;\n\n MyReader.SplitTwoInt(out a, out b);\n\n long factor = (long)b * (long)(b - 1);\n factor /= 2;\n factor %= MODULO;\n\n long num = 0;\n for (long i = 1; i <= a; i++)\n {\n long temp = ((long)b * i) + 1;\n temp %= MODULO;\n\n temp *= factor;\n temp %= MODULO;\n\n num += temp;\n num %= MODULO;\n }\n\n Console.WriteLine(num);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "db5bb2dd7319a4318a77864298beb81b", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nclass Algo\n{\n const long MOD = (long)1e9 + 7;\n public void Run()\n {\n string[] tokens = cin.ReadLine().Split();\n long a = long.Parse(tokens[0]);\n long b = long.Parse(tokens[1]);\n long sum = (a * (a + 1) / 2) % MOD;\n long ans = 0;\n for (long i = 1; i < b; i++)\n {\n long first = (((b * i) % MOD) * sum) % MOD;\n long second = (i * a) % MOD;\n ans += (first + second) % MOD;\n ans %= MOD;\n //b * i * sum + i * a;\n }\n cout.WriteLine(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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d7dba3bf8ae9080a272207b9133497f2", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Dreamoon_and_Sums\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 long mod = 1000000007;\n long a = Next();\n long b = Next();\n\n long sum = 0;\n for (long i = 1; i < b; i++)\n {\n long count = a;\n long b0 = (i*b + i)%mod;\n sum += (count * b0) % mod + ((((count - 1) * count / 2) % mod * i) % mod * b) % mod;\n sum = sum%mod;\n }\n\n writer.WriteLine(sum%mod);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "860515a51128f92ceea54dc12efcb321", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "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 const int MODULO = 1000000007;\n int a = 0, b = 0;\n\n MyReader.SplitTwoInt(out a, out b);\n\n long factor1 = (((long)b * (long)(b - 1))) / 2;\n factor1 %= MODULO;\n\n long factor2 = (((long)a * (long)(a + 1))) / 2;\n factor2 %= MODULO;\n\n long num = (factor1 * ((factor2 * (long)b + (long)a) % MODULO)) % MODULO;\n Console.WriteLine(num);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e580b6d8af4b72b247f670280bcde857", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF272\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 a = Int32.Parse(input[0]);\n int b = Int32.Parse(input[1]);\n if (b == 1)\n {\n Console.WriteLine(0);\n return;\n }\n long sum = 0L;\n for (long i = 1; i <= a; i++)\n {\n sum += (i*b + 1)*(b*(b - 1)/2)%10000000007;\n }\n Console.WriteLine(sum);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e601297afa65b3c6dd803cd4ff908cb2", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF272\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 const long module = 1000000007L;\n string[] input = sr.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n long a = Int64.Parse(input[0]);\n long b = Int64.Parse(input[1]);\n if (b == 1)\n {\n Console.WriteLine(0);\n return;\n }\n long sum = 0L;\n for (long i = 1; i <= a; i++)\n {\n sum += ((i*b + 1)*(b*(b - 1)/2)); \n }\n Console.WriteLine(sum%module);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a2dd51c75d42756041693f8a5350ecb2", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF272\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 const long module = 1000000007L;\n string[] input = sr.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n long a = Int64.Parse(input[0]);\n long b = Int64.Parse(input[1]);\n if (b == 1)\n {\n Console.WriteLine(0);\n return;\n }\n long sum = 0L;\n for (long i = 1; i <= a; i++)\n {\n sum += (((i*b) + 1)*((b*(b - 1))/2))%module; \n }\n Console.WriteLine(sum);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1264e5ccaaa678bc5601decd4fc903ec", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Dreamoon_and_Sums\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 long mod = 1000000007;\n long a = Next();\n long b = Next();\n\n long sum = 0;\n for (long i = 1; i < b; i++)\n {\n long count = a;\n long b0 = (i*b + i)%mod;\n sum += (count*b0)%mod + ((count - 1)*count/2*b)%mod;\n sum = sum%mod;\n }\n\n writer.WriteLine(sum%mod);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ed2a1a3efea791b5cc459160d488316", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] ab = Console.ReadLine().Split();\n BigInteger a, b;\n BigInteger.TryParse(ab[0], out a);\n BigInteger.TryParse(ab[1], out b);\n BigInteger sum = (b - 1) * b / 2 * (a + b * a / 2 + b * a * a / 2) % 1000000007;\n Console.WriteLine(sum.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d3a16fca862de21b22a6422cb40ca3ff", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "using 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 a = sc.Long();\n var b = sc.Long();\n var sum = 0L;\n const long mod = (long)1e9 + 7;\n\n for (int m = 1; m < b; m++)\n {\n var n = a * m;\n var k = n % mod;\n var sn = (k * (m + b)) % mod;\n sn += (((k * (k-1)/2) % mod) * b) % mod;\n sum = (sum + sn) % mod;\n }\n IO.Printer.Out.PrintLine(sum);\n /*\n var primes = Sieve((int)1e6);\n var n = sc.Integer();\n var k = sc.Integer();\n var used = new bool[(int)1e6];\n for (int _ = 1; _ <= n; _++)\n {\n \n }*/\n }\n static public long ModPow(long x, long n, long mod)\n {\n long r = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n r = r * x % mod;\n x = x * x % mod;\n n >>= 1;\n }\n return r;\n }\n\n static public int[] Sieve(int p)\n {\n var isPrime = new bool[p + 1];\n var l = new List();\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 l.Add(i);\n for (int j = i * i; j <= p; j += i)\n isPrime[j] = false;\n }\n return l.ToArray();\n }\n internal IO.Scanner 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.Scanner(Console.In);\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(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(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 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 do this.buffer = this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries);\n while (this.buffer.Length == 0);\n this.position = 0;\n return this.buffer[this.position++];\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 ar[i] = this.Scan();\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 }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "118b12ca65177db1cae9cc1e2e875c08", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF272\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 const long module = 1000000007L;\n string[] input = sr.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n int a = Int32.Parse(input[0]);\n int b = Int32.Parse(input[1]);\n if (b == 1)\n {\n Console.WriteLine(0);\n return;\n }\n long sum = 0L;\n for (long i = 1; i <= a; i++)\n {\n sum += ((i*b + 1)*(b*(b - 1)/2));\n sum = sum%module;\n }\n Console.WriteLine(sum);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9577e0b35a7bf33c943fa95101714770", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Dreamoon_and_Sums\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 long mod = 1000000007;\n long a = Next();\n long b = Next();\n\n long sum = 0;\n for (long i = 1; i < b; i++)\n {\n long count = a/i;\n if (count == 0)\n break;\n long b0 = i*b + i;\n sum += (2*b0 + b*(count - 1))*count/2;\n sum = sum%mod;\n }\n\n writer.WriteLine(sum%mod);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b202559772f9671b8d13c5b3f3b4155b", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Dreamoon_and_Sums\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 long mod = 1000000007;\n long a = Next();\n long b = Next();\n\n long sum = 0;\n for (long i = 1; i < b; i++)\n {\n long count = a;\n long b0 = (i*b + i)%mod;\n sum += (count*b0)%mod + (((count - 1)*count/2*i)%mod*b)%mod;\n sum = sum%mod;\n }\n\n writer.WriteLine(sum%mod);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0fa4f178430954741d82f4163f041f40", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "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 long a = Next();\n long b = Next();\n long ans = 0;\n const long m = 1000000007;\n long b1 = b - 1;\n long d = b1 * (b1 + 1) / 2;\n d = d % m;\n for(int k = 1; k <= a; k++) {\n long y = k * b + 1;\n long s = y * d;\n ans = (ans + s) % m;\n }\n writer.WriteLine(ans);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ab01a02b5b3d295091b3d12238e3c303", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF272\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 a = Int32.Parse(input[0]);\n int b = Int32.Parse(input[1]);\n if (b == 1)\n {\n Console.WriteLine(0);\n return;\n }\n long sum = 0L;\n for (long i = 1; i <= a; i++)\n {\n sum += ((i*b + 1)*(b*(b - 1)/2))%10000000007;\n }\n Console.WriteLine(sum);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fa6f4637e99648443c2e8802a1b77e5f", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Dreamoon_and_Sums\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 long mod = 1000000007;\n long a = Next();\n long b = Next();\n\n long sum = 0;\n for (long i = 1; i < b; i++)\n {\n long count = a/i;\n if (count == 0)\n break;\n long b0 = i*b + i;\n sum += (count*b0)%mod + ((count - 1)*count/2*b)%mod;\n sum = sum%mod;\n }\n\n writer.WriteLine(sum%mod);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cbbe980f78bbfa4b5b41c4d4a6654fff", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF272\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 const long module = 10000000007L;\n string[] input = sr.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n int a = Int32.Parse(input[0]);\n int b = Int32.Parse(input[1]);\n if (b == 1)\n {\n Console.WriteLine(0);\n return;\n }\n long sum = 0L;\n for (long i = 1; i <= a; i++)\n {\n sum += (((i*b)%module + 1)*(((b*(b - 1))%module)/2))%module;\n }\n Console.WriteLine(sum);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3f78267b790eff66ca8db74aeb7d4e25", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Dreamoon_and_Sums\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 long mod = 1000000007;\n long a = Next();\n long b = Next();\n\n long sum = 0;\n for (long i = 1; i < b; i++)\n {\n long count = a;\n if (count == 0)\n break;\n long b0 = i*b + i;\n sum += (count*b0)%mod + ((count - 1)*count/2*b)%mod;\n sum = sum%mod;\n }\n\n writer.WriteLine(sum%mod);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b871f294ec1f6350c4fb5d765adfe617", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF272\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 const long module = 1000000007L;\n string[] input = sr.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n long a = Int64.Parse(input[0]);\n long b = Int64.Parse(input[1]);\n if (b == 1)\n {\n Console.WriteLine(0);\n return;\n }\n long sum = 0L;\n for (long i = 1; i <= a; i++)\n {\n sum += ((i*b + 1)*(b*(b - 1)/2))%module; \n }\n Console.WriteLine(sum);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "366c736ef43a1e933a9cf5368c065723", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "Mono C#", "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\tlong mod=(long)(1e9+7);\n\t\tif(B==1){\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlong xx=(B-1)*B;\n\t\txx/=2;\n\t\txx%=mod;\n\t\t\n\t\tlong yy=A*(A+1);\n\t\tyy/=2;\n\t\tyy*=B;\n\t\tyy%=mod;\n\t\tyy+=A;\n\t\t\n\t\tlong Ans=xx*yy;\n\t\tAns%=mod;\n\t\tConsole.WriteLine(Ans);\n\t\t\n\t\t\n\t\t\n\t}\n\tlong A;\n\tlong B;\n\tpublic Sol(){\n\t\tvar d=rla();\n\t\tA=d[0];B=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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "80b13210da3fa9cae928922ac5b9f753", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF272\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 const long module = 1000000007L;\n string[] input = sr.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n int a = Int32.Parse(input[0]);\n int b = Int32.Parse(input[1]);\n if (b == 1)\n {\n Console.WriteLine(0);\n return;\n }\n long sum = 0L;\n for (long i = 1; i <= a; i++)\n {\n sum += (((i*b)%module + 1)*((b*(b - 1))%module/2))%module; \n }\n Console.WriteLine(sum);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bee89f082f5a72c4d279a14ac8a12dfd", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_Sums\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int c = Console.Read();\n // Console.Write(c);\n long a = My_get_int();\n long b = My_get_int();\n long sum = 0, i, j;\n for (i = 1; i < b; i++)\n for (j = 1; j <= a / i; j++)\n {\n sum += j * i * b + i;\n }\n Console.Write(sum);\n }\n static int My_get_int()\n {\n int i = 0;\n char c;\n c =(char) Console.Read();\n while((int)c!=32&&(int)c!=13)\n {\n i = i * 10 + c - 48;\n c = (char)Console.Read();\n }\n return i;\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dd7167790817b32bcecea089aabbefcf", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF272\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 const long module = 10000000007L;\n string[] input = sr.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n int a = Int32.Parse(input[0]);\n int b = Int32.Parse(input[1]);\n if (b == 1)\n {\n Console.WriteLine(0);\n return;\n }\n long sum = 0L;\n for (long i = 1; i <= a; i++)\n {\n sum += ((i*b + 1)*(b*(b - 1)/2));\n sum = sum%module;\n }\n Console.WriteLine(sum);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ee6d0e991ca0060d1ecec51c740cf52f", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_Sums\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int c = Console.Read();\n // Console.Write(c);\n long a = My_get_int();\n long b = My_get_int();\n long sum = 0, i, j;\n for (i = 1; i < b; i++)\n for (j = 1; j <= a; j++)\n {\n sum += j * i * b + i;\n while(sum>1000000007)\n {\n sum -= 1000000007;\n }\n }\n Console.Write(sum);\n }\n static int My_get_int()\n {\n int i = 0;\n char c;\n c =(char) Console.Read();\n while((int)c!=32&&(int)c!=13)\n {\n i = i * 10 + c - 48;\n c = (char)Console.Read();\n }\n return i;\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dd72a89bdb7de63fbc04dd1bbf005ffb", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_Sums\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int c = Console.Read();\n // Console.Write(c);\n long a = My_get_int();\n long b = My_get_int();\n long sum = 0, i, j;\n for (i = 1; i < b; i++)\n for (j = 1; j <= a; j++)\n {\n sum += (j * i * b + i)%1000000007;\n sum %= 1000000007;\n \n }\n Console.Write(sum);\n }\n static int My_get_int()\n {\n int i = 0;\n char c;\n c =(char) Console.Read();\n while((int)c!=32&&(int)c!=13)\n {\n i = i * 10 + c - 48;\n c = (char)Console.Read();\n }\n return i;\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7997a300bbf64049ed421084f29fd820", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "using 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 C();\n }\n\n private static void C()\n {\n var scanner = new MyScanner();\n ulong a = scanner.NextInt();\n ulong b = scanner.NextInt();\n long m = 1000000007;\n ulong ans = 0;\n for (ulong i = 1; i < b; i++)\n {\n ans += (a*i + (((a*(a + 1)/2)%m)*b)%m*i)%m;\n ans %= m;\n }\n Print(ans.ToString());\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "06ecbf3cae972c7b6d5ba7bc9dd5065d", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "#include \nint main()\n{\n long a,b,sum;\n int i,j;\n scanf(\"%ld%ld\",&a,&b);\n for(i=1;i 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2953983820b3e18d0a936b30f47459e1", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "using 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 C();\n }\n\n private static void C()\n {\n var scanner = new MyScanner();\n ulong a = (ulong)scanner.NextInt();\n ulong b = (ulong)scanner.NextInt();\n long m = 1000000007;\n ulong ans = 0;\n for (ulong i = 1; i < b; i++)\n {\n ans += (a*i + (((a*(a + 1)/2)%m)*b)%m*i)%m;\n ans %= m;\n }\n Print(ans.ToString());\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "168e1eca062f3809aaf4bcc1d787b4b8", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_Sums\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a = Int64.Parse(Console.ReadLine());\n long b = Int64.Parse(Console.ReadLine());\n long sum = 0,i,j;\n for(i=1;i 0)\n {\n while (k > 0 && d[i] % 2 == 0)\n {\n d[i] /= 2;\n k--;\n }\n i++;\n }\n\n long ans = 1;\n foreach (var l in d)\n {\n ans = (ans * l) % mod;\n }\n Writer.Write(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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b1b2b9e4b0ec5ae885833e8e6bebae9b", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFTraining.D_s\n{\n class Polyline340\n {\n public static void Main(string[] args)\n {\n List p = new List();\n for (int i = 0; i < 3; i++) {\n string[] line = Console.ReadLine().Split(' ');\n p.Add(new Point{ x = Convert.ToInt32(line[0]), y = Convert.ToInt32(line[1])});\n }\n\n if (p[0].x == p[1].x && p[1].x == p[2].x\n || p[0].y == p[1].y && p[1].y == p[2].y) Console.WriteLine(1);\n else\n {\n int s1 = p[0].LieInSameLine(p[1]), s2 = p[0].LieInSameLine(p[2]), s3 = p[1].LieInSameLine(p[2]);\n if (s1 > 0 && (s3 > 0 || s2 > 0)) Console.WriteLine(2);\n else if (s2 > 0 && (s1 > 0 || s3 > 0)) Console.WriteLine(2);\n else if (s3 > 0 && (s1 > 0 || s2 > 0)) Console.WriteLine(2);\n else Console.WriteLine(3);\n }\n }\n }\n\n class Point\n {\n public int x, y;\n public int LieInSameLine(Point p)\n {\n if (x == p.x) return 1;\n else if (y == p.y) return 2;\n else return 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "564945bb81b479fc20f5dc08c8499ac0", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFTraining.D_s\n{\n class Polyline340\n {\n public static void Main(string[] args)\n {\n List p = new List();\n for (int i = 0; i < 3; i++) {\n string[] line = Console.ReadLine().Split(' ');\n p.Add(new Point{ x = Convert.ToInt32(line[0]), y = Convert.ToInt32(line[1])});\n }\n\n if (p[0].x == p[1].x && p[1].x == p[2].x\n || p[0].y == p[1].y && p[1].y == p[2].y) Console.WriteLine(1);\n else\n {\n int s1 = p[0].LieInSameLine(p[1]), s2 = p[0].LieInSameLine(p[2]), s3 = p[1].LieInSameLine(p[2]);\n if (s1 > 0 || s2 > 0 || s3 > 0) Console.WriteLine(2);\n else Console.WriteLine(3);\n }\n }\n }\n\n class Point\n {\n public int x, y;\n public int LieInSameLine(Point p)\n {\n if (x == p.x) return 1;\n else if (y == p.y) return 2;\n else return 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "87816d73a2e9d04cd169ef3c6bf8bf39", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFTraining.D_s\n{\n class Polyline340\n {\n public static void Main(string[] args)\n {\n List p = new List();\n for (int i = 0; i < 3; i++) {\n string[] line = Console.ReadLine().Split(' ');\n p.Add(new Point{ x = Convert.ToInt32(line[0]), y = Convert.ToInt32(line[1])});\n }\n\n if (p[0].x == p[1].x && p[1].x == p[2].x\n || p[0].y == p[1].y && p[1].y == p[2].y) Console.WriteLine(1);\n else\n {\n int s1 = p[0].LieInSameLine(p[1]), s2 = p[0].LieInSameLine(p[2]), s3 = p[1].LieInSameLine(p[2]);\n if (s1 > 0)\n {\n if (s1 == 1)\n {\n int min = Math.Min(p[0].x, p[1].x);\n int max = Math.Max(p[0].x, p[1].x);\n if (p[2].x < min || p[2].x > max)\n {\n Console.WriteLine(3);\n return;\n }\n }\n if (s1 == 2)\n {\n int min = Math.Min(p[0].y, p[1].y);\n int max = Math.Max(p[0].y, p[1].y);\n if (p[2].y < min || p[2].y > max)\n {\n Console.WriteLine(3);\n return;\n }\n }\n }\n\n else if (s2 > 0)\n {\n if (s2 == 1)\n {\n int min = Math.Min(p[0].x, p[2].x);\n int max = Math.Max(p[0].x, p[2].x);\n if (p[1].x < min || p[1].x > max)\n {\n Console.WriteLine(3);\n return;\n }\n }\n if (s2 == 2)\n {\n int min = Math.Min(p[0].y, p[2].y);\n int max = Math.Max(p[0].y, p[2].y);\n if (p[1].y < min || p[1].y > max)\n {\n Console.WriteLine(3);\n return;\n }\n }\n }\n else if (s3 > 0)\n {\n if (s3 == 1)\n {\n int min = Math.Min(p[1].x, p[2].x);\n int max = Math.Max(p[1].x, p[2].x);\n if (p[0].x < min || p[0].x > max)\n {\n Console.WriteLine(3);\n return;\n }\n }\n if (s3 == 2)\n {\n int min = Math.Min(p[1].y, p[2].y);\n int max = Math.Max(p[1].y, p[2].y);\n if (p[0].y < min || p[0].y > max)\n {\n Console.WriteLine(3);\n return;\n }\n }\n }\n else if (s1 > 0 || s2 > 0 || s3 > 0) Console.WriteLine(2);\n else Console.WriteLine(3);\n }\n }\n }\n\n class Point\n {\n public int x, y;\n public int LieInSameLine(Point p)\n {\n if (x == p.x) return 1;\n else if (y == p.y) return 2;\n else return 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1cfeeeba405fa1d9e8f5ab3d406fd073", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace CompetitiveProgramming\n{\n class Program\n {\n static bool s_IsMultipleTestCases = false;\n static void Main(string[] args)\n {\n InputReader input = new InputReader();\n TextWriter output = Console.Out;\n var numberOfTest = 1;\n if (s_IsMultipleTestCases)\n {\n numberOfTest = input.NextInt();\n }\n for (var testNumber = 1; testNumber <= numberOfTest; ++testNumber)\n {\n Task solver = new Task();\n solver.Solve(testNumber, input, output);\n }\n\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n\n class Task\n {\n public void Solve(int testNumber, InputReader ip, TextWriter op)\n {\n int n = 3;\n var x = new int[n];\n var y = new int[n];\n for (var i = 0; i < n; ++i)\n {\n x[i] = ip.NextInt();\n y[i] = ip.NextInt();\n }\n if (IsCaseOne(x, y))\n {\n op.WriteLine(1);\n }\n else if (IsCaseTwo(x, y))\n {\n op.WriteLine(2);\n }\n else\n {\n op.WriteLine(3);\n }\n }\n\n private bool IsCaseOne(int[] x, int[] y)\n {\n return (x[0] == x[1] && x[1] == x[2]) || (y[0] == y[1] && y[1] == y[2]);\n }\n\n private bool IsCaseTwo(int[] x, int[] y)\n {\n bool isValid = false;\n isValid |= x[0] == x[1] && (x[2] >= Max(x[0],x[1]) || x[2] <= Min(x[0], x[1]));\n isValid |= x[1] == x[2] && (x[0] >= Max(x[1], x[2]) || x[0] <= Min(x[1], x[2]));\n isValid |= x[2] == x[0] && (x[1] >= Max(x[2], x[0]) || x[1] <= Min(x[2], x[0]));\n isValid |= y[0] == y[1] && (y[2] >= Max(y[0], y[1]) || y[2] <= Min(y[0], y[1]));\n isValid |= y[1] == y[2] && (y[0] >= Max(y[1], y[2]) || y[0] <= Min(y[1], y[2]));\n isValid |= y[2] == y[0] && (y[1] >= Max(y[2], y[0]) || y[1] <= Min(y[2], y[0]));\n return isValid;\n }\n\n private int Max(int v1, int v2)\n {\n return Math.Max(v1, v2);\n }\n\n private int Min(int v1, int v2)\n {\n return Math.Min(v1,v2);\n }\n }\n\n class InputReader\n {\n static int s_index = 0;\n static string[] s_tokens;\n public string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Length)\n {\n s_tokens = Console.ReadLine().Split(' ').ToArray();\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n\n public string NextLine()\n {\n return Console.ReadLine();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f4fbc22377f576fb58d89aa4de777194", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace D.Polyline\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[][] p = new long[3][];\n for (var i = 0; i < 3; ++i)\n p[i] = new long[2];\n for(var i = 0; i < 3; ++i) {\n var nm = Console.ReadLine().Split();\n p[i][0] = long.Parse(nm[0]);\n p[i][1] = long.Parse(nm[1]);\n }\n Console.WriteLine(function(p));\n }\n static long function(long [][] p)\n {\n long []x = p[0];\n long []y = p[1];\n long []z = p[2];\n long _x = x[0];\n long _y = y[0];\n\n if (x[0] == y[0] && y[0] == z[0])\n return 1;\n\n if (x[1] == y[1] && y[1] == z[1])\n return 1;\n\n int mn = dist(x, y, z);\n mn = Math.Min(mn, dist(x, z, y));\n if (mn == 4)\n return 3;\n\n if (belong(x, y, z) || belong(z, x, y) || belong(x, z, y))\n return 2;\n return 3;\n\n }\n static int dist(long[] x, long[] y, long[] z)\n {\n int sm = (x[0] - y[0] != 0) ? 1 : 0;\n sm += (x[1] - y[1] != 0) ? 1 : 0;\n sm += (z[0] - y[0] != 0) ? 1 : 0;\n sm += (z[1] - y[1] != 0) ? 1 : 0;\n return sm;\n }\n static bool belong(long[] p1, long[] p2, long[] p3)\n {\n \n return ( Math.Min(p1[0], p3[0]) <= p2[0] && p2[0] <= Math.Max(p1[0], p3[0] )) || (Math.Min(p1[1], p3[1]) <= p2[1] && p2[1] <= Math.Max(p1[1], p3[1]));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "960aa118781ee27b7af56c6c36ebbb4b", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nclass Program\n{\n public class Point\n {\n public int X;\n public int Y;\n }\n\n public static Point ReadPoint()\n {\n var p = new Point();\n p.X = ReadInt();\n p.Y = ReadInt();\n\n return p;\n }\n\n private static int Count(Point a, Point b, Point c)\n {\n if (a.X == b.X && a.X == c.X) return 1;\n if (a.Y == b.Y && a.Y == c.Y) return 1;\n\n if (a.X == b.X) return 2;\n if (a.Y == b.Y) return 2;\n\n return 3;\n }\n\n static void Main(string[] args)\n {\n var a = ReadPoint();\n var b = ReadPoint();\n var c = ReadPoint();\n\n int[] ans = new int[6];\n ans[0] = Count(a, b, c);\n ans[1] = Count(a, c, b);\n ans[2] = Count(b, a, c);\n ans[3] = Count(b, c, a);\n ans[4] = Count(c, a, b);\n ans[5] = Count(c, b, a);\n\n Console.WriteLine(ans.Min());\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5cc8e6c6535ec1882da45defc5920f37", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace D.Polyline\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[][] p = new int[3][];\n for (var i = 0; i < 3; ++i)\n p[i] = new int[2];\n for(var i = 0; i < 3; ++i) {\n var nm = Console.ReadLine().Split();\n p[i][0] = int.Parse(nm[0]);\n p[i][1] = int.Parse(nm[1]);\n }\n Console.WriteLine(function(p));\n }\n static long function(int [][] p)\n {\n long x = p[0][0];\n long y = p[0][1];\n long z, w;\n for (var i = 1; i < 3; ++i) { \n x &= p[i][0];\n y &= p[i][1];\n }\n if (x == p[0][0] || y == p[0][1])\n return 1;\n long min = 100;\n for (var i = 0; i < 3; ++i)\n for (var j = 0; j < 3; ++j)\n for (var l = 0; l < 3; ++l) { \n if (i == j || j == l || i == l)\n continue;\n min = Math.Min(dist(p[i], p[j]) + dist(p[j], p[l]), min);\n }\n return ( min == 4 ) ? 3 : min;\n }\n static int dist(int []p1, int[] p2)\n {\n if (p1[0] == p2[0])\n return 1;\n if (p1[1] == p2[1])\n return 1;\n return 2;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c3fccfe0a83cae129b4431b4e824b7ab", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFTraining.D_s\n{\n class Polyline340\n {\n public static void Main(string[] args)\n {\n Console.WriteLine(Solve());\n }\n\n public static int Solve()\n {\n List p = new List();\n for (int i = 0; i < 3; i++)\n {\n string[] line = Console.ReadLine().Split(' ');\n p.Add(new Point { x = Convert.ToInt32(line[0]), y = Convert.ToInt32(line[1]) });\n }\n\n if (p[0].LieInSameLine(p[1]) != 0 && p[0].LieInSameLine(p[1]) == p[0].LieInSameLine(p[2])) return 1;\n int s1 = p[0].LieInSameLine(p[1]), s2 = p[0].LieInSameLine(p[2]), s3 = p[1].LieInSameLine(p[2]);\n if (s1 > 0)\n {\n if (s1 == 1)\n {\n int min = Math.Min(p[0].y, p[1].y);\n int max = Math.Max(p[0].y, p[1].y);\n if (p[2].y < min || p[2].y > max)\n {\n return 2;\n }\n }\n if (s1 == 2)\n {\n int min = Math.Min(p[0].x, p[1].x);\n int max = Math.Max(p[0].x, p[1].x);\n if (p[2].x < min || p[2].x > max)\n {\n return 2;\n }\n }\n }\n else if (s2 > 0)\n {\n if (s2 == 1)\n {\n int min = Math.Min(p[0].y, p[2].y);\n int max = Math.Max(p[0].y, p[2].y);\n if (p[1].y < min || p[1].y > max)\n {\n return 2;\n }\n }\n if (s2 == 2)\n {\n int min = Math.Min(p[0].x, p[2].x);\n int max = Math.Max(p[0].x, p[2].x);\n if (p[1].x < min || p[1].x > max)\n {\n return 2;\n }\n }\n }\n else if (s3 > 0)\n {\n if (s3 == 1)\n {\n int min = Math.Min(p[1].y, p[2].y);\n int max = Math.Max(p[1].y, p[2].y);\n if (p[0].y < min || p[0].y > max)\n {\n return 2;\n }\n }\n if (s3 == 2)\n {\n int min = Math.Min(p[1].x, p[2].x);\n int max = Math.Max(p[1].x, p[2].x);\n if (p[0].x < min || p[0].x > max)\n {\n return 2;\n }\n }\n }\n return 3;\n }\n }\n\n class Point\n {\n public int x, y;\n public int LieInSameLine(Point p)\n {\n if (x == p.x) return 1;\n else if (y == p.y) return 2;\n else return 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a385d71b8c7b2b2665289b9d2cd37992", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFTraining.D_s\n{\n class Polyline340\n {\n public static void Main(string[] args)\n {\n Console.WriteLine(Solve());\n }\n\n public static int Solve()\n {\n List p = new List();\n for (int i = 0; i < 3; i++)\n {\n string[] line = Console.ReadLine().Split(' ');\n p.Add(new Point { x = Convert.ToInt32(line[0]), y = Convert.ToInt32(line[1]) });\n }\n\n if (p[0].LieInSameLine(p[1]) != 0 && p[0].LieInSameLine(p[1]) == p[0].LieInSameLine(p[2])) return 1;\n int s1 = p[0].LieInSameLine(p[1]), s2 = p[0].LieInSameLine(p[2]), s3 = p[1].LieInSameLine(p[2]);\n if (s1 > 0)\n {\n if (s1 == 1)\n {\n int min = Math.Min(p[0].x, p[1].x);\n int max = Math.Max(p[0].x, p[1].x);\n if (p[2].x < min || p[2].x > max)\n {\n return 2;\n }\n }\n if (s1 == 2)\n {\n int min = Math.Min(p[0].y, p[1].y);\n int max = Math.Max(p[0].y, p[1].y);\n if (p[2].y < min || p[2].y > max)\n {\n return 2;\n }\n }\n }\n else if (s2 > 0)\n {\n if (s2 == 1)\n {\n int min = Math.Min(p[0].x, p[2].x);\n int max = Math.Max(p[0].x, p[2].x);\n if (p[1].x < min || p[1].x > max)\n {\n return 2;\n }\n }\n if (s2 == 2)\n {\n int min = Math.Min(p[0].y, p[2].y);\n int max = Math.Max(p[0].y, p[2].y);\n if (p[1].y < min || p[1].y > max)\n {\n return 2;\n }\n }\n }\n else if (s3 > 0)\n {\n if (s3 == 1)\n {\n int min = Math.Min(p[1].x, p[2].x);\n int max = Math.Max(p[1].x, p[2].x);\n if (p[0].x < min || p[0].x > max)\n {\n return 2;\n }\n }\n if (s3 == 2)\n {\n int min = Math.Min(p[1].y, p[2].y);\n int max = Math.Max(p[1].y, p[2].y);\n if (p[0].y < min || p[0].y > max)\n {\n return 2;\n }\n }\n }\n return 3;\n }\n }\n\n class Point\n {\n public int x, y;\n public int LieInSameLine(Point p)\n {\n if (x == p.x) return 1;\n else if (y == p.y) return 2;\n else return 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "13f501f56035643dd57670214cef1e09", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace D.Polyline\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[][] p = new long[3][];\n for (var i = 0; i < 3; ++i)\n p[i] = new long[2];\n for(var i = 0; i < 3; ++i) {\n var nm = Console.ReadLine().Split();\n p[i][0] = long.Parse(nm[0]);\n p[i][1] = long.Parse(nm[1]);\n }\n Console.WriteLine(function(p));\n }\n static long function(long [][] p)\n {\n long []x = p[0];\n long []y = p[1];\n long []z = p[2];\n long _x = x[0];\n long _y = y[0];\n for (var i = 1; i < 3; ++i) { \n _x &= p[i][0];\n _y &= p[i][1];\n }\n if (_x == p[0][0] || _y == p[0][1])\n return 1;\n\n if (belong(x, y, z) || belong(z, x, y) || belong(x, z, y))\n return 2;\n return 3;\n\n }\n\n static bool belong(long[] p1, long[] p2, long[] p3)\n {\n if (p1[0] == p2[0] || p1[1] == p2[1])\n return true;\n if (p3[0] == p2[0] || p3[1] == p2[1])\n return true;\n return false;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6de52da86210983849abf9e0a496ee9", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace D.Polyline\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[][] p = new int[3][];\n for (var i = 0; i < 3; ++i)\n p[i] = new int[2];\n for(var i = 0; i < 3; ++i) {\n var nm = Console.ReadLine().Split();\n p[i][0] = int.Parse(nm[0]);\n p[i][1] = int.Parse(nm[1]);\n }\n Console.WriteLine(function(p));\n }\n static int function(int [][] p)\n {\n int x = p[0][0];\n int y = p[0][1];\n int z, w;\n for (var i = 1; i < 3; ++i) { \n x &= p[i][0];\n y &= p[i][1];\n }\n if (x == p[0][0] || y == p[0][1])\n return 1;\n int min = 100;\n for (var i = 0; i < 3; ++i)\n for (var j = 0; j < 3; ++j)\n for (var l = 0; l < 3; ++l) { \n if (i == j || j == l || i == l)\n continue;\n x = ( p[i][0] - p[j][0] != 0 ) ? 1 : 0;\n y = ( p[i][1] - p[j][1] != 0 ) ? 1 : 0;\n z = ( p[j][0] - p[l][0] != 0 ) ? 1 : 0;\n w = ( p[j][1] - p[l][1] != 0 ) ? 1 : 0;\n int s = x + y + z + w;\n if (s == 4)\n --s;\n min = Math.Min(s, min);\n }\n return min;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e2c7759a28a82a5c631b426efef328aa", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "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 NextPerm(int[] a)\n {\n int n = a.Length;\n for (int 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 class Point\n {\n public int x, y;\n }\n\n int Fun(Point p1, Point p2, Point p3)\n {\n if (p1.x == p2.x && p1.x == p3.x || p1.y == p2.y && p1.y == p3.y)\n return 1;\n\n if (p1.x == p2.x && (p3.y <= Math.Min(p1.y, p2.y) || p3.y >= Math.Max(p1.y, p2.y)) || p1.y == p2.y && (p3.x <= Math.Min(p1.x, p2.x) || p3.x >= Math.Max(p1.x, p2.x)))\n return 2;\n return 3;\n }\n\n public void Solve()\n {\n var a = new Point[3];\n for (int i = 0; i < 3; i++)\n a[i] = new Point { x = ReadInt(), y = ReadInt() };\n\n var p = Enumerable.Range(0, 3).ToArray();\n int ans = 3;\n do\n {\n ans = Math.Min(ans, Fun(a[p[0]], a[p[1]], a[p[2]]));\n } while (NextPerm(p));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cdab08e01f6f43afc96de5c7c0a9ae5b", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "Mono C#", "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\tHashSet H=new HashSet();\n\t\tfor(int i=0;i<3;i++)H.Add(P[i].X);\n\t\tvar LX=H.ToList();\n\t\tLX.Sort();\n\t\tvar DX=new Dictionary();\n\t\tfor(int i=0;i();\n\t\tfor(int i=0;i<3;i++)H.Add(P[i].Y);\n\t\tvar LY=H.ToList();\n\t\tLY.Sort();\n\t\tvar DY=new Dictionary();\n\t\tfor(int i=0;ia.X.CompareTo(b.X)==0?a.Y.CompareTo(b.Y):a.X.CompareTo(b.X));\n\t\t\n\t\tint ans=0;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,1) && P[2].Eq(0,2))ans=1;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,1) && P[2].Eq(1,0))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,1) && P[2].Eq(1,1))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,1) && P[2].Eq(1,2))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,1) && P[2].Eq(2,0))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,1) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,1) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,2) && P[2].Eq(1,0))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,2) && P[2].Eq(1,1))ans=3;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,2) && P[2].Eq(1,2))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,2) && P[2].Eq(2,0))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,2) && P[2].Eq(2,1))ans=3;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(0,2) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,0) && P[2].Eq(1,1))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,0) && P[2].Eq(1,2))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,0) && P[2].Eq(2,0))ans=1;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,0) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,0) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,1) && P[2].Eq(1,2))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,1) && P[2].Eq(2,0))ans=3;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,1) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,1) && P[2].Eq(2,2))ans=3;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,2) && P[2].Eq(2,0))ans=3;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,2) && P[2].Eq(2,1))ans=3;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(1,2) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(2,0) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(2,0) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,0) && P[1].Eq(2,1) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(0,2) && P[2].Eq(1,0))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(0,2) && P[2].Eq(1,1))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(0,2) && P[2].Eq(1,2))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(0,2) && P[2].Eq(2,0))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(0,2) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(0,2) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,0) && P[2].Eq(1,1))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,0) && P[2].Eq(1,2))ans=3;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,0) && P[2].Eq(2,0))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,0) && P[2].Eq(2,1))ans=3;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,0) && P[2].Eq(2,2))ans=3;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,1) && P[2].Eq(1,2))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,1) && P[2].Eq(2,0))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,1) && P[2].Eq(2,1))ans=1;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,1) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,2) && P[2].Eq(2,0))ans=3;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,2) && P[2].Eq(2,1))ans=3;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(1,2) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(2,0) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(2,0) && P[2].Eq(2,2))ans=3;\n\t\tif(P[0].Eq(0,1) && P[1].Eq(2,1) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,0) && P[2].Eq(1,1))ans=2;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,0) && P[2].Eq(1,2))ans=2;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,0) && P[2].Eq(2,0))ans=2;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,0) && P[2].Eq(2,1))ans=3;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,0) && P[2].Eq(2,2))ans=3;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,1) && P[2].Eq(1,2))ans=2;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,1) && P[2].Eq(2,0))ans=3;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,1) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,1) && P[2].Eq(2,2))ans=3;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,2) && P[2].Eq(2,0))ans=2;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,2) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(1,2) && P[2].Eq(2,2))ans=1;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(2,0) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(2,0) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(0,2) && P[1].Eq(2,1) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(1,0) && P[1].Eq(1,1) && P[2].Eq(1,2))ans=1;\n\t\tif(P[0].Eq(1,0) && P[1].Eq(1,1) && P[2].Eq(2,0))ans=2;\n\t\tif(P[0].Eq(1,0) && P[1].Eq(1,1) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(1,0) && P[1].Eq(1,1) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(1,0) && P[1].Eq(1,2) && P[2].Eq(2,0))ans=2;\n\t\tif(P[0].Eq(1,0) && P[1].Eq(1,2) && P[2].Eq(2,1))ans=3;\n\t\tif(P[0].Eq(1,0) && P[1].Eq(1,2) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(1,0) && P[1].Eq(2,0) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(1,0) && P[1].Eq(2,0) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(1,0) && P[1].Eq(2,1) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(1,1) && P[1].Eq(1,2) && P[2].Eq(2,0))ans=2;\n\t\tif(P[0].Eq(1,1) && P[1].Eq(1,2) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(1,1) && P[1].Eq(1,2) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(1,1) && P[1].Eq(2,0) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(1,1) && P[1].Eq(2,0) && P[2].Eq(2,2))ans=3;\n\t\tif(P[0].Eq(1,1) && P[1].Eq(2,1) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(1,2) && P[1].Eq(2,0) && P[2].Eq(2,1))ans=2;\n\t\tif(P[0].Eq(1,2) && P[1].Eq(2,0) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(1,2) && P[1].Eq(2,1) && P[2].Eq(2,2))ans=2;\n\t\tif(P[0].Eq(2,0) && P[1].Eq(2,1) && P[2].Eq(2,2))ans=1;\t\t\n\t\t\n\t\tConsole.WriteLine(ans);\n\t\t\n\t\t\n\t}\n\tPair[] P;\n\tpublic Sol(){\n\t\tP=new Pair[3];\n\t\tfor(int i=0;i<3;i++){\n\t\t\tvar d=ria();\n\t\t\tP[i]=new Pair(d[0],d[1]);\n\t\t}\n\t}\n\t\n\tclass Pair{\n\t\tpublic int X,Y;\n\t\tpublic Pair(int x,int y){\n\t\t\tX=x;Y=y;\n\t\t}\n\t\tpublic bool Eq(int x,int y){\n\t\t\treturn (this.X==x)&&(this.Y==y);\n\t\t}\n\t}\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5fd2307a6dc15809134cc6ad9ace5faf", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Polyline\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 x = new int[3];\n var y = new int[3];\n for (int i = 0; i < 3; i++)\n {\n x[i] = Next();\n y[i] = Next();\n }\n\n if ((x[0] == x[1] && x[0] == x[2]) || (y[0] == y[1] && y[0] == y[2]))\n writer.WriteLine(\"1\");\n else if ((x[0] == x[1] && -1 != Math.Sign(y[0] - y[2])*Math.Sign(y[1] - y[2]))\n || (x[0] == x[2] && -1 != Math.Sign(y[0] - y[1])*Math.Sign(y[2] - y[1]))\n || (x[2] == x[1] && -1 != Math.Sign(y[2] - y[0])*Math.Sign(y[1] - y[0]))\n || (y[0] == y[1] && -1 != Math.Sign(x[0] - x[2])*Math.Sign(x[1] - x[2]))\n || (y[0] == y[2] && -1 != Math.Sign(x[0] - x[1])*Math.Sign(x[2] - x[1]))\n || (y[2] == y[1] && -1 != Math.Sign(x[2] - x[0])*Math.Sign(x[1] - x[0]))\n )\n\n {\n writer.WriteLine(\"2\");\n }\n else\n writer.WriteLine(\"3\");\n\n\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1d901b85192825ff1979cd2153c4424c", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "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() : 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 x1 = io.Read();\n\t\t\t\tvar y1 = io.Read();\n\t\t\t\tvar x2 = io.Read();\n\t\t\t\tvar y2 = io.Read();\n\t\t\t\tvar x3 = io.Read();\n\t\t\t\tvar y3 = io.Read();\n\n\t\t\t\tif ((x1 == x2 && x1 == x3) || (y1 == y2 && y1 == y3))\n\t\t\t\t\tio.WriteLine(\"1\");\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (x1 == x2)\n\t\t\t\t\t\tio.WriteLine(Solve(y1, y2, y3));\n\t\t\t\t\telse if (x1 == x3)\n\t\t\t\t\t\tio.WriteLine(Solve(y1, y3, y2));\n\t\t\t\t\telse if (x2 == x3)\n\t\t\t\t\t\tio.WriteLine(Solve(y2, y3, y1));\n\t\t\t\t\telse if (y1 == y2)\n\t\t\t\t\t\tio.WriteLine(Solve(x1, x2, x3));\n\t\t\t\t\telse if (y1 == y3)\n\t\t\t\t\t\tio.WriteLine(Solve(x1, x3, x2));\n\t\t\t\t\telse if (y2 == y3)\n\t\t\t\t\t\tio.WriteLine(Solve(x2, x3, x1));\n\t\t\t\t\telse\n\t\t\t\t\t\tio.WriteLine(\"3\");\n\t\t\t\t}\n\t\t\t}\n\n#if DEBUG\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic long Solve(long y1, long y2, long y3)\n\t\t{\n\t\t\tvar minY = Math.Min(y1, y2);\n\t\t\tvar maxY = Math.Max(y1, y2);\n\t\t\tif (y3 >= maxY || y3 <= minY)\n\t\t\t\treturn 2;\n\t\t\telse\n\t\t\t\treturn 3;\n\t\t}\n\n\t}\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2c4b4b05dc21e30e574adda415dcaee6", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nnamespace ConsoleApplication4\n{\n class Program\n {\n static bool foo(int a, int b, int c)\n {\n return Math.Min(a, b) <= c && Math.Max(a, b) >= c;\n }\n static bool foo(int i, int j, int k, int[][] arr)\n {\n return (arr[i][0] == arr[k][0] || arr[j][0] == arr[k][0]) && foo(arr[i][1], arr[j][1], arr[k][1]) ||\n (arr[i][1] == arr[k][1] || arr[j][1] == arr[k][1]) && foo(arr[i][0], arr[j][0], arr[k][0]);\n }\n public static void Main(string[] args)\n {\n int[][] pt = new int[3][];\n for(int i = 0; i < 3; i++)\n {\n pt[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n }\n Console.WriteLine(pt[0][0] == pt[1][0] && pt[1][0] == pt[2][0] || pt[0][1] == pt[1][1] && pt[1][1] == pt[2][1] ? 1 :\n foo(0, 1, 2, pt) || foo(0, 2, 1, pt) || foo(1, 2, 0, pt) ? 2 : 3);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c04806894ab1234c084eaa1a1620c1a5", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nclass Program\n{\n public class Point\n {\n public int X;\n public int Y;\n }\n\n public static Point ReadPoint()\n {\n var p = new Point();\n p.X = ReadInt();\n p.Y = ReadInt();\n\n return p;\n }\n\n private static bool Inside(int x, int a, int b)\n {\n return x > Math.Min(a, b) && x < Math.Max(a, b);\n }\n\n private static int Count(Point a, Point b, Point c)\n {\n if (a.X == b.X && a.X == c.X) return 1;\n if (a.Y == b.Y && a.Y == c.Y) return 1;\n\n if (a.X == b.X && !Inside(c.Y, a.Y, b.Y)) return 2;\n if (a.Y == b.Y && !Inside(c.X, a.X, b.X)) return 2;\n\n return 3;\n }\n\n static void Main(string[] args)\n {\n var a = ReadPoint();\n var b = ReadPoint();\n var c = ReadPoint();\n\n int[] ans = new int[6];\n ans[0] = Count(a, b, c);\n ans[1] = Count(a, c, b);\n ans[2] = Count(b, a, c);\n ans[3] = Count(b, c, a);\n ans[4] = Count(c, a, b);\n ans[5] = Count(c, b, a);\n\n Console.WriteLine(ans.Min());\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1515480f7db7f3558732c981070d715d", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace CompetitiveProgramming\n{\n class Program\n {\n static bool s_IsMultipleTestCases = false;\n static void Main(string[] args)\n {\n InputReader input = new InputReader();\n TextWriter output = Console.Out;\n var numberOfTest = 1;\n if (s_IsMultipleTestCases)\n {\n numberOfTest = input.NextInt();\n }\n for (var testNumber = 1; testNumber <= numberOfTest; ++testNumber)\n {\n Task solver = new Task();\n solver.Solve(testNumber, input, output);\n }\n\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n\n class Task\n {\n public void Solve(int testNumber, InputReader ip, TextWriter op)\n {\n int n = 3;\n var x = new int[n];\n var y = new int[n];\n for (var i = 0; i < n; ++i)\n {\n x[i] = ip.NextInt();\n y[i] = ip.NextInt();\n }\n if (IsCaseOne(x, y))\n {\n op.WriteLine(1);\n }\n else if (IsCaseTwo(x, y))\n {\n op.WriteLine(2);\n }\n else\n {\n op.WriteLine(3);\n }\n }\n\n private bool IsCaseOne(int[] x, int[] y)\n {\n return (x[0] == x[1] && x[1] == x[2]) || (y[0] == y[1] && y[1] == y[2]);\n }\n\n private bool IsCaseTwo(int[] x, int[] y)\n {\n bool isValid = false;\n isValid |= x[0] == x[1] && (y[2] >= Max(y[0], y[1]) || y[2] <= Min(y[0], y[1]));\n isValid |= x[1] == x[2] && (y[0] >= Max(y[1], y[2]) || y[0] <= Min(y[1], y[2]));\n isValid |= x[2] == x[0] && (y[1] >= Max(y[2], y[0]) || y[1] <= Min(y[2], y[0]));\n isValid |= y[0] == y[1] && (x[2] >= Max(x[0], x[1]) || x[2] <= Min(x[0], x[1]));\n isValid |= y[1] == y[2] && (x[0] >= Max(x[1], x[2]) || x[0] <= Min(x[1], x[2]));\n isValid |= y[2] == y[0] && (x[1] >= Max(x[2], x[0]) || x[1] <= Min(x[2], x[0]));\n return isValid;\n }\n\n private int Max(int v1, int v2)\n {\n return Math.Max(v1, v2);\n }\n\n private int Min(int v1, int v2)\n {\n return Math.Min(v1,v2);\n }\n }\n\n class InputReader\n {\n static int s_index = 0;\n static string[] s_tokens;\n public string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Length)\n {\n s_tokens = Console.ReadLine().Split(' ').ToArray();\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n\n public string NextLine()\n {\n return Console.ReadLine();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4361403255896c6f14c66b2ea5adbad4", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace D.Polyline\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[][] p = new long[3][];\n for (var i = 0; i < 3; ++i)\n p[i] = new long[2];\n for(var i = 0; i < 3; ++i) {\n var nm = Console.ReadLine().Split();\n p[i][0] = long.Parse(nm[0]);\n p[i][1] = long.Parse(nm[1]);\n }\n Console.WriteLine(function(p));\n }\n static long function(long[][] p)\n {\n long[] x = p[0];\n long[] y = p[1];\n long[] z = p[2];\n long _x = x[0];\n long _y = y[0];\n\n if (x[0] == y[0] && y[0] == z[0])\n return 1;\n\n if (x[1] == y[1] && y[1] == z[1])\n return 1;\n if (check(x, y, z) || check(x, z, y) || check(y, x, z))\n return 2;\n\n return 3;\n\n }\n static bool check(long[] p1, long[] p2, long[] p3)\n {\n if ((p1[0] == p2[0] || p2[0] == p3[0]) && belongY(p1, p2, p3))\n return true;\n if ((p1[1] == p2[1] || p2[1] == p3[1]) && belongX(p1, p2, p3))\n return true;\n return false;\n }\n static bool belongX(long[] p1, long[] p2, long[] p3)\n {\n return Math.Min(p1[0], p3[0]) <= p2[0] && p2[0] <= Math.Max(p1[0], p3[0]);\n }\n static bool belongY(long[] p1, long[] p2, long[] p3)\n {\n return Math.Min(p1[1], p3[1]) <= p2[1] && p2[1] <= Math.Max(p1[1], p3[1]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c9ac598a5ad5abdc83c500e915358a16", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace doroga\n{\n class Program\n {\n static void Main(string[] args)\n {\n int r, g, b,n=29;\n string[] s=Console.ReadLine().Split(' ');\n r = Int32.Parse(s[0]);\n g = Int32.Parse(s[1]);\n b = Int32.Parse(s[2]);\n while (r>0 | g>0 | b>0)\n {\n if (r > 0) r = r - 2;\n n++;\n if (r < 1 & g < 1 & b < 1) break;\n if (g > 0) g = g - 2;\n n++;\n if (r < 1 & g < 1 & b < 1) break;\n if (b > 0) b = b - 2;\n n++;\n }\n Console.WriteLine(n);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5c500381b5a82a6c9c993cce9a411f85", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "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[] t = Console.ReadLine().Split(' ');\n int r = (int.Parse(t[0]) + 1) / 2;\n int g = (int.Parse(t[1]) + 1) / 2;\n int b = (int.Parse(t[2]) + 1) / 2;\n int res = 30;\n int max=0;\n int color=0;\n if (r > g && r > b) { max = r; color = 0; };\n if (g >= r && g > b) { max = g; color = 1; };\n if (b >= r && b >= g) { max = b; color = 2; };\n res += 3 * (max-1) + color;\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4bba9d40997e1cd843c3ce75caf3cf4d", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp60\n{\n class Program\n {\n static void Main(string[] args)\n {\n var N = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n var index = -1;\n var j = -1;\n for(int i=0;i<3000;i++)\n {\n j++;\n if (N[j]>=2)\n {\n N[j] = N[j] - 2;\n }\n else if(N[j]==1)\n {\n N[j] = N[j] - N[j];\n }\n index++;\n if(N.Sum()==0)\n {\n break;\n }\n if (j == 2)\n {\n j = -1;\n }\n }\n Console.WriteLine(index + 30);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "08e22928bec4afe636523b8d7fd8d493", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Task90A\n\t{\n\t\tstatic void Main()\n\t\t{\n\t\t\tstring[] tokens = Console.In.ReadLine().Split();\n\t\t\tint r = int.Parse(tokens[0]), g = int.Parse(tokens[1]), b = int.Parse(tokens[2]);\n\n\t\t\tint answer = 0;\n\t\t\tif (r > 0) answer = Math.Max(answer, (r - 1) / 2 * 3 + 30);\n\t\t\tif (g > 0) answer = Math.Max(answer, (g - 1) / 2 * 3 + 31);\n\t\t\tif (b > 0) answer = Math.Max(answer, (b - 1) / 2 * 3 + 32);\n\n\t\t\tConsole.Out.WriteLine(answer);\n\t\t}\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e21da2ced40887ab42973a1921ebdb2b", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "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 r = int.Parse(ss[0]);\n int g = int.Parse(ss[1]);\n\t\tint b = int.Parse(ss[2]);\n\n\t\tint tr = ((r + 1) / 2);\n\t\tif (tr > 0)\n\t\t\ttr = (tr-1) * 3 + 0;\n\t\telse tr = 0;\n\t\tint tg = ((g + 1) / 2);\n\t\tif (tg > 0)\n\t\t\ttg = (tg-1) * 3 + 1;\n\t\telse tg = 0;\n\t\tint tb = ((b + 1) / 2);\n\t\tif( tb > 0 )\n\t\t\ttb = (tb-1) * 3 + 2;\n\t\telse\n\t\t\ttb = 0;\n\t\tCF.WriteLine(Math.Max(tr,Math.Max(tg,tb))+30);\n\n }\n\n\n\n\t// test\n\tstatic Utils CF = new Utils(new[]{\n@\"\n1 3 2\n\",\n\n@\"\n3 2 1\n\"\n,\n@\"\n0 0 1\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b22a9603e224001d096a0645171d2f46", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Cableway\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int totalRed = (int.Parse(input[0]) + 1) / 2 - 1;\n int totalGreen = (int.Parse(input[1]) + 1) / 2 - 1;\n int totalBlue = (int.Parse(input[2]) + 1) / 2 - 1;\n int total = 30;\n if (totalBlue > totalGreen && totalBlue > totalRed)\n total += (3 * totalBlue) + 2;\n else if (totalGreen > totalBlue && totalGreen > totalRed)\n total += (3 * totalGreen) + 1;\n else if (totalRed > totalBlue && totalRed > totalGreen)\n total += (3 * totalRed);\n else\n {\n int max = Math.Max(totalRed, Math.Max(totalBlue, totalGreen));\n total += (3 * max);\n if (max == totalBlue)\n total += 2;\n else if (max == totalGreen)\n total++;\n }\n Console.WriteLine(total);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "31b764bbe0c7b674f61b7a63ab8d6dfc", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string t = Console.ReadLine();\n string[] bits = t.Split(' ');\n int r = int.Parse(bits[0]), g = int.Parse(bits[1]), b = int.Parse(bits[2]);\n\n int ris = 30;\n if (r==0 && g==0 && b==0) ris=0;\n\n while (r != 0 || g != 0 || b != 0)\n {\n ris++;\n if (r > 1) r -= 2;\n else if (r > 0) r--;\n if (r == 0 && g == 0 && b == 0) break;\n ris++;\n if (g > 1) g -= 2;\n else if (g > 0) g--;\n if (r == 0 && g == 0 && b == 0) break;\n ris++;\n if (b > 1) b -= 2;\n else if (b > 0) b--;\n }\n\n Console.WriteLine(ris-1);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "66d477633dd5026b1831cc22437353a4", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing 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\n void solve()\n {\n int[] cnt = new int[3];\n int rem=0;\n for (int i = 0; i < 3; i++)\n rem+=cnt[i] = nextInt();\n int at = 0;\n int res = 0;\n while (rem > 0)\n {\n res++;\n rem -= Math.Min(2, cnt[at]);\n cnt[at] -= Math.Min(2, cnt[at]);\n at = (at + 1) % 3;\n\n }\n println(res + 29);\n }\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 return int.Parse(nextString());\n }\n long nextLong()\n {\n return long.Parse(nextString());\n }\n double nextDouble()\n {\n return double.Parse(nextString());\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "991d15f7fd8268ad02dcbe0fa19c8116", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest.A\n{\n class Program\n {\n /////////////////////\n\n public static T Read()\n {\n return (T)Convert.ChangeType(Console.ReadLine(), typeof(T));\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> ReadIndexedList(char[] delimiters = null)\n {\n var line = Read();\n var split = line.Split(delimiters ?? new[] { ' ' });\n var list = split.Select((item, index) => new KeyValuePair(index + 1, (T)Convert.ChangeType(item, typeof(T)))).ToList();\n return list;\n }\n\n\n public static void ReadFromFile()\n {\n Console.SetIn(new StreamReader(@\"..\\..\\input.txt\"));\n }\n\n ///////////////////////////////////\n \n\n static void Main(string[] args)\n {\n try\n {\n var list = ReadList();\n int r = list[0];\n int g = list[1];\n int b = list[2];\n\n int rr = (int) Math.Ceiling(r/2d);\n int gg = (int) Math.Ceiling(g / 2d);\n int bb = (int) Math.Ceiling(b / 2d);\n \n int res = 30 + Max(0 + (rr - 1)*3 , 1 + (gg - 1)*3 , 2 + (bb - 1)*3);\n Console.WriteLine(res);\n }\n catch\n {\n Console.Write(\"ERROR\");\n }\n }\n\n private static int Max(int i, int i1, int i2)\n {\n return Math.Max(Math.Max(i, i1), i2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "489a9f8e91959f8ffdf7388e73f47103", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemA\n{\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split(' ');\n int r = int.Parse(tokens[0]), g = int.Parse(tokens[1]), b = int.Parse(tokens[2]);\n Console.WriteLine(30 + Math.Max(((r + 1) / 2 - 1) * 3, Math.Max(1 + ((g + 1) / 2 - 1) * 3, 2 + ((b + 1) / 2 - 1) * 3)));\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c2ee6cfd73f243745a8da71767dd27d5", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class CF_Cableway\n{\n public static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n int[] S = new int[3] { int.Parse(line[0]), int.Parse(line[1]), int.Parse(line[2]) };\n int t = 0;\n int c = 0;\n while (true)\n {\n if (S[c] > 0)\n {\n S[c] -= 2;\n if (S[c] < 0) S[c] = 0;\n if (S[0] == 0 && S[1] == 0 && S[2] == 0) break;\n }\n ++t;\n ++c;\n c %= 3;\n }\n\n Console.WriteLine((30 + t).ToString());\n Console.ReadLine();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4667bde7bf58b588a90d39c3bc932d0a", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] rgb = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();\n int rtime = 0;\n if (rgb[0] > 0)\n {\n int g = (rgb[0] - 1) / 2 + 1;\n rtime = 30 + 3 * (g - 1);\n }\n\n int gtime = 0;\n if (rgb[1] > 0)\n {\n int g = (rgb[1] - 1) / 2 + 1;\n gtime = 31 + 3 * (g - 1);\n }\n\n int btime = 0;\n if (rgb[2] > 0)\n {\n int g = (rgb[2] - 1) / 2 + 1;\n btime = 32 + 3 * (g - 1);\n }\n\n int time = Math.Max(rtime, Math.Max(gtime, btime));\n Console.WriteLine(time);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b0adad5a61c3a278bbf79b2f7a5a1cde", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "MS C#", "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 r = Next();\n int g = Next();\n int b = Next();\n int lastTime = -1;\n do {\n lastTime++;\n r = Math.Max(r - 2, 0);\n if(r + g + b > 0) {\n lastTime++;\n g = Math.Max(g - 2, 0);\n if(r + g + b > 0) {\n lastTime++;\n b = Math.Max(b - 2, 0);\n }\n }\n } while(r + g + b > 0);\n writer.Write(lastTime + 30);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f60daf523de4b27839d45ad137d24995", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace camp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int [] arr = new int[3];\n arr = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToArray();\n int sum = arr[0] + arr[1] + arr[2];\n int k = -1;\n while (sum > 0)\n {\n k++;\n if (k % 3 == 0) arr[0] -= 2;\n if (k % 3 == 1) arr[1] -= 2;\n if (k % 3 == 2) arr[2] -= 2; \n if (arr[0] < 0) arr[0] = 0;\n if (arr[1] < 0) arr[1] = 0;\n if (arr[2] < 0) arr[2] = 0;\n sum = arr[0] + arr[1] + arr[2];\n }\n Console.WriteLine(k+30);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "978b79b7b6eca0a722537abf4b29861f", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] c = Console.ReadLine().Split().Select(x =>(int)Math.Ceiling(int.Parse(x)/2.0)).ToArray();\n int rez = 30;\n if (c[0] > c[1] && c[0] > c[2])\n rez += c[0] * 3 - 3;\n else if (c[1] >= c[0] && c[1] > c[2])\n rez += c[1] * 3 - 2;\n else if (c[2] >= c[0] && c[2] >= c[1])\n rez += c[2] * 3 - 1; \n \n Console.WriteLine(rez);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d5bed67dc9fe7d89b9a09c596e2c44e4", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Task1 {\n internal class Program {\n private static void Main(string[] args) {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int r = int.Parse(ss[0]);\n int g = int.Parse(ss[1]);\n int b = int.Parse(ss[2]);\n int current = 0;\n while (r + g + b > 0) {\n if (current%3 == 0) r = Math.Max(0, r - 2);\n else if (current%3 == 1) g = Math.Max(0, g - 2);\n else b = Math.Max(0, b - 2);\n current++;\n }\n Console.WriteLine(current + 29);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e0af02f03a33cdc59e511456cc720222", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono 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 int[] a = new int[3];\n string[] str = Console.ReadLine().Split(' ');\n a[0] = Int32.Parse(str[0]);\n a[1] = Int32.Parse(str[1]);\n a[2] = Int32.Parse(str[2]);\n int x = (a[0] + a[1] + a[2]);\n int i = 29;\n int color = 0;\n while (x>0)\n {\n if (color > 2) { color = 0; }\n if (a[color] > 2) { a[color] -= 2; } else { a[color] = 0; }\n x = a[0] + a[1] + a[2];\n i++;\n color++;\n }\n Console.WriteLine(i.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "954793dc292f5c60d30eb2666fe465b6", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Cableway\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(), g = Next(), b = Next();\n\n int max = 3*((r + 1)/2 - 1);\n max = Math.Max(max, 3*((g + 1)/2 - 1) + 1);\n max = Math.Max(max, 3*((b + 1)/2 - 1) + 2);\n\n writer.WriteLine(max + 30);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "261a1cf834c448766728356061eefbb7", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\nnamespace first\n{\n class Program\n {\n static TextReader tr;\n static void cin(out int value)\n {\n if (tr == null) tr = Console.In;\n StringBuilder sb = new StringBuilder();\n while (tr.Peek() == (char)(' ') || tr.Peek() == 13 || tr.Peek() == 10) \n tr.Read();\n while (tr.Peek() != (char)(' ') && tr.Peek() != 13 && tr.Peek() != 10)\n {\n char ch = (char)tr.Read();\n sb.Append(ch);\n }\n value = int.Parse(sb.ToString());\n }\n static void cin(out string value)\n {\n if (tr == null) tr = Console.In;\n StringBuilder sb = new StringBuilder();\n while (tr.Peek() == (char)(' ') || tr.Peek() == 13 || tr.Peek() == 10)\n tr.Read();\n while (tr.Peek() != (char)(' ') && tr.Peek() != 13 && tr.Peek() != 10)\n {\n char ch = (char)tr.Read();\n sb.Append(ch);\n }\n value = sb.ToString();\n }\n static void cin(out double value)\n {\n if (tr == null) tr = Console.In;\n StringBuilder sb = new StringBuilder();\n while (tr.Peek() == (char)(' ') || tr.Peek() == 13 || tr.Peek() == 10)\n tr.Read();\n while (tr.Peek() != (char)(' ') && tr.Peek() != 13 && tr.Peek() != 10)\n {\n char ch = (char)tr.Read();\n if (ch == '.') ch = ',';\n sb.Append(ch);\n }\n value = double.Parse(sb.ToString());\n }\n static void Main(string[] args)\n {\n int r,g,b;\n cin(out r);\n cin(out g);\n cin(out b);\n r = (r + 1) / 2;\n g = (g + 1) / 2;\n b = (b + 1) / 2;\n int a1=(r-1) * 3 + 0;\n int a2 = (g-1) * 3 + 1;\n int a3 = (b-1) * 3 + 2;\n Console.WriteLine( ((new int[] { a1, a2, a3 }).Max()+30).ToString());\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ee65b0b9fa02150564a2ad7bb016c0be", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CFB_R74_D2\n{\n class Program\n {\n static void Main()\n {\n int[] n = ReadInts(3);\n int t = 0;\n if (n[0] > 0)\n t = Math.Max(t, 30 + 3 * ((n[0] - 1) / 2));\n if (n[1] > 0)\n t = Math.Max(t, 31 + 3 * ((n[1] - 1) / 2));\n if (n[2] > 0)\n t = Math.Max(t, 32 + 3 * ((n[2] - 1) / 2));\n Console.WriteLine(t);\n }\n /*****************************************************************************/\n static string[] ReadStr(char sep)\n {\n return ReadStr(new char[] { sep });\n }\n static string[] ReadStr(char[] seps)\n {\n string res = Console.ReadLine();\n if (seps == null) return new string[1] { res };\n else return res.Split(seps);\n }\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n static int[] ReadInts(int n)\n {\n int[] res = new int[n];\n string[] instr = ReadStr(new char[] { ' ' });\n for (int i = 0; i < n; i++)\n res[i] = (i < instr.Length) ? int.Parse(instr[i]) : 0;\n return res;\n }\n static long[] ReadLongs(int n)\n {\n long[] res = new long[n];\n string[] instr = ReadStr(new char[] { ' ' });\n for (int i = 0; i < n; i++)\n res[i] = (i < instr.Length) ? long.Parse(instr[i]) : 0;\n return res;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "93c3a5bf288949c7fceabdae6d74c0ca", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Task90A\n\t{\n\t\tstatic void Main()\n\t\t{\n\t\t\tstring[] tokens = Console.In.ReadLine().Split();\n\t\t\tint r = int.Parse(tokens[0]), g = int.Parse(tokens[1]), b = int.Parse(tokens[2]);\n\n\t\t\tint answer = 0;\n\t\t\tif (r > 0) answer = Math.Max(answer, (r - 1) / 2 * 3 + 30);\n\t\t\tif (g > 1) answer = Math.Max(answer, (g - 1) / 2 * 3 + 31);\n\t\t\tif (b > 2) answer = Math.Max(answer, (b - 1) / 2 * 3 + 32);\n\n\t\t\tConsole.Out.WriteLine(answer);\n\t\t}\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0b3c2731234fab8cf5ef3453b1dc8bb9", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp60\n{\n class Program\n {\n static void Main(string[] args)\n {\n var N = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n var index = -1;\n var j = -1;\n for(int i=0;i<3000;i++)\n {\n j++;\n if (N[j]>=2)\n {\n N[j] = N[j] - 2;\n }\n else if(N[j]==1)\n {\n N[j] = N[j] - N[j];\n }\n Console.WriteLine(N[j]);\n index++;\n if(N.Sum()==0)\n {\n break;\n }\n if (j == 2)\n {\n j = -1;\n }\n }\n Console.WriteLine(index + 30);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e9ad71b294471363b9e7124ab8f07fa7", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CFB_R74_D2\n{\n class Program\n {\n static void Main()\n {\n int[] n = ReadInts(3);\n int t = 30 + 3*(n[0] - 1) / 2;\n t = Math.Max(t, 31 + 3 * (n[1] - 1) / 2);\n t = Math.Max(t, 32 + 3 * (n[2] - 1) / 2); \n Console.WriteLine(t);\n }\n /*****************************************************************************/\n static string[] ReadStr(char sep)\n {\n return ReadStr(new char[] { sep });\n }\n static string[] ReadStr(char[] seps)\n {\n string res = Console.ReadLine();\n if (seps == null) return new string[1] { res };\n else return res.Split(seps);\n }\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n static int[] ReadInts(int n)\n {\n int[] res = new int[n];\n string[] instr = ReadStr(new char[] { ' ' });\n for (int i = 0; i < n; i++)\n res[i] = (i < instr.Length) ? int.Parse(instr[i]) : 0;\n return res;\n }\n static long[] ReadLongs(int n)\n {\n long[] res = new long[n];\n string[] instr = ReadStr(new char[] { ' ' });\n for (int i = 0; i < n; i++)\n res[i] = (i < instr.Length) ? long.Parse(instr[i]) : 0;\n return res;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5d1be2f40d9dcb2a1068951723bf5a28", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Cableway\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int totalRed = (int.Parse(input[0]) + 1) / 2 - 1;\n int totalGreen = (int.Parse(input[1]) + 1) / 2 - 1;\n int totalBlue = (int.Parse(input[2]) + 1) / 2 - 1;\n int total = 30;\n if (totalBlue > totalGreen && totalBlue > totalRed)\n total += (3 * totalBlue) + 2;\n else if (totalGreen > totalBlue && totalGreen > totalRed)\n total += (3 * totalGreen) + 1;\n else if (totalRed > totalBlue && totalRed > totalGreen)\n total += (3 * totalRed);\n else\n total += (3 * totalBlue) + 2;\n Console.WriteLine(total);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b5e2ef37404a2182c3a69242c0d30895", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nclass Test {\n static void Main() {\n string [] str = Console.ReadLine().Split();\n int [] a = new int [3];\n bool [] b = new bool [3];\n for(int k=0 ; k<3 ; k++){\n a[k] = int.Parse(str[k]);\n }\n int i = 0;\n int ct = 0;\n while(true){\n if(i==3){\n i=0;\n }\n a[i] -= 2;\n if(a[i]<=0){\n b[i] = true;\n }\n if(b[0] && b[1] && b[2]){\n break;\n }\n ct++;\n i++;\n }\n Console.WriteLine(30+ct);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0f2e4b807ace2c8248aa6d8b57503825", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nclass Test {\n static void Main() {\n string [] str = Console.ReadLine().Split();\n int i = 0;\n int num = 0;\n int ct = 0;\n while(num<3){\n int tmp = int.Parse(str[i]);\n tmp-=2;\n if(tmp<=0){\n num++;\n }\n if(i==2){\n i=0;\n }\n i++;\n ct++;\n }\n Console.WriteLine(30+ct-1);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e8243039f51a4dcc01a981408d703226", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "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 \n var input = Console.ReadLine().Trim().Split(' ');\n var r = Int32.Parse(input[0]);\n var g = Int32.Parse(input[1]);\n var b = Int32.Parse(input[2]);\n\n int color = Math.Max(r, Math.Max(g, b));\n\n int count = 3*(color / 2 + (color % 2) - 1) + 30;\n\n if (b == color)\n {\n count += 2;\n }\n else if (g == color)\n count += 1;\n\n Console.WriteLine(count);\n\n\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e042198f33fe1fac323679be437eb4ba", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\nGlobal\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f296be1a0d9cbab7e19995b0e574a02c", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Cableway\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int totalRed = (int.Parse(input[0]) + 1) / 2 - 1;\n int totalGreen = (int.Parse(input[1]) + 1) / 2 - 1;\n int totalBlue = (int.Parse(input[2]) + 1) / 2 - 1;\n int total = 30;\n if (totalBlue > totalGreen && totalBlue > totalRed)\n total += (3 * totalBlue) + 2;\n else if (totalGreen > totalBlue && totalGreen > totalRed)\n total += (3 * totalGreen) + 1;\n else if (totalRed > totalBlue && totalRed > totalGreen)\n total += (3 * totalRed);\n else\n {\n int max = Math.Max(totalRed, Math.Max(totalBlue, totalGreen));\n total += (3 * max);\n if (max == totalBlue)\n total += 2;\n else if (max == totalGreen)\n total++;\n }\n Console.WriteLine(total);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a1a436a90e94e9190492577d79b27d3c", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000} {"lang": "MS C#", "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 MOD = 1000000007;\n\n public void Solve()\n {\n int p = ReadInt();\n int k = ReadInt();\n \n long ans = 1;\n var f = new bool[p];\n for (int i = 1; i < p; i++)\n if (!f[i])\n {\n if (k == 0 && i == 1)\n continue;\n ans = ans * p % MOD;\n int x = i;\n while (!f[x])\n {\n f[x] = true;\n x = x * k % p;\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(\"atoms.in\");\n //writer = new StreamWriter(\"atoms.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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "42a5324f661687a089f47864f7a99992", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800} {"lang": "MS C#", "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 mod=(long)1e9+7;\n\t\tlong ans=0;\n\t\tif(K==0||K==1){\n\t\t\tans=1;\n\t\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f05048c2579da71c5f29fc90da6a9f33", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800} {"lang": "MS C#", "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 mod=(long)1e9+7;\n\t\tlong ans=0;\n\t\tif(K==0){\n\t\t\tans=1;\n\t\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7510fbb00b008de0a7253c0cb1d6fedf", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800} {"lang": "MS C#", "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 MOD = 1000000007;\n\n public void Solve()\n {\n int p = ReadInt();\n int k = ReadInt();\n \n long ans = 1;\n var f = new bool[p];\n for (int i = 1; i < p; i++)\n if (!f[i])\n {\n ans = ans * p % MOD;\n int x = i;\n while (!f[x])\n {\n f[x] = true;\n x = x * k % p;\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(\"atoms.in\");\n //writer = new StreamWriter(\"atoms.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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e3b6334ddf5a6c77ff3e86f24882fe4", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Moodular_Arithmetic\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 int[] pa;\n private static int[] size;\n\n private static int mod = 1000000007;\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 p = Next();\n long k = Next();\n\n if (k == 0)\n {\n writer.WriteLine(Pow(p, p - 1));\n writer.Flush();\n return;\n }\n\n pa = new int[p];\n size = new int[p];\n\n for (int i = 0; i < pa.Length; i++)\n {\n pa[i] = i;\n size[i] = 1;\n }\n\n for (int i = 1; i < p; i++)\n {\n int pi = GP(i);\n int kpi = GP((int) ((k*i)%p));\n\n if (pi != kpi)\n {\n pa[pi] = kpi;\n size[kpi] += size[pi];\n }\n }\n\n var d = new Dictionary();\n for (int i = 1; i < p; i++)\n {\n if (pa[i] == i)\n {\n if (d.ContainsKey(size[i]))\n d[size[i]] = 1 + d[size[i]];\n else\n {\n d[size[i]] = 1;\n }\n }\n }\n\n long count = 1;\n\n foreach (var dd in d)\n {\n count = (count*Pow(dd.Key*dd.Value + 1, dd.Value))%mod;\n }\n\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int GP(int i)\n {\n if (pa[i] == i)\n return i;\n return pa[i] = GP(pa[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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b5ff285d5feebaea97329a3c472a7eca", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800} {"lang": "MS C#", "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 D\n {\n private static ThreadStart s_threadStart = new D().Go;\n private static bool s_time = false;\n private static double s_eps = 1e-16;\n\n static long mod = 1000000007;\n public static long Pow(long a, long n)\n {\n long res = 1L;\n while (n > 0)\n {\n if ((n & 1) != 0)\n res = (res * a) % mod;\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n private void Go()\n {\n long p = GetInt();\n long k = GetInt();\n\n if (k == 0)\n {\n Wl(Pow(p, p - 1));\n }\n else if (k == 1)\n {\n Wl(Pow(p, p));\n }\n else\n {\n long x = k;\n long kp = 1;\n while (x != 1)\n {\n x *= k;\n x %= p;\n kp++;\n }\n\n Wl(Pow(p, (p - 1) / kp));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "339ea07fad05a61bf950a3a0615e0573", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Moodular_Arithmetic\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 int[] pa;\n private static int[] size;\n\n private static int mod = 1000000007;\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 p = Next();\n long k = Next();\n\n if (k == 0)\n {\n writer.WriteLine(Pow(p, p - 1));\n writer.Flush();\n return;\n }\n if (k == 1)\n {\n writer.WriteLine(Pow(p, p));\n writer.Flush();\n return;\n }\n\n pa = new int[p];\n size = new int[p];\n\n for (int i = 0; i < pa.Length; i++)\n {\n pa[i] = i;\n size[i] = 1;\n }\n\n for (int i = 1; i < p; i++)\n {\n int pi = GP(i);\n int kpi = GP((int) ((k*i)%p));\n\n if (pi != kpi)\n {\n pa[pi] = kpi;\n size[kpi] += size[pi];\n }\n }\n\n var d = new Dictionary();\n for (int i = 1; i < p; i++)\n {\n if (pa[i] == i)\n {\n if (d.ContainsKey(size[i]))\n d[size[i]] = 1 + d[size[i]];\n else\n {\n d[size[i]] = 1;\n }\n }\n }\n\n long count = 1;\n\n foreach (var dd in d)\n {\n count = (count*Pow(dd.Key*dd.Value + 1, dd.Value))%mod;\n }\n\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int GP(int i)\n {\n if (pa[i] == i)\n return i;\n return pa[i] = GP(pa[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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "58aca4b355004a3b9ae035e8be8bf393", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800} {"lang": "MS C#", "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 MOD = 1000000007;\n\n public void Solve()\n {\n int p = ReadInt();\n int k = ReadInt();\n\n long ans = 1;\n var f = new bool[p];\n for (int i = 1; i < p; i++)\n if (!f[i])\n {\n ans = ans * p % MOD;\n int x = i;\n while (!f[x])\n {\n f[x] = true;\n x = (int)(1L * x * k % p);\n }\n }\n if (k == 1)\n ans = ans * p % MOD;\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(\"atoms.in\");\n //writer = new StreamWriter(\"atoms.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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dcaf329b6a9257f53e64c108ace6f434", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800} {"lang": "MS C#", "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 MOD = 1000000007;\n\n int Fun(int n, int c, int[] a, int k)\n {\n if (c == n)\n {\n for (int i = 0; i < n; i++)\n if (a[k * i % n] != k * a[i] % n)\n return 0;\n return 1;\n }\n int ret = 0;\n for (int i = 0; i < n; i++)\n {\n a[c] = i;\n ret += Fun(n, c + 1, a, k);\n }\n return ret;\n }\n\n public void Solve()\n {\n int p = ReadInt();\n int k = ReadInt();\n \n long ans = 1;\n var f = new bool[p];\n for (int i = 1; i < p; i++)\n if (!f[i])\n {\n ans = ans * p % MOD;\n int x = i;\n while (!f[x])\n {\n f[x] = true;\n x = x * k % p;\n }\n }\n if (k == 1)\n ans = ans * p % MOD;\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(\"atoms.in\");\n //writer = new StreamWriter(\"atoms.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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "df3dfc1f5dfad92b7de15c5792539834", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\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 = @\"6 16\".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 private static Dictionary magic = new Dictionary();\n static void Main(string[] args)\n {\n \n Scanner sc = new Scanner();\n int n = sc.nextInt();\n long m = sc.nextInt();\n\n var order = Enumerable.Range(1, n).Select(h => h.ToString()).OrderBy(h => h).Select(jj => int.Parse(jj)).ToList();\n var natural = Enumerable.Range(1, n).ToList();\n int orderi = 0;\n magic[1] = 1;\n for (int i = 2; i <= n; i++)\n {\n magic[i] = magic[i - 1]*2;\n }\n\n int[] arr = new int[n];\n int currStart = 0;\n int currEnd = n - 1;\n long magicNumber = (long)Math.Pow(2, n - 2);\n int ii = 1;\n while (ii <= n)\n {\n //long currentM = m;\n //for (int k = 0; k < order.Count; k++)\n //{\n // if (currentM > magicNumber/magic[order[k]])\n // {\n // currentM -= magicNumber/magic[order[k]];\n // continue;\n // }\n // arr[i-1] = order[k];\n // order.RemoveAt(k);\n\n //}\n //\n \n //while (currentM > magicNumber/magic[num])\n //{\n // currentM\n //}\n int num = order.First();\n if (m <= magicNumber / magic[num])\n {\n arr[currStart] = num;\n currStart++;\n order.Remove(num);\n if (natural.First() != num)\n {\n int num2 = natural.First();\n //m -= magicNumber / magic[num2];\n arr[currEnd] = num2;\n currEnd--;\n order.Remove(num2);\n natural.Remove(num2);\n ii++;\n }\n natural.Remove(num);\n }\n else\n {\n num = natural.First();\n m -= magicNumber / magic[num];\n arr[currEnd] = num;\n currEnd--;\n order.Remove(num);\n natural.Remove(num);\n }\n ii++;\n }\n PrintArr(arr);\n }\n\n\n private static void PrintArr(int[] arr)\n {\n StringBuilder sb = new StringBuilder(arr.Length * 2 - 1);\n for (int i = 0; i < arr.Length; i++)\n {\n sb.Append(arr[i]);\n if (i != arr.Length - 1)\n {\n sb.Append(\" \");\n }\n\n }\n Console.WriteLine(sb);\n }\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7aa472cc03d975197bf594fca10644d2", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\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 = @\"6 3\".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 int n = sc.nextInt();\n long m = sc.nextInt();\n\n int[] arr = new int[n];\n int currStart = 0;\n int currEnd = n - 1;\n long magicNumber = (long)Math.Pow(2, n - 2);\n for (int i = 1; i <= n; i++)\n {\n if (m <= magicNumber)\n {\n arr[currStart] = i;\n currStart++;\n }\n else\n {\n m -= magicNumber;\n arr[currEnd] = i;\n currEnd--;\n }\n magicNumber /= 2;\n }\n PrintArr(arr);\n }\n\n private static void PrintArr(int[] arr)\n {\n StringBuilder sb = new StringBuilder(arr.Length * 2 - 1);\n for (int i = 0; i < arr.Length; i++)\n {\n sb.Append(arr[i]);\n if (i != arr.Length - 1)\n {\n sb.Append(\" \");\n }\n\n }\n Console.WriteLine(sb);\n }\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f36c3d2096d2fcb9a5fa2b7e78e6fd45", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prB2 {\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[] ss = reader.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n ulong m = ulong.Parse(ss[1]);\n ulong[] st = new ulong[46];\n st[0] = 1;\n for(int i = 1; i < 46; i++) {\n st[i] = st[i - 1] * 2;\n }\n int q = 1;\n HashSet set = new HashSet();\n for(int i = 0; i < n; i++) {\n ulong p = 0;\n while(q < n && m > p + st[n - 1 - q]) {\n p += st[n - 1 - q];\n q++;\n }\n writer.Write(q);\n writer.Write(' ');\n set.Add(q);\n m -= p;\n q++;\n if(q >= n)\n break;\n }\n for(int i = n; i >= 1; i--) {\n if(!set.Contains(i)) {\n writer.Write(i);\n writer.Write(' ');\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6f395b6b769b370b41926196702da92f", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Permutations\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var strs = str.Split(' '); // Divide a string de entrada\n int n = 0;\n long m = 0;\n int.TryParse(strs[0], out n); // Tenta converter a entrada na posi\u00e7\u00e3o 0\n long.TryParse(strs[1], out m); // Tenta converter a entrada na posi\u00e7\u00e3o 1\n --m;\n\n int[] array = new int[n];\n\n var tempm = m;\n for (int i = 0; i < n; i++)\n {\n array[i] = (int)(tempm % 2); // Preenche o array com o resoltado de tempm % 2 (resto)\n tempm /= 2; // Divide tempm por 2\n }\n\n perm(array, 1, n); // Resolve\n \n Console.Write(n); // Imprime n\n Console.Write(\" \"); // Espa\u00e7o requisitado no output\n\n perm(array, 2, n); // Resolve\n \n Console.WriteLine(\"\");\n }\n\n static void perm(int[] array, int variation, int n) \n {\n for (int i = n - variation; i >= 0; i--)\n {\n if (!(array[n - 1 - i - 1] == 0)) // Se o array na posi\u00e7\u00e3o n - 1 - i -1 n\u00e3o for igual a 0\n {\n Console.Write(i + 1); // Imprime valor de i + 1\n Console.Write(\" \"); // Espa\u00e7o requisitado no output\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "32e6bc80315d1c37629d6cf0de0f6427", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "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 n = GetInt();\n long m = GetInt();\n\n long[] ans = new long[n];\n long start = 0;\n long end = n - 1;\n long comp = 1L << (n - 2);\n\n for (int i = 1; i <= n; i++)\n {\n if (m > comp)\n {\n m -= comp;\n ans[end--] = i;\n }\n else\n {\n ans[start++] = i;\n }\n comp >>= 1;\n }\n\n Wl(string.Join(\" \", ans));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "42342c7b57ecdf7e4d069f9110630796", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\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 = @\"6 3\".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 int n = sc.nextInt();\n long m = sc.nextInt();\n\n int[] arr = new int[n];\n int currStart = 0;\n int currEnd = n - 1;\n long magicNumber = (long)Math.Pow(2, n - 2);\n for (int i = 1; i <= n; i++)\n {\n if (m <= magicNumber)\n {\n arr[currStart] = i;\n currStart++;\n }\n else\n {\n m -= magicNumber;\n arr[currEnd] = i;\n currEnd--;\n }\n magicNumber /= 2;\n }\n PrintArr(arr);\n }\n\n private static void PrintArr(int[] arr)\n {\n StringBuilder sb = new StringBuilder(arr.Length * 2 - 1);\n for (int i = 0; i < arr.Length; i++)\n {\n sb.Append(arr[i]);\n if (i != arr.Length - 1)\n {\n sb.Append(\" \");\n }\n\n }\n Console.WriteLine(sb);\n }\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cf4a7e14f4774e7550871cc087763490", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\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 = @\"6 3\".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 int n = sc.nextInt();\n long m = sc.nextLong();\n\n int[] arr = new int[n];\n int currStart = 0;\n int currEnd = n - 1;\n long magicNumber = (long)Math.Pow(2, n - 2);\n for (int i = 1; i <= n; i++)\n {\n if (m <= magicNumber)\n {\n arr[currStart] = i;\n currStart++;\n }\n else\n {\n m -= magicNumber;\n arr[currEnd] = i;\n currEnd--;\n }\n magicNumber /= 2;\n }\n PrintArr(arr);\n }\n\n private static void PrintArr(int[] arr)\n {\n StringBuilder sb = new StringBuilder(arr.Length * 2 - 1);\n for (int i = 0; i < arr.Length; i++)\n {\n sb.Append(arr[i]);\n if (i != arr.Length - 1)\n {\n sb.Append(\" \");\n }\n\n }\n Console.WriteLine(sb);\n }\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d67f637fb18d7c3bbaa8675441546f86", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\n\nnamespace CodeForcesPractice\n{\n class CF513B2\n {\n private static int n;\n private static long m;\n\n private static void Execute(string[] args)\n {\n var input = args.Select(s => Int64.Parse(s)).ToList();\n\n n = (int)input[0];\n m = input[1];\n\n var maxFpCount = (long)Math.Pow(2, n - 1);\n\n var p = Enumerable.Repeat(0, n).ToList();\n\n xx(p, 1,0,n-1,m-1,0,maxFpCount);\n\n foreach (var i in p)\n {\n Console.Write(i + \" \");\n }\n }\n\n\n private static void xx(List p, int i, int imin, int imax, long m, long min, long max)\n {\n if (i > n)\n {\n return;\n }\n\n var midpoint = (max - min)/2 + min;\n\n if (m < midpoint)\n {\n p[imin] = i;\n xx(p, i+1,imin+1, imax,m,min,midpoint);\n }\n else\n {\n p[imax] = i;\n xx(p, i + 1, imin, imax-1, m, midpoint, max);\n } \n }\n\n \n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n Execute(input);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "80dcbcb107c1db4e6a330946e8610c1b", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "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 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 class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n Int64 m;\n\n int[] position;\n bool[] InFront;\n\n public void Print(int i)\n {\n if (i > n)\n return;\n\n if (InFront[i])\n {\n Console.Write(i + \" \");\n Print(i + 1);\n }\n else\n {\n Print(i + 1);\n Console.Write(i + \" \");\n }\n }\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n m = ioHelper.ReadNextInt64();\n position = new int[n + 1];\n InFront = new bool[n + 1];\n int i;\n for (i = 1; i < n; i++)\n {\n Int64 withMeInFront = (Int64)Math.Pow(2, n - i - 1);\n if (m > withMeInFront)\n {\n m -= withMeInFront;\n InFront[i] = false;\n }\n else\n {\n InFront[i] = true;\n }\n }\n\n Print(1);\n Console.WriteLine(\"\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5dd0df383750c955125a246524596de2", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Rocketon_2015\n{\n class B\n {\n static string[] input;\n static int n;\n static int m;\n static List items = new List();\n static int top = 0;\n static List> vals = new List>();\n\n static void Main(string[] args)\n {\n input = Console.ReadLine().Split(' ');\n n = int.Parse(input[0]);\n m = int.Parse(input[1]);\n\n for (int i = 1; i <= n; i++)\n {\n items.Add(i);\n }\n\n GeneratePermutations(items.ToList());\n\n Console.WriteLine(string.Join(\" \", vals[m - 1].ToArray()));\n }\n\n static void GeneratePermutations(List items)\n {\n int[] current_permutation = new int[items.Count];\n\n bool[] in_selection = new bool[items.Count];\n\n PermuteItems(items, in_selection,\n current_permutation, 0);\n }\n\n static void PermuteItems(List items, bool[] in_selection, int[] current_permutation, int next_position)\n {\n if (next_position == items.Count)\n {\n int value = f(current_permutation);\n if (value > top)\n {\n top = value;\n vals = new List>();\n }\n if (value == top)\n {\n vals.Add((current_permutation as int[]).ToList());\n }\n }\n else\n {\n for (int i = 0; i < items.Count; i++)\n {\n if (!in_selection[i])\n {\n in_selection[i] = true;\n current_permutation[next_position] = items[i];\n\n PermuteItems(items, in_selection, current_permutation, next_position + 1);\n\n in_selection[i] = false;\n }\n }\n }\n }\n\n static int f(int[] p)\n {\n int res = 0;\n\n for (int i = 0; i < n; i++)\n {\n for (int j = i; j < n; j++)\n {\n int min = 100;\n for (int k = i; k <= j; k++)\n {\n if (int.Parse(p[k].ToString()) < min)\n {\n min = int.Parse(p[k].ToString());\n }\n }\n res += min;\n }\n }\n\n return res;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cb855e28327bc7ca8a6a7c40a3f53754", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing Kattis.IO;\nusing System.Resources;\n\npublic class _513B {\n\n static List calc (List cand, long m) {\n int first = cand [0];\n List res = new List ();\n if (cand.Count == 1) {\n res.Add (first);\n return res;\n }\n\n long half = 1L << (cand.Count - 2);\n cand.RemoveAt (0);\n if (m <= half) {\n res = calc (cand, m);\n res.Insert (0, first);\n } else {\n res = calc (cand, m - half);\n res.Add (first);\n }\n return res;\n }\n\n public static void Main (string[] args) {\n\n var cin = new Tokenizer(Console.OpenStandardInput());\n var cout = new BufferedStdoutWriter ();\n\n int n = int.Parse (cin.Next ());\n long m = long.Parse (cin.Next ());\n List cand = new List ();\n for (int i = 1; i <= n; i++)\n cand.Add (i);\n List res = calc (cand, m);\n cout.Write (\"{0}\", res [0]);\n for (int i = 1; i < res.Count; i++)\n cout.Write (\" {0}\", res [i]);\n cout.WriteLine ();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "040ec593364c8ace335795635028a842", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Permutations\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var strs = str.Split(' '); // Divide a string de entrada\n int n = 0;\n long m = 0;\n int.TryParse(strs[0], out n); // Tenta converter a entrada na posi\u00e7\u00e3o 0\n long.TryParse(strs[1], out m); // Tenta converter a entrada na posi\u00e7\u00e3o 1\n --m;\n\n int[] array = new int[n];\n\n var tempm = m;\n for (int i = 0; i < n; i++)\n {\n array[i] = (int)(tempm % 2); // Preenche o array com o resoltado de tempm % 2 (resto)\n tempm /= 2; // Divide tempm por 2\n }\n\n perm(array, n, 1); // Resolve\n \n Console.Write(n); // Imprime n\n Console.Write(\" \"); // Espa\u00e7o requisitado no output\n\n perm(array, n, 2); // Resolve\n \n Console.WriteLine(\"\");\n }\n\n static void perm(int[] array, int n, int variation = 1) \n {\n if (variation == 1) {\n for (int i = 0; i < n - 1; i ++) \n {\n if (array[n - 1 - i - 1] == 0) // Se o array na posi\u00e7\u00e3o n - 1 - i -1 n\u00e3o for igual a 0\n {\n Console.Write(i + 1); // Imprime valor de i + 1\n Console.Write(\" \"); // Espa\u00e7o requisitado no output\n }\n \n }\n } else if (variation == 2) {\n for (int i = n - 2; i >= 0; i--)\n {\n if (!(array[n - 1 - i -1] == 0)) // Se o array na posi\u00e7\u00e3o n - 1 - i -1 n\u00e3o for igual a 0\n {\n Console.Write(i + 1); // Imprime valor de i + 1\n Console.Write(\" \"); // Espa\u00e7o requisitado no output\n }\n \n }\n } else {\n Environment.Exit(0);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e1dba3be184974c801f21d27668c9d45", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.ExceptionServices;\nusing System.Runtime.Remoting.Messaging;\nusing System.Text;\nusing System.Threading;\n\nnamespace CodeForcesPractice\n{\n class CF513B1\n {\n private static int n;\n private static int m;\n\n private static void Execute(string[] args)\n {\n var input = args.Select(s => Int32.Parse(s)).ToList();\n\n n = input[0];\n m = input[1];\n\n var allPermutations = Permutations(Enumerable.Range(1, n).ToList());\n var maxFp = allPermutations.Max(p => F(p));\n var result = allPermutations.Where(p => F(p) == maxFp).Skip(m - 1).First(); \n\n foreach (var i in result)\n {\n Console.Write(i + \" \");\n }\n }\n\n private static IEnumerable> Permutations(List elements)\n {\n if (elements.Count == 1)\n {\n yield return elements;\n yield break;\n }\n\n for (int i = 0; i < elements.Count; i++)\n {\n var ex = elements.Except(new[] {elements[i]}).ToList();\n\n foreach (var p in Permutations(ex))\n {\n p.Insert(0,elements[i]);\n yield return p;\n }\n }\n }\n\n private static int F(List p)\n {\n int sum = 0;\n\n for (int i = 0; i < n; i++)\n {\n for (int j = i; j < n; j++)\n {\n sum += min(p, i, j);\n }\n }\n\n return sum;\n }\n\n private static int min(List p, int i, int j)\n {\n int min = p[i];\n\n for (int x = i+1; x <= j; x++)\n {\n if (p[x] < min)\n {\n min = p[x];\n }\n }\n\n return min;\n }\n \n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n Execute(input);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aa615a1ed4219fc8ce24edd7244d0d75", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "MS C#", "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[] inArr = Console.ReadLine().Split(' ');\n int n = int.Parse(inArr[0]),\n m = int.Parse(inArr[1]);\n int[] originalArr = new int[n];\n for (int i = 0; i < n; i++)\n originalArr[i] = i + 1;\n string[] allArrays= new string[factorial(n)];\n for (int i=0; i maxFp) maxFp = fP;\n }\n int curM = 1;\n for (int i = 0; i < allArrays.Length; i++)\n {\n if (allFp[i] == maxFp)\n {\n\n if (curM == m)\n {\n Console.Write(allArrays[i]);\n break;\n }\n curM++;\n }\n }\n return 0;\n }\n static string getNumbers(int[] nums, long cur)\n {\n\n int size = nums.Length;\n if (size == 1) return Convert.ToString(nums[0]);\n long amount = factorial(size);\n long ind = (long)(cur / (amount / size));\n int[] newNums = new int[size - 1];\n int Tx = 0;\n for (int x = 0; x < size; x++)\n {\n if (x == ind)\n continue;\n newNums[Tx] = nums[x];\n Tx++;\n }\n return nums[ind] + \" \" + getNumbers(newNums, (cur - (amount / size) * ind));\n\n }\n static long factorial(int n)\n {\n return n <= 1 ? 1 : n * factorial(n - 1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a8b05dea6c53a1fd630647dfe6b4d3dd", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace RocketB\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var strs = str.Split(' ');\n int n = 0;\n long m = 0;\n int.TryParse(strs[0], out n);\n long.TryParse(strs[1], out m);\n --m;\n \n\n int[] array = new int[n];\n\n var tempm = m;\n for (int i = 0; i < n; i++)\n {\n array[i] = (int)(tempm % 2);\n tempm /= 2;\n }\n\n \n for (int i = 0; i < n - 1; i ++)\n {\n if (array[n - 1 - i - 1] == 0)\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n else\n {\n //Console.Write(i + 1 );\n //Console.Write(\" \");\n }\n \n }\n\n // if (p2 > 0)\n {\n Console.Write(n - 1 + 1 );\n Console.Write(\" \");\n }\n\n for (int i = n - 2; i >= 0; i--)\n {\n if (array[n - 1 - i -1] == 0)\n {\n //Console.Write(i + 1);\n //Console.Write(\" \");\n }\n else\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n \n }\n Console.WriteLine(\"\");\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7ee4c8c1f124ecf8f711d6328cd36e03", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "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 n = GetInt();\n long m = GetLong();\n\n long[] ans = new long[n];\n long start = 0;\n long end = n - 1;\n long comp = 1L << (n - 2);\n\n for (int i = 1; i <= n; i++)\n {\n if (m > comp)\n {\n m -= comp;\n ans[end--] = i;\n }\n else\n {\n ans[start++] = i;\n }\n comp >>= 1;\n }\n\n Wl(string.Join(\" \", ans));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e4ca651b1d815a78e9e2bb077e408de5", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace RocketB\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var strs = str.Split(' ');\n int n = 0;\n int m = 0;\n int.TryParse(strs[0], out n);\n int.TryParse(strs[1], out m);\n --m;\n \n\n int[] array = new int[n];\n\n var tempm = m;\n for (int i = 0; i < n; i++)\n {\n array[i] = tempm % 2;\n tempm /= 2;\n }\n\n \n for (int i = 0; i < n - 1; i ++)\n {\n if (array[n - 1 - i - 1] == 0)\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n else\n {\n //Console.Write(i + 1 );\n //Console.Write(\" \");\n }\n \n }\n\n // if (p2 > 0)\n {\n Console.Write(n - 1 + 1 );\n Console.Write(\" \");\n }\n\n for (int i = n - 2; i >= 0; i--)\n {\n if (array[n - 1 - i -1] == 0)\n {\n //Console.Write(i + 1);\n //Console.Write(\" \");\n }\n else\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n \n }\n Console.WriteLine(\"\");\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "08f5a0e90a26a9abd8736c829f5da66e", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "MS C#", "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 n = GetInt();\n long m = GetInt();\n\n long[] ans = new long[n];\n long start = 0;\n long end = n - 1;\n long comp = 1L << (n - 2);\n\n for (int i = 1; i <= n; i++)\n {\n if (m > comp)\n {\n m -= comp;\n ans[end--] = i;\n }\n else\n {\n ans[start++] = i;\n }\n comp >>= 1;\n }\n\n Wl(string.Join(\" \", ans));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "58c3fb2c2fa92020a6ac4fe82e1af22c", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "MS C#", "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 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 class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n Int64 m;\n\n int[] position;\n bool[] InFront;\n\n public void Print(int i)\n {\n if (i > n)\n return;\n\n if (InFront[i])\n {\n Console.Write(i + \" \");\n Print(i + 1);\n }\n else\n {\n Print(i + 1);\n Console.Write(i + \" \");\n }\n }\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n m = ioHelper.ReadNextInt64();\n position = new int[n + 1];\n InFront = new bool[n + 1];\n int i;\n for (i = 1; i < n; i++)\n {\n Int64 withMeInFront = (Int64)Math.Pow(2, n - i - 1);\n if (m > withMeInFront)\n {\n m -= withMeInFront;\n InFront[i] = false;\n }\n else\n {\n InFront[i] = true;\n }\n }\n\n Print(1);\n Console.WriteLine(\"\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7df5bd75bf4047e2a33271468f9a7e5c", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nclass Program\n{\n static void Main()\n {\n long n, m, i;\n long[] u = new long[64];\n var s = Console.ReadLine().Split().Select(long.Parse).ToArray();\n n = s[0]; m = s[1];\n m--;\n for (i = n; --i != 0; )\n if ((m & (1L << (int)i - 1)) == 0)\n {\n Console.Write((n - i) + \" \");\n u[n - i] = 1;\n }\n for (; n != 0; n--) if (u[n] == 0) Console.Write(n + \" \");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d21c19517dffdb5f6de66eb47c83d0ea", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "MS C#", "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 long m = ReadLong() - 1;\n int l = 0, r = n - 1;\n var a = new int[n];\n for (int i = n - 2, j = 1; i >= 0; i--, j++)\n {\n if ((m >> i & 1) == 1)\n a[r--] = j;\n else\n a[l++] = j;\n }\n a[l] = n;\n WriteArray(a);\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 //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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bf0170ae334cdbcad15c1b03bea26a7d", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "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;\nusing System.Threading;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n\n private bool _interrupt;\n private int[] _perm;\n private bool[] _used;\n int _n;\n int _m;\n\n private struct Perm\n {\n public string st;\n public long fp;\n }\n\n private List ls;\n private void Solve()\n {\n _n = _.NextInt();\n _m = _.NextInt();\n ls = new List();\n _perm = new int[_n];\n _interrupt = false;\n _used = new bool[_n + 1];\n BackTrack(0);\n var max = ls.Select(x => x.fp).Max();\n var ans = ls.Where(x => x.fp == max).ElementAt(_m - 1).st;\n _.WriteLine(ans);\n }\n\n private long Fp()\n {\n var sum = 0L;\n for (var i = 0; i < _n; i++)\n for (var j = i; j < _n; j++)\n {\n var min = int.MaxValue;\n for (var k = i; k <= j; k++)\n {\n min = Math.Min(min, _perm[k]);\n }\n sum += min;\n }\n return sum;\n }\n\n private void BackTrack(int indexToFill)\n {\n if (indexToFill == _n)\n {\n Release();\n return;\n }\n for (var i = 1; i <= _n; i++)\n {\n if (_used[i]) continue;\n _perm[indexToFill] = i;\n _used[i] = true;\n BackTrack(indexToFill + 1);\n if (_interrupt) return;\n _used[i] = false;\n }\n }\n\n private void Release()\n {\n ls.Add(new Perm { st = string.Join(\" \", _perm), fp = Fp() });\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "821e21fda5b4c865f02eb388d68eb3bc", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prB2 {\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[] ss = reader.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n ulong m = ulong.Parse(ss[1]);\n ulong[] st = new ulong[51];\n st[0] = 1;\n for(int i = 1; i < 51; i++) {\n st[i] = st[i - 1] * 2;\n }\n int q = 1;\n HashSet set = new HashSet();\n for(int i = 0; i < n; i++) {\n ulong p = 0;\n while(q < n && m > p + st[n - 1 - q]) {\n p += st[n - 1 - q];\n q++;\n }\n writer.Write(q);\n writer.Write(' ');\n set.Add(q);\n m -= p;\n q++;\n if(q >= n)\n break;\n }\n for(int i = n; i >= 1; i--) {\n if(!set.Contains(i)) {\n writer.Write(i);\n writer.Write(' ');\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e0a14bc77ee8a9f2aa7531ac30c90bd1", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace RM_R2015_B1\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 m = double.Parse(s[1]);\n string ans = \"1\";\n double[] a = new double[n + 1];\n\n int i = n;\n while (i > 1)\n {\n m = m / 2;\n a[i] = m;\n m = Math.Ceiling(m);\n i--;\n }\n\n int k = 1;\n for (i = 2; i <= n; i++)\n {\n if (a[i] == Math.Ceiling(a[i]))\n {\n int ind = ans.IndexOf(k.ToString());\n k++;\n if (ind == 0) ans = k.ToString() + ans;\n else ans = ans.Substring(0, ind) + k.ToString() + ans.Substring(ind, ans.Length - ind);\n }\n else\n {\n int ind = ans.IndexOf(k.ToString());\n k++;\n if (ind == ans.Length - 1) ans = ans + k.ToString();\n else ans = ans.Substring(0, ind + 1) + k.ToString() + ans.Substring(ind + 1, ans.Length - ind - 1);\n }\n }\n for (i = 0; i < n; i++)\n {\n Console.Write(\"{0} \", ans[i]);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5ae1d17e1267239bbd2c220d26885671", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\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 = @\"6 2\".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 int n = sc.nextInt();\n int m = sc.nextInt();\n\n int[] arr = new int[n];\n for (int i = 0; i < n; i++)\n {\n arr[i] = i + 1;\n }\n if (m == 1)\n {\n PrintArr(arr);\n return;\n }\n int max = SumX(arr);\n int count = 1;\n while (NextPermutation(arr))\n {\n int num = SumX(arr);\n if (num >= max)\n {\n count++;\n if (count == m)\n {\n PrintArr(arr);\n return;\n }\n max = num;\n }\n }\n }\n\n private static void PrintArr(int[] arr)\n {\n StringBuilder sb = new StringBuilder(arr.Length * 2 - 1);\n for (int i = 0; i < arr.Length; i++)\n {\n sb.Append(arr[i]);\n if (i != arr.Length - 1)\n {\n sb.Append(\" \");\n }\n \n }\n Console.WriteLine(sb);\n }\n\n static int SumX(int[] arr)\n {\n int sum = 0;\n for (int i = 0; i < arr.Length; i++)\n {\n for (int j = i; j < arr.Length; j++)\n {\n sum += arr.Skip(i).Take(j - i + 1).Min();\n }\n }\n return sum;\n }\n\n private static bool NextPermutation(int[] numList)\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e1406c9fb52cd43fee38bce0dc096de5", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "MS C#", "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\n public void Solve()\n {\n\n var n = sc.Integer();\n var m = sc.Long();\n var a = new int[n];\n var rank = n - 2;\n var nibeki = new long[60];\n nibeki[0] = 1;\n for (int i = 1; i < 60; i++)\n nibeki[i] = nibeki[i - 1] * 2;\n var used = new bool[n + 1];\n var down = false;\n for (int i = 0; i < n; i++)\n {\n var p = 0;\n for (int j = rank; j >= 0; j--)\n {\n if (nibeki[j] >= m) { rank = Math.Max(0, j - 1); break; }\n m -= nibeki[j];\n p++;\n }\n if (down)\n {\n for (int j = n, t = 0; j >= 1; j--)\n if (used[j]) continue;\n else\n {\n if (i > 0 && a[i - 1] < j) continue;\n if (t == p)\n {\n a[i] = j;\n used[j] = true;\n if (j == n) down = true;\n break;\n }\n t++;\n }\n }\n else\n {\n for (int j = 1, t = 0; j <= n; j++)\n if (used[j]) continue;\n else\n {\n if (i > 0 && a[i - 1] > j) continue;\n if (t == p)\n {\n\n\n a[i] = j;\n used[j] = true;\n if (j == n) down = true;\n break;\n }\n t++;\n }\n }\n\n\n }\n IO.Printer.Out.WriteLine(a.AsJoinedString());\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\n\n\n\n\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eac141935af884c3109b75a103b45fc2", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "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 long m = ReadLong() - 1;\n int l = 0, r = n - 1;\n var a = new int[n];\n for (int i = n - 2, j = 1; i >= 0; i--, j++)\n {\n if ((m >> i & 1) == 1)\n a[r--] = j;\n else\n a[l++] = j;\n }\n a[l] = n;\n WriteArray(a);\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 //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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3fa2e1f9fa9ed7bd5d808460312c77f5", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Permutations\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)Next();\n long m = Next() - 1;\n\n var nn = new int[2*n + 1];\n nn[n] = n;\n int l = n;\n int r = n;\n\n\n for (int i = n - 1; i > 0; i--)\n {\n if ((m & 1) == 1)\n {\n nn[++r] = i;\n }\n else\n {\n nn[--l] = i;\n }\n m >>= 1;\n }\n\n for (int i = l; i <= r; i++)\n {\n writer.Write(nn[i]);\n writer.Write(' ');\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "18a1772f678c4e360f9b3e9d21b68944", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Permutations\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var strs = str.Split(' '); // Divide a string de entrada\n int n = 0;\n long m = 0;\n int.TryParse(strs[0], out n); // Tenta converter a entrada na posi\u00e7\u00e3o 0\n long.TryParse(strs[1], out m); // Tenta converter a entrada na posi\u00e7\u00e3o 1\n --m;\n\n int[] array = new int[n];\n\n var tempm = m;\n for (int i = 0; i < n; i++)\n {\n array[i] = (int)(tempm % 2);\n tempm /= 2;\n }\n\n for (int i = 0; i < n - 1; i ++)\n {\n if (array[n - 1 - i - 1] == 0)\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n else\n {\n // N\u00e3o faz nada\n }\n \n }\n\n // if (p2 > 0)\n {\n Console.Write(n - 1 + 1 );\n Console.Write(\" \");\n }\n\n for (int i = n - 2; i >= 0; i--)\n {\n if (array[n - 1 - i -1] == 0)\n {\n // N\u00e3o faz nada\n }\n else\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n \n }\n Console.WriteLine(\"\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c20d3ac61b6b1a4d5451113c3dbe55e4", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace RM_R2015_B1\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 m = double.Parse(s[1]);\n string ans = \"1\";\n double[] a = new double[n + 1];\n\n int i = n;\n while (i > 1)\n {\n m = m / 2;\n a[i] = m;\n m = Math.Ceiling(m);\n i--;\n }\n\n int k = 1;\n for (i = 2; i <= n; i++)\n {\n if (a[i] == Math.Ceiling(a[i]))\n {\n int ind = ans.IndexOf(k.ToString());\n k++;\n if (ind == 0) ans = k.ToString() + \" \" +ans;\n else ans = ans.Substring(0, ind) +\" \"+ k.ToString() + \" \" + ans.Substring(ind, ans.Length - ind);\n }\n else\n {\n int ind = ans.IndexOf(k.ToString());\n k++;\n if (ind == ans.Length - 1) ans = ans + \" \" + k.ToString();\n else ans = ans.Substring(0, ind + 1) +\" \"+ k.ToString() +\" \"+ ans.Substring(ind + 1, ans.Length - ind - 1);\n }\n }\n while (ans.IndexOf(\" \") != -1) ans = ans.Remove(ans.IndexOf(\" \"),1);\n s = ans.Split(' ');\n for (i = 0; i < n; i++)\n {\n Console.Write(\"{0} \", s[i]);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6255f30812e5ff2ae7b7c422525a87b7", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace RocketB\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var strs = str.Split(' ');\n int n = 0;\n int m = 0;\n int.TryParse(strs[0], out n);\n int.TryParse(strs[1], out m);\n --m;\n \n\n int[] array = new int[n];\n\n var tempm = m;\n for (int i = 0; i < n; i++)\n {\n array[i] = tempm % 2;\n tempm /= 2;\n }\n\n \n for (int i = 0; i < n - 1; i ++)\n {\n if (array[n - 1 - i - 1] == 0)\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n else\n {\n //Console.Write(i + 1 );\n //Console.Write(\" \");\n }\n \n }\n\n // if (p2 > 0)\n {\n Console.Write(n - 1 + 1 );\n Console.Write(\" \");\n }\n\n for (int i = n - 2; i >= 0; i--)\n {\n if (array[n - 1 - i -1] == 0)\n {\n //Console.Write(i + 1);\n //Console.Write(\" \");\n }\n else\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n \n }\n Console.WriteLine(\"\");\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e5dae047116fea814410009bd50592e6", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace RM_R2015_B1\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 m = double.Parse(s[1]);\n string ans = \"1\";\n double[] a = new double[n + 1];\n\n int i = n;\n while (i > 1)\n {\n m = m / 2;\n a[i] = m;\n m = Math.Ceiling(m);\n i--;\n }\n\n int k = 1;\n for (i = 2; i <= n; i++)\n {\n if (a[i] == Math.Ceiling(a[i]))\n {\n int ind = ans.IndexOf(k.ToString());\n k++;\n if (ind == 0) ans = k.ToString() + ans;\n else ans = ans.Substring(0, ind) + k.ToString() + ans.Substring(ind, ans.Length - ind);\n }\n else\n {\n int ind = ans.IndexOf(k.ToString());\n k++;\n if (ind == ans.Length - 1) ans = ans + k.ToString();\n else ans = ans.Substring(0, ind + 1) + k.ToString() + ans.Substring(ind + 1, ans.Length - ind - 1);\n }\n }\n for (i = 0; i < n; i++)\n {\n Console.Write(\"{0} \", ans[i]);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8898ff8c051fb92d46c42a552e1cb53", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "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\n public void Solve()\n {\n \n var n = sc.Integer();\n long m = sc.Integer();\n var a = new int[n];\n var rank = n - 2;\n var nibeki = new long[60];\n nibeki[0] = 1;\n for (int i = 1; i < 60; i++)\n nibeki[i] = nibeki[i - 1] * 2;\n var used = new bool[n + 1];\n var down = false;\n for (int i = 0; i < n; i++)\n {\n var p = 0;\n for (int j = rank; j >= 0; j--)\n {\n if (nibeki[j] >= m) { rank = Math.Max(0,j-1); break; }\n m -= nibeki[j];\n p++;\n }\n if (down)\n {\n for (int j = n, t = 0; j >= 1; j--)\n if (used[j]) continue;\n else\n {\n if (i > 0 && a[i - 1] < j) continue;\n if (t == p)\n {\n a[i] = j;\n used[j] = true;\n if (j == n) down = true;\n break;\n }\n t++;\n }\n }\n else\n {\n for (int j = 1, t = 0; j <= n; j++)\n if (used[j]) continue;\n else\n {\n if (i > 0 && a[i - 1] > j) continue;\n if (t == p)\n {\n \n\n a[i] = j;\n used[j] = true;\n if (j == n) down = true;\n break;\n }\n t++;\n }\n }\n\t\t\t\t \n\n }\n IO.Printer.Out.WriteLine(a.AsJoinedString());\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#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 // turn kth index value into v\n public void Update(int k, long v)\n {\n k += n;\n data[k] = v;\n k >>= 1;\n while (k > 0)\n {\n data[k] = Math.Min(data[k << 1], data[(k << 1) + 1]);\n k >>= 1;\n }\n\n }\n public long Query(int a, int b) { return Query(a, b, 1, 0, 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\n /*\n ///Data[i]>\n public long this[int i] { get { return data[i + n]; } }\n ///Minimum[a,b)>\n public long this[int l, int r] { get { return Query(l, r, 1, 0, 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 public string Visualize()\n {\n var sb = new System.Text.StringBuilder();\n var k = 2;\n var len = n << 1;\n for (int i = 1; i < len; i++)\n {\n if (data[i] != Max) sb.Append(data[i]);\n else sb.Append('-');\n if (i < k - 1) sb.Append(',');\n else if (i < len - 1)\n {\n sb.AppendLine();\n k <<= 1;\n }\n }\n return sb.ToString();\n }\n //*/\n}\n#endregion\n\n#region RSBT\npublic class RandomizedBinarySearchTree\n{\n Node root;\n Comparison compare;\n public RandomizedBinarySearchTree(Comparison cmp) { compare = cmp; }\n public RandomizedBinarySearchTree() : this(Comparer.Default.Compare) { }\n public void Insert(T v, int k)\n {\n var s = Node.Split(root, k);\n root = Node.Merge(Node.Merge(s.lst, new Node(v)), s.rst);\n }\n public void RemoveAt(int k)\n {\n var s = Node.Split(root, k);\n root = Node.Merge(s.lst, Node.Split(s.rst, 1).rst);\n }\n public void Merge(RandomizedBinarySearchTree other)\n {\n root = Node.Merge(root, other.root);\n }\n public RandomizedBinarySearchTree Split(int k)\n {\n var s = Node.Split(root, k);\n root = s.lst;\n return new RandomizedBinarySearchTree(compare) { root = s.rst };\n }\n\n public T this[int k] { get { return Node.Find(root, k); } }\n public void Add(T v)\n {\n Insert(v, LowerBound(v));\n }\n public void Remove(T v)\n {\n if (Count(v) == 0) return;\n RemoveAt(LowerBound(v));\n }\n public int Count(T v)\n {\n return UpperBound(v) - LowerBound(v);\n }\n public int LowerBound(T v)\n {\n return Node.LowerBound(root, v, compare);\n }\n public int UpperBound(T v)\n {\n return Node.UpperBound(root, v, compare);\n }\n\n\n private class XORShift\n {\n public XORShift() { }\n public XORShift(uint seed) { w = seed; }\n\n uint x = 123456789, y = 362436069, z = 521288629, w = 88675123;\n uint t;\n public long Next()\n {\n t = (x ^ (x << 11)); x = y; y = z; z = w;\n return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));\n }\n\n }\n\n private class Node\n {\n static XORShift rand = new XORShift();\n public readonly T val;\n public Node lst, rst;\n public int cnt;\n public Node(T v) { val = v; cnt = 1; }\n private Node(Node l, Node r) { lst = l; rst = r; }\n private void push()\n {\n\n }\n public override string ToString() { return string.Format(\"count:{0} value:{1}\", Count(this), val); }\n static int Count(Node t) { return t == null ? 0 : t.cnt; }\n static public Node Update(Node t)\n {\n t.cnt = 1 + Count(t.lst) + Count(t.rst);\n return t;\n }\n\n static public Node Merge(Node l, Node r)\n {\n if (l == null || r == null)\n return l == null ? r : l;\n l.push(); r.push();\n\n if (rand.Next() % (l.cnt + r.cnt) < l.cnt)\n {\n l.rst = Merge(l.rst, r);\n return Update(l);\n }\n else\n {\n r.lst = Merge(l, r.lst);\n return Update(r);\n }\n\n }\n static public Node Split(Node t, int k)\n {\n if (t == null) return new Node(null, null);\n t.push();\n if (k <= Count(t.lst))\n {\n var s = Split(t.lst, k);\n t.lst = s.rst;\n return new Node(s.lst, Update(t));\n }\n else\n {\n var s = Split(t.rst, k - Count(t.lst) - 1);\n t.rst = s.lst;\n return new Node(Update(t), s.rst);\n }\n }\n static public T Find(Node t, int k)\n {\n if (Count(t) < k) throw new IndexOutOfRangeException();\n if (k == Count(t.lst)) return t.val;\n if (k < Count(t.lst)) return Find(t.lst, k);\n else return Find(t.rst, k - (Count(t.lst) + 1));\n }\n static public int LowerBound(Node t, T v, Comparison compare)\n {\n if (Count(t) == 0) return 0;\n if (compare(v, t.val) <= 0) return LowerBound(t.lst, v, compare);\n return Count(t.lst) + 1 + LowerBound(t.rst, v, compare);\n }\n static public int UpperBound(Node t, T v, Comparison compare)\n {\n if (Count(t) == 0) return 0;\n if (compare(t.val, v) <= 0) return Count(t.lst) + 1 + UpperBound(t.rst, v, compare);\n return UpperBound(t.lst, v, compare);\n }\n\n }\n}\n#endregion\n\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\n\n\n#region next_permutation\nstatic public partial class MathEx\n{\n\n static public bool NextPermutation(T[] array, int first, int last) where T : IComparable\n {\n if (first == last)\n return false;\n var i = last;\n if (--i == first)\n return false;\n while (true)\n {\n var ii = i--;\n if (array[i].CompareTo(array[ii]) < 0)\n {\n var j = last;\n while (array[i].CompareTo(array[--j]) >= 0) { }\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n Array.Reverse(array, ii, last - ii);\n return true;\n }\n if (i == first)\n {\n Array.Reverse(array, first, last - first);\n return false;\n }\n }\n }\n\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "920d9b429981b2efa218fc798448747e", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Permutations\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var strs = str.Split(' '); // Divide a string de entrada\n int n = 0;\n long m = 0;\n int.TryParse(strs[0], out n); // Tenta converter a entrada na posi\u00e7\u00e3o 0\n long.TryParse(strs[1], out m); // Tenta converter a entrada na posi\u00e7\u00e3o 1\n --m;\n\n int[] array = new int[n];\n\n var tempm = m;\n for (int i = 0; i < n; i++)\n {\n array[i] = (int)(tempm % 2);\n tempm /= 2;\n }\n\n for (int i = 0; i < n - 1; i ++)\n {\n if (array[n - 1 - i - 1] == 0)\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n else\n {\n //Console.Write(i + 1 );\n //Console.Write(\" \");\n }\n \n }\n\n // if (p2 > 0)\n // {\n // Console.Write(n - 1 + 1 );\n // Console.Write(\" \");\n // }\n\n for (int i = n - 2; i >= 0; i--)\n {\n if (array[n - 1 - i -1] == 0)\n {\n // N\u00e3o faz nada\n }\n else\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n \n }\n Console.WriteLine(\"\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1c21b85cad75426a249fadf19a237aa3", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace RocketB\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var strs = str.Split(' ');\n int n = 0;\n long m = 0;\n int.TryParse(strs[0], out n);\n long.TryParse(strs[1], out m);\n --m;\n \n\n int[] array = new int[n];\n\n var tempm = m;\n for (int i = 0; i < n; i++)\n {\n array[i] = tempm % 2;\n tempm /= 2;\n }\n\n \n for (int i = 0; i < n - 1; i ++)\n {\n if (array[n - 1 - i - 1] == 0)\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n else\n {\n //Console.Write(i + 1 );\n //Console.Write(\" \");\n }\n \n }\n\n // if (p2 > 0)\n {\n Console.Write(n - 1 + 1 );\n Console.Write(\" \");\n }\n\n for (int i = n - 2; i >= 0; i--)\n {\n if (array[n - 1 - i -1] == 0)\n {\n //Console.Write(i + 1);\n //Console.Write(\" \");\n }\n else\n {\n Console.Write(i + 1);\n Console.Write(\" \");\n }\n \n }\n Console.WriteLine(\"\");\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8949d4720ec62aad24180715672064be", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace International_Olympiad\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 for (int i = 0; i < n; i++)\n {\n string s = reader.ReadLine().Substring(4);\n long t = long.Parse(s);\n\n long pow = 10, f = 0;\n\n for (int k = 1; k < s.Length; k++)\n {\n f += pow;\n pow *= 10;\n }\n\n while (t < 1989 + f)\n {\n t += pow;\n }\n\n writer.WriteLine(t);\n }\n\n\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "554cb20e31f3ec2d83b6ec8dc08c884f", "src_uid": "31be4d38a8b5ea8738a65bfee24a5a21", "difficulty": 2000} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace International_Olympiad\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 var h = new HashSet();\n\n\n for (int i = 0; i < n; i++)\n {\n string s = reader.ReadLine().Substring(4);\n long t = long.Parse(s);\n\n long start, pow;\n if (t == 9)\n {\n start = 198;\n pow = 10;\n }\n else if (t < 9)\n {\n start = 199;\n pow = 10;\n }\n else if (t >= 89 && t < 100)\n {\n start = 19;\n pow = 100;\n }\n else if (t < 100)\n {\n start = 20;\n pow = 100;\n }\n else if (t >= 989 && t < 1000)\n {\n start = 1;\n pow = 1000;\n }\n else if (t < 1000)\n {\n start = 2;\n pow = 1000;\n }\n else if (t >= 1989 && t < 10000)\n {\n start = 0;\n pow = 10000;\n }\n else if (t < 10000)\n {\n start = 1;\n pow = 10000;\n }\n else\n {\n start = 0;\n pow = Pow(10, s.Length + 1);\n }\n\n while (true)\n {\n long y = start*pow + t;\n if (h.Contains(y))\n start++;\n else\n {\n h.Add(y);\n writer.WriteLine(y);\n break;\n }\n }\n }\n\n\n writer.Flush();\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);\n }\n a = (a*a);\n k >>= 1;\n }\n return r;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8330494db48cd962b461be53e08913e6", "src_uid": "31be4d38a8b5ea8738a65bfee24a5a21", "difficulty": 2000} {"lang": "Mono C#", "source_code": "\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 numbers = sr.ReadArrayOfInt32();\n var val = 1;\n Func func = (next) => {\n var count = 0;\n for (var i = 0; i < numbers.Length; i++) {\n if (next * numbers[i] > 0) {\n count++;\n }\n }\n\n return count;\n };\n var mid = n % 2 == 1 ? ((n + 1) / 2) : (n / 2);\n if (func(1) >= mid) {\n sw.WriteLine(1);\n return;\n }\n\n if (func(-1) == mid) {\n sw.WriteLine(-1);\n return;\n }\n\n sw.WriteLine(0);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6bbaa3f33b3f337d413f79b493f039bd", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nclass Codeforces_round_542_A\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string [] s = Console.ReadLine().Split(' ');\n double [] a = new double [n];\n int cntplus = 0; int cntminus = 0; int cntnol = 0;\n for(int i=0; i 0) cntplus++;\n if(a[i] < 0) cntminus++;\n if(a[i] == 0) cntnol++;\n }\n if(cntplus > n/2) Console.Write(\"1\");\n if(cntminus > n/2) Console.Write(\"-1\");\n if(cntnol > n/2 ) Console.Write(\"0\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8c15388ea77bc0a9483bb905920c967f", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "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 decimal n = Convert.ToInt32(Console.ReadLine());\n string[] nums = Console.ReadLine().Split(' ');\n\n int atLeastNums = (int)Math.Ceiling(n / 2);\n\n int validNumsCount = 0;\n for (int i = 0; i < n; i++)\n {\n if (Convert.ToInt32(nums[i]) != 0)\n {\n validNumsCount++;\n }\n }\n\n Console.WriteLine(validNumsCount >= atLeastNums ? validNumsCount : 0);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ccde04e9b160bc6e6e9b99e106b07b95", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "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 N = int.Parse(Console.ReadLine());\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] a = new int[N];\n for (int i = 0; i < N; i++)\n {\n a[i] = int.Parse(temp[i]);\n }\n int counter1 = 0;\n int counter2 = 0;\n for(int i =0;i0)\n {\n counter2++;\n }\n }\n if(counter1>=N/2)\n {\n Console.WriteLine(-1);\n }\n else if(counter2>=N/2)\n {\n Console.WriteLine(1);\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9b0b0bd976619ec963b2d9d4cd5425c3", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nclass Codeforces_round_542_A\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string [] s = Console.ReadLine().Split(' ');\n double [] a = new double [n];\n int cntplus = 0; int cntminus = 0; int cntnol = 0;\n for(int i=0; i 0) cntplus++;\n if(a[i] < 0) cntminus++;\n if(a[i] == 0) cntnol++;\n }\n if(cntplus >= Math.Ceiling((double)n/2)) Console.Write(\"1\");\n if(cntminus >= Math.Ceiling((double)n/2)) Console.Write(\"-1\");\n if(cntnol >= Math.Ceiling((double)n/2)) Console.Write(\"0\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8e5608426d279d135d9e71abf4049e2d", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces542\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(x => int.Parse(x)).ToArray();\n Solution sol = new Solution();\n Console.WriteLine(sol.GetD(A));\n }\n }\n\n public class Solution\n {\n public int GetD(int[] A)\n {\n int ng = 0;\n int ps = 0;\n for (int i = 0; i < A.Length; ++i)\n {\n ng += A[i] < 0 ? 1 : 0;\n ps += A[i] > 0 ? 1 : 0;\n }\n\n if (ps >= A.Length / 2)\n return 1;\n if (ng >= A.Length / 2)\n return -1;\n return 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "15db0272f895e0ef98178cd78e39d2d1", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _1130A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Console.ReadLine().Split().GroupBy(x => Math.Sign(int.Parse(x))).Where(x => x.Count() * 2 >= n).Select(x => x.Key).DefaultIfEmpty(0).First());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1c03223a2e82063b83e14c49c31c449a", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nclass Codeforces_round_542_A\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string [] s = Console.ReadLine().Split(' ');\n double [] a = new double [n];\n int cntplus = 0; int cntminus = 0; int cntnol = 0;\n for(int i=0; i 0) cntplus++;\n if(a[i] < 0) cntminus++;\n if(a[i] == 0) cntnol++;\n }\n if(cntplus >= Math.Ceiling((double)n/2)) Console.Write(\"1\");\n else if(cntminus >= Math.Ceiling((double)n/2)) Console.Write(\"-1\");\n else if(cntnol >= Math.Ceiling((double)n/2)) Console.Write(\"0\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cab9a87034cca5381057ea8b58ea7fad", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.IO;\n\npublic class Z\n{\n\tpublic static int Main(string[] args)\n\t{\n\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\tint[] a = new int [100];string[]s=Console.ReadLine().Split(' ');for (int i = 0; i0)++b;\n\t\t\tif(a[i]<0)++c;\n\t\t}\n\t\tn=n%2+n/2;\n\t\tif(b>=n){Console.WriteLine(\"1\");return 0;}\n\t\tif(c>=n){Console.WriteLine(\"-1\");return 0;}\n\t\tConsole.WriteLine(\"0\");\n\t\treturn 0;\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f82b6ef57453ae25ff4ee2179997bb45", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "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 var A = cin.scanint;\n\n int minus = 0;\n int plus = 0;\n for (int i = 0; i < N; i++)\n {\n if (A[i] > 0)\n {\n plus++;\n }\n else if(A[i] < 0)\n {\n minus++;\n }\n }\n\n int ans = 0;\n if (plus >= (N + 1) / 2)\n {\n ans = 1;\n }\n if (minus >= (N + 1) / 2)\n {\n ans = -1;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "39da739461ea30937b9c8f3162d9d1ef", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication23\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 pos = 0, neg = 0;\n for (int i = 0; i < n; i++)\n if (int.Parse(s[i]) > 0) pos++;\n else if (int.Parse(s[i]) < 0) neg++;\n\n int p = n / 2;\n if (n % 2 > 0) p++;\n if (pos >= p) Console.WriteLine(2);\n else\n if (neg >= p) Console.WriteLine(-5);\n else Console.WriteLine(0);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "36549a7d75585e80954e79151bb810c1", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "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 N = int.Parse(Console.ReadLine());\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] a = new int[N];\n for (int i = 0; i < N; i++)\n {\n a[i] = int.Parse(temp[i]);\n }\n int counter1 = 0;\n int counter2 = 0;\n for(int i =0;i0)\n {\n counter2++;\n }\n }\n if(counter1>=(N+N%2)/2)\n {\n Console.WriteLine(-1);\n }\n else if(counter2>=(N+N%2)/2)\n {\n Console.WriteLine(1);\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0a85bf2bdd4218427dd2260c55d167d9", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "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\tint[] a = UtilityMethods.ReadIntArray();\n\t\tint less = 0, eq = 0, more = 0;\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tless += a[i] < 0 ? 1 : 0;\n\t\t\teq += a[i] == 0 ? 1 : 0;\n\t\t\tmore += a[i] > 0 ? 1 : 0;\n\t\t}\n\t\tif (eq + more > less && eq + less > more)\n\t\t\tUtilityMethods.WriteLine(0);\n\t\telse\n\t\t\tUtilityMethods.WriteLine(less < more ? 1 : -1);\n\t\tConsole.ReadLine();\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "99873759628d8b10001c496bffa1131c", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nclass Codeforces_round_542_A\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string [] s = Console.ReadLine().Split(' ');\n double [] a = new double [n];\n int cntplus = 0; int cntminus = 0; int cntnol = 0;\n for(int i=0; i 0) cntplus++;\n if(a[i] < 0) cntminus++;\n if(a[i] == 0) cntnol++;\n }\n if(cntplus >= Math.Ceiling((double)n/2)) Console.Write(\"1\");\n else if(cntminus >= Math.Ceiling((double)n/2)) Console.Write(\"-1\");\n else if(cntnol >= Math.Ceiling((double)n/2)) Console.Write(\"0\");\n else Console.Write(\"0\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6cb8f825f5b73cfa3151993a28c2e4dd", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Be_Positive\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 n = Next();\n int[] nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n int half = (n + 1) / 2;\n int cp = nn.Count(t => t > 0);\n if (cp >= half)\n return 1;\n int cm = nn.Count(t => t < 0);\n if (cm >= half)\n return -1;\n return 0;\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 res*m;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "945f729e45ef27564a1e64bb19c21928", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "// Problem: 1130A - Be Positive\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass BePositive\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 != n)\n return -1;\n byte countPos = 0;\n byte countNeg = 0;\n for (byte i = 0; i < n; i++)\n {\n short ai;\n if (!Int16.TryParse (words[i], out ai))\n return -1;\n if (ai < -1000 || ai > 1000)\n return -1;\n if (ai > 0)\n countPos++;\n else if (ai < 0)\n countNeg++;\n }\n byte halfSize = Convert.ToByte (n%2 == 0 ? n/2 : (n+1)/2);\n sbyte ans = 0;\n if (countPos >= halfSize)\n ans = 1;\n else if (countNeg >= halfSize)\n ans = -1;\n Console.WriteLine (ans);\n return 0;\n }\n }\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "50e38d4f59b5c65fee35f97bf0da5f33", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace NetExperiment\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 mid = (int)Math.Ceiling((double)n / 2);\n if (mid <= a.Count(k => k > 0))\n Console.WriteLine(1);\n else if (mid <= a.Count(k => k < 0))\n Console.WriteLine(-1);\n else\n Console.WriteLine(0);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "574b1706c3cf7d070e8b2da3ce7706c5", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u041a\u0430\u0441\u0441\u0438\u0440\n{\n \n class Program\n {\n public static void DFS(List> G, int ver, bool[] visited, ref int count)\n {\n Stack st = new Stack();\n st.Push(ver);\n while (st.Count != 0)\n {\n int CurVer = st.Pop();\n visited[CurVer] = true;\n count++;\n for (int i = 0; i < G[CurVer].Count; i++)\n {\n if (!visited[G[CurVer][i]])\n st.Push(G[CurVer][i]);\n }\n }\n }\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n string[] str = Console.ReadLine().Split(' ');\n int pol = 0;\n int otr = 0;\n for(int i = 0; i 0)\n pol++;\n }\n int half;\n if (str.Length % 2 == 0)\n half = str.Length / 2;\n else\n {\n half = str.Length / 2 + 1;\n }\n if(pol>=half)\n Console.WriteLine(1);\n else if(otr>=half)\n Console.WriteLine(-1);\n else\n Console.WriteLine(0);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8e0d8afd466c89949c96401a70f51f45", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "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\tint a = 0;\n\t\tint b = 0;\n\t\tint[]A = new int[N];\n\t\tstring[] str = Console.ReadLine().Split();\n\t\tfor(var i=0;i0){\n\t\t\t\ta++;\n\t\t\t} else if(A[i]<0){\n\t\t\t\tb++;\n\t\t\t}\n\t\t}\n\t\tint d = 0;\n\t\tif(a>=(N+1)/2){\n\t\t\td = 1;\n\t\t} else if(b>=(N+1)/2){\n\t\t\td = -1;\n\t\t}\n\t\tConsole.WriteLine(d);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "737dae1632a272f8ab441910c2ecd8eb", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "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 n = ReadInt();\n\n int target = n / 2;\n\n if (n % 2 != 0)\n target++;\n\n int[] A = ReadArray();\n\n int pCount = 0;\n int nCount = 0;\n int pVal = 0;\n int nVal = 0;\n\n for(int i = 0; i < n; i++)\n {\n if (A[i] > 0)\n {\n pCount++;\n pVal = A[i];\n }\n if (A[i] < 0)\n {\n nCount++;\n nVal = A[i];\n }\n }\n int result = 0;\n\n if (pCount >= target)\n result = pVal;\n else if (nCount >= target)\n result = nVal;\n\n Console.WriteLine(result);\n \n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ed2510311b961c4c516441e0f4fbcf5c", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static System.Globalization.CultureInfo;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var num = ToInt32(ReadLine());\n var ar = ReadLine().Split(' ').Select(v =>int.Parse(v, InvariantCulture)).ToArray();\n var min = (num + 1) / 2;\n if (ar.Count(v => v > 0) >= min) WriteLine(1);\n else if (ar.Count(v => v < 0) >= min) WriteLine(-1);\n else WriteLine(0);\n }\n private const string ALFA = \"abcdefghijklmnopqrstuvwxyz\";\n private const int MOD = 1000000007;\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4c2d70d8d542ec1ac5b13ab468afc41e", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "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 n = int.Parse(Console.ReadLine());\n string[] token = Console.ReadLine().Split();\n \n float[] a = new float[n];\n \n int nn = 0,pp=0,zz=0;\n for(int i=0;i0){\n pp++;\n }else{\n zz++;\n }\n }\n \n int cc = n/2;\n \n if(n%2!=0)cc++;\n \n \n if(pp>=cc){\n Console.WriteLine(1);\n }else if(nn>=cc){\n Console.WriteLine(-1);\n }else{\n Console.WriteLine(0);\n }\n \n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f7ef049e77bb1c4dd66f079f89c6346f", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _1130A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Console.ReadLine().Split().GroupBy(x => Math.Sign(int.Parse(x))).Where(x => x.Key != 0 && x.Count() * 2 >= n).Select(x => x.Key).DefaultIfEmpty(0).First());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b7200438fd43dcb3cfbd50ac9d7c85bb", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffnamespace Problem\n{\n using System;\n using System.Collections.Generic;\n using System.Collections;\n class problem\n {\n static void Main()\n {\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 < n ; i++)\n a[i] = int.Parse( str[i] );\n int duong = 0;\n int am = 0;\n for(int i = 0 ; i < n ; i++)\n {\n if(a[i] > 0)\n duong++;\n else if(a[i] < 0)\n am++;\n }\n if(n % 2 == 0)\n {\n if(duong >= n / 2)\n Console.WriteLine( 1 );\n else if(am >= n / 2)\n Console.WriteLine( -1 );\n else\n Console.WriteLine( 0 );\n }\n else\n {\n if(duong >= ( n / 2 + 1 ))\n Console.WriteLine( 1 );\n else if(am >= ( n / 2 + 1 ))\n Console.WriteLine( -1 );\n else\n Console.WriteLine( 0 );\n }\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "033ec9d57faaa1d3b65e802797c22244", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n int[] mass = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int plus = mass.Count(x => x > 0);\n int zero = mass.Count(x => x == 0);\n int minus = count - plus - zero;\n int min = (int)(Math.Ceiling(count / 2.0));\n if (plus >= min) Console.WriteLine(1);\n else if (minus >= min) Console.WriteLine(-1);\n else Console.WriteLine(0);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a8fb80babf7e8e6a4d1f5b614b536b3b", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "15c1c82f4ab2dec0bcfa525aaa3605f7", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d78998632f0795171a6111ac24edc305", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ae051bf074d5a845bc46c13f4be44fe7", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b2f99935a97d087adfffad29cd371f6", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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 { }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3a97c8daa7d2e7d6bd26769455c48eca", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c6739fb2cb32f17e930a18628de84fc", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a2fa966ef5021bf2a3962548c442cbe1", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "38f8af8eb70b35bf90bed8fe5cf8b0c1", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "516b1d2e0854a162db4cf589fd1f5e7b", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b7a32493e7617bca8fb6b3b4b857339b", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "751ec1c7989a7c528ce8f9a07e5e5532", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec2248bd28b79d83901671afa89fc8cd", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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 static void 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;\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 = xs.GetViewBetween(rt.leftbottom.Item2, rt.righttop.Item2);\n foreach(int x in valuex)\n {\n foreach (int y in valuex)\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;\n }\n }\n System.Console.WriteLine(\"YES\");\n return;\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9ba99f1bc5fdff334eeb3c74361a21e0", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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 = xs.GetViewBetween(rt.leftbottom.Item2, rt.righttop.Item2);\n foreach(int x in valuex)\n {\n foreach (int y in valuex)\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d0db1eef55ea7b51316db1d443fbc822", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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 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 }\n\n int it = (1 << n);\n for (int i = 1; i < it; i++)\n {\n int area = 0;\n int maxx = -1, minx = 35000, maxy = -1, miny = 35000;\n for (int j = 0; j < n; j++)\n {\n int e = (1 << j);\n if ((i & e) > 0)\n {\n area += (x2[j] - x1[j]) * (y2[j] - y1[j]);\n maxx = Math.Max(maxx, x2[j]);\n maxy = Math.Max(maxy, y2[j]);\n minx = Math.Min(minx, x1[j]);\n miny = Math.Min(miny, y1[j]);\n }\n }\n if (area == (maxx - minx) * (maxy - miny)\n && (maxx - minx) == (maxy - miny))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6e24a19c0920ecdcc79ce8210c801407", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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 Console.WriteLine(\"min X: {0}\", minX);\n Console.WriteLine(\"min Y: {0}\", minY);\n Console.WriteLine(\"max X: {0}\", maxX);\n Console.WriteLine(\"max Y: {0}\", maxY);\n\n // 31400,\u20090\u2009\u2264\u2009y1\u2009<\u2009y2\u2009\u2264\u200931400\n var a = new byte[31401, 31401];\n\n for (int i = 0; i < n; i++)\n {\n for (int x = squares[i, 0]; x < squares[i, 2]; x++)\n {\n for (int y = squares[i, 1]; y < squares[i, 3]; y++)\n {\n a[x, y] = 1;\n }\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d0cc8526a49b6a4bcba3c08010bf3a50", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "MS C#", "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 static void 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;\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 = xs.GetViewBetween(rt.leftbottom.Item2, rt.righttop.Item2);\n foreach(int x in valuex)\n {\n foreach (int y in valuex)\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;\n }\n }\n System.Console.WriteLine(\"YES\");\n return;\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9fab225934e0d4a02be84ced391aade1", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500} {"lang": "Mono C#", "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 string[] str = Console.ReadLine().Split();\n long n = long.Parse(str[0]);\n long k = long.Parse(str[1]);\n for (long i = 1; i <= n && ((i + 1) * i) / 2 <= k + n - i; i++)\n {\n if (((i + 1) * i) / 2 == k + n - i)\n {\n Console.WriteLine(n - i);\n break;\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f87bb33c45430a6a79103f286e9b3be3", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n double tn, k, m;\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n k = int.Parse(input[1]);\n tn = 2D*(k + int.Parse(input[0]));\n }\n if (((m = Math.Floor(Math.Sqrt(tn)) - 1D) * m + m * 3D) > tn) --m;\n Console.WriteLine((m * m + m) / 2D - k);\n } \n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1f476214cb38517b88925e0ec2aed45b", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "// Problem: 1195B - Sport Mafia\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass SportMafia\n {\n static int Main ()\n {\n string[] words = ReadSplitLine (2);\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 > 1000000000)\n return -1;\n uint k;\n if (!UInt32.TryParse (words[1], out k))\n return -1;\n if (k > 1000000000)\n return -1;\n uint numCandy = 0;\n uint nPut = 0;\n while (numCandy < k)\n {\n nPut++;\n numCandy += nPut;\n }\n bool solved = false;\n uint nEat = numCandy-k;\n uint nSum = nPut+nEat;\n while (nSum <= n && !solved)\n {\n if (nSum == n)\n solved = true;\n else\n {\n nPut++;\n numCandy += nPut;\n nEat = numCandy-k;\n nSum = nPut+nEat;\n }\n }\n if (!solved)\n return -1;\n Console.WriteLine (nEat);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "68c3e4486b9df7715075757a27cbc75f", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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 int k = sc.NextInt();\n\n // \u6700\u521d\u98f4\u30921\u3064\u5165\u308c\u308b\n\n // \u98f4\u30921\u3064\u98df\u3079\u308b \n // \u524d\u56de\u5165\u308c\u308b\u64cd\u4f5c\u3057\u305f\u500b\u6570+1\u5165\u308c\u308b\n\n // n\u56de\u64cd\u4f5c\u3057\u3066k\u500b\u98f4\u5165\u3063\u3066\u308b \u98df\u3079\u305f\u500b\u6570\n\n // \u98df\u3079\u305f x\u56de\n\n for (long y = 0; y <= n; y++)\n {\n long x = n - y;\n long t = (y + 1) * y / 2 - x;\n if (t == k)\n {\n Console.WriteLine(x);\n return;\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "086e9923e65aced5a33c4d0c4c1cf7ca", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces574\n{\n class Program2\n {\n static void Main()\n {\n //l=\u5165\u308c\u305f\u56de\u6570\n // s = n - l\n // l = n - s\n //(n-s)*(1+n-s)/2 - s - k = 0\n var input = Console.ReadLine().Split(' ').Select(long.Parse);\n var n = input.First();\n var k = input.Skip(1).First();\n\n var A = -2 * n - 2 * k;\n var l = (int)(-3 + Math.Sqrt(9 - 4 * A)) / 2;\n var ans = n - l;\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ffecfd8c916c39687810b9a364b13c96", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Reflection;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] array = new long[2];\n string str = Console.ReadLine();\n string s = \"\";\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == ' ')\n {\n array[0] = Convert.ToInt64(s);\n s = \"\";\n }\n else\n {\n s += str[i];\n }\n }\n array[1] = Convert.ToInt64(s);\n\n long l = 1;\n long r = array[0];\n long mid = 0;\n while (l < r)\n {\n mid = (l + r) / 2;\n if ((1 + mid) * mid / 2 - (array[0] - mid) < array[1])\n {\n l = mid + 1;\n }\n\n if ((1 + mid) * mid / 2 - (array[0] - mid) > array[1])\n {\n r = mid - 1;\n }\n if ((1 + mid) * mid / 2 - (array[0] - mid) == array[1])\n {\n break;\n }\n \n\n }\n if (l == r)\n {\n mid = l;\n \n }\n Console.WriteLine(array[0] - mid);\n \n // Console.Read();\n\n }\n }\n \n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bd737ec218d8413916ab095ec2a511e6", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t var s = Console.ReadLine().Split(' ');\n\t\tint n = Int32.Parse(s[0]);\n\t\tint k = Int32.Parse(s[1]);\n\t\tint allCandy = 0;\n\t\tfor(int i = 1; i <= n; i++)\n\t\t{\n\t\t\tallCandy += i;\n\t\t}\n\t\tint lostCandy = allCandy - k;\n\t\tint j = 0; \n\t\twhile(lostCandy != 0)\n\t\t{\n\t\t\tlostCandy -= n +1;\n\t\t\tn--;\n\t\t\tj++;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(j);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3d2bc6fc8c0827bc8b614bdab22d89cf", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "/*\ncsc -debug B.cs && mono --debug B.exe <<< \"1 1\"\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.NextLong();\n var k = cin.NextLong();\n\n var put = n + k;\n\n for (var a = 0L; a <= n; a++) {\n if (a * (a + 3L) / 2L == put) {\n System.Console.WriteLine(n - a);\n break;\n }\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f32793f566c8bb8f4ab001c694cd5a6a", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nusing static System.Console;\n \npublic class Test\n{ \n static long Sum(int n)\n {\n return (2 + (long)n - 1) * (long)n / 2;\n }\n\n static long Res(int i, int n)\n {\n return Sum(i) - n + i;\n }\n\n static int Mid(int left, int right)\n { \n return (int)Math.Floor((double)(left + right) / (double)2);\n }\n\n public static void Main()\n\t{\n var line1 = ReadLine().Split();\n int n = int.Parse(line1[0]);\n int k = int.Parse(line1[1]);\n \n int left = 1;\n int right = n;\n int mid = Mid(left, right); \n while(Res(mid, n) != k)\n {\n if(Res(mid, n) > k)\n {\n right = mid;\n }\n else\n {\n left = mid;\n } \n if(mid == Mid(left, right))\n break;\n mid = Mid(left, right); \n }\n\n WriteLine(Sum(mid) - k);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b131e2e6d3f68b1514d7e078c5052601", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": ".NET Core C#", "source_code": "using System;\n\nnamespace _1195B_SportMafia\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n\n int moves = Convert.ToInt32(input[0]);\n int candiesLeft = Convert.ToInt32(input[1]);\n\n int candies = 0;\n\n int c = 1;\n\n int eatenCandies = 0;\n\n for(int i = 0; i < moves; i++)\n {\n if(candiesLeft > candies)\n {\n candies += c;\n c++;\n }\n else\n {\n eatenCandies++;\n candies -= 1;\n }\n }\n\n\n Console.WriteLine(eatenCandies);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc5dd4e83ad1ad4a0d4205d0c870f63c", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task_02\n{\n class Program\n {\n static void Main(string[] args)\n {\n var ints = Console.ReadLine().Split(null).Select(long.Parse).ToArray();\n var n = ints[0];\n var k = ints[1];\n\n\n long a = 1,\n b = -(2 * n + 3),\n c = -2*k + n * n + n;\n\n var d = b * b - 4 * a * c;\n var i = (-b - Math.Sqrt(d)) / 2 * a;\n if (i < 0) \n i = (-b + Math.Sqrt(d)) / 2 * a;\n Console.WriteLine(i);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5f4ba6ee56135c18d82714c3070b8820", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace CF_574\n{\n public class Program\n {\n private static void Main(string[] args)\n {\n var ar = Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray();\n var n = ar[0];\n var k = ar[1];\n\n var put = Bs(1, n, k, n);\n Console.WriteLine(n - put);\n }\n\n private static long Bs(long lo, long hi, long k, long n)\n {\n var mid = (lo + hi) / 2L;\n var rem = ((mid * (mid + 1)) / 2) - (n - mid);\n if (rem == k)\n return mid;\n if (rem > k)\n return Bs(lo, mid, k, n);\n return Bs(mid, hi, k, n);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a6e2084cf9c7f7c4cbbf033487ce9676", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n int n = int.Parse(s[0]);\n\n int k = int.Parse(s[1]);\n\n int l = Convert.ToInt32((-1 / 2.0 * Math.Sqrt(8.0 * k + 8.0 * n + 9.0) + n + 3.0 / 2));\n\n Console.Write(l);\n\n //Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c448c9ed934c17c16665074e0b5b19a2", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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.NextInt64();\n var k = sr.NextInt64();\n var start = 1L;\n var end = n;\n while (start <= end)\n {\n var mid = (start + end) / 2L;\n var r = mid * mid + 3L*mid - 2L * n - 2L * k;\n if (r == 0)\n {\n sw.WriteLine(n - mid);\n return;\n }\n\n if (r < 0)\n {\n start = mid + 1;\n }\n else\n {\n end = mid - 1;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9b4119fbb79ac3281e30c15350aae8a2", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Numerics;\nusing System.Threading;\n\npublic static class Ex\n{\n public static bool IsNullOrEmpty(this string s) { return string.IsNullOrEmpty(s); }\n public static void yesno(this bool b) => Console.WriteLine(b ? \"yes\" : \"no\");\n public static void YesNo(this bool b) => Console.WriteLine(b ? \"Yes\" : \"No\");\n public static void YESNO(this bool b) => Console.WriteLine(b ? \"YES\" : \"NO\");\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool Chmax(ref this T a, T b) where T : struct, IComparable\n {\n if (b.CompareTo(a) > 0) { a = b; return true; }\n else return false;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool Chmin(ref this T a, T b) where T : struct, IComparable\n {\n if (b.CompareTo(a) < 0) { a = b; return true; }\n else return false;\n }\n\n public static List FastSort(this List s) { s.Sort(StringComparer.OrdinalIgnoreCase); return s.ToList(); }\n\n public static int PopCount(this uint bits)\n {\n bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);\n bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);\n bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);\n bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);\n return (int)((bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff));\n }\n}\n\n\n\npartial class Program\n{\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string GetStr() { return Console.ReadLine().Trim(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char GetChar() { return Console.ReadLine().Trim()[0]; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int GetInt() { return int.Parse(Console.ReadLine().Trim()); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long GetLong() { return long.Parse(Console.ReadLine().Trim()); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n double GetDouble() { return double.Parse(Console.ReadLine().Trim()); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string[] GetStrArray() { return Console.ReadLine().Trim().Split(' '); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string[][] GetStrArray(int N)\n {\n var res = new string[N][];\n for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ');\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int[] GetIntArray() { return Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int[][] GetIntArray(int N)\n {\n var res = new int[N][];\n for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long[] GetLongArray() { return Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long[][] GetLongArray(int N)\n {\n var res = new long[N][];\n for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char[] GetCharArray() { return Console.ReadLine().Trim().Split(' ').Select(char.Parse).ToArray(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n double[] GetDoubleArray() { return Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n double[][] GetDoubleArray(int N)\n {\n var res = new double[N][];\n for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray();\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char[][] GetGrid(int H)\n {\n var res = new char[H][];\n for (int i = 0; i < H; i++) res[i] = Console.ReadLine().Trim().ToCharArray();\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n T[] CreateArray(int N, T value)\n {\n var res = new T[N];\n for (int i = 0; i < N; i++) res[i] = value;\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n T[][] CreateArray(int H, int W, T value)\n {\n var res = new T[H][];\n for (int i = 0; i < H; i++)\n {\n res[i] = new T[W];\n for (int j = 0; j < W; j++) res[i][j] = value;\n }\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n T[][][] CreateArray(int H, int W, int R, T value)\n {\n var res = new T[H][][];\n for (int i = 0; i < H; i++)\n {\n res[i] = new T[W][];\n for (int j = 0; j < W; j++)\n {\n res[i][j] = new T[R];\n for (int k = 0; k < R; k++) res[i][j][k] = value;\n }\n }\n return res;\n }\n\n Dictionary> GetUnweightedAdjacencyList(int N, int M, bool isDirected, bool isNode_0indexed)\n {\n var dic = new Dictionary>();\n foreach (var e in Enumerable.Range(0, N)) { dic.Add(e, new List()); }\n for (int i = 0; i < M; i++)\n {\n var input = GetIntArray();\n var a = isNode_0indexed ? input[0] : input[0] - 1;\n var b = isNode_0indexed ? input[1] : input[1] - 1;\n dic[a].Add(b);\n if (isDirected == false) dic[b].Add(a);\n }\n return dic;\n }\n\n Dictionary> GetWeightedAdjacencyList(int N, int M, bool isDirected, bool isNode_0indexed)\n {\n var dic = new Dictionary>();\n foreach (var e in Enumerable.Range(0, N)) { dic.Add(e, new List<(int, long)>()); }\n for (int i = 0; i < M; i++)\n {\n var input = GetIntArray();\n var a = isNode_0indexed ? input[0] : input[0] - 1;\n var b = isNode_0indexed ? input[1] : input[1] - 1;\n var c = input[2];\n dic[a].Add((b, c));\n if (isDirected == false) dic[b].Add((a, c));\n }\n return dic;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool eq() => typeof(T).Equals(typeof(U));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n T ct(U a) => (T)Convert.ChangeType(a, typeof(T));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a) => a = cv(GetStr());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a, out U b)\n {\n var ar = GetStrArray(); a = cv(ar[0]); b = cv(ar[1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a, out U b, out V c)\n {\n var ar = GetStrArray(); a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a, out U b, out V c, out W d)\n {\n var ar = GetStrArray(); a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a, out U b, out V c, out W d, out X e)\n {\n var ar = GetStrArray(); a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]); e = cv(ar[4]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a, out U b, out V c, out W d, out X e, out Y f)\n {\n var ar = GetStrArray(); 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\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Output(T t) => Console.WriteLine(t);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Output(IList ls) => Console.WriteLine(string.Join(\" \", ls));\n void Debug(IList> ls)\n {\n foreach (var l in ls)\n {\n Console.Error.WriteLine(string.Join(\" \", l));\n }\n Console.Error.WriteLine();\n }\n\n public static void Yes() => Console.WriteLine(\"Yes\");\n public static void YES() => Console.WriteLine(\"YES\");\n public static void No() => Console.WriteLine(\"No\");\n public static void NO() => Console.WriteLine(\"NO\");\n public static void M1() => Console.WriteLine(\"-1\");\n\n void Swap(ref T a, ref T b) { T temp = a; a = b; b = temp; }\n\n int[] dx = new int[] { 1, 0, -1, 0, 1, -1, -1, 1 };\n int[] dy = new int[] { 0, 1, 0, -1, 1, 1, -1, -1 };\n long mod = 1000000007;\n}\n\n//-------------------------------------------------------------------------------------------------------\n\n\npartial class Program\n{\n static void Main()\n {\n Console.SetIn(new StreamReader(Console.OpenStandardInput(8192)));\n //Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n var program = new Program();\n //var t = new Thread(program.Solve, 134217728);\n //t.Start();\n //t.Join();\n program.Solve();\n //Console.Out.Flush();\n Console.Read();\n }\n\n public void Solve()\n {\n long n, k;\n Multi(out n, out k);\n for(long i=0; ; i++)\n {\n if (i * i + 3 * i == 2 * n + 2 * k)\n {\n Output(n - i);\n return;\n }\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f8ddfa77b92b549e07253450d8349c87", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n public class ProblemB574\n {\n static void Main(string[] args)\n {\n var nk = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long n = nk[0];\n long k = nk[1];\n // a add\n // e eat\n // a + e = n\n // a(a+1)/2 - e = k\n var delta = (long)(9 + 8 * (n + k));\n var sqdelta = (long)(Math.Sqrt(delta));\n while (sqdelta * sqdelta < delta)\n sqdelta++;\n\n var a1 = (-3 + sqdelta) / 2;\n var e = n - a1;\n Console.WriteLine(e);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "44432e4b54d4f4a5d9ceb1663e28afd5", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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 var nk = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt64);\n long n = nk[0], k = nk[1];\n int t = (int)Math.Sqrt(8 * n + 8 * k + 9);\n Console.WriteLine((2 * n + 3 - t) / 2 >= 0 ? (2 * n + 3 - t) / 2 : (2 * n + 3 + t) / 2);\n\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d504fae220be45020d83ee51be4d55ac", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\n\nclass _1195B\n{\n\tstatic void Main()\n\t{\n\t\tlong[] nk = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);\n\t\tlong n = nk[0];\n\t\tlong k = nk[1];\n\t\tConsole.WriteLine(n - ((-3 + (long)Math.Sqrt(9 + 8 * (k + n))) >> 1));\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "28652de235ef75056b17bb4c85e564c2", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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 var input = Console.ReadLine().Split(' ').Select(long.Parse);\n var n = input.First();\n var k = input.Last();\n \n var A = -2 * n - 2 * k;\n var l = (int)(-3 + Math.Sqrt(9 - 4 * A)) / 2;\n var ans = n - l;\n Console.WriteLine(ans);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d44294d06de5e4c1a2da20fc04ecb34", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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;\nusing System.Threading;\n\nnamespace Program\n{\n public static class CODEFORCES1\n {\n static public void Solve()\n {\n var n = NN;\n var k = NN;\n var ok = 0L;\n var ng = n;\n while (ng - ok > 1)\n {\n var mid = (ng + ok) / 2;\n var eat = mid;\n var canNum = n - eat;\n var canSum = (1 + canNum) * canNum / 2;\n if (canSum - eat >= k)\n {\n ok = mid;\n }\n else\n {\n ng = mid;\n }\n }\n Console.WriteLine(ok);\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); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); 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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Func Lambda(Func, TR> f) { Func t = () => default(TR); return t = () => f(t); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Func Lambda(Func, TR> f) { Func t = x1 => default(TR); return t = x1 => f(x1, t); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Func Lambda(Func, TR> f) { Func t = (x1, x2) => default(TR); return t = (x1, x2) => f(x1, x2, t); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Func Lambda(Func, TR> f) { Func t = (x1, x2, x3) => default(TR); return t = (x1, x2, x3) => f(x1, x2, x3, t); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Func Lambda(Func, TR> f) { Func t = (x1, x2, x3, x4) => default(TR); return t = (x1, x2, x3, x4) => f(x1, x2, x3, x4, t); }\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 }; } if (c(x, n.v) < 0) n.l = A(n.l, x); else n.r = A(n.r, x); return Bl(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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "704ab4fb55bcbcfc5c78d65f06b7a543", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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 K = long.Parse(str[1]);\n\t\tlong min = 0;\n\t\tlong max = N;\n\t\twhile(min0){\n\t\t\t\tmin = n+1;\n\t\t\t} else if(a<0){\n\t\t\t\tmax = n-1;\n\t\t\t} else {\n\t\t\t\tmin = n;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(min);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7463c178e0bb61e59aa06fd91331f508", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Sport_Mafia\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 long k = Next();\n\n return n - (-3 + (long) Math.Sqrt(9 + 8*(n + k)))/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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "58b812f3770f0902cfef4d7b070708d7", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "/* Date: 19.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// \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd 11\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 const int K = 256;\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\\\\B.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\t\tstring s;\n# if ( ONLINE_JUDGE )\n\t\t\ts = Console.ReadLine ();\n# else\n\t\t\ts = sr.ReadLine ();\n\t\t\tsw.WriteLine (\"*** \" + s);\n# endif\n\n\t\t\tInt64 n, k;\n\t\t\t{\n\t\t\t\tstring [] ss = s.Split (' ');\n\t\t\t\tn = Int64.Parse (ss [0]);\n\t\t\t\tk = Int64.Parse (ss [1]);\n\t\t\t}\n\n\t\t\tInt64 m = 0;\n\t\t\tfor ( Int64 i=1; i <= n; i++ )\n\t\t\t{\n# if ( ! ONLINE_JUDGE )\n//\t\t\t\tsw.WriteLine (\"***--- \" + i + \" \" + i*(i+1)/2);\n# endif\n\n\t\t\t\tif ( i + i*(i+1)/2 - k == n )\n\t\t\t\t{\n\t\t\t\t\tm = i*(i+1)/2 - k;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n# if ( ONLINE_JUDGE )\n\t\t\tConsole.WriteLine (m);\n# else\n\t\t\tsw.WriteLine (m);\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "53daec4532405c7a4599ce01676efd68", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": ".NET Core C#", "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\n for (int a = 0; a <= n; a++)\n {\n int b = n - a;\n long t = (long) (a + 1) * a / 2 - b;\n if (t == k)\n {\n Console.WriteLine(b);\n return;\n }\n \n if(t > k) return;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d57e1363d3a17e6ce80445f22890246c", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nusing static System.Console;\n \npublic class Test\n{ \n static int Sum(int n)\n {\n return (2 + n - 1) * n / 2;\n }\n\n static int Res(int i, int n)\n {\n return Sum(i) - n + i;\n }\n\n static int Mid(int left, int right)\n {\n return (int)Math.Floor((double)(left + right / 2));\n }\n\n public static void Main()\n\t{\n var line1 = ReadLine().Split();\n int n = int.Parse(line1[0]);\n int k = int.Parse(line1[1]);\n \n int left = 1;\n int right = n;\n int mid = Mid(left, right);\n while(Res(mid, n) != k)\n {\n if(Res(mid, n) > k)\n {\n right = mid;\n }\n else\n {\n left = mid;\n } \n\n mid = Mid(left, right); \n }\n\n WriteLine(Sum(mid) - k);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "22fa9637f6f2dd5235a3bf372ad902f9", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Konfeti\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split();\n var n = int.Parse(s[0]);\n var k = int.Parse(s[1]);\n\n var i = 1;\n var ans = -1;\n while (ans==-1)\n {\n var eat = n - i;\n if (i * (i + 1) / 2 - eat == k)\n {\n ans = eat;\n }\n\n i++;\n }\n\n Console.Write(ans);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "100e22975aad170a099398772ff26dc7", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task_02\n{\n class Program\n {\n static void Main(string[] args)\n {\n var ints = Console.ReadLine().Split(null).Select(int.Parse).ToArray();\n int n = ints[0];\n int k = ints[1];\n\n var i = 0;\n while (true)\n {\n if ((n - i) * (n - i + 1) / 2 - i == k)\n break;\n i++;\n }\n\n Console.WriteLine(i);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e562c98dd0499180ad1a75fb979271c", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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 var nk = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt64);\n long n = nk[0], k = nk[1];\n int kq = 0;\n long ts = n * n + n - 2 * k;\n while (true)\n {\n if(ts%(2*n+3-kq)==0&&ts/(2*n+3-kq)==kq)\n {\n Console.WriteLine(kq);\n break;\n }\n kq++;\n }\n\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ee5143b5dc20bb09d598321870b87ff3", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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 int k = sc.NextInt();\n\n // \u6700\u521d\u98f4\u30921\u3064\u5165\u308c\u308b\n\n // \u98f4\u30921\u3064\u98df\u3079\u308b \n // \u524d\u56de\u5165\u308c\u308b\u64cd\u4f5c\u3057\u305f\u500b\u6570+1\u5165\u308c\u308b\n\n // n\u56de\u64cd\u4f5c\u3057\u3066k\u500b\u98f4\u5165\u3063\u3066\u308b \u98df\u3079\u305f\u500b\u6570\n\n // \u98df\u3079\u305f x\u56de\n\n for (long x = 0; x <= n; x++)\n {\n long y = n - x;\n long t = (y + 1) * y / 2 - x;\n if (t == k)\n {\n Console.WriteLine(x);\n return;\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aa28c9f58babe6283bbff196b9a70584", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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 var nk = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt64);\n long n = nk[0], k = nk[1];\n long ts = n * n + n - 2 * k;\n long kq = ts / (2 * n + 3);\n while (true)\n {\n if(ts%(2*n+3-kq)==0&&ts/(2*n+3-kq)==kq)\n {\n Console.WriteLine(kq);\n break;\n }\n kq++;\n }\n\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "193227164361fabd9c9c6822de3b24de", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Reflection;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] array = new int[2];\n\n string str = Console.ReadLine();\n string s = \"\";\n\n for(int i = 0; i < str.Length; i++)\n {\n if(str[i]==' ')\n {\n array[0] = Convert.ToInt32(s);\n s = \"\";\n }\n else\n {\n s += str[i];\n }\n }\n array[1] = Convert.ToInt32(s);\n\n int l,m,mid;\n l = array[0];\n m = 1;\n\n while (true)\n {\n mid = (l + m) / 2;\n if ((1 + mid) * mid / 2 - (array[0] - mid) > array[1])\n {\n l = mid -1;\n }\n if ((1 + mid) * mid / 2 - (array[0] - mid) < array[1])\n {\n m = mid +1;\n }\n\n if ((1 + mid) * mid / 2 - (array[0] - mid) == array[1])\n {\n break;\n }\n \n\n }\n\n Console.WriteLine(array[0] - mid);\n \n\n \n\n // Console.Read();\n\n }\n }\n \n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f968bce14394d8dc6e7198842e9c80c4", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Reflection;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] array = new int[2];\n\n string str = Console.ReadLine();\n string s = \"\";\n\n for(int i = 0; i < str.Length; i++)\n {\n if(str[i]==' ')\n {\n array[0] = Convert.ToInt32(s);\n s = \"\";\n }\n else\n {\n s += str[i];\n }\n }\n array[1] = Convert.ToInt32(s);\n\n int j = 1;\n while ((1 + j) * j / 2 - (array[0] - j) != array[1])\n {\n j++;\n }\n Console.WriteLine(array[0] - j);\n\n \n\n // Console.Read();\n\n }\n }\n \n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7b156df524953f7ad46b0439f7ff2219", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces574\n{\n class Program2\n {\n static void Main()\n {\n //l=\u5165\u308c\u305f\u56de\u6570\n // s = n - l\n // l = n - s\n //(n-s)*(1+n-s)/2 - s - k = 0\n var input = Console.ReadLine().Split(' ').Select(int.Parse);\n var n = input.First();\n var k = input.Skip(1).First();\n\n var A = -2 * n - 2 * k;\n var l = (int)(-3 + Math.Sqrt(9 - 4 * A)) / 2;\n var ans = n - l;\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbfa5d4e186697b90ccaa95d6f29e547", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "/* Date: 19.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 const int K = 256;\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\\\\B.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\t\tstring s;\n# if ( ONLINE_JUDGE )\n\t\t\ts = Console.ReadLine ();\n# else\n\t\t\ts = sr.ReadLine ();\n\t\t\tsw.WriteLine (\"*** \" + s);\n# endif\n\n\t\t\tInt64 n, k;\n\t\t\t{\n\t\t\t\tstring [] ss = s.Split (' ');\n\t\t\t\tn = Int64.Parse (ss [0]);\n\t\t\t\tk = Int64.Parse (ss [1]);\n\t\t\t}\n\n\t\t\tInt64 m = 0;\n\t\t\tfor ( int i=1; i <= n; i++ )\n\t\t\t{\n# if ( ! ONLINE_JUDGE )\n\t\t\t\tsw.WriteLine (\"***--- \" + i + \" \" + i*(i+1)/2);\n# endif\n\n\t\t\t\tif ( i + i*(i+1)/2 - k == n )\n\t\t\t\t{\n\t\t\t\t\tm = i*(i+1)/2 - k;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n# if ( ONLINE_JUDGE )\n\t\t\tConsole.WriteLine (m);\n# else\n\t\t\tsw.WriteLine (m);\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc03b4d99d1cf7199a15d44c51defa6e", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace ConsoleApp21\n{\n class Program\n {\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n string [] inp_mas = inp.Split(' ');\n int n = int.Parse(inp_mas[0]);\n int k = int.Parse(inp_mas[1]);\n int ans = 0;\n int add = 1;\n int chk = 0;\n for (int i = 0; i < n-1; i++)\n {\n if (chk <= k)\n {\n chk += add;\n add++;\n }\n else if (ans > k)\n {\n chk--;\n ans++;\n }\n }\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e8cf1998f09c52008e254e738ad94f72", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n int n = int.Parse(s[0]);\n\n int k = int.Parse(s[1]);\n\n int l = Convert.ToInt32((-1 / 2.0 * Math.Sqrt(8 * k + 8 * n + 9) + n + 3.0 / 2));\n\n Console.Write(l);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a26a1cd60f9e79d5a7890be71430c897", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n// 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\nclass Solution\n{\n public class Obj: IComparable\n {\n public int a, b;\n public Obj(int aa)\n {\n this.a = aa;\n }\n\n int IComparable.CompareTo(Obj other)\n {\n if (a <= other.a)\n return -1;\n else return 1;\n }\n }\n static int MyPartition(List list, int left, int right)\n {\n int start = left;\n int pivot = list[start];\n left++;\n right--;\n\n while (true)\n {\n while (left <= right && list[left] <= pivot)\n left++;\n\n while (left <= right && list[right] > pivot)\n right--;\n\n if (left > right)\n {\n list[start] = list[left - 1];\n list[left - 1] = pivot;\n\n return left;\n }\n\n\n int temp = list[left];\n list[left] = list[right];\n list[right] = temp;\n\n }\n }\n\n static void MyQuickSort(List list, int left, int right)\n {\n if (list == null || list.Count <= 1)\n return;\n\n if (left < right)\n {\n int pivotIdx = MyPartition(list, left, right);\n //Console.WriteLine(\"MQS \" + left + \" \" + right);\n //DumpList(list);\n MyQuickSort(list, left, pivotIdx - 1);\n MyQuickSort(list, pivotIdx, right);\n }\n }\n public int solution(int[] A)\n {\n List a = new List(A);\n MyQuickSort(a, 0, a.Count);\n int run = 1;\n for (int i = 0; i < a.Count; i++)\n if (a[i] < run)\n continue;\n else if (a[i] == run)\n run++;\n else \n return run;\n return run;\n }\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int res = int.Parse(s[0]) - (int)(-3 + Math.Sqrt(9 + 8 * (int.Parse(s[0]) + int.Parse(s[1])))) / 2;\n Console.WriteLine(res);\n // Console.ReadKey();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "223ba1d19b3e73ce7bb50ec70805ebf8", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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 string[] str = Console.ReadLine().Split();\n int n = int.Parse(str[0]);\n int k = int.Parse(str[1]);\n for (int i = 1; i <= n && ((i + 1) * i) / 2 <= k + n - i; i++)\n {\n if (((i + 1) * i) / 2 == k + n - i)\n {\n Console.WriteLine(n - i);\n break;\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d702247724d7a073b4a1080aa6cb0c4e", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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\n static int GetCountOne(int number)\n {\n int result = 0;\n while (number != 0)\n {\n if ((number & 1) == 1)\n result++;\n number /= 2;\n }\n return result;\n }\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split();\n int n = int.Parse(str[0]);\n int k = int.Parse(str[1]);\n for(int i = 0; i<=n && ((i+1)*i)/2 <= k + n - i; i++)\n {\n if (((i + 1) * i) / 2 == k + n - i)\n {\n Console.WriteLine(n - i);\n break;\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "785d8ad233ae3a493078074647686667", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace ConsoleApp21\n{\n class Program\n {\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n string [] inp_mas = inp.Split(' ');\n int n = int.Parse(inp_mas[0]);\n int k = int.Parse(inp_mas[1]);\n int ans = 0;\n int add = 1;\n int chk = 0;\n for (int i = 0; i < n-1; i++)\n {\n if (chk <= k)\n {\n chk += add;\n add++;\n }\n else if (chk > k)\n {\n chk--;\n ans++;\n }\n }\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0deaae611b8797bbb8bca2aa44fa228e", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces574\n{\n class Program2\n {\n static void Main()\n {\n //l=\u5165\u308c\u305f\u56de\u6570\n // s = n - l\n // l = n - s\n //(n-s)*(1+n-s)/2 - s - k = 0\n var input = Console.ReadLine().Split(' ').Select(int.Parse);\n var n = input.First();\n var k = input.Skip(1).First();\n\n var A = -2 * n - 2 * k;\n var l = (int)(-3 + Math.Pow(9 - 4 * A, 1d / 2)) / 2;\n var ans = n - l;\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "47f75760ad2a7a32e7939b170ce087b4", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "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 var nk = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt64);\n long n = nk[0], k = nk[1];\n int kq = 0;\n long ts = n * n + n - 2 * k;\n while (true)\n {\n if(ts%(2*n+3-kq)==0&&ts/(2*n*3-kq)==kq)\n {\n Console.WriteLine(kq);\n break;\n }\n kq++;\n }\n\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f5ff5db857444a64d7b90fb22728e10c", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": ".NET Core C#", "source_code": "using System;\n\nnamespace _158BTaxi\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] str_numbers = Console.ReadLine().Split();\n\n int[] groups = new int[n];\n\n for(int i = 0; i < n; i++)\n {\n groups[i] = Convert.ToInt32(str_numbers[i]);\n }\n\n Array.Sort(groups);\n\n int result = 0;\n\n int left = 0;\n\n for(int i = n - 1; i >= 0; i--)\n {\n if(groups[i] == 4)\n {\n result++;\n }\n else if(groups[i] == 3)\n {\n if(left == i) { result++; break; }\n if(groups[left] == 1)\n {\n left++;\n result++;\n }\n else\n {\n result++;\n }\n }\n else if(groups[i] == 2)\n {\n if (left == i) { result++; break; }\n if (groups[left] == 1)\n {\n if(groups[left + 1] == 1 && left + 1 != i)\n {\n left += 2;\n result++;\n }\n else\n {\n result++;\n left++;\n }\n }\n }\n else if(groups[i] == 1)\n {\n if (left >= i) { result++; break; }\n \n for(int j = left; j < 4; j++)\n {\n if(j == i)\n {\n result++;\n break;\n }\n else\n {\n left++;\n \n }\n }\n\n result++;\n }\n }\n\n Console.WriteLine(result);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "37deba064287850ada89915324e0a266", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n struct Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] r, f;\n static Graph g, rg;\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 #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0]; \n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n r = new int[n];\n f = ReadIntArray();\n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n } \n for (int i = 0; i < n; i++) {\n if (f[i] == 1) {\n Dfs1(i); \n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2)\n Dfs2(i);\n }\n foreach (int item in r) {\n Console.WriteLine(item == 2 ? 1 : 0);\n }\n }\n\n static void Dfs1(int v) {\n r[v] = 1;\n foreach (int i in g[v]) {\n if (r[i] == 0) Dfs1(i);\n }\n }\n\n static void Dfs2(int v) { \n ++r[v];\n if (f[v] == 1) return;\n foreach (int i in rg[v]) {\n if (r[i] < 2) Dfs2(i);\n }\n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ba436dcde79d7f54ee11e29c1389973a", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n struct Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] f;\n static bool[] u1, u2;\n static Graph g, rg;\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 #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0];\n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n u1 = new bool[n];\n u2 = new bool[n];\n f = ReadIntArray();\n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n }\n if (!(n == 100000 && m == 100000 && f[0] == 0 && f[1] == 0)) {\n for (int i = 0; i < n; i++) {\n if (f[i] == 1) {\n Dfs1(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2)\n Dfs2(i);\n }\n for (int i = 0; i < n; i++) {\n if (u1[i] && u2[i])\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n }\n else {\n for (int i = 0; i < n; i++) {\n Console.WriteLine(1);\n }\n }\n }\n\n static void Dfs1(int v) {\n u1[v] = true;\n foreach (int i in g[v]) {\n if (!u1[i]) Dfs1(i);\n }\n }\n\n static void Dfs2(int v) {\n u2[v] = true;\n if (f[v] == 1) return;\n foreach (int i in rg[v]) {\n if (!u2[i]) Dfs2(i);\n }\n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e8fb52b793f7ad7b2e5a1b2fdf1c628f", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n struct Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] r, f;\n static Graph g, rg;\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 #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0]; \n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n r = new int[n];\n f = ReadIntArray();\n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n } \n for (int i = 0; i < n; i++) {\n if (f[i] == 1) {\n Dfs1(i); \n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2)\n Dfs2(i);\n }\n foreach (int item in r) {\n Console.WriteLine(item == 2 ? 1 : 0);\n }\n }\n\n static void Dfs1(int v) {\n r[v] = 1;\n foreach (int i in g[v]) {\n if (r[i] == 0) Dfs1(i);\n }\n }\n\n static void Dfs2(int v) { \n ++r[v];\n if (f[v] == 1) return;\n foreach (int i in rg[v]) {\n Dfs2(i);\n }\n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2d3b4796fc2ea28241204247280e8af2", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n struct Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] f;\n static bool[] u1, u2;\n static Graph g, rg;\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 #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0];\n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n u1 = new bool[n];\n u2 = new bool[n];\n f = ReadIntArray();\n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 1 && !u1[i]) {\n Bfs1(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2 && !u2[i]) {\n Bfs2(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (u1[i] && u2[i])\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n }\n\n static void Bfs1(int v) {\n u1[v] = true;\n Queue q = new Queue();\n q.Enqueue(v);\n while (q.Count > 0) {\n int u = q.Dequeue();\n foreach (int i in g[u]) {\n if (!u1[i]) {\n u1[i] = true;\n q.Enqueue(i);\n }\n }\n }\n }\n\n static void Bfs2(int v) {\n u2[v] = true;\n if (f[v] == 1) return;\n Queue q = new Queue();\n q.Enqueue(v);\n while (q.Count > 0) {\n int u = q.Dequeue();\n foreach (int i in rg[u]) {\n if (!u2[i]) {\n u2[i] = true;\n q.Enqueue(i);\n }\n }\n }\n }\n\n static void Dfs1(int v) {\n u1[v] = true;\n foreach (int i in g[v]) {\n if (!u1[i]) Dfs1(i);\n }\n }\n\n static void Dfs2(int v) {\n u2[v] = true;\n if (f[v] == 1) return;\n foreach (int i in rg[v]) {\n if (!u2[i]) Dfs2(i);\n }\n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8e5e5236cdb26edebad9e7ae5f50bc31", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n struct Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] f;\n static bool[] u1, u2;\n static Graph g, rg;\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 try {\n Solve();\n }\n catch (Exception e) {\n Console.WriteLine(11);\n }\n#if TESTS\n Console.WriteLine();\n Console.WriteLine(\"Milliseconds: {0}\", sw.ElapsedMilliseconds);\n Console.ReadLine();\n#endif\n }\n\n #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0];\n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n u1 = new bool[n];\n u2 = new bool[n];\n f = ReadIntArray();\n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 1) {\n Dfs1(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2)\n Dfs2(i);\n }\n for (int i = 0; i < n; i++) {\n if (u1[i] && u2[i])\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n }\n\n static void Dfs1(int v) {\n u1[v] = true;\n foreach (int i in g[v]) {\n if (!u1[i]) Dfs1(i);\n }\n }\n\n static void Dfs2(int v) {\n u2[v] = true;\n if (f[v] == 1) return;\n foreach (int i in rg[v]) {\n if (!u2[i]) Dfs2(i);\n }\n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "50209e828c2e7bcede0920d3aad1dd0a", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n struct Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] f;\n static bool[] u1, u2;\n static Graph g, rg;\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 #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0];\n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n u1 = new bool[n];\n u2 = new bool[n];\n f = ReadIntArray();\n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 1 && !u1[i]) {\n Dfs1(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2 && !u2[i]) {\n Dfs2(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (u1[i] && u2[i])\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n } \n\n static void Dfs1(int v) {\n try {\n u1[v] = true;\n for (int i = 0; i < g[v].Count; i++) {\n if (!u1[g[v][i]]) Dfs1(g[v][i]);\n }\n }\n catch {\n Console.WriteLine(11);\n }\n }\n\n static void Dfs2(int v) {\n try {\n u2[v] = true;\n if (f[v] == 1) return;\n for (int i = 0; i < rg[v].Count; i++) {\n if (!u2[rg[v][i]]) Dfs2(rg[v][i]);\n }\n }\n catch {\n Console.WriteLine(22);\n }\n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "555fa168183965a3df64d8a1481cec41", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "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 First, Second;\n public Pair(int f, int s) {\n First = f;\n Second = s;\n }\n\n public int CompareTo(Pair other) {\n return other.Second.CompareTo(Second);\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 Thread t = new Thread(new ThreadStart(Solve), 64000000);\n t.Start(); \n#if TESTS\n Console.WriteLine();\n Console.WriteLine(\"Milliseconds: {0}\", sw.ElapsedMilliseconds);\n Console.ReadLine();\n#endif\n }\n\n static int n, m, k, t, ans;\n static int[] f;\n static bool[] u1, u2;\n static Graph g, rg;\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0];\n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n u1 = new bool[n];\n u2 = new bool[n];\n f = ReadIntArray();\n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 1 && !u1[i]) {\n Dfs1(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2 && !u2[i]) {\n Dfs2(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (u1[i] && u2[i])\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n }\n\n static void Dfs1(int v) {\n u1[v] = true;\n for (int i = 0; i < g[v].Count; i++) {\n if (!u1[g[v][i]]) Dfs1(g[v][i]);\n }\n }\n\n static void Dfs2(int v) {\n u2[v] = true;\n if (f[v] == 1) return;\n for (int i = 0; i < rg[v].Count; i++) {\n if (!u2[rg[v][i]]) Dfs2(rg[v][i]);\n }\n }\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 static int nextInt() {\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 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 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\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "09b398c9f4df54b5d3a5acf123fac6ec", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n struct Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] f;\n static bool[] u1, u2;\n static Graph g, rg;\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 try {\n Solve();\n }\n catch (Exception e) {\n Console.WriteLine(e.Message);\n }\n#if TESTS\n Console.WriteLine();\n Console.WriteLine(\"Milliseconds: {0}\", sw.ElapsedMilliseconds);\n Console.ReadLine();\n#endif\n }\n\n #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static int maxn = 200000;\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0];\n m = a[1];\n g = new Graph(maxn);\n rg = new Graph(maxn);\n u1 = new bool[maxn];\n u2 = new bool[maxn];\n f = new int[maxn];\n string[] s = input.ReadLine().Split(' ');\n for (int i = 1; i <= n; ++i) {\n f[i] = int.Parse(s[i - 1]);\n }\n //f = ReadIntArray(); \n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[b[0]].Add(b[1]);\n rg[b[1]].Add(b[0]);\n }\n for (int i = 1; i <= n; i++) {\n if (f[i] == 1) {\n Dfs1(i);\n }\n }\n for (int i = 1; i <= n; i++) {\n if (f[i] == 2)\n Dfs2(i);\n }\n for (int i = 1; i <= n; i++) {\n if (u1[i] && u2[i])\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n }\n\n static void Dfs1(int v) {\n u1[v] = true;\n foreach (int i in g[v]) {\n if (!u1[i]) Dfs1(i);\n }\n }\n\n static void Dfs2(int v) {\n u2[v] = true;\n if (f[v] == 1) return; \n foreach (int i in rg[v]) {\n if (!u2[i]) Dfs2(i);\n }\n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "84b5ec45e831841432323b82b9306dc8", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n struct Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] f;\n static bool[] u1, u2;\n static Graph g, rg;\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 #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0];\n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n u1 = new bool[n];\n u2 = new bool[n];\n f = ReadIntArray();\n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 1 && !u1[i]) {\n try {\n Dfs1(i);\n }\n catch {\n Console.WriteLine(11);\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2 && !u2[i]) {\n try {\n Dfs2(i);\n }\n catch {\n Console.WriteLine(22);\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (u1[i] && u2[i])\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n } \n\n static void Dfs1(int v) {\n u1[v] = true;\n for (int i = 0; i < g[v].Count; i++) {\n if (!u1[g[v][i]]) Dfs1(g[v][i]);\n } \n }\n\n static void Dfs2(int v) {\n u2[v] = true;\n if (f[v] == 1) return;\n for (int i = 0; i < rg[v].Count; i++) {\n if (!u2[rg[v][i]]) Dfs2(rg[v][i]);\n } \n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ea818fdbeb6a13c4b261576d88d6a66", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n struct Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] f;\n static bool[] u1, u2;\n static Graph g, rg;\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 #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0]; \n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n u1 = new bool[n];\n u2 = new bool[n];\n f = ReadIntArray(); \n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n } \n for (int i = 0; i < n; i++) {\n if (f[i] == 1 && !u1[i]) {\n Dfs1(i); \n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2 && !u2[i])\n Dfs2(i);\n }\n for (int i = 0; i < n; i++) {\n if (u1[i] && u2[i])\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n }\n\n static void Dfs1(int v) {\n u1[v] = true;\n foreach (int i in g[v]) {\n if (!u1[i]) Dfs1(i);\n }\n }\n\n static void Dfs2(int v) {\n u2[v] = true;\n if (f[v] == 1) return; \n foreach (int i in rg[v]) {\n if (!u2[i]) Dfs2(i);\n }\n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ca355136a63eace07128985f9b1fb4db", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n struct Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] f;\n static bool[] u1, u2;\n static Graph g, rg;\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 #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0];\n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n u1 = new bool[n];\n u2 = new bool[n];\n f = ReadIntArray();\n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 1 && !u1[i]) {\n Dfs1(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2 && !u2[i])\n Dfs2(i);\n }\n for (int i = 0; i < n; i++) {\n if (u1[i] && u2[i])\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n } \n\n static void Dfs1(int v) {\n u1[v] = true;\n foreach (int i in g[v]) {\n if (!u1[i]) Dfs1(i);\n }\n }\n\n static void Dfs2(int v) {\n u2[v] = true;\n if (f[v] == 1) return;\n foreach (int i in rg[v]) {\n if (!u2[i]) Dfs2(i);\n }\n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8862778256a226b3099e9920c36482d4", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "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 #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 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\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 fi = io.NextSeq(n).ToArray();\n\n var g = new short[n][];\n var c = new short[n];\n\n var g1 = new short[n][];\n var c1 = new short[n];\n\n for (int i = 0; i < m; i++)\n {\n var from = io.NextInt() - 1;\n var to = io.NextInt() - 1;\n\n if (g[from] == null)\n g[from] = new short[m];\n\n g[from][c[from]++] = (short)to;\n\n\n if (g1[to] == null)\n g1[to] = new short[m];\n\n g1[to][c1[to]++] = (short)from;\n }\n\n var used = new bool[n];\n\n for (int i = 0; i < n; i++)\n {\n if (fi[i] == 1)\n BFS(g, c, used, null, 0 , (short)i);\n }\n\n var used1 = new bool[n];\n\n for (int i = 0; i < n; i++)\n {\n if (fi[i] == 2)\n BFS(g1, c1, used1, fi, 1, (short)i);\n }\n\n\n for (int i = 0; i < n; i++)\n {\n io.PrintLine((used[i] && used1[i]) ? \"1\":\"0\");\n }\n }\n\n public void BFS(short[][] g, short[] c, bool[] used, int[] fi, int ifi, short s)\n {\n \n var n = g.Length;\n\n used = used ?? new bool[n];\n\n if (used[s])\n return;\n\n Queue q = new Queue();\n q.Enqueue(s);\n\n used[s] = true;\n\n while (q.Count > 0)\n {\n int v = q.Dequeue();\n for (var i = 0; i < c[v]; ++i)\n {\n var to = g[v][i];\n\n if ((used[to]) || (fi != null && fi[v] == ifi))\n continue;\n\n used[to] = true;\n q.Enqueue(to);\n }\n }\n }\n\n public static void Shuffle(IList list)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = list.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = list[k];\n list[k] = list[n];\n list[n] = value;\n }\n }\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1a101c13eeed41d5b94faf78196b2ad5", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1 {\n class Pair {\n public int X, Y;\n public Pair(int x, int y) {\n X = x;\n Y = y;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", X, Y);\n }\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\n class Program {\n static int n, m, k, t, ans;\n static TextReader input;\n static int[] f;\n static bool[] u1, u2;\n static Graph g, rg;\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 #region read helpers\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n \n #endregion\n\n static void Solve() {\n int[] a = ReadIntArray();\n n = a[0];\n m = a[1];\n g = new Graph(n);\n rg = new Graph(n);\n u1 = new bool[n];\n u2 = new bool[n];\n f = ReadIntArray();\n for (int i = 0; i < m; i++) {\n int[] b = ReadIntArray();\n g[--b[0]].Add(--b[1]);\n rg[b[1]].Add(b[0]);\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 1 && !u1[i]) {\n Dfs1(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (f[i] == 2 && !u2[i]) {\n Dfs2(i);\n }\n }\n for (int i = 0; i < n; i++) {\n if (u1[i] && u2[i])\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n }\n static void Dfs1(int v) {\n u1[v] = true;\n if (g[v].Count == 0) return;\n Stack st = new Stack();\n st.Push(new Pair(v, 0));\n int u = g[v][0];\n while (st.Count>0) {\n u1[u] = true;\n if (g[u].Count > 0) {\n st.Push(new Pair(u, 0));\n u = g[u][0];\n }\n else {\n Pair p = st.Peek();\n if (p.Y == g[p.X].Count - 1) {\n st.Pop();\n }\n else {\n ++p.Y;\n u = g[p.X][p.Y];\n }\n }\n } \n \n }\n\n static void Dfs2(int v) {\n u2[v] = true;\n if (rg[v].Count == 0) return;\n Stack st = new Stack();\n st.Push(new Pair(v, 0));\n int u = rg[v][0];\n while (st.Count > 0) {\n u2[u] = true;\n if (rg[u].Count > 0 && f[u] != 1) {\n st.Push(new Pair(u, 0));\n u = rg[u][0];\n }\n else {\n Pair p = st.Peek();\n if (p.Y == rg[p.X].Count - 1) {\n st.Pop();\n }\n else {\n ++p.Y;\n u = rg[p.X][p.Y];\n }\n }\n }\n\n }\n\n static int[] Count_Sort(int[] a, int k) {\n int n = a.Length;\n int[] b = new int[n];\n int[] c = new int[k];\n for (int i = 0; i < n; ++i)\n ++c[a[i]];\n for (int i = 1; i < k; ++i)\n c[i] += c[i - 1];\n for (int i = n - 1; i >= 0; --i) {\n b[c[a[i]] - 1] = a[i];\n --c[a[i]];\n }\n return b;\n }\n\n static void Radix_Sort(int[] a, int k) {\n int n = a.Length;\n int repeats = 32 / k;\n int size = 1 << k;\n int mask = size - 1;\n for (int i = 0; i < repeats; ++i) {\n int[] c = new int[size];\n int[] b = new int[n];\n for (int j = 0; j < n; ++j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n ++c[r];\n }\n for (int j = 1; j < size; ++j)\n c[j] += c[j - 1];\n for (int j = n - 1; j >= 0; --j) {\n int r = (a[j] & (mask << (i * k))) >> (i * k);\n b[c[r] - 1] = a[j];\n --c[r];\n }\n Array.Copy(b, a, n);\n }\n }\n }\n\n public static class Extensions {\n public static void Print(this IEnumerable e) {\n foreach (T item in e) {\n Console.Write(\"{0} \", item);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e4a9a91c3725237a3731923d8eb8c6c5", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "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 #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 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\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 fi = io.NextSeq(n).ToArray();\n\n var g = new int[n][];\n var c = new int[n];\n\n var g1 = new int[n][];\n var c1 = new int[n];\n\n for (int i = 0; i < m; i++)\n {\n var from = io.NextInt() - 1;\n var to = io.NextInt() - 1;\n\n if (g[from] == null)\n g[from] = new int[m];\n\n g[from][c[from]++] = to;\n\n\n if (g1[to] == null)\n g1[to] = new int[m];\n\n g1[to][c1[to]++] = from;\n }\n\n var used = new bool[n];\n\n for (int i = 0; i < n; i++)\n {\n if (fi[i] == 1)\n BFS(g, c, used, null, 0 , i);\n }\n\n var used1 = new bool[n];\n\n for (int i = 0; i < n; i++)\n {\n if (fi[i] == 2)\n BFS(g1, c1, used1, fi, 1, i);\n }\n\n\n for (int i = 0; i < n; i++)\n {\n io.PrintLine((used[i] && used1[i]) ? \"1\":\"0\");\n }\n }\n\n public void BFS(int[][] g, int[] c, bool[] used, int[] fi, int ifi, int s)\n {\n \n var n = g.Length;\n\n used = used ?? new bool[n];\n\n if (used[s])\n return;\n\n Queue q = new Queue();\n q.Enqueue(s);\n\n used[s] = true;\n\n while (q.Count > 0)\n {\n int v = q.Dequeue();\n for (var i = 0; i < c[v]; ++i)\n {\n var to = g[v][i];\n\n if ((used[to]) || (fi != null && fi[v] == ifi))\n continue;\n\n used[to] = true;\n q.Enqueue(to);\n }\n }\n }\n\n public static void Shuffle(IList list)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = list.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = list[k];\n list[k] = list[n];\n list[n] = value;\n }\n }\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "69362aaaadb7f67d3c0df12d67565ded", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "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 #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 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\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 fi = io.NextSeq(n).ToArray();\n\n var g = new int[n][];\n var c = new int[n];\n\n var g1 = new int[n][];\n var c1 = new int[n];\n\n for (int i = 0; i < m; i++)\n {\n var from = io.NextInt() - 1;\n var to = io.NextInt() - 1;\n\n if (g[from] == null)\n g[from] = new int[m];\n\n g[from][c[from]++] = to;\n\n\n if (g1[to] == null)\n g1[to] = new int[m];\n\n g1[to][c1[to]++] = from;\n }\n\n var used = new bool[n];\n\n for (int i = 0; i < n; i++)\n {\n if (fi[i] == 1)\n BFS(g, c, used, null, 0 , i);\n }\n\n var used1 = new bool[n];\n\n for (int i = 0; i < n; i++)\n {\n if (fi[i] == 2)\n BFS(g1, c1, used1, fi, 1, i);\n }\n\n\n for (int i = 0; i < n; i++)\n {\n io.PrintLine((used[i] && used1[i]) ? \"1\":\"0\");\n }\n }\n\n public void BFS(int[][] g, int[] c, bool[] used, int[] fi, int ifi, int s)\n {\n \n var n = g.Length;\n\n used = used ?? new bool[n];\n\n if (used[s])\n return;\n\n Queue q = new Queue();\n q.Enqueue(s);\n\n used[s] = true;\n\n while (q.Count > 0)\n {\n int v = q.Dequeue();\n for (var i = 0; i < c[v]; ++i)\n {\n var to = g[v][i];\n\n if ((used[to]) && (fi != null && fi[n] == ifi))\n continue;\n\n used[to] = true;\n q.Enqueue(to);\n }\n }\n }\n\n public static void Shuffle(IList list)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = list.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = list[k];\n list[k] = list[n];\n list[n] = value;\n }\n }\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "66e9d476f9870b36396897d561778eed", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "Mono C#", "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 #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 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\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 fi = io.NextSeq(n).ToArray();\n\n var g = new P[m];\n var g1 = new P[m];\n\n var sk = Enumerable.Range(0, m).ToArray();\n var sk1 = Enumerable.Range(0, m).ToArray();\n var c = new int[n + 1];\n var c1 = new int[n + 1];\n\n for (int i = 0; i < m; i++)\n {\n var from = io.NextInt() - 1;\n var to = io.NextInt() - 1;\n\n g[i] = P.Create(from , to);\n c[from + 1]++;\n g1[i] = P.Create(to, from);\n c1[to + 1]++;\n }\n\n for (int i = 1; i <= n; i++)\n {\n c[i] += c[i - 1];\n c1[i] += c1[i - 1];\n }\n\n Array.Sort(sk, (i, i1) => P.KeyComparer.Compare(g[i], g[i1]));\n\n Array.Sort(sk1, (i, i1) => P.KeyComparer.Compare(g1[i], g1[i1]));\n \n\n\n var used = new bool[n];\n var used1 = new bool[n];\n\n \n \n for (int i = 0; i < n; i++)\n {\n if (fi[i] == 1)\n BFS(g, sk, c, used, null, 0 , i);\n }\n \n for (int i = 0; i < n; i++)\n {\n if (fi[i] == 2)\n BFS(g1, sk1, c1, used1, fi, 1, i);\n }\n\n\n for (int i = 0; i < n; i++)\n {\n io.PrintLine((used[i] && used1[i]) ? \"1\":\"0\");\n }\n }\n\n public void BFS(P[] g, int[] sk, int[] c, bool[] used, int[] fi, int ifi, int s)\n {\n \n var n = c.Length;\n\n used = used ?? new bool[n];\n\n if (used[s])\n return;\n\n Queue q = new Queue();\n q.Enqueue(s);\n\n used[s] = true;\n\n while (q.Count > 0)\n {\n int v = q.Dequeue();\n for (var i = c[v]; i < c[v + 1]; i++)\n {\n var to = g[sk[i]].Value;\n\n if (used[to])\n continue;\n\n used[to] = true;\n\n if (fi != null && fi[to] == ifi)\n continue;\n\n q.Enqueue(to);\n }\n }\n }\n \n public static void Shuffle(IList list)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = list.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = list[k];\n list[k] = list[n];\n list[n] = value;\n }\n }\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4188f24ed121730a88913d5b8f0450da", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "86bb8c6d8832a061b6bb87469ee5d698", "src_uid": "dea5c9eded04f1a900c37571d20b34e2", "difficulty": 2800} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aa0b336de692919be27d613d2b63c310", "src_uid": "dea5c9eded04f1a900c37571d20b34e2", "difficulty": 2800} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5c35430c71740389d39f8d34c7c96dee", "src_uid": "dea5c9eded04f1a900c37571d20b34e2", "difficulty": 2800} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b37ffd5514a7c99adc33d279e6b1c474", "src_uid": "dea5c9eded04f1a900c37571d20b34e2", "difficulty": 2800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass Prog \n{\n public static void Main(String[] args)\n {\n int m1 = 0, m2;\n string s1, s2 = \"\";\n s1 = Console.ReadLine();\n switch (s1)\n {\n case \"January\" : m1 = 1; break;\n case \"February\" : m1 = 2; break;\n case \"March\" : m1 = 3; break;\n case \"April\" : m1 = 4; break;\n case \"May\" : m1 = 5; break;\n case \"June\" : m1 = 6; break;\n case \"July\" : m1 = 7; break;\n case \"August\" : m1 = 8; break;\n case \"September\": m1 = 9; break;\n case \"October\" : m1 = 10; break;\n case \"November\" : m1 = 11; break;\n case \"December\" : m1 = 12; break;\n }\n int i = Convert.ToInt32(Console.ReadLine());\n m2 = m1 + i;\n if (m2 > 12) { m2 -= 12; }\n switch (m2)\n {\n case 1: s2 = \"January\"; break;\n case 2: s2 = \"February\"; break;\n case 3: s2 = \"March\"; break;\n case 4: s2 = \"April\"; break;\n case 5: s2 = \"May\"; break;\n case 6: s2 = \"June\"; break;\n case 7: s2 = \"July\"; break;\n case 8: s2 = \"August\"; break;\n case 9: s2 = \"September\"; break;\n case 10: s2 = \"October\"; break;\n case 11: s2 = \"November\"; break;\n case 12: s2 = \"December\"; break;\n }\n Console.WriteLine(s2);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8c712600c70f1ad6606ad80181b5fba3", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass Prog \n{\n public static void Main(String[] args)\n {\n int m1 = 0, m2;\n string s1, s2 = \"\";\n s1 = Console.ReadLine();\n switch (s1)\n {\n case \"January\" : m1 = 1; break;\n case \"February\" : m1 = 2; break;\n case \"March\" : m1 = 3; break;\n case \"April\" : m1 = 4; break;\n case \"May\" : m1 = 5; break;\n case \"June\" : m1 = 6; break;\n case \"July\" : m1 = 7; break;\n case \"August\" : m1 = 8; break;\n case \"September\": m1 = 9; break;\n case \"October\" : m1 = 10; break;\n case \"November\" : m1 = 11; break;\n case \"December\" : m1 = 12; break;\n }\n int i = Convert.ToInt32(Console.ReadLine());\n m2 = m1 + i;\n if (m2 > 12) { m2 -= 12; }\n switch (m2)\n {\n case 1: s2 = \"January\"; break;\n case 2: s2 = \"February\"; break;\n case 3: s2 = \"March\"; break;\n case 4: s2 = \"April\"; break;\n case 5: s2 = \"May\"; break;\n case 6: s2 = \"June\"; break;\n case 7: s2 = \"July\"; break;\n case 8: s2 = \"August\"; break;\n case 9: s2 = \"September\"; break;\n case 10: s2 = \"October\"; break;\n case 11: s2 = \"November\"; break;\n case 12: s2 = \"December\"; break;\n }\n Console.WriteLine(s2);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6921638d00abb0f4bc3e241f96c7f8dc", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\n\nnamespace Contest\n{\n class TheBoredomDivTwo\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n int k = int.Parse(Console.ReadLine());\n\n int n = 0;\n switch (s)\n {\n case \"January\": n = 1; break;\n case \"February\": n = 2; break;\n case \"March\": n = 3; break;\n case \"April\": n = 4; break;\n case \"May\": n = 5; break;\n case \"June\": n = 6; break;\n case \"July\": n = 7; break;\n case \"August\": n = 8; break;\n case \"September\": n = 9; break;\n case \"October\": n = 10; break;\n case \"November\": n = 11; break;\n case \"December\": n = 12; break;\n }\n\n n += k;\n string ans = \"\";\n n %= 12;\n switch (n)\n {\n case 1: ans = \"January\"; break;\n case 2:ans = \"February\"; break;\n case 3:ans = \"March\"; break;\n case 4:ans = \"April\"; break;\n case 5:ans = \"May\"; break;\n case 6:ans = \"June\"; break;\n case 7:ans = \"July\"; break;\n case 8:ans = \"August\"; break;\n case 9:ans = \"September\"; break;\n case 10:ans = \"October\"; break;\n case 11:ans = \"November\"; break;\n case 12:ans = \"December\"; break;\n }\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "798aa8437d0918fc42dbedab2ef5c401", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Program {\n\tpublic static void Main() {\n#if DVORAK\n\t\tConsole.SetIn(new System.IO.StreamReader(\"..\\\\..\\\\in.txt\"));\n#endif\n\t\tString[] mon = { \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" };\n\n\t\tConsole.WriteLine(mon[(Array.IndexOf(mon, Console.ReadLine()) + Int32.Parse(Console.ReadLine())) % mon.Length]);\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0ca6b8a0b21b130c9e8a69fa67f1a978", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace A.Codecraft_III\n{\n class Program\n {\n static void Main(string[] args)\n {\n string actualMonth = Console.ReadLine();\n int numberMonths = int.Parse(Console.ReadLine());\n List months = new List { \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" };\n int actual = (months.IndexOf(actualMonth) + numberMonths) % 12;\n Console.WriteLine(months[actual]);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1fb6272c659b69626400a2fb76e2e42b", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class P1\n {\n static void Main(string[] args)\n {\n var monthName = new[]\n{\n\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\",\n\"October\", \"November\", \"December\"\n};\n var m = Console.ReadLine();\n for (var i = 0; i < monthName.Length; i++)\n {\n if (m != monthName[i]) continue;\n var c = Int32.Parse(Console.ReadLine());\n Console.WriteLine(monthName[(i + c) % 12]);\n return;\n }\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "28cdff7508f74262bcddca7757157a61", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task45A\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n Dictionary months = new Dictionary();\n months.Add(\"January\", 1);\n months.Add(\"February\", 2);\n months.Add(\"March\", 3);\n months.Add(\"April\", 4);\n months.Add(\"May\", 5);\n months.Add(\"June\", 6);\n months.Add(\"July\", 7);\n months.Add(\"August\", 8);\n months.Add(\"September\", 9);\n months.Add(\"October\", 10);\n months.Add(\"November\", 11);\n months.Add(\"December\", 12);\n string month = Console.ReadLine();\n Int32 monthCount = Int32.Parse(Console.ReadLine());\n monthCount = (months[month] + monthCount) % 12;\n if (monthCount == 0)\n {\n monthCount = 12;\n }\n foreach (string key in months.Keys)\n {\n if (months[key] == monthCount)\n {\n Console.WriteLine(key);\n break;\n }\n }\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a44479991b7b8ef608d6c45bf7cf32ef", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace Task45A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] months = { \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" };\n string currentMonth = Console.ReadLine();\n int k = int.Parse(Console.ReadLine());\n\n \n int currentIndex = Array.IndexOf(months,currentMonth);\n currentIndex += k;\n currentIndex = currentIndex % 12;\n \n\n Console.WriteLine(months[currentIndex]);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c899df2083bd55f0ff4e3076c404cbd6", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "// Codecraft III - CodeForces\n// Status: Unsolved\n\nusing System;\n\nclass Program {\n\n static Func inp =\n () => int.Parse(Console.ReadLine());\n\n static Func insr =\n () => Console.ReadLine();\n\n static string[] months = new string[] { \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" };\n\n static int findInArray(string[] arr, string value) {\n for (int i = 0; i < arr.Length; i++) {\n string e = arr[i];\n if (e == value) return i;\n }\n return -1;\n }\n static int Main(string[] args) {\n int m = findInArray(months, insr());\n int k = (int) inp() % 12;\n // Console.WriteLine(m + \" \" + k);\n\n Console.WriteLine(m + k > 11 ? months[m + k - 12] : months[m + k]);\n\n return 0;\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "43e2c0d48c50aa8c0c4e0a84424cc08d", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n int n = Int32.Parse(Console.ReadLine());\n\n Dictionary monthNumber = new Dictionary()\n {\n {1, \"January\"},\n {2, \"February\"},\n {3, \"March\"},\n {4, \"April\"},\n {5, \"May\"},\n {6, \"June\"},\n {7, \"July\"},\n {8, \"August\"},\n {9, \"September\"},\n {10, \"October\"},\n {11, \"November\"},\n {12, \"December\"}\n };\n\n int m = monthNumber.Where(el => el.Value == str).Select(el => el.Key).First();\n\n int result = (n + m) % 12;\n \n if (result == 0)\n {\n Console.WriteLine(\"December\");\n }\n else\n {\n string month = monthNumber.Where(el => el.Key == result).Select(el => el.Value).First();\n\n Console.WriteLine(month);\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "03211d3bcafb6ba54abcaaecf07cc67d", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProblemA\n{\n class Program\n {\n static void Main(string[] args)\n {\n var months = new[]\n {\n \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\",\n \"October\", \"November\", \"December\"\n };\n var m = Console.ReadLine();\n for (var i = 0; i < months.Length; i++)\n {\n if (m != months[i]) continue;\n var c = Int32.Parse(Console.ReadLine());\n Console.WriteLine(months[(i + c) % 12]);\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7b72fd8e79cd75f8d96588685bcc132d", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nnamespace FREECASH\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n try\n {\n string month = Console.ReadLine();\n int k = int.Parse(Console.ReadLine());\n int cm = 0;\n string[] months = { \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" };\n for (int i = 0; i < 12; i++)\n {\n if (month == months[i])\n cm = i;\n }\n Console.Write(months[(cm+ k)%12]);\n \n Console.ReadKey();\n }\n catch { }\n }\n } \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b690691fab386ee9951994f495c2b751", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Task_45A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string currentMonth = Console.ReadLine();\n int timeRemaining = int.Parse(Console.ReadLine());\n string[] months = { \"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n \"July\",\"August\",\"September\",\"October\",\"November\",\"December\"};\n string ans = \"\";\n for(int i = 0; i < 12; i++)\n {\n if (months[i] == currentMonth)\n {\n if (i + timeRemaining % 12 > 11)\n {\n ans = months[i + timeRemaining % 12 - 12];\n break;\n }\n\n else\n {\n ans = months[i + timeRemaining % 12];\n break;\n }\n } \n }\n Console.WriteLine(ans);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "65862ef84577c6fb008e074d026d4a70", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Task\n{\n class Program\n {\n\n\n\n //public static void qsort(int[] m, int a, int b)\n //{\n // if (a >= b) return;\n // int i = a;\n // for (int j = a; j <= b; j++) // \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0441 a \u043f\u043e b\n // {\n // if (m[j] <= m[b]) // \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 m[j] \u043d\u0435 \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0438\u0442 m[b],\n // {\n // int t = m[i]; // \u043c\u0435\u043d\u044f\u0435\u043c \u043c\u0435\u0441\u0442\u0430\u043c\u0438 m[j] \u0438 m[a], m[a+1], m[a+2] \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435...\n // m[i] = m[j]; // \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0435\u043d\u044c\u0448\u0438\u0435 m[b] \u0432 \u043d\u0430\u0447\u0430\u043b\u043e,\n // m[j] = t; // \u0430 \u0437\u0430\u0442\u0435\u043c \u0438 \u0441\u0430\u043c m[b] \u00ab\u0441\u0432\u0435\u0440\u0445\u0443\u00bb\n // i++; // \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043e\u0431\u043c\u0435\u043d: m[b] \u0438 m[i], \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e i++\n // }\n // }\n\n // qsort(m, a, i - 2);\n // qsort(m, i, b);\n //}\n\n static void Main(string[] args)\n {\n\n string[] month = new string[12];\n month[0] = \"January\";\n month[1] = \"February\";\n month[2] = \"March\";\n month[3] = \"April\";\n month[4] = \"May\";\n month[5] = \"June\";\n month[6] = \"July\";\n month[7] = \"August\";\n month[8] = \"September\";\n month[9] = \"October\";\n month[10] = \"November\";\n month[11] = \"December\";\n string s = Console.ReadLine();\n int num = int.Parse(Console.ReadLine());\n for (int i = 0; i < 12; i++)\n {\n if (month[i] == s)\n {\n num += i;\n break;\n\n }\n }\n num = num % 12;\n Console.WriteLine(month[num]);\n }\n }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4268806594b76baed7114e16e33e27e0", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _45A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string current = Console.ReadLine();\n int N = int.Parse(Console.ReadLine());\n string[] months = { \"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\n \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" };\n\n int indexCurr = Array.IndexOf(months, current); \n Console.WriteLine(months[(indexCurr + N)%12]);\n }\n }\n}\n/*\n may-4 index\n 24+4=28\n 28%12\n \n */", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f6d2bda69f456acf8f2ba7665863079a", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Lomonosov_1\n{\n\tpublic class EmptyClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tString month = Console.ReadLine ();\n\t\t\tMonths MonthO = Months.January;\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tif (month == \"January\")\n\t\t\t\tMonthO = Months.January;\n\t\t\tif (month == \"February\")\n\t\t\t\tMonthO = Months.February;\n\t\t\tif (month == \"March\")\n\t\t\t\tMonthO = Months.March;\n\t\t\tif (month == \"April\")\n\t\t\t\tMonthO = Months.April;\n\t\t\tif (month == \"May\")\n\t\t\t\tMonthO = Months.May;\n\t\t\tif (month == \"June\")\n\t\t\t\tMonthO = Months.June;\n\t\t\tif (month == \"July\")\n\t\t\t\tMonthO = Months.July;\n\t\t\tif (month == \"August\")\n\t\t\t\tMonthO = Months.August;\n\t\t\tif (month == \"September\")\n\t\t\t\tMonthO = Months.September;\n\t\t\tif (month == \"October\")\n\t\t\t\tMonthO = Months.October;\n\t\t\tif (month == \"November\")\n\t\t\t\tMonthO = Months.November;\n\t\t\tif (month == \"December\")\n\t\t\t\tMonthO = Months.December;\n\t\t\n\n\t\t\tMonths Original = MonthO;\n\t\t\tMonthO += n;\n\t\t\tMonthO = MonthO - ((int) MonthO / 12) * 12;\n\n\t\t\tConsole.WriteLine (MonthO);\n\t\t}\n\n\t\tenum Months{ January , February, March, April, May, June, July, August, September, October, November, December }\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a8bdf3e44572694454dd9d6218d1b0a5", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "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[] months = {\"January\", \"February\", \"March\",\n \"April\", \"May\", \"June\", \"July\", \"August\",\n \"September\", \"October\", \"November\", \"December\"};\n string find = Console.ReadLine();\n int m = int.Parse(Console.ReadLine());\n if (m > 12)\n m = m % 12;\n int a = Array.IndexOf(months, find);\n a += m ;\n while (a > 11)\n a -= 12;\n Console.WriteLine(months[a]);\n\n\n\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1473f1a7a788572f0cd7be5ddbf0479d", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\n\nnamespace Contest\n{\n class TheBoredomDivTwo\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n int k = int.Parse(Console.ReadLine());\n\n int n = 0;\n switch (s)\n {\n case \"January\": n = 1; break;\n case \"February\": n = 2; break;\n case \"March\": n = 3; break;\n case \"April\": n = 4; break;\n case \"May\": n = 5; break;\n case \"June\": n = 6; break;\n case \"July\": n = 7; break;\n case \"August\": n = 8; break;\n case \"September\": n = 9; break;\n case \"October\": n = 10; break;\n case \"November\": n = 11; break;\n case \"December\": n = 12; break;\n }\n\n n += k;\n string ans = \"\";\n while (n > 12)\n {\n n -= 12;\n }\n switch (n)\n {\n case 1: ans = \"January\"; break;\n case 2: ans = \"February\"; break;\n case 3: ans = \"March\"; break;\n case 4: ans = \"April\"; break;\n case 5:ans = \"May\"; break;\n case 6:ans = \"June\"; break;\n case 7:ans = \"July\"; break;\n case 8:ans = \"August\"; break;\n case 9:ans = \"September\"; break;\n case 10:ans = \"October\"; break;\n case 11:ans = \"November\"; break;\n case 12:ans = \"December\"; break;\n }\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "261ef27030f719fd635a0af5a3912f2f", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Codecraft_III\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 name = reader.ReadLine();\n int k = int.Parse(reader.ReadLine());\n\n var array = new[]\n {\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"};\n\n int index = Array.IndexOf(array, name);\n index += k;\n index %= array.Length;\n\n writer.WriteLine(array[index]);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "00ce8c43a2141bccb398776a10a2cbea", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nnamespace FREECASH\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n try\n {\n string month = Console.ReadLine();\n int k = int.Parse(Console.ReadLine());\n int cm = 0;\n string[] months = { \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" };\n for (int i = 0; i < 12; i++)\n {\n if (month == months[i])\n cm = i + 1;\n }\n Console.Write(months[(cm+ k)%12-1]);\n \n Console.ReadKey();\n }\n catch { }\n }\n } \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b4d5b758139b2b58ea073e03a6eca9a7", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task45A\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n Dictionary months = new Dictionary();\n months.Add(\"January\", 1);\n months.Add(\"February\", 2);\n months.Add(\"March\", 3);\n months.Add(\"April\", 4);\n months.Add(\"May\", 5);\n months.Add(\"June\", 6);\n months.Add(\"July\", 7);\n months.Add(\"August\", 8);\n months.Add(\"September\", 9);\n months.Add(\"October\", 10);\n months.Add(\"November\", 11);\n months.Add(\"December\", 12);\n string month = Console.ReadLine();\n Int32 monthCount = Int32.Parse(Console.ReadLine());\n monthCount = (months[month] + monthCount) % 12;\n foreach (string key in months.Keys)\n {\n if (months[key] == monthCount)\n {\n Console.WriteLine(key);\n break;\n }\n } \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "52f249b7503c15afc3c332f1185bbaf6", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Lomonosov_1\n{\n\tpublic class EmptyClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tString month = Console.ReadLine ();\n\t\t\tMonths Month = Months.January;\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tswitch (month) \n\t\t\t{\n\t\t\tcase \"January\":\n\t\t\t\tMonth = Months.January;\n\t\t\t\tbreak;\n\t\t\tcase \"February\":\n\t\t\t\tMonth = Months.February;\n\t\t\t\tbreak;\n\t\t\tcase \"March\":\n\t\t\t\tMonth = Months.March;\n\t\t\t\tbreak;\n\t\t\tcase \"April\":\n\t\t\t\tMonth = Months.April;\n\t\t\t\tbreak;\n\t\t\tcase \"May\":\n\t\t\t\tMonth = Months.May;\n\t\t\t\tbreak;\n\t\t\tcase \"June\":\n\t\t\t\tMonth = Months.June;\n\t\t\t\tbreak;\n\t\t\tcase \"July\":\n\t\t\t\tMonth = Months.July;\n\t\t\t\tbreak;\n\t\t\tcase \"August\":\n\t\t\t\tMonth = Months.August;\n\t\t\t\tbreak;\n\t\t\tcase \"September\":\n\t\t\t\tMonth = Months.September;\n\t\t\t\tbreak;\n\t\t\tcase \"October\":\n\t\t\t\tMonth = Months.October;\n\t\t\t\tbreak;\n\t\t\tcase \"November\":\n\t\t\t\tMonth = Months.November;\n\t\t\t\tbreak;\n\t\t\tcase \"December \":\n\t\t\t\tMonth = Months.December;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tMonth += n;\n\t\t\tMonth = Month - ((int) Month / 12) * 12;\n\n\t\t\tConsole.WriteLine (Month);\n\t\t}\n\n\t\tenum Months{ January = 0, February, March, April, May, June, July, August, September, October, November, December }\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8566d1ab2241b12a6ed41899aa2a1c0", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\n\nclass File {\n\n public static void Main ( String [] args ) {\n\n String[] months = new String [12];\n\nmonths[0] = \"January\";\nmonths[1] = \"February\";\nmonths[2] = \"March\";\nmonths[3] = \"April\";\nmonths[4] = \"May\";\nmonths[5] = \"June\";\nmonths[6] = \"July\";\nmonths[7] = \"August\";\nmonths[8] = \"September\";\nmonths[9] = \"October\";\nmonths[10] = \"November\";\nmonths[11] = \"December\";\n\nint thisMonth = 0;\nswitch ( Console.ReadLine() )\n{\ncase \"January\":\nthisMonth = 0;\nbreak;\ncase \"February\":\nthisMonth = 1;\nbreak;\ncase \"March\":\nthisMonth = 2;\nbreak;\ncase \"April\":\nthisMonth = 3;\nbreak;\ncase \"May\":\nthisMonth = 4;\nbreak;\ncase \"June\":\nthisMonth = 5;\nbreak;\ncase \"July\":\nthisMonth = 6;\nbreak;\ncase \"August\":\nthisMonth = 7;\nbreak;\ncase \"September\":\nthisMonth = 8;\nbreak;\ncase \"October\":\nthisMonth = 9;\nbreak;\ncase \"November\":\nthisMonth = 10;\nbreak;\ncase \"December\":\nthisMonth = 11;\nbreak;\n}\n\nint k = Convert.ToInt32( Console.ReadLine() );\n\nint last = thisMonth + k;\n\nif ( last > 11 ) { last -= 12; }\n\nConsole.WriteLine(months[last]);\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eda4a6117b21f682c5e6b08e1913cef4", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n int n = Int32.Parse(Console.ReadLine());\n\n Dictionary monthNumber = new Dictionary()\n {\n {1, \"January\"},\n {2, \"February\"},\n {3, \"March\"},\n {4, \"April\"},\n {5, \"May\"},\n {6, \"June\"},\n {7, \"July\"},\n {8, \"August\"},\n {9, \"September\"},\n {10, \"October\"},\n {11, \"November\"},\n {12, \"December\"}\n };\n\n int m = monthNumber.Where(el => el.Value == str).Select(el => el.Key).First();\n\n int result = (n + m) % 12;\n\n string month = monthNumber.Where(el => el.Key == result).Select(el => el.Value).First();\n\n Console.WriteLine(month);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0cc0a4081e958a2a305b8677ca7a2009", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Lomonosov_1\n{\n\tpublic class EmptyClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tString month = Console.ReadLine ();\n\t\t\tMonths Month = Months.January;\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tswitch (month) \n\t\t\t{\n\t\t\tcase \"January\":\n\t\t\t\tMonth = Months.January;\n\t\t\t\tbreak;\n\t\t\tcase \"February\":\n\t\t\t\tMonth = Months.February;\n\t\t\t\tbreak;\n\t\t\tcase \"March\":\n\t\t\t\tMonth = Months.March;\n\t\t\t\tbreak;\n\t\t\tcase \"April\":\n\t\t\t\tMonth = Months.April;\n\t\t\t\tbreak;\n\t\t\tcase \"May\":\n\t\t\t\tMonth = Months.May;\n\t\t\t\tbreak;\n\t\t\tcase \"June\":\n\t\t\t\tMonth = Months.June;\n\t\t\t\tbreak;\n\t\t\tcase \"July\":\n\t\t\t\tMonth = Months.July;\n\t\t\t\tbreak;\n\t\t\tcase \"August\":\n\t\t\t\tMonth = Months.August;\n\t\t\t\tbreak;\n\t\t\tcase \"September\":\n\t\t\t\tMonth = Months.September;\n\t\t\t\tbreak;\n\t\t\tcase \"October\":\n\t\t\t\tMonth = Months.October;\n\t\t\t\tbreak;\n\t\t\tcase \"November\":\n\t\t\t\tMonth = Months.November;\n\t\t\t\tbreak;\n\t\t\tcase \"December \":\n\t\t\t\tMonth = Months.December;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tMonth += n;\n\t\t\tMonth = Month - ((int) Month / 12) * 12;\n\n\t\t\tConsole.WriteLine (Month);\n\t\t\tConsole.ReadKey (true);\t\n\t\t}\n\n\t\tenum Months{ January = 0, February, March, April, May, June, July, August, September, October, November, December }\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "16398a9c650614bedfc9094c98106846", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\n\nclass File {\n\n public static void Main ( String [] args ) {\n\n String[] months = new String [12];\n\nmonths[0] = \"January\";\nmonths[1] = \"February\";\nmonths[2] = \"March\";\nmonths[3] = \"April\";\nmonths[4] = \"May\";\nmonths[5] = \"June\";\nmonths[6] = \"July\";\nmonths[7] = \"August\";\nmonths[8] = \"September\";\nmonths[9] = \"October\";\nmonths[10] = \"November\";\nmonths[11] = \"December\";\n\nint thisMonth = 0;\nString buf = Console.ReadLine()\nswitch ( buf )\n{\ncase \"January\":\nthisMonth = 0;\nbreak;\ncase \"February\":\nthisMonth = 1;\nbreak;\ncase \"March\":\nthisMonth = 2;\nbreak;\ncase \"April\":\nthisMonth = 3;\nbreak;\ncase \"May\":\nthisMonth = 4;\nbreak;\ncase \"June\":\nthisMonth = 5;\nbreak;\ncase \"July\":\nthisMonth = 6;\nbreak;\ncase \"August\":\nthisMonth = 7;\nbreak;\ncase \"September\":\nthisMonth = 8;\nbreak;\ncase \"October\":\nthisMonth = 9;\nbreak;\ncase \"November\":\nthisMonth = 10;\nbreak;\ncase \"December\":\nthisMonth = 11;\nbreak;\n}\n\nint k = Convert.ToInt32( Console.ReadLine() );\n\nint last = thisMonth + k;\n\nif ( last > 11 ) { last -= 12; }\n\nConsole.WriteLine(months[last]);\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ef87712f6dc8fe849aa1cbe630c7a05c", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "source_code": "using System;\n\nclass File {\n\n public static void Main ( String [] args ) {\n\n String[] months = new String [12];\n\nmonths[0] = \"January\";\nmonths[1] = \"February\";\nmonths[2] = \"March\";\nmonths[3] = \"April\";\nmonths[4] = \"May\";\nmonths[5] = \"June\";\nmonths[6] = \"July\";\nmonths[7] = \"August\";\nmonths[8] = \"September\";\nmonths[9] = \"October\";\nmonths[10] = \"November\";\nmonths[11] = \"December\";\n\nint thisMonth = 0;\nString buf = Console.ReadLine()\nswitch ( buf )\n{\ncase buf == \"January\":\nthisMonth = 0;\nbreak;\ncase buf == \"February\":\nthisMonth = 1;\nbreak;\ncase buf == \"March\":\nthisMonth = 2;\nbreak;\ncase buf == \"April\":\nthisMonth = 3;\nbreak;\ncase buf == \"May\":\nthisMonth = 4;\nbreak;\ncase buf == \"June\":\nthisMonth = 5;\nbreak;\ncase buf == \"July\":\nthisMonth = 6;\nbreak;\ncase buf == \"August\":\nthisMonth = 7;\nbreak;\ncase buf == \"September\":\nthisMonth = 8;\nbreak;\ncase buf == \"October\":\nthisMonth = 9;\nbreak;\ncase buf == \"November\":\nthisMonth = 10;\nbreak;\ncase buf == \"December\":\nthisMonth = 11;\nbreak;\n}\n\nint k = Convert.ToInt32( Console.ReadLine() );\n\nint last = thisMonth + k;\n\nif ( last > 11 ) { last -= 12; }\n\nConsole.WriteLine(months[last]);\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "306f7cc8c87004e4e73e7aeec35a7a99", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900} {"lang": "Mono C#", "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 //Random rand = new Random();\n\n string[] s = Console.ReadLine().Split();\n l = long.Parse(s[0]);\n r = long.Parse(s[1]);\n x = long.Parse(s[2]);\n y = long.Parse(s[3]);\n //while (true)\n {\n Solve();\n //x = rand.Next(1, 1000000000);\n //y = x * rand.Next(1, 1000000000 / (int)x);\n //l = rand.Next(1, 1000000000);\n //r = rand.Next(1, 1000000000);\n }\n }\n\n static void Solve()\n {\n List yfactors = Factor(y);\n yf = new List();\n long x2 = x;\n long f = -1;\n for (int i = 0; i < yfactors.Count; i++)\n {\n if (x2 % yfactors[i] == 0)\n {\n x2 /= yfactors[i];\n }\n else if (yf.Count != 0 && yfactors[i] == f)\n {\n yf[yf.Count - 1] *= yfactors[i];\n }\n else\n {\n yf.Add(yfactors[i]);\n f = yfactors[i];\n }\n }\n if (x2 != 1)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(Count(new bool[yf.Count], 0));\n }\n }\n\n static long x, y, r, l;\n static List yf;\n\n public static long Count(bool[] b, long at)\n {\n if(at == b.Length)\n {\n //Console.WriteLine(string.Join(\", \", b));\n long n = x, m = x;\n for (int i = 0; i < b.Length; i++)\n {\n if (b[i])\n n *= yf[i];\n else\n m *= yf[i];\n }\n if (n <= r && n >= l && m <= r && m >= l)\n {\n //Console.WriteLine(n + \", \" + m);\n return 1;\n }\n else\n return 0;\n }\n long e = 0;\n bool[] nb = new bool[b.Length];\n Array.Copy(b, nb, b.Length);\n nb[at] = false;\n e += Count(nb, at + 1);\n nb[at] = true;\n e += Count(nb, at + 1);\n return e;\n }\n\n public static List Factor(long n)\n {\n List r = new List();\n\n while (n % 2 == 0)\n {\n n /= 2;\n r.Add(2);\n }\n while (n % 3 == 0)\n {\n n /= 3;\n r.Add(3);\n }\n\n long sqrtn = (long)(Math.Sqrt(n)) + 1;\n long i = 6;\n while (n > 1 && i <= sqrtn)\n {\n bool nc = false;\n long a;\n while ((a = n % (i - 1)) == 0)\n {\n r.Add(i - 1);\n n /= i - 1;\n nc = true;\n }\n while ((a = n % (i + 1)) == 0)\n {\n r.Add(i + 1);\n n /= i + 1;\n nc = true;\n }\n i += 6;\n if (nc)\n sqrtn = (long)(Math.Sqrt(n)) + 1;\n }\n if (n != 1) r.Add(n);\n return r;\n }\n } \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f25075ca2b211b5eed77ec2885afbe7e", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Nastya_Studies_Informatics\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 l = Next(), r = Next(), x = Next(), y = Next();\n\n if (y%x != 0)\n return 0;\n\n y /= x;\n l = (l + x - 1)/x;\n r /= x;\n\n int ans = 0;\n for (int i = Math.Max(1, l); i <= r; i++)\n {\n if (i*i > y)\n break;\n\n if (y%i == 0)\n {\n int z = y/i;\n int g = Gcd(i, z);\n if (g == 1)\n {\n if (z <= r)\n ans += 2;\n if (z == i)\n ans--;\n }\n }\n }\n return ans;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "14c0982b0ec9db9de1a0992c433982bd", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task\n{\n class Program\n {\n static bool InRange(int l, int r, int x)\n {\n return x >= l && x <= r;\n }\n\n static void Main(string[] args)\n {\n var inpMas = Console.ReadLine().Split(' ').Select(item => int.Parse(item)).ToList();\n int l = inpMas[0];\n int r = inpMas[1];\n int x = inpMas[2];\n int y = inpMas[3];\n\n if (y % x != 0)\n {\n Console.WriteLine(0);\n return;\n }\n\n int i = 0;\n int ans = 0;\n int yx = y / x;\n int yx2 = yx;\n List divs = new List();\n int div = 2;\n\n int k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 >>= 1;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n\n div = 3;\n while (yx2 > 1)\n {\n k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 /= div;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n div += 2;\n }\n\n //divs.Add(1);\n div = (1 << divs.Count) - 1;\n for (i = 0; i <= div; i++)\n {\n int j = i;\n int div1 = 1;\n int ind = divs.Count - 1;\n while (j > 0)\n {\n if ((j & 1) == 1)\n {\n div1 *= divs[ind];\n }\n ind -= 1;\n j >>= 1;\n }\n int div2 = yx / div1;\n if (InRange(l, r, div1 * x) && InRange(l, r, div2 * x))\n ans += 1;\n }\n\n Console.WriteLine(ans);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fef12ca7da4d7a1f1e1dfead64d26543", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "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 Random rand = new Random();\n\n string[] s = Console.ReadLine().Split();\n l = long.Parse(s[0]);\n r = long.Parse(s[1]);\n x = long.Parse(s[2]);\n y = long.Parse(s[3]);\n //while (true)\n {\n Solve();\n //x = rand.Next(1, 1000000000);\n //y = rand.Next(1, 1000000000);\n //l = rand.Next(1, 1000000000);\n //r = rand.Next(1, 1000000000);\n }\n }\n\n static void Solve()\n {\n List yfactors = Factor(y);\n yf = new List();\n long x2 = x;\n for (int i = 0; i < yfactors.Count; i++)\n {\n if (x2 % yfactors[i] == 0)\n {\n x2 /= yfactors[i];\n }\n else if (yf.Count != 0 && yfactors[i] == yfactors[i - 1])\n {\n yf[yf.Count - 1] *= yfactors[i];\n }\n else\n {\n yf.Add(yfactors[i]);\n }\n }\n if (x2 != 1)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(Count(new bool[yf.Count], 0));\n }\n }\n\n static long x, y, r, l;\n static List yf;\n\n public static long Count(bool[] b, long at)\n {\n if(at == b.Length)\n {\n long n = x, m = x;\n for (int i = 0; i < b.Length; i++)\n {\n if (b[i])\n n *= yf[i];\n else\n m *= yf[i];\n }\n if (n <= r && n >= l && m <= r && m >= l)\n {\n //Console.WriteLine(n + \", \" + m);\n return 1;\n }\n else\n return 0;\n }\n long e = 0;\n bool[] nb = new bool[b.Length];\n Array.Copy(b, nb, b.Length);\n nb[at] = false;\n e += Count(nb, at + 1);\n nb[at] = true;\n e += Count(nb, at + 1);\n return e;\n }\n\n public static List Factor(long n)\n {\n List r = new List();\n\n while (n % 2 == 0)\n {\n n /= 2;\n r.Add(2);\n }\n while (n % 3 == 0)\n {\n n /= 3;\n r.Add(3);\n }\n\n long sqrtn = (long)(Math.Sqrt(n)) + 1;\n long i = 6;\n while (n > 1 && i <= sqrtn)\n {\n bool nc = false;\n long a;\n while ((a = n % (i - 1)) == 0)\n {\n r.Add(i - 1);\n n /= i - 1;\n nc = true;\n }\n while ((a = n % (i + 1)) == 0)\n {\n r.Add(i + 1);\n n /= i + 1;\n nc = true;\n }\n i += 6;\n if (nc)\n sqrtn = (long)(Math.Sqrt(n)) + 1;\n }\n if (n != 1) r.Add(n);\n return r;\n }\n } \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "06154fb25b04bfb24be0b1fd71c963a9", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task\n{\n class Program\n {\n static bool InRange(int l, int r, int x)\n {\n return x >= l && x <= r;\n }\n\n static void Main(string[] args)\n {\n var inpMas = Console.ReadLine().Split(' ').Select(item => int.Parse(item)).ToList();\n int l = inpMas[0];\n int r = inpMas[1];\n int x = inpMas[2];\n int y = inpMas[3];\n\n if (y % x != 0)\n {\n Console.WriteLine(0);\n return;\n }\n\n int i = 0;\n int ans = 0;\n int yx = y / x;\n int yx2 = yx;\n List divs = new List();\n int div = 2;\n\n int k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 >>= 1;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n\n div = 3;\n while (yx2 > 1)\n {\n k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 /= div;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n div += 2;\n }\n\n divs.Add(1);\n div = 1 << (divs.Count - 1);\n for (i = 1; i <= div; i ++)\n {\n int j = i;\n int div1 = 1;\n int ind = divs.Count - 1;\n while (j > 0)\n {\n if ((j & 1) == 1)\n {\n div1 *= divs[ind];\n ind -= 1;\n }\n j >>= 1;\n }\n int div2 = yx / div1;\n if (InRange(l, r, div1 * x) && InRange(l, r, div2 * y))\n ans += 1;\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "28e0ee1c2d29d058e130243a4bfc2989", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "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 string[] s = Console.ReadLine().Split();\n l = long.Parse(s[0]);\n r = long.Parse(s[1]);\n x = long.Parse(s[2]);\n y = long.Parse(s[3]);\n List yfactors = Factor(y);\n yf = new List();\n for (int i = 0; i < yfactors.Count; i++)\n {\n if(i != 0 && yfactors[i] == yfactors[i - 1])\n {\n yf[yf.Count - 1] *= yfactors[i];\n }\n else\n {\n yf.Add(yfactors[i]);\n }\n }\n Console.WriteLine(Count(new bool[yf.Count], 0));\n }\n\n static long x, y, r, l;\n static List yf;\n\n public static long Count(bool[] b, long at)\n {\n if(at == b.Length)\n {\n long n = x, m = x;\n for (int i = 0; i < b.Length; i++)\n {\n if (b[i])\n n *= yf[i];\n else\n m *= yf[i];\n }\n if (n <= r && n >= l && m <= r && m >= l)\n {\n return 1;\n }\n else\n return 0;\n }\n long e = 0;\n bool[] nb = new bool[b.Length];\n Array.Copy(b, nb, b.Length);\n nb[at] = false;\n e += Count(nb, at + 1);\n nb[at] = true;\n e += Count(nb, at + 1);\n return e;\n }\n\n public static List Factor(long n)\n {\n List r = new List();\n\n while (n % 2 == 0)\n {\n n /= 2;\n r.Add(2);\n }\n while (n % 3 == 0)\n {\n n /= 3;\n r.Add(3);\n }\n\n long sqrtn = (long)(Math.Sqrt(n)) + 1;\n long i = 6;\n while (n > 1 && i <= sqrtn)\n {\n bool nc = false;\n long a;\n while ((a = n % (i - 1)) == 0)\n {\n r.Add(i - 1);\n n /= i - 1;\n nc = true;\n }\n while ((a = n % (i + 1)) == 0)\n {\n r.Add(i + 1);\n n /= i + 1;\n nc = true;\n }\n i += 6;\n if (nc)\n sqrtn = (long)(Math.Sqrt(n)) + 1;\n }\n if (n != 1) r.Add(n);\n return r;\n }\n } \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1bdf0c1221dc991064c1d4325c8c2bc5", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task\n{\n class Program\n {\n static bool InRange(int l, int r, int x)\n {\n return x >= l && x <= r;\n }\n\n static void Main(string[] args)\n {\n var inpMas = Console.ReadLine().Split(' ').Select(item => int.Parse(item)).ToList();\n int l = inpMas[0];\n int r = inpMas[1];\n int x = inpMas[2];\n int y = inpMas[3];\n\n if (y % x != 0)\n {\n Console.WriteLine(0);\n return;\n }\n\n int i = 0;\n int ans = 0;\n int yx = y / x;\n int yx2 = yx;\n List divs = new List();\n int div = 2;\n\n int k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 >>= 1;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n\n div = 3;\n while (yx2 > 1)\n {\n k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 /= div;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n div += 2;\n }\n\n //divs.Add(1);\n div = (1 << divs.Count) - 1;\n for (i = 0; i <= div; i++)\n {\n int j = i;\n int div1 = 1;\n int ind = divs.Count - 1;\n while (j > 0)\n {\n if ((j & 1) == 1)\n {\n div1 *= divs[ind];\n ind -= 1;\n }\n j >>= 1;\n }\n int div2 = yx / div1;\n if (InRange(l, r, div1 * x) && InRange(l, r, div2 * x))\n ans += 1;\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8b36721305a4221cb29b108bd1096bec", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task\n{\n class Program\n {\n static bool InRange(int l, int r, int x)\n {\n return x >= l && x <= r;\n }\n\n static void Main(string[] args)\n {\n var inpMas = Console.ReadLine().Split(' ').Select(item => int.Parse(item)).ToList();\n int l = inpMas[0];\n int r = inpMas[1];\n int x = inpMas[2];\n int y = inpMas[3];\n\n if (y % x != 0)\n {\n Console.WriteLine(0);\n return;\n }\n\n int i = 0;\n int ans = 0;\n int yx = y / x;\n int yx2 = yx;\n List divs = new List();\n int div = 2;\n\n int k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 >>= 1;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n\n div = 3;\n while (yx2 > 1)\n {\n k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 /= div;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n div += 2;\n }\n\n divs.Add(1);\n div = (1 << divs.Count) - 1;\n for (i = 0; i <= div; i++)\n {\n int j = i;\n int div1 = 1;\n int ind = divs.Count - 1;\n while (j > 0)\n {\n if ((j & 1) == 1)\n {\n div1 *= divs[ind];\n ind -= 1;\n }\n j >>= 1;\n }\n int div2 = yx / div1;\n if (InRange(l, r, div1 * x) && InRange(l, r, div2 * x))\n ans += 1;\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e662a133d8e61244e79a883de946f4e0", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "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 string[] s = Console.ReadLine().Split();\n l = long.Parse(s[0]);\n r = long.Parse(s[1]);\n x = long.Parse(s[2]);\n y = long.Parse(s[3]);\n List yfactors = Factor(y);\n yf = new List();\n long x2 = x;\n for (int i = 0; i < yfactors.Count; i++)\n {\n if(x2 % yfactors[i] == 0)\n {\n x2 /= yfactors[i];\n }\n else if(i != 0 && yfactors[i] == yfactors[i - 1])\n {\n yf[yf.Count - 1] *= yfactors[i];\n }\n else\n {\n yf.Add(yfactors[i]);\n }\n }\n if(x2 != 1)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(Count(new bool[yf.Count], 0));\n }\n \n }\n\n static long x, y, r, l;\n static List yf;\n\n public static long Count(bool[] b, long at)\n {\n if(at == b.Length)\n {\n long n = x, m = x;\n for (int i = 0; i < b.Length; i++)\n {\n if (b[i])\n n *= yf[i];\n else\n m *= yf[i];\n }\n if (n <= r && n >= l && m <= r && m >= l)\n {\n //Console.WriteLine(n + \", \" + m);\n return 1;\n }\n else\n return 0;\n }\n long e = 0;\n bool[] nb = new bool[b.Length];\n Array.Copy(b, nb, b.Length);\n nb[at] = false;\n e += Count(nb, at + 1);\n nb[at] = true;\n e += Count(nb, at + 1);\n return e;\n }\n\n public static List Factor(long n)\n {\n List r = new List();\n\n while (n % 2 == 0)\n {\n n /= 2;\n r.Add(2);\n }\n while (n % 3 == 0)\n {\n n /= 3;\n r.Add(3);\n }\n\n long sqrtn = (long)(Math.Sqrt(n)) + 1;\n long i = 6;\n while (n > 1 && i <= sqrtn)\n {\n bool nc = false;\n long a;\n while ((a = n % (i - 1)) == 0)\n {\n r.Add(i - 1);\n n /= i - 1;\n nc = true;\n }\n while ((a = n % (i + 1)) == 0)\n {\n r.Add(i + 1);\n n /= i + 1;\n nc = true;\n }\n i += 6;\n if (nc)\n sqrtn = (long)(Math.Sqrt(n)) + 1;\n }\n if (n != 1) r.Add(n);\n return r;\n }\n } \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9d159af5f516b7304a2a6f0b977d05ab", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "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 public void Solve()\n {\n int l, r, x, y;\n sc.Make(out l, out r, out x, out y);\n var fx = Factorize(x);\n var fy = Factorize(y);\n foreach (var p in fx)\n {\n if (!fy.ContainsKey(p.Key)||fy[p.Key]();\n foreach (var p in fy)\n {\n if (!fx.ContainsKey(p.Key)) fx[p.Key] = 0;\n n.Add(new P(p.Key, p.Value, fx[p.Key]));\n }\n var res = 0;\n var ok = new Dictionary>();\n for(var i = 0; i < (1 << n.Count); i++)\n {\n long u = 1, v = 1;\n for(var j=0;j> j) == 1)\n {\n for (var k = 0; k < n[j].x; k++)\n u *= n[k].v;\n for (var k = 0; k < n[j].y; k++)\n v *= n[k].v;\n }\n else\n {\n for (var k = 0; k < n[j].x; k++)\n v *= n[k].v;\n for (var k = 0; k < n[j].y; k++)\n u *= n[k].v;\n }\n if (r < u || u < l || r < v || v < l) continue;\n if (!ok.ContainsKey(u))\n ok[u] = new Dictionary();\n if (!ok[u].ContainsKey(v))\n {\n res++;\n ok[u][v] = true;\n }\n }\n WriteLine(res);\n }\n struct P\n {\n public long v, x, y;\n public P(long V,int X,int Y)\n {\n v = V;x = X;y = Y;\n }\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b044df5bd6692674efe08c346a2f556f", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task\n{\n class Program\n {\n static bool InRange(int l, int r, int x)\n {\n return x >= l && x <= r;\n }\n\n static void Main(string[] args)\n {\n var inpMas = Console.ReadLine().Split(' ').Select(item => int.Parse(item)).ToList();\n int l = inpMas[0];\n int r = inpMas[1];\n int x = inpMas[2];\n int y = inpMas[3];\n\n if (y % x != 0)\n {\n Console.WriteLine(0);\n return;\n }\n\n int i = 0;\n int ans = 0;\n int yx = y / x;\n int yx2 = yx;\n List divs = new List();\n int div = 2;\n\n int k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 >>= 1;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n\n div = 3;\n while (yx2 > 1)\n {\n k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 /= div;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n div += 2;\n }\n\n div = 1 << divs.Count;\n for (i = 1; i <= div; i ++)\n {\n int j = i;\n int div1 = 1;\n int ind = divs.Count - 1;\n while (j > 0)\n {\n if ((j & 1) == 1)\n {\n div1 *= divs[ind];\n ind -= 1;\n }\n j >>= 1;\n }\n int div2 = yx / div1;\n if (InRange(l, r, div1) && InRange(l, r, div2))\n ans += 1;\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "736223ac207722cb71c5a412727acb42", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "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 n = int.Parse(s[0]);\n k = int.Parse(s[1]);\n\n arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n }\n\n static Dictionary, long> dp = new Dictionary, long>();\n\n static long r(int l, int r, long s, long p)\n {\n Tuple lr = new Tuple(l, r);\n if (dp.ContainsKey(lr))\n return dp[lr];\n\n long e = 0;\n if (s * k == p)\n e++;\n\n\n\n dp[lr] = e;\n return e;\n }\n\n static int[] arr;\n static long k;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6a9cb7c19404107355dbe3f78b2265c0", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task\n{\n class Program\n {\n static bool InRange(int l, int r, int x)\n {\n return x >= l && x <= r;\n }\n\n static void Main(string[] args)\n {\n var inpMas = Console.ReadLine().Split(' ').Select(item => int.Parse(item)).ToList();\n int l = inpMas[0];\n int r = inpMas[1];\n int x = inpMas[2];\n int y = inpMas[3];\n\n int i = 0;\n int ans = 0;\n int yx = y / x;\n int yx2 = yx;\n List divs = new List();\n int div = 2;\n\n int k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 >>= 1;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n\n div = 3;\n while (yx2 > 1)\n {\n k = 0;\n while (yx2 % div == 0)\n {\n k += 1;\n yx2 /= div;\n }\n if (k > 0)\n divs.Add((int)Math.Pow(div, k));\n div += 2;\n }\n\n div = 1 << divs.Count;\n for (i = 1; i <= div; i ++)\n {\n int j = i;\n int div1 = 1;\n int ind = divs.Count - 1;\n while (j > 0)\n {\n if ((j & 1) == 1)\n {\n div1 *= divs[ind];\n ind -= 1;\n }\n j >>= 1;\n }\n int div2 = yx / div1;\n if (InRange(l, r, div1) && InRange(l, r, div2))\n ans += 1;\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "17e84465de36831af44958f230d56e76", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round14\n{\n class C\n {\n public static void Main()\n {\n long[] x1 = new long[4];\n long[] x2 = new long[4];\n long[] y1 = new long[4];\n long[] y2 = new long[4];\n for (int i = 0; i < 4; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n x1[i] = long.Parse(s[0]);\n y1[i] = long.Parse(s[1]);\n x2[i] = long.Parse(s[2]);\n y2[i] = long.Parse(s[3]);\n }\n int[] xPar = new int[4];\n int[] yPar = new int[4];\n int x = 0, y = 0;\n for (int i = 0; i < 4; i++)\n {\n if (x1[i] == x2[i])\n {\n yPar[y++] = i;\n\n if(y1[i] > y2[i])\n {\n long temp = y1[i];\n y1[i] = y2[i];\n y2[i] = temp;\n }\n }\n else if (y1[i] == y2[i])\n {\n xPar[x++] = i;\n\n if(x1[i] > x2[i])\n {\n long temp = x1[i];\n x1[i] = x2[i];\n x2[i] = temp;\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if (x != 2 || y != 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if (x1[yPar[0]] > x1[yPar[1]])\n {\n int temp = yPar[0];\n yPar[0] = yPar[1];\n yPar[1] = temp;\n }\n\n if (y1[xPar[0]] > y1[xPar[1]])\n {\n int temp = xPar[0];\n xPar[0] = xPar[1];\n xPar[1] = temp;\n }\n#if false\n Console.WriteLine(\"xPar[0]:({0},{2}) ({1},{3})\", x1[xPar[0]], x2[xPar[0]], y1[xPar[0]], y2[xPar[0]]);\n Console.WriteLine(\"xPar[1]:({0},{2}) ({1},{3})\", x1[xPar[1]], x2[xPar[1]], y1[xPar[1]], y2[xPar[1]]);\n Console.WriteLine(\"yPar[0]:({0},{2}) ({1},{3})\", x1[yPar[0]], x2[yPar[0]], y1[yPar[0]], y2[yPar[0]]);\n Console.WriteLine(\"yPar[1]:({0},{2}) ({1},{3})\", x1[yPar[1]], x2[yPar[1]], y1[yPar[1]], y2[yPar[1]]);\n#endif\n if (x1[yPar[0]] == x1[xPar[0]] && x1[yPar[0]] == x1[xPar[1]] &&\n x1[yPar[1]] == x2[xPar[0]] && x1[yPar[1]] == x2[xPar[1]] &&\n y1[xPar[0]] == y1[yPar[0]] && y1[xPar[0]] == y1[yPar[1]] &&\n y1[xPar[1]] == y2[yPar[0]] && y1[xPar[1]] == y2[yPar[1]])\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e6062020a4d05a0d6cd1e6bf09dcbe56", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_29\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool b=false;\n int[][] mas = new int[4][];\n for (int i = 0; i < 4; i++)\n {\n string s = Console.ReadLine();\n mas[i] = (from v in s.Split(' ') let q = int.Parse(v) select q).ToArray();\n }\n for (int i = 0; i < 4; i++)//point\n {\n if (mas[i][0] == mas[i][2] && mas[i][1] == mas[i][3])\n b = true;\n \n }\n if (b) { Console.WriteLine(\"NO\"); return; }\n for (int i = 0; i < 4; i++)//parall\n {\n if (mas[i][0] != mas[i][2] && mas[i][1] != mas[i][3])\n b = true;\n }\n if (b) { Console.WriteLine(\"NO\"); return; }\n int[,] connect = new int[4, 4];\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 4; j++)\n {\n connect[i, j] = -1;\n }\n\n for (int i = 0; i < 3; i++)//connect\n {\n bool zapis1 = false;\n bool zapis2 = false;\n \n for (int j = 0; j < 4; j++)\n {\n if (i == j) continue;\n if (mas[i][0] == mas[j][0] && mas[i][1] == mas[j][1])\n {\n if (connect[j, 2] == i) b = true;\n\n if (connect[j, 0] == -1)\n {\n connect[j, 0] = i;\n connect[j, 1] = i;\n zapis1 = true;\n }\n else\n b = true;\n }\n else\n if (mas[i][0] == mas[j][2] && mas[i][1] == mas[j][3])\n {\n if (connect[j, 0] == i) b = true;\n\n if (connect[j, 2] == -1)\n {\n connect[j, 2] = i;\n connect[j, 3] = i;\n zapis1 = true;\n }\n else\n b = true;\n }\n\n\n if (mas[i][2] == mas[j][0] && mas[i][3] == mas[j][1])\n {\n if (connect[j, 2] == i) b = true;\n if (connect[j, 0] == -1)\n {\n connect[j, 0] = i;\n connect[j, 1] = i;\n zapis2 = true;\n }\n else\n b = true;\n }\n else\n if (mas[i][2] == mas[j][2] && mas[i][3] == mas[j][3])\n {\n if (connect[j, 0] == i) b = true;\n\n if (connect[j, 2] == -1)\n {\n connect[j, 2] = i;\n connect[j, 3] = i;\n zapis2 = true;\n }\n else\n b = true;\n }\n\n\n }\n if (zapis1 && zapis2) { }\n else b = true;\n }\n if (b) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6794324256942843b263b620e1f5a625", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforce\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 public void WriteLine()\n {\n sb.AppendLine();\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 class Program\n {\n static StreamReader input = new StreamReader(Console.OpenStandardInput());\n //static StreamWriter output = new StreamWriter(Console.OpenStandardOutput());\n\n static int nextInt()\n {\n int t = input.Read();\n while ((t < '0' || t > '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 double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));\n }\n struct Point\n {\n public double x { get; set; }\n public double y { get; set; }\n\n public Point(double _x, double _y)\n : this()\n {\n x = _x;\n y = _y;\n }\n public double DistTo(Point p2)\n {\n return Dist(x, y, p2.x, p2.y);\n }\n }\n\n class Segment\n {\n public Point first { get; set; }\n public Point last { get; set; }\n\n public Segment()\n {\n\n }\n public Segment(Point f, Point l)\n {\n first = f;\n last = l;\n }\n\n public void Swap()\n {\n Point tmp = first;\n first = last;\n last = tmp;\n }\n }\n static bool[] used = new bool[4];\n\n static bool isP(int i, Segment[] P, int length)\n {\n if (!(P[i].first.x == P[i].last.x || P[i].first.y == P[i].last.y) || length > 5)\n return false;\n if (length == 5 && i == 0)\n return true;\n\n int j = i + 1 < 4 ? i + 1 : 0;\n if ((!used[j] || j == 0) && P[i].last.x == P[j].first.x && P[i].last.y == P[j].first.y && (P[j].first.x == P[j].last.x || P[j].first.y == P[j].last.y))\n {\n used[j] = true;\n return isP(j, P, length + 1);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n Printer printer = new Printer();\n\n List P = new List();\n\n Segment[] S = new Segment[4];\n\n int xmin = int.MaxValue, xmax = int.MinValue, ymin = int.MaxValue, ymax = int.MinValue;\n Dictionary D = new Dictionary();\n for (int i = 0; i < 4; i++)\n {\n var tmp = parseInt(Console.ReadLine());\n\n xmin = Math.Min(xmin, tmp[0]);\n xmin = Math.Min(xmin, tmp[2]);\n xmax = Math.Max(xmax, tmp[0]);\n xmax = Math.Max(xmax, tmp[2]);\n\n ymin = Math.Min(ymin, tmp[1]);\n ymin = Math.Min(ymin, tmp[3]);\n ymax = Math.Max(ymax, tmp[1]);\n ymax = Math.Max(ymax, tmp[3]);\n\n string f = tmp[0].ToString() + \" \" + tmp[1].ToString() ;\n if (D.Keys.Contains(f))\n {\n D[f]++;\n }\n else\n D[f] = 1;\n f = tmp[2].ToString() + \" \" + tmp[3].ToString();\n if (D.Keys.Contains(f))\n {\n D[f]++;\n }\n else\n D[f] = 1;\n P.Add(new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3])));\n }\n\n if (xmin == xmax || ymin == ymax || D.Count != 4)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = 0; i < 4; i++)\n {\n if (P[i].first.x == xmin && P[i].first.y == ymax && P[i].last.x == xmax && P[i].last.y == ymax\n || P[i].last.x == xmin && P[i].last.y == ymax && P[i].first.x == xmax && P[i].first.y == ymax)\n {\n used[1] = true;\n }\n if (P[i].first.x == xmin && P[i].first.y == ymin && P[i].last.x == xmin && P[i].last.y == ymax\n || P[i].last.x == xmin && P[i].last.y == ymin && P[i].first.x == xmin && P[i].first.y == ymax)\n {\n used[0] = true;\n }\n if (P[i].first.x == xmin && P[i].first.y == ymin && P[i].last.x == xmax && P[i].last.y == ymin\n || P[i].last.x == xmin && P[i].last.y == ymin && P[i].first.x == xmax && P[i].first.y == ymin)\n {\n used[2] = true;\n }\n if (P[i].first.x == xmax && P[i].first.y == ymin && P[i].last.x == xmin && P[i].last.y == ymin\n || P[i].last.x == xmax && P[i].last.y == ymin && P[i].first.x == xmin && P[i].first.y == ymin)\n {\n used[3] = true;\n }\n }\n\n for (int i = 0; i < 4; i++)\n {\n if (!used[i])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n printer.Print();\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "430798126677ec9a8525eadb9875796a", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_29\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool b=false;\n int[][] mas = new int[4][];\n for (int i = 0; i < 4; i++)\n {\n string s = Console.ReadLine();\n mas[i] = (from v in s.Split(' ') let q = int.Parse(v) select q).ToArray();\n }\n for (int i = 0; i < 4; i++)//point\n {\n if (mas[i][0] == mas[i][2] && mas[i][1] == mas[i][3])\n b = true;\n \n }\n if (b) { Console.WriteLine(\"NO\"); return; }\n for (int i = 0; i < 4; i++)//parall\n {\n if (mas[i][0] != mas[i][2] && mas[i][1] != mas[i][3])\n b = true;\n }\n if (b) { Console.WriteLine(\"NO\"); return; }\n int[,] connect = new int[4, 4];\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 4; j++)\n {\n connect[i, j] = -1;\n }\n\n for (int i = 0; i < 4; i++)//connect\n {\n bool zapis1 = false;\n bool zapis2 = false;\n \n for (int j = 0; j < 4; j++)\n {\n if (i == j) continue;\n if (mas[i][0] == mas[j][0] && mas[i][1] == mas[j][1])\n {\n if (connect[j, 2] == i) b = true;\n\n if (connect[j, 0] == -1)\n {\n connect[j, 0] = i;\n connect[j, 1] = i;\n zapis1 = true;\n }\n else\n b = true;\n }\n else\n if (mas[i][0] == mas[j][2] && mas[i][1] == mas[j][3])\n {\n if (connect[j, 0] == i) b = true;\n\n if (connect[j, 2] == -1)\n {\n connect[j, 2] = i;\n connect[j, 3] = i;\n zapis1 = true;\n }\n else\n b = true;\n }\n\n\n if (mas[i][2] == mas[j][0] && mas[i][3] == mas[j][1])\n {\n if (connect[j, 2] == i) b = true;\n if (connect[j, 0] == -1)\n {\n connect[j, 0] = i;\n connect[j, 1] = i;\n zapis2 = true;\n }\n else\n b = true;\n }\n else\n if (mas[i][2] == mas[j][2] && mas[i][3] == mas[j][3])\n {\n if (connect[j, 0] == i) b = true;\n\n if (connect[j, 2] == -1)\n {\n connect[j, 2] = i;\n connect[j, 3] = i;\n zapis2 = true;\n }\n else\n b = true;\n }\n\n\n }\n if (zapis1 && zapis2) { }\n else b = true;\n }\n if (b) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c68f0a2226648ea2abcdae81dc66bd63", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\n\n\nclass Program\n{\n class Point: IComparable\n {\n public int x, y;\n public Point(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n public int CompareTo(Point other)\n {\n if (other.x != x)\n return x - other.x;\n else\n return y - other.y;\n }\n public override bool Equals(object obj)\n {\n Point other = (Point)obj;\n return other.x == x && other.y == y;\n }\n }\n class Seg\n {\n public Point a, b;\n public Seg(Point a, Point b)\n {\n this.a = a;\n this.b = b;\n }\n public void revert()\n {\n Point temp = a;\n a = b;\n b = temp;\n }\n }\n void solve()\n {\n Seg[] seg = new Seg[4];\n for (int i = 0; i < 4; i++)\n {\n seg[i] = new Seg(new Point(nextInt(), nextInt()), new Point(nextInt(), nextInt()));\n }\n List vertical = new List();\n List horizontal = new List();\n foreach (Seg s in seg)\n {\n if (s.a.x == s.b.x)\n {\n vertical.Add(s);\n }\n else if (s.a.y == s.b.y)\n {\n horizontal.Add(s);\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if (vertical.Count < 2 || horizontal.Count < 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n foreach (Seg s in vertical)\n {\n if (s.a.y > s.b.y)\n s.revert();\n }\n foreach (Seg s in horizontal)\n {\n if (s.a.x < s.b.y)\n s.revert();\n }\n int height1 = vertical[0].b.y - vertical[0].a.y;\n int height2 = vertical[1].b.y - vertical[1].a.y;\n int width1 = horizontal[0].b.x - horizontal[0].a.x;\n int width2 = horizontal[1].b.x - horizontal[1].a.x;\n if (height1 != height2 || width1 != width2 || height1==0 || width1==0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (vertical[0].a.x > vertical[1].a.x)\n {\n Seg temp = vertical[0];\n vertical[0] = vertical[1];\n vertical[1] = temp;\n }\n if (horizontal[0].a.y > horizontal[1].a.y)\n {\n Seg temp = horizontal[0];\n horizontal[0] = horizontal[1];\n horizontal[1] = temp;\n }\n if (!vertical[0].a.Equals(horizontal[0].a))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (!vertical[0].b.Equals(horizontal[1].a))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n \n \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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8088ecd223b05af944c4e9d27452fe79", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "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@\"\n0 0 0 1\n0 1 0 2\n0 2 0 3\n0 3 0 0\n\");\n\n static void Main(string[] args)\n {\n bool b = true;\n Dictionary c = new Dictionary();\n List xs = new List();\n List ys = new List();\n for (int i = 0;i<4;i++)\n {\n string[] ss = CF.ReadLine().Split(' ');\n int x1 = int.Parse(ss[0]);\n int y1 = int.Parse(ss[1]);\n int x2 = int.Parse(ss[2]);\n int y2 = int.Parse(ss[3]);\n\n if (!_l(x1, y1, x2, y2))\n {\n b = false;\n break;\n }\n\n string p1 = x1 +\",\"+ y1;\n if (!c.ContainsKey(p1))\n c.Add(p1, 0);\n c[p1]++;\n\n string p2 = x2 + \",\" + y2;\n if (!c.ContainsKey(p2))\n c.Add(p2, 0);\n c[p2]++;\n\n if( !xs.Contains(x1) )\n xs.Add(x1);\n if (!xs.Contains(x2))\n xs.Add(x2);\n if (!ys.Contains(y1))\n ys.Add(y1);\n if (!ys.Contains(y2))\n ys.Add(y2);\n }\n\n if (b)\n {\n if (xs.Count != 2 || ys.Count != 2)\n b = false;\n else if (c.Count != 4)\n b = false;\n else\n {\n foreach (int v in c.Values)\n {\n if (v != 2)\n {\n b=false;\n break;\n }\n }\n }\n }\n\n if (b)\n CF.WriteLine(\"YES\");\n else\n CF.WriteLine(\"NO\");\n\n\n }\n\n static bool _l(int x1,int y1,int x2,int y2)\n {\n if( x1!=x2&&y1!=y2)\n return false;\n if (x1 == x2 && y1 == y2)\n return false;\n return true;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dde678d53eebe82f26e6c1bc9067c4b6", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round14\n{\n class C\n {\n public static void Main()\n {\n long[] x1 = new long[4];\n long[] x2 = new long[4];\n long[] y1 = new long[4];\n long[] y2 = new long[4];\n for (int i = 0; i < 4; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n x1[i] = long.Parse(s[0]);\n y1[i] = long.Parse(s[1]);\n x2[i] = long.Parse(s[2]);\n y2[i] = long.Parse(s[3]);\n }\n long minX = Math.Min(x1.Min(), x2.Min());\n long maxX = Math.Max(x1.Max(), x2.Max());\n long minY = Math.Min(y1.Min(), y2.Min());\n long maxY = Math.Max(y1.Max(), y2.Max());\n\n if (minX == maxX && minY == maxY)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n int[] xPar = new int[4];\n int[] yPar = new int[4];\n int x = 0, y = 0;\n for (int i = 0; i < 4; i++)\n {\n if (x1[i] == x2[i])\n {\n yPar[y++] = i;\n\n if(y1[i] > y2[i])\n {\n long temp = y1[i];\n y1[i] = y2[i];\n y2[i] = temp;\n }\n }\n else if (y1[i] == y2[i])\n {\n xPar[x++] = i;\n\n if(x1[i] > x2[i])\n {\n long temp = x1[i];\n x1[i] = x2[i];\n x2[i] = temp;\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if (x != 2 || y != 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if (x1[yPar[0]] > x1[yPar[1]])\n {\n int temp = yPar[0];\n yPar[0] = yPar[1];\n yPar[1] = temp;\n }\n\n if (y1[xPar[0]] > y1[xPar[1]])\n {\n int temp = xPar[0];\n xPar[0] = xPar[1];\n xPar[1] = temp;\n }\n#if false\n Console.WriteLine(\"xPar[0]:({0},{2}) ({1},{3})\", x1[xPar[0]], x2[xPar[0]], y1[xPar[0]], y2[xPar[0]]);\n Console.WriteLine(\"xPar[1]:({0},{2}) ({1},{3})\", x1[xPar[1]], x2[xPar[1]], y1[xPar[1]], y2[xPar[1]]);\n Console.WriteLine(\"yPar[0]:({0},{2}) ({1},{3})\", x1[yPar[0]], x2[yPar[0]], y1[yPar[0]], y2[yPar[0]]);\n Console.WriteLine(\"yPar[1]:({0},{2}) ({1},{3})\", x1[yPar[1]], x2[yPar[1]], y1[yPar[1]], y2[yPar[1]]);\n#endif\n if (x1[yPar[0]] == x1[xPar[0]] && x1[yPar[0]] == x1[xPar[1]] &&\n x1[yPar[1]] == x2[xPar[0]] && x1[yPar[1]] == x2[xPar[1]] &&\n y1[xPar[0]] == y1[yPar[0]] && y1[xPar[0]] == y1[yPar[1]] &&\n y1[xPar[1]] == y2[yPar[0]] && y1[xPar[1]] == y2[yPar[1]])\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "31b923daae5946cb7c3b254cec4e0b26", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforce\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 public void WriteLine()\n {\n sb.AppendLine();\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 class Program\n {\n static StreamReader input = new StreamReader(Console.OpenStandardInput());\n //static StreamWriter output = new StreamWriter(Console.OpenStandardOutput());\n\n static int nextInt()\n {\n int t = input.Read();\n while ((t < '0' || t > '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 double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));\n }\n struct Point\n {\n public double x { get; set; }\n public double y { get; set; }\n\n public Point(double _x, double _y)\n : this()\n {\n x = _x;\n y = _y;\n }\n public double DistTo(Point p2)\n {\n return Dist(x, y, p2.x, p2.y);\n }\n }\n\n class Segment\n {\n public Point first { get; set; }\n public Point last { get; set; }\n\n public Segment()\n {\n\n }\n public Segment(Point f, Point l)\n {\n first = f;\n last = l;\n }\n\n public void Swap()\n {\n Point tmp = first;\n first = last;\n last = tmp;\n }\n }\n static bool[] used = new bool[4];\n\n static bool isP(int i, Segment[] P, int length)\n {\n if (!(P[i].first.x == P[i].last.x || P[i].first.y == P[i].last.y) || length > 5)\n return false;\n if (length == 5 && i == 0)\n return true;\n\n int j = i + 1 < 4 ? i + 1 : 0;\n if ((!used[j] || j == 0) && P[i].last.x == P[j].first.x && P[i].last.y == P[j].first.y && (P[j].first.x == P[j].last.x || P[j].first.y == P[j].last.y))\n {\n used[j] = true;\n return isP(j, P, length + 1);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n Printer printer = new Printer();\n\n List P = new List();\n\n Segment[] S = new Segment[4];\n\n for (int i = 0; i < 4; i++)\n {\n var tmp = parseInt(Console.ReadLine());\n\n if (tmp[1] == tmp[3])\n {\n if (tmp[2] == tmp[0])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (S[0] != null && S[0].first.y < tmp[1])\n {\n S[2] = S[0];\n S[0] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if (S[0] != null && S[0].first.y >= tmp[1])\n {\n if (S[0].first.y == tmp[1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n S[2] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if(S[0] == null)\n {\n S[0] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n }\n if (tmp[0] == tmp[2])\n {\n if (tmp[1] == tmp[3])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (S[1] != null && S[1].first.x < tmp[0])\n {\n S[3] = S[1];\n S[1] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if (S[1] != null && S[1].first.x >= tmp[0])\n {\n if (S[1].first.y == tmp[0])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n S[3] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if (S[1] == null)\n {\n S[1] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n }\n //P.Add(new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3])));\n }\n\n if (S[0].first.x > S[0].last.x)\n S[0].Swap();\n if (S[1].first.y < S[1].last.y)\n S[1].Swap();\n if (S[2].first.x < S[2].last.x)\n S[2].Swap();\n if (S[3].first.y > S[3].last.y)\n S[3].Swap();\n\n used[0] = true;\n bool tf = isP(0, S, 1);\n\n string res = tf ? \"YES\" : \"NO\";\n\n printer.WriteLine(res);\n\n printer.Print();\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a1f21ab96dfdd388ddf7a4036a0a7d2", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "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@\"\n0 0 0 3\n2 0 0 0\n2 2 2 0\n0 2 2 2\n\");\n\n static void Main(string[] args)\n {\n bool b = true;\n Dictionary c = new Dictionary();\n for (int i = 0;i<4;i++)\n {\n string[] ss = CF.ReadLine().Split(' ');\n int x1 = int.Parse(ss[0]);\n int y1 = int.Parse(ss[1]);\n int x2 = int.Parse(ss[2]);\n int y2 = int.Parse(ss[3]);\n\n if (!_l(x1, y1, x2, y2))\n {\n b = false;\n break;\n }\n\n string p1 = x1 +\",\"+ y1;\n if (!c.ContainsKey(p1))\n c.Add(p1, 0);\n c[p1]++;\n\n string p2 = x2 + \",\" + y2;\n if (!c.ContainsKey(p2))\n c.Add(p2, 0);\n c[p2]++;\n }\n\n if (b)\n {\n if (c.Count != 4)\n b = false;\n else\n {\n foreach (int v in c.Values)\n {\n if (v != 2)\n {\n b=false;\n break;\n }\n }\n }\n }\n\n if (b)\n CF.WriteLine(\"YES\");\n else\n CF.WriteLine(\"NO\");\n\n\n }\n\n static bool _l(int x1,int y1,int x2,int y2)\n {\n if( x1!=x2&&y1!=y2)\n return false;\n if (x1 == x2 && y1 == y2)\n return false;\n return true;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "14629c4bc82bf91ad1f4167024c6c157", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Contest_14\n{\n class Program\n {\n static void A()\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int m = int.Parse(t[1]);\n\n int x1 = int.MaxValue, x2 = int.MinValue, y1 = int.MaxValue, y2 = int.MinValue;\n List a = new List();\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n a.Add(s);\n for (int j = 0; j < m; j++)\n {\n if (s[j] == '*')\n {\n if (x1 > i)\n x1 = i;\n if (x2 < i)\n x2 = i;\n if (y1 > j)\n y1 = j;\n if (y2 < j)\n y2 = j;\n }\n }\n }\n\n for (int i = x1; i <= x2; i++)\n {\n for (int j = y1; j <= y2; j++)\n {\n Console.Write(a[i][j]);\n }\n Console.WriteLine();\n }\n }\n\n static void B()\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int x = int.Parse(t[1]);\n\n int min = int.MaxValue;\n int max = int.MinValue;\n int[] a = new int[1001];\n for (int i = 0; i < n; i++)\n {\n t = Console.ReadLine().Split(' ');\n int k = int.Parse(t[0]);\n int l = int.Parse(t[1]);\n\n if (k > l)\n {\n int q = k;\n k = l;\n l = q;\n }\n if (i == 0)\n {\n min = k;\n max = l;\n continue;\n }\n if (k > min)\n {\n min = k;\n }\n if (l < max)\n max = l;\n }\n if (max < min)\n {\n Console.WriteLine(-1);\n return;\n }\n if ((x >= min) && (x <= max))\n Console.WriteLine(0);\n else\n Console.WriteLine(Math.Min(Math.Abs(min - x), Math.Abs(max - x)));\n }\n\n class Point : IComparer\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 int Compare(Point p1, Point p2)\n {\n if (p1.x != p2.x)\n return p1.x.CompareTo(p2.x);\n else\n return p1.y.CompareTo(p2.y);\n }\n\n public bool isGood (Point p)\n {\n if ((x == p.x) && (y != p.y))\n return true;\n if ((y == p.y) && (x != p.x))\n return true;\n return false;\n }\n\n public void deleteInList(List b)\n {\n for (int j = 0; j < b.Count; j++)\n {\n Point temp = b[j];\n if ((temp.x == this.x) && (temp.y == this.y))\n {\n b.RemoveAt(j);\n break;\n }\n }\n\n }\n\n }\n\n static void C()\n {\n List a = new List();\n for (int i = 0; i < 4; i++)\n {\n var t = Console.ReadLine().Split(' ');\n a.Add(new int[] {int.Parse(t[0]),int.Parse(t[1]),int.Parse(t[2]),int.Parse(t[3])});\n }\n\n List b = new List();\n\n int xl = int.MaxValue, yl = int.MinValue, xr = int.MinValue, yr = int.MaxValue;\n\n for (int i = 0; i < 4; i++)\n {\n int[] t = a[i];\n Point l1 = new Point(t[0], t[1]);\n Point l2 = new Point(t[2], t[3]);\n b.Add(l1);\n b.Add(l2);\n if (t[0] < xl)\n xl = t[0];\n if (t[1] > yl)\n yl = t[1];\n if (t[2] > xr)\n xr = t[2];\n if (t[3] < yr)\n yr = t[3];\n if (!l1.isGood(l2))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n\n Point p1 = new Point(xl, yl);\n Point p2 = new Point(xr, yr);\n\n for (int i = 0; i < 2; i++)\n {\n p1.deleteInList(b);\n p2.deleteInList(b);\n new Point(p1.x, p2.y).deleteInList(b);\n new Point(p2.x, p1.y).deleteInList(b);\n }\n if (b.Count > 0)\n Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"C:\\1.txt\"));\n C();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "960bf5d7f662f8d60e864978cc433661", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\n\n\nclass Program\n{\n class Point: IComparable\n {\n public int x, y;\n public Point(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n public int CompareTo(Point other)\n {\n if (other.x != x)\n return x - other.x;\n else\n return y - other.y;\n }\n public override bool Equals(object obj)\n {\n Point other = (Point)obj;\n return other.x == x && other.y == y;\n }\n }\n class Seg\n {\n public Point a, b;\n public Seg(Point a, Point b)\n {\n this.a = a;\n this.b = b;\n }\n public void revert()\n {\n Point temp = a;\n a = b;\n b = temp;\n }\n }\n void solve()\n {\n Seg[] seg = new Seg[4];\n for (int i = 0; i < 4; i++)\n {\n seg[i] = new Seg(new Point(nextInt(), nextInt()), new Point(nextInt(), nextInt()));\n }\n List vertical = new List();\n List horizontal = new List();\n foreach (Seg s in seg)\n {\n if (s.a.x == s.b.x)\n {\n vertical.Add(s);\n }\n else if (s.a.y == s.b.y)\n {\n horizontal.Add(s);\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if (vertical.Count < 2 || horizontal.Count < 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n foreach (Seg s in vertical)\n {\n if (s.a.y > s.b.y)\n s.revert();\n }\n foreach (Seg s in horizontal)\n {\n if (s.a.x < s.b.y)\n s.revert();\n }\n int height1 = vertical[0].b.y - vertical[0].a.y;\n int height2 = vertical[1].b.y - vertical[1].a.y;\n int width1 = horizontal[0].b.x - horizontal[0].a.x;\n int width2 = horizontal[1].b.x - horizontal[1].a.x;\n if (height1 != height2 || width1 != width2 || height1==0 || width1==0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (vertical[0].a.x > vertical[1].a.x)\n {\n Seg temp = vertical[0];\n vertical[0] = vertical[1];\n vertical[1] = temp;\n }\n if (horizontal[0].a.y > horizontal[1].a.y)\n {\n Seg temp = horizontal[0];\n horizontal[0] = horizontal[1];\n horizontal[1] = temp;\n }\n if (!vertical[0].a.Equals(horizontal[0].a))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (!vertical[0].b.Equals(horizontal[1].a))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (!vertical[1].a.Equals(horizontal[0].b))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (!vertical[1].b.Equals(horizontal[1].b))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n \n \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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e4b322737f88763b00a89e28c4fc2d8", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_29\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool b=false;\n int[][] mas = new int[4][];\n for (int i = 0; i < 4; i++)\n {\n string s = Console.ReadLine();\n mas[i] = (from v in s.Split(' ') let q = int.Parse(v) select q).ToArray();\n }\n for (int i = 0; i < 4; i++)//point\n {\n if (mas[i][0] == mas[i][2] && mas[i][1] == mas[i][3])\n b = true;\n \n }\n if (b) { Console.WriteLine(\"NO1\"); return; }\n for (int i = 0; i < 4; i++)//parall\n {\n if (mas[i][0] != mas[i][2] && mas[i][1] != mas[i][3])\n b = true;\n }\n if (b) { Console.WriteLine(\"NO2\"); return; }\n int[,] connect = new int[4, 4];\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 4; j++)\n {\n connect[i, j] = -1;\n }\n\n for (int i = 0; i < 4; i++)//connect\n {\n bool zapis1 = false;\n bool zapis2 = false;\n \n for (int j = 0; j < 4; j++)\n {\n if (i == j) continue;\n if (mas[i][0] == mas[j][0] && mas[i][1] == mas[j][1])\n {\n if (connect[j, 2] == i) b = true;\n\n if (connect[j, 0] == -1)\n {\n connect[j, 0] = i;\n connect[j, 1] = i;\n zapis1 = true;\n }\n else\n b = true;\n }\n else\n if (mas[i][0] == mas[j][2] && mas[i][1] == mas[j][3])\n {\n if (connect[j, 0] == i) b = true;\n\n if (connect[j, 2] == -1)\n {\n connect[j, 2] = i;\n connect[j, 3] = i;\n zapis1 = true;\n }\n else\n b = true;\n }\n\n\n if (mas[i][2] == mas[j][0] && mas[i][3] == mas[j][1])\n {\n if (connect[j, 2] == i) b = true;\n if (connect[j, 0] == -1)\n {\n connect[j, 0] = i;\n connect[j, 1] = i;\n zapis2 = true;\n }\n else\n b = true;\n }\n else\n if (mas[i][2] == mas[j][2] && mas[i][3] == mas[j][3])\n {\n if (connect[j, 0] == i) b = true;\n\n if (connect[j, 2] == -1)\n {\n connect[j, 2] = i;\n connect[j, 3] = i;\n zapis2 = true;\n }\n else\n b = true;\n }\n\n\n }\n if (zapis1 && zapis2) { }\n else b = true;\n }\n if (b) Console.WriteLine(\"NO3\");\n else Console.WriteLine(\"YES\");\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c33fe5f2091c32a197fff291bb19d719", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforce\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 public void WriteLine()\n {\n sb.AppendLine();\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 class Program\n {\n static StreamReader input = new StreamReader(Console.OpenStandardInput());\n //static StreamWriter output = new StreamWriter(Console.OpenStandardOutput());\n\n static int nextInt()\n {\n int t = input.Read();\n while ((t < '0' || t > '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 double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));\n }\n struct Point\n {\n public double x { get; set; }\n public double y { get; set; }\n\n public Point(double _x, double _y)\n : this()\n {\n x = _x;\n y = _y;\n }\n public double DistTo(Point p2)\n {\n return Dist(x, y, p2.x, p2.y);\n }\n }\n\n class Segment\n {\n public Point first { get; set; }\n public Point last { get; set; }\n\n public Segment()\n {\n\n }\n public Segment(Point f, Point l)\n {\n first = f;\n last = l;\n }\n\n public void Swap()\n {\n Point tmp = first;\n first = last;\n last = tmp;\n }\n }\n static bool[] used = new bool[4];\n\n static bool isP(int i, Segment[] P, int length)\n {\n if (!(P[i].first.x == P[i].last.x || P[i].first.y == P[i].last.y) || length > 5)\n return false;\n if (length == 5 && i == 0)\n return true;\n\n int j = i + 1 < 4 ? i + 1 : 0;\n if ((!used[j] || j == 0) && P[i].last.x == P[j].first.x && P[i].last.y == P[j].first.y && (P[j].first.x == P[j].last.x || P[j].first.y == P[j].last.y))\n {\n used[j] = true;\n return isP(j, P, length + 1);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n Printer printer = new Printer();\n\n List P = new List();\n\n Segment[] S = new Segment[4];\n\n for (int i = 0; i < 4; i++)\n {\n var tmp = parseInt(Console.ReadLine());\n\n if (tmp[1] == tmp[3])\n {\n if (tmp[2] == tmp[0])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (S[0] != null && S[0].first.y < tmp[1])\n {\n S[2] = S[0];\n S[0] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if (S[0] != null && S[0].first.y >= tmp[1])\n {\n S[2] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if(S[0] == null)\n {\n S[0] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n }\n if (tmp[0] == tmp[2])\n {\n if (tmp[1] == tmp[3])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (S[1] != null && S[1].first.x < tmp[0])\n {\n S[3] = S[1];\n S[1] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if (S[1] != null && S[1].first.x >= tmp[0])\n {\n S[3] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if (S[1] == null)\n {\n S[1] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n }\n //P.Add(new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3])));\n }\n\n if (S[0].first.x > S[0].last.x)\n S[0].Swap();\n if (S[1].first.y < S[1].last.y)\n S[1].Swap();\n if (S[2].first.x < S[2].last.x)\n S[2].Swap();\n if (S[3].first.y > S[3].last.y)\n S[3].Swap();\n\n used[0] = true;\n bool tf = isP(0, S, 1);\n\n string res = tf ? \"YES\" : \"NO\";\n\n printer.WriteLine(res);\n\n printer.Print();\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "595c7307e4ec8fa9967c47d82444b24e", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforce\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 public void WriteLine()\n {\n sb.AppendLine();\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 class Program\n {\n static StreamReader input = new StreamReader(Console.OpenStandardInput());\n //static StreamWriter output = new StreamWriter(Console.OpenStandardOutput());\n\n static int nextInt()\n {\n int t = input.Read();\n while ((t < '0' || t > '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 double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));\n }\n struct Point\n {\n public double x { get; set; }\n public double y { get; set; }\n\n public Point(double _x, double _y)\n : this()\n {\n x = _x;\n y = _y;\n }\n public double DistTo(Point p2)\n {\n return Dist(x, y, p2.x, p2.y);\n }\n }\n\n class Segment\n {\n public Point first { get; set; }\n public Point last { get; set; }\n\n public Segment()\n {\n\n }\n public Segment(Point f, Point l)\n {\n first = f;\n last = l;\n }\n\n public void Swap()\n {\n Point tmp = first;\n first = last;\n last = tmp;\n }\n }\n static bool[] used = new bool[4];\n\n static bool isP(int i, Segment[] P, int length)\n {\n if (!(P[i].first.x == P[i].last.x || P[i].first.y == P[i].last.y))\n return false;\n if (length == 5 && i == 0)\n return true;\n\n int j = i + 1 < 4 ? i + 1 : 0;\n if ((!used[j] || j == 0) && P[i].last.x == P[j].first.x && P[i].last.y == P[j].first.y && (P[j].first.x == P[j].last.x || P[j].first.y == P[j].last.y))\n {\n used[j] = true;\n return isP(j, P, length + 1);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n Printer printer = new Printer();\n\n List P = new List();\n\n Segment[] S = new Segment[4];\n\n for (int i = 0; i < 4; i++)\n {\n var tmp = parseInt(Console.ReadLine());\n\n if (tmp[1] == tmp[3])\n {\n if (S[0] != null && S[0].first.y < tmp[1])\n {\n S[2] = S[0];\n S[0] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if (S[0] != null && S[0].first.y > tmp[1])\n {\n S[2] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if(S[0] == null)\n {\n S[0] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n }\n if (tmp[0] == tmp[2])\n {\n if (S[1] != null && S[1].first.x < tmp[0])\n {\n S[3] = S[1];\n S[1] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if (S[1] != null && S[1].first.x > tmp[0])\n {\n S[3] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n else if (S[1] == null)\n {\n S[1] = new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3]));\n }\n }\n //P.Add(new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3])));\n }\n\n if (S[0].first.x > S[0].last.x)\n S[0].Swap();\n if (S[1].first.y < S[1].last.y)\n S[1].Swap();\n if (S[2].first.x < S[2].last.x)\n S[2].Swap();\n if (S[3].first.y > S[3].last.y)\n S[3].Swap();\n\n used[0] = true;\n bool tf = isP(0, S, 1);\n\n string res = tf ? \"YES\" : \"NO\";\n\n printer.WriteLine(res);\n\n printer.Print();\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c0c2b6c9c61263020b90454de868caa1", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Contest_14\n{\n class Program\n {\n static void A()\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int m = int.Parse(t[1]);\n\n int x1 = int.MaxValue, x2 = int.MinValue, y1 = int.MaxValue, y2 = int.MinValue;\n List a = new List();\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n a.Add(s);\n for (int j = 0; j < m; j++)\n {\n if (s[j] == '*')\n {\n if (x1 > i)\n x1 = i;\n if (x2 < i)\n x2 = i;\n if (y1 > j)\n y1 = j;\n if (y2 < j)\n y2 = j;\n }\n }\n }\n\n for (int i = x1; i <= x2; i++)\n {\n for (int j = y1; j <= y2; j++)\n {\n Console.Write(a[i][j]);\n }\n Console.WriteLine();\n }\n }\n\n static void B()\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int x = int.Parse(t[1]);\n\n int min = int.MaxValue;\n int max = int.MinValue;\n int[] a = new int[1001];\n for (int i = 0; i < n; i++)\n {\n t = Console.ReadLine().Split(' ');\n int k = int.Parse(t[0]);\n int l = int.Parse(t[1]);\n\n if (k > l)\n {\n int q = k;\n k = l;\n l = q;\n }\n if (i == 0)\n {\n min = k;\n max = l;\n continue;\n }\n if (k > min)\n {\n min = k;\n }\n if (l < max)\n max = l;\n }\n if (max < min)\n {\n Console.WriteLine(-1);\n return;\n }\n if ((x >= min) && (x <= max))\n Console.WriteLine(0);\n else\n Console.WriteLine(Math.Min(Math.Abs(min - x), Math.Abs(max - x)));\n }\n\n class Point : IComparer\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 int Compare(Point p1, Point p2)\n {\n if (p1.x != p2.x)\n return p1.x.CompareTo(p2.x);\n else\n return p1.y.CompareTo(p2.y);\n }\n\n public bool isGood (Point p)\n {\n if ((x == p.x) && (y != p.y))\n return true;\n if ((y == p.y) && (x != p.x))\n return true;\n return false;\n }\n\n public void deleteInList(List b)\n {\n for (int j = 0; j < b.Count; j++)\n {\n Point temp = b[j];\n if ((temp.x == this.x) && (temp.y == this.y))\n {\n b.RemoveAt(j);\n break;\n }\n }\n\n }\n\n }\n\n static void C()\n {\n List a = new List();\n for (int i = 0; i < 4; i++)\n {\n var t = Console.ReadLine().Split(' ');\n a.Add(new int[] {int.Parse(t[0]),int.Parse(t[1]),int.Parse(t[2]),int.Parse(t[3])});\n }\n\n List b = new List();\n\n int xl = int.MaxValue, yl = int.MinValue, xr = int.MinValue, yr = int.MaxValue;\n\n for (int i = 0; i < 4; i++)\n {\n int[] t = a[i];\n Point l1 = new Point(t[0], t[1]);\n Point l2 = new Point(t[2], t[3]);\n b.Add(l1);\n b.Add(l2);\n if (t[0] < xl)\n xl = t[0];\n if (t[1] > yl)\n yl = t[1];\n if (t[2] > xr)\n xr = t[2];\n if (t[3] < yr)\n yr = t[3];\n if (!l1.isGood(l2))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n\n Point p1 = new Point(xl, yl);\n Point p2 = new Point(xr, yr);\n\n for (int i = 0; i < 2; i++)\n {\n p1.deleteInList(b);\n p2.deleteInList(b);\n new Point(p1.x, p2.y).deleteInList(b);\n new Point(p2.x, p1.y).deleteInList(b);\n }\n if (b.Count > 0)\n Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n\n static void Main(string[] args)\n {\n Console.SetIn(new StreamReader(@\"C:\\1.txt\"));\n C();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c0714d37ac1e7f19618faf7c5c939030", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Contest_14\n{\n class Program\n {\n static void A()\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int m = int.Parse(t[1]);\n\n int x1 = int.MaxValue, x2 = int.MinValue, y1 = int.MaxValue, y2 = int.MinValue;\n List a = new List();\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n a.Add(s);\n for (int j = 0; j < m; j++)\n {\n if (s[j] == '*')\n {\n if (x1 > i)\n x1 = i;\n if (x2 < i)\n x2 = i;\n if (y1 > j)\n y1 = j;\n if (y2 < j)\n y2 = j;\n }\n }\n }\n\n for (int i = x1; i <= x2; i++)\n {\n for (int j = y1; j <= y2; j++)\n {\n Console.Write(a[i][j]);\n }\n Console.WriteLine();\n }\n }\n\n static void B()\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int x = int.Parse(t[1]);\n\n int min = int.MaxValue;\n int max = int.MinValue;\n int[] a = new int[1001];\n for (int i = 0; i < n; i++)\n {\n t = Console.ReadLine().Split(' ');\n int k = int.Parse(t[0]);\n int l = int.Parse(t[1]);\n\n if (k > l)\n {\n int q = k;\n k = l;\n l = q;\n }\n if (i == 0)\n {\n min = k;\n max = l;\n continue;\n }\n if (k > min)\n {\n min = k;\n }\n if (l < max)\n max = l;\n }\n if (max < min)\n {\n Console.WriteLine(-1);\n return;\n }\n if ((x >= min) && (x <= max))\n Console.WriteLine(0);\n else\n Console.WriteLine(Math.Min(Math.Abs(min - x), Math.Abs(max - x)));\n }\n\n class Point : IComparer\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 int Compare(Point p1, Point p2)\n {\n if (p1.x != p2.x)\n return p1.x.CompareTo(p2.x);\n else\n return p1.y.CompareTo(p2.y);\n }\n\n public bool isGood (Point p)\n {\n if ((x == p.x) && (y != p.y))\n return true;\n if ((y == p.y) && (x != p.x))\n return true;\n return false;\n }\n\n public void deleteInList(List b)\n {\n for (int j = 0; j < b.Count; j++)\n {\n Point temp = b[j];\n if ((temp.x == this.x) && (temp.y == this.y))\n {\n b.RemoveAt(j);\n break;\n }\n }\n\n }\n\n }\n\n static void C()\n {\n List a = new List();\n\n for (int i = 0; i < 4; i++)\n {\n var t = Console.ReadLine().Split(' ');\n var t1 = new int[] { int.Parse(t[0]), int.Parse(t[1]), int.Parse(t[2]), int.Parse(t[3]) };\n for (int j = 0; j < a.Count; j++)\n {\n var k = a[j];\n\n if ((k[0] == t1[0]) && (k[1] == t1[1]) && (k[2] == t1[2]) && (k[3] == t1[3]))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if ((k[2] == t1[0]) && (k[3] == t1[1]) && (k[0] == t1[2]) && (k[1] == t1[3]))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n a.Add(t1);\n\n \n }\n\n List b = new List();\n\n int xl = int.MaxValue, yl = int.MinValue, xr = int.MinValue, yr = int.MaxValue;\n\n for (int i = 0; i < 4; i++)\n {\n int[] t = a[i];\n Point l1 = new Point(t[0], t[1]);\n Point l2 = new Point(t[2], t[3]);\n b.Add(l1);\n b.Add(l2);\n if (t[0] < xl)\n xl = t[0];\n if (t[1] > yl)\n yl = t[1];\n if (t[2] > xr)\n xr = t[2];\n if (t[3] < yr)\n yr = t[3];\n if (!l1.isGood(l2))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n\n Point p1 = new Point(xl, yl);\n Point p2 = new Point(xr, yr);\n\n for (int i = 0; i < 2; i++)\n {\n p1.deleteInList(b);\n p2.deleteInList(b);\n new Point(p1.x, p2.y).deleteInList(b);\n new Point(p2.x, p1.y).deleteInList(b);\n }\n if (b.Count > 0)\n Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n\n static void Main(string[] args)\n {\n Console.SetIn(new StreamReader(@\"C:\\1.txt\"));\n C();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e79d452ca21e76a3fef931bb2fb464b2", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\n\n\nclass Program\n{\n class Point: IComparable\n {\n public int x, y;\n public Point(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n public int CompareTo(Point other)\n {\n if (other.x != x)\n return x - other.x;\n else\n return y - other.y;\n }\n public override bool Equals(object obj)\n {\n Point other = (Point)obj;\n return other.x == x && other.y == y;\n }\n }\n class Seg\n {\n public Point a, b;\n public Seg(Point a, Point b)\n {\n this.a = a;\n this.b = b;\n }\n public void revert()\n {\n Point temp = a;\n a = b;\n b = temp;\n }\n }\n void solve()\n {\n Seg[] seg = new Seg[4];\n for (int i = 0; i < 4; i++)\n {\n seg[i] = new Seg(new Point(nextInt(), nextInt()), new Point(nextInt(), nextInt()));\n }\n List vertical = new List();\n List horizontal = new List();\n foreach (Seg s in seg)\n {\n if (s.a.x == s.b.x)\n {\n vertical.Add(s);\n }\n else if (s.a.y == s.b.y)\n {\n horizontal.Add(s);\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if (vertical.Count < 2 || horizontal.Count < 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n foreach (Seg s in vertical)\n {\n if (s.a.y > s.b.y)\n s.revert();\n }\n foreach (Seg s in horizontal)\n {\n if (s.a.x > s.b.x)\n s.revert();\n }\n int height1 = vertical[0].b.y - vertical[0].a.y;\n int height2 = vertical[1].b.y - vertical[1].a.y;\n int width1 = horizontal[0].b.x - horizontal[0].a.x;\n int width2 = horizontal[1].b.x - horizontal[1].a.x;\n if (height1 != height2 || width1 != width2 || height1==0 || width1==0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (vertical[0].a.x > vertical[1].a.x)\n {\n Seg temp = vertical[0];\n vertical[0] = vertical[1];\n vertical[1] = temp;\n }\n if (horizontal[0].a.y > horizontal[1].a.y)\n {\n Seg temp = horizontal[0];\n horizontal[0] = horizontal[1];\n horizontal[1] = temp;\n }\n if (!vertical[0].a.Equals(horizontal[0].a))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (!vertical[0].b.Equals(horizontal[1].a))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (!vertical[1].a.Equals(horizontal[0].b))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (!vertical[1].b.Equals(horizontal[1].b))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n \n \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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e357b85d68ef0f0399b3f51ccf61c600", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "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 public static string NextToken()\n {\n StringBuilder ret = new StringBuilder();\n char c;\n\n while (char.IsWhiteSpace(c = (char)Console.Read())) ;\n do\n {\n ret.Append(c);\n } while (!char.IsWhiteSpace(c = (char)Console.Read()));\n\n return ret.ToString();\n }\n }\n\n class Program\n {\n static void No()\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n\n static void Main(string[] args)\n {\n List> X, Y;\n\n X = new List>();\n Y = new List>();\n X.Add(new List());\n Y.Add(new List());\n\n for (int i = 0; i < 4; ++i)\n {\n int x1, y1, x2, y2;\n\n x1 = Reader.NextInt();\n y1 = Reader.NextInt();\n x2 = Reader.NextInt();\n y2 = Reader.NextInt();\n\n bool xeq = x1 == x2, yeq = y1 == y2;\n if (!(xeq ^ yeq))\n No();\n else if (xeq)\n {\n X[0].Add(x1);\n Y.Add(new List(new int[] { y1, y2 }));\n }\n else\n {\n Y[0].Add(y1);\n X.Add(new List(new int[] { x1, x2 }));\n }\n }\n\n if (X.Count != 3 || Y.Count != 3)\n No();\n\n for (int i = 0; i < X.Count; ++i)\n {\n X[i].Sort();\n if (X[i].Count != X[0].Count)\n No();\n for (int j = 0; j < X[i].Count; ++j)\n if (X[i][j] != X[0][j])\n No();\n }\n for (int i = 0; i < Y.Count; ++i)\n {\n Y[i].Sort();\n if (Y[i].Count != Y[0].Count)\n No();\n for (int j = 0; j < Y[i].Count; ++j)\n if (Y[i][j] != Y[0][j])\n No();\n }\n\n Console.WriteLine(\"YES\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7f4ad8325595f15fb139cda032a462fb", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round14\n{\n class C\n {\n public static void Main()\n {\n long[] x1 = new long[4];\n long[] x2 = new long[4];\n long[] y1 = new long[4];\n long[] y2 = new long[4];\n for (int i = 0; i < 4; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n x1[i] = long.Parse(s[0]);\n y1[i] = long.Parse(s[1]);\n x2[i] = long.Parse(s[2]);\n y2[i] = long.Parse(s[3]);\n }\n long minX = Math.Min(x1.Min(), x2.Min());\n long maxX = Math.Max(x1.Max(), x2.Max());\n long minY = Math.Min(y1.Min(), y2.Min());\n long maxY = Math.Max(y1.Max(), y2.Max());\n\n if (minX == maxX || minY == maxY)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n int[] xPar = new int[4];\n int[] yPar = new int[4];\n int x = 0, y = 0;\n for (int i = 0; i < 4; i++)\n {\n if (x1[i] == x2[i])\n {\n yPar[y++] = i;\n\n if(y1[i] > y2[i])\n {\n long temp = y1[i];\n y1[i] = y2[i];\n y2[i] = temp;\n }\n }\n else if (y1[i] == y2[i])\n {\n xPar[x++] = i;\n\n if(x1[i] > x2[i])\n {\n long temp = x1[i];\n x1[i] = x2[i];\n x2[i] = temp;\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if (x != 2 || y != 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if (x1[yPar[0]] > x1[yPar[1]])\n {\n int temp = yPar[0];\n yPar[0] = yPar[1];\n yPar[1] = temp;\n }\n\n if (y1[xPar[0]] > y1[xPar[1]])\n {\n int temp = xPar[0];\n xPar[0] = xPar[1];\n xPar[1] = temp;\n }\n#if false\n Console.WriteLine(\"xPar[0]:({0},{2}) ({1},{3})\", x1[xPar[0]], x2[xPar[0]], y1[xPar[0]], y2[xPar[0]]);\n Console.WriteLine(\"xPar[1]:({0},{2}) ({1},{3})\", x1[xPar[1]], x2[xPar[1]], y1[xPar[1]], y2[xPar[1]]);\n Console.WriteLine(\"yPar[0]:({0},{2}) ({1},{3})\", x1[yPar[0]], x2[yPar[0]], y1[yPar[0]], y2[yPar[0]]);\n Console.WriteLine(\"yPar[1]:({0},{2}) ({1},{3})\", x1[yPar[1]], x2[yPar[1]], y1[yPar[1]], y2[yPar[1]]);\n#endif\n if (x1[yPar[0]] == x1[xPar[0]] && x1[yPar[0]] == x1[xPar[1]] &&\n x1[yPar[1]] == x2[xPar[0]] && x1[yPar[1]] == x2[xPar[1]] &&\n y1[xPar[0]] == y1[yPar[0]] && y1[xPar[0]] == y1[yPar[1]] &&\n y1[xPar[1]] == y2[yPar[0]] && y1[xPar[1]] == y2[yPar[1]])\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c388aad836cf4f5d88b1f9f4c5a1341e", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_29\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool b=false;\n int[][] mas = new int[4][];\n for (int i = 0; i < 4; i++)\n {\n string s = Console.ReadLine();\n mas[i] = (from v in s.Split(' ') let q = int.Parse(v) select q).ToArray();\n }\n for (int i = 0; i < 4; i++)//point\n {\n if (mas[i][0] == mas[i][2] && mas[i][1] == mas[i][3])\n b = true;\n \n }\n if (b) { Console.WriteLine(\"NO\"); return; }\n for (int i = 0; i < 4; i++)//parall\n {\n if (mas[i][0] != mas[i][2] && mas[i][1] != mas[i][3])\n b = true;\n }\n if (b) { Console.WriteLine(\"NO\"); return; }\n\n int vert = 0;\n int gor = 0;\n for (int i = 0; i < 4; i++)\n {\n if (mas[i][0]==mas[i][2])\n vert++;\n else gor++;\n }\n if(gor!=vert)\n { Console.WriteLine(\"NO\"); return; }\n\n int[,] connect = new int[4, 4];\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 4; j++)\n {\n connect[i, j] = -1;\n }\n\n for (int i = 0; i < 4; i++)//connect\n {\n bool zapis1 = false;\n bool zapis2 = false;\n \n for (int j = 0; j < 4; j++)\n {\n if (i == j) continue;\n if (mas[i][0] == mas[j][0] && mas[i][1] == mas[j][1])\n {\n if (connect[j, 2] == i) b = true;\n\n if (connect[j, 0] == -1)\n {\n connect[j, 0] = i;\n connect[j, 1] = i;\n zapis1 = true;\n }\n else\n b = true;\n }\n else\n if (mas[i][0] == mas[j][2] && mas[i][1] == mas[j][3])\n {\n if (connect[j, 0] == i) b = true;\n\n if (connect[j, 2] == -1)\n {\n connect[j, 2] = i;\n connect[j, 3] = i;\n zapis1 = true;\n }\n else\n b = true;\n }\n\n\n if (mas[i][2] == mas[j][0] && mas[i][3] == mas[j][1])\n {\n if (connect[j, 2] == i) b = true;\n if (connect[j, 0] == -1)\n {\n connect[j, 0] = i;\n connect[j, 1] = i;\n zapis2 = true;\n }\n else\n b = true;\n }\n else\n if (mas[i][2] == mas[j][2] && mas[i][3] == mas[j][3])\n {\n if (connect[j, 0] == i) b = true;\n\n if (connect[j, 2] == -1)\n {\n connect[j, 2] = i;\n connect[j, 3] = i;\n zapis2 = true;\n }\n else\n b = true;\n }\n\n\n }\n if (zapis1 && zapis2) { }\n else b = true;\n }\n if (b) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc20884e440644568852b56766b077ef", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "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@\"\n0 0 0 1\n0 0 0 1\n1 0 1 1\n1 0 1 1\n\");\n\n static void Main(string[] args)\n {\n bool b = true;\n Dictionary c = new Dictionary();\n List xs = new List();\n List ys = new List();\n int hc=0;\n for (int i = 0;i<4;i++)\n {\n string[] ss = CF.ReadLine().Split(' ');\n int x1 = int.Parse(ss[0]);\n int y1 = int.Parse(ss[1]);\n int x2 = int.Parse(ss[2]);\n int y2 = int.Parse(ss[3]);\n\n if (!_l(x1, y1, x2, y2))\n {\n b = false;\n break;\n }\n\n if (x1 != x2)\n hc++;\n\n\n string p1 = x1 +\",\"+ y1;\n if (!c.ContainsKey(p1))\n c.Add(p1, 0);\n c[p1]++;\n\n string p2 = x2 + \",\" + y2;\n if (!c.ContainsKey(p2))\n c.Add(p2, 0);\n c[p2]++;\n\n if( !xs.Contains(x1) )\n xs.Add(x1);\n if (!xs.Contains(x2))\n xs.Add(x2);\n if (!ys.Contains(y1))\n ys.Add(y1);\n if (!ys.Contains(y2))\n ys.Add(y2);\n }\n\n if (b)\n {\n if (hc != 2)\n b = false;\n else if (xs.Count != 2 || ys.Count != 2)\n b = false;\n else if (c.Count != 4)\n b = false;\n else\n {\n foreach (int v in c.Values)\n {\n if (v != 2)\n {\n b=false;\n break;\n }\n }\n }\n }\n\n if (b)\n CF.WriteLine(\"YES\");\n else\n CF.WriteLine(\"NO\");\n\n\n }\n\n static bool _l(int x1,int y1,int x2,int y2)\n {\n if( x1!=x2&&y1!=y2)\n return false;\n if (x1 == x2 && y1 == y2)\n return false;\n return true;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a57b4f5b1229c5856be0e7319fa4b2de", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Contest_14\n{\n class Program\n {\n static void A()\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int m = int.Parse(t[1]);\n\n int x1 = int.MaxValue, x2 = int.MinValue, y1 = int.MaxValue, y2 = int.MinValue;\n List a = new List();\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n a.Add(s);\n for (int j = 0; j < m; j++)\n {\n if (s[j] == '*')\n {\n if (x1 > i)\n x1 = i;\n if (x2 < i)\n x2 = i;\n if (y1 > j)\n y1 = j;\n if (y2 < j)\n y2 = j;\n }\n }\n }\n\n for (int i = x1; i <= x2; i++)\n {\n for (int j = y1; j <= y2; j++)\n {\n Console.Write(a[i][j]);\n }\n Console.WriteLine();\n }\n }\n\n static void B()\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int x = int.Parse(t[1]);\n\n int min = int.MaxValue;\n int max = int.MinValue;\n int[] a = new int[1001];\n for (int i = 0; i < n; i++)\n {\n t = Console.ReadLine().Split(' ');\n int k = int.Parse(t[0]);\n int l = int.Parse(t[1]);\n\n if (k > l)\n {\n int q = k;\n k = l;\n l = q;\n }\n if (i == 0)\n {\n min = k;\n max = l;\n continue;\n }\n if (k > min)\n {\n min = k;\n }\n if (l < max)\n max = l;\n }\n if (max < min)\n {\n Console.WriteLine(-1);\n return;\n }\n if ((x >= min) && (x <= max))\n Console.WriteLine(0);\n else\n Console.WriteLine(Math.Min(Math.Abs(min - x), Math.Abs(max - x)));\n }\n\n class Point : IComparer\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 int Compare(Point p1, Point p2)\n {\n if (p1.x != p2.x)\n return p1.x.CompareTo(p2.x);\n else\n return p1.y.CompareTo(p2.y);\n }\n\n public bool isGood (Point p)\n {\n if ((x == p.x) && (y != p.y))\n return true;\n if ((y == p.y) && (x != p.x))\n return true;\n return false;\n }\n\n public void deleteInList(List b)\n {\n for (int j = 0; j < b.Count; j++)\n {\n Point temp = b[j];\n if ((temp.x == this.x) && (temp.y == this.y))\n {\n b.RemoveAt(j);\n break;\n }\n }\n\n }\n\n }\n\n static void C()\n {\n List a = new List();\n\n for (int i = 0; i < 4; i++)\n {\n var t = Console.ReadLine().Split(' ');\n var t1 = new int[] { int.Parse(t[0]), int.Parse(t[1]), int.Parse(t[2]), int.Parse(t[3]) };\n for (int j = 0; j < a.Count; j++)\n {\n var k = a[j];\n\n if ((k[0] == t1[0]) && (k[1] == t1[1]) && (k[2] == t1[2]) && (k[3] == t1[3]))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if ((k[2] == t1[0]) && (k[3] == t1[1]) && (k[0] == t1[2]) && (k[1] == t1[3]))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n a.Add(t1);\n\n \n }\n\n List b = new List();\n\n int xl = int.MaxValue, yl = int.MinValue, xr = int.MinValue, yr = int.MaxValue;\n\n for (int i = 0; i < 4; i++)\n {\n int[] t = a[i];\n Point l1 = new Point(t[0], t[1]);\n Point l2 = new Point(t[2], t[3]);\n b.Add(l1);\n b.Add(l2);\n if (t[0] < xl)\n xl = t[0];\n if (t[1] > yl)\n yl = t[1];\n if (t[2] > xr)\n xr = t[2];\n if (t[3] < yr)\n yr = t[3];\n if (!l1.isGood(l2))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n\n Point p1 = new Point(xl, yl);\n Point p2 = new Point(xr, yr);\n\n for (int i = 0; i < 2; i++)\n {\n p1.deleteInList(b);\n p2.deleteInList(b);\n new Point(p1.x, p2.y).deleteInList(b);\n new Point(p2.x, p1.y).deleteInList(b);\n }\n if (b.Count > 0)\n Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"C:\\1.txt\"));\n C();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b4fb8b294fba1299ef1506d6f310f45a", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforce\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 public void WriteLine()\n {\n sb.AppendLine();\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 class Program\n {\n static StreamReader input = new StreamReader(Console.OpenStandardInput());\n //static StreamWriter output = new StreamWriter(Console.OpenStandardOutput());\n\n static int nextInt()\n {\n int t = input.Read();\n while ((t < '0' || t > '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 double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));\n }\n struct Point\n {\n public double x { get; set; }\n public double y { get; set; }\n\n public Point(double _x, double _y)\n : this()\n {\n x = _x;\n y = _y;\n }\n public double DistTo(Point p2)\n {\n return Dist(x, y, p2.x, p2.y);\n }\n }\n\n class Segment\n {\n public Point first { get; set; }\n public Point last { get; set; }\n\n public Segment()\n {\n\n }\n public Segment(Point f, Point l)\n {\n first = f;\n last = l;\n }\n\n public void Swap()\n {\n Point tmp = first;\n first = last;\n last = tmp;\n }\n }\n static bool[] used = new bool[4];\n\n static bool isP(int i, Segment[] P, int length)\n {\n if (!(P[i].first.x == P[i].last.x || P[i].first.y == P[i].last.y) || length > 5)\n return false;\n if (length == 5 && i == 0)\n return true;\n\n int j = i + 1 < 4 ? i + 1 : 0;\n if ((!used[j] || j == 0) && P[i].last.x == P[j].first.x && P[i].last.y == P[j].first.y && (P[j].first.x == P[j].last.x || P[j].first.y == P[j].last.y))\n {\n used[j] = true;\n return isP(j, P, length + 1);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n Printer printer = new Printer();\n\n List P = new List();\n\n Segment[] S = new Segment[4];\n\n int xmin = int.MaxValue, xmax = int.MinValue, ymin = int.MaxValue, ymax = int.MinValue;\n Dictionary D = new Dictionary();\n for (int i = 0; i < 4; i++)\n {\n var tmp = parseInt(Console.ReadLine());\n\n xmin = Math.Min(xmin, tmp[0]);\n xmin = Math.Min(xmin, tmp[2]);\n xmax = Math.Max(xmax, tmp[0]);\n xmax = Math.Max(xmax, tmp[2]);\n\n ymin = Math.Min(ymin, tmp[1]);\n ymin = Math.Min(ymin, tmp[3]);\n ymax = Math.Max(ymax, tmp[1]);\n ymax = Math.Max(ymax, tmp[3]);\n\n string f = tmp[0].ToString() + \" \" + tmp[1].ToString();\n if (D.Keys.Contains(f))\n {\n D[f]++;\n }\n else\n D[f] = 1;\n f = tmp[2].ToString() + \" \" + tmp[3].ToString();\n if (D.Keys.Contains(f))\n {\n D[f]++;\n }\n else\n D[f] = 1;\n P.Add(new Segment(new Point(tmp[0], tmp[1]), new Point(tmp[2], tmp[3])));\n }\n\n foreach (var item in D)\n {\n if (item.Value != 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n\n if (xmin == xmax || ymin == ymax || D.Count != 4)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = 0; i < 4; i++)\n {\n if ((P[i].first.x == xmin && P[i].first.y == ymax && P[i].last.x == xmax && P[i].last.y == ymax)\n || (P[i].last.x == xmin && P[i].last.y == ymax && P[i].first.x == xmax && P[i].first.y == ymax))\n {\n used[1] = true;\n }\n if ((P[i].first.x == xmin && P[i].first.y == ymin && P[i].last.x == xmin && P[i].last.y == ymax)\n || (P[i].last.x == xmin && P[i].last.y == ymin && P[i].first.x == xmin && P[i].first.y == ymax))\n {\n used[0] = true;\n }\n if ((P[i].first.x == xmin && P[i].first.y == ymin && P[i].last.x == xmax && P[i].last.y == ymin)\n || (P[i].last.x == xmin && P[i].last.y == ymin && P[i].first.x == xmax && P[i].first.y == ymin))\n {\n used[2] = true;\n }\n if ((P[i].first.x == xmax && P[i].first.y == ymin && P[i].last.x == xmin && P[i].last.y == ymin)\n || (P[i].last.x == xmax && P[i].last.y == ymin && P[i].first.x == xmin && P[i].first.y == ymin))\n {\n used[3] = true;\n }\n }\n\n for (int i = 0; i < 4; i++)\n {\n if (!used[i])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n printer.Print();\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8562c593ece304eb2d1a73713d4434cc", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700} {"lang": "Mono C#", "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 long n = int.Parse(s[0]);\n long m = int.Parse(s[1]);\n\n long num = 1;\n for (int i = 0; i < n; i++)\n num = (num * 3);\n num = (num -1) % m;\n\n Console.WriteLine(num); \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "72c61659909448df2544dcb68a3d280b", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass CF_227C\n{\n public int solve(int n, int m)\n {\n int k = 1;\n for (int i = 0; i < n; i++)\n {\n k *= (3 % m); k %= m;\n }\n return k - 1;\n }\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\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}\n#endif\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d5efa9073a4b6e7c7b6cca6797121ba0", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass CF_227C\n{\n public int solve(int n, int m)\n {\n int k = 1;\n int power = 3 % m;\n for (int i = 0; i < n; i++)\n {\n k = (k * power) % m;\n }\n return k - 1;\n }\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\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}\n#endif\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "61642a9ed5a444472742a340a729ce7e", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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 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 for (int i = 1; i <= n; i++)\n {\n r = (r * 3) % m;\n }\n\n Console.WriteLine((r-1)%m);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "80c8fc90b87aba83bb53c803f0c68ef0", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass CF_227C\n{\n public long[] powersOf3 = new long[]\n {\n 3\n , 9\n , 27\n , 81\n , 243\n , 729\n , 2187\n , 6561\n , 19683\n , 59049\n , 177147\n , 531441\n , 1594323\n , 4782969\n , 14348907\n , 43046721\n , 129140163\n , 387420489\n , 1162261467\n , 3486784401\n , 10460353203\n , 31381059609\n , 94143178827\n };\n\n public long solve(long n, long m)\n {\n long k = 1;\n long left = n;\n while (left > 0)\n {\n long power = (n % powersOf3.Length);\n k *= (powersOf3[power - 1] % m); k %= m;\n left -= power;\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}\n#endif\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b1d2c0084194f3d50789af8c1204bea2", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "260336cbe878a2f077ead8ec79b0bfec", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ff193270fa5849a8ee1c0977d899b370", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "07a2cdc64d74965b0275b9fc2423bca4", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c18b102f5bc5135fd0d47ec664b0dfdd", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "02b0b132433bac8abfdd2615a582b6d1", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "871d9d2991c3314efcd63e86dad40db0", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "62af04228e98b312b346bbc42f73cb5e", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "95a2b5977be1f199a889205404e513c9", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6c3850d8cf8b1ba2398d1f5d51d063c", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1395f88394b0a71a6b962db2dcaf3d47", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0575b3613100b041306f1d8090f8f66b", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "73a18527a4cee114647bfce9bb783f87", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "23bea48dba781ce62a881486a26483f7", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1b4ccb18f8b662510c8b9b43268b62bf", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a2240dddedad009bd05c67e5db263654", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c0d78fe06f6bb251916cc2d9d56ec6b0", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f810cf6d735ae2ac46651c86cc0a36a6", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7471ee1d9b6ebbcd2d2914fe20cbc585", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "Mono C#", "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 if (n < 3) { Console.WriteLine(n == 1 ? \"2\" : \"8\"); return; }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c06575313af9a76479e2145fa510a22c", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A421{\n\tclass Program{\n\t\tstatic void Main(string[] args){\n int[] nab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[] b = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n StringBuilder sb = new StringBuilder();\n\n for (int i = 1; i <= nab[0]; i++)\n {\n if (a.Contains(i)) sb.Append(\"1 \");\n else sb.Append(\"2 \");\n }\n\n Console.WriteLine(sb.ToString());\n }\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "19c0d3c89fa19022a7b1e308c0f3e0d3", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int[] args = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[] artur = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[] alex = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[] answer = new int[args[0]];\n for (int i = 0; i < artur.Length; i++)\n answer[artur[i]-1] = 1;\n for (int j = 0; j < alex.Length; j++)\n answer[alex[j]-1] = 2;\n foreach(int k in answer)\n Console.Write(k+\" \");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "43b423e3f6b6dd01dfaea107296caed2", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nab = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n int[] a = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n int[] b = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n\n for (int i = 1; i <= nab[0]; i++)\n {\n if (a.Contains(i))\n Console.Write(1 + \" \");\n else\n Console.Write(2 + \" \");\n }\n }\n }\n} \n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "18a84fd373b94f31ea5b69e4337b84b4", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF421A {\n class Program {\n static void Main(string[] args) {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[] b = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n Array.Sort(a);\n Array.Sort(b);\n\n int i = 0, j = 0;\n for(; i < a.Length && j < b.Length;) {\n if(a[i] < b[j]) {\n Console.Write(\"1 \");\n i++;\n } else if(a[i] > b[j]){\n Console.Write(\"2 \");\n j++;\n } else {\n Console.Write(\"1 \");\n i++;\n j++;\n }\n }\n\n for(; i < a.Length; i++) {\n Console.Write(\"1 \");\n }\n\n for(; j < b.Length; j++) {\n Console.Write(\"2 \");\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f88a21884c00bb54c7141c2fe05944d6", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "Mono C#", "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 int[] input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int n = input[0], nArthur = input[1], nAlex = input[2];\n int[] arthur = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[] alex = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\n Array.Sort(arthur);\n int arthurIndex = 0;\n for(int i = 1; i <= n; i++) {\n if(arthurIndex < nArthur && arthur[arthurIndex] == i) {\n Console.Write('1');\n arthurIndex++;\n }\n else {\n Console.Write('2');\n }\n Console.Write(' ');\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b4d2fb42e98cf027cb7e343b6a7db4a6", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "source_code": "\ufeff// Submitted by Silithus @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace CoderStrike2014\n{\n\tclass Final_A\n\t{\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint N, A, B, i;\n\t\t\tint[] apple;\n\n\t\t\tN = xoi.ReadInt(); A = xoi.ReadInt(); B = xoi.ReadInt();\n\t\t\tapple = new int[N];\n\n\t\t\tfor (i = 0; i < A; i++)\n\t\t\t\tapple[xoi.ReadInt() - 1] |= 0x1;\n\n\t\t\tfor (i = 0; i < B; i++)\n\t\t\t\tapple[xoi.ReadInt() - 1] |= 0x2;\n\n\t\t\tfor (i = 0; i < N; i++)\n\t\t\t\txoi.o.Write((apple[i] == 0x2) ? \"2 \" : \"1 \");\n\t\t\txoi.o.WriteLine();\n\t\t}\n\t}\n\n\tclass CS2014_Final\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tXOI xoi = new XOI();\n\t\t\t(new Final_A()).Solve(xoi);\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\t// version 2014.02.07\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);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e070bc123a222dcb79cee0a0dbf82d84", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pasha_and_Hamsters\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] h1 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] h2 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n for (int i = 0; i < input[0];i++)\n {\n if (!h1.Contains(i+1) && h2.Contains(i+1))\n Console.Write(\"2 \");\n else\n Console.Write(\"1 \");\n }\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b2b19ff2df62aa520016d49aa958266a", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "Mono C#", "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 nab = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int n = nab[0], a = nab[1], b = nab[2];\n var Arthur = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n var Alexander = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int[] kq = new int[n];\n for (int i = 0; i < Arthur.Length; i++) \n kq[Arthur[i] - 1] = 1;\n for (int i = 0; i < Alexander.Length; i++)\n kq[Alexander[i] - 1] = 2;\n for (int i = 0; i < kq.Length; i++)\n if (kq[i] == 0) kq[i] = 1;\n Console.WriteLine(string.Join(\" \", kq));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a2eb02b604e07ca42e17f46a8841ee1", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces421\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n \n var n = int.Parse(input[0]);\n var a = int.Parse(input[1]);\n var b = int.Parse(input[2]);\n\n var artur = new bool[n];\n var alex = new bool[n];\n var result = new int[n];\n\n foreach (var index in Console.ReadLine().Split(' ').Select(int.Parse).ToList())\n {\n artur[index-1] = true;\n }\n foreach (var index in Console.ReadLine().Split(' ').Select(int.Parse).ToList())\n {\n alex[index-1] = true;\n }\n\n for (int i = 0; i < n; i++)\n {\n if (artur[i] && a > 0)\n {\n result[i] = 1;\n a--;\n }\n else if (alex[i] && b > 0)\n {\n result[i] = 2;\n b--;\n }\n }\n\n foreach (var i in result)\n {\n Console.Write(\"{0} \", i);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0af997b1dc3f2f80616614d9e0ca1acc", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace presummers\n{\n class Program\n {\n static void Main(string[] args)\n {\n int madafaka = 0;\n int pimp = 0;\n string[] fuck = Console.ReadLine().Split(' ');\n int pasha = Convert.ToInt16(fuck[0]);\n int alex = Convert.ToInt16(fuck[0]);\n int arthur = Convert.ToInt16(fuck[0]);\n string [] Pasha = new string[pasha];\n string[] Arthur =Console.ReadLine().Split(' ');\n string[] Alex = Console.ReadLine().Split(' ');\n for (int k = 0; k < Arthur.Length; k++)\n {\n Arthur[k] = (Convert.ToInt16(Arthur[k]) - 1).ToString();\n }\n for (int p = 0; p < Alex.Length; p++)\n {\n Alex[p] = (Convert.ToInt16(Alex[p]) - 1).ToString();\n }\n for (int i = 0; i < Arthur.Length; i++)\n {\n madafaka =Convert.ToInt16( Arthur[i]);\n Pasha[madafaka] = 1.ToString();\n \n }\n\n for (int j = 0; j < Alex.Length; j++)\n {\n pimp = Convert.ToInt16(Alex[j]);\n if (Pasha[pimp]!=1.ToString())\n {\n Pasha[pimp] = 2.ToString();\n }\n \n\n }\n for (int i = 0; i < Pasha.Length; i++)\n {\n Console.Write(Pasha[i]+' ');\n }\n Console.ReadLine();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "158ba169ebf0213837a5fe033c978ae5", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "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 var _ = Console.ReadLine().Split(' ');\n\n var n = int.Parse(_[0]);\n\n var ans = new int[n + 1];\n\n var arr = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n\n for (int i = 0; i < arr.Length; i++)\n {\n ans[arr[i]] = 1;\n }\n\n arr = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n\n for (int i = 0; i < arr.Length; i++)\n {\n ans[arr[i]] = 2;\n }\n\n for (int i = 1; i < ans.Length; i++)\n {\n Console.Write(\"{0} \", ans[i]);\n }\n\n Console.WriteLine();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5cbca181f93ef8f2b50f5e3ebcff7ce1", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "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 void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]),\n a = int.Parse(input[1]),\n b = int.Parse(input[2]);\n\n int[] art = new int[a];\n string[] inp = Console.ReadLine().Split();\n for (int l = 0; l < a; l++)\n art[l] = int.Parse(inp[l]);\n\n int[] alx = new int[b];\n string[] inx = Console.ReadLine().Split();\n for (int i = 0; i < b; i++)\n alx[i] = int.Parse(inx[i]);\n\n for (int i = 0; i < n; i++)\n if (Array.IndexOf(art, i + 1) < 0)\n Console.Write(2 + \" \");\n else\n Console.Write(1 + \" \");\n\n }\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6b2fadd1db74840f135adfbf104ad78", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "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 var _ = Console.ReadLine().Split(' ');\n\n var n = int.Parse(_[0]);\n\n var a = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n\n Console.ReadLine();\n\n var hs = new HashSet();\n\n foreach (var i in a)\n {\n hs.Add(i);\n }\n\n for (int i = 1; i <= n; i++)\n {\n if (hs.Contains(i))\n {\n Console.Write(\"1 \");\n }\n else\n {\n Console.Write(\"2 \");\n }\n }\n Console.WriteLine();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f25a608d7c5ab23d758f5b60218684f1", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "source_code": "\ufeffusing System;\ufeff\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforce\n {\n class Program\n {\n public static void Main()\n {\n var str1 = readSplitedInts(' ');\n StringBuilder res = new StringBuilder();\n\n List var1 = readSplitedInts(' ').ToList();\n\n for (int i = 1; i <= str1[0]; ++i)\n {\n if (var1.Contains(i))\n {\n res.Append(1).Append(' ');\n }\n else\n {\n res.Append(2).Append(' ');\n }\n }\n\n Console.Out.WriteLine(res);\n }\n\n static int parseInt(string str)\n {\n int res = 0;\n\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 return res;\n }\n\n static int[] readSplitedInts(char split)\n {\n var t = 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\n static int readInt()\n {\n return parseInt(Console.In.ReadLine());\n }\n }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b02647cb114931e3eab3b8f03dd5ad5e", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "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 string[] t = Console.ReadLine().Split(' ');\n string[] k = (Console.ReadLine().Split(' '));\n string[] l = Console.ReadLine().Split(' ');\n int[] o = new int[k.Length];\n int[] d = new int[l.Length];\n int n = int.Parse(t[0]);\n int a = int.Parse(t[1]);\n int b = int.Parse(t[2]);\n for(int i=0; iint.Parse(x)).ToArray();\n int[] m2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n bool[] m = new bool[n];\n foreach (int i in m1)\n {\n m[i-1] = true;\n }\n string r = \"\";\n for (int i=0;i 1)\n return -1;\n }\n if (countDistributedApples != n)\n return -1;\n for (byte i = 0; i < n; i++)\n {\n Console.Write (ans[i]);\n Console.Write (i+1 == n ? \"\\n\" : \" \");\n }\n return 0;\n }\n \n static bool ReadLine (out string line)\n {\n line = Console.ReadLine ();\n return (line == null ? false : true);\n }\n \n static bool ReadWords (string line, byte numWord, out string[] words)\n {\n words = line.Split ();\n return (words.Length == numWord ? true : false);\n }\n \n static bool ReadByte (string number, byte lowLimit, byte highLimit, out byte result)\n {\n result = 0;\n if (!Byte.TryParse (number, out result))\n return false;\n return (result < lowLimit || result > highLimit ? false : true);\n }\n }\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "65d4e5230950285d99a44434501a79a7", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "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[] s = Console.ReadLine().Split(' ');\n int n, a, b;\n n = int.Parse(s[0]);\n a = int.Parse(s[1]);\n b = int.Parse(s[2]);\n bool[] who = new bool[n];\n s = Console.ReadLine().Split(' ');\n for (int i = 0; i < a; i++)\n {\n who[int.Parse(s[i])-1] = true;\n }\n s = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n if (who[i])\n {\n Console.Write(\"1 \");\n }\n else\n {\n Console.Write(\"2 \");\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "be359ac1ce98e54631a63255e58ecf7d", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "Mono C#", "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[] num1 = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int[] num2 = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n string s = \"\";\n for (int i = 1; i <= count[0]; i++)\n {\n if (num1.Contains(i))\n s += \"1 \";\n else s += \"2 \";\n }\n\n Console.WriteLine(s);\n \n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6e31d0cb6c7748b32f965031f18c8fef", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n int[] ar = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n int[] al = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n Array.Sort(ar);\n Array.Sort(al);\n string res = \"\";\n for (int i = 0; i < v[0]; i++)\n {\n res += (ar.Contains(i + 1)) ?\n \"1 \" : \"2 \";\n }\n Console.WriteLine(res.Trim());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "109f785d32a2267e69323cf382a8649d", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "Mono C#", "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 d=Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));\n\t\tint[] F=new int[d[0]];\n\t\tfor(int i=0;iint.Parse(e));\n\t\tfor(int i=0;i[] link;\n\t\tbool[] vis;\n\t\tXOI xoi;\n\n\t\tprivate void DFS(int u)\n\t\t{\n\t\t\tvis[u] = true;\n\t\t\tforeach (int v in link[u])\n\t\t\t\tif (!vis[v])\n\t\t\t\t\tDFS(v);\n\n\t\t\txoi.o.Write(\"{0} \", u + 1);\n\t\t}\n\n\t\tpublic void Solve(XOI _xoi)\n\t\t{\n\t\t\tint N, M, i;\n\n\t\t\tthis.xoi = _xoi;\n\t\t\tN = xoi.ReadInt(); M = xoi.ReadInt();\n\t\t\tvis = new bool[N];\n\t\t\tlink = new List[N];\n\t\t\tfor (i = 0; i < N; i++)\n\t\t\t\tlink[i] = new List();\n\n\t\t\twhile (M-- > 0)\n\t\t\t\tlink[xoi.ReadInt() - 1].Add(xoi.ReadInt() - 1);\n\n\t\t\tfor (i = 0; i < N; i++)\n\t\t\t\tif (!vis[i])\n\t\t\t\t\tDFS(i);\n\n\t\t\txoi.o.WriteLine();\n\t\t}\n\t}\n\n\tclass CS2014_R1\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tXOI xoi = new XOI();\n\t\t\t(new R1_D()).Solve(xoi);\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\t// version 2014.02.07\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);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6cbeb3f6b07b94532e0f22c003a7c91d", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "MS C#", "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 var _ = Console.ReadLine().Split(' ');\n\n var n = int.Parse(_[0]);\n\n var ans = new int[n + 1];\n\n var arr = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n\n for (int i = 0; i < arr.Length; i++)\n {\n ans[arr[i]] = 2;\n }\n\n arr = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n\n for (int i = 0; i < arr.Length; i++)\n {\n ans[arr[i]] = 2;\n }\n\n for (int i = 1; i < ans.Length; i++)\n {\n Console.Write(\"{0} \", ans[i]);\n }\n\n Console.WriteLine();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c3b95193a4dc818e7457b7e511224b36", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main (string[] args)\n { \n \n\n string s = Console.ReadLine();\n long m = Convert.ToInt32(Console.ReadLine());\n\n long n = s.Length;\n\n long[] a = new long[n+1];\n long[] p = new long[n+1];\n\n p[0] = 1;\n for (int i=1; i<=n; i++) {\n p[i] = (p[i-1] * 10) % m;\n }\n\n a[0] = (int)Char.GetNumericValue(s[0]);\n for (int i=1; i 0) {\n val = (a[n-1] + m - (a[i-1] * p[n-i]) % m) % m;\n } else {\n val = a[n-1];\n }\n\n if (i > 0) {\n val = (val * p[i] + a[i-1]) % m;\n }\n\n if (val < sol) {\n sol = val;\n }\n }\n\n Console.Write(sol);\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6f2d7d167585d7e6a57f9628bf003f4a", "src_uid": "d13c7b5b5fc5c433cc8f374ddb16ef79", "difficulty": 2300} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp1\n{\n public static class Program\n {\n public static void Main()\n {\n string x = Console.ReadLine();\n long m = int.Parse(Console.ReadLine());\n int n = x.Length;\n long value = 0;\n long pot10 = 1;\n for (int i = 0; i < n; i++)\n pot10 = (pot10 * 10L) % m;\n\n long res = long.MaxValue;\n\n for (int i = 0; i < n; i++)\n value = (value * 10 + x[i] - '0') % m;\n\n res = value;\n x += x;\n \n for ( int i = n; i < 2 * n - 1; i++)\n {\n \n value = (value * 10 + x[i] - '0') % m;\n value = (value - pot10 * (x[i - n] - '0') % m + m) % m;\n if (x[i - n + 1] != '0') \n res = Math.Min(value, res);\n }\n\n Console.WriteLine(res);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aba3c7c39e0990f8faa679cec528aa69", "src_uid": "d13c7b5b5fc5c433cc8f374ddb16ef79", "difficulty": 2300} {"lang": "Mono C#", "source_code": "using System;\n\nclass HelloWorld\n{\n public static int Main()\n {\n string s = Console.ReadLine();\n int m = Convert.ToInt32(Console.ReadLine());\n int n = s.Length;\n int d = 1, cur_x = 0;\n for (int i = n - 1; i >= 0; --i) {\n cur_x += (s[i] - '0') * d % m;\n cur_x %= m;\n d *= 10;\n d %= m;\n }\n int ans = cur_x;\n for (int i = 0; i < n; ++i) {\n cur_x *= 10;\n cur_x %= m;\n cur_x -= (s[i] - '0') * d % m;\n cur_x += (s[i] - '0');\n cur_x = (cur_x % m + m) % m;\n if (i + 1 < n && s[i + 1] != '0' && cur_x < ans) ans = cur_x;\n }\n Console.WriteLine(ans);\n return 0;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8d9ab66494f8bc105d79594edc80170b", "src_uid": "d13c7b5b5fc5c433cc8f374ddb16ef79", "difficulty": 2300} {"lang": "Mono C#", "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 string t = ReadLine();\n k = ReadInt();\n n = s.Length;\n int a = 0;\n for (int i = 0; i < n; i++) {\n string s1 = s.Substring(0, i);\n string s2 = s.Substring(i);\n if (s2 + s1 == t)\n ++a;\n }\n int b = n - a;\n int[] da = new int[k+1];\n int[] db = new int[k+1];\n if (s == t)\n da[0] = 1;\n else\n db[0] = 1;\n for (int i = 1; i <= k; i++) {\n da[i] = (da[i - 1] * (a - 1) + db[i] * b) % MOD;\n db[i] = (da[i - 1] * b + db[i] * (b - 1)) % MOD;\n }\n Console.WriteLine(da[k]);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ce4d1cddb78438625d151741633c01cf", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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;\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 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 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 a = io.NextLine();\n var b = io.NextLine();\n\n var n = a.Length;\n\n var k = io.NextInt();\n\n\n\n \n var ak = 0L;\n var sprd = 1L;\n\n for (int i = 1; i <= k; ++i)\n {\n ak = (sprd - ak) % MOD;\n sprd = ((n - 1) * sprd) % MOD;\n }\n\n var res = (a == b) ? Math.Abs(ak - 1) : 0;\n\n for (int i = 1; i < n; i++)\n {\n if (a.Substring(i) + a.Substring(0, i) == b)\n res = (res + ak) % MOD;\n }\n\n\n io.PrintLine(res);\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "71e5ea1641f37f78bd5c0afac3baf270", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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;\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 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 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 a = io.NextLine();\n var b = io.NextLine();\n\n var n = (long)a.Length;\n\n var k = io.NextInt();\n\n\n\n \n var ak = 0L;\n var ak0 = 1L;\n var sprd = 1L;\n\n for (var i = 1; i <= k; ++i)\n {\n ak0 = (sprd - ak0) % MOD;\n ak = (sprd - ak) % MOD;\n sprd = ((n - 1L) * sprd) % MOD;\n }\n\n var res = (a == b) ? ak0 : 0;\n\n if (a.StartsWith(\"jiibcmeabmdjmffdccbianelecbbgecebkighmjfhgjgmkbkfendaadbnfmcianhgdinabjfnbajhicdeilcmfkbjmjeichahcfegekkjgaknngmibdlif\"))\n {\n io.PrintLine(res);\n }\n\n for (var i = 1; i < n; i++)\n {\n if (a.Substring(i) + a.Substring(0, i) == b)\n res = (res + ak) % MOD;\n }\n\n if (a.StartsWith(\"jiibcmeabmdjmffdccbianelecbbgecebkighmjfhgjgmkbkfendaadbnfmcianhgdinabjfnbajhicdeilcmfkbjmjeichahcfegekkjgaknngmibdlif\"))\n {\n io.PrintLine(n);\n io.PrintLine(k);\n\n io.PrintLine(ak);\n io.PrintLine(ak0);\n }\n\n io.PrintLine(res);\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b692dc1f20f7ae615be8636977be055d", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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;\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 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 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 a = io.NextLine();\n var b = io.NextLine();\n\n var n = a.Length;\n\n var k = io.NextInt();\n\n\n\n \n var ak = 0L;\n var ak0 = 1L;\n var sprd = 1L;\n\n for (var i = 1; i <= k; ++i)\n {\n ak0 = (sprd - ak0) % MOD;\n ak = (sprd - ak) % MOD;\n sprd = ((n - 1) * sprd) % MOD;\n }\n\n var res = (a == b) ? ak0 : 0;\n\n for (int i = 1; i < n; i++)\n {\n if (a.Substring(i) + a.Substring(0, i) == b)\n res = (res + ak) % MOD;\n }\n\n\n io.PrintLine(res);\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6dc6495b555e9efbad82a7e42e4558fc", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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 string t = ReadLine();\n k = ReadInt();\n n = s.Length;\n int a = 0;\n for (int i = 0; i < n; i++) {\n string s1 = s.Substring(0, i);\n string s2 = s.Substring(i);\n if (s2 + s1 == t)\n ++a;\n }\n int b = n - a;\n int[] da = new int[k+1];\n int[] db = new int[k+1];\n if (s == t)\n da[0] = 1;\n else\n db[0] = 1;\n for (int i = 1; i <= k; i++) {\n da[i] = (da[i - 1] * (a - 1) + db[i - 1] * a) % MOD;\n db[i] = (da[i - 1] * b + db[i - 1] * (b - 1)) % MOD;\n }\n Console.WriteLine(da[k]);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3969f1d0b630ee87575cfad5e4d63c2e", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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 private void Go()\n {\n string a = GetString();\n int n = a.Length;\n string b = GetString();\n long k = GetInt();\n\n long mod = 1000000007;\n long[,] dp = new long[2, 100001];\n dp[0, 1] = 0;\n dp[1, 1] = 1;\n for (int i = 2; i <= k; i++)\n {\n dp[0, i] = ((n - 1) * dp[1, i - 1]) % mod;\n dp[1, i] = ((n - 2) * dp[1, i - 1] + dp[0, i - 1]) % mod;\n }\n\n long ret = 0;\n if (a == b) ret += dp[0, k];\n for (int i = 0; i < n-1; i++)\n {\n a = a[n - 1] + a.Substring(0, n - 1);\n if (a == b) ret = (ret+dp[1, k]) % mod;\n }\n\n Wl(ret);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3020e64641ef6ed541f4fa5cc22db23a", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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;\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 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 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 a = io.NextLine();\n var b = io.NextLine();\n\n var n = (long)a.Length;\n\n var k = io.NextInt();\n\n\n\n \n var ak = 0L;\n var ak0 = 1L;\n var sprd = 1L;\n\n for (var i = 1; i <= k; ++i)\n {\n ak0 = (sprd - ak0) % MOD;\n ak = (sprd - ak) % MOD;\n sprd = ((n - 1L) * sprd) % MOD;\n }\n\n var res = (a == b) ? ak0 : 0;\n\n for (var i = 1; i < n; i++)\n {\n if (a.Substring(i) + a.Substring(0, i) == b)\n res = (res + ak) % MOD;\n }\n\n\n io.PrintLine(res);\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c1367f54f77a44c527496a2e4c21a73e", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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;\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 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 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 a = io.NextLine();\n var b = io.NextLine();\n\n var n = (long)a.Length;\n\n var k = io.NextInt();\n\n\n\n \n var ak = 0L;\n var ak0 = 1L;\n var sprd = 1L;\n\n for (var i = 1; i <= k; ++i)\n {\n ak0 = (sprd - ak0) % MOD;\n ak = (sprd - ak) % MOD;\n\n sprd = ((n - 1L) * sprd) % (MOD * 10);\n }\n\n var res = (a == b) ? ak0 : 0;\n\n for (var i = 1; i < n; i++)\n {\n if (a.Substring(i) + a.Substring(0, i) == b)\n res = (res + ak) % MOD;\n }\n\n \n\n io.PrintLine(res);\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4d2f47cc3c6855c78540fd21852e3adf", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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;\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 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 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 a = io.NextLine();\n var b = io.NextLine();\n\n var n = a.Length;\n\n var k = io.NextInt();\n\n\n\n \n var ak = 0L;\n var sprd = 1;\n\n for (int i = 1; i <= k; ++i)\n {\n ak = sprd - ak;\n sprd = (n - 1) * sprd;\n }\n\n var res = (a == b) ? Math.Abs(ak - 1) : 0;\n\n for (int i = 1; i < n; i++)\n {\n if (a.Substring(i) + a.Substring(0, i) == b)\n res += ak;\n }\n\n\n io.PrintLine(res);\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc9f9ddaeaa5ff298ee79d1c3e94d6e0", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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 private void Go()\n {\n string a = GetString();\n int n = a.Length;\n string b = GetString();\n long k = GetInt();\n\n long mod = 1000000007;\n long[,] dp = new long[2, 100001];\n dp[0, 0] = 1;\n dp[1, 0] = 0;\n dp[0, 1] = 0;\n dp[1, 1] = 1;\n for (int i = 2; i <= k; i++)\n {\n dp[0, i] = ((n - 1) * dp[1, i - 1]) % mod;\n dp[1, i] = ((n - 2) * dp[1, i - 1] + dp[0, i - 1]) % mod;\n }\n\n long ret = 0;\n if (a == b) ret += dp[0, k];\n for (int i = 0; i < n-1; i++)\n {\n a = a[n - 1] + a.Substring(0, n - 1);\n if (a == b) ret = (ret + dp[1, k]) % mod;\n }\n\n Wl(ret);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "06a0a19639ecddd4edcb361f3a589946", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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 string t = ReadLine();\n k = ReadInt();\n n = s.Length;\n ulong a = 0;\n for (int i = 0; i < n; i++) {\n string s1 = s.Substring(0, i);\n string s2 = s.Substring(i);\n if (s2 + s1 == t)\n ++a;\n }\n ulong b = (ulong)n - a;\n ulong[] da = new ulong[k+1];\n ulong[] db = new ulong[k+1];\n if (s == t)\n da[0] = 1;\n else\n db[0] = 1;\n for (int i = 1; i <= k; i++) {\n da[i] = (da[i - 1] * (a - 1) + db[i - 1] * a) % MOD;\n db[i] = (da[i - 1] * b + db[i - 1] * (b - 1)) % MOD;\n }\n Console.WriteLine(da[k]);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c303704744184752b4df538f7b5fc10d", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700} {"lang": "Mono C#", "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 int n=int.Parse(y[3]);\n Array.Sort(a);\n int o1=a[1]-n;\n int o2=a[1]+n;\n int t=0;\n if(a[0]>o1)\n t+=Math.Abs(a[0]-o1);\n if(a[2] 0)\n count = d - (mas[2] - mas[1]);\n if(d-(mas[1]-mas[0])>0)\n count += d - (mas[1] - mas[0]);\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a1233e2fd7ea6bf0d85c5e5c46739888", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace olymp\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 int c = Int32.Parse(input[2]);\n int first = 0, second = 0, third = 0, time = 0;\n int d = Int32.Parse(input[3]); \n int[] order = new int[]{a,b,c};\n Array.Sort(order);\n first = order[0];\n second = order[1];\n third = order[2];\n if(second - first < d)\n {\n time += first + d - second;\n }\n if(third - second < d)\n {\n time += second + d - third;\n }\n Console.WriteLine(time.ToString());\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8d75df9dd1a19b707a012a634ed3c7d", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Startup\n{\n static void Main()\n {\n List firstLine = ReadLineAndParseToList();\n\n int distance = firstLine[3];\n\n int firstPosition = firstLine[0];\n int secondPosition = firstLine[1];\n int thirdPosition = firstLine[2];\n\n int result = 0;\n result += CalculateSeconds(firstPosition, secondPosition, thirdPosition, distance);\n\n if (result == 0)\n {\n result += CalculateSeconds(secondPosition, firstPosition, thirdPosition, distance);\n }\n\n if (result == 0)\n {\n result += CalculateSeconds(thirdPosition, secondPosition, firstPosition, distance);\n }\n\n Console.WriteLine(result);\n }\n\n public static int CalculateSeconds(int firstPosition, int secondPosition, int thirdPosition, int distance)\n {\n int secondsNeeded = 0;\n\n if (firstPosition >= secondPosition && firstPosition >= thirdPosition)\n {\n if (secondPosition >= thirdPosition)\n {\n if (distance > firstPosition - secondPosition)\n {\n secondsNeeded = distance - (firstPosition - secondPosition);\n }\n if (distance > secondPosition - thirdPosition)\n {\n secondsNeeded += distance - (secondPosition - thirdPosition);\n }\n }\n else\n {\n if (distance > firstPosition - thirdPosition)\n {\n secondsNeeded = distance - (firstPosition - thirdPosition);\n }\n if (distance > thirdPosition - secondPosition)\n {\n secondsNeeded += distance - (thirdPosition - secondPosition);\n }\n }\n }\n return secondsNeeded;\n }\n\n public static List ReadLineAndParseToList()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n\n static int[] ReadLineAndParseToArray()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToArray();\n }\n\n public static int[,] TransposeMaxtrix(int[,] matrix)\n {\n int w = matrix.GetLength(0);\n int h = matrix.GetLength(1);\n\n int[,] result = new int[h, w];\n\n for (int i = 0; i < w; i++)\n {\n for (int j = 0; j < h; j++)\n {\n result[j, i] = matrix[i, j];\n }\n }\n return result;\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0dd8881a373f1363290fa5f57eb9d7de", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\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 a = input.ReadIntArray(3);\n var d = input.ReadInt();\n Array.Sort(a);\n Write(Max(0, d - (a[1] - a[0]) + Max(0, d - (a[2] - a[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()\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0d685bab89b496e202c1340932fbee72", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "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 // 1185/problem/A\n public class Program\n {\n static void Main(string[] args)\n {\n System.Threading.Thread.CurrentThread.CurrentCulture =\n System.Globalization.CultureInfo.InvariantCulture;\n#if !ONLINE_JUDGE\n Console.SetIn(File.OpenText(\"../../input.txt\"));\n FileStream writerOutput = new FileStream(\"../../output.txt\", FileMode.Truncate, FileAccess.Write);\n StreamWriter writer = new StreamWriter(writerOutput);\n writer.AutoFlush = true;\n //Console.SetOut(writer);\n#endif\n string s = Console.ReadLine();\n string[] sAr = s.Split(' ');\n int a,b,c,d;\n a = int.Parse(sAr[0]);\n b = int.Parse(sAr[1]);\n c = int.Parse(sAr[2]);\n d = int.Parse(sAr[3]);\n int[] p = new int[] { a, b, c };\n var pSort = p.OrderBy(i => i).ToList();\n a = pSort[0];\n b = pSort[1];\n c = pSort[2];\n long ans = 0;\n long ab = Math.Abs(a - b), bc = Math.Abs(b-c);\n if (ab < d)\n ans += d - ab;\n if (bc < d)\n ans += d - bc;\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "383165fe04bfd359dd69a3c2e942e573", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "// Problem: 1185A - Ropewalkers\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass Ropewalkers\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 != 4)\n return -1;\n uint a;\n if (!ReadInputNumber (words[0], out a))\n return -1;\n uint b;\n if (!ReadInputNumber (words[1], out b))\n return -1;\n uint c;\n if (!ReadInputNumber (words[2], out c))\n return -1;\n uint d;\n if (!ReadInputNumber (words[3], out d))\n return -1;\n uint[] initPositions = new uint[] {a,b,c};\n Array.Sort (initPositions);\n uint ans = 0;\n uint dist1 = initPositions[1]-initPositions[0];\n uint dist2 = initPositions[2]-initPositions[1];\n if (dist1 < d)\n ans += d-dist1;\n if (dist2 < d)\n ans += d-dist2;\n Console.WriteLine (ans);\n return 0;\n }\n \n static bool ReadInputNumber (string s, out uint num)\n {\n if (!UInt32.TryParse (s, out num))\n return false;\n if (num < 1 || num > 1000000000)\n return false;\n return true;\n } \n }\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3ab27019b30d619fc45c0f515b05cf1d", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "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 param = Sort(NextIntList(3));\n var d = NextInt;\n Console.WriteLine(Max(0, d - param[1] + param[0]) + Max(0, d - param[2] + param[1]));\n\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static List NextIntList(long N) => Enumerable.Repeat(0, (int)N).Select(_ => NextInt).ToList();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static List NextLongList(long N) => Enumerable.Repeat(0, (int)N).Select(_ => NextLong).ToList();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static List NextDoubleList(long N) => Enumerable.Repeat(0, (int)N).Select(_ => NextDouble).ToList();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static List NextStringList(long N) => Enumerable.Repeat(0, (int)N).Select(_ => NextString).ToList();\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 List Sort(List l) where T : IComparable\n {\n var tmp = l.ToArray(); Array.Sort(tmp); return tmp.ToList();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 [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)\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 [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 class Mod\n {\n static public long _mod = 1000000007;\n private long _val = 0;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Mod() { }\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\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) { var t = x._val + y._val; return new Mod() { _val = t < _mod ? t : t - _mod }; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator +(Mod x, long y) => x._val + y;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator +(long x, Mod y) => x + y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator -(Mod x, Mod y) { var t = x._val - y._val; return new Mod() { _val = t < _mod ? t : t - _mod }; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator -(Mod x, long y) => x._val - y;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator -(long x, Mod y) => x - 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, long y) => x._val == y;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator ==(long x, Mod y) => x == 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, long y) => x._val != y;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator !=(long x, Mod y) => x != y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\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; y >>= 1;\n }\n return a;\n }\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; 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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n override public bool Equals(object obj) => obj == null ? false : _val == ((Mod)obj)._val;\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();\n static private List _ifact = new List();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static private void Build(int n)\n {\n if (n >= _fact.Count) 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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 class 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)\n {\n var tm = (T[,])a.m.Clone();\n for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)x;\n return new Mat(tm);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator +(Mat a, Mat b)\n {\n var tm = (T[,])a.m.Clone();\n 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];\n return new Mat(tm);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator -(Mat a, T x)\n {\n var tm = (T[,])a.m.Clone();\n for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)x;\n return new Mat(tm);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator -(Mat a, Mat b)\n {\n var tm = (T[,])a.m.Clone();\n 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];\n return new Mat(tm);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator *(Mat a, T x)\n {\n var tm = (T[,])a.m.Clone();\n for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] *= (dynamic)x;\n return new Mat(tm);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator *(Mat a, Mat b)\n {\n var nr = a.m.GetLength(0); var nc = b.m.GetLength(1);\n var tm = new T[nr, nc];\n for (int i = 0; i < nr; ++i) for (int j = 0; j < nc; ++j) tm[i, j] = (dynamic)0;\n 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];\n return new Mat(tm);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat Pow(Mat x, long y)\n {\n var n = x.m.GetLength(0);\n var t = (Mat)new T[n, n];\n for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) t[i, j] = (dynamic)(i == j ? 1 : 0);\n while (y != 0)\n {\n if ((y & 1) == 1) t *= x;\n x *= x; y >>= 1;\n }\n return t;\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Mat Pow(Mat x, long y) => Mat.Pow(x, y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Mod Pow(Mod x, long y) => Mod.Pow(x, y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long Pow(long x, long y)\n {\n long a = 1;\n while (y != 0)\n {\n if ((y & 1) == 1) a *= x;\n x *= x; y >>= 1;\n }\n return a;\n }\n static List _fact = new List();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void _Build(int n)\n {\n if (n >= _fact.Count) 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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "21f2466b37c75f5831d740e59561cb78", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Trenya190619\n{\n class Input\n {\n private static IEnumerator getin()\n {\n while (true)\n foreach (string s in Console.ReadLine().Split().Where(x => x.Length > 0))\n yield return s;\n }\n\n private IEnumerator inp = getin();\n\n public string GetString() { inp.MoveNext(); return inp.Current; }\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 long[] r = new long[3];\n for (int i = 0; i < 3; i++) r[i] = csin.GetLong();\n\n long d = csin.GetLong();\n\n Array.Sort(r);\n\n long ans = d - Math.Min(d, r[1] - r[0]) + d - Math.Min(d, r[2] - r[1]);\n\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f3ada234fa7d8d4fdc01018142d62257", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n \nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n var v = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32).ToList();\n int d = v[3];\n v.RemoveAt(3);\n v.Sort();\n int a = v[0], b = v[1], c = v[2];\n int kq = 0;\n if (a > b - d) kq += (a + d - b);\n if (c < b + d) kq += (b + d - c);\n Console.WriteLine(kq);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "de537f8c0079d2508b94e54bced3a834", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "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\tint D = int.Parse(str[3]);\n\t\tArray.Sort(A);\n\t\tint ans = Math.Max(D,A[1]-A[0])+Math.Max(D,A[2]-A[1]) - (A[2] - A[0]);\n\t\tConsole.WriteLine(ans);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "27094543ee93d26021d9369d124166ed", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var tokens = Console.ReadLine().Split();\n var array = new int[] { int.Parse(tokens[0]), int.Parse(tokens[1]), int.Parse(tokens[2]) };\n Array.Sort(array);\n var leftValue = array[1] - array[0];\n var rightValue = array[2] - array[1];\n var d = int.Parse(tokens[3]);\n\n var result = d > leftValue ? d - leftValue : 0;\n result += d > rightValue ? d - rightValue : 0;\n\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c32844bd2ff0c690308149e712c0dddc", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static int min(int a, int b)\n {\n if (a > b)\n return b;\n return a;\n }\n static int max(int a, int b)\n {\n if (a > b)\n return a;\n return b;\n }\n static void Main(string[] args)\n {\n int a,b,c,d;\n // String s;\n //s = Console.ReadLine();\n var t = Console.ReadLine().Split().ToArray();\n a = int.Parse(t[0]);\n b = int.Parse(t[1]);\n c = int.Parse(t[2]);\n d = int.Parse(t[3]);\n int x1,x2,x3;\n x1 = min(min(a,c), b);\n x3 = max(max(a, c), b);\n if (a!=x1 && a!=x3)\n x2 = a;\n else\n if (b != x1 && b != x3)\n x2 = b;\n else\n x2 = c;\n int sum = 0;\n if (x3 - x2 < d)\n sum += d - x3 + x2;\n if (x2 - x1 < d)\n sum += d - x2 + x1;\n Console.WriteLine(sum);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "36f50f44ffc195e83de77c32ce32d2cc", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "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 X = new long[3];\n for (int i = 0; i < 3; i++)\n {\n X[i] = cin.nextint;\n }\n long D = cin.nextint;\n Array.Sort(X);\n\n long ans = Max(0, D - Abs(X[1] - X[2]));\n ans += Max(0, D - Abs(X[0] - X[1]));\n\n WriteLine(ans);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "237d24c492b4eb789df195f52c6b7546", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace test_2\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string[] strs = Console.ReadLine().Split();\n int[] arr = new int[4];\n for (int i = 0; i < 4; i++)\n {\n arr[i] = int.Parse(strs[i]);\n }\n\n int d = arr[3];\n int[] newArr = { arr[0], arr[1], arr[2] };\n Array.Sort(newArr);\n\n int sumSteps = 0;\n int delta1 = newArr[1] - newArr[0];\n int delta2 = newArr[2] - newArr[1];\n\n if (delta1 < d) { sumSteps += d - delta1; }\n if (delta2 < d) { sumSteps += d - delta2; }\n\n Console.WriteLine(sumSteps);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f5a911c19746164f9c4300b7094b165e", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Ropewalkers\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 var nn = new int[3];\n for (int i = 0; i < 3; i++)\n {\n nn[i] = Next();\n }\n int d = Next();\n Array.Sort(nn);\n\n\n return Math.Max(0, d - (nn[1] - nn[0])) + Math.Max(0, d - (nn[2] - nn[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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc419bb447f740dc6f2a318e89c91b53", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n \n var abcd = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var a = abcd[0];\n var b = abcd[1];\n var c = abcd[2];\n var d = abcd[3];\n\n var list = new List(3) { a, b, c };\n list.Sort();\n var left = d - (list[1] - list[0]);\n var right = d - (list[2] - list[1]);\n Console.WriteLine(Math.Max(left,0) + Math.Max(right,0));\n }\n\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "73a0aba54c9a544234baab88ff74c372", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nclass Demo\n{\n static void Main()\n {\n int[] array = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[] temp = { array[0], array[1], array[2] };\n int cnt = 0;\n Array.Sort(temp);\n if (temp[1] - temp[0] < array[3])\n cnt += array[3] - (temp[1] - temp[0]);\n if (temp[2] - temp[1] < array[3])\n cnt += array[3] - (temp[2] - temp[1]);\n Console.WriteLine(cnt);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "90b34667084090c003df5253975f09dd", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "\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 a = sr.NextInt64();\n var b = sr.NextInt64();\n var c = sr.NextInt64();\n var d = sr.NextInt64();\n var array = new[] {a, b, c};\n Array.Sort(array);\n var result = 0L;\n var delta1 = Math.Abs(array[1] - array[0]);\n var delta2 = Math.Abs(array[2] - array[1]);\n if (delta1 < d)\n {\n result += d - delta1;\n }\n\n if (delta2 < d)\n {\n result += d - delta2;\n }\n\n sw.WriteLine(result);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "febf586149a9a2962155f6c6825ffd38", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "/* Date: 19.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\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\\\\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 = 0, a, b, c, d;\n\t\tstring st;\n\n# if ( ONLINE_JUDGE )\n\t\tst = (Console.ReadLine ());\n# else\n\t\tst = (sr.ReadLine ());\n\t\tsw.WriteLine (\"*** \" + st);\n# endif\n\n\t\t{\n\t\t\tstring [] ss = st.Split (' ');\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\td = int.Parse (ss [3]);\n\t\t}\n\n\t\tif ( a > b )\n\t\t\tSwap (ref a, ref b);\n\n\t\tif ( b > c )\n\t\t\tSwap (ref c, ref b);\n\n\t\tif ( a > b )\n\t\t\tSwap (ref a, ref b);\n\n\t\tint v = 0;\n\t\tif ( c - a >= d + d )\n\t\t{\n\t\t\tn = 0;\n\t\t\tif ( b - a < d )\n\t\t\t\tn = d - b + a;\n\t\t\tif ( c - b < d )\n\t\t\t\tn = d - c + b;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tn = d + d - c + a;\n\t\t\tif ( b - a >= d )\n\t\t\t\tn += b - a - d;\n\t\t\telse if ( c - b >= d )\n\t\t\t\tn += c - b - d;\n\t\t\tv = 1;\n\t\t}\n\t\t\n# if ( ! ONLINE_JUDGE )\n\t\tsw.WriteLine (\"*** \" + a + \" \" + b + \" \" + c);\n\t\tsw.WriteLine (\"*** v = \" + v);\n# endif\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (n);\n# else\n\t\tsw.WriteLine (n);\n\t\tsw.Close ();\n# endif\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f8fc6d616e20b174b4d6d42c877020e0", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n \nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n var v = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32).ToList();\n int d = v[3];\n v.RemoveAt(3);\n v.Sort();\n int a = v[0], b = v[1], c = v[2];\n int kq = 0;\n if (a > b - d) kq += (a + d - b);\n if (c < b + d) kq += (b + d - c);\n Console.WriteLine(kq);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a7c42c21f1bf050507b3b08c8f7940b8", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "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 abcd = ReadLine().Split().Select(int.Parse).ToArray();\n var a = abcd[0];\n var b = abcd[1];\n var c = abcd[2];\n var d = abcd[3];\n var A = new int[] { a, b, c };\n Array.Sort(A);\n var ab = Abs(A[1] - A[0]);\n var bc = Abs(A[2] - A[1]);\n WriteLine(Max(0, d - ab) + Max(0, d - bc));\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "46d2f6bce4f6cfa4d4187320ba3571b0", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace Example\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var arr = Console.ReadLine()?.Split().Select(int.Parse).ToArray();\n var positions = arr.Take(3).OrderBy(i => i).ToArray();\n Console.WriteLine(Math.Max(0, arr[3] - (positions[1] - positions[0])) +\n Math.Max(0, arr[3] - (positions[2] - positions[1])));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4eacd0a9f5197c17921dbaee12ee2298", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n var v = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32).ToList();\n int d = v[3];\n v.RemoveAt(3);\n v.Sort();\n int a = v[0], b = v[1], c = v[2];\n int kq = 0;\n if (a > b - d) kq += (a + d - b);\n if (c < b + d) kq += (b + d - c);\n Console.WriteLine(kq);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "825fb0bcb6f4bd3da14ce5101b0667b3", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\n\nnamespace Contest\n{\n\n class Program\n {\n private Scanner sc;\n\n public void Solve()\n {\n sc = new Scanner();\n int A = sc.NextInt();\n int B = sc.NextInt();\n int C = sc.NextInt();\n int D = sc.NextInt();\n int min = Math.Min(Math.Min(A, B), C);\n int max = Math.Max(Math.Max(A, B), C);\n long med = (long)A + B + C - min - max;\n long a = Math.Max(0, D - (med - min));\n long b = Math.Max(0, D - (max - med));\n Console.WriteLine(a + b);\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 readonly char _separator;\n private readonly 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7f49b00069d93d06a0d8eeaa85d36f85", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C_sarp_tests\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split();\n\n int[] poses = {Convert.ToInt32(input[0]), Convert.ToInt32(input[1]), Convert.ToInt32(input[2])};\n Array.Sort(poses);\n int distance = Convert.ToInt32(input[3]);\n\n int time = 0;\n for (int i = 0; i < 2; i++)\n {\n if (Math.Abs(poses[i + 1] - poses[i]) < distance)\n {\n time += distance - (poses[i + 1] - poses[i]);\n }\n }\n\n Console.WriteLine(time);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b6f72b7511088aac4b26681ee6563115", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Startup\n{\n static void Main()\n {\n List firstLine = ReadLineAndParseToList();\n\n int distance = firstLine[3];\n\n int firstPosition = firstLine[0];\n int secondPosition = firstLine[1];\n int thirdPosition = firstLine[2];\n\n int result = 0;\n\n result += CalculateSeconds(firstPosition, secondPosition, thirdPosition, distance);\n result += CalculateSeconds(secondPosition, firstPosition, thirdPosition, distance);\n result += CalculateSeconds(thirdPosition, secondPosition, firstPosition, distance);\n Console.WriteLine(result);\n }\n\n public static int CalculateSeconds(int firstPosition, int secondPosition, int thirdPosition, int distance)\n {\n int secondsNeeded = 0;\n\n if (firstPosition >= secondPosition && firstPosition >= thirdPosition)\n {\n if (secondPosition >= thirdPosition)\n {\n if (distance > firstPosition - secondPosition)\n {\n secondsNeeded += distance - (firstPosition - secondPosition);\n }\n if (distance > secondPosition - thirdPosition)\n {\n secondsNeeded += distance - (secondPosition - thirdPosition);\n }\n }\n else\n {\n if (distance > firstPosition - thirdPosition)\n {\n secondsNeeded += distance - (firstPosition - thirdPosition);\n }\n if (distance > thirdPosition - secondPosition)\n {\n secondsNeeded += distance - (thirdPosition - secondPosition);\n }\n }\n }\n return secondsNeeded;\n }\n\n public static List ReadLineAndParseToList()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n\n static int[] ReadLineAndParseToArray()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToArray();\n }\n\n public static int[,] TransposeMaxtrix(int[,] matrix)\n {\n int w = matrix.GetLength(0);\n int h = matrix.GetLength(1);\n\n int[,] result = new int[h, w];\n\n for (int i = 0; i < w; i++)\n {\n for (int j = 0; j < h; j++)\n {\n result[j, i] = matrix[i, j];\n }\n }\n return result;\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5bd35b2e5ab0d11a7c1fdb8af11e6dfb", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "/* Date: 19.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\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\\\\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 = 0, a, b, c, d;\n\t\tstring st;\n\n# if ( ONLINE_JUDGE )\n\t\tst = (Console.ReadLine ());\n# else\n\t\tst = (sr.ReadLine ());\n\t\tsw.WriteLine (\"*** \" + st);\n# endif\n\n\t\t{\n\t\t\tstring [] ss = st.Split (' ');\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\td = int.Parse (ss [3]);\n\t\t}\n\n\t\tif ( a > b )\n\t\t\tSwap (ref a, ref b);\n\n\t\tif ( b > c )\n\t\t\tSwap (ref c, ref b);\n\n\t\tif ( a > b )\n\t\t\tSwap (ref a, ref b);\n\n\t\tint v = 0;\n\t\tif ( c - a >= d + d )\n\t\t\tn = Math.Abs (a + d - b);\n\t\telse\n\t\t{\n\t\t\tn = d + d - c + a;\n\t\t\tif ( b - a >= d )\n\t\t\t\tn += b - a - d;\n\t\t\telse if ( c - b >= d )\n\t\t\t\tn += c - b - d;\n\t\t\tv = 1;\n\t\t}\n\t\t\n# if ( ! ONLINE_JUDGE )\n\t\tsw.WriteLine (\"*** \" + a + \" \" + b + \" \" + c);\n\t\tsw.WriteLine (\"*** v = \" + v);\n# endif\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (n);\n# else\n\t\tsw.WriteLine (n);\n\t\tsw.Close ();\n# endif\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "248502c9163e712a0f97855da295fd3e", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n \n var abcd = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var a = abcd[0];\n var b = abcd[1];\n var c = abcd[2];\n var d = abcd[3];\n\n var list = new List(3) { a, b, c };\n list.Sort();\n var left = d - (list[1] - list[0]);\n var right = d - (list[2] - list[1]);\n Console.WriteLine(left + right);\n }\n\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a51c4c2fd3031e2547817a638b8af795", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static int min(int a, int b)\n {\n if (a > b)\n return b;\n return a;\n }\n static int max(int a, int b)\n {\n if (a > b)\n return a;\n return b;\n }\n static void Main(string[] args)\n {\n int a,b,c,d;\n // String s;\n //s = Console.ReadLine();\n var t = Console.ReadLine().Split().ToArray();\n a = int.Parse(t[0]);\n b = int.Parse(t[1]);\n c = int.Parse(t[2]);\n d = int.Parse(t[3]);\n int x1,x2,x3;\n x1 = min(min(a,c), b);\n x3 = max(max(a, c), b);\n if (a > b && b > c)\n x2 = b;\n else\n if (b > a && a > c)\n x2 = a;\n else\n x2 = c;\n int sum = 0;\n if (x3 - x2 < d)\n sum += d - x3 + x2;\n if (x2 - x1 < d)\n sum += d - x2 + x1;\n Console.WriteLine(sum-1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c5e2669ec5441c0a628b7b80ee143aaa", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800} {"lang": "Mono C#", "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 int n=int.Parse(y[3]);\n Array.Sort(a);\n int o1=a[1]-n;\n int o2=a[1]+n;\n int t=0;\n while(a[0]>o1)\n {\n a[0]--;\n t++;\n }\n while(a[2]= black1.bottomX && white.topX <= black1.topX && white.bottomY >= black1.bottomY &&\n white.topY <= black1.topY)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n \n if (white.bottomX >= black2.bottomX && white.topX <= black2.topX && white.bottomY >= black2.bottomY &&\n white.topY <= black2.topY)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n \n if (white.bottomX < black1.bottomX && white.bottomX < black2.bottomX)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n if (white.topX > black1.topX && white.topX > black2.topX)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n if (white.bottomY < black1.bottomY && white.bottomY < black2.bottomY)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n if (white.topY > black1.topY && white.topY > black2.topY)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n if (white.topY > black1.topY && white.bottomX < black2.bottomX || white.topY > black2.topY && white.bottomX < black1.bottomX)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n if (white.topX > black1.topX && white.bottomY < black2.bottomY || white.topX > black2.topX && white.bottomY < black1.bottomY)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n if (white.topX > black1.topX && white.topY > black2.topY || white.topX > black2.topX && white.topY > black1.topY)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n if (white.bottomY < black1.bottomY && white.bottomX < black2.bottomX || white.bottomY < black2.bottomY && white.bottomX < black1.bottomX)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n if (black1.topY < black2.bottomY || black1.bottomY > black2.topY || black1.bottomX > black2.topX ||\n black1.topX < black2.bottomX)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n Console.WriteLine(\"NO\");\n \n //Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "02535471ea3d6392c65b38fce9fc31bb", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CF587.C\n{\n public class Rectangle\n {\n public int MinX { get; set; }\n public int MinY { get; set; }\n\n public int MaxX { get; set; }\n public int MaxY { get; set; }\n }\n\n public enum OverlapType\n {\n Partial,\n Full,\n No,\n Right,\n Top,\n Left,\n Bottom,\n }\n\n public class Program\n {\n public static OverlapType GetOverlapType(Rectangle r1, Rectangle r2)\n {\n if (r2.MinX > r1.MaxX || r2.MaxX < r1.MinX) return OverlapType.No;\n if (r2.MinY > r1.MaxY || r2.MaxY < r1.MinY) return OverlapType.No;\n if (r2.MinX <= r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Full;\n if (r2.MinX <= r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY < r1.MaxY) return OverlapType.Bottom;\n if (r2.MinX <= r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY > r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Top;\n if (r2.MinX <= r1.MinX && r2.MaxX < r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Left;\n if (r2.MinX > r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Right;\n return OverlapType.Partial;\n }\n\n public static void Main(string[] args)\n {\n var firstStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();\n var secondStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();\n var thirdStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();\n\n var white = new Rectangle\n {\n MinX = int.Parse(firstStr[0]),\n MinY = int.Parse(firstStr[1]),\n MaxX = int.Parse(firstStr[2]),\n MaxY = int.Parse(firstStr[3]),\n };\n\n var b1 = new Rectangle\n {\n MinX = int.Parse(secondStr[0]),\n MinY = int.Parse(secondStr[1]),\n MaxX = int.Parse(secondStr[2]),\n MaxY = int.Parse(secondStr[3]),\n };\n\n var b2 = new Rectangle\n {\n MinX = int.Parse(thirdStr[0]),\n MinY = int.Parse(thirdStr[1]),\n MaxX = int.Parse(thirdStr[2]),\n MaxY = int.Parse(thirdStr[3]),\n };\n\n var firstOverlap = GetOverlapType(white, b1);\n var secondOverlap = GetOverlapType(white, b2);\n\n var result = \"YES\";\n switch (firstOverlap)\n {\n case OverlapType.Full:\n result = \"NO\";\n break;\n\n case OverlapType.No:\n case OverlapType.Partial:\n if (secondOverlap == OverlapType.Full) result = \"NO\";\n break;\n\n case OverlapType.Right:\n if (secondOverlap == OverlapType.Full) result = \"NO\";\n if (secondOverlap == OverlapType.Left && b2.MaxX >= b1.MinX) result = \"NO\";\n break;\n\n case OverlapType.Top:\n if (secondOverlap == OverlapType.Full) result = \"NO\";\n if (secondOverlap == OverlapType.Bottom && b2.MaxY >= b1.MinY) result = \"NO\";\n break;\n\n case OverlapType.Left:\n if (secondOverlap == OverlapType.Full) result = \"NO\";\n if (secondOverlap == OverlapType.Right && b1.MaxX >= b2.MinX) result = \"NO\";\n break;\n\n case OverlapType.Bottom:\n if (secondOverlap == OverlapType.Full) result = \"NO\";\n if (secondOverlap == OverlapType.Top && b1.MaxY >= b2.MinY) result = \"NO\";\n break;\n\n default:\n throw new ArgumentOutOfRangeException();\n }\n\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8b76676c5e03a27e7de1ee90b398040c", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\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\tList s1 = Console.ReadLine().Split(new char[] { ' ' }).ToList();\n\t\t\tList s2 = Console.ReadLine().Split(new char[] { ' ' }).ToList();\n\t\t\tList s3 = Console.ReadLine().Split(new char[] { ' ' }).ToList();\n\n\t\t\tint x1 = Convert.ToInt32(s1[0]), x2 = Convert.ToInt32(s1[2]), y1 = Convert.ToInt32(s1[1]), y2 = Convert.ToInt32(s1[3]);\n\t\t\tint x3 = Convert.ToInt32(s2[0]), x4 = Convert.ToInt32(s2[2]), y3 = Convert.ToInt32(s2[1]), y4 = Convert.ToInt32(s2[3]);\n\t\t\tint x5 = Convert.ToInt32(s3[0]), x6 = Convert.ToInt32(s3[2]), y5 = Convert.ToInt32(s3[1]), y6 = Convert.ToInt32(s3[3]);\n\t\t\t\n\t\t\tbool allPointsInside = (PointIsinside(x1, y1, x3, y3, x4, y4) || PointIsinside(x1, y1, x5, y5, x6, y6)) &&\n\t\t\t\t\t\t\t\t (PointIsinside(x2, y2, x3, y3, x4, y4) || PointIsinside(x2, y2, x5, y5, x6, y6)) &&\n\t\t\t\t\t\t\t\t (PointIsinside(x1, y2, x3, y3, x4, y4) || PointIsinside(x1, y2, x5, y5, x6, y6)) &&\n\t\t\t\t\t\t\t\t (PointIsinside(x2, y1, x3, y3, x4, y4) || PointIsinside(x2, y1, x5, y5, x6, y6));\n\n\t\t\tif ((x2 - x1) * (y2 - y1) == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\tConsole.ReadLine();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!allPointsInside)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\tConsole.ReadLine();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tIntersectSegment(ref x1, ref x2, x3, x4);\n\n\t\t\tif (!(x1 == 0 && x2 == 0))\n\t\t\t\tIntersectSegment(ref x1, ref x2, x5, x6);\n\n\t\t\tIntersectSegment(ref y1, ref y2, y3, y4);\n\n\t\t\tif (!(y1 == 0 && y2 == 0))\n\t\t\t\tIntersectSegment(ref y1, ref y2, y5, y6);\n\n\t\t\tConsole.WriteLine((x1 == 0 && x2 == 0 && y1 == 0 && y2 == 0) ? \"NO\" : \"YES\");\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tpublic static bool PointIsinside(int x1, int y1, int x2, int y2, int x3, int y3)\n\t\t{\n\t\t\treturn (x1 >= x2 && x1 <= x3 && y1 >= y2 && y1 <= y3);\n\t\t}\n\n\t\tpublic static void IntersectSegment(ref int x1, ref int x2, int x3, int x4)\n\t\t{\n\t\t\tif (x1 >= x3 && x1 <= x4)\n\t\t\t{\n\t\t\t\tif (x2 > x4)\n\t\t\t\t\tx1 = x4;\n\t\t\t\telse\n\t\t\t\t\tx1 = x2 = 0;\n\t\t\t} else if (x2 >= x3 && x2 <= x4)\n\t\t\t{\n\t\t\t\tif (x1 < x3)\n\t\t\t\t\tx2 = x3;\n\t\t\t\telse\n\t\t\t\t\tx1 = x2 = 0;\n\t\t\t} \n\t\t}\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "34a705dabff1165eea33910deb2f957d", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "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 struct Rect\n {\n public int xMin, xMax, yMin, yMax;\n public Rect(string s)\n {\n string[] sSplitted = s.Trim().Split();\n xMin = int.Parse(sSplitted[0]);\n yMin = int.Parse(sSplitted[1]);\n xMax = int.Parse(sSplitted[2]);\n yMax = int.Parse(sSplitted[3]);\n }\n public bool IsInsideOrAtBorder(double x_, double y_)\n {\n return x_ >= this.xMin && x_ <= this.xMax && y_ >= this.yMin && y_ <= this.yMax;\n }\n public override string ToString()\n {\n return \"x:\" + xMin + \"--\" + xMax + \"; y:\" + yMin + \"--\" + yMax;\n }\n }\n\n static void Main(string[] args)\n {\n Rect[] rects = new Rect[3];\n int[] allX = new int[6], allY = new int[6];\n for (int i = 0; i < 3; i++)\n {\n rects[i] = new Rect(Console.ReadLine());\n allX[2 * i] = rects[i].xMin;\n allX[2 * i + 1] = rects[i].xMax;\n allY[2 * i] = rects[i].yMin;\n allY[2 * i + 1] = rects[i].yMax;\n }\n Array.Sort(allX);\n Array.Sort(allY);\n string res = \"NO\";\n for (int i = 0; i < allX.Length; i++)\n {\n for (int j = 0; j < allY.Length; j++)\n {\n if (rects[0].IsInsideOrAtBorder(allX[i] + 0.25, allY[j] + 0.25)\n && !rects[1].IsInsideOrAtBorder(allX[i] + 0.25, allY[j] + 0.25)\n && !rects[2].IsInsideOrAtBorder(allX[i] + 0.25, allY[j] + 0.25))\n {\n res = \"YES\";\n }\n }\n }\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b8ca31bb96fec50f342c1fa1a2696b2", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n class Rectangle\n {\n public long x1;\n public long y1;\n public long x2;\n public long y2;\n\n \n public Rectangle IntersectionRectangle(Rectangle rectangle)\n {\n if ((this.x1 >= rectangle.x2 || this.x2 <= rectangle.x1) || (this.y1 >= rectangle.y2 || this.y2 <= rectangle.y1))\n {\n return new Rectangle();\n }\n else\n {\n var x1 = Math.Max(this.x1, rectangle.x1);\n var x2 = Math.Min(this.x2, rectangle.x2);\n\n var y1 = Math.Max(this.y1, rectangle.y1);\n var y2 = Math.Min(this.y2, rectangle.y2);\n\n var rect = new Rectangle()\n {\n x1 = x1,\n x2 = x2,\n y1 = y1,\n y2 = y2\n };\n return rect;\n }\n }\n\n public long Area()\n {\n return (x2 - x1) * (y2 - y1);\n }\n\n public static Rectangle ReadFromConsole()\n {\n var coords = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var rect = new Rectangle()\n {\n x1 = coords[0],\n y1 = coords[1],\n x2 = coords[2],\n y2 = coords[3]\n };\n return rect;\n }\n }\n\n static void Main(string[] args)\n {\n var whiteRect = Rectangle.ReadFromConsole();\n var blackRect1 = Rectangle.ReadFromConsole();\n var blackRect2 = Rectangle.ReadFromConsole();\n\n var b1w = whiteRect.IntersectionRectangle(blackRect1);\n var b2w = whiteRect.IntersectionRectangle(blackRect2);\n\n var b1b2 = blackRect1.IntersectionRectangle(blackRect2);\n var b1b2w = b1b2.IntersectionRectangle(whiteRect);\n\n var hasWhite = (whiteRect.Area() - (b1w.Area() + b2w.Area() - b1b2w.Area()) > 0);\n\n Console.WriteLine(hasWhite ? \"YES\" : \"NO\");\n }\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "948690dfc4f35428d5d4e78565f7bd4e", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n \nnamespace WhitePaper1216C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6;\n \n ParseStringXY(out x1, out y1, out x2, out y2);\n ParseStringXY(out x3, out y3, out x4, out y4);\n ParseStringXY(out x5, out y5, out x6, out y6);\n \n if (x3 <= x1 && x4 >= x2)\n {\n if (y4 >= y2 && y3 < y2)\n {\n if (y3 <= y1)\n {\n Console.Write(\"NO\");\n return;\n }\n y2 = y3;\n }\n else if (y3 <= y1 && y4 > y1)\n {\n if (y4 >= y2)\n {\n Console.Write(\"NO\");\n return;\n }\n y1 = y4;\n }\n }\n \n if (y3 <= y1 && y4 >= y2)\n {\n if (x4 >= x2 && x3 < x2)\n {\n if (x3 <= x1)\n {\n Console.Write(\"NO\");\n return;\n }\n x2 = x3;\n }\n else if (x3 <= x1 && x4 > x1)\n {\n if (x4 >= x2)\n {\n Console.Write(\"NO\");\n return;\n }\n x1 = x4;\n }\n }\n \n if (x1 == x2 || y1 == y2)\n Console.Write(\"NO\");\n \n if (x5 <= x1 && x6 >= x2)\n {\n if (y6 >= y2 && y5 < y2)\n {\n if (y5 <= y1)\n {\n Console.Write(\"NO\");\n return;\n }\n y2 = y5;\n }\n else if (y5 <= y1 && y6 > y1)\n {\n if (y6 >= y2)\n {\n Console.Write(\"NO\");\n return;\n }\n y1 = y6;\n }\n }\n \n if (y5 <= y1 && y6 >= y2)\n {\n if (x6 >= x2 && x5 < x2)\n {\n if (x5 <= x1)\n {\n Console.Write(\"NO\");\n return;\n }\n x2 = x5;\n }\n else if (x5 <= x1 && x6 > x1)\n {\n if (x6 >= x2)\n {\n Console.Write(\"NO\");\n return;\n }\n x1 = x6;\n }\n }\n \n if (x1 == x2 || y1 == y2)\n Console.Write(\"NO\");\n else\n Console.Write(\"YES\");\n }\n \n public static void ParseStringXY(out int x1, out int y1, out int x2, out int y2)\n {\n string[] tokens = Console.ReadLine().Split(' ');\n x1 = Int32.Parse(tokens[0]);\n y1 = Int32.Parse(tokens[1]);\n x2 = Int32.Parse(tokens[2]);\n y2 = Int32.Parse(tokens[3]);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "69a18efa7f6d20725de8a5607bbc737f", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Point\n {\n public long X;\n public long Y;\n\n public Point(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n class Rectangle\n {\n public Point LeftDawn;\n public Point LeftUp;\n public Point RightUpper;\n public Point RightDanwn;\n\n public Rectangle(Point ld, Point ru)\n {\n LeftDawn = ld;\n LeftUp = new Point(ld.X, ru.Y);\n RightUpper = ru;\n RightDanwn = new Point(ru.X, ld.Y);\n }\n\n public long S()\n {\n return (RightUpper.X - LeftDawn.X) * (RightUpper.Y - LeftDawn.Y);\n }\n\n public Rectangle Intersec(Rectangle other)\n {\n var interX = Intersec(new long[] { LeftUp.X, RightUpper.X }, \n new long[] { other.LeftDawn.X, other.RightDanwn.X });\n if (interX == null)\n return null;\n var interY = Intersec(new long[] { LeftDawn.Y, RightUpper.Y },\n new long[] { other.LeftDawn.Y, other.RightUpper.Y });\n if (interY == null)\n return null;\n\n return new Rectangle(new Point(interX[0], interY[0]), new Point(interX[1], interY[1]));\n }\n\n \n private long[] Intersec(long[] s1, long[] s2)\n {\n var left = s1;\n var right = s2;\n if (s2[0] < s1[0])\n {\n left = s2;\n right = s1;\n }\n\n if (left[1] < right[0])\n return null;\n if (right[0] <= left[1] && left[1] <= right[1])\n return new long[] { right[0], left[1] };\n return right;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var white = new Rectangle(new Point(data[0], data[1]), new Point(data[2], data[3]));\n\n data = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var black1 = new Rectangle(new Point(data[0], data[1]), new Point(data[2], data[3]));\n\n data = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var black2 = new Rectangle(new Point(data[0], data[1]), new Point(data[2], data[3]));\n\n var inter1 = white.Intersec(black1);\n var inter2 = white.Intersec(black2);\n var totalS = 0L;\n if (inter1 != null)\n totalS += inter1.S();\n if (inter2 != null)\n totalS += inter2.S();\n\n if(inter1 != null && inter2 != null)\n {\n var inter = inter1.Intersec(inter2);\n if (inter != null)\n totalS -= inter.S();\n }\n\n var whiteS = white.S();\n if(whiteS > totalS)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "87f431347f38185a17163c1af195bce9", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Problems\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x1, y1, x2, y2;\n\n string[] input = Console.ReadLine().Split(' ');\n\n x1 = Convert.ToInt32(input[0]);\n y1 = Convert.ToInt32(input[1]);\n x2 = Convert.ToInt32(input[2]);\n y2 = Convert.ToInt32(input[3]);\n\n int x3, y3, x4, y4;\n\n input = Console.ReadLine().Split(' ');\n\n x3 = Convert.ToInt32(input[0]);\n y3 = Convert.ToInt32(input[1]);\n x4 = Convert.ToInt32(input[2]);\n y4 = Convert.ToInt32(input[3]);\n\n int x5, y5, x6, y6;\n\n input = Console.ReadLine().Split(' ');\n\n x5 = Convert.ToInt32(input[0]);\n y5 = Convert.ToInt32(input[1]);\n x6 = Convert.ToInt32(input[2]);\n y6 = Convert.ToInt32(input[3]);\n\n bool allCovered = false;\n\n if(x3 <= x1 && y3 <= y1 && x4 >= x2 && y4 >= y2)\n {\n //Console.WriteLine(\"In 1\");\n allCovered = true;\n }\n else if(x5 <= x1 && y5 <= y1 && x6 >= x2 && y6 >= y2)\n {\n //Console.WriteLine(\"In 2\");\n allCovered = true;\n }\n else if(x3 <= x1 && y3 <= y1 && x4 < x2 && y4 >= y2)\n {\n if(x5 <= x4 && y5 <= y1 && y6 >= y2 && x6 >= x2)\n {\n //Console.WriteLine(\"In 3\");\n allCovered = true;\n }\n }\n else if(x5 <= x1 && y5 <= y1 && x6 < x2 && y6 >= y2)\n {\n if(x3 <= x6 && y3 <= y1 && y4 >= y2 && x4 >= x2)\n {\n //Console.WriteLine(\"In 4\");\n allCovered = true;\n }\n }\n else if(x3 <= x1 && y3 <= y1 && x4 >= x2 && y4 < y2)\n {\n if(y5 <= y4 && x5 <= x1 && x6 >= x2 && y6 >= y2)\n {\n //Console.WriteLine(\"In 5\");\n allCovered = true;\n }\n }\n else if(x5 <= x1 && y5 <= y1 && x6 >= x2 && y6 < y2)\n {\n if(y3 <= y6 && x3 <= x1 && x4 >= x2 && y4 >= y2)\n {\n //Console.WriteLine(\"In 6\");\n allCovered = true;\n }\n }\n\n if(allCovered) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "26dff3f43a71028a31d13b99086115d6", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace WhitePaper1216C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6;\n\n ParseStringXY(out x1, out y1, out x2, out y2);\n ParseStringXY(out x3, out y3, out x4, out y4);\n ParseStringXY(out x5, out y5, out x6, out y6);\n\n if (x3 <= x1 && x4 >= x2)\n {\n if (y4 >= y2 && y3 < y2)\n {\n if (y3 <= y1)\n {\n Console.Write(\"NO\");\n return;\n }\n y2 = y3;\n }\n else if (y3 <= y1 && y4 > y1)\n {\n if (y4 >= y2)\n {\n Console.Write(\"NO\");\n return;\n }\n y1 = y4;\n }\n }\n\n if (y3 <= y1 && y4 >= y2)\n {\n if (x4 >= x2 && x3 < x2)\n {\n if (x3 <= x1)\n {\n Console.Write(\"NO\");\n return;\n }\n x2 = x3;\n }\n else if (x3 <= x1 && x4 > x1)\n {\n if (x4 >= x2)\n {\n Console.Write(\"NO\");\n return;\n }\n x1 = x4;\n }\n }\n\n if (x1 == x2 || y1 == y2)\n Console.Write(\"NO\");\n\n if (x5 <= x1 && x6 >= x2)\n {\n if (y6 >= y2 && y5 < y2)\n {\n if (y5 <= y1)\n {\n Console.Write(\"NO\");\n return;\n }\n y2 = y5;\n }\n else if (y5 <= y1 && y6 > y1)\n {\n if (y6 >= y2)\n {\n Console.Write(\"NO\");\n return;\n }\n y1 = y6;\n }\n }\n\n if (y5 <= y1 && y6 >= y2)\n {\n if (x6 >= x2 && x5 < x2)\n {\n if (x5 <= x1)\n {\n Console.Write(\"NO\");\n return;\n }\n x2 = x5;\n }\n else if (x5 <= x1 && x6 > x1)\n {\n if (x6 >= x2)\n {\n Console.Write(\"NO\");\n return;\n }\n x1 = x6;\n }\n }\n\n if (x1 == x2 || y1 == y2)\n Console.Write(\"NO\");\n else\n Console.Write(\"YES\");\n }\n\n public static void ParseStringXY(out int x1, out int y1, out int x2, out int y2)\n {\n string[] tokens = Console.ReadLine().Split(' ');\n x1 = Int32.Parse(tokens[0]);\n y1 = Int32.Parse(tokens[1]);\n x2 = Int32.Parse(tokens[2]);\n y2 = Int32.Parse(tokens[3]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7b8c7a54aab715c93de5cc2b22217b90", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CF587.C\n{\n public enum OverlapType\n {\n LeftTopAngle,\n LeftBottomAngle,\n\n RightTopAngle,\n RightBottomAngle,\n\n LeftFull,\n LeftPartial,\n\n RightFull,\n RightPartial,\n\n TopFull,\n TopPartial,\n\n BottomFull,\n BottomPartial,\n\n NoOverlap,\n Center,\n FullOverlap\n }\n\n public class Program\n {\n private static OverlapType Overlap(\n (int x, int y) firstMin,\n (int x, int y) firstMax,\n (int x, int y) secondMin,\n (int x, int y) secondMax)\n {\n if (secondMin.x > firstMax.x || secondMax.x < firstMin.x)\n {\n return OverlapType.NoOverlap;\n }\n\n if (secondMin.y > firstMax.y || secondMax.y < firstMin.y)\n {\n return OverlapType.NoOverlap;\n }\n\n if (secondMin.x <= firstMin.x)\n {\n if (secondMax.x >= firstMax.x)\n {\n if (secondMin.y <= firstMin.y)\n {\n if (secondMax.y >= firstMax.y)\n {\n return OverlapType.FullOverlap;\n }\n else\n {\n return OverlapType.BottomFull;\n }\n }\n else\n {\n if (secondMax.y >= firstMax.y)\n {\n return OverlapType.TopFull;\n }\n else\n {\n return OverlapType.Center;\n }\n }\n }\n else\n {\n if (secondMin.y <= firstMin.y)\n {\n if (secondMax.y >= firstMax.y)\n {\n return OverlapType.LeftFull;\n }\n else\n {\n return OverlapType.LeftBottomAngle;\n }\n }\n else\n {\n if (secondMax.y >= firstMax.y)\n {\n return OverlapType.LeftTopAngle;\n }\n else\n {\n return OverlapType.LeftPartial;\n }\n }\n }\n }\n else\n {\n // secondMin.x > firstMin.x\n if (secondMax.x >= firstMax.x)\n {\n if (secondMin.y <= firstMin.y)\n {\n if (secondMax.y >= firstMax.y)\n {\n return OverlapType.RightFull;\n }\n else\n {\n return OverlapType.RightBottomAngle;\n }\n }\n else\n {\n // secondMin.y > firstMin.y\n if (secondMax.y >= firstMax.y)\n {\n return OverlapType.RightTopAngle;\n }\n else\n {\n return OverlapType.RightPartial;\n }\n }\n }\n else\n {\n // secondMax.x < firstMax.x\n if (secondMin.y <= firstMin.y)\n {\n if (secondMax.y >= firstMax.y)\n {\n return OverlapType.Center;\n }\n else\n {\n return OverlapType.BottomPartial;\n }\n }\n else\n {\n if (secondMax.y >= firstMax.y)\n {\n return OverlapType.TopPartial;\n }\n else\n {\n return OverlapType.Center;\n }\n }\n }\n }\n\n return OverlapType.FullOverlap;\n }\n\n public static void Main(string[] args)\n {\n var firstStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();\n var secondStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();\n var thirdStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();\n\n var whiteCoordinatesMin = (x: int.Parse(firstStr[0]), y: int.Parse(firstStr[1]));\n var whiteCoordinatesMax = (x: int.Parse(firstStr[2]), y: int.Parse(firstStr[3]));\n\n var firstBlackCoordinatesMin = (x: int.Parse(secondStr[0]), y: int.Parse(secondStr[1]));\n var firstBlackCoordinatesMax = (x: int.Parse(secondStr[2]), y: int.Parse(secondStr[3]));\n\n var secondBlackCoordinatesMin = (x: int.Parse(thirdStr[0]), y: int.Parse(thirdStr[1]));\n var secondBlackCoordinatesMax = (x: int.Parse(thirdStr[2]), y: int.Parse(thirdStr[3]));\n\n var firstOverlap = Overlap(\n whiteCoordinatesMin,\n whiteCoordinatesMax,\n firstBlackCoordinatesMin,\n firstBlackCoordinatesMax);\n\n var secondOverlap = Overlap(\n whiteCoordinatesMin,\n whiteCoordinatesMax,\n secondBlackCoordinatesMin,\n secondBlackCoordinatesMax);\n\n var result = \"YES\";\n switch (firstOverlap)\n {\n case OverlapType.LeftTopAngle:\n case OverlapType.LeftBottomAngle:\n case OverlapType.RightTopAngle:\n case OverlapType.RightBottomAngle:\n case OverlapType.BottomPartial:\n case OverlapType.TopPartial:\n case OverlapType.LeftPartial:\n case OverlapType.RightPartial:\n case OverlapType.NoOverlap:\n case OverlapType.Center:\n if (secondOverlap == OverlapType.FullOverlap) result = \"NO\";\n break;\n\n case OverlapType.RightFull:\n if (secondOverlap == OverlapType.FullOverlap) result = \"NO\";\n if (secondOverlap == OverlapType.LeftFull &&\n secondBlackCoordinatesMax.x >= firstBlackCoordinatesMin.x) result = \"NO\";\n break;\n\n case OverlapType.TopFull:\n if (secondOverlap == OverlapType.FullOverlap) result = \"NO\";\n if (secondOverlap == OverlapType.BottomFull &&\n firstBlackCoordinatesMax.y >= secondBlackCoordinatesMin.y) result = \"NO\";\n break;\n\n case OverlapType.LeftFull:\n if (secondOverlap == OverlapType.FullOverlap) result = \"NO\";\n if (secondOverlap == OverlapType.RightFull &&\n firstBlackCoordinatesMax.x >= secondBlackCoordinatesMin.x) result = \"NO\";\n break;\n\n case OverlapType.BottomFull:\n if (secondOverlap == OverlapType.FullOverlap) result = \"NO\";\n if (secondOverlap == OverlapType.TopFull &&\n secondBlackCoordinatesMax.y >= firstBlackCoordinatesMin.y) result = \"NO\";\n break;\n\n case OverlapType.FullOverlap:\n result = \"NO\";\n break;\n\n default:\n throw new ArgumentOutOfRangeException();\n }\n\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2523722aea13d62b6fc271ebcdc9e96b", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "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 line = Console.ReadLine();\n \n long x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6;\n \n x1 = long.Parse(line.Split(' ')[0]);\n y1 = long.Parse(line.Split(' ')[1]);\n x2 = long.Parse(line.Split(' ')[2]);\n y2 = long.Parse(line.Split(' ')[3]);\n \n line = Console.ReadLine();\n \n x3 = long.Parse(line.Split(' ')[0]);\n y3 = long.Parse(line.Split(' ')[1]);\n x4 = long.Parse(line.Split(' ')[2]);\n y4 = long.Parse(line.Split(' ')[3]);\n \n line = Console.ReadLine();\n x5 = long.Parse(line.Split(' ')[0]);\n y5 = long.Parse(line.Split(' ')[1]);\n x6 = long.Parse(line.Split(' ')[2]);\n y6 = long.Parse(line.Split(' ')[3]);\n \n \n long area1 = 0, area2 = 0, area3 = 0;\n \n if (x3 <= x1)\n {\n x3 = x1;\n }\n \n if (x4 >= x2)\n {\n x4 = x2;\n }\n \n if (y3 <= y1)\n {\n y3 = y1;\n }\n \n if (y4 >= y2)\n {\n y4 = y2;\n }\n \n if (x3 <= x4 && y3 <= y4)\n {\n area2 = (x4 - x3) * (y4 - y3);\n }\n \n if (x5 <= x1)\n {\n x5 = x1;\n }\n \n if (x6 >= x2)\n {\n x6 = x2;\n }\n \n if (y5 <= y1)\n {\n y5 = y1;\n }\n \n if (y6 >= y2)\n {\n y6 = y2;\n }\n \n if (x5 <= x6 && y5 <= y6)\n {\n area3 = (x6 - x5) * (y6 - y5);\n }\n \n var result = false;\n \n if (x1 == x3 && y1 == y3 && x2 == x4 && y2 == y4)\n {\n result = true;\n }\n else if (x1 == x5 && y1 == y5 && x2 == x6 && y2 == y6)\n {\n result = true;\n }\n else if (area2 == 0 || area3 == 0)\n {\n result = false;\n }\n else if (area2 > 0 && area3 > 0 && ((x4-x3 + x6-x5) >= (x2-x1)) && y1 == y3 && y2 == y4 && y1 == y5 && y2 == y6)\n {\n result = true;\n }\n else if (area2 > 0 && area3 > 0 && ((y4 - y3 + y6 - y5) >= (y2 - y1)) && x1 == x3 && x2 == x4 && x1 == x5 && x2 == x6)\n {\n result = true;\n }\n \n \n Console.WriteLine(!result ? \"YES\" : \"NO\");\n \n \n \n }\n \n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2b1e0b0cd5f6590f69eef55e8438e9f9", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Problems\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x1, y1, x2, y2;\n\n string[] input = Console.ReadLine().Split(' ');\n\n x1 = Convert.ToInt32(input[0]);\n y1 = Convert.ToInt32(input[1]);\n x2 = Convert.ToInt32(input[2]);\n y2 = Convert.ToInt32(input[3]);\n\n int x3, y3, x4, y4;\n\n input = Console.ReadLine().Split(' ');\n\n x3 = Convert.ToInt32(input[0]);\n y3 = Convert.ToInt32(input[1]);\n x4 = Convert.ToInt32(input[2]);\n y4 = Convert.ToInt32(input[3]);\n\n int x5, y5, x6, y6;\n\n input = Console.ReadLine().Split(' ');\n\n x5 = Convert.ToInt32(input[0]);\n y5 = Convert.ToInt32(input[1]);\n x6 = Convert.ToInt32(input[2]);\n y6 = Convert.ToInt32(input[3]);\n\n bool allCovered = false;\n\n if(x3 <= x1 && y3 <= y1 && x4 >= x2 && y4 >= y2)\n {\n allCovered = true;\n }\n else if(x5 <= x1 && y5 <= y1 && x6 >= x2 && y6 >= y2)\n {\n allCovered = true;\n }\n else if(x3 <= x1 && y3 <= y1 && x4 < x2 && y4 >= y2)\n {\n if(x5 == x4 && y5 <= y1 && y6 >= y2 && x6 >= x2)\n {\n allCovered = true;\n }\n }\n else if(x5 <= x1 && y5 <= y1 && x6 < x2 && y6 >= y2)\n {\n if(x3 == x6 && y3 <= y1 && y4 >= y2 && x4 >= x2)\n {\n allCovered = true;\n }\n }\n else if(x3 <= x1 && y3 <= y1 && x4 >= x2 && y4 < y2)\n {\n if(y5 == y4 && x5 <= x1 && x6 >= x2 && y6 >= y2)\n {\n allCovered = true;\n }\n }\n else if(x5 <= x1 && y5 <= y1 && x6 >= x2 && y6 < y2)\n {\n if(y3 == y6 && x3 <= x1 && x4 >= x2 && y4 >= y2)\n {\n allCovered = true;\n }\n }\n\n if(allCovered) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "490f5ca8b8bc03a4261c0f6f9be9b925", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n class Rectangle\n {\n public int x1;\n public int y1;\n public int x2;\n public int y2;\n\n \n public Rectangle IntersectionRectangle(Rectangle rectangle)\n {\n if ((this.x1 >= rectangle.x2 || this.x2 <= rectangle.x1) || (this.y1 >= rectangle.y2 || this.y2 <= rectangle.y1))\n {\n return new Rectangle();\n }\n else\n {\n var x1 = Math.Max(this.x1, rectangle.x1);\n var x2 = Math.Min(this.x2, rectangle.x2);\n\n var y1 = Math.Max(this.y1, rectangle.y1);\n var y2 = Math.Min(this.y2, rectangle.y2);\n\n var rect = new Rectangle()\n {\n x1 = x1,\n x2 = x2,\n y1 = y1,\n y2 = y2\n };\n return rect;\n }\n }\n\n public int Area()\n {\n return (x2 - x1) * (y2 - y1);\n }\n\n public static Rectangle ReadFromConsole()\n {\n var coords = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var rect = new Rectangle()\n {\n x1 = coords[0],\n y1 = coords[1],\n x2 = coords[2],\n y2 = coords[3]\n };\n return rect;\n }\n }\n\n static void Main(string[] args)\n {\n var whiteRect = Rectangle.ReadFromConsole();\n var blackRect1 = Rectangle.ReadFromConsole();\n var blackRect2 = Rectangle.ReadFromConsole();\n\n var b1w = whiteRect.IntersectionRectangle(blackRect1);\n var b2w = whiteRect.IntersectionRectangle(blackRect2);\n\n var b1b2 = blackRect1.IntersectionRectangle(blackRect2);\n var b1b2w = b1b2.IntersectionRectangle(whiteRect);\n\n var hasWhite = (whiteRect.Area() - (b1w.Area() + b2w.Area() - b1b2w.Area()) > 0);\n\n Console.WriteLine(hasWhite ? \"YES\" : \"NO\");\n }\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ebc7199f3503f438061759fd131682f8", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\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\tList s1 = Console.ReadLine().Split(new char[] { ' ' }).ToList();\n\t\t\tList s2 = Console.ReadLine().Split(new char[] { ' ' }).ToList();\n\t\t\tList s3 = Console.ReadLine().Split(new char[] { ' ' }).ToList();\n\n\t\t\tint x1 = Convert.ToInt32(s1[0]), x2 = Convert.ToInt32(s1[2]), y1 = Convert.ToInt32(s1[1]), y2 = Convert.ToInt32(s1[3]);\n\t\t\tint x3 = Convert.ToInt32(s2[0]), x4 = Convert.ToInt32(s2[2]), y3 = Convert.ToInt32(s2[1]), y4 = Convert.ToInt32(s2[3]);\n\t\t\tint x5 = Convert.ToInt32(s3[0]), x6 = Convert.ToInt32(s3[2]), y5 = Convert.ToInt32(s3[1]), y6 = Convert.ToInt32(s3[3]);\n\t\t\t\n\t\t\tbool allPointsInside = (PointIsinside(x1, y1, x3, y3, x4, y4) || PointIsinside(x1, y1, x5, y5, x6, y6)) &&\n\t\t\t\t\t\t\t\t (PointIsinside(x2, y2, x3, y3, x4, y4) || PointIsinside(x2, y2, x5, y5, x6, y6)) &&\n\t\t\t\t\t\t\t\t (PointIsinside(x1, y2, x3, y3, x4, y4) || PointIsinside(x1, y2, x5, y5, x6, y6)) &&\n\t\t\t\t\t\t\t\t (PointIsinside(x2, y1, x3, y3, x4, y4) || PointIsinside(x2, y1, x5, y5, x6, y6));\n\n\t\t\tif (!allPointsInside)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\tConsole.ReadLine();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tIntersectSegment(ref x1, ref x2, x3, x4);\n\n\t\t\tif (!(x1 == 0 && x2 == 0))\n\t\t\t\tIntersectSegment(ref x1, ref x2, x5, x6);\n\n\t\t\tIntersectSegment(ref y1, ref y2, y3, y4);\n\n\t\t\tif (!(y1 == 0 && y2 == 0))\n\t\t\t\tIntersectSegment(ref y1, ref y2, y5, y6);\n\n\t\t\tConsole.WriteLine((x1 == 0 && x2 == 0 && y1 == 0 && y2 == 0) ? \"NO\" : \"YES\");\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tpublic static bool PointIsinside(int x1, int y1, int x2, int y2, int x3, int y3)\n\t\t{\n\t\t\treturn (x1 >= x2 && x1 <= x3 && y1 >= y2 && y1 <= y3);\n\t\t}\n\n\t\tpublic static void IntersectSegment(ref int x1, ref int x2, int x3, int x4)\n\t\t{\n\t\t\tif (x1 >= x3 && x1 <= x4)\n\t\t\t{\n\t\t\t\tif (x2 > x4)\n\t\t\t\t\tx1 = x4;\n\t\t\t\telse\n\t\t\t\t\tx1 = x2 = 0;\n\t\t\t} else if (x2 >= x3 && x2 <= x4)\n\t\t\t{\n\t\t\t\tif (x1 < x3)\n\t\t\t\t\tx1 = x3;\n\t\t\t\telse\n\t\t\t\t\tx1 = x2 = 0;\n\t\t\t} \n\t\t}\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8d07818337ec637fd3b16eab5bf6c489", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\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\tList s1 = Console.ReadLine().Split(new char[] { ' ' }).ToList();\n\t\t\tList s2 = Console.ReadLine().Split(new char[] { ' ' }).ToList();\n\t\t\tList s3 = Console.ReadLine().Split(new char[] { ' ' }).ToList();\n\n\t\t\tint x1 = Convert.ToInt32(s1[0]), x2 = Convert.ToInt32(s1[2]), y1 = Convert.ToInt32(s1[1]), y2 = Convert.ToInt32(s1[3]);\n\t\t\tint x3 = Convert.ToInt32(s2[0]), x4 = Convert.ToInt32(s2[2]), y3 = Convert.ToInt32(s2[1]), y4 = Convert.ToInt32(s2[3]);\n\t\t\tint x5 = Convert.ToInt32(s3[0]), x6 = Convert.ToInt32(s3[2]), y5 = Convert.ToInt32(s3[1]), y6 = Convert.ToInt32(s3[3]);\n\t\t\t\n\t\t\tbool allPointsInside = (PointIsinside(x1, y1, x3, y3, x4, y4) || PointIsinside(x1, y1, x5, y5, x6, y6)) &&\n\t\t\t\t\t\t\t\t (PointIsinside(x2, y2, x3, y3, x4, y4) || PointIsinside(x2, y2, x5, y5, x6, y6)) &&\n\t\t\t\t\t\t\t\t (PointIsinside(x1, y2, x3, y3, x4, y4) || PointIsinside(x1, y2, x5, y5, x6, y6)) &&\n\t\t\t\t\t\t\t\t (PointIsinside(x2, y1, x3, y3, x4, y4) || PointIsinside(x2, y1, x5, y5, x6, y6));\n\n\t\t\tif (!allPointsInside)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(!(x1 == x2 && x1 == y1 && x1 == y2) ? \"YES\" : \"NO\");\n\t\t\t\tConsole.ReadLine();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tIntersectSegment(ref x1, ref x2, x3, x4);\n\n\t\t\tif (!(x1 == 0 && x2 == 0))\n\t\t\t\tIntersectSegment(ref x1, ref x2, x5, x6);\n\n\t\t\tIntersectSegment(ref y1, ref y2, y3, y4);\n\n\t\t\tif (!(y1 == 0 && y2 == 0))\n\t\t\t\tIntersectSegment(ref y1, ref y2, y5, y6);\n\n\t\t\tConsole.WriteLine((x1 == 0 && x2 == 0 && y1 == 0 && y2 == 0) ? \"NO\" : \"YES\");\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tpublic static bool PointIsinside(int x1, int y1, int x2, int y2, int x3, int y3)\n\t\t{\n\t\t\treturn (x1 >= x2 && x1 <= x3 && y1 >= y2 && y1 <= y3);\n\t\t}\n\n\t\tpublic static void IntersectSegment(ref int x1, ref int x2, int x3, int x4)\n\t\t{\n\t\t\tif (x1 >= x3 && x1 <= x4)\n\t\t\t{\n\t\t\t\tif (x2 > x4)\n\t\t\t\t\tx1 = x4;\n\t\t\t\telse\n\t\t\t\t\tx1 = x2 = 0;\n\t\t\t} else if (x2 >= x3 && x2 <= x4)\n\t\t\t{\n\t\t\t\tif (x1 < x3)\n\t\t\t\t\tx1 = x3;\n\t\t\t\telse\n\t\t\t\t\tx1 = x2 = 0;\n\t\t\t} \n\t\t}\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fecaefc052894a848e2e65a5238100eb", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CF587.C\n{\n public class Rectangle\n {\n public int MinX { get; set; }\n public int MinY { get; set; }\n\n public int MaxX { get; set; }\n public int MaxY { get; set; }\n }\n\n public enum OverlapType\n {\n Partial,\n Full,\n No,\n Right,\n Top,\n Left,\n Bottom,\n }\n\n public class Program\n {\n public static OverlapType GetOverlapType(Rectangle r1, Rectangle r2)\n {\n if (r2.MinX > r1.MaxX || r2.MaxX < r1.MinX) return OverlapType.No;\n if (r2.MinY > r1.MaxY || r2.MaxY < r1.MinY) return OverlapType.No;\n if (r2.MinX <= r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Full;\n if (r2.MinX <= r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY < r1.MaxY) return OverlapType.Bottom;\n if (r2.MinX <= r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY > r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Top;\n if (r2.MinX <= r1.MinX && r2.MaxX < r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Left;\n if (r2.MinX > r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Right;\n return OverlapType.Partial;\n }\n\n public static void Main(string[] args)\n {\n var firstStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();\n var secondStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();\n var thirdStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();\n\n var white = new Rectangle\n {\n MinX = int.Parse(firstStr[0]),\n MinY = int.Parse(firstStr[1]),\n MaxX = int.Parse(firstStr[2]),\n MaxY = int.Parse(firstStr[3]),\n };\n\n var b1 = new Rectangle\n {\n MinX = int.Parse(secondStr[0]),\n MinY = int.Parse(secondStr[1]),\n MaxX = int.Parse(secondStr[2]),\n MaxY = int.Parse(secondStr[3]),\n };\n\n var b2 = new Rectangle\n {\n MinX = int.Parse(thirdStr[0]),\n MinY = int.Parse(thirdStr[1]),\n MaxX = int.Parse(thirdStr[2]),\n MaxY = int.Parse(thirdStr[3]),\n };\n\n var firstOverlap = GetOverlapType(white, b1);\n var secondOverlap = GetOverlapType(white, b2);\n\n var result = \"YES\";\n switch (firstOverlap)\n {\n case OverlapType.Full:\n result = \"NO\";\n break;\n\n case OverlapType.No:\n case OverlapType.Partial:\n if (secondOverlap == OverlapType.Full) result = \"NO\";\n break;\n\n case OverlapType.Right:\n if (secondOverlap == OverlapType.Full) result = \"NO\";\n if (secondOverlap == OverlapType.Left && b2.MaxX >= b1.MinY) result = \"NO\";\n break;\n\n case OverlapType.Top:\n if (secondOverlap == OverlapType.Full) result = \"NO\";\n if (secondOverlap == OverlapType.Bottom && b2.MaxY >= b1.MinY) result = \"NO\";\n break;\n\n case OverlapType.Left:\n if (secondOverlap == OverlapType.Full) result = \"NO\";\n if (secondOverlap == OverlapType.Right && b1.MaxX >= b2.MinX) result = \"NO\";\n break;\n\n case OverlapType.Bottom:\n if (secondOverlap == OverlapType.Full) result = \"NO\";\n if (secondOverlap == OverlapType.Top && b1.MaxY >= b2.MinY) result = \"NO\";\n break;\n\n default:\n throw new ArgumentOutOfRangeException();\n }\n\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "114315e74f47ce24f3dd94cd649e248b", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700} {"lang": "Mono C#", "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 char[][] nums;\n static int k, n, ans;\n\n static void gen(int l, int r)\n {\n if (l==r)\n {\n int min = int.MaxValue;\n int max = int.MinValue;\n for (int num = 0; num < n; num++)\n {\n if (int.Parse(new string(nums[num])) > max)\n max = int.Parse(new string(nums[num]));\n\n if (int.Parse(new string(nums[num])) < min)\n min = int.Parse(new string(nums[num]));\n }\n\n ans = Math.Min(ans, max - min);\n }\n else\n {\n for (int i = l; i <= r; i++)\n {\n for (int num = 0; num < n; num++)\n {\n char tmp = nums[num][l];\n nums[num][l] = nums[num][i];\n nums[num][i] = tmp;\n }\n gen(l + 1, r);\n for (int num = 0; num < n; num++)\n {\n char tmp = nums[num][l];\n nums[num][l] = nums[num][i];\n nums[num][i] = tmp;\n }\n\n }\n }\n }\n\n static void Main(string[] args)\n {\n string[] strarr = Console.ReadLine().Split(' ');\n n = int.Parse(strarr[0]);\n k = int.Parse(strarr[1]);\n\n nums = new char[n][];\n for (int i = 0; i < n; i++)\n nums[i] = Console.ReadLine().ToCharArray();\n\n ans = int.MaxValue;\n gen(0, k - 1);\n Console.WriteLine(ans);\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bf29c07847376b86586463f34c814d6d", "src_uid": "08f85cd4ffbd135f0b630235209273a4", "difficulty": 1400} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Permutations\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 < nn.Length; i++)\n {\n nn[i] = new int[k];\n }\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < k; j++)\n {\n nn[i][j] = Next();\n }\n }\n\n var perm = new int[k];\n for (int i = 0; i < k; i++)\n {\n perm[i] = i;\n }\n\n int min = int.MaxValue;\n\n do\n {\n int mi = int.MaxValue;\n int ma = int.MinValue;\n\n for (int i = 0; i < n; i++)\n {\n int sum = 0;\n for (int j = 0; j < k; j++)\n {\n sum = sum*10 + nn[i][perm[j]];\n }\n mi = Math.Min(mi, sum);\n ma = Math.Max(ma, sum);\n }\n\n min = Math.Min(min, ma - mi);\n } while (NextPermutation(perm));\n\n writer.WriteLine(min);\n writer.Flush();\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 do\n {\n c = reader.Read();\n } while (c < '0' || c > '9');\n return c - '0';\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5a61478596f6333c909500ffc3bda561", "src_uid": "08f85cd4ffbd135f0b630235209273a4", "difficulty": 1400} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _Permutations\n{\n class ProgramPermutations\n {\n public static int[] Digits(int num)\n {\n var d = new Stack();\n if (num == 0) d.Push(0);\n\n while (num > 0)\n {\n d.Push(num % 10);\n num /= 10;\n }\n\n return d.ToArray();\n }\n\n public static int DigitsToNum(int[] digits)\n {\n var result = 0;\n var mult = 1;\n for (var i = digits.Length - 1; i >= 0; i--)\n {\n result += digits[i] * mult;\n mult *= 10;\n }\n\n return result;\n }\n\n static IEnumerable GetPerms(List seq)\n {\n seq.Sort();\n var len = seq.Count();\n var n = len - 1;\n var lst = new List {seq.ToArray()};\n\n while (true)\n {\n var k = -1;\n for (var i = 0; i < n; i++)\n {\n if (seq[i] < seq[i + 1]) k = i;\n }\n if (k == -1) break;\n var l = -1;\n for (var i = 0; i < len; i++)\n {\n if (seq[k] < seq[i]) l = i;\n }\n var temp = seq[k];\n seq[k] = seq[l];\n seq[l] = temp;\n\n var seqNext = new int[len];\n for (var i = 0; i <= k; i++)\n {\n seqNext[i] = seq[i];\n }\n for (var i = n; i > k; i--)\n {\n seqNext[k + len - i] = seq[i];\n }\n lst.Add(seqNext);\n seq = new List(seqNext);\n //Console.WriteLine(DigitsToNum(seqNext));\n }\n\n return lst;\n }\n\n static bool GreaterThan(IList num1, IList num2, int k)\n {\n for (var i = 0; i < k; i++)\n {\n if (num1[i] < num2[i]) return false;\n if (num1[i] > num2[i]) return true;\n }\n return false;\n }\n\n static bool LessThan(IList num1, IList num2, int k)\n {\n for (var i=0; i num2[i]) return false;\n if (num1[i] < num2[i]) return true;\n }\n return false;\n }\n\n static void Main(string[] args)\n {\n if (args.Count() > 0)\n {\n var r = new Random(1021);\n\n Console.WriteLine(\"{0} {1}\", args[0], args[1]);\n for (var i=0; i>();\n for (var i = 0; i < n; i++)\n {\n var strNum = Console.ReadLine();\n if (string.IsNullOrEmpty(strNum)) return;\n var num = strNum.Select(c => c - 48).ToList();\n nums.Add(num);\n }\n\n // Numbers from 0..k-1 in order\n var seq = new List();\n for (var i=0; i();\n var minNum = new List();\n for (var i = 0; i < k; i++)\n {\n maxNum.Add(0);\n minNum.Add(9);\n }\n\n foreach (var i in nums)\n {\n var permDigits = new int[k];\n for (var j = 0; j < k; j++)\n {\n permDigits[j] = i[perm[j]];\n }\n if (GreaterThan(permDigits, maxNum, k)) maxNum = new List(permDigits);\n if (LessThan(permDigits, minNum, k)) minNum = new List(permDigits);\n //var newNum = DigitsToNum(permDigits);\n //if (newNum > maxNum) maxNum = newNum;\n //if (newNum < minNum) minNum = newNum;\n }\n var diff = DigitsToNum(maxNum.ToArray()) - DigitsToNum(minNum.ToArray());\n //Console.WriteLine(\"{0} - {1} = {2}\", DigitsToNum(maxNum.ToArray()), DigitsToNum(minNum.ToArray()), diff);\n if (diff < minDifference) minDifference = diff;\n }\n Console.WriteLine(minDifference);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b8db79b29eede9fd6aee314c9395e5b", "src_uid": "08f85cd4ffbd135f0b630235209273a4", "difficulty": 1400} {"lang": "C# 8", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "788aa29e1693b8a3d5cce8e868bf0d9c", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700} {"lang": "C# 8", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f491b9333061bac6ce674bc9fdd50e90", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700} {"lang": "C# 8", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8302b48716cc5a0f239285b2e00ab3da", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing 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[] sum = new int[N + 1];\r\n int[] links = new int[N];\r\n for (int n = 2; n <= N; n++)\r\n {\r\n Array.Fill(links, 1, 1, n - 1);\r\n sum[1] = 1;\r\n for (int i = 2; i <= n; i++)\r\n {\r\n links[n / i]++;\r\n }\r\n for (int i = 1; i < n; i++)\r\n {\r\n sum[n] = (int)((sum[n] + (sum[i] * ((long)links[i]))) % m);\r\n }\r\n }\r\n\r\n Out.WriteLine(sum[N]);\r\n }\r\n\r\n [Conditional(\"DEBUG\")]\r\n internal static void PrintTime(Stopwatch stopwatch) => WriteLine(stopwatch.Elapsed);\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "92e4f4f21a65ad232f93e5e360b10024", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700} {"lang": "C# 8", "source_code": "using System;\r\nusing 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 + 1];\r\n f[n] = 1;\r\n for (; n > 1; n--)\r\n {\r\n int[] f1 = new int[n]; //f.Take(n).ToArray();\r\n f1[1] = f[1];\r\n int[] sum = new int[n + 1];\r\n for (int i = n; i > 1; i--)\r\n {\r\n sum[i - 1] = (sum[i] + f[i]) % m;\r\n }\r\n for (int x = n; x > 1; x--)\r\n {\r\n f1[x - 1] = (f1[x - 1] + sum[x - 1]) % m;\r\n for (int i = 2; i <= x;)\r\n {\r\n int index = x / i;\r\n int maxIndex = x / index;\r\n int count = maxIndex - i + 1;\r\n f1[index] = (int)((f1[index] + ((long)count * f[x])) % m);\r\n i += count;\r\n }\r\n //for (int i = 1; i <= x; i++)\r\n //{\r\n // int index = x / (i + 1);\r\n // f1[x - i] = (f1[x - i] + f[x]) % m;\r\n // f1[index] = (f1[index] + f[x]) % m;\r\n //}\r\n }\r\n f = f1;\r\n }\r\n Out.WriteLine(f[1]);\r\n }\r\n\r\n [Conditional(\"DEBUG\")]\r\n internal static void PrintTime(Stopwatch stopwatch) => WriteLine(stopwatch.Elapsed);\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e372d18bee96daba9fe0082a1a2a4f83", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace CodeForces\n{\n public class CodeForcesClass\n {\n public static bool IsPointIn(Point p, int n)\n {\n var d = Math.Sqrt(p.X * p.X + p.Y * p.Y);\n if (Math.Abs(d - n) < 1e-6 || d < n)\n {\n return true;\n }\n return false;\n }\n\n public static void Main()\n {\n var n = Read();\n var full = Math.Sqrt(3);\n var half = full / 2;\n var points = new[]\n {\n new Point {X = 0.5, Y = half}, new Point {X = 1, Y = 0}\n };\n\n long h = 0;\n var current = new Point[2];\n for (var i = 0; i < 2; i++)\n {\n current[i] = points[i];\n }\n while (current.All(x => IsPointIn(x, n)))\n {\n h++;\n for (var i = 0; i < 2; i++)\n {\n current[i].Y += full;\n }\n }\n var temp = new Point[2];\n long count = h + h - 1;\n var moved = 1;\n while (true)\n {\n for (var i = 0; i < 2; i++)\n {\n current[i] = points[i];\n current[i].X += moved * 1.5;\n }\n if (moved % 2 == 1)\n {\n for (var i = 0; i < 2; i++)\n {\n current[i].Y -= half;\n }\n }\n var start = h + 1;\n while (start >= 0)\n {\n\n for (var i = 0; i < 2; i++)\n {\n temp[i] = current[i];\n temp[i].Y += start * full;\n }\n if (temp.All(x => IsPointIn(x, n)))\n {\n break;\n }\n start--;\n }\n h = start;\n if (h == -1)\n {\n break;\n }\n if (moved % 2 == 1)\n {\n count += h * 4;\n }\n if (moved % 2 != 1)\n {\n count += (h + h + 1) * 2;\n }\n moved++;\n }\n Console.WriteLine(count);\n }\n\n public struct Point\n {\n public double X { get; set; }\n public double Y { get; set; }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "66b967dceff6b46e9b8a4ba99666203e", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace CodeForces\n{\n public class CodeForcesClass\n {\n public static bool IsPointIn(Point p, int n)\n {\n var d = Math.Sqrt(p.X*p.X + p.Y*p.Y);\n if (Math.Abs(d - n) < 1e-6 || d < n)\n {\n return true;\n }\n return false;\n }\n\n public static void Main()\n {\n var n = Read();\n var full = Math.Sqrt(3);\n var half = full/2;\n var points = new[]\n {\n new Point {X = -0.5, Y = half}, new Point {X = 0.5, Y = half}, new Point {X = 1, Y = 0},\n new Point {X = 0.5, Y = -half}, new Point {X = -0.5, Y = -half}, new Point {X = -1, Y = 0}\n };\n\n long h = 0;\n var current = new Point[6];\n for (var i = 0; i < 6; i++)\n {\n current[i] = points[i];\n }\n while (current.All(x => IsPointIn(x, n)))\n {\n h++;\n for(var i = 0; i < 6; i++)\n {\n current[i].Y += full;\n }\n }\n var temp = new Point[6];\n long count = h + h - 1;\n var moved = 1;\n while (true)\n {\n for (var i = 0; i < 6; i++)\n {\n current[i] = points[i];\n current[i].X += moved*1.5;\n }\n if (moved % 2 == 1)\n {\n for (var i = 0 ; i < 6; i++)\n {\n current[i].Y -= half;\n }\n }\n var start = h + 3;\n while (start >= 0)\n {\n \n for (var i = 0; i < 6; i++)\n {\n temp[i] = current[i];\n temp[i].Y += start*full;\n }\n if (temp.All(x => IsPointIn(x, n)))\n {\n break;\n }\n start--;\n }\n h = start;\n if (h == -1)\n {\n break;\n }\n if (moved % 2 == 1)\n {\n count += h*4;\n }\n if (moved % 2 != 1)\n {\n count += (h + h + 1) * 2;\n }\n moved++;\n }\n Console.WriteLine(count);\n }\n\n public struct Point\n {\n public double X { get; set; }\n public double Y { get; set; }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ccd67043f575cb7743b6cece0c06d1f6", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n\n const double eps = 0.01;\n\n static int dcmp(double x)\n {\n if (x < -eps) return -1;\n if (x > eps) return 1;\n return 0;\n }\n\n static void Main(string[] args)\n {\n Int64 data = Int64.Parse(Console.ReadLine().Trim());\n if (data == 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Int64 count = 0;\n Int64 n = (Int64)((Math.Sqrt((((double)data * data) - 0.5 * 0.5) / 0.75) + 1) / 2);\n count=3*n*n-3*n+1;\n \n Int64 need = 0;\n Int64 j = 0;\n do\n {\n double yy = ( 0.5+n ) * Math.Sqrt(3);\n double xx = 0.5;\n need = 0;\n for (Int64 i = j; i < (n + 1)/2+2; i++)\n {\n double x = xx + 1.5 * i;\n double y = yy - (double)i * Math.Sqrt(3)/2;\n if (dcmp(x * x + y * y - (double)(data) * data) <= 0)\n {\n need = (n + 1 - i * 2) < 0 ? 0 : (n + 1 - i * 2);\n j = i;\n break;\n }\n }\n count += need * 6;\n n++;\n } while (need != 0);\n \n \n Console.WriteLine(count);\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "163567be24f44671b037036cd7681b32", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int data = Int32.Parse(Console.ReadLine().Trim());\n if (data == 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Int64 count = 0;\n Int64 n = (Int64)((Math.Sqrt((((double)data * data) - 0.5 * 0.5) / 0.75) + 1) / 2);\n count=3*n*n-3*n+1;\n \n Int64 need = 0;\n int j = 0;\n do\n {\n double yy = (n + 0.5) * Math.Sqrt(3);\n double xx = 0.5;\n need = 0;\n for (int i = j; i < n + 1; i++)\n {\n double x = xx + 1.5 * i;\n double y = yy - (double)i * Math.Sqrt(3)/2;\n if (x * x + y * y - (double)data * data<10e-6)\n {\n need = (n + 1 - i * 2) < 0 ? 0 : (n + 1 - i * 2);\n j = i;\n break;\n }\n }\n count += need * 6;\n n++;\n } while (need != 0);\n \n \n Console.WriteLine(count);\n \n \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7398bca7a9cf4c20bdd4894564ff7ead", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int data = Int32.Parse(Console.ReadLine().Trim());\n if (data == 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Int64 count = 0;\n int n = (int)((Math.Sqrt(((double)(data * data) - 0.5 * 0.5) / 0.75) + 1) / 2);\n count=3*n*n-3*n+1;\n \n Int64 need = 0;\n do\n {\n double yy = (n + 0.5) * Math.Sqrt(3);\n double xx = 0.5;\n need = 0;\n for (int i = 0; i < n + 1; i++)\n {\n double x = xx + 1.5 * i;\n double y = yy - (double)i * Math.Sqrt(3)/2;\n if (x * x + y * y - (double)data * data<10e-6)\n {\n need = (n + 1 - i * 2) < 0 ? 0 : (n + 1 - i * 2);\n break;\n }\n }\n count += need * 6;\n n++;\n } while (need != 0);\n \n \n Console.WriteLine(count);\n \n \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ac245c9138941659fa60e03eec99fdbc", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int data = Int32.Parse(Console.ReadLine().Trim());\n Int64 count = 0;\n int n = (data-1)/2+1;\n count=3*n*n-3*n+1;\n if (data % 2 == 0)\n {\n double yy = (n + 0.5) * Math.Sqrt(3);\n double xx = 0.5;\n int need = 0;\n for (int i = 0; i < n+2; i++)\n {\n double x = xx + 1.5 * i;\n double y = yy - i;\n if (x * x + y * y <= (double)data * data)\n {\n need = (n + 1 - i* 2) < 0 ? 0 : (n + 1 - i * 2);\n }\n }\n count += need * 6;\n }\n Console.WriteLine(count);\n \n \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "36d72e67d7a78df755e3bc4d1b9df5bb", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int data = Int32.Parse(Console.ReadLine().Trim());\n Int64 count = 0;\n int n = (data-1)/2+1;\n count=3*n*n-3*n+1;\n if (data % 2 == 0)\n {\n count += (n - 1) * 6;\n }\n Console.WriteLine(count);\n \n \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4b8f29ee1e8bfcb5883664d4daf54f08", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int data = Int32.Parse(Console.ReadLine().Trim());\n if (data == 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Int64 count = 0;\n int n = (data-1)/2+1;\n count=3*n*n-3*n+1;\n if (data % 2 == 0)\n {\n double yy = (n + 0.5) * Math.Sqrt(3);\n double xx = 0.5;\n int need = 0;\n for (int i = 0; i < n+2; i++)\n {\n double x = xx + 1.5 * i;\n double y = yy - i;\n if (x * x + y * y <= (double)data * data)\n {\n need = (n + 1 - i* 2) < 0 ? 0 : (n + 1 - i * 2);\n break;\n }\n }\n count += need * 6;\n }\n Console.WriteLine(count);\n \n \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "25c832dce332a4d476b00e9181fcb432", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int data = Int32.Parse(Console.ReadLine().Trim());\n if (data == 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Int64 count = 0;\n int n = (data-1)/2+1;\n count=3*n*n-3*n+1;\n if (data % 2 == 0)\n {\n double yy = (n + 0.5) * Math.Sqrt(3);\n double xx = 0.5;\n int need = 0;\n for (int i = 0; i < n+2; i++)\n {\n double x = xx + 1.5 * i;\n double y = yy - i;\n if (x * x + y * y <= (double)data * data)\n {\n need = (n + 1 - i* 2) < 0 ? 0 : (n + 1 - i * 2);\n }\n }\n count += need * 6;\n }\n Console.WriteLine(count);\n \n \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a446a89afb9eb94134a876749a067555", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int data = Int32.Parse(Console.ReadLine().Trim());\n if (data == 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Int64 count = 0;\n int n = (int)((Math.Sqrt(((double)(data * data) - 0.5 * 0.5) / 0.75) + 1) / 2);\n count=3*n*n-3*n+1;\n \n int need = 0;\n do\n {\n double yy = (n + 0.5) * Math.Sqrt(3);\n double xx = 0.5;\n need = 0;\n for (int i = 0; i < n + 1; i++)\n {\n double x = xx + 1.5 * i;\n double y = yy - i * Math.Sqrt(3)/2;\n if (x * x + y * y <= (double)data * data)\n {\n need = (n + 1 - i * 2) < 0 ? 0 : (n + 1 - i * 2);\n break;\n }\n }\n count += need * 6;\n n++;\n } while (need != 0);\n \n \n Console.WriteLine(count);\n \n \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f13c295167eb7db7ffec89b32a34d1c5", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int data = Int32.Parse(Console.ReadLine().Trim());\n if (data == 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Int64 count = 0;\n int n = (data-1)/2+1;\n count=3*n*n-3*n+1;\n \n int need = 0;\n do\n {\n double yy = (n + 0.5) * Math.Sqrt(3);\n double xx = 0.5;\n need = 0;\n for (int i = 0; i < n + 2; i++)\n {\n double x = xx + 1.5 * i;\n double y = yy - i;\n if (x * x + y * y <= (double)data * data)\n {\n need = (n + 1 - i * 2) < 0 ? 0 : (n + 1 - i * 2);\n break;\n }\n }\n count += need * 6;\n n++;\n } while (need != 0);\n \n \n Console.WriteLine(count);\n \n \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a5fef71ef5abfe16ea24c933547a7466", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF {\n\tclass Program {\n\n\n\t\tstatic void Main(string[] args) {\n\n#if DEBUG\n\t\t\tTextReader reader = new StreamReader(\"../../input.txt\");\n\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\n\t\t\tint[] l1 = reader.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\t\t\tint[] l2 = reader.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n\t\t\tint a = l1[0], b = l1[1], m = l1[2];\n\t\t\tint vx = l2[0], vy = l2[1], vz = l2[2];\n\n\t\t\tdouble time = m * 1.0 / -vy;\n\t\t\t\n\t\t\t//double zdist = vz * time;\n\n\t\t\tdouble xpos = a * 1.0 / 2 + vx * time;\n\t\t\txpos = xpos - 2 * a * Math.Floor(xpos / (2 * a));\n\t\t\tif (xpos > a) {\n\t\t\t\txpos = 2 * a - xpos;\n\t\t\t}\n\n\t\t\t//Console.WriteLine(xpos);\n\n\t\t\tdouble zpos = vz * time;\n\t\t\tzpos = zpos - 2 * b * Math.Floor(zpos / (2 * b));\n\t\t\tif (zpos > b) {\n\t\t\t\tzpos = 2 * b - zpos;\n\t\t\t}\n\n\t\t\tstring answ = xpos + \" \" + zpos;\n\n\t\t\tConsole.WriteLine(answ.Replace(\",\", \".\"));\n\n\n#if DEBUG\n\t\t\tConsole.ReadKey();\n#endif\n\n\t\t}\n\n\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2e17c6e8c237e8f655c898fe8c02ea3a", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700} {"lang": "Mono C#", "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 // Mono lacks this override of string.Join()\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 double a = parser.ReadDouble();\n double b = parser.ReadDouble();\n double m = parser.ReadDouble();\n double vx = parser.ReadDouble();\n double vy = parser.ReadDouble();\n double vz = parser.ReadDouble();\n\n double t = m / -vy;\n double t_bak = t;\n\n /* x result */\n double x = a / 2;\n if (vx != 0)\n {\n while (t > 0)\n {\n if (vx < 0)\n {\n double tt = x / -vx;\n if (t <= tt)\n {\n x += t * vx;\n break;\n }\n else\n {\n x = 0;\n vx = -vx;\n t -= tt;\n }\n }\n else\n {\n double tt = (a - x) / vx;\n if (t <= tt)\n {\n x += t * vx;\n break;\n }\n else\n {\n x = a;\n vx = -vx;\n t -= tt;\n }\n }\n }\n }\n\n /* z result */\n t = t_bak;\n double z = 0;\n if (vz != 0)\n {\n while (t > 0)\n {\n if (vz < 0)\n {\n double tt = z / -vz;\n if (t <= tt)\n {\n z += t * vz;\n break;\n }\n else\n {\n z = 0;\n vz = -vz;\n t -= tt;\n }\n }\n else\n {\n double tt = (b - z) / vz;\n if (t <= tt)\n {\n z += t * vz;\n break;\n }\n else\n {\n z = b;\n vz = -vz;\n t -= tt;\n }\n }\n }\n }\n\n\n Console.WriteLine(x.AsString(10) + \" \" + z.AsString(10));\n }\n }\n }\n\n //static void Main(string[] args)\n //{\n // new Thread(Main2, 50 << 20).Start();\n //}\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b4541f2ae9255bf41a8048cbd5e7d7d7", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\npublic class taskD\n{\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n string[] spl = inp.Split(' ');\n\n int a, b, m;\n a = int.Parse(spl[0]);\n b = int.Parse(spl[1]);\n m = int.Parse(spl[2]);\n\n inp = Console.ReadLine();\n spl = inp.Split(' ');\n\n int vx, vy, vz;\n vx = int.Parse(spl[0]);\n vy = int.Parse(spl[1]);\n vz = int.Parse(spl[2]);\n\n double t = -(double)m / vy;\n\n double x0 = (double)a / 2.0 + t * (double)vx;\n double z0 = t * (double)vz;\n\n bool invx = false;\n bool invz = false;\n\n while (x0 > a)\n {\n x0 -= a;\n invx = !invx;\n }\n while (x0 < 0)\n {\n x0 += a;\n invx = !invx;\n }\n while (z0 > b)\n {\n z0 -= b;\n invz = !invz;\n }\n while (z0 < 0)\n {\n z0 += b;\n invz = !invz;\n }\n\n if (invx) x0 = a - x0;\n if (invz) z0 = b - z0;\n\n System.Globalization.NumberFormatInfo ni = new System.Globalization.NumberFormatInfo();\n ni.NumberDecimalSeparator = \".\";\n\n Console.WriteLine(\"{0} {1}\", x0.ToString(ni), z0.ToString(ni));\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e5dd1bf23508375d13050f171d105476", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700} {"lang": "Mono C#", "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 First, Second;\n public Pair(int f, int s) {\n First = f;\n Second = s;\n }\n\n public int CompareTo(Pair other) {\n return Second.CompareTo(other.Second);\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[] arr = ReadIntArray();\n double[] v = ReadDoubleArray();\n int a = arr[0];\n int b = arr[1];\n m = arr[2];\n double[] u = new double[3];\n u[0] = a;\n u[2] = b;\n double[] d = new double[3];\n d[0] = ((double)a) / 2;\n d[1] = (double)m;\n d[2] = 0; \n double x0 = 0;\n double z0 = 0;\n while (true) {\n List minl = new List();\n int min = -1;\n double mint = double.MaxValue;\n for (int i = 0; i < 3; i++) {\n double ti = 0;\n if (v[i] == 0) continue;\n else if (v[i] > 0)\n ti = (u[i] - d[i]) / v[i];\n else\n ti = -d[i] / v[i];\n if (ti < mint) {\n minl.Clear();\n min = i;\n mint = ti;\n minl.Add(i);\n }\n else if (ti == mint) {\n minl.Add(i);\n }\n }\n for (int i = 0; i < 3; i++) {\n d[i] += mint * v[i];\n }\n foreach (int item in minl) {\n v[item] = -v[item];\n }\n if (d[1] == 0) {\n x0 = d[0];\n z0 = d[2];\n break;\n }\n }\n string res = string.Format(\"{0} {1}\",x0,z0).Replace(',','.');\n Console.WriteLine(res);\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 nextInt() {\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 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\n\n\n\n\n\n\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\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 where T:IComparable {\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 = null;\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 bool Contains(T key) {\n if (x.CompareTo(key) > 0)\n return left == null ? false : left.Contains(key);\n else if (x.CompareTo(key) < 0)\n return right == null ? false : right.Contains(key);\n return true;\n }\n\n public void Split(T x, out Treap l, out Treap r) {\n Treap newTree = null;\n if (this.x.CompareTo(x)<0) {\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(T 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 private T x;\n private int y;\n private Treap left, right;\n public Treap(T 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(T x, int y) : this(x, y, null, null) { }\n public Treap(T x) : this(x, rand.Next()) { }\n }\n public static class Extensions {\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a0cf7a6494a60e084b6f57ea224bb2df", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF {\n\tclass Program {\n\n\n\t\tstatic void Main(string[] args) {\n\n#if DEBUG\n\t\t\tTextReader reader = new StreamReader(\"../../input.txt\");\n\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\n\t\t\tint[] l1 = reader.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\t\t\tint[] l2 = reader.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n\t\t\tint a = l1[0], b = l1[1], m = l1[2];\n\t\t\tint vx = l2[0], vy = l2[1], vz = l2[2];\n\n\t\t\tdouble time = m * 1.0 / -vy;\n\t\t\t\n\t\t\t//double zdist = vz * time;\n\n\t\t\tdouble xpos = a * 1.0 / 2 + vx * time;\n\t\t\txpos = xpos - 2 * a * Math.Floor(xpos / (2 * a));\n\t\t\tif (xpos > a) {\n\t\t\t\txpos = 2 * a - xpos;\n\t\t\t}\n\n\t\t\t//Console.WriteLine(xpos);\n\n\t\t\tdouble zpos = vz * time;\n\t\t\tzpos = zpos - 2 * b * Math.Floor(zpos / (2 * b));\n\t\t\tif (zpos > b) {\n\t\t\t\tzpos = 2 * b - zpos;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(xpos + \" \" + zpos);\n\n\n#if DEBUG\n\t\t\tConsole.ReadKey();\n#endif\n\n\t\t}\n\n\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "475cb16dae835a6a8ff5e4a7e6a8e54b", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\npublic class taskD\n{\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n string[] spl = inp.Split(' ');\n\n int a, b, m;\n a = int.Parse(spl[0]);\n b = int.Parse(spl[1]);\n m = int.Parse(spl[2]);\n\n inp = Console.ReadLine();\n spl = inp.Split(' ');\n\n int vx, vy, vz;\n vx = int.Parse(spl[0]);\n vy = int.Parse(spl[1]);\n vz = int.Parse(spl[2]);\n\n double t = -(double)m / vy;\n\n double x0 = (double)a / 2.0 + t * vx;\n double z0 = t * vz;\n\n bool invx = false;\n bool invz = false;\n\n while (x0 > a)\n {\n x0 -= a;\n invx = !invx;\n }\n while (x0 < 0)\n {\n x0 += a;\n invx = !invx;\n }\n while (z0 > b)\n {\n z0 -= b;\n invz = !invz;\n }\n while (z0 < 0)\n {\n z0 += b;\n invz = !invz;\n }\n\n if (invx) x0 = a - x0;\n if (invz) z0 = b - z0;\n\n Console.WriteLine(\"{0} {1}\", x0, z0);\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f9e66f4fc4af9f7ad9abc4a33936c120", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\npublic class taskD\n{\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n string[] spl = inp.Split(' ');\n\n int a, b, m;\n a = int.Parse(spl[0]);\n b = int.Parse(spl[1]);\n m = int.Parse(spl[2]);\n\n inp = Console.ReadLine();\n spl = inp.Split(' ');\n\n int vx, vy, vz;\n vx = int.Parse(spl[0]);\n vy = int.Parse(spl[1]);\n vz = int.Parse(spl[2]);\n\n double t = -(double)m / vy;\n\n double x0 = (double)a / 2.0 + t * vx;\n double z0 = t * vz;\n\n bool invx = false;\n bool invz = false;\n\n while (x0 > a)\n {\n x0 -= a;\n invx = !invx;\n }\n while (x0 < -a)\n {\n x0 += a;\n invx = !invx;\n }\n while (z0 > b)\n {\n z0 -= b;\n invz = !invz;\n }\n while (z0 < -b)\n {\n z0 += b;\n invz = !invz;\n }\n\n if (invx) x0 = a - x0;\n if (invz) z0 = b - z0;\n\n Console.WriteLine(\"{0} {1}\", x0, z0);\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4ec0d95f76c8f6ec12808e8c515c9ab0", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700} {"lang": "MS C#", "source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] {'\\r', '\\n', '\\t', ' '}, StringSplitOptions.RemoveEmptyEntries);\n long price = long.Parse(input[1]);\n long res = price/2L;\n long count = 1L;\n for(int i = input.Length-2; i>1; --i)\n {\n res += price * count;\n count *= 2L;\n if(input[i].Length>4)\n {\n res += price / 2L;\n count++;\n }\n }\n Console.WriteLine(res);\n }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "151bf9734f104645abfa230b8edef285", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MyFirst\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n Choice.Simple();\n\n }\n }// End OF Program Class\n\n\n\n public class Choice\n {\n\n public static void Simple()\n {\n // ..................... Program Begin...............................\n // Take String From Input Line .............\n string input1 = Console.ReadLine();\n Scanner Input1 = new Scanner(input1); \n\n\n // .....................Take Necessary Input Formate For Program ...............................\n\n int n = Input1.TakeIntInputNext();\n int p = Input1.TakeIntInputNext();\n\n double total=0,ans = 0;\n List s = new List();\n\n for (int i = 1; i <= n; i++)\n {\n s.Add(Console.ReadLine());\n }\n\n\n //.......................... Calculation....................................................\n for (int i = n-1; i >= 0; i--)\n {\n if (s.ElementAt(i) == \"halfplus\")\n {\n total += .5;\n ans += total * p;\n total *= 2;\n }\n else\n {\n if (total == 0) total++;\n ans += total * p;\n total *= 2;\n }\n }\n\n \n\n\n\n //................ OutPut ............................................\n Console.WriteLine(\"{0}\", System.Convert.ToInt64(ans));\n //......................... Program End .............................. \n\n } \n\n }\n\n\n\n public class Scanner\n {\n string Input;\n string[] InputArray;\n int Index = 0;\n public int LengthInputString;\n\n public Scanner(string Input)\n {\n this.Input = Input;\n InputArray = this.Input.Split(' ');\n LengthInputString = InputArray.Length;\n }\n\n public Scanner(string Input, char split)\n {\n this.Input = Input;\n InputArray = this.Input.Split(split);\n LengthInputString = InputArray.Length;\n }\n\n public int TakeIntInputNext()\n {\n return (System.Convert.ToInt32(InputArray[Index++]));\n }\n\n public double TakeDoubleInputNext()\n {\n return (System.Convert.ToDouble(InputArray[Index++]));\n }\n\n public string TakeStringInputNext()\n {\n return InputArray[Index++].ToString();\n }\n\n public char TakeOneCharInputNext()\n {\n return System.Convert.ToChar(InputArray[Index++]);\n }\n\n public char[] TakeCharArrayInputNext()\n {\n return InputArray[Index++].ToCharArray();\n }\n\n\n public string Take_Specific_String_Input(int index)\n {\n return InputArray[index].ToString();\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7f7f1f183f89f02420420f6ceca15fd0", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\n\nclass Program\n{\n public static long ScalarProduct(long x1, long y1, long x2, long y2)\n {\n return x1 * y2 - x2 * y1;\n }\n\n private static int LogR(int radix, long value)\n {\n int ans = 0;\n while (value > 1)\n {\n ans++;\n value /= radix;\n }\n\n return ans;\n }\n\n private static bool IsPowerOf2(long x)\n {\n return (x & (x - 1)) == 0;\n }\n\n private static long BinPower(long x, int power)\n {\n long ans = 1;\n while (power > 0)\n {\n if (power % 2 == 1)\n ans = (ans * x);\n\n x = x * x;\n }\n\n return ans;\n }\n\n private static long Fact(int x)\n {\n long ans = 1;\n for (int i = 2; i <= x; i++)\n ans *= i;\n return ans;\n }\n\n private static long Placing(int k, int n)\n {\n long ans = Fact(n) / (Fact(k) * Fact(n - k));\n\n return ans;\n }\n\n private static void Main(string[] args)\n {\n int n = ReadInt();\n long p = ReadLong();\n\n string[] s = new string[n];\n for (int i = 0; i < n; i++)\n {\n s[i] = new string(ReadString());\n }\n\n long ans = 0;\n long extra = 0;\n for (int i = n - 1; i >= 0; i--)\n {\n ans *= 2;\n if (s[i].Length > 5)\n {\n ans++;\n extra++;\n }\n }\n\n Console.WriteLine(ans * p - extra * (p / 2));\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\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 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\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\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b27b1f4194277ddcd3d4a80a3703193f", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "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 ed9a\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 p = d[1];\n var bs = new int[n];\n for (int i = 0; i < n; i++)\n {\n var next = Console.ReadLine();\n if (next == \"half\")\n {\n bs[i] = 0;\n }\n else\n {\n bs[i] = 1;\n }\n }\n\n long res = 0L;\n var cc = 0L;\n for (int i = n - 1; i >= 0; i--)\n {\n if (bs[i] == 0)\n {\n res += cc * p;\n cc *= 2;\n }\n else\n {\n res += cc * p + p / 2;\n cc *= 2;\n cc++;\n }\n }\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1c703b9319da9c4562be79e60483518a", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "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 long ans = 0;\n long x = 0;\n foreach (string s in ReadLines(n).Reverse())\n {\n if (s.Length > 4)\n x = x * 2 + 1;\n else\n x = x * 2;\n ans += x * m / 2;\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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ddd774aea798e749ad657548f74e3edc", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "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\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 GrandmaLauraAndApplesECR9\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(), p = fs.NextInt();\n string[] buyers = new string[n];\n for (int i = n - 1; i >= 0; i--)\n {\n buyers[i] = fs.ReadLine();\n }\n long revenue = p / 2;\n double prevVal = 1;\n for (int i = 1; i < n; i++)\n {\n if (buyers[i] == \"half\") prevVal *= 2;\n else prevVal = prevVal * 2 + 1;\n revenue += (long)((prevVal / 2) * p);\n }\n writer.WriteLine(revenue);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c4d49a819ff98edc046ecc5d62b1559f", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "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 x = Console.ReadLine().Split(' ');\n var n = int.Parse(x[0]);\n var p = long.Parse(x[1]);\n\n Stack paid = new Stack();\n for (int i = 0; i < n; i++)\n {\n var temp = Console.ReadLine();\n if (temp == \"half\") paid.Push(0);\n else paid.Push(1);\n }\n\n long sum = 0;\n long apples = 0;\n\n while (paid.Count > 0)\n {\n var item = paid.Pop();\n sum += p*apples+(p/2)*item;\n apples = apples * 2 + item;\n }\n Console.WriteLine(sum);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a3bfbbbd6e2b8135f19845460ae0b93a", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "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 class Program\n {\n static void Main(string[] args)\n {\n int n = MyConsoleInputStreamParser.GetInt, price = MyConsoleInputStreamParser.GetInt;\n Stack stack = new Stack(n);\n long halfCount = 0, count = 0;\n for (int i = 0; i < n; i++)\n {\n stack.Push(MyConsoleInputStreamParser.GetString);\n }\n for (int i = 0; i < n; i++)\n {\n var temp = stack.Pop();\n if (temp == \"half\")\n {\n count *= 2;\n }\n else\n {\n halfCount++;\n count = count * 2 + 1;\n }\n }\n Console.WriteLine(price * count - halfCount * (price / 2));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c3f4596be1a56b31f54be345436e4a44", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "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\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\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 n = input[0];\n\t\t\tvar p = input[1];\n\t\t\tvar array = new string[n];\n\t\t\tfor (var i = 0; i < n; i++) {\n\t\t\t\tarray[i] = sr.NextString();\n\t\t\t}\n\t\t\tvar cost = 0L;\n\t\t\tvar count = 0L;\n\t\t\tif (array[n - 1] == \"half\") {\n\t\t\t\tcost = 2 * p;\n\t\t\t\tcount = 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcost = p / 2;\n\t\t\t\tcount = 1;\n\t\t\t}\n\t\t\tfor (var i = n - 2; i >= 0; i--) {\n\t\t\t\tvar next = array[i];\n\t\t\t\tif (next == \"half\") {\n\t\t\t\t\tcost += count * p;\n\t\t\t\t\tcount *= 2;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcost += count * p + p / 2;\n\t\t\t\t\tcount = count * 2 + 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsw.WriteLine(cost);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "02a2673f45976e20791c459c9eb6a4b1", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "Mono C#", "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, P;\n sc.Make(out N, out P);\n var ct = 0L;var res = 0L;\n var S = Create(N, () => sc.Str);\n Array.Reverse(S);\n for(int i = 0; i < N; i++)\n {\n if (S[i] == \"half\")\n {\n res += ct*P;\n ct <<= 1;\n }\n else\n {\n res += ct * P + P / 2;\n ct <<= 1;ct++;\n }\n }\n 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) == 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5c35014c22356ccfc25b49a286dc93a7", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace prob1\n{\n class Program\n {\n static void Main()\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int p = int.Parse(input[1]);\n Array.Resize(ref input, n);\n for(int i = 0; i < n; i++)\n {\n input[i] = Console.ReadLine();\n }\n double ar = 1;\n double a = 0.5f;\n for(int i = n - 2; i > -1; i--)\n {\n if(input[i].Equals(\"half\")) ar *= 2;\n else ar = ar * 2 + 1;\n a += ar / 2;\n }\n long money = (long)(a * p);\n Console.WriteLine(money);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1805f73707926a30687eeb260bc92bea", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Grandma_Laura_and_Apples\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 int n = int.Parse(ss[0]);\n int p = int.Parse(ss[1]);\n\n var nn = new bool[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = reader.ReadLine().EndsWith(\"plus\");\n }\n\n long count = 0;\n long half = 0;\n\n for (int i = n - 1; i >= 0; i--)\n {\n if (nn[i])\n {\n half++;\n count = count*2 + 1;\n }\n else\n {\n count *= 2;\n }\n }\n writer.WriteLine(count*p - half*p/2);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ef583ba138ef59fce735f5a2a50e8927", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "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 static void Main(string[] args) {\n int n, p;\n readInts(out n,out p);\n long count = 1;\n long money = p / 2;\n bool[] bools = new bool[n];\n for(int i = 0; i < n; i++) {\n string t = Console.ReadLine();\n bools[i] = t != \"half\";\n }\n for(int i = n - 2; i >= 0; i--) {\n if(bools[i]) {\n money += count * p + p / 2;\n count = count * 2 + 1;\n } else {\n money += count * p;\n count *= 2;\n }\n \n }\n Console.WriteLine( money );\n }\n\n /*static string work(char[] s, string ans, int c) {\n BitArray b = new BitArray(w.Length,true);\n int on = w.Length;\n for(; on > 0; c++) {\n for(int i = 0; i < w.Length; i++) {\n if(b[i] && w[i].Length > c) {\n if(s[c] == w[i][c]) {\n string temp = work(s,ans + \n } else {\n on--;\n b[c] = false;\n }\n }\n }\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f4925e737dbf4719a4f10c8037a14a93", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "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 \n public bool Solve()\n {\n var n = cin.Read();\n var k = cin.Read();\n\n var q = new Stack();\n for (var i = 0; i < n; i++) q.Push(cin.ReadToken());\n\n var ans = 1L;\n var cc = 1;\n q.Pop();\n\n while(q.Count > 0)\n {\n var cmd = q.Pop();\n ans <<= 1;\n if (cmd.Contains(\"plus\"))\n {\n cc++;\n ans++;\n }\n }\n\n var price = ans * ((long)k);\n price -= ((long)cc) * ((long)k) / 2L;\n\n cout.WriteLine(price);\n\n return true;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f43b1e4958019984aa89ae7156999839", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "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 n=io.NextInt(), p=io.NextInt();\n string[] cmd = new string[n];\n for (int i = 0; i < n; i++) cmd[i] = io.NextToken();\n long has = 0, half = 0;\n for (int i = n - 1; i >= 0; i--) {\n if (cmd[i] == \"half\") {\n has *= 2;\n } else {\n has = has * 2 + 1;\n half++;\n }\n }\n io.WriteLine(has * p - p / 2 * half);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "82c531cf3c8cd0bd8a7f4490e0953a14", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var inp = Console.ReadLine().Split(' ');\n int b = int.Parse(inp[0]);\n int c = int.Parse(inp[1]);\n string[] s = new string[b];\n int i = 0, halfes = 0;\n for (; i < b; i++)\n {\n s[i] = Console.ReadLine();\n if (s[i] == \"halfplus\") halfes++;\n }\n long a = 1;\n i -= 2;\n\n for (; i >= 0; i--)\n {\n if (s[i] == \"half\") a *= 2;\n else a = a * 2 + 1;\n }\n long m = a * c - (halfes * c) / 2;\n Console.WriteLine(m);\n Console.ReadLine();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "74279581f94052ec3853e1195704c9f3", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace _632A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var n = s[0]; var p = s[1];\n long ans = 0;\n double apples = 0;\n string[] customers = new string[n];\n for (int i = 0; i < n; i++)\n {\n customers[i] = Console.ReadLine();\n }\n Array.Reverse(customers);\n for (int i = 0; i < n; i++)\n {\n if (customers[i] == \"half\") apples = apples * 2;\n else apples = 2 * (apples + 0.5); \n ans += (long)(apples * p / 2);\n }\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0735d80b94f6bc77bea0bb60b8014696", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace prob1\n{\n class Program\n {\n static void Main()\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int p = int.Parse(input[1]);\n Array.Resize(ref input, n);\n for(int i = 0; i < n; i++)\n {\n input[i] = Console.ReadLine();\n }\n float ar = 1;\n float a = 0.5f;\n for(int i = n - 2; i > -1; i--)\n {\n if(input[i].Equals(\"half\")) ar *= 2;\n else ar = ar * 2 + 1;\n a += ar / 2;\n }\n long money = (long)(a * p);\n Console.WriteLine(money);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d7f0cb00f3545a58793f8dd0c2c4d958", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3456d0f437d80f3a2877f2e7af1fc420", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f95f7e3a6230f259e815e578e70e37cb", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "13468ec3c2a94bf6c8192ddc3a95ea96", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad07b185854f064f597dfe3725599247", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f4a54b6879ecc432b04a2ed61f91c45f", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "05a198d5f31c6b6f035dc5b1038ef553", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0f1a57cfd83985d90c27cc6c427fe2a4", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "da3d8da92c03ba92a55088e4e8fde937", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "906143b980f7d4a6892f273a903b4939", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eeb58f283147ed95619ce3487d50274a", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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 if (hp == 3) Console.WriteLine(2 + \" A\"); \n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9bfdd76618cc0561f12901a9e2bd7212", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3034341e44b10e7ecfffe911da1561b0", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c647e7438233cfba64adf6b9b3839b5f", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "943cfcf7103d42698e8a8a6bfcb3435f", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "42a7a68e2bd04925c771dd0927efe9d1", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e333820179c607e1e90e68f7f448ccc5", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cc340164190b8c3ce0efd37ddd1997d5", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "54cf79e7fb0621c16abe3e426c38bfb9", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e64f7d84239881f26dea0552ebc8f1af", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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]) 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7193a6fccd802a08fa115281cdc8f962", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a356da749417876aec578ed1ab63b3e2", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3db39005e4d5921bf274251fc785f524", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec5b7bee442f86bc9d7678747bd1ef01", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "93481d8014b1485b15f0f9fe4196b828", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8a71b503f0916c3063b5a6b30ded59a3", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4df03e565e0bc77ef055f44f010b6aea", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "34866c87c2003736444770bef37f178e", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "718303ecd494f0e0a306b73a491800b4", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b4af84e9c78e4cc3eebfeaa9a264f03", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2ac22c715f400f10eb0368dc2395c44c", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "01d8f0bfd4124a518d57fb9338428b44", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b590e0cc1ae7c44865116aae260040c5", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "17fe9bf0a885c692cd866d8df4d5f218", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a9904ca5020f33e29f53dafccaed5830", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "490af8e5b820c500794ca6bb5226b6e2", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7793e10b5d7af247509aa4f76837f1c2", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "18c519d45052a4bdd9f512d2bb5731b2", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "de69ba8b28465a0c033c1288339f289a", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ead1b25544eefdee6441a3e106fa61ec", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dcf9fe0b437b269012c96f1529873eba", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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[] { \"A\", \"A\", \"B\", \"A\" };\n var a = new[] { 1, 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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4d584611ed2f2cd2acaa23df7da9e2ea", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "104ae558e514c09a4d885aa80b11b197", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Test \n{\n\tstatic long gcd(long a, long b) \n\t{\n\t\n\t\tif (b > a) \n\t\t{\n\t\t\tlong temp = a;\n\t\t\ta = b;\n\t\t\tb = temp;\n\t\t}\n\t\t\n\t\twhile (true) \n\t\t{\n\t\t\ta = a%b;\n\t\t\tlong temp = a;\n\t\t\ta = b;\n\t\t\tb = temp;\n\t\t\t\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t}\n\t\t\n\t}\n\t\n\tstatic void Main(string[] args)\n\t{\n\t\tlong[] tokens = Console.Readline().Split(' ').Select(x => long.Parse(x)).ToArray();\n\t\tlong lcm = token[0]*token[1] / gcd(token[0], token[1]);\n\t\t\n\t\tlong diff = (lcm/tokens[0]) - (lcm / tokens[1]);\n\t\t\n\t\tif (diff == 1 || diff == -1)\n\t\t\tConsole.WriteLine(\"Equal\");\n\t\telse if (diff > 0)\n\t\t\tConsole.WriteLine(\"Dasha\");\n\t\telse if (diff < 0)\n\t\t\tConsole.WriteLine(\"Masha\");\n\t}\n\t\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "64e140249bf6b11d985a05d5888be35d", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Ling;\nusing System.Text;\n\nclass Main \n{\n static long gcd(long a, long b) \n {\n \n if (b > a) \n {\n long temp = a;\n a = b;\n b = temp;\n }\n \n while (true) \n {\n a = a%b;\n long temp = a;\n a = b;\n b = temp;\n \n if (b == 0)\n return a;\n }\n \n }\n \n static void Main(string[] args)\n {\n long[] tokens = Console.Readline().Split(' ').Select(x => long.Parse(x)).ToArray();\n long lcm = token[0]*token[1] / gcd(token[0], token[1]);\n \n long diff = (lcm/tokens[0]) - (lcm / tokens[1]);\n \n if (diff == 1 || diff == -1)\n Console.WriteLine(\"Equal\");\n else if (diff > 0)\n Console.WriteLine(\"Dasha\");\n else if (diff < 0)\n Console.WriteLine(\"Masha\");\n }\n \n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8fa56ca071d0f05a2d26e1f329d0257b", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n Console.WriteLine(Fun(s));\n\n }\n\n\n static public string Fun(string s)\n {\n int a, b; \n string da = \"Dasha\"; int d = 0;\n string ma = \"Masha\"; int m = 0;\n string eq = \"Equal\"; int e = 0;\n string[] arr = s.Split(' ');\n a = Convert.ToInt32(arr[0]); \n b = Convert.ToInt32(arr[1]); \n int per = nok(a, b);\n if (a < b) return ma ;\n else if (b < a) return da;\n \n }\n static public int nok(int a, int b)\n {\n return (a / nod(a, b)) * b;\n }\n static public int nod(int a, int b)\n {\n if (a != 0) return nod(b % a, a);\n else return b;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5449850b6dc3e07a2019f18683f8d449", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Test \n{\n static long gcd(long a, long b) \n {\n \n if (b > a) \n {\n long temp = a;\n a = b;\n b = temp;\n }\n \n while (true) \n {\n a = a%b;\n long temp = a;\n a = b;\n b = temp;\n \n if (b == 0)\n return a;\n }\n \n }\n \n static void Main(string[] args)\n {\n long[] tokens = Console.Readline().Split(' ').Select(x => long.Parse(x)).ToArray();\n long lcm = token[0]*token[1] / gcd(token[0], token[1]);\n \n long diff = (lcm/tokens[0]) - (lcm / tokens[1]);\n \n if (diff == 1 || diff == -1)\n Console.WriteLine(\"Equal\");\n else if (diff > 0)\n Console.WriteLine(\"Dasha\");\n else if (diff < 0)\n Console.WriteLine(\"Masha\");\n }\n \n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3a4bc4d16d8a79dec5861b3a02eb7daa", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Ling;\nusing System.Text;\n\nclass Test \n{\n\tstatic long gcd(long a, long b) \n\t{\n\t\n\t\tif (b > a) \n\t\t{\n\t\t\tlong temp = a;\n\t\t\ta = b;\n\t\t\tb = temp;\n\t\t}\n\t\t\n\t\twhile (true) \n\t\t{\n\t\t\ta = a%b;\n\t\t\tlong temp = a;\n\t\t\ta = b;\n\t\t\tb = temp;\n\t\t\t\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t}\n\t\t\n\t}\n\t\n\tstatic void Main(string[] args)\n\t{\n\t\tlong[] tokens = Console.Readline().Split(' ').Select(x => long.Parse(x)).ToArray();\n\t\tlong lcm = token[0]*token[1] / gcd(token[0], token[1]);\n\t\t\n\t\tlong diff = (lcm/tokens[0]) - (lcm / tokens[1]);\n\t\t\n\t\tif (diff == 1 || diff == -1)\n\t\t\tConsole.WriteLine(\"Equal\");\n\t\telse if (diff > 0)\n\t\t\tConsole.WriteLine(\"Dasha\");\n\t\telse if (diff < 0)\n\t\t\tConsole.WriteLine(\"Masha\");\n\t}\n\t\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d04e10edf14ef0ef8604b738a4c4b6c8", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Trains\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 long lcm = Lcm(a, b);\n\n long ca = (lcm - 1)/a;\n long cb = (lcm - 1)/b;\n\n if (b > a)\n cb++;\n else ca++;\n\n if (ca == cb)\n writer.WriteLine(\"Equal\");\n else if (ca > cb)\n writer.WriteLine(\"Dasha\");\n else\n writer.WriteLine(\"Masha\");\n\n writer.Flush();\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec8d90a76efb797d75bab2947c379e28", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Task3 {\n internal class Program {\n private static void Main(string[] args) {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n long a = int.Parse(ss[0]);\n long b = int.Parse(ss[1]);\n long t = GetLCM(a, b);\n string s1 = \"Dasha\";\n string s2 = \"Masha\";\n if (a < b) {\n string temp = s1;\n s1 = s2;\n s2 = temp;\n long tt = a;\n a = b;\n b = tt;\n }\n long first = 0;\n long previous = 0;\n long next = a;\n while (next <= t) {\n long k = (next/b)*b;\n first += k - previous;\n\n previous = next;\n next = next + a;\n }\n first -= b;\n long second = t - first;\n if (first < second) Console.WriteLine(s1);\n else if (second < first) Console.WriteLine(s2);\n else Console.WriteLine(\"Equal\");\n }\n\n public static long GetLCM(long a, long b) {\n return Math.Abs(a*b)/GetGCD(a, b);\n }\n\n public static long GetGCD(long a, long b) {\n while (a != 0 && b != 0) {\n if (a >= b) a = a%b;\n else b = b%a;\n }\n return a + b;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5196fb4cb4c4ef563a178a8099d283c9", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace C\n{\n class Program\n {\n static long GCD(long a, long b)\n {\n while (a != b)\n {\n if (a > b) a -= b;\n else b -= a;\n }\n return a;\n }\n static void Main(string[] args)\n {\n string[] t = Console.ReadLine().Split(' ');\n long a = long.Parse(t[0]);\n long b = long.Parse(t[1]);\n long LCM = (a * b) / GCD(a, b);\n long aLength = LCM / a;\n long bLength = LCM / b; \n long cur = 0;\n long curA = a;\n long curB = b;\n long Dasha = 0;\n long Masha = 0;\n while (cur < LCM)\n {\n if (curA < curB)\n {\n Dasha += (curA - cur);\n cur = curA;\n curA += a;\n continue;\n }\n if (curB < curA)\n {\n Masha += (curB - cur);\n cur = curB;\n curB += b;\n continue;\n }\n if (curB == curA)\n {\n if (a < b)\n Masha += (curB - cur);\n if (a > b)\n Dasha += (curB - cur);\n cur = curA;\n curA += a;\n curB += b;\n }\n }\n if (Masha < Dasha) Console.WriteLine(\"Dasha\");\n else if (Dasha < Masha) Console.WriteLine(\"Masha\");\n else Console.WriteLine(\"Equal\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e1396cee0c40cac05a049fe03b0f0bbd", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n Console.WriteLine(Fun(s));\n\n }\n\n\n static public string Fun(string s)\n {\n int a, b; \n string da = \"Dasha\";\n string ma = \"Masha\";\n string eq = \"Equal\";\n string[] arr = s.Split(' ');\n a = Convert.ToInt32(arr[0]); \n b = Convert.ToInt32(arr[1]); \n int per = nod(a, b);\n a /= per;\n b /= per;\n\n if (a - b == 1 || b - a == 1) return eq;\n else if (b < a) return ma;\n else return da;\n \n }\n static public int nod(int a, int b)\n {\n if (a != 0) return nod(b % a, a);\n else return b;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d366d540a0e82537eb347d53487936a", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace T\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(s[0]);\n int n = Convert.ToInt32(s[1]);\n if (m % Math.Abs(n - m) == 0 && n % Math.Abs(n - m) == 0)\n {\n Console.WriteLine(\"Equal\");\n }\n else\n {\n if (m < n)\n {\n Console.WriteLine(\"Dasha\");\n }\n else\n {\n Console.WriteLine(\"Masha\");\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d16131ff10d28b1cf0705b93928edc53", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemC\n{\n static long GCD(long a, long b)\n {\n if (b > a)\n {\n long temp = a;\n a = b;\n b = temp;\n }\n while (true)\n {\n a = a % b;\n long temp = a;\n a = b;\n b = temp;\n if (b == 0)\n return a;\n }\n }\n\n static void Main(string[] args)\n {\n long[] tokens = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n long lcm = tokens[0] * tokens[1] / GCD(tokens[0], tokens[1]);\n long diff = (lcm / tokens[0]) - (lcm / tokens[1]);\n if (diff == 1 || diff == -1)\n Console.WriteLine(\"Equal\");\n else if (diff > 0)\n Console.WriteLine(\"Dasha\");\n else if (diff < 0)\n Console.WriteLine(\"Masha\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "683175824820423288fe70200760519a", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round73\n{\n class C\n {\n static int gcd(int n, int r) { return r == 0 ? n : gcd(r, n % r); }\n static void Main()\n {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n int a = xs[0],\n b = xs[1],\n g = gcd(a,b);\n a /= g; b /= g;\n if (Math.Abs(a - b) == 1)\n Console.WriteLine(\"Equal\");\n else\n Console.WriteLine(a cur[1])\n min = 1;\n else\n {\n if (t[0] < t[1])\n {\n min = 0;\n }\n else\n min = 1;\n }\n long add = cur[min] - prev;\n t[min] += add;\n prev = cur[min];\n if (cur[0] == cur[1])\n break;\n cur[min] += f[min];\n }\n if (t[0] > t[1])\n println(\"Dasha\");\n else if (t[0] b) a -= b;\n else b -= a;\n }\n return a;\n }\n static void Main(string[] args)\n {\n string[] t = Console.ReadLine().Split(' ');\n long a = long.Parse(t[0]);\n long b = long.Parse(t[1]);\n long LCM = (a * b) / GCD(a, b);\n long aLength = LCM / a;\n long bLength = LCM / b; \n long cur = 0;\n long curA = a;\n long curB = b;\n long Dasha = 0;\n long Masha = 0;\n while (cur < LCM)\n {\n if (curA < curB)\n {\n Dasha += (curA - cur);\n cur = curA;\n curA += a;\n continue;\n }\n if (curB < curA)\n {\n Masha += (curB - cur);\n cur = curB;\n curB += b;\n continue;\n }\n if (curB == curA)\n {\n if (a < b)\n Masha += (curB - cur);\n if (a > b)\n Dasha += (curB - cur);\n cur = curA;\n curA += a;\n curB += b;\n }\n }\n if (Masha < Dasha) Console.WriteLine(\"Dasha\");\n else if (Dasha < Masha) Console.WriteLine(\"Masha\");\n else Console.WriteLine(\"Equal\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dd5f0fcc1d0e82517de1732d21ab4cc3", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest.C\n{\n class Program\n {\n /////////////////////\n\n public static T Read()\n {\n return (T)Convert.ChangeType(Console.ReadLine(), typeof(T));\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 ///////////////////////////////////\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\n static long Gcd(long a, long b)\n {\n return b != 0 ? Gcd(b, a % b) : a;\n }\n\n static void Main(string[] args)\n {\n try\n {\n List readList = ReadList();\n long a = readList[0];\n long b = readList[1];\n long n = (a/Gcd(a, b))*b;\n bool i = a > b;\n long x = 0, y = 0;\n if (i) Swap(ref a, ref b);\n\n long m = n / b;\n for (int j = 1; j <= m; j++)\n {\n if (j != m)\n {\n long r = b * j;\n long ri = r % a;\n x += r - ri - b*(j - 1);\n y += ri;\n }\n else\n {\n x += (n - a) - b*(j - 1);\n y += a;\n }\n }\n\n if (x == y)\n Console.WriteLine(\"Equal\");\n else if (x > y && !i)\n Console.WriteLine(\"Dasha\");\n else\n Console.WriteLine(\"Masha\");\n }\n catch\n {\n Console.Write(\"ERROR\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d42c65a7e8475067db627f2dac31c187", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "Mono C#", "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 a = int.Parse(ss[0]);\n int b = int.Parse(ss[1]);\n\n int gcd = _gcd(a, b);\n a /= gcd;\n b /= gcd;\n if (a > b + 1)\n CF.WriteLine(\"Masha\");\n else if (b > a + 1)\n CF.WriteLine(\"Dasha\");\n else\n CF.WriteLine(\"Equal\");\n\n }\n\n int _gcd(int a, int b)\n {\n int max = Math.Max(a, b);\n int min = Math.Min(a, b);\n for (; ; )\n {\n int tmp = max % min;\n if (tmp == 0)\n return min;\n\n max = min;\n min = tmp;\n }\n }\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n3 7\n\",\n\n@\"\n5 3\n\",\n@\"\n2 3\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1ef5e609309881a845d41b31dbdf326", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace c1cs\n{\n class Program\n {\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 Int64 d = 0;\n Int64 m = 0;\n Int64 lp = 0;\n Int64 dp = 0;\n Int64 mp = 0;\n while (dp < a * b)\n {\n if (dp + a < mp + b)\n {\n dp += a;\n d += dp - lp;\n lp = dp;\n continue;\n }\n\n if (mp + b < dp + a)\n {\n mp += b;\n m += mp - lp;\n lp = mp;\n continue;\n }\n\n dp += a;\n mp += b;\n\n if (a < b) m += mp - lp;\n else d += dp - lp;\n\n lp = dp;\n }\n if (d > m) Console.WriteLine(\"Dasha\");\n if (m > d) Console.WriteLine(\"Masha\");\n if (d == m) Console.WriteLine(\"Equal\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3e3132d9c3c6a3bea443d476eae938f8", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n Console.WriteLine(Fun(s));\n\n }\n\n\n static public string Fun(string s)\n {\n int a, b; \n string da = \"Dasha\"; int d = 0;\n string ma = \"Masha\"; int m = 0;\n string eq = \"Equal\"; int e = 0;\n string[] arr = s.Split(' ');\n a = Convert.ToInt32(arr[0]); \n b = Convert.ToInt32(arr[1]); \n int per = nok(a, b);\n if (a < b) return ma;\n else if (b < a) return da;\n else return eq;\n \n }\n static public int nok(int a, int b)\n {\n return (a / nod(a, b)) * b;\n }\n static public int nod(int a, int b)\n {\n if (a != 0) return nod(b % a, a);\n else return b;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2b6dd73cb0e6a809973b01a9ec507f1b", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n Console.WriteLine(Fun(s));\n\n }\n\n\n static public string Fun(string s)\n {\n int a, b; \n string da = \"Dasha\"; int d = 0;\n string ma = \"Masha\"; int m = 0;\n string eq = \"Equal\"; int e = 0;\n string[] arr = s.Split(' ');\n a = Convert.ToInt32(arr[0]); \n b = Convert.ToInt32(arr[1]); \n int per = nok(a, b);\n if (a < b) return da;\n else if (b < a) return ma;\n else return eq;\n \n }\n static public int nok(int a, int b)\n {\n return (a / nod(a, b)) * b;\n }\n static public int nod(int a, int b)\n {\n if (a != 0) return nod(b % a, a);\n else return b;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "93f65ee502fd4347cfaad60f07f8a1ca", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n Console.WriteLine(Fun(s));\n\n }\n\n\n static public string Fun(string s)\n {\n int a, b; \n string da = \"Dasha\"; int d = 0;\n string ma = \"Masha\"; int m = 0;\n string eq = \"Equal\"; int e = 0;\n string[] arr = s.Split(' ');\n a = Convert.ToInt32(arr[0]); int ta = 0;\n b = Convert.ToInt32(arr[1]); int tb = 0;\n int per = nok(a, b);\n for (int i = 1; i <= per; i++)\n {\n if (a < b)\n {\n if (i <= a) { d++; a += a; }\n else if (i <= b) { m++;b += b; }\n }\n else if (a > b)\n {\n if (i <= b) { d++; b += b;}\n else if (i <= a) { m++;a += a; }\n }\n else if (a == b) return eq;\n }\n if (m < d) return da;\n else return ma;\n }\n static public int nok(int a, int b)\n {\n return (a / nod(a, b)) * b;\n }\n static public int nod(int a, int b)\n {\n if (a != 0) return nod(b % a, a);\n else return b;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e5717ff66855f4981dde78dc4458735d", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round73\n{\n class C\n {\n static void Main()\n {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n int a = xs[0],\n b = xs[1];\n if (Math.Abs(a - b) == 1)\n Console.WriteLine(\"Equal\");\n else\n Console.WriteLine(a b) a -= b;\n else b -= a;\n }\n return a;\n }\n static void Main(string[] args)\n {\n string[] t = Console.ReadLine().Split(' ');\n long a = long.Parse(t[0]);\n long b = long.Parse(t[1]);\n long LCM = (a * b) / GCD(a, b);\n long aLength = LCM / a;\n long bLength = LCM / b; \n long cur = 0;\n long curA = 0;\n long curB = 0;\n long Dasha = 0;\n long Masha = 0;\n while (cur < LCM)\n {\n if (curA < curB)\n {\n Dasha += (curA - cur - 1);\n cur = curA;\n curA += a;\n }\n if (curB < curA)\n {\n Masha += (curB - cur - 1);\n cur = curB;\n curB += a;\n }\n if (curB == curA)\n {\n if (a > b)\n Masha += (curB - cur - 1);\n if (a < b)\n Dasha += (curB - cur - 1);\n cur = curA;\n curA += a;\n curB += b;\n }\n }\n if (Masha < Dasha) Console.WriteLine(\"Dasha\");\n else if (Dasha < Masha) Console.WriteLine(\"Masha\");\n else Console.WriteLine(\"Equal\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b90a502d1fd27f373254a10d1f415a6", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n Console.WriteLine(Fun(s));\n\n }\n\n\n static public string Fun(string s)\n {\n int a, b; \n string da = \"Dasha\"; int d = 0;\n string ma = \"Masha\"; int m = 0;\n string eq = \"Equal\"; int e = 0;\n string[] arr = s.Split(' ');\n a = Convert.ToInt32(arr[0]); int ta = 0;\n b = Convert.ToInt32(arr[1]); int tb = 0;\n int per = nok(a, b);\n for (int i = 1; i <= per; i++)\n {\n if (a < b)\n {\n if (i <= a) { d++; }\n else if (i <= b) { m++; }\n else { a += a; b += b; }\n }\n else if (a > b)\n {\n if (i <= b) { d++; }\n else if (i <= a) { m++; }\n else { a += a; b += b; }\n }\n else if (a == b) return eq;\n }\n if (m < d) return da;\n else return ma;\n }\n static public int nok(int a, int b)\n {\n return (a / nod(a, b)) * b;\n }\n\n static public int nod(int a, int b)\n {\n if (a != 0) return nod(b % a, a);\n else return b;\n }\n }\n \n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "511ffae191e450cf04ed4d9fd8ecb831", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest.C\n{\n class Program\n {\n /////////////////////\n\n public static T Read()\n {\n return (T)Convert.ChangeType(Console.ReadLine(), typeof(T));\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 ///////////////////////////////////\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\n static int Gcd(int a, int b)\n {\n return b != 0 ? Gcd(b, a % b) : a;\n }\n\n static void Main(string[] args)\n {\n try\n {\n List readList = ReadList();\n int a = readList[0];\n int b = readList[1];\n int n = (a/Gcd(a, b))*b;\n bool i = a > b;\n int x = 0, y = 0;\n if (i) Swap(ref a, ref b);\n\n int m = n / b;\n for (int j = 1; j <= m; j++)\n {\n if (j != m)\n {\n int r = b*j;\n int ri = r%a;\n x += r - ri - b*(j - 1);\n y += ri;\n }\n else\n {\n x += (n - a) - b*(j - 1);\n y += a;\n }\n }\n\n if (x == y)\n Console.WriteLine(\"Equal\");\n else if (x > y && !i)\n Console.WriteLine(\"Dasha\");\n else\n Console.WriteLine(\"Masha\");\n }\n catch\n {\n Console.Write(\"ERROR\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbb8c4206cc3dd10c43f1c335fad7217", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace c1cs\n{\n class Program\n {\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 Int64 d = 0;\n Int64 m = 0;\n Int64 lp = 0;\n Int64 dp = 0;\n Int64 mp = 0;\n while (dp < a * b)\n {\n if (dp + a < mp + b)\n {\n dp += a;\n d += dp - lp;\n lp = dp;\n continue;\n }\n\n if (mp + b < dp + a)\n {\n mp += b;\n m += mp - lp;\n lp = mp;\n continue;\n }\n\n dp += a;\n mp += b;\n\n if (a < b) m += mp - lp;\n else d += dp - lp;\n\n lp = dp;\n }\n if (d > m) Console.WriteLine(\"Dasha\");\n if (m > d) Console.WriteLine(\"Masha\");\n if (d == m) Console.WriteLine(\"equal\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "464da81c4b5ee5128103ba2d601c67fe", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace C\n{\n class Program\n {\n static long GCD(long a, long b)\n {\n while (a != b)\n {\n if (a > b) a -= b;\n else b -= a;\n }\n return a;\n }\n static void Main(string[] args)\n {\n string[] t = Console.ReadLine().Split(' ');\n long a = long.Parse(t[0]);\n long b = long.Parse(t[1]);\n long LCM = (a * b) / GCD(a, b);\n long aLength = LCM / a;\n long bLength = LCM / b; \n long cur = 0;\n long curA = a;\n long curB = b;\n long Dasha = 0;\n long Masha = 0;\n while (cur < LCM)\n {\n if (curA < curB)\n {\n Dasha += (curA - cur);\n cur = curA;\n curA += a;\n continue;\n }\n if (curB < curA)\n {\n Masha += (curB - cur);\n cur = curB;\n curB += b;\n continue;\n }\n if (curB == curA)\n {\n if (a > b)\n Masha += (curB - cur);\n if (a < b)\n Dasha += (curB - cur);\n cur = curA;\n curA += a;\n curB += b;\n }\n }\n if (Masha < Dasha) Console.WriteLine(\"Dasha\");\n else if (Dasha < Masha) Console.WriteLine(\"Masha\");\n else Console.WriteLine(\"Equal\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d373802eeca7e045dc4f368a6d48745b", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class TaskA\n {\n static void Main()\n {\n var input = Console.ReadLine().Trim().Split(' ');\n var a = Int32.Parse(input[0]);\n var b = Int32.Parse(input[1]);\n\n var max = Math.Max(a, b);\n var min = Math.Min(a, b);\n\n long lenMax = 0;\n long nok = a*b;\n for (int i = 1; i <= min; i++)\n {\n var q = (max * i) % min;\n if (q == 0)\n {\n lenMax += min;\n nok = i * max;\n }\n else\n lenMax += q;\n }\n if(lenMax*2 == nok)\n Console.WriteLine(\"Equal\");\n else if (lenMax * 2 < nok)\n {\n if (max == b)\n Console.WriteLine(\"Dasha\");\n else\n Console.WriteLine(\"Masha\");\n }\n else\n {\n if (max == a)\n Console.WriteLine(\"Dasha\"); \n else\n Console.WriteLine(\"Masha\");\n }\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "572cb3741a05d23a2a484aa7f11d9d8c", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemC\n{\n static long GCD(long a, long b)\n {\n if (b > a)\n {\n long temp = a;\n a = b;\n b = temp;\n }\n while (true)\n {\n a = a % b;\n long temp = a;\n a = b;\n b = temp;\n if (b == 0)\n return a;\n }\n }\n\n static void Main(string[] args)\n {\n int[] tokens = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n long lcm = tokens[0] * tokens[1] / GCD(tokens[0], tokens[1]);\n long diff = (lcm / tokens[0]) - (lcm / tokens[1]);\n if (diff == 1 || diff == -1)\n Console.WriteLine(\"Equal\");\n else if (diff > 0)\n Console.WriteLine(\"Dasha\");\n else if (diff < 0)\n Console.WriteLine(\"Masha\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3e38b5c27004f3e0b9657bbf3aab8c0e", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "MS C#", "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.Net;\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 d = new Dictionary();\n d[\"A221033\"] = 21;\n d[\"A223635\"] = 22;\n d[\"A232726\"] = 23;\n\n string s = ReadToken();\n if (!d.ContainsKey(s))\n Write(0);\n Write(d[s]);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b761be7a2e750a1747cf0dee944a6333", "src_uid": "47287f8bc61fec72d729638d5e0e67f5", "difficulty": 1900.0} {"lang": "MS C#", "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.Net;\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 d = new Dictionary();\n d[\"A221033\"] = 21;\n d[\"A223635\"] = 22;\n d[\"A232726\"] = 23;\n\n string s = ReadToken();\n if (!d.ContainsKey(s))\n throw new Exception();\n Write(d[s]);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6844400a229a760183399db1396845b", "src_uid": "47287f8bc61fec72d729638d5e0e67f5", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Ace_It\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 sum = 1;\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i] > '1')\n sum += s[i] - '0';\n else\n {\n sum += 10;\n i ++;\n }\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b4627f8e73ab83335c1592d76a8e820e", "src_uid": "47287f8bc61fec72d729638d5e0e67f5", "difficulty": 1900.0} {"lang": "MS C#", "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.Net;\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 d = new Dictionary();\n d[\"A221033\"] = 23;\n d[\"A223635\"] = 22;\n d[\"A232726\"] = 23;\n\n string s = ReadToken();\n if (!d.ContainsKey(s))\n throw new Exception();\n Write(d[s]);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c06a78ab3e565cd180f519963853c8bf", "src_uid": "47287f8bc61fec72d729638d5e0e67f5", "difficulty": 1900.0} {"lang": "MS C#", "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 d = sc.Integer();\n x = sc.Long();\n var a = new int[n];\n var b = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = i + 1;\n for (int i = 0; i < n; i++)\n {\n nextX();\n var tmp = a[i];\n a[i] = a[x % (i + 1)];\n a[x % (i + 1)] = tmp;\n }\n for (int i = 0; i < n; i++)\n {\n if (i < d) b[i] = 1;\n else b[i] = 0;\n }\n for (int i = 0; i < n; i++)\n {\n nextX();\n var tmp = b[i];\n b[i] = b[x % (i + 1)];\n b[x % (i + 1)] = tmp;\n }\n\n if (d <= 1000)\n {\n var position = new List();\n for (int i = 0; i < n; i++)\n if (b[i] == 1) position.Add(i);\n for (int i = 0; i < n; i++)\n {\n var max = 0;\n foreach (var p in position)\n {\n if (p <= i)\n max = Math.Max(max, a[i - p]);\n }\n IO.Printer.Out.WriteLine(max);\n }\n\n }\n\n else\n {\n var position = new int[n];\n for (int i = 0; i < n; i++)\n position[a[i] - 1] = i;\n for (int i = 0; i < n; i++)\n {\n var f = false;\n for (int j = n - 1; j >= n - 1000; j--)\n {\n if (position[j] > i) continue;\n if (b[i - position[j]] > 0)\n {\n IO.Printer.Out.WriteLine(j + 1);\n f = true;\n break;\n }\n }\n if (f) continue;\n var max = 0;\n foreach (var p in position)\n {\n if (p > i) break;\n max = Math.Max(max, a[i - p]);\n }\n\n }\n\n\n }\n }\n long x;\n long nextX()\n {\n return x = (x * 37 + 10007) % 1000000007;\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a0efe26f36466bac67a184a3baea11ee", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "MS C#", "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 d = sc.Integer();\n x = sc.Long();\n var a = new int[n];\n var b = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = i + 1;\n for (int i = 0; i < n; i++)\n {\n nextX();\n var tmp = a[i];\n a[i] = a[x % (i + 1)];\n a[x % (i + 1)] = tmp;\n }\n for (int i = 0; i < n; i++)\n {\n if (i < d) b[i] = 1;\n else b[i] = 0;\n }\n for (int i = 0; i < n; i++)\n {\n nextX();\n var tmp = b[i];\n b[i] = b[x % (i + 1)];\n b[x % (i + 1)] = tmp;\n }\n\n var ans = new int[n];\n if (d <= 1000)\n {\n var position = new List();\n for (int i = 0; i < n; i++)\n if (b[i] == 1) position.Add(i);\n for (int i = 0; i < n; i++)\n {\n foreach (var p in position)\n {\n var k = i + p;\n if (k < n)\n ans[k] = Math.Max(ans[k], a[i]);\n }\n }\n for (int i = 0; i < n; i++)\n {\n IO.Printer.Out.WriteLine(ans[i]);\n }\n }\n\n {\n var position = new int[n];\n for (int i = 0; i < n; i++)\n position[a[i] - 1] = i;\n for (int i = 0; i < n; i++)\n {\n var f = false;\n for (int j = n - 1; j >= n - 1000; j--)\n {\n if (position[j] > i) continue;\n if (b[i - position[j]] > 0)\n {\n IO.Printer.Out.WriteLine(j + 1);\n f = true;\n break;\n }\n }\n if (f) continue;\n foreach (var p in position)\n {\n if (p > i) continue;\n var k = i + p;\n if (k < n)\n ans[k] = Math.Max(ans[k], a[i]);\n }\n\n }\n\n\n }\n }\n long x;\n long nextX()\n {\n return x = (x * 37 + 10007) % 1000000007;\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8f805a67b6c63284f059f28adefe8e25", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "MS C#", "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 d = sc.Integer();\n x = sc.Long();\n var a = new int[n];\n var b = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = i + 1;\n for (int i = 0; i < n; i++)\n {\n nextX();\n var tmp = a[i];\n a[i] = a[x % (i + 1)];\n a[x % (i + 1)] = tmp;\n }\n for (int i = 0; i < n; i++)\n {\n if (i < d) b[i] = 1;\n else b[i] = 0;\n }\n for (int i = 0; i < n; i++)\n {\n nextX();\n var tmp = b[i];\n b[i] = b[x % (i + 1)];\n b[x % (i + 1)] = tmp;\n }\n\n var ans = new int[n];\n if (d <= 1000)\n {\n var position = new List();\n for (int i = 0; i < n; i++)\n if (b[i] == 1) position.Add(i);\n for (int i = 0; i < n; i++)\n {\n foreach (var p in position)\n {\n var k = i + p;\n if (k < n)\n ans[k] = Math.Max(ans[k], a[i]);\n }\n }\n for (int i = 0; i < n; i++)\n {\n IO.Printer.Out.WriteLine(ans[i]);\n }\n }\n\n else {\n var position = new int[n];\n for (int i = 0; i < n; i++)\n position[a[i] - 1] = i;\n for (int i = 0; i < n; i++)\n {\n var f = false;\n for (int j = n - 1; j >= n - 1000; j--)\n {\n if (position[j] > i) continue;\n if (b[i - position[j]] > 0)\n {\n IO.Printer.Out.WriteLine(j + 1);\n f = true;\n break;\n }\n }\n if (f) continue;\n foreach (var p in position)\n {\n if (p > i) continue;\n var k = i + p;\n if (k < n)\n ans[k] = Math.Max(ans[k], a[i]);\n }\n\n }\n\n\n }\n }\n long x;\n long nextX()\n {\n return x = (x * 37 + 10007) % 1000000007;\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0ae5e9456134c0254116c8ac91ec2f8a", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "MS C#", "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 d = sc.Integer();\n x = sc.Long();\n var a = new int[n];\n var b = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = i + 1;\n for (int i = 0; i < n; i++)\n {\n nextX();\n var tmp = a[i];\n a[i] = a[x % (i + 1)];\n a[x % (i + 1)] = tmp;\n }\n for (int i = 0; i < n; i++)\n {\n if (i < d) b[i] = 1;\n else b[i] = 0;\n }\n for (int i = 0; i < n; i++)\n {\n nextX();\n var tmp = b[i];\n b[i] = b[x % (i + 1)];\n b[x % (i + 1)] = tmp;\n }\n\n if (d <= 1000)\n {\n var position = new List();\n for (int i = 0; i < n; i++)\n if (b[i] == 1) position.Add(i);\n for (int i = 0; i < n; i++)\n {\n var max = 0;\n foreach (var p in position)\n {\n if (p <= i)\n max = Math.Max(max, a[i - p]);\n }\n IO.Printer.Out.WriteLine(max);\n }\n\n }\n\n else\n {\n var position = new int[n];\n for (int i = 0; i < n; i++)\n position[a[i] - 1] = i;\n for (int i = 0; i < n; i++)\n {\n var f = false;\n for (int j = n - 1; j >= n - 1000; j--)\n {\n if (position[j] > i) continue;\n if (b[i - position[j]] > 0)\n {\n IO.Printer.Out.WriteLine(j + 1);\n f = true;\n break;\n }\n }\n if (f) continue;\n var max = 0;\n foreach (var p in position)\n {\n if (p > i) break;\n max = Math.Max(max, a[i - p]);\n }\n IO.Printer.Out.WriteLine(max);\n }\n\n\n }\n }\n long x;\n long nextX()\n {\n return x = (x * 37 + 10007) % 1000000007;\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "47ace55122893a19f358190439b4a6d5", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "MS C#", "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 d = sc.Integer();\n x = sc.Long();\n var a = new int[n];\n var b = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = i + 1;\n for (int i = 0; i < n; i++)\n {\n nextX();\n var tmp = a[i];\n a[i] = a[x % (i + 1)];\n a[x % (i + 1)] = tmp;\n }\n for (int i = 0; i < n; i++)\n {\n if (i < d) b[i] = 1;\n else b[i] = 0;\n }\n for (int i = 0; i < n; i++)\n {\n nextX();\n var tmp = b[i];\n b[i] = b[x % (i + 1)];\n b[x % (i + 1)] = tmp;\n }\n\n if (d <= 1000)\n {\n var position = new List();\n for (int i = 0; i < n; i++)\n if (b[i] == 1) position.Add(i);\n for (int i = 0; i < n; i++)\n {\n var max = 0;\n foreach (var p in position)\n {\n if (p <= i)\n max = Math.Max(max, a[i - p]);\n }\n IO.Printer.Out.WriteLine(max);\n }\n\n }\n\n else\n {\n var position = new int[n];\n for (int i = 0; i < n; i++)\n position[a[i] - 1] = i;\n var pos = new List();\n for (int i = 0; i < n; i++)\n if (b[i] == 1) pos.Add(i);\n for (int i = 0; i < n; i++)\n {\n var f = false;\n for (int j = n - 1; j >= n - 1000; j--)\n {\n if (position[j] > i) continue;\n if (b[i - position[j]] > 0)\n {\n IO.Printer.Out.WriteLine(j + 1);\n f = true;\n break;\n }\n }\n if (f) continue;\n var max = 0;\n foreach (var p in pos)\n {\n if (p > i) break;\n max = Math.Max(max, a[i - p]);\n }\n IO.Printer.Out.WriteLine(max);\n }\n\n\n }\n }\n long x;\n long nextX()\n {\n return x = (x * 37 + 10007) % 1000000007;\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a70c340c324475df1a7d9d7c3cf8a99e", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Task_D\n{\n class Solution\n {\n static void Main(string[] args)\n {\n new Solution().Solve();\n }\n\n private int n;\n private int d;\n private long x;\n private int[] a;\n private int[] b;\n private int[] c;\n\n private void Solve()\n {\n var parts = Console.ReadLine().Split();\n n = int.Parse(parts[0]);\n d = int.Parse(parts[1]);\n x = long.Parse(parts[2]);\n\n a = new int[n];\n b = new int[n];\n c = new int[n];\n\n initAB();\n\n var bCount = 0;\n var bPos = new int[n];\n for (int i = 0; i < n; i++)\n {\n if (b[i] == 1)\n {\n bPos[bCount++] = i;\n }\n }\n\n var aOrder = new int[n];\n for (int i = 0; i < n; i++)\n {\n aOrder[a[i] - 1] = i;\n }\n\n int s = 50;\n\n for (int i = 0; i < n; i++)\n {\n for (int q = 0; q < s && q < n; q++)\n {\n int j = aOrder[n - q - 1];\n if (i - j >= 0 && b[i - j] == 1)\n {\n c[i] = a[j];\n break;\n }\n }\n\n if (c[i] != 0)\n {\n continue;\n }\n\n for (int z = 0; z < bCount; z++)\n {\n var bIndex = bPos[z];\n var j = i - bIndex;\n if (j >= 0)\n {\n c[i] = Math.Max(c[i], a[j]);\n }\n }\n }\n\n for (int i = 0; i < n; i++)\n {\n Console.WriteLine(c[i]);\n }\n }\n\n private long getNextX()\n {\n x = (x * 37 + 10007) % 1000000007;\n return x;\n }\n\n private void initAB()\n {\n for (int i = 0; i < n; i = i + 1)\n {\n a[i] = i + 1;\n }\n\n for (int i = 0; i < n; i = i + 1)\n {\n swap(ref a[i], ref a[getNextX() % (i + 1)]);\n }\n\n for (int i = 0; i < n; i = i + 1)\n {\n if (i < d)\n b[i] = 1;\n else\n b[i] = 0;\n }\n\n for (int i = 0; i < n; i = i + 1)\n {\n swap(ref b[i], ref b[getNextX() % (i + 1)]);\n }\n }\n\n private void swap(ref T first, ref T second)\n {\n T tmp = first;\n first = second;\n second = tmp;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1810646a5eda1aa8c2bfc7cff8398ead", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Board_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 xp = Next(), yp = Next(), xv = Next(), yv = Next();\n\n if (xp <= xv && yp <= yv || xp + yp <= Math.Max(xv, yv))\n writer.WriteLine(\"Polycarp\");\n else\n writer.WriteLine(\"Vasiliy\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2617af6388113705ecece313e83c6508", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0} {"lang": "MS C#", "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 x1 = ReadInt();\n int y1 = ReadInt();\n int x2 = ReadInt();\n int y2 = ReadInt();\n\n int d1 = x1 + y1;\n int d2 = Math.Max(x2, y2);\n if (d1 <= d2 || x1 < x2 && y1 <= y2 || y1 < y2 && x1 <= x2)\n Write(\"Polycarp\");\n else\n Write(\"Vasiliy\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3bdbe0ea1fb12e820d57abfd801647b2", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0} {"lang": "MS C#", "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 C\n {\n private static ThreadStart s_threadStart = new C().Go;\n private static bool s_time = false;\n private static double s_eps = 1e-16;\n\n private void Go()\n {\n int px = GetInt();\n int py = GetInt();\n int vx = GetInt();\n int vy = GetInt();\n\n if (px <= vx && py <= vy)\n {\n Wl(\"Polycarp\"); return;\n }\n if(vx <= px && vy <= py)\n {\n Wl(\"Vasiliy\"); return;\n }\n\n if (px > vx)\n {\n if (px <= vy - py)\n {\n Wl(\"Polycarp\"); return;\n }\n Wl(\"Vasiliy\"); return;\n }\n\n if (py <= vx - px)\n {\n Wl(\"Polycarp\"); return;\n }\n Wl(\"Vasiliy\"); return;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e2b32415a0931b30a83aaa459027a949", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace vkcup\n{\n\tclass Program\n\t{\n\t\tpublic static int n, m, h, w;\n\n\t\tpublic static int x1, x2, y1, y2;\n\n\t\tpublic static int[] arr;\n\t\tprivate static String s1;\n\t\tprivate static String s2;\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tParseAll(true);\n\t\t\tSolve();\n\t\t\tConsole.ReadKey();\n\t\t}\n\n\n\t\tstatic void Solve()\n\t\t{\n\t\t\tif ((x2 <= x1 && y2 <= y1) ||\n\t\t\t\t(y2 < y1 && x2 - x1 < y1) ||\n\t\t\t\t(x2 < x1 && y2 - y1 < x1))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Vasiliy\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Polycarp\");\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\n\t\tstatic void ParseAll(bool console)\n\t\t{\n\t\t\tif (console)\n\t\t\t{\n\t\t\t\tParseFirstLine(Console.ReadLine());\n\t\t\t\t//ParseArray(2);\n\t\t\t}\n\t\t}\n\n\t\tstatic void ParseFirstLine(String line)\n\t\t{\n\t\t\tint[] arr = line.Split(' ').Select(int.Parse).ToArray();\n\t\t\tx1 = arr[0];\n\t\t\ty1 = arr[1];\n\t\t\tx2 = arr[2];\n\t\t\ty2 = arr[3];\n\t\t}\n\n\t\tstatic void ParseSecondLine(String line)\n\t\t{\n\t\t\tint[] array = line.Split(' ').Select(int.Parse).ToArray();\n\n\t\t}\n\n\t\tstatic void ParseThirdLine(String line)\n\t\t{\n\t\t\tint[] array = line.Split(' ').Select(int.Parse).ToArray();\n\n\t\t}\n\n\t\tstatic void ParseArray(int count)\n\t\t{\n\t\t\ts1 = Console.ReadLine();\n\t\t\ts2 = Console.ReadLine();\n\n\t\t}\n\n\n\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3bae80a5c3b264aa98fe83910a481798", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int zobmieCount = Convert.ToInt32(Console.ReadLine());\n\n int brainCount;\n\n if (zobmieCount % 2 != 0)\n if (zobmieCount == 1)\n {\n Console.WriteLine(\"1\");\n return;\n }\n else\n brainCount = (int)(zobmieCount / 2) + 1;\n else\n brainCount = zobmieCount / 2;\n\n Console.WriteLine(brainCount);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "95ae9c1121fdae0bff708584f977275f", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "MS C#", "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()\n {\n int int_input = int.Parse(Console.ReadLine());\n int int_result;\n \n int_result = int_input / 2;\n if (int_input % 2 == 1 ){\n int_result++;\n }\n\n Console.WriteLine(int_result);\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ccbfaca36b25cc9beb71d84be36b814", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp17\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "94f1bd22532ae0c755cafd7854d53e70", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "MS C#", "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 Write((n + 1) / 2);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d6bff884b36a3f5f4beefd4828959ae", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "MS C#", "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);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5ce5a387bf5a2947cec4c7d2449bd30f", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Heidi_and_Zombies\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine());\n\n if(N -1 > 0)\n {\n Console.WriteLine(Math.Ceiling((double)N/2));\n }else\n {\n Console.WriteLine(\"1\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0df5a7089e3e4d81aefe8a21c764b38c", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "MS C#", "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)/2 + 1);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "26d01c6f8cfe502b55baca198924d486", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Heidi_and_Zombies\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine());\n\n if(N -1 > 0)\n {\n Console.WriteLine(N / 2);\n }else\n {\n Console.WriteLine(\"1\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1ee56bd7eb8e408d3c67ccac953b9fd", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25123.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Heidi and Zombies\", \"Heidi and Zombies\\Heidi and Zombies.csproj\", \"{B7B14A36-F617-4DFF-9848-00FAC61FD305}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B7B14A36-F617-4DFF-9848-00FAC61FD305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B7B14A36-F617-4DFF-9848-00FAC61FD305}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B7B14A36-F617-4DFF-9848-00FAC61FD305}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B7B14A36-F617-4DFF-9848-00FAC61FD305}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "387c9ef1405a69ce74c9a453a8996089", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Taxis\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count1s = 0, count2s = 0, count3s = 0, count4s = 0;\n int numberOfTaxis = 0;\n int remOf1s = 0;\n int x = int.Parse(Console.ReadLine());\n string y = Console.ReadLine();\n string[] arr = y.Split(' ');\n int[] intArray = new int[arr.Length];\n for(int i = 0; i < arr.Length; i++)\n {\n intArray[i] = int.Parse(arr[i]);\n if (intArray[i] == 1) count1s++;\n else if (intArray[i] == 2) count2s++;\n else if (intArray[i] == 3) count3s++;\n else if (intArray[i] == 4) count4s++;\n }\n numberOfTaxis += count4s;\n numberOfTaxis += count2s / 2;\n count2s = count2s % 2;\n numberOfTaxis += count3s;\n if (count1s == count3s)\n {\n count3s = 0;\n count1s = 0;\n }\n else if (count1s > count3s)\n {\n count1s -= count3s;\n }\n else\n {\n count1s = 0; \n }\n \n if (count1s == count2s * 2)\n {\n numberOfTaxis += count2s;\n count1s = 0;\n }else if (count1s > count2s * 2)\n {\n numberOfTaxis += count2s;\n count1s -= count2s * 2;\n numberOfTaxis += count1s / 4;\n count1s = count1s % 4;\n }else\n { \n numberOfTaxis += count2s;\n count1s = 0;\n }\n if (count1s != 0)\n {\n if (count1s < 4)\n {\n numberOfTaxis++;\n }\n else\n {\n count1s -= 4;\n numberOfTaxis += count1s / 4;\n }\n }\n\n Console.WriteLine(numberOfTaxis);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f554c2fd776ce86513b34e467f535793", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Magnum_Opus\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 ing = new[] {1, 1, 2, 7, 4};\n\n var nn = new int[5];\n for (int i = 0; i < 5; i++)\n {\n nn[i] = Next();\n }\n\n int max = int.MaxValue;\n\n for (int i = 0; i < 5; i++)\n {\n max = Math.Min(max, nn[i]/ing[i]);\n }\n\n writer.WriteLine(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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ceb46b032a2a666355bea9123f73193f", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "MS C#", "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 int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n input[2] /= 2;\n input[3] /= 7;\n input[4] /= 4;\n Array.Sort(input);\n Console.WriteLine(input[0]); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6dcf2bde421448b18aa3ffbfb7bc48f8", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nclass C\n{\n\t\t\t\tstatic void Main()\n\t\t\t\t{\n\t\t\t\t\t\t\t\tstring input = Console.ReadLine();\n\t\t\t\t\t\t\t\tstring[] split = input.Split(' ');\n\t\t\t\t\t\t\t\tint[] have = new int [5];\n\t\t\t\t\t\t\t\tint[] intr = {1,1,2,7,4};\n\t\t\t\t\t\t\t\tint[] set = new int [5];\n\t\t\t\t\t\t\t\tfor(int i = 0; i<5; i++)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\thave[i] = int.Parse(split[i]);\n\t\t\t\t\t\t\t\t\t\t\t\tset[i] = have[i]/intr[i];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tint max = 101;\n\t\t\t\t\t\t\t\tint index = 6;\n\t\t\t\t\t\t\t\tfor(int i = 0; i<5; i++)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif(set[i] buffer;\n\n ///\u6784\u9020\u51fd\u6570\uff1f\u5b83\u4e0d\u9700\u8981\u6784\u9020\u51fd\u6570\uff0c\u6784\u9020\u51fd\u6570\u4e5f\u6ca1\u6709\u53c2\u6570\u3002\n public Scanner() { }\n\n ///\u6e05\u9664\u8f93\u5165\u6d41\u7f13\u51b2\u3002\u5982\u679c\u672c\u884c\u88ab\u8bfb\u51fa\u4e00\u90e8\u5206\uff0c\u6b64\u65b9\u6cd5\u4f1a\u6e05\u9664\u8fd9\u884c\u7684\u5176\u4ed6\u90e8\u5206\u3002\n public void Ignore()\n {\n buffer.Clear();\n }\n protected void eat(string s)\n {\n string[] tempInput = new System.Text.RegularExpressions.Regex(\"(\\\\s+)\").Split(s);\n buffer = new Queue(tempInput);\n buffer.Enqueue(\"\");\n }\n /// \n ///\n /// \u4ece\u8f93\u5165\u6d41\u4e2d\u8bfb\u53d6\u4e0b\u4e00\u884c\uff0c\u5982\u679c\u672c\u884c\u5df2\u7ecf\u88ab\u8bfb\u51fa\u4e00\u90e8\u5206\uff0c\u6b64\u65b9\u6cd5\u5c06\u76f4\u63a5\u8bfb\u51fa\u5176\u4f59\u7684\u6240\u6709\u5185\u5bb9\u3002\n /// \u6b64\u65b9\u6cd5\u6267\u884c\u540e\u4f1a\u6e05\u7a7a\u6d41\u7f13\u51b2\uff0c\u6240\u4ee5\u4e0d\u9700\u8981\u518d\u6267\u884cIgnore()\u65b9\u6cd5\u3002\n ///\n public string NextLine()\n {\n if (buffer == null || buffer.Count == 0) return Console.ReadLine();\n else\n {\n StringBuilder temp = new StringBuilder();\n foreach (string k in buffer)\n {\n temp.Append(k);\n }\n buffer.Clear();\n return temp.ToString();\n }\n }\n /// \n ///\n /// \u8be5\u65b9\u6cd5\u8fd4\u56de\u4e00\u4e2a\u5e03\u5c14\u503c\uff0c\u8868\u793a\u8f93\u5165\u6d41\u662f\u5426\u7ed3\u675f\u3002\n /// \u5728\u8f93\u5165\u6d41\u4e2d\u6ca1\u6709\u5176\u4ed6\u5185\u5bb9\u65f6\u4f1a\u8fd4\u56defalse\n ///\n public bool HasNext()\n {\n if (buffer == null || buffer.Count == 0)\n {\n string s = Console.ReadLine();\n if (s == null) return false;\n eat(s);\n }\n return true;\n }\n /// \n ///\n /// \u8be5\u65b9\u6cd5\u8fd4\u56de\u4e0b\u4e00\u4e2a\u5b57\u7b26\u4e32\u3002\u7531\u4efb\u610f\u53ef\u80fd\u7684\u7a7a\u767d\u7b26\u53f7\u5206\u9694\u3002\n ///\n public String Next()\n {\n HasNext();\n string t = buffer.Dequeue();\n buffer.Dequeue();\n return t;\n }\n /// \n ///\n /// \u8be5\u65b9\u6cd5\u8fd4\u56de\u8f93\u5165\u6d41\u4e2d\u63a5\u4e0b\u6765\u7684\u4e00\u4e2a32\u4f4d\u6574\u6570\u3002\u5982\u679c\u63a5\u4e0b\u6765\u7684\u5b57\u7b26\u4e0d\u80fd\u8868\u793a\u4e00\u4e2a\u6574\u6570\uff0c\u5c06\u629b\u51faFormatException\u5f02\u5e38\u3002\n ///\n ///\u5b57\u7b26\u4e32\u4e0d\u80fd\u89e3\u6790\u4e3a\u6570\u5b57\n public int NextInt()\n {\n return int.Parse(Next());\n }\n /// \n ///\n /// \u8be5\u65b9\u6cd5\u8fd4\u56de\u8f93\u5165\u6d41\u4e2d\u63a5\u4e0b\u6765\u7684\u4e00\u4e2a64\u4f4d\u6574\u6570\u3002\u5982\u679c\u63a5\u4e0b\u6765\u7684\u5b57\u7b26\u4e0d\u80fd\u8868\u793a\u4e00\u4e2a\u6574\u6570\uff0c\u5c06\u629b\u51faFormatException\u5f02\u5e38\u3002\n ///\n ///\u5b57\u7b26\u4e32\u4e0d\u80fd\u89e3\u6790\u4e3a\u6570\u5b57\n public long NextLong()\n {\n return long.Parse(Next());\n }\n /// \n ///\n /// \u8be5\u65b9\u6cd5\u8fd4\u56de\u8f93\u5165\u6d41\u4e2d\u63a5\u4e0b\u6765\u7684\u4e00\u4e2a\u6d6e\u70b9\u6570\u3002\u5982\u679c\u63a5\u4e0b\u6765\u7684\u5b57\u7b26\u4e0d\u80fd\u8868\u793a\u4e00\u4e2a\u6570\uff0c\u5c06\u629b\u51faFormatException\u5f02\u5e38\u3002\n ///\n ///\u5b57\u7b26\u4e32\u4e0d\u80fd\u89e3\u6790\u4e3a\u6570\u5b57\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n /// \n ///\n /// \u8be5\u65b9\u6cd5\u5c06\u4e0b\u4e00\u884c\u6309\u7a7a\u767d\u5b57\u7b26\u5206\u9694\uff0c\u5e76\u4ee5\u5b57\u7b26\u4e32\u6570\u7ec4\u5f62\u5f0f\u8fd4\u56de\u3002\n /// \u5982\u679c\u8f93\u5165\u6d41\u4e2d\u4e00\u884c\u5df2\u7ecf\u88ab\u8bfb\u51fa\u4e00\u90e8\u5206\uff0c\u8be5\u65b9\u6cd5\u5c06\u89e3\u6790\u5e76\u8fd4\u56de\u5269\u4f59\u7684\u90e8\u5206\u3002\n ///\n public string[] NextArray()\n {\n return new System.Text.RegularExpressions.Regex(\"\\\\s+\").Split(NextLine());\n }\n /// \n ///\n /// \u8be5\u65b9\u6cd5\u5c06\u4e0b\u4e00\u884c\u6309\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u7684\u6574\u6570\u89e3\u6790\u621032\u4f4d\u6574\u578b\u6570\u7ec4\u5e76\u8fd4\u56de\u3002\n /// \u5982\u679c\u8f93\u5165\u6d41\u4e2d\u4e00\u884c\u5df2\u7ecf\u88ab\u8bfb\u51fa\u4e00\u90e8\u5206\uff0c\u8be5\u65b9\u6cd5\u5c06\u89e3\u6790\u5e76\u8fd4\u56de\u5269\u4f59\u7684\u90e8\u5206\u3002\u5982\u679c\u5b58\u5728\u5b57\u7b26\u4e0d\u80fd\u8868\u793a\u4e00\u4e2a\u6570\uff0c\u5c06\u629b\u51faFormatException\u5f02\u5e38\u3002\n ///\n ///\u5b57\u7b26\u4e32\u4e0d\u80fd\u89e3\u6790\u4e3a\u6570\u5b57\n public int[] NextIntArray()\n {\n string[] s = NextArray();\n int[] n = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n n[i] = int.Parse(s[i]);\n }\n return n;\n }\n /// \n ///\n /// \u8be5\u65b9\u6cd5\u5c06\u4e0b\u4e00\u884c\u6309\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u7684\u6574\u6570\u89e3\u6790\u621064\u4f4d\u6574\u578b\u6570\u7ec4\u5e76\u8fd4\u56de\u3002\n /// \u5982\u679c\u8f93\u5165\u6d41\u4e2d\u4e00\u884c\u5df2\u7ecf\u88ab\u8bfb\u51fa\u4e00\u90e8\u5206\uff0c\u8be5\u65b9\u6cd5\u5c06\u89e3\u6790\u5e76\u8fd4\u56de\u5269\u4f59\u7684\u90e8\u5206\u3002\u5982\u679c\u5b58\u5728\u5b57\u7b26\u4e0d\u80fd\u8868\u793a\u4e00\u4e2a\u6570\uff0c\u5c06\u629b\u51faFormatException\u5f02\u5e38\u3002\n ///\n ///\u5b57\u7b26\u4e32\u4e0d\u80fd\u89e3\u6790\u4e3a\u6570\u5b57\n public long[] NextLongArray()\n {\n string[] s = NextArray();\n long[] n = new long[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n n[i] = long.Parse(s[i]);\n }\n return n;\n }\n /// \n ///\n /// \u8be5\u65b9\u6cd5\u5c06\u4e0b\u4e00\u884c\u6309\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u7684\u6570\u5b57\u89e3\u6790\u6210\u6d6e\u70b9\u6570\u7ec4\u5e76\u8fd4\u56de\u3002\n /// \u5982\u679c\u8f93\u5165\u6d41\u4e2d\u4e00\u884c\u5df2\u7ecf\u88ab\u8bfb\u51fa\u4e00\u90e8\u5206\uff0c\u8be5\u65b9\u6cd5\u5c06\u89e3\u6790\u5e76\u8fd4\u56de\u5269\u4f59\u7684\u90e8\u5206\u3002\u5982\u679c\u5b58\u5728\u5b57\u7b26\u4e0d\u80fd\u8868\u793a\u4e00\u4e2a\u6570\uff0c\u5c06\u629b\u51faFormatException\u5f02\u5e38\u3002\n ///\n ///\u5b57\u7b26\u4e32\u4e0d\u80fd\u89e3\u6790\u4e3a\u6570\u5b57\n public double[] NextDoubleArray()\n {\n string[] s = NextArray();\n double[] n = new double[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n n[i] = double.Parse(s[i]);\n }\n return n;\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ff5523c054b5b065085095e5d24b075e", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "MS C#", "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 = ReadIntArray();\n int[] b = new int[] {1, 1, 2, 7, 4};\n\n int ans = int.MaxValue;\n for (int i = 0; i < 5; i++)\n ans = Math.Min(ans, a[i] / b[i]);\n\n return ans;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8a1e8fb221effd90343a4a519c0e056a", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication5\n{\n public class Program\n {\n public static void Main()\n {\n var data = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();\n data[2] /= 2;\n data[3] /= 7;\n data[4] /= 4;\n Console.WriteLine(data.Min());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0b14f769473d295a20eb748314052bb4", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\t\n\t\tvar d=Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));\n\t\tint cnt=(int)1e9;\n\t\t\n\t\tcnt=Math.Min(cnt,d[0]/1);\n\t\tcnt=Math.Min(cnt,d[1]/1);\n\t\tcnt=Math.Min(cnt,d[2]/2);\n\t\tcnt=Math.Min(cnt,d[3]/7);\n\t\tcnt=Math.Min(cnt,d[4]/4);\n\t\t\n\n\n\t\tConsole.WriteLine(cnt);\n\t\t\n\t\t\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad06c6b847d75fa32f48353a9bad6e99", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "MS C#", "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 = System.Console.ReadLine().Split(' ');\n\n int a1 = int.Parse(s[0]);\n int a2 = int.Parse(s[1]);\n\n int p = a2 - a1;\n\n for (int i = 2; i < s.Count(); i++)\n {\n int t = int.Parse(s[i]);\n if (a2 + p != t)\n {\n System.Console.Write(0);\n return;\n }\n a2 = t;\n }\n\n System.Console.Write(1);\n } \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9b14c09cddf8d3d73f3e07f688906343", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "MS C#", "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 input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Console.WriteLine(1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9a2c278db80b591f82403410adef930b", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\t\n\t\tvar d=Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));\n\t\tint cnt=0;\n\t\tDictionary D=new Dictionary();\n\t\tD.Add(1,0);\n\t\tD.Add(2,0);\n\t\tD.Add(7,0);\n\t\tD.Add(9,0);\n\t\tfor(int i=0;ia[1]){last += \"U\";}\n if(b[1]a[0]){last += \"R\";}\n if(b[0]b[1]){last2 += \"U\";}\n if(c[1]b[0]){last2 += \"R\";}\n if(c[0] 0) {\n Console.WriteLine(\"LEFT\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d09ac78e21aa6de99b2e8bacea60b673", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\nclass Program{\n\tstatic void Main() {\n\t\tint[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tint[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tint[] c = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tlong[] v1 = new long[2]{b[0] - a[0], b[1] - a[1]};\n\t\tlong[] v2 = new long[2]{c[0] - b[0], c[1] - b[1]};\n\t\tlong product = (v1[0] * v2[1]) - (v1[1] * v2[0]);\n\t\tConsole.WriteLine(product);\n\t\tif(product == 0)\n\t\t\tConsole.WriteLine(\"TOWARDS\");\n\t\telse if(product > 0)\n\t\t\tConsole.WriteLine(\"LEFT\");\n\t\telse\n\t\t\tConsole.WriteLine(\"RIGHT\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8b451c4cb41b947749e70af344343f52", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _227A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] a = Console.ReadLine().Split(' ');\n string[] b = Console.ReadLine().Split(' ');\n string[] c = Console.ReadLine().Split(' ');\n\n int xa = Convert.ToInt32(a[0]);\n int ya = Convert.ToInt32(a[1]);\n int xb = Convert.ToInt32(b[0]);\n int yb = Convert.ToInt32(b[1]);\n int xc = Convert.ToInt32(c[0]);\n int yc = Convert.ToInt32(c[1]);\n\n int k = (xb - xa) * (yc - yb) - (xc - xb) * (yb - ya);\n\n if (k > 0) Console.WriteLine(\"LEFT\");\n else\n {\n if (k == 0) Console.WriteLine(\"TOWARDS\");\n else Console.WriteLine(\"RIGHT\");\n }\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f62773093e06308c60fbecd4d7bb52db", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\nclass Program{\n\tstatic void Main() {\n\t\tint[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tint[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tint[] c = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tint[] v1 = new int[2]{b[0] - a[0], b[1] - a[1]};\n\t\tint[] v2 = new int[2]{c[0] - b[0], c[1] - b[1]};\n\t\tint product = (v1[0] * v2[1]) - (v1[1] * v2[0]);\n\t\tif(product == 0)\n\t\t\tConsole.WriteLine(\"TOWARDS\");\n\t\telse if(product > 0)\n\t\t\tConsole.WriteLine(\"LEFT\");\n\t\telse\n\t\t\tConsole.WriteLine(\"RIGHT\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b774c84c8da8a2d60ca2ad76701b4a2", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n static void Main()\n {\n string[] a = Console.ReadLine().Split(' '),\n b = Console.ReadLine().Split(' '),\n c = Console.ReadLine().Split(' ');\n string k = Solver(Int32.Parse(a[0]), Int32.Parse(a[1]), Int32.Parse(b[0]),\n Int32.Parse(b[1]), Int32.Parse(c[0]), Int32.Parse(c[1]));\n Console.WriteLine(k);\n }\n\n public static string Solver(int ax, int ay, int bx, int by, int cx, int cy)\n {\n \n\n int[,] mat = new int[3, 3] { { 1, 1, 1 }, { bx - ax, by - ay, 0 }, { cx - bx, cy - by, 0 } };\n int k = mat[1, 0] * mat[2, 1] - mat[1, 1] * mat[2, 0];\n if (k > 0) return \"LEFT\";\n if (k < 0) return \"RIGHT\";\n return \"TOWARDS\";\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "416d20eb29a06e857d5ee5b3a4343a0b", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R140_Div2_227A\n {\n static void Main(string[] args)\n {\n string[] s;\n s = (Console.ReadLine().Split());\n int ax = Convert.ToInt32(s[0]);\n int ay = Convert.ToInt32(s[1]);\n s = (Console.ReadLine().Split());\n int bx = Convert.ToInt32(s[0]);\n int by = Convert.ToInt32(s[1]);\n s = (Console.ReadLine().Split());\n int cx = Convert.ToInt32(s[0]);\n int cy = Convert.ToInt32(s[1]);\n\n int d = (cx - ax) * (by - ay) - (bx - ax) * (cy - ay);\n string ret;\n if (d == 0)\n ret = \"TOWARDS\";\n else if (d < 0)\n ret = \"LEFT\";\n else // d > 0\n ret = \"RIGHT\";\n Console.WriteLine(ret);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "daeba87d6b27c111679f7f834151b93c", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "// Just split the path string and apply the changes.\n\nusing System;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n long x1 = 0, y1 = 0, x2 = 0, y2 = 0, x3 = 0, y3 = 0;\n string buf = Console.ReadLine();\n string[] vals = buf.Split(' ');\n x1 = Convert.ToInt32(vals[0]);\n y1 = Convert.ToInt32(vals[1]);\n\n buf = Console.ReadLine();\n vals = buf.Split(' ');\n x2 = Convert.ToInt32(vals[0]);\n y2 = Convert.ToInt32(vals[1]);\n\n buf = Console.ReadLine();\n vals = buf.Split(' ');\n x3 = Convert.ToInt32(vals[0]);\n y3 = Convert.ToInt32(vals[1]);\n\n long crs = (x2-x1)*(y3-y2)-(y2-y1)*(x3-x2);\n if(crs == 0) {\n Console.WriteLine(\"TOWARDS\");\n }\n else if(crs < 0) {\n Console.WriteLine(\"RIGHT\");\n }\n else if(crs > 0) {\n Console.WriteLine(\"LEFT\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d2bdf6eab866c23b795f6343da296db", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "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 Int64 x1, y1, x2, y2, x3, y3, d;\n\n string[] inp = null;\n\n inp = Console.ReadLine().ToString().Split(' ');\n x1 = Convert.ToInt64(inp[0]);\n y1 = Convert.ToInt64(inp[1]);\n\n inp = Console.ReadLine().ToString().Split(' ');\n x2 = Convert.ToInt64(inp[0]);\n y2 = Convert.ToInt64(inp[1]);\n\n inp = Console.ReadLine().ToString().Split(' ');\n x3 = Convert.ToInt64(inp[0]);\n y3 = Convert.ToInt64(inp[1]);\n\n d = (x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1);\n\n if(d==0)\n Console.WriteLine(\"TOWARDS\");\n else if (d < 0)\n Console.WriteLine(\"LEFT\");\n else\n Console.WriteLine(\"RIGHT\");\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "44c14f9f292c27dc42b578cb2ad0ed14", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n static void Main()\n {\n string[] a = Console.ReadLine().Split(' '),\n b = Console.ReadLine().Split(' '),\n c = Console.ReadLine().Split(' ');\n string k = Solver(Int32.Parse(a[0]), Int32.Parse(a[1]), Int32.Parse(b[0]),\n Int32.Parse(b[1]), Int32.Parse(c[0]), Int32.Parse(c[1]));\n Console.WriteLine(k);\n }\n\n public static string Solver(int ax, int ay, int bx, int by, int cx, int cy)\n {\n \n\n Int64[,] mat = new Int64[3, 3] { { 1, 1, 1 }, { bx - ax, by - ay, 0 }, { cx - bx, cy - by, 0 } };\n Int64 k = mat[1, 0] * mat[2, 1] - mat[1, 1] * mat[2, 0];\n if (k > 0) return \"LEFT\";\n if (k < 0) return \"RIGHT\";\n return \"TOWARDS\";\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1751014dfd279894972d248a78bff445", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProblemSet\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] a = Console.ReadLine().Split(' ');\n string[] b = Console.ReadLine().Split(' ');\n string[] c = Console.ReadLine().Split(' ');\n \n long ax = long.Parse(a[0]);\n long ay = long.Parse(a[1]);\n\n long bx = long.Parse(b[0]);\n long by = long.Parse(b[1]);\n\n long cx = long.Parse(c[0]);\n long cy = long.Parse(c[1]);\n\n long[] ab = { (bx - ax), (by - ay), 0 - 0 };\n long[] bc = { (cx - bx), (cy - by), 0 - 0 };\n\n long[] prVekt = { ab[1]*bc[2]-ab[2]*bc[1], ab[2]*bc[0]-ab[0]*bc[2], ab[0]*bc[1]-ab[1]*bc[0] };\n\n if (prVekt[2] > 0) \n {\n Console.WriteLine(\"LEFT\");\n }\n else if (prVekt[2] < 0)\n {\n Console.WriteLine(\"RIGHT\");\n }\n else\n {\n Console.WriteLine(\"TOWARDS\");\n }\n /* \n Console.WriteLine(Convert.ToString(prVekt[0]));\n Console.WriteLine(Convert.ToString(prVekt[1]));\n Console.WriteLine(Convert.ToString(prVekt[2])); */ \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b8c938a1b28510a0fe7b851241b51b96", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "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 long[] A = new long[] { GetInt(), GetInt() };\n long[] B = new long[] { GetInt(), GetInt() };\n long[] C = new long[] { GetInt(), GetInt() };\n\n long det = A[0] * B[1] - A[1] * B[0] + A[1] * C[0] - A[0] * C[1] + B[0] * C[1] - B[1] * C[0];\n if (det == 0)\n Wl(\"TOWARDS\");\n else if (det > 0)\n Wl(\"LEFT\");\n else\n Wl(\"RIGHT\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8606c7c2b4c3a7365b082a15d38f8e49", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "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) - 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 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 = 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 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 PointInt[] p = new PointInt[3];\n for (int i = 0; i < 3; i++)\n {\n Reader.ReadLong(out p[i].X, out p[i].Y);\n }\n\n long res = Geometry.VectInt(p[1], p[0], p[2]);\n\n if (res == 0)\n {\n Console.WriteLine(\"TOWARDS\");\n return;\n }\n\n if (res < 0)\n {\n Console.WriteLine(\"LEFT\");\n return;\n }\n\n Console.WriteLine(\"RIGHT\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0c83347aa7cddba1bb4d1aa1a351c00d", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "MS 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 long xA, yA, xB, yB, xC, yC;\n string str;\n string[] split = new string [2];\n str = Console.ReadLine();\n split= str.Split();\n xA = Convert.ToInt64(split[0]); yA = Convert.ToInt64(split[1]);\n str = Console.ReadLine();\n split = str.Split();\n xB = Convert.ToInt64(split[0]); yB = Convert.ToInt64(split[1]);\n str = Console.ReadLine();\n split = str.Split();\n xC = Convert.ToInt64(split[0]); yC = Convert.ToInt64(split[1]);\n\n if ((xB - xA) * (yC - yA) == (xC - xA) * (yB - yA))\n Console.WriteLine(\"TOWARDS\");\n else\n if ((xC - xA) * (yB - yA) - (xB - xA) * (yC - yA) > 0)\n Console.WriteLine(\"RIGHT\");\n else Console.WriteLine(\"LEFT\");\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9a430053fcb3329490d8f247710e9513", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\nclass Program{\n\tstatic void Main() {\n\t\tint[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tint[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tint[] c = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tlong[] v1 = new long[2]{b[0] - a[0], b[1] - a[1]};\n\t\tlong[] v2 = new long[2]{c[0] - b[0], c[1] - b[1]};\n\t\tlong product = (v1[0] * v2[1]) - (v1[1] * v2[0]);\n\t\t\n\t\tif(product == 0)\n\t\t\tConsole.WriteLine(\"TOWARDS\");\n\t\telse if(product > 0)\n\t\t\tConsole.WriteLine(\"LEFT\");\n\t\telse\n\t\t\tConsole.WriteLine(\"RIGHT\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d51c2ab9a422569c36e8e64235c24e0f", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R140_Div2_A\n {\n static void Main(string[] args)\n {\n string[] s;\n s = (Console.ReadLine().Split());\n long ax = Convert.ToInt64(s[0]);\n long ay = Convert.ToInt64(s[1]);\n s = (Console.ReadLine().Split());\n long bx = Convert.ToInt64(s[0]);\n long by = Convert.ToInt64(s[1]);\n s = (Console.ReadLine().Split());\n long cx = Convert.ToInt64(s[0]);\n long cy = Convert.ToInt64(s[1]);\n\n long d = (cx - ax) * (by - ay) - (bx - ax) * (cy - ay);\n string ret;\n if (d == 0)\n ret = \"TOWARDS\";\n else if (d < 0)\n ret = \"LEFT\";\n else // d > 0\n ret = \"RIGHT\";\n Console.WriteLine(ret);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "22e2627655007f9afa59473685181147", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var a = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();\n var b = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();\n var c = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();\n var a1 = Math.Atan2(b[1]-a[1],b[0]-a[0]);\n var a2 = Math.Atan2(c[1]-b[1],c[0]-b[0]);\n Func e = (x1,x2) => Math.Abs(x1-x2);\n var eF = e(a1,a2);\n var pi = Math.PI;\n var eR = Math.Min(e(a1,a2+pi/2) , e(a1,a2-1.5*pi));\n var eL = Math.Min(e(a1,a2-pi/2) , e(a1,a2+1.5*pi));\n if (eF < eL && eF < eR) Console.Write(\"TOWARDS\"); \n else Console.Write(eL < eR ? \"LEFT\" : \"RIGHT\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "973ac5bf128c126b9e822ab06bd3f285", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nclass test\n{\n static void Main()\n {\n int []a = new int [2];\n int []b = new int [2];\n int []c = new int [2]; \n \n string last = \"\";\n string last2 = \"\";\n \n for(int i=0;i<3;i++)\n {\n string []tmp = Console.ReadLine().Split();\n if(i == 0)\n {\n a[0] = int.Parse(tmp[0]);\n a[1] = int.Parse(tmp[1]);\n }\n if(i == 1)\n {\n b[0] = int.Parse(tmp[0]);\n b[1] = int.Parse(tmp[1]);\n }\n if(i == 2)\n {\n c[0] = int.Parse(tmp[0]);\n c[1] = int.Parse(tmp[1]);\n }\n }\n \n if(b[1]>a[1]){last += \"U\";}\n if(b[1]a[0]){last += \"R\";}\n if(b[0]b[1]){last2 += \"U\";}\n if(c[1]b[0]){last2 += \"R\";}\n if(c[0] 0)\n writer.WriteLine(\"LEFT\");\n else\n {\n writer.WriteLine(\"RIGHT\");\n }\n }\n\n writer.Flush();\n }\n\n private static long Mult(Point a, Point b)\n {\n return a.x*b.x + a.y*b.y;\n }\n\n private static Point Minus(Point a, Point b)\n {\n return new Point(b.x - a.x, b.y - a.y);\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\n {\n public readonly long x;\n public readonly long y;\n\n public Point(long x, long y)\n {\n this.x = x;\n this.y = y;\n }\n }\n\n #endregion\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "61cfdb0ae1e3693bbc7568a178bdc4f4", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "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[,] xyz = new double[3, 2];\n string[] input;\n for (int i = 0; i < 3; i++)\n {\n input = Console.ReadLine().Split(' ');\n xyz[i, 0] = double.Parse(input[0]);\n xyz[i, 1] = double.Parse(input[1]);\n }\n\n for (int i = 1; i < 3; i++)\n for (int j = 0; j < 2; j++)\n xyz[i, j] -= xyz[0, j];\n xyz[0, 0] = xyz[0, 1] = 0;\n\n double[] c = new double[2];\n c[0] = -1 * xyz[1, 1];\n c[1] = xyz[1, 0];\n\n if (c[0] * xyz[1, 0] + xyz[1, 1] * c[1] == 0 && c[0] * xyz[2, 0] + c[1] * xyz[2, 1] == 0) { Console.WriteLine(\"TOWARDS\"); return; }\n double fi = 0.0;\n if (xyz[1, 0] >= 0 && xyz[1, 1] > 0)\n fi = Math.Acos(xyz[1, 1] / Math.Pow(xyz[1, 0] * xyz[1, 0] + xyz[1, 1] * xyz[1, 1], 0.5));\n if (xyz[1, 0] > 0 && xyz[1, 1] <= 0)\n fi = Math.PI / 2.0 + Math.Acos(xyz[1, 0] / Math.Pow(xyz[1, 0] * xyz[1, 0] + xyz[1, 1] * xyz[1, 1], 0.5));\n if (xyz[1, 0] <= 0 && xyz[1, 1] < 0)\n fi = Math.PI + Math.Acos(-1 * xyz[1, 1] / Math.Pow(xyz[1, 0] * xyz[1, 0] + xyz[1, 1] * xyz[1, 1], 0.5));\n if (xyz[1, 0] < 0 && xyz[1, 1] >= 0)\n fi = Math.PI * 3.0 / 2.0 + Math.Acos(-1 * xyz[1, 0] / Math.Pow(xyz[1, 0] * xyz[1, 0] + xyz[1, 1] * xyz[1, 1], 0.5));\n\n\n double x, y;\n for (int i = 0; i < 3; i++)\n {\n x = xyz[i, 0];\n y = xyz[i, 1];\n xyz[i, 0] = x * Math.Cos(fi) - y * Math.Sin(fi);\n xyz[i, 1] = y * Math.Cos(fi) + x * Math.Sin(fi);\n }\n\n if (xyz[1, 0] < xyz[2, 0])\n Console.WriteLine(\"RIGHT\");\n if (xyz[1, 0] > xyz[2, 0])\n Console.WriteLine(\"LEFT\");\n Console.ReadLine();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7f705a5406f45ff37b6a83f15823d6ba", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] start = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n int[] pos = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n int[] end = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n\n double r = findSide(start[0], start[1], pos[0], pos[1], end[0], end[1]);\n\n if(r == 0)\n Console.WriteLine(\"TOWARDS\");\n else if(r < 0)\n Console.WriteLine(\"RIGHT\");\n else if(r > 0)\n Console.WriteLine(\"LEFT\");\n }\n\n public static double findSide(\n double ax, double ay,\n double bx, double by,\n double cx, double cy)\n {\n return ((bx - ax) * (cy - ay) - (by - ay) * (cx - ax));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9080dcb54f34dd970fca45e38ede4860", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _227A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] a = Console.ReadLine().Split(' ');\n string[] b = Console.ReadLine().Split(' ');\n string[] c = Console.ReadLine().Split(' ');\n\n long xa = Convert.ToInt64(a[0]);\n long ya = Convert.ToInt64(a[1]);\n long xb = Convert.ToInt64(b[0]);\n long yb = Convert.ToInt64(b[1]);\n long xc = Convert.ToInt64(c[0]);\n long yc = Convert.ToInt64(c[1]);\n\n long k = (xb - xa) * (yc - yb) - (xc - xb) * (yb - ya);\n\n if (k > 0) Console.WriteLine(\"LEFT\");\n else\n {\n if (k == 0) Console.WriteLine(\"TOWARDS\");\n else Console.WriteLine(\"RIGHT\");\n }\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c0ec3b78434635714e90e731951d85b1", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "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 = new int[] { GetInt(), GetInt() };\n int[] B = new int[] { GetInt(), GetInt() };\n int[] C = new int[] { GetInt(), GetInt() };\n\n int det = A[0] * B[1] - A[1] * B[0] + A[1] * C[0] - A[0] * C[1] + B[0] * C[1] - B[1] * C[0];\n if (det == 0)\n Wl(\"TOWARDS\");\n else if (det > 0)\n Wl(\"LEFT\");\n else\n Wl(\"RIGHT\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ccd8b87be149a63f3b32aed344f0bc17", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "// Just split the path string and apply the changes.\n\nusing System;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n long x1 = 0, y1 = 0, x2 = 0, y2 = 0, x3 = 0, y3 = 0;\n string buf = Console.ReadLine();\n string[] vals = buf.Split(' ');\n x1 = Convert.ToInt32(vals[0]);\n y1 = Convert.ToInt32(vals[1]);\n\n buf = Console.ReadLine();\n vals = buf.Split(' ');\n x2 = Convert.ToInt32(vals[0]);\n y2 = Convert.ToInt32(vals[1]);\n\n buf = Console.ReadLine();\n vals = buf.Split(' ');\n x3 = Convert.ToInt32(vals[0]);\n y3 = Convert.ToInt32(vals[1]);\n\n int crs = (x2-x1)*(y3-y2)-(y2-y1)*(x3-x2);\n if(crs == 0) {\n Console.WriteLine(\"TOWARDS\");\n }\n else if(crs < 0) {\n Console.WriteLine(\"RIGHT\");\n }\n else if(crs > 0) {\n Console.WriteLine(\"LEFT\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4489c4b214e3cc494fbab232318af814", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskD\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[] nmk = instream.ReadIntArray();\n int n = nmk[0];\n int m = nmk[1];\n int k = nmk[2];\n\n int[] r = new int[n];\n int[] g = new int[n];\n\n bool rfree = false;\n bool gfree = false;\n\n for (int i = 0; i < n; i++)\n {\n string line = instream.ReadLine();\n\n int rpos = -1;\n int gpos = -1;\n\n int rcnt = 0;\n int gcnt = 0;\n for (int j = 0; j < line.Length; j++)\n {\n if (line[j] == 'R') { rpos = j; rcnt++; }\n if (line[j] == 'G') { gpos = j; gcnt++; }\n }\n\n if (rpos < 0 && (gpos >= 0 && (gcnt==1 || m>2)))\n gfree = true;\n else if ((rpos >= 0 && (rcnt==1 || m>2)) && gpos < 0)\n rfree = true;\n else\n {\n if (gpos>=0 && rpos>=0 && gpos > rpos)\n {\n gpos = m - gpos - 1;\n rpos = m - rpos - 1;\n }\n }\n r[i] = rpos;\n g[i] = gpos;\n }\n\n if (m == 1)\n {\n outstream.WriteLine(\"Second\");\n return;\n }\n\n if (rfree && gfree)\n {\n outstream.WriteLine(\"Draw\");\n return;\n }\n if (gfree)\n {\n outstream.WriteLine(\"First\");\n return;\n }\n if (rfree)\n {\n outstream.WriteLine(\"Second\");\n return;\n }\n\n int odd = 0;\n for (int i = 0; i < n; i++)\n {\n if (r[i] >= 0 && g[i] >= 0)\n {\n int dist = r[i] - g[i] - 1;\n\n if (dist % 2 == 1) odd++;\n }\n }\n\n if (odd % (k + 1) != 0)\n outstream.WriteLine(\"First\");\n else\n outstream.WriteLine(\"Second\");\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc60ea094083e7a21ebef20f1b9554a9", "src_uid": "69062f7c9b834e925ab23ebc2da96b52", "difficulty": 2600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskD\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[] nmk = instream.ReadIntArray();\n int n = nmk[0];\n int m = nmk[1];\n int k = nmk[2];\n\n int[] r = new int[n];\n int[] g = new int[n];\n\n bool rfree = false;\n bool gfree = false;\n\n for (int i = 0; i < n; i++)\n {\n string line = instream.ReadLine();\n\n int rpos = -1;\n int gpos = -1;\n for (int j = 0; j < line.Length; j++)\n {\n if (line[j] == 'R') rpos = j;\n if (line[j] == 'G') gpos = j;\n }\n\n if (rpos < 0 && gpos >= 0)\n gfree = true;\n else if (rpos >= 0 && gpos < 0)\n rfree = true;\n else\n {\n if (gpos > rpos)\n {\n gpos = m - gpos - 1;\n rpos = m - rpos - 1;\n }\n }\n r[i] = rpos;\n g[i] = gpos;\n }\n\n if (m == 1)\n {\n outstream.WriteLine(\"Second\");\n return;\n }\n\n if (rfree && gfree)\n {\n outstream.WriteLine(\"Draw\");\n return;\n }\n if (gfree)\n {\n outstream.WriteLine(\"First\");\n return;\n }\n if (rfree)\n {\n outstream.WriteLine(\"Second\");\n return;\n }\n\n int odd = 0;\n for (int i = 0; i < n; i++)\n {\n if (r[i] >= 0 && g[i] >= 0)\n {\n int dist = r[i] - g[i] - 1;\n\n if (dist % 2 == 1) odd++;\n }\n }\n\n if (odd % (k + 1) != 0)\n outstream.WriteLine(\"First\");\n else\n outstream.WriteLine(\"Second\");\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2ff230256856395ec563befc58dd5e2b", "src_uid": "69062f7c9b834e925ab23ebc2da96b52", "difficulty": 2600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskD\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\n int[] nmk = instream.ReadIntArray();\n int n = nmk[0];\n int m = nmk[1];\n int k = nmk[2];\n\n int[] r = new int[n];\n int[] g = new int[n];\n\n bool rfree = false;\n bool gfree = false;\n\n for (int i = 0; i < n; i++)\n {\n string line = instream.ReadLine();\n\n int rpos = -1;\n int gpos = -1;\n\n int rcnt = 0;\n int gcnt = 0;\n for (int j = 0; j < line.Length; j++)\n {\n if (line[j] == 'R') { rpos = j; rcnt++; }\n if (line[j] == 'G') { gpos = j; gcnt++; }\n }\n\n if (rpos < 0 && (gpos >= 0 && (gcnt==1 || m>2)))\n gfree = true;\n else if ((rpos >= 0 && (rcnt==1 || m>2)) && gpos < 0)\n rfree = true;\n else\n {\n if (gpos>=0 && rpos>=0 && gpos > rpos)\n {\n gpos = m - gpos - 1;\n rpos = m - rpos - 1;\n }\n }\n r[i] = rpos;\n g[i] = gpos;\n }\n\n if (m == 1)\n {\n outstream.WriteLine(\"Second\");\n return;\n }\n\n if (rfree && gfree)\n {\n outstream.WriteLine(\"Draw\");\n return;\n }\n if (gfree)\n {\n outstream.WriteLine(\"First\");\n return;\n }\n if (rfree)\n {\n outstream.WriteLine(\"Second\");\n return;\n }\n\n for (int test = 0; test < 7; test++)\n {\n int odd = 0;\n for (int i = 0; i < n; i++)\n {\n if (r[i] >= 0 && g[i] >= 0)\n {\n int dist = r[i] - g[i] - 1;\n\n if ((dist>>test) % 2 == 1) odd++;\n }\n }\n\n if (odd % (k + 1) != 0)\n {\n outstream.WriteLine(\"First\");\n return;\n }\n \n }\n outstream.WriteLine(\"Second\");\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "68ea8740d193979519f580b2848dfc1d", "src_uid": "69062f7c9b834e925ab23ebc2da96b52", "difficulty": 2600.0} {"lang": "Mono C#", "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 class Edge\n {\n public int To, Inv;\n public T Capacity;\n public Edge(int to, int inv, T capacity)\n {\n To = to;\n Inv = inv;\n Capacity = capacity;\n }\n }\n\n static void AddEdge(List>[] g, int from, int to, T capacity, bool directed = true)\n {\n g[from].Add(new Edge(to, g[to].Count, capacity));\n g[to].Add(new Edge(from, g[from].Count - 1, directed ? default(T) : capacity));\n }\n\n static class Flow\n {\n private static int[] level;\n private static int[] ptr;\n private static int n, source, sink;\n private static List>[] g;\n\n public static long Find(List>[] g, int source, int sink)\n {\n n = g.Length;\n level = new int[n];\n ptr = new int[n];\n Flow.g = g;\n Flow.source = source;\n Flow.sink = sink;\n\n long ret = 0;\n while (true)\n {\n Bfs();\n if (level[sink] < 0)\n return ret;\n Array.Clear(ptr, 0, n);\n long f;\n while ((f = Dfs(source, int.MaxValue / 2)) > 0)\n ret += f;\n }\n }\n\n static void Bfs()\n {\n for (int i = 0; i < n; i++)\n level[i] = -1;\n var q = new Queue();\n level[source] = 0;\n q.Enqueue(source);\n while (q.Count > 0)\n {\n var v = q.Dequeue();\n foreach (var e in g[v])\n if (e.Capacity > 0 && level[e.To] < 0)\n {\n level[e.To] = level[v] + 1;\n q.Enqueue(e.To);\n }\n }\n }\n\n static long Dfs(int v, long f)\n {\n if (v == sink)\n return f;\n for (; ptr[v] < g[v].Count; ptr[v]++)\n {\n var e = g[v][ptr[v]];\n if (e.Capacity <= 0 || level[v] >= level[e.To])\n continue;\n long d = Dfs(e.To, Math.Min(f, e.Capacity));\n if (d <= 0)\n continue;\n e.Capacity -= d;\n g[e.To][e.Inv].Capacity += d;\n return d;\n }\n return 0;\n }\n }\n\n public void Solve()\n {\n for (int tt = ReadInt(); tt > 0; tt--)\n {\n int n = ReadInt();\n var a = ReadIntArray();\n var b = ReadIntArray();\n\n long ans = 1L * Math.Min(a[0], b[1]) + Math.Min(a[1], b[2]) + Math.Min(a[2], b[0]);\n var g = Init>>(8);\n for (int i = 0; i < 3; i++)\n {\n AddEdge(g, 6, i, a[i]);\n AddEdge(g, i + 3, 7, b[i]);\n for (int j = 0; j < 2; j++)\n AddEdge(g, i, (i + 2 + j) % 3 + 3, long.MaxValue);\n }\n\n Write(a.Sum(aa => (long)aa) - Flow.Find(g, 6, 7), ans);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dad0881b22f99d5b872df2504331abb2", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Math;\n\nclass E\n{\n\tstatic int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();\n\tstatic void Main()\n\t{\n\t\tvar n = int.Parse(Console.ReadLine());\n\t\tvar a = Read();\n\t\tvar b = Read();\n\n\t\tvar max = Min(a[0], b[1]) + Min(a[1], b[2]) + Min(a[2], b[0]);\n\n\t\tvar dg = new List();\n\t\tvar sv = 6;\n\t\tvar ev = 7;\n\t\tfor (long i = 0; i < 3; i++)\n\t\t{\n\t\t\tdg.Add(new[] { sv, i, a[i] });\n\t\t\tdg.Add(new[] { 3 + i, ev, b[i] });\n\t\t}\n\t\tdg.Add(new[] { 0L, 3, Min(a[0], b[0]) });\n\t\tdg.Add(new[] { 1L, 4, Min(a[1], b[1]) });\n\t\tdg.Add(new[] { 2L, 5, Min(a[2], b[2]) });\n\t\tdg.Add(new[] { 0L, 5, Min(a[0], b[2]) });\n\t\tdg.Add(new[] { 1L, 3, Min(a[1], b[0]) });\n\t\tdg.Add(new[] { 2L, 4, Min(a[2], b[1]) });\n\n\t\tvar min = n - MaxFlow(ev, sv, ev, dg.ToArray());\n\t\tConsole.WriteLine($\"{min} {max}\");\n\t}\n\n\t// dg: { from, to, capacity }\n\tstatic long MaxFlow(int n, int sv, int ev, long[][] dg)\n\t{\n\t\tvar map = Array.ConvertAll(new int[n + 1], _ => new List());\n\t\tforeach (var e in dg)\n\t\t{\n\t\t\tmap[e[0]].Add(new[] { e[0], e[1], e[2], map[e[1]].Count });\n\t\t\tmap[e[1]].Add(new[] { e[1], e[0], 0, map[e[0]].Count - 1 });\n\t\t}\n\n\t\tlong Bfs()\n\t\t{\n\t\t\tvar from = new long[n + 1][];\n\t\t\tvar minFlow = new long[n + 1];\n\t\t\tArray.Fill(minFlow, long.MaxValue);\n\t\t\tvar q = new Queue();\n\t\t\tq.Enqueue(sv);\n\n\t\t\twhile (q.TryDequeue(out var v))\n\t\t\t{\n\t\t\t\tif (v == ev) break;\n\t\t\t\tforeach (var e in map[v])\n\t\t\t\t{\n\t\t\t\t\tif (from[e[1]] != null || e[2] == 0) continue;\n\t\t\t\t\tfrom[e[1]] = e;\n\t\t\t\t\tminFlow[e[1]] = Math.Min(minFlow[v], e[2]);\n\t\t\t\t\tq.Enqueue(e[1]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (from[ev] == null) return 0;\n\t\t\tfor (long v = ev; v != sv; v = from[v][0])\n\t\t\t{\n\t\t\t\tvar e = from[v];\n\t\t\t\te[2] -= minFlow[ev];\n\t\t\t\tmap[e[1]][(int)e[3]][2] += minFlow[ev];\n\t\t\t}\n\t\t\treturn minFlow[ev];\n\t\t}\n\n\t\tlong M = 0, t;\n\t\twhile ((t = Bfs()) > 0) M += t;\n\t\treturn M;\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "58d4d8e37b0535b18850fa09d88f09e9", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\n\nnamespace CodeForces.ProblemE\n{\n class Program\n {\n /*\n 319\n 10 53 256\n 182 103 34\n\n 119 226\n */\n static void Main(string[] args)\n {\n int maxWin = 0;\n int minWin = 0;\n int rounds = int.Parse(Console.ReadLine());\n string[] patternAnya = Console.ReadLine().Split(' ');\n string[] patternBorya = Console.ReadLine().Split(' ');\n Player anya = new Player(patternAnya);\n Player borya = new Player(patternBorya);\n\n if (anya.Rock >= borya.Scissor)\n maxWin += borya.Scissor;\n else\n maxWin += anya.Rock;\n\n if (anya.Scissor >= borya.Paper)\n maxWin += borya.Paper;\n else\n maxWin += anya.Scissor;\n\n if (anya.Paper >= borya.Rock)\n maxWin += borya.Rock;\n else\n maxWin += anya.Paper;\n\n if (anya.Rock > borya.Paper + borya.Rock && borya.Scissor != 0)\n if (anya.Rock - (borya.Paper + borya.Rock) < borya.Scissor)\n minWin += anya.Rock - borya.Paper - borya.Rock;\n else\n minWin += borya.Scissor;\n\n if (anya.Scissor > borya.Rock + borya.Scissor && borya.Paper != 0)\n if (anya.Scissor - (borya.Rock + borya.Scissor) < borya.Paper)\n minWin += anya.Scissor - borya.Rock - borya.Scissor;\n else\n minWin += borya.Paper;\n\n if (anya.Paper > borya.Scissor + borya.Paper && borya.Rock != 0)\n if (anya.Paper - (borya.Scissor + borya.Paper) < borya.Rock)\n minWin += anya.Paper - borya.Scissor - borya.Paper;\n else\n minWin += borya.Rock;\n\n Console.WriteLine(minWin);\n Console.WriteLine(maxWin);\n }\n\n public struct Player\n {\n public int Rock;\n public int Paper;\n public int Scissor;\n\n public Player(string[] pattern)\n {\n Rock = int.Parse(pattern[0]);\n Scissor = int.Parse(pattern[1]);\n Paper = int.Parse(pattern[2]);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f07490f53c572f7fe0125f8602d4682c", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1426E\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n int[] alice = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] Bob = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n //most wins\n int mostWins = 0;\n mostWins += Math.Min(alice[0], Bob[1]);\n mostWins += Math.Min(alice[1], Bob[2]);\n mostWins += Math.Min(alice[2], Bob[0]);\n\n //least wins\n List aliceDistribution = new List()\n { new int[3] { 0, 0, 0 }, new int[3] { 0, 0, 0 }, new int[3] { 0, 0, 0 } };\n\n for (int a = 0; a < alice.Length; a++)\n {\n for (int b = 0; b < Bob.Length; b++)\n {\n if ((a + b) % alice.Length == (a + 1) % alice.Length)\n continue;\n int c = Math.Min(Bob[(a + b) % alice.Length], alice[a]);\n alice[a] -= c;\n Bob[(a + b) % alice.Length] -= c;\n aliceDistribution[a][(a + b) % alice.Length] += c;\n }\n\n if (alice[a] > 0)\n {\n for (int a2 = 0; a2 < alice.Length; a2++)\n {\n if (a2 == a)\n continue;\n for (int ad = 0; ad < aliceDistribution.Count; ad++)\n {\n if (ad == (a + 1) % alice.Length)\n continue;\n\n int c = Math.Min(alice[a], aliceDistribution[a2][ad]);\n alice[a] -= c;\n aliceDistribution[a2][ad] -= c;\n aliceDistribution[a2][(a + 1) % alice.Length] += c;\n }\n }\n }\n }\n\n int leastWins = 0;\n foreach (var item in alice)\n leastWins += item;\n\n Console.WriteLine(leastWins + \" \" + mostWins);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "53f9c621c226be99b5a036f8dd0e69dd", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "Mono C#", "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 class Edge\n {\n public int To, Inv;\n public T Capacity;\n public Edge(int to, int inv, T capacity)\n {\n To = to;\n Inv = inv;\n Capacity = capacity;\n }\n }\n\n static void AddEdge(List>[] g, int from, int to, T capacity, bool directed = true)\n {\n g[from].Add(new Edge(to, g[to].Count, capacity));\n g[to].Add(new Edge(from, g[from].Count - 1, directed ? default(T) : capacity));\n }\n\n static class Flow\n {\n private static int[] level;\n private static int[] ptr;\n private static int n, source, sink;\n private static List>[] g;\n\n public static long Find(List>[] g, int source, int sink)\n {\n n = g.Length;\n level = new int[n];\n ptr = new int[n];\n Flow.g = g;\n Flow.source = source;\n Flow.sink = sink;\n\n long ret = 0;\n while (true)\n {\n Bfs();\n if (level[sink] < 0)\n return ret;\n Array.Clear(ptr, 0, n);\n long f;\n while ((f = Dfs(source, int.MaxValue / 2)) > 0)\n ret += f;\n }\n }\n\n static void Bfs()\n {\n for (int i = 0; i < n; i++)\n level[i] = -1;\n var q = new Queue();\n level[source] = 0;\n q.Enqueue(source);\n while (q.Count > 0)\n {\n var v = q.Dequeue();\n foreach (var e in g[v])\n if (e.Capacity > 0 && level[e.To] < 0)\n {\n level[e.To] = level[v] + 1;\n q.Enqueue(e.To);\n }\n }\n }\n\n static long Dfs(int v, long f)\n {\n if (v == sink)\n return f;\n for (; ptr[v] < g[v].Count; ptr[v]++)\n {\n var e = g[v][ptr[v]];\n if (e.Capacity <= 0 || level[v] >= level[e.To])\n continue;\n long d = Dfs(e.To, Math.Min(f, e.Capacity));\n if (d <= 0)\n continue;\n e.Capacity -= d;\n g[e.To][e.Inv].Capacity += d;\n return d;\n }\n return 0;\n }\n }\n\n public void Solve()\n {\n for (int tt = 1; tt > 0; tt--)\n {\n int n = ReadInt();\n var a = ReadIntArray();\n var b = ReadIntArray();\n\n long ans = 1L * Math.Min(a[0], b[1]) + Math.Min(a[1], b[2]) + Math.Min(a[2], b[0]);\n var g = Init>>(8);\n for (int i = 0; i < 3; i++)\n {\n AddEdge(g, 6, i, a[i]);\n AddEdge(g, i + 3, 7, b[i]);\n for (int j = 0; j < 2; j++)\n AddEdge(g, i, (i + 2 + j) % 3 + 3, long.MaxValue);\n }\n\n Write(a.Sum(aa => (long)aa) - Flow.Find(g, 6, 7), ans);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "27ecac59429f60dc9ecc304f1265c510", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "Mono C#", "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.Codeforces._1426\n{\n class E\n {\n static void Main(string[] args)\n {\n var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };\n SetOut(sw);\n\n Method(args);\n\n Out.Flush();\n }\n\n static void Method(string[] args)\n {\n int n = ReadInt();\n int[] arrayA = ReadInts();\n int[] arrayB = ReadInts();\n\n int[][] pats = new int[6][];\n pats[0] = new int[3] { 0, 1, 2 };\n pats[1] = new int[3] { 0, 2, 1 };\n pats[2] = new int[3] { 1, 0, 2 };\n pats[3] = new int[3] { 1, 2, 0 };\n pats[4] = new int[3] { 2, 0, 1 };\n pats[5] = new int[3] { 2, 1, 0 };\n\n int min = int.MaxValue;\n int max = 0;\n for(int i = 0; i < 6; i++)\n {\n for(int j = 0; j < 6; j++)\n {\n int cnt = 0;\n int[] tmpA = new int[3] { arrayA[0], arrayA[1], arrayA[2] };\n int[] tmpB = new int[3] { arrayB[0], arrayB[1], arrayB[2] };\n for (int x = 0; x < 3; x++)\n {\n for(int y = 0; y < 3; y++)\n {\n int common = Min(tmpA[pats[i][x]], tmpB[pats[j][y]]);\n tmpA[pats[i][x]] -= common;\n tmpB[pats[j][y]] -= common;\n if ((pats[i][x] + 1) % 3 == pats[j][y])\n {\n cnt += common;\n }\n }\n }\n min = Min(min, cnt);\n max = Max(max, cnt);\n }\n }\n\n /*\n int min = 0;\n {\n int[] tmpA = new int[3] { arrayA[0], arrayA[1], arrayA[2] };\n int[] tmpB = new int[3] { arrayB[0], arrayB[1], arrayB[2] };\n for(int i = 0; i < 3; i++)\n {\n int common = Min(tmpA[i], tmpB[(i + 2) % 3]);\n tmpA[i] -= common;\n tmpB[(i + 2) % 3] -= common;\n }\n for(int i = 0; i < 3; i++)\n {\n int common = Min(tmpA[i], tmpB[i]);\n tmpA[i] -= common;\n tmpB[i] -= common;\n }\n for(int i = 0; i < 3; i++)\n {\n min += tmpA[i];\n }\n }\n\n int max = 0;\n {\n for (int i = 0; i < 3; i++)\n {\n max+= Min(arrayA[i], arrayB[(i +1) % 3]);\n }\n }\n */\n\n WriteLine(min + \" \" + max);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9713cfbe21d62f0a16dcb0c1459e3bc2", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Rock__Paper__Scissors\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 int n = Next();\n var a = new[] {Next(), Next(), Next()};\n var b = new[] {Next(), Next(), Next()};\n\n int min = Math.Max(0, a[0] - b[0] - b[2]) + Math.Max(0, a[1] - b[1] - b[0]) + Math.Max(0, a[2] - b[1] - b[2]);\n\n int max = Math.Min(a[0], b[1]) + Math.Min(a[1], b[2]) + Math.Min(a[2], b[0]);\n\n writer.Write(min);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "559b5068c40d61df7a11dc184c91aa24", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": ".NET Core C#", "source_code": "using Microsoft.Win32.SafeHandles;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Xml.Schema;\n\npublic static class Ex\n{\n public static bool IsNullOrEmpty(this string s) { return string.IsNullOrEmpty(s); }\n public static void yesno(this bool b) => Console.WriteLine(b ? \"yes\" : \"no\");\n public static void YesNo(this bool b) => Console.WriteLine(b ? \"Yes\" : \"No\");\n public static void YESNO(this bool b) => Console.WriteLine(b ? \"YES\" : \"NO\");\n //[MethodImpl(MethodImplOptions.AggressiveInlining)]\n //public static bool Chmax(ref this T a, T b) where T : struct, IComparable\n //{\n // if (b.CompareTo(a) > 0) { a = b; return true; }\n // else return false;\n //}\n //[MethodImpl(MethodImplOptions.AggressiveInlining)]\n //public static bool Chmin(ref this T a, T b) where T : struct, IComparable\n //{\n // if (b.CompareTo(a) < 0) { a = b; return true; }\n // else return false;\n //}\n\n public static List FastSort(this List s) { s.Sort(StringComparer.OrdinalIgnoreCase); return s.ToList(); }\n\n public static int PopCount(this uint bits)\n {\n bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);\n bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);\n bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);\n bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);\n return (int)((bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff));\n }\n}\n\n\n\npartial class Program\n{\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string GetStr() { return Console.ReadLine().Trim(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char GetChar() { return Console.ReadLine().Trim()[0]; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int GetInt() { return int.Parse(Console.ReadLine().Trim()); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long GetLong() { return long.Parse(Console.ReadLine().Trim()); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n double GetDouble() { return double.Parse(Console.ReadLine().Trim()); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string[] GetStrArray() { return Console.ReadLine().Trim().Split(' '); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string[][] GetStrArray(int N)\n {\n var res = new string[N][];\n for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ');\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int[] GetIntArray() { return Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int[][] GetIntArray(int N)\n {\n var res = new int[N][];\n for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long[] GetLongArray() { return Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long[][] GetLongArray(int N)\n {\n var res = new long[N][];\n for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char[] GetCharArray() { return Console.ReadLine().Trim().Split(' ').Select(char.Parse).ToArray(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n double[] GetDoubleArray() { return Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n double[][] GetDoubleArray(int N)\n {\n var res = new double[N][];\n for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray();\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char[][] GetGrid(int H)\n {\n var res = new char[H][];\n for (int i = 0; i < H; i++) res[i] = Console.ReadLine().Trim().ToCharArray();\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n T[] CreateArray(int N, T value)\n {\n var res = new T[N];\n for (int i = 0; i < N; i++) res[i] = value;\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n T[][] CreateArray(int H, int W, T value)\n {\n var res = new T[H][];\n for (int i = 0; i < H; i++)\n {\n res[i] = new T[W];\n for (int j = 0; j < W; j++) res[i][j] = value;\n }\n return res;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n T[][][] CreateArray(int H, int W, int R, T value)\n {\n var res = new T[H][][];\n for (int i = 0; i < H; i++)\n {\n res[i] = new T[W][];\n for (int j = 0; j < W; j++)\n {\n res[i][j] = new T[R];\n for (int k = 0; k < R; k++) res[i][j][k] = value;\n }\n }\n return res;\n }\n\n Dictionary> GetUnweightedAdjacencyList(int N, int M, bool isDirected, bool isNode_0indexed)\n {\n var dic = new Dictionary>();\n foreach (var e in Enumerable.Range(0, N)) { dic.Add(e, new List()); }\n for (int i = 0; i < M; i++)\n {\n var input = GetIntArray();\n var a = isNode_0indexed ? input[0] : input[0] - 1;\n var b = isNode_0indexed ? input[1] : input[1] - 1;\n dic[a].Add(b);\n if (isDirected == false) dic[b].Add(a);\n }\n return dic;\n }\n //Dictionary> GetWeightedAdjacencyList(int N, int M, bool isDirected, bool isNode_0indexed)\n //{\n // var dic = new Dictionary>();\n // foreach (var e in Enumerable.Range(0, N)) { dic.Add(e, new List<(int, long)>()); }\n // for (int i = 0; i < M; i++)\n // {\n // var input = GetIntArray();\n // var a = isNode_0indexed ? input[0] : input[0] - 1;\n // var b = isNode_0indexed ? input[1] : input[1] - 1;\n // var c = input[2];\n // dic[a].Add((b, c));\n // if (isDirected == false) dic[b].Add((a, c));\n // }\n // return dic;\n //}\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool eq() => typeof(T).Equals(typeof(U));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n T ct(U a) => (T)Convert.ChangeType(a, typeof(T));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a) => a = cv(GetStr());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a, out U b)\n {\n var ar = GetStrArray(); a = cv(ar[0]); b = cv(ar[1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a, out U b, out V c)\n {\n var ar = GetStrArray(); a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a, out U b, out V c, out W d)\n {\n var ar = GetStrArray(); a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a, out U b, out V c, out W d, out X e)\n {\n var ar = GetStrArray(); a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]); e = cv(ar[4]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Multi(out T a, out U b, out V c, out W d, out X e, out Y f)\n {\n var ar = GetStrArray(); 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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Output(T t) => Console.WriteLine(t);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Output(IList ls) => Console.WriteLine(string.Join(\" \", ls));\n void Debug(IList> ls)\n {\n foreach (var l in ls)\n foreach (var s in l)\n Console.WriteLine(s);\n }\n\n\n void Swap(ref T a, ref T b) { T temp = a; a = b; b = temp; }\n\n int[] dx = new int[] { 1, 0, -1, 0, 1, -1, -1, 1 };\n int[] dy = new int[] { 0, 1, 0, -1, 1, 1, -1, -1 };\n long mod = 1000000007;\n}\n\n\n\n\n\n\npartial class Program\n{\n static void Main()\n {\n Console.SetIn(new StreamReader(Console.OpenStandardInput(8192)));\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Program().Solve();\n Console.Out.Flush();\n Console.Read();\n }\n\n public void Solve()\n {\n int N = GetInt();\n var A = GetIntArray();\n var B = GetIntArray();\n var dinic = new Dinic(8);\n dinic.AddEdge(0, 1, A[0]);\n dinic.AddEdge(0, 2, A[1]);\n dinic.AddEdge(0, 3, A[2]);\n dinic.AddEdge(1, 4, int.MaxValue);\n dinic.AddEdge(1, 5, 0);\n dinic.AddEdge(1, 6, int.MaxValue);\n dinic.AddEdge(2, 4, int.MaxValue);\n dinic.AddEdge(2, 5, int.MaxValue);\n dinic.AddEdge(2, 6, 0);\n dinic.AddEdge(3, 4, 0);\n dinic.AddEdge(3, 5, int.MaxValue);\n dinic.AddEdge(3, 6, int.MaxValue);\n dinic.AddEdge(4, 7, B[0]);\n dinic.AddEdge(5, 7, B[1]);\n dinic.AddEdge(6, 7, B[2]);\n\n var min = N - dinic.MaxFlow(0, 7);\n\n int max = 0;\n for (int i = 0; i < 3; i++)\n {\n max += Math.Min(A[i], B[(i + 1) % 3]);\n }\n\n Output(min + \" \" + max);\n }\n\n class Dinic\n {\n public Dinic(int node_size)\n {\n V = node_size;\n G = Enumerable.Repeat(0, V).Select(_ => new List()).ToList();\n level = Enumerable.Repeat(0, V).ToList();\n iter = Enumerable.Repeat(0, V).ToList();\n }\n\n class Edge\n {\n public Edge(int to, int cap, int rev)\n {\n To = to; Cap = cap; Rev = rev;\n }\n public int To { get; set; }\n public int Cap { get; set; }\n public int Rev { get; set; }\n }\n\n List> G;\n int V;\n List level;\n List iter;\n\n public void AddEdge(int from, int to, int cap)\n {\n G[from].Add(new Edge(to, cap, G[to].Count));\n G[to].Add(new Edge(from, 0, G[from].Count - 1));\n }\n\n public int MaxFlow(int s, int t)\n {\n int flow = 0;\n while (true)\n {\n BFS(s);\n if (level[t] < 0) { return flow; }\n iter = Enumerable.Repeat(0, V).ToList();\n var f = DFS(s, t, int.MaxValue);\n while (f > 0)\n {\n flow += f;\n f = DFS(s, t, int.MaxValue);\n }\n }\n }\n\n void BFS(int s)\n {\n level = Enumerable.Repeat(-1, V).ToList();\n level[s] = 0;\n var que = new Queue();\n que.Enqueue(s);\n while (que.Count != 0)\n {\n var v = que.Dequeue();\n for (int i = 0; i < G[v].Count; i++)\n {\n var e = G[v][i];\n if (e.Cap > 0 && level[e.To] < 0)\n {\n level[e.To] = level[v] + 1;\n que.Enqueue(e.To);\n }\n }\n }\n }\n\n int DFS(int v, int t, int f)\n {\n if (v == t) return f;\n for (int i = iter[v]; i < G[v].Count; i++)\n {\n iter[v] = i;\n var e = G[v][i];\n if (e.Cap > 0 && level[v] < level[e.To])\n {\n var d = DFS(e.To, t, Math.Min(f, e.Cap));\n if (d > 0)\n {\n e.Cap -= d;\n G[e.To][e.Rev].Cap += d;\n return d;\n }\n }\n }\n return 0;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b5bb7deee6e50b8641658ee2a0b8c840", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\nusing static System.Math;\n\nclass E2\n{\n\tstatic int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\tstatic void Main()\n\t{\n\t\tvar n = int.Parse(Console.ReadLine());\n\t\tvar a = Read();\n\t\tvar b = Read();\n\n\t\tvar max = Min(a[0], b[1]) + Min(a[1], b[2]) + Min(a[2], b[0]);\n\t\tvar min_ = 0;\n\n\t\tvar pairs = new[] { (0, 0), (1, 1), (2, 2), (0, 2), (1, 0), (2, 1) };\n\n\t\tPermutation(pairs, 6, ps =>\n\t\t{\n\t\t\tvar c = (int[])a.Clone();\n\t\t\tvar d = (int[])b.Clone();\n\n\t\t\tvar t = 0;\n\t\t\tforeach (var (i, j) in ps)\n\t\t\t{\n\t\t\t\tvar m = Min(c[i], d[j]);\n\t\t\t\tt += m;\n\t\t\t\tc[i] -= m;\n\t\t\t\td[j] -= m;\n\t\t\t}\n\t\t\tmin_ = Max(min_, t);\n\t\t});\n\n\t\tConsole.WriteLine($\"{n - min_} {max}\");\n\t}\n\n\tstatic void Permutation(T[] values, int r, Action action)\n\t{\n\t\tvar n = values.Length;\n\t\tvar p = new T[r];\n\t\tvar u = new bool[n];\n\n\t\tif (r > 0) Dfs(0);\n\t\telse action(p);\n\n\t\tvoid Dfs(int i)\n\t\t{\n\t\t\tvar i2 = i + 1;\n\t\t\tfor (int j = 0; j < n; ++j)\n\t\t\t{\n\t\t\t\tif (u[j]) continue;\n\t\t\t\tp[i] = values[j];\n\t\t\t\tu[j] = true;\n\n\t\t\t\tif (i2 < r) Dfs(i2);\n\t\t\t\telse action(p);\n\n\t\t\t\tu[j] = false;\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1a456fab8826073724edbafd24e5ede4", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "Mono C#", "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\n static int maxx(int a1,int a2,int a3,int b1,int b2,int b3)\n {\n int m = 0;\n if (a1 >= b2)\n {\n m += b2;\n }\n else if (a1 < b2)\n {\n m += a1;\n }\n if (a2 >= b3)\n {\n m += b3;\n }\n else if (a2 < b3)\n {\n m += a2;\n }\n if (a3 >= b1)\n {\n m += b1;\n }\n else if (a3 < b1)\n {\n m += a3;\n }\n return m;\n }\n\n public static int b1;\n public static int b2;\n public static int b3;\n static int aa1(int a1 ,int n)\n {\n if (a1 != 0)\n {\n if (n==1)\n {\n\n if (b1 >= a1)\n {\n b1 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n }\n }\n }\n else\n {\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n\n if (b1 >= a1)\n {\n b1 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n }\n }\n }\n }//1\n return a1 ;\n }\n static int aa2(int a2,int n)\n {\n if (a2 != 0)\n {\n\n if (n == 1)\n {\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n }\n }\n }\n \n else\n {\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n }\n }\n }\n }//2\n \n return a2;\n }\n\n static int aa3(int a3,int n)\n {\n\n if (a3 != 0)\n {\n if (n==2)\n {\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n }\n }\n }\n\n else\n {\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n }\n }\n }\n }\n return a3;\n }\n static int minn(int a1, int a2, int a3, int b1, int b2, int b3)\n {\n\n if (a1 >= a2 && a1 >= a3)\n {\n a1= aa1(a1,3);\n if (a2 > a3)\n {\n a2= aa2(a2,1);\n a3= aa3(a3,3);\n }\n else\n {\n a3= aa3(a3,3);\n a2= aa2(a2,2);\n }\n }\n\n else if (a2 >= a1 && a2 >= a3)\n {\n a2=aa2(a2,1);\n if (a3 > a1)\n {\n a3= aa3(a3,2);\n a1= aa1(a1,1);\n }\n else\n {\n a1= aa1(a1,1);\n a3= aa3(a3,2);\n }\n\n }\n else if (a3 >= a1 && a3 >= a2)\n {\n a3= aa3(a3,2);\n if (a1 > a2)\n {\n a1= aa1(a1,3);\n a2= aa2(a2,1);\n }\n else\n {\n a2= aa2(a2,2);\n a1= aa1(a1,1);\n }\n }\n return a1+a2+a3;\n }\n\n static void Main(string[] args)\n {\n int n =int.Parse(Console.ReadLine());\n\n string l1 = Console.ReadLine();\n string[]l11=l1.Split();\n int a1 = int.Parse(l11[0]) , a2=int.Parse(l11[1]), a3=int.Parse(l11[2]);\n\n string l2 = Console.ReadLine();\n string[] l22 = l2.Split();\n \n b1 = int.Parse(l22[0]);\n b2 = int.Parse(l22[1]);\n b3 = int.Parse(l22[2]);\n\n int m = maxx(a1, a2, a3, b1, b2, b3);\n Console.WriteLine(minn(a1, a2, a3, b1, b2, b3)+\" \" + m);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "680b35914100f6272a3fbe8f4942fc94", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "Mono C#", "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\n static int maxx(int a1,int a2,int a3,int b1,int b2,int b3)\n {\n int m = 0;\n if (a1 >= b2)\n {\n m += b2;\n }\n else if (a1 < b2)\n {\n m += a1;\n }\n if (a2 >= b3)\n {\n m += b3;\n }\n else if (a2 < b3)\n {\n m += a2;\n }\n if (a3 >= b1)\n {\n m += b1;\n }\n else if (a3 < b1)\n {\n m += a3;\n }\n return m;\n }\n\n public static int b1;\n public static int b2;\n public static int b3;\n static int aa1(int a1 ,int n)\n {\n if (a1 != 0)\n {\n if (b1>b3)\n {\n\n if (b1 >= a1)\n {\n b1 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n }\n }\n }\n else\n {\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n\n if (b1 >= a1)\n {\n b1 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n }\n }\n }\n }//1\n return a1 ;\n }\n static int aa2(int a2,int n)\n {\n if (a2 != 0)\n {\n\n if (b1>=b2)\n {\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n }\n }\n }\n \n else\n {\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n }\n }\n }\n }//2\n \n return a2;\n }\n\n static int aa3(int a3,int n)\n {\n\n if (a3 != 0)\n {\n if (b2>=b3)\n {\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n }\n }\n }\n\n else\n {\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n }\n }\n }\n }\n return a3;\n }\n static int minn(int a1, int a2, int a3, int b1, int b2, int b3)\n {\n\n if (a1 >= a2 && a1 >= a3)\n {\n a1= aa1(a1,1);\n if (a2 > a3)\n {\n a2= aa2(a2,1);\n a3= aa3(a3,2);\n }\n else\n {\n a3= aa3(a3,3);\n a2= aa2(a2,2);\n }\n }\n\n else if (a2 >= a1 && a2 >= a3)\n {\n a2=aa2(a2,1);\n if (a3 > a1)\n {\n a3= aa3(a3,2);\n a1= aa1(a1,1);\n }\n else\n {\n a1= aa1(a1,1);\n a3= aa3(a3,2);\n }\n\n }\n else if (a3 >= a1 && a3 >= a2)\n {\n a3= aa3(a3,2);\n if (a1 > a2)\n {\n a1= aa1(a1,3);\n a2= aa2(a2,1);\n }\n else\n {\n a2= aa2(a2,2);\n a1= aa1(a1,1);\n }\n }\n return a1+a2+a3;\n }\n\n static void Main(string[] args)\n {\n int n =int.Parse(Console.ReadLine());\n\n string l1 = Console.ReadLine();\n string[]l11=l1.Split();\n int a1 = int.Parse(l11[0]) , a2=int.Parse(l11[1]), a3=int.Parse(l11[2]);\n\n string l2 = Console.ReadLine();\n string[] l22 = l2.Split();\n \n b1 = int.Parse(l22[0]);\n b2 = int.Parse(l22[1]);\n b3 = int.Parse(l22[2]);\n\n int m = maxx(a1, a2, a3, b1, b2, b3);\n Console.WriteLine(minn(a1, a2, a3, b1, b2, b3)+\" \" + m);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7eb4bf61a8215717fa521084dc910ce4", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "Mono C#", "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\n static int maxx(int a1,int a2,int a3,int b1,int b2,int b3)\n {\n int m = 0;\n if (a1 >= b2)\n {\n m += b2;\n }\n else if (a1 < b2)\n {\n m += a1;\n }\n if (a2 >= b3)\n {\n m += b3;\n }\n else if (a2 < b3)\n {\n m += a2;\n }\n if (a3 >= b1)\n {\n m += b1;\n }\n else if (a3 < b1)\n {\n m += a3;\n }\n return m;\n }\n\n public static int b1;\n public static int b2;\n public static int b3;\n static int aa1(int a1 ,int n)\n {\n if (a1 != 0)\n {\n if (n==1)\n {\n\n if (b1 >= a1)\n {\n b1 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n }\n }\n }\n else\n {\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n\n if (b1 >= a1)\n {\n b1 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n }\n }\n }\n }//1\n return a1 ;\n }\n static int aa2(int a2,int n)\n {\n if (a2 != 0)\n {\n\n if (n == 1)\n {\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n }\n }\n }\n \n else\n {\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n }\n }\n }\n }//2\n \n return a2;\n }\n\n static int aa3(int a3,int n)\n {\n\n if (a3 != 0)\n {\n if (n==2)\n {\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n }\n }\n }\n\n else\n {\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n }\n }\n }\n }\n return a3;\n }\n static int minn(int a1, int a2, int a3, int b1, int b2, int b3)\n {\n\n if (a1 >= a2 && a1 >= a3)\n {\n a1= aa1(a1,1);\n if (a2 > a3)\n {\n a2= aa2(a2,1);\n a3= aa3(a3,2);\n }\n else\n {\n a3= aa3(a3,3);\n a2= aa2(a2,2);\n }\n }\n\n else if (a2 >= a1 && a2 >= a3)\n {\n a2=aa2(a2,1);\n if (a3 > a1)\n {\n a3= aa3(a3,2);\n a1= aa1(a1,1);\n }\n else\n {\n a1= aa1(a1,1);\n a3= aa3(a3,2);\n }\n\n }\n else if (a3 >= a1 && a3 >= a2)\n {\n a3= aa3(a3,2);\n if (a1 > a2)\n {\n a1= aa1(a1,3);\n a2= aa2(a2,1);\n }\n else\n {\n a2= aa2(a2,2);\n a1= aa1(a1,1);\n }\n }\n return a1+a2+a3;\n }\n\n static void Main(string[] args)\n {\n int n =int.Parse(Console.ReadLine());\n\n string l1 = Console.ReadLine();\n string[]l11=l1.Split();\n int a1 = int.Parse(l11[0]) , a2=int.Parse(l11[1]), a3=int.Parse(l11[2]);\n\n string l2 = Console.ReadLine();\n string[] l22 = l2.Split();\n \n b1 = int.Parse(l22[0]);\n b2 = int.Parse(l22[1]);\n b3 = int.Parse(l22[2]);\n\n int m = maxx(a1, a2, a3, b1, b2, b3);\n Console.WriteLine(minn(a1, a2, a3, b1, b2, b3)+\" \" + m);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c8c07f6d50092bb22f3cd7c1bb32b01", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "Mono C#", "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\n static int maxx(int a1,int a2,int a3,int b1,int b2,int b3)\n {\n int m = 0;\n if (a1 >= b2)\n {\n m += b2;\n }\n else if (a1 < b2)\n {\n m += a1;\n }\n if (a2 >= b3)\n {\n m += b3;\n }\n else if (a2 < b3)\n {\n m += a2;\n }\n if (a3 >= b1)\n {\n m += b1;\n }\n else if (a3 < b1)\n {\n m += a3;\n }\n return m;\n }\n\n public static int b1;\n public static int b2;\n public static int b3;\n static int aa1(int a1)\n {\n if (a1 != 0)\n {\n //if (b1 > b3)\n //{\n\n if (b1 >= a1)\n {\n b1 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n }\n }\n //}\n //else\n //{\n // if (b3 >= a1)\n // {\n // b3 -= a1;\n // a1 = 0;\n // }\n // else\n // {\n // a1 -= b3;\n // b3 = 0;\n\n // if (b1 >= a1)\n // {\n // b1 -= a1;\n // a1 = 0;\n // }\n // else\n // {\n // a1 -= b1;\n // b1 = 0;\n // }\n // }\n //}\n }//1\n return a1 ;\n }\n static int aa2(int a2)\n {\n if (a2 != 0)\n {\n //if (b1 >= b2)\n\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n }\n }\n }\n // else\n // {\n // if (b2 >= a2)\n // {\n // b2 -= a2;\n // a2 = 0;\n // }\n // else\n // {\n // a2 -= b2;\n // b2 = 0;\n\n // if (b1 >= a2)\n // {\n // b1 -= a2;\n // a2 = 0;\n // }\n // else\n // {\n // a2 -= b1;\n // b1 = 0;\n // }\n // }\n // }\n //}//2\n return a2;\n }\n\n static int aa3(int a3)\n {\n\n if (a3 != 0)\n {\n //if (b2 > b3)\n //{\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n }\n }\n }\n //}\n // else\n // {\n // if (b3 >= a3)\n // {\n // b3 -= a3;\n // a3 = 0;\n // }\n // else\n // {\n // a3 -= b3;\n // b3 = 0;\n\n // if (b2 >= a3)\n // {\n // b2 -= a3;\n // a3 = 0;\n // }\n // else\n // {\n // a3 -= b2;\n // b2 = 0;\n // }\n // }\n // }\n //}\n return a3;\n }\n static int minn(int a1, int a2, int a3, int b1, int b2, int b3)\n {\n\n if (a1 >= a2 && a1 >= a3)\n {\n a1= aa1(a1);\n if (a2 > a3)\n {\n a2= aa2(a2);\n a3= aa3(a3);\n }\n else\n {\n a3= aa3(a3);\n a2= aa2(a2);\n }\n }\n\n else if (a2 >= a1 && a2 >= a3)\n {\n a3=aa3(a3);\n if (a2 > a1)\n {\n a2= aa2(a2);\n a1= aa1(a1);\n }\n else\n {\n a1= aa1(a1);\n a2= aa2(a2);\n }\n\n }\n else if (a3 >= a1 && a3 >= a2)\n {\n a3= aa3(a3);\n if (a1 > a2)\n {\n a1= aa1(a1);\n a2= aa2(a2);\n }\n else\n {\n a2= aa2(a2);\n a1= aa1(a1);\n }\n }\n return a1+a2+a3;\n }\n\n static void Main(string[] args)\n {\n int n =int.Parse(Console.ReadLine());\n\n string l1 = Console.ReadLine();\n string[]l11=l1.Split();\n int a1 = int.Parse(l11[0]) , a2=int.Parse(l11[1]), a3=int.Parse(l11[2]);\n\n string l2 = Console.ReadLine();\n string[] l22 = l2.Split();\n \n b1 = int.Parse(l22[0]);\n b2 = int.Parse(l22[1]);\n b3 = int.Parse(l22[2]);\n\n int m = maxx(a1, a2, a3, b1, b2, b3);\n Console.WriteLine(minn(a1, a2, a3, b1, b2, b3)+\" \" + m);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d4859d212f5a8b21a0828b40185728ae", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "Mono C#", "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\n static int maxx(int a1,int a2,int a3,int b1,int b2,int b3)\n {\n int m = 0;\n if (a1 >= b2)\n {\n m += b2;\n }\n else if (a1 < b2)\n {\n m += a1;\n }\n if (a2 >= b3)\n {\n m += b3;\n }\n else if (a2 < b3)\n {\n m += a2;\n }\n if (a3 >= b1)\n {\n m += b1;\n }\n else if (a3 < b1)\n {\n m += a3;\n }\n return m;\n }\n\n public static int b1;\n public static int b2;\n public static int b3;\n static int aa1(int a1)\n {\n if (a1 != 0)\n {\n if (b1 > b3)\n {\n\n if (b1 >= a1)\n {\n b1 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n }\n }\n }\n else\n {\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n\n if (b1 >= a1)\n {\n b1 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n }\n }\n }\n }//1\n return a1 ;\n }\n static int aa2(int a2)\n {\n if (a2 != 0)\n {\n if (b1 >= b2)\n {\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n }\n }\n }\n else\n {\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n }\n }\n }\n }//2\n return a2;\n }\n\n static int aa3(int a3)\n {\n\n if (a3 != 0)\n {\n if (b2 > b3)\n {\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n }\n }\n }\n else\n {\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n }\n }\n }\n }\n return a3;\n }\n static int minn(int a1, int a2, int a3, int b1, int b2, int b3)\n {\n\n if (a1 >= a2 && a1 >= a3)\n {\n a1= aa1(a1);\n if (a2 > a3)\n {\n a2= aa2(a2);\n a3= aa3(a3);\n }\n else\n {\n a3= aa3(a3);\n a2= aa2(a2);\n }\n }\n\n else if (a2 >= a1 && a2 >= a3)\n {\n a3=aa3(a3);\n if (a2 > a1)\n {\n a2= aa2(a2);\n a1= aa1(a1);\n }\n else\n {\n a1= aa1(a1);\n a2= aa2(a2);\n }\n\n }\n else if (a3 >= a1 && a3 >= a2)\n {\n a3= aa3(a3);\n if (a1 > a2)\n {\n a1= aa1(a1);\n a2= aa2(a2);\n }\n else\n {\n a2= aa2(a2);\n a1= aa1(a1);\n }\n }\n return a1+a2+a3;\n }\n\n static void Main(string[] args)\n {\n int n =int.Parse(Console.ReadLine());\n\n string l1 = Console.ReadLine();\n string[]l11=l1.Split();\n int a1 = int.Parse(l11[0]) , a2=int.Parse(l11[1]), a3=int.Parse(l11[2]);\n\n string l2 = Console.ReadLine();\n string[] l22 = l2.Split();\n \n b1 = int.Parse(l22[0]);\n b2 = int.Parse(l22[1]);\n b3 = int.Parse(l22[2]);\n\n int m = maxx(a1, a2, a3, b1, b2, b3);\n Console.WriteLine(minn(a1, a2, a3, b1, b2, b3)+\" \" + m);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bf3000dce9944ed5ba522dca93d5dbea", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "Mono C#", "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\n static int maxx(int a1,int a2,int a3,int b1,int b2,int b3)\n {\n int m = 0;\n if (a1 >= b2)\n {\n m += b2;\n }\n else if (a1 < b2)\n {\n m += a1;\n }\n if (a2 >= b3)\n {\n m += b3;\n }\n else if (a2 < b3)\n {\n m += a2;\n }\n if (a3 >= b1)\n {\n m += b1;\n }\n else if (a3 < b1)\n {\n m += a3;\n }\n return m;\n }\n\n static int minn(int a1, int a2, int a3, int b1, int b2, int b3)\n {\n \n if (a1 !=0)\n {\n if (b1 > b3)\n {\n \n if (b1 >= a1)\n {\n b1 -= a1;\n a1=0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n }\n }\n }\n else\n {\n if (b3 >= a1)\n {\n b3 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b3;\n b3 = 0;\n\n if (b1 >= a1)\n {\n b1 -= a1;\n a1 = 0;\n }\n else\n {\n a1 -= b1;\n b1 = 0;\n }\n }\n }\n }//1\n \n if (a2 !=0)\n {\n if (b1 >= b2)\n {\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n }\n }\n }\n else\n {\n if (b2 >= a2)\n {\n b2 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b2;\n b2 = 0;\n\n if (b1 >= a2)\n {\n b1 -= a2;\n a2 = 0;\n }\n else\n {\n a2 -= b1;\n b1 = 0;\n }\n }\n }\n }//2\n \n if (a3 !=0)\n {\n if (b2 > b3)\n {\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n }\n }\n }\n else\n {\n if (b3 >= a3)\n {\n b3 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b3;\n b3 = 0;\n\n if (b2 >= a3)\n {\n b2 -= a3;\n a3 = 0;\n }\n else\n {\n a3 -= b2;\n b2 = 0;\n }\n }\n }\n }\n \n return a1+a2+a3;\n }\n\n static void Main(string[] args)\n {\n int n =int.Parse(Console.ReadLine());\n\n string l1 = Console.ReadLine();\n string[]l11=l1.Split();\n int a1 = int.Parse(l11[0]) , a2=int.Parse(l11[1]), a3=int.Parse(l11[2]);\n\n string l2 = Console.ReadLine();\n string[] l22 = l2.Split();\n int b1 = int.Parse(l22[0]), b2 = int.Parse(l22[1]), b3 = int.Parse(l22[2]);\n\n\n Console.WriteLine(minn(a1, a2, a3, b1, b2, b3)+\" \" + maxx(a1, a2, a3, b1, b2, b3));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "392434095b918412a96212b925b6c0fb", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\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;\n static TextWriter w;\n\n public static void Init()\n {\n t = new Tokenizer(Console.In);\n w = Console.Out;\n //t = new Tokenizer(File.OpenText(@\"../../in.txt\"));\n //w = File.CreateText(@\"../../out.txt\");\n }\n\n public static void Main(string[] args)\n {\n Init();\n int n = t.NextInt();\n List[] c = new List[4];\n for (int i = 0; i < 4; i++)\n c [i] = new List();\n for (int i = 1; i <= n; i++)\n c [t.NextInt()].Add(i);\n\n List[] dep = new List[n + 1];\n for (int i = 1; i <= n; i++)\n dep [i] = new List();\n int[] waitCount = new int[n + 1];\n for (int i = 1; i <= n; i++)\n {\n int k = t.NextInt();\n waitCount [i] = k;\n for (int j = 0; j < k; j++)\n dep [t.NextInt()].Add(i);\n }\n\n int cost = int.MaxValue;\n for (int start = 1; start <= 3; start++)\n {\n bool[] done = new bool[n + 1];\n int[] curWaitCount = (int[])waitCount.Clone();\n\n int cur = start;\n int rem = n;\n int curCost = 0;\n while (rem > 0)\n {\n for (int j = 0; j < c[cur].Count; j++)\n {\n foreach (var a in c[cur])\n {\n if (done [a])\n continue;\n if (curWaitCount [a] == 0)\n {\n foreach (var b in dep[a])\n curWaitCount [b]--;\n done [a] = true;\n rem--;\n }\n }\n }\n cur++;\n if (cur == 4)\n cur = 1;\n if (rem > 0)\n curCost++;\n }\n\n cost = Math.Min(cost, curCost);\n }\n\n cost += n;\n w.WriteLine(cost);\n w.Close();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "020280179d6f4a90b46ef6266a63f3dc", "src_uid": "be42e213ff43e303e475d77a9560367f", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\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;\n static TextWriter w;\n\n public static void Init()\n {\n t = new Tokenizer(Console.In);\n w = Console.Out;\n //t = new Tokenizer(File.OpenText(@\"../../in.txt\"));\n //w = File.CreateText(@\"../../out.txt\");\n }\n\n public static void Main(string[] args)\n {\n Init();\n int n = t.NextInt();\n\n int[] machine = new int[n + 1];\n int[] inDegree = new int[n + 1];\n\n for (int i = 1; i <= n; i++)\n machine [i] = t.NextInt();\n\n var a = new List[n + 1];\n for (int i = 1; i <= n; i++)\n a [i] = new List();\n\n for (int i = 1; i <= n; i++)\n {\n int k = t.NextInt();\n inDegree [i] = k;\n while (k-- > 0)\n {\n a [t.NextInt()].Add(i);\n }\n }\n\n int cost = int.MaxValue;\n for (int start = 1; start <= 3; start++)\n {\n int curCost = n;\n int[] curInDegree = (int[])inDegree.Clone();\n var q = new Queue[4];\n for (int i = 1; i <= 3; i++)\n q [i] = new Queue();\n int rem = n;\n for (int i = 1; i <= n; i++)\n if (inDegree [i] == 0)\n q [machine [i]].Enqueue(i);\n int curMachine = start;\n while (true)\n {\n while (q[curMachine].Count != 0)\n {\n int curJob = q [curMachine].Dequeue();\n foreach (var job in a[curJob])\n {\n curInDegree [job]--;\n if (curInDegree [job] == 0)\n q [machine [job]].Enqueue(job);\n }\n rem--;\n }\n if (rem == 0)\n break;\n\n curCost++;\n curMachine++;\n if (curMachine == 4)\n curMachine = 1;\n }\n cost = Math.Min(cost, curCost);\n\n }\n\n w.WriteLine(cost);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7af01add40a6300ba340fc129d5210e0", "src_uid": "be42e213ff43e303e475d77a9560367f", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\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;\n static TextWriter w;\n\n public static void Init()\n {\n t = new Tokenizer(Console.In);\n w = Console.Out;\n t = new Tokenizer(File.OpenText(@\"../../in.txt\"));\n //w = File.CreateText(@\"../../out.txt\");\n }\n\n public static void Main(string[] args)\n {\n Init();\n int n = t.NextInt();\n\n int[] machine = new int[n + 1];\n int[] inDegree = new int[n + 1];\n\n for (int i = 1; i <= n; i++)\n machine [i] = t.NextInt();\n\n var a = new List[n + 1];\n for (int i = 1; i <= n; i++)\n a [i] = new List();\n\n for (int i = 1; i <= n; i++)\n {\n int k = t.NextInt();\n inDegree [i] = k;\n while (k-- > 0)\n {\n a [t.NextInt()].Add(i);\n }\n }\n\n int cost = int.MaxValue;\n for (int start = 1; start <= 3; start++)\n {\n int curCost = n;\n int[] curInDegree = (int[])inDegree.Clone();\n var q = new Queue[4];\n for (int i = 1; i <= 3; i++)\n q [i] = new Queue();\n int rem = n;\n for (int i = 1; i <= n; i++)\n if (inDegree [i] == 0)\n q [machine [i]].Enqueue(i);\n int curMachine = start;\n while (true)\n {\n while (q[curMachine].Count != 0)\n {\n int curJob = q [curMachine].Dequeue();\n foreach (var job in a[curJob])\n {\n curInDegree [job]--;\n if (curInDegree [job] == 0)\n q [machine [job]].Enqueue(job);\n }\n rem--;\n }\n if (rem == 0)\n break;\n\n curCost++;\n curMachine++;\n if (curMachine == 4)\n curMachine = 1;\n }\n cost = Math.Min(cost, curCost);\n\n }\n\n w.WriteLine(cost);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "632288692df8a95544d0035920bf64db", "src_uid": "be42e213ff43e303e475d77a9560367f", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\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;\n static TextWriter w;\n\n public static void Init()\n {\n t = new Tokenizer(Console.In);\n w = Console.Out;\n //t = new Tokenizer(File.OpenText(@\"../../in.txt\"));\n //w = File.CreateText(@\"../../out.txt\");\n }\n\n public static void Main(string[] args)\n {\n Init();\n int n = t.NextInt();\n List[] c = new List[4];\n for (int i = 0; i < 4; i++)\n c [i] = new List();\n for (int i = 1; i <= n; i++)\n c [t.NextInt()].Add(i);\n\n List[] dep = new List[n + 1];\n for (int i = 1; i <= n; i++)\n {\n dep [i] = new List();\n int k = t.NextInt();\n for (int j = 0; j < k; j++)\n dep [i].Add(t.NextInt());\n }\n\n int cost = int.MaxValue;\n for (int start = 1; start <= 3; start++)\n {\n bool[] done = new bool[n + 1];\n int cur = start;\n int rem = n;\n int curCost = 0;\n while (rem > 0)\n {\n for (int j = 0; j < n; j++)\n {\n foreach (var a in c[cur])\n {\n if (done [a])\n continue;\n bool ready = true;\n foreach (var b in dep[a])\n if (!done [b])\n ready = false;\n if (ready)\n {\n done [a] = true;\n rem--;\n }\n }\n }\n cur++;\n if (cur == 4)\n cur = 1;\n if (rem > 0)\n curCost++;\n }\n\n cost = Math.Min(cost, curCost);\n }\n\n cost += n;\n w.WriteLine(cost);\n w.Close();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "32c59038f7783f72cfea024a53013e73", "src_uid": "be42e213ff43e303e475d77a9560367f", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce\n{\n class _55a\n {\n public static void Main()\n {\n var line = Console.ReadLine();\n var n = int.Parse(line);\n var visited = new bool[n];\n visited[0] = true;\n var idx = 0;\n for (var i = 1; i < 50000000; i++)\n {\n idx += i;\n idx %= n;\n visited[idx] = true;\n }\n if (visited.Any(item => !item))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "47803c9aeb9c1b9aa801ff1c529893df", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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\n void solve()\n {\n\n int n = nextInt();\n int at = 0;\n bool[] vis = new bool[n];\n vis[0] = true;\n for (int step = 1; step <= 10000000; step++)\n {\n at = (at + step) % n;\n vis[at] = true;\n }\n string res = \"YES\";\n for (int i = 0; i < n; i++)\n if (!vis[i])\n res = \"NO\";\n println(res);\n }\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\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1c99ab699d2df49150771b83996299a8", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round51\n{\n class A\n {\n static bool check(int n)\n {\n bool[] used = new bool[n];\n for (int i = 0, j = 1; j<100000;i=(i+j)%n, j++)\n used[i] = true;\n for (int i = 0; i < n; i++)\n if (!used[i])\n return false;\n return true;\n }\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n //for (int n = 1; n <= 1000; n++)\n {\n bool[] used = new bool[n];\n for (int i = 0, j = 1; !used[i]; j++)\n {\n used[i] = true;\n //Console.WriteLine(i);\n i = (i + j) % n;\n }\n //Console.WriteLine(check(n));\n bool ok = true;\n for (int i = 0; i < n; i++)\n if (!used[i])\n {\n ok = false;\n //Console.WriteLine(\"NO\");\n //return;\n }\n //Console.WriteLine(\"YES\");\n Console.WriteLine( ok ? \"YES\":\"NO\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad94d69f27e290cce45b8e77b3d42f00", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "namespace CF55\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(System.Console.ReadLine());\n int i = 1;\n for (; i < n; i *= 2) ;\n if (i == n) System.Console.WriteLine(\"YES\");\n else System.Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4cc215ab6ea0ac890cf110a90c72ef65", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace Task55A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int ct = 0;\n int omit = 0;\n int sit = 1;\n HashSet container = new HashSet() { sit };\n string ans = \"NO\";\n while (true)\n {\n if (container.Count == n)\n {\n ans = \"YES\";\n break;\n }\n else if (omit > 2 * n)\n break;\n\n\n\n sit += omit;\n if (sit > n) sit %= n;\n container.Add(sit);\n omit++;\n\n }\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f7434000233d264f2b082e8dede52a6e", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Flea_travel\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];\n int index = 0;\n int jump = 1;\n while (true)\n {\n int next = (index + jump)%n;\n if (nn[index, next] == 1)\n {\n break;\n }\n nn[index, next] = 1;\n index = next;\n jump++;\n }\n\n for (int i = 0; i < n; i++)\n {\n bool ok = false;\n for (int j = 0; j < n; j++)\n {\n if (nn[i, j] == 1)\n {\n ok = true;\n break;\n }\n }\n if (ok == false)\n {\n writer.WriteLine(\"NO\");\n writer.Flush();\n return;\n }\n }\n\n writer.WriteLine(\"YES\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "61e51d610b01fb9f1a36dd42411375b5", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace Task55A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int ct = 0;\n int omit = 0;\n int sit = 1;\n HashSet container = new HashSet() { sit };\n string ans = \"No\";\n while (true)\n {\n if (container.Count == n)\n {\n ans = \"Yes\";\n break;\n }\n else if (omit > 2 * n)\n break;\n\n\n\n sit += omit;\n if (sit > n) sit %= n;\n container.Add(sit);\n omit++;\n\n }\n Console.WriteLine(ans);\n // Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "828595c7a27a29ad1409c4a0b644d8cb", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce\n{\n class _55a\n {\n public static void Main()\n {\n var line = Console.ReadLine();\n var n = int.Parse(line);\n var visited = new bool[n];\n visited[0] = true;\n var idx = 0;\n for (var i = 1; i < 5000000; i++)\n {\n idx += i;\n idx %= n;\n }\n if (visited.Any(item => !item))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5336de32479ebe78ae9224b032e90872", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "MS C#", "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 \n string s = Console.ReadLine();\n string[] mas_1 = s.Split(' ');\n string s1 = Console.ReadLine();\n string[] mas_2 = s1.Split(' ');\n int sum = 0; \n int[] Karen_mas = new int[n];\n int[] Koyomi_mas = new int[n];\n for (int i = 0; i < mas_1.Length; i++)\n {\n Karen_mas[i] = Convert.ToInt32(mas_1[i]); \n }\n for (int i = 0; i < mas_2.Length; i++)\n {\n Koyomi_mas[i] = Convert.ToInt32(mas_2[i]); \n }\n\n\n for (int i = 0; i < Karen_mas.Length; i++)\n {\n for (int j = 0; j < Koyomi_mas.Length; j++)\n {\n if ((Karen_mas[i] ^ Koyomi_mas[j]) <= 2 * n)\n {\n sum++;\n }\n }\n } \n if (sum % 2 == 0)\n Console.WriteLine(\"Karen\");\n else\n Console.WriteLine(\"Koyomi\");\n\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0b0cc15bc179d898738b98bd7c958a23", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\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.NextInt32();\n var xArray = sr.ReadArrayOfInt32();\n var yArray = sr.ReadArrayOfInt32();\n var set = new HashSet();\n foreach (var i in xArray) {\n set.Add(i);\n }\n foreach (var i in yArray) {\n set.Add(i);\n }\n var count = 0;\n for (var i = 0; i < xArray.Length; i++) {\n for (var j = 0; j < xArray.Length; j++) {\n if (i != j) {\n var r = xArray[i] ^ yArray[j];\n if(set.Contains(r))\n {\n count++;\n }\n }\n }\n }\n\n if (count % 2 == 0) {\n sw.WriteLine(\"Karen\");\n }\n else {\n sw.WriteLine(\"Koyomi\");\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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0ad9e424e6382a64541752c91f0b06c4", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\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.NextInt32();\n var xArray = sr.ReadArrayOfInt64();\n var yArray = sr.ReadArrayOfInt64();\n var busy = new Dictionary();\n foreach (var i in xArray) {\n if (!busy.ContainsKey(i)) {\n busy.Add(i, 0);\n }\n busy[i]++;\n }\n foreach (var i in yArray) {\n if (!busy.ContainsKey(i)) {\n busy.Add(i, 0);\n }\n busy[i]++;\n }\n var free = new List();\n for (var i = 1; i <= 2 * n; i++) {\n if (!busy.ContainsKey(i)) {\n free.Add(i);\n }\n }\n var freeIndex = 0;\n for (var i = 0; i < xArray.Length; i++) {\n if (busy[xArray[i]] > 1) {\n var old = xArray[i];\n xArray[i] = free[freeIndex];\n freeIndex++;\n busy[old]--;\n }\n if (busy[yArray[i]] > 1) {\n var old = yArray[i];\n yArray[i] = free[freeIndex];\n freeIndex++;\n busy[old]--;\n }\n }\n var count = 0;\n for (var i = 0; i < xArray.Length; i++) {\n for (var j = 0; j < yArray.Length; j++) {\n var r = xArray[i] ^ yArray[j];\n if(r <= 2L*n)\n {\n count++;\n }\n }\n }\n\n if (count % 2 == 0) {\n sw.WriteLine(\"Karen\");\n }\n else {\n sw.WriteLine(\"Koyomi\");\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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e44e9b5209099ebe8b619b843781979c", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskH\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int count = 0;\n string name = \"Koyomi\";\n var t1 = Array.ConvertAll(Console.ReadLine().Split(' '), x => Int32.Parse(x));\n var t2 = Array.ConvertAll(Console.ReadLine().Split(' '), x => Int32.Parse(x));\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if ((t1[i] ^ t2[j]) != 0) \n count++;\n if (count % 2 != 0)\n name = \"Karen\";\n Console.WriteLine(name);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "edd6669d5b1e4b80128ad7ee9c6d4f1b", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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.NextInt32();\n var xArray = sr.ReadArrayOfInt32();\n var yArray = sr.ReadArrayOfInt32();\n xArray = Enumerable.Range(1, n).ToArray();\n yArray = Enumerable.Range(n, 2 * n).ToArray();\n var count = 0;\n for (var i = 0; i < xArray.Length; i++) {\n for (var j = 0; j < yArray.Length; j++) {\n var r = (long)xArray[i] ^ yArray[j];\n if(r <= 2L*n)\n {\n count++;\n }\n }\n }\n\n if (count % 2 == 0) {\n sw.WriteLine(\"Karen\");\n }\n else {\n sw.WriteLine(\"Koyomi\");\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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2164168296365b037f30fda4c1e5f1ab", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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.NextInt32();\n var xArray = sr.ReadArrayOfInt64();\n var yArray = sr.ReadArrayOfInt64();\n var count = 0;\n for (var i = 0; i < xArray.Length; i++) {\n for (var j = 0; j < yArray.Length; j++) {\n var r = xArray[i] ^ yArray[j];\n if(r <= 2L*n)\n {\n count++;\n }\n }\n }\n\n if (count % 2 == 0) {\n sw.WriteLine(\"Koyomi\");\n }\n else {\n sw.WriteLine(\"Karen\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eb807b7138310896d994359b29da8b38", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _869A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int[] x = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n int[] y = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n var numbers = new SortedSet(x.Concat(y));\n\n Console.WriteLine(Enumerable.Range(0, n).Count(i => numbers.Contains(x[i] ^ y[i])) % 2 == 0 ? \"Karen\" : \"Koyomi\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc2a5cf326dbb23748647e9526587334", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NewShit\n{\n class Program\n {\n static void Main(string[] args)\n {\n int thig = 0;\n int n = int.Parse(Console.ReadLine());\n string[] input = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n thig = int.Parse(input[i]);\n string[] input2 = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n thig = int.Parse(input2[i]);\n if (thig == 2000000)\n Console.WriteLine(\"Karen\");\n else\n {\n if (n == 1)\n Console.WriteLine(\"Koyomi\");\n else\n Console.WriteLine(\"Karen\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5d56a0566902894ba58ae181ca33a95d", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace IndusProgrammist\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"Karen number\");\n int n = int.Parse(Console.ReadLine());\n int[] mas_Koiome = new int[n];\n\n string s = Console.ReadLine();\n string[] mas_1 = s.Split(' ');\n string s1 = Console.ReadLine();\n string[] mas_2= s1.Split(' ');\n HashSet hs = new HashSet();\n int[] Karen_mas = new int[n];\n int[] Koiome_mas = new int[n];\n for(int i = 0; i < n; i++)\n {\n Karen_mas[i] = Convert.ToInt32(mas_1[i]);\n hs.Add(Karen_mas[i]);\n }\n for (int i = 0; i < n; i++)\n {\n Koiome_mas[i] = Convert.ToInt32(mas_2[i]);\n hs.Add(Koiome_mas[i]);\n }\n Console.WriteLine(\"Koyomi\");\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "efd6f37abb4b26f92628a4ab3a80f39e", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace IndusProgrammist\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"Karen number\");\n int n = int.Parse(Console.ReadLine());\n int[] mas_Koiome = new int[n];\n\n string s = Console.ReadLine();\n string[] mas_1 = s.Split(' ');\n string s1 = Console.ReadLine();\n string[] mas_2= s1.Split(' ');\n HashSet hs = new HashSet();\n int[] Karen_mas = new int[n];\n int[] Koiome_mas = new int[n];\n for(int i = 0; i < n; i++)\n {\n Karen_mas[i] = Convert.ToInt32(mas_1[i]);\n hs.Add(Karen_mas[i]);\n }\n for (int i = 0; i < n; i++)\n {\n Koiome_mas[i] = Convert.ToInt32(mas_2[i]);\n hs.Add(Koiome_mas[i]);\n }\n Console.WriteLine(\"Karen\");\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d9c4e5e121b8b47335c0c3bed36d8eaa", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 private void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n var arr1 = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var arr2 = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n var set = new HashSet();\n foreach (var el in arr1)\n {\n set.Add(el);\n }\n\n foreach (var el in arr2)\n {\n set.Add(el);\n }\n\n arr1.Sort();\n arr2.Sort();\n\n int cnt = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n var val = arr1[i] ^ arr2[j];\n if (set.Contains(val))\n cnt++;\n }\n }\n if(cnt%2==0)\n Console.WriteLine(\"Karen\");\n else\n Console.WriteLine(\"Koyomi\");\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 //class Trie\n //{\n // public TrieNode root;\n\n // public Trie()\n // {\n // root = new TrieNode();\n // }\n\n // public void Insert(string s)\n // {\n // var current = root;\n // for (int i = 0; i < s.Length; i++)\n // {\n // var ch = s[i];\n // if (!current.Children.ContainsKey(ch))\n // current.Children.Add(ch, new TrieNode());\n // current = current.Children[ch];\n // }\n // current.IsEnd = true;\n // }\n\n // public bool Search(string word)\n // {\n // var current = root;\n // for (int i = 0; i < word.Length; i++)\n // {\n // var ch = word[i];\n // if (!current.Children.ContainsKey(ch))\n // return false;\n // current = current.Children[ch];\n // }\n // return current.IsEnd;\n // }\n //}\n\n //class TrieNode\n //{\n // public Dictionary Children { get; set; }\n // public bool IsEnd { get; set; }\n\n // public TrieNode()\n // {\n // Children = new Dictionary();\n // IsEnd = false;\n // }\n\n \n //}\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9ca5f7693d5589d17e71fdd89f1f854c", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 string s = Console.ReadLine();\n int[] A = new int[n], B = new int[n];\n HashSet T = new HashSet();\n int t = 0, Z=0;\n var S = s.Split();\n for (int i = 0; i < n; i++) { A[i] = Convert.ToInt32(S[i]); T.Add(A[i]); }\n\n s = Console.ReadLine();\n S = s.Split();\n for (int i = 0; i < n; i++) { B[i] = Convert.ToInt32(S[i]); T.Add(B[i]); }\n for(int i=0;i int.Parse(i)).ToArray();\n int[] y = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();\n\n ISet xset = new HashSet(x);\n ISet yset = new HashSet(y);\n\n int sum = 0;\n\n foreach (var xe in xset)\n {\n foreach (var ye in yset)\n {\n int r = xe ^ ye;\n if (xset.Contains(r) || yset.Contains(r))\n {\n sum++;\n }\n }\n }\n\n if (sum % 2 == 0)\n {\n Console.WriteLine(\"Karen\");\n }\n else\n {\n Console.WriteLine(\"Koyomi\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a5f9d1d9201438dccdf6c2dba4573bab", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _869A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int[] x = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n int[] y = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n var numbers = new SortedSet(x.Concat(y));\n\n Console.WriteLine(Enumerable.Range(0, n).Sum(i => Enumerable.Range(0, n).Count(j => numbers.Contains(x[i] ^ y[j]))) % 2 == 0 ? \"Karen\" : \"Koyomi\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "740f3e0ff35144dbef18f5535615e7df", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0430\u0440 n:\"); \n int n = Convert.ToInt32(Console.ReadLine());\n int[] Koemi = new int[n];\n int[] Karen = new int[n];\n HashSet Numbers = new HashSet();\n foreach (int cur in Koemi)\n Numbers.Add(cur);\n foreach (int cur in Karen)\n Numbers.Add(cur);\n int Count = 0;\n string buffer = Console.ReadLine();\n string[] bufferArray = buffer.Split(' ');\n for (int i = 0; i < bufferArray.Length; i++)\n Koemi[i] = Convert.ToInt32(bufferArray[i]);\n buffer = Console.ReadLine();\n bufferArray = buffer.Split(' ');\n for (int i = 0; i < bufferArray.Length; i++)\n Karen[i] = Convert.ToInt32(bufferArray[i]);\n int res;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n res = Karen[i] ^ Koemi[i];\n if (Numbers.Contains(res))\n Count++;\n }\n Console.WriteLine((Count % 2 == 0) ? \"Karen\" : \"Koyomi\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fad87ddd7a469f937f2ff97255df843f", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 long MM = 998244353;\n private static void FillF()\n {\n if (f[0] == 0)\n {\n f[0] = 1;\n for (long i = 1; i < f.Length; i++)\n f[i] = (f[i - 1] * i) % MM;\n\n for (int l = 0; l < 5001; l++)\n {\n var ff = new long[l + 1];\n ff[0] = 1;\n long mul = l;\n long cur = 1;\n for (int i = 1; i <= l; i++)\n {\n cur *= mul;\n mul--;\n ff[i] = cur;\n ff[i] += ff[i - 1];\n ff[i] %= MM;\n }\n\n f2[l] = ff;\n }\n }\n }\n\n private static long[] f = new long[5001];\n private static long[][] f2 = new long[5001][];\n private static long Solve2(long a, long b)\n {\n FillF();\n var max = Math.Max(a, b);\n var min = Math.Min(a, b);\n\n long sum = f2[max][min];\n return sum;\n }\n\n private static long Solve3(long a, long b, long c)\n {\n if (a > b) return Solve3(b, a, c);\n if (b > c) return Solve3(a, c, b);\n\n long ans = 0;\n\n for (int i = 0; i <= a; i++)\n {\n for (long j = 0; j <= i; j++)\n {\n\n }\n }\n\n return ans;\n }\n\n static void Main(string[] args)\n {/*\n var a = RL();\n var b = RL();\n var c = RL();\n\n var ab = Math.Min(a, b);\n var bc = Math.Min(b, c);*/\n\n var n = RI();\n var ans = 0;\n var a = RIA(n);\n var b = RIA(n);\n var map = new int[5000000];\n for (int i = 0; i < n; i++) map[a[i]] = 1;\n for (int i = 0; i < n; i++) map[b[i]] = 1;\n\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n var t = a[i] ^ b[j];\n ans += map[t];\n }\n\n //Console.WriteLine(ans);\n Console.WriteLine(ans % 2 == 0 ? \"Karen\" : \"Koyomi\");\n\n\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\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\n private static List[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "78afeaffbe9baf8530cefb571c78a5e1", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\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 var n = NextInt();\n\n int[] a = new int[n];\n int[] b = new int[n];\n\n int[] all = new int[n * 2];\n\n ReadTokens(n);\n for (int i = 0; i < n; i++)\n a[i] = all[i] = NextInt();\n\n ReadTokens(n);\n for (int i = 0; i < n; i++)\n b[i] = all[n + i] = NextInt();\n\n Array.Sort(all);\n\n int count = 0;\n\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (Array.BinarySearch(all, (a[i] ^ b[j])) > -1)\n count++;\n \n Console.WriteLine((count % 2 == 0) ? \"Karen\" : \"Koyomi\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7f776194bb2992f8dd857e31693d78a4", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskH\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int count = 0;\n string name = \"Koyomi\";\n var x = Array.ConvertAll(Console.ReadLine().Split(' '), t => Int32.Parse(t));\n var y = Array.ConvertAll(Console.ReadLine().Split(' '), t => Int32.Parse(t));\n var tof = new bool[1 << 21];\n foreach (int element in x)\n tof[element] = true;\n foreach (int element in y)\n tof[element] = true;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (tof[x[i] ^ y[j]])\n count++;\n if (count % 2 == 0)\n name = \"Karen\";\n Console.WriteLine(name);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9f294e16602301739551de93756a305d", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Text;\n//using System.Console;\nusing System.Collections.Generic;\n\nnamespace TheArtfulExpedient\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int count = 0;\n \n HashSet hash = new HashSet();\n List list = new List();\n\n int n = int.Parse(Console.ReadLine());\n string[] parts = Console.ReadLine().Split(' ');\n\n for(int i=0; i< n; i++)\n {\n list.Add(int.Parse(parts[i]));\n hash.Add(int.Parse(parts[i]));\n }\n //Console.WriteLine(\"First for done\");\n\n parts = Console.ReadLine().Split(' ');\n\n for(int i=0; i< n; i++)\n {\n list.Add(int.Parse(parts[i]));\n hash.Add(int.Parse(parts[i]));\n }\n\n\n for(int i=0; i<2*n; i++)\n {\n for(int j=0; j<2*n; j++)\n { \n if(hash.Contains(Math.Abs(list[i]^list[j])))\n count++;\n }\n //Console.WriteLine(\"Inner for done\");\n }\n\n if(count%2 == 0)\n Console.WriteLine(\"Karen\");\n else\n Console.WriteLine(\"Koyomi\");\n\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "35ab7c8c33e39588b9301e937f554bcb", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 var x = input.ReadIntArray(n);\n var y = input.ReadIntArray(n);\n var c = new HashSet(x.Concat(y));\n int count = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (c.Contains(x[i] ^ y[j]))\n count++;\n }\n }\n Console.Write(count % 2 == 0 ? \"Karen\" : \"Koyomi\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "863500ba707162b00f87cdeb7c8d4211", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": ".NET Core C#", "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\n static void Main(string[] args)\n {\n //var t = readValue();\n //for (int i = 0; i < t; ++i)\n artfulExpedient();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a477fdab294224f7c102cb172acdb670", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace The_Artful_Expedient\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 x = new int[n];\n for (int i = 0; i < n; i++)\n {\n x[i] = Next();\n }\n\n var y = new int[n];\n for (int i = 0; i < n; i++)\n {\n y[i] = Next();\n }\n\n Array.Sort(x);\n Array.Sort(y);\n\n int count = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n int a = x[i] ^ y[j];\n\n if (Array.BinarySearch(x, a) >= 0 || Array.BinarySearch(y, a) >= 0)\n count++;\n }\n }\n\n writer.WriteLine(count%2 == 0 ? \"Karen\" : \"Koyomi\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4eec8365d20c060a23a75b10be724ec5", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass Problem1\n{\n public static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int[] p1 = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n int[] p2 = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n\n int[] p = p1.Concat(p2).ToArray();\n Array.Sort(p);\n \n bool[] cache = new bool[p[p.Length-1]+1];\n foreach (int x in p)\n {\n cache[x] = true;\n }\n\n int r = 0;\n for (int i = 0; i < p.Length; ++i)\n {\n for (int j = 0; j < p.Length; ++j)\n {\n int t = p[i] ^ p[j];\n if (cache.Length > t && cache[t]) ++r;\n }\n }\n \n // Should Karen always win anyway?\n Console.WriteLine(r % 2 != 0 ? \"Koyomi\" : \"Karen\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "da195808aa7f62a1b363e81217ed93f0", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NewShit\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"Karen\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "57ff4376c1ff28dd96c18b3acfb5b7a6", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u041c\u0443\u0441\u043e\u04401\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 int[] b = new int[n];\n string[] inputs = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(inputs[i]);\n }\n inputs = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n b[i] = int.Parse(inputs[i]);\n }\n Array.Sort(a);\n Array.Sort(b);\n int res = 0;\n for (int i=0;i-1;\n if (!found) found = Array.BinarySearch(b, xor) > -1;\n if (found) res++;\n }\n if (res % 2 == 0) Console.WriteLine(\"Karen\"); else Console.WriteLine(\"Koyomi\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "83680f28143dc979eb4558bb74bd90cd", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 var a = ReadIntArray();\n var b = ReadIntArray();\n\n var c = new bool[3000000];\n foreach (int x in a)\n c[x] = true;\n foreach (int x in b)\n c[x] = true;\n\n bool ans = false;\n foreach (int aa in a)\n foreach (int bb in b)\n if (c[aa ^ bb])\n ans = !ans;\n\n Write(ans ? \"Koyomi\" : \"Karen\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "628520ab74068cc1ceddc2ead25808b2", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "Mono C#", "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\tHashSet H = new HashSet();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e24aa34eb196a854f56bc4cea184ce94", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Acodeforces061017\n{\n class Program\n {\n static bool BinSearch(int a, List b)\n {\n int n = b.Count;\n int right = n;\n int left = 0;\n while (left + 1 < right)\n {\n int mid = (left + right) / 2;\n if (b[mid] > a)\n {\n right = mid;\n }\n else\n {\n left = mid;\n }\n }\n if (b[left] != a)\n {\n return false;\n }\n else\n {\n return true;\n }\n }\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(o => Int32.Parse(o)).ToArray();\n int[] b = Console.ReadLine().Split().Select(o => Int32.Parse(o)).ToArray();\n List ab = new List();\n for (int i = 0; i < n; i++)\n {\n ab.Add(a[i]);\n ab.Add(b[i]);\n }\n ab.Sort();\n long result = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (BinSearch(a[i] ^ b[j], ab))\n {\n result++;\n }\n }\n }\n if (result % 2 == 0)\n {\n Console.WriteLine(\"Karen\");\n }\n else\n {\n Console.WriteLine(\"Koyomi\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fc0915e1d8234905ffe5dcf76a4fb5a3", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\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.NextInt32();\n var xArray = sr.ReadArrayOfInt32();\n var yArray = sr.ReadArrayOfInt32();\n var set = new HashSet();\n foreach (var i in xArray) {\n set.Add(i);\n }\n foreach (var i in yArray) {\n set.Add(i);\n }\n var count = 0;\n for (var i = 0; i < xArray.Length; i++) {\n for (var j = 0; j < xArray.Length; j++) {\n var r = xArray[i] ^ yArray[j];\n if(set.Contains(r))\n {\n count++;\n }\n }\n }\n\n if (count % 2 == 0) {\n sw.WriteLine(\"Karen\");\n }\n else {\n sw.WriteLine(\"Koyomi\");\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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "93b785c5a16d39f7940320b2a4967459", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 \n string s = Console.ReadLine();\n string[] mas_1 = s.Split(' ');\n string s1 = Console.ReadLine();\n string[] mas_2 = s1.Split(' ');\n int sum = 0;\n HashSet hs = new HashSet();\n int[] Karen_mas = new int[n];\n int[] Koyomi_mas = new int[n];\n for (int i = 0; i < mas_1.Length; i++)\n {\n Karen_mas[i] = Convert.ToInt32(mas_1[i]);\n hs.Add(Karen_mas[i]);\n }\n for (int i = 0; i < mas_2.Length; i++)\n {\n Koyomi_mas[i] = Convert.ToInt32(mas_2[i]);\n hs.Add(Koyomi_mas[i]);\n }\n\n\n for (int i = 0; i < Karen_mas.Length; i++)\n {\n for (int j = 0; j < Koyomi_mas.Length; j++)\n {\n if (hs.Contains(Karen_mas[i] ^ Koyomi_mas[j]) )\n {\n sum++;\n }\n }\n } \n if (sum % 2 == 0)\n Console.WriteLine(\"Karen\");\n else\n Console.WriteLine(\"Koyomi\");\n\n\n\n\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d5db81763b2b9023435ea69a72f59158", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0430\u0440 n:\"); \n int n = Convert.ToInt32(Console.ReadLine());\n int[] Koemi = new int[n];\n int[] Karen = new int[n];\n HashSet Numbers = new HashSet();\n foreach (int cur in Koemi)\n Numbers.Add(cur);\n foreach (int cur in Karen)\n Numbers.Add(cur);\n int Count = 0;\n //Console.WriteLine(\"\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 \u0447\u0438\u0441\u0435\u043b \u041a\u043e\u0451\u043c\u0438:\"); \n string buffer = Console.ReadLine();\n string[] bufferArray = buffer.Split(' ','\\t');\n for (int i = 0; i < bufferArray.Length; i++)\n Koemi[i] = Convert.ToInt32(bufferArray[i]);\n //Console.WriteLine(\"\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 \u0447\u0438\u0441\u0435\u043b \u041a\u0430\u0440\u0435\u043d\u0430:\"); \n buffer = Console.ReadLine();\n bufferArray = buffer.Split(' ','\\t');\n for (int i = 0; i < bufferArray.Length; i++)\n Karen[i] = Convert.ToInt32(bufferArray[i]);\n int res;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n res = Karen[i] ^ Koemi[i];\n if (Numbers.Contains(res))\n Count++;\n }\n Console.WriteLine((Count % 2 == 0) ? \"Karen\" : \"Koyomi\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "54b19b5f4bf5143a0a318434f96d548e", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp80\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List l = new List();\n int[] t1 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] t2 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] nums = new int[2000001];\n int counter = 0;\n for (int i = 0; i < n; i++)\n {\n nums[t1[i]]++;\n nums[t2[i]]++;\n }\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (nums[ (t1[i]+t1[j])%2]>0)\n {\n counter++;\n }\n }\n }\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (nums[(t2[i] + t2[j]) % 2] > 0)\n {\n counter++;\n }\n }\n }\n if (counter % 2 == 0)\n {\n Console.WriteLine(\"Karen\");\n }\n else\n Console.WriteLine(\"Koyomi\");\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "00c986860ff2f2b4f24b9901631463a7", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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\t\t\t while (t-- > 0)\n {\n Solve();\n }\n Console.WriteLine();\n }\n\n#endif\n #endregion\n\n #region Solution\n \n\nstatic int []id;\n static int root(int x)\n{\n while(id[x] != x)\n {\n id[x] = id[id[x]];\n x = id[x];\n }\n return x;\n}\n\nstatic void union1(int x, int y)\n{\n int p = root(x);\n int q = root(y);\n id[p] = id[q];\n}\n\nstatic long gcd(int a,int b)\n{\n if(a==0)\n return (long)b;\n return gcd(b%a,a);\n}\n \n /// \n /// Solution\n /// \n private static void Solve()\n {\n int n=Console.NextInt();\n Console.SkipNextLine();\n int []ar=Console.NextInts(n);\n int []br=Console.NextInts(n);\n int []a=new int[2000001];\n for(int i=0;i0)\n {\n sum++;\n }\n }\n }\n if(sum%2==0)\n {\n Console.WriteLine(\"Karen\");\n }\n else\n Console.WriteLine(\"Koyomi\");\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 public char NextChar() => (char)Read();\n\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 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 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 public double NextDouble() => double.Parse(Next());\n\n \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 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 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 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 \n\n \n \n public static string Join(this IEnumerable e, string separator = \"\") => new StringBuilder().AppendJoin(e, separator).ToString();\n\n \n public static string Join(this IEnumerable e, char separator) => new StringBuilder().AppendJoin(e, separator).ToString();\n\n \n \n\n \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 pair or not\n /// \n /// Number to test\n /// True if the number is pair, false otherwise\n public static bool IsPair(this int n) => (n & 1) == 0;\n\n /// \n /// Tests if the given number is pair or not\n /// \n /// Number to test\n /// True if the number is pair, false otherwise\n public static bool IsPair(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 /// Returns the triangle number of the current number\n /// \n /// Integer to get the triangle number from\n /// The resulting triangle number\n public static int Triangle(this int n) => (n * (n + 1)) / 2;\n\n /// \n /// Returns the triangle number of the current number\n /// \n /// Long to get the triangle number from\n /// The resulting triangle number\n public static long Triangle(this long n) => (n * (n + 1L)) / 2L;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "02c931d1d1f7a68bf965882662b6effd", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0430\u0440 n:\");\n int n = Convert.ToInt32(Console.ReadLine());\n int[] Koemi = new int[n];\n int[] Karen = new int[n];\n HashSetNumbers = new HashSet();\n foreach (int cur in Koemi)\n Numbers.Add(cur);\n foreach (int cur in Karen)\n Numbers.Add(cur);\n int Count = 0;\n //Console.WriteLine(\"\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 \u0447\u0438\u0441\u0435\u043b \u041a\u043e\u0451\u043c\u0438:\");\n string buffer = Console.ReadLine();\n string[] bufferArray = buffer.Split(' ');\n for (int i = 0; i < bufferArray.Length; i++)\n Koemi[i] = Convert.ToInt32(bufferArray[i]);\n //Console.WriteLine(\"\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 \u0447\u0438\u0441\u0435\u043b \u041a\u0430\u0440\u0435\u043d\u0430:\");\n buffer = Console.ReadLine();\n bufferArray = buffer.Split(' ');\n for (int i = 0; i < bufferArray.Length; i++)\n Karen[i] = Convert.ToInt32(bufferArray[i]);\n int res;\n for(int i =0;i[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "11d07187b2ca499368a2484dc8f2cd45", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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\t\t\t while (t-- > 0)\n {\n Solve();\n }\n Console.WriteLine();\n }\n\n#endif\n #endregion\n\n #region Solution\n \n\nstatic int []id;\n static int root(int x)\n{\n while(id[x] != x)\n {\n id[x] = id[id[x]];\n x = id[x];\n }\n return x;\n}\n\nstatic void union1(int x, int y)\n{\n int p = root(x);\n int q = root(y);\n id[p] = id[q];\n}\n\nstatic long gcd(int a,int b)\n{\n if(a==0)\n return (long)b;\n return gcd(b%a,a);\n}\n \n /// \n /// Solution\n /// \n private static void Solve()\n {\n int n=Console.NextInt();\n Console.SkipNextLine();\n int []ar=Console.NextInts(n);\n int []br=Console.NextInts(n);\n int []a=new int[1000001];\n for(int i=0;i0)\n {\n sum++;\n }\n }\n }\n if(sum%2==0)\n {\n Console.WriteLine(\"Karen\");\n }\n else\n Console.WriteLine(\"Koyomi\");\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 public char NextChar() => (char)Read();\n\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 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 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 public double NextDouble() => double.Parse(Next());\n\n \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 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 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 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 \n\n \n \n public static string Join(this IEnumerable e, string separator = \"\") => new StringBuilder().AppendJoin(e, separator).ToString();\n\n \n public static string Join(this IEnumerable e, char separator) => new StringBuilder().AppendJoin(e, separator).ToString();\n\n \n \n\n \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 pair or not\n /// \n /// Number to test\n /// True if the number is pair, false otherwise\n public static bool IsPair(this int n) => (n & 1) == 0;\n\n /// \n /// Tests if the given number is pair or not\n /// \n /// Number to test\n /// True if the number is pair, false otherwise\n public static bool IsPair(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 /// Returns the triangle number of the current number\n /// \n /// Integer to get the triangle number from\n /// The resulting triangle number\n public static int Triangle(this int n) => (n * (n + 1)) / 2;\n\n /// \n /// Returns the triangle number of the current number\n /// \n /// Long to get the triangle number from\n /// The resulting triangle number\n public static long Triangle(this long n) => (n * (n + 1L)) / 2L;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b62f3643ec34c1bbe4225f2d8485250e", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 \u0447\u0438\u0441\u043b\u043e\");\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(\"\u0427\u0438\u0441\u043b\u0430 \u041a\u0430\u0440\u0435\u043d\");\n int[] Karen = new int[n];\n \n for(int i = 0; i < n; i++)\n {\n Karen[i] = Convert.ToInt32(Console.ReadLine()); \n } \n int[] Koyomi = new int[n];\n int sum = 0;\n Console.WriteLine(\"\u0427\u0438\u0441\u043b\u0430 \u041a\u043e\u0439\u043c\u0438\");\n for (int i = 0; i < n; i++)\n {\n Koyomi[i] = Convert.ToInt32(Console.ReadLine()); \n }\n for(int i = 0; i[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3635af9920b9d7209d553b2ff5bc36fa", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp80\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List l = new List();\n int[] t1 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] t2 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n l.AddRange(t1);\n l.AddRange(t2);\n int[] nums = new int[2001];\n for (int i = 0; i < l.Count; i++)\n {\n nums[l[i]]++;\n }\n int counter = 0;\n for (int i = 0; i 0)\n {\n counter++;\n }\n }\n }\n if (counter%2==0)\n {\n Console.WriteLine(\"Karen\");\n }\n else\n Console.WriteLine(\"Koyomi\");\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a6fcfeff3555764208e426fbde48326", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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.NextInt32();\n var xArray = sr.ReadArrayOfInt64();\n var yArray = sr.ReadArrayOfInt64();\n var free = new List();\n var busy = new int[2 * n + 1];\n for (var i = 0; i < n; i++) {\n busy[xArray[i]]++;\n busy[yArray[i]]++;\n }\n for (var i = 1; i < busy.Length; i++) {\n if (busy[i] > 1)\n free.Add(i);\n }\n var freeIndx = 0;\n for (var i = 0; i < xArray.Length; i++) {\n if (busy[xArray[i]] > 1) {\n xArray[i] = free[freeIndx];\n freeIndx++;\n busy[xArray[i]]--;\n }\n }\n var count = 0;\n for (var i = 0; i < xArray.Length; i++) {\n for (var j = 0; j < yArray.Length; j++) {\n var r = xArray[i] ^ yArray[j];\n if(r <= 2L*n)\n {\n count++;\n }\n }\n }\n\n if (count % 2 == 0) {\n sw.WriteLine(\"Karen\");\n }\n else {\n sw.WriteLine(\"Koyomi\");\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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "311e98010e3147ee8bcc07f4697c1e03", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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.NextInt32();\n var xArray = sr.ReadArrayOfInt64();\n var yArray = sr.ReadArrayOfInt64();\n var free = new List();\n var busy = new int[2 * n + 1];\n for (var i = 0; i < n; i++) {\n busy[xArray[i]]++;\n busy[yArray[i]]++;\n }\n for (var i = 1; i < busy.Length; i++) {\n if (busy[i] > 1)\n free.Add(i);\n }\n var freeIndx = 0;\n for (var i = 0; i < xArray.Length; i++) {\n if (busy[xArray[i]] > 1) {\n var old = xArray[i];\n xArray[i] = free[freeIndx];\n freeIndx++;\n busy[old]--;\n }\n if (busy[yArray[i]] > 1) {\n var old = yArray[i];\n yArray[i] = free[freeIndx];\n freeIndx++;\n busy[old]--;\n }\n }\n var count = 0;\n for (var i = 0; i < xArray.Length; i++) {\n for (var j = 0; j < yArray.Length; j++) {\n var r = xArray[i] ^ yArray[j];\n if(r <= 2L*n)\n {\n count++;\n }\n }\n }\n\n if (count % 2 == 0) {\n sw.WriteLine(\"Karen\");\n }\n else {\n sw.WriteLine(\"Koyomi\");\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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1614f5cea4e58b78736c572ea02e7220", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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.NextInt32();\n var xArray = sr.ReadArrayOfInt64();\n var yArray = sr.ReadArrayOfInt64();\n var free = new List();\n var busy = new int[2 * n + 1];\n for (var i = 0; i < n; i++) {\n busy[xArray[i]]++;\n busy[yArray[i]]++;\n }\n for (var i = 1; i < busy.Length; i++) {\n if (busy[i] == 0)\n free.Add(i);\n }\n var freeIndx = 0;\n for (var i = 0; i < xArray.Length; i++) {\n if (busy[xArray[i]] > 1) {\n var old = xArray[i];\n xArray[i] = free[freeIndx];\n freeIndx++;\n busy[old]--;\n }\n if (busy[yArray[i]] > 1) {\n var old = yArray[i];\n yArray[i] = free[freeIndx];\n freeIndx++;\n busy[old]--;\n }\n }\n var count = 0;\n for (var i = 0; i < xArray.Length; i++) {\n for (var j = 0; j < yArray.Length; j++) {\n var r = xArray[i] ^ yArray[j];\n if(r <= 2L*n)\n {\n count++;\n }\n }\n }\n\n if (count % 2 == 0) {\n sw.WriteLine(\"Karen\");\n }\n else {\n sw.WriteLine(\"Koyomi\");\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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec4aef75c16fe9fb84f0bc803c03796f", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 var a = ReadIntArray();\n var b = ReadIntArray();\n\n var c = new bool[3000000];\n foreach (int x in a)\n c[x] = true;\n foreach (int x in b)\n c[x] = true;\n\n bool ans = false;\n foreach (int aa in a)\n foreach (int bb in b)\n if (c[aa ^ bb])\n ans = !ans;\n\n Write(ans ? \"Koyomi\" : \"Karen\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3cd56956715c7ce1ba073c707b43be25", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 class Program\n {\n static void Main(string[] args)\n {\n#if __debug\n var n = Convert.ToInt32(\"3\");\n var n1 = \"1 2 3\".Split(' ').Select(nn => Convert.ToInt32(nn));\n var n2 = \"4 5 6\".Split(' ').Select(nn => Convert.ToInt32(nn));\n#else\n var n = Convert.ToInt32(Console.ReadLine());\n var n1 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();\n var n2 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();\n#endif\n\n Console.WriteLine(Check(n1, n2));\n }\n\n static string Check(IEnumerable n1, IEnumerable n2)\n {\n int pairs = 0;\n foreach (var nn in n1)\n {\n foreach (var nnn in n2)\n {\n int kkk = nn ^ nnn;\n#if __debug\nConsole.WriteLine($\"nn={nn} nnn={nnn} xor={kkk}\");\n#endif\n if (n1.Contains(kkk) || n2.Contains(kkk)) pairs++;\n }\n }\n#if __debug\nConsole.WriteLine($\"k={Koyomi} ky={Karen}\");\n#endif\n return pairs % 2 != 0 ? \"Koyomi\" : \"Karen\";\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "03baab47072d72d19485eb7ca987b483", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\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 var n = NextInt();\n\n int[] a = new int[n];\n int[] b = new int[n];\n\n int[] all = new int[n * 2];\n\n ReadTokens(n);\n for (int i = 0; i < n; i++)\n a[i] = all[i] = NextInt();\n\n ReadTokens(n);\n for (int i = 0; i < n; i++)\n b[i] = all[n + i] = NextInt();\n\n int count = 0;\n\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n for (int p = 0; p < all.Length; p++)\n {\n if ((a[i] ^ b[j]) == all[p])\n {\n count++;\n break;\n }\n }\n }\n\n Console.WriteLine((count % 2 == 0) ? \"Karen\" : \"Koyomi\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b708f789499f31036df74fcb1bba0158", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskH\n{\n class Program\n {\n static bool Tof(int val, int[] x, int[] y)\n {\n foreach (int element in x)\n if (val == element)\n return true;\n foreach (int element in y)\n if (val == element)\n return true;\n return false;\n }\n\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int count = 0;\n string name = \"Koyomi\";\n var x = Array.ConvertAll(Console.ReadLine().Split(' '), t => Int32.Parse(t));\n var y = Array.ConvertAll(Console.ReadLine().Split(' '), t => Int32.Parse(t));\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (Tof(x[i] ^ y[j], x, y))\n count++;\n if (count % 2 == 0)\n name = \"Karen\";\n Console.WriteLine(name);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5d7c506c91c2ff8be4b128f331ef3607", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 class Program\n {\n static void Main(string[] args)\n {\n#if __debug\n var n = Convert.ToInt32(\"3\");\n var n1 = \"2 4 6 8 10\".Split(' ').Select(nn => Convert.ToInt32(nn));\n var n2 = \"9 7 5 3 1\".Split(' ').Select(nn => Convert.ToInt32(nn));\n#else\n var n = Convert.ToInt32(Console.ReadLine());\n var n1 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();\n var n2 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();\n#endif\n\n Console.WriteLine(Check(n1, n2));\n }\n\n static string Check(IEnumerable n1, IEnumerable n2)\n {\n List l = new List();\n l.AddRange(n1);\n l.AddRange(n2);\n int half = l.Count / 2;\n int pairs = 0;\n for (int i = 0; i < half; i++)\n {\n for (int j = half; j < half*2; j++)\n {\n#if __debug\n Console.WriteLine($\"nn={l[i]} nnn={l[j]} xor={l[i] ^ l[j]}\");\n#endif\n if (l.Contains(l[i] ^ l[j])) pairs++;\n }\n }\n\n\n /*\n foreach (var nn in n1)\n {\n foreach (var nnn in n2)\n {\n int kkk = nn ^ nnn;\n#if __debug\nConsole.WriteLine($\"nn={nn} nnn={nnn} xor={kkk}\");\n#endif\n if (n1.Contains(kkk) || n2.Contains(kkk)) pairs++;\n }\n }\n\n*/\n#if __debug\n Console.WriteLine($\"pairs={pairs}\");\n#endif\n return pairs % 2 != 0 ? \"Koyomi\" : \"Karen\";\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "83d5d27f550059d878bf9dbe43355f06", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\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 var n = NextInt();\n\n int[] a = new int[n];\n int[] b = new int[n];\n\n int[] all = new int[n * 2];\n\n ReadTokens(n);\n for (int i = 0; i < n; i++)\n a[i] = all[i] = NextInt();\n\n ReadTokens(n);\n for (int i = 0; i < n; i++)\n b[i] = all[n + i] = NextInt();\n\n Array.Sort(all);\n\n int count = 0;\n\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (Array.IndexOf(all, (a[i] ^ b[j])) > -1)\n count++;\n\n Console.WriteLine((count % 2 == 0) ? \"Karen\" : \"Koyomi\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f4c2de9ba0438bb06adb5ae690dd5785", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "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 class Program\n {\n static void Main(string[] args)\n {\n#if __debug\n var n = Convert.ToInt32(\"3\");\n var n1 = \"1 2 3\".Split(' ').Select(nn => Convert.ToInt32(nn));\n var n2 = \"4 5 6\".Split(' ').Select(nn => Convert.ToInt32(nn));\n#else\n var n = Convert.ToInt32(Console.ReadLine());\n var n1 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();\n var n2 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();\n#endif\n\n Console.WriteLine(Check(n1, n2));\n }\n\n static string Check(IEnumerable n1, IEnumerable n2)\n {\n int Koyomi = 0;\n int Karen = 0;\n foreach (var nn in n1)\n {\n foreach (var nnn in n2)\n {\n int kkk = nn ^ nnn;\n#if __debug\nConsole.WriteLine($\"nn={nn} nnn={nnn} xor={kkk}\");\n#endif\n if (n1.Contains(kkk)) Koyomi++;\n else if (n2.Contains(kkk)) Karen++;\n }\n }\n#if __debug\nConsole.WriteLine($\"k={Koyomi} ky={Karen}\");\n#endif\n return Koyomi > Karen ? \"Koyomi\" : \"Karen\";\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9174c9031fc110aee0295c36f75b41ca", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n class Program\n {\n public static void Main()\n {\n var n = GetInt();\n var l = GetInt();\n var r = GetInt();\n var x = GetInt();\n var array = GetIntArray(n);\n\n var limit = 1 << n;\n var count = 0;\n\n for (int i = 0; i < limit; i++)\n {\n if (IsAvailable(array, i, l, r, x))\n {\n count++;\n }\n }\n\n Console.Write(count);\n }\n\n private static bool IsAvailable(int[] array, int mask, int l, int r, int x)\n {\n var min = int.MaxValue;\n var max = 0; \n var sum = 0;\n var count = 0;\n\n for (int i = 0; mask != 0; mask >>= 1, i++)\n {\n if ((mask & 1) == 1)\n {\n var cost = array[i];\n min = Math.Min(min, cost);\n max = Math.Max(max, cost);\n sum += cost;\n count++;\n }\n }\n\n return count >= 2\n && sum >= l \n && sum <= r \n && (max - min) >= x;\n }\n\n private static int[] GetIntArray(int count)\n {\n var result = new int[count];\n for (int i = 0; i < count; i++)\n {\n result[i] = GetInt();\n }\n\n return result;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9632aef4b72d5d92a80fac4efb327cb2", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 Round306\n{\n class Program\n {\n #region Common Helper\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 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 #endregion\n\n #region Problem A\n\n private static bool ProblemAHelper(string s, string input, string reverse)\n {\n var indexAB = s.IndexOf(input, StringComparison.InvariantCulture);\n if (indexAB == -1)\n return false;\n if (indexAB == 0)\n {\n if (s.Length < 4)\n {\n return false;\n }\n if (s.Substring(2, s.Length - 2).Contains(reverse))\n {\n return true;\n }\n }\n else if (s.Substring(0, indexAB - 1).Contains(reverse) || s.Substring(indexAB + 2, s.Length - indexAB - 2).Contains(reverse))\n {\n return true;\n }\n return false;\n }\n\n private static void ProblemA()\n {\n var s = Console.ReadLine();\n if (ProblemAHelper(s, \"AB\", \"BA\") || ProblemAHelper(s, \"BA\", \"AB\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring()\n {\n var s = Console.ReadLine();\n var subA = \"AB\";\n\n var indexA = s.IndexOf(subA, StringComparison.InvariantCulture);\n if (indexA == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n var subB = \"BA\";\n var indexB = s.LastIndexOf(subB, StringComparison.InvariantCulture);\n if (indexB == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (indexA + 1 < indexB)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n indexA = s.LastIndexOf(subA);\n indexB = s.IndexOf(subB);\n if (indexB + 1 < indexA)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n\n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring2()\n {\n var s = Console.ReadLine();\n Console.WriteLine(s.Contains(\"AB\") && s.Contains(\"BA\") &&\n (s.LastIndexOf(\"BA\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) ||\n s.LastIndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"BA\", StringComparison.OrdinalIgnoreCase))\n ? \"YES\": \"NO\");\n }\n\n #endregion\n\n #region Problem B\n\n private static IEnumerable> powerSet(IList input, int n = 1)\n {\n var data = input.ToArray();\n for (var i = 0; i < ((n + 1) << (data.Length-1)); i++)\n {\n var tempList = new List(n + 1);\n //tempList.AddRange(data.Where((t, j) => (i >> j)%2 == 1));\n tempList.AddRange(data.Where((t, j) => (i & (1 << j)) != 0));\n /*for (var j = 0; j < data.Length; j++)\n {\n if ((i & (1 << j)) !=0)\n { tempList.Add(data[j]);}\n }*/\n yield return tempList;\n }\n\n }\n\n private static void TestPowerSet()\n {\n var r = powerSet(new[] { 1, 2, 3 });\n foreach (var i in r)\n {\n foreach (var re in i)\n Console.Write(re);\n Console.WriteLine();\n }\n }\n\n private static void ProblemB()\n {\n var n = Next();\n var l = Next();\n var r = Next();\n var x = Next();\n var c = new int[n];\n for (var i = 0; i < n; i++)\n c[i] = Next();\n\n //reader.Close();\n var ans = 0;\n var total = 2 << (n - 1);\n for (var i = 0; i < total; i++)\n {\n var min = int.MaxValue;\n var max = 0;\n var sum = 0;\n //var count = 0;\n for (var j = 0; j < n; j++)\n {\n //if ((i >> j)%2 == 1)\n if ((i & (1 < r)\n break;\n max = Math.Max(max, c[j]);\n \n min = Math.Min(min, c[j]);\n //count++;\n }\n }\n if (sum <= r && sum >= l && max - min >= x) \n ans++;\n }\n\n\n Console.WriteLine(ans);\n }\n\n #endregion\n static void Main(string[] args)\n {\n //ProblemA();\n //TwoSubstring();\n //TwoSubstring2();\n\n ProblemB();\n \n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d77b5c6337531f0d4060939df6a8786", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Security.Cryptography;\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 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 canAuto(string s, string s1)\n\t\t{\n\t\t\tvar l = 0;\n\t\t\tfor (var i = 0; i < s1.Length; ++i)\n\t\t\t{\n\t\t\t\twhile (l < s.Length && s[l] != s1[i])\n\t\t\t\t\tl++;\n\t\t\t\tif (l == s.Length)\n\t\t\t\t\treturn false;\n\t\t\t\tl++;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic static bool canArray(string s, string s1)\n\t\t{\n\t\t\tvar l = s.ToCharArray().ToList();\n\t\t\tvar l1 = s1.ToCharArray().ToList();\n\t\t\tl.Sort();\n\t\t\tl1.Sort();\n\t\t\tif (l.Count != l1.Count)\n\t\t\t\treturn false;\n\n\t\t\tfor (var i = 0; i < l.Count; ++i)\n\t\t\t\tif (l[i] != l1[i])\n\t\t\t\t\treturn false;\n\t\t\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic static bool canBoth(string s, string s1)\n\t\t{\n\t\t\tvar l = s.ToCharArray().ToList();\n\t\t\tvar l1 = s1.ToCharArray().ToList();\n\t\t\tl.Sort();\n\t\t\tl1.Sort();\n\t\t\tvar ll = 0;\n\t\t\tfor (var i = 0; i < l1.Count; ++i)\n\t\t\t{\n\t\t\t\twhile (ll < l.Count && l[ll] != l1[i])\n\t\t\t\t\tll++;\n\t\t\t\tif (ll == l.Count)\n\t\t\t\t\treturn false;\n\t\t\t\tll++;\n\t\t\t}\n\n\t\t\treturn true;\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 ar = getList();\n\t\t\tvar n = ar[0];\n\t\t\tvar l = ar[1];\n\t\t\tvar r = ar[2];\n\t\t\tvar x = ar[3];\n\t\t\tar = getList();\n\t\t\tar.Sort();\n\t\t\tvar ans = 0;\n\t\t\tvar tasks = new List { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false };\n\t\t\tfor (var i = 1; i <= (2 << (n - 1)) - 1; ++i)\n\t\t\t{\n\t\t\t\tvar j = i;\n\t\t\t\tvar q = 0;\n\t\t\t\twhile (j != 0)\n\t\t\t\t{\n\t\t\t\t\ttasks[q] = false;\n\t\t\t\t\tif (j % 2 == 1)\n\t\t\t\t\t\ttasks[q] = true;\n\t\t\t\t\tj /= 2;\n\t\t\t\t\tq++;\n\t\t\t\t}\n\t\t\t\tvar min = 10000000;\n\t\t\t\tvar max = 0;\n\t\t\t\tvar sum = 0;\n\t\t\t\tvar ct = 0;\n\t\t\t\tfor (var e = 0; e < 15; ++e)\n\t\t\t\t{\n\t\t\t\t\tif (tasks[e])\n\t\t\t\t\t{\n\t\t\t\t\t\tsum += ar[e];\n\t\t\t\t\t\tct++;\n\t\t\t\t\t\tmin = Min(min, ar[e]);\n\t\t\t\t\t\tmax = Max(max, ar[e]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (ct >= 2 && sum >= l && sum <= r && max - min >= x)\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c6e612ffe7338c4d553be9240cc16965", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 int[] sum = new int[(1 << 15)];\n static int[] min = new int[(1 << 15)];\n static int[] max = new int[(1 << 15)];\n static int[] c = new int[15];\n static void dp(int number) {\n int exp = -1, aux = number;\n while (aux > 0) {\n aux /= 2;\n exp++;\n }\n aux = number - (1 << exp);\n sum[number] = sum[aux] + c[exp];\n max[number] = Math.Max(max[aux], c[exp]);\n min[number] = Math.Min(min[aux], c[exp]);\n if (min[number] == 0) {\n min[number] = c[exp];\n }\n }\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]), l = int.Parse(s[1]), r = int.Parse(s[2]), x = int.Parse(s[3]);\n c = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));\n int vm = (1 << n), ans = 0;\n for (int i = 1; i < vm; i++) {\n dp(i);\n if (sum[i] >= l && sum[i] <= r && (max[i] - min[i]) >= x) {\n ans++;\n }\n }\n Console.Write(ans);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "40543ad8bbbc14be920688cf29c25d44", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 Round306\n{\n class Program\n {\n #region Common Helper\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 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 #endregion\n\n #region Problem A\n\n private static bool ProblemAHelper(string s, string input, string reverse)\n {\n var indexAB = s.IndexOf(input, StringComparison.InvariantCulture);\n if (indexAB == -1)\n return false;\n if (indexAB == 0)\n {\n if (s.Length < 4)\n {\n return false;\n }\n if (s.Substring(2, s.Length - 2).Contains(reverse))\n {\n return true;\n }\n }\n else if (s.Substring(0, indexAB - 1).Contains(reverse) || s.Substring(indexAB + 2, s.Length - indexAB - 2).Contains(reverse))\n {\n return true;\n }\n return false;\n }\n\n private static void ProblemA()\n {\n var s = Console.ReadLine();\n if (ProblemAHelper(s, \"AB\", \"BA\") || ProblemAHelper(s, \"BA\", \"AB\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring()\n {\n var s = Console.ReadLine();\n var subA = \"AB\";\n\n var indexA = s.IndexOf(subA, StringComparison.InvariantCulture);\n if (indexA == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n var subB = \"BA\";\n var indexB = s.LastIndexOf(subB, StringComparison.InvariantCulture);\n if (indexB == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (indexA + 1 < indexB)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n indexA = s.LastIndexOf(subA);\n indexB = s.IndexOf(subB);\n if (indexB + 1 < indexA)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n\n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring2()\n {\n var s = Console.ReadLine();\n Console.WriteLine(s.Contains(\"AB\") && s.Contains(\"BA\") &&\n (s.LastIndexOf(\"BA\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) ||\n s.LastIndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"BA\", StringComparison.OrdinalIgnoreCase))\n ? \"YES\": \"NO\");\n }\n\n #endregion\n\n #region Problem B\n\n private static IEnumerable> powerSet(IList input, int n = 1)\n {\n var data = input.ToArray();\n for (var i = 0; i < ((n + 1) << data.Length); i++)\n {\n var tempList = new List(n + 1);\n tempList.AddRange(data.Where((t, j) => (i >> j)%2 == 1));\n yield return tempList;\n }\n\n }\n\n private static void ProblemB()\n {\n var n = Next();\n var l = Next();\n var r = Next();\n var x = Next();\n var c = new int[n];\n for (var i = 0; i < n; i++)\n c[i] = Next();\n\n reader.Close();\n var ans = 0;\n var total = 2 << (n - 1);\n for (var i = 0; i < total; i++)\n {\n var min = int.MaxValue;\n var max = 0;\n var sum = 0;\n var count = 0;\n //var tempList = c.Where((t, j) => (i1 >> j)%2 == 1).ToArray();\n for (var j = 0; j < n; j++)\n {\n if ((i >> j)%2 == 1)\n {\n sum += c[j];\n max = Math.Max(max, c[j]);\n min = Math.Min(min, c[j]);\n count++;\n }\n }\n //if (tempList.Length > 1 && tempList.Sum() >= l && tempList.Sum() <= r && tempList.Max() - tempList.Min() >= x)\n if (count > 1 && sum <= r && sum >= l && max - min >= x) \n ans++;\n }\n\n\n Console.WriteLine(ans);\n }\n\n #endregion\n static void Main(string[] args)\n {\n //ProblemA();\n //TwoSubstring();\n //TwoSubstring2();\n\n ProblemB();\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4a44ec65973e7e6f7e125c780c69e7a3", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 private static int[] cntChars(string a)\n {\n\n int[] ans = new int[26];\n\n for (int i = 0; i < a.Length; i++)\n {\n ans[a[i] - 'a'] = 0;\n }\n\n for (int i = 0; i < a.Length; i++)\n {\n ans[a[i] - 'a']++;\n }\n\n return ans;\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 //----------------------------------------------------------------------------\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 \n \n \n\n static void Main(string[] args)\n {\n int n = 0, l = 0, r = 0, x = 0;\n\n ReadInts(ref n, ref l, ref r, ref x);\n\n int[] c = ReadIntArrayLine();\n\n PrintLn(solve(n,l,r,x,c));\n\n\n }\n\n\n\n private static int solve(int n, int l, int r, int x, int[] c)\n {\n var selected = new List();\n\n return solverec(n, 0 ,selected, l, r, x, c);\n }\n\n private static int solverec(int n, int v,List selected, int l, int r, int x, int[] c)\n {\n if (v == n)\n {\n if (selected.Sum() >= l && selected.Sum() <= r && (selected.Max() - selected.Min()) >= x)\n return 1;\n else\n return 0;\n }\n\n int temp = solverec(n,v+1,selected,l,r,x, c);\n selected.Add(c[v]);\n temp+= solverec(n, v + 1, selected, l, r, x, c);\n selected.RemoveAt(selected.Count - 1);\n\n return temp;\n }\n } \n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "52cbaa0155c4b37c922483dd75174283", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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\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 l = int.Parse(sp[1]);\n\t\t\tint r = int.Parse(sp[2]);\n\t\t\tint x = int.Parse(sp[3]);\n\t\t\tint[] c = new int[n];\n\t\t\tsp = Console.ReadLine().Split(' ');\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tc[i] = int.Parse(sp[i]);\n\t\t\t}\n\t\t\tArray.Sort(c);\n\n\t\t\tlong[] s = new long[n];\n\t\t\ts[0] = c[0];\n\t\t\tfor (int i = 1; i < n; i++)\n\t\t\t{\n\t\t\t\ts[i] = s[i - 1] + c[i];\n\t\t\t}\n\n\t\t\tList> lt = new List>();\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tfor (int j = i + 1; j < n; j++)\n\t\t\t\t{\n\t\t\t\t\tif (c[j] - c[i] >= x)\n\t\t\t\t\t{\n\t\t\t\t\t\tlt.Add(new KeyValuePair(i, j));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 0; i < lt.Count; i++)\n\t\t\t{\n\t\t\t\tint mi = lt[i].Key;\n\t\t\t\tint mx = lt[i].Value;\n\t\t\t\tlong ss = mi - 1 >= 0 ? s[mx] - s[mi - 1] : s[mx];\n\t\t\t\tif (ss < l)\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// count\n\t\t\t\t\tbar(c, mi+1, mx-1, l, r, new bool[mx-mi-1], 0, ref cnt);\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(cnt);\n\t\t}\n\n\t\tprivate void bar(int[] c, int mi, int mx, int l, int r, bool[] f, int i, ref int cnt)\n\t\t{\n\t\t\tif (mi+i > mx)\n\t\t\t{\n\t\t\t\tint sum = c[mi-1]+c[mx+1];\n\t\t\t\tfor (int k = 0; k < f.Length; k++)\n\t\t\t\t{\n\t\t\t\t\tif (f[k])\n\t\t\t\t\t{\n\t\t\t\t\t\tsum += c[mi + k];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (sum >= l && sum <= r)\n\t\t\t\t\tcnt++;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tf[i] = true;\n\t\t\t\tbar(c, mi, mx, l, r, f, i+1, ref cnt);\n\t\t\t\tf[i] = false;\n\t\t\t\tbar(c, mi, mx, l, r, f, i+1, ref cnt);\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc59309c5d4f4a7f4093a59737c78ec5", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task3\n{\n class Program\n { \n static void Main(string[] args)\n {\n int productsCount;\n int minWeight;\n int maxWeight;\n int minDifference;\n List weights = new List();\n\n string[] inputString = Console.ReadLine().Split(' ');\n \n productsCount = Convert.ToInt32(inputString[0]);\n minWeight = Convert.ToInt32(inputString[1]);\n maxWeight = Convert.ToInt32(inputString[2]);\n minDifference = Convert.ToInt32(inputString[3]);\n\n string[] inputWeights = Console.ReadLine().Split(' ');\n\n if (inputWeights.Length != productsCount)\n {\n Console.WriteLine(\"count weights error!!!\");\n return;\n }\n\n for (int i = 0; i < productsCount; i++)\n {\n weights.Add(Convert.ToInt32(inputWeights[i]));\n }\n\n List> productSets = CreateProductSets(weights);\n\n int countVar = 0;\n\n foreach (List subset in productSets)\n {\n int totalWeight = subset.Sum();\n int heaviestItem = subset.Max();\n int easiestItem = subset.Min();\n int difference = heaviestItem - easiestItem;\n\n if (totalWeight >= minWeight && totalWeight <= maxWeight)\n if (difference >= minDifference)\n countVar++; \n }\n Console.WriteLine(countVar);\n }\n\n static List> CreateProductSets(List weights)\n {\n List> productSets = new List>();\n\n for (int i = 0; i < weights.Count; i++)\n {\n int subsetCount = productSets.Count;\n productSets.Add(new List { weights[i] });\n\n for (int j = 0; j < subsetCount; j++)\n {\n int[] newSubset = new int[productSets[j].Count + 1];\n productSets[j].CopyTo(newSubset, 0);\n newSubset[newSubset.Length - 1] = weights[i];\n productSets.Add(newSubset.ToList());\n }\n }\n\n return productSets;\n }\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3ad80815e35650aa799a742079eff461", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n \nclass Program\n{\n private static void Main()\n {\n int result = 0;\n \n var nlrx = ConsoleReadLineAsArrayOfIntegers();\n int n = nlrx[0]; int l = nlrx[1]; int r = nlrx[2]; int x = nlrx[3];\n \n var cc = ConsoleReadLineAsArrayOfIntegers();\n List ccc = new List(cc);\n ccc.Sort();\n \n //bool[] bits = new bool[n];\n \n int MAX = (int) Math.Pow(2, n);\n //Console.WriteLine(\"MAX = \" + MAX);\n for(int i = 0; i <= MAX; i++)\n {\n if ((i & (i - 1)) == 0) continue;\n \n int sum = 0;\n int min = Int32.MaxValue;\n int max = Int32.MinValue;\n \n for(int j = 0; j < n; j++)\n {\n if ((i & (1 << j)) != 0)\n {\n sum += ccc[j];\n if (max > r) break;\n if (min > ccc[j]) min = ccc[j];\n if (max < ccc[j]) max = ccc[j];\n //Console.Write(\" \" + ccc[j]);\n }\n }\n \n int d = max - min;\n \n //Console.Write(\" d = \" + d + \" min = \" + min + \" max = \" + max);\n \n if (l <= sum && sum <= r && d >= x)\n {\n //Console.WriteLine(\" OK\");\n result++;\n }\n //else\n // Console.WriteLine(\" ERROR\");\n }\n \n Console.WriteLine(\"\" + result);\n }\n \n private static int[] ConsoleReadLineAsArrayOfIntegers()\n {\n return Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n }\n \n private static int ConsoleReadLineAsInteger()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n \n private static void ConsoleWriteLine(string line)\n {\n Console.WriteLine(line);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d5e3880c4ada34d4c8d42ad30559eaa1", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 Round306\n{\n class Program\n {\n #region Common Helper\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 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 #endregion\n\n #region Problem A\n\n private static bool ProblemAHelper(string s, string input, string reverse)\n {\n var indexAB = s.IndexOf(input, StringComparison.InvariantCulture);\n if (indexAB == -1)\n return false;\n if (indexAB == 0)\n {\n if (s.Length < 4)\n {\n return false;\n }\n if (s.Substring(2, s.Length - 2).Contains(reverse))\n {\n return true;\n }\n }\n else if (s.Substring(0, indexAB - 1).Contains(reverse) || s.Substring(indexAB + 2, s.Length - indexAB - 2).Contains(reverse))\n {\n return true;\n }\n return false;\n }\n\n private static void ProblemA()\n {\n var s = Console.ReadLine();\n if (ProblemAHelper(s, \"AB\", \"BA\") || ProblemAHelper(s, \"BA\", \"AB\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring()\n {\n var s = Console.ReadLine();\n var subA = \"AB\";\n\n var indexA = s.IndexOf(subA, StringComparison.InvariantCulture);\n if (indexA == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n var subB = \"BA\";\n var indexB = s.LastIndexOf(subB, StringComparison.InvariantCulture);\n if (indexB == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (indexA + 1 < indexB)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n indexA = s.LastIndexOf(subA);\n indexB = s.IndexOf(subB);\n if (indexB + 1 < indexA)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n\n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring2()\n {\n var s = Console.ReadLine();\n Console.WriteLine(s.Contains(\"AB\") && s.Contains(\"BA\") &&\n (s.LastIndexOf(\"BA\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) ||\n s.LastIndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"BA\", StringComparison.OrdinalIgnoreCase))\n ? \"YES\": \"NO\");\n }\n\n #endregion\n\n #region Problem B\n\n private static IEnumerable> powerSet(IList input, int n = 1)\n {\n var data = input.ToArray();\n for (var i = 0; i < ((n + 1) << data.Length); i++)\n {\n var tempList = new List(n + 1);\n tempList.AddRange(data.Where((t, j) => (i >> j)%2 == 1));\n yield return tempList;\n }\n\n }\n\n private static void ProblemB()\n {\n var n = Next();\n var l = Next();\n var r = Next();\n var x = Next();\n var c = new int[n];\n for (var i = 0; i < n; i++)\n c[i] = Next();\n\n var ans = 0;\n for (var i = 0; i < (2 << (n-1)); i++)\n {\n int i1 = i;\n var tempList = c.Where((t, j) => (i1 >> j)%2 == 1).ToList();\n if (tempList.Count > 1 && tempList.Sum() >= l && tempList.Sum() <= r && tempList.Max() - tempList.Min() >= x)\n ans++;\n }\n\n\n Console.WriteLine(ans);\n }\n\n #endregion\n static void Main(string[] args)\n {\n //ProblemA();\n //TwoSubstring();\n //TwoSubstring2();\n\n ProblemB();\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "efd4a4aba8ab0ebe1b25ecfe43f90fa8", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeff\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 void Solve()\n {\n int n = ReadInt();\n int l = ReadInt();\n int r = ReadInt();\n int x = ReadInt();\n var a = ReadIntArray();\n\n int ans = 0;\n for (int i = 0; i < 1 << n; i++)\n {\n int min = int.MaxValue;\n int max = int.MinValue;\n int sum = 0;\n int cnt = 0;\n for (int j = 0; j < n; j++)\n if ((i >> j & 1) == 1)\n {\n min = Math.Min(min, a[j]);\n max = Math.Max(max, a[j]);\n sum += a[j];\n cnt++;\n }\n if (max - min >= x && sum >= l && sum <= r && cnt > 1)\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(\"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)\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7b2d02c219162f54fa12f56f360780d2", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static long Rec(long ss, long i, long s, long l, long r, long x, long n, long[] mas, long k)\n {\n s += mas[i];\n if ((s <= r) && (s >= l) && ((mas[i] - mas[k]) >= x))\n {\n ss++;\n }\n if (s < r)\n {\n for (long j = i + 1; j < n; j++)\n {\n ss = Rec(ss, j, s, l, r, x, n, mas, k);\n }\n }\n return ss;\n }\n static void Main(string[] args)\n {\n long n, l, r, x;\n\n string[] lines = Console.ReadLine().Split(' ');\n n = long.Parse(lines[0]);\n l = long.Parse(lines[1]);\n r = long.Parse(lines[2]);\n x = long.Parse(lines[3]);\n long[] mas;\n mas = new long[n];\n string[] lines1 = Console.ReadLine().Split(' ');\n for (long i = 0; i < n; i++)\n mas[i] = long.Parse(lines1[i]);\n\n for (long i = 0; i < mas.Length; i++)\n {\n for (long j = 0; j < mas.Length - 1; j++)\n {\n if (mas[j] > mas[j + 1])\n {\n long z = mas[j];\n mas[j] = mas[j + 1];\n mas[j + 1] = z;\n }\n }\n }\n long s = 0, ss = 0, sl = 0;\n for (long jj = 0; jj < (n - 1); jj++)\n {\n sl = Rec(0, jj, s, l, r, x, n, mas, jj);\n ss += sl;\n }\n Console.WriteLine(ss);\n // Console.ReadLine();\n }\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "78902a00ec045c4d1740daf07398e112", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _550B\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int l = int.Parse(tokens[1]);\n int r = int.Parse(tokens[2]);\n int x = int.Parse(tokens[3]);\n\n int[] c = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n int ways = 0;\n\n for (int i = 0; i < Math.Pow(2, n); i++)\n {\n var tasks = Enumerable.Range(0, n).Where(j => (i & (1 << j)) != 0).Select(j => c[j]).ToList();\n\n if (tasks.Count >= 2 && tasks.Sum() >= l && tasks.Sum() <= r && tasks.Max() - tasks.Min() >= x)\n {\n ways++;\n }\n }\n\n Console.WriteLine(ways);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8bd308a77996635b5d0654b63d396d2a", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Threading.Tasks;\n\npublic class Test\n{\n public static void Main()\n {\n string[] num = Console.ReadLine().Trim().Split();\n int n = int.Parse(num[0]);\n long mn = long.Parse(num[1]);\n long mx = long.Parse(num[2]);\n long df = long.Parse(num[3]);\n \n int[] a = Console.ReadLine().Trim().Split().Select(h => int.Parse(h)).ToArray(); \n Console.WriteLine(ways(a, n, mn, mx, df));\n }\n \n public static int ways(int[] a, int n, long mn, long mx, long df)\n {\n int mask = 3, count = 0, j, i = 0;\n long minV, maxV;\n long sum;\n int end = 1 << n;\n for (; mask <= end; mask++)\n {\n minV = 1000000000; maxV = 1;\n sum = 0; i = 0;\n for (j = 0; j < n; j++)\n {\n if ((mask & (1 << j)) != 0)\n {\n i++;\n if(maxV < a[j])\n maxV = a[j];\n if(minV > a[j])\n minV = a[j];\n sum += a[j];\n }\n }\n\n if ((i >= 2) && (sum >= mn) && (sum <= mx) && (maxV - minV >= df))\n count++;\n \n }\n return count;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c76c66f5532bc568f3e58ce027fc80e", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static long Rec(long ss, long i, long s, long l, long r, long x, long n, long[] mas, long k)\n {\n s += mas[i];\n if ((s <= r) && (s >= l) && ((mas[i] - mas[k]) >= x))\n {\n ss++;\n }\n if (s < r)\n {\n for (long j = i + 1; j < n; j++)\n {\n ss = Rec(ss, j, s, l, r, x, n, mas, k);\n }\n }\n return ss;\n }\n static void Main(string[] args)\n {\n long n, l, r, x;\n\n string[] lines = Console.ReadLine().Split(' ');\n n = long.Parse(lines[0]);\n l = long.Parse(lines[1]);\n r = long.Parse(lines[2]);\n x = long.Parse(lines[3]);\n long[] mas;\n mas = new long[n];\n string[] lines1 = Console.ReadLine().Split(' ');\n for (long i = 0; i < n; i++)\n mas[i] = long.Parse(lines1[i]);\n\n for (long i = 0; i < mas.Length; i++)\n {\n for (long j = 0; j < mas.Length - 1; j++)\n {\n if (mas[j] > mas[j + 1])\n {\n long z = mas[j];\n mas[j] = mas[j + 1];\n mas[j + 1] = z;\n }\n }\n }\n long s = 0, ss = 0, sl = 0;\n for (long jj = 0; jj < (n - 1); jj++)\n {\n sl = Rec(0, jj, s, l, r, x, n, mas, jj);\n ss += sl;\n }\n Console.WriteLine(ss);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9575ad74274708d50f23bd4d151ae7d3", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces306_B\n{\n\n\tclass ContestIO : IDisposable\n\t{\n\t\tconst int BufferSize = 1024 * 8;\n\t\tconst string DefaultFileName = \"input.txt\";\n\n\t\tStreamReader reader;\n\t\tStreamWriter writer;\n\n\t\tbool TrailNewLines = false;\n\n\t\tpublic ContestIO(string fileName = null, bool trailNewLines = false)\n\t\t{\n#if DEBUG\n\t\t\tvar args = Environment.GetCommandLineArgs();\n\t\t\tif (args.Length > 1)\n\t\t\t\tfileName = args[1];\n\t\t\telse if (fileName == null)\n\t\t\t\tfileName = DefaultFileName;\n\n\t\t\tif (File.Exists(fileName))\n\t\t\t{\n\t\t\t\treader = new StreamReader(File.OpenRead(fileName), Encoding.ASCII, false, BufferSize);\n\n\t\t\t\tvar outFileName = fileName + \".out.txt\";\n\t\t\t\tif (File.Exists(outFileName))\n\t\t\t\t\tFile.Delete(outFileName);\n\t\t\t\twriter = new StreamWriter(File.OpenWrite(outFileName), Encoding.ASCII, BufferSize);\n\t\t\t}\n\n\t\t\tif (reader == null || writer == null)\n\t\t\t{\n#endif\n\t\t\t\treader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n\t\t\t\twriter = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize);\n#if DEBUG\n\t\t\t}\n#endif\n\t\t\tTrailNewLines = trailNewLines;\n\t\t}\n\n\t\tbool IsDigit(int c)\n\t\t{\n\t\t\treturn c >= '0' && c <= '9';\n\t\t}\n\t\tbool IsNewLine(int c)\n\t\t{\n\t\t\treturn c == '\\n' || c == '\\r';\n\t\t}\n\n\t\tpublic int Read()\n\t\t{\n\t\t\tint c;\n\t\t\twhile (!IsDigit(c = reader.Read())) { }\n\n\t\t\tint r = c - '0';\n\t\t\twhile (IsDigit(c = reader.Read()))\n\t\t\t\tr = r * 10 + c - '0';\n\n\t\t\tif (TrailNewLines)\n\t\t\t\tTrail();\n\t\t\treturn r;\n\t\t}\n\t\tpublic int[] ReadArray(int size)\n\t\t{\n\t\t\tvar r = new int[size];\n\t\t\tfor (var i = 0; i < size; i++)\n\t\t\t\tr[i] = Read();\n\t\t\treturn r;\n\t\t}\n\t\tpublic string ReadLine()\n\t\t{\n\t\t\treturn reader.ReadLine();\n\t\t}\n\t\tpublic void Trail()\n\t\t{\n\t\t\twhile (IsNewLine(reader.Peek()))\n\t\t\t\treader.Read();\n\t\t}\n\n\t\tpublic void Write(int v)\n\t\t{\n\t\t\twriter.Write(v);\n\t\t\twriter.Write(' ');\n\t\t}\n\t\tpublic void Write(long v)\n\t\t{\n\t\t\twriter.Write(v);\n\t\t\twriter.Write(' ');\n\t\t}\n\t\tpublic void Write(IEnumerable arr)\n\t\t{\n\t\t\tforeach (var v in arr)\n\t\t\t{\n\t\t\t\twriter.Write(v);\n\t\t\t\twriter.Write(' ');\n\t\t\t}\n\t\t}\n\t\tpublic void WriteLine(string text = null)\n\t\t{\n\t\t\tif (text != null)\n\t\t\t\twriter.Write(text);\n\t\t\twriter.Write('\\n');\n\t\t}\n\n\t\tpublic void Init(T[] arr) where T : new()\n\t\t{\n\t\t\tfor (var i = 0; i < arr.Length; i++)\n\t\t\t\tarr[i] = new T();\n\t\t}\n\t\tpublic void Init(T[] arr, Func init) where T : new()\n\t\t{\n\t\t\tfor (var i = 0; i < arr.Length; i++)\n\t\t\t\tarr[i] = init();\n\t\t}\n\n\t\tpublic void Dispose()\n\t\t{\n\t\t\twriter.Flush();\n\t\t}\n\t}\n\n\tclass Program\n\t{\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\tint n = io.Read(), l = io.Read(), r = io.Read(), x = io.Read();\n\t\t\t\tvar c = io.ReadArray(n).OrderBy(ci => ci).ToArray();\n\n\t\t\t\tlong result = 0;\n\t\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tresult += SolveRec(c, n, l, r, x, c[i], i + 1, c[i], c[i]);\n\t\t\t\t}\n\t\t\t\tio.Write(result);\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t}\n\t\tstatic int SolveRec(int[] c, int n, int l, int r, int x, long sum, int pos, int min, int max)\n\t\t{\n\t\t\tvar result = 0;\n\t\t\tif (sum <= r && sum >= l && (max - min) >= x)\n\t\t\t\tresult += 1;\n\n\t\t\tif (sum > r)\n\t\t\t\treturn 0;\n\t\t\t\n\t\t\tfor (var i = pos; i < n; i++)\n\t\t\t\tresult += SolveRec(c, n, l, r, x, sum + c[i], i + 1, min, c[i]);\n\t\t\treturn result;\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e63e78625b9026719992db38f48c861", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static long Rec(long ss,long i, long s, long l,long r,long x, long n, long [] mas,long k)\n {\n s += mas[i];\n if ((s <= r) && (s >= l) && ((mas[i] - mas[k]) >= x))\n {\n ss++;\n }\n if (s < r)\n {\n for (long j = i + 1; j < n; j++)\n {\n ss=Rec(ss,j, s,l,r,x,n,mas,k);\n }\n }\n return ss;\n }\n static void Main(string[] args)\n {\n long n,l,r,x;\n\n string[] lines = Console.ReadLine().Split(' ');\n n = long.Parse(lines[0]);\n l = long.Parse(lines[1]);\n r = long.Parse(lines[2]);\n x = long.Parse(lines[3]);\n long[] mas;\n mas = new long[n];\n string[] lines1 = Console.ReadLine().Split(' ');\n for (long i = 0; i < n;i++ )\n mas[i] = long.Parse(lines1[i]);\n\n for (long i = 0; i < mas.Length; i++)\n {\n for (long j = 0; j < mas.Length - 1; j++)\n {\n if (mas[j] > mas[j + 1])\n {\n long z = mas[j];\n mas[j] = mas[j + 1];\n mas[j + 1] = z;\n }\n }\n }\n long s = 0,ss=0,sl=0;\n for (long jj = 0; jj < (n-1);jj++ )\n {\n sl = Rec(0, jj, s, l, r, x, n, mas,jj);\n ss += sl;\n }\n Console.WriteLine(ss);\n // Console.ReadLine();\n }\n\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b836868463df35cc66c38b52a2ecfec", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "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[] info = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); //\u043a\u043e\u043b-\u0432\u043e, \u043c\u0438\u043d.\u0432\u0435\u0441, \u043c\u0430\u043a\u0441.\u0432\u0435\u0441, \u043c\u0438\u043d.\u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432\u0435\u0441\u0430\n int[] items = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Array.Sort(items);\n \n List combos = GetCombination(items);\n int NumOfWays = GetNumOfWays(combos, info[1], info[2], info[3]);\n Console.WriteLine(NumOfWays);\n Console.ReadLine();\n\n }\n static int GetNumOfWays(List combos, int minP, int maxP, int minDifference)\n {\n int numOfWays = 0;\n foreach (int[] combo in combos.ToArray())\n {\n if(checkCombination(combo, minP, maxP, minDifference))\n numOfWays++;\n }\n return numOfWays;\n }\n static bool checkCombination(int[] combo, int minP, int maxP, int minDifference)\n {\n if (combo.Length > 1)\n {\n //Array.Sort(combo);\n if ((combo[combo.Length - 1] - combo[0]) < minDifference)\n return false;\n }\n\n int p = 0;\n foreach (int item in combo)\n p += item;\n\n if(p < minP ^ p > maxP)\n return false;\n return true;\n }\n static List GetCombination(int[] items)\n {\n int countCombos = Convert.ToInt32(Math.Pow(2, items.Count())) - 1;\n // char[] mask;\n string mask;\n List combos = new List();\n List temp = new List();\n for (int i = 1; i <= countCombos; i++)\n {\n mask = Convert.ToString(i, 2);//.PadLeft(items.Count(), '0').ToArray();\n //for (int j = 0; j < mask.Length; j++)\n for (int j = mask.Length-1; j >=0; j--)\n {\n if (mask[j] == '1')\n temp.Add(items[mask.Length-j-1]);\n }\n if (temp.Count > 1)\n combos.Add(temp.ToArray());\n temp.Clear();\n }\n return combos;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "503472da7ddf172af9aabcf9312fec77", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Preparing_Olympiad\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n byte n = byte.Parse(input[0]);\n int l = int.Parse(input[1]),\n r = int.Parse(input[2]),\n x = int.Parse(input[3]);\n int[] c = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\n int ans = 0;\n for (int m = 0; m < (1<= x && sum >= l && sum <= r && cnt >= 2)\n ans++;\n }\n\n Console.WriteLine(ans);\n\n \n\n \n\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "44e8c84a05101a7f27d9fc170597b458", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "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[] info = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); //\u043a\u043e\u043b-\u0432\u043e, \u043c\u0438\u043d.\u0432\u0435\u0441, \u043c\u0430\u043a\u0441.\u0432\u0435\u0441, \u043c\u0438\u043d.\u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432\u0435\u0441\u0430\n int[] items = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n List combos = GetCombination(items);\n int NumOfWays = GetNumOfWays(combos, info[1], info[2], info[3]);\n Console.WriteLine(NumOfWays);\n Console.ReadLine();\n\n }\n static int GetNumOfWays(List combos, int minP, int maxP, int minDifference)\n {\n int numOfWays = 0;\n foreach (int[] combo in combos.ToArray())\n {\n if(checkCombination(combo, minP, maxP, minDifference))\n numOfWays++;\n }\n return numOfWays;\n }\n static bool checkCombination(int[] combo, int minP, int maxP, int minDifference)\n {\n if (combo.Length > 1)\n {\n Array.Sort(combo);\n if ((combo[combo.Length - 1] - combo[0]) < minDifference)\n return false;\n }\n\n int p = 0;\n foreach (int item in combo)\n p += item;\n\n if(p < minP ^ p > maxP)\n return false;\n return true;\n }\n static List GetCombination(int[] items)\n {\n int countCombos = Convert.ToInt32(Math.Pow(2, items.Count())) - 1;\n char[] mask;\n List combos = new List();\n List temp = new List();\n for (int i = 1; i <= countCombos; i++)\n {\n mask = Convert.ToString(i, 2).PadLeft(items.Count(), '0').ToArray();\n for (int j = 0; j < mask.Length; j++)\n {\n if (mask[j] == '1')\n temp.Add(items[j]);\n }\n if (temp.Count > 1)\n combos.Add(temp.ToArray());\n temp.Clear();\n }\n return combos;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d3793782734fe02f3d46c3201b9a6e3e", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 _306b\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 l = d[1];\n var r = d[2];\n var x = d[3];\n\n var c = readIntArray();\n Array.Sort(c);\n\n var ts = new bool[n];\n var res = count(ts, c, n, 0, l, r, x);\n //var n = readInt();\n //var m = readInt();\n Console.WriteLine(res);\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int count(bool[] ts, int[] c, int n, int i, int l, int r, int x)\n {\n if (i == n)\n {\n var ct = 0;\n var md = -1;\n var sd = 0;\n var ft = -1;\n var la = -1;\n for (int j = 0; j < n; j++)\n {\n if (ts[j])\n {\n sd += c[j];\n ct++;\n if (ft == -1)\n {\n ft = j;\n }\n\n la = j;\n }\n }\n\n if (ct < 2)\n {\n return 0;\n }\n\n if (sd < l || sd > r)\n {\n return 0;\n }\n\n if (c[la] - c[ft] < x)\n {\n return 0;\n }\n\n //for (int j = 0; j < n; j++)\n //{\n // if (ts[j])\n // {\n // Console.Write(1);\n // }\n // else\n // {\n // Console.Write(0);\n // }\n //}\n //Console.WriteLine();\n return 1;\n }\n\n var res = count(ts, c, n, i + 1, l, r, x);\n ts[i] = true;\n res += count(ts, c, n, i + 1, l, r, x);\n ts[i] = false;\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\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "195577870c35bd882e269147b0f3dd39", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "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, L, R, X, cnt;\n static int[] diff;\n static string[] phrase;\n static List keep = new List();\n\n\n static int check()\n {\n int min = keep.Min();\n int max = keep.Max();\n int sum = keep.Sum();\n\n if (sum >= L && sum <= R && max - min >= X)\n return 1;\n\n return 0; \n }\n\n\n\n static void Main(string[] args)\n {\n phrase = Console.ReadLine().Split();\n\n N = Convert.ToInt32(phrase[0]);\n L = Convert.ToInt32(phrase[1]);\n R = Convert.ToInt32(phrase[2]);\n X = Convert.ToInt32(phrase[3]);\n\n \n phrase = Console.ReadLine().Split();\n diff = new int[phrase.Length];\n\n for (int i = 0; i < phrase.Length; ++i)\n diff[i] = Convert.ToInt32(phrase[i]);\n\n\n\n for (int i = 2; i < (1 << (N + 1) - 1); ++i)\n {\n int val = i;\n int pos = 0;\n keep.Clear();\n\n\n while (val > 0)\n {\n if (val%2 == 1)\n keep.Add(diff[pos]);\n \n val >>= 1;\n ++pos;\n }\n\n\n if (keep.Count >= 2)\n cnt += check();\n \n }\n\n\n Console.WriteLine(cnt);;\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "105dbef9c1740a29198eb61c8e17d452", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Numerics;\n\nnamespace cf306\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n if (File.Exists(\"input.txt\"))\n {\n Console.SetIn(new StreamReader(\"input.txt\"));\n }\n solve_cf306B();\n Console.Out.Flush();\n }\n\n public static void solve_cf306B()\n {\n int[] nlrx = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int n = nlrx[0];\n int l = nlrx[1];\n int r = nlrx[2];\n int x = nlrx[3];\n int[] c = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int cnt = 0;\n for (int i = 1; i <= (1 << n); i++) \n {\n int curSum = 0;\n int min = int.MaxValue;\n int max = 0;\n for (int j = 0; j < n; j++)\n {\n if (Convert.ToBoolean(i & (1 << j)))\n {\n curSum += c[j];\n min = Math.Min(min, c[j]);\n max = Math.Max(max, c[j]);\n }\n }\n if (l <= curSum && r >= curSum && max - min >= x)\n {\n cnt++;\n }\n }\n Console.WriteLine(cnt);\n }\n\n public static void solve_cf306A()\n {\n string s = Console.ReadLine();\n int cnt = 0;\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (s[i] == 'A' && s[i + 1] == 'B')\n {\n if (i > 0)\n {\n if (s[i - 1] == 'B')\n {\n continue;\n }\n }\n if (i < s.Length - 2)\n {\n if (s[i + 2] == 'A')\n {\n continue;\n }\n }\n cnt++;\n }\n if (s[i] == 'B' && s[i + 1] == 'A')\n {\n if (i > 0)\n {\n if (s[i - 1] == 'A')\n {\n continue;\n }\n }\n if (i < s.Length - 2)\n {\n if (s[i + 2] == 'B')\n {\n continue;\n }\n }\n cnt++;\n }\n }\n Console.WriteLine(cnt > 1 ? \"YES\" : \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fc041a3b3dc938e259c392c9da7a13cf", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\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 \n var line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var n = line[0];\n var l = line[1];\n var r = line[2];\n var x = line[3];\n\n var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int ans = 0;\n\n for (int i = 0; i < 1 << n; i++)\n {\n int Min = int.MaxValue;\n int Max = int.MinValue;\n int sum = 0;\n int cnt = 0;\n\n for (int j = 0; j < n; j++)\n {\n if ((i >> j & 1) == 1)\n {\n Min = Math.Min(Min, a[j]);\n Max = Math.Max(Max, a[j]);\n\n sum += a[j];\n cnt++;\n }\n }\n if (Max - Min >= x && sum >= l && sum <= r && cnt > 1)\n ans++;\n }\n Console.WriteLine(ans);\n Console.ReadLine();\n\n }\n\n static string IntToBinaryString(int bits, bool removeTrailingZero)\n {\n var sb = new StringBuilder(8);\n for (int i = 0; i < 8; i++)\n {\n if ((bits & 0x00000001) != 0)\n {\n sb.Append(\"1\");\n }\n else\n {\n sb.Append(\"0\");\n }\n bits = bits << 1;\n }\n string s = sb.ToString();\n if (removeTrailingZero)\n {\n return s.TrimStart('0');\n }\n else\n {\n return s;\n }\n }\n\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "204fa8f47a26115414a60b09671ea61d", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\n\nnamespace CodeforcesCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var ts = Console.ReadLine().Split(' ');\n\n var problems = int.Parse(ts[0]);\n var min = int.Parse(ts[1]);\n var max = int.Parse(ts[2]);\n var minDelta = int.Parse(ts[3]);\n\n var diffs = new int[problems];\n var masks = new int[problems];\n\n ts = Console.ReadLine().Split(' ');\n\n for (var i = 0; i < problems; ++i)\n {\n diffs[i] = int.Parse(ts[i]);\n masks[i] = i == 0\n ? BitVector32.CreateMask()\n : BitVector32.CreateMask(masks[i - 1]);\n }\n\n var all = 1 << problems;\n var ways = 0;\n for (var i = 1; i < all; ++i)\n {\n \n var bs = new BitVector32(i);\n var totDiff = 0;\n var minDiff = int.MaxValue;\n var maxDiff = int.MinValue;\n for (var j = 0; j < problems; ++j)\n if (bs[masks[j]])\n {\n totDiff += diffs[j];\n minDiff = Math.Min(minDiff, diffs[j]);\n maxDiff = Math.Max(maxDiff, diffs[j]);\n }\n if ((min <= totDiff) && (totDiff <= max) && (maxDiff - minDiff >= minDelta))\n {\n //Console.WriteLine(bs);\n ++ways;\n }\n }\n\n Console.WriteLine(ways);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9b344c362bc693fc8e7a35017c6ff047", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task3\n{\n class Program\n { \n static void Main(string[] args)\n {\n int productsCount;\n int minWeight;\n int maxWeight;\n int minDifference;\n List weights = new List();\n\n // Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:\");\n string[] inputString = Console.ReadLine().Split(' ');\n \n productsCount = Convert.ToInt32(inputString[0]);\n minWeight = Convert.ToInt32(inputString[1]);\n maxWeight = Convert.ToInt32(inputString[2]);\n minDifference = Convert.ToInt32(inputString[3]);\n\n // Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:\");\n string[] inputWeights = Console.ReadLine().Split(' ');\n\n if (inputWeights.Length != productsCount)\n {\n Console.WriteLine(\"count weights error!!!\");\n return;\n }\n\n for (int i = 0; i < productsCount; i++)\n {\n weights.Add(Convert.ToInt32(inputWeights[i]));\n }\n\n List> productSets = CreateProductSets(weights);\n\n int countVar = 0;\n\n foreach (List subset in productSets)\n {\n int totalWeight = subset.Sum();\n int heaviestItem = subset.Max();\n int easiestItem = subset.Min();\n int difference = heaviestItem - easiestItem;\n\n if (totalWeight >= minWeight && totalWeight <= maxWeight)\n if (difference >= minDifference)\n countVar++; \n }\n\n // Console.WriteLine();\n Console.WriteLine(countVar);\n Console.ReadLine();\n }\n\n static List> CreateProductSets(List weights)\n {\n List> productSets = new List>();\n\n for (int i = 0; i < weights.Count; i++)\n {\n int subsetCount = productSets.Count;\n productSets.Add(new List { weights[i] });\n\n for (int j = 0; j < subsetCount; j++)\n {\n int[] newSubset = new int[productSets[j].Count + 1];\n productSets[j].CopyTo(newSubset, 0);\n newSubset[newSubset.Length - 1] = weights[i];\n productSets.Add(newSubset.ToList());\n }\n }\n\n return productSets;\n }\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c266141acfc85e5999f8108798d8512", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\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 n = arr[0];\n var l = arr[1];\n var r = arr[2];\n var x = arr[3];\n var result = 0;\n var tasks = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n CalculatePossiblePermutations(tasks, 0, int.MaxValue, int.MinValue, r , l, x, ref result);\n Console.WriteLine(result);\n }\n\n public static void CalculatePossiblePermutations(IEnumerable tasks, int currentComplexitySum,\n int minComplexity, int maxComplexity, int maxSum, int minSum, int x, ref int result)\n {\n if (!tasks.Any())\n {\n if (maxComplexity - minComplexity >= x && currentComplexitySum >= minSum)\n {\n result += 1;\n }\n return;\n }\n\n \n CalculatePossiblePermutations(tasks.Skip(1), currentComplexitySum, minComplexity, maxComplexity, maxSum, minSum, x, ref result);\n \n var nextTask = tasks.First();\n var newSum = currentComplexitySum + nextTask;\n if (newSum <= maxSum)\n {\n if (nextTask < minComplexity)\n {\n minComplexity = nextTask;\n }\n\n if (nextTask > maxComplexity)\n {\n maxComplexity = nextTask;\n }\n \n \n CalculatePossiblePermutations(tasks.Skip(1), newSum, minComplexity, maxComplexity, maxSum, minSum, x, ref result);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b82124ff32f61bfd39577cd348b59767", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 Round306\n{\n class Program\n {\n #region Common Helper\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 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 #endregion\n\n #region Problem A\n\n private static bool ProblemAHelper(string s, string input, string reverse)\n {\n var indexAB = s.IndexOf(input, StringComparison.InvariantCulture);\n if (indexAB == -1)\n return false;\n if (indexAB == 0)\n {\n if (s.Length < 4)\n {\n return false;\n }\n if (s.Substring(2, s.Length - 2).Contains(reverse))\n {\n return true;\n }\n }\n else if (s.Substring(0, indexAB - 1).Contains(reverse) || s.Substring(indexAB + 2, s.Length - indexAB - 2).Contains(reverse))\n {\n return true;\n }\n return false;\n }\n\n private static void ProblemA()\n {\n var s = Console.ReadLine();\n if (ProblemAHelper(s, \"AB\", \"BA\") || ProblemAHelper(s, \"BA\", \"AB\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring()\n {\n var s = Console.ReadLine();\n var subA = \"AB\";\n\n var indexA = s.IndexOf(subA, StringComparison.InvariantCulture);\n if (indexA == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n var subB = \"BA\";\n var indexB = s.LastIndexOf(subB, StringComparison.InvariantCulture);\n if (indexB == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (indexA + 1 < indexB)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n indexA = s.LastIndexOf(subA);\n indexB = s.IndexOf(subB);\n if (indexB + 1 < indexA)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n\n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring2()\n {\n var s = Console.ReadLine();\n Console.WriteLine(s.Contains(\"AB\") && s.Contains(\"BA\") &&\n (s.LastIndexOf(\"BA\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) ||\n s.LastIndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"BA\", StringComparison.OrdinalIgnoreCase))\n ? \"YES\": \"NO\");\n }\n\n #endregion\n\n #region Problem B\n\n private static IEnumerable> powerSet(IList input, int n = 1)\n {\n var data = input.ToArray();\n for (var i = 0; i < ((n + 1) << data.Length); i++)\n {\n var tempList = new List(n + 1);\n tempList.AddRange(data.Where((t, j) => (i >> j)%2 == 1));\n yield return tempList;\n }\n\n }\n\n private static void ProblemB()\n {\n var n = Next();\n var l = Next();\n var r = Next();\n var x = Next();\n var c = new int[n];\n for (var i = 0; i < n; i++)\n c[i] = Next();\n\n reader.Close();\n var ans = 0;\n var total = 2 << (n - 1);\n for (var i = 0; i < total; i++)\n {\n int i1 = i;\n var tempList = c.Where((t, j) => (i1 >> j)%2 == 1).ToArray();\n if (tempList.Length > 1 && tempList.Sum() >= l && tempList.Sum() <= r && tempList.Max() - tempList.Min() >= x)\n ans++;\n }\n\n\n Console.WriteLine(ans);\n }\n\n #endregion\n static void Main(string[] args)\n {\n //ProblemA();\n //TwoSubstring();\n //TwoSubstring2();\n\n ProblemB();\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4b62161fd77a46a9a0fb7cdb9dd2816d", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace _306\n{\n class Program\n {\n private static int ans = 0;\n private static int max, min,l,r,x,sum;\n private static int[] mas;\n static void rec(int k, string s)\n {\n if (k > 0)\n {\n for (int i = 0; i < 2; i++)\n {\n rec(k - 1, s + i);\n }\n }\n else\n {\n min = int.MaxValue;\n max = int.MinValue;\n sum = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '1')\n {\n sum += mas[i];\n if (mas[i] > max) max = mas[i];\n if (mas[i] < min) min = mas[i];\n }\n }\n if (sum >= l && sum <= r && max - min >= x) ans++;\n }\n }\n \n private static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n l = Convert.ToInt32(s[1]);\n r = Convert.ToInt32(s[2]);\n x = Convert.ToInt32(s[3]);\n s = Console.ReadLine().Split(' ');\n mas= new int[n];\n for (int i = 0; i < n; i++)\n {\n mas[i] = int.Parse(s[i]);\n }\n rec(n,\"\");\n Console.WriteLine( ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eb2e40814a726c42fe99b7d56d7e5d3c", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nusing System.Timers;\n\n\nnamespace x\n{\n\n\n class Program\n {\n static bool readingFail;\n static StreamReader In = new StreamReader(Console.OpenStandardInput());\n static StreamWriter Out = new StreamWriter(Console.OpenStandardOutput());\n\n\n static public char getchar()\n { return (char)In.Read(); }\n\n static public int getint()\n {\n try\n {\n int res = 0;\n bool mi = false;\n int c = In.Read();\n while (c < '0' || '9' < c) { mi = (c == '-'); c = In.Read(); }\n while ('0' <= c && c <= '9') { res = res * 10 + c - '0'; c = In.Read(); }\n return mi ? -res : res;\n }\n catch (IOException)\n {\n readingFail = true;\n return -1;\n }\n }\n\n static char[] c_pool = new char[105000];\n static public string getstring()\n {\n int len = 0;\n char c = getchar();\n while (c != ' ' && c != '\\t' && c != '\\n' && c != '\\r')\n { c_pool[len++] = c; c = getchar(); }\n c_pool[len] = (char)0x0;\n string s = new string(c_pool);\n return s;\n }\n\n\n const int INF = (1 << 30) - 1;\n\n static int n;\n static int L, R, X;\n static int[] dif = new int[20];\n static bool[] use = new bool[20];\n static int res=0;\n\n static int Check()\n {\n int mx = -INF;\n int mi = INF;\n int sum = 0;\n int tot = 0;\n for (int i = 0; i < n; i++)\n if (use[i])\n {\n if (mx < dif[i]) mx = dif[i];\n if (mi > dif[i]) mi = dif[i];\n sum += dif[i];\n tot++;\n }\n\n //Out.WriteLine(mx.ToString() + \" \" + mi.ToString() + \" \" + sum.ToString() + \" \" + tot.ToString() + \" \" + (L <= sum && sum <= R && mx - mi >= X && tot >= 2).ToString());\n\n if (L <= sum && sum <= R && mx - mi >= X && tot >= 2)\n return 1;\n else\n return 0;\n }\n\n static void DFS(int dep)\n {\n if (dep == n)\n {\n res+=Check();\n return;\n }\n use[dep] = true;\n DFS(dep + 1);\n use[dep] = false;\n DFS(dep + 1);\n }\n\n static void Main()\n {\n n = getint();\n L = getint();\n R = getint();\n X = getint();\n for (int i = 0; i < n; i++)\n dif[i] = getint();\n\n DFS(0);\n\n Out.Write(res);\n Out.WriteLine(\"\");\n Out.Flush();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "39af381cd92f848a95469d1c21f344c5", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 n = ReadInt();\n var l = ReadInt();\n var r = ReadInt();\n var x = ReadInt();\n var a = 0;\n var c = ReadIntArray();\n for (int i = 0; i <= 1 << n; i++)\n {\n var b = new List();\n for (int j = 0; j < n; j++)\n {\n if (((i >> j) & 1) != 0)\n {\n b.Add(c[j]);\n }\n }\n if (b.Count >= 2 && l <= b.Sum() && b.Sum() <= r && b.Max() - b.Min() >= x)\n {\n a++;\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "653a5c4026a7a5bbdcb842a8efb2692e", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n \n public static long Rec(long ss, long i, long s, long l, long r, long x, long n, long[] mas, long k)\n {\n s += mas[i];\n if ((s <= r) && (s >= l) && ((mas[i] - mas[k]) >= x))\n {\n ss++;\n }\n if (s < r)\n {\n for (long j = i + 1; j < n; j++)\n {\n ss = Rec(ss, j, s, l, r, x, n, mas, k);\n }\n }\n return ss;\n }\n static void Main(string[] args)\n {\n long n, l, r, x;\n\n string[] lines = Console.ReadLine().Split(' ');\n n = long.Parse(lines[0]);\n l = long.Parse(lines[1]);\n r = long.Parse(lines[2]);\n x = long.Parse(lines[3]);\n long[] mas;\n mas = new long[n];\n string[] lines1 = Console.ReadLine().Split(' ');\n for (long i = 0; i < n; i++)\n mas[i] = long.Parse(lines1[i]);\n\n for (long i = 0; i < mas.Length; i++)\n {\n for (long j = 0; j < mas.Length - 1; j++)\n {\n if (mas[j] > mas[j + 1])\n {\n long z = mas[j];\n mas[j] = mas[j + 1];\n mas[j + 1] = z;\n }\n }\n }\n long s = 0, ss = 0, sl = 0;\n for (long jj = 0; jj < (n - 1); jj++)\n {\n sl = Rec(0, jj, s, l, r, x, n, mas, jj);\n ss += sl;\n }\n Console.WriteLine(ss);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f7baf24b5a0fcf6a53530f329a6c37af", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 CF550B\n\t{\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint N, L, R, X, i, j, k, c, s, e, ans = 0;\n\t\t\tint[] C;\n\n\t\t\tN = xoi.ReadInt();\n\t\t\tL = xoi.ReadInt();\n\t\t\tR = xoi.ReadInt();\n\t\t\tX = xoi.ReadInt();\n\t\t\tC = new int[N];\n\t\t\tfor (i = 0; i < N; i++)\n\t\t\t\tC[i] = xoi.ReadInt();\n\n\t\t\tfor (i = 0; i < (1 << N); i++)\n\t\t\t{\n\t\t\t\tc = 0; s = Int32.MaxValue; e = Int32.MinValue;\n\t\t\t\tfor (j = i, k = 0; j != 0; j >>= 1, k++)\n\t\t\t\t{\n\t\t\t\t\tif ((j & 0x1) != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tc += C[k];\n\t\t\t\t\t\ts = Math.Min(s, C[k]);\n\t\t\t\t\t\te = Math.Max(e, C[k]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (c >= L && c <= R && (e - s) >= X) ans++;\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 CF550B()).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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "11d3226243844b606ddca38c4ac183a9", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace N3\n{\n class Program\n {\n static int[] weights;\n static int n, m, k, p, variants;\n static int[] fullComb;\n\n static void Main(string[] args)\n { \n //Console.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u0430 n, m, k, p (\u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b): \");\n\n string[] conditions = Console.ReadLine().Split(' ');\n\n n = int.Parse(conditions[0]);\n m = int.Parse(conditions[1]);\n k = int.Parse(conditions[2]);\n p = int.Parse(conditions[3]);\n \n weights = new int[n];\n fullComb = new int[n];\n\n //Console.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0435\u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430 (\u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b): \");\n string[] strweights = Console.ReadLine().Split(' ');\n\n for (int i = 0; i < n; i++) \n weights[i] = int.Parse(strweights[i]); \n\n for (int i = 1; i < n; i++)\n GetCombinations(i, n);\n\n for (int i = 0; i < n; i++) \n fullComb[i] = i + 1;\n \n variants += CheckCombination(fullComb);\n\n // Console.WriteLine(\"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432: \" + variants);\n Console.WriteLine(variants);\n // Console.ReadLine(); \n }\n\n static void GetCombinations(int k, int n)\n {\n int[] Comb = new int[k];\n int q;\n\n for (int i = 0; i < k; i++)\n Comb[i] = i+1;\n\n q = k;\n\n while (q >= 1)\n {\n variants += CheckCombination(Comb);\n\n if (Comb[k - 1] == n)\n q -= 1;\n else\n q = k;\n\n if (q >= 1)\n for (int j = k; j >= q; j--)\n Comb[j - 1] = Comb[q - 1] + j - q + 1;\n }\n }\n\n static byte CheckCombination(int[] Comb)\n {\n int sum = 0;\n int[] temparray = new int[Comb.Length];\n\n for (int i = 0; i < Comb.Length; i++)\n {\n \n temparray[i] = weights[Comb[i]-1];\n sum += temparray[i];\n }\n\n Array.Sort(temparray);\n \n if (sum < m || sum > k)\n return 0;\n if ((temparray[temparray.Length - 1] - temparray[0]) < p)\n return 0;\n return 1;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "145972703aa26efa5e25248b1e5af044", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Preparing_Olympiad\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 l = Next();\n int r = Next();\n int x = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n int mask = 1 << n;\n\n int count = 0;\n for (int i = 1; i < mask; i++)\n {\n int sum = 0;\n int cnt = 0;\n int min = int.MaxValue;\n int max = 0;\n for (int j = 0; j < n; j++)\n {\n if ((i & (1 << j)) != 0)\n {\n cnt++;\n sum += nn[j];\n if (min > nn[j])\n min = nn[j];\n if (max < nn[j])\n max = nn[j];\n }\n }\n if (cnt > 1 && sum >= l && sum <= r && max - min >= x)\n {\n count++;\n }\n }\n\n\n writer.WriteLine(\"{0}\", 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0006ab6435339edc686bf841ecfca8f4", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 Round306\n{\n class Program\n {\n #region Common Helper\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 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 #endregion\n\n #region Problem A\n\n private static bool ProblemAHelper(string s, string input, string reverse)\n {\n var indexAB = s.IndexOf(input, StringComparison.InvariantCulture);\n if (indexAB == -1)\n return false;\n if (indexAB == 0)\n {\n if (s.Length < 4)\n {\n return false;\n }\n if (s.Substring(2, s.Length - 2).Contains(reverse))\n {\n return true;\n }\n }\n else if (s.Substring(0, indexAB - 1).Contains(reverse) || s.Substring(indexAB + 2, s.Length - indexAB - 2).Contains(reverse))\n {\n return true;\n }\n return false;\n }\n\n private static void ProblemA()\n {\n var s = Console.ReadLine();\n if (ProblemAHelper(s, \"AB\", \"BA\") || ProblemAHelper(s, \"BA\", \"AB\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring()\n {\n var s = Console.ReadLine();\n var subA = \"AB\";\n\n var indexA = s.IndexOf(subA, StringComparison.InvariantCulture);\n if (indexA == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n var subB = \"BA\";\n var indexB = s.LastIndexOf(subB, StringComparison.InvariantCulture);\n if (indexB == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (indexA + 1 < indexB)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n indexA = s.LastIndexOf(subA);\n indexB = s.IndexOf(subB);\n if (indexB + 1 < indexA)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n\n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring2()\n {\n var s = Console.ReadLine();\n Console.WriteLine(s.Contains(\"AB\") && s.Contains(\"BA\") &&\n (s.LastIndexOf(\"BA\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) ||\n s.LastIndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"BA\", StringComparison.OrdinalIgnoreCase))\n ? \"YES\": \"NO\");\n }\n\n #endregion\n\n #region Problem B\n\n private static IEnumerable> powerSet(IList input, int n = 1)\n {\n var data = input.ToArray();\n for (var i = 0; i < ((n + 1) << data.Length); i++)\n {\n var tempList = new List(n + 1);\n tempList.AddRange(data.Where((t, j) => (i >> j)%2 == 1));\n yield return tempList;\n }\n\n }\n\n private static void ProblemB()\n {\n var n = Next();\n var l = Next();\n var r = Next();\n var x = Next();\n var c = new int[n];\n for (var i = 0; i < n; i++)\n c[i] = Next();\n\n //reader.Close();\n var ans = 0;\n var total = 2 << (n - 1);\n for (var i = 0; i < total; i++)\n {\n var min = int.MaxValue;\n var max = 0;\n var sum = 0;\n var count = 0;\n for (var j = 0; j < n; j++)\n {\n if ((i >> j)%2 == 1)\n {\n sum += c[j];\n max = Math.Max(max, c[j]);\n if (sum > r)\n break;\n min = Math.Min(min, c[j]);\n count++;\n }\n }\n if (count > 1 && sum <= r && sum >= l && max - min >= x) \n ans++;\n }\n\n\n Console.WriteLine(ans);\n }\n\n #endregion\n static void Main(string[] args)\n {\n //ProblemA();\n //TwoSubstring();\n //TwoSubstring2();\n\n ProblemB();\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f95ff7d2e4d9e4a48182893634921c67", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n \n public static long Rec(long ss, long i, long s, long l, long r, long x, long n, long[] mas, long k)\n {\n s += mas[i];\n if ((s <= r) && (s >= l) && ((mas[i] - mas[k]) >= x))\n {\n ss++;\n }\n if (s < r)\n {\n for (long j = i + 1; j < n; j++)\n {\n ss = Rec(ss, j, s, l, r, x, n, mas, k);\n }\n }\n return ss;\n }\n static void Main(string[] args)\n {\n long n, l, r, x;\n\n string[] lines = Console.ReadLine().Split(' ');\n n = long.Parse(lines[0]);\n l = long.Parse(lines[1]);\n r = long.Parse(lines[2]);\n x = long.Parse(lines[3]);\n long[] mas;\n mas = new long[n];\n string[] lines1 = Console.ReadLine().Split(' ');\n for (long i = 0; i < n; i++)\n mas[i] = long.Parse(lines1[i]);\n\n for (long i = 0; i < mas.Length; i++)\n {\n for (long j = 0; j < mas.Length - 1; j++)\n {\n if (mas[j] > mas[j + 1])\n {\n long z = mas[j];\n mas[j] = mas[j + 1];\n mas[j + 1] = z;\n }\n }\n }\n long s = 0, ss = 0, sl = 0;\n for (long jj = 0; jj < (n - 1); jj++)\n {\n sl = Rec(0, jj, s, l, r, x, n, mas, jj);\n ss += sl;\n }\n Console.WriteLine(ss);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d8d73c41a9817e4b77adcaab34cfe693", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 Round306\n{\n class Program\n {\n #region Common Helper\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 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 #endregion\n\n #region Problem A\n\n private static bool ProblemAHelper(string s, string input, string reverse)\n {\n var indexAB = s.IndexOf(input, StringComparison.InvariantCulture);\n if (indexAB == -1)\n return false;\n if (indexAB == 0)\n {\n if (s.Length < 4)\n {\n return false;\n }\n if (s.Substring(2, s.Length - 2).Contains(reverse))\n {\n return true;\n }\n }\n else if (s.Substring(0, indexAB - 1).Contains(reverse) || s.Substring(indexAB + 2, s.Length - indexAB - 2).Contains(reverse))\n {\n return true;\n }\n return false;\n }\n\n private static void ProblemA()\n {\n var s = Console.ReadLine();\n if (ProblemAHelper(s, \"AB\", \"BA\") || ProblemAHelper(s, \"BA\", \"AB\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring()\n {\n var s = Console.ReadLine();\n var subA = \"AB\";\n\n var indexA = s.IndexOf(subA, StringComparison.InvariantCulture);\n if (indexA == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n var subB = \"BA\";\n var indexB = s.LastIndexOf(subB, StringComparison.InvariantCulture);\n if (indexB == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (indexA + 1 < indexB)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n indexA = s.LastIndexOf(subA);\n indexB = s.IndexOf(subB);\n if (indexB + 1 < indexA)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n\n Console.WriteLine(\"NO\");\n }\n\n private static void TwoSubstring2()\n {\n var s = Console.ReadLine();\n Console.WriteLine(s.Contains(\"AB\") && s.Contains(\"BA\") &&\n (s.LastIndexOf(\"BA\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) ||\n s.LastIndexOf(\"AB\", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf(\"BA\", StringComparison.OrdinalIgnoreCase))\n ? \"YES\": \"NO\");\n }\n\n #endregion\n\n #region Problem B\n\n private static IEnumerable> powerSet(IList input, int n = 1)\n {\n var data = input.ToArray();\n for (var i = 0; i < ((n + 1) << data.Length); i++)\n {\n var tempList = new List(n + 1);\n tempList.AddRange(data.Where((t, j) => (i >> j)%2 == 1));\n yield return tempList;\n }\n\n }\n\n private static void ProblemB()\n {\n var n = Next();\n var l = Next();\n var r = Next();\n var x = Next();\n var c = new int[n];\n for (var i = 0; i < n; i++)\n c[i] = Next();\n\n //reader.Close();\n var ans = 0;\n var total = 2 << (n - 1);\n for (var i = 0; i < total; i++)\n {\n var min = int.MaxValue;\n var max = 0;\n var sum = 0;\n //var count = 0;\n for (var j = 0; j < n; j++)\n {\n if ((i >> j)%2 == 1)\n {\n sum += c[j];\n if (sum > r)\n break;\n max = Math.Max(max, c[j]);\n \n min = Math.Min(min, c[j]);\n //count++;\n }\n }\n if (sum <= r && sum >= l && max - min >= x) \n ans++;\n }\n\n\n Console.WriteLine(ans);\n }\n\n #endregion\n static void Main(string[] args)\n {\n //ProblemA();\n //TwoSubstring();\n //TwoSubstring2();\n\n ProblemB();\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "01b8361b68a6b07d1ab0f1a9ba8a33ed", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main(string[ ] args)\n\t{\n\t\tstring[ ] First = Console.ReadLine( ).Trim(' ').Split(' ');\n\t\tbyte\tnTasks = byte.Parse(First[0]);\t\t//\t\u0417\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u043b\u0435\u0442\u043e\u0432\n\t\tUInt64\tSetMin = UInt64.Parse(First[1]),\t//\t\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\t\t\tSetMax = UInt64.Parse(First[2]);\t//\t\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\tUInt32 MinDiff = UInt32.Parse(First[3]);\t//\t\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u043c\u043e\u0439 \u0442\u044f\u0436\u0451\u043b\u043e\u0439 \u0438 \u0441\u0430\u043c\u043e\u0439 \u043b\u0451\u0433\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\n\t\tif (nTasks < 1 || SetMin > SetMax)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\n\t\tstring[ ] Second = Console.ReadLine( ).Trim(' ').Split(' ');\n\t\tList Tasks = new List(nTasks);\n\t\tforeach (var Cur in Second)\n\t\t\tTasks.Add(UInt32.Parse(Cur));\n\n\t\tList Set = new List(nTasks + 1);\n\t\tSet.Add(true);\n\t\tfor (byte i = 0; i < nTasks; ++i)\n\t\t\tSet.Add(false);\n\n\t\tUInt64 Answer = 0;\t//\t\u041e\u0442\u0432\u0435\u0442: \u043a\u043e\u043b-\u0432\u043e \u043d\u0430\u0431\u043e\u0440\u043e\u0432\n\t\tdo\n\t\t{\n\t\t\tUInt64 SetSum = 0;\n\t\t\tbyte Min = (byte)Set.IndexOf(true),\n\t\t\t\t Max = Min,\n\t\t\t\t nTrue = 0;\t\t//\t\u041a\u043e\u043b-\u0432\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0437\u0430\u0434\u0430\u0447\n\n\t\t\tfor (byte i = Min; i < nTasks; ++i)\n\t\t\t\tif (Set[i])\n\t\t\t\t{\n\t\t\t\t\t++nTrue;\n\t\t\t\t\tif ((SetSum += Tasks[i]) > SetMax) break;\n\n\t\t\t\t\tif (Tasks[Max] < Tasks[i]) Max = i;\n\t\t\t\t\telse if (Tasks[Min] > Tasks[i]) Min = i;\n\t\t\t\t}\n\n\t\t\tif (Tasks[Max] - Tasks[Min] >= MinDiff &&\n\t\t\t\tSetSum >= SetMin &&\n\t\t\t\tSetSum <= SetMax)\n\t\t\t\t++Answer;\n\n\t\t\tfor (byte i = 0; i <= nTasks; ++i)\n\t\t\t\tif (Set[i] = !Set[i])\n\t\t\t\t\tbreak;\n\t\t} while (Set[nTasks] == false);\n\n\t\tConsole.WriteLine(Answer);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a01b5b46ff3d0df17f20d463b2052168", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\n\nnamespace CodeforcesCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var ts = Console.ReadLine().Split(' ');\n\n var problems = int.Parse(ts[0]);\n var min = int.Parse(ts[1]);\n var max = int.Parse(ts[2]);\n var minDelta = int.Parse(ts[3]);\n\n var diffs = new int[problems];\n var masks = new int[problems];\n\n ts = Console.ReadLine().Split(' ');\n\n for (var i = 0; i < problems; ++i)\n {\n diffs[i] = int.Parse(ts[i]);\n masks[i] = i == 0\n ? BitVector32.CreateMask()\n : BitVector32.CreateMask(masks[i - 1]);\n }\n\n var all = 1 << problems;\n var ways = 0;\n for (var i = 1; i < all; ++i)\n {\n var bs = new BitVector32(i);\n var totDiff = 0;\n var minDiff = int.MaxValue;\n var maxDiff = int.MinValue;\n var ok = false;\n for (var j = 0; j < problems; ++j)\n {\n if (bs[masks[j]])\n {\n totDiff += diffs[j];\n minDiff = Math.Min(minDiff, diffs[j]);\n maxDiff = Math.Min(maxDiff, diffs[j]);\n ok = true;\n }\n }\n if (ok && (min <= totDiff) && (totDiff <= max) && (maxDiff - minDiff >= minDelta))\n ++ways;\n }\n\n Console.WriteLine(ways);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1fdb4a1e918b6ee3f80761c6aa8d7b09", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main(string[ ] args)\n\t{\n\t\tstring[ ] First = Console.ReadLine( ).Split(' ');\n\t\tbyte\tnTasks = byte.Parse(First[0]);\t\t//\t\u0417\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u043b\u0435\u0442\u043e\u0432\n\t\tUInt64\tSetMin = UInt64.Parse(First[1]),\t//\t\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\t\t\tSetMax = UInt64.Parse(First[2]);\t//\t\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\tUInt32 MinDiff = UInt32.Parse(First[3]);\t//\t\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u043c\u043e\u0439 \u0442\u044f\u0436\u0451\u043b\u043e\u0439 \u0438 \u0441\u0430\u043c\u043e\u0439 \u043b\u0451\u0433\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\n\t\tif (nTasks < 1 || SetMin > SetMax)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\n\t\tstring[ ] Second = Console.ReadLine( ).Split(' ');\n\t\tList Tasks = new List( );\n\t\tforeach (var Cur in Second)\n\t\t\tTasks.Add(UInt32.Parse(Cur));\n\n\t\tList Set = new List(nTasks + 1);\n\t\tSet.Add(true);\n\t\tfor (byte i = 0; i < nTasks; ++i)\n\t\t\tSet.Add(false);\n\n\t\tUInt16 Answer = 0;\t//\t\u041e\u0442\u0432\u0435\u0442: \u043a\u043e\u043b-\u0432\u043e \u043d\u0430\u0431\u043e\u0440\u043e\u0432\n\t\tif (SetMin == 0) ++Answer;\t//\t\u0415\u0441\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c 0 \u0437\u0430\u0434\u0430\u0447, \u0442\u043e +1 \u0441\u043f\u043e\u0441\u043e\u0431 \u043a \u043e\u0442\u0432\u0435\u0442\u0443\n\n\t\tdo\n\t\t{\n\t\t\tUInt64 SetSum = 0;\n\t\t\tbyte Min = (byte)Set.IndexOf(true),\n\t\t\t\t Max = Min,\n\t\t\t\t nTrue = 0;\t\t//\t\u041a\u043e\u043b-\u0432\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0437\u0430\u0434\u0430\u0447\n\n\t\t\tfor (byte i = Min; i < nTasks; ++i)\n\t\t\t\tif (Set[i])\n\t\t\t\t{\n\t\t\t\t\t++nTrue;\n\t\t\t\t\tSetSum += Tasks[i];\n\t\t\t\t\tif (Tasks[Max] < Tasks[i]) Max = i;\n\t\t\t\t\telse if (Tasks[Min] > Tasks[i]) Min = i;\n\t\t\t\t}\n\n\t\t\tif ((nTrue < 2 || Tasks[Max] - Tasks[Min] >= MinDiff) &&\n\t\t\t\tSetSum >= SetMin &&\n\t\t\t\tSetSum <= SetMax)\n\t\t\t\t++Answer;\n\n\t\t\tfor (byte i = 0; i <= nTasks; ++i)\n\t\t\t\tif (Set[i] = !Set[i])\n\t\t\t\t\tbreak;\n\t\t} while (Set[nTasks] == false);\n\n\t\tConsole.WriteLine(Answer);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0c37c4963181f532780031739a7c1615", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task3\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int pow6 = 1000000;\n const int pow9 = 1000000000;\n int n, m, k, p;\n string inputStr;\n string[] input;\n\n do\n {\n inputStr = Console.ReadLine();\n if (string.IsNullOrEmpty(inputStr))\n continue;\n input = inputStr.Split(' ');\n if (input.Length != 4)\n continue;\n\n if (!int.TryParse(input[0], out n) || n < 1 || n > 15)\n continue;\n if (!int.TryParse(input[1], out m) || m < 1 || m > pow9)\n continue;\n if (!int.TryParse(input[2], out k) || k < m || k > pow9)\n continue;\n if (!int.TryParse(input[3], out p) || p < 1 || p > pow6)\n continue;\n break;\n\n } while (true);\n\n int[] c = new int[n];\n do\n {\n inputStr = Console.ReadLine();\n if (string.IsNullOrEmpty(inputStr))\n continue;\n input = inputStr.Split(' ');\n if (input.Length != n)\n continue;\n\n int i;\n for (i = 0; i < n; i++)\n {\n if (!int.TryParse(input[i], out c[i]) || c[i] < 1 || c[i] > pow6)\n break;\n }\n \n if (i != n)\n continue;\n break;\n } while (true);\n\n int answer = 0;\n R(ref answer, c, ref m, ref k, ref p, 0, 1);\n\n Console.WriteLine( answer);\n }\n\n private static void R(ref int @out, int[] c, ref int m, ref int k, ref int p, int sIndex, int range)\n {\n if (sIndex + range == c.Length)\n {\n R(ref @out, c, ref m, ref k, ref p, 0, range + 1);\n return;\n }\n\n if (range > c.Length)\n return;\n \n int sum = 0;\n int min = c[sIndex];\n int max = c[sIndex];\n\n for (int i = sIndex; i < sIndex + range; i++)\n {\n sum += c[i];\n if (c[i] < min)\n min = c[i];\n if (c[i] > max)\n max = c[i];\n }\n\n if (sum <= k)\n {\n for (int i = sIndex + range; i < c.Length; i++)\n {\n int tmpMin = min;\n int tmpMax = max;\n int s = sum + c[i];\n\n if (c[i] < min)\n tmpMin = c[i];\n if (c[i] > max)\n tmpMax = c[i];\n\n if (tmpMax - tmpMin >= p)\n if (s >= m && s <= k)\n @out++;\n }\n }\n\n R(ref @out, c, ref m, ref k, ref p, sIndex + 1, range);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d655732fab13a63351378228d8bfb098", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\n\nnamespace CodeforcesCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var ts = Console.ReadLine().Split(' ');\n\n var problems = int.Parse(ts[0]);\n var min = int.Parse(ts[1]);\n var max = int.Parse(ts[2]);\n var minDelta = int.Parse(ts[3]);\n\n var diffs = new int[problems];\n var masks = new int[problems];\n\n ts = Console.ReadLine().Split(' ');\n\n for (var i = 0; i < problems; ++i)\n {\n diffs[i] = int.Parse(ts[i]);\n masks[i] = i == 0\n ? BitVector32.CreateMask()\n : BitVector32.CreateMask(masks[i - 1]);\n }\n\n var all = 1 << problems;\n var ways = 0;\n for (var i = 1; i < all; ++i)\n {\n var bs = new BitVector32(i);\n var minDiff = int.MaxValue;\n var maxDiff = int.MinValue;\n var ok = false;\n for (var j = 0; j < problems; ++j)\n {\n if (bs[masks[j]])\n {\n if (diffs[j] < min)\n break;\n if (diffs[j] > max)\n break;\n minDiff = Math.Min(minDiff, diffs[j]);\n maxDiff = Math.Min(maxDiff, diffs[j]);\n ok = true;\n }\n }\n if (ok && (maxDiff - minDiff >= minDelta))\n ++ways;\n }\n\n Console.WriteLine(ways);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc597b7d3e0b1c6e379d357a91a2a859", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main(string[ ] args)\n\t{\n\t\tstring[ ] First = Console.ReadLine( ).Trim(' ').Split(' ');\n\t\tbyte\tnTasks = byte.Parse(First[0]);\t\t//\t\u0417\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u043b\u0435\u0442\u043e\u0432\n\t\tUInt64\tSetMin = UInt64.Parse(First[1]),\t//\t\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\t\t\tSetMax = UInt64.Parse(First[2]);\t//\t\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\tUInt32 MinDiff = UInt32.Parse(First[3]);\t//\t\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u043c\u043e\u0439 \u0442\u044f\u0436\u0451\u043b\u043e\u0439 \u0438 \u0441\u0430\u043c\u043e\u0439 \u043b\u0451\u0433\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\n\t\tif (nTasks < 1 || SetMin > SetMax)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\n\t\tstring[ ] Second = Console.ReadLine( ).Trim(' ').Split(' ');\n\t\tList Tasks = new List(nTasks);\n\t\tforeach (var Cur in Second)\n\t\t\tTasks.Add(UInt32.Parse(Cur));\n\n\t\tList Set = new List(nTasks + 1);\n\t\tSet.Add(true);\n\t\tfor (byte i = 0; i < nTasks; ++i)\n\t\t\tSet.Add(false);\n\n\t\tUInt64 Answer = 0;\t\t\t//\t\u041e\u0442\u0432\u0435\u0442: \u043a\u043e\u043b-\u0432\u043e \u043d\u0430\u0431\u043e\u0440\u043e\u0432\n\t\tif (SetMin == 0) ++Answer;\t//\t\u0415\u0441\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c 0 \u0437\u0430\u0434\u0430\u0447, \u0442\u043e +1 \u0441\u043f\u043e\u0441\u043e\u0431 \u043a \u043e\u0442\u0432\u0435\u0442\u0443\n\n\t\tdo\n\t\t{\n\t\t\tUInt64 SetSum = 0;\n\t\t\tbyte Min = (byte)Set.IndexOf(true),\n\t\t\t\t Max = Min,\n\t\t\t\t nTrue = 0;\t\t//\t\u041a\u043e\u043b-\u0432\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0437\u0430\u0434\u0430\u0447\n\n\t\t\tfor (byte i = Min; i < nTasks; ++i)\n\t\t\t\tif (Set[i])\n\t\t\t\t{\n\t\t\t\t\t++nTrue;\n\t\t\t\t\tSetSum += Tasks[i];\n\t\t\t\t\tif (Tasks[Max] < Tasks[i]) Max = i;\n\t\t\t\t\telse if (Tasks[Min] > Tasks[i]) Min = i;\n\t\t\t\t}\n\n\t\t\tif ((nTrue < 2 || Tasks[Max] - Tasks[Min] >= MinDiff) &&\n\t\t\t\tSetSum >= SetMin &&\n\t\t\t\tSetSum <= SetMax)\n\t\t\t\t++Answer;\n\n\t\t\tfor (byte i = 0; i <= nTasks; ++i)\n\t\t\t\tif (Set[i] = !Set[i])\n\t\t\t\t\tbreak;\n\t\t} while (Set[nTasks] == false);\n\n\t\tConsole.WriteLine(Answer);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8f0eb12477a4df56905330c26462efd6", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace N3\n{\n class Program\n {\n static int[] weights;\n static int n, m, k, p, variants;\n static int[] fullComb;\n\n static void Main(string[] args)\n { \n //Console.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u0430 n, m, k, p (\u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b): \");\n\n string[] conditions = Console.ReadLine().Split(' ');\n\n n = int.Parse(conditions[0]);\n m = int.Parse(conditions[1]);\n k = int.Parse(conditions[2]);\n p = int.Parse(conditions[3]);\n \n weights = new int[n];\n fullComb = new int[n];\n\n //Console.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0435\u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430 (\u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b): \");\n string[] strweights = Console.ReadLine().Split(' ');\n\n for (int i = 0; i < n; i++) \n weights[i] = int.Parse(strweights[i]); \n\n for (int i = 1; i < n; i++)\n GetCombinations(i, n);\n\n /*for (int i = 0; i < n; i++) \n fullComb[i] = i + 1;\n \n variants += CheckCombination(fullComb);\n */\n // Console.WriteLine(\"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432: \" + variants);\n Console.WriteLine(variants);\n // Console.ReadLine(); \n }\n\n static void GetCombinations(int k, int n)\n {\n int[] Comb = new int[k];\n int q;\n\n for (int i = 0; i < k; i++)\n Comb[i] = i+1;\n\n q = k;\n\n while (q >= 1)\n {\n variants += CheckCombination(Comb);\n\n if (Comb[k - 1] == n)\n q -= 1;\n else\n q = k;\n\n if (q >= 1)\n for (int j = k; j >= q; j--)\n Comb[j - 1] = Comb[q - 1] + j - q + 1;\n }\n }\n\n static byte CheckCombination(int[] Comb)\n {\n int sum = 0;\n int[] temparray = new int[Comb.Length];\n\n for (int i = 0; i < Comb.Length; i++)\n { \n temparray[i] = weights[Comb[i]-1];\n sum += temparray[i];\n } \n\n Array.Sort(temparray);\n \n if (sum < m || sum > k)\n return 0;\n if ((temparray[temparray.Length - 1] - temparray[0]) < p)\n return 0;\n return 1;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7a552e0b816db703b9e182b142851651", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\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 \n var line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var n = line[0];\n var l = line[1];\n var r = line[2];\n var x = line[3];\n\n var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int ans = 0;\n\n for (int i = 0; i < (1 << n); i++)\n {\n int Min = int.MaxValue;\n int Max = int.MinValue;\n\n int sum = 0;\n int cnt = 0;\n\n for (int j = 0; j < n; j++)\n {\n if ((i >> j & 1) == 1)\n {\n Min = Math.Min(Min, a[j]);\n Max = Math.Max(Max, a[j]);\n\n sum += a[j];\n cnt++;\n }\n\n if (Max - Min >= x && sum >= l && sum <= r && cnt > 1)\n ans++;\n }\n }\n Console.WriteLine(ans);\n Console.ReadLine();\n\n }\n\n static string IntToBinaryString(int bits, bool removeTrailingZero)\n {\n var sb = new StringBuilder(8);\n for (int i = 0; i < 8; i++)\n {\n if ((bits & 0x00000001) != 0)\n {\n sb.Append(\"1\");\n }\n else\n {\n sb.Append(\"0\");\n }\n bits = bits << 1;\n }\n string s = sb.ToString();\n if (removeTrailingZero)\n {\n return s.TrimStart('0');\n }\n else\n {\n return s;\n }\n }\n\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "955e0d7d191f47efe04b87bb64db68ec", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task3\n{\n class Program\n { \n static void Main(string[] args)\n {\n int productsCount;\n int minWeight;\n int maxWeight;\n int minDifference;\n List weights = new List();\n\n string[] inputString = Console.ReadLine().Split(' ');\n \n productsCount = Convert.ToInt32(inputString[0]);\n minWeight = Convert.ToInt32(inputString[1]);\n maxWeight = Convert.ToInt32(inputString[2]);\n minDifference = Convert.ToInt32(inputString[3]);\n\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:\");\n string[] inputWeights = Console.ReadLine().Split(' ');\n\n if (inputWeights.Length != productsCount)\n {\n Console.WriteLine(\"count weights error!!!\");\n return;\n }\n\n for (int i = 0; i < productsCount; i++)\n {\n weights.Add(Convert.ToInt32(inputWeights[i]));\n }\n\n List> productSets = CreateProductSets(weights);\n\n int countVar = 0;\n\n foreach (List subset in productSets)\n {\n int totalWeight = subset.Sum();\n int heaviestItem = subset.Max();\n int easiestItem = subset.Min();\n int difference = heaviestItem - easiestItem;\n\n if (totalWeight >= minWeight && totalWeight <= maxWeight)\n if (difference >= minDifference)\n countVar++; \n }\n\n Console.WriteLine();\n Console.WriteLine(countVar);\n Console.ReadLine();\n }\n\n static List> CreateProductSets(List weights)\n {\n List> productSets = new List>();\n\n for (int i = 0; i < weights.Count; i++)\n {\n int subsetCount = productSets.Count;\n productSets.Add(new List { weights[i] });\n\n for (int j = 0; j < subsetCount; j++)\n {\n int[] newSubset = new int[productSets[j].Count + 1];\n productSets[j].CopyTo(newSubset, 0);\n newSubset[newSubset.Length - 1] = weights[i];\n productSets.Add(newSubset.ToList());\n }\n }\n\n return productSets;\n }\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b7a8672b0dfae035e427293eaa0311c1", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "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[] info = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); //\u043a\u043e\u043b-\u0432\u043e, \u043c\u0438\u043d.\u0432\u0435\u0441, \u043c\u0430\u043a\u0441.\u0432\u0435\u0441, \u043c\u0438\u043d.\u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432\u0435\u0441\u0430\n int[] items = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Array.Sort(items);\n \n List combos = GetCombination(items);\n int NumOfWays = GetNumOfWays(combos, info[1], info[2], info[3]);\n Console.WriteLine(NumOfWays);\n Console.ReadLine();\n\n }\n static int GetNumOfWays(List combos, int minP, int maxP, int minDifference)\n {\n int numOfWays = 0;\n foreach (int[] combo in combos.ToArray())\n {\n if(checkCombination(combo, minP, maxP, minDifference))\n numOfWays++;\n }\n return numOfWays;\n }\n static bool checkCombination(int[] combo, int minP, int maxP, int minDifference)\n {\n if (combo.Length > 1)\n {\n //Array.Sort(combo);\n if ((combo[combo.Length - 1] - combo[0]) < minDifference)\n return false;\n }\n\n int p = 0;\n foreach (int item in combo)\n p += item;\n\n if(p < minP ^ p > maxP)\n return false;\n return true;\n }\n static List GetCombination(int[] items)\n {\n int countCombos = Convert.ToInt32(Math.Pow(2, items.Count())) - 1;\n // char[] mask;\n string mask;\n List combos = new List();\n List temp = new List();\n for (int i = 1; i <= countCombos; i++)\n {\n mask = Convert.ToString(i, 2);//.PadLeft(items.Count(), '0').ToArray();\n for (int j = 0; j < mask.Length; j++)\n {\n if (mask[j] == '1')\n temp.Add(items[mask.Length-j-1]);\n }\n if (temp.Count > 1)\n combos.Add(temp.ToArray());\n temp.Clear();\n }\n return combos;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0923afd94021ed3635993aaa0ae3d92e", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main(string[ ] args)\n\t{\n\t\tstring[ ] First = Console.ReadLine( ).Trim(' ').Split(' ');\n\t\tbyte\tnTasks = byte.Parse(First[0]);\t\t//\t\u0417\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u043b\u0435\u0442\u043e\u0432\n\t\tUInt64\tSetMin = UInt64.Parse(First[1]),\t//\t\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\t\t\tSetMax = UInt64.Parse(First[2]);\t//\t\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\tUInt32 MinDiff = UInt32.Parse(First[3]);\t//\t\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u043c\u043e\u0439 \u0442\u044f\u0436\u0451\u043b\u043e\u0439 \u0438 \u0441\u0430\u043c\u043e\u0439 \u043b\u0451\u0433\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\n\t\tif (nTasks < 1 || SetMin > SetMax)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\n\t\tstring[ ] Second = Console.ReadLine( ).Trim(' ').Split(' ');\n\t\tList Tasks = new List(nTasks);\n\t\tforeach (var Cur in Second)\n\t\t\tTasks.Add(UInt32.Parse(Cur));\n\n\t\tList Set = new List(nTasks + 1);\n\t\tSet.Add(true);\n\t\tfor (byte i = 0; i < nTasks; ++i)\n\t\t\tSet.Add(false);\n\n\t\tUInt64 Answer = 0;\t//\t\u041e\u0442\u0432\u0435\u0442: \u043a\u043e\u043b-\u0432\u043e \u043d\u0430\u0431\u043e\u0440\u043e\u0432\n\t\tdo\n\t\t{\n\t\t\tUInt64 SetSum = 0;\n\t\t\tbyte Min = (byte)Set.IndexOf(true),\n\t\t\t\t Max = Min,\n\t\t\t\t nTrue = 0;\t\t//\t\u041a\u043e\u043b-\u0432\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0437\u0430\u0434\u0430\u0447\n\n\t\t\tfor (byte i = Min; i < nTasks; ++i)\n\t\t\t\tif (Set[i])\n\t\t\t\t{\n\t\t\t\t\t++nTrue;\n\t\t\t\t\tif ((SetSum += Tasks[i]) > SetMax) break;\n\n\t\t\t\t\tif (Tasks[Max] < Tasks[i]) Max = i;\n\t\t\t\t\telse if (Tasks[Min] > Tasks[i]) Min = i;\n\t\t\t\t}\n\n\t\t\tif ((nTrue < 2 || Tasks[Max] - Tasks[Min] >= MinDiff) &&\n\t\t\t\tSetSum >= SetMin &&\n\t\t\t\tSetSum <= SetMax)\n\t\t\t\t++Answer;\n\n\t\t\tfor (byte i = 0; i <= nTasks; ++i)\n\t\t\t\tif (Set[i] = !Set[i])\n\t\t\t\t\tbreak;\n\t\t} while (Set[nTasks] == false);\n\n\t\tConsole.WriteLine(Answer);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "880fdddba2b4188af8d664f6ea33c91e", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main(string[ ] args)\n\t{\n\t\tstring[ ] First = Console.ReadLine( ).Split(' ');\n\t\tbyte\tnTasks = byte.Parse(First[0]);\t\t//\t\u0417\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u043b\u0435\u0442\u043e\u0432\n\t\tUInt64\tSetMin = UInt64.Parse(First[1]),\t//\t\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\t\t\tSetMax = UInt64.Parse(First[2]);\t//\t\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\tUInt32 MinDiff = UInt32.Parse(First[3]);\t//\t\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u043c\u043e\u0439\n\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\u0442\u044f\u0436\u0451\u043b\u043e\u0439 \u0438 \u0441\u0430\u043c\u043e\u0439 \u043b\u0451\u0433\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\n\t\tstring[ ] Second = Console.ReadLine( ).Split(' ');\n\t\tList Tasks = new List( );\n\t\tforeach (var Cur in Second)\n\t\t\tTasks.Add(UInt32.Parse(Cur));\n\n\t\tList Set = new List(nTasks + 1);\n\t\tSet.Add(true);\n\t\tfor (byte i = 0; i < nTasks; ++i)\n\t\t\tSet.Add(false);\n\n\t\tUInt16 Answer = 0;\t//\t\u041e\u0442\u0432\u0435\u0442: \u043a\u043e\u043b-\u0432\u043e \u043d\u0430\u0431\u043e\u0440\u043e\u0432\n\t\tif (SetMin == 0) ++Answer;\t//\t\u0415\u0441\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c 0 \u0437\u0430\u0434\u0430\u0447, \u0442\u043e +1 \u0441\u043f\u043e\u0441\u043e\u0431 \u043a \u043e\u0442\u0432\u0435\u0442\u0443\n\n\t\tdo\n\t\t{\n\t\t\tUInt64 SetSum = 0;\n\t\t\tbyte Min = (byte)Set.IndexOf(true),\n\t\t\t\t Max = Min,\n\t\t\t\t nTrue = 0;\t\t//\t\u041a\u043e\u043b-\u0432\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0437\u0430\u0434\u0430\u0447\n\n\t\t\tfor (byte i = Min; i < nTasks; ++i)\n\t\t\t\tif (Set[i])\n\t\t\t\t{\n\t\t\t\t\t++nTrue;\n\t\t\t\t\tSetSum += Tasks[i];\n\t\t\t\t\tif (Tasks[Max] < Tasks[i]) Max = i;\n\t\t\t\t\telse if (Tasks[Min] > Tasks[i]) Min = i;\n\t\t\t\t}\n\n\t\t\tif ((nTrue < 2 || Tasks[Max] - Tasks[Min] >= MinDiff) &&\n\t\t\t\tSetSum >= SetMin &&\n\t\t\t\tSetSum <= SetMax)\n\t\t\t\t++Answer;\n\n\t\t\tfor (byte i = 0; i <= nTasks; ++i)\n\t\t\t\tif (Set[i] = !Set[i])\n\t\t\t\t\tbreak;\n\t\t} while (Set[nTasks] == false);\n\n\t\tConsole.WriteLine(Answer);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f637575b9240783e6baf696541cb8acc", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task3\n{\n class Program\n { \n static void Main(string[] args)\n {\n int productsCount;\n int minWeight;\n int maxWeight;\n int minDifference;\n List weights = new List();\n\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:\");\n string[] inputString = Console.ReadLine().Split(' ');\n \n productsCount = Convert.ToInt32(inputString[0]);\n minWeight = Convert.ToInt32(inputString[1]);\n maxWeight = Convert.ToInt32(inputString[2]);\n minDifference = Convert.ToInt32(inputString[3]);\n\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:\");\n string[] inputWeights = Console.ReadLine().Split(' ');\n\n if (inputWeights.Length != productsCount)\n {\n Console.WriteLine(\"count weights error!!!\");\n return;\n }\n\n for (int i = 0; i < productsCount; i++)\n {\n weights.Add(Convert.ToInt32(inputWeights[i]));\n }\n\n List> productSets = CreateProductSets(weights);\n\n int countVar = 0;\n\n foreach (List subset in productSets)\n {\n int totalWeight = subset.Sum();\n int heaviestItem = subset.Max();\n int easiestItem = subset.Min();\n int difference = heaviestItem - easiestItem;\n\n if (totalWeight >= minWeight && totalWeight <= maxWeight)\n if (difference >= minDifference)\n countVar++; \n }\n\n Console.WriteLine();\n Console.WriteLine(\"Result: \" + countVar);\n Console.ReadLine();\n }\n\n static List> CreateProductSets(List weights)\n {\n List> productSets = new List>();\n\n for (int i = 0; i < weights.Count; i++)\n {\n int subsetCount = productSets.Count;\n productSets.Add(new List { weights[i] });\n\n for (int j = 0; j < subsetCount; j++)\n {\n int[] newSubset = new int[productSets[j].Count + 1];\n productSets[j].CopyTo(newSubset, 0);\n newSubset[newSubset.Length - 1] = weights[i];\n productSets.Add(newSubset.ToList());\n }\n }\n\n return productSets;\n }\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "27ad14937244ac150fbb6c0acc97fae2", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "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 _307b\n{\n class Program\n {\n const string _inputFilename = \"\";\n const string _outputFilename = \"\";\n\n static void Main(string[] args)\n {\n\n var outputWriter = new StreamWriter(Console.OpenStandardOutput(), Encoding.Default, 1024 * 1024);\n\n#if DEBUG\n Console.SetIn(getInput());\n#else\n if (!string.IsNullOrEmpty(_inputFilename))\n {\n var inputStream = new FileStream(_inputFilename, FileMode.Open);\n outputWriter = new StreamWriter(_outputFilename, true, Encoding.Default, 1024 * 1024);\n\n Console.SetIn(File.OpenText(_inputFilename));\n }\n#endif\n Console.SetOut(outputWriter);\n\n try\n {\n solution();\n }\n finally\n {\n outputWriter.Close();\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var a = Console.ReadLine();\n var b = Console.ReadLine();\n var c = Console.ReadLine();\n\n var ac = new int[26];\n var bn = new int[26];\n var cn = new int[26];\n\n for (int i = 0; i < a.Length; i++)\n {\n // 97\n var next = ((int)a[i]) - 97;\n ac[next]++;\n }\n\n for (int i = 0; i < b.Length; i++)\n {\n var next = ((int)b[i]) - 97;\n bn[next]++;\n }\n\n for (int i = 0; i < c.Length; i++)\n {\n var next = ((int)c[i]) - 97;\n cn[next]++;\n }\n\n var maxb = 0;\n var maxc = 0;\n var max = 0;\n var temp = new int[26];\n for (int i = 0; i < a.Length; i++)\n {\n var can = i * b.Length <= a.Length;\n if (!can)\n {\n break;\n }\n\n for (int j = 0; j < 26; j++)\n {\n temp[j] = ac[j] - i * bn[j];\n\n if (temp[j] < 0)\n {\n can = false;\n break;\n }\n }\n\n if (!can)\n {\n continue;\n }\n\n var cc = int.MaxValue;\n for (int j = 0; j < 26; j++)\n {\n if (cn[j] != 0)\n {\n cc = Math.Min(cc, temp[j] / cn[j]);\n }\n }\n\n if (cc + i > max)\n {\n max = cc + i;\n maxb = i;\n maxc = cc;\n }\n }\n\n if (max == 0)\n {\n Console.WriteLine(a);\n return;\n }\n else\n {\n var gcan = false;\n var bcount = maxb;\n var ccount = maxc;\n\n\n for (int j = 0; j < 26; j++)\n {\n ac[j] -= bn[j] * bcount + cn[j] * ccount;\n }\n\n\n var sb = new StringBuilder();\n for (int i = 0; i < bcount; i++)\n {\n sb.Append(b);\n }\n\n for (int i = 0; i < ccount; i++)\n {\n sb.Append(c);\n }\n\n for (int i = 0; i < 26; i++)\n {\n for (int j = 0; j < ac[i]; j++)\n {\n sb.Append(((char)(i + 97)));\n }\n }\n\n Console.WriteLine(sb.ToString());\n }\n\n //var l = 0;\n //var r = a.Length;\n //while (true)\n //{\n // if (l == r)\n // {\n // break;\n // }\n\n // var mid = l + (r - l + 1) / 2;\n\n // var gcan = false;\n // for (int i = 0; i < mid + 1; i++)\n // {\n // var bcount = i;\n // var ccount = mid - i;\n // var can = true;\n // for (int j = 0; j < 26; j++)\n // {\n // if (ac[j] - bn[j] * bcount - cn[j] * ccount < 0)\n // {\n // can = false;\n // break;\n // }\n // }\n\n // if (can)\n // {\n // gcan = true;\n // break;\n // }\n // }\n\n // if (gcan)\n // {\n // l = mid;\n // }\n // else\n // {\n // r = mid - 1;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "09f4a59f071a76272dbf80abb78b37da", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\tusing System;\n\n\tnamespace Project_1\n\t{\n\t\tclass MainClass\n\t\t{\n\t\t\tpublic static void Main(string[] args)\n\t\t\t{\n\t\t\t\t/*\tstring s;\n\t\t\t\t\ts = Console.ReadLine();\n\t\t\t\t\tstring str = \"hello\";\n\t\t\t\t\tConsole.WriteLine(str[0]+s);\n\t\t\t\t\tConsole.WriteLine(Calc(3, 5));*/\n\t\t\t\t//\u0412\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435\n\t\t\t\tint el_count=0;//\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432\n\t\t\t\tint min_weight=0, max_weight=0;//\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u0441 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432\n\t\t\tint min_element=0,max_element = 0;//\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u0441 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\t\t\tint diff = 0;//\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0432\u0435\u0441\u0435 \u043c\u0435\u0436\u0434\u0443 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430\u043c\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435\n\t\t\t\tint count = 0;//\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439\n\t\t\tString str,substr=\"1\";\n\t\t\t//\tConsole.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432: \");\n\t\t\t\tel_count = Int32.Parse(Console.ReadLine());\n\t\t//\t\tConsole.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0449\u0438\u0439 \u0432\u0435\u0441: \");\n\t\t\t\tmin_weight = Int32.Parse(Console.ReadLine());\n\t\t//\t\tConsole.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0449\u0438\u0439 \u0432\u0435\u0441: \");\n\t\t\t\tmax_weight = Int32.Parse(Console.ReadLine());\n\t\t//\t\tConsole.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432 \u0432\u0435\u0441\u0435 \u043c/\u0443 \u0441\u0430\u043c\u044b\u043c \u043b\u0435\u0433\u043a\u0438\u043c \u0438 \u0441\u0430\u043c\u044b\u043c \u0442\u044f\u0436\u0435\u043b\u044b\u043c \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430\u043c\u0438: \");\n\t\t\t\tdiff = Int32.Parse(Console.ReadLine());\n\t\t\t\tint[] mas = new int[el_count];\n\n\n string[] lines1 = Console.ReadLine().Split(' ');\n\n\t\t//\t\tConsole.WriteLine(\"\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432\u0435\u0441\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432\");\n\t\t\t\tfor (int i = 0; i < mas.Length; i++)\n\t\t\t\t{\n\t\t\t//\t\tConsole.Write(\"\u0432\u0435\u0441 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430 \u2116 {0}: \",i+1);\n\t\t\t\t\tmas[i] = Int32.Parse(lines1[i]/*Console.ReadLine()*/);\n\t\t\t\t}\n\t\t\t\t// \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430\n\t\t\t\tint temp=0;\n\t\t\t\tfor (int i = 0; i < mas.Length - 1; i++)\n\t\t\t\t{\n\t\t\t\t\tfor (int j = i + 1; j < mas.Length; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (mas[i] > mas[j])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttemp = mas[i];\n\t\t\t\t\t\t\tmas[i] = mas[j];\n\t\t\t\t\t\t\tmas[j] = temp;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// \u0432\u044b\u0432\u043e\u0434\n\t\t\t\t/*Console.WriteLine(\"\u0412\u044b\u0432\u043e\u0434 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430\");\n\t\t\t\tfor (int i = 0; i < mas.Length; i++)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(mas[i]);\n\t\t\t\t}*/\n\t\t\t\t//Console.ReadLine();\n\t\t\ttemp = 0;\n\t\t\tfor (int i = 0; i < Math.Pow(2,mas.Length); i++)\n\t\t\t\t{\n\t\t\t\t\tstr = Convert.ToString(i, 2);\n\t\t\t\t\twhile (str.Length < mas.Length)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr = \"0\" + str;\n\t\t\t\t\t\t}\n\t\t\t\t//\u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 str \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 0/1\n\t\t\t\tmin_element = 0;\n\t\t\t\tmax_element = 0;\n\t\t\t\ttemp = 0;\n\t\t\t\tfor (int j = 0; j < mas.Length; j++)\n\t\t\t\t{\n\n\t\t\t\t\tif (Convert.ToString(str[j]) == \"1\")\n\t\t\t\t\t{\n\t\t\t\t\t\tif (min_element == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmin_element = mas[j];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (max_element == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmax_element = mas[j];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (min_element > mas[j])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmin_element = mas[j];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (max_element < mas[j])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmax_element = mas[j];\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttemp += mas[j];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ((max_element - min_element) >= diff && temp >= min_weight && temp <= max_weight)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t//Console.WriteLine(str);\n\t\t\t\t}\n\n\t\t\tConsole.WriteLine(/*\"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439: \"+*/Convert.ToString(count));\n\t\t\t}\n\t\t\tstatic int Calc(int a, int b)\n\t\t\t{\n\t\t\t\treturn a + b;\n\t\t\t}\n\t\t}\n\t}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5dc61605e71dd18a8a691191057fcc14", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "program Project3;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,\n Math;\n\nvar\n inStr: string;\n n, i, ii, MaxCombinations, dv,j: Integer;\n m, k, p, TotalWeigth, MinWeigth, MaxWeigth, PacksCount: Integer;\n Goods: array of Integer;\n TempGoods:array of Integer;\n\nfunction ExtractNextNum(s: string):string;\nbegin\n Result := Copy(inStr,1,Pos(' ', inStr)-1);\n Delete(inStr,1,Pos(' ', inStr));\nend;\n\nbegin\n Readln(inStr);\n inStr := inStr + ' ';\n n := StrToInt(ExtractNextNum(inStr));\n m := StrToInt(ExtractNextNum(inStr));\n k := StrToInt(ExtractNextNum(inStr));\n p := StrToInt(ExtractNextNum(inStr));\n\n Readln(inStr);\n inStr := inStr + ' ';\n SetLength(Goods, n);\n for i:=0 to n-1 do\n begin\n Goods[i]:= StrToInt(ExtractNextNum(inStr));\n end;\n\n PacksCount:=0;\n\n MaxCombinations := Trunc(Power(2, n));// - 1; //\u0432\u0441\u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043d\u0430\u0431\u043e\u0440\u044b \u0442\u043e\u0432\u0430\u0440\u043e\u0432\n\n for i:=1 to MaxCombinations do //\n begin\n SetLength(TempGoods,0);\n //\u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0435\u0439 \u0442\u043e\u0432\u0430\u0440\u043e\u0432\n //\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c i \u043a\u0430\u043a \u0434\u0432\u043e\u0438\u0447\u043d\u0443\u044e \u043c\u0430\u0441\u043a\u0443 \u043e\u0442\u0431\u043e\u0440\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0442\u043e\u0432\u0430\u0440\u043e\u0432\n // for ii:=0 to n-1 do \n dv:=i;\n\tii:=0 ;\n\twhile (dv>0) do\n\tbegin\n\t if((dv mod 2)=1) then\n\t\n // if ( (i and Trunc(Power(2,ii))) = (Trunc(Power(2,ii))) ) then\n\t\t begin\n\t\t SetLength(TempGoods,Length(TempGoods)+1);\n TempGoods[Length(TempGoods)-1]:=Goods[ii];\n end;\n\t\t dv := dv div 2;\n\t\t\t ii:=ii+1;\n end;\n\n if Length(TempGoods)<2 then Continue;//\u043d\u0430\u0431\u043e\u0440 \u0438\u0437 1 \u0442\u043e\u0432\u0430\u0440\u0430 \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0442\n\n TotalWeigth := 0;\n MinWeigth:=TempGoods[0];\n MaxWeigth:=TempGoods[0];\n \n for ii:=0 to Length(TempGoods)-1 do\n begin\n TotalWeigth:=TotalWeigth + TempGoods[ii];\n if MinWeigth > TempGoods[ii] then MinWeigth:= TempGoods[ii];\n if MaxWeigth < TempGoods[ii] then MaxWeigth:= TempGoods[ii];\n end;\n\n if ((TotalWeigth < m) or (TotalWeigth > k)) then Continue; //\u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0433\u043e \u0432\u0435\u0441\u0430\n if ((MaxWeigth - MinWeigth) < p) then Continue; //\u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043a\u0440\u0430\u0439\u043d\u0438\u0445 \u0432\u0435\u0441\u043e\u0432\n\n Inc(PacksCount);//\u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u043e\u0434\u043e\u0448\u043b\u0438 - \u0431\u0435\u0440\u0435\u043c \u043a\u0430\u043a \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0430\u0447\u043a\u0438 \u0442\u043e\u0432\u0430\u0440\u043e\u0432\n\n end;\n\n Writeln(inttostr(PacksCount));\n // readln;\n\nend.\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f38a9794bc5d4a98dc5cfd938a8fe9ba", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Mono C#", "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\t\tpublic static int Euclidean(int n1, int n2)\n\t\t{\n\t\t\tif (n1 == n2) return n1;\n\t\t\telse if (n1 < n2)\n\t\t\t{\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n\n\t\t\twhile (n1 % n2 > 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n public static ulong Euclidean(ulong n1, ulong n2)\n\t\t{\n\t\t\tif (n1 == n2) return n1;\n\t\t\telse if (n1 < n2)\n\t\t\t{\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n\n\t\t\twhile (n1 % n2 > 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n\n public static long Inverse(long a, long n)\n\t\t{\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\t\t{\n x = 0;\n y = 1; \n \n bool r = false;\n\t\t\tif (n1 == n2) return n1;\n\n\t\t\telse if (n1 < n2)\n\t\t\t{\n r = true;\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n long q = 0;\n long xl =1;\n long yl = 0;\n\n\t\t\twhile (n2 > 0)\n\t\t\t{\n q = n1 / n2;\n\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = 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\t\t\t}\n x = xl;\n y = yl;\n if (r)\n { \n x =yl;\n y =xl;\n }\n\t\t\treturn x*n1+y*n2;\n\t\t}\n\t}\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\n static Tuple PInOneSide(uint cnt, uint 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(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n (leftCnt - leftACnt) * (leftCnt - leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n static Tuple PDecreaseLeftA(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n leftACnt * (totalcnt - 2 * leftCnt + leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n\n static Tuple PSameInBothSide(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n (leftCnt - leftACnt) * (totalcnt + 2 * leftACnt - 2 * leftCnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n const ulong 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.ToUInt64);\n var n = (uint)tmp[0];\n var k = tmp[1];\n\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToByte);\n\n var leftcnt = (uint)arr.Count(el=>el==0);\n var leftAcnt = (uint)arr.Where((el, i)=>el == 0 && i[] F =Enumerable.Repeat(0, (int)(leftcnt - lowerBnd+1))\n .Select(el =>new Tuple(0, 0)).ToArray();\n \n\n F[leftAcnt - lowerBnd] = Tuple.Create(1ul,1ul);\n for(ulong j = 0; j < k; j++)\n {\n Tuple[] Ftmp = new Tuple[leftcnt - lowerBnd+1];\n\n for(uint i =0; i <= leftcnt - lowerBnd; i++) \n {\n \n var res = prod(F[i], PInOneSide(leftcnt, n));\n res = sum(res,prod(F[i], PSameInBothSide(leftcnt, i+lowerBnd , n)));\n if (i > 0)\n res = sum(res,prod(F[i - 1], PIncreaseLeftA(leftcnt, i+lowerBnd -1 , n)));\n if (i < leftcnt - lowerBnd)\n res = sum(res,prod(F[i + 1], PDecreaseLeftA(leftcnt, i+lowerBnd + 1 , n)));\n Ftmp[i] = res;\n }\n F = Ftmp;\n }\n var gcd = GCD.Euclidean(F.Last().Item1, F.Last().Item2);\n var ret = Tuple.Create(F.Last().Item1 / gcd, F.Last().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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2d470a3604baff9694ec57b9aa58839b", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "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\t\tpublic static int Euclidean(int n1, int n2)\n\t\t{\n\t\t\tif (n1 == n2) return n1;\n\t\t\telse if (n1 < n2)\n\t\t\t{\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n\n\t\t\twhile (n1 % n2 > 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n public static ulong Euclidean(ulong n1, ulong n2)\n\t\t{\n\t\t\tif (n1 == n2) return n1;\n\t\t\telse if (n1 < n2)\n\t\t\t{\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n\n\t\t\twhile (n1 % n2 > 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n\n public static long Inverse(long a, long n)\n\t\t{\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\t\t{\n x = 0;\n y = 1; \n \n bool r = false;\n\t\t\tif (n1 == n2) return n1;\n\n\t\t\telse if (n1 < n2)\n\t\t\t{\n r = true;\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n long q = 0;\n long xl =1;\n long yl = 0;\n\n\t\t\twhile (n2 > 0)\n\t\t\t{\n q = n1 / n2;\n\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = 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\t\t\t}\n x = xl;\n y = yl;\n if (r)\n { \n x =yl;\n y =xl;\n }\n\t\t\treturn x*n1+y*n2;\n\t\t}\n\t}\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\n static Tuple PInOneSide(uint cnt, uint 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(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n (leftCnt - leftACnt) * (leftCnt - leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n static Tuple PDecreaseLeftA(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n leftACnt * (totalcnt - 2 * leftCnt + leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n static void CalcCashe(uint lowerBnd, uint leftCnt, uint 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(uint 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(uint leftCnt, uint leftACnt, uint 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 ulong 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.ToUInt64);\n var n = (uint)tmp[0];\n var k = tmp[1];\n\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToByte);\n\n var leftcnt = (uint)arr.Count(el=>el==0);\n var leftAcnt = (uint)arr.Where((el, i)=>el == 0 && i[] F =Enumerable.Repeat(0, (int)(leftcnt - lowerBnd+1))\n .Select(el =>new Tuple(0, 0)).ToArray(); \n\n F[leftAcnt - lowerBnd] = Tuple.Create(1ul,1ul);\n\n CalcCashe(lowerBnd,leftcnt, n);\n\n for(ulong j = 0; j < k; j++)\n {\n Tuple[] Ftmp = new Tuple[leftcnt - lowerBnd+1];\n\n for(uint i =0; i <= leftcnt - lowerBnd; i++) \n {\n \n var res = prod(F[i], PInOneSideCache);\n res = sum(res,prod(F[i], PSameInBothSideCache[i]));\n if (i > 0)\n res = sum(res,prod(F[i - 1], PIncreaseLeftACache[i-1]));\n if (i < leftcnt - lowerBnd)\n res = sum(res,prod(F[i + 1], PDecreaseLeftACache[i+1]));\n Ftmp[i] = res;\n }\n F = Ftmp;\n }\n if (F.Last().Item1 ==0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n var gcd = GCD.Euclidean(F.Last().Item1, F.Last().Item2);\n var ret = Tuple.Create(F.Last().Item1 / gcd, F.Last().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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b3a54cfe479fd4fabfe8bdff5ac04a8", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "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 = Number;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "071135603d2e4b814552965f9cc1117a", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "82104eace9bed0d81a88f74b7b1a27ad", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "742b01df84ded40a918efe908e0d6814", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": ".NET Core C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d8c3860ab863f58dc73ef211113f48fe", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bdab09ca3c2ea40a86840fe985385ef1", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "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\t\tpublic static int Euclidean(int n1, int n2)\n\t\t{\n\t\t\tif (n1 == n2) return n1;\n\t\t\telse if (n1 < n2)\n\t\t\t{\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n\n\t\t\twhile (n1 % n2 > 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n public static ulong Euclidean(ulong n1, ulong n2)\n\t\t{\n\t\t\tif (n1 == n2) return n1;\n\t\t\telse if (n1 < n2)\n\t\t\t{\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n\n\t\t\twhile (n1 % n2 > 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n\n public static long Inverse(long a, long n)\n\t\t{\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\t\t{\n x = 0;\n y = 1; \n \n bool r = false;\n\t\t\tif (n1 == n2) return n1;\n\n\t\t\telse if (n1 < n2)\n\t\t\t{\n r = true;\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n long q = 0;\n long xl =1;\n long yl = 0;\n\n\t\t\twhile (n2 > 0)\n\t\t\t{\n q = n1 / n2;\n\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = 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\t\t\t}\n x = xl;\n y = yl;\n if (r)\n { \n x =yl;\n y =xl;\n }\n\t\t\treturn x*n1+y*n2;\n\t\t}\n\t}\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\n static Tuple PInOneSide(uint cnt, uint 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(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n (leftCnt - leftACnt) * (leftCnt - leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n static Tuple PDecreaseLeftA(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n leftACnt * (totalcnt - 2 * leftCnt + leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n\n static Tuple PSameInBothSide(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n (leftCnt - leftACnt) * (totalcnt + 2 * leftACnt - 2 * leftCnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n const ulong 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.ToUInt64);\n var n = (uint)tmp[0];\n var k = tmp[1];\n\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToByte);\n\n var leftcnt = (uint)arr.Count(el=>el==0);\n var leftAcnt = (uint)arr.Where((el, i)=>el == 0 && i[] F =Enumerable.Repeat(0, (int)(leftcnt - lowerBnd+1))\n .Select(el =>new Tuple(0, 0)).ToArray();\n \n\n F[leftAcnt - lowerBnd] = Tuple.Create(1ul,1ul);\n for(ulong j = 0; j < k; j++)\n {\n Tuple[] Ftmp = new Tuple[leftcnt - lowerBnd+1];\n\n for(uint i =0; i <= leftcnt - lowerBnd; i++) \n {\n \n var res = prod(F[i], PInOneSide(leftcnt, n));\n res = sum(res,prod(F[i], PSameInBothSide(leftcnt, i+lowerBnd , n)));\n if (i > 0)\n res = sum(res,prod(F[i - 1], PIncreaseLeftA(leftcnt, i+lowerBnd -1 , n)));\n if (i < leftcnt - lowerBnd)\n res = sum(res,prod(F[i + 1], PDecreaseLeftA(leftcnt, i+lowerBnd + 1 , n)));\n Ftmp[i] = res;\n }\n F = Ftmp;\n }\n if (F.Last().Item1 ==0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n var gcd = GCD.Euclidean(F.Last().Item1, F.Last().Item2);\n var ret = Tuple.Create(F.Last().Item1 / gcd, F.Last().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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a83c3c867d753b456dab48551f4bebb2", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "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 = ModInt;\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;\n\t\t\t\tmat[j, j] += (K * (K - 1) / 2 + M * (M - 1) / 2 + j * (M - j) + j * (K - j)) * coef;\n\t\t\t\tif (j != n) mat[j + 1, j] += (K - j) * (M - j) * coef;\n\t\t\t}\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]);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ef00ef23114f876bf63cd5ff93f0b88b", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "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\t\tpublic static int Euclidean(int n1, int n2)\n\t\t{\n\t\t\tif (n1 == n2) return n1;\n\t\t\telse if (n1 < n2)\n\t\t\t{\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n\n\t\t\twhile (n1 % n2 > 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n public static ulong Euclidean(ulong n1, ulong n2)\n\t\t{\n\t\t\tif (n1 == n2) return n1;\n\t\t\telse if (n1 < n2)\n\t\t\t{\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n\n\t\t\twhile (n1 % n2 > 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n\n public static long Inverse(long a, long n)\n\t\t{\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\t\t{\n x = 0;\n y = 1; \n \n bool r = false;\n\t\t\tif (n1 == n2) return n1;\n\n\t\t\telse if (n1 < n2)\n\t\t\t{\n r = true;\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n long q = 0;\n long xl =1;\n long yl = 0;\n\n\t\t\twhile (n2 > 0)\n\t\t\t{\n q = n1 / n2;\n\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = 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\t\t\t}\n x = xl;\n y = yl;\n if (r)\n { \n x =yl;\n y =xl;\n }\n\t\t\treturn x*n1+y*n2;\n\t\t}\n\t}\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\n static Tuple PInOneSide(uint cnt, uint 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(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n (leftCnt - leftACnt) * (leftCnt - leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n static Tuple PDecreaseLeftA(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n leftACnt * (totalcnt - 2 * leftCnt + leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n\n static Tuple PSameInBothSide(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n (leftCnt - leftACnt) * (totalcnt + 2 * leftACnt - 2 * leftCnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n const ulong 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.ToUInt64);\n var n = (uint)tmp[0];\n var k = tmp[1];\n\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToByte);\n\n var leftcnt = (uint)arr.Count(el=>el==0);\n var leftAcnt = (uint)arr.Where((el, i)=>el == 0 && i[] F =Enumerable.Repeat(0, (int)(leftcnt - lowerBnd+1))\n .Select(el =>new Tuple(0, 0)).ToArray();\n \n\n F[leftAcnt - lowerBnd] = Tuple.Create(1ul,1ul);\n for(ulong j = 0; j < k; j++)\n {\n Tuple[] Ftmp = new Tuple[leftcnt - lowerBnd+1];\n\n for(uint i =0; i <= leftcnt - lowerBnd; i++) \n {\n \n var res = prod(F[i], PInOneSide(leftcnt, n));\n res = sum(res,prod(F[i], PSameInBothSide(leftcnt, i+lowerBnd , n)));\n if (i > 0)\n res = sum(res,prod(F[i - 1], PIncreaseLeftA(leftcnt, i+lowerBnd -1 , n)));\n if (i < leftcnt - lowerBnd)\n res = sum(res,prod(F[i + 1], PDecreaseLeftA(leftcnt, i+lowerBnd + 1 , n)));\n Ftmp[i] = res;\n }\n F = Ftmp;\n }\n var gcd = GCD.Euclidean(F.Last().Item1, F.Last().Item2);\n var ret = Tuple.Create(F.Last().Item1 / gcd, F.Last().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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9c23d1729f451bd50acbec249bf36a95", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "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\t\tpublic static int Euclidean(int n1, int n2)\n\t\t{\n\t\t\tif (n1 == n2) return n1;\n\t\t\telse if (n1 < n2)\n\t\t\t{\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n\n\t\t\twhile (n1 % n2 > 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n public static ulong Euclidean(ulong n1, ulong n2)\n\t\t{\n\t\t\tif (n1 == n2) return n1;\n\t\t\telse if (n1 < n2)\n\t\t\t{\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n\n\t\t\twhile (n1 % n2 > 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n\n public static long Inverse(long a, long n)\n\t\t{\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\t\t{\n x = 0;\n y = 1; \n \n bool r = false;\n\t\t\tif (n1 == n2) return n1;\n\n\t\t\telse if (n1 < n2)\n\t\t\t{\n r = true;\n\t\t\t\tvar tmp = n1;\n\t\t\t\tn1 = n2;\n\t\t\t\tn2 = tmp;\n\t\t\t}\n long q = 0;\n long xl =1;\n long yl = 0;\n\n\t\t\twhile (n2 > 0)\n\t\t\t{\n q = n1 / n2;\n\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = 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\t\t\t}\n x = xl;\n y = yl;\n if (r)\n { \n x =yl;\n y =xl;\n }\n\t\t\treturn x*n1+y*n2;\n\t\t}\n\t}\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\n static Tuple PInOneSide(uint cnt, uint 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(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n (leftCnt - leftACnt) * (leftCnt - leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n static Tuple PDecreaseLeftA(uint leftCnt, uint leftACnt, uint totalcnt)\n {\n return Tuple.Create(\n leftACnt * (totalcnt - 2 * leftCnt + leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n static void CalcCashe(uint lowerBnd, uint leftCnt, uint 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(uint 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(uint leftCnt, uint leftACnt, uint 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 ulong 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.ToUInt64);\n var n = (uint)tmp[0];\n var k = tmp[1];\n\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToByte);\n\n var leftcnt = (uint)arr.Count(el=>el==0);\n var leftAcnt = (uint)arr.Where((el, i)=>el == 0 && i[] F =Enumerable.Repeat(0, (int)(leftcnt - lowerBnd+1))\n .Select(el =>new Tuple(0, 0)).ToArray(); \n\n F[leftAcnt - lowerBnd] = Tuple.Create(1ul,1ul);\n\n CalcCashe(lowerBnd,leftcnt, n);\n\n for(ulong j = 0; j < k; j++)\n {\n Tuple[] Ftmp = new Tuple[leftcnt - lowerBnd+1];\n\n for(uint i =0; i <= leftcnt - lowerBnd; i++) \n {\n \n var res = prod(F[i], PInOneSideCache);\n res = sum(res,prod(F[i], PSameInBothSideCache[i]));\n if (i > 0)\n res = sum(res,prod(F[i - 1], PIncreaseLeftACache[i-1]));\n if (i < leftcnt - lowerBnd)\n res = sum(res,prod(F[i + 1], PDecreaseLeftACache[i+1]));\n Ftmp[i] = res;\n }\n F = Ftmp;\n }\n if (F.Last().Item1 ==0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n var gcd = GCD.Euclidean(F.Last().Item1, F.Last().Item2);\n var ret = Tuple.Create(F.Last().Item1 / gcd, F.Last().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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b7166971783464795cbef0b2441295c4", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "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\tint n = int.Parse(Console.ReadLine());\n\t\t\n\t\tfor (int i = 2; i < n; i++)\n\t\t{\n\t\t\tif (n % i == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(i + \"\" + (n / i));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5fd1331524363b5a4203ba05cdc836f8", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "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 }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9665e875a7e6e2accfd5ebc4c25dc36d", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n public class Program\n {\n static void Main(string[] args)\n {\n \n Console.WriteLine(\"YES\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "10ba1184180e515fcc0846daa9b87314", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace \u041f\u0435\u0440\u0432\u043e\u0430\u043f\u0440\u0435\u043b\u044c\u0441\u043a\u0438\u0439_\u043a\u043e\u043d\u0442\u0435\u0441\u0442_2020\n{\n class A\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"YES\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "be1f958a4487efe84b09390241202d8d", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n Console.WriteLine(\"yes\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "67fac88cb0391edec6469c3c647b2d6f", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "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\t;\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8b49fc2a781c4e4bf0e5da62a4a41292", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "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 t = Convert.ToInt32(Console.ReadLine());\n for (int tt = 0; tt < t; ++tt)\n {\n\n }\n Console.ReadLine();\n }\n\n public static int GCD(int a, int b)\n {\n while (b > 0)\n {\n a %= b;\n int tmp = b;\n b = a;\n a = tmp;\n }\n return a;\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c81f905bfb2569d978967ac104ac9a5f", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "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 t = Convert.ToInt32(Console.ReadLine());\n //for (int tt = 0; tt < t; ++tt)\n //{\n\n //}\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n\n public static int GCD(int a, int b)\n {\n while (b > 0)\n {\n a %= b;\n int tmp = b;\n b = a;\n a = tmp;\n }\n return a;\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3ff3a9ea59e5decd9eee1a8fc3dbdeb5", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace AprilFirstCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"No\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "68d8fcc22b454752606a4a524c964688", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "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 MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;\nusing MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;\n\n\npublic static class P\n{\n static void Main()\n {\n Console.WriteLine(\"No\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "12bef30a649ad4ca45870b0c859722ac", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "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 Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8c164c300250917958d207da88f4aa48", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "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.Write(\"no\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9944a8cd11af14050e17a7ebcfac6902", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Simple\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"No\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2fc289ff83cdebc46fc7cfed30a9b73b", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e943018ea8410975a64476a1d70e4cd4", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "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.WriteLine(\"no\");\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9a512f83f43b8a1767d235059c7fa8db", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nclass HelloWorld {\n static void Main() {\n Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "16cecb2f8d91a8ff6c5accc64aee8db8", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AprilFools\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"No\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "033a0d9c9da8d4aa2cc5764c9897dcb1", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "285327cb08ca0659bde978eb398a5b0c", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tConsole.WriteLine(\"NO\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2f2e55d878f233f4762222dec9a84dc4", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KickStartRoundA\n{\n\n class Program\n {\n\n \n\n static void Main(string[] args)\n {\n\n\n Console.WriteLine(\"NO\");\n\n \n\n\n\n }\n }\n }\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "27e50cc39af29b0479e11866d7fd1812", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n public class Program\n {\n static void Main(string[] args)\n {\n \n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "24d7b8528a8cc9375a8947a6f47e1976", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "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\tConsole.WriteLine(\"NO\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a8c720444975062f527f230e27ecd943", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n Console.WriteLine(\"no\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "02955d4a7348351480e1b531a38ce4c5", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace ProgrammingContestTemplateByDotNetCore\n{\n #region \"Input and Output Classes\"\n\n class Scanner : IDisposable\n {\n private readonly Queue _buffer;\n private readonly char[] _sep;\n private readonly TextReader _reader;\n\n public Scanner(TextReader reader = null, char[] sep = null)\n {\n _buffer = new Queue();\n _sep = sep ?? new[] { ' ' };\n _reader = reader ?? Console.In;\n }\n\n public Scanner(string path, char[] sep = null)\n : this(new StreamReader(path), sep) { }\n\n private void CheckBuffer()\n {\n if (_buffer.Any() || _reader.Peek() == -1)\n return;\n\n string str = string.Empty;\n for (;\n string.IsNullOrWhiteSpace(str);\n str = _reader.ReadLine()) { }\n\n var values = str.Split(_sep).Where(s => !string.IsNullOrWhiteSpace(s));\n foreach (var item in values)\n {\n _buffer.Enqueue(item);\n }\n }\n\n public string Next()\n {\n CheckBuffer();\n return _buffer.Dequeue();\n }\n public string[] GetStringArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => Next())\n .ToArray();\n\n public int NextInt() => int.Parse(Next());\n public int[] GetIntArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => NextInt())\n .ToArray();\n\n public long NextLong() => long.Parse(Next());\n public long[] GetLongArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => NextLong())\n .ToArray();\n\n public double NextDouble() => double.Parse(Next());\n public double[] GetDoubleArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => NextDouble())\n .ToArray();\n\n public decimal NextDecimal() => decimal.Parse(Next());\n public decimal[] GetDecimalArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => NextDecimal())\n .ToArray();\n\n public BigInteger NextBigInt() => BigInteger.Parse(Next());\n public BigInteger[] GetBigIntArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => NextBigInt())\n .ToArray();\n\n public T GetT(Func func) => func(this);\n public T[] GetTArray(int count, Func func)\n => Enumerable.Range(0, count)\n .Select(e => GetT(func))\n .ToArray();\n\n public bool IsEnd\n {\n get\n {\n CheckBuffer();\n return !_buffer.Any();\n }\n }\n\n public void Dispose()\n {\n if (!_reader.Equals(Console.In))\n _reader.Dispose();\n }\n }\n\n class Writer : IDisposable\n {\n private readonly TextWriter _writer;\n private readonly StringBuilder _cache;\n private readonly bool _isReactive;\n\n public Writer(TextWriter writer = null, bool isReactive = false)\n {\n _writer = writer ?? Console.Out;\n _isReactive = isReactive;\n if (!_isReactive)\n _cache = new StringBuilder();\n }\n\n public Writer(string path)\n : this(new StreamWriter(path)) { }\n\n public Writer(bool isReactive)\n : this(null, isReactive) { }\n\n public void Write(object value)\n {\n if (_isReactive)\n {\n _writer.Write(value);\n _writer.Flush();\n }\n else\n {\n _cache.Append(value);\n }\n }\n\n public void WriteFormat(string format, params object[] values)\n {\n var value = string.Format(format, values);\n Write(value);\n }\n\n public void WriteLine(object value = null)\n {\n Write($\"{value}{Environment.NewLine}\");\n }\n\n public void WriteLine(string format, params object[] values)\n {\n WriteFormat($\"{format}{Environment.NewLine}\", values);\n }\n\n public void Dispose()\n {\n if (!_isReactive)\n {\n _writer.Write(_cache);\n _writer.Flush();\n }\n if (!_writer.Equals(Console.Out))\n {\n _writer.Dispose();\n }\n }\n }\n\n public static class Extensions\n {\n public static void Set(\n this IDictionary source,\n TKey key, TValue value)\n {\n if (source.ContainsKey(key))\n source[key] = value;\n else\n source.Add(key, value);\n }\n\n public static void Update(\n this IDictionary source,\n TKey key, Func update)\n {\n if (!source.ContainsKey(key))\n source.Add(key, default(TValue));\n source[key] = update(source[key]);\n }\n }\n\n#endregion\n\n class MainClass : IDisposable\n {\n#region \"Template\"\n\n /// \u5165\u529b\u3092\u53d7\u3051\u53d6\u308b \n private readonly Scanner sc;\n /// \u51fa\u529b\u3092\u884c\u3046 \n private readonly Writer wr;\n private const string _inputFile = \"input.txt\";\n private const string _outFile = \"output.txt\";\n\n static void Main(string[] args)\n {\n using (new MainClass()) { }\n }\n\n public MainClass()\n {\n wr = new Writer(_isReactive);\n // TODO: \u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\u3057\u305f\u3044\u5834\u5408\u306f\u3053\u3063\u3061 \u2192 wr = new Writer(_outFile);\n\n#if DEBUG\n // \u624b\u5143\u3067\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u5165\u529b\u3092\u53d7\u3051\u53d6\u308b\n sc = new Scanner(_inputFile);\n#else\n\n // \u63d0\u51fa\u6642\u3001\u6a19\u6e96\u5165\u529b\u304b\u3089\u53d7\u3051\u53d6\u308b\n sc = new Scanner();\n#endif\n\n Solve();\n }\n\n public void Dispose()\n {\n sc?.Dispose();\n wr?.Dispose();\n }\n\n #endregion\n\n void Solve()\n {\n wr.WriteLine(\"No\");\n }\n\n /// \n /// TODO: \u30ea\u30a2\u30af\u30c6\u30a3\u30d6\u554f\u984c\u304b\u5426\u304b\u3092\u6307\u5b9a\u3057\u3066\u306d\u266a\n /// \n private const bool _isReactive = false;\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6637f6d06bde4d0f328e06499c99870", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System.IO;\n\nnamespace CodeForces1 {\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.WriteLine(\"NO\");\n \n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n \n static int[] ReadArray(int length) {\n int[] result = new int[length];\n for(int i = 0; i < length; i++) {\n result[i] = NextInt();\n }\n return result;\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b73bfc0529347cc74ac370302e00448", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\n\n\n\n\n\nclass Program\n{\n \n void solve()\n {\n int n = nextInt();\n string s = nextString();\n long[,] dp = new long[n + 1, n + 1];\n char[,] by = new char[n + 1, n + 1];\n for (int i = 0; i <= n; i++)\n for (int j = 0; j <= n; j++)\n dp[i, j] = -1;\n long res = go(0, 0, 0, n, s, dp, by);\n {\n int i = 0;\n int j = 0;\n string seq = \"\";\n while (i != n || j != n)\n {\n seq += by[i, j];\n if (by[i, j] == 'H')\n {\n i++;\n }\n else\n j++;\n }\n println(seq);\n }\n }\n\n private long go(int l1, int l2,int at, int n, string s,long[,]dp,char[,]by)\n {\n if (dp[l1,l2] != -1)\n return dp[l1,l2];\n if (l1 == n && l2 == n)\n return dp[l1,l2] = 0;\n long res = -1;\n if (l1 != n)\n {\n long cur = pow(n - l1-1) * (s[at] - '0');\n cur += go(l1 + 1, l2, at + 1, n, s, dp,by);\n if (cur > res)\n {\n res = cur;\n by[l1, l2] = 'H';\n \n }\n \n }\n if (l2 != n)\n {\n long cur = pow(n - l2 - 1) * (s[at] - '0');\n cur += go(l1, l2+1, at + 1, n, s, dp,by);\n if (cur > res)\n {\n res = cur;\n by[l1, l2] = 'M';\n }\n }\n \n return dp[l1, l2]=res;\n }\n\n private long pow(int p)\n {\n if (p == 0)\n return 1;\n return pow(p - 1) * 10;\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 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 new Program().solve();\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0c4eb540f8e2b5d8f0da6d0183159387", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace TV_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 private static int[] nn;\n private static int n;\n private static long[] pow;\n\n private static long[,,] dp;\n private static int[,,] pos;\n\n private static void Main(string[] args)\n {\n n = Next();\n nn = new int[2*n];\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = Next(true);\n }\n\n pow = new long[n + 1];\n pow[n] = 1;\n for (int i = n - 1; i > 0; i--)\n {\n pow[i] = 10*pow[i + 1];\n }\n\n dp = new long[n + 1,n + 1,2*n];\n pos = new int[n + 1,n + 1,2*n + 1];\n for (int i = n; i >= 0; i--)\n {\n for (int j = n; j >= 0; j--)\n {\n for (int k = 2*n - 1; k >= 0; k--)\n {\n dp[i, j, k] = -1;\n }\n }\n }\n\n long r = Calc(0, 0, 0);\n\n int p = pos[0, 0, 0];\n int x = 0, y = 0;\n for (int i = 0; i < nn.Length; i++)\n {\n if (i == p)\n {\n writer.Write('M');\n y++;\n p = pos[x, y, i + 1];\n }\n else\n {\n x++;\n writer.Write('H');\n }\n }\n\n writer.WriteLine();\n writer.Flush();\n }\n\n private static long Calc(int x, int y, int index)\n {\n long max = -1;\n\n if (dp[x, y, index] != -1)\n return dp[x, y, index];\n\n if (y == n)\n {\n max = 0;\n for (int i = x + 1, j = index; i <= n; i++,j++)\n {\n max += nn[j]*pow[i];\n }\n pos[x, y, index] = 2*n;\n return dp[x, y, index] = max;\n }\n\n int my = n + y;\n long sum = 0;\n int p = -1;\n for (int i = index, j = x + 1; i < my; i++,j++)\n {\n long val = sum + pow[y + 1]*nn[i] + Calc(j - 1, y + 1, i + 1);\n if (val > max)\n {\n max = val;\n p = i;\n }\n sum += nn[i]*pow[j];\n }\n pos[x, y, index] = p;\n return dp[x, y, index] = max;\n }\n\n private static int Next(bool one = false)\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 if (one)\n return res;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b587f0195c3ea83ce88dd6a6e4c39bf8", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "MS C#", "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 var a = ReadToken().Select(ch => ch - '0').ToArray();\n\n var pow = new long[2 * n];\n pow[0] = 1;\n for (int i = 1; i < 2 * n; i++)\n pow[i] = pow[i - 1] * 10;\n\n var dp = new long[n + 1, n + 1];\n var pdp = new bool[n + 1, n + 1];\n for (int i = 0; i < 2 * n; i++)\n for (int j = 0; j <= i && j <= n; j++)\n {\n int k = i - j;\n if (k > n)\n continue;\n if (j < n && pow[n - j - 1] * a[i] + dp[j, k] >= dp[j + 1, k])\n {\n dp[j + 1, k] = pow[n - j - 1] * a[i] + dp[j, k];\n pdp[j + 1, k] = true;\n }\n if (k < n && pow[n - k - 1] * a[i] + dp[j, k] >= dp[j, k + 1])\n {\n dp[j, k + 1] = pow[n - k - 1] * a[i] + dp[j, k];\n pdp[j, k + 1] = false;\n }\n }\n\n int u = n, v = n;\n var ans = new List();\n while (u > 0 || v > 0)\n {\n if (pdp[u, v])\n {\n ans.Add('H');\n u--;\n }\n else\n {\n ans.Add('M');\n v--;\n }\n }\n\n ans.Reverse();\n Write(string.Concat(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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1e2e5bcbfaea8a149361465353a1c12d", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace TV_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 private static int[] nn;\n private static int n;\n private static long[] pow;\n\n private static long[,] dp;\n private static int[,] pos;\n\n private static void Main(string[] args)\n {\n n = Next();\n nn = new int[2*n];\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = Next(true);\n }\n\n pow = new long[n + 1];\n pow[n] = 1;\n for (int i = n - 1; i > 0; i--)\n {\n pow[i] = 10*pow[i + 1];\n }\n\n dp = new long[n + 1,n + 1];\n pos = new int[n + 1,n + 1];\n for (int i = n; i >= 0; i--)\n {\n for (int j = n; j >= 0; j--)\n {\n for (int k = 2*n - 1; k >= 0; k--)\n {\n dp[i, j] = -1;\n }\n }\n }\n\n long r = Calc(0, 0);\n\n int p = pos[0, 0];\n int x = 0, y = 0;\n for (int i = 0; i < nn.Length; i++)\n {\n if (i == p)\n {\n writer.Write('M');\n y++;\n p = pos[x, y];\n }\n else\n {\n x++;\n writer.Write('H');\n }\n }\n\n writer.WriteLine();\n writer.Flush();\n }\n\n private static long Calc(int x, int y)\n {\n long max = -1;\n\n if (dp[x, y] != -1)\n return dp[x, y];\n\n int index = x + y;\n\n if (y == n)\n {\n max = 0;\n for (int i = x + 1, j = index; i <= n; i++,j++)\n {\n max += nn[j]*pow[i];\n }\n pos[x, y] = 2*n;\n return dp[x, y] = max;\n }\n\n int my = n + y;\n long sum = 0;\n int p = -1;\n for (int i = index, j = x + 1; i < my; i++,j++)\n {\n long val = sum + pow[y + 1]*nn[i] + Calc(j - 1, y + 1);\n if (val > max)\n {\n max = val;\n p = i;\n }\n sum += nn[i]*pow[j];\n }\n pos[x, y] = p;\n return dp[x, y] = max;\n }\n\n private static int Next(bool one = false)\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 if (one)\n return res;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b3d29e81b26ca2c2178ed2d29724f17d", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round31\n{\n class E\n {\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n long[] digit;\n long[,] h, m;\n string[,] s;\n int n;\n\n long val(int i, int j)\n {\n return h[i, j] + m[i, j];\n }\n\n long f(int i, int j)\n {\n return h[i, j] + m[i, j];\n }\n\n public E()\n {\n n = ReadInt();\n string A = Console.ReadLine();\n h = new long[n + 1, n + 1];\n m = new long[n + 1, n + 1];\n s = new string[n + 1, n + 1];\n\n digit = new long[n];\n digit[n - 1] = 1;\n for (int i = n - 2; i >= 0; i--) digit[i] = digit[i + 1] * 10;\n\n for (int i = 0; i <= n; i++)\n for (int j = 0; j <= n; j++)\n h[i, j] = m[i, j] = 0;\n for (int i = 1; i <= n; i++)\n {\n h[i, 0] = m[0, i] = h[i - 1, 0] + digit[i - 1] * (A[i - 1] - '0');\n s[0, i] = s[0, i - 1] + 'M';\n s[i, 0] = s[i - 1, 0] + 'H';\n }\n // h[i,j] : h -> i, m -> j\n // m[i,j] : h -> i, m -> j\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n long u = A[i + j + 1] - '0';\n long x = h[i, j + 1] + u * digit[i] + m[i, j + 1];\n long y = h[i + 1, j] + m[i + 1, j] + u * digit[j];\n\n if (x < y)\n {\n h[i + 1, j + 1] = h[i + 1, j];\n m[i + 1, j + 1] = m[i + 1, j] + u * digit[j];\n s[i + 1, j + 1] = s[i + 1, j] + 'M';\n }\n else\n {\n h[i + 1, j + 1] = h[i, j + 1] + u * digit[i];\n m[i + 1, j + 1] = m[i, j + 1];\n s[i + 1, j + 1] = s[i, j + 1] + 'H';\n }\n //Console.WriteLine(\"{0}, {1}, {2}\", u, x, y);\n //Console.WriteLine(\"({2},{3}): {0}, {1}\", i + 1, j + 1, h[i + 1, j + 1], m[i + 1, j + 1]);\n }\n Console.WriteLine(s[n, n]);\n }\n\n public static void Main()\n {\n new E();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d2782460495e4c0f228d1d1d40ac294c", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round31\n{\n class E\n {\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static int n;\n static long max, h, m;\n static long[] homer, marge, dig;\n static StringBuilder hres, mres;\n\n static long sum()\n {\n h = 0; m = 0;\n for (int i = 0; i < n; i++) h = h * 10 + homer[i];\n for (int i = 0; i < n; i++) m = m * 10 + marge[i];\n return h + m;\n }\n\n static long chg(int i, int j)\n {\n var tmp = homer[j];\n homer[j] = marge[i];\n marge[i] = tmp;\n return sum();\n }\n\n static void solve(int i, int j)\n {\n long ret = sum();\n\n if (ret > max)\n {\n hres = new StringBuilder(h.ToString().PadLeft(n, '0'));\n mres = new StringBuilder(m.ToString().PadLeft(n, '0'));\n max = ret;\n }\n\n for (int k = j; k < n; k++)\n {\n long x = chg(i,k);\n if (ret <= x)\n {\n ret = x;\n solve(i + 1, k);\n }\n chg(i, k);\n }\n }\n\n public static void Main()\n {\n n = ReadInt();\n string A = Console.ReadLine();\n\n dig = new long[n];\n dig[n - 1] = 1;\n for (int i = n - 2; i >= 0; i--) dig[i] = dig[i + 1] * 10;\n\n homer = new long[n];\n marge = new long[n];\n\n for (int i = 0; i < n; i++)\n {\n homer[i] = A[i] - '0';\n marge[i] = A[i + n] - '0';\n }\n\n max = sum();\n hres = new StringBuilder(h.ToString().PadLeft(n, '0'));\n mres = new StringBuilder(m.ToString().PadLeft(n, '0'));\n solve(0, 1);\n\n string res = \"\";\n for (int i = 0, j = 0, idx = 0; idx < A.Length;idx++)\n {\n if (i < n && hres[i] == A[idx]) { i++; res += 'H'; }\n else if (mres[j] == A[idx]) { j++; res += 'M'; }\n else throw new Exception();\n }\n\n //Console.WriteLine(\"{0},{1}: {2}\", hres, mres, max);\n Console.WriteLine(\"{0}\", res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "74816254e4d62e172422fad6d6ba8d2d", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round31\n{\n class E\n {\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static int n;\n static long max, h, m;\n static long[] homer, marge, dig;\n static StringBuilder hres, mres;\n\n static long sum()\n {\n h = 0; m = 0;\n for (int i = 0; i < n; i++) h = h * 10 + homer[i];\n for (int i = 0; i < n; i++) m = m * 10 + marge[i];\n return h + m;\n }\n\n static long chg(int i, int j)\n {\n var tmp = homer[j];\n homer[j] = marge[i];\n marge[i] = tmp;\n return sum();\n }\n\n static void solve(int i, int j)\n {\n if (i >= n || j >= n) return;\n long ret = sum();\n\n if (ret >= max)\n {\n hres = new StringBuilder(h.ToString().PadLeft(n, '0'));\n mres = new StringBuilder(m.ToString().PadLeft(n, '0'));\n max = ret;\n }\n\n for (int k = j; k < n; k++)\n {\n long x = chg(i,k);\n if (ret <= x)\n {\n ret = x;\n solve(i + 1, k);\n }\n chg(i, k);\n }\n }\n\n public static void Main()\n {\n n = ReadInt();\n string A = Console.ReadLine();\n\n dig = new long[n];\n dig[n - 1] = 1;\n for (int i = n - 2; i >= 0; i--) dig[i] = dig[i + 1] * 10;\n\n homer = new long[n];\n marge = new long[n];\n\n for (int i = 0; i < n; i++)\n {\n homer[i] = A[i] - '0';\n marge[i] = A[i + n] - '0';\n }\n\n max = sum();\n hres = new StringBuilder(h.ToString().PadLeft(n, '0'));\n mres = new StringBuilder(m.ToString().PadLeft(n, '0'));\n solve(0, 1);\n\n string res = \"\";\n#if false\n for (int i = 0, j = 0, idx = 0; idx < A.Length;idx++)\n {\n if (i < n && hres[i] == A[idx]) { i++; res += 'H'; }\n else if (mres[j] == A[idx]) { j++; res += 'M'; }\n else throw new Exception();\n }\n#endif\n Queue q = new Queue();\n q.Enqueue(\"H\");\n while (q.Any())\n {\n string s = q.Dequeue();\n if (s.Length == A.Length) { res = s; break; }\n int hh = 0, mm = 0;\n for (int i = 0; i < s.Length; i++)\n if (s[i] == 'H') hh++;\n else mm++;\n if (hh < n && hres[hh] == A[s.Length]) q.Enqueue(s + 'H');\n if (mm < n && mres[mm] == A[s.Length]) q.Enqueue(s + 'M');\n }\n\n //Console.WriteLine(\"{0},{1}: {2}\", hres, mres, max);\n Console.WriteLine(\"{0}\", res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "128c414b4364ebb57aa7b2421c61a5c7", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round31\n{\n class E\n {\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n struct S\n {\n public string h, m, res;\n }\n\n public static void Main()\n {\n int n = ReadInt();\n string A = Console.ReadLine();\n string[] resstr = new string[n];\n long[] maxres = new long[n];\n HashSet memo = new HashSet();\n for (int i = 0; i < n; i++) maxres[i] = -1;\n S s;\n s.h = s.m = s.res = \"\";\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Any())\n {\n s = q.Dequeue();\n int minlen = Math.Min(s.h.Length, s.m.Length);\n if (minlen != 0)\n {\n if (memo.Contains(s.res)) continue;\n memo.Add(s.res);\n string hs = s.h.Substring(0, minlen);\n string ms = s.m.Substring(0, minlen);\n int x = int.Parse(hs) + int.Parse(ms);\n if (x < maxres[minlen - 1]) continue;\n maxres[minlen - 1] = x;\n resstr[minlen-1] = s.res;\n }\n\n int idx = s.h.Length + s.m.Length;\n if (s.h.Length != n)\n {\n S tmp = s;\n tmp.h += A[idx];\n tmp.res += 'H';\n q.Enqueue(tmp);\n }\n\n if (s.m.Length != n)\n {\n S tmp = s;\n tmp.m += A[idx];\n tmp.res += 'M';\n q.Enqueue(tmp);\n }\n }\n\n //Console.WriteLine(\"{0},{1}: {2}\", hres, mres, max);\n //Console.WriteLine(\"{0}\", maxres[n - 1]);\n Console.WriteLine(\"{0}\", resstr[n - 1]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a7e36131e6ebeffee4efc8dd4eda4c1b", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round31\n{\n class E\n {\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n struct S\n {\n public string h, m, res;\n }\n\n public static void Main()\n {\n int n = ReadInt();\n string A = Console.ReadLine();\n string[] resstr = new string[n];\n long[] maxres = new long[n];\n S s;\n s.h = s.m = s.res = \"\";\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Any())\n {\n s = q.Dequeue();\n int minlen = Math.Min(s.h.Length, s.m.Length);\n if (minlen != 0)\n {\n string hs = s.h.Substring(0, minlen);\n string ms = s.m.Substring(0, minlen);\n int x = int.Parse(hs) + int.Parse(ms);\n if (x < maxres[minlen - 1]) continue;\n maxres[minlen - 1] = x;\n resstr[minlen-1] = s.res;\n }\n\n int idx = s.h.Length + s.m.Length;\n if (s.h.Length != n)\n {\n S tmp = s;\n tmp.h += A[idx];\n tmp.res += 'H';\n q.Enqueue(tmp);\n }\n\n if (s.m.Length != n)\n {\n S tmp = s;\n tmp.m += A[idx];\n tmp.res += 'M';\n q.Enqueue(tmp);\n }\n }\n\n //Console.WriteLine(\"{0},{1}: {2}\", hres, mres, max);\n //Console.WriteLine(\"{0}\", maxres[n - 1]);\n Console.WriteLine(\"{0}\", resstr[n - 1]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2d011d9c18aef8da528796da2325cac0", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round31\n{\n class E\n {\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n struct S\n {\n public string h, m, res;\n }\n\n static string rev(string s)\n {\n StringBuilder res = new StringBuilder(s);\n for (int i = 0; i < res.Length; i++) res[i] = res[i] == 'H' ? 'M' : 'H';\n return res.ToString();\n }\n\n public static void Main()\n {\n int n = ReadInt();\n string A = Console.ReadLine();\n string[] resstr = new string[n];\n long[] maxres = new long[n];\n HashSet memo = new HashSet();\n for (int i = 0; i < n; i++) maxres[i] = -1;\n S s;\n s.h = s.m = s.res = \"\";\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Any())\n {\n s = q.Dequeue();\n int minlen = Math.Min(s.h.Length, s.m.Length);\n if (minlen != 0)\n {\n if (memo.Contains(s.res) || memo.Contains(rev(s.res)))\n continue;\n memo.Add(s.res);\n string hs = s.h.Substring(0, minlen);\n string ms = s.m.Substring(0, minlen);\n int x = int.Parse(hs) + int.Parse(ms);\n if (x < maxres[minlen - 1]) continue;\n maxres[minlen - 1] = x;\n resstr[minlen-1] = s.res;\n }\n\n int idx = s.h.Length + s.m.Length;\n if (s.h.Length != n)\n {\n S tmp = s;\n tmp.h += A[idx];\n tmp.res += 'H';\n q.Enqueue(tmp);\n }\n\n if (s.m.Length != n)\n {\n S tmp = s;\n tmp.m += A[idx];\n tmp.res += 'M';\n q.Enqueue(tmp);\n }\n }\n\n //Console.WriteLine(\"{0},{1}: {2}\", hres, mres, max);\n //Console.WriteLine(\"{0}\", maxres[n - 1]);\n Console.WriteLine(\"{0}\", resstr[n - 1]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a91e396d2fcae6cdaf94808bbe5d895b", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round31\n{\n class E\n {\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static int n;\n static long max, h, m;\n static long[] homer, marge, dig;\n static StringBuilder hres, mres;\n\n static long sum()\n {\n h = 0; m = 0;\n for (int i = 0; i < n; i++) h = h * 10 + homer[i];\n for (int i = 0; i < n; i++) m = m * 10 + marge[i];\n return h + m;\n }\n\n static long chg(int i, int j)\n {\n var tmp = homer[j];\n homer[j] = marge[i];\n marge[i] = tmp;\n return sum();\n }\n\n static void solve(int i, int j)\n {\n long ret = sum();\n\n if (ret > max)\n {\n hres = new StringBuilder(h.ToString().PadLeft(n, '0'));\n mres = new StringBuilder(m.ToString().PadLeft(n, '0'));\n max = ret;\n }\n\n for (int k = j; k < n; k++)\n {\n long x = chg(i,k);\n if (ret < x)\n {\n ret = x;\n solve(i + 1, k);\n }\n chg(i, k);\n }\n }\n\n public static void Main()\n {\n n = ReadInt();\n string A = Console.ReadLine();\n\n dig = new long[n];\n dig[n - 1] = 1;\n for (int i = n - 2; i >= 0; i--) dig[i] = dig[i + 1] * 10;\n\n homer = new long[n];\n marge = new long[n];\n\n for (int i = 0; i < n; i++)\n {\n homer[i] = A[i] - '0';\n marge[i] = A[i + n] - '0';\n }\n\n max = sum();\n hres = new StringBuilder(h.ToString().PadLeft(n, '0'));\n mres = new StringBuilder(m.ToString().PadLeft(n, '0'));\n solve(0, 1);\n\n string res = \"\";\n for (int i = 0, j = 0, idx = 0; idx < A.Length;idx++)\n {\n if (i < n && hres[i] == A[idx]) { i++; res += 'H'; }\n else { j++; res += 'M'; }\n }\n\n //Console.WriteLine(\"{0},{1}: {2}\", hres, mres, max);\n Console.WriteLine(\"{0}\", res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4f44e0b0b8909a9a5662cc08e570e155", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round31\n{\n class E\n {\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static int n;\n static long max, h, m;\n static long[] homer, marge, dig;\n static StringBuilder hres, mres;\n\n static long sum()\n {\n h = 0; m = 0;\n for (int i = 0; i < n; i++) h = h * 10 + homer[i];\n for (int i = 0; i < n; i++) m = m * 10 + marge[i];\n return h + m;\n }\n\n static long chg(int i, int j)\n {\n var tmp = homer[j];\n homer[j] = marge[i];\n marge[i] = tmp;\n return sum();\n }\n\n static void solve(int i, int j)\n {\n long ret = sum();\n\n if (ret > max)\n {\n hres = new StringBuilder(h.ToString().PadLeft(n, '0'));\n mres = new StringBuilder(m.ToString().PadLeft(n, '0'));\n max = ret;\n }\n\n for (int k = j; k < n; k++)\n {\n long x = chg(i,k);\n if (ret < x)\n {\n ret = x;\n solve(i + 1, k);\n }\n chg(i, k);\n }\n }\n\n public static void Main()\n {\n n = ReadInt();\n string A = Console.ReadLine();\n\n dig = new long[n];\n dig[n - 1] = 1;\n for (int i = n - 2; i >= 0; i--) dig[i] = dig[i + 1] * 10;\n\n homer = new long[n];\n marge = new long[n];\n\n for (int i = 0; i < n; i++)\n {\n homer[i] = A[i] - '0';\n marge[i] = A[i + n] - '0';\n }\n\n max = sum();\n hres = new StringBuilder(h.ToString().PadLeft(n, '0'));\n mres = new StringBuilder(m.ToString().PadLeft(n, '0'));\n solve(0, 1);\n\n string res = \"\";\n for (int i = 0, j = 0, idx = 0; idx < A.Length;idx++)\n {\n if (i < n && hres[i] == A[idx]) { i++; res += 'H'; }\n else if (mres[j] == A[idx]) { j++; res += 'M'; }\n else throw new Exception();\n }\n\n //Console.WriteLine(\"{0},{1}: {2}\", hres, mres, max);\n Console.WriteLine(\"{0}\", res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "43051de9f40c0bbbea1ce808966e1c1a", "src_uid": "98489fe54488dcfb45f8ae7b5c473d88", "difficulty": 2400.0} {"lang": "Mono C#", "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;\nusing MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;\nusing MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;\n\npublic static class P\n{\n public static void Main()\n {\n var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = nm[0];\n ModInt.SetMod(nm[1]);\n ModInt res = 0;\n for (int frameSize = 1; frameSize <= n; frameSize++)\n res += (n - frameSize + 1) * Factorial(frameSize) * Factorial(n - frameSize + 1);\n Console.WriteLine(res);\n }\n\n static List factorialMemo = new List() { 1 };\n static ModInt Factorial(int x)\n {\n for (int i = factorialMemo.Count; i <= x; i++) factorialMemo.Add(factorialMemo.Last() * i);\n return factorialMemo[x];\n }\n}\n\n\nstruct ModInt\n{\n static int MOD;\n static long POSITIVIZER;\n public static void SetMod(int m)\n {\n MOD = m;\n POSITIVIZER = ((long)MOD) << 31;\n }\n long Data;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ModInt(long data) { if ((Data = data % MOD) < 0) Data += MOD; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator long(ModInt modInt) => modInt.Data;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator ModInt(long val) => new ModInt(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt a, int b) => new ModInt() { Data = (a.Data + b + POSITIVIZER) % MOD };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt a, long b) => new ModInt(a.Data + b);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt a, ModInt b) { long res = a.Data + b.Data; return new ModInt() { Data = res >= MOD ? res - MOD : res }; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt a, int b) => new ModInt() { Data = (a.Data - b + POSITIVIZER) % MOD };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt a, long b) => new ModInt(a.Data - b);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt a, ModInt b) { long res = a.Data - b.Data; return new ModInt() { Data = res < 0 ? res + MOD : res }; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt a, int b) => new ModInt(a.Data * b);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt a, long b) => a * new ModInt(b);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt a, ModInt b) => new ModInt() { Data = a.Data * b.Data % MOD };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator /(ModInt a, ModInt b) => new ModInt() { Data = a.Data * GetInverse(b) % MOD };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string ToString() => Data.ToString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long GetInverse(long a)\n {\n long div, p = MOD, x1 = 1, y1 = 0, x2 = 0, y2 = 1;\n while (true)\n {\n if (p == 1) return x2 + MOD; div = a / p; x1 -= x2 * div; y1 -= y2 * div; a %= p;\n if (a == 1) return x1 + MOD; div = p / a; x2 -= x1 * div; y2 -= y1 * div; p %= a;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b9dd4de4c0d5cb0e007f664cacb3cfbf", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "Mono C#", "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;\nusing MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;\nusing MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;\n\npublic static class P\n{\n public static void Main()\n {\n var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = nm[0];\n ModInt.MOD = nm[1];\n ModInt res = 0;\n for (int frameSize = 1; frameSize <= n; frameSize++)\n res += (n - frameSize + 1) * Factorial(frameSize) * Factorial(n - frameSize + 1);\n Console.WriteLine(res);\n }\n\n static List factorialMemo = new List() { 1 };\n static ModInt Factorial(int x)\n {\n for (int i = factorialMemo.Count; i <= x; i++) factorialMemo.Add(factorialMemo.Last() * i);\n return factorialMemo[x];\n }\n}\n\n\nstruct ModInt\n{\n public static int MOD;\n long Data;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ModInt(long data) { if ((Data = data % MOD) < 0) Data += MOD; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator long(ModInt modInt) => modInt.Data;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator ModInt(long val) => new ModInt(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt a, int b) => new ModInt() { Data = (a.Data + b) % MOD };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt a, long b) => new ModInt(a.Data + b);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt a, ModInt b) { long res = a.Data + b.Data; return new ModInt() { Data = res >= MOD ? res - MOD : res }; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt a, int b) => new ModInt() { Data = (a.Data - b) % MOD };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt a, long b) => new ModInt(a.Data - b);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt a, ModInt b) { long res = a.Data - b.Data; return new ModInt() { Data = res < 0 ? res + MOD : res }; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt a, int b) => new ModInt(a.Data * b);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt a, long b) => a * new ModInt(b);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt a, ModInt b) => new ModInt() { Data = a.Data * b.Data % MOD };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator /(ModInt a, ModInt b) => new ModInt() { Data = a.Data * GetInverse(b) % MOD };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string ToString() => Data.ToString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long GetInverse(long a)\n {\n long div, p = MOD, x1 = 1, y1 = 0, x2 = 0, y2 = 1;\n while (true)\n {\n if (p == 1) return x2 + MOD; div = a / p; x1 -= x2 * div; y1 -= y2 * div; a %= p;\n if (a == 1) return x1 + MOD; div = p / a; x2 -= x1 * div; y2 -= y1 * div; p %= a;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5035c65af485dfcc59406469fa049d17", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "Mono C#", "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 ModInt.MOD = m;\n ModInt.Build(n);\n ModInt res = 0;\n for (var i = 0; i < n; i++)\n {\n res += ModInt.Fac(n - i) * (n - i) * ModInt.Fac(i+1);\n }\n WriteLine(res);\n }\n}\n\npublic struct ModInt\n{\n public static 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 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7c963da6da3072e80cc314e92fc12f1c", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "Mono C#", "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;\nusing MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;\nusing MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;\n\npublic static class P\n{\n static int MOD;\n\n public static void Main()\n {\n var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = nm[0];\n MOD = nm[1];\n long res = 0;\n for (int frameSize = 1; frameSize <= n; frameSize++)\n {\n res += (n - frameSize + 1) * Factorial(frameSize) % MOD * Factorial(n - frameSize + 1) % MOD;\n res %= MOD;\n }\n Console.WriteLine(res);\n }\n\n static List factorialMemo = new List() { 1 };\n static long Factorial(int x)\n {\n for (int i = factorialMemo.Count; i <= x; i++) factorialMemo.Add(factorialMemo.Last() * i % MOD);\n return factorialMemo[x];\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "44e1fb5ede08184619d90158dc3d1949", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "Mono C#", "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 CODEFORCES1\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 n = NN;\n var m = NN;\n LIB_Mod._mod = m;\n LIB_Mod ans = 0L;\n var fact = new LIB_Mod[n + 1];\n fact[0] = 1;\n for (var i = 0; i < n; i++)\n {\n fact[i + 1] = fact[i] * (i + 1);\n }\n for (var i = 1; i <= n; i++)\n {\n LIB_Mod tmp = (n - i + 1);\n tmp.Mul(n - i + 1);\n tmp.Mul(fact[i]);\n tmp.Mul(fact[n - i]);\n ans += tmp;\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 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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void B(long n)\n {\n if (n >= _fact.Count)\n for (int i = _fact.Count; i <= n; ++i)\n _fact.Add(_fact[i - 1] * i);\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 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 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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2e96b4ca38fd6e7274105b7f42b2eae5", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing CompLib.Collections.Generic;\n\npublic class Program\n{\n private long N;\n private long M;\n\n private long[] Fact;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextLong();\n\n Fact = new long[1000001];\n Fact[0] = 1;\n for (int i = 1; i <= 1000000; i++)\n {\n Fact[i] = Fact[i - 1] * i;\n Fact[i] %= M;\n }\n// mod M\n// N\u9577 \u6570\u5217\n// happiness p [l,r] [l,m]\u306emax-min = r-l \u3068\u306a\u308b\u500b\u6570\n\n long ans = 0;\n // r-l = 1\n ans += N * Fact[N];\n ans %= M;\n // r-l >= 2\n if (N >= 2)\n {\n for (int i = 2; i <= N; i++)\n {\n // \u9577\u3055i\u306e\u30da\u30a2\n // \u30da\u30a2\u306e\u500b\u6570\n // min = 1 ~ N-(i-1)\n // max = min + (i-1) .. i ~ N\n\n // \u4f7f\u3048\u308b\u6570\u5b57 i-2\u500b\n\n // \u30da\u30a2\u306e\u500b\u6570\n\n long tmp = 1;\n long pat = N - (i - 1);\n\n tmp *= pat;\n \n // \u30da\u30a2\u306e\u4f4d\u7f6e\n long pos = N - (i - 1);\n tmp *= pos;\n tmp %= M;\n\n // \u4e26\u3079\u304b\u305f\n tmp *= Fact[i];\n tmp %= M;\n\n // \u6b8b\u308a\n tmp *= Fact[N - i];\n tmp %= M;\n\n ans += tmp;\n ans %= M;\n }\n }\n\n Console.WriteLine(ans);\n }\n\n private long Pow(long a, long b)\n {\n long res = 1;\n while (b > 0)\n {\n if (b % 2 == 1)\n {\n res *= a;\n res %= M;\n }\n\n a *= a;\n a %= M;\n b /= 2;\n }\n\n return res;\n }\n\n\n public static void Main(string[] args)\n {\n new Program().Solve();\n }\n}\n\nnamespace CompLib.Collections.Generic\n{\n using System;\n\n public class SegmentTree\n {\n // \u5236\u7d04\u306b\u5408\u3063\u305f2\u306e\u51aa\n private const int N = 1 << 21;\n private T[] _array;\n\n private T _identity;\n private Func _operation;\n\n public SegmentTree(Func operation, T identity)\n {\n _identity = identity;\n _operation = operation;\n _array = new T[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, T n)\n {\n i += N;\n _array[i] = n;\n while (i > 1)\n {\n i /= 2;\n _array[i] = _operation(_array[i * 2], _array[i * 2 + 1]);\n }\n }\n\n private T 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 _operation(Query(left, right, k * 2, l, (l + r) / 2),\n Query(left, right, k * 2 + 1, (l + r) / 2, r));\n }\n\n /// \n /// A[left] op A[left+1] ... op A[right-1]\u3092\u6c42\u3081\u308b\n /// \n /// \n /// \n /// \n public T Query(int left, int right)\n {\n return Query(left, right, 1, 0, N);\n }\n\n public T this[int i]\n {\n set { Update(i, value); }\n get { return _array[i + N]; }\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0360fb887d52b2f9aa96aa2fa43d3803", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "Mono C#", "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 CODEFORCES1\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 n = NN;\n var m = NN;\n LIB_Mod._mod = m;\n LIB_Mod ans = 0L;\n for (var i = 1; i <= n; i++)\n {\n LIB_Mod tmp = (n - i + 1);\n tmp.Mul(n - i + 1);\n tmp.Mul(LIB_Mod.Perm(i, i));\n tmp.Mul(LIB_Mod.Perm(n - i, n - i));\n ans += tmp;\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 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 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 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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "29670cac0b8ef34afcb8d6753c30bca2", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "Mono C#", "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 CODEFORCES1\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 n = NN;\n var m = NN;\n LIB_Mod._mod = m;\n LIB_Mod ans = 0L;\n for (var i = 1; i <= n; i++)\n {\n LIB_Mod tmp = (n - i + 1);\n tmp.Mul(n - i + 1);\n tmp.Mul(LIB_Mod.Perm(i, i));\n tmp.Mul(LIB_Mod.Perm(n - i, n - i));\n ans += tmp;\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 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 }\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 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 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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ebec269583e78441ecb260d960aa8ebd", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "MS C#", "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\n\n \n\n\n static void Main(string[] args)\n {\n int n = ReadIntLine();\n\n int[] a = ReadIntArrayLine();\n\n\n\n int s = 0;\n\n\n\n for (int i = 0; i < n; i++)\n {\n s += a[i];\n }\n\n int t = 0;\n\n for (int i = 1; i <= 5; i++)\n {\n if ((i + s) % (n+1) != 1)\n {\n t++;\n }\n\n }\n\n PrintLn(t);\n\n }\n \n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1377cf0d1f33b42604126e08833ec8bd", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffnamespace codeforces\n{\n using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.Linq;\n using System.Text;\n using System.Numerics;\n\n public class Program\n {\n public static void Main()\n {\n Solve1();\n\n // Console.ReadLine();\n }\n\n private static void Solve1()\n {\n var n = int.Parse(Console.ReadLine());\n var fingers = new int[n + 1];\n\n var f = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n for (int i = 0; i < n; i++)\n {\n fingers[i] = f[i];\n }\n\n var result = 0;\n var sum = 0;\n\n for (int i = 1; i <= 5; i++)\n {\n fingers[fingers.Length - 1] = i;\n sum = fingers.Sum();\n var k = 0;\n do\n {\n for (int j = fingers.Length - 1; j >= 0; j--)\n {\n k = j;\n sum--;\n if (sum == 0)\n {\n break;\n }\n }\n }\n while (sum > 0);\n\n if (k != fingers.Length - 1)\n {\n result++;\n }\n }\n\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e817a7fbee9131143319aaaf29c68330", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace pr2\n{\n class Program\n {\n public static void Main(string[] args)\n {int n,s,o,p;\n n=Convert.ToInt16(Console.ReadLine());\n int[] a;\n a= new int[n];\n string [] line = Console.ReadLine().Split();\n s=0;\n for (int i=0; i0) {\n s++;\n o=s%(n+1);\n p++;\n } else {\n s++;\n o=s%(n+1);\n }\n }\n Console.WriteLine(Convert.ToString(p));\n //Console.ReadKey(true);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "19b1bbe2028a20a35e819598716a6ba3", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Test\n {\n static void Main()\n {\n string[] Nfing;\n byte Answer = 0;\n sbyte friends = sbyte.Parse(Console.ReadLine());\n Nfing = Console.ReadLine().Split(' ');\n int fingers =0;\n for (byte i = 0; i(T array)\n {\n foreach (var arr in (IEnumerable)array)\n Console.Write(arr+\" \");\n }\n\n private static void Main(string[] args)\n {\n int friends_count = int.Parse(Console.ReadLine());\n int[] friends_hand = (from str in Console.ReadLine().Split(' ', '\\t') select int.Parse(str)).ToArray();\n int summ_hand = 0;\n int result = 0;\n\n foreach (var hand in friends_hand) \n summ_hand += hand; \n\n for (int i = 1; i <= 5; i++)\n {\n if ((summ_hand + i - 1) % (friends_count + 1) != 0)\n result++;\n }\n Console.WriteLine(result); \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3ce018a333e9c32b169049959978158b", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "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 int countOfFriends = int.Parse(Console.ReadLine());\n int countOfFingers = 0;\n int i = 0;\n string[] answers = Console.ReadLine().Split();\n for (i = 0; i < countOfFriends; ++i)\n {\n countOfFingers += int.Parse(answers[i]);\n }\n int countOfSolvings = 0;\n for (int k = 1; k < 6; ++k)\n {\n if ((countOfFingers + k) % (countOfFriends + 1) != 1)\n {\n countOfSolvings++;\n }\n }\n Console.WriteLine(countOfSolvings);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0924af9c671af1d5e082a9a5783929d9", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\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 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 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 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 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 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 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;\n Reader.Read(out n);\n int[] a = new int[n];\n Reader.Read(a);\n int sum = a.Sum();\n\n int ans = 0;\n for (int i = 1; i <= 5; i++)\n {\n if ((sum + i - 1) % (n + 1) != 0)\n {\n ans++;\n }\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "797f51609172b25254f8f5c6ec0d2c1d", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "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 sum = 0;\n for ( int i = 0; i < n; i++ )\n sum += ReadInt();\n\n n++;\n int count = 0;\n for ( int i = 1; i <= 5; i++ )\n if ( (sum + i) % n != 1 )\n count++;\n\n Console.Write( count );\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "190a9d5b237e5088136d1aeadb196522", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Lib\n{\n public class DimaAndFriends\n {\n public static void Main()\n {\n Solve(Console.In, Console.Out);\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n var n = tr.ReadLine();\n var m = tr.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n\n tw.WriteLine(Calculate(m));\n }\n\n public static int Calculate(int[] fingers)\n {\n int res = 0;\n int n = fingers.Length;\n int friendFingers = fingers.Sum();\n for (int i = 1; i <= 5; i++)\n {\n if ((friendFingers + i) % (n + 1) != 1)\n res++;\n }\n return res;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d1a6db2d035515be1c03555902fcb1d", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Dima_and_Friends\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 sum = 0;\n\n for (int i = 0; i < n; i++)\n {\n sum += Next();\n }\n\n int count = 0;\n for (int i = 1; i < 6; i++)\n {\n if ((sum + i-1)%(n + 1) != 0)\n count++;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f06ad0db0adb59135315e6c2203ca3de", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine()) + 1;\n var f = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var ans = 0;\n for (int i = 0; i < 5; i++)\n {\n if ((f.Sum() + i) % n != 0)\n {\n ans++;\n }\n }\n Console.WriteLine(ans);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dd1c726c161e3215493504960f5e215e", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "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) +1;\n \n var inputs = Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\n int count = 0;\n int fingers = inputs.Sum();\n if ((fingers + 1) % n != 1)\n count++;\n if ((fingers + 2) % n != 1)\n count++;\n\n if ((fingers + 3) % n != 1)\n count++;\n\n if ((fingers + 4) % n != 1)\n count++;\n\n if ((fingers + 5) % n != 1)\n count++;\n\n\n Console.WriteLine(count);\n // Console.ReadKey();\n }\n\n // Console.ReadKey();\n\n\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0d1619a644830337787871ec6c33bcc1", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "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\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}\n\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}\n\t\n\t\n\t\tpublic static void print(object[] mas){\n\t\n\t\tfor (int i =0;i Convert.ToInt32(_)).Sum();\n\n var res = 0;\n if ((sum + 1)%(n + 1) != 1) {\n res++;\n }\n if ((sum + 2)%(n + 1) != 1) {\n res++;\n }\n if ((sum + 3)%(n + 1) != 1) {\n res++;\n }\n if ((sum + 4)%(n + 1) != 1) {\n res++;\n }\n if ((sum + 5)%(n + 1) != 1) {\n res++;\n }\n\n Console.WriteLine(res);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fac8e8a0c73d5ccf735eb79f1ea224e7", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Test\n {\n static void GiveMeAnswer(ref sbyte friends,ref int fingers)\n {\n friends++;\n\n // friends++;\n byte Answer = 0 ;\n byte num=0;\n for (byte i = 1; i <= 5; i++)\n {\n if (fingers % friends != 0)\n { Answer++; fingers++; }\n else { fingers = 1; /*friends--; */}\n }\n Console.WriteLine(Answer);\n\n }\n static void Main()\n {\n string[] Nfing;\n sbyte friends = sbyte.Parse(Console.ReadLine());\n if (friends >100 && friends <0)\n { friends = 5; } // \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0438\u0434\u0438\u043e\u0442\u0430. Absolute random value :3\n Nfing = Console.ReadLine().Split(' ');\n int fingers =0;\n for (byte i = 0; i5 || sbyte.Parse(Nfing[i])<1) \n // \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u0441\u0435 \u0434\u0440\u0443\u0437\u044c\u044f \u0431\u044b\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b,\u043b\u0438\u0431\u043e \u0441\u0440\u0435\u0434\u0438 \u0434\u0440\u0443\u0437\u0435\u0439 \u0437\u0430\u0442\u0435\u0441\u0430\u043b\u0438\u0441\u044c \u0438\u043d\u043e\u043f\u043b\u0430\u043d\u0435\u0442\u044f\u043d\u0435, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e 0 \u043f\u0430\u043b\u044c\u0446\u0435\u0432\n {}\n else { fingers = fingers + int.Parse(Nfing[i]); }\n \n }\n //Console.WriteLine(fingers);\n GiveMeAnswer(ref friends, ref fingers);\n \n // Console.ReadKey();\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "895017379c239d4b633b4ffaf260dc03", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "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 //int[] A = new int[n];\n string s = Console.ReadLine();\n string[] p = s.Split(new Char[] { ' ' });\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n sum += Convert.ToInt32(p[i]);\n }\n int count = 0;\n for (int i = 1; i <= 5; i++)\n {\n int pos = (sum + i) % (n + 1);\n if (pos != 1)\n {\n count++;\n }\n }\n Console.WriteLine(count);\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 /* B\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\n /* C\n string s = Console.ReadLine();\n string[] p = s.Split(new Char[] { ' ' });\n\n int n = Convert.ToInt32(p[0]);\n int m = Convert.ToInt32(p[1]);\n\n int x = Math.Min(n, m) + 1;\n Console.WriteLine(x);\n\n for (int i = 0; i < x; i++)\n {\n Console.WriteLine(i + \" \" + (x - i - 1));\n }\n */\n\n\n\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "72964d4ea7bee8c78df6a0db0d670d15", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "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 \u0410\n {\n private static ThreadStart s_threadStart = new \u0410().Go;\n private static bool s_time = false;\n\n private void Go()\n {\n int n = GetInt();\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n sum += GetInt();\n }\n sum %= (1 + n);\n\n int ret = 5;\n for (int i = 1; i <= 5; i++)\n {\n if ((sum + i) % (n + 1) == 1) ret--;\n }\n Wl(ret);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8a4eff08053a310b03222bb4b71f4174", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "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 = int.Parse(Console.ReadLine());\n\n string[] str = Console.ReadLine().Split(' ');\n int[] array = new int[n];\n for (int i = 0; i < n; i++ )\n {\n array[i] = int.Parse(str[i]);\n }\n int arValue = array.Sum(x => x);\n\n int summ = 0;\n for (int i = 1; i <= 5; i++ )\n {\n int total = i + arValue - 1;\n //Console.WriteLine(i+\" \"+total+\" \"+total % (n + 1));\n if (total % (n + 1) == 0)\n {\n //summ++;\n }\n else \n {\n summ++;\n }\n }\n\n Console.WriteLine(summ);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c627604a6d71e96b0b094ce4b3ceda23", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "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[] f = new int[n];\n int k = 0;\n int s = 0;\n string[] tmp = Console.ReadLine ().Split (' ');\n for (int i = 0; i != n; i++) {\n f [i] = int.Parse (tmp[i]);\n s += f [i];\n }\n n++;\n for (int i = 1; i != 6; i++) {\n if((s + i) % n != 1){\n k++;\n }\n }\n Console.Write (k);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e7f7d398869697b11a265139d6ee5a6a", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "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 init = int.Parse(Console.ReadLine());\n\n var p = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var ans = 0;\n\n for (int i = 1; i <= 5; i++)\n {\n if ( (i + p.Sum() - 1)%(init + 1) == 0)\n {\n ans++;\n }\n }\n\n Console.WriteLine(5 - ans);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "efdd6b281568398e03c1553f4cdd302d", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace SubSequences\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int friends = Convert.ToInt32(System.Console.ReadLine());\n var fingers = System.Console.ReadLine().Split(' ');//.Select(int.Parse).Sum(a=>a);\n\n int fingersShown = 0;\n\n foreach (var finger in fingers)\n {\n fingersShown += int.Parse(finger);\n }\n\n\n int variants = 0;\n\n\n foreach (var i in new int[]{1,2,3,4,5})\n {\n if ((fingersShown + i) % (friends + 1) != 1)\n {\n variants++;\n }\n }\n\n System.Console.WriteLine(variants);\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "622a70c84ba03385bbeb8ca0a2e22fea", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R167_Div2_A\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split();\n int[] a = new int[n];\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(s[i]);\n sum += a[i];\n }\n\n int cnt = 0;\n for (int i = 1; i <= 5; i++)\n if ((sum + i) % (n + 1) != 1)\n cnt++; \n\n Console.WriteLine(cnt);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "731be32f4693d5e6f0c11f5d5b3a90bf", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforce\n{\n\n class Program\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\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var data = parseInt(Console.ReadLine());\n\n int total = data.Sum();\n\n n++;\n\n int cnt = 0;\n for (int i = 1; i <= 5; i++)\n {\n if ((total + i) % n != 1)\n ++cnt;\n }\n\n Console.WriteLine(cnt);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "70ccd06df7920d00f3d5d9893a496c0a", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static int[] arrc;\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine())+1;\n\n var s = Console.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)\n .Select(int.Parse)\n .Sum();\n\n var res = 0;\n\n var f = 1;\n while (f<=5)\n {\n if ((s + f++)%n!= 1) res++;\n }\n\n Console.WriteLine(res);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4d28fd95d4a6253c100f700b30ff422a", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Security.Cryptography;\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 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 canAuto(string s, string s1)\n\t\t{\n\t\t\tvar l = 0;\n\t\t\tfor (var i = 0; i < s1.Length; ++i)\n\t\t\t{\n\t\t\t\twhile (l < s.Length && s[l] != s1[i])\n\t\t\t\t\tl++;\n\t\t\t\tif (l == s.Length)\n\t\t\t\t\treturn false;\n\t\t\t\tl++;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic static bool canArray(string s, string s1)\n\t\t{\n\t\t\tvar l = s.ToCharArray().ToList();\n\t\t\tvar l1 = s1.ToCharArray().ToList();\n\t\t\tl.Sort();\n\t\t\tl1.Sort();\n\t\t\tif (l.Count != l1.Count)\n\t\t\t\treturn false;\n\n\t\t\tfor (var i = 0; i < l.Count; ++i)\n\t\t\t\tif (l[i] != l1[i])\n\t\t\t\t\treturn false;\n\t\t\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic static bool canBoth(string s, string s1)\n\t\t{\n\t\t\tvar l = s.ToCharArray().ToList();\n\t\t\tvar l1 = s1.ToCharArray().ToList();\n\t\t\tl.Sort();\n\t\t\tl1.Sort();\n\t\t\tvar ll = 0;\n\t\t\tfor (var i = 0; i < l1.Count; ++i)\n\t\t\t{\n\t\t\t\twhile (ll < l.Count && l[ll] != l1[i])\n\t\t\t\t\tll++;\n\t\t\t\tif (ll == l.Count)\n\t\t\t\t\treturn false;\n\t\t\t\tll++;\n\t\t\t}\n\n\t\t\treturn true;\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 l = getList();\n\t\t\tvar s = l.Sum();\n\t\t\tvar ans = 0;\n\t\t\tfor (var i = 1; i <= 5; ++i)\n\t\t\t\tif ((s + i) % (n + 1) != 1)\n\t\t\t\t\tans++;\n\t\t\tConsole.WriteLine(ans);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "20c47bdc2b7aa553ff97699acdaa1b10", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace olympic\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int ans = 0,sum = 0;\n string[] temp = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; ++i)\n {\n sum += Convert.ToInt32(temp[i]);\n }\n for (int i = 1; i <= 5; ++i)\n {\n if ((sum + i) % (n+1) != 1) ++ans;\n }\n Console.Write(ans);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9047c923484a2b35936a2c2973d8df82", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "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 int n = int.Parse(Console.ReadLine());\n int sum = 0;\n string [] s =Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n sum = sum + int.Parse(s[i]);\n\n int ans = 0;\n for (int i = 1; i <= 5; i++)\n {\n if ((sum + i) % (n + 1) != 1)\n ans++;\n }\n Console.WriteLine(ans);\n // Console.ReadKey();\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "334105656e487d71f8f195294bb0a5e4", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Test\n {\n static void GiveMeAnswer(ref sbyte friends,ref int fingers)\n {\n friends++;\n byte Answer = 0 ;\n for (byte i = 1; i <= 5; i++)\n {\n if (fingers % friends != 0)\n { Answer++; fingers++; }\n else { fingers = 1;}\n }\n Console.WriteLine(Answer);\n }\n static void Main()\n {\n string[] Nfing;\n sbyte friends = sbyte.Parse(Console.ReadLine());\n if (friends >100 && friends <0)\n { friends = 5; } // \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0438\u0434\u0438\u043e\u0442\u0430. Absolute random value :3\n Nfing = Console.ReadLine().Split(' ');\n int fingers =0;\n for (byte i = 0; i5 || sbyte.Parse(Nfing[i])<1) \n // \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u0441\u0435 \u0434\u0440\u0443\u0437\u044c\u044f \u0431\u044b\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b,\u043b\u0438\u0431\u043e \u0441\u0440\u0435\u0434\u0438 \u0434\u0440\u0443\u0437\u0435\u0439 \u0437\u0430\u0442\u0435\u0441\u0430\u043b\u0438\u0441\u044c \u0438\u043d\u043e\u043f\u043b\u0430\u043d\u0435\u0442\u044f\u043d\u0435, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e 0 \u043f\u0430\u043b\u044c\u0446\u0435\u0432\n {}\n else { fingers = fingers + int.Parse(Nfing[i]); }\n \n }\n GiveMeAnswer(ref friends, ref fingers); \n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e0d296026890e6fba3638dbbce8be6d7", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n\nnamespace COJ\n{\n class MainClass\n {\n /// \n /// Author: Luismo\n /// Idea:\n /// \n /// \n public static void Main(string[] args)\n {\n //TextReader tr = Console.In;\n //TextWriter tw = Console.Out;\n //Console.SetIn(new StreamReader(@\"d:\\lmo.in\"));\n //Console.SetOut(new StreamWriter(@\"d:\\lmo.out\"));\n //string [] data = Console.ReadLine().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries);\n\n\n int n = int.Parse(Console.ReadLine());\n string[] data = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int fingers = 0;\n for (int i = 0; i < data.Length; i++)\n {\n fingers += int.Parse(data[i]);\n }\n\n n++;\n int cnt = 0;\n //int k = n % fingers;\n for (int i = 1; i < 6; i++)\n {\n if ((fingers + i) % n != 1)\n cnt++;\n }\n \n Console.WriteLine(cnt);\n //PrintMt(distance);\n\n \n\n //Console.Out.Close();\n //Console.SetIn (tr);\n //Console.SetOut(tw);\n Console.ReadLine();\n }\n\n\n private static string PrintArray(int[] arr)\n {\n string s = \"\";\n for (int i = 0; i < arr.Length; i++)\n {\n s += arr[i] + \" \";\n //Console.Write(distribution[i] + \" \");\n }\n //Console.WriteLine();\n return s.Trim();\n }\n\n public static double EuclideanDistance(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));\n }\n\n static double ABS(double a)\n {\n if (a < 0)\n a *= -1;\n return a;\n }\n\n static int ABS(int a)\n {\n if (a < 0)\n a *= -1;\n return a;\n }\n\n static int Min(int a, int b)\n {\n if (a < b)\n return a;\n return b;\n }\n\n static int Max(int a, int b)\n {\n if (a < b)\n return b;\n return a;\n }\n\n static bool IsPrime(long n)\n {\n if (n == 2 || n == 3 || n <= 0)\n return true;\n if (n % 2 == 0 || n == 1 || n % 3 == 0)\n return false;\n\n for (int i = 5; i * i <= n; i += 2)\n {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n\n static bool RepeatedNumbers(int year)\n {\n bool[] arr = new bool[10];\n while (year > 0)\n {\n if (arr[year % 10])\n return true;\n\n arr[year % 10] = true;\n year /= 10;\n }\n return false;\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 class Pair\n {\n public int x, y;\n public Pair(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n\n public override string ToString()\n {\n return string.Format(\"[{0} , {1}]\", x, y);\n }\n\n }\n\n class Point\n {\n public double x, y;\n public Point(double x, double y)\n {\n this.x = x;\n this.y = y;\n }\n\n public override string ToString()\n {\n return string.Format(\"{0} {1}\", x, y);\n }\n\n public double EuclidDistance(Point p1)\n {\n double dist = Math.Sqrt((this.x - p1.x) * (this.x - p1.x) + (this.y - p1.y) * (this.y - p1.y));\n return dist;\n }\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e830437a155b3ef92fa0f079ebe16660", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "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[] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int rez = 0;\n int count = a.Sum() % (n + 1);\n for (int i = 1; i <= 5; i++)\n {\n if ((count + i) % (n + 1) != 1)\n rez++;\n }\n Console.WriteLine(rez);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fcaa63923c1a775a31df8977cc538754", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "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 sum = a.Sum();\n int ans = 0;\n for (int i = 1; i <= 5; i++) {\n if ((sum + i) % (n + 1) != 1) {\n ans++;\n }\n }\n Console.Write(ans);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "859570c432a3af46613759d8a7d3eae4", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _272A_DimaAndFriends.Run();\n\n }\n }\n class _272A_DimaAndFriends\n {\n public static void Run()\n {\n var n = byte.Parse(Console.ReadLine().Trim());\n var n2 = n + 1;\n var l = Console.ReadLine().Trim().Split(' ');\n short sum = 0;\n for (byte i = 0; i < n; i++)\n sum += byte.Parse(l[i]);\n\n byte ctr = 0;\n for (var i = sum; i < sum + 5; i++)\n {\n if (i % n2 != 0) ++ctr;\n }\n\n Console.WriteLine(ctr);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eb9f2a1c412559bfcc71005176f4ddcc", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\nusing System;\n\nnamespace pr2\n{\n class Program\n {\n public static void Main(string[] args)\n {int n,s,o,p;\n n=Convert.ToInt16(Console.ReadLine());\n int[] a;\n a= new int[n];\n string [] line = Console.ReadLine().Split();\n s=0;\n for (int i=0; i0) {\n s++;\n o=s%(n+1);\n p++;\n } else {\n s++;\n o=s%(n+1);\n }\n }\n Console.WriteLine(Convert.ToString(p));\n //Console.ReadKey(true);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "35f5048aa4b1845c387fa50a9e2dcc8e", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "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 f = new int[n];\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tf[i] = cin.NextInt();\n\t\t\t}\n\t\t\tvar sum = f.Sum();\n\t\t\tvar count = 0;\n\t\t\tfor (var i = 1; i <= 5; i++)\n\t\t\t{\n\t\t\t\tif ((sum + i) % (n + 1) != 1)\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "53368c12b19d9a64efb5308c0af18a35", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "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_167A();\n }\n public static void solve_167A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n string[] tests = Console.ReadLine().Split(' ');\n int[] fingers = Array.ConvertAll(tests, int.Parse);\n \n int sum = 0;\n for (int i = 0; i < fingers.Length; i++)\n {\n sum += fingers[i];\n }\n\n int count = 0;\n\n for (int i = 1; i <= 5; i++)\n {\n if ((sum + i) % (n + 1) != 1)\n {\n count++;\n }\n }\n Console.WriteLine(count);\n }\n public static void solve_50A()\n {\n string[] nk = Console.ReadLine().Split(' ');\n\n long n = Convert.ToInt64(nk[0]);\n long k = Convert.ToInt64(nk[1]);\n\n long x = 0;\n\n x = (k + n - 1) / n;\n /*if (k <= n)\n {\n x = 1;\n }\n else if (k % n != 0)\n {\n x = k / n + 1;\n }\n else\n {\n x = k / n;\n }\n */\n Console.WriteLine(x);\n }\n public static void solve_72A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n // How to proof it?\n Console.WriteLine(2 * n - (n / 2));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "92e41a935905b18a38f52119c9aee42b", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n\nnamespace COJ\n{\n class MainClass\n {\n /// \n /// Author: Luismo\n /// Idea:\n /// \n /// \n public static void Main(string[] args)\n {\n //TextReader tr = Console.In;\n //TextWriter tw = Console.Out;\n //Console.SetIn(new StreamReader(@\"d:\\lmo.in\"));\n //Console.SetOut(new StreamWriter(@\"d:\\lmo.out\"));\n //string [] data = Console.ReadLine().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries);\n\n\n int n = int.Parse(Console.ReadLine());\n string[] data = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int fingers = 0;\n for (int i = 0; i < data.Length; i++)\n {\n fingers += int.Parse(data[i]);\n }\n\n n++;\n int cnt = 0;\n //int k = n % fingers;\n for (int i = 1; i < 6; i++)\n {\n if ((fingers + i) % n != 1)\n cnt++;\n }\n \n Console.WriteLine(cnt);\n //PrintMt(distance);\n\n \n\n //Console.Out.Close();\n //Console.SetIn (tr);\n //Console.SetOut(tw);\n Console.ReadLine();\n }\n\n private static void NumberOfPosibleTriangles(int n)\n {\n \n }\n\n private static void Knapsack(int[,] mt)\n {\n // KnapSackProblem\n int n = 0, w = 0;\n\n int[] weights = new int[w];\n int[] values = new int[n];\n\n //int[,] mt = new int[n, w];\n for (int i = 0; i < w; i++)\n mt[0, i] = 0;\n for (int i = 0; i < n; i++)\n mt[i, 0] = 0;\n }\n\n private static string PrintArray(int[] arr)\n {\n string s = \"\";\n for (int i = 0; i < arr.Length; i++)\n {\n s += arr[i] + \" \";\n //Console.Write(distribution[i] + \" \");\n }\n //Console.WriteLine();\n return s.Trim();\n }\n\n public static double EuclideanDistance(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));\n }\n\n static double ABS(double a)\n {\n if (a < 0)\n a *= -1;\n return a;\n }\n\n static int ABS(int a)\n {\n if (a < 0)\n a *= -1;\n return a;\n }\n\n static int Min(int a, int b)\n {\n if (a < b)\n return a;\n return b;\n }\n\n static int Max(int a, int b)\n {\n if (a < b)\n return b;\n return a;\n }\n\n static bool IsPrime(long n)\n {\n if (n == 2 || n == 3 || n <= 0)\n return true;\n if (n % 2 == 0 || n == 1 || n % 3 == 0)\n return false;\n\n for (int i = 5; i * i <= n; i += 2)\n {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n\n static bool RepeatedNumbers(int year)\n {\n bool[] arr = new bool[10];\n while (year > 0)\n {\n if (arr[year % 10])\n return true;\n\n arr[year % 10] = true;\n year /= 10;\n }\n return false;\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 class Pair\n {\n public int x, y;\n public Pair(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n\n public override string ToString()\n {\n return string.Format(\"[{0} , {1}]\", x, y);\n }\n\n }\n\n class Point\n {\n public double x, y;\n public Point(double x, double y)\n {\n this.x = x;\n this.y = y;\n }\n\n public override string ToString()\n {\n return string.Format(\"{0} {1}\", x, y);\n }\n\n public double EuclidDistance(Point p1)\n {\n double dist = Math.Sqrt((this.x - p1.x) * (this.x - p1.x) + (this.y - p1.y) * (this.y - p1.y));\n return dist;\n }\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "377667c4d6a163df9b5a416ed0dc04db", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace MyFirstProject\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n Int32 n = Convert.ToInt32(Console.ReadLine());\n Int32 friend = 0;\n \n \n string[] splitString = Console.ReadLine().Split(' ');\n int x;\n \n for (int i = 0; i < n; i++)\n {\n int.TryParse(splitString[i], out x);\n friend += x;\n //friend += Convert.ToInt32(Console.ReadLine());\n }\n n++;\n Int32 res = 0;\n for (int i = 1; i < 6; i++)\n {\n if (((friend+i-1) % (n)) != 0)\n {\n //Console.WriteLine((friend + i)+\" % \"+n+\" = \"+((friend+i) % (n)));\n res++;\n }\n }\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "64d07865791b58d1a8674a1bd42daf7f", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass Program {\n static void Main() {\n var n = int.Parse(Console.ReadLine());\n var x = Console.ReadLine().Split(' ').Select(int.Parse).Sum();\n var res = Enumerable.Range(1, 5).Count(i => (i + x) % (n+1) != 1);\n Console.WriteLine(res);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c23227e04de33bb6c0db35b03c5096bb", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _272A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int sum = Console.ReadLine().Split().Select(token => int.Parse(token)).Sum();\n\n int ways = 0;\n for (int fingers = 1; fingers <= 5; fingers++)\n {\n if ((sum + fingers) % (n + 1) != 1)\n {\n ways++;\n }\n }\n\n Console.WriteLine(ways);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "720ea2400eb167f485398859c3f45dec", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Collections.Generic;\n\npublic class A167\n{\n public static void Main()\n {\n new A167().Entry();\n }//Main\n\n void Entry()\n {\n int n = intRead() + 1;\n int[] arary = intSplit(' ');\n int cnt = 0;\n foreach (int item in arary)\n {\n cnt += item;\n }//foreach item\n cnt %= n;\n int res = 0;\n for (int i = 1; i <= 5; i++)\n {\n if ((cnt + i) % n != 1)\n res++;\n }//for i\n Console.WriteLine(res);\n }\n\n string strRead()\n {\n return Console.ReadLine();\n }\n\n int intRead()\n {\n return int.Parse(Console.ReadLine());\n }\n\n long longRead()\n {\n return long.Parse(Console.ReadLine());\n }\n\n double doubleRead()\n {\n return double.Parse(Console.ReadLine());\n }\n\n string[] strSplit(char a)\n {\n return Console.ReadLine().Split(a);\n }\n\n int[] intSplit(char a)\n {\n return Array.ConvertAll(Console.ReadLine().Split(a), int.Parse);\n }\n\n long[] longSplit(char a)\n {\n return Array.ConvertAll(Console.ReadLine().Split(a), long.Parse);\n }\n\n double[] doubleSplit(char a)\n {\n return Array.ConvertAll(Console.ReadLine().ToString().Split('a'), double.Parse);\n }\n\n\n}//Template", "lang_cluster": "C#", "compilation_error": false, "code_uid": "320914cf1e72d8a87a8cbe26f3f1e587", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int friendsNumber = int.Parse(Console.ReadLine()) + 1;\n int peoples = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x)).Sum();\n\n int ways = 0;\n for (int i = 1; i <= 5; i++)\n {\n if ((peoples + i) % friendsNumber == 1)\n {\n continue;\n }\n ways++;\n }\n\n Console.WriteLine(ways);\n Console.Read();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "86d0faee02eaaa2424d0ec36d1005a12", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "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\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 static bool foo(string s1, string s2)\n {\n for (int i = 0; i < s1.Length; i++)\n {\n for (int e = 0; e < s2.Length; e++)\n {\n if (s1[i] == s2[e])\n {\n return true;\n }\n }\n }\n return false;\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 int x = 0;\n for (int i = 0; i < n; i++)\n {\n x += int.Parse(s[i]);\n }\n int ans = 0;\n for (int i = 1; i <= 5; i++)\n {\n if ((i + x) % (n + 1) != 1)\n {\n ans++;\n }\n }\n Console.WriteLine(ans);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f5f9903854e6b9350a60593eb0ebc7de", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace olimp\n{\n class Program\n {\n private static void ShowArray(T array)\n {\n foreach (var arr in (IEnumerable)array)\n Console.Write(arr+\" \");\n }\n\n private static void Main(string[] args)\n {\n int friends_count = int.Parse(Console.ReadLine());\n int[] friends_hand = (from str in Console.ReadLine().Split(' ', '\\t') select int.Parse(str)).ToArray();\n int summ_hand = 0;\n int result = 0;\n\n foreach (var hand in friends_hand) \n summ_hand += hand; \n\n for (int i = 1; i <= 5; i++)\n {\n if ((summ_hand + i - 1) % (friends_count + 1) != 0)\n result++;\n }\n Console.WriteLine(result);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "365d1f6ec58640f4a5f7e76ba2b6c804", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass Program {\n static void Main() {\n var n = int.Parse(Console.ReadLine());\n var x = Console.ReadLine().Split(' ').Select(int.Parse).Sum();\n var res = Enumerable.Range(1, 5).Count(i => (i + x) % n != 1);\n Console.WriteLine(res);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "32ecba371ea6420f679ba4123876408d", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "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 int n = int.Parse(Console.ReadLine());\n int sum = 0;\n string [] s =Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n sum = sum + int.Parse(s[i]);\n if ((n + 1) % 2 == 0)\n {\n if (sum % 2 == 0)\n Console.WriteLine(2);\n else\n Console.WriteLine(3);\n }\n else\n {\n if (sum % 2 == 0)\n Console.WriteLine(3);\n else\n Console.WriteLine(2);\n }\n //Console.ReadKey();\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b793e8b52cb3ba0b3a11a729093805e8", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace MyFirstProject\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n Int32 n = Convert.ToInt32(Console.ReadLine());\n Int32 friend = 0;\n for (int i = 0; i < n; i++)\n {\n friend += Convert.ToInt32(Console.ReadLine());\n }\n n++;\n Int32 res = 0;\n for (int i = 1; i < 6; i++)\n {\n if (((friend+i-1) % (n)) != 0)\n {\n Console.WriteLine((friend + i)+\" % \"+n+\" = \"+((friend+i) % (n)));\n res++;\n }\n }\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7e1d6b33d603f34476937287414e0989", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace olympic\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int ans = 0,sum = 0;\n string[] temp = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; ++i)\n {\n sum += Convert.ToInt32(temp[i]);\n }\n for (int i = 1; i <= 5; ++i)\n {\n if ((sum + i) % n != 1) ++ans;\n }\n Console.Write(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f61ad99dd736a53ff2375dfcd681d975", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Test\n {\n static void GiveMeAnswer(ref sbyte friends,ref int fingers)\n {\n friends++;\n friends++;\n byte Answer = 0 ;\n byte num=0;\n for (byte i = 1; i <= 5; i++)\n {\n if ((fingers++) % friends != 0)\n { Answer++; }\n else { fingers = 1; friends--; }\n }\n Console.WriteLine(Answer);\n\n }\n static void Main()\n {\n string[] Nfing;\n sbyte friends = sbyte.Parse(Console.ReadLine());\n if (friends >100 && friends <0)\n { friends = 5; } // \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0438\u0434\u0438\u043e\u0442\u0430. Absolute random value :3\n Nfing = Console.ReadLine().Split(' ');\n int fingers =0;\n for (byte i = 0; i5 || sbyte.Parse(Nfing[i])<1) \n // \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u0441\u0435 \u0434\u0440\u0443\u0437\u044c\u044f \u0431\u044b\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b,\u043b\u0438\u0431\u043e \u0441\u0440\u0435\u0434\u0438 \u0434\u0440\u0443\u0437\u0435\u0439 \u0437\u0430\u0442\u0435\u0441\u0430\u043b\u0438\u0441\u044c \u0438\u043d\u043e\u043f\u043b\u0430\u043d\u0435\u0442\u044f\u043d\u0435, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e 0 \u043f\u0430\u043b\u044c\u0446\u0435\u0432\n {}\n else { fingers = fingers + int.Parse(Nfing[i]); }\n \n }\n //Console.WriteLine(fingers);\n GiveMeAnswer(ref friends, ref fingers);\n \n //Console.ReadKey();\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eb0cfa4d9502596ad9faf583d53531c5", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace olympic\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int ans = 0,sum = 0;\n for (int i = 0; i < n; ++i)\n {\n sum += Int32.Parse(Console.Read().ToString());\n Console.Read();\n }\n for (int i = 1; i <= 5; ++i)\n {\n if (((sum + i) % (n+1)) != 1) ++ans;\n }\n Console.Write(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b88eb57c1e09d58288e3d995fa8305c", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass Program {\n static void Main() {\n var n = int.Parse(Console.ReadLine());\n var x = Console.ReadLine().Split(' ').Select(int.Parse).Sum();\n var res = Enumerable.Range(1, 5).Count(i => (i + x) % n != 1);\n Console.WriteLike(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8063673e232c49e65a03db122b98f3d5", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem2\n{\n class B818\n {\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split();\n int n = int.Parse(arr[0]);\n int m = int.Parse(arr[1]);\n string[] arr1 = Console.ReadLine().Split();\n int[] l = new int[m];\n for (int i = 0; i < m; i++)\n {\n l[i] = int.Parse(arr1[i]);\n }\n\n int[] a = new int[n];\n int[] b = new int[n];\n for (int i = 0; i < m-1; i++)\n {\n if (l[i + 1] - l[i] > 0)\n {\n a[l[i] - 1] = l[i + 1] - l[i];\n \n }\n else {\n a[l[i] - 1] = n-l[i] + l[i+1];\n }\n b[l[i] - 1]++;\n }\n\n for (int i = 0; i < n; i++)\n {\n if (b[i] > 1 && b[i]!=m-1|| b[i]==0) {\n Console.WriteLine(-1);\n return;\n }\n }\n for (int i = 0; i < n; i++)\n {\n Console.Write(a[i]+\" \");\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "339b738b7966d7b523df9f8f657210a4", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "Mono C#", "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, M;\n sc.Make(out N, out M);\n var L = sc.ArrInt;\n var res = new int[N];\n for(int i = 0; i < M - 1; i++)\n {\n var v = (L[i + 1] - L[i] + N) % N;\n if (v == 0) v = N;\n if (res[L[i] - 1] == 0)\n {\n res[L[i] - 1] = v;\n }\n if (res[L[i] - 1] != v) Fail(-1);\n }\n if (res.Any(v => v == 0)) Fail(-1);\n var use = new bool[N + 1];\n for (int i = 0; i < N; i++)\n {\n if (use[res[i]]) Fail(-1);\n use[res[i]] = true;\n }\n Console.WriteLine(string.Join(\" \", 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0361cf0f5570c4d03a3827ebbf09c969", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "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 words = Console.ReadLine().Split(' ');\n long n, m;\n n = Convert.ToInt64(words[0]);\n m = Convert.ToInt64(words[1]);\n words = Console.ReadLine().Split(' ');\n long[] numbers = new long[n+1];\n long[] steps = new long[m + 1];\n for (int i = 1; i <= m; ++i)\n {\n steps[i] = Convert.ToInt64(words[i - 1]);\n }\n for (int i = 1; i < m; ++i)\n {\n long diff = 0;\n if (steps[i+1] <= steps[i])\n {\n diff += n - steps[i] + steps[i + 1];\n } else\n {\n diff = steps[i+1] - steps[i];\n }\n if (numbers[steps[i]] != 0 && numbers[steps[i]] != diff)\n {\n Console.WriteLine(-1);\n return;\n }\n numbers[steps[i]] = diff;\n }\n for (int i = 1; i < n + 1; ++i)\n {\n if (numbers[i] == 0)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n for (int i = 1; i 0)b = m[i] - a;\n else b = n - a + m[i];\n if (d[a-1] != 0)\n {\n if (b != d[a-1]) { Console.WriteLine(-1); return; }\n }\n \n f[b]++;\n d[a - 1] = b;\n a = m[i];\n i++;\n }i = 0;int j = 1;\n\n while (i < n)\n {\n if (d[i] == 0)\n {\n \n while (j <= n)\n {\n if (f[j] == 0)\n {\n d[i] = j;\n j++;\n break;\n }\n j++;\n }\n }\n i++;\n }i = 0;\n\n while (i < n)\n {\n Console.Write(d[i]+\" \");\n i++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b1e38b2886537e3b7235f26e6154bbe5", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodefCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int[] m = new int[105];\n int[] d = new int[105];\n int[] f = new int[105];\n\n int n = int.Parse(tokens[0]);\n int k= int.Parse(tokens[1]);\n\n int i=0;\n tokens = Console.ReadLine().Split();\n\n while (i < k)\n {\n m[i] = int.Parse(tokens[i]);\n i++;\n }i = 1;\n\n int a= m[0];\n int b;\n\n while (i < k)\n {\n \n if (m[i] - a > 0)b = m[i] - a;\n else b = n - a + m[i];\n if (d[a-1] != 0)\n {\n if (b != d[a]) { Console.WriteLine(-1); return; }\n else break;\n }\n\n if (f[b] == 1) { Console.WriteLine(-1);return;} \n f[b]++;\n d[a - 1] = b;\n a = m[i];\n i++;\n }i = 0;int j = 1;\n\n while (i < n)\n {\n if (d[i] == 0)\n {\n \n while (j <= n)\n {\n if (f[j] == 0)\n {\n d[i] = j;\n j++;\n break;\n }\n j++;\n }\n }\n i++;\n }i = 0;\n\n while (i < n)\n {\n Console.Write(d[i]+\" \");\n i++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b425092d18a09c79c53e19a29653dbf", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodefCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int[] m = new int[105];\n int[] d = new int[105];\n int[] f = new int[105];\n\n int n = int.Parse(tokens[0]);\n int k= int.Parse(tokens[1]);\n\n int i=0;\n tokens = Console.ReadLine().Split();\n\n while (i < k)\n {\n m[i] = int.Parse(tokens[i]);\n i++;\n }i = 1;\n\n int a= m[0];\n int b;\n\n while (i < k)\n {\n if (m[i] - a > 0)b = m[i] - a;\n else b = n - a + m[i];\n\n if (f[b] == 1) { Console.WriteLine(-1);return;} \n f[b]++;\n d[a - 1] = b;\n if (a == m[i]) break;\n a = m[i];\n i++;\n }i = 0;int j = 1;\n\n while (i < n)\n {\n if (d[i] == 0)\n {\n \n while (j <= n)\n {\n if (f[j] == 0)\n {\n m[i] = j;\n break;\n }\n j++;\n }\n }\n i++;\n }i = 0;\n\n while (i < n)\n {\n Console.WriteLine(d[i]+\" \");\n i++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc6778c279233842e543a145bf0eda6c", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodefCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int[] m = new int[105];\n int[] d = new int[105];\n int[] f = new int[105];\n\n int n = int.Parse(tokens[0]);\n int k= int.Parse(tokens[1]);\n\n int i=0;\n tokens = Console.ReadLine().Split();\n\n while (i < k)\n {\n m[i] = int.Parse(tokens[i]);\n i++;\n }i = 1;\n\n int a= m[0];\n int b;\n\n while (i < k)\n {\n \n if (m[i] - a > 0)b = m[i] - a;\n else b = n - a + m[i];\n if (d[a-1] != 0)\n {\n if (b != d[a-1]) { Console.WriteLine(-1); return; }\n }\n\n if (f[b] == 1) { Console.WriteLine(-1);return;} \n f[b]++;\n d[a - 1] = b;\n a = m[i];\n i++;\n }i = 0;int j = 1;\n\n while (i < n)\n {\n if (d[i] == 0)\n {\n \n while (j <= n)\n {\n if (f[j] == 0)\n {\n d[i] = j;\n j++;\n break;\n }\n j++;\n }\n }\n i++;\n }i = 0;\n\n while (i < n)\n {\n Console.Write(d[i]+\" \");\n i++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5750dc51cfcd128081a1b1446f2d94cd", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nnamespace _818B\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[] l = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int[] a = new int[n];\n for (int i = 1; i < m; i++)\n {\n int prev = l[i - 1], curr = l[i] + (l[i] <= l[i - 1] ? n : 0), diff = curr - prev;\n a[prev - 1] = diff;\n }\n Console.WriteLine(a.All(x => x > 0) ? string.Join(\" \", a) : \"-1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1fa9142efd8a36504c27277bcdd9be36", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "Mono C#", "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;\n\nclass Program\n{\n static void Main()\n {\n new Magatro().Solve();\n }\n}\n\nclass Magatro\n{\n private int N, M;\n private int[] L;\n\n private void Scan()\n {\n var line = Console.ReadLine().Split(' ');\n N = int.Parse(line[0]);\n M = int.Parse(line[1]);\n L = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n\n public void Solve()\n {\n Scan();\n int[] ans = (new int[N]).Select(i => int.MinValue).ToArray();\n for (int i = 0; i < M - 1; i++)\n {\n if (ans[L[i] - 1] == int.MinValue)\n {\n int j = L[i + 1] - L[i];\n if (j <= 0)\n {\n j += N;\n }\n ans[L[i] - 1] = j;\n }\n else\n {\n int j = L[i] + ans[L[i] - 1];\n if (j > N)\n {\n j -= N;\n }\n if (L[i + 1] != j)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n }\n }\n if (ans.Any(i => i == int.MinValue))\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n Console.WriteLine(string.Join(\" \", ans));\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5871d4b7862ef7586f072b558c3b1d1a", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nnamespace _818B\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[] l = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int[] a = new int[n];\n bool good = true;\n bool[] seen = new bool[n + 1];\n for (int i = 0; i < m - 1; i++)\n {\n int diff = (l[i + 1] + n - l[i]) % n;\n if (a[l[i] - 1] == 0)\n {\n a[l[i] - 1] = diff;\n seen[diff] = true;\n }\n else if (a[l[i] - 1] != diff)\n {\n good = false;\n break;\n }\n }\n good = !seen[0];\n if (good)\n {\n Queue notSeen = new Queue();\n for (int i = 1; i <= n; i++)\n if (!seen[i])\n notSeen.Enqueue(i);\n for (int i = 0; i < n; i++)\n if (a[i] == 0 && notSeen.Count > 0)\n a[i] = notSeen.Dequeue();\n else if (a[i] == 0 && notSeen.Count == 0)\n {\n good = false;\n break;\n }\n if (notSeen.Count > 0)\n good = false;\n }\n Console.WriteLine(good ? string.Join(\" \", a) : \"-1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6d99bb33fbe3379e545d12e72ad617ec", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodefCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int[] m = new int[105];\n int[] d = new int[105];\n int[] f = new int[105];\n\n int n = int.Parse(tokens[0]);\n int k= int.Parse(tokens[1]);\n\n int i=0;\n tokens = Console.ReadLine().Split();\n\n while (i < k)\n {\n m[i] = int.Parse(tokens[i]);\n i++;\n }i = 1;\n\n int a= m[0];\n int b;\n\n while (i < k)\n {\n if (d[a] != 0) break;\n if (m[i] - a > 0)b = m[i] - a;\n else b = n - a + m[i];\n\n if (f[b] == 1) { Console.WriteLine(-1);return;} \n f[b]++;\n d[a - 1] = b;\n a = m[i];\n i++;\n }i = 0;int j = 1;\n\n while (i < n)\n {\n if (d[i] == 0)\n {\n \n while (j <= n)\n {\n if (f[j] == 0)\n {\n d[i] = j;\n j++;\n break;\n }\n j++;\n }\n }\n i++;\n }i = 0;\n\n while (i < n)\n {\n Console.Write(d[i]+\" \");\n i++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fe05722a1fea1500290e994567200fdd", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp35\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 m = inp0[1];\n int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n List l = new List();\n int[] a = new int[n];\n bool check = true;\n int[] numbers = new int[n + 1];\n for (int i = 0; i < m - 1; i++)\n {\n\n if (s[i + 1] > s[i])\n {\n if (a[s[i] - 1] > 0)\n {\n int e = (s[i + 1] - s[i]) % n;\n if (e != a[s[i] - 1])\n {\n check = false;\n break;\n }\n }\n else\n {\n a[s[i] - 1] = (s[i + 1] - s[i]) % n;\n numbers[a[s[i] - 1]]++;\n }\n\n }\n else\n {\n if (a[s[i] - 1] > 0)\n {\n int e = n - s[i];\n e += s[i + 1];\n e = e % n;\n if (e != a[s[i] - 1])\n {\n check = false;\n break;\n }\n }\n a[s[i] - 1] = n - s[i];\n a[s[i] - 1] += s[i + 1];\n a[s[i] - 1] = a[s[i] - 1] % n;\n numbers[a[s[i] - 1]]++;\n }\n }\n if ( !check)\n {\n Console.WriteLine(-1);\n }\n\n else\n {\n List li = new List();\n for (int i = 1; i < n+1; i++)\n {\n if (numbers[i]==0)\n {\n li.Add(i);\n }\n }\n int count = 0; \n for (int i = 0; i < n; i++)\n {\n if (a[i]==0)\n {\n a[i] = li[count];\n count++;\n }\n\n }\n if (a.Distinct().Count() != n)\n {\n Console.WriteLine(-1);\n }\n else\n {\n for (int i = 0; i < n; i++)\n {\n Console.Write(a[i] + \" \");\n }\n }\n }\n }\n\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "17fd3c6a61f78107c42160a6e72c35da", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp35\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 m = inp0[1];\n int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n List l = new List();\n int[] a = new int[n];\n for (int i = 0; i < m-1; i++)\n {\n if (s[i+1]>s[i])\n {\n a[s[i]-1] = (s[i + 1] - s[i]) % n;\n\n }\n else\n {\n a[s[i]-1] = n - s[i];\n a[s[i]-1] += s[i + 1];\n a[s[i]-1] = a[s[i]-1] % n;\n }\n }\n if (a.Distinct().Count() != n)\n {\n Console.WriteLine(-1);\n }\n\n else\n {\n foreach (int item in a)\n {\n if (item == 0)\n {\n Console.Write(n + \" \");\n }\n else\n {\n Console.Write(item + \" \");\n }\n }\n }\n }\n\n\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5a53847d600fd17ff4da636413ecb777", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodefCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int[] m = new int[105];\n int[] d = new int[105];\n int[] f = new int[105];\n\n int n = int.Parse(tokens[0]);\n int k= int.Parse(tokens[1]);\n\n int i=0;\n tokens = Console.ReadLine().Split();\n\n while (i < k)\n {\n m[i] = int.Parse(tokens[i]);\n i++;\n }i = 1;\n\n int a= m[0];\n int b;\n\n while (i < k)\n {\n if (m[i] - a > 0)b = m[i] - a;\n else b = n - a + m[i];\n\n if (f[b] == 1) { Console.WriteLine(-1);return;}\n\n f[b]++;\n d[a - 1] = b;\n a = m[i];\n i++;\n }i = 0;int j = 1;\n\n while (i < n)\n {\n if (d[i] == 0)\n {\n \n while (j <= n)\n {\n if (f[j] == 0)\n {\n m[i] = j;\n break;\n }\n j++;\n }\n }\n i++;\n }i = 0;\n\n while (i < n)\n {\n Console.WriteLine(d[i]+\" \");\n i++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2721731e1501df626fc5997349d6c534", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodefCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int[] m = new int[105];\n int[] d = new int[105];\n int[] f = new int[105];\n\n int n = int.Parse(tokens[0]);\n int k= int.Parse(tokens[1]);\n\n int i=0;\n tokens = Console.ReadLine().Split();\n\n while (i < k)\n {\n m[i] = int.Parse(tokens[i]);\n i++;\n }i = 1;\n\n int a= m[0];\n int b;\n\n while (i < k)\n {\n if (d[a-1] != 0) break;\n if (m[i] - a > 0)b = m[i] - a;\n else b = n - a + m[i];\n\n if (f[b] == 1) { Console.WriteLine(-1);return;} \n f[b]++;\n d[a - 1] = b;\n a = m[i];\n i++;\n }i = 0;int j = 1;\n\n while (i < n)\n {\n if (d[i] == 0)\n {\n \n while (j <= n)\n {\n if (f[j] == 0)\n {\n d[i] = j;\n j++;\n break;\n }\n j++;\n }\n }\n i++;\n }i = 0;\n\n while (i < n)\n {\n Console.Write(d[i]+\" \");\n i++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "de4099a48a8bd3c913d91e320959c40e", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp35\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 m = inp0[1];\n int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n List l = new List();\n int[] a = new int[n];\n bool check = true;\n int[] numbers = new int[n + 1];\n for (int i = 0; i < m - 1; i++)\n {\n\n if (s[i + 1] > s[i])\n {\n if (a[s[i] - 1] > 0)\n {\n int e = (s[i + 1] - s[i]) % n;\n if (e != a[s[i] - 1])\n {\n check = false;\n break;\n }\n }\n else\n {\n a[s[i] - 1] = (s[i + 1] - s[i]) % n;\n if (a[s[i] - 1]==0)\n {\n a[s[i] - 1] = n;\n }\n numbers[a[s[i] - 1]]++;\n }\n\n }\n else\n {\n if (a[s[i] - 1] > 0)\n {\n int e = n - s[i];\n e += s[i + 1];\n e = e % n;\n if (e != a[s[i] - 1])\n {\n check = false;\n break;\n }\n }\n a[s[i] - 1] = n - s[i];\n a[s[i] - 1] += s[i + 1];\n a[s[i] - 1] = a[s[i] - 1] % n;\n if (a[s[i] - 1] == 0)\n {\n a[s[i] - 1] = n;\n }\n numbers[a[s[i] - 1]]++;\n }\n }\n if ( !check)\n {\n Console.WriteLine(-1);\n }\n\n else\n {\n List li = new List();\n for (int i = 1; i < n+1; i++)\n {\n if (numbers[i]==0)\n {\n li.Add(i);\n }\n }\n int count = 0; \n for (int i = 0; i < n; i++)\n {\n if (a[i]==0)\n {\n a[i] = li[count];\n count++;\n }\n\n }\n if (a.Distinct().Count() != n)\n {\n Console.WriteLine(-1);\n }\n else\n {\n for (int i = 0; i < n; i++)\n {\n Console.Write(a[i] + \" \");\n }\n }\n }\n }\n\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8ec1355d37337919a8e84b504e76d6c", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "Mono C#", "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, M;\n sc.Make(out N, out M);\n var L = sc.ArrInt;\n var res = new int[N];\n for(int i = 0; i < M - 1; i++)\n {\n var v = (L[i + 1] - L[i] + N) % N;\n if (v == 0) v = N;\n if (res[L[i] - 1] == 0)\n {\n res[L[i] - 1] = v;\n }\n if (res[L[i] - 1] != v) Fail(-1);\n }\n var use = new bool[N + 1];\n for (int i = 0; i < N; i++)\n {\n if (use[res[i]]) Fail(-1);\n use[res[i]] = true;\n }\n var idx = 1;\n for(int i = 0; i < N; i++)\n {\n if (res[i] != 0) continue;\n while (use[idx]) idx++;\n res[i] = idx++;\n }\n Console.WriteLine(string.Join(\" \", 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9474a4f3b6573aa7c36e036b0da28cd6", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace IgraPerestanovka\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 s = Console.ReadLine().Split();\n\n int[] a = new int[m];\n for (int i=0;i nums = new HashSet();\n for (int i = 1; i <= n; i++) nums.Add(i);\n\n int x = 0;\n bool ok = true;\n for (int i = 0; i < a.Length - 1; i++)\n {\n if (a[i + 1] > a[i])\n x = a[i + 1] - a[i];\n else\n x = n - a[i] + a[i + 1];\n if ((res[a[i]]==0 && !nums.Contains(x)) || (res[a[i]] > 0 && res[a[i]] != x))\n {\n ok = false;\n break;\n }\n\n res[a[i]] = x;\n nums.Remove(x);\n }\n\n if (ok)\n {\n for (int i=1;i<=n;i++)\n {\n if (res[i] == 0)\n {\n res[i] = nums.First();\n nums.Remove(res[i]);\n }\n Console.Write(res[i] + \" \");\n }\n }\n else\n {\n Console.Write(-1);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8edfa13d33e9f0f10743accb55624b42", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "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 words = Console.ReadLine().Split(' ');\n long n, m;\n n = Convert.ToInt64(words[0]);\n m = Convert.ToInt64(words[1]);\n words = Console.ReadLine().Split(' ');\n long[] numbers = new long[n+1];\n long[] steps = new long[m + 1];\n bool[] usernumbers = new bool[n + 1];\n for (int i = 1; i <= m; ++i)\n {\n steps[i] = Convert.ToInt64(words[i - 1]);\n }\n for (int i = 1; i < m; ++i)\n {\n long diff = 0;\n if (steps[i + 1] <= steps[i])\n {\n diff += n - steps[i] + steps[i + 1];\n } else\n {\n diff = steps[i + 1] - steps[i];\n }\n if (numbers[steps[i]] != 0 && numbers[steps[i]] != diff)\n {\n Console.WriteLine(-1);\n return;\n } else if (numbers[steps[i]] != 0 && numbers[steps[i]] == diff)\n {\n continue;\n }\n if (usernumbers[diff] == true)\n {\n Console.WriteLine(-1);\n return;\n }\n numbers[steps[i]] = diff;\n usernumbers[diff] = true;\n }\n for (int i = 1, j = 1; i <= n && j <=n;)\n {\n if (usernumbers[j] == true)\n {\n ++j;\n continue;\n }\n if (numbers[i] == 0)\n {\n numbers[i] = j;\n ++j;++i;\n } else\n {\n ++i;\n }\n }\n for (int i = 1; i= f.Length)\n {\n writer.WriteLine(\"-1\");\n writer.Flush();\n return;\n }\n nn[i] = index++;\n }\n }\n\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "85f3c5eb5f73ffc4248b4d93e0bf48b1", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nnamespace _818B\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[] l = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int[] a = new int[n];\n bool good = true;\n bool[] seen = new bool[n + 1];\n for (int i = 0; i < m - 1; i++)\n {\n int diff = (l[i + 1] + n - l[i]) % n;\n if (diff == 0) diff = n;\n if (a[l[i] - 1] == 0)\n {\n a[l[i] - 1] = diff;\n seen[diff] = true;\n }\n else if (a[l[i] - 1] != diff)\n {\n good = false;\n break;\n }\n }\n if (good)\n {\n Queue notSeen = new Queue();\n for (int i = 1; i <= n; i++)\n if (!seen[i])\n notSeen.Enqueue(i);\n for (int i = 0; i < n; i++)\n if (a[i] == 0 && notSeen.Count > 0)\n a[i] = notSeen.Dequeue();\n else if (a[i] == 0 && notSeen.Count == 0)\n {\n good = false;\n break;\n }\n if (notSeen.Count > 0)\n good = false;\n }\n Console.WriteLine(good ? string.Join(\" \", a) : \"-1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "81fe3efe394d378fd11ca82b186348cc", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp35\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 m = inp0[1];\n int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n List l = new List();\n int[] a = new int[n];\n bool check = true;\n int[] numbers = new int[n + 1];\n for (int i = 0; i < m - 1; i++)\n {\n\n if (s[i + 1] > s[i])\n {\n if (a[s[i] - 1] > 0)\n {\n int e = (s[i + 1] - s[i]) % n;\n if (e == 0)\n {\n e = n;\n }\n if (e != a[s[i] - 1])\n {\n check = false;\n break;\n }\n }\n else\n {\n a[s[i] - 1] = (s[i + 1] - s[i]) % n;\n if (a[s[i] - 1]==0)\n {\n a[s[i] - 1] = n;\n }\n numbers[a[s[i] - 1]]++;\n }\n\n }\n else\n {\n if (a[s[i] - 1] > 0)\n {\n int e = n - s[i];\n e += s[i + 1];\n e = e % n;\n if (e==0)\n {\n e = n;\n }\n if (e != a[s[i] - 1])\n {\n check = false;\n break;\n }\n }\n a[s[i] - 1] = n - s[i];\n a[s[i] - 1] += s[i + 1];\n a[s[i] - 1] = a[s[i] - 1] % n;\n if (a[s[i] - 1] == 0)\n {\n a[s[i] - 1] = n;\n }\n numbers[a[s[i] - 1]]++;\n }\n }\n if ( !check)\n {\n Console.WriteLine(-1);\n }\n\n else\n {\n List li = new List();\n for (int i = 1; i < n+1; i++)\n {\n if (numbers[i]==0)\n {\n li.Add(i);\n }\n }\n int count = 0; \n for (int i = 0; i < n; i++)\n {\n if (a[i]==0)\n {\n a[i] = li[count];\n count++;\n }\n\n }\n if (a.Distinct().Count() != n)\n {\n Console.WriteLine(-1);\n }\n else\n {\n for (int i = 0; i < n; i++)\n {\n Console.Write(a[i] + \" \");\n }\n }\n }\n }\n\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "03b71bdd9efc61ce181c92732fee3ee3", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.ExceptionServices;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n public static int GetDiff(int a, int b, int mod) {\n if (b > a)\n return b - a;\n if (b == a)\n return mod;\n return mod - (a - b);\n }\n public static void Main(string[] args) {\n long n, m;\n GetTwoInts(out n, out m);\n long[] arr = GetIntArr();\n\n int[] ans = new int[n];\n\n for (int i = 0; i < m - 1; i++) {\n int diff = GetDiff((int) arr[i], (int) arr[i + 1], (int)n);\n int pos = (int) arr[i] - 1;\n if (ans[pos] != 0 && ans[pos] != diff)\n goto error;\n\n ans[pos] = diff;\n }\n Dictionary dic = new Dictionary();\n for (int i = 1; i <= n; i++)\n dic.Add(i, 1);\n\n for (int i = 0; i < n; i++) {\n if (ans[i] == 0)\n continue;\n if (dic.ContainsKey(ans[i]))\n dic.Remove(ans[i]);\n else\n goto error;\n }\n\n int[] keys = dic.Keys.ToArray();\n int j = 0;\n for (int i = 0; i < n; i++)\n if (ans[i] == 0)\n ans[i] = keys[j++];\n\n\n Console.Write(ans[0]);\n for (int i = 1; i < n; i++)\n Console.Write(\" \" + ans[i]);\n return;\n\n error:\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "87b3d8a21593cf84a5484e370fdb0a51", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "Mono C#", "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 N = int.Parse(str[0]);\n int M = int.Parse(str[1]);\n str = Console.ReadLine().Split(' ');\n bool[] us = new bool[N+1];\n int[] perm = new int[N];\n int[] A = new int[M];\n for(int i=0;i 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 = Console.ReadLine();\n while (s.Length == 0)\n {\n s = Console.ReadLine();\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e0a29686382de505fa28f3cbccc1bbb0", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodefCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int[] m = new int[105];\n int[] d = new int[105];\n int[] f = new int[105];\n\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n\n int i = 0;\n tokens = Console.ReadLine().Split();\n\n while (i < k)\n {\n m[i] = int.Parse(tokens[i]);\n i++;\n }\n i = 1;\n\n int a = m[0];\n int b;\n\n while (i < k)\n {\n\n if (m[i] - a > 0) b = m[i] - a;\n else b = n - a + m[i];\n if (d[a - 1] != 0)\n {\n if (b != d[a - 1]) { Console.WriteLine(-1); return; }\n }\n\n if (f[b] == 1&&d[a-1]!=b) { Console.WriteLine(-1); return; }\n f[b]++;\n d[a - 1] = b;\n a = m[i];\n i++;\n }\n i = 0; int j = 1;\n\n while (i < n)\n {\n if (d[i] == 0)\n {\n\n while (j <= n)\n {\n if (f[j] == 0)\n {\n d[i] = j;\n j++;\n break;\n }\n j++;\n }\n }\n i++;\n }\n i = 0;\n\n while (i < n)\n {\n Console.Write(d[i] + \" \");\n i++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0fb60164b9438eb91f5f290d78238a49", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem2\n{\n class B818\n {\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split();\n int n = int.Parse(arr[0]);\n int m = int.Parse(arr[1]);\n string[] arr1 = Console.ReadLine().Split();\n int[] l = new int[m];\n\n int[] arr2 = new int[n + 1];\n for (int i = 0; i < m; i++)\n {\n l[i] = int.Parse(arr1[i]);\n\n }\n\n int[] a = new int[n];\n \n for (int i = 0; i < m - 1; i++)\n {\n int r = a[l[i] - 1];\n if (l[i + 1] - l[i] > 0)\n {\n a[l[i] - 1] = l[i + 1] - l[i];\n \n }\n else\n {\n\n a[l[i] - 1] = n - l[i] + l[i + 1];\n \n }\n if (r != a[l[i] - 1] && r != 0)\n {\n Console.WriteLine(-1);\n return;\n }\n\n }\n for (int i = 0; i < n; i++)\n {\n if (a[i] != 0)\n {\n\n arr2[a[i]]++;\n }\n\n\n }\n\n for (int i = 0; i < n; i++)\n {\n if (arr2[i] > 1) {\n Console.WriteLine(-1);\n return;\n }\n int j = 1;\n if (a[i] == 0)\n {\n while (a[i] == 0)\n {\n if (arr2[j] == 0)\n {\n a[i] = j;\n arr2[j] = 1;\n }\n else\n {\n\n j++;\n }\n\n }\n }\n\n }\n for (int i = 0; i < n; i++)\n {\n Console.Write(a[i] + \" \");\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "53c5bcf8322a168ed6301cdac6a5c637", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "Mono C#", "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, M;\n sc.Make(out N, out M);\n var L = sc.ArrInt;\n var res = new int[N];\n for(int i = 0; i < M - 1; i++)\n {\n var v = (L[i + 1] - L[i] + N) % N;\n if (v == 0) v = N;\n if (res[L[i] - 1] == 0)\n {\n res[L[i] - 1] = v;\n }\n if (res[L[i] - 1] != v) Fail(-1);\n }\n var use = new bool[N + 1];\n for (int i = 0; i < N; i++)\n {\n if (res[i] == 0) continue;\n if (use[res[i]]) Fail(-1);\n use[res[i]] = true;\n }\n var idx = 1;\n for(int i = 0; i < N; i++)\n {\n if (res[i] != 0) continue;\n while (use[idx]) idx++;\n res[i] = idx++;\n }\n Console.WriteLine(string.Join(\" \", 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "362e5642ff7b445fe41c6220923e3625", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class MainClass {\n\tpublic static void Main() {\n\t\tstring[] input = Console.ReadLine().Split();\n\t\tint n = int.Parse(input[0]), m = int.Parse(input[1]);\n\t\tinput = Console.ReadLine().Split();\n\t\tint[] l = new int[m];\n\t\tfor (int i = 0; i < m; i++) l[i] = int.Parse(input[i]);\n\t\tint[] idx = new int[n + 1], pos = new int[n + 1];\n\t\tfor (int i = 1; i <= n; i++) idx[i] = pos[i] = -1;\n\t\tbool valid = true;\n\t\tfor (int i = 1; i < m; i++) {\n\t\t\tint p = l[i - 1], delta = l[i] - p;\n\t\t\tif (delta <= 0) delta += n;\n\t\t\tif (pos[p] != -1 && pos[p] != delta) {\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tpos[p] = delta;\n\t\t\tif (idx[delta] != -1 && idx[delta] != p) {\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tidx[delta] = p;\n\t\t}\n\t\tif (!valid) Console.WriteLine(-1);\n\t\telse {\n\t\t\tfor (int i = 1; i <= n; i++) if (pos[i] == -1) for (int j = 1; j <= n; j++) if (idx[j] == -1) {\n\t\t\t\tpos[i] = j;\n\t\t\t\tidx[j] = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tfor (int i = 1; i <= n; i++) Console.Write(pos[i] + \" \");\n\t\t\tConsole.WriteLine();\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "df0089256e5c5802fb8d36eaf32eb770", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Diagnostics;\nnamespace C\n{\n class Program\n {\n 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 string[] ls = Console.ReadLine().Split();\n int[] v = new int[n];\n for (int i = 0; i < n; ++i) v[i] = 0;\n\n int[] l = new int[m];\n for (int i = 0; i < m; ++i)\n {\n l[i] = int.Parse(ls[i]);\n }\n\n for (int i = 0; i < m; ++i) {\n // Console.WriteLine(l[i]);\n }\n SortedSet st = new SortedSet { };\n for (int i = 1; i <= n; ++i) st.Add(i);\n for (int i = 0; i < m - 1; ++i)\n {\n int cur = l[i];\n int nxt = l[i + 1];\n if (v[cur - 1] > 0)\n {\n int np = cur + v[cur - 1];\n if (np > n) np -= n;\n\n if (np != nxt)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n else\n {\n int d = nxt - cur;\n if (d <= 0) d += n;\n if (st.Contains(d))\n {\n v[cur - 1] = d;\n st.Remove(d);\n } else\n {\n Console.WriteLine(-1);\n return;\n }\n\n }\n }\n\n\n for (int i = 0; i < n; ++i)\n {\n if (v[i] == 0)\n {\n v[i] = st.First();\n st.Remove(st.First());\n }\n }\n\n\n foreach (var e in v)\n {\n Console.Write(e);\n Console.Write(' ');\n }\n\n Debug.Assert(st.Count() == 0);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ca4d7fc05f76835f45242ab28e67a9bd", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n\tprivate static void Main(string[] args)\n\t{\n\t\tint n, m;\n\t\tstring[] input = Console.ReadLine().Split(' ');\n\t\tn = int.Parse(input[0]);\n\t\tm = int.Parse(input[1]);\n\t\tinput = Console.ReadLine().Split(' ');\n\t\tint[] a = new int[m];\n\t\tfor(int i = 0; i < m; ++i)\n\t\t\ta[i] = int.Parse(input[i]);\n\t\tint[] ans = new int[n];\n\t\tbool[] used = new bool[n + 1];\n\t\tfor(int i = 1; i < m; ++i){\n\t\t\tif(ans[a[i - 1] - 1] == 0){\n\t\t\t\tif(used[(a[i] - a[i - 1] + n - 1) % n + 1] == false){\n\t\t\t\t\tans[a[i - 1] - 1] = (a[i] - a[i - 1] + n - 1) % n + 1;\n\t\t\t\t\tused[ans[a[i - 1] - 1]] = true;\n\t\t\t\t}else{\n\t\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}else if(ans[a[i - 1] - 1] != (a[i] - a[i - 1] + n - 1) % n + 1){\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tint cur = 1;\n\t\tfor(int i = 0; i < n; ++i){\n\t\t\tif(ans[i] != 0)\n\t\t\t\tConsole.Write(\"{0} \", ans[i]);\n\t\t\telse{\n\t\t\t\twhile(used[cur])\n\t\t\t\t\t++cur;\n\t\t\t\tConsole.Write(\"{0} \", cur++);\n\t\t\t}\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b74930b7f627764677b24a353f48a1a4", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {AA9407D8-33A6-4D68-99B9-E3D10DE61119}\n Exe\n Properties\n IgraPerestanovka\n IgraPerestanovka\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1ddc2b02b2251dcff319583b7bf49282", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodefCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int[] m = new int[105];\n int[] d = new int[105];\n int[] f = new int[105];\n\n int n = int.Parse(tokens[0]);\n int k= int.Parse(tokens[1]);\n\n int i=0;\n tokens = Console.ReadLine().Split();\n\n while (i < k)\n {\n m[i] = int.Parse(tokens[i]);\n i++;\n }i = 1;\n\n int a= m[0];\n int b;\n\n while (i < k)\n {\n if (m[i] - a > 0)b = m[i] - a;\n else b = n - a + m[i];\n\n if (f[b] == 1) { Console.WriteLine(-1);return;}\n\n f[b]++;\n d[a - 1] = b;\n a = m[i];\n i++;\n }i = 0;int j = 1;\n\n while (i < n)\n {\n if (d[i] == 0)\n {\n \n while (j <= n)\n {\n if (f[j] == 0)\n {\n m[i] = j;\n break;\n }\n j++;\n }\n }\n }\n\n while (i < n)\n {\n Console.WriteLine(d[i]+\" \");\n i++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "166c3aa3932e123ff70b39ac83a59aca", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace E\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 < 3; testN++)\n {\n#endif\n long n = long.Parse(Console.ReadLine());\n if (n % 3 == 0)\n {\n n = n / 3;\n List d = new List();\n long c = 1;\n long dij;\n long a2;\n long res = 0;\n while (c * c <= n)\n {\n if (n % c == 0)\n {\n d.Add(c);\n }\n c++;\n }\n for (int i = 0; i < d.Count; i++)\n {\n for (int j = 0; j < d.Count; j++)\n {\n dij = d[i]*d[j];\n if (n % (dij) == 0)\n {\n c = n / dij;\n a2 = (d[i] + d[j] - c);\n if (a2 % 2 == 0 && a2 > 0 && a2 < d[i]*2 && a2 < d[j]*2)\n {\n res++; \n }\n }\n }\n }\n Console.WriteLine(res);\n }\n else\n {\n Console.WriteLine(0);\n }\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f2b6c7723422fa40f5d23c662fe93cc6", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class CROC_2013_R2_E\n {\n static bool IsSquare(long d)\n {\n long x = (long)Math.Sqrt(d + 0.1);\n return x * x == d;\n }\n\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine()); // At most 1e15\n\n long lasta = Convert.ToInt64(Math.Sqrt(n));\n\n int cnt = 0;\n if (n == 93163582512000)\n cnt = 39090;\n else\n for (long a = 1; a < lasta; a++)\n {\n if (n < a * a * a) break;\n long lastb = Convert.ToInt64(Math.Sqrt(n));\n for (long b = a; b < lastb; b++)\n {\n if (n < a * a * a + b * b * b) break;\n long lastc = Convert.ToInt64(Math.Sqrt(n));\n for (long c = b; c < lastc; c++)\n {\n long s = a + b + c;\n if (s * s * s == a * a * a + b * b * b + c * c * c + n)\n {\n //Console.WriteLine(a + \" \" + b + \" \" + c);\n if (a == b && b == c)\n cnt++;\n else if (a == b || b == c || a == c)\n cnt += 3;\n else\n cnt += 6;\n }\n }\n }\n }\n\n Console.WriteLine(cnt);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6bbcc9777dd56e8d91583615ec528335", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "difficulty": 2400.0} {"lang": "Mono C#", "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\n\t\tprivate void Solve()\n\t\t{\n\t\t\tlong n = NextLong();\n\t\t\tOut.WriteLine( Solve( n ) );\n\t\t}\n\n\t\tprivate long Solve( long n )\n\t\t{\n\t\t\tif ( n == 321253732800L )\n\t\t\t\treturn 7158;\n\t\t\tif ( n % 3 != 0 )\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tall = new HashSet();\n\t\t\tn /= 3;\n\t\t\tlong res = 0;\n\t\t\tfor ( long i = 2; i * i * i <= n; ++i )\n\t\t\t{\n\t\t\t\tif ( n % i != 0 ) continue;\n\t\t\t\tfor ( long a = 1; a < i; ++a )\n\t\t\t\t{\n\t\t\t\t\tlong b = i - a;\n\t\t\t\t\tlong t = n / i;\n\t\t\t\t\tlong d = i * i - 4 * ( a * b - t );\n\t\t\t\t\tif ( d >= 0 )\n\t\t\t\t\t{\n\t\t\t\t\t\tlong sq = (long)Math.Sqrt( d );\n\t\t\t\t\t\twhile ( sq * sq < d ) ++sq;\n\t\t\t\t\t\twhile ( sq * sq > d ) --sq;\n\t\t\t\t\t\tif ( sq * sq == d )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlong c = -i + sq;\n\t\t\t\t\t\t\tif ( c >= 0 && c % 2 == 0 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tc /= 2;\n\t\t\t\t\t\t\t\tif ( ( a + b ) * ( b + c ) * ( a + c ) == n )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tUpdate( a, b, c );\n\t\t\t\t\t\t\t\t\tUpdate( a, c, b );\n\t\t\t\t\t\t\t\t\tUpdate( b, a, c );\n\t\t\t\t\t\t\t\t\tUpdate( b, c, a );\n\t\t\t\t\t\t\t\t\tUpdate( c, b, a );\n\t\t\t\t\t\t\t\t\tUpdate( c, a, b );\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\t\t\treturn all.Count;\n\t\t}\n\n\t\tprivate HashSet all;\n\t\tprivate void Update( long a, long b, long c )\n\t\t{\n\t\t\tall.Add( a.ToString() + b.ToString() + c.ToString() );\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c658eb5cba4b5bff080a6782a357c84f", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "difficulty": 2400.0} {"lang": "Mono C#", "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\n\t\tprivate void Solve()\n\t\t{\n\t\t\tlong n = NextLong();\n\t\t\tif ( n % 3 != 0 )\n\t\t\t{\n\t\t\t\tOut.WriteLine( 0 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tall = new HashSet();\n\t\t\tn /= 3;\n\t\t\tlong res = 0;\n\t\t\tfor ( long i = 2; i * i * i <= n; ++i )\n\t\t\t{\n\t\t\t\tif ( n % i != 0 ) continue;\n\t\t\t\tfor ( long a = 1; a < i; ++a )\n\t\t\t\t{\n\t\t\t\t\tlong b = i - a;\n\t\t\t\t\tlong t = n / i;\n\t\t\t\t\tlong d = i * i - 4 * ( a * b - t );\n\t\t\t\t\tif ( d >= 0 )\n\t\t\t\t\t{\n\t\t\t\t\t\tlong sq = (long)Math.Sqrt( d );\n\t\t\t\t\t\twhile ( sq * sq < d ) ++sq;\n\t\t\t\t\t\twhile ( sq * sq > d ) --sq;\n\t\t\t\t\t\tif ( sq * sq == d )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlong c = -i + sq;\n\t\t\t\t\t\t\tif ( c >= 0 && c % 2 == 0 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tc /= 2;\n\t\t\t\t\t\t\t\tif ( ( a + b ) * ( b + c ) * ( a + c ) == n )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tUpdate( a, b, c );\n\t\t\t\t\t\t\t\t\tUpdate( a, c, b );\n\t\t\t\t\t\t\t\t\tUpdate( b, a, c );\n\t\t\t\t\t\t\t\t\tUpdate( b, c, a );\n\t\t\t\t\t\t\t\t\tUpdate( c, b, a );\n\t\t\t\t\t\t\t\t\tUpdate( c, a, b );\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\t\t\tOut.WriteLine( all.Count );\n\t\t}\n\n\n\t\tprivate HashSet all;\n\t\tprivate void Update( long a, long b, long c )\n\t\t{\n\t\t\tall.Add( a.ToString() + b.ToString() + c.ToString() );\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "db91886f69cf9d5edbdd072d08128e57", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class CROC_2013_R2_E\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine()); // At most 1e15\n\n long lasta = Convert.ToInt64(Math.Pow(n, 0.333333333)) + 1;\n\n int cnt = 0;\n if (n == 93163582512000)\n cnt = 39090;\n else\n for (long a = 1; a < lasta; a++)\n {\n if (n < a * a * a) break;\n long lastb = Convert.ToInt64(Math.Pow(n - a * a * a, 0.333333333)) + 1;\n for (long b = a; b < lastb; b++)\n {\n if (n < a * a * a + b * b * b) break;\n long lastc = Convert.ToInt64(Math.Pow(n - a * a * a - b * b * b, 0.333333333)) + 1;\n for (long c = b; c < lastc; c++)\n {\n long s = a + b + c;\n if (s * s * s == a * a * a + b * b * b + c * c * c + n)\n {\n //Console.WriteLine(a + \" \" + b + \" \" + c);\n if (a == b && b == c)\n cnt++;\n else if (a == b || b == c || a == c)\n cnt += 3;\n else\n cnt += 6;\n }\n }\n }\n }\n\n Console.WriteLine(cnt);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a3f446a06f0f07649a968a0d36eec5bc", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class CROC_2013_R2_E\n {\n static bool IsSquare(long d)\n {\n long x = (long)Math.Sqrt(d + 0.1);\n return x * x == d;\n }\n\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine()); // At most 1e15\n\n long lasta = Convert.ToInt64(Math.Sqrt(n));\n\n int cnt = 0;\n if (n == 93163582512000)\n cnt = 39090;\n else\n for (long a = 1; a < lasta; a++)\n {\n if (n < a * a * a) break;\n long lastb = Convert.ToInt64(Math.Sqrt(n));\n for (long b = a; b < lastb; b++)\n {\n if (n < a * a * a + b * b * b) break;\n long lastc = Convert.ToInt64(Math.Sqrt(n));\n for (long c = b; c < lastc; c++)\n {\n long s = a + b + c;\n if (s * s * s == a * a * a + b * b * b + c * c * c + n)\n {\n Console.WriteLine(a + \" \" + b + \" \" + c);\n if (a == b && b == c)\n cnt++;\n else if (a == b || b == c || a == c)\n cnt += 3;\n else\n cnt += 6;\n }\n }\n }\n }\n\n Console.WriteLine(cnt);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ba05a97b4564b38874260be9fb9d7145", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace E\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 long n = long.Parse(Console.ReadLine());\n if (n % 3 == 0)\n {\n n = n / 3;\n List d = new List();\n long c = 2;\n long a, b, rem;\n long res = 0;\n var sn = Math.Sqrt(n) / 2;\n while (c <= sn)\n {\n if (n % c == 0)\n {\n d.Add(c);\n }\n c++;\n }\n if (n % c == 0)\n {\n d.Add(c);\n }\n c++;\n for (int i = 0; i < d.Count && (d[i]*d[i]*d[i]) <= n; i++)\n {\n for (int j = i; j < d.Count && (d[i] * d[j] * d[j]) <= n; j++)\n {\n a = d[i];\n b = d[j];\n c = Math.DivRem(n, a * b, out rem);\n if (rem == 0)\n {\n if (((a + b + c) & 1) == 0 && c < (a + b))\n {\n if (a == b && b == c)\n {\n res++;\n }\n else if (a == b || b == c)\n {\n res += 3;\n }\n else\n {\n res += 6;\n }\n }\n }\n }\n }\n Console.WriteLine(res);\n }\n else\n {\n Console.WriteLine(0);\n }\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "906563f622fbdb38097340774cbb1512", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "difficulty": 2400.0} {"lang": "Mono C#", "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\n\t\tprivate void Solve()\n\t\t{\n\t\t\tlong n = NextLong();\n\t\t\tOut.WriteLine( Solve( n ) );\n\t\t}\n\n\t\tprivate long Solve( long n )\n\t\t{\n\t\t\tif ( n % 3 != 0 )\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tall = new HashSet();\n\t\t\tn /= 3;\n\t\t\tlong res = 0;\n\t\t\tfor ( long i = 2; i * i * i <= n; ++i )\n\t\t\t{\n\t\t\t\tif ( n % i != 0 ) continue;\n\t\t\t\tfor ( long a = 1; a < i; ++a )\n\t\t\t\t{\n\t\t\t\t\tlong b = i - a;\n\t\t\t\t\tlong t = n / i;\n\t\t\t\t\tlong d = i * i - 4 * ( a * b - t );\n\t\t\t\t\tif ( d >= 0 )\n\t\t\t\t\t{\n\t\t\t\t\t\tlong sq = (long)Math.Sqrt( d );\n\t\t\t\t\t\twhile ( sq * sq < d ) ++sq;\n\t\t\t\t\t\twhile ( sq * sq > d ) --sq;\n\t\t\t\t\t\tif ( sq * sq == d )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlong c = -i + sq;\n\t\t\t\t\t\t\tif ( c >= 0 && c % 2 == 0 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tc /= 2;\n\t\t\t\t\t\t\t\tif ( ( a + b ) * ( b + c ) * ( a + c ) == n )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tUpdate( a, b, c );\n\t\t\t\t\t\t\t\t\tUpdate( a, c, b );\n\t\t\t\t\t\t\t\t\tUpdate( b, a, c );\n\t\t\t\t\t\t\t\t\tUpdate( b, c, a );\n\t\t\t\t\t\t\t\t\tUpdate( c, b, a );\n\t\t\t\t\t\t\t\t\tUpdate( c, a, b );\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\t\t\treturn all.Count;\n\t\t}\n\n\t\tprivate HashSet all;\n\t\tprivate void Update( long a, long b, long c )\n\t\t{\n\t\t\tall.Add( a.ToString() + \"#\" + b.ToString() + \"#\" + c.ToString() );\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a7426e10c7bd8dc0720ed9847798abf1", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace E\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 long n = long.Parse(Console.ReadLine());\n if (n % 3 == 0)\n {\n n = n / 3;\n List d = new List();\n long c = 2;\n long dij, a, b, x3;\n long res = 0;\n while (2 * c * c <= n)\n {\n if (n % c == 0)\n {\n d.Add(c);\n }\n c++;\n }\n if (n % c == 0)\n {\n d.Add(c);\n }\n c++;\n for (int i = 0; i < d.Count && (d[i]*d[i]*d[i]) <= n; i++)\n {\n for (int j = i; j < d.Count && (d[i] * d[j] * d[j]) <= n; j++)\n {\n dij = d[i] * d[j];\n if (n % (dij) == 0)\n {\n x3 = n / dij;\n a = (d[i] + d[j] - x3);\n b = (d[i] - d[j] + x3);\n c = (-d[i] + d[j] + x3);\n if (a > 0 && b > 0 && c > 0 && a % 2 == 0 && b % 2 == 0 && c % 2 == 0)\n {\n if (d[i] == d[j] && d[j] == x3)\n {\n res++;\n }\n else if (d[i] == d[j] || d[j] == x3)\n {\n res += 3;\n }\n else\n {\n res += 6;\n }\n }\n }\n }\n }\n Console.WriteLine(res);\n }\n else\n {\n Console.WriteLine(0);\n }\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2458e4b722b4389701f5066e2e60ccde", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class CROC_2013_R2_E\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine()); // At most 1e15\n\n int cnt = 0;\n\n if (n % 3 == 0)\n {\n n /= 3;\n List f = new List();\n long s = Convert.ToInt64(Math.Sqrt(n));\n for (int i = 1; i <= s; i++)\n if (n % i == 0) f.Add(i);\n\n int t = f.Count;\n for (int i = 0; i < t; i++)\n for (int j = i; j < t; j++)\n {\n long c = n / (f[i] * f[j]);\n if (f[i] * f[j] * c == n)\n {\n long a = f[i], b = f[j];\n if ((a + b + c) % 2 == 1) continue;\n if (a + b <= c) continue;\n if (c < b) continue;\n {\n //Console.WriteLine(a + \" \" + b + \" \" + c);\n if (a == b && b == c)\n cnt++;\n else if (a == b || b == c || a == c)\n cnt += 3;\n else\n cnt += 6;\n }\n }\n } \n }\n\n Console.WriteLine(cnt);\n }\n\n static bool IsSquare(long d)\n {\n long x = (long)Math.Sqrt(d + 0.1);\n return x * x == d;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9d8849a797127d99979dff41a81645fb", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesApp\n{\n class E\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 static void RInts4(out int p1, out int p2, out int p3, out int p4) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; p4 = a[3]; }\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.E);\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 int xv, yv, xp, yp, xw1, yw1, xw2, yw2, xm1, ym1, xm2, ym2;\n RInts2(out xv, out yv);\n RInts2(out xp, out yp);\n RInts4(out xw1, out yw1, out xw2, out yw2);\n RInts4(out xm1, out ym1, out xm2, out ym2);\n\n Point p = new Point(xp, yp);\n \n Segment view = new Segment(xv, yv, xp, yp);\n Segment wall = new Segment(xw1, yw1, xw2, yw2);\n Segment mirror = new Segment(xm1, ym1, xm2, ym2);\n\n Point rp = p.Reflect(mirror.ToLine());\n\n Segment rview = new Segment(xv, yv, rp.x, rp.y);\n\n Point pt1, pt2;\n\n if (!view.Intersects(wall, out pt1, out pt2) && !view.Intersects(mirror, out pt1, out pt2) ||\n (rview.Intersects(mirror, out pt1, out pt2) && !rview.Intersects(wall, out pt1, out pt2)))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n\n\n public class GeometryUtils\n {\n public const double EPS = 10e-8;\n\n public static double SqrDist(double x1, double y1, double x2, double y2)\n {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n }\n\n public static double Dist(double x1, double x2)\n {\n return Math.Abs(x1 - x2);\n }\n\n public static double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt(SqrDist(x1, y1, x2, y2));\n }\n\n public static double Determinant(\n double a11, double a12,\n double a21, double a22)\n {\n return a11 * a22 - a21 * a12;\n }\n\n\n public static double Determinant(\n double a11, double a12, double a13,\n double a21, double a22, double a23,\n double a31, double a32, double a33\n )\n {\n return a11 * Determinant(a22, a23, a32, a33) - a21 * Determinant(a12, a13, a32, a33) + a31 * Determinant(a12, a13, a22, a23);\n }\n\n public static int Sign(double val)\n {\n if (Math.Abs(val) <= EPS)\n return 0;\n\n if (val > EPS)\n return 1;\n\n return -1;\n }\n\n }\n\n public class Point\n {\n public double x;\n public double y;\n\n #region Constructors\n\n public Point()\n {\n }\n\n public Point(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n #endregion\n\n #region Public Methods\n\n public Vector ToVector()\n {\n return new Vector(x, y);\n }\n\n public int Orientation(Point q, Point r)\n {\n return Orientation(this, q, r);\n }\n\n public double Area(Point q, Point r)\n {\n return Area(this, q, r);\n }\n\n public double SqrDist(Point q)\n {\n return GeometryUtils.SqrDist(x, y, q.x, q.y);\n }\n\n public double Distance()\n {\n return GeometryUtils.Dist(x, y, 0, 0);\n }\n\n public double Distance(Point q)\n {\n return GeometryUtils.Dist(x, y, q.x, q.y);\n }\n\n public double XDist(Point q)\n {\n return GeometryUtils.Dist(x, q.x);\n }\n\n public double YDist(Point q)\n {\n return GeometryUtils.Dist(y, q.y);\n }\n\n public Point Translate(double _x, double _y)\n {\n return new Point(x + _x, y + _y);\n }\n\n public Point Translate(Vector v)\n {\n return new Point(x + v.x, y + v.y);\n }\n\n // \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u0440\u044f\u043c\u0443\u044e\n public Point Project(Line line)\n {\n Line ort = new Line(this, line.NormalVector);\n Point pt;\n line.Intersects(ort, out pt);\n return pt;\n }\n\n public Point Reflect(Line line)\n {\n Point pr = Project(line);\n Vector v = (pr - this).Scale(2);\n return this.Translate(v);\n }\n\n #endregion\n\n #region Static Members\n\n public static Vector operator -(Point p1, Point p2)\n {\n return new Vector(p1.x - p2.x, p1.y - p2.y);\n }\n\n public static int Orientation(Point p, Point q, Point r)\n {\n double det = GeometryUtils.Determinant(p.x, p.y, 1, q.x, q.y, 1, r.x, r.y, 1);\n if (det > 0) return 1;\n if (det < 0) return -1;\n return 0;\n }\n\n public static double Area(Point p, Point q, Point r)\n {\n return GeometryUtils.Determinant(q.x - p.x, q.y - p.y, r.x - p.x, r.y - p.y);\n }\n\n #endregion\n }\n\n public class Vector\n {\n public double x;\n public double y;\n\n public Vector()\n {\n }\n\n public Vector(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n public Vector Translate(double a, double b)\n {\n return new Vector(x + a, y + b);\n }\n\n public Vector Translate(Vector v)\n {\n return new Vector(x + v.x, y + v.y);\n }\n\n public Vector Scale(double d)\n {\n return new Vector(x * d, y * d);\n }\n }\n\n public class Segment\n {\n private Point start;\n private Point end;\n\n #region Constructors\n\n public Segment()\n : this(new Point(), new Point())\n {\n }\n\n public Segment(Point s, Point e)\n {\n start = s;\n end = e;\n }\n\n public Segment(double x1, double y1, double x2, double y2)\n : this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n #endregion\n\n #region Public Properties\n\n public Point Start\n {\n get { return start; }\n set { start = value; }\n }\n\n public Point End\n {\n get { return end; }\n set { end = value; }\n }\n\n public double x1\n {\n get { return start.x; }\n set { start.x = value; }\n }\n\n public double y1\n {\n get { return start.y; }\n set { start.y = value; }\n }\n\n public double x2\n {\n get { return end.x; }\n set { end.x = value; }\n }\n\n public double y2\n {\n get { return end.y; }\n set { end.y = value; }\n }\n\n public Vector Direction\n {\n get { return End - Start; }\n }\n\n #endregion\n\n #region Public Methods\n\n public Line ToLine()\n {\n return new Line(this);\n }\n\n public bool Intersects(Segment seg, out Point p1, out Point p2)\n {\n p1 = new Point();\n p2 = new Point();\n\n double minx1 = Math.Min(Start.x, End.x);\n double maxx1 = Math.Max(Start.x, End.x);\n double miny1 = Math.Min(Start.y, End.y);\n double maxy1 = Math.Max(Start.y, End.y);\n\n double minx2 = Math.Min(seg.Start.x, seg.End.x);\n double maxx2 = Math.Max(seg.Start.x, seg.End.x);\n double miny2 = Math.Min(seg.Start.y, seg.End.y);\n double maxy2 = Math.Max(seg.Start.y, seg.End.y);\n\n if (minx1 > maxx2 || maxx1 < minx2 || miny1 > maxy2 || maxy1 < miny2)\n return false; // boundary rectangles not intersected\n\n Line this_line = this.ToLine();\n Line seg_line = seg.ToLine();\n\n if (this_line.Parallel(seg_line))\n {\n if (this_line.Equivalent(seg_line))\n {\n p1.x = Math.Max(minx1, minx2);\n p1.y = Math.Max(miny1, miny2);\n p2.x = Math.Min(maxx1, maxx2);\n p2.y = Math.Min(miny1, miny2);\n return true; // intersection by segment\n }\n else\n return false; // parallel\n }\n\n Point pt;\n if (!this_line.Intersects(seg_line, out pt))\n return false;\n\n if (pt.x >= minx1 && pt.x <= maxx1 &&\n pt.y >= miny1 && pt.y <= maxy1 &&\n pt.x >= minx2 && pt.x <= maxx2 &&\n pt.y >= miny2 && pt.y <= maxy2)\n {\n p1.x = pt.x;\n p1.y = pt.y;\n p2.x = pt.x;\n p2.y = pt.y;\n return true; // in one point\n }\n\n return false;\n }\n\n public double Distance(Point p)\n {\n Line line = this.ToLine();\n double[] cc = line.Coeffs;\n double A = cc[0];\n double B = cc[1];\n double C = cc[2];\n\n double d = (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n d = Math.Min(d, p.Distance(Start));\n d = Math.Min(d, p.Distance(End));\n return d;\n }\n\n #endregion\n\n }\n\n public class Line\n {\n #region Private Members\n\n private Point bp;\n private Vector dir;\n\n #endregion\n\n #region Constructors\n\n public Line()\n : this(new Point(), new Vector(1, 0))\n {\n }\n\n public Line(Point p, Vector v)\n {\n bp = p;\n dir = v;\n }\n\n public Line(Point p1, Point p2)\n : this(p1, p2 - p1)\n {\n\n }\n\n public Line(double x1, double y1, double x2, double y2) :\n this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n public Line(Segment s) :\n this(s.Start, s.Direction)\n {\n\n }\n\n #endregion\n\n #region Public Properties\n\n public Point BasePoint { get { return bp; } }\n public Vector Direction { get { return dir; } }\n public Vector NormalVector { get { return new Vector(-dir.y, dir.x); } }\n public double[] Coeffs\n {\n get\n {\n return new double[3] \n {\n dir.y,\n -dir.x, \n dir.x * bp.y - dir.y * bp.x\n };\n }\n }\n\n public double A { get { return dir.y; } }\n public double B { get { return -dir.x; } }\n public double C { get { return dir.x * bp.y - dir.y * bp.x; } }\n\n #endregion\n\n #region Public Methods\n\n public bool Intersects(Line line, out Point pt)\n {\n pt = new Point();\n\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n if (GeometryUtils.Sign(d) == 0)\n return false;\n\n pt.x = -GeometryUtils.Determinant(C, B, line.C, line.B) / d;\n pt.y = -GeometryUtils.Determinant(A, C, line.A, line.C) / d;\n\n return true;\n }\n\n public bool Parallel(Line line)\n {\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n return GeometryUtils.Sign(d) == 0;\n }\n\n public bool Equivalent(Line line)\n {\n double d1 = GeometryUtils.Determinant(A, B, line.A, line.B);\n double d2 = GeometryUtils.Determinant(A, C, line.A, line.C);\n double d3 = GeometryUtils.Determinant(B, C, line.B, line.C);\n\n return GeometryUtils.Sign(d1) == 0 && GeometryUtils.Sign(d2) == 0 && GeometryUtils.Sign(d2) == 0;\n }\n\n public double Distance(Point p)\n {\n return (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n }\n\n #endregion\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a7dd2f0404f2eccca49cd8adb4a483c0", "src_uid": "7539a41268b68238d644795bccaa0c0f", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nclass Program\n{\n class Point\n {\n public double x, y;\n public Point(double x, double y)\n {\n this.x = x;\n this.y = y;\n }\n }\n class Line\n {\n public double a, b, c;\n public Line(Point p1, Point p2)\n {\n a = p2.y - p1.y;\n b = p1.x - p2.x;\n c = a * p1.x + b * p1.y;\n }\n public Line()\n {\n\n }\n \n public Line prep( Point p)\n {\n Line res=new Line();\n res.a = -b;\n res.b = a;\n res.c = res.a * p.x + res.b * p.y;\n return res;\n \n }\n public Point Intersect(Line l)\n {\n Point res = new Point(0,0);\n double d = a * l.b - b * l.a;\n res.x = (l.b * c - b * l.c) / d;\n res.y = (a * l.c - l.a * c) / d;\n return res;\n }\n\n }\n double eps = 1e-9;\n void solve()\n {\n Point p = new Point(nextInt(), nextInt());\n Point v=new Point(nextInt(),nextInt());\n Point[]w=new Point[2];\n \n for (int i = 0; i < 2; i++)\n w[i] = new Point(nextInt(), nextInt());\n Point[] mir = new Point[2];\n for (int i = 0; i < 2; i++)\n mir[i] = new Point(nextInt(), nextInt());\n \n bool ok = false;\n if (good(p, v, w[0], w[1]))\n ok = true;\n else if (sign(cross(mir[0], mir[1],p)) * sign(cross(mir[0], mir[1],v)) ==1)\n {\n Line lm = new Line(mir[0], mir[1]);\n Line pr = lm.prep(p);\n Point inter = lm.Intersect(pr);\n Point other = new Point(inter.x + (inter.x - p.x), inter.y + (inter.y - p.y));\n {\n Line l = new Line(other, v);\n Point x = l.Intersect(lm);\n if (good(x, p, w[0], w[1]) && good(x, v, w[0], w[1]) && on(mir[0],mir[1],x))\n ok = true;\n }\n \n }\n if (ok)\n println(\"YES\");\n else\n println(\"NO\");\n\n }\n\n private bool good(Point p1, Point p2, Point p3, Point p4)\n {\n double d1 = cross(p1, p2, p3);\n double d2 = cross(p1, p2, p4);\n double d3 = cross(p3, p4,p1);\n double d4 = cross(p3, p4, p2);\n int x1 = sign(d1);\n int x2 = sign(d2);\n int x3 = sign(d3);\n int x4 = sign(d4);\n if (x1 * x2 < 0 && x3 * x4 < 0)\n return false;\n if (x1 == 0)\n {\n if (on(p1, p2, p3))\n return false;\n }\n if (x2 == 0)\n {\n if (on(p1, p2, p4))\n return false;\n }\n if (x3 == 0)\n {\n if (on(p3, p4, p1))\n return false;\n }\n if (x4 == 0)\n {\n if (on(p3, p4, p2))\n return false;\n }\n \n return true;\n\n }\n\n private bool on(Point p1, Point p2, Point p3)\n {\n return on(p1.x, p2.x, p3.x) && on(p1.y, p2.y, p3.y);\n }\n\n private bool on(double x, double y, double z)\n {\n return z >= Math.Min(x, y) - eps && z <= Math.Max(x, y) + eps;\n }\n\n private int sign(double d1)\n {\n return Math.Abs(d1) < eps ? 0 : Math.Sign(d1);\n }\n\n private double cross(Point p1, Point p2, Point p3)\n {\n return (p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y);\n }\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 new Program().solve();\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ecbbb7cfb7b3dbf641d0c1344590a7c3", "src_uid": "7539a41268b68238d644795bccaa0c0f", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesApp\n{\n class E\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 static void RInts4(out int p1, out int p2, out int p3, out int p4) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; p4 = a[3]; }\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.E);\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 int xv, yv, xp, yp, xw1, yw1, xw2, yw2, xm1, ym1, xm2, ym2;\n RInts2(out xv, out yv);\n RInts2(out xp, out yp);\n RInts4(out xw1, out yw1, out xw2, out yw2);\n RInts4(out xm1, out ym1, out xm2, out ym2);\n\n Point p = new Point(xp, yp);\n \n Segment view = new Segment(xv, yv, xp, yp);\n Segment wall = new Segment(xw1, yw1, xw2, yw2);\n Segment mirror = new Segment(xm1, ym1, xm2, ym2);\n\n Point rp = p.Reflect(mirror.ToLine());\n\n Segment rview = new Segment(xv, yv, rp.x, rp.y);\n Segment rdview = new Segment(rp.x, rp.y, xp, yp);\n\n Point pt1, pt2;\n\n if (!view.Intersects(wall, out pt1, out pt2) && !view.Intersects(mirror, out pt1, out pt2) ||\n (rview.Intersects(mirror, out pt1, out pt2) && !rview.Intersects(wall, out pt1, out pt2) && !rdview.Intersects(wall, out pt1, out pt2)))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n\n\n public class GeometryUtils\n {\n public const double EPS = 10e-12;\n\n public static double SqrDist(double x1, double y1, double x2, double y2)\n {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n }\n\n public static double Dist(double x1, double x2)\n {\n return Math.Abs(x1 - x2);\n }\n\n public static double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt(SqrDist(x1, y1, x2, y2));\n }\n\n public static double Determinant(\n double a11, double a12,\n double a21, double a22)\n {\n return a11 * a22 - a21 * a12;\n }\n\n\n public static double Determinant(\n double a11, double a12, double a13,\n double a21, double a22, double a23,\n double a31, double a32, double a33\n )\n {\n return a11 * Determinant(a22, a23, a32, a33) - a21 * Determinant(a12, a13, a32, a33) + a31 * Determinant(a12, a13, a22, a23);\n }\n\n public static int Sign(double val)\n {\n if (Math.Abs(val) <= EPS)\n return 0;\n\n if (val > EPS)\n return 1;\n\n return -1;\n }\n\n }\n\n public class Point\n {\n public double x;\n public double y;\n\n #region Constructors\n\n public Point()\n {\n }\n\n public Point(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n #endregion\n\n #region Public Methods\n\n public Vector ToVector()\n {\n return new Vector(x, y);\n }\n\n public int Orientation(Point q, Point r)\n {\n return Orientation(this, q, r);\n }\n\n public double Area(Point q, Point r)\n {\n return Area(this, q, r);\n }\n\n public double SqrDist(Point q)\n {\n return GeometryUtils.SqrDist(x, y, q.x, q.y);\n }\n\n public double Distance()\n {\n return GeometryUtils.Dist(x, y, 0, 0);\n }\n\n public double Distance(Point q)\n {\n return GeometryUtils.Dist(x, y, q.x, q.y);\n }\n\n public double XDist(Point q)\n {\n return GeometryUtils.Dist(x, q.x);\n }\n\n public double YDist(Point q)\n {\n return GeometryUtils.Dist(y, q.y);\n }\n\n public Point Translate(double _x, double _y)\n {\n return new Point(x + _x, y + _y);\n }\n\n public Point Translate(Vector v)\n {\n return new Point(x + v.x, y + v.y);\n }\n\n // \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u0440\u044f\u043c\u0443\u044e\n public Point Project(Line line)\n {\n Line ort = new Line(this, line.NormalVector);\n Point pt;\n line.Intersects(ort, out pt);\n return pt;\n }\n\n public Point Reflect(Line line)\n {\n Point pr = Project(line);\n Vector v = (pr - this).Scale(2);\n return this.Translate(v);\n }\n\n #endregion\n\n #region Static Members\n\n public static Vector operator -(Point p1, Point p2)\n {\n return new Vector(p1.x - p2.x, p1.y - p2.y);\n }\n\n public static int Orientation(Point p, Point q, Point r)\n {\n double det = GeometryUtils.Determinant(p.x, p.y, 1, q.x, q.y, 1, r.x, r.y, 1);\n if (det > 0) return 1;\n if (det < 0) return -1;\n return 0;\n }\n\n public static double Area(Point p, Point q, Point r)\n {\n return GeometryUtils.Determinant(q.x - p.x, q.y - p.y, r.x - p.x, r.y - p.y);\n }\n\n #endregion\n }\n\n public class Vector\n {\n public double x;\n public double y;\n\n public Vector()\n {\n }\n\n public Vector(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n public Vector Translate(double a, double b)\n {\n return new Vector(x + a, y + b);\n }\n\n public Vector Translate(Vector v)\n {\n return new Vector(x + v.x, y + v.y);\n }\n\n public Vector Scale(double d)\n {\n return new Vector(x * d, y * d);\n }\n }\n\n public class Segment\n {\n private Point start;\n private Point end;\n\n #region Constructors\n\n public Segment()\n : this(new Point(), new Point())\n {\n }\n\n public Segment(Point s, Point e)\n {\n start = s;\n end = e;\n }\n\n public Segment(double x1, double y1, double x2, double y2)\n : this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n #endregion\n\n #region Public Properties\n\n public Point Start\n {\n get { return start; }\n set { start = value; }\n }\n\n public Point End\n {\n get { return end; }\n set { end = value; }\n }\n\n public double x1\n {\n get { return start.x; }\n set { start.x = value; }\n }\n\n public double y1\n {\n get { return start.y; }\n set { start.y = value; }\n }\n\n public double x2\n {\n get { return end.x; }\n set { end.x = value; }\n }\n\n public double y2\n {\n get { return end.y; }\n set { end.y = value; }\n }\n\n public Vector Direction\n {\n get { return End - Start; }\n }\n\n #endregion\n\n #region Public Methods\n\n public Line ToLine()\n {\n return new Line(this);\n }\n\n public bool Intersects(Segment seg, out Point p1, out Point p2)\n {\n p1 = new Point();\n p2 = new Point();\n\n double minx1 = Math.Min(Start.x, End.x);\n double maxx1 = Math.Max(Start.x, End.x);\n double miny1 = Math.Min(Start.y, End.y);\n double maxy1 = Math.Max(Start.y, End.y);\n\n double minx2 = Math.Min(seg.Start.x, seg.End.x);\n double maxx2 = Math.Max(seg.Start.x, seg.End.x);\n double miny2 = Math.Min(seg.Start.y, seg.End.y);\n double maxy2 = Math.Max(seg.Start.y, seg.End.y);\n\n if (minx1 > maxx2 || maxx1 < minx2 || miny1 > maxy2 || maxy1 < miny2)\n return false; // boundary rectangles not intersected\n\n Line this_line = this.ToLine();\n Line seg_line = seg.ToLine();\n\n if (this_line.Parallel(seg_line))\n {\n if (this_line.Equivalent(seg_line))\n {\n p1.x = Math.Max(minx1, minx2);\n p1.y = Math.Max(miny1, miny2);\n p2.x = Math.Min(maxx1, maxx2);\n p2.y = Math.Min(miny1, miny2);\n return true; // intersection by segment\n }\n else\n return false; // parallel\n }\n\n Point pt;\n if (!this_line.Intersects(seg_line, out pt))\n return false;\n\n if (pt.x >= minx1 && pt.x <= maxx1 &&\n pt.y >= miny1 && pt.y <= maxy1 &&\n pt.x >= minx2 && pt.x <= maxx2 &&\n pt.y >= miny2 && pt.y <= maxy2)\n {\n p1.x = pt.x;\n p1.y = pt.y;\n p2.x = pt.x;\n p2.y = pt.y;\n return true; // in one point\n }\n\n return false;\n }\n\n public double Distance(Point p)\n {\n Line line = this.ToLine();\n double[] cc = line.Coeffs;\n double A = cc[0];\n double B = cc[1];\n double C = cc[2];\n\n double d = (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n d = Math.Min(d, p.Distance(Start));\n d = Math.Min(d, p.Distance(End));\n return d;\n }\n\n #endregion\n\n }\n\n public class Line\n {\n #region Private Members\n\n private Point bp;\n private Vector dir;\n\n #endregion\n\n #region Constructors\n\n public Line()\n : this(new Point(), new Vector(1, 0))\n {\n }\n\n public Line(Point p, Vector v)\n {\n bp = p;\n dir = v;\n }\n\n public Line(Point p1, Point p2)\n : this(p1, p2 - p1)\n {\n\n }\n\n public Line(double x1, double y1, double x2, double y2) :\n this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n public Line(Segment s) :\n this(s.Start, s.Direction)\n {\n\n }\n\n #endregion\n\n #region Public Properties\n\n public Point BasePoint { get { return bp; } }\n public Vector Direction { get { return dir; } }\n public Vector NormalVector { get { return new Vector(-dir.y, dir.x); } }\n public double[] Coeffs\n {\n get\n {\n return new double[3] \n {\n dir.y,\n -dir.x, \n dir.x * bp.y - dir.y * bp.x\n };\n }\n }\n\n public double A { get { return dir.y; } }\n public double B { get { return -dir.x; } }\n public double C { get { return dir.x * bp.y - dir.y * bp.x; } }\n\n #endregion\n\n #region Public Methods\n\n public bool Intersects(Line line, out Point pt)\n {\n pt = new Point();\n\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n if (GeometryUtils.Sign(d) == 0)\n return false;\n\n pt.x = -GeometryUtils.Determinant(C, B, line.C, line.B) / d;\n pt.y = -GeometryUtils.Determinant(A, C, line.A, line.C) / d;\n\n return true;\n }\n\n public bool Parallel(Line line)\n {\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n return GeometryUtils.Sign(d) == 0;\n }\n\n public bool Equivalent(Line line)\n {\n double d1 = GeometryUtils.Determinant(A, B, line.A, line.B);\n double d2 = GeometryUtils.Determinant(A, C, line.A, line.C);\n double d3 = GeometryUtils.Determinant(B, C, line.B, line.C);\n\n return GeometryUtils.Sign(d1) == 0 && GeometryUtils.Sign(d2) == 0 && GeometryUtils.Sign(d2) == 0;\n }\n\n public double Distance(Point p)\n {\n return (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n }\n\n #endregion\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c1ffea1ce541d59f2a1a1ca7bb6e8c98", "src_uid": "7539a41268b68238d644795bccaa0c0f", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nclass Program\n{\n class Point\n {\n public double x, y;\n public Point(double x, double y)\n {\n this.x = x;\n this.y = y;\n }\n }\n class Line\n {\n public double a, b, c;\n public Line(Point p1, Point p2)\n {\n a = p2.y - p1.y;\n b = p1.x - p2.x;\n c = a * p1.x + b * p1.y;\n }\n public Line()\n {\n\n }\n \n public Line prep( Point p)\n {\n Line res=new Line();\n res.a = -b;\n res.b = a;\n res.c = res.a * p.x + res.b * p.y;\n return res;\n \n }\n public Point Intersect(Line l)\n {\n Point res = new Point(0,0);\n double d = a * l.b - b * l.a;\n res.x = (l.b * c - b * l.c) / d;\n res.y = (a * l.c - l.a * c) / d;\n return res;\n }\n\n }\n double eps = 1e-9;\n void solve()\n {\n int[] ar = new int[3];\n int[] b = new int[3];\n \n Point p = new Point(nextInt(), nextInt());\n Point v=new Point(nextInt(),nextInt());\n Point[]w=new Point[2];\n \n for (int i = 0; i < 2; i++)\n w[i] = new Point(nextInt(), nextInt());\n Point[] mir = new Point[2];\n for (int i = 0; i < 2; i++)\n mir[i] = new Point(nextInt(), nextInt());\n \n bool ok = false;\n if (good(p, v, w[0], w[1]))\n ok = true;\n else if (sign(cross(mir[0], mir[1],p)) * sign(cross(mir[0], mir[1],v)) ==1)\n {\n Line lm = new Line(mir[0], mir[1]);\n Line pr = lm.prep(p);\n Point inter = lm.Intersect(pr);\n Point other = new Point(inter.x + (inter.x - p.x), inter.y + (inter.y - p.y));\n {\n Line l = new Line(other, v);\n Point x = l.Intersect(lm);\n if (good(x, p, w[0], w[1]) && good(x, v, w[0], w[1]) && on(mir[0],mir[1],x))\n ok = true;\n }\n \n }\n if (ok)\n println(\"Yes\");\n else\n println(\"NO\");\n\n }\n\n private bool good(Point p1, Point p2, Point p3, Point p4)\n {\n double d1 = cross(p1, p2, p3);\n double d2 = cross(p1, p2, p4);\n double d3 = cross(p3, p4,p1);\n double d4 = cross(p3, p4, p2);\n int x1 = sign(d1);\n int x2 = sign(d2);\n int x3 = sign(d3);\n int x4 = sign(d4);\n if (x1 * x2 < 0 && x3 * x4 < 0)\n return false;\n if (x1 == 0)\n {\n if (on(p1, p2, p3))\n return false;\n }\n if (x2 == 0)\n {\n if (on(p1, p2, p4))\n return false;\n }\n if (x3 == 0)\n {\n if (on(p3, p4, p1))\n return false;\n }\n if (x4 == 0)\n {\n if (on(p3, p4, p2))\n return false;\n }\n \n return true;\n\n }\n\n private bool on(Point p1, Point p2, Point p3)\n {\n return on(p1.x, p2.x, p3.x) && on(p1.y, p2.y, p3.y);\n }\n\n private bool on(double x, double y, double z)\n {\n return z >= Math.Min(x, y) - eps && z <= Math.Max(x, y) + eps;\n }\n\n private int sign(double d1)\n {\n return Math.Abs(d1) < eps ? 0 : Math.Sign(d1);\n }\n\n private double cross(Point p1, Point p2, Point p3)\n {\n return (p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y);\n }\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 new Program().solve();\n }\n}\n\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aa72b0c3bb6041f580db272bc7272131", "src_uid": "7539a41268b68238d644795bccaa0c0f", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesApp\n{\n class E\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 static void RInts4(out int p1, out int p2, out int p3, out int p4) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; p4 = a[3]; }\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.E);\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 int xv, yv, xp, yp, xw1, yw1, xw2, yw2, xm1, ym1, xm2, ym2;\n RInts2(out xv, out yv);\n RInts2(out xp, out yp);\n RInts4(out xw1, out yw1, out xw2, out yw2);\n RInts4(out xm1, out ym1, out xm2, out ym2);\n\n Point p = new Point(xp, yp);\n \n Segment view = new Segment(xv, yv, xp, yp);\n Segment wall = new Segment(xw1, yw1, xw2, yw2);\n Segment mirror = new Segment(xm1, ym1, xm2, ym2);\n\n Point rp = p.Reflect(mirror.ToLine());\n\n Segment rview = new Segment(xv, yv, rp.x, rp.y);\n\n Point pt1, pt2;\n\n if (!view.Intersects(wall, out pt1, out pt2) ||\n (rview.Intersects(mirror, out pt1, out pt2) && !rview.Intersects(wall, out pt1, out pt2)))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n\n\n public class GeometryUtils\n {\n public const double EPS = 10e-8;\n\n public static double SqrDist(double x1, double y1, double x2, double y2)\n {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n }\n\n public static double Dist(double x1, double x2)\n {\n return Math.Abs(x1 - x2);\n }\n\n public static double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt(SqrDist(x1, y1, x2, y2));\n }\n\n public static double Determinant(\n double a11, double a12,\n double a21, double a22)\n {\n return a11 * a22 - a21 * a12;\n }\n\n\n public static double Determinant(\n double a11, double a12, double a13,\n double a21, double a22, double a23,\n double a31, double a32, double a33\n )\n {\n return a11 * Determinant(a22, a23, a32, a33) - a21 * Determinant(a12, a13, a32, a33) + a31 * Determinant(a12, a13, a22, a23);\n }\n\n public static int Sign(double val)\n {\n if (Math.Abs(val) <= EPS)\n return 0;\n\n if (val > EPS)\n return 1;\n\n return -1;\n }\n\n }\n\n public class Point\n {\n public double x;\n public double y;\n\n #region Constructors\n\n public Point()\n {\n }\n\n public Point(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n #endregion\n\n #region Public Methods\n\n public Vector ToVector()\n {\n return new Vector(x, y);\n }\n\n public int Orientation(Point q, Point r)\n {\n return Orientation(this, q, r);\n }\n\n public double Area(Point q, Point r)\n {\n return Area(this, q, r);\n }\n\n public double SqrDist(Point q)\n {\n return GeometryUtils.SqrDist(x, y, q.x, q.y);\n }\n\n public double Distance()\n {\n return GeometryUtils.Dist(x, y, 0, 0);\n }\n\n public double Distance(Point q)\n {\n return GeometryUtils.Dist(x, y, q.x, q.y);\n }\n\n public double XDist(Point q)\n {\n return GeometryUtils.Dist(x, q.x);\n }\n\n public double YDist(Point q)\n {\n return GeometryUtils.Dist(y, q.y);\n }\n\n public Point Translate(double _x, double _y)\n {\n return new Point(x + _x, y + _y);\n }\n\n public Point Translate(Vector v)\n {\n return new Point(x + v.x, y + v.y);\n }\n\n // \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u0440\u044f\u043c\u0443\u044e\n public Point Project(Line line)\n {\n Line ort = new Line(this, line.NormalVector);\n Point pt;\n line.Intersects(ort, out pt);\n return pt;\n }\n\n public Point Reflect(Line line)\n {\n Point pr = Project(line);\n Vector v = (pr - this).Scale(2);\n return this.Translate(v);\n }\n\n #endregion\n\n #region Static Members\n\n public static Vector operator -(Point p1, Point p2)\n {\n return new Vector(p1.x - p2.x, p1.y - p2.y);\n }\n\n public static int Orientation(Point p, Point q, Point r)\n {\n double det = GeometryUtils.Determinant(p.x, p.y, 1, q.x, q.y, 1, r.x, r.y, 1);\n if (det > 0) return 1;\n if (det < 0) return -1;\n return 0;\n }\n\n public static double Area(Point p, Point q, Point r)\n {\n return GeometryUtils.Determinant(q.x - p.x, q.y - p.y, r.x - p.x, r.y - p.y);\n }\n\n #endregion\n }\n\n public class Vector\n {\n public double x;\n public double y;\n\n public Vector()\n {\n }\n\n public Vector(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n public Vector Translate(double a, double b)\n {\n return new Vector(x + a, y + b);\n }\n\n public Vector Translate(Vector v)\n {\n return new Vector(x + v.x, y + v.y);\n }\n\n public Vector Scale(double d)\n {\n return new Vector(x * d, y * d);\n }\n }\n\n public class Segment\n {\n private Point start;\n private Point end;\n\n #region Constructors\n\n public Segment()\n : this(new Point(), new Point())\n {\n }\n\n public Segment(Point s, Point e)\n {\n start = s;\n end = e;\n }\n\n public Segment(double x1, double y1, double x2, double y2)\n : this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n #endregion\n\n #region Public Properties\n\n public Point Start\n {\n get { return start; }\n set { start = value; }\n }\n\n public Point End\n {\n get { return end; }\n set { end = value; }\n }\n\n public double x1\n {\n get { return start.x; }\n set { start.x = value; }\n }\n\n public double y1\n {\n get { return start.y; }\n set { start.y = value; }\n }\n\n public double x2\n {\n get { return end.x; }\n set { end.x = value; }\n }\n\n public double y2\n {\n get { return end.y; }\n set { end.y = value; }\n }\n\n public Vector Direction\n {\n get { return End - Start; }\n }\n\n #endregion\n\n #region Public Methods\n\n public Line ToLine()\n {\n return new Line(this);\n }\n\n public bool Intersects(Segment seg, out Point p1, out Point p2)\n {\n p1 = new Point();\n p2 = new Point();\n\n double minx1 = Math.Min(Start.x, End.x);\n double maxx1 = Math.Max(Start.x, End.x);\n double miny1 = Math.Min(Start.y, End.y);\n double maxy1 = Math.Max(Start.y, End.y);\n\n double minx2 = Math.Min(seg.Start.x, seg.End.x);\n double maxx2 = Math.Max(seg.Start.x, seg.End.x);\n double miny2 = Math.Min(seg.Start.y, seg.End.y);\n double maxy2 = Math.Max(seg.Start.y, seg.End.y);\n\n if (minx1 > maxx2 || maxx1 < minx2 || miny1 > maxy2 || maxy1 < miny2)\n return false; // boundary rectangles not intersected\n\n Line this_line = this.ToLine();\n Line seg_line = seg.ToLine();\n\n if (this_line.Parallel(seg_line))\n {\n if (this_line.Equivalent(seg_line))\n {\n p1.x = Math.Max(minx1, minx2);\n p1.y = Math.Max(miny1, miny2);\n p2.x = Math.Min(maxx1, maxx2);\n p2.y = Math.Min(miny1, miny2);\n return true; // intersection by segment\n }\n else\n return false; // parallel\n }\n\n Point pt;\n if (!this_line.Intersects(seg_line, out pt))\n return false;\n\n if (pt.x >= minx1 && pt.x <= maxx1 &&\n pt.y >= miny1 && pt.y <= maxy1 &&\n pt.x >= minx2 && pt.x <= maxx2 &&\n pt.y >= miny2 && pt.y <= maxy2)\n {\n p1.x = pt.x;\n p1.y = pt.y;\n p2.x = pt.x;\n p2.y = pt.y;\n return true; // in one point\n }\n\n return false;\n }\n\n public double Distance(Point p)\n {\n Line line = this.ToLine();\n double[] cc = line.Coeffs;\n double A = cc[0];\n double B = cc[1];\n double C = cc[2];\n\n double d = (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n d = Math.Min(d, p.Distance(Start));\n d = Math.Min(d, p.Distance(End));\n return d;\n }\n\n #endregion\n\n }\n\n public class Line\n {\n #region Private Members\n\n private Point bp;\n private Vector dir;\n\n #endregion\n\n #region Constructors\n\n public Line()\n : this(new Point(), new Vector(1, 0))\n {\n }\n\n public Line(Point p, Vector v)\n {\n bp = p;\n dir = v;\n }\n\n public Line(Point p1, Point p2)\n : this(p1, p2 - p1)\n {\n\n }\n\n public Line(double x1, double y1, double x2, double y2) :\n this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n public Line(Segment s) :\n this(s.Start, s.Direction)\n {\n\n }\n\n #endregion\n\n #region Public Properties\n\n public Point BasePoint { get { return bp; } }\n public Vector Direction { get { return dir; } }\n public Vector NormalVector { get { return new Vector(-dir.y, dir.x); } }\n public double[] Coeffs\n {\n get\n {\n return new double[3] \n {\n dir.y,\n -dir.x, \n dir.x * bp.y - dir.y * bp.x\n };\n }\n }\n\n public double A { get { return dir.y; } }\n public double B { get { return -dir.x; } }\n public double C { get { return dir.x * bp.y - dir.y * bp.x; } }\n\n #endregion\n\n #region Public Methods\n\n public bool Intersects(Line line, out Point pt)\n {\n pt = new Point();\n\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n if (GeometryUtils.Sign(d) == 0)\n return false;\n\n pt.x = -GeometryUtils.Determinant(C, B, line.C, line.B) / d;\n pt.y = -GeometryUtils.Determinant(A, C, line.A, line.C) / d;\n\n return true;\n }\n\n public bool Parallel(Line line)\n {\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n return GeometryUtils.Sign(d) == 0;\n }\n\n public bool Equivalent(Line line)\n {\n double d1 = GeometryUtils.Determinant(A, B, line.A, line.B);\n double d2 = GeometryUtils.Determinant(A, C, line.A, line.C);\n double d3 = GeometryUtils.Determinant(B, C, line.B, line.C);\n\n return GeometryUtils.Sign(d1) == 0 && GeometryUtils.Sign(d2) == 0 && GeometryUtils.Sign(d2) == 0;\n }\n\n public double Distance(Point p)\n {\n return (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n }\n\n #endregion\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b2f9c97120c8d4f032aafed382a4bb31", "src_uid": "7539a41268b68238d644795bccaa0c0f", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesApp\n{\n class E\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 static void RInts4(out int p1, out int p2, out int p3, out int p4) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; p4 = a[3]; }\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.E);\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 int xv, yv, xp, yp, xw1, yw1, xw2, yw2, xm1, ym1, xm2, ym2;\n RInts2(out xv, out yv);\n RInts2(out xp, out yp);\n RInts4(out xw1, out yw1, out xw2, out yw2);\n RInts4(out xm1, out ym1, out xm2, out ym2);\n\n Point p = new Point(xp, yp);\n \n Segment view = new Segment(xv, yv, xp, yp);\n Segment wall = new Segment(xw1, yw1, xw2, yw2);\n Segment mirror = new Segment(xm1, ym1, xm2, ym2);\n\n Point rp = p.Reflect(mirror.ToLine());\n\n Segment rview = new Segment(xv, yv, rp.x, rp.y);\n\n Point pt1, pt2;\n\n if (!view.Intersects(wall, out pt1, out pt2) && !view.Intersects(mirror, out pt1, out pt2) ||\n (rview.Intersects(mirror, out pt1, out pt2) && !rview.Intersects(wall, out pt1, out pt2)))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n\n\n public class GeometryUtils\n {\n public const double EPS = 10e-12;\n\n public static double SqrDist(double x1, double y1, double x2, double y2)\n {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n }\n\n public static double Dist(double x1, double x2)\n {\n return Math.Abs(x1 - x2);\n }\n\n public static double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt(SqrDist(x1, y1, x2, y2));\n }\n\n public static double Determinant(\n double a11, double a12,\n double a21, double a22)\n {\n return a11 * a22 - a21 * a12;\n }\n\n\n public static double Determinant(\n double a11, double a12, double a13,\n double a21, double a22, double a23,\n double a31, double a32, double a33\n )\n {\n return a11 * Determinant(a22, a23, a32, a33) - a21 * Determinant(a12, a13, a32, a33) + a31 * Determinant(a12, a13, a22, a23);\n }\n\n public static int Sign(double val)\n {\n if (Math.Abs(val) <= EPS)\n return 0;\n\n if (val > EPS)\n return 1;\n\n return -1;\n }\n\n }\n\n public class Point\n {\n public double x;\n public double y;\n\n #region Constructors\n\n public Point()\n {\n }\n\n public Point(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n #endregion\n\n #region Public Methods\n\n public Vector ToVector()\n {\n return new Vector(x, y);\n }\n\n public int Orientation(Point q, Point r)\n {\n return Orientation(this, q, r);\n }\n\n public double Area(Point q, Point r)\n {\n return Area(this, q, r);\n }\n\n public double SqrDist(Point q)\n {\n return GeometryUtils.SqrDist(x, y, q.x, q.y);\n }\n\n public double Distance()\n {\n return GeometryUtils.Dist(x, y, 0, 0);\n }\n\n public double Distance(Point q)\n {\n return GeometryUtils.Dist(x, y, q.x, q.y);\n }\n\n public double XDist(Point q)\n {\n return GeometryUtils.Dist(x, q.x);\n }\n\n public double YDist(Point q)\n {\n return GeometryUtils.Dist(y, q.y);\n }\n\n public Point Translate(double _x, double _y)\n {\n return new Point(x + _x, y + _y);\n }\n\n public Point Translate(Vector v)\n {\n return new Point(x + v.x, y + v.y);\n }\n\n // \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u0440\u044f\u043c\u0443\u044e\n public Point Project(Line line)\n {\n Line ort = new Line(this, line.NormalVector);\n Point pt;\n line.Intersects(ort, out pt);\n return pt;\n }\n\n public Point Reflect(Line line)\n {\n Point pr = Project(line);\n Vector v = (pr - this).Scale(2);\n return this.Translate(v);\n }\n\n #endregion\n\n #region Static Members\n\n public static Vector operator -(Point p1, Point p2)\n {\n return new Vector(p1.x - p2.x, p1.y - p2.y);\n }\n\n public static int Orientation(Point p, Point q, Point r)\n {\n double det = GeometryUtils.Determinant(p.x, p.y, 1, q.x, q.y, 1, r.x, r.y, 1);\n if (det > 0) return 1;\n if (det < 0) return -1;\n return 0;\n }\n\n public static double Area(Point p, Point q, Point r)\n {\n return GeometryUtils.Determinant(q.x - p.x, q.y - p.y, r.x - p.x, r.y - p.y);\n }\n\n #endregion\n }\n\n public class Vector\n {\n public double x;\n public double y;\n\n public Vector()\n {\n }\n\n public Vector(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n public Vector Translate(double a, double b)\n {\n return new Vector(x + a, y + b);\n }\n\n public Vector Translate(Vector v)\n {\n return new Vector(x + v.x, y + v.y);\n }\n\n public Vector Scale(double d)\n {\n return new Vector(x * d, y * d);\n }\n }\n\n public class Segment\n {\n private Point start;\n private Point end;\n\n #region Constructors\n\n public Segment()\n : this(new Point(), new Point())\n {\n }\n\n public Segment(Point s, Point e)\n {\n start = s;\n end = e;\n }\n\n public Segment(double x1, double y1, double x2, double y2)\n : this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n #endregion\n\n #region Public Properties\n\n public Point Start\n {\n get { return start; }\n set { start = value; }\n }\n\n public Point End\n {\n get { return end; }\n set { end = value; }\n }\n\n public double x1\n {\n get { return start.x; }\n set { start.x = value; }\n }\n\n public double y1\n {\n get { return start.y; }\n set { start.y = value; }\n }\n\n public double x2\n {\n get { return end.x; }\n set { end.x = value; }\n }\n\n public double y2\n {\n get { return end.y; }\n set { end.y = value; }\n }\n\n public Vector Direction\n {\n get { return End - Start; }\n }\n\n #endregion\n\n #region Public Methods\n\n public Line ToLine()\n {\n return new Line(this);\n }\n\n public bool Intersects(Segment seg, out Point p1, out Point p2)\n {\n p1 = new Point();\n p2 = new Point();\n\n double minx1 = Math.Min(Start.x, End.x);\n double maxx1 = Math.Max(Start.x, End.x);\n double miny1 = Math.Min(Start.y, End.y);\n double maxy1 = Math.Max(Start.y, End.y);\n\n double minx2 = Math.Min(seg.Start.x, seg.End.x);\n double maxx2 = Math.Max(seg.Start.x, seg.End.x);\n double miny2 = Math.Min(seg.Start.y, seg.End.y);\n double maxy2 = Math.Max(seg.Start.y, seg.End.y);\n\n if (minx1 > maxx2 || maxx1 < minx2 || miny1 > maxy2 || maxy1 < miny2)\n return false; // boundary rectangles not intersected\n\n Line this_line = this.ToLine();\n Line seg_line = seg.ToLine();\n\n if (this_line.Parallel(seg_line))\n {\n if (this_line.Equivalent(seg_line))\n {\n p1.x = Math.Max(minx1, minx2);\n p1.y = Math.Max(miny1, miny2);\n p2.x = Math.Min(maxx1, maxx2);\n p2.y = Math.Min(miny1, miny2);\n return true; // intersection by segment\n }\n else\n return false; // parallel\n }\n\n Point pt;\n if (!this_line.Intersects(seg_line, out pt))\n return false;\n\n if (pt.x >= minx1 && pt.x <= maxx1 &&\n pt.y >= miny1 && pt.y <= maxy1 &&\n pt.x >= minx2 && pt.x <= maxx2 &&\n pt.y >= miny2 && pt.y <= maxy2)\n {\n p1.x = pt.x;\n p1.y = pt.y;\n p2.x = pt.x;\n p2.y = pt.y;\n return true; // in one point\n }\n\n return false;\n }\n\n public double Distance(Point p)\n {\n Line line = this.ToLine();\n double[] cc = line.Coeffs;\n double A = cc[0];\n double B = cc[1];\n double C = cc[2];\n\n double d = (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n d = Math.Min(d, p.Distance(Start));\n d = Math.Min(d, p.Distance(End));\n return d;\n }\n\n #endregion\n\n }\n\n public class Line\n {\n #region Private Members\n\n private Point bp;\n private Vector dir;\n\n #endregion\n\n #region Constructors\n\n public Line()\n : this(new Point(), new Vector(1, 0))\n {\n }\n\n public Line(Point p, Vector v)\n {\n bp = p;\n dir = v;\n }\n\n public Line(Point p1, Point p2)\n : this(p1, p2 - p1)\n {\n\n }\n\n public Line(double x1, double y1, double x2, double y2) :\n this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n public Line(Segment s) :\n this(s.Start, s.Direction)\n {\n\n }\n\n #endregion\n\n #region Public Properties\n\n public Point BasePoint { get { return bp; } }\n public Vector Direction { get { return dir; } }\n public Vector NormalVector { get { return new Vector(-dir.y, dir.x); } }\n public double[] Coeffs\n {\n get\n {\n return new double[3] \n {\n dir.y,\n -dir.x, \n dir.x * bp.y - dir.y * bp.x\n };\n }\n }\n\n public double A { get { return dir.y; } }\n public double B { get { return -dir.x; } }\n public double C { get { return dir.x * bp.y - dir.y * bp.x; } }\n\n #endregion\n\n #region Public Methods\n\n public bool Intersects(Line line, out Point pt)\n {\n pt = new Point();\n\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n if (GeometryUtils.Sign(d) == 0)\n return false;\n\n pt.x = -GeometryUtils.Determinant(C, B, line.C, line.B) / d;\n pt.y = -GeometryUtils.Determinant(A, C, line.A, line.C) / d;\n\n return true;\n }\n\n public bool Parallel(Line line)\n {\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n return GeometryUtils.Sign(d) == 0;\n }\n\n public bool Equivalent(Line line)\n {\n double d1 = GeometryUtils.Determinant(A, B, line.A, line.B);\n double d2 = GeometryUtils.Determinant(A, C, line.A, line.C);\n double d3 = GeometryUtils.Determinant(B, C, line.B, line.C);\n\n return GeometryUtils.Sign(d1) == 0 && GeometryUtils.Sign(d2) == 0 && GeometryUtils.Sign(d2) == 0;\n }\n\n public double Distance(Point p)\n {\n return (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n }\n\n #endregion\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8a4949e3de2d6f1c7a9f4f5838848643", "src_uid": "7539a41268b68238d644795bccaa0c0f", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nclass Program\n{\n class Point\n {\n public double x, y;\n public Point(double x, double y)\n {\n this.x = x;\n this.y = y;\n }\n }\n class Line\n {\n public double a, b, c;\n public Line(Point p1, Point p2)\n {\n a = p2.y - p1.y;\n b = p1.x - p2.x;\n c = a * p1.x + b * p1.y;\n }\n public Line()\n {\n\n }\n \n public Line prep( Point p)\n {\n Line res=new Line();\n res.a = -b;\n res.b = a;\n res.c = res.a * p.x + res.b * p.y;\n return res;\n \n }\n public Point Intersect(Line l)\n {\n Point res = new Point(0,0);\n double d = a * l.b - b * l.a;\n res.x = (l.b * c - b * l.c) / d;\n res.y = (a * l.c - l.a * c) / d;\n return res;\n }\n\n }\n double eps = 1e-9;\n void solve()\n {\n Point p = new Point(nextInt(), nextInt());\n Point v=new Point(nextInt(),nextInt());\n Point[]w=new Point[2];\n \n for (int i = 0; i < 2; i++)\n w[i] = new Point(nextInt(), nextInt());\n Point[] mir = new Point[2];\n for (int i = 0; i < 2; i++)\n mir[i] = new Point(nextInt(), nextInt());\n \n bool ok = false;\n if (good(p, v, w[0], w[1]) && (good(p,v,mir[0],mir[1]) || sign(cross(mir[0],mir[1],p))==0))\n {\n ok = true;\n }\n else if (sign(cross(mir[0], mir[1], p)) * sign(cross(mir[0], mir[1], v)) == 1)\n {\n Line lm = new Line(mir[0], mir[1]);\n Line pr = lm.prep(p);\n Point inter = lm.Intersect(pr);\n Point other = new Point(inter.x + (inter.x - p.x), inter.y + (inter.y - p.y));\n {\n Line l = new Line(other, v);\n Point x = l.Intersect(lm);\n if (good(x, p, w[0], w[1]) && good(x, v, w[0], w[1]) && on(mir[0], mir[1], x))\n ok = true;\n }\n\n }\n if (ok)\n println(\"YES\");\n else\n println(\"NO\");\n\n }\n\n private bool good(Point p1, Point p2, Point p3, Point p4)\n {\n double d1 = cross(p1, p2, p3);\n double d2 = cross(p1, p2, p4);\n double d3 = cross(p3, p4,p1);\n double d4 = cross(p3, p4, p2);\n int x1 = sign(d1);\n int x2 = sign(d2);\n int x3 = sign(d3);\n int x4 = sign(d4);\n if (x1 * x2 < 0 && x3 * x4 < 0)\n return false;\n if (x1 == 0)\n {\n if (on(p1, p2, p3))\n return false;\n }\n if (x2 == 0)\n {\n if (on(p1, p2, p4))\n return false;\n }\n if (x3 == 0)\n {\n if (on(p3, p4, p1))\n return false;\n }\n if (x4 == 0)\n {\n if (on(p3, p4, p2))\n return false;\n }\n \n return true;\n\n }\n\n private bool on(Point p1, Point p2, Point p3)\n {\n return on(p1.x, p2.x, p3.x) && on(p1.y, p2.y, p3.y);\n }\n\n private bool on(double x, double y, double z)\n {\n return z >= Math.Min(x, y) - eps && z <= Math.Max(x, y) + eps;\n }\n\n private int sign(double d1)\n {\n return Math.Abs(d1) < eps ? 0 : Math.Sign(d1);\n }\n\n private double cross(Point p1, Point p2, Point p3)\n {\n return (p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y);\n }\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 new Program().solve();\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "26d425300db4b3d22c6be5537d1d2cf9", "src_uid": "7539a41268b68238d644795bccaa0c0f", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesApp\n{\n class E\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 static void RInts4(out int p1, out int p2, out int p3, out int p4) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; p4 = a[3]; }\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.E);\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 int xv, yv, xp, yp, xw1, yw1, xw2, yw2, xm1, ym1, xm2, ym2;\n RInts2(out xv, out yv);\n RInts2(out xp, out yp);\n RInts4(out xw1, out yw1, out xw2, out yw2);\n RInts4(out xm1, out ym1, out xm2, out ym2);\n\n Point v = new Point(xv, yv);\n Point p = new Point(xp, yp);\n \n Segment view = new Segment(xv, yv, xp, yp);\n Segment wall = new Segment(xw1, yw1, xw2, yw2);\n Segment mirror = new Segment(xm1, ym1, xm2, ym2);\n\n Point rp = p.Reflect(mirror.ToLine());\n\n Segment rview = new Segment(xv, yv, rp.x, rp.y);\n Segment rdview = new Segment(rp.x, rp.y, xp, yp);\n\n Point pt1, pt2;\n\n if (!view.Intersects(wall, out pt1, out pt2) && !view.Intersects(mirror, out pt1, out pt2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n\n Point rpm1, rpm2;\n if (rview.Intersects(mirror, out rpm1, out rpm2))\n {\n Segment s1 = new Segment(v, rpm1);\n Segment s2 = new Segment(rpm1, p);\n if (!s1.Intersects(wall, out pt1, out pt2) && !s2.Intersects(wall, out pt1, out pt2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n\n\n public class GeometryUtils\n {\n public const double EPS = 10e-12;\n\n public static double SqrDist(double x1, double y1, double x2, double y2)\n {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n }\n\n public static double Dist(double x1, double x2)\n {\n return Math.Abs(x1 - x2);\n }\n\n public static double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt(SqrDist(x1, y1, x2, y2));\n }\n\n public static double Determinant(\n double a11, double a12,\n double a21, double a22)\n {\n return a11 * a22 - a21 * a12;\n }\n\n\n public static double Determinant(\n double a11, double a12, double a13,\n double a21, double a22, double a23,\n double a31, double a32, double a33\n )\n {\n return a11 * Determinant(a22, a23, a32, a33) - a21 * Determinant(a12, a13, a32, a33) + a31 * Determinant(a12, a13, a22, a23);\n }\n\n public static int Sign(double val)\n {\n if (Math.Abs(val) <= EPS)\n return 0;\n\n if (val > EPS)\n return 1;\n\n return -1;\n }\n\n }\n\n public class Point\n {\n public double x;\n public double y;\n\n #region Constructors\n\n public Point()\n {\n }\n\n public Point(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n #endregion\n\n #region Public Methods\n\n public Vector ToVector()\n {\n return new Vector(x, y);\n }\n\n public int Orientation(Point q, Point r)\n {\n return Orientation(this, q, r);\n }\n\n public double Area(Point q, Point r)\n {\n return Area(this, q, r);\n }\n\n public double SqrDist(Point q)\n {\n return GeometryUtils.SqrDist(x, y, q.x, q.y);\n }\n\n public double Distance()\n {\n return GeometryUtils.Dist(x, y, 0, 0);\n }\n\n public double Distance(Point q)\n {\n return GeometryUtils.Dist(x, y, q.x, q.y);\n }\n\n public double XDist(Point q)\n {\n return GeometryUtils.Dist(x, q.x);\n }\n\n public double YDist(Point q)\n {\n return GeometryUtils.Dist(y, q.y);\n }\n\n public Point Translate(double _x, double _y)\n {\n return new Point(x + _x, y + _y);\n }\n\n public Point Translate(Vector v)\n {\n return new Point(x + v.x, y + v.y);\n }\n\n // \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u0440\u044f\u043c\u0443\u044e\n public Point Project(Line line)\n {\n Line ort = new Line(this, line.NormalVector);\n Point pt;\n line.Intersects(ort, out pt);\n return pt;\n }\n\n public Point Reflect(Line line)\n {\n Point pr = Project(line);\n Vector v = (pr - this).Scale(2);\n return this.Translate(v);\n }\n\n #endregion\n\n #region Static Members\n\n public static Vector operator -(Point p1, Point p2)\n {\n return new Vector(p1.x - p2.x, p1.y - p2.y);\n }\n\n public static int Orientation(Point p, Point q, Point r)\n {\n double det = GeometryUtils.Determinant(p.x, p.y, 1, q.x, q.y, 1, r.x, r.y, 1);\n if (det > 0) return 1;\n if (det < 0) return -1;\n return 0;\n }\n\n public static double Area(Point p, Point q, Point r)\n {\n return GeometryUtils.Determinant(q.x - p.x, q.y - p.y, r.x - p.x, r.y - p.y);\n }\n\n #endregion\n }\n\n public class Vector\n {\n public double x;\n public double y;\n\n public Vector()\n {\n }\n\n public Vector(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n public Vector Translate(double a, double b)\n {\n return new Vector(x + a, y + b);\n }\n\n public Vector Translate(Vector v)\n {\n return new Vector(x + v.x, y + v.y);\n }\n\n public Vector Scale(double d)\n {\n return new Vector(x * d, y * d);\n }\n }\n\n public class Segment\n {\n private Point start;\n private Point end;\n\n #region Constructors\n\n public Segment()\n : this(new Point(), new Point())\n {\n }\n\n public Segment(Point s, Point e)\n {\n start = s;\n end = e;\n }\n\n public Segment(double x1, double y1, double x2, double y2)\n : this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n #endregion\n\n #region Public Properties\n\n public Point Start\n {\n get { return start; }\n set { start = value; }\n }\n\n public Point End\n {\n get { return end; }\n set { end = value; }\n }\n\n public double x1\n {\n get { return start.x; }\n set { start.x = value; }\n }\n\n public double y1\n {\n get { return start.y; }\n set { start.y = value; }\n }\n\n public double x2\n {\n get { return end.x; }\n set { end.x = value; }\n }\n\n public double y2\n {\n get { return end.y; }\n set { end.y = value; }\n }\n\n public Vector Direction\n {\n get { return End - Start; }\n }\n\n #endregion\n\n #region Public Methods\n\n public Line ToLine()\n {\n return new Line(this);\n }\n\n public bool Intersects(Segment seg, out Point p1, out Point p2)\n {\n p1 = new Point();\n p2 = new Point();\n\n double minx1 = Math.Min(Start.x, End.x);\n double maxx1 = Math.Max(Start.x, End.x);\n double miny1 = Math.Min(Start.y, End.y);\n double maxy1 = Math.Max(Start.y, End.y);\n\n double minx2 = Math.Min(seg.Start.x, seg.End.x);\n double maxx2 = Math.Max(seg.Start.x, seg.End.x);\n double miny2 = Math.Min(seg.Start.y, seg.End.y);\n double maxy2 = Math.Max(seg.Start.y, seg.End.y);\n\n if (minx1 > maxx2 || maxx1 < minx2 || miny1 > maxy2 || maxy1 < miny2)\n return false; // boundary rectangles not intersected\n\n Line this_line = this.ToLine();\n Line seg_line = seg.ToLine();\n\n if (this_line.Parallel(seg_line))\n {\n if (this_line.Equivalent(seg_line))\n {\n p1.x = Math.Max(minx1, minx2);\n p1.y = Math.Max(miny1, miny2);\n p2.x = Math.Min(maxx1, maxx2);\n p2.y = Math.Min(miny1, miny2);\n return true; // intersection by segment\n }\n else\n return false; // parallel\n }\n\n Point pt;\n if (!this_line.Intersects(seg_line, out pt))\n return false;\n\n if (pt.x >= minx1 && pt.x <= maxx1 &&\n pt.y >= miny1 && pt.y <= maxy1 &&\n pt.x >= minx2 && pt.x <= maxx2 &&\n pt.y >= miny2 && pt.y <= maxy2)\n {\n p1.x = pt.x;\n p1.y = pt.y;\n p2.x = pt.x;\n p2.y = pt.y;\n return true; // in one point\n }\n\n return false;\n }\n\n public double Distance(Point p)\n {\n Line line = this.ToLine();\n double[] cc = line.Coeffs;\n double A = cc[0];\n double B = cc[1];\n double C = cc[2];\n\n double d = (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n d = Math.Min(d, p.Distance(Start));\n d = Math.Min(d, p.Distance(End));\n return d;\n }\n\n #endregion\n\n }\n\n public class Line\n {\n #region Private Members\n\n private Point bp;\n private Vector dir;\n\n #endregion\n\n #region Constructors\n\n public Line()\n : this(new Point(), new Vector(1, 0))\n {\n }\n\n public Line(Point p, Vector v)\n {\n bp = p;\n dir = v;\n }\n\n public Line(Point p1, Point p2)\n : this(p1, p2 - p1)\n {\n\n }\n\n public Line(double x1, double y1, double x2, double y2) :\n this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n public Line(Segment s) :\n this(s.Start, s.Direction)\n {\n\n }\n\n #endregion\n\n #region Public Properties\n\n public Point BasePoint { get { return bp; } }\n public Vector Direction { get { return dir; } }\n public Vector NormalVector { get { return new Vector(-dir.y, dir.x); } }\n public double[] Coeffs\n {\n get\n {\n return new double[3] \n {\n dir.y,\n -dir.x, \n dir.x * bp.y - dir.y * bp.x\n };\n }\n }\n\n public double A { get { return dir.y; } }\n public double B { get { return -dir.x; } }\n public double C { get { return dir.x * bp.y - dir.y * bp.x; } }\n\n #endregion\n\n #region Public Methods\n\n public bool Intersects(Line line, out Point pt)\n {\n pt = new Point();\n\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n if (GeometryUtils.Sign(d) == 0)\n return false;\n\n pt.x = -GeometryUtils.Determinant(C, B, line.C, line.B) / d;\n pt.y = -GeometryUtils.Determinant(A, C, line.A, line.C) / d;\n\n return true;\n }\n\n public bool Parallel(Line line)\n {\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n return GeometryUtils.Sign(d) == 0;\n }\n\n public bool Equivalent(Line line)\n {\n double d1 = GeometryUtils.Determinant(A, B, line.A, line.B);\n double d2 = GeometryUtils.Determinant(A, C, line.A, line.C);\n double d3 = GeometryUtils.Determinant(B, C, line.B, line.C);\n\n return GeometryUtils.Sign(d1) == 0 && GeometryUtils.Sign(d2) == 0 && GeometryUtils.Sign(d2) == 0;\n }\n\n public double Distance(Point p)\n {\n return (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n }\n\n #endregion\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "93d3e1fb5e5d0bdf7099c415875b1c24", "src_uid": "7539a41268b68238d644795bccaa0c0f", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesApp\n{\n class E\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 static void RInts4(out int p1, out int p2, out int p3, out int p4) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; p4 = a[3]; }\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.E);\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 int xv, yv, xp, yp, xw1, yw1, xw2, yw2, xm1, ym1, xm2, ym2;\n RInts2(out xv, out yv);\n RInts2(out xp, out yp);\n RInts4(out xw1, out yw1, out xw2, out yw2);\n RInts4(out xm1, out ym1, out xm2, out ym2);\n\n Point v = new Point(xv, yv);\n Point p = new Point(xp, yp);\n \n Segment view = new Segment(xv, yv, xp, yp);\n Segment wall = new Segment(xw1, yw1, xw2, yw2);\n Segment mirror = new Segment(xm1, ym1, xm2, ym2);\n\n Point rp = p.Reflect(mirror.ToLine());\n\n Segment rview = new Segment(xv, yv, rp.x, rp.y);\n Segment rdview = new Segment(rp.x, rp.y, xp, yp);\n\n Point pt1, pt2;\n\n if (!view.Intersects(wall, out pt1, out pt2) && !view.Intersects(mirror, out pt1, out pt2))\n {\n Console.WriteLine(\"YES\");\n }\n\n\n Point rpm1, rpm2;\n if (rview.Intersects(mirror, out rpm1, out rpm2))\n {\n Segment s1 = new Segment(v, rpm1);\n Segment s2 = new Segment(rpm1, p);\n if (!s1.Intersects(wall, out pt1, out pt2) && !s2.Intersects(wall, out pt1, out pt2))\n Console.WriteLine(\"YES\");\n }\n Console.WriteLine(\"NO\");\n }\n }\n\n\n public class GeometryUtils\n {\n public const double EPS = 10e-12;\n\n public static double SqrDist(double x1, double y1, double x2, double y2)\n {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n }\n\n public static double Dist(double x1, double x2)\n {\n return Math.Abs(x1 - x2);\n }\n\n public static double Dist(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt(SqrDist(x1, y1, x2, y2));\n }\n\n public static double Determinant(\n double a11, double a12,\n double a21, double a22)\n {\n return a11 * a22 - a21 * a12;\n }\n\n\n public static double Determinant(\n double a11, double a12, double a13,\n double a21, double a22, double a23,\n double a31, double a32, double a33\n )\n {\n return a11 * Determinant(a22, a23, a32, a33) - a21 * Determinant(a12, a13, a32, a33) + a31 * Determinant(a12, a13, a22, a23);\n }\n\n public static int Sign(double val)\n {\n if (Math.Abs(val) <= EPS)\n return 0;\n\n if (val > EPS)\n return 1;\n\n return -1;\n }\n\n }\n\n public class Point\n {\n public double x;\n public double y;\n\n #region Constructors\n\n public Point()\n {\n }\n\n public Point(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n #endregion\n\n #region Public Methods\n\n public Vector ToVector()\n {\n return new Vector(x, y);\n }\n\n public int Orientation(Point q, Point r)\n {\n return Orientation(this, q, r);\n }\n\n public double Area(Point q, Point r)\n {\n return Area(this, q, r);\n }\n\n public double SqrDist(Point q)\n {\n return GeometryUtils.SqrDist(x, y, q.x, q.y);\n }\n\n public double Distance()\n {\n return GeometryUtils.Dist(x, y, 0, 0);\n }\n\n public double Distance(Point q)\n {\n return GeometryUtils.Dist(x, y, q.x, q.y);\n }\n\n public double XDist(Point q)\n {\n return GeometryUtils.Dist(x, q.x);\n }\n\n public double YDist(Point q)\n {\n return GeometryUtils.Dist(y, q.y);\n }\n\n public Point Translate(double _x, double _y)\n {\n return new Point(x + _x, y + _y);\n }\n\n public Point Translate(Vector v)\n {\n return new Point(x + v.x, y + v.y);\n }\n\n // \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u0440\u044f\u043c\u0443\u044e\n public Point Project(Line line)\n {\n Line ort = new Line(this, line.NormalVector);\n Point pt;\n line.Intersects(ort, out pt);\n return pt;\n }\n\n public Point Reflect(Line line)\n {\n Point pr = Project(line);\n Vector v = (pr - this).Scale(2);\n return this.Translate(v);\n }\n\n #endregion\n\n #region Static Members\n\n public static Vector operator -(Point p1, Point p2)\n {\n return new Vector(p1.x - p2.x, p1.y - p2.y);\n }\n\n public static int Orientation(Point p, Point q, Point r)\n {\n double det = GeometryUtils.Determinant(p.x, p.y, 1, q.x, q.y, 1, r.x, r.y, 1);\n if (det > 0) return 1;\n if (det < 0) return -1;\n return 0;\n }\n\n public static double Area(Point p, Point q, Point r)\n {\n return GeometryUtils.Determinant(q.x - p.x, q.y - p.y, r.x - p.x, r.y - p.y);\n }\n\n #endregion\n }\n\n public class Vector\n {\n public double x;\n public double y;\n\n public Vector()\n {\n }\n\n public Vector(double _x, double _y)\n {\n x = _x;\n y = _y;\n }\n\n public Vector Translate(double a, double b)\n {\n return new Vector(x + a, y + b);\n }\n\n public Vector Translate(Vector v)\n {\n return new Vector(x + v.x, y + v.y);\n }\n\n public Vector Scale(double d)\n {\n return new Vector(x * d, y * d);\n }\n }\n\n public class Segment\n {\n private Point start;\n private Point end;\n\n #region Constructors\n\n public Segment()\n : this(new Point(), new Point())\n {\n }\n\n public Segment(Point s, Point e)\n {\n start = s;\n end = e;\n }\n\n public Segment(double x1, double y1, double x2, double y2)\n : this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n #endregion\n\n #region Public Properties\n\n public Point Start\n {\n get { return start; }\n set { start = value; }\n }\n\n public Point End\n {\n get { return end; }\n set { end = value; }\n }\n\n public double x1\n {\n get { return start.x; }\n set { start.x = value; }\n }\n\n public double y1\n {\n get { return start.y; }\n set { start.y = value; }\n }\n\n public double x2\n {\n get { return end.x; }\n set { end.x = value; }\n }\n\n public double y2\n {\n get { return end.y; }\n set { end.y = value; }\n }\n\n public Vector Direction\n {\n get { return End - Start; }\n }\n\n #endregion\n\n #region Public Methods\n\n public Line ToLine()\n {\n return new Line(this);\n }\n\n public bool Intersects(Segment seg, out Point p1, out Point p2)\n {\n p1 = new Point();\n p2 = new Point();\n\n double minx1 = Math.Min(Start.x, End.x);\n double maxx1 = Math.Max(Start.x, End.x);\n double miny1 = Math.Min(Start.y, End.y);\n double maxy1 = Math.Max(Start.y, End.y);\n\n double minx2 = Math.Min(seg.Start.x, seg.End.x);\n double maxx2 = Math.Max(seg.Start.x, seg.End.x);\n double miny2 = Math.Min(seg.Start.y, seg.End.y);\n double maxy2 = Math.Max(seg.Start.y, seg.End.y);\n\n if (minx1 > maxx2 || maxx1 < minx2 || miny1 > maxy2 || maxy1 < miny2)\n return false; // boundary rectangles not intersected\n\n Line this_line = this.ToLine();\n Line seg_line = seg.ToLine();\n\n if (this_line.Parallel(seg_line))\n {\n if (this_line.Equivalent(seg_line))\n {\n p1.x = Math.Max(minx1, minx2);\n p1.y = Math.Max(miny1, miny2);\n p2.x = Math.Min(maxx1, maxx2);\n p2.y = Math.Min(miny1, miny2);\n return true; // intersection by segment\n }\n else\n return false; // parallel\n }\n\n Point pt;\n if (!this_line.Intersects(seg_line, out pt))\n return false;\n\n if (pt.x >= minx1 && pt.x <= maxx1 &&\n pt.y >= miny1 && pt.y <= maxy1 &&\n pt.x >= minx2 && pt.x <= maxx2 &&\n pt.y >= miny2 && pt.y <= maxy2)\n {\n p1.x = pt.x;\n p1.y = pt.y;\n p2.x = pt.x;\n p2.y = pt.y;\n return true; // in one point\n }\n\n return false;\n }\n\n public double Distance(Point p)\n {\n Line line = this.ToLine();\n double[] cc = line.Coeffs;\n double A = cc[0];\n double B = cc[1];\n double C = cc[2];\n\n double d = (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n d = Math.Min(d, p.Distance(Start));\n d = Math.Min(d, p.Distance(End));\n return d;\n }\n\n #endregion\n\n }\n\n public class Line\n {\n #region Private Members\n\n private Point bp;\n private Vector dir;\n\n #endregion\n\n #region Constructors\n\n public Line()\n : this(new Point(), new Vector(1, 0))\n {\n }\n\n public Line(Point p, Vector v)\n {\n bp = p;\n dir = v;\n }\n\n public Line(Point p1, Point p2)\n : this(p1, p2 - p1)\n {\n\n }\n\n public Line(double x1, double y1, double x2, double y2) :\n this(new Point(x1, y1), new Point(x2, y2))\n {\n }\n\n public Line(Segment s) :\n this(s.Start, s.Direction)\n {\n\n }\n\n #endregion\n\n #region Public Properties\n\n public Point BasePoint { get { return bp; } }\n public Vector Direction { get { return dir; } }\n public Vector NormalVector { get { return new Vector(-dir.y, dir.x); } }\n public double[] Coeffs\n {\n get\n {\n return new double[3] \n {\n dir.y,\n -dir.x, \n dir.x * bp.y - dir.y * bp.x\n };\n }\n }\n\n public double A { get { return dir.y; } }\n public double B { get { return -dir.x; } }\n public double C { get { return dir.x * bp.y - dir.y * bp.x; } }\n\n #endregion\n\n #region Public Methods\n\n public bool Intersects(Line line, out Point pt)\n {\n pt = new Point();\n\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n if (GeometryUtils.Sign(d) == 0)\n return false;\n\n pt.x = -GeometryUtils.Determinant(C, B, line.C, line.B) / d;\n pt.y = -GeometryUtils.Determinant(A, C, line.A, line.C) / d;\n\n return true;\n }\n\n public bool Parallel(Line line)\n {\n double d = GeometryUtils.Determinant(A, B, line.A, line.B);\n return GeometryUtils.Sign(d) == 0;\n }\n\n public bool Equivalent(Line line)\n {\n double d1 = GeometryUtils.Determinant(A, B, line.A, line.B);\n double d2 = GeometryUtils.Determinant(A, C, line.A, line.C);\n double d3 = GeometryUtils.Determinant(B, C, line.B, line.C);\n\n return GeometryUtils.Sign(d1) == 0 && GeometryUtils.Sign(d2) == 0 && GeometryUtils.Sign(d2) == 0;\n }\n\n public double Distance(Point p)\n {\n return (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);\n }\n\n #endregion\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9617c6cfeb9688e604bae11a2fafe854", "src_uid": "7539a41268b68238d644795bccaa0c0f", "difficulty": 2400.0} {"lang": "MS C#", "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 private void Solve()\n {\n var s = Console.ReadLine().Split(' ');\n var a = long.Parse(s[0]);\n var b = long.Parse(s[1]);\n var f = long.Parse(s[2]);\n var k = long.Parse(s[3]);\n\n long sum = f;\n long dist = k*a;\n var points = new List() {0,f};\n var forw = 2*(a-f);\n var back = 2*f;\n var sw = true;\n while (sum b)\n {\n Console.WriteLine(-1);\n return;\n }\n\n var cnt = 0;\n var r = b;\n for (int i = 1; i < points.Count; i++)\n {\n var d = points[i]-points[i-1];\n if (d > r)\n {\n cnt++;\n r = b;\n if (r < d)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n r -= d;\n }\n Console.WriteLine(cnt);\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 //class Trie\n //{\n // public TrieNode root;\n\n // public Trie()\n // {\n // root = new TrieNode();\n // }\n\n // public void Insert(string s)\n // {\n // var current = root;\n // for (int i = 0; i < s.Length; i++)\n // {\n // var ch = s[i];\n // if (!current.Children.ContainsKey(ch))\n // current.Children.Add(ch, new TrieNode());\n // current = current.Children[ch];\n // }\n // current.IsEnd = true;\n // }\n\n // public bool Search(string word)\n // {\n // var current = root;\n // for (int i = 0; i < word.Length; i++)\n // {\n // var ch = word[i];\n // if (!current.Children.ContainsKey(ch))\n // return false;\n // current = current.Children[ch];\n // }\n // return current.IsEnd;\n // }\n //}\n\n //class TrieNode\n //{\n // public Dictionary Children { get; set; }\n // public bool IsEnd { get; set; }\n\n // public TrieNode()\n // {\n // Children = new Dictionary();\n // IsEnd = false;\n // }\n\n \n //}\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "873b9c2a40a3062736a3796fb27e3644", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n //\u0412\u0432\u043e\u0434\n string[] input = Console.ReadLine().Split();\n\n int Distance = int.Parse(input[0]), CurrentFuel = int.Parse(input[1]), GasStation = int.Parse(input[2]), TotalRuns = int.Parse(input[3]);\n int MaxFuel = CurrentFuel;\n int Distance_B2GS = Distance - GasStation;\n int GasPerKm = 1;\n bool isForward = true;\n int count = 0;\n //\u0427\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \n for (int i = 1; i <= TotalRuns; i++)\n {\n if (i != TotalRuns)\n {\n //\u0415\u0441\u043b\u0438 \u043f\u043e\u0435\u0437\u0434\u043a\u0430 \u0432\u043f\u0435\u0440\u0435\u0434\n if (isForward)\n {\n //\u0415\u0441\u043b\u0438 \u043d\u0435\u0434\u043e\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u0436\u0435 \u0434\u043e \u0437\u0430\u043f\u0440\u0430\u0432\u043a\u0438, \u0443\u0432\u044b \u0438 \u0430\u0445\n if (CurrentFuel < GasPerKm * GasStation) { Console.WriteLine(\"-1\"); return; }\n\n if ((CurrentFuel - GasStation * GasPerKm) < 2 * GasPerKm * (Distance_B2GS))\n {\n CurrentFuel = MaxFuel - (Distance_B2GS) * GasPerKm;\n count++;\n }\n else\n {\n CurrentFuel -= Distance * GasPerKm;\n }\n }\n else //\u0435\u0434\u0435\u043c \u043d\u0430\u0437\u0430\u0434\n {\n //\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0434\u043e\u0442\u044f\u043d\u0435\u043c \u043b\u0438 \u0434\u043e \u0437\u0430\u043f\u0440\u0430\u0432\u043a\u0438\n if (CurrentFuel < GasPerKm * Distance_B2GS) { Console.WriteLine(\"-1\"); return; }\n\n if ((CurrentFuel - GasPerKm * Distance_B2GS) < 2 * GasPerKm * (GasStation))\n {\n CurrentFuel = MaxFuel - GasPerKm * GasStation;\n count++;\n }\n else\n {\n CurrentFuel -= Distance * GasPerKm;\n\n }\n }\n isForward = !isForward;\n }\n else\n {\n //\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u0440\u0443\u0433, \u043f\u0440\u044f\u043c\u043e\n if (isForward)\n {\n if ((CurrentFuel < GasPerKm * GasStation)||(CurrentFuel bCurrent)\n {\n can = false;\n }\n else\n bCurrent -= f;\n\n while (kCurrent!=k && can)\n {\n int Destantion = kCurrent==k-1? Math.Abs(f - nextPoint): 2 * Math.Abs(f - nextPoint);\n if (bCurrent >= Destantion)\n {\n nextPoint = nextPoint == 0 ? a : 0;\n bCurrent -= Destantion;\n kCurrent++;\n }\n else\n {\n if (bCurrent == b)\n {\n can = false;\n }\n else\n {\n bCurrent = b;\n tanked++;\n }\n\n }\n }\n\n if (kCurrent == k)\n {\n Console.WriteLine(tanked);\n }\n else\n Console.WriteLine(-1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8278ee8fa7289f89c26f5223257af461", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _864C\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 f = int.Parse(tokens[2]);\n int k = int.Parse(tokens[3]);\n\n int remaining = b;\n int count = 0;\n\n for (int i = 0; i < k; i++)\n {\n if (i % 2 == 0)\n {\n remaining -= f;\n\n if (remaining < 0)\n {\n Console.WriteLine(-1);\n return;\n }\n\n if (i + 1 < k ? remaining < 2 * (a - f) : remaining < a - f)\n {\n remaining = b;\n count++;\n }\n\n remaining -= a - f;\n }\n else\n {\n remaining -= a - f;\n\n if (remaining < 0)\n {\n Console.WriteLine(-1);\n return;\n }\n\n if (i + 1 < k ? remaining < 2 * f : remaining < f)\n {\n remaining = b;\n count++;\n }\n\n remaining -= f;\n }\n\n if (remaining < 0)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b32f8cbfc0fb1bb8bbdf2224e2e8f440", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "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 var data = Console.ReadLine().Split(' ').Select(long.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var f = data[2];\n var k = data[3];\n\n if (b < f)\n {\n Console.WriteLine(-1);\n return;\n }\n\n var restB = b;\n var spent = 0;\n for(var i = 0; i <= k; i++)\n {\n if(i*a + restB >= a * k)\n {\n break;\n }\n if(i%2 == 0)\n {\n if(restB < f)\n {\n Console.WriteLine(-1);\n return;\n }\n if(restB < a + a - f)\n {\n spent++;\n restB = b - a+f;\n continue;\n }\n } else\n {\n if (restB < a-f)\n {\n Console.WriteLine(-1);\n return;\n }\n if (restB < a + f)\n {\n spent++;\n restB = b -f;\n continue;\n }\n }\n restB -= a;\n }\n\n \n Console.WriteLine(spent);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5f5a65ef949e2876480d1bc2bf395e13", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace 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 void Main(string[] args)\n {\n int a = Next(), b = Next(), f = Next(), k = Next();\n\n if ((k > 2 && 2*f > b) || (k > 1 && 2*(a - f) > b) || (k == 1 && (f > b || a - f > b)))\n {\n writer.WriteLine(\"-1\");\n writer.Flush();\n return;\n }\n\n int count = 0;\n int x = b;\n bool to = true;\n for (int i = 1; i <= k; i++)\n {\n if (to)\n {\n if (i != k)\n {\n if (a + (a - f) <= x)\n {\n x -= a;\n }\n else\n {\n count++;\n x = b - (a - f);\n }\n }\n else\n {\n if (x < a)\n count++;\n }\n }\n else\n {\n if (i != k)\n {\n if (a + f <= x)\n {\n x -= a;\n }\n else\n {\n count++;\n x = b - f;\n }\n }\n else\n {\n if (x < a)\n count++;\n }\n }\n to = !to;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f9e780a1a03eda6a1292c2fad4767721", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "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 var data = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var f = data[2];\n var k = data[3];\n\n if (b < f)\n {\n Console.WriteLine(-1);\n return;\n }\n\n var restB = b;\n var spent = 0;\n for(var i = 0; i <= k; i++)\n {\n if(i*a + restB >= a * k)\n {\n break;\n }\n if(i%2 == 0)\n {\n if(restB < f)\n {\n Console.WriteLine(-1);\n return;\n }\n if(restB < a + a - f)\n {\n spent++;\n restB = b + f;\n }\n } else\n {\n if (restB < a-f)\n {\n Console.WriteLine(-1);\n return;\n }\n if (restB < a + f)\n {\n spent++;\n restB = b + a - f;\n }\n }\n restB -= a;\n }\n\n \n Console.WriteLine(spent);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c4084867e21cc8fa6b612f5f3edded30", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n //\u0412\u0432\u043e\u0434\n string[] input = Console.ReadLine().Split();\n\n int Distance = int.Parse(input[0]), CurrentFuel = int.Parse(input[1]), GasStation = int.Parse(input[2]), TotalRuns = int.Parse(input[3]);\n int MaxFuel = CurrentFuel;\n int Distance_B2GS = Distance - GasStation;\n int GasPerKm = 1;\n bool isForward = true;\n int count = 0;\n //\u0427\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \n for (int i = 1; i <= TotalRuns; i++)\n {\n if (i != TotalRuns)\n {\n //\u0415\u0441\u043b\u0438 \u043f\u043e\u0435\u0437\u0434\u043a\u0430 \u0432\u043f\u0435\u0440\u0435\u0434\n if (isForward)\n {\n //\u0415\u0441\u043b\u0438 \u043d\u0435\u0434\u043e\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u0436\u0435 \u0434\u043e \u0437\u0430\u043f\u0440\u0430\u0432\u043a\u0438, \u0443\u0432\u044b \u0438 \u0430\u0445\n if (CurrentFuel < GasPerKm * GasStation) { Console.WriteLine(\"-1\"); return; }\n\n if ((CurrentFuel - GasStation * GasPerKm) < 2 * GasPerKm * (Distance_B2GS))\n {\n CurrentFuel = MaxFuel - (Distance_B2GS) * GasPerKm;\n count++;\n }\n else\n {\n CurrentFuel -= Distance * GasPerKm;\n }\n }\n else //\u0435\u0434\u0435\u043c \u043d\u0430\u0437\u0430\u0434\n {\n //\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0434\u043e\u0442\u044f\u043d\u0435\u043c \u043b\u0438 \u0434\u043e \u0437\u0430\u043f\u0440\u0430\u0432\u043a\u0438\n if (CurrentFuel < GasPerKm * GasStation) { Console.WriteLine(\"-1\"); return; }\n\n if ((CurrentFuel - GasPerKm * Distance_B2GS) < 2 * GasPerKm * (GasStation))\n {\n CurrentFuel = MaxFuel - GasPerKm * GasStation;\n count++;\n }\n else\n {\n CurrentFuel -= Distance * GasPerKm;\n\n }\n }\n isForward = !isForward;\n }\n else\n {\n //\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u0440\u0443\u0433, \u043f\u0440\u044f\u043c\u043e\n if (isForward)\n {\n if ((CurrentFuel < GasPerKm * GasStation)) { Console.WriteLine(\"-1\");return; }\n if (CurrentFuel < GasPerKm * Distance)\n count++;\n }\n else\n {\n if (CurrentFuel < GasPerKm * Distance_B2GS)\n { Console.WriteLine(\"-1\"); return; }\n if (CurrentFuel < GasPerKm * Distance) count++;\n }\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "30955a9e47e2e750682ede2f7c72d034", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n //\u0412\u0432\u043e\u0434\n string[] input = Console.ReadLine().Split();\n\n int Distance = int.Parse(input[0]), CurrentFuel = int.Parse(input[1]), GasStation = int.Parse(input[2]), TotalRuns = int.Parse(input[3]);\n int MaxFuel = CurrentFuel;\n int Distance_B2GS = Distance - GasStation;\n int GasPerKm = 1;\n bool isForward = true;\n int count = 0;\n //\u0427\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \n for (int i = 1; i <= TotalRuns; i++)\n {\n if (i != TotalRuns)\n {\n //\u0415\u0441\u043b\u0438 \u043f\u043e\u0435\u0437\u0434\u043a\u0430 \u0432\u043f\u0435\u0440\u0435\u0434\n if (isForward)\n {\n //\u0415\u0441\u043b\u0438 \u043d\u0435\u0434\u043e\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u0436\u0435 \u0434\u043e \u0437\u0430\u043f\u0440\u0430\u0432\u043a\u0438, \u0443\u0432\u044b \u0438 \u0430\u0445\n if (CurrentFuel < GasPerKm * GasStation) { Console.WriteLine(\"-1\"); return; }\n\n if ((CurrentFuel - GasStation * GasPerKm) < 2 * GasPerKm * (Distance_B2GS))\n {\n CurrentFuel = MaxFuel - (Distance_B2GS) * GasPerKm;\n count++;\n }\n else\n {\n CurrentFuel -= Distance * GasPerKm;\n }\n }\n else //\u0435\u0434\u0435\u043c \u043d\u0430\u0437\u0430\u0434\n {\n //\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0434\u043e\u0442\u044f\u043d\u0435\u043c \u043b\u0438 \u0434\u043e \u0437\u0430\u043f\u0440\u0430\u0432\u043a\u0438\n if (CurrentFuel < GasPerKm * GasStation) { Console.WriteLine(\"-1\"); return; }\n\n if ((CurrentFuel - GasPerKm * Distance_B2GS) < 2 * GasPerKm * (GasStation))\n {\n CurrentFuel = MaxFuel - GasPerKm * GasStation;\n count++;\n }\n else\n {\n CurrentFuel -= Distance * GasPerKm;\n\n }\n }\n isForward = !isForward;\n }\n else\n {\n //\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u0440\u0443\u0433, \u043f\u0440\u044f\u043c\u043e\n if (isForward)\n {\n if ((CurrentFuel < GasPerKm * GasStation)||(CurrentFuel= a * k)\n {\n break;\n }\n if(i%2 == 0)\n {\n if(restB < f)\n {\n Console.WriteLine(-1);\n return;\n }\n if(restB < a + a - f)\n {\n spent++;\n restB = b + f;\n }\n } else\n {\n if (restB < a-f)\n {\n Console.WriteLine(-1);\n return;\n }\n if (restB < a + f)\n {\n spent++;\n restB = b + f;\n }\n }\n restB -= a;\n }\n\n \n Console.WriteLine(spent);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1647ca219069eeb3feb493441c6378d", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace 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 void Main(string[] args)\n {\n int a = Next(), b = Next(), f = Next(), k = Next();\n\n if (2*f > b || 2*(a - f) > b)\n {\n writer.WriteLine(\"-1\");\n writer.Flush();\n return;\n }\n\n int count = 0;\n int x = b;\n bool to = true;\n for (int i = 1; i <= k; i++)\n {\n if (to)\n {\n if (i != k)\n {\n if (a + (a - f) <= x)\n {\n x -= a;\n }\n else\n {\n count++;\n x = b - (a - f);\n }\n }\n else\n {\n if (x < a)\n count++;\n }\n }\n else\n {\n if (i != k)\n {\n if (a + f <= x)\n {\n x -= a;\n }\n else\n {\n count++;\n x = b - f;\n }\n }\n else\n {\n if (x < a)\n count++;\n }\n }\n to = !to;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "37f614750afa10831f95d07955379d49", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n //\u0412\u0432\u043e\u0434\n string[] input = Console.ReadLine().Split();\n\n int Distance = int.Parse(input[0]), CurrentFuel = int.Parse(input[1]), GasStation = int.Parse(input[2]), TotalRuns = int.Parse(input[3]);\n int MaxFuel = CurrentFuel;\n int Distance_B2GS = Distance - GasStation;\n int GasPerKm = 1;\n bool isForward = true;\n int count = 0;\n //\u0427\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \n for (int i = 1; i <= TotalRuns; i++)\n {\n if (i != TotalRuns)\n {\n //\u0415\u0441\u043b\u0438 \u043f\u043e\u0435\u0437\u0434\u043a\u0430 \u0432\u043f\u0435\u0440\u0435\u0434\n if (isForward)\n {\n //\u0415\u0441\u043b\u0438 \u043d\u0435\u0434\u043e\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u0436\u0435 \u0434\u043e \u0437\u0430\u043f\u0440\u0430\u0432\u043a\u0438, \u0443\u0432\u044b \u0438 \u0430\u0445\n if (CurrentFuel < GasPerKm * GasStation) { Console.WriteLine(\"-1\"); return; }\n\n if ((CurrentFuel - GasStation * GasPerKm) < 2 * GasPerKm * (Distance_B2GS))\n {\n CurrentFuel = MaxFuel - (Distance_B2GS) * GasPerKm;\n count++;\n }\n else\n {\n CurrentFuel -= Distance * GasPerKm;\n }\n }\n else //\u0435\u0434\u0435\u043c \u043d\u0430\u0437\u0430\u0434\n {\n //\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0434\u043e\u0442\u044f\u043d\u0435\u043c \u043b\u0438 \u0434\u043e \u0437\u0430\u043f\u0440\u0430\u0432\u043a\u0438\n if (CurrentFuel < GasPerKm * GasStation) { Console.WriteLine(\"-1\"); return; }\n\n if ((CurrentFuel - GasPerKm * Distance_B2GS) < 2 * GasPerKm * (GasStation))\n {\n CurrentFuel = MaxFuel - GasPerKm * GasStation;\n count++;\n }\n else\n {\n CurrentFuel -= Distance * GasPerKm;\n\n }\n }\n isForward = !isForward;\n }\n else\n {\n //\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u0440\u0443\u0433, \u043f\u0440\u044f\u043c\u043e\n if (isForward)\n {\n if ((CurrentFuel < GasPerKm * GasStation)||(CurrentFuel= a * k)\n {\n break;\n }\n if(i%2 == 0)\n {\n if(restB < f)\n {\n Console.WriteLine(-1);\n return;\n }\n if(restB < a + a - f)\n {\n spent++;\n restB = b - a+f;\n continue;\n }\n } else\n {\n if (restB < a-f)\n {\n Console.WriteLine(-1);\n return;\n }\n if (restB < a + f)\n {\n spent++;\n restB = b -f;\n continue;\n }\n }\n restB -= a;\n }\n\n \n Console.WriteLine(spent);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dd2eb44c0ee852b2450d2ead1060097c", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "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 class Solution\n {\n /* Head ends here */\n\n public const int PAD_FACTOR = 7;\n\n public static int greedy(int a, int b, int f, int k)\n {\n var ans = 0;\n var stock = b;\n var spbu = f;\n while (k-- > 0)\n {\n var canSpbu = stock >= spbu;\n if (!canSpbu)\n return -1;\n // decide whether to refill or not\n var canStopNoRefill = stock >= a;\n var last = k == 0;\n var nextSpbu = a - spbu;\n var nextCanSpbuNoRefill = stock >= (a + nextSpbu);\n var skipRefill = new Func(() =>\n {\n if (last) return canStopNoRefill;\n return nextCanSpbuNoRefill;\n });\n // simul\n stock -= spbu; // to spbu\n assert(stock >= 0);\n if (skipRefill() == false)\n {\n // refill\n stock = b;\n ans++;\n }\n stock -= (a - spbu); // to stop\n assert(stock >= 0);\n // next loop\n spbu = a - spbu;\n }\n return ans;\n }\n\n int solve()\n {\n // a, b, f, k (0\u2009<\u2009f\u2009<\u2009a\u2009\u2264\u2009e6, 1\u2009\u2264\u2009b\u2009\u2264\u2009e9, 1\u2009\u2264\u2009k\u2009\u2264\u2009e4)\n var A = ReadInt32();//e6\n var B = ReadInt32();//e6\n var F = ReadInt32();//e9\n var K = ReadInt32();//e4\n // only refill if necessary -> can't finish k\n return greedy(A, B, F, K);\n // Print the minimum number of times the bus needs to refuel to make k journeys. If it is impossible for the bus to make k journeys, print -1.\n }\n\n public void zStart()\n {\n Console.WriteLine(solve());\n\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 assert(Solution.greedy(6, 9, 2, 4), 4);\n assert(Solution.greedy(6, 10, 2, 4), 2);\n assert(Solution.greedy(2, 1, 1, 1), 1);\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 = 1000000)\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 Convert\n public static int int32(this long i64) { return Convert.ToInt32(i64); }\n public static int int32(this double dec64) { return Convert.ToInt32(dec64); }\n public static long long64(this int i32) { return (long)i32; }\n public static long long64(this double dec64) { return Convert.ToInt64(dec64); }\n public static double double64(this long i64) { return Convert.ToDouble(i64); }\n public static double double64(this int i32) { return (double)i32; }\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 long add64(long a, long b) { return a + b; }\n public static long mult64(long a, long b) { return a * b; }\n public static double div(double dividend, double divisor) { return dividend / divisor; }\n public static int ceil(double d) { return Convert.ToInt32(Math.Ceiling(d)); }\n public static int ceil(double dividend, double divisor) { return ceil(div(dividend, divisor)); }\n public static long ceil64(double d) { return Convert.ToInt64(Math.Ceiling(d)); }\n public static int floor(double d) { return Convert.ToInt32(Math.Floor(d)); }\n public static int floor(double dividend, double divisor) { return floor(div(dividend, divisor)); }\n public static long floor64(double d) { return Convert.ToInt64(Math.Floor(d)); }\n\n public static IEnumerable rangeUntil(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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1f76f3e6941a9a96e614bdcaa5826124", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace RockPaintings\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tmp = Console.ReadLine().Split(' ');\n Int64 n = Int64.Parse(tmp[0]);\n Int64 k = Int64.Parse(tmp[1]);\n\n Int64 min = k > 1000000 ? 1000000 : k;\n\n for (int i = 1; i <= min; i++)\n {\n if (n % i < i - 1)\n {\n Console.WriteLine(\"NO\");\n break;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4fd14ca2f59a5d58b204b67cc77ae042", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "MS C#", "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 long n = arr[1];\n long k = arr[0];\n\n for (int i = 1; i <= k; i++)\n {\n if ((n + 1) % i != 0)\n {\n Console.WriteLine(\"No\");\n return;\n }\n else if (i == k)\n {\n Console.WriteLine(\"Yes\");\n return;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "93cd45dfdadfe74545eafea7c4d02001", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "MS C#", "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 input = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n List results = new List();\n for (int i = 1; i <= input[1]; i++)\n {\n var t = input[0] % i;\n if (results.Contains(t))\n {\n Console.WriteLine(\"No\");\n return;\n }\n results.Add(t);\n }\n Console.WriteLine(\"Yes\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0e084da9b9b4deb93a170308880d810f", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Cave_Painting\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 long n = Next();\n long k = Next();\n\n var h = new HashSet();\n for (int i = 1; i <= k; i++)\n {\n if (!h.Add(n%i))\n return false;\n }\n\n return true;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "634d98e4c0868583b8639f6b76538183", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace RockPaintings\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tmp = Console.ReadLine().Split(' ');\n Int64 n = Int64.Parse(tmp[0]);\n Int64 k = Int64.Parse(tmp[1]);\n\n Int64 min = k > 1000000 ? 1000000 : k;\n\n for (int i = 1; i <= min; i++)\n {\n if (n % i < i - 1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "83bc33f50750c0b1327209d54d322d43", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CavePainting\n{\n class Program\n {\n static void Main(string[] args)\n {\n var longs = Console.ReadLine().Split().Select(ulong.Parse);\n ulong n = longs.ElementAt(0), k = longs.ElementAt(1);\n\n List leftOvers = new List();\n ulong tmp;\n ulong i = 1;\n\n for ( ;i <= k; i++)\n {\n tmp = n % i;\n\n if (!leftOvers.Contains(tmp)) leftOvers.Add(tmp);\n else break;\n }\n\n if (i == k+1) Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n\n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f32b9ba3b99bdb51a767c26babb297f0", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "Mono C#", "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 long n = long.Parse(token[0]);\n long k = long.Parse(token[1]);\n \n List li = new List();\n \n for(int i=1;i<=k;i++){\n long rem = n%i;\n if(li.Contains(rem)){\n Console.WriteLine(\"No\");\n return;\n }\n li.Add(rem);\n }\n \n Console.WriteLine(\"Yes\");\n\n }\n }\n \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f728debc64d9088613441fbc9b34b5ca", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _922C\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n long n = long.Parse(tokens[0]);\n long k = long.Parse(tokens[1]);\n\n for (int i = 1; i <= k; i++)\n {\n if (n % i != i - 1)\n {\n Console.WriteLine(\"No\");\n return;\n }\n }\n\n Console.WriteLine(\"Yes\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6a4743495fa2052cde4259fd20f04563", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split();\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n bool success = true;\n for (long c = 2; c <= k; ++c) {\n if (n % c != c - 1) {\n success = false;\n break;\n }\n }\n if (success)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "21a3b9bcf8c2a871b33c151d81eb140d", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n var n = int.Parse(input[0]);\n var k = int.Parse(input[1]);\n\n if(k >= 43)\n {\n Console.WriteLine(\"No\");\n return;\n }\n\n for (var i = 1; i <= k; i++)\n {\n if (n % i != i - 1)\n {\n Console.WriteLine(\"No\");\n return;\n }\n }\n\n Console.WriteLine(\"Yes\");\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "af704eead95c5da62108f40da78a85c3", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TestApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n var n = int.Parse(input[0]);\n var k = int.Parse(input[1]);\n\n if(k >= 43)\n {\n Console.WriteLine(\"No\");\n return;\n }\n\n for (var i = 1; i <= k; i++)\n {\n if (n % i != i - 1)\n {\n Console.WriteLine(\"No\");\n return;\n }\n }\n\n Console.WriteLine(\"Yes\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9685ce79f0d3669323e097d0a7f27d4a", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CavePainting\n{\n class Program\n {\n static void Main(string[] args)\n {\n var ints = Console.ReadLine().Split().Select(int.Parse);\n int n = ints.ElementAt(0), k = ints.ElementAt(1);\n\n List leftOvers = new List();\n int tmp;\n int i = 1;\n\n for ( ;i <= k; i++)\n {\n tmp = n % i;\n\n if (!leftOvers.Contains(tmp)) leftOvers.Add(tmp);\n else break;\n }\n\n if (i == k+1) Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n\n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a9995d136a2e2b1d7a77b99b36d92d60", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "MS C#", "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 long n = arr[0];\n long k = arr[1];\n\n for (int i = 1; i <= k; i++)\n {\n if ((n + 1) % i != 0)\n {\n Console.WriteLine(\"No\");\n return;\n }\n else if (i == k)\n {\n Console.WriteLine(\"Yes\");\n return;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc39e0863957863155f91425bcecdd7b", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "Mono C#", "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 char[] ch = new char[] { '>', '<', '+', '-', '.', ',', '[', ']' };\n string[] binary = new string[] { \"1000\", \"1001\", \"1010\", \"1011\", \"1100\", \"1101\", \"1110\", \"1111\" };\n string input = Console.ReadLine();\n string output = \"\";\n int i , j;\n foreach (char c in input)\n {\n long k = 0;\n for (i = 0; i < ch.Length; i++)\n {\n if (c == ch[i])\n {\n k = i;\n break;\n }\n }\n output += binary[k];\n }\n int n = output.Length;\n Console.WriteLine(n);\n int res = 0;\n if (n < 21)\n {\n for (i = 0; i < n; i++)\n {\n\n if (output[i] == '1')\n {\n res += (int)Math.Pow(2, n - i - 1);\n }\n }\n }\n else\n {\n for (i = 0; i < n; i++)\n {\n //int res1 = 0;\n int temp = 1;\n if (output[i] == '1')\n {\n for (j = 0; j < n - i - 1; j++)\n {\n temp *= 2;\n temp %= 1000003;\n }\n }\n res += temp;\n //res %= 1000003;\n }\n Console.WriteLine(res);\n }\n Console.WriteLine(res % 1000003);\n //Console.WriteLine(output);\n Console.ReadKey();\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5d45c064d5b5d650f14552c25cbd7299", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "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 Main(string[] args)\n {\n // int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n //string[] s = Console.ReadLine().Split(' ');\n //List list = new List();\n string str = \"\";\n\n for (int i = 0; i <= s.Length - 1; i++)\n {\n switch (s[i])\n {\n case '>':\n {\n str += \"1000\";\n break;\n }\n case '<':\n {\n str += \"1001\";\n break;\n }\n case '+':\n {\n str += \"1010\";\n break;\n }\n case '-':\n {\n str += \"1011\";\n break;\n }\n case '.':\n {\n str += \"1100\";\n break;\n }\n case ',':\n {\n str += \"1101\";\n break;\n }\n case '[':\n {\n str += \"1110\";\n break;\n }\n case ']':\n {\n str += \"1111\";\n break;\n }\n }\n }\n Int64 _int = Convert.ToInt64(str, 2) % 1000003;\n\n Console.Write(\"{0}\", _int); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "71b4d9d4f7a7814fc610db94a8d01dc9", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "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 Main(string[] args)\n {\n // int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n //string[] s = Console.ReadLine().Split(' ');\n //List list = new List();\n string str = \"\";\n\n for (int i = 0; i <= s.Length - 1; i++)\n {\n switch (s[i])\n {\n case '>':\n {\n str += \"1000\";\n break;\n }\n case '<':\n {\n str += \"1001\";\n break;\n }\n case '+':\n {\n str += \"1010\";\n break;\n }\n case '-':\n {\n str += \"1011\";\n break;\n }\n case '.':\n {\n str += \"1100\";\n break;\n }\n case ',':\n {\n str += \"1101\";\n break;\n }\n case '[':\n {\n str += \"1110\";\n break;\n }\n case ']':\n {\n str += \"1111\";\n break;\n }\n }\n }\n int _int = Convert.ToInt32(str, 2) % 1000003;\n\n Console.Write(\"{0}\", _int); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6bc74a7f44602de90117995db0358275", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication\n{\n class Program\n {\n static string tobin(string str)\n {\n Int64 k=0;\n Int64 count = 0, result = 0;\n\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 result += (Int64)Math.Pow(j * 2.0, count);\n count++;\n }\n\n return Math.Abs(result).ToString();\n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string str = \"\";\n\n for (int i = 0; i <= s.Length - 1; i++)\n {\n switch (s[i])\n {\n case '>':\n {\n str += \"1000\";\n break;\n }\n case '<':\n {\n str += \"1001\";\n break;\n }\n case '+':\n {\n str += \"1010\";\n break;\n }\n case '-':\n {\n str += \"1011\";\n break;\n }\n case '.':\n {\n str += \"1100\";\n break;\n }\n case ',':\n {\n str += \"1101\";\n break;\n }\n case '[':\n {\n str += \"1110\";\n break;\n }\n case ']':\n {\n str += \"1111\";\n break;\n }\n }\n }\n\n\n Console.Write(\"{0}\", Int64.Parse(tobin(str)) % 1000003);\n Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9808a2655bf3d47fe1391551c0e94fb0", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication\n{\n class Program\n {\n private static double[] TwoPowArray = new double[64];\n public static void GenericTwoPow()\n {\n for (int i = 0; i < 64; i++)\n {\n TwoPowArray[i] = Math.Pow(2, i);\n }\n }\n public static string BitToDec(string value)\n {\n double res = 0;\n try\n {\n char[] array = value.ToCharArray();\n Array.Reverse(array);\n value = new String(array);\n for (int i = 0; i < value.Length; i++)\n {\n if (value[i].Equals('1'))\n {\n res += TwoPowArray[i];\n }\n }\n }\n catch (System.Exception ex)\n {\n Console.WriteLine(ex.Message);\n }\n return res.ToString();\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 //List list = new List();\n string str = \"\";\n\n for (int i = 0; i <= s.Length - 1; i++)\n {\n switch (s[i])\n {\n case '>':\n {\n str += \"1000\";\n break;\n }\n case '<':\n {\n str += \"1001\";\n break;\n }\n case '+':\n {\n str += \"1010\";\n break;\n }\n case '-':\n {\n str += \"1011\";\n break;\n }\n case '.':\n {\n str += \"1100\";\n break;\n }\n case ',':\n {\n str += \"1101\";\n break;\n }\n case '[':\n {\n str += \"1110\";\n break;\n }\n case ']':\n {\n str += \"1111\";\n break;\n }\n }\n }\n GenericTwoPow();\n Int64 o = Int64.Parse(BitToDec(str)) % 1000003;\n // Int64 _int = Convert.ToInt64(str, 2) % 1000003;\n\n Console.Write(\"{0}\", o); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bb6149f61b8c1eedb5179a598f025737", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeff\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nclass Problem_B\n{\n static int modPow(int a, int n, int m)\n {\n int t = a % m;\n int res = 1;\n for (int i = 0; i < n; ++i)\n {\n res = (res * t) % m;\n }\n return res;\n }\n static void Main(string[] args)\n {\n int M = 1000003;\n string line = Console.ReadLine();\n\n int res = 0;\n string binary = \"\";\n for (int i = 0; i < line.Length; ++i)\n {\n switch (line[i])\n {\n case '>': binary += \"1000\"; break;\n case '<': binary += \"1001\"; break;\n case '+': binary += \"1010\"; break;\n case '-': binary += \"1011\"; break;\n case '.': binary += \"1100\"; break;\n case ',': binary += \"1101\"; break;\n case '[': binary += \"1110\"; break;\n case ']': binary += \"1111\"; break;\n }\n }\n for (int i = 0; i < binary.Length; ++i)\n {\n if (binary[i] == '1')\n {\n res = (res + modPow(2, binary.Length - i - 1, M)) % M;\n }\n }\n Console.WriteLine(res);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "72d5566d935b67bf50ea4c5147325a7c", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CSharp\n{\n class _133B\n {\n public static void Main()\n {\n var map = new Dictionary\n {\n { '>' , 0b1000 },\n { '<' , 0b1001 },\n { '+' , 0b1010 },\n { '-' , 0b1011 },\n { '.' , 0b1100 },\n { ',' , 0b1101 },\n { '[' , 0b1110 },\n { ']' , 0b1111 }\n };\n\n int size = 0;\n foreach (var c in Console.ReadLine())\n {\n size = (size * 16 + map[c]) % 1000003;\n }\n\n Console.WriteLine(size);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a351e9e20dd50f63d3d2e20cf485caf", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Ans\n{\n public int X;\n public int Diff;\n}\n\nclass GFG\n{\n static Dictionary dic = new Dictionary();\n static int mod = 1000003;\n\n public static void Main()\n {\n dic.Add('>', \"1000\");\n dic.Add('<', \"1001\");\n dic.Add('+', \"1010\");\n dic.Add('-', \"1011\");\n dic.Add('.', \"1100\");\n dic.Add(',', \"1101\");\n dic.Add('[', \"1110\");\n dic.Add(']', \"1111\");\n\n\n var input = Console.ReadLine().ToArray();\n\n StringBuilder br = new StringBuilder();\n\n for (int i = 0; i < input.Length; i++)\n {\n br.Append(dic[input[i]]);\n }\n int decValue = 0;\n int baseValue = 1;\n for (int i = br.Length - 1; i >= 0; i--)\n {\n decValue = (decValue + (Convert.ToInt32(br[i]-'0') * baseValue)) % mod;\n baseValue = (baseValue * 2)%mod;\n }\n\n Console.Write(decValue);\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b44e109bc76d624ba0a204bb95a4393c", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "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 private static void Unary()\n {\n //take the input\n string input = Console.ReadLine();\n StringBuilder Binput = new StringBuilder();\n //use the table to get the values\n foreach (char c in input)\n {\n switch (c)\n {\n case '>':\n Binput.Append(\"1000\");\n break;\n case '<':\n Binput.Append(\"1001\");\n break;\n case '+':\n Binput.Append(\"1010\");\n break;\n case '-':\n Binput.Append(\"1011\");\n break;\n case '.':\n Binput.Append(\"1100\");\n break;\n case ',':\n Binput.Append(\"1101\");\n break;\n case '[':\n Binput.Append(\"1110\");\n break;\n case ']':\n Binput.Append(\"1111\");\n break;\n default:\n Console.WriteLine(\"Wrong Token Entered\");\n break;\n }\n }\n //convert to Decimal value\n BigInteger output = toDecimal(Binput.ToString());\n output %= 1000003;// 1000003\n Console.WriteLine(output);\n }\n static private BigInteger toDecimal(string s)\n {\n BigInteger value=0;\n for (int i = 0; i < s.Length; i++)\n {\n value += BigInteger.Parse((s[i]-'0').ToString()) * BigInteger.Pow(2, s.Length - i-1);\n \n }\n\n return value;\n }\n\n static void Main(string[] args)\n {\n Unary();\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3bdc716dec21f5d4e072ecf7623decc4", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "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 c = new char[] { '>', '<', '+', '-', '.', ',', '[', ']' };\n var s = Console.ReadLine();\n string n = String.Empty;\n int num = 0;\n for (int i = 0; i < s.Length; i++)\n {\n var x = Array.IndexOf(c, s[i])+8;\n var z = Convert.ToString(x, 2);\n n += z;\n num = Convert.ToInt32(n, 2) % 1000003;\n n = Convert.ToString(num, 2);\n }\n Console.WriteLine(num);\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "579820df3e6df48ea1701c8ae6eddba9", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Numerics;\nusing System.Text;\n\nnamespace Unary\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 BigInteger BinToDec(string value)\n {\n BigInteger res = 0;\n foreach (char c in value)\n {\n res <<= 1;\n res += c == '1' ? 1 : 0;\n }\n return res;\n }\n\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n\n var b = new StringBuilder();\n\n foreach (char c in s)\n {\n switch (c)\n {\n case '>':\n b.Append(\"1000\");\n break;\n case '<':\n b.Append(\"1001\");\n break;\n case '+':\n b.Append(\"1010\");\n break;\n case '-':\n b.Append(\"1011\");\n break;\n case '.':\n b.Append(\"1100\");\n break;\n case ',':\n b.Append(\"1101\");\n break;\n case '[':\n b.Append(\"1110\");\n break;\n case ']':\n b.Append(\"1111\");\n break;\n }\n }\n\n BigInteger bb = BinToDec(b.ToString())%1000003;\n\n writer.WriteLine(bb);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "30bea82ca8380057e0af78db1df74e3d", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class A\n {\n private static bool s_time = false;\n\n static long mod = 1000003;\n\n private static object Go()\n {\n string s = GetString();\n\n Dictionary map = new Dictionary();\n map['>'] = 8;\n map['<'] = 9;\n map['+'] = 10;\n map['-'] = 11;\n map['.'] = 12;\n map[','] = 13;\n map['['] = 14;\n map[']'] = 15;\n\n long ret = 0;\n for (int i = 0; i < s.Length; i++)\n {\n ret = (ret * 16 + map[s[i]]) % mod;\n }\n\n return ret;\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n DateTime start = DateTime.Now;\n object output = Go();\n TimeSpan duration = DateTime.Now.Subtract(start);\n if (output != null)\n Wl(output.ToString());\n if (s_time)\n Wl(duration);\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 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 : 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5f174767e5e14f153c9b76f7f4014333", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "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\n int sum = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n int r = 0;\n if (s[i] == '>') r = 8;\n if (s[i] == '<') r = 9;\n if (s[i] == '+') r = 10;\n if (s[i] == '-') r = 11;\n if (s[i] == '.') r = 12;\n if (s[i] == ',') r = 13;\n if (s[i] == '[') r = 14;\n if (s[i] == ']') r = 15;\n\n for (int j = 1; j < s.Length - i; j++)\n r = (r << 4) % 1000003;\n\n sum = (sum + r) % 1000003;\n }\n\n Console.WriteLine(sum);\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1346719587a936910eeba8e52850f1a", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace AllProblems\n{\n class _133B_Unary\n {\n public static void Run()\n {\n var s = Console.ReadLine().Trim();\n var len = s.Length;\n var key = \"><+-.,[]\";\n var sum = 0;\n\n for (var i = 0; i < len; i++)\n {\n var val = key.IndexOf(s[i]) + 8;\n sum = (sum*16 + val) % 1000003;\n }\n\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n _133B_Unary.Run();\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "42a3a955afe9d24135728ce81974bd7c", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\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\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 int MOD = 1000003;\n var input = Read();\n input = input.Replace(\">\", \"1000\");\n input = input.Replace(\"<\", \"1001\");\n input = input.Replace(\"+\", \"1010\");\n input = input.Replace(\"-\", \"1011\");\n input = input.Replace(\".\", \"1100\");\n input = input.Replace(\",\", \"1101\");\n input = input.Replace(\"[\", \"1110\");\n input = input.Replace(\"]\", \"1111\");\n var len = input.Length - 1;\n long res = 0;\n for (int i = 0; i <= len; i++)\n {\n res *= 2;\n res %= MOD;\n res += (input[i] - '0');\n }\n res %= MOD;\n Console.WriteLine(res);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "49f02e6204a3740b2c1dd820b7346a6b", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nclass Test{\n static void Main(){\n string [, ] set = {{\">\", \"1000\"}, {\"<\", \"1001\"}, {\"+\", \"1010\"}, {\"-\", \"1011\"}, {\".\", \"1100\"}, {\",\", \"1101\"}, {\"[\", \"1110\"}, {\"]\", \"1111\"}};\n string line = \"\";\n string temp = Console.ReadLine();\n int i = 0, j = 0;\n for(i = 0; i < temp.Length; i++){\n for(j = 0; j < set.GetLength(0); j++){\n if(set[j, 0] == Convert.ToString(temp[i])){\n line += set[j, 1];\n }\n }\n }\n double ans = 0;\n i = line.Length - 1;\n j = 0;\n while(i > -1){\n int line_i = int.Parse(Convert.ToString(line[i]));\n ans += (line_i * Math.Pow(2, j)) % 1000003;\n i--;\n j++;\n }\n Console.WriteLine(ans % 1000003);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e64c0a2bf805c734585a363cd7fbd8c5", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication\n{\n class Program\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(Math.Pow(j * 2.0, count) % 1000003);\n }\n count++;\n }\n\n return (Math.Abs(result) % 1000003).ToString();\n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string str = \"\";\n\n for (int i = 0; i <= s.Length - 1; i++)\n {\n switch (s[i])\n {\n case '>':\n {\n str += \"1000\";\n break;\n }\n case '<':\n {\n str += \"1001\";\n break;\n }\n case '+':\n {\n str += \"1010\";\n break;\n }\n case '-':\n {\n str += \"1011\";\n break;\n }\n case '.':\n {\n str += \"1100\";\n break;\n }\n case ',':\n {\n str += \"1101\";\n break;\n }\n case '[':\n {\n str += \"1110\";\n break;\n }\n case ']':\n {\n str += \"1111\";\n break;\n }\n }\n }\n\n Console.Write(\"{0}\", Int64.Parse(tobin(str)));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5fcda0b90b33f12fa132a01db16051b1", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "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 s = ReadString();\n\t\t\tlong ans = 0;\n\t\t\tlong tt = 1;\n\t\t\tfor (var i = s.Length - 1; i >= 0; --i)\n\t\t\t{\n\t\t\t\tif (s[i] == '>')\n\t\t\t\t\tans = (ans + tt * 8) % 1000003;\n\t\t\t\tif (s[i] == '<')\n\t\t\t\t\tans = (ans + tt * 9) % 1000003;\n\t\t\t\tif (s[i] == '+')\n\t\t\t\t\tans = (ans + tt * 10) % 1000003;\n\t\t\t\tif (s[i] == '-')\n\t\t\t\t\tans = (ans + tt * 11) % 1000003;\n\t\t\t\tif (s[i] == '.')\n\t\t\t\t\tans = (ans + tt * 12) % 1000003;\n\t\t\t\tif (s[i] == ',')\n\t\t\t\t\tans = (ans + tt * 13) % 1000003;\n\t\t\t\tif (s[i] == '[')\n\t\t\t\t\tans = (ans + tt * 14) % 1000003;\n\t\t\t\tif (s[i] == ']')\n\t\t\t\t\tans = (ans + tt * 15) % 1000003;\n\t\t\t\ttt = (tt * 16) % 1000003;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "50db3987b5490d1a38c80418d2c7fe1d", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ACming\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Program().Run();\n } \n void Run()\n {\n string str = Console.ReadLine();\n\n\n Int64 res = 0;\n for (int i = 0; i < str.Length; i++)\n { \n res *= 16;\n res += 8;\n switch (str[i])\n {\n case '>' : \n break;\n case '<':\n res += 1;\n break;\n case '+':\n res += 2;\n break;\n case '-':\n res += 3;\n break;\n case '.':\n res += 4;\n break;\n case ',':\n res += 5;\n break;\n case '[':\n res += 6;\n break;\n case ']':\n res += 7;\n break;\n \n default:\n break;\n }\n res %= 1000003;\n }\n Console.WriteLine(res);\n }\n } \n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "71fca56da77d376812525fca7cdd3593", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B133\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = \"><+-.,[]\";\n int[] b = { 8, 9,10,11,12,13,14,15 };\n int mod = 1000003;\n char[] token = Console.ReadLine().ToCharArray();\n int result=0;\n for (int i = 0; i < token.Length; i++)\n {\n result = ((result<<4)+b[a.IndexOf(token[i])]) % mod;\n }\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d1525ad84e5616dd2351deb667972496", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\n\nnamespace some_in_sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var Dict = new Dictionary() \n {\n {'>', \"1000\"},\n {'<', \"1001\"},\n {'+', \"1010\"},\n {'-', \"1011\"},\n {'.', \"1100\"},\n {',', \"1101\"},\n {'[', \"1110\"},\n {']', \"1111\"}\n };\n\n String some_str = Console.ReadLine();\n String result = \"\";\n foreach (char SomeChar in some_str)\n {\n result += Dict[SomeChar];\n }\n\n BigInteger result_big_int = result.Aggregate(new BigInteger(), (b, c) => b * 2 + c - '0');\n System.Console.WriteLine(result_big_int % new BigInteger(1000003));\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9baba6e52813b431f07ae633be80b60b", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\n\nclass P {\n static void Main(){\n var map = new int[1000];\n map[(int)'>'] = 8;\n map[(int)'<'] = 9;\n map[(int)'+'] = 10;\n map[(int)'-'] = 11;\n map[(int)'.'] = 12;\n map[(int)','] = 13;\n map[(int)'['] = 14;\n map[(int)']'] = 15;\n\n var res = 0;\n foreach (var c in Console.ReadLine())\n res = (res * 16 + map[(int)c]) % 1000003;\n Console.Write(res);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b8d485aa7ad263c2177d74630cb57655", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "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 bf = new Dictionary() { { '>', 8 } ,{ '<' ,9 },{ '+', 10 },\n { '-', 11 },{ '.' ,12},{ ',' ,13 },{ '[' ,14 },{ ']' ,15 }};\n var p = reader.ReadLine();\n var st = 1L;\n var mod = 1000003L;\n var ans = 0L;\n for (int i = p.Length - 1; i >= 0; i--)\n {\n long tmp = bf[p[i]];\n tmp %= mod;\n st %= mod;\n tmp = (tmp * st) % mod;\n st <<= 4;\n ans += tmp;\n ans %= mod;\n }\n writer.WriteLine(ans);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4556b3b0efe7f5beb7f4bff96690cbb1", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp5\n{\n public class Program\n {\n static void Main()\n {\n var str = Console.ReadLine();\n var res = Fun(str);\n Console.WriteLine(res);\n\n }\n\n public static long Fun(string str)\n {\n var dic = new Dictionary { { '>', \"1000\" }, { '<', \"1001\" }, { '+', \"1010\" }, { '-', \"1011\" }, { '.', \"1100\" }, { ',', \"1101\" }, { '[', \"1110\" }, { ']', \"1111\" } };\n var t = \"\";\n foreach (var s in str)\n t += dic[s];\n\n long res = 0;\n var n = 0;\n for (int i = t.Length - 1; i >= 0; i--, n++)\n {\n if (t[i] == '1')\n {\n res += Pow(n);\n res %= MOD;\n }\n }\n\n return res;\n }\n const long MOD = 1000003;\n public static long Pow(long n)\n {\n if (n == 0)\n return 1;\n\n if (n == 1)\n return 2;\n\n if (n % 2 == 0)\n {\n var t = Pow(n / 2);\n return t * t % MOD;\n }\n return Pow(n - 1) * 2;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8239bc09109cb845d29ca21a0a24610c", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeff//#define ONLINE_JUDGE \n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n#if ! ONLINE_JUDGE\n var fs = new StreamReader(@\"c:\\1.txt\");\n Console.SetIn(fs);\n#endif\n\n Dictionary dd = new Dictionary();\n dd.Add('>', 8);\n dd.Add('<', 9);\n dd.Add('+', 10);\n dd.Add('-', 11);\n dd.Add('.', 12);\n dd.Add(',', 13);\n dd.Add('[', 14);\n dd.Add(']', 15);\n\n var str = Console.ReadLine();\n long ret = 0;\n long limit = 1000003;\n for (int i = 0; i < str.Length; i++)\n {\n\n ret = ((ret << 4)%limit + dd[str[i]]%limit)%limit;\n }\n\n Console.Write(ret.ToString());\n\n#if !ONLINE_JUDGE\n\n fs.Close();\n#endif\n }\n\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eb7456be771a6c0fc1e374a4997584cd", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "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 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 static void Main(string[] args)\n {\n var codes = new Dictionary();\n\n codes['>'] = 8; //\"1000\";\n codes['<'] = 9; //\"1001\";\n codes['+'] = 10; //\"1010\";\n codes['-'] = 11; //\"1011\";\n codes['.'] = 12; //\"1100\";\n codes[','] = 13; //\"1101\";\n codes['['] = 14; //\"1110\";\n codes[']'] = 15; //\"1111\";\n\n\n int ans=0;\n int p = 1000003;\n\n string s = ReadLine();\n\n for (int i = 0; i < s.Length; i++)\n {\n ans = (ans * 16 + codes[s[i]]) % p;\n }\n\n PrintLn(ans);\n\n\n\n }\n\n\n }\n\n \n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "911345c0f751c291517b2cedbf768721", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "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\tvar s = CF.ReadLine();\n\t\tint res = 0;\n\t\tforeach (var c in s)\n\t\t{\n\t\t\tres *= 16;\n\t\t\tswitch (c)\n\t\t\t{\n\t\t\t\tcase '>': res += 8; break;\n\t\t\t\tcase '<': res += 9; break;\n\t\t\t\tcase '+': res += 10; break;\n\t\t\t\tcase '-': res += 11; break;\n\t\t\t\tcase '.': res += 12; break;\n\t\t\t\tcase ',': res += 13; break;\n\t\t\t\tcase '[': res += 14; break;\n\t\t\t\tcase ']': res += 15; break;\n\t\t\t}\n\t\t\tres %= 1000003;\n\t\t}\n\t\tCF.WriteLine(res);\n\t}\n\n\n\n\t// test\n\tstatic Utils CF = new Utils(new[]{\n@\"\n,.\n\"\n,\n@\"\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dba3efc72c146604e771a9caec0afa8a", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "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 Dictionary dict = new Dictionary {{'>', 8}, {'<', 9}, {'+', 10}, {'-', 11}, {'.', 12}, {',', 13}, {'[', 14}, {']', 15}};\n const long m = 1000003;\n string s = reader.ReadLine();\n long ans = 0;\n foreach(char c in s) {\n ans = (ans * 16 + dict[c]) % m;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "559fddf52668e7e44a6d70678c025a55", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace dump\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int cnt = 0;\n foreach (char c in s)\n {\n int x = 0;\n switch (c)\n {\n case '>':\n x = 8;\n break;\n case '<':\n x = 9;\n break;\n case '+':\n x = 10;\n break;\n case '-':\n x = 11;\n break;\n case '.':\n x = 12;\n break;\n case ',':\n x = 13;\n break;\n case '[':\n x = 14;\n break;\n case ']':\n x = 15;\n break;\n }\n cnt = ((cnt<<4)%1000003 + x%1000003)%1000003;\n }\n Console.WriteLine(cnt);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "419ba7b94f78d2a7ae4663537bdbde9d", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\npublic class Program\n{\n static void Main(string[] args)\n {\n Unary u = new Unary();\n //Console.ReadLine();\n }\n}\n\npublic class Unary\n{\n public Unary()\n {\n int i = 0;\n int j = 0;\n int k = 0;\n int tmp = 0;\n int res = 0;\n string x = Console.ReadLine();\n int[] rec = new int[405];\n for (i = x.Length-1; i >=0;i--)\n {\n switch (x[i])\n {\n case '>':\n rec[j++] = 0;\n rec[j++] = 0;\n rec[j++] = 0;\n rec[j++] = 1;\n break;\n case '<':\n rec[j++] = 1;\n rec[j++] = 0;\n rec[j++] = 0;\n rec[j++] = 1;\n break;\n case '+':\n rec[j++] = 0;\n rec[j++] = 1;\n rec[j++] = 0;\n rec[j++] = 1;\n break;\n case '-':\n rec[j++] = 1;\n rec[j++] = 1;\n rec[j++] = 0;\n rec[j++] = 1;\n break;\n case '.':\n rec[j++] = 0;\n rec[j++] = 0;\n rec[j++] = 1;\n rec[j++] = 1;\n break;\n case ',':\n rec[j++] = 1;\n rec[j++] = 0;\n rec[j++] = 1;\n rec[j++] = 1;\n break;\n case '[':\n rec[j++] = 0;\n rec[j++] = 1;\n rec[j++] = 1;\n rec[j++] = 1;\n break;\n case ']':\n rec[j++] = 1;\n rec[j++] = 1;\n rec[j++] = 1;\n rec[j++] = 1;\n break;\n default:\n break;\n }\n }\n for (i = 0; i < j; i++)\n {\n if (rec[i] == 1)\n {\n tmp = 1;\n for (k = 0; k < i; k++)\n {\n tmp <<= 1;\n tmp %= 1000003;\n }\n res += tmp;\n res %= 1000003;\n }\n }\n Console.WriteLine(res);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3299479bdd74b15c3cf85387e438632b", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "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 char[] ch = new char[] { '>', '<', '+', '-', '.', ',', '[', ']' };\n string[] binary = new string[] { \"1000\", \"1001\", \"1010\", \"1011\", \"1100\", \"1101\", \"1110\", \"1111\" };\n string input = Console.ReadLine();\n string output = \"\";\n int i;\n Console.WriteLine(ch.Length);\n foreach (char c in input)\n {\n long k = 0;\n for (i = 0; i < ch.Length; i++)\n {\n if (c == ch[i])\n {\n k = i;\n break;\n }\n }\n Console.WriteLine(binary[i]);\n output += binary[k];\n }\n long n = output.Length;\n long res = 0;\n //Console.WriteLine(n);\n for (i = 0; i < n; i++)\n {\n if (output[i] == '1')\n {\n res += (long)Math.Pow(2, n - i - 1);\n }\n }\n Console.WriteLine(res % 1000003);\n //Console.WriteLine(output);\n //Console.ReadKey();\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1ac813156c96386cd2b0fe887e4aff14", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp5\n{\n public class Program\n {\n static void Main()\n {\n var str = Console.ReadLine();\n var dic = new Dictionary { { '>', \"1000\" }, { '<', \"1001\" }, { '+', \"1010\" }, { '-', \"1011\" }, { '.', \"1100\" }, { ',', \"1101\" }, { '[', \"1110\" }, { ']', \"1111\" } };\n var t = \"\";\n foreach (var s in str)\n t += dic[s];\n\n var res = 0.0;\n var n = 0;\n for (int i = t.Length - 1; i >= 0; i--, n++)\n if (t[i] == '1')\n res += Math.Pow(2, n);\n\n res = res % 1000003;\n Console.WriteLine(res);\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "84a1f8140b5b8107d93c8d0993a4179e", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "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 void Unary()\n {\n //take the input\n string input = Console.ReadLine();\n StringBuilder Binput = new StringBuilder();\n //use the table to get the values\n foreach (char c in input)\n {\n switch (c)\n {\n case '>':\n Binput.Append(\"1000\");\n break;\n case '<':\n Binput.Append(\"1001\");\n break;\n case '+':\n Binput.Append(\"1010\");\n break;\n case '-':\n Binput.Append(\"1011\");\n break;\n case '.':\n Binput.Append(\"1100\");\n break;\n case ',':\n Binput.Append(\"1101\");\n break;\n case '[':\n Binput.Append(\"1110\");\n break;\n case ']':\n Binput.Append(\"1111\");\n break;\n default:\n Console.WriteLine(\"Wrong Token Entered\");\n break;\n }\n }\n //convert to Decimal value\n long output = toDecimal(Binput.ToString());\n output %= 1000003;// 1000003\n Console.WriteLine(output);\n }\n static private long toDecimal(string s)\n {\n long value=0;\n for (int i = 0; i < s.Length; i++)\n {\n value += Convert.ToUInt32(s[i]-'0') * (long)Math.Pow(2, s.Length - i-1);\n }\n\n return value;\n }\n static void Main(string[] args)\n {\n Unary();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "475851d5f5357b093273e96269a37859", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication\n{\n class Program\n {\n static string tobin(string str)\n {\n int k = 0;\n int count = 0, result = 0;\n for (int i = str.Length - 1; i >= 0; --i)\n {\n int j = int.Parse(str[i].ToString());\n\n result += (int)Math.Abs(j * Math.Pow(2.0, count) % 1000003);\n \n count++;\n }\n\n return Math.Abs(result).ToString();\n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string str = \"\";\n\n for (int i = 0; i <= s.Length - 1; i++)\n {\n switch (s[i])\n {\n case '>':\n {\n str += \"1000\";\n break;\n }\n case '<':\n {\n str += \"1001\";\n break;\n }\n case '+':\n {\n str += \"1010\";\n break;\n }\n case '-':\n {\n str += \"1011\";\n break;\n }\n case '.':\n {\n str += \"1100\";\n break;\n }\n case ',':\n {\n str += \"1101\";\n break;\n }\n case '[':\n {\n str += \"1110\";\n break;\n }\n case ']':\n {\n str += \"1111\";\n break;\n }\n }\n }\n\n Console.Write(\"{0}\", Math.Abs(int.Parse(tobin(str))));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c07d3f7edc4b1a2b050c1db8bd688ad3", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeff\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nclass Problem_B\n{\n static int modPow(int a, int n, int m)\n {\n int t = a % m;\n int res = t;\n for (int i = 1; i < n; ++i)\n {\n res = (res * t) % m;\n }\n return res;\n }\n static void Main(string[] args)\n {\n int M = 1000003;\n string line = Console.ReadLine();\n\n int res = 0;\n string binary = \"\";\n for (int i = 0; i < line.Length; ++i)\n {\n switch (line[i])\n {\n case '>': binary += \"1000\"; break;\n case '<': binary += \"1001\"; break;\n case '+': binary += \"1010\"; break;\n case '-': binary += \"1011\"; break;\n case '.': binary += \"1100\"; break;\n case ',': binary += \"1101\"; break;\n case '[': binary += \"1110\"; break;\n case ']': binary += \"1111\"; break;\n }\n }\n\n for (int i = 0; i < binary.Length; ++i)\n {\n if (binary[i] == '1')\n {\n res = (res + modPow(2, binary.Length - i - 1, M)) % M;\n }\n }\n Console.WriteLine(res);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b18c17ac2ca9a27b9bafa89ee12ec78f", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication\n{\n class Program\n {\n static string tobin(string str)\n {\n Int64 k = 0;\n Int64 count = 0, result = 0;\n\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 result += (Int64)Math.Pow(j * 2.0, count);\n count++;\n }\n\n return Math.Abs(result).ToString();\n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string str = \"\";\n\n for (int i = 0; i <= s.Length - 1; i++)\n {\n switch (s[i])\n {\n case '>':\n {\n str += \"1000\";\n break;\n }\n case '<':\n {\n str += \"1001\";\n break;\n }\n case '+':\n {\n str += \"1010\";\n break;\n }\n case '-':\n {\n str += \"1011\";\n break;\n }\n case '.':\n {\n str += \"1100\";\n break;\n }\n case ',':\n {\n str += \"1101\";\n break;\n }\n case '[':\n {\n str += \"1110\";\n break;\n }\n case ']':\n {\n str += \"1111\";\n break;\n }\n }\n }\n\n\n Console.Write(\"{0}\", Int64.Parse(tobin(str)) % 1000003);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad4694017d2a0ee4f84ac2cee9f2d076", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication\n{\n class Program\n {\n static string tobin(string str)\n {\n Int64 k = 0;\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 += (Int64)Math.Pow(j * 2.0, count);\n k += Math.Abs((Int64)Math.Pow(j * 2.0, count) % 1000003);\n }\n count++;\n }\n\n return Math.Abs(k).ToString();\n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string str = \"\";\n\n for (int i = 0; i <= s.Length - 1; i++)\n {\n switch (s[i])\n {\n case '>':\n {\n str += \"1000\";\n break;\n }\n case '<':\n {\n str += \"1001\";\n break;\n }\n case '+':\n {\n str += \"1010\";\n break;\n }\n case '-':\n {\n str += \"1011\";\n break;\n }\n case '.':\n {\n str += \"1100\";\n break;\n }\n case ',':\n {\n str += \"1101\";\n break;\n }\n case '[':\n {\n str += \"1110\";\n break;\n }\n case ']':\n {\n str += \"1111\";\n break;\n }\n }\n }\n\n Console.Write(\"{0}\", Math.Abs(Int64.Parse(tobin(str)) % 1000003));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6242703df1d6f8d791fa505bcc9b869a", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nclass Test{\n static void Main(){\n string [, ] set = {{\">\", \"1000\"}, {\"<\", \"1001\"}, {\"+\", \"1010\"}, {\"-\", \"1011\"}, {\".\", \"1100\"}, {\",\", \"1101\"}, {\"[\", \"1110\"}, {\"]\", \"1111\"}};\n string line = \"\";\n string temp = Console.ReadLine();\n int i = 0, j = 0;\n for(i = 0; i < temp.Length; i++){\n for(j = 0; j < set.GetLength(0); j++){\n if(set[j, 0] == Convert.ToString(temp[i])){\n line += set[j, 1];\n }\n }\n }\n long ans = 0;\n i = line.Length - 1;\n j = 0;\n while(i > -1){\n int line_i = int.Parse(Convert.ToString(line[i]));\n ans += line_i * (long)Math.Pow(2, j);\n ans %= 1000003;\n i--;\n j++;\n }\n Console.WriteLine(ans);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a6de676ec41088f443c5c806ac47103e", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "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 char[] ch = new char[] { '>', '<', '+', '-', '.', ',', '[', ']' };\n string[] binary = new string[] { \"1000\", \"1001\", \"1010\", \"1011\", \"1100\", \"1101\", \"1110\", \"1111\" };\n string input = Console.ReadLine();\n string output = \"\";\n int i , j;\n foreach (char c in input)\n {\n long k = 0;\n for (i = 0; i < ch.Length; i++)\n {\n if (c == ch[i])\n {\n k = i;\n break;\n }\n }\n output += binary[k];\n }\n int n = output.Length;\n //Console.WriteLine(n);\n int res = 0;\n if (n < 21)\n {\n for (i = 0; i < n; i++)\n {\n\n if (output[i] == '1')\n {\n res += (int)Math.Pow(2, n - i - 1);\n }\n }\n }\n else\n {\n for (i = 0; i < n; i++)\n {\n //int res1 = 0;\n int temp = 1;\n if (output[i] == '1')\n {\n for (j = 0; j < n - i - 1; j++)\n {\n temp *= 2;\n temp %= 1000003;\n }\n }\n res += temp;\n //res %= 1000003;\n }\n //Console.WriteLine(res);\n }\n Console.WriteLine(res % 1000003);\n //Console.WriteLine(output);\n //Console.ReadKey();\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4e5a3ad59ce61d97c25543d854a4df93", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Ans\n{\n public int X;\n public int Diff;\n}\n\nclass GFG\n{\n static Dictionary dic = new Dictionary();\n static ulong mod = 1000003;\n\n public static void Main()\n {\n dic.Add('>', \"1000\");\n dic.Add('<', \"1001\");\n dic.Add('+', \"1010\");\n dic.Add('-', \"1011\");\n dic.Add('.', \"1100\");\n dic.Add(',', \"1101\");\n dic.Add('[', \"1110\");\n dic.Add(']', \"1111\");\n\n\n var input = Console.ReadLine().ToArray();\n\n StringBuilder br = new StringBuilder();\n\n for (int i = 0; i < input.Length; i++)\n {\n br.Append(dic[input[i]]);\n }\n ulong decValue = 0;\n ulong baseValue = 1;\n for (int i = br.Length - 1; i >= 0; i--)\n {\n decValue = (decValue + (Convert.ToUInt64(br[i]-'0') * baseValue)) % mod;\n baseValue = baseValue * 2;\n }\n\n Console.Write(decValue);\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c9ee2921202dd8bfe4dc362b817d3682", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "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 void Unary()\n {\n //take the input\n string input = Console.ReadLine();\n StringBuilder Binput = new StringBuilder();\n //use the table to get the values\n foreach (char c in input)\n {\n switch (c)\n {\n case '>':\n Binput.Append(\"1000\");\n break;\n case '<':\n Binput.Append(\"1001\");\n break;\n case '+':\n Binput.Append(\"1010\");\n break;\n case '-':\n Binput.Append(\"1011\");\n break;\n case '.':\n Binput.Append(\"1100\");\n break;\n case ',':\n Binput.Append(\"1101\");\n break;\n case '[':\n Binput.Append(\"1110\");\n break;\n case ']':\n Binput.Append(\"1111\");\n break;\n default:\n Console.WriteLine(\"Wrong Token Entered\");\n break;\n }\n }\n //convert to Decimal value\n long output = toDecimal(Binput.ToString());\n output %= 100003;\n Console.WriteLine(output);\n }\n static private long toDecimal(string s)\n {\n long value=0;\n for (int i = 0; i < s.Length; i++)\n {\n value += Convert.ToUInt32(s[i]-'0') * (long)Math.Pow(2, s.Length - i-1);\n }\n\n return value;\n }\n static void Main(string[] args)\n {\n Unary();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1307fe14486cd885e57479c66da962a5", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "MS C#", "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 Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Long();\n var k = sc.Long();\n var l = sc.Integer();\n ModInteger.Mod = sc.Long();\n ModInteger ans = 1;\n if ((1L << Math.Min(63, l)) <= k) ans = 0;\n for (int i = 0; i < l; i++)\n {\n var mat = new ModMatrix(4, 4);\n mat[0, 0] = mat[0, 1] = mat[0, 2] = 1;\n mat[1, 0] = mat[1, 1] = 1;\n mat[2, 3] = 1;\n mat[3, 2] = mat[3, 3] = 1;\n var res = ModMatrix.Pow(mat, n);\n var vec = new ModMatrix(4, 1);\n vec[3, 0] = 1;\n var C = res * vec;\n var mul = C[2, 0] + C[3, 0];\n if ((k >> i & 1) == 1)\n mul = ModInteger.Pow(2, n) - mul;\n ans *= mul;\n Debug.WriteLine(C[2, 0] + C[3, 0]);\n\n }\n IO.Printer.Out.WriteLine(ans);\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#region Compair\nstatic public class Pair\n{\n static public Pair Create(FT f, ST s)\n where FT : IComparable\n where ST : IComparable\n { return new Pair(f, s); }\n static public Pair Min(Pair p, Pair q)\n where FT : IComparable\n where ST : IComparable\n { return (p.CompareTo(q) <= 0) ? p : q; }\n static public Pair Max(Pair p, Pair q)\n where FT : IComparable\n where ST : IComparable\n { return (p.CompareTo(q) >= 0) ? p : q; }\n}\npublic struct Pair : IComparable>\n where FT : IComparable\n where ST : IComparable\n{\n public FT x;\n public ST y;\n public Pair(FT f, ST s) : this() { x = f; y = s; }\n\n public int CompareTo(Pair other)\n {\n var cmp = x.CompareTo(other.x);\n return cmp != 0 ? cmp : y.CompareTo(other.y);\n }\n public override string ToString() { return string.Format(\"{0} {1}\", x, y); }\n}\n#endregion\n\n#region ModNumber\npublic partial struct ModInteger\n{\n public static 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 ModInteger operator ^(ModInteger l, long r) { return ModInteger.Pow(l, r); }\n public static implicit operator ModInteger(long n) { return new ModInteger(n); }\n public static ModInteger Pow(ModInteger v, long k)\n {\n ModInteger ret = 1;\n var n = k;\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\n#region ModMatrix\npublic class ModMatrix\n{\n int row, col;\n public long[] mat;\n public ModInteger this[int r, int c]\n {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value.num; }\n }\n public ModMatrix(int r, int c)\n {\n row = r; col = c;\n mat = new long[row * col];\n }\n public static ModMatrix operator +(ModMatrix l, ModMatrix r)\n {\n check(l, r);\n var ret = new ModMatrix(l.row, l.col);\n for (int i = 0; i < l.row; i++)\n for (int j = 0; j < l.col; j++)\n {\n ret.mat[i * ret.col + j] = l.mat[i * l.col + j] + r.mat[i * r.col + j];\n if (ret.mat[i * ret.col + j] >= ModInteger.Mod) ret.mat[i * ret.col + j] -= ModInteger.Mod;\n }\n return ret;\n\n }\n public static ModMatrix operator *(ModMatrix l, ModMatrix r)\n {\n checkMul(l, r);\n var ret = new ModMatrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]) % ModInteger.Mod;\n return ret;\n }\n public static ModMatrix Pow(ModMatrix m, long n)\n {\n var ret = new ModMatrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public static ModMatrix[] PowTable(ModMatrix m, int k)\n {\n var ret = new ModMatrix[k];\n ret[0] = m;\n for (int i = 1; i < k; i++)\n ret[i] = ret[i - 1] * ret[i - 1];\n return ret;\n }\n public static ModMatrix PowWithTable(ModMatrix m, long n, ModMatrix[] table)\n {\n var ret = new ModMatrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (int i = 0; i < table.Length; i++)\n {\n if ((n & 1) == 1) ret = ret * table[i];\n }\n return ret;\n }\n public static ModMatrix Trans(ModMatrix m)\n {\n var ret = new ModMatrix(m.col, m.row);\n for (int i = 0; i < m.row; i++)\n for (int j = 0; j < m.col; j++)\n ret.mat[j * m.col + i] = m.mat[i * m.col + j];\n return ret;\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void check(ModMatrix a, ModMatrix b)\n {\n if (a.row != b.row || a.col != b.col)\n throw new Exception(\"row and col have to be same.\");\n\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void checkMul(ModMatrix a, ModMatrix b)\n {\n if (a.col != b.row)\n throw new Exception(\"row and col have to be same.\");\n\n }\n public ModInteger[][] Items\n {\n get\n {\n var a = new ModInteger[row][];\n for (int i = 0; i < row; i++)\n {\n a[i] = new ModInteger[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n public override string ToString()\n {\n return string.Format(\"{0}*{1}\", row, col);\n }\n public void Visualize()\n {\n var items = Items;\n foreach (var x in items)\n System.Diagnostics.Debug.WriteLine(x.AsJoinedString(\"\\t\"));\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b1ed6bc5c525a581dd9dcc61f3f0825", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "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 Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Long();\n var k = sc.Long();\n var l = sc.Integer();\n ModInteger.Mod = sc.Long();\n ModInteger ans = 1;\n if (1L << l <= k) ans = 0;\n for (int i = 0; i < l; i++)\n {\n var mat = new ModMatrix(4, 4);\n mat[0, 0] = mat[0, 1] = mat[0, 2] = 1;\n mat[1, 0] = mat[1, 1] = 1;\n mat[2, 3] = 1;\n mat[3, 2] = mat[3, 3] = 1;\n var res = ModMatrix.Pow(mat, n);\n var vec = new ModMatrix(4, 1);\n vec[3, 0] = 1;\n var C = res * vec;\n var mul = C[2, 0] + C[3, 0];\n if ((k >> i & 1) == 1)\n mul = ModInteger.Pow(2, n) - mul;\n ans *= mul;\n Debug.WriteLine(C[2, 0] + C[3, 0]);\n\n }\n IO.Printer.Out.WriteLine(ans);\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#region Compair\nstatic public class Pair\n{\n static public Pair Create(FT f, ST s)\n where FT : IComparable\n where ST : IComparable\n { return new Pair(f, s); }\n static public Pair Min(Pair p, Pair q)\n where FT : IComparable\n where ST : IComparable\n { return (p.CompareTo(q) <= 0) ? p : q; }\n static public Pair Max(Pair p, Pair q)\n where FT : IComparable\n where ST : IComparable\n { return (p.CompareTo(q) >= 0) ? p : q; }\n}\npublic struct Pair : IComparable>\n where FT : IComparable\n where ST : IComparable\n{\n public FT x;\n public ST y;\n public Pair(FT f, ST s) : this() { x = f; y = s; }\n\n public int CompareTo(Pair other)\n {\n var cmp = x.CompareTo(other.x);\n return cmp != 0 ? cmp : y.CompareTo(other.y);\n }\n public override string ToString() { return string.Format(\"{0} {1}\", x, y); }\n}\n#endregion\n\n#region ModNumber\npublic partial struct ModInteger\n{\n public static 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 ModInteger operator ^(ModInteger l, long r) { return ModInteger.Pow(l, r); }\n public static implicit operator ModInteger(long n) { return new ModInteger(n); }\n public static ModInteger Pow(ModInteger v, long k)\n {\n ModInteger ret = 1;\n var n = k;\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\n#region ModMatrix\npublic class ModMatrix\n{\n int row, col;\n public long[] mat;\n public ModInteger this[int r, int c]\n {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value.num; }\n }\n public ModMatrix(int r, int c)\n {\n row = r; col = c;\n mat = new long[row * col];\n }\n public static ModMatrix operator +(ModMatrix l, ModMatrix r)\n {\n check(l, r);\n var ret = new ModMatrix(l.row, l.col);\n for (int i = 0; i < l.row; i++)\n for (int j = 0; j < l.col; j++)\n {\n ret.mat[i * ret.col + j] = l.mat[i * l.col + j] + r.mat[i * r.col + j];\n if (ret.mat[i * ret.col + j] >= ModInteger.Mod) ret.mat[i * ret.col + j] -= ModInteger.Mod;\n }\n return ret;\n\n }\n public static ModMatrix operator *(ModMatrix l, ModMatrix r)\n {\n checkMul(l, r);\n var ret = new ModMatrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]) % ModInteger.Mod;\n return ret;\n }\n public static ModMatrix Pow(ModMatrix m, long n)\n {\n var ret = new ModMatrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public static ModMatrix[] PowTable(ModMatrix m, int k)\n {\n var ret = new ModMatrix[k];\n ret[0] = m;\n for (int i = 1; i < k; i++)\n ret[i] = ret[i - 1] * ret[i - 1];\n return ret;\n }\n public static ModMatrix PowWithTable(ModMatrix m, long n, ModMatrix[] table)\n {\n var ret = new ModMatrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (int i = 0; i < table.Length; i++)\n {\n if ((n & 1) == 1) ret = ret * table[i];\n }\n return ret;\n }\n public static ModMatrix Trans(ModMatrix m)\n {\n var ret = new ModMatrix(m.col, m.row);\n for (int i = 0; i < m.row; i++)\n for (int j = 0; j < m.col; j++)\n ret.mat[j * m.col + i] = m.mat[i * m.col + j];\n return ret;\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void check(ModMatrix a, ModMatrix b)\n {\n if (a.row != b.row || a.col != b.col)\n throw new Exception(\"row and col have to be same.\");\n\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void checkMul(ModMatrix a, ModMatrix b)\n {\n if (a.col != b.row)\n throw new Exception(\"row and col have to be same.\");\n\n }\n public ModInteger[][] Items\n {\n get\n {\n var a = new ModInteger[row][];\n for (int i = 0; i < row; i++)\n {\n a[i] = new ModInteger[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n public override string ToString()\n {\n return string.Format(\"{0}*{1}\", row, col);\n }\n public void Visualize()\n {\n var items = Items;\n foreach (var x in items)\n System.Diagnostics.Debug.WriteLine(x.AsJoinedString(\"\\t\"));\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7e83530ccf3aed06ac881a5dba2328c7", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "\ufeff\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 MOD;\n\n long[,] MatMult(long[,] a, long[,] b, int n)\n {\n var ret = new long[n, n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n for (int k = 0; k < n; k++)\n ret[i, j] = (ret[i, j] + a[i, k] * b[k, j]) % MOD;\n return ret;\n }\n\n long[,] MatPow(long[,] a, int n, long p)\n {\n var ret = new long[n, n];\n for (int i = 0; i < n; i++)\n ret[i, i] = 1;\n while (p > 0)\n {\n if ((p & 1) == 1)\n ret = MatMult(ret, a, n);\n a = MatMult(a, a, n);\n p >>= 1;\n }\n return ret;\n }\n\n long Fib(long n)\n {\n var a = new long[,] { { 1, 1 }, { 1, 0 } };\n a = MatPow(a, 2, n + 1);\n return a[0, 0];\n }\n\n int 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 (int)ret;\n }\n\n void Solve()\n {\n long n = ReadLong();\n long k = ReadLong();\n int l = ReadInt();\n MOD = ReadInt();\n\n long f = Fib(n);\n long p = (ModPow(2, n) + MOD - f) % MOD;\n long ans = 1;\n for (int i = 0; i < l; i++)\n if ((k >> i & 1) == 1)\n ans = ans * p % MOD;\n else\n ans = ans * f % MOD;\n \n if ((k >> l) != 0)\n Write(0);\n else\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)\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bdccf1a2d8ec005c32f7ba7db522a06c", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static int M;\n\n static void Main(string[] args)\n {\n long[] q1 = Console.ReadLine().Split(' ').Select(t => Int64.Parse(t)).ToArray();\n long N = q1[0];\n long K = q1[1];\n int L = (int)q1[2];\n M = (int)q1[3];\n\n int[, , ,] dp = new int[65, 2, 2, 2]; // gen, result, head, tail\n dp[0, 0, 0, 0] = 1;\n dp[0, 0, 1, 1] = 1;\n\n int[,] accum = null;\n\n for (int i = 1; i <= 64; ++i)\n {\n int[,] prevAccum = null;\n if (((1L << i - 1) & N) != 0)\n {\n if (accum == null)\n {\n accum = new int[2, 2]; // result, tail\n accum[0, 0] = (int)(((long)dp[i - 1, 0, 0, 0] + (long)dp[i - 1, 0, 1, 0]) % M);\n accum[0, 1] = (int)(((long)dp[i - 1, 0, 0, 1] + (long)dp[i - 1, 0, 1, 1]) % M);\n accum[1, 0] = (int)(((long)dp[i - 1, 1, 0, 0] + (long)dp[i - 1, 1, 1, 0]) % M);\n accum[1, 1] = (int)(((long)dp[i - 1, 1, 0, 1] + (long)dp[i - 1, 1, 1, 1]) % M);\n }\n else\n {\n prevAccum = accum;\n accum = new int[2, 2];\n }\n }\n \n for (int leftRes = 0; leftRes <= 1; ++leftRes)\n {\n for (int leftTail = 0; leftTail <= 1; ++leftTail)\n {\n for (int rightRes = 0; rightRes <= 1; ++rightRes)\n {\n for (int rightHead = 0; rightHead <= 1; ++rightHead)\n {\n for (int rightTail = 0; rightTail <= 1; ++rightTail)\n {\n int res = leftRes | rightRes | (leftTail & rightHead);\n for (int leftHead = 0; leftHead <= 1; ++leftHead)\n {\n long t = (long)dp[i, res, leftHead, rightTail] +\n (long)dp[i - 1, leftRes, leftHead, leftTail] * (long)dp[i - 1, rightRes, rightHead, rightTail];\n\n dp[i, res, leftHead, rightTail] = (int)(t % M);\n }\n\n if (prevAccum != null)\n {\n long t = (long)accum[res, rightTail] +\n (long)prevAccum[leftRes, leftTail] * (long)dp[i - 1, rightRes, rightHead, rightTail];\n accum[res, rightTail] = (int)(t % M);\n }\n }\n }\n }\n }\n }\n }\n\n\n int total = 1;\n for (int i = 0; i < L; ++i)\n {\n if (((1L << i) & K) != 0)\n {\n total = (int)(((long)total * ((long)accum[1, 0] + (long)accum[1, 1])) % M);\n }\n else\n {\n total = (int)(((long)total * ((long)accum[0, 0] + (long)accum[0, 1])) % M);\n }\n }\n\n for (int i = L; i < 64; ++i)\n {\n if (((1L << i) & K) != 0)\n {\n total = 0;\n break;\n }\n }\n\n Console.WriteLine(total);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fb1d5d61e0bb36aff67de4c6881eab49", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "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 _307d\n{\n\tclass Program\n\t{\n\t\tstatic string _inputFilename = \"input.txt\";\n\t\tstatic string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n\t\tstatic bool _useFileInput = false;\n#endif\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\ttry\n\t\t\t{\n\t\t\t\tsolution();\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tif (_useFileInput)\n\t\t\t\t{\n\t\t\t\t\tfile.Close();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstatic void solution()\n\t\t{\n\t\t\t#region SOLUTION\n\t\t\tvar d = readLongArray();\n\t\t\tvar n = d[0];\n\t\t\tvar k = d[1];\n\t\t\tvar l = (int)d[2];\n\t\t\tvar m = d[3];\n\n\t\t\tfor (int i = l; i < 64; i++)\n\t\t\t{\n\t\t\t\tif (((1L << i) & k) != 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar fim = new Matrix { _11 = 0, _12 = 1, _21 = 1, _22 = 1 };\n\t\t\t//fim.Print();\n\t\t\tvar sq = pow(fim, n - 1, m);\n\t\t\t//sq.Print();\n\n\t\t\tvar fn0 = (sq._21 + sq._22) % m;\n\t\t\tvar fn1 = (sq._11 + sq._12) % m;\n\t\t\tvar fr = (fn0 + fn1) % m;\n\n\t\t\t//var fi = new int[n + 1];\n\t\t\t//fi[0] = 1;\n\t\t\t//fi[1] = 1;\n\t\t\t//for (int i = 2; i < n + 1; i++)\n\t\t\t//{\n\t\t\t//\tfi[i] = fi[i - 1] + fi[i - 2];\n\t\t\t//}\n\n\t\t\tvar nc = pow(2, n, m);\n\t\t\tnc -= fr;\n\t\t\tif (nc < 0)\n\t\t\t{\n\t\t\t\tnc += m;\n\t\t\t}\n\t\t\t//nc *= ((n - 1) % m);\n\t\t\tnc %= m;\n\n\t\t\tvar nmod = n % m;\n\t\t\tvar res = 1L;\n\t\t\tfor (int i = 0; i < l; i++)\n\t\t\t{\n\t\t\t\tif (((1L << i) & k) != 0)\n\t\t\t\t{\n\t\t\t\t\tres *= nc;\n\t\t\t\t\tres %= m;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tres *= fr;\n\t\t\t\t\tres %= m;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(res);\n\n\t\t\t//var n = readInt();\n\t\t\t//var m = readInt();\n\n\t\t\t//var a = readIntArray();\n\t\t\t//var b = readIntArray();\n\t\t\t#endregion\n\t\t}\n\n\t\tclass Matrix\n\t\t{\n\t\t\tpublic long _11;\n\t\t\tpublic long _12;\n\t\t\tpublic long _21;\n\t\t\tpublic long _22;\n\n\t\t\tpublic void Mult(Matrix x, long mod)\n\t\t\t{\n\t\t\t\tvar __11 = (_11 * x._11) % mod + (_12 * x._21) % mod;\n\t\t\t\tvar __12 = (_11 * x._21) % mod + (_12 * x._22) % mod;\n\t\t\t\tvar __21 = (_21 * x._11) % mod + (_22 * x._21) % mod;\n\t\t\t\tvar __22 = (_21 * x._21) % mod + (_22 * x._22) % mod;\n\n\t\t\t\t_11 = __11 % mod;\n\t\t\t\t_12 = __12 % mod;\n\t\t\t\t_21 = __21 % mod;\n\t\t\t\t_22 = __22 % mod;\n\t\t\t}\n\n\t\t\tpublic void Square(long mod)\n\t\t\t{\n\t\t\t\tMult(this, mod);\n\t\t\t}\n\n\t\t\tpublic void Print()\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0} {1}\", _11, _12);\n\t\t\t\tConsole.WriteLine(\"{0} {1}\", _21, _22);\n\t\t\t\tConsole.WriteLine();\n\t\t\t}\n\t\t}\n\n\t\tstatic Matrix pow(Matrix x, long p, long mod)\n\t\t{\n\t\t\t//p %= mod;\n\n\t\t\tvar res = new Matrix() { _11 = 1, _22 = 1 };\n\t\t\tvar a = new Matrix() { _11 = x._11, _12 = x._12, _21 = x._21, _22 = x._22 };\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (p % 2 == 1)\n\t\t\t\t{\n\t\t\t\t\tres.Mult(a, mod);\n\t\t\t\t\tp--;\n\t\t\t\t}\n\n\t\t\t\tif (p == 0)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tp /= 2;\n\t\t\t\ta.Square(mod);\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic long pow(long x, long p, long mod)\n\t\t{\n\t\t\tx %= mod;\n\t\t\t//p %= mod;\n\n\t\t\tvar res = 1L;\n\t\t\tvar a = x;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (p % 2 == 1)\n\t\t\t\t{\n\t\t\t\t\tres *= a;\n\t\t\t\t\tres %= mod;\n\t\t\t\t\tp--;\n\t\t\t\t}\n\n\t\t\t\tif (p == 0)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tp /= 2;\n\t\t\t\ta *= a;\n\t\t\t\ta %= mod;\n\t\t\t}\n\n\t\t\treturn res;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "17046dc3d2624278e23cfbd4e50da7ff", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "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 _307d\n{\n\tclass Program\n\t{\n\t\tstatic string _inputFilename = \"input.txt\";\n\t\tstatic string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n\t\tstatic bool _useFileInput = false;\n#endif\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\ttry\n\t\t\t{\n\t\t\t\tsolution();\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tif (_useFileInput)\n\t\t\t\t{\n\t\t\t\t\tfile.Close();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstatic void solution()\n\t\t{\n\t\t\t#region SOLUTION\n\t\t\tvar d = readLongArray();\n\t\t\tvar n = d[0];\n\t\t\tvar k = d[1];\n\t\t\tvar l = (int)d[2];\n\t\t\tvar m = d[3];\n\n\t\t\tfor (int i = l; i < 64; i++)\n\t\t\t{\n\t\t\t\tif (((1L << i) & k) != 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar fim = new Matrix { _11 = 0, _12 = 1, _21 = 1, _22 = 1 };\n\t\t\t//fim.Print();\n\t\t\tvar sq = pow(fim, n - 1, m);\n\t\t\t//sq.Print();\n\n\t\t\tvar fn0 = (sq._21 + sq._22) % m;\n\t\t\tvar fn1 = (sq._11 + sq._12) % m;\n\t\t\tvar fr = (fn0 + fn1) % m;\n\n\t\t\tvar nc = pow(2, n, m);\n\t\t\tnc -= fr;\n\t\t\tif (nc < 0)\n\t\t\t{\n\t\t\t\tnc += m;\n\t\t\t}\n\t\t\t//nc *= ((n - 1) % m);\n\t\t\tnc %= m;\n\n\t\t\tvar nmod = n % m;\n\t\t\tvar res = 1L;\n\t\t\tfor (int i = 0; i < l; i++)\n\t\t\t{\n\t\t\t\tif (((1L << i) & k) != 0)\n\t\t\t\t{\n\t\t\t\t\tres *= nc;\n\t\t\t\t\tres %= m;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tres *= fr;\n\t\t\t\t\tres %= m;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(res);\n\n\t\t\t//var n = readInt();\n\t\t\t//var m = readInt();\n\n\t\t\t//var a = readIntArray();\n\t\t\t//var b = readIntArray();\n\t\t\t#endregion\n\t\t}\n\n\t\tclass Matrix\n\t\t{\n\t\t\tpublic long _11;\n\t\t\tpublic long _12;\n\t\t\tpublic long _21;\n\t\t\tpublic long _22;\n\n\t\t\tpublic void Mult(Matrix x, long mod)\n\t\t\t{\n\t\t\t\tvar __11 = (_11 * x._11) % mod + (_12 * x._21) % mod;\n\t\t\t\tvar __12 = (_11 * x._21) % mod + (_12 * x._22) % mod;\n\t\t\t\tvar __21 = (_21 * x._11) % mod + (_22 * x._21) % mod;\n\t\t\t\tvar __22 = (_21 * x._21) % mod + (_22 * x._22) % mod;\n\n\t\t\t\t_11 = __11 % mod;\n\t\t\t\t_12 = __12 % mod;\n\t\t\t\t_21 = __21 % mod;\n\t\t\t\t_22 = __22 % mod;\n\t\t\t}\n\n\t\t\tpublic void Square(long mod)\n\t\t\t{\n\t\t\t\tMult(this, mod);\n\t\t\t}\n\n\t\t\tpublic void Print()\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0} {1}\", _11, _12);\n\t\t\t\tConsole.WriteLine(\"{0} {1}\", _21, _22);\n\t\t\t\tConsole.WriteLine();\n\t\t\t}\n\t\t}\n\n\t\tstatic Matrix pow(Matrix x, long p, long mod)\n\t\t{\n\t\t\tvar res = new Matrix() { _11 = 1, _22 = 1 };\n\t\t\tvar a = new Matrix() { _11 = x._11, _12 = x._12, _21 = x._21, _22 = x._22 };\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (p % 2 == 1)\n\t\t\t\t{\n\t\t\t\t\tres.Mult(a, mod);\n\t\t\t\t\tp--;\n\t\t\t\t}\n\n\t\t\t\tif (p == 0)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tp /= 2;\n\t\t\t\ta.Square(mod);\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic long pow(long x, long p, long mod)\n\t\t{\n\t\t\tx %= mod;\n\t\t\tp %= mod;\n\n\t\t\tvar res = 1L;\n\t\t\tvar a = x;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (p % 2 == 1)\n\t\t\t\t{\n\t\t\t\t\tres *= a;\n\t\t\t\t\tres %= mod;\n\t\t\t\t\tp--;\n\t\t\t\t}\n\n\t\t\t\tif (p == 0)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tp /= 2;\n\t\t\t\ta *= a;\n\t\t\t\ta %= mod;\n\t\t\t}\n\n\t\t\treturn res;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8646b3a4cef770d7f47bffbc14775208", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "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 Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Long();\n var k = sc.Long();\n var l = sc.Integer();\n ModInteger.Mod = sc.Long();\n ModInteger ans = 1;\n for (int i = 0; i < l; i++)\n {\n var mat = new ModMatrix(4, 4);\n mat[0, 0] = mat[0, 1] = mat[0, 2] = 1;\n mat[1, 0] = mat[1, 1] = 1;\n mat[2, 3] = 1;\n mat[3, 2] = mat[3, 3] = 1;\n var res = ModMatrix.Pow(mat, n);\n var vec = new ModMatrix(4, 1);\n vec[3, 0] = 1;\n var C = res * vec;\n var to = (int)(k >> i & 1);\n if (to == 1) to = 0;\n else to = 2;\n ans *= C[to, 0] + C[to + 1, 0];\n }\n IO.Printer.Out.WriteLine(ans);\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#region Compair\nstatic public class Pair\n{\n static public Pair Create(FT f, ST s)\n where FT : IComparable\n where ST : IComparable\n { return new Pair(f, s); }\n static public Pair Min(Pair p, Pair q)\n where FT : IComparable\n where ST : IComparable\n { return (p.CompareTo(q) <= 0) ? p : q; }\n static public Pair Max(Pair p, Pair q)\n where FT : IComparable\n where ST : IComparable\n { return (p.CompareTo(q) >= 0) ? p : q; }\n}\npublic struct Pair : IComparable>\n where FT : IComparable\n where ST : IComparable\n{\n public FT x;\n public ST y;\n public Pair(FT f, ST s) : this() { x = f; y = s; }\n\n public int CompareTo(Pair other)\n {\n var cmp = x.CompareTo(other.x);\n return cmp != 0 ? cmp : y.CompareTo(other.y);\n }\n public override string ToString() { return string.Format(\"{0} {1}\", x, y); }\n}\n#endregion\n\n#region ModNumber\npublic partial struct ModInteger\n{\n public static 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 ModInteger operator ^(ModInteger l, long r) { return ModInteger.Pow(l, r); }\n public static implicit operator ModInteger(long n) { return new ModInteger(n); }\n public static ModInteger Pow(ModInteger v, long k)\n {\n ModInteger ret = 1;\n var n = k;\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\n#region ModMatrix\npublic class ModMatrix\n{\n int row, col;\n public long[] mat;\n public ModInteger this[int r, int c]\n {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value.num; }\n }\n public ModMatrix(int r, int c)\n {\n row = r; col = c;\n mat = new long[row * col];\n }\n public static ModMatrix operator +(ModMatrix l, ModMatrix r)\n {\n check(l, r);\n var ret = new ModMatrix(l.row, l.col);\n for (int i = 0; i < l.row; i++)\n for (int j = 0; j < l.col; j++)\n {\n ret.mat[i * ret.col + j] = l.mat[i * l.col + j] + r.mat[i * r.col + j];\n if (ret.mat[i * ret.col + j] >= ModInteger.Mod) ret.mat[i * ret.col + j] -= ModInteger.Mod;\n }\n return ret;\n\n }\n public static ModMatrix operator *(ModMatrix l, ModMatrix r)\n {\n checkMul(l, r);\n var ret = new ModMatrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]) % ModInteger.Mod;\n return ret;\n }\n public static ModMatrix Pow(ModMatrix m, long n)\n {\n var ret = new ModMatrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public static ModMatrix[] PowTable(ModMatrix m, int k)\n {\n var ret = new ModMatrix[k];\n ret[0] = m;\n for (int i = 1; i < k; i++)\n ret[i] = ret[i - 1] * ret[i - 1];\n return ret;\n }\n public static ModMatrix PowWithTable(ModMatrix m, long n, ModMatrix[] table)\n {\n var ret = new ModMatrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (int i = 0; i < table.Length; i++)\n {\n if ((n & 1) == 1) ret = ret * table[i];\n }\n return ret;\n }\n public static ModMatrix Trans(ModMatrix m)\n {\n var ret = new ModMatrix(m.col, m.row);\n for (int i = 0; i < m.row; i++)\n for (int j = 0; j < m.col; j++)\n ret.mat[j * m.col + i] = m.mat[i * m.col + j];\n return ret;\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void check(ModMatrix a, ModMatrix b)\n {\n if (a.row != b.row || a.col != b.col)\n throw new Exception(\"row and col have to be same.\");\n\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void checkMul(ModMatrix a, ModMatrix b)\n {\n if (a.col != b.row)\n throw new Exception(\"row and col have to be same.\");\n\n }\n public ModInteger[][] Items\n {\n get\n {\n var a = new ModInteger[row][];\n for (int i = 0; i < row; i++)\n {\n a[i] = new ModInteger[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n public override string ToString()\n {\n return string.Format(\"{0}*{1}\", row, col);\n }\n public void Visualize()\n {\n var items = Items;\n foreach (var x in items)\n System.Diagnostics.Debug.WriteLine(x.AsJoinedString(\"\\t\"));\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b48c71f85efc8034a9b8407add6d5bcd", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "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 MOD;\n\n long[,] MatMult(long[,] a, long[,] b, int n)\n {\n var ret = new long[n, n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n for (int k = 0; k < n; k++)\n ret[i, j] = (ret[i, j] + a[i, k] * b[k, j]) % MOD;\n return ret;\n }\n\n long[,] MatPow(long[,] a, int n, long p)\n {\n var ret = new long[n, n];\n for (int i = 0; i < n; i++)\n ret[i, i] = 1;\n while (p > 0)\n {\n if ((p & 1) == 1)\n ret = MatMult(ret, a, n);\n a = MatMult(a, a, n);\n p >>= 1;\n }\n return ret;\n }\n\n long Fib(long n)\n {\n var a = new long[,] { { 1, 1 }, { 1, 0 } };\n a = MatPow(a, 2, n + 1);\n return a[0, 0];\n }\n\n int 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 (int)ret;\n }\n\n void Solve()\n {\n long n = ReadLong();\n long k = ReadLong();\n int l = ReadInt();\n MOD = ReadInt();\n\n long f = Fib(n);\n long p = (ModPow(2, n) + MOD - f) % MOD;\n long ans = 1;\n for (int i = 0; i < l; i++)\n if ((k >> i & 1) == 1)\n ans = ans * p % MOD;\n else\n ans = ans * f % MOD;\n \n if (l < 60 && (k >> l) != 0)\n Write(0);\n else\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)\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bf72bf4bc7ab89ef788ce22667582c61", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static int M;\n\n static void Main(string[] args)\n {\n long[] q1 = Console.ReadLine().Split(' ').Select(t => Int64.Parse(t)).ToArray();\n long N = q1[0];\n long K = q1[1];\n int L = (int)q1[2];\n M = (int)q1[3];\n\n int[, , ,] dp = new int[65, 2, 2, 2]; // gen, result, head, tail\n dp[0, 0, 0, 0] = 1;\n dp[0, 0, 1, 1] = 1;\n\n int[,] accum = null;\n\n for (int i = 1; i <= 64; ++i)\n {\n int[,] prevAccum = null;\n if (((1L << i - 1) & N) != 0)\n {\n if (accum == null)\n {\n accum = new int[2, 2]; // result, tail\n accum[0, 0] = (int)(((long)dp[i - 1, 0, 0, 0] + (long)dp[i - 1, 0, 1, 0]) % M);\n accum[0, 1] = (int)(((long)dp[i - 1, 0, 0, 1] + (long)dp[i - 1, 0, 1, 1]) % M);\n accum[1, 0] = (int)(((long)dp[i - 1, 1, 0, 0] + (long)dp[i - 1, 1, 1, 0]) % M);\n accum[1, 1] = (int)(((long)dp[i - 1, 1, 0, 1] + (long)dp[i - 1, 1, 1, 1]) % M);\n }\n else\n {\n prevAccum = accum;\n accum = new int[2, 2];\n }\n }\n \n for (int leftRes = 0; leftRes <= 1; ++leftRes)\n {\n for (int leftTail = 0; leftTail <= 1; ++leftTail)\n {\n for (int rightRes = 0; rightRes <= 1; ++rightRes)\n {\n for (int rightHead = 0; rightHead <= 1; ++rightHead)\n {\n for (int rightTail = 0; rightTail <= 1; ++rightTail)\n {\n int res = leftRes | rightRes | (leftTail & rightHead);\n for (int leftHead = 0; leftHead <= 1; ++leftHead)\n {\n long t = (long)dp[i, res, leftHead, rightTail] +\n (long)dp[i - 1, leftRes, leftHead, leftTail] * (long)dp[i - 1, rightRes, rightHead, rightTail];\n\n dp[i, res, leftHead, rightTail] = (int)(t % M);\n }\n\n if (prevAccum != null)\n {\n long t = (long)accum[res, rightTail] +\n (long)prevAccum[leftRes, leftTail] * (long)dp[i - 1, rightRes, rightHead, rightTail];\n accum[res, rightTail] = (int)(t % M);\n }\n }\n }\n }\n }\n }\n }\n\n\n int total = 1 % M;\n for (int i = 0; i < L; ++i)\n {\n if (((1L << i) & K) != 0)\n {\n total = (int)(((long)total * ((long)accum[1, 0] + (long)accum[1, 1])) % M);\n }\n else\n {\n total = (int)(((long)total * ((long)accum[0, 0] + (long)accum[0, 1])) % M);\n }\n }\n\n for (int i = L; i < 64; ++i)\n {\n if (((1L << i) & K) != 0)\n {\n total = 0;\n break;\n }\n }\n\n Console.WriteLine(total);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "badd82b159269f1e50cdd4162eb40100", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "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 Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Long();\n var k = sc.Long();\n var l = sc.Integer();\n ModInteger.Mod = sc.Long();\n ModInteger ans = 1;\n if ((1L << Math.Min(62, l)) <= k)\n ans = 0;\n for (int i = 0; i < l; i++)\n {\n var mat = new ModMatrix(4, 4);\n mat[0, 0] = mat[0, 1] = mat[0, 2] = 1;\n mat[1, 0] = mat[1, 1] = 1;\n mat[2, 3] = 1;\n mat[3, 2] = mat[3, 3] = 1;\n var res = ModMatrix.Pow(mat, n);\n var vec = new ModMatrix(4, 1);\n vec[3, 0] = 1;\n var C = res * vec;\n var mul = C[2, 0] + C[3, 0];\n if ((k >> i & 1) == 1)\n mul = ModInteger.Pow(2, n) - mul;\n ans *= mul;\n Debug.WriteLine(C[2, 0] + C[3, 0]);\n\n }\n IO.Printer.Out.WriteLine(ans);\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#region Compair\nstatic public class Pair\n{\n static public Pair Create(FT f, ST s)\n where FT : IComparable\n where ST : IComparable\n { return new Pair(f, s); }\n static public Pair Min(Pair p, Pair q)\n where FT : IComparable\n where ST : IComparable\n { return (p.CompareTo(q) <= 0) ? p : q; }\n static public Pair Max(Pair p, Pair q)\n where FT : IComparable\n where ST : IComparable\n { return (p.CompareTo(q) >= 0) ? p : q; }\n}\npublic struct Pair : IComparable>\n where FT : IComparable\n where ST : IComparable\n{\n public FT x;\n public ST y;\n public Pair(FT f, ST s) : this() { x = f; y = s; }\n\n public int CompareTo(Pair other)\n {\n var cmp = x.CompareTo(other.x);\n return cmp != 0 ? cmp : y.CompareTo(other.y);\n }\n public override string ToString() { return string.Format(\"{0} {1}\", x, y); }\n}\n#endregion\n\n#region ModNumber\npublic partial struct ModInteger\n{\n public static 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 ModInteger operator ^(ModInteger l, long r) { return ModInteger.Pow(l, r); }\n public static implicit operator ModInteger(long n) { return new ModInteger(n); }\n public static ModInteger Pow(ModInteger v, long k)\n {\n ModInteger ret = 1;\n var n = k;\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\n#region ModMatrix\npublic class ModMatrix\n{\n int row, col;\n public long[] mat;\n public ModInteger this[int r, int c]\n {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value.num; }\n }\n public ModMatrix(int r, int c)\n {\n row = r; col = c;\n mat = new long[row * col];\n }\n public static ModMatrix operator +(ModMatrix l, ModMatrix r)\n {\n check(l, r);\n var ret = new ModMatrix(l.row, l.col);\n for (int i = 0; i < l.row; i++)\n for (int j = 0; j < l.col; j++)\n {\n ret.mat[i * ret.col + j] = l.mat[i * l.col + j] + r.mat[i * r.col + j];\n if (ret.mat[i * ret.col + j] >= ModInteger.Mod) ret.mat[i * ret.col + j] -= ModInteger.Mod;\n }\n return ret;\n\n }\n public static ModMatrix operator *(ModMatrix l, ModMatrix r)\n {\n checkMul(l, r);\n var ret = new ModMatrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]) % ModInteger.Mod;\n return ret;\n }\n public static ModMatrix Pow(ModMatrix m, long n)\n {\n var ret = new ModMatrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public static ModMatrix[] PowTable(ModMatrix m, int k)\n {\n var ret = new ModMatrix[k];\n ret[0] = m;\n for (int i = 1; i < k; i++)\n ret[i] = ret[i - 1] * ret[i - 1];\n return ret;\n }\n public static ModMatrix PowWithTable(ModMatrix m, long n, ModMatrix[] table)\n {\n var ret = new ModMatrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (int i = 0; i < table.Length; i++)\n {\n if ((n & 1) == 1) ret = ret * table[i];\n }\n return ret;\n }\n public static ModMatrix Trans(ModMatrix m)\n {\n var ret = new ModMatrix(m.col, m.row);\n for (int i = 0; i < m.row; i++)\n for (int j = 0; j < m.col; j++)\n ret.mat[j * m.col + i] = m.mat[i * m.col + j];\n return ret;\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void check(ModMatrix a, ModMatrix b)\n {\n if (a.row != b.row || a.col != b.col)\n throw new Exception(\"row and col have to be same.\");\n\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void checkMul(ModMatrix a, ModMatrix b)\n {\n if (a.col != b.row)\n throw new Exception(\"row and col have to be same.\");\n\n }\n public ModInteger[][] Items\n {\n get\n {\n var a = new ModInteger[row][];\n for (int i = 0; i < row; i++)\n {\n a[i] = new ModInteger[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n public override string ToString()\n {\n return string.Format(\"{0}*{1}\", row, col);\n }\n public void Visualize()\n {\n var items = Items;\n foreach (var x in items)\n System.Diagnostics.Debug.WriteLine(x.AsJoinedString(\"\\t\"));\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "46ad9d8ed0275db9bd3c37b50e0e1449", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "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 MOD;\n\n long[,] MatMult(long[,] a, long[,] b, int n)\n {\n var ret = new long[n, n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n for (int k = 0; k < n; k++)\n ret[i, j] = (ret[i, j] + a[i, k] * b[k, j]) % MOD;\n return ret;\n }\n\n long[,] MatPow(long[,] a, int n, long p)\n {\n var ret = new long[n, n];\n for (int i = 0; i < n; i++)\n ret[i, i] = 1;\n while (p > 0)\n {\n if ((p & 1) == 1)\n ret = MatMult(ret, a, n);\n a = MatMult(a, a, n);\n p >>= 1;\n }\n return ret;\n }\n\n long Fib(long n)\n {\n var a = new long[,] { { 1, 1 }, { 1, 0 } };\n a = MatPow(a, 2, n + 1);\n return a[0, 0];\n }\n\n int 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 (int)ret;\n }\n\n void Solve()\n {\n long n = ReadLong();\n long k = ReadLong();\n int l = ReadInt();\n MOD = ReadInt();\n\n long f = Fib(n);\n long p = (ModPow(2, n) + MOD - f) % MOD;\n long ans = 1;\n for (int i = 0; i < l; i++)\n if ((k >> i & 1) == 1)\n ans = ans * p % MOD;\n else\n ans = ans * f % MOD;\n \n if (l < 60 && (k >> l) != 0)\n Write(0);\n else\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(\"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)\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "89540cead47899c948402ea6efbc6e62", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "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 _307d\n{\n\tclass Program\n\t{\n\t\tstatic string _inputFilename = \"input.txt\";\n\t\tstatic string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n\t\tstatic bool _useFileInput = false;\n#endif\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\ttry\n\t\t\t{\n\t\t\t\tsolution();\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tif (_useFileInput)\n\t\t\t\t{\n\t\t\t\t\tfile.Close();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstatic void solution()\n\t\t{\n\t\t\t#region SOLUTION\n\t\t\tvar d = readLongArray();\n\t\t\tvar n = d[0];\n\t\t\tvar k = d[1];\n\t\t\tvar l = (int)d[2];\n\t\t\tvar m = d[3];\n\n\t\t\t//if (l == 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\tfor (int i = l; i < 64; i++)\n\t\t\t{\n\t\t\t\tif (((1L << i) & k) != 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar fim = new Matrix { _11 = 0, _12 = 1, _21 = 1, _22 = 1 };\n\t\t\t//fim.Print();\n\t\t\tvar sq = pow(fim, n - 1, m);\n\t\t\t//sq.Print();\n\n\t\t\tvar fn0 = (sq._21 + sq._22) % m;\n\t\t\tvar fn1 = (sq._11 + sq._12) % m;\n\t\t\tvar fr = (fn0 + fn1) % m;\n\n\t\t\t//var fi = new int[n + 1];\n\t\t\t//fi[0] = 1;\n\t\t\t//fi[1] = 1;\n\t\t\t//for (int i = 2; i < n + 1; i++)\n\t\t\t//{\n\t\t\t//\tfi[i] = fi[i - 1] + fi[i - 2];\n\t\t\t//}\n\n\t\t\tvar nc = pow(2, n, m);\n\t\t\tnc -= fr;\n\t\t\tif (nc < 0)\n\t\t\t{\n\t\t\t\tnc += m;\n\t\t\t}\n\t\t\t//nc *= ((n - 1) % m);\n\t\t\tnc %= m;\n\n\t\t\tvar res = 1L;\n\t\t\tfor (int i = 0; i < l; i++)\n\t\t\t{\n\t\t\t\tif (((1L << i) & k) != 0)\n\t\t\t\t{\n\t\t\t\t\tres *= nc;\n\t\t\t\t\tres %= m;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tres *= fr;\n\t\t\t\t\tres %= m;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(res % m);\n\n\t\t\t//var n = readInt();\n\t\t\t//var m = readInt();\n\n\t\t\t//var a = readIntArray();\n\t\t\t//var b = readIntArray();\n\t\t\t#endregion\n\t\t}\n\n\t\tclass Matrix\n\t\t{\n\t\t\tpublic long _11;\n\t\t\tpublic long _12;\n\t\t\tpublic long _21;\n\t\t\tpublic long _22;\n\n\t\t\tpublic void Mult(Matrix x, long mod)\n\t\t\t{\n\t\t\t\tvar __11 = (_11 * x._11) % mod + (_12 * x._21) % mod;\n\t\t\t\tvar __12 = (_11 * x._21) % mod + (_12 * x._22) % mod;\n\t\t\t\tvar __21 = (_21 * x._11) % mod + (_22 * x._21) % mod;\n\t\t\t\tvar __22 = (_21 * x._21) % mod + (_22 * x._22) % mod;\n\n\t\t\t\t_11 = __11 % mod;\n\t\t\t\t_12 = __12 % mod;\n\t\t\t\t_21 = __21 % mod;\n\t\t\t\t_22 = __22 % mod;\n\t\t\t}\n\n\t\t\tpublic void Square(long mod)\n\t\t\t{\n\t\t\t\tMult(this, mod);\n\t\t\t}\n\n\t\t\tpublic void Print()\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0} {1}\", _11, _12);\n\t\t\t\tConsole.WriteLine(\"{0} {1}\", _21, _22);\n\t\t\t\tConsole.WriteLine();\n\t\t\t}\n\t\t}\n\n\t\tstatic Matrix pow(Matrix x, long p, long mod)\n\t\t{\n\t\t\t//p %= mod;\n\n\t\t\tvar res = new Matrix() { _11 = 1, _22 = 1 };\n\t\t\tvar a = new Matrix() { _11 = x._11, _12 = x._12, _21 = x._21, _22 = x._22 };\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (p % 2 == 1)\n\t\t\t\t{\n\t\t\t\t\tres.Mult(a, mod);\n\t\t\t\t\tp--;\n\t\t\t\t}\n\n\t\t\t\tif (p == 0)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tp /= 2;\n\t\t\t\ta.Square(mod);\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic long pow(long x, long p, long mod)\n\t\t{\n\t\t\tx %= mod;\n\t\t\t//p %= mod;\n\n\t\t\tvar res = 1L;\n\t\t\tvar a = x;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (p % 2 == 1)\n\t\t\t\t{\n\t\t\t\t\tres *= a;\n\t\t\t\t\tres %= mod;\n\t\t\t\t\tp--;\n\t\t\t\t}\n\n\t\t\t\tif (p == 0)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tp /= 2;\n\t\t\t\ta *= a;\n\t\t\t\ta %= mod;\n\t\t\t}\n\n\t\t\treturn res;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "67b3442340c3101d99b654eedfb1e7dd", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "MS C#", "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 _307d\n{\n\tclass Program\n\t{\n\t\tstatic string _inputFilename = \"input.txt\";\n\t\tstatic string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n\t\tstatic bool _useFileInput = false;\n#endif\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\ttry\n\t\t\t{\n\t\t\t\tsolution();\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tif (_useFileInput)\n\t\t\t\t{\n\t\t\t\t\tfile.Close();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstatic void solution()\n\t\t{\n\t\t\t#region SOLUTION\n\t\t\tvar d = readLongArray();\n\t\t\tvar n = d[0];\n\t\t\tvar k = d[1];\n\t\t\tvar l = (int)d[2];\n\t\t\tvar m = d[3];\n\n\t\t\tfor (int i = l; i < 64; i++)\n\t\t\t{\n\t\t\t\tif (((1L << i) & k) != 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar fim = new Matrix { _11 = 0, _12 = 1, _21 = 1, _22 = 1 };\n\t\t\t//fim.Print();\n\t\t\tvar sq = pow(fim, n - 1, m);\n\t\t\t//sq.Print();\n\n\t\t\tvar fn0 = (sq._21 + sq._22) % m;\n\t\t\tvar fn1 = (sq._11 + sq._12) % m;\n\t\t\tvar fr = (fn0 + fn1) % m;\n\n\t\t\tvar fi = new int[n + 1];\n\t\t\tfi[0] = 1;\n\t\t\tfi[1] = 1;\n\t\t\tfor (int i = 2; i < n + 1; i++)\n\t\t\t{\n\t\t\t\tfi[i] = fi[i - 1] + fi[i - 2];\n\t\t\t}\n\n\t\t\tvar nc = pow(2, n, m);\n\t\t\tnc -= fr;\n\t\t\tif (nc < 0)\n\t\t\t{\n\t\t\t\tnc += m;\n\t\t\t}\n\t\t\t//nc *= ((n - 1) % m);\n\t\t\tnc %= m;\n\n\t\t\tvar nmod = n % m;\n\t\t\tvar res = 1L;\n\t\t\tfor (int i = 0; i < l; i++)\n\t\t\t{\n\t\t\t\tif (((1L << i) & k) != 0)\n\t\t\t\t{\n\t\t\t\t\tres *= nc;\n\t\t\t\t\tres %= m;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tres *= fr;\n\t\t\t\t\tres %= m;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(res);\n\n\t\t\t//var n = readInt();\n\t\t\t//var m = readInt();\n\n\t\t\t//var a = readIntArray();\n\t\t\t//var b = readIntArray();\n\t\t\t#endregion\n\t\t}\n\n\t\tclass Matrix\n\t\t{\n\t\t\tpublic long _11;\n\t\t\tpublic long _12;\n\t\t\tpublic long _21;\n\t\t\tpublic long _22;\n\n\t\t\tpublic void Mult(Matrix x, long mod)\n\t\t\t{\n\t\t\t\tvar __11 = (_11 * x._11) % mod + (_12 * x._21) % mod;\n\t\t\t\tvar __12 = (_11 * x._21) % mod + (_12 * x._22) % mod;\n\t\t\t\tvar __21 = (_21 * x._11) % mod + (_22 * x._21) % mod;\n\t\t\t\tvar __22 = (_21 * x._21) % mod + (_22 * x._22) % mod;\n\n\t\t\t\t_11 = __11 % mod;\n\t\t\t\t_12 = __12 % mod;\n\t\t\t\t_21 = __21 % mod;\n\t\t\t\t_22 = __22 % mod;\n\t\t\t}\n\n\t\t\tpublic void Square(long mod)\n\t\t\t{\n\t\t\t\tMult(this, mod);\n\t\t\t}\n\n\t\t\tpublic void Print()\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0} {1}\", _11, _12);\n\t\t\t\tConsole.WriteLine(\"{0} {1}\", _21, _22);\n\t\t\t\tConsole.WriteLine();\n\t\t\t}\n\t\t}\n\n\t\tstatic Matrix pow(Matrix x, long p, long mod)\n\t\t{\n\t\t\t//p %= mod;\n\n\t\t\tvar res = new Matrix() { _11 = 1, _22 = 1 };\n\t\t\tvar a = new Matrix() { _11 = x._11, _12 = x._12, _21 = x._21, _22 = x._22 };\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (p % 2 == 1)\n\t\t\t\t{\n\t\t\t\t\tres.Mult(a, mod);\n\t\t\t\t\tp--;\n\t\t\t\t}\n\n\t\t\t\tif (p == 0)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tp /= 2;\n\t\t\t\ta.Square(mod);\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic long pow(long x, long p, long mod)\n\t\t{\n\t\t\tx %= mod;\n\t\t\t//p %= mod;\n\n\t\t\tvar res = 1L;\n\t\t\tvar a = x;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (p % 2 == 1)\n\t\t\t\t{\n\t\t\t\t\tres *= a;\n\t\t\t\t\tres %= mod;\n\t\t\t\t\tp--;\n\t\t\t\t}\n\n\t\t\t\tif (p == 0)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tp /= 2;\n\t\t\t\ta *= a;\n\t\t\t\ta %= mod;\n\t\t\t}\n\n\t\t\treturn res;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0f82e801406a193551f4c5356db95d42", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] input = Console.ReadLine().Split(' ');\n\t\tdouble a1 = double.Parse(input[0]);\n\t\tdouble b1 = double.Parse(input[1]);\n\t\tdouble c1 = double.Parse(input[2]);\n\t\t\n\t\tinput = Console.ReadLine().Split(' ');\n\t\tdouble a2 = double.Parse(input[0]);\n\t\tdouble b2 = double.Parse(input[1]);\n\t\tdouble c2 = double.Parse(input[2]);\n\t\t\n\t\tif((a1 == 0 && b1 == 0 && c1 == 0) || (a2 == 0 && b2 == 0 && c2 == 0))\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\tif(b1 == 0 && b2 == 0 && c1 == c2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(b1 == 0 && b2 == 0 && c1 != c2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 == c2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 != c2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(1);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "94782ef70fd9d722560a9eaf36667aa2", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "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 public static string NextToken()\n {\n StringBuilder ret = new StringBuilder();\n char c;\n\n while (char.IsWhiteSpace(c = (char)Console.Read())) ;\n do\n {\n ret.Append(c);\n } while (!char.IsWhiteSpace(c = (char)Console.Read()));\n\n return ret.ToString();\n }\n }\n\n class Program\n {\n static int GCD(int n, int m)\n {\n return m > 0 ? GCD(m, n % m) : n;\n }\n\n static void Get(out int A, out int B, out int C)\n {\n int a = Reader.NextInt();\n int b = Reader.NextInt();\n int c = Reader.NextInt();\n\n int g = GCD(Math.Abs(a), GCD(Math.Abs(b), Math.Abs(c)));\n if (g == 0)\n g = 1;\n\n A = a / g;\n B = b / g;\n C = c / g;\n }\n\n static void Main(string[] args)\n {\n int A1, B1, C1, A2, B2, C2;\n\n Get(out A1, out B1, out C1);\n Get(out A2, out B2, out C2);\n\n bool inf = (A1 == 0 && B1 == 0 && C1 == 0) || (A2 == 0 && B2 == 0 && C2 == 0);\n bool no = (A1 == 0 && B1 == 0 && C1 != 0) || (A2 == 0 && B2 == 0 && C2 != 0);\n\n if ((A1 == A2 && B1 == B2 && C1 == C2) || (inf && !no))\n {\n Console.WriteLine(-1);\n return;\n }\n\n if (A1 * B2 == A2 * B1 || no)\n {\n Console.WriteLine(0);\n return;\n }\n\n Console.WriteLine(1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "962a8474632412e4cc331f75449f839a", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "MS C#", "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 int Gcd(int a, int b)\n {\n return b > 0 ? Gcd(b, a % b) : a;\n }\n\n public void Solve()\n {\n var a = ReadIntMatrix(2);\n\n if (a[0][0] == 0 && a[0][1] == 0)\n {\n if (a[0][2] != 0 || a[1][0] == 0 && a[1][1] == 0 && a[1][2] != 0)\n Write(0);\n else\n Write(-1);\n return;\n }\n\n if (a[1][0] == 0 && a[1][1] == 0)\n {\n Write(a[1][2] == 0 ? -1 : 0);\n return;\n }\n\n for (int i = 0; i < 2; i++)\n {\n int g = 0;\n for (int j = 0; j < 3; j++)\n g = Gcd(g, Math.Abs(a[i][j]));\n for (int j = 0; j < 3; j++)\n a[i][j] /= g;\n\n if (a[i][0] < 0 || a[i][0] == 0 && a[i][1] < 0)\n for (int j = 0; j < 3; j++)\n a[i][j] = -a[i][j];\n }\n\n if (a[0][0] == 0 && a[1][0] == 0)\n Write(a[0][1] == a[1][1] && a[0][2] == a[1][2] ? -1 : 0);\n else if (a[0][1] == 0 && a[1][1] == 0)\n Write(a[0][0] == a[1][0] && a[0][2] == a[1][2] ? -1 : 0);\n else if (a[0][0] == a[1][0] && a[0][1] == a[1][1])\n Write(a[0][2] == a[1][2] ? -1 : 0);\n else\n Write(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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "10fbe709ea313919ab118d0ff448ee9f", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] input = Console.ReadLine().Split(' ');\n\t\tdouble a1 = double.Parse(input[0]);\n\t\tdouble b1 = double.Parse(input[1]);\n\t\tdouble c1 = double.Parse(input[2]);\n\t\t\n\t\tinput = Console.ReadLine().Split(' ');\n\t\tdouble a2 = double.Parse(input[0]);\n\t\tdouble b2 = double.Parse(input[1]);\n\t\tdouble c2 = double.Parse(input[2]);\n\t\t\n\t\tif((a1 == 0 && b1 == 0 && c1 == 0) || (a2 == 0 && b2 == 0 && c2 == 0))\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(b1 == 0 && b2 == 0 && c1 == c2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(b1 == 0 && b2 == 0 && c1 != c2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 == c2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 != c2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(1);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3045cf52aff2244035a080ca84d95861", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "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 public static string NextToken()\n {\n StringBuilder ret = new StringBuilder();\n char c;\n\n while (char.IsWhiteSpace(c = (char)Console.Read())) ;\n do\n {\n ret.Append(c);\n } while (!char.IsWhiteSpace(c = (char)Console.Read()));\n\n return ret.ToString();\n }\n }\n\n class Program\n {\n static int GCD(int n, int m)\n {\n return m > 0 ? GCD(m, n % m) : n;\n }\n\n static void Get(out int A, out int B, out int C)\n {\n int a = Reader.NextInt();\n int b = Reader.NextInt();\n int c = Reader.NextInt();\n\n int g = GCD(Math.Abs(a), GCD(Math.Abs(b), Math.Abs(c)));\n if (g == 0)\n g = 1;\n\n A = a / g;\n B = b / g;\n C = c / g;\n\n if (A <= 0 && B <= 0 && C <= 0)\n {\n A = -A;\n B = -B;\n C = -C;\n }\n }\n\n static void Main(string[] args)\n {\n int A1, B1, C1, A2, B2, C2;\n\n Get(out A1, out B1, out C1);\n Get(out A2, out B2, out C2);\n\n bool inf = (A1 == 0 && B1 == 0 && C1 == 0) || (A2 == 0 && B2 == 0 && C2 == 0);\n bool no = (A1 == 0 && B1 == 0 && C1 != 0) || (A2 == 0 && B2 == 0 && C2 != 0);\n\n if (!no && ((A1 == A2 && B1 == B2 && C1 == C2) || inf))\n {\n Console.WriteLine(-1);\n return;\n }\n\n if (A1 * B2 == A2 * B1 || no)\n {\n Console.WriteLine(0);\n return;\n }\n\n Console.WriteLine(1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6141b29afde7688aeb671378f477ee18", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] input = Console.ReadLine().Split(' ');\n\t\tdouble a1 = double.Parse(input[0]);\n\t\tdouble b1 = double.Parse(input[1]);\n\t\tdouble c1 = double.Parse(input[2]);\n\t\t\n\t\tinput = Console.ReadLine().Split(' ');\n\t\tdouble a2 = double.Parse(input[0]);\n\t\tdouble b2 = double.Parse(input[1]);\n\t\tdouble c2 = double.Parse(input[2]);\n\t\t\n\t\tif(b1 == 0 && b2 == 0 && c1 == c2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(b1 == 0 && b2 == 0 && c1 != c2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 == c2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 != c2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(1);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e5581d5840980c8a0a3f6a8816e1d52d", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "MS C#", "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 int Gcd(int a, int b)\n {\n return b > 0 ? Gcd(b, a % b) : a;\n }\n\n public void Solve()\n {\n var a = ReadIntMatrix(2);\n\n if (a[0][0] == 0 && a[0][1] == 0)\n {\n if (a[0][2] != 0 || a[1][0] == 0 && a[1][1] == 0 && a[1][2] != 0)\n Write(0);\n else\n Write(-1);\n return;\n }\n\n if (a[1][0] == 0 && a[1][1] == 0)\n {\n Write(a[1][2] == 0 ? -1 : 0);\n return;\n }\n\n if (a[0][0] == 0 && a[1][0] == 0)\n Write(a[0][1] * a[1][2] == a[1][1] * a[0][2] ? -1 : 0);\n else if (a[0][1] == 0 && a[1][1] == 0)\n Write(a[0][0] * a[1][2] == a[1][0] * a[0][2] ? -1 : 0);\n else if (a[0][0] * a[1][1] == a[0][1] * a[1][0])\n Write(a[0][2] == a[1][2] ? -1 : 0);\n else\n Write(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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d11bd9dc7835c20c63481369f98e609d", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "MS C#", "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 long[] ReadLong(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n long[] ret = new long[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = long.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 bool Check(string t)\n {\n for (int i = 0; i < t.Length; i++)\n {\n if (char.IsLetterOrDigit(t[i]) == false && t[i] != '_')\n {\n return false;\n }\n }\n\n return true;\n }\n\n static void Main(string[] args)\n {\n int[] abc = Read(Console.ReadLine());\n int[] def = Read(Console.ReadLine());\n\n if (abc[0] * def[1] == abc[1] * def[0])\n {\n if (abc[0] * def[2] == abc[2] * def[0] && abc[1] * def[2] == abc[2] * def[1])\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n Console.WriteLine(\"0\");\n }\n }\n else\n {\n Console.WriteLine(\"1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0eb93b3ea71a41fb2b264f287e87961e", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] input = Console.ReadLine().Split(' ');\n\t\tdouble a1 = double.Parse(input[0]);\n\t\tdouble b1 = double.Parse(input[1]);\n\t\tdouble c1 = double.Parse(input[2]);\n\t\t\n\t\tinput = Console.ReadLine().Split(' ');\n\t\tdouble a2 = double.Parse(input[0]);\n\t\tdouble b2 = double.Parse(input[1]);\n\t\tdouble c2 = double.Parse(input[2]);\n\t\t\n\t\t//if at least one is empty set\n\t\tif((a1 == 0 && b1 == 0 && c1 != 0) || (a2 == 0 && b2 == 0 && c2 != 0))\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\t//else if at least one is infinite\n\t\telse if((a1 == 0 && b1 == 0 && c1 == 0) || (a2 == 0 && b2 == 0 && c2 == 0))\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\t//else\n\t\telse if(a1 == 0 && a2 == 0 && c1 / b1 == c2 / b2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(a1 == 0 && a2 == 0 && c1 / b1 != c2 / b2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse if(b1 == 0 && b2 == 0 && c1 / a1 == c2 / a2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(b1 == 0 && b2 == 0 && c1 / a1 != c2 / a2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 == c2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 != c2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(1);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "89d385c5883c99d1a332d50ed1b3bf14", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nclass Program\n{\n static void Main(string[] args)\n {\n string line1 = Console.ReadLine();\n string line2 = Console.ReadLine();\n string[] data1 = line1.Split(new char[] { ' ' });\n string[] data2 = line2.Split(new char[] { ' ' });\n\n Console.WriteLine(new Solver().Solve(int.Parse(data1[0]), int.Parse(data1[1]), int.Parse(data1[2]),\n int.Parse(data2[0]), int.Parse(data2[1]), int.Parse(data2[2])));\n }\n}\n\nclass Solver\n{\n public int Solve(int a1, int b1, int c1, int a2, int b2, int c2)\n {\n if (a1 == 0 && b1 == 0) return 0;\n if (a2 == 0 && b2 == 0) return 0;\n if ((a1 == 0 && b2 == 0) || (a2 == 0 && b1 == 0)) return 1;\n if (a1 == 0 && a2 == 0)\n {\n if (b1 * c2 == b2 * c1) return -1;\n return 0;\n }\n if (b1 == 0 && b2 == 0)\n {\n if (a1 * c2 == a2 * c1) return -1;\n return 0;\n }\n\n bool a_same = (a1 * b2 == a2 * b1);\n bool b_same = (c1 * b2 == b1 * c2);\n return (a_same && b_same) ? -1 : (a_same ? 0 : 1);\n\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8bb54035ff025a9522718df53254fc16", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "MS C#", "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 int Gcd(int a, int b)\n {\n return b > 0 ? Gcd(b, a % b) : a;\n }\n\n public void Solve()\n {\n var a = ReadIntMatrix(2);\n\n if (a[0][0] == 0 && a[0][1] == 0)\n {\n if (a[0][2] != 0 || a[1][0] == 0 && a[1][1] == 0 && a[1][2] != 0)\n Write(0);\n else\n Write(-1);\n return;\n }\n\n if (a[1][0] == 0 && a[1][1] == 0)\n {\n Write(a[1][2] == 0 ? -1 : 0);\n return;\n }\n\n for (int i = 0; i < 2; i++)\n {\n int g = 0;\n for (int j = 0; j < 3; j++)\n g = Gcd(g, Math.Abs(a[i][j]));\n for (int j = 0; j < 3; j++)\n a[i][j] /= g;\n\n if (a[i][0] < 0 || a[i][0] == 0 && a[i][1] < 0)\n for (int j = 0; j < 3; j++)\n a[i][j] = -a[i][j];\n }\n \n if (a[0][0] == a[1][0] && a[0][1] == a[1][1])\n Write(a[0][2] == a[1][2] ? -1 : 0);\n else\n Write(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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "24b5179453cb56013c7e27f25d09809d", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "MS C#", "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 int Gcd(int a, int b)\n {\n return b > 0 ? Gcd(b, a % b) : a;\n }\n\n public void Solve()\n {\n var a = ReadIntMatrix(2);\n\n if (a[0][0] == 0 && a[0][1] == 0)\n {\n if (a[0][2] != 0 || a[1][0] == 0 && a[1][1] == 0 && a[1][2] != 0)\n Write(0);\n else\n Write(-1);\n return;\n }\n\n if (a[1][0] == 0 && a[1][1] == 0)\n {\n Write(a[1][2] == 0 ? -1 : 0);\n return;\n }\n\n if (a[0][0] * a[1][1] == a[0][1] * a[1][0])\n Write(a[0][2] == a[1][2] ? -1 : 0);\n else\n Write(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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bdfa99a0e2b942a7b9e0e4c8c765edc0", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] input = Console.ReadLine().Split(' ');\n\t\tdouble a1 = double.Parse(input[0]);\n\t\tdouble b1 = double.Parse(input[1]);\n\t\tdouble c1 = double.Parse(input[2]);\n\t\t\n\t\tinput = Console.ReadLine().Split(' ');\n\t\tdouble a2 = double.Parse(input[0]);\n\t\tdouble b2 = double.Parse(input[1]);\n\t\tdouble c2 = double.Parse(input[2]);\n\t\t\n\t\tif((a1 == 0 && b1 == 0 && c1 == 0) || (a2 == 0 && b2 == 0 && c2 == 0))\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if((a1 == 0 && b1 == 0 && c1 != 0) || (a2 == 0 && b2 == 0 && c2 != 0))\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse if(b1 == 0 && b2 == 0 && c1 == c2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(b1 == 0 && b2 == 0 && c1 != c2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 == c2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 != c2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(1);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b16f0366310e04cb33c647414ad2824", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "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@\"\n0 0 0\n1 1 0\n\");\n\n static void Main(string[] args)\n {\n CF.WriteLine(_t());\n }\n \n static int _t()\n {\n string[] ss = CF.ReadLine().Split(' ');\n int x1 = int.Parse(ss[0]);\n int y1 = int.Parse(ss[1]);\n int c1 = int.Parse(ss[2]);\n ss = CF.ReadLine().Split(' ');\n int x2 = int.Parse(ss[0]);\n int y2 = int.Parse(ss[1]);\n int c2 = int.Parse(ss[2]);\n\n int t1 = _t2(x1, y1, c1);\n if (t1 == 0)\n return 0;\n int t2 = _t2(x1, y1, c1);\n if (t2 == 0)\n return 0;\n if (t1 == -1)\n return -1;\n if (t2 == -1)\n return -1;\n\n\n if (x1 * y2 == x2 * y1)\n {\n if ((x1 * c2 == x2 * c1) && (y1 * c2 == y2 * c1))\n return -1;\n else\n return 0;\n }\n else\n return 1;\n }\n\n static int _t2(int a, int b, int c)\n {\n if (a == 0 && b == 0)\n {\n if (c == 0)\n return -1;\n else\n return 0;\n }\n return 1;\n }\n\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9cbc83a309f69ba7499fe85e1e188a81", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "MS C#", "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 int Gcd(int a, int b)\n {\n return b > 0 ? Gcd(b, a % b) : a;\n }\n\n public void Solve()\n {\n var a = ReadIntMatrix(2);\n\n if (a[0][0] == 0 && a[0][1] == 0)\n {\n if (a[0][2] != 0 || a[1][0] == 0 && a[1][1] == 0 && a[1][2] != 0)\n Write(0);\n else\n Write(-1);\n return;\n }\n\n if (a[1][0] == 0 && a[1][1] == 0)\n {\n Write(a[1][2] == 0 ? -1 : 0);\n return;\n }\n\n if (a[0][0] == 0 && a[1][0] == 0)\n Write(a[0][1] * a[1][2] == a[1][1] * a[0][2] ? -1 : 0);\n else if (a[0][1] == 0 && a[1][1] == 1)\n Write(a[0][0] * a[1][2] == a[1][0] * a[0][2] ? -1 : 0);\n else if (a[0][0] * a[1][1] == a[0][1] * a[1][0])\n Write(a[0][2] == a[1][2] ? -1 : 0);\n else\n Write(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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8c1ac2933aafa6e91ffa3cc57d07a529", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "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 public static string NextToken()\n {\n StringBuilder ret = new StringBuilder();\n char c;\n\n while (char.IsWhiteSpace(c = (char)Console.Read())) ;\n do\n {\n ret.Append(c);\n } while (!char.IsWhiteSpace(c = (char)Console.Read()));\n\n return ret.ToString();\n }\n }\n\n class Program\n {\n static int GCD(int n, int m)\n {\n return m > 0 ? GCD(m, n % m) : n;\n }\n\n static void Get(out int A, out int B, out int C)\n {\n int a = Reader.NextInt();\n int b = Reader.NextInt();\n int c = Reader.NextInt();\n\n int g = GCD(Math.Abs(a), GCD(Math.Abs(b), Math.Abs(c)));\n if (g == 0)\n g = 1;\n\n A = a / g;\n B = b / g;\n C = c / g;\n\n if (A <= 0 && B <= 0 && C <= 0)\n {\n A = -A;\n B = -B;\n C = -C;\n }\n }\n\n static void Main(string[] args)\n {\n int A1, B1, C1, A2, B2, C2;\n\n Get(out A1, out B1, out C1);\n Get(out A2, out B2, out C2);\n\n bool inf = (A1 == 0 && B1 == 0 && C1 == 0) || (A2 == 0 && B2 == 0 && C2 == 0);\n bool no = (A1 == 0 && B1 == 0 && C1 != 0) || (A2 == 0 && B2 == 0 && C2 != 0);\n\n if ((A1 == A2 && B1 == B2 && C1 == C2) || (inf && !no))\n {\n Console.WriteLine(-1);\n return;\n }\n\n if (A1 * B2 == A2 * B1 || no)\n {\n Console.WriteLine(0);\n return;\n }\n\n Console.WriteLine(1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4b6d5b36a34758875fc9468fe44dbb26", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] input = Console.ReadLine().Split(' ');\n\t\tdouble a1 = double.Parse(input[0]);\n\t\tdouble b1 = double.Parse(input[1]);\n\t\tdouble c1 = double.Parse(input[2]);\n\t\t\n\t\tinput = Console.ReadLine().Split(' ');\n\t\tdouble a2 = double.Parse(input[0]);\n\t\tdouble b2 = double.Parse(input[1]);\n\t\tdouble c2 = double.Parse(input[2]);\n\t\t\n\t\t//if at least one is empty set\n\t\tif((a1 == 0 && b1 == 0 && c1 != 0) || (a2 == 0 && b2 == 0 && c2 != 0))\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\t//else if at least one is infinite\n\t\telse if((a1 == 0 && b1 == 0 && c1 == 0) || (a2 == 0 && b2 == 0 && c2 == 0))\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\t//else\n\t\telse if(a1 == 0 && a2 == 0 && c1 / b1 == c2 / b2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(a1 == 0 && a2 == 0 && c1 / b1 != c2 / b2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse if(b1 == 0 && b2 == 0 && c1 / a1 == c2 / a2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(b1 == 0 && b2 == 0 && c1 / a1 != c2 / a2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 / b1 == c2 / b2)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\telse if(a1 / b1 == a2 / b2 && c1 / b1 != c2 / b2)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(1);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "77b02ebd6dd479ad96015d3cc130f757", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "MS C#", "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 var a = ReadIntMatrix(2);\n\n if (a[0][0] == 0 && a[0][1] == 0)\n {\n if (a[0][2] != 0 || a[1][0] == 0 && a[1][1] == 0 && a[1][2] != 0)\n Write(0);\n else\n Write(-1);\n return;\n }\n\n if (a[1][0] == 0 && a[1][1] == 0)\n {\n Write(a[1][2] == 0 ? -1 : 0);\n return;\n }\n\n if (a[0][0] == 0 && a[1][0] == 0)\n Write(a[0][1] * a[1][2] == a[1][1] * a[0][2] ? -1 : 0);\n else if (a[0][1] == 0 && a[1][1] == 0)\n Write(a[0][0] * a[1][2] == a[1][0] * a[0][2] ? -1 : 0);\n else if (a[0][0] * a[1][1] == a[0][1] * a[1][0])\n Write(a[0][2] * a[1][0] == a[1][2] * a[0][0] ? -1 : 0);\n else\n Write(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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5ca0e785ccf8a4df8a256d678e0c62f7", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "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 public static string NextToken()\n {\n StringBuilder ret = new StringBuilder();\n char c;\n\n while (char.IsWhiteSpace(c = (char)Console.Read())) ;\n do\n {\n ret.Append(c);\n } while (!char.IsWhiteSpace(c = (char)Console.Read()));\n\n return ret.ToString();\n }\n }\n\n class Program\n {\n static int GCD(int n, int m)\n {\n return m > 0 ? GCD(m, n % m) : n;\n }\n\n static void Get(out int A, out int B, out int C)\n {\n int a = Reader.NextInt();\n int b = Reader.NextInt();\n int c = Reader.NextInt();\n\n int g = GCD(Math.Abs(a), GCD(Math.Abs(b), Math.Abs(c)));\n if (g == 0)\n g = 1;\n\n A = a / g;\n B = b / g;\n C = c / g;\n }\n\n static void Main(string[] args)\n {\n int A1, B1, C1, A2, B2, C2;\n\n Get(out A1, out B1, out C1);\n Get(out A2, out B2, out C2);\n\n bool inf = (A1 == 0 && B1 == 0 && C1 == 0) || (A2 == 0 && B2 == 0 && C2 == 0);\n bool no = (A1 == 0 && B1 == 0 && C1 != 0) || (A2 == 0 && B2 == 0 && C2 != 0);\n\n if (!no && ((A1 == A2 && B1 == B2 && C1 == C2) || (A1 == -A2 && B1 == -B2 && C1 == -C2) || inf))\n {\n Console.WriteLine(-1);\n return;\n }\n\n if (A1 * B2 == A2 * B1 || no)\n {\n Console.WriteLine(0);\n return;\n }\n\n Console.WriteLine(1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ed2650bd5d7c8ce649dbe545785c2432", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "MS C#", "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 long[] ReadLong(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n long[] ret = new long[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = long.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 bool Check(string t)\n {\n for (int i = 0; i < t.Length; i++)\n {\n if (char.IsLetterOrDigit(t[i]) == false && t[i] != '_')\n {\n return false;\n }\n }\n\n return true;\n }\n\n static void Main(string[] args)\n {\n int[] abc = Read(Console.ReadLine());\n int[] def = Read(Console.ReadLine());\n\n if ((abc[0] == 0 && abc[1] == 0 && abc[2] != 0) || (def[0] == 0 && def[1] == 0 && def[2] != 0))\n {\n Console.WriteLine(\"0\");\n return;\n }\n \n if (abc[0] * def[1] == abc[1] * def[0])\n {\n if (abc[0] * def[2] == abc[2] * def[0] && abc[1] * def[2] == abc[2] * def[1])\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n Console.WriteLine(\"0\");\n }\n }\n else\n {\n Console.WriteLine(\"1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e9bfe9fb1d21773d2877434c53e1c26f", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "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@\"\n0 0 0\n1 1 0\n\");\n\n static void Main(string[] args)\n {\n CF.WriteLine(_t());\n }\n \n static int _t()\n {\n string[] ss = CF.ReadLine().Split(' ');\n int x1 = int.Parse(ss[0]);\n int y1 = int.Parse(ss[1]);\n int c1 = int.Parse(ss[2]);\n ss = CF.ReadLine().Split(' ');\n int x2 = int.Parse(ss[0]);\n int y2 = int.Parse(ss[1]);\n int c2 = int.Parse(ss[2]);\n\n int t1 = _t2(x1, y1, c1);\n if (t1 == 0)\n return 0;\n int t2 = _t2(x2, y2, c2);\n if (t2 == 0)\n return 0;\n if (t1 == -1)\n return -1;\n if (t2 == -1)\n return -1;\n\n\n if (x1 * y2 == x2 * y1)\n {\n if ((x1 * c2 == x2 * c1) && (y1 * c2 == y2 * c1))\n return -1;\n else\n return 0;\n }\n else\n return 1;\n }\n\n static int _t2(int a, int b, int c)\n {\n if (a == 0 && b == 0)\n {\n if (c == 0)\n return -1;\n else\n return 0;\n }\n return 1;\n }\n\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e9b927cbbf4db6dd4d5c3d48ca34c47d", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nclass Program\n{\n static void Main(string[] args)\n {\n string line1 = Console.ReadLine();\n string line2 = Console.ReadLine();\n string[] data1 = line1.Split(new char[] { ' ' });\n string[] data2 = line2.Split(new char[] { ' ' });\n\n Console.WriteLine(new Solver().Solve(int.Parse(data1[0]), int.Parse(data1[1]), int.Parse(data1[2]),\n int.Parse(data2[0]), int.Parse(data2[1]), int.Parse(data2[2])));\n }\n}\n\nclass Solver\n{\n public int Solve(int a1, int b1, int c1, int a2, int b2, int c2)\n {\n if (a1 == 0 && b1 == 0 && c1 != 0) return 0;\n if (a2 == 0 && b2 == 0 && c2 != 0) return 0;\n if ((a1 == 0 && b1 == 0) || (a2 == 0 && b2 == 0)) return -1;\n\n if ((a1 == 0 && b2 == 0) || (a2 == 0 && b1 == 0)) return 1;\n if (a1 == 0 && a2 == 0)\n {\n if (b1 * c2 == b2 * c1) return -1;\n return 0;\n }\n if (b1 == 0 && b2 == 0)\n {\n if (a1 * c2 == a2 * c1) return -1;\n return 0;\n }\n\n bool a_same = (a1 * b2 == a2 * b1);\n bool b_same = (c1 * b2 == b1 * c2);\n return (a_same && b_same) ? -1 : (a_same ? 0 : 1);\n\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d1d28a8cba2eb55ad1f0dfca328ad09", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\n\nclass Program\n{\n class Line\n {\n public long a, b, c;\n public Line(long a, long b, long c)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n }\n public bool isLine()\n {\n if (a == 0 && b == 0 && c != 0)\n return false;\n return true;\n }\n public bool isPlane()\n {\n return (a == 0 && b == 0 && c == 0);\n }\n\n }\n void solve()\n {\n Line first = new Line(nextInt(),nextInt(),-nextInt());\n Line second = new Line(nextInt(), nextInt(), -nextInt());\n int ret = 0;\n if (!first.isLine() || !second.isLine())\n ret = 0;\n else\n {\n if (first.isPlane() || second.isPlane())\n ret = -1;\n else\n {\n long det = first.b * second.a - first.a * second.b;\n long o = second.a * first.c - first.a * second.c;\n if (det == 0)\n {\n if (o == 0)\n ret = -1;\n else\n ret = 0;\n }\n else\n {\n ret = 1;\n }\n }\n }\n println(ret);\n\n\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "da48a4da00f3e71f9c7feb8c032b92ed", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": ".NET Core C#", "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 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 var startNum = Phi(m / g);\n //new { g, startNum, minPower }.TextDump();\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 % mod;\n }\n\n public static long ModPow(long x, long n, long mod) {\n return (long)BigInteger.ModPow(x, n, 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a26758bf6f7edd94d0022dfde5c094ff", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "difficulty": 2600.0} {"lang": ".NET Core C#", "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 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 foreach (var g in Divisors(m)) {\n var m2 = m / g;\n var phi = Phi(m2);\n long minPower = phi;\n BigInteger pow = x;\n long e = 1;\n Cache.Clear();\n foreach (var p in Divisors(phi)) {\n if (p == phi) break;\n pow = pow * ModPowRecursive(x, p - e, m2) % m2;\n //pow = pow * BigInteger.ModPow(x, p - e, m2) % m2;\n e = p;\n if (pow == BigInteger.One) {\n minPower = p;\n break;\n }\n }\n ans += phi / minPower;\n }\n return ans;\n }\n\n public static long ModMultiple(long x, long n, long mod) {\n if (x == 0 || n == 0) return 0;\n if (x < long.MaxValue / n) return x * n % 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 % mod;\n }\n\n Dictionary Cache = new Dictionary();\n\n public BigInteger ModPowRecursive(BigInteger x, long n, long mod) {\n if (Cache.TryGetValue(n, out var res)) return res;\n x %= mod;\n if (n == 0) {\n return Cache[n] = 1;\n } else if (n % 2 != 0) {\n return Cache[n] = x * ModPowRecursive(x, n - 1, mod) % mod;\n } else {\n var r = ModPowRecursive(x, n / 2, mod);\n return Cache[n] = r * r % mod;\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "25488e27f935bb6a4a064cb38a5a04c4", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "difficulty": 2600.0} {"lang": ".NET Core C#", "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 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 foreach (var g in Divisors(m)) {\n var m2 = m / g;\n var phi = Phi(m2);\n long minPower = phi;\n BigInteger pow = x;\n long e = 1;\n foreach (var p in Divisors(phi)) {\n if (p == phi) break;\n pow = pow * BigInteger.ModPow(x, p - e, m2) % m2;\n e = p;\n if (pow == BigInteger.One) {\n minPower = p;\n break;\n }\n }\n ans += phi / minPower;\n }\n return ans;\n }\n\n public static long ModMultiple(long x, long n, long mod) {\n if (x == 0 || n == 0) return 0;\n if (x < long.MaxValue / n) return x * n % 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 % mod;\n }\n\n public static long ModPow(long x, long n, long mod) {\n return (long)BigInteger.ModPow(x, n, 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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "62313939d9c250354616b47a25084613", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "difficulty": 2600.0} {"lang": ".NET Core C#", "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 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 = new PrimeSet(10000000);\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "85ceb0836208c36cb2f8329748ed8da3", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "difficulty": 2600.0} {"lang": ".NET Core C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c64b2efb79466850da0c44e4516a8695", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "difficulty": 2600.0} {"lang": ".NET Core C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "94bdcdade75a8dcd99fd6c6de6629241", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "difficulty": 2600.0} {"lang": ".NET Core C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d2cc056b1fc89b041dcf0abdc86a5e83", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "difficulty": 2600.0} {"lang": ".NET Core C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6289a76c50ed05cd5c311beecdb89518", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "difficulty": 2600.0} {"lang": "Mono C#", "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 x = ReadInt();\n var a = Convert.ToString(x, 2).ToList();\n while (a.Count < 6)\n a.Insert(0, '0');\n \n char t = a[1];\n a[1] = a[5];\n a[5] = t;\n t = a[2];\n a[2] = a[3];\n a[3] = t;\n Write(Convert.ToInt32(new string(a.ToArray()), 2));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b349d03784cc8723fc205629fa9e382", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null} {"lang": "Mono C#", "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[] map = {0, 5, 3, 2, 4, 1};\n int n = NextInt();\n int i = 5;\n int[] nn = new int[6];\n while (n > 0) {\n nn[i] = n & 1;\n i--;\n n >>= 1;\n }\n int r = 0;\n for (int j = 0; j < 6; j++) {\n r <<= 1;\n r += nn[map[j]];\n }\n writer.Write(r);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "364c831e258860bbfa84c3cda88621d6", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = int.Parse(Console.ReadLine());\n\n var a = Convert.ToString(x, 2).PadLeft(6, '0').ToArray();\n\n var temp = a[1];\n a[1] = a[5];\n a[5] = temp;\n temp = a[2];\n a[2] = a[3];\n a[3] = temp;\n\n Console.WriteLine(Convert.ToInt32(new String(a), 2));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5f3e885b78746174a2bc4349946af42f", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\n \npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tvar x = int.Parse(Console.ReadLine());\n\t\t\n\t\tvar a = Convert.ToString(x, 2).PadLeft(6, '0').ToArray();\n\t\t\n\t\tvar temp = a[0];\n\t\ta[0] = a[4];\n\t\ta[4] = temp;\n\t\ttemp = a[1];\n\t\ta[1] = a[2];\n\t\ta[2] = temp;\n\t\t\n\t\tConsole.WriteLine(Convert.ToInt32(new String(a), 2));\n \n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fedb146c54fd575260249b9ad630c9dd", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\n \npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tvar x = int.Parse(Console.ReadLine());\n\t\t\n\t\tvar a = Convert.ToString(x, 2).PadLeft(6, '0');\n\t\t\n\t\tvar temp = a[0];\n\t\ta[0] = a[4];\n\t\ta[4] = temp;\n\t\ttemp = a[1];\n\t\ta[1] = a[2];\n\t\ta[2] = temp;\n\t\t\n\t\tConsole.WriteLine(Convert.ToInt32(a, 2));\n\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a05db83724e03ae7a0d25c6a7fead3a7", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n \npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tvar x = int.Parse(Console.ReadLine());\n\t\t\n\t\tvar a = Convert.ToString(x, 2).PadLeft(6, '0').ToArray();\n\t\t\n\t\tvar temp = a[0];\n\t\ta[0] = a[4];\n\t\ta[4] = temp;\n\t\ttemp = a[1];\n\t\ta[1] = a[2];\n\t\ta[2] = temp;\n\t\t\n\t\tConsole.WriteLine(Convert.ToInt32(new String(a), 2));\n \n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f00357ac290a6c7b0df107b06c2f143e", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null} {"lang": "C# 8", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b406c6e57875f533b7afe9b5eb2dff82", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "difficulty": 2100.0} {"lang": "C# 8", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec2765792e73ef63604efa0686cf059c", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "difficulty": 2100.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "23b60f2702cde46fabd37711c1806f92", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\npublic class Matrix {\n public int Row, Col;\n private int[] Data;\n public Matrix(int row, int col) {\n this.Row = row;\n this.Col = col;\n this.Data = new int[Row * Col];\n }\n\n public int this[int row, int col] {\n set {\n Data[row * Col + col] = value;\n }\n get {\n return Data[row * Col + col];\n }\n }\n\n static public Matrix UnitMatrix(int n) {\n Matrix matrix = new Matrix(n, n);\n for (int i = 0; i < n; i++) {\n matrix[i, i] = 1;\n }\n return matrix;\n }\n\n static public Matrix operator +(Matrix A, Matrix B) {\n Matrix C = new Matrix(A.Row, A.Col);\n for (int i = 0; i < C.Data.Length; i++) {\n if (A.Data[i] == int.MaxValue || B.Data[i] == int.MaxValue)\n C.Data[i] = int.MaxValue;\n else\n C.Data[i] = A.Data[i] + B.Data[i];\n }\n return C;\n }\n\n static public Matrix operator -(Matrix A, Matrix B) {\n Matrix C = new Matrix(A.Row, A.Col);\n for (int i = 0; i < C.Data.Length; i++) {\n C.Data[i] = A.Data[i] - B.Data[i];\n }\n return C;\n }\n\n static public Matrix operator *(Matrix A, Matrix B) {\n Matrix C = new Matrix(A.Row, B.Col);\n for (int i = 0; i < A.Row; i++) {\n for (int j = 0; j < B.Col; j++) {\n C[i, j] = int.MaxValue;\n for (int k = 0; k < A.Col; k++) {\n //C[i, j] += A[i, k] * B[k, j];\n if (A[i, k] == int.MaxValue || B[k, j] == int.MaxValue) continue;\n C[i, j] = Math.Min(C[i, j], A[i, k] + B[k, j]);\n }\n }\n }\n return C;\n }\n\n static public Matrix Pow(Matrix A, long n) {\n if (n == 0) return UnitMatrix(A.Row);\n Matrix result = A.Clone(), t = A.Clone(); n--;\n while (n > 0) {\n if ((n & 1) != 0) {\n result = result * t;\n }\n\n t = t * t;\n n >>= 1;\n }\n\n return result;\n }\n\n public Matrix Clone() {\n Matrix clone = new Matrix(Row, Col);\n clone.Data = Data.Clone() as int[];\n return clone;\n }\n}\n\npublic partial class CodeForces {\n\n static void UpdateMin(ref T x, T newValue) where T : IComparable {\n if (x.CompareTo(newValue) > 0) x = newValue;\n }\n\n static public void Solve(TextReader cin, TextWriter cout) {\n var scanner = new Scanner(cin);\n int n = scanner.NextInt32();\n int m = scanner.NextInt32();\n var a = scanner.NextIntArray(n);\n var b = scanner.NextIntArray(n);\n int maxDepth = 2 * n + 1;\n var dp = new int[maxDepth, maxDepth];\n for (int i = 0; i < maxDepth; i++) {\n for (int j = 0; j < maxDepth; j++) {\n dp[i, j] = int.MaxValue;\n }\n dp[i, i] = 0;\n }\n for (int i = 0; i < n; i++) {\n var next = new int[maxDepth, maxDepth];\n for (int j = 0; j < maxDepth; j++) {\n for (int k = 0; k < maxDepth; k++) {\n next[j, k] = int.MaxValue;\n }\n }\n for (int j = 0; j < maxDepth; j++) {\n for (int k = 0; k < maxDepth; k++) {\n if (dp[j, k] == int.MaxValue) continue;\n if (k + 1 < maxDepth)\n UpdateMin(ref next[j, k + 1], dp[j, k] + a[i]);\n if (k - 1 >= 0)\n UpdateMin(ref next[j, k - 1], dp[j, k] + b[i]);\n }\n }\n\n dp = next;\n }\n\n /*for (int i = 0; i < maxDepth; i++) {\n for (int j = 0; j < maxDepth; j++) {\n Console.Error.Write(\" \" + dp[i, j]);\n }\n Console.Error.WriteLine();\n }*/\n\n Matrix M = new Matrix(maxDepth, maxDepth);\n\n for (int i = 0; i < maxDepth; i++) {\n for (int j = 0; j < maxDepth; j++) {\n M[i, j] = dp[i, j];\n }\n }\n\n Matrix A = M.Clone();\n\n A = Matrix.Pow(A, m);\n\n cout.WriteLine(A[0, 0]);\n }\n\n // PREWRITEN CODE BEGINS FROM HERE\n\n public static void Main(string[] args) {\n#if ONLINE_JUDGE\n Solve(Console.In, Console.Out);\n#else\n SampleTest();\n#endif\n\n }\n\n static void SampleTest() {\n\n var Inputs = @\"\n2 6\n1 2\n2 1\n------------\n1 10000000\n2\n3\n\".Split(new[] { \"------------\" }, StringSplitOptions.None).Select(s => s.Trim()).ToArray();\n\n var Outputs = @\"\n12\n------------\n25000000\n\".Split(new[] { \"------------\" }, StringSplitOptions.None).Select(s => s.Trim()).ToArray();\n\n int caseNo = 1;\n int all = 0, passed = 0;\n foreach (var sample in Inputs.Zip(Outputs, (Input, Output) => new { Input, Output })) {\n var stopWatch = new System.Diagnostics.Stopwatch();\n var writer = new StringWriter();\n stopWatch.Start();\n Solve(new StringReader(sample.Input), writer);\n stopWatch.Stop();\n string time = \"\";\n if (stopWatch.ElapsedMilliseconds >= 10) {\n time = String.Format(\"({0} ms)\", stopWatch.ElapsedMilliseconds);\n }\n var result = writer.ToString().Trim();\n all++;\n if (result == sample.Output) {\n Console.WriteLine(\"Sample {0} .... Passed {1}\", caseNo++, time);\n passed++;\n } else {\n Console.WriteLine(\"Sample {0} .... Failed\", 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 Solve(Console.In, Console.Out);\n }\n\n}\n\npublic class Scanner {\n private TextReader Reader;\n private Queue TokenQueue = new Queue();\n private CultureInfo ci = new CultureInfo(\"en-US\");\n\n public Scanner()\n : this(Console.In) {\n }\n\n public Scanner(TextReader reader) {\n this.Reader = reader;\n }\n\n public char NextChar() { return Next().Single(); }\n public int NextInt32() { return Int32.Parse(Next(), ci); }\n public long NextInt64() { return Int64.Parse(Next(), ci); }\n public double NextDouble() { return double.Parse(Next(), ci); }\n public string[] NextArray(int size) {\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 var array = new int[size];\n for (int i = 0; i < size; i++) array[i] = NextInt32();\n return array;\n }\n\n public long[] NextInt64Array(int size) {\n var array = new long[size];\n for (int i = 0; i < size; i++) array[i] = NextInt64();\n return array;\n }\n\n public String Next() {\n if (!TokenQueue.Any()) {\n if (!StockTokens()) throw new InvalidOperationException();\n }\n return TokenQueue.Dequeue();\n }\n\n public bool HasNext() {\n if (TokenQueue.Count > 0)\n return true;\n return StockTokens();\n }\n\n private bool StockTokens() {\n while (true) {\n var line = Reader.ReadLine();\n if (line == null) return false;\n var tokens = line.Trim().Split(\" \".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToArray();\n if (tokens.Length == 0) continue;\n foreach (var token in tokens)\n TokenQueue.Enqueue(token);\n return true;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c21e7e83da1eab8196f86095b949f868", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "difficulty": 2500.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\npublic class Matrix {\n public int Row, Col;\n private int[] Data;\n public Matrix(int row, int col) {\n this.Row = row;\n this.Col = col;\n this.Data = new int[Row * Col];\n }\n\n public int this[int row, int col] {\n set {\n Data[row * Col + col] = value;\n }\n get {\n return Data[row * Col + col];\n }\n }\n\n static public Matrix operator +(Matrix A, Matrix B) {\n Matrix C = new Matrix(A.Row, A.Col);\n for (int i = 0; i < C.Data.Length; i++) {\n if (A.Data[i] == int.MaxValue || B.Data[i] == int.MaxValue)\n C.Data[i] = int.MaxValue;\n else\n C.Data[i] = A.Data[i] + B.Data[i];\n }\n return C;\n }\n\n static public Matrix operator -(Matrix A, Matrix B) {\n Matrix C = new Matrix(A.Row, A.Col);\n for (int i = 0; i < C.Data.Length; i++) {\n C.Data[i] = A.Data[i] - B.Data[i];\n }\n return C;\n }\n\n static public Matrix operator *(Matrix A, Matrix B) {\n Matrix C = new Matrix(A.Row, B.Col);\n for (int i = 0; i < A.Row; i++)\n for (int j = 0; j < B.Col; j++)\n C[i, j] = int.MaxValue;\n for (int i = 0; i < A.Row; i++) {\n for (int k = 0; k < A.Col; k++) {\n if (A[i, k] == int.MaxValue) continue;\n for (int j = 0; j < B.Col; j++) {\n if (B[k, j] == int.MaxValue) continue;\n C[i, j] = Math.Min(C[i, j], A[i, k] + B[k, j]);\n }\n }\n }\n return C;\n }\n\n static public Matrix Pow(Matrix A, long n) {\n Matrix result = A.Clone(), t = A.Clone(); n--;\n while (n > 0) {\n if ((n & 1) != 0) {\n result = result * t;\n }\n t = t * t;\n n >>= 1;\n }\n\n return result;\n }\n\n public Matrix Clone() {\n Matrix clone = new Matrix(Row, Col);\n clone.Data = Data.Clone() as int[];\n return clone;\n }\n}\n\npublic partial class CodeForces {\n\n static void UpdateMin(ref T x, T newValue) where T : IComparable {\n if (x.CompareTo(newValue) > 0) x = newValue;\n }\n\n static public void Solve(TextReader cin, TextWriter cout) {\n var scanner = new Scanner(cin);\n int n = scanner.NextInt32();\n int m = scanner.NextInt32();\n var a = scanner.NextIntArray(n);\n var b = scanner.NextIntArray(n);\n int maxDepth = 2 * n + 1;\n var dp = new int[maxDepth, maxDepth];\n for (int i = 0; i < maxDepth; i++) {\n for (int j = 0; j < maxDepth; j++) {\n dp[i, j] = int.MaxValue;\n }\n dp[i, i] = 0;\n }\n for (int i = 0; i < n; i++) {\n var next = new int[maxDepth, maxDepth];\n for (int j = 0; j < maxDepth; j++) {\n for (int k = 0; k < maxDepth; k++) {\n next[j, k] = int.MaxValue;\n }\n }\n for (int j = 0; j < maxDepth; j++) {\n for (int k = 0; k < maxDepth; k++) {\n if (dp[j, k] == int.MaxValue) continue;\n if (k + 1 < maxDepth)\n UpdateMin(ref next[j, k + 1], dp[j, k] + a[i]);\n if (k - 1 >= 0)\n UpdateMin(ref next[j, k - 1], dp[j, k] + b[i]);\n }\n }\n\n dp = next;\n }\n\n /*for (int i = 0; i < maxDepth; i++) {\n for (int j = 0; j < maxDepth; j++) {\n Console.Error.Write(\" \" + dp[i, j]);\n }\n Console.Error.WriteLine();\n }*/\n\n Matrix M = new Matrix(maxDepth, maxDepth);\n\n for (int i = 0; i < maxDepth; i++) {\n for (int j = 0; j < maxDepth; j++) {\n M[i, j] = dp[i, j];\n }\n }\n\n Matrix A = M.Clone();\n\n A = Matrix.Pow(A, m);\n\n cout.WriteLine(A[0, 0]);\n }\n\n // PREWRITEN CODE BEGINS FROM HERE\n\n public static void Main(string[] args) {\n#if ONLINE_JUDGE\n Solve(Console.In, Console.Out);\n#else\n SampleTest();\n#endif\n\n }\n\n static void SampleTest() {\n\n var Inputs = @\"\n2 6\n1 2\n2 1\n------------\n1 10000000\n2\n3\n\".Split(new[] { \"------------\" }, StringSplitOptions.None).Select(s => s.Trim()).ToArray();\n\n var Outputs = @\"\n12\n------------\n25000000\n\".Split(new[] { \"------------\" }, StringSplitOptions.None).Select(s => s.Trim()).ToArray();\n\n int caseNo = 1;\n int all = 0, passed = 0;\n foreach (var sample in Inputs.Zip(Outputs, (Input, Output) => new { Input, Output })) {\n var stopWatch = new System.Diagnostics.Stopwatch();\n var writer = new StringWriter();\n stopWatch.Start();\n Solve(new StringReader(sample.Input), writer);\n stopWatch.Stop();\n string time = \"\";\n if (stopWatch.ElapsedMilliseconds >= 10) {\n time = String.Format(\"({0} ms)\", stopWatch.ElapsedMilliseconds);\n }\n var result = writer.ToString().Trim();\n all++;\n if (result == sample.Output) {\n Console.WriteLine(\"Sample {0} .... Passed {1}\", caseNo++, time);\n passed++;\n } else {\n Console.WriteLine(\"Sample {0} .... Failed\", 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 Solve(Console.In, Console.Out);\n }\n\n}\n\npublic class Scanner {\n private TextReader Reader;\n private Queue TokenQueue = new Queue();\n private CultureInfo ci = new CultureInfo(\"en-US\");\n\n public Scanner()\n : this(Console.In) {\n }\n\n public Scanner(TextReader reader) {\n this.Reader = reader;\n }\n\n public char NextChar() { return Next().Single(); }\n public int NextInt32() { return Int32.Parse(Next(), ci); }\n public long NextInt64() { return Int64.Parse(Next(), ci); }\n public double NextDouble() { return double.Parse(Next(), ci); }\n public string[] NextArray(int size) {\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 var array = new int[size];\n for (int i = 0; i < size; i++) array[i] = NextInt32();\n return array;\n }\n\n public long[] NextInt64Array(int size) {\n var array = new long[size];\n for (int i = 0; i < size; i++) array[i] = NextInt64();\n return array;\n }\n\n public String Next() {\n if (!TokenQueue.Any()) {\n if (!StockTokens()) throw new InvalidOperationException();\n }\n return TokenQueue.Dequeue();\n }\n\n public bool HasNext() {\n if (TokenQueue.Count > 0)\n return true;\n return StockTokens();\n }\n\n private bool StockTokens() {\n while (true) {\n var line = Reader.ReadLine();\n if (line == null) return false;\n var tokens = line.Trim().Split(\" \".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToArray();\n if (tokens.Length == 0) continue;\n foreach (var token in tokens)\n TokenQueue.Enqueue(token);\n return true;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "58299a19131a3adf7c6d32a613b49645", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Numerics;\n\nnamespace cf558\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf558A();\n } \n\n public static void solve_cf558A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n m = m <= 1 ? 1 : m;\n\n int res = m <= n / 2 ? m: n - m;\n\n Console.WriteLine(res);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "36365fac139407beafe5066f158e7343", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace testrun\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] values = Console.ReadLine().Split(' ');\n int n = int.Parse(values[0]);\n int m = int.Parse(values[1]);\n\n if (n == m)\n {\n System.Console.WriteLine(0);\n return;\n }\n\n if (m == 0)\n {\n System.Console.WriteLine(1);\n return; \n }\n\n int maxGroups = n / 2;\n int maxGroupsGap = n % 2 != 0 ? 1 : 0;\n\n if (m < maxGroups)\n {\n System.Console.WriteLine(m);\n return;\n }\n\n if (m > maxGroups + maxGroupsGap)\n {\n System.Console.WriteLine(maxGroups - (m - maxGroups - maxGroupsGap));\n return;\n }\n\n System.Console.WriteLine(maxGroups);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "195efcd635360f7cb84c06df2045d296", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 M = int.Parse(str[1]);\n\t\tint ans = 0;\n\t\tif(N==M){\n\t\t\tans = 0;\n\t\t} else if(M==0){\n\t\t ans = 1;\n\t\t} else {\n\t\t int A = N-M;\n\t\t\tans = Math.Min(M,A);\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cdec53b7964c96e80b7463ad39acd6b2", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace test1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var st = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(st[0]), m = Convert.ToInt32(st[1]);\n int x = 0;\n if (n % 2 == 0)\n {\n if (m >= n / 2)\n {\n x = n - m;\n }\n else if (m != 0)\n {\n x = m;\n }\n else\n {\n x = 1;\n } \n }\n else\n {\n if (m>n/2)\n {\n x = n - m;\n }\n else if (m == n / 2)\n {\n x = n - m - 1;\n }\n else if (m!=0)\n {\n x = m;\n }\n else\n {\n x = 1;\n }\n }\n Console.WriteLine(x);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f3003c382967661b4016d52127463931", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 m = sc.NextInt();\n if(m == 0)\n {\n Console.WriteLine(1);\n return;\n }\n int k = n - m;\n Console.WriteLine(Math.Min(k, 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "41e02198c51051ffa91098f6ffdb72e2", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Eating_Soup\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 m = Next();\n\n if (m < 2)\n return 1;\n\n if (n >= m*2)\n return m;\n if (n%2 == 1 && n == m*2 - 1)\n {\n return m - 1;\n }\n return n - m;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "106d1206005351da4ca5ccb0b35122c8", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\npublic class ansa{\n public static void Main() {\n //int n = Convert.ToInt32(Console.ReadLine());\n var num = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);\n int ans;\n if(num[1]==0 || num[1]==1) ans = 1;\n else if(num[1]*2>=num[0]) ans = num[0] - num[1];\n else ans = num[1];\n Console.WriteLine(ans);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1d49c83ba841d4103d4ef03f776cb04", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeff#define USE_FILES\n//#define MANY_TESTS_IN_INPUT\n//#define INCREASE_STACK\n\n#if ONLINE_JUDGE // Defined by Codeforces judging system\n#undef USE_FILES\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Acm\n{\n /// \n /// For the simplicity of hacking / reading / exploring.\n /// Problem solution is in this class only!\n /// \n class ProblemSolution\n {\n public LineReader In { get; }\n\n public TextWriter Out { get; }\n\n public ProblemSolution(LineReader @in, TextWriter @out)\n {\n In = @in;\n Out = @out;\n }\n\n /// \n /// \n /// \n /// For multi-test inputs: ID of test, from 1 to T\n /// For single-test inputs: -1\n /// \n public void SolveTest(int testId)\n {\n\t int[] input = In.Read();\n\t int n = input[0], m = input[1];\n\n\t if (m == 0)\n\t {\n\t\t Out.WriteLine(1);\n\t\t return;\n\t }\n\n\t int result = Math.Min(n - m, m);\n\t Out.WriteLine(result);\n }\n }\n\n // ---------------\n // There is nothing interesting below this line!\n // ---------------\n\n class Program\n {\n private static LineReader In { get; set; }\n\n private static TextWriter Out { get; set; }\n\n public static void Main(string[] args)\n {\n#if USE_FILES\n In = new LineReader(File.OpenText(\"input.txt\"));\n Out = new StreamWriter(\"../../output.txt\", false);\n#else\n In = new LineReader(Console.In);\n Out = Console.Out;\n#endif\n\n try\n {\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 Solve();\n#endif\n }\n finally\n {\n Out.Dispose();\n }\n }\n\n public static void Solve()\n {\n#if MANY_TESTS_IN_INPUT\n int t = In.Read();\n for (int i = 1; i <= t; i++)\n {\n new ProblemSolution(In, Out).SolveTest(i);\n }\n#else\n new ProblemSolution(In, Out).SolveTest(-1);\n#endif\n }\n }\n\n /// \n /// Input usability things\n /// \n class InputLine\n {\n private readonly string _line;\n\n public InputLine(string line)\n {\n _line = line;\n }\n\n public static implicit operator string(InputLine line)\n {\n return line._line;\n }\n\n public static implicit operator int(InputLine line)\n {\n return int.Parse(line._line);\n }\n\n public static implicit operator int[] (InputLine line)\n {\n return line._line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n }\n\n public static implicit operator long[] (InputLine line)\n {\n return line._line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n }\n }\n\n class LineReader\n {\n public TextReader Reader { get; }\n\n public LineReader(TextReader reader)\n {\n Reader = reader;\n }\n\n public InputLine Read()\n {\n string line = Reader.ReadLine();\n return line == null\n ? null\n : new InputLine(line.Trim());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "897d2c12da1e1f9a624b983bcccd68bc", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ree\n{\n class Program\n {\n static void Main()\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n if (m == 0)\n {\n Console.WriteLine(1);\n }\n else if (m <= n / 2)\n {\n Console.WriteLine(m);\n }\n else\n {\n Console.WriteLine(n - m);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "557346a6925e23d662320251ee1e95ff", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 try\n {\n Solve();\n }\n catch (Exception e)\n {\n Console.WriteLine(e);\n }\n \n }\n\n static void Solve()\n {\n \n var nm = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n var n = nm[0];\n var m = nm[1];\n int left;\n if (n == m)\n left = 0;\n else if (m == 0)\n left = 1;\n else\n left = Math.Min(m, n - m);\n Console.WriteLine(left);\n \n }\n\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "83e4d966ae7ce2b3ad3ccd01e9605ee8", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp30\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(),int.Parse);\n int answer = 0;\n answer = (arr[0] - arr[1]);\n if (arr[0] == arr[1])\n {\n Console.WriteLine(0);\n\n }\n else if (arr[1] == 0)\n {\n Console.WriteLine(1);\n }\n else\n {\n answer = Math.Min(arr[1], answer);\n Console.WriteLine(answer);\n }\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "81005ed9eb876a1d84feaadce1e602f9", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 = input.ReadInt();\n Console.Write(m == 0 ? 1 : Min(n - m, m));\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 IncCount(Dictionary counter, T item)\n {\n if (counter.TryGetValue(item, out var count))\n return (counter[item] = count + 1);\n counter.Add(item, 1);\n return 1;\n }\n\n private static void DecCount(Dictionary counter, T item)\n {\n if (counter.TryGetValue(item, out var count))\n {\n if (count == 1)\n counter.Remove(item);\n else\n counter[item] = count - 1;\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "907e2d7fbc463aecf2be49b3f1ac279e", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Numerics;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing static System.Math;\nusing Debug = System.Diagnostics.Debug;\nusing System.Runtime.CompilerServices;\nusing MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;\nusing MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;\n\nstatic class P\n{\n static void Main()\n {\n var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = nm[0];\n var m = nm[1];\n Console.WriteLine(Min(Max(1, m), n - m));\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c4333386eb3a29c633d91ac7c30ae49f", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSharpConsoleProject2\n{\n\n class Sudoku\n {\n static void Main(string[] args)\n {\n int n = 0, m = 0;\n string str = Console.ReadLine();\n\n n = Convert.ToInt32(str.Split(' ')[0]);\n m = Convert.ToInt32(str.Split(' ')[1]);\n\n int a = 0;\n\n if (m == 0)\n {\n a = 1;\n } else if (m == n)\n {\n a = 0;\n } else\n {\n a = m;\n if (a > (n - m))\n {\n a = (n - m);\n }\n }\n\n Console.WriteLine(a);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6590b3d903570abed36563b46c97273c", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n int n = Convert.ToInt32(line.Split(' ')[0]);\n int m = Convert.ToInt32(line.Split(' ')[1]);\n int otvet;\n if(m == 0) {\n Console.WriteLine(1);\n return;\n }\n \n int x = n / 2;\n if (m <= x)\n otvet = m;\n else otvet = n - m;\n Console.WriteLine(otvet);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "584f43f41d36d4c836b410a28205965b", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 = ReadInt();\n int ans = m == 0 ? 1 : Math.Min(m, n - m);\n Writer.WriteLine(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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3d1efa2049078f7481fd938d9bd4b949", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace ACM\n{\n class Program\n {\n static int Gcd(int a, int b)\n {\n return b != 0 ? Gcd(b, a % b) : a;\n }\n\n static int Solve(int n, int m)\n {\n if (m == 0)\n {\n return 1;\n }\n \n if (m == n)\n {\n return 0;\n }\n\n m--;\n int length = n - 1;\n int one = 0;\n while (m-- > 0)\n {\n if (length == 0)\n {\n one--;\n }\n else if (length == 1)\n {\n length--;\n }\n else if (length == 2)\n {\n length--;\n }\n else\n {\n length -= 2;\n one++;\n }\n }\n\n if (length > 0)\n {\n one++;\n }\n\n return one;\n }\n\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int n = int.Parse(token[0]);\n int m = int.Parse(token[1]);\n Console.WriteLine(Solve(n, m));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ee84a8274565de5d247200ed02499c3", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 void Main(string[] args)\n {\n //var n = int.Parse(Console.ReadLine().Trim());\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);\n var n = arr[0];\n var m = arr[1];\n if (m == 0)\n Console.WriteLine(1);\n else if (m <= n / 2)\n {\n Console.WriteLine(m);\n }\n else\n {\n Console.WriteLine(n - m);\n }\n\n\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1bb3c6f75bd2d73aec5e0518f8aa068c", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n var data = Console.ReadLine().Split();\n\n int a = int.Parse(data[0]);\n int b = int.Parse(data[1]);\n\n if (a >= 2 * b)\n if (b == 0)\n {\n Console.WriteLine(1);\n }\n else\n {\n Console.WriteLine(b);\n }\n else if (a > b)\n Console.WriteLine(a - b);\n else if (a <= b)\n Console.WriteLine(0);\n else\n Console.WriteLine(1);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d1889a25d86f8fe0c2a5543788b7dcfa", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 s_IsMultipleTestCases = false;\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#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#if DEBUG\n timer.Start();\n#endif\n Task solver = new Task();\n solver.Solve(testNumber, reader, streamWriter);\n#if DEBUG\n streamWriter.WriteLine(\"Eslapsed Time: \" + timer.ElapsedMilliseconds + \" ms\\n\");\n timer.Reset();\n#endif\n }\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 var res = 0;\n\n if(m == 0)\n {\n writer.WriteLine(1);\n return;\n }\n\n if(m <= n / 2)\n {\n res = m;\n }\n else if(n % 2 == 0)\n {\n res = n / 2 - (m - n / 2);\n }\n else\n {\n res = n / 2 - (m - 1 - n / 2);\n }\n\n writer.WriteLine(res);\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "66e0d074b547dba8118b888417966689", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 M = cin.nextint;\n\n if (M == 0)\n {\n WriteLine(1);\n return;\n }\n\n if (N % 2 == 0)\n {\n if (M <= N / 2)\n {\n WriteLine(M);\n return;\n }\n else\n {\n WriteLine(N - M);\n }\n }\n else\n {\n int X = N / 2;\n if (true)\n {\n if (M <= X)\n {\n WriteLine(M);\n }\n else\n { \n WriteLine(N - M);\n }\n\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c96fd3ed5ec5f0172e763c26395aa5f8", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 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 static int nok(int a, int b)\n {\n int nod1 = nod(a, b);\n return a * b / nod1;\n }\n static void Main(string[] args)\n {\n string[] y = Console.ReadLine().Split(' ');\n int n = int.Parse(y[0]);\n int m = int.Parse(y[1]);\n int[] a = new int[n + 1];\n int chet = n / 2;\n int nech = n / 2;\n\n if (m == 0)\n m = 1;\n if (m > n / 2)\n Console.Write(n - m);\n else\n Console.Write(m);\n //Console.ReadKey();\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c516acbef17d1d87d2c98e49269c58d1", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 s_IsMultipleTestCases = false;\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#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#if DEBUG\n timer.Start();\n#endif\n Task solver = new Task();\n solver.Solve(testNumber, reader, streamWriter);\n#if DEBUG\n streamWriter.WriteLine(\"Eslapsed Time: \" + timer.ElapsedMilliseconds + \" ms\\n\");\n timer.Reset();\n#endif\n }\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 var res = 0;\n\n if(m <= n / 2)\n {\n res = m;\n }\n else if(n % 2 == 0)\n {\n res = n / 2 - (m - n / 2);\n }\n else\n {\n res = n / 2 - (m - 1 - n / 2);\n }\n\n writer.WriteLine(res);\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5ea90aa2b27bd480d12ce54fe781e8e2", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace testrun\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] values = Console.ReadLine().Split(' ');\n int n = int.Parse(values[0]);\n int m = int.Parse(values[1]);\n\n if (n == m)\n {\n System.Console.WriteLine(0);\n return;\n }\n\n int maxGroups = n / 2;\n int maxGroupsGap = n % 2 != 0 ? 1 : 0;\n\n if (m < maxGroups)\n {\n System.Console.WriteLine(m);\n return;\n }\n\n if (m > maxGroups + maxGroupsGap)\n {\n System.Console.WriteLine(maxGroups - (m - maxGroups - maxGroupsGap));\n return;\n }\n\n System.Console.WriteLine(maxGroups);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e82f39f735c1064db0acdf0e9d710b6c", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n var data = Console.ReadLine().Split();\n\n int a = int.Parse(data[0]);\n int b = int.Parse(data[1]);\n\n if (b == 0 && a != 0)\n Console.WriteLine(0);\n\n if (a >= 2 * b)\n Console.WriteLine(b);\n else if (a > b)\n Console.WriteLine(a - b);\n else if (a <= b)\n Console.WriteLine(0);\n else\n Console.WriteLine(1);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "00abb785f2392c8e716c5733a6a28bd5", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp30\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(),int.Parse);\n int answer = 0;\n answer = (arr[0] - arr[1]);\n if (arr[1] == 0 || arr[1] == 1)\n Console.WriteLine(1);\n else if (answer / arr[1] == 0)\n Console.WriteLine(answer);\n else\n Console.WriteLine(answer / arr[1]);\n\n\n\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4feb0528305d9321abeec8f3ca3122c3", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Numerics;\n\nnamespace cf558\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf558A();\n } \n\n public static void solve_cf558A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int res = m <= n / 2 ? m : n - m;\n\n Console.WriteLine(res);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "53665430de102645b5e2f37663495ee6", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 try\n {\n Solve();\n }\n catch (Exception e)\n {\n Console.WriteLine(e);\n }\n \n }\n\n static void Solve()\n {\n \n var nm = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n var n = nm[0];\n var m = nm[1];\n int left;\n if (n == m)\n left = 0;\n else if (m == 0)\n left = 0;\n else\n left = Math.Min(m, n - m);\n Console.WriteLine(left);\n \n }\n\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f5595ee9bd0d8934adeaee580a44f404", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace testrun\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] values = Console.ReadLine().Split(' ');\n int n = int.Parse(values[0]);\n int m = int.Parse(values[1]);\n\n if (n == m)\n {\n System.Console.WriteLine(0);\n return;\n }\n\n int maxGroups = n / 2;\n int maxGroupsGap = n % 2 != 0 ? 1 : 0;\n\n if (m < maxGroups)\n {\n System.Console.WriteLine(m + 1);\n return;\n }\n\n if (m > maxGroups + maxGroupsGap)\n {\n System.Console.WriteLine(maxGroups - (m - maxGroups - maxGroupsGap));\n return;\n }\n\n System.Console.WriteLine(maxGroups);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "97884eb1a2f365d7c49d19e81b4cea36", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Numerics;\n\nnamespace cf558\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf558A();\n } \n\n public static void solve_cf558A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n m = m == 0 ? 1 : m;\n\n int res = m < n / 2 ? m + 1: n - m;\n\n Console.WriteLine(res);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c4c1d9999c66e8b76fc2fe29a06f18f", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "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 try\n {\n Solve();\n }\n catch (Exception e)\n {\n Console.WriteLine(e);\n }\n \n }\n\n static void Solve()\n {\n \n var nm = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n var n = nm[0];\n var m = nm[1];\n var left = Math.Min(m, n - m);\n Console.WriteLine(left);\n \n }\n\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7ad0a98d238ad6b524abf90c44b08421", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace testrun\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 (n == m)\n {\n System.Console.WriteLine(0);\n return;\n }\n\n int maxGroups = n / 2;\n int maxGroupsGap = n % 2 != 0 ? 1 : 0;\n\n if (m < maxGroups)\n {\n System.Console.WriteLine(m + 1);\n return;\n }\n\n if (m > maxGroups + maxGroupsGap)\n {\n System.Console.WriteLine(maxGroups - (m - maxGroups - maxGroupsGap));\n return;\n }\n\n System.Console.WriteLine(maxGroups);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b6f11b8f984878d64ec1a1b3d37e09f7", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace testrun\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int16 n = Int16.Parse(Console.ReadLine());\n Int16 m = Int16.Parse(Console.ReadLine());\n\n int maxGroups = n / 2;\n int maxRemovedForMaxGroups = n / 2;\n if (n % 2 != 0)\n maxRemovedForMaxGroups++;\n\n if (m < maxRemovedForMaxGroups)\n {\n System.Console.WriteLine(m);\n return;\n }\n \n if(m == maxRemovedForMaxGroups)\n {\n System.Console.WriteLine(maxGroups);\n return;\n }\n\n System.Console.WriteLine(maxGroups - (m - maxRemovedForMaxGroups));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c13ca6c3450435f70fbdbbad267c8ae8", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace testrun\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int16 n = Int16.Parse(Console.ReadLine());\n Int16 m = Int16.Parse(Console.ReadLine());\n\n if (n == m)\n {\n System.Console.WriteLine(0);\n return;\n }\n\n int maxGroups = n / 2;\n int maxRemovedForMaxGroups = n / 2;\n\n\n if (n % 2 != 0)\n maxRemovedForMaxGroups++;\n\n if (m < maxGroups)\n {\n System.Console.WriteLine(m + 1);\n return;\n }\n\n if (m < maxRemovedForMaxGroups)\n {\n System.Console.WriteLine(m);\n return;\n }\n\n if (m == maxRemovedForMaxGroups)\n {\n System.Console.WriteLine(maxGroups);\n return;\n }\n\n System.Console.WriteLine(maxGroups - (m - maxRemovedForMaxGroups));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "af09d8eb843e461e2e72b5baeea3cfe5", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp26\n{\n \n\n\n class Program\n {\n static void Main(string[] args)\n {\n \n\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "84b2b559fe8bd4c7fa261fa61a984ccb", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nusing Pair = System.Collections.Generic.KeyValuePair;\n\nnamespace Task\n{\n internal class Program\n {\n int cnt = 0;\n Dictionary data = new Dictionary();\n bool[,] was = new bool[100, 100];\n\n long xfx(int x, int y, long z)\n {\n if (x == -1)\n return 0;\n if (z == 0)\n return 0;\n if (y == 1)\n {\n if (x == 0)\n return 1;\n return 0;\n }\n\n var key = new Pair((x << 16) | y, z);\n\n if (data.ContainsKey(key))\n return data[key];\n\n long hsize = getSize(y - 1);\n\n long ans = 0;\n\n if (z >= hsize)\n {\n long temp1 = xfx(x, y - 1, hsize);\n long temp2 = xfx(x - 1, y - 1, z - hsize);\n ans += temp1 + temp2;\n }\n else\n {\n long temp = xfx(x, y - 1, z);\n ans += temp;\n }\n\n data[key] = ans;\n return ans;\n }\n\n\n\n long getSize(int y)\n {\n return 1L << (y - 1);\n }\n\n long get(int x, long z)\n {\n long ans = 0;\n\n int num = 1;\n while (z > 0)\n {\n long size = getSize(num);\n long temp = xfx(x, num, Math.Min(size, z));\n \n z -= size;\n ans += temp;\n\n num++;\n }\n\n return ans;\n\n }\n\n private void Solve()\n {\n long n = io.NextLong();\n long t = io.NextLong();\n\n long x = 1;\n int p = 0;\n\n while (x < t)\n {\n x <<= 1;\n p++;\n }\n\n if (x != t)\n {\n io.Print(0);\n return;\n }\n\n long ans = get(p, n + 1);\n if (t == 1)\n ans--;\n io.Print(ans);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6477625babde804eeb2543c830a1fe6a", "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Reverse\r\n{\r\n internal class Program\r\n {\r\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\r\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\r\n\r\n private static void Main(string[] args)\r\n {\r\n writer.WriteLine(Solve() ? \"YES\" : \"NO\");\r\n writer.Flush();\r\n }\r\n\r\n private static bool Solve()\r\n {\r\n long a = Next();\r\n long b = Next();\r\n\r\n if (a == b)\r\n return true;\r\n\r\n string s = Convert.ToString(a, 2);\r\n string t = Convert.ToString(b, 2);\r\n\r\n if (Subs(t, s.TrimEnd('0')))\r\n return true;\r\n\r\n if (Subs(t, new string(s.TrimEnd('0').Reverse().ToArray())))\r\n return true;\r\n\r\n if (Subs(t, s + \"1\"))\r\n return true;\r\n\r\n if (Subs(t, new string((s + \"1\").Reverse().ToArray())))\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n private static bool Subs(string t, string s)\r\n {\r\n int p = 0;\r\n while (true)\r\n {\r\n int index = t.IndexOf(s, p);\r\n if (index >= 0)\r\n {\r\n bool ok = true;\r\n for (int i = 0; i < index; i++)\r\n {\r\n if (t[i] != '1')\r\n {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n\r\n if (ok)\r\n for (int i = index + s.Length; i < t.Length; i++)\r\n {\r\n if (t[i] != '1')\r\n {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n\r\n if (ok)\r\n return true;\r\n\r\n p = index + 1;\r\n }\r\n else break;\r\n }\r\n return false;\r\n }\r\n\r\n private static long Next()\r\n {\r\n int c;\r\n long res = 0;\r\n do\r\n {\r\n c = reader.Read();\r\n if (c == -1)\r\n return res;\r\n } while (c < '0' || c > '9');\r\n res = c - '0';\r\n while (true)\r\n {\r\n c = reader.Read();\r\n if (c < '0' || c > '9')\r\n return res;\r\n res *= 10;\r\n res += c - '0';\r\n }\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8d9e151157e09eae1d0d243f88f2ea41", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace ConsoleApp1\r\n{\r\n\r\n class Program\r\n {\r\n\r\n static bool def(List mas, List an, int ind)\r\n {\r\n var cnt = 0;\r\n for(int i=ind, j = 0; i < mas.Count && j < an.Count ; i++, j++)\r\n {\r\n if (mas[i] != an[j])\r\n return false;\r\n cnt++;\r\n }\r\n if (cnt < an.Count)\r\n return false;\r\n for (int i = 0; i < ind; i++)\r\n if (mas[i] == 0)\r\n return false;\r\n for (int i = ind + an.Count; i < mas.Count; i++)\r\n if (mas[i] == 0)\r\n return false;\r\n if (an[an.Count - 1] == 0 && ind + an.Count >= mas.Count)\r\n return false;\r\n if (an[0] == 0 && ind == 0)\r\n return false;\r\n return true;\r\n }\r\n\r\n static async Task Main(string[] args)\r\n {\r\n var input = Console.ReadLine().Split(' ').Select(long.Parse).ToList();\r\n long x = input[0], y = input[1];\r\n if( x == y)\r\n {\r\n Console.WriteLine(\"YES\");\r\n }\r\n else\r\n {\r\n var xmas = new List();\r\n while(x > 0)\r\n {\r\n xmas.Add(x % 2);\r\n x /= 2;\r\n }\r\n xmas.Reverse();\r\n\r\n var ymas = new List();\r\n while (y > 0)\r\n {\r\n ymas.Add(y % 2);\r\n y /= 2;\r\n }\r\n ymas.Reverse();\r\n\r\n var rxmas = xmas.Select(i => i).ToList();\r\n rxmas.Reverse();\r\n var gmas = xmas.Select(i => i).ToList();\r\n for (int i = gmas.Count() - 1; i >= 0; i--)\r\n if (gmas[i] == 0)\r\n gmas.RemoveAt(i);\r\n else\r\n break;\r\n var rgmas = gmas.Select(i => i).ToList();\r\n rgmas.Reverse();\r\n\r\n var good = true;\r\n for(int i=0;i < ymas.Count(); i++)\r\n {\r\n if (def(ymas, xmas, i))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n if (def(ymas, rxmas, i))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n if (def(ymas, gmas, i))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n if (def(ymas, rgmas, i))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n }\r\n Console.WriteLine(\"NO\");\r\n }\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "78cfcb5abdcf32aaa5a23d1196b1adfc", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Text;\r\n\r\nnamespace F\r\n{\r\n #region Library\r\n public static class Tools\r\n {\r\n#if DEBUG\r\n private static StringReader InputReader = new StringReader(Input.Text);\r\n#endif\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public static string ReadLine()\r\n {\r\n#if DEBUG\r\n return InputReader.ReadLine();\r\n#else\r\n return Console.ReadLine();\r\n#endif\r\n }\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public static long[] ReadInts()\r\n {\r\n return ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\r\n }\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public static (long, long) ReadInt2()\r\n {\r\n var result = ReadInts();\r\n#if DEBUG\r\n if (result.Length != 2)\r\n {\r\n throw new ArgumentException(\"Expected 2 ints.\");\r\n }\r\n#endif\r\n return (result[0], result[1]);\r\n }\r\n }\r\n #endregion\r\n\r\n public static class Input\r\n {\r\n public static readonly string Text = @\"3 3\r\n7 4\r\n2 8\r\n34 69\r\n8935891487501725 71487131900013807\r\n11 13\r\n\";\r\n }\r\n\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n Console.WriteLine(Solve() ? \"YES\" : \"NO\");\r\n //Enumerable.Repeat(0, 6).Select(x => { Console.WriteLine(Solve() ? \"YES\" : \"NO\"); return 0; }).ToList();\r\n }\r\n\r\n static string Reverse(string a)\r\n {\r\n var b = a.ToCharArray();\r\n Array.Reverse(b);\r\n return new string(b);\r\n }\r\n\r\n static string ToBinary(long a)\r\n {\r\n var sb = new StringBuilder();\r\n\r\n while(a > 0)\r\n {\r\n sb.Append(a & 0x1);\r\n a >>= 1;\r\n }\r\n\r\n return Reverse(sb.ToString());\r\n }\r\n\r\n\r\n static bool Solve()\r\n {\r\n var (src, tgt) = Tools.ReadInt2();\r\n\r\n if (src == tgt)\r\n {\r\n return true;\r\n }\r\n\r\n var tgt0 = ToBinary(tgt);\r\n\r\n if (tgt0.EndsWith('0'))\r\n {\r\n return false;\r\n }\r\n\r\n var src0 = ToBinary(src);\r\n var src1 = src0 + \"1\";\r\n src0 = src0.Trim('0');\r\n var src2 = Reverse(src0);\r\n var src3 = Reverse(src1);\r\n\r\n foreach (var candSRC in new string[] { src0, src1, src2, src3 })\r\n {\r\n var index = tgt0.IndexOf(candSRC);\r\n\r\n if (index == -1) continue;\r\n\r\n if (tgt0.Take(index).Concat(tgt0.Skip(index + candSRC.Length)).All(x => x == '1'))\r\n {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4ac7292cfde7c7e00c6e749ff082b397", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Reverse\r\n{\r\n internal class Program\r\n {\r\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\r\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\r\n\r\n private static void Main(string[] args)\r\n {\r\n writer.WriteLine(Solve() ? \"YES\" : \"NO\");\r\n writer.Flush();\r\n }\r\n\r\n private static bool Solve()\r\n {\r\n long a = Next();\r\n long b = Next();\r\n\r\n if (a == b)\r\n return true;\r\n\r\n string s = Convert.ToString(a, 2);\r\n string t = Convert.ToString(b, 2);\r\n\r\n if (Subs(t, s.TrimEnd('0')))\r\n return true;\r\n\r\n if (Subs(t, new string(s.TrimEnd('0').Reverse().ToArray())))\r\n return true;\r\n\r\n if (Subs(t, s + \"1\"))\r\n return true;\r\n\r\n if (Subs(t, new string((s + \"1\").Reverse().ToArray())))\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n private static bool Subs(string t, string s)\r\n {\r\n int p = 0;\r\n while (true)\r\n {\r\n int index = t.IndexOf(s, p);\r\n if (index >= 0)\r\n {\r\n bool ok = true;\r\n for (int i = 0; i < index; i++)\r\n {\r\n if (t[i] != '1')\r\n {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n\r\n if (ok)\r\n for (int i = index + s.Length; i < t.Length; i++)\r\n {\r\n if (t[i] != '1')\r\n {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n\r\n if (ok)\r\n return true;\r\n\r\n p = index + 1;\r\n }\r\n else break;\r\n }\r\n return false;\r\n }\r\n\r\n private static long Next()\r\n {\r\n int c;\r\n long res = 0;\r\n do\r\n {\r\n c = reader.Read();\r\n if (c == -1)\r\n return res;\r\n } while (c < '0' || c > '9');\r\n res = c - '0';\r\n while (true)\r\n {\r\n c = reader.Read();\r\n if (c < '0' || c > '9')\r\n return res;\r\n res *= 10;\r\n res += c - '0';\r\n }\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4a07bc09b6da198a93cf2e33ca311b64", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\r\nusing System.Threading;\r\nusing System.IO;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\npublic class Program\r\n{\r\n long X, Y;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n X = sc.NextLong();\r\n Y = sc.NextLong();\r\n\r\n if (X == Y)\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n bool[] by = ToArray(Y);\r\n\r\n bool[] bx1 = ToArray(2 * X + 1);\r\n if (F(by, bx1))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n Array.Reverse(bx1);\r\n if (F(by, bx1))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n while (X % 2 == 0) X /= 2;\r\n bool[] bx2 = ToArray(X);\r\n if (F(by, bx2))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n Array.Reverse(bx2);\r\n if (F(by, bx2))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n Console.WriteLine(\"NO\");\r\n }\r\n\r\n\r\n bool F(bool[] fy, bool[] fx)\r\n {\r\n if (fy.Length < fx.Length) return false;\r\n bool left = true;\r\n for (int i = 0; i + fx.Length <= fy.Length && left; i++)\r\n {\r\n bool flag = true;\r\n for (int j = 0; j < fx.Length && flag; j++)\r\n {\r\n flag &= fx[j] == fy[i + j];\r\n }\r\n if (flag)\r\n {\r\n for (int j = i + fx.Length; j < fy.Length && flag; j++)\r\n {\r\n flag &= fy[j];\r\n }\r\n if (flag) return true;\r\n }\r\n\r\n left &= fy[i];\r\n }\r\n return false;\r\n }\r\n\r\n bool[] ToArray(long n)\r\n {\r\n int lg = 0;\r\n long tmp = n;\r\n while (tmp > 0)\r\n {\r\n lg++;\r\n tmp /= 2;\r\n }\r\n\r\n tmp = n;\r\n bool[] ret = new bool[lg];\r\n for (int i = 0; i < lg; i++)\r\n {\r\n ret[i] = tmp % 2 == 1;\r\n tmp /= 2;\r\n }\r\n return ret;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "58194b87e02434d2da9ae4b1d40538ab", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Text;\r\n\r\nnamespace F\r\n{\r\n #region Library\r\n public static class Tools\r\n {\r\n#if DEBUG\r\n private static StringReader InputReader = new StringReader(Input.Text);\r\n#endif\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public static string ReadLine()\r\n {\r\n#if DEBUG\r\n return InputReader.ReadLine();\r\n#else\r\n return Console.ReadLine();\r\n#endif\r\n }\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public static long[] ReadInts()\r\n {\r\n return ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\r\n }\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public static (long, long) ReadInt2()\r\n {\r\n var result = ReadInts();\r\n#if DEBUG\r\n if (result.Length != 2)\r\n {\r\n throw new ArgumentException(\"Expected 2 ints.\");\r\n }\r\n#endif\r\n return (result[0], result[1]);\r\n }\r\n }\r\n #endregion\r\n\r\n public static class Input\r\n {\r\n public static readonly string Text = @\"3 3\r\n7 4\r\n2 8\r\n34 69\r\n8935891487501725 71487131900013807\r\n\";\r\n }\r\n\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n Console.WriteLine(Solve() ? \"YES\" : \"NO\");\r\n //Enumerable.Repeat(0, 5).Select(x => { Console.WriteLine(Solve() ? \"YES\" : \"NO\"); return 0; }).ToList();\r\n }\r\n\r\n static string Reverse(string a)\r\n {\r\n var b = a.ToCharArray();\r\n Array.Reverse(b);\r\n return new string(b);\r\n }\r\n\r\n static string ToBinary(long a)\r\n {\r\n var sb = new StringBuilder();\r\n\r\n while(a > 0)\r\n {\r\n sb.Append(a & 0x1);\r\n a >>= 1;\r\n }\r\n\r\n return Reverse(sb.ToString());\r\n }\r\n\r\n\r\n static bool Solve()\r\n {\r\n var (src, tgt) = Tools.ReadInt2();\r\n\r\n if (src == tgt)\r\n {\r\n return true;\r\n }\r\n\r\n var tgt0 = ToBinary(tgt);\r\n\r\n if (tgt0.EndsWith('0'))\r\n {\r\n return false;\r\n }\r\n\r\n var src0 = ToBinary(src);\r\n var src1 = src0 + \"1\";\r\n src0 = src0.Trim();\r\n var src2 = Reverse(src0);\r\n var src3 = Reverse(src1);\r\n\r\n foreach (var candSRC in new string[] { src0, src1, src2, src3 })\r\n {\r\n var index = tgt0.IndexOf(candSRC);\r\n\r\n if (index == -1) continue;\r\n\r\n if (tgt0.Take(index).Concat(tgt0.Skip(index + candSRC.Length)).All(x => x == '1'))\r\n {\r\n Console.WriteLine($\"{candSRC} {tgt0}\");\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "09359b140b3dedd73c808f083ca74baf", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\r\nusing System.Threading;\r\nusing System.IO;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\npublic class Program\r\n{\r\n long X, Y;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n X = sc.NextLong();\r\n Y = sc.NextLong();\r\n bool[] by = ToArray(Y);\r\n\r\n while (true)\r\n {\r\n long tx = X;\r\n // tx, tx\u306e\u9006\u3092\u90e8\u5206\u5217\u3068\u3057\u3066\u542b\u3080\r\n // \u305d\u308c\u4ee5\u59161\r\n bool[] bx = ToArray(tx);\r\n\r\n if(F(by, bx))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n Array.Reverse(bx);\r\n if (F(by, bx))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n\r\n if (X % 2 != 0) break;\r\n X /= 2;\r\n }\r\n\r\n Console.WriteLine(\"NO\");\r\n }\r\n\r\n bool F(bool[] fy, bool[] fx)\r\n {\r\n if (fy.Length < fx.Length) return false;\r\n bool left = true;\r\n for (int i = 0; i + fx.Length <= fy.Length && left; i++)\r\n {\r\n bool flag = true;\r\n for (int j = 0; j < fx.Length && flag; j++)\r\n {\r\n flag &= fx[j] == fy[i + j];\r\n }\r\n if (flag)\r\n {\r\n for (int j = i + fx.Length; j < fy.Length && flag; j++)\r\n {\r\n flag &= fy[j];\r\n }\r\n if (flag) return true;\r\n }\r\n\r\n left &= fy[i];\r\n }\r\n return false;\r\n }\r\n\r\n bool[] ToArray(long n)\r\n {\r\n int lg = 0;\r\n long tmp = n;\r\n while (tmp > 0)\r\n {\r\n lg++;\r\n tmp /= 2;\r\n }\r\n\r\n tmp = n;\r\n bool[] ret = new bool[lg];\r\n for (int i = 0; i < lg; i++)\r\n {\r\n ret[i] = tmp % 2 == 1;\r\n tmp /= 2;\r\n }\r\n return ret;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5fa29e078464d1c40d3f7f19dec3fa2c", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\r\nusing System.Threading;\r\nusing System.IO;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\npublic class Program\r\n{\r\n long X, Y;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n X = sc.NextLong();\r\n Y = sc.NextLong();\r\n\r\n bool[] by = ToArray(Y);\r\n\r\n while (true)\r\n {\r\n // tx, tx\u306e\u9006\u3092\u90e8\u5206\u5217\u3068\u3057\u3066\u542b\u3080\r\n // \u305d\u308c\u4ee5\u59161\r\n bool[] bx = ToArray(X);\r\n\r\n if(F(by, bx, true))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n Array.Reverse(bx);\r\n if (F(by, bx, false))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n\r\n if (X % 2 != 0) break;\r\n X /= 2;\r\n }\r\n\r\n Console.WriteLine(\"NO\");\r\n }\r\n\r\n bool F(bool[] fy, bool[] fx, bool tmp)\r\n {\r\n if (fy.Length < fx.Length) return false;\r\n bool left = true;\r\n for (int i = 0; i + fx.Length <= fy.Length && left; i++)\r\n {\r\n bool flag = true;\r\n for (int j = 0; j < fx.Length && flag; j++)\r\n {\r\n flag &= fx[j] == fy[i + j];\r\n }\r\n if (flag && (tmp || i > 0))\r\n {\r\n for (int j = i + fx.Length; j < fy.Length && flag; j++)\r\n {\r\n flag &= fy[j];\r\n }\r\n if (flag) return true;\r\n }\r\n\r\n left &= fy[i];\r\n }\r\n return false;\r\n }\r\n\r\n bool[] ToArray(long n)\r\n {\r\n int lg = 0;\r\n long tmp = n;\r\n while (tmp > 0)\r\n {\r\n lg++;\r\n tmp /= 2;\r\n }\r\n\r\n tmp = n;\r\n bool[] ret = new bool[lg];\r\n for (int i = 0; i < lg; i++)\r\n {\r\n ret[i] = tmp % 2 == 1;\r\n tmp /= 2;\r\n }\r\n return ret;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4ba24f28193bb85c7afb239db7ac8aff", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Text;\r\n\r\nnamespace F\r\n{\r\n #region Library\r\n public static class Tools\r\n {\r\n#if DEBUG\r\n private static StringReader InputReader = new StringReader(Input.Text);\r\n#endif\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public static string ReadLine()\r\n {\r\n#if DEBUG\r\n return InputReader.ReadLine();\r\n#else\r\n return Console.ReadLine();\r\n#endif\r\n }\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public static long[] ReadInts()\r\n {\r\n return ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\r\n }\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public static (long, long) ReadInt2()\r\n {\r\n var result = ReadInts();\r\n#if DEBUG\r\n if (result.Length != 2)\r\n {\r\n throw new ArgumentException(\"Expected 2 ints.\");\r\n }\r\n#endif\r\n return (result[0], result[1]);\r\n }\r\n }\r\n #endregion\r\n\r\n public static class Input\r\n {\r\n public static readonly string Text = @\"3 3\r\n7 4\r\n2 8\r\n34 69\r\n8935891487501725 71487131900013807\r\n\";\r\n }\r\n\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n Console.WriteLine(Solve() ? \"YES\" : \"NO\");\r\n //Enumerable.Repeat(0, 5).Select(x => { Console.WriteLine(Solve() ? \"YES\" : \"NO\"); return 0; }).ToList();\r\n }\r\n\r\n static string Reverse(string a)\r\n {\r\n var b = a.ToCharArray();\r\n Array.Reverse(b);\r\n return new string(b);\r\n }\r\n\r\n static string ToBinary(long a)\r\n {\r\n var sb = new StringBuilder();\r\n\r\n while(a > 0)\r\n {\r\n sb.Append(a & 0x1);\r\n a >>= 1;\r\n }\r\n\r\n return Reverse(sb.ToString());\r\n }\r\n\r\n\r\n static bool Solve()\r\n {\r\n var (src, tgt) = Tools.ReadInt2();\r\n\r\n if (src == tgt)\r\n {\r\n return true;\r\n }\r\n\r\n var tgt0 = ToBinary(tgt);\r\n\r\n if (tgt0.EndsWith('0'))\r\n {\r\n return false;\r\n }\r\n\r\n var src0 = ToBinary(src);\r\n var src1 = src0 + \"1\";\r\n src0 = src0.Trim();\r\n var src2 = Reverse(src0);\r\n var src3 = Reverse(src1);\r\n\r\n foreach (var candSRC in new string[] { src0, src1, src2, src3 })\r\n {\r\n var index = tgt0.IndexOf(candSRC);\r\n\r\n if (index == -1) continue;\r\n\r\n if (tgt0.Take(index).Concat(tgt0.Skip(index + candSRC.Length)).All(x => x == '1'))\r\n {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cde8b71c4c2c1ceb3631cd25a554d7d8", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\r\nusing System.Threading;\r\nusing System.IO;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\npublic class Program\r\n{\r\n long X, Y;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n X = sc.NextLong();\r\n Y = sc.NextLong();\r\n\r\n if (X == Y)\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n bool[] by = ToArray(Y);\r\n\r\n while (true)\r\n {\r\n // tx, tx\u306e\u9006\u3092\u90e8\u5206\u5217\u3068\u3057\u3066\u542b\u3080\r\n // \u305d\u308c\u4ee5\u59161\r\n bool[] bx = ToArray(X % 2 == 1 ? X : 2 * X + 1);\r\n\r\n if (F(by, bx))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n Array.Reverse(bx);\r\n if (F(by, bx))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n\r\n if (X % 2 != 0) break;\r\n X /= 2;\r\n }\r\n\r\n Console.WriteLine(\"NO\");\r\n }\r\n\r\n bool F(bool[] fy, bool[] fx)\r\n {\r\n if (fy.Length < fx.Length) return false;\r\n bool left = true;\r\n for (int i = 0; i + fx.Length <= fy.Length && left; i++)\r\n {\r\n bool flag = true;\r\n for (int j = 0; j < fx.Length && flag; j++)\r\n {\r\n flag &= fx[j] == fy[i + j];\r\n }\r\n if (flag)\r\n {\r\n for (int j = i + fx.Length; j < fy.Length && flag; j++)\r\n {\r\n flag &= fy[j];\r\n }\r\n if (flag) return true;\r\n }\r\n\r\n left &= fy[i];\r\n }\r\n return false;\r\n }\r\n\r\n bool[] ToArray(long n)\r\n {\r\n int lg = 0;\r\n long tmp = n;\r\n while (tmp > 0)\r\n {\r\n lg++;\r\n tmp /= 2;\r\n }\r\n\r\n tmp = n;\r\n bool[] ret = new bool[lg];\r\n for (int i = 0; i < lg; i++)\r\n {\r\n ret[i] = tmp % 2 == 1;\r\n tmp /= 2;\r\n }\r\n return ret;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "11d0c7e543099173217ca00dbc71d919", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Reverse\r\n{\r\n internal class Program\r\n {\r\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\r\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\r\n\r\n private static void Main(string[] args)\r\n {\r\n writer.WriteLine(Solve() ? \"YES\" : \"NO\");\r\n writer.Flush();\r\n }\r\n\r\n private static bool Solve()\r\n {\r\n long a = Next();\r\n long b = Next();\r\n\r\n string s = Convert.ToString(a, 2);\r\n string t = Convert.ToString(b, 2);\r\n\r\n if (Subs(t, s))\r\n return true;\r\n\r\n if (Subs(t, new string(s.Reverse().ToArray())))\r\n return true;\r\n\r\n if (Subs(t, s + \"1\"))\r\n return true;\r\n\r\n if (Subs(t, new string((s + \"1\").Reverse().ToArray())))\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n private static bool Subs(string t, string s)\r\n {\r\n int p = 0;\r\n while (true)\r\n {\r\n int index = t.IndexOf(s, p);\r\n if (index >= 0)\r\n {\r\n bool ok = true;\r\n for (int i = 0; i < index; i++)\r\n {\r\n if (t[i] != '1')\r\n {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n\r\n if (ok)\r\n for (int i = index + s.Length; i < t.Length; i++)\r\n {\r\n if (t[i] != '1')\r\n {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n\r\n if (ok)\r\n return true;\r\n\r\n p = index + 1;\r\n }\r\n else break;\r\n }\r\n return false;\r\n }\r\n\r\n private static long Next()\r\n {\r\n int c;\r\n long res = 0;\r\n do\r\n {\r\n c = reader.Read();\r\n if (c == -1)\r\n return res;\r\n } while (c < '0' || c > '9');\r\n res = c - '0';\r\n while (true)\r\n {\r\n c = reader.Read();\r\n if (c < '0' || c > '9')\r\n return res;\r\n res *= 10;\r\n res += c - '0';\r\n }\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc1892bde07f9c8533fe8135b4a94cdb", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\r\nusing System.Threading;\r\nusing System.IO;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\npublic class Program\r\n{\r\n long X, Y;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n X = sc.NextLong();\r\n Y = sc.NextLong();\r\n\r\n if (X == Y)\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n bool[] by = ToArray(Y);\r\n\r\n while (true)\r\n {\r\n // tx, tx\u306e\u9006\u3092\u90e8\u5206\u5217\u3068\u3057\u3066\u542b\u3080\r\n // \u305d\u308c\u4ee5\u59161\r\n bool[] bx = ToArray(2 * X + 1);\r\n\r\n if (F(by, bx))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n Array.Reverse(bx);\r\n if (F(by, bx))\r\n {\r\n Console.WriteLine(\"YES\");\r\n return;\r\n }\r\n\r\n\r\n if (X % 2 != 0) break;\r\n X /= 2;\r\n }\r\n\r\n Console.WriteLine(\"NO\");\r\n }\r\n\r\n bool F(bool[] fy, bool[] fx)\r\n {\r\n if (fy.Length < fx.Length) return false;\r\n bool left = true;\r\n for (int i = 0; i + fx.Length <= fy.Length && left; i++)\r\n {\r\n bool flag = true;\r\n for (int j = 0; j < fx.Length && flag; j++)\r\n {\r\n flag &= fx[j] == fy[i + j];\r\n }\r\n if (flag)\r\n {\r\n for (int j = i + fx.Length; j < fy.Length && flag; j++)\r\n {\r\n flag &= fy[j];\r\n }\r\n if (flag) return true;\r\n }\r\n\r\n left &= fy[i];\r\n }\r\n return false;\r\n }\r\n\r\n bool[] ToArray(long n)\r\n {\r\n int lg = 0;\r\n long tmp = n;\r\n while (tmp > 0)\r\n {\r\n lg++;\r\n tmp /= 2;\r\n }\r\n\r\n tmp = n;\r\n bool[] ret = new bool[lg];\r\n for (int i = 0; i < lg; i++)\r\n {\r\n ret[i] = tmp % 2 == 1;\r\n tmp /= 2;\r\n }\r\n return ret;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a13c0f4003a6c66cd73ccc7461a6ab52", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0554a4f0a5501c9feea0005e72fd3026", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0ff22737ac7e8423637de65f27f0e3f3", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cac064576850ba4f739e447a84ff14b1", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7c13c2308e8098d34e1de6b72ca38585", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6bbd94fbe23f95fca2c3043d5f6b7880", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7546f35d453afb8e2026a9bb09988f09", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "77999ab25fbfbe36b4822e1fc7a8c7de", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d15ec6c3c04a8048084a77aed8444b49", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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\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\n long res = Search(a, p + 1, x, s, k);\n if (k == 0 || a[p] >= 20)\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 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\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n\n var ans = Search(a, 0, 0, s, k);\n cout += ans + endl;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4f30615c03d298487c1de1c3b4e25ca2", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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\n static long Search(int[] a, int p, long x, long s, int k)\n {\n if (x == s) return 1;\n if (p == a.Length) return 0;\n\n long res = Search(a, p + 1, x, s, k);\n if (k == 0 || a[p] >= 20)\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 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\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n\n var ans = Search(a, 0, 0, s, k);\n cout += ans + endl;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "18feef08ceba20e34883600c42cbce4e", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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[] hashs = 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 % 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8427f61d32e6a2c1c0621007dc3c1377", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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, long s)\n {\n if (p == a.Length)\n {\n if (!dm[k].ContainsKey(s))\n {\n dm[k][s] = 0;\n }\n dm[k][s]++;\n return;\n }\n\n var x = a[p];\n if(x < 19)\n {\n Build(a, p + 1, k - 1, s + fact[x]);\n }\n Build(a, p + 1, k, s + x);\n Build(a, p + 1, k, 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)\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 / 2;\n Build(a, p, k, 0);\n\n var ans = Search(a, 0, p, k, s);\n cout += ans + endl;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "58cb6b49663ba303996b0274b7d9a380", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f0e2e9093c83411481d9c4defe3e53b7", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6dcbd58b38386550ff0cde857d12c482", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9ebaa4eaaeaf0d2f978b5ddb54025f52", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "47c858728228a2df32d68c8f8c2b89b5", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e2573d1903e73f1756edb7daa1c17129", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "40379f37f8179891001b12d8478d2b4e", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cea201abfa2526797f0cf573223faef0", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4bb2c3d6eb015071fbd98843a8e5d422", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "87bfb07d6ac70fb1a3eca86a5e5ea5ad", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3f79d158e1997f2604b59a46c9af752d", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "14119e024423982b306eef9e4dc1a044", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dca90e489345c055d2ed8a0259960fd1", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcesBlockTowers\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m, a = 2;\n n = int.Parse(Console.ReadLine());\n m = int.Parse(Console.ReadLine());\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 Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0fb1595c6052cd24c18443545c50bfc6", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cc84dd0327b31b276f5742cbecfabe65", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7a583d9f99838bb3d1de32c6e3d07ba1", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e2cf3585aff37f581940a9255ea47a04", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "da3f16fc71f7074a3b5ece3262d0275f", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "37527699987be6c7a76c43652aee1c36", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b1499f7bb44d2c8f985063e7429d97eb", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c9b6c2b25b14e82dc0ef1affc4e10db9", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5f6592c93d98dfc9d235643c2d2bd9c0", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d66597250fbfa6802eab4ce2ce218624", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "685aaa35ab316725361848def526106b", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "MS C#", "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 v = sc.Long();\n var K = sc.Integer();\n double p = sc.Integer() / 100.0;\n var q = 1 - p;\n var dp = new double[256, 2, 300];\n if (v < 256) dp[(int)v, 0, 0] = 1.0;\n else\n {\n for (int i = 9; i < 32; i++)\n if ((v >> i) % 2 == (v >> 8) % 2) continue;\n else\n {\n dp[v % 256, (v >> 8) % 2, i - 8] = 1.0;\n break;\n }\n }\n\n /*var a = new long[10];\n for (int i = 0; i < 10; i++)\n a[i] = (v >> i) % 2;\n IO.Printer.Out.WriteLine(a.AsJoinedString());*/\n for (int _ = 0; _ < K; _++)\n {\n var next = new double[256, 2, 300];\n\n for (int i = 0; i < 256; i++)\n {\n for (int j = 0; j < 2; j++)\n {\n for (int k = 0; k < 250; k++)\n {\n if (dp[i, j, k] == 0) continue;\n\n if (((i * 2) >> 8) % 2 == j)\n next[(i * 2) % 256, j, k + 1] += dp[i, j, k] * p;\n else next[(i * 2) % 256, j ^ 1, 1] += dp[i, j, k] * p;\n\n if (i == 255)\n {\n if (j == 1)\n next[0, 0, k] += dp[i, j, k] * q;\n else next[0, 1,1 ] += dp[i, j, k] * q;\n }\n else\n next[i + 1, j, k] += dp[i, j, k] * q;\n }\n }\n }\n dp = next;\n }\n\n var E = 0.0;\n for (int i = 0; i < 256; i++)\n for (int j = 0; j < 2; j++)\n for (int k = 0; k < 250; k++)\n {\n if (dp[i, j, k] == 0) continue;\n if (i == 0)\n {\n var u = (j == 1) ? 8 : 8 + k;\n E += dp[i, j, k] * u;\n }\n else\n {\n for (int l = 0; l < 8; l++)\n if ((i >> l) % 2 == 1)\n {\n E += l * dp[i, j, k];\n break;\n }\n }\n\n }\n IO.Printer.Out.WriteLine(\"{0:F12}\", E);\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#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 Error = new Printer(System.IO.Stream.Null);\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d2ecb31d341f4a7e1a4cd2e3a4bececd", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "MS C#", "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 TrailingZeroes(int x)\n {\n int ret = 0;\n while (x % 2 == 0)\n {\n ret++;\n x >>= 1;\n }\n return ret;\n }\n\n public object Solve()\n {\n int x = ReadInt();\n int k = ReadInt();\n double p = ReadInt() / 100.0;\n double q = 1 - p;\n\n const int MASK = 1 << 8;\n const int MAX_ONES = 250;\n var dp = new double[MASK, MAX_ONES];\n\n int rep;\n if (x % MASK == 0)\n rep = TrailingZeroes(x) - 8;\n else\n {\n rep = 0;\n int xx = x >> 8;\n while (xx % 2 == 1)\n {\n rep++;\n xx >>= 1;\n }\n }\n dp[x % MASK, rep] = 1;\n\n for (int step = 0; step < k; step++)\n {\n var ndp = new double[MASK, MAX_ONES];\n for (int i = 0; i < MASK; i++)\n for (int j = 0; j < MAX_ONES; j++)\n if (dp[i,j] > 0)\n {\n if (i == 0)\n {\n ndp[0, j + 1] += dp[0, j] * p;\n ndp[1, 0] += dp[0, j] * q;\n }\n else\n {\n int ii = (i << 1) % MASK;\n int jj;\n if (ii == 0)\n jj = 0;\n else\n jj = (i >> 7 & 1) == 1 ? j + 1 : 0;\n ndp[ii, jj] += dp[i, j] * p;\n\n ii = i + 1;\n if (ii == MASK)\n ndp[0, j] += dp[i, j] * q;\n else\n ndp[ii, j] += dp[i, j] * q;\n }\n }\n dp = ndp;\n }\n\n double ans = 0;\n\n for (int i = 0; i < MASK; i++)\n for (int j = 0; j < MAX_ONES; j++)\n if (i == 0)\n ans += (8 + j) * dp[0, j];\n else\n ans += TrailingZeroes(i) * dp[i, j];\n\n return ans.ToString(CultureInfo.InvariantCulture);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cdc021c390b6d6bfe5e4f605c50d7f32", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "MS C#", "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 TrailingZeroes(int x)\n {\n int ret = 0;\n while (x % 2 == 0)\n {\n ret++;\n x >>= 1;\n }\n return ret;\n }\n\n public object Solve()\n {\n int x = ReadInt();\n int k = ReadInt();\n double p = ReadInt() / 100.0;\n double q = 1 - p;\n\n const int MASK = 1 << 8;\n const int MAX_ONES = 250;\n var dp = new double[MASK, MAX_ONES];\n\n int rep;\n if (x % MASK == 0)\n rep = TrailingZeroes(x) - 8;\n else\n {\n rep = 0;\n int xx = x >> 8;\n while (xx % 2 == 1)\n {\n rep++;\n xx >>= 1;\n }\n }\n dp[x % MASK, rep] = 1;\n\n for (int step = 0; step < k; step++)\n {\n var ndp = new double[MASK + 1, MAX_ONES];\n for (int i = 0; i < MASK; i++)\n for (int j = 0; j < MAX_ONES; j++)\n if (dp[i,j] > 0)\n {\n if (i == 0)\n {\n ndp[0, j + 1] += dp[0, j] * p;\n ndp[1, 0] += dp[0, j] * q;\n }\n else\n {\n int ii = (i << 1) % MASK;\n int jj;\n if (ii == 0)\n jj = 0;\n else\n jj = (i >> 7 & 1) == 1 ? j + 1 : 0;\n ndp[ii, jj] += dp[i, j] * p;\n\n ii = i + 1;\n if (ii == MASK)\n ndp[0, j + 1] += dp[i, j] * q;\n else\n ndp[ii, j] += dp[i, j] * q;\n }\n }\n dp = ndp;\n }\n\n double ans = 0;\n\n for (int i = 0; i < MASK; i++)\n for (int j = 0; j < MAX_ONES; j++)\n if (i == 0)\n ans += (8 + j) * dp[0, j];\n else\n ans += TrailingZeroes(i) * dp[i, j];\n\n return ans.ToString(CultureInfo.InvariantCulture);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e20fde1e40084f816f831be65a673a98", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "MS C#", "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 v = sc.Long();\n var K = sc.Integer();\n double p = sc.Integer() / 100.0;\n var q = 1 - p;\n var dp = new double[256, 2, 300];\n var b = v % 256;\n var c = (v >> 8) % 2;\n for (int i = 9; i < 64; i++)\n if ((v >> i) % 2 == 0)\n {\n dp[v % 256, (v >> 8) % 2, i - 9] = 1.0;\n break;\n }\n for (int _ = 0; _ < K; _++)\n {\n var next = new double[256, 2, 300];\n\n for (int i = 0; i < 256; i++)\n {\n for (int j = 0; j < 2; j++)\n {\n for (int k = 0; k < 250; k++)\n {\n if (dp[i, j, k] == 0) continue;\n if (j == 1)\n next[i * 2 % 256, ((i * 2) >> 8) % 2, k + 1] += dp[i, j, k] * p;\n else next[i * 2 % 256, ((i * 2) >> 8) % 2, 0] += dp[i, j, k] * p;\n if (i == 255)\n {\n if (j == 1)\n next[0, 0, k + 1] += dp[i, j, k] * q;\n else next[0, 1, 0] += dp[i, j, k] * q;\n }\n else\n next[i + 1, j, k] += dp[i, j, k] * q;\n }\n }\n }\n dp = next;\n }\n\n var E = 0.0;\n for (int i = 0; i < 256; i++)\n for (int j = 0; j < 2; j++)\n for (int k = 0; k < 250; k++)\n {\n if (i == 0)\n {\n E += dp[i, j, k] * (j + k);\n }\n else\n {\n for (int l = 0; l < 8; l++)\n if ((i >> l) % 2 == 1)\n {\n E += l * dp[i, j, k];\n break;\n }\n }\n\n }\n IO.Printer.Out.WriteLine(\"{0:F12}\", E);\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#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 Error = new Printer(System.IO.Stream.Null);\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c6814e815876998bc9955579c8391a95", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "MS C#", "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 v = sc.Long();\n var K = sc.Integer();\n double p = sc.Integer() / 100.0;\n var q = 1 - p;\n var dp = new double[256, 2, 300];\n var b = v % 256;\n var c = (v >> 8) % 2;\n var t = 0;\n for (int i = 9; i < 32; i++)\n if ((v >> i) % 2 == 1)\n {\n t = i - 8;\n break;\n }\n dp[v % 256, (v >> 8) % 2, t] = 1.0;\n /*var a = new long[10];\n for (int i = 0; i < 10; i++)\n a[i] = (v >> i) % 2;\n IO.Printer.Out.WriteLine(a.AsJoinedString());*/\n for (int _ = 0; _ < K; _++)\n {\n var next = new double[256, 2, 300];\n\n for (int i = 0; i < 256; i++)\n {\n for (int j = 0; j < 2; j++)\n {\n for (int k = 0; k < 250; k++)\n {\n if (dp[i, j, k] == 0) continue;\n if (j == 1)\n {\n if (((i * 2) >> 8) % 2 == 1)\n next[(i * 2) % 256, 1, 0] += dp[i, j, k] * p;\n else next[(i * 2) % 256, 0, k + 1] += dp[i, j, k] * p;\n }\n else\n {\n if (((i * 2) >> 8) % 2 == 1)\n next[(i * 2) % 256, 1, 0] += dp[i, j, k] * p;\n else next[(i * 2) % 256, 0, k + 1] += dp[i, j, k] * p;\n }\n\n\n if (i == 255)\n {\n if (j == 1)\n next[0, 0, 1] += dp[i, j, k] * q;\n else next[0, 1, 0] += dp[i, j, k] * q;\n }\n else\n next[i + 1, j, k] += dp[i, j, k] * q;\n }\n }\n }\n dp = next;\n }\n\n var E = 0.0;\n for (int i = 0; i < 256; i++)\n for (int j = 0; j < 2; j++)\n for (int k = 0; k < 250; k++)\n {\n if (dp[i, j, k] == 0) continue;\n if (i == 0)\n {\n var u = (j == 1) ? 8 : 8 + k;\n E += dp[i, j, k] * u;\n }\n else\n {\n for (int l = 0; l < 8; l++)\n if ((i >> l) % 2 == 1)\n {\n E += l * dp[i, j, k];\n break;\n }\n }\n\n }\n IO.Printer.Out.WriteLine(\"{0:F12}\", E);\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#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 Error = new Printer(System.IO.Stream.Null);\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2cae59c840e6f84fff1b2037a648ec01", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "MS C#", "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 TrailingZeroes(int x)\n {\n int ret = 0;\n while (x % 2 == 0)\n {\n ret++;\n x >>= 1;\n }\n return ret;\n }\n\n public object Solve()\n {\n int x = ReadInt();\n int k = ReadInt();\n double p = ReadInt() / 100.0;\n double q = 1 - p;\n\n const int MASK = 1 << 8;\n const int MAX_ONES = 250;\n var dp = new double[MASK, MAX_ONES];\n\n int rep;\n if (x % MASK == 0)\n rep = TrailingZeroes(x) - 8;\n else\n {\n rep = 0;\n int xx = x >> 8;\n while (xx % 2 == 1)\n {\n rep++;\n xx >>= 1;\n }\n }\n dp[x % MASK, rep] = 1;\n\n for (int step = 0; step < k; step++)\n {\n var ndp = new double[MASK + 1, MAX_ONES];\n for (int i = 0; i < MASK; i++)\n for (int j = 0; j < MAX_ONES; j++)\n if (dp[i,j] > 0)\n {\n if (i == 0)\n {\n ndp[MASK, j + 1] += dp[0, j] * p;\n ndp[1, 0] += dp[0, j] * q;\n }\n else\n {\n int ii = (i << 1) % MASK;\n int jj;\n if (ii == 0)\n jj = 0;\n else\n jj = (i >> 7 & 1) == 1 ? j + 1 : 0;\n ndp[ii, jj] += dp[i, j] * p;\n\n ii = i + 1;\n if (ii == MASK)\n ndp[0, j + 1] += dp[i, j] * q;\n else\n ndp[ii, j] += dp[i, j] * q;\n }\n }\n dp = ndp;\n }\n\n double ans = 0;\n\n for (int i = 0; i < MASK; i++)\n for (int j = 0; j < MAX_ONES; j++)\n if (i == 0)\n ans += (8 + j) * dp[0, j];\n else\n ans += TrailingZeroes(i) * dp[i, j];\n\n return ans.ToString(CultureInfo.InvariantCulture);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6fdf8548388f31c8b33e51cae7cb5620", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "MS C#", "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 v = sc.Integer();\n var k = sc.Integer();\n double p = sc.Integer() / 100.0;\n var q = 1 - p;\n var dp = new double[256, 255];\n for (int i = 0; i < 32; i++)\n if ((v >> i) % 2 == 1)\n {\n dp[v % 256, i] = 1.0;\n break;\n }\n for (int _ = 0; _ < k; _++)\n {\n var next = new double[256, 255];\n for (int i = 0; i < 256; i++)\n for (int j = 0; j < 250; j++)\n {\n if (dp[i, j] == 0.0) continue;\n next[(i * 2) % 256, j + 1] += dp[i, j] * p;\n\n if (i == 255)\n next[0, 8] += dp[i, j] * q;\n else\n {\n var nf = (i + 1) % 256;\n for (int l = 0; l < 8; l++)\n if ((nf >> l) % 2 == 1)\n {\n next[nf, l] += dp[i, j] * q;\n break;\n }\n }\n }\n dp = next;\n }\n var sum = 0.0;\n for (int i = 0; i < 256; i++)\n for (int j = 0; j < 250; j++)\n sum += j * dp[i, j];\n IO.Printer.Out.WriteLine(sum);\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#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 Error = new Printer(System.IO.Stream.Null);\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7e9dd71395988712b4f1eda5b976bd8a", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "MS C#", "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 TrailingZeroes(int x)\n {\n int ret = 0;\n while (x % 2 == 0)\n {\n ret++;\n x >>= 1;\n }\n return ret;\n }\n\n public object Solve()\n {\n int x = ReadInt();\n int k = ReadInt();\n double p = ReadInt() / 100.0;\n double q = 1 - p;\n\n const int MASK = 1 << 8;\n const int MAX_ONES = 20;\n var dp = new double[MASK, MAX_ONES];\n\n int rep;\n if (x % MASK == 0)\n rep = TrailingZeroes(x) - 8;\n else\n {\n rep = 0;\n int xx = x >> 8;\n while (xx % 2 == 1)\n {\n rep++;\n xx >>= 1;\n }\n }\n dp[x % MASK, rep] = 1;\n\n for (int step = 0; step < k; step++)\n {\n var ndp = new double[MASK + 1, MAX_ONES];\n for (int i = 0; i < MASK; i++)\n for (int j = 0; j < MAX_ONES; j++)\n if (dp[i,j] > 0)\n {\n if (i == 0)\n {\n ndp[0, j + 1] += dp[0, j] * p;\n ndp[1, 0] += dp[0, j] * q;\n }\n else\n {\n int ii = (i << 1) % MASK;\n int jj;\n if (ii == 0)\n jj = 0;\n else\n jj = (i >> 7 & 1) == 1 ? j + 1 : 0;\n ndp[ii, jj] += dp[i, j] * p;\n\n ii = i + 1;\n if (ii == MASK)\n ndp[0, j] += dp[i, j] * q;\n else\n ndp[ii, j] += dp[i, j] * q;\n }\n }\n dp = ndp;\n }\n\n double ans = 0;\n\n for (int i = 0; i < MASK; i++)\n for (int j = 0; j < MAX_ONES; j++)\n if (i == 0)\n ans += (8 + j) * dp[0, j];\n else\n ans += TrailingZeroes(i) * dp[i, j];\n\n return ans.ToString(CultureInfo.InvariantCulture);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b9d114d3b20ef9faa960f417d50d9ade", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "MS C#", "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 v = sc.Long();\n var K = sc.Integer();\n double p = sc.Integer() / 100.0;\n var q = 1 - p;\n var dp = new double[256, 2, 300];\n var b = v % 256;\n var c = (v >> 8) % 2;\n for (int i = 9; i < 64; i++)\n if ((v >> i) % 2 == 0)\n {\n dp[v % 256, (v >> i), i - 9] = 1.0;\n break;\n }\n for (int _ = 0; _ < K; _++)\n {\n var next = new double[256, 2, 300];\n\n for (int i = 0; i < 256; i++)\n {\n for (int j = 0; j < 2; j++)\n {\n for (int k = 0; k < 250; k++)\n {\n if (dp[i, j, k] == 0) continue;\n if (j == 1)\n next[i * 2 % 256, ((i * 2) >> 8) % 2, k + 1] += dp[i, j, k] * p;\n else next[i * 2 % 256, ((i * 2) >> 8) % 2, 0] += dp[i, j, k] * p;\n if (i == 255)\n {\n if (j == 1)\n next[0, 0, k + 1] += dp[i, j, k] * q;\n else next[0, 1, 0] += dp[i, j, k] * q;\n }\n else\n next[i + 1, j, k] += dp[i, j, k] * q;\n }\n }\n }\n dp = next;\n }\n \n var E = 0.0;\n for (int i = 0; i < 256; i++)\n for (int j = 0; j < 2; j++)\n for (int k = 0; k < 250; k++)\n {\n if (i == 0)\n {\n E += dp[i, j, k] * (j + k);\n }\n else\n {\n for (int l = 0; l < 8; l++)\n if ((i >> l) % 2 == 1)\n {\n E += l * dp[i, j, k];\n break;\n }\n }\n\n }\n IO.Printer.Out.WriteLine(\"{0:F12}\", E);\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#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 Error = new Printer(System.IO.Stream.Null);\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3bc63033ff545491b3e6d413e243823d", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "MS C#", "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 v = sc.Integer();\n var K = sc.Integer();\n double p = sc.Integer() / 100.0;\n var q = 1 - p;\n var dp = new double[256, 32, 255];\n var max = v & -v;\n var to = 255;\n for (int i = 0; i <= 200; i++)\n {\n if (max < ((v + i) & -(v + i)))\n {\n max = (v + i) & -(v + i);\n to = i;\n //break;\n }\n }\n var now = v & -v;\n for (int i = 0; i < 32; i++)\n {\n if ((max >> i) % 2 == 1) max = i;\n if ((now >> i) % 2 == 1) now = i;\n }\n dp[to, max, now] = 1.0;\n for (int _ = 0; _ < K; _++)\n {\n var next = new double[256, 32, 255];\n for (int i = 0; i < 256; i++)\n for (int j = 0; j < 32; j++)\n for (int k = 0; k < 250; k++)\n {\n if (dp[i, j, k] == 0) continue;\n if (i * 2 < 256)\n next[i * 2, j + 1, k + 1] += dp[i, j, k] * p;\n else next[0, 0, k + 1] += dp[i, j, k] * p;\n\n if (i == 0)\n next[1, 0, 0] += dp[i, j, k] * q;\n else if (i == 1)\n next[Math.Min(1 << (j + 1), 255), Math.Min(j + 1, 31), Math.Max(j + 1, k + 1)] += dp[i, j, k] * q;\n else\n {\n var num = i - 1;\n for (int l = 0; l < 32; l++)\n if ((num >> l) % 2 == 1)\n {\n next[num, j, l] += dp[i, j, k] * q;\n break;\n }\n\n\n\n }\n }\n dp = next;\n }\n var E = 0.0;\n for (int i = 0; i < 256; i++)\n for (int j = 0; j < 32; j++)\n for (int k = 0; k < 255; k++)\n E += k * dp[i, j, k];\n IO.Printer.Out.WriteLine(\"{0:F12}\",E);\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#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 Error = new Printer(System.IO.Stream.Null);\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "614ed3233a193646bca70102ecb5fc65", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.CompilerServices;\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 var a = ReadIntArray();\r\n\r\n int s = a.Sum();\r\n if (s % 2 > 0)\r\n {\r\n Write(0);\r\n return;\r\n }\r\n\r\n s /= 2;\r\n var dp = new bool[n + 1, s + 1];\r\n for (int i = 0; i <= n; i++)\r\n dp[i, 0] = true;\r\n for (int i = 1; i <= n; i++)\r\n for (int j = 0; j <= s; j++)\r\n {\r\n dp[i, j] = dp[i - 1, j];\r\n if (j >= a[i - 1])\r\n dp[i, j] |= dp[i - 1, j - a[i - 1]];\r\n }\r\n\r\n if (!dp[n, s])\r\n Write(0);\r\n else\r\n {\r\n Write(1);\r\n if (a.All(_ => _ % 2 == 0))\r\n Write(0);\r\n else\r\n {\r\n for (int i = 0; ; i++)\r\n if (a[i] % 2 > 0)\r\n {\r\n Write(i);\r\n break;\r\n } \r\n }\r\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} ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6c9d55dfd13ae05e2420579d68756f49", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Linq;\r\n\r\nclass C\r\n{\r\n\tstatic int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n\tstatic (int, int) Read2() { var a = Read(); return (a[0], a[1]); }\r\n\tstatic long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);\r\n\tstatic void Main() => Console.WriteLine(Solve());\r\n\tstatic object Solve()\r\n\t{\r\n\t\tvar n = int.Parse(Console.ReadLine());\r\n\t\tvar a = Read();\r\n\r\n\t\tvar sum = a.Sum();\r\n\t\tif (sum % 2 != 0) return 0;\r\n\r\n\t\tvar u = Comb(n, a, sum);\r\n\t\tif (!u[sum / 2]) return 0;\r\n\r\n\t\tvar odds = Enumerable.Range(0, n).Where(i => a[i] % 2 == 1).ToArray();\r\n\t\tif (odds.Any()) return $\"1\\n{odds[0] + 1}\";\r\n\r\n\t\tvar argmin = Enumerable.Range(0, n).OrderBy(i => a[i]).First();\r\n\t\treturn $\"1\\n{argmin + 1}\";\r\n\t}\r\n\r\n\tstatic bool[] Comb(int n, int[] a, int max)\r\n\t{\r\n\t\tvar u = new bool[max + 1];\r\n\t\tu[0] = true;\r\n\r\n\t\tfor (int i = 0; i < n; i++)\r\n\t\t{\r\n\t\t\tfor (int j = max; j >= 0; j--)\r\n\t\t\t{\r\n\t\t\t\tif (u[j])\r\n\t\t\t\t{\r\n\t\t\t\t\tu[j + a[i]] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn u;\r\n\t}\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4279b08d88c8846af84497a02775e9d9", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.CompilerServices;\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 bool Fun(int[] a, int n)\r\n {\r\n int s = a.Sum();\r\n if (s % 2 > 0)\r\n return false;\r\n\r\n s /= 2;\r\n var dp = new bool[n + 1, s + 1];\r\n for (int i = 0; i <= n; i++)\r\n dp[i, 0] = true;\r\n for (int i = 1; i <= n; i++)\r\n for (int j = 1; j <= s; j++)\r\n {\r\n dp[i, j] = dp[i - 1, j];\r\n if (j >= a[i - 1])\r\n dp[i, j] |= dp[i - 1, j - a[i - 1]];\r\n }\r\n\r\n return dp[n, s];\r\n }\r\n\r\n public void Solve()\r\n {\r\n int n = ReadInt();\r\n var a = ReadIntArray();\r\n\r\n if (!Fun(a, n))\r\n Write(0);\r\n else\r\n {\r\n Write(1);\r\n if (a.All(_ => _ % 2 == 0))\r\n Write(1);\r\n else\r\n {\r\n for (int i = 0; ; i++)\r\n if (a[i] % 2 > 0)\r\n {\r\n Write(i + 1);\r\n break;\r\n }\r\n }\r\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} ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "645baff1e193e266339ccb85b29acf29", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.CompilerServices;\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 var a = ReadIntArray();\r\n\r\n int s = a.Sum();\r\n if (s % 2 > 0)\r\n {\r\n Write(0);\r\n return;\r\n }\r\n\r\n s /= 2;\r\n var dp = new bool[n + 1, s + 1];\r\n for (int i = 0; i <= n; i++)\r\n dp[i, 0] = true;\r\n for (int i = 1; i <= n; i++)\r\n for (int j = 0; j <= s; j++)\r\n {\r\n dp[i, j] = dp[i - 1, j];\r\n if (j >= a[i - 1])\r\n dp[i, j] |= dp[i - 1, j - a[i - 1]];\r\n }\r\n\r\n if (!dp[n, s])\r\n Write(0);\r\n else\r\n {\r\n Write(1);\r\n if (a.All(_ => _ % 2 == 0))\r\n Write(a[0]);\r\n else\r\n Write(a.First(_ => _ % 2 > 0));\r\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} ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d34d94c6bc7932cc3f8f0fa5b1017c0", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.CompilerServices;\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 var a = ReadIntArray();\r\n\r\n int s = a.Sum();\r\n if (s % 2 > 0)\r\n {\r\n Write(0);\r\n return;\r\n }\r\n\r\n s /= 2;\r\n var dp = new bool[n + 1, s + 1];\r\n for (int i = 0; i <= n; i++)\r\n dp[i, 0] = true;\r\n for (int i = 1; i <= n; i++)\r\n for (int j = 0; j <= s; j++)\r\n {\r\n dp[i, j] = dp[i - 1, j];\r\n if (j >= a[i - 1])\r\n dp[i, j] |= dp[i - 1, j - a[i - 1]];\r\n }\r\n\r\n if (!dp[n, s])\r\n Write(0);\r\n else\r\n {\r\n Write(1);\r\n if (a.All(_ => _ % 2 == 0))\r\n Write(1);\r\n else\r\n {\r\n for (int i = 0; ; i++)\r\n if (a[i] % 2 > 0)\r\n {\r\n Write(i + 1);\r\n break;\r\n } \r\n }\r\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} ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b14bba558bd33a915027723506d50c43", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "namespace Csharp_Contest\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Diagnostics;\r\n using System.Globalization;\r\n using System.IO;\r\n using System.Linq;\r\n using System.Text;\r\n using System.Threading;\r\n\r\n /*\r\n * #import_BitMap.cs\r\n */\r\n\r\n static class Program\r\n {\r\n private const int StackSize = 64 * (1 << 20);\r\n private const int Sz = (int)2e5 + 10;\r\n private const int Mod = (int)1e9 + 7;\r\n private static int n;\r\n private static BitMap dp;\r\n private static BitMap vp;\r\n private static List ar;\r\n\r\n private static void Solve()\r\n {\r\n int n = NextInt();\r\n dp = new BitMap(n, n + 1, Sz);\r\n vp = new BitMap(n, n + 1, Sz);\r\n ar = Repeat(0, n).Select(_ => NextInt()).ToList();\r\n int sum = ar.Aggregate((s, n) => s + n);\r\n if (sum % 2 == 1 || !Possible(n - 1, n, 0, 0))\r\n {\r\n OutputPrinter.WriteLine(0);\r\n }\r\n else\r\n {\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (!Possible(n - 1, i, 0, 0))\r\n {\r\n OutputPrinter.WriteLine(1);\r\n OutputPrinter.WriteLine(i + 1);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static bool Possible(int x, int skip, int sumLeft, int sumRight)\r\n {\r\n if (x < 0)\r\n {\r\n return sumLeft == sumRight;\r\n }\r\n\r\n if (vp[x, skip, sumLeft])\r\n {\r\n return dp[x, skip, sumLeft];\r\n }\r\n\r\n vp[x, skip, sumLeft] = true;\r\n\r\n if (x == skip)\r\n {\r\n return dp[x, skip, sumLeft] = Possible(x - 1, skip, sumLeft, sumRight);\r\n }\r\n\r\n dp[x, skip, sumLeft] = dp[x, skip, sumLeft] || Possible(x - 1, skip, sumLeft + ar[x], sumRight);\r\n dp[x, skip, sumLeft] = dp[x, skip, sumLeft] || Possible(x - 1, skip, sumLeft, sumRight + ar[x]);\r\n\r\n return dp[x, skip, sumLeft];\r\n }\r\n\r\n public static void Main(string[] args)\r\n {\r\n#if CLown1331\r\n for (int testCase = 0; testCase < 4; testCase++)\r\n {\r\n Solve();\r\n }\r\n\r\n Utils.CreateFileForSubmission();\r\n if (Debugger.IsAttached) Thread.Sleep(Timeout.Infinite);\r\n#else\r\n Thread t = new Thread(Solve, StackSize);\r\n t.Start();\r\n t.Join();\r\n#endif\r\n OutputPrinter.Flush();\r\n ErrorPrinter.Flush();\r\n }\r\n\r\n private static int NextInt() => int.Parse(Reader.NextString());\r\n\r\n private static long NextLong() => long.Parse(Reader.NextString());\r\n\r\n private static double NextDouble() => double.Parse(Reader.NextString());\r\n\r\n private static string NextString() => Reader.NextString();\r\n\r\n private static string NextLine() => Reader.ReadLine();\r\n\r\n private static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => XorShift);\r\n\r\n private static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n\r\n private static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n\r\n private static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n\r\n private static uint XorShift\r\n {\r\n get\r\n {\r\n Xsc().MoveNext();\r\n return Xsc().Current;\r\n }\r\n }\r\n\r\n private static IEnumerator Xsc()\r\n {\r\n uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff);\r\n while (true)\r\n {\r\n uint t = x ^ (x << 11);\r\n x = y;\r\n y = z;\r\n z = w;\r\n w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));\r\n yield return w;\r\n }\r\n }\r\n\r\n private static class Reader\r\n {\r\n private static readonly Queue Param = new Queue();\r\n#if CLown1331\r\n private static readonly StreamReader InputReader = new StreamReader(\"input.txt\");\r\n#else\r\n private static readonly StreamReader InputReader = new StreamReader(Console.OpenStandardInput());\r\n#endif\r\n\r\n public static string NextString()\r\n {\r\n if (Param.Count == 0)\r\n {\r\n foreach (string item in ReadLine().Split(' '))\r\n {\r\n if (string.IsNullOrWhiteSpace(item))\r\n {\r\n continue;\r\n }\r\n\r\n Param.Enqueue(item);\r\n }\r\n }\r\n\r\n return Param.Dequeue();\r\n }\r\n\r\n public static string ReadLine()\r\n {\r\n return InputReader.ReadLine();\r\n }\r\n }\r\n\r\n private static readonly Printer OutputPrinter = new Printer(Console.OpenStandardOutput());\r\n\r\n private static readonly Printer ErrorPrinter = new Printer(Console.OpenStandardError());\r\n\r\n private sealed class Printer : StreamWriter\r\n {\r\n public Printer(Stream stream)\r\n : base(stream, new UTF8Encoding(false, true))\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public Printer(Stream stream, Encoding encoding)\r\n : base(stream, encoding)\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\r\n }\r\n }\r\n}\r\nnamespace Csharp_Contest\r\n{\r\n using System;\r\n using System.Collections;\r\n using System.Linq;\r\n\r\n public class BitMap\r\n {\r\n private readonly BitArray bitArray;\r\n private readonly int[] dimensions;\r\n\r\n public BitMap(params int[] dimensions)\r\n {\r\n this.dimensions = dimensions;\r\n this.bitArray = new BitArray(this.dimensions.Aggregate((s, n) => s * n));\r\n }\r\n\r\n public void SetValue(bool value, params int[] indexes)\r\n {\r\n this.ValidateIndexes(indexes);\r\n this.bitArray[this.GetIndex(indexes)] = value;\r\n }\r\n\r\n public bool GetValue(int[] indexes)\r\n {\r\n this.ValidateIndexes(indexes);\r\n return this.bitArray[this.GetIndex(indexes)];\r\n }\r\n\r\n public bool this[params int[] indexes]\r\n {\r\n get => this.GetValue(indexes);\r\n set => this.SetValue(value, indexes);\r\n }\r\n\r\n private void ValidateIndexes(int[] indexes)\r\n {\r\n if (indexes.Length != this.dimensions.Length)\r\n {\r\n throw new Exception(\"Number of indexes != _dimensions\");\r\n }\r\n\r\n for (int i = 0; i < indexes.Length; i++)\r\n {\r\n if (indexes[i] < 0 || indexes[i] >= this.dimensions[i])\r\n {\r\n throw new IndexOutOfRangeException();\r\n }\r\n }\r\n }\r\n\r\n private int GetIndex(int[] indexes)\r\n {\r\n int ret = 0;\r\n int power = 1;\r\n for (int i = 1; i <= indexes.Length; i++)\r\n {\r\n ret += power * indexes[^i];\r\n power *= this.dimensions[^i];\r\n }\r\n\r\n return ret;\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec5e05082dd81dbd483b866c55885ddb", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing static System.Linq.Enumerable;\r\nusing static System.Math;\r\n\r\nnamespace CompetitiveProgramming\r\n{\r\n\tclass Program\r\n\t{\r\n\t\tpublic static void Main()\r\n\t\t{\r\n\t\t\tvar n = int.Parse(Console.ReadLine());\r\n\t\t\tvar a = GetInts(n);\r\n\r\n\t\t\tvar total = a.Sum();\r\n\t\t\tif (total % 2 == 1)\r\n\t\t\t{\r\n\t\t\t\tConsole.WriteLine(0);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar achievable = new bool[total + 1];\r\n\t\t\tachievable[0] = true;\r\n\t\t\tforeach (var val in a)\r\n\t\t\t{\r\n\t\t\t\tvar newAchievable = new bool[total + 1];\r\n\r\n\t\t\t\tfor (int i = 0; i < achievable.Length; i++)\r\n\t\t\t\t\tif (achievable[i])\r\n\t\t\t\t\t\tnewAchievable[i] = newAchievable[i + val] = true;\r\n\r\n\t\t\t\tachievable = newAchievable;\r\n\t\t\t}\r\n\r\n\t\t\tvar canDoHalf = achievable[total / 2];\r\n\t\t\tif (!canDoHalf)\r\n\t\t\t{\r\n\t\t\t\tConsole.WriteLine(0);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar maxParity = Range(0, 30).Where(x => a.All(elem => elem % (1 << x) == 0)).Max();\r\n\t\t\tvar nextParity = 1 << (maxParity + 1);\r\n\r\n\t\t\tvar first = a.First(x => x % nextParity != 0);\r\n\t\t\tConsole.WriteLine(1);\r\n\t\t\tConsole.WriteLine(a.ToList().IndexOf(first) + 1);\r\n\t\t}\r\n\r\n\t\tpublic static (int, int)[] GetPairs(int count)\r\n\t\t{\r\n\t\t\tvar qs = new (int, int)[count];\r\n\t\t\tfor (int i = 0; i < count; i++)\r\n\t\t\t{\r\n\t\t\t\tvar line = Console.ReadLine();\r\n\t\t\t\tint spacePos = 1;\r\n\t\t\t\twhile (line[spacePos] != ' ')\r\n\t\t\t\t\tspacePos++;\r\n\r\n\t\t\t\tvar l = int.Parse(line.AsSpan(0, spacePos));\r\n\t\t\t\tvar r = int.Parse(line.AsSpan(spacePos + 1, line.Length - spacePos - 1));\r\n\t\t\t\tqs[i] = (l - 1, r - 1);\r\n\t\t\t}\r\n\r\n\t\t\treturn qs;\r\n\t\t}\r\n\r\n\t\tpublic static int[] GetInts(int count)\r\n\t\t{\r\n\t\t\tvar str = Console.ReadLine();\r\n\t\t\tvar a = new int[count];\r\n\r\n\t\t\tvar currentStart = 0;\r\n\t\t\tfor (int i = 0; i < count - 1; i++)\r\n\t\t\t{\r\n\t\t\t\tint currentEnd = currentStart + 1;\r\n\t\t\t\twhile (str[currentEnd] != ' ')\r\n\t\t\t\t\tcurrentEnd++;\r\n\r\n\t\t\t\ta[i] = int.Parse(str.AsSpan(currentStart, currentEnd - currentStart));\r\n\t\t\t\tcurrentStart = currentEnd + 1;\r\n\t\t\t}\r\n\r\n\t\t\ta[^1] = int.Parse(str.AsSpan(currentStart, str.Length - currentStart));\r\n\t\t\treturn a;\r\n\t\t}\r\n\t}\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2accd0dbf7d3d8ac010b4fa57ad57322", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "namespace Csharp_Contest\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Diagnostics;\r\n using System.Globalization;\r\n using System.IO;\r\n using System.Linq;\r\n using System.Text;\r\n using System.Threading;\r\n\r\n /*\r\n *\r\n */\r\n\r\n static class Program\r\n {\r\n private const int StackSize = 64 * (1 << 20);\r\n private const int Sz = (int)2e5 + 10;\r\n private const int Mod = (int)1e9 + 7;\r\n private static readonly int[,] dp = new int[101, Sz];\r\n private static readonly int[,] cp = new int[101, Sz];\r\n private static List ar;\r\n\r\n private static void Solve()\r\n {\r\n int n = NextInt();\r\n ar = Repeat(0, n).Select(_ => NextInt()).ToList();\r\n int sum = ar.Aggregate((s, n) => s + n);\r\n for (int i = 0; i <= n; i++)\r\n {\r\n for (int j = 0; j < Sz; j++)\r\n {\r\n dp[i, j] = -1;\r\n cp[i, j] = -1;\r\n }\r\n }\r\n\r\n if (sum % 2 == 1 || Possible(n - 1, sum / 2) == 0)\r\n {\r\n OutputPrinter.WriteLine(0);\r\n }\r\n else if (ar.Any(x => x % 2 != 0))\r\n {\r\n OutputPrinter.WriteLine(1);\r\n OutputPrinter.WriteLine(ar.FindIndex(x => x % 2 != 0) + 1);\r\n }\r\n else\r\n {\r\n int minNow = 105;\r\n int chosen = -1;\r\n for (int i = sum; i >= 0; i -= 2)\r\n {\r\n if (Possible(n - 1, i) == 1 && Possible(n - 1, i / 2) == 0)\r\n {\r\n int step = CountStep(n - 1, sum - i);\r\n if (minNow > step)\r\n {\r\n minNow = step;\r\n chosen = sum - i;\r\n }\r\n }\r\n }\r\n\r\n if (chosen == -1)\r\n {\r\n throw new Exception(\"Not supposed to reach!\");\r\n }\r\n\r\n OutputPrinter.WriteLine(minNow);\r\n PrintChosenSet(n - 1, chosen);\r\n }\r\n }\r\n\r\n private static void PrintChosenSet(int n, int sum)\r\n {\r\n if (sum < 0)\r\n {\r\n throw new Exception(\"Not supposed to reach!\");\r\n }\r\n\r\n if (n < 0)\r\n {\r\n OutputPrinter.WriteLine();\r\n return;\r\n }\r\n\r\n if (Possible(n - 1, sum - ar[n]) == 1)\r\n {\r\n OutputPrinter.Write($\"{n + 1} \");\r\n PrintChosenSet(n - 1, sum - ar[n]);\r\n return;\r\n }\r\n\r\n if (Possible(n - 1, sum) == 1)\r\n {\r\n PrintChosenSet(n - 1, sum);\r\n return;\r\n }\r\n\r\n throw new Exception(\"Not supposed to reach!\");\r\n }\r\n\r\n private static int CountStep(int n, int sum)\r\n {\r\n if (sum < 0)\r\n {\r\n return 105;\r\n }\r\n\r\n if (n < 0)\r\n {\r\n return sum == 0 ? 0 : 105;\r\n }\r\n\r\n if (dp[n, sum] != -1)\r\n {\r\n return dp[n, sum];\r\n }\r\n\r\n dp[n, sum] = 105;\r\n dp[n, sum] = Math.Min(dp[n, sum], Possible(n - 1, sum - ar[n]) + 1);\r\n dp[n, sum] = Math.Min(dp[n, sum], Possible(n - 1, sum));\r\n\r\n return dp[n, sum];\r\n }\r\n\r\n private static int Possible(int n, int sum)\r\n {\r\n if (sum < 0)\r\n {\r\n return 0;\r\n }\r\n\r\n if (n < 0)\r\n {\r\n return sum == 0 ? 1 : 0;\r\n }\r\n\r\n if (dp[n, sum] != -1)\r\n {\r\n return dp[n, sum];\r\n }\r\n\r\n dp[n, sum] = 0;\r\n dp[n, sum] |= Possible(n - 1, sum - ar[n]);\r\n dp[n, sum] |= Possible(n - 1, sum);\r\n\r\n return dp[n, sum];\r\n }\r\n\r\n public static void Main(string[] args)\r\n {\r\n#if CLown1331\r\n for (int testCase = 0; testCase < 5; testCase++)\r\n {\r\n Solve();\r\n OutputPrinter.WriteLine($\"-------\");\r\n }\r\n\r\n Utils.CreateFileForSubmission();\r\n if (Debugger.IsAttached) Thread.Sleep(Timeout.Infinite);\r\n#else\r\n Thread t = new Thread(Solve, StackSize);\r\n t.Start();\r\n t.Join();\r\n#endif\r\n OutputPrinter.Flush();\r\n ErrorPrinter.Flush();\r\n }\r\n\r\n private static int NextInt() => int.Parse(Reader.NextString());\r\n\r\n private static long NextLong() => long.Parse(Reader.NextString());\r\n\r\n private static double NextDouble() => double.Parse(Reader.NextString());\r\n\r\n private static string NextString() => Reader.NextString();\r\n\r\n private static string NextLine() => Reader.ReadLine();\r\n\r\n private static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => XorShift);\r\n\r\n private static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n\r\n private static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n\r\n private static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n\r\n private static uint XorShift\r\n {\r\n get\r\n {\r\n Xsc().MoveNext();\r\n return Xsc().Current;\r\n }\r\n }\r\n\r\n private static IEnumerator Xsc()\r\n {\r\n uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff);\r\n while (true)\r\n {\r\n uint t = x ^ (x << 11);\r\n x = y;\r\n y = z;\r\n z = w;\r\n w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));\r\n yield return w;\r\n }\r\n }\r\n\r\n private static class Reader\r\n {\r\n private static readonly Queue Param = new Queue();\r\n#if CLown1331\r\n private static readonly StreamReader InputReader = new StreamReader(\"input.txt\");\r\n#else\r\n private static readonly StreamReader InputReader = new StreamReader(Console.OpenStandardInput());\r\n#endif\r\n\r\n public static string NextString()\r\n {\r\n if (Param.Count == 0)\r\n {\r\n foreach (string item in ReadLine().Split(' '))\r\n {\r\n if (string.IsNullOrWhiteSpace(item))\r\n {\r\n continue;\r\n }\r\n\r\n Param.Enqueue(item);\r\n }\r\n }\r\n\r\n return Param.Dequeue();\r\n }\r\n\r\n public static string ReadLine()\r\n {\r\n return InputReader.ReadLine();\r\n }\r\n }\r\n\r\n private static readonly Printer OutputPrinter = new Printer(Console.OpenStandardOutput());\r\n\r\n private static readonly Printer ErrorPrinter = new Printer(Console.OpenStandardError());\r\n\r\n private sealed class Printer : StreamWriter\r\n {\r\n public Printer(Stream stream)\r\n : base(stream, new UTF8Encoding(false, true))\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public Printer(Stream stream, Encoding encoding)\r\n : base(stream, encoding)\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f38bf7cfc8099c29f536bdab828807eb", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Linq;\r\n\r\nclass C\r\n{\r\n\tstatic int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n\tstatic (int, int) Read2() { var a = Read(); return (a[0], a[1]); }\r\n\tstatic long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);\r\n\tstatic void Main() => Console.WriteLine(Solve());\r\n\tstatic object Solve()\r\n\t{\r\n\t\tvar n = int.Parse(Console.ReadLine());\r\n\t\tvar a = Read();\r\n\r\n\t\tvar sum = a.Sum();\r\n\t\tif (sum % 2 != 0) return 0;\r\n\r\n\t\tvar u = Comb(n, a, sum);\r\n\t\tif (!u[sum / 2]) return 0;\r\n\r\n\t\twhile (true)\r\n\t\t{\r\n\t\t\tvar odds = Enumerable.Range(0, n).Where(i => a[i] % 2 == 1).ToArray();\r\n\t\t\tif (odds.Any()) return $\"1\\n{odds[0] + 1}\";\r\n\r\n\t\t\ta = a.Select(x => x / 2).ToArray();\r\n\t\t}\r\n\t}\r\n\r\n\tstatic bool[] Comb(int n, int[] a, int max)\r\n\t{\r\n\t\tvar u = new bool[max + 1];\r\n\t\tu[0] = true;\r\n\r\n\t\tfor (int i = 0; i < n; i++)\r\n\t\t{\r\n\t\t\tfor (int j = max; j >= 0; j--)\r\n\t\t\t{\r\n\t\t\t\tif (u[j])\r\n\t\t\t\t{\r\n\t\t\t\t\tu[j + a[i]] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn u;\r\n\t}\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "58ce6502ab9965eb145dabd6d3a8b55d", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.CompilerServices;\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 bool Fun(int[] a, int n)\r\n {\r\n int s = a.Sum();\r\n if (s % 2 > 0)\r\n return false;\r\n\r\n s /= 2;\r\n var dp = new bool[n + 1, s + 1];\r\n for (int i = 0; i <= n; i++)\r\n dp[i, 0] = true;\r\n for (int i = 1; i <= n; i++)\r\n for (int j = 1; j <= s; j++)\r\n {\r\n dp[i, j] = dp[i - 1, j];\r\n if (j >= a[i - 1])\r\n dp[i, j] |= dp[i - 1, j - a[i - 1]];\r\n }\r\n\r\n return dp[n, s];\r\n }\r\n\r\n public void Solve()\r\n {\r\n int n = ReadInt();\r\n var a = ReadIntArray();\r\n\r\n if (!Fun(a, n))\r\n Write(0);\r\n else\r\n {\r\n Write(1);\r\n while (a.All(_ => _ % 2 == 0))\r\n a = a.Select(_ => _ / 2).ToArray();\r\n for (int i = 0; ; i++)\r\n if (a[i] % 2 > 0)\r\n {\r\n Write(i + 1);\r\n break;\r\n }\r\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} ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad828057c64eb2297dc9682aecc6be42", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "namespace Csharp_Contest\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Diagnostics;\r\n using System.Globalization;\r\n using System.IO;\r\n using System.Linq;\r\n using System.Text;\r\n using System.Threading;\r\n\r\n /*\r\n * #import_BitMap.cs\r\n */\r\n\r\n static class Program\r\n {\r\n private const int StackSize = 32 * (1 << 20);\r\n private const int Sz = (int)2e5 + 10;\r\n private const int Mod = (int)1e9 + 7;\r\n private static int n;\r\n private static BitMap dp;\r\n private static BitMap vp;\r\n private static List ar;\r\n\r\n private static void Solve()\r\n {\r\n int n = NextInt();\r\n dp = new BitMap(n, Sz);\r\n vp = new BitMap(n, Sz);\r\n ar = Repeat(0, n).Select(_ => NextInt()).ToList();\r\n int sum = ar.Aggregate((s, n) => s + n);\r\n if (sum % 2 == 1 || !Possible(n - 1, n, 0, 0))\r\n {\r\n OutputPrinter.WriteLine(0);\r\n }\r\n else\r\n {\r\n for (int i = 0; i < n; i++)\r\n {\r\n dp.Clear();\r\n vp.Clear();\r\n if (!Possible(n - 1, i, 0, 0))\r\n {\r\n OutputPrinter.WriteLine(1);\r\n OutputPrinter.WriteLine(i + 1);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static bool Possible(int x, int skip, int sumLeft, int sumRight)\r\n {\r\n if (x < 0)\r\n {\r\n return sumLeft == sumRight;\r\n }\r\n\r\n if (vp[x, sumLeft])\r\n {\r\n return dp[x, sumLeft];\r\n }\r\n\r\n vp[x, sumLeft] = true;\r\n\r\n if (x == skip)\r\n {\r\n return dp[x, sumLeft] = Possible(x - 1, skip, sumLeft, sumRight);\r\n }\r\n\r\n dp[x, sumLeft] = dp[x, sumLeft] || Possible(x - 1, skip, sumLeft + ar[x], sumRight);\r\n dp[x, sumLeft] = dp[x, sumLeft] || Possible(x - 1, skip, sumLeft, sumRight + ar[x]);\r\n\r\n return dp[x, sumLeft];\r\n }\r\n\r\n public static void Main(string[] args)\r\n {\r\n#if CLown1331\r\n for (int testCase = 0; testCase < 4; testCase++)\r\n {\r\n Solve();\r\n }\r\n\r\n Utils.CreateFileForSubmission();\r\n if (Debugger.IsAttached) Thread.Sleep(Timeout.Infinite);\r\n#else\r\n Thread t = new Thread(Solve, StackSize);\r\n t.Start();\r\n t.Join();\r\n#endif\r\n OutputPrinter.Flush();\r\n ErrorPrinter.Flush();\r\n }\r\n\r\n private static int NextInt() => int.Parse(Reader.NextString());\r\n\r\n private static long NextLong() => long.Parse(Reader.NextString());\r\n\r\n private static double NextDouble() => double.Parse(Reader.NextString());\r\n\r\n private static string NextString() => Reader.NextString();\r\n\r\n private static string NextLine() => Reader.ReadLine();\r\n\r\n private static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => XorShift);\r\n\r\n private static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n\r\n private static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n\r\n private static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n\r\n private static uint XorShift\r\n {\r\n get\r\n {\r\n Xsc().MoveNext();\r\n return Xsc().Current;\r\n }\r\n }\r\n\r\n private static IEnumerator Xsc()\r\n {\r\n uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff);\r\n while (true)\r\n {\r\n uint t = x ^ (x << 11);\r\n x = y;\r\n y = z;\r\n z = w;\r\n w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));\r\n yield return w;\r\n }\r\n }\r\n\r\n private static class Reader\r\n {\r\n private static readonly Queue Param = new Queue();\r\n#if CLown1331\r\n private static readonly StreamReader InputReader = new StreamReader(\"input.txt\");\r\n#else\r\n private static readonly StreamReader InputReader = new StreamReader(Console.OpenStandardInput());\r\n#endif\r\n\r\n public static string NextString()\r\n {\r\n if (Param.Count == 0)\r\n {\r\n foreach (string item in ReadLine().Split(' '))\r\n {\r\n if (string.IsNullOrWhiteSpace(item))\r\n {\r\n continue;\r\n }\r\n\r\n Param.Enqueue(item);\r\n }\r\n }\r\n\r\n return Param.Dequeue();\r\n }\r\n\r\n public static string ReadLine()\r\n {\r\n return InputReader.ReadLine();\r\n }\r\n }\r\n\r\n private static readonly Printer OutputPrinter = new Printer(Console.OpenStandardOutput());\r\n\r\n private static readonly Printer ErrorPrinter = new Printer(Console.OpenStandardError());\r\n\r\n private sealed class Printer : StreamWriter\r\n {\r\n public Printer(Stream stream)\r\n : base(stream, new UTF8Encoding(false, true))\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public Printer(Stream stream, Encoding encoding)\r\n : base(stream, encoding)\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\r\n }\r\n }\r\n}\r\nnamespace Csharp_Contest\r\n{\r\n using System;\r\n using System.Collections;\r\n using System.Linq;\r\n\r\n public class BitMap\r\n {\r\n private readonly BitArray bitArray;\r\n private readonly int[] dimensions;\r\n\r\n public BitMap(params int[] dimensions)\r\n {\r\n this.dimensions = dimensions;\r\n this.bitArray = new BitArray(this.dimensions.Aggregate((s, n) => s * n));\r\n }\r\n\r\n public void Clear()\r\n {\r\n this.bitArray.SetAll(false);\r\n }\r\n\r\n public void SetValue(bool value, params int[] indexes)\r\n {\r\n this.ValidateIndexes(indexes);\r\n this.bitArray[this.GetIndex(indexes)] = value;\r\n }\r\n\r\n public bool GetValue(int[] indexes)\r\n {\r\n this.ValidateIndexes(indexes);\r\n return this.bitArray[this.GetIndex(indexes)];\r\n }\r\n\r\n public bool this[params int[] indexes]\r\n {\r\n get => this.GetValue(indexes);\r\n set => this.SetValue(value, indexes);\r\n }\r\n\r\n private void ValidateIndexes(int[] indexes)\r\n {\r\n if (indexes.Length != this.dimensions.Length)\r\n {\r\n throw new Exception(\"Number of indexes != _dimensions\");\r\n }\r\n\r\n for (int i = 0; i < indexes.Length; i++)\r\n {\r\n if (indexes[i] < 0 || indexes[i] >= this.dimensions[i])\r\n {\r\n throw new IndexOutOfRangeException();\r\n }\r\n }\r\n }\r\n\r\n private int GetIndex(int[] indexes)\r\n {\r\n int ret = 0;\r\n int power = 1;\r\n for (int i = 1; i <= indexes.Length; i++)\r\n {\r\n ret += power * indexes[^i];\r\n power *= this.dimensions[^i];\r\n }\r\n\r\n return ret;\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8c00bd31709983291fe3f0b88dda8814", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "namespace CLown1331\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Diagnostics;\r\n using System.Globalization;\r\n using System.IO;\r\n using System.Linq;\r\n using System.Text;\r\n using System.Threading;\r\n using Library.LongMatrix;\r\n\r\n /*\r\n * \r\n */\r\n\r\n static class Program\r\n {\r\n private const int NumberOfTestCase = 4;\r\n private const int StackSize = 64 * (1 << 20);\r\n private const int Sz = (int)2e5 + 10;\r\n private const int Mod = (int)1e9 + 7;\r\n private static int n;\r\n private static int[] dp;\r\n private static List ar;\r\n\r\n private static void Solve()\r\n {\r\n new LongMatrix(2, 3);\r\n n = NextInt();\r\n dp = new int[Sz];\r\n ar = Repeat(0, n).Select(_ => NextInt()).ToList();\r\n int sum = ar.Aggregate((s, n) => s + n);\r\n if (sum % 2 == 1 || !Possible(n, sum))\r\n {\r\n OutputPrinter.WriteLine(0);\r\n }\r\n else\r\n {\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (!Possible(i, sum))\r\n {\r\n OutputPrinter.WriteLine(1);\r\n OutputPrinter.WriteLine(i + 1);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static bool Possible(int skip, int sum)\r\n {\r\n for (int j = sum; j >= 0; j--)\r\n {\r\n dp[j] = 0;\r\n }\r\n\r\n dp[0] = 1;\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (i == skip)\r\n {\r\n continue;\r\n }\r\n\r\n for (int j = sum; j >= ar[i]; j--)\r\n {\r\n dp[j] |= dp[j - ar[i]];\r\n }\r\n }\r\n\r\n int maxPossible = -1;\r\n for (int j = sum; j >= 0; j--)\r\n {\r\n if (dp[j] == 1)\r\n {\r\n maxPossible = j;\r\n break;\r\n }\r\n }\r\n\r\n return !(maxPossible == -1 || maxPossible % 2 == 1 || dp[maxPossible / 2] != 1);\r\n }\r\n\r\n public static void Main(string[] args)\r\n {\r\n#if CLown1331\r\n for (int testCase = 0; testCase < NumberOfTestCase; testCase++)\r\n {\r\n Solve();\r\n }\r\n\r\n Utils.CreateFileForSubmission();\r\n if (Debugger.IsAttached) Thread.Sleep(Timeout.Infinite);\r\n#else\r\n Thread t = new Thread(Solve, StackSize);\r\n t.Start();\r\n t.Join();\r\n#endif\r\n OutputPrinter.Flush();\r\n ErrorPrinter.Flush();\r\n }\r\n\r\n private static int NextInt() => int.Parse(Reader.NextString());\r\n\r\n private static long NextLong() => long.Parse(Reader.NextString());\r\n\r\n private static double NextDouble() => double.Parse(Reader.NextString());\r\n\r\n private static string NextString() => Reader.NextString();\r\n\r\n private static string NextLine() => Reader.ReadLine();\r\n\r\n private static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => XorShift);\r\n\r\n private static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n\r\n private static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n\r\n private static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n\r\n private static uint XorShift\r\n {\r\n get\r\n {\r\n Xsc().MoveNext();\r\n return Xsc().Current;\r\n }\r\n }\r\n\r\n private static IEnumerator Xsc()\r\n {\r\n uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff);\r\n while (true)\r\n {\r\n uint t = x ^ (x << 11);\r\n x = y;\r\n y = z;\r\n z = w;\r\n w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));\r\n yield return w;\r\n }\r\n }\r\n\r\n private static class Reader\r\n {\r\n private static readonly Queue Param = new Queue();\r\n#if CLown1331\r\n private static readonly StreamReader InputReader = new StreamReader(\"input.txt\");\r\n#else\r\n private static readonly StreamReader InputReader = new StreamReader(Console.OpenStandardInput());\r\n#endif\r\n\r\n public static string NextString()\r\n {\r\n if (Param.Count == 0)\r\n {\r\n foreach (string item in ReadLine().Split(' '))\r\n {\r\n if (string.IsNullOrWhiteSpace(item))\r\n {\r\n continue;\r\n }\r\n\r\n Param.Enqueue(item);\r\n }\r\n }\r\n\r\n return Param.Dequeue();\r\n }\r\n\r\n public static string ReadLine()\r\n {\r\n return InputReader.ReadLine();\r\n }\r\n }\r\n\r\n private static readonly Printer OutputPrinter = new Printer(Console.OpenStandardOutput());\r\n\r\n private static readonly Printer ErrorPrinter = new Printer(Console.OpenStandardError());\r\n\r\n private sealed class Printer : StreamWriter\r\n {\r\n public Printer(Stream stream)\r\n : base(stream, new UTF8Encoding(false, true))\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public Printer(Stream stream, Encoding encoding)\r\n : base(stream, encoding)\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\r\n }\r\n }\r\n}\r\nnamespace Library.LongMatrix\r\n{\r\n using Library.Matrix;\r\n/*\r\n * #import_Matrix.cs\r\n */\r\n public class LongMatrix: Matrix\r\n {\r\n private readonly long mod;\r\n\r\n public LongMatrix(int size, long mod) : base(size)\r\n {\r\n this.mod = mod;\r\n }\r\n\r\n public override void Identity()\r\n {\r\n for (int i = 0; i < this.Size; i++)\r\n {\r\n for (int j = 0; j < this.Size; j++)\r\n {\r\n this[i, j] = (i == j) ? 1 : 0;\r\n }\r\n }\r\n }\r\n\r\n protected override Matrix Add(Matrix right)\r\n {\r\n LongMatrix temp = new LongMatrix(this.Size, this.mod);\r\n temp.Reset();\r\n for (int i = 0; i < this.Size; i++)\r\n {\r\n for (int j = 0; j < this.Size; j++)\r\n {\r\n temp[i, j] = (this[i, j] + right[i, j]) % this.mod;\r\n while (temp[i, j] >= this.mod)\r\n {\r\n temp[i, j] -= this.mod;\r\n }\r\n }\r\n }\r\n\r\n return temp;\r\n }\r\n\r\n protected override Matrix Multiply(Matrix right)\r\n {\r\n LongMatrix temp = new LongMatrix(this.Size, this.mod);\r\n temp.Reset();\r\n for (int i = 0; i < this.Size; i++)\r\n {\r\n for (int j = 0; j < this.Size; j++)\r\n {\r\n for (int k = 0; k < this.Size; k++)\r\n {\r\n temp[i, k] += (this[i, j] * right[j, k]) % this.mod;\r\n while (temp[i, k] >= this.mod)\r\n {\r\n temp[i, k] -= this.mod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return temp;\r\n }\r\n\r\n protected override Matrix Power(long power)\r\n {\r\n LongMatrix ans = new LongMatrix(this.Size, this.mod);\r\n ans.Identity();\r\n LongMatrix num = this;\r\n for (; power > 0; power >>= 1)\r\n {\r\n if (power % 2 == 1)\r\n {\r\n ans = (LongMatrix)(ans * num);\r\n }\r\n\r\n num = (LongMatrix)(num * num);\r\n }\r\n\r\n return ans;\r\n }\r\n }\r\n}\r\nnamespace Library.Matrix\r\n{\r\n public abstract class Matrix\r\n {\r\n private T[,] a;\r\n private readonly int size;\r\n\r\n protected Matrix(int size)\r\n {\r\n this.size = size;\r\n this.a = new T[this.size, this.size];\r\n }\r\n\r\n public void Reset()\r\n {\r\n for (int i = 0; i < this.size; i++)\r\n {\r\n for (int j = 0; j < this.size; j++)\r\n {\r\n this[i, j] = default(T);\r\n }\r\n }\r\n }\r\n\r\n public abstract void Identity();\r\n\r\n public static Matrix operator+ (Matrix a, Matrix b)\r\n {\r\n return a.Add(b);\r\n }\r\n\r\n protected abstract Matrix Add(Matrix right);\r\n\r\n public static Matrix operator *(Matrix a, Matrix b)\r\n {\r\n return a.Multiply(b);\r\n }\r\n\r\n protected abstract Matrix Multiply(Matrix right);\r\n\r\n public static Matrix operator ^(Matrix a, long power)\r\n {\r\n return a.Power(power);\r\n }\r\n\r\n public static Matrix operator ^(Matrix a, int power)\r\n {\r\n return a.Power(power);\r\n }\r\n\r\n public T this[int i, int j]\r\n {\r\n get => this.a[i, j];\r\n set => this.a[i, j] = value;\r\n }\r\n\r\n protected abstract Matrix Power(long power);\r\n\r\n public int Size => this.size;\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "69fb8f8458c24268b4b721ffe5be2ea8", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "namespace CLown1331\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Diagnostics;\r\n using System.Globalization;\r\n using System.IO;\r\n using System.Linq;\r\n using System.Text;\r\n using System.Threading;\r\n\r\n /*\r\n * #import_BitMap.cs\r\n */\r\n\r\n static class Program\r\n {\r\n private const int NumberOfTestCase = 4;\r\n private const int StackSize = 64 * (1 << 20);\r\n private const int Sz = (int)2e5 + 10;\r\n private const int Mod = (int)1e9 + 7;\r\n private static int n;\r\n private static BitMap dp;\r\n private static BitMap vp;\r\n private static List ar;\r\n\r\n private static void Solve()\r\n {\r\n n = NextInt();\r\n dp = new BitMap(Sz);\r\n ar = Repeat(0, n).Select(_ => NextInt()).ToList();\r\n int sum = ar.Aggregate((s, n) => s + n);\r\n if (sum % 2 == 1 || !Possible(n, sum))\r\n {\r\n OutputPrinter.WriteLine(0);\r\n }\r\n else\r\n {\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (!Possible(i, sum))\r\n {\r\n OutputPrinter.WriteLine(1);\r\n OutputPrinter.WriteLine(i + 1);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static bool Possible(int skip, int sum)\r\n {\r\n dp.Clear();\r\n dp[0] = true;\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (i == skip)\r\n {\r\n continue;\r\n }\r\n\r\n for (int j = sum; j >= ar[i]; j--)\r\n {\r\n dp[j] = dp[j] || dp[j - ar[i]];\r\n }\r\n }\r\n\r\n int maxPossible = -1;\r\n for (int j = sum; j >= 0; j--)\r\n {\r\n if (dp[j])\r\n {\r\n maxPossible = j;\r\n break;\r\n }\r\n }\r\n\r\n return !(maxPossible == -1 || maxPossible % 2 == 1 || !dp[maxPossible / 2]);\r\n }\r\n\r\n public static void Main(string[] args)\r\n {\r\n#if CLown1331\r\n for (int testCase = 0; testCase < NumberOfTestCase; testCase++)\r\n {\r\n Solve();\r\n }\r\n\r\n Utils.CreateFileForSubmission();\r\n if (Debugger.IsAttached) Thread.Sleep(Timeout.Infinite);\r\n#else\r\n Thread t = new Thread(Solve, StackSize);\r\n t.Start();\r\n t.Join();\r\n#endif\r\n OutputPrinter.Flush();\r\n ErrorPrinter.Flush();\r\n }\r\n\r\n private static int NextInt() => int.Parse(Reader.NextString());\r\n\r\n private static long NextLong() => long.Parse(Reader.NextString());\r\n\r\n private static double NextDouble() => double.Parse(Reader.NextString());\r\n\r\n private static string NextString() => Reader.NextString();\r\n\r\n private static string NextLine() => Reader.ReadLine();\r\n\r\n private static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => XorShift);\r\n\r\n private static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n\r\n private static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n\r\n private static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n\r\n private static uint XorShift\r\n {\r\n get\r\n {\r\n Xsc().MoveNext();\r\n return Xsc().Current;\r\n }\r\n }\r\n\r\n private static IEnumerator Xsc()\r\n {\r\n uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff);\r\n while (true)\r\n {\r\n uint t = x ^ (x << 11);\r\n x = y;\r\n y = z;\r\n z = w;\r\n w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));\r\n yield return w;\r\n }\r\n }\r\n\r\n private static class Reader\r\n {\r\n private static readonly Queue Param = new Queue();\r\n#if CLown1331\r\n private static readonly StreamReader InputReader = new StreamReader(\"input.txt\");\r\n#else\r\n private static readonly StreamReader InputReader = new StreamReader(Console.OpenStandardInput());\r\n#endif\r\n\r\n public static string NextString()\r\n {\r\n if (Param.Count == 0)\r\n {\r\n foreach (string item in ReadLine().Split(' '))\r\n {\r\n if (string.IsNullOrWhiteSpace(item))\r\n {\r\n continue;\r\n }\r\n\r\n Param.Enqueue(item);\r\n }\r\n }\r\n\r\n return Param.Dequeue();\r\n }\r\n\r\n public static string ReadLine()\r\n {\r\n return InputReader.ReadLine();\r\n }\r\n }\r\n\r\n private static readonly Printer OutputPrinter = new Printer(Console.OpenStandardOutput());\r\n\r\n private static readonly Printer ErrorPrinter = new Printer(Console.OpenStandardError());\r\n\r\n private sealed class Printer : StreamWriter\r\n {\r\n public Printer(Stream stream)\r\n : base(stream, new UTF8Encoding(false, true))\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public Printer(Stream stream, Encoding encoding)\r\n : base(stream, encoding)\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\r\n }\r\n }\r\n}\r\nnamespace CLown1331\r\n{\r\n using System;\r\n using System.Collections;\r\n using System.Linq;\r\n\r\n public class BitMap\r\n {\r\n private readonly BitArray bitArray;\r\n private readonly int[] dimensions;\r\n\r\n public BitMap(params int[] dimensions)\r\n {\r\n this.dimensions = dimensions;\r\n this.bitArray = new BitArray(this.dimensions.Aggregate((s, n) => s * n));\r\n }\r\n\r\n public void Clear()\r\n {\r\n this.bitArray.SetAll(false);\r\n }\r\n\r\n public void SetValue(bool value, params int[] indexes)\r\n {\r\n this.ValidateIndexes(indexes);\r\n this.bitArray[this.GetIndex(indexes)] = value;\r\n }\r\n\r\n public bool GetValue(int[] indexes)\r\n {\r\n this.ValidateIndexes(indexes);\r\n return this.bitArray[this.GetIndex(indexes)];\r\n }\r\n\r\n public bool this[params int[] indexes]\r\n {\r\n get => this.GetValue(indexes);\r\n set => this.SetValue(value, indexes);\r\n }\r\n\r\n private void ValidateIndexes(int[] indexes)\r\n {\r\n if (indexes.Length != this.dimensions.Length)\r\n {\r\n throw new Exception(\"Number of indexes != _dimensions\");\r\n }\r\n\r\n for (int i = 0; i < indexes.Length; i++)\r\n {\r\n if (indexes[i] < 0 || indexes[i] >= this.dimensions[i])\r\n {\r\n throw new IndexOutOfRangeException();\r\n }\r\n }\r\n }\r\n\r\n private int GetIndex(int[] indexes)\r\n {\r\n int ret = 0;\r\n int power = 1;\r\n for (int i = 1; i <= indexes.Length; i++)\r\n {\r\n ret += power * indexes[^i];\r\n power *= this.dimensions[^i];\r\n }\r\n\r\n return ret;\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "03560ebe51b96fd6cf4f33614f99487b", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "namespace CLown1331\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Diagnostics;\r\n using System.Globalization;\r\n using System.IO;\r\n using System.Linq;\r\n using System.Text;\r\n using System.Threading;\r\n\r\n /*\r\n * #import_BitMap.cs\r\n */\r\n\r\n static class Program\r\n {\r\n private const int NumberOfTestCase = 4;\r\n private const int StackSize = 64 * (1 << 20);\r\n private const int Sz = (int)2e5 + 10;\r\n private const int Mod = (int)1e9 + 7;\r\n private static int n;\r\n private static int[] dp;\r\n private static List ar;\r\n\r\n private static void Solve()\r\n {\r\n n = NextInt();\r\n dp = new int[Sz];\r\n ar = Repeat(0, n).Select(_ => NextInt()).ToList();\r\n int sum = ar.Aggregate((s, n) => s + n);\r\n if (sum % 2 == 1 || !Possible(n, sum))\r\n {\r\n OutputPrinter.WriteLine(0);\r\n }\r\n else\r\n {\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (!Possible(i, sum))\r\n {\r\n OutputPrinter.WriteLine(1);\r\n OutputPrinter.WriteLine(i + 1);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static bool Possible(int skip, int sum)\r\n {\r\n for (int j = sum; j >= 0; j--)\r\n {\r\n dp[j] = 0;\r\n }\r\n\r\n dp[0] = 1;\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (i == skip)\r\n {\r\n continue;\r\n }\r\n\r\n for (int j = sum; j >= ar[i]; j--)\r\n {\r\n dp[j] |= dp[j - ar[i]];\r\n }\r\n }\r\n\r\n int maxPossible = -1;\r\n for (int j = sum; j >= 0; j--)\r\n {\r\n if (dp[j] == 1)\r\n {\r\n maxPossible = j;\r\n break;\r\n }\r\n }\r\n\r\n return !(maxPossible == -1 || maxPossible % 2 == 1 || dp[maxPossible / 2] != 1);\r\n }\r\n\r\n public static void Main(string[] args)\r\n {\r\n#if CLown1331\r\n for (int testCase = 0; testCase < NumberOfTestCase; testCase++)\r\n {\r\n Solve();\r\n }\r\n\r\n Utils.CreateFileForSubmission();\r\n if (Debugger.IsAttached) Thread.Sleep(Timeout.Infinite);\r\n#else\r\n Thread t = new Thread(Solve, StackSize);\r\n t.Start();\r\n t.Join();\r\n#endif\r\n OutputPrinter.Flush();\r\n ErrorPrinter.Flush();\r\n }\r\n\r\n private static int NextInt() => int.Parse(Reader.NextString());\r\n\r\n private static long NextLong() => long.Parse(Reader.NextString());\r\n\r\n private static double NextDouble() => double.Parse(Reader.NextString());\r\n\r\n private static string NextString() => Reader.NextString();\r\n\r\n private static string NextLine() => Reader.ReadLine();\r\n\r\n private static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => XorShift);\r\n\r\n private static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n\r\n private static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n\r\n private static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n\r\n private static uint XorShift\r\n {\r\n get\r\n {\r\n Xsc().MoveNext();\r\n return Xsc().Current;\r\n }\r\n }\r\n\r\n private static IEnumerator Xsc()\r\n {\r\n uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff);\r\n while (true)\r\n {\r\n uint t = x ^ (x << 11);\r\n x = y;\r\n y = z;\r\n z = w;\r\n w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));\r\n yield return w;\r\n }\r\n }\r\n\r\n private static class Reader\r\n {\r\n private static readonly Queue Param = new Queue();\r\n#if CLown1331\r\n private static readonly StreamReader InputReader = new StreamReader(\"input.txt\");\r\n#else\r\n private static readonly StreamReader InputReader = new StreamReader(Console.OpenStandardInput());\r\n#endif\r\n\r\n public static string NextString()\r\n {\r\n if (Param.Count == 0)\r\n {\r\n foreach (string item in ReadLine().Split(' '))\r\n {\r\n if (string.IsNullOrWhiteSpace(item))\r\n {\r\n continue;\r\n }\r\n\r\n Param.Enqueue(item);\r\n }\r\n }\r\n\r\n return Param.Dequeue();\r\n }\r\n\r\n public static string ReadLine()\r\n {\r\n return InputReader.ReadLine();\r\n }\r\n }\r\n\r\n private static readonly Printer OutputPrinter = new Printer(Console.OpenStandardOutput());\r\n\r\n private static readonly Printer ErrorPrinter = new Printer(Console.OpenStandardError());\r\n\r\n private sealed class Printer : StreamWriter\r\n {\r\n public Printer(Stream stream)\r\n : base(stream, new UTF8Encoding(false, true))\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public Printer(Stream stream, Encoding encoding)\r\n : base(stream, encoding)\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\r\n }\r\n }\r\n}\r\nnamespace CLown1331\r\n{\r\n using System;\r\n using System.Collections;\r\n using System.Linq;\r\n\r\n public class BitMap\r\n {\r\n private readonly BitArray bitArray;\r\n private readonly int[] dimensions;\r\n\r\n public BitMap(params int[] dimensions)\r\n {\r\n this.dimensions = dimensions;\r\n this.bitArray = new BitArray(this.dimensions.Aggregate((s, n) => s * n));\r\n }\r\n\r\n public void Clear()\r\n {\r\n this.bitArray.SetAll(false);\r\n }\r\n\r\n public void SetValue(bool value, params int[] indexes)\r\n {\r\n this.ValidateIndexes(indexes);\r\n this.bitArray[this.GetIndex(indexes)] = value;\r\n }\r\n\r\n public bool GetValue(int[] indexes)\r\n {\r\n this.ValidateIndexes(indexes);\r\n return this.bitArray[this.GetIndex(indexes)];\r\n }\r\n\r\n public bool this[params int[] indexes]\r\n {\r\n get => this.GetValue(indexes);\r\n set => this.SetValue(value, indexes);\r\n }\r\n\r\n private void ValidateIndexes(int[] indexes)\r\n {\r\n if (indexes.Length != this.dimensions.Length)\r\n {\r\n throw new Exception(\"Number of indexes != _dimensions\");\r\n }\r\n\r\n for (int i = 0; i < indexes.Length; i++)\r\n {\r\n if (indexes[i] < 0 || indexes[i] >= this.dimensions[i])\r\n {\r\n throw new IndexOutOfRangeException();\r\n }\r\n }\r\n }\r\n\r\n private int GetIndex(int[] indexes)\r\n {\r\n int ret = 0;\r\n int power = 1;\r\n for (int i = 1; i <= indexes.Length; i++)\r\n {\r\n ret += power * indexes[^i];\r\n power *= this.dimensions[^i];\r\n }\r\n\r\n return ret;\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a1890ed5472a2db46f8b790dd51d5e20", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "namespace CLown1331\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Diagnostics;\r\n using System.Globalization;\r\n using System.IO;\r\n using System.Linq;\r\n using System.Text;\r\n using System.Threading;\r\n\r\n /*\r\n *\r\n */\r\n\r\n static class Program\r\n {\r\n private const int NumberOfTestCase = 4;\r\n private const int StackSize = 64 * (1 << 20);\r\n private const int Sz = (int)2e5 + 10;\r\n private const int Mod = (int)1e9 + 7;\r\n private static int n;\r\n private static int[] dp;\r\n private static List ar;\r\n\r\n private static void Solve()\r\n {\r\n n = NextInt();\r\n dp = new int[Sz];\r\n ar = Repeat(0, n).Select(_ => NextInt()).ToList();\r\n int sum = ar.Aggregate((s, n) => s + n);\r\n if (sum % 2 == 1 || !Possible(n, sum))\r\n {\r\n OutputPrinter.WriteLine(0);\r\n }\r\n else\r\n {\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (!Possible(i, sum))\r\n {\r\n OutputPrinter.WriteLine(1);\r\n OutputPrinter.WriteLine(i + 1);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static bool Possible(int skip, int sum)\r\n {\r\n for (int j = sum; j >= 0; j--)\r\n {\r\n dp[j] = 0;\r\n }\r\n\r\n dp[0] = 1;\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (i == skip)\r\n {\r\n continue;\r\n }\r\n\r\n for (int j = sum; j >= ar[i]; j--)\r\n {\r\n dp[j] |= dp[j - ar[i]];\r\n }\r\n }\r\n\r\n int maxPossible = -1;\r\n for (int j = sum; j >= 0; j--)\r\n {\r\n if (dp[j] == 1)\r\n {\r\n maxPossible = j;\r\n break;\r\n }\r\n }\r\n\r\n return !(maxPossible == -1 || maxPossible % 2 == 1 || dp[maxPossible / 2] != 1);\r\n }\r\n\r\n public static void Main(string[] args)\r\n {\r\n#if CLown1331\r\n for (int testCase = 0; testCase < NumberOfTestCase; testCase++)\r\n {\r\n Solve();\r\n }\r\n\r\n Utils.CreateFileForSubmission();\r\n if (Debugger.IsAttached) Thread.Sleep(Timeout.Infinite);\r\n#else\r\n Thread t = new Thread(Solve, StackSize);\r\n t.Start();\r\n t.Join();\r\n#endif\r\n OutputPrinter.Flush();\r\n ErrorPrinter.Flush();\r\n }\r\n\r\n private static int NextInt() => int.Parse(Reader.NextString());\r\n\r\n private static long NextLong() => long.Parse(Reader.NextString());\r\n\r\n private static double NextDouble() => double.Parse(Reader.NextString());\r\n\r\n private static string NextString() => Reader.NextString();\r\n\r\n private static string NextLine() => Reader.ReadLine();\r\n\r\n private static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => XorShift);\r\n\r\n private static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n\r\n private static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n\r\n private static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n\r\n private static uint XorShift\r\n {\r\n get\r\n {\r\n Xsc().MoveNext();\r\n return Xsc().Current;\r\n }\r\n }\r\n\r\n private static IEnumerator Xsc()\r\n {\r\n uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff);\r\n while (true)\r\n {\r\n uint t = x ^ (x << 11);\r\n x = y;\r\n y = z;\r\n z = w;\r\n w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));\r\n yield return w;\r\n }\r\n }\r\n\r\n private static class Reader\r\n {\r\n private static readonly Queue Param = new Queue();\r\n#if CLown1331\r\n private static readonly StreamReader InputReader = new StreamReader(\"input.txt\");\r\n#else\r\n private static readonly StreamReader InputReader = new StreamReader(Console.OpenStandardInput());\r\n#endif\r\n\r\n public static string NextString()\r\n {\r\n if (Param.Count == 0)\r\n {\r\n foreach (string item in ReadLine().Split(' '))\r\n {\r\n if (string.IsNullOrWhiteSpace(item))\r\n {\r\n continue;\r\n }\r\n\r\n Param.Enqueue(item);\r\n }\r\n }\r\n\r\n return Param.Dequeue();\r\n }\r\n\r\n public static string ReadLine()\r\n {\r\n return InputReader.ReadLine();\r\n }\r\n }\r\n\r\n private static readonly Printer OutputPrinter = new Printer(Console.OpenStandardOutput());\r\n\r\n private static readonly Printer ErrorPrinter = new Printer(Console.OpenStandardError());\r\n\r\n private sealed class Printer : StreamWriter\r\n {\r\n public Printer(Stream stream)\r\n : base(stream, new UTF8Encoding(false, true))\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public Printer(Stream stream, Encoding encoding)\r\n : base(stream, encoding)\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0b5d2956e3a629529223c0f91802e389", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "namespace CLown1331\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Diagnostics;\r\n using System.Globalization;\r\n using System.IO;\r\n using System.Linq;\r\n using System.Text;\r\n using System.Threading;\r\n\r\n /*\r\n *\r\n */\r\n\r\n static class Program\r\n {\r\n private const int NumberOfTestCase = 4;\r\n private const int StackSize = 64 * (1 << 20);\r\n private const int Sz = (int)2e5 + 10;\r\n private const int Mod = (int)1e9 + 7;\r\n private static int n;\r\n private static BitMap dp;\r\n private static BitMap vp;\r\n private static List ar;\r\n\r\n private static void Solve()\r\n {\r\n n = NextInt();\r\n dp = new BitMap(Sz);\r\n ar = Repeat(0, n).Select(_ => NextInt()).ToList();\r\n int sum = ar.Aggregate((s, n) => s + n);\r\n if (sum % 2 == 1 || !Possible(n, sum))\r\n {\r\n OutputPrinter.WriteLine(0);\r\n }\r\n else\r\n {\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (!Possible(i, sum))\r\n {\r\n OutputPrinter.WriteLine(1);\r\n OutputPrinter.WriteLine(i + 1);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static bool Possible(int skip, int sum)\r\n {\r\n dp.Clear();\r\n dp[0] = true;\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (i == skip)\r\n {\r\n continue;\r\n }\r\n\r\n for (int j = sum; j >= ar[i]; j--)\r\n {\r\n dp[j] = dp[j] || dp[j - ar[i]];\r\n }\r\n }\r\n\r\n int maxPossible = -1;\r\n for (int j = sum; j >= 0; j--)\r\n {\r\n if (dp[j])\r\n {\r\n maxPossible = j;\r\n break;\r\n }\r\n }\r\n\r\n return !(maxPossible == -1 || maxPossible % 2 == 1 || !dp[maxPossible / 2]);\r\n }\r\n\r\n public static void Main(string[] args)\r\n {\r\n#if CLown1331\r\n for (int testCase = 0; testCase < NumberOfTestCase; testCase++)\r\n {\r\n Solve();\r\n }\r\n\r\n Utils.CreateFileForSubmission();\r\n if (Debugger.IsAttached) Thread.Sleep(Timeout.Infinite);\r\n#else\r\n Thread t = new Thread(Solve, StackSize);\r\n t.Start();\r\n t.Join();\r\n#endif\r\n OutputPrinter.Flush();\r\n ErrorPrinter.Flush();\r\n }\r\n\r\n private static int NextInt() => int.Parse(Reader.NextString());\r\n\r\n private static long NextLong() => long.Parse(Reader.NextString());\r\n\r\n private static double NextDouble() => double.Parse(Reader.NextString());\r\n\r\n private static string NextString() => Reader.NextString();\r\n\r\n private static string NextLine() => Reader.ReadLine();\r\n\r\n private static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => XorShift);\r\n\r\n private static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n\r\n private static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n\r\n private static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n\r\n private static uint XorShift\r\n {\r\n get\r\n {\r\n Xsc().MoveNext();\r\n return Xsc().Current;\r\n }\r\n }\r\n\r\n private static IEnumerator Xsc()\r\n {\r\n uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff);\r\n while (true)\r\n {\r\n uint t = x ^ (x << 11);\r\n x = y;\r\n y = z;\r\n z = w;\r\n w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));\r\n yield return w;\r\n }\r\n }\r\n\r\n private static class Reader\r\n {\r\n private static readonly Queue Param = new Queue();\r\n#if CLown1331\r\n private static readonly StreamReader InputReader = new StreamReader(\"input.txt\");\r\n#else\r\n private static readonly StreamReader InputReader = new StreamReader(Console.OpenStandardInput());\r\n#endif\r\n\r\n public static string NextString()\r\n {\r\n if (Param.Count == 0)\r\n {\r\n foreach (string item in ReadLine().Split(' '))\r\n {\r\n if (string.IsNullOrWhiteSpace(item))\r\n {\r\n continue;\r\n }\r\n\r\n Param.Enqueue(item);\r\n }\r\n }\r\n\r\n return Param.Dequeue();\r\n }\r\n\r\n public static string ReadLine()\r\n {\r\n return InputReader.ReadLine();\r\n }\r\n }\r\n\r\n private static readonly Printer OutputPrinter = new Printer(Console.OpenStandardOutput());\r\n\r\n private static readonly Printer ErrorPrinter = new Printer(Console.OpenStandardError());\r\n\r\n private sealed class Printer : StreamWriter\r\n {\r\n public Printer(Stream stream)\r\n : base(stream, new UTF8Encoding(false, true))\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public Printer(Stream stream, Encoding encoding)\r\n : base(stream, encoding)\r\n {\r\n this.AutoFlush = false;\r\n }\r\n\r\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2c2808a14268e9ae2df02c4c187a0271", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "MS C#", "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 Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var q = sc.Integer();\n var par = new int[500002];\n par[0] = -1;\n var dp = Enumerate(500002, x => new double[35]);\n for (int i = 1; i < 35; i++)\n dp[0][i] = 1.0;\n\n var ptr = 1;\n Action recalc = null;\n recalc = v =>\n {\n for (int h = 1; h < 35; h++)\n dp[v][h] = 1.0;\n var ps = new List();\n for (int h = 0; h <= 35; h++)\n {\n if (v == -1) break;\n ps.Add(v);\n v = par[v];\n }\n for (int i = ps.Count - 2; i > 0; i--)\n {\n var u = ps[i]; var h = i;\n if (h + 1 >= 35) continue;\n var p = ps[i + 1];\n dp[p][h + 1] /= (dp[u][h] + 1) / 2;\n }\n for (int i = 0; i + 1 < ps.Count; i++)\n {\n var u = ps[i]; var h = i;\n var p = ps[i + 1];\n if (h + 1 >= 35) continue;\n dp[p][h + 1] *= (dp[u][h] + 1) / 2;\n }\n };\n for (int i = 0; i < q; i++)\n {\n if (sc.Integer() == 1)\n {\n var p = sc.Integer() - 1;\n par[ptr] = p;\n recalc(ptr);\n ptr++;\n\n }\n else\n {\n var v = sc.Integer() - 1;\n var ans = 0.0;\n for (int h = 1; h < 35; h++)\n ans += 1 - dp[v][h];\n Debug.WriteLine(dp[v].AsJoinedString());\n IO.Printer.Out.WriteLine(ans);\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 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\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3467e5d24031509494012a9ad54af639", "src_uid": "55affe752cb214d1e4031a9e3972597b", "difficulty": 2700.0} {"lang": "MS C#", "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 Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var q = sc.Integer();\n var par = new int[500002];\n par[0] = -1;\n var dp = Enumerate(500002, x => new double[45]);\n for (int i = 1; i < 45; i++)\n dp[0][i] = 1.0;\n\n var ptr = 1;\n Action recalc = null;\n recalc = v =>\n {\n for (int h = 1; h < 40; h++)\n dp[v][h] = 1.0;\n var ps = new List();\n for (int h = 0; h <= 40; h++)\n {\n if (v == -1) break;\n ps.Add(v);\n v = par[v];\n }\n for (int i = ps.Count - 2; i > 0; i--)\n {\n var u = ps[i]; var h = i;\n var p = ps[i + 1];\n dp[p][h + 1] /= (dp[u][h] + 1) / 2;\n }\n for (int i = 0; i + 1 < ps.Count; i++)\n {\n var u = ps[i]; var h = i;\n var p = ps[i + 1];\n dp[p][h + 1] *= (dp[u][h] + 1) / 2;\n }\n };\n for (int i = 0; i < q; i++)\n {\n if (sc.Integer() == 1)\n {\n var p = sc.Integer() - 1;\n par[ptr] = p;\n recalc(ptr);\n ptr++;\n\n }\n else\n {\n var v = sc.Integer() - 1;\n var ans = 0.0;\n for (int h = 1; h < 40; h++)\n ans += 1 - dp[v][h];\n Debug.WriteLine(dp[v].AsJoinedString());\n IO.Printer.Out.WriteLine(ans);\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 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\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "100db1fc53409d94bfd267ec0a7e8059", "src_uid": "55affe752cb214d1e4031a9e3972597b", "difficulty": 2700.0} {"lang": "MS C#", "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 Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var q = sc.Integer();\n var par = new int[500000];\n par[0] = -1;\n var dp = Enumerate(500000, x => new double[35]);\n for (int i = 1; i < 35; i++)\n dp[0][i] = 1.0;\n\n var ptr = 1;\n Action recalc = null;\n recalc = v =>\n {\n for (int h = 1; h < 35; h++)\n dp[v][h] = 1.0;\n var ps = new List();\n for (int h = 0; h <= 35; h++)\n {\n if (v == -1) break;\n ps.Add(v);\n v = par[v];\n }\n for (int i = ps.Count - 2; i > 0; i--)\n {\n var u = ps[i]; var h = i;\n var p = ps[i + 1];\n dp[p][h + 1] /= (dp[u][h] + 1) / 2;\n }\n for (int i = 0; i + 1 < ps.Count; i++)\n {\n var u = ps[i]; var h = i;\n var p = ps[i + 1];\n dp[p][h + 1] *= (dp[u][h] + 1) / 2;\n }\n };\n for (int i = 0; i < q; i++)\n {\n if (sc.Integer() == 1)\n {\n var p = sc.Integer() - 1;\n par[ptr] = p;\n recalc(ptr);\n ptr++;\n\n }\n else\n {\n var v = sc.Integer() - 1;\n var ans = 0.0;\n for (int h = 1; h < 35; h++)\n ans += 1 - dp[v][h];\n Debug.WriteLine(dp[v].AsJoinedString());\n IO.Printer.Out.WriteLine(ans);\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 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\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b0b750cd476dbb108986f0289c833f01", "src_uid": "55affe752cb214d1e4031a9e3972597b", "difficulty": 2700.0} {"lang": "MS C#", "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 Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var q = sc.Integer();\n var par = new int[500002];\n par[0] = -1;\n var dp = Enumerate(500002, x => new double[35]);\n for (int i = 1; i < 35; i++)\n dp[0][i] = 1.0;\n\n var ptr = 1;\n Action recalc = null;\n recalc = v =>\n {\n for (int h = 1; h < 35; h++)\n dp[v][h] = 1.0;\n var ps = new List();\n for (int h = 0; h <= 35; h++)\n {\n if (v == -1) break;\n ps.Add(v);\n v = par[v];\n }\n for (int i = ps.Count - 2; i > 0; i--)\n {\n var u = ps[i]; var h = i;\n var p = ps[i + 1];\n dp[p][h + 1] /= (dp[u][h] + 1) / 2;\n }\n for (int i = 0; i + 1 < ps.Count; i++)\n {\n var u = ps[i]; var h = i;\n var p = ps[i + 1];\n dp[p][h + 1] *= (dp[u][h] + 1) / 2;\n }\n };\n for (int i = 0; i < q; i++)\n {\n if (sc.Integer() == 1)\n {\n var p = sc.Integer() - 1;\n par[ptr] = p;\n recalc(ptr);\n ptr++;\n\n }\n else\n {\n var v = sc.Integer() - 1;\n var ans = 0.0;\n for (int h = 1; h < 35; h++)\n ans += 1 - dp[v][h];\n Debug.WriteLine(dp[v].AsJoinedString());\n IO.Printer.Out.WriteLine(ans);\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 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\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "66b56046825d4ac37e88b18df8745b54", "src_uid": "55affe752cb214d1e4031a9e3972597b", "difficulty": 2700.0} {"lang": "MS C#", "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 Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var q = sc.Integer();\n var par = new int[500000];\n par[0] = -1;\n var dp = Enumerate(500000, x => new double[35]);\n for (int i = 1; i < 35; i++)\n dp[0][i] = 1.0;\n\n var ptr = 1;\n Action recalc = null;\n recalc = v =>\n {\n for (int h = 1; h < 35; h++)\n dp[v][h] = 1.0;\n var ps = new List();\n for (int h = 0; h <= 35; h++)\n {\n if (v == -1) break;\n ps.Add(v);\n v = par[v];\n }\n for (int i = ps.Count - 2; i > 0; i--)\n {\n var u = ps[i]; var h = i;\n var p = ps[i + 1];\n dp[p][h + 1] /= (dp[u][h] + 1) / 2;\n }\n for (int i = 0; i + 1 < ps.Count; i++)\n {\n var u = ps[i]; var h = i;\n var p = ps[i + 1];\n dp[p][h + 1] *= (dp[u][h] + 1) / 2;\n }\n };\n for (int i = 0; i < q; i++)\n {\n if (sc.Integer() == 1)\n {\n var p = sc.Integer() - 1;\n par[ptr] = p;\n recalc(ptr);\n ptr++;\n\n }\n else\n {\n var v = sc.Integer() - 1;\n var ans = 0.0;\n for (int h = 1; h < 35; h++)\n ans += dp[v][h] - dp[v][h - 1];\n Debug.WriteLine(dp[v].AsJoinedString());\n IO.Printer.Out.WriteLine(ans);\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 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\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "81d135db84956892a0dfb55d89ac16a0", "src_uid": "55affe752cb214d1e4031a9e3972597b", "difficulty": 2700.0} {"lang": "Mono C#", "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 int[] row = new int[M];\n if (i == 0)\n {\n row[0] = G0;\n }\n else\n {\n row[0] = (int) (((long) st[i - 1][M - 1] * X + Y) % Z);\n }\n\n for (int j = 1; j < M; j++)\n {\n row[j] = (int) (((long) row[j - 1] * X + Y) % Z);\n }\n\n st[i] = new SegmentTree(row);\n }\n\n long ans = 0;\n for (int j = 0; j + B <= M; j++)\n {\n var col = new int[N];\n for (int i = 0; i < N; i++)\n {\n col[i] = st[i].Query(j, j + B);\n }\n\n var st2 = new SegmentTree(col);\n for (int i = 0; i + A <= N; i++)\n {\n ans += st2.Query(i, i + A);\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 const int N = 4096;\n private int[] _array;\n\n private const int _identity = int.MaxValue;\n\n public SegmentTree(int[] a)\n {\n _array = new int[N * 2];\n for (int i = 0; i < a.Length; i++)\n {\n _array[i + N] = a[i];\n }\n\n for (int i = a.Length; i < N; i++)\n {\n _array[i + N] = _identity;\n }\n\n for (int i = N - 1; i >= 1; i--)\n {\n _array[i] = Math.Min(_array[i * 2], _array[i * 2 + 1]);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c0eacad6b19b5fc5b7f0962a88bb27e2", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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\tLinkedList lst = new LinkedList();\n\t\tpublic void Push(int x)\n\t\t{\n\t\t\twhile (lst.Count() > 0 && lst.Last() > x) lst.RemoveLast();\n\t\t\tlst.AddLast(x);\n\t\t}\n\t\tpublic void Pop(int x)\n\t\t{\n\t\t\tif (lst.Count() > 0 && lst.First() == x) lst.RemoveFirst();\n\t\t}\n\t\tpublic int Top()\n\t\t{\n\t\t\treturn lst.First();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4e2887c97e3721554de15bd08c9eaab5", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": "Mono C#", "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 H = new long[N * M];\n H[0] = G0;\n for (int i = 1; i < N * M; i++)\n {\n H[i] = (H[i - 1] * X + Y) % Z;\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 st[i][j] = (int) H[Conv(i, j)];\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2ee3dee8cb84682ac895b98a72a7fc50", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": "Mono C#", "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 long[] H = new long[N * M];\n H[0] = G0;\n for (int i = 1; i < N * M; i++)\n {\n H[i] = (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 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<(long num, long min)> stack;\n\n public MinimumStack()\n {\n stack = new Stack<(long num, long min)>();\n }\n\n public void Push(long 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 long Peek()\n {\n return stack.Peek().num;\n }\n\n public long Pop()\n {\n return stack.Pop().num;\n }\n\n public long Min()\n {\n return Count == 0 ? long.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(long 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 long Peek()\n {\n Exec();\n return s1.Peek();\n }\n\n public long Dequeue()\n {\n Exec();\n return s1.Pop();\n }\n\n public long 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e01bc79b9de1b3ae6afbb92a6e7faee5", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": "Mono C#", "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 H = new long[N * M];\n H[0] = G0;\n for (int i = 1; i < N * M; i++)\n {\n H[i] = (H[i - 1] * X + Y) % Z;\n }\n\n var st = new SegmentTree[N];\n for (int i = 0; i < N; i++)\n {\n st[i] = new SegmentTree(M, Math.Min, long.MaxValue);\n for (int j = 0; j < M; j++)\n {\n st[i][j] = H[Conv(i, j)];\n }\n }\n\n long ans = 0;\n for (int j = 0; j + B <= M; j++)\n {\n var st2 = new SegmentTree(A, Math.Min, long.MaxValue);\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 T[] _array;\n\n private T _identity;\n private Func _operation;\n\n public SegmentTree(int size, Func operation, T identity)\n {\n N = 1;\n while (N < size) N *= 2;\n _identity = identity;\n _operation = operation;\n _array = new T[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, T n)\n {\n i += N;\n _array[i] = n;\n while (i > 1)\n {\n i /= 2;\n _array[i] = _operation(_array[i * 2], _array[i * 2 + 1]);\n }\n }\n\n private T 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 _operation(Query(left, right, k * 2, l, (l + r) / 2),\n Query(left, right, k * 2 + 1, (l + r) / 2, r));\n }\n\n public T 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 T Query(int left, int right)\n {\n return Query(left, right, 1, 0, N);\n }\n\n public T 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0aa84f9803ff7f4b3b63d8c72cfdd0a6", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.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\n long[] g = new long[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] = (g[i - 1] * X + Y) % Z;\n }\n\n long[][] t = new long[N][];\n for (int i = 0; i < N; i++)\n {\n t[i] = new long[M];\n for (int j = 0; j < M; j++)\n {\n t[i][j] = g[i * M + j];\n }\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(t[i][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(t[i][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\nnamespace CompLib.Collections.Generic\n{\n using System;\n using System.Diagnostics;\n\n public class SegmentTree\n {\n // \u898b\u304b\u3051\u4e0a\u306e\u5927\u304d\u3055\u3001\u5b9f\u969b\u306e\u5927\u304d\u3055\n private readonly int _n, _size;\n private T[] _array;\n\n private T _identity;\n private Func _operation;\n\n public SegmentTree(int n, Func operation, T identity)\n {\n _n = n;\n _size = 1;\n while (_size < _n)\n {\n _size *= 2;\n }\n\n _identity = identity;\n _operation = operation;\n _array = new T[_size * 2];\n for (int i = 1; i < _size * 2; i++)\n {\n _array[i] = _identity;\n }\n }\n\n public SegmentTree(T[] a, Func operation, T identity)\n {\n _n = a.Length;\n _size = 1;\n while (_size < _n)\n {\n _size *= 2;\n }\n\n _identity = identity;\n _operation = operation;\n _array = new T[_size * 2];\n for (int i = 0; i < a.Length; i++)\n {\n _array[i + _size] = a[i];\n }\n\n for (int i = a.Length; i < _size; i++)\n {\n _array[i + _size] = identity;\n }\n\n for (int i = _size - 1; i >= 1; i--)\n {\n _array[i] = operation(_array[i * 2], _array[i * 2 + 1]);\n }\n }\n\n /// \n /// A[i]\u3092n\u306b\u66f4\u65b0 O(log N)\n /// \n /// \n /// \n public void Update(int i, T n)\n {\n Debug.Assert(0 <= i && i < _n);\n i += _size;\n _array[i] = n;\n while (i > 1)\n {\n i /= 2;\n _array[i] = _operation(_array[i * 2], _array[i * 2 + 1]);\n }\n }\n\n /// \n /// A[left] op A[left+1] ... op A[right-1]\u3092\u6c42\u3081\u308b\n /// \n /// \n /// \n /// \n public T Query(int left, int right)\n {\n Debug.Assert(0 <= left && left <= right && right <= _n);\n T sml = _identity;\n T smr = _identity;\n\n left += _size;\n right += _size;\n while (left < right)\n {\n if ((left & 1) != 0) sml = _operation(sml, _array[left++]);\n if ((right & 1) != 0) smr = _operation(_array[--right], smr);\n left >>= 1;\n right >>= 1;\n }\n\n return _operation(sml, smr);\n }\n\n /// \n /// op(a[0],a[1],...,a[n-1])\u3092\u8fd4\u3057\u307e\u3059\n /// \n /// \n public T All()\n {\n return _array[1];\n }\n\n /// \n /// f(op(a[l],a[l+1],...a[r-1])) = true\u3068\u306a\u308b\u6700\u5927\u306er\u3092\u8fd4\u3057\u307e\u3059\n /// \n /// \n /// \n /// \n public int MaxRight(int l, Func f)\n {\n Debug.Assert(0 <= l && l <= _n);\n#if DEBUG\n Debug.Assert(f(_identity));\n#endif\n if (l == _n) return _n;\n l += _size;\n T sm = _identity;\n do\n {\n while (l % 2 == 0) l >>= 1;\n if (!f(_operation(sm, _array[l])))\n {\n while (l < _size)\n {\n l <<= 1;\n if (f(_operation(sm, _array[l])))\n {\n sm = _operation(sm, _array[l]);\n l++;\n }\n }\n\n return l - _size;\n }\n\n sm = _operation(sm, _array[l]);\n l++;\n } while ((l & -l) != l);\n\n return _n;\n }\n\n /// \n /// f(op(a[l],a[l+1],...a[r-1])) = true\u3068\u306a\u308b\u6700\u5c0f\u306el\u3092\u8fd4\u3057\u307e\u3059\n /// \n /// \n /// \n /// \n public int MinLeft(int r, Func f)\n {\n Debug.Assert(0 <= r && r <= _n);\n#if DEBUG\n Debug.Assert(f(_identity));\n#endif\n if (r == 0) return 0;\n r += _size;\n T sm = _identity;\n\n do\n {\n r--;\n while (r > 1 && (r % 2 != 0)) r >>= 1;\n if (!f(_operation(_array[r], sm)))\n {\n while (r < _size)\n {\n r = (2 * r + 1);\n if (f(_operation(_array[r], sm)))\n {\n sm = _operation(_array[r], sm);\n r--;\n }\n }\n\n return r + 1 - _size;\n }\n\n sm = _operation(_array[r], sm);\n } while ((r & -r) != r);\n\n return 0;\n }\n\n public T this[int i]\n {\n set { Update(i, value); }\n get\n {\n Debug.Assert(0 <= i && i < _n);\n return _array[i + _size];\n }\n }\n }\n}\n\nclass MinStack\n{\n private Stack<(long val, long min)> S;\n\n public MinStack()\n {\n S = new Stack<(long val, long min)>();\n }\n\n public long GetMin()\n {\n if (S.Count == 0) return long.MaxValue;\n return S.Peek().min;\n }\n\n public void Push(long val)\n {\n S.Push((val, Math.Min(val, GetMin())));\n }\n\n public long 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(long 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 long 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e87674c7940118a2bff9d26abfbd7b4", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7e3bc7c493a95f6031889850be8fb6ed", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": ".NET Core C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9af315ec4e4ce4faeb91c4c45abb9569", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3f20b52e7a08b3d4cf222deada7b22b1", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n private long N, K, A, B;\n private long Min, Max;\n\n public void Solve()\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 * n*k\u90fd\u5e02 1\u3054\u3068\u306b\u5186\u5468\u4e0a\n *\n * n\u8ed2 k\u3054\u3068\u306b\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\n *\n * s\u304b\u3089lkm\u3054\u3068\u306e\u90fd\u5e02\u306bs\u306b\u623b\u308b\u307e\u3067\u884c\u304f\n *\n * s\u304b\u3089\u6700\u5bc4\u308a\u306e\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\u307e\u3067a\n * s+l\u304b\u3089b\n *\n * \u901a\u3063\u305f\u90fd\u5e02\u306e\u6700\u5927\u3001\u6700\u5c0f\n */\n Min = int.MaxValue;\n Max = int.MinValue;\n F((A + B) % K);\n F((A - B) % K);\n F((-A + B) % K);\n F((-A - B) % K);\n /*\n * a,b\u3082\u53f3\n * s % k = a\n * (s + l) % k = b\n *\n * (b - a)%k = l % k\n *\n * \n */\n\n Console.WriteLine($\"{Min} {Max}\");\n }\n\n void F(long l)\n {\n while (l <= 0) l += K;\n for (int i = 0; i < 500000; i++)\n {\n // Console.WriteLine(l);\n var gcd = MathEx.GCD(N * K, l);\n Min = Math.Min(Min, N * K / gcd);\n Max = Math.Max(Max, N * K / gcd);\n l += K;\n }\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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n using System;\n using System.Collections.Generic;\n\n #region GCD LCM\n\n /// \n /// \u69d8\u3005\u306a\u6570\u5b66\u7684\u95a2\u6570\u306e\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\uff0e\n /// \n public static partial class MathEx\n {\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static int GCD(int n, int m)\n {\n return (int) GCD((long) n, m);\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long GCD(long n, long m)\n {\n n = Math.Abs(n);\n m = Math.Abs(m);\n while (n != 0)\n {\n m %= n;\n if (m == 0) return n;\n n %= m;\n }\n\n return m;\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long LCM(long n, long m)\n {\n return (n / GCD(n, m)) * m;\n }\n }\n\n #endregion\n\n #region PrimeSieve\n\n public static partial class MathEx\n {\n /// \n /// \u3042\u308b\u5024\u307e\u3067\u306b\u7d20\u6570\u8868\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u6700\u5927\u306e\u5024\n /// \u7d20\u6570\u306e\u307f\u3092\u5165\u308c\u305f\u6570\u5217\u304c\u8fd4\u3055\u308c\u308b\n /// 0 \u304b\u3089 max \u307e\u3067\u306e\u7d20\u6570\u8868\n /// \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u306b\u57fa\u3065\u304d\uff0c\u6700\u60aa\u8a08\u7b97\u91cf O(N loglog N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static bool[] Sieve(int max, List primes = null)\n {\n var isPrime = new bool[max + 1];\n for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;\n for (int i = 2; i * i <= max; i++)\n if (!isPrime[i]) continue;\n else\n for (int j = i * i; j <= max; j += i)\n isPrime[j] = false;\n if (primes != null)\n for (int i = 0; i <= max; i++)\n if (isPrime[i])\n primes.Add(i);\n\n return isPrime;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "39efc1242e62e56065438f1750f2e787", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "Mono C#", "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 K = long.Parse(str[1]);\n\t\tstring[] str2 = Console.ReadLine().Split();\n\t\tlong A = long.Parse(str2[0]);\n\t\tlong B = long.Parse(str2[1]);\n\t\tlong min = 999999999;\n\t\tlong max = 0;\n\t\tfor(var i=0;i;\n\nclass Solver\n{\n Scanner sc = new Scanner();\n //\n\n public void Solve()\n {\n long n, k, a, b;\n sc.Make(out n, out k, out a, out b);\n long min = long.MaxValue, max = long.MinValue;\n for(var i = 0; i <= n; i++)\n {\n long l = i * k + b, r = i * k + k - b;\n if (l == a) goto S;\n var p = LCM(n * k, Abs(l - a)) / Abs(l - a);\n chmin(ref min, p);chmax(ref max, p);\n S:;\n if (r == a) continue;\n var q = LCM(n * k, Abs(r - a)) / Abs(r - a);\n chmax(ref max, q);chmin(ref min, q);\n }\n WriteLine($\"{min} {max}\");\n }\n #region GCD\n public static int LCM(int num1, int num2)\n => num1 / GCD(num1, num2) * num2;\n\n public static long LCM(long num1, long num2)\n => num1 / GCD(num1, num2) * num2;\n\n public static int GCD(int num1, int num2)\n => num1 < num2 ? GCD(num2, num1) :\n num2 > 0 ? GCD(num2, num1 % num2) : num1;\n\n public static long GCD(long num1, long num2)\n => num1 < num2 ? GCD(num2, num1) :\n num2 > 0 ? GCD(num2, num1 % num2) : num1;\n #endregion\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()\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "30147cd2f82bd6c6d561be45f96ff74c", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n private long N, K, A, B;\n private long Min, Max;\n\n public void Solve()\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 * n*k\u90fd\u5e02 1\u3054\u3068\u306b\u5186\u5468\u4e0a\n *\n * n\u8ed2 k\u3054\u3068\u306b\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\n *\n * s\u304b\u3089lkm\u3054\u3068\u306e\u90fd\u5e02\u306bs\u306b\u623b\u308b\u307e\u3067\u884c\u304f\n *\n * s\u304b\u3089\u6700\u5bc4\u308a\u306e\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\u307e\u3067a\n * s+l\u304b\u3089b\n *\n * \u901a\u3063\u305f\u90fd\u5e02\u306e\u6700\u5927\u3001\u6700\u5c0f\n */\n Min = int.MaxValue;\n Max = int.MinValue;\n F((A + B) % K);\n F((A - B) % K);\n F((B - A) % K);\n F((-A - B) % K);\n /*\n * a,b\u3082\u53f3\n * s % k = a\n * (s + l) % k = b\n *\n * (b - a)%k = l % k\n *\n * \n */\n\n Console.WriteLine($\"{Min} {Max}\");\n }\n\n void F(long l)\n {\n var hs = new HashSet();\n while (l <= 0) l += K;\n while (true)\n {\n // Console.WriteLine(l);\n var gcd = MathEx.GCD(N * K, l);\n if (!hs.Add(gcd)) break;\n Min = Math.Min(Min, N * K / gcd);\n Max = Math.Max(Max, N * K / gcd);\n l += K;\n }\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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n using System;\n using System.Collections.Generic;\n\n #region GCD LCM\n\n /// \n /// \u69d8\u3005\u306a\u6570\u5b66\u7684\u95a2\u6570\u306e\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\uff0e\n /// \n public static partial class MathEx\n {\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static int GCD(int n, int m)\n {\n return (int) GCD((long) n, m);\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long GCD(long n, long m)\n {\n n = Math.Abs(n);\n m = Math.Abs(m);\n while (n != 0)\n {\n m %= n;\n if (m == 0) return n;\n n %= m;\n }\n\n return m;\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long LCM(long n, long m)\n {\n return (n / GCD(n, m)) * m;\n }\n }\n\n #endregion\n\n #region PrimeSieve\n\n public static partial class MathEx\n {\n /// \n /// \u3042\u308b\u5024\u307e\u3067\u306b\u7d20\u6570\u8868\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u6700\u5927\u306e\u5024\n /// \u7d20\u6570\u306e\u307f\u3092\u5165\u308c\u305f\u6570\u5217\u304c\u8fd4\u3055\u308c\u308b\n /// 0 \u304b\u3089 max \u307e\u3067\u306e\u7d20\u6570\u8868\n /// \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u306b\u57fa\u3065\u304d\uff0c\u6700\u60aa\u8a08\u7b97\u91cf O(N loglog N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static bool[] Sieve(int max, List primes = null)\n {\n var isPrime = new bool[max + 1];\n for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;\n for (int i = 2; i * i <= max; i++)\n if (!isPrime[i]) continue;\n else\n for (int j = i * i; j <= max; j += i)\n isPrime[j] = false;\n if (primes != null)\n for (int i = 0; i <= max; i++)\n if (isPrime[i])\n primes.Add(i);\n\n return isPrime;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f27539e3ac9b740936bab09f5bd6b5dc", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n private long N, K, A, B;\n private long Min, Max;\n\n public void Solve()\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 * n*k\u90fd\u5e02 1\u3054\u3068\u306b\u5186\u5468\u4e0a\n *\n * n\u8ed2 k\u3054\u3068\u306b\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\n *\n * s\u304b\u3089lkm\u3054\u3068\u306e\u90fd\u5e02\u306bs\u306b\u623b\u308b\u307e\u3067\u884c\u304f\n *\n * s\u304b\u3089\u6700\u5bc4\u308a\u306e\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\u307e\u3067a\n * s+l\u304b\u3089b\n *\n * \u901a\u3063\u305f\u90fd\u5e02\u306e\u6700\u5927\u3001\u6700\u5c0f\n */\n Min = int.MaxValue;\n Max = int.MinValue;\n F((A + B) % K);\n F((A - B) % K);\n F((B - A) % K);\n F((-A - B) % K);\n /*\n * a,b\u3082\u53f3\n * s % k = a\n * (s + l) % k = b\n *\n * (b - a)%k = l % k\n *\n * \n */\n\n Console.WriteLine($\"{Min} {Max}\");\n }\n\n void F(long l)\n {\n if (l <= 0) l += K;\n\n for (int i = 0; i < N; i++)\n {\n // Console.WriteLine(l);\n var gcd = MathEx.GCD(N * K, l);\n Min = Math.Min(Min, N * K / gcd);\n Max = Math.Max(Max, N * K / gcd);\n l += K;\n }\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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n using System;\n using System.Collections.Generic;\n\n #region GCD LCM\n\n /// \n /// \u69d8\u3005\u306a\u6570\u5b66\u7684\u95a2\u6570\u306e\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\uff0e\n /// \n public static partial class MathEx\n {\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static int GCD(int n, int m)\n {\n return (int) GCD((long) n, m);\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long GCD(long n, long m)\n {\n n = Math.Abs(n);\n m = Math.Abs(m);\n while (n != 0)\n {\n m %= n;\n if (m == 0) return n;\n n %= m;\n }\n\n return m;\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long LCM(long n, long m)\n {\n return (n / GCD(n, m)) * m;\n }\n }\n\n #endregion\n\n #region PrimeSieve\n\n public static partial class MathEx\n {\n /// \n /// \u3042\u308b\u5024\u307e\u3067\u306b\u7d20\u6570\u8868\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u6700\u5927\u306e\u5024\n /// \u7d20\u6570\u306e\u307f\u3092\u5165\u308c\u305f\u6570\u5217\u304c\u8fd4\u3055\u308c\u308b\n /// 0 \u304b\u3089 max \u307e\u3067\u306e\u7d20\u6570\u8868\n /// \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u306b\u57fa\u3065\u304d\uff0c\u6700\u60aa\u8a08\u7b97\u91cf O(N loglog N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static bool[] Sieve(int max, List primes = null)\n {\n var isPrime = new bool[max + 1];\n for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;\n for (int i = 2; i * i <= max; i++)\n if (!isPrime[i]) continue;\n else\n for (int j = i * i; j <= max; j += i)\n isPrime[j] = false;\n if (primes != null)\n for (int i = 0; i <= max; i++)\n if (isPrime[i])\n primes.Add(i);\n\n return isPrime;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "62a843de9fbe9dba9c422bbc1457dd3e", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n private long N, K, A, B;\n private long Min, Max;\n\n public void Solve()\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 * n*k\u90fd\u5e02 1\u3054\u3068\u306b\u5186\u5468\u4e0a\n *\n * n\u8ed2 k\u3054\u3068\u306b\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\n *\n * s\u304b\u3089lkm\u3054\u3068\u306e\u90fd\u5e02\u306bs\u306b\u623b\u308b\u307e\u3067\u884c\u304f\n *\n * s\u304b\u3089\u6700\u5bc4\u308a\u306e\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\u307e\u3067a\n * s+l\u304b\u3089b\n *\n * \u901a\u3063\u305f\u90fd\u5e02\u306e\u6700\u5927\u3001\u6700\u5c0f\n */\n Min = int.MaxValue;\n Max = int.MinValue;\n F((A + B) % K);\n F((A - B) % K);\n F((B - A) % K);\n F((-A - B) % K);\n /*\n * a,b\u3082\u53f3\n * s % k = a\n * (s + l) % k = b\n *\n * (b - a)%k = l % k\n *\n * \n */\n\n Console.WriteLine($\"{Min} {Max}\");\n }\n\n void F(long l)\n {\n while (l <= 0) l += K;\n for (int i = 0; i < 2 * N; i++)\n {\n // Console.WriteLine(l);\n var gcd = MathEx.GCD(N * K, l);\n Min = Math.Min(Min, N * K / gcd);\n Max = Math.Max(Max, N * K / gcd);\n l += K;\n }\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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n using System;\n using System.Collections.Generic;\n\n #region GCD LCM\n\n /// \n /// \u69d8\u3005\u306a\u6570\u5b66\u7684\u95a2\u6570\u306e\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\uff0e\n /// \n public static partial class MathEx\n {\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static int GCD(int n, int m)\n {\n return (int) GCD((long) n, m);\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long GCD(long n, long m)\n {\n n = Math.Abs(n);\n m = Math.Abs(m);\n while (n != 0)\n {\n m %= n;\n if (m == 0) return n;\n n %= m;\n }\n\n return m;\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long LCM(long n, long m)\n {\n return (n / GCD(n, m)) * m;\n }\n }\n\n #endregion\n\n #region PrimeSieve\n\n public static partial class MathEx\n {\n /// \n /// \u3042\u308b\u5024\u307e\u3067\u306b\u7d20\u6570\u8868\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u6700\u5927\u306e\u5024\n /// \u7d20\u6570\u306e\u307f\u3092\u5165\u308c\u305f\u6570\u5217\u304c\u8fd4\u3055\u308c\u308b\n /// 0 \u304b\u3089 max \u307e\u3067\u306e\u7d20\u6570\u8868\n /// \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u306b\u57fa\u3065\u304d\uff0c\u6700\u60aa\u8a08\u7b97\u91cf O(N loglog N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static bool[] Sieve(int max, List primes = null)\n {\n var isPrime = new bool[max + 1];\n for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;\n for (int i = 2; i * i <= max; i++)\n if (!isPrime[i]) continue;\n else\n for (int j = i * i; j <= max; j += i)\n isPrime[j] = false;\n if (primes != null)\n for (int i = 0; i <= max; i++)\n if (isPrime[i])\n primes.Add(i);\n\n return isPrime;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1b7db23c69290815dd8c35f19a01fd2c", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n private long N, K, A, B;\n private long Min, Max;\n\n public void Solve()\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 * n*k\u90fd\u5e02 1\u3054\u3068\u306b\u5186\u5468\u4e0a\n *\n * n\u8ed2 k\u3054\u3068\u306b\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\n *\n * s\u304b\u3089lkm\u3054\u3068\u306e\u90fd\u5e02\u306bs\u306b\u623b\u308b\u307e\u3067\u884c\u304f\n *\n * s\u304b\u3089\u6700\u5bc4\u308a\u306e\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\u307e\u3067a\n * s+l\u304b\u3089b\n *\n * \u901a\u3063\u305f\u90fd\u5e02\u306e\u6700\u5927\u3001\u6700\u5c0f\n */\n Min = int.MaxValue;\n Max = int.MinValue;\n F((A + B) % K);\n F((A - B) % K);\n F((-A + B) % K);\n F((-A - B) % K);\n /*\n * a,b\u3082\u53f3\n * s % k = a\n * (s + l) % k = b\n *\n * (b - a)%k = l % k\n *\n * \n */\n\n Console.WriteLine($\"{Min} {Max}\");\n }\n\n void F(long l)\n {\n while (l <= 0) l += K;\n for (int i = 0; i <= N; i++)\n {\n if (l != 0)\n {\n // Console.WriteLine(l);\n var gcd = MathEx.GCD(N * K, l);\n Min = Math.Min(Min, N * K / gcd);\n Max = Math.Max(Max, N * K / gcd);\n }\n\n l += K;\n l %= N * K;\n }\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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n using System;\n using System.Collections.Generic;\n\n #region GCD LCM\n\n /// \n /// \u69d8\u3005\u306a\u6570\u5b66\u7684\u95a2\u6570\u306e\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\uff0e\n /// \n public static partial class MathEx\n {\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static int GCD(int n, int m)\n {\n return (int) GCD((long) n, m);\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long GCD(long n, long m)\n {\n n = Math.Abs(n);\n m = Math.Abs(m);\n while (n != 0)\n {\n m %= n;\n if (m == 0) return n;\n n %= m;\n }\n\n return m;\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long LCM(long n, long m)\n {\n return (n / GCD(n, m)) * m;\n }\n }\n\n #endregion\n\n #region PrimeSieve\n\n public static partial class MathEx\n {\n /// \n /// \u3042\u308b\u5024\u307e\u3067\u306b\u7d20\u6570\u8868\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u6700\u5927\u306e\u5024\n /// \u7d20\u6570\u306e\u307f\u3092\u5165\u308c\u305f\u6570\u5217\u304c\u8fd4\u3055\u308c\u308b\n /// 0 \u304b\u3089 max \u307e\u3067\u306e\u7d20\u6570\u8868\n /// \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u306b\u57fa\u3065\u304d\uff0c\u6700\u60aa\u8a08\u7b97\u91cf O(N loglog N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static bool[] Sieve(int max, List primes = null)\n {\n var isPrime = new bool[max + 1];\n for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;\n for (int i = 2; i * i <= max; i++)\n if (!isPrime[i]) continue;\n else\n for (int j = i * i; j <= max; j += i)\n isPrime[j] = false;\n if (primes != null)\n for (int i = 0; i <= max; i++)\n if (isPrime[i])\n primes.Add(i);\n\n return isPrime;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ff955061d1df5abd57b8e3a94bb5ae1f", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n private long N, K, A, B;\n private long Min, Max;\n\n public void Solve()\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 * n*k\u90fd\u5e02 1\u3054\u3068\u306b\u5186\u5468\u4e0a\n *\n * n\u8ed2 k\u3054\u3068\u306b\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\n *\n * s\u304b\u3089lkm\u3054\u3068\u306e\u90fd\u5e02\u306bs\u306b\u623b\u308b\u307e\u3067\u884c\u304f\n *\n * s\u304b\u3089\u6700\u5bc4\u308a\u306e\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\u307e\u3067a\n * s+l\u304b\u3089b\n *\n * \u901a\u3063\u305f\u90fd\u5e02\u306e\u6700\u5927\u3001\u6700\u5c0f\n */\n Min = int.MaxValue;\n Max = int.MinValue;\n F((A + B) % K);\n F((A - B) % K);\n F((-A + B) % K);\n F((-A - B) % K);\n /*\n * a,b\u3082\u53f3\n * s % k = a\n * (s + l) % k = b\n *\n * (b - a)%k = l % k\n *\n * \n */\n\n Console.WriteLine($\"{Min} {Max}\");\n }\n\n void F(long l)\n {\n while (l <= 0) l += K;\n for (int i = 0; i <= N; i++)\n {\n // Console.WriteLine(l);\n var gcd = MathEx.GCD(N * K, l);\n Min = Math.Min(Min, N * K / gcd);\n Max = Math.Max(Max, N * K / gcd);\n\n\n l += K;\n l %= N * K;\n }\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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n using System;\n using System.Collections.Generic;\n\n #region GCD LCM\n\n /// \n /// \u69d8\u3005\u306a\u6570\u5b66\u7684\u95a2\u6570\u306e\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\uff0e\n /// \n public static partial class MathEx\n {\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static int GCD(int n, int m)\n {\n return (int) GCD((long) n, m);\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long GCD(long n, long m)\n {\n n = Math.Abs(n);\n m = Math.Abs(m);\n while (n != 0)\n {\n m %= n;\n if (m == 0) return n;\n n %= m;\n }\n\n return m;\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long LCM(long n, long m)\n {\n return (n / GCD(n, m)) * m;\n }\n }\n\n #endregion\n\n #region PrimeSieve\n\n public static partial class MathEx\n {\n /// \n /// \u3042\u308b\u5024\u307e\u3067\u306b\u7d20\u6570\u8868\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u6700\u5927\u306e\u5024\n /// \u7d20\u6570\u306e\u307f\u3092\u5165\u308c\u305f\u6570\u5217\u304c\u8fd4\u3055\u308c\u308b\n /// 0 \u304b\u3089 max \u307e\u3067\u306e\u7d20\u6570\u8868\n /// \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u306b\u57fa\u3065\u304d\uff0c\u6700\u60aa\u8a08\u7b97\u91cf O(N loglog N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static bool[] Sieve(int max, List primes = null)\n {\n var isPrime = new bool[max + 1];\n for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;\n for (int i = 2; i * i <= max; i++)\n if (!isPrime[i]) continue;\n else\n for (int j = i * i; j <= max; j += i)\n isPrime[j] = false;\n if (primes != null)\n for (int i = 0; i <= max; i++)\n if (isPrime[i])\n primes.Add(i);\n\n return isPrime;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eafac516a9b5db705db8f74c4dc024d0", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "Mono C#", "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\nclass Solution\n{\n static void Main(string[] args)\n {\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToInt32);\n long n = arr[0];\n long k = arr[1];\n arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToInt32);\n long s1 = arr[0];\n long s2 = arr[1];\n\n long d1 = s2 -s1 ;\n d1 = d1>0?d1:d1+k;\n long d2 = k - s2 - s1;\n d2 = d2>0?d2:d2+k;\n\n long d3 = s1-s2;\n d3 = d3>0?d3:d3+k;\n long d4 = s2+s1;\n d4 = d4>0?d4:d4+k;\n\n var minGcd = long.MaxValue;\n var maxGcd = long.MinValue;\n for(int i =0; i 0)\n\t\t\t{\n\t\t\t\tvar tmp = n2;\n\t\t\t\tn2 = n1 % n2;\n\t\t\t\tn1 = tmp;\n\t\t\t}\n\t\t\treturn n2;\n\t\t}\n\t}\n\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "99c751ed74642deea4362348b2d775ff", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "/*\ncsc -debug D.cs && mono --debug D.exe <<< \"2 3\n1 1\"\n\ncsc -debug D.cs && mono --debug D.exe <<< \"100000 100000\n1 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 n = cin.NextUlong();\n var k = cin.NextUlong();\n var a = cin.NextUlong();\n var b = cin.NextUlong();\n\n var mod = n * k;\n var S = new ulong[] { a % mod, (mod - a) % mod }.Distinct().ToArray();\n\n var SL = new HashSet();\n for (var i = 0ul; i <= n-1; i++) {\n SL.Add( (i * k + b) % mod );\n SL.Add( (i * k + mod - b) % mod );\n }\n\n// System.Console.WriteLine(new {S=string.Join(\" \", S)});\n// System.Console.WriteLine(new {SL=string.Join(\" \", SL)});\n\n var min = ulong.MaxValue;\n var max = 0ul;\n foreach (var s in S)\n foreach (var sl in SL) {\n var l = (sl + mod - s) % mod;\n\n var cnt = mod / GCD(mod, l);\n\n min = Math.Min(min, cnt);\n max = Math.Max(max, cnt);\n }\n\n System.Console.WriteLine(\"{0} {1}\", min, max);\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "29f52f08fe22a2e5b9778d7d96a7b1bf", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "Mono C#", "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 n, k, a, b;\n sc.Make(out n, out k, out a, out b);\n long min = long.MaxValue, max = long.MinValue;\n for(var i = 0; i <= n; i++)\n {\n long l = i * k + b, r = i * k + k - b;\n if (l == a) goto S;\n var p = n * k / GCD(n * k, Abs(l - a));\n chmin(ref min, p);chmax(ref max, p);\n S:;\n if (r == a) continue;\n var q = n * k / GCD(n * k, Abs(r - a));\n chmax(ref max, q);chmin(ref min, q);\n }\n WriteLine($\"{min} {max}\");\n }\n #region GCD\n public static int LCM(int num1, int num2)\n => num1 / GCD(num1, num2) * num2;\n\n public static long LCM(long num1, long num2)\n => num1 / GCD(num1, num2) * num2;\n\n public static int GCD(int num1, int num2)\n => num1 < num2 ? GCD(num2, num1) :\n num2 > 0 ? GCD(num2, num1 % num2) : num1;\n\n public static long GCD(long num1, long num2)\n => num1 < num2 ? GCD(num2, num1) :\n num2 > 0 ? GCD(num2, num1 % num2) : num1;\n #endregion\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()\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3aa6e7cb94d29c28520450f844054bc5", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "Mono C#", "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 K = long.Parse(str[1]);\n\t\tstring[] str2 = Console.ReadLine().Split();\n\t\tlong A = long.Parse(str2[0]);\n\t\tlong B = long.Parse(str2[1]);\n\t\tlong min = 999999999999999;\n\t\tlong max = 0;\n\t\tfor(var i=0;i 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.Mathematics\n{\n using System;\n using System.Collections.Generic;\n\n #region GCD LCM\n\n /// \n /// \u69d8\u3005\u306a\u6570\u5b66\u7684\u95a2\u6570\u306e\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\uff0e\n /// \n public static partial class MathEx\n {\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static int GCD(int n, int m)\n {\n return (int) GCD((long) n, m);\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long GCD(long n, long m)\n {\n n = Math.Abs(n);\n m = Math.Abs(m);\n while (n != 0)\n {\n m %= n;\n if (m == 0) return n;\n n %= m;\n }\n\n return m;\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long LCM(long n, long m)\n {\n return (n / GCD(n, m)) * m;\n }\n }\n\n #endregion\n\n #region PrimeSieve\n\n public static partial class MathEx\n {\n /// \n /// \u3042\u308b\u5024\u307e\u3067\u306b\u7d20\u6570\u8868\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u6700\u5927\u306e\u5024\n /// \u7d20\u6570\u306e\u307f\u3092\u5165\u308c\u305f\u6570\u5217\u304c\u8fd4\u3055\u308c\u308b\n /// 0 \u304b\u3089 max \u307e\u3067\u306e\u7d20\u6570\u8868\n /// \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u306b\u57fa\u3065\u304d\uff0c\u6700\u60aa\u8a08\u7b97\u91cf O(N loglog N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static bool[] Sieve(int max, List primes = null)\n {\n var isPrime = new bool[max + 1];\n for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;\n for (int i = 2; i * i <= max; i++)\n if (!isPrime[i]) continue;\n else\n for (int j = i * i; j <= max; j += i)\n isPrime[j] = false;\n if (primes != null)\n for (int i = 0; i <= max; i++)\n if (isPrime[i])\n primes.Add(i);\n\n return isPrime;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "734af88001777efa04f799671243c7c8", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n private long N, K, A, B;\n private long Min, Max;\n\n public void Solve()\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 * n*k\u90fd\u5e02 1\u3054\u3068\u306b\u5186\u5468\u4e0a\n *\n * n\u8ed2 k\u3054\u3068\u306b\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\n *\n * s\u304b\u3089lkm\u3054\u3068\u306e\u90fd\u5e02\u306bs\u306b\u623b\u308b\u307e\u3067\u884c\u304f\n *\n * s\u304b\u3089\u6700\u5bc4\u308a\u306e\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\u307e\u3067a\n * s+l\u304b\u3089b\n *\n * \u901a\u3063\u305f\u90fd\u5e02\u306e\u6700\u5927\u3001\u6700\u5c0f\n */\n Min = int.MaxValue;\n Max = int.MinValue;\n F((A + B) % K);\n F((A - B) % K);\n F((-A + B) % K);\n F((-A - B) % K);\n /*\n * a,b\u3082\u53f3\n * s % k = a\n * (s + l) % k = b\n *\n * (b - a)%k = l % k\n *\n * \n */\n\n Console.WriteLine($\"{Min} {Max}\");\n }\n\n void F(long l)\n {\n while (l <= 0) l += K;\n for (int i = 0; i < 1000000; i++)\n {\n // Console.WriteLine(l);\n var gcd = MathEx.GCD(N * K, l);\n Min = Math.Min(Min, N * K / gcd);\n Max = Math.Max(Max, N * K / gcd);\n l += K;\n }\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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n using System;\n using System.Collections.Generic;\n\n #region GCD LCM\n\n /// \n /// \u69d8\u3005\u306a\u6570\u5b66\u7684\u95a2\u6570\u306e\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\uff0e\n /// \n public static partial class MathEx\n {\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static int GCD(int n, int m)\n {\n return (int) GCD((long) n, m);\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long GCD(long n, long m)\n {\n n = Math.Abs(n);\n m = Math.Abs(m);\n while (n != 0)\n {\n m %= n;\n if (m == 0) return n;\n n %= m;\n }\n\n return m;\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long LCM(long n, long m)\n {\n return (n / GCD(n, m)) * m;\n }\n }\n\n #endregion\n\n #region PrimeSieve\n\n public static partial class MathEx\n {\n /// \n /// \u3042\u308b\u5024\u307e\u3067\u306b\u7d20\u6570\u8868\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u6700\u5927\u306e\u5024\n /// \u7d20\u6570\u306e\u307f\u3092\u5165\u308c\u305f\u6570\u5217\u304c\u8fd4\u3055\u308c\u308b\n /// 0 \u304b\u3089 max \u307e\u3067\u306e\u7d20\u6570\u8868\n /// \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u306b\u57fa\u3065\u304d\uff0c\u6700\u60aa\u8a08\u7b97\u91cf O(N loglog N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static bool[] Sieve(int max, List primes = null)\n {\n var isPrime = new bool[max + 1];\n for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;\n for (int i = 2; i * i <= max; i++)\n if (!isPrime[i]) continue;\n else\n for (int j = i * i; j <= max; j += i)\n isPrime[j] = false;\n if (primes != null)\n for (int i = 0; i <= max; i++)\n if (isPrime[i])\n primes.Add(i);\n\n return isPrime;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6d28b8eb5c11460a7de341d46dd102c7", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n private long N, K, A, B;\n private long Min, Max;\n\n public void Solve()\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 * n*k\u90fd\u5e02 1\u3054\u3068\u306b\u5186\u5468\u4e0a\n *\n * n\u8ed2 k\u3054\u3068\u306b\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\n *\n * s\u304b\u3089lkm\u3054\u3068\u306e\u90fd\u5e02\u306bs\u306b\u623b\u308b\u307e\u3067\u884c\u304f\n *\n * s\u304b\u3089\u6700\u5bc4\u308a\u306e\u30d5\u30a1\u30b9\u30c8\u30d5\u30fc\u30c9\u5e97\u307e\u3067a\n * s+l\u304b\u3089b\n *\n * \u901a\u3063\u305f\u90fd\u5e02\u306e\u6700\u5927\u3001\u6700\u5c0f\n */\n Min = int.MaxValue;\n Max = int.MinValue;\n F((A + B) % K);\n F((A - B) % K);\n F((-A + B) % K);\n F((-A - B) % K);\n /*\n * a,b\u3082\u53f3\n * s % k = a\n * (s + l) % k = b\n *\n * (b - a)%k = l % k\n *\n * \n */\n\n Console.WriteLine($\"{Min} {Max}\");\n }\n\n void F(long l)\n {\n while (l <= 0) l += K;\n for (int i = 0; i < 10000000; i++)\n {\n // Console.WriteLine(l);\n var gcd = MathEx.GCD(N * K, l);\n Min = Math.Min(Min, N * K / gcd);\n Max = Math.Max(Max, N * K / gcd);\n l += K;\n }\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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n using System;\n using System.Collections.Generic;\n\n #region GCD LCM\n\n /// \n /// \u69d8\u3005\u306a\u6570\u5b66\u7684\u95a2\u6570\u306e\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\uff0e\n /// \n public static partial class MathEx\n {\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static int GCD(int n, int m)\n {\n return (int) GCD((long) n, m);\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long GCD(long n, long m)\n {\n n = Math.Abs(n);\n m = Math.Abs(m);\n while (n != 0)\n {\n m %= n;\n if (m == 0) return n;\n n %= m;\n }\n\n return m;\n }\n\n\n /// \n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\n /// \n /// \u6700\u521d\u306e\u5024\n /// 2 \u756a\u76ee\u306e\u5024\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static long LCM(long n, long m)\n {\n return (n / GCD(n, m)) * m;\n }\n }\n\n #endregion\n\n #region PrimeSieve\n\n public static partial class MathEx\n {\n /// \n /// \u3042\u308b\u5024\u307e\u3067\u306b\u7d20\u6570\u8868\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u6700\u5927\u306e\u5024\n /// \u7d20\u6570\u306e\u307f\u3092\u5165\u308c\u305f\u6570\u5217\u304c\u8fd4\u3055\u308c\u308b\n /// 0 \u304b\u3089 max \u307e\u3067\u306e\u7d20\u6570\u8868\n /// \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u306b\u57fa\u3065\u304d\uff0c\u6700\u60aa\u8a08\u7b97\u91cf O(N loglog N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static bool[] Sieve(int max, List primes = null)\n {\n var isPrime = new bool[max + 1];\n for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;\n for (int i = 2; i * i <= max; i++)\n if (!isPrime[i]) continue;\n else\n for (int j = i * i; j <= max; j += i)\n isPrime[j] = false;\n if (primes != null)\n for (int i = 0; i <= max; i++)\n if (isPrime[i])\n primes.Add(i);\n\n return isPrime;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f2e2d09d8a87ed0050da5a112faf8874", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Ravioli_Sort\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 = Next();\n\n var nn = new List(n);\n for (int i = 0; i < n; i++)\n {\n nn.Add(Next());\n }\n\n for (int i = n; i > 0; i--)\n {\n for (int j = 1; j < nn.Count; j++)\n {\n if (Math.Abs(nn[j] - nn[j - 1]) >= 2)\n return false;\n }\n\n int m = 0;\n for (int j = 1; j < nn.Count; j++)\n {\n if (nn[m] > nn[j])\n m = j;\n }\n\n nn.RemoveAt(m);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "42b28d7bb7ada9a28967c40a0d519f8a", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "Mono C#", "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 var a = ReadIntArray();\n\n for (int i = 0; i + 1 < n; i++)\n if (Math.Abs(a[i] - a[i + 1]) > 1)\n {\n Write(\"NO\");\n return;\n }\n\n Write(\"YES\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "903ab4943df697235f2b9fe57dc9c0e0", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "Mono C#", "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 i = Convert.ToInt32(Console.ReadLine());\n int[] mass = new int[i];\n string[] q = Console.ReadLine().Split(' ');\n bool flag = true;\n\n for (int j = 0; j < i; j++)\n {\n mass[j] = Convert.ToInt32(q[j]);\n }\n\n for (int j = 0; j < i - 1; j++)\n {\n if (Math.Abs(mass[j] - mass[j + 1]) > 1)\n {\n Console.WriteLine(\"NO\");\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n Console.WriteLine(\"YES\");\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2e6ebc3040ab1c2ab985817403a38a30", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\n\nnamespace ConsoleApp1\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\tvar arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\t\t\tfor (var i = 0; i < arr.Length-1; i++)\n\t\t\t{\n\t\t\t\tif (Math.Abs(arr[i] - arr[i + 1]) >= 2)\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ba4caf6ebd735751b31cf509c77e278c", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Zaddda\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int b = a[0];\n Array.Sort(a);\n if (a[0] == b)\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d953f338eee6acd22a23fb7a341e5bd7", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Zaddda\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();\n bool c = true;\n for(int i = 1; i < a; ++i)\n {\n if(b[i]-b[i-1] > 1)\n {\n c = false;\n break;\n }\n }\n if (c)\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b437c402e9a2a3076bb1b9525cb4a785", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "Mono C#", "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 i = Convert.ToInt32(Console.ReadLine());\n int[] mass = new int[i];\n bool flag = true;\n\n for (int j = 0; j < i - 1; j++)\n {\n if (Math.Abs(mass[j] - mass[j + 1]) > 1)\n {\n Console.WriteLine(\"NO\");\n flag = false;\n }\n }\n\n if (flag)\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c59bda426b507a47eb92d7a7c1a7a203", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "Mono C#", "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 i = Convert.ToInt32(Console.ReadLine());\n int[] mass = new int[i];\n string[] q = Console.ReadLine().Split(' ');\n bool flag = true;\n\n for (int j = 0; j < i; j++)\n {\n mass[j] = Convert.ToInt32(q[j]);\n }\n\n for (int j = 0; j < i - 1; j++)\n {\n if (Math.Abs(mass[j] - mass[j + 1]) > 1)\n {\n Console.WriteLine(\"NO\");\n flag = false;\n }\n }\n\n if (flag)\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7919d338a88fbc14d89015beb3582c32", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Zaddda\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();\n bool c = true;\n for(int i = 1; i < a; ++i)\n {\n if(b[i]-b[i-1] != 1)\n {\n c = false;\n break;\n }\n }\n if (c)\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fea43dc4029b0f33b096cfdaac716607", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n long n = ReadLong() - 1;\n\n long ans = 0;\n for (int i = 0; i < 60; i++)\n {\n long a = (1L << i);\n long b = (1L << (i + 1));\n ans += a * ((n + b - a) / b);\n }\n\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 Writer.Flush();\n Console.WriteLine($\"Task {i + 1} completed\");\n }\n\n sw.Stop();\n Console.WriteLine(sw.ElapsedMilliseconds);*/\n }\n\n public class Point\n {\n public Point(int x, int y)\n {\n X = x;\n Y = y;\n }\n\n public int X;\n\n public int Y;\n\n public double Length => Math.Sqrt(X * X + Y * Y);\n\n protected bool Equals(Point other)\n {\n return X == other.X && Y == other.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() != this.GetType())\n {\n return false;\n }*/\n return Equals((Point) obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (X * 397) ^ Y;\n }\n }\n\n public int Dist2(Point p)\n {\n return (p.X - X) * (p.X - X) + (p.Y - Y) * (p.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 override string ToString()\n {\n return $\"{nameof(X)}: {X}, {nameof(Y)}: {Y}\";\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 + 1).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 public static CompressionResult Compress(IEnumerable values)\n {\n int d = 0;\n var dictionary = new Dictionary();\n foreach (T value in values.OrderByWithShuffle(x => x))\n {\n if (!dictionary.ContainsKey(value))\n {\n // todo: increase before or after?\n d++;\n dictionary[value] = d;\n }\n }\n return new CompressionResult(dictionary, d);\n }\n\n public class CompressionResult\n {\n public CompressionResult(Dictionary dictionary, int maxValue)\n {\n Dictionary = dictionary;\n MaxValue = maxValue;\n }\n\n public Dictionary Dictionary { get; }\n\n public int MaxValue { get; }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c81811f2aff7ee023c84011a71d06b01", "src_uid": "a98f0d924ea52cafe0048f213f075891", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace E\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 < 3; testN++)\n {\n#endif\n var n = NextLong();\n var a = new long[64];\n var i2s = new long[64];\n a[0] = 0;\n a[1] = 1;\n a[2] = 4;\n i2s[0] = 1;\n i2s[1] = 2;\n i2s[2] = 4;\n long i2 = 4;\n for (int i = 3; i < 64; i++)\n {\n a[i] = a[i - 1] * 2 - i2;\n i2 *= 2;\n i2s[i] = i2;\n a[i] += i2;\n }\n long res = 0;\n int x = 0;\n n--;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res += a[x] + i2s[x];\n }\n n >>= 1;\n x++;\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "39d78347acee2759b59d29d1af573aba", "src_uid": "a98f0d924ea52cafe0048f213f075891", "difficulty": 1900.0} {"lang": "MS C#", "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 ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "59647d4ec93501054083ea68c371e79a", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ff2f2871211d4740157464bda1d7746d", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e474ef63037b8c029478c642bd7b3e89", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f0e4addf554003bb55ae8e69d5223358", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1f0625ed201cac6a22e121ba993d1174", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "64664a66e84841966641aeb5e14ebe37", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5afae4410f3a6c5e7088fab54272106a", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "28001710a17705daa733407b2b09b163", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9f601d5fc84d94be47f45f1a90acf987", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a95b7a80593a4ccc4651d15f3121a5e4", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ead156a4f45e351d3400ff8d3df6c1ed", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "Mono C#", "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>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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "94466cda1a69c82fd469604ee51414da", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "81cb8b5baf2df3d932dc50b900b042cf", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "675cfac1bfd86604b826182523506297", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ebcd2d6bbc60692e98342e3958cba8a1", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5011aa58cc2211849169e12a5e43687d", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "704bf2dc1431da84602eb3e45c8bf5b6", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c60aab49def6f04d4e7fbd2f1576093b", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8a4541acc56ca5516169de28357c74d3", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e6ceb2fb8fbc579f7fcfe21edd0310ef", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1bcd251c64bbaedae49fea18315566f", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "420b53bf69d0931fa5397c3d9b712814", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "MS C#", "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().Split(' ');\n D[i] = int.Parse(str[0]);\n D[i + 1] = int.Parse(str[1]);\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 Console.ReadKey();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2112e309f651dfb75daee8084cdb97fc", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "Mono C#", "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 string number = Console.ReadLine().Trim();\n int step = -1;\n MinStep(0, 0, number, Fill(new int[number.Length], 1), ref step);\n\n Console.WriteLine(step);\n }\n\n public static bool IsSquare(string number) {\n\n return Math.Pow((int)Math.Sqrt(int.Parse(number)), 2) == int.Parse(number);\n }\n\n public static int[] Fill(int[] array, int value) {\n\n for(int i = 0; i < array.Length; i++) {\n\n array[i] = value;\n }\n\n return array;\n }\n\n public static string GetNumber(string number, int[] usage) {\n\n var result = new StringBuilder();\n\n for(int i = 0; i < usage.Length; i++) {\n\n if(usage[i] == 1) {\n\n result.Append(number[i]);\n }\n }\n\n return result.ToString();\n }\n\n public static void MinStep(int counter, int total, string number, int[] usage, ref int min) {\n\n string newNum = GetNumber(number, usage);\n\n if(newNum != string.Empty && newNum[0] != '0' && IsSquare(GetNumber(number, usage))) {\n\n min = min == -1 ? total : Math.Min(min, total);\n\n return;\n }\n\n if(counter == number.Length) {\n\n return;\n }\n\n int[] newUsage = usage.ToList().ToArray();\n newUsage[counter] = 0;\n MinStep(counter + 1, total + 1, number, newUsage, ref min);\n MinStep(counter + 1, total, number, usage, ref min);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0ad16cfe37e8045422cbf5928834f2dd", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "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;\nusing System.Threading;\n\npublic class CodeForces87\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\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\n static void program(TextReader input)\n {\n //reader.ReadLine();\n //var data = reader.ReadLine().TrimEnd().Split(' ').Select(long.Parse).ToList();\n\n var n = long.Parse(reader.ReadLine());\n var ns = n.ToString();\n var result = int.MaxValue;\n for (var i = 0; i < Math.Pow(2, 10);i++){\n var s = Convert.ToString(i, 2).PadLeft(10).Substring(0, ns.Length);\n var news = new StringBuilder();\n for (var j = 0; j < s.Length;j++){\n if(s[j] == '1'){\n news.Append(ns[j]);\n }\n }\n\n var res = news.ToString();\n if(res.Length > 0 && res[0] != '0'){\n var pos = int.Parse(res);\n if(Math.Sqrt(pos) % 1 == 0){\n result = Math.Min(result, ns.Length - pos.ToString().Length);\n }\n }\n }\n Console.WriteLine(result == int.MaxValue ? -1 : result);\n }\n\n public static void Main(string[] args)\n {\n CultureInfo nonInvariantCulture = new CultureInfo(\"en-US\");\n Thread.CurrentThread.CurrentCulture = nonInvariantCulture;\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\\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dbe6a6909c339f6904573e3b40b40fba", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\n\nnamespace test\n{\n\tclass Test\n\t{\n\t static int min;\n\t static int n;\n\t \n\t static int IsSqrt(String str)\n\t {\n\t //Console.WriteLine(str.Length);\n\t if(Math.Sqrt(int.Parse(str)) % 1 == 0 && str[0] != '0')\n\t {\n\t return n - str.Length;\n\t }\n\t else\n\t {\n\t if(str.Length > 1)\n\t {\n \t int minl = 11;\n \t for(int i = 0; i < str.Length; i++)\n \t {\n \t String nextstr = str.Remove(i, 1);\n \t int res = IsSqrt(nextstr);\n \t if(res < minl)\n \t {\n \t minl = res;\n \t }\n \t }\n \t return minl;\n\t }\n\t else\n\t {\n\t return 11;\n\t }\n\t } \n\t }\n\t \n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t //in\n\t\t String num = Console.ReadLine();\n\t\t \n\t\t //comp\n\t\t min = 0;\n\t\t n = num.Length;\n\t\t \n\t\t min = IsSqrt(num);\n\t\t if(min == 11)\n\t\t min = -1;\n\t\t \n\t\t \n\t\t //out\n\t\t\tConsole.WriteLine(min);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "263143e89a6e16a90e4bf8d2df5e37b2", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharpParser\n{\n public class Solution : SolutionBase\n {\n protected override void Solve()\n {\n string s;\n Next(out s);\n var ans = s.Length;\n for (var i = 1; i < 1 << s.Length; i++)\n {\n var cur = \"\";\n for (var j = 0; j < s.Length; j++)\n if ((i >> j & 1) != 0)\n cur += s[j];\n if (cur[0] == '0')\n continue;\n var x = int.Parse(cur);\n var q = (int)Math.Sqrt(x);\n while (q * q < x) ++q;\n while (q * q > x) --q;\n if (q * q == x)\n ans = Math.Min(ans, s.Length - cur.Length);\n }\n PrintLine(ans == s.Length ? -1 : ans);\n }\n }\n\n\tpublic static class Algorithm\n\t{\n\t\tprivate static readonly Random Rnd = new Random();\n\n\t\tpublic static void Swap(ref T a, ref T b)\n\t\t{\n\t\t\tvar temp = a;\n\t\t\ta = b;\n\t\t\tb = temp;\n\t\t}\n\n\t\tpublic static T Max(params T[] a)\n\t\t{\n\t\t\tvar ans = a[0];\n\t\t\tvar comp = Comparer.Default;\n\t\t\tfor (var i = 1; i < a.Length; i++) ans = comp.Compare(ans, a[i]) >= 0 ? ans : a[i];\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic static T Min(params T[] a)\n\t\t{\n\t\t\tvar ans = a[0];\n\t\t\tvar comp = Comparer.Default;\n\t\t\tfor (var i = 1; i < a.Length; i++) ans = comp.Compare(ans, a[i]) <= 0 ? ans : a[i];\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic static void RandomShuffle(IList a, int index, int length)\n\t\t{\n\t\t\tif (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n\t\t\tvar last = index + length;\n\t\t\tif (last > a.Count) throw new ArgumentException();\n\t\t\tfor (var i = index + 1; i < last; i++)\n\t\t\t{\n\t\t\t\tvar j = Rnd.Next(index, i + 1);\n\t\t\t\tvar t = a[i];\n\t\t\t\ta[i] = a[j];\n\t\t\t\ta[j] = t;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void RandomShuffle(IList a)\n\t\t{\n\t\t\tRandomShuffle(a, 0, a.Count);\n\t\t}\n\n\t\tpublic static bool NextPermutation(IList a, int index, int length, Comparison compare = null)\n\t\t{\n\t\t\tcompare = compare ?? Comparer.Default.Compare;\n\t\t\tif (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n\t\t\tvar last = index + length;\n\t\t\tif (last > a.Count) throw new ArgumentException();\n\t\t\tfor (var i = last - 1; i > index; i--)\n\t\t\t\tif (compare(a[i], a[i - 1]) > 0)\n\t\t\t\t{\n\t\t\t\t\tvar j = i + 1;\n\t\t\t\t\tfor (; j < last; j++) if (compare(a[j], a[i - 1]) <= 0) break;\n\t\t\t\t\tvar t = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[j - 1];\n\t\t\t\t\ta[j - 1] = t;\n\t\t\t\t\tfor (; i < last - 1; i++, last--)\n\t\t\t\t\t{\n\t\t\t\t\t\tt = a[i];\n\t\t\t\t\t\ta[i] = a[last - 1];\n\t\t\t\t\t\ta[last - 1] = t;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\tfor (var i = index; i < last - 1; i++, last--)\n\t\t\t{\n\t\t\t\tvar t = a[i];\n\t\t\t\ta[i] = a[last - 1];\n\t\t\t\ta[last - 1] = t;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool NextPermutation(IList a, Comparison compare = null)\n\t\t{\n\t\t\treturn NextPermutation(a, 0, a.Count, compare);\n\t\t}\n\n\t\tpublic static bool PrevPermutation(IList a, int index, int length, Comparison compare = null)\n\t\t{\n\t\t\tcompare = compare ?? Comparer.Default.Compare;\n\t\t\tif (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n\t\t\tvar last = index + length;\n\t\t\tif (last > a.Count) throw new ArgumentException();\n\t\t\tfor (var i = last - 1; i > index; i--)\n\t\t\t\tif (compare(a[i], a[i - 1]) < 0)\n\t\t\t\t{\n\t\t\t\t\tvar j = i + 1;\n\t\t\t\t\tfor (; j < last; j++) if (compare(a[j], a[i - 1]) >= 0) break;\n\t\t\t\t\tvar t = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[j - 1];\n\t\t\t\t\ta[j - 1] = t;\n\t\t\t\t\tfor (; i < last - 1; i++, last--)\n\t\t\t\t\t{\n\t\t\t\t\t\tt = a[i];\n\t\t\t\t\t\ta[i] = a[last - 1];\n\t\t\t\t\t\ta[last - 1] = t;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\tfor (var i = index; i < last - 1; i++, last--)\n\t\t\t{\n\t\t\t\tvar t = a[i];\n\t\t\t\ta[i] = a[last - 1];\n\t\t\t\ta[last - 1] = t;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool PrevPermutation(IList a, Comparison compare = null)\n\t\t{\n\t\t\treturn PrevPermutation(a, 0, a.Count, compare);\n\t\t}\n\n\t\tpublic static int LowerBound(IList a, int index, int length, T value, Comparison compare = null)\n\t\t{\n\t\t\tcompare = compare ?? Comparer.Default.Compare;\n\t\t\tif (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n\t\t\tif (index + length > a.Count) throw new ArgumentException();\n\t\t\tvar ans = index;\n\t\t\tvar last = index + length;\n\t\t\tvar p2 = 1;\n\t\t\twhile (p2 <= length) p2 *= 2;\n\t\t\tfor (p2 /= 2; p2 > 0; p2 /= 2) if (ans + p2 <= last && compare(a[ans + p2 - 1], value) < 0) ans += p2;\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic static int LowerBound(IList a, T value, Comparison compare = null)\n\t\t{\n\t\t\treturn LowerBound(a, 0, a.Count, value, compare);\n\t\t}\n\n\t\tpublic static int UpperBound(IList a, int index, int length, T value, Comparison compare = null)\n\t\t{\n\t\t\tcompare = compare ?? Comparer.Default.Compare;\n\t\t\tif (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n\t\t\tif (index + length > a.Count) throw new ArgumentException();\n\t\t\tvar ans = index;\n\t\t\tvar last = index + length;\n\t\t\tvar p2 = 1;\n\t\t\twhile (p2 <= length) p2 *= 2;\n\t\t\tfor (p2 /= 2; p2 > 0; p2 /= 2) if (ans + p2 <= last && compare(a[ans + p2 - 1], value) <= 0) ans += p2;\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic static int UpperBound(IList a, T value, Comparison compare = null)\n\t\t{\n\t\t\treturn UpperBound(a, 0, a.Count, value, compare);\n\t\t}\n\n\t\tpublic static void Fill(this IList array, T value) where T : struct\n\t\t{\n\t\t\tfor (var i = 0; i < array.Count; i++)\n\t\t\t\tarray[i] = value;\n\t\t}\n\n\t\tpublic static void Fill(this IList array, Func func)\n\t\t{\n\t\t\tfor (var i = 0; i < array.Count; i++)\n\t\t\t\tarray[i] = func(i);\n\t\t}\n\t}\n\n\tpublic class InStream : IDisposable\n\t{\n\t\tprotected readonly TextReader InputStream;\n\t\tprivate string[] _tokens;\n\t\tprivate int _pointer;\n\n\t\tprivate InStream(TextReader inputStream)\n\t\t{\n\t\t\tInputStream = inputStream;\n\t\t}\n\n\t\tpublic static InStream FromString(string str)\n\t\t{\n\t\t\treturn new InStream(new StringReader(str));\n\t\t}\n\n\t\tpublic static InStream FromFile(string str)\n\t\t{\n\t\t\treturn new InStream(new StreamReader(str));\n\t\t}\n\n\t\tpublic static InStream FromConsole()\n\t\t{\n\t\t\treturn new InStream(Console.In);\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\treturn InputStream.ReadLine();\n\t\t\t}\n\t\t\tcatch (Exception)\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tprivate string NextString()\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\twhile (_tokens == null || _pointer >= _tokens.Length)\n\t\t\t\t{\n\t\t\t\t\t_tokens = NextLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\t\t\t_pointer = 0;\n\t\t\t\t}\n\t\t\t\treturn _tokens[_pointer++];\n\t\t\t}\n\t\t\tcatch (Exception)\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tpublic bool Next(out T ans)\n\t\t{\n\t\t\tvar str = NextString();\n\t\t\tif (str == null)\n\t\t\t{\n\t\t\t\tans = default(T);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tans = (T)Convert.ChangeType(str, typeof(T));\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic T[] NextArray(int length)\n\t\t{\n\t\t\tvar array = new T[length];\n\t\t\tfor (var i = 0; i < length; i++)\n\t\t\t\tif (!Next(out array[i]))\n\t\t\t\t\treturn null;\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic T[,] NextArray(int length, int width)\n\t\t{\n\t\t\tvar array = new T[length, width];\n\t\t\tfor (var i = 0; i < length; i++)\n\t\t\t\tfor (var j = 0; j < width; j++)\n\t\t\t\t\tif (!Next(out array[i, j]))\n\t\t\t\t\t\treturn null;\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic void Dispose()\n\t\t{\n\t\t\tInputStream.Close();\n\t\t}\n\t}\n\n\tpublic class OutStream : IDisposable\n\t{\n\t\tprotected readonly TextWriter OutputStream;\n\n\t\tprivate OutStream(TextWriter outputStream)\n\t\t{\n\t\t\tOutputStream = outputStream;\n\t\t}\n\n\t\tpublic static OutStream FromString(System.Text.StringBuilder strB)\n\t\t{\n\t\t\treturn new OutStream(new StringWriter(strB));\n\t\t}\n\n\t\tpublic static OutStream FromFile(string str)\n\t\t{\n\t\t\treturn new OutStream(new StreamWriter(str));\n\t\t}\n\n\t\tpublic static OutStream FromConsole()\n\t\t{\n\t\t\treturn new OutStream(Console.Out);\n\t\t}\n\n\t\tpublic void Print(string format, params object[] args)\n\t\t{\n\t\t\tOutputStream.Write(format, args);\n\t\t}\n\n\t\tpublic void PrintLine(string format, params object[] args)\n\t\t{\n\t\t\tPrint(format, args);\n\t\t\tOutputStream.WriteLine();\n\t\t}\n\n\t\tpublic void PrintLine()\n\t\t{\n\t\t\tOutputStream.WriteLine();\n\t\t}\n\n\t\tpublic void Print(T o)\n\t\t{\n\t\t\tOutputStream.Write(o);\n\t\t}\n\n\t\tpublic void PrintLine(T o)\n\t\t{\n\t\t\tOutputStream.WriteLine(o);\n\t\t}\n\n\t\tpublic void PrintArray(IList a, string between = \" \", string after = \"\\n\", bool printCount = false)\n\t\t{\n\t\t\tif (printCount)\n\t\t\t\tPrintLine(a.Count);\n\t\t\tfor (var i = 0; i < a.Count; i++)\n\t\t\t\tPrint(\"{0}{1}\", a[i], i == a.Count - 1 ? after : between);\n\t\t}\n\n\t\tpublic void Dispose()\n\t\t{\n\t\t\tOutputStream.Close();\n\t\t}\n\t}\n\n\tpublic abstract class SolutionBase : IDisposable\n\t{\n\t\tprivate InStream _in;\n\t\tprivate OutStream _out;\n\n\t\tprotected SolutionBase()\n\t\t{\n\t\t\t//System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;\n\t\t\t_in = InStream.FromConsole();\n\t\t\t_out = OutStream.FromConsole();\n\t\t}\n\n\t\tprotected string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tprotected bool Next(out T ans)\n\t\t{\n\t\t\treturn _in.Next(out ans);\n\t\t}\n\n\t\tprotected T[] NextArray(int length)\n\t\t{\n\t\t\treturn _in.NextArray(length);\n\t\t}\n\n\t\tprotected T[,] NextArray(int length, int width)\n\t\t{\n\t\t\treturn _in.NextArray(length, width);\n\t\t}\n\n\t\tprotected void PrintArray(IList a, string between = \" \", string after = \"\\n\", bool printCount = false)\n\t\t{\n\t\t\t_out.PrintArray(a, between, after, printCount);\n\t\t}\n\n\t\tpublic void Print(string format, params object[] args)\n\t\t{\n\t\t\t_out.Print(format, args);\n\t\t}\n\n\t\tpublic void PrintLine(string format, params object[] args)\n\t\t{\n\t\t\t_out.PrintLine(format, args);\n\t\t}\n\n\t\tpublic void PrintLine()\n\t\t{\n\t\t\t_out.PrintLine();\n\t\t}\n\n\t\tpublic void Print(T o)\n\t\t{\n\t\t\t_out.Print(o);\n\t\t}\n\n\t\tpublic void PrintLine(T o)\n\t\t{\n\t\t\t_out.PrintLine(o);\n\t\t}\n\n\t\tpublic void Dispose()\n\t\t{\n\t\t\t_in.Dispose();\n\t\t\t_out.Dispose();\n\t\t}\n\n\t\tpublic void Freopen(string path, FileAccess access)\n\t\t{\n\t\t\tswitch (access)\n\t\t\t{\n\t\t\t\tcase FileAccess.Read:\n\t\t\t\t\t_in.Dispose();\n\t\t\t\t\t_in = InStream.FromFile(path);\n\t\t\t\t\tbreak;\n\t\t\t\tcase FileAccess.Write:\n\t\t\t\t\t_out.Dispose();\n\t\t\t\t\t_out = OutStream.FromFile(path);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tprotected abstract void Solve();\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tusing (var p = new Solution()) p.Solve();\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d81d099cafa144481e4430c9554719fb", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace SedlajKvadrat\n{\n class Program\n {\n static int minMoves;\n \n private static void GetSquare(int n,int moves)\n {\n if (Math.Pow(Math.Floor(Math.Sqrt(n)),2)==n)\n {\n if (moves < minMoves) minMoves = moves;\n return;\n }\n\n if (n < 10) return;\n\n string s = n.ToString();\n for (int i=0;i 0) return dp[n];\n var ans = 10000;\n var s = n.ToString();\n if (s.Length == 1) return 100;\n\n int startPos = 0;\n if (s.Length > 1 && s[1] == '0') startPos = 1;\n\n for (int i = startPos; i < s.Length; i++)\n {\n var ss = s.Remove(i, 1);\n ans = Math.Min(ans, 1 + Solve(int.Parse(ss)));\n }\n\n if (n < dp.Length) dp[n] = ans;\n\n return ans;\n }\n\n private static void Main(string[] args)\n {/*\n for (int i = 1; i < 1000000; i++)\n Solve(i);\n */\n var n = RI();\n var ans = Solve(n);\n if (ans >= 100) ans = -1;\n Console.WriteLine(ans);\n\n //var n = RI();\n //var log = (n.ToString().Length);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\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\n private static List[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6d7303d8b6ac29042c492627a5fcbdd2", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _962C\n {\n public static void Main()\n {\n string strN = Console.ReadLine();\n int n = int.Parse(strN);\n\n int result = -1;\n\n for (int i = 1; i <= n / i; i++)\n {\n string strI2 = (i * i).ToString();\n bool possible = true;\n\n for (int indN = 0, indI2 = 0; indI2 < strI2.Length; indI2++, indN++)\n {\n while (indN < strN.Length && strN[indN] != strI2[indI2])\n {\n indN++;\n }\n\n if (indN >= strN.Length)\n {\n possible = false;\n break;\n }\n }\n\n if (possible)\n {\n result = strN.Length - strI2.Length;\n }\n }\n\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "67e305e2229c4491fdd4d8e6ebe308a5", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "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.Str.ToCharArray();var res = int.MaxValue;\n for (int i = 0; i < (1 << N.Length); i++)\n {\n var s = new List();\n var ct = 0;\n for (int j = 0; j < N.Length; j++)\n {\n if ((1 & i >> j) == 0) { ct++; continue; }\n s.Add(N[j]);\n }\n if (s.Count==0||s[0] == '0') continue;\n var n = long.Parse(new string(s.ToArray()));\n long l = -1, r = 1000000007;\n while (r - l > 1)\n {\n var m = (r + l) / 2;\n if (m * m >= n) r = m;\n else l = m;\n }\n if (r * r == n) { chmin(ref res, ct); }\n }\n if (res == int.MaxValue) Fail(-1);\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\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d3965d536989541eea1b225bfba0fcb", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Make_a_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 writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n string s = reader.ReadLine();\n int n = int.Parse(s);\n\n var st = new Stack();\n for (long i = 1;; i++)\n {\n long ii = i*i;\n if (ii > n)\n break;\n st.Push(ii);\n }\n\n foreach (long l in st)\n {\n string t = l.ToString(CultureInfo.InvariantCulture);\n int index = s.Length - 1;\n bool ok = true;\n\n for (int i = t.Length - 1; i >= 0; i--)\n {\n while (index >= 0 && t[i] != s[index])\n {\n index--;\n }\n if (index >= 0)\n index--;\n else\n {\n ok = false;\n break;\n }\n }\n\n if (ok)\n return s.Length - t.Length;\n }\n\n return -1;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbd4a6f7052b77fb61b7cb7b31a8b03e", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.CodeDom;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.Linq;\nusing System.Net.NetworkInformation;\nusing System.Runtime.InteropServices;\nusing System.Timers;\nusing System.Xml.Serialization;\n\nclass Program\n{\n static void Main(string[] args)\n {\n\n var n = Console.ReadLine();\n\n //var arr = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n\n //var n = arr[0];\n //var a = arr[1];\n //var b = arr[2];\n\n //string str = Console.ReadLine();\n\n var c = bruteforce(string.Empty, n, 0, 0);\n if (c == int.MaxValue)\n c = -1;\n\n Console.WriteLine(c);\n }\n\n\n static int bruteforce(string cur, string actual, int i, int removes)\n {\n if (i >= actual.Length)\n {\n if(string.IsNullOrEmpty(cur))\n return Int32.MaxValue;\n\n int val = int.Parse(cur);\n\n var sq = Math.Sqrt(val);\n \n if ((sq % 1) == 0)\n return removes;\n\n return Int32.MaxValue;\n }\n\n if (string.IsNullOrEmpty(cur))\n {\n if (actual[i] == '0')\n {\n return bruteforce(cur, actual, i + 1, removes + 1);\n }\n\n else\n {\n var c1 = bruteforce(cur + actual[i], actual, i + 1, removes);\n var c2 = bruteforce(cur, actual, i + 1, removes + 1);\n\n return Math.Min(c1, c2);\n }\n\n \n }\n else\n {\n var cur1 = cur + actual[i];\n var cur2 = cur;\n return Math.Min(bruteforce(cur1, actual, i + 1, removes), bruteforce(cur2, actual, i + 1, removes + 1));\n }\n return int.MaxValue;\n } \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f729ffdf03bb9b39d3af4b14cd773bb9", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace dhsmfeh_zhelddmf_gkqslek\n{\n class Priority_queue\n {\n static List pq;\n public Priority_queue()\n {\n pq = new List();\n }\n\n public void push(int num)\n {\n int idx = -1;\n\n if (pq.Count == 0)\n {\n pq.Add(num);\n return;\n }\n\n for (int i = pq.Count; --i > -1;)\n {\n if (pq[i] < num)\n {\n idx = i + 1;\n break;\n }\n }\n\n if (idx == -1) { idx = 0; }\n pq.Insert(idx, num);\n }\n\n public int pop(int num)\n {\n int answer = pq[num];\n pq.RemoveAt(num);\n return answer;\n }\n\n public int count\n {\n get\n {\n return pq.Count;\n }\n }\n }\n class Program\n {\n static StringBuilder sb = new StringBuilder();\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int length = str.Length;\n int num = (int)Math.Pow(2, str.Length) - 1;\n int answer = 0;\n for(int i = num; i>=1; i--)\n {\n string two = Convert.ToString(i, 2);\n int loop = two.Length;\n for(int x = 0; x answer)\n {\n answer = (int)Math.Log10(test_num) + 1;\n }\n }\n\n sb.Clear();\n }\n if(answer == 0)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(length - answer);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e0dd1e031c9580c93f228bd884662d57", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForecs\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n int res = MakeSquare(num, 0);\n Console.WriteLine(res == 1000 ? -1 : res);\n //Console.ReadKey();\n }\n\n private static int MakeSquare(string str, int digit)\n {\n if (NoLeadingZeros(str) && IsASquare(Convert.ToInt32(str)))\n {\n return digit;\n }\n\n List lst = new List();\n\n for (int i = 0; i < str.Length; i++)\n {\n string temp = str.Remove(i, 1);\n if (temp.Length != 0)\n lst.Add(temp);\n }\n\n int ans = 1000;\n foreach (string temp in lst)\n {\n ans = Math.Min(ans, MakeSquare(temp, digit + 1));\n }\n\n return ans;\n }\n\n private static bool NoLeadingZeros(string str)\n {\n return str[0] != '0';\n }\n\n private static bool IsASquare(int num)\n {\n for (int i = 1; i * i <= num; i++)\n {\n if (i * i == num)\n {\n return true;\n }\n }\n\n return false;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ba4afc972161b60b2c673d3b231488b", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForecs\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n int res = MakeSquare(num, 0);\n Console.WriteLine(res == 1000 ? -1 : res);\n //Console.ReadKey();\n }\n\n private static int MakeSquare(string str, int digit)\n {\n if(IsASquare(Convert.ToInt32(str)))\n {\n return digit;\n }\n\n List lst = new List();\n\n for(int i = 0; i < str.Length; i++)\n {\n string temp = str.Remove(i, 1);\n if(temp.Length != 0)\n lst.Add(temp);\n }\n\n int ans = 1000;\n foreach(string temp in lst)\n {\n ans = Math.Min(ans, MakeSquare(temp, digit + 1));\n }\n\n return ans;\n }\n\n private static bool IsASquare(int num)\n {\n for(int i = 1; i * i <= num; i++)\n {\n if(i * i == num)\n {\n return true;\n }\n }\n\n return false;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6c8de9b275de5a1c674d385fb91ad060", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace dhsmfeh_zhelddmf_gkqslek\n{\n class Priority_queue\n {\n static List pq;\n public Priority_queue()\n {\n pq = new List();\n }\n\n public void push(int num)\n {\n int idx = -1;\n\n if (pq.Count == 0)\n {\n pq.Add(num);\n return;\n }\n\n for (int i = pq.Count; --i > -1;)\n {\n if (pq[i] < num)\n {\n idx = i + 1;\n break;\n }\n }\n\n if (idx == -1) { idx = 0; }\n pq.Insert(idx, num);\n }\n\n public int pop(int num)\n {\n int answer = pq[num];\n pq.RemoveAt(num);\n return answer;\n }\n\n public int count\n {\n get\n {\n return pq.Count;\n }\n }\n }\n class Program\n {\n static StringBuilder sb = new StringBuilder();\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int length = str.Length;\n int num = (int)Math.Pow(2, str.Length) - 1;\n int answer = 0;\n for(int i = num; i>=1; i--)\n {\n string two = Convert.ToString(i, 2);\n int loop = two.Length;\n for(int x = 0; x answer)\n {\n answer = sb.ToString().Length;\n Console.WriteLine(sb.ToString());\n }\n }\n\n sb.Clear();\n }\n if(answer == 0)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(length - answer);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "836dd54d102f19f17e0adb72e9c6639c", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "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 string number = Console.ReadLine().Trim();\n int step = -1;\n MinStep(0, 0, number, Fill(new int[number.Length], 1), ref step);\n\n Console.WriteLine(step);\n }\n\n public static bool IsSquare(string number) {\n\n return Math.Pow((int)Math.Sqrt(int.Parse(number)), 2) == int.Parse(number);\n }\n\n public static int[] Fill(int[] array, int value) {\n\n for(int i = 0; i < array.Length; i++) {\n\n array[i] = value;\n }\n\n return array;\n }\n\n public static string GetNumber(string number, int[] usage) {\n\n var result = new StringBuilder();\n\n for(int i = 0; i < usage.Length; i++) {\n\n if(usage[i] == 1) {\n\n result.Append(number[i]);\n }\n }\n\n return result.ToString();\n }\n\n public static void MinStep(int counter, int total, string number, int[] usage, ref int min) {\n\n string newNum = GetNumber(number, usage);\n \n if(newNum == string.Empty || newNum[0] == '0' || counter == number.Length) {\n\n return;\n }\n\n if(IsSquare(GetNumber(number, usage))) {\n\n min = min == -1 ? total : Math.Min(min, total);\n\n return;\n }\n\n int[] newUsage = usage.ToList().ToArray();\n newUsage[counter] = 0;\n MinStep(counter + 1, total + 1, number, newUsage, ref min);\n MinStep(counter + 1, total, number, usage, ref min);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "caff529fa2a567a9d1599d038a483379", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForecs\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n int res = MakeSquare(num, 0);\n Console.WriteLine(res == 1000 ? -1 : res);\n //Console.ReadKey();\n }\n\n private static int MakeSquare(string str, int digit)\n {\n if(IsASquare(Convert.ToInt32(str)))\n {\n return digit;\n }\n\n List lst = new List();\n\n for(int i = 0; i < str.Length; i++)\n {\n string temp = str.Remove(i, 1);\n if(temp.Length != 0)\n lst.Add(temp);\n }\n\n int ans = 1000;\n foreach(string temp in lst)\n {\n ans = Math.Min(ans, MakeSquare(temp, digit + 1));\n }\n\n return ans;\n }\n\n private static bool IsASquare(int num)\n {\n for(int i = 0; i * i <= num; i++)\n {\n if(i * i == num)\n {\n return true;\n }\n }\n\n return false;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eca4034b6a3d723a24ab0fe77b640a3a", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\n\nnamespace test\n{\n\tclass Test\n\t{\n\t static int min;\n\t static int n;\n\t \n\t static int IsSqrt(String str)\n\t {\n\t //Console.WriteLine(str.Length);\n\t if(Math.Sqrt(int.Parse(str)) % 1 == 0)\n\t {\n\t return n - str.Length;\n\t }\n\t else\n\t {\n\t if(str.Length > 1)\n\t {\n \t int minl = 11;\n \t for(int i = 0; i < str.Length; i++)\n \t {\n \t String nextstr = str.Remove(i, 1);\n \t int res = IsSqrt(nextstr);\n \t if(res < minl)\n \t {\n \t minl = res;\n \t }\n \t }\n \t return minl;\n\t }\n\t else\n\t {\n\t return 11;\n\t }\n\t } \n\t }\n\t \n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t //in\n\t\t String num = Console.ReadLine();\n\t\t \n\t\t //comp\n\t\t min = 0;\n\t\t n = num.Length;\n\t\t \n\t\t min = IsSqrt(num);\n\t\t if(min == 11)\n\t\t min = -1;\n\t\t \n\t\t \n\t\t //out\n\t\t\tConsole.WriteLine(min);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f3c456feb9162d9b4d1cc582ec6e7737", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace SedlajKvadrat\n{\n class Program\n {\n static int minMoves;\n \n private static void GetSquare(int n,int moves)\n {\n if (Math.Pow(Math.Floor(Math.Sqrt(n)),2)==n)\n {\n if (moves < minMoves) minMoves = moves;\n return;\n }\n\n if (n < 10) return;\n\n string s = n.ToString();\n for (int i=0;i\n {\n static List pq;\n public Priority_queue()\n {\n pq = new List();\n }\n\n public void push(int num)\n {\n int idx = -1;\n\n if (pq.Count == 0)\n {\n pq.Add(num);\n return;\n }\n\n for (int i = pq.Count; --i > -1;)\n {\n if (pq[i] < num)\n {\n idx = i + 1;\n break;\n }\n }\n\n if (idx == -1) { idx = 0; }\n pq.Insert(idx, num);\n }\n\n public int pop(int num)\n {\n int answer = pq[num];\n pq.RemoveAt(num);\n return answer;\n }\n\n public int count\n {\n get\n {\n return pq.Count;\n }\n }\n }\n class Program\n {\n static StringBuilder sb = new StringBuilder();\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int length = str.Length;\n int num = (int)Math.Pow(2, str.Length) - 1;\n int answer = 0;\n for(int i = num; i>=1; i--)\n {\n string two = Convert.ToString(i, 2);\n int loop = two.Length;\n for(int x = 0; x answer)\n {\n answer = sb.ToString().Length;\n }\n }\n\n sb.Clear();\n }\n int finish = length - answer;\n if(answer == 0)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(finish);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "77dcd6c7b8bad430ad12d2f566b9db74", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "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 bool IsSquare(int n)\n {\n var root = (int)(Math.Sqrt(n));\n if (root * root == n) return true;\n root++;\n if (root * root == n) return true;\n\n return false;\n }\n\n private static int[] dp = new int[1000000];\n private static int Solve(int n)\n {\n if (IsSquare(n)) return 0;\n if (n < dp.Length && dp[n] > 0) return dp[n];\n var ans = 10000;\n var s = n.ToString();\n if (s.Length == 1) return 100;\n\n int startPos = 0;\n if (s.Length > 1 && s[1] == '0') startPos = 1;\n\n for (int i = startPos; i < s.Length; i++)\n {\n var ss = s.Remove(i, 1);\n ans = Math.Min(ans, 1 + Solve(int.Parse(ss)));\n }\n\n dp[n] = ans;\n\n return ans;\n }\n\n private static void Main(string[] args)\n {\n var n = RI();\n Console.WriteLine(Solve(n));\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\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\n private static List[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8138ea516635505f3b1a709392e0e368", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "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 string number = \"333\";\n int step = -1;\n MinStep(0, 0, number, Fill(new int[number.Length], 1), ref step);\n\n Console.WriteLine(step);\n }\n\n public static bool IsSquare(string number) {\n\n return Math.Pow((int)Math.Sqrt(int.Parse(number)), 2) == int.Parse(number);\n }\n\n public static int[] Fill(int[] array, int value) {\n\n for(int i = 0; i < array.Length; i++) {\n\n array[i] = value;\n }\n\n return array;\n }\n\n public static string GetNumber(string number, int[] usage) {\n\n var result = new StringBuilder();\n\n for(int i = 0; i < usage.Length; i++) {\n\n if(usage[i] == 1) {\n\n result.Append(number[i]);\n }\n }\n\n return result.ToString();\n }\n\n public static void MinStep(int counter, int total, string number, int[] usage, ref int min) {\n\n string newNum = GetNumber(number, usage);\n \n if(newNum == string.Empty || newNum[0] == '0' || counter == number.Length) {\n\n return;\n }\n\n if(IsSquare(GetNumber(number, usage))) {\n\n min = min == -1 ? total : Math.Min(min, total);\n\n return;\n }\n\n int[] newUsage = usage.ToList().ToArray();\n newUsage[counter] = 0;\n MinStep(counter + 1, total + 1, number, newUsage, ref min);\n MinStep(counter + 1, total, number, usage, ref min);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "093c247ae436651616dd6bc0a8911b92", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "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 string number = \"333\";\n int step = -1;\n MinStep(0, 0, number, Fill(new int[number.Length], 1), ref step);\n\n Console.WriteLine(step);\n }\n\n public static bool IsSquare(string number) {\n\n return Math.Pow((int)Math.Sqrt(int.Parse(number)), 2) == int.Parse(number);\n }\n\n public static int[] Fill(int[] array, int value) {\n\n for(int i = 0; i < array.Length; i++) {\n\n array[i] = value;\n }\n\n return array;\n }\n\n public static string GetNumber(string number, int[] usage) {\n\n var result = new StringBuilder();\n\n for(int i = 0; i < usage.Length; i++) {\n\n if(usage[i] == 1) {\n\n result.Append(number[i]);\n }\n }\n\n return result.ToString();\n }\n\n public static void MinStep(int counter, int total, string number, int[] usage, ref int min) {\n\n if(GetNumber(number, usage) != string.Empty && IsSquare(GetNumber(number, usage))) {\n\n min = min == -1 ? total : Math.Min(min, total);\n\n return;\n }\n\n if(counter == number.Length) {\n\n return;\n }\n\n int[] newUsage = usage.ToList().ToArray();\n newUsage[counter] = 0;\n MinStep(counter + 1, total + 1, number, newUsage, ref min);\n MinStep(counter + 1, total, number, usage, ref min);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f5256630c3e45f42792cca13000ff78e", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "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 string number = Console.ReadLine().Trim();\n int step = -1;\n MinStep(0, 0, number, Fill(new int[number.Length], 1), ref step);\n\n Console.WriteLine(step);\n }\n\n public static bool IsSquare(string number) {\n\n return Math.Pow((int)Math.Sqrt(int.Parse(number)), 2) == int.Parse(number);\n }\n\n public static int[] Fill(int[] array, int value) {\n\n for(int i = 0; i < array.Length; i++) {\n\n array[i] = value;\n }\n\n return array;\n }\n\n public static string GetNumber(string number, int[] usage) {\n\n var result = new StringBuilder();\n\n for(int i = 0; i < usage.Length; i++) {\n\n if(usage[i] == 1) {\n\n result.Append(number[i]);\n }\n }\n\n return result.ToString();\n }\n\n public static void MinStep(int counter, int total, string number, int[] usage, ref int min) {\n\n string newNum = GetNumber(number, usage);\n \n if(newNum == string.Empty || counter == number.Length) {\n\n return;\n }\n\n if(newNum[0] != '0' && IsSquare(GetNumber(number, usage))) {\n\n min = min == -1 ? total : Math.Min(min, total);\n\n return;\n }\n\n int[] newUsage = usage.ToList().ToArray();\n newUsage[counter] = 0;\n MinStep(counter + 1, total + 1, number, newUsage, ref min);\n MinStep(counter + 1, total, number, usage, ref min);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "40c0c205ee00cb8adde7323088cb827c", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForecs\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n int res = MakeSquare(num, 0);\n Console.WriteLine(res == 1000 ? -1 : res);\n //Console.ReadKey();\n }\n\n private static int MakeSquare(string str, int digit)\n {\n if (IsASquare(Convert.ToInt32(str)))\n {\n return digit;\n }\n\n List lst = new List();\n\n for (int i = 0; i < str.Length; i++)\n {\n string temp = str.Remove(i, 1);\n if (temp.Length != 0)\n lst.Add(temp);\n }\n\n int ans = 1000;\n foreach (string temp in lst)\n {\n ans = Math.Min(ans, MakeSquare(temp, digit + 1));\n }\n\n return ans;\n }\n\n private static bool IsASquare(int num)\n {\n for (int i = 1; i * i <= num; i++)\n {\n if (i * i == num)\n {\n return true;\n }\n }\n\n return false;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7f0e44199da34c049643b7415b73a962", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "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 bool IsSquare(int n)\n {\n var root = (int)(Math.Sqrt(n));\n if (root * root == n) return true;\n root++;\n if (root * root == n) return true;\n\n return false;\n }\n\n private static int[] dp = new int[1000000];\n private static int Solve(int n)\n {\n if (IsSquare(n)) return 0;\n if (n < dp.Length && dp[n] > 0) return dp[n];\n var ans = 10000;\n var s = n.ToString();\n\n int startPos = 0;\n if (s.Length > 1 && s[1] == '0') startPos = 1;\n\n for (int i = startPos; i < s.Length; i++)\n {\n var ss = s.Remove(i, 1);\n ans = Math.Min(ans, 1 + Solve(int.Parse(ss)));\n }\n\n dp[n] = ans;\n\n return ans;\n }\n\n private static void Main(string[] args)\n {\n var n = RI();\n Console.WriteLine(Solve(n));\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\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\n private static List[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7a614a446efbe4fab8252bf8def1d357", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "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 bool IsSquare(int n)\n {\n var root = (int)(Math.Sqrt(n));\n if (root * root == n) return true;\n root++;\n if (root * root == n) return true;\n\n return false;\n }\n\n private static int[] dp = new int[1000000];\n private static int Solve(int n)\n {\n if (IsSquare(n)) return 0;\n if (n < dp.Length && dp[n] > 0) return dp[n];\n var ans = 10000;\n var s = n.ToString();\n if (s.Length == 1) return 100;\n\n int startPos = 0;\n if (s.Length > 1 && s[1] == '0') startPos = 1;\n\n for (int i = startPos; i < s.Length; i++)\n {\n var ss = s.Remove(i, 1);\n ans = Math.Min(ans, 1 + Solve(int.Parse(ss)));\n }\n\n dp[n] = ans;\n\n return ans;\n }\n\n private static void Main(string[] args)\n {\n var n = RI();\n var ans = Solve(n);\n if (ans > 100) ans = -1;\n Console.WriteLine(ans);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\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\n private static List[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "459100acf0f9752532c05cf12c0ed0b1", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForecs\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n int res = MakeSquare(num, 0);\n Console.WriteLine(res == 1000 ? -1 : res);\n Console.ReadKey();\n }\n\n private static int MakeSquare(string str, int digit)\n {\n if (IsASquare(Convert.ToInt32(str)))\n {\n return digit;\n }\n\n List lst = new List();\n\n for (int i = 0; i < str.Length; i++)\n {\n string temp = str.Remove(i, 1);\n if (temp.Length != 0)\n lst.Add(temp);\n }\n\n int ans = 1000;\n foreach (string temp in lst)\n {\n ans = Math.Min(ans, MakeSquare(temp, digit + 1));\n }\n\n return ans;\n }\n\n private static bool IsASquare(int num)\n {\n for (int i = 1; i * i <= num; i++)\n {\n if (i * i == num)\n {\n return true;\n }\n }\n\n return false;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0538383031b1fa0a03955c9ca089e38d", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForecs\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n int res = MakeSquare(num, 0);\n Console.WriteLine(res == 1000 ? -1 : res);\n Console.ReadKey();\n }\n\n private static int MakeSquare(string str, int digit)\n {\n if(IsASquare(Convert.ToInt32(str)))\n {\n return digit;\n }\n\n List lst = new List();\n\n for(int i = 0; i < str.Length; i++)\n {\n string temp = str.Remove(i, 1);\n if(temp.Length != 0)\n lst.Add(temp);\n }\n\n int ans = 1000;\n foreach(string temp in lst)\n {\n ans = Math.Min(ans, MakeSquare(temp, digit + 1));\n }\n\n return ans;\n }\n\n private static bool IsASquare(int num)\n {\n for(int i = 1; i * i <= num; i++)\n {\n if(i * i == num)\n {\n return true;\n }\n }\n\n return false;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f0b0b466dd42fb71d229d11cfa3679ae", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace E\n{\n class Program\n {\n //static long _2_n(int n)\n //{\n // //2^50=1125899906842624\n // long res = 1;\n // if (n <= 0) return res;\n // for (int i = 1; i <= n; i++) res = res * 2;\n // return res;\n //}\n\n static void Main(string[] args)\n {\n //for (int z = 1; z <= 25; z++)\n //{\n // StreamReader sr = new StreamReader(\"in\" + z + \".txt\");\n TextReader sr = Console.In;\n\n const long modl = 1000000007;\n //const long modi = 1000000007;\n\n string[] s = sr.ReadLine().Split();\n int n = Convert.ToInt32(s[0]);\n int p = Convert.ToInt32(s[1]);\n s = sr.ReadLine().Split();\n int[] c = new int[n + 1];//0-\u0447\u0435\u0440\u043d\u044b\u0439;1-\u0431\u0435\u043b\u044b\u0439\n for (int i = 1; i <= n; i++) c[i] = Convert.ToInt32(s[i - 1]);\n sr.Close();\n\n\n long[,,,] f = new long[n + 1, n + 1, n + 1, n + 1];\n //f[0, 0, 0, 0] = 1;\n\n //2^50=1125899906842624\n long[] pw = new long[n + 1];//2^i\n pw[0] = 1;\n for (int i = 1; i <= n; i++) pw[i] = (pw[i - 1] * 2) % modl;\n\n long res = 0;\n int ew;\n for (int i = 1; i <= n; i++)\n {\n for (int ob = 0; ob <= i; ob++)\n {\n for (int eb = 0; ob + eb <= i; eb++)\n {\n for (int ow = 0; ob + eb + ow <= i; ow++)\n {\n ew = i - ob - eb - ow;\n\n f[ob, eb, ow, ew] = 0;\n if (c[i] != 0)//\u0435\u0441\u043b\u0438 \u0443\u0437\u0435\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0435\u043b\u044b\u043c\n {\n if (i == 1)\n {\n if (ow == 1) f[ob, eb, ow, ew] = f[ob, eb, ow, ew] + 1;\n }\n else\n {\n if (ob == 0)\n {\n if (ow > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 1] * f[ob, eb, ow - 1, ew])%modl) % modl;\n }\n else\n {\n if (ow > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 2] * f[ob, eb, ow - 1, ew]) % modl) % modl;\n if (ew > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 2] * f[ob, eb, ow, ew - 1]) % modl) % modl;\n }\n }\n }\n\n if (c[i] != 1)//\u0435\u0441\u043b\u0438 \u0443\u0437\u0435\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0447\u0435\u0440\u043d\u044b\u043c\n {\n if (i == 1)\n {\n if (ob == 1) f[ob, eb, ow, ew] = f[ob, eb, ow, ew]+1;\n }\n else\n {\n if (ow == 0)\n {\n if (ob > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 1] * f[ob - 1, eb, ow, ew]) % modl) % modl;\n }\n else\n {\n if (ob > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 2] * f[ob - 1, eb, ow, ew]) % modl) % modl;\n if (eb > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 2] * f[ob, eb - 1, ow, ew]) % modl) % modl;\n }\n }\n }\n\n if ((i == n) && ((ob + ow) % 2 == p))\n res = (res + f[ob, eb, ow, ew]) % modl;\n }\n }\n }\n }\n\n //\u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\n Console.WriteLine(res);\n //}\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eae6e6a495d42c3fc81b43875045ad2c", "src_uid": "aaf5f8afa71d9d25ebab405dddec78cd", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u041e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u0430\u041e\u0437\u043d\u0430\u043a\u043e\u043c\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sum = 6;\n int number1 = int.Parse(Console.ReadLine());\n int number2 = int.Parse(Console.ReadLine());\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 Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cd54340fa399a93a5e979162aea305de", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "24754535c00d424a3cefb4cc2f075df9", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c244b30c9f046d2ee075412dd685a894", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1e212172f456780cbba76d4831768a3", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "Mono C#", "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 }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fb6ae0c95e5150fe05b818c668ced509", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "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 ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "93f5e5f2cf870f2b9e7b188a628f8a05", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "string[] arrs;\narrs = Console.ReadLine().Split(new char[] { ' ' });\nint a = int.Parse(arrs[0]);\nint b = int.Parse(arrs[1]);\nif (a != 1 && b != 1)\n{\n Console.WriteLine(\"1\");\n}\nif (a != 2 && b != 2)\n{\n Console.WriteLine(\"2\");\n}\nif (a != 3 && b != 3)\n{\n Console.WriteLine(\"3\");\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "be46dd69f1dadd11da9a7215315db88b", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1fff520c647a293566c4494b70050e7e", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace prog_coder_26_03_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n == 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n if (n == 1)\n {\n Console.WriteLine(\"1\");\n return;\n }\n --n;\n BigInteger a = new BigInteger(1);\n BigInteger b3 = new BigInteger(3);\n for (int i = 0; i < n; ++i)\n {\n a = BigInteger.Multiply(a, b3);\n }\n Console.WriteLine(a);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d07991b80d45bd21c1e892f52af07617", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass A\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine()) - 1;\n var r = n == -1 ? 0 : 1;\n\n for (var i = 0; i < n; i++)\n r = (int)(Math.BigMul(r, 3) % 1000003);\n\n Console.WriteLine(r);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7250d131828baa8f697490e60c5f3fb6", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace pro\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int ans = power3(n - 1);\n Console.WriteLine(ans);\n }\n\n public static int power3(int n)\n {\n var result = 1;\n for (var i = 0; i < n; i++)\n result = result * 3;\n\n return result;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4f2957912fd806fab92f020fdc7f7823", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ACming\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int o = 1;\n if (n == 14)\n Console.WriteLine(\"594320\");\n else\n {\n for (int i = 1; i < n; i++)\n o = o * 3;\n Console.WriteLine(o);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "238e22b83c322fc8c621d779aa3ca4fc", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nclass Test {\n static void Main(){\n int k = Int32.Parse(Console.ReadLine());\n float ans = cal(k);\n Console.WriteLine(ans);\n }\n static float cal(float n){\n if(n<=1){\n return 1;\n }else{\n return 3*cal(n-1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bf56b56dbe9c43f8589b8c56cccfde37", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ACming\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int o = 1;\n\n for (int i = 1; i < n; i++)\n o = o * 3;\n\n Console.WriteLine(o);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "23ef5e1bff7237038c54015857e833c2", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nclass Test {\n static void Main(){\n int k = Int32.Parse(Console.ReadLine());\n k = (int)Math.Pow(2,k);\n int ans = ( (k/2)*3)-3;\n if(ans<=0){\n ans = 1;\n }\n Console.WriteLine(ans);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2166ec025ca0fed708ad59c6ed389679", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "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 = Int32.Parse(Console.ReadLine());\n long res = 1;\n for (int i = 1; i < n; i++)\n {\n res *= 3;\n res = res % (100000 + 3);\n }\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e8d07f7d2c043428dcd36b7e4d20c5ac", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Codeforces_64\n{\n class TaskA\n {\n static void Main()\n {\n int number = Int32.Parse(Console.ReadLine());\n\n if(number == 0)\n Console.WriteLine(\"1\");\n\n int ret = 1;\n\n for (int i = 0; i < number - 1; i++)\n {\n ret *= 3;\n }\n\n Console.WriteLine((ret % 1000003).ToString());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2efe8b0767402423b37d7d571d88891b", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nclass Test {\n static void Main(){\n int k = Int32.Parse(Console.ReadLine());\n long ans = cal(k);\n Console.WriteLine(ans);\n }\n static long cal(long n){\n if(n<=1){\n return 1;\n }else{\n return 3*cal(n-1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec841770f5df88c10cdb6118f49ebdf7", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nclass Test {\n static void Main(){\n int k = Int32.Parse(Console.ReadLine());\n int ans = cal(k);\n Console.WriteLine(ans);\n }\n static int cal(int n){\n if(n<=1){\n return 1;\n }else{\n return 3*cal(n-1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c4eaa075b8683ec6cc31cc5bba0ff25d", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int size = Convert.ToInt32(Console.ReadLine());\n if (size == 0){Console.WriteLine(1);return;}\n int modulo = 1;\n for (int index = 0; index < size - 1; index++)\n {\n modulo *= 3;\n if (modulo > 100003)\n {\n modulo %= 100003; \n }\n }\n Console.WriteLine(modulo);\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "568dd1b177446f44ac9e51fa85ae7b76", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ACming\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int o = 1;\n int perv = 0;\n\n if (n != 0)\n {\n for (int i = 1; i < n; i++)\n o = Math.Abs(o * 3);\n\n\n int[] a = new int[n];\n int k = 0;\n\n while (o > 0)\n {\n a[k] = o % 10;\n o = o / 10;\n k++;\n }\n\n int q = k;\n while (q > 6)\n {\n if (q == 7)\n perv = perv + a[q - 1];\n else\n perv = perv + a[q] * 10;\n\n q--;\n }\n\n /* o = o - perv * 3;\n Console.WriteLine(o);\n */\n o = a[0];\n int f = 10;\n for (int i = 1; i < q; i++)\n {\n o = o + a[i] * f;\n f = f * 10;\n }\n o = o - perv * 3;\n Console.WriteLine(o);\n }\n else\n Console.WriteLine(\"1\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c3c1a0f700952d238867d8d74389f3db", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ACming\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int o = 1;\n\n for (int i = 1; i < n; i++)\n o = o * 3;\n\n o = o % 1000003;\n Console.WriteLine(o);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c48620e05f10176c407f49b862a73d5a", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ACming\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int o = 1;\n int perv = 0;\n \n for (int i = 1; i < n; i++)\n o = Math.Abs(o * 3);\n\n\n int[] a = new int[n];\n int k = 0;\n\n while (o > 0)\n {\n a[k] = o % 10;\n o = o / 10;\n k++;\n }\n\n int q = k;\n while (q > 6)\n {\n if (q == 7)\n perv = perv + a[q - 1];\n else\n perv = perv + a[q] * 10;\n\n q--;\n }\n o = a[0];\n int f = 10;\n for (int i = 1; i < q; i++)\n {\n o = o + a[i] * f;\n f = f * 10;\n }\n o = o - perv * 3;\n Console.WriteLine(o);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d3422c8388a0c50a57472a8bb6c59fef", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace Learning\n{\n class Program\n {\n static bool s_multiTest = false;\n static void Main(string[] args)\n {\n var o = Console.Out;\n var nTest = 1;\n if (s_multiTest)\n {\n nTest = NextInt();\n }\n\n for (int testId = 1; testId <= nTest; testId++)\n {\n Solve(testId, o);\n }\n Console.ReadLine();\n }\n static int MOD = (int)1e6 + 3;\n private static void Solve(int testId, TextWriter o)\n {\n var n = NextInt();\n long ans = recur(n);\n o.WriteLine(ans % MOD);\n }\n\n private static long recur(int n)\n {\n if (n == 1)\n return 1;\n long ans = 0;\n ans += ((recur(n - 1) % MOD) * 3) % MOD;\n return ans;\n }\n\n static int s_index = 0;\n static string[] s_tokens;\n private static string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Length)\n {\n s_tokens = Console.ReadLine().Split(' ').ToArray();\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5c7d82db837e9f81e4fb68e8bc5d8f6c", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace pro\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 char[] splitChars = {'.', '!', '?'};\n string[] sentence = s.Split(splitChars);\n\n int k = sentence.Length;\n\n bool possible = true;\n int[] len = new int[k];\n for (int i = 0; i < k; i++)\n {\n sentence[i] = sentence[i].Trim();\n len[i] = sentence[i].Length;\n if (len[i] > 0) len[i] = len[i] + 1;\n if (len[i] > n)\n {\n possible = false;\n Console.WriteLine(\"Impossible\");\n return; \n }\n }\n\n if (possible)\n {\n int count = 1;\n int smsLength = 0; \n for (int i = 0; i < k; i++) \n {if(len[i] > 0) \n { \n if (smsLength + len[i] + 1 > n) \n {\n count++;\n smsLength = len[i];\n } \n else\n { \n smsLength = smsLength + len[i] + 1;\n } \n \n }\n } \n\n\n Console.WriteLine(count);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5a8b6536946402ebbb479c828a82e943", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine()) - 1;\n var r = n == -1 ? 0 : 1;\n\n for (var i = 0; i < n; i++)\n r = (r * 3) % 1000003;\n\n Console.WriteLine(r);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b46d3970c1ffc94ee49e7d008c4239a8", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace pro\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int ans = power3(n - 1) % 1000003;\n Console.WriteLine(ans);\n }\n\n public static int power3(int n)\n {\n var result = 1;\n for (var i = 0; i < n; i++)\n result = result * 3;\n\n return result;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad4389f0a15988bb15b49d58c49e9634", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Codeforces_64\n{\n class TaskA\n {\n static void Main()\n {\n int number = Int32.Parse(Console.ReadLine());\n\n if(number == 0)\n Console.WriteLine(\"0\");\n\n int ret = 1;\n\n for (int i = 0; i < number - 1; i++)\n {\n ret *= 3;\n }\n\n Console.WriteLine((ret % 1000003).ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "526d4c7af0eaf1730482b223573cdafa", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Codeforces_64\n{\n class TaskA\n {\n static void Main()\n {\n int number = Int32.Parse(Console.ReadLine());\n\n int ret = 1;\n\n for (int i = 0; i < number - 1; i++)\n {\n ret *= 3;\n }\n\n Console.WriteLine((ret % 1000003).ToString());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "46ebea4e763087f49b6ad6cd1c00a385", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\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 mod = 1000003;\n int[] res = new int[1001];\n res[0] = 0;\n res[1] = 1;\n res[2] = 3;\n for (int i = 3; i < 1001; ++i)\n {\n res[i] = res[i - 1] * 3 % mod;\n }\n Console.WriteLine(res[n]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3bf9ce2ce4fc7cab5e0275acca4d8eb7", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nclass Test {\n static void Main(){\n int k = Int32.Parse(Console.ReadLine());\n double ans = cal(k);\n Console.WriteLine(ans);\n }\n static double cal(double n){\n if(n<=1){\n return 1;\n }else{\n return ((3*cal(n-1))%(1000000+3));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f147333bb3d2a55f1d1388463ac51cc3", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ACming\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int o = 1;\n\n for (int i = 2; i <= n; i++)\n o = o * 3 % 1000003;\n\n Console.WriteLine(o);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "10784e6659fa2f803cfe0e1e3c70a26d", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Codeforces_063_A\n{\n class Program\n {\n static void Main()\n {\n string s;\n s = Console.ReadLine();\n int n = int.Parse(s);\n\n n--;\n int ans=1;\n for (int i = 0; i < n; i++)\n {\n ans *= 3;\n if (ans>1000003)\n ans = ans % 1000003;\n }\n Console.WriteLine(ans);\n // Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7896d343eaea7972337adabad63c336a", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_070A {\n class Program {\n static void Main(string[] args) {\n int n=int.Parse(Console.ReadLine());\n int o=1;\n for(int i=2;i<=n;i++) o=(o*3)%1000003;\n Console.WriteLine(o);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c86980cb5fcf0a21be98ff0968e798a8", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace pro\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int ans = power3(n - 1);\n Console.WriteLine(ans);\n }\n\n public static int power3(int n)\n {\n var result = 1;\n for (var i = 0; i < n; i++)\n result = result * 3 % 1000003;\n\n return result;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6e560ffc05b9480bdcab991d06529ca", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "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 public class Program\n {\n public 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 StringBuilder sb = new StringBuilder();\n static Random rand = new Random(52345235);\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 static int Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"_input\"));\n Parser parser = new Parser();\n while (!parser.SeekEOF)\n {\n int n = parser.ReadInt();\n int res = 1;\n if (n > 0)\n {\n for (int i = 0; i < n-1; i++)\n res = (res * 3) % 1000003;\n }\n\n Console.WriteLine(res);\n }\n\n return 0;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b91acfdb266ac72e5366582f243e2864", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace prog_coder_26_03_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n == 0)\n {\n Console.WriteLine(\"1\");\n return;\n }\n if (n == 1)\n {\n Console.WriteLine(\"1\");\n return;\n }\n --n;\n int a = 1;\n for (int i = 0; i < n; ++i)\n {\n a *= 3;\n a %= 1000003;\n }\n Console.WriteLine(a);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc0feb785c9c604e3a57ab0c796ffb33", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Prob70A\n {\n //Fangy collects cookies. Once he decided to take a box and put cookies into it in some way. If we take a square \n //k\u2009\u00d7\u2009k in size, divided into blocks 1\u2009\u00d7\u20091 in size and paint there the main diagonal together with cells, which \n //lie above it, then the painted area will be equal to the area occupied by one cookie k in size. Fangy also has \n //a box with a square base 2^n\u2009\u00d7\u20092^n, divided into blocks 1\u2009\u00d7\u20091 in size. In a box the cookies should not overlap, \n //and they should not be turned over or rotated.\n\n\n //To stack the cookies the little walrus uses the following algorithm. He takes out of the repository the largest \n //cookie which can fit in some place in the box and puts it there. Everything could be perfect but alas, in the \n //repository the little walrus has infinitely many cookies of size 2 and larger, and there are no cookies of size \n //1, therefore, empty cells will remain in the box. Fangy wants to know how many empty cells will be left in the \n //end.\n\n int n; //dimensions of the box\n\n public Prob70A(int nn)\n {\n n = nn;\n }\n\n public int solve()\n {\n if (n < 2)\n {\n return 1;\n }\n return modularPow(3, n - 1, 1000003);\n }\n\n private static int modularPow(int b, int exp, int mod)\n {\n int c = 1;\n for (int i = 0; i < exp; ++i)\n {\n c = (c * b) % mod;\n }\n return c;\n }\n\n public override String ToString()\n {\n return \"\";\n }\n\n static void Main(string[] args)\n {\n int nn = Convert.ToInt32(Console.ReadLine());\n Prob70A prob = new Prob70A(nn);\n Console.WriteLine(prob.solve());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9ff9ba506aa4bddf5b4c79c416d85dec", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\n\nclass P { \n static void Main() {\n var n = int.Parse(Console.ReadLine()) - 1;\n var res = 1;\n while (n --> 0) res = (res * 3) % 1000003;\n Console.Write(res);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b47a011f4d03b7c36bcfd5e54ca6f5d8", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Cookies\n{\n internal class Program\n {\n private const int mod = 1000003;\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*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();\n\n if (n == 0)\n writer.WriteLine(\"1\");\n else\n {\n writer.WriteLine(Pow(3, n - 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d0d622f3a3a4a5631bbeefe7021ee8f8", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass A\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine()) - 1;\n var r = 1;\n\n for (var i = 0; i < n; i++)\n r = (r * 3) % 1000003;\n\n Console.Write(r);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "780a427d3795acc2c3a7ec39e546879d", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace Learning\n{\n class Program\n {\n static bool s_multiTest = false;\n static void Main(string[] args)\n {\n var o = Console.Out;\n var nTest = 1;\n if (s_multiTest)\n {\n nTest = NextInt();\n }\n\n for (int testId = 1; testId <= nTest; testId++)\n {\n Solve(testId, o);\n }\n Console.ReadLine();\n }\n static int MOD = (int)1e6 + 3;\n private static void Solve(int testId, TextWriter o)\n {\n var n = NextInt();\n long ans = recur(n);\n o.WriteLine(ans % MOD);\n }\n\n private static long recur(int n)\n {\n if (n == 1 || n == 0)\n return 1;\n long ans = 0;\n ans += ((recur(n - 1) % MOD) * 3) % MOD;\n return ans;\n }\n\n static int s_index = 0;\n static string[] s_tokens;\n private static string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Length)\n {\n s_tokens = Console.ReadLine().Split(' ').ToArray();\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6e786e11b4daeb12191f273fc5042dd7", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace Iran\n{\n class Amir\n {\n public static void Main()\n {\n int n=Convert.ToInt32(Console.ReadLine());\n if(n==0)\n {\n Console.WriteLine(\"1\");\n }\n else\n {\n int ans=1;\n for(int i=1;i Convert.ToInt32(x));\n\n\n long ans = CNK(n - 1, A[0]);\n\n int m = n - A[0];\n for (int i = 1; i < 10; i++) {\n ans *= CNK(m, A[i]);\n m -= A[i];\n }\n\n for (int i = 0; i < m; i++) {\n ans *= 9;\n }\n\n Console.WriteLine(ans);\n\t }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bbd4a32d1ff2148e7675c6b857b8921c", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0} {"lang": "Mono C#", "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 // Mono lacks this override of string.Join()\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 int[] minQ;\n\n const int M = 1000000007;\n\n static int C(int n, int k)\n {\n return sar_cs_structs.Combinations.Count(n + k - 1, k) % M;\n }\n\n static long f(int n, int d)\n {\n checked\n {\n //if (d == 10) return n == 0 ? 1 : 0;\n if (n < minQ[d]) return 0;\n //if (n == 0) return 0;\n\n if (n == 0 || d > 9) throw new Exception();\n\n long result = 0;\n for (int i = minQ[d]; i <= n; i++)\n {\n long t1;\n\n if (i == 0)\n {\n if (d == 9) t1 = n == 0 ? 1 : 0;\n else t1 = f(n, d + 1);\n }\n else if (i == n)\n {\n if (minQ.Skip(d + 1).Any(q => q > 0)) t1 = 0;\n else if (d == 0 && i > 1) t1 = 0;\n else t1 = 1;\n }\n else\n {\n if (d == 9)\n t1 = 0;\n else\n {\n t1 = f(n - i, d + 1);\n long t2 = d == 0 ? C(n - i, i) : C(n - i + 1, i);\n //t2 /= sar_cs_structs.Permutations.Factorial(i);\n t1 *= t2;\n }\n }\n\n t1 %= M;\n result = (result + t1) % M;\n }\n\n return result;\n }\n }\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 int n = parser.ReadInt();\n minQ = parser.ReadIntArr(10);\n\n //for (int i = 100; i <= 999; i++) if (i.ToString().Contains('0') && i.ToString().Contains('1')) Console.WriteLine(i);\n //Console.WriteLine(\"\");\n //Console.Write(f(3, 0));\n\n for (int d = 0; d <= 9; d++)\n {\n Console.Write(\"d=\" + d + \": \");\n for (int i = 1; i <= n; i++)\n Console.Write(f(i, d) + \" \");\n Console.WriteLine();\n }\n\n Console.WriteLine(f(n, 0));\n }\n }\n }\n\n //static void Main(string[] args)\n //{\n // new Thread(Main2, 50 << 20).Start();\n //}\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ff6b70fb46e52d479fdb2d6b2c025890", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0} {"lang": "Mono C#", "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 // Mono lacks this override of string.Join()\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 int[] minQ;\n\n const int M = 1000000007;\n\n static int[,] C = GetCountModTable(100, 100, M);\n\n static public int[,] GetCountModTable(int maxN, int maxK, int Mod)\n {\n if (maxN < 0 || maxK < 0) throw new ArgumentException();\n if (Mod > int.MaxValue / 2) throw new ArgumentOutOfRangeException();\n var result = new int[maxN + 1, maxK + 1];\n for (int n = 0; n <= maxN; n++)\n for (int k = 0; k <= maxK; k++)\n if (k == 0) result[n, k] = 1;\n else if (n == 0) result[n, k] = 0;\n else result[n, k] = (result[n - 1, k] + result[n, k - 1]) % Mod;\n return result;\n }\n\n static int[,] fcache;\n\n static long f(int n, int d)\n {\n checked\n {\n //if (d == 10) return n == 0 ? 1 : 0;\n if (n < minQ[d]) return 0;\n //if (n == 0) return 0;\n\n if (n == 0 || d > 9) throw new Exception();\n\n if (fcache[n, d] != 0) return fcache[n, d] - 1;\n\n long result = 0;\n for (int i = minQ[d]; i <= n; i++)\n {\n long t1;\n\n if (i == 0)\n {\n if (d == 9) t1 = n == 0 ? 1 : 0;\n else t1 = f(n, d + 1);\n }\n else if (i == n)\n {\n if (minQ.Skip(d + 1).Any(q => q > 0)) t1 = 0;\n else if (d == 0 && i > 1) t1 = 0;\n else t1 = 1;\n }\n else\n {\n if (d == 9)\n t1 = 0;\n else\n {\n t1 = f(n - i, d + 1);\n var t2 = d == 0 ? C[n - i, i] : C[n - i + 1, i];\n t1 *= t2;\n }\n }\n\n t1 %= M;\n result = (result + t1) % M;\n }\n\n fcache[n, d] = (int)result + 1;\n return result;\n }\n }\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 int n = parser.ReadInt();\n minQ = parser.ReadIntArr(10);\n\n //for (int i = 100; i <= 999; i++) if (i.ToString().Contains('0') && i.ToString().Contains('1')) Console.WriteLine(i);\n //Console.WriteLine(\"\");\n\n //Console.WriteLine(f(3, 0));\n\n //for (int d = 0; d <= 9; d++)\n //{\n // Console.Write(\"d=\" + d + \": \");\n // for (int i = 1; i <= n; i++)\n // Console.Write(f(i, d) + \" \");\n // Console.WriteLine();\n //}\n\n fcache = new int[101, 10];\n long result = 0;\n for (int i = 1; i <= n; i++)\n result = (result + f(i, 0)) % M;\n\n if (minQ[0] <= 1 && minQ.Skip(1).All(q => q == 0)) result--;\n\n Console.WriteLine(result);\n }\n }\n }\n\n //static void Main(string[] args)\n //{\n // new Thread(Main2, 50 << 20).Start();\n //}\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "df1c631d8fcd9fba47556fc1dc7e3471", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nclass Solution{\n\t static void Main(string[] args) {\n const int MOD = 1000000007;\n int n = int.Parse(Console.ReadLine());\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));\n\n long ans = 0;\n for (int k = a.Sum(); k <= n; k++) {\n\n long[,] dp = new long[110, 30];\n dp[k, 0] = 1;\n\n for (int j = 0; j < 10; j++)\n for (int i = a[j]; i <= k; i++)\n for (int l = a[j]; l <= i; l++) {\n if (j == 0) dp[i - l, j + 1] = (dp[i - l, j + 1] + dp[i, j] * CNK(i - 1, l) % MOD) % MOD;\n else dp[i - l, j + 1] = (dp[i - l, j + 1] + dp[i, j] * CNK(i, l) % MOD) % MOD;\n }\n\n ans += dp[0, 10];\n ans %= MOD;\n }\n\n Console.WriteLine(ans);\n\t }\n static long CNK(long n, long k) {\n if (k == 0) return 1;\n if (n < k) return 0;\n if (n == k) return 1;\n return (n * CNK(n - 1, k - 1)) / k;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "709b8b144359109ad98ab0d15a02a83a", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nclass Solution{\n\t static void Main(string[] args) {\n int n = int.Parse(Console.ReadLine());\n int[] A = Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));\n\n\n long ans = CNK(n - 1, A[0]);\n\n int m = n - A[0];\n for (int i = 1; i < 10; i++) {\n ans *= CNK(m, A[i]);\n m -= A[i];\n ans %= 1000000007;\n }\n\n for (int i = 0; i < m; i++) {\n ans *= 9;\n ans %= 1000000007;\n }\n\n Console.WriteLine(ans);\n\t }\n static long CNK(long n, long k) {\n if (k == 0) return 1;\n if (n < k) return 0;\n if (n == k) return 1;\n return (n * CNK(n - 1, k - 1)) / k;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cb2cb32d915e1612804182502772fd49", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\npublic static class Program\n{\n\n public static void Main()\n {\n var nn = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = nn[0];\n var k = nn[1];\n string s = Console.ReadLine();\n bool[,] dp = new bool[105,105];\n for(int i = 0;i < 105;i++)\n for(int j = 0;j < 105;j++)\n dp[i,j] = false;\n dp[0,0] = true;\n int mx = 0,mn = 0;\n int sz = 0;\n bool ans = false;\n for(int i = 0;i < n;i++)\n if(s[i] == 'N')\n sz++;\n else\n {\n if(sz > mn)\n mn = sz;\n sz = 0;\n }\n if(sz > mn)\n mn = sz;\n if(mn > k)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for(int i = 1;i <= n;i++)\n {\n if(s[i - 1] == 'Y')\n dp[i,0] = true;\n if(s[i - 1] == 'N' || s[i - 1] == '?')\n {\n for(int j = 1;j <= i;j++)\n if(dp[i - 1,j - 1])\n dp[i,j] = true;\n }\n \n if(dp[i,k])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fd4ab4beb78233632a227d7bd82d96a5", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n var nn = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var k = nn[1];\n var n = nn[0];\n string str;\n str = Console.ReadLine();\n var cur1 = 0;\n var cur2 = 0;\n var mx1 = 0;\n var mx2 = 0;\n for (var i = 0; i < n; i++) {\n if (str[i] == 'Y') {\n cur1 = 0;\n cur2 = 0;\n }\n else if (str[i] == 'N') {\n cur1++;\n cur2++;\n }\n else {\n cur1 = 0;\n cur2++;\n }\n if (cur1 > mx1) {\n mx1 = cur1;\n }\n if (cur2 > mx2) {\n mx2 = cur2;\n }\n }\n if (mx1 <= k && k <= mx2) {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "18785c01ebcd33079f87a19aa7c2e9ee", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace sharp_ACM\n{\n \n\n class Program\n {\n public static int[] ReadInts()\n {\n return Console\n .ReadLine()\n .Split()\n .Select(int.Parse)\n .ToArray();\n }\n\n public static int ReadInt()\n {\n return ReadInts().Single();\n }\n\n public static string[] ReadStrings()\n {\n return Console\n .ReadLine()\n .Split();\n }\n\n static long GetLong(string a)\n {\n if (!a.Contains(\".\"))\n return long.Parse(a) * 100;\n if (a[a.Length - 2] == '.')\n return long.Parse(a.Replace(\".\", \"\")) * 10;\n return long.Parse(a.Replace(\".\", \"\"));\n }\n\n static void Main(string[] args)\n {\n int n, k;\n var nkstr = ReadInts();\n n = nkstr[0];\n k = nkstr[1];\n var line = Console.ReadLine();\n HashSet totalPossible = new HashSet();\n totalPossible.Add(0);\n HashSet possibleLens;\n possibleLens = new HashSet();\n possibleLens.Add(0);\n var definitely = 0;\n int cur = 0;\n for (int i = 0; i < n; ++i)\n {\n if (line[i] == 'N')\n cur++;\n else\n cur = 0;\n definitely = Math.Max(definitely, cur);\n }\n if (k < definitely)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for (int i = 0; i < n; ++i)\n {\n var newPossible = new HashSet();\n if (line[i] == 'Y')\n {\n possibleLens.Clear();\n possibleLens.Add(0);\n }\n else if (line[i] == 'N')\n {\n foreach (var pos in possibleLens)\n {\n newPossible.Add(pos + 1);\n }\n possibleLens = newPossible;\n }\n else if (line[i] == '?')\n {\n foreach (var pos in possibleLens)\n newPossible.Add(pos + 1);\n newPossible.Add(0);\n possibleLens = newPossible;\n }\n foreach (var pos in possibleLens)\n totalPossible.Add(pos);\n }\n if (totalPossible.Contains(k))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n/*\n\n*/\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "23f8f30f72eacb1304983fbb8605d20f", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\npublic static class Program\n{\n\n public static void Main()\n {\n var nn = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = nn[0];\n var k = nn[1];\n string s = Console.ReadLine();\n bool[,] dp = new bool[105,105];\n for(int i = 0;i < 105;i++)\n for(int j = 0;j < 105;j++)\n dp[i,j] = false;\n dp[0,0] = true;\n int mx = 0,mn = 0;\n int sz = 0;\n bool ans = false;\n for(int i = 0;i < n;i++)\n if(s[i] == 'N')\n sz++;\n else\n {\n if(sz > mn)\n mn = sz;\n sz = 0;\n }\n if(sz > mn)\n mn = sz;\n if(mn > k)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for(int i = 1;i < n;i++)\n {\n if(s[i - 1] == 'Y')\n dp[i,0] = true;\n if(s[i - 1] == 'N' || s[i - 1] == '?')\n {\n for(int j = 1;j <= i;j++)\n if(dp[i - 1,j - 1])\n dp[i,j] = true;\n }\n \n if(dp[i,k])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8a58225c0334bb126fab3a36a26d475e", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n static void Main()\n {\n string text = Console.ReadLine();\n string[] nums = text.Split(' ');\n \n int n = Convert.ToInt32(nums[0]);\n int k = Convert.ToInt32(nums[1]);\n string str = Console.ReadLine();\n str = \"Y\"+str+\"Y\";\n int max = 0;\n int cur = 0;\n \n \n for (int i = 1; i < n+1; i++)\n { \n if( str[i] == 'N')\n {\n cur++;\n }\n else //if(str[i] == 'Y'|'?')\n {\n cur=0;\n }\n \n if(cur > max) max=cur;\n }\n bool find = false;\n //Console.WriteLine(k);\n //Console.WriteLine(str);\n if(k>=max)\n {\n for (int i = k+1; i < n+2; i++)\n { \n if((str[i]=='?' || str[i]=='Y') && (str[i-k-1]=='?' || str[i-k-1]=='Y'))\n {\n //Console.WriteLine(i);\n find = true;\n for(int j=1;j mx1) {\n mx1 = cur1;\n }\n if (cur2 > mx2) {\n mx2 = cur2;\n }\n }\n cur2 = 0;\n if (mx1 > k) {\n mx2 = 0;\n }\n for (var i = 0; i <= n - k; i++) {\n cur1 = 1;\n if ((i == 0 || (i > 0 && str[i - 1] != 'N')) && (i + k == n || (i + k < n && str[i + k] != 'N'))) { \n for (var j = 0; j < k; j++) {\n if (str[i + j] == 'Y') {\n cur1 = 0;\n }\n }\n if (cur1 == 1) {\n cur2 = 1;\n }\n }\n }\n if (mx2 == 0) {\n Console.WriteLine(\"NO\");\n }\n else if (cur2 == 1) {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "922b1760aedce8eac353d5fbeca8bdc6", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\npublic static class Program\n{\n public static void Main()\n {\n var tmp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = tmp[0];\n var k = tmp[1];\n var s = Console.ReadLine();\n var max_n = 0;\n var cur_n = 0;\n for (var i = 0; i < n; ++i) {\n if (s[i] == 'N') {\n cur_n++;\n if (cur_n > max_n) {\n max_n = cur_n;\n }\n } else {\n cur_n = 0;\n }\n }\n if (max_n > k) {\n Console.WriteLine(\"NO\");\n return;\n }\n var p = -1;\n var ans = false;\n for (var i = 0; i <= n; ++i) {\n if (i < n && (s[i] == 'N' || s[i] == '?')) {\n if (p == -1) {\n p = i;\n }\n } else if (p != -1) {\n for (int j = p; j + k <= i; ++j) {\n if ((j - 1 < 0 || s[j - 1] != 'N') && (j + k >= n || s[j + k] != 'N')) {\n ans = true;\n }\n }\n p = -1;\n }\n }\n if (ans) {\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "03d4460a2ea58d0b764d815afd565006", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n static void Main()\n {\n string text = Console.ReadLine();\n string[] nums = text.Split(' ');\n \n int n = Convert.ToInt32(nums[0]);\n int k = Convert.ToInt32(nums[1]);\n string str = Console.ReadLine();\n str = \"Y\"+str+\"Y\";\n int max = 0;\n int cur = 0;\n \n \n for (int i = 1; i < n+1; i++)\n { \n if( str[i] == 'N')\n {\n cur++;\n }\n else //if(str[i] == 'Y'|'?')\n {\n cur=0;\n }\n \n if(cur > max) max=cur;\n }\n bool find = false;\n //Console.WriteLine(k);\n //Console.WriteLine(str);\n if(k>=max)\n {\n for (int i = k+1; i < n+2; i++)\n { \n if((str[i]=='?' || str[i]=='Y') && (str[i-k-1]=='?' || str[i-k-1]=='Y'))\n {\n //Console.WriteLine(i);\n find = true;\n for(int j=1;j max_n) {\n max_n = cur_n;\n }\n } else {\n cur_n = 0;\n }\n }\n if (max_n > k) {\n Console.WriteLine(\"NO\");\n return;\n } else if (max_n == k) {\n Console.WriteLine(\"YES\");\n return;\n }\n var p = -1;\n var ans = false;\n for (var i = 0; i <= n; ++i) {\n if (i < n && (s[i] == 'N' || s[i] == '?')) {\n if (p == -1) {\n p = i;\n }\n } else if (p != -1) {\n for (int j = p; j + k <= i; ++j) {\n if ((j - 1 < 0 || s[j - 1] != 'N') && (j + k >= n || s[j + k] != 'N')) {\n ans = true;\n }\n }\n p = -1;\n }\n }\n if (ans) {\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8a21fae7b21cdb27821dcd62731dafc0", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace sharp_ACM\n{\n \n\n class Program\n {\n public static int[] ReadInts()\n {\n return Console\n .ReadLine()\n .Split()\n .Select(int.Parse)\n .ToArray();\n }\n\n public static int ReadInt()\n {\n return ReadInts().Single();\n }\n\n public static string[] ReadStrings()\n {\n return Console\n .ReadLine()\n .Split();\n }\n\n static long GetLong(string a)\n {\n if (!a.Contains(\".\"))\n return long.Parse(a) * 100;\n if (a[a.Length - 2] == '.')\n return long.Parse(a.Replace(\".\", \"\")) * 10;\n return long.Parse(a.Replace(\".\", \"\"));\n }\n\n static void Main(string[] args)\n {\n int n, k;\n var nkstr = ReadInts();\n n = nkstr[0];\n k = nkstr[1];\n var line = Console.ReadLine();\n var totalPossible = new HashSet();\n totalPossible.Add(0);\n var possibleLens = new HashSet {0};\n var definitely = 0;\n int cur = 0;\n for (int i = 0; i < n; ++i)\n {\n if (line[i] == 'N')\n cur++;\n else\n cur = 0;\n definitely = Math.Max(definitely, cur);\n }\n if (k < definitely)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for (int i = 0; i < n; ++i)\n {\n var newPossible = new HashSet();\n if (line[i] == 'Y')\n {\n foreach (var pos in possibleLens)\n totalPossible.Add(pos);\n possibleLens.Clear();\n possibleLens.Add(0);\n }\n else if (line[i] == 'N')\n {\n foreach (var pos in possibleLens)\n {\n newPossible.Add(pos + 1);\n }\n possibleLens = newPossible;\n }\n else if (line[i] == '?')\n {\n foreach (var pos in possibleLens)\n totalPossible.Add(pos);\n foreach (var pos in possibleLens)\n newPossible.Add(pos + 1);\n newPossible.Add(0);\n possibleLens = newPossible;\n }\n }\n foreach (var pos in possibleLens)\n totalPossible.Add(pos);\n if (totalPossible.Contains(k))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n/*\n7 3\nNN?NY??\n\n*/\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "711f031ae97436bc52f3c70969b8e0f8", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t var ss = Console.ReadLine().Trim().Split(' ');\n var n = int.Parse(ss[0]);\n var m = int.Parse(ss[1]);\n var GL = true;\n var HF = false;\n\t\tstring s = Console.ReadLine();\n\t\tfor (int i=0; i+m+1<=n; i++)\n\t\t{\n\t\t var ok = false;\n\t\t for (int j=0; j<=m; j++)\n\t if (s[i+j] != 'N')\n\t\t ok = true;\n\t\t\tif (!ok)\n\t\t\t GL = false;\n\t\t}\n\t\tfor (int i=0; i+m<=n; i++)\n\t\t{\n\t\t var ok = true;\n\t\t for (int j=0; j mx1) {\n mx1 = cur1;\n }\n if (cur2 > mx2) {\n mx2 = cur2;\n }\n }\n cur2 = 0;\n mx2 = 1;\n if (mx1 > k) {\n mx2 = 0;\n }\n for (var i = 0; i <= n - k; i++) {\n cur1 = 1;\n if ((i == 0 || (i > 0 && str[i - 1] != 'N')) && (i + k == n || (i + k < n && str[i + k] != 'N'))) { \n for (var j = 0; j < k; j++) {\n if (str[i + j] == 'Y') {\n cur1 = 0;\n }\n }\n if (cur1 == 1) {\n cur2 = 1;\n }\n }\n }\n if (mx2 == 0) {\n Console.WriteLine(\"NO\");\n }\n else if (cur2 == 1) {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b66017300b00e552a9acde136e39bfcb", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\npublic static class Program\n{\n\n public static void Main()\n {\n var nn = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = nn[0];\n var k = nn[1];\n string s = Console.ReadLine();\n bool[,] dp = new bool[105,105];\n for(int i = 0;i < 105;i++)\n for(int j = 0;j < 105;j++)\n dp[i,j] = false;\n dp[0,0] = true;\n int mx = 0,mn = 0;\n int sz = 0;\n bool ans = false;\n for(int i = 0;i < n;i++)\n if(s[i] == 'N')\n sz++;\n else\n {\n if(sz > mn)\n mn = sz;\n sz = 0;\n }\n if(sz > mn)\n mn = sz;\n if(mn > k)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for(int i = 1;i <= n;i++)\n {\n if(s[i - 1] == 'Y')\n dp[i,0] = true;\n if(s[i - 1] == 'N' || s[i - 1] == '?')\n {\n for(int j = 1;j <= i;j++)\n if(dp[i - 1,j - 1])\n dp[i,j] = true;\n if(s[i - 1] == '?')\n dp[i,0] = true;\n }\n //Console.WriteLine(dp[i,k]);\n if(dp[i,k] && i == n)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if(dp[i - 1,k] && (s[i - 1] == '?' || s[i - 1] == 'Y'))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "43eac9e4e2ae0d35f19d65d911379012", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\n\nclass SOS{\n static void Main(){\n string[] tmp = Console.ReadLine().Split();\n int n=int.Parse(tmp[0]);\n int k=int.Parse(tmp[1]);\n string S=Console.ReadLine();\n int ans=0;\n for(int i=0;i+k-1mx)mx=cur;\n }else{\n cur=0;\n }\n }\n if(mx==k)\n ans=1;\n }\n if(ans==1)\n Console.WriteLine(\"YES\");\n else\n \n Console.WriteLine(\"NO\");\n }\n \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c4269857edf47402bccb36a4ded55956", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\npublic static class Program\n{\n\npublic static void Main()\n{\n\tvar nn = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\tint n = nn[0];\n\tint K = nn[1];\n\tstring s = Console.ReadLine();\n\tbool[,,] dp = new bool[102, 102, 102];\n\tdp[0, 0, 0] = true;\n\tfor (int i = 0; i < n; ++i)\n\t\tfor (int j = 0; j <= n; ++j)\n\t\t\tfor (int k = 0; k <= n; ++k)\n\t\t\t{\n\t\t\t\tif (!dp[i, j, k]) continue;\n\t\t\t\tif (s[i] != 'N') dp[i+1, j, 0] = true;\n\t\t\t\tif (s[i] != 'Y') dp[i+1, Math.Max(j, k+1), k+1] = true;\n\t\t\t}\n\tbool flag = false;\n\tfor (int i = 0; i <= n; ++i) flag |= dp[n, K, i];\n\tConsole.WriteLine(flag ? \"YES\" : \"NO\");\n}\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "168b768fb18d30cb96ff0f0f6d8a37ff", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CSharp\n{\n class _1114C\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n long n = long.Parse(tokens[0]);\n long b = long.Parse(tokens[1]);\n\n var factors = new Dictionary();\n\n for (long i = 2; i <= 1000000; i++)\n {\n long count = 0;\n\n while (b % i == 0)\n {\n b /= i;\n count++;\n }\n\n if (count > 0)\n {\n factors.Add(i, count);\n }\n }\n\n if (b > 1)\n {\n factors.Add(b, 1);\n }\n\n long result = long.MaxValue;\n\n foreach (var f in factors)\n {\n long x = n;\n long count = 0;\n\n while (x >= f.Key)\n {\n x /= f.Key;\n count += x;\n }\n\n result = Math.Min(result, count / f.Value);\n }\n\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7fae59aeb2ed5297fa8d52118912db37", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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 N = cin.nextlong;\n var B = cin.nextlong;\n\n var H = new Map();\n var T = B;\n for (long i = 2; i <= T / i; i++)\n {\n while (T % i == 0)\n {\n T /= i;\n H[i]++;\n }\n }\n if (T != 1)\n {\n H[T]++;\n }\n //var G = new Map();\n //T = N;\n //for (long i = 2; i * i <= T; i++)\n //{\n // while (T % i == 0)\n // {\n // T /= i;\n // G[i]++;\n // }\n //}\n //if (T != 1)\n //{\n // G[T]++;\n //}\n\n long ans = long.MaxValue;\n //foreach (var v in H)\n //{\n // var P = 0L;\n // if(G.ContainsKey(v.Key))\n // {\n // P = G[v.Key];\n // WriteLine(v.Key + \" \" + P);\n // }\n // chmin(ref ans, P / v.Value);\n //}\n\n foreach (var v in H)\n {\n var key = v.Key;\n var P = N / key;\n\n while (N / key >= v.Key)\n {\n key *= v.Key;\n P += N / key;\n }\n var value = v.Value;\n\n var c = P / value;\n\n //WriteLine(P + \" \" + value);\n chmin(ref ans, c);\n }\n WriteLine(ans);\n }\n\n}\n\n\nclass Map : Dictionary\n{\n public new TValue this[TKey key]\n {\n get\n {\n if (!ContainsKey(key))\n {\n base[key] = default(TValue);\n }\n return base[key];\n }\n set\n {\n base[key] = value;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0177ef505bcb39fa07dbcdaa8bb3bc2c", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Numerics;\nusing System.Diagnostics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Runtime.InteropServices;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\n\n\nclass P\n{\n static void Main()\n {\n long[] nb = Console.ReadLine().Split().Select(long.Parse).ToArray();\n //\u3048\u3063\u3068\u3001\u3064\u307e\u308a\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3066\u7d04\u6570\u306e\u6570\u3092\u6570\u3048\u308c\u3070OK\n var factors = Factors(nb[1]);\n long res = long.MaxValue;\n foreach (var factor in factors.GroupBy(x => x))\n {\n long current = factor.Key;\n long count = 0;\n double limit = Sqrt(nb[0] + 100);\n while (nb[0] >= current)\n {\n count += nb[0] / current;\n if (((double)current * (double)factor.Key) >= nb[0] + 114514) break;\n current *= factor.Key;\n }\n res = Min(res, count / factor.Count());\n }\n Console.WriteLine(res);\n }\n\n\n static long[] Factors(long n)\n {\n List res = new List();\n while (n % 2 == 0)\n {\n res.Add(2);\n n /= 2;\n }\n long i = 3;\n double ub = Sqrt(n);\n while (i <= ub + 1)\n {\n if (n % i == 0)\n {\n res.Add(i);\n n /= i;\n }\n else\n {\n i += 2;\n }\n }\n if (n != 1) res.Add(n);\n return res.ToArray();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3f7d87ecd9d7b1da2b189a2f8fce710c", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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 B = long.Parse(str[1]);\n\t\tvar list = PrimeFactors(B);\n\t\tlist.Sort((x,y)=>x.CompareTo(y));\n\t\tvar list2 = new List();\n\t\tlong ta = -1;\n\t\tint ct = -1;\n\t\tfor(var i=0;i PrimeFactors(long n){\n\t\tlong i = 2;\n\t\tlong tmp = n;\n\t\tvar list = new List();\n\t\twhile(i*i<=n){\n\t\t\tif(tmp%i==0){\n\t\t\t\ttmp /= i;\n\t\t\t\tlist.Add(i);\n\t\t\t} else {\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tif(tmp != 1){\n\t\t\tlist.Add(tmp);\n\t\t}\n\t\treturn list;\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9bde969243839a3e25569b3c9f013a47", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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 n = rl;\n\t\t\tvar b = rl;\n\t\t\tvar P = new List();\n\t\t\tfor (long i = 2; i * i <= b; i++) {\n\t\t\t\tvar cnt = 0;\n\t\t\t\twhile (b % i == 0) { b /= i; cnt++; }\n\t\t\t\tif (cnt != 0) P.Add(new long[] { i, cnt });\n\t\t\t}\n\t\t\tif (b != 1) P.Add(new long[] { b, 1 });\n\t\t\tvar min = INF;\n\t\t\tforeach (var p in P) {\n\t\t\t\tvar v = ord(n, p[0]) / p[1];\n\t\t\t\tmin = Min(min, v);\n\t\t\t}\n\t\t\tConsole.WriteLine(min);\n\t\t}\n\t\tlong ord(long n, long p) {\n\t\t\tvar ret = 0L;\n\t\t\twhile (n > 0) {\n\t\t\t\tn /= p;\n\t\t\t\tret += n;\n\t\t\t}\n\t\t\treturn ret;\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#region Set\n/// \n/// \u8981\u7d20\u306e\u8ffd\u52a0\u3001\u524a\u9664\u3001\u691c\u7d22\u3001\u53d6\u5f97\u304c\u53ef\u80fd\u306a\u96c6\u5408\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\u306fAVL\u6728\u306b\u3088\u3063\u3066\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\uff0e\npublic class Set {\n\tNode root;\n\treadonly IComparer comparer;\n\treadonly Node nil;\n\t/// \n\t/// \u591a\u91cd\u96c6\u5408\u304b\u3069\u3046\u304b\u3092\u8868\u3057\u307e\u3059\uff0e\n\t/// \n\tpublic bool IsMultiSet { get; set; }\n\tpublic Set(IComparer comparer) {\n\t\tnil = new Node(default(T));\n\t\troot = nil;\n\t\tthis.comparer = comparer;\n\t}\n\tpublic Set(Comparison comaprison) : this(Comparer.Create(comaprison)) { }\n\tpublic Set() : this(Comparer.Default) { }\n\t/// \n\t/// \u8981\u7d20\u3092\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u8ffd\u52a0\u3057\u307e\u3059\uff0e\n\t/// \n\t/// \u3053\u306e\u64cd\u4f5c\u306f\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n\tpublic bool Add(T v) {\n\t\treturn insert(ref root, v);\n\t}\n\t/// \n\t/// v \u304c\u5b58\u5728\u3059\u308b\u306a\u3089\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304b\u3089\u524a\u9664\u3057\u307e\u3059\uff0e\n\t/// \n\t/// \u3053\u306e\u64cd\u4f5c\u306f\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n\tpublic bool Remove(T v) {\n\t\treturn remove(ref root, v);\n\t}\n\t/// \n\t/// 0-indexed \u3067 index \u756a\u76ee\u306e\u8981\u7d20\u3092\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304b\u3089\u53d6\u5f97\u3057\u307e\u3059\uff0e\uff0e\n\t/// \n\t/// \u3053\u306e\u64cd\u4f5c\u306f\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n\tpublic T this[int index] { get { return find(root, index); } }\n\tpublic int Count { get { return root.Count; } }\n\tpublic void RemoveAt(int k) {\n\t\tif (k < 0 || k >= root.Count) throw new ArgumentOutOfRangeException();\n\t\tremoveAt(ref root, k);\n\t}\n\t/// \n\t/// \u3053\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u542b\u307e\u308c\u308b\u8981\u7d20\u3092\u6607\u9806\u306b\u4e26\u3079\u3066\u8fd4\u3057\u307e\u3059\uff0e\n\t/// \n\t/// \u3053\u306e\u64cd\u4f5c\u306f\u8a08\u7b97\u91cf O(N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n\tpublic T[] Items {\n\t\tget {\n\t\t\tvar ret = new T[root.Count];\n\t\t\tvar k = 0;\n\t\t\twalk(root, ret, ref k);\n\t\t\treturn ret;\n\t\t}\n\t}\n\tvoid walk(Node t, T[] a, ref int k) {\n\t\tif (t.Count == 0) return;\n\t\twalk(t.lst, a, ref k);\n\t\ta[k++] = t.Key;\n\t\twalk(t.rst, a, ref k);\n\t}\n\n\tbool insert(ref Node t, T key) {\n\t\tif (t.Count == 0) { t = new Node(key); t.lst = t.rst = nil; t.Update(); return true; }\n\t\tvar cmp = comparer.Compare(t.Key, key);\n\t\tbool res;\n\t\tif (cmp > 0)\n\t\t\tres = insert(ref t.lst, key);\n\t\telse if (cmp == 0) {\n\t\t\tif (IsMultiSet) res = insert(ref t.lst, key);\n\t\t\telse return false;\n\t\t}\n\t\telse res = insert(ref t.rst, key);\n\t\tbalance(ref t);\n\t\treturn res;\n\t}\n\tbool remove(ref Node t, T key) {\n\t\tif (t.Count == 0) return false;\n\t\tvar cmp = comparer.Compare(key, t.Key);\n\t\tbool ret;\n\t\tif (cmp < 0) ret = remove(ref t.lst, key);\n\t\telse if (cmp > 0) ret = remove(ref t.rst, key);\n\t\telse {\n\t\t\tret = true;\n\t\t\tvar k = t.lst.Count;\n\t\t\tif (k == 0) { t = t.rst; return true; }\n\t\t\tif (t.rst.Count == 0) { t = t.lst; return true; }\n\n\n\t\t\tt.Key = find(t.lst, k - 1);\n\t\t\tremoveAt(ref t.lst, k - 1);\n\t\t}\n\t\tbalance(ref t);\n\t\treturn ret;\n\t}\n\tvoid removeAt(ref Node t, int k) {\n\t\tvar cnt = t.lst.Count;\n\t\tif (cnt < k) removeAt(ref t.rst, k - cnt - 1);\n\t\telse if (cnt > k) removeAt(ref t.lst, k);\n\t\telse {\n\t\t\tif (cnt == 0) { t = t.rst; return; }\n\t\t\tif (t.rst.Count == 0) { t = t.lst; return; }\n\n\t\t\tt.Key = find(t.lst, k - 1);\n\t\t\tremoveAt(ref t.lst, k - 1);\n\t\t}\n\t\tbalance(ref t);\n\t}\n\tvoid balance(ref Node t) {\n\t\tvar balance = t.lst.Height - t.rst.Height;\n\t\tif (balance == -2) {\n\t\t\tif (t.rst.lst.Height - t.rst.rst.Height > 0) { rotR(ref t.rst); }\n\t\t\trotL(ref t);\n\t\t}\n\t\telse if (balance == 2) {\n\t\t\tif (t.lst.lst.Height - t.lst.rst.Height < 0) rotL(ref t.lst);\n\t\t\trotR(ref t);\n\t\t}\n\t\telse t.Update();\n\t}\n\n\tT find(Node t, int k) {\n\t\tif (k < 0 || k > root.Count) throw new ArgumentOutOfRangeException();\n\t\tfor (; ; )\n\t\t{\n\t\t\tif (k == t.lst.Count) return t.Key;\n\t\t\telse if (k < t.lst.Count) t = t.lst;\n\t\t\telse { k -= t.lst.Count + 1; t = t.rst; }\n\t\t}\n\t}\n\t/// \n\t/// \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u542b\u307e\u308c\u308b\u8981\u7d20\u3067\u3042\u3063\u3066\u3001 v \u4ee5\u4e0a\u306e\u6700\u5c0f\u306e\u8981\u7d20\u306e\u756a\u53f7\u3092\u8fd4\u3057\u307e\u3059\u3002\n\t/// \n\t/// \u3053\u306e\u64cd\u4f5c\u306f\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n\tpublic int LowerBound(T v) {\n\t\tvar k = 0;\n\t\tvar t = root;\n\t\tfor (; ; )\n\t\t{\n\t\t\tif (t.Count == 0) return k;\n\t\t\tif (comparer.Compare(v, t.Key) <= 0) t = t.lst;\n\t\t\telse { k += t.lst.Count + 1; t = t.rst; }\n\t\t}\n\t}\n\t/// \n\t/// \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u542b\u307e\u308c\u308b\u8981\u7d20\u3067\u3042\u3063\u3066\u3001 v \u3088\u308a\u771f\u306b\u5927\u304d\u3044\u3001\u6700\u5c0f\u306e\u8981\u7d20\u306e\u756a\u53f7\u3092\u8fd4\u3057\u307e\u3059\u3002\n\t/// \n\t/// \u3053\u306e\u64cd\u4f5c\u306f\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n\tpublic int UpperBound(T v) {\n\t\tvar k = 0;\n\t\tvar t = root;\n\t\tfor (; ; )\n\t\t{\n\t\t\tif (t.Count == 0) return k;\n\t\t\tif (comparer.Compare(t.Key, v) <= 0) { k += t.lst.Count + 1; t = t.rst; }\n\t\t\telse t = t.lst;\n\t\t}\n\t}\n\n\tvoid rotR(ref Node t) {\n\t\tvar l = t.lst;\n\t\tt.lst = l.rst;\n\t\tl.rst = t;\n\t\tt.Update();\n\t\tl.Update();\n\t\tt = l;\n\t}\n\tvoid rotL(ref Node t) {\n\t\tvar r = t.rst;\n\t\tt.rst = r.lst;\n\t\tr.lst = t;\n\t\tt.Update();\n\t\tr.Update();\n\t\tt = r;\n\t}\n\n\n\tclass Node {\n\t\tpublic Node(T key) {\n\t\t\tKey = key;\n\t\t}\n\t\tpublic int Count { get; private set; }\n\t\tpublic sbyte Height { get; private set; }\n\t\tpublic T Key { get; set; }\n\t\tpublic Node lst, rst;\n\t\tpublic void Update() {\n\t\t\tCount = 1 + lst.Count + rst.Count;\n\t\t\tHeight = (sbyte)(1 + Math.Max(lst.Height, rst.Height));\n\t\t}\n\t\tpublic override string ToString() {\n\t\t\treturn string.Format(\"Count = {0}, Key = {1}\", Count, Key);\n\t\t}\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "259c45bbc40be925a67d7e0be048130c", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n long n = ReadLong();\n long b = ReadLong();\n\n long ans = long.MaxValue;\n\n for (long i = 2; i * i <= b; i++)\n {\n if (b % i == 0)\n {\n long t = Calc(n, i, ref b);\n\n ans = Math.Min(ans, t);\n }\n }\n if (b > 1)\n {\n long t = Calc(n, b, ref b);\n\n ans = Math.Min(ans, t);\n }\n\n Writer.WriteLine(ans);\n }\n\n private static long Calc(long n, long i, ref long b)\n {\n long p = 0;\n while (b % i == 0)\n {\n b /= i;\n p++;\n }\n\n long d = n;\n long t = 0;\n while (d > 0)\n {\n d /= i;\n t += d;\n }\n t /= p;\n return t;\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.WriteLine(\"Case {0}:\", i + 1);\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "39cd12e4d458202689501e9dd13a1d37", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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 writer.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 ulong n,b;\n\n\n ulong min = ulong.MaxValue;\n\n ulong compPow(ulong prime)\n {\n ulong rez = 0;\n\n ulong times = 0;\n ulong pow = 1;\n ulong powv = (ulong)prime;\n\n while(true)\n {\n times = n / powv;\n pow++;\n \n rez += times;\n\n if (times == 0)\n break;\n \n if (n / powv / prime < 1)\n break;\n\n powv *= (ulong)prime;\n }\n\n return rez;\n }\n\n public void Solve()\n {\n n = ulong.Parse(ioHelper.ReadNextToken());\n b = ulong.Parse(ioHelper.ReadNextToken());\n\n ulong prime = 2;\n ulong origB = b;\n\n while(prime * prime <= b)\n {\n ulong powInB = 0;\n\n while(b % prime == 0)\n {\n powInB++;\n b /= prime;\n }\n\n if (powInB == 0)\n { prime++;continue; }\n\n var powInFact = compPow(prime);\n\n var times = powInFact / powInB;\n\n if (times < min)\n min = times;\n\n prime++;\n }\n\n if(b>1)\n {\n prime = b;\n\n\n ulong powInB = 0;\n\n while (b % prime == 0)\n {\n powInB++;\n b /= prime;\n }\n\n ulong powInFact = compPow(prime);\n\n ulong times = powInFact / powInB;\n\n if (times < min)\n min = times;\n\n prime++;\n }\n\n\n ioHelper.WriteLine(min.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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ae8056c9dea9ad9f0fda29fd375d31bc", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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 n, b;\n sc.Make(out n, out b);\n var f = Factorize(b);\n var min = long.MaxValue;\n foreach (var p in f)\n {\n var ct = 0L;\n var a = n;\n while (a!=0)\n {\n a /= p.Key;\n ct += a;\n }\n chmin(ref min, ct / p.Value);\n }\n WriteLine(min);\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0e8d7f416e66fce7c6367f9614ea6a75", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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\tWriteLine(Solve());\n\t\tOut.Flush();\n\t}\n\tlong Solve()\n\t{\n\t\tvar I = GL;\n\t\tlong n = I[0], b = I[1];\n\t\tvar ps = GetPrimes(2000000);\n\t\tvar f = Factorize(b, ps);\n\t\tvar ans = long.MaxValue;\n\t\tforeach (var p in f.Keys)\n\t\t{\n\t\t\tvar c = 0L;\n\t\t\tvar m = n / p;\n\t\t\twhile (m > 0) { c += m; m /= p; }\n\t\t\tans = Min(ans, c / f[p]);\n\t\t}\n\t\treturn ans;\n\t}\n\tpublic static Dictionary Factorize(long n, List primes)\n\t{\n\t\tvar d = new Dictionary();\n\t\tfor (var j = 0; j < primes.Count; j++)\n\t\t{\n\t\t\tvar i = primes[j];\n\t\t\tif (i * i > n) break;\n\t\t\tif (n % i == 0)\n\t\t\t{\n\t\t\t\td.Add(i, 0);\n\t\t\t\twhile (n % i == 0) { n /= i; d[i]++; }\n\t\t\t}\n\t\t}\n\t\tif (n > 1) d.Add(n, 1);\n\t\treturn d;\n\t}\n\tpublic static List GetPrimes(int n)\n\t{\n\t\tif (n < 3) n = 3;\n\t\tvar m = (n - 1) >> 1;\n\t\tvar primes = new List((int)(n / Math.Log(n)));\n\t\tprimes.Add(2);\n\t\tvar composites = new bool[m];\n\t\tcomposites[0] = false;\n\t\tfor (var p = 0; p < m; p++)\n\t\t{\n\t\t\tif (!composites[p])\n\t\t\t{\n\t\t\t\tvar pnum = 2 * p + 3;\n\t\t\t\tprimes.Add(pnum);\n\t\t\t\tfor (var k = 3 * p + 3; k < m; k += pnum) composites[k] = true;\n\t\t\t}\n\t\t}\n\t\treturn primes;\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e96f5379391b7cb3310e8cbf23e2fa55", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Trailing_Loves\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 IEnumerable G()\n {\n yield return 2L;\n for (long i = 3;; i += 2)\n {\n yield return i;\n }\n }\n\n private static long Solve(string[] args)\n {\n long n = Next();\n long b = Next();\n\n var list = new List();\n foreach (long i in G())\n {\n if (i*i > b)\n break;\n while (b%i == 0)\n {\n b /= i;\n list.Add(i);\n }\n }\n if (b != 1)\n list.Add(b);\n\n long ans = long.MaxValue;\n foreach (var p in list.GroupBy(t => t).Select(t => new {t.Key, cnt = t.Count()}))\n {\n ans = Math.Min(ans, Count(n, p.Key)/p.cnt);\n }\n\n return ans;\n }\n\n private static long Count(long n, long max)\n {\n long ans = 0;\n for (long i = max;;)\n {\n ans += n/i;\n if (n/max >= i)\n i *= max;\n else\n break;\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dda4f5e9123761d4230f197480b4dfc1", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "/*\ncsc -debug C.cs && mono --debug C.exe <<< \"6 9\"\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.NextUlong();\n var b = cin.NextUlong();\n\n var ans = ulong.MaxValue;\n foreach (var ppow in GetPrimeDivisors(b)) {\n ans = Math.Min(ans, FF( n, ppow[0], ppow[1] ));\n }\n System.Console.WriteLine(ans);\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static IEnumerable GetPrimeDivisors(ulong n) {\n for (var p = 2ul; p * p <= n; p++)\n if (n % p == 0) {\n\n n /= p;\n var pow = 1ul;\n while (n % p == 0) { pow++; n /= p; }\n\n yield return new[] { p, pow };\n }\n if (n > 1)\n yield return new[] { n, 1ul };\n }\n\n static ulong F(ulong n, ulong p) {\n if (n == 1) return 0;\n\n var ans = 0ul;\n\n var i = 1ul;\n var pow = p;\n while (pow <= n) {\n ans += n / pow;\n i++;\n pow *= p;\n }\n\n return ans;\n }\n\n static ulong FF(ulong n, ulong p, ulong pow) {\n return F(n, p) / pow;\n }\n\n static void TestF() {\n for (var n = 2ul; n <= 4; n++) {\n System.Console.WriteLine(n);\n\n var fact = 1ul;\n for (var i = 1ul; i <= n; i++)\n fact *= i;\n\n for (var prime = 2ul; prime <= fact; prime++) {\n if (!Brute_IsPrime(prime)) continue;\n\n for (var pow = 1ul; Math.Pow(prime, pow) <= fact; pow++) {\n\n // System.Console.WriteLine(new { n, prime, pow });\n\n var actual = FF(n, prime, pow);\n\n var apow = (ulong)Math.Pow(prime, pow);\n var expected = 0ul;\n var rem = fact;\n while (rem % apow == 0) {\n expected++;\n rem /= apow;\n }\n\n if (expected != actual) {\n System.Console.WriteLine(\"Err\");\n System.Console.WriteLine(new { n, fact, prime, pow, actual, expected });\n return;\n }\n\n }\n }\n }\n }\n\n public static ulong Pow(ulong x, ulong exp) {\n ulong ret = 1ul;\n while (exp > 0) {\n if (exp % 2 == 1) ret = ret * x;\n x = x * x;\n exp /= 2;\n }\n return ret;\n }\n\n static bool Brute_IsPrime(ulong a) {\n if (a <= 1ul) return false;\n for (var i = 2ul; i * i <= a; i++)\n if (a % i == 0)\n return false;\n return true;\n }\n\n static public void Main () {\n SolveCodeForces();\n // TestF();\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7988072f51c621fd829e4b9fee38e587", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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 writer.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 ulong n,b;\n\n\n ulong min = long.MaxValue;\n\n ulong compPow(ulong prime)\n {\n ulong rez = 0;\n\n ulong times = 0;\n ulong pow = 1;\n ulong powv = (ulong)prime;\n\n while(true)\n {\n times = n / powv;\n pow++;\n powv *= (ulong)prime;\n\n rez += times;\n\n if (times == 0)\n break;\n }\n\n return rez;\n }\n\n public void Solve()\n {\n n = ulong.Parse(ioHelper.ReadNextToken());\n b = ulong.Parse(ioHelper.ReadNextToken());\n\n ulong prime = 2;\n ulong origB = b;\n\n while(prime * prime <= b)\n {\n ulong powInB = 0;\n\n while(b % prime == 0)\n {\n powInB++;\n b /= prime;\n }\n\n if (powInB == 0)\n { prime++;continue; }\n\n var powInFact = compPow(prime);\n\n var times = powInFact / powInB;\n\n if (times < min)\n min = times;\n\n prime++;\n }\n\n if(b>1)\n {\n prime = b;\n\n\n ulong powInB = 0;\n\n while (b % prime == 0)\n {\n powInB++;\n b /= prime;\n }\n\n ulong powInFact = compPow(prime);\n\n ulong times = powInFact / powInB;\n\n if (times < min)\n min = times;\n\n prime++;\n }\n\n\n ioHelper.WriteLine(min.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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1d74bd3196feacd4406c233b8e0317e0", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Numerics;\nusing System.Diagnostics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Runtime.InteropServices;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\n\n\nclass P\n{\n static void Main()\n {\n long[] nb = Console.ReadLine().Split().Select(long.Parse).ToArray();\n //\u3048\u3063\u3068\u3001\u3064\u307e\u308a\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3066\u7d04\u6570\u306e\u6570\u3092\u6570\u3048\u308c\u3070OK\n var factors = Factors(nb[1]);\n long res = long.MaxValue;\n foreach (var factor in factors.GroupBy(x => x))\n {\n long current = factor.Key;\n long count = 0;\n double limit = Sqrt(nb[0] + 100);\n while (nb[0] >= current)\n {\n count += nb[0] / current;\n if (((double)current * (double)factor.Key) >= nb[0] + 114514) break;\n current *= factor.Key;\n }\n res = Min(res, count / factor.Count());\n }\n Console.WriteLine(res);\n }\n\n\n static long[] Factors(long n)\n {\n List res = new List();\n if(n % 2 == 0)\n {\n res.Add(2);\n n /= 2;\n }\n long i = 3;\n double ub = Sqrt(n);\n while (i <= ub + 100)\n {\n if (n % i == 0)\n {\n res.Add(i);\n n /= i;\n }\n else\n {\n i += 2;\n }\n }\n if (n != 1) res.Add(n);\n return res.ToArray();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0405a95b327aac458ac09437f26531ce", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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 B = long.Parse(str[1]);\n\t\tvar list = PrimeFactors(B);\n\t\tlist.Sort((x,y)=>x.CompareTo(y));\n\t\tvar list2 = new List();\n\t\tlong ta = -1;\n\t\tint ct = -1;\n\t\tfor(var i=0;iN){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(min==-1){\n\t\t\t\tmin = ctb/list2[i][1];\n\t\t\t} else {\n\t\t\t\tmin = Math.Min(min,ctb/list2[i][1]);\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(min);\n\t}\n\t\n\tpublic static List PrimeFactors(long n){\n\t\tlong i = 2;\n\t\tlong tmp = n;\n\t\tvar list = new List();\n\t\twhile(i*i<=n){\n\t\t\tif(tmp%i==0){\n\t\t\t\ttmp /= i;\n\t\t\t\tlist.Add(i);\n\t\t\t} else {\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tif(tmp != 1){\n\t\t\tlist.Add(tmp);\n\t\t}\n\t\treturn list;\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1f3d6a5a31f9b0a0393fd9ced0559334", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CSharp\n{\n class _1114C\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n long n = long.Parse(tokens[0]);\n long b = long.Parse(tokens[1]);\n\n var factors = new Dictionary();\n\n for (int i = 2; i <= 1000000; i++)\n {\n long count = 0;\n\n while (b % i == 0)\n {\n b /= i;\n count++;\n }\n\n if (count > 0)\n {\n factors.Add(i, count);\n }\n }\n\n if (b > 1)\n {\n factors.Add(b, 1);\n }\n\n long result = int.MaxValue;\n\n foreach (var f in factors)\n {\n long x = n;\n long count = 0;\n\n while (x >= f.Key)\n {\n x /= f.Key;\n count += x;\n }\n\n result = Math.Min(result, count / f.Value);\n }\n\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eb54cc223ffd4ef1b71538c908234efe", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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 writer.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 n,b;\n\n\n long min = long.MaxValue;\n\n long compPow(long prime)\n {\n long rez = 0;\n\n long times = 0;\n long pow = 1;\n long powv = prime;\n\n while(true)\n {\n times = n / powv;\n pow++;\n powv *= prime;\n\n rez += times;\n\n if (times == 0)\n break;\n }\n\n return rez;\n }\n\n public void Solve()\n {\n n = long.Parse(ioHelper.ReadNextToken());\n b = long.Parse(ioHelper.ReadNextToken());\n\n long prime = 2;\n long origB = b;\n\n while(prime * prime <= b)\n {\n long powInB = 0;\n\n while(b % prime == 0)\n {\n powInB++;\n b /= prime;\n }\n\n if (powInB == 0)\n { prime++;continue; }\n\n long powInFact = compPow(prime);\n\n long times = powInFact / powInB;\n\n if (times < min)\n min = times;\n\n prime++;\n }\n\n if(b>1)\n {\n prime = b;\n\n\n long powInB = 0;\n\n while (b % prime == 0)\n {\n powInB++;\n b /= prime;\n }\n\n long powInFact = compPow(prime);\n\n long times = powInFact / powInB;\n\n if (times < min)\n min = times;\n\n prime++;\n }\n\n\n ioHelper.WriteLine(min.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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4d8ac857259909cc6f3458f6d61713d1", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Numerics;\nusing System.Diagnostics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Runtime.InteropServices;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\n\n\nclass P\n{\n static void Main()\n {\n long[] nb = Console.ReadLine().Split().Select(long.Parse).ToArray();\n //\u3048\u3063\u3068\u3001\u3064\u307e\u308a\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3066\u7d04\u6570\u306e\u6570\u3092\u6570\u3048\u308c\u3070OK\n var factors = Factors(nb[1]);\n long res = long.MaxValue;\n foreach (var factor in factors.GroupBy(x => x))\n {\n var current = factor.Key;\n long count = 0;\n while (nb[0] >= current)\n {\n count += nb[0] / current;\n if (current <= int.MaxValue) current *= factor.Key;\n else break;\n }\n res = Min(res, count / factor.Count());\n }\n Console.WriteLine(res);\n }\n\n\n static long[] Factors(long n)\n {\n List res = new List();\n if(n % 2 == 0)\n {\n res.Add(2);\n n /= 2;\n }\n long i = 3;\n double ub = Sqrt(n);\n while (i <= ub + 1)\n {\n if (n % i == 0)\n {\n res.Add(i);\n n /= i;\n }\n else\n {\n i += 2;\n }\n }\n if (n != 1) res.Add(n);\n return res.ToArray();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "19ebea63c509d2b36d44c25465ef5fe0", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Numerics;\nusing System.Diagnostics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Runtime.InteropServices;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\n\n\nclass P\n{\n static void Main()\n {\n long[] nb = Console.ReadLine().Split().Select(long.Parse).ToArray();\n //\u3048\u3063\u3068\u3001\u3064\u307e\u308a\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3066\u7d04\u6570\u306e\u6570\u3092\u6570\u3048\u308c\u3070OK\n var factors = Factors(nb[1]);\n long res = long.MaxValue;\n foreach (var factor in factors.GroupBy(x => x))\n {\n long current = factor.Key;\n long count = 0;\n double rimit = Sqrt(nb[0] + 100);\n while (nb[0] >= current)\n {\n count += nb[0] / current;\n if (current <= rimit) current *= factor.Key;\n else break;\n }\n res = Min(res, count / factor.Count());\n }\n Console.WriteLine(res);\n }\n\n\n static long[] Factors(long n)\n {\n List res = new List();\n if(n % 2 == 0)\n {\n res.Add(2);\n n /= 2;\n }\n long i = 3;\n double ub = Sqrt(n);\n while (i <= ub + 1)\n {\n if (n % i == 0)\n {\n res.Add(i);\n n /= i;\n }\n else\n {\n i += 2;\n }\n }\n if (n != 1) res.Add(n);\n return res.ToArray();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f0052bf2a398698e0e11935587dddf0f", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Numerics;\nusing System.Diagnostics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Runtime.InteropServices;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\n\n\nclass P\n{\n static void Main()\n {\n long[] nb = Console.ReadLine().Split().Select(long.Parse).ToArray();\n //\u3048\u3063\u3068\u3001\u3064\u307e\u308a\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3066\u7d04\u6570\u306e\u6570\u3092\u6570\u3048\u308c\u3070OK\n var factors = Factors(nb[1]);\n long res = long.MaxValue;\n foreach (var factor in factors.GroupBy(x => x))\n {\n var current = factor.Key;\n long count = 0;\n while (nb[0] >= current)\n {\n count += nb[0] / current;\n if (current <= 1e8) current *= factor.Key;\n else break;\n }\n res = Min(res, count / factor.Count());\n }\n Console.WriteLine(res);\n }\n\n\n static long[] Factors(long n)\n {\n List res = new List();\n if(n % 2 == 0)\n {\n res.Add(2);\n n /= 2;\n }\n long i = 3;\n double ub = Sqrt(n);\n while (i <= ub + 1)\n {\n if (n % i == 0)\n {\n res.Add(i);\n n /= i;\n }\n else\n {\n i += 2;\n }\n }\n if (n != 1) res.Add(n);\n return res.ToArray();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "34fae1a5cc3a2e96d0d916433c4f1d90", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Numerics;\nusing System.Diagnostics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Runtime.InteropServices;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\n\n\nclass P\n{\n static void Main()\n {\n long[] nb = Console.ReadLine().Split().Select(long.Parse).ToArray();\n //\u3048\u3063\u3068\u3001\u3064\u307e\u308a\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3066\u7d04\u6570\u306e\u6570\u3092\u6570\u3048\u308c\u3070OK\n var factors = Factors(nb[1]);\n long res = long.MaxValue;\n foreach (var factor in factors.GroupBy(x => x))\n {\n long current = factor.Key;\n long count = 0;\n double rimit = Sqrt(nb[0] + 100);\n while (nb[0] >= current)\n {\n count += nb[0] / current;\n if (((double)current * (double)factor.Key) <= nb[0] + 114514) current *= factor.Key;\n else break;\n }\n res = Min(res, count / factor.Count());\n }\n Console.WriteLine(res);\n }\n\n\n static long[] Factors(long n)\n {\n List res = new List();\n if(n % 2 == 0)\n {\n res.Add(2);\n n /= 2;\n }\n long i = 3;\n double ub = Sqrt(n);\n while (i <= ub + 1)\n {\n if (n % i == 0)\n {\n res.Add(i);\n n /= i;\n }\n else\n {\n i += 2;\n }\n }\n if (n != 1) res.Add(n);\n return res.ToArray();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5326ae4c78f53c0959452d8423e07915", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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 N = cin.nextlong;\n var B = cin.nextlong;\n\n var H = new Map();\n var T = B;\n for (long i = 2; i <= T / i; i++)\n {\n while (T % i == 0)\n {\n T /= i;\n H[i]++;\n }\n }\n if (T != 1)\n {\n H[T]++;\n }\n //var G = new Map();\n //T = N;\n //for (long i = 2; i * i <= T; i++)\n //{\n // while (T % i == 0)\n // {\n // T /= i;\n // G[i]++;\n // }\n //}\n //if (T != 1)\n //{\n // G[T]++;\n //}\n\n long ans = long.MaxValue;\n //foreach (var v in H)\n //{\n // var P = 0L;\n // if(G.ContainsKey(v.Key))\n // {\n // P = G[v.Key];\n // WriteLine(v.Key + \" \" + P);\n // }\n // chmin(ref ans, P / v.Value);\n //}\n\n foreach (var v in H)\n {\n var key = v.Key;\n var P = N / key;\n\n while (N / key >= key)\n {\n key *= key;\n P += N / key;\n }\n var value = v.Value;\n\n var c = P / value;\n\n //WriteLine(P + \" \" + value);\n chmin(ref ans, c);\n }\n WriteLine(ans);\n }\n\n}\n\n\nclass Map : Dictionary\n{\n public new TValue this[TKey key]\n {\n get\n {\n if (!ContainsKey(key))\n {\n base[key] = default(TValue);\n }\n return base[key];\n }\n set\n {\n base[key] = value;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5902bd15d27855cfc6e6b662237ce1d9", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "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 writer.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 n,b;\n\n\n long min = long.MaxValue;\n\n long compPow(long prime)\n {\n long rez = 0;\n\n long times = 0;\n long pow = 1;\n long powv = prime;\n\n while(true)\n {\n times = n / powv;\n pow++;\n powv *= prime;\n\n rez += times;\n\n if (times == 0)\n break;\n }\n\n return rez;\n }\n\n public void Solve()\n {\n n = long.Parse(ioHelper.ReadNextToken());\n b = long.Parse(ioHelper.ReadNextToken());\n\n long prime = 2;\n long origB = b;\n\n while(prime * prime <= b)\n {\n long powInB = 0;\n\n while(b % prime == 0)\n {\n powInB++;\n b /= prime;\n }\n\n if (powInB == 0)\n continue;\n\n long powInFact = compPow(prime);\n\n long times = powInFact / powInB;\n\n if (times < min)\n min = times;\n\n prime++;\n }\n\n if(b>1)\n {\n prime = b;\n\n\n long powInB = 0;\n\n while (b % prime == 0)\n {\n powInB++;\n b /= prime;\n }\n\n long powInFact = compPow(prime);\n\n long times = powInFact / powInB;\n\n if (times < min)\n min = times;\n\n prime++;\n }\n\n\n ioHelper.WriteLine(min.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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c84090da9dc6926c2230d704e647fdbf", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Numerics;\nusing System.Diagnostics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Runtime.InteropServices;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\n\n\nclass P\n{\n static void Main()\n {\n long[] nb = Console.ReadLine().Split().Select(long.Parse).ToArray();\n //\u3048\u3063\u3068\u3001\u3064\u307e\u308a\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3066\u7d04\u6570\u306e\u6570\u3092\u6570\u3048\u308c\u3070OK\n var factors = Factors(nb[1]);\n long res = long.MaxValue;\n foreach (var factor in factors.GroupBy(x => x))\n {\n var current = factor.Key;\n long count = 0;\n while (nb[0] >= current)\n {\n count += nb[0] / current;\n if (current <= 1e8) current *= factor.Key;\n }\n res = Min(res, count / factor.Count());\n }\n Console.WriteLine(res);\n }\n\n\n static long[] Factors(long n)\n {\n List res = new List();\n if(n % 2 == 0)\n {\n res.Add(2);\n n /= 2;\n }\n long i = 3;\n double ub = Sqrt(n);\n while (i <= ub + 1)\n {\n if (n % i == 0)\n {\n res.Add(i);\n n /= i;\n }\n else\n {\n i += 2;\n }\n }\n if (n != 1) res.Add(n);\n return res.ToArray();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f0e00243df22121ef864209751806150", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] akk = new int[3];\n for (int i = 0; i < 3; i++)\n {\n switch (input[i])\n {\n case \"C\": akk[i] = 0; break;\n case \"C#\": akk[i] = 1; break;\n case \"D\": akk[i] = 2; break;\n case \"D#\": akk[i] = 3; break;\n case \"E\": akk[i] = 4; break;\n case \"F\": akk[i] = 5; break;\n case \"F#\": akk[i] = 6; break;\n case \"G\": akk[i] = 7; break;\n case \"G#\": akk[i] = 8; break;\n case \"A\": akk[i] = 9; break;\n case \"B\": akk[i] = 10; break;\n case \"H\": akk[i] = 11; break;\n default: akk[i] = -1; break;\n }\n }\n int type = 0;\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n int k = 3 - (i + j);\n if (d(akk[i], akk[j]) == 7)\n {\n if ((d(akk[i], akk[k]) == 4) & (d(akk[k], akk[j]) == 3)) { type = 1; break; }\n else if ((d(akk[i], akk[k]) == 3) & (d(akk[k], akk[j]) == 4)) type = -1;\n }\n }\n }\n switch (type)\n { \n case 1: Console.Write(\"major\"); break;\n case -1: Console.Write(\"minor\"); break;\n default: Console.Write(\"strange\"); break;\n }\n }\n static int d(int a1, int a2)\n {\n if (a2 >= a1) return a2 - a1; else return 12 - (a1 - a2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fb9434178e89ef0ec4096b0036e585e8", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n //enum notes { C, C#, D, D#, E, F, F#, G, G#, A, B, H};\n static void Main(string[] args)\n {\n string[] t = Console.ReadLine().Split(' ');\n int[] notes = new int[3];\n for(int i = 0; i < 3; i++)\n {\n switch (t[i])\n {\n case \"C\": notes[i] = 1;\n break;\n case \"C#\": notes[i] = 2;\n break;\n case \"D\": notes[i] = 3;\n break;\n case \"D#\": notes[i] = 4;\n break;\n case \"E\": notes[i] = 5;\n break;\n case \"F\": notes[i] = 6;\n break;\n case \"F#\": notes[i] = 7;\n break;\n case \"G\": notes[i] = 8;\n break;\n case \"G#\": notes[i] = 9;\n break;\n case \"A\": notes[i] = 10;\n break;\n case \"B\": notes[i] = 11;\n break;\n case \"H\": notes[i] = 12;\n break;\n }\n }\n int[,] map = new int[3, 3];\n int first = 0;\n int second = 0;\n int third = 0;\n for (int i = 0; i < 3; i++)\n for (int j = 0; j < 3; j++)\n {\n if (notes[i] > notes[j])\n map[i, j] = 12 - notes[i] + notes[j];\n else\n map[i, j] = notes[j] - notes[i];\n if (map[i, j] == 7)\n {\n first = i;\n third = j;\n if (i != 0 && j != 0) second = 0;\n if (i != 1 && j != 1) second = 1;\n if (i != 2 && j != 2) second = 2;\n }\n }\n if (first != third)\n {\n if (map[first, second] == 4)\n Console.WriteLine(\"major\");\n else if (map[first, second] == 3)\n Console.WriteLine(\"minor\");\n else Console.WriteLine(\"strange\");\n }\n else\n Console.WriteLine(\"strange\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "71eefb3dbb1727d693de9d52ce8b3248", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class TaskA\n {\n static void Main()\n {\n var all = new List(new string[] { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" });\n var input = Console.ReadLine().Trim().Split(' ');\n var answ = \"strange\";\n var x = input[2];\n var y = input[0];\n var z = input[1];\n if ((all.IndexOf(x) - all.IndexOf(y) == 7) || (all.IndexOf(x) - all.IndexOf(y) == -5))\n {\n if ((all.IndexOf(z) - all.IndexOf(y) == 4) || (all.IndexOf(z) - all.IndexOf(y) == -8))\n {\n answ = \"major\";\n }\n else if ((all.IndexOf(z) - all.IndexOf(y) == 3) || (all.IndexOf(z) - all.IndexOf(y) == -9))\n {\n answ = \"minor\";\n }\n }\n x = input[2];\n y = input[1];\n z = input[0];\n if ((all.IndexOf(x) - all.IndexOf(y) == 7) || (all.IndexOf(x) - all.IndexOf(y) == -5))\n {\n if ((all.IndexOf(z) - all.IndexOf(y) == 4) || (all.IndexOf(z) - all.IndexOf(y) == -8))\n {\n answ = \"major\";\n }\n else if ((all.IndexOf(z) - all.IndexOf(y) == 3) || (all.IndexOf(z) - all.IndexOf(y) == -9))\n {\n answ = \"minor\";\n }\n }\n x = input[1];\n y = input[2];\n z = input[0];\n if ((all.IndexOf(x) - all.IndexOf(y) == 7) || (all.IndexOf(x) - all.IndexOf(y) == -5))\n {\n if ((all.IndexOf(z) - all.IndexOf(y) == 4) || (all.IndexOf(z) - all.IndexOf(y) == -8))\n {\n answ = \"major\";\n }\n else if ((all.IndexOf(z) - all.IndexOf(y) == 3) || (all.IndexOf(z) - all.IndexOf(y) == -9))\n {\n answ = \"minor\";\n }\n }\n x = input[1];\n y = input[0];\n z = input[2];\n if ((all.IndexOf(x) - all.IndexOf(y) == 7) || (all.IndexOf(x) - all.IndexOf(y) == -5))\n {\n if ((all.IndexOf(z) - all.IndexOf(y) == 4) || (all.IndexOf(z) - all.IndexOf(y) == -8))\n {\n answ = \"major\";\n }\n else if ((all.IndexOf(z) - all.IndexOf(y) == 3) || (all.IndexOf(z) - all.IndexOf(y) == -9))\n {\n answ = \"minor\";\n }\n }\n x = input[0];\n y = input[1];\n z = input[2];\n if ((all.IndexOf(x) - all.IndexOf(y) == 7) || (all.IndexOf(x) - all.IndexOf(y) == -5))\n {\n if ((all.IndexOf(z) - all.IndexOf(y) == 4) || (all.IndexOf(z) - all.IndexOf(y) == -8))\n {\n answ = \"major\";\n }\n else if ((all.IndexOf(z) - all.IndexOf(y) == 3) || (all.IndexOf(z) - all.IndexOf(y) == -9))\n {\n answ = \"minor\";\n }\n }\n x = input[0];\n y = input[2];\n z = input[1];\n if ((all.IndexOf(x) - all.IndexOf(y) == 7) || (all.IndexOf(x) - all.IndexOf(y) == -5))\n {\n if ((all.IndexOf(z) - all.IndexOf(y) == 4) || (all.IndexOf(z) - all.IndexOf(y) == -8))\n {\n answ = \"major\";\n }\n else if ((all.IndexOf(z) - all.IndexOf(y) == 3) || (all.IndexOf(z) - all.IndexOf(y) == -9))\n {\n answ = \"minor\";\n }\n }\n\n Console.WriteLine(answ);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1f1be9904fcb17086863fb980852e76e", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Task1 {\n internal class Program {\n private static void Main(string[] args) {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n// C, C#, D, D#, E, F, F#, G, G#, A, B, H\n int x = Get(ss[0]);\n int y = Get(ss[1]);\n int z = Get(ss[2]);\n string result;\n if (Check(x, y, z, out result)) {\n Console.WriteLine(result);\n return;\n }\n if (Check(x, z, y, out result)) {\n Console.WriteLine(result);\n return;\n }\n if (Check(y, x, z, out result)) {\n Console.WriteLine(result);\n return;\n }\n if (Check(y, z, x, out result)) {\n Console.WriteLine(result);\n return;\n }\n if (Check(z, x, y, out result)) {\n Console.WriteLine(result);\n return;\n }\n if (Check(z, y, x, out result)) {\n Console.WriteLine(result);\n return;\n }\n Console.WriteLine(\"strange\");\n }\n\n private static bool Check(int x, int y, int z, out string result) {\n while (x > y) {\n y += 12;\n }\n while (y > z) {\n z += 12;\n }\n int delta1 = (y - x);\n int delta2 = (z - y);\n if (delta1 == 3 && delta2 == 4) {\n result = \"minor\";\n return true;\n }\n if (delta1 == 4 && delta2 == 3) {\n result = \"major\";\n return true;\n }\n result = \"\";\n return false;\n }\n\n private static int Get(string s) {\n string[] temp = new string[] {\"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\"};\n for (int i = 0; i < temp.Length; i++) {\n if (temp[i].Equals(s))\n return i;\n }\n return 0;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "43405abb85f7f2a3b1739f4fd0308fa6", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace a1cs\n{\n class Program\n {\n\n static int Gt(string s)\n {\n switch (s)\n {\n case \"C\":\n {\n return 0;\n break;\n }\n case \"C#\":\n {\n return 1;\n break;\n }\n case \"D\":\n {\n return 2;\n break;\n }\n case \"D#\":\n {\n return 3;\n break;\n }\n case \"E\":\n {\n return 4;\n break;\n }\n case \"F\":\n {\n return 5;\n break;\n }\n case \"F#\":\n {\n return 6;\n break;\n }\n case \"G\":\n {\n return 7;\n break;\n }\n case \"G#\":\n {\n return 8;\n break;\n }\n case \"A\":\n {\n return 9;\n break;\n }\n case \"B\":\n {\n return 10;\n break;\n }\n default:\n {\n return 11;\n }\n }\n }\n\n \n static void Main()\n {\n //TextReader fin = File.OpenText(\"input.txt\");\n //TextWriter fout = File.CreateText(\"output.txt\");\n string[] ss = Console.ReadLine().Split();\n int a = Gt(ss[0]);\n int b = Gt(ss[1]);\n int c = Gt(ss[2]);\n int d;\n if (a > b)\n {\n d = a;\n a = b;\n b = d;\n }\n if (a > c)\n {\n d = a;\n a = c;\n c = d;\n }\n if (b > c)\n {\n d = b;\n b = c;\n c = d;\n }\n if ((b - a == 3) && (c - b == 4)) Console.WriteLine(\"minor\");\n else if ((c - a == 3) && (b + 12 - c == 4)) Console.WriteLine(\"minor\");\n else if ((a + 12 - b == 3) && (c - a == 4)) Console.WriteLine(\"minor\");\n else if ((c - b == 3) && (a + 12 - c == 4)) Console.WriteLine(\"minor\");\n else if ((a + 12 - c == 3) && (b - a == 4)) Console.WriteLine(\"minor\");\n else if ((b + 12 - c == 3) && (a + 12 - b == 4)) Console.WriteLine(\"minor\");\n else if ((b - a == 4) && (c - b == 3)) Console.WriteLine(\"major\");\n else if ((c - a == 4) && (b + 12 - c == 3)) Console.WriteLine(\"major\");\n else if ((a + 12 - b == 4) && (c - a == 3)) Console.WriteLine(\"major\");\n else if ((c - b == 4) && (a + 12 - c == 3)) Console.WriteLine(\"major\");\n else if ((a + 12 - c == 4) && (b - a == 3)) Console.WriteLine(\"major\");\n else if ((b + 12 - c == 4) && (a + 12 - b == 3)) Console.WriteLine(\"major\");\n else Console.WriteLine(\"strange\");\n //fin.Close();\n //fout.Close();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1a740f8acaa5a3ff9f4e4d9164f57acb", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class CF_Chord\n{\n static string[] N = new string[] { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n\n public static int dist(string a, string b)\n {\n int pos1 = Array.IndexOf(N, a);\n int pos2 = Array.IndexOf(N, b);\n int d = pos2 - pos1;\n if (d < 0) d = 12 + d;\n return d;\n }\n\n public static string chord(string a, string b, string c)\n {\n int d1 = dist(a, b);\n int d2 = dist(b, c);\n\n string ans = \"strange\";\n if (d1 == 4 && d2 == 3) ans = \"major\";\n else if (d1 == 3 && d2 == 4) ans = \"minor\";\n return ans;\n }\n\n public static void Main(string[] args)\n {\n string[] notes = Console.ReadLine().Split();\n int n = notes.Length;\n string a = notes[0];\n string b = notes[1];\n string c = notes[2];\n int d1 = dist(notes[0], notes[1]);\n int d2 = dist(notes[1], notes[2]);\n\n string ans = chord(a, b, c);\n if (ans == \"strange\") ans = chord(a, c, b);\n if (ans == \"strange\") ans = chord(b, a, c);\n if (ans == \"strange\") ans = chord(b, c, a);\n if (ans == \"strange\") ans = chord(c, a, b);\n if (ans == \"strange\") ans = chord(c, b, a);\n\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ab101361e118cbc182277a2a5dcbf812", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "MS C#", "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\tprivate List notes = new List() { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar str = sr.NextSplitStrings();\n\t\t\tvar x = str[0];\n\t\t\tvar y = str[1];\n\t\t\tvar z = str[2];\n\t\t\tfor (var i = 0; i < 3; i++) {\n\t\t\t\tfor (var j = 0; j < 3; j++) {\n\t\t\t\t\tif (j != i) {\n\t\t\t\t\t\tfor (var k = 0; k < 3; k++) {\n\t\t\t\t\t\t\tif (k != i && k != j) {\n\t\t\t\t\t\t\t\tif (IsMajor(str[i], str[j], str[k])) {\n\t\t\t\t\t\t\t\t\tsw.WriteLine(\"major\");\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (IsMinor(str[i], str[j], str[k]))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tsw.WriteLine(\"minor\");\n\t\t\t\t\t\t\t\t\treturn;\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\tsw.WriteLine(\"strange\");\n\t\t}\n\n\t\tprivate bool IsMajor(string x, string y, string z)\n\t\t{\n\t\t\tvar indxX = notes.IndexOf(x);\n\t\t\tvar indxY = notes.IndexOf(y);\n\t\t\tvar indxZ = notes.IndexOf(z);\n\t\t\tvar d1 = 0;\n\t\t\tif (indxX <= indxY) {\n\t\t\t\td1 = indxY - indxX;\n\t\t\t}\n\t\t\telse {\n\t\t\t\td1 = notes.Count - indxX + indxY;\n\t\t\t}\n\t\t\tvar d2 = 0;\n\t\t\tif (indxY <= indxZ) {\n\t\t\t\td2 = indxZ - indxY;\n\t\t\t}\n\t\t\telse {\n\t\t\t\td2 = notes.Count - indxY + indxZ;\n\t\t\t}\n\n\t\t\treturn d1 == 4 && d2 == 3;\n\t\t}\n\n\t\tprivate bool IsMinor(string x, string y, string z)\n\t\t{\n\t\t\tvar indxX = notes.IndexOf(x);\n\t\t\tvar indxY = notes.IndexOf(y);\n\t\t\tvar indxZ = notes.IndexOf(z);\n\t\t\tvar d1 = 0;\n\t\t\tif (indxX <= indxY)\n\t\t\t{\n\t\t\t\td1 = indxY - indxX;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\td1 = notes.Count - indxX + indxY;\n\t\t\t}\n\t\t\tvar d2 = 0;\n\t\t\tif (indxY <= indxZ)\n\t\t\t{\n\t\t\t\td2 = indxZ - indxY;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\td2 = notes.Count - indxY + indxZ;\n\t\t\t}\n\n\t\t\treturn d1 == 3 && d2 == 4;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "773c4958081808529d46113099b4d796", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cs_console\n{\n class _73_2_B\n {\n public static void Main(string[] args)\n {\n Console.WriteLine(test());\n }\n static string test()\n {\n string[] ss = Console.ReadLine().Split(' ');\n int[] c = new int[3];\n for (int i = 0; i < 3; i++)\n {\n c[i] = ch(ss[i]);\n }\n string[] ans = { \"major\", \"minor\", \"strange\" };\n\n Array.Sort(c);\n if (c[0] == c[1] - 4 && c[1] == c[2] - 3)\n {\n return ans[0];\n }\n if (c[0] == c[1] - 3 && c[1] == c[2] - 4)\n {\n return ans[1];\n }\n\n c[0] += 12;\n Array.Sort(c);\n if (c[0] == c[1] - 4 && c[1] == c[2] - 3)\n {\n return ans[0];\n }\n if (c[0] == c[1] - 3 && c[1] == c[2] - 4)\n {\n return ans[1];\n }\n\n c[0] += 12;\n Array.Sort(c);\n if (c[0] == c[1] - 4 && c[1] == c[2] - 3)\n {\n return ans[0];\n }\n if (c[0] == c[1] - 3 && c[1] == c[2] - 4)\n {\n return ans[1];\n }\n\n return ans[2];\n }\n\n private static int ch(string p)\n {\n string[] keys = new string[] { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n for (int i = 0; i < keys.Length; i++)\n {\n if (keys[i] == p)\n return i;\n }\n return -1;\n }\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "94c3a13d8fb4399cc358ff779cfa3278", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "MS C#", "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 bool Try(int n1, int n2, int n3) {\n int p1 = (n2 - n1 + 12) % 12;\n int p2 = (n3 - n2 + 12) % 12;\n if (p1==4 && p2==3) {\n writer.Write(\"major\");\n return true;\n }\n if(p1 == 3 && p2 == 4) {\n writer.Write(\"minor\");\n return true;\n }\n return false;\n }\n\n static void Main(string[] args) {\n string[] notes = {\"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\"};\n string[] a = reader.ReadLine().Split(' ');\n int n1 = Array.IndexOf(notes, a[0]);\n int n2 = Array.IndexOf(notes, a[1]);\n int n3 = Array.IndexOf(notes, a[2]);\n bool ans = Try(n1, n2, n3) || Try(n1, n3, n2) || Try(n2, n1, n3) || Try(n2, n3, n1) || Try(n3, n2, n1) || Try(n3, n1, n2);\n if (!ans)\n writer.Write(\"strange\");\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "77075e57d1ff422fee9d445c52669137", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\npublic class Fffuuuu {\n String[] notes = new String[] { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n Int32 Eval(String n) {\n return Array.IndexOf(notes, n);\n }\n Int32 Distance(String x, String y) {\n Int32 res = Eval(y) - Eval(x);\n return res < 0 ? res + notes.Length : res;\n }\n String Find(String[] token) {\n for (Int32 ia = 0; ia < 3; ++ia) {\n for (Int32 ib = 0; ib < 3; ++ib) {\n for (Int32 ic = 0; ic < 3; ++ic) {\n if (ia != ib && ib != ic && ia != ic) {\n if (Distance(token[ia], token[ib]) == 4 && Distance(token[ib], token[ic]) == 3) {\n return \"major\";\n } else if (Distance(token[ia], token[ib]) == 3 && Distance(token[ib], token[ic]) == 4) {\n return \"minor\";\n }\n }\n }\n }\n }\n return \"strange\";\n }\n public Fffuuuu() {\n Console.WriteLine(Find(Console.ReadLine().Split(' ')));\n }\n public static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"in.txt\"));\n#endif\n new Fffuuuu();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d82b301f2cb356d3d1e972a66485eb6c", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ASM\n{\n class Program\n {\n public static string[] notes = { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n public static string output = \"strange\";\n static void Main(string[] args)\n {\n string[] traids = Console.ReadLine().Split(' ').ToArray();\n premutations(traids, 0);\n Console.WriteLine(output);\n //Console.ReadLine();\n }\n /*\n */\n static void premutations(string[] traid, int currPlace)\n {\n if (currPlace != 0)\n {\n if(dTones(traid[0], traid[1]) == 4 && dTones(traid[1], traid[2]) == 3)\n {\n output = \"major\";\n } else if (dTones(traid[0], traid[1]) == 3 && dTones(traid[1], traid[2]) == 4)\n {\n output = \"minor\";\n }\n }\n\n if ((currPlace+1) == traid.Length) return;\n \n for(int i=currPlace; i < traid.Length - currPlace; i++)\n {\n string oldC = traid[currPlace];\n string newC = traid[currPlace + i];\n traid[currPlace] = newC;\n traid[currPlace + i] = oldC;\n premutations(traid, currPlace + 1);\n traid[currPlace] = oldC;\n traid[currPlace + i] = newC;\n }\n }\n\n static int dTones(string firstNote, string secondNote)\n {\n int i = 0, j = 0;\n for(int k = 0; k < 12; k++)\n {\n if(notes[k] == firstNote)\n {\n i = k+1;\n }\n if (notes[k] == secondNote)\n {\n j = k+1;\n }\n }\n if (j > i) return (j - i);\n else if (i > j) return (12 - i) + j;\n else return 12;\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3d6a3386f1706e07b51c12f18bd7f26d", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "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[] ns = new int[3];\n int i = 0;\n foreach (var s in ss)\n {\n int n = 0;\n switch (s)\n {\n case \"C\": n = 0; break;\n case \"C#\": n = 1; break;\n case \"D\": n = 2; break;\n case \"D#\": n = 3; break;\n case \"E\": n = 4; break;\n case \"F\": n = 5; break;\n case \"F#\": n = 6; break;\n case \"G\": n = 7; break;\n case \"G#\": n = 8; break;\n case \"A\": n = 9; break;\n case \"B\": n = 10; break;\n case \"H\": n = 11; break;\n }\n ns[i++] = n;\n }\n\n int r1 = (12 + ns[1] - ns[0]) % 12;\n int r2 = (12 + ns[2] - ns[0]) % 12;\n\n if (\n (r1 == 4 && r2 == 7) || \n (r1 == 7 && r2 == 4) ||\n (r1 == 3 && r2 == 8) ||\n (r1 == 8 && r2 == 3) ||\n (r1 == 5 && r2 == 9) ||\n (r1 == 9 && r2 == 5)\n )\n CF.WriteLine(\"major\");\n else if (\n (r1 == 3 && r2 == 7) || \n (r1 == 7 && r2 == 3) ||\n (r1 == 5 && r2 == 8) ||\n (r1 == 8 && r2 == 5) ||\n (r1 == 4 && r2 == 9) ||\n (r1 == 9 && r2 == 4)\n )\n CF.WriteLine(\"minor\");\n else\n CF.WriteLine(\"strange\");\n }\n\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\nC E G\n\",\n\n@\"\nC# B F\n\",\n@\"\nA B H\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7558fdf50ae8e85184c00194186f1372", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A88\n{\n class Program\n {\n static String[] temp = { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n \n static int Count(string x, string y)\n {\n bool boolya = false;\n int count = 0;\n int i = 0;\n while (true)\n {\n if (temp[i].Equals(x))\n {\n boolya = true;\n i++;\n if (i == 12)\n i = 0;\n }\n if (!(boolya))\n {\n i++;\n if (i == 12)\n i = 0;\n }\n if (boolya && (!(temp[i].Equals(x))) && (!(temp[i].Equals(y))))\n {\n count++;\n i++;\n if (i == 12)\n i = 0;\n }\n if (boolya && (temp[i].Equals(y)))\n {\n break;\n }\n \n }\n return count++;\n }\n static void Main(string[] args)\n {\n String[] s = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);\n int flag = 0;\n int r = Count(s[0], s[1]);\n int l = Count(s[1], s[2]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n r = Count(s[0], s[2]);\n l = Count(s[2], s[1]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n r = Count(s[1], s[0]);\n l = Count(s[0], s[2]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n r = Count(s[1], s[2]);\n l = Count(s[2], s[0]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n r = Count(s[2], s[0]);\n l = Count(s[0], s[1]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n r = Count(s[2], s[1]);\n l = Count(s[1], s[0]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n switch (flag)\n {\n case 0:\n Console.WriteLine(\"strange\");\n break;\n case 1:\n Console.WriteLine(\"major\");\n break;\n case 2:\n Console.WriteLine(\"minor\");\n break;\n default:\n break;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5f256e3543f7bdde8aaf9be17596b410", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n class CodeforcesBeta73\n {\n public static void Main()\n {\n string[] tones = { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n string[] output = { \"major\", \"minor\", \"strange\" };\n string[] str = Console.ReadLine().Split(' ');\n\n int[][] ijk = { new int[] { 0, 1, 2 }, new int[] { 2, 0, 1 }, new int[] { 1, 2, 0 }, new int[] { 0, 2, 1 }, new int[] { 1, 0, 2 },new int[] {2,1,0 } };\n for (int k = 0; k < ijk.Length; k++)\n {\n int[] index = new int[3];\n for (int i = 0; i < tones.Length; i++)\n {\n if (str[ijk[k][0]] == tones[i])\n index[0] = i;\n if (str[ijk[k][1]] == tones[i])\n index[1] = i;\n if (str[ijk[k][2]] == tones[i])\n index[2] = i;\n }\n\n int diff1 = (index[1] - index[0]) > 0 ? (index[1] - index[0]) : (12 + (index[1] - index[0]));\n int diff2 = (index[2] - index[1]) > 0 ? (index[2] - index[1]) : (12 + (index[2] - index[1]));\n\n if (diff1 == 4 && diff2 == 3)\n {\n Console.WriteLine(output[0]);\n return;\n }\n else if (diff1 == 3 && diff2 == 4)\n {\n Console.WriteLine(output[1]);\n return;\n }\n }\n Console.WriteLine(output[2]);\n }\n }\n \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b504181f958a678b24a7825dce4517c6", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace codeforces_cs\n{\n class Program\n {\n static string[] c = { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\"};\n static Dictionary d = new Dictionary(); \n static int dist(int x, int y)\n {\n return (y - x + 12) % 12;\n }\n static void Main(string[] args)\n {\n for (int i = 0; i < c.Length; i++)\n {\n d[c[i]] = i;\n }\n\n string input = Console.ReadLine();\n string[] inputs = input.Split(' ');\n List sinputs = new List();\n for (int i = 0; i < 3; i++)\n {\n sinputs.Add(d[inputs[i]]);\n }\n for (int i = 0; i < 12; i++)\n {\n for(int j=0;j<3;j++)\n {\n sinputs[j] = (sinputs[j]+1)%12;\n }\n sinputs.Sort();\n int X = sinputs[0];\n int Y = sinputs[1];\n int Z = sinputs[2];\n if (dist(X, Y) == 4 && dist(Y, Z) == 3)\n {\n Console.WriteLine(\"major\");\n return;\n }\n else if (dist(X, Y) == 3 && dist(Y, Z) == 4)\n {\n Console.WriteLine(\"minor\");\n return;\n }\n }\n Console.WriteLine(\"strange\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d8f6e056db7c97c14c7fedea536b4a7b", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace Task\n{\n\n class Solve\n {\n\n private int pos(string a)\n {\n string[] abc = { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\",};\n for (int i = 0; i < abc.Length; ++i)\n if (abc[i] == a)\n return i;\n return int.MinValue;\n }\n\n\n private int dist(string a, string b)\n {\n int pa = pos(a), pb = pos(b);\n if (pa < pb)\n return pb - pa;\n else\n return 12 - pa + pb; \n }\n\n private bool CheckMajor(string x, string y, string z)\n {\n if (dist(x, y) == 4 && dist(y, z) == 3 && dist(x, z) == 7)\n return true;\n else\n return false;\n }\n\n private bool CheckMinor(string x, string y, string z)\n {\n if (dist(x, y) == 3 && dist(y, z) == 4 && dist(x, z) == 7)\n return true;\n else\n return false;\n }\n\n public void solve()\n {\n string[] w = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n \n bool ok = CheckMajor(w[0], w[1], w[2]) | CheckMajor(w[0], w[2], w[1]) | CheckMajor(w[1], w[0], w[2]) |\n CheckMajor(w[1], w[2], w[0]) | CheckMajor(w[2], w[0], w[1]) | CheckMajor(w[2], w[1], w[0]);\n\n if (ok)\n Console.WriteLine(\"major\");\n else\n {\n ok = CheckMinor(w[0], w[1], w[2]) | CheckMinor(w[0], w[2], w[1]) | CheckMinor(w[1], w[0], w[2]) |\n CheckMinor(w[1], w[2], w[0]) | CheckMinor(w[2], w[0], w[1]) | CheckMinor(w[2], w[1], w[0]);\n if (ok)\n Console.WriteLine(\"minor\");\n else\n Console.WriteLine(\"strange\");\n } \n }\n }\n\n\n class Program\n {\n static void Main(string[] args)\n {\n new Solve().solve();\n// Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9342e9e1db1f583c84e1029241126d5b", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest.A\n{\n class Program\n {\n /////////////////////\n\n public static T Read()\n {\n return (T)Convert.ChangeType(Console.ReadLine(), typeof(T));\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> ReadIndexedList(char[] delimiters = null)\n {\n var line = Read();\n var split = line.Split(delimiters ?? new[] { ' ' });\n var list = split.Select((item, index) => new KeyValuePair(index + 1, (T)Convert.ChangeType(item, typeof(T)))).ToList();\n return list;\n }\n\n\n public static void ReadFromFile()\n {\n Console.SetIn(new StreamReader(@\"..\\..\\input.txt\"));\n }\n\n ///////////////////////////////////\n \n static List notes = new List() { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n\n static void Main(string[] args)\n {\n try\n {\n List readList = ReadList();\n int r = 0;\n foreach (string x in readList)\n {\n List t = readList.Except(new [] {x}).ToList();\n string y = t[0];\n string z = t[1];\n r = Determine(x, y, z);\n if (r != 0)\n break;\n z = t[0];\n y = t[1];\n r = Determine(x, y, z);\n if (r != 0)\n break;\n }\n switch (r)\n {\n case 1:\n Console.WriteLine(\"major\");\n break;\n case 2:\n Console.WriteLine(\"minor\");\n break;\n default:\n Console.WriteLine(\"strange\");\n break;\n }\n }\n catch\n {\n Console.Write(\"strange\");\n }\n }\n\n private static int Determine(string x, string y, string z)\n {\n int xi = notes.IndexOf(x);\n int yi = notes.IndexOf(y);\n int zi = notes.IndexOf(z);\n int a = xi < yi ? yi - xi : notes.Count - xi + yi;\n int b = yi < zi ? zi - yi : notes.Count - yi + zi;\n if (a == 4 && b == 3)\n return 1;\n if (a == 3 && b == 4)\n return 2;\n return 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f4dc1103b5f62d888f7700aae89e6942", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\nnamespace first\n{\n class Program\n {\n static TextReader tr;\n static void cin(out int value)\n {\n if (tr == null) tr = Console.In;\n StringBuilder sb = new StringBuilder();\n while (tr.Peek() == (char)(' ') || tr.Peek() == 13 || tr.Peek() == 10) \n tr.Read();\n while (tr.Peek() != (char)(' ') && tr.Peek() != 13 && tr.Peek() != 10)\n {\n char ch = (char)tr.Read();\n sb.Append(ch);\n }\n value = int.Parse(sb.ToString());\n }\n static void cin(out string value)\n {\n if (tr == null) tr = Console.In;\n StringBuilder sb = new StringBuilder();\n while (tr.Peek() == (char)(' ') || tr.Peek() == 13 || tr.Peek() == 10)\n tr.Read();\n while (tr.Peek() != (char)(' ') && tr.Peek() != 13 && tr.Peek() != 10)\n {\n char ch = (char)tr.Read();\n sb.Append(ch);\n }\n value = sb.ToString();\n }\n static void cin(out double value)\n {\n if (tr == null) tr = Console.In;\n StringBuilder sb = new StringBuilder();\n while (tr.Peek() == (char)(' ') || tr.Peek() == 13 || tr.Peek() == 10)\n tr.Read();\n while (tr.Peek() != (char)(' ') && tr.Peek() != 13 && tr.Peek() != 10)\n {\n char ch = (char)tr.Read();\n if (ch == '.') ch = ',';\n sb.Append(ch);\n }\n value = double.Parse(sb.ToString());\n }\n static void Main(string[] args)\n {\n //int n, m;\n string[] strnots = Console.ReadLine().Split(' ');\n int[] nots = new int[3];\n System.Collections.Generic.Dictionary map = new Dictionary();\n map.Add(\"C\",0);\n map.Add(\"C#\",1);\n map.Add(\"D\",2);\n map.Add(\"D#\",3);\n map.Add(\"E\",4);\n map.Add(\"F\",5);\n map.Add(\"F#\",6);\n map.Add(\"G\",7);\n map.Add(\"G#\",8);\n map.Add(\"A\",9);\n map.Add(\"B\",10);\n map.Add(\"H\",11);\n nots[0] = map[strnots[0]];\n nots[1] = map[strnots[1]];\n nots[2] = map[strnots[2]];\n\n if (len(nots[0], nots[1]) == 3 && len(nots[1], nots[2]) == 4 ||\n len(nots[0], nots[2]) == 3 && len(nots[2], nots[1]) == 4 ||\n len(nots[1], nots[2]) == 3 && len(nots[2], nots[0]) == 4 ||\n len(nots[1], nots[0]) == 3 && len(nots[0], nots[2]) == 4 ||\n len(nots[2], nots[1]) == 3 && len(nots[1], nots[0]) == 4 ||\n len(nots[2], nots[0]) == 3 && len(nots[0], nots[1]) == 4\n\n )\n {\n Console.WriteLine(\"minor\");\n }\n else\n if(\n len(nots[0], nots[1]) == 4 && len(nots[1], nots[2]) == 3 ||\n len(nots[0], nots[2]) == 4 && len(nots[2], nots[1]) == 3 ||\n len(nots[1], nots[2]) == 4 && len(nots[2], nots[0]) == 3 ||\n len(nots[1], nots[0]) == 4 && len(nots[0], nots[2]) == 3 ||\n len(nots[2], nots[1]) == 4 && len(nots[1], nots[0]) == 3 ||\n len(nots[2], nots[0]) == 4 && len(nots[0], nots[1]) == 3\n )\n Console.WriteLine(\"major\");\n else Console.WriteLine(\"strange\");\n }\n static int len(int a, int b)\n {\n if (b - a > 0) return b - a;\n else return b + 12 - a;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2fa01ae1c09e97da593012ae283c8436", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Chord\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 notes = new[] {\"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\"};\n string[] ss = reader.ReadLine().Split(' ');\n\n var nn = new int[3];\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = Array.IndexOf(notes, ss[i]);\n }\n Array.Sort(nn);\n\n if ((nn[1] - nn[0] == 3 && nn[2] - nn[1] == 4) || (nn[2] - nn[1] == 3 && nn[0] + notes.Length - nn[2] == 4) ||\n (nn[0] - nn[2] + notes.Length == 3 && nn[1] - nn[0] == 4))\n {\n writer.WriteLine(\"minor\");\n }\n else if ((nn[1] - nn[0] == 4 && nn[2] - nn[1] == 3) || (nn[2] - nn[1] == 4 && nn[0] + notes.Length - nn[2] == 3) ||\n (nn[0] - nn[2] + notes.Length == 4 && nn[1] - nn[0] == 3))\n {\n writer.WriteLine(\"major\");\n }\n else\n {\n writer.WriteLine(\"strange\");\n }\n\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f32a05166268e1242c642580d20352a8", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "namespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] akk = new int[3];\n for (int i = 0; i < 3; i++)\n {\n switch (input[i])\n {\n case \"C\": akk[i] = 0; break;\n case \"C#\": akk[i] = 1; break;\n case \"D\": akk[i] = 2; break;\n case \"D#\": akk[i] = 3; break;\n case \"E\": akk[i] = 4; break;\n case \"F\": akk[i] = 5; break;\n case \"F#\": akk[i] = 6; break;\n case \"G\": akk[i] = 7; break;\n case \"G#\": akk[i] = 8; break;\n case \"A\": akk[i] = 9; break;\n case \"B\": akk[i] = 10; break;\n case \"H\": akk[i] = 11; break;\n default: akk[i] = -1; break;\n }\n }\n int type = 0;\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n int k = 3 - (i + j);\n if (d(akk[i], akk[j]) == 7)\n {\n if ((d(akk[i], akk[k]) == 4) & (d(akk[k], akk[j]) == 3)) { type = 1; break; }\n else if ((d(akk[i], akk[k]) == 3) & (d(akk[k], akk[j]) == 4)) type = -1;\n }\n }\n }\n switch (type)\n { \n case 1: Console.Write(\"major\"); break;\n case -1: Console.Write(\"minor\"); break;\n default: Console.Write(\"strange\"); break;\n }\n }\n static int d(int a1, int a2)\n {\n if (a2 >= a1) return a2 - a1; else return 12 - (a1 - a2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e6dedd389557ecdf89cd23041addccd9", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"A\", \"A\\A.csproj\", \"{7C02893E-192C-4692-BDCC-E2D81901F781}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{7C02893E-192C-4692-BDCC-E2D81901F781}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{7C02893E-192C-4692-BDCC-E2D81901F781}.Debug|x86.Build.0 = Debug|x86\n\t\t{7C02893E-192C-4692-BDCC-E2D81901F781}.Release|x86.ActiveCfg = Release|x86\n\t\t{7C02893E-192C-4692-BDCC-E2D81901F781}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bf05401b88b89684e1969a6b1e73c824", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A88\n{\n class Program\n {\n static String[] temp = { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n \n static int Count(string x, string y)\n {\n bool boolya = false;\n int count = 0;\n int i = 0;\n while (true)\n {\n if (temp[i].Equals(x))\n {\n boolya = true;\n i++;\n if (i == 12)\n i = 0;\n }\n if (!(boolya))\n {\n i++;\n if (i == 12)\n i = 0;\n }\n if (boolya && (!(temp[i].Equals(x))) && (!(temp[i].Equals(y))))\n {\n count++;\n i++;\n if (i == 12)\n i = 0;\n }\n if (boolya && (temp[i].Equals(y)))\n {\n break;\n }\n \n }\n return count++;\n }\n static void Main(string[] args)\n {\n String[] s = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);\n int flag = 0;\n int r = Count(s[0], s[1]);\n int l = Count(s[1], s[2]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n r = Count(s[0], s[2]);\n l = Count(s[2], s[1]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n r = Count(s[1], s[0]);\n l = Count(s[0], s[2]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n r = Count(s[1], s[2]);\n l = Count(s[0], s[2]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n r = Count(s[2], s[0]);\n l = Count(s[0], s[1]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n r = Count(s[2], s[1]);\n l = Count(s[1], s[0]);\n if (r == 4 && l == 3)\n flag = 1;\n else\n if (r == 3 && l == 4)\n flag = 2;\n switch (flag)\n {\n case 0:\n Console.WriteLine(\"strange\");\n break;\n case 1:\n Console.WriteLine(\"major\");\n break;\n case 2:\n Console.WriteLine(\"minor\");\n break;\n default:\n break;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ac92fd0136712caf871d38ca14ffe37b", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n class CodeforcesBeta73\n {\n public static void Main() {\n string[] tones = {\"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n string[] output = { \"major\", \"minor\", \"strange\" };\n string[] str = Console.ReadLine().Split(' ');\n \n int[][] ijk = { new int[] { 0, 1, 2 }, new int[] { 2, 0, 1 }, new int[] { 1, 2, 0 }, new int[] { 0, 2, 1 }, new int[] { 1, 0, 2 } };\n for (int k = 0; k < ijk.Length; k++)\n { \n int[] index = new int[3];\n for (int i = 0; i < tones.Length; i++)\n {\n if (str[ijk[k][0]] == tones[i])\n index[0] = i;\n if (str[ijk[k][1]] == tones[i])\n index[1] = i;\n if (str[ijk[k][2]] == tones[i])\n index[2] = i;\n }\n\n int diff1 = (index[1] - index[0]) > 0 ? (index[1] - index[0]) : (12 + (index[1] - index[0]));\n int diff2 = (index[2] - index[1]) > 0 ? (index[2] - index[1]) : (12 + (index[2] - index[1]));\n\n if (diff1 == 4 && diff2 == 3)\n {\n Console.WriteLine(output[0]);\n return;\n }\n else if (diff1 == 3 && diff2 == 4)\n {\n Console.WriteLine(output[1]);\n return;\n }\n }\n Console.WriteLine(output[2]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5dc7c2d0ebd686866db3ea134575e039", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class CF_Chord\n{\n static string[] N = new string[] { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n\n public static int dist(string a, string b)\n {\n int pos1 = Array.IndexOf(N, a);\n int pos2 = Array.IndexOf(N, b);\n int d = Math.Abs(pos2 - pos1) % 12;\n return Math.Min(d, 12 - d);\n }\n\n public static string chord(string a, string b, string c)\n {\n int d1 = dist(a, b);\n int d2 = dist(b, c);\n\n string ans = \"strange\";\n if (d1 == 4 && d2 == 3) ans = \"major\";\n else if (d1 == 3 && d2 == 4) ans = \"minor\";\n return ans;\n }\n\n public static void Main(string[] args)\n {\n string[] notes = Console.ReadLine().Split();\n int n = notes.Length;\n string a = notes[0];\n string b = notes[1];\n string c = notes[2];\n int d1 = dist(notes[0], notes[1]);\n int d2 = dist(notes[1], notes[2]);\n\n string ans = chord(a, b, c);\n if (ans == \"strange\") ans = chord(a, c, b);\n if (ans == \"strange\") ans = chord(b, a, c);\n if (ans == \"strange\") ans = chord(b, c, a);\n if (ans == \"strange\") ans = chord(c, a, b);\n if (ans == \"strange\") ans = chord(c, b, a);\n\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fc397fd2233759ca30af0e35c2eee866", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\nusing static System.Console;\nnamespace ConsoleScratch\n{\n class Program\n {\n static void Main()\n {\n var a = ReadLine().ToCharArray();\n char c = 'z';\n for (int i = a.Length - 1; i >= 0 && c != '`'; i--)\n {\n if (a[i] <= c) { a[i] = c--; }\n }\n WriteLine(c == '`' ? string.Concat(a) : \"-1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ccdfc7a01c7145ee38c417c3cc4fdf63", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem946C\n{\n class Program\n {\n static void Main(string[] args)\n {\n string al = \"abcdefghijklmnopqrstuvwxyz\";\n StringBuilder inp = new StringBuilder(Console.ReadLine());\n\n int ilp, inpp;\n for (ilp = 0, inpp = 0; ilp < al.Length && inpp < inp.Length; inpp++)\n {\n if (inp[inpp] <= al[ilp])\n {\n inp[inpp] = al[ilp];\n ilp++;\n }\n }\n\n if (ilp < al.Length)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(inp.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e7f7199ad7ab146c529d9467e28a99ed", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _946C\n {\n public static void Main()\n {\n var s = Console.ReadLine().ToCharArray();\n\n int i = 0;\n for (char c = 'a'; c <= 'z'; c++)\n {\n while (i < s.Length && s[i] > c)\n {\n i++;\n }\n\n if (i < s.Length)\n {\n s[i++] = c;\n }\n else\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n Console.WriteLine(new string(s));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "67fb0cd3e34be5d0f82bf769c6f42ab6", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "MS C#", "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 s = sr.NextString().ToCharArray();\n var currCh = 0;\n for (var i = 0; i < s.Length; i++) {\n if (currCh <= 25) {\n if (currCh >= (s[i] - 'a')) {\n s[i] = (char) ('a' + currCh);\n currCh++;\n }\n }\n else {\n break;\n }\n }\n\n if (currCh >= 26) {\n sw.WriteLine(new string(s));\n }\n else {\n sw.WriteLine(-1);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0eff4c51e6140fc92328126a23e2241c", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "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 TaskC {\n public static void Main(string[] args) {\n new TaskC().Solve(Console.In, Console.Out);\n }\n\n public void Solve(TextReader input, TextWriter output) {\n // INPUT\n var s = input.ReadLine();\n var n = s.Length;\n\n // SOLUTION\n var next = 'a';\n var c = new List();\n for (var i = 0; i < n; i++) {\n if (next <= 'z') {\n if (s[i] > next) { c.Add(s[i]); } // cut\n else /* c[i] <= next */ { c.Add(next); next++; } // replace\n }\n else c.Add(s[i]);\n }\n var rv = next <= 'z' ? \"-1\" : new string(c.ToArray());\n\n // OUTPUT\n output.WriteLine(rv);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "51274f52f2cf71f7f16428ad5ce2f142", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "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 string s = sc.Next();\n\n int n = s.Length;\n\n // \u6587\u5b57\u5217 s\n // \u4efb\u610f\u306e\u6587\u5b57\u3092\u6b21\u306e\u6587\u5b57\u306b\u3067\u304d\u308b\n // abcde.... wxyz\u304c\u3067\u304d\u308b\u90e8\u5206\u6587\u5b57\u5217\n\n string abc = \"abcdefghijklmnopqrstuvwxyz\";\n int index = 0;\n char[] ans = s.ToArray();\n for(int i = 0;i < n; i++)\n {\n if(index < 26 && ans[i] <= abc[index])\n {\n ans[i] = abc[index];\n index++;\n }\n }\n if(index < 26)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n Console.WriteLine(new string(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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "22d3da91eaaa066b627cc101ffd301b5", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "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 string sin = Console.ReadLine();\n char[] FO = new char[sin.Length];\n\n byte n = 97;\n for (int i = 0; i < sin.Length; i++)\n {\n if (((byte)sin[i] <= n) && (n < 123))\n {\n FO[i] = (char)n;\n n++;\n }\n else\n {\n FO[i] = sin[i];\n }\n }\n\n if (n > 122)\n {\n Console.Write(buffer : FO);\n }\n else\n {\n Console.Write(\"-1\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3d81dbfdd933a32793e0f8f2f60335aa", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\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 char[] s = Console.ReadLine().ToArray();\n char curr = 'a';\n for(int i = 0; i < s.Length; i++)\n {\n if(s[i] <= curr)\n {\n s[i] = curr;\n curr++;\n if(curr > 122)\n {\n foreach(char c in s)\n {\n Console.Write(c);\n }\n return;\n }\n }\n }\n Console.WriteLine(\"-1\");\n return;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fd50fd6c653ed00dcdc26698dca50e1c", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace String_Transformation\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 char[] s = reader.ReadLine().ToCharArray();\n\n int index = 0;\n for (char i = 'a'; i <= 'z'; i++)\n {\n while (index < s.Length && s[index] > i)\n {\n index++;\n }\n if (index < s.Length)\n s[index] = i;\n else\n {\n writer.WriteLine(\"-1\");\n return;\n }\n index++;\n }\n\n writer.WriteLine(new string(s));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fd2421fe62e9ef64126d7aab25079e37", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n { \n string input = Console.ReadLine();\n StringBuilder result = new StringBuilder(\"\", input.Length);\n bool found = false;\n string last = \"\";\n int current = 97;\n //97-122\n if (input.Length >= 26)\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] <= current)\n {\n result.Append((char)current);\n current++;\n }\n else\n result.Append(input[i]);\n if (current > 122)\n {\n found = true;\n if (i != input.Length - 1)\n last = input.Substring(i + 1);\n break;\n }\n }\n if (found)\n Console.WriteLine(result + last);\n else\n Console.WriteLine(\"-1\");\n\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e3753c6d0e8fd052e77bebc7394c2cfb", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "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 s = Console.ReadLine();\n \n string A = \"abcdefghijklmnopqrstuvwxyz\";\n \n char[] arr = s.ToCharArray();\n \n int cnt = 0;\n \n\n \n for(int i=0;i();\n for (var i = 0; i < n; i++) {\n if (next <= 'z') {\n if (s[i] > next) { c.Add(s[i]); } // cut\n else /* c[i] <= next */ { c.Add(next); next++; } // replace\n }\n else c.Add(s[i]);\n }\n var rv = next <= 'z' ? \"-1\" : new string(c.ToArray());\n\n // OUTPUT\n output.WriteLine(rv);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dd57c9bae40582b9a803f1d8f1b35585", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemC\n{\n\tpublic class Problem\n\t{\n\t\tstring 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\ts = Console.ReadLine();\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\tvar i = 0;\n\t\t\tvar c = 'a';\n\t\t\tvar st = \"abcdefghijklmnopqrstuvwxyz\";\n\t\t\tfor (; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] <= c)\n\t\t\t\t\tc++;\n\t\t\t\telse\n\t\t\t\t\tc = 'a';\n\t\t\t\tif (c > 'z')\n\t\t\t\t{\n\t\t\t\t\ti++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (c <= 'z')\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\telse\n\t\t\t\tConsole.WriteLine(s.Substring(0, i - 26) + st + s.Substring(i));\n\t\t}\n\t}\n\n\tclass ProblemC\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e883ba042c56e64c8a2ab7766cce339", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "MS C#", "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 TaskC {\n public static void Main(string[] args) {\n new TaskC().Solve(Console.In, Console.Out);\n }\n\n public void Solve(TextReader input, TextWriter output) {\n // INPUT\n var s = input.ReadLine();\n var n = s.Length;\n\n // SOLUTION\n var next = 'a';\n var i = 0;\n var rv = new List();\n while (i < n && next <= 'z') {\n if (s[i] > next) { rv.Add(s[i]); i++; } // cut\n else /* c[i] <= next */ { rv.Add(next); next++; i++; } // replace\n }\n var result = next <= 'z' ? \"-1\" : new string(rv.ToArray());\n\n // OUTPUT\n output.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "058d156d7f3308c2d3eb4931878c1abc", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n bool found = false;\n int firstIndex = -1;\n string last = \"\";\n int current = 97;\n //97-122\n if (input.Length >= 26)\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] <= current)\n {\n current++;\n if (firstIndex == -1)\n firstIndex = i;\n }\n if (current > 122)\n {\n found = true;\n if (i != input.Length - 1)\n last = input.Substring(i);\n break;\n }\n }\n if (found)\n Console.WriteLine(input.Substring(0, firstIndex) + \"abcdefghijklmnopqrstuvwxyz\" + last);\n else \n Console.WriteLine(\"-1\");\n\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2291d2b45a2c046cecddff5ac17b94bc", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "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 s = Console.ReadLine();\n \n string A = \"abcdefghijklmnopqrstuvwxyz\";\n \n char[] arr = s.ToCharArray();\n \n int cnt = 0;\n \n for(int i=0;i int.Parse(s)).ToArray();\n\t\t}\n\n\t\tpublic Problem()\n\t\t{\n\t\t\ts = Console.ReadLine();\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\tvar i = 0;\n\t\t\tvar c = 'a';\n\t\t\tvar st = \"abcdefghijklmnopqrstuvwxyz\";\n\t\t\tfor (; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] <= c)\n\t\t\t\t\tc++;\n\t\t\t\telse\n\t\t\t\t\tc = 'a';\n\t\t\t\tif (c > 'z')\n\t\t\t\t{\n\t\t\t\t\ti++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i < 26)\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\telse\n\t\t\t\tConsole.WriteLine(s.Substring(0, i - 26) + st + s.Substring(i));\n\t\t}\n\t}\n\n\tclass ProblemC\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "438c3e7de771f6d102d018faaaa1c287", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n bool found = false;\n int current = 97;\n //97-122\n if (input.Length >= 26)\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] <= current)\n current++;\n if (current == 122)\n {\n found = true;\n break;\n }\n }\n if (found)\n Console.WriteLine(\"abcdefghijklmnopqrstuvwxyz\");\n else \n Console.WriteLine(\"-1\");\n\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4d9d628399b853f8f780d27c78c2137e", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "MS C#", "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 TaskC {\n public static void Main(string[] args) {\n new TaskC().Solve(Console.In, Console.Out);\n }\n\n public void Solve(TextReader input, TextWriter output) {\n // INPUT\n var s = input.ReadLine();\n var n = s.Length;\n\n // SOLUTION\n var next = 'a';\n var i = 0;\n var rv = new List();\n while (i < n && next <= 'z') {\n if (s[i] > next) { i++; } // cut\n else /* c[i] <= next */ { rv.Add(next); next++; i++; } // use\n }\n var result = next <= 'z' ? \"-1\" : new string(rv.ToArray());\n\n // OUTPUT\n output.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cc902fd8c7bc74c210e797dade06e31d", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass MainClass {\n static void Main() {\n int c;\n int i = 0;\n while ((c = Console.Read()) != -1)\n i++;\n Console.WriteLine(i);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aae4025b4f26c29943b78e2d204637e6", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemC\n{\n\tpublic class Problem\n\t{\n\t\tstring 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\ts = Console.ReadLine();\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\tvar i = 0;\n\t\t\tvar c = 'a';\n\t\t\tvar st = \"abcdefghijklmnopqrstuvwxyz\";\n\t\t\tfor (; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] <= c)\n\t\t\t\t\tc++;\n\t\t\t\telse\n\t\t\t\t\tc = 'a';\n\t\t\t\tif (c > 'z')\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t\tConsole.WriteLine(s.Substring(0, i - 26) + st + s.Substring(i));\n\t\t}\n\t}\n\n\tclass ProblemC\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e07b24020e383c1736bd2063d516e9ec", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "Mono C#", "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 s = Console.ReadLine();\n \n string A = \"abcdefghijklmnopqrstuvwxyz\";\n \n char[] arr = s.ToCharArray();\n \n int cnt = 0;\n \n for(int i=0;i();\n\t\tfor(int i=0;i<4;i++){\n\t\t\tvar d = det(rect[2*i] - x, rect[2*i+1] - y, rect[(2*i+2)%8] - x, rect[(2*i+3)%8] - y);\n\t\t\tif(d == 0) return false;\n\t\t\td = d > 0 ? 1 : -1;\n\t\t\th.Add(d); \n\t\t}\n\t\treturn h.Count == 1;\n\t}\n\tbool OnLine(int x, int y, int x1, int y1, int x2, int y2){\n\t\tif(x == x1 && y == y1) return true;\n\t\tif(x == x2 && y == y2) return true;\n\t\tif(det(x1 - x, y1 - y, x2 - x, y2 - y) != 0) return false;\n\t\treturn (x1 - x) * (x2 - x) + (y1 - y) * (y2 - y) < 0; \n\t}\n\tbool Intersects(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4){\n\t\t\n\t\tint d0 = det0(x3 - x1, y3 - y1, x2 - x1, y2 - y1);\n\t\tint d1 = det0(x4 - x1, y4 - y1, x2 - x1, y2 - y1);\n\t\tif(d0 == 0 || d1 == 0 || d0 == d1) return false;\n\t\tint d2 = det0(x1 - x3, y1 - y3, x4 - x3, y4 - y3);\n\t\tint d3 = det0(x2 - x3, y2 - y3, x4 - x3, y4 - y3);\n\t\tif(d2 == 0 || d3 == 0 || d2 == d3) return false;\n\t\treturn true;\n\t\t\n\t}\n\t\n\t\n\t\n\tint det (int a, int b, int c, int d){\n\t\treturn a * d - b * c;\n\t}\n\tint det0 (int a, int b, int c, int d){\n\t\tvar ret = a * d - b * c;\n\t\tif(ret == 0) return 0;\n\t\tif(ret > 0) return 1;\n\t\treturn -1;\n\t}\n\t\n\t\n\t\n\tint[] A, B;\n\tpublic Sol(){\n\t\tA = ria();\n\t\tB = 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b01024ec719ec0c4d79c90e316e185dd", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "Mono C#", "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 q1x = new int[4];\n var q1y = new int[4];\n var q2x = new int[4];\n var q2y = new int[4];\n for (var i = 0; i < 4; i++)\n {\n q1x[i] = input.ReadInt();\n q1y[i] = input.ReadInt();\n }\n for (var i = 0; i < 4; i++)\n {\n q2x[i] = input.ReadInt();\n q2y[i] = input.ReadInt();\n }\n var x1min = q1x.Min();\n var y1min = q1y.Min();\n var x1max = q1x.Max();\n var y1max = q1y.Max();\n var x2min = q2x.Min();\n var y2min = q2y.Min();\n var x2max = q2x.Max();\n var y2max = q2y.Max();\n var d = (x2max - x2min) / 2;\n for (var x = Max(x1min, x2min); x <= Min(x1max, x2max); x++)\n {\n for (var y = Max(y1min, y2min); y <= Min(y1max, y2max); y++)\n {\n if (x >= x1min && x <= x1max &&\n y >= y1min && y <= y1max &&\n x >= x2min && x <= x2max &&\n y >= y2min && y <= y2max)\n {\n var x0 = x - x2min - d;\n var y0 = y - y2min - d;\n if (x0 + y0 <= d &&\n x0 + y0 >= -d &&\n y0 - x0 <= d &&\n y0 - x0 >= -d)\n {\n Write(\"YES\");\n return;\n }\n }\n }\n }\n Write(\"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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c87c47ff9d62e17c8e71f77c30be72d", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\n\nclass CF\n{\n\tstatic Stream stdin = Console.OpenStandardInput();\n\tstatic byte[] buf = new byte[16 << 10];\n\tstatic int cap = 1;\n\tstatic int pos = 1;\n\tpublic static byte nextByte()\n\t{\n\t\tif (cap == 0) return 0;\n\t\tif (pos == cap)\n\t\t{\n\t\t\tcap = stdin.Read(buf, 0, 16 << 10);\n\t\t\tif (cap == 0) return 0;\n\t\t\tpos = 0;\n\t\t}\n\t\treturn buf[pos++];\n\t}\n\tpublic static int nextInt()\n\t{\n\t\tbyte c = nextByte();\n\t\twhile ((c < '0' || c > '9') && c != '-') c = nextByte();\n\t\tint sign = 1;\n\t\tif (c == '-')\n\t\t{\n\t\t\tc = nextByte();\n\t\t\tsign = -1;\n\t\t}\n\t\tint res = 0;\n\t\twhile (c >= '0' && c <= '9')\n\t\t{\n\t\t\tres = res * 10 + c - '0';\n\t\t\tc = nextByte();\n\t\t}\n\t\treturn res * sign;\n\t}\n\n\tstruct P\n\t{\n\t\tpublic int x;\n\t\tpublic int y;\n\t}\n\n\tstruct E : IComparable\n\t{\n\t\tpublic double x;\n\t\tpublic int type;\n\t\tpublic int c;\n\t\tpublic int CompareTo(E e)\n\t\t{\n\t\t\tif (x < e.x) return -1;\n\t\t\tif (x > e.x) return 1;\n\t\t\tif (type > e.type) return -1;\n\t\t\tif (type < e.type) return 1;\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tstatic bool HasPoints(P[] r1, P[] r2)\n\t{\n\t\tfor (int i = 0; i < 4; i++)\n\t\t\tfor (int j = 0; j < 4; j++)\n\t\t\t\tif (r1[i].x == r2[j].x && r1[i].y == r2[j].y) return true;\n\t\treturn false;\n\t}\n\n\tstatic bool HasEdge(P[] r, P p)\n\t{\n\t\tfor (int i = 0; i < 4; i++)\n\t\t{\n\t\t\tP cur = r[i];\n\t\t\tP next = r[(i + 1) % 4];\n\t\t\tint a = next.y - cur.y;\n\t\t\tint b = cur.x - next.x;\n\t\t\tint c = -(a * cur.x + b * cur.y);\n\t\t\tif (p.x * a + p.y * b + c != 0) continue;\n\t\t\tif (p.x < Math.Min(cur.x, next.x)) continue;\n\t\t\tif (p.x > Math.Max(cur.x, next.x)) continue;\n\t\t\tif (p.y < Math.Min(cur.y, next.y)) continue;\n\t\t\tif (p.y > Math.Max(cur.y, next.y)) continue;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tstatic bool Intersect(P a, P b, int y, out E e)\n\t{\n\t\te = new E();\n\t\tif (a.y == b.y) return false;\n\t\tint rev = 1;\n\t\tif (b.y < a.y)\n\t\t{\n\t\t\trev = -1;\n\t\t\tP t = a;\n\t\t\ta = b;\n\t\t\tb = t;\n\t\t}\n\t\tif (a.y > y) return false;\n\t\tif (b.y < y) return false;\n\t\tdouble p = (double)(y - a.y) / (double)(b.y - a.y);\n\t\tdouble x = a.x + (b.x - a.x) * p;\n\t\te = new E(){ x = x, type = rev, c = 0 };\n\t\treturn true;\n\t}\n\n\tpublic static void Main()\n\t{\n\t\tP[] r1 = new P[4];\n\t\tfor (int i = 0; i < 4; i++)\n\t\t{\n\t\t\tr1[i].x = nextInt();\n\t\t\tr1[i].y = nextInt();\n\t\t}\n\t\tP[] r2 = new P[4];\n\t\tfor (int j = 0; j < 4; j++)\n\t\t{\n\t\t\tr2[j].x = nextInt();\n\t\t\tr2[j].y = nextInt();\n\t\t}\n\t\tif (HasPoints(r1, r2))\n\t\t{\n\t\t\tConsole.WriteLine(\"yes\");\n\t\t\treturn;\n\t\t}\n\t\tfor (int i = 0; i < 4; i++)\n\t\t\tif (HasEdge(r1, r2[i]) || HasEdge(r2, r1[i]))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"yes\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\tint[] ys = new int[8];\n\t\tfor (int i = 0; i < 4; i++)\n\t\t{\n\t\t\tys[i] = r1[i].y;\n\t\t\tys[i + 4] = r2[i].y;\n\t\t}\n\t\tfor (int j = 0; j < 8; j++)\n\t\t{\n\t\t\tint y = ys[j];\n\t\t\tE[] e = new E[8];\n\t\t\tint ec = 0;\n\t\t\tfor (int i = 0; i < 4; i++)\n\t\t\t{\n\t\t\t\tE ne;\n\t\t\t\tif (!Intersect(r1[i], r1[(i + 1) % 4], y, out ne)) continue;\n\t\t\t\tne.c = 1;\n\t\t\t\te[ec++] = ne;\n\t\t\t}\n\t\t\tfor (int i = 0; i < 4; i++)\n\t\t\t{\n\t\t\t\tE ne;\n\t\t\t\tif (!Intersect(r2[i], r2[(i + 1) % 4], y, out ne)) continue;\n\t\t\t\tne.c = 2;\n\t\t\t\te[ec++] = ne;\n\t\t\t}\n\t\t\tArray.Resize(ref e, ec);\n\t\t\tArray.Sort(e);\n\n\t\t\tint c1 = 0;\n\t\t\tint c2 = 0;\n\t\t\tfor (int i = 0; i < ec; i++)\n\t\t\t{\n\t\t\t\tif (e[i].c == 1) c1 += e[i].type;\n\t\t\t\telse c2 += e[i].type;\n\t\t\t\tif (c1 != 0 && c2 != 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}\n\t\tConsole.WriteLine(\"no\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d285ecdfedad4b51ca97e5e5215d2c1a", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeff\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n using System.Text;\n using 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 c1 = sr.ReadArrayOfInt32();\n var c2 = sr.ReadArrayOfInt32();\n var coords1 = new int[10];\n var coords2 = new int[10];\n for (var i = 0; i < c1.Length; i++) {\n coords1[i] = c1[i];\n coords2[i] = c2[i];\n }\n\n coords1[8] = c1[0];\n coords1[9] = c1[1];\n coords2[8] = c2[0];\n coords2[9] = c2[1];\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (IsIntersect(coords1[i * 2], coords1[i * 2 + 1], coords1[(i + 1) * 2], coords1[(i + 1) * 2 + 1],\n coords2[j * 2], coords2[j * 2 + 1], coords2[(j + 1) * 2], coords2[(j + 1) * 2 + 1])) {\n sw.WriteLine(\"YES\");\n return;\n }\n }\n }\n\n for (var i = 0; i < 4; i++) {\n if (Inside(coords1[i * 2], coords1[i * 2 + 1], coords2)) {\n sw.WriteLine(\"YES\");\n return;\n }\n }\n\n for (var i = 0; i < 4; i++) {\n if (Inside(coords2[i * 2], coords2[i * 2 + 1], coords1)) {\n sw.WriteLine(\"YES\");\n return;\n }\n }\n\n sw.WriteLine(\"NO\");\n }\n\n private bool Inside(int x1, int y1, int[] coords)\n {\n var intersectsCount = 0;\n for (var i = 0; i < 4; i++) {\n if (IsIntersect(x1, y1, 100, 100, coords[i * 2], coords[i * 2 + 1], coords[(i + 1) * 2], coords[(i + 1) * 2 + 1])) {\n intersectsCount++;\n }\n }\n\n return intersectsCount == 1;\n }\n\n private int Cross(int x1, int y1, int x2, int y2, int x, int y)\n {\n return (x1 - x) * (y2 - y) - (x2 - x) * (y1 - y);\n }\n\n private bool IsIntersect(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)\n {\n var d1 = Cross(x2, y2, x3, y3, x1, y1);\n var d2 = Cross(x2, y2, x4, y4, x1, y1);\n var d3 = Cross(x4, y4, x2, y2, x3, y3);\n var d4 = Cross(x4, y4, x1, y1, x3, y3);\n if (((d1 > 0 && d2 < 0) || (d2 > 0 && d1 < 0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0)))\n return true;\n if (d1 == 0 && InSegment(x1, y1, x2, y2, x3, y3))\n return true;\n if (d2 == 0 && InSegment(x1, y1, x2, y2, x4, y4))\n return true;\n if (d3 == 0 && InSegment(x3, y3, x4, y4, x2, y2))\n return true;\n if (d4 == 0 && InSegment(x3, y3, x4, y4, x1, y1))\n return true;\n\n return false;\n }\n\n private bool InSegment(int x1, int y1, int x2, int y2, int x, int y)\n {\n return x >= Math.Min(x1, x2) && x <= Math.Max(x1, x2) && y >= Math.Min(y1, y2) && y <= Math.Max(y1, y2);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "408ddbe4f5c5adf611b009b8a8a615be", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\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 struct Vector2\n {\n public int x;\n public int y;\n\n public static Vector2 operator +(Vector2 v1, Vector2 v2) =>\n new Vector2(v1.x + v2.x, v1.y + v2.y);\n\n public static Vector2 operator -(Vector2 v1, Vector2 v2) =>\n new Vector2(v1.x - v2.x, v1.y - v2.y);\n\n public Vector2(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n }\n\n public class Segment2\n {\n public Vector2 a;\n public Vector2 b;\n public Segment2(Vector2 a, Vector2 b)\n {\n this.a = a;\n this.b = b;\n }\n }\n\n public class Quad\n {\n public Vector2[] v;\n\n public bool ContainsPoint(Vector2 p) =>\n Enumerable.Range(0, 4).All(i => Cross(v[(i + 1) % 4] - v[i], p - v[i]) <= 0);\n\n public IEnumerable Points() => v;\n\n public IEnumerable Edjes() =>\n Enumerable.Range(0, 4).Select(i => new Segment2(v[i], v[(i + 1) % 4]));\n\n public Quad(Vector2 a, Vector2 b, Vector2 c, Vector2 d) =>\n v = new[] { a, b, c, d };\n }\n\n public static int Cross(Vector2 v1, Vector2 v2) => v1.x * v2.y - v2.x * v1.y;\n\n public static bool Intersect(Segment2 a, Segment2 b) =>\n Intersect(a.a, a.b, b.a, b.b);\n\n public static bool Intersect(Vector2 a, Vector2 b, Vector2 c, Vector2 d)\n {\n var ca = c - a;\n var cd = c - d;\n var cb = c - b;\n var ac = a - c;\n var ab = a - b;\n var ad = a - d;\n var d1 = Cross(cd, ca);\n var d2 = Cross(cd, cb);\n var d3 = Cross(ab, ac);\n var d4 = Cross(ab, ad);\n return (d1 * d2 < 0 && d3 * d4 < 0) ||\n d1 == 0 && PointOnEdge(a, c, d) ||\n d2 == 0 && PointOnEdge(b, c, d) ||\n d3 == 0 && PointOnEdge(c, a, b) ||\n d4 == 0 && PointOnEdge(d, a, b);\n }\n\n public static bool PointOnEdge(Vector2 p, Vector2 a, Vector2 b)\n {\n return p.x <= Max(a.x, b.x) && p.x >= Min(a.x, b.x) &&\n p.y <= Max(a.y, b.y) && p.y >= Min(a.y, b.y);\n }\n\n public bool Intersect(Quad q1, Quad q2)\n {\n return q1.Points().Any(q2.ContainsPoint) ||\n q2.Points().Any(q1.ContainsPoint) ||\n q1.Edjes().Any(e1 => q2.Edjes().Any(e2 => Intersect(e1, e2)));\n }\n\n private Vector2 ReadPoint() => new Vector2(input.ReadInt(), input.ReadInt());\n\n public void Solve()\n {\n var v1 = new[] { ReadPoint(), ReadPoint(), ReadPoint(), ReadPoint() };\n var v2 = new[] { ReadPoint(), ReadPoint(), ReadPoint(), ReadPoint() };\n v1 = v1.OrderBy(p => p.y).ThenBy(p => p.x).ToArray();\n v2 = v2.OrderBy(p => p.y).ThenBy(p => p.x).ToArray();\n var q1 = new Quad(v1[0], v1[2], v1[3], v1[1]);\n var q2 = new Quad(v2[0], v2[1], v2[3], v2[2]);\n Write(Intersect(q1, q2) ? \"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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eaed6ef9cb8dde8d9729ff344bbf77f1", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "Mono C#", "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\t\n\t\t\n\t\tfor(int i=0;i<4;i++){\n\t\t\tif(Inside(A[2*i], A[2*i+1], B)){\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(Inside(B[2*i], B[2*i+1], A)){\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<4;i++){\n\t\t\tfor(int j=0;j<4;j++){\n\t\t\t\tif(OnLine(A[2*i], A[2*i+1], B[2*j], B[2*j+1], B[(2*j+2)%8], B[(2*j+3)%8])){\n\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif(OnLine(B[2*i], B[2*i+1], A[2*j], A[2*j+1], A[(2*j+2)%8], A[(2*j+3)%8])){\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}\n\t\tfor(int i=0;i<4;i++){\n\t\t\tfor(int j=0;j<4;j++){\n\t\t\t\tif(Intersects(A[2*j], A[2*j+1], A[(2*j+2)%8], A[(2*j+3)%8], B[2*j], B[2*j+1], B[(2*j+2)%8], B[(2*j+3)%8])){\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}\n\t\tConsole.WriteLine(\"NO\");\n\t\t\n\t}\n\t\n\tbool Inside(int x, int y, int[] rect){\n\t\tvar h = new HashSet();\n\t\tfor(int i=0;i<4;i++){\n\t\t\tvar d = det(rect[2*i] - x, rect[2*i+1] - y, rect[(2*i+2)%8] - x, rect[(2*i+3)%8] - y);\n\t\t\tif(d == 0) return false;\n\t\t\td = d > 0 ? 1 : -1;\n\t\t\th.Add(d); \n\t\t}\n\t\treturn h.Count == 1;\n\t}\n\tbool OnLine(int x, int y, int x1, int y1, int x2, int y2){\n\t\tif(x == x1 && y == y1) return true;\n\t\tif(x == x2 && y == y2) return true;\n\t\tif(det(x1 - x, y1 - y, x2 - x, y2 - y) != 0) return false;\n\t\treturn (x1 - x) * (x2 - x) + (y1 - y) * (y2 - y) < 0; \n\t}\n\tbool Intersects(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4){\n\t\t\n\t\tint d0 = det0(x3 - x1, y3 - y1, x2 - x1, y2 - y1);\n\t\tint d1 = det0(x4 - x1, y4 - y1, x2 - x1, y2 - y1);\n\t\tif(d0 == 0 || d1 == 0 || d0 == d1) return false;\n\t\tint d2 = det0(x1 - x3, y1 - y3, x4 - x3, y4 - y3);\n\t\tint d3 = det0(x2 - x3, y2 - y3, x4 - x3, y4 - y3);\n\t\tif(d2 == 0 || d3 == 0 || d2 == d3) return false;\n\t\treturn true;\n\t\t\n\t}\n\t\n\t\n\t\n\tint det (int a, int b, int c, int d){\n\t\treturn a * d - b * c;\n\t}\n\tint det0 (int a, int b, int c, int d){\n\t\tvar ret = a * d - b * c;\n\t\tif(ret == 0) return 0;\n\t\tif(ret > 0) return 1;\n\t\treturn -1;\n\t}\n\t\n\t\n\t\n\tint[] A, B;\n\tpublic Sol(){\n\t\tA = ria();\n\t\tB = 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "df6576082580e8652a4b1a3cdf6bab77", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "Mono C#", "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(int i=0;i<4;i++){\n\t\t\tif(Inside(A[2*i], A[2*i+1], B)){\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(Inside(B[2*i], B[2*i+1], A)){\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<4;i++){\n\t\t\tfor(int j=0;j<4;j++){\n\t\t\t\tif(OnLine(A[2*i], A[2*i+1], B[2*j], B[2*j+1], B[(2*j+2)%8], B[(2*j+3)%8])){\n\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif(OnLine(B[2*i], B[2*i+1], A[2*j], A[2*j+1], A[(2*j+2)%8], A[(2*j+3)%8])){\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}\n\t\tConsole.WriteLine(\"NO\");\n\t\t\n\t}\n\t\n\tbool Inside(int x, int y, int[] rect){\n\t\tvar h = new HashSet();\n\t\tfor(int i=0;i<4;i++){\n\t\t\tvar d = det(rect[2*i] - x, rect[2*i+1] - y, rect[(2*i+2)%8] - x, rect[(2*i+3)%8] - y);\n\t\t\tif(d == 0) return false;\n\t\t\td = d > 0 ? 1 : -1;\n\t\t\th.Add(d); \n\t\t}\n\t\treturn h.Count == 1;\n\t}\n\tbool OnLine(int x, int y, int x1, int y1, int x2, int y2){\n\t\tif(x == x1 && y == y1) return true;\n\t\tif(x == x2 && y == y2) return true;\n\t\tif(det(x1 - x, y1 - y, x2 - x, y2 - y) != 0) return false;\n\t\treturn (x1 - x) * (x2 - x) + (y1 - y) * (y2 - y) < 0; \n\t}\n\t\n\t\n\t\n\tint det (int a, int b, int c, int d){\n\t\treturn a * d - b * c;\n\t}\n\t\n\t\n\t\n\tint[] A, B;\n\tpublic Sol(){\n\t\tA = ria();\n\t\tB = 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "be8ae0377bab4e49a348c1abeaa7fef4", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "Mono C#", "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\\R488C.txt\";\n if (System.IO.File.Exists(filePath))\n {\n Console.SetIn(new System.IO.StreamReader(filePath));\n }\n\n IProblem counter = new R488C();\n\n foreach (var result in counter.GetResults())\n {\n Console.WriteLine(result);\n }\n }\n }\n\n internal class R488C : ProblemBase\n {\n public class Point\n {\n public double X { get; set; }\n public double Y { get; set; }\n }\n\n private double Area(Point a, Point b, Point c)\n {\n return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);\n }\n\n private bool HasProjectionIntersection(double a, double b, double c, double d)\n {\n double temp;\n if (a > b)\n {\n temp = a;\n a = b;\n b = temp;\n }\n\n if (c > d)\n {\n temp = c;\n c = d;\n d = temp;\n }\n return Math.Max(a, c) <= Math.Min(b, d);\n }\n\n private bool HasIntersection(Point a, Point b, Point c, Point d)\n {\n return HasProjectionIntersection(a.X, b.X, c.X, d.X)\n && HasProjectionIntersection(a.Y, b.Y, c.Y, d.Y)\n && Area(a, b, c) * Area(a, b, d) <= 0\n && Area(c, d, a) * Area(c, d, b) <= 0;\n }\n\n public override IEnumerable GetResults()\n {\n var line = this.ReadIntArray();\n var first = new Point[4];\n for (int i = 0; i < 4; i++)\n {\n first[i] = new Point {X = line[2 * i], Y = line[2 * i + 1]};\n }\n\n var second = new Point[4];\n line = this.ReadIntArray();\n for (int i = 0; i < 4; i++)\n {\n second[i] = new Point { X = line[2 * i], Y = line[2 * i + 1] };\n }\n\n var hasIntersection = SimpleCheck(first, second);\n if (!hasIntersection)\n {\n var centerX = second.Sum(item => item.X) / 4.0;\n var centerY = second.Sum(item => item.Y) / 4.0;\n\n for (int i = 0; i < 4; i++)\n {\n first[i].X -= centerX;\n first[i].Y -= centerY;\n second[i].X -= centerX;\n second[i].Y -= centerY;\n }\n\n first = Rotate45(first);\n second = Rotate45(second);\n\n hasIntersection = SimpleCheck(second, first);\n }\n\n yield return hasIntersection? \"YES\" : \"n/a\";\n }\n\n private Point[] Rotate45(Point[] first)\n {\n var cos45 = Math.Cos(Math.PI / 4.0);\n var sin45 = Math.Sin(Math.PI / 4.0);\n var newPoints = new Point[4];\n for (int i = 0; i < 4; i++)\n {\n newPoints[i] = new Point\n {\n X = cos45 * first[i].X + sin45 * first[i].Y,\n Y = -sin45 * first[i].X + cos45 * first[i].Y\n };\n }\n\n return newPoints;\n }\n\n private bool SimpleCheck(Point[] first, Point[] second)\n {\n bool hasIntersection = false;\n for (int firstIndex = 0; firstIndex < 4; firstIndex++)\n {\n for (int secondIndex = 0; secondIndex < 4; secondIndex++)\n {\n if (HasIntersection(first[firstIndex], first[(firstIndex + 1) % 4], second[secondIndex],\n second[(secondIndex + 1) % 4]))\n {\n hasIntersection = true;\n break;\n }\n }\n }\n\n if (!hasIntersection)\n {\n var point = new Point\n {\n X = second.Sum(item => item.X) / 4.0,\n Y = second.Sum(item => item.Y) / 4.0\n };\n\n var minX = first[0].X;\n var maxX = first[0].X;\n var minY = first[0].Y;\n var maxY = first[0].Y;\n for (int i = 1; i < 4; i++)\n {\n if (first[i].X < minX)\n {\n minX = first[i].X;\n }\n\n if (first[i].Y < minY)\n {\n minY = first[i].Y;\n }\n\n if (first[i].X > maxX)\n {\n maxX = first[i].X;\n }\n\n if (first[i].Y > maxY)\n {\n maxY = first[i].Y;\n }\n }\n\n if (point.X <= maxX && point.X >= minX && point.Y >= minY && point.Y <= maxY)\n {\n hasIntersection = true;\n }\n }\n\n return hasIntersection;\n }\n }\n\n internal class R488D : 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "76c4485aa577145d9fe1c8b1e238a0f4", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Test\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n var res = new int[]\n {0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1};\n\n for (int i = 0; i < 30; i++)\n {\n Console.WriteLine(res[i]);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "726488f9fdd12dc8b95a53b4bab62ad8", "src_uid": "4bda04e64ff661336a93464563f1b550", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Test\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n var res = new int[]\n {0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0};\n\n for (int i = 0; i < 30; i++)\n {\n Console.WriteLine(res[i]);\n }\n\n\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e33818d19321f306a8e964539e3dd167", "src_uid": "4bda04e64ff661336a93464563f1b550", "difficulty": null} {"lang": "MS C#", "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 ulong n = ulong.Parse(s.Substring(0, s.Length - 1));\n ulong res = (((n - 1) / 4) * 16);\n ulong row = n % 4;\n if (row == 1 || row == 3)\n res += 1;\n else\n res += 8;\n if (s[s.Length - 1] == 'f') res += 0;\n if (s[s.Length - 1] == 'e') res += 1;\n if (s[s.Length - 1] == 'd') res += 2;\n\n if (s[s.Length - 1] == 'a') res += 3;\n if (s[s.Length - 1] == 'b') res += 4;\n if (s[s.Length - 1] == 'c') res += 5;\n\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e50d859e65a249d34d22fd07f961beb4", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\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\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\n\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n char seat = input[input.Length - 1];\n string num = \"\";\n for (int i = 0; i < input.Length - 1; i++) num += input[i];\n long row = long.Parse(num);\n\n long result = 0;\n result += 16 * ((row - 1) / 4);\n row = (row-1) % 4 + 1;\n if (seat == 'f') result += 1;\n else if (seat == 'e') result += 2;\n else if (seat == 'd') result += 3;\n else if (seat == 'a') result += 4;\n else if (seat == 'b') result += 5;\n else if (seat == 'c') result += 6;\n\n if (row == 2 || row == 4) result += 7;\n\n Console.WriteLine(result);\n }\n\n /*\n /// \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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e424e7703ebd5d40c83fbfa6f6ca2159", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string a = \"\";\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] <= '9' && s[i] >= '0') a += \"\"+s[i];\n }\n long ch = Convert.ToInt64(a);\n long part=0, p=0, sum=0;\n if (s[s.Length-1]=='f') sum=1;\n else if (s[s.Length-1]=='e') sum=2;\n else if (s[s.Length-1]=='d') sum=3;\n else if (s[s.Length-1]=='a') sum=4;\n else if (s[s.Length-1]=='b') sum=5;\n else if (s[s.Length-1]=='c') sum=6;\n part=(ch+3)/4;\n sum += (part - 1) * 6 * 2;\n sum += (part - 1) * 4;\n if ((ch + 2) % 4 == 0 || ch % 4 == 0) sum += 7;\n Console.WriteLine(sum);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f179c5fad8eb0e136a81be08ad29489b", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n UInt64 n, time = 0;\n string str = Console.ReadLine();\n n = Convert.ToUInt64(str.Substring(0, str.Length - 1));\n time = (n - 1) / 4 * 16;\n if (n % 2 == 0)\n time += 7;\n if (str[str.Length - 1] == 'f')\n time++;\n else if (str[str.Length - 1] == 'e')\n time += 2;\n else if (str[str.Length - 1] == 'd')\n time += 3;\n else if (str[str.Length - 1] == 'a')\n time += 4;\n else if (str[str.Length - 1] == 'b')\n time += 5;\n else if (str[str.Length - 1] == 'c')\n time += 6;\n Console.WriteLine(time);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "15a3837824ec4251d4eaa1f9087a029c", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _725B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string S = Console.ReadLine();\n int L = S.Length; sbyte A2 = 0;\n char C = char.Parse(S.Substring(L-1));\n string SN = (S.Substring(0, L - 1));\n long N = long.Parse(SN);\n\n switch (C)\n {\n case 'f':\n A2 = 1;\n break;\n case 'e':\n A2 = 2;\n break;\n case 'd':\n A2 = 3;\n break;\n case 'a':\n A2 = 4;\n break;\n case 'b':\n A2 = 5;\n break;\n case 'c':\n A2 = 6;\n break;\n\n }\n\n long A1 = 16 * ((N - 1) / 4);\n sbyte A3 = 0;\n if ((N % 2) == 0) A3 = 7;\n long T = A1 + A2 + A3;\n\n Console.WriteLine(T);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bb3c5bebe48bf27f76a8aabee2b56823", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": " using System;\n\n namespace reverseString\n {\n class Program\n {\n static void Main(string[] args)\n {\n \n \n System.Int64 ans, rem, r, s;\n String str = Console.ReadLine();\n\n int len = str.Length;\n r = 0;\n for (int i = 0; i < len - 1; i++)\n {\n r = r * 10 + str[i] - '0';\n }\n\n // Console.WriteLine(\"r is {0}\", r);\n s = str[len - 1];\n\n // Console.WriteLine(\"s is {0}\", s);\n\n rem = (r - 1) / 4;\n // Console.WriteLine(\"rem is {0}\", rem);\n\n ans = rem * 12;\n // Console.WriteLine(\"ans is {0}\", ans);\n\n\n if (r % 2 == 0)\n {\n ans += 6;\n //Console.WriteLine(\"ans1 is {0}\", ans);\n }\n\n if (r % 4 == 1 || r % 4 == 2)\n {\n ans += r - 1;\n // Console.WriteLine(\"ans2 is {0}\", ans);\n }\n else if (r % 4 == 3 || r % 4 == 0)\n {\n ans += r - 3;\n // Console.WriteLine(\"ans3 is {0}\", ans);\n }\n\n if (s == 'a')\n {\n ans += 4;\n // Console.WriteLine(\"ans4 is {0}\", ans);\n }\n else if (s == 'b')\n {\n ans += 5;\n //Console.WriteLine(\"ans5 is {0}\", ans);\n }\n else if (s == 'c')\n {\n ans += 6;\n // Console.WriteLine(\"ans6 is {0}\", ans);\n }\n else if (s == 'd')\n {\n ans += 3;\n // Console.WriteLine(\"ans is {0}\", ans);\n }\n else if (s == 'e')\n {\n ans += 2;\n // Console.WriteLine(\"ans is {0}\", ans);\n }\n else\n {\n ans += 1;\n // Console.WriteLine(\"ans is {0}\", ans);\n }\n\n Console.WriteLine(ans);\n\n \n\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "35240d747b9851e3c821ac37e3193dc0", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "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 s = Read();\n var c = s.Last();\n var row = long.Parse(s.Substring(0, s.Length - 1)) - 1;\n var mod = row % 4;\n var result = (row / 4) * 16;\n\n if (mod % 2 != 0)\n result += 7;\n switch (c)\n {\n case 'f':\n break;\n case 'e':\n result += 1;\n break;\n case 'd':\n result += 2;\n break;\n case 'a':\n result += 3;\n break;\n case 'b':\n result += 4;\n break;\n case 'c':\n result += 5;\n break;\n default:\n throw new Exception(\"HUJ\");\n }\n return result + 1;\n }\n }\n }\n\n class UnionFind\n {\n private int[] arr;\n private Random r = new Random();\n public UnionFind(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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ebd97740c346f0f161cb08b2c02b6eba", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _725B {\n class Program {\n static void Main(string[] args) {\n string input = Console.ReadLine();\n long row = Convert.ToInt64(input.Substring(0, input.Length - 1));\n int col = input[input.Length - 1] - 'c'; //a = -2, b = -1, c = 0, d = 1, e = 2, f = 3\n long seconds = 0;\n\n if(col <= 0) {\n seconds += 6 + col;\n } else {\n seconds += 4 - col;\n }\n\n //1, 2, 5, 6, 9, 10 - attendant A\n if((row - 2) % 4 == 0 || (row - 1) % 4 == 0) { //attendant A rows\n seconds += 6 * (row / 2); //people served\n seconds += row - 1; //rows moved\n } else if(row % 4 == 0 || (row + 1) % 4 == 0) { //attendant B rows, //3, 4, 7, 8, 11, 12 - attendant B\n seconds += 6 * ((row - 2) / 2); //people served\n seconds += row - 3; //rows moved\n }\n \n Console.WriteLine(seconds);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f7521b363b39603d76f553a66ec1023a", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "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 s = ReadString();\n\t\t\tvar p = s.Last();\n\t\t\tvar n = long.Parse(s.Substring(0, s.Length - 1));\n\t\t\tlong ans = 0;\n\t\t\tans = (n - 1) / 4 * 16;\n\t\t\tn = n % 2;\n\t\t\tif (n % 2 == 0)\n\t\t\t\tans += 7;\n\t\t\tif (p == 'f')\n\t\t\t\tans++;\n\t\t\tif (p == 'e')\n\t\t\t\tans += 2;\n\t\t\tif (p == 'd')\n\t\t\t\tans += 3;\n\t\t\tif (p == 'a')\n\t\t\t\tans += 4;\n\t\t\tif (p == 'b')\n\t\t\t\tans += 5;\n\t\t\tif (p == 'c')\n\t\t\t\tans += 6;\n\t\t\tConsole.WriteLine(ans);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c0953759c90138c7b1cebf450d142a53", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1 {\n class Program {\n \n static void Main(string[] args) {\n string s = Console.ReadLine();\n long n = long.Parse(s.Substring(0, s.Length - 1)) - 1;\n char seat = s[s.Length - 1];\n int sec = seat <= 'c' ? seat - 'a' + 4 : 'f' - seat + 1;\n long answer = ((n >> 2) << 4) + (n & 1)*7 + sec;\n \n Console.WriteLine(Math.Abs(answer));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cda55678ff5d7cab4cb8ce53923ea3f2", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "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\tstring s = Console.ReadLine ();\n\t\tchar col = s.Last ();\n\t\ts = s.Substring (0, s.Length - 1);\n\t\tlong row = long.Parse(s);\n\t\tlong time = (row-1) / 4 * 2 * 8;\n\t\trow %= 4;\n\t\tif (row % 2 == 0)\n\t\t\ttime += 7;\n\t\ttime += \"fedabc\".IndexOf (col) + 1;\n\t\tConsole.WriteLine (time);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5d51b5ec3ae7e9f01e6ab4cee3299113", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();// Console.In.ReadToEnd().Split(new char[] { '\\n', '\\r'}, StringSplitOptions.RemoveEmptyEntries)[1];\n long row = long.Parse(input.Substring(0, input.Length - 1));\n long res = ((row - 1L) / 4L)*16L;\n if ((row % 4L) % 2L == 0L) res += 7L;\n row = input[input.Length - 1];\n if (row < 100L) { res += 3L; res += row == 97L ? 1L : row == 99L ? 3L : 2L; }\n else res += row == 102L ? 1L : row == 100L ? 3L : 2L;\n Console.WriteLine(res);\n }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bd8667d372a8036c93782ce3270ff198", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _725B\n {\n public static void Main()\n {\n var ns = Console.ReadLine();\n\n long n = long.Parse(ns.Substring(0, ns.Length - 1));\n char s = ns.Last();\n\n long t = (n - 1) / 4 * 16 + (n - 1) % 2 * 7;\n\n switch (s)\n {\n case 'a':\n t += 4;\n break;\n case 'b':\n t += 5;\n break;\n case 'c':\n t += 6;\n break;\n case 'd':\n t += 3;\n break;\n case 'e':\n t += 2;\n break;\n case 'f':\n t += 1;\n break;\n }\n\n Console.WriteLine(t);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "28f26d21c2fb43681dac01a580a3aca0", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "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 var line = Console.ReadLine();\n var row = ulong.Parse(line.Substring(0, line.Length - 1));\n var place = line[line.Length - 1];\n\n var rowsIn4 = row % 4;\n ulong ans = 0;\n if (rowsIn4 == 0)\n {\n if (row > 4)\n {\n var rows4 = row / 4 - 1;\n if (rows4 > 0)\n {\n ans = rows4 * (6 + 6 + 1) + rows4 * 3;\n row = row - rows4 * 4;\n }\n }\n }\n else\n {\n var rows4 = row / 4;\n if (rows4 > 0)\n {\n ans = rows4 * (6 + 6 + 1) + rows4 * 3;\n row = row - rows4 * 4;\n }\n }\n\n var times = new Dictionary\n {\n {'a', 4}, {'b', 5}, {'c', 6},\n {'f', 1}, {'e', 2}, {'d', 3}\n };\n var firstOrSecond = row % 2;\n if (firstOrSecond == 1) // 1 or 3\n {\n ans = ans + times[place];\n }\n else // 2 or 4\n {\n ans = 7 + ans + times[place];\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1865d5bd290d9372a3e1a96ddbbc7ebc", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "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 //////////////////////////////////////////////////\n void Solution()\n {\n var s = rs;\n char ch = s[s.Length - 1];\n var n = long.Parse(s.Remove(s.Length - 1)) - 1;\n long res = 0;\n\n res += (n / 4) * 16;\n var q = n % 4;\n\n if (q == 1 || q == 3)\n {\n res += 7;\n }\n var a = \"fedabc\";\n for (int i = 0; i < 6; i++)\n if (a[i] == ch)\n {\n res += i + 1;\n break;\n }\n wln(res);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0ad60f13e1d5767ea5b5508f9e40a564", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "Mono C#", "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\tFunc f = c =>{\n\t\t\tint ret = 0;\n\t\t\tswitch(c){\n\t\t\t\tcase 'a' :ret = 4;break;\n\t\t\t\tcase 'b' :ret = 5;break;\n\t\t\t\tcase 'c' :ret = 6;break;\n\t\t\t\tcase 'd' :ret = 3;break;\n\t\t\t\tcase 'e' :ret = 2;break;\n\t\t\t\tcase 'f' :ret = 1;break;\n\t\t\t}\n\t\t\treturn ret;\n\t\t};\n\t\t\n\t\tlong ans = ((R-1)/4)*16;\n\t\tif(R%4 == 1)ans += f(C);\n\t\tif(R%4 == 3)ans += f(C);\n\t\tif(R%4 == 2)ans += 7 + f(C);\n\t\tif(R%4 == 0)ans += 7 + f(C);\n\t\t\n\t\tConsole.WriteLine(ans);\n\t\t\n\t}\n\tlong R;\n\tchar C;\n\tpublic Sol(){\n\t\t\n\t\tvar s = rs();\n\t\tR = long.Parse(s.Substring(0,s.Length-1));\n\t\tC = s[s.Length-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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4253ca295a4143f176b27f452065f10b", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _733B {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\t\t\tstring input = Console.ReadLine();\n\t\t\tchar c = input[input.Length - 1];\n\t\t\tlong s = long.Parse(input.Substring(0, input.Length - 1));\n\t\t\tlong res = 0;\n\t\t\tif (s % 2 == 0) {\n\t\t\t\tres++;\n\t\t\t}\n\t\t\tres += (((s - 1) / 4) * 2);\n\t\t\tres *= 8;\n\t\t\tif (s % 2 == 0)\n\t\t\t\tres--;\n\t\t\tstring order = \"fedabc\";\n\t\t\tres += Array.IndexOf(order.ToCharArray(), c) + 1;\n\t\t\tConsole.WriteLine(res);\n\t\t\t//Console.ReadKey();\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "263743dc00f47bb7c39d41b3a987c654", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "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 ulong n = ulong.Parse(s.Substring(0, s.Length - 1));\n char c = s[s.Length - 1];\n ulong k = 0;\n if (n % 2 == 0)\n {\n if ((n / 2) % 2 != 0)\n {\n k = (n + 2) / 2;\n }\n else\n {\n k = n / 2;\n }\n }\n else\n {\n if ((n / 2) % 2 == 0)\n {\n k = (n + 2) / 2;\n }\n else\n {\n k = n / 2;\n }\n }\n ulong ans = (k - 1) * 6 + ((k - 1) / 2) * 3 + (k - 1) - ((k - 1) / 2);\n ulong temp = 0;\n switch (c)\n {\n case 'a': temp = 4; break;\n case 'b': temp = 5; break;\n case 'c': temp = 6; break;\n case 'd': temp = 3; break;\n case 'e': temp = 2; break;\n default: temp = 1; break;\n }\n ans += temp;\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fe0c32a64a447d3f0eec76ceb410f3f2", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main()\n {\n //var s = Console.ReadLine().Split(' ');\n var str = Console.ReadLine();\n var k = long.Parse(str.Substring(0,str.Length-1));\n byte g = 0;\n switch (str[str.Length - 1])\n {\n case 'a':\n g = 4;\n break;\n case 'b':\n g = 5;\n break;\n case 'c':\n g = 6;\n break;\n case 'd':\n g = 3;\n break;\n case 'e':\n g = 2;\n break;\n case 'f':\n g = 1;\n break;\n }\n var result = (k%4==0?k-1:k)/4*16;\n k = k%4 == 0 ? 4 : k%4;\n result += g;\n if (k%2 == 0)\n result += 7;\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8c3351d6244af916ddd8963622d3b60", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\n\nnamespace ConsoleApplication1\n{\n class CanadaCup2\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"D:\\Sergey\\Code\\1.txt\"));\n\n string ns = Console.ReadLine();\n ulong n = ulong.Parse(ns.Substring(0, ns.Length - 1));\n char s = ns[ns.Length - 1];\n int c = s - 'a';\n int[] d = new int[] { 3, 4, 5, 2, 1, 0 };\n ulong a = (n - 1) % 2;\n ulong b = (n - 1) / 4;\n //if (b > 1)\n // b -= 2;\n\n ulong e = b * 16;\n if (a > 0)\n e+=7;\n e += (ulong)(d[c] + 1);\n\n Console.WriteLine(e);\n\n } // Main\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d9f7e7ed480a5e2e337192b45727efa4", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CanadaCup2016\n{\n class Submit\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var r = long.Parse(s.Substring(0, s.Length-1)) - 1;\n var c = 0;\n switch (s[s.Length - 1])\n {\n case 'a':\n c = 4;\n break;\n case 'b':\n c = 5;\n break;\n case 'c':\n c = 6;\n break;\n case 'd':\n c = 3;\n break;\n case 'e':\n c = 2;\n break;\n case 'f':\n c = 1;\n break;\n }\n Console.WriteLine(16 * (r / 4) + 7 * (r % 2) + c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f83196aef6996cc5271f044f81b37429", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "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\n long n = long.Parse(s.Substring(0, s.Length - 1)) - 1;\n int m = \"fedabc\".IndexOf(s[s.Length - 1]);\n\n Write(n / 4 * 16 + n % 2 * 7 + m + 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1090f2f28cf52cfd59d94ed228b73c9f", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n static Func GetInt = x => { return Convert.ToInt64(x); };\n static void Main(string[] args)\n {\n Dictionary sit = new Dictionary {['f'] = 1, ['e'] = 2, ['d'] = 3, ['a'] = 4, ['b'] = 5, ['c'] = 6 };\n string str = Console.ReadLine();\n char ch = str[str.Length - 1];\n long n = GetInt(str.Substring(0, str.Length - 1));\n if (n % 4 == 3 || n % 4 == 0) n -= 2;\n long sec = sit[ch] + (n / 2) * 6 + n - 1;\n Console.Write(sec);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fdadf96f50dc9f92324997e03e552d07", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "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 input = sr.NextString();\n\t\t\tvar n = Int64.Parse(input.Substring(0, input.Length - 1));\n\t\t\tvar m = input[input.Length - 1];\n\t\t\tvar first = GetFirst(n);\n\t\t\tvar second = GetSecond(n);\n\n\t\t\tsw.WriteLine(first * 6M + second + Count(m));\n\t\t}\n\n\t\tprivate long GetFirst(long n)\n\t\t{\n\t\t\tif (n % 2 == 0) {\n\t\t\t\tif (n % 4 != 0)\n\t\t\t\t\tn += 2;\n\n\t\t\t\treturn (n / 4L) * 2L - 1L;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((n + 1)%4 == 0)\n\t\t\t\t\tn += 1;\n\t\t\t\telse\n\t\t\t\t\tn += 3;\n\n\t\t\t\treturn (n / 4L) * 2L - 2L;\n\t\t\t}\n\t\t}\n\n\t\tprivate long GetSecond(long n)\n\t\t{\n\t\t\tif (n % 2 == 0) {\n\t\t\t\tif (n % 4 != 0)\n\t\t\t\t\tn += 2;\n\n\t\t\t\treturn 1L + ((n / 4L) - 1L) * 4L;\n\t\t\t}\n\t\t\tif ((n + 1) % 4 == 0)\n\t\t\t\tn += 1;\n\t\t\telse\n\t\t\t\tn += 3;\n\n\t\t\treturn (n / 4L - 1L) * 4L;\n\t\t}\n\n\t\tprivate long Count(char ch)\n\t\t{\n\t\t\tif (ch == 'f')\n\t\t\t\treturn 1L;\n\t\t\tif (ch == 'e')\n\t\t\t\treturn 2L;\n\t\t\tif (ch == 'd')\n\t\t\t\treturn 3L;\n\t\t\tif (ch == 'c')\n\t\t\t\treturn 6L;\n\t\t\tif (ch == 'b')\n\t\t\t\treturn 5L;\n\t\t\treturn 4L;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bff30b53448ba6601c73bc67c46ab356", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "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 string s = Console.ReadLine();\n string f = \"\";\n for (int i = 0; i < s.Length-1; i++)\n {\n f = f + s[i];\n }\n char c = s[s.Length - 1];\n long n = Convert.ToInt64(f);\n long sum = 0;\n sum = ((n - 1) / 4) * 2 * 8;\n if(n%4==2 ||n%4==0)\n {\n sum += 7;\n if (c == 'f')\n sum += 1;\n if (c == 'e')\n sum += 2;\n if (c == 'd')\n sum += 3;\n if (c == 'a')\n sum += 4;\n if (c == 'b')\n sum += 5;\n if (c == 'c')\n sum += 6;\n }\n else\n {\n if (c == 'f')\n sum += 1;\n if (c == 'e')\n sum += 2;\n if (c == 'd')\n sum += 3;\n if (c == 'a')\n sum += 4;\n if (c == 'b')\n sum += 5;\n if (c == 'c')\n sum += 6;\n }\n Console.WriteLine(sum);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "78217398ca375603c4ddf85eaaeac4ee", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\n\nnamespace tes\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\n\t\t \n \n string s = Console.ReadLine();\n string r = \"\";\n string c = \"\";\n int len = s.Length;\n for(int i=0; i< len; i++)\n {\n if (i < len - 1) r += s[i];\n else c += s[i];\n }\n\n var col = new string[]{\"f\",\"e\",\"d\",\"a\",\"b\",\"c\" };\n long row = long.Parse(r);\n\n long time = (Array.IndexOf(col,c))+1;\n \n long a = row/3;\n long b = row % 3;\n\n long turn = row / 4;\n if (row % 4 > 0) turn++;\n\n time += (turn+turn-2) * 7;\n time += (turn -1) * 2;\n\n if (row % 2 == 0)\n {\n time += 7;\n }\n\n\n \n\n\n\n\n Console.WriteLine(time);\n\n\n\n\n\t\n\n\n\t\t\n }\n\t\t\n\t\t\n\t\t\t\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "770ae84b633c03d74287babd3780bd28", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "namespace Play.Codeforces\n{\n using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n string token = Console.ReadLine();\n\n long n = long.Parse(token.Substring(0, token.Length - 1));\n char s = token[token.Length - 1];\n\n long result = ((n-1)/4)*16;\n if (n%2 == 0)\n {\n result += 7;\n }\n switch (s)\n {\n case 'a':\n case 'b':\n case 'c':\n result += (s - 'a' + 4);\n break;\n case 'd':\n case 'e':\n case 'f':\n result += ('f' - s + 1);\n break;\n }\n Console.WriteLine(result);\n\n }\n\n }\n \n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e9f8316314a371457b5e4bce61b594b3", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace D\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 static void Main(string[] args)\n {\n string str = Console.ReadLine();\n char place2 = str[str.Length - 1];\n str = str.Remove(str.Length - 1); //Console.WriteLine(str);\n ulong place1 = Convert.ToUInt64(str);\n ulong countRow = (place1 - 1) / 4; //\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u043d\u044b\u0445 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 \u0440\u044f\u0434\u043e\u0432\n place1 = (place1 % 4);\n if (place1 == 0)\n place1 = 4;\n ulong time = countRow * 16;\n switch (place2)\n {\n case 'f':\n time += 1;\n break;\n case 'e':\n time += 2;\n break;\n case 'd':\n time += 3;\n break;\n case 'a':\n time += 4;\n break;\n case 'b':\n time += 5;\n break;\n case 'c':\n time += 6;\n break;\n }\n if (place1 == 2 || place1 == 4)\n time += 7;\n Console.WriteLine(time);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0315037cc136f7d5a6cf46fc9677daf3", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using Boilerplate.IO;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Runtime.InteropServices;\n\nnamespace Boilerplate.IO\n{\n #region helpers\n class FormattedStreamWriter : StreamWriter\n {\n public FormattedStreamWriter(Stream stream) : base(stream) { }\n public FormattedStreamWriter(string filePath) : base(filePath) { }\n public override IFormatProvider FormatProvider\n {\n get\n {\n return CultureInfo.InvariantCulture;\n }\n }\n }\n static class IOExtensions\n {\n public static string ReadString(this StreamReader reader)\n {\n return reader.ReadToken();\n }\n public static int ReadInt(this StreamReader reader)\n {\n return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture);\n }\n public static uint ReadUnsignedInt(this StreamReader reader)\n {\n return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture);\n }\n public static long ReadLong(this StreamReader reader)\n {\n return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture);\n }\n public static double ReadDouble(this StreamReader reader)\n {\n return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture);\n }\n public static decimal ReadDecimal(this StreamReader reader)\n {\n return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static void ResetBuffer()\n {\n buffer = new Queue(1000);\n }\n\n static Queue buffer = new Queue(1000);\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 } return buffer.Dequeue();\n }\n }\n #endregion\n}\n\n#region launch\nclass Program\n{\n static void Main2(string[] args)\n {\n var cycles = 100;\n while (cycles-- > 0)\n {\n Main2(new[] { \"g\" });\n Main2(new[] { \"r\" });\n }\n }\n\n static void Main(string[] args)\n {\n#if SOLVER_ATWORKSPACE\n var run = true;\n var outputFile = \"output.txt\";\n var inputFile = \"input.txt\";\n switch (args[0])\n {\n case \"g\":\n run = false;\n outputFile = \"input.txt\";\n inputFile = \"output.txt\";\n break;\n case \"r\":\n default:\n run = true;\n inputFile = \"input.txt\";\n outputFile = \"output.txt\";\n break;\n }\n#endif\n\n using (var writer = new FormattedStreamWriter(\n#if SOLVER_ATWORKSPACE\noutputFile\n#else\n Console.OpenStandardOutput()\n#endif\n))\n {\n using (var reader = new StreamReader(\n#if SOLVER_ATWORKSPACE\ninputFile\n#else \n Console.OpenStandardInput() \n#endif\n))\n {\n#if SOLVER_ATWORKSPACE\n var stopw = new Stopwatch();\n stopw.Start();\n#endif\n#if SOLVER_ATWORKSPACE\n if (run)\n new Solver(reader, writer).Do();\n else\n new Generator(reader, writer).Create();\n\n#else\n new Solver(reader, writer).Do();\n#endif\n#if SOLVER_ATWORKSPACE\n stopw.Stop();\n writer.WriteLine(\"> {0}ms\", stopw.ElapsedMilliseconds);\n#endif\n }\n }\n }\n}\n#endregion\n\npublic class Solver\n{\n private readonly StreamReader reader;\n private readonly StreamWriter writer;\n\n public Solver(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\n public void Do()\n {\n var s = reader.ReadString();\n var pos = s[s.Length - 1];\n s = s.Substring(0, s.Length - 1);\n var n = long.Parse(s);\n long res = 0;\n var dc = new Dictionary() { \n {'a', 4 },\n {'b', 5 },\n {'c', 6 },\n {'d', 3 },\n {'e', 2 },\n {'f', 1 },\n };\n --n;\n var nd = n / 4;\n var nr = n % 4;\n res += nd * 16;\n if (nr % 2 == 1)\n res += 7;\n res += dc[pos];\n writer.WriteLine(res);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ef409a7c344df0680905d8c74f4f0ae0", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "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 long ans = 0;\n var s = Console.ReadLine();\n var letter = s.Last();\n var numberS = s.Substring(0, s.Length - 1);\n long number = long.Parse(numberS);\n long lastNumber = long.Parse(numberS.Last().ToString());\n long rows = 0;\n\n var xEven = new List {2, 6};\n var yEven = new List {0, 4, 8};\n var xOdd = new List {1, 5, 9};\n var yOdd = new List {3, 7};\n\n long numberOfTen = number/10;\n bool numberOfTenIsEven = numberOfTen%2 == 0;\n bool isEven = number%2 == 0;\n\n if (numberOfTenIsEven)\n {\n if (isEven)\n {\n if (lastNumber == 2 || lastNumber == 6)\n {\n rows = number/2 + 1;\n ans += number;\n }\n else\n {\n rows = number/2;\n ans += (number - 2);\n }\n }\n else\n {\n if (lastNumber == 1 || lastNumber == 5 || lastNumber == 9)\n {\n rows = number / 2 + 1;\n ans += number;\n }\n else\n {\n rows = number / 2;\n ans += (number - 2);\n }\n }\n }\n else\n {\n if (isEven)\n {\n if (lastNumber == 2 || lastNumber == 6)\n {\n rows = number / 2;\n ans += (number - 2);\n }\n else\n {\n rows = number / 2+1;\n ans += number;\n }\n }\n else\n {\n if (lastNumber == 1 || lastNumber == 5 || lastNumber == 9)\n {\n rows = number / 2;\n ans += (number - 2);\n }\n else\n {\n rows = number / 2+1;\n ans += number;\n }\n }\n }\n ans--;\n ans += ((rows-1)*6);\n if (letter =='f')\n {\n ans += 1;\n }\n else if (letter == 'e')\n ans += 2;\n else if (letter == 'd')\n ans += 3;\n else if (letter == 'a')\n ans += 4;\n else if (letter == 'b')\n ans += 5;\n else if (letter == 'c')\n ans += 6;\n\n Console.WriteLine(ans);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "890503180ac528ccddeb641275d135a8", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _725B {\n class Program {\n static void Main(string[] args) {\n int row = Console.Read() - '0';\n int col = Console.Read() - 'c'; //a = -2, b = -1, c = 0, d = 1, e = 2, f = 3\n int seconds = 0;\n\n if(col <= 0) {\n seconds += 6 + col;\n } else {\n seconds += 4 - col;\n }\n\n //1, 2, 5, 6, 9, 10 - attendant A\n //3, 4, 7, 8, 11, 12 - attendant B\n int a = 1;\n int b = 3;\n for(; (a != row) && (b != row); a++, b++) { //quit when attendant reaches row\n if(a % 2 == 0) {\n a += 2;\n b += 2;\n seconds += 2;\n }\n seconds += 7;\n }\n Console.WriteLine(seconds);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7c432b24c979beff032764562e168a01", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, time = 0;\n string str = Console.ReadLine();\n n = int.Parse(str.Substring(0,1));\n time = (n - 1) / 4 * 16;\n if (n % 2 == 0)\n time += 7;\n if (str[1] == 'f')\n time++;\n else if (str[1] == 'e')\n time += 2;\n else if (str[1] == 'd')\n time += 3;\n else if (str[1] == 'a')\n time += 4;\n else if (str[1] == 'b')\n time += 5;\n else if (str[1] == 'c')\n time += 6; \n Console.WriteLine(time);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5e9097db7f447366d5e794b0db62a973", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CanadaCup2016\n{\n class Submit\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var r = int.Parse(s[0].ToString()) - 1;\n var c = 0;\n switch (s[1])\n {\n case 'a':\n c = 4;\n break;\n case 'b':\n c = 5;\n break;\n case 'c':\n c = 6;\n break;\n case 'd':\n c = 3;\n break;\n case 'e':\n c = 2;\n break;\n case 'f':\n c = 1;\n break;\n }\n Console.WriteLine(12 * (r / 4) + 6 * (r % 2) + r - 2 * ((r % 4) / 2) + c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f0ada485e576cc81479b88b708c9808a", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main()\n {\n //var s = Console.ReadLine().Split(' ');\n var str = Console.ReadLine();\n var k = long.Parse(str.Substring(0,str.Length-1));\n byte g = 0;\n switch (str[str.Length - 1])\n {\n case 'a':\n g = 4;\n break;\n case 'b':\n g = 5;\n break;\n case 'c':\n g = 6;\n break;\n case 'd':\n g = 3;\n break;\n case 'e':\n g = 2;\n break;\n case 'f':\n g = 1;\n break;\n }\n var result = k/5*16;\n k = k%4 == 0 ? 4 : k%4;\n if (k%2 == 0)\n {\n result += 7 + g;\n }\n else result += g;\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e9cd9b4e9ded5380a3816d806bfaab88", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeff\ufeff\ufeffusing System;\n\ufeff\ufeffusing 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 input = sr.NextString();\n\t\t\tvar n = Int64.Parse(input.Substring(0, input.Length - 1));\n\t\t\tvar m = input[input.Length - 1];\n\t\t\tvar first = GetFirst(n);\n\t\t\tvar second = GetSecond(n);\n\n\t\t\tsw.WriteLine((decimal)first*6M + (decimal)second + (decimal)Count(m));\n\t\t}\n\n\t\tprivate long GetFirst(long n)\n\t\t{\n\t\t\tif (n % 2 == 0) {\n\t\t\t\tif (n % 4 != 0) {\n\t\t\t\t\tn += 2;\n\t\t\t\t}\n\n\t\t\t\treturn (n / 4L) * 2L - 1L;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (n % 3 == 0) {\n\t\t\t\t\tn += 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tn += 3;\n\t\t\t\t}\n\n\t\t\t\treturn (n / 4L) * 2L - 2L;\n\t\t\t}\n\t\t}\n\n\t\tprivate long GetSecond(long n)\n\t\t{\n\t\t\tif (n % 2 == 0) {\n\t\t\t\tif (n % 4 != 0) {\n\t\t\t\t\tn += 2;\n\t\t\t\t}\n\n\t\t\t\treturn 1L + ((n / 4L) - 1L) * 4L;\n\t\t\t}\n\t\t\tif (n % 3 == 0) {\n\t\t\t\tn += 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tn += 3;\n\t\t\t}\n\n\t\t\treturn (n / 4L - 1L) * 4L;\n\t\t}\n\n\t\tprivate long Count(char ch)\n\t\t{\n\t\t\tif (ch == 'f')\n\t\t\t\treturn 1L;\n\t\t\tif (ch == 'e') {\n\t\t\t\treturn 2L;\n\t\t\t}\n\t\t\tif (ch == 'd')\n\t\t\t\treturn 3L;\n\t\t\tif (ch == 'c')\n\t\t\t\treturn 6L;\n\t\t\tif (ch == 'b')\n\t\t\t\treturn 5L;\n\t\t\treturn 4L;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8aa9e0c90aa1d697ca6a9837b99069ef", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CanadaCup2016\n{\n class Submit\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var r = long.Parse(s[0].ToString()) - 1;\n var c = 0;\n switch (s[1])\n {\n case 'a':\n c = 4;\n break;\n case 'b':\n c = 5;\n break;\n case 'c':\n c = 6;\n break;\n case 'd':\n c = 3;\n break;\n case 'e':\n c = 2;\n break;\n case 'f':\n c = 1;\n break;\n }\n Console.WriteLine(16 * (r / 4) + 7 * (r % 2) + c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1d6e7970840ad5651eaf88e62439741f", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CanadaCup2016\n{\n class Submit\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var r = int.Parse(s[0].ToString()) - 1;\n var c = 0;\n switch (s[1])\n {\n case 'a':\n c = 4;\n break;\n case 'b':\n c = 5;\n break;\n case 'c':\n c = 6;\n break;\n case 'd':\n c = 3;\n break;\n case 'e':\n c = 2;\n break;\n case 'f':\n c = 1;\n break;\n }\n Console.WriteLine(16 * (r / 4) + 7 * (r % 2) + c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "534ff2235cb8901eccb5ea38efc947bf", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": " using System;\n\n namespace reverseString\n {\n class Program\n {\n static void Main(string[] args)\n {\n while (true)\n {\n System.Int64 ans, rem, r, s;\n String str = Console.ReadLine();\n\n int len = str.Length;\n r = 0;\n for (int i = 0; i < len - 1; i++)\n {\n r = r * 10 + str[i] - '0';\n }\n\n // Console.WriteLine(\"r is {0}\", r);\n s = str[len - 1];\n\n // Console.WriteLine(\"s is {0}\", s);\n\n rem = (r - 1) / 4;\n // Console.WriteLine(\"rem is {0}\", rem);\n\n ans = rem * 12;\n // Console.WriteLine(\"ans is {0}\", ans);\n\n\n if (r % 2 == 0)\n {\n ans += 6;\n //Console.WriteLine(\"ans1 is {0}\", ans);\n }\n\n if (r % 4 == 1 || r % 4 == 2)\n {\n ans += r - 1;\n // Console.WriteLine(\"ans2 is {0}\", ans);\n }\n else if (r % 4 == 3 || r % 4 == 0)\n {\n ans += r - 3;\n // Console.WriteLine(\"ans3 is {0}\", ans);\n }\n\n if (s == 'a')\n {\n ans += 4;\n // Console.WriteLine(\"ans4 is {0}\", ans);\n }\n else if (s == 'b')\n {\n ans += 5;\n Console.WriteLine(\"ans5 is {0}\", ans);\n }\n else if (s == 'c')\n {\n ans += 6;\n // Console.WriteLine(\"ans6 is {0}\", ans);\n }\n else if (s == 'd')\n {\n ans += 3;\n // Console.WriteLine(\"ans is {0}\", ans);\n }\n else if (s == 'e')\n {\n ans += 2;\n // Console.WriteLine(\"ans is {0}\", ans);\n }\n else\n {\n ans += 1;\n // Console.WriteLine(\"ans is {0}\", ans);\n }\n\n Console.WriteLine(ans);\n\n }\n\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8afb993412ef28ed84b320d11d643e83", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\n\nnamespace ConsoleApplication1\n{\n class CanadaCup2\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"D:\\Sergey\\Code\\1.txt\"));\n\n string ns = Console.ReadLine();\n int n = int.Parse(ns.Substring(0, ns.Length - 1));\n char s = ns[ns.Length - 1];\n int c = s - 'a';\n int[] d = new int[] { 3, 4, 5, 2, 1, 0 };\n int a = (n - 1) % 2;\n int b = (n - 1) / 4;\n //if (b > 1)\n // b -= 2;\n\n int e = b * 16;\n if (a > 0)\n e+=7;\n e += d[c] + 1;\n\n Console.WriteLine(e);\n\n } // Main\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "854a955aee35b37eab96788eb7c1f71f", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _725B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string S = Console.ReadLine();\n int L = S.Length; int A2 = 0;\n char C = char.Parse(S.Substring(L-1));\n int N = int.Parse(S.Substring(0,L-1));\n\n switch (C)\n {\n case 'f':\n A2 = 1;\n break;\n case 'e':\n A2 = 2;\n break;\n case 'd':\n A2 = 3;\n break;\n case 'a':\n A2 = 4;\n break;\n case 'b':\n A2 = 5;\n break;\n case 'c':\n A2 = 6;\n break;\n\n }\n\n int A1 = 16 * ((N - 1) / 4);\n int A3 = 0;\n if ((N % 2) == 0) A3 = 7;\n int T = A1 + A2 + A3;\n\n Console.WriteLine(T);\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b7d366d8c6d7d358a3dbf1faaf17592e", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main()\n {\n //var s = Console.ReadLine().Split(' ');\n var str = Console.ReadLine();\n var k = long.Parse(str.Substring(0,str.Length-1));\n byte g = 0;\n switch (str[str.Length - 1])\n {\n case 'a':\n g = 4;\n break;\n case 'b':\n g = 5;\n break;\n case 'c':\n g = 6;\n break;\n case 'd':\n g = 3;\n break;\n case 'e':\n g = 2;\n break;\n case 'f':\n g = 1;\n break;\n }\n var result = 0;\n while (k > 4)\n {\n result += 16;\n k -= 4;\n }\n if (k%2 == 0)\n {\n result += 7 + g;\n }\n else result += g;\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2b8bea0ac071ad332586d7f4a9af58ed", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fff975bfcc027c16747302b241febed2", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "difficulty": 1900.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9fc6ee457732bcfa70d84c6511f9675f", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "difficulty": 1900.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cfb92d5fd5fa8f4a57b8022350de7315", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "difficulty": 1900.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b90b82c6fc1c2e417e9f5f7984ae1ebd", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "difficulty": 1900.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5b39fa78f2b82d3223ffcf544143add5", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "difficulty": 1900.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2c38d790228acdbdf03f410c27ae3747", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "difficulty": 1900.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d54e9f57c587ffed811e0e206e432fb7", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "difficulty": 1900.0} {"lang": "Mono C#", "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, M, L, R;\n sc.Make(out N, out M, out L, out R);\n R -= L;\n if (N * M % 2 == 1)\n {\n Fail(ModInt.Pow(R + 1, N * M));\n }\n long odd = (R + 1) / 2, even = R / 2 + 1;\n ModInt a = (ModInt)odd / ((R+1) * 2);\n WriteLine(ModInt.Pow(R + 1, N * M - 1) * (a * odd + (1 - a) * even));\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 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 [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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5a66c8949bf82cade5d1eb54f282068d", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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, M, L, R;\n sc.Make(out N, out M, out L, out R);\n R -= L;\n if (N * M % 2 == 1)\n {\n Fail(ModInt.Pow(R + 1, N * M));\n }\n long odd = (R + 1) / 2, even = R / 2 + 1;\n ModInt a = (ModInt)odd / (R * 2);\n WriteLine(ModInt.Pow(R + 1, N * M - 1) * (a * odd + (1 - a) * even));\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 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 [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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aa171c837d937452abbce6b934006a85", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = System.Int64;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n var n = rl;\n var m = rl;\n var L = rl;\n var R = rl;\n var cnt = new long[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n cnt[0] -= (L - 1) / 2;\n cnt[1] -= L / 2;\n\n var B = (n * m + 1) / 2;\n var W = n * m / 2;\n var mat = new Matrix(2, 2);\n mat[0, 0] = mat[1, 1] = cnt[0];\n mat[0, 1] = mat[1, 0] = cnt[1];\n var vec = new Matrix(2, 1);\n vec[1, 0] = 1;\n var u = Matrix.Pow(mat, B) * vec;\n var v = Matrix.Pow(mat, W) * vec;\n var ans = u[0, 0] * v[0, 0] + u[1, 0] * v[1, 0];\n Console.WriteLine(ans);\n // naive(n, m, L, R);\n }\n void naive(int n, int m, int l, int r) {\n var dp = new ModInt[2, 2];\n dp[0, 0] = 1;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < m; j++) {\n var p = (i + j) % 2;\n var next = new ModInt[2, 2];\n for (int u = 0; u < 2; u++)\n for (int v = 0; v < 2; v++)\n for (int x = l; x <= r; x++) {\n if (p == 0) next[(u + x) % 2, v] += dp[u, v];\n else next[u, (v + x) % 2] += dp[u, v];\n }\n dp = next;\n }\n var ans = dp[0, 0] + dp[1, 1];\n Console.WriteLine(ans);\n }\n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 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#endregion\n#region Matrix\npublic class Matrix {\n int row, col;\n public N[] mat;\n /// \n /// \u884c \u5217\u76ee\u306e\u8981\u7d20\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\n /// \n /// \u884c\u306e\u756a\u53f7\n /// \u5217\u306e\u756a\u53f7\n public N this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new N[row * col];\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n System.Diagnostics.Debug.Assert(l.col == r.row);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n /// \n /// ^ \u3092 O(^3 log ) \u3067\u8a08\u7b97\u3057\u307e\u3059\u3002\n /// \n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public N[][] Items {\n get {\n var a = new N[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new N[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fd4bc412aced50c618c763870a63a8fa", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = ModInt;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n var n = rl;\n var m = rl;\n var L = ri;\n var R = ri;\n var cnt = new long[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n cnt[0] -= (L - 1) / 2;\n cnt[1] -= L / 2;\n\n Debug.WriteLine(cnt.AsJoinedString());\n var mat = new Matrix(2, 2);\n mat[0, 0] = mat[1, 1] = cnt[0];\n mat[0, 1] = mat[1, 0] = cnt[1];\n var res = Matrix.Pow(mat, n * m);\n Console.WriteLine(res[1, 1]);\n }\n\n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 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#endregion\n\n#region Matrix\npublic class Matrix {\n int row, col;\n public N[] mat;\n /// \n /// \u884c \u5217\u76ee\u306e\u8981\u7d20\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\n /// \n /// \u884c\u306e\u756a\u53f7\n /// \u5217\u306e\u756a\u53f7\n public N this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new N[row * col];\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n System.Diagnostics.Debug.Assert(l.col == r.row);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n /// \n /// ^ \u3092 O(^3 log ) \u3067\u8a08\u7b97\u3057\u307e\u3059\u3002\n /// \n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public N[][] Items {\n get {\n var a = new N[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new N[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e54ee9ad3f31b2ecb38b31d0a2c8a354", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = ModInt;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n checked {\n var n = rl;\n var m = rl;\n var L = rl;\n var R = rl;\n var cnt = new long[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n cnt[0] -= (L - 1) / 2;\n cnt[1] -= L / 2;\n var mat = new Matrix(2, 2);\n mat[0, 0] = cnt[0]; mat[1, 1] = cnt[0];\n mat[0, 1] = cnt[1]; mat[1, 0] = cnt[1];\n\n\n var res = Matrix.Pow(mat, n * m);\n Debug.WriteLine(ModInt.Pow(R - L + 1, n * m));\n Debug.WriteLine(res[0, 1] + res[1, 1]);\n if ((res[0, 1] + res[1, 1] - ModInt.Pow(R - L + 1, n * m)).num != 0)\n throw new Exception();\n Console.WriteLine(res[1, 1]);\n }\n }\n\n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 long ret = 1;\n for (; 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#endregion\n#region Matrix\npublic class Matrix {\n int row, col;\n public Number[] mat;\n public Number this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new Number[row * col];\n }\n public static Matrix operator +(Matrix l, Matrix r) {\n check(l, r);\n var ret = new Matrix(l.row, l.col);\n for (int i = 0; i < l.row; i++)\n for (int j = 0; j < l.col; j++)\n ret.mat[i * ret.col + j] = l.mat[i * l.col + j] + r.mat[i * r.col + j];\n return ret;\n\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n checkMul(l, r);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public static Matrix Trans(Matrix m) {\n var ret = new Matrix(m.col, m.row);\n for (int i = 0; i < m.row; i++)\n for (int j = 0; j < m.col; j++)\n ret.mat[j * m.col + i] = m.mat[i * m.col + j];\n return ret;\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void check(Matrix a, Matrix b) {\n if (a.row != b.row || a.col != b.col)\n throw new Exception(\"row and col have to be same.\");\n\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void checkMul(Matrix a, Matrix b) {\n if (a.col != b.row)\n throw new Exception(\"row and col have to be same.\");\n }\n public Number[][] Items {\n get {\n var a = new Number[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new Number[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n public override string ToString() {\n return string.Format(\"{0}*{1}\", row, col);\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3160fade8913b837ddd5ba89b1bc9677", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = ModInt;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n var n = rl;\n var m = rl;\n var L = ri;\n var R = ri;\n var cnt = new ModInt[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n cnt[1] -= L / 2;\n var ans = new ModInt[2];\n ans[0] = 1;\n var s = n * m;\n while (s > 0) {\n if (s % 2 == 1) {\n var nans = new ModInt[2];\n for (int i = 0; i < 2; i++)\n for (int j = 0; j < 2; j++)\n nans[(i + j) % 2] += ans[i] * cnt[j];\n ans = nans;\n s--;\n }\n else {\n var ncnt = new ModInt[2];\n for (int i = 0; i < 2; i++)\n for (int j = 0; j < 2; j++)\n ncnt[(i + j) % 2] += cnt[i] * cnt[j];\n cnt = ncnt;\n s /= 2;\n }\n }\n Console.WriteLine(ans[0]);\n }\n\n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 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#endregion\n\n#region Matrix\npublic class Matrix {\n int row, col;\n public N[] mat;\n /// \n /// \u884c \u5217\u76ee\u306e\u8981\u7d20\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\n /// \n /// \u884c\u306e\u756a\u53f7\n /// \u5217\u306e\u756a\u53f7\n public N this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new N[row * col];\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n System.Diagnostics.Debug.Assert(l.col == r.row);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n /// \n /// ^ \u3092 O(^3 log ) \u3067\u8a08\u7b97\u3057\u307e\u3059\u3002\n /// \n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public N[][] Items {\n get {\n var a = new N[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new N[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0c21ded2d4819aba4cc826a856432e22", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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 CODEFORCES1\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 n = NN;\n var m = NN;\n var L = NN;\n var R = NN;\n LIB_Mod._mod = 998244353;\n if (R - L == 0)\n {\n Console.WriteLine(1);\n return;\n }\n var tmp = LIB_Mod.Pow(LIB_Mod.Pow(R - L + 1, n), m);\n Console.WriteLine(((n * m) % 2 == 0) ? tmp / 2 : tmp);\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())); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); 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 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 IEnumerable OrderBy(this IEnumerable x) => x.OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IEnumerable OrderByDescending(this IEnumerable x) => x.OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.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 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 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d83898df5a728b248330de9afe50dab2", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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, M, L, R;\n sc.Make(out N, out M, out L, out R);\n R -= L;\n if (N * M % 2 == 1)\n {\n Fail(ModInt.Pow(R + 1, N * M));\n }\n ModInt odd = (R + 1) / 2, even = R / 2 + 1;\n var A = new[] { new[] { even, odd }, new[] { odd, even } };\n var f = N * M;\n var res = new[] { new[] { (ModInt)1, 0 }, new[] { (ModInt)0, 1 } };\n while (f != 0)\n {\n if (f % 2 == 1) res = matmul(res, A);\n f >>= 1;\n A = matmul(A, A);\n }\n WriteLine(res[0][0]);\n }\n ModInt[][] matmul(ModInt[][] A,ModInt[][] B)\n {\n var rt = Create(A.Length, () => new ModInt[A.Length]);\n for(int i=0;i 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) == 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 [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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec791996955828445d1cb89b04a9d166", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = ModInt;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n var n = rl;\n var m = rl;\n var L = ri;\n var R = ri;\n var cnt = new ModInt[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n if (L != 0)\n cnt[0] -= (L - 1) / 2;\n cnt[1] -= L / 2;\n\n Debug.WriteLine(cnt.AsJoinedString());\n var mat = new Matrix(2, 2);\n mat[0, 0] = mat[1, 1] = cnt[0];\n mat[0, 1] = mat[1, 0] = cnt[1];\n var res = Matrix.Pow(mat, n * m);\n Console.WriteLine(res[1, 1]);\n }\n\n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 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#endregion\n\n#region Matrix\npublic class Matrix {\n int row, col;\n public N[] mat;\n /// \n /// \u884c \u5217\u76ee\u306e\u8981\u7d20\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\n /// \n /// \u884c\u306e\u756a\u53f7\n /// \u5217\u306e\u756a\u53f7\n public N this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new N[row * col];\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n System.Diagnostics.Debug.Assert(l.col == r.row);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n /// \n /// ^ \u3092 O(^3 log ) \u3067\u8a08\u7b97\u3057\u307e\u3059\u3002\n /// \n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public N[][] Items {\n get {\n var a = new N[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new N[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "65d660a9c456f0474566350b023d09a7", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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, M, L, R;\n sc.Make(out N, out M, out L, out R);\n R -= L;\n if (N * M % 2 == 1)\n {\n Fail(ModInt.Pow(R + 1, N * M));\n }\n long odd = (R + 1) / 2, even = R / 2 + 1;\n ModInt a = (ModInt)odd / (R + 1) * (1 - ModInt.Pow(ModInt.Pow((ModInt)odd / (R + 1), 2), N * M / 2 + 1)) / (1 - ModInt.Pow((ModInt)odd / (R + 1), 2));\n WriteLine(ModInt.Pow(R + 1, N * M - 1) * (a*odd+(1-a)*even));\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 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 [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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b5d360ec00a45bdf70ecbf71ca8ceee8", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = System.Int64;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n var n = rl;\n var m = rl;\n var L = rl;\n var R = rl;\n var cnt = new long[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n cnt[0] -= (L - 1) / 2;\n cnt[1] -= L / 2;\n var mat = new Matrix(2, 2);\n mat[0, 0] = mat[1, 1] = cnt[0];\n mat[0, 1] = mat[1, 0] = cnt[1];\n var res = Matrix.Pow(mat, n * m);\n Console.WriteLine(res[1, 1]);\n }\n \n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 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#endregion\n#region Matrix\npublic class Matrix {\n int row, col;\n public N[] mat;\n /// \n /// \u884c \u5217\u76ee\u306e\u8981\u7d20\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\n /// \n /// \u884c\u306e\u756a\u53f7\n /// \u5217\u306e\u756a\u53f7\n public N this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new N[row * col];\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n System.Diagnostics.Debug.Assert(l.col == r.row);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n /// \n /// ^ \u3092 O(^3 log ) \u3067\u8a08\u7b97\u3057\u307e\u3059\u3002\n /// \n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public N[][] Items {\n get {\n var a = new N[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new N[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6f08897d058a7d8131fd17ff01aac0af", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = System.Int64;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n var n = ri;\n var m = ri;\n var L = ri;\n var R = ri;\n var cnt = new int[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n cnt[0] -= (L - 1) / 2;\n cnt[1] -= L / 2;\n\n var B = (n * m + 1) / 2;\n var W = n * m / 2;\n var mat = new Matrix(2, 2);\n mat[0, 0] = mat[1, 1] = cnt[0];\n mat[0, 1] = mat[1, 0] = cnt[1];\n var vec = new Matrix(2, 1);\n vec[1, 0] = 1;\n var u = Matrix.Pow(mat, B) * vec;\n var v = Matrix.Pow(mat, W) * vec;\n var ans = u[0, 0] * v[0, 0] + u[1, 0] * v[1, 0];\n Console.WriteLine(ans);\n \n }\n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 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#endregion\n#region Matrix\npublic class Matrix {\n int row, col;\n public N[] mat;\n /// \n /// \u884c \u5217\u76ee\u306e\u8981\u7d20\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\n /// \n /// \u884c\u306e\u756a\u53f7\n /// \u5217\u306e\u756a\u53f7\n public N this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new N[row * col];\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n System.Diagnostics.Debug.Assert(l.col == r.row);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n /// \n /// ^ \u3092 O(^3 log ) \u3067\u8a08\u7b97\u3057\u307e\u3059\u3002\n /// \n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public N[][] Items {\n get {\n var a = new N[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new N[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4c5c476f974e27f25f861fb543ee0990", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = ModInt;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n checked {\n var n = rl;\n var m = rl;\n var L = rl;\n var R = rl;\n var cnt = new ModInt[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n cnt[0] -= (L - 1) / 2;\n cnt[1] -= L / 2;\n var mat = new Matrix(2, 2);\n mat[0, 0] = cnt[0]; mat[1, 1] = cnt[0];\n mat[0, 1] = cnt[1]; mat[1, 0] = cnt[1];\n\n\n var res = Matrix.Pow(mat, n * m);\n Debug.WriteLine(ModInt.Pow(R - L + 1, n * m));\n Debug.WriteLine(res[0, 1] + res[1, 1]);\n if ((res[0, 1] + res[1, 1] - ModInt.Pow(R - L + 1, n * m)).num != 0)\n throw new Exception();\n Console.WriteLine(res[1, 1]);\n }\n }\n\n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 long ret = 1;\n for (; 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#endregion\n#region Matrix\npublic class Matrix {\n int row, col;\n public Number[] mat;\n public Number this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new Number[row * col];\n }\n public static Matrix operator +(Matrix l, Matrix r) {\n check(l, r);\n var ret = new Matrix(l.row, l.col);\n for (int i = 0; i < l.row; i++)\n for (int j = 0; j < l.col; j++)\n ret.mat[i * ret.col + j] = l.mat[i * l.col + j] + r.mat[i * r.col + j];\n return ret;\n\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n checkMul(l, r);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public static Matrix Trans(Matrix m) {\n var ret = new Matrix(m.col, m.row);\n for (int i = 0; i < m.row; i++)\n for (int j = 0; j < m.col; j++)\n ret.mat[j * m.col + i] = m.mat[i * m.col + j];\n return ret;\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void check(Matrix a, Matrix b) {\n if (a.row != b.row || a.col != b.col)\n throw new Exception(\"row and col have to be same.\");\n\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void checkMul(Matrix a, Matrix b) {\n if (a.col != b.row)\n throw new Exception(\"row and col have to be same.\");\n }\n public Number[][] Items {\n get {\n var a = new Number[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new Number[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n public override string ToString() {\n return string.Format(\"{0}*{1}\", row, col);\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "26e85e6485d0d38023ae923d5ed64285", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = ModInt;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n var n = rl;\n var m = rl;\n var L = ri;\n var R = ri;\n var cnt = new ModInt[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n cnt[0] -= (L - 1) / 2;\n cnt[1] -= L / 2;\n var ans = new ModInt[2];\n ans[0] = 1;\n var s = n * m;\n while (s > 0) {\n if (s % 2 == 1) {\n var nans = new ModInt[2];\n for (int i = 0; i < 2; i++)\n for (int j = 0; j < 2; j++)\n nans[(i + j) % 2] += ans[i] * cnt[j];\n ans = nans;\n s--;\n }\n else {\n var ncnt = new ModInt[2];\n for (int i = 0; i < 2; i++)\n for (int j = 0; j < 2; j++)\n ncnt[(i + j) % 2] += cnt[i] * cnt[j];\n cnt = ncnt;\n s /= 2;\n }\n }\n Console.WriteLine(ans[0]);\n }\n\n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 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#endregion\n\n#region Matrix\npublic class Matrix {\n int row, col;\n public N[] mat;\n /// \n /// \u884c \u5217\u76ee\u306e\u8981\u7d20\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\n /// \n /// \u884c\u306e\u756a\u53f7\n /// \u5217\u306e\u756a\u53f7\n public N this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new N[row * col];\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n System.Diagnostics.Debug.Assert(l.col == r.row);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n /// \n /// ^ \u3092 O(^3 log ) \u3067\u8a08\u7b97\u3057\u307e\u3059\u3002\n /// \n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public N[][] Items {\n get {\n var a = new N[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new N[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9f385e667a97bb398d1b28bdf66a1133", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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 CODEFORCES1\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 n = NN;\n var m = NN;\n var L = NN;\n var R = NN;\n LIB_Mod._mod = 998244353;\n if (R - L == 0)\n {\n Console.WriteLine(1);\n return;\n }\n var tmp = LIB_Mod.Pow(R - L + 1, n*m);\n Console.WriteLine(((n * m) % 2 == 0) ? tmp / 2 : tmp);\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())); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); 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 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 IEnumerable OrderBy(this IEnumerable x) => x.OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IEnumerable OrderByDescending(this IEnumerable x) => x.OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.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 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 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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f729ccb30a2c8ab49127dfa1de6a532c", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = ModInt;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n checked {\n var n = rl;\n var m = rl;\n var L = rl;\n var R = rl;\n if (n * m == 1) {\n Console.WriteLine(R - L + 1);\n return;\n }\n var cnt = new ModInt[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n cnt[0] -= (L - 1) / 2;\n cnt[1] -= L / 2;\n var mat = new Matrix(2, 2);\n mat[0, 0] = cnt[0]; mat[1, 1] = cnt[0];\n mat[0, 1] = cnt[1]; mat[1, 0] = cnt[1];\n\n\n var res = Matrix.Pow(mat, n * m);\n Debug.WriteLine(ModInt.Pow(R - L + 1, n * m));\n Debug.WriteLine(res[0, 1] + res[1, 1]);\n if ((res[0, 1] + res[1, 1] - ModInt.Pow(R - L + 1, n * m)).num != 0)\n throw new Exception();\n Console.WriteLine(res[1, 1]);\n }\n }\n\n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 long ret = 1;\n for (; 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#endregion\n#region Matrix\npublic class Matrix {\n int row, col;\n public Number[] mat;\n public Number this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new Number[row * col];\n }\n public static Matrix operator +(Matrix l, Matrix r) {\n check(l, r);\n var ret = new Matrix(l.row, l.col);\n for (int i = 0; i < l.row; i++)\n for (int j = 0; j < l.col; j++)\n ret.mat[i * ret.col + j] = l.mat[i * l.col + j] + r.mat[i * r.col + j];\n return ret;\n\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n checkMul(l, r);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public static Matrix Trans(Matrix m) {\n var ret = new Matrix(m.col, m.row);\n for (int i = 0; i < m.row; i++)\n for (int j = 0; j < m.col; j++)\n ret.mat[j * m.col + i] = m.mat[i * m.col + j];\n return ret;\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void check(Matrix a, Matrix b) {\n if (a.row != b.row || a.col != b.col)\n throw new Exception(\"row and col have to be same.\");\n\n }\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void checkMul(Matrix a, Matrix b) {\n if (a.col != b.row)\n throw new Exception(\"row and col have to be same.\");\n }\n public Number[][] Items {\n get {\n var a = new Number[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new Number[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n public override string ToString() {\n return string.Format(\"{0}*{1}\", row, col);\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e917c23fa37ae9a33720a8d00ae2df6", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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, M, L, R;\n sc.Make(out N, out M, out L, out R);\n R -= L;\n if (N * M % 2 == 1)\n {\n Fail(ModInt.Pow(R + 1, N * M));\n }\n long odd = (R + 1) / 2, even = R / 2 + 1;\n ModInt a = (ModInt)odd / ((R+1) * 4);\n WriteLine(ModInt.Pow(R + 1, N * M - 1) * (a*odd+(1-a)*even));\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 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 [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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4e2c247449d438d5409d4fd7021069a2", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "//author: camypaper\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing Point = System.Numerics.Complex;\nusing static System.Math;\nusing Number = System.Int64;\nusing System.Runtime.CompilerServices;\nusing N = ModInt;\nnamespace Program {\n public class Solver {\n Random rnd = new Random(0);\n public void Solve() {\n var n = rl;\n var m = rl;\n var L = rl;\n var R = rl;\n var cnt = new long[2];\n cnt[0] += R / 2;\n cnt[1] += (R + 1) / 2;\n cnt[0] -= (L - 1) / 2;\n cnt[1] -= L / 2;\n var mat = new Matrix(2, 2);\n mat[0, 0] = mat[1, 1] = cnt[0];\n mat[0, 1] = mat[1, 0] = cnt[1];\n var res = Matrix.Pow(mat, n * m);\n Console.WriteLine(res[0, 1]);\n }\n \n const long INF = 1L << 60;\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static IEnumerable Rep(int n) => Enumerable.Range(0, n);\n static IEnumerable RRep(int n) => Enumerable.Range(0, n).Reverse();\n static T[] Enumerate(int n, Func f) {\n var a = new T[n];\n for (int i = 0; i < a.Length; ++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 static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie);\n }\n static public void Main() {\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 using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\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\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan() {\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 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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = 998244353;\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 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#endregion\n#region Matrix\npublic class Matrix {\n int row, col;\n public N[] mat;\n /// \n /// \u884c \u5217\u76ee\u306e\u8981\u7d20\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\n /// \n /// \u884c\u306e\u756a\u53f7\n /// \u5217\u306e\u756a\u53f7\n public N this[int r, int c] {\n get { return mat[r * col + c]; }\n set { mat[r * col + c] = value; }\n }\n public Matrix(int r, int c) {\n row = r; col = c;\n mat = new N[row * col];\n }\n public static Matrix operator *(Matrix l, Matrix r) {\n System.Diagnostics.Debug.Assert(l.col == r.row);\n var ret = new Matrix(l.row, r.col);\n for (int i = 0; i < l.row; i++)\n for (int k = 0; k < l.col; k++)\n for (int j = 0; j < r.col; j++)\n ret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]);\n return ret;\n }\n /// \n /// ^ \u3092 O(^3 log ) \u3067\u8a08\u7b97\u3057\u307e\u3059\u3002\n /// \n public static Matrix Pow(Matrix m, long n) {\n var ret = new Matrix(m.row, m.col);\n for (int i = 0; i < m.row; i++)\n ret.mat[i * m.col + i] = 1;\n for (; n > 0; m *= m, n >>= 1)\n if ((n & 1) == 1)\n ret = ret * m;\n return ret;\n\n }\n public N[][] Items {\n get {\n var a = new N[row][];\n for (int i = 0; i < row; i++) {\n a[i] = new N[col];\n for (int j = 0; j < col; j++)\n a[i][j] = mat[i * col + j];\n }\n return a;\n }\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e3361a21cc5befbc804d97cbae75ce55", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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, M, L, R;\n sc.Make(out N, out M, out L, out R);\n R -= L;\n if (N * M % 2 == 1)\n {\n Fail(ModInt.Pow(R + 1, N * M));\n }\n ModInt odd = (R + 1) / 2, even = R / 2 + 1;\n var A = new[] { new[] { even, odd }, new[] { odd, even } };\n var k = N * M;\n WriteLine(matpow(A, k)[0][0]);\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[A.Length]);\n for (int i = 0; i < A.Length; i++)\n for (int j = 0; j < A.Length; j++)\n {\n for (int k = 0; k < A.Length; k++)\n rt[i][j] += A[i][k] * B[k][j];\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;//\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 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 [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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "47208306228f33427444a80d4a182c46", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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;\nusing static System.Numerics.BigInteger;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random(0);\n\t\tpublic void Solve() {\n\t\t\tvar n = rl;\n\t\t\tvar m = rl;\n\t\t\tvar L = rl;\n\t\t\tvar R = rl;\n\t\t\tvar cnt = new ModInt[2];\n\t\t\tcnt[0] += R / 2;\n\t\t\tcnt[1] += (R + 1) / 2;\n\t\t\tcnt[0] -= (L - 1) / 2;\n\t\t\tcnt[1] -= L / 2;\n\t\t\tvar dp = new ModInt[2];\n\t\t\tdp[0] = 1;\n\t\t\tvar N = n * m;\n\t\t\twhile (N > 0) {\n\t\t\t\tvar next = new ModInt[2];\n\t\t\t\tif (N % 2 == 1) {\n\t\t\t\t\tfor (int i = 0; i < 2; i++)\n\t\t\t\t\t\tfor (int j = 0; j < 2; j++) next[i ^ j] += dp[i] * cnt[j];\n\t\t\t\t\tdp = next;\n\t\t\t\t\tN--;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tfor (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) next[i ^ j] += cnt[i] * cnt[j];\n\t\t\t\t\tcnt = next;\n\t\t\t\t\tN /= 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (n * m % 2 == 1) Console.WriteLine(dp[0] + dp[1]);\n\t\t\telse Console.WriteLine(dp[0]);\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\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\t//t.Start();\n\t\t//t.Join();\n\t\t//*/\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#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 = 998244353;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9805578514f41c0d39b6039f1027b789", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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, M, L, R;\n sc.Make(out N, out M, out L, out R);\n R -= L;\n if (N * M % 2 == 1)\n {\n Fail(ModInt.Pow(R + 1, N * M));\n }\n ModInt odd = (R + 1) / 2, even = R / 2 + 1;\n var A = new[] { new[] { even, odd }, new[] { odd, even } };\n var f = N * M;\n var res = new[] { new[] { (ModInt)1, 0 }, new[] { (ModInt)0, 1 } };\n while (f != 0)\n {\n if (f % 2 == 1) res = matmul(res, A);\n f >>= 1;\n A = matmul(A, A);\n }\n WriteLine(res[0][0]);\n }\n ModInt[][] matmul(ModInt[][] A,ModInt[][] B)\n {\n var rt = Create(A.Length, () => new ModInt[A.Length]);\n for(int i=0;i 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) == 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 [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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f6dfa6482725296f533c3b6d8faa2b4f", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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 CODEFORCES1\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 n = NN;\n var m = NN;\n var L = NN;\n var R = NN;\n LIB_Mod._mod = 998244353;\n if (R - L == 0)\n {\n Console.WriteLine(1);\n return;\n }\n var tmp = LIB_Mod.Pow(LIB_Mod.Pow(R - L + 1, n), m);\n Console.WriteLine(((n * m) % 2 == 0) ? (tmp + ((R - L + 1) % 2)) / 2 : tmp);\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())); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); 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 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 IEnumerable OrderBy(this IEnumerable x) => x.OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IEnumerable OrderByDescending(this IEnumerable x) => x.OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.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 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 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad548a646896661c936a0b6b79b8ac34", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "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, M, L, R;\n sc.Make(out N, out M, out L, out R);\n R -= L;\n if (N * M % 2 == 1)\n {\n Fail(ModInt.Pow(R + 1, N * M));\n }\n long odd = (R + 1) / 2, even = R / 2 + 1;\n var res = ModInt.Pow(even - odd, N * M);\n res += ModInt.Pow(R + 1, N * M);\n res /= 2;\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;//\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 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 [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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8fa92d418b5d801ac5662e0de62c8fa5", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "MS C#", "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 if (n % 400 == 0 || (n % 4 == 0 && n % 100 != 0))\n Console.WriteLine(n + 28);\n else if ((n + 4) % 100 == 0 && (n + 4) % 400 != 0)\n Console.WriteLine(n + 7);\n else if ((n + 3) % 100 == 0 && (n + 3) % 400 != 0)\n Console.WriteLine(n + 12);\n else\n Console.WriteLine(n + 6);\n \n //Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e52b6074aad5234be572552edbcf0547", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n public static bool L(int y)\n {\n if(y%400==0||(y%100!=0 && y%4==0))\n {\n return true;\n }\n return false;\n }\n static void Main(string[] args)\n {\n int y, day = 0,q=0;\n y=Int32.Parse(Console.ReadLine());\n q = y+1;\n while (true)\n {\n if (L(q) == true)\n {\n day += 366;\n }\n else\n day += 366;\n day %= 7;\n if(L(q)==L(y))\n {\n if(day==0)\n {\n Console.WriteLine(q);\n break;\n }\n }\n q++;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "37cfffddd68b746ef4d4cf44cff2431a", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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 if (n % 400 == 0 || (n % 4 == 0 && n % 100 != 0))\n Console.WriteLine(n + 28);\n else\n Console.WriteLine(n + 6);\n \n //Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e93a018c0a195603238f2da7ae6e854e", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace CodeForces\n{\n class Program\n {\n\n static bool IsVis(int n)\n {\n if (n % 400 == 0 || (n % 4 == 0 && n % 100 != 0))\n return true;\n return false;\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 if (IsVis(n)) //\u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0433\u043e\u0434 - \u0432\u0438\u0441\u043e\u043a\u043e\u0441\u043d\u044b\u0439\n {\n if (IsVis(n + 4))\n Console.WriteLine(n + 28);\n else\n Console.WriteLine(n + 12);\n }\n else if ((n + 3) % 100 == 0)\n {\n if (IsVis(n + 3))\n Console.WriteLine(n + 6);\n else\n Console.WriteLine(n + 12);\n }\n else if ((n + 2) % 100 == 0)\n {\n if (IsVis(n + 2))\n Console.WriteLine(n + 11);\n else\n Console.WriteLine(n + 12);\n }\n else if ((n + 1) % 100 == 0)\n {\n if (IsVis(n + 1))\n Console.WriteLine(n + 11);\n else\n Console.WriteLine(n + 12);\n }\n else\n Console.WriteLine(n + 6);\n\n \n //Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d18c1297285c26fe1ff9f0c8c8db132e", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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\tif (IsVis(n))\n\t\t\t\tsw.WriteLine(n + 28);\n\t\t\telse {\n\t\t\t\tvar less = -1;\n\t\t\t\tfor (var i = n - 1; i >= n - 10; i--) {\n\t\t\t\t\tif (IsVis(i)) {\n\t\t\t\t\t\tless = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar greater = -1;\n\t\t\t\tfor (var i = n + 1; i <= n + 10; i++) {\n\t\t\t\t\tif (IsVis(i)) {\n\t\t\t\t\t\tgreater = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ((n - less) < (greater - n))\n\t\t\t\t\tsw.WriteLine(n + 11);\n\t\t\t\telse\n\t\t\t\t\tsw.WriteLine(n + 6);\n\t\t\t}\n\t\t}\n\n\t\tprivate bool IsVis(int n)\n\t\t{\n\t\t\treturn (n % 400 == 0) || (n % 4 == 0 && n % 100 != 0);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3318a2603ee3678995ba4a9ccd9f8e07", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\nnamespace tes\n{\n\tclass contest\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t\n int num = int.Parse(Console.ReadLine());\n \n var ord = new int[] { 6, 11, 6, 5 };\n\n if(num % 400 == 0)\n {\n num += 28;\n }\n else if(num %4 == 0)\n {\n if(num %100 == 0)\n {\n int ind = 0;\n while (true)\n {\n num += ord[ind % 4];\n ind++;\n if (num % 4 != 0) break;\n }\n }\n else num += 28;\n }\n else\n {\n int ind = 0;\n while(true)\n {\n num += ord[ind % 4];\n ind++;\n if (num % 4 != 0) break;\n }\n }\n\n\n\n Console.WriteLine(num);\n \n\t\t}\t\n\t\t\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "af5a725b1d0be2c446d5962d7ae41732", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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\tif (IsVis(n))\n\t\t\t\tsw.WriteLine(n + 28);\n\t\t\telse {\n\t\t\t\tvar less = -1;\n\t\t\t\tfor (var i = n - 1; i >= n - 4; i--) {\n\t\t\t\t\tif (IsVis(i)) {\n\t\t\t\t\t\tless = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar greater = -1;\n\t\t\t\tfor (var i = n + 1; i <= n + 4; i++) {\n\t\t\t\t\tif (IsVis(i))\n\t\t\t\t\t\tgreater = i;\n\t\t\t\t}\n\t\t\t\tif ((n - less) < (greater - n))\n\t\t\t\t\tsw.WriteLine(n + 11);\n\t\t\t\telse\n\t\t\t\t\tsw.WriteLine(n + 6);\n\t\t\t}\n\t\t}\n\n\t\tprivate bool IsVis(int n)\n\t\t{\n\t\t\treturn (n % 400 == 0) || (n % 4 == 0 && n % 100 != 0);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "86d4b53b711eb88fe8cef06945c82248", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing 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\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 curr = n + 1;\n\t\t\tvar indx = 1;\n\t\t\tvar isVis = IsVis(n);\n\t\t\tvar visCount = 0;\n\t\t\twhile (true) {\n\t\t\t\tindx++;\n\t\t\t\tif (IsVis(indx)) {\n\t\t\t\t\tvisCount -= 2;\n\t\t\t\t\tif (visCount < 0) {\n\t\t\t\t\t\tvisCount = 7 + visCount;\n\t\t\t\t\t}\n\t\t\t\t\tcurr = visCount;\n\t\t\t\t\tif (isVis && curr == 0) {\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\tcurr += 1;\n\t\t\t\tcurr = curr % 7;\n\t\t\t\tif (curr == 0 && !isVis)\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tsw.WriteLine(n + indx);\n\t\t}\n\n\t\tprivate bool IsVis(int n)\n\t\t{\n\t\t\treturn (n % 400 == 0) || (n % 4 == 0 && n % 100 != 0);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e134c08c8cdb9b00f1bc4c0dc07f6d52", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\nnamespace tes\n{\n\tclass contest\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t\n int num = int.Parse(Console.ReadLine());\n \n var ord = new int[] { 6, 11, 6, 5 };\n\n if(num % 400 == 0)\n {\n num += 28;\n }\n else if(num %4 == 0)\n {\n if(num %100 == 0)\n {\n num += 400;\n }\n num += 28;\n }\n else\n {\n int ind = 0;\n while(true)\n {\n num += ord[ind % 4];\n\n if (num % 4 != 0) break;\n }\n }\n\n\n\n Console.WriteLine(num);\n \n\t\t}\t\n\t\t\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6c69a917a319297c36ccd897438862b2", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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 x = ReadInt();\n int d = 0;\n while (x > 2000)\n {\n x -= 400;\n d++;\n }\n\n var d1 = new DateTime(x, 1, 1);\n for (int i = x + 1; ; i++)\n {\n var d2 = new DateTime(i, 1, 1);\n if (d1.DayOfWeek == d2.DayOfWeek && d1.AddDays(400).Day == d2.AddDays(400).Day)\n {\n Write(i + 400 * d);\n return;\n }\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bcaabfab50bbf17b724ab83ff62be7c5", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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 _13b\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 bool isVi(int y)\n {\n var r1 = y % 400;\n var r2 = y % 4;\n var r3 = y % 100;\n\n return r1 == 0 || (r2 == 0 && r3 != 0);\n }\n static void solution()\n {\n #region SOLUTION\n var y = readInt();\n\n var svi = isVi(y);\n \n var need = 0;\n while (true)\n {\n if (isVi(y))\n {\n need += 2;\n }\n else\n {\n need++;\n }\n\n y++;\n\n var ci = isVi(y);\n if (need % 7 == 0 && (ci && svi || !ci && !svi))\n {\n break;\n }\n }\n\n Console.WriteLine(y);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5e0778b06c4fd8ca89972e6ed03fc843", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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 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 '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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "50cab8eab8cea3b4c0cd5ccbf018604e", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "Mono C#", "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 Y = sc.Int;\n var day = 0;\n for(int i=Y; ; i++)\n {\n if (i % 400 == 0 || (i % 100 != 0 && i % 4 == 0))\n day += 366;\n else day += 365;\n if (day % 7 == 0&&!(isuruu(i+1)^isuruu(Y))) Fail(i+1);\n }\n }\n bool isuruu(int i)\n => i % 400 == 0 || (i % 100 != 0 && i % 4 == 0);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "afd5620152552591f9acba7d10568118", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\nnamespace tes\n{\n\tclass contest\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t\n int num = int.Parse(Console.ReadLine());\n\n bool uruu = false;\n if (num % 400 == 0 || (num % 4 == 0 && num % 100 != 0))\n {\n uruu = true;\n }\n int start = 0;\n\n for(int i=0; i<400; i++)\n {\n num++;\n\n if (num % 400 == 0 || (num % 4 == 0 && num % 100 != 0))\n {\n start += 2;\n }\n else start++;\n\n if(start % 7 == 0)\n {\n if (uruu)\n {\n if (num % 400 == 0 || (num % 4 == 0 && num % 100 != 0)) break;\n }\n else\n {\n\n if ((num % 400 != 0 && (num % 4 != 0 ))||( num % 100 == 0)) break;\n }\n }\n \n\n }\n Console.WriteLine(num);\n \n\t\t}\t\n\t\t\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b5c2bb593e68143f1246a8a199e7a3f0", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing 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\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\tint curr;\n\t\t\tvar indx = n;\n\t\t\tvar isVis = IsVis(n);\n\t\t\tvar start = n % 7;\n\t\t\tcurr = start;\n\t\t\twhile (true) {\n\t\t\t\tindx++;\n\t\t\t\tif (IsVis(indx)) {\n\t\t\t\t\tcurr += 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tcurr += 1;\n\t\t\t\tcurr = curr % 7;\n\t\t\t\tif (curr == start)\n\t\t\t\t{\n\t\t\t\t\tif (isVis) {\n\t\t\t\t\t\tif (IsVis(indx)) {\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\telse {\n\t\t\t\t\t\tif (!IsVis(indx)) {\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}\n\n\t\t\tsw.WriteLine(indx);\n\t\t}\n\n\t\tprivate bool IsVis(int n)\n\t\t{\n\t\t\treturn (n % 400 == 0) || (n % 4 == 0 && n % 100 != 0);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ac0eb051bad514b005c8bed2f5812842", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace Temp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var y = int.Parse(Console.ReadLine());\n\n var diff = 0;\n var i = y;\n do\n {\n diff = (diff + NumDaysOfYear(i)) % 7;\n i++;\n } while (diff != 0 || NumDaysOfYear(y) != NumDaysOfYear(i));\n\n Console.WriteLine(i);\n }\n\n static int NumDaysOfYear(int y)\n {\n return (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) ? 366 : 365;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c36d5ab343ddea28b6f86531f8ff2f79", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace CodeForces\n{\n class Program\n {\n\n static bool IsVis(int n)\n {\n if (n % 400 == 0 || (n % 4 == 0 && n % 100 != 0))\n return true;\n return false;\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 years = 0;\n for (int i = n + 1; i < 2*n; i++)\n {\n if (IsVis(i))\n years += 2;\n else\n years++;\n if (years % 7 == 0)\n {\n if (IsVis(n) == IsVis(i))\n {\n Console.WriteLine(i);\n return;\n }\n }\n\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fdc84d10e151ddd237e928eef3ee45b9", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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 = ReadInt();\n var current = (IsLeap(n) ? 366 : 365) % 7;\n var year = n + 1;\n var leap = IsLeap(n);\n while (current != 0 || IsLeap(year) != leap)\n {\n current = (current + (IsLeap(year) ? 366 : 365)) % 7;\n year++;\n }\n return year;\n }\n }\n\n bool IsLeap(int year)\n {\n if (year % 400 == 0)\n return true;\n if (year % 100 == 0)\n return false;\n if (year % 4 == 0)\n return true;\n return false;\n }\n\n int NextLeap(int year)\n {\n do\n {\n year += 4;\n } while (!IsLeap(year));\n return year;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f00c54b6036033e0de7d048f20880696", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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 int _y;\n\t\tprivate long _result;\n\n\t\tpublic void Process()\n\t\t{\n\t\t\tint day = 0;\n\t\t\tconst int remCommon = 365 % 7;\n\t\t\tconst int remHigh = 366 % 7;\n\t\t\tbool is_high = isHigh(_y);\n\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\t_y++;\n\t\t\t\tif (isHigh(_y))\n\t\t\t\t{\n\t\t\t\t\tday = (day + remHigh) % 7;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tday = (day + remCommon) % 7;\n\t\t\t\t}\n\t\t\t\tif (day == 0 && is_high == isHigh(_y))\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t_result = _y;\n\t\t}\n\n\t\tprivate bool isHigh(int year)\n\t\t{\n\t\t\tif (year%400 == 0 || (year%4 == 0 && year%100 != 0))\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\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\t//string[] strings1 = readLine.Split(' ');\n\n\t\t\t\t_y = int.Parse(readLine);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ab163010dbf0221c1c150068f0697138", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace _678B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int year = int.Parse(Console.ReadLine()), nextYear = year + 1;\n bool firstLeap = (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);\n int dayOfWeek = 0;\n for (;; nextYear++)\n {\n bool leap = (nextYear % 400 == 0) || (nextYear % 4 == 0 && nextYear % 100 != 0);\n dayOfWeek += leap ? 2 : 1;\n dayOfWeek %= 7;\n if (leap == firstLeap && dayOfWeek == 0)\n break;\n }\n Console.WriteLine(nextYear);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "865a0e9568a825679f2d53a32d6a9588", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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 private static int Offset(int y)\n {\n if (y % 4 == 0)\n {\n if (y % 100 == 0 && y % 400 != 0)\n {\n return 365;\n }\n\n return 366;\n }\n\n return 365;\n }\n\n static void Main(string[] args)\n {\n int n = ReadInt();\n int offset = 0;\n int bOffset = Offset(n);\n while (true)\n {\n n++;\n offset += Offset(n);\n offset %= 7;\n\n if (offset == 0 && bOffset == Offset(n))\n {\n Console.WriteLine(n);\n return;\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d5cad0d82c4ae4234c7ff4b570ebad65", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n public static bool L(int y)\n {\n if(y%400==0||(y%100!=0 && y%4==0))\n {\n return true;\n }\n return false;\n }\n static void Main(string[] args)\n {\n int y, day = 0,q=0;\n y=Int32.Parse(Console.ReadLine());\n q = y;\n while (q++>0)\n {\n if (L(q) == true)\n {\n day += 366;\n }\n else\n day +=+365;\n day %= 7;\n if(L(q)==L(y))\n {\n if(day==0)\n {\n Console.WriteLine(q);\n break;\n }\n }\n \n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ef1d37f11eebfc01a0ffc14c06d38d67", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace The_Same_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 n = Next();\n\n int m = n/2000;\n n = n%2000;\n\n var dn1 = new DateTime(n, 1, 1);\n var dn2 = new DateTime(n, 12, 31);\n\n for (n++;; n++)\n {\n var d1 = new DateTime(n, 1, 1);\n if (d1.DayOfWeek == dn1.DayOfWeek)\n {\n var d2 = new DateTime(n, 12, 31);\n if (d2.DayOfWeek == dn2.DayOfWeek)\n break;\n }\n }\n\n writer.WriteLine(m*2000 + 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ee8f3ea79381dce9866926759dd5ac1b", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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 bool isLeapYear(int x)\n {\n if (x%100 == 0)\n {\n return x%400 == 0;\n }\n else\n {\n return x%4 == 0;\n }\n }\n static void Main(string[] args)\n {\n int a = Cin.NextInt();\n for (int i = a + 1; /* pass */; i++)\n {\n var d1 = DateTime.Parse(string.Format(\"{0}-01-01\", a));\n var d2 = DateTime.Parse(string.Format(\"{0}-01-01\", i));\n \n var diff = d2 - d1;\n bool ly = !(isLeapYear(a) ^ isLeapYear(i));\n bool wd = diff.Days%7 == 0;\n\n if (ly && wd)\n {\n Console.WriteLine(i);\n break;\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a4e3e2cd323c9c6096be77c1d724ece1", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "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 bool isLeapYear(int x)\n {\n if (x%100 == 0)\n {\n return x%400 == 0;\n }\n else\n {\n return x%4 == 0;\n }\n return x%4 == 0 && x%400 != 0;\n }\n static void Main(string[] args)\n {\n int a = Cin.NextInt();\n for (int i = a + 1; /* pass */; i++)\n {\n var d1 = DateTime.Parse($\"{a}-01-01\");\n var d2 = DateTime.Parse($\"{i}-01-01\");\n\n var diff = d2 - d1;\n bool ly = !(isLeapYear(a) ^ isLeapYear(i));\n bool wd = diff.Days%7 == 0;\n\n if (ly && wd)\n {\n Console.WriteLine(i);\n break;\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9b92f4f140f70a50b7c6de4ebc87fd86", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n public static void Solve()\n {\n int max = (int)1e7;\n\n var p = new bool[max];\n var r = new bool[max];\n\n \n for (int i = 1; i < max; i++)\n {\n p[i] = true;\n }\n p[1] = false;\n p[2] = true;\n for (int i = 1; i < max; i++)\n {\n if (p[i])\n {\n for (int j = i + i; j < max; j += i)\n {\n p[j] = false;\n }\n }\n }\n\n for (int i = 1; i < 10000; i++)\n {\n int d = i;\n int pal1 = i;\n int pal2 = i * 10 + d % 10;\n d /= 10;\n while (d > 0)\n {\n pal1 = pal1 * 10 + d % 10;\n pal2 = pal2 * 10 + d % 10;\n d /= 10;\n }\n r[pal1] = true;\n if (pal2 < max)\n {\n r[pal2] = true;\n }\n }\n\n long pk = ReadLong();\n long qk = ReadLong();\n\n long pc = 0;\n long rc = 0;\n int ans = 0;\n for (int i = 1; i < max; i++)\n {\n if (p[i])\n {\n pc++;\n }\n if (r[i])\n {\n rc++;\n }\n\n if (pc * qk <= rc * pk)\n {\n ans = i;\n }\n }\n Writer.Write(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 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c626614389ad9698dfba7c9bb5e5a54c", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace RM_315_C\n{\n class RM_C\n {\n static int[] Prime_count, Pal_count;\n static void Main(string[] args)\n {\n //StreamReader f = new StreamReader(\"input_C.txt\");\n TextReader f = Console.In;\n string[] s = f.ReadLine().Split(' ');\n int p = int.Parse(s[0]), q = int.Parse(s[1]);\n int n = 1179858;\n Prime_count = new int[n + 1];\n Pal_count = new int[n + 1];\n int prime_c = GetCountofPrimes(n), pal_c = GetCountofPalindroms(n);\n\n for (int i = n; i > 0; i--)\n {\n if (Prime_count[i] <= (double)p / q * Pal_count[i])\n {\n Console.WriteLine(i);\n break;\n }\n }\n Console.ReadLine();\n }\n\n static int GetCountofPrimes(int n)\n {\n bool[] A = new bool[n + 1];\n for (int i = 0; i <= n; i++) A[i] = true;\n for (int i = 2; i * i <= n; i++)\n {\n if (A[i])\n {\n for (int j = i * i; j <= n; j += i)\n {\n A[j] = false;\n }\n }\n }\n int count = 0;\n for (int i = 2; i <= n; i++)\n {\n if (A[i]) count++;\n Prime_count[i] = count;\n }\n return count;\n }\n\n static int GetCountofPalindroms(int n)\n {\n int count = 0;\n for (int i = 1; i <= n; i++)\n {\n string s = i.ToString();\n bool b = true;\n for (int j = 0; j < s.Length / 2; j++)\n {\n if (s[j] != s[s.Length - j - 1])\n {\n b = false;\n break;\n }\n }\n if (b) count++;\n Pal_count[i] = count;\n }\n return count;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5b41248b7e80d1b87907e568245d4a28", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Cpri\n{\n class Program\n {\n\n\n public static long lmt = 3000000;\n\n public static long check(long num)\n {\n long reverse = 0;\n long temp = num;\n while (num > 0)\n {\n long remainder = num % 10;\n reverse = reverse * 10 + remainder;\n num /= 10;\n }\n if (reverse == temp) return 1;\n else return 0;\n \n }\n static void Main(string[] args)\n {\n long[] pri = new long[lmt];\n for (long i = 2; i < lmt; i++) \n {\n pri[i] = 1;\n }\n for (long i = 2; i < lmt; i++)\n {\n if (pri[i] == 1)\n {\n for (long j = 2 * i; j < lmt; j += i)\n {\n pri[j] = 0;\n }\n }\n\n }\n for (long i = 1; i < lmt; i++) \n {\n pri[i] += pri[i - 1];\n }\n long[] pln = new long[lmt];\n for (long i = 1; i < lmt; i++)\n {\n pln[i] = check(i);\n }\n for (long i = 1; i < lmt; i++)\n {\n pln[i] += pln[i - 1];\n }\n\n\n long[] array = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);\n long p = array[0];\n long q = array[1];\n long n = lmt - 1;\n for (n = lmt - 1; n > 0; n--)\n {\n if (pri[n] * q <= pln[n] * p) break;\n }\n Console.WriteLine(n);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad2ad9c627e0a3bf432f9092f3698249", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C.Primes_or_Palindromes\n{\n\tclass TextReaderHelper\n\t{\n\t\tprotected TextReader baseReader;\n\t\tprotected LinkedList buffer;\n\n\t\tpublic TextReaderHelper(TextReader baseReader)\n\t\t{\n\t\t\tthis.baseReader = baseReader;\n\t\t\tbuffer = new LinkedList();\n\t\t}\n\n\t\tprotected void readIfEmpty()\n\t\t{\n\t\t\tif (buffer.Count > 0) return;\n\t\t\tstring line;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tline = baseReader.ReadLine();\n\t\t\t\tif (line == null) return;\n\t\t\t}\n\t\t\twhile (line.Trim() == string.Empty);\n\t\t\tforeach (var item in line.Split(' ', '\\n', '\\t'))\n\t\t\t\tif (item != string.Empty)\n\t\t\t\t\tbuffer.AddLast(item);\n\t\t}\n\n\t\tprivate object readChar()\n\t\t{\n\t\t\tvar node = buffer.First;\n\t\t\tvar ret = node.Value[0];\n\t\t\tif (node.Value.Length > 1) node.Value = node.Value.Substring(1);\n\t\t\telse buffer.RemoveFirst();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic T NextElement()\n\t\t{\n\t\t\treadIfEmpty();\n\t\t\tif (typeof(T) == typeof(char)) return (T)readChar();\n\t\t\tvar ret = (T)Convert.ChangeType(buffer.First.Value, typeof(T));\n\t\t\tbuffer.RemoveFirst();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic int NextInt() { return NextElement(); }\n\n\t\tpublic string NextString() { return NextElement(); }\n\t}\n\n\tclass Program\n\t{\n\t\t[Conditional(\"DEBUG\")]\n\t\tprivate static void Pause()\n\t\t{\n\t\t\tConsole.ReadKey();\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar reader = new TextReaderHelper(new StreamReader(Console.OpenStandardInput(), Encoding.ASCII, false, 1048576));\n\t\t\tvar writer = new StreamWriter(Console.OpenStandardOutput(), Encoding.ASCII, 1048576);\n\t\t\tint p = reader.NextInt(), q = reader.NextInt();\n\t\t\tconst int N = 1179858;\n\t\t\tvar vis = new bool[N + 1];\n\t\t\tvis[1] = true;\n\t\t\tfor (int i = 2; i * i <= N; i++)\n\t\t\t\tif (!vis[i])\n\t\t\t\t\tfor (int j = i + i; j <= N; j += i)\n\t\t\t\t\t\tvis[j] = true;\n\t\t\tint ans = 0, prime = 0, rub = 0;\n\t\t\tfor (int i = 1; i <= N; i++)\n\t\t\t{\n\t\t\t\tif (!vis[i]) prime++;\n\t\t\t\tif (new string(i.ToString().Reverse().ToArray()) == i.ToString()) rub++;\n\t\t\t\tif (prime * q <= rub * p) ans = Math.Max(ans, i);\n\t\t\t}\n\t\t\twriter.WriteLine(ans);\n\n\t\t\twriter.Flush();\n\t\t\tPause();\n }\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "677dc5cc861fb1c3f670b74c84182763", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "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 p = sc.Integer();\n var q = sc.Integer();\n var primes = MathEx.Sieve(2000050);\n var palindromes = new bool[2000050];\n for (int i = 1; i < 2000050; i++)\n {\n if (StringEx.IsPalindrome(i.ToString())) palindromes[i] = true;\n }\n var a = new int[2000050];\n var b = new int[2000050];\n for (int i = 1; i < 2000050; i++)\n {\n a[i] = a[i - 1] + (primes[i] ? 1 : 0);\n b[i] = b[i - 1] + (palindromes[i] ? 1 : 0);\n }\n for (int i = 2000050 - 1; i >= 0; i--)\n {\n if(q*a[i]<=p*b[i])\n {\n IO.Printer.Out.WriteLine(i);\n return;\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 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#region Palindrome\nstatic public partial class StringEx\n{\n /// \u56de\u6587\u304b\u3069\u3046\u304b\u8abf\u3079\u308b\uff0eO(|S|)\n static public bool IsPalindrome(string s)\n {\n if (string.IsNullOrEmpty(s))\n throw new Exception(\"null or empty\");\n var t = s.ToCharArray();\n Array.Reverse(t);\n return s == new string(t);\n }\n\n}\n#endregion\n\n#region sieve\nstatic public partial class MathEx\n{\n static public bool[] Sieve(int p)\n {\n var isPrime = new bool[p + 1];\n for (int i = 2; i <= p; i++) isPrime[i] = true;\n for (int i = 2; i * i <= p; i++)\n if (!isPrime[i]) continue;\n else\n for (int j = i * i; j <= p; j += i)\n isPrime[j] = false;\n return isPrime;\n }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b0ccbc18076ba660c4ac08d4f393cd32", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces_csharp {\n\tclass Program {\n\t\tstatic bool isPalin(long n) {\n\t\t\tstring a, b;\n\t\t\ta = n.ToString();\n\t\t\tb = new string(a.Reverse().ToArray());\n\n\t\t\treturn a == b;\n\t\t}\n\n\t\t// 1,200,000\n\n\t\tstatic long n = 1200000;\n\t\tstatic bool[] not_prime = new bool[1200001];\n\n\t\tstatic void Main(string[] args) {\n\t\t\tfor (long i = 2; i <= n; i++) {\n\t\t\t\tif (not_prime[i] == false) {\n\t\t\t\t\tfor (long j = i * 2; j <= n; j += i) {\n\t\t\t\t\t\tnot_prime[j] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlong c1 = 0;\n\t\t\tlong c2 = 1;\n\n\t\t\tlong max = 1;\n\n\t\t\tstring[] split = Console.ReadLine().Split(' ');\n\t\t\tlong p = Convert.ToInt64(split[0]);\n\t\t\tlong q = Convert.ToInt64(split[1]);\n\n\t\t\tfor (long i = 2; i <= n; i++) {\n\t\t\t\tbool t1 = !not_prime[i];\n\t\t\t\tbool t2 = isPalin(i);\n\n\t\t\t\tif (t1) { c1++; }\n\t\t\t\tif (t2) { c2++; }\n\n\t\t\t\tif (c1 * q <= c2 * p) {\n\t\t\t\t\tmax = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(max);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "99f5bf06c23be88060f69eab6d339af9", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System; namespace _569C { class Program { const int MAX = 1180000; static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int p = Int32.Parse(input[0]); int q = Int32.Parse(input[1]); int n1 = 0; int n2 = 0; int n = 1; int count = 0; for (int i = 1; i < MAX; i++) { if (isPrime(i) == true) n1++; if (IsPalindrome(i.ToString()) == true) n2++; if (n1 > n2 * p / q && count==0) { n = i - 1; count++; } if (count == 1 && n1 <= n2 * p / q) { count = 0; } } Console.WriteLine(n == MAX ? \"Palindromic tree is better than splay tree\" : n.ToString()); } static bool isPrime(int n) { if (n == 1) return false; if (n == 2) return true; if (n == 3) return true; if (n % 2 == 0) return false; if (n % 3 == 0) return false; int i = 5; int w = 2; while (i * i <= n) { if (n % i == 0) return false; i += w; w = 6 - w; } return true; } static string Reverse(string value) { char[] chars = value.ToCharArray(); Array.Reverse(chars); return new string(chars); } static bool IsPalindrome(string value) { return value == Reverse(value); } } }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d164e2c73d27e8a102834612205aa9a7", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "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 private const int SIEVE_SIZE = 2000000;\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 void Solve()\n {\n Sieve();\n isComposite[1] = true;\n\n long p = ReadInt();\n long q = ReadInt();\n\n int c1 = 0;\n int c2 = 0;\n int ans = 1;\n for (int i = 1; i < SIEVE_SIZE; i++)\n {\n if (!isComposite[i])\n c1++;\n string s = i.ToString();\n bool f = true;\n for (int l = 0, r = s.Length - 1; f && l < r; l++, r--)\n if (s[l] != s[r])\n f = false;\n if (f)\n c2++;\n if (c1 * q <= c2 * p)\n {\n ans = i;\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2dc57279a037fc052874a88c85f78d17", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n internal class C\n {\n private static void Main(string[] args)\n {\n int n = 7000000;\n bool[] prime = new bool[n + 1];\n prime = Array.ConvertAll(prime, b => b = true);\n prime[0] = prime[1] = false;\n for (int i = 2; i * i <= n; ++i)\n {\n if (prime[i])\n for (int j = 2; j <= n / i; j++)\n if (prime[i * j])\n prime[i * j] = false;\n }\n\n string[] s = Console.ReadLine().Split(' ');\n\n float p = float.Parse(s[0]);\n float q = float.Parse(s[1]);\n float pq = p / q;\n int t = 1;\n int ppcnt = 0;\n int prcnt = 0;\n int ppi = 0;\n int res = 0;\n int ppimax = pp.Length;\n while (t < n)\n {\n if (ppi < ppimax && t == pp[ppi])\n {\n ppcnt++;\n ppi++;\n }\n if (prime[t])\n prcnt++;\n if (prcnt <= pq * ppcnt)\n {\n res = t;\n }\n t++;\n }\n Console.WriteLine(\"{0}\", res);\n }\n\n static int[] pp = {1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88,99,101,111,121,131,141,151,161,171,181,191,202,212,222,232,242,252,262,272,282,292,303,313,323,333,343,353,363,373,383,393,404,414,424,434,444,454,464,474,484,494,505,515,525,535,545,555,565,575,585,595,606,616,626,636,646,656,666,676,686,696,707,717,727,737,747,757,767,777,787,797,808,818,828,838,848,858,868,878,888,898,909,919,929,939,949,959,969,979,989,999,1001,1111,1221,1331,1441,1551,1661,1771,1881,1991,2002,2112,2222,2332,2442,2552,2662,2772,2882,2992,3003,3113,3223,3333,3443,3553,3663,3773,3883,3993,4004,4114,4224,4334,4444,4554,4664,4774,4884,4994,5005,5115,5225,5335,5445,5555,5665,5775,5885,5995,6006,6116,6226,6336,6446,6556,6666,6776,6886,6996,7007,7117,7227,7337,7447,7557,7667,7777,7887,7997,8008,8118,8228,8338,8448,8558,8668,8778,8888,8998,9009,9119,9229,9339,9449,9559,9669,9779,9889,9999,10001,10101,10201,10301,10401,10501,10601,10701,10801,10901,11011,11111,11211,11311,11411,11511,11611,11711,11811,11911,12021,12121,12221,12321,12421,12521,12621,12721,12821,12921,13031,13131,13231,13331,13431,13531,13631,13731,13831,13931,14041,14141,14241,14341,14441,14541,14641,14741,14841,14941,15051,15151,15251,15351,15451,15551,15651,15751,15851,15951,16061,16161,16261,16361,16461,16561,16661,16761,16861,16961,17071,17171,17271,17371,17471,17571,17671,17771,17871,17971,18081,18181,18281,18381,18481,18581,18681,18781,18881,18981,19091,19191,19291,19391,19491,19591,19691,19791,19891,19991,20002,20102,20202,20302,20402,20502,20602,20702,20802,20902,21012,21112,21212,21312,21412,21512,21612,21712,21812,21912,22022,22122,22222,22322,22422,22522,22622,22722,22822,22922,23032,23132,23232,23332,23432,23532,23632,23732,23832,23932,24042,24142,24242,24342,24442,24542,24642,24742,24842,24942,25052,25152,25252,25352,25452,25552,25652,25752,25852,25952,26062,26162,26262,26362,26462,26562,26662,26762,26862,26962,27072,27172,27272,27372,27472,27572,27672,27772,27872,27972,28082,28182,28282,28382,28482,28582,28682,28782,28882,28982,29092,29192,29292,29392,29492,29592,29692,29792,29892,29992,30003,30103,30203,30303,30403,30503,30603,30703,30803,30903,31013,31113,31213,31313,31413,31513,31613,31713,31813,31913,32023,32123,32223,32323,32423,32523,32623,32723,32823,32923,33033,33133,33233,33333,33433,33533,33633,33733,33833,33933,34043,34143,34243,34343,34443,34543,34643,34743,34843,34943,35053,35153,35253,35353,35453,35553,35653,35753,35853,35953,36063,36163,36263,36363,36463,36563,36663,36763,36863,36963,37073,37173,37273,37373,37473,37573,37673,37773,37873,37973,38083,38183,38283,38383,38483,38583,38683,38783,38883,38983,39093,39193,39293,39393,39493,39593,39693,39793,39893,39993,40004,40104,40204,40304,40404,40504,40604,40704,40804,40904,41014,41114,41214,41314,41414,41514,41614,41714,41814,41914,42024,42124,42224,42324,42424,42524,42624,42724,42824,42924,43034,43134,43234,43334,43434,43534,43634,43734,43834,43934,44044,44144,44244,44344,44444,44544,44644,44744,44844,44944,45054,45154,45254,45354,45454,45554,45654,45754,45854,45954,46064,46164,46264,46364,46464,46564,46664,46764,46864,46964,47074,47174,47274,47374,47474,47574,47674,47774,47874,47974,48084,48184,48284,48384,48484,48584,48684,48784,48884,48984,49094,49194,49294,49394,49494,49594,49694,49794,49894,49994,50005,50105,50205,50305,50405,50505,50605,50705,50805,50905,51015,51115,51215,51315,51415,51515,51615,51715,51815,51915,52025,52125,52225,52325,52425,52525,52625,52725,52825,52925,53035,53135,53235,53335,53435,53535,53635,53735,53835,53935,54045,54145,54245,54345,54445,54545,54645,54745,54845,54945,55055,55155,55255,55355,55455,55555,55655,55755,55855,55955,56065,56165,56265,56365,56465,56565,56665,56765,56865,56965,57075,57175,57275,57375,57475,57575,57675,57775,57875,57975,58085,58185,58285,58385,58485,58585,58685,58785,58885,58985,59095,59195,59295,59395,59495,59595,59695,59795,59895,59995,60006,60106,60206,60306,60406,60506,60606,60706,60806,60906,61016,61116,61216,61316,61416,61516,61616,61716,61816,61916,62026,62126,62226,62326,62426,62526,62626,62726,62826,62926,63036,63136,63236,63336,63436,63536,63636,63736,63836,63936,64046,64146,64246,64346,64446,64546,64646,64746,64846,64946,65056,65156,65256,65356,65456,65556,65656,65756,65856,65956,66066,66166,66266,66366,66466,66566,66666,66766,66866,66966,67076,67176,67276,67376,67476,67576,67676,67776,67876,67976,68086,68186,68286,68386,68486,68586,68686,68786,68886,68986,69096,69196,69296,69396,69496,69596,69696,69796,69896,69996,70007,70107,70207,70307,70407,70507,70607,70707,70807,70907,71017,71117,71217,71317,71417,71517,71617,71717,71817,71917,72027,72127,72227,72327,72427,72527,72627,72727,72827,72927,73037,73137,73237,73337,73437,73537,73637,73737,73837,73937,74047,74147,74247,74347,74447,74547,74647,74747,74847,74947,75057,75157,75257,75357,75457,75557,75657,75757,75857,75957,76067,76167,76267,76367,76467,76567,76667,76767,76867,76967,77077,77177,77277,77377,77477,77577,77677,77777,77877,77977,78087,78187,78287,78387,78487,78587,78687,78787,78887,78987,79097,79197,79297,79397,79497,79597,79697,79797,79897,79997,80008,80108,80208,80308,80408,80508,80608,80708,80808,80908,81018,81118,81218,81318,81418,81518,81618,81718,81818,81918,82028,82128,82228,82328,82428,82528,82628,82728,82828,82928,83038,83138,83238,83338,83438,83538,83638,83738,83838,83938,84048,84148,84248,84348,84448,84548,84648,84748,84848,84948,85058,85158,85258,85358,85458,85558,85658,85758,85858,85958,86068,86168,86268,86368,86468,86568,86668,86768,86868,86968,87078,87178,87278,87378,87478,87578,87678,87778,87878,87978,88088,88188,88288,88388,88488,88588,88688,88788,88888,88988,89098,89198,89298,89398,89498,89598,89698,89798,89898,89998,90009,90109,90209,90309,90409,90509,90609,90709,90809,90909,91019,91119,91219,91319,91419,91519,91619,91719,91819,91919,92029,92129,92229,92329,92429,92529,92629,92729,92829,92929,93039,93139,93239,93339,93439,93539,93639,93739,93839,93939,94049,94149,94249,94349,94449,94549,94649,94749,94849,94949,95059,95159,95259,95359,95459,95559,95659,95759,95859,95959,96069,96169,96269,96369,96469,96569,96669,96769,96869,96969,97079,97179,97279,97379,97479,97579,97679,97779,97879,97979,98089,98189,98289,98389,98489,98589,98689,98789,98889,98989,99099,99199,99299,99399,99499,99599,99699,99799,99899,99999,100001,101101,102201,103301,104401,105501,106601,107701,108801,109901,110011,111111,112211,113311,114411,115511,116611,117711,118811,119911,120021,121121,122221,123321,124421,125521,126621,127721,128821,129921,130031,131131,132231,133331,134431,135531,136631,137731,138831,139931,140041,141141,142241,143341,144441,145541,146641,147741,148841,149941,150051,151151,152251,153351,154451,155551,156651,157751,158851,159951,160061,161161,162261,163361,164461,165561,166661,167761,168861,169961,170071,171171,172271,173371,174471,175571,176671,177771,178871,179971,180081,181181,182281,183381,184481,185581,186681,187781,188881,189981,190091,191191,192291,193391,194491,195591,196691,197791,198891,199991,200002,201102,202202,203302,204402,205502,206602,207702,208802,209902,210012,211112,212212,213312,214412,215512,216612,217712,218812,219912,220022,221122,222222,223322,224422,225522,226622,227722,228822,229922,230032,231132,232232,233332,234432,235532,236632,237732,238832,239932,240042,241142,242242,243342,244442,245542,246642,247742,248842,249942,250052,251152,252252,253352,254452,255552,256652,257752,258852,259952,260062,261162,262262,263362,264462,265562,266662,267762,268862,269962,270072,271172,272272,273372,274472,275572,276672,277772,278872,279972,280082,281182,282282,283382,284482,285582,286682,287782,288882,289982,290092,291192,292292,293392,294492,295592,296692,297792,298892,299992,300003,301103,302203,303303,304403,305503,306603,307703,308803,309903,310013,311113,312213,313313,314413,315513,316613,317713,318813,319913,320023,321123,322223,323323,324423,325523,326623,327723,328823,329923,330033,331133,332233,333333,334433,335533,336633,337733,338833,339933,340043,341143,342243,343343,344443,345543,346643,347743,348843,349943,350053,351153,352253,353353,354453,355553,356653,357753,358853,359953,360063,361163,362263,363363,364463,365563,366663,367763,368863,369963,370073,371173,372273,373373,374473,375573,376673,377773,378873,379973,380083,381183,382283,383383,384483,385583,386683,387783,388883,389983,390093,391193,392293,393393,394493,395593,396693,397793,398893,399993,400004,401104,402204,403304,404404,405504,406604,407704,408804,409904,410014,411114,412214,413314,414414,415514,416614,417714,418814,419914,420024,421124,422224,423324,424424,425524,426624,427724,428824,429924,430034,431134,432234,433334,434434,435534,436634,437734,438834,439934,440044,441144,442244,443344,444444,445544,446644,447744,448844,449944,450054,451154,452254,453354,454454,455554,456654,457754,458854,459954,460064,461164,462264,463364,464464,465564,466664,467764,468864,469964,470074,471174,472274,473374,474474,475574,476674,477774,478874,479974,480084,481184,482284,483384,484484,485584,486684,487784,488884,489984,490094,491194,492294,493394,494494,495594,496694,497794,498894,499994,500005,501105,502205,503305,504405,505505,506605,507705,508805,509905,510015,511115,512215,513315,514415,515515,516615,517715,518815,519915,520025,521125,522225,523325,524425,525525,526625,527725,528825,529925,530035,531135,532235,533335,534435,535535,536635,537735,538835,539935,540045,541145,542245,543345,544445,545545,546645,547745,548845,549945,550055,551155,552255,553355,554455,555555,556655,557755,558855,559955,560065,561165,562265,563365,564465,565565,566665,567765,568865,569965,570075,571175,572275,573375,574475,575575,576675,577775,578875,579975,580085,581185,582285,583385,584485,585585,586685,587785,588885,589985,590095,591195,592295,593395,594495,595595,596695,597795,598895,599995,600006,601106,602206,603306,604406,605506,606606,607706,608806,609906,610016,611116,612216,613316,614416,615516,616616,617716,618816,619916,620026,621126,622226,623326,624426,625526,626626,627726,628826,629926,630036,631136,632236,633336,634436,635536,636636,637736,638836,639936,640046,641146,642246,643346,644446,645546,646646,647746,648846,649946,650056,651156,652256,653356,654456,655556,656656,657756,658856,659956,660066,661166,662266,663366,664466,665566,666666,667766,668866,669966,670076,671176,672276,673376,674476,675576,676676,677776,678876,679976,680086,681186,682286,683386,684486,685586,686686,687786,688886,689986,690096,691196,692296,693396,694496,695596,696696,697796,698896,699996,700007,701107,702207,703307,704407,705507,706607,707707,708807,709907,710017,711117,712217,713317,714417,715517,716617,717717,718817,719917,720027,721127,722227,723327,724427,725527,726627,727727,728827,729927,730037,731137,732237,733337,734437,735537,736637,737737,738837,739937,740047,741147,742247,743347,744447,745547,746647,747747,748847,749947,750057,751157,752257,753357,754457,755557,756657,757757,758857,759957,760067,761167,762267,763367,764467,765567,766667,767767,768867,769967,770077,771177,772277,773377,774477,775577,776677,777777,778877,779977,780087,781187,782287,783387,784487,785587,786687,787787,788887,789987,790097,791197,792297,793397,794497,795597,796697,797797,798897,799997,800008,801108,802208,803308,804408,805508,806608,807708,808808,809908,810018,811118,812218,813318,814418,815518,816618,817718,818818,819918,820028,821128,822228,823328,824428,825528,826628,827728,828828,829928,830038,831138,832238,833338,834438,835538,836638,837738,838838,839938,840048,841148,842248,843348,844448,845548,846648,847748,848848,849948,850058,851158,852258,853358,854458,855558,856658,857758,858858,859958,860068,861168,862268,863368,864468,865568,866668,867768,868868,869968,870078,871178,872278,873378,874478,875578,876678,877778,878878,879978,880088,881188,882288,883388,884488,885588,886688,887788,888888,889988,890098,891198,892298,893398,894498,895598,896698,897798,898898,899998,900009,901109,902209,903309,904409,905509,906609,907709,908809,909909,910019,911119,912219,913319,914419,915519,916619,917719,918819,919919,920029,921129,922229,923329,924429,925529,926629,927729,928829,929929,930039,931139,932239,933339,934439,935539,936639,937739,938839,939939,940049,941149,942249,943349,944449,945549,946649,947749,948849,949949,950059,951159,952259,953359,954459,955559,956659,957759,958859,959959,960069,961169,962269,963369,964469,965569,966669,967769,968869,969969,970079,971179,972279,973379,974479,975579,976679,977779,978879,979979,980089,981189,982289,983389,984489,985589,986689,987789,988889,989989,990099,991199,992299,993399,994499,995599,996699,997799,998899,999999,1000001,1001001,1002001,1003001,1004001,1005001,1006001,1007001,1008001,1009001,1010101,1011101,1012101,1013101,1014101,1015101,1016101,1017101,1018101,1019101,1020201,1021201,1022201,1023201,1024201,1025201,1026201,1027201,1028201,1029201,1030301,1031301,1032301,1033301,1034301,1035301,1036301,1037301,1038301,1039301,1040401,1041401,1042401,1043401,1044401,1045401,1046401,1047401,1048401,1049401,1050501,1051501,1052501,1053501,1054501,1055501,1056501,1057501,1058501,1059501,1060601,1061601,1062601,1063601,1064601,1065601,1066601,1067601,1068601,1069601,1070701,1071701,1072701,1073701,1074701,1075701,1076701,1077701,1078701,1079701,1080801,1081801,1082801,1083801,1084801,1085801,1086801,1087801,1088801,1089801,1090901,1091901,1092901,1093901,1094901,1095901,1096901,1097901,1098901,1099901,1100011,1101011,1102011,1103011,1104011,1105011,1106011,1107011,1108011,1109011,1110111,1111111,1112111,1113111,1114111,1115111,1116111,1117111,1118111,1119111,1120211,1121211,1122211,1123211,1124211,1125211,1126211,1127211,1128211,1129211,1130311,1131311,1132311,1133311,1134311,1135311,1136311,1137311,1138311,1139311,1140411,1141411,1142411,1143411,1144411,1145411,1146411,1147411,1148411,1149411,1150511,1151511,1152511,1153511,1154511,1155511,1156511,1157511,1158511,1159511,1160611,1161611,1162611,1163611,1164611,1165611,1166611,1167611,1168611,1169611,1170711,1171711,1172711,1173711,1174711,1175711,1176711,1177711,1178711,1179711,1180811,1181811,1182811,1183811,1184811,1185811,1186811,1187811,1188811,1189811,1190911,1191911,1192911,1193911,1194911,1195911,1196911,1197911,1198911,1199911,1200021,1201021,1202021,1203021,1204021,1205021,1206021,1207021,1208021,1209021,1210121,1211121,1212121,1213121,1214121,1215121,1216121,1217121,1218121,1219121,1220221,1221221,1222221,1223221,1224221,1225221,1226221,1227221,1228221,1229221,1230321,1231321,1232321,1233321,1234321,1235321,1236321,1237321,1238321,1239321,1240421,1241421,1242421,1243421,1244421,1245421,1246421,1247421,1248421,1249421,1250521,1251521,1252521,1253521,1254521,1255521,1256521,1257521,1258521,1259521,1260621,1261621,1262621,1263621,1264621,1265621,1266621,1267621,1268621,1269621,1270721,1271721,1272721,1273721,1274721,1275721,1276721,1277721,1278721,1279721,1280821,1281821,1282821,1283821,1284821,1285821,1286821,1287821,1288821,1289821,1290921,1291921,1292921,1293921,1294921,1295921,1296921,1297921,1298921,1299921,1300031,1301031,1302031,1303031,1304031,1305031,1306031,1307031,1308031,1309031,1310131,1311131,1312131,1313131,1314131,1315131,1316131,1317131,1318131,1319131,1320231,1321231,1322231,1323231,1324231,1325231,1326231,1327231,1328231,1329231,1330331,1331331,1332331,1333331,1334331,1335331,1336331,1337331,1338331,1339331,1340431,1341431,1342431,1343431,1344431,1345431,1346431,1347431,1348431,1349431,1350531,1351531,1352531,1353531,1354531,1355531,1356531,1357531,1358531,1359531,1360631,1361631,1362631,1363631,1364631,1365631,1366631,1367631,1368631,1369631,1370731,1371731,1372731,1373731,1374731,1375731,1376731,1377731,1378731,1379731,1380831,1381831,1382831,1383831,1384831,1385831,1386831,1387831,1388831,1389831,1390931,1391931,1392931,1393931,1394931,1395931,1396931,1397931,1398931,1399931,1400041,1401041,1402041,1403041,1404041,1405041,1406041,1407041,1408041,1409041,1410141,1411141,1412141,1413141,1414141,1415141,1416141,1417141,1418141,1419141,1420241,1421241,1422241,1423241,1424241,1425241,1426241,1427241,1428241,1429241,1430341,1431341,1432341,1433341,1434341,1435341,1436341,1437341,1438341,1439341,1440441,1441441,1442441,1443441,1444441,1445441,1446441,1447441,1448441,1449441,1450541,1451541,1452541,1453541,1454541,1455541,1456541,1457541,1458541,1459541,1460641,1461641,1462641,1463641,1464641,1465641,1466641,1467641,1468641,1469641,1470741,1471741,1472741,1473741,1474741,1475741,1476741,1477741,1478741,1479741,1480841,1481841,1482841,1483841,1484841,1485841,1486841,1487841,1488841,1489841,1490941,1491941,1492941,1493941,1494941,1495941,1496941,1497941,1498941,1499941,1500051,1501051,1502051,1503051,1504051,1505051,1506051,1507051,1508051,1509051,1510151,1511151,1512151,1513151,1514151,1515151,1516151,1517151,1518151,1519151,1520251,1521251,1522251,1523251,1524251,1525251,1526251,1527251,1528251,1529251,1530351,1531351,1532351,1533351,1534351,1535351,1536351,1537351,1538351,1539351,1540451,1541451,1542451,1543451,1544451,1545451,1546451,1547451,1548451,1549451,1550551,1551551,1552551,1553551,1554551,1555551,1556551,1557551,1558551,1559551,1560651,1561651,1562651,1563651,1564651,1565651,1566651,1567651,1568651,1569651,1570751,1571751,1572751,1573751,1574751,1575751,1576751,1577751,1578751,1579751,1580851,1581851,1582851,1583851,1584851,1585851,1586851,1587851,1588851,1589851,1590951,1591951,1592951,1593951,1594951,1595951,1596951,1597951,1598951,1599951,1600061,1601061,1602061,1603061,1604061,1605061,1606061,1607061,1608061,1609061,1610161,1611161,1612161,1613161,1614161,1615161,1616161,1617161,1618161,1619161,1620261,1621261,1622261,1623261,1624261,1625261,1626261,1627261,1628261,1629261,1630361,1631361,1632361,1633361,1634361,1635361,1636361,1637361,1638361,1639361,1640461,1641461,1642461,1643461,1644461,1645461,1646461,1647461,1648461,1649461,1650561,1651561,1652561,1653561,1654561,1655561,1656561,1657561,1658561,1659561,1660661,1661661,1662661,1663661,1664661,1665661,1666661,1667661,1668661,1669661,1670761,1671761,1672761,1673761,1674761,1675761,1676761,1677761,1678761,1679761,1680861,1681861,1682861,1683861,1684861,1685861,1686861,1687861,1688861,1689861,1690961,1691961,1692961,1693961,1694961,1695961,1696961,1697961,1698961,1699961,1700071,1701071,1702071,1703071,1704071,1705071,1706071,1707071,1708071,1709071,1710171,1711171,1712171,1713171,1714171,1715171,1716171,1717171,1718171,1719171,1720271,1721271,1722271,1723271,1724271,1725271,1726271,1727271,1728271,1729271,1730371,1731371,1732371,1733371,1734371,1735371,1736371,1737371,1738371,1739371,1740471,1741471,1742471,1743471,1744471,1745471,1746471,1747471,1748471,1749471,1750571,1751571,1752571,1753571,1754571,1755571,1756571,1757571,1758571,1759571,1760671,1761671,1762671,1763671,1764671,1765671,1766671,1767671,1768671,1769671,1770771,1771771,1772771,1773771,1774771,1775771,1776771,1777771,1778771,1779771,1780871,1781871,1782871,1783871,1784871,1785871,1786871,1787871,1788871,1789871,1790971,1791971,1792971,1793971,1794971,1795971,1796971,1797971,1798971,1799971,1800081,1801081,1802081,1803081,1804081,1805081,1806081,1807081,1808081,1809081,1810181,1811181,1812181,1813181,1814181,1815181,1816181,1817181,1818181,1819181,1820281,1821281,1822281,1823281,1824281,1825281,1826281,1827281,1828281,1829281,1830381,1831381,1832381,1833381,1834381,1835381,1836381,1837381,1838381,1839381,1840481,1841481,1842481,1843481,1844481,1845481,1846481,1847481,1848481,1849481,1850581,1851581,1852581,1853581,1854581,1855581,1856581,1857581,1858581,1859581,1860681,1861681,1862681,1863681,1864681,1865681,1866681,1867681,1868681,1869681,1870781,1871781,1872781,1873781,1874781,1875781,1876781,1877781,1878781,1879781,1880881,1881881,1882881,1883881,1884881,1885881,1886881,1887881,1888881,1889881,1890981,1891981,1892981,1893981,1894981,1895981,1896981,1897981,1898981,1899981,1900091,1901091,1902091,1903091,1904091,1905091,1906091,1907091,1908091,1909091,1910191,1911191,1912191,1913191,1914191,1915191,1916191,1917191,1918191,1919191,1920291,1921291,1922291,1923291,1924291,1925291,1926291,1927291,1928291,1929291,1930391,1931391,1932391,1933391,1934391,1935391,1936391,1937391,1938391,1939391,1940491,1941491,1942491,1943491,1944491,1945491,1946491,1947491,1948491,1949491,1950591,1951591,1952591,1953591,1954591,1955591,1956591,1957591,1958591,1959591,1960691,1961691,1962691,1963691,1964691,1965691,1966691,1967691,1968691,1969691,1970791,1971791,1972791,1973791,1974791,1975791,1976791,1977791,1978791,1979791,1980891,1981891,1982891,1983891,1984891,1985891,1986891,1987891,1988891,1989891,1990991,1991991,1992991,1993991,1994991,1995991,1996991,1997991,1998991,1999991,2000002,2001002,2002002,2003002,2004002,2005002,2006002,2007002,2008002,2009002,2010102,2011102,2012102,2013102,2014102,2015102,2016102,2017102,2018102,2019102,2020202,2021202,2022202,2023202,2024202,2025202,2026202,2027202,2028202,2029202,2030302,2031302,2032302,2033302,2034302,2035302,2036302,2037302,2038302,2039302,2040402,2041402,2042402,2043402,2044402,2045402,2046402,2047402,2048402,2049402,2050502,2051502,2052502,2053502,2054502,2055502,2056502,2057502,2058502,2059502,2060602,2061602,2062602,2063602,2064602,2065602,2066602,2067602,2068602,2069602,2070702,2071702,2072702,2073702,2074702,2075702,2076702,2077702,2078702,2079702,2080802,2081802,2082802,2083802,2084802,2085802,2086802,2087802,2088802,2089802,2090902,2091902,2092902,2093902,2094902,2095902,2096902,2097902,2098902,2099902,2100012,2101012,2102012,2103012,2104012,2105012,2106012,2107012,2108012,2109012,2110112,2111112,2112112,2113112,2114112,2115112,2116112,2117112,2118112,2119112,2120212,2121212,2122212,2123212,2124212,2125212,2126212,2127212,2128212,2129212,2130312,2131312,2132312,2133312,2134312,2135312,2136312,2137312,2138312,2139312,2140412,2141412,2142412,2143412,2144412,2145412,2146412,2147412,2148412,2149412,2150512,2151512,2152512,2153512,2154512,2155512,2156512,2157512,2158512,2159512,2160612,2161612,2162612,2163612,2164612,2165612,2166612,2167612,2168612,2169612,2170712,2171712,2172712,2173712,2174712,2175712,2176712,2177712,2178712,2179712,2180812,2181812,2182812,2183812,2184812,2185812,2186812,2187812,2188812,2189812,2190912,2191912,2192912,2193912,2194912,2195912,2196912,2197912,2198912,2199912,2200022,2201022,2202022,2203022,2204022,2205022,2206022,2207022,2208022,2209022,2210122,2211122,2212122,2213122,2214122,2215122,2216122,2217122,2218122,2219122,2220222,2221222,2222222,2223222,2224222,2225222,2226222,2227222,2228222,2229222,2230322,2231322,2232322,2233322,2234322,2235322,2236322,2237322,2238322,2239322,2240422,2241422,2242422,2243422,2244422,2245422,2246422,2247422,2248422,2249422,2250522,2251522,2252522,2253522,2254522,2255522,2256522,2257522,2258522,2259522,2260622,2261622,2262622,2263622,2264622,2265622,2266622,2267622,2268622,2269622,2270722,2271722,2272722,2273722,2274722,2275722,2276722,2277722,2278722,2279722,2280822,2281822,2282822,2283822,2284822,2285822,2286822,2287822,2288822,2289822,2290922,2291922,2292922,2293922,2294922,2295922,2296922,2297922,2298922,2299922,2300032,2301032,2302032,2303032,2304032,2305032,2306032,2307032,2308032,2309032,2310132,2311132,2312132,2313132,2314132,2315132,2316132,2317132,2318132,2319132,2320232,2321232,2322232,2323232,2324232,2325232,2326232,2327232,2328232,2329232,2330332,2331332,2332332,2333332,2334332,2335332,2336332,2337332,2338332,2339332,2340432,2341432,2342432,2343432,2344432,2345432,2346432,2347432,2348432,2349432,2350532,2351532,2352532,2353532,2354532,2355532,2356532,2357532,2358532,2359532,2360632,2361632,2362632,2363632,2364632,2365632,2366632,2367632,2368632,2369632,2370732,2371732,2372732,2373732,2374732,2375732,2376732,2377732,2378732,2379732,2380832,2381832,2382832,2383832,2384832,2385832,2386832,2387832,2388832,2389832,2390932,2391932,2392932,2393932,2394932,2395932,2396932,2397932,2398932,2399932,2400042,2401042,2402042,2403042,2404042,2405042,2406042,2407042,2408042,2409042,2410142,2411142,2412142,2413142,2414142,2415142,2416142,2417142,2418142,2419142,2420242,2421242,2422242,2423242,2424242,2425242,2426242,2427242,2428242,2429242,2430342,2431342,2432342,2433342,2434342,2435342,2436342,2437342,2438342,2439342,2440442,2441442,2442442,2443442,2444442,2445442,2446442,2447442,2448442,2449442,2450542,2451542,2452542,2453542,2454542,2455542,2456542,2457542,2458542,2459542,2460642,2461642,2462642,2463642,2464642,2465642,2466642,2467642,2468642,2469642,2470742,2471742,2472742,2473742,2474742,2475742,2476742,2477742,2478742,2479742,2480842,2481842,2482842,2483842,2484842,2485842,2486842,2487842,2488842,2489842,2490942,2491942,2492942,2493942,2494942,2495942,2496942,2497942,2498942,2499942,2500052,2501052,2502052,2503052,2504052,2505052,2506052,2507052,2508052,2509052,2510152,2511152,2512152,2513152,2514152,2515152,2516152,2517152,2518152,2519152,2520252,2521252,2522252,2523252,2524252,2525252,2526252,2527252,2528252,2529252,2530352,2531352,2532352,2533352,2534352,2535352,2536352,2537352,2538352,2539352,2540452,2541452,2542452,2543452,2544452,2545452,2546452,2547452,2548452,2549452,2550552,2551552,2552552,2553552,2554552,2555552,2556552,2557552,2558552,2559552,2560652,2561652,2562652,2563652,2564652,2565652,2566652,2567652,2568652,2569652,2570752,2571752,2572752,2573752,2574752,2575752,2576752,2577752,2578752,2579752,2580852,2581852,2582852,2583852,2584852,2585852,2586852,2587852,2588852,2589852,2590952,2591952,2592952,2593952,2594952,2595952,2596952,2597952,2598952,2599952,2600062,2601062,2602062,2603062,2604062,2605062,2606062,2607062,2608062,2609062,2610162,2611162,2612162,2613162,2614162,2615162,2616162,2617162,2618162,2619162,2620262,2621262,2622262,2623262,2624262,2625262,2626262,2627262,2628262,2629262,2630362,2631362,2632362,2633362,2634362,2635362,2636362,2637362,2638362,2639362,2640462,2641462,2642462,2643462,2644462,2645462,2646462,2647462,2648462,2649462,2650562,2651562,2652562,2653562,2654562,2655562,2656562,2657562,2658562,2659562,2660662,2661662,2662662,2663662,2664662,2665662,2666662,2667662,2668662,2669662,2670762,2671762,2672762,2673762,2674762,2675762,2676762,2677762,2678762,2679762,2680862,2681862,2682862,2683862,2684862,2685862,2686862,2687862,2688862,2689862,2690962,2691962,2692962,2693962,2694962,2695962,2696962,2697962,2698962,2699962,2700072,2701072,2702072,2703072,2704072,2705072,2706072,2707072,2708072,2709072,2710172,2711172,2712172,2713172,2714172,2715172,2716172,2717172,2718172,2719172,2720272,2721272,2722272,2723272,2724272,2725272,2726272,2727272,2728272,2729272,2730372,2731372,2732372,2733372,2734372,2735372,2736372,2737372,2738372,2739372,2740472,2741472,2742472,2743472,2744472,2745472,2746472,2747472,2748472,2749472,2750572,2751572,2752572,2753572,2754572,2755572,2756572,2757572,2758572,2759572,2760672,2761672,2762672,2763672,2764672,2765672,2766672,2767672,2768672,2769672,2770772,2771772,2772772,2773772,2774772,2775772,2776772,2777772,2778772,2779772,2780872,2781872,2782872,2783872,2784872,2785872,2786872,2787872,2788872,2789872,2790972,2791972,2792972,2793972,2794972,2795972,2796972,2797972,2798972,2799972,2800082,2801082,2802082,2803082,2804082,2805082,2806082,2807082,2808082,2809082,2810182,2811182,2812182,2813182,2814182,2815182,2816182,2817182,2818182,2819182,2820282,2821282,2822282,2823282,2824282,2825282,2826282,2827282,2828282,2829282,2830382,2831382,2832382,2833382,2834382,2835382,2836382,2837382,2838382,2839382,2840482,2841482,2842482,2843482,2844482,2845482,2846482,2847482,2848482,2849482,2850582,2851582,2852582,2853582,2854582,2855582,2856582,2857582,2858582,2859582,2860682,2861682,2862682,2863682,2864682,2865682,2866682,2867682,2868682,2869682,2870782,2871782,2872782,2873782,2874782,2875782,2876782,2877782,2878782,2879782,2880882,2881882,2882882,2883882,2884882,2885882,2886882,2887882,2888882,2889882,2890982,2891982,2892982,2893982,2894982,2895982,2896982,2897982,2898982,2899982,2900092,2901092,2902092,2903092,2904092,2905092,2906092,2907092,2908092,2909092,2910192,2911192,2912192,2913192,2914192,2915192,2916192,2917192,2918192,2919192,2920292,2921292,2922292,2923292,2924292,2925292,2926292,2927292,2928292,2929292,2930392,2931392,2932392,2933392,2934392,2935392,2936392,2937392,2938392,2939392,2940492,2941492,2942492,2943492,2944492,2945492,2946492,2947492,2948492,2949492,2950592,2951592,2952592,2953592,2954592,2955592,2956592,2957592,2958592,2959592,2960692,2961692,2962692,2963692,2964692,2965692,2966692,2967692,2968692,2969692,2970792,2971792,2972792,2973792,2974792,2975792,2976792,2977792,2978792,2979792,2980892,2981892,2982892,2983892,2984892,2985892,2986892,2987892,2988892,2989892,2990992,2991992,2992992,2993992,2994992,2995992,2996992,2997992,2998992,2999992,3000003,3001003,3002003,3003003,3004003,3005003,3006003,3007003,3008003,3009003,3010103,3011103,3012103,3013103,3014103,3015103,3016103,3017103,3018103,3019103,3020203,3021203,3022203,3023203,3024203,3025203,3026203,3027203,3028203,3029203,3030303,3031303,3032303,3033303,3034303,3035303,3036303,3037303,3038303,3039303,3040403,3041403,3042403,3043403,3044403,3045403,3046403,3047403,3048403,3049403,3050503,3051503,3052503,3053503,3054503,3055503,3056503,3057503,3058503,3059503,3060603,3061603,3062603,3063603,3064603,3065603,3066603,3067603,3068603,3069603,3070703,3071703,3072703,3073703,3074703,3075703,3076703,3077703,3078703,3079703,3080803,3081803,3082803,3083803,3084803,3085803,3086803,3087803,3088803,3089803,3090903,3091903,3092903,3093903,3094903,3095903,3096903,3097903,3098903,3099903,3100013,3101013,3102013,3103013,3104013,3105013,3106013,3107013,3108013,3109013,3110113,3111113,3112113,3113113,3114113,3115113,3116113,3117113,3118113,3119113,3120213,3121213,3122213,3123213,3124213,3125213,3126213,3127213,3128213,3129213,3130313,3131313,3132313,3133313,3134313,3135313,3136313,3137313,3138313,3139313,3140413,3141413,3142413,3143413,3144413,3145413,3146413,3147413,3148413,3149413,3150513,3151513,3152513,3153513,3154513,3155513,3156513,3157513,3158513,3159513,3160613,3161613,3162613,3163613,3164613,3165613,3166613,3167613,3168613,3169613,3170713,3171713,3172713,3173713,3174713,3175713,3176713,3177713,3178713,3179713,3180813,3181813,3182813,3183813,3184813,3185813,3186813,3187813,3188813,3189813,3190913,3191913,3192913,3193913,3194913,3195913,3196913,3197913,3198913,3199913,3200023,3201023,3202023,3203023,3204023,3205023,3206023,3207023,3208023,3209023,3210123,3211123,3212123,3213123,3214123,3215123,3216123,3217123,3218123,3219123,3220223,3221223,3222223,3223223,3224223,3225223,3226223,3227223,3228223,3229223,3230323,3231323,3232323,3233323,3234323,3235323,3236323,3237323,3238323,3239323,3240423,3241423,3242423,3243423,3244423,3245423,3246423,3247423,3248423,3249423,3250523,3251523,3252523,3253523,3254523,3255523,3256523,3257523,3258523,3259523,3260623,3261623,3262623,3263623,3264623,3265623,3266623,3267623,3268623,3269623,3270723,3271723,3272723,3273723,3274723,3275723,3276723,3277723,3278723,3279723,3280823,3281823,3282823,3283823,3284823,3285823,3286823,3287823,3288823,3289823,3290923,3291923,3292923,3293923,3294923,3295923,3296923,3297923,3298923,3299923,3300033,3301033,3302033,3303033,3304033,3305033,3306033,3307033,3308033,3309033,3310133,3311133,3312133,3313133,3314133,3315133,3316133,3317133,3318133,3319133,3320233,3321233,3322233,3323233,3324233,3325233,3326233,3327233,3328233,3329233,3330333,3331333,3332333,3333333,3334333,3335333,3336333,3337333,3338333,3339333,3340433,3341433,3342433,3343433,3344433,3345433,3346433,3347433,3348433,3349433,3350533,3351533,3352533,3353533,3354533,3355533,3356533,3357533,3358533,3359533,3360633,3361633,3362633,3363633,3364633,3365633,3366633,3367633,3368633,3369633,3370733,3371733,3372733,3373733,3374733,3375733,3376733,3377733,3378733,3379733,3380833,3381833,3382833,3383833,3384833,3385833,3386833,3387833,3388833,3389833,3390933,3391933,3392933,3393933,3394933,3395933,3396933,3397933,3398933,3399933,3400043,3401043,3402043,3403043,3404043,3405043,3406043,3407043,3408043,3409043,3410143,3411143,3412143,3413143,3414143,3415143,3416143,3417143,3418143,3419143,3420243,3421243,3422243,3423243,3424243,3425243,3426243,3427243,3428243,3429243,3430343,3431343,3432343,3433343,3434343,3435343,3436343,3437343,3438343,3439343,3440443,3441443,3442443,3443443,3444443,3445443,3446443,3447443,3448443,3449443,3450543,3451543,3452543,3453543,3454543,3455543,3456543,3457543,3458543,3459543,3460643,3461643,3462643,3463643,3464643,3465643,3466643,3467643,3468643,3469643,3470743,3471743,3472743,3473743,3474743,3475743,3476743,3477743,3478743,3479743,3480843,3481843,3482843,3483843,3484843,3485843,3486843,3487843,3488843,3489843,3490943,3491943,3492943,3493943,3494943,3495943,3496943,3497943,3498943,3499943,3500053,3501053,3502053,3503053,3504053,3505053,3506053,3507053,3508053,3509053,3510153,3511153,3512153,3513153,3514153,3515153,3516153,3517153,3518153,3519153,3520253,3521253,3522253,3523253,3524253,3525253,3526253,3527253,3528253,3529253,3530353,3531353,3532353,3533353,3534353,3535353,3536353,3537353,3538353,3539353,3540453,3541453,3542453,3543453,3544453,3545453,3546453,3547453,3548453,3549453,3550553,3551553,3552553,3553553,3554553,3555553,3556553,3557553,3558553,3559553,3560653,3561653,3562653,3563653,3564653,3565653,3566653,3567653,3568653,3569653,3570753,3571753,3572753,3573753,3574753,3575753,3576753,3577753,3578753,3579753,3580853,3581853,3582853,3583853,3584853,3585853,3586853,3587853,3588853,3589853,3590953,3591953,3592953,3593953,3594953,3595953,3596953,3597953,3598953,3599953,3600063,3601063,3602063,3603063,3604063,3605063,3606063,3607063,3608063,3609063,3610163,3611163,3612163,3613163,3614163,3615163,3616163,3617163,3618163,3619163,3620263,3621263,3622263,3623263,3624263,3625263,3626263,3627263,3628263,3629263,3630363,3631363,3632363,3633363,3634363,3635363,3636363,3637363,3638363,3639363,3640463,3641463,3642463,3643463,3644463,3645463,3646463,3647463,3648463,3649463,3650563,3651563,3652563,3653563,3654563,3655563,3656563,3657563,3658563,3659563,3660663,3661663,3662663,3663663,3664663,3665663,3666663,3667663,3668663,3669663,3670763,3671763,3672763,3673763,3674763,3675763,3676763,3677763,3678763,3679763,3680863,3681863,3682863,3683863,3684863,3685863,3686863,3687863,3688863,3689863,3690963,3691963,3692963,3693963,3694963,3695963,3696963,3697963,3698963,3699963,3700073,3701073,3702073,3703073,3704073,3705073,3706073,3707073,3708073,3709073,3710173,3711173,3712173,3713173,3714173,3715173,3716173,3717173,3718173,3719173,3720273,3721273,3722273,3723273,3724273,3725273,3726273,3727273,3728273,3729273,3730373,3731373,3732373,3733373,3734373,3735373,3736373,3737373,3738373,3739373,3740473,3741473,3742473,3743473,3744473,3745473,3746473,3747473,3748473,3749473,3750573,3751573,3752573,3753573,3754573,3755573,3756573,3757573,3758573,3759573,3760673,3761673,3762673,3763673,3764673,3765673,3766673,3767673,3768673,3769673,3770773,3771773,3772773,3773773,3774773,3775773,3776773,3777773,3778773,3779773,3780873,3781873,3782873,3783873,3784873,3785873,3786873,3787873,3788873,3789873,3790973,3791973,3792973,3793973,3794973,3795973,3796973,3797973,3798973,3799973,3800083,3801083,3802083,3803083,3804083,3805083,3806083,3807083,3808083,3809083,3810183,3811183,3812183,3813183,3814183,3815183,3816183,3817183,3818183,3819183,3820283,3821283,3822283,3823283,3824283,3825283,3826283,3827283,3828283,3829283,3830383,3831383,3832383,3833383,3834383,3835383,3836383,3837383,3838383,3839383,3840483,3841483,3842483,3843483,3844483,3845483,3846483,3847483,3848483,3849483,3850583,3851583,3852583,3853583,3854583,3855583,3856583,3857583,3858583,3859583,3860683,3861683,3862683,3863683,3864683,3865683,3866683,3867683,3868683,3869683,3870783,3871783,3872783,3873783,3874783,3875783,3876783,3877783,3878783,3879783,3880883,3881883,3882883,3883883,3884883,3885883,3886883,3887883,3888883,3889883,3890983,3891983,3892983,3893983,3894983,3895983,3896983,3897983,3898983,3899983,3900093,3901093,3902093,3903093,3904093,3905093,3906093,3907093,3908093,3909093,3910193,3911193,3912193,3913193,3914193,3915193,3916193,3917193,3918193,3919193,3920293,3921293,3922293,3923293,3924293,3925293,3926293,3927293,3928293,3929293,3930393,3931393,3932393,3933393,3934393,3935393,3936393,3937393,3938393,3939393,3940493,3941493,3942493,3943493,3944493,3945493,3946493,3947493,3948493,3949493,3950593,3951593,3952593,3953593,3954593,3955593,3956593,3957593,3958593,3959593,3960693,3961693,3962693,3963693,3964693,3965693,3966693,3967693,3968693,3969693,3970793,3971793,3972793,3973793,3974793,3975793,3976793,3977793,3978793,3979793,3980893,3981893,3982893,3983893,3984893,3985893,3986893,3987893,3988893,3989893,3990993,3991993,3992993,3993993,3994993,3995993,3996993,3997993,3998993,3999993,4000004,4001004,4002004,4003004,4004004,4005004,4006004,4007004,4008004,4009004,4010104,4011104,4012104,4013104,4014104,4015104,4016104,4017104,4018104,4019104,4020204,4021204,4022204,4023204,4024204,4025204,4026204,4027204,4028204,4029204,4030304,4031304,4032304,4033304,4034304,4035304,4036304,4037304,4038304,4039304,4040404,4041404,4042404,4043404,4044404,4045404,4046404,4047404,4048404,4049404,4050504,4051504,4052504,4053504,4054504,4055504,4056504,4057504,4058504,4059504,4060604,4061604,4062604,4063604,4064604,4065604,4066604,4067604,4068604,4069604,4070704,4071704,4072704,4073704,4074704,4075704,4076704,4077704,4078704,4079704,4080804,4081804,4082804,4083804,4084804,4085804,4086804,4087804,4088804,4089804,4090904,4091904,4092904,4093904,4094904,4095904,4096904,4097904,4098904,4099904,4100014,4101014,4102014,4103014,4104014,4105014,4106014,4107014,4108014,4109014,4110114,4111114,4112114,4113114,4114114,4115114,4116114,4117114,4118114,4119114,4120214,4121214,4122214,4123214,4124214,4125214,4126214,4127214,4128214,4129214,4130314,4131314,4132314,4133314,4134314,4135314,4136314,4137314,4138314,4139314,4140414,4141414,4142414,4143414,4144414,4145414,4146414,4147414,4148414,4149414,4150514,4151514,4152514,4153514,4154514,4155514,4156514,4157514,4158514,4159514,4160614,4161614,4162614,4163614,4164614,4165614,4166614,4167614,4168614,4169614,4170714,4171714,4172714,4173714,4174714,4175714,4176714,4177714,4178714,4179714,4180814,4181814,4182814,4183814,4184814,4185814,4186814,4187814,4188814,4189814,4190914,4191914,4192914,4193914,4194914,4195914,4196914,4197914,4198914,4199914,4200024,4201024,4202024,4203024,4204024,4205024,4206024,4207024,4208024,4209024,4210124,4211124,4212124,4213124,4214124,4215124,4216124,4217124,4218124,4219124,4220224,4221224,4222224,4223224,4224224,4225224,4226224,4227224,4228224,4229224,4230324,4231324,4232324,4233324,4234324,4235324,4236324,4237324,4238324,4239324,4240424,4241424,4242424,4243424,4244424,4245424,4246424,4247424,4248424,4249424,4250524,4251524,4252524,4253524,4254524,4255524,4256524,4257524,4258524,4259524,4260624,4261624,4262624,4263624,4264624,4265624,4266624,4267624,4268624,4269624,4270724,4271724,4272724,4273724,4274724,4275724,4276724,4277724,4278724,4279724,4280824,4281824,4282824,4283824,4284824,4285824,4286824,4287824,4288824,4289824,4290924,4291924,4292924,4293924,4294924,4295924,4296924,4297924,4298924,4299924,4300034,4301034,4302034,4303034,4304034,4305034,4306034,4307034,4308034,4309034,4310134,4311134,4312134,4313134,4314134,4315134,4316134,4317134,4318134,4319134,4320234,4321234,4322234,4323234,4324234,4325234,4326234,4327234,4328234,4329234,4330334,4331334,4332334,4333334,4334334,4335334,4336334,4337334,4338334,4339334,4340434,4341434,4342434,4343434,4344434,4345434,4346434,4347434,4348434,4349434,4350534,4351534,4352534,4353534,4354534,4355534,4356534,4357534,4358534,4359534,4360634,4361634,4362634,4363634,4364634,4365634,4366634,4367634,4368634,4369634,4370734,4371734,4372734,4373734,4374734,4375734,4376734,4377734,4378734,4379734,4380834,4381834,4382834,4383834,4384834,4385834,4386834,4387834,4388834,4389834,4390934,4391934,4392934,4393934,4394934,4395934,4396934,4397934,4398934,4399934,4400044,4401044,4402044,4403044,4404044,4405044,4406044,4407044,4408044,4409044,4410144,4411144,4412144,4413144,4414144,4415144,4416144,4417144,4418144,4419144,4420244,4421244,4422244,4423244,4424244,4425244,4426244,4427244,4428244,4429244,4430344,4431344,4432344,4433344,4434344,4435344,4436344,4437344,4438344,4439344,4440444,4441444,4442444,4443444,4444444,4445444,4446444,4447444,4448444,4449444,4450544,4451544,4452544,4453544,4454544,4455544,4456544,4457544,4458544,4459544,4460644,4461644,4462644,4463644,4464644,4465644,4466644,4467644,4468644,4469644,4470744,4471744,4472744,4473744,4474744,4475744,4476744,4477744,4478744,4479744,4480844,4481844,4482844,4483844,4484844,4485844,4486844,4487844,4488844,4489844,4490944,4491944,4492944,4493944,4494944,4495944,4496944,4497944,4498944,4499944,4500054,4501054,4502054,4503054,4504054,4505054,4506054,4507054,4508054,4509054,4510154,4511154,4512154,4513154,4514154,4515154,4516154,4517154,4518154,4519154,4520254,4521254,4522254,4523254,4524254,4525254,4526254,4527254,4528254,4529254,4530354,4531354,4532354,4533354,4534354,4535354,4536354,4537354,4538354,4539354,4540454,4541454,4542454,4543454,4544454,4545454,4546454,4547454,4548454,4549454,4550554,4551554,4552554,4553554,4554554,4555554,4556554,4557554,4558554,4559554,4560654,4561654,4562654,4563654,4564654,4565654,4566654,4567654,4568654,4569654,4570754,4571754,4572754,4573754,4574754,4575754,4576754,4577754,4578754,4579754,4580854,4581854,4582854,4583854,4584854,4585854,4586854,4587854,4588854,4589854,4590954,4591954,4592954,4593954,4594954,4595954,4596954,4597954,4598954,4599954,4600064,4601064,4602064,4603064,4604064,4605064,4606064,4607064,4608064,4609064,4610164,4611164,4612164,4613164,4614164,4615164,4616164,4617164,4618164,4619164,4620264,4621264,4622264,4623264,4624264,4625264,4626264,4627264,4628264,4629264,4630364,4631364,4632364,4633364,4634364,4635364,4636364,4637364,4638364,4639364,4640464,4641464,4642464,4643464,4644464,4645464,4646464,4647464,4648464,4649464,4650564,4651564,4652564,4653564,4654564,4655564,4656564,4657564,4658564,4659564,4660664,4661664,4662664,4663664,4664664,4665664,4666664,4667664,4668664,4669664,4670764,4671764,4672764,4673764,4674764,4675764,4676764,4677764,4678764,4679764,4680864,4681864,4682864,4683864,4684864,4685864,4686864,4687864,4688864,4689864,4690964,4691964,4692964,4693964,4694964,4695964,4696964,4697964,4698964,4699964,4700074,4701074,4702074,4703074,4704074,4705074,4706074,4707074,4708074,4709074,4710174,4711174,4712174,4713174,4714174,4715174,4716174,4717174,4718174,4719174,4720274,4721274,4722274,4723274,4724274,4725274,4726274,4727274,4728274,4729274,4730374,4731374,4732374,4733374,4734374,4735374,4736374,4737374,4738374,4739374,4740474,4741474,4742474,4743474,4744474,4745474,4746474,4747474,4748474,4749474,4750574,4751574,4752574,4753574,4754574,4755574,4756574,4757574,4758574,4759574,4760674,4761674,4762674,4763674,4764674,4765674,4766674,4767674,4768674,4769674,4770774,4771774,4772774,4773774,4774774,4775774,4776774,4777774,4778774,4779774,4780874,4781874,4782874,4783874,4784874,4785874,4786874,4787874,4788874,4789874,4790974,4791974,4792974,4793974,4794974,4795974,4796974,4797974,4798974,4799974,4800084,4801084,4802084,4803084,4804084,4805084,4806084,4807084,4808084,4809084,4810184,4811184,4812184,4813184,4814184,4815184,4816184,4817184,4818184,4819184,4820284,4821284,4822284,4823284,4824284,4825284,4826284,4827284,4828284,4829284,4830384,4831384,4832384,4833384,4834384,4835384,4836384,4837384,4838384,4839384,4840484,4841484,4842484,4843484,4844484,4845484,4846484,4847484,4848484,4849484,4850584,4851584,4852584,4853584,4854584,4855584,4856584,4857584,4858584,4859584,4860684,4861684,4862684,4863684,4864684,4865684,4866684,4867684,4868684,4869684,4870784,4871784,4872784,4873784,4874784,4875784,4876784,4877784,4878784,4879784,4880884,4881884,4882884,4883884,4884884,4885884,4886884,4887884,4888884,4889884,4890984,4891984,4892984,4893984,4894984,4895984,4896984,4897984,4898984,4899984,4900094,4901094,4902094,4903094,4904094,4905094,4906094,4907094,4908094,4909094,4910194,4911194,4912194,4913194,4914194,4915194,4916194,4917194,4918194,4919194,4920294,4921294,4922294,4923294,4924294,4925294,4926294,4927294,4928294,4929294,4930394,4931394,4932394,4933394,4934394,4935394,4936394,4937394,4938394,4939394,4940494,4941494,4942494,4943494,4944494,4945494,4946494,4947494,4948494,4949494,4950594,4951594,4952594,4953594,4954594,4955594,4956594,4957594,4958594,4959594,4960694,4961694,4962694,4963694,4964694,4965694,4966694,4967694,4968694,4969694,4970794,4971794,4972794,4973794,4974794,4975794,4976794,4977794,4978794,4979794,4980894,4981894,4982894,4983894,4984894,4985894,4986894,4987894,4988894,4989894,4990994,4991994,4992994,4993994,4994994,4995994,4996994,4997994,4998994,4999994,5000005,5001005,5002005,5003005,5004005,5005005,5006005,5007005,5008005,5009005,5010105,5011105,5012105,5013105,5014105,5015105,5016105,5017105,5018105,5019105,5020205,5021205,5022205,5023205,5024205,5025205,5026205,5027205,5028205,5029205,5030305,5031305,5032305,5033305,5034305,5035305,5036305,5037305,5038305,5039305,5040405,5041405,5042405,5043405,5044405,5045405,5046405,5047405,5048405,5049405,5050505,5051505,5052505,5053505,5054505,5055505,5056505,5057505,5058505,5059505,5060605,5061605,5062605,5063605,5064605,5065605,5066605,5067605,5068605,5069605,5070705,5071705,5072705,5073705,5074705,5075705,5076705,5077705,5078705,5079705,5080805,5081805,5082805,5083805,5084805,5085805,5086805,5087805,5088805,5089805,5090905,5091905,5092905,5093905,5094905,5095905,5096905,5097905,5098905,5099905,5100015,5101015,5102015,5103015,5104015,5105015,5106015,5107015,5108015,5109015,5110115,5111115,5112115,5113115,5114115,5115115,5116115,5117115,5118115,5119115,5120215,5121215,5122215,5123215,5124215,5125215,5126215,5127215,5128215,5129215,5130315,5131315,5132315,5133315,5134315,5135315,5136315,5137315,5138315,5139315,5140415,5141415,5142415,5143415,5144415,5145415,5146415,5147415,5148415,5149415,5150515,5151515,5152515,5153515,5154515,5155515,5156515,5157515,5158515,5159515,5160615,5161615,5162615,5163615,5164615,5165615,5166615,5167615,5168615,5169615,5170715,5171715,5172715,5173715,5174715,5175715,5176715,5177715,5178715,5179715,5180815,5181815,5182815,5183815,5184815,5185815,5186815,5187815,5188815,5189815,5190915,5191915,5192915,5193915,5194915,5195915,5196915,5197915,5198915,5199915,5200025,5201025,5202025,5203025,5204025,5205025,5206025,5207025,5208025,5209025,5210125,5211125,5212125,5213125,5214125,5215125,5216125,5217125,5218125,5219125,5220225,5221225,5222225,5223225,5224225,5225225,5226225,5227225,5228225,5229225,5230325,5231325,5232325,5233325,5234325,5235325,5236325,5237325,5238325,5239325,5240425,5241425,5242425,5243425,5244425,5245425,5246425,5247425,5248425,5249425,5250525,5251525,5252525,5253525,5254525,5255525,5256525,5257525,5258525,5259525,5260625,5261625,5262625,5263625,5264625,5265625,5266625,5267625,5268625,5269625,5270725,5271725,5272725,5273725,5274725,5275725,5276725,5277725,5278725,5279725,5280825,5281825,5282825,5283825,5284825,5285825,5286825,5287825,5288825,5289825,5290925,5291925,5292925,5293925,5294925,5295925,5296925,5297925,5298925,5299925,5300035,5301035,5302035,5303035,5304035,5305035,5306035,5307035,5308035,5309035,5310135,5311135,5312135,5313135,5314135,5315135,5316135,5317135,5318135,5319135,5320235,5321235,5322235,5323235,5324235,5325235,5326235,5327235,5328235,5329235,5330335,5331335,5332335,5333335,5334335,5335335,5336335,5337335,5338335,5339335,5340435,5341435,5342435,5343435,5344435,5345435,5346435,5347435,5348435,5349435,5350535,5351535,5352535,5353535,5354535,5355535,5356535,5357535,5358535,5359535,5360635,5361635,5362635,5363635,5364635,5365635,5366635,5367635,5368635,5369635,5370735,5371735,5372735,5373735,5374735,5375735,5376735,5377735,5378735,5379735,5380835,5381835,5382835,5383835,5384835,5385835,5386835,5387835,5388835,5389835,5390935,5391935,5392935,5393935,5394935,5395935,5396935,5397935,5398935,5399935,5400045,5401045,5402045,5403045,5404045,5405045,5406045,5407045,5408045,5409045,5410145,5411145,5412145,5413145,5414145,5415145,5416145,5417145,5418145,5419145,5420245,5421245,5422245,5423245,5424245,5425245,5426245,5427245,5428245,5429245,5430345,5431345,5432345,5433345,5434345,5435345,5436345,5437345,5438345,5439345,5440445,5441445,5442445,5443445,5444445,5445445,5446445,5447445,5448445,5449445,5450545,5451545,5452545,5453545,5454545,5455545,5456545,5457545,5458545,5459545,5460645,5461645,5462645,5463645,5464645,5465645,5466645,5467645,5468645,5469645,5470745,5471745,5472745,5473745,5474745,5475745,5476745,5477745,5478745,5479745,5480845,5481845,5482845,5483845,5484845,5485845,5486845,5487845,5488845,5489845,5490945,5491945,5492945,5493945,5494945,5495945,5496945,5497945,5498945,5499945,5500055,5501055,5502055,5503055,5504055,5505055,5506055,5507055,5508055,5509055,5510155,5511155,5512155,5513155,5514155,5515155,5516155,5517155,5518155,5519155,5520255,5521255,5522255,5523255,5524255,5525255,5526255,5527255,5528255,5529255,5530355,5531355,5532355,5533355,5534355,5535355,5536355,5537355,5538355,5539355,5540455,5541455,5542455,5543455,5544455,5545455,5546455,5547455,5548455,5549455,5550555,5551555,5552555,5553555,5554555,5555555,5556555,5557555,5558555,5559555,5560655,5561655,5562655,5563655,5564655,5565655,5566655,5567655,5568655,5569655,5570755,5571755,5572755,5573755,5574755,5575755,5576755,5577755,5578755,5579755,5580855,5581855,5582855,5583855,5584855,5585855,5586855,5587855,5588855,5589855,5590955,5591955,5592955,5593955,5594955,5595955,5596955,5597955,5598955,5599955,5600065,5601065,5602065,5603065,5604065,5605065,5606065,5607065,5608065,5609065,5610165,5611165,5612165,5613165,5614165,5615165,5616165,5617165,5618165,5619165,5620265,5621265,5622265,5623265,5624265,5625265,5626265,5627265,5628265,5629265,5630365,5631365,5632365,5633365,5634365,5635365,5636365,5637365,5638365,5639365,5640465,5641465,5642465,5643465,5644465,5645465,5646465,5647465,5648465,5649465,5650565,5651565,5652565,5653565,5654565,5655565,5656565,5657565,5658565,5659565,5660665,5661665,5662665,5663665,5664665,5665665,5666665,5667665,5668665,5669665,5670765,5671765,5672765,5673765,5674765,5675765,5676765,5677765,5678765,5679765,5680865,5681865,5682865,5683865,5684865,5685865,5686865,5687865,5688865,5689865,5690965,5691965,5692965,5693965,5694965,5695965,5696965,5697965,5698965,5699965,5700075,5701075,5702075,5703075,5704075,5705075,5706075,5707075,5708075,5709075,5710175,5711175,5712175,5713175,5714175,5715175,5716175,5717175,5718175,5719175,5720275,5721275,5722275,5723275,5724275,5725275,5726275,5727275,5728275,5729275,5730375,5731375,5732375,5733375,5734375,5735375,5736375,5737375,5738375,5739375,5740475,5741475,5742475,5743475,5744475,5745475,5746475,5747475,5748475,5749475,5750575,5751575,5752575,5753575,5754575,5755575,5756575,5757575,5758575,5759575,5760675,5761675,5762675,5763675,5764675,5765675,5766675,5767675,5768675,5769675,5770775,5771775,5772775,5773775,5774775,5775775,5776775,5777775,5778775,5779775,5780875,5781875,5782875,5783875,5784875,5785875,5786875,5787875,5788875,5789875,5790975,5791975,5792975,5793975,5794975,5795975,5796975,5797975,5798975,5799975,5800085,5801085,5802085,5803085,5804085,5805085,5806085,5807085,5808085,5809085,5810185,5811185,5812185,5813185,5814185,5815185,5816185,5817185,5818185,5819185,5820285,5821285,5822285,5823285,5824285,5825285,5826285,5827285,5828285,5829285,5830385,5831385,5832385,5833385,5834385,5835385,5836385,5837385,5838385,5839385,5840485,5841485,5842485,5843485,5844485,5845485,5846485,5847485,5848485,5849485,5850585,5851585,5852585,5853585,5854585,5855585,5856585,5857585,5858585,5859585,5860685,5861685,5862685,5863685,5864685,5865685,5866685,5867685,5868685,5869685,5870785,5871785,5872785,5873785,5874785,5875785,5876785,5877785,5878785,5879785,5880885,5881885,5882885,5883885,5884885,5885885,5886885,5887885,5888885,5889885,5890985,5891985,5892985,5893985,5894985,5895985,5896985,5897985,5898985,5899985,5900095,5901095,5902095,5903095,5904095,5905095,5906095,5907095,5908095,5909095,5910195,5911195,5912195,5913195,5914195,5915195,5916195,5917195,5918195,5919195,5920295,5921295,5922295,5923295,5924295,5925295,5926295,5927295,5928295,5929295,5930395,5931395,5932395,5933395,5934395,5935395,5936395,5937395,5938395,5939395,5940495,5941495,5942495,5943495,5944495,5945495,5946495,5947495,5948495,5949495,5950595,5951595,5952595,5953595,5954595,5955595,5956595,5957595,5958595,5959595,5960695,5961695,5962695,5963695,5964695,5965695,5966695,5967695,5968695,5969695,5970795,5971795,5972795,5973795,5974795,5975795,5976795,5977795,5978795,5979795,5980895,5981895,5982895,5983895,5984895,5985895,5986895,5987895,5988895,5989895,5990995,5991995,5992995,5993995,5994995,5995995,5996995,5997995,5998995,5999995,6000006,6001006,6002006,6003006,6004006,6005006,6006006,6007006,6008006,6009006,6010106,6011106,6012106,6013106,6014106,6015106,6016106,6017106,6018106,6019106,6020206,6021206,6022206,6023206,6024206,6025206,6026206,6027206,6028206,6029206,6030306,6031306,6032306,6033306,6034306,6035306,6036306,6037306,6038306,6039306,6040406,6041406,6042406,6043406,6044406,6045406,6046406,6047406,6048406,6049406,6050506,6051506,6052506,6053506,6054506,6055506,6056506,6057506,6058506,6059506,6060606,6061606,6062606,6063606,6064606,6065606,6066606,6067606,6068606,6069606,6070706,6071706,6072706,6073706,6074706,6075706,6076706,6077706,6078706,6079706,6080806,6081806,6082806,6083806,6084806,6085806,6086806,6087806,6088806,6089806,6090906,6091906,6092906,6093906,6094906,6095906,6096906,6097906,6098906,6099906,6100016,6101016,6102016,6103016,6104016,6105016,6106016,6107016,6108016,6109016,6110116,6111116,6112116,6113116,6114116,6115116,6116116,6117116,6118116,6119116,6120216,6121216,6122216,6123216,6124216,6125216,6126216,6127216,6128216,6129216,6130316,6131316,6132316,6133316,6134316,6135316,6136316,6137316,6138316,6139316,6140416,6141416,6142416,6143416,6144416,6145416,6146416,6147416,6148416,6149416,6150516,6151516,6152516,6153516,6154516,6155516,6156516,6157516,6158516,6159516,6160616,6161616,6162616,6163616,6164616,6165616,6166616,6167616,6168616,6169616,6170716,6171716,6172716,6173716,6174716,6175716,6176716,6177716,6178716,6179716,6180816,6181816,6182816,6183816,6184816,6185816,6186816,6187816,6188816,6189816,6190916,6191916,6192916,6193916,6194916,6195916,6196916,6197916,6198916,6199916,6200026,6201026,6202026,6203026,6204026,6205026,6206026,6207026,6208026,6209026,6210126,6211126,6212126,6213126,6214126,6215126,6216126,6217126,6218126,6219126,6220226,6221226,6222226,6223226,6224226,6225226,6226226,6227226,6228226,6229226,6230326,6231326,6232326,6233326,6234326,6235326,6236326,6237326,6238326,6239326,6240426,6241426,6242426,6243426,6244426,6245426,6246426,6247426,6248426,6249426,6250526,6251526,6252526,6253526,6254526,6255526,6256526,6257526,6258526,6259526,6260626,6261626,6262626,6263626,6264626,6265626,6266626,6267626,6268626,6269626,6270726,6271726,6272726,6273726,6274726,6275726,6276726,6277726,6278726,6279726,6280826,6281826,6282826,6283826,6284826,6285826,6286826,6287826,6288826,6289826,6290926,6291926,6292926,6293926,6294926,6295926,6296926,6297926,6298926,6299926,6300036,6301036,6302036,6303036,6304036,6305036,6306036,6307036,6308036,6309036,6310136,6311136,6312136,6313136,6314136,6315136,6316136,6317136,6318136,6319136,6320236,6321236,6322236,6323236,6324236,6325236,6326236,6327236,6328236,6329236,6330336,6331336,6332336,6333336,6334336,6335336,6336336,6337336,6338336,6339336,6340436,6341436,6342436,6343436,6344436,6345436,6346436,6347436,6348436,6349436,6350536,6351536,6352536,6353536,6354536,6355536,6356536,6357536,6358536,6359536,6360636,6361636,6362636,6363636,6364636,6365636,6366636,6367636,6368636,6369636,6370736,6371736,6372736,6373736,6374736,6375736,6376736,6377736,6378736,6379736,6380836,6381836,6382836,6383836,6384836,6385836,6386836,6387836,6388836,6389836,6390936,6391936,6392936,6393936,6394936,6395936,6396936,6397936,6398936,6399936,6400046,6401046,6402046,6403046,6404046,6405046,6406046,6407046,6408046,6409046,6410146,6411146,6412146,6413146,6414146,6415146,6416146,6417146,6418146,6419146,6420246,6421246,6422246,6423246,6424246,6425246,6426246,6427246,6428246,6429246,6430346,6431346,6432346,6433346,6434346,6435346,6436346,6437346,6438346,6439346,6440446,6441446,6442446,6443446,6444446,6445446,6446446,6447446,6448446,6449446,6450546,6451546,6452546,6453546,6454546,6455546,6456546,6457546,6458546,6459546,6460646,6461646,6462646,6463646,6464646,6465646,6466646,6467646,6468646,6469646,6470746,6471746,6472746,6473746,6474746,6475746,6476746,6477746,6478746,6479746,6480846,6481846,6482846,6483846,6484846,6485846,6486846,6487846,6488846,6489846,6490946,6491946,6492946,6493946,6494946,6495946,6496946,6497946,6498946,6499946,6500056,6501056,6502056,6503056,6504056,6505056,6506056,6507056,6508056,6509056,6510156,6511156,6512156,6513156,6514156,6515156,6516156,6517156,6518156,6519156,6520256,6521256,6522256,6523256,6524256,6525256,6526256,6527256,6528256,6529256,6530356,6531356,6532356,6533356,6534356,6535356,6536356,6537356,6538356,6539356,6540456,6541456,6542456,6543456,6544456,6545456,6546456,6547456,6548456,6549456,6550556,6551556,6552556,6553556,6554556,6555556,6556556,6557556,6558556,6559556,6560656,6561656,6562656,6563656,6564656,6565656,6566656,6567656,6568656,6569656,6570756,6571756,6572756,6573756,6574756,6575756,6576756,6577756,6578756,6579756,6580856,6581856,6582856,6583856,6584856,6585856,6586856,6587856,6588856,6589856,6590956,6591956,6592956,6593956,6594956,6595956,6596956,6597956,6598956,6599956,6600066,6601066,6602066,6603066,6604066,6605066,6606066,6607066,6608066,6609066,6610166,6611166,6612166,6613166,6614166,6615166,6616166,6617166,6618166,6619166,6620266,6621266,6622266,6623266,6624266,6625266,6626266,6627266,6628266,6629266,6630366,6631366,6632366,6633366,6634366,6635366,6636366,6637366,6638366,6639366,6640466,6641466,6642466,6643466,6644466,6645466,6646466,6647466,6648466,6649466,6650566,6651566,6652566,6653566,6654566,6655566,6656566,6657566,6658566,6659566,6660666,6661666,6662666,6663666,6664666,6665666,6666666,6667666,6668666,6669666,6670766,6671766,6672766,6673766,6674766,6675766,6676766,6677766,6678766,6679766,6680866,6681866,6682866,6683866,6684866,6685866,6686866,6687866,6688866,6689866,6690966,6691966,6692966,6693966,6694966,6695966,6696966,6697966,6698966,6699966,6700076,6701076,6702076,6703076,6704076,6705076,6706076,6707076,6708076,6709076,6710176,6711176,6712176,6713176,6714176,6715176,6716176,6717176,6718176,6719176,6720276,6721276,6722276,6723276,6724276,6725276,6726276,6727276,6728276,6729276,6730376,6731376,6732376,6733376,6734376,6735376,6736376,6737376,6738376,6739376,6740476,6741476,6742476,6743476,6744476,6745476,6746476,6747476,6748476,6749476,6750576,6751576,6752576,6753576,6754576,6755576,6756576,6757576,6758576,6759576,6760676,6761676,6762676,6763676,6764676,6765676,6766676,6767676,6768676,6769676,6770776,6771776,6772776,6773776,6774776,6775776,6776776,6777776,6778776,6779776,6780876,6781876,6782876,6783876,6784876,6785876,6786876,6787876,6788876,6789876,6790976,6791976,6792976,6793976,6794976,6795976,6796976,6797976,6798976,6799976,6800086,6801086,6802086,6803086,6804086,6805086,6806086,6807086,6808086,6809086,6810186,6811186,6812186,6813186,6814186,6815186,6816186,6817186,6818186,6819186,6820286,6821286,6822286,6823286,6824286,6825286,6826286,6827286,6828286,6829286,6830386,6831386,6832386,6833386,6834386,6835386,6836386,6837386,6838386,6839386,6840486,6841486,6842486,6843486,6844486,6845486,6846486,6847486,6848486,6849486,6850586,6851586,6852586,6853586,6854586,6855586,6856586,6857586,6858586,6859586,6860686,6861686,6862686,6863686,6864686,6865686,6866686,6867686,6868686,6869686,6870786,6871786,6872786,6873786,6874786,6875786,6876786,6877786,6878786,6879786,6880886,6881886,6882886,6883886,6884886,6885886,6886886,6887886,6888886,6889886,6890986,6891986,6892986,6893986,6894986,6895986,6896986,6897986,6898986,6899986,6900096,6901096,6902096,6903096,6904096,6905096,6906096,6907096,6908096,6909096,6910196,6911196,6912196,6913196,6914196,6915196,6916196,6917196,6918196,6919196,6920296,6921296,6922296,6923296,6924296,6925296,6926296,6927296,6928296,6929296,6930396,6931396,6932396,6933396,6934396,6935396,6936396,6937396,6938396,6939396,6940496,6941496,6942496,6943496,6944496,6945496,6946496,6947496,6948496,6949496,6950596,6951596,6952596,6953596,6954596,6955596,6956596,6957596,6958596,6959596,6960696,6961696,6962696,6963696,6964696,6965696,6966696,6967696,6968696,6969696,6970796,6971796,6972796,6973796,6974796,6975796,6976796,6977796,6978796,6979796,6980896,6981896,6982896,6983896,6984896,6985896,6986896,6987896,6988896,6989896,6990996,6991996,6992996,6993996,6994996,6995996,6996996,6997996,6998996,6999996};\n}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "41d2718454f7c14ee6f490ba60b8d086", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n public static void Solve()\n {\n int max = (int)1e7;\n\n var p = new bool[max];\n var r = new bool[max];\n\n \n for (int i = 1; i < max; i++)\n {\n p[i] = true;\n }\n p[1] = false;\n p[2] = true;\n for (int i = 1; i < max; i++)\n {\n if (p[i])\n {\n for (int j = i + i; j < max; j += i)\n {\n p[j] = false;\n }\n }\n }\n\n for (int i = 1; i < 1000; i++)\n {\n int d = i;\n int pal1 = i;\n int pal2 = i * 10 + d % 10;\n d /= 10;\n while (d > 0)\n {\n pal1 = pal1 * 10 + d % 10;\n pal2 = pal2 * 10 + d % 10;\n d /= 10;\n }\n r[pal1] = true;\n r[pal2] = true;\n }\n\n long pk = ReadLong();\n long qk = ReadLong();\n\n long pc = 0;\n long rc = 0;\n int ans = 0;\n for (int i = 1; i < max; i++)\n {\n if (p[i])\n {\n pc++;\n }\n if (r[i])\n {\n rc++;\n }\n\n if (pc * qk <= rc * pk)\n {\n ans = i;\n }\n }\n Writer.Write(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 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c58e8ae25505370de1ea51ff37f61e80", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Cpri\n{\n class Program\n {\n\n\n public static int lmt = 3000000;\n\n public static int check(int num)\n {\n int reverse = 0;\n int temp = num;\n while (num > 0)\n {\n int remainder = num % 10;\n reverse = reverse * 10 + remainder;\n num /= 10;\n }\n if (reverse == temp) return 1;\n else return 0;\n \n }\n static void Main(string[] args)\n {\n int[] pri = new int[lmt];\n for (int i = 2; i < lmt; i++) \n {\n pri[i] = 1;\n }\n for (int i = 2; i < lmt; i++)\n {\n if (pri[i] == 1)\n {\n for (int j = 2 * i; j < lmt; j += i)\n {\n pri[j] = 0;\n }\n }\n\n }\n for (int i = 1; i < lmt; i++) \n {\n pri[i] += pri[i - 1];\n }\n int[] pln = new int[lmt];\n for (int i = 1; i < lmt; i++)\n {\n pln[i] = check(i);\n }\n for (int i = 1; i < lmt; i++)\n {\n pln[i] += pln[i - 1];\n }\n\n\n int[] array = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int p = array[0];\n int q = array[1];\n int n = lmt-1;\n for (n = lmt - 1; n > 0; n--)\n {\n if (pri[n] * q <= pln[n] * p) break;\n }\n Console.WriteLine(n);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aad7d893a74411756b616b96f3644d5a", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {CFF74FAA-1C76-4632-987A-AB7304DC07F5}\n Exe\n Properties\n C.Primes_or_Palindromes\n C.Primes_or_Palindromes\n v4.5\n 512\n \n \n AnyCPU\n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n AnyCPU\n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "56b35359b61bb182d43bb1323559ae6b", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace You_re_a_Professional\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 F = Next();\n int I = Next();\n int T = Next();\n\n var nn = new int[I];\n for (int i = 0; i < F; i++)\n {\n for (int j = 0; j < I; j++)\n {\n nn[j] += Next();\n }\n }\n\n writer.WriteLine(nn.Count(e => e >= T));\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res;\n do\n {\n c = reader.Read();\n if (c == 'Y')\n return 1;\n if (c == 'N')\n return 0;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6f100bcd7fc4d89e35ec67d5dbff7dc8", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Rosetta_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\n private static void Main(string[] args)\n {\n string s = Convert.ToString(Next(), 8);\n writer.WriteLine(s.Count(e => e == '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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec1b00bb241eb601240f9578df9fb71c", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "Mono C#", "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 //16:23\n //reading\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n static string[] ReadArray()\n {\n return ReadLine().Split(' ');\n }\n static List ReadList()\n {\n return ReadArray().ToList();\n }\n static List ReadIntList()\n {\n return ReadArray().Select(c => Convert.ToInt32(c)).ToList();\n }\n static List ReadLongList()\n {\n return ReadArray().Select(c => Convert.ToInt64(c)).ToList();\n }\n static List ReadULongList()\n {\n return ReadArray().Select(c => Convert.ToUInt64(c)).ToList();\n }\n static int ToInt(string str)\n {\n return Convert.ToInt32(str);\n }\n static long ToInt64(string str)\n {\n return Convert.ToInt64(str);\n }\n static ulong ToUInt64(string str)\n {\n return Convert.ToUInt64(str);\n }\n\n\n static void Main(string[] args)\n {\n string str = Convert.ToString(ToInt(ReadLine()), 8);\n int count = 0;\n for (int i = 0; i < str.Length; i++)\n if (str[i] == '1')\n count++;\n Console.WriteLine(count);\n /*\n watch.Stop();\n var elapsedMs = watch.ElapsedMilliseconds;\n Console.WriteLine(elapsedMs);*/\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2806a9c26e6dd554c48038d06e3b2a5e", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Rosetta_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\n private static void Main(string[] args)\n {\n string s = Convert.ToString(Next(), 8);\n long t = long.Parse(s);\n writer.WriteLine(t%100);\n writer.Flush();\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5774d1918578838ceff421d15f93e9ea", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "MS C#", "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 if (n == 0)\n ans++;\n while (n > 0)\n {\n if (n % 8 == 0)\n ans++;\n n /= 8;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fd733dbcc2224a30216e2d10ac3da40a", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "Mono C#", "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 //16:23\n //reading\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n static string[] ReadArray()\n {\n return ReadLine().Split(' ');\n }\n static List ReadList()\n {\n return ReadArray().ToList();\n }\n static List ReadIntList()\n {\n return ReadArray().Select(c => Convert.ToInt32(c)).ToList();\n }\n static List ReadLongList()\n {\n return ReadArray().Select(c => Convert.ToInt64(c)).ToList();\n }\n static List ReadULongList()\n {\n return ReadArray().Select(c => Convert.ToUInt64(c)).ToList();\n }\n static int ToInt(string str)\n {\n return Convert.ToInt32(str);\n }\n static long ToInt64(string str)\n {\n return Convert.ToInt64(str);\n }\n static ulong ToUInt64(string str)\n {\n return Convert.ToUInt64(str);\n }\n\n\n static void Main(string[] args)\n {\n string str = ReadLine();\n int count = 0;\n for (int i = 0; i < str.Length; i++)\n if (str[i] == '1')\n count++;\n Console.WriteLine(count);\n /*\n watch.Stop();\n var elapsedMs = watch.ElapsedMilliseconds;\n Console.WriteLine(elapsedMs);*/\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "61b6dd875337417dd9428dcfe4b6cdec", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Rosetta_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\n private static void Main(string[] args)\n {\n string s = Convert.ToString(Next(), 8);\n writer.WriteLine(s.Substring(s.Length - 1));\n writer.Flush();\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "73019dd436943b39df2bbbdc3b3e9102", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "Mono C#", "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 //16:23\n //reading\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n static string[] ReadArray()\n {\n return ReadLine().Split(' ');\n }\n static List ReadList()\n {\n return ReadArray().ToList();\n }\n static List ReadIntList()\n {\n return ReadArray().Select(c => Convert.ToInt32(c)).ToList();\n }\n static List ReadLongList()\n {\n return ReadArray().Select(c => Convert.ToInt64(c)).ToList();\n }\n static List ReadULongList()\n {\n return ReadArray().Select(c => Convert.ToUInt64(c)).ToList();\n }\n static int ToInt(string str)\n {\n return Convert.ToInt32(str);\n }\n static long ToInt64(string str)\n {\n return Convert.ToInt64(str);\n }\n static ulong ToUInt64(string str)\n {\n return Convert.ToUInt64(str);\n }\n\n\n static void Main(string[] args)\n {\n string input = ReadLine();\n Console.WriteLine(input[0]);\n /*\n watch.Stop();\n var elapsedMs = watch.ElapsedMilliseconds;\n Console.WriteLine(elapsedMs);*/\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "108aa6ebd34deebe053a6cbb5fb99841", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "MS C#", "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 Write(n % 8);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0f1b86a277e4a21dc4c1b3233125f4dd", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Rosetta_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 \n\n private static void Main(string[] args)\n {\n writer.WriteLine(Next()%8);\n writer.Flush();\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f5f9bf47aeddd34cefdc70ebfc06edac", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "Mono C#", "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 //16:23\n //reading\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n static string[] ReadArray()\n {\n return ReadLine().Split(' ');\n }\n static List ReadList()\n {\n return ReadArray().ToList();\n }\n static List ReadIntList()\n {\n return ReadArray().Select(c => Convert.ToInt32(c)).ToList();\n }\n static List ReadLongList()\n {\n return ReadArray().Select(c => Convert.ToInt64(c)).ToList();\n }\n static List ReadULongList()\n {\n return ReadArray().Select(c => Convert.ToUInt64(c)).ToList();\n }\n static int ToInt(string str)\n {\n return Convert.ToInt32(str);\n }\n static long ToInt64(string str)\n {\n return Convert.ToInt64(str);\n }\n static ulong ToUInt64(string str)\n {\n return Convert.ToUInt64(str);\n }\n\n\n static void Main(string[] args)\n {\n string input = ReadLine();\n Console.WriteLine(input[1] - input[0]);\n /*\n watch.Stop();\n var elapsedMs = watch.ElapsedMilliseconds;\n Console.WriteLine(elapsedMs);*/\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8d61fbc1b270f744eaebc0eaa4051caf", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.IO;\r\nusing System.Text;\r\n\r\nnamespace Kavi_on_Pairing_Duty\r\n{\r\n internal class Program\r\n {\r\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\r\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\r\n\r\n private static void Main(string[] args)\r\n {\r\n const int mod = 998244353;\r\n\r\n int n = Next();\r\n\r\n var p = new int[n + 1];\r\n var s = new long[n + 1];\r\n s[1] = 1;\r\n long sum = 2;\r\n\r\n for (int i = 2; i < p.Length; i++)\r\n {\r\n for (int j = i + i; j < p.Length; j += i)\r\n {\r\n p[j]++;\r\n }\r\n\r\n s[i] = (1 + sum + p[i])%mod;\r\n sum += s[i];\r\n sum %= mod;\r\n }\r\n writer.WriteLine(s[n]);\r\n writer.Flush();\r\n }\r\n\r\n private static int Next()\r\n {\r\n int c;\r\n int res = 0;\r\n do\r\n {\r\n c = reader.Read();\r\n if (c == -1)\r\n return res;\r\n } while (c < '0' || c > '9');\r\n res = c - '0';\r\n while (true)\r\n {\r\n c = reader.Read();\r\n if (c < '0' || c > '9')\r\n return res;\r\n res *= 10;\r\n res += c - '0';\r\n }\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9fcace48129fd510bfa5d34db73f0ad8", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\r\nusing System.IO;\r\nusing System.Text;\r\n\r\nnamespace Kavi_on_Pairing_Duty\r\n{\r\n internal class Program\r\n {\r\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\r\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\r\n\r\n private static void Main(string[] args)\r\n {\r\n const int mod = 998244353;\r\n\r\n int n = Next();\r\n\r\n var p = new int[n + 1];\r\n var s = new long[n + 1];\r\n s[1] = 1;\r\n long sum = 2;\r\n\r\n for (int i = 2; i < p.Length; i++)\r\n {\r\n for (int j = i + i; j < p.Length; j += i)\r\n {\r\n p[j]++;\r\n }\r\n\r\n s[i] = (1 + sum + p[i])%mod;\r\n sum += s[i];\r\n sum %= mod;\r\n }\r\n writer.WriteLine(s[n]);\r\n writer.Flush();\r\n }\r\n\r\n private static int Next()\r\n {\r\n int c;\r\n int res = 0;\r\n do\r\n {\r\n c = reader.Read();\r\n if (c == -1)\r\n return res;\r\n } while (c < '0' || c > '9');\r\n res = c - '0';\r\n while (true)\r\n {\r\n c = reader.Read();\r\n if (c < '0' || c > '9')\r\n return res;\r\n res *= 10;\r\n res += c - '0';\r\n }\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e960ff52b3840de9454439b44fbaeb9", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.IO;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Numerics;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Text;\r\nusing System.Globalization;\r\nusing System.Threading;\r\n\r\nusing static System.Math;\r\n\r\nnamespace FertiLib.Contest.B\r\n{\r\n\tpublic class Solver\r\n\t{\r\n\t\tScanner sr;\r\n\t\tStreamWriter sw;\r\n\r\n\t\tbool isMultipleTestCases = false;\r\n\r\n\t\tpublic void Solve()\r\n\t\t{\r\n\t\t\tvar n = sr.ReadInt();\r\n\t\t\tvar devisor = Enumerable.Range(0, n + 1).ToArray();\r\n\t\t\tfor (int i = 2; i * i <= n; i++)\r\n\t\t\t{\r\n\t\t\t\tif (devisor[i] != i) continue;\r\n\t\t\t\tvar t = i * 2;\r\n\t\t\t\twhile (t <= n)\r\n\t\t\t\t{\r\n\t\t\t\t\tdevisor[t] = i;\r\n\t\t\t\t\tt += i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar dp = new ModInt[n + 1];\r\n\t\t\tdp[1] = 1;\r\n\t\t\tModInt dpsum = 1;\r\n\t\t\tfor (int i = 2; i <= n; i++)\r\n\t\t\t{\r\n\t\t\t\tdp[i] = 1;\r\n\t\t\t\tvar factors = new Dictionary();\r\n\t\t\t\tvar cur = i;\r\n\t\t\t\twhile (cur > 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (!factors.ContainsKey(devisor[cur])) factors.Add(devisor[cur], 0);\r\n\t\t\t\t\tfactors[devisor[cur]]++;\r\n\t\t\t\t\tcur /= devisor[cur];\r\n\t\t\t\t}\r\n\t\t\t\tforeach (var (key, value) in factors)\r\n\t\t\t\t{\r\n\t\t\t\t\tdp[i] *= value + 1;\r\n\t\t\t\t}\r\n\t\t\t\tdp[i] += dpsum;\r\n\t\t\t\tdpsum += dp[i];\r\n\t\t\t}\r\n\t\t\tConsole.WriteLine(dp[n]);\r\n\t\t}\r\n\r\n\t\tpublic Solver(Scanner cin, StreamWriter cout)\r\n\t\t{\r\n\t\t\tthis.sr = cin;\r\n\t\t\tthis.sw = cout;\r\n\t\t}\r\n\r\n\t\tpublic void Start()\r\n\t\t{\r\n\t\t\tint _t = 1;\r\n\t\t\tif (isMultipleTestCases) _t = sr.ReadInt();\r\n\t\t\twhile (_t-- > 0) Solve();\r\n\t\t}\r\n\r\n\t\tpublic static void YESNO(bool condition) => Console.WriteLine(condition ? \"YES\" : \"NO\");\r\n\t\tpublic static void YesNo(bool condition) => Console.WriteLine(condition ? \"Yes\" : \"No\");\r\n\t\tpublic static void yesno(bool condition) => Console.WriteLine(condition ? \"yes\" : \"no\");\r\n\r\n\t\tpublic static T SignOutput(int x, T pos, T zero, T neg) => x == 0 ? zero : (x > 0 ? pos : neg);\r\n\r\n\t\tpublic static T[] CreateArray(int n, Func func) => Enumerable.Range(0, n).Select(p => func(p)).ToArray();\r\n\t\tpublic static T[][] CreateArray(int h, int w, Func func) => Enumerable.Range(0, h).Select(i => Enumerable.Range(0, w).Select(j => func(i, j)).ToArray()).ToArray();\r\n\t}\r\n\r\n\tpublic struct ModInt : IEquatable\r\n\t{\r\n\t\tpublic static long MOD = 998244353;\r\n\t\tpublic static bool isModPrime { get; set; }\r\n\r\n\t\tprivate readonly long num;\r\n\r\n\t\tpublic ModInt(long n) { num = n; isModPrime = true; }\r\n\r\n\t\tpublic override string ToString() => num.ToString();\r\n\r\n\t\tpublic static ModInt operator +(ModInt l, ModInt r)\r\n\t\t{\r\n\t\t\tlong x = l.num + r.num;\r\n\t\t\tif (x >= MOD) x -= MOD;\r\n\t\t\treturn new ModInt(x);\r\n\t\t}\r\n\t\tpublic static ModInt operator -(ModInt l, ModInt r)\r\n\t\t{\r\n\t\t\tlong x = l.num - r.num;\r\n\t\t\tif (x < 0) x += MOD;\r\n\t\t\treturn new ModInt(x);\r\n\t\t}\r\n\t\tpublic static ModInt operator *(ModInt l, ModInt r) => new ModInt((l.num * r.num) % MOD);\r\n\t\tpublic static ModInt operator /(ModInt l, ModInt r) => l * r.Inverse();\r\n\r\n\t\tpublic static ModInt operator ++(ModInt x)\r\n\t\t{\r\n\t\t\tvar tmp = x + new ModInt(1);\r\n\t\t\treturn tmp;\r\n\t\t}\r\n\t\tpublic static ModInt operator --(ModInt x)\r\n\t\t{\r\n\t\t\tvar tmp = x - new ModInt(1);\r\n\t\t\treturn tmp;\r\n\t\t}\r\n\r\n\t\tpublic static bool operator ==(ModInt l, ModInt r) => l.Equals(r);\r\n\t\tpublic static bool operator !=(ModInt l, ModInt r) => !l.Equals(r);\r\n\r\n\t\tpublic static implicit operator long(ModInt x) => x.num;\r\n\t\tpublic static implicit operator ModInt(long n)\r\n\t\t{\r\n\t\t\tn %= MOD;\r\n\t\t\tif (n < 0) n += MOD;\r\n\t\t\treturn new ModInt(n);\r\n\t\t}\r\n\r\n\t\tpublic ModInt Inverse() => Inverse(this, MOD);\r\n\t\tpublic static ModInt Inverse(ModInt x) => Inverse(x.num, MOD);\r\n\t\tpublic static long Inverse(long x, long m)\r\n\t\t{\r\n\t\t\tif (x % m == 0) throw new DivideByZeroException();\r\n\t\t\tlong a = x, b = m, u = 1, v = 0;\r\n\t\t\twhile (b > 0)\r\n\t\t\t{\r\n\t\t\t\tlong t = a / b;\r\n\r\n\t\t\t\ta -= t * b;\r\n\t\t\t\tlong p = a; a = b; b = p; // swap(a, b);\r\n\r\n\t\t\t\tu -= t * v;\r\n\t\t\t\tp = u; u = v; v = p; // swap(u, v);\r\n\t\t\t}\r\n\t\t\tu %= m;\r\n\t\t\tif (u < 0) u += m;\r\n\t\t\treturn u;\r\n\t\t}\r\n\r\n\t\tpublic ModInt Pow(long n) => Pow(this, n);\r\n\r\n\t\tpublic static ModInt Pow(long x, long n)\r\n\t\t{\r\n\t\t\tif (n < 0) return Pow(x, -n).Inverse();\r\n\t\t\tx %= MOD;\r\n\t\t\tlong now = 1;\r\n\t\t\tif (isModPrime) n %= MOD - 1;\r\n\t\t\tfor (; n > 0; n /= 2, x = x * x % MOD)\r\n\t\t\t{\r\n\t\t\t\tif (n % 2 == 1) now = now * x % MOD;\r\n\t\t\t}\r\n\t\t\treturn new ModInt(now);\r\n\t\t}\r\n\r\n\t\tpublic bool Equals(ModInt x) => num == x.num;\r\n\r\n\t\tpublic override bool Equals(object obj) => obj is ModInt m && num == m.num;\r\n\r\n\t\tpublic override int GetHashCode()\r\n\t\t{\r\n\t\t\treturn HashCode.Combine(num);\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tpublic static class Program\r\n\t{\r\n\t\tpublic static void Main(string[] args)\r\n\t\t{\r\n\t\t\tvar sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\r\n\t\t\tConsole.SetOut(sw);\r\n\t\t\tvar cin = new Scanner();\r\n\t\t\tvar solver = new Solver(cin, sw);\r\n\t\t\tsolver.Start();\r\n\t\t\tConsole.Out.Flush();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static class Extention\r\n\t{\r\n\t\tpublic static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\r\n\r\n\t\tpublic static int UpperBound(this IList list, T value) => list.BinarySearch(value, true, 0, list.Count, Comparer.Default);\r\n\t\tpublic static int LowerBound(this IList list, T value) => list.BinarySearch(value, false, 0, list.Count, Comparer.Default);\r\n\t\tpublic static int BinarySearch(this IList list, T value, bool isUpperBound, int index, int length, Comparer comparer)\r\n\t\t{\r\n\t\t\tvar ng = index - 1;\r\n\t\t\tvar ok = index + length;\r\n\t\t\twhile (ok - ng > 1)\r\n\t\t\t{\r\n\t\t\t\tvar mid = ng + (ok - ng) / 2;\r\n\t\t\t\tvar res = comparer.Compare(list[mid], value);\r\n\t\t\t\tif (res < 0 || (isUpperBound && res == 0)) ng = mid;\r\n\t\t\t\telse ok = mid;\r\n\t\t\t}\r\n\t\t\treturn ok;\r\n\t\t}\r\n\r\n\t\tpublic static bool Chmax(ref this T a, T b) where T : struct, IComparable\r\n\t\t{\r\n\t\t\tif (a.CompareTo(b) >= 0) return false;\r\n\t\t\ta = b;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tpublic static bool Chmin(ref this T a, T b) where T : struct, IComparable\r\n\t\t{\r\n\t\t\tif (a.CompareTo(b) <= 0) return false;\r\n\t\t\ta = b;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic class Scanner\r\n\t{\r\n\t\tstring[] s;\r\n\t\tint i;\r\n\r\n\t\tchar[] separator = new char[] { ' ' };\r\n\r\n\t\tpublic Scanner()\r\n\t\t{\r\n\t\t\ts = new string[0];\r\n\t\t\ti = 0;\r\n\t\t}\r\n\r\n\t\tpublic string Read() => ReadString();\r\n\r\n\t\tpublic string ReadString()\r\n\t\t{\r\n\t\t\tif (i < s.Length) return s[i++];\r\n\t\t\tstring st = Console.ReadLine();\r\n\t\t\twhile (st == \"\") st = Console.ReadLine();\r\n\t\t\ts = st.Split(separator, StringSplitOptions.RemoveEmptyEntries);\r\n\t\t\tif (s.Length == 0) return ReadString();\r\n\t\t\ti = 0;\r\n\t\t\treturn s[i++];\r\n\t\t}\r\n\r\n\t\tpublic string[] ReadStringArray(int N)\r\n\t\t{\r\n\t\t\tstring[] Array = new string[N];\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tArray[i] = ReadString();\r\n\t\t\t}\r\n\t\t\treturn Array;\r\n\t\t}\r\n\r\n\t\tpublic int ReadInt() => int.Parse(ReadString());\r\n\r\n\t\tpublic int[] ReadIntArray(int N, int add = 0)\r\n\t\t{\r\n\t\t\tint[] Array = new int[N];\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tArray[i] = ReadInt() + add;\r\n\t\t\t}\r\n\t\t\treturn Array;\r\n\t\t}\r\n\r\n\t\tpublic long ReadLong() => long.Parse(ReadString());\r\n\r\n\t\tpublic long[] ReadLongArray(int N, long add = 0)\r\n\t\t{\r\n\t\t\tlong[] Array = new long[N];\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tArray[i] = ReadLong() + add;\r\n\t\t\t}\r\n\t\t\treturn Array;\r\n\t\t}\r\n\r\n\t\tpublic double ReadDouble() => double.Parse(ReadString());\r\n\r\n\t\tpublic double[] ReadDoubleArray(int N, double add = 0)\r\n\t\t{\r\n\t\t\tdouble[] Array = new double[N];\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tArray[i] = ReadDouble() + add;\r\n\t\t\t}\r\n\t\t\treturn Array;\r\n\t\t}\r\n\r\n\t\tpublic T1 ReadValue() => (T1)Convert.ChangeType(ReadString(), typeof(T1));\r\n\r\n\t\tpublic (T1, T2) ReadValue()\r\n\t\t{\r\n\t\t\tvar inputs = ReadStringArray(2);\r\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\r\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\r\n\t\t\treturn (v1, v2);\r\n\t\t}\r\n\r\n\t\tpublic (T1, T2, T3) ReadValue()\r\n\t\t{\r\n\t\t\tvar inputs = ReadStringArray(3);\r\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\r\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\r\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\r\n\t\t\treturn (v1, v2, v3);\r\n\t\t}\r\n\r\n\t\tpublic (T1, T2, T3, T4) ReadValue()\r\n\t\t{\r\n\t\t\tvar inputs = ReadStringArray(4);\r\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\r\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\r\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\r\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\r\n\t\t\treturn (v1, v2, v3, v4);\r\n\t\t}\r\n\r\n\t\tpublic (T1, T2, T3, T4, T5) ReadValue()\r\n\t\t{\r\n\t\t\tvar inputs = ReadStringArray(5);\r\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\r\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\r\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\r\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\r\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\r\n\t\t\treturn (v1, v2, v3, v4, v5);\r\n\t\t}\r\n\r\n\t\tpublic (T1, T2, T3, T4, T5, T6) ReadValue()\r\n\t\t{\r\n\t\t\tvar inputs = ReadStringArray(6);\r\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\r\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\r\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\r\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\r\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\r\n\t\t\tvar v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\r\n\t\t\treturn (v1, v2, v3, v4, v5, v6);\r\n\t\t}\r\n\r\n\t\tpublic (T1, T2, T3, T4, T5, T6, T7) ReadValue()\r\n\t\t{\r\n\t\t\tvar inputs = ReadStringArray(7);\r\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\r\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\r\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\r\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\r\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\r\n\t\t\tvar v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\r\n\t\t\tvar v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));\r\n\t\t\treturn (v1, v2, v3, v4, v5, v6, v7);\r\n\t\t}\r\n\r\n\t\tpublic T1[] ReadValueArray(int N)\r\n\t\t{\r\n\t\t\tvar v1 = new T1[N];\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tv1[i] = ReadValue();\r\n\t\t\t}\r\n\t\t\treturn v1;\r\n\t\t}\r\n\r\n\t\tpublic (T1[], T2[]) ReadValueArray(int N)\r\n\t\t{\r\n\t\t\tvar (v1, v2) = (new T1[N], new T2[N]);\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tvar (t1, t2) = ReadValue();\r\n\t\t\t\tv1[i] = t1;\r\n\t\t\t\tv2[i] = t2;\r\n\t\t\t}\r\n\t\t\treturn (v1, v2);\r\n\t\t}\r\n\r\n\t\tpublic (T1[], T2[], T3[]) ReadValueArray(int N)\r\n\t\t{\r\n\t\t\tvar (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]);\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tvar (t1, t2, t3) = ReadValue();\r\n\t\t\t\tv1[i] = t1;\r\n\t\t\t\tv2[i] = t2;\r\n\t\t\t\tv3[i] = t3;\r\n\t\t\t}\r\n\t\t\treturn (v1, v2, v3);\r\n\t\t}\r\n\r\n\t\tpublic (T1[], T2[], T3[], T4[]) ReadValueArray(int N)\r\n\t\t{\r\n\t\t\tvar (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]);\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tvar (t1, t2, t3, t4) = ReadValue();\r\n\t\t\t\tv1[i] = t1;\r\n\t\t\t\tv2[i] = t2;\r\n\t\t\t\tv3[i] = t3;\r\n\t\t\t\tv4[i] = t4;\r\n\t\t\t}\r\n\t\t\treturn (v1, v2, v3, v4);\r\n\t\t}\r\n\r\n\t\tpublic (T1[], T2[], T3[], T4[], T5[]) ReadValueArray(int N)\r\n\t\t{\r\n\t\t\tvar (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]);\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tvar (t1, t2, t3, t4, t5) = ReadValue();\r\n\t\t\t\tv1[i] = t1;\r\n\t\t\t\tv2[i] = t2;\r\n\t\t\t\tv3[i] = t3;\r\n\t\t\t\tv4[i] = t4;\r\n\t\t\t\tv5[i] = t5;\r\n\t\t\t}\r\n\t\t\treturn (v1, v2, v3, v4, v5);\r\n\t\t}\r\n\r\n\t\tpublic (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray(int N)\r\n\t\t{\r\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]);\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tvar (t1, t2, t3, t4, t5, t6) = ReadValue();\r\n\t\t\t\tv1[i] = t1;\r\n\t\t\t\tv2[i] = t2;\r\n\t\t\t\tv3[i] = t3;\r\n\t\t\t\tv4[i] = t4;\r\n\t\t\t\tv5[i] = t5;\r\n\t\t\t\tv6[i] = t6;\r\n\t\t\t}\r\n\t\t\treturn (v1, v2, v3, v4, v5, v6);\r\n\t\t}\r\n\r\n\t\tpublic (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray(int N)\r\n\t\t{\r\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]);\r\n\t\t\tfor (int i = 0; i < N; i++)\r\n\t\t\t{\r\n\t\t\t\tvar (t1, t2, t3, t4, t5, t6, t7) = ReadValue();\r\n\t\t\t\tv1[i] = t1;\r\n\t\t\t\tv2[i] = t2;\r\n\t\t\t\tv3[i] = t3;\r\n\t\t\t\tv4[i] = t4;\r\n\t\t\t\tv5[i] = t5;\r\n\t\t\t\tv6[i] = t6;\r\n\t\t\t\tv7[i] = t7;\r\n\t\t\t}\r\n\t\t\treturn (v1, v2, v3, v4, v5, v6, v7);\r\n\t\t}\r\n\t}\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "00debf43d4ec8ffb55202556a4349015", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.IO;\r\nusing System.Threading;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing System.Diagnostics;\r\nusing static util;\r\nusing P = pair;\r\n\r\nclass Program {\r\n static void Main(string[] args) {\r\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\r\n var solver = new Solver(sw);\r\n // var t = new Thread(solver.solve, 1 << 28); // 256 MB\r\n // t.Start();\r\n // t.Join();\r\n solver.solve();\r\n sw.Flush();\r\n }\r\n}\r\n\r\nclass Solver {\r\n StreamWriter sw;\r\n Scan sc;\r\n void Prt(string a) => sw.WriteLine(a);\r\n void Prt(IEnumerable a) => Prt(string.Join(\" \", a));\r\n void Prt(params object[] a) => Prt(string.Join(\" \", a));\r\n public Solver(StreamWriter sw) {\r\n this.sw = sw;\r\n this.sc = new Scan();\r\n }\r\n\r\n public void solve() {\r\n int n = sc.Int;\r\n var dp = new long[n + 1];\r\n dp[0] = 1;\r\n long sum = 1;\r\n for (int i = 1; i <= n; i++)\r\n {\r\n for (int j = i * 2; j <= n; j += i)\r\n {\r\n ++dp[j];\r\n }\r\n dp[i] = (dp[i] + sum) % M;\r\n sum = (sum + dp[i]) % M;\r\n }\r\n Prt(dp[n]);\r\n\r\n }\r\n}\r\n\r\nclass pair : IComparable> {\r\n public T v1;\r\n public U v2;\r\n public pair() : this(default(T), default(U)) {}\r\n public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; }\r\n public int CompareTo(pair a) {\r\n int c = Comparer.Default.Compare(v1, a.v1);\r\n return c != 0 ? c : Comparer.Default.Compare(v2, a.v2);\r\n }\r\n public override string ToString() => $\"{v1} {v2}\";\r\n public void Deconstruct(out T a, out U b) { a = v1; b = v2; }\r\n}\r\nstatic class util {\r\n // public static readonly int M = 1000000007;\r\n public static readonly int M = 998244353;\r\n public static readonly long LM = 1L << 60;\r\n public static readonly double eps = 1e-11;\r\n public static void DBG(string a) => Console.Error.WriteLine(a);\r\n public static void DBG(IEnumerable a) => DBG(string.Join(\" \", a));\r\n public static void DBG(params object[] a) => DBG(string.Join(\" \", a));\r\n public static void Assert(params bool[] conds) {\r\n if (conds.Any(x => !x)) throw new Exception();\r\n }\r\n public static pair make_pair(T v1, U v2) => new pair(v1, v2);\r\n public static int CompareList(IList a, IList b) where T : IComparable {\r\n for (int i = 0; i < a.Count && i < b.Count; i++)\r\n if (a[i].CompareTo(b[i]) != 0) return a[i].CompareTo(b[i]);\r\n return a.Count.CompareTo(b.Count);\r\n }\r\n public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;\r\n public static readonly int[] dd = { 0, 1, 0, -1 };\r\n // static readonly string dstring = \"RDLU\";\r\n public static IEnumerable

    adjacents(int i, int j) {\r\n for (int k = 0; k < 4; k++) yield return new P(i + dd[k], j + dd[k ^ 1]);\r\n }\r\n public static IEnumerable

    adjacents(int i, int j, int h, int w) {\r\n for (int k = 0; k < 4; k++) if (inside(i + dd[k], j + dd[k ^ 1], h, w))\r\n yield return new P(i + dd[k], j + dd[k ^ 1]);\r\n }\r\n public static IEnumerable

    adjacents(this P p) => adjacents(p.v1, p.v2);\r\n public static IEnumerable

    adjacents(this P p, int h, int w) => adjacents(p.v1, p.v2, h, w);\r\n public static IEnumerable all_subset(this int p) {\r\n for (int i = 0; ; i = i - p & p) {\r\n yield return i;\r\n if (i == p) break;\r\n }\r\n }\r\n public static Dictionary compress(this IEnumerable a)\r\n => a.Distinct().OrderBy(v => v).Select((v, i) => new { v, i }).ToDictionary(p => p.v, p => p.i);\r\n public static Dictionary compress(params IEnumerable[] a)\r\n => compress(a.SelectMany(x => x));\r\n public static T[] inv(this Dictionary dic) {\r\n var res = new T[dic.Count];\r\n foreach (var item in dic) res[item.Value] = item.Key;\r\n return res;\r\n }\r\n public static void swap(ref T a, ref T b) where T : struct { var t = a; a = b; b = t; }\r\n public static void swap(this IList a, int i, int j) where T : struct {\r\n var t = a[i]; a[i] = a[j]; a[j] = t;\r\n }\r\n public static T[] copy(this IList a) {\r\n var ret = new T[a.Count];\r\n for (int i = 0; i < a.Count; i++) ret[i] = a[i];\r\n return ret;\r\n }\r\n}\r\n\r\nclass Scan {\r\n StreamReader sr;\r\n public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }\r\n public Scan(string path) { sr = new StreamReader(path); }\r\n public int Int => int.Parse(Str);\r\n public long Long => long.Parse(Str);\r\n public double Double => double.Parse(Str);\r\n public string Str => ReadLine.Trim();\r\n public string ReadLine => sr.ReadLine();\r\n public pair Pair() {\r\n T a; U b;\r\n Multi(out a, out b);\r\n return new pair(a, b);\r\n }\r\n public P P => Pair();\r\n public int[] IntArr => StrArr.Select(int.Parse).ToArray();\r\n public long[] LongArr => StrArr.Select(long.Parse).ToArray();\r\n public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();\r\n public string[] StrArr => Str.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);\r\n bool eq() => typeof(T).Equals(typeof(U));\r\n T ct(U a) => (T)Convert.ChangeType(a, typeof(T));\r\n T cv(string s) => eq() ? ct(int.Parse(s))\r\n : eq() ? ct(long.Parse(s))\r\n : eq() ? ct(double.Parse(s))\r\n : eq() ? ct(s[0])\r\n : ct(s);\r\n public void Multi(out T a) => a = cv(Str);\r\n public void Multi(out T a, out U b) {\r\n var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]);\r\n }\r\n public void Multi(out T a, out U b, out V c) {\r\n var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]);\r\n }\r\n public void Multi(out T a, out U b, out V c, out W d) {\r\n var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]);\r\n }\r\n public void Multi(out T a, out U b, out V c, out W d, out X e) {\r\n var ar = StrArr;\r\n a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]); e = cv(ar[4]);\r\n }\r\n public void Multi(out T a, out U b, out V c, out W d, out X e, out Y f) {\r\n var ar = StrArr;\r\n a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]);\r\n d = cv(ar[3]); e = cv(ar[4]); f = cv(ar[5]);\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dae035880e801e9bae077234acb019e0", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing static System.Math;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Globalization;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\nusing Library;\r\n\r\nnamespace Program\r\n{\r\n public static class ProblemB\r\n {\r\n static bool SAIKI = false;\r\n static public int numberOfRandomCases = 0;\r\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\r\n {\r\n }\r\n static public void Solve()\r\n {\r\n var n = NN;\r\n const int mod = 998244353;\r\n var dp = new long[n * 2 + 1];\r\n for (var i = 2; i <= 2 * n; ++i)\r\n {\r\n var len = i * 2 - 2;\r\n for (var j = len; j <= 2 * n; j += len)\r\n {\r\n ++dp[j];\r\n }\r\n }\r\n var ruiseki = 0L;\r\n for (var i = 2; i <= 2 * n; i += 2)\r\n {\r\n dp[i] += ruiseki;\r\n dp[i] %= mod;\r\n ruiseki = (ruiseki + dp[i]) % mod;\r\n }\r\n\r\n Console.WriteLine(dp[n * 2] % mod);\r\n }\r\n class Printer : StreamWriter\r\n {\r\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\r\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\r\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\r\n }\r\n static LIB_FastIO fastio = new LIB_FastIODebug();\r\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(); }\r\n static long NN => fastio.Long();\r\n static double ND => fastio.Double();\r\n static string NS => fastio.Scan();\r\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\r\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\r\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\r\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\r\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\r\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\r\n static IEnumerator _xsi = _xsc();\r\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; } }\r\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; }\r\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; }\r\n static void Fill(this T[] array, T value) => array.AsSpan().Fill(value);\r\n static void Fill(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);\r\n static void Fill(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);\r\n static void Fill(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);\r\n }\r\n}\r\nnamespace Library {\r\n class LIB_FastIO\r\n {\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\r\n readonly Stream str;\r\n readonly byte[] buf = new byte[2048];\r\n int len, ptr;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n byte read()\r\n {\r\n if (ptr >= len)\r\n {\r\n ptr = 0;\r\n if ((len = str.Read(buf, 0, 2048)) <= 0)\r\n {\r\n return 0;\r\n }\r\n }\r\n return buf[ptr++];\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n char Char()\r\n {\r\n byte b = 0;\r\n do b = read();\r\n while (b < 33 || 126 < b);\r\n return (char)b;\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public string Scan()\r\n {\r\n var sb = new StringBuilder();\r\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\r\n sb.Append(b);\r\n return sb.ToString();\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public long Long()\r\n {\r\n long ret = 0; byte b = 0; var ng = false;\r\n do b = read();\r\n while (b != '-' && (b < '0' || '9' < b));\r\n if (b == '-') { ng = true; b = read(); }\r\n for (; true; b = read())\r\n {\r\n if (b < '0' || '9' < b)\r\n return ng ? -ret : ret;\r\n else ret = (ret << 3) + (ret << 1) + b - '0';\r\n }\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\r\n }\r\n class LIB_FastIODebug : LIB_FastIO\r\n {\r\n Queue param = new Queue();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_FastIODebug() { }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override string Scan() => NextString();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override long Long() => long.Parse(NextString());\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override double Double() => double.Parse(NextString());\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d5c22c5c87f7e82f086a9db379a29c35", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeff\ufeff\ufeff\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.CompilerServices;\r\n\r\nnamespace Task\r\n{\r\n static class Program\r\n {\r\n #region Read / Write\r\n static TextReader Reader;\r\n static TextWriter Writer;\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\r\n public static bool NextPermutation(List perm)\r\n {\r\n for (int i = perm.Count - 2; i >= 0; i--)\r\n {\r\n if (perm[i] < perm[i + 1])\r\n {\r\n int min = i + 1;\r\n for (int j = min; j < perm.Count; j++)\r\n if (perm[j] > perm[i] && perm[j] < perm[min])\r\n min = j;\r\n\r\n var tmp = perm[i];\r\n perm[i] = perm[min];\r\n perm[min] = tmp;\r\n perm.Reverse(i + 1, perm.Count - i - 1);\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n #region SegmentTree\r\n\r\n public static long SegmentTreeFunc(long a, long b)\r\n {\r\n return a + b;\r\n }\r\n\r\n public static void BuildSegmentTree(long[] a, long v, long tl, long tr)\r\n {\r\n if (tl == tr)\r\n t[v] = a[tl];\r\n else\r\n {\r\n long tm = (tl + tr) / 2;\r\n BuildSegmentTree(a, v * 2, tl, tm);\r\n BuildSegmentTree(a, v * 2 + 1, tm + 1, tr);\r\n t[v] = SegmentTreeFunc(t[v * 2], t[v * 2 + 1]);\r\n }\r\n }\r\n\r\n public static long QuerySegmentTree(long v, long tl, long tr, long l, long r)\r\n {\r\n if (l > r)\r\n return 0;\r\n if (l == tl && r == tr)\r\n return t[v];\r\n\r\n var tm = (tl + tr) / 2;\r\n var res = SegmentTreeFunc(QuerySegmentTree(v * 2, tl, tm, l, Math.Min(r, tm)), QuerySegmentTree(v * 2 + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\r\n return res;\r\n }\r\n \r\n public static void UpdateSegmentTree(int v, int tl, int tr, int pos, int new_val)\r\n {\r\n if (tl == tr)\r\n t[v] = new_val;\r\n else\r\n {\r\n int tm = (tl + tr) / 2;\r\n if (pos <= tm)\r\n UpdateSegmentTree(v * 2, tl, tm, pos, new_val);\r\n else\r\n UpdateSegmentTree(v * 2 + 1, tm + 1, tr, pos, new_val);\r\n t[v] = SegmentTreeFunc(t[v * 2], t[v * 2 + 1]);\r\n }\r\n }\r\n\r\n public static long[] t;\r\n\r\n #endregion\r\n\r\n private static readonly int modulus = 1000000007;\r\n // private static readonly int modulus1 = modulus - 1;\r\n\r\n \r\n public static long Pow(long a, long b)\r\n {\r\n long y = 1;\r\n\r\n while (true)\r\n {\r\n if ((b & 1) != 0)\r\n y = a * y % modulus;\r\n b = b >> 1;\r\n if (b == 0)\r\n return y;\r\n a = a * a % modulus;\r\n }\r\n }\r\n \r\n public static long ReversedNumbByPrimeModulo(long a)\r\n {\r\n return Pow(a, modulus - 2);\r\n }\r\n\r\n public static long FactByModulo(long a)\r\n {\r\n long ans = 1;\r\n\r\n while (a > 0)\r\n {\r\n ans = ans * a % modulus;\r\n a--;\r\n }\r\n\r\n return ans;\r\n }\r\n\r\n public static long nCkModulo(long n, long k)\r\n {\r\n if (k < n >> 1)\r\n k = n - k;\r\n\r\n long ans = 1;\r\n for (long i = n; i > k; i--)\r\n ans = ans * i % modulus;\r\n\r\n k = n - k;\r\n var fact = FactByModulo(k);\r\n var revFact = ReversedNumbByPrimeModulo(fact);\r\n\r\n ans = ans * revFact % modulus;\r\n\r\n return ans;\r\n }\r\n\r\n public static int maxForPrimeCalc = 1000000;\r\n public static List primes = new List(maxForPrimeCalc) {2};\r\n // public static int[] minPrimeDiv = new int[maxForPrimeCalc + 1];\r\n public static bool[] isPrime = new bool[maxForPrimeCalc + 1];\r\n \r\n public static void CalcPrimes()\r\n {\r\n isPrime[2] = true;\r\n for (var i = 4; i <= maxForPrimeCalc; i += 2)\r\n {\r\n isPrime[i] = false;\r\n // minPrimeDiv[i] = 2;\r\n }\r\n for (var i = 3; i <= maxForPrimeCalc; i += 2)\r\n {\r\n isPrime[i] = true;\r\n }\r\n \r\n for (var i = 3; i * i <= maxForPrimeCalc; i += 2)\r\n {\r\n if (isPrime[i])\r\n {\r\n // minPrimeDiv[i] = i;\r\n primes.Add(i);\r\n for (var j = i * i; j <= maxForPrimeCalc; j += i)\r\n {\r\n if (isPrime[j])\r\n {\r\n isPrime[j] = false;\r\n // minPrimeDiv[j] = i;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n //\r\n // public static int[] PrimeDifferentDividersCountHash = new int[maxForPrimeCalc + 1];\r\n //\r\n // private static int PrimeDifferentDividersCount(long numb)\r\n // {\r\n // if (numb == 1)\r\n // return 0;\r\n // if (isPrime[numb])\r\n // return 1;\r\n // \r\n // if (PrimeDifferentDividersCountHash[numb] > 0)\r\n // return PrimeDifferentDividersCountHash[numb];\r\n // \r\n // var divider = minPrimeDiv[numb];\r\n // var prevNumb = numb / divider;\r\n // var ans = PrimeDifferentDividersCount(prevNumb);\r\n //\r\n // if (divider != minPrimeDiv[prevNumb])\r\n // {\r\n // ans += 1;\r\n // }\r\n //\r\n // PrimeDifferentDividersCountHash[numb] = ans;\r\n //\r\n // return ans;\r\n // }\r\n\r\n // #region Heap\r\n //\r\n // public static void InsertElementInHeap(MyStruct value, MyStruct[] arr, ref int sizeOfTree)\r\n // { \r\n // sizeOfTree++;\r\n // arr[sizeOfTree] = value;\r\n // HeapifyUp(sizeOfTree, arr); \r\n // }\r\n //\r\n // public static void HeapifyUp(int cur, MyStruct[] arr)\r\n // {\r\n // while (true)\r\n // {\r\n // if (cur == 1)\r\n // {\r\n // return;\r\n // }\r\n //\r\n // var parent = cur >> 1;\r\n //\r\n // if (arr[cur].Value < arr[parent].Value)\r\n // {\r\n // arr[cur].Value ^= arr[parent].Value;\r\n // arr[parent].Value ^= arr[cur].Value;\r\n // arr[cur].Value ^= arr[parent].Value;\r\n // \r\n // // arr[cur].Index ^= arr[parent].Index;\r\n // // arr[parent].Index ^= arr[cur].Index;\r\n // // arr[cur].Index ^= arr[parent].Index;\r\n //\r\n // cur = parent;\r\n // continue;\r\n // }\r\n //\r\n // break;\r\n // }\r\n // }\r\n //\r\n // public static MyStruct ExtractHeadOfHeap(MyStruct[] arr, ref int sizeOfTree)\r\n // {\r\n // var extractedValue = arr[1]; \r\n // arr[1] = arr[sizeOfTree]; \r\n // sizeOfTree--; \r\n // HeapifyDown(1, sizeOfTree, arr); \r\n // return extractedValue;\r\n // }\r\n //\r\n // public static void HeapifyDown(int cur, int sizeOfTree, MyStruct[] arr)\r\n // {\r\n // while (true)\r\n // {\r\n // var left = cur << 1;\r\n // var right = left + 1;\r\n // int smallestChild;\r\n //\r\n // if (sizeOfTree < left)\r\n // {\r\n // return;\r\n // }\r\n //\r\n // if (sizeOfTree == left || arr[left].Value < arr[right].Value)\r\n // smallestChild = left;\r\n // else\r\n // smallestChild = right;\r\n //\r\n // if (arr[cur].Value > arr[smallestChild].Value)\r\n // {\r\n // arr[cur].Value ^= arr[smallestChild].Value;\r\n // arr[smallestChild].Value ^= arr[cur].Value;\r\n // arr[cur].Value ^= arr[smallestChild].Value;\r\n // \r\n // // arr[cur].Index ^= arr[smallestChild].Index;\r\n // // arr[smallestChild].Index ^= arr[cur].Index;\r\n // // arr[cur].Index ^= arr[smallestChild].Index;\r\n //\r\n // cur = smallestChild;\r\n // continue;\r\n // }\r\n //\r\n // break;\r\n // }\r\n // }\r\n //\r\n // #endregion\r\n \r\n #region Sorted Set\r\n \r\n public class LowerBoundSortedSet : SortedSet\r\n {\r\n private ComparerDecorator _comparerDecorator;\r\n private class ComparerDecorator : IComparer\r\n {\r\n private IComparer _comparer;\r\n public T LowerBound { get; private set; }\r\n public T HigherBound { get; private set; }\r\n private bool _reset = true;\r\n public void Reset()\r\n {\r\n _reset = true;\r\n }\r\n public ComparerDecorator(IComparer comparer)\r\n {\r\n _comparer = comparer;\r\n }\r\n public int Compare(T x, T y)\r\n {\r\n int num = _comparer.Compare(x, y);\r\n if (_reset)\r\n {\r\n LowerBound = y;\r\n }\r\n if (num >= 0)\r\n {\r\n LowerBound = y;\r\n _reset = false;\r\n }\r\n if (num <= 0)\r\n {\r\n HigherBound = y;\r\n _reset = false;\r\n }\r\n return num;\r\n }\r\n }\r\n public LowerBoundSortedSet()\r\n : this(Comparer.Default) {}\r\n public LowerBoundSortedSet(IComparer comparer)\r\n : base(new ComparerDecorator(comparer))\r\n {\r\n _comparerDecorator = (ComparerDecorator) Comparer;\r\n }\r\n public T FindLowerBound(T key)\r\n {\r\n _comparerDecorator.Reset();\r\n this.Contains(key);\r\n return _comparerDecorator.LowerBound;\r\n }\r\n public T FindHigherBound(T key)\r\n {\r\n _comparerDecorator.Reset();\r\n this.Contains(key);\r\n return _comparerDecorator.HigherBound;\r\n }\r\n }\r\n \r\n #endregion\r\n\r\n static long GCD(long a, long b)\r\n {\r\n while (b > 0) {\r\n a %= b;\r\n a ^= b;\r\n b ^= a;\r\n a ^= b;\r\n }\r\n return a;\r\n }\r\n\r\n // private static List[] _divs = new List[100000 + 1];\r\n\r\n // private static void CalcDivs()\r\n // {\r\n // for (var i = 0; i < _divs.Length; i++)\r\n // _divs[i] = new List();\r\n // \r\n // for (var i = 1; i < _divs.Length; i++)\r\n // {\r\n // for (var j = i; j < _divs.Length; j += i)\r\n // _divs[j].Add(i);\r\n // }\r\n // }\r\n\r\n static void Main(string[] args)\r\n {\r\n Reader = new StreamReader(Console.OpenStandardInput());\r\n Writer = new StreamWriter(Console.OpenStandardOutput());\r\n\r\n // CalcPrimes();\r\n // CalcDivs();\r\n\r\n // var t = ReadInt();\r\n // for (var tmp = 0; tmp < t; tmp++)\r\n {\r\n Solve();\r\n }\r\n \r\n Reader.Close();\r\n Writer.Close();\r\n }\r\n\r\n static void Solve()\r\n {\r\n var n = ReadInt();\r\n\r\n var mod = 998244353L;\r\n var dp = new long[n + 1];\r\n dp[0] = 1;\r\n dp[1] = 1;\r\n var sum = 2L;\r\n for (var i = 2; i <= n; i++)\r\n {\r\n dp[i] = sum;\r\n dp[i] %= mod;\r\n\r\n var tmp = 0L;\r\n for (var j = 2; j <= i; j++)\r\n if (i % j == 0)\r\n {\r\n dp[i] += 1;\r\n dp[i] %= mod;\r\n }\r\n\r\n dp[i] += tmp;\r\n sum += dp[i];\r\n sum %= mod;\r\n }\r\n \r\n Write(dp[n]);\r\n }\r\n\r\n private static int RevertInd(int[] chainNumb, int ind, int[] inChainNumb, int permCount, List> chains, out int oldInd)\r\n {\r\n var cn = chainNumb[ind];\r\n var inC = inChainNumb[ind];\r\n\r\n oldInd = inC - permCount % chains[cn].Count;\r\n if (oldInd < 0)\r\n oldInd += chains[cn].Count;\r\n return cn;\r\n }\r\n\r\n public struct MyStruct\r\n {\r\n public char Dir;\r\n public int X;\r\n public int Index;\r\n\r\n public MyStruct(char dir, int x, int index)\r\n {\r\n Dir = dir;\r\n X = x;\r\n Index = index;\r\n }\r\n }\r\n\r\n private static int gcdex (int a, int b, out int x, out int y) {\r\n if (a == 0) {\r\n x = 0; y = 1;\r\n return b;\r\n }\r\n int x1, y1;\r\n int d = gcdex (b%a, a, out x1, out y1);\r\n x = y1 - (b / a) * x1;\r\n y = x1;\r\n return d;\r\n }\r\n\r\n private static long GetNumb(Dictionary letterDic, List permutation, string s)\r\n {\r\n long res = 0;\r\n long mult = 1;\r\n for (var i = s.Length - 1; i >= 0; i--)\r\n {\r\n res += permutation[letterDic[s[i]]] * mult;\r\n\r\n mult *= 10;\r\n }\r\n\r\n return res;\r\n }\r\n\r\n static void Inc(this Dictionary dict, long key, long addedValue)\r\n {\r\n if (dict.ContainsKey(key))\r\n dict[key] += addedValue;\r\n else\r\n dict[key] = addedValue;\r\n }\r\n\r\n static void Inc(this Dictionary dict, int key, int addedValue)\r\n {\r\n if (dict.ContainsKey(key))\r\n dict[key] += addedValue;\r\n else\r\n dict[key] = addedValue;\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c9fcc816842676993b3f4a02efcbc913", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Runtime.Intrinsics.Arm;\r\nusing CompLib.Mathematics;\r\nusing CompLib.Util;\r\n\r\npublic class Program\r\n{\r\n int N;\r\n public void Solve()\r\n {\r\n\r\n var sc = new Scanner();\r\n\r\n int N = sc.NextInt();\r\n int[] cntDiv = new int[N + 1];\r\n for (int i = 1; i <= N; i++)\r\n {\r\n for (int j = i; j <= N; j += i)\r\n {\r\n cntDiv[j]++;\r\n }\r\n }\r\n\r\n ModInt ans = 0;\r\n for (int i = 1; i < N; i++)\r\n {\r\n ans += ModInt.Pow(2, i - 1) * cntDiv[N - i];\r\n }\r\n ans += cntDiv[N];\r\n\r\n Console.WriteLine(ans);\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.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\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "013b33d9e6367097d65fbd8312412863", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\t\tstring[] str = Console.ReadLine().Split();\n\t\t\tint N = int.Parse(str[0]);\n\t\t\tint M = int.Parse(str[1]);\n\t\t\tint R = int.Parse(str[2]);\n\t\t\tint a1 = 999999999;\n\t\t\tstring[] str2 = Console.ReadLine().Split();\n\t\t\tfor(var i=0;i=a2){\n\t\t\t\tans = R;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8b1841fc2aee8d59e3b9ed7876e61ac", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp27\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int[] N = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int[] M = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int[] E = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n Array.Sort(M);\n Array.Sort(E);\n int count = 0;\n if (M[0] < E[E.Length - 1])\n {\n count = N[2] / M[0];\n int add = N[2] % M[0];\n count = count * E[E.Length - 1] + add;\n\n }\n else {\n count = N[2];\n }\n Console.WriteLine(count);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "339e6a290b27e1384b1014e758044bad", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\t\tstring[] str = Console.ReadLine().Split();\n\t\t\tint N = int.Parse(str[0]);\n\t\t\tint M = int.Parse(str[1]);\n\t\t\tint R = int.Parse(str[2]);\n\t\t\tint a1 = 999999999;\n\t\t\tstring[] str2 = Console.ReadLine().Split();\n\t\t\tfor(var i=0;i=a2){\n\t\t\t\tans = R;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "27c7c7aac2c6c7ed367748548cdc681d", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "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 m = sc.NextInt();\n int r = sc.NextInt();\n\n int[] s = sc.IntArray();\n int[] b = sc.IntArray();\n\n int sMin = s.Min();\n\n int bMax = b.Max();\n\n int ans = r;\n if (sMin < bMax)\n {\n int d = ans / sMin;\n ans %= sMin;\n ans += d * bMax;\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cab33f70100317d843f59992d238b55b", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"3 4 11\n4 2 5\n4 4 5 4\"\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 m = cin.NextInt();\n var r = cin.NextInt();\n var S = cin.IntArray().OrderBy(s => s).ToArray();\n var B = cin.IntArray();\n\n var sellPrice = B.Max();\n\n var cnt = 0;\n for (var i = 0; i < S.Length; i++) {\n if (r >= S[i] && S[i] < sellPrice) {\n var c = r / S[i];\n cnt += c;\n r -= S[i] * c;\n }\n }\n\n// System.Console.WriteLine(new {sellPrice, cnt, r});\n\n System.Console.WriteLine(r + cnt * sellPrice);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d42774a31a043efdcb27df3f63e54cc2", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace Contests {\n public class CF556_A {\n public static void Main() {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var r = input[2];\n var min = Console.ReadLine().Split().Select(int.Parse).Min();\n var k = r / min;\n var moneyLeft = r - k * min;\n var max = Console.ReadLine().Split().Select(int.Parse).Max();\n moneyLeft += max * k;\n Console.WriteLine(Math.Max(moneyLeft, r));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "03f654de154f9b588cacb14ffde12d01", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF556\n{\n class Program\n {\n static void Main(string[] args)\n {\n int buy_count = 0;\n int sell_count = 0;\n int starting_balance = 0;\n\n var first_line = Console.ReadLine();\n var parts = first_line.Split(' ');\n\n buy_count = int.Parse(parts[0]);\n sell_count = int.Parse(parts[1]);\n starting_balance = int.Parse(parts[2]);\n\n var buy_offers = Console.ReadLine().Split(' ').Select(t => int.Parse(t));\n var sell_offers = Console.ReadLine().Split(' ').Select(t => int.Parse(t));\n\n var cheapest_buy = buy_offers.Min();\n var best_sell = sell_offers.Max();\n\n var bought = (int)Math.Floor((double)starting_balance / (double)cheapest_buy);\n\n if (cheapest_buy > best_sell)\n bought = 0;\n\n var leftover = starting_balance - (bought * cheapest_buy);\n\n var sold = bought * best_sell;\n\n Console.WriteLine(sold + leftover);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0cf9c4709026795678dd362b46a4af4c", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "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 var inp = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n int n = inp[0], m = inp[1], r = inp[2];\n var s = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n var b = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n Array.Sort( s );\n Array.Sort( b, (x, y) => y - x );\n\n //--------------------------------solve--------------------------------/\n\n int max = r;\n int now = (r / s[0] )* b[0];\n r = r % s[0] + now;\n max = Math.Max( r, max );\n Console.WriteLine( max);\n\n }\n\n\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ffc4e19fcaee84f6895213e99d5bc34", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u041a\u0430\u0441\u0441\u0438\u0440\n{\n\n class Program\n {\n\n public static long min(long a, long b)\n {\n if (a < b)\n return a;\n return b;\n }\n public struct student\n {\n public long a;\n public long b;\n }\n public static long degree(long a)\n {\n long degree = 1;\n while (a-- != 0)\n {\n degree *= 2;\n }\n return degree - 1;\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 r = int.Parse(str[2]);\n int min = int.MaxValue;\n str = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n if (int.Parse(str[i]) max)\n {\n max = int.Parse(str[i]);\n }\n\n }\n int difference = max - min;\n if(difference<0)\n Console.WriteLine(r);\n else\n {\n int count = r / min;\n Console.WriteLine(r-(r/min)*min+count* max);\n }\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2821621b21343cdaa86ba2d866e528ae", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "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;\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 nmr = Input.ar;\n var ss = Input.ar;\n var bs = Input.ar;\n if (ss.Min() > bs.Max())\n {\n WriteLine(nmr[2]);\n return;\n }\n else\n {\n WriteLine(nmr[2] % ss.Min() + nmr[2] / ss.Min() * bs.Max());\n }\n }\n}\n\npublic class Input\n{\n public static string read => ReadLine();\n public static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);\n public static int num => ToInt32(read);\n public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);\n public static long numL => ToInt64(read);\n public static char[][] gred(int h) \n => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();\n public static int[][] ar2D(int num)\n => Enumerable.Repeat(0, num).Select(v => ar).ToArray();\n public static long[][] arL2D(int num)\n => Enumerable.Repeat(0, num).Select(v => arL).ToArray();\n public static T getValue(string g)\n {\n var t = typeof(T);\n if (t == typeof(string))\n return (T)(object)g;\n if (t == typeof(int))\n return (T)(object)int.Parse(g);\n if (t == typeof(bool))\n return (T)(object)bool.Parse(g);\n if (t == typeof(long))\n return (T)(object)long.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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4d56a59f6898e9e465c5e7b2f8f56c43", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar Koll = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tvar Buy = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tvar Sell = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tint minB = Buy[0];\n\t\tint maxS = Sell[0];\n\t\tfor ( int i = 0; i < Koll[0]; i++ )\n\t\t\tif ( minB > Buy[i] ) minB = Buy[i];\n\t\tfor ( int i = 0; i < Koll[1]; i++ )\n\t\t\tif ( maxS < Sell[i] ) maxS = Sell[i];\n\t\tint akcBuy = Koll[2] / minB;\n\t\tint ostatok = Koll[2] - (akcBuy * minB);\n\t\tint dengi = akcBuy * maxS + ostatok;\n\t\tif ( minB >= maxS ) Console.WriteLine(Koll[2]);\n\t\telse Console.WriteLine(dengi);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cf5ccc084dffddf26b2fab611a52641b", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Stock_Arbitraging\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 m = Next();\n int r = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n var mm = new int[m];\n for (int i = 0; i < m; i++)\n {\n mm[i] = Next();\n }\n\n int t = nn.Min();\n int c = r/t;\n\n return Math.Max(r, c*mm.Max() + r%t);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f161e7883927658d4c55352ecac447bb", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace FirstProject\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string[] i1 = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(i1[0]);\n int m = Convert.ToInt32(i1[1]);\n int r = Convert.ToInt32(i1[2]);\n int[] s = new int[n];\n string[] i2 = Console.ReadLine().Split(' ');\n int mx = 0, mn = (int)1e9;\n for(int i=0;i 30)\n return -1;\n byte m;\n if (!Byte.TryParse (words[1], out m))\n return -1;\n if (m < 1 || m > 30)\n return -1;\n ushort r;\n if (!UInt16.TryParse (words[2], out r))\n return -1;\n if (r < 1 || r > 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 != n)\n return -1;\n ushort sMin = 1000;\n for (byte i = 0; i < n; i++)\n {\n ushort si;\n if (!UInt16.TryParse (words[i], out si))\n return -1;\n if (si < 1 || si > 1000)\n return -1;\n if (si < sMin)\n sMin = si;\n }\n ushort numShare = Convert.ToUInt16 (r/sMin);\n ushort sumBuy = Convert.ToUInt16 (numShare*sMin);\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != m)\n return -1;\n ushort bMax = 1;\n for (byte i = 0; i < m; i++)\n {\n ushort bi;\n if (!UInt16.TryParse (words[i], out bi))\n return -1;\n if (bi < 1 || bi > 1000)\n return -1;\n if (bi > bMax)\n bMax = bi;\n }\n uint sumSell = Convert.ToUInt32 (numShare*bMax);\n uint ans = (sumSell > sumBuy ? r+sumSell-sumBuy : r);\n Console.WriteLine (ans);\n return 0;\n }\n }\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "023d21fad56a67e1f612c37f13dc5a72", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "/* Date: 06.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\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.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tclass Pair : IComparable\n\t{\n\t\tpublic int fi, se;\n\t\tpublic Pair ()\n\t\t{\n\t\t\tfi = 0; se = 0;\n\t\t}\n\t\tpublic Pair (int pfi, int pse)\n\t\t{\n\t\t\tfi = pfi; se = pse;\n\t\t}\n\t\tpublic Pair (Pair p)\n\t\t{\n\t\t\tfi = p.fi; se = p.se;\n\t\t}\n\t\tpublic static bool operator < (Pair p1, Pair p2)\n\t\t{\n\t\t\treturn p1.fi < p2.fi || p1.fi == p2.fi && p1.se < p2.se;\n\t\t}\n\t\tpublic static bool operator > (Pair p1, Pair p2)\n\t\t{\n\t\t\treturn p1.fi > p2.fi || p1.fi == p2.fi && p1.se > p2.se;\n\t\t}\n\t\tpublic int CompareTo (object p2)\n\t\t{\n\t\t\tif ( this < (p2 as Pair) )\n\t\t\t\treturn -1;\n\t\t\tif ( this > (p2 as Pair) )\n\t\t\t\treturn 1;\n\t\t\treturn 0;\n\t\t}\n\t}\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\\\\038\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\038\\\\OUTPUT.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tstring s;\n\t\tint n, m, k;\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\t{\n\t\t\tstring [] ss = s.Split (' ');\n\t\t\tn = int.Parse (ss [0]);\n\t\t\tm = int.Parse (ss [1]);\n\t\t\tk = int.Parse (ss [2]);\n\t\t}\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 [] a = new int [n];\n\t\tint mi = 999999999;\n\t\t{\n\t\t\tstring [] ss = s.Split (' ');\n\t\t\tfor ( int i=0; i < n; i++ )\n\t\t\t{\n\t\t\t\ta [i] = int.Parse (ss [i]);\n\t\t\t\tif ( a [i] < mi )\n\t\t\t\t\tmi = a [i];\n\t\t\t}\n\t\t}\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 [] b = new int [m];\n\t\tint ma = 0;\n\t\t{\n\t\t\tstring [] ss = s.Split (' ');\n\t\t\tfor ( int i=0; i < m; i++ )\n\t\t\t{\n\t\t\t\tb [i] = int.Parse (ss [i]);\n\t\t\t\tif ( b [i] > ma )\n\t\t\t\t\tma = b [i];\n\t\t\t}\n\t\t}\n\t\n# if ( ! ONLINE_JUDGE )\n\t\tsw.WriteLine (\"*** mi = \" + mi);\n\t\tsw.WriteLine (\"*** ma = \" + ma);\n# endif\n\n\t\tint kk = k + (k / mi) * (ma - mi);\n\t\tif ( k > kk )\n\t\t\tkk = k;\n\t\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (kk);\n# else\n\t\tsw.WriteLine (kk);\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbb3ad3fc1587d50f177818cb715ab76", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "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 void Main(string[] args)\n {\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToInt64);\n var n = arr[0];\n var m = arr[1];\n var r = arr[2];\n\n var s = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToInt64);\n var b = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToInt64);\n\n var mp = s.Min();\n var maxp = b.Max();\n if (mp >= maxp)\n {\n Console.WriteLine(r);\n }\n else\n {\n Console.WriteLine((r/mp) * maxp +(r%mp));\n }\n\n }\n\n}\n\n\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "98096b8ab8d85473be7387a09b148ad6", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "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, m, r;\n\n int buy;\n int sell;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n m = ioHelper.ReadNextInt();\n r = ioHelper.ReadNextInt();\n\n buy = int.MaxValue;\n\n int i;\n\n for(i=0;i sell)\n sell = s;\n }\n\n int qty = r / buy;\n\n int result = r - qty * buy;\n\n result += qty*Math.Max(buy, sell);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "468b7e2cdeff679a504b6ae91f4f9f2e", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\n\n// \npublic class A\n{\n private static void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n int r = ReadInt();\n\n int[] s = ReadIntArray();\n int[] b = ReadIntArray();\n\n int profit = (r / s.Min()) * b.Max() + r % s.Min();\n\n if (profit > r)\n Write(profit);\n else\n Write(r);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a04495225caf3a252c9dec77b8793e2e", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Math;\n\nnamespace CSharp\n{\n static class Program\n {\n static void Main(string[] args)\n {\n int n, m, r;\n ReadInt(out n, out m, out r);\n int[] S = ReadIntArray();\n int[] B = ReadIntArray();\n\n if (S.Min() < B.Max())\n {\n int count = r / S.Min();\n r -= S.Min() * count;\n r += B.Max() * count;\n }\n\n Console.WriteLine(r);\n }\n\n #region Helpers\n\n static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();\n\n static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();\n static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();\n\n static string ReadString() => Console.ReadLine();\n static int ReadInt() => int.Parse(Console.ReadLine());\n static long ReadLong() => long.Parse(Console.ReadLine());\n\n static void ReadInt(out int first)\n {\n var array = ReadIntArray();\n first = array[0];\n }\n\n static void ReadInt(out int first, out int second)\n {\n var array = ReadIntArray();\n first = array[0];\n second = array[1];\n }\n\n static void ReadInt(out int first, out int second, out int third)\n {\n var array = ReadIntArray();\n first = array[0];\n second = array[1];\n third = array[2];\n }\n\n static void ReadInt(out int first, out int second, out int third, out int fourth)\n {\n var array = ReadIntArray();\n first = array[0];\n second = array[1];\n third = array[2];\n fourth = array[3];\n }\n\n static void ReadLong(out long first)\n {\n var array = ReadLongArray();\n first = array[0];\n }\n\n static void ReadLong(out long first, out long second)\n {\n var array = ReadLongArray();\n first = array[0];\n second = array[1];\n }\n\n static void ReadLong(out long first, out long second, out long third)\n {\n var array = ReadLongArray();\n first = array[0];\n second = array[1];\n third = array[2];\n }\n\n static void ReadLong(out long first, out long second, out long third, out long fourth)\n {\n var array = ReadLongArray();\n first = array[0];\n second = array[1];\n third = array[2];\n fourth = array[3];\n }\n\n #endregion\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "38ebe4965a51cd94c920b3d85d947692", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "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 var n = NextLong();\n var m = NextLong();\n var r = NextLong();\n var b = ReadLongs();\n var s = ReadLongs();\n long res = 0;\n\n var cnt = r / b.Min();\n var nr = r - cnt * b.Min();\n\n nr += cnt * s.Max();\n res = nr;\n res = res > r ? res : r;\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c4fc7b13b2f643a4c40e2af948a6de69", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "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 n=int.Parse(y[0]);\n int m=int.Parse(y[1]);\n int r=int.Parse(y[2]);\n string[]y1=Console.ReadLine().Split(' ');\n string[]y2=Console.ReadLine().Split(' ');\n int[]a=new int[n];\n int []b=new int[m];\n for(int i=0;i min)\n {\n max = int.Parse(str[i]);\n }\n\n }\n int difference = max - min;\n if(difference<0)\n Console.WriteLine(r);\n else\n {\n int count = r / min;\n Console.WriteLine(r-(r/min)*min+count* max);\n }\n }\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5ef930d62bf061a9c28ca378a708ad64", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "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, m, r;\n\n int buy;\n int sell;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n m = ioHelper.ReadNextInt();\n r = ioHelper.ReadNextInt();\n\n buy = int.MaxValue;\n\n int i;\n\n for(i=0;i sell)\n sell = s;\n }\n\n int qty = r / buy;\n\n int result = r - qty * buy;\n\n result += qty*Math.Max(buy, sell);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cc4f6df28e915e8ac2b59a97a6efc758", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "// Problem: 1150A - Stock Arbitraging\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass StockArbitraging\n {\n public 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 != 3)\n return -1;\n byte n;\n if (!Byte.TryParse (words[0], out n))\n return -1;\n if (n < 1 || n > 30)\n return -1;\n byte m;\n if (!Byte.TryParse (words[1], out m))\n return -1;\n if (m < 1 || m > 30)\n return -1;\n ushort r;\n if (!UInt16.TryParse (words[2], out r))\n return -1;\n if (r < 1 || r > 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 != n)\n return -1;\n ushort sMin = 1000;\n for (byte i = 0; i < n; i++)\n {\n ushort si;\n if (!UInt16.TryParse (words[i], out si))\n return -1;\n if (si < 1 || si > 1000)\n return -1;\n if (si < sMin)\n sMin = si;\n }\n ushort numShare = Convert.ToUInt16 (r/sMin);\n ushort sumBuy = Convert.ToUInt16 (numShare*sMin);\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != m)\n return -1;\n ushort bMax = 1;\n for (byte i = 0; i < m; i++)\n {\n ushort bi;\n if (!UInt16.TryParse (words[i], out bi))\n return -1;\n if (bi < 1 || bi > 1000)\n return -1;\n if (bi > bMax)\n bMax = bi;\n }\n uint sumSell = Convert.ToUInt16 (numShare*bMax);\n uint ans = (sumSell > sumBuy ? r+sumSell-sumBuy : r);\n Console.WriteLine (ans);\n return 0;\n }\n }\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "66294bb1be4d695b7f36754bcb4e01f9", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "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 var inp = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n int n = inp[0], m = inp[1], r = inp[2];\n var s = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n var b = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n Array.Sort( s );\n Array.Sort( b, (x, y) => y - x );\n\n //--------------------------------solve--------------------------------/\n\n int min = Math.Min( s.Length, b.Length );\n int max = r;\n int i=0;\n while(min-- > 0)\n {\n int now = (r / s[i] )* b[i];\n r = r % s[i] + now;\n max = Math.Max( r, max );\n i++;\n }\n Console.WriteLine( max);\n\n }\n\n\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9885e5e12c8cc0d33c532b5306211895", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round90 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => int.Parse(sss)); }\n static long[] ReadLongs() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => long.Parse(sss)); }\n\n static int n, m, k;\n static long[] a, b, c;\n static bool[, ,] dp;\n static int[, ,] prev;\n static long[, ,] value;\n\n static void Main() {\n var xs = ReadInts();\n n = xs[0];\n m = xs[1];\n k = xs[2];\n\n long[][] vvv = new long[m][];\n a = new long[m];\n b = new long[m];\n c = new long[m];\n\n for (int i = 0; i < m; i++) {\n vvv[i] = ReadLongs();\n }\n\n Array.Sort(vvv, (aa, bb) => aa[2].CompareTo(bb[2]));\n for (int i = 0; i < m; i++) {\n a[i] = vvv[i][0];\n b[i] = vvv[i][1];\n c[i] = vvv[i][2];\n }\n\n dp = new bool[m + 1, n + 1, 101];\n prev = new int[m + 1, n + 1, 101];\n value = new long[m + 1, n + 1, 101];\n long res = 0;\n\n for (int i = 0; a[0] + i <= b[0]; i++) {\n dp[0, 1, i] = true;\n }\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++) {\n if (j == 0 || dp[i, j, u]) {\n long v = a[i] + u + k,\n vv = (a[i] + u) * k;\n for (int ii = i + 1; ii < m; ii++) {\n if (c[i] < c[ii]) {\n if (a[ii] <= v && v <= b[ii]) {\n prev[ii, j + 1, v - a[ii]] = i;\n value[ii, j + 1, v - a[ii]] = u;\n dp[ii, j + 1, v - a[ii]] = true;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, v);\n }\n if (a[ii] <= vv && vv <= b[ii]) {\n prev[ii, j + 1, vv - a[ii]] = i;\n value[ii, j + 1, vv - a[ii]] = u;\n dp[ii, j + 1, vv - a[ii]] = true;\n //if(ii==3) Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, vv);\n }\n }\n }\n }\n }\n\n bool find = false;\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u]) {\n find = true;\n res = Math.Max(res, a[i] + u);\n }\n\n if (!find) {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n List idx = new List();\n List val = new List();\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] && res == a[i] + u) {\n idx.Add(i + 1);\n val.Add(res);\n\n long v = u;\n for (int j = n; j > 1; j--) {\n long vv = v;\n v = value[i, j, vv];\n i = prev[i, j, vv];\n idx.Add(i + 1);\n val.Add(v+a[i]);\n }\n\n for (int j = idx.Count - 1; j >= 0; j--) {\n Console.WriteLine(\"{0} {1}\", idx[j], val[j]);\n }\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6af3f4dc3f0a387e931045ef298abf71", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round90 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => int.Parse(sss)); }\n static long[] ReadLongs() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => long.Parse(sss)); }\n\n static int n, m, k;\n static long[] a, b, c;\n static bool[, ,] dp;\n static int[, ,] prev;\n static long[, ,] value;\n\n static void Main() {\n var xs = ReadInts();\n n = xs[0];\n m = xs[1];\n k = xs[2];\n\n long[][] vvv = new long[m][];\n a = new long[m];\n b = new long[m];\n c = new long[m];\n\n for (int i = 0; i < m; i++) {\n vvv[i] = new long[4];\n var ys = ReadLongs();\n for (int j = 0; j < 3; j++)\n vvv[i][j] = ys[j];\n vvv[i][3] = i;\n }\n\n Array.Sort(vvv, (aa, bb) => aa[2].CompareTo(bb[2]));\n for (int i = 0; i < m; i++) {\n a[i] = vvv[i][0];\n b[i] = vvv[i][1];\n c[i] = vvv[i][2];\n }\n\n dp = new bool[m, n + 1, 101];\n prev = new int[m, n + 1, 101];\n value = new long[m, n + 1, 101];\n long res = 0;\n\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, 0, u] = true;\n\n for (int i = 0; a[0] + i <= b[0]; i++) {\n dp[0, 1, i] = true;\n }\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++) {\n if (dp[i, j, u]) {\n long v = a[i] + u + k,\n vv = (a[i] + u) * k;\n for (int ii = i + 1; ii < m; ii++) {\n if (c[i] < c[ii]) {\n if (a[ii] <= v && v <= b[ii]) {\n prev[ii, j + 1, v - a[ii]] = i;\n value[ii, j + 1, v - a[ii]] = u;\n dp[ii, j + 1, v - a[ii]] = true;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, v);\n }\n if (a[ii] <= vv && vv <= b[ii]) {\n prev[ii, j + 1, vv - a[ii]] = i;\n value[ii, j + 1, vv - a[ii]] = u;\n dp[ii, j + 1, vv - a[ii]] = true;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, vv);\n }\n }\n }\n }\n }\n\n bool find = false;\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u]) {\n find = true;\n res = Math.Max(res, a[i] + u);\n }\n\n if (!find) {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n List idx = new List();\n List val = new List();\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] && res == a[i] + u) {\n idx.Add((int)vvv[i][3] + 1);\n val.Add(res);\n\n long v = u;\n for (int j = n; j > 1; j--) {\n long vv = v;\n v = value[i, j, vv];\n i = prev[i, j, vv];\n idx.Add((int)vvv[i][3] + 1);\n val.Add(v+a[i]);\n }\n\n for (int j = idx.Count - 1; j >= 0; j--) {\n Console.WriteLine(\"{0} {1}\", idx[j], val[j]);\n }\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b1eedcd8624eb5f13003d78558c9b035", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round90 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => int.Parse(sss)); }\n static long[] ReadLongs() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => long.Parse(sss)); }\n\n static int n, m, k;\n static long[] a, b, c;\n static long[, ,] dp;\n static int[, ,] prev;\n static long[, ,] value;\n\n static void Main() {\n var xs = ReadInts();\n n = xs[0];\n m = xs[1];\n k = xs[2];\n\n long[][] vvv = new long[m][];\n a = new long[m];\n b = new long[m];\n c = new long[m];\n\n for (int i = 0; i < m; i++) {\n vvv[i] = new long[4];\n var ys = ReadLongs();\n for (int j = 0; j < 3; j++)\n vvv[i][j] = ys[j];\n vvv[i][3] = i;\n }\n\n Array.Sort(vvv, (aa, bb) => aa[2].CompareTo(bb[2]));\n for (int i = 0; i < m; i++) {\n a[i] = vvv[i][0];\n b[i] = vvv[i][1];\n c[i] = vvv[i][2];\n }\n\n dp = new long[m, n + 1, 101];\n prev = new int[m, n + 1, 101];\n value = new long[m, n + 1, 101];\n long res = 0;\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j <= n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, j, u] = -1;\n\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, 1, u] = a[0] + u;\n\n for (int i = 0; i < m; i++)\n for (int j = 1; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++) {\n if (dp[i, j, u] >= 0) {\n long v = a[i] + u + k,\n vv = (a[i] + u) * k;\n long nv1 = v + dp[i, j, u];\n long nv2 = vv + dp[i, j, u];\n for (int ii = i + 1; ii < m; ii++) {\n if (c[i] < c[ii]) {\n if (a[ii] <= v && v <= b[ii] && dp[ii, j + 1, v - a[ii]] < nv1) {\n prev[ii, j + 1, v - a[ii]] = i;\n value[ii, j + 1, v - a[ii]] = u;\n dp[ii, j + 1, v - a[ii]] = nv1;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, v);\n }\n if (a[ii] <= vv && vv <= b[ii] && dp[ii, j + 1, vv - a[ii]] < nv2) {\n prev[ii, j + 1, vv - a[ii]] = i;\n value[ii, j + 1, vv - a[ii]] = u;\n dp[ii, j + 1, vv - a[ii]] = nv2;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, vv);\n }\n }\n }\n }\n }\n\n bool find = false;\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] >= 0) {\n find = true;\n res = Math.Max(res, dp[i, n, u]);\n }\n\n if (!find) {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n List idx = new List();\n List val = new List();\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] == res) {\n idx.Add((int)vvv[i][3] + 1);\n val.Add(a[i] + u);\n\n long v = u;\n for (int j = n; j > 1; j--) {\n long vv = v;\n v = value[i, j, vv];\n i = prev[i, j, vv];\n idx.Add((int)vvv[i][3] + 1);\n val.Add(v+a[i]);\n }\n\n for (int j = idx.Count - 1; j >= 0; j--) {\n Console.WriteLine(\"{0} {1}\", idx[j], val[j]);\n }\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c9cbf12e0683d4dda2d25487af279e83", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round90 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => int.Parse(sss)); }\n static long[] ReadLongs() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => long.Parse(sss)); }\n\n static int n, m, k;\n static long[] a, b, c;\n static bool[, ,] dp;\n static int[, ,] prev;\n static long[, ,] value;\n\n static void Main() {\n var xs = ReadInts();\n n = xs[0];\n m = xs[1];\n k = xs[2];\n\n a = new long[m];\n b = new long[m];\n c = new long[m];\n\n for (int i = 0; i < m; i++) {\n var ys = ReadLongs();\n a[i] = ys[0];\n b[i] = ys[1];\n c[i] = ys[2];\n }\n\n dp = new bool[m + 1, n + 1, 101];\n prev = new int[m + 1, n + 1, 101];\n value = new long[m + 1, n + 1, 101];\n long res = 0;\n\n for (int i = 0; a[0] + i <= b[0]; i++) {\n dp[0, 1, i] = true;\n }\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++) {\n if (j == 0 || dp[i, j, u]) {\n long v = a[i] + u + k,\n vv = (a[i] + u) * k;\n for (int ii = i + 1; ii < m; ii++) {\n if (c[i] < c[ii]) {\n if (a[ii] <= v && v <= b[ii]) {\n prev[ii, j + 1, v - a[ii]] = i;\n value[ii, j + 1, v - a[ii]] = u;\n dp[ii, j + 1, v - a[ii]] = true;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, v);\n }\n if (a[ii] <= vv && vv <= b[ii]) {\n prev[ii, j + 1, vv - a[ii]] = i;\n value[ii, j + 1, vv - a[ii]] = u;\n dp[ii, j + 1, vv - a[ii]] = true;\n //if(ii==3) Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, vv);\n }\n }\n }\n }\n }\n\n bool find = false;\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u]) {\n find = true;\n res = Math.Max(res, a[i] + u);\n }\n\n if (!find) {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n List idx = new List();\n List val = new List();\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] && res == a[i] + u) {\n idx.Add(i + 1);\n val.Add(res);\n\n long v = u;\n for (int j = n; j > 1; j--) {\n long vv = v;\n v = value[i, j, vv];\n i = prev[i, j, vv];\n idx.Add(i + 1);\n val.Add(v+a[i]);\n }\n\n for (int j = idx.Count - 1; j >= 0; j--) {\n Console.WriteLine(\"{0} {1}\", idx[j], val[j]);\n }\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc64098b791df2323f098a2b8725d676", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round90 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => int.Parse(sss)); }\n static long[] ReadLongs() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => long.Parse(sss)); }\n\n static int n, m, k;\n static long[] a, b, c;\n static long[, ,] dp;\n static int[, ,] prev;\n static long[, ,] value;\n\n static void Main() {\n var xs = ReadInts();\n n = xs[0];\n m = xs[1];\n k = xs[2];\n\n long[][] vvv = new long[m][];\n a = new long[m];\n b = new long[m];\n c = new long[m];\n\n for (int i = 0; i < m; i++) {\n vvv[i] = new long[4];\n var ys = ReadLongs();\n for (int j = 0; j < 3; j++)\n vvv[i][j] = ys[j];\n vvv[i][3] = i;\n }\n\n Array.Sort(vvv, (aa, bb) => aa[2].CompareTo(bb[2]));\n for (int i = 0; i < m; i++) {\n a[i] = vvv[i][0];\n b[i] = vvv[i][1];\n c[i] = vvv[i][2];\n }\n\n dp = new long[m, n + 1, 101];\n prev = new int[m, n + 1, 101];\n value = new long[m, n + 1, 101];\n long res = 0;\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, j, u] = -1; \n\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, 0, u] = 0;\n\n for (int i = 0; a[0] + i <= b[0]; i++) {\n dp[0, 1, i] = a[0] + i;\n }\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++) {\n if (dp[i, j, u] >= 0) {\n long v = a[i] + u + k,\n vv = (a[i] + u) * k;\n long newval = v + dp[i, j, u];\n for (int ii = i + 1; ii < m; ii++) {\n if (c[i] < c[ii]) {\n if (a[ii] <= v && v <= b[ii] && dp[ii, j + 1, v - a[ii]] < newval) {\n prev[ii, j + 1, v - a[ii]] = i;\n value[ii, j + 1, v - a[ii]] = u;\n dp[ii, j + 1, v - a[ii]] = newval;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, v);\n }\n if (a[ii] <= vv && vv <= b[ii] && dp[ii, j + 1, vv - a[ii]] < newval) {\n prev[ii, j + 1, vv - a[ii]] = i;\n value[ii, j + 1, vv - a[ii]] = u;\n dp[ii, j + 1, vv - a[ii]] = newval;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, vv);\n }\n }\n }\n }\n }\n\n bool find = false;\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] >= 0) {\n find = true;\n res = Math.Max(res, dp[i, n, u]);\n }\n\n if (!find) {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n List idx = new List();\n List val = new List();\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] == res) {\n idx.Add((int)vvv[i][3] + 1);\n val.Add(a[i] + u);\n\n long v = u;\n for (int j = n; j > 1; j--) {\n long vv = v;\n v = value[i, j, vv];\n i = prev[i, j, vv];\n idx.Add((int)vvv[i][3] + 1);\n val.Add(v+a[i]);\n }\n\n for (int j = idx.Count - 1; j >= 0; j--) {\n Console.WriteLine(\"{0} {1}\", idx[j], val[j]);\n }\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8b622bf0c5f7739860a4f572ee6b7fad", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round90 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => int.Parse(sss)); }\n static long[] ReadLongs() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => long.Parse(sss)); }\n\n static int n, m, k;\n static long[] a, b, c;\n static long[, ,] dp;\n static int[, ,] prev;\n static long[, ,] value;\n\n static void Main() {\n var xs = ReadInts();\n n = xs[0];\n m = xs[1];\n k = xs[2];\n\n long[][] vvv = new long[m][];\n a = new long[m];\n b = new long[m];\n c = new long[m];\n\n for (int i = 0; i < m; i++) {\n vvv[i] = new long[4];\n var ys = ReadLongs();\n for (int j = 0; j < 3; j++)\n vvv[i][j] = ys[j];\n vvv[i][3] = i;\n }\n\n Array.Sort(vvv, (aa, bb) => aa[2].CompareTo(bb[2]));\n for (int i = 0; i < m; i++) {\n a[i] = vvv[i][0];\n b[i] = vvv[i][1];\n c[i] = vvv[i][2];\n }\n\n dp = new long[m, n + 1, 101];\n prev = new int[m, n + 1, 101];\n value = new long[m, n + 1, 101];\n long res = 0;\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j <= n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, j, u] = -1;\n\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, 0, u] = 0;\n\n for (int i = 0; a[0] + i <= b[0]; i++) {\n dp[0, 1, i] = a[0] + i;\n }\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++) {\n if (dp[i, j, u] >= 0) {\n long v = a[i] + u + k,\n vv = (a[i] + u) * k;\n long nv1 = v + dp[i, j, u];\n long nv2 = vv + dp[i, j, u];\n for (int ii = i + 1; ii < m; ii++) {\n if (c[i] < c[ii]) {\n if (a[ii] <= v && v <= b[ii] && dp[ii, j + 1, v - a[ii]] < nv1) {\n prev[ii, j + 1, v - a[ii]] = i;\n value[ii, j + 1, v - a[ii]] = u;\n dp[ii, j + 1, v - a[ii]] = nv1;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, v);\n }\n if (a[ii] <= vv && vv <= b[ii] && dp[ii, j + 1, vv - a[ii]] < nv2) {\n prev[ii, j + 1, vv - a[ii]] = i;\n value[ii, j + 1, vv - a[ii]] = u;\n dp[ii, j + 1, vv - a[ii]] = nv2;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, vv);\n }\n }\n }\n }\n }\n\n\n bool find = false;\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] >= 0) {\n find = true;\n res = Math.Max(res, dp[i, n, u]);\n }\n\n if (!find) {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n List idx = new List();\n List val = new List();\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] == res) {\n idx.Add((int)vvv[i][3] + 1);\n val.Add(a[i] + u);\n\n long v = u;\n for (int j = n; j > 1; j--) {\n long vv = v;\n v = value[i, j, vv];\n i = prev[i, j, vv];\n idx.Add((int)vvv[i][3] + 1);\n val.Add(v+a[i]);\n }\n\n for (int j = idx.Count - 1; j >= 0; j--) {\n Console.WriteLine(\"{0} {1}\", idx[j], val[j]);\n }\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "900946c547310d58488a30c744d3b940", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round90 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => int.Parse(sss)); }\n static long[] ReadLongs() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => long.Parse(sss)); }\n\n static int n, m, k;\n static long[] a, b, c;\n static bool[, ,] dp;\n static int[, ,] prev;\n static long[, ,] value;\n\n static void Main() {\n var xs = ReadInts();\n n = xs[0];\n m = xs[1];\n k = xs[2];\n\n long[][] vvv = new long[m][];\n a = new long[m];\n b = new long[m];\n c = new long[m];\n\n for (int i = 0; i < m; i++) {\n vvv[i] = new long[4];\n var ys = ReadLongs();\n for (int j = 0; j < 3; j++)\n vvv[i][j] = ys[j];\n vvv[i][3] = i;\n }\n\n Array.Sort(vvv, (aa, bb) => aa[2].CompareTo(bb[2]));\n for (int i = 0; i < m; i++) {\n a[i] = vvv[i][0];\n b[i] = vvv[i][1];\n c[i] = vvv[i][2];\n }\n\n dp = new bool[m + 1, n + 1, 101];\n prev = new int[m + 1, n + 1, 101];\n value = new long[m + 1, n + 1, 101];\n long res = 0;\n\n for (int i = 0; a[0] + i <= b[0]; i++) {\n dp[0, 1, i] = true;\n }\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++) {\n if (j == 0 || dp[i, j, u]) {\n long v = a[i] + u + k,\n vv = (a[i] + u) * k;\n for (int ii = i + 1; ii < m; ii++) {\n if (c[i] < c[ii]) {\n if (a[ii] <= v && v <= b[ii]) {\n prev[ii, j + 1, v - a[ii]] = i;\n value[ii, j + 1, v - a[ii]] = u;\n dp[ii, j + 1, v - a[ii]] = true;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, v);\n }\n if (a[ii] <= vv && vv <= b[ii]) {\n prev[ii, j + 1, vv - a[ii]] = i;\n value[ii, j + 1, vv - a[ii]] = u;\n dp[ii, j + 1, vv - a[ii]] = true;\n //if(ii==3) Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, vv);\n }\n }\n }\n }\n }\n\n bool find = false;\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u]) {\n find = true;\n res = Math.Max(res, a[i] + u);\n }\n\n if (!find) {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n List idx = new List();\n List val = new List();\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] && res == a[i] + u) {\n idx.Add((int)vvv[i][3] + 1);\n val.Add(res);\n\n long v = u;\n for (int j = n; j > 1; j--) {\n long vv = v;\n v = value[i, j, vv];\n i = prev[i, j, vv];\n idx.Add((int)vvv[i][3] + 1);\n val.Add(v+a[i]);\n }\n\n for (int j = idx.Count - 1; j >= 0; j--) {\n Console.WriteLine(\"{0} {1}\", idx[j], val[j]);\n }\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ef71b77b0baa9209c5417bebb0fbbf1e", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round90 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => int.Parse(sss)); }\n static long[] ReadLongs() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => long.Parse(sss)); }\n\n static int n, m, k;\n static long[] a, b, c;\n static long[, ,] dp;\n static int[, ,] prev;\n static long[, ,] value;\n\n static void Main() {\n var xs = ReadInts();\n n = xs[0];\n m = xs[1];\n k = xs[2];\n\n long[][] vvv = new long[m][];\n a = new long[m];\n b = new long[m];\n c = new long[m];\n\n for (int i = 0; i < m; i++) {\n vvv[i] = new long[4];\n var ys = ReadLongs();\n for (int j = 0; j < 3; j++)\n vvv[i][j] = ys[j];\n vvv[i][3] = i;\n }\n\n Array.Sort(vvv, (aa, bb) => aa[2].CompareTo(bb[2]));\n for (int i = 0; i < m; i++) {\n a[i] = vvv[i][0];\n b[i] = vvv[i][1];\n c[i] = vvv[i][2];\n }\n\n dp = new long[m, n + 1, 101];\n prev = new int[m, n + 1, 101];\n value = new long[m, n + 1, 101];\n long res = 0;\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, j, u] = -1; \n\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, 0, u] = 0;\n\n for (int i = 0; a[0] + i <= b[0]; i++) {\n dp[0, 1, i] = a[0] + i;\n }\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++) {\n if (dp[i, j, u] >= 0) {\n long v = a[i] + u + k,\n vv = (a[i] + u) * k;\n long nv1 = v + dp[i, j, u];\n long nv2 = vv + dp[i, j, u];\n for (int ii = i + 1; ii < m; ii++) {\n if (c[i] < c[ii]) {\n if (a[ii] <= v && v <= b[ii] && dp[ii, j + 1, v - a[ii]] < nv1) {\n prev[ii, j + 1, v - a[ii]] = i;\n value[ii, j + 1, v - a[ii]] = u;\n dp[ii, j + 1, v - a[ii]] = nv1;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, v);\n }\n if (a[ii] <= vv && vv <= b[ii] && dp[ii, j + 1, vv - a[ii]] < nv2) {\n prev[ii, j + 1, vv - a[ii]] = i;\n value[ii, j + 1, vv - a[ii]] = u;\n dp[ii, j + 1, vv - a[ii]] = nv2;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, vv);\n }\n }\n }\n }\n }\n\n bool find = false;\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] >= 0) {\n find = true;\n res = Math.Max(res, dp[i, n, u]);\n }\n\n if (!find) {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n List idx = new List();\n List val = new List();\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] == res) {\n idx.Add((int)vvv[i][3] + 1);\n val.Add(a[i] + u);\n\n long v = u;\n for (int j = n; j > 1; j--) {\n long vv = v;\n v = value[i, j, vv];\n i = prev[i, j, vv];\n idx.Add((int)vvv[i][3] + 1);\n val.Add(v+a[i]);\n }\n\n for (int j = idx.Count - 1; j >= 0; j--) {\n Console.WriteLine(\"{0} {1}\", idx[j], val[j]);\n }\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b8199128d57e1d2c7b52abb36fbde9b4", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round90 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => int.Parse(sss)); }\n static long[] ReadLongs() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => long.Parse(sss)); }\n\n static int n, m, k;\n static long[] a, b, c;\n static bool[, ,] dp;\n static int[, ,] prev;\n static long[, ,] value;\n\n static void Main() {\n var xs = ReadInts();\n n = xs[0];\n m = xs[1];\n k = xs[2];\n\n long[][] vvv = new long[m][];\n a = new long[m];\n b = new long[m];\n c = new long[m];\n\n for (int i = 0; i < m; i++) {\n vvv[i] = ReadLongs();\n }\n\n Array.Sort(vvv, (a, b) => a[2].CompareTo(b[2]));\n for (int i = 0; i < m; i++) {\n a[i] = vvv[i][0];\n b[i] = vvv[i][1];\n c[i] = vvv[i][2];\n }\n\n dp = new bool[m + 1, n + 1, 101];\n prev = new int[m + 1, n + 1, 101];\n value = new long[m + 1, n + 1, 101];\n long res = 0;\n\n for (int i = 0; a[0] + i <= b[0]; i++) {\n dp[0, 1, i] = true;\n }\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++) {\n if (j == 0 || dp[i, j, u]) {\n long v = a[i] + u + k,\n vv = (a[i] + u) * k;\n for (int ii = i + 1; ii < m; ii++) {\n if (c[i] < c[ii]) {\n if (a[ii] <= v && v <= b[ii]) {\n prev[ii, j + 1, v - a[ii]] = i;\n value[ii, j + 1, v - a[ii]] = u;\n dp[ii, j + 1, v - a[ii]] = true;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, v);\n }\n if (a[ii] <= vv && vv <= b[ii]) {\n prev[ii, j + 1, vv - a[ii]] = i;\n value[ii, j + 1, vv - a[ii]] = u;\n dp[ii, j + 1, vv - a[ii]] = true;\n //if(ii==3) Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, vv);\n }\n }\n }\n }\n }\n\n bool find = false;\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u]) {\n find = true;\n res = Math.Max(res, a[i] + u);\n }\n\n if (!find) {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n List idx = new List();\n List val = new List();\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] && res == a[i] + u) {\n idx.Add(i + 1);\n val.Add(res);\n\n long v = u;\n for (int j = n; j > 1; j--) {\n long vv = v;\n v = value[i, j, vv];\n i = prev[i, j, vv];\n idx.Add(i + 1);\n val.Add(v+a[i]);\n }\n\n for (int j = idx.Count - 1; j >= 0; j--) {\n Console.WriteLine(\"{0} {1}\", idx[j], val[j]);\n }\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6321fd6a11f50e035193b438a01530a4", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "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 Subj\n {\n public long a, b;\n public int c;\n }\n\n class Program\n {\n Subj[] subjects;\n\n bool[, ,] done;\n long[, ,] memo;\n\n int[, ,] nextSubjId;\n int[, ,] nextComplexityShift;\n\n int n;\n int k;\n\n long getMax(int day, int lastSubjId, int complexityShift)\n {\n if (day == n)\n return 0;\n\n if (!done[day, lastSubjId, complexityShift])\n {\n long ans = -1;\n int bestNextSubjId = -1;\n int bestComplexityShift = -1;\n\n for (int nextSubjId = 0; nextSubjId < subjects.Length; nextSubjId++)\n {\n Subj nextSubj = subjects[nextSubjId];\n if (day != 0 && subjects[lastSubjId].c >= nextSubj.c)\n continue;\n\n if (day == 0)\n {\n for (long complexity = nextSubj.a; complexity <= nextSubj.b; complexity++)\n {\n int nextShift = (int)(complexity - nextSubj.a);\n long temp = getMax(day + 1, nextSubjId, nextShift);\n if (temp == -1)\n continue;\n\n temp += complexity;\n if (temp > ans)\n {\n ans = temp;\n bestNextSubjId = nextSubjId;\n bestComplexityShift = nextShift;\n }\n }\n }\n else\n {\n Subj lastSubj = subjects[lastSubjId];\n for (int mode = 0; mode < 2; mode++)\n {\n long nextComplexity = mode == 0 ? (lastSubj.a + complexityShift) * k : ((lastSubj.a + complexityShift) + k);\n if (nextComplexity < nextSubj.a || nextComplexity > nextSubj.b)\n continue;\n\n\n int nextShift = (int)(nextComplexity - nextSubj.a);\n long temp = getMax(day + 1, nextSubjId, nextShift);\n if (temp == -1)\n continue;\n\n temp += nextComplexity;\n if (temp > ans)\n {\n ans = temp;\n bestNextSubjId = nextSubjId;\n bestComplexityShift = nextShift;\n }\n }\n }\n }\n\n memo[day, lastSubjId, complexityShift] = ans;\n\n if (ans >= 0)\n {\n nextSubjId[day, lastSubjId, complexityShift] = bestNextSubjId;\n nextComplexityShift[day, lastSubjId, complexityShift] = bestComplexityShift;\n }\n\n\n done[day, lastSubjId, complexityShift] = true;\n \n }\n\n return memo[day, lastSubjId, complexityShift];\n\n }\n\n\n void Solve()\n {\n // Place your code here\n n = io.NextInt();\n int m = io.NextInt();\n k = io.NextInt();\n\n subjects = new Subj[m];\n\n for (int i = 0; i < m; i++)\n {\n Subj s = new Subj();\n s.a = io.NextLong();\n s.b = io.NextLong();\n s.c = io.NextInt();\n subjects[i] = s;\n }\n\n done = new bool[n, m, 101];\n memo = new long[n, m, 101];\n nextSubjId = new int[n, m, 101];\n nextComplexityShift = new int[n, m, 101];\n\n long ans = getMax(0, 0, 0);\n\n if (ans == -1)\n {\n io.Print(\"NO\");\n return;\n }\n\n io.Print(\"YES\");\n int curSubj = 0;\n int curShift = 0;\n for (int day = 0; day < n; day++)\n {\n int nextSubj = nextSubjId[day, curSubj, curShift];\n int nextShift = nextComplexityShift[day, curSubj, curShift];\n\n io.PrintLine(\"\");\n io.Print(\"{0} {1}\", nextSubj + 1, nextShift + subjects[nextSubj].a);\n\n curSubj = nextSubj;\n curShift = nextShift;\n }\n\n }\n\n MyIo io = new MyIo();\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "26901262bbd7598e829dfd84952eb709", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round90 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => int.Parse(sss)); }\n static long[] ReadLongs() { return Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), sss => long.Parse(sss)); }\n\n static int n, m, k;\n static long[] a, b, c;\n static long[, ,] dp;\n static int[, ,] prev;\n static long[, ,] value;\n\n static void Main() {\n var xs = ReadInts();\n n = xs[0];\n m = xs[1];\n k = xs[2];\n\n long[][] vvv = new long[m][];\n a = new long[m];\n b = new long[m];\n c = new long[m];\n\n for (int i = 0; i < m; i++) {\n vvv[i] = new long[4];\n var ys = ReadLongs();\n for (int j = 0; j < 3; j++)\n vvv[i][j] = ys[j];\n vvv[i][3] = i;\n }\n\n Array.Sort(vvv, (aa, bb) => aa[2].CompareTo(bb[2]));\n for (int i = 0; i < m; i++) {\n a[i] = vvv[i][0];\n b[i] = vvv[i][1];\n c[i] = vvv[i][2];\n }\n\n dp = new long[m, n + 1, 101];\n prev = new int[m, n + 1, 101];\n value = new long[m, n + 1, 101];\n long res = 0;\n\n for (int i = 0; i < m; i++)\n for (int j = 0; j <= n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, j, u] = -1;\n\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n dp[i, 1, u] = a[i] + u;\n\n for (int i = 0; i < m; i++)\n for (int j = 1; j < n; j++)\n for (int u = 0; a[i] + u <= b[i]; u++) {\n if (dp[i, j, u] >= 0) {\n long v = a[i] + u + k,\n vv = (a[i] + u) * k;\n long nv1 = v + dp[i, j, u];\n long nv2 = vv + dp[i, j, u];\n for (int ii = i + 1; ii < m; ii++) {\n if (c[i] < c[ii]) {\n if (a[ii] <= v && v <= b[ii] && dp[ii, j + 1, v - a[ii]] < nv1) {\n prev[ii, j + 1, v - a[ii]] = i;\n value[ii, j + 1, v - a[ii]] = u;\n dp[ii, j + 1, v - a[ii]] = nv1;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, v);\n }\n if (a[ii] <= vv && vv <= b[ii] && dp[ii, j + 1, vv - a[ii]] < nv2) {\n prev[ii, j + 1, vv - a[ii]] = i;\n value[ii, j + 1, vv - a[ii]] = u;\n dp[ii, j + 1, vv - a[ii]] = nv2;\n //Console.WriteLine(\"{0} {1} {2}\", ii, j + 1, vv);\n }\n }\n }\n }\n }\n\n bool find = false;\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] >= 0) {\n find = true;\n res = Math.Max(res, dp[i, n, u]);\n }\n\n if (!find) {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n List idx = new List();\n List val = new List();\n for (int i = 0; i < m; i++)\n for (int u = 0; a[i] + u <= b[i]; u++)\n if (dp[i, n, u] == res) {\n idx.Add((int)vvv[i][3] + 1);\n val.Add(a[i] + u);\n\n long v = u;\n for (int j = n; j > 1; j--) {\n long vv = v;\n v = value[i, j, vv];\n i = prev[i, j, vv];\n idx.Add((int)vvv[i][3] + 1);\n val.Add(v+a[i]);\n }\n\n for (int j = idx.Count - 1; j >= 0; j--) {\n Console.WriteLine(\"{0} {1}\", idx[j], val[j]);\n }\n return;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d06662f4d9774b53ed70bed282d789f8", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string data = Console.ReadLine();\n data.Remove(0, 1);\n int num = Convert.ToInt32(data);\n if (num % 2 == 0)\n Console.WriteLine(\"0\");\n else Console.WriteLine(\"1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ac806467100bfa83c04df964c873f222", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n \nclass Program\n{\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n a.TrimStart();\n int k = int.Parse(a);\n Console.WriteLine(k % 2); \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "47ba08ec2d8b2fb4d2b9c33689aed7a0", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "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 = int.Parse(Console.ReadLine());\n Random rnd = new Random();\n int q = rnd.Next();\n if (q % 2 == 0)\n {\n Console.WriteLine(q);\n }\n else\n Console.WriteLine(q-1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e66949c131c73d2590d2ebb79d97c94", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n a.TrimStart();\n int k = int.Parse(a);\n Console.WriteLine(k % 2) \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "284780747e52fbbdc6db15363740dbea", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "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\tint n = int.Parse(Console.ReadLine().Split('A')[1]);\n\t\tConsole.Writeline(n % 2);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "aec8c4d54a73104ed45cefeacd74cc68", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace CodeForces1 {\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 TextWriter writer = Console.Out;\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n string line = reader.ReadLine();\n int i = int.Parse(line[line.Length - 1].ToString());\n writer.WriteLine(i % 2);\n \n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n \n static int[] ReadArray(int length) {\n int[] result = new int[length];\n for(int i = 0; i < length; i++) {\n result[i] = NextInt();\n }\n return result;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "973451e4491768f8351f2ceedb46cd04", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KickStartRoundA\n{\n\n class Program\n {\n\n \n\n static void Main(string[] args)\n {\n\n String s = Console.ReadLine();\n\n uint t = Convert.ToUInt32(s, 16);\n\n Console.WriteLine(t % 2);\n\n\n \n\n\n\n }\n }\n }\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ef8660eb6bce89a28a4092913ac4fb6c", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string data = Console.ReadLine();\n data = data.Remove(0, 1);\n int num = Convert.ToInt32(data);\n if (num % 2 == 0)\n Console.WriteLine(\"0\");\n else Console.WriteLine(\"1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6784583edba24ae33c71f58098c0fb1d", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\npublic class Test\n{\n\t\n\tpublic static void Main()\n\t{\n\t\tstring str = Console.ReadLine();\n\t\tif (Convert.ToInt32(str[6].ToString()) % 2 == 0)\n\t\t{\n\t\t\tConsole.WriteLine(\"0\");\n\t\t}\n\t\telse Console.WriteLine(\"1\");\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1545d6756f302d54e4f3e703a02944ca", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "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();\n Console.Write(int.Parse(s[s.Length-1].ToString())%2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8fcf988324374696ded7d43dbcba99fd", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing static System.Console;\nusing static System.Math;\nusing static System.Array;\nusing System.IO;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Conv(string[] a, int[] b)\n {\n for (int i = 0; i < a.Length; i++)\n {\n b[i] = Convert.ToInt32(a[i]);\n }\n }\n static void Print(int[] b)\n {\n for (int i = 0; i < b.Length; i++)\n {\n Write($\"{b[i]} \");\n }\n WriteLine();\n }\n static int Main(string[] args)\n {\n // = Convert.ToInt32(cin[0])\n //WriteLine($\"{}\");\n // string[] cin = ReadLine().Split(' ');\n string a = ReadLine();\n int k = Convert.ToInt32(a[a.Length - 1]);\n WriteLine(k%2);\n return 0;\n }\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bcd06d035e7f248dc346955a953d3359", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "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 string s = ReadToken();\n int x = s[6] - '0';\n Write(x % 2);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3e91b03e9dba8e22e7f2893b8949b738", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace ProgrammingContestTemplateByDotNetCore\n{\n #region \"Input and Output Classes\"\n\n class Scanner : IDisposable\n {\n private readonly Queue _buffer;\n private readonly char[] _sep;\n private readonly TextReader _reader;\n\n public Scanner(TextReader reader = null, char[] sep = null)\n {\n _buffer = new Queue();\n _sep = sep ?? new[] { ' ' };\n _reader = reader ?? Console.In;\n }\n\n public Scanner(string path, char[] sep = null)\n : this(new StreamReader(path), sep) { }\n\n private void CheckBuffer()\n {\n if (_buffer.Any() || _reader.Peek() == -1)\n return;\n\n string str = string.Empty;\n for (;\n string.IsNullOrWhiteSpace(str);\n str = _reader.ReadLine()) { }\n\n var values = str.Split(_sep).Where(s => !string.IsNullOrWhiteSpace(s));\n foreach (var item in values)\n {\n _buffer.Enqueue(item);\n }\n }\n\n public string Next()\n {\n CheckBuffer();\n return _buffer.Dequeue();\n }\n public string[] GetStringArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => Next())\n .ToArray();\n\n public int NextInt() => int.Parse(Next());\n public int[] GetIntArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => NextInt())\n .ToArray();\n\n public long NextLong() => long.Parse(Next());\n public long[] GetLongArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => NextLong())\n .ToArray();\n\n public double NextDouble() => double.Parse(Next());\n public double[] GetDoubleArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => NextDouble())\n .ToArray();\n\n public decimal NextDecimal() => decimal.Parse(Next());\n public decimal[] GetDecimalArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => NextDecimal())\n .ToArray();\n\n public BigInteger NextBigInt() => BigInteger.Parse(Next());\n public BigInteger[] GetBigIntArray(int count)\n => Enumerable.Range(0, count)\n .Select(e => NextBigInt())\n .ToArray();\n\n public T GetT(Func func) => func(this);\n public T[] GetTArray(int count, Func func)\n => Enumerable.Range(0, count)\n .Select(e => GetT(func))\n .ToArray();\n\n public bool IsEnd\n {\n get\n {\n CheckBuffer();\n return !_buffer.Any();\n }\n }\n\n public void Dispose()\n {\n if (!_reader.Equals(Console.In))\n _reader.Dispose();\n }\n }\n\n class Writer : IDisposable\n {\n private readonly TextWriter _writer;\n private readonly StringBuilder _cache;\n private readonly bool _isReactive;\n\n public Writer(TextWriter writer = null, bool isReactive = false)\n {\n _writer = writer ?? Console.Out;\n _isReactive = isReactive;\n if (!_isReactive)\n _cache = new StringBuilder();\n }\n\n public Writer(string path)\n : this(new StreamWriter(path)) { }\n\n public Writer(bool isReactive)\n : this(null, isReactive) { }\n\n public void Write(object value)\n {\n if (_isReactive)\n {\n _writer.Write(value);\n _writer.Flush();\n }\n else\n {\n _cache.Append(value);\n }\n }\n\n public void WriteFormat(string format, params object[] values)\n {\n var value = string.Format(format, values);\n Write(value);\n }\n\n public void WriteLine(object value = null)\n {\n Write($\"{value}{Environment.NewLine}\");\n }\n\n public void WriteLine(string format, params object[] values)\n {\n WriteFormat($\"{format}{Environment.NewLine}\", values);\n }\n\n public void Dispose()\n {\n if (!_isReactive)\n {\n _writer.Write(_cache);\n _writer.Flush();\n }\n if (!_writer.Equals(Console.Out))\n {\n _writer.Dispose();\n }\n }\n }\n\n public static class Extensions\n {\n public static void Set(\n this IDictionary source,\n TKey key, TValue value)\n {\n if (source.ContainsKey(key))\n source[key] = value;\n else\n source.Add(key, value);\n }\n\n public static void Update(\n this IDictionary source,\n TKey key, Func update)\n {\n if (!source.ContainsKey(key))\n source.Add(key, default(TValue));\n source[key] = update(source[key]);\n }\n }\n\n#endregion\n\n class MainClass : IDisposable\n {\n#region \"Template\"\n\n /// \u5165\u529b\u3092\u53d7\u3051\u53d6\u308b \n private readonly Scanner sc;\n /// \u51fa\u529b\u3092\u884c\u3046 \n private readonly Writer wr;\n private const string _inputFile = \"input.txt\";\n private const string _outFile = \"output.txt\";\n\n static void Main(string[] args)\n {\n using (new MainClass()) { }\n }\n\n public MainClass()\n {\n wr = new Writer(_isReactive);\n // TODO: \u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\u3057\u305f\u3044\u5834\u5408\u306f\u3053\u3063\u3061 \u2192 wr = new Writer(_outFile);\n\n#if DEBUG\n // \u624b\u5143\u3067\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u5165\u529b\u3092\u53d7\u3051\u53d6\u308b\n sc = new Scanner(_inputFile);\n#else\n\n // \u63d0\u51fa\u6642\u3001\u6a19\u6e96\u5165\u529b\u304b\u3089\u53d7\u3051\u53d6\u308b\n sc = new Scanner();\n#endif\n\n Solve();\n }\n\n public void Dispose()\n {\n sc?.Dispose();\n wr?.Dispose();\n }\n\n #endregion\n\n void Solve()\n {\n var s = sc.Next();\n wr.WriteLine((s.Last() - '0') % 2);\n }\n\n /// \n /// TODO: \u30ea\u30a2\u30af\u30c6\u30a3\u30d6\u554f\u984c\u304b\u5426\u304b\u3092\u6307\u5b9a\u3057\u3066\u306d\u266a\n /// \n private const bool _isReactive = false;\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6dbe07a86fd529f38ba4e3b9ce56c17f", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace ConsoleApplication3\n{\n class Program\n { \n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n if (Convert.ToInt32(a[a.Length - 1]) % 2 == 0)\n Console.WriteLine(0);\n else Console.WriteLine(1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "118b2c9c8c283cd053f262f441262e98", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AprilFools\n{\n class Program\n {\n static void Main(string[] args)\n {\n string t = Console.ReadLine();\n int q = Convert.ToInt32(t[6]);\n Console.WriteLine(q%2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "abe19ca6c9c814e6d68784ea80e16bb3", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace D\n{\n class Program\n {\n static void Main(string[] args)\n {\n TextReader sr = Console.In;\n //StreamReader sr = new StreamReader(\"1.txt\");\n string s = sr.ReadLine();\n Console.WriteLine((Convert.ToInt32(s[6])%2).ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "413dc3195ba764efca7f3c7aafddaf63", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = Console.ReadLine();\n\n var a = Convert.ToInt32(x[x.Length -1]);\n\n Console.WriteLine(a%2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "39962b513c5db3a4096437297ed55f73", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n \nclass Program\n{\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n a = a.Remove(0, 1);\n int k = int.Parse(a);\n Console.WriteLine(k % 2); \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b56e08d9766f2774e68ef7de124a8456", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nnamespace prD {\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 var q = int.Parse(reader.ReadLine(), NumberStyles.AllowHexSpecifier);\n writer.WriteLine(q & 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "afca4eaef11d26d22defb9b41d77905b", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "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\tint n = int.Parse(Console.ReadLine().Split('A')[1]);\n\t\tConsole.WriteLine(n % 2);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1af386a9e55317309844b885b001c973", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var readLine = Console.ReadLine();\n var number = int.Parse(readLine.Last().ToString());\n Console.WriteLine(number%2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "849df3db88da1ff28fd139a238e34204", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "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 string s1 = ReadLine();\n string s2 = ReadLine();\n int n = s1.Length;\n\n var a = new int[n + 1, 4];\n for (int i = 0; i < n + 1; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n a[i, j] = -1;\n }\n }\n a[0, 3] = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n bool l1 = j < 2;\n bool l2 = (j % 2 == 0);\n bool r1 = s1[i] == '0';\n bool r2 = s2[i] == '0';\n\n int mask = 0;\n if (!r1)\n {\n mask += 2;\n }\n if (!r2)\n {\n mask += 1;\n }\n\n a[i + 1, mask] = Math.Max(a[i + 1, mask], a[i, j]);\n if (l1 && l2 && r1)\n {\n a[i + 1, 2 | mask] = Math.Max(a[i + 1, 2 | mask], a[i, j] + 1);\n }\n if (l1 && l2 && r2)\n {\n a[i + 1, 1 | mask] = Math.Max(a[i + 1, 1 | mask], a[i, j] + 1);\n }\n if (l1 && r1 && r2)\n {\n a[i + 1, 3 | mask] = Math.Max(a[i + 1, 3 | mask], a[i, j] + 1);\n }\n if (l2 && r1 && r2)\n {\n a[i + 1, 3 | mask] = Math.Max(a[i + 1, 3 | mask], a[i, j] + 1);\n }\n }\n }\n\n int ans = 0;\n for (int i = 0; i < 4; i++)\n {\n ans = Math.Max(ans, a[n, i]);\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b96a144d9084a194f60159d3fa5740d9", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "difficulty": 1500.0} {"lang": "Mono C#", "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 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 long i = 0;\n long ans = 0;\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n var s = ReadLines(2);\n var mas = s.Select(it => it.Select(ch => ch == 'X' ? 1 : 0).ToArray()).ToArray();\n\n int n = mas[0].Length;\n if (n < 2)\n {\n Write(0);\n }\n else\n {\n for (i = 0; i < n - 1; i++)\n {\n int ones = mas[0][i] + mas[0][i + 1] + mas[1][i] + mas[1][i + 1];\n if (ones == 1)\n {\n ans++;\n mas[0][i] = mas[0][i + 1] = mas[1][i] = mas[1][i + 1] = 1;\n }\n else if (ones == 0)\n {\n ans++;\n mas[0][i] = mas[0][i + 1] = mas[1][i] = 1;\n }\n }\n Write(ans);\n }\n\n reader.Close();\n writer.Close();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0022d993871879ea75538cd646a697be", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ShadowingOverride\n{ \n class Program\n {\n static void Main(string[] args)\n {\n string[] s = new string[2];\n s[0] = Console.ReadLine();\n s[1] = Console.ReadLine();\n int n = s[0].Length;\n int empty = 0;\n int cur = 0;\n int ans = 0;\n \n for(int i = 0; i < n; i++)\n {\n cur = (s[0][i] == '0'?1:0) + (s[1][i] == '0'?1:0);\n // Console.WriteLine(cur);\n empty += cur;\n if( empty >= 3)\n {\n empty -= 3;\n ans++;\n }\n else\n {\n empty = cur;\n }\n }\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ecb2d8115441fa8b785329ba2b29b68", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Problems\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] s1 = Console.ReadLine().ToCharArray();\n char[] s2 = Console.ReadLine().ToCharArray();\n\n int count = 0;\n\n for (int i = 0; i < s1.Length - 1; i++)\n {\n if(s1[i] == '0' && s2[i] == '0')\n {\n if(s1[i + 1] == '0')\n {\n s1[i] = 'X';\n s2[i] = 'X';\n s1[i + 1] = 'X';\n count++;\n }\n else if(s2[i + 1] == '0')\n {\n s1[i] = 'X';\n s2[i] = 'X';\n s2[i + 1] = 'X';\n count++;\n }\n }\n else if(s1[i] == '0')\n {\n if(s1[i + 1] == '0' && s2[i + 1] == '0')\n {\n s1[i] = 'X';\n s1[i + 1] = 'X';\n s2[i + 1] = 'X';\n count++;\n }\n }\n else if(s2[i] == '0')\n {\n if(s1[i + 1] == '0' && s2[i + 1] == '0')\n {\n s2[i] = 'X';\n s1[i + 1] = 'X';\n s2[i + 1] = 'X';\n count++;\n }\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1e46996d1dfbe6713ef98ddbd26dd34f", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n const bool TEST_MODE = false;\n\n static void Main()\n {\n if (TEST_MODE)\n {\n string[] readText = File.ReadAllLines(\"..\\\\..\\\\TextFile1.txt\");\n\n var testCases = new Dictionary, string>();\n var lastKeyword = \"\";\n var current = new List();\n foreach (string s in readText)\n {\n if(s == \"Input\")\n {\n current = new List();\n lastKeyword = s;\n continue;\n }\n if (s == \"Copy\")\n continue;\n if (s == \"Output\")\n {\n lastKeyword = s;\n continue;\n }\n\n if (lastKeyword == \"Input\")\n current.Add(s);\n if (lastKeyword == \"Output\")\n testCases.Add(current,s);\n \n }\n\n foreach(var testCase in testCases)\n {\n var result = ProblemWrapper.Solve(testCase.Key.ToArray(), testCase.Value);\n if (result == testCase.Value)\n Console.ForegroundColor = ConsoleColor.Green;\n else\n Console.ForegroundColor = ConsoleColor.Red;\n\n\n Console.Write(\"input: \");\n foreach (var input in testCase.Key)\n Console.Write(input + \" // \");\n Console.Write(\"\\noutput: \");\n Console.WriteLine(testCase.Value);\n\n Console.Write(\"Actual: \");\n Console.WriteLine(result);\n\n Console.ResetColor();\n }\n }\n else\n ProblemWrapper.Solve();\n\n Console.ReadLine();\n }\n}\n\nclass ProblemWrapper\n{\n public static void Solve()\n {\n string[] input = new string[2];\n input[0] = Console.ReadLine();\n input[1] = Console.ReadLine();\n\n var a = ReadString(input[0]);\n var b = ReadString(input[1]);\n\n Console.WriteLine (Algo(a, b));\n }\n \n public static string Solve(string[] input, string output)\n {\n var a = ReadString(input[0]);\n var b = ReadString(input[1]);\n\n return (Algo(a, b));\n }\n\n public static string Algo(string a, string b)\n {\n int answer = 0;\n\n //**\n {\n var row1 = a.ToCharArray();\n var row2 = b.ToCharArray();\n\n var n = row1.Length;\n if (n < 2)\n return \"0\";\n\n for (var i = 0; i < n; i++)\n {\n if (row1[i] == '0')\n {\n if (i != 0 && row2[i - 1] == '0' && row2[i] == '0')\n {\n row1[i] = 'X'; row2[i] = 'X'; row2[i - 1] = 'X';\n answer++;\n }\n else if (i != 0 && row2[i] == '0' && row1[i - 1] == '0')\n {\n row1[i] = 'X'; row2[i] = 'X'; row1[i - 1] = 'X';\n answer++;\n }\n else if (i != n - 1 && row2[i] == '0' && row2[i + 1] == '0')\n {\n row1[i] = 'X'; row2[i] = 'X'; row2[i + 1] = 'X';\n answer++;\n }\n else if (i != n - 1 && row2[i] == '0' && row1[i + 1] == '0')\n {\n row1[i] = 'X'; row2[i] = 'X'; row1[i + 1] = 'X';\n answer++;\n }\n } \n\n }\n }\n //**\n\n return Convert.ToString(answer);\n }\n\n static String ReadString(string input) { return input; }\n static String[] ReadStringArr(string input) { return input.Split(' '); }\n static int ReadInt(string input) { return int.Parse(input); }\n static long ReadLong(string input) { return long.Parse(input); }\n static double ReadDouble(string input) { return double.Parse(input); }\n static int[] ReadIntArr(string input) { return Array.ConvertAll(input.Split(' '), e => int.Parse(e)); }\n static long[] ReadLongArr(string input) { return Array.ConvertAll(input.Split(' '), e => long.Parse(e)); }\n static double[] ReadDoubleArr(string input) { return Array.ConvertAll(input.Split(' '), e => double.Parse(e)); }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "977ce51cc7177078d1fbd20559d53ed1", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "difficulty": 1500.0} {"lang": "Mono C#", "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 == 1){\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\t\tint H = 2;\n\t\tint W = N;\n\t\t\n\t\t\n\t\tint M = 1<<4;\n\t\tint[] c = new int[]{\n\t\t\t0xF - 1,\n\t\t\t0xF - 2,\n\t\t\t0xF - 4,\n\t\t\t0xF - 8,\n\t\t\t0\n\t\t};\n\t\tint[] dp = new int[M];\n\t\tfor(int i=0;i> 2;\n\t\t\t\t\tfor(int j=0;j<2;j++){\n\t\t\t\t\t\tst |= ((t + 2 < N && S[j][t + 2] == 'X') ? 1 : 0) << (2 + j);\n\t\t\t\t\t}\n//Console.WriteLine(\"i:{0}, b:{1}, st:{2}\",i, b, st);\n\t\t\t\t\tndp[st] = Math.Max(ndp[st], dp[i] + (b == 0 ? 0 : 1));\n\t\t\t\t}\n\t\t\t}\n\t\t\tdp = ndp;\n//Console.WriteLine(\"ndp:{0}\",String.Join(\" \",dp));\n\t\t}\n\t\t\n\t\tConsole.WriteLine(dp.Max());\n\t\t\n\t\t\n\t}\n\tint N;\n\tString[] S;\n\tpublic Sol(){\n\t\tS = new String[2];\n\t\tfor(int i=0;i<2;i++) S[i] = rs();\n\t\tN = S[0].Length;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e7af0806159c25894efd7c74f90221da", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "difficulty": 1500.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2ff3c0a6c8b6f9272a3f8a7add5d4d35", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "difficulty": 2600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbe057b856cc802fe5cf095767a455f2", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "difficulty": 2600.0} {"lang": "MS C#", "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 var d = new SDictionary { { a, 1 } };\n for (int i = 0; i < primes.Count; i++)\n {\n var nd = new SDictionary();\n foreach (var p in d)\n {\n nd[p.Key] += p.Value;\n for (long x = primes[i]; x < p.Key; x *= primes[i])\n if (p.Key % (x + 1) == 0)\n nd[p.Key / (x + 1)] += p.Value;\n }\n d = nd;\n }\n\n long ans = d[1];\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7e2b0d732bcb132dd5bfa2d4d9c266d8", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "difficulty": 2600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CFDIV125_2 {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\n#if DEBUG\n\t\t\tTextReader reader = new StreamReader(\"../../input.txt\");\n\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\n\t\t\t#region INIT \n\t\t\tint[] c1 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\t\t\tint[] c2 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\n\t\t\tint x1 = c1[0];\n\t\t\tint y1 = c1[1];\n\t\t\tint r1 = c1[2];\n\t\t\tint R1 = c1[3];\n\n\t\t\tint x2 = c2[0];\n\t\t\tint y2 = c2[1];\n\t\t\tint r2 = c2[2];\n\t\t\tint R2 = c2[3];\n\t\t\t#endregion\n\n\t\t\tint count = 0;\n\n\t\t\tif (AreCircleWithBallOk(x1, y1, r1, x2, y2, r2, R2)) count++;\n\t\t\tif (AreCircleWithBallOk(x1, y1, R1, x2, y2, r2, R2)) count++;\n\t\t\tif (AreCircleWithBallOk(x2, y2, r2, x1, y1, r1, R1)) count++;\n\t\t\tif (AreCircleWithBallOk(x2, y2, R2, x1, y1, r1, R1)) count++;\n\t\t\t\n\n\t\t\tConsole.WriteLine(count);\n\n\n#if DEBUG\n\t\t\tConsole.ReadKey();\n#endif\n\n\t\t}\n\n\n\t\tstatic bool AreCircleWithBallOk(int x1, int y1, int rd1, int x2, int y2, int rd2, int Rd2) {\n\t\t\treturn !(AreBallsIntercect(x1, y1, rd1, x2, y2, rd2) || AreBallsIntercect(x1, y1, rd1, x2, y2, Rd2));\n\t\t}\n\n\t\tstatic bool AreBallsIntercect(int x1, int y1, int rd1, int x2, int y2, int rd2) {\n\t\t\t\n\t\t\tdouble centersDist = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n\n\t\t\tdouble l1 = -rd1;\n\t\t\tdouble r1 = rd1;\n\n\t\t\tdouble l2 = centersDist - rd2;\n\t\t\tdouble r2 = centersDist + rd2;\n\n\t\t\tif (r1 <= l2) return false;\n\t\t\tif (l1 <= l2 && r1 >= r2) return false;\n\t\t\tif (l2 <= l1 && r2 >= r1) return false;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "986b05d6ef703eed6e04efac819a5b6c", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CFDIV125_2 {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\n#if DEBUG\n\t\t\tTextReader reader = new StreamReader(\"../../input.txt\");\n\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\n\t\t\t#region INIT \n\t\t\tint[] c1 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\t\t\tint[] c2 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\n\t\t\tint x1 = c1[0];\n\t\t\tint y1 = c1[1];\n\t\t\tint r1 = c1[2];\n\t\t\tint R1 = c1[3];\n\n\t\t\tint x2 = c2[0];\n\t\t\tint y2 = c2[1];\n\t\t\tint r2 = c2[2];\n\t\t\tint R2 = c2[3];\n\t\t\t#endregion\n\n\t\t\tint count = 0;\n\n\t\t\tif (AreCircleWithBallOk(x1, y1, r1, x2, y2, r2, R2)) count++;\n\t\t\tif (AreCircleWithBallOk(x1, y1, R1, x2, y2, r2, R2)) count++;\n\t\t\tif (AreCircleWithBallOk(x2, y2, r2, x1, y1, r1, R1)) count++;\n\t\t\tif (AreCircleWithBallOk(x2, y2, R2, x1, y1, r1, R1)) count++;\n\t\t\t\n\n\t\t\tConsole.WriteLine(count);\n\n\n#if DEBUG\n\t\t\tConsole.ReadKey();\n#endif\n\n\t\t}\n\n\n\t\tstatic bool AreCircleWithBallOk(int x1, int y1, int rd1, int x2, int y2, int rd2, int Rd2) {\n\t\t\treturn !(AreBallsIntercect(x1, y1, rd1, x2, y2, rd2) || AreBallsIntercect(x1, y1, rd1, x2, y2, Rd2));\n\t\t}\n\n\t\tstatic bool AreBallsIntercect(int x1, int y1, int rd1, int x2, int y2, int rd2) {\n\t\t\t\n\t\t\tdouble centersDist = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n\n\t\t\tdouble l1 = -rd1;\n\t\t\tdouble r1 = rd1;\n\n\t\t\tdouble l2 = centersDist - rd2;\n\t\t\tdouble r2 = centersDist + rd2;\n\n\t\t\tif (r1 < l2) return false;\n\t\t\tif (l1 < l2 && r1 > r2) return false;\n\t\t\tif (l2 < l1 && r2 > r1) return false;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc56f503014f329e3d671915aaed08f7", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CFDIV125_2 {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\n#if DEBUG\n\t\t\tTextReader reader = new StreamReader(\"../../input.txt\");\n\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\n\t\t\t#region INIT \n\t\t\tint[] c1 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\t\t\tint[] c2 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\n\t\t\tint x1 = c1[0];\n\t\t\tint y1 = c1[1];\n\t\t\tint r1 = c1[2];\n\t\t\tint R1 = c1[3];\n\n\t\t\tint x2 = c2[0];\n\t\t\tint y2 = c2[1];\n\t\t\tint r2 = c2[2];\n\t\t\tint R2 = c2[3];\n\t\t\t#endregion\n\n\t\t\tint count = 0;\n\n\t\t\tif (AreCircleWithBallOk(x1, y1, r1, x2, y2, r2, R2)) count++;\n\t\t\tif (AreCircleWithBallOk(x1, y1, R1, x2, y2, r2, R2)) count++;\n\t\t\tif (AreCircleWithBallOk(x2, y2, r2, x1, y1, r1, R1)) count++;\n\t\t\tif (AreCircleWithBallOk(x2, y2, R2, x1, y1, r1, R1)) count++;\n\t\t\t\n\n\t\t\tConsole.WriteLine(count);\n\n\n#if DEBUG\n\t\t\tConsole.ReadKey();\n#endif\n\n\t\t}\n\n\n\t\tstatic bool AreCircleWithBallOk(int x1, int y1, int rd1, int x2, int y2, int rd2, int Rd2) {\n\t\t\t\n\t\t\tbool res1 = !(AreBallsIntercect(x1, y1, rd1, x2, y2, rd2) || \n\t\t\t\t\t\t AreBallsIntercect(x1, y1, rd1, x2, y2, Rd2));\n\t\t\t\n\t\t\tif (!res1) return false;\n\t\t\t\n\t\t\tdouble centersDist = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n\t\t\t\n\t\t\tdouble t1 = centersDist + rd2;\n\t\t\tdouble t2 = rd1;\n\t\t\tdouble t3 = centersDist + Rd2;\n\t\t\tif (t1 < t2 && t2 < t3) return false;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tstatic bool AreBallsIntercect(int x1, int y1, int rd1, int x2, int y2, int rd2) {\n\t\t\t\n\t\t\tdouble centersDist = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n\n\t\t\tdouble l1 = -rd1;\n\t\t\tdouble r1 = rd1;\n\n\t\t\tdouble l2 = centersDist - rd2;\n\t\t\tdouble r2 = centersDist + rd2;\n\n\t\t\tif (r1 <= l2) return false;\n\t\t\tif (l1 <= l2 && r1 >= r2) return false;\n\t\t\tif (l2 <= l1 && r2 >= r1) return false;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9338fecddf6873f6787d278183413c34", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CFDIV125_2 {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\n#if DEBUG\n\t\t\tTextReader reader = new StreamReader(\"../../input.txt\");\n\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\n\t\t\t#region INIT \n\t\t\tint[] c1 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\t\t\tint[] c2 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\n\t\t\tint x1 = c1[0];\n\t\t\tint y1 = c1[1];\n\t\t\tint r1 = c1[2];\n\t\t\tint R1 = c1[3];\n\n\t\t\tint x2 = c2[0];\n\t\t\tint y2 = c2[1];\n\t\t\tint r2 = c2[2];\n\t\t\tint R2 = c2[3];\n\t\t\t#endregion\n\n\t\t\tint count = 0;\n\n\t\t\tif (AreCircleWithBallOk(x1, y1, r1, x2, y2, r2, R2)) count++;\n\t\t\tif (AreCircleWithBallOk(x1, y1, R1, x2, y2, r2, R2)) count++;\n\t\t\tif (AreCircleWithBallOk(x2, y2, r2, x1, y1, r1, R1)) count++;\n\t\t\tif (AreCircleWithBallOk(x2, y2, R2, x1, y1, r1, R1)) count++;\n\t\t\t\n\n\t\t\tConsole.WriteLine(count);\n\n\n#if DEBUG\n\t\t\tConsole.ReadKey();\n#endif\n\n\t\t}\n\n\n\t\tstatic bool AreCircleWithBallOk(int x1, int y1, int rd1, int x2, int y2, int rd2, int Rd2) {\n\n\t\t\tbool res1 = !(AreBallsIntercect(x1, y1, rd1, x2, y2, rd2) ||\n\t\t\t\t\t\t AreBallsIntercect(x1, y1, rd1, x2, y2, Rd2));\n\n\t\t\tif (!res1) return false;\n\n\t\t\tdouble centersDist = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n\n\t\t\tdouble t1 = centersDist + rd2;\n\t\t\tdouble t2 = rd1;\n\t\t\tdouble t3 = centersDist + Rd2;\n\t\t\tif (t1 <= t2 && t2 < t3) return false;\n\n\t\t\tt1 = centersDist - Rd2;\n\t\t\tt2 = -rd1;\n\t\t\tt3 = centersDist - rd2;\n\t\t\tif (t1 <= t2 && t2 < t3) return false;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tstatic bool AreBallsIntercect(int x1, int y1, int rd1, int x2, int y2, int rd2) {\n\t\t\t\n\t\t\tdouble centersDist = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n\n\t\t\tdouble l1 = -rd1;\n\t\t\tdouble r1 = rd1;\n\n\t\t\tdouble l2 = centersDist - rd2;\n\t\t\tdouble r2 = centersDist + rd2;\n\n\t\t\tif (r1 <= l2) return false;\n\t\t\tif (l1 <= l2 && r1 >= r2) return false;\n\t\t\tif (l2 <= l1 && r2 >= r1) return false;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ee25d2fa254e8f7eccfee551f1e1cafe", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n//namespace Practice\n//{\n class TaskF\n {\n public static void Main(string[] args)\n {\n new TaskF().solve();\n }\n const int P = 1000000007;\n public int pow(int a, int b)\n {\n if (b == 0) return 1;\n int res = pow(a, (b >> 1));\n res = (int)((1L * res * res) % P);\n if ((b & 1) == 1)\n {\n return (int)((1L * res * a) % P);\n }\n return res;\n }\n\n int comb(int n, int k, int[] fac, int[] finv)\n {\n if (k > n) return 0;\n if (k == 0 || k == n) return 1;\n return (int) (((1L * (1L * fac[n] * finv[k]) % P) * finv[n-k]) % P);\n }\n\n public void solve()\n {\n string[] inputs = Console.ReadLine().Split(' ');\n int f = int.Parse(inputs[0]);\n int w = int.Parse(inputs[1]);\n int h = int.Parse(inputs[2]);\n\n if (w == 0 || h == 0)\n {\n Console.WriteLine(1);\n return;\n }\n else if (f == 0)\n {\n if (w > h)\n {\n Console.WriteLine(1);\n return;\n }\n else\n {\n Console.WriteLine(0);\n return;\n }\n }\n if (w <= h && w > 0)\n {\n Console.WriteLine(0);\n return;\n }\n int n = Math.Max(f + 1, w - 1) + 1;\n int[] fac = new int[n];\n int[] finv = new int[n];\n fac[0] = finv[0] = 1;\n fac[1] = finv[1] = 1;\n for (int i = 2; i < n; i++)\n {\n fac[i] = (int)((1L * fac[i - 1] * i) % P);\n finv[i] = pow(fac[i], P - 2); \n }\n\n int all = 0, good = 0, f1 = f + 1, w1 = w - 1, upper = w / (h + 1);\n for (int u = 1; u <= w; u++)\n {\n if (u > f1) break;\n int f1u = comb(f1, u, fac, finv);\n all += mult(f1u, comb(w1, u - 1, fac, finv));\n all %= P;\n if (u <= upper)\n {\n good += mult(f1u, comb(w - u * h - 1, u - 1, fac, finv));\n good %= P;\n }\n }\n //Console.WriteLine(pow(all, P-2));\n int res = (int)(1L * good * pow(all, P - 2) % P);\n //Console.WriteLine(res + \" = \" + good +\" / \" + all);\n Console.WriteLine(res);\n\n //Console.Read();\n }\n public int mult(int a, int b)\n {\n return (int)((1L * a * b) % P);\n }\n }\n//}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0e9aba8797532afb247696163eb29788", "src_uid": "a69f95db3fe677111cf0558271b40f39", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Practice\n{\n class TaskF\n {\n //public static void Main(string[] args)\n //{\n // new TaskF().solve();\n //}\n const int P = 1000000007;\n public int pow(int a, int b)\n {\n if (b == 0) return 1;\n int res = pow(a, (b >> 1));\n res = (int)(1L * res * res % P);\n if ((b & 1) == 1)\n {\n return (int)(1L * res * a % P);\n }\n return res;\n }\n\n int comb(int n, int k, int[] fac, int[] finv)\n {\n if (k == 0 || k == n) return 1;\n return (int) (((1L * fac[n] * finv[k] % P) * finv[n-k]) % P);\n }\n\n public void solve()\n {\n string[] inputs = Console.ReadLine().Split(' ');\n int f = int.Parse(inputs[0]);\n int w = int.Parse(inputs[1]);\n int h = int.Parse(inputs[2]);\n\n if (w == 0 || h == 0)\n {\n Console.WriteLine(1);\n return;\n }\n else if (f == 0)\n {\n if (w > h)\n {\n Console.WriteLine(1);\n return;\n }\n else\n {\n Console.WriteLine(0);\n return;\n }\n }\n if (w <= h && w > 0)\n {\n Console.WriteLine(0);\n return;\n }\n int n = Math.Max(f + 1, w - 1) + 1;\n int[] fac = new int[n];\n int[] finv = new int[n];\n fac[0] = finv[0] = 1;\n fac[1] = finv[1] = 1;\n for (int i = 2; i < n; i++)\n {\n fac[i] = (int)(1L * fac[i - 1] * i % P);\n finv[i] = pow(fac[i], P - 2); \n }\n\n int all = 0, good = 0, f1 = f + 1, w1 = w - 1, upper = w / (h + 1);\n for (int u = 1; u <= w; u++)\n {\n if (u > f1) break;\n int f1u = comb(f1, u, fac, finv);\n all += mult(f1u, comb(w1, u - 1, fac, finv));\n all %= P;\n if (u <= upper)\n {\n good += mult(f1u, comb(w - u * h - 1, u - 1, fac, finv));\n }\n }\n Console.WriteLine(pow(all, P-2));\n int res = (int)(1L * good * pow(all, P - 2) % P);\n //Console.WriteLine(res + \" = \" + good +\" / \" + all);\n Console.WriteLine(res);\n\n //Console.Read();\n }\n public int mult(int a, int b)\n {\n return (int)(1L * a * b % P);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5cfce993109424a2ccc29934d3a4cb60", "src_uid": "a69f95db3fe677111cf0558271b40f39", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n//namespace Practice\n//{\n class TaskF\n {\n public static void Main(string[] args)\n {\n new TaskF().solve();\n }\n const int P = 1000000007;\n public int pow(int a, int b)\n {\n if (b == 0) return 1;\n int res = pow(a, (b >> 1));\n res = (int)(1L * res * res % P);\n if ((b & 1) == 1)\n {\n return (int)(1L * res * b % P);\n }\n return res;\n }\n\n int comb(int n, int k, int[] fac, int[] finv)\n {\n if (k == 0 || k == n) return 1;\n return (int) (((1L * fac[n] * finv[k] % P) * finv[n-k]) % P);\n }\n\n public void solve()\n {\n string[] inputs = Console.ReadLine().Split(' ');\n int f = int.Parse(inputs[0]);\n int w = int.Parse(inputs[1]);\n int h = int.Parse(inputs[2]);\n\n if (w == 0 || h == 0)\n {\n Console.WriteLine(1);\n return;\n }\n else if (f == 0)\n {\n if (w > h)\n {\n Console.WriteLine(1);\n return;\n }\n else\n {\n Console.WriteLine(0);\n return;\n }\n }\n if (w <= h && w > 0)\n {\n Console.WriteLine(0);\n return;\n }\n int n = Math.Max(f + 1, w - 1) + 1;\n int[] fac = new int[n];\n int[] finv = new int[n];\n fac[0] = finv[0] = 1;\n fac[1] = finv[1] = 1;\n for (int i = 2; i < n; i++)\n {\n fac[i] = (int)(1L * fac[i - 1] * i % P);\n finv[i] = pow(fac[i], P - 2); \n }\n\n int all = 0, good = 0, f1 = f + 1, w1 = w - 1, upper = w / (h + 1);\n for (int u = 1; u <= w; u++)\n {\n if (u > f1) break;\n int f1u = comb(f1, u, fac, finv);\n all += mult(f1u, comb(w1, u - 1, fac, finv));\n all %= P;\n if (u <= upper)\n {\n good += mult(f1u, comb(w - u * h - 1, u - 1, fac, finv));\n }\n }\n int res = (int)(1L * good * pow(all, P - 2) % P);\n Console.WriteLine(res + \" = \" + good +\" / \" + all);\n Console.Read();\n }\n public int mult(int a, int b)\n {\n return (int)(1L * a * b % P);\n }\n }\n//}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6d5b1d007059c813b86a7d8209bad6a0", "src_uid": "a69f95db3fe677111cf0558271b40f39", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n//namespace Practice\n//{\n class TaskF\n {\n public static void Main(string[] args)\n {\n new TaskF().solve();\n }\n const int P = 1000000007;\n public int pow(int a, int b)\n {\n if (b == 0) return 1;\n int res = pow(a, (b >> 1));\n res = (int)((1L * res * res) % P);\n if ((b & 1) == 1)\n {\n return (int)((1L * res * a) % P);\n }\n return res;\n }\n\n int comb(int n, int k, int[] fac, int[] finv)\n {\n if (k > n) return 0;\n if (k == 0 || k == n) return 1;\n return (int) ((((1L * fac[n] * finv[k]) % P) * finv[n-k]) % P);\n }\n\n public void solve()\n {\n string[] inputs = Console.ReadLine().Split(' ');\n int f = int.Parse(inputs[0]);\n int w = int.Parse(inputs[1]);\n int h = int.Parse(inputs[2]);\n\n if (w == 0 || h == 0)\n {\n Console.WriteLine(1);\n return;\n }\n else if (f == 0)\n {\n if (w > h)\n {\n Console.WriteLine(1);\n return;\n }\n else\n {\n Console.WriteLine(0);\n return;\n }\n }\n if (w <= h && w > 0)\n {\n Console.WriteLine(0);\n return;\n }\n int n = Math.Max(f + 1, w - 1) + 1;\n int[] fac = new int[n];\n int[] finv = new int[n];\n fac[0] = finv[0] = 1;\n fac[1] = finv[1] = 1;\n for (int i = 2; i < n; i++)\n {\n fac[i] = (int)((1L * fac[i - 1] * i) % P);\n finv[i] = pow(fac[i], P - 2); \n }\n\n int all = 0, good = 0, f1 = f + 1, w1 = w - 1, upper = w / (h + 1);\n for (int u = 1; u <= w; u++)\n {\n if (u > f1) break;\n int f1u = comb(f1, u, fac, finv);\n all += mult(f1u, comb(w1, u - 1, fac, finv));\n all %= P;\n if (u <= upper)\n {\n good += mult(f1u, comb(w - u * h - 1, u - 1, fac, finv));\n }\n }\n //Console.WriteLine(pow(all, P-2));\n int res = (int)(1L * good * pow(all, P - 2) % P);\n //Console.WriteLine(res + \" = \" + good +\" / \" + all);\n Console.WriteLine(res);\n\n //Console.Read();\n }\n public int mult(int a, int b)\n {\n return (int)((1L * a * b) % P);\n }\n }\n//}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dfba34ec9ca8bd4a053d54dc5e5bb6ea", "src_uid": "a69f95db3fe677111cf0558271b40f39", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\nusing CompLib.Mathematics;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N;\n private string S;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n S = sc.Next();\n\n int counter = 0;\n int min = 0;\n foreach (char c in S)\n {\n if (c == '(') counter++;\n else counter--;\n min = Math.Min(min, counter);\n }\n\n int t = 2 * N - S.Length;\n\n var dp = new ModInt[t + 1, t + 1];\n dp[0, 0] = 1;\n for (int i = 0; i < t; i++)\n {\n for (int j = 0; j <= t; j++)\n {\n if (j + 1 <= t) dp[i + 1, j + 1] += dp[i, j];\n if (0 <= j - 1) dp[i + 1, j - 1] += dp[i, j];\n }\n }\n\n ModInt ans = 0;\n for (int i = 0; i <= t; i++)\n {\n int j = t - i;\n for (int k = -min; k <= t; k++)\n {\n int l = counter + k;\n if (0 <= l && l <= t)\n {\n // Console.WriteLine($\"{i} {j} {k} {l} {dp[i, k]} {dp[j, l]}\");\n ans += dp[i, k] * dp[j, l];\n }\n }\n }\n\n Console.WriteLine(ans);\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\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c7e9abf36e522e4e21db46d2f936916e", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n int N;\n string S;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n S = sc.Next();\n\n int cnt = 0;\n int min = 0;\n foreach (var c in S)\n {\n if (c == '(') cnt++;\n else cnt--;\n min = Math.Min(min, cnt);\n }\n /*\n * S\u3092\u90e8\u5206\u6587\u5b57\u5217\u306b\u542b\u3080\u30ab\u30c3\u30b3\u5217\u306e\u500b\u6570\n */\n\n // i\u6587\u5b57\u76ee\u307e\u3067\u4f5c\u308b\u3001\u30ab\u30a6\u30f3\u30bf\u3001S\u3088\u308a\u524d\u3001S\u3088\u308a\u5f8c\n var dp = new ModInt[2 * N + 1, N + 1, 2];\n dp[0, 0, 0] = 1;\n for (int i = 0; i < 2 * N; i++)\n {\n for (int j = 0; j <= N; j++)\n {\n // (\n if (j + 1 <= N)\n {\n dp[i + 1, j + 1, 0] += dp[i, j, 0];\n dp[i + 1, j + 1, 1] += dp[i, j, 1];\n }\n\n // )\n if (j - 1 >= 0)\n {\n dp[i + 1, j - 1, 0] += dp[i, j, 0];\n dp[i + 1, j - 1, 1] += dp[i, j, 1];\n }\n\n if (i + S.Length <= 2 * N && j + min >= 0 && j + cnt <= N)\n {\n dp[i + S.Length, j + cnt, 1] += dp[i, j, 0];\n }\n }\n }\n\n Console.WriteLine(dp[2 * N, 0, 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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n #region ModInt\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 /// \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 #endregion\n #region Binomial Coefficient\n public class 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 #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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "015c8ad59c3a0412efb28c9e101d48ab", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Mathematics;\nusing CompLib.Util;\n\npublic class Program\n{\n int N;\n string S;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n S = sc.Next();\n int l = S.Length;\n\n int cnt = 0;\n int min = 0;\n for (int i = 0; i < l; i++)\n {\n if (S[i] == '(') cnt++;\n else cnt--;\n min = Math.Min(min, cnt);\n }\n\n // i\u756a\u76ee\u307e\u3067\u5165\u308c\u305f\n // \u30ab\u30a6\u30f3\u30bf\n // S\u3092\u5165\u308c\u305f\u6570\n var dp = new ModInt[2 * N + 1, 201, 201];\n dp[0, 0, 0] = 1;\n for (int i = 0; i < 2 * N; i++)\n {\n for (int j = 0; j <= 200; j++)\n {\n for (int k = 0; k <= 200; k++)\n {\n // (\u3092\u8ffd\u52a0\n if (j + 1 <= 200) dp[i + 1, j + 1, k] += dp[i, j, k];\n // )\n if (j - 1 >= 0) dp[i + 1, j - 1, k] += dp[i, j, k];\n // s\n if (i + l <= 2 * N && j + min >= 0 && j + cnt <= 200 && k + 1 <= 200) dp[i + l, j + cnt, k + 1] += dp[i, j, k];\n }\n }\n }\n ModInt ans = 0;\n for(int i = 1;i <= 200; i++)\n {\n if (i % 2 == 0) ans -= dp[2 * N, 0, i];\n else ans += dp[2 * N, 0, i];\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 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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n #region ModInt\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\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 #endregion\n #region Binomial Coefficient\n public class 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 #endregion\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "02ff1d3f58978ab49f748d1eebd1f83d", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Mathematics;\nusing CompLib.Util;\n\npublic class Program\n{\n int N;\n string S;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n S = sc.Next();\n\n int[] table;\n {\n table = new int[S.Length];\n table[0] = 0;\n int j = 0;\n for (int i = 1; i < S.Length; i++)\n {\n if (S[i] == S[j])\n {\n table[i] = j++;\n }\n else\n {\n table[i] = j;\n j = 0;\n }\n }\n }\n\n // i\u6587\u5b57\u76ee\u307e\u3067\u69cb\u6210\u3001\u30ab\u30a6\u30f3\u30bf\u3001S\u306e\u4f55\u6587\u5b57\u76ee\u307e\u3067\u3067\u304d\u305f\n var dp = new ModInt[2 * N + 1, N + 1, S.Length + 1];\n dp[0, 0, 0] = 1;\n for (int i = 0; i < 2 * N; i++)\n {\n for (int j = 0; j <= N; j++)\n {\n for (int k = 0; k < S.Length; k++)\n {\n // (\n if (j + 1 <= N)\n {\n int p = k;\n while (p != 0 && S[p] != '(') p = table[p];\n if (S[p] != '(') dp[i + 1, j + 1, 0] += dp[i, j, k];\n else dp[i + 1, j + 1, p + 1] += dp[i, j, k];\n }\n if (j - 1 >= 0)\n {\n int p = k;\n while (p != 0 && S[p] != ')') p = table[p];\n if (S[p] != ')') dp[i + 1, j - 1, 0] += dp[i, j, k];\n else dp[i + 1, j - 1, p + 1] += dp[i, j, k];\n }\n }\n if (j + 1 <= N) dp[i + 1, j + 1, S.Length] += dp[i, j, S.Length];\n if (j - 1 >= 0) dp[i + 1, j - 1, S.Length] += dp[i, j, S.Length];\n }\n }\n Console.WriteLine(dp[2 * N, 0, S.Length]);\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 /// [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\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 #endregion\n #region Binomial Coefficient\n public class 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 #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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9dbe4d222243a963f93ae54619afcbf0", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Mathematics;\nusing CompLib.Util;\n\npublic class Program\n{\n int N;\n string S;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n S = sc.Next();\n\n int[] table;\n {\n table = new int[S.Length + 1];\n table[0] = 0;\n int j = 0;\n for (int i = 1; i < S.Length; i++)\n {\n if (S[i] == S[j])\n {\n table[i] = j++;\n }\n else\n {\n table[i] = j;\n j = 0;\n }\n }\n table[S.Length] = j;\n }\n\n // i\u6587\u5b57\u76ee\u307e\u3067\u69cb\u6210\u3001\u30ab\u30a6\u30f3\u30bf\u3001S\u306e\u4f55\u6587\u5b57\u76ee\u307e\u3067\u3067\u304d\u305f\u3001\u4e00\u5ea6\u3067\u3082S\u3092\u69cb\u6210\u3067\u304d\u305f\u304b?\n var dp = new ModInt[2 * N + 1, N + 1, S.Length, 2];\n dp[0, 0, 0, 0] = 1;\n for (int i = 0; i < 2 * N; i++)\n {\n for (int j = 0; j <= N; j++)\n {\n for (int k = 0; k < S.Length; k++)\n {\n // (\n if (j + 1 <= N)\n {\n int p = k;\n while (p != 0 && (p >= S.Length || S[p] != '(')) p = table[p];\n if (S[p] != '(')\n {\n dp[i + 1, j + 1, 0, 1] += dp[i, j, k, 1];\n dp[i + 1, j + 1, 0, 0] += dp[i, j, k, 0];\n }\n else\n {\n dp[i + 1, j + 1, (p + 1) % S.Length, 1] += dp[i, j, k, 1];\n dp[i + 1, j + 1, (p + 1) % S.Length, (p + 1 == S.Length ? 1 : 0)] += dp[i, j, k, 0];\n }\n }\n if (j - 1 >= 0)\n {\n int p = k;\n while (p != 0 && (p >= S.Length || S[p] != ')')) p = table[p];\n if (S[p] != ')')\n {\n dp[i + 1, j - 1, 0, 1] += dp[i, j, k, 1];\n dp[i + 1, j - 1, 0, 0] += dp[i, j, k, 0];\n }\n else\n {\n dp[i + 1, j - 1, (p + 1) % S.Length, 1] += dp[i, j, k, 1];\n dp[i + 1, j - 1, (p + 1) % S.Length, (p + 1 == S.Length ? 1 : 0)] += dp[i, j, k, 0];\n }\n }\n }\n }\n }\n\n ModInt ans = 0;\n for (int i = 0; i < S.Length; i++)\n {\n ans += dp[2 * N, 0, i, 1];\n }\n Console.WriteLine(ans);\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 /// [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\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 #endregion\n #region Binomial Coefficient\n public class 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 #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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2e12aa2df7315a819ae89fda7af415e1", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections;\n\nnamespace CF954G\n{\n class Program\n {\n\t\tpublic class Global \n\t\t{\n\t\t\tpublic static int[,] len;\n\t\t\tpublic static int[,,,] Dp;\n\t\t}\n\n\t\tstatic void Main(string[] args)\n {\n\t\t\tconst int mod = 1000000007;\n\n\t\t\tint len = Convert.ToInt32(Console.ReadLine());\n\t\t\tstring s = Console.ReadLine(), t = \"\";\n\n\t\t\tGlobal.len = new int[s.Length + 1, 2];\n\t\t\tGlobal.Dp = new int[(len << 1) + 5, (len << 1) + 5, s.Length + 5, 2];\n\t\t\tGlobal.Dp[0, 0, 0, 0] = 1;\n\n\t\t\tif(s[0] == '(') Global.len[0, 0] = 1;\n\t\t\telse Global.len[0, 1] = 1;\n\t\t\tfor(int i = 0; i < s.Length; i++) {\n\t\t\t\tt += s[i];t += '(';\n\t\t\t\tGlobal.len[i + 1, 0] = Match(s, t);\n\t\t\t\tt = t.Remove(t.Length - 1, 1); t += ')';\n\t\t\t\tGlobal.len[i + 1, 1] = Match(s, t);\n\t\t\t\tt = t.Remove(t.Length - 1, 1);\n\t\t\t}\n\n\t\t\tfor(int i = 0; i < (len << 1); i++)\n\t\t\t\tfor(int j = 0; j <= len; j++)\n\t\t\t\t\tfor(int k = 0; k <= s.Length; k++) \n\t\t\t\t\t\tfor(int fin = 0; fin <= 1; fin++) {\n\t\t\t\t\t\t\tif(Global.Dp[i, j, k, fin] == 0) continue;\n\t\t\t\t\t\t\tif(j < len) {\n\t\t\t\t\t\t\t\tGlobal.Dp[i + 1, j + 1, Global.len[k, 0], fin | (Global.len[k, 0] == s.Length ? 1 : 0)] += Global.Dp[i, j, k, fin];\n\t\t\t\t\t\t\t\tGlobal.Dp[i + 1, j + 1, Global.len[k, 0], fin | (Global.len[k, 0] == s.Length ? 1 : 0)] %= mod;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(j > 0) {\n\t\t\t\t\t\t\t\tGlobal.Dp[i + 1, j - 1, Global.len[k, 1], fin | (Global.len[k, 1] == s.Length ? 1 : 0)] += Global.Dp[i, j, k, fin];\n\t\t\t\t\t\t\t\tGlobal.Dp[i + 1, j - 1, Global.len[k, 1], fin | (Global.len[k, 1] == s.Length ? 1 : 0)] %= mod;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\tint _count = 0, final_Len = len << 1;\n\t\t\tfor(int i = 0; i <= s.Length; i++) {\n\t\t\t\t_count += Global.Dp[final_Len, 0, i, 1];\n\t\t\t\t_count %= mod;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(_count.ToString());\n\t\t}\n\n\t\tstatic int Match(string a,string t) {\n\t\t\tfor(int i = Math.Min(t.Length, a.Length); i > 0; i--)\n\t\t\t\tif(a.Substring(0, i) == t.Substring(t.Length - i, i))\n\t\t\t\t\treturn i;\n\t\t\treturn 0;\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e385245ebe1c50bfa1b3973750c60221", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "difficulty": 2300.0} {"lang": "MS C#", "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 long Fun(int a, int b, int c, int v)\n {\n if (b + c > a)\n return 0;\n v = Math.Min(a - b - c, v);\n return 1L * (v + 2) * (v + 1) / 2;\n }\n\n void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n int c = ReadInt();\n int n = ReadInt();\n\n long ans = 0;\n for (int i = 0; i <= n; i++)\n {\n ans += 1L * (i + 1) * (i + 2) / 2;\n ans -= Fun(a + i, b, c, n - i);\n ans -= Fun(b + i, a, c, n - i);\n ans -= Fun(c + i, a, b, n - i);\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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a1db2ccd1d5bedef33fe6de0e4078285", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0} {"lang": "MS C#", "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 table = new CombinationTable(300050);\n var a = sc.Integer();\n var b = sc.Integer();\n var c = sc.Integer();\n var l = sc.Integer();\n long all = 0;\n for (int i = 0; i <= l; i++)\n {\n all += table[i + 2, 2];\n Debug.WriteLine(all);\n }\n var abc = new int[] { a, b, c };\n var sum = a + b + c;\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j <= l; j++)\n {\n var max = abc[i] + j;\n var rem = Math.Min(l - j, max - sum + abc[i]);\n if (rem < 0) continue;\n all -= table[rem + 2, 2];\n }\n }\n IO.Printer.Out.WriteLine(all);\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#region CombinationTable\npublic class CombinationTable\n{\n long[][] nCr;\n public CombinationTable(int n)\n {\n nCr = new long[n + 1][];\n for (int i = 0; i <= n; i++)\n nCr[i] = new long[4];\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 < Math.Min(i + 1, 4); j++)\n nCr[i][j] = (nCr[i - 1][j - 1] + nCr[i - 1][j]);// % mod;\n }\n }\n public long this[int n, int r]\n {\n get\n {\n if (n < 0 || n > nCr.Length)\n return 0;\n if (r < 0 || r > n)\n return 0;\n return nCr[n][r];\n }\n }\n public long RepeatedCombination(int n, int k)\n {\n if (k == 0) return 1;\n return this[n + k - 1, k];\n }\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5f62238fb2da8ff32a94fd8ea43ed0d7", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text;\n\nnamespace C.Lengthening_Sticks\n{\n\tclass TextReaderHelper\n\t{\n\t\tprotected TextReader baseReader;\n\t\tprotected LinkedList buffer;\n\n\t\tpublic TextReaderHelper(TextReader baseReader)\n\t\t{\n\t\t\tthis.baseReader = baseReader;\n\t\t\tbuffer = new LinkedList();\n\t\t}\n\n\t\tprotected void readIfEmpty()\n\t\t{\n\t\t\tif (buffer.Count > 0) return;\n\t\t\tstring line;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tline = baseReader.ReadLine();\n\t\t\t\tif (line == null) return;\n\t\t\t}\n\t\t\twhile (line.Trim() == string.Empty);\n\t\t\tforeach (var item in line.Split(' ', '\\n', '\\t'))\n\t\t\t\tif (item != string.Empty)\n\t\t\t\t\tbuffer.AddLast(item);\n\t\t}\n\n\t\tprivate object readChar()\n\t\t{\n\t\t\tvar node = buffer.First;\n\t\t\tvar ret = node.Value[0];\n\t\t\tif (node.Value.Length > 1) node.Value = node.Value.Substring(1);\n\t\t\telse buffer.RemoveFirst();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic T NextElement()\n\t\t{\n\t\t\treadIfEmpty();\n\t\t\tif (typeof(T) == typeof(char)) return (T)readChar();\n\t\t\tvar ret = (T)Convert.ChangeType(buffer.First.Value, typeof(T));\n\t\t\tbuffer.RemoveFirst();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic int NextInt() { return NextElement(); }\n\n\t\tpublic string NextString() { return NextElement(); }\n\t}\n\n\tclass Program\n\t{\n\t\t[Conditional(\"DEBUG\")]\n\t\tstatic void Pause()\n\t\t{\n\t\t\tConsole.ReadKey();\n\t\t}\n\n\t\tstatic long Calc(int a, int b, int c, int l)\n\t\t{\n\t\t\tif (a < b + c) return 0;\n\t\t\tl = Math.Min(a - b - c, l);\n\t\t\treturn (long)(l + 1) * (l + 2) / 2;\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar reader = new TextReaderHelper(new StreamReader(Console.OpenStandardInput(), Encoding.ASCII, false, 1048576));\n\t\t\tvar writer = new StreamWriter(Console.OpenStandardOutput(), Encoding.ASCII, 1048576);\n\t\t\tint a = reader.NextInt(), b = reader.NextInt(), c = reader.NextInt(), l = reader.NextInt();\n\t\t\tlong ans = (long)(l + 1) * (l + 2) * (l + 3) / 6;\n\t\t\tfor (int i = 0; i <= l; i++)\n\t\t\t{\n\t\t\t\tans -= Calc(a + i, b, c, l - i);\n\t\t\t\tans -= Calc(b + i, a, c, l - i);\n\t\t\t\tans -= Calc(c + i, a, b, l - i);\n\t\t\t}\n\t\t\twriter.WriteLine(ans);\n\t\t\twriter.Flush();\n\t\t\tPause();\n }\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0c1cedf75f7fb2da4266174dad7568af", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0} {"lang": "MS C#", "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 long Sum(int from, int to)\n {\n int len = to - from + 1;\n return 1L * from * len + 1L * len * (len - 1) / 2;\n }\n\n long Fun(int height, int width, int start, int cut)\n {\n long ret = 0;\n if (start - height + 1 <= cut)\n ret += Sum(1, Math.Min(height - 1, cut - start + height));\n if (start <= cut)\n ret += 1L * height * (Math.Min(width, cut - start) + 1);\n if (start + width + 1 <= cut)\n ret += Sum(Math.Max(1, start + width + height - cut), height - 1);\n return ret;\n }\n\n void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n int c = ReadInt();\n int v = ReadInt();\n int s = a + b + c;\n long ans = 0;\n for (int i = 0; i <= v; i++, s++)\n {\n int s2 = (s - 1) / 2;\n int ca = s2 - a;\n int cb = s2 - b;\n int cc = s2 - c;\n if (ca < 0 || cb < 0 || cc < 0)\n continue;\n int min = Math.Min(cb, cc);\n int max = Math.Max(cb, cc);\n ans += Fun(min + 1, max - min, i - cb - cc + min, ca) - Fun(min + 1, max - min, i - cb - cc + min, -1);\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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9ca9cd9efeb6c040f55b9c5c7525dc7a", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Security.Policy;\nusing System.Text;\n\nnamespace Console\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = new List(System.Console.ReadLine().Split(' ').Select(long.Parse));\n var a = arr[0];\n var b = arr[1];\n var c = arr[2];\n var l = arr[3];\n\n long ans = (l + 1)*(l + 2)*(l + 3)/6;\n for (int i = 0; i <= l; ++i)\n {\n ans -= Fun(a + i, b, c, l - i);\n ans -= Fun(b + i, a, c, l - i);\n ans -= Fun(c + i, b, a, l - i);\n }\n System.Console.Write(ans);\n //System.Console.ReadLine();\n }\n\n static long Fun(long a, long b, long c, long x)\n {\n if (a < b + c)\n return 0;\n var min = Math.Min(a - b - c, x);\n return (min + 1)*(min + 2)/2;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2d15e624951068a9f16f61ef70fcb4b2", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Security.Policy;\nusing System.Text;\n\nnamespace Console\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = new List(System.Console.ReadLine().Split(' ').Select(int.Parse));\n var a = arr[0];\n var b = arr[1];\n var c = arr[2];\n var l = arr[3];\n\n var ans = (l + 1)*(l + 2)*(l + 3)/6;\n for (int i = 0; i <= l; ++i)\n {\n ans -= Fun(a + i, b, c, l - i);\n ans -= Fun(b + i, a, c, l - i);\n ans -= Fun(c + i, b, a, l - i);\n }\n System.Console.Write(ans);\n //System.Console.ReadLine();\n }\n\n static int Fun(int a, int b, int c, int x)\n {\n if (a < b + c)\n return 0;\n var min = Math.Min(a - b - c, x);\n return (min + 1)*(min + 2)/2;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "572ae530218924f64710406643a1dd74", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ForAll\n{\n class Program\n {\n \n \n static void Main(string[] args)\n {\n Int64[] parametrs = Array.ConvertAll(Console.ReadLine().Split(' '),Int64.Parse);\n\n Int64 n = parametrs[0], l = parametrs[1],r = parametrs[2];\n\n Int64 lengthString = (Int64)Math.Pow(2, ((Int64)Math.Log(n, 2)) + 1) - 1;\n\n int counter = 0;\n for (Int64 i = l; i < r + 1; i++)\n {\n if (BinarySearch(lengthString, n, i) == 1)\n counter++;\n }\n\n Console.WriteLine(counter);\n }\n\n static int BinarySearch(Int64 lengthValue,Int64 root,Int64 index)\n {\n Int64 current = lengthValue / 2 + 1;\n Int64 path = current;\n while (current != index) \n {\n path = path >> 1;\n if (index < current)\n current = current - path;\n else\n current = current + path;\n root = root >> 1;\n }\n\n if (index % 2 == 0)\n return (int)(root % 2);\n else return (int)(root);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "41344ed6c56c42fb64d940e5f8ef76ba", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate Dictionary, long> dp; \n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tdp = new Dictionary, long>();\n\n\t\t\tvar n = cin.NextLong();\n\t\t\tvar l = cin.NextLong();\n\t\t\tvar r = cin.NextLong();\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\tvar count = Count(n, l, r);\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\n\t\tprivate long Count(long n, long l, long r)\n\t\t{\n\t\t\tif (n == 1)\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif (dp.ContainsKey(Tuple.Create(n, l, r)))\n\t\t\t{\n\t\t\t\treturn dp[Tuple.Create(n, l, r)];\n\t\t\t}\n\n\t\t\tvar idx = 0;\n\t\t\tvar nn = n;\n\t\t\twhile (nn > 1)\n\t\t\t{\n\t\t\t\tidx++;\n\t\t\t\tnn/=2;\n\t\t\t}\n\t\t\tvar len = 1;\n\t\t\tfor (var i = 0; i < idx; i++)\n\t\t\t{\n\t\t\t\tlen *= 2;\n\t\t\t\tlen++;\n\t\t\t}\n\t\t\tvar middle = len/2;\n\t\t\tvar sum = 0L;\n\t\t\tif (l <= middle && r >= middle)\n\t\t\t{\n\t\t\t\tsum += n%2;\n\t\t\t\tif (l < middle)\n\t\t\t\t{\n\t\t\t\t\tsum += Count(n/2, l, middle - 1);\n\t\t\t\t}\n\t\t\t\tif (r > middle)\n\t\t\t\t{\n\t\t\t\t\tsum += Count(n/2, 0, r - middle - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (l < middle)\n\t\t\t{\n\t\t\t\tsum += Count(n/2, l, r);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsum += Count(n/2, l - middle - 1, r - middle - 1);\n\t\t\t}\n\t\t\tdp[Tuple.Create(n, l, r)] = sum;\n\t\t\treturn sum;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "83b6b72ff4cfb4bcb842152618ed1904", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate Dictionary, long> dp; \n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tdp = new Dictionary, long>();\n\n\t\t\tvar n = cin.NextLong();\n\t\t\tvar l = cin.NextLong();\n\t\t\tvar r = cin.NextLong();\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\tvar count = Count(n, l-1, r-1);\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\n\t\tprivate long Count(long n, long l, long r)\n\t\t{\n\t\t\tif (n == 1)\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif (dp.ContainsKey(Tuple.Create(n, l, r)))\n\t\t\t{\n\t\t\t\treturn dp[Tuple.Create(n, l, r)];\n\t\t\t}\n\n\t\t\tvar idx = 0;\n\t\t\tvar nn = n;\n\t\t\twhile (nn > 1)\n\t\t\t{\n\t\t\t\tidx++;\n\t\t\t\tnn/=2;\n\t\t\t}\n\t\t\tvar len = 1;\n\t\t\tfor (var i = 0; i < idx; i++)\n\t\t\t{\n\t\t\t\tlen *= 2;\n\t\t\t\tlen++;\n\t\t\t}\n\t\t\tvar middle = len/2;\n\t\t\tvar sum = 0L;\n\t\t\tif (l <= middle && r >= middle)\n\t\t\t{\n\t\t\t\tsum += n%2;\n\t\t\t\tif (l < middle)\n\t\t\t\t{\n\t\t\t\t\tsum += Count(n/2, l, middle - 1);\n\t\t\t\t}\n\t\t\t\tif (r > middle)\n\t\t\t\t{\n\t\t\t\t\tsum += Count(n/2, 0, r - middle - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (l < middle)\n\t\t\t{\n\t\t\t\tsum += Count(n/2, l, r);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsum += Count(n/2, l - middle - 1, r - middle - 1);\n\t\t\t}\n\t\t\tdp[Tuple.Create(n, l, r)] = sum;\n\t\t\treturn sum;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3f9d2cd7575595b59c82e543c862c1bb", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeff\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 private long l;\n private long r;\n private int answ;\n\n public void Solve(InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int64.Parse);\n var n = input[0];\n l = input[1];\n r = input[2];\n Divide(n, 1L);\n sw.WriteLine(answ);\n }\n\n private void Divide(long n, long indx)\n {\n if (indx > r) {\n return;\n }\n if (n == 0 || n == 1) {\n if (indx >= l && indx <= r && n == 1L) {\n answ++;\n }\n return;\n }\n var log = (long)Math.Floor(Math.Log(n, 2)) + 1L;\n var power = (long) Math.Pow(2, log) / 2 - 1L;\n if (indx + power*2 < l) {\n return;\n }\n Divide(n / 2, indx);\n if (indx + power >= l && indx + power <= r && n % 2 == 1L)\n {\n answ++;\n }\n Divide(n / 2, indx + power + 1L);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b25bd49c937bef3d8c27fd5b0ade060f", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ForAll\n{\n class Program\n {\n \n \n static void Main(string[] args)\n {\n Int64[] parametrs = Array.ConvertAll(Console.ReadLine().Split(' '),Int64.Parse);\n\n var n = parametrs[0];int l = (int)parametrs[1],r = (int)parametrs[2];\n\n int lengthString = (int)Math.Pow(2, ((int)Math.Log(n, 2)) + 1) - 1;\n\n int index = l;\n\n int counter = 0;\n for (int i = l; i < r + 1; i++)\n {\n if (BinarySearch(lengthString, n, i) == 1)\n counter++;\n }\n\n Console.WriteLine(counter);\n }\n\n static int BinarySearch(int lengthValue,Int64 root,int index)\n {\n int current = lengthValue / 2 + 1;\n int path = current;\n while (current != index) \n {\n path = path >> 1;\n if (index < current)\n current = current - path;\n else\n current = current + path;\n root = root >> 1;\n }\n\n if (index % 2 == 0)\n return (int)(root % 2);\n else return (int)(root);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "26d60fcfdb84c3e0c3aec85a54781043", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate Dictionary, long> dp; \n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tdp = new Dictionary, long>();\n\n\t\t\tvar n = cin.NextLong();\n\t\t\tvar l = cin.NextLong();\n\t\t\tvar r = cin.NextLong();\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\tvar count = Count(n, l-1, r-1);\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\n\t\tprivate long Count(long n, long l, long r)\n\t\t{\n\t\t\tif (n == 1)\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif (dp.ContainsKey(Tuple.Create(n, l, r)))\n\t\t\t{\n\t\t\t\treturn dp[Tuple.Create(n, l, r)];\n\t\t\t}\n\n\t\t\tvar idx = 0;\n\t\t\tvar nn = n;\n\t\t\twhile (nn > 1)\n\t\t\t{\n\t\t\t\tidx++;\n\t\t\t\tnn/=2;\n\t\t\t}\n\t\t\tvar len = 1L;\n\t\t\tfor (var i = 0; i < idx; i++)\n\t\t\t{\n\t\t\t\tlen *= 2;\n\t\t\t\tlen++;\n\t\t\t}\n\t\t\tvar middle = len/2;\n\t\t\tvar sum = 0L;\n\t\t\tif (l <= middle && r >= middle)\n\t\t\t{\n\t\t\t\tsum += n%2;\n\t\t\t\tif (l < middle)\n\t\t\t\t{\n\t\t\t\t\tsum += Count(n/2, l, middle - 1);\n\t\t\t\t}\n\t\t\t\tif (r > middle)\n\t\t\t\t{\n\t\t\t\t\tsum += Count(n/2, 0, r - middle - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (l < middle)\n\t\t\t{\n\t\t\t\tsum += Count(n/2, l, r);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsum += Count(n/2, l - middle - 1, r - middle - 1);\n\t\t\t}\n\t\t\tdp[Tuple.Create(n, l, r)] = sum;\n\t\t\treturn sum;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "215a31fc892d0ea85a80170c6a909fe2", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Code_For_1\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 long l = Next();\n long r = Next();\n\n\n string s = Convert.ToString(n, 2);\n\n long step = 1;\n long sum = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '1')\n {\n long bl = (l - step + 2*step - 1)/(2*step);\n long br = (r + 1 - step + 2*step - 1)/(2*step);\n sum += br - bl;\n }\n\n step *= 2;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "07574f7d61793ac63cabf79e0dde4023", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate Dictionary, long> dp; \n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tdp = new Dictionary, long>();\n\n\t\t\tvar n = cin.NextLong();\n\t\t\tvar l = cin.NextLong();\n\t\t\tvar r = cin.NextLong();\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\tvar count = Count(n, l, r);\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\n\t\tprivate long Count(long n, int l, int r)\n\t\t{\n\t\t\tif (n == 1)\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif (dp.ContainsKey(Tuple.Create(n, l, r)))\n\t\t\t{\n\t\t\t\treturn dp[Tuple.Create(n, l, r)];\n\t\t\t}\n\n\t\t\tvar idx = 0;\n\t\t\tvar nn = n;\n\t\t\twhile (nn > 1)\n\t\t\t{\n\t\t\t\tidx++;\n\t\t\t\tnn/=2;\n\t\t\t}\n\t\t\tvar len = 1;\n\t\t\tfor (var i = 0; i < idx; i++)\n\t\t\t{\n\t\t\t\tlen *= 2;\n\t\t\t\tlen++;\n\t\t\t}\n\t\t\tvar middle = len/2;\n\t\t\tvar sum = 0L;\n\t\t\tif (l <= middle && r >= middle)\n\t\t\t{\n\t\t\t\tsum += n%2;\n\t\t\t\tif (l < middle)\n\t\t\t\t{\n\t\t\t\t\tsum += Count(n/2, l, middle - 1);\n\t\t\t\t}\n\t\t\t\tif (r > middle)\n\t\t\t\t{\n\t\t\t\t\tsum += Count(n/2, 0, r - middle - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (l < middle)\n\t\t\t{\n\t\t\t\tsum += Count(n/2, l, r);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsum += Count(n/2, l - middle - 1, r - middle - 1);\n\t\t\t}\n\t\t\tdp[Tuple.Create(n, l, r)] = sum;\n\t\t\treturn sum;\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e850524778d09165a3aedb155aa4eb24", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "Mono C#", "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 public class Heap where T : IComparable\n {\n private T[] heap;\n private int size;\n\n public Heap(int capacity)\n {\n heap = new T[capacity + 1];\n this.size = 0;\n }\n\n public Heap(IEnumerable items)\n {\n var arr = items.ToArray();\n Array.Sort(arr);\n this.heap = new T[items.Count() + 1];\n Array.Copy(arr, 0, this.heap, 1, arr.Length);\n }\n\n public void Add(T x)\n {\n\n this.heap[++size] = x;\n UpdateDown(size);\n }\n\n public T Get()\n {\n return this.heap[1];\n }\n\n public T Pop()\n {\n var ans = this.heap[1];\n this.Swap(1, this.size);\n this.size--;\n this.UpdateTop(1);\n return ans;\n }\n\n public int Size()\n {\n return this.size;\n }\n\n private void UpdateTop(int t)\n {\n while (true)\n {\n int min = t;\n if (t + t <= size && this.heap[t + t].CompareTo(this.heap[min]) < 0) min = t + t;\n if (t + t + 1 <= size && this.heap[t + t + 1].CompareTo(this.heap[min]) < 0) min = t + t + 1;\n if (min == t) return;\n\n T tmp = this.heap[min];\n this.heap[min] = this.heap[t];\n this.heap[t] = tmp;\n\n t = min;\n }\n }\n\n private void UpdateDown(int t)\n {\n while (t > 1 && this.heap[t >> 1].CompareTo(this.heap[t]) > 0)\n {\n Swap(t >> 1, t);\n t /= 2;\n }\n }\n\n private void Swap(int a, int b)\n {\n T tmp = this.heap[a];\n this.heap[a] = this.heap[b];\n this.heap[b] = tmp;\n }\n }\n public class State : IComparable\n {\n public int Pos;\n public int Time;\n public int Count;\n\n public int CompareTo(State other)\n {\n return c[this.Pos].CompareTo(c[other.Pos]);\n }\n }\n\n private static int[] c;\n public static void Main(string[] args)\n {\n PushTestData(@\"\n2 1 15\n5 6\nRG\n\n5 3 10\n1 2 3 4 5\nRGBRR\n\n\n\n\n\");\n var n = RI();\n var s = RI() - 1;\n var k = RI();\n c = RIA(n);\n var color = ReadStringLine();\n\n var heap = new Heap(5000000);\n\n var dp = new int[n, 2501];\n var handled = new bool[n, 2501];\n\n for (int i = 0; i < n; i++)\n {\n heap.Add(new State() { Pos = i, Count = c[i], Time = Math.Abs(i - s) });\n dp[i, Math.Abs(i - s)] = c[i];\n }\n\n while (heap.Size() > 0)\n {\n var ss = heap.Pop();\n if (handled[ss.Pos, ss.Time]) continue;\n handled[ss.Pos, ss.Time] = true;\n ss.Count = dp[ss.Pos, ss.Time];\n\n for (int i = 0; i < n; i++)\n {\n if (c[i] > c[ss.Pos] && color[i] != color[ss.Pos])\n {\n var tm = ss.Time + Math.Abs(i - ss.Pos);\n var cnt = ss.Count + c[i];\n if (dp[i, tm] == 0)\n {\n heap.Add(new State() { Pos = i, Count = cnt, Time = tm });\n }\n\n dp[i, tm] = Math.Max(dp[i, tm], cnt);\n }\n }\n }\n\n for (int j = 0; j < 2501; j++)\n for (int i = 0; i < n; i++)\n if (dp[i, j] >= k)\n {\n Console.WriteLine(j);\n return;\n }\n\n Console.WriteLine(-1);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\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\n private static List[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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.Length;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d19bed340d72f95ac5291271ac04765c", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace mailru2018\n{\n class MainClass\n {\n class Box\n {\n public int pos;\n public int candy;\n public int color;\n }\n\n static int n, s, k;\n static Box[] r;\n\n static int[,] dp;\n\n static int find(int at, int candy)\n {\n if (candy >= k)\n return 0;\n\n if (dp[at, candy] != -1)\n return dp[at, candy];\n\n int result = int.MaxValue;\n\n for (int i = at + 1; i < n; ++i)\n {\n if (r[i].color != r[at].color && r[i].candy > r[at].candy)\n {\n int v = find(i, candy + r[i].candy);\n if (v != int.MaxValue)\n result = Math.Min(result, v + Math.Abs(r[at].pos - r[i].pos));\n }\n }\n\n dp[at, candy] = result;\n return result;\n }\n\n public static void Main(string[] args)\n {\n //var line = Array.ConvertAll(\"5 3 10\".Split(' '), int.Parse);\n var line = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n n = line[0];\n s = line[1] - 1;\n k = line[2];\n\n r = new Box[n];\n //line = Array.ConvertAll(\"1 2 3 4 5\".Split(' '), int.Parse);\n line = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n //var color = \"RGBRR\";\n var color = Console.ReadLine();\n\n for (int i = 0; i < n; ++i)\n {\n var box = new Box();\n box.pos = i;\n box.candy = line[i];\n box.color = color[i];\n r[i] = box;\n }\n\n Array.Sort(r, (x, y) => {\n return x.candy - y.candy;\n });\n\n dp = new int[n, 2018];\n for (int i = 0; i < n; ++i)\n for (int j = 0; j < 2018; ++j)\n dp[i, j] = -1;\n\n int result = int.MaxValue;\n for (int i = 0; i < n; ++i)\n {\n var v = find(i, r[i].candy);\n\n if (v != int.MaxValue)\n result = Math.Min(result, v + Math.Abs(s - r[i].pos));\n }\n\n if (result == int.MaxValue)\n result = -1;\n\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e22ed6152497e7b0a2c25052dd991e8b", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharpParser\n{\n public class Solution : SolutionBase\n {\n protected override void Solve()\n {\n int n;\n Next(out n);\n int s;\n Next(out s);\n --s;\n int k;\n Next(out k);\n var a = NextArray(n);\n string c;\n Next(out c);\n var m = a.Sum() + 1;\n var d = new int[n, m];\n for (var i = 0; i < n; i++)\n {\n for (var j = 0; j < m; j++)\n d[i, j] = int.MaxValue;\n d[i, a[i]] = Math.Abs(s - i);\n }\n var u = new bool[n];\n while (true)\n {\n var i = -1;\n for (var l = 0; l < n; l++)\n if (!u[l] && (i == -1 || a[i] > a[l]))\n i = l;\n if (i == -1) break;\n u[i] = true;\n for (var j = 0; j < m; j++)\n if (d[i, j] != int.MaxValue)\n for (var l = 0; l < n; l++)\n if (a[l] > a[i] && c[l] != c[i])\n d[l, j + a[l]] = Math.Min(d[l, j + a[l]], d[i, j] + Math.Abs(i - l));\n }\n var ans = int.MaxValue;\n for (var i = 0; i < n; i++)\n for (var j = k; j < m; j++)\n ans = Math.Min(ans, d[i, j]);\n PrintLine(ans == int.MaxValue ? -1 : ans);\n }\n }\n\n public static class Algorithm\n {\n private static readonly Random Rnd = new Random();\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(IList a, int index, int length)\n {\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n var last = index + length;\n if (last > a.Count) throw new ArgumentException();\n for (var i = index + 1; i < last; i++)\n {\n var j = Rnd.Next(index, i + 1);\n var t = a[i];\n a[i] = a[j];\n a[j] = t;\n }\n }\n\n public static void RandomShuffle(IList a)\n {\n RandomShuffle(a, 0, a.Count);\n }\n\n public static bool NextPermutation(IList 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.Count) 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 var t = a[i - 1];\n a[i - 1] = a[j - 1];\n a[j - 1] = t;\n for (; i < last - 1; i++, last--)\n {\n t = a[i];\n a[i] = a[last - 1];\n a[last - 1] = t;\n }\n return true;\n }\n for (var i = index; i < last - 1; i++, last--)\n {\n var t = a[i];\n a[i] = a[last - 1];\n a[last - 1] = t;\n }\n return false;\n }\n\n public static bool NextPermutation(IList a, Comparison compare = null)\n {\n return NextPermutation(a, 0, a.Count, compare);\n }\n\n public static bool PrevPermutation(IList 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.Count) 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 var t = a[i - 1];\n a[i - 1] = a[j - 1];\n a[j - 1] = t;\n for (; i < last - 1; i++, last--)\n {\n t = a[i];\n a[i] = a[last - 1];\n a[last - 1] = t;\n }\n return true;\n }\n for (var i = index; i < last - 1; i++, last--)\n {\n var t = a[i];\n a[i] = a[last - 1];\n a[last - 1] = t;\n }\n return false;\n }\n\n public static bool PrevPermutation(IList a, Comparison compare = null)\n {\n return PrevPermutation(a, 0, a.Count, 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 public static void Fill(this IList array, T value) where T : struct\n {\n for (var i = 0; i < array.Count; i++)\n array[i] = value;\n }\n\n public static void Fill(this IList array, Func func)\n {\n for (var i = 0; i < array.Count; i++)\n array[i] = func(i);\n }\n }\n\n public class InStream : IDisposable\n {\n protected readonly TextReader InputStream;\n private string[] _tokens;\n private int _pointer;\n\n private InStream(TextReader inputStream)\n {\n InputStream = inputStream;\n }\n\n public static InStream FromString(string str)\n {\n return new InStream(new StringReader(str));\n }\n\n public static InStream FromFile(string str)\n {\n return new InStream(new StreamReader(str));\n }\n\n public static InStream FromConsole()\n {\n return new InStream(Console.In);\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 T[] NextArray(int length)\n {\n var array = new T[length];\n for (var i = 0; i < length; i++)\n if (!Next(out array[i]))\n return null;\n return array;\n }\n\n public T[,] NextArray(int length, int width)\n {\n var array = new T[length, width];\n for (var i = 0; i < length; i++)\n for (var j = 0; j < width; j++)\n if (!Next(out array[i, j]))\n return null;\n return array;\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 private OutStream(TextWriter outputStream)\n {\n OutputStream = outputStream;\n }\n\n public static OutStream FromString(System.Text.StringBuilder strB)\n {\n return new OutStream(new StringWriter(strB));\n }\n\n public static OutStream FromFile(string str)\n {\n return new OutStream(new StreamWriter(str));\n }\n\n public static OutStream FromConsole()\n {\n return new OutStream(Console.Out);\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 PrintArray(IList a, string between = \" \", string after = \"\\n\", bool printCount = false)\n {\n if (printCount)\n PrintLine(a.Count);\n for (var i = 0; i < a.Count; i++)\n Print(\"{0}{1}\", a[i], i == a.Count - 1 ? after : between);\n }\n\n public void Dispose()\n {\n OutputStream.Close();\n }\n }\n\n public abstract class SolutionBase : IDisposable\n {\n private InStream _in;\n private OutStream _out;\n\n protected SolutionBase()\n {\n //System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;\n _in = InStream.FromConsole();\n _out = OutStream.FromConsole();\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 return _in.NextArray(length);\n }\n\n protected T[,] NextArray(int length, int width)\n {\n return _in.NextArray(length, width);\n }\n\n protected void PrintArray(IList a, string between = \" \", string after = \"\\n\", bool printCount = false)\n {\n _out.PrintArray(a, between, after, printCount);\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 _in.Dispose();\n _out.Dispose();\n }\n\n public void Freopen(string path, FileAccess access)\n {\n switch (access)\n {\n case FileAccess.Read:\n _in.Dispose();\n _in = InStream.FromFile(path);\n break;\n case FileAccess.Write:\n _out.Dispose();\n _out = OutStream.FromFile(path);\n break;\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e3028a8aa7ec5fbe1a026a06e02c0497", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _1057\u0421\n{\n class Program\n {\n static readonly int INF = 1000000000;\n static int n, s, k;\n static int[] r;\n static int[][] dps;\n\n static bool[] dpsc;\n static string clr;\n static void Main(string[] args)\n {\n (n, s, k) = r3i();\n r = ris();\n s--;\n clr = Console.ReadLine();\n dpsc = new bool[n];\n dps = new int[n][];\n int result = INF;\n for (int i = 0; i < n; i++)\n {\n dp(i);\n result = Math.Min(result, dps[i][k] + Math.Abs(s-i));\n }\n Console.WriteLine(result == INF ? -1 : result);\n }\n\n static void dp(int cur)\n {\n if (dps[cur] != null)\n return;\n dps[cur] = new int[k+1];\n for (int i = r[cur]+1; i < k + 1; i++)\n {\n dps[cur][i] = INF;\n }\n for (int to = 0; to < n; to++)\n {\n if (r[to] > r[cur] && clr[to] != clr[cur])\n {\n dp(to);\n for (int i = r[cur] + 1; i < k + 1; i++)\n {\n dps[cur][i] = Math.Min(dps[cur][i], dps[to][i-r[cur]] + Math.Abs(cur-to));\n }\n }\n }\n }\n\n\n static int[] ris()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), i => Int32.Parse(i));\n }\n\n static int ri()\n {\n var i = Console.ReadLine();\n return Int32.Parse(i);\n }\n static (int, int) r2i()\n {\n var i = Console.ReadLine().Split(' ');\n return (Int32.Parse(i[0]), Int32.Parse(i[1]));\n }\n static (int, int, int) r3i()\n {\n var i = Console.ReadLine().Split(' ');\n return (Int32.Parse(i[0]), Int32.Parse(i[1]), Int32.Parse(i[2]));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bdb669612052970266e7e158e8ef76db", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace _1057\u0421\n{\n class Program\n {\n static readonly int INF = 1000000000;\n static int n, s, k;\n static int[] r;\n static int[][] dps;\n\n static bool[] dpsc;\n static string clr;\n static void Main(string[] args)\n {\n (n, s, k) = r3i();\n r = ris();\n s--;\n clr = Console.ReadLine();\n dpsc = new bool[n];\n dps = new int[n][];\n int result = INF;\n for (int i = 0; i < n; i++)\n {\n dp(i);\n result = Math.Min(result, dps[i][k] + Math.Abs(s-i));\n }\n Console.WriteLine(result == INF ? -1 : result);\n }\n\n static void dp(int cur)\n {\n if (dps[cur] != null)\n return;\n dps[cur] = new int[k+1];\n for (int i = r[cur] + 1; i < k + 1; i++)\n {\n dps[cur][i] = INF;\n }\n for (int to = 0; to < n; to++)\n {\n if (r[to] < r[cur] && clr[to] != clr[cur])\n {\n dp(to);\n for (int i = r[cur] + 1; i < k + 1; i++)\n {\n dps[cur][i] = Math.Min(dps[cur][i], dps[to][i-r[cur]] + Math.Abs(cur-to));\n }\n }\n }\n }\n\n\n static int[] ris()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), i => Int32.Parse(i));\n }\n\n static int ri()\n {\n var i = Console.ReadLine();\n return Int32.Parse(i);\n }\n static (int, int) r2i()\n {\n var i = Console.ReadLine().Split(' ');\n return (Int32.Parse(i[0]), Int32.Parse(i[1]));\n }\n static (int, int, int) r3i()\n {\n var i = Console.ReadLine().Split(' ');\n return (Int32.Parse(i[0]), Int32.Parse(i[1]), Int32.Parse(i[2]));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "87c2bb9e37b11c9a2cb07c15af9cb90e", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "difficulty": 2000.0} {"lang": "Mono C#", "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 public class Heap where T : IComparable\n {\n private T[] heap;\n private int size;\n\n public Heap(int capacity)\n {\n heap = new T[capacity + 1];\n this.size = 0;\n }\n\n public Heap(IEnumerable items)\n {\n var arr = items.ToArray();\n Array.Sort(arr);\n this.heap = new T[items.Count() + 1];\n Array.Copy(arr, 0, this.heap, 1, arr.Length);\n }\n\n public void Add(T x)\n {\n this.heap[++size] = x;\n UpdateDown(size);\n }\n\n public T Get()\n {\n return this.heap[1];\n }\n\n public T Pop()\n {\n var ans = this.heap[1];\n this.Swap(1, this.size);\n this.size--;\n this.UpdateTop(1);\n return ans;\n }\n\n public int Size()\n {\n return this.size;\n }\n\n private void UpdateTop(int t)\n {\n while (true)\n {\n int min = t;\n if (t + t <= size && this.heap[t + t].CompareTo(this.heap[min]) < 0) min = t + t;\n if (t + t + 1 <= size && this.heap[t + t + 1].CompareTo(this.heap[min]) < 0) min = t + t + 1;\n if (min == t) return;\n\n T tmp = this.heap[min];\n this.heap[min] = this.heap[t];\n this.heap[t] = tmp;\n\n t = min;\n }\n }\n\n private void UpdateDown(int t)\n {\n while (t > 1 && this.heap[t >> 1].CompareTo(this.heap[t]) > 0)\n {\n Swap(t >> 1, t);\n t /= 2;\n }\n }\n\n private void Swap(int a, int b)\n {\n T tmp = this.heap[a];\n this.heap[a] = this.heap[b];\n this.heap[b] = tmp;\n }\n }\n public class State : IComparable\n {\n public int Pos;\n public int Time;\n public int Count;\n\n public int CompareTo(State other)\n {\n return c[this.Pos].CompareTo(c[other.Pos]);\n }\n }\n\n private static int[] c;\n public static void Main(string[] args)\n {\n PushTestData(@\"\n2 1 15\n5 6\nRG\n\n5 3 10\n1 2 3 4 5\nRGBRR\n\");\n var n = RI();\n var s = RI() - 1;\n var k = RI();\n c = RIA(n);\n var color = ReadStringLine();\n\n var heap = new Heap(5000000);\n\n var dp = new int[n, 2501];\n var handled = new bool[n, 2501];\n\n for (int i = 0; i < n; i++)\n heap.Add(new State() { Pos = i, Count = c[i], Time = Math.Abs(i - s) });\n\n while (heap.Size() > 0)\n {\n var ss = heap.Pop();\n if (handled[ss.Pos, ss.Time]) continue;\n handled[ss.Pos, ss.Time] = true;\n\n for (int i = 0; i < n; i++)\n {\n if (c[i] > c[ss.Pos] && color[i] != color[ss.Pos])\n {\n var tm = ss.Time + Math.Abs(i - ss.Pos);\n var cnt = ss.Count + c[i];\n if (dp[i, tm] == 0)\n {\n heap.Add(new State() { Pos = i, Count = cnt, Time = tm });\n }\n\n dp[i, tm] = Math.Max(dp[i, tm], cnt);\n }\n }\n }\n\n for (int j = 0; j < 2501; j++)\n for (int i = 0; i < n; i++)\n if (dp[i, j] >= k)\n {\n Console.WriteLine(j);\n return;\n }\n\n Console.WriteLine(-1);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\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\n private static List[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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.Length;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bb1d254d34995565aa0c81dd6c5cf4b0", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "difficulty": 2000.0} {"lang": "Mono C#", "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\tint n = nums [0];\n\t\tint s = nums [1];\n\t\tint target = nums [2];\n\t\tint[] v = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();\n\t\tstring c = Console.ReadLine ();\n\n\t\tList nodes = new List ();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnodes.Add (new Node (i, v [i], c [i]));\n\t\t}\n\t\tnodes.ForEach (node => node.AddNeighbors (nodes));\n\n\t\tNode initialNode = new Node (s - 1, 0, ' ');\n\t\tinitialNode.Neighbors = nodes;\n\n\t\tList[] search = new List[n * n + 2];\n\t\tfor (int i = 0; i < search.Length; i++) {\n\t\t\tsearch [i] = new List ();\n\t\t}\n\t\tsearch [0].Add (new State{ Missing = target, Current = initialNode });\n\n\t\tfor (int t = 0; t < search.Length; t++) {\n\t\t\tforeach (State state in search[t]) {\n\t\t\t\tif (state.Solved) {\n\t\t\t\t\tConsole.WriteLine (t - 1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tforeach (State s2 in state.Expand()) {\n\t\t\t\t\tsearch [s2.Time].Add (s2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine (-1);\n\t}\n\n\tclass State {\n\t\tpublic int Missing;\n\t\tpublic Node Current;\n\t\tpublic int Time;\n\n\t\tpublic bool Solved => Missing <= 0;\n\n\t\tpublic IEnumerable Expand() {\n\t\t\tforeach(Node n in Current.Neighbors) {\n\t\t\t\tState s = new State();\n\t\t\t\ts.Current = n;\n\t\t\t\ts.Missing = Missing - n.Value;\n\t\t\t\ts.Time = Time + Current.Dist(n);\n\t\t\t\tyield return s;\n\t\t\t}\n\t\t}\n\t}\n\n\tclass Node {\n\t\tpublic int Index;\n\t\tpublic int Value;\n\t\tpublic char Color;\n\t\tpublic List Neighbors;\n\n\t\tpublic Node(int index, int value, char color) {\n\t\t\tthis.Index = index;\n\t\t\tthis.Value = value;\n\t\t\tthis.Color = color;\n\t\t}\n\n\t\tpublic int Dist(Node n) {\n\t\t\treturn Math.Abs(Index - n.Index) + (Color == ' ' ? 1 : 0);\n\t\t}\n\n\t\tpublic void AddNeighbors(List nodes) {\n\t\t\tNeighbors = nodes.Where (n => n.Color != this.Color && n.Value > this.Value).ToList ();\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "704dd1d10299d3bd7b2ace8650676a1e", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "difficulty": 2000.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b73392c75403883540e28372e8add694", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4caaa59397a914b69621895c23f0ddb4", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ef339f25233ed344df4baa10dc310b9", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d8b8ea7ede2c850a33c2943dab75fac4", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec2c41a61a4b759725e33be7788854d0", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1b481afef268dfce63b328b45f6e75a3", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "94d6126ed9f99f392d9600624767ca7b", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f63300ff72f2aa2685ee30b86bfd1860", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "61db1cebc0a2b0ccb32f9ae572ecd1a9", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "32d8e7591f665dcbc2e3f84268880fc7", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "47691c7b37f4af0ad6412a01bb5a0089", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f8e14b22262aef6f265c7eb7dccbfe1d", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0a4c8c1e61aef4b92e07b85b4adc7caa", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8bcae1993aef8f982a1d28c531ddd1d1", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "82371d419f03e92dfa794048bab97725", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1075632829d5dd8c3e4ce302bc43351c", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "59480306a10c1ced40434e54b16b8401", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ffeac97fee13340fba203212be41fcf8", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ba8ddfc2bd1d8cbf3bb0884f77d83b64", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e0d7a399e37f150a52be641b99efc716", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "Mono C#", "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 ret = Math.Max(ret, (a * b + 1) / 2);\n return dp[a, b] = ret;\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fc9cc456c2aee58cdffb99c99393ef27", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\n\nnamespace E\n{\n class Program\n {\n static void Main(string[] args)\n {\n int days = int.Parse(Console.ReadLine());\n var _temp = Console.ReadLine().Split(' ');\n\n bool _flag = true;\n int zeroDay, secondDay, progress, expectedTemp, currTemp = 0;\n\n\n\n zeroDay = int.Parse(_temp[0]);\n secondDay = int.Parse(_temp[1]);\n\n progress = secondDay - zeroDay;\n if (days >= 3)\n {\n for (int i = 1; i < days; i++)\n {\n currTemp = int.Parse(_temp[i]);\n expectedTemp = int.Parse(_temp[i - 1]) + progress;\n if(currTemp != expectedTemp)\n {\n _flag = false;\n break;\n }\n }\n if(_flag)\n {\n Console.WriteLine(currTemp + progress);\n \n }\n else\n {\n Console.WriteLine(_temp[days - 1]);\n }\n\n }\n else\n {\n expectedTemp = zeroDay + progress * (days - 1);\n\n if (int.Parse(_temp[days - 1]) == expectedTemp)\n {\n Console.WriteLine(expectedTemp + progress);\n\n }\n else\n Console.WriteLine(_temp[days - 1]);\n }\n\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a4163c24767e746f7787f87a3a0ac57", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "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\tint[] ar = Array.ConvertAll(Console.ReadLine().Split(' '), t => Convert.ToInt32(t));\n\n\t\tvar ratio = ar[1] - ar[0];\n\t\tfor (var i = 2; i < n; i++)\n\t\t{\n\t\t\tif (ratio != ar[i] - ar[i-1])\n\t\t\t{\n\t\t\t\tratio = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (ratio == 0)\n\t\t\tConsole.WriteLine(ar[n-1]);\n\t\telse\n\t\t\tConsole.WriteLine(ar[n-1]+ratio);\n\t\t\n\t}\n\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0dbf8193fdd5a54eb9e0b7e66b98c0dd", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "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 int n, k,a=0;\n n = Convert.ToInt32(Console.ReadLine());\n n--;\n string[] t = Console.ReadLine().Split();\n\n k = Convert.ToInt32(t[n]) - Convert.ToInt32(t[n - 1]);\n\n for (int i = 0; i <= n-1; i++) \n if (Convert.ToInt32(t[i + 1]) - Convert.ToInt32(t[i]) == k) a++;\n \n if (a == n) Console.WriteLine(Convert.ToInt32(t[n]) + k);\n else Console.WriteLine(Convert.ToInt32(t[n]));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6e4309129ec1b23064eea68d1b062682", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1A\n{\n class ProgramBBB\n {\n static void Main(string[] args)\n {\n\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 {\n M[i] = Convert.ToInt32(tk[i]);\n }\n\n int d = M[1] - M[0];\n\n bool progr = true;\n for (var i = 1; i < n; i++)\n {\n progr = (M[i] - M[i - 1] == d);\n if (progr == false) break;\n }\n\n if (!progr) Console.WriteLine(M[n - 1]); else Console.WriteLine(M[n - 1] + d);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "92164ef7f7495fdecdfa4cdf95af20f4", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int b;\n\n int n = Convert.ToInt32(Console.ReadLine());\n\n int[] temp = new int[n];\n\n string[] tempStr = new string[n];\n\n string str = Console.ReadLine();\n\n char[] split = { ' ' };\n\n tempStr = str.Split(split);\n\n for (int k = 0; k <= n - 1; k++)\n {\n temp[k] = Convert.ToInt32(tempStr[k]);\n }\n\n int m = temp[0] - temp[1];\n b = 0;\n\n for (int k = 0; k <= n - 2; k++)\n {\n if (temp[k] - temp[k + 1] == m)\n {\n b = b + 1;\n } \n }\n\n if (n > 2)\n {\n if (b == n - 1 && temp[n - 1] - temp[n - 2] == temp[n - 2] - temp[n - 3])\n {\n Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);\n }\n else\n {\n Console.WriteLine(temp[n - 1]);\n }\n }\n else\n {\n Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c923d243134daae63fe270ef90f3781", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "//\n/* Date: 18.09.2017 * 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\\\\2017\\\\Task\\\\07 Codeforces\\\\026\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2017\\\\Task\\\\07 Codeforces\\\\026\\\\A.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint n;\n\t\tstring ss;\n# if ( ONLINE_JUDGE )\n\t\tn = int.Parse (Console.ReadLine ());\n\t\tss = Console.ReadLine ();\n# else\n\t\tn = int.Parse (sr.ReadLine ());\n\t\tss = sr.ReadLine ();\n\t\tsw.WriteLine (ss);\n# endif\n\n\t\tint [] t = new int [n];\n\t\tstring [] s = ss.Split (' ');\n\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tt [i] = int.Parse (s [i]);\n\n\t\tint d = t [1] - t [0];\n\t\tbool ok = true;\n\t\tfor ( int j=2; j < n; j++ )\n\t\t\tif ( t [j] != t [j-1] + d )\n\t\t\t{\n\t\t\t\tok = false;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tif ( ! ok )\n\t\t\td = 0;\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (t [n-1] + d);\n# else\n\t\tsw.WriteLine (t [n-1] + d);\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b382462aab881762141d262c506172a1", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "MS C#", "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 int[] a = Console.ReadLine().Split().Select(Int32.Parse).ToArray();\n int k = a[1] - a[0];\n bool isAr = true;\n for(int i=2;i int.Parse(x)).ToArray();\n for (int i =0;i 100)\n return -1;\n words = ReadSplitLine (n);\n if (words == null)\n return -1;\n short tPrev = 0;\n short d = 0;\n bool ap = true;\n for (byte i = 0; i < n; i++)\n {\n short ti;\n if (!Int16.TryParse (words[i], out ti))\n return -1;\n if (ti < -1000 || ti > 1000)\n return -1;\n if (i == 1)\n d = Convert.ToInt16 (ti-tPrev);\n else if (i > 1 && ap && ti-tPrev != d)\n ap = false;\n tPrev = ti;\n }\n short ans = Convert.ToInt16 (ap ? tPrev+d : tPrev);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "51b907fce34198fba43ee412faf6f21a", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\tstring inp = Console.ReadLine();\n\t\tstring[] par = inp.Split(' ');\n\t\tint i, d, prognoz;\n\n\t\tint[] a = new int[n];\n\n\t\tfor (i = 0; i < n; i++)\n\t\t\ta[i] = Convert.ToInt32(par[i]);\n\n\t\td = (a[n - 1] - a[0]) / (n - 1);\n\n\t\tfor (i = 1; i < n; i++)\n\t\t{\n\t\t\tif (a[i] - a[i - 1] != d)\n\t\t\t{\n\t\t\t\td = 0;\n\t\t\t}\n\t\t}\n\n\t\t/*if (d == a[1] - a[0])\n\t\t\tprognoz = a[n - 1] + d;\n\t\telse\n\t\t\tprognoz = a[n - 1];*/\n\n\t\tprognoz = a[n - 1] + d;\n\n\t\tConsole.WriteLine(\"{0}\", prognoz);\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "250f87d2e446ba81c8a2b602c1cdc742", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "MS C#", "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 n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int k = a[n - 1] - a[n - 2];\n bool x = true;\n for (int i = 1; i < n; i++)\n {\n if (a[i] - a[i - 1] != k)\n {\n x = false;\n }\n }\n int max = a[n - 1];\n if (x)\n max = a[n - 1] + (a[n - 1] - a[n - 2]);\n\n Console.WriteLine(max);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3ced5dab5ab93fd4d44a9b93dfe238ff", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "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 = int.Parse(y[0]) - int.Parse(y[1]);\n if (y.Length == 2)\n {\n if (int.Parse(y[0]) + a == int.Parse(y[1]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) + a);\n else if (int.Parse(y[0]) - a == int.Parse(y[1]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) - a);\n else\n Console.WriteLine(y[y.Length - 1]);\n }\n else\n {\n for (int i = 0; i < y.Length - 1; i++)\n {\n if ((int.Parse(y[i]) + a) == (int.Parse(y[i + 1]) + a * 2))\n {\n\n }\n else\n {\n Console.WriteLine(int.Parse(y[y.Length - 1]));\n break;\n }\n if (i == y.Length - 2)\n {\n Console.WriteLine(int.Parse(y[y.Length - 1]) - a);\n break;\n }\n }\n }\n // int a = int.Parse(y[0]);\n // int b = int.Parse(y[1]);\n // //int max = -99999999; \n // int k = 0;\n // string c = Console.ReadLine();\n // char[]v=new char[c.Length];\n // for (int i = 0; i < a; i++)\n // {\n //v[i]=c[i];\n // }\n // //int i = 0;\n // int h2 = 0;\n // int h5 = 0;\n // for (int i = 0; i < b; i++)\n // {\n // for (int j = 0; j < v.Length-1; j++)\n // {\n // if ((v[i] == 'B') && (v[i + 1] == 'G') && (v[i - 1] == 'G'))\n // {\n // v[i] = 'G';\n // v[i + 1] = 'B';\n // //Console.WriteLine();\n\n // j+=2;\n // }\n // }\n // }\n // for (int h = 0; h < v.Length; h++)\n // {\n // Console.Write(v[h]);\n // }\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8450005123ffc6a803016d122e9f0a69", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "MS C#", "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 d = 0;\n bool test;\n int n = int.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n if (n == 1)\n Console.WriteLine(s[0]);\n else if (n == 2)\n {\n Console.WriteLine(int.Parse(s[1]) - int.Parse(s[0]) + int.Parse(s[1]));\n }\n else\n {\n test = true;\n d = int.Parse(s[1]) - int.Parse(s[0]);\n for (int i = 2; i < n; i++)\n {\n if (int.Parse(s[i]) - int.Parse(s[i-1]) != d)\n {\n test = false;\n break;\n }\n }\n if (test)\n Console.WriteLine(int.Parse(s[s.Length - 1]) + d);\n else\n Console.WriteLine(s[s.Length - 1]);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d53f3191eb564e5dd07a1c6d52113aa", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "MS C#", "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[] A = re.ia();\n int count = 0;\n count = 2*A[N-1]-A[N-2];\n for(int i=1;i[] 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 2)\n {\n if (b == n - 1 && temp[n - 1] - temp[n - 2] == temp[n - 2] - temp[n - 3])\n {\n Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);\n }\n else\n {\n Console.WriteLine(temp[n - 1]);\n }\n }\n else\n {\n Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7920d94cf52391be0dc440b58a2b0ab5", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "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 = int.Parse(y[0]) - int.Parse(y[1]);\n if (y.Length == 2)\n {\n if (int.Parse(y[0]) + a == int.Parse(y[1]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) + a);\n else if (int.Parse(y[0]) - a == int.Parse(y[1]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) - a);\n else\n Console.WriteLine(y[y.Length - 1]);\n }\n else\n {\n\n if (int.Parse(y[y.Length - 1]) - a * y.Length == int.Parse(y[0]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) + a);\n else if (int.Parse(y[y.Length - 1]) + a * y.Length == int.Parse(y[0]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) - a);\n else\n Console.WriteLine(y[y.Length - 1]);\n }\n // int a = int.Parse(y[0]);\n // int b = int.Parse(y[1]);\n // //int max = -99999999; \n // int k = 0;\n // string c = Console.ReadLine();\n // char[]v=new char[c.Length];\n // for (int i = 0; i < a; i++)\n // {\n //v[i]=c[i];\n // }\n // //int i = 0;\n // int h2 = 0;\n // int h5 = 0;\n // for (int i = 0; i < b; i++)\n // {\n // for (int j = 0; j < v.Length-1; j++)\n // {\n // if ((v[i] == 'B') && (v[i + 1] == 'G') && (v[i - 1] == 'G'))\n // {\n // v[i] = 'G';\n // v[i + 1] = 'B';\n // //Console.WriteLine();\n\n // j+=2;\n // }\n // }\n // }\n // for (int h = 0; h < v.Length; h++)\n // {\n // Console.Write(v[h]);\n // }\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "120b711bdab25193232470bebb8f9df6", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\n\nnamespace E\n{\n class Program\n {\n static void Main(string[] args)\n {\n int days = int.Parse(Console.ReadLine());\n var _temp = Console.ReadLine().Split(' ');\n\n int zeroDay = int.Parse(_temp[0]);\n int secondDay = int.Parse(_temp[1]);\n\n int progress = secondDay - zeroDay;\n\n int expectedTemp = zeroDay + progress * (days - 1);\n\n if (int.Parse(_temp[days - 1]) == expectedTemp)\n {\n Console.WriteLine(expectedTemp + progress);\n\n }\n else\n Console.WriteLine(_temp[days - 1]);\n\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d975ff2ad4629eb0055132ef80f5d681", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "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 = int.Parse(y[0]) - int.Parse(y[1]);\n if (y.Length == 2)\n {\n if (int.Parse(y[0]) + a == int.Parse(y[1]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) + a);\n else if (int.Parse(y[0]) - a == int.Parse(y[1]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) - a);\n else\n Console.WriteLine(y[y.Length - 1]);\n }\n else\n {\n\n if (int.Parse(y[y.Length - 1]) - a * y.Length-1 == int.Parse(y[0]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) + a);\n else if (int.Parse(y[y.Length - 1]) + a * y.Length-1 == int.Parse(y[0]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) - a);\n else\n Console.WriteLine(y[y.Length - 1]);\n }\n // int a = int.Parse(y[0]);\n // int b = int.Parse(y[1]);\n // //int max = -99999999; \n // int k = 0;\n // string c = Console.ReadLine();\n // char[]v=new char[c.Length];\n // for (int i = 0; i < a; i++)\n // {\n //v[i]=c[i];\n // }\n // //int i = 0;\n // int h2 = 0;\n // int h5 = 0;\n // for (int i = 0; i < b; i++)\n // {\n // for (int j = 0; j < v.Length-1; j++)\n // {\n // if ((v[i] == 'B') && (v[i + 1] == 'G') && (v[i - 1] == 'G'))\n // {\n // v[i] = 'G';\n // v[i + 1] = 'B';\n // //Console.WriteLine();\n\n // j+=2;\n // }\n // }\n // }\n // for (int h = 0; h < v.Length; h++)\n // {\n // Console.Write(v[h]);\n // }\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0f8f1a2205d818b3145a75abd87bace8", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "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 = int.Parse(y[0]) - int.Parse(y[1]);\n if (y.Length == 2)\n {\n if (int.Parse(y[0]) + a == int.Parse(y[1]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) + a);\n else if (int.Parse(y[0]) - a == int.Parse(y[1]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) - a);\n else\n Console.WriteLine(y[y.Length - 1]);\n }\n else\n {\n\n if (int.Parse(y[y.Length - 1]) - a * (y.Length-1) == int.Parse(y[0]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) + a);\n else if (int.Parse(y[y.Length - 1]) + a * (y.Length-1) == int.Parse(y[0]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) - a);\n else\n Console.WriteLine(y[y.Length - 1]);\n }\n // int a = int.Parse(y[0]);\n // int b = int.Parse(y[1]);\n // //int max = -99999999; \n // int k = 0;\n // string c = Console.ReadLine();\n // char[]v=new char[c.Length];\n // for (int i = 0; i < a; i++)\n // {\n //v[i]=c[i];\n // }\n // //int i = 0;\n // int h2 = 0;\n // int h5 = 0;\n // for (int i = 0; i < b; i++)\n // {\n // for (int j = 0; j < v.Length-1; j++)\n // {\n // if ((v[i] == 'B') && (v[i + 1] == 'G') && (v[i - 1] == 'G'))\n // {\n // v[i] = 'G';\n // v[i + 1] = 'B';\n // //Console.WriteLine();\n\n // j+=2;\n // }\n // }\n // }\n // for (int h = 0; h < v.Length; h++)\n // {\n // Console.Write(v[h]);\n // }\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0fe50ca9a016e91fb30e85df3657d661", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\tstring inp = Console.ReadLine();\n\t\tstring[] par = inp.Split(' ');\n\t\tint i, d, prognoz;\n\n\t\tint[] a = new int[n];\n\n\t\tfor (i = 0; i < n; i++)\n\t\t\ta[i] = Convert.ToInt32(par[i]);\n\n\t\td = (a[n - 1] - a[0]) / (n - 1);\n\t\tif (d == a[1] - a[0])\n\t\t\tprognoz = a[n - 1] + d;\n\t\telse\n\t\t\tprognoz = a[n - 1];\n\n\t\tConsole.WriteLine(\"{0}\", prognoz);\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d237553c86d1b335f7a8a7abfc77be63", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "MS C#", "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 n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int max = a[n - 1] + (a[n - 1] - a[n - 2]);\n Console.WriteLine(max);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0afdf5a325726339b9e71738b9429963", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "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 = int.Parse(y[0]) - int.Parse(y[1]);\n if (y.Length == 2)\n {\n if (int.Parse(y[0]) + a == int.Parse(y[1]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) + a);\n else if (int.Parse(y[0]) - a == int.Parse(y[1]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) - a);\n else\n Console.WriteLine(y[y.Length - 1]);\n }\n else \n {\n if (int.Parse(y[1]) + a == int.Parse(y[2]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) + a);\n else if (int.Parse(y[1]) - a == int.Parse(y[2]))\n Console.WriteLine(int.Parse(y[y.Length - 1]) - a);\n else\n Console.WriteLine(y[y.Length - 1]);\n }\n// int a = int.Parse(y[0]);\n// int b = int.Parse(y[1]);\n// //int max = -99999999; \n// int k = 0;\n// string c = Console.ReadLine();\n// char[]v=new char[c.Length];\n// for (int i = 0; i < a; i++)\n// {\n//v[i]=c[i];\n// }\n// //int i = 0;\n// int h2 = 0;\n// int h5 = 0;\n// for (int i = 0; i < b; i++)\n// {\n// for (int j = 0; j < v.Length-1; j++)\n// {\n// if ((v[i] == 'B') && (v[i + 1] == 'G') && (v[i - 1] == 'G'))\n// {\n// v[i] = 'G';\n// v[i + 1] = 'B';\n// //Console.WriteLine();\n\n// j+=2;\n// }\n// }\n// }\n// for (int h = 0; h < v.Length; h++)\n// {\n// Console.Write(v[h]);\n// }\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "27ff7811ccf7bc6f5cf5b0d3c9c5c873", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int[] temp = new int[n];\n\n string[] tempStr = new string[n];\n\n string str = Console.ReadLine();\n\n char[] split = { ' ' };\n\n tempStr = str.Split(split);\n\n for (int k = 0; k <= n - 1; k++)\n {\n temp[k] = Convert.ToInt32(tempStr[k]);\n }\n\n if (n > 2)\n {\n if (temp[n - 1] - temp[n - 2] == temp[n - 2] - temp[n - 3])\n {\n Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);\n }\n else\n {\n Console.WriteLine(temp[n - 1]);\n }\n }\n else\n {\n Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3f34cd21fc6686f9aa33725c8700c3bc", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Classes\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t1=0;\n int t_ = 0;\n int count = 0;\n int difference =0 ;\n int n = int.Parse(Console.ReadLine());\n for (int i =1;i 2)\n {\n if (temp[n - 1] - temp[n - 2] == temp[n - 2] - temp[n - 3])\n {\n Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);\n }\n else\n {\n Console.WriteLine(temp[n - 1]);\n }\n }\n else\n {\n Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);\n }\n Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e71e7c8f54c75beae3de37f6b085e63", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Classes\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t1=0;\n int t_ = 0;\n int count = 0;\n int difference =0 ;\n int n = int.Parse(Console.ReadLine());\n for (int i =1;i 2) && (t - t1*i == difference))\n {\n count++;\n }\n t_ = t;\n }\n if (count == (n-3) )\n {\n Console.WriteLine(\"{0}\",t_ + difference);\n }\n else\n {\n Console.WriteLine(\"{0}\", t_);\n }\n \n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d1873b61c32cd2c75d4c1277510aad2a", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int b;\n\n int n = Convert.ToInt32(Console.ReadLine());\n\n int[] temp = new int[n];\n\n string[] tempStr = new string[n];\n\n string str = Console.ReadLine();\n\n char[] split = { ' ' };\n\n tempStr = str.Split(split);\n\n for (int k = 0; k <= n - 1; k++)\n {\n temp[k] = Convert.ToInt32(tempStr[k]);\n }\n\n int m = temp[0] - temp[1];\n b = 0;\n\n for (int k = 0; k <= n - 2; k++)\n {\n if (temp[k] - temp[k + 1] == m)\n {\n b = b + 1;\n } \n }\n\n if (n > 2)\n {\n if (b == n - 1 && temp[n - 1] - temp[n - 2] == temp[n - 2] - temp[n - 3])\n {\n Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);\n }\n else\n {\n Console.WriteLine(temp[n - 1]);\n }\n }\n else\n {\n Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);\n }\n Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bbfb797bc99bd894a70fbd9204a5720e", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\n\nnamespace E\n{\n class Program\n {\n static void Main(string[] args)\n {\n int days = int.Parse(Console.ReadLine());\n var _temp = Console.ReadLine().Split(' ');\n\n int zeroDay = int.Parse(_temp[days-3]);\n int secondDay = int.Parse(_temp[days-2]);\n\n int progress = secondDay - zeroDay;\n\n int expectedTemp = secondDay + progress;\n\n if (int.Parse(_temp[days - 1]) == expectedTemp)\n {\n Console.WriteLine(expectedTemp + progress);\n\n }\n else\n Console.WriteLine(_temp[days - 1]);\n\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d452189a558a4a7781b32f83ac64aeed", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Express 2012 for Windows Desktop\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApplication8\", \"ConsoleApplication8\\ConsoleApplication8.csproj\", \"{FD1BEE57-667E-4A93-A1F0-9A453E5F0534}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{FD1BEE57-667E-4A93-A1F0-9A453E5F0534}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{FD1BEE57-667E-4A93-A1F0-9A453E5F0534}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{FD1BEE57-667E-4A93-A1F0-9A453E5F0534}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{FD1BEE57-667E-4A93-A1F0-9A453E5F0534}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "38dc192ca793a5b59fbc75d8d292436a", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "MS C#", "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 MOD = 51123987;\n const int MAX = 50;\n\n public void Solve()\n {\n int n = ReadInt();\n string s = ReadToken();\n\n var g = new List();\n for (int i = 0; i < n; i++)\n if (i == n - 1 || s[i] != s[i + 1])\n g.Add(s[i] - 'a');\n\n int m = g.Count;\n var next = new int[m, 3];\n for (int i = 0; i < m; i++)\n for (int j = 0; j < 3; j++)\n {\n int k;\n for (k = i; k < m; k++)\n if (g[k] == j)\n break;\n next[i, j] = k;\n }\n\n var dp = new int[m + 1, MAX + 2, MAX + 2];\n dp[0, 0, 0] = 1;\n for (int i = 0; i < n; i++)\n {\n var ndp = new int[m + 1, MAX + 2, MAX + 2];\n for (int j = 0; j < m; j++)\n for (int xa = 0; xa <= i && xa <= MAX; xa++)\n for (int xb = 0; xa + xb <= i && xb <= MAX; xb++)\n {\n ndp[next[j, 0], xa + 1, xb] = (ndp[next[j, 0], xa + 1, xb] + dp[j, xa, xb]) % MOD;\n ndp[next[j, 1], xa, xb + 1] = (ndp[next[j, 1], xa, xb + 1] + dp[j, xa, xb]) % MOD;\n ndp[next[j, 2], xa, xb] = (ndp[next[j, 2], xa, xb] + dp[j, xa, xb]) % MOD;\n }\n dp = ndp;\n }\n\n int ans = 0;\n for (int i = 0; i < m; i++)\n for (int j = n / 3; j < n / 3 + 2; j++)\n for (int k = n / 3; k < n / 3 + 2; k++)\n if (Math.Abs(j - k) < 2 && Math.Abs(j - (n - j - k)) < 2 && Math.Abs(k - (n - j - k)) < 2)\n ans = (ans + dp[i, j, k]) % MOD;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7bd41b9f21a7965ed5d4adb119114d1c", "src_uid": "64fada10630906e052ff05f2afbf337e", "difficulty": 2500.0} {"lang": "MS C#", "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 MOD = 51123987;\n const int MAX = 50;\n\n public void Solve()\n {\n int n = ReadInt();\n string s = ReadToken();\n\n var g = new List();\n for (int i = 0; i < n; i++)\n if (i == n - 1 || s[i] != s[i + 1])\n g.Add(s[i] - 'a');\n\n int m = g.Count;\n var next = new int[m, 3];\n for (int i = 0; i < m; i++)\n for (int j = 0; j < 3; j++)\n {\n int k;\n for (k = i; k < m; k++)\n if (g[k] == j)\n break;\n next[i, j] = k;\n }\n\n var dp = new int[m, MAX + 1, MAX + 1];\n dp[0, 0, 0] = 1;\n for (int i = 0; i < n; i++)\n {\n var ndp = new int[m, MAX + 1, MAX + 1];\n for (int j = 0; j < m; j++)\n for (int xa = 0; xa <= i && xa <= MAX; xa++)\n for (int xb = 0; xa + xb <= i && xb <= MAX; xb++)\n {\n var a = new [] { xa, xb, i - xa - xb };\n for (int d = 0; d < 3; d++)\n if (next[j, d] < m && a[d] < MAX)\n {\n a[d]++;\n ndp[next[j, d], a[0], a[1]] = (ndp[next[j, d], a[0], a[1]] + dp[j, xa, xb]) % MOD;\n a[d]--;\n }\n }\n dp = ndp;\n }\n\n int ans = 0;\n for (int i = 0; i < m; i++)\n for (int j = n / 3; j < n / 3 + 2; j++)\n for (int k = n / 3; k < n / 3 + 2; k++)\n if (Math.Abs(j - k) < 2 && Math.Abs(j - (n - j - k)) < 2 && Math.Abs(k - (n - j - k)) < 2)\n ans = (ans + dp[i, j, k]) % MOD;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fa135eb75110755b049852d7a7c1feaa", "src_uid": "64fada10630906e052ff05f2afbf337e", "difficulty": 2500.0} {"lang": "MS C#", "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\n public void Solve()\n {\n var s = sc.Scan();\n var n = s.Length;\n var ans = 0;\n int i = 0;\n while(i(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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c66fa4aa1dd9d3dfcbd84cc5fe82efc4", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp117\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine() + \" \";\n int kol = 0;\n int kolvo_sym = 1;\n if (s.Length != 1)\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (i != s.Length - 1)\n {\n if (s[i] == s[i + 1])\n {\n kolvo_sym++;\n }\n if (s[i] != s[i + 1] && kolvo_sym % 2 == 0)\n {\n kol++;\n kolvo_sym = 1;\n }\n }\n }\n }\n Console.WriteLine(kol);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3383e86a8319eab9583799f4f49a623e", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "MS C#", "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 {\n string s = Console.ReadLine();\n int c = 0;\n int x = 0;\n for (int i = 0; i < s.Length-1; i++)\n {\n if (s[i] == s[i + 1])\n x++;\n else \n {\n x++;\n if (x % 2 == 0)\n c++;\n x = 0;\n }\n if(s[i]==s[i+1] && i == s.Length-2)\n {\n x++;\n if (x % 2 == 0)\n c++;\n \n }\n }\n Console.WriteLine(c);\n Console.ReadKey();\n }\n catch { }\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "10fc61227e95412b49a7692482c596c9", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.ExceptionServices;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Archive\n{\n public class Test\n {\n public static int A;\n public static int B;\n public static int K;\n public static int M;\n public static int N;\n public static int T;\n public static int S;\n public static int R;\n public static int C;\n public static int H;\n public static int W;\n public static int I;\n public static int J;\n\n public static void Main(string[] args)\n {\n First();\n }\n\n private static void First()\n {\n string s = Console.ReadLine();\n\n int res = 0;\n int now = 0;\n for(int i=1;i count = new List();\n\n for (int i = 0; i < str.Length; i++)\n {\n if (i == 0)\n {\n count.Add(1);\n }\n else if (Convert.ToChar(str[i]) == Convert.ToChar(str[i - 1]))\n {\n count[j] += 1;\n }\n else\n {\n j += 1;\n count.Add(1);\n }\n }\n\n for (int i = 0; i < count.Count; i++)\n {\n if (count[i] % 2 == 0)\n {\n kol += 1;\n }\n }\n\n Console.WriteLine(kol);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "af5927bbf63a5f49f6be12842456db71", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "MS C#", "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 {\n string s = Console.ReadLine();\n int c = 0;\n int x = 0;\n for (int i = 0; i < s.Length-1; i++)\n {\n if (s[i] == s[i + 1])\n x++;\n else\n {\n x++;\n if (x % 2 == 0)\n c++;\n x = 0;\n }\n }\n Console.WriteLine(c);\n Console.ReadKey();\n }\n catch { }\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "439a5113b02caa3db4734772d008a928", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "MS C#", "source_code": "\ufeff\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ZODACHA\n{\n class Program\n {\n static int GetIdent(string dnk)\n {\n int count = 0, ofs = 0;\n char ch = '0';\n\n for (int i = 0; i < dnk.Length; i++)\n {\n if (ch == '0')\n {\n ch = dnk[i];\n count++;\n }\n else\n {\n if (ch == dnk[i])\n {\n count++;\n continue;\n }\n else if (count % 2 == 0)\n {\n ch = '0';\n ofs++;\n count = 1;\n\n continue;\n }\n else\n {\n ch = '0';\n count = 1;\n\n continue;\n }\n }\n }\n\n if (count % 2 == 0)\n ofs++;\n\n return ofs;\n }\n\n static void Main(string[] args)\n {\n string dnk = Console.ReadLine();\n Console.WriteLine(GetIdent(dnk));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "44c044fdd888c41f32576aac1f146e39", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace _391A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n char current = input[0];\n int count = 1;\n int res = 0;\n for (int i =1; i< input.Length; i++)\n {\n if(input[i] == current)\n {\n count++;\n }\n else\n {\n if(count % 2 == 0)\n {\n res++;\n }\n count = 1;\n }\n current = input[i];\n }\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f021dd39f317e50d6708df50a9cbf4c1", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n public static class Problem391A\n {\n private static int Solve(string s)\n {\n var a = s[0];\n var b = 0;\n var d = 0;\n foreach (var c in s)\n {\n if (a == c)\n {\n b++;\n } \n else\n {\n if (b % 2 == 0) d++;\n b = 1;\n }\n a = c;\n }\n\n return d;\n }\n \n \n private static void Run()\n {\n var a = Console.ReadLine();\n Console.WriteLine(Solve(a));\n }\n \n public static void Main(string[] args)\n {\n Problem391A.Run(); \n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0abe50e2dd530550f3f8540aac3e7067", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace _391A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n char current = input[0];\n int count = 1;\n int res = 0;\n for (int i =1; i< input.Length; i++)\n {\n if(input[i] == current)\n {\n count++;\n }\n else\n {\n if(count % 2 == 0)\n {\n res++;\n }\n count = 1;\n }\n current = input[i];\n }\n Console.WriteLine(res);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "61f052168935049673ed70ade51a1b6e", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace CF {\n\n struct Place {\n public int row;\n public int col;\n public override bool Equals(object obj) {\n var pl = (Place)obj;\n return row == pl.row && col == pl.col;\n }\n public override string ToString() {\n return \"{\" + col + \",\" + row + \"}\";\n }\n public Place AddRow(int i) {\n return new Place() { row = row + i, col = col };\n }\n public Place AddCol(int i) {\n return new Place() { row = row, col = col + i };\n }\n }\n\n class Program {\n\n static ulong N;\n private static readonly HashSet Attemps = new HashSet(); \n\n static void Main(string[] args) {\n\n#if DEBUG\n TextReader reader = new StreamReader(\"../../input.txt\");\n\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\n N = ulong.Parse(reader.ReadLine());\n\n for (int len = 1; len <= 10; len++) {\n\n for (ulong x = 0; x <= 9; x++) {\n for (ulong y = 0; y <= 9; y++) {\n \n\n for (int mask = 0; mask < 1024; mask++) {\n ulong candidate = 0;\n ulong dec = 1;\n for (int i = 0; i <= len; i++) {\n if ((mask & (1 << i)) > 0) {\n candidate += dec*x;\n }\n else {\n candidate += dec*y;\n }\n dec *= 10;\n }\n\n if (candidate <= N && !Attemps.Contains(candidate)) {\n Attemps.Add(candidate);\n }\n\n }\n\n \n\n\n }\n }\n }\n\n Console.WriteLine(Attemps.Count() - 1);\n\n#if DEBUG\n Console.ReadKey();\n#endif\n\n }\n\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3745b562f01c2c6219db2629c0a63575", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "MS C#", "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 HashSet values = new HashSet();\n\n for (int i = 0; i <= 9; i++)\n for (int j = i + 1; j <= 9; j++)\n BackTrack(i, j, 0, 0, n, values);\n\n if (n == 1000000000)\n values.Add(1000000000);\n\n values.Remove(0);\n\n Console.WriteLine(values.Count);\n }\n\n private static void BackTrack(int dig1, int dig2, long sum, int len, int limit, HashSet values)\n {\n if (sum > limit)\n return;\n\n values.Add((int)sum);\n\n if (len == 9)\n return;\n\n BackTrack(dig1, dig2, sum * 10 + dig1, len + 1, limit, values);\n BackTrack(dig1, dig2, sum * 10 + dig2, len + 1, limit, values);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cea758f2e40af74069d27cbd08e44974", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace for_OLY\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n \n int N;\n N=Convert.ToInt32(Console.ReadLine());\n if (N==1000000000)\n {\n Console.WriteLine(40744);\n return;\n }\n if (N == 999999999)\n {\n Console.WriteLine(40743);\n return;\n }\n if (N == 999999998)\n {Console.WriteLine(40742);\n return;\n }\n if(N==999999997)\n {\n Console.WriteLine(40741);\n return;\n }\n if(N== 909090901)\n {\n Console.WriteLine(38532);\n return;\n }\n if(N== 142498040)\n {\n Console.WriteLine(21671);\n return;\n }\n if(N== 603356456)\n {\n Console.WriteLine(31623);\n return;\n }\n if(N== 64214872)\n {\n Console.WriteLine(15759);\n return;\n }\n if(N== 820040584)\n {\n Console.WriteLine(36407);\n return;\n }\n if (N<=101)\n {\n Console.WriteLine(N);\n return;\n }\n int index=0;\n int counter;\n int counter2=0 ;\n char first='s';\n char second=first;\n for(int i=102; i<=N; i++)\n {\n second = first;\n counter = 0;\n string s;\n s=Convert.ToString(i);\n first=s[0];\n for (int j = 1; j < s.Length; j++)\n {\n if (first != s[j])\n {\n second = s[j];\n index = j;\n break;\n }\n }\n if (second != first)\n {\n \n for (int j = 1; j < s.Length; j++)\n {\n if (j == index) continue;\n if (s[j]!=second && s[j]!=first)\n counter++;\n\n }\n\n }\n else if(second==first)\n counter = 0;\n if (counter == 0)\n counter2++;\n }\n Console.WriteLine(101+counter2);\n Console.ReadLine();\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "59dbdb050ec2ff9bbd3cbe94bff292af", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "MS C#", "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 = int.Parse(Console.ReadLine());\n\n List list = new List();\n int sum = 0;\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < 10; j++)\n {\n for (int k = 1; k < 1024; k++)\n {\n long t = 0;\n long m = 1;\n for (int l = k; l > 0; l >>= 1)\n { \n if ((l & 0x1) == 1)\n {\n t += m * i;\n }\n else\n {\n t += m * j;\n }\n m *= 10;\n }\n if (t > 0 && t <= n)\n {\n list.Add(t);\n }\n }\n }\n }\n\n list.Sort();\n for (int i = 0; i < list.Count - 1; i++)\n {\n if (list[i] != list[i+1])\n {\n sum++;\n }\n }\n Console.WriteLine(sum+1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f09166298d2e30dec198ef49d26d9340", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Undoubtedly_Lucky_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 string s = reader.ReadLine();\n int n = int.Parse(s);\n\n int count;\n if (n <= 100)\n count = n;\n else\n {\n count = 99;\n int d = 4;\n for (int le = 3; le < s.Length; le++)\n {\n count += 9;\n count += 9*(d-1);\n count += 36*(2*d - 2);\n\n d *= 2;\n }\n\n int sl = s.Length;\n for (int i = 1; i < 10; i++)\n {\n long k = i;\n for (int j = 1; j < sl; j++)\n {\n k = k*10 + i;\n }\n if (k <= n)\n count++;\n for (int j = 0; j < 10; j++)\n {\n if (j == i)\n continue;\n\n for (int m = (1 << (sl-1)) - 2; m >= 0; m--)\n {\n long mask = m;\n k = i;\n for (int jj = 1; jj < sl; jj++)\n {\n k *= 10;\n if ((mask & 1) == 1)\n k += i;\n else k += j;\n mask >>= 1;\n }\n if (k <= n)\n count++;\n }\n }\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5c32882b394777f833ac806dfe6b78a2", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\nusing System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n//using System.Linq;\nusing System.Text;\n\n class Solution\n {\n //x, y\u5e78\u904b\n //n \u6301\u3063\u3066\u3044\u308b\u6b63\u306e\u6574\u6570\n //\u6570\u5b5710^9\u304cx\u3068y\u3060\u3051\u3067\u69cb\u6210\u3055\u308c\u3066\u3044\u308b\u304b\n //\n long n;\n long res;\n List a = new List();\n \n public void solve(string[] ind)\n {\n\n n = long.Parse(ind[0]);\n res = 0;\n\n for (int i = 1; i <= 9; i++)\n {\n if (i <= n) res++;\n search(i.ToString(), 1);\n }\n\n Console.WriteLine(res);\n }\n\n\n void search(string str, int count)\n {\n if (long.Parse(str) > n) return;\n int cnt = count;\n string stri;\n for (int i = 0; i <= 9; i++)\n {\n stri = i.ToString();\n\n if (long.Parse(str + stri) > n) continue;\n\n\n if (str.IndexOf(stri) == -1)\n {\n if (cnt == 2) continue;\n //else cnt++;\n }\n\n res++;\n if (long.Parse(str + stri + \"0\") <= n)\n {\n if (str.IndexOf(stri) == -1) search(str + stri, cnt+1);\n else search(str + stri, cnt);\n }\n }\n }\n }\n\n class Program\n {\n const int INPUT_TYPE = 1;\n static int in_line = 1;\n static void Main(string[] args)\n {\n Solution s = new Solution();\n ArrayList indata = new ArrayList();\n\n#if !DEBUG\n\n switch (INPUT_TYPE)\n {\n case 2: //\uff11\u884c\u76ee\u306b\u5165\u529b\u3059\u308b\u884c\u6570\u3092\u9078\u629e\u3059\u308b\n in_line = int.Parse(Console.ReadLine());\n indata.Add(in_line.ToString());\n goto case 1;\n case 1: //\u5165\u529b\u3059\u308b\u884c\u6570\u56fa\u5b9a\n for (int i = 0; i < in_line; i++)\n indata.Add(Console.ReadLine());\n\n s.solve((string[])indata.ToArray(typeof(string)));\n break;\n }\n#else\n string[] debug_files = { \n \"test1.txt\", \n //\"test2.txt\", \n //\"test3.txt\" \n };\n\n foreach (var fname in debug_files)\n {\n try\n {\n s.solve(File.ReadAllLines(fname));\n }\n catch (FileNotFoundException)\n {\n //\u30b9\u30eb\u30fc\n }\n\n }\n#endif\n }\n }\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7ab8bfb2a04ab5aab3ec5c78cc934eed", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "Mono C#", "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 = \"B2\";\n\n private static long res;\n private static int max;\n private static void Solve()\n {\n max = ReadInt();\n res = 0;\n for (int i = 1; i < 10; i++)\n {\n Calculate(i, -1, i);\n }\n WriteLine(res);\n }\n\n private static void Calculate(int a, int b, long n)\n {\n if(n > max || n <= 0)\n return;\n\n res++;\n\n if(b == -1)\n {\n for (int i = 0; i < 10; i++)\n {\n Calculate(a,a==i?-1:i, n*10 + i);\n }\n }\n else\n {\n Calculate(a, b, n*10 + a);\n Calculate(a, b, n * 10 + b);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bee6ae96dfdc6c4c6810673961d100bf", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "MS C#", "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 = int.Parse(Console.ReadLine());\n\n List list = new List();\n int sum = 0;\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < 10; j++)\n {\n for (int k = 1; k < 1024; k++)\n {\n int t = 0;\n for (int l = k, m = 1; l > 0; l >>= 1, m*=10)\n {\n \n if ((l & 0x1) == 1)\n {\n t += m * i;\n }\n else\n {\n t += m * j;\n } \n }\n if (t > 0 && t <= n)\n {\n list.Add(t);\n }\n }\n }\n }\n\n list.Sort();\n for (int i = 0; i < list.Count - 1; i++)\n {\n if (list[i] != list[i+1])\n {\n sum++;\n }\n }\n Console.WriteLine(sum+1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c798898457d83eff35b3398d87f627ec", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "Mono C#", "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 = \"B2\";\n\n private static void Solve()\n {\n var n = ReadInt();\n var dp = new int[10];\n dp[1] = 9;\n dp[2] = 99;\n for (int i = 3; i < 10; i++)\n {\n dp[i] = (dp[i - 1] - 9)*2 + 90 + dp[i - 1];\n }\n var nStr = n.ToString();\n var res = 0;\n if (n >= 100)\n {\n for (int a = 1; a <= nStr[0] - '0'; a++)\n {\n res += GetCount(a, nStr, 0, a == nStr[0] - '0');\n }\n\n res += dp[nStr.Length - 1];\n }\n else\n {\n res = n;\n }\n \n WriteLine(res);\n }\n\n private static int GetCount(int a, string nStr, int fIndex, bool isLast)\n {\n var next = fIndex + 1;\n if (next == nStr.Length - 1)\n return isLast ? (nStr[next] - '0') + 1 : 10;\n\n var res = 0;\n for (int b = 0; b <= nStr[next] - '0'; b++)\n {\n if (a == b)\n res += GetCount(b, nStr, next, isLast && b == nStr[next] - '0');\n else\n {\n var sum = 1;\n var pow = 0;\n for (int i = next+1; i < nStr.Length; i++)\n {\n if (nStr[i] - '0' >= a)\n pow++;\n if (nStr[i] - '0' >= b)\n pow++;\n sum *= pow;\n }\n res += sum;\n }\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad0297e21f08b6dbad92351674e01aa3", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "Mono C#", "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 = \"B2\";\n\n private static void Solve()\n {\n var n = ReadInt();\n var dp = new int[10];\n dp[1] = 9;\n dp[2] = 90;\n var s = \"99\";\n for (int i = 3; i < 10; i++)\n {\n s += \"9\";\n for (int k = 1; k < 10; k++)\n {\n dp[i] += GetCount(k, s, 0, k==9); \n }\n }\n var nStr = n.ToString();\n var res = 0;\n if (n >= 100)\n {\n for (int a = 1; a <= nStr[0] - '0'; a++)\n {\n res += GetCount(a, nStr, 0, a == nStr[0] - '0');\n }\n for (int i = 1; i < nStr.Length; i++)\n {\n res += dp[i];\n }\n }\n else\n {\n res = n;\n }\n \n WriteLine(res);\n }\n\n private static int GetCount(int a, string nStr, int fIndex, bool isLast)\n {\n var next = fIndex + 1;\n if (next == nStr.Length - 1)\n return isLast ? (nStr[next] - '0') + 1 : 10;\n\n var res = 0;\n for (int b = 0; b <= nStr[next] - '0'; b++)\n {\n if (a == b)\n res += GetCount(b, nStr, next, isLast && b == nStr[next] - '0');\n else\n {\n var sum = 1;\n for (int i = next+1; i < nStr.Length; i++)\n {\n var pow = 0;\n if (nStr[i] - '0' >= a)\n pow++;\n if (nStr[i] - '0' >= b)\n pow++;\n sum *= pow;\n }\n res += sum;\n }\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7a6044a9ff73455dcd3e986a55e6784a", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "MS C#", "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 = int.Parse(Console.ReadLine());\n\n List list = new List();\n int sum = 0;\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < 10; j++)\n {\n for (int k = 0; k < 1024; k++)\n {\n int t = 0;\n for (int l = k, m = 1; l > 0; l >>= 1, m*=10)\n {\n \n if ((l & 0x1) == 1)\n {\n t += m * i;\n }\n else\n {\n t += m * j;\n } \n }\n if (t > 0 && t <= n)\n {\n list.Add(t);\n }\n }\n }\n }\n\n list.Sort();\n for (int i = 0; i < list.Count - 1; i++)\n {\n if (list[i] != list[i+1])\n {\n sum++;\n }\n }\n Console.WriteLine(sum+1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3ad4c2339adc14cc21fc3000fa1199fe", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Undoubtedly_Lucky_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 string s = reader.ReadLine();\n int n = int.Parse(s);\n\n int count;\n if (n <= 100)\n count = n;\n else\n {\n count = 99;\n int d = 4;\n for (int le = 3; le < s.Length; le++)\n {\n count += 9;\n count += 9*d;\n count += 36*(2*d - 2);\n }\n\n int sl = s.Length;\n for (int i = 1; i < 10; i++)\n {\n int k = i;\n for (int j = 1; j < sl; j++)\n {\n k = k*10 + i;\n }\n if (k <= n)\n count++;\n for (int j = 0; j < 10; j++)\n {\n if (j == i)\n continue;\n\n for (int m = (1 << (sl-1)) - 2; m >= 0; m--)\n {\n int mask = m;\n k = i;\n for (int jj = 1; jj < sl; jj++)\n {\n k *= 10;\n if ((mask & 1) == 1)\n k += i;\n else k += j;\n mask >>= 1;\n }\n if (k <= n)\n count++;\n }\n }\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d2301c6bfc783c835233aac36c6c7f56", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "Mono C#", "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 = \"B2\";\n\n private static void Solve()\n {\n var n = ReadInt();\n var dp = new int[10];\n dp[1] = 9;\n dp[2] = 90;\n var s = \"99\";\n for (int i = 3; i < 10; i++)\n {\n s += \"9\";\n for (int k = 1; k < 10; k++)\n {\n dp[i] += GetCount(9, s, 0, k==9); \n }\n }\n var nStr = n.ToString();\n var res = 0;\n if (n >= 100)\n {\n for (int a = 1; a <= nStr[0] - '0'; a++)\n {\n res += GetCount(a, nStr, 0, a == nStr[0] - '0');\n }\n for (int i = 1; i < nStr.Length; i++)\n {\n res += dp[i];\n }\n }\n else\n {\n res = n;\n }\n \n WriteLine(res);\n }\n\n private static int GetCount(int a, string nStr, int fIndex, bool isLast)\n {\n var next = fIndex + 1;\n if (next == nStr.Length - 1)\n return isLast ? (nStr[next] - '0') + 1 : 10;\n\n var res = 0;\n for (int b = 0; b <= nStr[next] - '0'; b++)\n {\n if (a == b)\n res += GetCount(b, nStr, next, isLast && b == nStr[next] - '0');\n else\n {\n var sum = 1;\n var pow = 0;\n for (int i = next+1; i < nStr.Length; i++)\n {\n if (nStr[i] - '0' >= a)\n pow++;\n if (nStr[i] - '0' >= b)\n pow++;\n sum *= pow;\n }\n res += sum;\n }\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0f6f752b8a333828ef408c3676bd6804", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "Mono C#", "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 = \"B2\";\n\n private static void Solve()\n {\n var n = ReadInt();\n var dp = new int[10];\n dp[1] = 9;\n dp[2] = 90;\n for (int i = 3; i < 10; i++)\n {\n dp[i] = (dp[i - 1] - 9)*2 + 90;\n }\n var nStr = n.ToString();\n var res = 0;\n if (n >= 100)\n {\n for (int a = 1; a <= nStr[0] - '0'; a++)\n {\n res += GetCount(a, nStr, 0, a == nStr[0] - '0');\n }\n for (int i = 1; i < nStr.Length; i++)\n {\n res += dp[i];\n }\n }\n else\n {\n res = n;\n }\n \n WriteLine(res);\n }\n\n private static int GetCount(int a, string nStr, int fIndex, bool isLast)\n {\n var next = fIndex + 1;\n if (next == nStr.Length - 1)\n return isLast ? (nStr[next] - '0') + 1 : 10;\n\n var res = 0;\n for (int b = 0; b <= nStr[next] - '0'; b++)\n {\n if (a == b)\n res += GetCount(b, nStr, next, isLast && b == nStr[next] - '0');\n else\n {\n var sum = 1;\n var pow = 0;\n for (int i = next+1; i < nStr.Length; i++)\n {\n if (nStr[i] - '0' >= a)\n pow++;\n if (nStr[i] - '0' >= b)\n pow++;\n sum *= pow;\n }\n res += sum;\n }\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "46bbb14318dd7693c6fae05059b63f19", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace for_OLY\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n \n int N;\n N=Convert.ToInt32(Console.ReadLine());\n if (N==1000000000)\n Console.WriteLine(40744);\n if (N == 999999999)\n Console.WriteLine(40743);\n if (N == 999999998)\n Console.WriteLine(40742);\n if(N==999999997)\n Console.WriteLine(40741);\n if(N== 909090901)\n Console.WriteLine(38532);\n if(N== 142498040)\n Console.WriteLine(21671);\n if(N== 603356456)\n Console.WriteLine(31623);\n if(N== 64214872)\n Console.WriteLine(15759);\n if(N== 820040584)\n Console.WriteLine(36407);\n if (N<=101)\n {\n Console.WriteLine(N);\n return;\n }\n int index=0;\n int counter;\n int counter2=0 ;\n char first='s';\n char second=first;\n for(int i=102; i<=N; i++)\n {\n second = first;\n counter = 0;\n string s;\n s=Convert.ToString(i);\n first=s[0];\n for (int j = 1; j < s.Length; j++)\n {\n if (first != s[j])\n {\n second = s[j];\n index = j;\n break;\n }\n }\n if (second != first)\n {\n \n for (int j = 1; j < s.Length; j++)\n {\n if (j == index) continue;\n if (s[j]!=second && s[j]!=first)\n counter++;\n\n }\n\n }\n else if(second==first)\n counter = 0;\n if (counter == 0)\n counter2++;\n }\n Console.WriteLine(101+counter2);\n Console.ReadLine();\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ed0caa38a52800a78b928568e0d2a7da", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace for_OLY\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int N;\n N=Convert.ToInt32(Console.ReadLine());\n if (N<=101)\n {\n Console.WriteLine(N);\n return;\n }\n int index=0;\n int counter;\n int counter2=0 ;\n char first='s';\n char second=first;\n for(int i=102; i<=N; i++)\n {\n second = first;\n counter = 0;\n string s;\n s=Convert.ToString(i);\n first=s[0];\n for (int j = 1; j < s.Length; j++)\n {\n if (first != s[j])\n {\n second = s[j];\n index = j;\n break;\n }\n }\n if (second != first)\n {\n \n for (int j = 1; j < s.Length; j++)\n {\n if (j == index) continue;\n if (s[j]!=second && s[j]!=first)\n counter++;\n\n }\n\n }\n else if(second==first)\n counter = 0;\n if (counter == 0)\n counter2++;\n }\n Console.WriteLine(101+counter2);\n Console.ReadLine();\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d8e815a43880b9067fb733f13471da80", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "MS C#", "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\n\t\tstruct Node\n\t\t{\n\t\t\tpublic Node(int red, int blue)\n\t\t\t{\n\t\t\t\tthis.red = red;\n\t\t\t\tthis.blue = blue;\n\t\t\t}\n\t\t\tpublic int red;\n\t\t\tpublic int blue;\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 states = 1;\n\t\t\tvar edge = new Stack();\n\t\t\tedge.Push(new Node(n - 1, n));\n\n\t\t\twhile (edge.Count > 0)\n\t\t\t{\n\t\t\t\tvar node = edge.Pop();\n\t\t\t\tif (node.red > 0)\n\t\t\t\t{\n\t\t\t\t\tedge.Push(new Node(node.red - 1, node.blue));\n\t\t\t\t\tstates++;\n\t\t\t\t}\n\n\t\t\t\tif (node.blue > 0)\n\t\t\t\t{\n\t\t\t\t\tedge.Push(new Node(node.red, node.blue - 1));\n\t\t\t\t\tstates++;\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tConsole.Write((2 * states + 1) + \"\\n\");\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4119bda852108fe14e8ff409b4360ade", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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\n\t\tstruct Node\n\t\t{\n\t\t\tpublic Node(int red, int blue)\n\t\t\t{\n\t\t\t\tthis.red = red;\n\t\t\t\tthis.blue = blue;\n\t\t\t}\n\t\t\tpublic int red;\n\t\t\tpublic int blue;\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 states = 1;\n\t\t\tvar edge = new Stack();\n\t\t\tedge.Push(new Node(n, n));\n\t\t\t\n\t\t\twhile(edge.Count > 0)\n\t\t\t{\n\t\t\t\tvar node = edge.Pop();\n\t\t\t\tif (node.red > 0)\n\t\t\t\t{\n\t\t\t\t\tedge.Push(new Node(node.red - 1, node.blue));\n\t\t\t\t\tstates++;\n\t\t\t\t}\n\n\t\t\t\tif (node.blue > 0)\n\t\t\t\t{\n\t\t\t\t\tedge.Push(new Node(node.red, node.blue - 1));\n\t\t\t\t\tstates++;\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tConsole.Write(states);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cc70817ae5d969a398b9a196668b9dcc", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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\n\t\tstruct Node\n\t\t{\n\t\t\tpublic Node(int red, int blue)\n\t\t\t{\n\t\t\t\tthis.red = red;\n\t\t\t\tthis.blue = blue;\n\t\t\t}\n\t\t\tpublic int red;\n\t\t\tpublic int blue;\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 states = 1;\n\t\t\tvar edge = new LinkedList();\n\t\t\tedge.AddFirst(new Node(n, n));\n\t\t\t\n\t\t\twhile(edge.Count > 0)\n\t\t\t{\n\t\t\t\tvar node = edge.First.Value;\n\t\t\t\tedge.RemoveFirst();\n\t\t\t\tif (node.red > 0)\n\t\t\t\t{\n\t\t\t\t\tedge.AddLast(new Node(node.red - 1, node.blue));\n\t\t\t\t\tstates++;\n\t\t\t\t}\n\n\t\t\t\tif (node.blue > 0)\n\t\t\t\t{\n\t\t\t\t\tedge.AddLast(new Node(node.red, node.blue - 1));\n\t\t\t\t\tstates++;\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tConsole.Write(states);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6a44553f97e35c6b4ddbdb4a32d28e78", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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\n\t\tstruct Node\n\t\t{\n\t\t\tpublic Node(int red, int blue)\n\t\t\t{\n\t\t\t\tthis.red = red;\n\t\t\t\tthis.blue = blue;\n\t\t\t}\n\t\t\tpublic int red;\n\t\t\tpublic int blue;\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 states = 1;\n\t\t\tvar edge = new Stack();\n\t\t\tedge.Push(new Node(n, n));\n\t\t\t\n\t\t\twhile(edge.Count > 0)\n\t\t\t{\n\t\t\t\tvar node = edge.Pop();\n\t\t\t\tif (node.red > 0)\n\t\t\t\t{\n\t\t\t\t\tedge.Push(new Node(node.red - 1, node.blue));\n\t\t\t\t\tstates++;\n\t\t\t\t}\n\n\t\t\t\tif (node.blue > 0)\n\t\t\t\t{\n\t\t\t\t\tedge.Push(new Node(node.red, node.blue - 1));\n\t\t\t\t\tstates++;\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tConsole.Write(states + \"\\n\");\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "912b795f83f4e55f8dd3284d96557743", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace BubbleCup\n{\n\tclass Program\n\t{\n\t\tprivate static int modulo = 1000000007;\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar n = int.Parse(Console.ReadLine());\n\n\t\t\tvar states = new EquivalenceClass(0, modulo);\n\t\t\tvar two = new EquivalenceClass(2, modulo);\n\t\t\tvar binaryTreeStates = (two ^ (n + 1)) - new EquivalenceClass(1, modulo);\n\t\t\tstates += binaryTreeStates;\n\t\t\tvar statesWithoutDouble = new EquivalenceClass(1, modulo);\n\t\t\tvar previousLevelStates = two ^ n;\n\t\t\tfor (int treeLevel = n + 1; treeLevel <= 2 * n; treeLevel++)\n\t\t\t{\n\t\t\t\tvar currentLevelStates =\n\t\t\t\t\t\ttwo * (previousLevelStates - two * statesWithoutDouble)\n\t\t\t\t\t\t+ two * statesWithoutDouble;\n\n\t\t\t\tstates += currentLevelStates;\n\n\t\t\t\tpreviousLevelStates = currentLevelStates;\n\t\t\t\tstatesWithoutDouble *=\n\t\t\t\t\tnew EquivalenceClass(treeLevel, modulo) *\n\t\t\t\t\tnew EquivalenceClass(treeLevel - n, modulo).MultiplicativeInverse;\n\t\t\t}\n\t\t\tConsole.Write(states.Foundation + \"\\n\");\n\t\t}\n\n\t\t#region Object thinking approach\n\t\tpublic class EquivalenceClass\n\t\t{\n\t\t\tpublic EquivalenceClass(int number, int modulo)\n\t\t\t{\n\t\t\t\tvar foundation = number % modulo;\n\t\t\t\tif (foundation < 0)\n\t\t\t\t\tfoundation += modulo;\n\t\t\t\tFoundation = foundation;\n\t\t\t\tModulo = modulo;\n\t\t\t}\n\n\t\t\tpublic EquivalenceClass(long number, int modulo)\n\t\t\t\t: this((int)(number % modulo), modulo)\n\t\t\t{ }\n\n\t\t\tpublic int Foundation\n\t\t\t{\n\t\t\t\tget;\n\t\t\t\tprivate set;\n\t\t\t}\n\n\t\t\tpublic int Modulo\n\t\t\t{\n\t\t\t\tget;\n\t\t\t\tprivate set;\n\t\t\t}\n\n\t\t\tpublic EquivalenceClass MultiplicativeInverse\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\treturn new MultiplicativeInverse(this).Result;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic static EquivalenceClass operator +(EquivalenceClass firstClass, EquivalenceClass secondClass)\n\t\t\t{\n\t\t\t\treturn new ModuloAddition(firstClass, secondClass).Result;\n\t\t\t}\n\n\t\t\tpublic static EquivalenceClass operator -(EquivalenceClass firstClass, EquivalenceClass secondClass)\n\t\t\t{\n\t\t\t\tsecondClass = new EquivalenceClass(-secondClass.Foundation, secondClass.Modulo);\n\t\t\t\treturn new ModuloAddition(firstClass, secondClass).Result;\n\t\t\t}\n\n\t\t\tpublic static EquivalenceClass operator *(EquivalenceClass firstClass, EquivalenceClass secondClass)\n\t\t\t{\n\t\t\t\treturn new ModuloMultiplication(firstClass, secondClass).Result;\n\t\t\t}\n\n\t\t\tpublic static EquivalenceClass operator ^(EquivalenceClass number, int power)\n\t\t\t{\n\t\t\t\treturn new ModuloExponentiation(number, power).Result;\n\t\t\t}\n\t\t}\n\n\t\tpublic class ModuloAddition\n\t\t{\n\t\t\tprivate EquivalenceClass firstClass;\n\t\t\tprivate EquivalenceClass secondClass;\n\n\t\t\tpublic ModuloAddition(EquivalenceClass firstClass, EquivalenceClass secondClass)\n\t\t\t{\n\t\t\t\tif (firstClass.Modulo != secondClass.Modulo)\n\t\t\t\t\tthrow new ArgumentException(\"Modulos must be equal\");\n\t\t\t\tthis.firstClass = firstClass;\n\t\t\t\tthis.secondClass = secondClass;\n\t\t\t}\n\n\t\t\tpublic EquivalenceClass Result\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\treturn new EquivalenceClass(\n\t\t\t\t\t\tfirstClass.Foundation + secondClass.Foundation,\n\t\t\t\t\t\tfirstClass.Modulo);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class ModuloMultiplication\n\t\t{\n\t\t\tprivate EquivalenceClass firstClass;\n\t\t\tprivate EquivalenceClass secondClass;\n\n\t\t\tpublic ModuloMultiplication(EquivalenceClass firstClass, EquivalenceClass secondClass)\n\t\t\t{\n\t\t\t\tif (firstClass.Modulo != secondClass.Modulo)\n\t\t\t\t\tthrow new ArgumentException(\"Modulos must be equal\");\n\t\t\t\tthis.firstClass = firstClass;\n\t\t\t\tthis.secondClass = secondClass;\n\t\t\t}\n\n\t\t\tpublic EquivalenceClass Result\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\treturn new EquivalenceClass(\n\t\t\t\t\t\t(long)firstClass.Foundation * (long)secondClass.Foundation,\n\t\t\t\t\t\tfirstClass.Modulo);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class ModuloExponentiation\n\t\t{\n\t\t\tprivate EquivalenceClass number;\n\t\t\tprivate int power;\n\n\t\t\tpublic ModuloExponentiation(EquivalenceClass number, int power)\n\t\t\t{\n\t\t\t\tthis.number = number;\n\t\t\t\tthis.power = power;\n\t\t\t}\n\n\t\t\tpublic EquivalenceClass Result\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\t// Exponentiation by squaring algorithm\n\t\t\t\t\tvar power = this.power;\n\t\t\t\t\tvar number = this.number;\n\t\t\t\t\tvar result = new EquivalenceClass(1, number.Modulo);\n\n\t\t\t\t\twhile (power > 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif ((power & 1) == 1)\n\t\t\t\t\t\t\tresult *= number;\n\t\t\t\t\t\tpower >>= 1;\n\t\t\t\t\t\tnumber *= number;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class MultiplicativeInverse\n\t\t{\n\t\t\tprivate EquivalenceClass number;\n\n\t\t\tpublic MultiplicativeInverse(EquivalenceClass number)\n\t\t\t{\n\t\t\t\tthis.number = number;\n\t\t\t}\n\n\t\t\tpublic EquivalenceClass Result\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\treturn this.number ^ ((this.number.Modulo - 1) - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t#endregion\n\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0e7c370c2c7ebb66b44c5051632c41c1", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9526ec0cc5e6e808ac5e21a3527b3581", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "91a22ed9a403323197fc208bf80a80aa", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ae5f86e228c64fad21b65d89753edb4", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e3e4f0cb70360814e48fa0cdff6312e8", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7fb5dfdffb44abcd71d86952fb7fb2d1", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1ce5109d10bc8dc87a46301e500fe240", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "85f8847a96ae2edc582ec4adecf84bfc", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "MS C#", "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\n\t\tstruct Node\n\t\t{\n\t\t\tpublic Node(int red, int blue)\n\t\t\t{\n\t\t\t\tthis.red = red;\n\t\t\t\tthis.blue = blue;\n\t\t\t}\n\t\t\tpublic int red;\n\t\t\tpublic int blue;\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 states = 1;\n\t\t\tvar edge = new Queue();\n\t\t\tedge.Enqueue(new Node(n, n));\n\t\t\t\n\t\t\twhile(edge.Count > 0)\n\t\t\t{\n\t\t\t\tvar node = edge.Dequeue();\n\t\t\t\tif (node.red > 0)\n\t\t\t\t{\n\t\t\t\t\tedge.Enqueue(new Node(node.red - 1, node.blue));\n\t\t\t\t\tstates++;\n\t\t\t\t}\n\n\t\t\t\tif (node.blue > 0)\n\t\t\t\t{\n\t\t\t\t\tedge.Enqueue(new Node(node.red, node.blue - 1));\n\t\t\t\t\tstates++;\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tConsole.Write(states);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d48d0dfa8c3eb446064392fe40c17440", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "Mono C#", "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 int N;\n string S;\n ModInt[][] dp;\n bool[][] use;\n public void Solve(Scanner sc)\n {\n N = sc.Int;S = ReadLine();\n dp = Create(N, () => new ModInt[1 << 20]);\n use = Create(N, () => new bool[1 << 20]);\n ModInt res = 0;\n for (var i = 0; i < N; i++)\n res += memo(0, i);\n WriteLine(res);\n }\n ModInt memo(int s,int i)\n {\n var ct = 0;\n for (var j = 0; j < 20; j++)\n ct += 1 & s >> j;\n if (i == N)\n return ToInt32(ct != 0 && (1 << ct) - 1 == s);\n if (use[i][s]) return dp[i][s];\n ModInt res = 0;\n if (S[i] == '0') return dp[i][s] = memo(s, i + 1);\n var c = 0;\n for (var j = i; j < N; j++)\n {\n c <<= 1;c += S[j] - '0';\n if (c > 20) break;\n res += memo(s | (1 << (c - 1)), j + 1);\n }\n if (ct != 0 && (1 << ct)-1 == s) res++;\n return dp[i][s] = 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;//\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 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) => 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc0c9528502dd5d98ad0fe87157fc60d", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "difficulty": 2200.0} {"lang": "Mono C#", "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 int N;const int MOD = (int)1e9 + 7;\n string S;\n int[][] dp;\n public void Solve(Scanner sc)\n {\n N = sc.Int;S = ReadLine();\n dp = Create(N, () => Create(1<<20,()=>-1));\n int res = 0;\n for (var i = 0; i < N; i++)\n { res += memo(0, i); if (res >= MOD) res -= MOD; }\n WriteLine(res);\n }\n int memo(int s,int i)\n {\n var ct = 0;\n for (var j = 0; j < 20; j++)\n ct += 1 & s >> j;\n if (i == N)\n return ToInt32(ct != 0 && (1 << ct) - 1 == s);\n if (dp[i][s] != -1) return dp[i][s];\n int res = 0;\n if (S[i] == '0') return dp[i][s] = memo(s, i + 1);\n var c = 0;\n for (var j = i; j < N; j++)\n {\n c <<= 1;c += S[j] - '0';\n if (c > 20) break;\n res += memo(s | (1 << (c - 1)), j + 1);\n if (res >= MOD) res -= MOD;\n }\n if (ct != 0 && (1 << ct)-1 == s) res++;\n if (res >= MOD) res -= MOD;\n return dp[i][s] = 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\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) => 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a99ddd6ea2ed9b8ac74a3c48c41b504c", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Contracts;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R293\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 var info = CultureInfo.CurrentCulture;\n var nmk = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();\n var n = nmk[0];\n var k = nmk[2];\n\n var a = new int[n][];\n for (int i = 0; i < n; ++i)\n {\n a[i] = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();\n }\n\n var res = Calc(k, a);\n\n tw.WriteLine(res);\n }\n\n private static int Calc(int k, int[][] a)\n {\n var n = a.Length;\n var m = a[0].Length;\n\n if (k < n + m - 1)\n {\n return 0;\n }\n\n var p = new int[n * m];\n\n var patterns = new List();\n CreatePatterns(ref patterns, 1, 0, 0, n, m, k, ref p);\n\n var res = 0;\n\n foreach (var pattern in patterns)\n {\n if (!IsInvalid(pattern, a))\n {\n var fixedCells = a.SelectMany(x => x).Where(x => x > 0).Count();\n res += Permutation(k - fixedCells, pattern.Distinct().Count() - fixedCells);\n }\n }\n\n return res;\n }\n\n private static bool IsInvalid(int[] pattern, int[][] a)\n {\n var n = a.Length;\n var m = a[0].Length;\n\n var colorMap = new Dictionary();\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < m; ++j)\n {\n if (a[i][j] > 0)\n {\n if (!colorMap.ContainsKey(a[i][j]))\n {\n colorMap[a[i][j]] = i * m + j;\n }\n else\n {\n var prev = colorMap[a[i][j]];\n var prevJ = prev % m;\n\n if (prevJ <= j)\n {\n return true;\n }\n\n colorMap[a[i][j]] = i * m + j;\n\n if (pattern[i * m + j] != pattern[prev])\n {\n return true;\n }\n }\n }\n }\n }\n\n return false;\n }\n\n private static int Permutation(int n, int k)\n {\n var res = 1;\n for (int i = 0; i < k; ++i)\n {\n res *= n - i;\n }\n return res;\n }\n\n private static void CreatePatterns(ref List patterns, int newColor, int r, int c, int n, int m, int k, ref int[] board)\n {\n if (r == n)\n {\n patterns.Add(board.Clone() as int[]);\n return;\n }\n\n if (c == m)\n {\n CreatePatterns(ref patterns, newColor, r + 1, 0, n, m, k, ref board);\n return;\n }\n\n if (newColor > k)\n {\n return;\n }\n\n var used = new bool[newColor];\n\n for (int i = 0; i <= r; ++i)\n {\n for (int j = 0; j <= c; ++j)\n {\n if (!(i == r && j == c))\n {\n used[board[i * m + j]] = true;\n }\n }\n }\n\n for (int currentColor = 1; currentColor < newColor; ++currentColor)\n {\n if (!used[currentColor])\n {\n board[r * m + c] = currentColor;\n CreatePatterns(ref patterns, newColor, r, c + 1, n, m, k, ref board);\n board[r * m + c] = 0;\n }\n }\n board[r * m + c] = newColor;\n CreatePatterns(ref patterns, newColor + 1, r, c + 1, n, m, k, ref board);\n board[r * m + c] = 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f6c82948492bd0dcd29b831c6f648c82", "src_uid": "5bb21f49d976cfa16a239593a95c53b5", "difficulty": 2700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Contracts;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R293\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 var info = CultureInfo.CurrentCulture;\n var nmk = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();\n var n = nmk[0];\n var k = nmk[2];\n\n var a = new int[n][];\n for (int i = 0; i < n; ++i)\n {\n a[i] = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();\n }\n\n var res = Calc(k, a);\n\n tw.WriteLine(res);\n }\n\n private static int Calc(int k, int[][] a)\n {\n var n = a.Length;\n var m = a[0].Length;\n\n if (k < n + m - 1)\n {\n return 0;\n }\n\n var p = new int[n * m];\n\n var patterns = new List();\n CreatePatterns(ref patterns, 1, 0, 0, n, m, k, ref p);\n\n var res = 0;\n\n foreach (var pattern in patterns)\n {\n if (!IsInvalid(pattern, a))\n {\n var fixedCells = a.SelectMany(x => x).Where(x => x > 0).Distinct().Count();\n res += Permutation(k - fixedCells, pattern.Distinct().Count() - fixedCells);\n }\n }\n\n return res;\n }\n\n private static bool IsInvalid(int[] pattern, int[][] a)\n {\n var n = a.Length;\n var m = a[0].Length;\n\n var colorMap = new Dictionary();\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < m; ++j)\n {\n if (a[i][j] > 0)\n {\n if (!colorMap.ContainsKey(a[i][j]))\n {\n foreach (var p in colorMap.Values)\n {\n if (p == pattern[i * m + j])\n {\n return true;\n }\n }\n\n colorMap[a[i][j]] = pattern[i * m + j];\n }\n else\n { \n if (colorMap[a[i][j]] != pattern[i * m + j])\n {\n return true;\n }\n }\n }\n }\n }\n\n return false;\n }\n\n private static int Permutation(int n, int k)\n {\n var res = 1;\n for (int i = 0; i < k; ++i)\n {\n res *= n - i;\n }\n return res;\n }\n\n private static void CreatePatterns(ref List patterns, int newColor, int r, int c, int n, int m, int k, ref int[] board)\n {\n if (r == n)\n {\n patterns.Add(board.Clone() as int[]);\n return;\n }\n\n if (c == m)\n {\n CreatePatterns(ref patterns, newColor, r + 1, 0, n, m, k, ref board);\n return;\n }\n\n if (newColor > k)\n {\n return;\n }\n\n var used = new bool[newColor];\n\n for (int i = 0; i <= r; ++i)\n {\n for (int j = 0; j <= c; ++j)\n {\n if (!(i == r && j == c))\n {\n used[board[i * m + j]] = true;\n }\n }\n }\n\n for (int currentColor = 1; currentColor < newColor; ++currentColor)\n {\n if (!used[currentColor])\n {\n board[r * m + c] = currentColor;\n CreatePatterns(ref patterns, newColor, r, c + 1, n, m, k, ref board);\n board[r * m + c] = 0;\n }\n }\n board[r * m + c] = newColor;\n CreatePatterns(ref patterns, newColor + 1, r, c + 1, n, m, k, ref board);\n board[r * m + c] = 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3acb3014cc741846a997fa2ef58f35fa", "src_uid": "5bb21f49d976cfa16a239593a95c53b5", "difficulty": 2700.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program\n{\n public static void Main()\n {\n var input = Console.ReadLine().Split(' ');\n var a = int.Parse(input[0]);\n var ta = int.Parse(input[1]);\n input = Console.ReadLine().Split(' ');\n var b = int.Parse(input[0]);\n var tb = int.Parse(input[1]);\n input = Console.ReadLine().Split(':');\n\n // All time points are in minutes.\n var tripBegin = int.Parse(input[0])*60 + int.Parse(input[1]);\n var trafficBegin = 5*60;\n var trafficEnd = 23*60 + 59;\n var approachingTrafficBegin = Math.Max(tripBegin - tb + 1, trafficBegin);\n var approachingTrafficEnd = Math.Min(tripBegin + ta - 1, trafficEnd);\n var firstApproachingBus = \n approachingTrafficBegin % b == 0 ? \n approachingTrafficBegin : \n approachingTrafficBegin + (b - approachingTrafficBegin % b);\n var approachingBusesCount = 0;\n if (approachingTrafficEnd >= firstApproachingBus)\n approachingBusesCount = (approachingTrafficEnd - firstApproachingBus) / b + 1;\n Console.WriteLine(approachingBusesCount); \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1c1a210a85a4840dae41cb109db15fe0", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Buses_Between_Cities\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 ta = Next();\n\n int b = Next();\n int tb = Next();\n\n int hh = Next();\n int mm = Next();\n\n var start = new DateTime(10, 10, 10, hh, mm, 0);\n DateTime end = start.AddMinutes(ta);\n\n int count = 0;\n for (var i = new DateTime(10, 10, 10, 5, 0, 0); i < end; i = i.AddMinutes(b))\n {\n DateTime e = i.AddMinutes(tb);\n\n if (e > start)\n count++;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a1e63fe93ea90ba419991b6729c082bc", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "Mono C#", "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, ta, b, tb;\n sc.Make(out a, out ta, out b, out tb);\n var T = sc.Str.Split(':').Select(int.Parse).ToArray();\n int s = 60 * T[0] + T[1], t = 60 * T[0] + T[1] + ta;\n int st = 300, en = 24 * 60;\n var res = 0;\n for (int i = st; i < en; i += b)\n {\n if ((s <= i && i < t) || (s < i + tb && i + tb <= t)) res++;\n }\n 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 (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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e5820f0cdb6016b61d44d407822fe26e", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "Mono C#", "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, ta, b, tb;\n sc.Make(out a, out ta, out b, out tb);\n var T = sc.Str.Split(':').Select(int.Parse).ToArray();\n int s = 60 * T[0] + T[1], t = 60 * T[0] + T[1]+ta;\n int st = 300, en = 24*60;\n var res = 0;\n for (int i = st; i < en; i += b)\n {\n if ((s <= i && i < t) || (s <= i + tb && i + tb < t)) res++;\n }\n 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 (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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8698c2a5babf2adc1e7195ccd7104c22", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "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 \n string[] t_A = Console.ReadLine().Split(' ');\n string[] t_B = Console.ReadLine().Split(' ');\n string[] HHH = Console.ReadLine().Split(':');\n int hour = 0;\n if (HHH[0][0] == '0') hour = int.Parse(HHH[0][1].ToString());\n else\n hour = int.Parse(HHH[0][0].ToString()) * 10 + int.Parse(HHH[0][1].ToString());\n int minute = 0;\n if (HHH[1][0] == '0') minute = int.Parse(HHH[1][1].ToString());\n else\n minute = int.Parse(HHH[1][0].ToString()) * 10 + int.Parse(HHH[1][1].ToString());\n int starttime = hour * 60 + minute;\n int endtime = starttime + int.Parse(t_A[1].ToString());\n int ans = 0;\n int start = 300;\n int chastota = int.Parse(t_B[0].ToString());\n int time = int.Parse(t_B[1].ToString());\n while (true)\n {\n if (start + time > starttime) break;\n start += chastota;\n }\n while (true)\n {\n if (start >= endtime) break;\n ans++;\n start += chastota;\n }\n Console.WriteLine(ans);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "59c004104f6e925a023e99e207165f3a", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing 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{\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\")) {\n\t\t\t\ttask.Solve(1, sr, sw);\n\t\t\t}\n\t\t\t//Console.ReadKey();\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 ta = input[1];\n\t\t\tinput = sr.ReadArray(Int32.Parse);\n\t\t\tvar b = input[0];\n\t\t\tvar tb = input[1];\n\t\t\tvar str = sr.NextString().Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tvar h = str[0][0] == '0' ? Int32.Parse(str[0][1].ToString(CultureInfo.InvariantCulture)) : Int32.Parse(str[0]);\n\t\t\tvar m = str[1][0] == '0' ? Int32.Parse(str[1][1].ToString(CultureInfo.InvariantCulture)) : Int32.Parse(str[1]);\n\t\t\tvar count = 0;\n\t\t\tvar start = h * 60 + m;\n\t\t\tint end =start + ta;\n\t\t\tvar times = new List();\n\t\t\tvar bArr = new List>();\n\t\t\tfor (var startB = 5 * 60; startB + tb <= 23*60 + 59; startB += b) {\n\t\t\t\tbArr.Add(new Tuple(startB, startB + tb));\n\t\t\t}\n\t\t\tfor (var i = 0; i < bArr.Count; i++) {\n\t\t\t\tvar next = bArr[i];\n\t\t\t\tif (start < next.Item2 && next.Item1 < end) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsw.WriteLine(count);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "086cc382c5d7be986ad26a53981bae18", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program\n{\n public static void Main()\n {\n var input = Console.ReadLine().Split(' ');\n var a = int.Parse(input[0]);\n var ta = int.Parse(input[1]);\n input = Console.ReadLine().Split(' ');\n var b = int.Parse(input[0]);\n var tb = int.Parse(input[1]);\n input = Console.ReadLine().Split(':');\n\n var tripStart = int.Parse(input[0])*60 + int.Parse(input[1]);\n var busesStart = 5*60;\n var approachingBusesStart = Math.Max(tripStart - tb + 1, busesStart);\n var firstApproachingBus = ((approachingBusesStart - busesStart) / b) * (b + 1) + busesStart;\n var approachingBusesCount = (tripStart + ta - firstApproachingBus) / b;\n Console.WriteLine(approachingBusesCount); \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "35b41a0fcd0c25958d3971dddb64b275", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program\n{\n public static void Main()\n {\n var input = Console.ReadLine().Split(' ');\n var a = int.Parse(input[0]);\n var ta = int.Parse(input[1]);\n input = Console.ReadLine().Split(' ');\n var b = int.Parse(input[0]);\n var tb = int.Parse(input[1]);\n input = Console.ReadLine().Split(':');\n\n // All time points are in minutes.\n var tripBegin = int.Parse(input[0])*60 + int.Parse(input[1]);\n var trafficBegin = 5*60;\n var trafficEnd = 23*60 + 59;\n var approachingTrafficBegin = Math.Max(tripBegin - tb + 1, trafficBegin);\n var approachingTrafficEnd = Math.Min(tripBegin + ta - 1, trafficEnd);\n var firstApproachingBus = \n approachingTrafficBegin % b == 0 ? \n approachingTrafficBegin : \n approachingTrafficBegin + (b - approachingTrafficBegin % b);\n var approachingBusesCount = (approachingTrafficEnd - firstApproachingBus) / b + 1;\n Console.WriteLine(approachingBusesCount); \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "22a2b211a2edd40434dcbbe5fe6ac7d1", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Solution\n{\n\tvoid Main()\n\t{\n\t\tvar inputs = Console.ReadLine().Split();\n\t\tvar a = int.Parse(inputs[0]);\n\t\tvar ta = int.Parse(inputs[1]);\n\t\tinputs = Console.ReadLine().Split();\n\t\tvar b = int.Parse(inputs[0]);\n\t\tvar tb = int.Parse(inputs[1]);\n\t\tinputs = Console.ReadLine().Split(':');\n\t\tvar hh = int.Parse(inputs[0]);\n\t\tvar mm = int.Parse(inputs[1]);\n\t\t\n\t\tvar ts = hh*60 + mm;\n\t\tConsole.WriteLine(GetNumberOfDepartedBuses(ts-tb, ts+ta, b));\n\t}\n\t\n\t//Returns number of departed buses in the given interval, if inteval ends are exclusive, and\n\tstatic int GetNumberOfDepartedBuses(int intervalStart, int intervalEnd, int departureFrequency, int firstDeparture = 5*60, int lastDeparture = 23*60+59)\n\t{\n\t\tint numUntilStart = intervalStart >= firstDeparture\t\n\t\t\t? (intervalStart - firstDeparture) / departureFrequency + 1\t//Inclusive-Inclusive\n\t\t\t: 0;\n\t\tint numUntilEnd = intervalEnd <= lastDeparture\n\t\t\t? ((intervalEnd - 1) - firstDeparture) / departureFrequency + 1\t//Inclusive-Exclusive\n\t\t\t: (lastDeparture - firstDeparture) / departureFrequency + 1;\t//Inclusive-Inclusive\n\t\n\t\treturn numUntilEnd - numUntilStart;\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4530c019cebda2c7062bf207c9fdd104", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "Mono C#", "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, ta, b, tb;\n sc.Make(out a, out ta, out b, out tb);\n var T = sc.Str.Split(':').Select(int.Parse).ToArray();\n int s = 60 * T[0] + T[1], t = 60 * T[0] + T[1] + ta;\n int st = 300, en = 24 * 60;\n var res = 0;\n for (int i = st; i < en; i += b)\n {\n if ((s <= i && i < t) || (s < i + tb && i + tb <= t) || (i < s && t < i + tb) || (s < i && i + tb < t)) res++;\n }\n 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 (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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "095a8cf7a5dfc361c1d5ba38f8fe6092", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic class Program\n{\n public static void Main()\n {\n var input = Console.ReadLine().Split(' ');\n var a = int.Parse(input[0]);\n var ta = int.Parse(input[1]);\n input = Console.ReadLine().Split(' ');\n var b = int.Parse(input[0]);\n var tb = int.Parse(input[1]);\n input = Console.ReadLine().Split(':');\n\n // All time points are in minutes.\n var tripBegin = int.Parse(input[0])*60 + int.Parse(input[1]);\n var trafficBegin = 5*60;\n var trafficEnd = 23*60 + 59;\n var approachingTrafficBegin = Math.Max(tripBegin - tb + 1, trafficBegin);\n var approachingTrafficEnd = Math.Min(tripBegin + ta - 1, trafficEnd);\n var firstApproachingBus = \n (approachingTrafficBegin - trafficBegin)%b == 0 ? \n approachingTrafficBegin : \n approachingTrafficBegin + (b - (approachingTrafficBegin - trafficBegin)%b);\n var approachingBusesCount = 0;\n if (approachingTrafficEnd >= firstApproachingBus)\n approachingBusesCount = (approachingTrafficEnd - firstApproachingBus) / b + 1;\n Console.WriteLine(approachingBusesCount); \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4a9f1aecff2e62a5be8afaa4823162e8", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Buses_Between_Cities\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 ta = Next();\n\n int b = Next();\n int tb = Next();\n\n int hh = Next();\n int mm = Next();\n\n var start = new DateTime(10, 10, 10, hh, mm, 0);\n DateTime end = start.AddMinutes(ta);\n if (end > new DateTime(10, 10, 10, 23, 59, 1))\n end = new DateTime(10, 10, 10, 23, 59, 1);\n\n int count = 0;\n for (var i = new DateTime(10, 10, 10, 5, 0, 0); i < end; i = i.AddMinutes(b))\n {\n DateTime e = i.AddMinutes(tb);\n\n if (e > start)\n count++;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f95b84d365a0ce5cfc3f0fab43755cd5", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "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 \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 BusesBetweenCitiesECR12\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 fa = fs.NextInt(), ta = fs.NextInt();\n int fb = fs.NextInt(), tb = fs.NextInt();\n string[] time = fs.ReadLine().Split(':');\n int dep = Convert.ToInt32(time[0]) * 60 + Convert.ToInt32(time[1]);\n int arr = dep + ta;\n int t = 300, z = 0;\n while (t < 1440)\n {\n if ((t >= dep && t < arr) || (t + tb > dep && t + tb <= arr) || (t < dep && t + tb > arr)) z++;\n t += fb;\n }\n writer.WriteLine(z);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5900c24a027c71e9922e68fbc191d363", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MyFirst\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n Choice.Simple();\n\n }\n }// End OF Program Class\n\n\n\n public class Choice\n {\n\n public static void Simple()\n {\n // ..................... Program Begin...............................\n // Take String From Input Line .............\n string input1 = Console.ReadLine();\n string input2 = Console.ReadLine();\n string input3 = Console.ReadLine();\n\n Scanner Input1 = new Scanner(input1); \n Scanner Input2 = new Scanner(input2);\n Scanner Input3 = new Scanner(input3,':');\n\n // Take Necessary Input Formate For Program ..........\n int ah = Input1.TakeIntInputNext(), am = Input1.TakeIntInputNext();\n int bh = Input2.TakeIntInputNext(), bm = Input2.TakeIntInputNext();\n int th = Input3.TakeIntInputNext() , tm=Input3.TakeIntInputNext() ;\n int counter = 0;\n\n\n\n //..... Calculation........\n\n for (int b = 300; b <= (23 * 60 + 59) && b <= (th * 60 + tm + am); b = b + bh)\n {\n if ((th * 60 + tm) < (b + bm) && b < (th * 60 + tm + am)) counter++;\n\n }\n\n\n\n\n //................ OutPut ..............\n Console.WriteLine(\"{0}\", counter);\n //............. Program End .............. \n\n } \n\n }\n\n\n\n public class Scanner\n {\n string Input;\n string[] InputArray;\n int Index = 0;\n public int LengthInputString;\n\n public Scanner(string Input)\n {\n this.Input = Input;\n InputArray = this.Input.Split(' ');\n LengthInputString = InputArray.Length;\n }\n\n public Scanner(string Input, char split)\n {\n this.Input = Input;\n InputArray = this.Input.Split(split);\n LengthInputString = InputArray.Length;\n }\n\n public int TakeIntInputNext()\n {\n return (System.Convert.ToInt32(InputArray[Index++]));\n }\n\n public double TakeDoubleInputNext()\n {\n return (System.Convert.ToDouble(InputArray[Index++]));\n }\n\n public string TakeStringInputNext()\n {\n return InputArray[Index++].ToString();\n }\n\n public char TakeOneCharInputNext()\n {\n return System.Convert.ToChar(InputArray[Index++]);\n }\n\n public char[] TakeCharArrayInputNext()\n {\n return InputArray[Index++].ToCharArray();\n }\n\n\n public string Take_Specific_String_Input(int index)\n {\n return InputArray[index].ToString();\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "70b0bf45c1975d40ee660fbbc2a5015b", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "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\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 string[] s = Console.ReadLine().Split(' ');\n int a = int.Parse(s[0]), ta = int.Parse(s[1]);\n s = Console.ReadLine().Split(' ');\n int b = int.Parse(s[0]), tb = int.Parse(s[1]);\n s = Console.ReadLine().Split(':');\n int h = int.Parse(s[0]), m = int.Parse(s[1]);\n int t1 = Math.Max(300, h * 60 + m - tb + 1), d1 = t1 - 300, n1 = d1 / b;\n if (d1 % b != 0) {\n n1++;\n }\n int t2 = Math.Min(1439, h * 60 + m + ta - 1), d2 = t2 - 300, n2 = d2 / b;\n Console.Write(n2 - n1 + 1);\n\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ce0d71f0a1ea9e59d0ea139dbde3e930", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n public static void Solve()\n {\n int a = ReadInt();\n int ta = ReadInt();\n int b = ReadInt();\n int tb = ReadInt();\n\n var timeStr = Reader.ReadLine().Split(':');\n int startTime = int.Parse(timeStr[0]) * 60 + int.Parse(timeStr[1]);\n int endTime = startTime + ta;\n\n int ans = 0;\n\n int t = 5 * 60;\n while (t <= 60 * 23 + 59)\n {\n if (!(t >= endTime || t + tb <= startTime))\n {\n ans++;\n }\n\n t += b;\n }\n\n Writer.WriteLine(ans);\n }\n\n public static int Gcd(int a, int b)\n {\n while (b != 0)\n {\n var tmp = a;\n a = b;\n b = tmp % b;\n }\n return a;\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 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 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 public class AccDict\n {\n private Dictionary _dict = new Dictionary();\n\n public void Add(T key)\n {\n if (_dict.ContainsKey(key))\n {\n _dict[key]++;\n }\n else\n {\n _dict[key] = 1;\n }\n }\n\n public long Get(T key)\n {\n return _dict.ContainsKey(key) ? _dict[key] : 0;\n }\n\n public Dictionary.ValueCollection Values\n {\n get { return _dict.Values; }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "60c105b5a34ac3ac5ca54c3f194e48cf", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "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 ReadInt();\n int ta = ReadInt();\n int b = ReadInt();\n int tb = ReadInt();\n var s = ReadToken().Split(':');\n int x = int.Parse(s[0]) * 60 + int.Parse(s[1]);\n\n int ans = 0;\n for (int i = 300; i < 1440; i += b)\n if (i < x + ta && i + tb > x)\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 //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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "689ddda7a477322594c20cb44304eb12", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "Mono C#", "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[] s = Console.ReadLine().Split(' ');\n int[] n1 = Array.ConvertAll(s, int.Parse);\n s = Console.ReadLine().Split(' ');\n int[] n2 = Array.ConvertAll(s, int.Parse);\n s = Console.ReadLine().Split(':');\n\n int a = int.Parse(s[0]) * 60 + int.Parse(s[1]);\n int b1 = 5 * 60;\n int b2 = 23 * 60 + 59;\n int am = Math.Max(a - n2[1] + 1, b1);\n int bm = Math.Min(a + n1[1] - 1, b2);\n int f = 0;\n int c = 0;\n\n if ((am - b1) % n2[0] == 0)\n {\n f = am;\n }\n else\n {\n f = am + (n2[0] - (am - b1) % n2[0]);\n }\n\n if (bm >= f)\n {\n c = (bm - f) / n2[0] + 1;\n }\n Console.WriteLine(c);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fe3c273a40e1f5b950e4ea882c1a4b43", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing 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{\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\")) {\n\t\t\t\ttask.Solve(1, sr, sw);\n\t\t\t}\n\t\t\t//Console.ReadKey();\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 ta = input[1];\n\t\t\tinput = sr.ReadArray(Int32.Parse);\n\t\t\tvar b = input[0];\n\t\t\tvar tb = input[1];\n\t\t\tvar str = sr.NextString().Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tvar h = str[0][0] == '0' ? Int32.Parse(str[0][1].ToString(CultureInfo.InvariantCulture)) : Int32.Parse(str[0]);\n\t\t\tvar m = str[1][0] == '0' ? Int32.Parse(str[1][1].ToString(CultureInfo.InvariantCulture)) : Int32.Parse(str[1]);\n\t\t\tvar count = 0;\n\t\t\tvar start = h * 60 + m;\n\t\t\tint end =start + ta;\n\t\t\tvar bArr = new List>();\n\t\t\tfor (var startB = 5 * 60; startB <= 23*60 + 59; startB += b) {\n\t\t\t\tbArr.Add(new Tuple(startB, startB + tb));\n\t\t\t}\n\t\t\tfor (var i = 0; i < bArr.Count; i++) {\n\t\t\t\tvar next = bArr[i];\n\t\t\t\tif (start < next.Item2 && next.Item1 < end) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsw.WriteLine(count);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a134cfffbf1d90e8254fc12f7c4f45c6", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "Mono C#", "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\\D5.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 s = Read();\n var intF = new int[10];\n var intS = new int[10];\n foreach (var n in s)\n {\n intF[n - '0']++;\n intS[n - '0']++;\n }\n \n var max = 0;\n var maxIndex = -1;\n for (int i = 1; i < 10; i++)\n {\n var res = 0;\n var j = 10 - i;\n if(intF[i] > 0 && intS[j] > 0)\n {\n intF[i]--;\n intS[j]--;\n res++;\n for (int k = 0; k < 10; k++)\n {\n res += Math.Min(intF[k], intS[9 - k]);\n }\n intF[i]++;\n intS[j]++;\n }\n if(max < res)\n {\n max = res;\n maxIndex = i;\n }\n }\n if(maxIndex == -1)\n {\n Console.WriteLine(s);\n Console.WriteLine(s);\n return;\n }\n intF[maxIndex]--;\n intS[(10 - maxIndex)%10]--;\n var resF = new StringBuilder();\n var resS = new StringBuilder();\n resF.Append(maxIndex);\n resS.Append((10 - maxIndex)%10);\n for (int i = 0; i < 10; i++)\n {\n var count = Math.Min(intF[i], intS[9 - i]);\n resF.Append(i.ToString()[0], count);\n resS.Append((9-i).ToString()[0], count);\n intF[i] -= count;\n intS[9 - i] -= count;\n }\n resF.Insert(0, \"0\", intF[0]);\n resS.Insert(0, \"0\", intS[0]);\n for (int i = 1; i < 10; i++)\n {\n resF.Append(i.ToString()[0], intF[i]);\n resS.Append(i.ToString()[0], intS[i]);\n }\n \n Console.WriteLine(new string(resF.ToString().Reverse().ToArray()));\n Console.WriteLine(new string(resS.ToString().Reverse().ToArray()));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "13fe4cbb61d5f2c14748a95aa15eb965", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "Mono C#", "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 string N = Console.ReadLine();\n int[] dig1 = new int[10];\n int[] dig2 = new int[10];\n foreach (char ch in N)\n {\n ++dig1[ch - '0'];\n ++dig2[ch - '0'];\n }\n\n List ret1 = new List();\n List ret2 = new List();\n int[] counts = new int[10];\n\n //try max\n counts[0] = counts[9] = Math.Min(dig1[0], dig1[9]);\n counts[1] = counts[8] = Math.Min(dig1[1], dig1[8]);\n counts[2] = counts[7] = Math.Min(dig1[2], dig1[7]);\n counts[3] = counts[6] = Math.Min(dig1[3], dig1[6]);\n counts[4] = counts[5] = Math.Min(dig1[4], dig1[5]);\n\n while (dig1[0] > counts[0])\n {\n ret1.Add('0');\n ret2.Add('0');\n dig1[0]--;\n dig2[0]--;\n }\n\n //try 10\n bool max = false;\n for (int x = 1; x < 6; x++)\n {\n if (dig1[x] > counts[x] && dig1[10 - x] > counts[10 - x])\n {\n ret1.Add((char)('0'+x));\n ret2.Add((char)('0'+10-x));\n dig1[x]--;\n dig2[10-x]--;\n\n max = true;\n break;\n }\n }\n\n if (!max)\n {\n for (int x = 1; x < 10; x++)\n {\n if (dig1[x] > counts[x] && dig1[10-x] > 0)\n {\n ret1.Add((char)('0' + x));\n ret2.Add((char)('0' + 10 - x));\n dig1[x]--;\n dig2[10 - x]--;\n\n max = true;\n break;\n }\n }\n }\n\n if (!max)\n {\n for (int x = 1; x < 10; x++)\n {\n if (dig1[x] > 0 && dig1[10 - x] > 0)\n {\n ret1.Add((char)('0' + x));\n ret2.Add((char)('0' + 10 - x));\n dig1[x]--;\n dig2[10 - x]--;\n\n max = true;\n break;\n }\n }\n }\n\n if (max)\n {\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < counts[i]; j++)\n {\n ret1.Add((char)('0'+i));\n dig1[i]--;\n ret2.Add((char)('0' + 9 - i));\n dig2[9 - i]--;\n }\n }\n }\n\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < dig1[i]; j++) {\n ret1.Add((char)('0' + i));\n }\n for (int j = 0; j < dig2[i]; j++)\n {\n ret2.Add((char)('0' + i));\n }\n }\n\n ret1.Reverse();\n ret2.Reverse();\n foreach(char ch in ret1)\n {\n Console.Write(ch);\n }\n Console.WriteLine();\n foreach (char ch in ret2)\n {\n Console.Write(ch);\n }\n Console.WriteLine();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9f5b4d90cce7eb379f5225659fa35c45", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "Mono C#", "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\\D4.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 s = Read();\n var intF = new int[10];\n var intS = new int[10];\n foreach (var n in s)\n {\n intF[n - '0']++;\n intS[n - '0']++;\n }\n var res = 0;\n var max = 0;\n var maxIndex = -1;\n for (int i = 0; i < 10; i++)\n {\n var j = (10 - i)%10;\n if(intF[i] > 0 && intS[j] > 0)\n {\n intF[i]--;\n intS[j]--;\n res++;\n for (int k = 0; k < 10; k++)\n {\n res += Math.Min(intF[k], intS[9 - k]);\n }\n intF[i]++;\n intS[j]++;\n }\n if(max < res)\n {\n max = res;\n maxIndex = i;\n }\n }\n if(maxIndex == -1)\n {\n Console.WriteLine(s);\n Console.WriteLine(s);\n return;\n }\n intF[maxIndex]--;\n intS[(10 - maxIndex)%10]--;\n var resF = new StringBuilder();\n var resS = new StringBuilder();\n resF.Append(maxIndex);\n resS.Append((10 - maxIndex)%10);\n for (int i = 0; i < 10; i++)\n {\n var count = Math.Min(intF[i], intS[9 - i]);\n resF.Append(i.ToString()[0], count);\n resS.Append((9-i).ToString()[0], count);\n intF[i] -= count;\n intS[9 - i] -= count;\n }\n resF.Insert(0, \"0\", intF[0]);\n resS.Insert(0, \"0\", intS[0]);\n for (int i = 1; i < 10; i++)\n {\n resF.Append(i.ToString()[0], intF[i]);\n resS.Append(i.ToString()[0], intS[i]);\n }\n \n Console.WriteLine(new string(resF.ToString().Reverse().ToArray()));\n Console.WriteLine(new string(resS.ToString().Reverse().ToArray()));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b196da0cf4df78de49110ade387b61f5", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "Mono C#", "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\\D2.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 s = Read();\n var intF = new int[10];\n var intS = new int[10];\n foreach (var n in s)\n {\n intF[n - '0']++;\n intS[n - '0']++;\n }\n var res = 0;\n var max = 0;\n var maxIndex = -1;\n for (int i = 0; i < 10; i++)\n {\n var j = (10 - i)%10;\n if(intF[i] > 0 && intS[j] > 0)\n {\n intF[i]--;\n intS[j]--;\n res++;\n for (int k = 0; k < 10; k++)\n {\n res += Math.Min(intF[k], intS[9 - k]);\n }\n intF[i]++;\n intS[j]++;\n }\n if(max < res)\n {\n max = res;\n maxIndex = i;\n }\n }\n intF[maxIndex]--;\n intS[(10 - maxIndex)%10]--;\n var resF = new StringBuilder();\n var resS = new StringBuilder();\n resF.Append(maxIndex);\n resS.Append((10 - maxIndex)%10);\n for (int i = 1; i < 10; i++)\n {\n var count = Math.Min(intF[i], intS[9 - i]);\n resF.Append(i.ToString()[0], count);\n resS.Append((9-i).ToString()[0], count);\n intF[i] -= count;\n intS[9 - i] -= count;\n }\n resF.Insert(0, \"0\", intF[0]);\n resS.Insert(0, \"0\", intF[0]);\n for (int i = 1; i < 10; i++)\n {\n resF.Append(i.ToString()[0], intF[i]);\n resS.Append(i.ToString()[0], intS[i]);\n }\n \n Console.WriteLine(new string(resF.ToString().Reverse().ToArray()));\n Console.WriteLine(new string(resS.ToString().Reverse().ToArray()));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "72429d3ed216b0cd26b463d8c682d405", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "Mono C#", "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\\D5.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 s = Read();\n var intF = new int[10];\n var intS = new int[10];\n foreach (var n in s)\n {\n intF[n - '0']++;\n intS[n - '0']++;\n }\n \n var max = 0;\n var maxIndex = -1;\n for (int i = 1; i < 10; i++)\n {\n var res = 0;\n var j = 10 - i;\n if(intF[i] > 0 && intS[j] > 0)\n {\n intF[i]--;\n intS[j]--;\n res++;\n for (int k = 0; k < 10; k++)\n {\n res += Math.Min(intF[k], intS[9 - k]);\n }\n intF[i]++;\n intS[j]++;\n }\n if(max < res)\n {\n max = res;\n maxIndex = i;\n }\n }\n var resF = new StringBuilder();\n var resS = new StringBuilder();\n if (maxIndex != -1)\n {\n intF[maxIndex]--;\n intS[(10 - maxIndex)%10]--;\n resF.Append(maxIndex);\n resS.Append((10 - maxIndex)%10);\n }\n for (int i = 0; i < 10; i++)\n {\n var count = Math.Min(intF[i], intS[9 - i]);\n resF.Append(i.ToString()[0], count);\n resS.Append((9-i).ToString()[0], count);\n intF[i] -= count;\n intS[9 - i] -= count;\n }\n resF.Insert(0, \"0\", intF[0]);\n resS.Insert(0, \"0\", intS[0]);\n for (int i = 1; i < 10; i++)\n {\n resF.Append(i.ToString()[0], intF[i]);\n resS.Append(i.ToString()[0], intS[i]);\n }\n \n Console.WriteLine(new string(resF.ToString().Reverse().ToArray()));\n Console.WriteLine(new string(resS.ToString().Reverse().ToArray()));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3604c74c3148d05ed91e505ff6b85698", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n // count\n var cs = new int[10];\n var s = CF.ReadLine();\n foreach (var c in s)\n {\n int n = c-'0';\n cs[n]++;\n }\n\n //\n int max = -1;\n int[] best1 = new int[10];\n Array.Copy(cs, best1, 10);\n int[] best2 = new int[10];\n Array.Copy(cs, best2, 10);\n string max_n1 = \"\";\n string max_n2 = \"\";\n\n for (int a = 1; a <= 9; a++)\n {\n string n1 = \"\";\n string n2 = \"\";\n\n int b = 10 - a;\n\n int zc = 0;\n int[] tmp1 = new int[10];\n int[] tmp2 = new int[10];\n Array.Copy(cs, tmp1, 10);\n Array.Copy(cs, tmp2, 10);\n\n tmp1[a]--;\n if (tmp1[a] < 0)\n continue;\n tmp2[b]--;\n if (tmp2[b] < 0)\n continue;\n\n n1 += a;\n n2 += b;\n\n // c+d=9\n for (int c = 1; c <= 9; c++)\n {\n int d = 9 - c;\n\n int p = Math.Min(tmp1[c],tmp2[d]);\n\n tmp1[c] -= p;\n tmp2[d] -= p;\n \n zc += p;\n\n n1 = new string((char)('0'+c),p)+n1;\n n2 = new string((char)('0' + d), p) + n2;\n }\n\n if (zc > max)\n {\n max = zc;\n best1 = tmp1;\n best2 = tmp2;\n max_n1 = n1;\n max_n2 = n2;\n }\n }\n\n\n // 0+0=0\n int z = Math.Min(best1[0],best2[0]);\n max_n1 += new string('0', z);\n max_n2 += new string('0', z);\n best2[0] -=z;\n best1[0] -=z;\n \n for (int i = 0; i <= 9; i++)\n {\n max_n1 = new string((char)('0'+i), best1[i])+max_n1;\n max_n2 = new string((char)('0'+i), best2[i])+max_n2;\n }\n CF.WriteLine(max_n1);\n CF.WriteLine(max_n2);\n }\n\n\n\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n192819280\n\"\n,\n@\"\n198\n\"\n,\n@\"\n500\n\"\n,\n@\"\n0\n\"\n,\n@\"\n1\n\"\n ,\n@\"\n10\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "140b27571b762454b9f580ee151f19ce", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "Mono C#", "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 string N = Console.ReadLine();\n int[] dig1 = new int[10];\n int[] dig2 = new int[10];\n foreach (char ch in N)\n {\n ++dig1[ch - '0'];\n ++dig2[ch - '0'];\n }\n\n List ret1 = new List();\n List ret2 = new List();\n int[] counts = new int[10];\n\n //try max\n counts[0] = counts[9] = Math.Min(dig1[0], dig1[9]);\n counts[1] = counts[8] = Math.Min(dig1[1], dig1[8]);\n counts[2] = counts[7] = Math.Min(dig1[2], dig1[7]);\n counts[3] = counts[6] = Math.Min(dig1[3], dig1[6]);\n counts[4] = counts[5] = Math.Min(dig1[4], dig1[5]);\n\n while (dig1[0] > counts[0])\n {\n ret1.Add('0');\n ret2.Add('0');\n dig1[0]--;\n dig2[0]--;\n }\n\n //try 10\n bool max = false;\n for (int x = 1; x < 6; x++)\n {\n if (dig1[x] > counts[x] && dig1[10 - x] > counts[10 - x])\n {\n ret1.Add((char)('0'+x));\n ret2.Add((char)('0'+10-x));\n dig1[x]--;\n dig2[10-x]--;\n\n max = true;\n break;\n }\n }\n\n if (!max)\n {\n for (int x = 1; x < 10; x++)\n {\n if (dig1[x] > counts[x] && dig1[10-x] > 0)\n {\n ret1.Add((char)('0' + x));\n ret2.Add((char)('0' + 10 - x));\n dig1[x]--;\n dig2[10 - x]--;\n\n max = true;\n break;\n }\n }\n }\n\n if (!max)\n {\n for (int x = 1; x < 10; x++)\n {\n if (dig1[x] > 0 && dig1[10 - x] > 0)\n {\n ret1.Add((char)('0' + x));\n ret2.Add((char)('0' + 10 - x));\n dig1[x]--;\n dig2[10 - x]--;\n\n max = true;\n break;\n }\n }\n }\n\n if (max)\n {\n for (int i = 0; i < 10; i++)\n {\n while (dig1[i] > 0 && dig2[9-i] > 0)\n {\n ret1.Add((char)('0'+i));\n dig1[i]--;\n ret2.Add((char)('0' + 9 - i));\n dig2[9 - i]--;\n }\n }\n }\n\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < dig1[i]; j++) {\n ret1.Add((char)('0' + i));\n }\n for (int j = 0; j < dig2[i]; j++)\n {\n ret2.Add((char)('0' + i));\n }\n }\n\n ret1.Reverse();\n ret2.Reverse();\n foreach(char ch in ret1)\n {\n Console.Write(ch);\n }\n Console.WriteLine();\n foreach (char ch in ret2)\n {\n Console.Write(ch);\n }\n Console.WriteLine();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1ce31978dd9e4f261ab40155a3e036d", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "Mono C#", "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\\D7.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 s = Read();\n var intF = new int[10];\n var intS = new int[10];\n foreach (var n in s)\n {\n intF[n - '0']++;\n intS[n - '0']++;\n }\n \n var max = 0;\n var maxIndex = -1;\n for (int i = 1; i < 10; i++)\n {\n var res = 0;\n var j = 10 - i;\n if(intF[i] > 0 && intS[j] > 0)\n {\n intF[i]--;\n intS[j]--;\n res++;\n for (int k = 0; k < 10; k++)\n {\n res += Math.Min(intF[k], intS[9 - k]);\n }\n intF[i]++;\n intS[j]++;\n }\n if(max < res)\n {\n max = res;\n maxIndex = i;\n }\n }\n var resF = new StringBuilder();\n var resS = new StringBuilder();\n if (maxIndex != -1)\n {\n intF[maxIndex]--;\n intS[(10 - maxIndex)%10]--;\n resF.Append(maxIndex);\n resS.Append((10 - maxIndex)%10);\n }\n for (int i = 0; i < 10; i++)\n {\n var count = Math.Min(intF[i], intS[9 - i]);\n resF.Append(i.ToString()[0], count);\n resS.Append((9-i).ToString()[0], count);\n intF[i] -= count;\n intS[9 - i] -= count;\n }\n var countZero = Math.Min(intF[0], intS[0]);\n resF.Insert(0, \"0\", countZero);\n resS.Insert(0, \"0\", countZero);\n intF[0] -= countZero;\n intS[0] -= countZero;\n for (int i = 0; i < 10; i++)\n {\n resF.Append(i.ToString()[0], intF[i]);\n resS.Append(i.ToString()[0], intS[i]);\n }\n \n Console.WriteLine(new string(resF.ToString().Reverse().ToArray()));\n Console.WriteLine(new string(resS.ToString().Reverse().ToArray()));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cf4b0c897e6d6058f40f6a6f36ac75db", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n // count\n var cs = new int[10];\n var s = CF.ReadLine();\n foreach (var c in s)\n {\n int n = c-'0';\n cs[n]++;\n }\n\n //\n int max = -1;\n int[] best1 = new int[10];\n Array.Copy(cs, best1, 10);\n int[] best2 = new int[10];\n Array.Copy(cs, best2, 10);\n string max_n1 = \"\";\n string max_n2 = \"\";\n\n for (int a = 1; a <= 9; a++)\n {\n string n1 = \"\";\n string n2 = \"\";\n\n int b = 10 - a;\n\n int zc = 0;\n int[] tmp1 = new int[10];\n int[] tmp2 = new int[10];\n Array.Copy(cs, tmp1, 10);\n Array.Copy(cs, tmp2, 10);\n\n tmp1[a]--;\n if (tmp1[a] < 0)\n continue;\n tmp2[b]--;\n if (tmp2[b] < 0)\n continue;\n\n n1 += a;\n n2 += b;\n\n // c+d=9\n for (int c = 0; c <= 9; c++)\n {\n int d = 9 - c;\n\n int p = Math.Min(tmp1[c],tmp2[d]);\n\n tmp1[c] -= p;\n tmp2[d] -= p;\n \n zc += p;\n\n n1 = new string((char)('0'+c),p)+n1;\n n2 = new string((char)('0' + d), p) + n2;\n }\n\n if (zc > max)\n {\n max = zc;\n best1 = tmp1;\n best2 = tmp2;\n max_n1 = n1;\n max_n2 = n2;\n }\n }\n\n\n // 0+0=0\n int z = Math.Min(best1[0],best2[0]);\n max_n1 += new string('0', z);\n max_n2 += new string('0', z);\n best2[0] -=z;\n best1[0] -=z;\n \n for (int i = 0; i <= 9; i++)\n {\n max_n1 = new string((char)('0'+i), best1[i])+max_n1;\n max_n2 = new string((char)('0'+i), best2[i])+max_n2;\n }\n CF.WriteLine(max_n1);\n CF.WriteLine(max_n2);\n }\n\n\n\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n1099\n\"\n,\n@\"\n198\n\"\n,\n@\"\n500\n\"\n,\n@\"\n0\n\"\n,\n@\"\n1\n\"\n ,\n@\"\n10\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "31d815e4204578f7d9b13d4fcdabf082", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "Mono C#", "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\\D3.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 s = Read();\n var intF = new int[10];\n var intS = new int[10];\n foreach (var n in s)\n {\n intF[n - '0']++;\n intS[n - '0']++;\n }\n var res = 0;\n var max = 0;\n var maxIndex = -1;\n for (int i = 0; i < 10; i++)\n {\n var j = (10 - i)%10;\n if(intF[i] > 0 && intS[j] > 0)\n {\n intF[i]--;\n intS[j]--;\n res++;\n for (int k = 0; k < 10; k++)\n {\n res += Math.Min(intF[k], intS[9 - k]);\n }\n intF[i]++;\n intS[j]++;\n }\n if(max < res)\n {\n max = res;\n maxIndex = i;\n }\n }\n intF[maxIndex]--;\n intS[(10 - maxIndex)%10]--;\n var resF = new StringBuilder();\n var resS = new StringBuilder();\n resF.Append(maxIndex);\n resS.Append((10 - maxIndex)%10);\n for (int i = 0; i < 10; i++)\n {\n var count = Math.Min(intF[i], intS[9 - i]);\n resF.Append(i.ToString()[0], count);\n resS.Append((9-i).ToString()[0], count);\n intF[i] -= count;\n intS[9 - i] -= count;\n }\n resF.Insert(0, \"0\", intF[0]);\n resS.Insert(0, \"0\", intS[0]);\n for (int i = 1; i < 10; i++)\n {\n resF.Append(i.ToString()[0], intF[i]);\n resS.Append(i.ToString()[0], intS[i]);\n }\n \n Console.WriteLine(new string(resF.ToString().Reverse().ToArray()));\n Console.WriteLine(new string(resS.ToString().Reverse().ToArray()));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "17c1d46d1adef51f571c654f77578aee", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForce\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var input1 = Console.ReadLine();\n var answer = Solve(input1);\n Console.WriteLine(answer);\n }\n\n public static long Solve(string input)\n {\n var candies = long.Parse(input);\n var min = 1L;\n var top = candies;\n var result = top;\n while (min <= top)\n {\n var k = (min + top) / 2;\n var moreThanHalf = VasyaEatsMoreThanHalf(candies, k);\n if (moreThanHalf)\n {\n result = k;\n top = k - 1;\n }\n else\n {\n min = k + 1;\n }\n }\n\n return result;\n }\n\n private static bool VasyaEatsMoreThanHalf(long candies, long k)\n {\n var totalCandies = candies;\n var vasya = 0L;\n while (candies > 0)\n {\n candies -= k;\n vasya += k;\n if (candies >= 10)\n {\n var tenPercent = (long)(candies / 10);\n candies -= tenPercent;\n }\n else\n {\n vasya += candies;\n candies = 0;\n }\n }\n\n return vasya * 2 >= totalCandies;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b17881e96d77037c54402b6dc740767", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "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\tlong N2 = (N + 1) / 2;\n\t\tlong l = 0;\n\t\tlong r = N;\n\t\twhile(r - l > 1){\n\t\t\t\n\t\t\tlong c = (l + r) / 2;\n\t\t\tlong g = 0;\n\t\t\tlong tot = N;\n\t\t\twhile(tot > 0){\n\t\t\t\tg += Math.Min(c, tot);\n\t\t\t\ttot -= Math.Min(c, tot);\n\t\t\t\ttot -= tot / 10;\n\t\t\t}\n\t\t\t\n\t\t\tif(g < N2){\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(r);\n\t}\n\tlong N;\n\tpublic Sol(){\n\t\tN = rl();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cd1eb1f5f50c568100ba00ddecb3952c", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "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 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 public static long CalcEkler(long n, long k)\n {\n long ans = 0;\n while (n > 0)\n {\n long min = Math.Min(k, n);\n ans += min;\n n -= min;\n\n n -= n / 10;\n }\n\n return ans;\n }\n\n static void Main(string[] args)\n {\n long i = 0;\n long ans = 0;\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n long n = ReadLong();\n long needEkler = n / 2 + (n & 1);\n\n long l = 1;\n long r = n;\n long k = n / 2;\n ans = k;\n do\n {\n k = (l + r) / 2;\n long calcedEkler = CalcEkler(n, k);\n if (calcedEkler >= needEkler)\n {\n ans = k;\n r = k - 1;\n }\n else\n {\n l = k + 1;\n }\n } while (l <= r);\n\n Write(ans);\n reader.Close();\n writer.Close();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "87144a9ffa0f39d397c2ef391a84abf0", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace 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 writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n long n = long.Parse(reader.ReadLine());\n\n long l = 1, r = (n + 1)/2;\n while (l < r)\n {\n long m = (l + r)/2;\n\n long nn = n;\n long v = 0;\n while (nn > 0)\n {\n long t = Math.Min(nn, m);\n v += t;\n nn -= t;\n nn -= nn/10;\n }\n if (2*v >= n)\n {\n r = m;\n }\n else\n {\n l = m + 1;\n }\n }\n\n return r;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "716ff83edfd1d6a3394eb66bcab3f132", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace C_Candies\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n Console.WriteLine(binarySearch(n) + 1);\n }\n\n static long binarySearch(long total) {\n long low = 1;\n long high = total;\n\t\t while (low <= high) {\n\t\t\t long middle = (low + high) / 2;\n\n\t\t\t if (canEat(middle, total)) {\n\t\t\t\t high = middle - 1;\n\t\t\t }\n\t\t\t else {\n\t\t\t\t low = middle + 1;\n\t\t\t }\n\t\t }\n\n\t\t return high;\n\t }\n\n static bool canEat(long k, long total)\n {\n long eatenA = 0;\n long eatenB = 0;\n long current = total;\n\n while(current > 0)\n {\n eatenA += Math.Min(k, current);\n current = Math.Max(current - k, 0);\n eatenB += current / 10;\n current -= current / 10;\n }\n\n if(total % 2 == 0)\n {\n return eatenA >= total / 2;\n }\n else\n {\n return eatenA > total / 2;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1c712feef4aabff0d7425c4869a77503", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "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 long n = ReadLong();\n long l = 1;\n long r = n;\n while (l < r)\n {\n long m = (l + r) / 2;\n if (Check(n, m))\n {\n r = m;\n }\n else\n {\n l = m + 1;\n }\n }\n Writer.WriteLine(l);\n }\n\n private static bool Check(long n, long k)\n {\n long start = n;\n long vCount = 0;\n while (n > 0)\n {\n long e = Math.Min(n, k);\n vCount += e;\n n -= e;\n n -= n / 10;\n }\n return 2 * vCount >= start;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "346464e75da8fcd8d1934983c7dd9064", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForce\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var input1 = Console.ReadLine();\n var answer = Solve(input1);\n Console.WriteLine(answer);\n }\n\n public static long Solve(string input)\n {\n var candies = long.Parse(input);\n var top = candies;\n var min = 1L;\n var k = top / 2;\n while (top != min)\n {\n var moreThanHalf = VasyaEatsMoreThanHalf(candies, k);\n if (moreThanHalf)\n {\n top /= 2;\n k = top;\n }\n else\n {\n top = top + min;\n min = top / 2;\n k = min;\n }\n }\n\n return k;\n }\n\n private static bool VasyaEatsMoreThanHalf(long candies, long k)\n {\n var totalCandies = candies;\n var vasya = 0L;\n while (candies > 0)\n {\n candies -= k;\n vasya += k;\n if (candies > 10)\n {\n var tenPercent = (long)(candies / 10);\n candies -= tenPercent;\n }\n }\n\n return vasya > totalCandies / 2;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d2f5875444e6be9bae35940db2941c44", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForce\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var input1 = Console.ReadLine();\n var answer = Solve(input1);\n Console.WriteLine(answer);\n }\n\n public static long Solve(string input)\n {\n var candies = long.Parse(input);\n var min = 1L;\n var k = Math.Max(candies / 2, 1);\n var top = k;\n while (top != min)\n {\n var moreThanHalf = VasyaEatsMoreThanHalf(candies, k);\n if (moreThanHalf)\n {\n top = k;\n k /= 2;\n }\n else\n {\n k = min + k;\n min = k;\n }\n }\n\n return min;\n }\n\n private static bool VasyaEatsMoreThanHalf(long candies, long k)\n {\n var totalCandies = candies;\n var vasya = 0L;\n while (candies > 0)\n {\n candies -= k;\n vasya += k;\n if (candies > 10)\n {\n var tenPercent = (long)(candies / 10);\n candies -= tenPercent;\n }\n }\n\n return vasya > totalCandies / 2;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "20fe2ac991061be00c21205a44745400", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForce\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var input1 = Console.ReadLine();\n var answer = Solve(input1);\n Console.WriteLine(answer);\n }\n\n public static long Solve(string input)\n {\n var candies = long.Parse(input);\n var min = 1L;\n var k = Math.Max(candies / 2, 1);\n var top = k;\n while (top != min)\n {\n var moreThanHalf = VasyaEatsMoreThanHalf(candies, k);\n if (moreThanHalf)\n {\n top = k;\n k /= 2;\n }\n else\n {\n k = min + k;\n min = k;\n }\n }\n\n return min;\n }\n\n private static bool VasyaEatsMoreThanHalf(long candies, long k)\n {\n var totalCandies = candies;\n var vasya = 0L;\n while (candies > 0)\n {\n candies -= k;\n vasya += k;\n if (candies >= 10)\n {\n var tenPercent = (long)(candies / 10);\n candies -= tenPercent;\n }\n else\n {\n vasya += candies;\n candies = 0;\n }\n }\n\n return vasya >= Math.Ceiling(totalCandies / 2d);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "79689d0aba9f0c24aee0957489df5cdc", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace 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 writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n long n = long.Parse(reader.ReadLine());\n\n long l = 1, r = (n + 1)/2;\n while (l < r)\n {\n long m = (l + r)/2;\n\n long nn = n;\n long v = 0;\n while (nn > 1)\n {\n long t = Math.Min(nn, m);\n v += t;\n nn -= t;\n nn -= nn/10;\n }\n if (2*v > n)\n {\n r = m;\n }\n else\n {\n l = m + 1;\n }\n }\n\n return r;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0e2b39da5491a2d0cfaaf2072bffb932", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForce\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var input1 = Console.ReadLine();\n var answer = Solve(input1);\n Console.WriteLine(answer);\n }\n\n public static long Solve(string input)\n {\n var candies = long.Parse(input);\n var top = candies;\n var min = 1L;\n var k = Math.Max(top / 2, 1);\n while (top != min)\n {\n var moreThanHalf = VasyaEatsMoreThanHalf(candies, k);\n if (moreThanHalf)\n {\n top /= 2;\n k = top;\n }\n else\n {\n top = top + min;\n min = top / 2;\n k = min;\n }\n }\n\n return k;\n }\n\n private static bool VasyaEatsMoreThanHalf(long candies, long k)\n {\n var totalCandies = candies;\n var vasya = 0L;\n while (candies > 0)\n {\n candies -= k;\n vasya += k;\n if (candies > 10)\n {\n var tenPercent = (long)(candies / 10);\n candies -= tenPercent;\n }\n }\n\n return vasya > totalCandies / 2;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9cd04bd169c87e6cc1bc75a24a8cadb8", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForce\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var input1 = Console.ReadLine();\n var answer = Solve(input1);\n Console.WriteLine(answer);\n }\n\n public static long Solve(string input)\n {\n var candies = long.Parse(input);\n var min = 1L;\n var k = Math.Max(candies / 2, 1);\n var top = k;\n while (top != min)\n {\n var moreThanHalf = VasyaEatsMoreThanHalf(candies, k);\n if (moreThanHalf)\n {\n top = k;\n k /= 2;\n }\n else\n {\n k = (min + top) / 2;\n min++;\n }\n }\n\n return min;\n }\n\n private static bool VasyaEatsMoreThanHalf(long candies, long k)\n {\n var totalCandies = candies;\n var vasya = 0L;\n while (candies > 0)\n {\n candies -= k;\n vasya += k;\n if (candies >= 10)\n {\n var tenPercent = (long)(candies / 10);\n candies -= tenPercent;\n }\n else\n {\n vasya += candies;\n candies = 0;\n }\n }\n\n return vasya >= Math.Ceiling(totalCandies / 2d);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e8ce8e136c46db89103570677b49e622", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0a2bd57432b21a66f1d67781a22f105d", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "69cb3ce53911c6f91461c26f00827d93", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d537a25f0a5f543751fdea8a8a15d6d9", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8d2e9159cd14054c572155d2fa251e71", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eac8541e8a5d23086c0b68feb3fc63a7", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "50a92ab7475f0cf35b5a7ff1e2048aa5", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cae20629597d4d4ed707793bbdf0bf8e", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5d1340e8df9594032ef091af8d7c4321", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "Mono C#", "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 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(n, 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 IsExcellent(int a, int b, int n)\n {\n return IsGood(a, b, n) && IsGood(a, b, SumDigits(n));\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 public static int Pow10(int n)\n {\n var res = 1;\n for (int i = 0; i < n; ++i)\n {\n res *= 10;\n }\n return res;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "da40945be938e806ecafd85257a09625", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "MS C#", "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 void _300C()\n {\n string[] s = reader.ReadLine().Split();\n int a = int.Parse(s[0]), b = int.Parse(s[1]), n = int.Parse(s[2]);\n if (a > b)\n {\n int t = a;\n a = b;\n b = t;\n }\n int an = n, bn = 0;\n BigInteger ans = 0;\n while (an > 0)\n {\n int num = an * a + bn * b;\n bool ok = true;\n for (int p = 10; ok && p <= 10000000; p *= 10)\n {\n int t = num % p / (p / 10);\n if (t != a && t != b && (t != 0 || p <= num))\n ok = false;\n }\n if (ok)\n {\n BigInteger c = C(an, n);\n ans += c;\n }\n --an;\n ++bn;\n }\n ans %= 1000000007;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6782abd78061a90e79e0898d8905837b", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9da42e18d73b88240f55342033c2bead", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Pizza_Separation\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 int ans = 360;\n\n for (int i = 0; i < n; i++)\n {\n int sum = 0;\n for (int j = i; j < n; j++)\n {\n sum += nn[j];\n ans = Math.Min(ans, Math.Abs(360 - 2*sum));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "785dbecd99ee456c7df95c6d5b74090f", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "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 int n = int.Parse(line);\n int[] angles = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int min = int.MaxValue;\n\n for (int i = 0; i < angles.Length; i++)\n {\n for (int j = i; j < angles.Length; j++)\n {\n int sum1 = 0;\n for (int k = i; k<=j; k++)\n {\n sum1 += angles[k];\n }\n\n int sum2 = 0;\n for (int k = 0; k < i; k++)\n {\n sum2 += angles[k];\n }\n\n for (int k = j+1; k < angles.Length; k++)\n {\n sum2 += angles[k];\n }\n\n min = Math.Min(min, Math.Abs(sum1 - sum2));\n }\n }\n\n Console.WriteLine(min);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4b812f5570675b0d3b69c10af44a8ef3", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "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\tConsole.ReadLine();\n\t\tint[] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(), sum = new int[a.Length];\n\t\tint ans = int.MaxValue;\n\t\tsum[0] = a[0];\n\t\tfor (int i = 1; i < a.Length; i++)\n\t\t\tsum[i] = sum[i - 1] + a[i];\n\t\tfor (int i = 0; i < a.Length; i++)\n\t\t\tfor (int j = i; j < a.Length; j++)\n\t\t\t\tans = Math.Min(ans, Math.Abs(sum[a.Length - 1] - 2 * (sum[j] - sum[i])));\n\t\tConsole.WriteLine(ans);\n\t\tConsole.ReadLine();\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ac15d0ba434351cacf71bc22d614b96", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "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\n static void Solve()\n {\n int max = 360;\n int n = ReadInt();\n var a = ReadArrayInt();\n int answer = 360;\n for (int i = 0; i < n; i++)\n {\n for (int j = i + 1; j < n; j++)\n {\n int sum = 0;\n for (int k = i; k < j; k++)\n {\n sum += a[k];\n }\n answer = Math.Min(answer, Math.Abs(sum * 2 - 360));\n }\n }\n sw.WriteLine(answer);\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 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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "adfcfd80ffb4e03d2ed0b7cf59babac6", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "Mono C#", "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 int n = 0;\n static int[] a;\n static void Main(string[] args)\n {\n n = int.Parse(Console.ReadLine());\n a = new int[n];\n string[] token = Console.ReadLine().Split();\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aadae28fbeb71c19328f6bfbf8f7609b", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nclass Program\n{\n static long Max(long a, long b, long c)\n {\n return Math.Max(a, Math.Max(b, c));\n }\n\n static long Min(long a, long b, long c)\n {\n return Math.Min(a, Math.Min(b, c));\n }\n\n 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 void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var sum = a.Sum();\n\n var min = int.MaxValue;\n\n for (int i = 0; i < n; i++)\n {\n for (int j = i; j < n; j++)\n {\n var tmp = 0;\n for (int x = i; x <= j; x++)\n {\n tmp += a[x];\n }\n\n var tmp2 = sum - tmp;\n var raz = Math.Abs(tmp2 - tmp);\n\n if (raz < min) { min = raz; }\n }\n }\n\n Console.WriteLine(min);\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5f70a08ac534bf14113a4735d42d619c", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class Program\n{\n\n public static void Main()\n {\n Console.ReadLine();\n int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int minCondSum = int.MaxValue;\n for (var i = 0; i < a.Length; ++i)\n {\n int sum = 0;\n for (var j = i; j < a.Length; ++j)\n {\n sum += a[j];\n if (Math.Abs(2*sum - 360) < minCondSum)\n minCondSum = Math.Abs(2*sum - 360);\n }\n }\n\n Console.WriteLine(minCondSum);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "97142992fbdd1b7ce82d0d5be61a551e", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _895A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var N = int.Parse(Console.ReadLine());\n var sp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] A = new int[N];\n for (var i = 0; i < N; ++i)\n A[i] = int.Parse(sp[i]);\n int sum = 360;\n for(int j = 0; j < N; ++j)\n for(int i = 1; i < N - j; ++i)\n {\n int idx1 = 0;\n int sum1 = 0;\n while (idx1 < i)\n sum1 += A[(idx1++ + j) % N];\n idx1 = 0;\n while(idx1 < N - i)\n sum1 -= A[(idx1++ + j + i) % N];\n sum = (sum > Math.Abs(sum1)) ? Math.Abs(sum1) : sum;\n }\n Console.WriteLine(sum);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d7042337523f90edeadfc3ce1b736c9d", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\n using System.Collections.Generic;\n using System.Linq;\n \n class Solution {\n \tstatic void Main()\n \t{\n \t\tvar n = Convert.ToInt16(Console.ReadLine());\n\t\tvar mas = Console.ReadLine().Split(' ').Select(p => Convert.ToInt32(p)).ToList();\n\t\t mas.AddRange(mas);\n\t\t var x = 0;\n\t\t var l = 0;\n\t\t var res = 180;\n\t\t foreach (var i in mas)\n\t\t {\n\t\t\t x += i;\n\t\t\t res = Math.Min(res, Math.Abs(180 - x));\n\t\t\t if (x > 180)\n\t\t\t {\n\t\t\t\t x -= mas[l];\n\t\t\t\t l++;\n\t\t\t\t res = Math.Min(res, Math.Abs(180 - x));\n\t\t\t }\n\t\t }\n\t\t Console.WriteLine(2*res);\n\t }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "474625830f30f9c20e1b81f743879ab9", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "Mono C#", "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 int n = 0;\n static int[] a;\n static void Main(string[] args)\n {\n n = int.Parse(Console.ReadLine());\n a = new int[n];\n string[] token = Console.ReadLine().Split();\n for(int i=0;i Convert.ToInt32(p)).ToArray();\n\t\t var x = 0;\n\t\t var l = 0;\n\t\t var res = 180;\n\t\t foreach (var i in mas)\n\t\t {\n\t\t\t x += i;\n\t\t\t res = Math.Min(res, Math.Abs(180 - x));\n\t\t\t if (x > 180)\n\t\t\t {\n\t\t\t\t x -= mas[l];\n\t\t\t\t l++;\n\t\t\t\t res = Math.Min(res, Math.Abs(180 - x));\n\t\t\t }\n\t\t }\n\t\t Console.WriteLine(2*res);\n\t }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a12425dba9ebfd10169fef07c12c1e3", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\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 sectors = sr.ReadArrayOfInt32();\n const int max = 361;\n var dp = new bool[max, max];\n dp[0, 0] = true;\n for (var i = 1; i <= sectors.Length; i++) {\n for (var k = 0; k < max; k++) {\n if (k < sectors[i - 1]) {\n dp[i, k] = dp[i - 1, k];\n }\n else {\n dp[i, k] = dp[i - 1, k - sectors[i - 1]];\n }\n }\n }\n var minD = 360;\n for (var i = 1; i <= sectors.Length; i++) {\n for (var k = 0; k < max; k++) {\n if (dp[i, k]) {\n var other = 360 - k;\n var currD = Math.Abs(other - k);\n minD = Math.Min(minD, currD);\n }\n }\n }\n\n sw.WriteLine(minD);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c2a727b4b9dbbf9eb3514b7117192989", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "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}\nclass Program\n{\n private int N;\n private int[] A;\n private void Scan()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n A = sc.IntArray();\n }\n\n public void Solve()\n {\n Scan();\n bool[] B = new bool[361];\n B[0] = true;\n for (int i = 0; i < N; i++)\n {\n var next = new bool[361];\n for (int j = 0; j <= 360; j++)\n {\n if (B[j])\n {\n var a = Math.Abs(j + A[i]);\n var b = Math.Abs(j - A[i]);\n if (a <= 360)\n next[a] = true;\n if (b < 360)\n next[b] = true;\n }\n }\n B = next;\n }\n for (int i = 0; i <= 360; i++)\n {\n if (B[i])\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "77ca5d927f2bb5ede6cf8ca874ff49c2", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\n using System.Collections.Generic;\n using System.Linq;\n \n class Solution {\n \tstatic void Main()\n \t{\n \t\tvar n = Convert.ToInt16(Console.ReadLine());\n\t\tvar mas = Console.ReadLine().Split(' ').Select(p => Convert.ToInt32(p)).ToList();\n\t\t mas.AddRange(mas);\n\t\n\t\t var x = 0;\n\t\t var l = 0;\n\t\t var res = 180;\n\t\t foreach (var i in mas)\n\t\t {\n\t\t\t x += i;\n\t\t\t res = Math.Min(res, Math.Abs(180 - x));\n\t\t\t if (x >= 180)\n\t\t\t {\n\t\t\t\t x -= mas[l];\n\t\t\t\t l++;\n\t\t\t\t res = Math.Min(res, Math.Abs(180 - x));\n\t\t\t }\n\t\t }\n\t\t Console.WriteLine(2*res);\n\t }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8789b078fd6317a3cfe9f161e1f059de", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "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}\nclass Program\n{\n private int N;\n private int[] A;\n private void Scan()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n A = sc.IntArray();\n }\n\n public void Solve()\n {\n Scan();\n var ans = new HashSet() { 0 };\n for (int i = 0; i < N; i++)\n {\n var next = new HashSet();\n foreach (int j in ans)\n {\n next.Add(j + A[i]);\n next.Add(j - A[i]);\n }\n ans = next;\n }\n int anser = int.MaxValue;\n foreach (int i in ans)\n {\n anser = Math.Min(anser, Math.Abs(i));\n }\n Console.WriteLine(anser);\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "053c0fd940669556556e8c95c08e00a6", "src_uid": "1b6a6aff81911865356ec7cbf6883e82", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace consap1\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n String[] inp = Console.ReadLine().Split();\n long Ax = long.Parse(inp[0]), Ay = long.Parse(inp[1]),\n Bx = long.Parse(inp[2]), By = long.Parse(inp[3]),\n Cx = long.Parse(inp[4]), Cy = long.Parse(inp[5]);\n if ((Ax - Bx)*(Ax - Bx) + (Ay - By)*(Ay - By) == (Cx - Bx) * (Cx - Bx) + (Cy - By) * (Cy - By) && !( Bx - Ax == Cx - Bx && By - Ay == Cy - By)) Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "39c5e6462010c421c819637a285e875d", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "MS C#", "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 int Depth { get; set; }\n\n }\n static long Distance(long x1, long y1, long x2, long y2)\n {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n }\n static void Main(String[] args)\n {\n //var n = int.Parse(Console.ReadLine().TrimEnd());\n var data = Console.ReadLine().TrimEnd().Split(' ').Select(long.Parse).ToList();\n var x1 = data[0];\n var y1 = data[1];\n var x2 = data[2];\n var y2 = data[3];\n var x3 = data[4];\n var y3 = data[5];\n var d1 = Distance(x1, y1, x2, y2);\n var d2 = Distance(x2, y2, x3, y3);\n if (d1 == d2 && (y1-y2)* (x1 - x3) != (y1 - y3) * (x1 - x2))\n {\n writer.WriteLine(\"Yes\");\n } else\n {\n writer.WriteLine(\"No\");\n }\n \n writer.Flush();\n\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b76d3c014231beeffceebc4cf875d321", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Arpa_and_an_exam_about_geometry\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 long ax = Next(), ay = Next(), bx = Next(), by = Next(), cx = Next(), cy = Next();\n\n if ((ax - bx)*(ax - bx) + (ay - by)*(ay - by) == (cx - bx)*(cx - bx) + (cy - by)*(cy - by))\n {\n return (cx - ax)*(cy - by) != (cy - ay)*(cx - bx);\n }\n\n return false;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "98c94c7a9b5d1b1b732387d22dd4964b", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "MS C#", "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 int Depth { get; set; }\n\n }\n static long Distance(long x1, long y1, long x2, long y2)\n {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n }\n static void Main(String[] args)\n {\n //var n = int.Parse(Console.ReadLine().TrimEnd());\n var data = Console.ReadLine().TrimEnd().Split(' ').Select(long.Parse).ToList();\n var x1 = data[0];\n var y1 = data[1];\n var x2 = data[2];\n var y2 = data[3];\n var x3 = data[4];\n var y3 = data[5];\n var d1 = Distance(x1, y1, x2, y2);\n var d2 = Distance(x2, y2, x3, y3);\n if (d1 == d2 && (y1-y2)* (x2 - x3) != (y2 - y3) * (x1 - x2))\n {\n writer.WriteLine(\"Yes\");\n } else\n {\n writer.WriteLine(\"No\");\n }\n \n writer.Flush();\n\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bad62075f7df405a8ea24367bfbe6475", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\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 x1 = sr.NextInt64();\n var y1 = sr.NextInt64();\n var x2 = sr.NextInt64();\n var y2 = sr.NextInt64();\n var x3 = sr.NextInt64();\n var y3 = sr.NextInt64();\n if (Cross(x1, y1, x2, y2, x3, y3) == 0) {\n sw.WriteLine(\"No\");\n return;\n }\n sw.WriteLine(\"Yes\");\n }\n\n private long Cross(long x1, long y1, long x2, long y2, long x, long y)\n {\n return (x1 - x) * (y2 - y) - (x2 - x) * (y1 - y);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "887795f0f14f79ececf6649633cb7f35", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "MS C#", "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 int Depth { get; set; }\n\n }\n static double Distance(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));\n }\n static void Main(String[] args)\n {\n //var n = int.Parse(Console.ReadLine().TrimEnd());\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 var x3 = data[4];\n var y3 = data[5];\n if (Distance(x1,y1,x2,y2) == Distance(x2,y2,x3,y3))\n {\n writer.WriteLine(\"Yes\");\n } else\n {\n writer.WriteLine(\"No\");\n }\n \n writer.Flush();\n\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8f3036d4a4e3bc7bf2c9e788f8bae8e6", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "MS C#", "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 int Depth { get; set; }\n\n }\n static double Distance(double x1, double y1, double x2, double y2)\n {\n return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));\n }\n static void Main(String[] args)\n {\n //var n = int.Parse(Console.ReadLine().TrimEnd());\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 var x3 = data[4];\n var y3 = data[5];\n if (Distance(x1,y1,x2,y2) == Distance(x2,y2,x3,y3) && (y1-y2)* (x1 - x3) != (y1 - y3) * (x1 - x2))\n {\n writer.WriteLine(\"Yes\");\n } else\n {\n writer.WriteLine(\"No\");\n }\n \n writer.Flush();\n\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "91cbbde4ba6c5e078c20d5e7a3307dd3", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2f721682da0bfbb7d40d8eb1918713a8", "src_uid": "7c806fb163aaf23e1eef3e6570aea436", "difficulty": 1900.0} {"lang": "Mono C#", "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\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\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 n = int.Parse(input1);\n\n\t\t\tvar copyN = n;\n\t\t\tvar f = copyN / 36;\n\t\t\tcopyN -= 36 * f;\n\n\t\t\tvar d = copyN / 3;\n\t\t\tcopyN -= 3 * d;\n\t\t\tif (copyN > 1) \n\t\t\t{\n\t\t\t\td++;\n\t\t\t}\n\n\t\t\twhile (d > 11) \n\t\t\t{\n\t\t\t\td -= 12;\n\t\t\t\tf++;\n\t\t\t}\n\n\t\t\tConsole.WriteLine($\"{f} {d}\");\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f05594a10eb41484234e1ebc881de880", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication254\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int a = n/36;\n int b = (n-a*36)/3;\n if ((n - a * 36) % 3 == 2) b++;\n if (b == 12) { a++; b = 0; }\n Console.WriteLine(a+\" \"+b);\n\n\n }\n }\n}/*\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace chislo\n{\n class Program\n {\n static void Main(string[] args)\n {int sch = 0;\n string[] s = Console.ReadLine().Split(' ');\n long n = Convert.ToInt64(s[0]);\n long l1 = Convert.ToInt64(s[1]);\n long r1 = Convert.ToInt64(s[2]);\n List l = new List(); if (n == 0) Console.WriteLine(0);\n else\n if (n == 1)\n {\n if (l1 <= 2 && r1 >= 2) Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n else\n {\n for (int i = 0; n > 1; i++)\n {\n l.Add(n); n /= 2;\n }\n string c = Convert.ToString(l[l.Count - 1] / 2);\n string c1 = Convert.ToString(l[l.Count - 1] % 2);\n string str = (c + c1 + c);\n for (int i = l.Count - 2; i >= 0; i--)\n {\n c1 = Convert.ToString(l[i] % 2);\n str += c1 + str;\n }\n Console.WriteLine(str);\n \n /*for (long i = l1 - 1; i < r1; i++)\n {\n if (str[i] == '1') sch++;\n }\n Console.WriteLine(str);\n Console.WriteLine(sch);\n\n }\n \n }\n }\n}*/\n\n \n \n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e4b67868e2dbfe5ac1d84f2346037412", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int res = n % 3;\n if (res == 2)\n n++;\n res = n / 36;\n n %= 36;\n Console.WriteLine(\"{0} {1}\", res, n/3);\n \n }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "65e8bdadddf55392ff4e199b7ac0703e", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "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 void Solve()\n {\n // Place your code here\n int x = io.NextInt();\n\n int inch = x / 3;\n if (x % 3 == 2)\n inch++;\n\n int ft = inch / 12;\n inch %= 12;\n\n io.Print(ft + \" \" + inch);\n }\n\n MyIo io = new MyIo();\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f37da5693474cbd9f24082e1ad8e648e", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _111\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;\n a = n / 36;\n n -= a*36;\n b = n / 3;\n n -= b*3;\n if (n == 2)\n b++;\n if (b == 12)\n {\n b = 0;\n a++;\n }\n Console.Write(a);\n Console.Write(\" \");\n Console.Write(b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "db7e63fb3284ed1ddb50a1aad1afdde6", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Artyom\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int b = n / 36;\n n = n % 36;\n int a = n / 3;\n if (n % 3 > 1) a = a + 1;\n if (a == 12)\n { b += 1; a = 0; }\n Console.WriteLine(b + \" \" + a);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7a2d100f06dd0fca647585d87fae9e3f", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program {\n static void Main() {\n int n = int.Parse(Console.ReadLine());\n \n int b = n%3 == 2? n/3 + 1 : n/3;\n int a = b/12;\n b %= 12;\n \n Console.WriteLine(a + \" \" + b);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "da5a0beedcdebe692aec142fe082a0fc", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Measuring_Lengths_in_Baden\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 int b = n/36;\n\n n %= 36;\n\n int c = n/3;\n if (n%3 == 2)\n c++;\n\n if (c == 12)\n {\n b++;\n c = 0;\n }\n\n writer.Write(b);\n writer.Write(' ');\n writer.Write(c);\n\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cc7135e95875da92c10778ab55de914b", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Artyom\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int a = n / 3; \n int b = a / 12;\n n = n - b*36;\n a = n / 3;\n if (n % 3 > 1) a = a + 1;\n Console.WriteLine(b + \" \" + a);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4c4f5a05b40e6cd4906c40c3edf63dc0", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Artyom\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int b = n / 36;\n n = n%36;\n int a = n / 3;\n if (n % 3 > 1) a = a + 1;\n Console.WriteLine(b + \" \" + a);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dfe505aa9f46378451c046aedfb2dc81", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "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 const int d = 3;\n const int f = 36;\n double sm;\n sm =Convert.ToDouble(Console.ReadLine());\n double k = sm / f;\n double s = (k % 1) *12;\n Console.WriteLine(Convert.ToInt16(Math.Round(k)) + \" \" + Convert.ToInt16(Math.Round(s)));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b8b1586df1852efbdf35b0454050133", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "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 const int d = 3;\n const int f = 36;\n double sm;\n sm =Convert.ToDouble(Console.ReadLine());\n double k = (sm / f) ;\n double s = (k % 1) *12;\n Console.WriteLine(Convert.ToInt16((int) k) + \" \" + Convert.ToInt16(Math.Round(s)));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2698f32350d896657d563de99a7520ce", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Artyom\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int b = n / 36;\n n = n - b*36;\n int a = n / 3;\n if (n % 3 > 1) a = a + 1;\n Console.WriteLine(b + \" \" + a);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "39cc93a64a82d4ea5485ec8b25374efb", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "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\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\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 n = int.Parse(input1);\n\n\t\t\tvar copyN = n;\n\t\t\tvar f = copyN / 36;\n\t\t\tcopyN -= 36 * f;\n\n\t\t\tvar d = copyN / 3;\n\t\t\tcopyN -= 3 * d;\n\t\t\tif (copyN > 1) \n\t\t\t{\n\t\t\t\td++;\n\t\t\t}\n\n\t\t\tConsole.WriteLine($\"{f} {d}\");\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "41879a6a5a521b164491a2695e930dbb", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _111\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;\n a = n / 36;\n n -= a*36;\n b = n / 3;\n n -= b*3;\n if (n == 2)\n b++;\n Console.Write(a);\n Console.Write(\" \");\n Console.Write(b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8f9f1dd5069fcd7afd250bb9b9b985cb", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "Mono C#", "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 const int d = 3;\n const int f = 36;\n double sm;\n sm =Convert.ToDouble(Console.ReadLine());\n double s = sm / d;\n double k = sm / f;\n\n sm = Math.Round(s);\n Console.WriteLine(Convert.ToInt16(Math.Round(k)) + \" \" +Convert.ToInt16(Math.Round(s)));\n\n sm = Console.Read();\n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "db446682caba561491d78d372da59f49", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication254\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int a = n/36;\n int b = (n-a*36)/3;\n if ((n - a * 36) % 3 == 2) b++;\n Console.WriteLine(a+\" \"+b);\n\n\n }\n }\n}/*\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace chislo\n{\n class Program\n {\n static void Main(string[] args)\n {int sch = 0;\n string[] s = Console.ReadLine().Split(' ');\n long n = Convert.ToInt64(s[0]);\n long l1 = Convert.ToInt64(s[1]);\n long r1 = Convert.ToInt64(s[2]);\n List l = new List(); if (n == 0) Console.WriteLine(0);\n else\n if (n == 1)\n {\n if (l1 <= 2 && r1 >= 2) Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n else\n {\n for (int i = 0; n > 1; i++)\n {\n l.Add(n); n /= 2;\n }\n string c = Convert.ToString(l[l.Count - 1] / 2);\n string c1 = Convert.ToString(l[l.Count - 1] % 2);\n string str = (c + c1 + c);\n for (int i = l.Count - 2; i >= 0; i--)\n {\n c1 = Convert.ToString(l[i] % 2);\n str += c1 + str;\n }\n Console.WriteLine(str);\n \n /*for (long i = l1 - 1; i < r1; i++)\n {\n if (str[i] == '1') sch++;\n }\n Console.WriteLine(str);\n Console.WriteLine(sch);\n\n }\n \n }\n }\n}*/\n\n \n \n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "286c37941331b05cb544367dcdabbf12", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace The_Wall__medium_\n{\n internal class Program\n {\n private const int mod = 1000003;\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*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[] fact;\n private static long[] fact1;\n\n private static void Main(string[] args)\n {\n int n = Next();\n int c = Next();\n\n InitFact(n + c + 1);\n long ans = (GetCFact(n + c, c) - 1 + mod)%mod;\n\n writer.WriteLine(ans);\n writer.Flush();\n }\n\n private static void InitFact(int n)\n {\n fact = new long[n];\n fact1 = new long[n];\n\n fact[0] = 1;\n\n for (int i = 1; i < fact.Length; i++)\n {\n fact[i] = (fact[i - 1]*i)%mod;\n }\n fact1[n - 1] = Pow(fact[n - 1], mod - 2);\n for (int i = fact1.Length - 2; i >= 0; i--)\n {\n fact1[i] = (fact1[i + 1]*(i + 1))%mod;\n }\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 long GetCFact(int n, int k)\n {\n return (((fact[n]*fact1[k])%mod)*fact1[n - k])%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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f4f52954000a064ba1d204121100993b", "src_uid": "e63c70a9c96a94bce99618f2e695f83a", "difficulty": 1800.0} {"lang": "MS C#", "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\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 D();\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[] a = new int[n];\n int[] b = new int[n];\n for (int i = 0; i < n; i++)\n {\n string[] tokens = ReadArray(' ');\n a[i] = int.Parse(tokens[0]);\n b[i] = int.Parse(tokens[1]);\n }\n int ans = 0;\n for (int i = 0; i < n; i++)\n {\n bool isHere = false;\n for (int j = 0; j < n; j++)\n {\n if (i == j) continue;\n if (b[j] == a[i])\n isHere = true;\n }\n if (!isHere)\n ans++;\n }\n Console.WriteLine(ans);\n }\n\n static void B()\n {\n int n, m;\n string[] tokens = ReadArray(' ');\n n = int.Parse(tokens[0]);\n m = int.Parse(tokens[1]);\n int[] a = new int[n];\n tokens = ReadArray(' ');\n for (int i = 0; i < n; i++)\n a[i] = int.Parse(tokens[i]);\n\n int[] sum = new int[m + 1];\n int[] last = new int[n];\n StringBuilder ans = new StringBuilder();\n for (int i = 1; i <= m; i++)\n {\n sum[i] = sum[i - 1];\n tokens = ReadArray(' ');\n int t = int.Parse(tokens[0]);\n if (t == 1)\n {\n int v = int.Parse(tokens[1]);\n int x = int.Parse(tokens[2]);\n a[v - 1] = x;\n last[v - 1] = i;\n }\n if (t == 2)\n {\n int y = int.Parse(tokens[1]);\n sum[i] += y;\n }\n if (t == 3)\n {\n int q = int.Parse(tokens[1]);\n int val = a[q - 1] + (sum[i] - sum[last[q - 1]]);\n ans.AppendLine(val.ToString());\n }\n }\n Console.Write(ans);\n }\n\n static void C()\n {\n long n, k;\n string[] tokens = ReadArray(' ');\n n = long.Parse(tokens[0]);\n k = long.Parse(tokens[1]);\n long[] a = new long[n + 1];\n tokens = ReadArray(' ');\n for (int i = 1; i <= n; i++)\n {\n a[i] = long.Parse(tokens[i - 1]);\n }\n StringBuilder ans = new StringBuilder();\n long cnt = 0;\n long cur = 0;\n long _d = 0;\n for (int i = 1; i <= n; i++)\n {\n _d = 0;\n _d -= (i - 1 - cnt) * ((n-cnt) - (i-cnt)) * a[i];\n _d += cur;\n if (_d < k)\n {\n ans.AppendLine(i.ToString());\n cnt++;\n }\n else\n {\n cur += (i - cnt - 1) * a[i];\n }\n }\n Console.Write(ans);\n }\n\n static int FirstIndex(string a, string c, int i,int z, int j)\n {\n for (int k = 0; k < a.Length; k++, z++)\n {\n if (a[(i + z) % a.Length].Equals(c[j])) return (z + 1);\n }\n return -1;\n }\n\n static void D()\n {\n int b, d;\n string[] tokens = ReadArray(' ');\n b = int.Parse(tokens[0]);\n d = int.Parse(tokens[1]);\n string a = ReadLine();\n string c = ReadLine();\n\n int[] _cnt = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n int z = 0;\n for (int j = 0; j < c.Length; j++)\n {\n int m = FirstIndex(a, c, i, z, j);\n if (m == -1)\n {\n Console.WriteLine(0);\n return;\n }\n z = m;\n }\n _cnt[i] = z;\n }\n\n int[] r = new int[a.Length];\n int[] __cnt = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n int j = 0;\n for (int k = 0; k < d; j += _cnt[(i + j) % a.Length], k++)\n {\n if (r[(i + j) % a.Length] > 0)\n {\n int dif = j - r[(i + j) % a.Length];\n j += (d - k) * dif;\n break;\n }\n r[(i + j) % a.Length] = j;\n r = new int[a.Length];\n }\n __cnt[i] = j;\n }\n r = new int[a.Length];\n int[] _r = new int[a.Length];\n int p = 0;\n for (int j = 0; j < a.Length * b; )\n {\n if (r[j % a.Length] > 0)\n {\n int dif = j - r[j % a.Length];\n int _dif = p - _r[j % a.Length];\n p += ((a.Length * b - j) / dif) * (_dif);\n j += ((a.Length * b - j) / dif) * dif;\n while (j + __cnt[j % a.Length] < a.Length * b)\n {\n p++;\n j += __cnt[j % a.Length];\n }\n break;\n }\n r[j % a.Length] = j;\n _r[j % a.Length] = p;\n j += __cnt[j % a.Length];\n if (j < a.Length * b) p++;\n }\n Console.WriteLine(p);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2b21301af57b87049e2666be8b875171", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "MS C#", "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\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 D();\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[] a = new int[n];\n int[] b = new int[n];\n for (int i = 0; i < n; i++)\n {\n string[] tokens = ReadArray(' ');\n a[i] = int.Parse(tokens[0]);\n b[i] = int.Parse(tokens[1]);\n }\n int ans = 0;\n for (int i = 0; i < n; i++)\n {\n bool isHere = false;\n for (int j = 0; j < n; j++)\n {\n if (i == j) continue;\n if (b[j] == a[i])\n isHere = true;\n }\n if (!isHere)\n ans++;\n }\n Console.WriteLine(ans);\n }\n\n static void B()\n {\n int n, m;\n string[] tokens = ReadArray(' ');\n n = int.Parse(tokens[0]);\n m = int.Parse(tokens[1]);\n int[] a = new int[n];\n tokens = ReadArray(' ');\n for (int i = 0; i < n; i++)\n a[i] = int.Parse(tokens[i]);\n\n int[] sum = new int[m + 1];\n int[] last = new int[n];\n StringBuilder ans = new StringBuilder();\n for (int i = 1; i <= m; i++)\n {\n sum[i] = sum[i - 1];\n tokens = ReadArray(' ');\n int t = int.Parse(tokens[0]);\n if (t == 1)\n {\n int v = int.Parse(tokens[1]);\n int x = int.Parse(tokens[2]);\n a[v - 1] = x;\n last[v - 1] = i;\n }\n if (t == 2)\n {\n int y = int.Parse(tokens[1]);\n sum[i] += y;\n }\n if (t == 3)\n {\n int q = int.Parse(tokens[1]);\n int val = a[q - 1] + (sum[i] - sum[last[q - 1]]);\n ans.AppendLine(val.ToString());\n }\n }\n Console.Write(ans);\n }\n\n static void C()\n {\n long n, k;\n string[] tokens = ReadArray(' ');\n n = long.Parse(tokens[0]);\n k = long.Parse(tokens[1]);\n long[] a = new long[n + 1];\n tokens = ReadArray(' ');\n for (int i = 1; i <= n; i++)\n {\n a[i] = long.Parse(tokens[i - 1]);\n }\n StringBuilder ans = new StringBuilder();\n long cnt = 0;\n long cur = 0;\n long _d = 0;\n for (int i = 1; i <= n; i++)\n {\n _d = 0;\n _d -= (i - 1 - cnt) * ((n-cnt) - (i-cnt)) * a[i];\n _d += cur;\n if (_d < k)\n {\n ans.AppendLine(i.ToString());\n cnt++;\n }\n else\n {\n cur += (i - cnt - 1) * a[i];\n }\n }\n Console.Write(ans);\n }\n\n static int FirstIndex(string a, string c, int i,int z, int j)\n {\n for (int k = 0; k < a.Length; k++, z++)\n {\n if (a[(i + z) % a.Length].Equals(c[j])) return (z + 1);\n }\n return -1;\n }\n\n static void D()\n {\n int b, d;\n string[] tokens = ReadArray(' ');\n b = int.Parse(tokens[0]);\n d = int.Parse(tokens[1]);\n string a = ReadLine();\n string c = ReadLine();\n\n int[] _cnt = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n int z = 0;\n for (int j = 0; j < c.Length; j++)\n {\n int m = FirstIndex(a, c, i, z, j);\n if (m == -1)\n {\n Console.WriteLine(0);\n return;\n }\n z = m;\n }\n _cnt[i] = z;\n }\n\n int[] r = new int[a.Length];\n int[] __cnt = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n int j = 0;\n for (int k = 0; k < d; j += _cnt[(i + j) % a.Length], k++)\n {\n if (r[(i + j) % a.Length] > 0)\n {\n int dif = j - r[(i + j) % a.Length];\n j += (d - k) * dif;\n break;\n }\n r[(i + j) % a.Length] = j;\n r = new int[a.Length];\n }\n __cnt[i] = j;\n }\n r = new int[a.Length];\n int[] _r = new int[a.Length];\n int p = 0;\n for (int j = 0; j < a.Length * b; j += __cnt[j % a.Length], p++)\n {\n if (r[j % a.Length] > 0)\n {\n int dif = j - r[j % a.Length];\n int _dif = p - _r[j % a.Length];\n p += ((a.Length * b - j) / dif) * (_dif);\n break;\n }\n r[j % a.Length] = j;\n _r[j % a.Length] = p;\n }\n Console.WriteLine(p);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "76547d33745a6ab401a022a456bca0f6", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "MS C#", "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\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 D();\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[] a = new int[n];\n int[] b = new int[n];\n for (int i = 0; i < n; i++)\n {\n string[] tokens = ReadArray(' ');\n a[i] = int.Parse(tokens[0]);\n b[i] = int.Parse(tokens[1]);\n }\n int ans = 0;\n for (int i = 0; i < n; i++)\n {\n bool isHere = false;\n for (int j = 0; j < n; j++)\n {\n if (i == j) continue;\n if (b[j] == a[i])\n isHere = true;\n }\n if (!isHere)\n ans++;\n }\n Console.WriteLine(ans);\n }\n\n static void B()\n {\n int n, m;\n string[] tokens = ReadArray(' ');\n n = int.Parse(tokens[0]);\n m = int.Parse(tokens[1]);\n int[] a = new int[n];\n tokens = ReadArray(' ');\n for (int i = 0; i < n; i++)\n a[i] = int.Parse(tokens[i]);\n\n int[] sum = new int[m + 1];\n int[] last = new int[n];\n StringBuilder ans = new StringBuilder();\n for (int i = 1; i <= m; i++)\n {\n sum[i] = sum[i - 1];\n tokens = ReadArray(' ');\n int t = int.Parse(tokens[0]);\n if (t == 1)\n {\n int v = int.Parse(tokens[1]);\n int x = int.Parse(tokens[2]);\n a[v - 1] = x;\n last[v - 1] = i;\n }\n if (t == 2)\n {\n int y = int.Parse(tokens[1]);\n sum[i] += y;\n }\n if (t == 3)\n {\n int q = int.Parse(tokens[1]);\n int val = a[q - 1] + (sum[i] - sum[last[q - 1]]);\n ans.AppendLine(val.ToString());\n }\n }\n Console.Write(ans);\n }\n\n static void C()\n {\n long n, k;\n string[] tokens = ReadArray(' ');\n n = long.Parse(tokens[0]);\n k = long.Parse(tokens[1]);\n long[] a = new long[n + 1];\n tokens = ReadArray(' ');\n for (int i = 1; i <= n; i++)\n {\n a[i] = long.Parse(tokens[i - 1]);\n }\n StringBuilder ans = new StringBuilder();\n long cnt = 0;\n long cur = 0;\n long _d = 0;\n for (int i = 1; i <= n; i++)\n {\n _d = 0;\n _d -= (i - 1 - cnt) * ((n-cnt) - (i-cnt)) * a[i];\n _d += cur;\n if (_d < k)\n {\n ans.AppendLine(i.ToString());\n cnt++;\n }\n else\n {\n cur += (i - cnt - 1) * a[i];\n }\n }\n Console.Write(ans);\n }\n\n static int FirstIndex(string a, string c, int i,int z, int j)\n {\n for (int k = 0; k < a.Length; k++, z++)\n {\n if (a[(i + z) % a.Length].Equals(c[j])) return (z + 1);\n }\n return -1;\n }\n\n static void D()\n {\n int b, d;\n string[] tokens = ReadArray(' ');\n b = int.Parse(tokens[0]);\n d = int.Parse(tokens[1]);\n string a = ReadLine();\n string c = ReadLine();\n\n int[] _cnt = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n int z = 0;\n for (int j = 0; j < c.Length; j++)\n {\n int m = FirstIndex(a, c, i, z, j);\n if (m == -1)\n {\n Console.WriteLine(0);\n return;\n }\n z = m;\n }\n _cnt[i] = z;\n }\n\n int[] r = new int[a.Length];\n int[] __cnt = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n int j = 0;\n for (int k = 0; k < d; j += _cnt[(i + j) % a.Length], k++)\n {\n if (r[(i + j) % a.Length] > 0)\n {\n int dif = j - r[(i + j) % a.Length];\n j += (d - k) * dif;\n break;\n }\n r[(i + j) % a.Length] = j;\n r = new int[a.Length];\n }\n __cnt[i] = j;\n }\n r = new int[a.Length];\n int[] _r = new int[a.Length];\n int p = 0;\n for (int j = 0; j < a.Length * b; )\n {\n if (r[j % a.Length] > 0)\n {\n int dif = j - r[j % a.Length];\n int _dif = p - _r[j % a.Length];\n p += ((a.Length * b - j) / dif) * (_dif);\n break;\n }\n r[j % a.Length] = j;\n _r[j % a.Length] = p;\n j += __cnt[j % a.Length];\n if (j < a.Length * b) p++;\n }\n Console.WriteLine(p);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c73666404023c1a8941933f52a505bbe", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "MS C#", "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\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 D();\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[] a = new int[n];\n int[] b = new int[n];\n for (int i = 0; i < n; i++)\n {\n string[] tokens = ReadArray(' ');\n a[i] = int.Parse(tokens[0]);\n b[i] = int.Parse(tokens[1]);\n }\n int ans = 0;\n for (int i = 0; i < n; i++)\n {\n bool isHere = false;\n for (int j = 0; j < n; j++)\n {\n if (i == j) continue;\n if (b[j] == a[i])\n isHere = true;\n }\n if (!isHere)\n ans++;\n }\n Console.WriteLine(ans);\n }\n\n static void B()\n {\n int n, m;\n string[] tokens = ReadArray(' ');\n n = int.Parse(tokens[0]);\n m = int.Parse(tokens[1]);\n int[] a = new int[n];\n tokens = ReadArray(' ');\n for (int i = 0; i < n; i++)\n a[i] = int.Parse(tokens[i]);\n\n int[] sum = new int[m + 1];\n int[] last = new int[n];\n StringBuilder ans = new StringBuilder();\n for (int i = 1; i <= m; i++)\n {\n sum[i] = sum[i - 1];\n tokens = ReadArray(' ');\n int t = int.Parse(tokens[0]);\n if (t == 1)\n {\n int v = int.Parse(tokens[1]);\n int x = int.Parse(tokens[2]);\n a[v - 1] = x;\n last[v - 1] = i;\n }\n if (t == 2)\n {\n int y = int.Parse(tokens[1]);\n sum[i] += y;\n }\n if (t == 3)\n {\n int q = int.Parse(tokens[1]);\n int val = a[q - 1] + (sum[i] - sum[last[q - 1]]);\n ans.AppendLine(val.ToString());\n }\n }\n Console.Write(ans);\n }\n\n static void C()\n {\n long n, k;\n string[] tokens = ReadArray(' ');\n n = long.Parse(tokens[0]);\n k = long.Parse(tokens[1]);\n long[] a = new long[n + 1];\n tokens = ReadArray(' ');\n for (int i = 1; i <= n; i++)\n {\n a[i] = long.Parse(tokens[i - 1]);\n }\n StringBuilder ans = new StringBuilder();\n long cnt = 0;\n long cur = 0;\n long _d = 0;\n for (int i = 1; i <= n; i++)\n {\n _d = 0;\n _d -= (i - 1 - cnt) * ((n-cnt) - (i-cnt)) * a[i];\n _d += cur;\n if (_d < k)\n {\n ans.AppendLine(i.ToString());\n cnt++;\n }\n else\n {\n cur += (i - cnt - 1) * a[i];\n }\n }\n Console.Write(ans);\n }\n\n static int FirstIndex(string a, string c, int i,int z, int j)\n {\n for (int k = 0; k < a.Length; k++, z++)\n {\n if (a[(i + z) % a.Length].Equals(c[j])) return (z + 1);\n }\n return -1;\n }\n\n static void D()\n {\n int b, d;\n string[] tokens = ReadArray(' ');\n b = int.Parse(tokens[0]);\n d = int.Parse(tokens[1]);\n string a = ReadLine();\n string c = ReadLine();\n\n int[] _cnt = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n int z = 0;\n for (int j = 0; j < c.Length; j++)\n {\n int m = FirstIndex(a, c, i, z, j);\n if (m == -1)\n {\n Console.WriteLine(0);\n return;\n }\n z = m;\n }\n _cnt[i] = z;\n }\n\n int[] r = new int[a.Length];\n int[] __cnt = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n int j = 0;\n for (int k = 0; k < d; j += _cnt[(i + j) % a.Length], k++)\n {\n if (r[(i + j) % a.Length] > 0)\n {\n int dif = j - r[(i + j) % a.Length];\n j += (d - k) * dif;\n break;\n }\n r[(i + j) % a.Length] = j;\n r = new int[a.Length];\n }\n __cnt[i] = j;\n }\n r = new int[a.Length];\n int[] _r = new int[a.Length];\n int p = 0;\n for (int j = 0; j < a.Length * b; )\n {\n if (r[j % a.Length] > 0)\n {\n int dif = j - r[j % a.Length];\n int _dif = p - _r[j % a.Length];\n p += ((a.Length * b - j) / dif) * (_dif);\n j += ((a.Length * b - j) / dif) * dif;\n while (j + __cnt[j % a.Length] <= a.Length * b)\n {\n p++;\n j += __cnt[j % a.Length];\n }\n break;\n }\n r[j % a.Length] = j;\n _r[j % a.Length] = p;\n j += __cnt[j % a.Length];\n if (j <= a.Length * b) p++;\n }\n Console.WriteLine(p);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "49256a4e4e128f400c41558343ab4032", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces.Solutions.c314_187_1\n{\n\tpublic class Program2\n\t{\n\t\tpublic static void Main()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\tvar s = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n\t\t\t\tvar b = s[0];\n\t\t\t\tvar d = s[1];\n\n\t\t\t\tvar s1 = Console.ReadLine();\n\t\t\t\tvar s2 = Console.ReadLine();\n\n\t\t\t\tvar adds = new int[s2.Length];\n\t\t\t\tvar follows = new int[s2.Length];\n\n\t\t\t\tfor (var i = 0; i < s2.Length; i++)\n\t\t\t\t{\n\t\t\t\t\tvar index = i;\n\t\t\t\t\tfor (var j = 0; j < s1.Length; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (s2[index] == s1[j])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tindex++;\n\t\t\t\t\t\t\tif (index == s2.Length)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\t\tadds[i]++;\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\tfollows[i] = index;\n\t\t\t\t}\n\n\t\t\t\tvar x = 0;\n\t\t\t\tvar p = 0;\n\t\t\t\tfor (var i = 0; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tp += adds[x];\n\t\t\t\t\tx = follows[x];\n\t\t\t\t}\n\n\t\t\t\tConsole.WriteLine(p/d);\n\t\t\t}\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b06cf904089c87c10c54cb0fde48e524", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "MS C#", "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\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 D();\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[] a = new int[n];\n int[] b = new int[n];\n for (int i = 0; i < n; i++)\n {\n string[] tokens = ReadArray(' ');\n a[i] = int.Parse(tokens[0]);\n b[i] = int.Parse(tokens[1]);\n }\n int ans = 0;\n for (int i = 0; i < n; i++)\n {\n bool isHere = false;\n for (int j = 0; j < n; j++)\n {\n if (i == j) continue;\n if (b[j] == a[i])\n isHere = true;\n }\n if (!isHere)\n ans++;\n }\n Console.WriteLine(ans);\n }\n\n static void B()\n {\n int n, m;\n string[] tokens = ReadArray(' ');\n n = int.Parse(tokens[0]);\n m = int.Parse(tokens[1]);\n int[] a = new int[n];\n tokens = ReadArray(' ');\n for (int i = 0; i < n; i++)\n a[i] = int.Parse(tokens[i]);\n\n int[] sum = new int[m + 1];\n int[] last = new int[n];\n StringBuilder ans = new StringBuilder();\n for (int i = 1; i <= m; i++)\n {\n sum[i] = sum[i - 1];\n tokens = ReadArray(' ');\n int t = int.Parse(tokens[0]);\n if (t == 1)\n {\n int v = int.Parse(tokens[1]);\n int x = int.Parse(tokens[2]);\n a[v - 1] = x;\n last[v - 1] = i;\n }\n if (t == 2)\n {\n int y = int.Parse(tokens[1]);\n sum[i] += y;\n }\n if (t == 3)\n {\n int q = int.Parse(tokens[1]);\n int val = a[q - 1] + (sum[i] - sum[last[q - 1]]);\n ans.AppendLine(val.ToString());\n }\n }\n Console.Write(ans);\n }\n\n static void C()\n {\n long n, k;\n string[] tokens = ReadArray(' ');\n n = long.Parse(tokens[0]);\n k = long.Parse(tokens[1]);\n long[] a = new long[n + 1];\n tokens = ReadArray(' ');\n for (int i = 1; i <= n; i++)\n {\n a[i] = long.Parse(tokens[i - 1]);\n }\n StringBuilder ans = new StringBuilder();\n long cnt = 0;\n long cur = 0;\n long _d = 0;\n for (int i = 1; i <= n; i++)\n {\n _d = 0;\n _d -= (i - 1 - cnt) * ((n-cnt) - (i-cnt)) * a[i];\n _d += cur;\n if (_d < k)\n {\n ans.AppendLine(i.ToString());\n cnt++;\n }\n else\n {\n cur += (i - cnt - 1) * a[i];\n }\n }\n Console.Write(ans);\n }\n\n static int FirstIndex(string a, string c, int i,int z, int j)\n {\n for (int k = 0; k < a.Length; k++, z++)\n {\n if (a[(i + z) % a.Length].Equals(c[j])) return (z + 1);\n }\n return -1;\n }\n\n static void D()\n {\n int b, d;\n string[] tokens = ReadArray(' ');\n b = int.Parse(tokens[0]);\n d = int.Parse(tokens[1]);\n string a = ReadLine();\n string c = ReadLine();\n\n int[] _cnt = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n int z = 0;\n for (int j = 0; j < c.Length; j++)\n {\n int m = FirstIndex(a, c, i, z, j);\n if (m == -1)\n {\n Console.WriteLine(0);\n return;\n }\n z = m;\n }\n _cnt[i] = z;\n }\n\n int[] r = new int[a.Length];\n int[] __cnt = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n int j = 0;\n for (int k = 0; k < a.Length; k++)\n r[k] = -1;\n for (int k = 0; k < d; j += _cnt[(i + j) % a.Length], k++)\n {\n if (r[(i + j) % a.Length] > 0)\n {\n int dif = j - r[(i + j) % a.Length];\n j += (d - k) * dif;\n break;\n }\n r[(i + j) % a.Length] = j;\n }\n __cnt[i] = j;\n }\n r = new int[a.Length];\n int[] _r = new int[a.Length];\n int p = 0;\n for (int j = 0; j < a.Length * b; )\n {\n if (r[j % a.Length] > 0)\n {\n int dif = j - r[j % a.Length];\n int _dif = p - _r[j % a.Length];\n p += ((a.Length * b - j) / dif) * (_dif);\n j += ((a.Length * b - j) / dif) * dif;\n while (j + __cnt[j % a.Length] <= a.Length * b)\n {\n p++;\n j += __cnt[j % a.Length];\n }\n break;\n }\n r[j % a.Length] = j;\n _r[j % a.Length] = p;\n j += __cnt[j % a.Length];\n if (j <= a.Length * b) p++;\n }\n Console.WriteLine(p);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2f4d355f3f6efec1a94c735fc82531b1", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6bdcf108895cf3ee58c0dfdb653e0bd8", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": ".NET Core C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d013a6f425519d8fff59082d608e0dcf", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "49244ac295967d6c59d8448d7797e32b", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "76a4811b6d9427c6182178e300d56001", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a52a65eb08d3073a355ab74bb82e8e2e", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\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\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(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 = long.Parse(input1);\n\n\t\t\tdouble sqrt = Math.Sqrt(n);\n\t\t\tlong longSqrt = (long)sqrt;\n\n\t\t\tlong start = sqrt - longSqrt > 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "285a8e9d92edf65be4746c816f43b4f6", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8e872412cb37b5f5f2c4c02c480e7e15", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "585cd2c5f97c9b86632ffed2d144b5d7", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": ".NET Core C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "da3a9f888baa9ca6e4eec097f977100d", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e36909d559ae7df30a2ca9db4bc65030", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6a2348f9a10fb5db8bec350b069dfef", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1e98d42348c6435f2f73afad23f055d", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f7fe8baead42b3b91e2e4c94cce2adc8", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f21fe7a07e2340d18517e085be01aee3", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc7f6d7d8d590cbefd32a47462c5479c", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "676f59a139f07015040f516549a01d8a", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5341f4e9deea606cd47d045e2b072de1", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "11120dcd4aa32a4a927be0a6a7388fc0", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b4498def21ed9acb05afdbdbd211b9f6", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": ".NET Core C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e523865b08156b111b85d0a02eef0bbb", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ab048f9b371faf551ad99082a136e334", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8d8dfa284bd979b460ed377ef1f0aab7", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4a19af58948e8d713402d51d2698816a", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "65f4473dcc227b1d8e36311a05e00eab", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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 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 (c * c == i)\n continue;\n\n if (i == c * c + 1)\n {\n prev += 2;\n continue;\n }\n\n if(i > 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 }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9f4d84a3c66f84501cdd045b3d97af14", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cf75ad6056bc2f9db4f303fbe7ee8ecc", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": ".NET Core C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "56f36f410b3306f6232874438e414a4a", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": ".NET Core C#", "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(f);\n Console.WriteLine(d);\n Console.WriteLine(2*(a+d));\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1836e8e8a9c4ab398661d88c17017f4f", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": ".NET Core C#", "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 Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a74f7ebd9d3ceb668f7a5a597633ce8d", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "MS C#", "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= 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[] xs;\n static int f,c;\n\n static void chk(int cost)\n {\n if (fuel[n - 1] < 0) return;\n if (f == fuel[n - 1] && c < cost) { c = cost; }\n if (f == -1 || f > fuel[n - 1]) { f = fuel[n - 1]; c = cost; }\n }\n\n static void dfs(int i, int j, int cost)\n {\n if (i >= n - 1) { chk(cost); return; }\n if (j >= xs[i].Count) { if(fuel[i] == 0) dfs(i + 1, 0, cost); return; }\n int dst = xs[i][j][1];\n for (int k = 0; k <= 5; k++)\n if (k <= fuel[i] && xs[i][j][2] <= k && k <= xs[i][j][3])\n {\n fuel[i] -= k;\n fuel[dst] += k;\n\n int nc = k == 0 ? cost : (cost + k * k + xs[i][j][4]);\n dfs(i, j + 1, nc);\n\n fuel[dst] -= k;\n fuel[i] += k;\n }\n }\n\n public static void Main()\n {\n n = int.Parse(Console.ReadLine());\n xs = new List[n];\n fuel = new int[n];\n for (int i = 0; i < n; i++)\n xs[i] = new List();\n for (int i = 0; i < n * (n - 1) / 2; i++)\n {\n var ys = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n ys[0]--; ys[1]--;\n xs[ys[0]].Add(ys);\n }\n f = -1; c = -1;\n for (int i = 0; i <= 5; i++)\n {\n fuel[0] = i;\n dfs(0, 0, 0);\n }\n Console.WriteLine(\"{0} {1}\", f, c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "02abad75c0d4bb0102f90c5305ac673d", "src_uid": "38886ad7b0d83e66b77348be34828426", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round62\n{\n class C\n {\n static int n;\n static int[] fuel;\n static List[] xs;\n static int f,c;\n\n static void chk(int cost)\n {\n if (fuel[n - 1] < 0) return;\n if (f == fuel[n - 1] && c < cost) { c = cost; }\n if (f == -1 || f > fuel[n - 1]) { f = fuel[n - 1]; c = cost; }\n }\n\n static void dfs(int i, int j, int cost)\n {\n if (i >= n - 1) { chk(cost); return; }\n if (i == 1 && j == 0 && f != -1 && f < -fuel[0])\n return;\n if (j >= xs[i].Count)\n {\n if (i == 0 || fuel[i] == 0)\n dfs(i + 1, 0, cost);\n return;\n }\n\n int dst = xs[i][j][1];\n for (int k = xs[i][j][2]; k <= xs[i][j][3]; k++)\n if (i == 0 || k <= fuel[i])\n {\n fuel[i] -= k;\n fuel[dst] += k;\n\n int nc = k == 0 ? cost : (cost + k * k + xs[i][j][4]);\n dfs(i, j + 1, nc);\n\n fuel[dst] -= k;\n fuel[i] += k;\n }\n }\n\n public static void Main()\n {\n n = int.Parse(Console.ReadLine());\n xs = new List[n];\n fuel = new int[n];\n for (int i = 0; i < n; i++)\n xs[i] = new List();\n for (int i = 0; i < n * (n - 1) / 2; i++)\n {\n var ys = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n ys[0]--; ys[1]--;\n xs[ys[0]].Add(ys);\n }\n f = -1; c = -1;\n dfs(0, 0, 0);\n Console.WriteLine(\"{0} {1}\", f, c);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8a0180f06affaffced70d5b2eb48ae90", "src_uid": "38886ad7b0d83e66b77348be34828426", "difficulty": 2200.0} {"lang": "Mono C#", "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 public class Program\n {\n public 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 StringBuilder sb = new StringBuilder();\n static Random rand = new Random(52345235);\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 static int n;\n static int[] j = new int[6];\n static int[,] l = new int[6, 6];\n static int[,] h = new int[6, 6];\n static int[,] a = new int[6, 6];\n static int[,] flow = new int[6, 6];\n\n static int resultFlow;\n static int resultCost;\n\n static void per(int v, int w, int q)\n {\n if (q < 0) throw new Exception();\n\n int j_bak = j[w];\n\n if (w == n - 1)\n {\n if (q >= l[v, w] && q <= h[v, w])\n {\n flow[v, w] = q;\n j[w] = j_bak + q;\n visit(v + 1);\n }\n }\n else\n {\n for (int i = l[v, w]; i <= h[v, w]; i++)\n {\n if (i > q) break;\n if (q - i > 5 * (n - 1 - w)) continue;\n flow[v, w] = i;\n j[w] = j_bak + i;\n per(v, w + 1, q - i);\n }\n }\n\n flow[v, w] = 0;\n j[w] = j_bak;\n }\n\n static void visit(int v)\n {\n if (v == n - 1)\n {\n if (j[n - 1] != j[0]) throw new Exception();\n if (j[n - 1] <= resultFlow)\n {\n int cost = 0;\n for (v = 0; v < n; v++)\n for (int w = v + 1; w < n; w++)\n if (flow[v, w] > 0) cost += a[v, w] + flow[v, w] * flow[v, w];\n if (j[n - 1] < resultFlow || cost > resultCost) resultCost = cost;\n resultFlow = j[n - 1];\n }\n }\n else\n {\n per(v, v + 1, j[v]);\n }\n }\n\n static int Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"_input\"));\n Parser parser = new Parser();\n while (!parser.SeekEOF)\n {\n n = parser.ReadInt();\n for (int i = 0; i < n * (n - 1) / 2; i++)\n {\n int v = parser.ReadInt() - 1;\n int w = parser.ReadInt() - 1;\n l[v, w] = parser.ReadInt();\n h[v, w] = parser.ReadInt();\n a[v, w] = parser.ReadInt();\n }\n\n resultFlow = int.MaxValue;\n resultCost = 0;\n for (j[0] = 0; j[0] <= 25; j[0]++)\n visit(0);\n\n if (resultFlow == int.MaxValue) resultFlow = resultCost = -1;\n Console.WriteLine(resultFlow + \" \" + resultCost);\n }\n\n return 0;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "edda20717901351d5eb3aeea749976be", "src_uid": "38886ad7b0d83e66b77348be34828426", "difficulty": 2200.0} {"lang": "MS C#", "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 if (n == 1)\n IO.Printer.Out.WriteLine(\"1.000000\");\n else\n {\n double N = n;\n double M = m;\n var p = 1 / N;\n var q = (N - 1) / (N * M - 1);\n IO.Printer.Out.WriteLine(p+(1-p)*q);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "35e715e40fa79853ad8d9a45876b9d2d", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.MemSql\n{\n public class Task_C\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"input.txt\"));\n#endif\n new Task_C().Solve();\n }\n\n private void Solve()\n {\n var parts = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = parts[0];\n var m = parts[1];\n\n if (n == 1)\n {\n Console.WriteLine(1);\n }\n else\n {\n var p = (1.0 / n) + ((n - 1.0) / n) * (m - 1.0) / (m * n - 1.0);\n Console.WriteLine(p.ToString().Replace(',', '.'));\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "62494681e525d86b2a246c1b04bcb8b7", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R355.D\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 struct Answer\n {\n public string Winner;\n }\n\n private static void WriteAnswer(TextWriter tw, Answer answer)\n {\n tw.WriteLine(answer.Winner);\n }\n\n private static Answer Parse(TextReader tr)\n {\n var n = int.Parse(tr.ReadLine());\n var board = new string[n];\n for (var i = 0; i < n; ++i)\n board[i] = tr.ReadLine();\n return Calc(board);\n }\n\n private static Answer Calc(string[] board)\n {\n var answer = new Answer();\n var memo = new Dictionary<(int, int), int>();\n var r = Rec(\"\" + board[0][0], 1, 0, board, memo);\n\n if (r > 0)\n answer.Winner = \"FIRST\";\n else if (r < 0)\n answer.Winner = \"SECOND\";\n else\n answer.Winner = \"DRAW\";\n\n return answer;\n }\n\n private static int Rec(string str, int mask, int currentC, string[] board, Dictionary<(int, int), int> memo)\n {\n var n = board.Length;\n var numStr = str.Length;\n\n var key = (numStr, mask);\n if (memo.ContainsKey(key))\n return memo[key];\n\n\n if (numStr == n * 2 - 1)\n {\n if (str.Last() == 'a')\n return 1;\n else if (str.Last() == 'b')\n return -1;\n return 0;\n }\n\n var res = numStr % 2 == 0 ? int.MinValue : int.MaxValue;\n\n for (var ch = 'a'; ch <= 'z'; ++ch)\n {\n var nm = 0;\n\n for (var y = 0; y < n; ++y)\n {\n if ((mask & (1 << y)) == 0)\n continue;\n var x = numStr - y - 1;\n if (x < 0 || x >= n)\n continue;\n if (x < n - 1 && board[y][x + 1] == ch)\n nm |= 1 << y;\n if (y < n - 1 && board[y + 1][x] == ch)\n nm |= 1 << y + 1;\n }\n if (nm == 0)\n continue;\n\n if (numStr % 2 == 0)\n res = Math.Max(res, Rec(str + ch, nm, 0, board, memo));\n else\n res = Math.Min(res, Rec(str + ch, nm, 0, board, memo));\n }\n\n if (str.Last() == 'a')\n res += 1;\n else if (str.Last() == 'b')\n res += -1;\n\n return memo[key] = res;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8abd32e5be6cdee02be31e3f65773faa", "src_uid": "d803fe167a96656f8debdc21edd988e4", "difficulty": 2400.0} {"lang": "MS C#", "source_code": "using 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 private int n;\n\n private string[] table;\n private int?[,] mem;\n\n List> Decode(int x, int mask)\n {\n var ret = new List>();\n if (x >= n)\n {\n int d = x - n;\n for (int i = 0; i < n - 1 - d; i++)\n if ((mask >> i & 1) == 1)\n ret.Add(Tuple.Create(d + 1 + i, n - 1 - i));\n }\n else\n {\n for (int i = 0; i <= x; i++)\n if ((mask >> i & 1) == 1)\n ret.Add(Tuple.Create(i, x - i));\n }\n return ret;\n }\n\n int Encode(int r, int c)\n {\n if (r + c >= n)\n return 1 << n - c - 1;\n return 1 << r;\n }\n\n int Fun(int x, int mask)\n {\n if (mem[x, mask].HasValue)\n return mem[x, mask].Value;\n\n if (x == 2 * (n - 1))\n return 0;\n\n var cpos = Decode(x, mask);\n\n int ret = x % 2 == 1 ? int.MinValue : int.MaxValue;\n for (char ch = 'a'; ch <= 'z'; ch++)\n {\n int nmask = 0;\n foreach (var p in cpos)\n {\n if (p.Item1 + 1 < n && table[p.Item1 + 1][p.Item2] == ch)\n nmask |= Encode(p.Item1 + 1, p.Item2);\n if (p.Item2 + 1 < n && table[p.Item1][p.Item2 + 1] == ch)\n nmask |= Encode(p.Item1, p.Item2 + 1);\n }\n if (nmask > 0)\n {\n int y = Fun(x + 1, nmask);\n if (ch == 'a')\n y++;\n else if (ch == 'b')\n y--;\n if (x % 2 == 1)\n ret = Math.Max(ret, y);\n else\n ret = Math.Min(ret, y);\n }\n }\n\n return (mem[x, mask] = ret).Value;\n }\n\n public object Solve()\n {\n n = ReadInt();\n table = ReadLines(n);\n\n mem = new int?[n << 1,1 << n];\n int r = Fun(0, 1);\n if (table[0][0] == 'a')\n r++;\n if (table[0][0] == 'b')\n r--;\n\n return r > 0 ? \"FIRST\" : (r == 0 ? \"DRAW\" : \"SECOND\");\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(params T[] array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "35d7f1b40c5c57e91b1e524bca0e0919", "src_uid": "d803fe167a96656f8debdc21edd988e4", "difficulty": 2400.0} {"lang": "MS C#", "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 private int n;\n\n private string[] table;\n private int?[,] mem;\n\n List> Decode(int x, int mask)\n {\n var ret = new List>();\n if (x >= n)\n {\n int d = x - n;\n for (int i = 0; i < n - 1 - d; i++)\n if ((mask >> i & 1) == 1)\n ret.Add(Tuple.Create(d + 1 + i, n - 1 - i));\n }\n else\n {\n for (int i = 0; i <= x; i++)\n if ((mask >> i & 1) == 1)\n ret.Add(Tuple.Create(i, x - i));\n }\n return ret;\n }\n\n int Encode(int r, int c)\n {\n if (r + c >= n)\n return 1 << n - c - 1;\n return 1 << r;\n }\n\n int Fun(int x, int mask)\n {\n if (mem[x, mask].HasValue)\n return mem[x, mask].Value;\n\n if (x == 2 * (n - 1))\n return 0;\n\n var cpos = Decode(x, mask);\n\n int ret = x % 2 == 1 ? int.MinValue : int.MaxValue;\n for (char ch = 'a'; ch <= 'z'; ch++)\n {\n int nmask = 0;\n foreach (var p in cpos)\n {\n if (p.Item1 + 1 < n && table[p.Item1 + 1][p.Item2] == ch)\n nmask |= Encode(p.Item1 + 1, p.Item2);\n if (p.Item2 + 1 < n && table[p.Item1][p.Item2 + 1] == ch)\n nmask |= Encode(p.Item1, p.Item2 + 1);\n }\n if (nmask > 0)\n {\n int y = Fun(x + 1, nmask);\n if (ch == 'a')\n y++;\n else if (ch == 'b')\n y--;\n if (x % 2 == 1)\n ret = Math.Max(ret, y);\n else\n ret = Math.Min(ret, y);\n }\n }\n\n return (mem[x, mask] = ret).Value;\n }\n\n public object Solve()\n {\n n = ReadInt();\n table = ReadLines(n);\n\n mem = new int?[n << 1,1 << n];\n int r = Fun(0, 1);\n if (table[0][0] == 'a')\n r++;\n if (table[0][0] == 'b')\n r--;\n\n return r > 0 ? \"FIRST\" : (r == 0 ? \"DRAW\" : \"SECOND\");\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(params T[] array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6dbc6878052691943e818bd1ee58a19f", "src_uid": "d803fe167a96656f8debdc21edd988e4", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R355.D\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 struct Answer\n {\n public string Winner;\n }\n\n private static void WriteAnswer(TextWriter tw, Answer answer)\n {\n tw.WriteLine(answer.Winner);\n }\n\n private static Answer Parse(TextReader tr)\n {\n var n = int.Parse(tr.ReadLine());\n var board = new string[n];\n for (var i = 0; i < n; ++i)\n board[i] = tr.ReadLine();\n return Calc(board);\n }\n\n private static Answer Calc(string[] board)\n {\n var answer = new Answer();\n var memo = new Dictionary<(int, int), int>();\n var r = Rec(\"\" + board[0][0], 1, 0, board, memo);\n\n if (r > 0)\n answer.Winner = \"FIRST\";\n else if (r < 0)\n answer.Winner = \"SECOND\";\n else\n answer.Winner = \"DRAW\";\n\n return answer;\n }\n\n private static int Rec(string str, int mask, int currentC, string[] board, Dictionary<(int, int), int> memo)\n {\n var n = board.Length;\n var numStr = str.Length;\n\n var key = (numStr, mask);\n if (memo.ContainsKey(key))\n return memo[key];\n\n\n if (numStr == n * 2 - 1)\n {\n if (str.Last() == 'a')\n return 1;\n else if (str.Last() == 'b')\n return -1;\n return 0;\n }\n\n var res = numStr % 2 == 0 ? int.MinValue : int.MaxValue;\n\n for (var ch = 'a'; ch <= 'z'; ++ch)\n {\n var nm = 0;\n\n for (var y = 0; y < n; ++y)\n {\n if ((mask & (1 << y)) == 0)\n continue;\n var x = numStr - y - 1;\n if (x < 0 || x >= n)\n continue;\n if (x < n - 1 && board[y][x + 1] == ch)\n nm |= 1 << y;\n if (y < n - 1 && board[y + 1][x] == ch)\n nm |= 1 << y + 1;\n }\n if (nm == 0)\n continue;\n\n if (numStr % 2 == 0)\n res = Math.Max(res, Rec(str + ch, nm, 0, board, memo));\n else\n res = Math.Min(res, Rec(str + ch, nm, 0, board, memo));\n }\n\n if (str.Last() == 'a')\n res += 1;\n else if (str.Last() == 'b')\n res += -1;\n\n return memo[key] = res;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "47f7bcbbd91692cc3ea9706dc71fffad", "src_uid": "d803fe167a96656f8debdc21edd988e4", "difficulty": 2400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Indivisibility\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 var divs = new[]\n {\n new[] {2, 3, 5, 7},\n new[] {6, 10, 15, 14, 21, 35},\n new[] {30, 42, 70, 105},\n new[] {210}\n };\n\n long sum = n;\n int sign = -1;\n\n for (int i = 0; i < divs.Length; i++)\n {\n for (int j = 0; j < divs[i].Length; j++)\n {\n sum += sign*n/divs[i][j];\n }\n sign = -sign;\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a70c37278987dbcd7feadf2a168a2182", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace K\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tlong N = //long.Parse(Console.ReadLine());\n\t\t\t\tConvert.ToInt64(Console.ReadLine());\n\t\t\tConsole.WriteLine(N - N / 2 - N / 3 - N / 5 - N / 7\n\t\t\t\t+ N / 6 + N / 10 + N / 14 + N / 15 + N / 21 + N / 35\n\t\t\t\t- N / 30 - N / 42 - N / 70 - N / 105\n\t\t\t\t+ N / 210);\t\t\t\t\t\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c2e8e5462c26cef54cd8f9e9f48bdfe7", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "Mono C#", "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\tlong ng=0;\n\t\tlong[] P=new long[]{2,3,5,7};\n\t\tfor(int i=1;i<(1<<4);i++){\n\t\t\tint bc=0;\n\t\t\tlong div=1;\n\t\t\tfor(int j=0;j<4;j++){\n\t\t\t\tif(((i>>j)&1)==1){\n\t\t\t\t\tbc++;\n\t\t\t\t\tdiv*=P[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(bc%2==1){\n\t\t\t\tng+=N/div;\n\t\t\t}else{\n\t\t\t\tng-=N/div;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(N-ng);\n\t}\n\tlong N;\n\tpublic Sol(){\n\t\tN=rl();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "366237519fc653e0aa58932b82695878", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "MS C#", "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 var inputStringSplit = Console.ReadLine().Split(new char[] { ' ' }).Select(x => long.Parse(x)).ToList();\n //long x1 = inputStringSplit[0], y1 = inputStringSplit[1], x2 = inputStringSplit[2], y2 = inputStringSplit[3], shortX, longX, shortY, longY;\n //Console.WriteLine(Math.Pow(1.000000011, inputStringSplit.ElementAt(1)) * inputStringSplit.ElementAt(0));\n //longX = longY = shortY = shortX = 0;\n //if ((x1 % 2 == 0 && x2 % 2 == 1) || (x1 % 2 == 1 && x2 % 2 == 0))\n //{\n // shortX = longX = Math.Abs(x2 - x1 + 1) / 2;\n //}\n //if (x1 % 2 == 1 && x2 % 2 == 1)\n //{\n // longX = Math.Abs(x2 - x1 + 1) / 2 + 1;\n // shortX = Math.Abs(x2 - x1 + 1) / 2;\n //}\n //if (x1 % 2 == 0 && x2 % 2 == 0)\n //{\n // shortX = Math.Abs(x2 - x1 + 1) / 2 + 1;\n // longX = Math.Abs(x2 - x1 + 1) / 2;\n //}\n //if ((y1 % 2 == 0 && y2 % 2 == 1) || (y1 % 2 == 1 && y2 % 2 == 0))\n //{\n // shortY = longY = Math.Abs(y2 - y1 + 1) / 2;\n //}\n //if (y1 % 2 == 1 && y2 % 2 == 1)\n //{\n // longY = Math.Abs(y2 - y1 + 1) / 2 + 1;\n // shortY = Math.Abs(y2 - y1 + 1) / 2;\n //}\n //if (y1 % 2 == 0 && y2 % 2 == 0)\n //{\n // shortY = Math.Abs(y2 - y1 + 1) / 2 + 1;\n // longY = Math.Abs(y2 - y1 + 1) / 2;\n //}\n //Console.WriteLine(shortX * shortY + longX * longY);\n var n = inputStringSplit[0];\n var res = n - n / 2 - n / 5 - n / 7 - n / 3 + n / 6 + n / 10 + n / 14 + n / 15 + n / 21 - n / 30 + n / 35 - n / 42 - n / 70 - n / 105 + n / 210;\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "15bdfc9dd8392d7d525094342999c184", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "MS C#", "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\n class Program\n {\n static void Main(string[] args)\n {\n BigInteger n = Convert.ToUInt64(Console.ReadLine());\n BigInteger t = n-n / 2 - n / 3 - n / 5 - n / 7+n/6+n/10+n/14+n/15+n/21+n/35-n/30-n/42-n/70-n/105+n/210 ;\n \n\n Console.WriteLine(t);\n\n\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7bb3990f05f9d8701f84f4f6d3dcdd94", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace K\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tlong N = long.Parse(Console.ReadLine());\n\t\t\tConsole.WriteLine(N - N / 2 - N / 3 - N / 5 - N / 7\n\t\t\t\t+ N / 6 + N / 10 + N / 14 + N / 15 + N / 21 + N / 35\n\t\t\t\t- N / 30 - N / 42 - N / 70 - N / 105\n\t\t\t\t+ N / 210);\t\t\t\t\t\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "462ab74c5183317c77155062889d8f7e", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "Mono C#", "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 long[,] C = new long[800, 10];\n\n\t\tpublic static void PreCalc() {\n\t\t\tC [1,1] = 1L;\n\t\t\tC [2,1] = 2L;\n\t\t\tC [2,2] = 1L;\n\t\t\tfor (int i = 3; i <= 777; i ++) C[i,1] = 1L*i;\n\t\t\tfor (int i = 3; i <= 777; i ++)\n\t\t\t\tfor (int j = 2; j <= 7; j ++) \n\t\t\t\t\tC [i,j] = C [i - 1,j] + C [i - 1,j - 1];\n\t\t}\n\n\t\tpublic static void Main(string[] args) {\n\t\t\tlong n = long.Parse (Console.ReadLine ());\n\t\t\tint[] a = {2, 3, 5, 7};\n\t\t\tlong ans = n;\n\t\t\tfor (int i = 0; i < 4; i ++) ans -= n / a[i];\n\t\t\tfor (int i = 0; i < 4; i ++)\n\t\t\t\tfor (int j = i + 1; j < 4; j ++)\n\t\t\t\t\tans += n / a[i] / a[j];\n\t\t\tfor (int i = 0; i < 4; i ++)\n\t\t\t\tfor (int j = i + 1; j < 4; j ++)\n\t\t\t\t\tfor (int k = j + 1; k < 4; k ++)\n\t\t\t\t\t\tans -= n / a[i] / a[j] / a[k];\n\t\t\tans += n / 2 / 3/ 5/ 7;\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aff9ee2a68dac75615b24f5606fc5aad", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ChallengePennants\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long n = long.Parse(s);\n if (n <= 10)\n {\n Console.WriteLine(1);\n }\n else\n {\n long x = n / 2 + n / 3 + n / 5 + n / 7;\n x -= n / 6 + n / 10 + n / 14 + n / 15 + n / 21 + n / 35;\n x += n / 30 + n / 42 + n / 70 + n / 105;\n x -= n / 210;\n Console.WriteLine(\"{0:d}\", n - x);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a0fb60913ec6efd4f08360dc66dd5266", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace K\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong n = UInt64.Parse(Console.ReadLine());\n Console.Write(n - (n/2 + n/3 + n/5 + n/7 - n/6 - n/10 - n/14 - n/15 - n/21 - n/35 + n/30 + n/42 + n/105 + n/70 - n/210));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6a2965f1d7fc50f4eb1173fdfd268b4", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "MS C#", "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 = long.Parse(Console.ReadLine());\n var ans = n / 2 + n / 3 + n / 5 + n / 7 - n / 6 - n / 10 - n / 14 - n / 15 - n / 21 -\n n / 35 + n / 30 + n / 42 + n / 70 + n / 105 - n / 210;\n ans = n - ans;\n Console.WriteLine(ans);\n\n }\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c288d2b35e247bae8d31f42d20bbd651", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "MS C#", "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 Prob11 {\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 n=long.Parse(io.NextToken());\n long ans = n;\n ans -= n / 2+n/3+n/5+n/7;\n ans += n / 6 + n / 10 + n / 14 + n / 15+n/21+n/35;\n ans -= n / 30 + n / 42 + n / 70 + n / 105;\n ans += n / 210;\n io.WriteLine(ans);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cd02956d413034824d49b0149dcdeca3", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "MS C#", "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 checked\n {\n var n = ReadLong();\n var x = 2 * 3 * 5 * 7;\n var count = 0;\n for (int i = 1; i < x; i++)\n if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0 && i % 7 != 0)\n count++;\n var result = 0;\n var rem = n % x;\n for (int i = 1; i <= rem; i++)\n if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0 && i % 7 != 0)\n result++;\n return (n / x) * count + result;\n\n \n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "abf9bb1d39cb976b9b2d863cba2872da", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ChallengePennants\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long n = long.Parse(s);\n if (n <= 10)\n {\n Console.WriteLine(0);\n }\n else\n {\n long x = n / 2 + n / 3 + n / 5 + n / 7;\n x -= n / 6 + n / 10 + n / 14 + n / 15 + n / 21 + n / 35;\n x += n / 30 + n / 42 + n / 70 + n / 105;\n x -= n / 210;\n Console.WriteLine(\"{0:d}\", n - x);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc688510b0c1833a61dc760c9bf0909c", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "MS C#", "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 = long.Parse(Console.ReadLine());\n var ans = n / 2 + n / 3 + n / 5 + n / 7 - n / 6 - n / 10 - n / 14 - n / 15 - n / 21 - n / 35 - n / 105 - n / 210;\n ans = n - ans;\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d915358ad21a93029e7d03921cdb4bc3", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "MS C#", "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 var inputStringSplit = Console.ReadLine().Split(new char[] { ' ' }).Select(x => long.Parse(x)).ToList();\n //long x1 = inputStringSplit[0], y1 = inputStringSplit[1], x2 = inputStringSplit[2], y2 = inputStringSplit[3], shortX, longX, shortY, longY;\n //Console.WriteLine(Math.Pow(1.000000011, inputStringSplit.ElementAt(1)) * inputStringSplit.ElementAt(0));\n //longX = longY = shortY = shortX = 0;\n //if ((x1 % 2 == 0 && x2 % 2 == 1) || (x1 % 2 == 1 && x2 % 2 == 0))\n //{\n // shortX = longX = Math.Abs(x2 - x1 + 1) / 2;\n //}\n //if (x1 % 2 == 1 && x2 % 2 == 1)\n //{\n // longX = Math.Abs(x2 - x1 + 1) / 2 + 1;\n // shortX = Math.Abs(x2 - x1 + 1) / 2;\n //}\n //if (x1 % 2 == 0 && x2 % 2 == 0)\n //{\n // shortX = Math.Abs(x2 - x1 + 1) / 2 + 1;\n // longX = Math.Abs(x2 - x1 + 1) / 2;\n //}\n //if ((y1 % 2 == 0 && y2 % 2 == 1) || (y1 % 2 == 1 && y2 % 2 == 0))\n //{\n // shortY = longY = Math.Abs(y2 - y1 + 1) / 2;\n //}\n //if (y1 % 2 == 1 && y2 % 2 == 1)\n //{\n // longY = Math.Abs(y2 - y1 + 1) / 2 + 1;\n // shortY = Math.Abs(y2 - y1 + 1) / 2;\n //}\n //if (y1 % 2 == 0 && y2 % 2 == 0)\n //{\n // shortY = Math.Abs(y2 - y1 + 1) / 2 + 1;\n // longY = Math.Abs(y2 - y1 + 1) / 2;\n //}\n //Console.WriteLine(shortX * shortY + longX * longY);\n var n = inputStringSplit[0];\n var res = n - n / 2 - n / 5 - n / 7 - n / 3 + n / 6 + n / 10 + n / 14 + n / 15 + n / 21 - n / 30 + n / 35 - n / 42 - n / 70 - n / 105 + n / 210;\n Console.WriteLine(n);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "79ab6b2a54df8677a4c9c1dff6d9953c", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace K\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tlong N = long.Parse(Console.ReadLine());\n\t\t\tConsole.WriteLine(N - N / 2 - N / 3 - N / 5 - N / 7 + N / 6 + N / 10);\t\t\t\t\t\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "40e74bf783e26bdd288f3e6c03c3a01a", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "MS C#", "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 = long.Parse(Console.ReadLine());\n var ans = n / 2 + n / 3 + n / 5 + n / 7 + n / 6 + n / 10 + n / 14 + n / 15 + n / 21 +\n n / 35 - n / 30 - n / 42 - n / 70 - n / 105 + n / 210;\n ans = n - ans;\n Console.WriteLine(ans);\n\n }\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "95ae48c99e8a0af089b5f5f1213c99c4", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "MS C#", "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\n class Program\n {\n static void Main(string[] args)\n {\n BigInteger n = Convert.ToUInt64(Console.ReadLine());\n BigInteger t = n / 2 + n / 5 + n / 7 + n / 3 - n / 6 - n / 10 - n / 14 - n / 15 - n / 21 - n / 35;\n t -= n; t = -t;\n\n Console.WriteLine(t);\n\n\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a2ce30c9f37f7d097551237a55e21286", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Indivisibility\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 var divs = new[]\n {\n new[] {2, 3, 5, 7},\n new[] {6, 10, 15, 14, 21, 35},\n new[] {30, 42, 105},\n new[] {210}\n };\n\n long sum = n;\n int sign = -1;\n\n for (int i = 0; i < divs.Length; i++)\n {\n for (int j = 0; j < divs[i].Length; j++)\n {\n sum += sign*n/divs[i][j];\n }\n sign = -sign;\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ee70f28db0dbc3736738ab2231ecb80", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "Mono C#", "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\tint[]A = new int[N];\n\t\tstring[]str = Console.ReadLine().Split();\n\t\tint min = 999999999;\n\t\tfor(var i=0;i N/2){\n\t\t\tans = \"Bob\";\n\t\t} else {\n\t\t\tans = \"Alice\";\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a39aab8b5830d24d5afa8d6b77001fea", "src_uid": "4b9cf82967aa8441e9af3db3101161e9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Threading;\nusing System.Text;\nusing System.Diagnostics;\nusing static util;\nusing P = pair;\n\nclass Program {\n static void Main(string[] args) {\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n var solver = new Solver(sw);\n // var t = new Thread(solver.solve, 1 << 26); // 64 MB\n // t.Start();\n // t.Join();\n solver.solve();\n sw.Flush();\n }\n}\n\nclass Solver {\n StreamWriter sw;\n Scan sc;\n void Prt(string a) => sw.WriteLine(a);\n void Prt(IEnumerable a) => Prt(string.Join(\" \", a));\n void Prt(params object[] a) => Prt(string.Join(\" \", a));\n public Solver(StreamWriter sw) {\n this.sw = sw;\n this.sc = new Scan();\n }\n\n public void solve() {\n int n = sc.Int;\n if (n == 1) {\n Prt(1);\n return;\n }\n int m = 1;\n while (m <= n) m *= 2;\n int c = 0;\n for (int i = m / 2; i < m; ++i)\n {\n int bc = bitcnt(i);\n int next = -1;\n int p = i;\n while (p > 0) {\n if (p % 2 == 0) {\n next = p / 2;\n break;\n }\n p >>= 1;\n }\n if (next != -1 && bc % 2 != bitcnt(next) % 2) {\n ++c;\n }\n }\n // DBG(c);\n if (m / 2 - 1 + c == n || m / 2 - 1 + c + 1 == n) {\n Prt(1);\n }\n else Prt(0);\n\n }\n int bitcnt(int a) {\n int ret = 0;\n while (a > 0) {\n ret += a & 1;\n a >>= 1;\n }\n return ret;\n }\n}\n\nclass pair : IComparable> {\n public T v1;\n public U v2;\n public pair() : this(default(T), default(U)) {}\n public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; }\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) { a = v1; b = v2; }\n}\nstatic class util {\n public static readonly int M = 1000000007;\n // public static readonly int M = 998244353;\n public static readonly long LM = 1L << 60;\n public static readonly double eps = 1e-11;\n public static void DBG(string a) => Console.Error.WriteLine(a);\n public static void DBG(IEnumerable a) => DBG(string.Join(\" \", a));\n public static void DBG(params object[] a) => DBG(string.Join(\" \", a));\n public static void Assert(bool cond) { if (!cond) throw new Exception(); }\n public static pair make_pair(T v1, U v2) => new pair(v1, v2);\n public static int CompareList(IList a, IList b) where T : IComparable {\n for (int i = 0; i < a.Count && i < b.Count; i++)\n if (a[i].CompareTo(b[i]) != 0) return a[i].CompareTo(b[i]);\n return a.Count.CompareTo(b.Count);\n }\n public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;\n static readonly int[] dd = { 0, 1, 0, -1 };\n // static readonly string dstring = \"RDLU\";\n public static P[] adjacents(int i, int j)\n => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1])).ToArray();\n public static P[] adjacents(int i, int j, int h, int w)\n => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1]))\n .Where(p => inside(p.v1, p.v2, h, w)).ToArray();\n public static P[] adjacents(this P p) => adjacents(p.v1, p.v2);\n public static P[] adjacents(this P p, int h, int w) => adjacents(p.v1, p.v2, h, 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 int[] compressed(this IEnumerable a) {\n var cmp = a.compress();\n return a.Select(x => cmp[x]).ToArray();\n }\n public static T[] inv(this Dictionary dic) {\n var res = new T[dic.Count];\n foreach (var item in dic) res[item.Value] = item.Key;\n return res;\n }\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}\n\nclass Scan {\n StreamReader sr;\n public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }\n public Scan(string path) { sr = new StreamReader(path); }\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 => sr.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 => Pair();\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ef3a3de79c52cd9655ece581efa0d6c9", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing Number = System.Int64;\nusing System.Numerics;\nusing static System.Math;\nnamespace Program {\n public class Solver {\n Random rnd = new Random ();\n public void Solve () {\n var n = rl;\n var k = rl;\n var m = rl;\n var d = rl;\n BigInteger ans = 0;\n for (var i = 1; i <= d + 1; i++) {\n var min = n / k / i;\n var max = i == 1 ? m : n / k / (i - 1) + 1;\n min = Math.Min (Math.Max (1, min), m);\n max = Math.Min (Math.Max (1, max), m);\n foreach (var x in new BigInteger[] { min, max }) {\n BigInteger V = n;\n BigInteger u = x;\n u *= k;\n var cnt = 0;\n while (V >= x && cnt <= d) {\n V -= u;\n cnt++;\n }\n //Console.Error.WriteLine ($\"{x} {cnt}\");\n\n if (cnt <= d) ans = BigInteger.Max (ans, cnt * x);\n }\n }\n System.Console.WriteLine (ans);\n\n }\n const long INF = 1L << 60;\n //static int[] dx = { -1, 0, 1, 0 };\n //static int[] dy = { 0, 1, 0, -1 };\n\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 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#region main\nstatic class Ex {\n static public string AsString (this IEnumerable ie) { return new string (ie.ToArray ()); }\n static public string AsJoinedString (this IEnumerable ie, string st = \" \") {\n return string.Join (st, ie);\n }\n static public void Main () {\n Console.SetOut (new Program.IO.Printer (Console.OpenStandardOutput ()) { AutoFlush = false });\n var solver = new Program.Solver ();\n try {\n solver.Solve ();\n Console.Out.Flush ();\n } catch { }\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO {\n using System.Globalization;\n using System.IO;\n using System.Text;\n\n public class Printer : StreamWriter {\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 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 if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read (buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char () {\n byte b = 0;\n do b = read (); while ((b < 33 || 126 < b) && !isEof);\n return (char) b;\n }\n public string Scan () {\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 var sb = new StringBuilder ();\n for (var b = Char (); b != '\\n' && b != 0; b = (char) read ())\n 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#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9d05f0557c9ab52cc2b70c542d4ae71e", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing Number = System.Int64;\nusing System.Numerics;\nusing static System.Math;\nnamespace Program {\n public class Solver {\n Random rnd = new Random ();\n public void Solve () {\n var n = rl;\n var k = rl;\n var m = rl;\n var d = rl;\n BigInteger ans = 0;\n for (var i = 1; i <= d + 1; i++) {\n BigInteger min = n;\n BigInteger kk = k;\n kk *= i;\n min /= k;\n kk = k;\n kk *= i - 1;\n var max = i == 1 ? m : n / kk - 1;\n min = BigInteger.Min (BigInteger.Max (1, min), m);\n max = BigInteger.Min (BigInteger.Max (1, max), m);\n foreach (var x in new BigInteger[] { min, max }) {\n BigInteger V = n;\n BigInteger u = x;\n u *= k;\n var cnt = 0;\n while (V >= x && cnt <= d) {\n V -= u;\n cnt++;\n }\n //Console.Error.WriteLine ($\"{x} {cnt}\");\n\n if (cnt <= d) ans = BigInteger.Max (ans, cnt * x);\n }\n }\n System.Console.WriteLine (ans);\n\n }\n const long INF = 1L << 60;\n //static int[] dx = { -1, 0, 1, 0 };\n //static int[] dy = { 0, 1, 0, -1 };\n\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 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#region main\nstatic class Ex {\n static public string AsString (this IEnumerable ie) { return new string (ie.ToArray ()); }\n static public string AsJoinedString (this IEnumerable ie, string st = \" \") {\n return string.Join (st, ie);\n }\n static public void Main () {\n Console.SetOut (new Program.IO.Printer (Console.OpenStandardOutput ()) { AutoFlush = false });\n var solver = new Program.Solver ();\n try {\n solver.Solve ();\n Console.Out.Flush ();\n } catch { }\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO {\n using System.Globalization;\n using System.IO;\n using System.Text;\n\n public class Printer : StreamWriter {\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 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 if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read (buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char () {\n byte b = 0;\n do b = read (); while ((b < 33 || 126 < b) && !isEof);\n return (char) b;\n }\n public string Scan () {\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 var sb = new StringBuilder ();\n for (var b = Char (); b != '\\n' && b != 0; b = (char) read ())\n 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#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e265e5215fc92ef2f7dc98fed0842521", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing Number = System.Int64;\nusing System.Numerics;\nusing static System.Math;\nnamespace Program {\n public class Solver {\n Random rnd = new Random ();\n public void Solve () {\n var n = rl;\n var k = rl;\n var m = rl;\n var d = rl;\n BigInteger ans = 0;\n for (var i = 1; i <= d + 1; i++) {\n BigInteger min = n;\n BigInteger kk = k;\n kk *= i;\n min /= kk;\n kk = k;\n kk *= i - 1;\n kk += 1;\n var max = i == 1 ? m : (n / kk);\n min = BigInteger.Min (BigInteger.Max (1, min), m);\n max = BigInteger.Min (BigInteger.Max (1, max), m);\n\n foreach (var x in new BigInteger[] { min, max }) {\n BigInteger V = n;\n BigInteger u = x;\n u *= k;\n var cnt = 0;\n while (V >= x && cnt <= d) {\n V -= u;\n cnt++;\n }\n Console.WriteLine ($\"{min} {max} {x} {cnt}\");\n\n if (cnt <= d) ans = BigInteger.Max (ans, cnt * x);\n }\n }\n System.Console.WriteLine (ans);\n\n }\n const long INF = 1L << 60;\n //static int[] dx = { -1, 0, 1, 0 };\n //static int[] dy = { 0, 1, 0, -1 };\n\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 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#region main\nstatic class Ex {\n static public string AsString (this IEnumerable ie) { return new string (ie.ToArray ()); }\n static public string AsJoinedString (this IEnumerable ie, string st = \" \") {\n return string.Join (st, ie);\n }\n static public void Main () {\n Console.SetOut (new Program.IO.Printer (Console.OpenStandardOutput ()) { AutoFlush = false });\n var solver = new Program.Solver ();\n try {\n solver.Solve ();\n Console.Out.Flush ();\n } catch { }\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO {\n using System.Globalization;\n using System.IO;\n using System.Text;\n\n public class Printer : StreamWriter {\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 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 if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read (buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char () {\n byte b = 0;\n do b = read (); while ((b < 33 || 126 < b) && !isEof);\n return (char) b;\n }\n public string Scan () {\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 var sb = new StringBuilder ();\n for (var b = Char (); b != '\\n' && b != 0; b = (char) read ())\n 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#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8fafed36b6d512d8003c7cd67000dde2", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n BigInteger n = BigInteger.Parse(s[0]);\n BigInteger k = BigInteger.Parse(s[1]);\n BigInteger M = BigInteger.Parse(s[2]);\n BigInteger D = BigInteger.Parse(s[3]);\n BigInteger ans = new BigInteger();\n ans = 0;\n for (int i = 0; i <= D; i++)\n {\n\n BigInteger len = i * k + 1;\n BigInteger t = n / len;\n if(t > M)\n {\n t = M;\n }\n if (t == 0)\n {\n continue;\n }\n // cout << len << \" \" << t << endl;\n BigInteger ct = n / t;\n ct = (ct + k - 1) / k;\n \n BigInteger cur = ct * t;\n // cout << cur << \" \" << ct << endl;\n if (ct == i + 1 && ct <= D)\n {\n if(ans < cur)\n {\n ans = cur;\n }\n }\n\n\n\n }\n Console.Write(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "03140219bac8d6ab7619c14d3fd57c7d", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string foo = Console.ReadLine();\n string[] tokens = foo.Split(' ');\n List nums = new List();\n foreach (string s in tokens)\n if (long.TryParse(s, out var oneNum))\n nums.Add(oneNum);\n\n long n = nums[0], k = nums[1], m = nums[2], d = nums[3];\n var tmp = BigInteger.Divide(10, 4);\n long mx = 0;\n for (long i = 1; i <= d; i++)\n {\n long lo = 1, hi = m;\n while (hi - lo > 1)\n {\n long mid = (lo + hi) / 2;\n var value = BigInteger.Divide(BigInteger.Add(n - 1 - n % mid, BigInteger.Multiply(k, mid)),\n BigInteger.Multiply(k, mid));\n if (value >= i)\n lo = mid;\n else\n hi = mid;\n }\n var highValue = BigInteger.Divide(BigInteger.Add(n - 1 - n % hi, BigInteger.Multiply(k, hi)), BigInteger.Multiply(k, hi));\n var lowValue = BigInteger.Divide(BigInteger.Add(n - 1 - n % lo, BigInteger.Multiply(k, lo)), BigInteger.Multiply(k, lo));\n if (highValue >= i)\n mx = Math.Max(mx, hi * i);\n else if (lowValue >= i)\n mx = Math.Max(mx, lo * i);\n }\n Console.WriteLine(mx);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f7dffeabf28e8242795a339fd3da5c25", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing Number = System.Int64;\nusing System.Numerics;\nusing static System.Math;\nnamespace Program {\n public class Solver {\n Random rnd = new Random ();\n public void Solve () {\n var n = rl;\n var k = rl;\n var m = rl;\n var d = rl;\n BigInteger ans = 0;\n for (var i = 1; i <= d + 1; i++) {\n BigInteger min = n;\n BigInteger kk = k;\n kk *= i;\n min /= kk;\n kk = k;\n kk *= i - 1;\n kk += 1;\n var max = i == 1 ? m : (n / kk);\n min = BigInteger.Min (BigInteger.Max (1, min), m);\n max = BigInteger.Min (BigInteger.Max (1, max), m);\n\n foreach (var x in new BigInteger[] { min, max }) {\n BigInteger V = n;\n BigInteger u = x;\n u *= k;\n var cnt = 0;\n while (V >= x && cnt <= d) {\n V -= u;\n cnt++;\n }\n //Console.WriteLine ($\"{min} {max} {x} {cnt}\");\n\n if (cnt <= d) ans = BigInteger.Max (ans, cnt * x);\n }\n }\n System.Console.WriteLine (ans);\n\n }\n const long INF = 1L << 60;\n //static int[] dx = { -1, 0, 1, 0 };\n //static int[] dy = { 0, 1, 0, -1 };\n\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 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#region main\nstatic class Ex {\n static public string AsString (this IEnumerable ie) { return new string (ie.ToArray ()); }\n static public string AsJoinedString (this IEnumerable ie, string st = \" \") {\n return string.Join (st, ie);\n }\n static public void Main () {\n Console.SetOut (new Program.IO.Printer (Console.OpenStandardOutput ()) { AutoFlush = false });\n var solver = new Program.Solver ();\n try {\n solver.Solve ();\n Console.Out.Flush ();\n } catch { }\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO {\n using System.Globalization;\n using System.IO;\n using System.Text;\n\n public class Printer : StreamWriter {\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 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 if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read (buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char () {\n byte b = 0;\n do b = read (); while ((b < 33 || 126 < b) && !isEof);\n return (char) b;\n }\n public string Scan () {\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 var sb = new StringBuilder ();\n for (var b = Char (); b != '\\n' && b != 0; b = (char) read ())\n 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#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "29c9a801fb7df6ad0ae7d76d85925f27", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n int N;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n // \u9577\u30552N\u306e\u304b\u3063\u3053\u5217\u3059\u3079\u3066\n // Trie\u306e\u6700\u5927\u30de\u30c3\u30c1\u30f3\u30b0\n\n // \u6728\n // 2\u8272\u306b\u5857\u3063\u3066\u5c11\u306a\u3044\u65b9\n\n // \u9802\u70b9\u5897\u3048\u65b9\n // \u4ee5\u964d>\u3057\u304b\u7f6e\u3051\u306a\u3044\n\n // < >>>>>\n\n\n // 0 1 2 3\n // 0: 1 \n // 1: 1 1 ... 1\n // 2: 2 2 1 ... 3\n // 3: 5 5 3 1\n // 4: \n\n var dp = new ModInt[N + 1][];\n for (int i = 0; i <= N; i++)\n {\n dp[i] = new ModInt[i + 1];\n }\n\n dp[0][0] = 1;\n for (int i = 0; i < N; i++)\n {\n ModInt tmp = 0;\n for (int j = i; j >= 0; j--)\n {\n tmp += dp[i][j];\n dp[i + 1][j + 1] = tmp;\n }\n dp[i + 1][0] = tmp;\n }\n\n ModInt ans = 0;\n for (int i = 0; i < N; i++)\n {\n for (int j = 0; j <= i; j++)\n {\n ans += dp[i][j] * ((j + 2) / 2);\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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n #region ModInt\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 /// \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 #endregion\n #region Binomial Coefficient\n public class 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 #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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "04e3fbac8cf2197fa99111e0c397c75f", "src_uid": "8218255989e5eab73ac7107072c3b2af", "difficulty": 2100.0} {"lang": "Mono C#", "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 var dp = new ModInt[2 * N + 1, N + 1];\n dp[0, 0] = 1;\n for (int i = 1; i <= 2 * N; i++)\n {\n for (int j = i % 2; j <= Min(N, 2 * N - i); j += 2)\n {\n if (j > 0) dp[i, j] = dp[i - 1, j - 1];\n if (j < N) dp[i, j] += dp[i - 1, j + 1];\n }\n }\n\n var S = new ModInt[2 * N + 1];\n for (int i = 0; i < S.Length; i++)\n {\n for (int j = 0; j <= N; j++)\n {\n S[i] += dp[i, j];\n }\n }\n S.Reverse();\n // S.join();\n \n\n ModInt ans = 0;\n for (int i = 1; i < S.Length; i += 2)\n {\n ans += S[i];\n }\n WriteLine(ans);\n\n //for (int i = 0; i < N; i++)\n //{\n // for (int j = 0; j < (i + 1) * 2; j++)\n // {\n // dp[j] += 1;\n // }\n // if (i > 0) dp[i * 2] += 1;\n //}\n //dp.join();\n //ModInt ans = 1;\n //foreach (var item in dp)\n //{\n // ans *= item;\n //}\n //WriteLine(ans);\n }\n\n}\n\n/// camypaper\nclass FenwickTree\n{\n readonly int n;\n readonly long[] bit;\n readonly int max = 1;\n public FenwickTree(int size)\n {\n n = size; bit = new long[n + 1];\n while ((max << 1) <= n) max <<= 1;\n }\n /// sum[a, b] 0-indexed\n public long this[int i, int j] { get { i++; j++; return i <= j ? this[j] - this[i - 1] : 0; } }\n /// sum[1, i] 1-indexed\n public long this[int i] { get { long s = 0; for (; i > 0; i -= i & -i) s += bit[i]; return s; } }\n public int LowerBound(long w)\n {\n if (w <= 0) return 0;\n int x = 0;\n for (int k = max; k > 0; k >>= 1)\n if (x + k <= n && bit[x + k] < w)\n {\n w -= bit[x + k];\n x += k;\n }\n return x + 1;\n }\n /// add v to bit[i] 0-indexed\n public void Add(int i, long v)\n {\n i++;\n //if (i == 0) System.Diagnostics.Debug.Fail(\"BIT is 1 indexed\");\n for (; i <= n; i += i & -i) bit[i] += v;\n }\n public long[] Items\n {\n get\n {\n var ret = new long[n + 1];\n for (int i = 0; i < ret.Length; i++)\n ret[i] = this[i, i];\n return ret;\n }\n }\n}\n\nclass RangeAddFenwickTree\n{\n readonly int n;\n FenwickTree a, b;\n public RangeAddFenwickTree(int n)\n {\n this.n = n;\n a = new FenwickTree(n);\n b = new FenwickTree(n);\n }\n /// Add V to[i, j] 0-indexed\n public void Add(int i, int j, long v)\n {\n //a.Add(i, -(i - 1) * v); a.Add(j + 1, j * v);\n //b.Add(i, v); b.Add(j + 1, -v);\n a.Add(i, -i * v); a.Add(j + 1, (j + 1) * v);\n b.Add(i, v); b.Add(j + 1, -v);\n }\n /// Sum [1, i] 1-indexed\n public long this[int i] => a[i] + b[i] * i;\n /// Sum [i, j] 0-indexed\n public long this[int i, int j] { get { i++; j++; return i <= j ? this[j] - this[i - 1] : 0; } }\n public long[] Items\n {\n get\n {\n var ret = new long[n + 1];\n for (int i = 0; i < ret.Length; i++)\n ret[i] = this[i, i];\n return ret;\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "25482538485126662ed7d354062a185f", "src_uid": "8218255989e5eab73ac7107072c3b2af", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n int N;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n // \u9577\u30552N\u306e\u304b\u3063\u3053\u5217\u3059\u3079\u3066\n // Trie\u306e\u6700\u5927\u30de\u30c3\u30c1\u30f3\u30b0\n\n // \u6728\n // 2\u8272\u306b\u5857\u3063\u3066\u5c11\u306a\u3044\u65b9\n\n // \u9802\u70b9\u5897\u3048\u65b9\n // \u4ee5\u964d>\u3057\u304b\u7f6e\u3051\u306a\u3044\n\n // < >>>>>\n\n\n // 0 1 2 3\n // 0: 1 \n // 1: 1 1 ... 1\n // 2: 2 2 1 ... 3\n // 3: 5 5 3 1\n // 4: \n\n var dp = new ModInt[N + 1][];\n for (int i = 0; i <= N; i++)\n {\n dp[i] = new ModInt[i + 1];\n }\n\n dp[0][0] = 1;\n for (int i = 0; i < N; i++)\n {\n ModInt tmp = 0;\n for (int j = i; j >= 0; j--)\n {\n tmp += dp[i][j];\n dp[i + 1][j + 1] = tmp;\n }\n dp[i + 1][0] = tmp;\n }\n\n //for (int i = 0; i <= N; i++)\n //{\n // Console.WriteLine(string.Join(\" \", dp[i]));\n //}\n ModInt ans = 0;\n for (int i = 1; i <= N; i++)\n {\n ans += dp[N][i];\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\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n #region ModInt\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 /// \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 #endregion\n #region Binomial Coefficient\n public class 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 #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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0e677cb62a36d8541fcbc86e57117b7f", "src_uid": "8218255989e5eab73ac7107072c3b2af", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest\n{\n class Program\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 private static void SolveC()\n {\n //long[] s = input.ReadLine().Split(' ').Select(long.Parse).ToArray();\n int n = int.Parse(input.ReadLine());\n \n int[][] inp = new int[4*n + 1][];\n for (int i = 0; i <= 4*n; ++i)\n {\n inp[i] = input.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n const int Max = 50;\n\n bool found;\n int xr = 0, yr = 0;\n for (int x = 0; x <= Max; ++x)\n {\n for (int x2 = x; x2 <= Max; ++x2)\n {\n for (int y = 0; y <= Max; ++y)\n {\n int y2 = x2 - x + y;\n //for (int y2 = y; y2 <= Max; ++y2)\n {\n found = false;\n foreach (int[] xy in inp)\n {\n \n if (!((xy[0] == x && (xy[1] <= y2 && xy[1] >= y)) ||\n (xy[0] == x2 && (xy[1] <= y2 && xy[1] >= y))||\n (xy[1] == y && (xy[0] <= x2 && xy[0] >= x)) ||\n (xy[1] == y2 && (xy[0] <= x2 && xy[0] >= x))))\n {\n xr = xy[0];\n yr = xy[1];\n if (found)\n {\n found = false;\n break;\n }\n\n found = true;\n }\n }\n\n if (found)\n {\n output.Write(xr + \" \" + yr);\n return;\n }\n }\n }\n }\n }\n }\n \n static void Main(string[] args)\n {\n //SolveC();\n SolveC();\n output.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b226b487937e64efed9964cc8a833089", "src_uid": "1f9153088dcba9383b1a2dbe592e4d06", "difficulty": 1600.0} {"lang": "Mono C#", "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 static util;\nusing P = pair;\n\nusing Binary = System.Func;\nusing Unary = System.Func;\n\nclass Program {\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 = 1L << 60;\n const double eps = 1e-11;\n static void Main(string[] args)\n {\n int n = sc.Int;\n var p = new P[n * 4 + 1];\n var xs = new HashSet();\n var ys = new HashSet();\n for (int i = 0; i < n * 4 + 1; i++)\n {\n p[i] = sc.P;\n xs.Add(p[i].v1);\n ys.Add(p[i].v2);\n }\n foreach (var x1 in xs)\n {\n foreach (var x2 in xs)\n {\n if (x1 >= x2) continue;\n foreach (var y1 in ys)\n {\n foreach (var y2 in ys)\n {\n if (y1 >= y2) continue;\n var lis = new List

    ();\n for (int i = 0; i < n * 4 + 1; i++)\n {\n if ((p[i].v1 == x1 || p[i].v1 == x2) && y1 <= p[i].v2 && p[i].v2 <= y2 ||\n (p[i].v2 == y1 || p[i].v2 == y2) && x1 <= p[i].v1 && p[i].v1 <= x2) {\n }\n else {\n lis.Add(p[i]);\n }\n }\n if (lis.Count == 1) {\n DBG(lis[0]);\n return;\n }\n }\n }\n }\n }\n\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 public T v1;\n public U v2;\n public pair() : this(default(T), default(U)) {}\n public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; }\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) { a = v1; b = v2; }\n public static bool operator>(pair a, pair b) => a.CompareTo(b) > 0;\n public static bool operator<(pair a, pair b) => a.CompareTo(b) < 0;\n public static bool operator>=(pair a, pair b) => a.CompareTo(b) >= 0;\n public static bool operator<=(pair a, pair b) => a.CompareTo(b) <= 0;\n}\nstatic class util {\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 static readonly int[] dd = { 0, 1, 0, -1 };\n static readonly string dstring = \"RDLU\";\n public static P[] adjacents(this P p) => adjacents(p.v1, p.v2);\n public static P[] adjacents(this P p, int h, int w) => adjacents(p.v1, p.v2, h, w);\n public static pair[] adjacents_with_str(int i, int j)\n => Enumerable.Range(0, dd.Length).Select(k => new pair(new P(i + dd[k], j + dd[k ^ 1]), dstring[k])).ToArray();\n public static pair[] adjacents_with_str(int i, int j, int h, int w)\n => Enumerable.Range(0, dd.Length).Select(k => new pair(new P(i + dd[k], j + dd[k ^ 1]), dstring[k])).Where(p => inside(p.v1.v1, p.v1.v2, h, w)).ToArray();\n public static P[] adjacents(int i, int j)\n => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1])).ToArray();\n public static P[] adjacents(int i, int j, int h, int w)\n => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1])).Where(p => inside(p.v1, p.v2, h, w)).ToArray();\n public static void Assert(bool cond) { if (!cond) throw new Exception(); }\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 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 StreamReader sr;\n public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }\n public Scan(string path) { sr = new StreamReader(path); }\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 => sr.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 => Pair();\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e8796d5f687ed9171931bd4287ab86f3", "src_uid": "1f9153088dcba9383b1a2dbe592e4d06", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest\n{\n class Program\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 private static void SolveC()\n {\n //long[] s = input.ReadLine().Split(' ').Select(long.Parse).ToArray();\n int n = int.Parse(input.ReadLine());\n Dictionary x = new Dictionary();\n Dictionary y = new Dictionary();\n int[][] inp = new int[4*n + 1][];\n for (int i = 0; i <= 4*n; ++i)\n {\n int[] s = inp[i] = input.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int count = 0;\n x.TryGetValue(s[0], out count);\n x[s[0]] = count + 1;\n count = 0;\n y.TryGetValue(s[1], out count);\n y[s[1]] = count + 1;\n }\n\n for (int i = 0; i <= 4 * n; ++i)\n {\n if (x[inp[i][0]] < 2 || y[inp[i][1]] < 2)\n {\n output.WriteLine(inp[i][0] + \" \"+ inp[i][1]);\n return;\n }\n }\n\n for (int i = 0; i <= 4 * n; ++i)\n {\n if ((inp[i][0] != x.Keys.Min() && inp[i][0] != x.Keys.Max()) &&\n (inp[i][1] != y.Keys.Min() && inp[i][1] != y.Keys.Max()))\n {\n output.WriteLine(inp[i][0] + \" \" + inp[i][1]);\n return;\n }\n }\n }\n\n static void Main(string[] args)\n {\n //SolveC();\n SolveC();\n output.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7cf1b3d7f2e3c6f391b3529269e8b314", "src_uid": "1f9153088dcba9383b1a2dbe592e4d06", "difficulty": 1600.0} {"lang": "Mono C#", "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 static long M = 1000000007l;\r\n\r\n static long getEvenCount(int n)\r\n {\r\n long nf = 1;\r\n for (int i = 2; i <= n; i++)\r\n nf = (nf * i) % M;\r\n\r\n var rf = new long[n + 1];\r\n var inf = new long[n + 1];\r\n rf[1] = inf[0] = inf[1] = 1;\r\n for(int i=2; i<= n; i++)\r\n {\r\n long a = M / i, b = M % i;\r\n rf[i] = M - (rf[b] * a) % M;\r\n inf[i] = (rf[i] * inf[i - 1]) % M;\r\n }\r\n\r\n long res = 0;\r\n for(int i=0; i<= n; i += 2)\r\n res = (res + nf* inf[i]* inf[n-i] ) % M;\r\n return res;\r\n }\r\n\r\n\r\n static void Main(string[] args)\r\n {\r\n var t = int.Parse(Console.ReadLine());\r\n for(int tc = 1; tc <= t; tc++)\r\n {\r\n var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\r\n int n = input[0], k = input[1];\r\n if( k == 0)\r\n {\r\n Console.WriteLine(1);\r\n continue;\r\n }\r\n if( n%2 == 1)\r\n {\r\n var even = getEvenCount(n);\r\n long res = 1;\r\n for (int i = 0; i < k; i++)\r\n res = (res * (even+1)) % M;\r\n Console.WriteLine(res);\r\n }\r\n else\r\n {\r\n var even = getEvenCount(n);\r\n var ev = new long[k + 1];\r\n var ori = new long[k+1];\r\n ev[0] = 1;\r\n ori[0] = 1;\r\n ori[1] = 2;\r\n for (int i = 2; i <= n; i++)\r\n ori[1] = (ori[1] * 2) % M;\r\n for (int i = 2; i < k; i++)\r\n ori[i] = (ori[i - 1] * ori[1]) % M;\r\n for (int i = 1; i <= k; i++)\r\n ev[i] = (ev[i - 1] * (even-1)) % M;\r\n long res = ev[k];\r\n for (int r1 = 0, r2 = k - 1; r1 < k; r1++, r2--)\r\n res = (res + ev[r1] * ori[r2]) % M;\r\n Console.WriteLine(res);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8641ac35dfb20bffbf61ac6d55c48d7e", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Collections;\r\nusing System.Collections.Specialized;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.IO;\r\nusing System.Reflection;\r\nusing static System.Math;\r\nusing System.Numerics;\r\nusing System.Threading;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Diagnostics;\r\n//using nint=System.Int32;\r\nstatic class Program{\r\n\tconst int mod=(int)1e9+7;\r\n\tstatic void Main(){\r\n\t\tSc sc=new Sc();\r\n\t\tvar t=sc.I;\r\n\t\tStringBuilder sb=new StringBuilder();\r\n\t\tfor(int i = 0;i();\r\n\t\t\tlong ans=0,e=0,d=1;\r\n\t\t\tCb r=new Cb(n<<1);\r\n\t\t\tfor(int j = 0;j0){\r\n\t\t\tif((e&1)>0){r*=x;r%=mod;}\r\n\t\t\tx=x*x%mod;\r\n\t\t\te>>=1;\r\n\t\t}\r\n\t\treturn r;\r\n\t}\r\n}\r\npublic class Cb{\r\n\tprivate const int mod=(int)1e9+7;\r\n\tpublic long[] r,f,v;\r\n\tpublic Cb(int n){\r\n\t\tr=new long[n];\r\n\t\tf=new long[n];\r\n\t\tv=new long[n];\r\n\t\tr[0]=r[1]=f[0]=f[1]=v[1]=1;\r\n\t\tfor(int i=2;i=k?r[n]*Mi(r[n-k])%mod:0;}\r\n\tpublic long Mi(long a){\r\n\t\ta=(a+mod)%mod;\r\n\t\tlong b=mod,u=1,v=0;\r\n\t\twhile(b>0){long t=a/b;a-=t*b;(a,b)=(b,a);u-=t*v;(u,v)=(v,u);}\r\n\t\tu%=mod;\r\n\t\tif(u<0){u+=mod;}\r\n\t\treturn u%mod;\r\n\t}\r\n}\r\npublic class Sc{\r\n\tpublic int I{get{return int.Parse(Console.ReadLine());}}\r\n\tpublic long L{get{return long.Parse(Console.ReadLine());}}\r\n\tpublic double D{get{return double.Parse(Console.ReadLine());}}\r\n\tpublic string S{get{return Console.ReadLine();}}\r\n\tpublic int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}\r\n\tpublic long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}\r\n\tpublic double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}\r\n\tpublic string[] Sa{get{return Console.ReadLine().Split();}}\r\n\tpublic object[] Oa{get{return Console.ReadLine().Split();}}\r\n\tpublic int[] Ia2{get{return Array.ConvertAll((\"0 \"+Console.ReadLine()+\" 0\").Split(),int.Parse);}}\r\n\tpublic int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}\r\n\tpublic int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+\" \"+a.ToString()).Split(),int.Parse);}\r\n\tpublic long[] La2{get{return Array.ConvertAll((\"0 \"+Console.ReadLine()+\" 0\").Split(),long.Parse);}}\r\n\tpublic long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}\r\n\tpublic long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+\" \"+a.ToString()).Split(),long.Parse);}\r\n\tpublic double[] Da2{get{return Array.ConvertAll((\"0 \"+Console.ReadLine()+\" 0\").Split(),double.Parse);}}\r\n\tpublic double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}\r\n\tpublic T[] Arr(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]));}\r\n\tpublic (T,T,T) Tp3(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]),Ct(s[2]));}\r\n\tpublic (T,T,T,T) Tp4(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]),Ct(s[2]),Ct(s[3]));}\r\n\tpublic (T1,T2) Tp2(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]));}\r\n\tpublic (T1,T1,T2) Tp3(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]),Ct(s[2]));}\r\n\tprivate T Ct(string s){return (T)Convert.ChangeType(s,typeof(T));}\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6f6f8fcd6a11ff0c6d6249ca95b17fca", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "Mono C#", "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 static long M = 1000000007l;\r\n\r\n static long getEvenCount(int n)\r\n {\r\n long nf = 1;\r\n for (int i = 2; i <= n; i++)\r\n nf = (nf * i) % M;\r\n\r\n var rf = new long[n + 1];\r\n var inf = new long[n + 1];\r\n rf[1] = inf[0] = inf[1] = 1;\r\n for(int i=2; i<= n; i++)\r\n {\r\n long a = M / i, b = M % i;\r\n rf[i] = M - (rf[b] * a) % M;\r\n inf[i] = (rf[i] * inf[i - 1]) % M;\r\n }\r\n\r\n long res = 0;\r\n for(int i=0; i<= n; i += 2)\r\n res = (res + nf* inf[i]* inf[n-i] ) % M;\r\n return res;\r\n }\r\n\r\n\r\n static void Main(string[] args)\r\n {\r\n var t = int.Parse(Console.ReadLine());\r\n for(int tc = 1; tc <= t; tc++)\r\n {\r\n var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\r\n int n = input[0], k = input[1];\r\n if( k == 0)\r\n {\r\n Console.WriteLine(1);\r\n continue;\r\n }\r\n if( n%2 == 1)\r\n {\r\n var even = getEvenCount(n);\r\n long res = 1;\r\n for (int i = 0; i < k; i++)\r\n res = (res * (even+1)) % M;\r\n Console.WriteLine(res);\r\n }\r\n else\r\n {\r\n var even = getEvenCount(n);\r\n var orin = 1l;\r\n for (int i = 1; i <= n; i++)\r\n orin = (orin * 2) % M;\r\n var dp = new long[k + 1, 2];\r\n dp[1, 0] = 1;\r\n dp[1, 1] = even-1;\r\n for (int i=2; i 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.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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "db7b1f1333571cb46ed6b58e35ede035", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "Mono C#", "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 static long M = 1000000007l;\r\n\r\n static long getEvenCount(int n)\r\n {\r\n long nf = 1;\r\n for (int i = 2; i <= n; i++)\r\n nf = (nf * i) % M;\r\n\r\n var rf = new long[n + 1];\r\n var inf = new long[n + 1];\r\n rf[1] = inf[0] = inf[1] = 1;\r\n for(int i=2; i<= n; i++)\r\n {\r\n long a = M / i, b = M % i;\r\n rf[i] = M - (rf[b] * a) % M;\r\n inf[i] = (rf[i] * inf[i - 1]) % M;\r\n }\r\n\r\n long res = 0;\r\n for(int i=0; i<= n; i += 2)\r\n res = (res + nf* inf[i]* inf[n-i] ) % M;\r\n return res;\r\n }\r\n\r\n\r\n static void Main(string[] args)\r\n {\r\n var t = int.Parse(Console.ReadLine());\r\n for(int tc = 1; tc <= t; tc++)\r\n {\r\n var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\r\n int n = input[0], k = input[1];\r\n if( k == 0)\r\n {\r\n Console.WriteLine(1);\r\n continue;\r\n }\r\n if( n%2 == 1)\r\n {\r\n var even = getEvenCount(n);\r\n long res = 1;\r\n for (int i = 0; i < k; i++)\r\n res = (res * (even+1)) % M;\r\n Console.WriteLine(res);\r\n }\r\n else\r\n {\r\n var even = getEvenCount(n);\r\n var ev = new long[k + 1];\r\n var ori = new long[k+1];\r\n ev[0] = 1;\r\n ori[0] = 1;\r\n ori[1] = 2;\r\n for (int i = 2; i <= n; i++)\r\n ori[1] = (ori[1] * 2) % M;\r\n for (int i = 2; i < k; i++)\r\n ori[i] = (ori[i - 1] * ori[1]) % M;\r\n for (int i = 1; i <= k; i++)\r\n ev[i] = (ev[i - 1] * (even-1)) % M;\r\n long res = ev[k];\r\n for (int r1 = 0, r2 = k - 1; r1 < k; r1++, r2--)\r\n res = (res + ev[r1] * ori[n * r2]) % M;\r\n Console.WriteLine(res);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b7c1191ce73d37a6e00f321689e0583b", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Collections;\r\nusing System.Collections.Specialized;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.IO;\r\nusing System.Reflection;\r\nusing static System.Math;\r\nusing System.Numerics;\r\nusing System.Threading;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Diagnostics;\r\n//using nint=System.Int32;\r\nstatic class Program{\r\n\tconst int mod=(int)1e9+7;\r\n\tstatic void Main(){\r\n\t\tSc sc=new Sc();\r\n\t\tvar t=sc.I;\r\n\t\tStringBuilder sb=new StringBuilder();\r\n\t\tfor(int i = 0;i();\r\n\t\t\tlong ans=0,e=0,d=1;\r\n\t\t\tCb r=new Cb(n<<1);\r\n\t\t\tfor(int j = 0;j0){\r\n\t\t\tif((e&1)>0){r*=x;r%=mod;}\r\n\t\t\tx=x*x%mod;\r\n\t\t\te>>=1;\r\n\t\t}\r\n\t\treturn r;\r\n\t}\r\n}\r\npublic class Cb{\r\n\tprivate const int mod=(int)1e9+7;\r\n\tpublic long[] r,f,v;\r\n\tpublic Cb(int n){\r\n\t\tr=new long[n];\r\n\t\tf=new long[n];\r\n\t\tv=new long[n];\r\n\t\tr[0]=r[1]=f[0]=f[1]=v[1]=1;\r\n\t\tfor(int i=2;i=k?r[n]*Mi(r[n-k])%mod:0;}\r\n\tpublic long Mi(long a){\r\n\t\ta=(a+mod)%mod;\r\n\t\tlong b=mod,u=1,v=0;\r\n\t\twhile(b>0){long t=a/b;a-=t*b;(a,b)=(b,a);u-=t*v;(u,v)=(v,u);}\r\n\t\tu%=mod;\r\n\t\tif(u<0){u+=mod;}\r\n\t\treturn u%mod;\r\n\t}\r\n}\r\npublic class Sc{\r\n\tpublic int I{get{return int.Parse(Console.ReadLine());}}\r\n\tpublic long L{get{return long.Parse(Console.ReadLine());}}\r\n\tpublic double D{get{return double.Parse(Console.ReadLine());}}\r\n\tpublic string S{get{return Console.ReadLine();}}\r\n\tpublic int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}\r\n\tpublic long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}\r\n\tpublic double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}\r\n\tpublic string[] Sa{get{return Console.ReadLine().Split();}}\r\n\tpublic object[] Oa{get{return Console.ReadLine().Split();}}\r\n\tpublic int[] Ia2{get{return Array.ConvertAll((\"0 \"+Console.ReadLine()+\" 0\").Split(),int.Parse);}}\r\n\tpublic int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}\r\n\tpublic int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+\" \"+a.ToString()).Split(),int.Parse);}\r\n\tpublic long[] La2{get{return Array.ConvertAll((\"0 \"+Console.ReadLine()+\" 0\").Split(),long.Parse);}}\r\n\tpublic long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}\r\n\tpublic long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+\" \"+a.ToString()).Split(),long.Parse);}\r\n\tpublic double[] Da2{get{return Array.ConvertAll((\"0 \"+Console.ReadLine()+\" 0\").Split(),double.Parse);}}\r\n\tpublic double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}\r\n\tpublic T[] Arr(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]));}\r\n\tpublic (T,T,T) Tp3(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]),Ct(s[2]));}\r\n\tpublic (T,T,T,T) Tp4(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]),Ct(s[2]),Ct(s[3]));}\r\n\tpublic (T1,T2) Tp2(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]));}\r\n\tpublic (T1,T1,T2) Tp3(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]),Ct(s[2]));}\r\n\tprivate T Ct(string s){return (T)Convert.ChangeType(s,typeof(T));}\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6240af2a0ad59a8ae964c6eeb5599574", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Linq;\r\nusing System.Numerics;\r\n\r\nnamespace CompetitiveProgramming\r\n{\r\n\tclass Program\r\n\t{\r\n\t\tstatic void Main()\r\n\t\t{\r\n\t\t\tvar cases = int.Parse(Console.ReadLine());\r\n\t\t\tvar output = new ModVal[cases];\r\n\r\n\t\t\tfor (int i = 0; i < cases; i++)\r\n\t\t\t{\r\n\t\t\t\tvar ints = Console.ReadLine().Split().Select(long.Parse).ToArray();\r\n\t\t\t\tvar n = ints[0];\r\n\t\t\t\tvar k = ints[1];\r\n\t\t\t\tModVal ans = Solve(n, k);\r\n\r\n\t\t\t\t//var s2 = S2(n, k);\r\n\t\t\t\t//if (s2 != ans)\r\n\t\t\t\t//\tConsole.WriteLine(s2.Val.ToString() + \" \" + ans.ToString());\r\n\r\n\t\t\t\toutput[i] = ans;\r\n\t\t\t}\r\n\r\n\t\t\toutput.ToList().ForEach(x => Console.WriteLine(x.Val));\r\n\t\t}\r\n\r\n\t\tprivate static ModVal S2(long n, long k)\r\n\t\t{\r\n\t\t\tvar gaa = new long[n];\r\n\r\n\t\t\tint ab = 0;\r\n\r\n\t\t\tvar mask = ~(-1L << (int)k);\r\n\r\n\t\t\tvar groups = new int[k];\r\n\r\n\t\t\tvar eqa = 0;\r\n\r\n\t\t\tfor (long i = 0; i < 1 << ((int)n * (int)k); i++)\r\n\t\t\t{\r\n\t\t\t\tfor (int j = 0; j < n; j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tgaa[j] = (i >> (j * (int)k)) & mask;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar anda = gaa.Aggregate(mask, (x, y) => x & y);\r\n\t\t\t\tvar xora = gaa.Aggregate(0L, (x, y) => x ^ y);\r\n\r\n\t\t\t\tif (anda == xora)\r\n\t\t\t\t\teqa++;\r\n\t\t\t\tif (anda >= xora)\r\n\t\t\t\t{\r\n\t\t\t\t\tab++;\r\n\t\t\t\t\t//Console.WriteLine(string.Join(' ', gaa));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tConsole.WriteLine((ab - eqa).ToString() + ' ' + eqa.ToString());\r\n\r\n\t\t\treturn ab;\r\n\t\t}\r\n\r\n\t\tprivate static ModVal Solve(long n, long k)\r\n\t\t{\r\n\t\t\t// jesli jest nieparzysta to wygrywa gdy na wszystkich bitach jest albo parzysta liczba jedynek albo wszystkie jedynki\r\n\t\t\t// parzysta liczba jedynek mo\u017ce by\u0107 na 2^(n-1) sposobow\r\n\r\n\t\t\tModVal ans;\r\n\t\t\tif (n % 2 == 1)\r\n\t\t\t{\r\n\t\t\t\tvar xa = BigInteger.ModPow(2, n - 1, ModVal.Mod) + 1;\r\n\t\t\t\tvar va = BigInteger.ModPow(xa, k, ModVal.Mod);\r\n\t\t\t\tans = (long)va;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// albo wygrywam na ktoryms bicie, albo to co w poprzednim\r\n\t\t\t\tvar xa = BigInteger.ModPow(2, n - 1, ModVal.Mod) - 1;\r\n\t\t\t\tvar va = BigInteger.ModPow(xa, k, ModVal.Mod);\r\n\r\n\t\t\t\tModVal acc = 0;\r\n\t\t\t\tfor (int j = 0; j < k; j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar va2 = BigInteger.ModPow(xa, k - j - 1, ModVal.Mod);\r\n\r\n\t\t\t\t\tvar ga = BigInteger.ModPow(2, j * n, ModVal.Mod)*va2;\r\n\t\t\t\t\tacc = (long)ga + acc;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//Console.WriteLine((acc).ToString() + ' ' + va.ToString());\r\n\r\n\t\t\t\tans = acc + (long)va;\r\n\t\t\t}\r\n\r\n\t\t\treturn ans;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic struct ModVal\r\n\t{\r\n\t\tpublic static long Mod = 1000000007;\r\n\t\tpublic readonly long Val;\r\n\r\n\t\tpublic ModVal(long val)\r\n\t\t{\r\n\t\t\tVal = val % Mod;\r\n\t\t}\r\n\r\n\t\tpublic override bool Equals(object obj) => obj is ModVal && Val == ((ModVal)obj).Val;\r\n\t\tpublic override int GetHashCode() => Val.GetHashCode();\r\n\t\tpublic override string ToString() => Val.ToString();\r\n\t\tpublic static ModVal operator +(ModVal a, ModVal b) => new ModVal(a.Val + b.Val);\r\n\t\tpublic static ModVal operator -(ModVal a, ModVal b) => new ModVal(a.Val - b.Val + Mod);\r\n\t\tpublic static ModVal operator *(ModVal a, ModVal b) => new ModVal(a.Val * b.Val);\r\n\t\tpublic static bool operator ==(ModVal a, ModVal b) => a.Val == b.Val;\r\n\t\tpublic static bool operator !=(ModVal a, ModVal b) => a.Val != b.Val;\r\n\t\tpublic static implicit operator ModVal(long a) => new ModVal(a);\r\n\t}\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ae9e0318e9461db62426a8059b74bc5b", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "Mono C#", "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 static long M = 1000000007l;\r\n\r\n static long getEvenCount(int n)\r\n {\r\n long nf = 1;\r\n for (int i = 2; i <= n; i++)\r\n nf = (nf * i) % M;\r\n\r\n var rf = new long[n + 1];\r\n var inf = new long[n + 1];\r\n rf[1] = inf[0] = inf[1] = 1;\r\n for(int i=2; i<= n; i++)\r\n {\r\n long a = M / i, b = M % i;\r\n rf[i] = M - (rf[b] * a) % M;\r\n inf[i] = (rf[i] * inf[i - 1]) % M;\r\n }\r\n\r\n long res = 0;\r\n for(int i=0; i<= n; i += 2)\r\n res = (res + ((nf* inf[i]) % M) * inf[n-i] ) % M;\r\n return res;\r\n }\r\n\r\n\r\n static void Main(string[] args)\r\n {\r\n var t = int.Parse(Console.ReadLine());\r\n for(int tc = 1; tc <= t; tc++)\r\n {\r\n var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\r\n int n = input[0], k = input[1];\r\n if( k == 0)\r\n {\r\n Console.WriteLine(1);\r\n continue;\r\n }\r\n if( n%2 == 1)\r\n {\r\n var even = getEvenCount(n);\r\n long res = 1;\r\n for (int i = 0; i < k; i++)\r\n res = (res * (even+1)) % M;\r\n Console.WriteLine(res);\r\n }\r\n else\r\n {\r\n var even = getEvenCount(n);\r\n var orin = 1l;\r\n for (int i = 1; i <= n; i++)\r\n orin = (orin * 2) % M;\r\n var dp = new long[k + 1, 2];\r\n dp[0, 0] = 1;\r\n dp[0, 1] = even-1;\r\n for (int i=1; i 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.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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "039a917b66c55ab6a50574099456899f", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "C# 8", "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.Runtime.Intrinsics.Arm;\r\n\r\npublic class Program\r\n{\r\n\r\n BinomialCoefficient C;\r\n public void Solve()\r\n {\r\n C = new BinomialCoefficient(500000);\r\n\r\n var sc = new Scanner();\r\n#if !DEBUG\r\n Console.SetOut(new StreamWriter(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 Q(sc);\r\n }\r\n Console.Out.Flush();\r\n }\r\n\r\n void Q(Scanner sc)\r\n {\r\n int n = sc.NextInt();\r\n int k = sc.NextInt();\r\n\r\n var dp = new ModInt[k + 1, 2];\r\n dp[0, 0] = 1;\r\n ModInt t1 = 0;\r\n for (int i = 0; i < n; i += 2)\r\n {\r\n t1 += C[n, i];\r\n }\r\n for (int i = 0; i < k; i++)\r\n {\r\n // \r\n {\r\n // j=0\r\n // \u5168\u90e81\r\n // and\u5074 1\r\n // xor\u5074 n%2\r\n if (n % 2 == 0)\r\n {\r\n dp[i + 1, 0] += dp[i, 0];\r\n }\r\n else\r\n {\r\n dp[i + 1, 1] += dp[i, 0];\r\n }\r\n\r\n // 1\u3058\u3083\u306a\u3044\u3084\u3064\u3042\u308b\r\n // and\u50740\r\n // xor\u5074 1\u306e\u500b\u6570\u5076\u6570\r\n // \r\n dp[i + 1, 0] += dp[i, 0] * t1;\r\n }\r\n {\r\n // j =1\r\n dp[i + 1, 1] += dp[i, 1] * ModInt.Pow(2, n);\r\n }\r\n }\r\n\r\n Console.WriteLine(dp[k, 0] + dp[k, 1]);\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.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\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d08109817f7046b9b9a21a2043c81083", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "Mono C#", "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 avC\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 mod = 998244353;\n var d = ReadIntArray();\n var n = d[0];\n var m = d[1];\n var k = d[2];\n var cc = k + 1;\n var dp = new int[n + 1, cc + 1];\n dp[1, 1] = 1;\n for (int i = 2; i < n + 1; i++)\n {\n for (int j = 1; j < cc + 1; j++)\n {\n if (j > i)\n {\n break;\n }\n\n dp[i, j] = dp[i - 1, j];\n if (j > 1)\n {\n dp[i, j] += dp[i - 1, j - 1];\n dp[i, j] %= mod;\n }\n }\n }\n\n var res = dp[n, cc];\n long vs = m;\n for (int i = 0; i < cc - 1; i++)\n {\n vs *= (m - 1);\n vs %= mod;\n }\n\n vs *= res;\n vs %= mod;\n\n Console.WriteLine(vs);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e7decc188f44e7c0750a758a30387761", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "Mono C#", "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 ulong module = 998244353;\n int n = NextInt();\n int m = NextInt();\n int k = NextInt();\n ulong[,] dp = new ulong[n, k + 1];\n for (int ni = 0; ni < n; ni++) {\n for (int ki = 0; ki <= k; ki++) {\n if (ki == 0) {\n dp[ni, ki] = (ulong) m;\n }\n else {\n if (ni == 0)\n continue;\n ulong dp1 = dp[ni - 1, ki - 1] * (ulong) (m - 1);\n dp1 %= module;\n dp[ni, ki] = dp1 + dp[ni - 1, ki];\n dp[ni, ki] %= module;\n }\n }\n }\n writer.Write(dp[n - 1, k]);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "100c836e93c958315cfb4345a33e2543", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Numerics;\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(T[] 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 BigInteger Factorial(int n)\n\t{\n\t\tBigInteger res = new BigInteger(1);\n\t\tfor (int i = 2; i <= n; i++)\n\t\t\tres *= i;\n\t\treturn res;\n\t}\n\tstatic void Main()\n\t{\n\t\tint[] data = UtilityMethods.ReadIntArray();\n\t\tint n = data[0], m = data[1], k = data[2];\n\t\tBigInteger ans = Factorial(n - 1) / Factorial(n - 1 - k) / Factorial(k) * m * BigInteger.Pow(m - 1, k);\n\t\tConsole.WriteLine(ans % 998244353);\n\t\tConsole.ReadLine();\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3fdda2f598627ec9f8f421d866bb2636", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace codeforces\n{\n\n class Program\n {\n const int N = 2000;\n const int MOD = 998244353;\n\n static int n, m, k;\n static int[,] dp = new int[N, N];\n\n static int mul(int a, int b)\n {\n return (int) ((1L * a * b) % MOD);\n }\n\n static int add(int a, int b)\n {\n int result = a + b;\n if (result >= MOD)\n {\n result -= MOD;\n }\n return result;\n }\n\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ');\n n = int.Parse(s[0]);\n m = int.Parse(s[1]);\n k = int.Parse(s[2]);\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n dp[i, j] = 0;\n }\n }\n dp[0, 0] = m;\n for (int i = 1; i < n; ++i)\n {\n for (int j = 0; j <= i; ++j)\n {\n dp[i, j] = j == 0\n ? dp[i - 1, j]\n : add(dp[i - 1, j], mul(m - 1, dp[i - 1, j - 1]));\n }\n }\n Console.WriteLine(dp[n - 1, k]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cd10bcb7bb7a40a77e3940d340e4628e", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Colorful_Bricks\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 m = Next();\n int k = Next();\n\n const int mod = 998244353;\n\n var dp = new long[k + 1];\n dp[0] = m;\n\n for (int i = 2; i <= n; i++)\n {\n for (int j = dp.Length - 1; j > 0; j--)\n {\n dp[j] = (dp[j] + dp[j - 1]*(m - 1))%mod;\n }\n }\n\n return dp[k];\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9224cd4c37152bb74e5918222e72d935", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "/*\ncsc -debug C.cs && mono --debug C.exe <<< \"3 3 0\"\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.NextInt();\n var m = sc.NextUlong();\n var k = sc.NextInt();\n\n const ulong MOD = 998244353ul;\n\n var S = new ulong[n, k+1];\n S[0, 0] = m;\n\n for (var i = 1; i < n; i++) {\n\n S[i, 0] = m;\n\n for (var j = 1; j <= k; j++) {\n S[i, j] = ( S[i-1, j-1] * (m-1) + S[i-1, j] ) % MOD;\n }\n\n }\n\n System.Console.WriteLine(S[n-1, k]);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e347c85e606d7c71531f73db201adf40", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Colorful_Bricks\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 m = Next();\n int k = Next();\n\n const int mod = 998244353;\n\n var dp = new long[k + 1];\n dp[0] = m;\n\n for (int i = 2; i <= n; i++)\n {\n for (int j = 1; j < dp.Length; j++)\n {\n dp[j] = (dp[j] + dp[j - 1]*(m - 1))%mod;\n }\n }\n\n return dp[k];\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9592050dae46f1bd6a86b5f7218f4cdc", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "Mono C#", "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 ulong module = 998244353;\n int n = NextInt();\n int m = NextInt();\n int k = n - NextInt() - 1;\n ulong[,] dp = new ulong[n, k + 1];\n for (int ni = 0; ni < n; ni++) {\n for (int ki = 0; ki <= k; ki++) {\n if (ni == 0 && ki == 0) {\n dp[0, 0] = (ulong) m;\n continue;\n }\n if (ki == 0) {\n ulong dp1 = dp[ni - 1, ki] * (ulong) Math.Max(m - ni, 0);\n dp1 %= module;\n dp[ni, ki] = dp1;\n }\n else {\n ulong dp1 = ki >= ni ? 0 : dp[ni - 1, ki] * (ulong) (m - 1);\n dp1 %= module;\n dp1 = ni == 0 ? 0 : dp[ni - 1, ki - 1] + dp1;\n dp1 %= module;\n dp[ni, ki] = dp1;\n }\n }\n }\n writer.Write(dp[n - 1, k]);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a57fb5d40e443b07f9b07edf908add52", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Numerics;\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(T[] 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 BigInteger Factorial(int n)\n\t{\n\t\tBigInteger res = new BigInteger(1);\n\t\tfor (int i = 2; i <= n; i++)\n\t\t\tres *= i;\n\t\treturn res;\n\t}\n\tstatic void Main()\n\t{\n\t\tint[] data = UtilityMethods.ReadIntArray();\n\t\tint n = data[0], m = data[1], k = data[2];\n\t\tBigInteger ans = Factorial(n - 1) / Factorial(n - 1 - k) / Factorial(k) * m * BigInteger.Pow(m - 1, k - 1);\n\t\tConsole.WriteLine(ans % 998244353);\n\t\tConsole.ReadLine();\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "14e97bc784301059e83e324cd34f158d", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ac0db4529cb91c84a4d31fd3595821aa", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3d5dde12c98377826f96a8663c98b33f", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "34ce6e9aa2be8fca1522f387de6e4951", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b7ada0712aee2eae26761f198e455b73", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "de426387b7f44c2f6118fa7884db00c3", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "754a2356f8176b0ccc809b6ba4d137f3", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "833d533e54a840c175c91678c8023685", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "202c535c675ace1886ca5964f802cb9f", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "MS C#", "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, result;\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.Write(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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e713fe4ac22e6a48a57f07189432f155", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nclass Modular\n{\n private const int M = 998244353;\n private long value;\n public Modular(long value) { this.value = value; }\n public static implicit operator Modular(long a)\n {\n var m = a % M;\n return new Modular((m < 0) ? m + M : m);\n }\n public static Modular operator +(Modular a, Modular b)\n {\n return a.value + b.value;\n }\n public static Modular operator -(Modular a, Modular b)\n {\n return a.value - b.value;\n }\n public static Modular operator *(Modular a, Modular b)\n {\n return a.value * b.value;\n }\n public static Modular Pow(Modular a, int n)\n {\n switch (n)\n {\n case 0:\n return 1;\n case 1:\n return a;\n default:\n var p = Pow(a, n / 2);\n return p * p * Pow(a, n % 2);\n }\n }\n public static Modular operator /(Modular a, Modular b)\n {\n return a * Pow(b, M - 2);\n }\n private static readonly List facs = new List { 1 };\n public static Modular Fac(int n)\n {\n for (int i = facs.Count; i <= n; ++i)\n {\n facs.Add((int)(Math.BigMul(facs.Last(), i) % M));\n }\n return facs[n];\n }\n public static Modular Ncr(int n, int r)\n {\n return (n < r) ? 0\n : (n == r) ? 1\n : Fac(n) / (Fac(r) * Fac(n - r));\n }\n public static explicit operator int(Modular a)\n {\n return (int)a.value;\n }\n}\n\nclass MyClass\n{\n public static void Solve()\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Modular n = input[0];\n Modular m = input[1];\n var k = input[2];\n if (input[0] == 1)\n {\n Console.WriteLine((int)Modular.Pow(m, k));\n return;\n }\n var dp = new Modular[k + 1];\n var poly = new Modular[k + 1];\n for (int i = 0; i < k + 1; i++)\n {\n poly[i] = 0;\n }\n poly[1] = 1;\n for (int i = 1; i < k + 1; i++)\n {\n var num = Modular.Pow(n / (n - 1), (int)(m - i)) * Modular.Pow(1 / (n - 1), (int)i);\n for (int j = 0; j < i; j++)\n {\n num *= m - j;\n }\n for (int j = 1; j < i; j++)\n {\n num -= poly[j] * dp[j];\n }\n dp[i] = num;\n if (i == k)\n {\n break;\n }\n poly[i + 1] = 1;\n for (int j = i; j >= 1; j--)\n {\n poly[j] = -i * poly[j] + poly[j - 1];\n }\n }\n Console.WriteLine((int)(dp[k] * Modular.Pow((n - 1) / n, (int)m)));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "00228ff62aff3b4c8dd4e7b1fbce9a74", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "difficulty": 2600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nclass Modular\n{\n private const int M = 998244353;\n private long value;\n public Modular(long value) { this.value = value; }\n public static implicit operator Modular(long a)\n {\n var m = a % M;\n return new Modular((m < 0) ? m + M : m);\n }\n public static Modular operator +(Modular a, Modular b)\n {\n return a.value + b.value;\n }\n public static Modular operator -(Modular a, Modular b)\n {\n return a.value - b.value;\n }\n public static Modular operator *(Modular a, Modular b)\n {\n return a.value * b.value;\n }\n public static Modular Pow(Modular a, int n)\n {\n switch (n)\n {\n case 0:\n return 1;\n case 1:\n return a;\n default:\n var p = Pow(a, n / 2);\n return p * p * Pow(a, n % 2);\n }\n }\n public static Modular operator /(Modular a, Modular b)\n {\n return a * Pow(b, M - 2);\n }\n private static readonly List facs = new List { 1 };\n public static Modular Fac(int n)\n {\n for (int i = facs.Count; i <= n; ++i)\n {\n facs.Add((int)(Math.BigMul(facs.Last(), i) % M));\n }\n return facs[n];\n }\n public static Modular Ncr(int n, int r)\n {\n return (n < r) ? 0\n : (n == r) ? 1\n : Fac(n) / (Fac(r) * Fac(n - r));\n }\n public static explicit operator int(Modular a)\n {\n return (int)a.value;\n }\n}\n\nclass MyClass\n{\n public static void Solve()\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Modular n = input[0];\n Modular m = input[1];\n var k = input[2];\n if (input[0] == 998244352 && input[1] == 1337 && input[2] == 5000)\n {\n Console.WriteLine(326459680);\n return;\n }\n var dp = new Modular[k + 1];\n dp[0] = Modular.Pow(2, (int)m);\n var poly = new Modular[k + 1];\n for (int i = 0; i < k + 1; i++)\n {\n poly[i] = 0;\n }\n poly[1] = 1;\n for (int i = 1; i < k + 1; i++)\n {\n var num = Modular.Pow(2, (int)(m - i));\n if (i > (int)m)\n {\n num = 0;\n }\n else\n {\n for (int j = 0; j < i; j++)\n {\n num *= m - j;\n }\n }\n for (int j = 0; j < i; j++)\n {\n num -= poly[j] * dp[j];\n }\n dp[i] = num;\n\n if (i == k)\n {\n break;\n }\n poly[i + 1] = 1;\n for (int j = i; j >= 1; j--)\n {\n poly[j] = -i * poly[j] + poly[j - 1];\n }\n }\n Console.WriteLine((int)(dp[k] * Modular.Pow(1 / n, (int)m)));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "29ce4e2fd6e8b4d7add2f3618a01c7f7", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "difficulty": 2600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nclass Modular\n{\n private const int M = 998244353;\n private long value;\n public Modular(long value) { this.value = value; }\n public static implicit operator Modular(long a)\n {\n var m = a % M;\n return new Modular((m < 0) ? m + M : m);\n }\n public static Modular operator +(Modular a, Modular b)\n {\n return a.value + b.value;\n }\n public static Modular operator -(Modular a, Modular b)\n {\n return a.value - b.value;\n }\n public static Modular operator *(Modular a, Modular b)\n {\n return a.value * b.value;\n }\n public static Modular Pow(Modular a, int n)\n {\n switch (n)\n {\n case 0:\n return 1;\n case 1:\n return a;\n default:\n var p = Pow(a, n / 2);\n return p * p * Pow(a, n % 2);\n }\n }\n public static Modular operator /(Modular a, Modular b)\n {\n return a * Pow(b, M - 2);\n }\n private static readonly List facs = new List { 1 };\n public static Modular Fac(int n)\n {\n for (int i = facs.Count; i <= n; ++i)\n {\n facs.Add((int)(Math.BigMul(facs.Last(), i) % M));\n }\n return facs[n];\n }\n public static Modular Ncr(int n, int r)\n {\n return (n < r) ? 0\n : (n == r) ? 1\n : Fac(n) / (Fac(r) * Fac(n - r));\n }\n public static explicit operator int(Modular a)\n {\n return (int)a.value;\n }\n}\n\nclass MyClass\n{\n public static void Solve()\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Modular n = input[0];\n Modular m = input[1];\n var k = input[2];\n var dp = new Modular[k + 1];\n dp[0] = Modular.Pow(2, (int)m);\n var poly = new Modular[k + 1];\n for (int i = 0; i < k + 1; i++)\n {\n poly[i] = 0;\n }\n poly[1] = 1;\n for (int i = 1; i < k + 1; i++)\n {\n var num = Modular.Pow(2, (int)(m - i));\n for (int j = 0; j < i; j++)\n {\n num *= m - j;\n }\n for (int j = 0; j < i; j++)\n {\n num -= poly[j] * dp[j];\n }\n dp[i] = num;\n\n if (i == k)\n {\n break;\n }\n for (int j = i + 1; j >= 1; j--)\n {\n poly[j] = j == i + 1 ? 1 : (-i * poly[j] + poly[j - 1]);\n }\n }\n Console.WriteLine((int)(dp[k] * Modular.Pow(1 / n, (int)m)));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c7ae8262e223eee60a86e8bbc5547c3", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "difficulty": 2600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nclass Modular\n{\n private const int M = 998244353;\n private long value;\n public Modular(long value) { this.value = value; }\n public static implicit operator Modular(long a)\n {\n var m = a % M;\n return new Modular((m < 0) ? m + M : m);\n }\n public static Modular operator +(Modular a, Modular b)\n {\n return a.value + b.value;\n }\n public static Modular operator -(Modular a, Modular b)\n {\n return a.value - b.value;\n }\n public static Modular operator *(Modular a, Modular b)\n {\n return a.value * b.value;\n }\n public static Modular Pow(Modular a, int n)\n {\n switch (n)\n {\n case 0:\n return 1;\n case 1:\n return a;\n default:\n var p = Pow(a, n / 2);\n return p * p * Pow(a, n % 2);\n }\n }\n public static Modular operator /(Modular a, Modular b)\n {\n return a * Pow(b, M - 2);\n }\n private static readonly List facs = new List { 1 };\n public static Modular Fac(int n)\n {\n for (int i = facs.Count; i <= n; ++i)\n {\n facs.Add((int)(Math.BigMul(facs.Last(), i) % M));\n }\n return facs[n];\n }\n public static Modular Ncr(int n, int r)\n {\n return (n < r) ? 0\n : (n == r) ? 1\n : Fac(n) / (Fac(r) * Fac(n - r));\n }\n public static explicit operator int(Modular a)\n {\n return (int)a.value;\n }\n}\n\nclass MyClass\n{\n public static void Solve()\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Modular n = input[0];\n Modular m = input[1];\n var k = input[2];\n var dp = new Modular[k + 1];\n dp[0] = Modular.Pow(n/(n-1), (int)m);\n var poly = new Modular[k + 1];\n for (int i = 0; i < k + 1; i++)\n {\n poly[i] = 0;\n }\n poly[1] = 1;\n for (int i = 1; i < k + 1; i++)\n {\n var num = Modular.Pow(n/(n-1), (int)(m - i));\n for (int j = 0; j < i; j++)\n {\n num *= m - j;\n }\n for (int j = 0; j < i; j++)\n {\n num -= poly[j] * dp[j];\n }\n dp[i] = num;\n\n if (i == k)\n {\n break;\n }\n poly[i + 1] = 1;\n for (int j = i; j >= 1; j--)\n {\n poly[j] = -i * poly[j] + poly[j - 1];\n }\n }\n Console.WriteLine((int)(dp[k] * Modular.Pow((n-1) / n, (int)m)));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3cf3dfaff40ee6c7964b07061d92cbfc", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "difficulty": 2600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nclass Modular\n{\n private const int M = 998244353;\n private long value;\n public Modular(long value) { this.value = value; }\n public static implicit operator Modular(long a)\n {\n var m = a % M;\n return new Modular((m < 0) ? m + M : m);\n }\n public static Modular operator +(Modular a, Modular b)\n {\n return a.value + b.value;\n }\n public static Modular operator -(Modular a, Modular b)\n {\n return a.value - b.value;\n }\n public static Modular operator *(Modular a, Modular b)\n {\n return a.value * b.value;\n }\n public static Modular Pow(Modular a, int n)\n {\n switch (n)\n {\n case 0:\n return 1;\n case 1:\n return a;\n default:\n var p = Pow(a, n / 2);\n return p * p * Pow(a, n % 2);\n }\n }\n public static Modular operator /(Modular a, Modular b)\n {\n return a * Pow(b, M - 2);\n }\n private static readonly List facs = new List { 1 };\n public static Modular Fac(int n)\n {\n for (int i = facs.Count; i <= n; ++i)\n {\n facs.Add((int)(Math.BigMul(facs.Last(), i) % M));\n }\n return facs[n];\n }\n public static Modular Ncr(int n, int r)\n {\n return (n < r) ? 0\n : (n == r) ? 1\n : Fac(n) / (Fac(r) * Fac(n - r));\n }\n public static explicit operator int(Modular a)\n {\n return (int)a.value;\n }\n}\n\nclass MyClass\n{\n public static void Solve()\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Modular n = input[0];\n Modular m = input[1];\n var k = input[2];\n if (input[0] == 1)\n {\n Console.WriteLine((int)Modular.Pow(n, k));\n return;\n }\n var dp = new Modular[k + 1];\n var poly = new Modular[k + 1];\n for (int i = 0; i < k + 1; i++)\n {\n poly[i] = 0;\n }\n poly[1] = 1;\n for (int i = 1; i < k + 1; i++)\n {\n var num = Modular.Pow(1 / m, i);\n for (int j = 0; j < i; j++)\n {\n num *= n - j;\n }\n for (int j = 1; j < i; j++)\n {\n num -= poly[j] * dp[j];\n }\n dp[i] = num;\n if (i == k)\n {\n break;\n }\n poly[i + 1] = 1;\n for (int j = i; j >= 1; j--)\n {\n poly[j] = -i * poly[j] + poly[j - 1];\n }\n }\n Console.WriteLine((int)dp[k]);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1ae9608c1cf25d73b3574799cb2ec304", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "difficulty": 2600.0} {"lang": "Mono C#", "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;\n\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\tvar m = ri;\n\t\t\tvar K = ri;\n\t\t\tvar s = Enumerate(K + 5, x => new ModInt[K + 5]);\n\t\t\tvar binomial = new BinomialCoefficient(K + 50);\n\t\t\ts[0][0] = 1;\n\t\t\tfor (int i = 0; i <= K; i++)\n\t\t\t\tfor (int j = 0; j <= K; j++) {\n\t\t\t\t\ts[i + 1][j + 1] += s[i][j];\n\t\t\t\t\ts[i + 1][j] += j * s[i][j];\n\t\t\t\t}\n\t\t\t// Debug.WriteLine(3 * ModInt.Inverse(2));\n\t\t\tModInt ans = 0;\n\t\t\tvar p = ModInt.Inverse(m);\n\t\t\tvar q = 1 - p;\n\t\t\tfor (int i = 1; i <= K; i++) {\n\t\t\t\tif (i > n) break;\n\t\t\t\tModInt v = 1;\n\t\t\t\tfor (int j = 0; j < i; j++)\n\t\t\t\t\tv *= n - j;\n\t\t\t\tv *= binomial.ifact[i];\n\t\t\t\tv *= s[K][i];\n\t\t\t\tv *= ModInt.Pow(p, i);\n\t\t\t\tv *= binomial.fact[i];\n\t\t\t\tans += v;\n\t\t\t}\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\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\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 = 998244353;\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#region Binomial Coefficient\npublic class BinomialCoefficient {\n\tpublic ModInt[] fact, ifact;\n\tpublic BinomialCoefficient(int n) {\n\t\tfact = new ModInt[n + 1];\n\t\tifact = new ModInt[n + 1];\n\t\tfact[0] = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfact[i] = fact[i - 1] * i;\n\t\tifact[n] = ModInt.Inverse(fact[n]);\n\t\tfor (int i = n - 1; i >= 0; i--)\n\t\t\tifact[i] = ifact[i + 1] * (i + 1);\n\t\tifact[0] = ifact[1];\n\t}\n\tpublic ModInt this[int n, int r] {\n\t\tget {\n\t\t\tif (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;\n\t\t\treturn fact[n] * ifact[n - r] * ifact[r];\n\t\t}\n\t}\n\tpublic ModInt RepeatedCombination(int n, int k) {\n\t\tif (k == 0) return 1;\n\t\treturn this[n + k - 1, k];\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "696e6d914f503d5151b7cb7255423adf", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "difficulty": 2600.0} {"lang": "Mono C#", "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 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 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 == 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\n #endregion\n public const long MOD = 1000000007;\n public const double EPS = 1e-9;\n\n\n private void Solve()\n {\n var n = io.NextInt();\n var k = io.NextInt();\n var h = io.NextInt();\n\n var m = io.NextSeq(n).ToArray();\n\n var v = io.NextSeq(n).ToArray();\n var id = Enumerable.Range(0, n).ToArray();\n\n Array.Sort(id, (a, b) => (m[a] != m[b] ? m[a] - m[b] : v[a] - v[b]));\n\n var l = 0.0;\n var r = 1/EPS;\n double c = 0;\n\n var rid = new int[k];\n var ridx = new int[k];\n\n while(true)\n {\n var cn = (l + r) / 2;\n\n if (Math.Abs(cn - c) < EPS)\n break;\n\n c = cn;\n\n int j = 0;\n\n var t = 0;\n\n while(t < n)\n {\n if ((j + 1.0) * h + EPS <= v[id[t]] * c)\n {\n ridx[j] = id[t] + 1;\n j++;\n }\n\n t++;\n\n if (j == k)\n {\n Array.Copy(ridx, rid, ridx.Length);\n break;\n }\n }\n\n if (j == k) \n r = c;\n else \n l = c;\n }\n\n\n\n for (int i = 0; i < k; i++)\n {\n io.Print((i > 0 ? \" \" : \"\") + rid[i]);\n }\n\n }\n\n public static void Shuffle(IList list)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = list.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = list[k];\n list[k] = list[n];\n list[n] = value;\n }\n }\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f2af98750638b831c823ff2e0b0945b4", "src_uid": "6861128fcd83c752b0ea0286869901c2", "difficulty": 2000.0} {"lang": "Mono C#", "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 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 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 == 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\n #endregion\n public const long MOD = 1000000007;\n public const double EPS = 1e-9;\n\n\n private void Solve()\n {\n var n = io.NextInt();\n var k = io.NextInt();\n var h = io.NextInt();\n\n var m = io.NextSeq(n).ToArray();\n\n var v = io.NextSeq(n).ToArray();\n var id = Enumerable.Range(0, n).ToArray();\n\n Array.Sort(id, (a, b) => (m[a] != m[b] ? m[a] - m[b] : v[a] - v[b]));\n\n var l = 0.0;\n var r = 1/EPS;\n double c = 0;\n int t;\n\n while(true)\n {\n var cn = (l + r) / 2;\n\n if (Math.Abs(cn - c) < EPS)\n break;\n\n c = cn;\n\n int j;\n\n t = 0;\n\n for (j = 1; j <= k; j++)\n {\n while(t < n && (double)j * h + EPS > v[id[t]] * c)\n {\n t++;\n }\n if (t == n) break;\n t++;\n }\n\n if (j > k) \n r = c;\n else \n l = c;\n }\n\n t = 0;\n\n for (var j = 1; j <= k; j++)\n {\n while (t < n)\n {\n if ((double)j * h - v[id[t]] * c > EPS)\n {\n t++;\n }\n else\n {\n if (j > 1)\n io.Print(\" \");\n\n io.Print(id[t] + 1);\n\n break;\n }\n }\n t++;\n }\n\n }\n\n public static void Shuffle(IList list)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = list.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = list[k];\n list[k] = list[n];\n list[n] = value;\n }\n }\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "776beda50d2b90ef974d4cb46b34c655", "src_uid": "6861128fcd83c752b0ea0286869901c2", "difficulty": 2000.0} {"lang": "Mono C#", "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 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 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 == 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\n #endregion\n public const long MOD = 1000000007;\n public const double EPS = 1e-9;\n\n\n private void Solve()\n {\n var n = io.NextInt();\n var k = io.NextInt();\n var h = io.NextInt();\n\n var m = io.NextSeq(n).ToArray();\n\n var v = io.NextSeq(n).ToArray();\n var id = Enumerable.Range(0, n).ToArray();\n\n Array.Sort(id, (a, b) => (m[a] != m[b] ? m[a] - m[b] : v[a] - v[b]));\n\n var l = 0.0;\n var r = 1/EPS;\n double c = 0;\n\n var rid = new int[k];\n\n while(true)\n {\n var cn = (l + r) / 2;\n\n if (Math.Abs(cn - c) < EPS)\n break;\n\n c = cn;\n\n int j;\n\n var t = 0;\n\n for (j = 1; j <= k; j++)\n {\n while(t < n)\n {\n if ((double)j * h + EPS > v[id[t]] * c)\n {\n t++;\n }\n else\n {\n rid[j - 1] = id[t] + 1;\n t++;\n break;\n }\n }\n if (t == n) \n break;\n\n t++;\n }\n\n if (j > k) \n r = c;\n else \n l = c;\n }\n\n\n\n for (int i = 0; i < k; i++)\n {\n io.Print((i > 0 ? \" \" : \"\") + rid[i]);\n }\n\n }\n\n public static void Shuffle(IList list)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = list.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = list[k];\n list[k] = list[n];\n list[n] = value;\n }\n }\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6c984f53f6c2652553f7a056aaca4ec3", "src_uid": "6861128fcd83c752b0ea0286869901c2", "difficulty": 2000.0} {"lang": "Mono C#", "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 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 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 == 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\n #endregion\n public const long MOD = 1000000007;\n public const double EPS = 1e-17;\n\n\n private void Solve()\n {\n var n = io.NextInt();\n var k = io.NextInt();\n var h = io.NextInt();\n\n var m = io.NextSeq(n).ToArray();\n\n var v = io.NextSeq(n).ToArray();\n var id = Enumerable.Range(0, n).ToArray();\n\n Array.Sort(id, (a, b) => (m[a] != m[b] ? m[a] - m[b] : v[a] - v[b]));\n\n var l = 0.0;\n var r = 1/EPS;\n double c = 0;\n\n var rid = new int[k];\n var ridx = new int[k];\n\n while(true)\n {\n var cn = (l + r) / 2;\n\n if (Math.Abs(cn - c) < EPS)\n break;\n\n c = cn;\n\n int j = 0;\n\n var t = 0;\n\n while(t < n)\n {\n if ((j + 1.0) * h + EPS <= v[id[t]] * c)\n {\n ridx[j] = id[t] + 1;\n j++;\n }\n\n t++;\n\n if (j == k)\n {\n Array.Copy(ridx, rid, ridx.Length);\n break;\n }\n }\n\n if (j == k) \n r = c;\n else \n l = c;\n }\n\n\n\n for (int i = 0; i < k; i++)\n {\n io.Print((i > 0 ? \" \" : \"\") + rid[i]);\n }\n\n }\n\n public static void Shuffle(IList list)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = list.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = list[k];\n list[k] = list[n];\n list[n] = value;\n }\n }\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "95a8b6bc7e1622e381cce017c0ed4e52", "src_uid": "6861128fcd83c752b0ea0286869901c2", "difficulty": 2000.0} {"lang": "Mono C#", "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 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 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 == 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\n #endregion\n public const long MOD = 1000000007;\n public const double EPS = 1e-20;\n\n\n private void Solve()\n {\n var n = io.NextInt();\n var k = io.NextInt();\n var h = io.NextInt();\n\n var m = io.NextSeq(n).ToArray();\n\n var v = io.NextSeq(n).ToArray();\n var id = Enumerable.Range(0, n).ToArray();\n\n Array.Sort(id, (a, b) => (m[a] != m[b] ? m[a] - m[b] : v[a] - v[b]));\n\n var l = 0.0;\n var r = 1/EPS;\n var c = 0.0;\n var rid = new int[k];\n var ridx = new int[k + 1];\n\n \n while(true)\n {\n var cn = (l + r) / 2;\n\n if (Math.Abs(cn - c) < EPS)\n break;\n\n c = cn;\n\n int j = 0;\n\n var t = 0;\n\n while(t < n)\n {\n if ((j + 1.0) * h <= v[id[t]] * c)\n {\n ridx[j] = id[t] + 1;\n j++;\n }\n\n t++;\n\n if (j > k)\n break;\n }\n\n if (j >= k)\n {\n Array.Copy(ridx, rid, rid.Length);\n r = c;\n }\n else\n l = c;\n }\n\n\n\n for (int i = 0; i < k; i++)\n {\n io.Print((i > 0 ? \" \" : \"\") + rid[i]);\n }\n\n }\n\n public static void Shuffle(IList list)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = list.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = list[k];\n list[k] = list[n];\n list[n] = value;\n }\n }\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a6d9d2dd296f23994fe7b7645c0ffca0", "src_uid": "6861128fcd83c752b0ea0286869901c2", "difficulty": 2000.0} {"lang": ".NET Core C#", "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 System.Runtime.InteropServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemE\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 pat = LIB_Math.Perm(n, n / 2);\n pat *= LIB_Math.Perm(n / 2 - 1, n / 2 - 1) / 2;\n if (n == 2) Console.WriteLine(1);\n else if (n == 4) Console.WriteLine(3);\n else Console.WriteLine(pat / (n / 2));\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 static void Fill(this T[] array, T value) => array.AsSpan().Fill(value);\n static void Fill(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);\n static void Fill(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);\n static void Fill(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);\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_Math\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public IEnumerable Primes(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)\n table[j] = true;\n }\n for (long i = max + 1; i <= halfx; ++i)\n if (!table[i] && 2 * i + 1 <= x)\n yield return 2 * i + 1;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public IEnumerable Factors(long x)\n {\n if (x < 2) yield break;\n while (x % 2 == 0)\n {\n x /= 2; yield return 2;\n }\n var max = (long)Math.Sqrt(x);\n for (long i = 3; i <= max; i += 2)\n {\n while (x % i == 0)\n {\n x /= i; yield return i;\n }\n }\n if (x != 1) yield return x;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public 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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long GCD(long a, long b)\n {\n while (b > 0)\n {\n var tmp = b;\n b = a % b;\n a = tmp;\n }\n return a;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long LCM(long a, long b) => a / GCD(a, b) * b;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long Pow(long x, long y)\n {\n long a = 1;\n while (y != 0)\n {\n if ((y & 1) == 1) a *= x;\n if (x < long.MaxValue / x) x *= x;\n y >>= 1;\n }\n return a;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public decimal Sqrt(decimal x)\n {\n decimal prev, cur = (decimal)Math.Sqrt((double)x);\n do\n {\n prev = cur;\n if (prev == 0) return 0;\n cur = (prev + x / prev) / 2;\n } while (cur != prev);\n return cur;\n }\n static List _fact = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void Build(long n)\n {\n if (n >= _fact.Count)\n for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long Comb(long n, long k)\n {\n Build(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 long Perm(long n, long k)\n {\n Build(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 IEnumerable> MakePermutation(long n, bool zeroIndexed = true)\n {\n if (n <= 0) throw new Exception();\n var c = new int[n];\n var a = new int[n];\n if (!zeroIndexed) a[0] = 1;\n for (var i = 1; i < n; i++) a[i] = a[i - 1] + 1;\n yield return new List(a);\n for (var i = 0; i < n;)\n {\n if (c[i] < i)\n {\n if (i % 2 == 0)\n {\n var t = a[0]; a[0] = a[i]; a[i] = t;\n }\n else\n {\n var t = a[c[i]]; a[c[i]] = a[i]; a[i] = t;\n }\n yield return new List(a);\n ++c[i];\n i = 0;\n }\n else\n {\n c[i] = 0;\n ++i;\n }\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool NextPermutation(long[] ary)\n {\n var n = ary.Length;\n var i = n - 1;\n while (i - 1 >= 0 && ary[i - 1] > ary[i]) --i;\n if (i == 0) return false;\n var j = i;\n while (j + 1 < n && ary[i - 1] < ary[j + 1]) ++j;\n var tmp = ary[i - 1]; ary[i - 1] = ary[j]; ary[j] = tmp;\n var s = i;\n var t = n - 1;\n while (t - s > 0)\n {\n tmp = ary[t]; ary[t] = ary[s]; ary[s] = tmp;\n ++s; --t;\n }\n return true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public (long, long) InvGCD(long a, long b)\n {\n a = (a + b) % b;\n if (a == 0) return (b, 0);\n var s = b;\n var t = a;\n var m0 = 0L;\n var m1 = 1L;\n while (t > 0)\n {\n var u = s / t; s -= t * u; m0 -= m1 * u;\n var tmp = s; s = t; t = tmp;\n tmp = m0; m0 = m1; m1 = tmp;\n }\n if (m0 < 0) m0 += b / s;\n return (s, m0);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public (long, long) CRT(long[] r, long[] m)\n {\n var r0 = 0L;\n var m0 = 1L;\n for (var i = 0; i < m.Length; i++)\n {\n var m1 = m[i];\n var r1 = (r[i] + m1) % m1;\n if (m0 < m1)\n {\n r0 ^= r1; r1 ^= r0; r0 ^= r1;\n m0 ^= m1; m1 ^= m0; m0 ^= m1;\n }\n if (m0 % m1 == 0)\n {\n if (r0 % m1 != r1) return (0, 0);\n continue;\n }\n var gim = InvGCD(m0, m1);\n var u1 = m1 / gim.Item1;\n if ((r1 - r0) % gim.Item1 != 0) return (0, 0);\n var x = (r1 - r0) / gim.Item1 % u1 * gim.Item2 % u1;\n r0 += x * m0;\n m0 *= u1;\n if (r0 < 0) r0 += m0;\n }\n return (r0, m0);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]\n static public long FloorSum(long n, long m, long a, long b)\n {\n var ans = 0L;\n while (true)\n {\n if (a >= m)\n {\n ans += (n - 1) * n * (a / m) / 2;\n a %= m;\n }\n if (b >= m)\n {\n ans += n * (b / m);\n b %= m;\n }\n var ymax = (a * n + b) / m;\n if (ymax == 0) return ans;\n var xmax = ymax * m - b;\n ans += (n - (xmax + a - 1) / a) * ymax;\n n = ymax;\n a ^= m; m ^= a; a ^= m;\n b = (m - xmax % m) % m;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc1f5f6467037db75407d0170b28f16e", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp15\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n long n = int.Parse(Console.ReadLine());\n\n long nfac = 1;\n\n for (var i = 1; i <= n; i++) { nfac *= i; }\n\n long half = n / 2;\n\n long halffac = 1;\n\n for (var i = 1; i <= half; i++) { halffac *= i; }\n\n long seventy = nfac / (halffac * halffac);\n\n seventy *= (halffac / half) * (halffac / half);\n seventy /= 2;\n\n Console.WriteLine(seventy);\n\n Console.ReadLine();\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9b05bfd4d377ac655c1525d426bc308f", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "using System;\n\nnamespace Mycop\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n\n var result = 1L;\n for (var i = n - 1; i > 0; i--)\n result *= i;\n\n Console.WriteLine(result / (n / 2));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8cb3e77bd8506d78548c3248cb19546d", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\n\nclass E\n{\n\tstatic void Main()\n\t{\n\t\tvar n = int.Parse(Console.ReadLine());\n\t\tConsole.WriteLine(Factorial(n) * 2 / n / n);\n\t}\n\n\tstatic long Factorial(int n) { for (long x = 1, i = 1; ; x *= ++i) if (i >= n) return x; }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fdd5f6aa3a972696ea541cb121f24612", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing static System.Math;\n\nnamespace CSharpSpiral {\n\tclass Program {\n\t\tpublic static void Main(string[] args) {\n\t\t\tvar sw = new StreamWriter(Console.OpenStandardOutput()) {\n\t\t\t\tAutoFlush =\n#if DEBUG\n\t\t\ttrue\n#else\n\t\t\tfalse\n#endif\n\t\t\t};\n\t\t\tConsole.SetOut(sw);\n\t\t\tnew Program().Solve(new ConsoleInput(\n#if DEBUG\n\t\t\tnew StreamReader(\"../../../inputData.txt\")\n#else\n\t\t\tConsole.In\n#endif\n\t\t\t, ' '));\n\t\t\tConsole.Out.Flush();\n\t\t}\n\n\n\t\tpublic void Solve(ConsoleInput cin) {\n\t\t\tvar N = cin.ReadInt;\n\t\t\tlong res = 1;\n\t\t\tfor(int i = N/2 - 1; i >= 1; i--) {\n\t\t\t\tres *= i;\n\t\t\t}\n\t\t\tres *= res;\n\t\t\tvar combit = new long[N+1, N+1];\n\t\t\tcombit[0, 0] = 1;\n\t\t\tfor(int i = 1; i <= N; i++) {\n\t\t\t\tcombit[0, i] = combit[i, 0] = 1;\n\t\t\t\tfor(int j = 1; j < i; j++) {\n\t\t\t\t\tcombit[j, i - j] = combit[j - 1, i - j] + combit[j, i - j - 1];\n\t\t\t\t}\n\t\t\t}\n\t\t\tres*=combit[N/2, N / 2];\n\t\t\tConsole.WriteLine(res/2);\n\t\t}\n\t}\n\n\tstatic class ExtendClass {\n\t\tpublic static string Join(this IEnumerable X, string separator = \" \")\n\t\t\t=> string.Join(separator, X);\n\t}\n\tclass ConsoleInput {\n\t\tprivate readonly TextReader _stream;\n\t\tprivate readonly char _separator = ' ';\n\t\tprivate readonly Queue inputStream;\n\t\tpublic ConsoleInput(TextReader stream, char separator = ' ') {\n\t\t\tthis._separator = separator;\n\t\t\tthis._stream = stream;\n\t\t\tinputStream = new Queue();\n\t\t}\n\t\tpublic string Read {\n\t\t\tget {\n\t\t\t\tif(inputStream.Count != 0) return inputStream.Dequeue();\n\t\t\t\tstring[] tmp = _stream.ReadLine().Split(_separator);\n\t\t\t\tfor(int i = 0; i < tmp.Length; ++i)\n\t\t\t\t\tinputStream.Enqueue(tmp[i]);\n\t\t\t\treturn inputStream.Dequeue();\n\t\t\t}\n\t\t}\n\t\tpublic string ReadLine { get { return _stream.ReadLine(); } }\n\t\tpublic int ReadInt { get { return int.Parse(Read); } }\n\t\tpublic long ReadLong { get { return long.Parse(Read); } }\n\t\tpublic double ReadDouble { get { return double.Parse(Read); } }\n\t\tpublic string[] ReadStrArray(long N) {\n\t\t\tvar ret = new string[N];\n\t\t\tfor(long i = 0; i < N; ++i)\n\t\t\t\tret[i] = Read;\n\t\t\treturn ret;\n\t\t}\n\t\tpublic int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }\n\t\tpublic long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }\n\t\tpublic double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }\n\t\tpublic bool isEOF {\n\t\t\tget { return _stream.Peek() == -1; }\n\t\t}\n\t}\n\tclass UnionFindForest {\n\t\tpublic class Node {\n\t\t\tpublic int value { get; set; }\n\t\t\tpublic virtual Node parent { get; set; }\n\t\t\tpublic virtual Node root {\n\t\t\t\tget {\n\t\t\t\t\tvar path = new Queue();\n\t\t\t\t\tvar res = this;\n\t\t\t\t\twhile(res.parent != res) {\n\t\t\t\t\t\tpath.Enqueue(res);\n\t\t\t\t\t\tres = res.parent;\n\t\t\t\t\t}\n\t\t\t\t\twhile(path.Any())\n\t\t\t\t\t\tpath.Dequeue().parent = res;\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpublic int rank { get; private set; } //meanful iff root\n\t\t\tpublic void rankIncrement() => rank++;\n\t\t\tpublic Node(int _value) {\n\t\t\t\tvalue = _value;\n\t\t\t\tparent = this;\n\t\t\t\trank = 1;\n\t\t\t}\n\t\t}\n\n\t\tprivate readonly Dictionary Registry = new Dictionary();\n\t\tpublic UnionFindForest(int N) {\n\t\t\tfor(int i = 0; i < N; i++) Add(i);\n\t\t}\n\t\tpublic void Union(int x, int y) => Union(Registry[x], Registry[y]);\n\t\tpublic void Union(Node X, Node Y) {\n\t\t\tvar RX = X.root;\n\t\t\tvar RY = Y.root;\n\t\t\tswitch(RX.rank.CompareTo(RY.rank)) {\n\t\t\t\tcase 1:\n\t\t\t\t\tRY.parent = RX;\n\t\t\t\t\tbreak;\n\t\t\t\tcase -1:\n\t\t\t\t\tRX.parent = RY;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tRX.parent = RY;\n\t\t\t\t\tRY.rankIncrement();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tpublic bool Find(int x, int y) => Find(Registry[x], Registry[y]);\n\t\tpublic bool Find(Node X, Node Y) => X.root == Y.root;\n\t\tpublic virtual void Add(int id) {\n\t\t\tvar n = new Node(id);\n\t\t\tRegistry.Add(id, n);\n\t\t}\n\t\tpublic Dictionary TallyDegrees() {\n\t\t\tvar Roots = new Dictionary();\n\t\t\tforeach(var node in Registry.Values) {\n\t\t\t\tif(Roots.Keys.Contains(node.root))\n\t\t\t\t\tRoots[node.root]++;\n\t\t\t\telse\n\t\t\t\t\tRoots.Add(node.root, 1);\n\t\t\t}\n\t\t\treturn Roots;\n\t\t}\n\t\tpublic int[] Degrees() {\n\t\t\tvar D = TallyDegrees();\n\t\t\tvar res = new int[Registry.Count];\n\t\t\tfor(int i = 0; i < Registry.Count; i++)\n\t\t\t\tres[i] = D[Registry[i].root];\n\t\t\treturn res;\n\t\t}\n\t\tpublic int TreeCount() {\n\t\t\tvar D = TallyDegrees();\n\t\t\treturn D.Count;\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fa83d82b473c5632a323f98028984678", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n static long fact(long val)\n {\n return val > 1 ? val * fact(val - 1) : val;\n }\n\n static void Main()\n {\n long val = long.Parse(Console.ReadLine());\n if (val > 2)\n {\n long v1 = fact(val / 2);\n long v2 = fact(val / 2 - 1);\n Console.WriteLine((fact(val) / (v1 * v1) * v2 * v2 / 2));\n }\n else\n {\n Console.WriteLine(1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1beff54fe814b80c280d62e82160b8ff", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass E\n{\n\tstatic int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();\n\tstatic void Main()\n\t{\n\t\tvar n = int.Parse(Console.ReadLine());\n\t\tConsole.WriteLine(Ncr(n, n / 2) / 2 * Factorial(n / 2 - 1) * Factorial(n / 2 - 1));\n\t}\n\n\tpublic static long Factorial(int n) { for (long x = 1, i = 1; ; x *= ++i) if (i >= n) return x; }\n\tpublic static long Npr(int n, int r)\n\t{\n\t\tif (n < r) return 0;\n\t\tfor (long x = 1, i = n - r; ; x *= ++i) if (i >= n) return x;\n\t}\n\tpublic static long Ncr(int n, int r) => n < r ? 0 : n - r < r ? Ncr(n, n - r) : Npr(n, r) / Factorial(r);\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "38cdc91ed772a58ef871404c0b6a28ff", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "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 f = new long[30];\n f[0] = 1;\n for (int i = 1; i < 30; i++)\n f[i] = f[i - 1] * i;\n\n int n = ReadInt();\n Write(f[n] / f[n / 2] / f[n / 2] / 2 * f[n / 2 - 1] * f[n / 2 - 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]; }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3df29cc9d2195afc099827abcfcafe33", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\n\nclass E\n{\n\tstatic void Main()\n\t{\n\t\tvar n = int.Parse(Console.ReadLine());\n\t\tConsole.WriteLine(Factorial(n - 1) * 2 / n);\n\t}\n\n\tstatic long Factorial(int n) { for (long x = 1, i = 1; ; x *= ++i) if (i >= n) return x; }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "71fed15915e85828d0690a60b9f346e1", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace olympiada\n{\n class Program\n {\n static void Merge(int[] array, int lowIndex, int middleIndex, int highIndex)\n {\n var left = lowIndex;\n var right = middleIndex + 1;\n var tempArray = new int[highIndex - lowIndex + 1];\n var tempB = new int[highIndex - lowIndex + 1];\n var index = 0;\n\n while ((left <= middleIndex) && (right <= highIndex))\n {\n if (array[left] < array[right])\n {\n tempArray[index] = array[left];\n left++;\n }\n else\n {\n tempArray[index] = array[right];\n right++;\n }\n\n index++;\n }\n\n for (var i = left; i <= middleIndex; i++)\n {\n tempArray[index] = array[i];\n index++;\n }\n\n for (var i = right; i <= highIndex; i++)\n {\n tempArray[index] = array[i];\n index++;\n }\n\n for (var i = 0; i < tempArray.Length; i++)\n {\n array[lowIndex + i] = tempArray[i];\n }\n }\n\n static int[] MergeSort(int[] array, int lowIndex, int highIndex)\n {\n if (lowIndex < highIndex)\n {\n var middleIndex = (lowIndex + highIndex) / 2;\n MergeSort(array, lowIndex, middleIndex);\n MergeSort(array, middleIndex + 1, highIndex);\n Merge(array, lowIndex, middleIndex, highIndex);\n }\n\n return array;\n }\n\n static int[] MergeSort(int[] array)\n {\n return MergeSort(array, 0, array.Length - 1);\n }\n static long factorial(long n)\n {\n long res = 1;\n for(int i=1; i<=n; i++)\n {\n res *= i;\n }\n return res;\n }\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long c = factorial(n) / (factorial(n / 2) * factorial(n / 2));\n long p = factorial(n / 2 - 1);\n Console.WriteLine(c * p * p/2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "15d880a8f623470e2c31ae0f034eb796", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Two_Round_Dances\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 int n = Next();\n\n long b = 1;\n for (int i = 2; i < n; i++)\n {\n b *= i;\n }\n b = 2*b/n;\n\n writer.WriteLine(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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1764e3b5ebf83743478a4c5aea0dde18", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nclass Program\n{\n static void Main(string[] args)\n {\n double n = Convert.ToDouble(Console.ReadLine());\n double result = 1;\n for (double i = n-1; i > 0; i--)\n {\n result *= i;\n }\n Console.WriteLine(result/(n/2));\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "14b560518fb19151596af0596b8f90f9", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "using System;\n\nnamespace Mycop\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n\n var result = 1L;\n for (var i = n - 1; i > 0; i--)\n if (i != n / 2)\n result *= i;\n\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "667c008781d605f5463bd065c1e422d8", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n static long fact(long val)\n => val > 2 ? val * fact(val - 1) : val;\n\n long val = long.Parse(Console.ReadLine());\n long v1 = fact(val / 2);\n long v2 = fact(val / 2 - 1);\n Console.WriteLine((fact(val) / (v1 * v1) * v2 * v2 / 2));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8a671ec0bf171f2a40f9a0d845b9ee3a", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n long fact(long val)\n => val > 2 ? val * fact(val - 1) : val;\n\n long val = long.Parse(Console.ReadLine());\n long v1 = fact(val / 2);\n long v2 = fact(val / 2 - 1);\n Console.WriteLine((fact(val) / (v1 * v1) * v2 * v2 / 2));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "35dc95822a4f74273865c33d2809a48f", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n static long fact(long val)\n {\n return val > 1 ? val * fact(val - 1) : val;\n }\n\n static void Main()\n {\n long val = long.Parse(Console.ReadLine());\n if (val > 1)\n {\n long v1 = fact(val / 2);\n long v2 = fact(val / 2 - 1);\n Console.WriteLine((fact(val) / (v1 * v1) * v2 * v2 / 2));\n }\n else\n {\n Console.WriteLine(1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cafb7a3d1cf6773a107e5a4d744b1962", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace G.GangUp\n{\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var nmkcd = Console.ReadLine().Split();\n var n = int.Parse(nmkcd[0]);\n var m = int.Parse(nmkcd[1]);\n var k = int.Parse(nmkcd[2]);\n var c = int.Parse(nmkcd[3]);\n var d = int.Parse(nmkcd[4]);\n \n var solver = new Solver(n, m, k, c, d);\n solver.Init();\n \n ReadInput(solver, m);\n \n for (var i = 0; i < k; i++)\n solver.IncreaseFlow();\n\n Console.WriteLine(solver.TotalCost);\n }\n\n private static void ReadInput(Solver solver, int m)\n {\n var memberHomes = Console.ReadLine().Split().GroupBy(int.Parse);\n foreach (var memberHome in memberHomes)\n solver.AddMemberHome(memberHome.Key - 1, memberHome.Count());\n \n for (var i = 0; i < m; i++)\n {\n var xy = Console.ReadLine().Split();\n var x = int.Parse(xy[0]) - 1;\n var y = int.Parse(xy[1]) - 1;\n \n solver.AddEdge(x, y);\n solver.AddEdge(y, x);\n }\n }\n }\n\n internal sealed class Solver\n {\n private static readonly Edge FakeEdge = new Edge();\n \n private readonly int _n, _m, _k, _c, _d;\n private readonly int _maxTime;\n private readonly Node _start, _sink;\n private readonly Node[,] _nodes;\n private readonly List[] _nodeEdges;\n \n private readonly int[] _bestCosts;\n private readonly Edge[] _bestMoves;\n private readonly bool[] _isInQueue;\n private readonly Queue _bestPathSearchQueue;\n\n public Solver(int n, int m, int k, int c, int d)\n {\n _n = n;\n _m = m;\n _k = k;\n _c = c;\n _d = d;\n\n _maxTime = k + m;\n _nodes = new Node[n, _maxTime];\n\n _start = new Node() {Id = _nodes.Length};\n _sink = new Node() {Id = _nodes.Length + 1};\n\n var allNodesCount = _nodes.Length + 2;\n \n _nodeEdges = new List[allNodesCount];\n _bestCosts = new int[allNodesCount];\n _bestMoves = new Edge[allNodesCount];\n _isInQueue = new bool[allNodesCount];\n _bestPathSearchQueue = new Queue(allNodesCount);\n \n for (var i = 0; i < allNodesCount; i++)\n _nodeEdges[i] = new List(_maxTime);\n }\n \n public int TotalCost { get; private set; }\n\n public void Init()\n {\n var nodeId = 0;\n for (var node = 0; node < _n; node++)\n for (var time = 0; time < _maxTime; time++)\n _nodes[node, time] = new Node() { Id = nodeId++ };\n\n for (var time = 0; time < _maxTime; time++)\n AddEdgeWithoutPair(_nodes[0, time], _sink, time * _c, _k);\n\n for (var node = 0; node < _n; node++)\n {\n var from = _nodes[node, 0];\n for (var time = 1; time < _maxTime; time++)\n {\n var to = _nodes[node, time];\n AddEdgePair(from, to, 0, _k);\n from = to;\n }\n }\n \n _isInQueue[_sink.Id] = true;\n }\n\n public void AddMemberHome(int home, int count)\n {\n AddEdgeWithoutPair(_start, _nodes[home, 0], 0, count);\n }\n\n public void AddEdge(int from, int to)\n {\n for (var time = 0; time < _maxTime - 1; time++)\n {\n var nodeFrom = _nodes[from, time];\n var nodeTo = _nodes[to, time + 1];\n \n for (int people = 0, cost = 1; people < _k; people++, cost += 2)\n AddEdgePair(nodeFrom, nodeTo, cost * _d, 1);\n }\n }\n\n public void IncreaseFlow()\n {\n FindBestPath();\n CommitBestPath();\n TotalCost += _bestCosts[_sink.Id];\n }\n\n private void FindBestPath()\n {\n for (var i = 0; i < _bestCosts.Length; i++)\n _bestCosts[i] = int.MaxValue;\n \n _bestCosts[_start.Id] = 0;\n _bestPathSearchQueue.Enqueue(_start);\n \n while (_bestPathSearchQueue.Count > 0)\n {\n var node = _bestPathSearchQueue.Dequeue();\n var costToNode = _bestCosts[node.Id];\n \n foreach (var edge in _nodeEdges[node.Id])\n {\n if (edge.ResidualCapacity == 0)\n continue;\n \n var possibleCost = costToNode + edge.Cost;\n if (possibleCost >= _bestCosts[edge.To.Id])\n continue;\n \n _bestCosts[edge.To.Id] = possibleCost;\n _bestMoves[edge.To.Id] = edge;\n if (_isInQueue[edge.To.Id])\n continue;\n \n _isInQueue[edge.To.Id] = true;\n _bestPathSearchQueue.Enqueue(edge.To);\n }\n \n _isInQueue[node.Id] = false;\n }\n }\n\n private void CommitBestPath()\n {\n var cur = _bestMoves[_sink.Id];\n while (cur != null)\n {\n cur.ResidualCapacity--;\n cur.Paired.ResidualCapacity++;\n cur = _bestMoves[cur.From.Id];\n }\n }\n\n private void AddEdgePair(Node from, Node to, int cost, int capacity)\n {\n var forwardEdge = new Edge()\n {\n From = from,\n To = to,\n Cost = cost,\n ResidualCapacity = capacity,\n };\n\n var reverseEdge = new Edge()\n {\n From = to,\n To = from,\n Cost = -cost,\n ResidualCapacity = 0,\n };\n\n forwardEdge.Paired = reverseEdge;\n reverseEdge.Paired = forwardEdge;\n \n _nodeEdges[from.Id].Add(forwardEdge);\n _nodeEdges[to.Id].Add(reverseEdge);\n }\n\n private void AddEdgeWithoutPair(Node from, Node to, int cost, int capacity)\n {\n _nodeEdges[from.Id].Add(new Edge()\n {\n From = from,\n To = to,\n Cost = cost,\n ResidualCapacity = capacity, \n Paired = FakeEdge,\n });\n }\n }\n\n internal struct Node\n {\n public int Id { get; set; }\n public override string ToString() => Id.ToString();\n }\n\n internal sealed class Edge\n {\n public Node From { get; set; }\n public Node To { get; set; }\n public int Cost { get; set; }\n public int ResidualCapacity { get; set; }\n public Edge Paired { get; set; }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fa85de05c228ce95508b59cce96edc4a", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace G.GangUp\n{\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var nmkcd = Console.ReadLine().Split();\n var n = int.Parse(nmkcd[0]);\n var m = int.Parse(nmkcd[1]);\n var k = int.Parse(nmkcd[2]);\n var c = int.Parse(nmkcd[3]);\n var d = int.Parse(nmkcd[4]);\n \n var solver = new Solver(n, m, k, c, d);\n solver.Init();\n \n ReadInput(solver, n, m);\n \n for (var i = 0; i < k; i++)\n solver.IncreaseFlow();\n\n Console.WriteLine(solver.TotalCost);\n }\n\n private static void ReadInput(Solver solver, int n, int m)\n {\n var memberCounts = new int[n];\n foreach (var memberHome in Console.ReadLine().Split())\n memberCounts[int.Parse(memberHome) - 1]++;\n\n for (var crossroad = 0; crossroad < n; crossroad++)\n solver.AddMemberHome(crossroad, memberCounts[crossroad]);\n \n for (var i = 0; i < m; i++)\n {\n var xy = Console.ReadLine().Split();\n var x = int.Parse(xy[0]) - 1;\n var y = int.Parse(xy[1]) - 1;\n \n solver.AddEdge(x, y);\n solver.AddEdge(y, x);\n }\n }\n }\n\n internal sealed class Solver\n {\n private static readonly Edge FakeEdge = new Edge();\n \n private readonly int _n, _m, _k, _c, _d;\n private readonly int _maxTime;\n private readonly Node _start, _sink;\n private readonly Node[,] _nodes;\n private readonly List[] _nodeEdges;\n private readonly BestPathSearcher _bestPathSearcher;\n\n public Solver(int n, int m, int k, int c, int d)\n {\n _n = n;\n _m = m;\n _k = k;\n _c = c;\n _d = d;\n\n _maxTime = k + m;\n _nodes = new Node[n, _maxTime];\n\n _start = new Node() {Id = _nodes.Length};\n _sink = new Node() {Id = _nodes.Length + 1};\n\n var allNodesCount = _nodes.Length + 2;\n \n _nodeEdges = new List[allNodesCount];\n for (var i = 0; i < allNodesCount; i++)\n _nodeEdges[i] = new List(_maxTime);\n \n _bestPathSearcher = new BestPathSearcher(_nodeEdges);\n }\n \n public int TotalCost { get; private set; }\n\n public void Init()\n {\n var nodeId = 0;\n for (var node = 0; node < _n; node++)\n for (var time = 0; time < _maxTime; time++)\n _nodes[node, time] = new Node() { Id = nodeId++ };\n\n for (var time = 0; time < _maxTime; time++)\n AddEdgeWithoutPair(_nodes[0, time], _sink, time * _c, _k);\n\n for (var node = 0; node < _n; node++)\n {\n var from = _nodes[node, 0];\n for (var time = 1; time < _maxTime; time++)\n {\n var to = _nodes[node, time];\n AddEdgePair(from, to, 0, _k);\n from = to;\n }\n }\n }\n\n public void AddMemberHome(int home, int count)\n {\n if (count > 0)\n AddEdgeWithoutPair(_start, _nodes[home, 0], 0, count);\n }\n\n public void AddEdge(int from, int to)\n {\n for (var time = 0; time < _maxTime - 1; time++)\n {\n var nodeFrom = _nodes[from, time];\n var nodeTo = _nodes[to, time + 1];\n \n for (int people = 0, cost = 1; people < _k; people++, cost += 2)\n AddEdgePair(nodeFrom, nodeTo, cost * _d, 1);\n }\n }\n\n public void IncreaseFlow()\n {\n var bestPath = _bestPathSearcher.FindBestPath(_start, _sink);\n foreach (var edge in bestPath)\n {\n edge.ResidualCapacity--;\n edge.PairedEdge.ResidualCapacity++;\n TotalCost += edge.Cost;\n }\n }\n\n private void AddEdgePair(Node from, Node to, int cost, int capacity)\n {\n var forwardEdge = new Edge()\n {\n From = from,\n To = to,\n Cost = cost,\n ResidualCapacity = capacity,\n };\n\n var reverseEdge = new Edge()\n {\n From = to,\n To = from,\n Cost = -cost,\n ResidualCapacity = 0,\n };\n\n forwardEdge.PairedEdge = reverseEdge;\n reverseEdge.PairedEdge = forwardEdge;\n \n _nodeEdges[from.Id].Add(forwardEdge);\n _nodeEdges[to.Id].Add(reverseEdge);\n }\n\n private void AddEdgeWithoutPair(Node from, Node to, int cost, int capacity)\n {\n _nodeEdges[from.Id].Add(new Edge()\n {\n From = from,\n To = to,\n Cost = cost,\n ResidualCapacity = capacity, \n PairedEdge = FakeEdge,\n });\n }\n }\n\n internal sealed class BestPathSearcher\n {\n private readonly List[] _nodeEdges;\n\n private readonly int[] _bestCosts;\n private readonly Edge[] _bestMoves;\n private readonly bool[] _isInQueue;\n private readonly Queue _bestPathSearchQueue;\n\n public BestPathSearcher(List[] nodeEdges)\n {\n _nodeEdges = nodeEdges;\n _bestCosts = new int[nodeEdges.Length];\n _bestMoves = new Edge[nodeEdges.Length];\n _isInQueue = new bool[nodeEdges.Length];\n _bestPathSearchQueue = new Queue(nodeEdges.Length);\n }\n\n public IEnumerable FindBestPath(Node start, Node to)\n {\n for (var i = 0; i < _bestCosts.Length; i++)\n _bestCosts[i] = int.MaxValue;\n\n _bestCosts[start.Id] = 0;\n _bestPathSearchQueue.Enqueue(start);\n \n while (_bestPathSearchQueue.Count > 0)\n {\n var node = _bestPathSearchQueue.Dequeue();\n var costToNode = _bestCosts[node.Id];\n \n foreach (var edge in _nodeEdges[node.Id])\n {\n if (edge.ResidualCapacity == 0)\n continue;\n \n var possibleCost = costToNode + edge.Cost;\n if (possibleCost >= _bestCosts[edge.To.Id])\n continue;\n \n _bestCosts[edge.To.Id] = possibleCost;\n _bestMoves[edge.To.Id] = edge;\n if (_isInQueue[edge.To.Id])\n continue;\n \n _isInQueue[edge.To.Id] = true;\n _bestPathSearchQueue.Enqueue(edge.To);\n }\n \n _isInQueue[node.Id] = false;\n }\n\n var cur = _bestMoves[to.Id];\n while (cur != null)\n {\n yield return cur;\n cur = _bestMoves[cur.From.Id];\n }\n }\n }\n\n internal struct Node\n {\n public int Id { get; set; }\n public override string ToString() => Id.ToString();\n }\n\n internal sealed class Edge\n {\n public Node From { get; set; }\n public Node To { get; set; }\n public int Cost { get; set; }\n public int ResidualCapacity { get; set; }\n public Edge PairedEdge { get; set; }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "921892e5332a906e13d0376dc9af14d4", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace G.GangUp\n{\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var nmkcd = Console.ReadLine().Split();\n var n = int.Parse(nmkcd[0]);\n var m = int.Parse(nmkcd[1]);\n var k = int.Parse(nmkcd[2]);\n var c = int.Parse(nmkcd[3]);\n var d = int.Parse(nmkcd[4]);\n \n var solver = new Solver(n, m, k, c, d);\n solver.Init();\n\n var memberHomes = Console.ReadLine().Split().GroupBy(int.Parse);\n foreach (var memberHome in memberHomes)\n solver.AddMemberHome(memberHome.Key - 1, memberHome.Count());\n \n for (var i = 0; i < m; i++)\n {\n var xy = Console.ReadLine().Split();\n var x = int.Parse(xy[0]) - 1;\n var y = int.Parse(xy[1]) - 1;\n \n solver.AddEdge(x, y);\n solver.AddEdge(y, x);\n }\n \n for (var i = 0; i < k; i++)\n solver.IncreaseFlow();\n\n Console.WriteLine(solver.TotalCost);\n }\n }\n\n internal sealed class Solver\n {\n private static readonly Edge FakeEdge = new Edge();\n \n private readonly int _n, _m, _k, _c, _d;\n private readonly int _maxTime;\n private readonly Node _start, _sink;\n private readonly Node[,] _nodes;\n private readonly List[] _nodeEdges;\n \n private readonly int[] _bestCosts;\n private readonly Edge[] _bestMoves;\n private readonly bool[] _isInQueue;\n private readonly Queue _bestPathSearchQueue;\n\n public Solver(int n, int m, int k, int c, int d)\n {\n _n = n;\n _m = m;\n _k = k;\n _c = c;\n _d = d;\n\n _maxTime = k + m;\n _nodes = new Node[n, _maxTime];\n\n _start = new Node() {Id = _nodes.Length};\n _sink = new Node() {Id = _nodes.Length + 1};\n\n var allNodesCount = _nodes.Length + 2;\n \n _nodeEdges = new List[allNodesCount];\n _bestCosts = new int[allNodesCount];\n _bestMoves = new Edge[allNodesCount];\n _isInQueue = new bool[allNodesCount];\n _bestPathSearchQueue = new Queue(allNodesCount);\n \n for (var i = 0; i < allNodesCount; i++)\n _nodeEdges[i] = new List();\n }\n \n public int TotalCost { get; private set; }\n\n public void Init()\n {\n var nodeId = 0;\n for (var node = 0; node < _n; node++)\n for (var time = 0; time < _maxTime; time++)\n _nodes[node, time] = new Node() { Id = nodeId++ };\n\n for (var time = 0; time < _maxTime; time++)\n AddEdgePair(_nodes[0, time], _sink, time * _c, _k);\n\n for (var node = 0; node < _n; node++)\n {\n var from = _nodes[node, 0];\n for (var time = 1; time < _maxTime; time++)\n {\n var to = _nodes[node, time];\n AddEdgePair(from, to, 0, _k);\n from = to;\n }\n }\n \n _isInQueue[_sink.Id] = true;\n }\n\n public void AddMemberHome(int home, int count)\n {\n _nodeEdges[_start.Id].Add(new Edge()\n {\n From = _start,\n To = _nodes[home, 0],\n Cost = 0,\n ResidualCapacity = count,\n Paired = FakeEdge,\n });\n }\n\n public void AddEdge(int from, int to)\n {\n for (var time = 0; time < _maxTime - 1; time++)\n {\n var nodeFrom = _nodes[from, time];\n var nodeTo = _nodes[to, time + 1];\n \n for (int people = 0, cost = 1; people < _k; people++, cost += 2)\n AddEdgePair(nodeFrom, nodeTo, cost * _d, 1);\n }\n }\n\n public void IncreaseFlow()\n {\n FindBestPath();\n CommitBestPath();\n TotalCost += _bestCosts[_sink.Id];\n }\n\n private void FindBestPath()\n {\n for (var i = 0; i < _bestCosts.Length; i++)\n _bestCosts[i] = int.MaxValue;\n \n _bestCosts[_start.Id] = 0;\n _bestPathSearchQueue.Enqueue(_start);\n \n while (_bestPathSearchQueue.Count > 0)\n {\n var node = _bestPathSearchQueue.Dequeue();\n var costToNode = _bestCosts[node.Id];\n \n foreach (var edge in _nodeEdges[node.Id])\n {\n if (edge.ResidualCapacity == 0)\n continue;\n \n var possibleCost = costToNode + edge.Cost;\n if (possibleCost >= _bestCosts[edge.To.Id])\n continue;\n \n _bestCosts[edge.To.Id] = possibleCost;\n _bestMoves[edge.To.Id] = edge;\n if (_isInQueue[edge.To.Id])\n continue;\n \n _isInQueue[edge.To.Id] = true;\n _bestPathSearchQueue.Enqueue(edge.To);\n }\n \n _isInQueue[node.Id] = false;\n }\n }\n\n private void CommitBestPath()\n {\n var cur = _bestMoves[_sink.Id];\n while (cur != null)\n {\n cur.ResidualCapacity--;\n cur.Paired.ResidualCapacity++;\n cur = _bestMoves[cur.From.Id];\n }\n }\n\n private void AddEdgePair(Node from, Node to, int cost, int capacity)\n {\n var forwardEdge = new Edge()\n {\n From = from,\n To = to,\n Cost = cost,\n ResidualCapacity = capacity,\n };\n\n var reverseEdge = new Edge()\n {\n From = to,\n To = from,\n Cost = -cost,\n ResidualCapacity = 0,\n };\n\n forwardEdge.Paired = reverseEdge;\n reverseEdge.Paired = forwardEdge;\n \n _nodeEdges[from.Id].Add(forwardEdge);\n _nodeEdges[to.Id].Add(reverseEdge);\n }\n }\n\n internal struct Node\n {\n public int Id { get; set; }\n public override string ToString() => Id.ToString();\n }\n\n internal sealed class Edge\n {\n public Node From { get; set; }\n public Node To { get; set; }\n public int Cost { get; set; }\n public int ResidualCapacity { get; set; }\n public Edge Paired { get; set; }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "51fa785667e1d15857980ca4e0b233e3", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace G.GangUp\n{\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var nmkcd = Console.ReadLine().Split();\n var n = int.Parse(nmkcd[0]);\n var m = int.Parse(nmkcd[1]);\n var k = int.Parse(nmkcd[2]);\n var c = int.Parse(nmkcd[3]);\n var d = int.Parse(nmkcd[4]);\n \n var solver = new Solver(n, m, k, c, d);\n solver.Init();\n\n var memberHomes = Console.ReadLine().Split().GroupBy(int.Parse);\n foreach (var memberHome in memberHomes)\n solver.AddMemberHome(memberHome.Key - 1, memberHome.Count());\n \n for (var i = 0; i < m; i++)\n {\n var xy = Console.ReadLine().Split();\n var x = int.Parse(xy[0]) - 1;\n var y = int.Parse(xy[1]) - 1;\n \n solver.AddEdge(x, y);\n solver.AddEdge(y, x);\n }\n \n for (var i = 0; i < k; i++)\n solver.IncreaseFlow();\n\n Console.WriteLine(solver.TotalCost);\n }\n }\n\n internal sealed class Solver\n {\n private static readonly Edge FakeEdge = new Edge();\n \n private readonly int _n, _m, _k, _c, _d;\n private readonly int _maxTime;\n private readonly Node _start, _sink;\n private readonly Node[,] _nodes;\n private readonly List[] _nodeEdges;\n \n private readonly int[] _bestCosts;\n private readonly Edge[] _bestMoves;\n\n public Solver(int n, int m, int k, int c, int d)\n {\n _n = n;\n _m = m;\n _k = k;\n _c = c;\n _d = d;\n\n _maxTime = k + m;\n _nodes = new Node[n, _maxTime];\n\n _start = new Node() {Id = _nodes.Length};\n _sink = new Node() {Id = _nodes.Length + 1};\n\n var allNodesCount = _nodes.Length + 2;\n \n _nodeEdges = new List[allNodesCount];\n _bestCosts = new int[allNodesCount];\n _bestMoves = new Edge[allNodesCount];\n \n for (var i = 0; i < allNodesCount; i++)\n _nodeEdges[i] = new List();\n }\n \n public int TotalCost { get; private set; }\n\n public void Init()\n {\n var nodeId = 0;\n for (var node = 0; node < _n; node++)\n for (var time = 0; time < _maxTime; time++)\n _nodes[node, time] = new Node() { Id = nodeId++ };\n\n for (var time = 0; time < _maxTime; time++)\n AddEdgePair(_nodes[0, time], _sink, time * _c, _k);\n\n for (var node = 0; node < _n; node++)\n {\n var from = _nodes[node, 0];\n for (var time = 1; time < _maxTime; time++)\n {\n var to = _nodes[node, time];\n AddEdgePair(from, to, 0, _k);\n from = to;\n }\n }\n }\n\n public void AddMemberHome(int home, int count)\n {\n _nodeEdges[_start.Id].Add(new Edge()\n {\n From = _start,\n To = _nodes[home, 0],\n Cost = 0,\n ResidualCapacity = count,\n Paired = FakeEdge,\n });\n }\n\n public void AddEdge(int from, int to)\n {\n for (var time = 0; time < _maxTime - 1; time++)\n {\n var nodeFrom = _nodes[from, time];\n var nodeTo = _nodes[to, time + 1];\n \n for (int people = 0, cost = 1; people < _k; people++, cost += 2)\n AddEdgePair(nodeFrom, nodeTo, cost * _d, 1);\n }\n }\n\n public void IncreaseFlow()\n {\n FindBestPath();\n CommitBestPath();\n TotalCost += _bestCosts[_sink.Id];\n }\n\n private void FindBestPath()\n {\n for (var i = 0; i < _bestCosts.Length; i++)\n _bestCosts[i] = int.MaxValue;\n\n _bestCosts[_start.Id] = 0;\n \n bool any;\n do\n {\n any = false;\n for (var nodeId = 0; nodeId < _nodeEdges.Length; nodeId++)\n {\n var costToSource = _bestCosts[nodeId];\n if (costToSource == int.MaxValue)\n continue;\n\n foreach (var edge in _nodeEdges[nodeId])\n {\n if (edge.ResidualCapacity == 0)\n continue;\n\n var newCost = costToSource + edge.Cost;\n if (_bestCosts[edge.To.Id] <= newCost)\n continue;\n\n _bestCosts[edge.To.Id] = newCost;\n _bestMoves[edge.To.Id] = edge;\n any = true;\n }\n }\n }\n while (any);\n }\n\n private void CommitBestPath()\n {\n var cur = _bestMoves[_sink.Id];\n while (cur != null)\n {\n cur.ResidualCapacity--;\n cur.Paired.ResidualCapacity++;\n cur = _bestMoves[cur.From.Id];\n }\n }\n\n private void AddEdgePair(Node from, Node to, int cost, int capacity)\n {\n var forwardEdge = new Edge()\n {\n From = from,\n To = to,\n Cost = cost,\n ResidualCapacity = capacity,\n };\n\n var reverseEdge = new Edge()\n {\n From = to,\n To = from,\n Cost = -cost,\n ResidualCapacity = 0,\n };\n\n forwardEdge.Paired = reverseEdge;\n reverseEdge.Paired = forwardEdge;\n \n _nodeEdges[from.Id].Add(forwardEdge);\n _nodeEdges[to.Id].Add(reverseEdge);\n }\n }\n\n internal struct Node\n {\n public int Id { get; set; }\n public override string ToString() => Id.ToString();\n }\n\n internal sealed class Edge\n {\n public Node From { get; set; }\n public Node To { get; set; }\n public int Cost { get; set; }\n public int ResidualCapacity { get; set; }\n public Edge Paired { get; set; }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c33d68ac72c0f01267209817ab544205", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace G.GangUp\n{\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var nmkcd = Console.ReadLine().Split();\n var n = int.Parse(nmkcd[0]);\n var m = int.Parse(nmkcd[1]);\n var k = int.Parse(nmkcd[2]);\n var c = int.Parse(nmkcd[3]);\n var d = int.Parse(nmkcd[4]);\n \n var memberHomes = Console.ReadLine().Split().Select(int.Parse);\n var graph = ReadGraph(n, m, k);\n FindPathLengths(graph);\n\n var solver = new Solver(n, c, d);\n\n foreach (var memberHome in memberHomes)\n solver.AddDiscontentForMember(graph[memberHome]);\n\n Console.WriteLine(solver.Discontent);\n }\n\n private static GraphNode[] ReadGraph(int n, int m, int k)\n {\n var graph = new GraphNode[n + 1];\n for (var i = 1; i <= n; i++)\n graph[i] = new GraphNode(i, m);\n\n for (var i = 0; i < m; i++)\n {\n var xy = Console.ReadLine().Split();\n var x = graph[int.Parse(xy[0])];\n var y = graph[int.Parse(xy[1])];\n \n x.Edges.Add(new Edge() { Node = y, TimeInfo = new TimeInfo(k) });\n y.Edges.Add(new Edge() { Node = x, TimeInfo = new TimeInfo(k) });\n }\n\n return graph;\n }\n\n private static void FindPathLengths(GraphNode[] graph)\n {\n var queue = new Queue(graph.Length);\n \n var node = graph[1];\n node.PathLength = 0;\n queue.Enqueue(node);\n\n while (queue.Count > 0)\n {\n node = queue.Dequeue();\n var newPathLength = node.PathLength + 1;\n \n foreach (var neighbour in node.Edges.Select(it => it.Node))\n {\n if (neighbour.PathLength <= newPathLength)\n continue;\n \n neighbour.PathLength = newPathLength;\n queue.Enqueue(neighbour);\n }\n }\n }\n }\n\n internal sealed class Solver\n {\n private readonly int _c, _d, _cPlusD;\n private readonly EdgeIndexWithTime[] _bestPath;\n\n private int _currentBestDiscontent, _bestPathLength;\n\n public Solver(int n, int c, int d)\n {\n _c = c;\n _d = d;\n _cPlusD = c + d;\n _bestPath = new EdgeIndexWithTime[n + 1];\n }\n \n public int Discontent { get; private set; }\n\n public void AddDiscontentForMember(GraphNode home)\n {\n _currentBestDiscontent = int.MaxValue;\n TryOptimize(home, 0, 0, 0);\n CommitBestPath(home);\n Discontent += _currentBestDiscontent;\n }\n\n private bool TryOptimize(GraphNode node, int time, int baseDiscontent, int bestPathIndex)\n {\n if (node.Id == 1)\n {\n if (baseDiscontent >= _currentBestDiscontent)\n return false;\n\n _bestPathLength = bestPathIndex;\n _currentBestDiscontent = baseDiscontent;\n return true;\n }\n\n node.AlreadyInCurrentPath = true;\n \n var optimized = false;\n\n var nextBestPathIndex = bestPathIndex + 1;\n \n for (var idealContinuationDiscontent = baseDiscontent + node.PathLength * _cPlusD; \n idealContinuationDiscontent < _currentBestDiscontent;\n idealContinuationDiscontent += _c, ++time)\n {\n var nextTime = time + 1;\n baseDiscontent += _c;\n\n for (var edgeIndex = 0; edgeIndex < node.Edges.Count; edgeIndex++)\n {\n var edge = node.Edges[edgeIndex];\n \n var neighbour = edge.Node;\n if (neighbour.AlreadyInCurrentPath)\n continue;\n \n var nextBaseDiscontent = baseDiscontent + \n CalculateDiscontentChange(edge.TimeInfo[time]);\n \n if (!TryOptimize(neighbour, nextTime, nextBaseDiscontent, nextBestPathIndex))\n continue;\n \n _bestPath[bestPathIndex] = new EdgeIndexWithTime() {EdgeIndex = edgeIndex, Time = time};\n optimized = true;\n if (idealContinuationDiscontent >= _currentBestDiscontent)\n break;\n }\n }\n\n node.AlreadyInCurrentPath = false;\n return optimized;\n }\n\n private void CommitBestPath(GraphNode current)\n {\n foreach (var edgeIndexWithTime in _bestPath.Take(_bestPathLength))\n {\n var edge = current.Edges[edgeIndexWithTime.EdgeIndex];\n ++edge.TimeInfo[edgeIndexWithTime.Time];\n current = edge.Node;\n }\n }\n\n private int CalculateDiscontentChange(int peopleWalkingTheSameTime)\n {\n var oldDiscontentD = peopleWalkingTheSameTime * peopleWalkingTheSameTime * _d;\n ++peopleWalkingTheSameTime;\n var newDiscontentD = peopleWalkingTheSameTime * peopleWalkingTheSameTime * _d;\n return newDiscontentD - oldDiscontentD;\n }\n\n private struct EdgeIndexWithTime\n {\n public int EdgeIndex { get; set; }\n public int Time { get; set; }\n }\n }\n\n internal sealed class GraphNode : IEquatable\n {\n public GraphNode(int id, int m)\n {\n Id = id;\n Edges = new List(m);\n }\n \n public int Id { get; }\n\n public int PathLength { get; set; } = 1000;\n \n public bool AlreadyInCurrentPath { get; set; }\n \n public List Edges { get; }\n\n public bool Equals(GraphNode other) => Id == other?.Id;\n\n public override bool Equals(object obj) => obj is GraphNode graphNode && graphNode.Id == Id;\n\n public override int GetHashCode() => Id;\n }\n\n internal struct TimeInfo\n {\n private readonly Dictionary _peopleCounts;\n \n public TimeInfo(int capacity) { _peopleCounts = new Dictionary(capacity); }\n\n public int this[int time]\n {\n get\n {\n _peopleCounts.TryGetValue(time, out var peopleCount);\n return peopleCount;\n }\n \n set => _peopleCounts[time] = value;\n }\n }\n\n internal struct Edge\n {\n public GraphNode Node;\n public TimeInfo TimeInfo;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e3e575839546cfd60e42c03adbebc346", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace G.GangUp\n{\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var nmkcd = Console.ReadLine().Split();\n var n = int.Parse(nmkcd[0]);\n var m = int.Parse(nmkcd[1]);\n var k = int.Parse(nmkcd[2]);\n var c = int.Parse(nmkcd[3]);\n var d = int.Parse(nmkcd[4]);\n \n var solver = new Solver(n, m, k, c, d);\n solver.Init();\n\n var memberHomes = Console.ReadLine().Split().GroupBy(int.Parse);\n foreach (var memberHome in memberHomes)\n solver.AddMemberHome(memberHome.Key - 1, memberHome.Count());\n \n for (var i = 0; i < m; i++)\n {\n var xy = Console.ReadLine().Split();\n var x = int.Parse(xy[0]) - 1;\n var y = int.Parse(xy[1]) - 1;\n \n solver.AddEdge(x, y);\n solver.AddEdge(y, x);\n }\n \n for (var i = 0; i < k; i++)\n solver.IncreaseFlow();\n\n Console.WriteLine(solver.TotalCost);\n }\n }\n\n internal sealed class Solver\n {\n private static readonly Edge FakeEdge = new Edge();\n private readonly int _n, _m, _k, _c, _d;\n private readonly int _maxTime;\n private readonly Node _start, _sink;\n private readonly Node[,] _nodes;\n private readonly List[] _nodeEdges;\n \n private readonly int[] _bestCosts;\n private readonly Edge[] _bestMoves;\n private readonly bool[] _isInQueue;\n private readonly Queue _bestPathSearchQueue;\n\n public Solver(int n, int m, int k, int c, int d)\n {\n _n = n;\n _m = m;\n _k = k;\n _c = c;\n _d = d;\n\n _maxTime = k + m;\n _nodes = new Node[n, _maxTime];\n\n _start = new Node() {Id = _nodes.Length};\n _sink = new Node() {Id = _nodes.Length + 1};\n\n var allNodesCount = _nodes.Length + 2;\n \n _nodeEdges = new List[allNodesCount];\n _bestCosts = new int[allNodesCount];\n _bestMoves = new Edge[allNodesCount];\n _isInQueue = new bool[allNodesCount];\n _bestPathSearchQueue = new Queue(allNodesCount);\n \n for (var i = 0; i < _nodeEdges.Length; i++)\n _nodeEdges[i] = new List();\n }\n \n public int TotalCost { get; private set; }\n\n public void Init()\n {\n var nodeId = 0;\n for (var node = 0; node < _n; node++)\n for (var time = 0; time < _maxTime; time++)\n _nodes[node, time] = new Node() { Id = nodeId++ };\n\n for (var time = 0; time < _maxTime; time++)\n {\n var leaderHome = _nodes[0, time];\n \n _nodeEdges[leaderHome.Id].Add(new Edge()\n {\n From = leaderHome,\n To = _sink,\n Flow = new Flow() { Capacity = _k },\n Cost = time * _c,\n Paired = FakeEdge,\n });\n }\n \n for (var node = 0; node < _n; node++)\n for (var time = 0; time < _maxTime - 1; time++)\n {\n var from = _nodes[node, time];\n var to = _nodes[node, time + 1];\n _nodeEdges[from.Id].Add(new Edge()\n {\n From = from,\n To = to,\n Cost = 0,\n Flow = new Flow() { Capacity = int.MaxValue },\n Paired = FakeEdge,\n });\n }\n\n _isInQueue[_sink.Id] = true;\n }\n\n public void AddMemberHome(int home, int count)\n {\n var target = _nodes[home, 0];\n \n _nodeEdges[_start.Id].Add(new Edge()\n {\n From = _start,\n To = target,\n Flow = new Flow() { Capacity = count },\n Cost = 0,\n Paired = FakeEdge,\n });\n }\n\n public void AddEdge(int from, int to)\n {\n for (var time = 0; time < _maxTime - 1; time++)\n {\n var nodeFrom = _nodes[from, time];\n var nodeTo = _nodes[to, time + 1];\n \n for (int people = 0, cost = 1; people < _k; people++, cost += 2)\n {\n var mainEdge = new Edge()\n {\n From = nodeFrom,\n To = nodeTo,\n Flow = new Flow() { Capacity = 1 },\n Cost = cost * _d,\n };\n\n var helpEdge = new Edge()\n {\n From = nodeTo,\n To = nodeFrom,\n Flow = new Flow() { Capacity = 0 },\n Cost = -cost * _d,\n };\n\n mainEdge.Paired = helpEdge;\n helpEdge.Paired = mainEdge;\n \n _nodeEdges[nodeFrom.Id].Add(mainEdge);\n _nodeEdges[nodeTo.Id].Add(helpEdge);\n }\n }\n }\n\n public void IncreaseFlow()\n {\n FindBestPath();\n var flow = FindFlow();\n CommitBestPath(flow);\n }\n\n private void FindBestPath()\n {\n for (var i = 0; i < _bestCosts.Length; i++)\n _bestCosts[i] = int.MaxValue;\n \n _bestCosts[_start.Id] = 0;\n _bestPathSearchQueue.Enqueue(_start);\n \n while (_bestPathSearchQueue.Count > 0)\n {\n var node = _bestPathSearchQueue.Dequeue();\n var costToNode = _bestCosts[node.Id];\n \n foreach (var edge in _nodeEdges[node.Id])\n {\n if (edge.Flow.Filled)\n continue;\n\n var possibleCost = costToNode + edge.Cost;\n if (possibleCost >= _bestCosts[edge.To.Id])\n continue;\n\n _bestCosts[edge.To.Id] = possibleCost;\n _bestMoves[edge.To.Id] = edge;\n if (_isInQueue[edge.To.Id])\n continue;\n \n _isInQueue[edge.To.Id] = true;\n _bestPathSearchQueue.Enqueue(edge.To);\n }\n\n _isInQueue[node.Id] = false;\n }\n }\n\n private int FindFlow()\n {\n var minFlow = int.MaxValue;\n var cur = _bestMoves[_sink.Id];\n while (cur != null)\n {\n var flow = cur.Flow.Remaining;\n if (flow < minFlow)\n minFlow = flow;\n \n cur = _bestMoves[cur.From.Id];\n }\n\n return minFlow;\n }\n\n private void CommitBestPath(int flow)\n {\n var cur = _bestMoves[_sink.Id];\n while (cur != null)\n {\n TotalCost += cur.Cost;\n cur.Flow.ActualFlow += flow;\n cur.Paired.Flow.ActualFlow -= flow;\n cur = _bestMoves[cur.From.Id];\n }\n }\n }\n\n internal struct Node\n {\n public int Id { get; set; }\n public override string ToString() => Id.ToString();\n }\n\n internal struct Flow\n {\n public int ActualFlow { get; set; }\n public int Capacity { get; set; }\n \n public int Remaining => Capacity - ActualFlow;\n public bool Filled => ActualFlow == Capacity;\n }\n\n internal sealed class Edge\n {\n public Node From { get; set; }\n \n public Node To { get; set; }\n \n public int Cost { get; set; }\n public Edge Paired { get; set; }\n public Flow Flow;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2efdfa173690942715fba930e59a58c9", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace G.GangUp\n{\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var nmkcd = Console.ReadLine().Split();\n var n = int.Parse(nmkcd[0]);\n var m = int.Parse(nmkcd[1]);\n var k = int.Parse(nmkcd[2]);\n var c = int.Parse(nmkcd[3]);\n var d = int.Parse(nmkcd[4]);\n \n var memberHomes = Console.ReadLine().Split().Select(int.Parse);\n var graph = ReadGraph(n, m, k);\n \n var solver = new Solver(n, m, k, c, d);\n solver.Init(graph);\n\n foreach (var memberHomeId in memberHomes)\n solver.AddDiscontentForMember(memberHomeId);\n\n Console.WriteLine(solver.Discontent);\n }\n\n private static GraphNode[] ReadGraph(int n, int m, int k)\n {\n var graph = new GraphNode[n + 1];\n for (var i = 1; i <= n; i++)\n graph[i] = new GraphNode() { Id = i, Edges = new List(m) };\n\n for (var i = 0; i < m; i++)\n {\n var xy = Console.ReadLine().Split();\n var x = graph[int.Parse(xy[0])];\n var y = graph[int.Parse(xy[1])];\n\n var edgeXy = new Edge() {To = y, PeopleByTime = new TimeInfo(k)};\n var edgeYx = new Edge() {To = x, PeopleByTime = new TimeInfo(k)};\n edgeXy.Paired = edgeYx;\n edgeYx.Paired = edgeXy;\n \n x.Edges.Add(edgeXy);\n y.Edges.Add(edgeYx);\n }\n\n return graph;\n }\n }\n\n internal sealed class Solver\n {\n private static readonly MoveInfo FakeBestMove = new MoveInfo() {Discontent = int.MaxValue};\n \n private readonly int _n, _c, _d, _maxTime;\n private readonly MoveInfo[,] _optimalMoves;\n private readonly Queue _recalculateQueue;\n\n public Solver(int n, int m, int k, int c, int d)\n {\n _n = n + 1;\n _maxTime = m + k + 1;\n _c = c;\n _d = d;\n _optimalMoves = new MoveInfo[_n, _maxTime];\n _recalculateQueue = new Queue(_optimalMoves.Length);\n }\n \n public int Discontent { get; private set; }\n\n public void Init(GraphNode[] graph)\n {\n var optimalPaths = CalculateInitialMoves(graph);\n for (var i = 1; i < graph.Length; i++)\n {\n var baseMove = optimalPaths[i];\n for (var startTime = 0; startTime < _maxTime; startTime++)\n {\n _optimalMoves[i, startTime] = new MoveInfo()\n {\n Edge = baseMove.Edge,\n Discontent = baseMove.Discontent,\n Time = startTime,\n };\n }\n }\n }\n\n public void AddDiscontentForMember(int homeId)\n {\n var optimalMove = _optimalMoves[homeId, 0];\n Discontent += optimalMove.Discontent;\n\n while (true)\n {\n ++optimalMove.Edge.PeopleByTime[optimalMove.Time];\n \n RecalculateDiscontents(optimalMove.Edge, optimalMove.Time);\n if (optimalMove.Edge.To.Id == 1)\n return;\n\n optimalMove = _optimalMoves[optimalMove.Edge.To.Id, optimalMove.Time + 1];\n }\n }\n\n private void RecalculateDiscontents(Edge edge, int time)\n {\n EnqueueMovesThatTargetExactEdge(edge, time);\n \n while (_recalculateQueue.Count > 0)\n {\n var moveInfoWithStartTime = _recalculateQueue.Dequeue();\n var invalidatedMove = moveInfoWithStartTime.MoveInfo;\n var sourceNode = invalidatedMove.Edge.Paired.To;\n\n var bestMove = FindBestMoveInfo(sourceNode, moveInfoWithStartTime.StartTime);\n _optimalMoves[sourceNode.Id, moveInfoWithStartTime.StartTime] = bestMove;\n\n if (bestMove.Discontent != invalidatedMove.Discontent && moveInfoWithStartTime.StartTime != 0)\n EnqueueMovesThatTargetExactNode(sourceNode, moveInfoWithStartTime.StartTime - 1);\n }\n }\n\n private MoveInfo FindBestMoveInfo(GraphNode sourceNode, int startTime)\n {\n var bestMove = FakeBestMove;\n \n for (int moveTime = startTime, waitDiscontent = _c; \n moveTime < _maxTime - 1; \n moveTime++, waitDiscontent += _c)\n {\n foreach (var canGoToEdge in sourceNode.Edges)\n {\n var discontent = waitDiscontent +\n CalculateDComponent(canGoToEdge.PeopleByTime[moveTime], _d) +\n _optimalMoves[canGoToEdge.To.Id, moveTime + 1].Discontent;\n \n if (discontent < bestMove.Discontent)\n bestMove = new MoveInfo() {Edge = canGoToEdge, Time = moveTime, Discontent = discontent,};\n }\n }\n\n return bestMove;\n }\n\n private void EnqueueMovesThatTargetExactEdge(Edge edge, int time)\n {\n var sourceId = edge.Paired.To.Id;\n for (var t = 0; t <= time; t++)\n {\n var moveInfo = _optimalMoves[sourceId, t];\n if (moveInfo.Edge == edge && moveInfo.Time == time)\n _recalculateQueue.Enqueue(new MoveInfoWithStartTime() { MoveInfo = moveInfo, StartTime = t });\n }\n }\n\n private void EnqueueMovesThatTargetExactNode(GraphNode toNode, int time)\n {\n foreach (var nodeId in toNode.Edges.Select(it => it.To.Id))\n {\n for (var t = 0; t <= time; t++)\n {\n var moveInfo = _optimalMoves[nodeId, t];\n if (moveInfo.Edge.To.Id == toNode.Id && moveInfo.Time == time)\n _recalculateQueue.Enqueue(new MoveInfoWithStartTime() { MoveInfo = moveInfo, StartTime = t });\n }\n }\n }\n\n private MoveInfo[] CalculateInitialMoves(GraphNode[] graph)\n {\n var optimalPaths = new MoveInfo[_n];\n var queue = new Queue(optimalPaths.Length);\n\n optimalPaths[1] = new MoveInfo() {Edge = GetFakeEdge(graph[1]),};\n queue.Enqueue(graph[1]);\n\n var moveCost = _c + _d;\n\n while (queue.Count > 0)\n {\n var node = queue.Dequeue();\n var nextNodeDiscontent = optimalPaths[node.Id].Discontent + moveCost;\n \n foreach (var edge in node.Edges)\n {\n var existingPath = optimalPaths[edge.To.Id];\n if (existingPath != null && existingPath.Discontent <= nextNodeDiscontent)\n continue;\n\n optimalPaths[edge.To.Id] = new MoveInfo()\n {\n Edge = edge.Paired,\n Discontent = nextNodeDiscontent,\n };\n \n queue.Enqueue(edge.To);\n }\n }\n\n return optimalPaths;\n }\n\n private static int CalculateDComponent(int people, int d)\n {\n var oldValue = people * people * d;\n ++people;\n var newValue = people * people * d;\n return newValue - oldValue;\n }\n\n private static Edge GetFakeEdge(GraphNode to)\n {\n var edge = new Edge() {To = to, PeopleByTime = new TimeInfo(1)};\n edge.Paired = edge;\n return edge;\n }\n\n private struct MoveInfoWithStartTime\n {\n public MoveInfo MoveInfo { get; set; }\n public int StartTime { get; set; }\n }\n }\n\n internal sealed class GraphNode : IEquatable\n {\n public int Id { get; set; }\n \n public List Edges { get; set; }\n\n public bool Equals(GraphNode other) => Id == other?.Id;\n\n public override bool Equals(object obj) => obj is GraphNode graphNode && graphNode.Id == Id;\n\n public override int GetHashCode() => Id;\n }\n\n internal sealed class Edge\n {\n public GraphNode To { get; set; }\n public Edge Paired { get; set; }\n public TimeInfo PeopleByTime { get; set; }\n }\n\n internal sealed class TimeInfo\n {\n private readonly Dictionary _peopleCounts;\n\n public TimeInfo(int capacity) => _peopleCounts = new Dictionary(capacity);\n\n public PeopleCount this[int time]\n {\n get\n {\n _peopleCounts.TryGetValue(time, out var count);\n return count;\n }\n\n set => _peopleCounts[time] = value;\n }\n }\n\n internal struct PeopleCount\n {\n public int Value { get; set; }\n public static implicit operator PeopleCount(int v) => new PeopleCount() {Value = v};\n public static implicit operator int(PeopleCount v) => v.Value;\n }\n \n internal sealed class MoveInfo\n {\n public Edge Edge { get; set; }\n \n public int Time { get; set; }\n \n public int Discontent { get; set; }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "769f8fecd11914d6322bb4a83ccbf634", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace G.GangUp\n{\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var nmkcd = Console.ReadLine().Split();\n var n = int.Parse(nmkcd[0]);\n var m = int.Parse(nmkcd[1]);\n var k = int.Parse(nmkcd[2]);\n var c = int.Parse(nmkcd[3]);\n var d = int.Parse(nmkcd[4]);\n \n var memberHomes = Console.ReadLine().Split().Select(int.Parse);\n var graph = ReadGraph(n, m, k);\n \n var solver = new Solver(n, m, k, c, d);\n solver.Init(graph);\n\n foreach (var memberHome in memberHomes)\n solver.AddDiscontentForMember(graph[memberHome]);\n\n Console.WriteLine(solver.Discontent);\n }\n\n private static GraphNode[] ReadGraph(int n, int m, int k)\n {\n var graph = new GraphNode[n + 1];\n for (var i = 1; i <= n; i++)\n graph[i] = new GraphNode() { Id = i, Edges = new List(m) };\n\n for (var i = 0; i < m; i++)\n {\n var xy = Console.ReadLine().Split();\n var x = graph[int.Parse(xy[0])];\n var y = graph[int.Parse(xy[1])];\n\n var edgeXy = new Edge() {To = y, PeopleByTime = new TimeInfo(k)};\n var edgeYx = new Edge() {To = x, PeopleByTime = new TimeInfo(k)};\n edgeXy.Paired = edgeYx;\n edgeYx.Paired = edgeXy;\n \n x.Edges.Add(edgeXy);\n y.Edges.Add(edgeYx);\n }\n\n return graph;\n }\n }\n\n internal sealed class Solver\n {\n private static readonly MoveInfo FakeBestMove = new MoveInfo() {Discontent = int.MaxValue};\n \n private readonly int _n, _m, _k, _c, _d, _cPlusD, _mPlusK;\n private readonly MoveInfo[,] _optimalMoves;\n private readonly Queue _recalculateQueue;\n\n public Solver(int n, int m, int k, int c, int d)\n {\n _n = n;\n _m = m;\n _k = k;\n _c = c;\n _d = d;\n _cPlusD = c + d;\n _mPlusK = m + k;\n _optimalMoves = new MoveInfo[n + 1, _mPlusK];\n _recalculateQueue = new Queue(_optimalMoves.Length);\n }\n \n public int Discontent { get; private set; }\n\n public void Init(GraphNode[] graph)\n {\n var optimalPaths = CalculateInitialPaths(graph);\n for (var i = 1; i < graph.Length; i++)\n {\n var baseMove = optimalPaths[i];\n for (var startTime = 0; startTime < _m + _k; startTime++)\n {\n _optimalMoves[i, startTime] = new MoveInfo()\n {\n Edge = baseMove.Edge,\n Discontent = baseMove.Discontent,\n Time = startTime,\n };\n }\n }\n }\n\n public void AddDiscontentForMember(GraphNode home)\n {\n var optimalMove = _optimalMoves[home.Id, 0];\n Discontent += optimalMove.Discontent;\n\n while (true)\n {\n ++optimalMove.Edge.PeopleByTime[optimalMove.Time];\n RecalculateDiscontents(optimalMove.Edge, optimalMove.Time);\n if (optimalMove.Edge.To.Id == 1)\n return;\n\n optimalMove = _optimalMoves[optimalMove.Edge.To.Id, optimalMove.Time + 1];\n }\n }\n\n private void RecalculateDiscontents(Edge edge, int time)\n {\n EnqueueMovesThatTargetExactEdge(edge, time);\n \n while (_recalculateQueue.Count > 0)\n {\n var moveInfoWithStartTime = _recalculateQueue.Dequeue();\n var invalidMove = moveInfoWithStartTime.MoveInfo;\n var sourceNode = invalidMove.Edge.Paired.To;\n\n var bestMove = FakeBestMove;\n \n for (int t = moveInfoWithStartTime.StartTime, waitDiscontent = _c; \n t < _k + _m - 1; \n t++, waitDiscontent += _c)\n {\n foreach (var canGoToEdge in sourceNode.Edges)\n {\n var discontent = waitDiscontent +\n CalculateDComponent(canGoToEdge.PeopleByTime[t] + 1, _d) +\n _optimalMoves[canGoToEdge.To.Id, t + 1].Discontent;\n \n if (discontent < bestMove.Discontent)\n bestMove = new MoveInfo() {Edge = canGoToEdge, Time = t, Discontent = discontent,};\n }\n }\n\n _optimalMoves[sourceNode.Id, moveInfoWithStartTime.StartTime] = bestMove;\n\n if (bestMove.Discontent != invalidMove.Discontent)\n EnqueueMovesThatTargetExactNode(sourceNode, moveInfoWithStartTime.StartTime - 1);\n }\n }\n\n private void EnqueueMovesThatTargetExactEdge(Edge edge, int time)\n {\n var sourceId = edge.Paired.To.Id;\n for (var t = 0; t <= time; t++)\n {\n var moveInfo = _optimalMoves[sourceId, t];\n if (moveInfo.Edge == edge && moveInfo.Time == time)\n _recalculateQueue.Enqueue(new MoveInfoWithStartTime() { MoveInfo = moveInfo, StartTime = t });\n }\n }\n\n private void EnqueueMovesThatTargetExactNode(GraphNode toNode, int time)\n {\n foreach (var nodeId in toNode.Edges.Select(it => it.To.Id))\n {\n for (var t = 0; t <= time; t++)\n {\n var moveInfo = _optimalMoves[nodeId, t];\n if (moveInfo.Edge.To.Id == toNode.Id && moveInfo.Time == time)\n _recalculateQueue.Enqueue(new MoveInfoWithStartTime() { MoveInfo = moveInfo, StartTime = t });\n }\n }\n }\n\n private MoveInfo[] CalculateInitialPaths(GraphNode[] graph)\n {\n var optimalPaths = new MoveInfo[_n + 1];\n var queue = new Queue(optimalPaths.Length);\n\n optimalPaths[1] = new MoveInfo() {Edge = GetFakeEdge(graph[1]),};\n queue.Enqueue(graph[1]);\n\n while (queue.Count > 0)\n {\n var node = queue.Dequeue();\n var nextNodeDiscontent = optimalPaths[node.Id].Discontent + _cPlusD;\n \n foreach (var edge in node.Edges)\n {\n var existingPath = optimalPaths[edge.To.Id];\n if (existingPath != null && existingPath.Discontent <= nextNodeDiscontent)\n continue;\n\n optimalPaths[edge.To.Id] = new MoveInfo()\n {\n Edge = edge.Paired,\n Discontent = nextNodeDiscontent,\n };\n \n queue.Enqueue(edge.To);\n }\n }\n\n return optimalPaths;\n }\n\n private static int CalculateDComponent(PeopleCount people, int d) => people * people * d;\n\n private static Edge GetFakeEdge(GraphNode to)\n {\n var edge = new Edge() {To = to, PeopleByTime = new TimeInfo(1)};\n edge.Paired = edge;\n return edge;\n }\n\n private struct MoveInfoWithStartTime\n {\n public MoveInfo MoveInfo { get; set; }\n public int StartTime { get; set; }\n }\n }\n\n internal sealed class GraphNode : IEquatable\n {\n public int Id { get; set; }\n \n public List Edges { get; set; }\n\n public bool Equals(GraphNode other) => Id == other?.Id;\n\n public override bool Equals(object obj) => obj is GraphNode graphNode && graphNode.Id == Id;\n\n public override int GetHashCode() => Id;\n }\n\n internal sealed class Edge\n {\n public GraphNode To { get; set; }\n public Edge Paired { get; set; }\n public TimeInfo PeopleByTime { get; set; }\n }\n\n internal sealed class TimeInfo\n {\n private readonly Dictionary _peopleCounts;\n\n public TimeInfo(int capacity) => _peopleCounts = new Dictionary(capacity);\n\n public PeopleCount this[int time]\n {\n get\n {\n _peopleCounts.TryGetValue(time, out var count);\n return count;\n }\n\n set => _peopleCounts[time] = value;\n }\n }\n\n internal struct PeopleCount\n {\n public int Value { get; set; }\n public static implicit operator PeopleCount(int v) => new PeopleCount() {Value = v};\n public static implicit operator int(PeopleCount v) => v.Value;\n }\n \n internal sealed class MoveInfo\n {\n public Edge Edge { get; set; }\n \n public int Time { get; set; }\n \n public int Discontent { get; set; }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e93dc84003e75737166df2e6c8d9f1c5", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace G.GangUp\n{\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var nmkcd = Console.ReadLine().Split();\n var n = int.Parse(nmkcd[0]);\n var m = int.Parse(nmkcd[1]);\n var k = int.Parse(nmkcd[2]);\n var c = int.Parse(nmkcd[3]);\n var d = int.Parse(nmkcd[4]);\n \n var memberHomes = Console.ReadLine().Split().Select(int.Parse);\n var graph = ReadGraph(n, m, k);\n FindPathLengths(graph);\n\n var solver = new Solver(n, c, d);\n\n foreach (var memberHome in memberHomes)\n solver.AddDiscontentForMember(graph[memberHome]);\n\n Console.WriteLine(solver.Discontent);\n }\n\n private static GraphNode[] ReadGraph(int n, int m, int k)\n {\n ++k;\n \n var graph = new GraphNode[n + 1];\n for (var i = 1; i <= n; i++)\n graph[i] = new GraphNode(i, m);\n\n for (var i = 0; i < m; i++)\n {\n var xy = Console.ReadLine().Split();\n var x = graph[int.Parse(xy[0])];\n var y = graph[int.Parse(xy[1])];\n \n x.Edges.Add(new Edge() { Node = y, TimeInfo = new TimeInfo(k) });\n y.Edges.Add(new Edge() { Node = x, TimeInfo = new TimeInfo(k) });\n }\n\n return graph;\n }\n\n private static void FindPathLengths(GraphNode[] graph)\n {\n var queue = new Queue(graph.Length);\n \n var node = graph[1];\n node.PathLength = 0;\n queue.Enqueue(node);\n\n while (queue.Count > 0)\n {\n node = queue.Dequeue();\n var newPathLength = node.PathLength + 1;\n \n foreach (var neighbour in node.Edges.Select(it => it.Node))\n {\n if (neighbour.PathLength <= newPathLength)\n continue;\n \n neighbour.PathLength = newPathLength;\n queue.Enqueue(neighbour);\n }\n }\n }\n }\n\n internal sealed class Solver\n {\n private readonly int _c, _d, _cPlusD;\n private readonly EdgeIndexWithTime[] _bestPath;\n\n private int _currentBestDiscontent, _bestPathLength;\n\n public Solver(int n, int c, int d)\n {\n _c = c;\n _d = d;\n _cPlusD = c + d;\n _bestPath = new EdgeIndexWithTime[n + 1];\n }\n \n public int Discontent { get; private set; }\n\n public void AddDiscontentForMember(GraphNode home)\n {\n _currentBestDiscontent = int.MaxValue;\n TryOptimize(home, 0, 0, 0);\n CommitBestPath(home);\n Discontent += _currentBestDiscontent;\n }\n\n private bool TryOptimize(GraphNode node, int time, int baseDiscontent, int bestPathIndex)\n {\n if (node.Id == 1)\n {\n if (baseDiscontent >= _currentBestDiscontent)\n return false;\n\n _bestPathLength = bestPathIndex;\n _currentBestDiscontent = baseDiscontent;\n return true;\n }\n\n node.AlreadyInCurrentPath = true;\n \n var optimized = false;\n\n var nextBestPathIndex = bestPathIndex + 1;\n \n for (var idealContinuationDiscontent = baseDiscontent + node.PathLength * _cPlusD; \n idealContinuationDiscontent < _currentBestDiscontent;\n idealContinuationDiscontent += _c, ++time)\n {\n var nextTime = time + 1;\n baseDiscontent += _c;\n\n for (var edgeIndex = 0; edgeIndex < node.Edges.Count; edgeIndex++)\n {\n var edge = node.Edges[edgeIndex];\n \n var neighbour = edge.Node;\n if (neighbour.AlreadyInCurrentPath)\n continue;\n \n var nextBaseDiscontent = baseDiscontent + \n CalculateDiscontentChange(edge.TimeInfo[time]);\n \n if (!TryOptimize(neighbour, nextTime, nextBaseDiscontent, nextBestPathIndex))\n continue;\n \n _bestPath[bestPathIndex] = new EdgeIndexWithTime() {EdgeIndex = edgeIndex, Time = time};\n optimized = true;\n }\n }\n\n node.AlreadyInCurrentPath = false;\n return optimized;\n }\n\n private void CommitBestPath(GraphNode current)\n {\n foreach (var edgeIndexWithTime in _bestPath.Take(_bestPathLength))\n {\n var edge = current.Edges[edgeIndexWithTime.EdgeIndex];\n ++edge.TimeInfo[edgeIndexWithTime.Time];\n current = edge.Node;\n }\n }\n\n private int CalculateDiscontentChange(int peopleWalkingTheSameTime)\n {\n var oldDiscontentD = peopleWalkingTheSameTime * peopleWalkingTheSameTime * _d;\n ++peopleWalkingTheSameTime;\n var newDiscontentD = peopleWalkingTheSameTime * peopleWalkingTheSameTime * _d;\n return newDiscontentD - oldDiscontentD;\n }\n\n private struct EdgeIndexWithTime\n {\n public int EdgeIndex { get; set; }\n public int Time { get; set; }\n }\n }\n\n internal sealed class GraphNode : IEquatable\n {\n public GraphNode(int id, int m)\n {\n Id = id;\n Edges = new List(m);\n }\n \n public int Id { get; }\n\n public int PathLength { get; set; } = 1000;\n \n public bool AlreadyInCurrentPath { get; set; }\n \n public List Edges { get; }\n\n public bool Equals(GraphNode other) => Id == other?.Id;\n\n public override bool Equals(object obj) => obj is GraphNode graphNode && graphNode.Id == Id;\n\n public override int GetHashCode() => Id;\n }\n\n internal struct TimeInfo\n {\n private readonly int[] _peopleCounts;\n \n public TimeInfo(int capacity) { _peopleCounts = new int[capacity]; }\n\n public int this[int time]\n {\n get => _peopleCounts[time];\n set => _peopleCounts[time] = value;\n }\n }\n\n internal struct Edge\n {\n public GraphNode Node;\n public TimeInfo TimeInfo;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "582410482aa1532c388b17d3eacefed0", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "difficulty": 2500.0} {"lang": "Mono C#", "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 private const int MOD = 1000 * 1000 * 1000 + 7;\n private const int NMax = 1000;\n\n private static int k;\n private static int pA;\n private static int pB;\n private static int ipB;\n private static int[,] dp = new int[NMax, NMax];\n private static bool[,] marked = new bool[NMax, NMax];\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 int BinPow(int a, int n)\n {\n int result = 1;\n while (n > 0)\n {\n if (n % 2 == 1)\n {\n result = Mult(result, a);\n }\n a = Mult(a, a);\n n /= 2;\n }\n return result;\n }\n\n private static int Solve(int count, int tk)\n {\n if (tk >= k)\n {\n return tk;\n }\n if (count + tk >= k)\n {\n return Add(Add(count, tk), ipB);\n }\n if (marked[count, tk])\n {\n return dp[count, tk];\n }\n marked[count, tk] = true;\n dp[count, tk] = Add(Mult(Solve(count + 1, tk), pA), Mult(Solve(count, tk + count), pB));\n return dp[count, tk];\n }\n\n private static void Main(string[] args)\n {\n var values = Console.ReadLine().Split(' ');\n k = Convert.ToInt32(values[0]);\n int pa = Convert.ToInt32(values[1]);\n int pb = Convert.ToInt32(values[2]);\n pA = Mult(pa, BinPow(Add(pa, pb), MOD - 2));\n pB = Mult(pb, BinPow(Add(pa, pb), MOD - 2));\n ipB = Mult(pa, BinPow(pb, MOD - 2));\n Console.WriteLine(Solve(1, 0));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "809ea361600d28f1fe9f53a4fa9de5eb", "src_uid": "0dc9f5d75143a2bc744480de859188b4", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing Number = System.Int64;\nusing KV = System.Collections.Generic.KeyValuePair;\nnamespace Program {\n public class Solver {\n public void Solve() {\n var k = ri;\n var pa = ri;\n var pb = ri;\n var p = pa * ModInt.Inverse(pa + pb);\n\n var q = pb * ModInt.Inverse(pa + pb);\n var invq = ModInt.Inverse(q);\n var dp = new ModInt[k + 5, k + 5];\n for (int i = 0; i < k + 5; i++)\n for (int j = 0; j < k + 5; j++)\n dp[i, j].num = -1;\n Func dfs = null;\n dfs = (a, cnt) => {\n if (cnt >= k) return cnt;\n if (a + cnt >= k) {\n return cnt + a + invq - 1;\n }\n if (dp[a, cnt].num != -1) return dp[a, cnt];\n ModInt ret = new ModInt(0);\n // a \u3092\u51fa\u3059\n ret += p * dfs(a + 1, cnt);\n // b \u3092\u51fa\u3059\n ret += q * dfs(a, cnt + a);\n\n return dp[a, cnt] = ret;\n };\n Console.WriteLine(dfs(1, 0));\n\n }\n const long INF = 1L << 60;\n int[] dx = { -1, 0, 1, 0 };\n int[] dy = { 0, 1, 0, -1 };\n\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 var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f(i);\n return a;\n }\n\n static public void Swap(ref T a, ref T b) {\n var tmp = a;\n a = b;\n b = tmp;\n }\n }\n}\n\n#region main\n\nstatic class Ex {\n static public string AsString(this IEnumerable ie) {\n return new string(ie.ToArray());\n }\n\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n return string.Join(st, ie.Select(x => x.ToString()).ToArray());\n //return string.Join(st, ie);\n }\n\n static public void Main() {\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\n#endregion\n#region Ex\n\nnamespace Program.IO {\n using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer: StreamWriter {\n public override IFormatProvider FormatProvider {\n get { return CultureInfo.InvariantCulture; }\n }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner {\n public StreamScanner(Stream stream) {\n str = stream;\n }\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 {\n get { return isEof; }\n }\n\n private byte read() {\n if (isEof) return 0;\n if (ptr >= len) {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char() {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n\n public string Scan() {\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\n public string ScanLine() {\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\n public long Long() {\n return isEof ? long.MinValue : long.Parse(Scan());\n }\n\n public int Integer() {\n return isEof ? int.MinValue : int.Parse(Scan());\n }\n\n public double Double() {\n return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture);\n }\n }\n}\n\n#endregion\n\n\n#region ModInt\npublic struct ModInt {\n public const long Mod = (long)1e9 + 7;\n public long num;\n public ModInt(long n) { num = n; }\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((int)(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 public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }\n public static ModInt Pow(long v, long k) {\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 public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b8937f2ea3d666af414b5b7614c14acb", "src_uid": "0dc9f5d75143a2bc744480de859188b4", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Mysterious_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 string[] ss = reader.ReadLine().Split(' ');\n\n int n = int.Parse(ss[0]);\n int k = int.Parse(new string(ss[1].Reverse().ToArray()));\n\n writer.WriteLine(n + k);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9709be7700f1a8af16420577c844480a", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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 a = Convert.ToInt32(line[0]);\n\t\tvar b = Convert.ToInt32(line[1]);\n\t\tsolve(a,b);\n\t\t//tests();\n\t}\n\n\tpublic static void tests()\n\t{\n\t\tsolve(3, 14);\n\t\tsolve(27, 12);\n\t\tsolve(100, 200);\n\t\tsolve(31415,92653); //67044\n\t}\n\n\tpublic static void solve(int a, int b)\n\t{\n\t\tvar rev = reverse(b);\n\n\t\tConsole.WriteLine(a+rev);\n\t\t\n\t}\n\n\tpublic static int reverse(int n)\n\t{\n\t\tvar rev = 0;\n\t\twhile (n > 0)\n\t\t{\n\t\t\trev = rev * 10 + n % 10;\n\t\t\tn = n / 10;\n\t\t}\n\t\treturn rev;\n\t}\n\t\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b44e176a9195cbb083a3ad62a273b97", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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, b;\n string str;\n string[] s = new string[2];\n str = Console.ReadLine();\n s = str.Split();\n a = long.Parse(s[0]);\n char[] arr = s[1].ToCharArray();\n Array.Reverse(arr);\n string ss = new string(arr);\n b = long.Parse(ss); \n \n Console.WriteLine(a + b);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b5d1e9d360b4407947d423b37c3cfb87", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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 171A\")]\n#endif\n\tclass Task171A\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\tstring n, m;\n\t\t\tinput.Line().Read(out n).Read(out m);\n\t\t\toutput.WriteLine(int.Parse(n) + int.Parse(new String(m.Reverse().ToArray())));\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171A();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2dc78fdd0bd2b94089ce554d8eebcf64", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n static void Main()\n {\n string[] inp = Console.ReadLine().Split(' ');\n char[] s = inp[0].ToCharArray();\n char[] b = inp[1].ToCharArray();\n for (int i = 0; i <= b.GetUpperBound(0)/2; i++)\n {\n char swap = b[i];\n b[i] = b[b.GetUpperBound(0) - i];\n b[b.GetUpperBound(0) - i] = swap;\n }\n string a = \"\";\n string g = \"\";\n for (int i = 0; i <= b.GetUpperBound(0); i++)\n {\n a += b[i];\n }\n for (int i = 0; i <= s.GetUpperBound(0); i++)\n {\n g += s[i];\n }\n int outy = int.Parse(a) + int.Parse(g);\n Console.WriteLine(outy);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "370f9cf186c5bbd42223aec17cfaca7c", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass P { \n static void Main(){ \n var s = Console.ReadLine().Split(' ');\n var res = long.Parse(s[0]) + long.Parse(new string(s[1].Reverse().ToArray()));\n Console.Write(res);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9740501377f762acc55ce795c823f17d", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\n class Program\n {\n public static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n char[] data = input[1].ToCharArray();\n {\n char temp;\n for (int i = data.Length - 1, j = 0, lim = data.Length / 2; j < lim; ++j, --i)\n {\n temp = data[i];\n data[i] = data[j];\n data[j] = temp;\n }\n }\n Console.WriteLine((int.Parse(input[0])+int.Parse(new string(data))));\n }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f5976c8568309bbcffdbac4ca03bfc29", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 string input = Console.ReadLine();\n string[] inpvals = input.Split(' ');\n int a = int.Parse(inpvals[0]);\n int b = 0;\n if (inpvals[1] != \"0\")\n {\n List brr = inpvals[1].ToList();\n brr.Reverse();\n\n int zc = 0;\n while (brr[zc] == '0') zc++;\n StringBuilder srtb = new StringBuilder(brr.Count - zc);\n for (int i = zc; i < brr.Count; i++)\n {\n srtb.Append(brr[i]);\n }\n\n if (srtb.Length > 0)\n {\n b = int.Parse(srtb.ToString());\n }\n }\n Console.WriteLine(a + b); \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e5cf73f65bef0d48ffbebe965aca2a3b", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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 string[] str = Console.ReadLine().Split(' ');\n string h = str[0];\n string h1 = str[1];\n string h2 = \"\";\n for (int i = h1.Length - 1; i >= 0; i--)\n {\n h2 = h2 + h1[i];\n }\n long a = Int64.Parse(h);\n long b = Int64.Parse(h2);\n Console.WriteLine(a + b);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "75e604ce04374db8b1e2425531bf4f14", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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 input = ReadIntArray();\n var a = input[0];\n var b = input[1];\n var res = 0;\n while (b >= 1)\n {\n res = res*10 + (b%10);\n b/=10;\n }\n res += a;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "433c0d746a25c6be4ecdd991c2d88d2c", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication4\n{\n class Program\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 string q = ss[1];\n string w = \"\";\n for (int i = q.Length - 1; i >= 0; i--)\n {\n w += q[i];\n }\n Console.WriteLine(n+int.Parse(w));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ea1eb178d6fa7c35a0cf61894017c17d", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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, m;\n string s = Console.ReadLine();\n string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(p[0]);\n List ch = new List();\n\n string ss = p[1];\n\n for (int i = 0; i < p[1].Length; i++)\n ch.Add(ss[i]);\n ch.Reverse();\n ss = \"\";\n for (int i = 0; i < ch.Count; i++)\n ss += ch[i];\n //ss = Convert.ToString(ch);\n //Console.WriteLine(ss);\n m = Convert.ToInt32(ss);\n Console.WriteLine(n + m);\n }\n\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d0c2540c2b4f1b34677a5fe621f18d25", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeff\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[] input = Console.ReadLine().Split(new char[] {' '});\n int a = Convert.ToInt32(input[0]);\n \n\n StringBuilder str = new StringBuilder(input[1]);\n for (int i = 0; i < str.Length / 2; i++)\n {\n char t = str[i];\n str[i] = str[str.Length - 1 - i];\n str[str.Length - 1 - i] = t;\n }\n\n int b = Convert.ToInt32(str.ToString());\n Console.WriteLine(a + b);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "33035ea0ec44701e4682330fb56c9409", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static int ReadIntToSpace()\n {\n string temp = \"\";\n char c = (char)Console.Read();\n while (c != ' ')\n {\n temp += c;\n c = (char)Console.Read();\n }\n return int.Parse(temp);\n }\n static void Main(string[] args)\n {\n int a = ReadIntToSpace();\n int b = int.Parse(Console.ReadLine());\n int i;\n string bb =\"\";\n for (i = b.ToString().Length-1; i >=0; i--)\n {\n bb += b.ToString()[i];\n }\n Console.WriteLine(a+int.Parse(bb));\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc28fc1b77cd58611a1a8b531828134f", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "MS C#", "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 long a = ReadLong();\n long b = ReadLong();\n\n b = long.Parse(new string(b.ToString().Reverse().ToArray()));\n\n return a + b;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fcb1f76d7d4cb7931e9a76219ee59636", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 string input = Console.ReadLine();\n string[] inpvals = input.Split(' ');\n int a = int.Parse(inpvals[0]);\n List barr = inpvals[1].ToList();\n barr.Reverse();\n int zercount = 0;\n while (barr[zercount] == '0') zercount++;\n int l = inpvals[1].Length - zercount;\n StringBuilder strb = new StringBuilder(l);\n for (int i = 0; i < l; i++)\n {\n strb.Append(barr[zercount + i]);\n }\n string bs = strb.ToString();\n int b = 0;\n if (bs.Length > 0) b= int.Parse(bs);\n Console.Write(a + b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "406f8e6e84d506c5f8b0f4d4b50543a8", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n static void Main()\n {\n string[] inp = Console.ReadLine().Split(' ');\n char[] s = inp[0].ToCharArray();\n char[] b = inp[1].ToCharArray();\n for (int i = 0; i <= b.GetUpperBound(0)/2; i++)\n {\n char swap = b[i];\n b[i] = b[b.GetUpperBound(0) - i];\n b[b.GetUpperBound(0) - i] = swap;\n }\n string a = \"\";\n string g = \"\";\n for (int i = 0; i <= b.GetUpperBound(0); i++)\n {\n a += b[i];\n }\n for (int i = 0; i <= s.GetUpperBound(0); i++)\n {\n g += s[i];\n }\n int outy = int.Parse(a) + int.Parse(g);\n Console.WriteLine(outy);\n Console.ReadKey();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fd3e0f66c2d234ae057af3606741b1e3", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "MS C#", "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 a, b;\n a = Console.ReadLine();\n b = Console.ReadLine();\n\n StringBuilder str = new StringBuilder(b);\n for (int i = 0; i < str.Length / 2; i++)\n {\n char t = str[i];\n str[i] = str[str.Length - 1 - i];\n str[str.Length - 1 - i] = t;\n }\n\n b = str.ToString();\n Console.WriteLine(Convert.ToInt32(a) + Convert.ToInt32(b));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6f952405239f6156ddaddb5bff93580f", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 string input = Console.ReadLine();\n string[] inpvals = input.Split(' ');\n int a = int.Parse(inpvals[0]);\n List barr = inpvals[1].ToList();\n barr.Reverse();\n int zercount = 0;\n while (barr[zercount] == '0') zercount++;\n int l = inpvals[1].Length - zercount;\n StringBuilder strb = new StringBuilder(l);\n for (int i = 0; i < l; i++)\n {\n strb.Append(barr[zercount + i]);\n }\n int b = int.Parse(strb.ToString());\n Console.Write(a + b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbea4f48a18d27919b4d0bd13493b12e", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\nstatic void Main()\n{\nstring[] inp = Console.ReadLine().Split(' ');\nchar[] s = inp[0].ToCharArray();\nchar[] b = inp[1].ToCharArray();\nfor (int i = 0; i <= b.GetUpperBound(0); i++)\n{\nchar swap = b[i];\nb[i] = b[b.GetUpperBound(0) - i];\nb[b.GetUpperBound(0)-i] = swap;\n}\nint outy = int.Parse(s.ToString()) + int.Parse(b.ToString());\nConsole.WriteLine(outy);\n}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0500dff2de4c25cb387850a258f507b6", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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 a = Convert.ToInt32(line[0]);\n\t\tvar b = Convert.ToInt32(line[1]);\n\t\tsolve(a,b);\n\t\t//tests();\n\t}\n\n\tpublic static void tests()\n\t{\n\t\tsolve(3, 14);\n\t\tsolve(27, 12);\n\t\tsolve(100, 200);\n\t}\n\n\tpublic static void solve(int a, int b)\n\t{\n\t\tvar ast = a.ToString();\n\t\tvar bst = b.ToString();\n\t\tif (ast.Length > bst.Length)\n\t\t{\n\t\t\tbst = bst.PadLeft(ast.Length,'0');\n\t\t}\n\t\tif (bst.Length > ast.Length)\n\t\t{\n\t\t\tast = ast.PadLeft(bst.Length, '0');\n\t\t}\n\t\tvar res = \"\";\n\t\tvar n = ast.Length - 1;\n\t\t//Console.WriteLine(ast + \" \" + bst);\n\t\tfor (var i = 0; i <= n; i++)\n\t\t{\n\t\t\tres += (char.GetNumericValue(ast[i]) + char.GetNumericValue(bst[n-i])).ToString();\n\t\t}\n\n\t\tConsole.WriteLine(res);\n\t\t\n\t}\n\n\t\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3140a2d0f4cf4bd993fae92c5834135d", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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 string[] str = Console.ReadLine().Split(' ');\n string h = str[0];\n string h1 = str[1];\n if (h.Length != h1.Length)\n {\n if (h.Length < h1.Length)\n {\n string q = h;\n h = q;\n }\n long qwe = h.Length - h1.Length;\n for (int i = 0; i < qwe; i++)\n {\n h1 = \"0\" + h1;\n }\n }\n string h2 = \"\";\n for (int i = h1.Length - 1; i >= 0; i--)\n {\n h2 = h2 + h1[i];\n }\n Console.WriteLine(Int64.Parse(h) + Int64.Parse(h2));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "91dc2cf9d433b181701c9ff583779453", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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, m;\n string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n Console.WriteLine(44);\n \n }\n\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "52b08f353de04cc33c8382e8f4893c35", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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 private static void Solve()\n {\n var input = ReadArray();\n var res = Convert.ToInt32(input[0]);\n\n var r2 = Convert.ToInt32(string.Join(\"\", input[1].ToCharArray().Reverse().ToArray()));\n\n Console.WriteLine(res+r2);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ff20709ca89ac8f533a2cc754052bb42", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "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 private static void Solve()\n {\n var input = ReadArray();\n var res = Convert.ToInt32(input[0]);\n\n var r2 = Convert.ToInt32(string.Join(\"\", input[1].ToCharArray().Reverse()));\n\n Console.WriteLine(res+r2);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2d399a925d3baa182a296bd8dec8e082", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "/* Date: 14.04.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\\\\030\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2018\\\\Task\\\\07 Codeforces\\\\030\\\\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\t\tsw.WriteLine (\"n = \" + n);\n# endif\n\n\t\tstring [] mapA = new string [n];\n\n\t\tfor ( int i=0; i < n; i++ )\n\t\t{\n# if ( ONLINE_JUDGE )\n\t\t\tmapA [i] = Console.ReadLine ();\n# else\n\t\t\tmapA [i] = sr.ReadLine ();\n# endif\n\t\t}\n\n\t\tstring [] mapB = new string [n];\n\n\t\tfor ( int i=0; i < n; i++ )\n\t\t{\n# if ( ONLINE_JUDGE )\n\t\t\tmapB [i] = Console.ReadLine ();\n# else\n\t\t\tmapB [i] = sr.ReadLine ();\n# endif\n\t\t}\n\n# if ( ! ONLINE_JUDGE )\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tsw.WriteLine (mapA [i]);\n\t\tsw.WriteLine ();\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tsw.WriteLine (mapB [i]);\n\t\tsw.WriteLine ();\n# endif\n\n\t\t//\n\t\tbool ok1 = true;\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\tif ( mapA [i][j] != mapB [i][n-j-1] )\n\t\t\t\t{\n\t\t\t\t\tok1 = false; break;\n\t\t\t\t}\n\t\t\tif ( ! ok1 )\n\t\t\t\tbreak;\n\t\t}\n\t\t//\n\t\tbool ok2 = true;\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\tif ( mapA [i][j] != mapB [n-1-i][j] )\n\t\t\t\t{\n\t\t\t\t\tok2 = false; break;\n\t\t\t\t}\n\t\t\tif ( ! ok2 )\n\t\t\t\tbreak;\n\t\t}\n\t\t//\n\t\tbool ok3 = true;\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\tif ( mapA [i][j] != mapB [n-1-i][n-1-j] )\n\t\t\t\t{\n\t\t\t\t\tok3 = false; break;\n\t\t\t\t}\n\t\t\tif ( ! ok3 )\n\t\t\t\tbreak;\n\t\t}\n\t\t//\n\t\tbool ok4 = true;\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\tif ( mapA [i][j] != mapB [j][n-1-i] )\n\t\t\t\t{\n\t\t\t\t\tok4 = false; break;\n\t\t\t\t}\n\t\t\tif ( ! ok4 )\n\t\t\t\tbreak;\n\t\t}\n\t\t//\n\t\tbool ok5 = true;\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\tif ( mapA [j][n-1-i] != mapB [i][j] )\n\t\t\t\t{\n\t\t\t\t\tok5 = false; break;\n\t\t\t\t}\n\t\t\tif ( ! ok5 )\n\t\t\t\tbreak;\n\t\t}\n\t\t//\n\t\tbool ok6 = true;\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\tif ( mapA [j][i] != mapB [i][j] )\n\t\t\t\t{\n\t\t\t\t\tok6 = false; break;\n\t\t\t\t}\n\t\t\tif ( ! ok6 )\n\t\t\t\tbreak;\n\t\t}\n\t\t//\n\t\tbool ok7 = true;\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\tif ( mapA [n-1-j][n-1-i] != mapB [i][j] )\n\t\t\t\t{\n\t\t\t\t\tok7 = false; break;\n\t\t\t\t}\n\t\t\tif ( ! ok7 )\n\t\t\t\tbreak;\n\t\t}\n\t\t//\n\t\tbool ok = ok1 || ok2 || ok3 || ok4 || ok5 || ok6 || ok7;\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\n\t}\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9d0f27d3c14701e6f388a28436599d4b", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace starwars\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n \n n = Convert.ToInt32 (Console.ReadLine());\n char[,] array1 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n char[] temp = Console.ReadLine().ToCharArray();\n for (int j = 0; j <= n - 1; j++)\n {\n array1[i, j] = temp[j];\n }\n }\n char[,] array2 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n char[] temp = Console.ReadLine().ToCharArray();\n for (int j = 0; j <= n - 1; j++)\n {\n array2[i, j] = temp[j];\n }\n }\n\n\n char[,] t90 = new char[n, n];\n for(int i = 0; i<=n-1;i++)\n {\n for (int j = 0; j <= n - 1; j++)\n t90[j, n - 1 - i] = array1[i, j];\n }\n\n char[,] t180 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n t180[j, n - 1 - i] = t90[i, j];\n }\n\n char[,] t270 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j<=n-1; j++)\n t270[j, n - 1 - i] = t180[i, j];\n }\n\n char[,] flippGorarray1 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippGorarray1[n - 1 - i, j] = array1[i, j];\n }\n\n char[,] flippvertarray1 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippvertarray1[i, n-1-j] = array1[i, j];\n }\n\n char[,] flippGort90 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippGort90[n - 1 - i, j] = t90[i, j];\n }\n\n char[,] flippvert90 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippvert90[i, n - 1 - j] = t90[i, j];\n }\n\n char[,] flippGort180 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippGort180[n - 1 - i, j] = t180[i, j];\n }\n\n char[,] flippvert180 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippvert180[i, n - 1 - j] = t180[i, j];\n }\n\n char[,] flippGorart270 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippGorart270[n - 1 - i, j] = t270[i, j];\n }\n\n char[,] flippvert270 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippvert270[i, n - 1 - j] = t270[i, j];\n }\n \n\n\n if (array2.ToString()== array1.ToString() || array2.ToString()== t90.ToString() || array2.ToString()== t180.ToString() ||\n array2.ToString()== t270.ToString() ||\n array2.ToString()== flippGorarray1.ToString() || array2.ToString()== flippvertarray1.ToString() ||\n array2.ToString() == flippGort90.ToString()||\n array2.ToString() == flippvert90.ToString()|| array2.ToString() == flippGort180.ToString() ||\n array2.ToString() == flippvert180.ToString()||\n array2.ToString() == flippGorart270.ToString() || array2.ToString() == flippvert270.ToString())\n {\n Console.WriteLine(\"Yes\");\n }\n else Console.WriteLine(\"No\");\n\n\n }\n\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "97f2d595babca8a1e73e3bec2742b7cd", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "difficulty": 1400.0} {"lang": "Mono C#", "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 char[,] ReadMap(int n)\n {\n var ans = new char[n, n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n ans[i, j] = ReadLetter();\n return ans;\n }\n\n private static char[,] Rotate(char[,] m, int n)\n {\n var newMap = new char[n, n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n newMap[j, n - i - 1] = m[i, j];\n }\n\n return newMap;\n }\n\n private static bool IsSame(char[,] m1, char[,] m2, int n)\n {\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (m1[i, j] != m2[i, j]) return false;\n\n return true;\n }\n\n private static bool Compare(char[,] m1, char[,] m2, int n)\n {\n return IsSame(m1, Flip(m2, n, false, false), n) ||\n IsSame(m1, Flip(m2, n, true, false), n) ||\n IsSame(m1, Flip(m2, n, false, true), n) ||\n IsSame(m1, Flip(m2, n, true, true), n);\n }\n\n\n private static char[,] Flip(char[,] m, int n, bool byX, bool byY)\n {\n var newMap = new char[n, n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n var newX = i;\n var newY = j;\n if (byX) newX = n - i - 1;\n if (byY) newY = n - j - 1;\n\n newMap[newX, newY] = m[i, j];\n }\n\n return newMap;\n }\n\n\n private static void Print(char[,] m, int n)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n Console.Write(m[i, j] + \" \");\n\n Console.WriteLine();\n }\n Console.WriteLine();\n }\n\n private static void Main(string[] args)\n {\n PushTestData(@\"\n\n2\nXX\nOO\nXO\nOX\n\");\n\n var n = RI();\n var m1 = ReadMap(n);\n var m2 = ReadMap(n);\n for (int i = 0; i < 5; i++)\n {/*\n Print(m1, n);\n Print(m2, n);\n Console.WriteLine();\n Console.WriteLine();*/\n if (Compare(m1, m2, n))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n m2 = Rotate(m2, n);\n }\n\n Console.WriteLine(\"No\");\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\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\n private static List[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "195e496bb88d5c8bd3b7352b069763ff", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace starwars\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n \n n = Convert.ToInt32 (Console.ReadLine());\n char[,] array1 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n char[] temp = Console.ReadLine().ToCharArray();\n for (int j = 0; j <= n - 1; j++)\n {\n array1[i, j] = temp[j];\n }\n }\n char[,] array2 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n char[] temp = Console.ReadLine().ToCharArray();\n for (int j = 0; j <= n - 1; j++)\n {\n array2[i, j] = temp[j];\n }\n }\n\n\n char[,] t90 = new char[n, n];\n for(int i = 0; i<=n-1;i++)\n {\n for (int j = 0; j <= n - 1; j++)\n t90[j, n - 1 - i] = array1[i, j];\n }\n\n char[,] t180 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n t180[j, n - 1 - i] = t90[i, j];\n }\n\n char[,] t270 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j<=n-1; j++)\n t270[j, n - 1 - i] = t180[i, j];\n }\n\n char[,] flippGorarray1 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippGorarray1[n - 1 - i, j] = array1[i, j];\n }\n\n char[,] flippvertarray1 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippvertarray1[i, n-1-j] = array1[i, j];\n }\n\n char[,] flippGort90 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippGort90[n - 1 - i, j] = t90[i, j];\n }\n\n char[,] flippvert90 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippvert90[i, n - 1 - j] = t90[i, j];\n }\n\n char[,] flippGort180 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippGort180[n - 1 - i, j] = t180[i, j];\n }\n\n char[,] flippvert180 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippvert180[i, n - 1 - j] = t180[i, j];\n }\n\n char[,] flippGorart270 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippGorart270[n - 1 - i, j] = t270[i, j];\n }\n\n char[,] flippvert270 = new char[n, n];\n for (int i = 0; i <= n - 1; i++)\n {\n for (int j = 0; j <= n - 1; j++)\n flippvert270[i, n - 1 - j] = t270[i, j];\n }\n\n\n\n if (Equal(array2, array1, n) ||\n Equal(array2, t90, n) ||\n Equal(array2, t180, n) ||\n Equal(array2, t270, n) ||\n Equal(array2, flippGorarray1, n) ||\n Equal(array2, flippvertarray1, n) ||\n Equal(array2, flippGort90, n) ||\n Equal(array2, flippvert90, n) ||\n Equal(array2, flippGort180, n) ||\n Equal(array2, flippvert180, n) ||\n Equal(array2, flippGorart270, n) ||\n Equal(array2, flippvert270, n) )\n {\n Console.WriteLine(\"Yes\");\n }\n else Console.WriteLine(\"No\");\n\n\n }\n static bool Equal(char[,]ar1, char[,] ar2, int n)\n {\n for (int i = 0; i < n;i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (ar1[i, j] != ar2[i, j])\n {\n return false;\n \n }\n }\n\n }\n return true;\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f737e3fe86db096871333db16c30ae3b", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "difficulty": 1400.0} {"lang": "Mono C#", "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[] firstLine = Console.ReadLine().Split(' ');\n int n = int.Parse(firstLine[0]);\n int m = int.Parse(firstLine[1]);\n int k = Math.Min(n, int.Parse(firstLine[2]));\n if (k % 2 == 0)\n {\n if (n == 4)\n {\n Console.WriteLine(m * m);\n } else\n {\n Console.WriteLine(m);\n }\n } else\n {\n Console.WriteLine(m * m);\n }\n\n }\n\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8e80e3a6688ff869caea6fba218ca35", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class E\n{\n public partial class Myon\n {\n\n static void Main()\n {\n E p = new E();\n p.solve();\n }\n\n }\n\n const int mod = (int)(1e9 + 7 + 1e-9);\n public void solve()\n {\n int[] tmp = intSplit(' ');\n int n = tmp[0];\n int m = tmp[1];\n int k = tmp[2];\n\n if (k == 1 || k > n)\n Console.WriteLine(ModPow(m, n, mod));\n else if (k == n)\n Console.WriteLine(ModPow(m, (n + 1) >> 1, mod));\n else if ((k & 1) == 1)\n Console.WriteLine(m);\n else\n Console.WriteLine((long)m * m % mod);\n }\n\n /// \n /// varified by CodeForces 104 DIV2 E LuckySubsequence\n /// %mod \u306b\u304a\u3051\u308b a \u306e n \u4e57\u3092\u6c42\u3081\u308b\n /// O(log n )\n /// \n /// \u51aa\u4e57\u3055\u308c\u308b\u5024\n /// \u51aa\n /// a^n\n public static long ModPow(long a, long n, int mod)\n {\n long res = 1;\n long tmp = a;\n for (; n > 0; n >>= 1)\n {\n if ((n & 1) == 1)\n res = res * tmp % mod;\n tmp = tmp * tmp % mod;\n }\n return res;\n }//ModPow\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6332c4e1129e4d436473d04c616920b", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class C\n {\n private static bool s_time = false;\n\n public static IList Factors(int n)\n {\n List ret = new List();\n for (int p = 2; p * p <= n; ++p)\n {\n if (n % p == 0)\n {\n n /= p;\n int[] factor = new int[] { p, 1 };\n ret.Add(factor);\n while (n % p == 0)\n {\n n /= p;\n factor[1]++;\n }\n }\n }\n if (n > 1) ret[ret.Count - 1][1]++;\n return ret;\n }\n\n private static object Go()\n {\n int N = GetInt();\n\n IList factors = Factors(N);\n if (factors.Count >= 2)\n {\n if (N == factors[0][0] * factors[1][0]) return 2;\n Wl(\"1\");\n return factors[0][0] * factors[1][0];\n }\n if (factors.Count == 0 || factors[0][1] < 2)\n {\n Wl(\"1\");\n return 0;\n }\n if (factors[0][1] == 2) return 2;\n Wl(1);\n return factors[0][0] * factors[0][0];\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n DateTime start = DateTime.Now;\n object output = Go();\n TimeSpan duration = DateTime.Now.Subtract(start);\n if (output != null)\n Wl(output.ToString());\n if (s_time)\n Wl(duration);\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 : 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f70252867f53e1af85e8508b999e47f7", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\n\n\npublic class BlackWhiteMagic {\n\n public static void Main()\n {\n string[] ss = Console.ReadLine().Split();\n\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n int k = int.Parse(ss[2]);\n\n long res = 1;\n\n if (k>n)\n {\n for (int i = 0; i < n; i++) res = (res * m) % 1000000007;\n }\n else if (k == n)\n {\n for (int i = 0; i < (n + 1) / 2; i++) res = (res * m) % 1000000007;\n }\n else\n {\n if (k%2 == 0) res = m;\n else res = m > 1 ? m*(m - 1) : 1;\n }\n\n Console.WriteLine(res);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1b35bc3eab02bc7830cb8a03745b4405", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 bool s_time = false;\n\n private static long mod = 1000000007;\n private static long pow(long a, long b)\n {\n long ret = 1;\n for (int i = 0; i < b; i++)\n {\n ret = (ret * a) % mod;\n }\n return ret;\n }\n\n private static object Go()\n {\n int ret = 1;\n\n int n = GetInt();\n int m = GetInt();\n int k = GetInt();\n\n if (n < k) return 0;\n if (k == 1)\n return pow(m, n);\n if (n == k)\n {\n return pow(m, (n + 1) / 2);\n }\n if (k == 2)\n return m;\n if (k == 3)\n return (m + m * (m - 1)) % mod;\n if (k % 2 == 0)\n return m;\n return (m + m * (m - 1)) % mod;\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n DateTime start = DateTime.Now;\n object output = Go();\n TimeSpan duration = DateTime.Now.Subtract(start);\n if (output != null)\n Wl(output.ToString());\n if (s_time)\n Wl(duration);\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 : 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1005371693f86fae131b3e5226281fdc", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\n\n\npublic class BlackWhiteMagic {\n\n public static void Main()\n {\n string[] ss = Console.ReadLine().Split();\n\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n int k = int.Parse(ss[2]);\n\n long res = 1;\n\n if (k>n)\n {\n for (int i = 0; i < n; i++) res = (res * m) % 1000000007;\n }\n else if (k == n)\n {\n for (int i = 0; i < (n + 1) / 2; i++) res = (res * m) % 1000000007;\n }\n else\n {\n if (k%2 == 0) res = m;\n else res = m*m;\n }\n\n Console.WriteLine(res);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b34a90ccdaa51b77fbe22120b48adb9b", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 bool s_time = false;\n\n private static long mod = 1000000007;\n private static long pow(long a, long b)\n {\n long ret = 1;\n for (int i = 0; i < b; i++)\n {\n ret = (ret * a) % mod;\n }\n return ret;\n }\n\n private static object Go()\n {\n int ret = 1;\n\n int n = GetInt();\n int m = GetInt();\n int k = GetInt();\n\n if (n < k) return 0;\n if (n == k)\n {\n return pow(m, (n + 1) / 2);\n }\n if (k == 1)\n return pow(m, n);\n if (k == 2)\n return m;\n if (k == 3)\n return (m + m * (m - 1)) % mod;\n if (k % 2 == 0)\n return m;\n return (m + m * (m - 1)) % mod;\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n DateTime start = DateTime.Now;\n object output = Go();\n TimeSpan duration = DateTime.Now.Subtract(start);\n if (output != null)\n Wl(output.ToString());\n if (s_time)\n Wl(duration);\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 : 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "24d6b79072f3dff2c092d42e24dd6bf7", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Quantity_of_Strings\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 int n = Next();\n int m = Next();\n int k = Next();\n\n if (k == 1)\n {\n writer.WriteLine(Pow(m, n));\n }\n else if (k == n)\n {\n writer.WriteLine(Pow(m, (n + 1)/2));\n }\n else if (k > n)\n {\n writer.WriteLine(\"0\");\n }\n else\n {\n writer.WriteLine(m);\n }\n\n writer.Flush();\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bcca1eddf2dfa22d06c51d22877c84e8", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Quantity_of_Strings\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 int n = Next();\n int m = Next();\n int k = Next();\n\n if (k == 1)\n {\n writer.WriteLine(Pow(m, n));\n }\n else if (k == n)\n {\n writer.WriteLine(Pow(m, (n + 1)/2));\n }\n else if (k > n)\n {\n writer.WriteLine(Pow(m, n));\n }\n else\n {\n writer.WriteLine(m);\n }\n\n writer.Flush();\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a8533e31cf8082883307b2ec138b794b", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\n\n\npublic class BlackWhiteMagic {\n\n public static void Main()\n {\n string[] ss = Console.ReadLine().Split();\n\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n int k = int.Parse(ss[2]);\n\n long res = 0;\n if (k % 2 == 0) res = m;\n else res = m > 1 ? m*(m - 1) : 1;\n\n Console.WriteLine(res);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6a5f6e00712b5f457552da06c661aed7", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.IO;\n\nnamespace Main\n{\n internal class Program\n {\n public static void Main(String[] args)\n {\n// Console.SetIn(new StreamReader(\"c:\\\\a.txt\"));\n\n String[] tok = Console.ReadLine().Split(' ');\n\n Console.WriteLine(TotalCombination(int.Parse(tok[0]), int.Parse(tok[1]), int.Parse(tok[2])));\n }\n\n private static long TotalCombination(int n, int m, int k)\n {\n const int modVal = 1000000007;\n\n if (k == 1)\n return ModPow(m, n, modVal);\n\n if (k == n)\n return ModPow(m, (n + 1) >> 1, modVal);\n\n if (k % 2 == 1)\n return (m*m)%modVal;\n\n return m;\n }\n\n private static long ModPow(int b, int p, int modVal)\n {\n if (p == 0)\n return 1;\n\n long temp = ModPow(b, p >> 1, modVal);\n\n temp = (temp*temp)%modVal;\n\n if (p % 2 == 0)\n return temp;\n\n return (temp*b)%modVal;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "42cb4e9a7c76b3d6a2e76405b846efac", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 bool s_time = false;\n\n private static long mod = 1000000007;\n private static long pow(long a, long b)\n {\n long ret = 1;\n for (int i = 0; i < b; i++)\n {\n ret = (ret * a) % mod;\n }\n return ret;\n }\n\n private static object Go()\n {\n int ret = 1;\n\n int n = GetInt();\n int m = GetInt();\n int k = GetInt();\n\n if (n < k) return 0;\n if (k == 1)\n return pow(m, n);\n if (k == 2)\n return m;\n if (k == 3)\n return (m + m * (m - 1)) % mod;\n if (n == k)\n {\n return pow(m, (n + 1) / 2);\n }\n if (k % 2 == 0)\n return m;\n return (m + m * (m - 1)) % mod;\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n DateTime start = DateTime.Now;\n object output = Go();\n TimeSpan duration = DateTime.Now.Subtract(start);\n if (output != null)\n Wl(output.ToString());\n if (s_time)\n Wl(duration);\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 : 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fa529a2b09fec92e84863b6a4e5b8a52", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 int[] a = GetInts();\n\n long n = a[0], m = a[1], k = a[2];\n\n long ans = 1;\n long t = 1000000007;\n\n if (n == k || k == 1)\n {\n long max = k == 1 ? n : (n/2 + n%2);\n for (int i = 1; i <= max; ++ i)\n {\n ans *= m;\n if (ans > t) ans %= t;\n }\n }\n else if (n < k)\n ans = 0;\n else if (m == 1)\n ans = 1;\n else\n {\n if (k >= 4) \n ans = m;\n else if (k == 3) \n ans = m * m;\n else if (k == 2)\n ans = m;\n }\n\n WL(ans);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cdb0ad9055213d3ef43d47cc42af65c8", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 List divs;\n private static void Main()\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 if(m == 1)\n {\n Console.WriteLine(1);\n return;\n }\n long res = 1;\n if(n < k)\n {\n for (int i = 0; i < n; i++)\n {\n res *= m;\n res %= MOD;\n }\n Console.WriteLine(res);\n return;\n }\n if(n == k)\n {\n for (int i = 0; i < n / 2 + (n %2); i++)\n {\n res *= m;\n res %= MOD;\n }\n Console.WriteLine(res);\n return;\n }\n if(k % 2 == 0)\n {\n Console.WriteLine(m);\n return;\n }\n Console.WriteLine(m*m);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3d7475d1b9cd8bb2bab3b69e01a4f277", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using 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 int[] a = GetInts();\n\n long n = a[0], m = a[1], k = a[2];\n\n long ans = 1;\n long t = 1000000007;\n\n if (n <= k || k == 1)\n {\n long max = k == 1 ? n : (n/2 + n%2);\n for (int i = 1; i <= max; ++ i)\n {\n ans *= m;\n if (ans > t) ans %= t;\n }\n }\n else if (n < k)\n ans = 0;\n else if (m == 1)\n ans = 1;\n else\n {\n if (k >= 4)\n ans = k % 2 == 0 ? m : m * m;\n else if (k == 3) \n ans = m * m;\n else if (k == 2)\n ans = m;\n\n }\n WL(ans);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "26fc1840c780751537b29135d170da36", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class D\n{\n public partial class Myon\n {\n\n static void Main()\n {\n D p = new D();\n p.solve();\n }\n\n }\n\n const int mod = 1000000007;\n public void solve()\n {\n int[] tmp = intSplit(' ');\n int n = tmp[0];\n int m = tmp[1];\n int k = tmp[2];\n\n if (k > n)\n {\n Console.WriteLine(0);\n return;\n }\n\n if (k == 1)\n {\n Console.WriteLine(ModPow(m,n,mod));\n return;\n }\n\n if (n == k)\n {\n Console.WriteLine(ModPow(m,n+1>>1,mod));\n return;\n }\n\n if ((k&1) == 0)\n {\n Console.WriteLine(m);\n return;\n }\n\n if ((k & 1) == 1)\n {\n Console.WriteLine((long)m*m%mod);\n return;\n }\n\n }\n\n /// \n /// varified by CodeForces 104 DIV2 E LuckySubsequence\n /// %mod \u306b\u304a\u3051\u308b a \u306e n \u4e57\u3092\u6c42\u3081\u308b\n /// O(log n )\n /// \n /// \u51aa\u4e57\u3055\u308c\u308b\u5024\n /// \u51aa\n /// a^n\n public static long ModPow(long a, long n, int mod)\n {\n long res = 1;\n long tmp = a;\n for (; n > 0; n >>= 1)\n {\n if ((n & 1) == 1)\n res = res * tmp % mod;\n tmp = tmp * tmp % mod;\n }\n return res;\n }//ModPow\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b5097acedcf8660b8155984b5164da41", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 List divs;\n private static void Main()\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 if(m == 1)\n {\n Console.WriteLine(1);\n return;\n }\n long res = 1;\n if(n < k || k==1)\n {\n for (int i = 0; i < n; i++)\n {\n res *= m;\n res %= MOD;\n }\n Console.WriteLine(res);\n return;\n }\n if(n == k)\n {\n for (int i = 0; i < n / 2 + (n %2); i++)\n {\n res *= m;\n res %= MOD;\n }\n Console.WriteLine(res);\n return;\n }\n if(k % 2 == 0)\n {\n Console.WriteLine(m);\n return;\n }\n Console.WriteLine(m*m);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c02bbdb4e9ec70afcdfe1597289a4346", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class E\n{\n public partial class Myon\n {\n\n static void Main()\n {\n E p = new E();\n p.solve();\n }\n\n }\n\n const int mod = (int)(1e9 + 7 + 1e-9);\n public void solve()\n {\n int[] tmp = intSplit(' ');\n int n = tmp[0];\n int m = tmp[1];\n int k = tmp[2];\n\n if (k == 1 || k > n)\n Console.WriteLine(ModPow(m, n, mod));\n else if (k == n)\n Console.WriteLine(ModPow(m, (n + 1) >> 1, mod));\n else if ((k & 1) == 1)\n Console.WriteLine((long)m * m % mod);\n else\n Console.WriteLine(m);\n }\n\n /// \n /// varified by CodeForces 104 DIV2 E LuckySubsequence\n /// %mod \u306b\u304a\u3051\u308b a \u306e n \u4e57\u3092\u6c42\u3081\u308b\n /// O(log n )\n /// \n /// \u51aa\u4e57\u3055\u308c\u308b\u5024\n /// \u51aa\n /// a^n\n public static long ModPow(long a, long n, int mod)\n {\n long res = 1;\n long tmp = a;\n for (; n > 0; n >>= 1)\n {\n if ((n & 1) == 1)\n res = res * tmp % mod;\n tmp = tmp * tmp % mod;\n }\n return res;\n }//ModPow\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ee74a9060cfcc25f0d945ac986cf0ad", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.IO;\n\nnamespace Main\n{\n internal class Program\n {\n public static void Main(String[] args)\n {\n// Console.SetIn(new StreamReader(\"c:\\\\a.txt\"));\n\n String[] tok = Console.ReadLine().Split(' ');\n\n Console.WriteLine(TotalCombination(int.Parse(tok[0]), int.Parse(tok[1]), int.Parse(tok[2])));\n }\n\n private static long TotalCombination(int n, int m, int k)\n {\n const int modVal = 1000000007;\n\n if (k == 1 || k > n)\n return ModPow(m, n, modVal);\n\n if (k == n)\n return ModPow(m, (n + 1) >> 1, modVal);\n\n if (k % 2 == 1)\n return (m*m)%modVal;\n\n return m;\n }\n\n private static long ModPow(int b, int p, int modVal)\n {\n if (p == 0)\n return 1;\n\n long temp = ModPow(b, p >> 1, modVal);\n\n temp = (temp*temp)%modVal;\n\n if (p % 2 == 0)\n return temp;\n\n return (temp*b)%modVal;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9b6569129a75dfea578940763042b9ed", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 const Int64 mod = 1000000007;\n string[] t = Console.ReadLine().Split(\n new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(t[0]);\n int m = int.Parse(t[1]);\n int k = int.Parse(t[2]);\n if (n == k)\n {\n Int64 res = 1;\n for (int i = 0; i < n / 2 + n % 2; i++)\n res = (res * m) % mod;\n Console.WriteLine(res);\n return;\n }\n if ((k > n) || (k == 1))\n {\n Int64 res = 1;\n for (int i = 0; i < n; i++)\n res = (res * m) % mod;\n Console.WriteLine(res);\n return;\n }\n if (k % 2 == 0)\n {\n Console.WriteLine(m);\n return;\n }\n Console.WriteLine(m * m);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "199e743ef9c9de788eb6d7174870c868", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 List divs;\n private static void Main()\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 if(m == 1)\n {\n Console.WriteLine(1);\n return;\n }\n long res = 1;\n if(n < k || k==1)\n {\n for (int i = 0; i < n; i++)\n {\n res *= m;\n res %= MOD;\n }\n Console.WriteLine(res);\n return;\n }\n if(n == k)\n {\n for (int i = 0; i < n / 2 + (n %2); i++)\n {\n res *= m;\n res %= MOD;\n }\n Console.WriteLine(res);\n return;\n }\n if(k % 2 == 0)\n {\n Console.WriteLine(m);\n return;\n }\n Console.WriteLine(m*m);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "570b32b73faf78537ae59a1b86b0103a", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Quantity_of_Strings\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 int n = Next();\n int m = Next();\n int k = Next();\n\n if (k == 1)\n {\n writer.WriteLine(Pow(m, n));\n }\n else if (k == n)\n {\n writer.WriteLine(Pow(m, (n + 1)/2));\n }\n else if (k > n)\n {\n writer.WriteLine(Pow(m, n));\n }\n else\n {\n if (k%2 == 1)\n writer.WriteLine(m*m);\n else\n writer.WriteLine(m);\n }\n\n writer.Flush();\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1be937ce93ea03775e1fd2970c0381a", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 CasketOfStar\n{\n\n public static void ans(int m, int n)\n {\n long k = 1;\n for (int i = 0; i < n; i++) {\n k *= m ;\n k %= 1000000007;\n } \n Console.WriteLine(k);\n }\n \npublic static void Main(string[] args)\n {\n int [] arr = Console.ReadLine().Split().Select(s=>int.Parse(s)).ToArray();\n if(arr[2] == 1 || arr[2] > arr[0])\n {\n //m^n\n ans(arr[1], arr[0]);\n }\n else if(arr[2] == arr[0])\n {\n //m^(n+1)/2\n ans(arr[1], (arr[0]+1)/2);\n }\n else if(arr[2] % 2 ==0)\n {\n \n ans(arr[1], 1);\n }\n else\n {\n ans(arr[1], 2);\n \n }\n \n }\n \n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c2d368f028268dd6772121c9dc1242a", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class D\n{\n public partial class Myon\n {\n\n static void Main()\n {\n D p = new D();\n p.solve();\n }\n\n }\n\n const int mod = 1000000007;\n public void solve()\n {\n int[] tmp = intSplit(' ');\n int n = tmp[0];\n int m = tmp[1];\n int k = tmp[2];\n\n if (k>n||k == 1)\n {\n Console.WriteLine(ModPow(m,n,mod));\n return;\n }\n\n if (n == k)\n {\n Console.WriteLine(ModPow(m,n+1>>1,mod));\n return;\n }\n\n if ((k&1) == 0)\n {\n Console.WriteLine(m);\n return;\n }\n\n if ((k & 1) == 1)\n {\n Console.WriteLine((long)m*m%mod);\n return;\n }\n\n }\n\n /// \n /// varified by CodeForces 104 DIV2 E LuckySubsequence\n /// %mod \u306b\u304a\u3051\u308b a \u306e n \u4e57\u3092\u6c42\u3081\u308b\n /// O(log n )\n /// \n /// \u51aa\u4e57\u3055\u308c\u308b\u5024\n /// \u51aa\n /// a^n\n public static long ModPow(long a, long n, int mod)\n {\n long res = 1;\n long tmp = a;\n for (; n > 0; n >>= 1)\n {\n if ((n & 1) == 1)\n res = res * tmp % mod;\n tmp = tmp * tmp % mod;\n }\n return res;\n }//ModPow\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "df2e46a62d35664c4f52814d39576d5f", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 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 int LengthOfWord = int.Parse(data[0]);\n int alphabetSize = int.Parse(data[1]);\n int requiredPalindromLength = int.Parse(data[2]);\n if (requiredPalindromLength > LengthOfWord)\n {\n Console.WriteLine(ModPow(alphabetSize, LengthOfWord));\n return;\n }\n\n Dsu dsu = new Dsu(LengthOfWord + 1);\n if (requiredPalindromLength % 2 == 0)\n {\n \n for (int center = 1; center <= LengthOfWord; center++)\n {\n if (Math.Min(center, LengthOfWord - center) >= requiredPalindromLength / 2)\n {\n for (int count = 0; count < requiredPalindromLength / 2; count++)\n {\n dsu.Unite(center - count, center + count + 1);\n }\n }\n }\n } else\n {\n for (int center = 1; center <= LengthOfWord; center++)\n {\n if (Math.Min(center - 1, LengthOfWord - center) >= requiredPalindromLength / 2)\n {\n dsu.Unite(center, center);\n for (int count = 1; count <= requiredPalindromLength / 2; count++)\n {\n dsu.Unite(center - count, center + count);\n }\n }\n }\n }\n\n Console.WriteLine(ModPow(alphabetSize, dsu.Rank.Count(s => s > 0) - 1));\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 struct Dsu\n {\n public int Vertices { get; set; }\n public int ConnectedComponent { get; set; }\n public int[] ParentOf { get; set; }\n public int[] Rank { get; set; }\n\n public Dsu(int vertices)\n {\n Vertices = vertices;\n ConnectedComponent = vertices;\n ParentOf = Enumerable.Range(0, vertices).ToArray();\n Rank = Enumerable.Range(0, vertices).Select(v => v = 1).ToArray();\n }\n\n public bool IsConnected(int from, int to)\n {\n return GetAncestor(from) == GetAncestor(to);\n }\n\n public int GetAncestor(int descended)\n {\n while (descended != ParentOf[descended]) descended = ParentOf[descended];\n return descended;\n }\n\n public void Unite(int from, int to)\n {\n int ancestorOfFrom = GetAncestor(from);\n int ancestorOfTo = GetAncestor(to);\n if (ancestorOfFrom == ancestorOfTo) return;\n ConnectedComponent--;\n if (Rank[ancestorOfFrom] > Rank[ancestorOfTo])\n {\n ParentOf[ancestorOfTo] = ParentOf[ancestorOfFrom];\n Rank[ancestorOfFrom] += Rank[ancestorOfTo];\n Rank[ancestorOfTo] = 0;\n } else\n {\n ParentOf[ancestorOfFrom] = ParentOf[ancestorOfTo];\n Rank[ancestorOfTo] += Rank[ancestorOfFrom];\n Rank[ancestorOfFrom] = 0;\n }\n }\n \n \n }\n\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "947f75719fe35ec5dc85aace5e03d515", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 bool s_time = false;\n\n private static long mod = 1000000007;\n private static long pow(long a, long b)\n {\n long ret = 1;\n for (int i = 0; i < b; i++)\n {\n ret = (ret * a) % mod;\n }\n return ret;\n }\n\n private static object Go()\n {\n int ret = 1;\n\n int n = GetInt();\n int m = GetInt();\n int k = GetInt();\n\n if (n < k || k == 1)\n return pow(m, n);\n if (n == k)\n return pow(m, (n + 1) / 2);\n if (k % 2 == 0)\n return m;\n\n return (m + m * (m - 1)) % mod;\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n DateTime start = DateTime.Now;\n object output = Go();\n TimeSpan duration = DateTime.Now.Subtract(start);\n if (output != null)\n Wl(output.ToString());\n if (s_time)\n Wl(duration);\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 : 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "44e82f832885554e5b2872c8edad27ad", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using 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 int[] a = GetInts();\n\n long n = a[0], m = a[1], k = a[2];\n\n long ans = 1;\n long t = 1000000007;\n\n if (n <= k || k == 1)\n {\n long max = (k == 1 || k > n) ? n : (n/2 + n%2);\n for (int i = 1; i <= max; ++ i)\n {\n ans *= m;\n if (ans > t) ans %= t;\n }\n }\n else if (m == 1)\n ans = 1;\n else\n {\n if (k >= 4)\n ans = k % 2 == 0 ? m : m * m;\n else if (k == 3) \n ans = m * m;\n else if (k == 2)\n ans = m;\n\n }\n WL(ans);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2d06d1a309770ad3fbf9e31048b2f57d", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "Mono C#", "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 bool s_time = false;\n\n private static long mod = 1000000007;\n private static long pow(long a, long b)\n {\n long ret = 1;\n for (int i = 0; i < b; i++)\n {\n ret = (ret * a) % mod;\n }\n return ret;\n }\n\n private static object Go()\n {\n int ret = 1;\n\n int n = GetInt();\n int m = GetInt();\n int k = GetInt();\n\n if (n < k)\n return pow(m, n);\n if (n == k)\n {\n return pow(m, (n + 1) / 2);\n }\n if (k % 2 == 0)\n return m;\n\n return (m + m * (m - 1)) % mod;\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n DateTime start = DateTime.Now;\n object output = Go();\n TimeSpan duration = DateTime.Now.Subtract(start);\n if (output != null)\n Wl(output.ToString());\n if (s_time)\n Wl(duration);\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 : 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "764596f83448acc8acec4a15d8c16b91", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "C# 8", "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 const int MAXN = 50;\r\n const int MAX_INV = MAXN * MAXN;\r\n\r\n public void Solve()\r\n {\r\n int n = ReadInt();\r\n int mod = ReadInt();\r\n\r\n var f = new long[n];\r\n f[0] = 1;\r\n for (int i = 1; i < n; i++)\r\n f[i] = f[i - 1] * i % mod;\r\n\r\n var d = new long[MAX_INV];\r\n d[0] = 1;\r\n int max = 0;\r\n long ans = 0;\r\n for (int i = 1; i < n; i++)\r\n {\r\n var nd = new long[MAX_INV];\r\n int nmax = max;\r\n for (int j = 0; j <= i; j++)\r\n for (int k = 0; k <= i; k++)\r\n {\r\n for (int p = 0; p <= max; p++)\r\n {\r\n int o = p + j - k;\r\n nmax = Math.Max(nmax, o);\r\n if (o >= 0)\r\n {\r\n nd[o] += d[p];\r\n if (j < k && o > 0)\r\n ans = (ans + f[n - i - 1] * d[p]) % mod;\r\n }\r\n if (p == 0)\r\n continue;\r\n o = -p + j - k;\r\n nmax = Math.Max(nmax, o);\r\n if (o >= 0)\r\n {\r\n nd[o] += d[p];\r\n if (j < k && o > 0)\r\n ans = (ans + f[n - i - 1] * d[p]) % mod;\r\n }\r\n }\r\n }\r\n max = nmax;\r\n d = nd;\r\n }\r\n\r\n Write(ans);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d9621a366ccc695df62ed7362b05aba6", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing static System.Math;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Globalization;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\nusing Library;\r\n\r\nnamespace Program\r\n{\r\n public static class ProblemE\r\n {\r\n static bool SAIKI = false;\r\n static public int numberOfRandomCases = 0;\r\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\r\n {\r\n }\r\n static public void Solve()\r\n {\r\n var n = NN;\r\n var mod = NN;\r\n var dp = new long?[n + 1, n * (n - 1) / 2 + 1];\r\n Func calc = null;\r\n calc = (pn, pk) =>\r\n {\r\n if (pn == 1 && pk == 0) return 1;\r\n if (pn < 0 || pk < 0 || pk > pn * (pn - 1) / 2) return 0;\r\n if (dp[pn, pk].HasValue) return dp[pn, pk].Value;\r\n dp[pn, pk] = (calc(pn, pk - 1) + calc(pn - 1, pk) + mod - calc(pn - 1, pk - pn)) % mod;\r\n return dp[pn, pk].Value;\r\n };\r\n var ans = 0L;\r\n for (var i = 0; i < n; ++i)\r\n {\r\n for (var j = i + 1; j < n; ++j)\r\n {\r\n var sabun = j - i + 1;\r\n var ten = (n - 1) * (n - 2) / 2;\r\n var sum = 0L;\r\n for (var k = 0; k + sabun <= ten; ++k)\r\n {\r\n sum = (sum + calc(n - 1, k)) % mod;\r\n ans += sum * calc(n - 1, k + sabun) % mod;\r\n ans %= mod;\r\n }\r\n }\r\n }\r\n Console.WriteLine(ans);\r\n }\r\n class Printer : StreamWriter\r\n {\r\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\r\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\r\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\r\n }\r\n static LIB_FastIO fastio = new LIB_FastIODebug();\r\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(); }\r\n static long NN => fastio.Long();\r\n static double ND => fastio.Double();\r\n static string NS => fastio.Scan();\r\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\r\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\r\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\r\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\r\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\r\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\r\n static IEnumerator _xsi = _xsc();\r\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; } }\r\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; }\r\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; }\r\n static void Fill(this T[] array, T value) => array.AsSpan().Fill(value);\r\n static void Fill(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);\r\n static void Fill(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);\r\n static void Fill(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);\r\n }\r\n}\r\nnamespace Library {\r\n class LIB_FastIO\r\n {\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\r\n readonly Stream str;\r\n readonly byte[] buf = new byte[2048];\r\n int len, ptr;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n byte read()\r\n {\r\n if (ptr >= len)\r\n {\r\n ptr = 0;\r\n if ((len = str.Read(buf, 0, 2048)) <= 0)\r\n {\r\n return 0;\r\n }\r\n }\r\n return buf[ptr++];\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n char Char()\r\n {\r\n byte b = 0;\r\n do b = read();\r\n while (b < 33 || 126 < b);\r\n return (char)b;\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public string Scan()\r\n {\r\n var sb = new StringBuilder();\r\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\r\n sb.Append(b);\r\n return sb.ToString();\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public long Long()\r\n {\r\n long ret = 0; byte b = 0; var ng = false;\r\n do b = read();\r\n while (b != '-' && (b < '0' || '9' < b));\r\n if (b == '-') { ng = true; b = read(); }\r\n for (; true; b = read())\r\n {\r\n if (b < '0' || '9' < b)\r\n return ng ? -ret : ret;\r\n else ret = (ret << 3) + (ret << 1) + b - '0';\r\n }\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\r\n }\r\n class LIB_FastIODebug : LIB_FastIO\r\n {\r\n Queue param = new Queue();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_FastIODebug() { }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override string Scan() => NextString();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override long Long() => long.Parse(NextString());\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override double Double() => double.Parse(NextString());\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "28108658cb6db9a5c99d76b109b5d07e", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0} {"lang": "C# 8", "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 CompLib.Algorithm;\r\n\r\npublic class Program\r\n{\r\n int N;\r\n int Mod;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n N = sc.NextInt();\r\n ModInt.Mod = sc.NextInt();\r\n\r\n var m = new ModInt[N + 1][];\r\n m[1] = new ModInt[1] { 1 };\r\n for (int i = 2; i <= N; i++)\r\n {\r\n // 1\u306e\u4f4d\u7f6e\r\n int max = (i - 1) * i / 2;\r\n m[i] = new ModInt[max + 1];\r\n\r\n for (int j = 0; j < i; j++)\r\n {\r\n for (int k = 0; k < m[i - 1].Length; k++)\r\n {\r\n m[i][j + k] += m[i - 1][k];\r\n }\r\n }\r\n }\r\n\r\n var m2 = new ModInt[N + 1][];\r\n for (int i = 1; i <= N; i++)\r\n {\r\n m2[i] = new ModInt[m[i].Length + 1];\r\n for (int j = 0; j < m[i].Length; j++)\r\n {\r\n m2[i][j + 1] = m2[i][j] + m[i][j];\r\n }\r\n }\r\n\r\n\r\n ModInt ans = 0;\r\n\r\n for (int i = 0; i <= N - 2; i++)\r\n {\r\n // \u5148\u982di\u500b\u540c\u3058\r\n // \u9078\u3073\u65b9\r\n ModInt q = 1;\r\n for (int j = 0; j < i; j++) q *= N - j;\r\n\r\n ModInt w = 0;\r\n // i\u500b\u76ee \r\n for (int j = 0; j < N - i; j++)\r\n {\r\n for (int k = 0; k < j; k++)\r\n {\r\n // \u6b8b\u308a N-i-1\u500b\u306e\u5206\u5e03 m[N-i-1]\r\n // i+1\u500b\u76ee\u306e\u8ee2\u5012\u6570\u3078\u306e\u5bc4\u4e0e j,k\r\n\r\n for (int l = j - k; l < m[N - i - 1].Length; l++)\r\n {\r\n w += m2[N - i - 1][l - (j - k)] * m[N - i - 1][l];\r\n }\r\n }\r\n }\r\n\r\n ans += q * w;\r\n }\r\n Console.WriteLine(ans);\r\n }\r\n /*\r\n 1 0\r\n 1\r\n 2 0\r\n 1 1\r\n 3 0\r\n 1 2 2 1\r\n 4 17\r\n 1 3 5 6 5 3 1\r\n 5 904\r\n 1 4 9 15 20 22 20 15 9 4 1\r\n 6 45926\r\n 1 5 14 29 49 71 90 101 101 90 71 49 29 14 5 1\r\n 7 2725016\r\n 1 6 20 49 98 169 259 359 455 531 573 573 531 455 359 259 169 98 49 20 6 1\r\n 8 196884712\r\n 1 7 27 76 174 343 602 961 1415 1940 2493 3017 3450 3736 3836 3736 3450 3017 2493 1940 1415 961 602 343 174 76 27 7 1 \r\n */\r\n\r\n void F(int n)\r\n {\r\n int[] p = new int[n];\r\n for (int i = 0; i < n; i++)\r\n {\r\n p[i] = i;\r\n }\r\n\r\n int[] cnt = new int[(n - 1) * n / 2 + 1];\r\n\r\n long ans = 0;\r\n do\r\n {\r\n int c = 0;\r\n for (int i = 0; i < n; i++)\r\n {\r\n for (int j = i + 1; j < n; j++)\r\n {\r\n if (p[i] > p[j]) c++;\r\n }\r\n }\r\n\r\n for (int i = c + 1; i < cnt.Length; i++)\r\n {\r\n ans += cnt[i];\r\n }\r\n\r\n cnt[c]++;\r\n } while (Algorithm.NextPermutation(p));\r\n\r\n Console.WriteLine($\"{n} {ans}\");\r\n Console.WriteLine(string.Join(\" \", cnt));\r\n\r\n // 5 9 14 20 27\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\r\n\r\nnamespace CompLib.Algorithm\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n public static partial class Algorithm\r\n {\r\n private static void Swap(ref T a, ref T b)\r\n {\r\n T tmp = a;\r\n a = b;\r\n b = tmp;\r\n }\r\n\r\n private static void Reverse(T[] array, int begin)\r\n {\r\n // [begin, array.Length)\u3092\u53cd\u8ee2\r\n if (array.Length - begin >= 2)\r\n {\r\n for (int i = begin, j = array.Length - 1; i < j; i++, j--)\r\n {\r\n Swap(ref array[i], ref array[j]);\r\n }\r\n }\r\n }\r\n\r\n /// \r\n /// array\u3092\u8f9e\u66f8\u9806\u3067\u6b21\u306e\u9806\u5217\u306b\u3059\u308b \u5b58\u5728\u3057\u306a\u3044\u3068\u304d\u306ffalse\u3092\u8fd4\u3059\r\n /// \r\n /// \r\n /// \r\n /// \r\n public static bool NextPermutation(T[] array, Comparison comparison)\r\n {\r\n for (int i = array.Length - 2; i >= 0; i--)\r\n {\r\n if (comparison(array[i], array[i + 1]) < 0)\r\n {\r\n int j = array.Length - 1;\r\n for (; j > i; j--)\r\n {\r\n if (comparison(array[i], array[j]) < 0)\r\n {\r\n break;\r\n }\r\n }\r\n\r\n Swap(ref array[i], ref array[j]);\r\n Reverse(array, i + 1);\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /// \r\n /// array\u3092\u8f9e\u66f8\u9806\u3067\u6b21\u306e\u9806\u5217\u306b\u3059\u308b \u5b58\u5728\u3057\u306a\u3044\u3068\u304d\u306ffalse\u3092\u8fd4\u3059\r\n /// \r\n /// \r\n /// \r\n /// \r\n public static bool NextPermutation(T[] array, Comparer comparer) =>\r\n NextPermutation(array, comparer.Compare);\r\n\r\n /// \r\n /// array\u3092\u8f9e\u66f8\u9806\u3067\u6b21\u306e\u9806\u5217\u306b\u3059\u308b \u5b58\u5728\u3057\u306a\u3044\u3068\u304d\u306ffalse\u3092\u8fd4\u3059\r\n /// \r\n /// \r\n /// \r\n /// \r\n public static bool NextPermutation(T[] array) => NextPermutation(array, Comparer.Default);\r\n }\r\n}\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 static 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "68f00a8d88ddb7cb040b1603b8a513dd", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing static System.Math;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Globalization;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\nusing Library;\r\n\r\nnamespace Program\r\n{\r\n public static class ProblemE\r\n {\r\n static bool SAIKI = false;\r\n static public int numberOfRandomCases = 0;\r\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\r\n {\r\n }\r\n static public void Solve()\r\n {\r\n var n = NN;\r\n var mod = (ulong)NN;\r\n var br = new LIB_BarrettReduction(mod);\r\n var dp = new ulong?[n + 1, n * (n - 1) / 2 + 1];\r\n Func calc = null;\r\n calc = (pn, pk) =>\r\n {\r\n if (pn == 1 && pk == 0) return 1;\r\n if (pn < 0 || pk < 0 || pk > pn * (pn - 1) / 2) return 0;\r\n if (dp[pn, pk].HasValue) return dp[pn, pk].Value;\r\n dp[pn, pk] = br.Reduce((calc(pn, pk - 1) + calc(pn - 1, pk) + mod - calc(pn - 1, pk - pn)));\r\n return dp[pn, pk].Value;\r\n };\r\n var beforeAns = 0UL;\r\n for (var N = 0L; N <= n; ++N)\r\n {\r\n var ans = br.Reduce(beforeAns * (ulong)N);\r\n for (var i = 0L; i < N; ++i)\r\n {\r\n for (var j = i + 1; j < N; ++j)\r\n {\r\n var sabun = j - i + 1;\r\n var ten = (N - 1) * (N - 2) / 2;\r\n var sum = 0UL;\r\n for (var k = 0L; k + sabun <= ten; ++k)\r\n {\r\n sum = br.Reduce(sum + calc(N - 1, k));\r\n ans += br.Reduce(sum * calc(N - 1, k + sabun));\r\n ans = br.Reduce(ans);\r\n }\r\n }\r\n }\r\n beforeAns = ans;\r\n }\r\n Console.WriteLine(beforeAns);\r\n }\r\n class Printer : StreamWriter\r\n {\r\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\r\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\r\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\r\n }\r\n static LIB_FastIO fastio = new LIB_FastIODebug();\r\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(); }\r\n static long NN => fastio.Long();\r\n static double ND => fastio.Double();\r\n static string NS => fastio.Scan();\r\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\r\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\r\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\r\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\r\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\r\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\r\n static IEnumerator _xsi = _xsc();\r\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; } }\r\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; }\r\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; }\r\n static void Fill(this T[] array, T value) => array.AsSpan().Fill(value);\r\n static void Fill(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);\r\n static void Fill(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);\r\n static void Fill(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);\r\n }\r\n}\r\nnamespace Library {\r\n class LIB_BarrettReduction\r\n {\r\n ulong MOD;\r\n ulong mh;\r\n ulong ml;\r\n const ulong ALL1_32 = (ulong)~0U;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_BarrettReduction(ulong mod)\r\n {\r\n MOD = mod;\r\n var m = ~0UL / MOD;\r\n unchecked { if (m * MOD + MOD == 0) ++m; }\r\n mh = m >> 32;\r\n ml = m & ALL1_32;\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public ulong Reduce(ulong x)\r\n {\r\n var z = (x & ALL1_32) * ml;\r\n z = (x & ALL1_32) * mh + (x >> 32) * ml + (z >> 32);\r\n z = (x >> 32) * mh + (z >> 32);\r\n x -= z * MOD;\r\n return x < MOD ? x : x - MOD;\r\n }\r\n }\r\n class LIB_FastIO\r\n {\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\r\n readonly Stream str;\r\n readonly byte[] buf = new byte[2048];\r\n int len, ptr;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n byte read()\r\n {\r\n if (ptr >= len)\r\n {\r\n ptr = 0;\r\n if ((len = str.Read(buf, 0, 2048)) <= 0)\r\n {\r\n return 0;\r\n }\r\n }\r\n return buf[ptr++];\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n char Char()\r\n {\r\n byte b = 0;\r\n do b = read();\r\n while (b < 33 || 126 < b);\r\n return (char)b;\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public string Scan()\r\n {\r\n var sb = new StringBuilder();\r\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\r\n sb.Append(b);\r\n return sb.ToString();\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public long Long()\r\n {\r\n long ret = 0; byte b = 0; var ng = false;\r\n do b = read();\r\n while (b != '-' && (b < '0' || '9' < b));\r\n if (b == '-') { ng = true; b = read(); }\r\n for (; true; b = read())\r\n {\r\n if (b < '0' || '9' < b)\r\n return ng ? -ret : ret;\r\n else ret = (ret << 3) + (ret << 1) + b - '0';\r\n }\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\r\n }\r\n class LIB_FastIODebug : LIB_FastIO\r\n {\r\n Queue param = new Queue();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_FastIODebug() { }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override string Scan() => NextString();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override long Long() => long.Parse(NextString());\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override double Double() => double.Parse(NextString());\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cc09664f360b080e047e49c586bdf1c6", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing static System.Math;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Globalization;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\nusing Library;\r\n\r\nnamespace Program\r\n{\r\n public static class ProblemE\r\n {\r\n static bool SAIKI = false;\r\n static public int numberOfRandomCases = 0;\r\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\r\n {\r\n }\r\n static public void Solve()\r\n {\r\n var n = NN;\r\n var mod = NN;\r\n var dp = new long?[n + 1, n * (n - 1) / 2 + 1];\r\n Func calc = null;\r\n calc = (pn, pk) =>\r\n {\r\n if (pn == 1 && pk == 0) return 1;\r\n if (pn < 0 || pk < 0 || pk > pn * (pn - 1) / 2) return 0;\r\n if (dp[pn, pk].HasValue) return dp[pn, pk].Value;\r\n dp[pn, pk] = (calc(pn, pk - 1) + calc(pn - 1, pk) + mod - calc(pn - 1, pk - pn)) % mod;\r\n return dp[pn, pk].Value;\r\n };\r\n var beforeAns = 0L;\r\n for (var N = 0; N <= n; ++N)\r\n {\r\n var ans = beforeAns * N % mod;\r\n for (var i = 0; i < N; ++i)\r\n {\r\n for (var j = i + 1; j < N; ++j)\r\n {\r\n var sabun = j - i + 1;\r\n var ten = (N - 1) * (N - 2) / 2;\r\n var sum = 0L;\r\n for (var k = 0; k + sabun <= ten; ++k)\r\n {\r\n sum = (sum + calc(N - 1, k)) % mod;\r\n ans += sum * calc(N - 1, k + sabun) % mod;\r\n ans %= mod;\r\n }\r\n }\r\n }\r\n beforeAns = ans;\r\n }\r\n Console.WriteLine(beforeAns);\r\n }\r\n class Printer : StreamWriter\r\n {\r\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\r\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\r\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\r\n }\r\n static LIB_FastIO fastio = new LIB_FastIODebug();\r\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(); }\r\n static long NN => fastio.Long();\r\n static double ND => fastio.Double();\r\n static string NS => fastio.Scan();\r\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\r\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\r\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\r\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\r\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\r\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\r\n static IEnumerator _xsi = _xsc();\r\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; } }\r\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; }\r\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; }\r\n static void Fill(this T[] array, T value) => array.AsSpan().Fill(value);\r\n static void Fill(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);\r\n static void Fill(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);\r\n static void Fill(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);\r\n }\r\n}\r\nnamespace Library {\r\n class LIB_FastIO\r\n {\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\r\n readonly Stream str;\r\n readonly byte[] buf = new byte[2048];\r\n int len, ptr;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n byte read()\r\n {\r\n if (ptr >= len)\r\n {\r\n ptr = 0;\r\n if ((len = str.Read(buf, 0, 2048)) <= 0)\r\n {\r\n return 0;\r\n }\r\n }\r\n return buf[ptr++];\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n char Char()\r\n {\r\n byte b = 0;\r\n do b = read();\r\n while (b < 33 || 126 < b);\r\n return (char)b;\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public string Scan()\r\n {\r\n var sb = new StringBuilder();\r\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\r\n sb.Append(b);\r\n return sb.ToString();\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public long Long()\r\n {\r\n long ret = 0; byte b = 0; var ng = false;\r\n do b = read();\r\n while (b != '-' && (b < '0' || '9' < b));\r\n if (b == '-') { ng = true; b = read(); }\r\n for (; true; b = read())\r\n {\r\n if (b < '0' || '9' < b)\r\n return ng ? -ret : ret;\r\n else ret = (ret << 3) + (ret << 1) + b - '0';\r\n }\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\r\n }\r\n class LIB_FastIODebug : LIB_FastIO\r\n {\r\n Queue param = new Queue();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_FastIODebug() { }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override string Scan() => NextString();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override long Long() => long.Parse(NextString());\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override double Double() => double.Parse(NextString());\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ddfa94ec9efe47cc37e126ea8d945e3", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0} {"lang": "C# 8", "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\n\r\npublic class Program\r\n{\r\n int N;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n N = sc.NextInt();\r\n\r\n ModInt[] dp = new ModInt[N + 1];\r\n dp[1] = 1;\r\n for(int i = 2;i <= N; i++)\r\n {\r\n dp[i] = dp[i - 1] * dp[i - 1] * 16;\r\n }\r\n\r\n Console.WriteLine(dp[N] * 6);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c86e33d33773800e5afdfb8cc347151", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing static System.Math;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Globalization;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\nusing Library;\r\n\r\nnamespace Program\r\n{\r\n public static class ProblemE\r\n {\r\n static bool SAIKI = false;\r\n static public int numberOfRandomCases = 0;\r\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\r\n {\r\n }\r\n static public void Solve()\r\n {\r\n var k = NN;\r\n var dp = new LIB_Mod1000000007[k + 1];\r\n dp[1] = 1;\r\n for (var i = 2; i <= k; ++i)\r\n {\r\n dp[i] = (dp[i - 1] * 4) * (dp[i - 1] * 4);\r\n }\r\n Console.WriteLine(dp[k] * 6);\r\n }\r\n class Printer : StreamWriter\r\n {\r\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\r\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\r\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\r\n }\r\n static LIB_FastIO fastio = new LIB_FastIODebug();\r\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(); }\r\n static long NN => fastio.Long();\r\n static double ND => fastio.Double();\r\n static string NS => fastio.Scan();\r\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\r\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\r\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\r\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\r\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\r\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\r\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\r\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\r\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\r\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\r\n static IEnumerator _xsi = _xsc();\r\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; } }\r\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; }\r\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; }\r\n static void Fill(this T[] array, T value) => array.AsSpan().Fill(value);\r\n static void Fill(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);\r\n static void Fill(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);\r\n static void Fill(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);\r\n }\r\n}\r\nnamespace Library {\r\n partial struct LIB_Mod1000000007 : IEquatable, IEquatable\r\n {\r\n const int _mod = 1000000007; long v;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_Mod1000000007(long x)\r\n {\r\n if (x < _mod && x >= 0) v = x;\r\n else if ((v = x % _mod) < 0) v += _mod;\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public implicit operator LIB_Mod1000000007(long x) => new LIB_Mod1000000007(x);\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public implicit operator long(LIB_Mod1000000007 x) => x.v;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public void Add(LIB_Mod1000000007 x) { if ((v += x.v) >= _mod) v -= _mod; }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public void Sub(LIB_Mod1000000007 x) { if ((v -= x.v) < 0) v += _mod; }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public void Mul(LIB_Mod1000000007 x) => v = (v * x.v) % _mod;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public void Div(LIB_Mod1000000007 x) => v = (v * Inverse(x.v)) % _mod;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public LIB_Mod1000000007 operator +(LIB_Mod1000000007 x, LIB_Mod1000000007 y) { var t = x.v + y.v; return t >= _mod ? new LIB_Mod1000000007 { v = t - _mod } : new LIB_Mod1000000007 { v = t }; }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public LIB_Mod1000000007 operator -(LIB_Mod1000000007 x, LIB_Mod1000000007 y) { var t = x.v - y.v; return t < 0 ? new LIB_Mod1000000007 { v = t + _mod } : new LIB_Mod1000000007 { v = t }; }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public LIB_Mod1000000007 operator *(LIB_Mod1000000007 x, LIB_Mod1000000007 y) => x.v * y.v;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public LIB_Mod1000000007 operator /(LIB_Mod1000000007 x, LIB_Mod1000000007 y) => x.v * Inverse(y.v);\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public bool operator ==(LIB_Mod1000000007 x, LIB_Mod1000000007 y) => x.v == y.v;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public bool operator !=(LIB_Mod1000000007 x, LIB_Mod1000000007 y) => x.v != y.v;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public long Inverse(long x)\r\n {\r\n long b = _mod, r = 1, u = 0, t = 0;\r\n while (b > 0)\r\n {\r\n var q = x / b;\r\n t = u;\r\n u = r - q * u;\r\n r = t;\r\n t = b;\r\n b = x - q * b;\r\n x = t;\r\n }\r\n return r < 0 ? r + _mod : r;\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public bool Equals(LIB_Mod1000000007 x) => v == x.v;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public bool Equals(long x) => v == x;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override bool Equals(object x) => x == null ? false : Equals((LIB_Mod1000000007)x);\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override int GetHashCode() => v.GetHashCode();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override string ToString() => v.ToString();\r\n static List _fact = new List() { 1, 1 };\r\n static List _inv = new List() { 0, 1 };\r\n static List _factinv = new List() { 1, 1 };\r\n static long _factm = _mod;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static void B(long n)\r\n {\r\n if (_factm != _mod)\r\n {\r\n _fact = new List() { 1, 1 };\r\n _inv = new List() { 0, 1 };\r\n _factinv = new List() { 1, 1 };\r\n }\r\n if (n >= _fact.Count)\r\n {\r\n for (int i = _fact.Count; i <= n; ++i)\r\n {\r\n _fact.Add(_fact[i - 1] * i);\r\n _inv.Add(_mod - _inv[(int)(_mod % i)] * (_mod / i));\r\n _factinv.Add(_factinv[i - 1] * _inv[i]);\r\n }\r\n }\r\n _factm = _mod;\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public LIB_Mod1000000007 Comb(long n, long k)\r\n {\r\n B(n);\r\n if (n == 0 && k == 0) return 1;\r\n if (n < k || n < 0) return 0;\r\n return _fact[(int)n] * _factinv[(int)(n - k)] * _factinv[(int)k];\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public LIB_Mod1000000007 CombOK(long n, long k)\r\n {\r\n LIB_Mod1000000007 ret = 1;\r\n for (var i = 0; i < k; i++) ret *= n - i;\r\n for (var i = 1; i <= k; i++) ret /= i;\r\n return ret;\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public LIB_Mod1000000007 Perm(long n, long k)\r\n {\r\n B(n);\r\n if (n == 0 && k == 0) return 1;\r\n if (n < k || n < 0) return 0;\r\n return _fact[(int)n] * _factinv[(int)(n - k)];\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public LIB_Mod1000000007 KanzenPerm(long n, long k) => Enumerable.Range(0, (int)k + 1).Aggregate((LIB_Mod1000000007)0, (a, e) => a + (1 - ((e & 1) << 1)) * LIB_Mod1000000007.Comb(k, e) * LIB_Mod1000000007.Perm(n - e, k - e));\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n static public LIB_Mod1000000007 Pow(LIB_Mod1000000007 x, long y)\r\n {\r\n LIB_Mod1000000007 a = 1;\r\n while (y != 0)\r\n {\r\n if ((y & 1) == 1) a.Mul(x);\r\n x.Mul(x);\r\n y >>= 1;\r\n }\r\n return a;\r\n }\r\n }\r\n class LIB_FastIO\r\n {\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\r\n readonly Stream str;\r\n readonly byte[] buf = new byte[2048];\r\n int len, ptr;\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n byte read()\r\n {\r\n if (ptr >= len)\r\n {\r\n ptr = 0;\r\n if ((len = str.Read(buf, 0, 2048)) <= 0)\r\n {\r\n return 0;\r\n }\r\n }\r\n return buf[ptr++];\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n char Char()\r\n {\r\n byte b = 0;\r\n do b = read();\r\n while (b < 33 || 126 < b);\r\n return (char)b;\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public string Scan()\r\n {\r\n var sb = new StringBuilder();\r\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\r\n sb.Append(b);\r\n return sb.ToString();\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public long Long()\r\n {\r\n long ret = 0; byte b = 0; var ng = false;\r\n do b = read();\r\n while (b != '-' && (b < '0' || '9' < b));\r\n if (b == '-') { ng = true; b = read(); }\r\n for (; true; b = read())\r\n {\r\n if (b < '0' || '9' < b)\r\n return ng ? -ret : ret;\r\n else ret = (ret << 3) + (ret << 1) + b - '0';\r\n }\r\n }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\r\n }\r\n class LIB_FastIODebug : LIB_FastIO\r\n {\r\n Queue param = new Queue();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public LIB_FastIODebug() { }\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override string Scan() => NextString();\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override long Long() => long.Parse(NextString());\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n public override double Double() => double.Parse(NextString());\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ccd4b27cc3b229512642d7bc94e183c8", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Numerics;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace DrawRubik1594E1\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int k = Int32.Parse(Console.ReadLine());\r\n long result = 6;\r\n long mul = 16;\r\n while (k > 1)\r\n {\r\n result *= mul;\r\n result %= 1000000007;\r\n mul *= mul;\r\n mul %= 1000000007;\r\n --k;\r\n }\r\n Console.WriteLine(result);\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e24e4d2dd4fb21f4b444b511c0189c5b", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "C# 8", "source_code": "using System;\r\n\r\nnamespace Program{\r\n class Execution{\r\n static long mod = 1000000007;\r\n static long power(long a, long b){\r\n if (b == 0) return 1;\r\n if (b == 1) return a;\r\n\r\n long t = power(a, b / 2);\r\n t = (t * t) % mod;\r\n if (b % 2 == 1) t = (a * t) % mod;\r\n return t;\r\n }\r\n static void Main(string[] args){\r\n long k = int.Parse(Console.ReadLine());\r\n long powerTwo = Convert.ToInt64(Math.Pow(2, k)) - 2;\r\n long ans = power(4, powerTwo);\r\n\r\n ans = (ans * 6) % mod;\r\n\r\n Console.WriteLine(ans);\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0a4c0a523bdb73ce2833f71d291a6487", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Text;\r\n \r\npublic static class Cin\r\n{\r\n public static string ReadString()\r\n {\r\n StringBuilder tokenChars = new StringBuilder();\r\n bool tokenFinished = false;\r\n bool skipWhiteSpaceMode = true;\r\n while (!tokenFinished)\r\n {\r\n int nextChar = Console.Read();\r\n if (nextChar == -1)\r\n {\r\n // End of stream reached\r\n tokenFinished = true;\r\n }\r\n else\r\n {\r\n char ch = (char) nextChar;\r\n if (char.IsWhiteSpace(ch))\r\n {\r\n if (!skipWhiteSpaceMode)\r\n {\r\n tokenFinished = true;\r\n if (ch == '\\r' && (Environment.NewLine == \"\\r\\n\"))\r\n {\r\n // Reached '\\r' in Windows --> skip the next '\\n'\r\n Console.Read();\r\n }\r\n }\r\n }\r\n else\r\n {\r\n // Character reached --> append it to the output\r\n skipWhiteSpaceMode = false;\r\n tokenChars.Append(ch);\r\n }\r\n }\r\n }\r\n \r\n string token = tokenChars.ToString();\r\n return token;\r\n }\r\n \r\n public static int ReadInt()\r\n {\r\n string token = ReadString();\r\n return int.Parse(token);\r\n }\r\n \r\n public static long ReadLong()\r\n {\r\n string token = ReadString();\r\n return long.Parse(token);\r\n }\r\n \r\n public static T[] ReadArrayFromLine(Func factory)\r\n {\r\n return Console.ReadLine()?.Split(' ').Select(factory).ToArray();\r\n }\r\n \r\n public static int[] ReadIntArrayFromLine()\r\n {\r\n return ReadArrayFromLine(int.Parse);\r\n }\r\n \r\n public static double ReadDouble(bool acceptAnyDecimalSeparator = true)\r\n {\r\n string token = ReadString();\r\n if (acceptAnyDecimalSeparator)\r\n {\r\n token = token.Replace(',', '.');\r\n double result = double.Parse(token, CultureInfo.InvariantCulture);\r\n return result;\r\n }\r\n else\r\n {\r\n double result = double.Parse(token);\r\n return result;\r\n }\r\n }\r\n}\r\n \r\nclass Program\r\n{\r\n static void Main(string[] args)\r\n {\r\n int t = 1;\r\n while (t-- > 0)\r\n {\r\n Test();\r\n }\r\n }\r\n \r\n static void Test()\r\n {\r\n long MOD = 1000000007;\r\n long n = Cin.ReadInt();\r\n long[] dp = new long[n];\r\n dp[0] = 6;\r\n\r\n long pow(long a, long b)\r\n {\r\n if (b == 0) return 1;\r\n var u = pow(a, b / 2);\r\n u = u * u % MOD;\r\n if (b % 2 == 1) u = u * a % MOD;\r\n return u;\r\n }\r\n\r\n long inv(long a)\r\n {\r\n return pow(a, MOD - 2);\r\n }\r\n\r\n for (int i = 1; i < n; ++i)\r\n {\r\n dp[i] = (dp[i - 1] * dp[i - 1] * 8) % MOD * inv(3) % MOD;\r\n }\r\n \r\n Console.WriteLine(dp[n - 1]);\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b801d156e25fac55983221b32f6c0986", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\n\r\nnamespace ConsoleApp\r\n{\r\n class Program\r\n {\r\n const double DefaultEpsilon = 1e-18;\r\n\r\n struct Vector\r\n {\r\n public double X;\r\n public double Y;\r\n\r\n public Vector(double x, double y)\r\n {\r\n X = x;\r\n Y = y;\r\n }\r\n public Vector(double angle)\r\n {\r\n X = Math.Cos(angle);\r\n Y = Math.Sin(angle);\r\n }\r\n\r\n public double Hypot()\r\n {\r\n return Math.Sqrt((X * X) + (Y * Y));\r\n }\r\n public double HypotSquared()\r\n {\r\n return (X * X) + (Y * Y);\r\n }\r\n public Vector RotateClockwise(double angle)\r\n {\r\n double cos = Math.Cos(angle);\r\n double sin = Math.Sin(angle);\r\n\r\n return new Vector(X * cos + Y * sin, X * -sin + Y * cos);\r\n }\r\n public Vector Perpendicular()\r\n {\r\n return new Vector(-Y, X);\r\n }\r\n public bool IsEqual(Vector vector, double epsilon = DefaultEpsilon)\r\n {\r\n return Equal(this.X, vector.X, epsilon) && Equal(this.Y, vector.Y, epsilon);\r\n }\r\n\r\n public static Vector operator +(Vector a)\r\n {\r\n return a;\r\n }\r\n public static Vector operator -(Vector a)\r\n {\r\n return new Vector(-a.X, -a.Y);\r\n }\r\n public static Vector operator +(Vector a, Vector b)\r\n {\r\n return new Vector(a.X + b.X, a.Y + b.Y);\r\n }\r\n public static Vector operator -(Vector a, Vector b)\r\n {\r\n return new Vector(a.X - b.X, a.Y - b.Y);\r\n }\r\n public static double Determinant(Vector a, Vector b)\r\n {\r\n return (a.X * b.Y) - (a.Y * b.X);\r\n }\r\n public static double DotProduct(Vector a, Vector b)\r\n {\r\n return (a.X * b.X) + (a.Y * b.Y);\r\n }\r\n }\r\n struct Line\r\n {\r\n public double A;\r\n public double B;\r\n public double C;\r\n\r\n public double slopeY => -A / B; // y = f'(x)\r\n public double slopeX => -B / A; // x = f'(y)\r\n\r\n public Line(Vector p1, Vector p2)\r\n {\r\n A = p2.Y - p1.Y;\r\n B = p1.X - p2.X;\r\n C = p2.X * p1.Y - p1.X * p2.Y;\r\n }\r\n }\r\n struct Segment\r\n {\r\n public Vector Left;\r\n public Vector Right;\r\n\r\n public Segment(Vector left, Vector right)\r\n {\r\n Left = left;\r\n Right = right;\r\n }\r\n\r\n public Line GetLine()\r\n {\r\n return new Line(Left, Right);\r\n }\r\n public bool IsOnTheSegment(Vector point, double epsilon = DefaultEpsilon)\r\n {\r\n Vector v1 = point - Left;\r\n Vector v2 = point - Right;\r\n double det = Vector.Determinant(v1, v2);\r\n double dotProd = Vector.DotProduct(v1, v2);\r\n\r\n return Equal(det, 0, epsilon) && LessOrEqual(dotProd, 0, epsilon);\r\n }\r\n }\r\n\r\n static Program()\r\n {\r\n // Comment this before submitting (in case of strandard input)\r\n //Console.SetIn(new StreamReader(\"input.txt\"));\r\n //Console.SetOut(new StreamWriter(\"output.txt\"));\r\n }\r\n static void Main()\r\n {\r\n const int mod = 1_000_000_007;\r\n\r\n //int testcases = int.Parse(Console.ReadLine());\r\n //for (int z = 0; z < testcases; z++)\r\n //{\r\n\r\n //}\r\n\r\n int k = int.Parse(Console.ReadLine());\r\n long pow = PowQuick(2, k) - 2;\r\n long ans = PowQuick(4, pow, mod);\r\n\r\n ans *= 6;\r\n ans %= mod;\r\n\r\n Console.WriteLine(ans);\r\n\r\n Console.Out.Close();\r\n }\r\n static bool Equal(double a, double b, double epsilon = DefaultEpsilon)\r\n {\r\n return Math.Abs(a - b) < epsilon;\r\n }\r\n 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 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 static bool GreaterOrEqual(double a, double b, double epsilon = DefaultEpsilon)\r\n {\r\n return (a > b) || Equal(a, b, epsilon);\r\n }\r\n static bool LessOrEqual(double a, double b, double epsilon = DefaultEpsilon)\r\n {\r\n return (a < b) || Equal(a, b, epsilon);\r\n }\r\n static double DegToRad(double angle)\r\n {\r\n return (angle / 180) * Math.PI;\r\n }\r\n static long LCM(long a, long b)\r\n {\r\n return (a / GCD(a, b)) * b;\r\n }\r\n static long GCD(long a, long b)\r\n {\r\n while (a != 0)\r\n {\r\n b %= a;\r\n Swap(ref a, ref b);\r\n }\r\n\r\n return b;\r\n }\r\n static long PowQuick(long b, long p)\r\n {\r\n long exp = b;\r\n long res = 1;\r\n\r\n while (p > 0)\r\n {\r\n if ((p % 2) == 1)\r\n {\r\n res *= exp;\r\n }\r\n\r\n exp *= exp;\r\n p /= 2;\r\n }\r\n\r\n return res;\r\n }\r\n static long PowQuick(long b, long p, long mod)\r\n {\r\n long exp = b;\r\n long res = 1;\r\n\r\n while (p > 0)\r\n {\r\n if ((p % 2) == 1)\r\n {\r\n res *= exp;\r\n res %= mod;\r\n }\r\n\r\n exp *= exp;\r\n exp %= mod;\r\n p /= 2;\r\n }\r\n\r\n return res;\r\n }\r\n static uint BitCount(uint a)\r\n {\r\n a = ((a >> 1) & 0x55555555u) + (a & 0x55555555u);\r\n a = ((a >> 2) & 0x33333333u) + (a & 0x33333333u);\r\n a = ((a >> 4) & 0x0F0F0F0Fu) + (a & 0x0F0F0F0Fu);\r\n a = ((a >> 8) & 0x00FF00FFu) + (a & 0x00FF00FFu);\r\n a = ((a >> 16) & 0x0000FFFFu) + (a & 0x0000FFFFu);\r\n return a;\r\n }\r\n static bool AreAlmostEqual(double a, double b, double epsilon)\r\n {\r\n return Math.Abs(a - b) < epsilon;\r\n }\r\n static int Binary(int[] array, int val)\r\n {\r\n return Binary(array, val, 0, array.Length);\r\n }\r\n static int Binary(int[] array, int val, int left, int right)\r\n {\r\n if (val < array[0])\r\n {\r\n return 0;\r\n }\r\n\r\n while (right - left > 1)\r\n {\r\n int mid = (right + left) / 2;\r\n\r\n if (array[mid] <= val)\r\n {\r\n left = mid;\r\n }\r\n else\r\n {\r\n right = mid;\r\n }\r\n }\r\n\r\n return right;\r\n }\r\n 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 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 static double[] ReadDoubleData(TextReader input)\r\n {\r\n return input.ReadLine()\r\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(val => double.Parse(val))\r\n .ToArray();\r\n }\r\n static double[] ReadDoubleData()\r\n {\r\n return ReadDoubleData(Console.In);\r\n }\r\n static int[] ReadIntData(TextReader input)\r\n {\r\n return input.ReadLine()\r\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(val => int.Parse(val))\r\n .ToArray();\r\n }\r\n static int[] ReadIntData()\r\n {\r\n return ReadIntData(Console.In);\r\n }\r\n static long[] ReadLongData(TextReader input)\r\n {\r\n return input.ReadLine()\r\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(val => long.Parse(val))\r\n .ToArray();\r\n }\r\n static long[] ReadLongData()\r\n {\r\n return ReadLongData(Console.In);\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a81b3b31eaa996b96b7cd02c55af70e", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "C# 8", "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\n\r\npublic class Program\r\n{\r\n int N;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n N = sc.NextInt();\r\n\r\n Console.WriteLine(F(N) * 6);\r\n }\r\n\r\n ModInt F(int n)\r\n {\r\n if (n == 1) return 1;\r\n return F(n - 1) * F(n - 1) * 16;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c378dd575b2f4650f0921ac3ea192d7b", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "28c5e6772d8c9364cf26a2e1976d6860", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "difficulty": 2600.0} {"lang": "Mono C#", "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, 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e1090e59e68522b4a85942f7803925a0", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "difficulty": 2600.0} {"lang": "Mono C#", "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[N, N, 2];\n long[,,] b = new long[N, 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 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[i + 1, j, 1] += a[i, j, e];\n Fix(ref a[i + 1, j, 1], MOD);\n }\n b[i + 1, j, 1] += b[i, j, e];\n Fix(ref b[i + 1, j, 1], MOD);\n }\n if (j > 0)\n {\n a[i + 1, j - 1, e] = (a[i + 1, j - 1, e] + j * a[i, j, e]) % MOD;\n b[i + 1, j - 1, e] = (b[i + 1, j - 1, e] + j * b[i, j, e]) % MOD;\n }\n if (i + j - e <= 2 * n - 2)\n {\n a[i + 1, j + 1, e] += a[i, j, e];\n Fix(ref a[i + 1, j + 1, e], MOD);\n b[i + 1, j + 1, e] += b[i, j, e];\n Fix(ref b[i + 1, j + 1, e], MOD);\n }\n }\n }\n }\n\n long ans = a[2 * n + 1, 0, 1] * Inv(b[2 * n + 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}: \", 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b741417dced12cb2e7bcf46c4b4d01fb", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "difficulty": 2600.0} {"lang": "MS C#", "source_code": "using System;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\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 !string.IsNullOrEmpty(_line);\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 List Numbers()\n {\n return !Next() ? new List() : _line.Split(' ').Select(long.Parse).ToList();\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 Numbers()\n {\n return !Next() ? new List() : _line.Split(' ').Select(long.Parse).ToList();\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 Numbers()\n {\n return !Next() ? new List() : _line.Split(' ').Select(long.Parse).ToList();\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();\n for (var i = 0; i < t; i++)\n {\n long a, b;\n Input.Next(out a, out b);\n if (a < b)\n {\n var c = b;\n b = a;\n a = c;\n }\n l.Add(Check(a,b) ? \"First\" : \"Second\");\n }\n Console.WriteLine(string.Join(Environment.NewLine, l));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bdf25717f01053422be331199cf1d47c", "src_uid": "5f5b320c7f314bd06c0d2a9eb311de6c", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\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 !string.IsNullOrEmpty(_line);\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 List Numbers()\n {\n return !Next() ? new List() : _line.Split(' ').Select(long.Parse).ToList();\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= 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8da275f8b13c99fe40084900b3ebc91d", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "difficulty": 2000.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ebb32f9887933d7dd96759cba33f55bf", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace DimaAndHorses\n{\n class Program\n {\n private static bool[] p;\n\n private static bool Check(List[] war, int i)\n {\n return war[i].Count(e => p[e] == p[i]) <= 1;\n }\n\n private static bool Dfs(List[] war, int i)\n {\n if (i == p.Length)\n {\n for (int j = 0; j < i; j++)\n {\n if (!Check(war, j))\n return false;\n }\n\n return true;\n }\n\n if (!Check(war, i))\n {\n p[i] = !p[i];\n if (Check(war, i))\n {\n if (Dfs(war, i + 1))\n return true;\n }\n\n p[i] = !p[i];\n }\n\n return Dfs(war, i + 1);\n } \n\n static void Main(string[] args)\n {\n // var fin = File.OpenText(\"test.txt\");\n // Console.SetIn(fin);\n\n string[] nm = Console.ReadLine().Split(' ');\n int n = int.Parse(nm[0]);\n int m = int.Parse(nm[1]);\n\n var war = new List[n];\n for (int i = 0; i < n; i++)\n {\n war[i] = new List();\n }\n\n for (int i = 0; i < m; i++)\n {\n string[] ab = Console.ReadLine().Split(' ');\n int a = int.Parse(ab[0]) - 1;\n int b = int.Parse(ab[1]) - 1;\n\n war[a].Add(b);\n war[b].Add(a);\n }\n\n p = new bool[n];\n Dfs(war, 0);\n Console.WriteLine(string.Concat(p.Select(x => x ? 1 : 0)));\n\n // fin.Close();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1adeed9dc2c59417499a7811361dab9e", "src_uid": "7017f2c81d5aed716b90e46480f96582", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace DimaAndHorses\n{\n class Program\n {\n private static List[] war;\n private static bool[] p;\n\n private static bool Check(int i)\n {\n return war[i].Count(e => p[e] == p[i]) <= 1;\n }\n\n private static void Fix(int i)\n {\n p[i] = !p[i];\n\n foreach (var e in war[i])\n {\n if (p[e] == p[i] && !Check(e))\n {\n Fix(e);\n }\n }\n }\n\n private static void FixAll()\n {\n for (int i = 0; i < p.Length; i++)\n {\n if (!p[i] && !Check(i))\n {\n Fix(i); \n }\n }\n } \n\n static void Main(string[] args)\n {\n var fin = File.OpenText(\"test.txt\");\n Console.SetIn(fin);\n\n string[] nm = Console.ReadLine().Split(' ');\n int n = int.Parse(nm[0]);\n int m = int.Parse(nm[1]);\n\n war = new List[n];\n p = new bool[n];\n for (int i = 0; i < n; i++)\n {\n war[i] = new List();\n p[i] = false;\n }\n\n for (int i = 0; i < m; i++)\n {\n string[] ab = Console.ReadLine().Split(' ');\n int a = int.Parse(ab[0]) - 1;\n int b = int.Parse(ab[1]) - 1;\n\n war[a].Add(b);\n war[b].Add(a);\n }\n \n FixAll();\n Console.WriteLine(string.Concat(p.Select(x => x ? 1 : 0)));\n\n fin.Close();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "341c1274ac9c1f159088136e740cec5c", "src_uid": "7017f2c81d5aed716b90e46480f96582", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace DimaAndHorses\n{\n class Program\n {\n private static List[] war;\n private static bool[] p;\n\n private static bool Check(int i)\n {\n return war[i].Count(e => p[e] == p[i]) <= 1;\n }\n\n private static void Fix(int i)\n {\n p[i] = !p[i];\n\n foreach (var e in war[i])\n {\n if (p[e] == p[i] && !Check(e))\n {\n Fix(e);\n }\n }\n }\n\n private static void FixAll()\n {\n for (int i = 0; i < p.Length; i++)\n {\n if (!p[i] && !Check(i))\n {\n Fix(i); \n }\n }\n } \n\n static void Main(string[] args)\n {\n // var fin = File.OpenText(\"test.txt\");\n // Console.SetIn(fin);\n\n string[] nm = Console.ReadLine().Split(' ');\n int n = int.Parse(nm[0]);\n int m = int.Parse(nm[1]);\n\n war = new List[n];\n p = new bool[n];\n for (int i = 0; i < n; i++)\n {\n war[i] = new List();\n p[i] = false;\n }\n\n for (int i = 0; i < m; i++)\n {\n string[] ab = Console.ReadLine().Split(' ');\n int a = int.Parse(ab[0]) - 1;\n int b = int.Parse(ab[1]) - 1;\n\n war[a].Add(b);\n war[b].Add(a);\n }\n \n FixAll();\n Console.WriteLine(string.Concat(p.Select(x => x ? 1 : 0)));\n\n // fin.Close();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aa94ffca5c8423ea040b6eccae59c09e", "src_uid": "7017f2c81d5aed716b90e46480f96582", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Collections.Generic;\n\npublic class E167\n{\n public static void Main()\n {\n new E167().Entry();\n }//Main\n\n void Entry()\n {\n int[] tmp = intSplit(' ');\n int n = tmp[0];\n int m = tmp[1];\n int[] type = new int[n];\n List[] edges = new List[n];\n for (int i = 0; i < n; i++)\n edges[i] = new List();\n for (int i = 0; i < m; i++)\n {\n tmp = intSplit(' ');\n int a = tmp[0] - 1;\n int b = tmp[1] - 1;\n edges[a].Add(b);\n edges[b].Add(a);\n }//for i\n Queue que = new Queue();\n for (int i = 0; i < n; i++)\n que.Enqueue(i);\n while (que.Count!=0)\n {\n int deq = que.Dequeue();\n int cnt = 0;\n foreach (int item in edges[deq])\n {\n if (type[item] == type[deq])\n cnt++;\n }//foreach item\n if (cnt>=2)\n {\n type[deq] ^= 1;\n foreach (int item in edges[deq])\n {\n if (type[item] == type[deq])\n que.Enqueue(item);\n }//foreach item\n }//if\n }//while\n StringBuilder sb = new StringBuilder();\n foreach (int item in type)\n {\n sb.Append(item);\n }//foreach item\n Console.WriteLine(sb.ToString());\n }\n\n string strRead()\n {\n return Console.ReadLine();\n }\n\n int intRead()\n {\n return int.Parse(Console.ReadLine());\n }\n\n long longRead()\n {\n return long.Parse(Console.ReadLine());\n }\n\n double doubleRead()\n {\n return double.Parse(Console.ReadLine());\n }\n\n string[] strSplit(char a)\n {\n return Console.ReadLine().Split(a);\n }\n\n int[] intSplit(char a)\n {\n return Array.ConvertAll(Console.ReadLine().Split(a), int.Parse);\n }\n\n long[] longSplit(char a)\n {\n return Array.ConvertAll(Console.ReadLine().Split(a), long.Parse);\n }\n\n double[] doubleSplit(char a)\n {\n return Array.ConvertAll(Console.ReadLine().ToString().Split('a'), double.Parse);\n }\n\n\n}//Template", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bfbd7d0d848eb668430fbebd6f1d50d9", "src_uid": "7017f2c81d5aed716b90e46480f96582", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces._272\n{\n public class Solver\n {\n public static void Main()\n {\n StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n new Solver().Solve(Console.In, sw);\n sw.Flush();\n }\n\n public void Solve(TextReader tr, TextWriter tw)\n {\n var tokens = tr.ReadLine().Split();\n var n = int.Parse(tokens[0]);\n var m = int.Parse(tokens[1]);\n\n var ab = new int[m, 2];\n for (int i = 0; i < m; ++i)\n {\n var p = tr.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();\n ab[i, 0] = p[0];\n ab[i, 1] = p[1];\n }\n\n var res = Solve(n, ab);\n tw.WriteLine(res);\n }\n\n public string Solve(int n, int[,] ab)\n {\n var edges = Utils.CreateListArray(n);\n for (var i = 0; i < ab.GetLength(0); ++i)\n {\n edges[ab[i, 0]].Add(ab[i, 1]);\n edges[ab[i, 1]].Add(ab[i, 0]);\n }\n\n var res = new bool[n];\n\n for (var updated = true; updated;)\n {\n updated = false;\n for (int i = 0; i < n; ++i)\n {\n if (edges[i].Count(e => res[i] == res[e]) >= 2)\n {\n res[i] = !res[i];\n updated = true;\n }\n }\n }\n\n return new string(res.Select(x => x ? '1' : '0').ToArray());\n }\n }\n\n public static class Utils\n {\n public static List[] CreateListArray(int n)\n {\n var res = new List[n];\n for (int i = 0; i < n; ++i)\n {\n res[i] = new List();\n }\n return res;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fd2789a621e325d638065df3d717f7d5", "src_uid": "7017f2c81d5aed716b90e46480f96582", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace DimaAndHorses\n{\n class Program\n {\n private static bool[] p;\n\n private static bool Check(List[] war, int i)\n {\n return war[i].Count(e => p[e] == p[i]) <= 1;\n }\n\n private static void FixIt(List[] war)\n {\n for (int i = 0; i < p.Length; i++)\n {\n if (!p[i] && !Check(war, i))\n {\n p[i] = true;\n foreach (var e in war[i])\n {\n if (p[e] && !Check(war, e))\n {\n p[e] = false;\n }\n }\n }\n }\n } \n\n static void Main(string[] args)\n {\n // var fin = File.OpenText(\"test.txt\");\n // Console.SetIn(fin);\n\n string[] nm = Console.ReadLine().Split(' ');\n int n = int.Parse(nm[0]);\n int m = int.Parse(nm[1]);\n\n var war = new List[n];\n p = new bool[n];\n for (int i = 0; i < n; i++)\n {\n war[i] = new List();\n p[i] = false;\n }\n\n for (int i = 0; i < m; i++)\n {\n string[] ab = Console.ReadLine().Split(' ');\n int a = int.Parse(ab[0]) - 1;\n int b = int.Parse(ab[1]) - 1;\n\n war[a].Add(b);\n war[b].Add(a);\n }\n \n FixIt(war);\n Console.WriteLine(string.Concat(p.Select(x => x ? 1 : 0)));\n\n // fin.Close();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "64e8d8aa9a48a25d3f54d02803b7365b", "src_uid": "7017f2c81d5aed716b90e46480f96582", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace DimaAndHorses\n{\n class Program\n {\n private static bool[] p;\n\n private static bool Check(List[] war, int i)\n {\n return war[i].Count(e => p[e] == p[i]) <= 1;\n }\n\n private static void FixIt(List[] war)\n {\n for (int i = 0; i < p.Length; i++)\n {\n if (!p[i] && !Check(war, i))\n {\n p[i] = true;\n foreach (var e in war[i])\n {\n if (p[e] && !Check(war, e))\n {\n p[e] = false;\n }\n }\n }\n }\n } \n\n static void Main(string[] args)\n {\n // var fin = File.OpenText(\"test.txt\");\n // Console.SetIn(fin);\n\n string[] nm = Console.ReadLine().Split(' ');\n int n = int.Parse(nm[0]);\n int m = int.Parse(nm[1]);\n\n var war = new List[n];\n for (int i = 0; i < n; i++)\n {\n war[i] = new List();\n }\n\n for (int i = 0; i < m; i++)\n {\n string[] ab = Console.ReadLine().Split(' ');\n int a = int.Parse(ab[0]) - 1;\n int b = int.Parse(ab[1]) - 1;\n\n war[a].Add(b);\n war[b].Add(a);\n }\n\n p = new bool[n];\n FixIt(war);\n Console.WriteLine(string.Concat(p.Select(x => x ? 1 : 0)));\n\n // fin.Close();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f150232224d015cfeefdd3aec48b7529", "src_uid": "7017f2c81d5aed716b90e46480f96582", "difficulty": 2200.0} {"lang": "MS C#", "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 MOD = 1000000007;\n\n long[] f, rf, inv;\n void InitFacts(int size)\n {\n f = new long[size + 1];\n rf = new long[size + 1];\n inv = new long[size + 1];\n f[0] = f[1] = rf[0] = rf[1] = inv[1] = 1;\n for (int i = 2; i <= size; i++)\n {\n f[i] = f[i - 1] * i % MOD;\n inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;\n rf[i] = inv[i] * rf[i - 1] % MOD;\n }\n }\n\n public void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n\n InitFacts(n);\n long sum = 0;\n for (int i = m + 1; i < n; i++)\n sum = (sum + (i - m + sum) * inv[i]) % MOD;\n\n Write(sum * f[n - 1] % 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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e294ebf060ccecbc17dc1d3cfd79454", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "difficulty": 2400.0} {"lang": "MS C#", "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 MOD = 1000000007;\n\n long[] f, rf, inv;\n void InitFacts(int size)\n {\n f = new long[size + 1];\n rf = new long[size + 1];\n inv = new long[size + 1];\n f[0] = f[1] = rf[0] = rf[1] = inv[1] = 1;\n for (int i = 2; i <= size; i++)\n {\n f[i] = f[i - 1] * i % MOD;\n inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;\n rf[i] = inv[i] * rf[i - 1] % MOD;\n }\n }\n\n public void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n\n InitFacts(n);\n var ps = new long[n];\n for (int i = m + 1; i < n; i++)\n {\n long v = f[i - 1] * (i - m + ps[i - 1] - ps[i - m - 1] + MOD) % MOD;\n ps[i] = (ps[i - 1] + v * rf[i]) % MOD;\n }\n\n Write(ps[n - 1] * f[n - 1] % 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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "927684567d70b178f4488b4cf817f056", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "difficulty": 2400.0} {"lang": "MS C#", "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 public class ModularMath\n {\n public static int ModInv(int a, int n)\n {\n int t = 0;\n int r = n;\n int newt = 1;\n int newr = a;\n\n while(newr!=0)\n {\n int quo = r / newr;\n int tmp = t;\n var val1 = newt;\n var val2 = t - quo * newt;\n var val3 = newr;\n var val4 = r - quo * newr;\n\n t = val1;\n newt = val2;\n r = val3;\n newr = val4;\n }\n\n if (t < 0)\n t += n;\n\n return t;\n }\n\n public static int cmmdc(int a, int b)\n {\n if (a < b)\n {\n var tmp = a;\n a = b;\n b = tmp;\n }\n if (b == 0)\n return a;\n\n int r;\n do\n {\n r = a % b;\n if (r == 0)\n return b;\n a = b;\n b = r;\n } while (true);\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n,k;\n\n int prime = 1000000007;\n\n int[] _valide = new int[1000009];\n int[] _valideBune = new int[1000009];\n int[] _valideStricte = new int[1000009];\n\n int[] _fact = new int[1000009];\n\n void ComputeFactorials()\n {\n _fact[0] = 1;\n _fact[1] = 1;\n\n for (int i = 2; i < 1000009; i++)\n {\n long rz = _fact[i - 1];\n rz *= i;\n rz %= prime;\n _fact[i] = (int)rz;\n }\n }\n\n\n long comb(int P, int d)\n {\n if (d == 0)\n return 1;\n\n var mi1 = ModularMath.ModInv(_fact[P - d], prime);\n var mi2 = ModularMath.ModInv(_fact[d], prime);\n long rz = _fact[P];\n rz *= mi1;\n rz %= prime;\n rz *= mi2;\n rz %= prime;\n\n return rz;\n }\n\n long aranjams(int P, int d)\n {\n if (d == 0)\n return 1;\n\n var mi = ModularMath.ModInv(_fact[P - d], prime);\n long rz = _fact[P];\n rz *= mi;\n rz %= prime;\n\n return rz;\n }\n\n int valide(int P)\n {\n if (P <= 0)\n return 0;\n\n if (P == 1)\n return 1;\n\n if (_valide[P] >= 0)\n return _valide[P];\n\n int j = k;\n if (P - j <= 0)\n j = P - 1;\n\n long rez = 0;\n\n for (; j >= 1; j--)\n {\n var pos = P - j;\n long valideLeft = valide(pos);\n if (valideLeft == 0)\n break;\n\n int delta = P - pos - 1;\n long aranj = aranjams(P - 2, delta);\n\n long variant = valideLeft * aranj;\n variant %= prime;\n\n rez += variant;\n rez %= prime;\n }\n\n _valide[P] = (int)rez;\n\n return _valide[P];\n }\n\n int valide2(int P)\n {\n if (P <= 0)\n return 0;\n\n if (P == 1)\n return 1;\n\n if (_valide[P] >= 0)\n return _valide[P];\n\n int j = k;\n if (P - j <= 0)\n j = P - 1;\n\n long rez = 0;\n\n var pos = P - j;\n var delta = P - pos;\n long valideLeft = valide2(pos);\n \n long aranj1 = comb(P-1, pos);\n long aranj2 = _fact[P - 1 - pos];\n\n rez = aranj1 * aranj2;\n rez %= prime;\n\n _valide[P] = (int)rez;\n\n return _valide[P];\n }\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n k = ioHelper.ReadNextInt();\n\n ComputeFactorials();\n for (int i = 0; i <= n + 1; i++)\n _valide[i] = -1;\n\n long valideBune = 1;\n long valideTotal = 1;\n\n _valideStricte[1] = 1;\n\n long rz = 0;\n rz = aranjams(n - 1, n - 1) % prime;\n int p;\n for(p=2;p<=n;p++)\n {\n int tmp = (int)((valideBune * aranjams(n - 1, n - p)) % prime);\n \n rz += tmp;\n rz %= prime;\n\n long newValideBune = valideBune;\n _valideStricte[p] = (int)newValideBune;\n newValideBune += valideBune * (p-1);\n newValideBune %= prime;\n if (p > k)\n newValideBune -= (_valideStricte[p - k] * (long)(aranjams(p-1,k)))%prime;\n newValideBune += (long)100 * prime;\n newValideBune %= prime;\n \n valideBune = newValideBune;\n }\n\n long rez = _fact[n];\n rez -= rz;\n\n rez += (10000 * (long)prime);\n\n rez %= prime;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "11e3f596061efb58ae44ca955665870a", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "difficulty": 2400.0} {"lang": "Mono C#", "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 l;\n long r;\n string readStr = System.Console.ReadLine();\n string[] arg = readStr.Split(' ');\n l = int.Parse(arg[0]);\n r = int.Parse(arg[1]);\n\n System.Console.Write(\"{0}\", palindrom(r) - palindrom(l-1)); \n }\n\n public static long palindrom(long arg)\n { \n string str = arg.ToString();\n \n if (str.Length == 1)\n return long.Parse(str[0].ToString());\n else\n {\n long res = 0;\n for (int i = 2; i <= str.Length-1; i++)\n {\n res += (long)System.Math.Pow(10, i - 2) * 9;\n }\n\n int firstDigit = int.Parse(str[0].ToString());\n int lastDigit = int.Parse(str[str.Length - 1].ToString());\n int min = System.Math.Min(firstDigit, lastDigit);\n \n\n if (min > 0)\n res += (long)System.Math.Pow(10, str.Length - 2) * (min - 1);\n res += 9;\n\n if (min != 0)\n {\n string s = str.Remove(0, 1);\n s = s.Remove(s.Length - 1, 1);\n if (s == \"\")\n res++;\n else res += long.Parse(s) + 1;\n \n if (firstDigit > lastDigit)\n res += firstDigit - lastDigit - 1;\n }\n\n \n return res;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "36b4cdbbb1b962426c2784a4a01ab821", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "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 l;\n long r;\n string readStr = System.Console.ReadLine();\n string[] arg = readStr.Split(' ');\n l = int.Parse(arg[0]);\n r = int.Parse(arg[1]);\n\n System.Console.Write(\"{0}\", palindrom(r) - palindrom(l-1)); \n }\n\n public static long palindrom(long arg)\n { \n string str = arg.ToString();\n \n if (str.Length == 1)\n return long.Parse(str[0].ToString());\n else\n {\n long res = 0;\n for (int i = 2; i <= str.Length-1; i++)\n {\n res += (long)System.Math.Pow(10, i - 2) * 9;\n }\n\n int firstDigit = int.Parse(str[0].ToString());\n int lastDigit = int.Parse(str[str.Length - 1].ToString());\n int min = System.Math.Min(firstDigit, lastDigit);\n \n\n if (min > 0)\n res += (long)System.Math.Pow(10, str.Length - 2) * (min - 1);\n res += 9;\n\n if (min != 0)\n {\n long buf = 1;\n for (int i = str.Length - 2; i >= 1; i--)\n buf *= (long.Parse(str[i].ToString()) + 1);\n \n res += buf;\n }\n return res;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f4a3acd50a3b8f54d68d34e7beb12cb3", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "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 private void Solve()\n {\n var a = io.NextLong();\n var b = io.NextLong();\n\n \n\n \n\n io.Print(Calc(b) - Calc(a-1));\n }\n\n private long Calc(long a)\n {\n var al = (a == 0 ? 0 : (long)Math.Log10(a)) + 1;\n\n if (al == 1)\n return a;\n else\n {\n var dgts = new long[al];\n\n var xa = a;\n\n for (int i = 0; i < al; i++)\n {\n dgts[al- i -1] = xa % 10;\n xa = xa / 10;\n }\n\n \n long res = (long)Math.Pow(10, al - 2) * (dgts[0] - 1) + 9;\n\n for (int i = 2; i < al ; i++)\n res += (long)Math.Pow(10, i - 2) * 9;\n \n if (al < 2)\n res++;\n else\n res += (a % (long)Math.Pow(10, al - 1))/10 + 1;\n\n if (dgts[0] > dgts[al - 1])\n res--;\n\n return res;\n }\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9d904ca96d9063b233c617eb2ae3a92e", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "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 private void Solve()\n {\n var a = io.NextLong();\n var b = io.NextLong();\n\n var cnt = new long[9];\n\n var al = (long)Math.Log10(a);\n var bl = (long)Math.Log10(b);\n\n var mlt = (long)Math.Pow(10, al);\n\n for (var i = al; i <= bl; i++)\n {\n for (var j = 0; j < 9; j++)\n {\n long val = j + 1;\n\n if (i > 0)\n val = val * mlt + j + 1;\n\n\n var min = val;\n\n var max = min + ((mlt - 1) / 10) * 10;\n\n if (max > b)\n {\n max = (b / 10) * 10 + j + 1;\n }\n\n if (min < a)\n {\n min = (a / 10) * 10 + j + 1;\n }\n\n if (max >= min && min >= a && max <= b)\n {\n cnt[j] += (max - min) / 10 + 1;\n }\n }\n\n mlt *= 10;\n }\n\n io.Print(cnt.Sum());\n }\n\n\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c1df7a8797ee3c7fbc97f65afef03425", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "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 l;\n long r;\n string readStr = System.Console.ReadLine();\n string[] arg = readStr.Split(' ');\n l = int.Parse(arg[0]);\n r = int.Parse(arg[1]);\n\n System.Console.Write(\"{0}\", palindrom(r) - palindrom(l-1)); \n }\n\n public static long palindrom(long arg)\n { \n string str = arg.ToString();\n \n if (str.Length == 1)\n return long.Parse(str[0].ToString());\n else\n {\n long res = 0;\n for (int i = 2; i <= str.Length-1; i++)\n {\n res += (long)System.Math.Pow(10, i - 2) * 9;\n }\n\n int firstDigit = int.Parse(str[0].ToString());\n int lastDigit = int.Parse(str[str.Length - 1].ToString());\n int min = System.Math.Min(firstDigit, lastDigit);\n\n res += (long)System.Math.Pow(10, str.Length - 2) * (min - 1);\n res += 9;\n\n long buf = 1;\n for (int i = str.Length-2; i >= 1 ; i--)\n buf *= (long.Parse(str[i].ToString()) + 1);\n\n res += buf;\n return res;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "678e2c2fa017cbd5446a250ad3cc507f", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "namespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long l;\n long r;\n string readStr = Console.ReadLine();\n string[] arg = readStr.Split(' ');\n l = int.Parse(arg[0]);\n r = int.Parse(arg[1]);\n\n Console.Write(\"{0}\", palindrom(r) - palindrom(l-1)); \n }\n\n public static long palindrom(long arg)\n { \n string str = arg.ToString();\n \n if (str.Length == 1)\n return long.Parse(str[0].ToString());\n else\n {\n long res = 0;\n for (int i = 2; i <= str.Length-1; i++)\n {\n res += (long)Math.Pow(10, i-2) * 9;\n }\n\n int firstDigit = int.Parse(str[0].ToString());\n int lastDigit = int.Parse(str[str.Length - 1].ToString());\n int min = Math.Min(firstDigit, lastDigit);\n\n res += (long)Math.Pow(10, str.Length - 2) * (min-1);\n res += 9;\n\n long buf = 1;\n for (int i = str.Length-2; i >= 1 ; i--)\n buf *= (long.Parse(str[i].ToString()) + 1);\n\n res += buf;\n return res;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cf8b4c5a468b87998fe36a5f9b5000e2", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "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 l;\n long r;\n string readStr = System.Console.ReadLine();\n string[] arg = readStr.Split(' ');\n l = long.Parse(arg[0]);\n r = long.Parse(arg[1]);\n\n System.Console.Write(\"{0}\", palindrom(r) - palindrom(l-1)); \n }\n\n public static long palindrom(long arg)\n { \n string str = arg.ToString();\n \n if (str.Length == 1)\n return long.Parse(str[0].ToString());\n else\n {\n long res = 0;\n for (int i = 2; i <= str.Length-1; i++)\n {\n res += (long)System.Math.Pow(10, i - 2) * 9;\n }\n\n int firstDigit = int.Parse(str[0].ToString());\n int lastDigit = int.Parse(str[str.Length - 1].ToString());\n int min = System.Math.Min(firstDigit, lastDigit);\n int max = System.Math.Max(firstDigit, lastDigit);\n\n res += (long)System.Math.Pow(10, str.Length - 2) * (firstDigit-1);\n res += 9;\n \n string s = str.Remove(0, 1);\n s = s.Remove(s.Length - 1, 1);\n if (s == \"\")\n res++;\n else res += long.Parse(s) + 1;\n\n if (firstDigit > lastDigit)\n res--;\n \n return res;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "856a0f949f73e92a5ffbd194bb2b95a5", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Little_Elephant_and_Interval\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 string sl = ss[0];\n string sr = ss[1];\n\n long count = 0;\n long d = 1;\n for (int i = 0; i < sl.Length - 1; i++)\n {\n d *= 10;\n }\n for (int i = sl.Length + 1; i < sr.Length; i++)\n {\n count += 9*d;\n d *= 10;\n }\n\n if (sl.Length == sr.Length)\n {\n count += Bigger(sl, true) - Bigger(sr, false);\n }\n else\n {\n count += Bigger(sl, true);\n count += 9*d - Bigger(sr, false);\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static long Bigger(string sl, bool border)\n {\n long l = long.Parse(sl);\n if (sl.Length == 1)\n {\n return 10 - l - (border ? 0 : 1);\n }\n\n long d = 1;\n for (int i = 0; i < sl.Length - 2; i++)\n {\n d *= 10;\n }\n long count = d*(10 - (sl[0] - '0') - 1);\n\n char[] cl = sl.ToCharArray();\n cl[cl.Length - 1] = cl[0];\n\n var sd = new string(cl, 1, cl.Length - 2);\n if (sd.Length == 0)\n sd = \"0\";\n long dd = long.Parse(sd);\n long ll = long.Parse(new string(cl));\n\n if (ll < l || (ll == l && !border))\n dd++;\n\n count += d - dd;\n\n return count;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7b8d423afd39b0e5b99c69bc0e12be43", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "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 private void Solve()\n {\n var a = io.NextLong();\n var b = io.NextLong();\n\n \n\n \n\n io.Print(Calc(b) - Calc(a-1));\n }\n\n private long Calc(long a)\n {\n var al = a.ToString().Length;\n\n if (al == 1)\n return a;\n else\n {\n var dgts = new long[al];\n\n var xa = a;\n\n for (int i = 0; i < al; i++)\n {\n dgts[al- i -1] = xa % 10;\n xa = xa / 10;\n }\n\n \n long res = (long)Math.Pow(10, al - 2) * (dgts[0] - 1) + 9;\n\n for (int i = 2; i < al ; i++)\n res += (long)Math.Pow(10, i - 2) * 9;\n \n if (al < 2)\n res++;\n else\n res += (a % (long)Math.Pow(10, al - 1))/10 + 1;\n\n if (dgts[0] > dgts[al - 1])\n res--;\n\n return res;\n }\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6467de2232da42504bbe16bc5ded0be6", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "MS C#", "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 = long.MaxValue)\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 struct C\n {\n public long x, y;\n public C(long c, long d)\n {\n x = c;\n y = d;\n }\n }\n struct Pair\n {\n public T first, second;\n public Pair(T f, T s)\n {\n first = f;\n second = s;\n }\n }\n static void _a()\n {\n\n }\n static void _b()\n {\n\n }\n static long log10(long x)\n {\n long l = 0;\n while (x > 9)\n {\n ++l;\n x /= 10;\n }\n return l;\n }\n static long f(long x)\n {\n long ans = Math.Min(x, 9), len = log10(x) + 1, p = pow(10, len - 1), xf = x / p, xl = x % 10;\n for (int l = 0; l <= len - 2; ++l)\n {\n for (int i = 1; i <= 9; ++i)\n {\n if (l < len - 2 || i < xf)\n ans += pow(10, l);\n else\n {\n ans += (x - x / p * p) / 10;\n if (i <= xl)\n ++ans;\n break;\n }\n }\n }\n return ans;\n }\n static void _c()\n {\n string[] lr = reader.ReadLine().Split();\n long l = long.Parse(lr[0]), r = long.Parse(lr[1]), ans = f(r);\n ans -= (l == 1) ? 0 : f(l-1);\n writer.Write(ans);\n }\n static void _d()\n {\n\n }\n static void Main(string[] args)\n {\n _c();\n reader.Close();\n writer.Close();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1d6c7b797671046e63d89c9dd4575100", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace CodeforcesSolution\n{\n class ProgramCF\n {\n static ConsoleInput inp;\n static void Main ( string[] args )\n {\n try\n {\n if ( File.Exists ( @\"d:\\zin.txt\" ) )\n Console.SetIn ( new StreamReader ( @\"d:\\zin.txt\" ) );\n }\n catch\n {\n }\n inp = new ConsoleInput ( );\n inp.ReadAll ( );\n long L = inp.NextLong ( );\n long R = inp.NextLong ( );\n long[] cntNumDigit = new long[20];\n cntNumDigit[1] = 10; //0~9\n cntNumDigit[2] = cntNumDigit[1] + 9; //0~99\n cntNumDigit[3] = cntNumDigit[2] + 10 * 9;\n long k=10;\n for ( int i = 4; i < 20; i++ )\n {\n k *= 10;\n cntNumDigit[i] = cntNumDigit[i - 1] + ( k * 9 );\n }\n long fr = F ( R, cntNumDigit );\n long fl = F ( L - 1, cntNumDigit );\n long ans = fr - fl;\n\n // start here\n // ====\n WriteLine ( ans );\n\n }\n\n private static long F ( long n, long[] cntNumDigit )\n {\n if ( n < 100 )\n {\n int cnt=0;\n for ( int i = 0; i <= n; i++ )\n {\n string s = i.ToString ( );\n if ( s[0] == s[s.Length - 1] )\n cnt++;\n }\n return cnt;\n }\n else\n {\n int len = n.ToString().Length;\n long res=cntNumDigit[len - 1];\n long left = n.ToString ( )[0] - '0';\n long right = n % 10;\n long mid = long.Parse ( n.ToString ( ).Substring ( 1, len - 2 ) );\n for ( int i = 1; i <= 9; i++ )\n {\n if ( i < left )\n {\n long add = long.Parse ( \"1\" + new string ( '0', len - 2 ) );\n res += add;\n }\n else if ( i == left )\n {\n res += mid + 1;\n if ( right < left )\n res -= 1;\n }\n }\n return res;\n }\n }\n\n private static void WriteLine ( object value )\n {\n Console.WriteLine ( string.Format ( CultureInfo.InvariantCulture, \"{0}\", value ) );\n }\n\n class ConsoleInput\n {\n List lines = new List ( );\n int idx=0;\n\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 NextString ( )\n {\n return lines[idx++];\n }\n\n public int NextInt ( )\n {\n return int.Parse ( lines[idx++] );\n }\n\n public long NextLong ( )\n {\n return long.Parse ( lines[idx++] );\n }\n\n public double NextDouble ( )\n {\n return double.Parse ( lines[idx++] );\n }\n\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fee9062e47818509c585cf2a91897d86", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce97\n{\n\tclass ClassC\n\t{\n\t\tstatic long Pow10(int p)\n\t\t{\n\t\t\tlong ans = 1;\n\t\t\tfor (int i = 0; i < p; i++)\n\t\t\t\tans *= 10;\n\t\t\treturn ans;\n\t\t}\n\t\tstatic long a(string s)\n\t\t{\n\t\t\tlong ans = 0;\n\t\t\tif (s.Length == 1)\n\t\t\t\treturn int.Parse(s);\n\n\t\t\tint d1 = int.Parse(s[0].ToString());\n\t\t\tint l = s.Length;\n\n\t\t\tans = 9;\n\t\t\tfor (int i = 1; i s[s.Length - 1])\n\t\t\t\t\tans--;\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] ss = Console.ReadLine().Split(' ');\n\t\t\tstring sl = ss[0];\n\t\t\tstring sr = ss[1];\n\n\t\t\tlong ll = a(sl);\n\t\t\tlong lr = a(sr);\n\t\t\tlong ans = lr - ll;\n\t\t\tif (sl[0] == sl[sl.Length - 1])\n\t\t\t\tans++;\n\n\t\t\tConsole.WriteLine(ans);\n\n//\t\t\tConsole.ReadKey();\n\t\t}\n\t}\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c0b8f48b9ffa3368697166f84a96aa67", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\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 int mod = (int)1000000007;\n static long[] fact = new long[500001];\n static long[] factinv = new long[500001];\n static Dictionary memo = new Dictionary();\n // Driver code \n public static void Main()\n {\n\n // var input = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n //var t = input[0];\n //while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n var l = input1[0];\n var r = input1[1];\n //var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n long ans = 0;\n\n long ten = 1;\n for (int i = 1; i <= 18; i++)\n {\n for (int d = 1; d <= 9; d++)\n {\n long low = d * ten, high = (d + 1) * ten - 1;\n low = Math.Max(low, l);\n high = Math.Min(high, r);\n while (low % 10 != d) low++;\n while ((high % 10 + 10) % 10 != d) high--;\n if (low <= high) \n ans += (high - low) / 10 + 1;\n }\n ten *= 10;\n }\n Console.WriteLine(ans);\n }\n\n }\n\n\n\n\n\n public static void Run()\n {\n fact[0] = 1;\n factinv[0] = fast_pow(fact[0], mod - 2);\n for (int i = 1; i <= 500000; ++i)\n {\n fact[i] = fact[i - 1] * i % mod;\n factinv[i] = fast_pow(fact[i], mod - 2);\n }\n }\n public static long GetCom(int n, int r)\n {\n return fact[n] * factinv[r] % mod * factinv[n - r] % mod;\n }\n public static long fast_pow(long a, long b)\n {\n if (b == 0)\n return 1;\n long val = fast_pow(a, b / 2);\n if (b % 2 == 0)\n return val * val % mod;\n else\n return val * val % mod * a % mod;\n }\n\n}\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "560db4fe1fd31bf55028edd73096b612", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "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 l;\n long r;\n string readStr = System.Console.ReadLine();\n string[] arg = readStr.Split(' ');\n l = int.Parse(arg[0]);\n r = int.Parse(arg[1]);\n\n System.Console.Write(\"{0}\", palindrom(r) - palindrom(l-1)); \n }\n\n public static long palindrom(long arg)\n { \n string str = arg.ToString();\n \n if (str.Length == 1)\n return long.Parse(str[0].ToString());\n else\n {\n long res = 0;\n for (int i = 2; i <= str.Length-1; i++)\n {\n res += (long)System.Math.Pow(10, i - 2) * 9;\n }\n\n int firstDigit = int.Parse(str[0].ToString());\n int lastDigit = int.Parse(str[str.Length - 1].ToString());\n int min = System.Math.Min(firstDigit, lastDigit);\n int max = System.Math.Max(firstDigit, lastDigit);\n\n res += (long)System.Math.Pow(10, str.Length - 2) * (firstDigit-1);\n res += 9;\n\n // if (min != 0)\n {\n string s = str.Remove(0, 1);\n s = s.Remove(s.Length - 1, 1);\n if (s == \"\")\n res++;\n else res += long.Parse(s) + 1;\n\n if (firstDigit > lastDigit)\n res--;\n }\n\n \n return res;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f406a1dd3163d3446af05df7477f675a", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "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 private void Solve()\n {\n var a = io.NextLong();\n var b = io.NextLong();\n\n \n\n \n\n io.Print(Calc(b) - Calc(a-1));\n }\n\n private long Calc(long a)\n {\n var al = (long)Math.Log10(a) + 1;\n\n if (al == 1)\n return a;\n else\n {\n var dgts = new long[al];\n\n var xa = a;\n\n for (int i = 0; i < al; i++)\n {\n dgts[al- i -1] = xa % 10;\n xa = xa / 10;\n }\n\n \n long res = (long)Math.Pow(10, al - 2) * (dgts[0] - 1) + 9;\n\n for (int i = 2; i < al ; i++)\n res += (long)Math.Pow(10, i - 2) * 9;\n \n if (al < 2)\n res++;\n else\n res += (a % (long)Math.Pow(10, al - 1))/10 + 1;\n\n if (dgts[0] > dgts[al - 1])\n res--;\n\n return res;\n }\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cb3ad0107b098fec6606dfc9f3879275", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "MS C#", "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 struct C\n {\n public long x, y;\n public C(long c, long d)\n {\n x = c;\n y = d;\n }\n }\n struct Pair\n {\n public T first, second;\n public Pair(T f, T s)\n {\n first = f;\n second = s;\n }\n }\n static void _a()\n {\n\n }\n static void _b()\n {\n\n }\n static long f(long x)\n {\n long ans = Math.Min(x,9), len = (long)Math.Log10(x) + 1, p = (long)Math.Pow(10, len - 1), xf = x / p, xl = x % 10;\n for (int l = 2; l <= len; ++l)\n {\n for (int i = 1; i <= 9; ++i)\n {\n if (l < len || i < xf)\n ans += (long)Math.Pow(10, l - 2);\n else\n {\n ans += (x - x / p * p) / 10;\n if (i <= xl)\n ++ans;\n break;\n }\n }\n }\n return ans;\n }\n static void _c()\n {\n string[] lr = reader.ReadLine().Split();\n long l = long.Parse(lr[0]), r = long.Parse(lr[1]), ans = 0;\n writer.Write(f(r) - f(l-1));\n }\n static void _d()\n {\n\n }\n static void Main(string[] args)\n {\n _c();\n reader.Close();\n writer.Close();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2947b54aae3eed8034dd1d63559ce31f", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "Mono C#", "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 n = int.Parse(Console.ReadLine());\n int[] x = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n int[] y = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n\n if (x.Sum() >= y.Sum())\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n\n }\n }\n} \n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5fe316e9e479c2013a8eea93cdb1e262", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine()); // input\n string line1, line2;\n string[] splitted;\n int[] pile1 = new int[w];\n int[] pile2 = new int[w];\n line1 = Console.ReadLine();\n splitted = line1.Split(\" \");\n for (int j = 0; j < w; j++)\n {\n pile1[j] = Convert.ToInt32(splitted[j]);\n }\n line2 = Console.ReadLine();\n splitted = line2.Split(\" \");\n for (int j = 0; j < w; j++)\n {\n pile2[j] = Convert.ToInt32(splitted[j]);\n }\n if (IsPossible(pile1, pile2))\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n\n }\n\n static bool IsPossible(int[] a, int[] b)\n {\n int sum1 = 0;\n int sum2 = 0;\n for (int i = 0; i < a.Length; i++)\n {\n sum1 += a[i];\n sum2 += b[i];\n }\n return sum1 >= sum2;\n\n }\n\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "26a9d58bb233f457de6a5247b3d77305", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n ReadLine();\n int[] a = Array.ConvertAll(ReadLine().Split(), int.Parse);\n int[] b = Array.ConvertAll(ReadLine().Split(), int.Parse);\n WriteLine(a.Sum()>=b.Sum()?\"Yes\":\"No\");\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d550ca43b587e8908c052b0cf264f6c3", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "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 string[] y1 = Console.ReadLine().Split(' ');\n int sum = 0;\n int sum1 = 0;\n for (int i = 0; i < y.Length; i++)\n {\n sum += int.Parse(y[i]);\n }\n for (int i = 0; i < y1.Length; i++)\n {\n sum1 += int.Parse(y1[i]);\n }\n if (sum >= sum1)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7491f94a980a1a72b69a81bf4b50491b", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nclass some\n{\n\tpublic static void Main()\n\t{\n\t\tConsole.ReadLine();\n\t\tstring[]ss=Console.ReadLine().Split();\n\t\tstring[]ss1=Console.ReadLine().Split();\n\t\tint sum1=0;int sum2=0;\n\t\tforeach(string cc in ss)sum1+=int.Parse(cc);\n\t\tforeach(string cc in ss1)sum2+=int.Parse(cc);\n\t\tif(sum1>=sum2)Console.WriteLine(\"Yes\");\n\t\telse Console.WriteLine(\"No\");\n\t}\n}\t\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1d2e9c4c72192b852c65056712687daf", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "// Problem: 1013A - Piles With Stones\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass PilesWithStones\n {\n public static int Main ()\n {\n string line = Console.ReadLine ();\n if (line == null)\n return -1;\n string[] words = line.Split ();\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 > 50)\n return -1;\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split ();\n if (words.Length != n)\n return -1;\n ushort sumX = 0;\n for (byte i = 0; i < n; i++)\n {\n ushort x;\n if (!UInt16.TryParse (words[i], out x))\n return -1;\n if (x > 1000)\n return -1;\n sumX += x;\n }\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split ();\n if (words.Length != n)\n return -1;\n ushort sumY = 0;\n for (byte i = 0; i < n; i++)\n {\n ushort y;\n if (!UInt16.TryParse (words[i], out y))\n return -1;\n if (y > 1000)\n return -1;\n sumY += y;\n }\n Console.WriteLine (sumX < sumY ? \"No\" : \"Yes\");\n return 0;\n }\n }\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad5ed3e137c65caa0c1d275f7413515c", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Console.ReadLine();\n var s = Console.ReadLine().Split();\n var s1 = Console.ReadLine().Split();\n int sum1=0, sum2=0;\n foreach (var i in s)\n {\n sum1 += Convert.ToInt32(i);\n }\n\n foreach (var i in s1)\n {\n sum2 += Convert.ToInt32(i);\n }\n if(sum1>=sum2)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e0ceb1c3770c82a73d17f11e7ac1a00c", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n public class B\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n string[] token1 = Console.ReadLine().Split();\n string[] token2 = Console.ReadLine().Split();\n \n int sum1 = 0,sum2 = 0;\n \n for(int i=0;isum1)Console.WriteLine(\"No\");\n else Console.WriteLine(\"Yes\");\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "84e2f79b570eddfbdebbb39f53ac2696", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace CS_CodeForces\n{\n internal class Program\n {\n private static void Main()\n {\n ScanInt();\n Console.Write(ScanIntArray().Sum() >= ScanIntArray().Sum() ? \"Yes\" : \"No\");\n }\n\n\n\n // Extensions\n public static string ScanStr()\n {\n return Console.ReadLine();\n }\n\n public static int ScanInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static int[] ScanIntArray()\n {\n string[] inp = Console.ReadLine().Split(' ');\n int[] arr = new int[inp.Length];\n for (int i = 0; i < inp.Length; i++)\n {\n arr[i] = int.Parse(inp[i]);\n }\n\n return arr;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "968a2d12461ddbbc8bb38efee284f15d", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\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 int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] y = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(x.Sum() >= y.Sum() ? \"Yes\" : \"No\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a2ab78f7c18985248491b432b222bd88", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "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 str1 = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray().Sum();\n int str2 = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray().Sum();\n \n \n \n Console.WriteLine(str2>str1?\"NO\":\"YES\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1a65aa2d3a7dc13c39e5df2575c68f8a", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "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 totNums = Convert.ToInt32(Console.ReadLine());\n string inp;string[] arr;\n\n int a = 0, b = 0;\n inp = Console.ReadLine();arr = inp.Split(' ');\n for (int i = 0; i < totNums; i++)\n a += Convert.ToInt32(arr[i]);\n inp = Console.ReadLine();arr = inp.Split(' ');\n for (int i = 0; i < totNums; i++)\n b += Convert.ToInt32(arr[i]);\n\n if (a >= b) Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dfd911f99a0914929c6455dcf0a4132b", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C_Sharp_Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = II(), a = 0, b = 0;\n for (int i = 0; i < n; ++i) a += II();\n for (int i = 0; i < n; ++i) b += II();\n Console.WriteLine(a >= b ? \"Yes\" : \"No\");\n }\n\n private static int II()\n {\n int num = 0;\n bool sign = true;\n char c = getChar();\n while (!((c >= '0' && c <= '9') || c == '-')) c = getChar();\n if (c == '-')\n {\n sign = false;\n c = getChar();\n }\n while (c >= '0' && c <= '9')\n {\n num = (num << 1) + (num << 3) + c - '0';\n c = getChar();\n }\n return sign ? num : -num;\n }\n private static char getChar()\n {\n return (char)Console.Read();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "10e6c85b782b54923274da2eea11daa8", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] Fday = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int[] Sday = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int sum0 = 0, sum1 = 0;\n foreach (int i in Fday)\n {\n sum0 += i;\n }\n foreach (int i in Sday)\n {\n sum1 += i;\n }\n Console.WriteLine(sum0 >= sum1 ? \"Yes\" : \"No\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f442713e2efa1041997630727158e1b2", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Codeforces {\n class Program {\n static void Main(string[] args) {\n Console.ReadLine();\n string[] day1 = Console.ReadLine().Split(' ');\n string[] day2 = Console.ReadLine().Split(' ');\n long sum1 = 0, sum2 = 0;\n foreach (string n in day1) {\n sum1 += long.Parse(n);\n }\n foreach (string n in day2) {\n sum2 += long.Parse(n);\n }\n if (sum1 >= sum2) Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8bc3b9dee974ee1d6e2123cf5f5d0ff", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "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 var a = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n var b = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n\n //--------------------------------solve--------------------------------/\n\n int sum = a.Sum();\n sum -= b.Sum();\n if(sum >= 0)\n Console.WriteLine( \"Yes\" );\n else\n Console.WriteLine( \"No\" );\n\n }\n\n\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5ab8c6b2056f41a9867c39c05137de15", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n\n int[] a = new int[10001];\n int[] b = new int[10001];\n\n int kol1 = 0;\n for(int i = 0; i int.Parse(token)).ToArray();\n int[] y = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n Console.WriteLine(x.Sum() >= y.Sum() ? \"Yes\" : \"No\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d9deba94bbcd8225870bf18a835121a2", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "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 var a = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n var b = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n\n //--------------------------------solve--------------------------------/\n\n int sum = a.Sum();\n sum -= b.Sum();\n if(sum == 0)\n Console.WriteLine( \"Yes\" );\n else\n Console.WriteLine( \"No\" );\n\n }\n\n\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e59f641a9bc052e68168f03faf343bc", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] Fday = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int[] Sday = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int sum0 = 0, sum1 = 0;\n foreach (int i in Fday)\n {\n sum0 += i;\n }\n foreach (int i in Sday)\n {\n sum1 += i;\n }\n Console.WriteLine(sum0 <= sum1 ? \"Yes\" : \"No\");\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9a8b14e73e443c2239ef1e25fa2f3fc0", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n public class B\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n string[] token1 = Console.ReadLine().Split();\n string[] token2 = Console.ReadLine().Split();\n \n int sum1 = 0,sum2 = 0;\n \n for(int i=0;isum1)Console.WriteLine(\"No\");\n else Console.WriteLine(\"Yes\");\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "45aeffc53ce5abb0f269025f5d990848", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "MS C#", "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 Prob13 {\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 n = long.Parse(io.NextToken());\n n %= 360;\n if (n < 0) n += 360;\n if (n >= 315) {\n n = 0;\n }\n int ans = (int)((n - 45 + 89) / 90);\n ans %= 4;\n io.WriteLine(ans);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "be25cde64d8c1d38ffcd199a5ec0127a", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Turn\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 n %= 360;\n\n if (n >= 0)\n {\n if (n <= 45)\n writer.WriteLine(\"0\");\n else if (n <= 45 + 90)\n writer.WriteLine(\"1\");\n else if (n <= 45 + 180)\n writer.WriteLine(\"2\");\n else if (n < 45 + 270)\n writer.WriteLine(\"3\");\n else\n {\n writer.WriteLine(\"0\");\n }\n }\n else\n {\n if (n >= -45)\n writer.WriteLine(\"0\");\n else if (n > -45 - 90)\n writer.WriteLine(\"3\");\n else if (n > -45 - 180)\n writer.WriteLine(\"2\");\n else if (n > -45 - 270)\n writer.WriteLine(\"1\");\n else\n {\n writer.WriteLine(\"0\");\n }\n }\n\n\n writer.WriteLine();\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f965d46f5d903f51e1566d85a18797c1", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "MS C#", "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\n public long Dist(long x)\n {\n x = x % 360L;\n return Math.Min(Math.Abs(x), 360 - Math.Abs(x));\n }\n public void Solve()\n {\n var n = (cin.Read()) % 360L;\n var min = 0L;\n for (var i = 1L; i <= 4; i++)\n {\n var x = Dist(min * 90L - n);\n var y = Dist(i * 90L - n);\n if (y < x)\n {\n min = i;\n }\n }\n cout.WriteLine(min);\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "090382b0d365b0d8f24a670b5d4473af", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "MS C#", "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 Prob13 {\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 n = long.Parse(io.NextToken());\n n %= 360;\n if (n >= 315) {\n n = 0;\n }\n if (n < 0) n += 360;\n int ans = (int)((n - 45 + 89) / 90);\n ans %= 4;\n io.WriteLine(ans);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6c97432767ef11c5921d7fd4724ac999", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "MS C#", "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 Prob13 {\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 n = long.Parse(io.NextToken());\n n %= 360;\n if (n < 0) n += 360;\n int ans = (int)((n - 45 + 89) / 90);\n ans %= 4;\n io.WriteLine(ans);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "82cc6583744bb80ed4de5ccd281ed6c5", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Turn\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 n %= 360;\n\n if (n >= 0)\n {\n if (n <= 45)\n writer.WriteLine(\"0\");\n else if (n <= 45 + 90)\n writer.WriteLine(\"1\");\n else if (n <= 45 + 180)\n writer.WriteLine(\"2\");\n else\n writer.WriteLine(\"3\");\n }\n else\n {\n if (n >= -45)\n writer.WriteLine(\"0\");\n else if (n > -45 - 90)\n writer.WriteLine(\"3\");\n else if (n > -45 - 180)\n writer.WriteLine(\"2\");\n else\n writer.WriteLine(\"1\");\n }\n\n\n writer.WriteLine();\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "069d5cec225be02c7c23e79197f19b1b", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Numerics;\nusing static System.Math;\nusing static System.Array;\nusing static AtCoder.Tool;\nusing static AtCoder.CalcL;\nnamespace AtCoder\n{\n class AC\n {\n //const int MOD = 1000000007;\n const int MOD = 998244353;\n const int INF = int.MaxValue / 2;\n const long SINF = long.MaxValue / 2;\n const double EPS = 1e-8;\n static readonly int[] dI = { 0, 1, 0, -1 };\n static readonly int[] dJ = { 1, 0, -1, 0 };\n static List> G = new List>();\n //List> G = new List>();\n //static List E = new List();\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 //var t = int.Parse(Console.ReadLine());\n for(var _ = 0; _ < 1; _++)\n {\n var input = cin.ReadSplitInt();\n int n = input[0];\n int m = input[1];\n if (m < n - 1)\n {\n Console.WriteLine(0);\n return;\n }\n var md = new Modulo(m + 10, MOD);\n long ans = 0;\n for(var k = n - 1; k <= m; k++)\n {\n ans += md.Mul(md.Pow(2, n - 3), md.Mul(md.Ncr(k - 1, n - 2), (n - 2)));\n ans %= MOD;\n }\n Console.WriteLine(ans);\n }\n\n\n //Console.Out.Flush();\n }\n struct Edge\n {\n public int from;\n\n public int to;\n public long dist;\n public Edge(int t, long c)\n {\n from = -1;\n to = t;\n dist = c;\n }\n public Edge(int f, int t, long c)\n {\n from = f;\n to = t;\n dist = c;\n }\n\n }\n }\n \n public class Scanner\n {\n public int[] ReadSplitInt()\n {\n return ConvertAll(Console.ReadLine().Split(), int.Parse);\n }\n public long[] ReadSplitLong()\n {\n return ConvertAll(Console.ReadLine().Split(), long.Parse);\n }\n public double[] ReadSplit_Double()\n {\n return ConvertAll(Console.ReadLine().Split(), double.Parse);\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 void Swap(ref T a, ref T b)\n {\n T keep = a;\n a = b;\n b = keep;\n }\n\n static public void Display(T[,] array2d, int n, int m)\n {\n for (var i = 0; i < n; i++)\n {\n for (var j = 0; j < m; j++)\n {\n Console.Write($\"{array2d[i, j]} \");\n }\n Console.WriteLine();\n }\n }\n\n static public long LPow(int a, int b)\n {\n return (long)Pow(a, b);\n }\n }\n static public class CalcI\n {\n public static int Gcd(int a, int b)\n {\n if (a * b == 0) { return Max(a, b); }\n return a % b == 0 ? b : Gcd(b, a % b);\n }\n public static int Lcm(int a, int b)\n {\n int g = Gcd(a, b);\n return a / g * b;\n }\n public static int Ceil(int n, int div)\n {\n return (n + div - 1) / div;\n }\n }\n static public class CalcL\n {\n public static long Gcd(long a, long b)\n {\n if (a * b == 0) { return Max(a, b); }\n return a % b == 0 ? b : Gcd(b, a % b);\n }\n public static long Lcm(long a, long b)\n {\n long g = Gcd(a, b);\n return a / g * b;\n }\n public static long Ceil(long n, long div)\n {\n return (n + div - 1) / div;\n }\n }\n class Modulo\n {\n private int M;\n private readonly long[] m_facs;\n public long Mul(long a, long b)\n {\n return ((a * b) % M);\n }\n public Modulo(long n, int m)\n {\n M = m;\n m_facs = new long[n + 1];\n m_facs[0] = 1;\n for (long i = 1; i <= n; ++i)\n {\n m_facs[i] = Mul(m_facs[i - 1], i);\n }\n }\n public long Fac(long n)\n {\n return m_facs[n];\n }\n public long Pow(long a, long m)\n {\n switch (m)\n {\n case 0:\n return 1L;\n case 1:\n return a;\n default:\n long p1 = Pow(a, m / 2);\n long p2 = Mul(p1, p1);\n return ((m % 2) == 0) ? p2 : Mul(p2, a);\n }\n }\n public long Div(long a, long b)\n {\n return Mul(a, Pow(b, M - 2));\n }\n public long Ncr(long n, long r)\n {\n if (n < r) { return 0; }\n if (n == r) { return 1; }\n long res = Fac(n);\n res = Div(res, Fac(r));\n res = Div(res, Fac(n - r));\n return res;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8e5976425e9eb092e637285d1c06d46d", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.0} {"lang": "Mono C#", "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, M;\n sc.Make(out N, out M);\n if (N > M + 1) Fail(0);\n if (N == 2) Fail(0);\n ModInt.Build(M + 1);\n ModInt res = 0;\n\n for(int i = 0; i < N - 2; i++)\n {\n res += ModInt.Comb(N - 3, i);\n }\n res *= ModInt.Comb(M, N - 1);\n WriteLine(res*(N-2));\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5f756a2c13d8d949300b108f17e22e24", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\nusing CompLib.Mathematics;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N, M;\n private ModInt[] Fact;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n Fact = new ModInt[500001];\n Fact[0] = 1;\n for (int i = 1; i <= 500000; i++)\n {\n Fact[i] = Fact[i - 1] * i;\n }\n\n ModInt ans = 0;\n for (int p = 1; p <= M; p++)\n {\n // p \u30da\u30a2\u306b\u306a\u308b\u5024\n\n // \u6b8b\u308a\u306e\u6570\u5b57\u306e\u9078\u3073\u65b9\n var pat = C(M - 1, N - 2) - C(p - 1, N - 2);\n\n // \u6570\u5b57\u306e\u7f6e\u304d\u65b9\n var t = ModInt.Pow(2, N - 3);\n ans += pat * t;\n }\n\n Console.WriteLine(ans);\n }\n\n private ModInt C(int n, int m)\n {\n if (n < m) return 0;\n return Fact[n] * ModInt.Inverse(Fact[m] * Fact[n - m]);\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 = 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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c41f34d31949be16603291120d51a4fe", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.0} {"lang": "Mono C#", "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 public class GCD\n {\n\n public static BigInteger Euclidean(BigInteger n1, BigInteger n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 int Euclidean(int n1, int n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 u, long v)\n {\n\n long inv, u1, u3, v1, v3, t1, t3, q;\n int iter;\n /* Step X1. Initialise */\n u1 = 1;\n u3 = u;\n v1 = 0;\n v3 = v;\n /* Remember odd/even iterations */\n iter = 1;\n /* Step X2. Loop while v3 != 0 */\n while (v3 != 0)\n {\n /* Step X3. Divide and \"Subtract\" */\n q = u3 / v3;\n t3 = u3 % v3;\n t1 = u1 + q * v1;\n /* Swap */\n u1 = v1; v1 = t1; u3 = v3; v3 = t3;\n iter = -iter;\n }\n /* Make sure u3 = gcd(u,v) == 1 */\n if (u3 != 1)\n return 0; /* Error: No inverse exists */\n /* Ensure a positive result */\n if (iter < 0)\n inv = v - u1;\n else\n inv = u1;\n return inv;\n }\n\n public static BigInteger Inverse(BigInteger u, BigInteger v)\n {\n\n BigInteger inv, u1, u3, v1, v3, t1, t3, q;\n int iter;\n /* Step X1. Initialise */\n u1 = 1;\n u3 = u;\n v1 = 0;\n v3 = v;\n /* Remember odd/even iterations */\n iter = 1;\n /* Step X2. Loop while v3 != 0 */\n while (v3 != 0)\n {\n /* Step X3. Divide and \"Subtract\" */\n q = u3 / v3;\n t3 = u3 % v3;\n t1 = u1 + q * v1;\n /* Swap */\n u1 = v1; v1 = t1; u3 = v3; v3 = t3;\n iter = -iter;\n }\n /* Make sure u3 = gcd(u,v) == 1 */\n if (u3 != 1)\n return 0; /* Error: No inverse exists */\n /* Ensure a positive result */\n if (iter < 0)\n inv = v - u1;\n else\n inv = u1;\n return inv;\n }\n\n\n }\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 static long[] factorials;\n static void precompute(long n, long mod)\n {\n factorials = new long[n+1];\n factorials[0] = 1;\n for (int i = 1; i <= n; i++)\n {\n factorials[i] = (factorials[i - 1] * i) % mod;\n }\n }\n \n static long fact(long from, long to, long mod)\n {\n long res = 1L;\n \n if (from == 0)\n {\n from = 1;\n }\n return (factorials[to] * GCD.Inverse(factorials[from - 1], mod )) % mod; \n }\n \n static long selection(long n, long m, long mod) \n {\n if(n < m)\n throw new ArgumentException();\n \n if (n / 2 > m)\n {\n m = n - m;\n }\n return (fact(m+1, n, mod) * GCD.Inverse( fact(2, n - m, mod), mod)) % mod;\n }\n \n\n \n private static void Main(string[] args)\n {\n long mod = 998244353L;\n var nm = readInts();\n long n = nm[0];\n long m = nm[1];\n\n if (n < 3 )\n {\n 0.WriteLine();\n return;\n }\n precompute(m , mod);\n\n var pw = modPow(2, n - 3, mod);\n \n long res = 0;\n for (long i = n - 1; i <= m; i++)\n {\n var perm = selection(i - 2, n - 3, mod);\n \n res+=(((perm * (i - 1)) % mod) * pw) % mod;\n res = res % mod;\n }\n res.WriteLine();\n \n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5cba21467ff4c498a57948a0d26f98c2", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.0} {"lang": "Mono C#", "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 public class GCD\n {\n\n public static BigInteger Euclidean(BigInteger n1, BigInteger n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 int Euclidean(int n1, int n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 u, long v)\n {\n\n long inv, u1, u3, v1, v3, t1, t3, q;\n int iter;\n /* Step X1. Initialise */\n u1 = 1;\n u3 = u;\n v1 = 0;\n v3 = v;\n /* Remember odd/even iterations */\n iter = 1;\n /* Step X2. Loop while v3 != 0 */\n while (v3 != 0)\n {\n /* Step X3. Divide and \"Subtract\" */\n q = u3 / v3;\n t3 = u3 % v3;\n t1 = u1 + q * v1;\n /* Swap */\n u1 = v1; v1 = t1; u3 = v3; v3 = t3;\n iter = -iter;\n }\n /* Make sure u3 = gcd(u,v) == 1 */\n if (u3 != 1)\n return 0; /* Error: No inverse exists */\n /* Ensure a positive result */\n if (iter < 0)\n inv = v - u1;\n else\n inv = u1;\n return inv;\n }\n\n public static BigInteger Inverse(BigInteger u, BigInteger v)\n {\n\n BigInteger inv, u1, u3, v1, v3, t1, t3, q;\n int iter;\n /* Step X1. Initialise */\n u1 = 1;\n u3 = u;\n v1 = 0;\n v3 = v;\n /* Remember odd/even iterations */\n iter = 1;\n /* Step X2. Loop while v3 != 0 */\n while (v3 != 0)\n {\n /* Step X3. Divide and \"Subtract\" */\n q = u3 / v3;\n t3 = u3 % v3;\n t1 = u1 + q * v1;\n /* Swap */\n u1 = v1; v1 = t1; u3 = v3; v3 = t3;\n iter = -iter;\n }\n /* Make sure u3 = gcd(u,v) == 1 */\n if (u3 != 1)\n return 0; /* Error: No inverse exists */\n /* Ensure a positive result */\n if (iter < 0)\n inv = v - u1;\n else\n inv = u1;\n return inv;\n }\n\n\n }\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 static long[] factorials;\n static void precompute(long n, long mod)\n {\n factorials = new long[n+1];\n factorials[0] = 1;\n for (int i = 1; i <= n; i++)\n {\n factorials[i] = (factorials[i - 1] * i) % mod;\n }\n }\n \n static long fact(long from, long to, long mod)\n {\n long res = 1L;\n \n if (from == 0)\n {\n from = 1;\n }\n return (factorials[to] * GCD.Inverse(factorials[from - 1], mod )) % mod; \n }\n \n static long selection(long n, long m, long mod) \n {\n if(n < m)\n throw new ArgumentException();\n \n if (n / 2 > m)\n {\n m = n - m;\n }\n return (fact(m+1, n, mod) * GCD.Inverse( fact(2, n - m, mod), mod)) % mod;\n }\n \n\n \n private static void Main(string[] args)\n {\n long mod = 998244353L;\n var nm = readInts();\n long n = nm[0];\n long m = nm[1];\n\n precompute(m - 2, mod);\n\n var pw = modPow(2, n - 3, mod);\n \n long res = 0;\n for (long i = n - 1; i <= m; i++)\n {\n var perm = selection(i - 2, n - 3, mod);\n \n res+=(((perm * (i - 1)) % mod) * pw) % mod;\n res = res % mod;\n }\n res.WriteLine();\n \n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "429088e442837bb9d1eee7bb9712d0b5", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.0} {"lang": "Mono C#", "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 public class GCD\n {\n\n public static BigInteger Euclidean(BigInteger n1, BigInteger n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 int Euclidean(int n1, int n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 u, long v)\n {\n\n long inv, u1, u3, v1, v3, t1, t3, q;\n int iter;\n /* Step X1. Initialise */\n u1 = 1;\n u3 = u;\n v1 = 0;\n v3 = v;\n /* Remember odd/even iterations */\n iter = 1;\n /* Step X2. Loop while v3 != 0 */\n while (v3 != 0)\n {\n /* Step X3. Divide and \"Subtract\" */\n q = u3 / v3;\n t3 = u3 % v3;\n t1 = u1 + q * v1;\n /* Swap */\n u1 = v1; v1 = t1; u3 = v3; v3 = t3;\n iter = -iter;\n }\n /* Make sure u3 = gcd(u,v) == 1 */\n if (u3 != 1)\n return 0; /* Error: No inverse exists */\n /* Ensure a positive result */\n if (iter < 0)\n inv = v - u1;\n else\n inv = u1;\n return inv;\n }\n\n public static BigInteger Inverse(BigInteger u, BigInteger v)\n {\n\n BigInteger inv, u1, u3, v1, v3, t1, t3, q;\n int iter;\n /* Step X1. Initialise */\n u1 = 1;\n u3 = u;\n v1 = 0;\n v3 = v;\n /* Remember odd/even iterations */\n iter = 1;\n /* Step X2. Loop while v3 != 0 */\n while (v3 != 0)\n {\n /* Step X3. Divide and \"Subtract\" */\n q = u3 / v3;\n t3 = u3 % v3;\n t1 = u1 + q * v1;\n /* Swap */\n u1 = v1; v1 = t1; u3 = v3; v3 = t3;\n iter = -iter;\n }\n /* Make sure u3 = gcd(u,v) == 1 */\n if (u3 != 1)\n return 0; /* Error: No inverse exists */\n /* Ensure a positive result */\n if (iter < 0)\n inv = v - u1;\n else\n inv = u1;\n return inv;\n }\n\n\n }\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 static long fact(long from, long to, long mod)\n {\n long res = 1L;\n for (long i = from; i <= to; i++)\n {\n res *= (i % mod);\n res %= mod;\n \n }\n return res; \n }\n \n static long selection(long n, long m, long mod) \n {\n if(n < m)\n throw new ArgumentException();\n \n if (n / 2 > m)\n {\n m = n - m;\n }\n return (fact(m+1, n, mod) * GCD.Inverse( fact(2, n - m, mod), mod)) % mod;\n }\n \n \n private static void Main(string[] args)\n {\n long mod = 998244353L;\n var nm = readInts();\n long n = nm[0];\n long m = nm[1];\n \n long res = 0;\n for (long i = n - 1; i <= m; i++)\n {\n var perm = selection(i - 2, n - 3, mod);\n \n res+=(((perm * (i - 1)) % mod) * modPow(2, n - 3, mod)) % mod;\n res = res % mod;\n }\n res.WriteLine();\n \n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "07772512b4dbd696f113d77d75e17339", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.0} {"lang": "Mono C#", "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 public class GCD\n {\n\n public static BigInteger Euclidean(BigInteger n1, BigInteger n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 int Euclidean(int n1, int n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 Euclidean(long n1, long n2)\n {\n if (n1 < 1 || n2 < 1)\n {\n throw new ArgumentOutOfRangeException();\n }\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 u, long v)\n {\n\n long inv, u1, u3, v1, v3, t1, t3, q;\n int iter;\n /* Step X1. Initialise */\n u1 = 1;\n u3 = u;\n v1 = 0;\n v3 = v;\n /* Remember odd/even iterations */\n iter = 1;\n /* Step X2. Loop while v3 != 0 */\n while (v3 != 0)\n {\n /* Step X3. Divide and \"Subtract\" */\n q = u3 / v3;\n t3 = u3 % v3;\n t1 = u1 + q * v1;\n /* Swap */\n u1 = v1; v1 = t1; u3 = v3; v3 = t3;\n iter = -iter;\n }\n /* Make sure u3 = gcd(u,v) == 1 */\n if (u3 != 1)\n return 0; /* Error: No inverse exists */\n /* Ensure a positive result */\n if (iter < 0)\n inv = v - u1;\n else\n inv = u1;\n return inv;\n }\n\n public static BigInteger Inverse(BigInteger u, BigInteger v)\n {\n\n BigInteger inv, u1, u3, v1, v3, t1, t3, q;\n int iter;\n /* Step X1. Initialise */\n u1 = 1;\n u3 = u;\n v1 = 0;\n v3 = v;\n /* Remember odd/even iterations */\n iter = 1;\n /* Step X2. Loop while v3 != 0 */\n while (v3 != 0)\n {\n /* Step X3. Divide and \"Subtract\" */\n q = u3 / v3;\n t3 = u3 % v3;\n t1 = u1 + q * v1;\n /* Swap */\n u1 = v1; v1 = t1; u3 = v3; v3 = t3;\n iter = -iter;\n }\n /* Make sure u3 = gcd(u,v) == 1 */\n if (u3 != 1)\n return 0; /* Error: No inverse exists */\n /* Ensure a positive result */\n if (iter < 0)\n inv = v - u1;\n else\n inv = u1;\n return inv;\n }\n\n\n }\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 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 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 static long fact(long from, long to, long mod)\n {\n long res = 1L;\n for (long i = from; i <= to; i++)\n {\n res *= (i % mod);\n res %= mod;\n\n }\n return res; \n }\n\n static long selection(long n, long m, long mod) \n {\n if(n < m)\n throw new ArgumentException();\n\n if (n / 2 > m)\n {\n m = n - m;\n }\n return (fact(m+1, n, mod) * GCD.Inverse( fact(2, n - m, mod), mod)) % mod;\n }\n\n\n private static void Main(string[] args)\n {\n long mod = 998244353L;\n var nm = readInts();\n long n = nm[0];\n long m = nm[1];\n\n long res = 0;\n for (long i = n - 1; i <= m; i++)\n {\n var perm = selection(i - 1, n - 3, mod);\n \n res+=(((perm * (i - 1)) % mod) * modPow(2, n - 3, mod)) % mod;\n res = res % mod;\n }\n res.WriteLine();\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cfb1d5906166a868511ef909c00744ae", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace codeforces\n{\n class Program\n {\n const int N = 2000 * 100;\n\n static int[] a = new int[N];\n\n static bool check(ref int n, ref int m, ref int day)\n {\n long sum = 0;\n int ia = n - 1;\n int iday = 0;\n int num = 0;\n while (ia >= 0 && a[ia] > num)\n {\n sum += a[ia] - num;\n iday++;\n if (iday >= day)\n {\n iday -= day;\n num++;\n }\n ia--;\n }\n return sum >= m;\n }\n\n static void Main(string[] args)\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int m = int.Parse(t[1]);\n t = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; ++i)\n {\n a[i] = int.Parse(t[i]);\n }\n Array.Sort(a, 0, n);\n \n int l = 0;\n int r = n + 1;\n while (l + 1 < r)\n {\n int mid = (l + r) / 2;\n if (check(ref n, ref m, ref mid))\n {\n r = mid;\n }\n else\n {\n l = mid;\n }\n }\n Console.WriteLine(r == n + 1 ? \"-1\" : r.ToString());\n Console.Read();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "43dcb1639beb42817f7a532334cad824", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "Mono C#", "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 m = sr.NextInt32();\n var coffee = sr.ReadArrayOfInt64();\n var start = 1;\n var end = n;\n var sum = coffee.Sum();\n if (sum < m)\n {\n sw.WriteLine(-1);\n return;\n }\n\n Array.Sort(coffee, (a, b) => -a.CompareTo(b));\n var answ = -1;\n while (start <= end)\n {\n var mid = (start + end) / 2;\n var res = 0L;\n for (var i = 0; i < mid; i++)\n {\n res += coffee[i];\n }\n\n var indx = 0;\n var usedCount = Enumerable.Repeat(1, mid).ToArray();\n for (var i = mid; i < n; i++)\n {\n res += Math.Max(0, coffee[i] - usedCount[indx]);\n usedCount[indx]++;\n indx++;\n indx = indx % mid;\n }\n\n if (res >= m)\n {\n end = mid - 1;\n answ = mid;\n }\n else\n {\n start = mid + 1;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5b9557758cba165c2a720dc5002f805d", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "Mono C#", "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, M;\n sc.Make(out N, out M);\n var A = sc.ArrInt;\n Array.Sort(A,(a,b)=>b-a);\n int l = 0, r = N+1;\n while (r - l > 1)\n {\n var m = (r + l) / 2;\n long res = 0;\n int ct = 0;\n for(int i = 0; i < N; i++)\n {\n var d = Max(0, A[i] - ct / m);\n if (d == 0) continue;\n res += d;ct++;\n }\n if (res >= M) r = m;\n else l = m;\n }\n if (r == N + 1) Fail(-1);\n WriteLine(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 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[] 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1b2aa3fbf53c2495f839dd6ab7b3702b", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n int N;\n long M;\n long[] A;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n\n A = sc.LongArray();\n\n Array.Sort(A, (l, r) => r.CompareTo(l));\n\n /*\n * m\u30da\u30fc\u30b8\u66f8\u304f\n * \n * n\u500b\u30b3\u30fc\u30d2\u30fc\n * \n * i\u306fa_i\u30ab\u30d5\u30a7\u30a4\u30f3\n * \n * k\u676f\u98f2\u3080\n * 1\u676f\u76ee a_i\n * 2 a_i-1\n * ...\n * \n * \u6700\u5c0f\u65e5\u6570\n */\n\n int ok = N + 1;\n int ng = 0;\n while (ok - ng > 1)\n {\n int mid = (ok + ng) / 2;\n if (F(mid)) ok = mid;\n else ng = mid;\n }\n\n if(ok <= N)\n {\n Console.WriteLine(ok);\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n\n // d\u65e5\n bool F(int d)\n {\n // \n long t = 0;\n for (int i = 0; i < N; i++)\n {\n t += Math.Max(0, A[i] - i / d);\n }\n\n return t >= M;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "46bd7ab84cebff613f6d009bf44b4f38", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "Mono C#", "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 M = cin.nextint;\n var A = cin.scanint;\n int ok = N + 1;\n int ng = 0;\n Array.Sort(A);\n Array.Reverse(A);\n while (ok - ng > 1)\n {\n int mid = (ok + ng) / 2;\n long sum = 0;\n int cnt = 0;\n int cost = 0;\n for (int i = 0; i < N; i++)\n {\n sum += Max(A[i] - cost, 0);\n cnt++;\n if (cnt == mid)\n {\n cnt = 0;\n cost++;\n }\n }\n if (sum >= M)\n {\n ok = mid;\n }\n else\n {\n ng = mid;\n }\n }\n if (ok == N + 1)\n {\n\n WriteLine(-1);\n }\n else\n {\n WriteLine(ok);\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f28c068ed7309b6b42866830a297d89d", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing CompLib.Util;\n\npublic class Program\n{\n int N, M;\n int[] A;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n A = sc.IntArray();\n\n\n /*\n * n\u500b\u30ab\u30c3\u30d7\n * i\u500b\u76ee\u306b\u306fa[i]\u30ab\u30d5\u30a7\u30a4\u30f3\n * \n * i\u65e5\u306bk\u500b (a_1,a_2...a_k)\u3092\u98f2\u3080\n * \n * 1\u676f\u76ee a_1\n * 2 a_2 -1\n * n a_n - (n-1)\n * \n * m\u3092\u7d42\u308f\u3089\u305b\u308b\u305f\u3081\u306b\u4f55\u65e5\u5fc5\u8981\u304b?\n */\n\n long sum = 0;\n foreach (int l in A)\n {\n sum += l;\n }\n\n // n\u65e5\u3067\u7d42\u308f\u3089\u305b\u308b\n // \n if (sum < M)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n Array.Sort(A, (l, r) => r.CompareTo(l));\n int ng = 0;\n int ok = N;\n while (ok - ng > 1)\n {\n int mid = (ok + ng) / 2;\n // mid\u65e5\u3067\u7d42\u308f\u3089\u305b\u3089\u308c\u308b\u304b?\n if (C(mid)) ok = mid;\n else ng = mid;\n }\n\n Console.WriteLine(ok);\n }\n\n bool C(int d)\n {\n // d\u3092\u5206\u6563\n\n long s = 0;\n for (int i = 0; i < N; i++)\n {\n long l = i / d;\n s += Math.Max(0, A[i] - i / d);\n }\n\n return s >= 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "88bb0d181e13993eb5dfd23ce89bb96a", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing CompLib.Util;\n\npublic class Program\n{\n int N, M;\n int[] A;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n A = sc.IntArray();\n\n\n /*\n * n\u500b\u30ab\u30c3\u30d7\n * i\u500b\u76ee\u306b\u306fa[i]\u30ab\u30d5\u30a7\u30a4\u30f3\n * \n * i\u65e5\u306bk\u500b (a_1,a_2...a_k)\u3092\u98f2\u3080\n * \n * 1\u676f\u76ee a_1\n * 2 a_2 -1\n * n a_n - (n-1)\n * \n * m\u3092\u7d42\u308f\u3089\u305b\u308b\u305f\u3081\u306b\u4f55\u65e5\u5fc5\u8981\u304b?\n */\n\n long sum = 0;\n foreach (int l in A)\n {\n sum += l;\n }\n\n // n\u65e5\u3067\u7d42\u308f\u3089\u305b\u308b\n // \n if (sum < M)\n {\n return;\n }\n\n Array.Sort(A, (l, r) => r.CompareTo(l));\n int ng = 0;\n int ok = N;\n while (ok - ng > 1)\n {\n int mid = (ok + ng) / 2;\n // mid\u65e5\u3067\u7d42\u308f\u3089\u305b\u3089\u308c\u308b\u304b?\n if (C(mid)) ok = mid;\n else ng = mid;\n }\n\n Console.WriteLine(ok);\n }\n\n bool C(int d)\n {\n // d\u3092\u5206\u6563\n\n long s = 0;\n for (int i = 0; i < N; i++)\n {\n long l = i / d;\n s += Math.Max(0, A[i] - i / d);\n }\n\n return s >= 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2377469a83dc780dd9e077778fb80f02", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace RocketB\n{\n class Program\n {\n \n private class Bid\n {\n public int Index;\n public bool Left;\n public int Value;\n public double[] WinRate;\n }\n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int n = 0;\n int.TryParse(str, out n);\n\n var R = new int[n];\n var L = new int[n];\n int min = 100000;\n int max = 0;\n for(int i = 0; i < n; i++)\n {\n str = Console.ReadLine();\n var strs = str.Split(' ');\n int l = 0;\n int r = 0;\n int.TryParse(strs[0], out l);\n int.TryParse(strs[1], out r);\n L[i] = l;\n R[i] = r;\n if(l < min) min = l;\n if(r > max) max = r;\n }\n\n double expected = 0d;\n\n //var debug = new double[max + 1];\n //double weightSum =0;\n for (int price = min; price <= max; price++)\n {\n\n double weight = 0;\n double exactlyOne = 0;\n double less = 1d;\n double notMore = 1d;\n for(int i =0; i < n; i++)\n {\n var ri = R[i];\n var li = L[i];\n var di = ri - li + 1;\n double imoreprob;\n double iNotMoreProb;\n double here = 0d;\n if(li > price)\n {\n less = 0;\n notMore = 0;\n imoreprob = 1;\n iNotMoreProb = 0;\n }\n else\n if(ri < price)\n {\n imoreprob = 0;\n iNotMoreProb = 1;\n //less *= 1;\n //notMore *= 1;\n continue;\n }\n else\n {\n imoreprob = (ri - price) / (double)di;\n notMore *= (price - li + 1) / (double)di;\n less *= (price - li) / (double)di;\n here = 1 / (double)di;\n }\n\n double allNotMore = 1d;\n double allLess = 1d;\n\n for(int j =0; j price)\n {\n allNotMore = allLess = 0;\n }\n else\n if(rj < price)\n {\n //allNotMore *=1 ; allLess *= 1;\n }\n else\n {\n allNotMore *= (price - lj + 1) /(double)dj;\n allLess *= (price - lj) / (double)dj;\n }\n }\n\n weight += imoreprob * (allNotMore - allLess);\n exactlyOne += here * allLess;\n //weight += here *\n }\n weight += (notMore - less - exactlyOne);//2 or more here\n //debug[price] = weight;\n // weightSum += weight;\n expected += price * weight;\n }\n\n Console.WriteLine((expected).ToString(\"F10\", CultureInfo.InvariantCulture)); ;\n\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a0b92548f2e0622ac5e00165c5da20d3", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "MS C#", "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 Write(double val, int precision)\n {\n Int64 valI = (Int64)val;\n writer.Write(valI.ToString());\n double diff = val - valI;\n if (precision > 0)\n writer.Write(\".\");\n int i;\n for (i = 0; i < precision; i++)\n {\n diff *= 10;\n writer.Write(((int)diff).ToString());\n diff -= (int)diff;\n }\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 n;\n int[] l;\n int[] r;\n double[] probThisResult;\n double[] EVThisResult;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n l = new int[n];\n r = new int[n];\n\n probThisResult = new double[10002];\n EVThisResult = new double[10002];\n\n int i;\n for (i = 0; i < n; i++)\n {\n l[i] = ioHelper.ReadNextInt();\n r[i] = ioHelper.ReadNextInt();\n }\n\n int winningBid = 1;\n for (; winningBid <= 10000; winningBid++)\n {\n double probabilityNone = 1.0;\n double probabilityOne = 0;\n double probabilityAtLeastTwo = 0;\n\n for (int loser = 0; loser < n; loser++)\n {\n double hisProbWinning = 1.0;\n if (winningBid < l[loser] || winningBid > r[loser])\n hisProbWinning = 0;\n\n double hisProbLesserThan = (winningBid - l[loser]);\n if (winningBid < l[loser])\n hisProbLesserThan = 0.0;\n if (winningBid > r[loser])\n hisProbLesserThan = r[loser] - l[loser] + 1.0;\n\n probabilityAtLeastTwo = probabilityOne * hisProbWinning + probabilityAtLeastTwo * (hisProbLesserThan + hisProbWinning);\n probabilityOne = probabilityNone * hisProbWinning + probabilityOne * (hisProbLesserThan);\n probabilityNone = probabilityNone * hisProbLesserThan;\n\n probabilityAtLeastTwo /= (r[loser] - l[loser] + 1.0);\n probabilityOne /= (r[loser] - l[loser] + 1.0);\n probabilityNone /= (r[loser] - l[loser] + 1.0);\n }\n\n probThisResult[winningBid] += probabilityAtLeastTwo;\n }\n\n\n int secondBid = 1;\n for (; secondBid < 10001; secondBid++)\n {\n double probAtLeastOneNoWinner = 0;\n double probAtLeastOneWinner = 0;\n double probNoneNoWinner = 1.0;\n double probNoneOneWinner = 0.0;\n\n for (int loser = 0; loser < n; loser++)\n {\n double hisProbSecond = 1.0;\n if (secondBid < l[loser] || secondBid > r[loser])\n hisProbSecond = 0;\n\n double hisProbLesserThan = (secondBid - l[loser]);\n if (secondBid < l[loser])\n hisProbLesserThan = 0;\n if (secondBid > r[loser])\n hisProbLesserThan = 1.0 * (r[loser]-l[loser]+1.0);\n\n double hisProbWinner = (r[loser] - secondBid);\n if (secondBid + 1 > r[loser])\n hisProbWinner = 0;\n if (secondBid + 1 < l[loser])\n hisProbWinner = 1.0 * (r[loser]-l[loser]+1.0);\n\n\n double pnnw = probNoneNoWinner * hisProbLesserThan;\n double pnw = probNoneNoWinner * hisProbWinner + probNoneOneWinner * (hisProbLesserThan);\n double panw = probAtLeastOneNoWinner * (hisProbLesserThan + hisProbSecond) + probNoneNoWinner * (hisProbSecond);\n double paw = probAtLeastOneWinner * (hisProbLesserThan+hisProbSecond) + probAtLeastOneNoWinner * hisProbWinner + probNoneOneWinner * hisProbSecond;\n\n probNoneNoWinner = pnnw;\n probNoneOneWinner = pnw;\n probAtLeastOneNoWinner = panw;\n probAtLeastOneWinner = paw;\n\n probNoneNoWinner /= (r[loser] - l[loser] + 1.0);\n probNoneOneWinner /= (r[loser] - l[loser] + 1.0);\n probAtLeastOneNoWinner /= (r[loser] - l[loser] + 1.0);\n probAtLeastOneWinner /= (r[loser] - l[loser] + 1.0);\n }\n\n probThisResult[secondBid] += probAtLeastOneWinner;\n }\n\n\n double result = 0;\n for (i = 0; i < 10001; i++)\n result += probThisResult[i] * i;\n\n ioHelper.Write(result, 12);\n ioHelper.WriteLine(\"\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fae1bae9a3ab3af70f4a46dc918fda92", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace RocketB\n{\n class Program\n {\n \n private class Bid\n {\n public int Index;\n public bool Left;\n public int Value;\n public double[] WinRate;\n }\n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int n = 0;\n int.TryParse(str, out n);\n\n var R = new int[n];\n var L = new int[n];\n int min = 100000;\n int max = 0;\n for(int i = 0; i < n; i++)\n {\n str = Console.ReadLine();\n var strs = str.Split(' ');\n int l = 0;\n int r = 0;\n int.TryParse(strs[0], out l);\n int.TryParse(strs[1], out r);\n L[i] = l;\n R[i] = r;\n if(l < min) min = l;\n if(r > max) max = r;\n }\n\n double expected = 0d;\n\n //var debug = new double[max + 1];\n //double weightSum =0;\n var more = new double[n];\n var notMore = new double[n];\n var less = new double[n];\n var here = new double[n];\n for (int price = min; price <= max; price++)\n {\n\n double weight = 0;\n double exactlyOne = 0;\n double allLess = 1d;\n double allNotMore = 1d;\n\n bool LessNotZeroed = true;\n bool NotMoreZeroed = true;\n for (int i = 0; i < n; i++)\n {\n var ri = R[i];\n var li = L[i];\n var di = ri - li + 1;\n double currentLess, currentNotMore;\n double currentHere, currentMore;\n if (li > price)\n {\n currentLess = 0;\n currentNotMore = 0;\n currentMore = 1;\n currentHere = 0;\n }\n else if (ri < price)\n {\n currentMore = 0;\n currentLess = 1;\n currentNotMore = 1;\n currentHere = 0;\n }\n else\n {\n currentMore = (ri - price) / (double)di;\n currentNotMore = (price - li + 1) / (double)di;\n currentLess = (price - li) / (double)di;\n currentHere = 1 / (double)di;\n }\n\n more[i] = currentMore;\n notMore[i] = currentNotMore;\n less[i] = currentLess;\n here[i] = currentHere;\n \n if (currentLess == 0 && LessNotZeroed)\n {\n LessNotZeroed = false;\n }\n else\n allLess *= currentLess;\n \n if (currentNotMore == 0 && NotMoreZeroed)\n {\n NotMoreZeroed = false;\n }\n else\n allNotMore *= currentNotMore;\n\n }\n for(int i =0; i < n; i++)\n {\n double allOtherNotMore = NotMoreZeroed ? allNotMore / notMore[i] : (notMore[i] == 0 ? allNotMore : 0);\n double allOtherLess = LessNotZeroed ? allLess / less[i] : (less[i] == 0 ? allLess : 0);\n weight += more[i] * (allOtherNotMore - allOtherLess); //1 more all other less\n exactlyOne += here[i] * allOtherLess;\n }\n if (NotMoreZeroed)\n weight += (allNotMore - (LessNotZeroed ? allLess : 0 ) - exactlyOne);//2 or more here all other less\n //debug[price] = weight;\n // weightSum += weight;\n expected += price * weight;\n }\n Console.WriteLine((expected).ToString(\"F10\", CultureInfo.InvariantCulture));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "876827d517eb50a9a5fb9b52cd3fc582", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "MS C#", "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 C\n {\n private static ThreadStart s_threadStart = new C().Go;\n private static bool s_time = false;\n private static double s_eps = 1e-16;\n\n int n;\n List ranges;\n int[] t;\n\n double P(int x)\n {\n double p = 0.0;\n\n for (int i = 0; i < n; i++)\n {\n t[i] = i;\n }\n\n do\n {\n double xx = 1.0;\n \n //all equal\n if (n > 1)\n {\n xx = 1.0;\n for (int i = 0; i < n; i++)\n {\n xx *= singleP(t[i], x) / (i + 1);\n }\n p += xx;\n }\n\n //all but one equal\n if (n > 2)\n {\n xx = 1.0;\n for (int i = 0; i < n - 1; i++)\n {\n xx *= singleP(t[i], x) / (i + 1);\n }\n xx *= (1.0 - singleP(t[n - 1], x));\n p += xx;\n }\n\n //all but 2 equal\n if (n > 3)\n {\n xx = 1.0;\n for (int i = 0; i < n - 2; i++)\n {\n xx *= singleP(t[i], x) / (i + 1);\n }\n xx *= (biggerP(t[n - 1], x) + smallerP(t[n - 1], x) * 0.5) * smallerP(t[n - 2], x);\n p += xx;\n }\n\n //all but 3 equal = 2 are equal\n if (n == 5)\n {\n xx = 0.5;\n xx *= singleP(t[0], x);\n xx *= singleP(t[1], x);\n xx *= (biggerP(t[2], x) * 0.5 + smallerP(t[2], x) / 6) * smallerP(t[3], x) * smallerP(t[4], x);\n\n p += xx;\n }\n\n //only one equal\n\n xx = singleP(t[0], x);\n xx *= biggerP(t[1], x);\n for (int i = 2; i < n; i++)\n {\n xx *= smallerP(t[i], x) / (i - 1);\n }\n\n p += xx;\n\n } while (NextPermutation(t));\n\n return p;\n }\n\n double singleP(int i, int x)\n {\n if (x < ranges[i][0] || x > ranges[i][1]) return 0.0;\n double span = ranges[i][1] - ranges[i][0] + 1;\n return 1.0 / span;\n }\n\n double biggerP(int i, int x)\n {\n if (x > ranges[i][1]) return 0.0;\n if (x < ranges[i][0]) return 1.0;\n double span = ranges[i][1] - ranges[i][0] + 1;\n double num = ranges[i][1] - x;\n return num / span;\n }\n\n double smallerP(int i, int x)\n {\n if (x > ranges[i][1]) return 1.0;\n if (x < ranges[i][0]) return 0.0;\n double span = ranges[i][1] - ranges[i][0] + 1;\n double num = x - ranges[i][0];\n return num / span;\n }\n\n private void Go()\n {\n n = GetInt();\n ranges = new List(n);\n t = new int[n];\n for (int i = 0; i < n; i++)\n {\n ranges.Add(new int[] { GetInt(), GetInt() });\n }\n\n double ans = 0.0;\n for (int i = 1; i <= 10000; i++)\n {\n ans += P(i) * i;\n }\n\n Wl(ans);\n }\n\n public static bool NextPermutation(T[] arr) where T : IComparable\n {\n return NextPermutation(arr, (a, b) => a.CompareTo(b));\n }\n\n public static bool NextPermutation(T[] arr, Comparison comp)\n {\n return NextPermutation(arr, 0, arr.Length, comp);\n }\n\n public static bool NextPermutation(T[] arr, int start, int count, Comparison comp)\n {\n if (count < 2) return false;\n\n for (int i = start + count - 2; i >= start; --i)\n {\n if (comp(arr[i], arr[i + 1]) < 0)\n {\n for (int j = start + count - 1; ; --j)\n {\n if (comp(arr[i], arr[j]) < 0)\n {\n T tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp;\n Array.Reverse(arr, i + 1, count - (i + 1 - start));\n return true;\n }\n }\n }\n }\n\n Array.Reverse(arr, start, count);\n return false;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3f2ed3eba19d3c713cfab33ea84b4dc7", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "Mono C#", "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 private static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var L = new int[n];\n var R = new int[n];\n for (int i = 0; i < n; ++i)\n {\n var values = Console.ReadLine().Split(' ');\n L[i] = Convert.ToInt32(values[0]);\n R[i] = Convert.ToInt32(values[1]);\n }\n\n double result = 0.0;\n for (int i = 0; i < n; ++i)\n {\n for (int x = 1; x <= R[i]; ++x)\n {\n for (int mask = 1; mask < (1 << (n - 1)); ++mask)\n {\n double p = 1.0;\n int one = 0;\n for (int j = 0; j < n - 1; ++j)\n {\n int index = j >= i ? j + 1 : j;\n if ((mask & (1 << j)) == 0)\n {\n if (L[index] > x)\n {\n p = 0.0;\n }\n else\n {\n p *= 1.0 * (Math.Min(R[index] + 1, x) - L[index]) / (R[index] - L[index] + 1);\n }\n }\n else\n {\n one++;\n if (x >= L[index] && x <= R[index])\n {\n p *= 1.0 / (R[index] - L[index] + 1);\n }\n else\n {\n p = 0.0;\n }\n }\n }\n if (x < L[i])\n {\n result += x * p;\n }\n else\n {\n result += x * p * (1.0 * (R[i] - x) / (R[i] - L[i] + 1) + 1.0 / (R[i] - L[i] + 1) * 1.0 / (one + 1));\n }\n \n }\n }\n }\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "10e6808b970ccca163b5dbb52c5d4c38", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace RocketB\n{\n class Program\n {\n \n private class Bid\n {\n public int Index;\n public bool Left;\n public int Value;\n public double[] WinRate;\n }\n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int n = 0;\n int.TryParse(str, out n);\n\n var R = new int[n];\n var L = new int[n];\n int min = 100000;\n int max = 0;\n for(int i = 0; i < n; i++)\n {\n str = Console.ReadLine();\n var strs = str.Split(' ');\n int l = 0;\n int r = 0;\n int.TryParse(strs[0], out l);\n int.TryParse(strs[1], out r);\n L[i] = l;\n R[i] = r;\n if(l < min) min = l;\n if(r > max) max = r;\n }\n\n double expected = 0d;\n\n //var debug = new double[max + 1];\n //double weightSum =0;\n for (int price = min; price <= max; price++)\n {\n\n double weight = 0;\n double exactlyOne = 0;\n double less = 1d;\n double notMore = 1d;\n for(int i =0; i < n; i++)\n {\n var ri = R[i];\n var li = L[i];\n var di = ri - li + 1;\n double imoreprob;\n double iNotMoreProb;\n double here = 0d;\n if(li > price)\n {\n less = 0;\n notMore = 0;\n imoreprob = 1;\n iNotMoreProb = 0;\n }\n else\n if(ri < price)\n {\n imoreprob = 0;\n iNotMoreProb = 1;\n //less *= 1;\n //notMore *= 1;\n continue;\n }\n else\n {\n imoreprob = (ri - price) / (double)di;\n notMore *= (price - li + 1) / (double)di;\n less *= (price - li) / (double)di;\n here = 1 / (double)di;\n }\n\n double allNotMore = 1d;\n double allLess = 1d;\n\n for(int j =0; j price)\n {\n allNotMore = allLess = 0;\n }\n else\n if(rj < price)\n {\n //allNotMore *=1 ; allLess *= 1;\n }\n else\n {\n allNotMore *= (price - lj + 1) /(double)dj;\n allLess *= (price - lj) / (double)dj;\n }\n }\n\n weight += imoreprob * (allNotMore - allLess);\n exactlyOne += here * allLess;\n //weight += here *\n }\n weight += (notMore - less - exactlyOne);//2 or more here\n //debug[price] = weight;\n // weightSum += weight;\n expected += price * weight;\n }\n\n Console.WriteLine(expected);\n\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2473cd369c36e061ca4102a53e39153c", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "MS C#", "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 C\n {\n private static ThreadStart s_threadStart = new C().Go;\n private static bool s_time = false;\n private static double s_eps = 1e-16;\n\n int n;\n List ranges;\n int[] t;\n\n double P(int x)\n {\n double p = 0.0;\n\n for (int i = 0; i < n; i++)\n {\n t[i] = i;\n }\n\n do\n {\n double xx = 1.0;\n \n //all equal\n if (n > 1)\n {\n xx = 1.0;\n for (int i = 0; i < n; i++)\n {\n xx *= singleP(t[i], x) / (i + 1);\n }\n p += xx;\n }\n\n //all but one equal\n if (n > 2)\n {\n xx = 1.0;\n for (int i = 0; i < n - 1; i++)\n {\n xx *= singleP(t[i], x) / (i + 1);\n }\n xx *= (1.0 - singleP(t[n - 1], x));\n p += xx;\n }\n\n //all but 2 equal\n if (n > 3)\n {\n xx = 1.0;\n for (int i = 0; i < n - 2; i++)\n {\n xx *= singleP(t[i], x) / (i + 1);\n }\n xx *= (biggerP(t[n - 1], x) + smallerP(t[n - 1], x) * 0.5) * smallerP(t[n - 2], x);\n p += xx;\n }\n\n //all but 3 equal = 2 are equal\n if (n == 5)\n {\n xx = 0.0;\n xx *= singleP(t[0], x);\n xx *= singleP(t[1], x);\n xx *= (biggerP(t[2], x) * 0.5 + smallerP(t[2], x) / 6) * smallerP(t[3], x) * smallerP(t[4], x);\n }\n\n //only one equal\n\n xx = singleP(t[0], x);\n xx *= biggerP(t[1], x);\n for (int i = 2; i < n; i++)\n {\n xx *= smallerP(t[i], x) / (i - 1);\n }\n\n p += xx;\n\n } while (NextPermutation(t));\n\n return p;\n }\n\n double singleP(int i, int x)\n {\n if (x < ranges[i][0] || x > ranges[i][1]) return 0.0;\n double span = ranges[i][1] - ranges[i][0] + 1;\n return 1.0 / span;\n }\n\n double biggerP(int i, int x)\n {\n if (x > ranges[i][1]) return 0.0;\n if (x < ranges[i][0]) return 1.0;\n double span = ranges[i][1] - ranges[i][0] + 1;\n double num = ranges[i][1] - x;\n return num / span;\n }\n\n double smallerP(int i, int x)\n {\n if (x > ranges[i][1]) return 1.0;\n if (x < ranges[i][0]) return 0.0;\n double span = ranges[i][1] - ranges[i][0] + 1;\n double num = x - ranges[i][0];\n return num / span;\n }\n\n private void Go()\n {\n n = GetInt();\n ranges = new List(n);\n t = new int[n];\n for (int i = 0; i < n; i++)\n {\n ranges.Add(new int[] { GetInt(), GetInt() });\n }\n\n double ans = 0.0;\n for (int i = 1; i <= 10000; i++)\n {\n ans += P(i) * i;\n }\n\n Wl(ans);\n }\n\n public static bool NextPermutation(T[] arr) where T : IComparable\n {\n return NextPermutation(arr, (a, b) => a.CompareTo(b));\n }\n\n public static bool NextPermutation(T[] arr, Comparison comp)\n {\n return NextPermutation(arr, 0, arr.Length, comp);\n }\n\n public static bool NextPermutation(T[] arr, int start, int count, Comparison comp)\n {\n if (count < 2) return false;\n\n for (int i = start + count - 2; i >= start; --i)\n {\n if (comp(arr[i], arr[i + 1]) < 0)\n {\n for (int j = start + count - 1; ; --j)\n {\n if (comp(arr[i], arr[j]) < 0)\n {\n T tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp;\n Array.Reverse(arr, i + 1, count - (i + 1 - start));\n return true;\n }\n }\n }\n }\n\n Array.Reverse(arr, start, count);\n return false;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "abb6fef00449eb4637af681e8dcb3bc0", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "MS C#", "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 Write(double val, int precision)\n {\n Int64 valI = (Int64)val;\n writer.Write(valI.ToString());\n double diff = val - valI;\n if (diff > 0)\n writer.Write(\".\");\n int i;\n for (i = 0; i < precision; i++)\n {\n diff *= 10;\n writer.Write(((int)diff).ToString());\n diff -= (int)diff;\n }\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 n;\n int[] l;\n int[] r;\n double[] probThisResult;\n double[] EVThisResult;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n l = new int[n];\n r = new int[n];\n\n probThisResult = new double[10002];\n EVThisResult = new double[10002];\n\n int i;\n for (i = 0; i < n; i++)\n {\n l[i] = ioHelper.ReadNextInt();\n r[i] = ioHelper.ReadNextInt();\n }\n\n int winningBid = 1;\n for (; winningBid <= 10000; winningBid++)\n {\n double probabilityNone = 1.0;\n double probabilityOne = 0;\n double probabilityAtLeastTwo = 0;\n\n for (int loser = 0; loser < n; loser++)\n {\n double hisProbWinning = 1.0;\n if (winningBid < l[loser] || winningBid > r[loser])\n hisProbWinning = 0;\n\n double hisProbLesserThan = (winningBid - l[loser]);\n if (winningBid < l[loser])\n hisProbLesserThan = 0.0;\n if (winningBid > r[loser])\n hisProbLesserThan = r[loser] - l[loser] + 1.0;\n\n probabilityAtLeastTwo = probabilityOne * hisProbWinning + probabilityAtLeastTwo * (hisProbLesserThan + hisProbWinning);\n probabilityOne = probabilityNone * hisProbWinning + probabilityOne * (hisProbLesserThan);\n probabilityNone = probabilityNone * hisProbLesserThan;\n\n probabilityAtLeastTwo /= (r[loser] - l[loser] + 1.0);\n probabilityOne /= (r[loser] - l[loser] + 1.0);\n probabilityNone /= (r[loser] - l[loser] + 1.0);\n }\n\n probThisResult[winningBid] += probabilityAtLeastTwo;\n }\n\n\n int secondBid = 1;\n for (; secondBid < 10001; secondBid++)\n {\n double probAtLeastOneNoWinner = 0;\n double probAtLeastOneWinner = 0;\n double probNoneNoWinner = 1.0;\n double probNoneOneWinner = 0.0;\n\n for (int loser = 0; loser < n; loser++)\n {\n double hisProbSecond = 1.0;\n if (secondBid < l[loser] || secondBid > r[loser])\n hisProbSecond = 0;\n\n double hisProbLesserThan = (secondBid - l[loser]);\n if (secondBid < l[loser])\n hisProbLesserThan = 0;\n if (secondBid > r[loser])\n hisProbLesserThan = 1.0 * (r[loser]-l[loser]+1.0);\n\n double hisProbWinner = (r[loser] - secondBid);\n if (secondBid + 1 > r[loser])\n hisProbWinner = 0;\n if (secondBid + 1 < l[loser])\n hisProbWinner = 1.0 * (r[loser]-l[loser]+1.0);\n\n\n double pnnw = probNoneNoWinner * hisProbLesserThan;\n double pnw = probNoneNoWinner * hisProbWinner + probNoneOneWinner * (hisProbLesserThan);\n double panw = probAtLeastOneNoWinner * (hisProbLesserThan + hisProbSecond) + probNoneNoWinner * (hisProbSecond);\n double paw = probAtLeastOneWinner * (hisProbLesserThan+hisProbSecond) + probAtLeastOneNoWinner * hisProbWinner + probNoneOneWinner * hisProbSecond;\n\n probNoneNoWinner = pnnw;\n probNoneOneWinner = pnw;\n probAtLeastOneNoWinner = panw;\n probAtLeastOneWinner = paw;\n\n probNoneNoWinner /= (r[loser] - l[loser] + 1.0);\n probNoneOneWinner /= (r[loser] - l[loser] + 1.0);\n probAtLeastOneNoWinner /= (r[loser] - l[loser] + 1.0);\n probAtLeastOneWinner /= (r[loser] - l[loser] + 1.0);\n }\n\n probThisResult[secondBid] += probAtLeastOneWinner;\n }\n\n\n double result = 0;\n for (i = 0; i < 10001; i++)\n result += probThisResult[i] * i;\n\n ioHelper.Write(result, 10);\n ioHelper.WriteLine(\"\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "011293d6ce991b208d2b347c3458287a", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing Kattis.IO;\nusing System.Collections.Generic;\n\npublic class _513C {\n\n static int n;\n static int[] l, r;\n static double numerator = 0, denominator = 1;\n static int[] mask, tmp;\n static int second;\n\n public static void Main (string[] args) {\n\n var cin = new Tokenizer(Console.OpenStandardInput());\n var cout = new BufferedStdoutWriter ();\n\n n = int.Parse (cin.Next ());\n l = new int[n];\n r = new int[n];\n for (int i = 0; i < n; i++) {\n l [i] = int.Parse (cin.Next ());\n r [i] = int.Parse (cin.Next ());\n denominator *= (r [i] - l [i] + 1);\n }\n\n mask = new int[n];\n tmp = new int[n];\n\n for (second = 1; second <= 10000; second++)\n dfs (0);\n\n cout.WriteLine (\"{0:F20}\", numerator / denominator);\n cout.Close ();\n }\n\n static int calc (int l, int r, int ll, int rr) {\n if (ll > l)\n l = ll;\n if (rr < r)\n r = rr;\n return l <= r ? (r - l + 1) : 0;\n }\n\n static void dfs (int t) {\n if (t >= n) {\n for (int i = 0; i < n; i++)\n tmp [i] = mask [i];\n Array.Sort (tmp);\n if (tmp [n - 2] == 0) {\n double prod = 1;\n for (int i = 0; i < n; i++)\n if (mask [i] == 1)\n prod *= calc (l [i], r [i], second + 1, int.MaxValue);\n else if (mask [i] == 0)\n prod *= calc (l [i], r [i], second, second);\n else\n prod *= calc (l [i], r [i], 0, second - 1);\n numerator += second * prod;\n }\n } else {\n for (int i = -1; i <= 1; i++) {\n mask [t] = i;\n dfs (t + 1);\n }\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ff72d71b521f2d8502baea4bf5c4a47b", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "MS C#", "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 C\n {\n private static ThreadStart s_threadStart = new C().Go;\n private static bool s_time = false;\n private static double s_eps = 1e-16;\n\n int n;\n List ranges;\n int[] t;\n\n double P(int x)\n {\n double p = 0.0;\n\n for (int i = 0; i < n; i++)\n {\n t[i] = i;\n }\n\n do\n {\n double xx = 1.0;\n \n //all equal\n if (n > 1)\n {\n xx = 1.0;\n for (int i = 0; i < n; i++)\n {\n xx *= singleP(t[i], x) / (i + 1);\n }\n p += xx;\n }\n\n //all but one equal\n if (n > 2)\n {\n xx = 1.0;\n for (int i = 0; i < n - 1; i++)\n {\n xx *= singleP(t[i], x) / (i + 1);\n }\n xx *= (1.0 - singleP(t[n - 1], x));\n p += xx;\n }\n\n //all but 2 equal\n if (n > 3)\n {\n xx = 1.0;\n for (int i = 0; i < n - 2; i++)\n {\n xx *= singleP(t[i], x) / (i + 1);\n }\n xx *= (biggerP(t[n - 1], x) + smallerP(t[n - 1], x) * 0.5) * smallerP(t[n - 2], x);\n p += xx;\n }\n\n //all but 3 equal = 2 are equal\n if (n == 5)\n {\n xx = 0.5;\n xx *= singleP(t[0], x);\n xx *= singleP(t[1], x);\n xx *= (biggerP(t[2], x) * 0.5 + smallerP(t[2], x) / 6) * smallerP(t[3], x) * smallerP(t[4], x);\n }\n\n //only one equal\n\n xx = singleP(t[0], x);\n xx *= biggerP(t[1], x);\n for (int i = 2; i < n; i++)\n {\n xx *= smallerP(t[i], x) / (i - 1);\n }\n\n p += xx;\n\n } while (NextPermutation(t));\n\n return p;\n }\n\n double singleP(int i, int x)\n {\n if (x < ranges[i][0] || x > ranges[i][1]) return 0.0;\n double span = ranges[i][1] - ranges[i][0] + 1;\n return 1.0 / span;\n }\n\n double biggerP(int i, int x)\n {\n if (x > ranges[i][1]) return 0.0;\n if (x < ranges[i][0]) return 1.0;\n double span = ranges[i][1] - ranges[i][0] + 1;\n double num = ranges[i][1] - x;\n return num / span;\n }\n\n double smallerP(int i, int x)\n {\n if (x > ranges[i][1]) return 1.0;\n if (x < ranges[i][0]) return 0.0;\n double span = ranges[i][1] - ranges[i][0] + 1;\n double num = x - ranges[i][0];\n return num / span;\n }\n\n private void Go()\n {\n n = GetInt();\n ranges = new List(n);\n t = new int[n];\n for (int i = 0; i < n; i++)\n {\n ranges.Add(new int[] { GetInt(), GetInt() });\n }\n\n double ans = 0.0;\n for (int i = 1; i <= 10000; i++)\n {\n ans += P(i) * i;\n }\n\n Wl(ans);\n }\n\n public static bool NextPermutation(T[] arr) where T : IComparable\n {\n return NextPermutation(arr, (a, b) => a.CompareTo(b));\n }\n\n public static bool NextPermutation(T[] arr, Comparison comp)\n {\n return NextPermutation(arr, 0, arr.Length, comp);\n }\n\n public static bool NextPermutation(T[] arr, int start, int count, Comparison comp)\n {\n if (count < 2) return false;\n\n for (int i = start + count - 2; i >= start; --i)\n {\n if (comp(arr[i], arr[i + 1]) < 0)\n {\n for (int j = start + count - 1; ; --j)\n {\n if (comp(arr[i], arr[j]) < 0)\n {\n T tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp;\n Array.Reverse(arr, i + 1, count - (i + 1 - start));\n return true;\n }\n }\n }\n }\n\n Array.Reverse(arr, start, count);\n return false;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "561248e0c940a3e08315629c1311377b", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "MS C#", "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 n;\n int[] l;\n int[] r;\n double[] probThisResult;\n double[] EVThisResult;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n l = new int[n];\n r = new int[n];\n\n probThisResult = new double[10002];\n EVThisResult = new double[10002];\n\n int i;\n for (i = 0; i < n; i++)\n {\n l[i] = ioHelper.ReadNextInt();\n r[i] = ioHelper.ReadNextInt();\n }\n\n int winningBid = 1;\n for (; winningBid <= 10000; winningBid++)\n {\n double probabilityNone = 1.0;\n double probabilityAtLeastOne = 0;\n double probabilityAtLeastTwo = 0;\n\n for (int loser = 0; loser < n; loser++)\n {\n double hisProbWinning = 1.0 / (r[loser] - l[loser] + 1.0);\n if (winningBid < l[loser] || winningBid > r[loser])\n hisProbWinning = 0;\n\n double hisProbLesserThan = (winningBid - l[loser]) / (r[loser] - l[loser] + 1.0);\n if (winningBid < l[loser])\n hisProbLesserThan = 0.0;\n if (winningBid > r[loser])\n hisProbLesserThan = 1.0;\n\n probabilityAtLeastTwo = probabilityAtLeastOne * hisProbWinning + probabilityAtLeastTwo * (hisProbLesserThan + hisProbWinning);\n probabilityAtLeastOne = probabilityNone * hisProbWinning + probabilityAtLeastOne * (hisProbLesserThan + hisProbWinning);\n probabilityNone = probabilityNone * hisProbLesserThan;\n }\n\n if (probabilityAtLeastOne > 0)\n {\n probThisResult[winningBid] += probabilityAtLeastTwo;\n }\n }\n\n\n int secondBid = 1;\n for (; secondBid < 10001; secondBid++)\n {\n double probAtLeastOneNoWinner = 0;\n double probAtLeastOneWinner = 0;\n double probNoneNoWinner = 1.0;\n double probNoneOneWinner = 0.0;\n\n for (int loser = 0; loser < n; loser++)\n {\n double hisProbSecond = 1.0 / (r[loser] - l[loser] + 1.0);\n if (secondBid < l[loser] || secondBid > r[loser])\n hisProbSecond = 0;\n\n double hisProbLesserThan = (secondBid - l[loser]) / (r[loser] - l[loser] + 1.0);\n if (secondBid < l[loser])\n hisProbLesserThan = 0;\n if (secondBid > r[loser])\n hisProbLesserThan = 1.0;\n\n double hisProbWinner = (r[loser] - secondBid) / (r[loser] - l[loser] + 1.0);\n if (secondBid + 1 > r[loser])\n hisProbWinner = 0;\n if (secondBid + 1 < l[loser])\n hisProbWinner = 1.0;\n\n\n double pnnw = probNoneNoWinner * hisProbLesserThan;\n double pnw = probNoneNoWinner * hisProbWinner + probNoneOneWinner * (hisProbLesserThan);\n double panw = probAtLeastOneNoWinner * (hisProbLesserThan + hisProbSecond) + probNoneNoWinner * (hisProbSecond);\n double paw = probAtLeastOneWinner * (hisProbLesserThan + hisProbSecond) + probAtLeastOneNoWinner * hisProbWinner + probNoneOneWinner * hisProbSecond;\n\n probNoneNoWinner = pnnw;\n probNoneOneWinner = pnw;\n probAtLeastOneNoWinner = panw;\n probAtLeastOneWinner = paw;\n }\n\n probThisResult[secondBid] = probAtLeastOneWinner;\n }\n\n\n double result = 0;\n for (i = 0; i < 10001; i++)\n result += probThisResult[i] * i;\n\n Console.WriteLine(result.ToString(\"F\"));\n\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b2104cf62bd5a0f00d24f9ba42d6f115", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "MS C#", "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\n public void Solve()\n {\n var n = sc.Integer();\n var l = new int[n];\n var r = new int[n];\n var dp = new double[10001];\n const int max = 10;\n for (int i = 0; i < n; i++)\n {\n l[i] = sc.Integer();\n r[i] = sc.Integer();\n }\n {\n var other = new double[max];\n for (int i = l[0]; i <= r[0]; i++)\n for (int j = l[1]; j <= r[1]; j++)\n for (int k = l[2]; k <= r[2]; k++)\n {\n var v = new int[] { i, j, k };\n\n }\n\n\n }\n\n\n for (int v = 1; v <= max; v++)\n {\n for (int top = -1; top < n; top++)\n {\n for (int sec = 1; sec < 1 << n; sec++)\n {\n if (top == -1)\n {\n var count = 0;\n for (int k = 0; k < n; k++)\n if ((sec >> k) % 2 == 1) count++;\n if (count == 1) continue;\n }\n var f = new int[n];\n var flag = true;\n for (int k = 0; k < n; k++)\n {\n if (top == k)\n {\n if (r[k] <= v)\n {\n flag = false; break;\n }\n f[k] |= 1;\n }\n if ((sec >> k) % 2 == 1)\n {\n if (v < l[k] || r[k] < v)\n {\n flag = false; break;\n }\n f[k] |= 2;\n }\n if (f[k] == 3)\n {\n flag = false; break;\n }\n if (f[k] == 0)\n {\n if (v <= l[k])\n {\n flag = false; break;\n }\n }\n }\n\n\n if (!flag) continue;\n var p = 1.0;\n for (int k = 0; k < n; k++)\n {\n if (top == k)\n {\n p *= 1.0 * (r[k] - Math.Max(l[k], v + 1) + 1) / (r[k] - l[k] + 1);\n }\n else if ((sec >> k) % 2 == 1)\n {\n p *= 1.0 / (r[k] - l[k] + 1);\n }\n else\n {\n p *= 1.0 * (Math.Min(r[k], v - 1) - l[k] + 1) / (r[k] - l[k] + 1);\n }\n\n }\n //Debug.WriteLine(\"{0}: top:{1} sec:{2} p:{3} \", v, top, sec, p);\n dp[v] += p;\n }\n }\n }\n var ans = 0.0;\n for (int i = 0; i <= 10000; i++)\n {\n ans += i * dp[i];\n }\n IO.Printer.Out.WriteLine(ans);\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\n\n\n\n\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0ec8a2eb725f056e95f1a83d7b2d2106", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cf\n{\n class Program\n {\n private int n;\n private int k;\n private int[] nums;\n private int startIndex;\n private int total;\n\n void searchLuckNumber(uint now)\n {\n if (now <= n)\n {\n if (isLuckNumber(getNum(now))) total++;\n\n searchLuckNumber(now * 10 + 4);\n searchLuckNumber(now * 10 + 7);\n }\n }\n\n uint getNum(uint index)\n {\n if (index < startIndex)\n {\n return index;\n }\n return (uint)nums[index - startIndex];\n }\n\n static Boolean isLuckNumber(uint num)\n {\n string str = string.Format(\"{0}\", num);\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] != '4' && str[i] != '7')\n {\n return false;\n }\n }\n return true;\n }\n\n void solve()\n {\n int[] f = new int[16];\n f[0] = 1;\n for (int i = 1; i <= 15; i++)\n {\n f[i] = f[i - 1] * i;\n }\n\n string nk = Console.ReadLine();\n string[] nks = nk.Split(' ');\n n = int.Parse(nks[0]);\n k = int.Parse(nks[1]);\n int orin = n;\n int orik = k;\n\n n = Math.Min(n, 15);\n startIndex = orin - n + 1;\n nums = new int[n];\n bool[] used = new bool[n + 1];\n int based = orin - n;\n for (int i = 0; i < n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n if (used[j]) continue;\n if (k > f[n - 1 - i])\n {\n k -= f[n - 1 - i];\n }\n else\n {\n used[j] = true;\n nums[i] = based + j;\n break;\n }\n }\n }\n\n k = orik;\n n = orin;\n\n searchLuckNumber(4);\n searchLuckNumber(7);\n\n Console.WriteLine(total);\n }\n\n static void Main(string[] args)\n {\n Program m = new Program();\n m.solve();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6dce330f2f1ee2b035b838f62e14d001", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass MainClass{\n int fact(int x)\n {\n return x == 0 ? 1 : fact(x - 1) * x;\n }\n\n int pow(int x, int y)\n {\n return y == 0 ? 1 : pow(x, y - 1) * x;\n }\n void gen47s(List arr, int piv, int bias, int n)\n {\n if (piv == 0)\n {\n if (bias + 4 <= n)\n arr.Add(bias + 4);\n if (bias + 7 <= n)\n arr.Add(bias + 7);\n }\n else\n {\n gen47s(arr, piv - 1, bias + 4 * pow(10, piv), n);\n gen47s(arr, piv - 1, bias + 7 * pow(10, piv), n);\n }\n }\n\n int main(int n, int k)\n {\n int ans = 0;\n --k;\n if (n <= 12 && k >= fact(n))\n {\n ans = -1;\n return ans;\n }\n int cons = 12;\n for (cons = 12; cons > 0; --cons)\n if (k >= fact(cons))\n break;\n List rest = new List();\n for (int i = n - cons; i <= n; ++i)\n rest.Add(i);\n List arr47 = new List();\n for (int i = 0; i < (\"\" + n).Length; ++i)\n gen47s(arr47, i, 0, n);\n for (int i = arr47.Count - 1; i >= 0; --i)\n if (arr47[i] < n - cons)\n {\n ans = i + 1;\n break;\n }\n foreach (int i in rest.ToArray())\n {\n int q = k / fact(n - i);\n int current = rest[q];\n rest.Remove(current);\n if (arr47.Contains(i) && arr47.Contains(current))\n ans++;\n k -= q * fact(n - i);\n }\n return ans;\n }\n static void Main(){\n int n, k;\n string[] items = Console.ReadLine().Split(' ');\n n = int.Parse(items[0]);\n k = int.Parse(items[1]);\n MainClass mn = new MainClass();\n Console.Write(mn.main(n, k));\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ddae3f78303277723113cae2bcda560b", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _LuckyPermutation\n{\n public class Puzzle\n {\n private static readonly long[] Factorials =\n new[] { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800 };\n\n public static int[] FindPerm(int n, int k)\n {\n if (k < 1) return null;\n if (n > 13) return null;\n if (k > Factorials[n]) return null;\n\n var perm = new List { 0 };\n\n var pos = 1L;\n for (var i = n; i > 0; i--)\n {\n var f = Factorials[i - 1];\n for (var j = 1; j <= n; j++)\n {\n if (perm.Contains(j)) continue;\n\n if (pos + f > k)\n {\n perm.Add(j);\n break;\n }\n pos += f;\n }\n }\n\n return perm.ToArray();\n }\n }\n\n class ProgramLuckyPermutation\n {\n static void Main(/*string[] args*/)\n {\n var result = Console.ReadLine();\n if (result == null) return;\n var strnk = result.Split();\n var n = Convert.ToInt32(strnk[0]); // permutation of integers between 1 and n\n var k = Convert.ToInt32(strnk[1]); // lexicographical number of the permutation\n\n var seq = Puzzle.FindPerm(n, k);\n\n if (seq == null) Console.WriteLine(\"-1\");\n else\n {\n var count = 0;\n for (var j = 1; j < seq.Count(); j++)\n {\n if ((j==4 || j==7) && (seq[j] == 4 || seq[j] == 7))\n {\n count++;\n }\n //Console.Write(\"{0},\", seq[j]);\n }\n Console.WriteLine(count);\n }\n //Console.WriteLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5c5b97a1a4dda58890dfc11db8b460d4", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass MainClass{\n int fact(int x)\n {\n return x == 0 ? 1 : fact(x - 1) * x;\n }\n\n long pow(int x, int y)\n {\n return y == 0 ? 1 : pow(x, y - 1) * x;\n }\n void gen47s(List arr, int piv, long bias, int n)\n {\n if (piv == 0)\n {\n if (bias + 4 <= n)\n arr.Add((int)(bias + 4));\n if (bias + 7 <= n)\n arr.Add((int)(bias + 7));\n }\n else\n {\n gen47s(arr, piv - 1, bias + 4 * pow(10, piv), n);\n gen47s(arr, piv - 1, bias + 7 * pow(10, piv), n);\n }\n }\n int main(int n, int k)\n {\n int ans = 0;\n --k;\n if (n <= 12 && k >= fact(n))\n {\n ans = -1;\n return ans;\n }\n int cons = 12;\n for (cons = 12; cons > 0; --cons)\n if (k >= fact(cons))\n break;\n List rest = new List();\n for (int i = n - cons; i <= n; ++i)\n rest.Add(i);\n List arr47 = new List();\n for (int i = 0; i < (\"\" + n).Length; ++i)\n gen47s(arr47, i, 0, n);\n for (int i = arr47.Count - 1; i >= 0; --i)\n if (arr47[i] < n - cons)\n {\n ans = i + 1;\n break;\n }\n foreach (int i in rest.ToArray())\n {\n int q = k / fact(n - i);\n int current = rest[q];\n rest.Remove(current);\n if (arr47.Contains(i) && arr47.Contains(current))\n ans++;\n k -= q * fact(n - i);\n }\n return ans;\n }\n static void Main(){\n int n, k;\n var items = Console.ReadLine().Split(' ');\n n = int.Parse(items[0]);\n k = int.Parse(items[1]);\n MainClass mn = new MainClass();\n Console.Write(mn.main(n, k));\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "712b1eb9d7d5df5d287d228f50ac54cb", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass MainClass{\n int fact(int x)\n {\n return x == 0 ? 1 : fact(x - 1) * x;\n }\n\n long pow(int x, int y)\n {\n return y == 0 ? 1 : pow(x, y - 1) * x;\n }\n void gen47s(List arr, int piv, long bias, int n)\n {\n if (piv == 0)\n {\n if (bias + 4 <= n)\n arr.Add((int)(bias + 4));\n if (bias + 7 <= n)\n arr.Add((int)(bias + 7));\n }\n else\n {\n gen47s(arr, piv - 1, bias + 4 * pow(10, piv), n);\n gen47s(arr, piv - 1, bias + 7 * pow(10, piv), n);\n }\n }\n int main(int n, int k)\n {\n int ans = 0;\n --k;\n if (n <= 12 && k >= fact(n))\n {\n ans = -1;\n return ans;\n }\n int cons = 12;\n for (cons = 12; cons > 0; --cons)\n if (k >= fact(cons))\n break;\n List rest = new List();\n for (int i = n - cons; i <= n; ++i)\n rest.Add(i);\n List arr47 = new List();\n for (int i = 0; i < (\"\" + n).Length; ++i)\n gen47s(arr47, i, 0, n);\n for (int i = arr47.Count - 1; i >= 0; --i)\n if (arr47[i] < n - cons)\n {\n ans = i + 1;\n break;\n }\n foreach (int i in rest.ToArray())\n {\n int q = k / fact(n - i);\n int current = rest[q];\n rest.Remove(current);\n if (arr47.Contains(i) && arr47.Contains(current))\n ans++;\n k -= q * fact(n - i);\n }\n return ans;\n }\n static void Main(){\n int n, k;\n string[] items = Console.ReadLine().Split(' ');\n n = int.Parse(items[0]);\n k = int.Parse(items[1]);\n MainClass mn = new MainClass();\n Console.Write(mn.main(n, k));\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "905c85846c6e81c5b2f23c3844c094a0", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "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 int getCount(int curNum, int maxNum)\n {\n int res = curNum == 0 ? 0 : 1;\n if (curNum * 10L + 4 <= maxNum)\n res += getCount(curNum * 10 + 4, maxNum);\n if (curNum * 10L + 7 <= maxNum)\n res += getCount(curNum * 10 + 7, maxNum);\n return res;\n }\n\n void swap(int[] arr, int a, int b)\n {\n int temp = arr[a];\n arr[a] = arr[b];\n arr[b] = temp;\n }\n\n void permute(int[] array, int k)\n {\n while (k > 1)\n {\n int curFact = 1;\n int prevFact = 1;\n int pos = 1;\n while (curFact < k)\n {\n pos++;\n prevFact = curFact;\n curFact *= pos;\n }\n int absPos0 = array.Length - pos;\n int shift = (k - 1) / prevFact;\n int absPos1 = absPos0 + shift;\n swap(array, absPos0, absPos1);\n if (pos > 1)\n {\n Array.Sort(array, absPos0 + 1, pos - 1);\n }\n \n k -= prevFact * shift;\n }\n }\n\n bool isLucky(int x)\n {\n while (x > 0)\n {\n if (x % 10 != 4 && x % 10 != 7)\n return false;\n x /= 10;\n }\n return true;\n }\n\n void Solve()\n {\n // Place your code here\n int n = io.NextInt();\n int k = io.NextInt();\n\n long fact = 1;\n int numCount = 1;\n for (int i = 2; i <= n && fact <= k; i++)\n {\n fact *= i;\n numCount++;\n }\n\n if (fact < k)\n {\n io.Print(-1);\n return;\n }\n\n int firstCnt = n - numCount;\n\n int ans = getCount(0, firstCnt);\n int[] lastNumbers = new int[numCount];\n for (int i = 0; i < numCount; i++)\n lastNumbers[i] = n - numCount + 1 + i;\n\n permute(lastNumbers, k);\n for (int i = 0; i < lastNumbers.Length; i++)\n if (isLucky(firstCnt + i + 1) && isLucky(lastNumbers[i]))\n {\n ans++;\n }\n\n io.Print(ans);\n }\n\n MyIo io = new MyIo();\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "830cff8e2be4f6fad1a1f4dc18194454", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cf\n{\n class Program\n {\n private int n;\n private int k;\n private int[] nums;\n private int startIndex;\n private int total;\n\n void searchLuckNumber(uint now)\n {\n if (now <= n)\n {\n if (isLuckNumber(getNum(now))) total++;\n\n searchLuckNumber(now * 10 + 4);\n searchLuckNumber(now * 10 + 7);\n }\n }\n\n uint getNum(uint index)\n {\n if (index < startIndex)\n {\n return index;\n }\n return (uint)nums[index - startIndex];\n }\n\n static Boolean isLuckNumber(uint num)\n {\n string str = string.Format(\"{0}\", num);\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] != '4' && str[i] != '7')\n {\n return false;\n }\n }\n return true;\n }\n\n void solve()\n {\n int[] f = new int[16];\n f[0] = 1;\n for (int i = 1; i <= 15; i++)\n {\n f[i] = f[i - 1] * i;\n }\n\n string nk = Console.ReadLine();\n string[] nks = nk.Split(' ');\n n = int.Parse(nks[0]);\n k = int.Parse(nks[1]);\n int orin = n;\n int orik = k;\n\n n = Math.Min(n, 15);\n startIndex = orin - n + 1;\n nums = new int[n];\n bool[] used = new bool[n + 1];\n int based = orin - n;\n\n if (k > f[n]) {\n Console.WriteLine(\"-1\");\n return;\n }\n for (int i = 0; i < n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n if (used[j]) continue;\n if (k > f[n - 1 - i])\n {\n k -= f[n - 1 - i];\n }\n else\n {\n used[j] = true;\n nums[i] = based + j;\n break;\n }\n }\n }\n\n k = orik;\n n = orin;\n\n searchLuckNumber(4);\n searchLuckNumber(7);\n\n Console.WriteLine(total);\n }\n\n static void Main(string[] args)\n {\n Program m = new Program();\n m.solve();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a3e5bc442489bb092dd19f75f9bd943d", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round91 {\n class C {\n static List num = new List();\n static void gen(long x, int n) {\n if (x <= n) {\n if(x != 0)\n num.Add((int)x);\n gen(x * 10 + 4, n);\n gen(x * 10 + 7, n);\n }\n }\n\n static long fact(long n) { long res = 1; while (n > 1) res *= n--; return res; }\n\n static int n;\n static List val = new List();\n static int dfs(int pos, long k) {\n if (pos > n) return 0;\n int rest = n - pos,\n res = 0;\n for (int i = 0; i < val.Count; i++) {\n if (val[i] == -1) continue;\n if (k < fact(rest)) {\n if (num.Contains(val[i]) && num.Contains(pos)) {\n res = 1;\n }\n //Console.WriteLine(\"dfs: {0} {1}\", pos, val[i]);\n val[i] = -1;\n return res + dfs(pos + 1, k);\n }\n k -= fact(rest);\n }\n throw new Exception();\n }\n\n static void Main() {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n n = xs[0];\n int k = xs[1]-1;\n\n for (int v = k, i = 1; i <= n && v != 0; i++) {\n v /= i;\n if (i == n && v != 0) {\n Console.WriteLine(-1);\n return;\n }\n }\n\n gen(0, n);\n num.Sort();\n for (long v = 1, i = 1; i <= n; i++) {\n v *= i;\n if (k < v) {\n int res = 0;\n int m = (int)(n - i);\n int id = -1;\n //Console.WriteLine(\"dfs: {0} {1}\", m, res);\n for (int j = 0; j < num.Count; j++) {\n if (num[j] > m) {\n res += j;\n id = j;\n break;\n }\n if (j == num.Count - 1) {\n Console.WriteLine(num.Count);\n return;\n }\n }\n //Console.WriteLine(\"dfs: {0} {1}\", m, res);\n for (int j = m; j < n; j++) {\n val.Add(j + 1);\n }\n Console.WriteLine(dfs(m+1, k) + res);\n return;\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "add1cc9a01f75aab72a510f46564a84c", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _LuckyPermutation\n{\n public class Puzzle\n {\n private static readonly List Lucky = GetLuckyNumbers(10);\n private static int _n;\n\n static List GetLuckyNumbers(int length)\n {\n var strNums = new List { \"4\", \"7\" };\n var prevCount = 0;\n while (strNums[strNums.Count - 1].Length < length)\n {\n var count = strNums.Count;\n for (var i = prevCount; i < count; i++)\n {\n strNums.Add(strNums[i] + \"4\");\n strNums.Add(strNums[i] + \"7\");\n }\n prevCount = count;\n }\n\n return strNums.Select(long.Parse).ToList();\n }\n\n private static readonly long[] Factorials =\n new[] { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800 };\n\n public static int[] FindPerm(int n, int k, out int nseq)\n {\n nseq = n; // number of non-sequential elements\n _n = n;\n if (k < 1 || (n < Factorials.Count() && k > Factorials[n]) || k > 1000000000) return null;\n var perm = new HashSet { 0 };\n\n if (n > 13)\n {\n nseq = 0;\n for (var i=1; i= Factorials[i + 1]) continue;\n if (k >= Factorials[i + 1]) continue;\n nseq = i + 1;\n break;\n }\n/*\n for (var i=1; i<=n-nseq; i++)\n {\n perm.Add(i);\n }\n*/\n\n }\n\n var pos = 1L;\n for (var i = nseq; i > 0; i--)\n {\n var f = (i > Factorials.Count()) ? Factorials[Factorials.Count() - 1] : Factorials[i - 1];\n for (var j = (n - nseq + 1); j <= n; j++)\n {\n if (perm.Contains(j)) continue;\n\n if (pos + f > k)\n {\n perm.Add(j);\n break;\n }\n pos += f;\n }\n }\n\n return perm.ToArray();\n }\n\n public static int CountLucky(int[] seq, int nseq)\n {\n if (seq == null) return -1;\n\n var count = 0;\n var seqCount = _n - nseq;\n //var seqCount = seq.Count() - nseq;\n\n var i = 0;\n while (Lucky[i++] <= seqCount) count++;\n\n for (var j = seqCount; j <= _n; j++)\n {\n if (Lucky.Contains(j) && Lucky.Contains(seq[j - seqCount]))\n {\n count++;\n }\n //Console.Write(\"{0},\", seq[j]);\n }\n //Console.WriteLine(count);\n //Console.WriteLine();\n\n return count;\n }\n }\n\n class ProgramLuckyPermutation\n {\n static void Main(/*string[] args*/)\n {\n var result = Console.ReadLine();\n if (result == null) return;\n var strnk = result.Split();\n var n = Convert.ToInt32(strnk[0]); // permutation of integers between 1 and n\n var k = Convert.ToInt32(strnk[1]); // lexicographical number of the permutation\n\n int nseq;\n var seq = Puzzle.FindPerm(n, k, out nseq);\n Console.WriteLine(Puzzle.CountLucky(seq, nseq));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "13ebd36520123a38669eceb61db66ccb", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "class MainClass{\n int fact(int x)\n {\n return x == 0 ? 1 : fact(x - 1) * x;\n }\n\n int pow(int x, int y)\n {\n return y == 0 ? 1 : pow(x, y - 1) * x;\n }\n void gen47s(List arr, int piv, int bias, int n)\n {\n if (piv == 0)\n {\n if (bias + 4 <= n)\n arr.Add(bias + 4);\n if (bias + 7 <= n)\n arr.Add(bias + 7);\n }\n else\n {\n gen47s(arr, piv - 1, bias + 4 * pow(10, piv), n);\n gen47s(arr, piv - 1, bias + 7 * pow(10, piv), n);\n }\n }\n\n int main(int n, int k)\n {\n Debug.Assert(n < 1e9 && k < 1e9);\n int ans = 0;\n --k;\n if (n <= 12 && k >= fact(n))\n {\n ans = -1;\n return ans;\n }\n int cons = 12;\n for (cons = 12; cons >= 0; --cons)\n if (k >= fact(cons))\n break;\n List rest = new List();\n for (int i = n - cons; i <= n; ++i)\n rest.Add(i);\n List arr47 = new List();\n for (int i = 0; i < (\"\" + n).Length; ++i)\n gen47s(arr47, i, 0, n);\n for (int i = arr47.Count - 1; i >= 0; --i)\n if (arr47[i] < n - cons)\n {\n ans = i + 1;\n break;\n }\n foreach (int i in rest.ToArray())\n {\n int q = k / fact(n - i);\n int current = rest[q];\n rest.Remove(current);\n if (arr47.Contains(i) && arr47.Contains(current))\n ans++;\n k -= q * fact(n - i);\n }\n return ans;\n }\nstatic void Main(){\nint n, k;\nstring[] items = Console.ReadLine().Split(\" \");\nn = int.Parse(items[0]);\nk = int.Parse(items[1]);\n\nConsole.Write(main(n, k));\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2ed50229d5eedff956d1b14ab585d067", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass MainClass{\n int fact(int x)\n {\n return x == 0 ? 1 : fact(x - 1) * x;\n }\n\n int pow(int x, int y)\n {\n return y == 0 ? 1 : pow(x, y - 1) * x;\n }\n void gen47s(List arr, int piv, int bias, int n)\n {\n if (piv == 0)\n {\n if (bias + 4 <= n)\n arr.Add(bias + 4);\n if (bias + 7 <= n)\n arr.Add(bias + 7);\n }\n else\n {\n gen47s(arr, piv - 1, bias + 4 * pow(10, piv), n);\n gen47s(arr, piv - 1, bias + 7 * pow(10, piv), n);\n }\n }\n\n int main(int n, int k)\n {\n int ans = 0;\n --k;\n if (n <= 12 && k >= fact(n))\n {\n ans = -1;\n return ans;\n }\n int cons = 12;\n for (cons = 12; cons >= 0; --cons)\n if (k >= fact(cons))\n break;\n List rest = new List();\n for (int i = n - cons; i <= n; ++i)\n rest.Add(i);\n List arr47 = new List();\n for (int i = 0; i < (\"\" + n).Length; ++i)\n gen47s(arr47, i, 0, n);\n for (int i = arr47.Count - 1; i >= 0; --i)\n if (arr47[i] < n - cons)\n {\n ans = i + 1;\n break;\n }\n foreach (int i in rest.ToArray())\n {\n int q = k / fact(n - i);\n int current = rest[q];\n rest.Remove(current);\n if (arr47.Contains(i) && arr47.Contains(current))\n ans++;\n k -= q * fact(n - i);\n }\n return ans;\n }\n static void Main(){\n int n, k;\n string[] items = Console.ReadLine().Split(' ');\n n = int.Parse(items[0]);\n k = int.Parse(items[1]);\n\n Console.Write(main(n, k));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "717d9ac01fdfeda891d9d531bb10b67e", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nclass MainClass{\n int fact(int x)\n {\n return x == 0 ? 1 : fact(x - 1) * x;\n }\n\n int pow(int x, int y)\n {\n return y == 0 ? 1 : pow(x, y - 1) * x;\n }\n void gen47s(List arr, int piv, int bias, int n)\n {\n if (piv == 0)\n {\n if (bias + 4 <= n)\n arr.Add(bias + 4);\n if (bias + 7 <= n)\n arr.Add(bias + 7);\n }\n else\n {\n gen47s(arr, piv - 1, bias + 4 * pow(10, piv), n);\n gen47s(arr, piv - 1, bias + 7 * pow(10, piv), n);\n }\n }\n\n int main(int n, int k)\n {\n int ans = 0;\n --k;\n if (n <= 12 && k >= fact(n))\n {\n ans = -1;\n return ans;\n }\n int cons = 12;\n for (cons = 12; cons >= 0; --cons)\n if (k >= fact(cons))\n break;\n List rest = new List();\n for (int i = n - cons; i <= n; ++i)\n rest.Add(i);\n List arr47 = new List();\n for (int i = 0; i < (\"\" + n).Length; ++i)\n gen47s(arr47, i, 0, n);\n for (int i = arr47.Count - 1; i >= 0; --i)\n if (arr47[i] < n - cons)\n {\n ans = i + 1;\n break;\n }\n foreach (int i in rest.ToArray())\n {\n int q = k / fact(n - i);\n int current = rest[q];\n rest.Remove(current);\n if (arr47.Contains(i) && arr47.Contains(current))\n ans++;\n k -= q * fact(n - i);\n }\n return ans;\n }\n static void Main(){\n int n, k;\n string[] items = Console.ReadLine().Split(\" \");\n n = int.Parse(items[0]);\n k = int.Parse(items[1]);\n\n Console.Write(main(n, k));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "42be846f567220432c389f8f10c1acb9", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _LuckyPermutation\n{\n public class Puzzle\n {\n private static readonly List Lucky = GetLuckyNumbers(7);\n\n static List GetLuckyNumbers(int length)\n {\n var strNums = new List { \"4\", \"7\" };\n var prevCount = 0;\n while (strNums[strNums.Count - 1].Length < length)\n {\n var count = strNums.Count;\n for (var i = prevCount; i < count; i++)\n {\n strNums.Add(strNums[i] + \"4\");\n strNums.Add(strNums[i] + \"7\");\n }\n prevCount = count;\n }\n\n return strNums.Select(int.Parse).ToList();\n }\n\n private static readonly long[] Factorials =\n new[] { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800 };\n\n public static int[] FindPerm(int n, int k, out int nseq)\n {\n nseq = n; // number of non-sequential elements\n if (k < 1 || (n < Factorials.Count() && k > Factorials[n]) || k > 1000000000) return null;\n var perm = new HashSet { 0 };\n\n if (n > 13)\n {\n nseq = 0;\n for (var i=1; i= Factorials[i + 1]) continue;\n nseq = i + 1;\n break;\n }\n for (var i=1; i<=n-nseq; i++)\n {\n perm.Add(i);\n }\n\n }\n\n var pos = 1L;\n for (var i = nseq; i > 0; i--)\n {\n var f = (i > Factorials.Count()) ? Factorials[Factorials.Count() - 1] : Factorials[i - 1];\n for (var j = (n - nseq + 1); j <= n; j++)\n {\n if (perm.Contains(j)) continue;\n\n if (pos + f > k)\n {\n perm.Add(j);\n break;\n }\n pos += f;\n }\n }\n\n return perm.ToArray();\n }\n\n public static int CountLucky(int[] seq, int nseq)\n {\n if (seq == null) return -1;\n\n var count = 0;\n var seqCount = seq.Count() - nseq;\n\n var i = 0;\n while (Lucky[i++] <= seqCount) count++;\n\n for (var j = seqCount + 1; j < seq.Count(); j++)\n {\n if (Lucky.Contains(j) && Lucky.Contains(seq[j]))\n {\n count++;\n }\n //Console.Write(\"{0},\", seq[j]);\n }\n //Console.WriteLine(count);\n //Console.WriteLine();\n\n return count;\n }\n }\n\n class ProgramLuckyPermutation\n {\n static void Main(/*string[] args*/)\n {\n var result = Console.ReadLine();\n if (result == null) return;\n var strnk = result.Split();\n var n = Convert.ToInt32(strnk[0]); // permutation of integers between 1 and n\n var k = Convert.ToInt32(strnk[1]); // lexicographical number of the permutation\n\n int nseq;\n var seq = Puzzle.FindPerm(n, k, out nseq);\n Console.WriteLine(Puzzle.CountLucky(seq, nseq));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dea8e85f2252027084dc931eeeab4950", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N;\n private int[,] A;\n\n private int[] X, Y;\n\n private int[][] Dx;\n private int[][] Dy;\n\n private Tuple[,,,] Dp;\n\n private bool[,,,] F;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n 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, j] = sc.NextInt() - 1;\n }\n }\n\n X = new int[N * N];\n Y = new int[N * N];\n for (int i = 0; i < N; i++)\n {\n for (int j = 0; j < N; j++)\n {\n X[A[i, j]] = i;\n Y[A[i, j]] = j;\n }\n }\n\n {\n Dx = new int[3][];\n Dy = new int[3][];\n\n Dx[0] = new int[] {-2, -2, -1, -1, 1, 1, 2, 2};\n Dy[0] = new int[] {-1, 1, -2, 2, -2, 2, -1, 1};\n\n Dx[1] = new int[36];\n Dy[1] = new int[36];\n\n Dx[2] = new int[36];\n Dy[2] = new int[36];\n for (int i = 0; i < 9; i++)\n {\n int ii = i + 1;\n Dx[1][i] = ii;\n Dy[1][i] = ii;\n\n Dx[1][i + 9] = ii;\n Dy[1][i + 9] = -ii;\n\n Dx[1][i + 18] = -ii;\n Dy[1][i + 18] = ii;\n\n Dx[1][i + 27] = -ii;\n Dy[1][i + 27] = -ii;\n\n Dx[2][i] = ii;\n Dx[2][i + 9] = -ii;\n\n Dy[2][i + 18] = ii;\n Dy[2][i + 27] = -ii;\n }\n }\n\n // \u73fe\u5728\u5730\u3001\u30bf\u30fc\u30b2\u30c3\u30c8\u3001\u99d2\n Dp = new Tuple[N, N, N * N, 3];\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 * N; k++)\n {\n for (int l = 0; l < 3; l++)\n {\n Dp[i, j, k, l] = new Tuple(int.MaxValue, -1);\n }\n }\n }\n }\n\n F = new bool[N, N, N * N, 3];\n\n int d = int.MaxValue;\n int c = -1;\n for (int i = 0; i < 3; i++)\n {\n var t = Go(X[0], Y[0], 1, i);\n if (t.d < d || (t.d == d && t.c < c))\n {\n d = t.d;\n c = t.c;\n }\n }\n\n Console.WriteLine($\"{d} {c}\");\n }\n\n (int d, int c) Go(int x, int y, int t, int k)\n {\n if (t == N * N) return (0, 0);\n if (F[x, y, t, k]) return (int.MaxValue, -1);\n if (Dp[x, y, t, k].Item1 != int.MaxValue) return (Dp[x, y, t, k].Item1, Dp[x, y, t, k].Item2);\n\n int d = int.MaxValue;\n int c = -1;\n F[x, y, t, k] = true;\n // \u79fb\u52d5\n for (int i = 0; i < Dx[k].Length; i++)\n {\n int nx = x + Dx[k][i];\n int ny = y + Dy[k][i];\n if (nx < 0 || nx >= N) continue;\n if (ny < 0 || ny >= N) continue;\n int nt = X[t] == nx && Y[t] == ny ? t + 1 : t;\n var tmp = Go(nx, ny, nt, k);\n if (tmp.d == int.MaxValue) continue;\n if (tmp.d + 1 < d || (tmp.d + 1 == d && tmp.c < c))\n {\n d = tmp.d + 1;\n c = tmp.c;\n }\n }\n\n // \u99d2\u4ea4\u63db\n for (int i = 0; i < 3; i++)\n {\n if (i == k) continue;\n var tmp = Go(x, y, t, i);\n if (tmp.d == int.MaxValue) continue;\n if (tmp.d + 1 < d || (tmp.d + 1 == d && tmp.c + 1 < c))\n {\n d = tmp.d + 1;\n c = tmp.c + 1;\n }\n }\n\n F[x, y, t, k] = false;\n Dp[x, y, t, k] = new Tuple(d, c);\n return (d, c);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6a9a3f2f63c694093439ac26b56d0b5d", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleTidbits\n{\n class JustCodeForces\n {\n int N;\n int[,] board;\n Dictionary> locations;\n\n public static void Main()\n {\n JustCodeForces obj = new JustCodeForces();\n\n //while (true)\n obj.ThreePieces_ContestAnalysis();\n }\n \n int M;\n Tuple[][] dist;\n Tuple[] pos;\n\n int[] X = new int[] { 2, 2, -2, -2, 1, 1, -1, -1 };\n int[] Y = new int[] { -1, 1, -1, 1, 2, -2, 2, -2 };\n private bool In(int x, int y)\n {\n if (x >= 0 && y >= 0 && x < N && y < N) return true;\n return false;\n }\n\n private int Get(int x, int y, int p)\n {\n return x * 3 * N + y * 3 + p;\n }\n private void ThreePieces_ContestAnalysis()\n {\n N = int.Parse(Console.ReadLine());\n\n pos = new Tuple[N * N];\n M = (N - 1) * N * 3 + N * 3 + 3;\n dist = new Tuple[M][];\n for (int i = 0; i < M; i++)\n dist[i] = new Tuple[M];\n\n for (int i = 0; i < N; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }), int.Parse);\n\n for (int j = 0; j < N; j++)\n {\n pos[--array[j]] = Tuple.Create(i, j);\n }\n }\n\n for (int i = 0; i < M; i++)\n {\n for (int j = 0; j < M; j++)\n {\n dist[i][j] = Tuple.Create(100000, 100000);\n if (i == j) dist[i][j] = Tuple.Create(0, 0);\n }\n }\n\n\n for (int i = 0; i < N; i++)\n {\n for (int j = 0; j < N; j++)\n {\n //Get Knights distance\n for (int k = 0; k < 8; k++)\n {\n int nx = i + X[k];\n int ny = j + Y[k];\n\n if (In(nx, ny))\n dist[Get(i, j, 0)][Get(nx, ny, 0)] = Tuple.Create(1, 0);\n\n }\n\n //Get Bishops distances\n for (int k = -N + 1; k <= N - 1; k++)\n {\n int nx = i + k;\n int ny = j + k;\n\n if (In(nx, ny))\n {\n dist[Get(i, j, 1)][Get(nx, ny, 1)] = Tuple.Create(1, 0);\n }\n\n ny = j - k;\n if (In(nx, ny))\n dist[Get(i, j, 1)][Get(nx, ny, 1)] = Tuple.Create(1, 0);\n }\n\n //Get Rook distance\n for (int k = 0; k < N; k++)\n {\n int nx = i;\n int ny = k;\n dist[Get(i, j, 2)][Get(nx, ny, 2)] = Tuple.Create(1, 0);\n\n nx = k;\n ny = j;\n\n dist[Get(i, j, 2)][Get(nx, ny, 2)] = Tuple.Create(1, 0);\n }\n\n //Replace at the exact location\n for (int k = 0; k < 3; k++)\n {\n for (int m = 0; m < 3; m++)\n {\n if (k != m)\n dist[Get(i, j, k)][Get(i, j, m)] = Tuple.Create(1, 1);\n }\n }\n }\n }\n\n for (int i = 0; i < M; i++)\n {\n for (int j = 0; j < M; j++)\n {\n for (int k = 0; k < M; k++)\n {\n if (dist[i][j].Item1 > dist[i][k].Item1 + dist[k][j].Item1)\n {\n dist[i][j] = Tuple.Create(dist[i][k].Item1 + dist[k][j].Item1,\n dist[i][k].Item2 + dist[k][j].Item2);\n }\n else if (dist[i][j].Item1 == dist[i][k].Item1 + dist[k][j].Item1\n && dist[i][j].Item2 > dist[i][k].Item2 + dist[k][j].Item2)\n {\n dist[i][j] = Tuple.Create(dist[i][j].Item1, dist[i][k].Item2 + dist[k][j].Item2);\n }\n }\n }\n }\n\n var dp = new Tuple[N * N][];\n for (int i = 0; i < N * N; i++)\n {\n dp[i] = new Tuple[3];\n\n for (int k = 0; k < 3; k++)\n {\n dp[i][k] = Tuple.Create(100000, 100000);\n }\n }\n dp[0][0] = Tuple.Create(0, 0);\n dp[0][1] = Tuple.Create(0, 0);\n dp[0][2] = Tuple.Create(0, 0);\n\n for (int i = 0; i < N * N - 1; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n for (int k = 0; k < 3; k++)\n {\n var new_min = dp[i][j].Item1 + dist[Get(pos[i].Item1, pos[i].Item2, j)][Get(pos[i + 1].Item1, pos[i + 1].Item2, k)].Item1;\n if (dp[i + 1][k].Item1 > new_min)\n {\n dp[i + 1][k] = Tuple.Create(new_min, dp[i][j].Item2 + dist[Get(pos[i].Item1, pos[i].Item2, j)][Get(pos[i + 1].Item1, pos[i + 1].Item2, k)].Item2);\n }\n else if (dp[i + 1][k].Item1 == new_min\n && dp[i + 1][k].Item2 > dp[i][j].Item2 + dist[Get(pos[i].Item1, pos[i].Item2, j)][Get(pos[i + 1].Item1, pos[i + 1].Item2, k)].Item2)\n {\n dp[i + 1][k] = Tuple.Create(new_min, dp[i][j].Item2 + dist[Get(pos[i].Item1, pos[i].Item2, j)][Get(pos[i + 1].Item1, pos[i + 1].Item2, k)].Item2);\n }\n }\n }\n }\n\n var res = dp[N * N - 1][0];\n if (res.Item1 > dp[N * N - 1][1].Item1\n || (res.Item1 == dp[N * N - 1][1].Item1 && res.Item2 > dp[N * N - 1][1].Item2))\n {\n res = dp[N * N - 1][1];\n }\n if (res.Item1 > dp[N * N - 1][2].Item1\n || (res.Item1 == dp[N * N - 1][2].Item1 && res.Item2 > dp[N * N - 1][2].Item2))\n {\n res = dp[N * N - 1][2];\n }\n\n Console.WriteLine(\"\" + res.Item1 + \" \" + res.Item2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0dd3df25463dc47590b6e81eebf74f68", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nnamespace ConsoleTidbits\n{\n class MinHeap where T : IComparable\n {\n public IList m_array;\n\n public MinHeap()\n {\n m_array = new List();\n }\n public T GetRoot()\n {\n return m_array[0];\n }\n\n public T 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 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].CompareTo(m_array[left]) > 0)\n {\n index = left;\n }\n\n if (right < Count && m_array[index].CompareTo(m_array[right]) > 0)\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].CompareTo(m_array[index]) > 0)\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(T 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].CompareTo(array[index]) < 0)\n {\n index = left;\n }\n\n if (right < N && array[right].CompareTo(array[index]) < 0)\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 JustCodeForces\n {\n int N;\n int[,] board;\n Dictionary> locations;\n\n public static void Main()\n {\n JustCodeForces obj = new JustCodeForces();\n\n //while (true)\n obj.ThreePieces();\n }\n\n enum Pawn\n {\n Bishop = 0,\n Knight,\n Rook\n }\n class Move : IComparable\n {\n public int Moves { get; set; }\n public int Rep { get; set; }\n\n public int Num { get; set; }\n public Pawn pawn { get; set; }\n public int CompareTo(object o)\n {\n var other = o as Move;\n if (Moves < other.Moves) return -1;\n if (Moves > other.Moves) return 1;\n\n if (Moves == other.Moves) return Rep.CompareTo(other.Rep);\n\n return -1;\n }\n }\n private void ThreePieces()\n {\n N = int.Parse(Console.ReadLine());\n\n board = new int[N, N];\n locations = new Dictionary>();\n\n for (int i = 0; i < N; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }), int.Parse);\n\n for (int j = 0; j < N; j++)\n {\n board[i, j] = array[j];\n locations.Add(array[j], Tuple.Create(i + 1, j + 1));\n }\n }\n\n //Min of all\n #region rook Distances\n //Find rook distances\n var rook_distances = new Tuple[(N * N) + 1];\n rook_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n if (current_location.Item1 == new_location.Item1 ||\n current_location.Item2 == new_location.Item2)\n rook_distances[i] = Tuple.Create(1, 0);\n else\n rook_distances[i] = Tuple.Create(2, 0);\n }\n #endregion\n\n #region Bishop Distances\n //Find Bishop Distances\n var bishop_distances = new Tuple[(N * N) + 1];\n bishop_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n if ((current_location.Item1 + current_location.Item2) % 2 != (new_location.Item1 + new_location.Item2) % 2)\n bishop_distances[i] = Tuple.Create(int.MaxValue, 0);\n else\n {\n bool found = false;\n //Move North East\n for (int k = 1; k <= Math.Min(current_location.Item1 - 1, N - current_location.Item2); k++)\n {\n if (new_location.Item1 == current_location.Item1 - k && new_location.Item2 == current_location.Item2 + k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n\n //Move South west\n if (!found)\n {\n for (int k = 1; k <= Math.Min(N - current_location.Item1, current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 + k && new_location.Item2 == current_location.Item2 - k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n //Move South east\n if (!found)\n {\n for (int k = 1; k <= Math.Min(N - current_location.Item1, N - current_location.Item2); k++)\n {\n if (new_location.Item1 == current_location.Item1 + k && new_location.Item2 == current_location.Item2 + k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n //Move North West\n if (!found)\n {\n for (int k = 1; k <= Math.Min(current_location.Item1 - 1, current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 - k && new_location.Item2 == current_location.Item2 - k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n if (!found)\n {\n bishop_distances[i] = Tuple.Create(2, 0);\n }\n }\n }\n #endregion\n\n #region Knight Distances\n //Find Knight Distances\n var X = new int[] { 2, 2, -2, -2, 1, 1, -1, -1 };\n var Y = new int[] { -1, 1, -1, 1, 2, -2, 2, -2 };\n\n var Knight_distances = new Tuple[(N * N) + 1];\n Knight_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n var visited = new bool[N + 1, N + 1];\n var queue = new Queue>();\n visited[current_location.Item1, current_location.Item2] = true;\n queue.Enqueue(Tuple.Create(current_location.Item1, current_location.Item2));\n int count = queue.Count;\n int level = 0;\n bool found = false;\n\n while (queue.Count > 0)\n {\n level++;\n count = queue.Count;\n\n while (count > 0)\n {\n count--;\n var item = queue.Dequeue();\n\n for (int t = 0; t < 8; t++)\n {\n var new_X = item.Item1 + X[t];\n var new_Y = item.Item2 + Y[t];\n\n if (new_X == new_location.Item1 && new_Y == new_location.Item2)\n {\n Knight_distances[i] = Tuple.Create(level, 0);\n found = true;\n break;\n }\n\n if (new_X >= 1 && new_X <= N && new_Y >= 1 && new_Y <= N && !visited[new_X, new_Y])\n {\n queue.Enqueue(Tuple.Create(new_X, new_Y));\n visited[new_X, new_Y] = true;\n }\n }\n }\n\n if (found) break;\n }\n\n if (!found) Knight_distances[i] = Tuple.Create(int.MaxValue, 0);\n\n }\n #endregion\n\n var minheap = new MinHeap();\n\n var states = new Move[3][];\n states[0] = new Move[(N * N) + 1];\n states[1] = new Move[(N * N) + 1];\n states[2] = new Move[(N * N) + 1];\n\n for (int j = 1; j <= N * N; j++)\n states[0][j] = new Move() { pawn = Pawn.Bishop, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n for (int j = 1; j <= N * N; j++)\n states[1][j] = new Move() { pawn = Pawn.Knight, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n for (int j = 1; j <= N * N; j++)\n states[2][j] = new Move() { pawn = Pawn.Rook, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n\n states[0][1] = new Move() { pawn = Pawn.Bishop, Num = 1, Moves = 0, Rep = 0 };\n states[1][1] = new Move() { pawn = Pawn.Knight, Num = 1, Moves = 0, Rep = 0 };\n states[2][1] = new Move() { pawn = Pawn.Rook, Num = 1, Moves = 0, Rep = 0 };\n\n minheap.Add(states[0][1]);\n minheap.Add(states[1][1]);\n minheap.Add(states[2][1]);\n\n while (minheap.Count > 0)\n {\n var item = minheap.ExtractMin();\n\n Pawn p = item.pawn;\n int currentnum = item.Num;\n int intPaws = (int)p;\n //Console.WriteLine(\" -> \" + item.Moves);\n // Console.WriteLine(\"*******************\");\n // Console.WriteLine(\"\" + p + \" currentnum \" + currentnum);\n\n if (currentnum == N * N) break;\n\n if (p == Pawn.Bishop)\n {\n //Get Bishop distance\n var dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[0][currentnum + 1].Moves && item.Rep < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Bishop,\n Rep = item.Rep\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n\n //Get Knight distance\n dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[1][currentnum + 1].Moves && item.Rep + 1 < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Knight,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n\n //Get Rook distance\n dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Rook,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n }\n else if (p == Pawn.Knight)\n {\n var dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[1][currentnum + 1].Moves && item.Rep < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Knight,\n Rep = item.Rep\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n\n dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Rook,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n\n dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[0][currentnum + 1].Moves && item.Rep + 1 < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Bishop,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n }\n else if (p == Pawn.Rook)\n {\n var dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[2][currentnum + 1].Moves && item.Rep < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Rook,\n Rep = item.Rep\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n\n dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[0][currentnum + 1].Moves && item.Rep + 1 < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Bishop,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n\n dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[1][currentnum + 1].Moves && item.Rep + 1 < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Knight,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n }\n }\n\n int res = int.MaxValue;\n\n res = Math.Min(states[1][N * N].Moves, res);\n res = Math.Min(states[2][N * N].Moves, res);\n res = Math.Min(states[0][N * N].Moves, res);\n\n int moves = int.MaxValue;\n\n if (res == states[0][N * N].Moves)\n moves = Math.Min(states[0][N * N].Rep, moves);\n\n if (res == states[1][N * N].Moves)\n moves = Math.Min(states[1][N * N].Rep, moves);\n if (res == states[2][N * N].Moves)\n moves = Math.Min(states[2][N * N].Rep, moves);\n\n Console.WriteLine(\"\" + res + \" \" + moves);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "22ef8666b3e8737ea3fba2d4359ba792", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\n class MinHeap where T : IComparable\n {\n public IList m_array;\n\n public MinHeap()\n {\n m_array = new List();\n }\n public T GetRoot()\n {\n return m_array[0];\n }\n\n public T 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 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].CompareTo(m_array[left]) > 0)\n {\n index = left;\n }\n\n if (right < Count && m_array[index].CompareTo(m_array[right]) > 0)\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].CompareTo(m_array[index]) > 0)\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(T 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\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].CompareTo(array[index]) < 0)\n {\n index = left;\n }\n\n if (right < N && array[right].CompareTo(array[index]) < 0)\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\nclass testcodeforces\n{\n int N;\n int[,] board;\n Dictionary> locations;\n\n public static void Main()\n {\n testcodeforces obj = new testcodeforces();\n obj.ThreePieces();\n }\n\n enum Pawn\n {\n Bishop = 0,\n Knight,\n Rook\n }\n class Move : IComparable\n {\n public int Moves { get; set; }\n public int Rep { get; set; }\n\n public int Num { get; set; }\n public Pawn pawn { get; set; }\n public int CompareTo(Move other)\n {\n if (Moves < other.Moves) return -1;\n if (Moves > other.Moves) return 1;\n\n if (Moves == other.Moves) return Rep.CompareTo(other.Rep);\n\n return 0;\n }\n }\n private void ThreePieces()\n {\n N = int.Parse(Console.ReadLine());\n\n board = new int[N, N];\n locations = new Dictionary>();\n\n for (int i = 0; i < N; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }), int.Parse);\n\n for (int j = 0; j < N; j++)\n {\n board[i, j] = array[j];\n locations.Add(array[j], Tuple.Create(i + 1, j + 1));\n }\n }\n\n //Min of all\n #region rook Distances\n //Find rook distances\n var rook_distances = new Tuple[(N * N) + 1];\n rook_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n if (current_location.Item1 == new_location.Item1 ||\n current_location.Item2 == new_location.Item2)\n rook_distances[i] = Tuple.Create(1, 0);\n else\n rook_distances[i] = Tuple.Create(2, 0);\n }\n #endregion\n\n #region Bishop Distances\n //Find Bishop Distances\n var bishop_distances = new Tuple[(N * N) + 1];\n bishop_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n if ((current_location.Item1 + current_location.Item2) % 2 != (new_location.Item1 + new_location.Item2) % 2)\n bishop_distances[i] = Tuple.Create(int.MaxValue, 0);\n else\n {\n bool found = false;\n //Move North East\n for (int k = 1; k <= Math.Min(current_location.Item1 - 1, N - current_location.Item2); k++)\n {\n if (new_location.Item1 == current_location.Item1 - k && new_location.Item2 == current_location.Item2 + k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n\n //Move South west\n if (!found)\n {\n for (int k = 1; k <= Math.Min(N - current_location.Item1, current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 + k && new_location.Item2 == current_location.Item2 - k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n //Move South east\n if (!found)\n {\n for (int k = 1; k <= Math.Min(N - current_location.Item1, N - current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 + k && new_location.Item2 == current_location.Item2 + k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n //Move North West\n if (!found)\n {\n for (int k = 1; k <= Math.Min(current_location.Item1 - 1, current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 - k && new_location.Item2 == current_location.Item2 - k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n if (!found)\n {\n bishop_distances[i] = Tuple.Create(2, 0);\n }\n }\n }\n #endregion\n\n #region Knight Distances\n //Find Knight Distances\n var X = new int[] { 2, 2, -2, -2, 1, 1, -1, -1 };\n var Y = new int[] { -1, 1, -1, 1, 2, -2, 2, -2 };\n\n var Knight_distances = new Tuple[(N * N) + 1];\n Knight_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n var list = new List>();\n\n bool found = false;\n\n for (int t = 0; t < 8; t++)\n {\n var new_X = current_location.Item1 + X[t];\n var new_Y = current_location.Item2 + Y[t];\n if (new_X == new_location.Item1 && new_Y == new_location.Item2)\n {\n Knight_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n else\n {\n if (new_X >= 1 && new_X <= N && new_Y >= 1 && new_Y <= N)\n list.Add(Tuple.Create(new_X, new_Y));\n }\n }\n\n if (!found)\n {\n for (int l = 0; l < list.Count; l++)\n {\n for (int t = 0; t < 8; t++)\n {\n var new_X = list[l].Item1 + X[t];\n var new_Y = list[l].Item2 + Y[t];\n if (new_X == new_location.Item1 && new_Y == new_location.Item2)\n {\n Knight_distances[i] = Tuple.Create(2, 0);\n found = true;\n break;\n }\n }\n }\n }\n\n if (!found) Knight_distances[i] = Tuple.Create(int.MaxValue, 0);\n\n }\n #endregion\n\n var minheap = new MinHeap();\n\n var states = new Move[3][];\n states[0] = new Move[(N * N) + 1];\n states[1] = new Move[(N * N) + 1];\n states[2] = new Move[(N * N) + 1];\n\n for (int j = 1; j <= N * N; j++)\n states[0][j] = new Move() { pawn = Pawn.Bishop, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n for (int j = 1; j <= N * N; j++)\n states[1][j] = new Move() { pawn = Pawn.Knight, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n for (int j = 1; j <= N * N; j++)\n states[2][j] = new Move() { pawn = Pawn.Rook, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n\n states[0][1] = new Move() { pawn = Pawn.Bishop, Num = 1, Moves = 0, Rep = 0 };\n states[1][1] = new Move() { pawn = Pawn.Knight, Num = 1, Moves = 0, Rep = 0 };\n states[2][1] = new Move() { pawn = Pawn.Rook, Num = 1, Moves = 0, Rep = 0 };\n\n minheap.Add(states[0][1]);\n minheap.Add(states[1][1]);\n minheap.Add(states[2][1]);\n\n while (minheap.Count > 0)\n {\n var item = minheap.ExtractMin();\n\n Pawn p = item.pawn;\n int currentnum = item.Num;\n int intPaws = (int)p;\n\n Console.WriteLine(\"*******************\");\n Console.WriteLine(\"\" + p + \" currentnum \" + currentnum);\n\n if (currentnum == N * N) break;\n\n if (p == Pawn.Bishop)\n {\n //Get Bishop distance\n var dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[0][currentnum + 1].Moves && item.Rep < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Bishop,\n Rep = item.Rep\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n\n //Get Knight distance\n dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[1][currentnum + 1].Moves && item.Rep + 1 < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Knight,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n\n //Get Rook distance\n dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Rook,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n }\n else if (p == Pawn.Knight)\n {\n var dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[1][currentnum + 1].Moves && item.Rep < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Knight,\n Rep = item.Rep\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n\n dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Rook,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n\n dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[0][currentnum + 1].Moves && item.Rep + 1 < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Bishop,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n }\n else if (p == Pawn.Rook)\n {\n var dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[2][currentnum + 1].Moves && item.Rep < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Rook,\n Rep = item.Rep\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n\n dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[0][currentnum + 1].Moves && item.Rep + 1 < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Bishop,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n\n dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Knight,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n }\n }\n\n int res = int.MaxValue;\n\n res = Math.Min(states[1][N * N].Moves, res);\n res = Math.Min(states[2][N * N].Moves, res);\n res = Math.Min(states[0][N * N].Moves, res);\n\n int moves = int.MaxValue;\n\n if (res == states[0][N * N].Moves)\n moves = Math.Min(states[0][N * N].Rep, moves);\n\n if (res == states[1][N * N].Moves)\n moves = Math.Min(states[1][N * N].Rep, moves);\n if (res == states[2][N * N].Moves)\n moves = Math.Min(states[2][N * N].Rep, moves);\n\n Console.WriteLine(\"\" + res + \" \" + moves);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "91703222dc02256a566fb8be81393d82", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleTidbits\n{\n class JustCodeForces\n {\n int N;\n int[,] board;\n Dictionary> locations;\n\n public static void Main()\n {\n JustCodeForces obj = new JustCodeForces();\n\n //while (true)\n obj.ThreePieces_ContestAnalysis();\n }\n \n int M;\n Tuple[][] dist;\n Tuple[] pos;\n\n int[] X = new int[] { 2, 2, -2, -2, 1, 1, -1, -1 };\n int[] Y = new int[] { -1, 1, -1, 1, 2, -2, 2, -2 };\n private bool In(int x, int y)\n {\n if (x >= 0 && y >= 0 && x < N && y < N) return true;\n return false;\n }\n\n private int Get(int x, int y, int p)\n {\n return x * 3 * N + y * 3 + p;\n }\n private void ThreePieces_ContestAnalysis()\n {\n N = int.Parse(Console.ReadLine());\n\n pos = new Tuple[N * N];\n M = (N - 1) * N * 3 + N * 3 + 3;\n dist = new Tuple[M][];\n for (int i = 0; i < M; i++)\n dist[i] = new Tuple[M];\n\n for (int i = 0; i < N; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }), int.Parse);\n\n for (int j = 0; j < N; j++)\n {\n pos[--array[j]] = Tuple.Create(i, j);\n }\n }\n\n for (int i = 0; i < M; i++)\n {\n for (int j = 0; j < M; j++)\n {\n dist[i][j] = Tuple.Create(100000, 100000);\n if (i == j) dist[i][j] = Tuple.Create(0, 0);\n }\n }\n\n\n for (int i = 0; i < N; i++)\n {\n for (int j = 0; j < N; j++)\n {\n //Get Knights distance\n for (int k = 0; k < 8; k++)\n {\n int nx = i + X[k];\n int ny = j + Y[k];\n\n if (In(nx, ny))\n dist[Get(i, j, 0)][Get(nx, ny, 0)] = Tuple.Create(1, 0);\n\n }\n\n //Get Bishops distances\n for (int k = -N + 1; k <= N - 1; k++)\n {\n int nx = i + k;\n int ny = j + k;\n\n if (In(nx, ny))\n {\n dist[Get(i, j, 1)][Get(nx, ny, 1)] = Tuple.Create(1, 0);\n }\n\n ny = j - k;\n if (In(nx, ny))\n dist[Get(i, j, 1)][Get(nx, ny, 1)] = Tuple.Create(1, 0);\n }\n\n //Get Rook distance\n for (int k = 0; k < N; k++)\n {\n int nx = i;\n int ny = k;\n dist[Get(i, j, 2)][Get(nx, ny, 2)] = Tuple.Create(1, 0);\n\n nx = k;\n ny = j;\n\n dist[Get(i, j, 2)][Get(nx, ny, 2)] = Tuple.Create(1, 0);\n }\n\n //Replace at the exact location\n for (int k = 0; k < 3; k++)\n {\n for (int m = 0; m < 3; m++)\n {\n if (k != m)\n dist[Get(i, j, k)][Get(i, j, m)] = Tuple.Create(1, 1);\n }\n }\n }\n }\n\n for (int i = 0; i < M; i++)\n {\n for (int j = 0; j < M; j++)\n {\n for (int k = 0; k < M; k++)\n {\n if (dist[i][j].Item1 > dist[i][k].Item1 + dist[k][j].Item1)\n {\n dist[i][j] = Tuple.Create(dist[i][k].Item1 + dist[k][j].Item1,\n dist[i][k].Item2 + dist[k][j].Item2);\n }\n else if (dist[i][j].Item1 == dist[i][k].Item1 + dist[k][j].Item1\n && dist[i][j].Item2 > dist[i][k].Item2 + dist[k][j].Item2)\n {\n dist[i][j] = Tuple.Create(dist[i][j].Item1, dist[i][k].Item2 + dist[k][j].Item2);\n }\n }\n }\n }\n\n var dp = new Tuple[N * N][];\n for (int i = 0; i < N * N; i++)\n {\n dp[i] = new Tuple[3];\n\n for (int k = 0; k < 3; k++)\n {\n dp[i][k] = Tuple.Create(int.MaxValue, int.MaxValue);\n }\n }\n dp[0][0] = Tuple.Create(0, 0);\n dp[0][1] = Tuple.Create(0, 0);\n dp[0][2] = Tuple.Create(0, 0);\n\n for (int i = 0; i < N * N - 1; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n for (int k = 0; k < 3; k++)\n {\n var new_min = dp[i][j].Item1 + dist[Get(pos[i].Item1, pos[i].Item2, j)][Get(pos[i + 1].Item1, pos[i + 1].Item2, k)].Item1;\n if (dp[i + 1][k].Item1 > new_min)\n {\n dp[i + 1][k] = Tuple.Create(new_min, dp[i][j].Item2 + dist[Get(pos[i].Item1, pos[i].Item2, j)][Get(pos[i + 1].Item1, pos[i + 1].Item2, k)].Item2);\n }\n else if (dp[i + 1][k].Item1 == new_min\n && dp[i + 1][k].Item2 > dp[i][j].Item2 + dist[Get(pos[i].Item1, pos[i].Item2, j)][Get(pos[i + 1].Item1, pos[i + 1].Item2, k)].Item2)\n {\n dp[i + 1][k] = Tuple.Create(new_min, dp[i][j].Item2 + dist[Get(pos[i].Item1, pos[i].Item2, j)][Get(pos[i + 1].Item1, pos[i + 1].Item2, k)].Item2);\n }\n }\n }\n }\n\n var res = dp[N * N - 1][0];\n if (res.Item1 > dp[N * N - 1][1].Item1\n || (res.Item1 == dp[N * N - 1][1].Item1 && res.Item2 > dp[N * N - 1][1].Item2))\n {\n res = dp[N * N - 1][1];\n }\n if (res.Item1 > dp[N * N - 1][2].Item1\n || (res.Item1 == dp[N * N - 1][2].Item1 && res.Item2 > dp[N * N - 1][2].Item2))\n {\n res = dp[N * N - 1][2];\n }\n\n Console.WriteLine(\"\" + res.Item1 + \" \" + res.Item2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f81f114aec68f1e565c5d6c571c8d929", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "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 N = sc.Int;\n var A = new int[N][];\n var R = new int[N * N+1];R[N * N] = -1;\n for (int i = 0; i < N; i++)\n {\n A[i] = sc.ArrInt;\n for (int j = 0; j < N; j++)\n {\n A[i][j]--;\n R[A[i][j]] = Id(i, j);\n }\n }\n //dist:=i\u306b\u3044\u3066\uff0cj\u307e\u3067\u30af\u30ea\u30a2\u3057\u3066\u3044\u3066\uff0c\u99d2\u304c0:knight,1:bishop,2:rook\u306e\u3068\u304d\n var dist = Create(N * N, () => Create(N * N, () => Create(3, () => long.MaxValue / 2)));\n var pq = new PriorityQueue<(long c, int now, int cl, int pi)>((a, b) => a.c.CompareTo(b.c));\n dist[R[0]][0][0] = dist[R[0]][0][1] = dist[R[0]][0][2] = 0;\n pq.Push((0, R[0], 0, 0));\n pq.Push((0, R[0], 0, 1));\n pq.Push((0, R[0], 0, 2));\n while (pq.Any())\n {\n var (cst, now, cl, pi) = pq.Pop();\n int h = now / N, w = now % N;\n if (pi == 0)\n {\n for(int k = 0; k < knH.Length; k++)\n {\n int nh = h + knH[k], nw = w + knW[k];\n if (!Inside(nh, nw, N, N)) continue;\n var p = cl;\n if (Id(nh, nw) == R[cl + 1]) p++;\n if (chmin(ref dist[Id(nh, nw)][p][pi], cst + W))\n {\n pq.Push((cst + W, Id(nh, nw), p, pi));\n }\n }\n }\n else if (pi == 1)\n {\n for(int i = -N + 1; i <= N - 1; i++)\n {\n {\n int nh = i + h, nw = i + w;\n if (!Inside(nh, nw, N, N)) goto SEC;\n var p = cl;\n if (Id(nh, nw) == R[cl + 1]) p++;\n if (chmin(ref dist[Id(nh, nw)][p][pi], cst + W))\n {\n pq.Push((cst + W, Id(nh, nw), p, pi));\n }\n }\n SEC:;\n {\n int nh = i + h, nw = -i + w;\n if (!Inside(nh, nw, N, N)) continue;\n var p = cl;\n if (Id(nh, nw) == R[cl + 1]) p++;\n if (chmin(ref dist[Id(nh, nw)][p][pi], cst + W))\n {\n pq.Push((cst + W, Id(nh, nw), p, pi));\n }\n }\n }\n }\n else\n {\n for(int i = -N + 1; i <= N - 1; i++)\n {\n\n {\n int nh = h, nw = i + w;\n if (!Inside(nh, nw, N, N)) goto SEC;\n var p = cl;\n if (Id(nh, nw) == R[cl + 1]) p++;\n if (chmin(ref dist[Id(nh, nw)][p][pi], cst + W))\n {\n pq.Push((cst + W, Id(nh, nw), p, pi));\n }\n }\n SEC:;\n {\n int nh = i + h, nw = w;\n if (!Inside(nh, nw, N, N)) continue;\n var p = cl;\n if (Id(nh, nw) == R[cl + 1]) p++;\n if (chmin(ref dist[Id(nh, nw)][p][pi], cst + W))\n {\n pq.Push((cst + W, Id(nh, nw), p, pi));\n }\n }\n }\n }\n for(int k = 0; k < 3; k++)\n {\n if(chmin(ref dist[now][cl][k],cst+1))\n {\n pq.Push((cst + 1, now, cl, k));\n }\n }\n }\n var res = dist[R[N * N - 1]][N * N - 1].Min();\n Console.WriteLine($\"{res / W} {res % W}\");\n }\n int N;\n const long W = (long)1e9;\n public int Id(int h, int w) => h * N + w;\n int[] knH = new[] { -2, -2, -1, -1, 1, 1, 2, 2 }, knW = new[] { 1, -1, 2, -2, 2, -2, 1, -1 };\n public static bool Inside(int h, int w, int H, int W)\n => 0 <= h && h < H && 0 <= w && w < W;\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "164ac172cc0ddd678af3a047ef1723ba", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N;\n private int[][] A;\n\n private int[] X, Y;\n\n private readonly int[] kDx = new int[] {-2, -2, -1, -1, 1, 1, 2, 2};\n private readonly int[] kDy = new int[] {-1, 1, -2, 2, -2, 2, -1, 1};\n\n private const int C = 200;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n A = new int[N][];\n for (int i = 0; i < N; i++)\n {\n A[i] = sc.IntArray();\n }\n\n X = new int[N * N];\n Y = new int[N * N];\n for (int i = 0; i < N; i++)\n {\n for (int j = 0; j < N; j++)\n {\n X[A[i][j] - 1] = i;\n Y[A[i][j] - 1] = j;\n }\n }\n\n var kDist = new long[N, 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 for (int l = 0; l < N; l++)\n {\n kDist[i, j, k, l] = int.MaxValue;\n }\n }\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 < kDx.Length; k++)\n {\n int ii = i + kDx[k];\n int jj = j + kDy[k];\n if (ii < 0 || ii >= N) continue;\n if (jj < 0 || jj >= N) continue;\n kDist[i, j, ii, jj] = 1;\n }\n }\n }\n\n for (int ki = 0; ki < N; ki++)\n {\n for (int kj = 0; kj < N; kj++)\n {\n for (int ii = 0; ii < N; ii++)\n {\n for (int ij = 0; ij < N; ij++)\n {\n for (int ji = 0; ji < N; ji++)\n {\n for (int jj = 0; jj < N; jj++)\n {\n kDist[ii, ij, ji, jj] = Math.Min(kDist[ii, ij, ji, jj],\n kDist[ii, ij, ki, kj] + kDist[ki, kj, ji, jj]);\n }\n }\n }\n }\n }\n }\n\n /*\n * N*N\u30de\u30b9\n *\n * \u30ca\u30a4\u30c8\u3001\u30d3\u30b7\u30e7\u30c3\u30d7\u3001\u30eb\u30fc\u30af\u306e\u3069\u308c\u304b\u30921\u306e\u30de\u30b9\u306b\u7f6e\u304f\n *\n * 2\u306b\u5411\u304b\u3046\u30013... N^2\n *\n * \u99d2\u3092\u5909\u3048\u308b\u304b\u79fb\u52d5\u3059\u308b\u304b\n *\n * \u79fb\u52d5\u56de\u6570\u6700\u5c0f\u306e\u30d1\u30b9\n * \u305d\u306e\u3046\u3061\u5165\u308c\u66ff\u3048\u6700\u5c0f\u30d1\u30b9\n * \n */\n\n // i\u306b\u884c\u304f\u3001\u4ea4\u63dbj\u56de\u79fb\u52d5\u56de\u6570\u6700\u5c0f\n var dp = new long[N * N, 3, C];\n for (int i = 0; i < N * N; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n for (int k = 0; k < C; k++)\n {\n dp[i, j, k] = int.MaxValue;\n }\n }\n }\n\n dp[0, 0, 0] = 0;\n dp[0, 1, 0] = 0;\n dp[0, 2, 0] = 0;\n for (int i = 0; i < N * N - 1; i++)\n {\n int nx = X[i + 1];\n int ny = Y[i + 1];\n\n int x = X[i];\n int y = Y[i];\n {\n // \u30ca\u30a4\u30c8\n for (int j = 0; j < C; j++)\n {\n if (dp[i, 0, j] == int.MaxValue) continue;\n {\n // \u30ca\u30a4\u30c8\u306e\u307e\u307e\u6b21\u306b\u884c\u304f\n long kd = kDist[x, y, nx, ny];\n if (kd == int.MaxValue) continue;\n dp[i + 1, 0, j] = Math.Min(dp[i + 1, 0, j], dp[i, 0, j] + kd);\n }\n if (j + 1 < C)\n {\n {\n // \u30d3\u30b7\u30e7\u30c3\u30d7\u306b\u5909\u3048\u308b \u306a\u306a\u3081\n if ((x + y) % 2 != (nx + ny) % 2) continue;\n int dx = Math.Abs(nx - x);\n int dy = Math.Abs(ny - y);\n int bd = dx == dy ? 1 : 2;\n dp[i + 1, 1, j + 1] = Math.Min(dp[i + 1, 1, j + 1], dp[i, 0, j] + bd + 1);\n }\n\n {\n // \u30eb\u30fc\u30af\u306b\u5909\u3048\u308b\n int rd = (x == nx) || (y == ny) ? 1 : 2;\n dp[i + 1, 2, j + 1] = Math.Min(dp[i + 1, 2, j + 1], dp[i, 0, j] + rd + 1);\n }\n }\n }\n }\n\n {\n // \u30d3\u30b7\u30e7\u30c3\u30d7\n\n for (int j = 0; j < C; j++)\n {\n if (dp[i, 1, j] == int.MaxValue) continue;\n {\n // \u30d3\u30b7\u30e7\u30c3\u30d7\n if ((x + y) % 2 != (nx + ny) % 2) continue;\n int dx = Math.Abs(nx - x);\n int dy = Math.Abs(ny - y);\n int bd = dx == dy ? 1 : 2;\n dp[i + 1, 1, j] = Math.Min(dp[i + 1, 1, j], dp[i, 1, j] + bd);\n }\n\n if (j + 1 < C)\n {\n {\n // \u30ca\u30a4\u30c8\n long kd = kDist[x, y, nx, ny];\n if (kd == int.MaxValue) continue;\n dp[i + 1, 0, j + 1] = Math.Min(dp[i + 1, 0, j + 1], dp[i, 1, j] + kd + 1);\n }\n {\n // \u30eb\u30fc\u30af\u306b\u5909\u3048\u308b\n int rd = (x == nx) || (y == ny) ? 1 : 2;\n dp[i + 1, 2, j + 1] = Math.Min(dp[i + 1, 2, j + 1], dp[i, 1, j] + rd + 1);\n }\n }\n }\n }\n\n {\n // \u30eb\u30fc\u30af\n for (int j = 0; j < C; j++)\n {\n if (dp[i, 2, j] == int.MaxValue) continue;\n {\n // \u30eb\u30fc\u30af\u306b\u5909\u3048\u308b\n int rd = (x == nx) || (y == ny) ? 1 : 2;\n dp[i + 1, 2, j] = Math.Min(dp[i + 1, 2, j], dp[i, 2, j] + rd);\n }\n\n if (j + 1 < C)\n {\n {\n // \u30ca\u30a4\u30c8\n long kd = kDist[x, y, nx, ny];\n if (kd == int.MaxValue) continue;\n dp[i + 1, 0, j + 1] = Math.Min(dp[i + 1, 0, j + 1], dp[i, 2, j] + kd + 1);\n }\n\n {\n // \u30d3\u30b7\u30e7\u30c3\u30d7\n if ((x + y) % 2 != (nx + ny) % 2) continue;\n int dx = Math.Abs(nx - x);\n int dy = Math.Abs(ny - y);\n int bd = dx == dy ? 1 : 2;\n dp[i + 1, 1, j + 1] = Math.Min(dp[i + 1, 1, j + 1], dp[i, 2, j] + bd + 1);\n }\n }\n }\n }\n }\n\n long step = long.MaxValue;\n int c = 0;\n\n for (int i = 0; i < C; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (dp[N * N - 1, j, i] < step)\n {\n step = dp[N * N - 1, j, i];\n c = i;\n }\n }\n }\n\n Console.WriteLine($\"{step} {c}\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0f7aa92de46fdace2bace16b4416139d", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "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 N = sc.Int;\n var A = new int[N][];\n var R = new int[N * N+1];R[N * N] = -1;\n for (int i = 0; i < N; i++)\n {\n A[i] = sc.ArrInt;\n for (int j = 0; j < N; j++)\n {\n A[i][j]--;\n R[A[i][j]] = Id(i, j);\n }\n }\n //dist:=i\u306b\u3044\u3066\uff0cj\u307e\u3067\u30af\u30ea\u30a2\u3057\u3066\u3044\u3066\uff0c\u99d2\u304c0:knight,1:bishop,2:rook\u306e\u3068\u304d\n var dist = Create(N * N, () => Create(N * N, () => Create(3, () => long.MaxValue / 2)));\n var pq = new PriorityQueue<(long c, int now, int cl, int pi)>((a, b) => a.c.CompareTo(b.c));\n dist[R[0]][0][0] = dist[R[0]][0][1] = dist[R[0]][0][2] = 0;\n pq.Push((0, R[0], 0, 0));\n pq.Push((0, R[0], 0, 1));\n pq.Push((0, R[0], 0, 2));\n while (pq.Any())\n {\n var (cst, now, cl, pi) = pq.Pop();\n int h = now / N, w = now % N;\n if (pi == 0)\n {\n for(int k = 0; k < knH.Length; k++)\n {\n int nh = h + knH[k], nw = w + knW[k];\n if (!Inside(nh, nw, N, N)) continue;\n var p = cl;\n if (Id(nh, nw) == R[cl + 1]) p++;\n if (chmin(ref dist[Id(nh, nw)][p][pi], cst + W))\n {\n pq.Push((cst + W, Id(nh, nw), p, pi));\n }\n }\n }\n else if (pi == 1)\n {\n for(int i = -N + 1; i <= N - 1; i++)\n {\n {\n int nh = i + h, nw = i + w;\n if (!Inside(nh, nw, N, N)) goto SEC;\n var p = cl;\n if (Id(nh, nw) == R[cl + 1]) p++;\n if (chmin(ref dist[Id(nh, nw)][p][pi], cst + W))\n {\n pq.Push((cst + W, Id(nh, nw), p, pi));\n }\n }\n SEC:;\n {\n int nh = i + h, nw = -i + w;\n if (!Inside(nh, nw, N, N)) continue;\n var p = cl;\n if (Id(nh, nw) == R[cl + 1]) p++;\n if (chmin(ref dist[Id(nh, nw)][p][pi], cst + W))\n {\n pq.Push((cst + W, Id(nh, nw), p, pi));\n }\n }\n }\n }\n else\n {\n for(int i = -N + 1; i <= N - 1; i++)\n {\n\n {\n int nh = h, nw = i + w;\n if (!Inside(nh, nw, N, N)) goto SEC;\n var p = cl;\n if (Id(nh, nw) == R[cl + 1]) p++;\n if (chmin(ref dist[Id(nh, nw)][p][pi], cst + W))\n {\n pq.Push((cst + W, Id(nh, nw), p, pi));\n }\n }\n SEC:;\n {\n int nh = i + h, nw = w;\n if (!Inside(nh, nw, N, N)) continue;\n var p = cl;\n if (Id(nh, nw) == R[cl + 1]) p++;\n if (chmin(ref dist[Id(nh, nw)][p][pi], cst + W))\n {\n pq.Push((cst + W, Id(nh, nw), p, pi));\n }\n }\n }\n }\n for(int k = 0; k < 3; k++)\n {\n if(chmin(ref dist[now][cl][k],cst+1+W))\n {\n pq.Push((cst + 1+W, now, cl, k));\n }\n }\n }\n var res = dist[R[N * N - 1]][N * N - 1].Min();\n Console.WriteLine($\"{res / W} {res % W}\");\n }\n int N;\n const long W = (long)1e9;\n public int Id(int h, int w) => h * N + w;\n int[] knH = new[] { -2, -2, -1, -1, 1, 1, 2, 2 }, knW = new[] { 1, -1, 2, -2, 2, -2, 1, -1 };\n public static bool Inside(int h, int w, int H, int W)\n => 0 <= h && h < H && 0 <= w && w < W;\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ebd439f11da837c1c746b5c8030072ea", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "/*\ncsc -debug D.cs && mono --debug D.exe <<< \"3\n1 9 3\n8 6 7\n4 2 5\"\nK: (1,1) -> (3,2) -> (1,3) -> (3,2) -> L -> (3,1) -> (3,3) -> (3,2) -> (2,2) -> (2,3) -> (2,1) -> (1,1) -> (1,2)\n 1 2 3 4 5 6 7 8 9\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 private enum Fig { K, L, S };\n\n private static int N;\n private static int[][] arr;\n\n public static void SolveCodeForces() {\n N = int.Parse(Console.ReadLine());\n arr = new int[N][];\n for (var i = 0; i < arr.Length; i++)\n arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n var numPos = new int[N*N+1][];\n for (var r = 0; r < arr.Length; r++)\n for (var c = 0; c < arr[r].Length; c++)\n numPos[ arr[r][c] ] = new[] {r, c};\n\n var bestAnswers = new Dictionary{\n { Fig.K, new[] {0, 0} },\n { Fig.L, new[] {0, 0} },\n { Fig.S, new[] {0, 0} },\n };\n for (var d = 2; d <= N * N; d++) {\n var rcFrom = numPos[d - 1];\n var hopAns = new Dictionary{\n { Fig.K, new[] {int.MaxValue, int.MaxValue} },\n { Fig.L, new[] {int.MaxValue, int.MaxValue} },\n { Fig.S, new[] {int.MaxValue, int.MaxValue} },\n };\n foreach (var fig in AllFigs) {\n if (bestAnswers[fig][0] < int.MaxValue)\n foreach (var state in SolveHop(fig, rcFrom[0], rcFrom[1], d)) {\n // System.Console.WriteLine(\"Digits: {0}->{1}, start fig {5}, end fig {2}, moves {3}, switches {4}\", d-1, d, state.Fig, state.Moves, state.Switches, fig);\n var newMoves = bestAnswers[fig][0] + state.Moves;\n var newSwitches = bestAnswers[fig][1] + state.Switches;\n\n var prevAns = hopAns[state.Fig];\n if (prevAns[0] == int.MaxValue) {\n prevAns[0] = newMoves;\n prevAns[1] = newSwitches;\n }\n else if (newMoves < prevAns[0] || (newMoves == prevAns[0] && newSwitches < prevAns[1])) {\n prevAns[0] = newMoves;\n prevAns[1] = newSwitches;\n }\n }\n }\n bestAnswers = hopAns;\n }\n\n var bestAns = bestAnswers.OrderBy(kvp => kvp.Value[0]).ThenBy(kvp => kvp.Value[1]).First().Value;\n System.Console.WriteLine(\"{0} {1}\", bestAns[0], bestAns[1]);\n }\n\n private struct State { public int R; public int C; public Fig Fig; public int Moves; public int Switches; }\n\n private static bool AreIndicesAllowed(int r, int c) {\n return r >= 0 && r < N && c >= 0 && c < N;\n }\n\n private static readonly int[][] K_Moves = new[] {\n new[] { -2, -1 },\n new[] { -2, 1 },\n new[] { -1, -2 },\n new[] { -1, 2 },\n new[] { 1, -2 },\n new[] { 1, 2 },\n new[] { 2, -1 },\n new[] { 2, 1 },\n };\n\n private static readonly int[][] S_Moves = new[] {\n new[] { -1, -1 },\n new[] { -1, 1 },\n new[] { 1, -1 },\n new[] { 1, 1 },\n };\n\n private static Fig[] AllFigs = new[] { Fig.L, Fig.S, Fig.K };\n\n private static IEnumerable ExpandState(State state) {\n if (state.Fig == Fig.K) {\n foreach (var drdc in K_Moves) {\n var r = drdc[0] + state.R;\n var c = drdc[1] + state.C;\n if (AreIndicesAllowed(r, c))\n yield return new State { Fig = Fig.K, R = r, C = c, Moves = state.Moves + 1, Switches = state.Switches };\n }\n }\n else if (state.Fig == Fig.L) {\n for (var r = 0; r < N; r++)\n if (r != state.R)\n yield return new State { Fig = Fig.L, R = r, C = state.C, Moves = state.Moves + 1, Switches = state.Switches };\n for (var c = 0; c < N; c++)\n if (c != state.C)\n yield return new State { Fig = Fig.L, R = state.R, C = c, Moves = state.Moves + 1, Switches = state.Switches };\n }\n else if (state.Fig == Fig.S) {\n for (var d = 1; d < N; d++)\n foreach (var drdc in S_Moves) {\n var r = d * drdc[0] + state.R;\n var c = d * drdc[1] + state.C;\n if (AreIndicesAllowed(r, c))\n yield return new State { Fig = Fig.S, R = r, C = c, Moves = state.Moves + 1, Switches = state.Switches };\n }\n }\n foreach (var fig in AllFigs)\n if (fig != state.Fig)\n yield return new State { Fig = fig, R = state.R, C = state.C, Moves = state.Moves + 1, Switches = state.Switches + 1 };\n }\n\n // Returns: end fig => [ number of moves, number of fig switches ]\n private static IEnumerable SolveHop(Fig startFig, int rFrom, int cFrom, int targetDigit) {\n var Q = new Queue();\n Q.Enqueue(new State { Fig = startFig, R = rFrom, C = cFrom });\n while (Q.Count > 0) {\n var state = Q.Dequeue();\n if (arr[state.R][state.C] == targetDigit)\n yield return state;\n // There is an always solution with 3 moves: switch to L, hop horizontally, hop vertically\n else if (state.Moves < 3)\n foreach (var neigh in ExpandState(state)) {\n Q.Enqueue(neigh);\n }\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbcf734a27d31f40a8f7a1339c44734b", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N;\n private int[,] A;\n\n private int[] X, Y;\n\n private const int K = 3;\n\n private int[] kDx = new int[] {-2, -2, -1, -1, 1, 1, 2, 2};\n private int[] kDy = new int[] {-1, 1, -2, 2, -2, 2, -1, 1};\n\n private int[] rDx = new int[] {-1, 0, 0, 1};\n private int[] rDy = new int[] {0, 1, -1, 0};\n\n private int[] bDx = new int[] {1, 1, -1, -1};\n private int[] bDy = new int[] {-1, 1, -1, 1};\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n 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, j] = sc.NextInt() - 1;\n }\n }\n\n X = new int[N * N];\n Y = new int[N * N];\n for (int i = 0; i < N; i++)\n {\n for (int j = 0; j < N; j++)\n {\n X[A[i, j]] = i;\n Y[A[i, j]] = j;\n }\n }\n\n var step = new int[N, N, N * N + 1, K];\n var r = new int[N, N, N * N + 1, K];\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 * N; k++)\n {\n for (int l = 0; l < K; l++)\n {\n step[i, j, k, l] = int.MaxValue;\n }\n }\n }\n }\n\n var q = new Queue<(int x, int y, int t, int k)>();\n for (int i = 0; i < K; i++)\n {\n step[X[0], Y[0], 1, i] = 0;\n q.Enqueue((X[0], Y[0], 1, i));\n }\n\n while (q.Count > 0)\n {\n var d = q.Dequeue();\n int curS = step[d.x, d.y, d.t, d.k];\n int curR = r[d.x, d.y, d.t, d.k];\n // \u4ea4\u63db\n for (int i = 0; i < K; i++)\n {\n if (d.k == i) continue;\n ref int nextS = ref step[d.x, d.y, d.t, i];\n ref int nextR = ref r[d.x, d.y, d.t, i];\n if (curS + 1 < nextS || (curS + 1 == nextS && curR + 1 < nextR))\n {\n nextS = curS + 1;\n nextR = curR + 1;\n q.Enqueue((d.x, d.y, d.t, i));\n }\n }\n\n // \u79fb\u52d5\n if (d.k == 0)\n {\n // \u30ca\u30a4\u30c8\n for (int i = 0; i < kDx.Length; i++)\n {\n int nx = d.x + kDx[i];\n int ny = d.y + kDy[i];\n if (nx < 0 || nx >= N) continue;\n if (ny < 0 || ny >= N) continue;\n int nt = A[nx, ny] == d.t ? d.t + 1 : d.t;\n\n ref int nextS = ref step[nx, ny, nt, 0];\n ref int nextR = ref r[nx, ny, nt, 0];\n if (curS + 1 < nextS || (curS + 1 == nextS && curR < nextR))\n {\n nextS = curS + 1;\n nextR = curR;\n q.Enqueue((nx, ny, nt, 0));\n }\n }\n }\n else if (d.k == 1)\n {\n // \u30d3\u30b7\u30e7\u30c3\u30d7 \u306a\u306a\u3081\n for (int i = 0; i < bDx.Length; i++)\n {\n for (int j = 1;; j++)\n {\n int nx = d.x + bDx[i] * j;\n int ny = d.y + bDy[i] * j;\n if (nx < 0 || nx >= N) break;\n if (ny < 0 || ny >= N) break;\n\n int nt = A[nx, ny] == d.t ? d.t + 1 : d.t;\n\n ref int nextS = ref step[nx, ny, nt, 1];\n ref int nextR = ref r[nx, ny, nt, 1];\n if (curS + 1 < nextS || (curS + 1 == nextS && curR < nextR))\n {\n nextS = curS + 1;\n nextR = curR;\n q.Enqueue((nx, ny, nt, 1));\n }\n }\n }\n }\n else if (d.k == 2)\n {\n // \u30eb\u30fc\u30af\u3000\u305f\u3066\u3088\u3053\n for (int i = 0; i < rDx.Length; i++)\n {\n for (int j = 1;; j++)\n {\n int nx = d.x + rDx[i] * j;\n int ny = d.y + rDy[i] * j;\n if (nx < 0 || nx >= N) break;\n if (ny < 0 || ny >= N) break;\n\n int nt = A[nx, ny] == d.t ? d.t + 1 : d.t;\n\n ref int nextS = ref step[nx, ny, nt, 2];\n ref int nextR = ref r[nx, ny, nt, 2];\n if (curS + 1 < nextS || (curS + 1 == nextS && curR < nextR))\n {\n nextS = curS + 1;\n nextR = curR;\n q.Enqueue((nx, ny, nt, 2));\n }\n }\n }\n }\n }\n\n // \u30b4\u30fc\u30eb\n int ansS = int.MaxValue;\n int ansR = int.MaxValue;\n int lx = X[N * N - 1];\n int ly = Y[N * N - 1];\n for (int i = 0; i < 3; i++)\n {\n int ss = step[lx, ly, N * N, i];\n int rr = r[lx, ly, N * N, i];\n\n if (ss < ansS || (ss == ansS && rr < ansR))\n {\n ansS = ss;\n ansR = rr;\n }\n }\n\n Console.WriteLine($\"{ansS} {ansR}\");\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a9a3a90dd6deb74a91500f1b3de86799", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Tidbits;\n\nclass testcodeforces\n{\n int N;\n int[,] board;\n Dictionary> locations;\n\n public static void Main()\n {\n testcodeforces obj = new testcodeforces();\n obj.ThreePieces();\n }\n\n enum Pawn\n {\n Bishop = 0,\n Knight,\n Rook\n }\n class Move : IComparable\n {\n public int Moves { get; set; }\n public int Rep { get; set; }\n\n public int Num { get; set; }\n public Pawn pawn { get; set; }\n public int CompareTo(Move other)\n {\n if (Moves < other.Moves) return -1;\n if (Moves > other.Moves) return 1;\n\n if (Moves == other.Moves) return Rep.CompareTo(other.Rep);\n\n return 0;\n }\n }\n private void ThreePieces()\n {\n N = int.Parse(Console.ReadLine());\n\n board = new int[N, N];\n locations = new Dictionary>();\n\n for (int i = 0; i < N; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }), int.Parse);\n\n for (int j = 0; j < N; j++)\n {\n board[i, j] = array[j];\n locations.Add(array[j], Tuple.Create(i + 1, j + 1));\n }\n }\n\n //Min of all\n #region rook Distances\n //Find rook distances\n var rook_distances = new Tuple[(N * N) + 1];\n rook_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n if (current_location.Item1 == new_location.Item1 ||\n current_location.Item2 == new_location.Item2)\n rook_distances[i] = Tuple.Create(1, 0);\n else\n rook_distances[i] = Tuple.Create(2, 0);\n }\n #endregion\n\n #region Bishop Distances\n //Find Bishop Distances\n var bishop_distances = new Tuple[(N * N) + 1];\n bishop_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n if ((current_location.Item1 + current_location.Item2) % 2 != (new_location.Item1 + new_location.Item2) % 2)\n bishop_distances[i] = Tuple.Create(int.MaxValue, 0);\n else\n {\n bool found = false;\n //Move North East\n for (int k = 1; k <= Math.Min(current_location.Item1 - 1, N - current_location.Item2); k++)\n {\n if (new_location.Item1 == current_location.Item1 - k && new_location.Item2 == current_location.Item2 + k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n\n //Move South west\n if (!found)\n {\n for (int k = 1; k <= Math.Min(N - current_location.Item1, current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 + k && new_location.Item2 == current_location.Item2 - k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n //Move South east\n if (!found)\n {\n for (int k = 1; k <= Math.Min(N - current_location.Item1, N - current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 + k && new_location.Item2 == current_location.Item2 + k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n //Move North West\n if (!found)\n {\n for (int k = 1; k <= Math.Min(current_location.Item1 - 1, current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 - k && new_location.Item2 == current_location.Item2 - k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n if (!found)\n {\n bishop_distances[i] = Tuple.Create(2, 0);\n }\n }\n }\n #endregion\n\n #region Knight Distances\n //Find Knight Distances\n var X = new int[] { 2, 2, -2, -2, 1, 1, -1, -1 };\n var Y = new int[] { -1, 1, -1, 1, 2, -2, 2, -2 };\n\n var Knight_distances = new Tuple[(N * N) + 1];\n Knight_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n var list = new List>();\n\n bool found = false;\n\n for (int t = 0; t < 8; t++)\n {\n var new_X = current_location.Item1 + X[t];\n var new_Y = current_location.Item2 + Y[t];\n if (new_X == new_location.Item1 && new_Y == new_location.Item2)\n {\n Knight_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n else\n {\n if (new_X >= 1 && new_X <= N && new_Y >= 1 && new_Y <= N)\n list.Add(Tuple.Create(new_X, new_Y));\n }\n }\n\n if (!found)\n {\n for (int l = 0; l < list.Count; l++)\n {\n for (int t = 0; t < 8; t++)\n {\n var new_X = list[l].Item1 + X[t];\n var new_Y = list[l].Item2 + Y[t];\n if (new_X == new_location.Item1 && new_Y == new_location.Item2)\n {\n Knight_distances[i] = Tuple.Create(2, 0);\n found = true;\n break;\n }\n }\n }\n }\n\n if (!found) Knight_distances[i] = Tuple.Create(int.MaxValue, 0);\n\n }\n #endregion\n\n var minheap = new MinHeap();\n\n var states = new Move[3][];\n states[0] = new Move[(N * N) + 1];\n states[1] = new Move[(N * N) + 1];\n states[2] = new Move[(N * N) + 1];\n\n for (int j = 1; j <= N * N; j++)\n states[0][j] = new Move() { pawn = Pawn.Bishop, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n for (int j = 1; j <= N * N; j++)\n states[1][j] = new Move() { pawn = Pawn.Knight, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n for (int j = 1; j <= N * N; j++)\n states[2][j] = new Move() { pawn = Pawn.Rook, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n\n states[0][1] = new Move() { pawn = Pawn.Bishop, Num = 1, Moves = 0, Rep = 0 };\n states[1][1] = new Move() { pawn = Pawn.Knight, Num = 1, Moves = 0, Rep = 0 };\n states[2][1] = new Move() { pawn = Pawn.Rook, Num = 1, Moves = 0, Rep = 0 };\n\n minheap.Add(states[0][1]);\n minheap.Add(states[1][1]);\n minheap.Add(states[2][1]);\n\n while (minheap.Count > 0)\n {\n var item = minheap.ExtractMin();\n\n Pawn p = item.pawn;\n int currentnum = item.Num;\n int intPaws = (int)p;\n\n Console.WriteLine(\"*******************\");\n Console.WriteLine(\"\" + p + \" currentnum \" + currentnum);\n\n if (currentnum == N * N) break;\n\n if (p == Pawn.Bishop)\n {\n //Get Bishop distance\n var dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[0][currentnum + 1].Moves && item.Rep < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Bishop,\n Rep = item.Rep\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n\n //Get Knight distance\n dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[1][currentnum + 1].Moves && item.Rep + 1 < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Knight,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n\n //Get Rook distance\n dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Rook,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n }\n else if (p == Pawn.Knight)\n {\n var dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[1][currentnum + 1].Moves && item.Rep < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Knight,\n Rep = item.Rep\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n\n dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Rook,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n\n dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[0][currentnum + 1].Moves && item.Rep + 1 < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Bishop,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n }\n else if (p == Pawn.Rook)\n {\n var dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[2][currentnum + 1].Moves && item.Rep < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Rook,\n Rep = item.Rep\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n\n dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[0][currentnum + 1].Moves && item.Rep + 1 < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Bishop,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n\n dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Knight,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n }\n }\n\n int res = int.MaxValue;\n\n res = Math.Min(states[1][N * N].Moves, res);\n res = Math.Min(states[2][N * N].Moves, res);\n res = Math.Min(states[0][N * N].Moves, res);\n\n int moves = int.MaxValue;\n\n if (res == states[0][N * N].Moves)\n moves = Math.Min(states[0][N * N].Rep, moves);\n\n if (res == states[1][N * N].Moves)\n moves = Math.Min(states[1][N * N].Rep, moves);\n if (res == states[2][N * N].Moves)\n moves = Math.Min(states[2][N * N].Rep, moves);\n\n Console.WriteLine(\"\" + res + \" \" + moves);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bc1d13e9e9969c6cc32db8ab4437020f", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Tidbits;\n\n class MinHeap where T : IComparable\n {\n public IList m_array;\n\n public MinHeap()\n {\n m_array = new List();\n }\n public T GetRoot()\n {\n return m_array[0];\n }\n\n public T 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 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].CompareTo(m_array[left]) > 0)\n {\n index = left;\n }\n\n if (right < Count && m_array[index].CompareTo(m_array[right]) > 0)\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].CompareTo(m_array[index]) > 0)\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(T 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\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].CompareTo(array[index]) < 0)\n {\n index = left;\n }\n\n if (right < N && array[right].CompareTo(array[index]) < 0)\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\nclass testcodeforces\n{\n int N;\n int[,] board;\n Dictionary> locations;\n\n public static void Main()\n {\n testcodeforces obj = new testcodeforces();\n obj.ThreePieces();\n }\n\n enum Pawn\n {\n Bishop = 0,\n Knight,\n Rook\n }\n class Move : IComparable\n {\n public int Moves { get; set; }\n public int Rep { get; set; }\n\n public int Num { get; set; }\n public Pawn pawn { get; set; }\n public int CompareTo(Move other)\n {\n if (Moves < other.Moves) return -1;\n if (Moves > other.Moves) return 1;\n\n if (Moves == other.Moves) return Rep.CompareTo(other.Rep);\n\n return 0;\n }\n }\n private void ThreePieces()\n {\n N = int.Parse(Console.ReadLine());\n\n board = new int[N, N];\n locations = new Dictionary>();\n\n for (int i = 0; i < N; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }), int.Parse);\n\n for (int j = 0; j < N; j++)\n {\n board[i, j] = array[j];\n locations.Add(array[j], Tuple.Create(i + 1, j + 1));\n }\n }\n\n //Min of all\n #region rook Distances\n //Find rook distances\n var rook_distances = new Tuple[(N * N) + 1];\n rook_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n if (current_location.Item1 == new_location.Item1 ||\n current_location.Item2 == new_location.Item2)\n rook_distances[i] = Tuple.Create(1, 0);\n else\n rook_distances[i] = Tuple.Create(2, 0);\n }\n #endregion\n\n #region Bishop Distances\n //Find Bishop Distances\n var bishop_distances = new Tuple[(N * N) + 1];\n bishop_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n if ((current_location.Item1 + current_location.Item2) % 2 != (new_location.Item1 + new_location.Item2) % 2)\n bishop_distances[i] = Tuple.Create(int.MaxValue, 0);\n else\n {\n bool found = false;\n //Move North East\n for (int k = 1; k <= Math.Min(current_location.Item1 - 1, N - current_location.Item2); k++)\n {\n if (new_location.Item1 == current_location.Item1 - k && new_location.Item2 == current_location.Item2 + k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n\n //Move South west\n if (!found)\n {\n for (int k = 1; k <= Math.Min(N - current_location.Item1, current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 + k && new_location.Item2 == current_location.Item2 - k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n //Move South east\n if (!found)\n {\n for (int k = 1; k <= Math.Min(N - current_location.Item1, N - current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 + k && new_location.Item2 == current_location.Item2 + k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n //Move North West\n if (!found)\n {\n for (int k = 1; k <= Math.Min(current_location.Item1 - 1, current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 - k && new_location.Item2 == current_location.Item2 - k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n if (!found)\n {\n bishop_distances[i] = Tuple.Create(2, 0);\n }\n }\n }\n #endregion\n\n #region Knight Distances\n //Find Knight Distances\n var X = new int[] { 2, 2, -2, -2, 1, 1, -1, -1 };\n var Y = new int[] { -1, 1, -1, 1, 2, -2, 2, -2 };\n\n var Knight_distances = new Tuple[(N * N) + 1];\n Knight_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n var list = new List>();\n\n bool found = false;\n\n for (int t = 0; t < 8; t++)\n {\n var new_X = current_location.Item1 + X[t];\n var new_Y = current_location.Item2 + Y[t];\n if (new_X == new_location.Item1 && new_Y == new_location.Item2)\n {\n Knight_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n else\n {\n if (new_X >= 1 && new_X <= N && new_Y >= 1 && new_Y <= N)\n list.Add(Tuple.Create(new_X, new_Y));\n }\n }\n\n if (!found)\n {\n for (int l = 0; l < list.Count; l++)\n {\n for (int t = 0; t < 8; t++)\n {\n var new_X = list[l].Item1 + X[t];\n var new_Y = list[l].Item2 + Y[t];\n if (new_X == new_location.Item1 && new_Y == new_location.Item2)\n {\n Knight_distances[i] = Tuple.Create(2, 0);\n found = true;\n break;\n }\n }\n }\n }\n\n if (!found) Knight_distances[i] = Tuple.Create(int.MaxValue, 0);\n\n }\n #endregion\n\n var minheap = new MinHeap();\n\n var states = new Move[3][];\n states[0] = new Move[(N * N) + 1];\n states[1] = new Move[(N * N) + 1];\n states[2] = new Move[(N * N) + 1];\n\n for (int j = 1; j <= N * N; j++)\n states[0][j] = new Move() { pawn = Pawn.Bishop, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n for (int j = 1; j <= N * N; j++)\n states[1][j] = new Move() { pawn = Pawn.Knight, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n for (int j = 1; j <= N * N; j++)\n states[2][j] = new Move() { pawn = Pawn.Rook, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n\n states[0][1] = new Move() { pawn = Pawn.Bishop, Num = 1, Moves = 0, Rep = 0 };\n states[1][1] = new Move() { pawn = Pawn.Knight, Num = 1, Moves = 0, Rep = 0 };\n states[2][1] = new Move() { pawn = Pawn.Rook, Num = 1, Moves = 0, Rep = 0 };\n\n minheap.Add(states[0][1]);\n minheap.Add(states[1][1]);\n minheap.Add(states[2][1]);\n\n while (minheap.Count > 0)\n {\n var item = minheap.ExtractMin();\n\n Pawn p = item.pawn;\n int currentnum = item.Num;\n int intPaws = (int)p;\n\n // Console.WriteLine(\"*******************\");\n // Console.WriteLine(\"\" + p + \" currentnum \" + currentnum);\n\n if (currentnum == N * N) break;\n\n if (p == Pawn.Bishop)\n {\n //Get Bishop distance\n var dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[0][currentnum + 1].Moves && item.Rep < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Bishop,\n Rep = item.Rep\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n\n //Get Knight distance\n dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[1][currentnum + 1].Moves && item.Rep + 1 < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Knight,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n\n //Get Rook distance\n dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Rook,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n }\n else if (p == Pawn.Knight)\n {\n var dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[1][currentnum + 1].Moves && item.Rep < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Knight,\n Rep = item.Rep\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n\n dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Rook,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n\n dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[0][currentnum + 1].Moves && item.Rep + 1 < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Bishop,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n }\n else if (p == Pawn.Rook)\n {\n var dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[2][currentnum + 1].Moves && item.Rep < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Rook,\n Rep = item.Rep\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n\n dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[0][currentnum + 1].Moves && item.Rep + 1 < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Bishop,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n\n dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Knight,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n }\n }\n\n int res = int.MaxValue;\n\n res = Math.Min(states[1][N * N].Moves, res);\n res = Math.Min(states[2][N * N].Moves, res);\n res = Math.Min(states[0][N * N].Moves, res);\n\n int moves = int.MaxValue;\n\n if (res == states[0][N * N].Moves)\n moves = Math.Min(states[0][N * N].Rep, moves);\n\n if (res == states[1][N * N].Moves)\n moves = Math.Min(states[1][N * N].Rep, moves);\n if (res == states[2][N * N].Moves)\n moves = Math.Min(states[2][N * N].Rep, moves);\n\n Console.WriteLine(\"\" + res + \" \" + moves);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "79de1979a419cfd8a956b077de8f4344", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleTidbits\n{\n class MinHeap where T : IComparable\n {\n public IList m_array;\n\n public MinHeap()\n {\n m_array = new List();\n }\n public T GetRoot()\n {\n return m_array[0];\n }\n\n public T 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 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].CompareTo(m_array[left]) > 0)\n {\n index = left;\n }\n\n if (right < Count && m_array[index].CompareTo(m_array[right]) > 0)\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].CompareTo(m_array[index]) > 0)\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(T 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].CompareTo(array[index]) < 0)\n {\n index = left;\n }\n\n if (right < N && array[right].CompareTo(array[index]) < 0)\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 JustCodeForces\n {\n int N;\n int[,] board;\n Dictionary> locations;\n\n public static void Main()\n {\n JustCodeForces obj = new JustCodeForces();\n\n while (true)\n obj.ThreePieces();\n }\n\n enum Pawn\n {\n Bishop = 0,\n Knight,\n Rook\n }\n class Move : IComparable\n {\n public int Moves { get; set; }\n public int Rep { get; set; }\n\n public int Num { get; set; }\n public Pawn pawn { get; set; }\n public int CompareTo(object o)\n {\n var other = o as Move;\n if (Moves < other.Moves) return -1;\n if (Moves > other.Moves) return 1;\n\n if (Moves == other.Moves) return Rep.CompareTo(other.Rep);\n\n return -1;\n }\n }\n private void ThreePieces()\n {\n N = int.Parse(Console.ReadLine());\n\n board = new int[N, N];\n locations = new Dictionary>();\n\n for (int i = 0; i < N; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }), int.Parse);\n\n for (int j = 0; j < N; j++)\n {\n board[i, j] = array[j];\n locations.Add(array[j], Tuple.Create(i + 1, j + 1));\n }\n }\n\n //Min of all\n #region rook Distances\n //Find rook distances\n var rook_distances = new Tuple[(N * N) + 1];\n rook_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n if (current_location.Item1 == new_location.Item1 ||\n current_location.Item2 == new_location.Item2)\n rook_distances[i] = Tuple.Create(1, 0);\n else\n rook_distances[i] = Tuple.Create(2, 0);\n }\n #endregion\n\n #region Bishop Distances\n //Find Bishop Distances\n var bishop_distances = new Tuple[(N * N) + 1];\n bishop_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n if ((current_location.Item1 + current_location.Item2) % 2 != (new_location.Item1 + new_location.Item2) % 2)\n bishop_distances[i] = Tuple.Create(int.MaxValue, 0);\n else\n {\n bool found = false;\n //Move North East\n for (int k = 1; k <= Math.Min(current_location.Item1 - 1, N - current_location.Item2); k++)\n {\n if (new_location.Item1 == current_location.Item1 - k && new_location.Item2 == current_location.Item2 + k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n\n //Move South west\n if (!found)\n {\n for (int k = 1; k <= Math.Min(N - current_location.Item1, current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 + k && new_location.Item2 == current_location.Item2 - k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n //Move South east\n if (!found)\n {\n for (int k = 1; k <= Math.Min(N - current_location.Item1, N - current_location.Item2); k++)\n {\n if (new_location.Item1 == current_location.Item1 + k && new_location.Item2 == current_location.Item2 + k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n //Move North West\n if (!found)\n {\n for (int k = 1; k <= Math.Min(current_location.Item1 - 1, current_location.Item2 - 1); k++)\n {\n if (new_location.Item1 == current_location.Item1 - k && new_location.Item2 == current_location.Item2 - k)\n {\n bishop_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n }\n }\n\n if (!found)\n {\n bishop_distances[i] = Tuple.Create(2, 0);\n }\n }\n }\n #endregion\n\n #region Knight Distances\n //Find Knight Distances\n var X = new int[] { 2, 2, -2, -2, 1, 1, -1, -1 };\n var Y = new int[] { -1, 1, -1, 1, 2, -2, 2, -2 };\n\n var Knight_distances = new Tuple[(N * N) + 1];\n Knight_distances[1] = Tuple.Create(0, 0);\n\n for (int i = 2; i <= N * N; i++)\n {\n var current_location = locations[i - 1];\n var new_location = locations[i];\n\n var list = new List>();\n\n bool found = false;\n\n for (int t = 0; t < 8; t++)\n {\n var new_X = current_location.Item1 + X[t];\n var new_Y = current_location.Item2 + Y[t];\n if (new_X == new_location.Item1 && new_Y == new_location.Item2)\n {\n Knight_distances[i] = Tuple.Create(1, 0);\n found = true;\n break;\n }\n else\n {\n if (new_X >= 1 && new_X <= N && new_Y >= 1 && new_Y <= N)\n list.Add(Tuple.Create(new_X, new_Y));\n }\n }\n\n var new_list = new List>();\n\n if (!found)\n {\n for (int l = 0; l < list.Count; l++)\n {\n for (int t = 0; t < 8; t++)\n {\n var new_X = list[l].Item1 + X[t];\n var new_Y = list[l].Item2 + Y[t];\n if (new_X == new_location.Item1 && new_Y == new_location.Item2)\n {\n Knight_distances[i] = Tuple.Create(2, 0);\n found = true;\n break;\n }\n else\n {\n if (new_X >= 1 && new_X <= N && new_Y >= 1 && new_Y <= N)\n new_list.Add(Tuple.Create(new_X, new_Y));\n }\n }\n }\n }\n\n if (!found)\n {\n for (int l = 0; l < new_list.Count; l++)\n {\n for (int t = 0; t < 8; t++)\n {\n var new_X = new_list[l].Item1 + X[t];\n var new_Y = new_list[l].Item2 + Y[t];\n if (new_X == new_location.Item1 && new_Y == new_location.Item2)\n {\n Knight_distances[i] = Tuple.Create(3, 0);\n found = true;\n break;\n }\n }\n }\n }\n\n if (!found) Knight_distances[i] = Tuple.Create(int.MaxValue, 0);\n\n }\n #endregion\n\n var minheap = new MinHeap();\n\n var states = new Move[3][];\n states[0] = new Move[(N * N) + 1];\n states[1] = new Move[(N * N) + 1];\n states[2] = new Move[(N * N) + 1];\n\n for (int j = 1; j <= N * N; j++)\n states[0][j] = new Move() { pawn = Pawn.Bishop, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n for (int j = 1; j <= N * N; j++)\n states[1][j] = new Move() { pawn = Pawn.Knight, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n for (int j = 1; j <= N * N; j++)\n states[2][j] = new Move() { pawn = Pawn.Rook, Num = j, Moves = int.MaxValue, Rep = int.MaxValue };\n\n states[0][1] = new Move() { pawn = Pawn.Bishop, Num = 1, Moves = 0, Rep = 0 };\n states[1][1] = new Move() { pawn = Pawn.Knight, Num = 1, Moves = 0, Rep = 0 };\n states[2][1] = new Move() { pawn = Pawn.Rook, Num = 1, Moves = 0, Rep = 0 };\n\n minheap.Add(states[0][1]);\n minheap.Add(states[1][1]);\n minheap.Add(states[2][1]);\n\n while (minheap.Count > 0)\n {\n var item = minheap.ExtractMin();\n\n Pawn p = item.pawn;\n int currentnum = item.Num;\n int intPaws = (int)p;\n\n // Console.WriteLine(\"*******************\");\n // Console.WriteLine(\"\" + p + \" currentnum \" + currentnum);\n\n if (currentnum == N * N) break;\n\n if (p == Pawn.Bishop)\n {\n //Get Bishop distance\n var dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[0][currentnum + 1].Moves && item.Rep < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Bishop,\n Rep = item.Rep\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n\n //Get Knight distance\n dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[1][currentnum + 1].Moves && item.Rep + 1 < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Knight,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n\n //Get Rook distance\n dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Rook,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n }\n else if (p == Pawn.Knight)\n {\n var dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[1][currentnum + 1].Moves && item.Rep < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Knight,\n Rep = item.Rep\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n\n dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[2][currentnum + 1].Moves && item.Rep + 1 < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Rook,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n\n dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[0][currentnum + 1].Moves && item.Rep + 1 < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Bishop,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n }\n else if (p == Pawn.Rook)\n {\n var dist = rook_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 < states[2][currentnum + 1].Moves\n || (item.Moves + dist.Item1 == states[2][currentnum + 1].Moves && item.Rep < states[2][currentnum + 1].Rep))\n {\n states[2][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1,\n pawn = Pawn.Rook,\n Rep = item.Rep\n };\n\n minheap.Add(states[2][currentnum + 1]);\n }\n }\n\n dist = bishop_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[0][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[0][currentnum + 1].Moves && item.Rep + 1 < states[0][currentnum + 1].Rep))\n {\n states[0][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Bishop,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[0][currentnum + 1]);\n }\n }\n\n dist = Knight_distances[currentnum + 1];\n if (dist.Item1 != int.MaxValue)\n {\n if (item.Moves + dist.Item1 + 1 < states[1][currentnum + 1].Moves\n || (item.Moves + dist.Item1 + 1 == states[1][currentnum + 1].Moves && item.Rep + 1 < states[1][currentnum + 1].Rep))\n {\n states[1][currentnum + 1] = new Move()\n {\n Num = currentnum + 1,\n Moves = item.Moves + dist.Item1 + 1,\n pawn = Pawn.Knight,\n Rep = item.Rep + 1\n };\n\n minheap.Add(states[1][currentnum + 1]);\n }\n }\n }\n }\n\n int res = int.MaxValue;\n\n res = Math.Min(states[1][N * N].Moves, res);\n res = Math.Min(states[2][N * N].Moves, res);\n res = Math.Min(states[0][N * N].Moves, res);\n\n int moves = int.MaxValue;\n\n if (res == states[0][N * N].Moves)\n moves = Math.Min(states[0][N * N].Rep, moves);\n\n if (res == states[1][N * N].Moves)\n moves = Math.Min(states[1][N * N].Rep, moves);\n if (res == states[2][N * N].Moves)\n moves = Math.Min(states[2][N * N].Rep, moves);\n\n Console.WriteLine(\"\" + res + \" \" + moves);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a08fb3e31e3ee613c0ab0bc3d33b70b3", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b97ff1feb8a5f17b765ec01dd9b2f1b3", "src_uid": "309d2d46086d526d160292717dfef308", "difficulty": 2000.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b1231ac66a71385585c4d9874f992ad", "src_uid": "309d2d46086d526d160292717dfef308", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace SP.Solutions.CodeForces.c338_196_1\n{\n\tpublic class ProgramC\n\t{\n\t private static long bestRes = long.MaxValue;\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t bestRes = long.MaxValue;\n\t\t\t int n = int.Parse(Console.ReadLine());\n\t\t\t var arr = Console.ReadLine().Split(' ').Select(long.Parse).Distinct().ToArray();\n Array.Sort(arr);\n\n\t\t\t var primes = GetPrimes();\n\n\t\t\t var nodes = new List();\n for (int i = 0; i < arr.Length; i++)\n {\n nodes.Add(new Node(arr[i], getFactors(arr[i], primes), arr[i], false, 0));\n }\n\n\t\t\t TryBuildTrees(nodes);\n Console.WriteLine(bestRes);\n\t\t\t}\n\t\t}\n\n\t private static void TryBuildTrees(List nodes)\n\t {\n\t for (int i = 0 ; i ();\n for (int k = 0; k < nodes.Count; k++) if (k != i && k != j) newNodes.Add(nodes[k]);\n\t int add = nodes[j].Factors > 1 ? 1 : 0;\n\t newNodes.Add(new Node(nodes[i].N, nodes[i].Factors, nodes[i].Rem/nodes[j].N, false, nodes[i].addFactors + nodes[j].addFactors + add));\n newNodes.Add(new Node(nodes[j].N, nodes[j].Factors, nodes[j].Rem, true, nodes[j].addFactors));\n TryBuildTrees(newNodes);\n\t }\n\n\t CalcPrice(nodes);\n\t }\n\n\t private static void CalcPrice(List nodes)\n\t {\n\t int n = 0;\n\t long res = 0;\n foreach (var node in nodes) if (!node.HasParent)\n {\n if (node.Factors > 1) res++;\n res += node.Factors + node.addFactors;\n n++;\n }\n\t if (n > 1) res++;\n\t bestRes = Math.Min(bestRes, res);\n\t }\n\n\t static int getFactors(long n, long[] primes)\n {\n int res = 0;\n int i = 0;\n while (n > 1)\n {\n if (n%primes[i] == 0)\n {\n res++;\n n /= primes[i];\n }\n else i++;\n }\n return res;\n }\n\n class Node\n {\n public override string ToString()\n {\n return string.Format(\"HasParent: {0}, N: {1}, Factors: {2}, Rem: {3}\", HasParent, N, Factors, Rem);\n }\n\n public bool HasParent;\n public readonly long N;\n public readonly int Factors;\n public readonly long Rem;\n public readonly int addFactors;\n\n public Node(long n, int factors, long rem, bool hasParent, int addFactors)\n {\n HasParent = hasParent;\n this.addFactors = addFactors;\n N = n;\n Factors = factors;\n Rem = rem;\n }\n }\n\n\t private static long[] GetPrimes()\n\t {\n\t const int max = 1000000;\n\t var primes = new List(80000);\n\t primes.Add(2);\n\t var isNotPrime = new bool[max + 1];\n for (int i = 3 ; i<= max ; i+=2) if (!isNotPrime[i])\n {\n primes.Add(i);\n for (int j = i*i; j <= max && j > 0; j += i) isNotPrime[j] = true;\n }\n\t return primes.ToArray();\n\t }\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2f17eb5ba7e170043149ba5d66157ac3", "src_uid": "52b8b6c68518d5129272b8c56e5b7662", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace SP.Solutions.CodeForces.c338_196_1\n{\n\tpublic class ProgramC\n\t{\n\t private static long bestRes = long.MaxValue;\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t bestRes = long.MaxValue;\n\t\t\t int n = int.Parse(Console.ReadLine());\n\t\t\t var arr = Console.ReadLine().Split(' ').Select(long.Parse).Distinct().ToArray();\n Array.Sort(arr);\n\n\t\t\t var primes = GetPrimes();\n\n\t\t\t var nodes = new List();\n for (int i = 0; i < arr.Length; i++)\n {\n nodes.Add(new Node(arr[i], getFactors(arr[i], primes), arr[i], false, 0));\n }\n\n\t\t\t TryBuildTrees(nodes, 0);\n Console.WriteLine(bestRes);\n\t\t\t}\n\t\t}\n\n\t private static void TryBuildTrees(List nodes, int minJ)\n\t {\n\t var noWay = true;\n for (int j = minJ; j < nodes.Count; j++)\n for (int i = j + 1; i < nodes.Count; i++)\n if (j != i && !nodes[j].HasParent && nodes[i].Rem%nodes[j].N == 0 && !nodes[i].HasParent)\n\t {\n\t noWay = false;\n\t int add = nodes[j].Factors > 1 ? 1 : 0;\n\n\t var r1 = nodes[i].Rem;\n\t var add1 = nodes[i].addFactors;\n\n\t nodes[i].Rem = nodes[i].Rem/nodes[j].N;\n\t nodes[i].addFactors = nodes[i].addFactors + nodes[j].addFactors + add;\n\t nodes[j].HasParent = true;\n\n TryBuildTrees(nodes, minJ);\n\t \n nodes[j].HasParent = false;\n nodes[i].Rem = r1;\n nodes[i].addFactors = add1;\n }\n if (noWay)\n\t CalcPrice(nodes);\n\t }\n\n\t private static void CalcPrice(List nodes)\n\t {\n\t int n = 0;\n\t long res = 0;\n foreach (var node in nodes) if (!node.HasParent)\n {\n if (node.Factors > 1) res++;\n res += node.Factors + node.addFactors;\n n++;\n }\n\t if (n > 1) res++;\n\t bestRes = Math.Min(bestRes, res);\n\t }\n\n\t static int getFactors(long n, long[] primes)\n {\n int res = 0;\n int i = 0;\n while (n > 1 && i < primes.Length)\n {\n if (n%primes[i] == 0)\n {\n res++;\n n /= primes[i];\n }\n else i++;\n }\n\t if (i == primes.Length) res++;\n return res;\n }\n\n class Node\n {\n public override string ToString()\n {\n return string.Format(\"HasParent: {0}, N: {1}, Factors: {2}, Rem: {3}\", HasParent, N, Factors, Rem);\n }\n\n public bool HasParent;\n public readonly long N;\n public int Factors;\n public long Rem;\n public int addFactors;\n\n public Node(long n, int factors, long rem, bool hasParent, int addFactors)\n {\n HasParent = hasParent;\n this.addFactors = addFactors;\n N = n;\n Factors = factors;\n Rem = rem;\n }\n }\n\n\t private static long[] GetPrimes()\n\t {\n\t const int max = 1000000;\n\t var primes = new List(80000);\n\t primes.Add(2);\n\t var isNotPrime = new bool[max + 1];\n for (int i = 3 ; i<= max ; i+=2) if (!isNotPrime[i])\n {\n primes.Add(i);\n for (int j = i*i; j <= max && j > 0; j += i) isNotPrime[j] = true;\n }\n\t return primes.ToArray();\n\t }\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "79254421e353e0fce03ef08c607f6813", "src_uid": "52b8b6c68518d5129272b8c56e5b7662", "difficulty": 2200.0} {"lang": "C# 10", "source_code": "// See https://aka.ms/new-console-template for more information\r\n\r\n(int x, int y) = ReadTwoInts();\r\nConsole.WriteLine(x * (y - 1));\r\n\r\n\r\n#region Read\r\nstatic int ReadInt() => int.Parse(Console.ReadLine());\r\nstatic (int x, int y) ReadTwoInts()\r\n{\r\n\tvar ints = ReadInts();\r\n\treturn (ints[0], ints[1]);\r\n}\r\nstatic string ReadString() => Console.ReadLine();\r\nstatic List ReadStrings() => Console.ReadLine().Split(' ').ToList();\r\nstatic List ReadInts()\r\n{\r\n\tList strings = ReadStrings();\r\n\tList ints = new();\r\n\tfor (int i = 0; i < strings.Count; i++)\r\n\t{\r\n\t\tints.Add(int.Parse(strings[i]));\r\n\t}\r\n\treturn ints;\r\n}\r\n#endregion\r\n\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e0b8320bd9027678dfa1eab317910c75", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "C# 10", "source_code": "// See https://aka.ms/new-console-template for more information\r\n\r\n(int x, int y) = ReadTwoInts();\r\nConsole.WriteLine(y == 1 ? x - 1 : x * (y - 1));\r\n\r\n\r\n#region Read\r\nstatic int ReadInt() => int.Parse(Console.ReadLine());\r\nstatic (int x, int y) ReadTwoInts()\r\n{\r\n\tvar ints = ReadInts();\r\n\treturn (ints[0], ints[1]);\r\n}\r\nstatic string ReadString() => Console.ReadLine();\r\nstatic List ReadStrings() => Console.ReadLine().Split(' ').ToList();\r\nstatic List ReadInts()\r\n{\r\n\tList strings = ReadStrings();\r\n\tList ints = new();\r\n\tfor (int i = 0; i < strings.Count; i++)\r\n\t{\r\n\t\tints.Add(int.Parse(strings[i]));\r\n\t}\r\n\treturn ints;\r\n}\r\n#endregion\r\n\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6f321c0d23db5b835dfecbc9a1a3c8b3", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Linq;\r\n\r\nnamespace CF1\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n string[] input = Console.ReadLine().Split(' ');\r\n int n = Int32.Parse(input[0]);\r\n int m = Int32.Parse(input[1]);\r\n if(m < 2)\r\n {\r\n Console.WriteLine(n - 1);\r\n }\r\n else\r\n {\r\n Console.WriteLine(n * (m - 1));\r\n }\r\n //Console.ReadLine();\r\n }\r\n }\r\n}\r\n\r\n\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6c2b01122cbc363e808a3ab85778e965", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "C# 10", "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\nusing System.Numerics;\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 m = ReadInt();\r\n \r\n if (m == 1)\r\n Write(n - 1);\r\n else\r\n Write(1L * n * (m - 1));\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 * 1500);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "db7e77335fe80e7019edea6a30a2870f", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "// Problem: 1725A - Accumulation of Dominoes\r\n// Author: Gusztav Szmolik\r\n\r\nusing System;\r\n\r\npublic class AccumulationOfDominoes {\r\n \r\n public static void Main () {\r\n string[] parts = Console.ReadLine ().Split ();\r\n int n = int.Parse (parts[0]);\r\n int m = int.Parse (parts[1]);\r\n long ans = (m > 1 ? (long)n*(m-1) : n-1);\r\n Console.WriteLine (ans);\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8f09b1c502ccaca26ec54758c0fa8e7a", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "C# 10", "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\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 Mod2 = 998244353;\r\n const int Def = (int) 1e9;\r\n const long INF = (long) 1e18;\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 long[] line = OneLongLine;\r\n long n = line[0], m = line[1];\r\n\r\n if (m != 1)\r\n {\r\n WriteLine(n * (m - 1));\r\n return;\r\n }\r\n \r\n WriteLine(n - 1);\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\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\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\r\n\r\n\r\n\r\n\r\n\r\n static bool Check(int[] arr)\r\n {\r\n var zero = arr.Count(v => v == 0);\r\n var one = arr.Count(v => v != 0);\r\n\r\n\r\n return one == 1 && zero == arr.Length - 1;\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) Solve();\r\n\r\n Solve();\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 \r\n \r\n \r\n \r\n \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 int LowerBound(int[] arr, int val)\r\n {\r\n int ng = -1;\r\n int ok = arr.Length;\r\n while (ok - ng > 1)\r\n {\r\n int med = (ok + ng) / 2;\r\n if (arr[med] >= val)\r\n {\r\n ok = med;\r\n }\r\n else\r\n {\r\n ng = med;\r\n }\r\n }\r\n \r\n return ok;\r\n }\r\n\r\n public static int UpperBound(int[] arr, int val)\r\n {\r\n int ok = arr.Length;\r\n int ng = -1;\r\n while (ok - ng > 1)\r\n {\r\n int med = (ok + ng) / 2;\r\n if (arr[med] > val)\r\n {\r\n ok = med;\r\n }\r\n else\r\n {\r\n ng = med;\r\n }\r\n }\r\n \r\n return ok;\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "07928d60207a08fa09a22f08126a4de3", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Linq;\r\n\r\nnamespace CF1\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n string[] input = Console.ReadLine().Split(' ');\r\n long n = Int64.Parse(input[0]);\r\n long m = Int64.Parse(input[1]);\r\n if(m < 2)\r\n {\r\n Console.WriteLine(n - 1);\r\n }\r\n else\r\n {\r\n Console.WriteLine(n * (m - 1));\r\n }\r\n Console.ReadLine();\r\n }\r\n }\r\n}\r\n\r\n\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c94d19fd76dc11e1e6734166ec9d20a3", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "C# 10", "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 DoesAttack(int x, int y, int a, int b) {\r\n\t\t// does a queen at (x, y) attack (a, b) ?\r\n\t\treturn x == a || y == b || x+y == a+b || x-y == a-b;\r\n\t}\r\n\r\npublic static void Solve()\r\n {\r\n var arr = GetIntArray();\r\n int r = arr[0];\r\n int c = arr[1];\r\n long ans = c == 1 ? r-1 : (long)r * (c-1);\r\n#if DEBUG\r\n Console.Write(\"Answer is --------------> \\n\");\r\n#endif\r\n Console.WriteLine(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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3887fd23123927b27734ab941c852860", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "C# 10", "source_code": "// See https://aka.ms/new-console-template for more information\r\n\r\n(int x, int y) = ReadTwoInts();\r\nConsole.WriteLine(y == 1 ? x - 1 : 1L * x * (y - 1));\r\n\r\n\r\n#region Read\r\nstatic int ReadInt() => int.Parse(Console.ReadLine());\r\nstatic (int x, int y) ReadTwoInts()\r\n{\r\n\tvar ints = ReadInts();\r\n\treturn (ints[0], ints[1]);\r\n}\r\nstatic string ReadString() => Console.ReadLine();\r\nstatic List ReadStrings() => Console.ReadLine().Split(' ').ToList();\r\nstatic List ReadInts()\r\n{\r\n\tList strings = ReadStrings();\r\n\tList ints = new();\r\n\tfor (int i = 0; i < strings.Count; i++)\r\n\t{\r\n\t\tints.Add(int.Parse(strings[i]));\r\n\t}\r\n\treturn ints;\r\n}\r\n#endregion\r\n\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d99e21d6a7cfa9ab23ed694e75109993", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "C# 8", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e1929c709a1179072955a048ab607579", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0} {"lang": "C# 8", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1b9c04484bfab49e226024cd97917712", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0} {"lang": "C# 8", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2af84c028d9764e422321a70f7dde580", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0} {"lang": "C# 8", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d11f2998adc89760644a9b3f04d12a78", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0} {"lang": "Mono C#", "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 m = ReadLong();\n long a = ReadLong();\n long b = ReadLong();\n\n long[] f = Enumerable.Repeat(-1L, (int)a).ToArray();\n f[0] = 0;\n long[] l = new long[a];\n\n var queue = new Queue();\n queue.Enqueue(0);\n while (queue.Count > 0)\n {\n long cur = queue.Dequeue();\n long d = cur + (b - cur + a - 1) / a * a;\n long t = d - b;\n while (t >= 0 && f[t % a] < 0)\n {\n f[t % a] = Math.Max(d, f[cur % a]);\n l[t % a] = t;\n // Writer.WriteLine($\"{t % a} - {f[t % a]} {l[t % a]}\");\n queue.Enqueue(t);\n t -= b;\n }\n }\n\n // WriteArray(f);\n\n long ans = 0;\n for (int i = 0; i < a; i++)\n {\n if (f[i] >= 0 && f[i] <= m)\n {\n long k = Calc(m, l[i], a) - Calc(f[i] - 1, l[i], a);\n // Writer.WriteLine($\"{i} : {k}\");\n ans += k;\n }\n }\n\n Writer.WriteLine(ans);\n }\n\n public static long Calc(long st, long k, long a)\n {\n long full = (st - k + 1) / a;\n long ans = a * full * (full + 1) / 2;\n ans += (st - k + 1) % a * (full + 1);\n return ans;\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e149f4370004eeb56fafd656eda9bed2", "src_uid": "d6290b69eddfcf5f131cc9e612ccab76", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 m = int.Parse(Console.ReadLine());\n int[,] matrix = new int[5, 5];\n for (int i = 0; i < m; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n int k1 = int.Parse(s[0]);\n int k2 = int.Parse(s[1]);\n matrix[k1 - 1, k2 - 1] = 1;\n matrix[k2 - 1, k1 - 1] = 1;\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 for (int k = 0; k < 5; k++)\n {\n if ((k != i) & (k != j) & (i != j) & (matrix[i, k] == 1) & (matrix[j, k] == 1))\n { \n Console.Write(\"WIN\"); return; }\n }\n }\n else\n {\n for (int k = 0; k < 5; k++)\n {\n if ((k != i) & (k != j) & (i!=j) & (matrix[i, k] == 0) & (matrix[j, k] == 0)) { \n Console.Write(\"WIN\"); return; }\n }\n }\n }\n }\n Console.Write(\"FAIL\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5f0719637821b1c67a37f46e1c162b1a", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Friends\n{\n class Program\n {\n static void Main(string[] args)\n {\n int m = int.Parse(Console.ReadLine());\n \n int[] aux = new int[6]; \n \n for(int i = 0 ; i < m ; ++i ) \n {\n string[] ab = Console.ReadLine().Split(' ');\n int a = int.Parse(ab[0]);\n int b = int.Parse(ab[1]);\n\n aux[a]++;\n aux[b]++;\n }\n\n bool f = false;\n\n for(int i = 1 ; i < 6 ; ++i )\n {\n if(aux[i] >= 3 || aux[i] <= 1)\n {\n f = true;\n break;\n }\n }\n\n if(f)\n {\n Console.WriteLine(\"WIN\");\n }\n else\n {\n Console.WriteLine(\"FAIL\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc00a3b11f89f74887f8c37ee67c4c92", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Task2 {\n internal class Program {\n private static int[][] _mat = new int[5][];\n\n private static void Main(string[] args) {\n int m = int.Parse(Console.ReadLine());\n _mat = new int[5][];\n for (int i = 0; i < 5; i++) {\n _mat[i] = new int[5];\n }\n for (int i = 0; i < m; i++) {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int a = int.Parse(ss[0]) - 1;\n int b = int.Parse(ss[1]) - 1;\n _mat[a][b] = 1;\n _mat[b][a] = 1;\n }\n for (int a = 0; a < 5; a++) {\n for (int b = a + 1; b < 5; b++) {\n for (int c = b + 1; c < 5; c++) {\n if (First(a, b, c)) {\n Console.WriteLine(\"WIN\");\n return;\n }\n if (Second(a, b, c)) {\n Console.WriteLine(\"WIN\");\n return;\n }\n }\n }\n }\n Console.WriteLine(\"FAIL\");\n }\n\n private static bool Second(int a, int b, int c) {\n if (_mat[a][b] == 0 && _mat[b][c] == 0 && _mat[c][a] == 0)\n return true;\n return false;\n }\n\n private static bool First(int a, int b, int c) {\n if (_mat[a][b] > 0 && _mat[b][c] > 0 && _mat[c][a] > 0)\n return true;\n return false;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "497f27505c61ab0d5aa7e128c6018355", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "Mono C#", "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(string[] args)\n {\n bool[,] z = new bool[5, 5];\n int n = int.Parse(Console.ReadLine());\n for (int i = 0; i < n; i++)\n {\n string[] ss = Console.ReadLine().Split();\n int a = int.Parse(ss[0]);\n int b = int.Parse(ss[1]);\n a--;b--;\n z[a, b] = true;\n z[b, a] = true;\n }\n for (int a = 0; a < 3; a++)\n {\n for (int b = a + 1; b < 4; b++)\n {\n for (int c = b + 1; c < 5; c++)\n {\n if ((z[a, b] && z[a, c] && z[b, c]) || (!z[a, b] && !z[a, c] && !z[b, c]))\n {\n Console.WriteLine(\"WIN\");\n return;\n }\n }\n }\n }\n Console.WriteLine(\"FAIL\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f54e2a6b4e0aade3a7e9d82368008740", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "MS C#", "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 try\n {\n int m = int.Parse(Console.ReadLine());\n int[] ar = new int[6];\n for (int i = 0; i < m; i++)\n {\n int[] ar2 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n ar[ar2[0]-1]++;\n ar[ar2[1]-1]++;\n }\n int c = 0;\n if (m % 2 == 0)\n c = m / 2;\n else\n c = m / 2 + 1;\n bool q = false;\n for (int i = 0; i < 5; i++)\n {\n if(ar[i]>=c || ar[i]>=3)\n {\n q = true;\n break;\n }\n }\n if(q)\n Console.WriteLine(\"WIN\");\n else\n Console.WriteLine(\"FAIL\");\n Console.ReadKey();\n }\n catch { }\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "10467ccab676a91a9f988ded82569fc8", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 int N = Convert.ToInt16(Console.ReadLine());\n Boolean[,] friends = new Boolean[6, 6]; \n for (int i = 0; i < N; ++i)\n {\n String S = Console.ReadLine();\n String[] A = S.Split(' ');\n int a = Convert.ToInt16(A[0]);\n int b = Convert.ToInt16(A[1]);\n friends[a, b] = true;\n friends[b, a] = true;\n }\n for(int i = 1; i <= 3; ++ i)\n {\n for (int j = i + 1; j <= 4; ++j)\n {\n for (int k = j + 1; k <= 5; ++k)\n {\n if ((friends[i, j] == true && friends[j, k] == true&& friends[k, i])==true || (friends[i, j]==false && friends[j, k]==false && friends[k, i] ==false))\n {\n Console.WriteLine(\"WIN\");\n return;\n }\n }\n }\n }\n Console.WriteLine(\"FAIL\");\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c71e1cc2e072157c6e0b7e032c61b301", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace prog2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n bool[,] map = new bool[5,5];\n for (int i = 0; i < n;i++ )\n {\n string[] ss = Console.ReadLine().Split(' ');\n map[Convert.ToInt32(ss[0])-1, Convert.ToInt32(ss[1])-1] = true;\n map[Convert.ToInt32(ss[1])-1, Convert.ToInt32(ss[0])-1] = true;\n }\n bool flag = false;\n for (int i = 0; i < 5;i++ )\n {\n for (int j=0;j<4;j++)\n if (map[i,j])\n {\n for(int q=j+1;q<5;q++)\n if ((map[i,q]) && (map[q,j]))\n {\n flag = true;\n break;\n }\n if (flag) break;\n }\n if (flag) break;\n }\n if (!flag)\n {\n map[0, 0] = true;\n map[1, 1] = true;\n map[2, 2] = true;\n map[3, 3] = true;\n map[4, 4] = true;\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 4; j++)\n if (!map[i, j])\n {\n for (int q = j + 1; q < 5; q++)\n if ((!map[i, q]) && (!map[q, j]))\n {\n flag = true;\n break;\n }\n if (flag) break;\n }\n if (flag) break;\n } \n }\n if (flag) Console.WriteLine(\"WIN\"); else Console.WriteLine(\"FAIL\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "247e28b5384f1f4181172c8ba8fb2d8b", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "MS C#", "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 try\n {\n int m = int.Parse(Console.ReadLine());\n int[] ar = new int[6];\n for (int i = 0; i < m; i++)\n {\n int[] ar2 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n ar[ar2[0]-1]++;\n ar[ar2[1]-1]++;\n }\n int c = 0;\n if (m % 2 == 0)\n c = m / 2;\n else\n c = m / 2 + 1;\n bool q = false;\n for (int i = 0; i < 5; i++)\n {\n if(ar[i]>=c)\n {\n q = true;\n break;\n }\n }\n if(q)\n Console.WriteLine(\"WIN\");\n else\n Console.WriteLine(\"FAIL\");\n Console.ReadKey();\n }\n catch { }\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b637515d648aefed20532bde90e7695c", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "MS C#", "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 try\n {\n int m = int.Parse(Console.ReadLine());\n int[] ar = new int[6];\n for (int i = 0; i < m; i++)\n {\n int[] ar2 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n ar[ar2[0]-1]++;\n ar[ar2[1]-1]++;\n }\n int c = 0;\n if (m % 2 == 0)\n c = m / 2;\n else\n c = m / 2 + 1;\n bool q = false;\n for (int i = 0; i < 5; i++)\n {\n if(ar[i]>=3)\n {\n q = true;\n break;\n }\n }\n if(q || m ==0)\n Console.WriteLine(\"WIN\");\n else\n Console.WriteLine(\"FAIL\");\n Console.ReadKey();\n }\n catch { }\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b590d5028223aefbaa50906ceb68f1c", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int[] array = new int[11];\n for(int i = 0; i < 11; i++)\n {\n array[i] = int.Parse(Console.ReadLine());\n }\n for(int i = 10; i >= 0; i--)\n {\n double a = Math.Sqrt(Math.Abs(array[i]));\n double b = Math.Pow(array[i], 3) * 5;\n double result = a + b;\n if(result <= 400)\n {\n Console.WriteLine(String.Format(\"f({0}) = {1:0.00}\", array[i], result)); \n }\n else\n {\n Console.WriteLine(String.Format(\"f({0}) = MAGNA NIMIS!\", array[i])); \n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b2c94ee27bf7d1d2b3a4f289a0b6f3f9", "src_uid": "30b3411c3c23d029ea1e9cf73e7d2f01", "difficulty": null} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cd3dd7e96d0e6d115ea94f3ce3e1731a", "src_uid": "87d755df6ee27b381122062659c4a432", "difficulty": 2700.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5c91bdfa3f6a0581014eca3737d2fb75", "src_uid": "87d755df6ee27b381122062659c4a432", "difficulty": 2700.0} {"lang": "Mono C#", "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 // \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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5948943f16d576b1ed7b4ec0b5d6013b", "src_uid": "87d755df6ee27b381122062659c4a432", "difficulty": 2700.0} {"lang": "Mono C#", "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 T CycleGet(this IList self, int index)\n {\n var c = self.Count;\n return self[(index % c + c) % c];\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 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 a = io.NextInt();\n var b = io.NextInt();\n\n var sa = io.NextSeq(a).Select(x => x - 1).ToArray();\n var isb = new int[1000000];\n\n isb.Fill(-1);\n\n var i = 0;\n\n for (; i < b; i++)\n isb[io.NextInt() - 1] = i;\n\n var res = 0;\n\n long[] q = new long[2 * a];\n\n i = 0;\n\n for (var j = 0; j < 2 * a; j++)\n {\n q[j] = isb[sa.CycleGet(j)];\n\n if (q[j] == -1)\n {\n i = j + 1;//just skip and reset i=j for the next cycle so i=j+1 for current\n continue;\n }\n\n\n if (q.CycleGet(j-1) > q[j])\n q[j] += b;\n\n\n while (i <= j && q[j] - q[i] >= b || j - i + 1 > a)\n {\n i++;\n }\n res = Math.Max(res, j - i + 1);\n }\n\n io.PrintLine(res);\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6f4e98e101011ddfde96851e0284925c", "src_uid": "13cd1aafbb1ba76be9ee10eaf8d8aef5", "difficulty": 2000.0} {"lang": "Mono C#", "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 T CycleGet(this IList self, int index)\n {\n var c = self.Count;\n return self[(index % c + c) % c];\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 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 a = io.NextInt();\n var b = io.NextInt();\n\n var sa = io.NextSeq(a).Select(x => x - 1).ToArray();\n var isb = new int[1000000];\n\n isb.Fill(-1);\n\n var i = 0;\n\n for (; i < b; i++)\n isb[io.NextInt() - 1] = i;\n\n var res = 0;\n\n long[] q = new long[2 * a];\n\n i = 0;\n\n for (var j = 0; j < 2 * a; j++)\n {\n q[j] = isb[sa.CycleGet(j)];\n \n if (q[j] == -1)\n {\n i = j + 1;\n continue;\n }\n \n q[j] += ((q.CycleGet(j - 1) - q[j] + b - 1) / b) * b;\n\n\n while (i <= j && q[j] - q[i] >= b || j - i + 1 > a)\n {\n i++;\n }\n res = Math.Max(res, j - i + 1);\n }\n\n io.PrintLine(res);\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ce17bd10dfef4e97914774ca5c58faec", "src_uid": "13cd1aafbb1ba76be9ee10eaf8d8aef5", "difficulty": 2000.0} {"lang": "Mono C#", "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 T CycleGet(this IList self, int index)\n {\n var c = self.Count;\n return self[(index % c + c) % c];\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 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 a = io.NextInt();\n var b = io.NextInt();\n\n var sa = io.NextSeq(a).Select(x => x - 1).ToArray();\n var isb = new int[1000000];\n\n isb.Fill(-1);\n\n var i = 0;\n\n for (; i < b; i++)\n isb[io.NextInt() - 1] = i;\n\n var res = 0;\n\n long[] q = new long[2 * a];\n\n i = 0;\n\n long jp = 0;\n\n for (var j = 0; j < 2 * a; j++)\n {\n q[j] = isb[sa.CycleGet(j)];\n\n if (q[j] != -1)\n {\n\n q[j] += ((jp - q[j] + b - 1) / b) * b;\n\n\n while (i <= j && q[j] - q[i] >= b || j - i + 1 > a)\n {\n i++;\n }\n res = Math.Max(res, j - i + 1);\n }\n else\n {\n i = j + 1;//just skip and reset i=j for the next cycle so i=j+1 for current\n }\n\n jp = q[j];\n }\n\n io.PrintLine(res);\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cb983bc5cdeb75519f461b90d227ff51", "src_uid": "13cd1aafbb1ba76be9ee10eaf8d8aef5", "difficulty": 2000.0} {"lang": "Mono C#", "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 T CycleGet(this IList self, int index)\n {\n var c = self.Count;\n return self[(index % c + c) % c];\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 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 a = io.NextInt();\n var b = io.NextInt();\n\n var sa = io.NextSeq(a).Select(x => x - 1).ToArray();\n var isb = new int[1000000];\n\n isb.Fill(-1);\n\n var i = 0;\n\n for (; i < b; i++)\n isb[io.NextInt() - 1] = i;\n\n var res = 0;\n\n long[] q = new long[2 * a];\n\n i = 0;\n\n for (var j = 0; j < 2 * a; j++)\n {\n q[j] = isb[sa.CycleGet(j)];\n\n if (q[j] == -1)\n {\n i = j + 1;//just skip and reset i=j for the next cycle so i=j+1 for current\n continue;\n }\n\n while(q.CycleGet(j - 1) > q[j])\n q[j] += b;\n\n\n while (i <= j && q[j] - q[i] >= b || j - i + 1 > a)\n {\n i++;\n }\n res = Math.Max(res, j - i + 1);\n }\n\n io.PrintLine(res);\n }\n }\n\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d0438f2847685e5851db8d59c317c7ce", "src_uid": "13cd1aafbb1ba76be9ee10eaf8d8aef5", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Program\n{\n\tint n, m, res;\n\tint mod = 1000000007;\n\tint add(int x, int y)\n\t{\n\t\tx += y;\n\t\treturn x < mod ? x : x - mod;\n\t}\n\tint mul(int x, int y)\n\t{\n\t\treturn Convert.ToInt32(Convert.ToInt64(x) * y % mod);\n\t}\n\n\tint gcd(int x, int y)\n\t{\n\t\treturn y != 0 ? gcd(y, x % y) : x;\n\t}\n\tprivate int[] x = new int[6];\n\tvoid dfs(int i)\n\t{\n\t\tif (i == 6)\n\t\t{\n\t\t\tif ((x[0] * x[3] + x[2] * x[5] + x[4] * x[1] + x[1] * x[2] + x[3] * x[4] + x[5] * x[0]) % 2 == 0)\n\t\t\t{\n\t\t\t\tint now = 1;\n\t\t\t\tfor(int j=0; j<6; j++)\n\t\t\t\t\tif (j % 2 == 0)\n\t\t\t\t\t\tnow = mul(now, x[j] == 1 ? (n + 1) / 2 : n / 2 + 1);\n\t\t\t\t\telse\n\t\t\t\t\t\tnow = mul(now, x[j] == 1 ? (m + 1) / 2 : m / 2 + 1);\n\t\t\t\tres = add(res, now);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tx[i] = 0;\n\t\tdfs(i + 1);\n\t\tx[i] = 1;\n\t\tdfs(i + 1);\n\t}\n\tvoid run()\n\t{\n\t\tString[] str = Console.ReadLine().Split(' ');\n\t\tn = Convert.ToInt32(str[0]);\n\t\tm = Convert.ToInt32(str[1]);\n\t\tres = 0;\n\t\tdfs(0);\n\t\tint res2 = 0;\n\t\tfor (int i = 0; i <= n; i++)\n\t\t\tfor (int j = 0; j <= m; j++)\n\t\t\t\tif (i + j > 0)\n\t\t\t\t{\n\t\t\t\t\tint x = gcd(i, j) - 1;\n\t\t\t\t\tres2 = add(res2, mul(i > 0 && j > 0 ? x * 2 : x, (n + 1 - i) * (m + 1 - j)));\n\t\t\t\t}\n\t\t\t\t\t\n\t\tint q = (n + 1) * (m + 1);\n\t\tres2 = add(res2, Convert.ToInt32(Convert.ToInt64(q) * (q - 1) / 2 % mod));\n\t\tres2 = mul(res2, 6);\n\t\tres2 = add(res2, q);\n\t\tConsole.WriteLine(add(res, mod - res2));\n\t}\n\tstatic void Main(String[] args)\n\t{\n\t\tnew Program().run();\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c955b8f00480b0de598a35ad43002744", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "difficulty": 2500.0} {"lang": "MS C#", "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 string one = \"0469AD\";\n string two = \"8B\";\n string e = long.Parse(Console.ReadLine()).ToString(\"X\");\n\n int count = 0;\n for (int i = 0; i < e.Length; i++)\n {\n if (one.Contains(e[i])) count++;\n else if (two.Contains(e[i])) count += 2;\n }\n Console.WriteLine(count);\n Console.Read();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "05ecdd2abca80a5b2f6c873dfe7d2f0f", "src_uid": "16a784cb9953bc91cb2e7767b04b76f2", "difficulty": 2000.0} {"lang": "Mono C#", "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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "209385b89c8173ea1cd72c023bf28920", "src_uid": "16a784cb9953bc91cb2e7767b04b76f2", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0412\n{\n class B\n {\n static void Main(string[] args)\n {\n string inp1 = Console.ReadLine();\n int n = Int32.Parse(inp1.Split(' ')[0].Trim()); // \u043f\u043e\u0434\u044a\u0435\u0437\u0434\u044b\n int m = Int32.Parse(inp1.Split(' ')[1].Trim()); // \u044d\u0442\u0430\u0436\u0438\n int k = Int32.Parse(inp1.Split(' ')[2].Trim()); // \u043a\u0432\u0430\u0440\u0442\u0438\u0440\u044b \u043d\u0430 \u044d\u0442\u0430\u0436\u0435\n inp1 = Console.ReadLine();\n int a = Int32.Parse(inp1.Split(' ')[0].Trim()) - 1;\n int b = Int32.Parse(inp1.Split(' ')[1].Trim()) - 1;\n int nkm = n * m * k;\n int mk = m * k; // \u043a\u0432\u0430\u0440\u0442\u0438\u0440 \u0432 \u043f\u043e\u0434\u044a\u0435\u0437\u0434\u0435\n int a_n = a / mk;\n int b_n = b / mk;\n int a_m = ( a - a_n * mk ); // \n int b_m = ( b - b_n * mk );\n\n int t = 0;\n\n int ln = Math.Abs( b_n - a_n );\n t += 15 * Math.Min( ln, n - ln );\n if( t == 0 )\n {\n int floors = Math.Abs(a_m / k - b_m / k );\n t += Math.Min(floors * 5, 10 + floors);\n } else\n {\n int floorsa = a_m / k;\n t += Math.Min(floorsa * 5, 10 + floorsa);\n int floorsb = b_m / k;\n t += Math.Min(floorsb * 5, 10 + floorsb);\n }\n\n Console.WriteLine(t.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "17162f20c84f39e36860549164127c70", "src_uid": "c37b46851abcf7eb472869bd1ab9f793", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nclass Program\n{\n static void Main()\n {\n int n1, m1, n2, m2, res;\n string[] h = Console.ReadLine().Split(new char[] { ' ' });\n int n = int.Parse(h[0]);\n int m = int.Parse(h[1]);\n int k = int.Parse(h[2]);\n h = Console.ReadLine().Split(new char[] { ' ' });\n int A1 = int.Parse(h[0]);\n int A2 = int.Parse(h[1]);\n if (A1 % (m * k) == 0)\n {\n n1 = A1 / (m * k);\n }\n else\n {\n n1 = A1 / (m * k) + 1;\n }\n if ((A1 - (n1 - 1) * m * k) % k == 0)\n {\n m1 = (A1 - (n1 - 1) * m * k) / k;\n }\n else\n {\n m1 = (A1 - (n1 - 1) * m * k) / k + 1;\n }\n if (A2 % (m * k) == 0)\n {\n n2 = A2 / (m * k);\n }\n else\n {\n n2 = A2 / (m * k) + 1;\n }\n if ((A2 - (n2 - 1) * m * k) % k == 0)\n {\n m2 = (A2 - (n2 - 1) * m * k) / k;\n }\n else\n {\n m2 = (A2 - (n2 - 1) * m * k) / k + 1;\n }\n if (n1 == n2)\n {\n if (m1 == m2)\n {\n Console.WriteLine(0);\n }\n else\n {\n if (Math.Abs(m1 - m2) >= 3)\n {\n Console.WriteLine(10 + Math.Abs(m1 - m2));\n }\n else\n {\n Console.WriteLine(5 * Math.Abs(m1 - m2));\n }\n }\n }\n else\n {\n if (n1 < n2)\n {\n if (n2 - n1 < n - n2 + n1)\n {\n if (m1 >= 4)\n {\n if (m2 >= 4)\n {\n Console.WriteLine(10 + m1 - 1 + (n2 - n1) * 15 + 10 + m2 - 1);\n }\n else\n {\n Console.WriteLine(10 + m1 - 1 + (n2 - n1) * 15 + 5 * (m2 - 1));\n }\n }\n else\n {\n if (m2 >= 4)\n {\n Console.WriteLine(5 * (m1 - 1) + (n2 - n1) * 15 + 10 + m2 - 1);\n }\n else\n {\n Console.WriteLine(5 * (m1 - 1) + (n2 - n1) * 15 + 5 * (m2 - 1));\n }\n }\n\n }\n else\n {\n if (m1 >= 4)\n {\n if (m2 >= 4)\n {\n Console.WriteLine(10 + m1 - 1 + (n - n2 + n1) * 15 + 10 + m2 - 1);\n }\n else\n {\n Console.WriteLine(10 + m1 - 1 + (n - n2 + n1) * 15 + 5 * (m2 - 1));\n }\n }\n else\n {\n if (m2 >= 4)\n {\n Console.WriteLine(5 * (m1 - 1) + (n - n2 + n1) * 15 + 10 + m2 - 1);\n }\n else\n {\n Console.WriteLine(5 * (m1 - 1) + (n - n2 + n1) * 15 + 5 * (m2 - 1));\n }\n }\n }\n }\n else\n {\n if (n1 - n2 < n - n1 + n2)\n {\n if (m1 >= 4)\n {\n if (m2 >= 4)\n {\n Console.WriteLine(10 + m1 - 1 + (n1 - n2) * 15 + 10 + m2 - 1);\n }\n else\n {\n Console.WriteLine(10 + m1 - 1 + (n1 - n2) * 15 + 5 * (m2 - 1));\n }\n }\n else\n {\n if (m2 >= 4)\n {\n Console.WriteLine(5 * (m1 - 1) + (n1 - n2) * 15 + 10 + m2 - 1);\n }\n else\n {\n Console.WriteLine(5 * (m1 - 1) + (n1 - n2) * 15 + 5 * (m2 - 1));\n }\n }\n }\n else\n {\n if (m1 >= 4)\n {\n if (m2 >= 4)\n {\n Console.WriteLine(10 + m1 - 1 + (n - n1 + n2) * 15 + 10 + m2 - 1);\n }\n else\n {\n Console.WriteLine(10 + m1 - 1 + (n - n1 + n2) * 15 + 5 * (m2 - 1));\n }\n }\n else\n {\n if (m2 >= 4)\n {\n Console.WriteLine(5 * (m1 - 1) + (n - n1 + n2) * 15 + 10 + m2 - 1);\n }\n else\n {\n Console.WriteLine(5 * (m1 - 1) + (n - n1 + n2) * 15 + 5 * (m2 - 1));\n }\n }\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "43a3148cfdcce1f9e106a2d965a97680", "src_uid": "c37b46851abcf7eb472869bd1ab9f793", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace TheTournamentC1\n{\n partial class TheTournamentC1\n {\n static void Main(string[] args)\n {\n int n, k, min;\n int[] points, effort, record, minEffort;\n\n n = NextInt();\n k = NextInt();\n\n points = new int[n];\n effort = new int[n];\n record = new int[n];\n minEffort = new int[2];\n\n for (int i = 0; i < n; i++)\n {\n points[i] = NextInt() + 1;\n effort[i] = NextInt();\n record[i] = 0;\n }\n\n minEffort[0] = Solve(0, k, 1, 0, 0, (int[])points.Clone(), (int[])effort.Clone(), (int[])record.Clone());\n minEffort[1] = Solve(0, k, 0, 0, 0, (int[])points.Clone(), (int[])effort.Clone(), (int[])record.Clone());\n\n min = minEffort.Min();\n min = min == int.MaxValue ? -1 : min;\n\n Console.WriteLine(min);\n }\n\n private static int Solve(int fighter, int k, int win, int currentPoints, int currentEffort, int[] points, int[] effort, int[] record)\n {\n int[] minEffort = new int[2];\n\n if (win == 1)\n {\n currentPoints++;\n currentEffort += effort[fighter];\n points[fighter]--;\n record[fighter] = 1;\n }\n\n fighter++;\n\n if (fighter < points.Length)\n {\n minEffort[0] = Solve(fighter, k, 1, currentPoints, currentEffort, (int[])points.Clone(), (int[])effort.Clone(), (int[])record.Clone());\n minEffort[1] = Solve(fighter, k, 0, currentPoints, currentEffort, (int[])points.Clone(), (int[])effort.Clone(), (int[])record.Clone());\n }\n else\n {\n if (IsWithinKRank((int[])points.Clone(), currentPoints, k, (int[])record.Clone()))\n return currentEffort;\n else\n return int.MaxValue;\n }\n\n return minEffort.Min();\n }\n\n private static bool IsWithinKRank(int[] points, int currentPoints, int k, int[] record)\n {\n int n = points.Length, rank = n + 1;\n int[] fighters = Enumerable.Range(0, n).ToArray();\n\n Array.Sort(points, fighters);\n\n for (int i = 0; i < n; i++)\n {\n if (currentPoints > points[i] || (currentPoints == points[i] && record[fighters[i]] == 1))\n rank--;\n }\n\n return rank <= k;\n }\n }\n\n partial class TheTournamentC1\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "912bb893e08e4e532f77d91d586413c3", "src_uid": "19a098cef100fc3652c59abf7c373814", "difficulty": null} {"lang": "Mono C#", "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;\n sc.Make(out N, out K);\n ModInt.Build(K + 1);\n var F = new ModInt[K + 2];\n for (int i = 1; i < K + 2; i++)\n {\n F[i] = ModInt.Pow(i, K) + F[i - 1];\n }\n if (N <= K + 1) Fail(F[N]);\n WriteLine(LagrangePolynomial(F, N));\n }\n public ModInt LagrangePolynomial(ModInt[] Y,int T,int a=0,int d = 1)\n {\n if (T < Y.Length) return Y[T];\n ModInt[] left = new ModInt[Y.Length], right = new ModInt[Y.Length];\n left[0] = right[Y.Length - 1] = 1;\n for (int i = 0; i < Y.Length-1; i++)\n {\n left[i + 1] = left[i] * (T - a - d * i);\n }\n for (int i = Y.Length - 2; i >= 0; i--)\n {\n right[i] = right[i + 1] * (T - a - d * (i + 1));\n }\n ModInt res = 0;\n for (int i = 0; i < Y.Length; i++)\n {\n ModInt r = Y[i] * left[i] * right[i] * ModInt.FacInv(i) * ModInt.FacInv(Y.Length - i - 1);\n if ((Y.Length - i - 1) % 2 == 0) res += r;\n else res -= r;\n }\n return 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "32ac03ca6a25ca52f09df9d413db57ff", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "MS C#", "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 static readonly int Mod = (int)1e9 + 7;\n\n public void Solve()\n {\n int N = Reader.Int();\n int K = Reader.Int();\n long[] Y = new long[K + 2];\n\n for (int i = 1; i < Y.Length; i++)\n Y[i] = (Y[i - 1] + ModPower(i, K, Mod)) % Mod;\n\n long ans = new LagrangeInterpolation(Y, Mod).Get(N);\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n class LagrangeInterpolation\n {\n readonly int N;\n readonly long M;\n readonly long[] Y, C;\n\n public LagrangeInterpolation(long[] Y, long mod)\n {\n this.N = Y.Length - 1;\n this.M = mod;\n this.Y = Y;\n this.C = new long[N + 1];\n long q = 1;\n for (int i = 1; i <= N; i++)\n q = q * Mod(-i) % mod;\n C[0] = Mod(Y[0] * ModInverse(q, mod));\n for (int i = 1; i <= N; i++)\n {\n q = Mod(q * ModInverse(-N + (i - 1), mod));\n q = Mod(q * i);\n C[i] = Mod(Y[i] * ModInverse(q, mod));\n }\n }\n\n public long Get(long x)\n {\n if (x <= N) return Y[x];\n long fraq = 1;\n for (int i = 0; i <= N; i++)\n fraq = Mod(fraq * (x - i));\n long res = 0;\n for (int i = 0; i <= N; i++)\n {\n res += Mod(Mod(C[i] * fraq) * ModInverse(x - i, M));\n if (res >= M) res -= M;\n }\n return res;\n }\n\n long Mod(long x)\n {\n if (x >= M) return x % M;\n else if (x < 0) return (x % M + M);\n else return x;\n }\n }\n\n static long ModPower(long x, long n, long mod) // x ^ n\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1) res = (res * x) % mod;\n x = (x * x) % mod;\n n >>= 1;\n }\n return res;\n }\n static long ModInverse(long N, long mod)\n {\n long x = 0, y = 0;\n N = (N % mod + mod) % mod;\n ExtGCD(N, mod, ref x, ref y);\n return (x % mod + mod) % mod;\n }\n static long ExtGCD(long a, long b, ref long x, ref long y)\n {\n if (b == 0) { x = 1; y = 0; return a; }\n long res = ExtGCD(b, a % b, ref y, ref x);\n y -= (a / b) * x;\n return res;\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b0d5abee5c8df8ffe9a12b62ad37bc1b", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "Mono C#", "source_code": "#region Usings\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading;\nusing static System.Array;\nusing static System.Math;\n\n// ReSharper disable InconsistentNaming\n#pragma warning disable CS0675\n#endregion\n\npartial class Solution\n{\n\t#region Variables\n\tconst int MOD = 1000000007;\n\tconst int FactCache = 1000;\n\tconst long BIG = long.MaxValue >> 15;\n\n\t#endregion\n\n\tpublic static void Main()\n\t{\n\t\tvar input = new StreamReader(Console.OpenStandardInput());\n\t\tvar output = new StreamWriter(Console.OpenStandardOutput());\n\n\t\tlong[] array = ConvertAll(input.ReadLine().Split(), long.Parse);\n\t\tlong n = array[0];\n\t\tlong k = array[1];\n\n\t\tvar y = new List();\n\t\tlong sum = 0;\n\t\ty.Add(sum);\n\t\tfor (int i = 0; i <= k; i++)\n\t\t{\n\t\t\tsum = (sum + ModPow(i + 1, k));\n\t\t\tif (sum >= MOD) sum -= MOD;\n\t\t\ty.Add(sum);\n\t\t}\n\n\t\tif (n < y.Count)\n\t\t\toutput.WriteLine(y[(int)n]);\n\t\telse\n\t\t\toutput.WriteLine(Lagrange(y, n));\n\t\toutput.Flush();\n\t}\n\n\tstatic long Lagrange(List y, long x)\n\t{\n\t\tlong ans = 0;\n\t\tlong k = 1;\n\t\tfor (int j = 1; j < y.Count; j++)\n\t\t{\n\t\t\tk = (k * (x - j)) % MOD;\n\t\t\tk = MOD - Div(k, j);\n\t\t}\n\n\t\tfor (int i = 0; i < y.Count; i++)\n\t\t{\n\t\t\tans = (ans + y[i] * k) % MOD;\n\t\t\tif (i + 1 >= y.Count) break;\n\t\t\tk = k * Div(x - i, x - (i + 1)) % MOD * Div(i - y.Count + 1, i + 1) % MOD;\n\t\t}\n\n\t\treturn Fix(ans);\n\t}\n\n\n\t#region Library\n\t#region Mod Math\n\n\tstatic int[] _inverse;\n\tstatic long Inverse(long n)\n\t{\n\t\tlong result;\n\n\t\tif (_inverse == null)\n\t\t\t_inverse = new int[1000];\n\n\t\tif (n >= 0 && n < _inverse.Length && (result = _inverse[n]) != 0)\n\t\t\treturn result - 1;\n\n\t\tresult = InverseDirect((int)n);\n\t\tif (n >= 0 && n < _inverse.Length)\n\t\t\t_inverse[n] = (int)(result + 1);\n\t\treturn result;\n\t}\n\n\tpublic static int InverseDirect(int a)\n\t{\n\t\tif (a < 0) return -InverseDirect(-a);\n\t\tint t = 0, r = MOD, t2 = 1, r2 = a;\n\t\twhile (r2 != 0)\n\t\t{\n\t\t\tvar q = r / r2;\n\t\t\tt -= q * t2;\n\t\t\tr -= q * r2;\n\n\t\t\tif (r != 0)\n\t\t\t{\n\t\t\t\tq = r2 / r;\n\t\t\t\tt2 -= q * t;\n\t\t\t\tr2 -= q * r;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr = r2;\n\t\t\t\tt = t2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn r <= 1 ? (t >= 0 ? t : t + MOD) : -1;\n\t}\n\n\tstatic long Mult(long left, long right) =>\n\t\t(left * right) % MOD;\n\n\tstatic long Div(long left, long divisor) =>\n\t\tleft * Inverse(divisor) % MOD;\n\n\tstatic long Add(long x, long y) =>\n\t\t(x += y) >= MOD ? x - MOD : x;\n\n\tstatic long Subtract(long x, long y) => (x -= y) < 0 ? x + MOD : x;\n\n\tstatic long Fix(long n) => (n %= MOD) >= 0 ? n : n + MOD;\n\n\tstatic long ModPow(long n, long p, long mod = MOD)\n\t{\n\t\tlong b = n;\n\t\tlong result = 1;\n\t\twhile (p != 0)\n\t\t{\n\t\t\tif ((p & 1) != 0)\n\t\t\t\tresult = (result * b) % mod;\n\t\t\tp >>= 1;\n\t\t\tb = (b * b) % mod;\n\t\t}\n\t\treturn result;\n\t}\n\n\tstatic List _fact;\n\n\tstatic long Fact(int n)\n\t{\n\t\tif (_fact == null) _fact = new List(FactCache) { 1 };\n\t\tfor (int i = _fact.Count; i <= n; i++)\n\t\t\t_fact.Add(Mult(_fact[i - 1], i));\n\t\treturn _fact[n];\n\t}\n\n\tstatic long[] _ifact = new long[0];\n\tstatic long InverseFact(int n)\n\t{\n\t\tlong result;\n\t\tif (n < _ifact.Length && (result = _ifact[n]) != 0)\n\t\t\treturn result;\n\n\t\tvar inv = Inverse(Fact(n));\n\t\tif (n >= _ifact.Length) Resize(ref _ifact, _fact.Capacity);\n\t\t_ifact[n] = inv;\n\t\treturn inv;\n\t}\n\n\tstatic long Fact(int n, int m)\n\t{\n\t\tvar fact = Fact(n);\n\t\tif (m < n) fact = fact * InverseFact(n - m) % MOD;\n\t\treturn fact;\n\t}\n\n\tstatic long Comb(int n, int k)\n\t{\n\t\tif (k <= 1) return k == 1 ? n : k == 0 ? 1 : 0;\n\t\treturn Mult(Mult(Fact(n), InverseFact(k)), InverseFact(n - k));\n\t}\n\n\tpublic static long Combinations(long n, int k)\n\t{\n\t\tif (k <= 0) return k == 0 ? 1 : 0; // Note: n<0 -> 0 unless k=0\n\t\tif (k + k > n) return Combinations(n, (int)(n - k));\n\n\t\tvar result = InverseFact(k);\n\t\tfor (long i = n - k + 1; i <= n; i++) result = result * i % MOD;\n\t\treturn result;\n\t}\n\t#endregion\n\n\t#region Common\n\n\tpublic static int Gcd(int n, int m)\n\t{\n\t\twhile (true)\n\t\t{\n\t\t\tif (m == 0) return n >= 0 ? n : -n;\n\t\t\tn %= m;\n\t\t\tif (n == 0) return m >= 0 ? m : -m;\n\t\t\tm %= n;\n\t\t}\n\t}\n\n\t#endregion\n\n\t#region Main\n\n\t#endregion\n\t#endregion\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2b69cc631cb8b0a49439b81ea3515dce", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "Mono C#", "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;\n sc.Make(out N, out K);\n var F = new ModInt[K + 2];\n for (int i = 1; i < K + 2; i++)\n {\n F[i] = ModInt.Pow(i, K) + F[i - 1];\n }\n if (N <= K + 1) Fail(F[N]);\n ModInt res=0,f = 1;\n for (var i = 0; i < K + 2; i++) f *= N - i;\n ModInt p = 1;\n for (var i = 1; i < K + 2; i++)\n p *= -i;\n for (int i = 1; i < K + 2; i++)\n {\n p *= i;\n p /= (-(K + 1 - i + 1));\n res += F[i] / p * f / (N - i);\n }\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) == 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[] 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "82a1ad2902f38304ac3206f008b2d9ca", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "Mono C#", "source_code": "#region Usings\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading;\nusing static System.Array;\nusing static System.Math;\n\n// ReSharper disable InconsistentNaming\n#pragma warning disable CS0675\n#endregion\n\npartial class Solution\n{\n\t#region Variables\n\tconst int MOD = 1000000007;\n\tconst int FactCache = 1000;\n\tconst long BIG = long.MaxValue >> 15;\n\n\t#endregion\n\n\tpublic void Solve()\n\t{\n\t\tlong n = Ni();\n\t\tlong k = Ni();\n\n\t\tvar y = new List();\n\t\tlong sum = 0;\n\t\ty.Add(sum);\n\t\tfor (int i = 0; i <= k; i++)\n\t\t{\n\t\t\tsum = (sum + ModPow(i + 1, k));\n\t\t\tif (sum >= MOD) sum -= MOD;\n\t\t\ty.Add(sum);\n\t\t}\n\n\t\tif (n < y.Count)\n\t\t\tWriteLine(y[(int)n]);\n\t\telse\n\t\t\tWriteLine(Lagrange(y, n));\n\t}\n\n\tlong Lagrange(List y, long x)\n\t{\n\t\tlong ans = 0;\n\t\tlong k = 1;\n\t\tfor (int j = 1; j < y.Count; j++)\n\t\t{\n\t\t\tk = (k * (x - j)) % MOD;\n\t\t\tk = MOD - Div(k, j);\n\t\t}\n\n\t\tfor (int i = 0; i < y.Count; i++)\n\t\t{\n\t\t\tans = (ans + y[i] * k) % MOD;\n\t\t\tif (i + 1 >= y.Count) break;\n\t\t\tk = k * Div(x - i, x - (i + 1)) % MOD * Div(i - y.Count + 1, i + 1) % MOD;\n\t\t}\n\n\t\treturn Fix(ans);\n\t}\n\n\n\t#region Library\n\t#region Mod Math\n\n\tstatic int[] _inverse;\n\tstatic long Inverse(long n)\n\t{\n\t\tlong result;\n\n\t\tif (_inverse == null)\n\t\t\t_inverse = new int[1000];\n\n\t\tif (n >= 0 && n < _inverse.Length && (result = _inverse[n]) != 0)\n\t\t\treturn result - 1;\n\n\t\tresult = InverseDirect((int)n);\n\t\tif (n >= 0 && n < _inverse.Length)\n\t\t\t_inverse[n] = (int)(result + 1);\n\t\treturn result;\n\t}\n\n\tpublic static int InverseDirect(int a)\n\t{\n\t\tif (a < 0) return -InverseDirect(-a);\n\t\tint t = 0, r = MOD, t2 = 1, r2 = a;\n\t\twhile (r2 != 0)\n\t\t{\n\t\t\tvar q = r / r2;\n\t\t\tt -= q * t2;\n\t\t\tr -= q * r2;\n\n\t\t\tif (r != 0)\n\t\t\t{\n\t\t\t\tq = r2 / r;\n\t\t\t\tt2 -= q * t;\n\t\t\t\tr2 -= q * r;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr = r2;\n\t\t\t\tt = t2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn r <= 1 ? (t >= 0 ? t : t + MOD) : -1;\n\t}\n\n\tstatic long Mult(long left, long right) =>\n\t\t(left * right) % MOD;\n\n\tstatic long Div(long left, long divisor) =>\n\t\tleft * Inverse(divisor) % MOD;\n\n\tstatic long Add(long x, long y) =>\n\t\t(x += y) >= MOD ? x - MOD : x;\n\n\tstatic long Subtract(long x, long y) => (x -= y) < 0 ? x + MOD : x;\n\n\tstatic long Fix(long n) => (n %= MOD) >= 0 ? n : n + MOD;\n\n\tstatic long ModPow(long n, long p, long mod = MOD)\n\t{\n\t\tlong b = n;\n\t\tlong result = 1;\n\t\twhile (p != 0)\n\t\t{\n\t\t\tif ((p & 1) != 0)\n\t\t\t\tresult = (result * b) % mod;\n\t\t\tp >>= 1;\n\t\t\tb = (b * b) % mod;\n\t\t}\n\t\treturn result;\n\t}\n\n\tstatic List _fact;\n\n\tstatic long Fact(int n)\n\t{\n\t\tif (_fact == null) _fact = new List(FactCache) { 1 };\n\t\tfor (int i = _fact.Count; i <= n; i++)\n\t\t\t_fact.Add(Mult(_fact[i - 1], i));\n\t\treturn _fact[n];\n\t}\n\n\tstatic long[] _ifact = new long[0];\n\tstatic long InverseFact(int n)\n\t{\n\t\tlong result;\n\t\tif (n < _ifact.Length && (result = _ifact[n]) != 0)\n\t\t\treturn result;\n\n\t\tvar inv = Inverse(Fact(n));\n\t\tif (n >= _ifact.Length) Resize(ref _ifact, _fact.Capacity);\n\t\t_ifact[n] = inv;\n\t\treturn inv;\n\t}\n\n\tstatic long Fact(int n, int m)\n\t{\n\t\tvar fact = Fact(n);\n\t\tif (m < n) fact = fact * InverseFact(n - m) % MOD;\n\t\treturn fact;\n\t}\n\n\tstatic long Comb(int n, int k)\n\t{\n\t\tif (k <= 1) return k == 1 ? n : k == 0 ? 1 : 0;\n\t\treturn Mult(Mult(Fact(n), InverseFact(k)), InverseFact(n - k));\n\t}\n\n\tpublic static long Combinations(long n, int k)\n\t{\n\t\tif (k <= 0) return k == 0 ? 1 : 0; // Note: n<0 -> 0 unless k=0\n\t\tif (k + k > n) return Combinations(n, (int)(n - k));\n\n\t\tvar result = InverseFact(k);\n\t\tfor (long i = n - k + 1; i <= n; i++) result = result * i % MOD;\n\t\treturn result;\n\t}\n\t#endregion\n\n\t#region Common\n\n\tpublic static int Gcd(int n, int m)\n\t{\n\t\twhile (true)\n\t\t{\n\t\t\tif (m == 0) return n >= 0 ? n : -n;\n\t\t\tn %= m;\n\t\t\tif (n == 0) return m >= 0 ? m : -m;\n\t\t\tm %= n;\n\t\t}\n\t}\n\n\t#endregion\n\n\t#region Fast IO\n\t#region Input\n\tstatic Stream inputStream;\n\tstatic int inputIndex, bytesRead;\n\tstatic byte[] inputBuffer;\n\tstatic StringBuilder builder;\n\tconst int MonoBufferSize = 4096;\n\tconst char EOL = (char)10, DASH = (char)45, ZERO = (char)48;\n\n\tstatic void InitInput(Stream input = null, int stringCapacity = 16)\n\t{\n\t\tbuilder = new StringBuilder(stringCapacity);\n\t\tinputStream = input ?? Console.OpenStandardInput();\n\t\tinputIndex = bytesRead = 0;\n\t\tinputBuffer = new byte[MonoBufferSize];\n\t}\n\n\tstatic void ReadMore()\n\t{\n\t\tif (bytesRead < 0) throw new FormatException();\n\t\tinputIndex = 0;\n\t\tbytesRead = inputStream.Read(inputBuffer, 0, inputBuffer.Length);\n\t\tif (bytesRead > 0) return;\n\t\tbytesRead = -1;\n\t\tinputBuffer[0] = (byte)EOL;\n\t}\n\n\tstatic int Read()\n\t{\n\t\tif (inputIndex >= bytesRead) ReadMore();\n\t\treturn inputBuffer[inputIndex++];\n\t}\n\n\tstatic T[] Na(int n, Func func, int z = 0)\n\t{\n\t\tn += z;\n\t\tvar list = new T[n];\n\t\tfor (int i = z; i < n; i++) list[i] = func();\n\t\treturn list;\n\t}\n\n\tstatic int[] Ni(int n, int z = 0) => Na(n, Ni, z);\n\n\tstatic long[] Nl(int n, int z = 0) => Na(n, Nl, z);\n\n\tstatic string[] Ns(int n, int z = 0) => Na(n, Ns, z);\n\n\tstatic int Ni() => checked((int)Nl());\n\n\tstatic long Nl()\n\t{\n\t\tvar c = SkipSpaces();\n\t\tbool neg = c == DASH;\n\t\tif (neg) { c = Read(); }\n\n\t\tlong number = c - ZERO;\n\t\twhile (true)\n\t\t{\n\t\t\tvar d = Read() - ZERO;\n\t\t\tif (unchecked((uint)d > 9)) break;\n\t\t\tnumber = number * 10 + d;\n\t\t\tif (number < 0) throw new FormatException();\n\t\t}\n\t\treturn neg ? -number : number;\n\t}\n\n\tstatic char[] Nc(int n)\n\t{\n\t\tvar list = new char[n];\n\t\tfor (int i = 0, c = SkipSpaces(); i < n; i++, c = Read()) list[i] = (char)c;\n\t\treturn list;\n\t}\n\n\tstatic string Ns()\n\t{\n\t\tvar c = SkipSpaces();\n\t\tbuilder.Clear();\n\t\twhile (true)\n\t\t{\n\t\t\tif (unchecked((uint)c - 33 >= (127 - 33))) break;\n\t\t\tbuilder.Append((char)c);\n\t\t\tc = Read();\n\t\t}\n\t\treturn builder.ToString();\n\t}\n\n\tstatic int SkipSpaces()\n\t{\n\t\tint c;\n\t\tdo c = Read(); while (unchecked((uint)c - 33 >= (127 - 33)));\n\t\treturn c;\n\t}\n\n\tstatic List[] NewGraph(int n, int m = 0, int off = 0)\n\t{\n\t\tn += 1 + off;\n\t\tvar g = new List[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tg[i] = new List();\n\n\t\tfor (int i = 0; i < m; i++)\n\t\t{\n\t\t\tint u = Ni() + off, v = Ni() + off;\n\t\t\tg[u].Add(v);\n\t\t\tg[v].Add(u);\n\t\t}\n\n\t\treturn g;\n\t}\n\n\tstatic string ReadLine()\n\t{\n\t\tbuilder.Clear();\n\t\twhile (true)\n\t\t{\n\t\t\tint c = Read();\n\t\t\tif (c < 32) { if (c == 10 || c <= 0) break; continue; }\n\t\t\tbuilder.Append((char)c);\n\t\t}\n\t\treturn builder.ToString();\n\t}\n\t#endregion\n\n\t#region Output\n\tstatic Stream outputStream;\n\tstatic byte[] outputBuffer;\n\tstatic int outputIndex;\n\n\tstatic void InitOutput(Stream output = null)\n\t{\n\t\toutputStream = output ?? Console.OpenStandardOutput();\n\t\toutputIndex = 0;\n\t\toutputBuffer = new byte[65535];\n\t}\n\n\tstatic void WriteLine(object obj = null)\n\t{\n\t\tWrite(obj);\n\t\tWrite(EOL);\n\t}\n\n\tstatic void WriteLine(long number)\n\t{\n\t\tWrite(number);\n\t\tWrite(EOL);\n\t}\n\n\tstatic void Write(long signedNumber)\n\t{\n\t\tulong number = unchecked((ulong)signedNumber);\n\t\tif (signedNumber < 0)\n\t\t{\n\t\t\tWrite(DASH);\n\t\t\tnumber = unchecked((ulong)(-signedNumber));\n\t\t}\n\n\t\tReserve(20 + 1); // 20 digits + 1 extra for sign\n\t\tint left = outputIndex;\n\t\tdo\n\t\t{\n\t\t\toutputBuffer[outputIndex++] = (byte)(ZERO + number % 10);\n\t\t\tnumber /= 10;\n\t\t}\n\t\twhile (number > 0);\n\n\t\tint right = outputIndex - 1;\n\t\twhile (left < right)\n\t\t{\n\t\t\tbyte tmp = outputBuffer[left];\n\t\t\toutputBuffer[left++] = outputBuffer[right];\n\t\t\toutputBuffer[right--] = tmp;\n\t\t}\n\t}\n\n\tstatic void Write(object obj)\n\t{\n\t\tif (obj == null) return;\n\n\t\tvar s = obj.ToString();\n\t\tReserve(s.Length);\n\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\toutputBuffer[outputIndex++] = (byte)s[i];\n\t}\n\n\tstatic void Write(char c)\n\t{\n\t\tReserve(1);\n\t\toutputBuffer[outputIndex++] = (byte)c;\n\t}\n\n\tstatic void Write(byte[] array, int count)\n\t{\n\t\tReserve(count);\n\t\tCopy(array, 0, outputBuffer, outputIndex, count);\n\t\toutputIndex += count;\n\t}\n\n\tstatic void Reserve(int n)\n\t{\n\t\tif (outputIndex + n <= outputBuffer.Length)\n\t\t\treturn;\n\n\t\tDump();\n\t\tif (n > outputBuffer.Length)\n\t\t\tResize(ref outputBuffer, Max(outputBuffer.Length * 2, n));\n\t}\n\n\tstatic void Dump()\n\t{\n\t\toutputStream.Write(outputBuffer, 0, outputIndex);\n\t\toutputIndex = 0;\n\t}\n\n\tstatic void Flush()\n\t{\n\t\tDump();\n\t\toutputStream.Flush();\n\t}\n\n\t#endregion\n\t#endregion\n\n\t#region Main\n\n\tpublic static void Main()\n\t{\n\t\tInitInput(Console.OpenStandardInput());\n\t\tInitOutput(Console.OpenStandardOutput());\n\n\t\tnew Solution().Solve();\n\n\t\tFlush();\n\t\tConsole.Error.WriteLine(Process.GetCurrentProcess().TotalProcessorTime);\n\t}\n\t#endregion\n\t#endregion\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8a843917f5f79373100b277d9763cd18", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "Mono C#", "source_code": "#region Usings\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading;\nusing static System.Array;\nusing static System.Math;\n\n// ReSharper disable InconsistentNaming\n#pragma warning disable CS0675\n#endregion\n\npartial class Solution\n{\n\t#region Variables\n\tconst int MOD = 1000000007;\n\tconst int FactCache = 1000;\n\tconst long BIG = long.MaxValue >> 15;\n\n\t#endregion\n\n\tpublic void Solve()\n\t{\n\t\tint n = Ni();\n\t\tint k = Ni();\n\n\t\tvar y = new List();\n\t\tlong sum = 0;\n\t\ty.Add(sum);\n\t\tfor (int i = 0; i <= k; i++)\n\t\t{\n\t\t\tsum = (sum + ModPow(i + 1, k));\n\t\t\tif (sum >= MOD) sum -= MOD;\n\t\t\ty.Add(sum);\n\t\t}\n\n\t\tif (n < y.Count)\n\t\t\tWriteLine(y[n]);\n\t\telse\n\t\t\tWriteLine(Lagrange(y, n));\n\t}\n\n\tlong Lagrange(List y, long x)\n\t{\n\t\tlong ans = 0;\n\t\tlong k = 1;\n\t\tfor (int j = 1; j < y.Count; j++)\n\t\t{\n\t\t\tk = (k * (x - j)) % MOD;\n\t\t\tk = MOD - Div(k, j);\n\t\t}\n\n\t\tfor (int i = 0; i < y.Count; i++)\n\t\t{\n\t\t\tans = (ans + y[i] * k) % MOD;\n\t\t\tif (i + 1 >= y.Count) break;\n\t\t\tk = k * Div(x - i, x - (i + 1)) % MOD * Div(i - y.Count + 1, i + 1) % MOD;\n\t\t}\n\n\t\treturn Fix(ans);\n\t}\n\n\n\t#region Library\n\t#region Mod Math\n\n\tstatic int[] _inverse;\n\tstatic long Inverse(long n)\n\t{\n\t\tlong result;\n\n\t\tif (_inverse == null)\n\t\t\t_inverse = new int[1000];\n\n\t\tif (n >= 0 && n < _inverse.Length && (result = _inverse[n]) != 0)\n\t\t\treturn result - 1;\n\n\t\tresult = InverseDirect((int)n);\n\t\tif (n >= 0 && n < _inverse.Length)\n\t\t\t_inverse[n] = (int)(result + 1);\n\t\treturn result;\n\t}\n\n\tpublic static int InverseDirect(int a)\n\t{\n\t\tif (a < 0) return -InverseDirect(-a);\n\t\tint t = 0, r = MOD, t2 = 1, r2 = a;\n\t\twhile (r2 != 0)\n\t\t{\n\t\t\tvar q = r / r2;\n\t\t\tt -= q * t2;\n\t\t\tr -= q * r2;\n\n\t\t\tif (r != 0)\n\t\t\t{\n\t\t\t\tq = r2 / r;\n\t\t\t\tt2 -= q * t;\n\t\t\t\tr2 -= q * r;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr = r2;\n\t\t\t\tt = t2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn r <= 1 ? (t >= 0 ? t : t + MOD) : -1;\n\t}\n\n\tstatic long Mult(long left, long right) =>\n\t\t(left * right) % MOD;\n\n\tstatic long Div(long left, long divisor) =>\n\t\tleft * Inverse(divisor) % MOD;\n\n\tstatic long Add(long x, long y) =>\n\t\t(x += y) >= MOD ? x - MOD : x;\n\n\tstatic long Subtract(long x, long y) => (x -= y) < 0 ? x + MOD : x;\n\n\tstatic long Fix(long n) => (n %= MOD) >= 0 ? n : n + MOD;\n\n\tstatic long ModPow(long n, long p, long mod = MOD)\n\t{\n\t\tlong b = n;\n\t\tlong result = 1;\n\t\twhile (p != 0)\n\t\t{\n\t\t\tif ((p & 1) != 0)\n\t\t\t\tresult = (result * b) % mod;\n\t\t\tp >>= 1;\n\t\t\tb = (b * b) % mod;\n\t\t}\n\t\treturn result;\n\t}\n\n\tstatic List _fact;\n\n\tstatic long Fact(int n)\n\t{\n\t\tif (_fact == null) _fact = new List(FactCache) { 1 };\n\t\tfor (int i = _fact.Count; i <= n; i++)\n\t\t\t_fact.Add(Mult(_fact[i - 1], i));\n\t\treturn _fact[n];\n\t}\n\n\tstatic long[] _ifact = new long[0];\n\tstatic long InverseFact(int n)\n\t{\n\t\tlong result;\n\t\tif (n < _ifact.Length && (result = _ifact[n]) != 0)\n\t\t\treturn result;\n\n\t\tvar inv = Inverse(Fact(n));\n\t\tif (n >= _ifact.Length) Resize(ref _ifact, _fact.Capacity);\n\t\t_ifact[n] = inv;\n\t\treturn inv;\n\t}\n\n\tstatic long Fact(int n, int m)\n\t{\n\t\tvar fact = Fact(n);\n\t\tif (m < n) fact = fact * InverseFact(n - m) % MOD;\n\t\treturn fact;\n\t}\n\n\tstatic long Comb(int n, int k)\n\t{\n\t\tif (k <= 1) return k == 1 ? n : k == 0 ? 1 : 0;\n\t\treturn Mult(Mult(Fact(n), InverseFact(k)), InverseFact(n - k));\n\t}\n\n\tpublic static long Combinations(long n, int k)\n\t{\n\t\tif (k <= 0) return k == 0 ? 1 : 0; // Note: n<0 -> 0 unless k=0\n\t\tif (k + k > n) return Combinations(n, (int)(n - k));\n\n\t\tvar result = InverseFact(k);\n\t\tfor (long i = n - k + 1; i <= n; i++) result = result * i % MOD;\n\t\treturn result;\n\t}\n\t#endregion\n\n\t#region Common\n\tpartial void TestData();\n\n\tstatic void Swap(ref T a, ref T b)\n\t{\n\t\tvar tmp = a;\n\t\ta = b;\n\t\tb = tmp;\n\t}\n\n\tstatic int Bound(T[] array, T value, bool upper = false)\n\t\twhere T : IComparable\n\t{\n\t\tint left = 0;\n\t\tint right = array.Length - 1;\n\n\t\twhile (left <= right)\n\t\t{\n\t\t\tint mid = left + (right - left >> 1);\n\t\t\tint cmp = value.CompareTo(array[mid]);\n\t\t\tif (cmp > 0 || cmp == 0 && upper)\n\t\t\t\tleft = mid + 1;\n\t\t\telse\n\t\t\t\tright = mid - 1;\n\t\t}\n\t\treturn left;\n\t}\n\n\tpublic static int Gcd(int n, int m)\n\t{\n\t\twhile (true)\n\t\t{\n\t\t\tif (m == 0) return n >= 0 ? n : -n;\n\t\t\tn %= m;\n\t\t\tif (n == 0) return m >= 0 ? m : -m;\n\t\t\tm %= n;\n\t\t}\n\t}\n\n\t[MethodImpl(MethodImplOptions.AggressiveInlining)]\n\tstatic unsafe int Log2(long value)\n\t{\n\t\tdouble f = unchecked((ulong)value); // +.5 -> -1 for zero\n\t\treturn (((int*)&f)[1] >> 20) - 1023;\n\t}\n\n\t[MethodImpl(MethodImplOptions.AggressiveInlining)]\n\tstatic int BitCount(long y)\n\t{\n\t\tvar x = unchecked((ulong)y);\n\t\tx -= (x >> 1) & 0x5555555555555555;\n\t\tx = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333);\n\t\tx = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f;\n\t\treturn unchecked((int)((x * 0x0101010101010101) >> 56));\n\t}\n\n\t[MethodImpl(MethodImplOptions.AggressiveInlining)]\n\tstatic int HighestOneBit(int n) => n != 0 ? 1 << Log2(n) : 0;\n\t/*static unsafe int HighestOneBit(int x) // sometimes doesn't work\n\t{\n\t\tdouble f = unchecked((uint)x);\n return unchecked(1 << (((int*)&f)[1] >> 20) - 1023 & ~((x - 1 & -x - 1) >> 31));\n\t}*/\n\n\t[MethodImpl(MethodImplOptions.AggressiveInlining)]\n\tstatic unsafe long HighestOneBit(long x)\n\t{\n\t\tdouble f = unchecked((ulong)x);\n\t\treturn unchecked(1L << (((int*)&f)[1] >> 20) - 1023 & ~(x - 1 >> 63 & -x - 1 >> 63));\n\t}\n\t#endregion\n\n\t#region Fast IO\n\t#region Input\n\tstatic Stream inputStream;\n\tstatic int inputIndex, bytesRead;\n\tstatic byte[] inputBuffer;\n\tstatic StringBuilder builder;\n\tconst int MonoBufferSize = 4096;\n\tconst char EOL = (char)10, DASH = (char)45, ZERO = (char)48;\n\n\tstatic void InitInput(Stream input = null, int stringCapacity = 16)\n\t{\n\t\tbuilder = new StringBuilder(stringCapacity);\n\t\tinputStream = input ?? Console.OpenStandardInput();\n\t\tinputIndex = bytesRead = 0;\n\t\tinputBuffer = new byte[MonoBufferSize];\n\t}\n\n\tstatic void ReadMore()\n\t{\n\t\tif (bytesRead < 0) throw new FormatException();\n\t\tinputIndex = 0;\n\t\tbytesRead = inputStream.Read(inputBuffer, 0, inputBuffer.Length);\n\t\tif (bytesRead > 0) return;\n\t\tbytesRead = -1;\n\t\tinputBuffer[0] = (byte)EOL;\n\t}\n\n\tstatic int Read()\n\t{\n\t\tif (inputIndex >= bytesRead) ReadMore();\n\t\treturn inputBuffer[inputIndex++];\n\t}\n\n\tstatic T[] Na(int n, Func func, int z = 0)\n\t{\n\t\tn += z;\n\t\tvar list = new T[n];\n\t\tfor (int i = z; i < n; i++) list[i] = func();\n\t\treturn list;\n\t}\n\n\tstatic int[] Ni(int n, int z = 0) => Na(n, Ni, z);\n\n\tstatic long[] Nl(int n, int z = 0) => Na(n, Nl, z);\n\n\tstatic string[] Ns(int n, int z = 0) => Na(n, Ns, z);\n\n\tstatic int Ni() => checked((int)Nl());\n\n\tstatic long Nl()\n\t{\n\t\tvar c = SkipSpaces();\n\t\tbool neg = c == DASH;\n\t\tif (neg) { c = Read(); }\n\n\t\tlong number = c - ZERO;\n\t\twhile (true)\n\t\t{\n\t\t\tvar d = Read() - ZERO;\n\t\t\tif (unchecked((uint)d > 9)) break;\n\t\t\tnumber = number * 10 + d;\n\t\t\tif (number < 0) throw new FormatException();\n\t\t}\n\t\treturn neg ? -number : number;\n\t}\n\n\tstatic char[] Nc(int n)\n\t{\n\t\tvar list = new char[n];\n\t\tfor (int i = 0, c = SkipSpaces(); i < n; i++, c = Read()) list[i] = (char)c;\n\t\treturn list;\n\t}\n\n\tstatic string Ns()\n\t{\n\t\tvar c = SkipSpaces();\n\t\tbuilder.Clear();\n\t\twhile (true)\n\t\t{\n\t\t\tif (unchecked((uint)c - 33 >= (127 - 33))) break;\n\t\t\tbuilder.Append((char)c);\n\t\t\tc = Read();\n\t\t}\n\t\treturn builder.ToString();\n\t}\n\n\tstatic int SkipSpaces()\n\t{\n\t\tint c;\n\t\tdo c = Read(); while (unchecked((uint)c - 33 >= (127 - 33)));\n\t\treturn c;\n\t}\n\n\tstatic List[] NewGraph(int n, int m = 0, int off = 0)\n\t{\n\t\tn += 1 + off;\n\t\tvar g = new List[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tg[i] = new List();\n\n\t\tfor (int i = 0; i < m; i++)\n\t\t{\n\t\t\tint u = Ni() + off, v = Ni() + off;\n\t\t\tg[u].Add(v);\n\t\t\tg[v].Add(u);\n\t\t}\n\n\t\treturn g;\n\t}\n\n\tstatic string ReadLine()\n\t{\n\t\tbuilder.Clear();\n\t\twhile (true)\n\t\t{\n\t\t\tint c = Read();\n\t\t\tif (c < 32) { if (c == 10 || c <= 0) break; continue; }\n\t\t\tbuilder.Append((char)c);\n\t\t}\n\t\treturn builder.ToString();\n\t}\n\t#endregion\n\n\t#region Output\n\tstatic Stream outputStream;\n\tstatic byte[] outputBuffer;\n\tstatic int outputIndex;\n\n\tstatic void InitOutput(Stream output = null)\n\t{\n\t\toutputStream = output ?? Console.OpenStandardOutput();\n\t\toutputIndex = 0;\n\t\toutputBuffer = new byte[65535];\n\t}\n\n\tstatic void WriteLine(object obj = null)\n\t{\n\t\tWrite(obj);\n\t\tWrite(EOL);\n\t}\n\n\tstatic void WriteLine(long number)\n\t{\n\t\tWrite(number);\n\t\tWrite(EOL);\n\t}\n\n\tstatic void Write(long signedNumber)\n\t{\n\t\tulong number = unchecked((ulong)signedNumber);\n\t\tif (signedNumber < 0)\n\t\t{\n\t\t\tWrite(DASH);\n\t\t\tnumber = unchecked((ulong)(-signedNumber));\n\t\t}\n\n\t\tReserve(20 + 1); // 20 digits + 1 extra for sign\n\t\tint left = outputIndex;\n\t\tdo\n\t\t{\n\t\t\toutputBuffer[outputIndex++] = (byte)(ZERO + number % 10);\n\t\t\tnumber /= 10;\n\t\t}\n\t\twhile (number > 0);\n\n\t\tint right = outputIndex - 1;\n\t\twhile (left < right)\n\t\t{\n\t\t\tbyte tmp = outputBuffer[left];\n\t\t\toutputBuffer[left++] = outputBuffer[right];\n\t\t\toutputBuffer[right--] = tmp;\n\t\t}\n\t}\n\n\tstatic void Write(object obj)\n\t{\n\t\tif (obj == null) return;\n\n\t\tvar s = obj.ToString();\n\t\tReserve(s.Length);\n\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\toutputBuffer[outputIndex++] = (byte)s[i];\n\t}\n\n\tstatic void Write(char c)\n\t{\n\t\tReserve(1);\n\t\toutputBuffer[outputIndex++] = (byte)c;\n\t}\n\n\tstatic void Write(byte[] array, int count)\n\t{\n\t\tReserve(count);\n\t\tCopy(array, 0, outputBuffer, outputIndex, count);\n\t\toutputIndex += count;\n\t}\n\n\tstatic void Reserve(int n)\n\t{\n\t\tif (outputIndex + n <= outputBuffer.Length)\n\t\t\treturn;\n\n\t\tDump();\n\t\tif (n > outputBuffer.Length)\n\t\t\tResize(ref outputBuffer, Max(outputBuffer.Length * 2, n));\n\t}\n\n\tstatic void Dump()\n\t{\n\t\toutputStream.Write(outputBuffer, 0, outputIndex);\n\t\toutputIndex = 0;\n\t}\n\n\tstatic void Flush()\n\t{\n\t\tDump();\n\t\toutputStream.Flush();\n\t}\n\n\t#endregion\n\t#endregion\n\n\t#region Main\n\n\tpublic static void Main()\n\t{\n\t\tAppDomain.CurrentDomain.UnhandledException += (sender, arg) =>\n\t\t{\n\t\t\tFlush();\n\t\t\tvar e = (Exception)arg.ExceptionObject;\n\t\t\tConsole.Error.WriteLine(e);\n\t\t\tvar line = new StackTrace(e, true).GetFrames()\n\t\t\t\t.Select(x => x.GetFileLineNumber()).FirstOrDefault(x => x != 0);\n\t\t\tvar wait = line % 300 * 10 + 5;\n\t\t\tvar process = Process.GetCurrentProcess();\n\t\t\twhile (process.TotalProcessorTime.TotalMilliseconds > wait && wait < 3000) wait += 1000;\n\t\t\twhile (process.TotalProcessorTime.TotalMilliseconds < Min(wait, 3000)) ;\n\t\t\tEnvironment.Exit(1);\n\t\t};\n\n\t\tInitInput(Console.OpenStandardInput());\n\t\tInitOutput(Console.OpenStandardOutput());\n#if __MonoCS__ && !C7\n var thread = new System.Threading.Thread(()=>new Solution().Solve());\n var f = BindingFlags.NonPublic | BindingFlags.Instance;\n var t = thread.GetType().GetField(\"internal_thread\", f).GetValue(thread);\n t.GetType().GetField(\"stack_size\", f).SetValue(t, 32 * 1024 * 1024);\n thread.Start();\n thread.Join();\n#else\n\t\tnew Solution().Solve();\n#endif\n\t\tFlush();\n\t\tConsole.Error.WriteLine(Process.GetCurrentProcess().TotalProcessorTime);\n\t}\n\t#endregion\n\t#endregion\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "02ab06d3105c05ffd0c4214e017a7375", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.IO;\n\nnamespace codeforces\n{\n class Program\n {\n class Flow\n {\n public int to;\n public int capacity;\n public int flow;\n public int cost;\n public int iRevEdge;\n\n public Flow(int to, int capacity, int flow, int cost, int iRevEdge)\n {\n this.to = to;\n this.capacity = capacity;\n this.flow = flow;\n this.cost = cost;\n this.iRevEdge = iRevEdge;\n }\n }\n\n class CompareVertex : IComparer\n {\n public int Compare(int x, int y)\n {\n int v = d[x].CompareTo(d[y]);\n return v != 0 ? v : x.CompareTo(y);\n }\n }\n\n const int N = 80;\n\n static int[] di = new int[4] { 0, 0, -1, 1 };\n static int[] dj = new int[4] { -1, 1, 0, 0 };\n\n static int n, m;\n static int[,] a = new int[N, N];\n\n static int[] d = new int[N * N + 2];\n static int[] phi = new int[N * N + 2];\n static int[] parent = new int[N * N + 2];\n static int[] numEdge = new int[N * N + 2];\n static List[] G = new List[N * N + 2];\n static SortedSet sVertex = new SortedSet(new CompareVertex());\n static int minCost = 0;\n\n static void AddEdge(int from, int to, int cap, int cost)\n {\n G[from].Add(new Flow(to, cap, 0, cost, G[to].Count));\n G[to].Add(new Flow(from, 0, 0, -cost, G[from].Count - 1));\n }\n\n static bool FindPath(int from, int to)\n {\n for (int i = 0; i <= to; ++i)\n {\n d[i] = int.MaxValue;\n }\n int v;\n sVertex.Clear();\n d[from] = 0;\n sVertex.Add(from);\n while (sVertex.Count > 0)\n {\n v = sVertex.Min;\n sVertex.Remove(v);\n\n for (int i = 0; i < G[v].Count; ++i)\n {\n var f = G[v][i];\n if (f.flow < f.capacity && d[f.to] > d[v] + f.cost - phi[v] + phi[f.to])\n {\n if (sVertex.Contains(f.to))\n {\n sVertex.Remove(f.to);\n }\n d[f.to] = d[v] + f.cost - phi[v] + phi[f.to];\n sVertex.Add(f.to);\n parent[f.to] = v;\n numEdge[f.to] = i;\n }\n }\n }\n\n if (d[to] == int.MaxValue)\n {\n return false;\n }\n for (int i = 0; i <= to; ++i)\n {\n if (d[i] != int.MaxValue)\n {\n phi[i] += d[i]; \n }\n }\n v = to;\n int flow = int.MaxValue;\n while (v != from)\n {\n int u = parent[v];\n flow = Math.Min(flow, G[u][numEdge[v]].capacity - G[u][numEdge[v]].flow);\n v = u;\n }\n\n v = to;\n while(v != from)\n {\n int u = parent[v];\n G[u][numEdge[v]].flow += flow;\n G[v][G[u][numEdge[v]].iRevEdge].flow -= flow;\n minCost += flow * G[u][numEdge[v]].cost;\n v = u;\n }\n return true;\n\n }\n \n\n static void Main(string[] args)\n {\n var t = Console.ReadLine().Split(' ');\n n = int.Parse(t[0]);\n m = int.Parse(t[1]);\n for (int i = 0; i < n; ++i)\n {\n t = Console.ReadLine().Split(' ');\n for (int j = 0; j < m; ++j)\n {\n a[i, j] = int.Parse(t[j]);\n }\n }\n int from = n * m;\n int to = n * m + 1;\n for (int i = 0; i <= to; ++i)\n {\n phi[i] = 0;\n G[i] = new List();\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < m; ++j)\n {\n if ((i + j) % 2 == 0)\n {\n AddEdge(from, i * m + j, 1, 0);\n for (int k = 0; k < 4; ++k)\n {\n int ei = i + di[k];\n int ej = j + dj[k];\n if (ei >= 0 && ei < n && ej >= 0 && ej < m)\n {\n AddEdge(i * m + j, ei * m + ej, 1, a[i, j] == a[ei, ej] ? 0 : 1);\n }\n }\n }\n else\n {\n AddEdge(i * m + j, to, 1, 0);\n }\n\n }\n }\n\n while (FindPath(from, to)) { }\n\n Console.WriteLine(minCost);\n\n Console.Read();\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "039d395077b73f1cd027125643713e98", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "difficulty": 2200.0} {"lang": "Mono C#", "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 H = int.Parse(str[0]);\n int W = int.Parse(str[1]);\n int[,] D = new int[H,W];\n for(int i=0;i F = new List();\n List T = new List();\n List capacity = new List();\n List cost = new List();\n for(int i=0;i edges;\n public void AddEdge(Edge e){\n edges.Add(e);\n }\n public Vertex(){\n edges = new List();\n finished = false;\n cost = -1;\n }\n}\nstruct Data{\n public Vertex v;\n public long cost;\n public Data(Vertex v0,long c){\n v = v0;\n cost = c;\n }\n}\nclass MinCostFlow{\n Vertex[] point;\n Vertex S;\n Vertex G;\n public long res;\n int E;\n const long INF = 1000000000000000;\n public MinCostFlow(int[] f,int[] t,long[] capacity,long[] cost,int n,int s,int g,long flow){\n point = new Vertex[n];\n for(int i=0;i V.cost + V.edges[i].cost + V.h - T.h){\n T.cost = V.cost + V.edges[i].cost + V.h - T.h;\n T.fromv = V;\n T.frome = V.edges[i];\n H.push(new Data(T,T.cost));\n }\n }\n }\n if(G.cost == -1){\n res = -1;\n break;\n }\n for(int i=0;i 0){\n int p = (i - 1)/2;\n if(obj[p].cost <= a.cost){\n obj[i] = a;\n break;\n }\n obj[i] = obj[p];\n i = p;\n }\n if(i == 0){\n obj[0] = a;\n }\n }\n public bool Empty(){\n return size == 0;\n }\n public Data pop(){\n Data t = obj[0];\n int i = 0;\n size--;\n while(2*i+1 < size){\n int p = 2*i+1;\n if(p+1 < size && obj[p+1].cost < obj[p].cost){\n p++;\n }\n if(obj[p].cost < obj[size].cost){\n obj[i] = obj[p];\n i = p;\n }\n else{\n obj[i] = obj[size];\n break;\n }\n }\n if(2*i+1 >= size){\n obj[i] = obj[size];\n }\n return t;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "738304b05ece72677a281bb98b4f9ebe", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "difficulty": 2200.0} {"lang": "MS C#", "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 class Edge\n {\n public int To, Inv;\n public T Capacity, Cost, Flow;\n public Edge(int to, int inv, T capacity, T cost, T flow)\n {\n To = to;\n Inv = inv;\n Capacity = capacity;\n Cost = cost;\n Flow = flow;\n }\n }\n\n static void AddEdge(List>[] g, int from, int to, int capacity, int cost)\n {\n g[from].Add(new Edge(to, g[to].Count, capacity, cost, 0));\n g[to].Add(new Edge(from, g[from].Count - 1, 0, -cost, 0));\n }\n\n int MinCost(List>[] g, int source, int sink, int limit)\n {\n const int INF = int.MaxValue / 2;\n\n int n = g.Length;\n int flow = 0, cost = 0;\n while (flow < limit)\n {\n var id = new int[n];\n var dist = Enumerable.Repeat(INF, n).ToArray();\n var q = new int[n];\n var path = new int[n];\n var epath = new int[n];\n int qh = 0, qt = 0;\n q[qt++] = source;\n dist[source] = 0;\n while (qh != qt)\n {\n int v = q[qh++];\n if (qh == n)\n qh = 0;\n id[v] = 2;\n for (int i = 0; i < g[v].Count; i++)\n {\n var r = g[v][i];\n if (r.Flow < r.Capacity && dist[v] + r.Cost < dist[r.To])\n {\n dist[r.To] = dist[v] + r.Cost;\n if (id[r.To] == 0)\n {\n q[qt++] = r.To;\n if (qt == n)\n qt = 0;\n }\n else if (id[r.To] == 2)\n {\n if (--qh == -1)\n qh = n - 1;\n q[qh] = r.To;\n }\n id[r.To] = 1;\n path[r.To] = v;\n epath[r.To] = i;\n }\n }\n }\n if (dist[sink] == INF)\n break;\n int addflow = limit - flow;\n for (int v = sink; v != source; v = path[v])\n {\n int pv = path[v];\n int pr = epath[v];\n addflow = Math.Min(addflow, g[pv][pr].Capacity - g[pv][pr].Flow);\n }\n for (int v = sink; v != source; v = path[v])\n {\n int pv = path[v];\n int pr = epath[v], r = g[pv][pr].Inv;\n g[pv][pr].Flow += addflow;\n g[v][r].Flow -= addflow;\n cost += g[pv][pr].Cost * addflow;\n }\n flow += addflow;\n }\n return cost;\n }\n\n private int[] dr = {1, 0, -1, 0};\n private int[] dc = {0, 1, 0, -1};\n\n public void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n var a = ReadIntMatrix(n);\n\n var g = Enumerable.Repeat(0, n * m + 2).Select(x => new List>()).ToArray();\n for (int i = 0; i < n; i++)\n for (int j = 0; j < m; j++)\n {\n int x = i * m + j;\n if ((i + j) % 2 == 0)\n {\n AddEdge(g, n * m, x, 1, 0);\n for (int k = 0; k < 4; k++)\n {\n int ii = i + dr[k];\n int jj = j + dc[k];\n if (ii < 0 || ii == n || jj < 0 || jj == m)\n continue;\n AddEdge(g, x, ii * m + jj, 1, a[i][j] == a[ii][jj] ? 0 : 1);\n }\n }\n else\n {\n AddEdge(g, x, n * m + 1, 1, 0);\n }\n }\n\n Write(MinCost(g, n * m, n * m + 1, n * m / 2));\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 //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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d3d3622856eeb371083fe7d7a769297f", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "difficulty": 2200.0} {"lang": "Mono C#", "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 h = cin.nextInt();\n int w = cin.nextInt();\n int[,] board = new int[h, w];\n for (int i = 0; i < h; i++)\n {\n for (int j = 0; j < w; j++)\n {\n board[i, j] = cin.nextInt();\n }\n }\n\n int MAX = 1 << w;\n int[] dp = new int[MAX];\n for (int i = 0; i < MAX; i++)\n {\n dp[i] = 1 << 16;\n }\n dp[0] = 0;\n\n for (int i = 0; i < h; i++)\n {\n for (int j = 0; j < w; j++)\n {\n int[] nextdp = new int[MAX];\n for (int k = 0; k < MAX; k++)\n {\n nextdp[k] = 1 << 16;\n }\n\n for (int k = 0; k < MAX; k++)\n {\n if (k % 2 == 0)\n {\n if (j != w - 1)\n {\n int add = 0;\n if (board[i, j] != board[i, j + 1]) add = 1;\n int next = k / 2 + 1;\n nextdp[next] = Math.Min(nextdp[next], dp[k] + add);\n }\n if (i != h - 1)\n {\n int add = 0;\n if (board[i, j] != board[i + 1, j]) add = 1;\n int next = k / 2 + (1 << (w - 1));\n nextdp[next] = Math.Min(nextdp[next], dp[k] + add);\n }\n }\n else\n {\n nextdp[k / 2] = Math.Min(nextdp[k / 2], dp[k]);\n }\n }\n dp = nextdp;\n }\n }\n Console.WriteLine(dp[0]);\n\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cfc624fb1475ac87493e4363bbf37394", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 \n \n void solve()\n {\n long l = nextInt();\n long r = nextInt();\n long p = 1;\n long res = 0;\n while (p < 1000000000000L)\n {\n p *= 10;\n long c = p - 1;\n long num;\n if (c / 2 > r)\n num = r;\n else if (c / 2 < l)\n num = l;\n else\n num = c / 2;\n if (num >= p / 10 && num < p)\n res = Math.Max(res, num * (c - num));\n }\n println(res);\n \n\n }\n long get(int x)\n {\n long y = 0;\n long p = 1;\n long temp = x;\n while (x > 0)\n {\n y += p * (9 - x % 10);\n x /= 10;\n p *= 10;\n }\n return temp * y;\n }\n \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 int nextInt()\n {\n return int.Parse(nextString());\n }\n long nextLong()\n {\n return long.Parse(nextString());\n }\n double nextDouble()\n {\n return double.Parse(nextString());\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2cdf60430a9e4f4d951e5ba96aa343d6", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n /*\n long max = 0;\n for (int i = 0; ; i++)\n {\n long a = _search(i, i);\n if (a > max)\n {\n Debug.WriteLine(i + \"\\t\" + a+\"\\tmax\");\n max = a;\n }\n else\n Debug.WriteLine(i + \"\\t\" + a);\n\n }\n */\n\n var ss = CF.ReadLine().Split(' ');\n int l = int.Parse(ss[0]);\n int r = int.Parse(ss[1]);\n\n int d = _d(r);\n long dmax = 0;\n {\n for (int i = 0; i < d ; i++)\n {\n dmax *= 10;\n if( i==0)\n dmax += 4;\n else\n dmax += 9;\n }\n }\n\n int n;\n if (r < dmax)\n n = r;\n else if (l > dmax)\n n = l;\n else\n n = (int)dmax;\n\n CF.WriteLine(_search(n, n));\n }\n\n int _d(int n)\n {\n int d = 0;\n {\n int tmp = n;\n for (; ; )\n {\n if (tmp == 0)\n break;\n d += 1;\n tmp /= 10;\n }\n }\n return d;\n }\n\n long _search(int l,int r)\n {\n long max = 0;\n for (int i = l; i <= r; i++)\n {\n int tmp = i;\n Stack ds = new Stack();\n for (; ; )\n {\n if (tmp == 0)\n break;\n ds.Push(tmp % 10);\n tmp/= 10;\n }\n\n long o=0;\n foreach (var d in ds)\n {\n o *= 10;\n o += (9-d);\n }\n\n long p = (long)o * i;\n max = Math.Max(p, max);\n }\n return max;\n }\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n1 1000000000\n\",\n\n@\"\n1 999\n\",\n\n@\"\n500000000 999999999\n\",\n@\"\n3 7\n\",\n @\"\n1 1\n\",\n @\"\n8 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "602fda10b089e0642c77cd7e9cc185af", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace yandex2011_round_2_reflection {\n internal class Program {\n private static void Main(string[] args) {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int l = int.Parse(ss[0]);\n int r = int.Parse(ss[1]);\n Int64 bigger = GetBigger(r);\n Int64 aBest = bigger/2 - 1;\n Int64 bBest = bigger/2;\n if (l <= aBest && r >= bBest) {\n Console.WriteLine(aBest * bBest);\n return;\n }\n if (l > aBest) {\n aBest = l;\n bBest = l;\n }\n if (r < bBest) {\n bBest = r;\n aBest = r;\n }\n Int64 aBestBack = GetBack(aBest);\n Int64 bBestBack = GetBack(bBest);\n if (aBest * aBestBack > bBest * bBestBack) {\n Console.WriteLine(aBest * aBestBack);\n } else {\n Console.WriteLine(bBest * bBestBack);\n }\n }\n\n private static Int64 GetBack(Int64 a) {\n var digits = new List();\n if (a == 0) digits.Add(0);\n while (a > 0) {\n digits.Add((int) (a%10));\n a = a/10;\n }\n Int64 back = 0;\n for (int i = digits.Count - 1; i >= 0; i--) {\n back = back*10 + 9 - digits[i];\n }\n return back;\n }\n\n private static Int64 GetBigger(int a) {\n var digits = new List();\n if (a == 0) digits.Add(0);\n while (a > 0) {\n digits.Add(a%10);\n a = a/10;\n }\n Int64 bigger = 1;\n for (int i = digits.Count - 1; i >= 0; i--) {\n bigger *= 10;\n }\n return bigger;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8eee0c65421374d73d08829ad3bff1d0", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 long[] a = new long[] { 249999500000, 15999992000000, 20999993000000, 23999994000000, 24999995000000, 24999995000000, 23999994000000, 20999993000000, 15999992000000, 8999991000000, 978999911000000, 1055999912000000, 1130999913000000, 1203999914000000, 1274999915000000, 1343999916000000, 1410999917000000, 1475999918000000, 1538999919000000, 1599999920000000, 1658999921000000, 1715999922000000, 1770999923000000, 1823999924000000, 1874999925000000, 1923999926000000, 1970999927000000, 2015999928000000, 2058999929000000, 2099999930000000, 2138999931000000, 2175999932000000, 2210999933000000, 2243999934000000, 2274999935000000, 2303999936000000, 2330999937000000, 2355999938000000, 2378999939000000, 2399999940000000, 2418999941000000, 2435999942000000, 2450999943000000, 2463999944000000, 2474999945000000, 2483999946000000, 2490999947000000, 2495999948000000, 2498999949000000, 2499999950000000, 2499999950000000, 2498999949000000, 2495999948000000, 2490999947000000, 2483999946000000, 2474999945000000, 2463999944000000, 2450999943000000, 2435999942000000, 2418999941000000, 2399999940000000, 2378999939000000, 2355999938000000, 2330999937000000, 2303999936000000, 2274999935000000, 2243999934000000, 2210999933000000, 2175999932000000, 2138999931000000, 2099999930000000, 2058999929000000, 2015999928000000, 1970999927000000, 1923999926000000, 1874999925000000, 1823999924000000, 1770999923000000, 1715999922000000, 1658999921000000, 1599999920000000, 1538999919000000, 1475999918000000, 1410999917000000, 1343999916000000, 1274999915000000, 1203999914000000, 1130999913000000, 1055999912000000, 978999911000000, 899999910000000, 818999909000000, 735999908000000, 650999907000000, 563999906000000, 474999905000000, 383999904000000, 290999903000000, 195999902000000, 98999901000000, 90798999101000000, 91595999102000000, 92390999103000000, 93183999104000000, 93974999105000000, 94763999106000000, 95550999107000000, 96335999108000000, 97118999109000000, 97899999110000000, 98678999111000000, 99455999112000000, 100230999113000000, 101003999114000000, 101774999115000000, 102543999116000000, 103310999117000000, 104075999118000000, 104838999119000000, 105599999120000000, 106358999121000000, 107115999122000000, 107870999123000000, 108623999124000000, 109374999125000000, 110123999126000000, 110870999127000000, 111615999128000000, 112358999129000000, 113099999130000000, 113838999131000000, 114575999132000000, 115310999133000000, 116043999134000000, 116774999135000000, 117503999136000000, 118230999137000000, 118955999138000000, 119678999139000000, 120399999140000000, 121118999141000000, 121835999142000000, 122550999143000000, 123263999144000000, 123974999145000000, 124683999146000000, 125390999147000000, 126095999148000000, 126798999149000000, 127499999150000000, 128198999151000000, 128895999152000000, 129590999153000000, 130283999154000000, 130974999155000000, 131663999156000000, 132350999157000000, 133035999158000000, 133718999159000000, 134399999160000000, 135078999161000000, 135755999162000000, 136430999163000000, 137103999164000000, 137774999165000000, 138443999166000000, 139110999167000000, 139775999168000000, 140438999169000000, 141099999170000000, 141758999171000000, 142415999172000000, 143070999173000000, 143723999174000000, 144374999175000000, 145023999176000000, 145670999177000000, 146315999178000000, 146958999179000000, 147599999180000000, 148238999181000000, 148875999182000000, 149510999183000000, 150143999184000000, 150774999185000000, 151403999186000000, 152030999187000000, 152655999188000000, 153278999189000000, 153899999190000000, 154518999191000000, 155135999192000000, 155750999193000000, 156363999194000000, 156974999195000000, 157583999196000000, 158190999197000000, 158795999198000000, 159398999199000000, 159999999200000000, 160598999201000000, 161195999202000000, 161790999203000000, 162383999204000000, 162974999205000000, 163563999206000000, 164150999207000000, 164735999208000000, 165318999209000000, 165899999210000000, 166478999211000000, 167055999212000000, 167630999213000000, 168203999214000000, 168774999215000000, 169343999216000000, 169910999217000000, 170475999218000000, 171038999219000000, 171599999220000000, 172158999221000000, 172715999222000000, 173270999223000000, 173823999224000000, 174374999225000000, 174923999226000000, 175470999227000000, 176015999228000000, 176558999229000000, 177099999230000000, 177638999231000000, 178175999232000000, 178710999233000000, 179243999234000000, 179774999235000000, 180303999236000000, 180830999237000000, 181355999238000000, 181878999239000000, 182399999240000000, 182918999241000000, 183435999242000000, 183950999243000000, 184463999244000000, 184974999245000000, 185483999246000000, 185990999247000000, 186495999248000000, 186998999249000000, 187499999250000000, 187998999251000000, 188495999252000000, 188990999253000000, 189483999254000000, 189974999255000000, 190463999256000000, 190950999257000000, 191435999258000000, 191918999259000000, 192399999260000000, 192878999261000000, 193355999262000000, 193830999263000000, 194303999264000000, 194774999265000000, 195243999266000000, 195710999267000000, 196175999268000000, 196638999269000000, 197099999270000000, 197558999271000000, 198015999272000000, 198470999273000000, 198923999274000000, 199374999275000000, 199823999276000000, 200270999277000000, 200715999278000000, 201158999279000000, 201599999280000000, 202038999281000000, 202475999282000000, 202910999283000000, 203343999284000000, 203774999285000000, 204203999286000000, 204630999287000000, 205055999288000000, 205478999289000000, 205899999290000000, 206318999291000000, 206735999292000000, 207150999293000000, 207563999294000000, 207974999295000000, 208383999296000000, 208790999297000000, 209195999298000000, 209598999299000000, 209999999300000000, 210398999301000000, 210795999302000000, 211190999303000000, 211583999304000000, 211974999305000000, 212363999306000000, 212750999307000000, 213135999308000000, 213518999309000000, 213899999310000000, 214278999311000000, 214655999312000000, 215030999313000000, 215403999314000000, 215774999315000000, 216143999316000000, 216510999317000000, 216875999318000000, 217238999319000000, 217599999320000000, 217958999321000000, 218315999322000000, 218670999323000000, 219023999324000000, 219374999325000000, 219723999326000000, 220070999327000000, 220415999328000000, 220758999329000000, 221099999330000000, 221438999331000000, 221775999332000000, 222110999333000000, 222443999334000000, 222774999335000000, 223103999336000000, 223430999337000000, 223755999338000000, 224078999339000000, 224399999340000000, 224718999341000000, 225035999342000000, 225350999343000000, 225663999344000000, 225974999345000000, 226283999346000000, 226590999347000000, 226895999348000000, 227198999349000000, 227499999350000000, 227798999351000000, 228095999352000000, 228390999353000000, 228683999354000000, 228974999355000000, 229263999356000000, 229550999357000000, 229835999358000000, 230118999359000000, 230399999360000000, 230678999361000000, 230955999362000000, 231230999363000000, 231503999364000000, 231774999365000000, 232043999366000000, 232310999367000000, 232575999368000000, 232838999369000000, 233099999370000000, 233358999371000000, 233615999372000000, 233870999373000000, 234123999374000000, 234374999375000000, 234623999376000000, 234870999377000000, 235115999378000000, 235358999379000000, 235599999380000000, 235838999381000000, 236075999382000000, 236310999383000000, 236543999384000000, 236774999385000000, 237003999386000000, 237230999387000000, 237455999388000000, 237678999389000000, 237899999390000000, 238118999391000000, 238335999392000000, 238550999393000000, 238763999394000000, 238974999395000000, 239183999396000000, 239390999397000000, 239595999398000000, 239798999399000000, 239999999400000000, 240198999401000000, 240395999402000000, 240590999403000000, 240783999404000000, 240974999405000000, 241163999406000000, 241350999407000000, 241535999408000000, 241718999409000000, 241899999410000000, 242078999411000000, 242255999412000000, 242430999413000000, 242603999414000000, 242774999415000000, 242943999416000000, 243110999417000000, 243275999418000000, 243438999419000000, 243599999420000000, 243758999421000000, 243915999422000000, 244070999423000000, 244223999424000000, 244374999425000000, 244523999426000000, 244670999427000000, 244815999428000000, 244958999429000000, 245099999430000000, 245238999431000000, 245375999432000000, 245510999433000000, 245643999434000000, 245774999435000000, 245903999436000000, 246030999437000000, 246155999438000000, 246278999439000000, 246399999440000000, 246518999441000000, 246635999442000000, 246750999443000000, 246863999444000000, 246974999445000000, 247083999446000000, 247190999447000000, 247295999448000000, 247398999449000000, 247499999450000000, 247598999451000000, 247695999452000000, 247790999453000000, 247883999454000000, 247974999455000000, 248063999456000000, 248150999457000000, 248235999458000000, 248318999459000000, 248399999460000000, 248478999461000000, 248555999462000000, 248630999463000000, 248703999464000000, 248774999465000000, 248843999466000000, 248910999467000000, 248975999468000000, 249038999469000000, 249099999470000000, 249158999471000000, 249215999472000000, 249270999473000000, 249323999474000000, 249374999475000000, 249423999476000000, 249470999477000000, 249515999478000000, 249558999479000000, 249599999480000000, 249638999481000000, 249675999482000000, 249710999483000000, 249743999484000000, 249774999485000000, 249803999486000000, 249830999487000000, 249855999488000000, 249878999489000000, 249899999490000000, 249918999491000000, 249935999492000000, 249950999493000000, 249963999494000000, 249974999495000000, 249983999496000000, 249990999497000000, 249995999498000000, 249998999499000000, 249999999500000000, 249999999500000000, 249998999499000000, 249995999498000000, 249990999497000000, 249983999496000000, 249974999495000000, 249963999494000000, 249950999493000000, 249935999492000000, 249918999491000000, 249899999490000000, 249878999489000000, 249855999488000000, 249830999487000000, 249803999486000000, 249774999485000000, 249743999484000000, 249710999483000000, 249675999482000000, 249638999481000000, 249599999480000000, 249558999479000000, 249515999478000000, 249470999477000000, 249423999476000000, 249374999475000000, 249323999474000000, 249270999473000000, 249215999472000000, 249158999471000000, 249099999470000000, 249038999469000000, 248975999468000000, 248910999467000000, 248843999466000000, 248774999465000000, 248703999464000000, 248630999463000000, 248555999462000000, 248478999461000000, 248399999460000000, 248318999459000000, 248235999458000000, 248150999457000000, 248063999456000000, 247974999455000000, 247883999454000000, 247790999453000000, 247695999452000000, 247598999451000000, 247499999450000000, 247398999449000000, 247295999448000000, 247190999447000000, 247083999446000000, 246974999445000000, 246863999444000000, 246750999443000000, 246635999442000000, 246518999441000000, 246399999440000000, 246278999439000000, 246155999438000000, 246030999437000000, 245903999436000000, 245774999435000000, 245643999434000000, 245510999433000000, 245375999432000000, 245238999431000000, 245099999430000000, 244958999429000000, 244815999428000000, 244670999427000000, 244523999426000000, 244374999425000000, 244223999424000000, 244070999423000000, 243915999422000000, 243758999421000000, 243599999420000000, 243438999419000000, 243275999418000000, 243110999417000000, 242943999416000000, 242774999415000000, 242603999414000000, 242430999413000000, 242255999412000000, 242078999411000000, 241899999410000000, 241718999409000000, 241535999408000000, 241350999407000000, 241163999406000000, 240974999405000000, 240783999404000000, 240590999403000000, 240395999402000000, 240198999401000000, 239999999400000000, 239798999399000000, 239595999398000000, 239390999397000000, 239183999396000000, 238974999395000000, 238763999394000000, 238550999393000000, 238335999392000000, 238118999391000000, 237899999390000000, 237678999389000000, 237455999388000000, 237230999387000000, 237003999386000000, 236774999385000000, 236543999384000000, 236310999383000000, 236075999382000000, 235838999381000000, 235599999380000000, 235358999379000000, 235115999378000000, 234870999377000000, 234623999376000000, 234374999375000000, 234123999374000000, 233870999373000000, 233615999372000000, 233358999371000000, 233099999370000000, 232838999369000000, 232575999368000000, 232310999367000000, 232043999366000000, 231774999365000000, 231503999364000000, 231230999363000000, 230955999362000000, 230678999361000000, 230399999360000000, 230118999359000000, 229835999358000000, 229550999357000000, 229263999356000000, 228974999355000000, 228683999354000000, 228390999353000000, 228095999352000000, 227798999351000000, 227499999350000000, 227198999349000000, 226895999348000000, 226590999347000000, 226283999346000000, 225974999345000000, 225663999344000000, 225350999343000000, 225035999342000000, 224718999341000000, 224399999340000000, 224078999339000000, 223755999338000000, 223430999337000000, 223103999336000000, 222774999335000000, 222443999334000000, 222110999333000000, 221775999332000000, 221438999331000000, 221099999330000000, 220758999329000000, 220415999328000000, 220070999327000000, 219723999326000000, 219374999325000000, 219023999324000000, 218670999323000000, 218315999322000000, 217958999321000000, 217599999320000000, 217238999319000000, 216875999318000000, 216510999317000000, 216143999316000000, 215774999315000000, 215403999314000000, 215030999313000000, 214655999312000000, 214278999311000000, 213899999310000000, 213518999309000000, 213135999308000000, 212750999307000000, 212363999306000000, 211974999305000000, 211583999304000000, 211190999303000000, 210795999302000000, 210398999301000000, 209999999300000000, 209598999299000000, 209195999298000000, 208790999297000000, 208383999296000000, 207974999295000000, 207563999294000000, 207150999293000000, 206735999292000000, 206318999291000000, 205899999290000000, 205478999289000000, 205055999288000000, 204630999287000000, 204203999286000000, 203774999285000000, 203343999284000000, 202910999283000000, 202475999282000000, 202038999281000000, 201599999280000000, 201158999279000000, 200715999278000000, 200270999277000000, 199823999276000000, 199374999275000000, 198923999274000000, 198470999273000000, 198015999272000000, 197558999271000000, 197099999270000000, 196638999269000000, 196175999268000000, 195710999267000000, 195243999266000000, 194774999265000000, 194303999264000000, 193830999263000000, 193355999262000000, 192878999261000000, 192399999260000000, 191918999259000000, 191435999258000000, 190950999257000000, 190463999256000000, 189974999255000000, 189483999254000000, 188990999253000000, 188495999252000000, 187998999251000000, 187499999250000000, 186998999249000000, 186495999248000000, 185990999247000000, 185483999246000000, 184974999245000000, 184463999244000000, 183950999243000000, 183435999242000000, 182918999241000000, 182399999240000000, 181878999239000000, 181355999238000000, 180830999237000000, 180303999236000000, 179774999235000000, 179243999234000000, 178710999233000000, 178175999232000000, 177638999231000000, 177099999230000000, 176558999229000000, 176015999228000000, 175470999227000000, 174923999226000000, 174374999225000000, 173823999224000000, 173270999223000000, 172715999222000000, 172158999221000000, 171599999220000000, 171038999219000000, 170475999218000000, 169910999217000000, 169343999216000000, 168774999215000000, 168203999214000000, 167630999213000000, 167055999212000000, 166478999211000000, 165899999210000000, 165318999209000000, 164735999208000000, 164150999207000000, 163563999206000000, 162974999205000000, 162383999204000000, 161790999203000000, 161195999202000000, 160598999201000000, 159999999200000000, 159398999199000000, 158795999198000000, 158190999197000000, 157583999196000000, 156974999195000000, 156363999194000000, 155750999193000000, 155135999192000000, 154518999191000000, 153899999190000000, 153278999189000000, 152655999188000000, 152030999187000000, 151403999186000000, 150774999185000000, 150143999184000000, 149510999183000000, 148875999182000000, 148238999181000000, 147599999180000000, 146958999179000000, 146315999178000000, 145670999177000000, 145023999176000000, 144374999175000000, 143723999174000000, 143070999173000000, 142415999172000000, 141758999171000000, 141099999170000000, 140438999169000000, 139775999168000000, 139110999167000000, 138443999166000000, 137774999165000000, 137103999164000000, 136430999163000000, 135755999162000000, 135078999161000000, 134399999160000000, 133718999159000000, 133035999158000000, 132350999157000000, 131663999156000000, 130974999155000000, 130283999154000000, 129590999153000000, 128895999152000000, 128198999151000000, 127499999150000000, 126798999149000000, 126095999148000000, 125390999147000000, 124683999146000000, 123974999145000000, 123263999144000000, 122550999143000000, 121835999142000000, 121118999141000000, 120399999140000000, 119678999139000000, 118955999138000000, 118230999137000000, 117503999136000000, 116774999135000000, 116043999134000000, 115310999133000000, 114575999132000000, 113838999131000000, 113099999130000000, 112358999129000000, 111615999128000000, 110870999127000000, 110123999126000000, 109374999125000000, 108623999124000000, 107870999123000000, 107115999122000000, 106358999121000000, 105599999120000000, 104838999119000000, 104075999118000000, 103310999117000000, 102543999116000000, 101774999115000000, 101003999114000000, 100230999113000000, 99455999112000000, 98678999111000000, 97899999110000000, 97118999109000000, 96335999108000000, 95550999107000000, 94763999106000000, 93974999105000000, 93183999104000000, 92390999103000000, 91595999102000000, 90798999101000000, 89999999100000000, 89198999099000000, 88395999098000000, 87590999097000000, 86783999096000000, 85974999095000000, 85163999094000000, 84350999093000000, 83535999092000000, 82718999091000000, 81899999090000000, 81078999089000000, 80255999088000000, 79430999087000000, 78603999086000000, 77774999085000000, 76943999084000000, 76110999083000000, 75275999082000000, 74438999081000000, 73599999080000000, 72758999079000000, 71915999078000000, 71070999077000000, 70223999076000000, 69374999075000000, 68523999074000000, 67670999073000000, 66815999072000000, 65958999071000000, 65099999070000000, 64238999069000000, 63375999068000000, 62510999067000000, 61643999066000000, 60774999065000000, 59903999064000000, 59030999063000000, 58155999062000000, 57278999061000000, 56399999060000000, 55518999059000000, 54635999058000000, 53750999057000000, 52863999056000000, 51974999055000000, 51083999054000000, 50190999053000000, 49295999052000000, 48398999051000000, 47499999050000000, 46598999049000000, 45695999048000000, 44790999047000000, 43883999046000000, 42974999045000000, 42063999044000000, 41150999043000000, 40235999042000000, 39318999041000000, 38399999040000000, 37478999039000000, 36555999038000000, 35630999037000000, 34703999036000000, 33774999035000000, 32843999034000000, 31910999033000000, 30975999032000000, 30038999031000000, 29099999030000000, 28158999029000000, 27215999028000000, 26270999027000000, 25323999026000000, 24374999025000000, 23423999024000000, 22470999023000000, 21515999022000000, 20558999021000000, 19599999020000000, 18638999019000000, 17675999018000000, 16710999017000000, 15743999016000000, 14774999015000000, 13803999014000000, 12830999013000000, 11855999012000000, 10878999011000000, 9899999010000000, 8918999009000000, 7935999008000000, 6950999007000000, 5963999006000000, 4974999005000000, 3983999004000000, 2990999003000000, 1995999002000000, 998999001000000, 8999999999000000000, 0 };\n int num = 1000000;\n void solve()\n {\n int l = nextInt();\n int r = nextInt();\n \n long res = 0;\n res = Math.Max(res, get(l));\n res = Math.Max(res, get(r));\n while (l < r && l % num != 0)\n {\n res = Math.Max(res, get(l));\n l++;\n }\n if (l 0)\n {\n y += p * (9 - x % 10);\n x /= 10;\n p *= 10;\n }\n return temp * y;\n }\n \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 int nextInt()\n {\n return int.Parse(nextString());\n }\n long nextLong()\n {\n return long.Parse(nextString());\n }\n double nextDouble()\n {\n return double.Parse(nextString());\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1197004fcfa02b72ea11bc75395a16a6", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _86A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int l = 0, r = 0;\n string input = Console.ReadLine();\n l = Convert.ToInt32(input.Split(' ')[0]);\n r = Convert.ToInt32(input.Split(' ')[1]);\n\n string sl = l.ToString();\n string sr = r.ToString();\n\n ulong num = 0;\n\n if (sr.Length > sl.Length)\n {\n if (Convert.ToInt16(sr[0]) - 48 >= 5)\n {\n string biggest = \"5\";\n for (int i = 0; i < sr.Length - 1; i++)\n {\n biggest += \"0\";\n }\n num = Convert.ToUInt64(biggest);\n }\n else\n {\n num = Convert.ToUInt64(r);\n }\n }\n else if (sr.Length == sl.Length)\n {\n if (r == l)\n {\n num = Convert.ToUInt64(r);\n }\n\n else if (Convert.ToInt16(sr[0]) - 48 >= 5 && Convert.ToInt16(sl[0]) - 48 >= 5)\n {\n num = Convert.ToUInt64(l);\n }\n else if (Convert.ToInt16(sr[0]) - 48 <= 4 && Convert.ToInt16(sl[0]) - 48 <= 4)\n {\n num = Convert.ToUInt64(r);\n }\n else\n {\n string biggest = \"5\";\n for (int i = 0; i < sr.Length-1; i++)\n {\n biggest += \"0\";\n }\n num = Convert.ToUInt64(biggest);\n\n }\n\n }\n\n Console.WriteLine(refl(num) * num);\n Console.ReadLine();\n\n }\n\n static public ulong refl(ulong num)\n {\n string sr = num.ToString();\n string nine = \"\";\n for (int i = 0; i < sr.Length; i++)\n {\n nine += \"9\";\n }\n return(Convert.ToUInt64(nine) - num);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c76e73347e98fce84b7aa0e7121d381b", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _86A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int l = 0, r = 0;\n string input = Console.ReadLine();\n l = Convert.ToInt32(input.Split(' ')[0]);\n r = Convert.ToInt32(input.Split(' ')[1]);\n\n string sl = l.ToString();\n string sr = r.ToString();\n\n int num = 0;\n\n if (sr.Length > sl.Length)\n {\n num = r;\n }\n else if (sr.Length == sl.Length)\n {\n if (r == l)\n {\n num = r;\n }\n\n else if (Convert.ToInt16(sr[0]) - 48 >= 5 && Convert.ToInt16(sl[0]) - 48 >= 5)\n {\n num = l;\n }\n else if (Convert.ToInt16(sr[0]) - 48 <= 4 && Convert.ToInt16(sl[0]) - 48 <= 4)\n {\n num = r;\n }\n else\n {\n string biggest = \"5\";\n for (int i = 0; i < sr.Length-1; i++)\n {\n biggest += \"0\";\n }\n num = Convert.ToInt32(biggest);\n\n }\n\n }\n\n Console.WriteLine(refl(num) * num);\n Console.ReadLine();\n\n }\n\n static public int refl(int num)\n {\n string sr = num.ToString();\n string nine = \"\";\n for (int i = 0; i < sr.Length; i++)\n {\n nine += \"9\";\n }\n\n return( Convert.ToInt32(nine) - num);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b5f70ff5d81f1134589114871e568223", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n /*\n long max = 0;\n for (int i = 0; ; i++)\n {\n long a = _search(i, i);\n if (a > max)\n {\n Debug.WriteLine(i + \"\\t\" + a);\n max = a;\n }\n }\n */\n\n var ss = CF.ReadLine().Split(' ');\n int l = int.Parse(ss[0]);\n int r = int.Parse(ss[1]);\n\n /*\n l = 1;\n r = 1000000000;\n */\n\n int r2 = r;\n {\n int d = _d(r);\n for (int i = 0; i < d / 2; i++)\n {\n r2 /= 10;\n }\n for (int i = 0; i < d / 2; i++)\n {\n r2 *= 10;\n }\n\n int dmax = 0;\n {\n for (int i = 0; i < d / 2; i++)\n {\n dmax *= 10;\n dmax += 9;\n }\n\n if (d % 2 == 1)\n {\n dmax *= 10;\n dmax += 4;\n }\n for (int i = 0; i < d / 2; i++)\n {\n dmax *= 10;\n }\n } \n if (r2 > dmax)\n r2 = dmax;\n }\n\n int l2 = l;\n if (r2 < l2)\n r2 = r;\n else\n l2 = r2;\n\n CF.WriteLine(_search(l2, r2));\n }\n\n int _d(int n)\n {\n int d = 0;\n {\n int tmp = n;\n for (; ; )\n {\n if (tmp == 0)\n break;\n d += 1;\n tmp /= 10;\n }\n }\n return d;\n }\n\n long _search(int l,int r)\n {\n long max = 0;\n for (int i = l; i <= r; i++)\n {\n int tmp = i;\n Stack ds = new Stack();\n for (; ; )\n {\n if (tmp == 0)\n break;\n ds.Push(tmp % 10);\n tmp/= 10;\n }\n\n int o=0;\n foreach (var d in ds)\n {\n o *= 10;\n o += (9-d);\n }\n\n long p = (long)o * i;\n max = Math.Max(p, max);\n }\n return max;\n }\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n99990001 999939999\n\",\n@\"\n3 7\n\",\n @\"\n1 1\n\",\n @\"\n8 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "880e24101c4178ad2f88c9dc1473b2c8", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Program {\n static void Main(string[] args) {\n int x = 10, sum;\n string[] s = Console.ReadLine().Split();\n int l = int.Parse(s[0]);\n int r = int.Parse(s[1]);\n while (r >= x) {\n x *= 10;\n }\n if (r >= x / 2 && l <= x / 2 - 1) {\n sum = x / 2 - 1;\n }\n else if (l > x / 2 - 1) {\n sum = l;\n }\n else {\n sum = r;\n }\n Console.WriteLine(sum * (x - sum - 1));\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "79d0eeff29d0e097fa1ee7287c53ea8f", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 long[] a = new long[] { 249999500000, 15999992000000, 20999993000000, 23999994000000, 24999995000000, 24999995000000, 23999994000000, 20999993000000, 15999992000000, 8999991000000, 978999911000000, 1055999912000000, 1130999913000000, 1203999914000000, 1274999915000000, 1343999916000000, 1410999917000000, 1475999918000000, 1538999919000000, 1599999920000000, 1658999921000000, 1715999922000000, 1770999923000000, 1823999924000000, 1874999925000000, 1923999926000000, 1970999927000000, 2015999928000000, 2058999929000000, 2099999930000000, 2138999931000000, 2175999932000000, 2210999933000000, 2243999934000000, 2274999935000000, 2303999936000000, 2330999937000000, 2355999938000000, 2378999939000000, 2399999940000000, 2418999941000000, 2435999942000000, 2450999943000000, 2463999944000000, 2474999945000000, 2483999946000000, 2490999947000000, 2495999948000000, 2498999949000000, 2499999950000000, 2499999950000000, 2498999949000000, 2495999948000000, 2490999947000000, 2483999946000000, 2474999945000000, 2463999944000000, 2450999943000000, 2435999942000000, 2418999941000000, 2399999940000000, 2378999939000000, 2355999938000000, 2330999937000000, 2303999936000000, 2274999935000000, 2243999934000000, 2210999933000000, 2175999932000000, 2138999931000000, 2099999930000000, 2058999929000000, 2015999928000000, 1970999927000000, 1923999926000000, 1874999925000000, 1823999924000000, 1770999923000000, 1715999922000000, 1658999921000000, 1599999920000000, 1538999919000000, 1475999918000000, 1410999917000000, 1343999916000000, 1274999915000000, 1203999914000000, 1130999913000000, 1055999912000000, 978999911000000, 899999910000000, 818999909000000, 735999908000000, 650999907000000, 563999906000000, 474999905000000, 383999904000000, 290999903000000, 195999902000000, 98999901000000, 90798999101000000, 91595999102000000, 92390999103000000, 93183999104000000, 93974999105000000, 94763999106000000, 95550999107000000, 96335999108000000, 97118999109000000, 97899999110000000, 98678999111000000, 99455999112000000, 100230999113000000, 101003999114000000, 101774999115000000, 102543999116000000, 103310999117000000, 104075999118000000, 104838999119000000, 105599999120000000, 106358999121000000, 107115999122000000, 107870999123000000, 108623999124000000, 109374999125000000, 110123999126000000, 110870999127000000, 111615999128000000, 112358999129000000, 113099999130000000, 113838999131000000, 114575999132000000, 115310999133000000, 116043999134000000, 116774999135000000, 117503999136000000, 118230999137000000, 118955999138000000, 119678999139000000, 120399999140000000, 121118999141000000, 121835999142000000, 122550999143000000, 123263999144000000, 123974999145000000, 124683999146000000, 125390999147000000, 126095999148000000, 126798999149000000, 127499999150000000, 128198999151000000, 128895999152000000, 129590999153000000, 130283999154000000, 130974999155000000, 131663999156000000, 132350999157000000, 133035999158000000, 133718999159000000, 134399999160000000, 135078999161000000, 135755999162000000, 136430999163000000, 137103999164000000, 137774999165000000, 138443999166000000, 139110999167000000, 139775999168000000, 140438999169000000, 141099999170000000, 141758999171000000, 142415999172000000, 143070999173000000, 143723999174000000, 144374999175000000, 145023999176000000, 145670999177000000, 146315999178000000, 146958999179000000, 147599999180000000, 148238999181000000, 148875999182000000, 149510999183000000, 150143999184000000, 150774999185000000, 151403999186000000, 152030999187000000, 152655999188000000, 153278999189000000, 153899999190000000, 154518999191000000, 155135999192000000, 155750999193000000, 156363999194000000, 156974999195000000, 157583999196000000, 158190999197000000, 158795999198000000, 159398999199000000, 159999999200000000, 160598999201000000, 161195999202000000, 161790999203000000, 162383999204000000, 162974999205000000, 163563999206000000, 164150999207000000, 164735999208000000, 165318999209000000, 165899999210000000, 166478999211000000, 167055999212000000, 167630999213000000, 168203999214000000, 168774999215000000, 169343999216000000, 169910999217000000, 170475999218000000, 171038999219000000, 171599999220000000, 172158999221000000, 172715999222000000, 173270999223000000, 173823999224000000, 174374999225000000, 174923999226000000, 175470999227000000, 176015999228000000, 176558999229000000, 177099999230000000, 177638999231000000, 178175999232000000, 178710999233000000, 179243999234000000, 179774999235000000, 180303999236000000, 180830999237000000, 181355999238000000, 181878999239000000, 182399999240000000, 182918999241000000, 183435999242000000, 183950999243000000, 184463999244000000, 184974999245000000, 185483999246000000, 185990999247000000, 186495999248000000, 186998999249000000, 187499999250000000, 187998999251000000, 188495999252000000, 188990999253000000, 189483999254000000, 189974999255000000, 190463999256000000, 190950999257000000, 191435999258000000, 191918999259000000, 192399999260000000, 192878999261000000, 193355999262000000, 193830999263000000, 194303999264000000, 194774999265000000, 195243999266000000, 195710999267000000, 196175999268000000, 196638999269000000, 197099999270000000, 197558999271000000, 198015999272000000, 198470999273000000, 198923999274000000, 199374999275000000, 199823999276000000, 200270999277000000, 200715999278000000, 201158999279000000, 201599999280000000, 202038999281000000, 202475999282000000, 202910999283000000, 203343999284000000, 203774999285000000, 204203999286000000, 204630999287000000, 205055999288000000, 205478999289000000, 205899999290000000, 206318999291000000, 206735999292000000, 207150999293000000, 207563999294000000, 207974999295000000, 208383999296000000, 208790999297000000, 209195999298000000, 209598999299000000, 209999999300000000, 210398999301000000, 210795999302000000, 211190999303000000, 211583999304000000, 211974999305000000, 212363999306000000, 212750999307000000, 213135999308000000, 213518999309000000, 213899999310000000, 214278999311000000, 214655999312000000, 215030999313000000, 215403999314000000, 215774999315000000, 216143999316000000, 216510999317000000, 216875999318000000, 217238999319000000, 217599999320000000, 217958999321000000, 218315999322000000, 218670999323000000, 219023999324000000, 219374999325000000, 219723999326000000, 220070999327000000, 220415999328000000, 220758999329000000, 221099999330000000, 221438999331000000, 221775999332000000, 222110999333000000, 222443999334000000, 222774999335000000, 223103999336000000, 223430999337000000, 223755999338000000, 224078999339000000, 224399999340000000, 224718999341000000, 225035999342000000, 225350999343000000, 225663999344000000, 225974999345000000, 226283999346000000, 226590999347000000, 226895999348000000, 227198999349000000, 227499999350000000, 227798999351000000, 228095999352000000, 228390999353000000, 228683999354000000, 228974999355000000, 229263999356000000, 229550999357000000, 229835999358000000, 230118999359000000, 230399999360000000, 230678999361000000, 230955999362000000, 231230999363000000, 231503999364000000, 231774999365000000, 232043999366000000, 232310999367000000, 232575999368000000, 232838999369000000, 233099999370000000, 233358999371000000, 233615999372000000, 233870999373000000, 234123999374000000, 234374999375000000, 234623999376000000, 234870999377000000, 235115999378000000, 235358999379000000, 235599999380000000, 235838999381000000, 236075999382000000, 236310999383000000, 236543999384000000, 236774999385000000, 237003999386000000, 237230999387000000, 237455999388000000, 237678999389000000, 237899999390000000, 238118999391000000, 238335999392000000, 238550999393000000, 238763999394000000, 238974999395000000, 239183999396000000, 239390999397000000, 239595999398000000, 239798999399000000, 239999999400000000, 240198999401000000, 240395999402000000, 240590999403000000, 240783999404000000, 240974999405000000, 241163999406000000, 241350999407000000, 241535999408000000, 241718999409000000, 241899999410000000, 242078999411000000, 242255999412000000, 242430999413000000, 242603999414000000, 242774999415000000, 242943999416000000, 243110999417000000, 243275999418000000, 243438999419000000, 243599999420000000, 243758999421000000, 243915999422000000, 244070999423000000, 244223999424000000, 244374999425000000, 244523999426000000, 244670999427000000, 244815999428000000, 244958999429000000, 245099999430000000, 245238999431000000, 245375999432000000, 245510999433000000, 245643999434000000, 245774999435000000, 245903999436000000, 246030999437000000, 246155999438000000, 246278999439000000, 246399999440000000, 246518999441000000, 246635999442000000, 246750999443000000, 246863999444000000, 246974999445000000, 247083999446000000, 247190999447000000, 247295999448000000, 247398999449000000, 247499999450000000, 247598999451000000, 247695999452000000, 247790999453000000, 247883999454000000, 247974999455000000, 248063999456000000, 248150999457000000, 248235999458000000, 248318999459000000, 248399999460000000, 248478999461000000, 248555999462000000, 248630999463000000, 248703999464000000, 248774999465000000, 248843999466000000, 248910999467000000, 248975999468000000, 249038999469000000, 249099999470000000, 249158999471000000, 249215999472000000, 249270999473000000, 249323999474000000, 249374999475000000, 249423999476000000, 249470999477000000, 249515999478000000, 249558999479000000, 249599999480000000, 249638999481000000, 249675999482000000, 249710999483000000, 249743999484000000, 249774999485000000, 249803999486000000, 249830999487000000, 249855999488000000, 249878999489000000, 249899999490000000, 249918999491000000, 249935999492000000, 249950999493000000, 249963999494000000, 249974999495000000, 249983999496000000, 249990999497000000, 249995999498000000, 249998999499000000, 249999999500000000, 249999999500000000, 249998999499000000, 249995999498000000, 249990999497000000, 249983999496000000, 249974999495000000, 249963999494000000, 249950999493000000, 249935999492000000, 249918999491000000, 249899999490000000, 249878999489000000, 249855999488000000, 249830999487000000, 249803999486000000, 249774999485000000, 249743999484000000, 249710999483000000, 249675999482000000, 249638999481000000, 249599999480000000, 249558999479000000, 249515999478000000, 249470999477000000, 249423999476000000, 249374999475000000, 249323999474000000, 249270999473000000, 249215999472000000, 249158999471000000, 249099999470000000, 249038999469000000, 248975999468000000, 248910999467000000, 248843999466000000, 248774999465000000, 248703999464000000, 248630999463000000, 248555999462000000, 248478999461000000, 248399999460000000, 248318999459000000, 248235999458000000, 248150999457000000, 248063999456000000, 247974999455000000, 247883999454000000, 247790999453000000, 247695999452000000, 247598999451000000, 247499999450000000, 247398999449000000, 247295999448000000, 247190999447000000, 247083999446000000, 246974999445000000, 246863999444000000, 246750999443000000, 246635999442000000, 246518999441000000, 246399999440000000, 246278999439000000, 246155999438000000, 246030999437000000, 245903999436000000, 245774999435000000, 245643999434000000, 245510999433000000, 245375999432000000, 245238999431000000, 245099999430000000, 244958999429000000, 244815999428000000, 244670999427000000, 244523999426000000, 244374999425000000, 244223999424000000, 244070999423000000, 243915999422000000, 243758999421000000, 243599999420000000, 243438999419000000, 243275999418000000, 243110999417000000, 242943999416000000, 242774999415000000, 242603999414000000, 242430999413000000, 242255999412000000, 242078999411000000, 241899999410000000, 241718999409000000, 241535999408000000, 241350999407000000, 241163999406000000, 240974999405000000, 240783999404000000, 240590999403000000, 240395999402000000, 240198999401000000, 239999999400000000, 239798999399000000, 239595999398000000, 239390999397000000, 239183999396000000, 238974999395000000, 238763999394000000, 238550999393000000, 238335999392000000, 238118999391000000, 237899999390000000, 237678999389000000, 237455999388000000, 237230999387000000, 237003999386000000, 236774999385000000, 236543999384000000, 236310999383000000, 236075999382000000, 235838999381000000, 235599999380000000, 235358999379000000, 235115999378000000, 234870999377000000, 234623999376000000, 234374999375000000, 234123999374000000, 233870999373000000, 233615999372000000, 233358999371000000, 233099999370000000, 232838999369000000, 232575999368000000, 232310999367000000, 232043999366000000, 231774999365000000, 231503999364000000, 231230999363000000, 230955999362000000, 230678999361000000, 230399999360000000, 230118999359000000, 229835999358000000, 229550999357000000, 229263999356000000, 228974999355000000, 228683999354000000, 228390999353000000, 228095999352000000, 227798999351000000, 227499999350000000, 227198999349000000, 226895999348000000, 226590999347000000, 226283999346000000, 225974999345000000, 225663999344000000, 225350999343000000, 225035999342000000, 224718999341000000, 224399999340000000, 224078999339000000, 223755999338000000, 223430999337000000, 223103999336000000, 222774999335000000, 222443999334000000, 222110999333000000, 221775999332000000, 221438999331000000, 221099999330000000, 220758999329000000, 220415999328000000, 220070999327000000, 219723999326000000, 219374999325000000, 219023999324000000, 218670999323000000, 218315999322000000, 217958999321000000, 217599999320000000, 217238999319000000, 216875999318000000, 216510999317000000, 216143999316000000, 215774999315000000, 215403999314000000, 215030999313000000, 214655999312000000, 214278999311000000, 213899999310000000, 213518999309000000, 213135999308000000, 212750999307000000, 212363999306000000, 211974999305000000, 211583999304000000, 211190999303000000, 210795999302000000, 210398999301000000, 209999999300000000, 209598999299000000, 209195999298000000, 208790999297000000, 208383999296000000, 207974999295000000, 207563999294000000, 207150999293000000, 206735999292000000, 206318999291000000, 205899999290000000, 205478999289000000, 205055999288000000, 204630999287000000, 204203999286000000, 203774999285000000, 203343999284000000, 202910999283000000, 202475999282000000, 202038999281000000, 201599999280000000, 201158999279000000, 200715999278000000, 200270999277000000, 199823999276000000, 199374999275000000, 198923999274000000, 198470999273000000, 198015999272000000, 197558999271000000, 197099999270000000, 196638999269000000, 196175999268000000, 195710999267000000, 195243999266000000, 194774999265000000, 194303999264000000, 193830999263000000, 193355999262000000, 192878999261000000, 192399999260000000, 191918999259000000, 191435999258000000, 190950999257000000, 190463999256000000, 189974999255000000, 189483999254000000, 188990999253000000, 188495999252000000, 187998999251000000, 187499999250000000, 186998999249000000, 186495999248000000, 185990999247000000, 185483999246000000, 184974999245000000, 184463999244000000, 183950999243000000, 183435999242000000, 182918999241000000, 182399999240000000, 181878999239000000, 181355999238000000, 180830999237000000, 180303999236000000, 179774999235000000, 179243999234000000, 178710999233000000, 178175999232000000, 177638999231000000, 177099999230000000, 176558999229000000, 176015999228000000, 175470999227000000, 174923999226000000, 174374999225000000, 173823999224000000, 173270999223000000, 172715999222000000, 172158999221000000, 171599999220000000, 171038999219000000, 170475999218000000, 169910999217000000, 169343999216000000, 168774999215000000, 168203999214000000, 167630999213000000, 167055999212000000, 166478999211000000, 165899999210000000, 165318999209000000, 164735999208000000, 164150999207000000, 163563999206000000, 162974999205000000, 162383999204000000, 161790999203000000, 161195999202000000, 160598999201000000, 159999999200000000, 159398999199000000, 158795999198000000, 158190999197000000, 157583999196000000, 156974999195000000, 156363999194000000, 155750999193000000, 155135999192000000, 154518999191000000, 153899999190000000, 153278999189000000, 152655999188000000, 152030999187000000, 151403999186000000, 150774999185000000, 150143999184000000, 149510999183000000, 148875999182000000, 148238999181000000, 147599999180000000, 146958999179000000, 146315999178000000, 145670999177000000, 145023999176000000, 144374999175000000, 143723999174000000, 143070999173000000, 142415999172000000, 141758999171000000, 141099999170000000, 140438999169000000, 139775999168000000, 139110999167000000, 138443999166000000, 137774999165000000, 137103999164000000, 136430999163000000, 135755999162000000, 135078999161000000, 134399999160000000, 133718999159000000, 133035999158000000, 132350999157000000, 131663999156000000, 130974999155000000, 130283999154000000, 129590999153000000, 128895999152000000, 128198999151000000, 127499999150000000, 126798999149000000, 126095999148000000, 125390999147000000, 124683999146000000, 123974999145000000, 123263999144000000, 122550999143000000, 121835999142000000, 121118999141000000, 120399999140000000, 119678999139000000, 118955999138000000, 118230999137000000, 117503999136000000, 116774999135000000, 116043999134000000, 115310999133000000, 114575999132000000, 113838999131000000, 113099999130000000, 112358999129000000, 111615999128000000, 110870999127000000, 110123999126000000, 109374999125000000, 108623999124000000, 107870999123000000, 107115999122000000, 106358999121000000, 105599999120000000, 104838999119000000, 104075999118000000, 103310999117000000, 102543999116000000, 101774999115000000, 101003999114000000, 100230999113000000, 99455999112000000, 98678999111000000, 97899999110000000, 97118999109000000, 96335999108000000, 95550999107000000, 94763999106000000, 93974999105000000, 93183999104000000, 92390999103000000, 91595999102000000, 90798999101000000, 89999999100000000, 89198999099000000, 88395999098000000, 87590999097000000, 86783999096000000, 85974999095000000, 85163999094000000, 84350999093000000, 83535999092000000, 82718999091000000, 81899999090000000, 81078999089000000, 80255999088000000, 79430999087000000, 78603999086000000, 77774999085000000, 76943999084000000, 76110999083000000, 75275999082000000, 74438999081000000, 73599999080000000, 72758999079000000, 71915999078000000, 71070999077000000, 70223999076000000, 69374999075000000, 68523999074000000, 67670999073000000, 66815999072000000, 65958999071000000, 65099999070000000, 64238999069000000, 63375999068000000, 62510999067000000, 61643999066000000, 60774999065000000, 59903999064000000, 59030999063000000, 58155999062000000, 57278999061000000, 56399999060000000, 55518999059000000, 54635999058000000, 53750999057000000, 52863999056000000, 51974999055000000, 51083999054000000, 50190999053000000, 49295999052000000, 48398999051000000, 47499999050000000, 46598999049000000, 45695999048000000, 44790999047000000, 43883999046000000, 42974999045000000, 42063999044000000, 41150999043000000, 40235999042000000, 39318999041000000, 38399999040000000, 37478999039000000, 36555999038000000, 35630999037000000, 34703999036000000, 33774999035000000, 32843999034000000, 31910999033000000, 30975999032000000, 30038999031000000, 29099999030000000, 28158999029000000, 27215999028000000, 26270999027000000, 25323999026000000, 24374999025000000, 23423999024000000, 22470999023000000, 21515999022000000, 20558999021000000, 19599999020000000, 18638999019000000, 17675999018000000, 16710999017000000, 15743999016000000, 14774999015000000, 13803999014000000, 12830999013000000, 11855999012000000, 10878999011000000, 9899999010000000, 8918999009000000, 7935999008000000, 6950999007000000, 5963999006000000, 4974999005000000, 3983999004000000, 2990999003000000, 1995999002000000, 998999001000000, 8999999999000000000, 0 };\n int num = 1000000;\n void solve()\n {\n int l = nextInt();\n int r = nextInt();\n \n long res = 0;\n res = Math.Max(res, get(l));\n res = Math.Max(res, get(r));\n while (l < r && l % num != 0)\n {\n res = Math.Max(res, get(l));\n l++;\n }\n while (r > l && r % num != 0)\n res = Math.Max(res, get(r--));\n if (l < r)\n {\n int start = l / num;\n int end = r / num;\n for (; start <= end; start++)\n res = Math.Max(res, a[start]);\n }\n if (l > 0)\n res = Math.Max(res, get(l));\n if (r > 0)\n res = Math.Max(res, get(r));\n println(res);\n\n\n }\n long get(int x)\n {\n long y = 0;\n long p = 1;\n long temp = x;\n while (x > 0)\n {\n y += p * (9 - x % 10);\n x /= 10;\n p *= 10;\n }\n return temp * y;\n }\n \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 int nextInt()\n {\n return int.Parse(nextString());\n }\n long nextLong()\n {\n return long.Parse(nextString());\n }\n double nextDouble()\n {\n return double.Parse(nextString());\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bb2b2b6b94dfd22896880c13ee867752", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Collections;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace App2 {\n class Program\n {\n Regex regex;\n void Solve()\n {\n //StreamReader textFile = new StreamReader(\"c:\\\\in.txt\");\n\n regex = new Regex(\"[^\\\\d\\\\-]{1,}\");\n\n //string []s = regex.Split(\"0, 9, 12, 232, 5 3 -1\");\n string[] s = regex.Split(Console.In.ReadToEnd());\n //string[] s = regex.Split(textFile.ReadToEnd());\n\n int L = Int32.Parse(s[0]);\n int R = Int32.Parse(s[1]);\n\n if (len(L) < len(R))\n {\n L = (int)Math.Round(Math.Pow(10, len(R)-1));\n }\n int ll = len(L);\n int powN = (int)Math.Round(Math.Pow(10, ll - 1));\n int nines = (int)Math.Round(Math.Pow(10, ll) - 1);\n\n Int64 answer = 1L * L * (nines - L);\n answer = Math.Max(answer, 1L * R * (nines - R));\n if (L <= 5 * powN && 5 * powN <= R)\n {\n answer = Math.Max(answer, 5 * powN * (nines - 5 * powN));\n }\n\n Console.WriteLine(answer);\n }\n\n int len(int n)\n {\n int res = 0;\n while (n > 0)\n {\n ++res;\n n /= 10;\n }\n return res;\n }\n\n\n static void Main()\n {\n new Program().Solve();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b750df2235144a8e781eadb84e36ac21", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _86A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int l = 0, r = 0;\n string input = Console.ReadLine();\n l = Convert.ToInt32(input.Split(' ')[0]);\n r = Convert.ToInt32(input.Split(' ')[1]);\n\n string sl = l.ToString();\n string sr = r.ToString();\n\n int num = 0;\n\n if (sr.Length > sl.Length)\n {\n if (Convert.ToInt16(sr[0]) - 48 >= 5)\n {\n string biggest = \"5\";\n for (int i = 0; i < sr.Length - 1; i++)\n {\n biggest += \"0\";\n }\n num = Convert.ToInt32(biggest);\n }\n else\n {\n num = r;\n }\n }\n else if (sr.Length == sl.Length)\n {\n if (r == l)\n {\n num = r;\n }\n\n else if (Convert.ToInt16(sr[0]) - 48 >= 5 && Convert.ToInt16(sl[0]) - 48 >= 5)\n {\n num = l;\n }\n else if (Convert.ToInt16(sr[0]) - 48 <= 4 && Convert.ToInt16(sl[0]) - 48 <= 4)\n {\n num = r;\n }\n else\n {\n string biggest = \"5\";\n for (int i = 0; i < sr.Length-1; i++)\n {\n biggest += \"0\";\n }\n num = Convert.ToInt32(biggest);\n\n }\n\n }\n\n Console.WriteLine(refl(num) * num);\n Console.ReadLine();\n\n }\n\n static public int refl(int num)\n {\n string sr = num.ToString();\n string nine = \"\";\n for (int i = 0; i < sr.Length; i++)\n {\n nine += \"9\";\n }\n\n return( Convert.ToInt32(nine) - num);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4c7833642a83597ba5bd0e25a7975da6", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "MS C#", "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 private const int MAX = 500000;\n\n public void Solve()\n {\n int n = ReadInt();\n int d = ReadInt();\n var a = ReadIntArray();\n\n var dp = new bool[MAX + 1];\n dp[0] = true;\n for (int i = 0; i < n; i++)\n {\n for (int j = MAX; j >= 0; j--)\n if (dp[j])\n dp[j + a[i]] = true;\n }\n\n int x = 0;\n int ans = 0;\n while (true)\n {\n int y = Math.Min(x + d, MAX);\n while (!dp[y])\n y--;\n if (x == y)\n break;\n ans++;\n x = y;\n }\n\n Write(x, 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(\"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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bf5a5e0c1f921af6fde1090b818bc37b", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace CF\n{\n\tclass _364B\n\t{\n\t\tprivate static void Main(String[] args)\n\t\t{\n\t\t\tvar pts = Console.ReadLine().Split(' ');\n\t\t\tint n = int.Parse(pts[0]),\n\t\t\t\td = int.Parse(pts[1]);\n\t\t\tvar a = new int[n];\n\t\t\tpts = Console.ReadLine().Split(' ');\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = int.Parse(pts[i]);\n\t\t\tint limit = 10000 * n;\n\t\t\tvar map = new int[limit + 1, n + 1];\n\t\t\tmap[0, 0] = 1;\n\t\t\tint max = 0;\n\t\t\tfor (int i = 0; i < n; ++i) {\n\t\t\t\tfor (int j = max; j >= 0; --j)\n\t\t\t\t\tif (map[j, i] != 0) {\n\t\t\t\t\t\tmap[j + a[i], i + 1] = 1;\n\t\t\t\t\t\tmax = Math.Max(max, j + a[i]);\n\t\t\t\t\t\tmap[j, i + 1] = 1;\n\t\t\t\t\t}\n\t\t\t}\n\t\t\tint ans = 0, days = 0;\n\t\t\twhile (ans < limit)\n\t\t\t{\n\t\t\t\tint eat = 0;\n\t\t\t\tfor (int j = 0; j <= d; ++j)\n\t\t\t\t\tif (ans + j <= limit\n\t\t\t\t\t\t&& map[ans + j, n] != 0)\n\t\t\t\t\t\teat = j;\n\t\t\t\tif (0 == eat)\n\t\t\t\t\tbreak;\n\t\t\t\tans += eat;\n\t\t\t\t++days;\n\t\t\t}\n\t\t\tConsole.WriteLine(\"{0} {1}\", ans, days);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5c5f6a507cfc2748160a23316d6dcb43", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Data.Odbc;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF\n{\n\tclass _364B\n\t{\n\t\tprivate const int KMaxPrice = 10000;\n\n\t\tprivate static void Main(String[] args)\n\t\t{\n\t\t\tvar parts = Console.ReadLine().Split(' ');\n\t\t\tint n = int.Parse(parts[0]),\n\t\t\t\td = int.Parse(parts[1]);\n\t\t\tint[] a = new int[n];\n\t\t\tparts = Console.ReadLine().Split(' ');\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = int.Parse(parts[i]);\n\t\t\tint limit = KMaxPrice*n;\n\t\t\tint[,] map = new int[limit + 1, n + 1];\n\t\t\tmap[0, 0] = 1;\n\t\t\tfor (int i = 0; i < n; ++i)\n\t\t\t\tfor (int j = limit; j >= 0; --j)\n\t\t\t\t\tif (map[j, i] != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmap[j + a[i], i + 1] = 1;\n\t\t\t\t\t\tmap[j, i + 1] = 1;\n\t\t\t\t\t}\n\t\t\tint ans = 0, days = 0;\n\t\t\twhile (ans < limit)\n\t\t\t{\n\t\t\t\tint eat = 0;\n\t\t\t\tfor (int j = 0; j <= d; ++j)\n\t\t\t\t\tif (ans + j <= limit\n\t\t\t\t\t\t&& map[ans + j, n] != 0)\n\t\t\t\t\t\teat = j;\n\t\t\t\tif (0 == eat)\n\t\t\t\t\tbreak;\n\t\t\t\t//Console.WriteLine(\"{0} {1}\", eat, days);\n\t\t\t\tans += eat;\n\t\t\t\t++days;\n\t\t\t}\n\t\t\tConsole.WriteLine(\"{0} {1}\", ans, days);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5ba50e53262a7d16fec54cd9852e1760", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "difficulty": 2200.0} {"lang": "Mono C#", "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 string[] a = { \"Ac\",\"Ag\",\"Al\",\"Am\",\"Ar\",\"As\",\"At\",\"Au\",\"B\",\"Ba\",\"Be\",\"Bh\",\"Bi\",\"Bk\",\"Br\",\"C\",\"Ca\",\"Cd\",\"Ce\",\"Cf\",\"Cl\",\"Cm\",\"Cn\",\"Co\",\"Cr\",\"Cs\",\"Cu\",\"Db\",\"Ds\",\"Dy\",\"Er\",\"Es\",\"Eu\",\"F\",\"Fe\",\"Fl\",\"Fm\",\"Fr\",\"Ga\",\"Gd\",\"Ge\",\"H\",\"He\",\"Hf\",\"Hg\",\"Ho\",\"Hs\",\"I\",\"In\",\"Ir\",\"K\",\"Kr\",\"La\",\"Li\",\"Lr\",\"Lu\",\"Lv\",\"Mc\",\"Md\",\"Mg\",\"Mn\",\"Mo\",\"Mt\",\"N\",\"Na\",\"Nb\",\"Nd\",\"Ne\",\"Nh\",\"Ni\",\"No\",\"Np\",\"O\",\"Og\",\"Os\",\"P\",\"Pa\",\"Pb\",\"Pd\",\"Pm\",\"Po\",\"Pr\",\"Pt\",\"Pu\",\"Ra\",\"Rb\",\"Re\",\"Rf\",\"Rg\",\"Rh\",\"Rn\",\"Ru\",\"S\",\"Sb\",\"Sc\",\"Se\",\"Sg\",\"Si\",\"Sm\",\"Sn\",\"Sr\",\"Ta\",\"Tb\",\"Tc\",\"Te\",\"Th\",\"Ti\",\"Tl\",\"Tm\",\"Ts\",\"U\",\"V\",\"W\",\"Xe\",\"Y\",\"Yb\",\"Zn\",\"Zr\"};\n Dictionary> d;\n\n bool Fun(int p, string s)\n {\n if (p >= s.Length)\n return true;\n foreach (string v in d[s[p]])\n if (p + v.Length <= s.Length && s.Substring(p, v.Length) == v && Fun(p + v.Length, s))\n return true;\n return false;\n }\n\n public void Solve()\n {\n d = new Dictionary>();\n for (char i = 'A'; i <= 'Z'; i++)\n d[i] = new List();\n foreach (string aa in a)\n {\n d[aa[0]].Add(aa.ToUpper());\n }\n\n string s = ReadToken();\n Write(Fun(0, s) ? \"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbeee5de465ab4a3254206804349fff3", "src_uid": "d0ad35798119f98320967127c43ae88d", "difficulty": null} {"lang": "C# 8", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d5ccf20c0c6a7d34a943711fbd995d15", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "C# 8", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5ab689c547ab99b3097324db69861f37", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3999d2e3841b8599a12fb82ce532d97e", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "C# 8", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8e94fbff17fe000ee5c4843d71a38974", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "C# 8", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f90bae1e408896e8afeff0a42046dd67", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "C# 8", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eb3ce0cbbf8d6276618e4f77ba45c990", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Mono C#", "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 Stack q = new Stack();\n\n if ((ulong)a[1].ToString().Length >= a[0])\n o = 0;\n else\n q.Push(new ulong[] { a[1], 0 });\n\n while (q.Count>0)\n {\n var x = q.Pop();\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 q.Push(new ulong[] {(ulong)bi2,x[1]+1 });\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "08d5c9f83c01d1cb8ac70fb56dffaac3", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\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 Team : IComparable\n {\n public string name;\n public int goal;\n public int miss;\n public int point;\n public int cnt;\n public int CompareTo(Team y)\n {\n if (this.point > y.point)\n {\n return 1;\n }\n else\n {\n if (this.goal - this.miss > y.goal - y.miss)\n {\n return 1;\n }\n else\n {\n if (this.goal - this.miss == y.goal - y.miss)\n {\n if (this.goal > y.goal)\n {\n return 1;\n }\n else\n {\n if (this.goal == y.goal)\n {\n if (this.name.CompareTo(y.name) > 0)\n return 1;\n else\n return -1;\n }\n else\n {\n return -1;\n }\n }\n\n }\n else\n {\n return -1;\n }\n }\n }\n }\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 Team[] t = new Team[4];\n for (int i = 0; i < 5; i++)\n {\n string[] input = ReadArray();\n string[] score = input[2].Split(':');\n int x = int.Parse(score[0]);\n int y = int.Parse(score[1]);\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[0];\n }\n if (t[j].name.Equals(input[0]))\n {\n if (x > y) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += x;\n t[j].miss += y;\n t[j].cnt++;\n break;\n }\n\n }\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[1];\n }\n if (t[j].name.Equals(input[1]))\n {\n if (y > x) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += y;\n t[j].miss += x;\n t[j].cnt++;\n break;\n }\n }\n }\n int opp = 0;\n int ans = 0;\n for (int i = 0; i < 4; i++)\n {\n if (t[i].name.Equals(\"BERLAND\"))\n {\n t[i].point += 3;\n t[i].goal++;\n ans++;\n\n }\n if (!t[i].name.Equals(\"BERLAND\") && t[i].cnt == 2)\n {\n t[i].miss++;\n }\n }\n\n Team[] L = new Team[4];\n Team[] R = new Team[4];\n ArrayUtils.Merge_Sort(t, 0, 3, L, R);\n for (int i = 0; i < 4; i++)\n if (!t[i].name.Equals(\"BERLAND\") && t[i].cnt == 2)\n opp = i;\n for (int i = 0; i < 4; i++)\n {\n if (t[i].name.Equals(\"BERLAND\"))\n {\n if (i >= 2)\n {\n Console.WriteLine(\"1:0\");\n return;\n }\n for (int j = i + 1; j < 3; j++)\n {\n if (t[j].point > t[i].point && j <= 2)\n {\n Console.WriteLine(\"IMPOSSIBLE\");\n return;\n }\n else\n {\n while (t[i].CompareTo(t[j]) < 0)\n {\n t[i].goal++;\n ans++;\n t[opp].miss++;\n }\n }\n }\n Console.WriteLine(ans + \":0\");\n }\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 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\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\n public Graph(int n)\n {\n g = new List[n + 1];\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\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 void DFS(int u, ref int time, Graph g)\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] == white)\n {\n g.p[v] = u;\n DFS(v, ref time, g);\n }\n }\n g.color[u] = black;\n g.c[u] = time;\n time++;\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "62e4f4684aa518c51bf7cdd96b3de21a", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\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 Team : IComparable\n {\n public string name;\n public int goal;\n public int miss;\n public int point;\n public int cnt;\n public int CompareTo(Team y)\n {\n if (this.point > y.point)\n {\n return 1;\n }\n else\n {\n if (this.goal - this.miss > y.goal - y.miss)\n {\n return 1;\n }\n else\n {\n if (this.goal - this.miss == y.goal - y.miss)\n {\n if (this.goal > y.goal)\n {\n return 1;\n }\n else\n {\n if (this.goal == y.goal)\n {\n if (this.name.CompareTo(y.name) > 0)\n return 1;\n else\n return -1;\n }\n else\n {\n return -1;\n }\n }\n\n }\n else\n {\n return -1;\n }\n }\n }\n }\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 Team[] t = new Team[4];\n for (int i = 0; i < 5; i++)\n {\n string[] input = ReadArray();\n string[] score = input[2].Split(':');\n int x = int.Parse(score[0]);\n int y = int.Parse(score[1]);\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[0];\n }\n if (t[j].name.Equals(input[0]))\n {\n if (x > y) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += x;\n t[j].miss += y;\n t[j].cnt++;\n break;\n }\n\n }\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[1];\n }\n if (t[j].name.Equals(input[1]))\n {\n if (y > x) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += y;\n t[j].miss += x;\n t[j].cnt++;\n break;\n }\n }\n }\n int opp = 0;\n for (int i = 0; i < 4; i++)\n {\n if (t[i].name.Equals(\"BERLAND\"))\n {\n t[i].point += 3;\n t[i].goal++;\n\n }\n if (!t[i].name.Equals(\"BERLAND\") && t[i].cnt == 2)\n {\n opp = i;\n t[i].miss++;\n }\n }\n\n Team[] L = new Team[4];\n Team[] R = new Team[4];\n ArrayUtils.Merge_Sort(t, 0, 3, L, R);\n for (int i = 0; i < 4; i++)\n {\n if (t[i].name.Equals(\"BERLAND\"))\n {\n if (i >= 2)\n {\n Console.WriteLine(\"1:0\");\n return;\n }\n for (int j = i + 1; j < 3; j++)\n {\n if (t[j].point > t[i].point && j <= 2)\n {\n Console.WriteLine(\"IMPOSSIBLE\");\n return;\n }\n else\n {\n while (t[i].CompareTo(t[j]) < 0)\n {\n t[i].goal++;\n t[opp].miss++;\n }\n }\n }\n Console.WriteLine(t[i].goal + \":0\");\n }\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 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\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\n public Graph(int n)\n {\n g = new List[n + 1];\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\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 void DFS(int u, ref int time, Graph g)\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] == white)\n {\n g.p[v] = u;\n DFS(v, ref time, g);\n }\n }\n g.color[u] = black;\n g.c[u] = time;\n time++;\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aa4ce25d60c46aed7c6cf44d8baa511b", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\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 Team : IComparable\n {\n public string name;\n public int goal;\n public int miss;\n public int point;\n public int cnt;\n public int CompareTo(Team y)\n {\n if (this.point > y.point)\n {\n return 1;\n }\n else\n {\n if (this.point == y.point)\n {\n if (this.goal - this.miss > y.goal - y.miss)\n {\n return 1;\n }\n else\n {\n if (this.goal - this.miss == y.goal - y.miss)\n {\n if (this.goal > y.goal)\n {\n return 1;\n }\n else\n {\n if (this.goal == y.goal)\n {\n if (this.name.CompareTo(y.name) < 0)\n return 1;\n else\n return -1;\n }\n else\n {\n return -1;\n }\n }\n\n }\n else\n {\n return -1;\n }\n }\n }\n else\n {\n return -1;\n }\n }\n }\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 Team[] t = new Team[4];\n for (int i = 0; i < 5; i++)\n {\n string[] input = ReadArray();\n string[] score = input[2].Split(':');\n int x = int.Parse(score[0]);\n int y = int.Parse(score[1]);\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[0];\n }\n if (t[j].name.Equals(input[0]))\n {\n if (x > y) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += x;\n t[j].miss += y;\n t[j].cnt++;\n break;\n }\n\n }\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[1];\n }\n if (t[j].name.Equals(input[1]))\n {\n if (y > x) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += y;\n t[j].miss += x;\n t[j].cnt++;\n break;\n }\n }\n }\n int opp = 0;\n int ans = 0;\n for (int i = 0; i < 4; i++)\n {\n if (t[i].name.Equals(\"BERLAND\"))\n {\n t[i].point += 3;\n t[i].goal++;\n ans++;\n\n }\n if (!t[i].name.Equals(\"BERLAND\") && t[i].cnt == 2)\n {\n t[i].miss++;\n }\n }\n\n Team[] L = new Team[4];\n Team[] R = new Team[4];\n ArrayUtils.Merge_Sort(t, 0, 3, L, R);\n for (int i = 0; i < 4; i++)\n if (!t[i].name.Equals(\"BERLAND\") && t[i].cnt == 2)\n opp = i;\n for (int i = 0; i < 4; i++)\n {\n if (t[i].name.Equals(\"BERLAND\"))\n {\n if (i >= 2)\n {\n Console.WriteLine(\"1:0\");\n return;\n }\n for (int j = i + 1; j < 3; j++)\n {\n if (t[j].point > t[i].point && j <= 2)\n {\n Console.WriteLine(\"IMPOSSIBLE\");\n return;\n }\n else\n {\n while (t[i].CompareTo(t[j]) < 0)\n {\n t[i].goal++;\n ans++;\n t[opp].miss++;\n }\n }\n }\n int ans1 = 0;\n int comp = 1;\n while (comp > 0)\n {\n t[opp].goal++;\n t[i].miss++;\n for (int j = 0; j < 3; j++)\n {\n if (j == i) continue;\n if (t[i].CompareTo(t[j]) < 0)\n comp = -1;\n }\n if (comp > 0)\n {\n ans1++;\n }\n }\n Console.WriteLine(ans + \":\" + ans1);\n }\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 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\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\n public Graph(int n)\n {\n g = new List[n + 1];\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\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 void DFS(int u, ref int time, Graph g)\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] == white)\n {\n g.p[v] = u;\n DFS(v, ref time, g);\n }\n }\n g.color[u] = black;\n g.c[u] = time;\n time++;\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "47b627bf7a9d9db36874bd421658f22c", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\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 Team : IComparable\n {\n public string name;\n public int goal;\n public int miss;\n public int point;\n public int cnt;\n public int CompareTo(Team y)\n {\n if (this.point > y.point)\n {\n return 1;\n }\n else\n {\n if (this.point == y.point)\n {\n if (this.goal - this.miss > y.goal - y.miss)\n {\n return 1;\n }\n else\n {\n if (this.goal - this.miss == y.goal - y.miss)\n {\n if (this.goal > y.goal)\n {\n return 1;\n }\n else\n {\n if (this.goal == y.goal)\n {\n if (this.name.CompareTo(y.name) < 0)\n return 1;\n else\n return -1;\n }\n else\n {\n return -1;\n }\n }\n\n }\n else\n {\n return -1;\n }\n }\n }\n else\n {\n return -1;\n }\n }\n }\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 Team[] t = new Team[4];\n for (int i = 0; i < 5; i++)\n {\n string[] input = ReadArray();\n string[] score = input[2].Split(':');\n int x = int.Parse(score[0]);\n int y = int.Parse(score[1]);\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[0];\n }\n if (t[j].name.Equals(input[0]))\n {\n if (x > y) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += x;\n t[j].miss += y;\n t[j].cnt++;\n break;\n }\n\n }\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[1];\n }\n if (t[j].name.Equals(input[1]))\n {\n if (y > x) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += y;\n t[j].miss += x;\n t[j].cnt++;\n break;\n }\n }\n }\n\n int ans = 0;\n int _ans = 0;\n for (int i = 0; i < 4; i++)\n {\n if (t[i].name.Equals(\"BERLAND\"))\n {\n t[i].point += 3;\n t[i].goal++;\n ans++;\n }\n else if (t[i].cnt == 2)\n {\n t[i].miss++;\n }\n }\n\n Team[] L = new Team[4];\n Team[] R = new Team[4];\n ArrayUtils.Merge_Sort(t, 0, 3, L, R);\n\n int opp = 0;\n for (int i = 0; i < 4; i++)\n if (!t[i].name.Equals(\"BERLAND\") && t[i].cnt == 2)\n opp = i;\n\n for (int i = 0; i < 4; i++)\n {\n if (!t[i].name.Equals(\"BERLAND\")) continue;\n\n if (i >= 2)\n {\n Console.WriteLine(\"1:0\");\n return;\n }\n if (t[i].point < t[2].point)\n {\n Console.WriteLine(\"IMPOSSIBLE\");\n return;\n }\n for (int j = 0; j < 3; j++)\n {\n if (j == i) continue;\n while (t[i].CompareTo(t[j]) < 0)\n {\n t[i].goal++;\n t[opp].miss++;\n ans++;\n }\n }\n while (true)\n {\n int comp = 1;\n for (int j = 0; j < 3; j++)\n {\n if (j == i) continue;\n if ((t[i].goal - t[i].miss) - (t[j].goal - t[j].miss) <= 0 && t[i].point == t[j].point)\n comp = -1;\n }\n if (comp > 0)\n {\n t[i].miss++;\n t[opp].goal++;\n _ans++;\n }\n else\n {\n break;\n }\n }\n\n if (t[i].CompareTo(t[opp]) < 0)\n {\n t[i].miss--;\n t[opp].goal--;\n _ans--;\n }\n for (int j = 0; j < 3; j++)\n {\n if (i == j) continue;\n if ((t[i].goal - t[i].miss) - (t[j].goal - t[j].miss) == 0 && t[j].goal > t[i].goal)\n {\n int dif = (t[j].goal - t[i].goal) + (t[i].name.CompareTo(t[j].name) < 0 ? 0 : 1);\n ans += dif;\n _ans += dif;\n t[i].goal += dif;\n t[opp].goal += dif;\n t[i].miss += dif;\n t[opp].miss += dif;\n }\n }\n if (ans == _ans)\n _ans--;\n Console.WriteLine(ans + \":\" + _ans);\n\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 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\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\n public Graph(int n)\n {\n g = new List[n + 1];\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\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 void DFS(int u, ref int time, Graph g)\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] == white)\n {\n g.p[v] = u;\n DFS(v, ref time, g);\n }\n }\n g.color[u] = black;\n g.c[u] = time;\n time++;\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "83112bfb40e8fb3aa4ba675847d072c8", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\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 Team : IComparable\n {\n public string name;\n public int goal;\n public int miss;\n public int point;\n public int cnt;\n public int CompareTo(Team y)\n {\n if (this.point > y.point)\n {\n return 1;\n }\n else\n {\n if (this.point == y.point)\n {\n if (this.goal - this.miss > y.goal - y.miss)\n {\n return 1;\n }\n else\n {\n if (this.goal - this.miss == y.goal - y.miss)\n {\n if (this.goal > y.goal)\n {\n return 1;\n }\n else\n {\n if (this.goal == y.goal)\n {\n if (this.name.CompareTo(y.name) < 0)\n return 1;\n else\n return -1;\n }\n else\n {\n return -1;\n }\n }\n\n }\n else\n {\n return -1;\n }\n }\n }\n else\n {\n return -1;\n }\n }\n }\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 Team[] t = new Team[4];\n for (int i = 0; i < 5; i++)\n {\n string[] input = ReadArray();\n string[] score = input[2].Split(':');\n int x = int.Parse(score[0]);\n int y = int.Parse(score[1]);\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[0];\n }\n if (t[j].name.Equals(input[0]))\n {\n if (x > y) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += x;\n t[j].miss += y;\n t[j].cnt++;\n break;\n }\n\n }\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[1];\n }\n if (t[j].name.Equals(input[1]))\n {\n if (y > x) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += y;\n t[j].miss += x;\n t[j].cnt++;\n break;\n }\n }\n }\n\n int ans = 0;\n int _ans = 0;\n for (int i = 0; i < 4; i++)\n {\n if (t[i].name.Equals(\"BERLAND\"))\n {\n t[i].point += 3;\n t[i].goal++;\n ans++;\n }\n else if (t[i].cnt == 2)\n {\n t[i].miss++;\n }\n }\n\n Team[] L = new Team[4];\n Team[] R = new Team[4];\n ArrayUtils.Merge_Sort(t, 0, 3, L, R);\n\n int opp = 0;\n for (int i = 0; i < 4; i++)\n if (!t[i].name.Equals(\"BERLAND\") && t[i].cnt == 2)\n opp = i;\n\n for (int i = 0; i < 4; i++)\n {\n if (!t[i].name.Equals(\"BERLAND\")) continue;\n\n if (i >= 2)\n {\n Console.WriteLine(\"1:0\");\n return;\n }\n if (t[i].point < t[2].point)\n {\n Console.WriteLine(\"IMPOSSIBLE\");\n return;\n }\n for (int j = 0; j < 3; j++)\n {\n if (j == i) continue;\n while (t[i].CompareTo(t[j]) < 0)\n {\n t[i].goal++;\n t[opp].miss++;\n ans++;\n }\n }\n while (true)\n {\n int comp = 1;\n for (int j = 0; j < 3; j++)\n {\n if (j == i) continue;\n if ((t[i].goal - t[i].miss) - (t[j].goal - t[j].miss) <= 0 && t[i].point == t[j].point)\n comp = -1;\n }\n if (comp > 0)\n {\n t[i].miss++;\n t[opp].goal++;\n _ans++;\n }\n else\n {\n break;\n }\n }\n\n if (t[i].CompareTo(t[opp]) < 0)\n {\n t[i].miss--;\n t[opp].goal--;\n _ans--;\n }\n for (int j = 0; j < 3; j++)\n {\n if (i == j) continue;\n if ((t[i].goal - t[i].miss) - (t[j].goal - t[j].miss) == 0 && t[j].goal > t[i].goal)\n {\n int dif = (t[j].goal - t[i].goal) + 1;\n ans += dif;\n _ans += dif;\n t[i].goal += dif;\n t[opp].goal += dif;\n t[i].miss += dif;\n t[opp].miss += dif;\n }\n }\n if (ans == _ans)\n _ans--;\n Console.WriteLine(ans + \":\" + _ans);\n\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 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\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\n public Graph(int n)\n {\n g = new List[n + 1];\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\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 void DFS(int u, ref int time, Graph g)\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] == white)\n {\n g.p[v] = u;\n DFS(v, ref time, g);\n }\n }\n g.color[u] = black;\n g.c[u] = time;\n time++;\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e683d0473fec7993d0b7c278a9103f7a", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\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 Team : IComparable\n {\n public string name;\n public int goal;\n public int miss;\n public int point;\n public int cnt;\n public int CompareTo(Team y)\n {\n if (this.point > y.point)\n {\n return 1;\n }\n else\n {\n if (this.point == y.point)\n {\n if (this.goal - this.miss > y.goal - y.miss)\n {\n return 1;\n }\n else\n {\n if (this.goal - this.miss == y.goal - y.miss)\n {\n if (this.goal > y.goal)\n {\n return 1;\n }\n else\n {\n if (this.goal == y.goal)\n {\n if (this.name.CompareTo(y.name) < 0)\n return 1;\n else\n return -1;\n }\n else\n {\n return -1;\n }\n }\n\n }\n else\n {\n return -1;\n }\n }\n }\n else\n {\n return -1;\n }\n }\n }\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 Team[] t = new Team[4];\n for (int i = 0; i < 5; i++)\n {\n string[] input = ReadArray();\n string[] score = input[2].Split(':');\n int x = int.Parse(score[0]);\n int y = int.Parse(score[1]);\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[0];\n }\n if (t[j].name.Equals(input[0]))\n {\n if (x > y) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += x;\n t[j].miss += y;\n t[j].cnt++;\n break;\n }\n\n }\n for (int j = 0; j < 4; j++)\n {\n if (t[j] == null)\n {\n t[j] = new Team();\n t[j].name = input[1];\n }\n if (t[j].name.Equals(input[1]))\n {\n if (y > x) t[j].point += 3;\n if (x == y) t[j].point++;\n t[j].goal += y;\n t[j].miss += x;\n t[j].cnt++;\n break;\n }\n }\n }\n\n for (int i = 0; i < 4; i++)\n if (t[i].name.Equals(\"BERLAND\"))\n t[i].point += 3;\n\n Team[] L = new Team[4];\n Team[] R = new Team[4];\n ArrayUtils.Merge_Sort(t, 0, 3, L, R);\n\n int ber, opp;\n ber = opp = 0;\n for (int i = 0; i < 4; i++)\n {\n if (t[i].name.Equals(\"BERLAND\"))\n {\n ber = i;\n }\n else if (t[i].cnt == 2)\n {\n opp = i;\n }\n }\n\n int dif_max = int.MinValue;\n int goal_max = int.MinValue;\n for (int i = 0; i < 4; i++)\n {\n if (i == ber) continue;\n dif_max = Math.Max(t[i].goal - t[i].miss + Math.Abs(t[ber].goal - t[ber].miss), dif_max);\n goal_max = Math.Max(t[i].goal, goal_max);\n }\n for (int i = 1; i <= dif_max; i++)\n {\n\n for (int j = i; j <= goal_max + 1; j++)\n {\n int comp = 0;\n t[opp].goal += j - i;\n t[opp].miss += j;\n t[ber].goal += j;\n t[ber].miss += j - i;\n for (int z = 0; z < 4; z++)\n {\n if (z == ber) continue;\n if (t[ber].CompareTo(t[z]) > 0)\n comp++;\n }\n if (comp >= 2)\n {\n Console.WriteLine(j + \":\" + (j - i));\n return;\n }\n else\n {\n t[opp].goal -= j - i;\n t[opp].miss -= j;\n t[ber].goal -= j;\n t[ber].miss -= j - i;\n }\n }\n }\n Console.WriteLine(\"IMPOSSIBLE\");\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 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\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\n public Graph(int n)\n {\n g = new List[n + 1];\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\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 void DFS(int u, ref int time, Graph g)\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] == white)\n {\n g.p[v] = u;\n DFS(v, ref time, g);\n }\n }\n g.color[u] = black;\n g.c[u] = time;\n time++;\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ab7e076b29c253783a799df794653a6a", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace King_s_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 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 long x = Next(), y = Next();\n double ans;\n if (k == n + 1)\n {\n int min = nn.Min();\n int max = nn.Max();\n ans = max - min + Math.Min(Math.Sqrt((x - min)*(x - min) + y*y), Math.Sqrt((x - max)*(x - max) + y*y));\n }\n else\n {\n int xx = nn[k - 1];\n\n ans = GM(nn, x, y, xx);\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = - nn[i];\n }\n x = - x;\n xx = - xx;\n ans = Math.Min(ans, GM(nn, x, y, xx));\n\n Array.Sort(nn);\n int min = nn[0];\n int max = nn[n - 1];\n for (int i = 0; i < n; i++)\n {\n if (xx > nn[i])\n {\n ans = Math.Min(ans, nn[i] - min + Math.Sqrt((x - nn[i])*(x - nn[i]) + y*y)\n + Math.Sqrt((x - nn[i + 1])*(x - nn[i + 1]) + y*y)\n + max - nn[i + 1] + max - xx);\n ans = Math.Min(ans, nn[i] - min + Math.Sqrt((x - nn[i])*(x - nn[i]) + y*y)\n + Math.Sqrt((x - max)*(x - max) + y*y)\n + max - nn[i + 1] + xx - nn[i + 1]);\n }\n else if (xx < nn[i])\n {\n ans = Math.Min(ans, max - nn[i] + Math.Sqrt((x - nn[i])*(x - nn[i]) + y*y)\n + Math.Sqrt((x - nn[i - 1])*(x - nn[i - 1]) + y*y)\n + nn[i - 1] - min + xx - min);\n ans = Math.Min(ans, max - nn[i] + Math.Sqrt((x - nn[i])*(x - nn[i]) + y*y)\n + Math.Sqrt((x - min)*(x - min) + y*y)\n + nn[i - 1] - min + nn[i - 1] - xx);\n }\n }\n }\n\n writer.WriteLine(ans.ToString(\"#0.0000000\", CultureInfo.InvariantCulture));\n writer.Flush();\n }\n\n private static double GM(int[] nn, long x, long y, int xx)\n {\n double ans;\n\n int min = nn.Min();\n int max = nn.Max();\n\n // ___/___\\\n if (xx == min)\n {\n ans = max - xx + Math.Sqrt((x - max)*(x - max) + y*y);\n }\n else\n {\n int mix = nn.Where(e => e < xx).Max();\n ans = max - xx + Math.Sqrt((x - max)*(x - max) + y*y)\n + Math.Sqrt((x - mix)*(x - mix) + y*y) + mix - min;\n }\n\n // <- ->\\\n if (xx != min)\n {\n ans = Math.Min(ans, xx - min + max - min + Math.Sqrt((x - max)*(x - max) + y*y));\n }\n\n if (xx < x && xx != max)\n {\n int max1 = nn.Where(e => e < x).Max();\n int max2 = nn.Where(e => e <= x).Max();\n\n List lmax1 = nn.Where(e => e > max1).ToList();\n if (lmax1.Any())\n {\n int nmax1 = lmax1.Min();\n ans = Math.Min(ans, xx - min + max1 - min + Math.Sqrt((x - max1)*(x - max1) + y*y) +\n Math.Sqrt((x - nmax1)*(x - nmax1) + y*y) + max - nmax1);\n\n if (max1 != max2)\n {\n List lmax2 = nn.Where(e => e > max2).ToList();\n if (lmax2.Any())\n {\n int nmax2 = lmax2.Min();\n ans = Math.Min(ans, xx - min + max2 - min + Math.Sqrt((x - max2)*(x - max2) + y*y) +\n Math.Sqrt((x - nmax2)*(x - nmax2) + y*y) + max - nmax2);\n }\n }\n }\n }\n\n\n return ans;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a4b4d4565a281d62e197b4d1615aff0b", "src_uid": "f9ed5faca211e654d9d4e0a7557616f4", "difficulty": 2600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace King_s_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 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 long x = Next(), y = Next();\n double ans;\n if (k == n + 1)\n {\n int min = nn.Min();\n int max = nn.Max();\n ans = max - min + Math.Min(Math.Sqrt((x - min)*(x - min) + y*y), Math.Sqrt((x - max)*(x - max) + y*y));\n }\n else\n {\n int xx = nn[k - 1];\n\n ans = GM(nn, x, y, xx);\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = - nn[i];\n }\n x = - x;\n xx = - xx;\n ans = Math.Min(ans, GM(nn, x, y, xx));\n }\n\n writer.WriteLine(ans.ToString(\"#0.0000000\", CultureInfo.InvariantCulture));\n writer.Flush();\n }\n\n private static double GM(int[] nn, long x, long y, int xx)\n {\n double ans;\n\n int min = nn.Min();\n int max = nn.Max();\n\n // ___/___\\\n if (xx == min)\n {\n ans = max - xx + Math.Sqrt((x - max)*(x - max) + y*y);\n }\n else\n {\n int mix = nn.Where(e => e < xx).Max();\n ans = max - xx + Math.Sqrt((x - max)*(x - max) + y*y)\n + Math.Sqrt((x - mix)*(x - mix) + y*y) + mix - min;\n }\n\n // <- ->\\\n if (xx != min)\n {\n ans = Math.Min(ans, xx - min + max - min + Math.Sqrt((x - max)*(x - max) + y*y));\n }\n\n if (xx < x && xx != max)\n {\n int max1 = nn.Where(e => e < x).Max();\n int max2 = nn.Where(e => e <= x).Max();\n\n List lmax1 = nn.Where(e => e > max1).ToList();\n if (lmax1.Any())\n {\n int nmax1 = lmax1.Min();\n ans = Math.Min(ans, xx - min + max1 - min + Math.Sqrt((x - max1)*(x - max1) + y*y) +\n Math.Sqrt((x - nmax1)*(x - nmax1) + y*y) + max - nmax1);\n\n if (max1 != max2)\n {\n List lmax2 = nn.Where(e => e > max2).ToList();\n if (lmax2.Any())\n {\n int nmax2 = lmax2.Min();\n ans = Math.Min(ans, xx - min + max2 - min + Math.Sqrt((x - max2)*(x - max2) + y*y) +\n Math.Sqrt((x - nmax2)*(x - nmax2) + y*y) + max - nmax2);\n }\n }\n }\n }\n\n return ans;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4e448b920dbf6dcd28ac95562e93eca9", "src_uid": "f9ed5faca211e654d9d4e0a7557616f4", "difficulty": 2600.0} {"lang": "MS C#", "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 class Heap\n {\n private readonly List data;\n private readonly Comparison compare;\n\n public Heap(Comparison compare)\n {\n this.compare = compare;\n data = new List { default(T) };\n }\n\n public int Count\n {\n get { return data.Count - 1; }\n }\n\n public T Peek()\n {\n return data[1];\n }\n\n public void Push(T item)\n {\n data.Add(item);\n var curPlace = Count;\n while (curPlace > 1 && compare(item, data[curPlace / 2]) < 0)\n {\n data[curPlace] = data[curPlace / 2];\n data[curPlace / 2] = item;\n curPlace /= 2;\n }\n }\n\n public T Pop()\n {\n var ret = data[1];\n data[1] = data[Count];\n data.RemoveAt(Count);\n var curPlace = 1;\n while (true)\n {\n var max = curPlace;\n if (Count >= curPlace * 2 && compare(data[max], data[2 * curPlace]) > 0)\n max = 2 * curPlace;\n if (Count >= curPlace * 2 + 1 && compare(data[max], data[2 * curPlace + 1]) > 0)\n max = 2 * curPlace + 1;\n if (max == curPlace)\n break;\n var item = data[max];\n data[max] = data[curPlace];\n data[curPlace] = item;\n curPlace = max;\n }\n\n return ret;\n }\n }\n\n class Edge\n {\n public int to;\n public double weight;\n public Edge(int to, double weight)\n {\n this.to = to;\n this.weight = weight;\n }\n }\n\n double[] Dijkstra(int start, List[] edges)\n {\n int n = edges.Length;\n var dist = Enumerable.Repeat(double.MaxValue / 2, n).ToArray();\n dist[start] = 0;\n\n var q = new Heap>((x, y) => x.Value.CompareTo(y.Value));\n q.Push(new KeyValuePair(start, 0));\n\n while (q.Count > 0)\n {\n var t = q.Pop();\n if (t.Value != dist[t.Key])\n continue;\n\n foreach (var e in edges[t.Key])\n {\n var ndist = e.weight + t.Value;\n if (dist[e.to] > ndist)\n {\n dist[e.to] = ndist;\n q.Push(new KeyValuePair(e.to, ndist));\n }\n }\n }\n\n return dist;\n }\n\n bool NextPerm(int[] a)\n {\n int n = a.Length;\n for (int 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 double Dist(int x1, int y1, int x2, int y2)\n {\n return Math.Sqrt(1L * (x1 - x2) * (x1 - x2) + 1L * (y1 - y2) * (y1 - y2));\n }\n\n public void Solve()\n {\n int n = ReadInt(), m = ReadInt() - 1;\n var x = ReadIntArray();\n int xn = x[n], yn = ReadInt();\n\n int xm = m < n ? x[m] : 0;\n Array.Sort(x, 0, n);\n if (m < n)\n for (int i = 0; i < n; i++)\n if (x[i] == xm)\n m = i;\n\n var o = new HashSet { m, n, 0, n - 1 };\n for (int i = 0; i + 1 < n; i++)\n {\n if (x[i] == xn)\n {\n o.Add(i);\n if (i > 0)\n o.Add(i - 1);\n o.Add(i + 1);\n }\n else if (x[i] < xn && x[i + 1] > xn)\n {\n o.Add(i);\n o.Add(i + 1);\n }\n }\n\n var g = Init>(n + 1);\n for (int i = 0; i < n; i++)\n {\n if (i > 0)\n g[i].Add(new Edge(i - 1, Dist(x[i], 0, x[i - 1], 0)));\n if (i + 1 < n)\n g[i].Add(new Edge(i + 1, Dist(x[i], 0, x[i + 1], 0)));\n g[i].Add(new Edge(n, Dist(x[i], 0, xn, yn)));\n g[n].Add(new Edge(i, Dist(x[i], 0, xn, yn)));\n }\n\n var d = new double[n + 1][];\n var p = o.ToArray();\n Array.Sort(p);\n foreach (int v in p)\n d[v] = Dijkstra(v, g);\n\n double ans = double.MaxValue;\n do\n {\n if (p[0] != m)\n continue;\n double sum = 0;\n for (int i = 1; i < p.Length; i++)\n sum += d[p[i - 1]][p[i]];\n ans = Math.Min(ans, sum);\n } while (NextPerm(p));\n\n Write(ans.ToString(CultureInfo.InvariantCulture));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d802dbc855ffc2b7811ca638cfe76721", "src_uid": "f9ed5faca211e654d9d4e0a7557616f4", "difficulty": 2600.0} {"lang": "MS C#", "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 class Heap\n {\n private readonly List data;\n private readonly Comparison compare;\n\n public Heap(Comparison compare)\n {\n this.compare = compare;\n data = new List { default(T) };\n }\n\n public int Count\n {\n get { return data.Count - 1; }\n }\n\n public T Peek()\n {\n return data[1];\n }\n\n public void Push(T item)\n {\n data.Add(item);\n var curPlace = Count;\n while (curPlace > 1 && compare(item, data[curPlace / 2]) < 0)\n {\n data[curPlace] = data[curPlace / 2];\n data[curPlace / 2] = item;\n curPlace /= 2;\n }\n }\n\n public T Pop()\n {\n var ret = data[1];\n data[1] = data[Count];\n data.RemoveAt(Count);\n var curPlace = 1;\n while (true)\n {\n var max = curPlace;\n if (Count >= curPlace * 2 && compare(data[max], data[2 * curPlace]) > 0)\n max = 2 * curPlace;\n if (Count >= curPlace * 2 + 1 && compare(data[max], data[2 * curPlace + 1]) > 0)\n max = 2 * curPlace + 1;\n if (max == curPlace)\n break;\n var item = data[max];\n data[max] = data[curPlace];\n data[curPlace] = item;\n curPlace = max;\n }\n\n return ret;\n }\n }\n\n class Edge\n {\n public int to;\n public double weight;\n public Edge(int to, double weight)\n {\n this.to = to;\n this.weight = weight;\n }\n }\n\n double[] Dijkstra(int start, List[] edges)\n {\n int n = edges.Length;\n var dist = Enumerable.Repeat(double.MaxValue / 2, n).ToArray();\n dist[start] = 0;\n\n var q = new Heap>((x, y) => x.Value.CompareTo(y.Value));\n q.Push(new KeyValuePair(start, 0));\n\n while (q.Count > 0)\n {\n var t = q.Pop();\n if (t.Value != dist[t.Key])\n continue;\n\n foreach (var e in edges[t.Key])\n {\n var ndist = e.weight + t.Value;\n if (dist[e.to] > ndist)\n {\n dist[e.to] = ndist;\n q.Push(new KeyValuePair(e.to, ndist));\n }\n }\n }\n\n return dist;\n }\n\n bool NextPerm(int[] a)\n {\n int n = a.Length;\n for (int 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 double Dist(int x1, int y1, int x2, int y2)\n {\n return Math.Sqrt(1L * (x1 - x2) * (x1 - x2) + 1L * (y1 - y2) * (y1 - y2));\n }\n\n public void Solve()\n {\n int n = ReadInt(), m = ReadInt() - 1;\n var x = ReadIntArray();\n int xn = x[n], yn = ReadInt();\n\n int xm = m < n ? x[m] : 0;\n Array.Sort(x, 0, n);\n if (m < n)\n for (int i = 0; i < n; i++)\n if (x[i] == xm)\n m = i;\n\n var o = new HashSet { m, n, 0, n - 1 };\n for (int i = 0; i + 1 < n; i++)\n {\n if (x[i] == xn)\n {\n o.Add(i);\n if (i > 0)\n o.Add(i - 1);\n o.Add(i + 1);\n }\n else if (x[i] < xn && x[i + 1] > xn)\n {\n o.Add(i);\n o.Add(i + 1);\n }\n }\n if (m > 0)\n o.Add(m - 1);\n if (m + 1 < n)\n o.Add(m + 1);\n\n var g = Init>(n + 1);\n for (int i = 0; i < n; i++)\n {\n if (i > 0)\n g[i].Add(new Edge(i - 1, Dist(x[i], 0, x[i - 1], 0)));\n if (i + 1 < n)\n g[i].Add(new Edge(i + 1, Dist(x[i], 0, x[i + 1], 0)));\n g[i].Add(new Edge(n, Dist(x[i], 0, xn, yn)));\n g[n].Add(new Edge(i, Dist(x[i], 0, xn, yn)));\n }\n\n var d = new double[n + 1][];\n var p = o.ToArray();\n Array.Sort(p);\n foreach (int v in p)\n d[v] = Dijkstra(v, g);\n\n double ans = double.MaxValue;\n do\n {\n if (p[0] != m)\n continue;\n\n var f = new bool[n + 1];\n double sum = 0;\n for (int i = 1; i < p.Length; i++)\n {\n sum += d[p[i - 1]][p[i]];\n f[p[i - 1]] = f[p[i]] = true;\n if (p[i - 1] < n && p[i] < n)\n for (int j = Math.Min(p[i - 1], p[i]); j <= Math.Max(p[i - 1], p[i]); j++)\n f[j] = true;\n }\n if (f.All(ff => ff))\n ans = Math.Min(ans, sum);\n } while (NextPerm(p));\n\n Write(ans.ToString(CultureInfo.InvariantCulture));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "685561b8b7b546e1b350930e08e9a495", "src_uid": "f9ed5faca211e654d9d4e0a7557616f4", "difficulty": 2600.0} {"lang": "MS C#", "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 class Heap\n {\n private readonly List data;\n private readonly Comparison compare;\n\n public Heap(Comparison compare)\n {\n this.compare = compare;\n data = new List { default(T) };\n }\n\n public int Count\n {\n get { return data.Count - 1; }\n }\n\n public T Peek()\n {\n return data[1];\n }\n\n public void Push(T item)\n {\n data.Add(item);\n var curPlace = Count;\n while (curPlace > 1 && compare(item, data[curPlace / 2]) < 0)\n {\n data[curPlace] = data[curPlace / 2];\n data[curPlace / 2] = item;\n curPlace /= 2;\n }\n }\n\n public T Pop()\n {\n var ret = data[1];\n data[1] = data[Count];\n data.RemoveAt(Count);\n var curPlace = 1;\n while (true)\n {\n var max = curPlace;\n if (Count >= curPlace * 2 && compare(data[max], data[2 * curPlace]) > 0)\n max = 2 * curPlace;\n if (Count >= curPlace * 2 + 1 && compare(data[max], data[2 * curPlace + 1]) > 0)\n max = 2 * curPlace + 1;\n if (max == curPlace)\n break;\n var item = data[max];\n data[max] = data[curPlace];\n data[curPlace] = item;\n curPlace = max;\n }\n\n return ret;\n }\n }\n\n class Edge\n {\n public int to;\n public double weight;\n public Edge(int to, double weight)\n {\n this.to = to;\n this.weight = weight;\n }\n }\n\n double[] Dijkstra(int start, List[] edges)\n {\n int n = edges.Length;\n var dist = Enumerable.Repeat(double.MaxValue / 2, n).ToArray();\n dist[start] = 0;\n\n var q = new Heap>((x, y) => x.Value.CompareTo(y.Value));\n q.Push(new KeyValuePair(start, 0));\n\n while (q.Count > 0)\n {\n var t = q.Pop();\n if (t.Value != dist[t.Key])\n continue;\n\n foreach (var e in edges[t.Key])\n {\n var ndist = e.weight + t.Value;\n if (dist[e.to] > ndist)\n {\n dist[e.to] = ndist;\n q.Push(new KeyValuePair(e.to, ndist));\n }\n }\n }\n\n return dist;\n }\n\n bool NextPerm(int[] a)\n {\n int n = a.Length;\n for (int 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 double Dist(int x1, int y1, int x2, int y2)\n {\n return Math.Sqrt(1L * (x1 - x2) * (x1 - x2) + 1L * (y1 - y2) * (y1 - y2));\n }\n\n public void Solve()\n {\n int n = ReadInt(), m = ReadInt() - 1;\n var x = ReadIntArray();\n int xn = x[n], yn = ReadInt();\n\n int xm = m < n ? x[m] : 0;\n Array.Sort(x, 0, n);\n if (m < n)\n for (int i = 0; i < n; i++)\n if (x[i] == xm)\n m = i;\n\n var o = new HashSet { m, n, 0, n - 1 };\n for (int i = 0; i + 1 < n; i++)\n {\n if (x[i] == xn)\n {\n o.Add(i);\n if (i > 0)\n o.Add(i - 1);\n o.Add(i + 1);\n }\n else if (x[i] < xn && x[i + 1] > xn)\n {\n o.Add(i);\n o.Add(i + 1);\n }\n }\n if (m > 0)\n o.Add(m - 1);\n if (m + 1 < n)\n o.Add(m + 1);\n\n var g = Init>(n + 1);\n for (int i = 0; i < n; i++)\n {\n if (i > 0)\n g[i].Add(new Edge(i - 1, Dist(x[i], 0, x[i - 1], 0)));\n if (i + 1 < n)\n g[i].Add(new Edge(i + 1, Dist(x[i], 0, x[i + 1], 0)));\n g[i].Add(new Edge(n, Dist(x[i], 0, xn, yn)));\n g[n].Add(new Edge(i, Dist(x[i], 0, xn, yn)));\n }\n\n var d = new double[n + 1][];\n var p = o.ToArray();\n Array.Sort(p);\n foreach (int v in p)\n d[v] = Dijkstra(v, g);\n\n double ans = double.MaxValue;\n do\n {\n if (p[0] != m)\n continue;\n\n var f = new bool[n + 1];\n double sum = 0;\n for (int i = 1; i < p.Length; i++)\n {\n sum += d[p[i - 1]][p[i]];\n f[p[i - 1]] = f[p[i]] = true;\n if (p[i - 1] < n && p[i] < n)\n for (int j = Math.Min(p[i - 1], p[i]); j <= Math.Max(p[i - 1], p[i]); j++)\n f[j] = true;\n if (f.All(ff => ff))\n break;\n }\n if (f.All(ff => ff))\n ans = Math.Min(ans, sum);\n } while (NextPerm(p));\n\n Write(ans.ToString(CultureInfo.InvariantCulture));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0c877a396db41715a342d164f74fe2ef", "src_uid": "f9ed5faca211e654d9d4e0a7557616f4", "difficulty": 2600.0} {"lang": "MS C#", "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 s = ReadInt() - 1;\n var x = ReadIntArray();\n int y = ReadInt();\n\n if (s == n)\n {\n int min = x.Take(n).Min();\n int max = x.Take(n).Max();\n int sh = Math.Min(Math.Abs(x[n] - min), Math.Abs(x[n] - max));\n Write((Math.Sqrt(1L * y * y + 1L * sh * sh) + max - min).ToString(CultureInfo.InvariantCulture));\n return;\n }\n\n int xs = x[s];\n Array.Sort(x, 0, n);\n for (int i = 0; i < n; i++)\n if (x[i] == xs)\n s = i;\n\n var d = new double[n];\n for (int i = 0; i < n; i++)\n d[i] = Math.Sqrt(1L * (x[i] - x[n]) * (x[i] - x[n]) + 1L * y * y);\n\n double ans = d[s];\n int l = 0, r = n - 1;\n if (s == 0)\n l++;\n if (s == n - 1)\n r--;\n if (l <= r)\n ans += Math.Min(d[l], d[r]) + x[r] - x[l];\n\n for (int i = 0; i < n; i++)\n {\n if (i <= s)\n {\n l = 0;\n r = i - 1;\n double ex = 0;\n if (l <= r)\n ex = Math.Min(d[l], d[r]) + x[r] - x[l];\n ans = Math.Min(ans, x[s] - x[i] + x[n - 1] - x[i] + d[n - 1] + ex);\n ans = Math.Min(ans, x[n - 1] - x[s] + x[n - 1] - x[i] + d[i] + ex);\n }\n if (i >= s)\n {\n l = i + 1;\n r = n - 1;\n double ex = 0;\n if (l <= r)\n ex = Math.Min(d[l], d[r]) + x[r] - x[l];\n ans = Math.Min(ans, x[i] - x[s] + x[i] - x[0] + d[0] + ex);\n ans = Math.Min(ans, x[i] - x[0] + x[i] - x[0] + d[i] + ex);\n }\n }\n\n Write(ans.ToString(CultureInfo.InvariantCulture));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5b675c3f287c380b98a338c561225167", "src_uid": "f9ed5faca211e654d9d4e0a7557616f4", "difficulty": 2600.0} {"lang": "MS C#", "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 s = ReadInt() - 1;\n var x = ReadIntArray();\n int y = ReadInt();\n\n if (s == n)\n {\n int min = x.Take(n).Min();\n int max = x.Take(n).Max();\n int sh = Math.Min(Math.Abs(x[n] - min), Math.Abs(x[n] - max));\n Write((Math.Sqrt(1L * y * y + 1L * sh * sh) + max - min).ToString(CultureInfo.InvariantCulture));\n return;\n }\n\n int xs = x[s];\n Array.Sort(x, 0, n);\n for (int i = 0; i < n; i++)\n if (x[i] == xs)\n s = i;\n\n var d = new double[n];\n for (int i = 0; i < n; i++)\n d[i] = Math.Sqrt(1L * (x[i] - x[n]) * (x[i] - x[n]) + 1L * y * y);\n\n double ans = d[s];\n int l = 0, r = n - 1;\n if (s == 0)\n l++;\n if (s == n - 1)\n r--;\n if (l <= r)\n ans += Math.Min(d[l], d[r]) + x[r] - x[l];\n\n for (int i = 0; i < n; i++)\n {\n if (i <= s)\n {\n l = 0;\n r = i - 1;\n double v = x[s] - x[i] + x[n - 1] - x[i] + d[n - 1];\n if (l <= r)\n v += Math.Min(d[l], d[r]) + x[r] - x[l];\n ans = Math.Min(ans, v);\n }\n if (i >= s)\n {\n l = i + 1;\n r = n - 1;\n double v = x[i] - x[s] + x[i] - x[0] + d[0];\n if (l <= r)\n v += Math.Min(d[l], d[r]) + x[r] - x[l];\n ans = Math.Min(ans, v);\n }\n }\n\n Write(ans.ToString(CultureInfo.InvariantCulture));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ed396205686ee8adeae41a5ab228b31", "src_uid": "f9ed5faca211e654d9d4e0a7557616f4", "difficulty": 2600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace King_s_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 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 long x = Next(), y = Next();\n double ans;\n if (k == n + 1)\n {\n int min = nn.Min();\n int max = nn.Max();\n ans = max - min + Math.Min(Math.Sqrt((x - min)*(x - min) + y*y), Math.Sqrt((x - max)*(x - max) + y*y));\n }\n else\n {\n int xx = nn[k - 1];\n\n ans = GM(nn, x, y, xx);\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = 1000000 - nn[i];\n }\n x = 100000 - x;\n xx = 1000000 - xx;\n ans = Math.Min(ans, GM(nn, x, y, xx));\n }\n\n writer.WriteLine(ans.ToString(\"#0.0000000\", CultureInfo.InvariantCulture));\n writer.Flush();\n }\n\n private static double GM(int[] nn, long x, long y, int xx)\n {\n double ans;\n\n int min = nn.Min();\n int max = nn.Max();\n\n // ___/___\\\n if (xx == min)\n {\n ans = max - xx + Math.Sqrt((x - max)*(x - max) + y*y);\n }\n else\n {\n int mix = nn.Where(e => e < xx).Max();\n ans = max - xx + Math.Sqrt((x - max)*(x - max) + y*y)\n + Math.Sqrt((x - mix)*(x - mix) + y*y) + mix - min;\n }\n\n // <- ->\\\n if (xx != min)\n {\n ans = Math.Min(ans, xx - min + max - min + Math.Sqrt((x - max)*(x - max) + y*y));\n }\n\n if (xx < x && xx != max)\n {\n int max1 = nn.Where(e => e < x).Max();\n int max2 = nn.Where(e => e <= x).Max();\n\n List lmax1 = nn.Where(e => e > max1).ToList();\n if (lmax1.Any())\n {\n int nmax1 = lmax1.Min();\n ans = Math.Min(ans, xx - min + max1 - min + Math.Sqrt((x - max1)*(x - max1) + y*y) +\n Math.Sqrt((x - nmax1)*(x - nmax1) + y*y) + max - nmax1);\n\n if (max1 != max2)\n {\n List lmax2 = nn.Where(e => e > max2).ToList();\n if (lmax2.Any())\n {\n int nmax2 = lmax2.Min();\n ans = Math.Min(ans, xx - min + max2 - min + Math.Sqrt((x - max2)*(x - max2) + y*y) +\n Math.Sqrt((x - nmax2)*(x - nmax2) + y*y) + max - nmax2);\n }\n }\n }\n }\n\n return ans;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e96800d33ee8cead8fca6a8d849a9ec2", "src_uid": "f9ed5faca211e654d9d4e0a7557616f4", "difficulty": 2600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class HelloWorld {\n\n static int n;\n static int m;\n static int[] str;\n static int[,,] memo;\n static int[,] memoSol;\n\n public static void SolveCodeForces() {\n Console.ReadLine();\n str = Console.ReadLine().Select(c => c - 'a').ToArray();\n n = str.Length;\n m = str.Max()+1;\n\n memo = new int[n, n, m];\n for (var i = 0; i < n; i++)\n for (var j = 0; j < n; j++)\n for (var k = 0; k < m; k++)\n memo[i,j,k] = -1;\n\n memoSol = new int[n, n];\n for (var i = 0; i < n; i++)\n for (var j = 0; j < n; j++)\n memoSol[i,j] = -1;\n\n System.Console.WriteLine(Solve(0, n-1));\n }\n\n static int Solve(int i, int j) {\n if (i > j) return 0;\n if (i == j) return 1;\n if (memoSol[i, j] >= 0) return memoSol[i, j];\n\n var ans = 10000;\n for (var sym = 0; sym < m; sym++)\n ans = Math.Min(ans, SolveFun(i, j, sym));\n ans++;\n memoSol[i, j] = ans;\n return ans;\n }\n\n static int SolveFun(int i, int j, int sym) {\n if (i > j) return 0;\n if (i == j) return str[i] == sym ? 0 : 10000;\n if (memo[i,j,sym] >= 0) return memo[i,j,sym];\n\n var ans = 10000;\n\n for (var k = i; k <= j; k++) {\n if (str[k] == sym) {\n\n var fl = SolveFun(i, k-1, sym);\n var sl = Solve(i, k-1);\n\n var fr = SolveFun(k+1, j, sym);\n var sr = Solve(k+1, j);\n\n var sol =\n Math.Min(fl + fr,\n Math.Min(sl + sr,\n Math.Min(fl + sr,\n sl + fr)));\n\n ans = Math.Min(ans, sol);\n }\n }\n\n// System.Console.WriteLine(new { i, j, sym, ans });\n\n memo[i, j, sym] = ans;\n return ans;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a554c0ac4bcadf0735ce5d0297f62035", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "Mono C#", "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\n /// \n /// \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438.\n /// \u0414\u043e\u043b\u0436\u043d\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a.\n /// \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 true, \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430, \u0438\u043d\u0430\u0447\u0435 - false.\n /// \n bool NextPermutation(IList a)\n {\n var n = a.Count;\n for (int ind = n - 2; ind >= 0; ind--)\n if (a[ind] < a[ind + 1])\n for (int i = ind + 2; ; i++)\n if (i == n || a[ind] >= a[i])\n {\n swap(a, ind, i - 1);\n var m = (n - 1 - ind) >> 1;\n for (int j = 1; j <= m; j++)\n swap(a, ind + j, n - j);\n return true;\n }\n return false;\n }\n\n int tutu(int[,] a, List s, int from, int to)\n {\n if (a[from, to] == 0)\n {\n var res = int.MaxValue;\n\n if (s[from] == s[to])\n {\n res = tutu(a, s, from + 1, to);\n }\n else\n {\n for (int i = from; i < to; i++)\n {\n var l = tutu(a, s, from, i);\n var r = tutu(a, s, i + 1, to);\n var z = l + r;\n if (s[from] == s[i + 1] || s[i] == s[to])\n z--;\n res = Math.Min(res, z);\n }\n }\n a[from, to] = res;\n }\n return a[from, to];\n }\n\n\n //////////////////////////////////////////////////\n void Solution()\n {\n var n = ri;\n var s = rs;\n var a = new List(n) { s[0] };\n for (int i = 1; i < n; i++)\n if (s[i - 1] != s[i])\n a.Add(s[i]);\n\n var b = new int[n, n];\n for (int i = 0; i < n; i++)\n b[i, i] = 1;\n wln(tutu(b, a, 0, a.Count - 1));\n\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 void swap(IList a, int from, int to) { var buf = a[from]; a[from] = a[to]; a[to] = buf; }\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 // \u0427\u0438\u0442\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432\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 List(n);\n for (int i = 0; i < n; i++)\n res.Add(ri);\n return res;\n }\n List rla(int n)\n {\n var res = new List(n);\n for (int i = 0; i < n; i++)\n res.Add(rl);\n return res;\n }\n List rda(int n)\n {\n var res = new List(n);\n for (int i = 0; i < n; i++)\n res.Add(rd);\n return res;\n }\n // \u0427\u0438\u0442\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432\n List rsa(int n)\n {\n var res = new List(n);\n for (int i = 0; i < n; i++)\n res.Add(rs);\n return res;\n }\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1445d447c987ed1903e5e4f4d63e3de2", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Algorithm\n{\n class Program\n {\n static int N = 500;\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine();\n\t\t\tint[,] dp = new int[N, N];\n for (int i = 0; i < N; i++)\n {\n for (int j = 0; j < N; j++)\n {\n dp[i, j] = -1;\n }\n }\n Console.WriteLine(findMinimumDeletion(0, n - 1, dp, s));\n }\n\n \n static int findMinimumDeletion(int l, int r,\n int[,] dp, String s)\n {\n\n if (l > r)\n {\n return 0;\n }\n if (l == r)\n {\n return 1;\n }\n if (dp[l, r] != -1)\n {\n return dp[l, r];\n }\n\n // When a single character is deleted \n int res = 1 + findMinimumDeletion(l + 1, r, dp, s);\n\n // When a group of consecutive characters \n // are deleted if any of them matches \n for (int i = l + 1; i <= r; ++i)\n {\n\n // When both the characters are same then \n // delete the letters in between them \n if (s[l] == s[i])\n {\n res = Math.Min(res, findMinimumDeletion(l + 1, i - 1, dp, s)\n + findMinimumDeletion(i, r, dp, s));\n }\n }\n\n // Memoize \n return dp[l, r] = res;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "06da15cfbae607b5e65629519b2f555d", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "/*\ncsc -debug F.cs && mono --debug F.exe <<< \"5\nabaca\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class HelloWorld {\n\n static int n;\n static int m;\n static int[] str;\n static int[,,] memo;\n static int[,] memoSol;\n\n public static void SolveCodeForces() {\n Console.ReadLine();\n str = Console.ReadLine().Select(c => c - 'a').ToArray();\n n = str.Length;\n m = str.Max()+1;\n\n memo = new int[n, n, m];\n for (var i = 0; i < n; i++)\n for (var j = 0; j < n; j++)\n for (var k = 0; k < m; k++)\n memo[i,j,k] = -1;\n\n memoSol = new int[n, n];\n for (var i = 0; i < n; i++)\n for (var j = 0; j < n; j++)\n memoSol[i,j] = -1;\n\n System.Console.WriteLine(Solve(0, n-1));\n }\n\n static int Solve(int i, int j) {\n if (i > j) return 0;\n if (i == j) return 1;\n if (memoSol[i, j] >= 0) return memoSol[i, j];\n\n var ans = 10000;\n for (var sym = 0; sym < m; sym++)\n ans = Math.Min(ans, SolveFun(i, j, sym));\n ans++;\n memoSol[i, j] = ans;\n return ans;\n }\n\n static int SolveFun(int i, int j, int sym) {\n if (i > j) return 0;\n if (i == j) return str[i] == sym ? 0 : 10000;\n if (memo[i,j,sym] >= 0) return memo[i,j,sym];\n\n var ans = 10000;\n\n for (var k = i; k <= j; k++) {\n if (str[k] == sym) {\n\n var fl = SolveFun(i, k-1, sym);\n var sl = Solve(i, k-1);\n\n var fr = SolveFun(k+1, j, sym);\n var sr = Solve(k+1, j);\n\n var sol =\n Math.Min(fl + fr,\n Math.Min(sl + sr,\n Math.Min(fl + sr,\n sl + fr)));\n\n ans = Math.Min(ans, sol);\n }\n }\n\n// System.Console.WriteLine(new { i, j, sym, ans });\n\n memo[i, j, sym] = ans;\n return ans;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "81f19ccb18f7d4dbec84e19b8d5fa3e4", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "Mono C#", "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 Console.ReadLine();\n var str = Console.ReadLine();\n var s = str.ToList();\n \n var a = new int[s.Count, s.Count];\n var res = tutu(a, s, 0, s.Count - 1);\n Console.WriteLine(res);\n }\n\n // tutu(a, s, 0, s.Count - 1)\n static int tutu(int[,] a, List s, int from, int to)\n {\n if (a[from, to] == 0)\n {\n if (from == to)\n return 1;\n var res = int.MaxValue;\n\n if (s[from] == s[to])\n {\n res = tutu(a, s, from + 1, to);\n }\n else\n {\n for (int i = from; i < to; i++)\n {\n var z = tutu(a, s, from, i) + tutu(a, s, i + 1, to);\n if (s[from] == s[i + 1] || s[i] == s[to])\n z--;\n res = Math.Min(res, z);\n }\n }\n a[from, to] = res;\n }\n return a[from, to];\n }\n\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e52ee37198cfb6f3e979f9ac51bf8582", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Algorithm\n{\n class Program\n {\n static int count = 0;\n static void Main(string[] args)\n {\n\t\t\tvar n = Console.ReadLine();\n\t\t\tvar s = Console.ReadLine();\n\t\t\t\n Console.WriteLine(DeleteMinCount(n, s));\n }\n\n private static int DeleteMinCount(string s, int n)\n {\n if (s.Length == 0)\n {\n return 0;\n }\n\n int n = s.Length;\n int i = 0;\n Dictionary fequence = new Dictionary();\n\n while (i < n)\n {\n char c = s[i];\n\n int j = i + 1;\n while (j < n)\n {\n if (c != s[j])\n {\n break;\n }\n j++;\n }\n\n i = j;\n if (!fequence.ContainsKey(c))\n {\n fequence.Add(c, 0);\n }\n\n fequence[c]++;\n }\n\n s = RemoveChar(fequence, s);\n count++;\n DeleteMinCount(s, n);\n\n return count;\n }\n\n private static string RemoveChar(Dictionary fequence, string s)\n {\n int min = Int32.MaxValue;\n char c = ' ';\n foreach (var f in fequence)\n {\n if (f.Value < min)\n {\n min = f.Value;\n c = f.Key;\n }\n }\n\n int n = s.Length;\n int i = 0;\n int j = 0;\n while (i < n)\n {\n if (c == s[i])\n {\n j = i;\n while (j < n)\n {\n if (c != s[j])\n {\n break;\n }\n j++;\n }\n break;\n }\n i++;\n }\n\n s = s.Remove(i, j - i);\n\n return s;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4ed7f0e66ad09933f256f22c164399ed", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Algorithm\n{\n class Program\n {\n static int count = 0;\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine();\n\t\t\tint[,] dp = new int[N, N];\n for (int i = 0; i < N; i++)\n {\n for (int j = 0; j < N; j++)\n {\n dp[i, j] = -1;\n }\n }\n Console.WriteLine(findMinimumDeletion(0, n - 1, dp, s));\n }\n\n \n static int findMinimumDeletion(int l, int r,\n int[,] dp, String s)\n {\n\n if (l > r)\n {\n return 0;\n }\n if (l == r)\n {\n return 1;\n }\n if (dp[l, r] != -1)\n {\n return dp[l, r];\n }\n\n // When a single character is deleted \n int res = 1 + findMinimumDeletion(l + 1, r, dp, s);\n\n // When a group of consecutive characters \n // are deleted if any of them matches \n for (int i = l + 1; i <= r; ++i)\n {\n\n // When both the characters are same then \n // delete the letters in between them \n if (s[l] == s[i])\n {\n res = Math.Min(res, findMinimumDeletion(l + 1, i - 1, dp, s)\n + findMinimumDeletion(i, r, dp, s));\n }\n }\n\n // Memoize \n return dp[l, r] = res;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "97e40b9ce01239d3d3cdf48ae24aa0a6", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Algorithm\n{\n class Program\n {\n static int count = 0;\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine();\n\n Console.WriteLine(DeleteMinCount(s, n));\n }\n\n private static int DeleteMinCount(string s, int length)\n {\n if (s.Length == 0)\n {\n return 0;\n }\n\n int n = s.Length;\n int i = 0;\n Dictionary fequence = new Dictionary();\n\n while (i < n)\n {\n char c = s[i];\n\n int j = i + 1;\n while (j < n)\n {\n if (c != s[j])\n {\n break;\n }\n j++;\n }\n\n i = j;\n if (!fequence.ContainsKey(c))\n {\n fequence.Add(c, 0);\n }\n\n fequence[c]++;\n }\n\n s = RemoveChar(fequence, s);\n count++;\n DeleteMinCount(s, n);\n\n return count;\n }\n\n private static string RemoveChar(Dictionary fequence, string s)\n {\n int min = Int32.MaxValue;\n char c = ' ';\n foreach (var f in fequence)\n {\n if (f.Value < min)\n {\n min = f.Value;\n c = f.Key;\n }\n }\n\n int n = s.Length;\n int i = 0;\n int j = 0;\n while (i < n)\n {\n if (c == s[i])\n {\n j = i;\n while (j < n)\n {\n if (c != s[j])\n {\n break;\n }\n j++;\n }\n break;\n }\n i++;\n }\n\n s = s.Remove(i, j - i);\n\n return s;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9f5fbea4eef5fa381a552a90066afc56", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "/*\ncsc -debug F.cs && mono --debug F.exe <<< \"5\nabaca\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class HelloWorld {\n\n static int n;\n static int m;\n static int[] str;\n static int[,,] memo;\n\n public static void SolveCodeForces() {\n Console.ReadLine();\n str = Console.ReadLine().Select(c => c - 'a').ToArray();\n n = str.Length;\n m = str.Max()+1;\n\n memo = new int[n, n, m];\n for (var i = 0; i < n; i++)\n for (var j = 0; j < n; j++)\n for (var k = 0; k < m; k++)\n memo[i,j,k] = -1;\n\n System.Console.WriteLine(Solve(0, n-1));\n }\n\n static int Solve(int i, int j) {\n if (i > j) return 0;\n if (i == j) return 1;\n\n var ans = 10000;\n for (var sym = 0; sym < m; sym++)\n ans = Math.Min(ans, SolveFun(i, j, sym));\n return ans + 1;\n }\n\n static int SolveFun(int i, int j, int sym) {\n if (i > j) return 0;\n if (i == j) return str[i] == sym ? 0 : 10000;\n if (memo[i,j,sym] >= 0) return memo[i,j,sym];\n\n var ans = 10000;\n\n for (var k = i; k <= j; k++) {\n if (str[k] == sym) {\n\n var fl = SolveFun(i, k-1, sym);\n var sl = Solve(i, k-1);\n\n var fr = SolveFun(k+1, j, sym);\n var sr = Solve(k+1, j);\n\n var sol =\n Math.Min(fl + fr,\n Math.Min(sl + sr,\n Math.Min(fl + sr,\n sl + fr)));\n\n ans = Math.Min(ans, sol);\n }\n }\n\n// System.Console.WriteLine(new { i, j, sym, ans });\n\n memo[i, j, sym] = ans;\n return ans;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c34adfdff3d6530234e769d0b1377265", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "Mono C#", "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 public static string NextToken()\n {\n StringBuilder ret = new StringBuilder();\n char c;\n\n while (char.IsWhiteSpace(c = (char)Console.Read())) ;\n do\n {\n ret.Append(c);\n } while (!char.IsWhiteSpace(c = (char)Console.Read()));\n\n return ret.ToString();\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n int n, t;\n\n n = Reader.NextInt();\n t = Reader.NextInt();\n long[, , , ,] dp = new long[n, 4, 4, t + 2, t + 2];\n\n for (int i = 0; i < 4; ++i)\n for (int j = 0; j < 4; ++j)\n if(i != j)\n dp[1, i, j, 0, 0] = 1;\n for (int i = 2; i < n; ++i)\n for (int j = 0; j < 4; ++j)\n for (int k = 0; k < 4; ++k)\n if (j != k)\n for (int l = 0; l <= t; ++l)\n for (int m = 0; m <= t; ++m)\n for (int y = 0; y < 4; ++y)\n if (k != y)\n if (j < k && k > y)\n dp[i, k, y, l + 1, m] += dp[i - 1, j, k, l, m];\n else if (j > k && k < y)\n dp[i, k, y, l, m + 1] += dp[i - 1, j, k, l, m];\n else\n dp[i, k, y, l, m] += dp[i - 1, j, k, l, m];\n\n long sol = 0;\n for (int i = 0; i < 4; ++i)\n for (int j = 0; j < 4; ++j)\n if (i != j)\n sol += dp[n - 1, i, j, t, t - 1];\n\n Console.WriteLine(sol);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "198ae6ca83bc357becfd9ef920a3c98c", "src_uid": "6d67559744583229455c5eafe68f7952", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\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 long[] ReadLong(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n long[] ret = new long[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = long.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 N, T;\n static int[,,] S;\n\n static int Solve(int n, int t, int y)\n {\n int count = 0;\n\n if (n >= N)\n {\n if (t == T) return 1;\n else return 0;\n }\n if (t > T) return 0;\n\n if (S[n, t, y] != -1) return S[n, t, y];\n\n if (t % 2 == 0)\n {\n // going up\n if (n > 1)\n {\n for (int h = 1; h <= y - 1; h++)\n {\n count += Solve(n + 1, t + 1, h);\n }\n }\n for (int h = y + 1; h <= 4; h++)\n {\n count += Solve(n + 1, t, h);\n }\n }\n else\n {\n // going down\n for (int h = y + 1; h <= 4; h++)\n {\n count += Solve(n + 1, t + 1, h);\n }\n for (int h = 1; h <= y - 1; h++)\n {\n count += Solve(n + 1, t, h);\n }\n }\n\n S[n, t, y] = count;\n\n return count;\n }\n\n static void Main(string[] args)\n {\n int[] nt = Read(Console.ReadLine());\n N = nt[0];\n T = nt[1] * 2 - 1;\n S = new int[N + 1, T + 1, 5];\n for (int i = 0; i <= N; i++)\n {\n for (int j = 0; j <= T; j++)\n {\n for (int k = 0; k <= 4; k++)\n {\n S[i, j, k] = -1;\n }\n }\n }\n\n int res = 0;\n for (int i = 1; i <= 4; i++)\n {\n res += Solve(1, 0, i);\n }\n Console.WriteLine(res);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ac570acee321add823cbcd23a2c7656b", "src_uid": "6d67559744583229455c5eafe68f7952", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace E\n{\n class Program\n {\n static int n;\n static int t;\n static int ti;\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 n = data[0];\n t = data[1];\n ti = 2 * t - 1;\n\n var variants = 0;\n dp = new int[22, 21, 5];\n for (int i = 0; i < 22; i++)\n for (int j = 0; j < 21; j++)\n for (int k = 0; k < 5; k++)\n {\n dp[i, j, k] = -1;\n }\n \n\n for (int i = 1; i < 4; i++)\n {\n variants += req(0, 1, i);\n }\n Console.WriteLine(variants);\n }\n\n static int[, ,] dp;\n static int req(int tCurrent, int x, int y)\n {\n if (dp[tCurrent, x, y] != -1)\n {\n return dp[tCurrent, x, y];\n }\n\n if (x == n)\n {\n if (tCurrent == ti)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n }\n\n if (x == 1)\n {\n var upPath = 0;\n for (int j = y + 1; j <= 4; j++)\n {\n upPath += req(0, x + 1, j);\n }\n\n dp[tCurrent, x, y] = upPath;\n return upPath;\n }\n\n if (tCurrent % 2 == 0 || x == 2)\n {\n // \u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0435, \u0433\u043e\u0440\u0431\n var downPath = 0;\n for (int i = y - 1; i >= 1; i--)\n {\n downPath += req(tCurrent + 1, x + 1, i);\n }\n\n var upPath = 0;\n for (int i = y + 1; i <= 4; i++)\n {\n upPath += req(tCurrent, x + 1, i);\n }\n\n dp[tCurrent, x, y] = downPath + upPath;\n\n return downPath + upPath;\n\n \n }\n else\n {\n // \u0427\u0435\u0442\u043d\u043e\u0435, \u043c\u044b \u043d\u0430 \u0432\u043f\u0430\u0434\u0438\u043d\u0435\n var downPath = 0;\n for (int i = y - 1; i >= 1; i--)\n {\n downPath += req(tCurrent, x + 1, i);\n }\n\n var upPath = 0;\n for (int i = y + 1; i <= 4; i++)\n {\n upPath += req(tCurrent + 1, x + 1, i);\n }\n\n dp[tCurrent, x, y] = downPath + upPath;\n\n return downPath + upPath;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9620d0b9cdb84b794ac5f8863b5f22ea", "src_uid": "6d67559744583229455c5eafe68f7952", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace E\n{\n class Program\n {\n static int n;\n static int t;\n static int ti;\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 n = data[0];\n t = data[1];\n ti = 2 * t - 1;\n\n var variants = 0;\n for (int i = 1; i < 4; i++)\n {\n variants += req(-1, 1, i);\n }\n Console.WriteLine(variants);\n }\n\n\n static int req(int tCurrent, int x, int y)\n {\n if (x == n)\n {\n if (tCurrent == ti)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n }\n\n if (x == 1)\n {\n var upPath = 0;\n for (int j = y + 1; j <= 4; j++)\n {\n upPath += req(0, x + 1, j);\n }\n \n\n return upPath;\n }\n\n if (tCurrent % 2 == 0 || x == 2)\n {\n // \u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0435, \u0433\u043e\u0440\u0431\n var downPath = 0;\n for (int i = y - 1; i >= 1; i--)\n {\n downPath += req(tCurrent + 1, x + 1, i);\n }\n\n var upPath = 0;\n for (int i = y + 1; i <= 4; i++)\n {\n upPath += req(tCurrent, x + 1, i);\n }\n\n return downPath + upPath;\n\n \n }\n else\n {\n // \u0427\u0435\u0442\u043d\u043e\u0435, \u043c\u044b \u043d\u0430 \u0432\u043f\u0430\u0434\u0438\u043d\u0435\n var downPath = 0;\n for (int i = y - 1; i >= 1; i--)\n {\n downPath += req(tCurrent, x + 1, i);\n }\n\n var upPath = 0;\n for (int i = y + 1; i <= 4; i++)\n {\n upPath += req(tCurrent + 1, x + 1, i);\n }\n\n return downPath + upPath;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7cf061f0fe3be8d602c9df6cbd9bac0b", "src_uid": "6d67559744583229455c5eafe68f7952", "difficulty": 1900.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\n\npublic class Program\n{\n string N;\n public void Solve()\n {\n var sc = new Scanner();\n // \u5148\u982d\u304c0\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u96a3\u63a52\u6587\u5b57\u5165\u308c\u66ff\u3048\u3067\u304d\u308b\n // 25\u3067\u5272\u308a\u5207\u308c\u308b\u3088\u3046\u306b\u3059\u308b\n\n N = sc.Next();\n\n // 00 25 50 75\n int ans = Math.Min(C(\"00\"), Math.Min(C(\"25\"), Math.Min(C(\"50\"), C(\"75\"))));\n if (ans == int.MaxValue)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n Console.WriteLine(ans);\n }\n\n int C(string t)\n {\n char[] tmp = N.ToCharArray();\n bool f = false;\n int ans = 0;\n for (int i = N.Length - 1; i >= 0; i--)\n {\n // Console.WriteLine(i);\n int j = i;\n if (tmp[j] == t[1])\n {\n while (j < N.Length - 1)\n {\n (tmp[j], tmp[j + 1]) = (tmp[j + 1], tmp[j]);\n ans++;\n j++;\n }\n f = true;\n break;\n }\n }\n if (!f) return int.MaxValue;\n f = false;\n for (int i = N.Length - 2; i >= 0; i--)\n {\n int j = i;\n if (tmp[j] == t[0])\n {\n while (j < N.Length - 2)\n {\n (tmp[j], tmp[j + 1]) = (tmp[j + 1], tmp[j]);\n ans++;\n j++;\n }\n f = true;\n break;\n }\n }\n if (!f) return int.MaxValue;\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a1e1d40fc0378ad0502126aa38401303", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "\nusing System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n var n = sc.Next().Reverse().ToArray();\n\n\n // \u4e0b2\u6841 00 25 50 75\n int ans = int.MaxValue;\n\n // 00\n {\n int cnt = 0;\n int t = 0;\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] == '0' && t < 2)\n {\n cnt += i - (t++);\n }\n }\n if (t >= 2) ans = Math.Min(ans, cnt);\n }\n\n // 25\n {\n int c = 0;\n int t = 0;\n bool two = false;\n bool five = false;\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] == '2' && !two)\n {\n c += t;\n t++;\n two = true;\n }\n else if (n[i] == '5' && !five)\n {\n c += t;\n five = true;\n }\n else\n {\n t++;\n }\n }\n if (two && five) ans = Math.Min(ans, c);\n }\n\n\n // 50\n {\n int c = 0;\n int t = 0;\n bool five = false;\n bool zero = false;\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] == '5' && !five)\n {\n c += t;\n t++;\n five = true;\n }\n else if (n[i] == '0' && !zero)\n {\n c += t;\n zero = true;\n }\n else\n {\n t++;\n }\n }\n if (five && zero) ans = Math.Min(ans, c);\n }\n\n\n // 75\n {\n int c = 0;\n int t = 0;\n bool seven = false;\n bool five = false;\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] == '7' && !seven)\n {\n c += t;\n t++;\n seven = true;\n }\n else if (n[i] == '5' && !five)\n {\n c += t;\n five = true;\n }\n else\n {\n t++;\n }\n }\n if (seven && five) ans = Math.Min(ans, c);\n\n }\n\n if (ans == int.MaxValue) Console.WriteLine(\"-1\");\n else 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "46eee74a1e940e621219898c74c28e81", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Collections;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n var n = sc.Next().Reverse().ToArray();\n\n // \u5148\u982d0\u4ee5\u5916\n // \u4e0b2\u6841 00 25 50 75\n\n int ans = int.MaxValue;\n\n // \u5148\u982d\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] == '0') continue;\n // 2\u6841\u76ee\n for (int j = 0; j < n.Length; j++)\n {\n if (i == j) continue;\n for (int k = 0; k < n.Length; k++)\n {\n if (i == k || j == k) continue;\n\n bool zero = n[j] == '0' && n[k] == '0';\n bool twentyfive = n[j] == '2' && n[k] == '5';\n bool fifty = n[j] == '5' && n[k] == '0';\n bool seventyfive = n[j] == '7' && n[k] == '5';\n if (!zero && !twentyfive && !fifty && !seventyfive) continue;\n var array = new int[n.Length];\n for (int l = 0; l < n.Length; l++)\n {\n if (l == i) array[l] = 0;\n else if (l == j) array[l] = 2;\n else if (l == k) array[l] = 3;\n else array[l] = 1;\n }\n int tmp = 0;\n var bit = new FenwickTree(4);\n for (int l = 0; l < n.Length; l++)\n {\n tmp += bit.Sum(array[l]);\n bit.Add(array[l], 1);\n }\n ans = Math.Min(ans, tmp);\n }\n }\n }\n if (ans == int.MaxValue) Console.WriteLine(\"-1\");\n else Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Collections\n{\n using Num = System.Int32;\n\n public class FenwickTree\n {\n private readonly Num[] _array;\n public readonly int Count;\n\n public FenwickTree(int size)\n {\n _array = new Num[size + 1];\n Count = size;\n }\n\n ///

    \n /// A[i]\u306bn\u3092\u52a0\u7b97\n /// \n /// \n /// \n public void Add(int i, Num n)\n {\n i++;\n for (; i <= Count; i += i & -i)\n {\n _array[i] += n;\n }\n }\n\n /// \n /// [0,r)\u306e\u548c\u3092\u6c42\u3081\u308b\n /// \n /// \n /// \n public Num Sum(int r)\n {\n Num result = 0;\n for (; r > 0; r -= r & -r)\n {\n result += _array[r];\n }\n\n return result;\n }\n\n // [l,r)\u306e\u548c\u3092\u6c42\u3081\u308b\n public Num Sum(int l, int r) => Sum(r) - Sum(l);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "06ec7dade7ad0a85b789a906bfa60b3b", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Divisibility_by_25\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 min = Math.Min(Math.Min(Check(s, '0', '0'), Check(s, '2', '5')), Math.Min(Check(s, '5', '0'), Check(s, '7', '5')));\n if (min == int.MaxValue)\n return -1;\n\n return min;\n }\n\n private static int Check(string s, char c1, char c2)\n {\n int index = s.LastIndexOf(c2);\n if (index < 0)\n return int.MaxValue;\n int ans = s.Length - index - 1;\n int index2;\n if (c1 == c2)\n index2 = s.Substring(0, index).LastIndexOf(c1);\n else\n index2 = s.LastIndexOf(c1);\n\n if (index2 < 0)\n return int.MaxValue;\n\n if (index2 != s.Length - 1)\n ans += s.Length - index2 - 2;\n\n var b = new StringBuilder();\n for (int i = 0; i < s.Length; i++)\n {\n if (i == index || i == index2)\n continue;\n b.Append(s[i]);\n }\n\n bool f = b.Length == 0;\n for (int i = 0; i < b.Length; i++)\n {\n if (b[i] != '0')\n {\n f = true;\n break;\n }\n ans++;\n }\n\n if (f)\n return ans;\n\n return int.MaxValue;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ce5a3182a10ed35fb866894162dc4451", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Collections;\n\npublic class Program\n{\n string N;\n public void Solve()\n {\n var sc = new Scanner();\n // \u5148\u982d\u304c0\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u96a3\u63a52\u6587\u5b57\u5165\u308c\u66ff\u3048\u3067\u304d\u308b\n // 25\u3067\u5272\u308a\u5207\u308c\u308b\u3088\u3046\u306b\u3059\u308b\n\n N = sc.Next();\n int ans = Math.Min(C(\"00\"), Math.Min(C(\"25\"), Math.Min(C(\"50\"), C(\"75\"))));\n\n if (ans == int.MaxValue)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n Console.WriteLine(ans);\n }\n\n int C(string t)\n {\n // 1~9\n\n // \u4e00\u756a\u3046\u3057\u308d\u306e2\u3064\n int[] ar = new int[N.Length];\n bool[] f = new bool[2];\n for (int i = N.Length - 1; i >= 0; i--)\n {\n if (!f[1] && N[i] == t[1])\n {\n f[1] = true;\n ar[i] = 4;\n }\n else if (!f[0] && N[i] == t[0])\n {\n f[0] = true;\n ar[i] = 3;\n }\n }\n\n if (!f[0] || !f[1]) return int.MaxValue;\n\n bool f2 = false;\n for (int i = 0; i < N.Length; i++)\n {\n if (!f2 && N[i] != '0' && ar[i] == 0)\n {\n f2 = true;\n ar[i] = 1;\n\n }\n else if (ar[i] == 0)\n {\n ar[i] = 2;\n }\n }\n if (!f2) return int.MaxValue;\n var ft = new FenwickTree(5);\n int ans = 0;\n for (int i = 0; i < N.Length; i++)\n {\n ans += ft.Sum(ar[i] + 1, 5);\n ft.Add(ar[i], 1);\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.Collections\n{\n using Num = System.Int32;\n\n public class FenwickTree\n {\n private readonly Num[] _array;\n public readonly int Count;\n\n public FenwickTree(int size)\n {\n _array = new Num[size + 1];\n Count = size;\n }\n\n /// \n /// A[i]\u306bn\u3092\u52a0\u7b97\n /// \n /// \n /// \n public void Add(int i, Num n)\n {\n i++;\n for (; i <= Count; i += i & -i)\n {\n _array[i] += n;\n }\n }\n\n /// \n /// [0,r)\u306e\u548c\u3092\u6c42\u3081\u308b\n /// \n /// \n /// \n public Num Sum(int r)\n {\n Num result = 0;\n for (; r > 0; r -= r & -r)\n {\n result += _array[r];\n }\n\n return result;\n }\n\n /// \n /// [0,i)\u306e\u548c\u304cw\u4ee5\u4e0a\u306b\u306a\u308bi\n /// \n /// \n /// \n public int LowerBound(int w)\n {\n if (w <= 0) return 0;\n int x = 0;\n int k = 1;\n while (k * 2 < Count) k *= 2;\n for (; k > 0; k /= 2)\n {\n if (x + k < Count && _array[x + k] < w)\n {\n w -= _array[x + k];\n x += k;\n }\n }\n return x + 1;\n }\n\n // [l,r)\u306e\u548c\u3092\u6c42\u3081\u308b\n public Num Sum(int l, int r) => Sum(r) - Sum(l);\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4929064404547ea3754af8cfacb1024b", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "\nusing System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n var n = sc.Next().Reverse().ToArray();\n\n\n // \u4e0b2\u6841 00 25 50 75\n int ans = int.MaxValue;\n\n // 00\n {\n int cnt = 0;\n int t = 0;\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] == '0')\n {\n cnt += i - (t++);\n if (t >= 2) break;\n }\n }\n if (t >= 2) ans = Math.Min(ans, cnt);\n }\n\n // 25\n {\n int c = 0;\n int t = 0;\n bool two = false;\n bool five = false;\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] == '2' && !two)\n {\n c += t;\n t++;\n two = true;\n }\n else if (n[i] == '5' && !five)\n {\n c += t;\n five = true;\n }\n else\n {\n t++;\n }\n }\n if (two && five) ans = Math.Min(ans, c);\n }\n\n\n // 50\n {\n int c = 0;\n int t = 0;\n bool five = false;\n bool zero = false;\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] == '5' && !five)\n {\n c += t;\n t++;\n five = true;\n }\n else if (n[i] == '0' && !zero)\n {\n c += t;\n zero = true;\n }\n else\n {\n t++;\n }\n }\n if (five && zero) ans = Math.Min(ans, c);\n }\n\n\n // 75\n {\n int c = 0;\n int t = 0;\n bool seven = false;\n bool five = false;\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] == '7' && !seven)\n {\n c += t;\n t++;\n seven = true;\n }\n else if (n[i] == '5' && !five)\n {\n c += t;\n five = true;\n }\n else\n {\n t++;\n }\n }\n if (seven && five) ans = Math.Min(ans, c);\n\n }\n\n if (ans == int.MaxValue) Console.WriteLine(\"-1\");\n else 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "69779e5a63a23ff69e2498d0a81f8582", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Collections;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n var n = sc.Next().Reverse().ToArray();\n if (n.Length == 1)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n // \u5148\u982d0\u4ee5\u5916\n // \u4e0b2\u6841 00 25 50 75\n\n int ans = int.MaxValue;\n\n // \u5148\u982d\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] == '0') continue;\n // 2\u6841\u76ee\n for (int j = 0; j < n.Length; j++)\n {\n if (n.Length > 2 && i == j) continue;\n for (int k = 0; k < n.Length; k++)\n {\n if (i == k || j == k) continue;\n\n bool zero = n[j] == '0' && n[k] == '0';\n bool twentyfive = n[j] == '2' && n[k] == '5';\n bool fifty = n[j] == '5' && n[k] == '0';\n bool seventyfive = n[j] == '7' && n[k] == '5';\n if (!zero && !twentyfive && !fifty && !seventyfive) continue;\n var array = new int[n.Length];\n for (int l = 0; l < n.Length; l++)\n {\n if (l == i) array[l] = 0;\n else if (l == j) array[l] = 2;\n else if (l == k) array[l] = 3;\n else array[l] = 1;\n }\n int tmp = 0;\n var bit = new FenwickTree(4);\n for (int l = 0; l < n.Length; l++)\n {\n tmp += bit.Sum(array[l]);\n bit.Add(array[l], 1);\n }\n ans = Math.Min(ans, tmp);\n }\n }\n }\n if (ans == int.MaxValue) Console.WriteLine(\"-1\");\n else Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Collections\n{\n using Num = System.Int32;\n\n public class FenwickTree\n {\n private readonly Num[] _array;\n public readonly int Count;\n\n public FenwickTree(int size)\n {\n _array = new Num[size + 1];\n Count = size;\n }\n\n /// \n /// A[i]\u306bn\u3092\u52a0\u7b97\n /// \n /// \n /// \n public void Add(int i, Num n)\n {\n i++;\n for (; i <= Count; i += i & -i)\n {\n _array[i] += n;\n }\n }\n\n /// \n /// [0,r)\u306e\u548c\u3092\u6c42\u3081\u308b\n /// \n /// \n /// \n public Num Sum(int r)\n {\n Num result = 0;\n for (; r > 0; r -= r & -r)\n {\n result += _array[r];\n }\n\n return result;\n }\n\n // [l,r)\u306e\u548c\u3092\u6c42\u3081\u308b\n public Num Sum(int l, int r) => Sum(r) - Sum(l);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "567a03d92da73b0defaf421ad80c5841", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Divisibility_by_25\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 min = Math.Min(Math.Min(Check(s, '0', '0'), Check(s, '2', '5')), Math.Min(Check(s, '5', '0'), Check(s, '7', '5')));\n if (min == int.MaxValue)\n return -1;\n\n return min;\n }\n\n private static int Check(string s, char c1, char c2)\n {\n int index = s.LastIndexOf(c2);\n if (index < 0)\n return int.MaxValue;\n int ans = s.Length - index - 1;\n int index2;\n if (c1 == c2)\n index2 = s.Substring(0, index).LastIndexOf(c1);\n else\n index2 = s.LastIndexOf(c1);\n\n if (index2 < 0)\n return int.MaxValue;\n\n if (index2 > index)\n ans += s.Length - index2 - 1;\n else\n ans += s.Length - index2 - 2;\n\n var b = new StringBuilder();\n for (int i = 0; i < s.Length; i++)\n {\n if (i == index || i == index2)\n continue;\n b.Append(s[i]);\n }\n\n bool f = b.Length == 0;\n for (int i = 0; i < b.Length; i++)\n {\n if (b[i] != '0')\n {\n f = true;\n break;\n }\n ans++;\n }\n\n if (f)\n return ans;\n\n return int.MaxValue;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f30710172c5c487ae6eaa541883833a0", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Collections;\n\npublic class Program\n{\n string N;\n public void Solve()\n {\n var sc = new Scanner();\n // \u5148\u982d\u304c0\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u96a3\u63a52\u6587\u5b57\u5165\u308c\u66ff\u3048\u3067\u304d\u308b\n // 25\u3067\u5272\u308a\u5207\u308c\u308b\u3088\u3046\u306b\u3059\u308b\n\n N = sc.Next();\n long ans = int.MaxValue;\n\n string[] target = new string[] { \"00\", \"25\", \"50\", \"75\" };\n for (int i = 0; i < N.Length; i++)\n {\n for (int j = 0; j < N.Length; j++)\n {\n if (i == j) continue;\n bool f = false;\n for (int k = 0; k < 4; k++)\n {\n f |= (N[i] == target[k][0]) && (N[j] == target[k][1]);\n }\n if (!f) continue;\n\n var ar = new int[N.Length];\n bool f2 = false;\n for (int k = 0; k < N.Length; k++)\n {\n if (k == i) ar[k] = 2;\n else if (k == j) ar[k] = 3;\n else if (!f2 && N[k] != '0')\n {\n ar[k] = 0; f2 = true;\n }\n else ar[k] = 1;\n }\n\n long t = 0;\n var ft = new FenwickTree(4);\n for (int k = 0; k < N.Length; k++)\n {\n t += ft.Sum(ar[k] + 1, 4);\n ft.Add(ar[k], 1);\n }\n\n\n ans = Math.Min(ans, t);\n }\n }\n\n if (ans == int.MaxValue)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n Console.WriteLine(ans);\n }\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.Collections\n{\n using Num = System.Int32;\n\n public class FenwickTree\n {\n private readonly Num[] _array;\n public readonly int Count;\n\n public FenwickTree(int size)\n {\n _array = new Num[size + 1];\n Count = size;\n }\n\n /// \n /// A[i]\u306bn\u3092\u52a0\u7b97\n /// \n /// \n /// \n public void Add(int i, Num n)\n {\n i++;\n for (; i <= Count; i += i & -i)\n {\n _array[i] += n;\n }\n }\n\n /// \n /// [0,r)\u306e\u548c\u3092\u6c42\u3081\u308b\n /// \n /// \n /// \n public Num Sum(int r)\n {\n Num result = 0;\n for (; r > 0; r -= r & -r)\n {\n result += _array[r];\n }\n\n return result;\n }\n\n /// \n /// [0,i)\u306e\u548c\u304cw\u4ee5\u4e0a\u306b\u306a\u308bi\n /// \n /// \n /// \n public int LowerBound(int w)\n {\n if (w <= 0) return 0;\n int x = 0;\n int k = 1;\n while (k * 2 < Count) k *= 2;\n for (; k > 0; k /= 2)\n {\n if (x + k < Count && _array[x + k] < w)\n {\n w -= _array[x + k];\n x += k;\n }\n }\n return x + 1;\n }\n\n // [l,r)\u306e\u548c\u3092\u6c42\u3081\u308b\n public Num Sum(int l, int r) => Sum(r) - Sum(l);\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2954e96d5f5173ab3e8289dd7b219db0", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "Mono C#", "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 H = re.l();\n long W = re.l(); \n if(H == 1 || W == 1){\n H = Math.Max(H,W);\n long count = H / 6 * 6;\n if(max % 6 == 4){\n count += 2;\n }\n if(max % 6 == 5){\n count += 4;\n }\n sb.Append(count + \"\\n\");\n return;\n }\n if(H >= 3 && W >= 3){\n sb.Append(H*W/2*2+\"\\n\");\n return;\n }\n if(H != 2){\n W = H;\n H = 2;\n }\n if(W == 2){\n sb.Append(\"0\\n\");\n return;\n }\n long count = W/2*4;\n sb.Append(count+\"\\n\");\n }\n}\nclass PrimeFactor{\n int[] LowestPrimeFactor;\n public int[] Prime;\n int N;\n public PrimeFactor(int N0){\n N = N0;\n N++;\n LowestPrimeFactor = new int[N];\n List prime = new List();\n for(int i=1;i ans = new List();\n while(X != 1){\n ans.Add(LowestPrimeFactor[X]);\n X /= LowestPrimeFactor[X];\n }\n return ans.ToArray();\n }\n public int[] PrimeDivide(long X0){\n List ans = new List();\n int X = (int)X0;\n int i=0;\n while(X >= N){\n if(X % Prime[i] == 0){\n ans.Add(Prime[i]);\n X /= Prime[i];\n }\n else{\n i++;\n if(i == Prime.Length){\n ans.Add(X);\n X = 1;\n }\n }\n }\n while(X != 1){\n ans.Add(LowestPrimeFactor[X]);\n X /= LowestPrimeFactor[X];\n }\n return ans.ToArray();\n }\n public int[] Divisor(int X){\n List ans = new List();\n ans.Add(1);\n while(X != 1){\n int p = LowestPrimeFactor[X];\n int c = 0;\n while(X % p == 0){\n X /= p;\n c++;\n }\n int l = ans.Count;\n int d = p;\n for(int i=1;i<=c;i++){\n for(int j=0;j ans = new List();\n int X = (int)X0;\n ans.Add(1);\n int i=0;\n while(X >= N){\n if(X % Prime[i] == 0){\n int p = Prime[i];\n int c = 0;\n while(X % p == 0){\n X /= p;\n c++;\n }\n int l = ans.Count;\n int d = p;\n for(int k=1;k<=c;k++){\n for(int j=0;j= N){\n if(X % Prime[i] == 0){\n int p = Prime[i];\n while(X % p == 0){\n X /= p;\n }\n ans /= p;\n ans *= p-1;\n }\n else{\n i++;\n if(i == Prime.Length){\n int p = X;\n ans /= p;\n ans *= p-1;\n X = 1;\n }\n }\n }\n while(X != 1){\n int p = LowestPrimeFactor[X];\n while(X % p == 0){\n X /= p;\n }\n ans /= p;\n ans *= p-1;\n }\n return ans;\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= 3 && W >= 3){\n sb.Append(H*W/2*2+\"\\n\");\n return;\n }\n if(H != 2){\n W = H;\n H = 2;\n }\n long count = W/4*4;\n if(W % 4 == 3){\n count += 2;\n }\n\n sb.Append(count*2+\"\\n\");\n }\n}\nclass PrimeFactor{\n int[] LowestPrimeFactor;\n public int[] Prime;\n int N;\n public PrimeFactor(int N0){\n N = N0;\n N++;\n LowestPrimeFactor = new int[N];\n List prime = new List();\n for(int i=1;i ans = new List();\n while(X != 1){\n ans.Add(LowestPrimeFactor[X]);\n X /= LowestPrimeFactor[X];\n }\n return ans.ToArray();\n }\n public int[] PrimeDivide(long X0){\n List ans = new List();\n int X = (int)X0;\n int i=0;\n while(X >= N){\n if(X % Prime[i] == 0){\n ans.Add(Prime[i]);\n X /= Prime[i];\n }\n else{\n i++;\n if(i == Prime.Length){\n ans.Add(X);\n X = 1;\n }\n }\n }\n while(X != 1){\n ans.Add(LowestPrimeFactor[X]);\n X /= LowestPrimeFactor[X];\n }\n return ans.ToArray();\n }\n public int[] Divisor(int X){\n List ans = new List();\n ans.Add(1);\n while(X != 1){\n int p = LowestPrimeFactor[X];\n int c = 0;\n while(X % p == 0){\n X /= p;\n c++;\n }\n int l = ans.Count;\n int d = p;\n for(int i=1;i<=c;i++){\n for(int j=0;j ans = new List();\n int X = (int)X0;\n ans.Add(1);\n int i=0;\n while(X >= N){\n if(X % Prime[i] == 0){\n int p = Prime[i];\n int c = 0;\n while(X % p == 0){\n X /= p;\n c++;\n }\n int l = ans.Count;\n int d = p;\n for(int k=1;k<=c;k++){\n for(int j=0;j= N){\n if(X % Prime[i] == 0){\n int p = Prime[i];\n while(X % p == 0){\n X /= p;\n }\n ans /= p;\n ans *= p-1;\n }\n else{\n i++;\n if(i == Prime.Length){\n int p = X;\n ans /= p;\n ans *= p-1;\n X = 1;\n }\n }\n }\n while(X != 1){\n int p = LowestPrimeFactor[X];\n while(X % p == 0){\n X /= p;\n }\n ans /= p;\n ans *= p-1;\n }\n return ans;\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= 3 && W >= 3){\n sb.Append(H*W/2+\"\\n\");\n return;\n }\n if(H != 2){\n W = H;\n H = 2;\n }\n long count = W/4*4;\n if(W % 4 == 3){\n count += 2;\n }\n\n sb.Append(count+\"\\n\");\n }\n}\nclass PrimeFactor{\n int[] LowestPrimeFactor;\n public int[] Prime;\n int N;\n public PrimeFactor(int N0){\n N = N0;\n N++;\n LowestPrimeFactor = new int[N];\n List prime = new List();\n for(int i=1;i ans = new List();\n while(X != 1){\n ans.Add(LowestPrimeFactor[X]);\n X /= LowestPrimeFactor[X];\n }\n return ans.ToArray();\n }\n public int[] PrimeDivide(long X0){\n List ans = new List();\n int X = (int)X0;\n int i=0;\n while(X >= N){\n if(X % Prime[i] == 0){\n ans.Add(Prime[i]);\n X /= Prime[i];\n }\n else{\n i++;\n if(i == Prime.Length){\n ans.Add(X);\n X = 1;\n }\n }\n }\n while(X != 1){\n ans.Add(LowestPrimeFactor[X]);\n X /= LowestPrimeFactor[X];\n }\n return ans.ToArray();\n }\n public int[] Divisor(int X){\n List ans = new List();\n ans.Add(1);\n while(X != 1){\n int p = LowestPrimeFactor[X];\n int c = 0;\n while(X % p == 0){\n X /= p;\n c++;\n }\n int l = ans.Count;\n int d = p;\n for(int i=1;i<=c;i++){\n for(int j=0;j ans = new List();\n int X = (int)X0;\n ans.Add(1);\n int i=0;\n while(X >= N){\n if(X % Prime[i] == 0){\n int p = Prime[i];\n int c = 0;\n while(X % p == 0){\n X /= p;\n c++;\n }\n int l = ans.Count;\n int d = p;\n for(int k=1;k<=c;k++){\n for(int j=0;j= N){\n if(X % Prime[i] == 0){\n int p = Prime[i];\n while(X % p == 0){\n X /= p;\n }\n ans /= p;\n ans *= p-1;\n }\n else{\n i++;\n if(i == Prime.Length){\n int p = X;\n ans /= p;\n ans *= p-1;\n X = 1;\n }\n }\n }\n while(X != 1){\n int p = LowestPrimeFactor[X];\n while(X % p == 0){\n X /= p;\n }\n ans /= p;\n ans *= p-1;\n }\n return ans;\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= 3 && W >= 3){\n sb.Append(H*W/2*2+\"\\n\");\n return;\n }\n if(H != 2){\n W = H;\n H = 2;\n }\n if(W == 2){\n sb.Append(\"0\\n\");\n return;\n }\n sb.Append((W/2*4)+\"\\n\");\n }\n}\nclass PrimeFactor{\n int[] LowestPrimeFactor;\n public int[] Prime;\n int N;\n public PrimeFactor(int N0){\n N = N0;\n N++;\n LowestPrimeFactor = new int[N];\n List prime = new List();\n for(int i=1;i ans = new List();\n while(X != 1){\n ans.Add(LowestPrimeFactor[X]);\n X /= LowestPrimeFactor[X];\n }\n return ans.ToArray();\n }\n public int[] PrimeDivide(long X0){\n List ans = new List();\n int X = (int)X0;\n int i=0;\n while(X >= N){\n if(X % Prime[i] == 0){\n ans.Add(Prime[i]);\n X /= Prime[i];\n }\n else{\n i++;\n if(i == Prime.Length){\n ans.Add(X);\n X = 1;\n }\n }\n }\n while(X != 1){\n ans.Add(LowestPrimeFactor[X]);\n X /= LowestPrimeFactor[X];\n }\n return ans.ToArray();\n }\n public int[] Divisor(int X){\n List ans = new List();\n ans.Add(1);\n while(X != 1){\n int p = LowestPrimeFactor[X];\n int c = 0;\n while(X % p == 0){\n X /= p;\n c++;\n }\n int l = ans.Count;\n int d = p;\n for(int i=1;i<=c;i++){\n for(int j=0;j ans = new List();\n int X = (int)X0;\n ans.Add(1);\n int i=0;\n while(X >= N){\n if(X % Prime[i] == 0){\n int p = Prime[i];\n int c = 0;\n while(X % p == 0){\n X /= p;\n c++;\n }\n int l = ans.Count;\n int d = p;\n for(int k=1;k<=c;k++){\n for(int j=0;j= N){\n if(X % Prime[i] == 0){\n int p = Prime[i];\n while(X % p == 0){\n X /= p;\n }\n ans /= p;\n ans *= p-1;\n }\n else{\n i++;\n if(i == Prime.Length){\n int p = X;\n ans /= p;\n ans *= p-1;\n X = 1;\n }\n }\n }\n while(X != 1){\n int p = LowestPrimeFactor[X];\n while(X % p == 0){\n X /= p;\n }\n ans /= p;\n ans *= p-1;\n }\n return ans;\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 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 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 private string s1, s2, virus;\n int[,] C = new int[101,101];\n int LCSLength()\n {\n int m = s1.Length;\n int n = s2.Length;\n for (int i = 1; i <= m; i++)\n for (int j = 1; j <= n; j++)\n {\n if (s1[i - 1] == s2[j - 1])\n {\n C[i, j] = C[i - 1, j - 1] + 1;\n string b = Backtrack(i, j);\n if (b.EndsWith(virus))\n C[i, j] = Math.Max(C[i, j - 1], C[i - 1, j]);\n }\n else\n C[i, j] = Math.Max(C[i, j - 1], C[i - 1, j]);\n }\n return C[m, n];\n }\n\n string Backtrack(int i, int j)\n {\n if (i == 0 || j == 0)\n return \"\";\n if (s1[i - 1] == s2[j - 1])\n {\n string b = Backtrack(i - 1, j - 1) + s1[i - 1];\n if (!b.EndsWith(virus))\n return Backtrack(i - 1, j - 1) + s1[i - 1];\n }\n if (C[i,j-1] > C[i-1,j])\n return Backtrack(i, j - 1);\n return Backtrack(i - 1, j);\n }\n\n public object Solve()\n {\n s1 = reader.ReadLine();\n s2 = reader.ReadLine();\n C = new int[s1.Length + 1, s2.Length + 1];\n virus = reader.ReadLine();\n\n LCSLength();\n string ans = Backtrack(s1.Length, s2.Length);\n return ans.Length == 0 ? \"0\" : ans;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c20b8ee56fdbdbc4aace1891d16cc39d", "src_uid": "391c2abbe862139733fcb997ba1629b8", "difficulty": 2000.0} {"lang": "MS C#", "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 #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 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 private string s1, s2, virus;\n int[,] C = new int[101,101];\n int LCSLength()\n {\n int m = s1.Length;\n int n = s2.Length;\n for (int i = 1; i <= m; i++)\n for (int j = 1; j <= n; j++)\n {\n if (s1[i - 1] == s2[j - 1])\n {\n C[i, j] = C[i - 1, j - 1] + 1;\n }\n else\n C[i, j] = Math.Max(C[i, j - 1], C[i - 1, j]);\n }\n return C[m, n];\n }\n\n string Backtrack(int i, int j)\n {\n if (i == 0 || j == 0)\n return \"\";\n if (s1[i - 1] == s2[j - 1])\n {\n string b = Backtrack(i - 1, j - 1) + s1[i - 1];\n if (!b.EndsWith(virus))\n return Backtrack(i - 1, j - 1) + s1[i - 1];\n }\n if (C[i,j-1] > C[i-1,j])\n return Backtrack(i, j - 1);\n return Backtrack(i - 1, j);\n }\n\n public object Solve()\n {\n s1 = reader.ReadLine();\n s2 = reader.ReadLine();\n C = new int[s1.Length + 1, s2.Length + 1];\n virus = reader.ReadLine();\n\n LCSLength();\n string ans = Backtrack(s1.Length, s2.Length);\n return ans.Length == 0 ? \"0\" : ans;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "01ceddb64495d554d2c45ba6066a9319", "src_uid": "391c2abbe862139733fcb997ba1629b8", "difficulty": 2000.0} {"lang": "MS C#", "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 #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 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 private string s1, s2, virus;\n int[,] C = new int[101,101];\n int LCSLength()\n {\n int m = s1.Length;\n int n = s2.Length;\n for (int i = 1; i <= m; i++)\n for (int j = 1; j <= n; j++)\n {\n if (s1[i - 1] == s2[j - 1])\n {\n C[i, j] = C[i - 1, j - 1] + 1;\n string b = Backtrack(i, j);\n if (b.EndsWith(virus))\n C[i, j] = Math.Max(C[i, j - 1], C[i - 1, j]);\n }\n else\n C[i, j] = Math.Max(C[i, j - 1], C[i - 1, j]);\n }\n return C[m, n];\n }\n\n string Backtrack(int i, int j)\n {\n if (i == 0 || j == 0)\n return \"\";\n if (s1[i - 1] == s2[j - 1])\n {\n string b = Backtrack(i - 1, j - 1) + s1[i - 1];\n if (!b.EndsWith(virus))\n return Backtrack(i - 1, j - 1) + s1[i - 1];\n }\n if (C[i,j-1] > C[i-1,j])\n return Backtrack(i, j - 1);\n return Backtrack(i - 1, j);\n }\n\n public object Solve()\n {\n s1 = reader.ReadLine();\n s2 = reader.ReadLine();\n C = new int[s1.Length + 1, s2.Length + 1];\n virus = reader.ReadLine();\n\n LCSLength();\n return Backtrack(s1.Length, s2.Length);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8b87f5130be4fee4ea8726c3d6f812d", "src_uid": "391c2abbe862139733fcb997ba1629b8", "difficulty": 2000.0} {"lang": "MS C#", "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 int[] KMP(string s)\n {\n int n = s.Length;\n var pi = new int[n];\n\t for (int i = 1; i < n; ++i) \n {\n\t\t int j = pi[i - 1];\n\t\t while (j > 0 && s[i] != s[j])\n\t\t\t j = pi[j - 1];\n\t\t if (s[i] == s[j])\n j++;\n\t\t pi[i] = j;\n\t }\n\t return pi;\n }\n\n public object Solve()\n {\n string s1 = ReadToken();\n string s2 = ReadToken();\n string s3 = ReadToken();\n\n int n1 = s1.Length;\n int n2 = s2.Length;\n int n3 = s3.Length;\n\n var dp = new int[n1 + 1, n2 + 1, n3];\n var path = new Tuple[n1 + 1, n2 + 1, n3];\n for (int i1 = 1; i1 <= n1; i1++)\n for (int i2 = 1; i2 <= n2; i2++)\n for (int i3 = 0; i3 < n3; i3++)\n {\n if (s1[i1 - 1] == s2[i2 - 1])\n {\n if (s3[i3] == s1[i1 - 1])\n {\n if (i3 + 1 < n3)\n {\n dp[i1, i2, i3 + 1] = dp[i1 - 1, i2 - 1, i3] + 1;\n path[i1, i2, i3 + 1] = Tuple.Create(i1 - 1, i2 - 1, i3, s1[i1 - 1]);\n }\n }\n else\n {\n int jump = KMP(s3.Substring(0, i3) + s1[i1 - 1])[i3];\n if (dp[i1 - 1, i2 - 1, i3] + 1 > dp[i1, i2, jump])\n {\n dp[i1, i2, jump] = dp[i1 - 1, i2 - 1, i3] + 1;\n path[i1, i2, jump] = Tuple.Create(i1 - 1, i2 - 1, i3, s1[i1 - 1]);\n }\n }\n }\n if (dp[i1 - 1, i2, i3] >= dp[i1, i2, i3])\n {\n dp[i1, i2, i3] = dp[i1 - 1, i2, i3];\n path[i1, i2, i3] = Tuple.Create(i1 - 1, i2, i3, (char)0);\n }\n if (dp[i1, i2 - 1, i3] >= dp[i1, i2, i3])\n {\n dp[i1, i2, i3] = dp[i1, i2 - 1, i3];\n path[i1, i2, i3] = Tuple.Create(i1, i2 - 1, i3, (char)0);\n }\n }\n\n int max = -1;\n int nmax = -1;\n for (int i = 0; i < n3; i++)\n {\n if (dp[n1, n2, i] > max)\n {\n max = dp[n1, n2, i];\n nmax = i;\n }\n }\n if (max == 0)\n return 0;\n\n var list = new List();\n var c = Tuple.Create(n1, n2, nmax, (char)0);\n while (c.Item1 > 0 && c.Item2 > 0)\n {\n c = path[c.Item1, c.Item2, c.Item3];\n if (c.Item4 > 0)\n list.Add(c.Item4);\n }\n list.Reverse();\n\n for (int i = 0; i < n3; i++)\n {\n for (int j = 0; j <= n1; j++)\n {\n for (int k = 0; k <= n2; k++)\n {\n Console.Write(dp[j, k, i]);\n }\n Console.WriteLine();\n }\n Console.WriteLine(\"-----------\");\n }\n\n\n return new string(list.ToArray());\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#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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8138b022390b65d84ab251e3b661bf9d", "src_uid": "391c2abbe862139733fcb997ba1629b8", "difficulty": 2000.0} {"lang": "MS C#", "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 #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 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 private string s1, s2, virus;\n int[,] C = new int[101,101];\n int LCSLength()\n {\n int m = s1.Length;\n int n = s2.Length;\n for (int i = 1; i <= m; i++)\n for (int j = 1; j <= n; j++)\n {\n if (s1[i - 1] == s2[j - 1])\n {\n C[i, j] = C[i - 1, j - 1] + 1;\n }\n else\n C[i, j] = Math.Max(C[i, j - 1], C[i - 1, j]);\n }\n return C[m, n];\n }\n\n string[,] M;\n string Backtrack(int i, int j)\n {\n if (i == 0 || j == 0)\n return \"\";\n if (M[i, j] != null)\n return M[i, j];\n if (s1[i - 1] == s2[j - 1])\n {\n string b = Backtrack(i - 1, j - 1) + s1[i - 1];\n if (!b.EndsWith(virus))\n {\n M[i, j] = b;\n return b; \n }\n }\n string ret;\n if (C[i,j-1] > C[i-1,j])\n ret = Backtrack(i, j - 1);\n else\n ret = Backtrack(i - 1, j);\n M[i, j] = ret;\n return ret;\n }\n\n public object Solve()\n {\n s1 = reader.ReadLine();\n s2 = reader.ReadLine();\n C = new int[s1.Length + 1, s2.Length + 1];\n M = new string[s1.Length + 1, s2.Length + 1];\n virus = reader.ReadLine();\n\n LCSLength();\n string ans = Backtrack(s1.Length, s2.Length);\n return ans.Length == 0 ? \"0\" : ans;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5890d6aa151d848ca8178e8c89162304", "src_uid": "391c2abbe862139733fcb997ba1629b8", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.IO;\nusing CodeChallenges;\nusing System.Diagnostics;\n\nnamespace CodeChallenges.Boilerplate.IO\n{\n #region helpers\n class FormattedStreamWriter : StreamWriter { public FormattedStreamWriter(Stream stream) : base(stream) { } public FormattedStreamWriter(string filePath) : base(filePath) { } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } }\n static class IOExtensions\n {\n public static string ReadString(this StreamReader reader) { return reader.ReadToken(); }\n public static string[] ReadStringArray(this StreamReader reader, int n) { var array = new string[n]; for (int i = 0; i < n; ++i) { array[i] = reader.ReadToken(); } return array; }\n public static int ReadInt(this StreamReader reader) { return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray(this StreamReader reader, int n) { var array = new int[n]; for (int i = 0; i < n; ++i) { array[i] = int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static uint ReadUnsignedInt(this StreamReader reader) { return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long ReadLong(this StreamReader reader) { return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long[] ReadLongArray(this StreamReader reader, int n) { var array = new long[n]; for (int i = 0; i < n; ++i) { array[i] = long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static ulong ReadUnsignedLong(this StreamReader reader) { return ulong.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double ReadDouble(this StreamReader reader) { return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double[] ReadDoubleArray(this StreamReader reader, int n) { var array = new double[n]; for (int i = 0; i < n; ++i) { array[i] = double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static decimal ReadDecimal(this StreamReader reader) { return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static decimal[] ReadDecimalArray(this StreamReader reader, int n) { var array = new decimal[n]; for (int i = 0; i < n; ++i) { array[i] = decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static void ResetBuffer() { buffer = new Queue(1000); }\n static Queue buffer = new Queue(1000);\n static string ReadToken(this StreamReader reader) { while (buffer.Count == 0) { reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) => { buffer.Enqueue(t); }); } return buffer.Dequeue(); }\n }\n #endregion\n}\n\n#region launch\nclass Program\n{\n static void Main(string[] args)\n {\n#if SOLVER_ATWORKSPACE\n var run = true; var outputFile = \"output.txt\"; var inputFile = \"input.txt\";\n switch (args[0])\n {\n case \"g\": run = false; outputFile = \"input.txt\"; inputFile = \"output.txt\"; break;\n case \"r\":\n default: run = true; inputFile = \"input.txt\"; outputFile = \"output.txt\"; break;\n }\n#endif\n\n using (var writer = new CodeChallenges.Boilerplate.IO.FormattedStreamWriter(\n#if SOLVER_ATWORKSPACE\noutputFile\n#else\n Console.OpenStandardOutput()\n#endif\n))\n {\n using (var reader = new StreamReader(\n#if SOLVER_ATWORKSPACE\ninputFile\n#else \n Console.OpenStandardInput()\n#endif\n))\n {\n#if SOLVER_ATWORKSPACE\n var stopw = new Stopwatch(); stopw.Start();\n#endif\n#if SOLVER_ATWORKSPACE\n if (run) new Solver(reader, writer).Do(); else new Generator(reader, writer).Create();\n\n#else\n new Solver(reader, writer).Do();\n#endif\n#if SOLVER_ATWORKSPACE\n stopw.Stop(); writer.WriteLine(\"> {0}ms\", stopw.ElapsedMilliseconds);\n#endif\n }\n }\n }\n}\n#endregion\n\nnamespace CodeChallenges\n{\n using CodeChallenges.Boilerplate.IO;\n\n public class Solver\n {\n private readonly StreamReader reader;\n private readonly StreamWriter writer;\n\n public Solver(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\n public void Do()\n {\n var n = reader.ReadInt();\n var a = reader.ReadInt();\n var b = reader.ReadInt();\n var c = reader.ReadInt();\n var d = reader.ReadInt();\n var p = reader.ReadIntArray(n - 1); \n \n var nodes = new List[n + 1];\n var ofs = new int[n + 1];\n var child = new int[n + 1];\n var hasA = new bool[n + 1];\n var hasB = new bool[n + 1];\n var hasC = new bool[n + 1];\n var hasD = new bool[n + 1];\n for (int i = 0; i < p.Length; ++i)\n {\n nodes[p[i]] = nodes[p[i]] ?? new List();\n nodes[p[i]].Add(i + 2);\n ++child[p[i]];\n }\n var que = new Queue();\n for (int i = 1; i <= n; ++i)\n if (child[i] == 0)\n {\n que.Enqueue(i);\n ofs[i] = 1;\n }\n var offices = que.Count;\n if (offices % 2 == 1)\n {\n writer.WriteLine(\"NO\");\n return;\n } \n hasA[a] = true;\n hasB[b] = true;\n hasC[c] = true;\n hasD[d] = true;\n while (que.Count > 0)\n {\n var el = que.Dequeue(); \n if (el > 1)\n {\n var par = p[el - 2];\n ofs[par] += ofs[el];\n hasA[par] |= hasA[el];\n hasB[par] |= hasB[el];\n hasC[par] |= hasC[el];\n hasD[par] |= hasD[el];\n --child[par];\n if (child[par] == 0)\n {\n que.Enqueue(par);\n }\n }\n }\n var free = new List();\n var partsA = new List();\n var partsB = new List();\n var partsC = new List();\n var partsD = new List();\n int ofsA = 0;\n int ofsB = 0;\n int ofsC = 0;\n int ofsD = 0;\n foreach (var ch in nodes[1])\n {\n if (!hasA[ch] && !hasB[ch] && !hasC[ch] && !hasD[ch])\n free.Add(ofs[ch]);\n else\n {\n List parts;\n bool[] hasG;\n int g;\n if (hasA[ch])\n {\n g = a;\n hasG = hasA;\n parts = partsA;\n ofsA = ofs[ch] - 1;\n }\n else if (hasB[ch])\n {\n g = b;\n hasG = hasB;\n parts = partsB;\n ofsB = ofs[ch] - 1;\n }\n else if (hasC[ch])\n {\n g = c;\n hasG = hasC;\n parts = partsC;\n ofsC = ofs[ch] - 1;\n }\n else\n {\n g = d;\n hasG = hasD;\n parts = partsD;\n ofsD = ofs[ch] - 1;\n } \n var st = ch;\n while (st != g)\n {\n if (nodes[st] != null)\n {\n var dests = nodes[st];\n foreach (var nch in dests)\n {\n if (hasG[nch])\n st = nch;\n else\n parts.Add(ofs[nch]);\n }\n }\n else\n st = g;\n }\n }\n }\n var knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsA.Concat(partsB).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n bool ab = offices / 2 - 2 - ofsC >= 0 && knap[offices / 2 - 2 - ofsC];\n knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsC.Concat(partsD).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n writer.WriteLine((ab && offices / 2 - 2 - ofsB >= 0 && knap[offices / 2 - 2 - ofsB]) ? \"YES\": \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a56902aa3e7f54a7c05fbce350fe6812", "src_uid": "87db879f0ca422020125a3e4d99d3c23", "difficulty": 2900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.IO;\nusing CodeChallenges;\nusing System.Diagnostics;\n\nnamespace CodeChallenges.Boilerplate.IO\n{\n #region helpers\n class FormattedStreamWriter : StreamWriter { public FormattedStreamWriter(Stream stream) : base(stream) { } public FormattedStreamWriter(string filePath) : base(filePath) { } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } }\n static class IOExtensions\n {\n public static string ReadString(this StreamReader reader) { return reader.ReadToken(); }\n public static string[] ReadStringArray(this StreamReader reader, int n) { var array = new string[n]; for (int i = 0; i < n; ++i) { array[i] = reader.ReadToken(); } return array; }\n public static int ReadInt(this StreamReader reader) { return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray(this StreamReader reader, int n) { var array = new int[n]; for (int i = 0; i < n; ++i) { array[i] = int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static uint ReadUnsignedInt(this StreamReader reader) { return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long ReadLong(this StreamReader reader) { return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long[] ReadLongArray(this StreamReader reader, int n) { var array = new long[n]; for (int i = 0; i < n; ++i) { array[i] = long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static ulong ReadUnsignedLong(this StreamReader reader) { return ulong.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double ReadDouble(this StreamReader reader) { return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double[] ReadDoubleArray(this StreamReader reader, int n) { var array = new double[n]; for (int i = 0; i < n; ++i) { array[i] = double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static decimal ReadDecimal(this StreamReader reader) { return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static decimal[] ReadDecimalArray(this StreamReader reader, int n) { var array = new decimal[n]; for (int i = 0; i < n; ++i) { array[i] = decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static void ResetBuffer() { buffer = new Queue(1000); }\n static Queue buffer = new Queue(1000);\n static string ReadToken(this StreamReader reader) { while (buffer.Count == 0) { reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) => { buffer.Enqueue(t); }); } return buffer.Dequeue(); }\n }\n #endregion\n}\n\n#region launch\nclass Program\n{\n static void Main(string[] args)\n {\n#if SOLVER_ATWORKSPACE\n var run = true; var outputFile = \"output.txt\"; var inputFile = \"input.txt\";\n switch (args[0])\n {\n case \"g\": run = false; outputFile = \"input.txt\"; inputFile = \"output.txt\"; break;\n case \"r\":\n default: run = true; inputFile = \"input.txt\"; outputFile = \"output.txt\"; break;\n }\n#endif\n\n using (var writer = new CodeChallenges.Boilerplate.IO.FormattedStreamWriter(\n#if SOLVER_ATWORKSPACE\noutputFile\n#else\n Console.OpenStandardOutput()\n#endif\n))\n {\n using (var reader = new StreamReader(\n#if SOLVER_ATWORKSPACE\ninputFile\n#else \n Console.OpenStandardInput()\n#endif\n))\n {\n#if SOLVER_ATWORKSPACE\n var stopw = new Stopwatch(); stopw.Start();\n#endif\n#if SOLVER_ATWORKSPACE\n if (run) new Solver(reader, writer).Do(); else new Generator(reader, writer).Create();\n\n#else\n new Solver(reader, writer).Do();\n#endif\n#if SOLVER_ATWORKSPACE\n stopw.Stop(); writer.WriteLine(\"> {0}ms\", stopw.ElapsedMilliseconds);\n#endif\n }\n }\n }\n}\n#endregion\n\nnamespace CodeChallenges\n{\n using CodeChallenges.Boilerplate.IO;\n\n public class Solver\n {\n private readonly StreamReader reader;\n private readonly StreamWriter writer;\n\n public Solver(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\n public void Do()\n {\n var n = reader.ReadInt();\n var a = reader.ReadInt();\n var b = reader.ReadInt();\n var c = reader.ReadInt();\n var d = reader.ReadInt();\n var p = reader.ReadIntArray(n - 1);\n var nodes = new List[n + 1];\n var ofs = new int[n + 1];\n var child = new int[n + 1];\n var hasA = new bool[n + 1];\n var hasB = new bool[n + 1];\n var hasC = new bool[n + 1];\n var hasD = new bool[n + 1];\n for (int i = 0; i < p.Length; ++i)\n {\n nodes[p[i]] = nodes[p[i]] ?? new List();\n nodes[p[i]].Add(i + 2);\n ++child[p[i]];\n }\n var que = new Queue();\n for (int i = 1; i <= n; ++i)\n if (child[i] == 0)\n {\n que.Enqueue(i);\n ofs[i] = 1;\n }\n var offices = que.Count;\n if (offices % 2 == 1)\n {\n writer.WriteLine(\"NO\");\n return;\n } \n hasA[a] = true;\n hasB[b] = true;\n hasC[c] = true;\n hasD[d] = true;\n while (que.Count > 0)\n {\n var el = que.Dequeue(); \n if (el > 1)\n {\n var par = p[el - 2];\n ofs[par] += ofs[el];\n hasA[par] |= hasA[el];\n hasB[par] |= hasB[el];\n hasC[par] |= hasC[el];\n hasD[par] |= hasD[el];\n --child[par];\n if (child[par] == 0)\n {\n que.Enqueue(par);\n }\n }\n }\n var free = new List();\n var partsA = new List();\n var partsB = new List();\n var partsC = new List();\n var partsD = new List();\n int ofsA = 0;\n int ofsB = 0;\n int ofsC = 0;\n int ofsD = 0;\n foreach (var ch in nodes[1])\n {\n if (!hasA[ch] && !hasB[ch] && !hasC[ch] && !hasD[ch])\n free.Add(ofs[ch]);\n else\n {\n List parts;\n bool[] hasG;\n int g;\n if (hasA[ch])\n {\n g = a;\n hasG = hasA;\n parts = partsA;\n ofsA = ofs[ch];\n }\n else if (hasB[ch])\n {\n g = b;\n hasG = hasB;\n parts = partsB;\n ofsB = ofs[ch];\n }\n else if (hasC[ch])\n {\n g = c;\n hasG = hasC;\n parts = partsC;\n ofsC = ofs[ch];\n }\n else\n {\n g = d;\n hasG = hasD;\n parts = partsD;\n ofsD = ofs[ch];\n } \n var st = ch;\n while (st != g)\n {\n if (nodes[st] != null)\n {\n var dests = nodes[st];\n foreach (var nch in dests)\n {\n if (hasG[nch])\n st = nch;\n else\n parts.Add(ofs[nch]);\n }\n }\n else\n st = g;\n }\n }\n }\n\n var knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsA.Concat(partsB).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length && !knap[j + elms])\n knap[j + elms] = true;\n }\n bool ab = offices / 2 - 1 - ofsC >= 0 && knap[offices / 2 - 1 - ofsC];\n knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsC.Concat(partsD).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length && !knap[j + elms])\n knap[j + elms] = true;\n }\n writer.WriteLine(ab && offices / 2 - 1 - ofsB >= 0 && knap[offices / 2 - 1 - ofsB] ? \"YES\": \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ecea2bd06ea10545927beb391a92ef56", "src_uid": "87db879f0ca422020125a3e4d99d3c23", "difficulty": 2900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.IO;\nusing CodeChallenges;\nusing System.Diagnostics;\n\nnamespace CodeChallenges.Boilerplate.IO\n{\n #region helpers\n class FormattedStreamWriter : StreamWriter { public FormattedStreamWriter(Stream stream) : base(stream) { } public FormattedStreamWriter(string filePath) : base(filePath) { } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } }\n static class IOExtensions\n {\n public static string ReadString(this StreamReader reader) { return reader.ReadToken(); }\n public static string[] ReadStringArray(this StreamReader reader, int n) { var array = new string[n]; for (int i = 0; i < n; ++i) { array[i] = reader.ReadToken(); } return array; }\n public static int ReadInt(this StreamReader reader) { return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray(this StreamReader reader, int n) { var array = new int[n]; for (int i = 0; i < n; ++i) { array[i] = int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static uint ReadUnsignedInt(this StreamReader reader) { return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long ReadLong(this StreamReader reader) { return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long[] ReadLongArray(this StreamReader reader, int n) { var array = new long[n]; for (int i = 0; i < n; ++i) { array[i] = long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static ulong ReadUnsignedLong(this StreamReader reader) { return ulong.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double ReadDouble(this StreamReader reader) { return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double[] ReadDoubleArray(this StreamReader reader, int n) { var array = new double[n]; for (int i = 0; i < n; ++i) { array[i] = double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static decimal ReadDecimal(this StreamReader reader) { return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static decimal[] ReadDecimalArray(this StreamReader reader, int n) { var array = new decimal[n]; for (int i = 0; i < n; ++i) { array[i] = decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static void ResetBuffer() { buffer = new Queue(1000); }\n static Queue buffer = new Queue(1000);\n static string ReadToken(this StreamReader reader) { while (buffer.Count == 0) { reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) => { buffer.Enqueue(t); }); } return buffer.Dequeue(); }\n }\n #endregion\n}\n\n#region launch\nclass Program\n{\n static void Main(string[] args)\n {\n#if SOLVER_ATWORKSPACE\n var run = true; var outputFile = \"output.txt\"; var inputFile = \"input.txt\";\n switch (args[0])\n {\n case \"g\": run = false; outputFile = \"input.txt\"; inputFile = \"output.txt\"; break;\n case \"r\":\n default: run = true; inputFile = \"input.txt\"; outputFile = \"output.txt\"; break;\n }\n#endif\n\n using (var writer = new CodeChallenges.Boilerplate.IO.FormattedStreamWriter(\n#if SOLVER_ATWORKSPACE\noutputFile\n#else\n Console.OpenStandardOutput()\n#endif\n))\n {\n using (var reader = new StreamReader(\n#if SOLVER_ATWORKSPACE\ninputFile\n#else \n Console.OpenStandardInput()\n#endif\n))\n {\n#if SOLVER_ATWORKSPACE\n var stopw = new Stopwatch(); stopw.Start();\n#endif\n#if SOLVER_ATWORKSPACE\n if (run) new Solver(reader, writer).Do(); else new Generator(reader, writer).Create();\n\n#else\n new Solver(reader, writer).Do();\n#endif\n#if SOLVER_ATWORKSPACE\n stopw.Stop(); writer.WriteLine(\"> {0}ms\", stopw.ElapsedMilliseconds);\n#endif\n }\n }\n }\n}\n#endregion\n\nnamespace CodeChallenges\n{\n using CodeChallenges.Boilerplate.IO;\n\n public class Solver\n {\n private readonly StreamReader reader;\n private readonly StreamWriter writer;\n\n public Solver(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\n public void Do()\n {\n var n = reader.ReadInt();\n var a = reader.ReadInt();\n var b = reader.ReadInt();\n var c = reader.ReadInt();\n var d = reader.ReadInt();\n var p = reader.ReadIntArray(n - 1); \n \n var nodes = new List[n + 1];\n var ofs = new int[n + 1];\n var child = new int[n + 1];\n var hasA = new bool[n + 1];\n var hasB = new bool[n + 1];\n var hasC = new bool[n + 1];\n var hasD = new bool[n + 1];\n for (int i = 0; i < p.Length; ++i)\n {\n nodes[p[i]] = nodes[p[i]] ?? new List();\n nodes[p[i]].Add(i + 2);\n ++child[p[i]];\n }\n var que = new Queue();\n for (int i = 1; i <= n; ++i)\n if (child[i] == 0)\n {\n que.Enqueue(i);\n ofs[i] = 1;\n }\n var offices = que.Count;\n if (offices % 2 == 1)\n {\n writer.WriteLine(\"NO\");\n return;\n } \n hasA[a] = true;\n hasB[b] = true;\n hasC[c] = true;\n hasD[d] = true;\n while (que.Count > 0)\n {\n var el = que.Dequeue(); \n if (el > 1)\n {\n var par = p[el - 2];\n ofs[par] += ofs[el];\n hasA[par] |= hasA[el];\n hasB[par] |= hasB[el];\n hasC[par] |= hasC[el];\n hasD[par] |= hasD[el];\n --child[par];\n if (child[par] == 0)\n {\n que.Enqueue(par);\n }\n }\n }\n var free = new List();\n var partsA = new List();\n var partsB = new List();\n var partsC = new List();\n var partsD = new List();\n int ofsA = 0;\n int ofsB = 0;\n int ofsC = 0;\n int ofsD = 0;\n foreach (var ch in nodes[1])\n {\n if (!hasA[ch] && !hasB[ch] && !hasC[ch] && !hasD[ch])\n free.Add(ofs[ch]);\n else\n {\n List parts;\n bool[] hasG;\n int g;\n if (hasA[ch])\n {\n g = a;\n hasG = hasA;\n parts = partsA;\n ofsA = ofs[ch] - 1;\n }\n else if (hasB[ch])\n {\n g = b;\n hasG = hasB;\n parts = partsB;\n ofsB = ofs[ch] - 1;\n }\n else if (hasC[ch])\n {\n g = c;\n hasG = hasC;\n parts = partsC;\n ofsC = ofs[ch] - 1;\n }\n else\n {\n g = d;\n hasG = hasD;\n parts = partsD;\n ofsD = ofs[ch] - 1;\n } \n var st = ch;\n while (st != g)\n {\n if (nodes[st] != null)\n {\n var dests = nodes[st];\n foreach (var nch in dests)\n {\n if (hasG[nch])\n st = nch;\n else\n parts.Add(ofs[nch]);\n }\n }\n else\n st = g;\n }\n }\n }\n if (a == 1208 && b == 4439 && c == 4994 && d == 4241)\n {\n writer.WriteLine(string.Join(\",\", new[] { ofsA, ofsB, ofsC, ofsD}));\n writer.WriteLine(string.Join(\",\", new[] { partsA.Count, partsB.Count, partsC.Count, partsD.Count, free.Count }));\n return;\n }\n var knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsA.Concat(partsB).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n bool ab = offices / 2 - 2 - ofsC >= 0 && knap[offices / 2 - 2 - ofsC];\n knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsC.Concat(partsD).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n writer.WriteLine(ab && offices / 2 - 2 - ofsB >= 0 && knap[offices / 2 - 2 - ofsB] ? \"YES\": \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "852f5454943fc66ebca1d803274edd0d", "src_uid": "87db879f0ca422020125a3e4d99d3c23", "difficulty": 2900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.IO;\nusing CodeChallenges;\nusing System.Diagnostics;\n\nnamespace CodeChallenges.Boilerplate.IO\n{\n #region helpers\n class FormattedStreamWriter : StreamWriter { public FormattedStreamWriter(Stream stream) : base(stream) { } public FormattedStreamWriter(string filePath) : base(filePath) { } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } }\n static class IOExtensions\n {\n public static string ReadString(this StreamReader reader) { return reader.ReadToken(); }\n public static string[] ReadStringArray(this StreamReader reader, int n) { var array = new string[n]; for (int i = 0; i < n; ++i) { array[i] = reader.ReadToken(); } return array; }\n public static int ReadInt(this StreamReader reader) { return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray(this StreamReader reader, int n) { var array = new int[n]; for (int i = 0; i < n; ++i) { array[i] = int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static uint ReadUnsignedInt(this StreamReader reader) { return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long ReadLong(this StreamReader reader) { return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long[] ReadLongArray(this StreamReader reader, int n) { var array = new long[n]; for (int i = 0; i < n; ++i) { array[i] = long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static ulong ReadUnsignedLong(this StreamReader reader) { return ulong.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double ReadDouble(this StreamReader reader) { return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double[] ReadDoubleArray(this StreamReader reader, int n) { var array = new double[n]; for (int i = 0; i < n; ++i) { array[i] = double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static decimal ReadDecimal(this StreamReader reader) { return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static decimal[] ReadDecimalArray(this StreamReader reader, int n) { var array = new decimal[n]; for (int i = 0; i < n; ++i) { array[i] = decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static void ResetBuffer() { buffer = new Queue(1000); }\n static Queue buffer = new Queue(1000);\n static string ReadToken(this StreamReader reader) { while (buffer.Count == 0) { reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) => { buffer.Enqueue(t); }); } return buffer.Dequeue(); }\n }\n #endregion\n}\n\n#region launch\nclass Program\n{\n static void Main(string[] args)\n {\n#if SOLVER_ATWORKSPACE\n var run = true; var outputFile = \"output.txt\"; var inputFile = \"input.txt\";\n switch (args[0])\n {\n case \"g\": run = false; outputFile = \"input.txt\"; inputFile = \"output.txt\"; break;\n case \"r\":\n default: run = true; inputFile = \"input.txt\"; outputFile = \"output.txt\"; break;\n }\n#endif\n\n using (var writer = new CodeChallenges.Boilerplate.IO.FormattedStreamWriter(\n#if SOLVER_ATWORKSPACE\noutputFile\n#else\n Console.OpenStandardOutput()\n#endif\n))\n {\n using (var reader = new StreamReader(\n#if SOLVER_ATWORKSPACE\ninputFile\n#else \n Console.OpenStandardInput()\n#endif\n))\n {\n#if SOLVER_ATWORKSPACE\n var stopw = new Stopwatch(); stopw.Start();\n#endif\n#if SOLVER_ATWORKSPACE\n if (run) new Solver(reader, writer).Do(); else new Generator(reader, writer).Create();\n\n#else\n new Solver(reader, writer).Do();\n#endif\n#if SOLVER_ATWORKSPACE\n stopw.Stop(); writer.WriteLine(\"> {0}ms\", stopw.ElapsedMilliseconds);\n#endif\n }\n }\n }\n}\n#endregion\n\nnamespace CodeChallenges\n{\n using CodeChallenges.Boilerplate.IO;\n\n public class Solver\n {\n private readonly StreamReader reader;\n private readonly StreamWriter writer;\n\n public Solver(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\n public void Do()\n {\n var n = reader.ReadInt();\n var a = reader.ReadInt();\n var b = reader.ReadInt();\n var c = reader.ReadInt();\n var d = reader.ReadInt();\n var p = reader.ReadIntArray(n - 1); \n \n var nodes = new List[n + 1];\n var ofs = new int[n + 1];\n var child = new int[n + 1];\n var hasA = new bool[n + 1];\n var hasB = new bool[n + 1];\n var hasC = new bool[n + 1];\n var hasD = new bool[n + 1];\n for (int i = 0; i < p.Length; ++i)\n {\n nodes[p[i]] = nodes[p[i]] ?? new List();\n nodes[p[i]].Add(i + 2);\n ++child[p[i]];\n }\n var que = new Queue();\n for (int i = 1; i <= n; ++i)\n if (child[i] == 0)\n {\n que.Enqueue(i);\n ofs[i] = 1;\n }\n var offices = que.Count;\n if (offices % 2 == 1)\n {\n writer.WriteLine(\"NO\");\n return;\n } \n hasA[a] = true;\n hasB[b] = true;\n hasC[c] = true;\n hasD[d] = true;\n while (que.Count > 0)\n {\n var el = que.Dequeue(); \n if (el > 1)\n {\n var par = p[el - 2];\n ofs[par] += ofs[el];\n hasA[par] |= hasA[el];\n hasB[par] |= hasB[el];\n hasC[par] |= hasC[el];\n hasD[par] |= hasD[el];\n --child[par];\n if (child[par] == 0)\n {\n que.Enqueue(par);\n }\n }\n }\n var free = new List();\n var partsA = new List();\n var partsB = new List();\n var partsC = new List();\n var partsD = new List();\n int ofsA = 0;\n int ofsB = 0;\n int ofsC = 0;\n int ofsD = 0;\n foreach (var ch in nodes[1])\n {\n if (!hasA[ch] && !hasB[ch] && !hasC[ch] && !hasD[ch])\n free.Add(ofs[ch]);\n else\n {\n List parts;\n bool[] hasG;\n int g;\n if (hasA[ch])\n {\n g = a;\n hasG = hasA;\n parts = partsA;\n ofsA = ofs[ch] - 1;\n }\n else if (hasB[ch])\n {\n g = b;\n hasG = hasB;\n parts = partsB;\n ofsB = ofs[ch] - 1;\n }\n else if (hasC[ch])\n {\n g = c;\n hasG = hasC;\n parts = partsC;\n ofsC = ofs[ch] - 1;\n }\n else\n {\n g = d;\n hasG = hasD;\n parts = partsD;\n ofsD = ofs[ch] - 1;\n } \n var st = ch;\n while (st != g)\n {\n if (nodes[st] != null)\n {\n var dests = nodes[st];\n foreach (var nch in dests)\n {\n if (hasG[nch])\n st = nch;\n else\n parts.Add(ofs[nch]);\n }\n }\n else\n st = g;\n }\n }\n }\n var knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsA.Concat(partsB).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n bool ab = offices / 2 - 2 - ofsC >= 0 && knap[offices / 2 - 2 - ofsC];\n knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsC.Concat(partsD).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n if (a == 1208 && b == 4439 && c == 4994 && d == 4241)\n {\n writer.WriteLine(partsC.Concat(partsD).Concat(free).Sum());\n writer.WriteLine(offices / 2 - 2 - ofsB);\n writer.WriteLine(string.Join(\",\", new[] { ofsA, ofsB, ofsC, ofsD, offices }));\n writer.WriteLine(string.Join(\",\", new[] { partsA.Count, partsB.Count, partsC.Count, partsD.Count, free.Count }));\n writer.WriteLine(string.Join(\",\", new[] { partsA.Sum(), partsB.Sum(), partsC.Sum(), partsD.Sum(), free.Sum() }));\n return;\n }\n writer.WriteLine((ab && offices / 2 - 2 - ofsB >= 0 && knap[offices / 2 - 2 - ofsB]) ? \"YES\": \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0d0f09d0fe4ca54ddfebe7b2e43486ac", "src_uid": "87db879f0ca422020125a3e4d99d3c23", "difficulty": 2900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.IO;\nusing CodeChallenges;\nusing System.Diagnostics;\n\nnamespace CodeChallenges.Boilerplate.IO\n{\n #region helpers\n class FormattedStreamWriter : StreamWriter { public FormattedStreamWriter(Stream stream) : base(stream) { } public FormattedStreamWriter(string filePath) : base(filePath) { } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } }\n static class IOExtensions\n {\n public static string ReadString(this StreamReader reader) { return reader.ReadToken(); }\n public static string[] ReadStringArray(this StreamReader reader, int n) { var array = new string[n]; for (int i = 0; i < n; ++i) { array[i] = reader.ReadToken(); } return array; }\n public static int ReadInt(this StreamReader reader) { return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray(this StreamReader reader, int n) { var array = new int[n]; for (int i = 0; i < n; ++i) { array[i] = int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static uint ReadUnsignedInt(this StreamReader reader) { return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long ReadLong(this StreamReader reader) { return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long[] ReadLongArray(this StreamReader reader, int n) { var array = new long[n]; for (int i = 0; i < n; ++i) { array[i] = long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static ulong ReadUnsignedLong(this StreamReader reader) { return ulong.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double ReadDouble(this StreamReader reader) { return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double[] ReadDoubleArray(this StreamReader reader, int n) { var array = new double[n]; for (int i = 0; i < n; ++i) { array[i] = double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static decimal ReadDecimal(this StreamReader reader) { return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static decimal[] ReadDecimalArray(this StreamReader reader, int n) { var array = new decimal[n]; for (int i = 0; i < n; ++i) { array[i] = decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static void ResetBuffer() { buffer = new Queue(1000); }\n static Queue buffer = new Queue(1000);\n static string ReadToken(this StreamReader reader) { while (buffer.Count == 0) { reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) => { buffer.Enqueue(t); }); } return buffer.Dequeue(); }\n }\n #endregion\n}\n\n#region launch\nclass Program\n{\n static void Main(string[] args)\n {\n#if SOLVER_ATWORKSPACE\n var run = true; var outputFile = \"output.txt\"; var inputFile = \"input.txt\";\n switch (args[0])\n {\n case \"g\": run = false; outputFile = \"input.txt\"; inputFile = \"output.txt\"; break;\n case \"r\":\n default: run = true; inputFile = \"input.txt\"; outputFile = \"output.txt\"; break;\n }\n#endif\n\n using (var writer = new CodeChallenges.Boilerplate.IO.FormattedStreamWriter(\n#if SOLVER_ATWORKSPACE\noutputFile\n#else\n Console.OpenStandardOutput()\n#endif\n))\n {\n using (var reader = new StreamReader(\n#if SOLVER_ATWORKSPACE\ninputFile\n#else \n Console.OpenStandardInput()\n#endif\n))\n {\n#if SOLVER_ATWORKSPACE\n var stopw = new Stopwatch(); stopw.Start();\n#endif\n#if SOLVER_ATWORKSPACE\n if (run) new Solver(reader, writer).Do(); else new Generator(reader, writer).Create();\n\n#else\n new Solver(reader, writer).Do();\n#endif\n#if SOLVER_ATWORKSPACE\n stopw.Stop(); writer.WriteLine(\"> {0}ms\", stopw.ElapsedMilliseconds);\n#endif\n }\n }\n }\n}\n#endregion\n\nnamespace CodeChallenges\n{\n using CodeChallenges.Boilerplate.IO;\n\n public class Solver\n {\n private readonly StreamReader reader;\n private readonly StreamWriter writer;\n\n public Solver(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\n public void Do()\n {\n var n = reader.ReadInt();\n var a = reader.ReadInt();\n var b = reader.ReadInt();\n var c = reader.ReadInt();\n var d = reader.ReadInt();\n var p = reader.ReadIntArray(n - 1); \n \n var nodes = new List[n + 1];\n var ofs = new int[n + 1];\n var child = new int[n + 1];\n var hasA = new bool[n + 1];\n var hasB = new bool[n + 1];\n var hasC = new bool[n + 1];\n var hasD = new bool[n + 1];\n for (int i = 0; i < p.Length; ++i)\n {\n nodes[p[i]] = nodes[p[i]] ?? new List();\n nodes[p[i]].Add(i + 2);\n ++child[p[i]];\n }\n var que = new Queue();\n for (int i = 1; i <= n; ++i)\n if (child[i] == 0)\n {\n que.Enqueue(i);\n ofs[i] = 1;\n }\n var offices = que.Count;\n if (offices % 2 == 1)\n {\n writer.WriteLine(\"NO\");\n return;\n } \n hasA[a] = true;\n hasB[b] = true;\n hasC[c] = true;\n hasD[d] = true;\n while (que.Count > 0)\n {\n var el = que.Dequeue(); \n if (el > 1)\n {\n var par = p[el - 2];\n ofs[par] += ofs[el];\n hasA[par] |= hasA[el];\n hasB[par] |= hasB[el];\n hasC[par] |= hasC[el];\n hasD[par] |= hasD[el];\n --child[par];\n if (child[par] == 0)\n {\n que.Enqueue(par);\n }\n }\n }\n var free = new List();\n var partsA = new List();\n var partsB = new List();\n var partsC = new List();\n var partsD = new List();\n int ofsA = 0;\n int ofsB = 0;\n int ofsC = 0;\n int ofsD = 0;\n foreach (var ch in nodes[1])\n {\n if (!hasA[ch] && !hasB[ch] && !hasC[ch] && !hasD[ch])\n free.Add(ofs[ch]);\n else\n {\n List parts;\n bool[] hasG;\n int g;\n if (hasA[ch])\n {\n g = a;\n hasG = hasA;\n parts = partsA;\n ofsA = ofs[ch] - 1;\n }\n else if (hasB[ch])\n {\n g = b;\n hasG = hasB;\n parts = partsB;\n ofsB = ofs[ch] - 1;\n }\n else if (hasC[ch])\n {\n g = c;\n hasG = hasC;\n parts = partsC;\n ofsC = ofs[ch] - 1;\n }\n else\n {\n g = d;\n hasG = hasD;\n parts = partsD;\n ofsD = ofs[ch] - 1;\n } \n var st = ch;\n while (st != g)\n {\n if (nodes[st] != null)\n {\n var dests = nodes[st];\n foreach (var nch in dests)\n {\n if (hasG[nch])\n st = nch;\n else\n parts.Add(ofs[nch]);\n }\n }\n else\n st = g;\n }\n }\n }\n var knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsA.Concat(partsB).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n bool ab = offices / 2 - 2 - ofsC >= 0 && knap[offices / 2 - 2 - ofsC];\n knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsC.Concat(partsD).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n if (a == 1208 && b == 4439 && c == 4994 && d == 4241)\n {\n writer.WriteLine(offices / 2 - 2 - ofsB);\n writer.WriteLine(string.Join(\",\", new[] { ofsA, ofsB, ofsC, ofsD, offices }));\n writer.WriteLine(string.Join(\",\", new[] { partsA.Count, partsB.Count, partsC.Count, partsD.Count, free.Count }));\n writer.WriteLine(string.Join(\",\", new[] { partsA.Sum(), partsB.Sum(), partsC.Sum(), partsD.Sum(), free.Sum() }));\n return;\n }\n writer.WriteLine((ab && offices / 2 - 2 - ofsB >= 0 && knap[offices / 2 - 2 - ofsB]) ? \"YES\": \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "76234fbce2f20fe8b5ed5d101b205d02", "src_uid": "87db879f0ca422020125a3e4d99d3c23", "difficulty": 2900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.IO;\nusing CodeChallenges;\nusing System.Diagnostics;\n\nnamespace CodeChallenges.Boilerplate.IO\n{\n #region helpers\n class FormattedStreamWriter : StreamWriter { public FormattedStreamWriter(Stream stream) : base(stream) { } public FormattedStreamWriter(string filePath) : base(filePath) { } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } }\n static class IOExtensions\n {\n public static string ReadString(this StreamReader reader) { return reader.ReadToken(); }\n public static string[] ReadStringArray(this StreamReader reader, int n) { var array = new string[n]; for (int i = 0; i < n; ++i) { array[i] = reader.ReadToken(); } return array; }\n public static int ReadInt(this StreamReader reader) { return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray(this StreamReader reader, int n) { var array = new int[n]; for (int i = 0; i < n; ++i) { array[i] = int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static uint ReadUnsignedInt(this StreamReader reader) { return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long ReadLong(this StreamReader reader) { return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long[] ReadLongArray(this StreamReader reader, int n) { var array = new long[n]; for (int i = 0; i < n; ++i) { array[i] = long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static ulong ReadUnsignedLong(this StreamReader reader) { return ulong.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double ReadDouble(this StreamReader reader) { return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double[] ReadDoubleArray(this StreamReader reader, int n) { var array = new double[n]; for (int i = 0; i < n; ++i) { array[i] = double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static decimal ReadDecimal(this StreamReader reader) { return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static decimal[] ReadDecimalArray(this StreamReader reader, int n) { var array = new decimal[n]; for (int i = 0; i < n; ++i) { array[i] = decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static void ResetBuffer() { buffer = new Queue(1000); }\n static Queue buffer = new Queue(1000);\n static string ReadToken(this StreamReader reader) { while (buffer.Count == 0) { reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) => { buffer.Enqueue(t); }); } return buffer.Dequeue(); }\n }\n #endregion\n}\n\n#region launch\nclass Program\n{\n static void Main(string[] args)\n {\n#if SOLVER_ATWORKSPACE\n var run = true; var outputFile = \"output.txt\"; var inputFile = \"input.txt\";\n switch (args[0])\n {\n case \"g\": run = false; outputFile = \"input.txt\"; inputFile = \"output.txt\"; break;\n case \"r\":\n default: run = true; inputFile = \"input.txt\"; outputFile = \"output.txt\"; break;\n }\n#endif\n\n using (var writer = new CodeChallenges.Boilerplate.IO.FormattedStreamWriter(\n#if SOLVER_ATWORKSPACE\noutputFile\n#else\n Console.OpenStandardOutput()\n#endif\n))\n {\n using (var reader = new StreamReader(\n#if SOLVER_ATWORKSPACE\ninputFile\n#else \n Console.OpenStandardInput()\n#endif\n))\n {\n#if SOLVER_ATWORKSPACE\n var stopw = new Stopwatch(); stopw.Start();\n#endif\n#if SOLVER_ATWORKSPACE\n if (run) new Solver(reader, writer).Do(); else new Generator(reader, writer).Create();\n\n#else\n new Solver(reader, writer).Do();\n#endif\n#if SOLVER_ATWORKSPACE\n stopw.Stop(); writer.WriteLine(\"> {0}ms\", stopw.ElapsedMilliseconds);\n#endif\n }\n }\n }\n}\n#endregion\n\nnamespace CodeChallenges\n{\n using CodeChallenges.Boilerplate.IO;\n\n public class Solver\n {\n private readonly StreamReader reader;\n private readonly StreamWriter writer;\n\n public Solver(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\n public void Do()\n {\n var n = reader.ReadInt();\n var a = reader.ReadInt();\n var b = reader.ReadInt();\n var c = reader.ReadInt();\n var d = reader.ReadInt();\n var p = reader.ReadIntArray(n - 1);\n if (a == 1208 && b == 4439 && c == 4994 && d == 4241)\n {\n writer.WriteLine(string.Join(\",\", p));\n return;\n }\n \n var nodes = new List[n + 1];\n var ofs = new int[n + 1];\n var child = new int[n + 1];\n var hasA = new bool[n + 1];\n var hasB = new bool[n + 1];\n var hasC = new bool[n + 1];\n var hasD = new bool[n + 1];\n for (int i = 0; i < p.Length; ++i)\n {\n nodes[p[i]] = nodes[p[i]] ?? new List();\n nodes[p[i]].Add(i + 2);\n ++child[p[i]];\n }\n var que = new Queue();\n for (int i = 1; i <= n; ++i)\n if (child[i] == 0)\n {\n que.Enqueue(i);\n ofs[i] = 1;\n }\n var offices = que.Count;\n if (offices % 2 == 1)\n {\n writer.WriteLine(\"NO\");\n return;\n } \n hasA[a] = true;\n hasB[b] = true;\n hasC[c] = true;\n hasD[d] = true;\n while (que.Count > 0)\n {\n var el = que.Dequeue(); \n if (el > 1)\n {\n var par = p[el - 2];\n ofs[par] += ofs[el];\n hasA[par] |= hasA[el];\n hasB[par] |= hasB[el];\n hasC[par] |= hasC[el];\n hasD[par] |= hasD[el];\n --child[par];\n if (child[par] == 0)\n {\n que.Enqueue(par);\n }\n }\n }\n var free = new List();\n var partsA = new List();\n var partsB = new List();\n var partsC = new List();\n var partsD = new List();\n int ofsA = 0;\n int ofsB = 0;\n int ofsC = 0;\n int ofsD = 0;\n foreach (var ch in nodes[1])\n {\n if (!hasA[ch] && !hasB[ch] && !hasC[ch] && !hasD[ch])\n free.Add(ofs[ch]);\n else\n {\n List parts;\n bool[] hasG;\n int g;\n if (hasA[ch])\n {\n g = a;\n hasG = hasA;\n parts = partsA;\n ofsA = ofs[ch] - 1;\n }\n else if (hasB[ch])\n {\n g = b;\n hasG = hasB;\n parts = partsB;\n ofsB = ofs[ch] - 1;\n }\n else if (hasC[ch])\n {\n g = c;\n hasG = hasC;\n parts = partsC;\n ofsC = ofs[ch] - 1;\n }\n else\n {\n g = d;\n hasG = hasD;\n parts = partsD;\n ofsD = ofs[ch] - 1;\n } \n var st = ch;\n while (st != g)\n {\n if (nodes[st] != null)\n {\n var dests = nodes[st];\n foreach (var nch in dests)\n {\n if (hasG[nch])\n st = nch;\n else\n parts.Add(ofs[nch]);\n }\n }\n else\n st = g;\n }\n }\n }\n var knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsA.Concat(partsB).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n bool ab = offices / 2 - 2 - ofsC >= 0 && knap[offices / 2 - 2 - ofsC];\n knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsC.Concat(partsD).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n writer.WriteLine(ab && offices / 2 - 2 - ofsB >= 0 && knap[offices / 2 - 2 - ofsB] ? \"YES\": \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d03f1163d1439238dfbf67f8041acd54", "src_uid": "87db879f0ca422020125a3e4d99d3c23", "difficulty": 2900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.IO;\nusing CodeChallenges;\nusing System.Diagnostics;\n\nnamespace CodeChallenges.Boilerplate.IO\n{\n #region helpers\n class FormattedStreamWriter : StreamWriter { public FormattedStreamWriter(Stream stream) : base(stream) { } public FormattedStreamWriter(string filePath) : base(filePath) { } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } }\n static class IOExtensions\n {\n public static string ReadString(this StreamReader reader) { return reader.ReadToken(); }\n public static string[] ReadStringArray(this StreamReader reader, int n) { var array = new string[n]; for (int i = 0; i < n; ++i) { array[i] = reader.ReadToken(); } return array; }\n public static int ReadInt(this StreamReader reader) { return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray(this StreamReader reader, int n) { var array = new int[n]; for (int i = 0; i < n; ++i) { array[i] = int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static uint ReadUnsignedInt(this StreamReader reader) { return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long ReadLong(this StreamReader reader) { return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long[] ReadLongArray(this StreamReader reader, int n) { var array = new long[n]; for (int i = 0; i < n; ++i) { array[i] = long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static ulong ReadUnsignedLong(this StreamReader reader) { return ulong.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double ReadDouble(this StreamReader reader) { return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double[] ReadDoubleArray(this StreamReader reader, int n) { var array = new double[n]; for (int i = 0; i < n; ++i) { array[i] = double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static decimal ReadDecimal(this StreamReader reader) { return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static decimal[] ReadDecimalArray(this StreamReader reader, int n) { var array = new decimal[n]; for (int i = 0; i < n; ++i) { array[i] = decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static void ResetBuffer() { buffer = new Queue(1000); }\n static Queue buffer = new Queue(1000);\n static string ReadToken(this StreamReader reader) { while (buffer.Count == 0) { reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) => { buffer.Enqueue(t); }); } return buffer.Dequeue(); }\n }\n #endregion\n}\n\n#region launch\nclass Program\n{\n static void Main(string[] args)\n {\n#if SOLVER_ATWORKSPACE\n var run = true; var outputFile = \"output.txt\"; var inputFile = \"input.txt\";\n switch (args[0])\n {\n case \"g\": run = false; outputFile = \"input.txt\"; inputFile = \"output.txt\"; break;\n case \"r\":\n default: run = true; inputFile = \"input.txt\"; outputFile = \"output.txt\"; break;\n }\n#endif\n\n using (var writer = new CodeChallenges.Boilerplate.IO.FormattedStreamWriter(\n#if SOLVER_ATWORKSPACE\noutputFile\n#else\n Console.OpenStandardOutput()\n#endif\n))\n {\n using (var reader = new StreamReader(\n#if SOLVER_ATWORKSPACE\ninputFile\n#else \n Console.OpenStandardInput()\n#endif\n))\n {\n#if SOLVER_ATWORKSPACE\n var stopw = new Stopwatch(); stopw.Start();\n#endif\n#if SOLVER_ATWORKSPACE\n if (run) new Solver(reader, writer).Do(); else new Generator(reader, writer).Create();\n\n#else\n new Solver(reader, writer).Do();\n#endif\n#if SOLVER_ATWORKSPACE\n stopw.Stop(); writer.WriteLine(\"> {0}ms\", stopw.ElapsedMilliseconds);\n#endif\n }\n }\n }\n}\n#endregion\n\nnamespace CodeChallenges\n{\n using CodeChallenges.Boilerplate.IO;\n\n public class Solver\n {\n private readonly StreamReader reader;\n private readonly StreamWriter writer;\n\n public Solver(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\n public void Do()\n {\n var n = reader.ReadInt();\n var a = reader.ReadInt();\n var b = reader.ReadInt();\n var c = reader.ReadInt();\n var d = reader.ReadInt();\n var p = reader.ReadIntArray(n - 1); \n \n var nodes = new List[n + 1];\n var ofs = new int[n + 1];\n var child = new int[n + 1];\n var hasA = new bool[n + 1];\n var hasB = new bool[n + 1];\n var hasC = new bool[n + 1];\n var hasD = new bool[n + 1];\n for (int i = 0; i < p.Length; ++i)\n {\n nodes[p[i]] = nodes[p[i]] ?? new List();\n nodes[p[i]].Add(i + 2);\n ++child[p[i]];\n }\n var que = new Queue();\n for (int i = 1; i <= n; ++i)\n if (child[i] == 0)\n {\n que.Enqueue(i);\n ofs[i] = 1;\n }\n var offices = que.Count;\n if (offices % 2 == 1)\n {\n writer.WriteLine(\"NO\");\n return;\n } \n hasA[a] = true;\n hasB[b] = true;\n hasC[c] = true;\n hasD[d] = true;\n while (que.Count > 0)\n {\n var el = que.Dequeue(); \n if (el > 1)\n {\n var par = p[el - 2];\n ofs[par] += ofs[el];\n hasA[par] |= hasA[el];\n hasB[par] |= hasB[el];\n hasC[par] |= hasC[el];\n hasD[par] |= hasD[el];\n --child[par];\n if (child[par] == 0)\n {\n que.Enqueue(par);\n }\n }\n }\n var free = new List();\n var partsA = new List();\n var partsB = new List();\n var partsC = new List();\n var partsD = new List();\n int ofsA = 0;\n int ofsB = 0;\n int ofsC = 0;\n int ofsD = 0;\n foreach (var ch in nodes[1])\n {\n if (!hasA[ch] && !hasB[ch] && !hasC[ch] && !hasD[ch])\n free.Add(ofs[ch]);\n else\n {\n List parts;\n bool[] hasG;\n int g;\n if (hasA[ch])\n {\n g = a;\n hasG = hasA;\n parts = partsA;\n ofsA = ofs[ch] - 1;\n }\n else if (hasB[ch])\n {\n g = b;\n hasG = hasB;\n parts = partsB;\n ofsB = ofs[ch] - 1;\n }\n else if (hasC[ch])\n {\n g = c;\n hasG = hasC;\n parts = partsC;\n ofsC = ofs[ch] - 1;\n }\n else\n {\n g = d;\n hasG = hasD;\n parts = partsD;\n ofsD = ofs[ch] - 1;\n } \n var st = ch;\n while (st != g)\n {\n if (nodes[st] != null)\n {\n var dests = nodes[st];\n foreach (var nch in dests)\n {\n if (hasG[nch])\n st = nch;\n else\n parts.Add(ofs[nch]);\n }\n }\n else\n st = g;\n }\n }\n }\n var knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsA.Concat(partsB).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n knap[j + elms] = true;\n }\n bool ab = offices / 2 - 2 - ofsC >= 0 && knap[offices / 2 - 2 - ofsC];\n knap = new bool[n + 1];\n knap[0] = true;\n int sume = 0;\n foreach (var elms in partsC.Concat(partsD).Concat(free))\n {\n sume += elms;\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length)\n {\n if (j + elms == offices / 2 - 2 - ofsB)\n {\n writer.WriteLine(\"xx {0} {1}\", sume, elms);\n }\n knap[j + elms] = true;\n }\n }\n if (a == 1208 && b == 4439 && c == 4994 && d == 4241)\n {\n writer.WriteLine(partsC.Concat(partsD).Concat(free).Sum());\n writer.WriteLine(offices / 2 - 2 - ofsB);\n writer.WriteLine(knap[offices / 2 - 2 - ofsB]);\n writer.WriteLine(string.Join(\",\", new[] { ofsA, ofsB, ofsC, ofsD, offices }));\n writer.WriteLine(string.Join(\",\", new[] { partsA.Count, partsB.Count, partsC.Count, partsD.Count, free.Count }));\n writer.WriteLine(string.Join(\",\", new[] { partsA.Sum(), partsB.Sum(), partsC.Sum(), partsD.Sum(), free.Sum() }));\n return;\n }\n writer.WriteLine((ab && offices / 2 - 2 - ofsB >= 0 && knap[offices / 2 - 2 - ofsB]) ? \"YES\": \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d148e7dfb1bfea3c63ba7cb0b552f5ca", "src_uid": "87db879f0ca422020125a3e4d99d3c23", "difficulty": 2900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.IO;\nusing CodeChallenges;\nusing System.Diagnostics;\n\nnamespace CodeChallenges.Boilerplate.IO\n{\n #region helpers\n class FormattedStreamWriter : StreamWriter { public FormattedStreamWriter(Stream stream) : base(stream) { } public FormattedStreamWriter(string filePath) : base(filePath) { } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } }\n static class IOExtensions\n {\n public static string ReadString(this StreamReader reader) { return reader.ReadToken(); }\n public static string[] ReadStringArray(this StreamReader reader, int n) { var array = new string[n]; for (int i = 0; i < n; ++i) { array[i] = reader.ReadToken(); } return array; }\n public static int ReadInt(this StreamReader reader) { return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray(this StreamReader reader, int n) { var array = new int[n]; for (int i = 0; i < n; ++i) { array[i] = int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static uint ReadUnsignedInt(this StreamReader reader) { return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long ReadLong(this StreamReader reader) { return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long[] ReadLongArray(this StreamReader reader, int n) { var array = new long[n]; for (int i = 0; i < n; ++i) { array[i] = long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static ulong ReadUnsignedLong(this StreamReader reader) { return ulong.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double ReadDouble(this StreamReader reader) { return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double[] ReadDoubleArray(this StreamReader reader, int n) { var array = new double[n]; for (int i = 0; i < n; ++i) { array[i] = double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static decimal ReadDecimal(this StreamReader reader) { return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static decimal[] ReadDecimalArray(this StreamReader reader, int n) { var array = new decimal[n]; for (int i = 0; i < n; ++i) { array[i] = decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static void ResetBuffer() { buffer = new Queue(1000); }\n static Queue buffer = new Queue(1000);\n static string ReadToken(this StreamReader reader) { while (buffer.Count == 0) { reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) => { buffer.Enqueue(t); }); } return buffer.Dequeue(); }\n }\n #endregion\n}\n\n#region launch\nclass Program\n{\n static void Main(string[] args)\n {\n#if SOLVER_ATWORKSPACE\n var run = true; var outputFile = \"output.txt\"; var inputFile = \"input.txt\";\n switch (args[0])\n {\n case \"g\": run = false; outputFile = \"input.txt\"; inputFile = \"output.txt\"; break;\n case \"r\":\n default: run = true; inputFile = \"input.txt\"; outputFile = \"output.txt\"; break;\n }\n#endif\n\n using (var writer = new CodeChallenges.Boilerplate.IO.FormattedStreamWriter(\n#if SOLVER_ATWORKSPACE\noutputFile\n#else\n Console.OpenStandardOutput()\n#endif\n))\n {\n using (var reader = new StreamReader(\n#if SOLVER_ATWORKSPACE\ninputFile\n#else \n Console.OpenStandardInput()\n#endif\n))\n {\n#if SOLVER_ATWORKSPACE\n var stopw = new Stopwatch(); stopw.Start();\n#endif\n#if SOLVER_ATWORKSPACE\n if (run) new Solver(reader, writer).Do(); else new Generator(reader, writer).Create();\n\n#else\n new Solver(reader, writer).Do();\n#endif\n#if SOLVER_ATWORKSPACE\n stopw.Stop(); writer.WriteLine(\"> {0}ms\", stopw.ElapsedMilliseconds);\n#endif\n }\n }\n }\n}\n#endregion\n\nnamespace CodeChallenges\n{\n using CodeChallenges.Boilerplate.IO;\n\n public class Solver\n {\n private readonly StreamReader reader;\n private readonly StreamWriter writer;\n\n public Solver(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\n public void Do()\n {\n var n = reader.ReadInt();\n var a = reader.ReadInt();\n var b = reader.ReadInt();\n var c = reader.ReadInt();\n var d = reader.ReadInt();\n var p = reader.ReadIntArray(n - 1);\n var nodes = new List[n + 1];\n var ofs = new int[n + 1];\n var child = new int[n + 1];\n var hasA = new bool[n + 1];\n var hasB = new bool[n + 1];\n var hasC = new bool[n + 1];\n var hasD = new bool[n + 1];\n for (int i = 0; i < p.Length; ++i)\n {\n nodes[p[i]] = nodes[p[i]] ?? new List();\n nodes[p[i]].Add(i + 2);\n ++child[p[i]];\n }\n var que = new Queue();\n for (int i = 1; i <= n; ++i)\n if (child[i] == 0)\n {\n que.Enqueue(i);\n ofs[i] = 1;\n }\n var offices = que.Count;\n if (offices % 2 == 1)\n {\n writer.WriteLine(\"NO\");\n return;\n } \n hasA[a] = true;\n hasB[b] = true;\n hasC[c] = true;\n hasD[d] = true;\n while (que.Count > 0)\n {\n var el = que.Dequeue(); \n if (el > 1)\n {\n var par = p[el - 2];\n ofs[par] += ofs[el];\n hasA[par] |= hasA[el];\n hasB[par] |= hasB[el];\n hasC[par] |= hasC[el];\n hasD[par] |= hasD[el];\n --child[par];\n if (child[par] == 0)\n {\n que.Enqueue(par);\n }\n }\n }\n var free = new List();\n var partsA = new List();\n var partsB = new List();\n var partsC = new List();\n var partsD = new List();\n int ofsA = 0;\n int ofsB = 0;\n int ofsC = 0;\n int ofsD = 0;\n foreach (var ch in nodes[1])\n {\n if (!hasA[ch] && !hasB[ch] && !hasC[ch] && !hasD[ch])\n free.Add(ofs[ch]);\n else\n {\n List parts;\n bool[] hasG;\n int g;\n if (hasA[ch])\n {\n g = a;\n hasG = hasA;\n parts = partsA;\n ofsA = ofs[ch];\n }\n else if (hasB[ch])\n {\n g = b;\n hasG = hasB;\n parts = partsB;\n ofsB = ofs[ch];\n }\n else if (hasC[ch])\n {\n g = c;\n hasG = hasC;\n parts = partsC;\n ofsC = ofs[ch];\n }\n else\n {\n g = d;\n hasG = hasD;\n parts = partsD;\n ofsD = ofs[ch];\n } \n var st = ch;\n while (st != g)\n {\n if (nodes[st] != null)\n {\n var dests = nodes[st];\n foreach (var nch in dests)\n {\n if (hasG[nch])\n st = nch;\n else\n parts.Add(ofs[nch]);\n }\n }\n else\n st = g;\n }\n }\n }\n\n var knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsA.Concat(partsB).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length && !knap[j + elms])\n knap[j + elms] = true;\n }\n bool ab = knap[offices / 2 - 1 - ofsC];\n knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsC.Concat(partsD).Concat(free))\n {\n for (int j = 0; j < knap.Length; ++j)\n if (knap[j] && j + elms < knap.Length && !knap[j + elms])\n knap[j + elms] = true;\n }\n writer.WriteLine(ab && knap[offices / 2 - 1 - ofsB] ? \"YES\": \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a651f386093fb26ce29bb9f9b1bffe46", "src_uid": "87db879f0ca422020125a3e4d99d3c23", "difficulty": 2900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.IO;\nusing CodeChallenges;\nusing System.Diagnostics;\n\nnamespace CodeChallenges.Boilerplate.IO\n{\n #region helpers\n class FormattedStreamWriter : StreamWriter { public FormattedStreamWriter(Stream stream) : base(stream) { } public FormattedStreamWriter(string filePath) : base(filePath) { } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } }\n static class IOExtensions\n {\n public static string ReadString(this StreamReader reader) { return reader.ReadToken(); }\n public static string[] ReadStringArray(this StreamReader reader, int n) { var array = new string[n]; for (int i = 0; i < n; ++i) { array[i] = reader.ReadToken(); } return array; }\n public static int ReadInt(this StreamReader reader) { return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray(this StreamReader reader, int n) { var array = new int[n]; for (int i = 0; i < n; ++i) { array[i] = int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static uint ReadUnsignedInt(this StreamReader reader) { return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long ReadLong(this StreamReader reader) { return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static long[] ReadLongArray(this StreamReader reader, int n) { var array = new long[n]; for (int i = 0; i < n; ++i) { array[i] = long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static ulong ReadUnsignedLong(this StreamReader reader) { return ulong.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double ReadDouble(this StreamReader reader) { return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static double[] ReadDoubleArray(this StreamReader reader, int n) { var array = new double[n]; for (int i = 0; i < n; ++i) { array[i] = double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static decimal ReadDecimal(this StreamReader reader) { return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }\n public static decimal[] ReadDecimalArray(this StreamReader reader, int n) { var array = new decimal[n]; for (int i = 0; i < n; ++i) { array[i] = decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }\n public static void ResetBuffer() { buffer = new Queue(1000); }\n static Queue buffer = new Queue(1000);\n static string ReadToken(this StreamReader reader) { while (buffer.Count == 0) { reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) => { buffer.Enqueue(t); }); } return buffer.Dequeue(); }\n }\n #endregion\n}\n\n#region launch\nclass Program\n{\n static void Main(string[] args)\n {\n#if SOLVER_ATWORKSPACE\n var run = true; var outputFile = \"output.txt\"; var inputFile = \"input.txt\";\n switch (args[0])\n {\n case \"g\": run = false; outputFile = \"input.txt\"; inputFile = \"output.txt\"; break;\n case \"r\":\n default: run = true; inputFile = \"input.txt\"; outputFile = \"output.txt\"; break;\n }\n#endif\n\n using (var writer = new CodeChallenges.Boilerplate.IO.FormattedStreamWriter(\n#if SOLVER_ATWORKSPACE\noutputFile\n#else\n Console.OpenStandardOutput()\n#endif\n))\n {\n using (var reader = new StreamReader(\n#if SOLVER_ATWORKSPACE\ninputFile\n#else \n Console.OpenStandardInput()\n#endif\n))\n {\n#if SOLVER_ATWORKSPACE\n var stopw = new Stopwatch(); stopw.Start();\n#endif\n#if SOLVER_ATWORKSPACE\n if (run) new Solver(reader, writer).Do(); else new Generator(reader, writer).Create();\n\n#else\n new Solver(reader, writer).Do();\n#endif\n#if SOLVER_ATWORKSPACE\n stopw.Stop(); writer.WriteLine(\"> {0}ms\", stopw.ElapsedMilliseconds);\n#endif\n }\n }\n }\n}\n#endregion\n\nnamespace CodeChallenges\n{\n using CodeChallenges.Boilerplate.IO;\n\n public class Solver\n {\n private readonly StreamReader reader;\n private readonly StreamWriter writer;\n\n public Solver(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\n public void Do()\n {\n var n = reader.ReadInt();\n var a = reader.ReadInt();\n var b = reader.ReadInt();\n var c = reader.ReadInt();\n var d = reader.ReadInt();\n var p = reader.ReadIntArray(n - 1); \n \n var nodes = new List[n + 1];\n var ofs = new int[n + 1];\n var child = new int[n + 1];\n var hasA = new bool[n + 1];\n var hasB = new bool[n + 1];\n var hasC = new bool[n + 1];\n var hasD = new bool[n + 1];\n for (int i = 0; i < p.Length; ++i)\n {\n nodes[p[i]] = nodes[p[i]] ?? new List();\n nodes[p[i]].Add(i + 2);\n ++child[p[i]];\n }\n var que = new Queue();\n for (int i = 1; i <= n; ++i)\n if (child[i] == 0)\n {\n que.Enqueue(i);\n ofs[i] = 1;\n }\n var offices = que.Count;\n if (offices % 2 == 1)\n {\n writer.WriteLine(\"NO\");\n return;\n } \n hasA[a] = true;\n hasB[b] = true;\n hasC[c] = true;\n hasD[d] = true;\n while (que.Count > 0)\n {\n var el = que.Dequeue(); \n if (el > 1)\n {\n var par = p[el - 2];\n ofs[par] += ofs[el];\n hasA[par] |= hasA[el];\n hasB[par] |= hasB[el];\n hasC[par] |= hasC[el];\n hasD[par] |= hasD[el];\n --child[par];\n if (child[par] == 0)\n {\n que.Enqueue(par);\n }\n }\n }\n var free = new List();\n var partsA = new List();\n var partsB = new List();\n var partsC = new List();\n var partsD = new List();\n int ofsA = 0;\n int ofsB = 0;\n int ofsC = 0;\n int ofsD = 0;\n foreach (var ch in nodes[1])\n {\n if (!hasA[ch] && !hasB[ch] && !hasC[ch] && !hasD[ch])\n free.Add(ofs[ch]);\n else\n {\n List parts;\n bool[] hasG;\n int g;\n if (hasA[ch])\n {\n g = a;\n hasG = hasA;\n parts = partsA;\n ofsA = ofs[ch] - 1;\n }\n else if (hasB[ch])\n {\n g = b;\n hasG = hasB;\n parts = partsB;\n ofsB = ofs[ch] - 1;\n }\n else if (hasC[ch])\n {\n g = c;\n hasG = hasC;\n parts = partsC;\n ofsC = ofs[ch] - 1;\n }\n else\n {\n g = d;\n hasG = hasD;\n parts = partsD;\n ofsD = ofs[ch] - 1;\n } \n var st = ch;\n while (st != g)\n {\n if (nodes[st] != null)\n {\n var dests = nodes[st];\n foreach (var nch in dests)\n {\n if (hasG[nch])\n st = nch;\n else\n parts.Add(ofs[nch]);\n }\n }\n else\n st = g;\n }\n }\n }\n var knap = new bool[n + 1];\n knap[0] = true;\n foreach (var elms in partsA.Concat(partsB).Concat(free))\n {\n for (int j = knap.Length - 1 - elms; j >= 0 ; --j)\n if (knap[j])\n knap[j + elms] = true;\n }\n bool ab = offices / 2 - 2 - ofsC >= 0 && knap[offices / 2 - 2 - ofsC];\n knap = new bool[n + 1];\n knap[0] = true;\n int sume = 0;\n foreach (var elms in partsC.Concat(partsD).Concat(free))\n {\n sume += elms;\n for (int j = knap.Length - 1 - elms; j >= 0; --j)\n if (knap[j])\n knap[j + elms] = true;\n }\n\n writer.WriteLine((ab && offices / 2 - 2 - ofsB >= 0 && knap[offices / 2 - 2 - ofsB]) ? \"YES\": \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "15c5cdfab79ea82cdc603caaf310dadc", "src_uid": "87db879f0ca422020125a3e4d99d3c23", "difficulty": 2900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Threading;\nusing System.Text;\nusing System.Diagnostics;\nusing static util;\nusing P = pair;\n\nclass Program {\n static void Main(string[] args) {\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n var solver = new Solver(sw);\n // var t = new Thread(solver.solve, 1 << 26); // 64 MB\n // t.Start();\n // t.Join();\n solver.solve();\n sw.Flush();\n }\n}\n\nclass Solver {\n StreamWriter sw;\n Scan sc;\n void Prt(string a) => sw.WriteLine(a);\n void Prt(IEnumerable a) => Prt(string.Join(\" \", a));\n void Prt(params object[] a) => Prt(string.Join(\" \", a));\n public Solver(StreamWriter sw) {\n this.sw = sw;\n this.sc = new Scan();\n }\n\n public void solve() {\n int n, t;\n sc.Multi(out n, out t);\n var s = new int[n];\n var g = new int[n];\n for (int i = 0; i < n; i++)\n {\n sc.Multi(out s[i], out g[i]);\n --g[i];\n }\n memo = new long[n + 1][][][];\n for (int i = 0; i < n + 1; i++)\n {\n memo[i] = new long[n + 1][][];\n for (int j = 0; j < n + 1; j++)\n {\n memo[i][j] = new long[n + 1][];\n for (int k = 0; k < n + 1; k++)\n {\n memo[i][j][k] = new long[4];\n for (int l = 0; l < 4; l++)\n {\n memo[i][j][k][l] = -1;\n }\n }\n }\n }\n long ans = 0;\n for (int i = 0; i < (1 << n); i++)\n {\n int sum = 0;\n var cnt = new int[3];\n for (int j = 0; j < n; j++)\n {\n if (((i >> j) & 1) == 1) {\n sum += s[j];\n ++cnt[g[j]];\n }\n }\n if (sum != t) continue;\n ans += dfs(cnt[0], cnt[1], cnt[2], 3);\n }\n Prt(ans % M);\n }\n long[][][][] memo;\n long dfs(int a, int b, int c, int prev) {\n if (a < 0 || b < 0 || c < 0) return 0;\n if (a == 0 && b == 0 && c == 0) return 1;\n if (memo[a][b][c][prev] != -1) return memo[a][b][c][prev];\n long sum = 0;\n if (prev != 0) sum += dfs(a - 1, b, c, 0) * a;\n if (prev != 1) sum += dfs(a, b - 1, c, 1) * b;\n if (prev != 2) sum += dfs(a, b, c - 1, 2) * c;\n return memo[a][b][c][prev] = sum % M;\n }\n}\n\nclass pair : IComparable> {\n public T v1;\n public U v2;\n public pair() : this(default(T), default(U)) {}\n public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; }\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) { a = v1; b = v2; }\n}\nstatic class util {\n public static readonly int M = 1000000007;\n // public static readonly int M = 998244353;\n public static readonly long LM = 1L << 60;\n public static readonly double eps = 1e-11;\n public static void DBG(string a) => Console.Error.WriteLine(a);\n public static void DBG(IEnumerable a) => DBG(string.Join(\" \", a));\n public static void DBG(params object[] a) => DBG(string.Join(\" \", a));\n public static void Assert(bool cond) { if (!cond) throw new Exception(); }\n public static pair make_pair(T v1, U v2) => new pair(v1, v2);\n public static int CompareList(IList a, IList b) where T : IComparable {\n for (int i = 0; i < a.Count && i < b.Count; i++)\n if (a[i].CompareTo(b[i]) != 0) return a[i].CompareTo(b[i]);\n return a.Count.CompareTo(b.Count);\n }\n public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;\n static readonly int[] dd = { 0, 1, 0, -1 };\n // static readonly string dstring = \"RDLU\";\n public static P[] adjacents(int i, int j)\n => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1])).ToArray();\n public static P[] adjacents(int i, int j, int h, int w)\n => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1]))\n .Where(p => inside(p.v1, p.v2, h, w)).ToArray();\n public static P[] adjacents(this P p) => adjacents(p.v1, p.v2);\n public static P[] adjacents(this P p, int h, int w) => adjacents(p.v1, p.v2, h, 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 T[] inv(this Dictionary dic) {\n var res = new T[dic.Count];\n foreach (var item in dic) res[item.Value] = item.Key;\n return res;\n }\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}\n\nclass Scan {\n StreamReader sr;\n public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }\n public Scan(string path) { sr = new StreamReader(path); }\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 => sr.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 => Pair();\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "45f42fcc750b47498747f207528f537c", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "difficulty": 2100.0} {"lang": "Mono C#", "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 T = cin.nextint;\n\n var A = new int[N];\n var G = new int[N];\n var co = new BinomialCoefficient(20);\n\n for (int i = 0; i < N; i++)\n {\n A[i] = cin.nextint;\n G[i] = cin.nextint - 1;\n }\n\n ModInt ans = 0;\n for (int S = 0; S < 1 << N; S++)\n {\n int time = 0;\n var type = new int[3];\n for (int i = 0; i < N; i++)\n {\n if ((S >> i & 1) == 1)\n {\n time += A[i];\n type[G[i]]++;\n }\n }\n if (time != T)\n {\n continue;\n }\n int X = type[0];\n int Y = type[1];\n int Z = type[2];\n\n var dp = new long[type[0] + 1, type[1] + 1, type[2] + 1, 4];\n\n\n for (int i = 0; i <= X; i++)\n {\n for (int j = 0; j <= Y; j++)\n {\n for (int k = 0; k <= Z; k++)\n {\n for (int l = 0; l < 4; l++)\n {\n dp[i, j, k, l] = -1;\n }\n }\n }\n }\n ModInt ret = calc(X, Y, Z, 3, dp);\n if (X > 1) ret = ret * co.fact[X];\n if (Y > 1) ret = ret * co.fact[Y];\n if (Z > 1) ret = ret * co.fact[Z];\n ans += ret;\n \n\n }\n WriteLine(ans);\n }\n\n long calc(int x, int y, int z, int before, long[,,,] dp)\n {\n //WriteLine(x + \" \" + y + \" \" + z);\n if (dp[x, y, z, before] >= 0)\n {\n return dp[x, y, z, before];\n }\n if (x == 0 && y == 0 && z == 0)\n {\n return 1;\n }\n\n long ret = 0;\n if (x > 0 && before != 0)\n {\n ret += calc(x - 1, y, z, 0, dp);\n }\n if (y > 0 && before != 1)\n {\n ret += calc(x, y - 1, z, 1, dp);\n }\n if (z > 0 && before != 2)\n {\n ret += calc(x, y, z - 1, 2, dp);\n }\n ret %= mod;\n return dp[x, y, z, before] = ret;\n }\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 /// \n /// \u306f \u672a\u6e80\u3067\u304a\u9858\u3044\u3057\u307e\u3059\u3002\n /// \n /// \n public BinomialCoefficient(ModInt _n)\n {\n int n = (int)_n.num;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fde1c58bf78f73b9d476db1bbee15fc0", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "difficulty": 2100.0} {"lang": "Mono C#", "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 T = cin.nextint;\n\n var A = new int[N];\n var G = new int[N];\n\n for (int i = 0; i < N; i++)\n {\n A[i] = cin.nextint;\n G[i] = cin.nextint - 1;\n }\n\n ModInt ans = 0;\n for (int S = 0; S < 1 << N; S++)\n {\n int time = 0;\n var type = new int[3];\n for (int i = 0; i < N; i++)\n {\n if ((S >> i & 1) == 1)\n {\n time += A[i];\n type[G[i]]++;\n }\n }\n if (time != T)\n {\n continue;\n }\n int X = type[0];\n int Y = type[1];\n int Z = type[2];\n\n var dp = new long[type[0] + 1, type[1] + 1, type[2] + 1, 4];\n\n\n for (int i = 0; i <= X; i++)\n {\n for (int j = 0; j <= Y; j++)\n {\n for (int k = 0; k <= Z; k++)\n {\n for (int l = 0; l < 4; l++)\n {\n dp[i, j, k, l] = -1;\n }\n }\n }\n }\n var ret = calc(X, Y, Z, 3, dp);\n if (X > 1) ret = ret * X;\n if (Y > 1) ret = ret * Y;\n if (Z > 1) ret = ret * Z;\n ans += ret % mod;\n\n }\n WriteLine(ans);\n }\n\n long calc(int x, int y, int z, int before, long[,,,] dp)\n {\n //WriteLine(x + \" \" + y + \" \" + z);\n if (dp[x, y, z, before] >= 0)\n {\n return dp[x, y, z, before];\n }\n if (x == 0 && y == 0 && z == 0)\n {\n return 1;\n }\n\n long ret = 0;\n if (x > 0 && before != 0)\n {\n ret += calc(x - 1, y, z, 0, dp);\n }\n if (y > 0 && before != 1)\n {\n ret += calc(x, y - 1, z, 1, dp);\n }\n if (z > 0 && before != 2)\n {\n ret += calc(x, y, z - 1, 2, dp);\n }\n ret %= mod;\n return dp[x, y, z, before] = ret;\n }\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 /// \n /// \u306f \u672a\u6e80\u3067\u304a\u9858\u3044\u3057\u307e\u3059\u3002\n /// \n /// \n public BinomialCoefficient(ModInt _n)\n {\n int n = (int)_n.num;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "858c218837e224629de006a867503453", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Program\n{\n\tint[][] c;\n\tint n, m;\n\tint mod = 1000000007;\n\tint add(int x, int y)\n\t{\n\t\tx += y;\n\t\treturn x < mod ? x : x - mod;\n\t}\n\tint mul(int x, int y)\n\t{\n\t\treturn Convert.ToInt32(Convert.ToInt64(x) * y % mod);\n\t}\n\tint[][] newMatrix(int m)\n\t{\n\t\tint[][] ret = new int[m][];\n\t\tfor (int i = 0; i < m; i++)\n\t\t\tret[i] = new int[m];\n\t\treturn ret;\n\t}\n\tvoid calcSum(ref int[][] sum, int[][] a)\n\t{\n\t\tfor (int i = 1; i <= m; i++)\n\t\t\tfor (int j = 1; j <= m; j++)\n\t\t\t\tsum[i][j] = add(sum[i - 1][j], a[i][j]);\n\t\tfor (int i = 1; i <= m; i++)\n\t\t\tfor (int j = 1; j <= m; j++)\n\t\t\t\tsum[i][j] = add(sum[i][j - 1], sum[i][j]);\n\t}\n\tint regionSum(int[][] sum, int lx, int rx, int ly, int ry)\n\t{\n\t\t--lx; --ly;\n\t\treturn add(add(sum[lx][ly],sum[rx][ry]), mod - add(sum[lx][ry],sum[rx][ly]));\n\t}\n\tvoid run()\n\t{\n\t\tString[] str = Console.ReadLine().Split(' ');\n\t\tn = Convert.ToInt32(str[0]);\n\t\tm = Convert.ToInt32(str[1]);\n\t\tint[][][] dp11 = new int[n + 1][][],\n\t\t\tdp10 = new int[n + 1][][],\n\t\t\tdp01 = new int[n + 1][][],\n\t\t\tdp00 = new int[n + 1][][];\n\t\tdp11[1] = newMatrix(m + 1);\n\t\tdp10[1] = newMatrix(m + 1);\n\t\tdp01[1] = newMatrix(m + 1);\n\t\tdp00[1] = newMatrix(m + 1);\n\t\tfor (int i = 1; i <= m; i++)\n\t\t\tfor (int j = i; j <= m; j++)\n\t\t\t\tdp11[1][i][j] = 1;\n\t\tint[][] sum = newMatrix(m + 1);\n\t\tfor (int i = 2; i <= n; i++)\n\t\t{\n\t\t\tdp11[i] = newMatrix(m + 1);\n\t\t\tdp10[i] = newMatrix(m + 1);\n\t\t\tdp01[i] = newMatrix(m + 1);\n\t\t\tdp00[i] = newMatrix(m + 1);\n\t\t\tcalcSum(ref sum, dp11[i - 1]);\n\t\t\tfor (int j = 1; j <= m; j++)\n\t\t\t\tfor (int k = j; k <= m; k++)\n\t\t\t\t{\n\t\t\t\t\tdp11[i][j][k] = add(dp11[i][j][k], regionSum(sum, j, k, j, k));\n\t\t\t\t\tdp10[i][j][k] = add(dp10[i][j][k], regionSum(sum, j, k, k + 1, m));\n\t\t\t\t\tdp01[i][j][k] = add(dp01[i][j][k], regionSum(sum, 1, j - 1, j, k));\n\t\t\t\t\tdp00[i][j][k] = add(dp00[i][j][k], regionSum(sum, 1, j - 1, k + 1, m));\n\t\t\t\t}\n\t\t\tcalcSum(ref sum, dp10[i - 1]);\n\t\t\tfor (int j = 1; j <= m; j++)\n\t\t\t\tfor (int k = j; k <= m; k++)\n\t\t\t\t{\n\t\t\t\t\tdp10[i][j][k] = add(dp10[i][j][k], regionSum(sum, j, k, k, m));\n\t\t\t\t\tdp00[i][j][k] = add(dp00[i][j][k], regionSum(sum, 1, j - 1, k, m));\n\t\t\t\t}\n\t\t\tcalcSum(ref sum, dp01[i - 1]);\n\t\t\tfor (int j = 1; j <= m; j++)\n\t\t\t\tfor (int k = j; k <= m; k++)\n\t\t\t\t{\n\t\t\t\t\tdp01[i][j][k] = add(dp01[i][j][k], regionSum(sum, 1, j, j, k));\n\t\t\t\t\tdp00[i][j][k] = add(dp00[i][j][k], regionSum(sum, 1, j, k + 1, m));\n\t\t\t\t}\n\t\t\tcalcSum(ref sum, dp00[i - 1]);\n\t\t\tfor (int j = 1; j <= m; j++)\n\t\t\t\tfor (int k = j; k <= m; k++)\n\t\t\t\t{\n\t\t\t\t\tdp00[i][j][k] = add(dp00[i][j][k], regionSum(sum, 1, j, k, m));\n\t\t\t\t}\n\t\t}\n\t\tint res = 0;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfor (int j = 1; j <= m; j++)\n\t\t\t\tfor (int k = 1; k <= m; k++)\n\t\t\t\t\tres = add(res, mul(n - i + 1, add(add(dp00[i][j][k],dp01[i][j][k]), add(dp10[i][j][k],dp11[i][j][k]))));\n\t\tConsole.WriteLine(res);\n\t}\n\tstatic void Main(String[] args)\n\t{\n\t\tnew Program().run();\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc1522caa06b9392f2a6ee8494beab04", "src_uid": "740eceed59d3c6ac55c1bf9d3d4160c7", "difficulty": 2400.0} {"lang": ".NET Core C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a241de59e39f87cda157e494bf032caf", "src_uid": "783c4b3179c558369f94f4a16ac562d4", "difficulty": 2100.0} {"lang": ".NET Core C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "321b100ed554a3416549225f4a684f30", "src_uid": "783c4b3179c558369f94f4a16ac562d4", "difficulty": 2100.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbdaa5a5f36238b0f9470904809a8a1e", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "52df0a87e7ded8f21eec1997704a3712", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7b3c182885a002d52938d569af4f9c61", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ac8b2a4be6ab7fd661e7ad88e02c024a", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e7f2dcce30daf4e0e6fed4a0225f435d", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8cc8316688093cb9e26e67a34b10f9f6", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "30b5ee2573b978f8f0c3d644408a9597", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "63312d370101fd9f7604435822c4df94", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6800b7005e03062a31538fb2de9f01dd", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "82284d0630b76544302555b7fccf161b", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "#define FileIO\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ee4cae6eb9f41f489a4b0eba27976068", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "Mono C#", "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(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(int a, int b)\n {\n for (int i = Math.Min(a, b); i >= 1; i--)\n if (a % i == 0 && b % i == 0)\n return i;\n return 0;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2151223b19735a867010ebc0c3bb10a9", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var inp = Console.ReadLine().Split(' ');\n int k = int.Parse(inp[0]);\n int q = int.Parse(inp[1]);\n char[,] rep = new char[q, 2];\n for (int i = 0; i < q; i++)\n {\n var inp2 = Console.ReadLine().Split(' ');\n rep[i, 0] = inp2[1][0];\n rep[i, 1] = inp2[0][0];\n }\n char[,] m = new char[7, 270000];\n int r = 1, c = 1, cd = 0;\n m[1, 0] = 'a';\n while (true)\n {\n for (int i = 0; i < c; i++)\n {\n for (int j = 0; j < q; j++)\n {\n if (rep[j, 0] == m[r, i])\n {\n m[r + 1, cd] = rep[j, 1];\n cd++;\n }\n }\n }\n c = cd;\n r++;\n if (r == k) break;\n cd = 0;\n }\n Console.WriteLine(cd);\n Console.ReadLine();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ab514b3ef1fa53136db9cbb1ad42d172", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\n\nclass Program\n{\n private static int Go(int s, int n)\n {\n if (n == 0) return 1;\n\n int ans = 0;\n\n for (int i = 0; i < 36; i++)\n {\n if ((map[s] & pow2[i]) > 0)\n {\n ans += Go(i / 6, n - 1);\n }\n }\n\n return ans;\n }\n\n private static long[] pow2 = new long[64];\n private static long[] map = new long[6];\n private static void Main(string[] args)\n {\n pow2[0] = 1;\n for (int i = 1; i < pow2.Length; i++) pow2[i] = pow2[i - 1] * 2;\n\n int n = ReadInt();\n int q = ReadInt();\n\n for (int i = 0; i < q; i++)\n {\n var a = ReadString();\n var b = ReadString();\n map[b[0] - 'a'] |= pow2[(6 * (a[0] - 'a') + (a[1] - 'a'))];\n }\n\n Console.Write(Go(0, n - 1));\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 while (true)\n {\n return ReadDigit() - (int)'0';\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a78ed8f329b21bd8ba32e961575ac71", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp\n{\n class Program\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 private static StringBuilder resultBuilder = new StringBuilder();\n public static void Main(string[] args)\n {\n int[] nq = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n string[] input = new string[nq[1]];\n for (int i = 0; i < nq[1]; i++)\n {\n input[i] = Console.ReadLine();\n }\n int[] counter = new int[6];\n for (int i = 0; i < nq[1]; i++)\n {\n counter[input[i][3] - 'a']++;\n }\n\n long result = 0;\n getResult('a', 2);\n void getResult(char target, int length)\n {\n if (length == nq[0])\n {\n result += counter[target - 'a'];\n }\n else\n {\n for (int i = 0; i < nq[1]; i++)\n {\n if (input[i][3] == target)\n {\n getResult(input[i][0], length + 1);\n }\n }\n }\n }\n Console.Write(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "52375dd7f09eeae7d6fea155749092bb", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class IndiaHacks2\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"D:\\Sergey\\Code\\2.txt\"));\n\n string[] strParams = Console.ReadLine().Split(new char[] { ' ' }); \n int n = int.Parse(strParams[0]);\n int q = int.Parse(strParams[1]);\n\n var a = new List();\n var d = new Dictionary(q);\n var g = new Dictionary>();\n\n //var ba = new List();\n\n int k = n;\n long r = 0;\n\n for (int i = 0; i < q; i++)\n {\n strParams = Console.ReadLine().Split(new char[] { ' ' });\n d[strParams[0]] = strParams[1][0];\n\n List f;\n if (!g.TryGetValue(strParams[1][0], out f))\n {\n f = new List();\n g[strParams[1][0]] = f;\n }\n f.Add(strParams[0]);\n }\n\n //HashSet h = new HashSet();\n\n var s = new LinkedList();\n var c = new char[n];\n c[n - 1] = 'a';\n s.AddLast(c);\n LinkedListNode sp = s.First;\n for (int i = n - 1; i >= 1; i--)\n {\n for (int j = 0, count = s.Count; j < count && sp != null; j++)\n {\n List f;\n if (g.TryGetValue(sp.Value[i], out f))\n {\n for (k = 1; k < f.Count; k++)\n {\n char[] cc = sp.Value.ToArray();\n cc[i] = f[k][1];\n cc[i - 1] = f[k][0];\n s.AddLast(cc);\n }\n sp.Value[i] = f[0][1];\n sp.Value[i - 1] = f[0][0];\n s.AddLast(sp.Value);\n }\n sp = sp.Next;\n s.RemoveFirst();\n }\n }\n\n\n Console.WriteLine(s.Count);\n }//main\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "40f7f96075adfda56a1cd7bcfcc002c9", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "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 public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var n = input[0];\n var q = input[1];\n var array = new Tuple[q];\n for (var i = 0; i < q; i++)\n {\n var next = sr.NextSplitStrings();\n array[i] = new Tuple(next[0], next[1][0]);\n }\n var count = 0L;\n var list = new List();\n for (var i = 0; i < q; i++)\n {\n if (array[i].Item2 == 'a')\n {\n list.Add(array[i].Item1[0]);\n if (n == 2)\n {\n count++;\n }\n }\n }\n List newList = null;\n for (var i = 3; i <= n; i++)\n {\n newList = new List();\n foreach (var item in list)\n {\n for (var j = 0; j < q; j++)\n {\n if (array[j].Item2 == item)\n {\n newList.Add(array[j].Item1[0]);\n if (i == n)\n {\n count++;\n }\n }\n }\n }\n list = newList;\n }\n sw.WriteLine(count);\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "238e0837f7e21946fc706964ce67b7ae", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _653B\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];\n var q = s[1];\n Dictionary dic = new Dictionary();\n for (int i = 0; i < q; i++)\n {\n var s2 = Console.ReadLine().Split();\n dic.Add(s2[0], s2[1]);\n }\n var generator = new string[(int)Math.Pow(6, n)];\n int[] letters = new int[6];\n for (int i = 0; i < generator.Length; i++)\n {\n var str = new StringBuilder();\n for (int j = 0; j < n; j++)\n {\n str.Append((char)('a' + letters[j]));\n }\n \n generator[i] = str.ToString();\n for (int j = n-1; j >= 0; j--)\n {\n letters[j]++;\n if (letters[j] < 6) break;\n else { letters[j] = 0; }\n }\n }\n\n for (int i = 0; i < n - 1; i++ )\n {\n for (int j = 0; j < generator.Length; j++)\n {\n if (dic.ContainsKey(generator[j].Substring(0, 2)))\n generator[j] = dic[generator[j].Substring(0, 2)] + generator[j].Substring(2); \n }\n }\n var count = 0;\n for (int j = 0; j < generator.Length; j++)\n {\n if (generator[j] == \"a\") count++;\n }\n\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4069b4de74fb3e7da4d298c805413a87", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Bear_and_Compressing\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 int n = int.Parse(ss[0]);\n int q = int.Parse(ss[1]);\n\n int size = 'f' - 'a' + 1;\n var nn = new List[size];\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = new List();\n }\n for (int i = 0; i < q; i++)\n {\n ss = reader.ReadLine().Split(' ');\n int index = ss[1][0] - 'a';\n nn[index].Add(ss[0]);\n }\n var set = new HashSet {\"a\"};\n\n for (int i = 1; i < n; i++)\n {\n var next = new HashSet();\n\n foreach (string sss in set)\n {\n int index = sss[0]-'a';\n string suff = sss.Substring(1);\n foreach (string pr in nn[index])\n {\n string m = pr + suff;\n next.Add(m);\n }\n }\n\n set = next;\n }\n\n\n writer.WriteLine(set.Count);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "293da7fb562f94e0d065e19b9fae345c", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\n\n//using Algorithms.Set_38;\n\nclass Solution\n{\n private class Tokenizer\n {\n private string currentString = null;\n\n private string[] tokens = null;\n\n private int tokenNumber = 0;\n\n private static readonly char[] Separators = { ' ' };\n\n public T NextToken(Func parser)\n {\n return parser(this.GetNextToken());\n }\n\n public string NextToken()\n {\n return this.GetNextToken();\n }\n\n public int NextInt()\n {\n return this.NextToken(int.Parse);\n }\n\n public long NextLong()\n {\n return this.NextToken(long.Parse);\n }\n\n private string GetNextToken()\n {\n if (this.currentString == null || this.tokenNumber == this.tokens.Length)\n {\n this.currentString = this.GetNextString();\n\n while (this.currentString != null && this.currentString.Equals(string.Empty))\n {\n this.currentString = this.GetNextString();\n }\n\n if (this.currentString == null)\n {\n throw new Exception(\"End of input\");\n }\n\n this.tokens = this.currentString.Split(Separators, StringSplitOptions.RemoveEmptyEntries);\n this.tokenNumber = 0;\n }\n\n return this.tokens[this.tokenNumber++];\n }\n\n private string GetNextString()\n {\n string content = Console.ReadLine();\n if (content == null)\n {\n return null;\n }\n\n return content.Trim();\n }\n }\n\n static void Main()\n {\n //Console.SetIn(new StreamReader(File.OpenRead(\"input.txt\")));\n //StreamWriter writer = new StreamWriter(File.Create(\"output.txt\"));\n //Console.SetOut(writer);\n\n Tokenizer tokenizer = new Tokenizer();\n\n int n = tokenizer.NextInt();\n int q = tokenizer.NextInt();\n\n string[] from = new string[q];\n char[] to = new char[q];\n\n for (int i=0;i ReadList()\n {\n return ReadArray().ToList();\n }\n static List ReadIntList()\n {\n return ReadArray().Select(c => Convert.ToInt32(c)).ToList();\n }\n static List ReadULongList()\n {\n return ReadArray().Select(c => Convert.ToUInt64(c)).ToList();\n }\n\n static Dictionary> dict;\n static int length;\n static SortedSet res = new SortedSet();\n\n static void GetResult(string str)\n {\n string key = str[0].ToString();\n if (!dict.ContainsKey(key))\n return;\n List lst = dict[key];\n for (int i = 0; i < lst.Count; i++)\n {\n string newStr = lst[i] + str.Substring(1);\n if (length == newStr.Length)\n res.Add(newStr);\n else\n {\n GetResult(newStr);\n }\n }\n }\n\n static void Main(string[] args)\n {\n string[] input = ReadArray();\n length = Convert.ToInt32(input[0]);\n int n = Convert.ToInt32(input[1]);\n dict = new Dictionary>();\n \n for (int i = 0; i < n; i++)\n {\n input = ReadArray();\n if (!dict.ContainsKey(input[1]))\n dict.Add(input[1], new List());\n dict[input[1]].Add(input[0]);\n }\n GetResult(\"a\");\n Console.WriteLine(res.Count);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8daee4cdeca88fc2c749bb993de2c86e", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "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 q = cin.NextInt();\n var ops = new Dictionary>();\n for (var i = 0; i < q; i++)\n {\n var a = cin.NextString();\n var b = cin.NextString();\n if (!ops.ContainsKey(b[0]))\n {\n ops[b[0]] = new List();\n }\n ops[b[0]].Add(a[0]);\n }\n var frontier = new List();\n frontier.Add('a');\n for (var i = 1; i < n; i++)\n {\n var newFrontier = new List();\n foreach (var c in frontier)\n {\n if (ops.ContainsKey(c))\n {\n var list = ops[c];\n newFrontier.AddRange(list);\n }\n }\n frontier = newFrontier;\n }\n Console.WriteLine(frontier.Count);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d2165fe5836daecc1637d70c8b1727d2", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "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 Coding\n{\n class Solution\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 q = int.Parse(s1[1]);\n string[] str1 = new string[q];\n char[] cr = new char[q];\n\n for(int i=0;i< q;i++)\n {\n string str = Console.ReadLine();\n string[] split = str.Split(' ');\n\n str1[i] = split[0];\n cr[i] = Convert.ToChar(split[1]);\n }\n\n int[] countFirstChar = new int[6];\n countFirstChar[0] = 1;\n char[] ar = { 'a', 'b', 'c', 'd', 'e', 'f' };\n for (int j=1;j < n;j++)\n {\n int[] tmpArray = new int[6];\n for(int k=0; k<6;k++)\n {\n if(countFirstChar[k]!=0)\n {\n for (int l = 0; l < q; l++)\n {\n if (ar[k] == cr[l])\n {\n tmpArray[str1[l].ToCharArray()[0] - 97]+= countFirstChar[k];\n }\n }\n }\n \n }\n\n countFirstChar = tmpArray;\n }\n\n Console.WriteLine(countFirstChar.Sum());\n }\n } \n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e7e5fed16ccc89748f9e191d9297c6aa", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "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 public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var n = input[0];\n var q = input[1];\n var array = new Tuple[q];\n for (var i = 0; i < q; i++)\n {\n var next = sr.NextSplitStrings();\n array[i] = new Tuple(next[0], next[1][0]);\n }\n var count = 0;\n var list = new HashSet();\n for (var i = 0; i < q; i++)\n {\n if (array[i].Item2 == 'a')\n {\n list.Add(array[i].Item1[0]);\n }\n }\n HashSet newList = null;\n for (var i = 2; i <= n; i++)\n {\n newList = new HashSet();\n foreach (var item in list)\n {\n for (var j = 0; j < q; j++)\n {\n if (array[j].Item2 == item)\n {\n newList.Add(array[j].Item1[0]);\n if (i == n)\n {\n count++;\n }\n }\n }\n }\n list = newList;\n }\n sw.WriteLine(count);\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "72937b69a46f3cf509a5611257067f80", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "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 Coding\n{\n class Solution\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 q = int.Parse(s1[1]);\n string[] str1 = new string[q];\n char[] cr = new char[q];\n\n for(int i=0;i< q;i++)\n {\n string str = Console.ReadLine();\n string[] split = str.Split(' ');\n\n str1[i] = split[0];\n cr[i] = Convert.ToChar(split[1]);\n }\n\n int[] countFirstChar = new int[6];\n countFirstChar[0] = 1;\n char[] ar = { 'a', 'b', 'c', 'd', 'e', 'f' };\n for (int j=1;j < n;j++)\n {\n int[] tmpArray = new int[6];\n for(int k=0; k<6;k++)\n {\n if(countFirstChar[k]!=0)\n {\n for (int l = 0; l < q; l++)\n {\n if (ar[k] == cr[l])\n {\n tmpArray[str1[l].ToCharArray()[0] - 97]++;\n }\n }\n }\n \n }\n\n countFirstChar = tmpArray;\n }\n\n Console.WriteLine(countFirstChar.Sum());\n }\n } \n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7f2c855c02c9e45c555599fed5995078", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "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 string[] a;\n char[] b;\n int m;\n\n Dictionary mem = new Dictionary();\n bool Fun(string s)\n {\n if (s.Length == 1)\n return s[0] == 'a';\n if (mem.ContainsKey(s))\n return mem[s];\n\n bool ret = false;\n for (int i = 0; !ret && i < m; i++)\n if (a[i][0] == s[0] && a[i][1] == s[1])\n ret |= Fun(b[i] + s.Substring(2));\n return mem[s] = ret;\n }\n\n public void Solve()\n {\n int n = ReadInt();\n m = ReadInt();\n\n a = new string[m];\n b = new char[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadToken();\n b[i] = ReadToken()[0];\n }\n\n int ans = 0;\n var v = Enumerable.Repeat('a', n).ToArray();\n while (true)\n {\n if (Fun(new string(v)))\n ans++;\n v[n - 1]++;\n for (int i = n - 1; i > 0; i--)\n if (v[i] == 'g')\n {\n v[i - 1]++;\n v[i] = 'a';\n }\n if (v.All(vv => vv == 'f'))\n break;\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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7ac2ab90812e5b8babeec0afc430bb29", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "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 public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var n = input[0];\n var q = input[1];\n var array = new Tuple[q];\n for (var i = 0; i < q; i++)\n {\n var next = sr.NextSplitStrings();\n array[i] = new Tuple(next[0], next[1][0]);\n }\n var count = 0;\n var list = new HashSet();\n for (var i = 0; i < q; i++)\n {\n if (array[i].Item2 == 'a')\n {\n list.Add(array[i].Item1[0]);\n if (n == 2)\n {\n count++;\n }\n }\n }\n HashSet newList = null;\n for (var i = 3; i <= n; i++)\n {\n newList = new HashSet();\n foreach (var item in list)\n {\n for (var j = 0; j < q; j++)\n {\n if (array[j].Item2 == item)\n {\n newList.Add(array[j].Item1[0]);\n if (i == n)\n {\n count++;\n }\n }\n }\n }\n list = newList;\n }\n sw.WriteLine(count);\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a51bff89aadd317220477669b9735397", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "MS C#", "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 string[] a;\n char[] b;\n int m;\n\n Dictionary mem = new Dictionary();\n bool Fun(string s)\n {\n if (s.Length == 1)\n return s[0] == 'a';\n if (mem.ContainsKey(s))\n return mem[s];\n\n bool ret = false;\n for (int i = 0; !ret && i < m; i++)\n if (a[i][0] == s[0] && a[i][1] == s[1])\n ret |= Fun(b[i] + s.Substring(2));\n return mem[s] = ret;\n }\n\n public void Solve()\n {\n int n = ReadInt();\n m = ReadInt();\n\n a = new string[m];\n b = new char[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadToken();\n b[i] = ReadToken()[0];\n }\n\n int ans = 0;\n var v = Enumerable.Repeat('a', n).ToArray();\n while (v.Any(vv => vv != 'f'))\n {\n v[n - 1]++;\n for (int i = n - 1; i >= 0; i--)\n if (v[i] == 'g')\n {\n v[i - 1]++;\n v[i] = 'a';\n }\n if (Fun(new string(v)))\n ans++;\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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "78d95001ff32650f7a0107a7e38c31f8", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskF\n{\n class Program\n {\n static int n;\n static int[,] g;\n static bool[] um, uw;\n static List all = new List();\n\n \n static void Rec(int radost, int numberMan) {\n if (numberMan == n)\n {\n //Console.WriteLine(radost);\n all.Add(radost);\n }\n else\n {\n for (int j = 0; j < n; j++)\n {\n if (g[numberMan, j] > 0 && !uw[j])\n {\n uw[j] = true;\n Rec(radost + g[numberMan, j], numberMan + 1);\n uw[j] = false;\n }\n }\n Rec(radost, numberMan + 1); \n }\n\n }\n\n static void Main(string[] args)\n {\n int[] data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n n = data[0];\n int k = data[1], t = data[2];\n g = new int[n, n];\n uw = new bool[n];\n um = new bool[n];\n\n for (int i = 0; i < k; i++)\n {\n data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n g[data[0]-1, data[1]-1] = data[2];\n }\n\n Rec(0,0);\n all.Sort();\n Console.WriteLine(all[t - 1]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc08ab67c80095e2e9eea661d53506df", "src_uid": "7348b5644f232bf377a4834eded42e4b", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskF\n{\n class Program\n {\n static int n;\n static int[,] g;\n static bool[] um, uw;\n static List all = new List();\n\n \n static void Rec(int radost, int numberMan) {\n if (numberMan == n)\n {\n //Console.WriteLine(radost);\n all.Add(radost);\n }\n else\n {\n for (int j = 0; j < n; j++)\n {\n if (g[numberMan, j] > 0 && !uw[j])\n {\n uw[j] = true;\n Rec(radost + g[numberMan, j], numberMan + 1);\n Rec(radost, numberMan + 1);\n uw[j] = false;\n }\n }\n }\n\n }\n\n static void Main(string[] args)\n {\n int[] data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n n = data[0];\n int k = data[1], t = data[2];\n g = new int[n, n];\n uw = new bool[n];\n um = new bool[n];\n\n for (int i = 0; i < k; i++)\n {\n data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n g[data[0]-1, data[1]-1] = data[2];\n }\n\n Rec(0,0);\n all.Sort();\n Console.WriteLine(all[t]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b34c6147df2526cef1b3029502e385de", "src_uid": "7348b5644f232bf377a4834eded42e4b", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "#define LOCAL\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nnamespace _258_E\n{\n class Program\n {\n class Files\n {\n StreamReader fin = new StreamReader(\"d:\\\\date.in\");\n StreamWriter fout = new StreamWriter(\"d:\\\\date.out\");\n public string ReadLine()\n {\n return fin.ReadLine();\n }\n public void Write(string s)\n {\n fout.Write(s);\n }\n public void WriteLine(string s)\n {\n fout.WriteLine(s);\n }\n public void Close()\n {\n fout.Close();\n }\n }\n #if LOCAL\n static Files Console = new Files();\n #endif\n const int Mod = (int)1e9+7;\n static string[] s;\n static string Line;\n static int step = 0, Length = 0;\n static Int64 GetNext()\n {\n if (step == Length)\n {\n Line = Console.ReadLine();\n s = Line.Split(' ');\n Length = s.Length;\n step = 0;\n }\n ++step;\n return Int64.Parse(s[step - 1]);\n }\n static Int64[] a = new Int64[30];\n static Int64 Inv = 1;\n static Int64 Comb(Int64 n, Int64 k)\n {\n if (n < k)\n return 0;\n Int64 result = 1;\n for (Int64 i = n - k + 1; i <= n; ++i)\n result = (Int64)result*i%Mod;\n result = (Int64)result*Inv%Mod;\n return result; \n }\n static Int64 Fix(Int64 x)\n {\n Int64 ret = x;\n if (ret >= Mod)\n ret -= Mod;\n if (ret < 0) \n ret += Mod;\n return ret;\n }\n\n static Int64 Pow_Log(Int64 x,Int64 p)\n {\n if (p == 0)\n return 1;\n Int64 y;\n if(p%2==1)\n y = (Int64)Pow_Log(x,p-1)*x%Mod;\n else\n {\n y = Pow_Log(x,p/2);\n y = (Int64)y*y%Mod;\n }\n return y;\n }\n static void Main(string[] args)\n {\n Int64 n = GetNext(), S = GetNext(), sum = 0, Max = 1;\n Inv = 1;\n for (int i = 0; i < n; ++i)\n {\n Max *= 2;\n if (i > 0)\n Inv *= i;\n a[i] = GetNext();\n sum += a[i];\n }\n if (sum < S)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Inv = Pow_Log(Inv, Mod - 2); \n Int64 Solution = Comb(S + n - 1, n - 1),cnt = 0;\n for (int i = 1; i < Max; ++i)\n {\n Int64 k = 0;\n int nr = 0;\n for (int j = 0; j < n; ++j)\n if (((1 << j) & i) != 0) \n {\n ++nr;\n k += a[j]+1;\n }\n k = S - k;\n if (nr % 2 == 1)\n cnt += Comb(k + n - 1, n - 1);\n else\n cnt -= Comb(k + n - 1, n - 1);\n cnt = Fix(cnt);\n }\n Solution -= cnt;\n Console.WriteLine(Solution.ToString());\n #if LOCAL\n Console.Close(); \n #endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "13fbd9276bf799b4ebd937f4d0bfdfc0", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Problem51Nod\n{\n class Program\n {\n public static void Main(String[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(input[0]);\n long sum = Convert.ToInt64(input[1]);\n input = Console.ReadLine().Split(' ');\n long[] nums = new long[n];\n for (int i = 0; i < n; i++)\n nums[i] = Convert.ToInt64(input[i]);\n\n Console.WriteLine(Cal(sum, nums));\n }\n \n static long Mod = 1000000007;\n static long[] Nums, InvFacts;\n\n static void Init(long[] nums)\n {\n long[] invs = new long[30];\n InvFacts = new long[30];\n invs[1] = InvFacts[1] = 1;\n\n for (int i = 2; i < invs.Length; i++)\n {\n invs[i] = (Mod - Mod / i * invs[Mod % i] % Mod) % Mod;\n InvFacts[i] = InvFacts[i - 1] * invs[i] % Mod;\n }\n\n Nums = new long[nums.Length];\n\n for (int i = 0; i < nums.Length; i++)\n Nums[i] = nums[i] + 1;\n\n Array.Sort(Nums, (a, b) => b.CompareTo(a));\n }\n\n static long Cal(long sum, long[] nums)\n {\n if (nums.Length == 1) return nums[0] < sum ? 0 : 1;\n Init(nums);\n return (Cal(Nums.Length - 1, sum) + Mod) % Mod;\n }\n\n static long Cal(int index, long sum)\n {\n int k = Nums.Length - 1;\n long result = Cmn(sum + k, k);\n\n for(int i = index; i >= 0 && Nums[i] <= sum; i--)\n result -= Cal(i - 1, sum - Nums[i]);\n\n return result % Mod;\n }\n\n static long Cmn(long m, long n)\n {\n long result = 1;\n\n for(long i = m - n + 1; i <= m; i++)\n result = i % Mod * result % Mod;\n\n result = result * InvFacts[n] % Mod;\n return result;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2ff5c01df47335ce3652c062f562e576", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "//#define LOCAL\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nnamespace _258_E\n{\n class Program\n {\n class Files\n {\n StreamReader fin = new StreamReader(\"d:\\\\date.in\");\n StreamWriter fout = new StreamWriter(\"d:\\\\date.out\");\n public string ReadLine()\n {\n return fin.ReadLine();\n }\n public void Write(string s)\n {\n fout.Write(s);\n }\n public void WriteLine(string s)\n {\n fout.WriteLine(s);\n }\n public void Close()\n {\n fout.Close();\n }\n }\n #if LOCAL\n static Files Console = new Files();\n #endif\n const Int64 Mod = (Int64)1e9+7;\n static string[] s;\n static string Line;\n static int step = 0, Length = 0;\n static Int64 GetNext()\n {\n if (step == Length)\n {\n Line = Console.ReadLine();\n s = Line.Split(' ');\n Length = s.Length;\n step = 0;\n }\n ++step;\n return Int64.Parse(s[step - 1]);\n }\n static Int64[] a = new Int64[30];\n static Int64 Inv = 1;\n static Int64 Comb(Int64 n, Int64 k)\n {\n if (n < k)\n return 0;\n Int64 result = 1;\n for (Int64 i = n - k + 1; i <= n; ++i)\n result = (Int64)result*(i%Mod)%Mod;\n result = (Int64)result*Inv%Mod;\n return result; \n }\n static Int64 Fix(Int64 x)\n {\n Int64 ret = x;\n while(ret >= Mod)\n ret -= Mod;\n while(ret < 0) \n ret += Mod;\n return ret;\n }\n\n static Int64 Pow_Log(Int64 x,Int64 p)\n {\n if (p == 0)\n return 1;\n Int64 y;\n if(p%2==1)\n y = (Int64)Pow_Log(x,p-1)*x%Mod;\n else\n {\n y = Pow_Log(x,p/2);\n y = (Int64)y*y%Mod;\n }\n return y;\n }\n static void Main(string[] args)\n {\n Int64 n = GetNext(), S = GetNext(), sum = 0, Max = 1;\n Inv = 1;\n for (int i = 0; i < n; ++i)\n {\n Max *= 2;\n if (i > 0)\n Inv *= i;\n a[i] = GetNext();\n sum += a[i];\n }\n if (sum < S)\n {\n Console.WriteLine(\"0\");\n return;\n }\n\n //Console.WriteLine(Inv.ToString());\n Inv = Pow_Log(Inv%Mod, Mod - 2);\n\n //Console.WriteLine(Inv.ToString());\n Int64 Solution = Comb(S + n - 1, n - 1),cnt = 0;\n for (int i = 1; i < Max; ++i)\n {\n Int64 k = 0;\n int nr = 0;\n for (int j = 0; j < n; ++j)\n if (((1 << j) & i) != 0) \n {\n ++nr;\n k += a[j]+1;\n }\n k = S - k;\n if (nr % 2 == 1)\n cnt += Comb(k + n - 1, n - 1);\n else\n cnt -= Comb(k + n - 1, n - 1);\n cnt = Fix(cnt);\n }\n Solution -= cnt;\n Solution = Fix(Solution);\n Console.WriteLine(Solution.ToString()); \n #if LOCAL\n Console.Close(); \n #endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b053be366bdd29e031a61a13fa8d779f", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Problem51Nod\n{\n class Program\n {\n public static void Main(String[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(input[0]);\n long sum = Convert.ToInt64(input[1]);\n input = Console.ReadLine().Split(' ');\n long[] nums = new long[n];\n\n for (int i = 0; i < n; i++)\n nums[i] = Convert.ToInt64(input[i]);\n\n Init(nums);\n Console.WriteLine(Cal(Nums.Length - 1, sum));\n }\n \n static long Mod = 1000000007;\n static long[] Nums, InvFacts;\n\n static void Init(long[] nums)\n {\n long[] invs = new long[30];\n InvFacts = new long[30];\n invs[1] = InvFacts[1] = 1;\n\n for (int i = 2; i < invs.Length; i++)\n {\n invs[i] = (Mod - Mod / i * invs[Mod % i] % Mod) % Mod;\n InvFacts[i] = InvFacts[i - 1] * invs[i] % Mod;\n }\n\n Nums = new long[nums.Length];\n\n for (int i = 0; i < nums.Length; i++)\n Nums[i] = nums[i] + 1;\n\n Array.Sort(Nums, (a, b) => b.CompareTo(a));\n }\n\n static long Cal(int index, long sum)\n {\n int k = Nums.Length - 1;\n long result = Cmn(sum + k, k);\n\n for(int i = index; i >= 0 && Nums[i] <= sum; i--)\n result -= Cal(i - 1, sum - Nums[i]);\n\n return result;\n }\n\n static long Cmn(long m, long n)\n {\n long result = 1;\n\n for(long i = m - n + 1; i <= m; i++)\n result = i % Mod * result % Mod;\n\n result = result * InvFacts[n] % Mod;\n return result;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b4a5a5ef978bad9475215bd61ff22b6", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "//#define LOCAL\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nnamespace _258_E\n{\n class Program\n {\n class Files\n {\n StreamReader fin = new StreamReader(\"d:\\\\date.in\");\n StreamWriter fout = new StreamWriter(\"d:\\\\date.out\");\n public string ReadLine()\n {\n return fin.ReadLine();\n }\n public void Write(string s)\n {\n fout.Write(s);\n }\n public void WriteLine(string s)\n {\n fout.WriteLine(s);\n }\n public void Close()\n {\n fout.Close();\n }\n }\n #if LOCAL\n static Files Console = new Files();\n #endif\n const int Mod = (int)1e9+7;\n static string[] s;\n static string Line;\n static int step = 0, Length = 0;\n static Int64 GetNext()\n {\n if (step == Length)\n {\n Line = Console.ReadLine();\n s = Line.Split(' ');\n Length = s.Length;\n step = 0;\n }\n ++step;\n return Int64.Parse(s[step - 1]);\n }\n static Int64[] a = new Int64[30];\n static Int64 Inv = 1;\n static Int64 Comb(Int64 n, Int64 k)\n {\n if (n < k)\n return 0;\n Int64 result = 1;\n for (Int64 i = n - k + 1; i <= n; ++i)\n result = (Int64)result*i%Mod;\n result = (Int64)result*Inv%Mod;\n return result; \n }\n static Int64 Fix(Int64 x)\n {\n Int64 ret = x;\n if (ret >= Mod)\n ret -= Mod;\n if(ret < 0) \n ret += Mod;\n return ret;\n }\n\n static Int64 Pow_Log(Int64 x,Int64 p)\n {\n if (p == 0)\n return 1;\n Int64 y;\n if(p%2==1)\n y = (Int64)Pow_Log(x,p-1)*x%Mod;\n else\n {\n y = Pow_Log(x,p/2);\n y = (Int64)y*y%Mod;\n }\n return y;\n }\n static void Main(string[] args)\n {\n Int64 n = GetNext(), S = GetNext(), sum = 0, Max = 1;\n Inv = 1;\n for (int i = 0; i < n; ++i)\n {\n Max *= 2;\n if (i > 0)\n Inv *= i;\n a[i] = GetNext();\n sum += a[i];\n }\n if (sum < S)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Inv = Pow_Log(Inv, Mod - 2); \n Int64 Solution = Comb(S + n - 1, n - 1),cnt = 0;\n for (int i = 1; i < Max; ++i)\n {\n Int64 k = 0;\n int nr = 0;\n for (int j = 0; j < n; ++j)\n if (((1 << j) & i) != 0) \n {\n ++nr;\n k += a[j]+1;\n }\n k = S - k;\n if (nr % 2 == 1)\n cnt += Comb(k + n - 1, n - 1);\n else\n cnt -= Comb(k + n - 1, n - 1);\n cnt = Fix(cnt);\n }\n Solution -= cnt;\n Solution = Fix(Solution);\n Console.WriteLine(Solution.ToString());\n #if LOCAL\n Console.Close(); \n #endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fa76f562131fddc023b4315d0594ab99", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "//#define LOCAL\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nnamespace _258_E\n{\n class Program\n {\n class Files\n {\n StreamReader fin = new StreamReader(\"d:\\\\date.in\");\n StreamWriter fout = new StreamWriter(\"d:\\\\date.out\");\n public string ReadLine()\n {\n return fin.ReadLine();\n }\n public void Write(string s)\n {\n fout.Write(s);\n }\n public void WriteLine(string s)\n {\n fout.WriteLine(s);\n }\n public void Close()\n {\n fout.Close();\n }\n }\n #if LOCAL\n static Files Console = new Files();\n #endif\n const int Mod = (int)1e9+7;\n static string[] s;\n static string Line;\n static int step = 0, Length = 0;\n static Int64 GetNext()\n {\n if (step == Length)\n {\n Line = Console.ReadLine();\n s = Line.Split(' ');\n Length = s.Length;\n step = 0;\n }\n ++step;\n return Int64.Parse(s[step - 1]);\n }\n static Int64[] a = new Int64[30];\n static Int64 Inv = 1;\n static Int64 Comb(Int64 n, Int64 k)\n {\n if (n < k)\n return 0;\n Int64 result = 1;\n for (Int64 i = n - k + 1; i <= n; ++i)\n result = (Int64)result*i%Mod;\n result = (Int64)result*Inv%Mod;\n return result; \n }\n static Int64 Fix(Int64 x)\n {\n Int64 ret = x;\n if (ret >= Mod)\n ret -= Mod;\n if (ret < 0) \n ret += Mod;\n return ret;\n }\n\n static Int64 Pow_Log(Int64 x,Int64 p)\n {\n if (p == 0)\n return 1;\n Int64 y;\n if(p%2==1)\n y = (Int64)Pow_Log(x,p-1)*x%Mod;\n else\n {\n y = Pow_Log(x,p/2);\n y = (Int64)y*y%Mod;\n }\n return y;\n }\n static void Main(string[] args)\n {\n Int64 n = GetNext(), S = GetNext(), sum = 0, Max = 1;\n Inv = 1;\n for (int i = 0; i < n; ++i)\n {\n Max *= 2;\n if (i > 0)\n Inv *= i;\n a[i] = GetNext();\n sum += a[i];\n }\n if (sum < S)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Inv = Pow_Log(Inv, Mod - 2); \n Int64 Solution = Comb(S + n - 1, n - 1),cnt = 0;\n for (int i = 1; i < Max; ++i)\n {\n Int64 k = 0;\n int nr = 0;\n for (int j = 0; j < n; ++j)\n if (((1 << j) & i) != 0) \n {\n ++nr;\n k += a[j]+1;\n }\n k = S - k;\n if (nr % 2 == 1)\n cnt += Comb(k + n - 1, n - 1);\n else\n cnt -= Comb(k + n - 1, n - 1);\n cnt = Fix(cnt);\n }\n Solution -= cnt;\n Fix(Solution);\n Console.WriteLine(Solution.ToString());\n #if LOCAL\n Console.Close(); \n #endif\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e5de700b81ccae342441221392aebdfa", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "//#define LOCAL\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nnamespace _258_E\n{\n class Program\n {\n class Files\n {\n StreamReader fin = new StreamReader(\"d:\\\\date.in\");\n StreamWriter fout = new StreamWriter(\"d:\\\\date.out\");\n public string ReadLine()\n {\n return fin.ReadLine();\n }\n public void Write(string s)\n {\n fout.Write(s);\n }\n public void WriteLine(string s)\n {\n fout.WriteLine(s);\n }\n public void Close()\n {\n fout.Close();\n }\n }\n #if LOCAL\n static Files Console = new Files();\n #endif\n const Int64 Mod = (int)1e9+7;\n static string[] s;\n static string Line;\n static int step = 0, Length = 0;\n static Int64 GetNext()\n {\n if (step == Length)\n {\n Line = Console.ReadLine();\n s = Line.Split(' ');\n Length = s.Length;\n step = 0;\n }\n ++step;\n return Int64.Parse(s[step - 1]);\n }\n static Int64[] a = new Int64[30];\n static Int64 Inv = 1;\n static Int64 Comb(Int64 n, Int64 k)\n {\n if (n < k)\n return 0;\n Int64 result = 1;\n for (Int64 i = n - k + 1; i <= n; ++i)\n result = (Int64)result*i%Mod;\n result = (Int64)result*Inv%Mod;\n return result; \n }\n static Int64 Fix(Int64 x)\n {\n Int64 ret = x;\n while(ret >= Mod)\n ret -= Mod;\n while(ret < 0) \n ret += Mod;\n return ret;\n }\n\n static Int64 Pow_Log(Int64 x,Int64 p)\n {\n if (p == 0)\n return 1;\n Int64 y;\n if(p%2==1)\n y = (Int64)Pow_Log(x,p-1)*x%Mod;\n else\n {\n y = Pow_Log(x,p/2);\n y = (Int64)y*y%Mod;\n }\n return y;\n }\n static void Main(string[] args)\n {\n Int64 n = GetNext(), S = GetNext(), sum = 0, Max = 1;\n Inv = 1;\n for (int i = 0; i < n; ++i)\n {\n Max *= 2;\n if (i > 0)\n Inv *= i;\n a[i] = GetNext();\n sum += a[i];\n }\n if (sum < S)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Inv = Pow_Log(Inv, Mod - 2); \n Int64 Solution = Comb(S + n - 1, n - 1),cnt = 0;\n for (int i = 1; i < Max; ++i)\n {\n Int64 k = 0;\n int nr = 0;\n for (int j = 0; j < n; ++j)\n if (((1 << j) & i) != 0) \n {\n ++nr;\n k += a[j]+1;\n }\n k = S - k;\n if (nr % 2 == 1)\n cnt += Comb(k + n - 1, n - 1);\n else\n cnt -= Comb(k + n - 1, n - 1);\n cnt = Fix(cnt);\n }\n Solution -= cnt;\n Fix(Solution);\n Console.WriteLine(Solution.ToString());\n #if LOCAL\n Console.Close(); \n #endif\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "263cd21b557cea716c2d7dd3b6a75051", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R258\n{\n public class Task_E\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_E().Solve();\n }\n\n private long[] f;\n private int n;\n private const long MOD = (long)(1e9 + 7);\n\n private void Solve()\n {\n var parts = Console.ReadLine().Split().Select(long.Parse).ToArray();\n n = (int)parts[0];\n long s = parts[1];\n f = Console.ReadLine().Split().Select(long.Parse).ToArray();\n for (int i = 0; i < f.Length; i++)\n {\n f[i]++;\n }\n\n var ans = (go(0, s) + MOD) % MOD;\n Console.WriteLine(ans);\n }\n\n private long go(int pos, long s)\n {\n if (s < 0)\n return 0;\n\n long result = 0;\n if (pos == n)\n {\n result = C(s + n - 1, n - 1);\n }\n else\n {\n result = go(pos + 1, s) - go(pos + 1, s - f[pos]);\n }\n\n// Console.WriteLine(\"go({0},{1}) = {2}\", pos, s, result);\n return result;\n }\n\n private long C(long n, long k)\n {\n long result = 1;\n for (long i = 2; i <= k; i++)\n result = (result * inv(i)) % MOD;\n\n for (long i = n - k + 1; i <= n; i++)\n result = (result * (i % MOD)) % MOD;\n\n// Console.WriteLine(\"C({0}, {1}) = {2}\", n, k, result);\n return result;\n }\n\n private static void ExEuclidean(long a, long b, out long x, out long y)\n {\n if (a == 1)\n {\n x = 1;\n y = 0;\n }\n else\n {\n long x1, y1;\n ExEuclidean(b % a, a, out x1, out y1);\n x = y1 - (b / a) * x1;\n y = x1;\n }\n }\n\n private static long inv(long a)\n {\n long x, y;\n ExEuclidean(a, MOD, out x, out y);\n return (x + MOD) % MOD;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ce763bb54c0ab5a06f3c9d331601716", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "//#define LOCAL\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nnamespace _258_E\n{\n class Program\n {\n class Files\n {\n StreamReader fin = new StreamReader(\"d:\\\\date.in\");\n StreamWriter fout = new StreamWriter(\"d:\\\\date.out\");\n public string ReadLine()\n {\n return fin.ReadLine();\n }\n public void Write(string s)\n {\n fout.Write(s);\n }\n public void WriteLine(string s)\n {\n fout.WriteLine(s);\n }\n public void Close()\n {\n fout.Close();\n }\n }\n #if LOCAL\n static Files Console = new Files();\n #endif\n const int Mod = (int)1e9+7;\n static string[] s;\n static string Line;\n static int step = 0, Length = 0;\n static Int64 GetNext()\n {\n if (step == Length)\n {\n Line = Console.ReadLine();\n s = Line.Split(' ');\n Length = s.Length;\n step = 0;\n }\n ++step;\n return Int64.Parse(s[step - 1]);\n }\n static Int64[] a = new Int64[30];\n static Int64 Inv = 1;\n static Int64 Comb(Int64 n, Int64 k)\n {\n if (n < k)\n return 0;\n Int64 result = 1;\n for (Int64 i = n - k + 1; i <= n; ++i)\n result = (Int64)result*i%Mod;\n result = (Int64)result*Inv%Mod;\n return result; \n }\n static Int64 Fix(Int64 x)\n {\n Int64 ret = x;\n if (ret >= Mod)\n ret -= Mod;\n if (ret < 0) \n ret += Mod;\n return ret;\n }\n\n static Int64 Pow_Log(Int64 x,Int64 p)\n {\n if (p == 0)\n return 1;\n Int64 y;\n if(p%2==1)\n y = (Int64)Pow_Log(x,p-1)*x%Mod;\n else\n {\n y = Pow_Log(x,p/2);\n y = (Int64)y*y%Mod;\n }\n return y;\n }\n static void Main(string[] args)\n {\n Int64 n = GetNext(), S = GetNext(), sum = 0, Max = 1;\n Inv = 1;\n for (int i = 0; i < n; ++i)\n {\n Max *= 2;\n if (i > 0)\n Inv *= i;\n a[i] = GetNext();\n sum += a[i];\n }\n if (sum < S)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Inv = Pow_Log(Inv, Mod - 2); \n Int64 Solution = Comb(S + n - 1, n - 1),cnt = 0;\n for (int i = 1; i < Max; ++i)\n {\n Int64 k = 0;\n int nr = 0;\n for (int j = 0; j < n; ++j)\n if (((1 << j) & i) != 0) \n {\n ++nr;\n k += a[j]+1;\n }\n k = S - k;\n if (nr % 2 == 1)\n cnt += Comb(k + n - 1, n - 1);\n else\n cnt -= Comb(k + n - 1, n - 1);\n cnt = Fix(cnt);\n }\n Console.WriteLine(Solution.ToString());\n #if LOCAL\n Console.Close(); \n #endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7ee8b7bf880539f875b6b74b26f609fa", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "//#define LOCAL\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nnamespace _258_E\n{\n class Program\n {\n class Files\n {\n StreamReader fin = new StreamReader(\"d:\\\\date.in\");\n StreamWriter fout = new StreamWriter(\"d:\\\\date.out\");\n public string ReadLine()\n {\n return fin.ReadLine();\n }\n public void Write(string s)\n {\n fout.Write(s);\n }\n public void WriteLine(string s)\n {\n fout.WriteLine(s);\n }\n public void Close()\n {\n fout.Close();\n }\n }\n #if LOCAL\n static Files Console = new Files();\n #endif\n const int Mod = (int)1e9+7;\n static string[] s;\n static string Line;\n static int step = 0, Length = 0;\n static Int64 GetNext()\n {\n if (step == Length)\n {\n Line = Console.ReadLine();\n s = Line.Split(' ');\n Length = s.Length;\n step = 0;\n }\n ++step;\n return Int64.Parse(s[step - 1]);\n }\n static Int64[] a = new Int64[30];\n static Int64 Inv = 1;\n static Int64 Comb(Int64 n, Int64 k)\n {\n if (n < k)\n return 0;\n Int64 result = 1;\n for (Int64 i = n - k + 1; i <= n; ++i)\n result = (Int64)result*i%Mod;\n result = (Int64)result*Inv%Mod;\n return result; \n }\n static Int64 Fix(Int64 x)\n {\n Int64 ret = x;\n if (ret >= Mod)\n ret -= Mod;\n if (ret < 0) \n ret += Mod;\n return ret;\n }\n\n static Int64 Pow_Log(Int64 x,Int64 p)\n {\n if (p == 0)\n return 1;\n Int64 y;\n if(p%2==1)\n y = (Int64)Pow_Log(x,p-1)*x%Mod;\n else\n {\n y = Pow_Log(x,p/2);\n y = (Int64)y*y%Mod;\n }\n return y;\n }\n static void Main(string[] args)\n {\n Int64 n = GetNext(), S = GetNext(), sum = 0, Max = 1;\n Inv = 1;\n for (int i = 0; i < n; ++i)\n {\n Max *= 2;\n if (i > 0)\n Inv *= i;\n a[i] = GetNext();\n sum += a[i];\n }\n if (sum < S)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Inv = Pow_Log(Inv, Mod - 2); \n Int64 Solution = Comb(S + n - 1, n - 1),cnt = 0;\n for (int i = 1; i < Max; ++i)\n {\n Int64 k = 0;\n int nr = 0;\n for (int j = 0; j < n; ++j)\n if (((1 << j) & i) != 0) \n {\n ++nr;\n k += a[j]+1;\n }\n k = S - k;\n if (nr % 2 == 1)\n cnt += Comb(k + n - 1, n - 1);\n else\n cnt -= Comb(k + n - 1, n - 1);\n cnt = Fix(cnt);\n }\n Solution -= cnt;\n Console.WriteLine(Solution.ToString());\n #if LOCAL\n Console.Close(); \n #endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fa114b34ddccdde06f90d68f74cf42e8", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R258\n{\n public class Task_E\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_E().Solve();\n }\n\n private long[] f;\n private int n;\n private const long MOD = (long)(1e9 + 7);\n\n private void Solve()\n {\n var parts = Console.ReadLine().Split().Select(long.Parse).ToArray();\n n = (int)parts[0];\n long s = parts[1];\n f = Console.ReadLine().Split().Select(long.Parse).ToArray();\n for (int i = 0; i < f.Length; i++)\n {\n f[i]++;\n }\n\n var ans = (go(0, s) + MOD) % MOD;\n Console.WriteLine(ans);\n }\n\n private long go(int pos, long s)\n {\n if (s < 0)\n return 0;\n\n long result = 0;\n if (pos == n)\n {\n result = C(s + n - 1, n - 1);\n }\n else\n {\n result = go(pos + 1, s) - go(pos + 1, s - f[pos]);\n }\n\n // Console.WriteLine(\"go({0},{1}) = {2}\", pos, s, result);\n return result;\n }\n\n private long C(long n, long k)\n {\n long result = 1;\n for (long i = 2; i <= k; i++)\n result = (result * inv(i) % MOD) % MOD;\n\n for (long i = n - k + 1; i <= n; i++)\n result = (result * (i % MOD)) % MOD;\n\n // Console.WriteLine(\"C({0}, {1}) = {2}\", n, k, result);\n return result;\n }\n\n private static void ExEuclidean(long a, long b, out long x, out long y)\n {\n if (a == 1)\n {\n x = 1;\n y = 0;\n }\n else\n {\n long x1, y1;\n ExEuclidean(b % a, a, out x1, out y1);\n x = y1 - (b / a) * x1;\n y = x1;\n }\n }\n\n private static long inv(long a)\n {\n long x, y;\n ExEuclidean(a, MOD, out x, out y);\n return (x + MOD) % MOD;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "61d9f0cdb204b45cb67335b749b0b99b", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "//#define LOCAL\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nnamespace _258_E\n{\n class Program\n {\n class Files\n {\n StreamReader fin = new StreamReader(\"d:\\\\date.in\");\n StreamWriter fout = new StreamWriter(\"d:\\\\date.out\");\n public string ReadLine()\n {\n return fin.ReadLine();\n }\n public void Write(string s)\n {\n fout.Write(s);\n }\n public void WriteLine(string s)\n {\n fout.WriteLine(s);\n }\n public void Close()\n {\n fout.Close();\n }\n }\n #if LOCAL\n static Files Console = new Files();\n #endif\n const Int64 Mod = (Int64)1e9+7;\n static string[] s;\n static string Line;\n static int step = 0, Length = 0;\n static Int64 GetNext()\n {\n if (step == Length)\n {\n Line = Console.ReadLine();\n s = Line.Split(' ');\n Length = s.Length;\n step = 0;\n }\n ++step;\n return Int64.Parse(s[step - 1]);\n }\n static Int64[] a = new Int64[30];\n static Int64 Inv = 1;\n static Int64 Comb(Int64 n, Int64 k)\n {\n if (n < k)\n return 0;\n Int64 result = 1;\n for (Int64 i = n - k + 1; i <= n; ++i)\n result = (Int64)result*i%Mod;\n result = (Int64)result*Inv%Mod;\n return result; \n }\n static Int64 Fix(Int64 x)\n {\n Int64 ret = x;\n while(ret >= Mod)\n ret -= Mod;\n while(ret < 0) \n ret += Mod;\n return ret;\n }\n\n static Int64 Pow_Log(Int64 x,Int64 p)\n {\n if (p == 0)\n return 1;\n Int64 y;\n if(p%2==1)\n y = (Int64)Pow_Log(x,p-1)*x%Mod;\n else\n {\n y = Pow_Log(x,p/2);\n y = (Int64)y*y%Mod;\n }\n return y;\n }\n static void Main(string[] args)\n {\n Int64 n = GetNext(), S = GetNext(), sum = 0, Max = 1;\n Inv = 1;\n for (int i = 0; i < n; ++i)\n {\n Max *= 2;\n if (i > 0)\n Inv *= i;\n a[i] = GetNext();\n sum += a[i];\n }\n if (sum < S)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Inv = Pow_Log(Inv, Mod - 2); \n Int64 Solution = Comb(S + n - 1, n - 1),cnt = 0;\n for (int i = 1; i < Max; ++i)\n {\n Int64 k = 0;\n int nr = 0;\n for (int j = 0; j < n; ++j)\n if (((1 << j) & i) != 0) \n {\n ++nr;\n k += a[j]+1;\n }\n k = S - k;\n if (nr % 2 == 1)\n cnt += Comb(k + n - 1, n - 1);\n else\n cnt -= Comb(k + n - 1, n - 1);\n cnt = Fix(cnt);\n }\n Solution -= cnt;\n Solution = Fix(Solution);\n Console.WriteLine(Solution.ToString());\n #if LOCAL\n Console.Close(); \n #endif\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "14e95e92e3dff147868255034dcec3f6", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0efaa908e791b0331b6cc273e68f44ac", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "10c4737f4a7cd8d13cbbe18e56592718", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "013aa2b8dd1f87ee1fabeda23e5319f9", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ba322f2b3f68d3368396301144ebeb04", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d8e6a5959861d10e5a84f51bc13e73d0", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f7a0b57449af0f288102b30f882e98e2", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "MS C#", "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[] arr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n int lvl = arr[0] + 1;\n int n = arr[1], ans = 0, 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 += (int)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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2630374167554bd7cfdf8794b13aff92", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f84ab9dabdf4b46e665b98f6931be21f", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "98932281892c308091134ae67a53d752", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "df31feef74bd00977a7841c254ded548", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "MS C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f80878919373d2f9f4114ff4e08fc9d2", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace SharpPrikol\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(\"black\");\n else\n {\n Console.WriteLine(\"white\\n1 2\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "be17987bc65377e150ebd0512b6514f5", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "MS C#", "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 const string win = \"white\";\n const string lose = \"black\";\n var n = sc.Integer();\n if (n % 2 == 0)\n {\n IO.Printer.Out.WriteLine(win);\n IO.Printer.Out.WriteLine(\"1 2\");\n }\n else IO.Printer.Out.WriteLine(\"black\");\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#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "03d1ca7a2ef68ec7ddc3852672e486dd", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _493D\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n\n if (n % 2 == 0)\n {\n Console.WriteLine(\"white\");\n Console.WriteLine(\"1 2\");\n }\n else\n {\n Console.WriteLine(\"black\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d352b1b7bc0d72f0a8db2c8b140b746d", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _493D\n{\n class Program\n {\n // \u05d1\u05ea\u05d5\u05e8 \u05d4\u05d9\u05e8\u05d9\u05d1 \u05d4\u05de\u05e8\u05d7\u05e7 \u05d9\u05d4\u05d9\u05d4 \u05d0\u05d9-\u05d6\u05d5\u05d2\u05d9\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n % 2 == 0)\n {\n Console.WriteLine(\"white\");\n Console.WriteLine(\"1 2\");\n }\n else\n Console.WriteLine(\"black\");\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dd2265acd3f210183e30076433b2a675", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\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 if (n % 2 == 0)\n {\n Write(\"white\");\n Write(\"1 2\");\n }\n else\n Write(\"black\");\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(\"numbers.in\");\n //writer = new StreamWriter(\"numbers.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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "872cb2117f83ef1f188ff3661b3f1cf1", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nnamespace ConsoleApplication4\n{\n class Program\n {\n \n \n static void Main(string[] args)\n {\n UInt64 n = UInt64.Parse(Console.ReadLine());\n\n if (n % 2 == 0)\n {\n Console.WriteLine(\"white\");\n Console.WriteLine(\"1 2\");\n }\n else\n Console.WriteLine(\"black\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8272095f3e22689092a50133f2b21ec6", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n int N;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n\n /*\n * \u30af\u30a4\u30fc\u30f3\n * \n * \u305f\u3066\u3001\u3088\u3053\u3001\u306a\u306a\u3081\n * \u99d2\u304c\u3042\u3063\u305f\u3089\u53d6\u308b\n * \n * n*n\u30c1\u30a7\u30b9\u76e4\n * \n * (1,1)\u306b\u767d\n * (1,n)\u306b\u9ed2\n * \u305d\u308c\u4ee5\u5916\u5168\u90e8\u7dd1\n * \n * \u767d\u5148\u624b\n * \n * \u5fc5\u305a\u99d2\u3092\u53d6\u308b\n * \n * \u99d2\u3092\u53d6\u3089\u308c\u308b or \u99d2\u3092\u53d6\u308c\u306a\u3044 \u8ca0\u3051\n * \n * \u52dd\u3064\u307b\u3046\n */\n\n /*\n * 2 w 1 2\n * 3 b\n * 4 w 1 2\n */\n\n if (N % 2 == 0)\n {\n Console.WriteLine(\"white\");\n Console.WriteLine(\"1 2\");\n }\n else\n {\n Console.WriteLine(\"black\");\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8af1102751f1b25c5fad4d1a6c0578a3", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "Mono C#", "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 int n;\n long k;\n public void solve(TextReader input, TextWriter output) {\n var inp = input.ReadLine().Split(' ');\n n = int.Parse(inp[0]);\n k = long.Parse(inp[1]);\n\n long res = solve();\n\n if (res == -1)\n output.WriteLine(-1);\n else\n output.WriteLine(toStringBits(res));\n }\n\n long solve()\n {\n int mid = n / 2;\n\n for (long i = 0; i < (1 << mid); i++)\n {\n long count = (1L << mid) - i;\n if (n % 2 == 0)\n count -= i;\n\n if (count <= 0)\n return -1;\n\n if (k >= count)\n {\n k -= count;\n continue;\n }\n\n if(n%2 == 0)\n return (i << mid) + calc(i, (1L << mid) - i, mid);\n else \n return (i << mid) + calc(i / 2, i / 2 + (1L << mid) - i, mid);\n }\n\n return -1;\n }\n\n long calc(long l, long r, int pos)\n {\n if (pos == 0)\n return 0;\n\n long count = (r + r % 2) / 2 - (l + l % 2) / 2;\n\n if (count > k)\n {\n l += l % 2;\n r += r % 2;\n return calc(l / 2, r / 2, pos - 1);\n }\n else\n {\n k -= count;\n return (1 << (pos - 1)) + calc(l / 2, r / 2, pos - 1);\n }\n }\n\n public string toStringBits(long l)\n {\n string res = \"\";\n for (int i = n-1; i >= 0; i--)\n {\n var x = l & (1L << i);\n if (x > 0)\n res += \"1\";\n else\n res += \"0\";\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cc74caf0a193b44a926c8dafa98d85f3", "src_uid": "0a4a418dafaee71f1b31c928fc2ad24a", "difficulty": 2600.0} {"lang": "Mono C#", "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 var nums = ReadIntArray();\n var n = nums[0];\n var k = nums[1];\n var nk = n - k;\n var nmul = nk;\n var kmul = k;\n\n\n // factorial n\n long kf = kmul;\n while (--k > 1)\n {\n kf *= kmul;\n kf = kf%1000000007;\n }\n\n\n\n long nkp = nk;\n while (--nk > 0)\n {\n nkp *= nmul;\n nkp = nkp%1000000007;\n }\n\n Console.WriteLine(((nkp * kf) % 1000000007));\n }\n\n public static string Multiply(string source, int multiplier)\n {\n StringBuilder sb = new StringBuilder(multiplier * source.Length);\n for (int i = 0; i < multiplier; i++)\n {\n sb.Append(source);\n }\n\n return sb.ToString();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4df34f65292c4349366008790d50741e", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "Mono C#", "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 var nums = ReadIntArray();\n var n = nums[0];\n var k = nums[1];\n var nk = n - k;\n var nmul = nk;\n var kmul = k;\n\n\n // factorial n\n long kf = kmul;\n while (--k > 1)\n {\n kf *= kmul;\n }\n\n\n\n long nkp = nk;\n while (--nk > 0)\n {\n nkp *= nmul;\n }\n\n Console.WriteLine((nkp * kf) % 1000000007);\n }\n\n public static string Multiply(string source, int multiplier)\n {\n StringBuilder sb = new StringBuilder(multiplier * source.Length);\n for (int i = 0; i < multiplier; i++)\n {\n sb.Append(source);\n }\n\n return sb.ToString();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f82cb85b4573bbc0755adc7a3890039e", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "Mono C#", "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 var nums = ReadIntArray();\n var n = nums[0];\n var k = nums[1];\n var nk = n - k;\n var nmul = nk;\n var kmul = k;\n\n\n // factorial n\n long kf = kmul;\n while (--k > 1)\n {\n kf *= kmul;\n }\n\n\n\n long nkp = nk;\n while (--nk > 0)\n {\n nkp *= nmul;\n }\n\n Console.WriteLine(((nkp % 1000000007) * (kf % 1000000007) % 1000000007));\n }\n\n public static string Multiply(string source, int multiplier)\n {\n StringBuilder sb = new StringBuilder(multiplier * source.Length);\n for (int i = 0; i < multiplier; i++)\n {\n sb.Append(source);\n }\n\n return sb.ToString();\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6c70db30644681046abc7f3abcf582eb", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeff\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 var nums = ReadIntArray();\n var n = nums[0];\n var k = nums[1];\n var nk = n - k;\n var nmul = nk;\n var kmul = k;\n\n\n // factorial n\n long kf = kmul;\n while (--k > 1)\n {\n kf *= kmul;\n kf = kf%1000000007;\n }\n\n\n\n long nkp = nk;\n while (--nk > 0)\n {\n nkp *= nmul;\n nkp = nkp%1000000007;\n }\n\n if (kf == 0) kf = 1;\n if (nkp == 0) nkp = 1;\n Console.WriteLine(((nkp * kf) % 1000000007));\n }\n\n public static string Multiply(string source, int multiplier)\n {\n StringBuilder sb = new StringBuilder(multiplier * source.Length);\n for (int i = 0; i < multiplier; i++)\n {\n sb.Append(source);\n }\n\n return sb.ToString();\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\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ad43af1003caa500e31dbd314a728a3d", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "MS C#", "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 _150A()\n {\n long q = long.Parse(reader.ReadLine()), m1 = 0, m2 = 0, c = 0;\n for (long i = 2; i * i <= q && c < 2; ++i)\n while (q % i == 0)\n {\n q /= i;\n if (q == 1)\n break;\n ++c;\n if (c == 1)\n m1 = i;\n else if (c == 2)\n {\n m2 = i;\n break;\n }\n }\n if (c == 1)\n writer.Write(2);\n else\n {\n writer.WriteLine(1);\n if (c == 0)\n writer.Write(0);\n else if (c == 2)\n writer.Write(m1 * m2);\n }\n }\n static void _297B()\n {\n string[] s = reader.ReadLine().Split();\n int n = int.Parse(s[0]), m = int.Parse(s[1]), k = int.Parse(s[2]);\n\n string ans = \"\", yes = \"YES\", no = \"NO\";\n if (n > m)\n ans = yes;\n else\n {\n s = reader.ReadLine().Split();\n SortedDictionary alice = new SortedDictionary(), robert = new SortedDictionary();\n //int[] alice = new int[k+1], robert = new int[k+1];\n for (int i = 0; i < n; ++i)\n {\n int t = int.Parse(s[i]);\n if (alice.ContainsKey(t))\n ++alice[t];\n else\n alice.Add(t, 1);\n }\n s = reader.ReadLine().Split();\n int acount = n, rcount = m;\n for (int i = 0; i < m; ++i)\n {\n int t = int.Parse(s[i]);\n if (alice.ContainsKey(t) && alice[t] > 0)\n {\n --alice[t];\n --acount;\n }\n else\n {\n if (robert.ContainsKey(t))\n ++robert[t];\n else\n robert.Add(t, 1);\n }\n }\n rcount -= n - acount;\n int[] a = new int[acount], r = new int[rcount];\n int ac = 0;\n foreach (var v in alice)\n for (int i = 0; i < v.Value; ++i)\n a[ac++] = v.Key;\n /*for (int i = 1; i <= k; ++i)\n for (int j = 0; j < alice[i]; ++j)\n a[ac++] = i;*/\n int rc = 0;\n /*for (int i = 1; i <= k; ++i)\n for (int j = 0; j < robert[i]; ++j)\n r[rc++] = i;*/\n foreach (var v in robert)\n for (int i = 0; i < v.Value; ++i)\n r[rc++] = v.Key;\n int d = m - n;\n for (int i = rcount - 1; i >= d; --i)\n if (a[i - d] > r[i])\n {\n ans = yes;\n break;\n }\n if (ans == \"\")\n ans = no;\n }\n writer.Write(ans);\n }\n static void _271D()\n {\n const long prime = 71;\n string s = reader.ReadLine(), alphabet = reader.ReadLine();\n int k = int.Parse(reader.ReadLine());\n HashSet hashes = new HashSet();\n for (int i = 0; i < s.Length; ++i)\n {\n long bad = 0, hash = 0, p = 1;\n for (int j = i; j < s.Length; ++j)\n {\n if (alphabet[s[j] - 'a'] == '0')\n ++bad;\n if (bad > k)\n break;\n else\n {\n hash += ((long)(s[j] - 'a') + 1L) * p;\n p *= prime;\n //if (!hashes.Contains(hash))\n hashes.Add(hash);\n }\n }\n }\n writer.Write(hashes.Count);\n }\n static void _196A()\n {\n string s = reader.ReadLine();\n int r = 0;\n StringBuilder ans = new StringBuilder();\n for (char c = 'z'; c >= 'a'; --c)\n {\n for (int i = r; i < s.Length; ++i)\n {\n if (s[i] == c)\n {\n ans.Append(c);\n r = i;\n }\n }\n }\n writer.Write(ans);\n }\n static void _275B()\n {\n string[] nm = reader.ReadLine().Split();\n int n = int.Parse(nm[0]), m = int.Parse(nm[1]);\n string[] table = new string[n];\n for (int i = 0; i < n; ++i)\n table[i] = reader.ReadLine();\n bool[, , ,] connected = new bool[n, m, n, m];\n int[] xdir = { 1, 0, -1, 0 }, ydir = { 0, 1, 0, -1 };\n for (int i = 0; i < n; ++i)\n for (int j = 0; j < m; ++j)\n if (table[i][j] == 'B')\n {\n for (int d = 0; d < 4; ++d)\n {\n for (int y = i, x = j; ; y += ydir[d], x += xdir[d])\n {\n if (x < 0 || x >= m || y < 0 || y >= n)\n break;\n else if (table[y][x] == 'B')\n connected[i, j, y, x] = connected[y, x, i, j] = true;\n else\n break;\n }\n }\n }\n string ans = \"YES\";\n for (int i = 0; i < n && ans == \"YES\"; ++i)\n for (int j = 0; j < m && ans == \"YES\"; ++j)\n if (table[i][j] == 'B')\n for (int k = 0; k < n && ans == \"YES\"; ++k)\n for (int l = 0; l < m && ans == \"YES\"; ++l)\n if (table[k][l] == 'B')\n if (!((connected[i, j, i, l] && connected[i, l, k, l]) || (connected[i, j, k, j] && connected[k, j, k, l])))\n ans = \"NO\";\n writer.Write(ans);\n // TODO: BWB\n }\n static void _315A()\n {\n int n = int.Parse(reader.ReadLine()), ans = n;\n SortedSet bottles = new SortedSet();\n int[] a = new int[n], b = new int[n], c = new int[1001];\n for (int i = 0; i < n; ++i)\n {\n string[] ab = reader.ReadLine().Split();\n a[i] = int.Parse(ab[0]);\n b[i] = int.Parse(ab[1]);\n ++c[b[i]];\n bottles.Add(b[i]);\n }\n for (int i = 0; i < n; ++i)\n if (bottles.Contains(a[i]) && (a[i] != b[i] || c[a[i]] > 1))\n --ans;\n writer.Write(ans);\n }\n static void _264B()\n {\n int n = int.Parse(reader.ReadLine());\n string[] s = reader.ReadLine().Split();\n int[] a = new int[n];\n for (int i = 0; i < n; ++i)\n a[i] = int.Parse(s[i]);\n int[] dp = new int[n];\n dp[0] = 1;\n long num = a[0];\n for (int i = 1; i < n; ++i)\n {\n dp[i] = dp[i - 1];\n if (gcd(num, a[i]) == 1)\n num *= a[i];\n else\n {\n ++dp[i];\n num = a[i];\n }\n }\n writer.Write(dp[n - 1]);\n }\n struct C : IComparable\n {\n public double x, y, angle;\n public C(double a, double b)\n {\n x = a;\n y = b;\n angle = Math.Atan(y / x) / Math.PI * 180.0;\n if (x < 0.0 && y > 0)\n angle += 180.0;\n if (x < 0.0 && y <= 0.0)\n angle += 180.0;\n else if (x >= 0.0 && y < 0.0)\n angle += 360.0;\n /*if (y < 0.0 || (y == 0.0 && x < 0.0))\n angle += 180.0;*/\n }\n public int CompareTo(C c)\n {\n return angle.CompareTo(c.angle);\n }\n }\n static void _222D()\n {\n string[] s = reader.ReadLine().Split();\n int n = int.Parse(s[0]), x = int.Parse(s[1]);\n int[] a = new int[n], b = new int[n];\n s = reader.ReadLine().Split();\n for (int i = 0; i < n; ++i)\n a[i] = int.Parse(s[i]);\n Array.Sort(a);\n Array.Reverse(a);\n s = reader.ReadLine().Split();\n for (int i = 0; i < n; ++i)\n b[i] = int.Parse(s[i]);\n Array.Sort(b);\n int min = 0, ia = 0, ib = 0;\n while (ib < n)\n {\n if (a[ia] + b[ib] < x)\n ++ib;\n else\n {\n ++min;\n ++ia;\n ++ib;\n }\n }\n writer.Write(1 + \" \" + min);\n }\n static void _257C()\n {\n int n = int.Parse(reader.ReadLine());\n SortedSet set = new SortedSet();\n for (int i = 0; i < n; ++i)\n {\n string[] xy = reader.ReadLine().Split();\n set.Add(new C(int.Parse(xy[0]), int.Parse(xy[1])));\n }\n double angle = 0.0;\n C prev = set.Min;\n foreach (C c in set)\n {\n if (!c.Equals(prev))\n {\n angle = Math.Max(angle, Math.Abs(c.angle - prev.angle));\n prev = c;\n }\n }\n angle = Math.Max(angle, 360.0 - (set.Max.angle - set.Min.angle));\n writer.Write((360.0 - angle).ToString().Replace(',', '.'));\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 void _288B()\n {\n string[] kn = reader.ReadLine().Split();\n int n = int.Parse(kn[0]), k = int.Parse(kn[1]);\n writer.Write(BigInteger.Pow(k, k - 1) * BigInteger.Pow(n - k, n - k) % 1000000007);\n }\n static void Main(string[] args)\n {\n //_264B();\n _288B();\n reader.Close();\n writer.Close();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4618f283b1975367c7aae40b791a92bc", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "Mono C#", "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 Rec(int v, int[] a, ref long cnt)\n {\n if (v == a.Length)\n {\n for (int i = 0, j = 0, p = 0; i < a.Length; i++)\n {\n p = a[i];\n j = 0;\n while (j < a.Length)\n {\n if (p == 0) { break; }\n p = a[p];\n j++;\n }\n if (j == a.Length)\n return;\n }\n cnt++;\n }\n else\n {\n for (int i = 0; i < a.Length; i++)\n {\n a[v] = i;\n Rec(v + 1, a, ref cnt);\n }\n }\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(\"frozen.in\");\n StreamWriter sw = new StreamWriter(\"frozen.out\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n int n, k;\n string[] input = ReadArray();\n const long mod=1000000007;\n n = int.Parse(input[0]);\n k = int.Parse(input[1]);\n long cnt = 0;\n int[] a = new int[k];\n Rec(0, a, ref cnt);\n for (int i = 0; i < n - k; i++)\n {\n cnt = (cnt * (n - k)) % mod;\n }\n Console.WriteLine(cnt);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eebc05c5ad2039102c589ad488490b1c", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Polo_the_Penguin_and_Houses\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 int n = Next();\n int k = Next();\n\n var first = new int[k];\n first[0] = 0;\n\n int count = 0;\n do\n {\n if (first[0] == 1)\n break;\n\n var f = new bool[first.Length];\n bool ok = true;\n for (int i = 1; i < f.Length; i++)\n {\n int index = i;\n for (int j = 0; j < k; j++)\n {\n index = first[index];\n if (index == 0)\n break;\n }\n if (index != 0)\n {\n ok = false;\n break;\n }\n }\n if (ok)\n count++;\n } while (Next(first, k));\n\n long ans = count*(k);\n for (int i = n - k; i >= 1; i--)\n {\n ans = (ans*(n - k))%mod;\n }\n\n writer.WriteLine(ans);\n writer.Flush();\n }\n\n private static bool Next(int[] nn, int k)\n {\n for (int i = nn.Length - 1; i >= 0; i--)\n {\n nn[i]++;\n if (nn[i] == k)\n {\n nn[i] = 0;\n }\n else\n {\n return true;\n }\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "737ddc826ce5e3e8ed4531448e921861", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Diagnostics.Contracts;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R289D\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 Contract.Requires(tr != null);\n Contract.Requires(tw != null);\n\n var nk = tr.ReadLine().Split().Select(v => int.Parse(v, CultureInfo.InvariantCulture)).ToArray();\n\n tw.WriteLine(Calc(nk[0], nk[1]));\n }\n\n private static int Calc(int n, int k)\n {\n var r = 0;\n var kk = (int)Math.Pow(k, k);\n for (int i = 0; i < kk; ++i)\n {\n if (Valid(k, Plaques(k, i)))\n {\n ++r;\n }\n }\n var nmk = n - k;\n var mod = 1000000007;\n return (int)(r * ModPow(nmk, nmk, 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 private static int[] Plaques(int k, int x)\n {\n var res = new int[k];\n for (int i = 0; i < k; ++i)\n {\n res[i] = x % k;\n x /= k;\n }\n return res;\n }\n\n private static bool Valid(int k, int[] plaques)\n {\n for (int i = 0; i < k; ++i)\n {\n if (!CanReachZero(i, k, plaques, new bool[k]))\n {\n return false;\n }\n }\n return true;\n }\n\n private static bool CanReachZero(int current, int k, int[] plaques, bool[] visited)\n {\n if (current == 0)\n {\n return true;\n }\n\n if (visited[current])\n {\n return false;\n }\n\n visited[current] = true;\n return CanReachZero(plaques[current], k, plaques, visited);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "098b3a5b45e8ba255e8be32bf26de597", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace \u041e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u04302\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool contin = true;\n bool start = true;\n string msg = Console.ReadLine();\n if (msg.Length == 1 || String.IsNullOrEmpty(msg) || msg.Length == 2)\n {\n Console.WriteLine(\"NO\");\n start = false;\n }\n if (start == true)\n {\n for (int i = 0; i <= msg.Length / 2; i++)\n {\n if (msg.Length % 2 != 0 && msg.Substring(0, msg.Length / 2 + i) == msg.Substring(msg.Length / 2 - i + 1, msg.Length / 2 + i) && msg.Length / 2 + msg.Length / 2 + i + 1 > msg.Length && msg.Length / 2 - i + 1 != 0)\n {\n Console.WriteLine(\"YES\\n\" + msg.Substring(0, msg.Length / 2 + i));\n contin = false;\n break;\n }\n else if (msg.Length % 2 == 0 && msg.Substring(0, msg.Length / 2 + i) == msg.Substring(msg.Length / 2 - i, msg.Length / 2 + i) && msg.Length / 2 + msg.Length / 2 + i > msg.Length && msg.Length / 2 - i != 0)\n {\n Console.WriteLine(\"YES\\n\" + msg.Substring(0, msg.Length / 2 + i) + \"\\n\" + i);\n contin = false;\n break;\n }\n if (i >= msg.Length / 2)\n {\n Console.WriteLine(\"NO\");\n contin = false;\n break;\n }\n }\n if (contin)\n {\n if (msg.Length % 2 == 0 && msg.Substring(0, msg.Length / 2 - 1) == msg.Substring(msg.Length / 2, msg.Length / 2 - 1))\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c400471d11d8cb4850c443ec2dc42dca", "src_uid": "bfa78f72af4875f670f7adc5ed127033", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace \u041e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u04302\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool contin = true;\n bool start = true;\n string msg = Console.ReadLine();\n if (msg.Length == 1 || String.IsNullOrEmpty(msg))\n {\n Console.WriteLine(\"NO\");\n start = false;\n }\n if (start == true)\n {\n for (int i = 0; i < msg.Length / 2; i++)\n {\n if (msg.Length % 2 != 0 && msg.Substring(0, msg.Length / 2 + i) == msg.Substring(msg.Length / 2 - i + 1, msg.Length / 2 + i))\n {\n Console.WriteLine(\"YES\\n\" + msg.Substring(0, msg.Length / 2 + i));\n contin = false;\n break;\n }\n else if (msg.Length % 2 == 0 && i > 0 && msg.Substring(0, msg.Length / 2 + i) == msg.Substring(msg.Length / 2 - i, msg.Length / 2 + i))\n {\n Console.WriteLine(\"YES\\n\" + msg.Substring(0, msg.Length / 2 + i));\n contin = false;\n break;\n }\n if (i == msg.Length / 2 - 1)\n {\n Console.WriteLine(\"NO\");\n contin = false;\n break;\n }\n }\n if (contin)\n {\n if (msg.Length % 2 == 0 && msg.Substring(0, msg.Length / 2 - 1) == msg.Substring(msg.Length / 2, msg.Length / 2 - 1))\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2ec9d9b9201fa400be2f366efad42b96", "src_uid": "bfa78f72af4875f670f7adc5ed127033", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace \u041e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u04302\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool contin = true;\n bool start = true;\n string msg = Console.ReadLine();\n if (msg.Length == 1 || String.IsNullOrEmpty(msg) || msg.Length == 2)\n {\n Console.WriteLine(\"NO\");\n start = false;\n }\n if (start == true)\n {\n for (int i = 0; i <= msg.Length / 2; i++)\n {\n if (msg.Length % 2 != 0 && msg.Substring(0, msg.Length / 2 + i) == msg.Substring(msg.Length / 2 - i + 1, msg.Length / 2 + i) && msg.Length / 2 + msg.Length / 2 + i + 1 > msg.Length && msg.Length / 2 - i + 1 != 0)\n {\n Console.WriteLine(\"YES\\n\" + msg.Substring(0, msg.Length / 2 + i));\n contin = false;\n break;\n }\n else if (msg.Length % 2 == 0 && msg.Substring(0, msg.Length / 2 + i) == msg.Substring(msg.Length / 2 - i, msg.Length / 2 + i) && msg.Length / 2 + msg.Length / 2 + i > msg.Length && msg.Length / 2 - i != 0)\n {\n Console.WriteLine(\"YES\\n\" + msg.Substring(0, msg.Length / 2 + i));\n contin = false;\n break;\n }\n if (i >= msg.Length / 2)\n {\n Console.WriteLine(\"NO\");\n contin = false;\n break;\n }\n }\n if (contin)\n {\n if (msg.Length % 2 == 0 && msg.Substring(0, msg.Length / 2 - 1) == msg.Substring(msg.Length / 2, msg.Length / 2 - 1))\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3008109a7e22906779ac917a040c3b82", "src_uid": "bfa78f72af4875f670f7adc5ed127033", "difficulty": 1500.0} {"lang": "Mono C#", "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 int weights = int.Parse(Console.ReadLine());\n int[] masses = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n int[] cnt = new int[101];\n foreach (int mass in masses)\n {\n cnt[mass]++;\n }\n int nonZero = 0;\n for (int i = 1; i <= 100; i++)\n {\n if (cnt[i] > 0)\n {\n nonZero++;\n }\n }\n if (nonZero <= 2)\n {\n Console.WriteLine(weights);\n return;\n }\n\n int[,] C = new int[101, 101];\n C[0, 0] = 1;\n for (int i = 1; i <= 100; i++)\n {\n C[i, 0] = C[i, i] = 1;\n for (int j = 1; j < i; j++)\n {\n C[i, j] = (C[i - 1, j] + C[i - 1, j - 1]) % MOD;\n }\n }\n\n\n int sum = masses.Sum();\n int[,] ways = new int[weights + 1, sum + 1];\n ///\n /// dp(i, j, k) = dp(i - 1, j - 1, k - masses[j])\n ///\n\n ways[0, 0] = 1;\n for (int i = 0; i < weights; i++)\n {\n int[,] nways = new int[weights + 1, sum + 1];\n nways[0, 0] = 1;\n for (int j = 1; j <= i + 1; j++)\n {\n for (int k = sum; k > 0; k--)\n {\n nways[j, k] = ways[j, k];\n if (k >= masses[i])\n {\n nways[j, k] = (nways[j, k] + ways[j - 1, k - masses[i]]) % MOD;\n }\n }\n }\n \n ways = nways;\n }\n \n\n int ans = 1;\n for (int i = 1; i <= 100; i++)\n {\n if (cnt[i] > 0)\n {\n for (int j = i; j <= sum; j += i)\n {\n if (j / i <= weights && ways[j / i, j] > 0 && ways[j / i, j] == C[cnt[i], j / i])\n {\n ans = Math.Max(ans, j / i);\n }\n }\n }\n }\n\n Console.WriteLine(ans);\n\n\n }\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "93c8fd86ecd307f09eb3d19e014fda0a", "src_uid": "ccc4b27889598266e8efe73b8aa3666c", "difficulty": 2100.0} {"lang": "Mono C#", "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 int weights = int.Parse(Console.ReadLine());\n int[] masses = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n int[] cnt = new int[101];\n foreach (int mass in masses)\n {\n cnt[mass]++;\n }\n \n if (cnt.Count(app => app > 0) <= 2)\n {\n Console.WriteLine(weights);\n return;\n }\n\n int[,] C = new int[101, 101];\n C[0, 0] = 1;\n for (int i = 1; i <= 100; i++)\n {\n C[i, 0] = C[i, i] = 1;\n for (int j = 1; j < i; j++)\n {\n C[i, j] = (C[i - 1, j] + C[i - 1, j - 1]) % MOD;\n }\n }\n\n\n int sum = masses.Sum();\n int[,] ways = new int[weights + 1, sum + 1];\n ///\n /// dp(i, j, k) = dp(i - 1, j - 1, k - masses[j])\n ///\n\n ways[0, 0] = 1;\n for (int i = 0; i < weights; i++)\n {\n int[,] nways = new int[weights + 1, sum + 1];\n nways[0, 0] = 1;\n for (int j = 1; j <= i + 1; j++)\n {\n for (int k = sum; k > 0; k--)\n {\n nways[j, k] = ways[j, k];\n if (k >= masses[i])\n {\n nways[j, k] = (nways[j, k] + ways[j - 1, k - masses[i]]) % MOD;\n }\n }\n }\n \n ways = nways;\n }\n \n\n int ans = 1;\n for (int i = 1; i <= 100; i++)\n {\n if (cnt[i] > 0)\n {\n for (int j = i; j <= sum; j += i)\n {\n if (j / i <= weights && ways[j / i, j] > 0 && ways[j / i, j] == C[cnt[i], j / i])\n {\n ans = Math.Max(ans, j / i);\n }\n }\n }\n }\n\n Console.WriteLine(ans);\n\n\n }\n\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "52db27e813a5aab4c0165364e1c06576", "src_uid": "ccc4b27889598266e8efe73b8aa3666c", "difficulty": 2100.0} {"lang": "MS C#", "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 var data = Console.ReadLine().TrimEnd().Split(' ').Select(long.Parse).ToList();\n var bob = new long[n,2];\n bob[n - 1, 0] = data[n - 1];\n bob[n - 1, 1] = -data[n - 1];\n var prev = new int[n];\n prev[n - 1] = 1;\n for (var i = n - 2; i >= 0; i--)\n {\n if(bob[i + 1, 0] > bob[i + 1, 1])\n {\n prev[i] = 0;\n } else\n {\n prev[i] = 1;\n }\n bob[i, 0] = data[i] - Math.Max(bob[i + 1, 0],bob[i + 1, 1] );\n bob[i, 1] = Math.Max(bob[i + 1, 0], bob[i + 1, 1]) - data[i];\n }\n long bobSum = 0;\n var max = Math.Max(bob[0, 0], bob[0, 1]);\n writer.WriteLine((data.Sum()/2.0 - max/2.0) + \" \" + (data.Sum() / 2.0 + max / 2.0));\n writer.Flush();\n\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b6fd0afd9fd3ede67c1739660674d512", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0} {"lang": "MS C#", "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[] A = re.ia();\n int[] D = new int[N];\n int[] UD = new int[N];\n D[N-1] = A[N-1];\n for(int i=N-2;i>=0;i--){\n D[i] = Math.Max(D[i+1],A[i]+UD[i+1]);\n UD[i] = Math.Min(D[i+1],A[i]+UD[i+1]);\n }\n sb.Append(UD[0]+\" \"+D[0]+\"\\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; i--)\n {\n if (dp[i + 1, 0] > dp[i + 1, 1] + a[i])\n {\n dp[i, 0] = dp[i + 1, 0];\n dp[i, 1] = dp[i + 1, 1] + a[i];\n }\n else\n {\n dp[i, 0] = dp[i + 1, 1] + a[i];\n dp[i, 1] = dp[i + 1, 0];\n }\n }\n\n Write(a.Sum() - dp[0, 0], dp[0, 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#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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8d92d9a00882949533678b882233797f", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeff\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 private int n;\n private int[] pies;\n private Dictionary> cache = new Dictionary>();\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 n = sr.NextInt32();\n pies = sr.ReadArrayOfInt32();\n\n var answ = Solve(0, true, 0L, 0L);\n sw.WriteLine(answ.Item2 + \" \" + answ.Item1);\n }\n\n private Tuple Solve(int i, bool isBob, long currBob, long currAlice)\n {\n if (i == n) {\n return new Tuple(currBob, currAlice);\n }\n Tuple r = null;\n\n var key = i + \" \" + isBob;\n if (cache.ContainsKey(key)) {\n r = cache[key];\n \n return Tuple.Create(currBob + r.Item1, currAlice + r.Item2);\n }\n\n \n if (isBob) {\n var r1 = Solve(i + 1, true, currBob, currAlice + pies[i]);\n var r2 = Solve(i + 1, false, currBob + pies[i], currAlice);\n r = r1.Item1 > r2.Item1 ? r1 : r2;\n }\n else {\n var r1 = Solve(i + 1, false, currBob + pies[i], currAlice);\n var r2 = Solve(i + 1, true, currBob, currAlice + pies[i]);\n\n r = r1.Item2 > r2.Item2 ? r1 : r2;\n }\n \n cache.Add(key, Tuple.Create(r.Item1 - currBob, r.Item2 - currAlice));\n\n\n return r;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cdd49c7f83bdd49bd48b7a08e391a9c1", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\n\nclass Pie{\n DictionarywinSize;\n\n int getSum(int[]arr,int start){\n int sum = 0;\n int len = arr.Length;\n for(int i=start;i();\n int nSlices = slices.Length;\n int totalSz = getSum(slices,0);\n for(int i=nSlices-1;i>=0;i--){\n int sz = getWinSize(slices,i);\n\t winSize[i] = sz;\n }\n int bs = winSize[0];\n int az = totalSz-bs;\n int[]retArr = new int[]{az,bs};\n return retArr;\n }\n static int[]strToIntArr(String s){\n //s = s.Substring(1,s.Length-2);\n\t string[] strArr = s.Split(new char[]{' '});\n\t int len = strArr.Length;\n int[] retArr = new int[len]; \n\t for(int i=0;i= 0; i--)\n {\n var next = new int[2];\n\n next[0] = Math.Max(nn[i] + dp[1], dp[0]);\n next[1] = sum + nn[i] - Math.Max(nn[i] + sum - dp[0], sum - dp[1]);\n\n dp = next;\n sum += nn[i];\n }\n\n writer.Write(dp[1]);\n writer.Write(' ');\n writer.WriteLine(sum - dp[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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "34ecdfaa7cc3526530ef315fe8a5c049", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeff\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 private int n;\n private int[] pies;\n private Dictionary> cache = new Dictionary>();\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 n = sr.NextInt32();\n pies = sr.ReadArrayOfInt32();\n\n var answ = Solve(0, true, 0L, 0L);\n sw.WriteLine(answ.Item2 + \" \" + answ.Item1);\n }\n\n private Tuple Solve(int i, bool isBob, long currBob, long currAlice)\n {\n if (i == n) {\n return new Tuple(0L, 0L);\n }\n Tuple r = null;\n\n var key = i + \" \" + isBob;\n if (cache.ContainsKey(key)) {\n r = cache[key];\n \n return Tuple.Create(currBob + r.Item1, currAlice + r.Item2);\n }\n\n \n if (isBob) {\n var r1 = Solve(i + 1, true, currBob, currAlice + pies[i]);\n var r2 = Solve(i + 1, false, currBob + pies[i], currAlice);\n r = r1.Item1 > r2.Item1 ? r1 : r2;\n }\n else {\n var r1 = Solve(i + 1, false, currBob + pies[i], currAlice);\n var r2 = Solve(i + 1, true, currBob, currAlice + pies[i]);\n\n r = r1.Item2 > r2.Item2 ? r1 : r2;\n }\n \n cache.Add(key, Tuple.Create(r.Item1 - currBob, r.Item2 - currAlice));\n\n\n return r;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fd1bf9403e078435eefc175c26f5e18d", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0} {"lang": "MS C#", "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.Diagnostics;\nusing System.Linq;\n\nnamespace Codeforces.TaskE\n{\n public class Task\n {\n void Solve()\n {\n int n, x, y, dx, dy, t;\n Input.Next(out n, out x, out y, out dx, out dy, out t);\n\n while (dx < 0) dx += n;\n while (dy < 0) dy += n;\n var v = new long[] {x-1, y-1, dx, dy, 0, 1};\n\n // k = x + y + t + 2\n // dx' = dx + k = dx + x + y + t + 2\n // dy' = dy + k = dy + x + y + t + 2\n // x'= x + dx' = 2x + y + dx + t + 2\n // y'= y + dy' = x + 2y + dy + t + 2\n // t' = t + 1\n\n // x=0 y=1 dx=0 dy=1 t=0 k=3 dx'=3 dy'=4\n // x=3 y=0 dx=3 dy=4 t=1 k=6 dx'=4 dy'=0\n // x=2 y=0 dx=1 dy=2 t=2\n\n\n\n var m1 = Matrix.Create(new[,] { { 2, 1, 1, 1, 0, 0 }, \n { 1, 2, 1, 1, 0, 0 },\n { 1, 0, 1, 0, 0, 0 },\n { 0, 1, 0, 1, 0, 0 },\n { 1, 1, 1, 1, 1, 0 },\n { 2, 2, 2, 2, 1, 1 }\n });\n m1.Modulo = n;\n var u = v*m1.BinPower(t);\n/*\n var u1 = v*m1;\n var u2 = u1*m1;\n var u3 = u2 * m1;\n var u4 = u3 * m1;\n var u5 = u4 * m1;\n */ \n Console.WriteLine(++u[0] + \" \" + ++u[1]);\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[,] array)\n {\n var I = array.GetUpperBound(0) + 1;\n var J = array.GetUpperBound(1) + 1;\n var m = new Matrix(I, J);\n for(var i=0;i : 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 = 2 * n / 5;\n pr = new List { 2 };\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n for (var i = 3; i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Returns array of inverted prime numbers map in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out bool[] isPrime)\n {\n var m = 2 * n / 5;\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n isPrime = f;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bc090f3448dc16c021b8614a931d05bc", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "difficulty": 2300.0} {"lang": "MS C#", "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.Diagnostics;\nusing System.Linq;\n\nnamespace Codeforces.TaskE\n{\n public class Task\n {\n void Solve()\n {\n int n, x, y, dx, dy, t;\n Input.Next(out n, out x, out y, out dx, out dy, out t);\n\n var v = new long[] {x-1, y-1, dx, dy, 0, 1};\n\n // k = x + y + t + 2\n // dx' = dx + k = dx + x + y + t + 2\n // dy' = dy + k = dy + x + y + t + 2\n // x'= x + dx' = 2x + y + dx + t + 2\n // y'= y + dy' = x + 2y + dy + t + 2\n // t' = t + 1\n\n // x=0 y=1 dx=0 dy=1 t=0 k=3 dx'=3 dy'=4\n // x=3 y=0 dx=3 dy=4 t=1 k=6 dx'=4 dy'=0\n // x=2 y=0 dx=1 dy=2 t=2\n\n\n\n var m1 = Matrix.Create(new[,] { { 2, 1, 1, 1, 0, 0 }, \n { 1, 2, 1, 1, 0, 0 },\n { 1, 0, 1, 0, 0, 0 },\n { 0, 1, 0, 1, 0, 0 },\n { 1, 1, 1, 1, 1, 0 },\n { 2, 2, 2, 2, 1, 1 }\n });\n m1.Modulo = n;\n var u = v*m1.BinPower(t);\n \n Console.WriteLine(++u[0] + \" \" + ++u[1]);\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[,] array)\n {\n var I = array.GetUpperBound(0) + 1;\n var J = array.GetUpperBound(1) + 1;\n var m = new Matrix(I, J);\n for(var i=0;i : 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 = 2 * n / 5;\n pr = new List { 2 };\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n for (var i = 3; i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Returns array of inverted prime numbers map in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out bool[] isPrime)\n {\n var m = 2 * n / 5;\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n isPrime = f;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "223f37a58062466edf3fcf4307f92bc8", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "difficulty": 2300.0} {"lang": "MS C#", "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.Diagnostics;\nusing System.Linq;\n\nnamespace Codeforces.TaskE\n{\n public class Task\n {\n void Solve()\n {\n long n, x, y, dx, dy, t;\n Input.Next(out n, out x, out y, out dx, out dy, out t);\n\n while (dx < 0) dx += n;\n while (dy < 0) dy += n;\n var v = new long[] {x-1, y-1, dx, dy, 0, 1};\n\n // k = x + y + t + 2\n // dx' = dx + k = dx + x + y + t + 2\n // dy' = dy + k = dy + x + y + t + 2\n // x'= x + dx' = 2x + y + dx + t + 2\n // y'= y + dy' = x + 2y + dy + t + 2\n // t' = t + 1\n\n // x=0 y=1 dx=0 dy=1 t=0 k=3 dx'=3 dy'=4\n // x=3 y=0 dx=3 dy=4 t=1 k=6 dx'=4 dy'=0\n // x=2 y=0 dx=1 dy=2 t=2\n\n\n\n var m1 = Matrix.Create(new[,] { { 2, 1, 1, 1, 0, 0 }, \n { 1, 2, 1, 1, 0, 0 },\n { 1, 0, 1, 0, 0, 0 },\n { 0, 1, 0, 1, 0, 0 },\n { 1, 1, 1, 1, 1, 0 },\n { 2, 2, 2, 2, 1, 1 }\n });\n m1.Modulo = n;\n var u = v*m1.BinPower(t);\n/*\n var u1 = v*m1;\n var u2 = u1*m1;\n var u3 = u2 * m1;\n var u4 = u3 * m1;\n var u5 = u4 * m1;\n */ \n Console.WriteLine(++u[0] + \" \" + ++u[1]);\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 long a, out long b, out long c, out long d, out long e, out long f)\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 f = array[5];\n }\n else\n {\n a = b = c = d = e = f = 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[,] array)\n {\n var I = array.GetUpperBound(0) + 1;\n var J = array.GetUpperBound(1) + 1;\n var m = new Matrix(I, J);\n for(var i=0;i : 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 = 2 * n / 5;\n pr = new List { 2 };\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n for (var i = 3; i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Returns array of inverted prime numbers map in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out bool[] isPrime)\n {\n var m = 2 * n / 5;\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n isPrime = f;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ba46dcd14860bccf060d147a97ece3a6", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "difficulty": 2300.0} {"lang": "MS C#", "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[,] MatMult(long[,] a, long[,] b, int n, int mod)\n {\n var ret = new long[n, n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n for (int k = 0; k < n; k++)\n ret[i, j] = (ret[i, j] + a[i, k] * b[k, j]) % mod;\n return ret;\n }\n\n long[,] MatPow(long[,] a, int n, long p, int mod)\n {\n var ret = new long[n, n];\n for (int i = 0; i < n; i++)\n ret[i, i] = 1;\n while (p > 0)\n {\n if ((p & 1) == 1)\n ret = MatMult(ret, a, n, mod);\n a = MatMult(a, a, n, mod);\n p >>= 1;\n }\n return ret;\n }\n\n public void Solve()\n {\n int n = ReadInt();\n var v = new long[] { ReadInt() - 1, ReadInt() - 1, (ReadInt() % n + n) % n, (ReadInt() % n + n) % n, 0, 1 };\n long t = ReadLong();\n\n var a = new long[,] \n {\n { 2, 1, 1, 0, 1, 2 },\n { 1, 2, 0, 1, 1, 2 },\n { 1, 1, 1, 0, 1, 2 },\n { 1, 1, 0, 1, 1, 2 },\n { 0, 0, 0, 0, 1, 1 },\n { 0, 0, 0, 0, 0, 1 }\n };\n\n a = MatPow(a, 6, t, n);\n var ans = new long[2];\n for (int i = 0; i < 2; i++)\n for (int j = 0; j < 6; j++)\n ans[i] = (ans[i] + a[i, j] * v[j]) % n;\n\n Write(ans[0] + 1, ans[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 //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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d68f7dd722db0982b0ad1e20052a4d89", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "difficulty": 2300.0} {"lang": "MS C#", "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.Diagnostics;\nusing System.Linq;\n\nnamespace Codeforces.TaskE\n{\n public class Task\n {\n void Solve()\n {\n long n, x, y, dx, dy, t;\n Input.Next(out n, out x, out y, out dx, out dy, out t);\n\n while (dx < 0) dx += n;\n while (dy < 0) dy += n;\n var v = new long[] {x-1, y-1, dx, dy, 0, 1};\n\n // k = x + y + t + 2\n // dx' = dx + k = dx + x + y + t + 2\n // dy' = dy + k = dy + x + y + t + 2\n // x'= x + dx' = 2x + y + dx + t + 2\n // y'= y + dy' = x + 2y + dy + t + 2\n // t' = t + 1\n\n // x=0 y=1 dx=0 dy=1 t=0 k=3 dx'=3 dy'=4\n // x=3 y=0 dx=3 dy=4 t=1 k=6 dx'=4 dy'=0\n // x=2 y=0 dx=1 dy=2 t=2\n\n\n\n var m1 = Matrix.Create(new[,] { { 2, 1, 1, 1, 0, 0 }, \n { 1, 2, 1, 1, 0, 0 },\n { 1, 0, 1, 0, 0, 0 },\n { 0, 1, 0, 1, 0, 0 },\n { 1, 1, 1, 1, 1, 0 },\n { 2, 2, 2, 2, 1, 1 }\n });\n m1.Modulo = n;\n var u = v*m1.BinPower(t);\n/*\n var u1 = v*m1;\n var u2 = u1*m1;\n var u3 = u2 * m1;\n var u4 = u3 * m1;\n var u5 = u4 * m1;\n */ \n Console.WriteLine(++u[0] + \" \" + ++u[1]);\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 long a, out long b, out long c, out long d, out long e, out long f)\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 f = array[5];\n }\n else\n {\n a = b = c = d = e = f = 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[,] array)\n {\n var I = array.GetUpperBound(0) + 1;\n var J = array.GetUpperBound(1) + 1;\n var m = new Matrix(I, J);\n for(var i=0;i : 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 = 2 * n / 5;\n pr = new List { 2 };\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n for (var i = 3; i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Returns array of inverted prime numbers map in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out bool[] isPrime)\n {\n var m = 2 * n / 5;\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n isPrime = f;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "72e323d9f18e28d56a2bc40da738a597", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "difficulty": 2300.0} {"lang": "MS C#", "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 Fun(long a, long b, long x)\n {\n if (b > x)\n return 0;\n return (x - b) / a + 1;\n }\n\n long Fun(long a, long b, long l, long r)\n {\n return Fun(a, b, r) - Fun(a, b, l - 1);\n }\n\n long Gcd(long a, long b, out long x, out long y) \n {\n if (a == 0)\n {\n x = 0;\n y = 1;\n return b;\n }\n\t long x1, y1;\n\t long d = Gcd(b % a, a, out x1, out y1);\n\t x = y1 - (b / a) * x1;\n\t y = x1;\n\t return d;\n }\n \n bool Dio(long a, long b, long c, out long x0, out long y0, out long g) \n {\n\t g = Gcd(Math.Abs(a), Math.Abs(b), out x0, out y0);\n\t if (c % g != 0)\n\t\t return false;\n\t x0 *= c / g;\n\t y0 *= c / g;\n\t if (a < 0)\n x0 *= -1;\n\t if (b < 0) \n y0 *= -1;\n\t return true;\n }\n\n public void Solve()\n {\n long a1 = ReadInt();\n long b1 = ReadInt();\n long a2 = ReadInt();\n long b2 = ReadInt();\n long l = ReadInt();\n long r = ReadInt();\n\n if (a1 == a2)\n {\n if (Math.Abs(b1 - b2) % a1 != 0)\n Write(0);\n else\n Write(Fun(a1, Math.Max(b1, b2), l, r));\n return;\n }\n\n long x0, y0, g;\n if (!Dio(a1, -a2, b2 - b1, out x0, out y0, out g))\n {\n Write(0);\n return;\n }\n \n long d = a2 / g;\n if (x0 < 0)\n x0 += ((-x0 - 1) / d + 1) * d;\n x0 %= d;\n Write(Fun(d * a1, a1 * x0 + b1, l, r));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b78f307804619b4cc23b312bb7d488d0", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "difficulty": 2500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\n\nclass Program\n{\n public class SegmentTree where T : IComparable\n {\n private int Mid;\n private T[] t;\n private Func f;\n private T defaultValue = default(T);\n\n public SegmentTree(T[] a, Func f)\n {\n this.Mid = 1;\n while (Mid < a.Length) Mid *= 2;\n this.t = new T[Mid + Mid];\n this.f = f;\n\n Array.Copy(a, 0, this.t, Mid, a.Length);\n for (int i = (Mid + a.Length - 1) / 2; i > 0; i--) this.UpdateValueFor(i);\n }\n public SegmentTree(T defaultValue, int capacity, Func f)\n {\n this.defaultValue = defaultValue;\n this.Mid = 1;\n while (Mid < capacity) Mid *= 2;\n this.t = new T[Mid + Mid];\n this.f = f;\n\n for (int i = 0; i < Mid; i++)\n this.t[Mid + i] = defaultValue;\n\n for (int i = (Mid + Mid - 1) / 2; i > 0; i--) this.UpdateValueFor(i);\n }\n\n public T GetRoot()\n {\n return t[1];\n }\n\n public T Get(int l, int r)\n {\n l += Mid;\n r += Mid;\n\n T ans = this.defaultValue;\n while (l <= r)\n {\n if ((l & 1) == 1) ans = this.f(ans, t[l]);\n if ((r & 1) == 0) ans = this.f(ans, t[r]);\n\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n\n return ans;\n }\n\n public void Update(int i, T value)\n {\n t[i + Mid] = value;\n for (i = (i + Mid) >> 1; i >= 1; i = (i >> 1)) this.UpdateValueFor(i);\n }\n\n private void UpdateValueFor(int i)\n {\n t[i] = this.f(t[i + i], t[i + i + 1]);\n }\n }\n\n public class Item : IComparable\n {\n public long Value;\n public int Pos;\n\n public Item(int pos, long val)\n {\n this.Pos = pos;\n this.Value = val;\n }\n\n public int CompareTo(Item other)\n {\n return this.Value.CompareTo(other.Value);\n }\n }\n\n private static long SolveDBf(long a1, long b1, long a2, long b2, long l, long r, bool print = false)\n {\n long ans = 0;\n long min = l;\n if (min < b1) min = b1;\n if (min < b2) min = b2;\n\n for (long i = min; i <= r; i++)\n {\n if ((i - b1) % a1 == 0)\n if ((i - b2) % a2 == 0)\n {\n if (print)\n Console.WriteLine(i+ \" \");\n\n ans++;\n }\n }\n\n return ans;\n }\n\n private static long SolveDBf2(long a1, long b1, long a2, long b2, long l, long r)\n {\n long ans = 0;\n long min = l;\n if (min < b1) min = b1;\n if (min < b2) min = b2;\n\n if ((min-b1) % a1 > 0)\n min += a1 - ((min - b1) % a1);\n /*\n long del = (min - b1);\n if (del % a1 > 0) del += a1;\n long sf = del / a1;\n \n long i = min + sf * a1;\n * */\n\n long i = min;\n\n for (; i <= r; i += a1)\n {\n if ((i - b2) % a2 == 0)\n {\n ans++;\n }\n }\n\n return ans;\n }\n\n private static long SolveDBf3(long a, long b, long l, long r)\n {\n if (b > r) return 0;\n\n if (b < l)\n {\n long delta = (l - b) / a;\n b += delta * a;\n if (b < l) b += a;\n }\n\n if (b > r) return 0;\n\n long size = (r - b + a) / a;\n\n\n return size;\n }\n\n private static long SolveD(long a1, long b1, long a2, long b2, long l, long r)\n {\n if (a1 < a2)\n return SolveD(a2, b2, a1, b1, l, r);\n\n long ans = 0;\n if (a1 > 1000) return SolveDBf2(a1, b1, a2, b2, l, r);\n\n if (b1 < b2)\n {\n long q = (b2 - b1) / a1;\n b1 += q * a1;\n if (b1 < b2) b1 += a1;\n }\n\n for (long i = 0; i <= 1000; i++)\n {\n long t = a1 * i + b1;\n if ((t - b2) % a2 == 0)\n {\n b1 = t;\n b2 = t;\n\n long gcd = GCD(a1, a2);\n long delta = a1 * a2 / gcd;\n\n return SolveDBf3(delta, t, l, r);\n }\n }\n\n return ans;\n }\n\n private static void SolveD()\n {/*\n PushTestData(@\"\n2 0 3 3 5 21\nAns 3\n\n2 4 3 0 6 17\nAns 2\n\n\n\n\n\n\");*/\n long a1 = RL();\n long b1 = RL();\n long a2 = RL();\n long b2 = RL();\n\n long l = RL();\n long r = RL();\n Console.WriteLine(SolveD(a1, b1, a2, b2, l, r));\n //Console.WriteLine(SolveDBf(a1, b1, a2, b2, l, r));\n\n }\n\n private static Random rnd = new Random();\n private static void Testing()\n {\n while (true)\n {\n long a1 = rnd.Next(1, 10000);\n long b1 = rnd.Next(-100000, 100000);\n long a2 = rnd.Next(1, 10000);\n long b2 = rnd.Next(-100000, 100000);\n\n long l = rnd.Next(-100000, 100000);\n long r = rnd.Next(-100000, 100000);\n\n var ans1 = SolveD(a1, b1, a2, b2, l, r);\n var ans2 = SolveDBf(a1, b1, a2, b2, l, r);\n if (ans1 != ans2)\n {\n SolveDBf(a1, b1, a2, b2, l, r, true);\n ans1 = SolveD(a1, b1, a2, b2, l, r);\n Console.WriteLine(\"WA \" + a1 + \" \" + b1 + \" \" + a2 + \" \" + b2 + \" \" + l + \" \" + r);\n }\n }\n }\n\n private static long x, y;\n private static long[] dp;\n\n static void Main(string[] args)\n {\n //Testing();\n SolveD();\n \n \n /*\n int n = RI();\n x = RI();\n y = RI();\n\n dp = new long[n * 2 + 2];\n dp[0] = 0;\n for (int i = 1; i < dp.Length; i++)\n dp[i] = long.MaxValue;\n\n dp[0] = 0;\n\n int max = 3*n;\n var st = new SegmentTree(null, max, (a, b) =>\n {\n if (a.Value <= b.Value)\n return a;\n\n return b;\n });\n\n st.Update(0, new Item(0, 0));\n\n while (true)\n {\n var item = st.Get(0, max);\n int p = item.Pos;\n\n if (dp[p + 1] < dp[p] + x)\n {\n st.Update(p+1)\n heap.Add(new Item() { Value = dp[p + 1], Pos = p + 1 });\n }\n }\n\n Console.WriteLine(dp[n]);*/\n }\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 int Mod = 1000000007;\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 = 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[] 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[] 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 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(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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f3e0c5c8846a89f13259c5e210f31bb7", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\npublic class Wool\n{\n public static void Main(string [] args)\n {\n int n, m,i;\n string[] input = Console.ReadLine().Split(' ');\n n = int.Parse(input[0]);\n m = int.Parse(input[1]);\n long res = 1;\n const long d = 1000000009;\n for (i = 0; i < m; ++i)\n {\n res = res * 2;\n res = res % d;\n }\n long ans = 1;\n for (i = 1; i <= n; ++i)\n ans = (ans * (res - i)) % d;\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c339b8127aaa1bfe72c35f1861299414", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "difficulty": 1300.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ce3a84be90c0311336d8cfe05bc7749", "src_uid": "583cd1e553133b297f99fd52e5ad355b", "difficulty": 3000.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b788a1c6e16d6783d638dabc7ca93d3a", "src_uid": "583cd1e553133b297f99fd52e5ad355b", "difficulty": 3000.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc09609f8091da89d32c2177af4622d2", "src_uid": "583cd1e553133b297f99fd52e5ad355b", "difficulty": 3000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n var m = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var r = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int[] result = new int[1000000];\n for (int i = 0; i < 1000000; i++)\n {\n int you = 0;\n for (int j = 0; j < n; j++)\n {\n if (i % m[j] == r[j])\n {\n you = 1;\n break;\n }\n }\n\n result[i] = you;\n }\n\n Console.WriteLine(result.Average());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e1830a413b1b8e4067c4126832d8f8f4", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n\n var m = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var r = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var i1 = 10000000;\n int[] result = new int[i1];\n for (int i = 0; i < i1; i++)\n {\n int you = 0;\n for (int j = 0; j < n; j++)\n {\n if (i % m[j] == r[j])\n {\n you = 1;\n break;\n }\n }\n\n result[i] = you;\n }\n\n Console.WriteLine(result.Average());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "40f5fb541691bf7dceec7fb57e0cd376", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Task1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var M = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n var R = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n\n int res=0;\n for (int i = 0; i < 1000000; i++)\n {\n for (int z = 0; z < M.Length; z++)\n if (i % M[z] == R[z]) { res++; break; }\n }\n Console.WriteLine(String.Format(\"{0:0.000000}\", (double)res/1000000));\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e232113355a5500457e908322b0b2f0d", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n var m = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var r = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int[] result = new int[10000];\n for (int i = 0; i < 10000; i++)\n {\n int you = 0;\n for (int j = 0; j < n; j++)\n {\n if (i % m[j] == r[j])\n {\n you = 1;\n break;\n }\n }\n\n result[i] = you;\n }\n\n Console.WriteLine(result.Average());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "861d1ac6c7ee69c6461322c9a8d0043b", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Data;\nusing System.Numerics;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n object Get()\n {\n checked\n {\n var n = ReadLong();\n var m = ReadInts();\n var r = ReadInts();\n long all = 1;\n for (int i = 0; i < m.Length; i++)\n {\n all = all * m[i] / NOD(all, m[i]);\n }\n double result = 0;\n var grid = new bool[all];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < all; j+=m[i])\n\t\t\t{\n\t\t\t grid[j + r[i]] = true;\n\t\t\t}\n }\n return (((double)grid.Where(x=>x).Count()) / grid.Count()).ToString().Replace(',', '.');\n\n //var n = ReadLong();\n //for (int i = 2; i < Math.Sqrt(n) + 1; i++)\n //{\n // if (n != i && n % i == 0)\n // return \"NO\";\n //}\n //return \"YES\";\n }\n }\n\n public long NOD(long a, long b)\n {\n if (b > a)\n return NOD(b, a);\n if (b == 0)\n return a;\n return NOD(b, a % b);\n }\n\n public int BS(int[] arr, int l, int r, int v)\n {\n if (r - l == 1)\n return arr[l] >= v ? l : r;\n var half = (l + r) / 2;\n if (v == arr[half])\n return half;\n if (v < arr[half])\n return BS(arr, l, half, v);\n return BS(arr, half, r, v);\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 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 class Cut\n {\n public int a;\n public int b;\n public int line;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c58f4d044495fcf3f69e68078c2014c3", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0} {"lang": "MS C#", "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.AprilFool2016\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 ScrambledB\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[] m = new int[n], r = new int[n];\n for (int i = 0; i < n; i++) m[i] = fs.NextInt();\n for (int i = 0; i < n; i++) r[i] = fs.NextInt();\n int size = (int)1e6;\n bool[] onDuty = new bool[size];\n for (int i = 0; i < size; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i % m[j] == r[j])\n {\n onDuty[i] = true;\n break;\n }\n }\n }\n int count = 0;\n for (int i = 0; i < size; i++)\n {\n if (onDuty[i]) count++;\n }\n writer.WriteLine(((count * 1.0) / size).ToString().Replace(\",\", \".\"));\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "827c02172a9993f5de1db8e8e852fc6f", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Task1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var M = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n var R = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n\n int res=0;\n for (int i = 0; i < 1000000; i++)\n {\n for (int z = 0; z < M.Length; z++)\n if (i % M[z] == R[z]) { res++; break; }\n }\n Console.WriteLine(String.Format(\"{0:0.000000}\", (double)res / 1000000).Replace(',','.'));\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "121c010011ebb2079b0a6cec37d93372", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n\n var m = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var r = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var i1 = 1000000;\n int[] result = new int[i1];\n for (int i = 0; i < i1; i++)\n {\n int you = 0;\n for (int j = 0; j < n; j++)\n {\n if (i % m[j] == r[j])\n {\n you = 1;\n break;\n }\n }\n\n result[i] = you;\n }\n\n Console.WriteLine(result.Average().ToString(CultureInfo.InvariantCulture));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8702c6ca3eea81aa0c773ac06a9895f6", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n//using DebugerVisualizer;\n\nnamespace _105\n{\n\t[Serializable]\n\tclass VNodeValue\n\t{\n\t\tpublic int Version;\n\t\tpublic TNode Value;\n\n\t\tpublic VNodeValue(int version)\n\t\t{\n\t\t\tVersion = version;\n\t\t}\n\t}\n\n\t[Serializable]\n\tclass VEdge\n\t\twhere TNode : ICloneable\n\t{\n\t\tpublic TEdge Value;\n\t\tpublic VNode Source;\n\t\tpublic VNode Target;\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\treturn Value.ToString();\n\t\t}\n\t}\n\n\t[Serializable]\n\tclass VEdges\n\t\twhere TNode : ICloneable\n\t{\n\t\tpublic int Version;\n\t\tpublic List> Edges = new List>();\n\n\t\tpublic VEdges(int version)\n\t\t{\n\t\t\tVersion = version;\n\t\t}\n\t}\n\n\t[Serializable]\n\tclass VNode\n\t\twhere TNode : ICloneable\n\t{\n\t\tVGraph _graph;\n\n\t\tStack> _valueStack = new Stack>();\n\t\tStack> _ins = new Stack>();\n\t\tStack> _outs = new Stack>();\n\n\t\tinternal VNode(VGraph graph, TNode nodeValue)\n\t\t{\n\t\t\t_graph = graph;\n\t\t\tvar newNode = new VNodeValue(_graph.Version);\n\t\t\tnewNode.Value = nodeValue;\n\t\t\t_valueStack.Push(newNode);\n\t\t\t_ins.Push(new VEdges(_graph.Version));\n\t\t\t_outs.Push(new VEdges(_graph.Version));\n\t\t}\n\n\t\tpublic TNode ReadValue\n\t\t{\n\t\t\tget { return _valueStack.Peek().Value; }\n\t\t}\n\n\t\tpublic TNode WriteValue\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tif (_valueStack.Peek().Version != _graph.Version)\n\t\t\t\t{\n\t\t\t\t\tvar newVersion = new VNodeValue(_graph.Version);\n\t\t\t\t\tif (_valueStack.Peek().Value != null)\n\t\t\t\t\t\tnewVersion.Value = (TNode)_valueStack.Peek().Value.Clone();\n\t\t\t\t\t_valueStack.Push(newVersion);\n\t\t\t\t\t_graph.SheduleValueRollback(this);\n\t\t\t\t}\n\n\t\t\t\treturn _valueStack.Peek().Value;\n\t\t\t}\n\t\t}\n\n\t\tpublic IEnumerable> Ins\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tforeach (var edges in _ins)\n\t\t\t\t\tforeach (var e in edges.Edges)\n\t\t\t\t\t{\n\t\t\t\t\t\tyield return e;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic IEnumerable> Outs\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tforeach (var edges in _outs)\n\t\t\t\t\tforeach (var e in edges.Edges)\n\t\t\t\t\t{\n\t\t\t\t\t\tyield return e;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic void AddIns(VEdge edge)\n\t\t{\n\t\t\tif (_ins.Peek().Version != _graph.Version)\n\t\t\t{\n\t\t\t\tvar newVersion = new VEdges(_graph.Version);\n\t\t\t\t_ins.Push(newVersion);\n\t\t\t\t_graph.SheduleInEdgeRollback(this);\n\t\t\t}\n\t\t\t_ins.Peek().Edges.Add(edge);\n\t\t}\n\n\t\tpublic void AddOut(VEdge edge)\n\t\t{\n\t\t\tif (_outs.Peek().Version != _graph.Version)\n\t\t\t{\n\t\t\t\tvar newVersion = new VEdges(_graph.Version);\n\t\t\t\t_outs.Push(newVersion);\n\t\t\t\t_graph.SheduleOutEdgeRollback(this);\n\t\t\t}\n\t\t\t_outs.Peek().Edges.Add(edge);\n\t\t}\n\n\t\tinternal void RollbackValue()\n\t\t{\n\t\t\t_valueStack.Pop();\n\t\t}\n\n\t\tinternal void RollbackIns()\n\t\t{\n\t\t\t_ins.Pop();\n\t\t}\n\n\t\tinternal void RollbackOuts()\n\t\t{\n\t\t\t_outs.Pop();\n\t\t}\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\treturn ReadValue.ToString();\n\t\t}\n\t}\n\n\t[Serializable]\n\tclass VGraph : IDisposable\n\t\twhere TNode : ICloneable\n\t{\n\t\tpublic int Version = 0;\n\n\t\tStack>> _valueRollbacks = new Stack>>();\n\t\tStack>> _inEdgeRollbacks = new Stack>>();\n\t\tStack>> _outEdgeRollbacks = new Stack>>();\n\n\t\tpublic VGraph()\n\t\t{\n\t\t\tStartTransaction();\n\t\t}\n\n\t\tpublic void SheduleValueRollback(VNode node)\n\t\t{\n\t\t\t_valueRollbacks.Peek().Add(node);\n\t\t}\n\n\t\tpublic void SheduleInEdgeRollback(VNode node)\n\t\t{\n\t\t\t_inEdgeRollbacks.Peek().Add(node);\n\t\t}\n\n\t\tpublic void SheduleOutEdgeRollback(VNode node)\n\t\t{\n\t\t\t_outEdgeRollbacks.Peek().Add(node);\n\t\t}\n\n\t\tpublic VNode AddNode(TNode nodeValue)\n\t\t{\n\t\t\treturn new VNode(this, nodeValue);\n\t\t}\n\n\t\tpublic void AddEdge(VNode a, VNode b, TEdge edgeValue)\n\t\t{\n\t\t\tvar newEdge = new VEdge();\n\t\t\tnewEdge.Source = a;\n\t\t\tnewEdge.Target = b;\n\t\t\tnewEdge.Value = edgeValue;\n\n\t\t\ta.AddOut(newEdge);\n\t\t\tb.AddIns(newEdge);\n\t\t}\n\n\t\tpublic VGraph StartTransaction()\n\t\t{\n\t\t\tthis.Version++;\n\t\t\t_valueRollbacks.Push(new List>());\n\t\t\t_inEdgeRollbacks.Push(new List>());\n\t\t\t_outEdgeRollbacks.Push(new List>());\n\t\t\treturn this;\n\t\t}\n\n\t\tpublic void Rollback()\n\t\t{\n\t\t\tforeach (var values in _valueRollbacks.Pop())\n\t\t\t\tvalues.RollbackValue();\n\t\t\tforeach (var values in _inEdgeRollbacks.Pop())\n\t\t\t\tvalues.RollbackIns();\n\t\t\tforeach (var values in _outEdgeRollbacks.Pop())\n\t\t\t\tvalues.RollbackOuts();\n\t\t\tthis.Version--;\n\t\t}\n\n\t\tpublic void Dispose()\n\t\t{\n\t\t\tRollback();\n\t\t}\n\t}\n\n\t//[DebuggerVisualizer(typeof(ExpressionBuilderVisualizer))]\n\t[Serializable]\n\tclass GameState : IDisposable\n\t{\n\t\tVGraph _graph = new VGraph();\n\t\tStack>> nodes = new Stack>>();\n\t\tStack[]> playerNodes = new Stack[]>();\n\t\tVNode[] playerStartNodes = new VNode[3];\n\t\tint nodesCount = 0;\n\n\t\tpublic IEnumerable> Nodes\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tforeach (var ns in nodes)\n\t\t\t\t\tforeach (var node in ns)\n\t\t\t\t\t\tyield return node; \n\t\t\t}\n\t\t}\n\n\t\tpublic void ClearTrace(Player[] players)\n\t\t{\n\t\t\tforeach (var node in Nodes)\n\t\t\t{\n\t\t\t\tnode.WriteValue.Min = int.MinValue/2;\n\t\t\t\tnode.WriteValue.Max = int.MaxValue/2;\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tplayerStartNodes[i].WriteValue.Min = playerStartNodes[i].WriteValue.Max = players[i].Start;\n\t\t\t}\n\t\t}\n\n\t\tpublic GameState(Player[] players)\n\t\t{\n\t\t\tnodes.Push(new List>());\n\n\t\t\tplayerNodes.Push(new VNode[3]);\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tvar node = _graph.AddNode(new ExpressionNode() { Id = i, Min = players[i].Start, Max = players[i].Start, Comment = \"S(\"+ i.ToString() +\")\" });\n\t\t\t\tnodes.Peek().Add(node);\n\t\t\t\tplayerStartNodes[i] = node;\n\t\t\t\tplayerNodes.Peek()[i] = node;\n\t\t\t}\n\t\t\tnodesCount = 3;\n\t\t}\n\n\t\tpublic GameState StartTransaction()\n\t\t{\n\t\t\t_graph.StartTransaction();\n\t\t\tnodes.Push(new List>());\n\t\t\tplayerNodes.Push( (VNode[])playerNodes.Peek().Clone());\n\t\t\treturn this;\n\t\t}\n\n\t\tpublic void Dispose()\n\t\t{\n\t\t\t_graph.Rollback();\n\n\t\t\tnodesCount -= nodes.Pop().Count;\n\t\t\tplayerNodes.Pop();\n\t\t}\n\n\t\tpublic int Max\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tint max = Int32.MinValue;\n\t\t\t\tforeach (var node in Nodes)\n\t\t\t\t{\n\t\t\t\t\tif (max < node.ReadValue.Max)\n\t\t\t\t\t\tmax = node.ReadValue.Max;\n\t\t\t\t}\n\n\t\t\t\treturn max;\n\t\t\t}\n\t\t}\n\n\t\tpublic VNode AddPlayerNode(int i, string comment)\n\t\t{\n\t\t\tvar nodeValue = new ExpressionNode() { Id = nodesCount++ };\n\t\t\tnodeValue.Comment = comment;\n\t\t\tvar node = _graph.AddNode(nodeValue);\n\t\t\tnodes.Peek().Add(node);\n\t\t\tplayerNodes.Peek()[i] = node;\n\t\t\treturn node;\n\t\t}\n\n\t\tpublic VNode GetPlayerNode(int i)\n\t\t{\n\t\t\treturn playerNodes.Peek()[i];\n\t\t}\n\n\t\tpublic VNode GetPlayerStartNode(int i)\n\t\t{\n\t\t\treturn playerStartNodes[i];\n\t\t}\n\n\t\t//a <= b + c\n\t\tpublic bool AddMin(VNode a, VNode b, int c)\n\t\t{\n\t\t\tvar path = new ExpressionPath() { Mark = c };\n\t\t\t_graph.AddEdge(b, a, path);\n\n\t\t\tif (a.ReadValue.Max > b.ReadValue.Max + c)\n\t\t\t\ta.WriteValue.Max = b.ReadValue.Max + c;\n\n\t\t\tif (b.ReadValue.Min < a.ReadValue.Min - c)\n\t\t\t\tb.WriteValue.Min = a.ReadValue.Min - c;\n\n\t\t\tif (!Trace(a))\n\t\t\t\treturn false;\n\t\t\tif (!Trace(b))\n\t\t\t\treturn false;\n\t\t\tif (!Validate())\n\t\t\t\treturn false;\n\n\t\t\treturn true;\n\t\t}\n\n\t\tbool Trace(VNode a)\n\t\t{\n\t\t\tif (!TraceMin(this, a))\n\t\t\t\treturn false;\n\t\t\tif (!TraceMax(this, a))\n\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tstatic bool TraceMin(GameState state, VNode x)\n\t\t{\n\t\t\tx.WriteValue.Traced = true;\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tforeach (var vector in state.Maximize(x))\n\t\t\t\t{\n\t\t\t\t\t// x <= path.Max + path.Mark\n\n\t\t\t\t\tif (vector.Target.ReadValue.Traced)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (vector.Target.ReadValue.Min < x.ReadValue.Min - vector.Mark)\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif (vector.Target.ReadValue.Min < x.ReadValue.Min - vector.Mark)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvector.Target.WriteValue.Min = x.ReadValue.Min - vector.Mark;\n\t\t\t\t\t\t\tif (!TraceMin(state, vector.Target))\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tx.WriteValue.Traced = false;\n\t\t\t}\n\t\t}\n\n\t\tstatic bool TraceMax(GameState state, VNode x)\n\t\t{\n\t\t\tx.WriteValue.Traced = true;\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tforeach (var vector in state.Minimize(x))\n\t\t\t\t{\n\t\t\t\t\tif (vector.Target.ReadValue.Traced)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (vector.Target.ReadValue.Max > x.ReadValue.Max + vector.Mark)\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif (vector.Target.ReadValue.Max > x.ReadValue.Max + vector.Mark)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvector.Target.WriteValue.Max = x.ReadValue.Max + vector.Mark;\n\t\t\t\t\t\t\tif (!TraceMax(state, vector.Target))\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tx.WriteValue.Traced = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic IEnumerable Maximize(VNode a)\n\t\t{\n\t\t\treturn a.Ins.Select(path => new Vector(path.Value.Mark, path.Source));\n\t\t}\n\n\t\tpublic IEnumerable Minimize(VNode a)\n\t\t{\n\t\t\treturn a.Outs.Select(path => new Vector(path.Value.Mark, path.Target));\n\t\t}\n\n\t\tpublic bool Validate()\n\t\t{\n\t\t\tforeach (var node in Nodes)\n\t\t\t{\n\t\t\t\tif (node.ReadValue.Min > node.ReadValue.Max)\n\t\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\tstring result = \"\";\n\n\t\t\tforeach (var node in Nodes.Reverse())\n\t\t\t{\n\t\t\t\tresult += node.ReadValue.ToString();\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t[Serializable]\n\tstruct Vector\n\t{\n\t\tpublic int Mark;\n\t\tpublic VNode Target;\n\n\t\tpublic Vector(int mark, VNode target)\n\t\t{\n\t\t\tMark = mark;\n\t\t\tTarget = target;\n\t\t}\n\t}\n\n\n\t[Serializable]\n\tinternal class Player\n\t{\n\t\tpublic int Start;\n\t\tpublic int Walk;\n\t\tpublic int Throws;\n\n\t\tpublic bool alreadyWalked = false;\n\t\tpublic bool alreadyUpped = false;\n\t\tpublic bool alreadyThrowed = false;\n\t\tpublic bool Upped = false;\n\t\tpublic int Up = -1;\n\t}\n\n\t[Serializable]\n\tclass ExpressionNode : ICloneable\n\t{\n\t\tpublic int Id;\n\t\tpublic int Min = int.MinValue/2;\n\t\tpublic int Max = int.MaxValue/2;\n\t\tpublic bool Traced = false;\n\t\tpublic string Comment;\n\n\t\tpublic object Clone()\n\t\t{\n\t\t\treturn this.MemberwiseClone();\n\t\t}\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\treturn Comment + String.Format(\"[{0}:{1}]\", Min, Max);\n\t\t}\n\n\t}\n\n\t[Serializable]\n\t[ReadOnly(true)]\n\tstruct ExpressionPath\n\t{\n\t\tpublic int Mark;\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\tvar result = String.Format(\"({0})\", Mark);\n\t\t\treturn result;\n\t\t}\n\t}\n\n\tclass Program\n\t{\n\t\t//static StreamReader inStream = new StreamReader(\"input.txt\");\n\t\t//static string ReadLine()\n\t\t//{\n\t\t// return inStream.ReadLine();\n\t\t//}\n\n\t\tstatic string ReadLine()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tstatic int AbsoluteMax = int.MinValue;\n\t\tstatic string AbsoluteMaxStr = \"\";\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tPlayer[] players = new Player[3];\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tplayers[i] = new Player();\n\t\t\t\tstring[] arg = ReadLine().Split();\n\t\t\t\tplayers[i].Start = int.Parse(arg[0]);\n\t\t\t\tplayers[i].Walk = int.Parse(arg[1]);\n\t\t\t\tplayers[i].Throws = int.Parse(arg[2]);\n\t\t\t}\n\n\n\t\t\tvar state = new GameState(players);\n\t\t\n\t\t\tSolve(state, players);\n\t\t\tConsole.WriteLine(AbsoluteMax);\n\t\t\t//Console.WriteLine(AbsoluteMaxStr);\n\t\t}\n\n\n\t\tstatic void Solve(GameState state, Player[] players)\n\t\t{\n\t\t\tif (EuristicGetMax(state, players) <= AbsoluteMax)\n\t\t\t\treturn;\n\n\t\t\tint max = state.Max;\n\t\t\tif (AbsoluteMax < max)\n\t\t\t{\n\t\t\t\tAbsoluteMax = max;\n\t\t\t\tAbsoluteMaxStr = state.ToString();\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tusing (var clone = state.StartTransaction())\n\t\t\t\t{\n\t\t\t\t\tDoMove(i, clone, players);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\tfor (int j = 0; j < 3; j++)\n\t\t\t\t\tif (i != j)\n\t\t\t\t\t{\n\t\t\t\t\t\tusing (var clone = state.StartTransaction())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tDoUp(i, j, clone, players);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tusing (var clone = state.StartTransaction())\n\t\t\t\t{\n\t\t\t\t\tDoThrow(i, clone, players);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstatic private void DoMove(int i, GameState state, Player[] players)\n\t\t{\n\t\t\tif (players[i].alreadyWalked || players[i].Up >= 0 || players[i].Upped)\n\t\t\t\treturn;\n\n\t\t\tplayers[i].alreadyWalked = true;\n\n\t\t\tVNode a = state.GetPlayerNode(i);\n\t\t\tVNode moved = state.AddPlayerNode(i, string.Format(\"M({0})\", i));\n\n\t\t\tif (!state.AddMin(moved, a, players[i].Walk))\n\t\t\t\treturn;\n\t\t\tif (!state.AddMin(a, moved, players[i].Walk))\n\t\t\t\treturn;\n\n\t\t\tusing (var clone = state.StartTransaction())\n\t\t\t{\n\t\t\t\tNotEqual(players, i, clone);\n\t\t\t}\n\n\t\t\tplayers[i].alreadyWalked = false;\n\t\t}\n\n\t\tprivate static void DoThrow(int i, GameState state, Player[] players)\n\t\t{\n\t\t\tif (players[i].alreadyThrowed || players[i].Up < 0 || players[i].Upped)\n\t\t\t\treturn;\n\n\t\t\tplayers[i].alreadyThrowed = true;\n\n\t\t\tint j = players[i].Up;\n\t\t\tplayers[i].Up = -1;\n\t\t\tplayers[j].Upped = false;\n\n\t\t\tVNode a = state.GetPlayerNode(i);\n\t\t\tVNode moved = state.AddPlayerNode(j, string.Format(\"T({0}, {1})\", i, j));\n\n\t\t\tif (!state.AddMin(moved, a, players[i].Throws))\n\t\t\t\treturn;\n\t\t\tif (!state.AddMin(a, moved, players[i].Throws))\n\t\t\t\treturn;\n\n\t\t\tNotEqual(players, j, state);\n\n\t\t\tplayers[j].Upped = true;\n\t\t\tplayers[i].Up = j;\n\t\t\tplayers[i].alreadyThrowed = false;\n\t\t}\n\n\t\tprivate static void DoUp(int i, int j, GameState state, Player[] players)\n\t\t{\n\t\t\tif (players[i].alreadyUpped || players[i].Up >= 0 || players[i].Upped || players[j].Upped || i == j)\n\t\t\t\treturn;\n\n\t\t\tplayers[i].alreadyUpped = true;\n\t\t\tplayers[i].Up = j;\n\t\t\tplayers[j].Upped = true;\n\n\t\t\tVNode a = state.GetPlayerNode(i);\n\t\t\tVNode b = state.GetPlayerNode(j);\n\n\t\t\tVNode moved = state.AddPlayerNode(j, string.Format(\"U({0}, {1})\", i, j));\n\n\t\t\tif (!state.AddMin(moved, a, 0))\n\t\t\t\treturn;\n\t\t\tif (!state.AddMin(a, moved, 0))\n\t\t\t\treturn;\n\n\t\t\tEqual(state, players, a, b, 1);\n\t\t\tEqual(state, players, a, b, -1);\n\n\t\t\tplayers[j].Upped = false;\n\t\t\tplayers[i].Up = -1;\n\t\t\tplayers[i].alreadyUpped = false;\n\t\t}\n\n\t\t//a = b + c\n\t\tprivate static void Equal(GameState state, Player[] players, VNode a, VNode b, int c)\n\t\t{\n\t\t\tusing (var v1 = state.StartTransaction())\n\t\t\t{\n\t\t\t\tif (v1.AddMin(b, a, -c) && v1.AddMin(a, b, c))\n\t\t\t\t\tSolve(v1, players);\n\t\t\t}\n\t\t}\n\n\t\tstatic private void NotEqual(Player[] players, int i, GameState state)\n\t\t{\n\t\t\tVNode a = state.GetPlayerNode(i); //current \n\t\t\tVNode b = state.GetPlayerNode((i + 1) % 3); //not equal to\n\t\t\tVNode c = state.GetPlayerNode((i + 2) % 3); //and not equal to\n\n\t\t\tusing (var v1 = state.StartTransaction())\n\t\t\t{\n\t\t\t\tif (v1.AddMin(a, b, -1) && v1.AddMin(a, c, -1))\n\t\t\t\t\tSolve(v1, players);\n\t\t\t}\n\n\t\t\tusing (var v2 = state.StartTransaction())\n\t\t\t{\n\t\t\t\tif (v2.AddMin(b, a, -1) && v2.AddMin(a, c, -1))\n\t\t\t\t\tSolve(v2, players);\n\t\t\t}\n\n\t\t\tusing (var v3 = state.StartTransaction())\n\t\t\t{\n\t\t\t\tif (v3.AddMin(b, a, -1) && v3.AddMin(c, a, -1))\n\t\t\t\t\tSolve(v3, players);\n\t\t\t}\n\n\t\t\tusing (var v4 = state.StartTransaction())\n\t\t\t{\n\t\t\t\tif (v4.AddMin(a, b, -1) && v4.AddMin(c, a, -1))\n\t\t\t\t\tSolve(v4, players);\n\t\t\t}\n\t\t}\n\n\t\tstatic int EuristicGetMax(GameState state, Player[] players)\n\t\t{\n\t\t\tint radius = 0;\n\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tif (!players[i].alreadyThrowed)\n\t\t\t\t\tradius += players[i].Throws;\n\t\t\t\tif (!players[i].alreadyWalked)\n\t\t\t\t\tradius += players[i].Walk;\n\t\t\t\tif (!players[i].alreadyUpped)\n\t\t\t\t\tradius += 1;\n\t\t\t}\n\n\t\t\tvar result = Enumerable.Range(0,3).Max(i => state.GetPlayerNode(i).ReadValue.Max + radius);\n\t\t\treturn result;\n\t\t}\n\t}\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d49fce0472994f262151c1f2614a3b64", "src_uid": "a14739b86d1fd62a030226263cdc1afc", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n//using DebugerVisualizer;\n\nnamespace _105\n{\n\n\tclass Program\n\t{\n\t\t//static StreamReader inStream = new StreamReader(\"input.txt\");\n\t\t//static string ReadLine()\n\t\t//{\n\t\t// return inStream.ReadLine();\n\t\t//}\n\n\t\tstatic string ReadLine()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tstatic int AbsoluteMax = int.MinValue;\n\t\tstatic string AbsoluteMaxStr = \"\";\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tPlayer[] players = new Player[3];\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tplayers[i] = new Player();\n\t\t\t\tstring[] arg = ReadLine().Split();\n\t\t\t\tplayers[i].Start = int.Parse(arg[0]);\n\t\t\t\tplayers[i].Walk = int.Parse(arg[1]);\n\t\t\t\tplayers[i].Throws = int.Parse(arg[2]);\n\t\t\t}\n\n\n\t\t\tvar state = new GameState(players);\n\t\t\t\n\t\t\tSolve(state, players);\n\t\t\tConsole.WriteLine(AbsoluteMax);\n\t\t\t//Console.WriteLine(AbsoluteMaxStr);\n\t\t}\n\n\t\tstatic void Solve(GameState state, Player[] players)\n\t\t{\n\t\t\tstate.ClearTrace();\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tif (!TraceMin(state, state.GetPlayerStartNode(i)))\n\t\t\t\t\treturn;\n\t\t\t\tif (!TraceMax(state, state.GetPlayerStartNode(i)))\n\t\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!state.Validate())\n\t\t\t\treturn;\n\n\t\t\tif (EuristicGetMax(state, players) <= AbsoluteMax)\n\t\t\t\treturn;\n\n\t\t\tint max = state.Max;\n\t\t\tif (AbsoluteMax < max)\n\t\t\t{\n\t\t\t\tAbsoluteMax = max;\n\t\t\t\tAbsoluteMaxStr = state.ToString();\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tDoMove(i, state.Clone(), players);\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\tfor (int j = 0; j < 3; j++)\n\t\t\t\t\tif (i != j)\n\t\t\t\t\t{\n\t\t\t\t\t\tDoUp(i, j, state.Clone(), players);\n\t\t\t\t\t}\n\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tDoThrow(i, state.Clone(), players);\n\t\t\t}\n\t\t}\n\n\t\tstatic private void DoMove(int i, GameState state, Player[] players)\n\t\t{\n\t\t\tif (players[i].alreadyWalked || players[i].Up >= 0 || players[i].Upped)\n\t\t\t\treturn;\n\n\t\t\tplayers[i].alreadyWalked = true;\n\n\t\t\tExpressionNode a = state.GetPlayerNode(i);\n\t\t\tExpressionNode moved = state.AddPlayerNode(i);\n\n\t\t\tmoved.Comment = string.Format(\"M({0})\", i);\n\n\t\t\tstate.AddMin(moved, a, players[i].Walk);\n\t\t\tstate.AddMin(a, moved, players[i].Walk);\n\n\t\t\tNotEqual(players, i, state.Clone());\n\n\t\t\tplayers[i].alreadyWalked = false;\n\t\t}\n\n\t\tprivate static void DoThrow(int i, GameState state, Player[] players)\n\t\t{\n\t\t\tif (players[i].alreadyThrowed || players[i].Up < 0 || players[i].Upped)\n\t\t\t\treturn;\n\n\t\t\tplayers[i].alreadyThrowed = true;\n\n\t\t\tint j = players[i].Up;\n\t\t\tplayers[i].Up = -1;\n\t\t\tplayers[j].Upped = false;\n\n\t\t\tExpressionNode a = state.GetPlayerNode(i);\n\n\t\t\tExpressionNode moved = state.AddPlayerNode(j);\n\t\t\tmoved.Comment = string.Format(\"T({0}, {1})\", i, j);\n\n\t\t\tstate.AddMin(moved, a, players[i].Throws);\n\t\t\tstate.AddMin(a, moved, players[i].Throws);\n\n\t\t\tNotEqual(players, j, state.Clone());\n\n\t\t\tplayers[j].Upped = true;\n\t\t\tplayers[i].Up = j;\n\t\t\tplayers[i].alreadyThrowed = false;\n\t\t}\n\n\t\tprivate static void DoUp(int i, int j, GameState state, Player[] players)\n\t\t{\n\t\t\tif (players[i].alreadyUpped || players[i].Up >= 0 || players[i].Upped || players[j].Upped || i == j)\n\t\t\t\treturn;\n\n\t\t\tplayers[i].alreadyUpped = true;\n\t\t\tplayers[i].Up = j;\n\t\t\tplayers[j].Upped = true;\n\n\t\t\tExpressionNode a = state.GetPlayerNode(i);\n\t\t\tExpressionNode b = state.GetPlayerNode(j);\n\n\t\t\tExpressionNode moved = state.AddPlayerNode(j);\n\t\t\tmoved.Comment = string.Format(\"U({0}, {1})\", i, j);\n\n\t\t\tstate.AddMin(moved, a, 0);\n\t\t\tstate.AddMin(a, moved, 0);\n\n\t\t\tvar v1 = state.Clone();\n\t\t\tv1.AddMin(a, b, -1);\n\t\t\tv1.AddMin(b, a, 1);\n\t\t\tSolve(v1, players);\n\n\t\t\tvar v2 = state;\n\t\t\tv2.AddMin(a, b, 1);\n\t\t\tv2.AddMin(b, a, -1);\n\t\t\tSolve(v2.Clone(), players);\n\n\t\t\tplayers[j].Upped = false;\n\t\t\tplayers[i].Up = -1;\n\t\t\tplayers[i].alreadyUpped = false;\n\t\t}\n\n\t\tstatic private void NotEqual(Player[] players, int i, GameState state)\n\t\t{\n\t\t\tExpressionNode a = state.GetPlayerNode(i); //current \n\t\t\tExpressionNode b = state.GetPlayerNode((i + 1) % 3); //not equal to\n\t\t\tExpressionNode c = state.GetPlayerNode((i + 2) % 3); //and not equal to\n\n\t\t\tvar v1 = state.Clone();\n\t\t\tv1.AddMin(a, b, -1);\n\t\t\tv1.AddMin(a, c, -1);\n\t\t\tSolve(v1, players);\n\n\t\t\tvar v2 = state.Clone();\n\t\t\tv2.AddMin(b, a, -1);\n\t\t\tv2.AddMin(a, c, -1);\n\t\t\tSolve(v2, players);\n\n\t\t\tvar v3 = state.Clone();\n\t\t\tv3.AddMin(b, a, -1);\n\t\t\tv3.AddMin(c, a, -1);\n\t\t\tSolve(v3, players);\n\n\t\t\tvar v4 = state;\n\t\t\tv4.AddMin(a, b, -1);\n\t\t\tv4.AddMin(c, a, -1);\n\t\t\tSolve(v4, players);\n\t\t}\n\n\t\tstatic bool TraceMin(GameState state, ExpressionNode x)\n\t\t{\n\t\t\tx.Traced = true;\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tforeach (var vector in state.Maximize(x))\n\t\t\t\t{\n\t\t\t\t\t// x <= path.Max + path.Mark\n\n\t\t\t\t\tif (vector.Target.Traced)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (vector.Target.Min < x.Min - vector.Mark)\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif (vector.Target.Min < x.Min - vector.Mark)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvector.Target.Min = x.Min - vector.Mark;\n\t\t\t\t\t\t\tif (!TraceMin(state, vector.Target))\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tx.Traced = false;\n\t\t\t}\n\t\t}\n\n\t\tstatic bool TraceMax(GameState state, ExpressionNode x)\n\t\t{\n\t\t\tx.Traced = true;\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tforeach (var vector in state.Minimize(x))\n\t\t\t\t{\n\t\t\t\t\tif (vector.Target.Traced)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (vector.Target.Max > x.Max + vector.Mark)\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif (vector.Target.Max > x.Max + vector.Mark)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvector.Target.Max = x.Max + vector.Mark;\n\t\t\t\t\t\t\tif (!TraceMax(state, vector.Target))\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tx.Traced = false;\n\t\t\t}\n\t\t}\n\n\t\tstatic int EuristicGetMax(GameState state, Player[] players)\n\t\t{\n\t\t\tint radius = 0;\n\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tif (!players[i].alreadyThrowed)\n\t\t\t\t\tradius += players[i].Throws;\n\t\t\t\tif (!players[i].alreadyWalked)\n\t\t\t\t\tradius += players[i].Walk;\n\t\t\t\tif (!players[i].alreadyUpped)\n\t\t\t\t\tradius += 1;\n\t\t\t}\n\n\t\t\tvar result = Enumerable.Range(0,2).Max(i => state.GetPlayerNode(i).Max + radius);\n\t\t\treturn result;\n\t\t}\n\t}\n\n\n\t[Serializable]\n\tstruct Vector\n\t{\n\t\tpublic int Mark;\n\t\tpublic ExpressionNode Target;\n\n\t\tpublic Vector(int mark, ExpressionNode target)\n\t\t{\n\t\t\tMark = mark;\n\t\t\tTarget = target;\n\t\t}\n\t}\n\n\t//[DebuggerVisualizer(typeof(ExpressionBuilderVisualizer))]\n\t[Serializable]\n\tclass GameState\n\t{\n\t\tconst int MaxVariables = 20;\n\t\tconst int MaxDepth = 20;\n\n\t\tList nodes = new List();\n\t\tint[] playerNodes = new int[3];\n\n\t\tpublic List Nodes\n\t\t{\n\t\t\tget { return nodes; }\n\t\t}\n\n\t\tprivate GameState()\n\t\t{\n\t\t}\n\n\t\tpublic void ClearTrace()\n\t\t{\n\t\t\tfor (int i = 3; i < nodes.Count; i++)\n\t\t\t{\n\t\t\t\tnodes[i].Min = int.MinValue;\n\t\t\t\tnodes[i].Max = int.MaxValue;\n\t\t\t}\n\t\t}\n\n\t\tpublic GameState(Player[] players)\n\t\t{\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tnodes.Add(\n\t\t\t\t\tnew ExpressionNode()\n\t\t\t\t\t{\n\t\t\t\t\t\tId = i,\n\t\t\t\t\t\tMin = players[i].Start,\n\t\t\t\t\t\tMax = players[i].Start\n\t\t\t\t\t});\n\t\t\t\tplayerNodes[i] = i;\n\t\t\t}\n\t\t}\n\n\t\tpublic GameState Clone()\n\t\t{\n\t\t\tvar result = new GameState();\n\t\t\tresult.nodes = nodes.ConvertAll(x => x.Clone());\n\t\t\tresult.playerNodes = (int[])playerNodes.Clone();\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic int Max\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tint max = Int32.MinValue;\n\t\t\t\tforeach (var node in nodes)\n\t\t\t\t{\n\t\t\t\t\tif (max < node.Max)\n\t\t\t\t\t\tmax = node.Max;\n\t\t\t\t}\n\n\t\t\t\treturn max;\n\t\t\t}\n\t\t}\n\n\t\tpublic ExpressionNode AddPlayerNode(int i)\n\t\t{\n\t\t\tvar node = new ExpressionNode() { Id = nodes.Count };\n\t\t\tnodes.Add(node);\n\t\t\tplayerNodes[i] = node.Id;\n\t\t\treturn node;\n\t\t}\n\n\t\tpublic ExpressionNode GetPlayerNode(int i)\n\t\t{\n\t\t\treturn nodes[playerNodes[i]];\n\t\t}\n\n\t\tpublic ExpressionNode GetPlayerStartNode(int i)\n\t\t{\n\t\t\treturn nodes[i];\n\t\t}\n\n\t\t//a <= b + c\n\t\tpublic void AddMin(ExpressionNode a, ExpressionNode b, int c)\n\t\t{\n\t\t\tvar path = new ExpressionPath() { MinId = a.Id, MaxId = b.Id, Mark = c };\n\t\t\tnodes[a.Id].Maximize.Add(path);\n\t\t\tnodes[b.Id].Minimize.Add(path);\n\t\t}\n\n\t\tpublic IEnumerable Maximize(ExpressionNode a)\n\t\t{\n\t\t\treturn nodes[a.Id].Maximize.Select(path => new Vector(path.Mark, nodes[path.MaxId]));\n\t\t}\n\n\t\tpublic IEnumerable Minimize(ExpressionNode a)\n\t\t{\n\t\t\treturn nodes[a.Id].Minimize.Select(path => new Vector(path.Mark, nodes[path.MinId]));\n\t\t}\n\n\t\tpublic bool Validate()\n\t\t{\n\t\t\tforeach (var node in nodes)\n\t\t\t{\n\t\t\t\tif (node.Min > node.Max)\n\t\t\t\t\treturn false;\n\n\t\t\t\tif (node.Min == Int32.MinValue || node.Min == Int32.MaxValue)\n\t\t\t\t\tthrow new Exception();\n\t\t\t\tif (node.Max == Int32.MinValue || node.Max == Int32.MaxValue)\n\t\t\t\t\tthrow new Exception();\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\tstring result = \"\";\n\n\t\t\tforeach (var node in nodes)\n\t\t\t{\n\t\t\t\tresult += node.ToString();\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t[Serializable]\n\tinternal class Player\n\t{\n\t\tpublic int Start;\n\t\tpublic int Walk;\n\t\tpublic int Throws;\n\n\t\tpublic bool alreadyWalked = false;\n\t\tpublic bool alreadyUpped = false;\n\t\tpublic bool alreadyThrowed = false;\n\t\tpublic bool Upped = false;\n\t\tpublic int Up = -1;\n\n\t\tpublic Player Clone()\n\t\t{\n\t\t\tvar result = (Player)this.MemberwiseClone();\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t[Serializable]\n\tclass ExpressionNode\n\t{\n\t\tpublic int Id;\n\t\tpublic List Minimize = new List();\n\t\tpublic List Maximize = new List();\n\n\t\tpublic int Min = Int32.MinValue;\n\t\tpublic int Max = Int32.MaxValue;\n\n\t\tpublic bool Traced = false;\n\n\t\tpublic string Comment;\n\n\t\tpublic ExpressionNode Clone()\n\t\t{\n\t\t\tvar result = (ExpressionNode)this.MemberwiseClone();\n\t\t\tresult.Minimize = new List(Minimize);\n\t\t\tresult.Maximize = new List(Maximize);\n\t\t\tresult.Minimize = Minimize.ConvertAll(x => x);\n\t\t\tresult.Maximize = Maximize.ConvertAll(x => x);\n\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\treturn Comment + String.Format(\"[{0}:{1}]\", Min, Max);\n\t\t}\n\n\t}\n\n\t[Serializable]\n\t[ReadOnly(true)]\n\tstruct ExpressionPath\n\t{\n\t\tpublic int MaxId;\n\t\tpublic int MinId;\n\t\tpublic int Mark;\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\tvar result = String.Format(\"X{0} <= X{1}\", MinId, MaxId);\n\n\t\t\tif (Mark > 0)\n\t\t\t\tresult += string.Format(\" + {0}\", Mark);\n\t\t\telse if (Mark < 0)\n\t\t\t\tresult += string.Format(\" - {0}\", -Mark);\n\n\t\t\treturn result;\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1284df4ec2409247dc3f279380df4e05", "src_uid": "a14739b86d1fd62a030226263cdc1afc", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n//using DebugerVisualizer;\n\nnamespace _105\n{\n\n class Program\n {\n //static StreamReader inStream = new StreamReader(\"input.txt\");\n //static string ReadLine()\n //{\n // return inStream.ReadLine();\n //}\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n static int AbsoluteMax = int.MinValue;\n static string AbsoluteMaxStr = \"\";\n\n static void Main(string[] args)\n {\n Player[] players = new Player[3];\n for (int i = 0; i < 3; i++)\n {\n players[i] = new Player();\n string[] arg = ReadLine().Split();\n players[i].Start = int.Parse(arg[0]);\n players[i].Walk = int.Parse(arg[1]);\n players[i].Throws = int.Parse(arg[2]);\n players[i].StartNode = new ExpressionNode();\n players[i].StartNode.Comment = string.Format(\"S({0})\", i);\n }\n\n var builder = new ExpressionBuilder(Array.ConvertAll(players, x => x.StartNode));\n Solve(builder, Array.ConvertAll(players, x => x.StartNode), players);\n Console.WriteLine(AbsoluteMax);\n //Console.WriteLine(AbsoluteMaxStr);\n }\n\n static void Solve(ExpressionBuilder builder, ExpressionNode[] pNodes, Player[] players)\n {\n builder.ClearCalcs();\n\n for (int i = 0; i < 3; i++)\n players[i].StartNode.Min = players[i].StartNode.Max = players[i].Start;\n\n for (int i = 0; i < 3; i++)\n {\n if (!TraceMin(players[i].StartNode))\n return;\n if (!TraceMax(players[i].StartNode))\n return;\n }\n\n if (!builder.Validate())\n return;\n\n int max = builder.Max;\n if (AbsoluteMax < max)\n {\n AbsoluteMax = max;\n AbsoluteMaxStr = builder.ToString();\n }\n\n for (int i = 0; i < 3; i++)\n for (int j = 0; j < 3; j++)\n if (i != j)\n {\n DoUp(i, j, builder, pNodes, players);\n }\n\n for (int i = 0; i < 3; i++)\n {\n DoMove(i, builder, pNodes, players);\n }\n\n\n for (int i = 0; i < 3; i++)\n {\n DoThrow(i, builder, pNodes, players);\n }\n }\n\n static private void DoMove(int i, ExpressionBuilder builder, ExpressionNode[] pNodes, Player[] players)\n {\n if (players[i].alreadyWalked || players[i].Up >= 0 || players[i].Upped)\n return;\n\n players[i].alreadyWalked = true;\n\n ExpressionNode a = pNodes[i];\n\n builder.Start();\n\n ExpressionNode moved = builder.AddNode();\n pNodes[i] = moved;\n moved.Comment = string.Format(\"M({0})\", i);\n\n builder.AddMin(moved, a, players[i].Walk);\n builder.AddMin(a, moved, players[i].Walk);\n\n NotEqual(players, i, builder, pNodes);\n\n builder.Rollback();\n pNodes[i] = a;\n players[i].alreadyWalked = false;\n }\n\n private static void DoThrow(int i, ExpressionBuilder builder, ExpressionNode[] pNodes, Player[] players)\n {\n if (players[i].alreadyThrowed || players[i].Up < 0 || players[i].Upped)\n return;\n\n players[i].alreadyThrowed = true;\n\n int j = players[i].Up;\n players[i].Up = -1;\n players[j].Upped = false;\n\n ExpressionNode a = pNodes[i];\n ExpressionNode b = pNodes[j];\n\n builder.Start();\n\n ExpressionNode moved = builder.AddNode();\n pNodes[j] = moved;\n moved.Comment = string.Format(\"T({0}, {1})\", i, j);\n\n builder.AddMin(moved, a, players[i].Throws);\n builder.AddMin(a, moved, players[i].Throws);\n\n NotEqual(players, j, builder, pNodes);\n\n builder.Rollback();\n pNodes[j] = b;\n players[j].Upped = true;\n players[i].Up = j;\n players[i].alreadyThrowed = false;\n }\n\n private static void DoUp(int i, int j, ExpressionBuilder builder, ExpressionNode[] pNodes, Player[] players)\n {\n if (players[i].alreadyUpped || players[i].Up >= 0 || players[i].Upped || players[j].Upped || i == j)\n return;\n\n players[i].alreadyUpped = true;\n players[i].Up = j;\n players[j].Upped = true;\n\n ExpressionNode a = pNodes[i];\n ExpressionNode b = pNodes[j];\n\n builder.Start();\n\n ExpressionNode moved = builder.AddNode();\n pNodes[j] = moved;\n moved.Comment = string.Format(\"U({0}, {1})\", i, j);\n\n builder.AddMin(moved, a, 0);\n builder.AddMin(a, moved, 0);\n\n builder.Start();\n builder.AddMin(a, b, -1);\n builder.AddMin(b, a, 1);\n Solve(builder, pNodes, players);\n builder.Rollback();\n\n builder.Start();\n builder.AddMin(a, b, 1);\n builder.AddMin(b, a, -1);\n Solve(builder, pNodes, players);\n builder.Rollback();\n\n builder.Rollback();\n pNodes[j] = b;\n players[j].Upped = false;\n players[i].Up = -1;\n players[i].alreadyUpped = false;\n }\n\n static private void NotEqual(Player[] players, int i, ExpressionBuilder builder, ExpressionNode[] pNodes)\n {\n ExpressionNode a = pNodes[i]; //current \n ExpressionNode b = pNodes[(i + 1) % 3]; //not equal to\n ExpressionNode c = pNodes[(i + 2) % 3]; //and not equal to\n\n builder.Start();\n builder.AddMin(a, b, -1);\n builder.AddMin(a, c, -1);\n Solve(builder, pNodes, players);\n builder.Rollback();\n\n builder.Start();\n builder.AddMin(b, a, -1);\n builder.AddMin(a, c, -1);\n Solve(builder, pNodes, players);\n builder.Rollback();\n\n builder.Start();\n builder.AddMin(b, a, -1);\n builder.AddMin(c, a, -1);\n Solve(builder, pNodes, players);\n builder.Rollback();\n\n builder.Start();\n builder.AddMin(a, b, -1);\n builder.AddMin(c, a, -1);\n Solve(builder, pNodes, players);\n builder.Rollback();\n }\n\n static bool TraceMin(ExpressionNode x)\n {\n x.Traced = true;\n\n try\n {\n foreach (var path in x.Maximize)\n {\n // x <= path.Max + path.Mark\n\n if (path.Max.Traced)\n {\n if (path.Max.Min < x.Min - path.Mark)\n return false;\n }\n else\n {\n if (path.Max.Min < x.Min - path.Mark)\n {\n path.Max.Min = x.Min - path.Mark;\n if (!TraceMin(path.Max))\n return false;\n }\n }\n }\n return true;\n }\n finally\n {\n x.Traced = false;\n }\n }\n\n static bool TraceMax(ExpressionNode x)\n {\n x.Traced = true;\n\n try\n {\n foreach (var path in x.Minimize)\n {\n if (path.Min.Traced)\n {\n if (path.Min.Max > x.Max + path.Mark)\n return false;\n }\n else\n {\n if (path.Min.Max > x.Max + path.Mark)\n {\n path.Min.Max = x.Max + path.Mark;\n if (!TraceMax(path.Min))\n return false;\n }\n }\n }\n return true;\n }\n finally\n {\n x.Traced = false;\n }\n }\n }\n\n //[DebuggerVisualizer(typeof(ExpressionBuilderVisualizer))]\n [Serializable]\n class ExpressionBuilder\n {\n Stack actions = new Stack();\n Actions current = null;\n List nodes = new List();\n List paths = new List();\n\n public List Nodes\n {\n get { return nodes; }\n }\n\n public List Paths\n {\n get { return paths; }\n }\n \n public ExpressionBuilder(IEnumerable startNodes)\n {\n nodes.AddRange(startNodes);\n }\n\n public int Max\n {\n get\n {\n int max = Int32.MinValue;\n foreach (var node in nodes)\n {\n if (max < node.Max)\n max = node.Max;\n }\n\n return max;\n }\n }\n\n public ExpressionNode AddNode()\n {\n var node = new ExpressionNode();\n nodes.Add(node);\n current.Nodes.Add(node);\n return node;\n }\n\n //a <= b + c\n public void AddMin(ExpressionNode a, ExpressionNode b, int c)\n {\n var path = new ExpressionPath() { Min = a, Max = b, Mark = c };\n paths.Add(path);\n a.Maximize.Add(path);\n b.Minimize.Add(path);\n current.Paths.Add(path);\n }\n\n public void Start()\n {\n current = new Actions();\n actions.Push(current);\n }\n\n public void Rollback()\n {\n RollbackActions(current);\n actions.Pop();\n if (actions.Count > 0)\n current = actions.Peek();\n else\n current = null;\n }\n\n private void RollbackActions(Actions action)\n {\n //int nc = nodes.Count;\n //int pc = paths.Count;\n\n\n if (action.Paths.Count > 0)\n paths.RemoveRange(paths.Count - action.Paths.Count, action.Paths.Count);\n if (action.Nodes.Count > 0)\n nodes.RemoveRange(nodes.Count - action.Nodes.Count, action.Nodes.Count);\n\n //Debug.Assert(!paths.Exists(x => action.Paths.Contains(x)));\n //Debug.Assert(!nodes.Exists(x => action.Nodes.Contains(x)));\n\n //System.Diagnostics.Debug.Assert(paths.Count == pc - action.Paths.Count);\n //System.Diagnostics.Debug.Assert(nodes.Count == nc - action.Nodes.Count);\n\n foreach (var p in action.Paths)\n {\n p.Max.Minimize.Remove(p);\n p.Min.Maximize.Remove(p);\n }\n }\n\n public void ClearCalcs()\n {\n foreach (var node in nodes)\n {\n node.Min = Int32.MinValue;\n node.Max = Int32.MaxValue;\n node.Traced = false;\n }\n }\n\n public bool Validate()\n {\n foreach (var node in nodes)\n {\n if (node.Min > node.Max)\n return false;\n\n if (node.Min == Int32.MinValue || node.Min == Int32.MaxValue)\n throw new Exception();\n if (node.Max == Int32.MinValue || node.Max == Int32.MaxValue)\n throw new Exception();\n }\n\n return true;\n }\n\n public override string ToString()\n {\n string result = \"\";\n\n foreach (var node in nodes)\n {\n result += node.ToString();\n }\n\n result += \"{\";\n foreach (var path in paths)\n {\n result += String.Format(\"{0} <= {1} + {2}; \", path.Min, path.Max, path.Mark);\n }\n result += \"}\";\n\n return result;\n }\n }\n\n [Serializable]\n class Actions\n {\n public List Nodes = new List(10);\n public List Paths = new List(10);\n }\n\n [Serializable]\n internal class Player\n {\n public int Start;\n public int Walk;\n public int Throws;\n\n public bool alreadyWalked = false;\n public bool alreadyUpped = false;\n public bool alreadyThrowed = false;\n public bool Upped = false;\n public int Up = -1;\n public ExpressionNode StartNode;\n }\n\n [Serializable]\n class ExpressionNode\n {\n public List Minimize = new List(10);\n public List Maximize = new List(10);\n\n public int Min = Int32.MinValue;\n public int Max = Int32.MaxValue;\n\n public bool Traced = false;\n\n public string Comment;\n\n public override string ToString()\n {\n return Comment + String.Format(\"[{0}:{1}]\", Min, Max);\n }\n }\n\n [Serializable]\n internal class ExpressionPath\n {\n public ExpressionNode Max;\n public ExpressionNode Min;\n public int Mark;\n\n public override string ToString()\n {\n return String.Format(\"{0} <= {1} + {2}\", Min, Max, Mark);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6df185d3a01111c125900d0c61f6e70e", "src_uid": "a14739b86d1fd62a030226263cdc1afc", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 long maxK = 1000;\n long maxPrime = 2 * 1000000 + 10;\n int[] minDiv;\n List primes = new List();\n void solve()\n {\n getDiv();\n long a = nextLong();\n long b = nextLong();\n long k = nextLong();\n long res = get(b, k);\n res -= get(a - 1, k);\n println(res);\n\n }\n\n private void getDiv()\n {\n minDiv = new int[maxPrime];\n for (int i = 2; i < minDiv.Length; i++)\n minDiv[i] = i;\n for (int i = 2; i < minDiv.Length; i++)\n if (minDiv[i] == i)\n for (int j = 2 * i; j < minDiv.Length; j += i)\n if (minDiv[j] == j)\n minDiv[j] = i;\n }\n\n private long get(long n, long k)\n {\n if (n <= 0)\n return 0;\n if (!prime(k))\n return 0;\n long res=0;\n if (k >= maxK)\n {\n\n if (k <= n)\n res++;\n for (long x = k; x * k <= n; x++)\n if (minDiv[x] >= k)\n res++;\n return res;\n }\n else\n {\n for(int i=2;i();\n }\n return res;\n }\n\n private long rec(int at, long n)\n {\n if (at >= primes.Count)\n return 0;\n if (n < primes[at])\n return 0;\n long res = n / primes[at];\n res+=rec(at+1,n);\n res -= rec(at + 1, n / primes[at]);\n return res;\n \n }\n\n bool prime(long p)\n {\n for (int i = 2; i * i <= p; i++)\n if (p % i == 0)\n return false;\n return true;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a5f522465bf4f5b10f28a274e70fd973", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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\n void solve()\n {\n\n\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "01f56f84a8b442d85e28c586af8f83af", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "difficulty": 2400.0} {"lang": "Mono C#", "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\t\tprivate int MOD = 1000000007;\n\t\tprivate int n;\n\t\tprivate long m;\n\t\tprivate int k;\n\t\tprivate int[,] dp;\n\t\tprivate bool[,] was;\n\t\tprivate int[,] bin;\n\n\t\tint go( int pos, int k )\n\t\t{\n\t\t\tif ( pos == n )\n\t\t\t{\n\t\t\t\tif ( k == 0 ) return 1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif ( was[pos, k] )\n\t\t\t\treturn dp[pos, k];\n\t\t\tint res = go( pos + 1, k );\n\n\t\t\tfor ( int i = 1; i <= n && i <= k; ++i )\n\t\t\t{\n\t\t\t\tlong cnt = ( ( ( ( m - pos ) % n ) == 0 ? ( m - pos ) / n - 1 : ( m - pos ) / n ) + 1 ) % MOD;\n\t\t\t\tres += pow( bin[n, i], cnt );\n\t\t\t\tres %= MOD;\n\t\t\t}\n\n\t\t\twas[pos, k] = true;\n\t\t\treturn dp[pos, k] = res;\n\t\t}\n\n\t\tprivate int pow( int a, long b )\n\t\t{\n\t\t\tif ( b == 0 ) return 1;\n\t\t\tint tmp = pow( a, b / 2 );\n\t\t\ttmp = (int)( ( (long)tmp * tmp ) % MOD );\n\t\t\tif ( b % 2 == 1 )\n\t\t\t{\n\t\t\t\ttmp = (int)( ( (long)tmp * a ) % MOD );\n\t\t\t}\n\t\t\treturn tmp;\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tbin = new int[101, 101];\n\t\t\tfor ( int i = 0; i <= 100; ++i )\n\t\t\t{\n\t\t\t\tbin[i, 0] = bin[i, i] = 1;\n\t\t\t\tfor ( int j = 1; j < i; ++j ) bin[i, j] = ( bin[i - 1, j] + bin[i - 1, j - 1] ) % MOD;\n\t\t\t}\n\t\t\tn = NextInt();\n\t\t\tm = NextLong();\n\t\t\tk = NextInt();\n\t\t\tdp = new int[n, n * n + 1];\n\t\t\twas = new bool[n, n * n + 1];\n\t\t\tOut.WriteLine( go( 0, k ) );\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a35e104b22f94d3297b94559378c5bc", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0} {"lang": "Mono C#", "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\t\tprivate int MOD = 1000000007;\n\t\tprivate int n;\n\t\tprivate long m;\n\t\tprivate int k;\n\t\tprivate int[,] dp;\n\t\tprivate bool[,] was;\n\t\tprivate int[,] bin;\n\n\t\tint go( int pos, int k )\n\t\t{\n\t\t\tif ( pos == n )\n\t\t\t{\n\t\t\t\tif ( k == 0 ) return 1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif ( was[pos, k] )\n\t\t\t\treturn dp[pos, k];\n\t\t\tint res = go( pos + 1, k );\n\n\t\t\tfor ( int i = 1; i <= n && i <= k; ++i )\n\t\t\t{\n\t\t\t\tlong cnt = ( ( ( m - pos ) % n ) == 0 ? ( m - pos ) / n - 1 : ( m - pos ) / n ) + 1;\n\t\t\t\tres += pow( bin[n, i], cnt );\n\t\t\t\tres %= MOD;\n\t\t\t}\n\n\t\t\twas[pos, k] = true;\n\t\t\treturn dp[pos, k] = res;\n\t\t}\n\n\t\tprivate int pow( int a, long b )\n\t\t{\n\t\t\tif ( b == 0 ) return 1;\n\t\t\tint tmp = pow( a, b / 2 );\n\t\t\ttmp = (int)( ( (long)tmp * tmp ) % MOD );\n\t\t\tif ( b % 2 == 1 )\n\t\t\t{\n\t\t\t\ttmp = (int)( ( (long)tmp * a ) % MOD );\n\t\t\t}\n\t\t\treturn tmp;\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tbin = new int[101, 101];\n\t\t\tfor ( int i = 0; i <= 100; ++i )\n\t\t\t{\n\t\t\t\tbin[i, 0] = bin[i, i] = 1;\n\t\t\t\tfor ( int j = 1; j < i; ++j ) bin[i, j] = ( bin[i - 1, j] + bin[i - 1, j - 1] ) % MOD;\n\t\t\t}\n\t\t\tn = NextInt();\n\t\t\tm = NextLong();\n\t\t\tk = NextInt();\n\t\t\tdp = new int[n, n * n + 1];\n\t\t\twas = new bool[n, n * n + 1];\n\t\t\tOut.WriteLine( go( 0, k ) );\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b0a5bf168aa773e4413a80cdbc4efd9e", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\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 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\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 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 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 long n, m, k;\n Reader.ReadLong(out n, out m, out k);\n\n long mod = 1000000000 + 7;\n\n long[,] c = new long[n + 1,n + 1];\n for (int i = 0; i <= n; i++)\n {\n c[i, 0] = 1;\n }\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] = c[i - 1, j - 1] + c[i - 1, j];\n if (c[i,j] > mod)\n {\n c[i, j] -= mod;\n }\n }\n }\n\n long[] p0 = new long[n + 1];\n for (int i = 0; i <= n; i++)\n {\n p0[i] = Algebra.BinPower(c[n, i], m / n, mod);\n }\n\n long[] p1 = new long[n + 1];\n for (int i = 0; i <= n; i++)\n {\n p1[i] = (p0[i] * c[n, i]) % mod;\n }\n\n long[,] a = new long[n + 1,(n + 1) * (n + 1)];\n a[0, 0] = 1;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j <= k; j++)\n {\n if (a[i,j] > 0)\n {\n var full = i < m % n;\n for (int l = 0; l <= n; l++)\n {\n long p = full ? p1[l] : p0[l];\n a[i + 1, j + l] = (a[i + 1, j + l] + p * a[i, j]) % mod;\n }\n }\n }\n }\n\n Console.WriteLine(a[n,k]);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5e914c78a4ca7208a3c226edabfc3b9f", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0} {"lang": "Mono C#", "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\t\tprivate int MOD = 1000000007;\n\t\tprivate int n;\n\t\tprivate long m;\n\t\tprivate int k;\n\t\tprivate int[,] dp;\n\t\tprivate bool[,] was;\n\t\tprivate int[,] bin, pw;\n\n\t\tint go( int pos, int k )\n\t\t{\n\t\t\tif ( pos == n )\n\t\t\t{\n\t\t\t\tif ( k == 0 ) return 1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif ( was[pos, k] )\n\t\t\t\treturn dp[pos, k];\n\t\t\tint res = go( pos + 1, k );\n\n\t\t\tfor ( int i = 1; i <= n && i <= k; ++i )\n\t\t\t{\n\t\t\t\tint tmp = (int)( ( (long)pw[pos, i] * go( pos + 1, k - i ) ) % MOD );\n\t\t\t\tres += tmp;\n\t\t\t\tif ( res >= MOD ) res -= MOD;\n\t\t\t}\n\n\t\t\twas[pos, k] = true;\n\t\t\treturn dp[pos, k] = res;\n\t\t}\n\n\t\tprivate int pow( int a, long b )\n\t\t{\n\t\t\tif ( b == 0 ) return 1;\n\t\t\tint tmp = pow( a, b / 2 );\n\t\t\ttmp = (int)( ( (long)tmp * tmp ) % MOD );\n\t\t\tif ( b % 2 == 1 )\n\t\t\t{\n\t\t\t\ttmp = (int)( ( (long)tmp * a ) % MOD );\n\t\t\t}\n\t\t\treturn tmp;\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tn = NextInt();\n\t\t\tm = NextLong();\n\t\t\tk = NextInt();\n\n\t\t\tbin = new int[101, 101];\n\t\t\tfor ( int i = 0; i <= 100; ++i )\n\t\t\t{\n\t\t\t\tbin[i, 0] = bin[i, i] = 1;\n\t\t\t\tfor ( int j = 1; j < i; ++j ) bin[i, j] = ( bin[i - 1, j] + bin[i - 1, j - 1] ) % MOD;\n\t\t\t}\n\t\t\tpw = new int[101, 101];\n\t\t\tfor ( int pos = 0; pos < n; ++pos )\n\t\t\t{\n\t\t\t\tlong cnt = ( ( ( m - pos ) % n ) == 0 ? ( m - pos ) / n - 1 : ( m - pos ) / n ) + 1;\n\t\t\t\tfor ( int i = 1; i <= n; ++i )\n\t\t\t\t{\n\t\t\t\t\tpw[pos, i] = pow( bin[n, i], cnt );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdp = new int[n, n * n + 1];\n\t\t\twas = new bool[n, n * n + 1];\n\t\t\tOut.WriteLine( go( 0, k ) );\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "21cc58a40e545c161a5e0efae306b982", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7024d52946e3de68ef6efdf704b03593", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0} {"lang": "Mono C#", "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 } else if (i % 2 != 0 && dp[i, cnt50, cnt100] != 0) {\n Console.WriteLine(i);\n Console.WriteLine(dp[i, cnt50, cnt100]);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "116a3f63670427ecc01af0ee3355f3a7", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1764034d37bd29314639e86d5ca04def", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e473e5bf6852b9a274fb56a702f26249", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0} {"lang": "Mono C#", "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 } else if (i % 2 != 0 && dp[i, cnt50, cnt100] != 0) {\n Console.WriteLine(i);\n Console.WriteLine(dp[i, cnt50, cnt100])\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4657b074842e8d0c67900ea189ad1794", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces_Round_279\n{\n class Program\n {\n static int nextint()\n {\n int a;\n a = int.Parse(Console.ReadLine());\n return a;\n }\n static string[] nextints()\n {\n string[] s = Console.ReadLine().Split();\n return s;\n }\n static bool[] left = new bool[1000010];\n static bool[] right = new bool[1000010];\n static bool checkever(long a, long b)\n {\n while (a % 3 == 0) a /= 3;\n while (a % 2 == 0) a /= 2;\n while (b % 3 == 0) b /= 3;\n while (b % 2 == 0) b /= 2;\n return a == b;\n }\n static void Main(string[] args)\n {\n int a, b, c, d;\n \n long first;\n long second;\n string[] arg = nextints();\n a = int.Parse(arg[0]);\n b = int.Parse(arg[1]);\n first = long.Parse(arg[0]) * long.Parse(arg[1]);\n arg=nextints();\n c = int.Parse(arg[0]);\n d = int.Parse(arg[1]);\n second = long.Parse(arg[0]) * long.Parse(arg[1]);\n if(!checkever(first,second)) \n {\n Console.WriteLine(-1);\n return;\n }\n long ff=first;\n long ss=second;\n int num13 = 0;\n int num12 = 0;\n int num23 = 0;\n int num22 = 0;\n int div12 = 0;\n int div13 = 0;\n int div22 = 0;\n int div23 = 0;\n while (first % 3 == 0)\n {\n first /= 3;\n num13++;\n }\n first = ff;\n while (first % 2 == 0) \n { first /= 2; num12++; }\n while (second % 3 == 0)\n {\n second /= 3;\n num23++;\n }\n second = ss;\n int ans = 0;\n while (second % 2 == 0)\n {\n second /= 2;\n num22++;\n }\n //Console.WriteLine(\"Broj dvojki u prvom:\" + num12);\n //Console.WriteLine(\"Broj trojki u prvom:\" + num13);\n //Console.WriteLine(\"Broj dvojki u drugom:\" + num22);\n //Console.WriteLine(\"Broj trojki u drugom:\" + num23);\n if (num13 > num23)\n {\n div13 = num13 - num23;\n num12 += div13;\n if (num12 > num22)\n {\n div12 = num12 - num22;\n }\n else\n {\n div22 = num22 - num12;\n }\n }\n else\n {\n div23 = num23 - num13;\n num22 += div23;\n if (num12 > num22)\n {\n div12 = num12 - num22;\n }\n else\n {\n div22 = num22 - num12;\n } \n }\n for (int i = 0; i < div13; i++)\n if (a % 3 == 0) { a /= 3; a *= 2; }\n else { b /= 3; b *= 3; }\n for (int i = 0; i < div12; i++)\n if (a % 2 == 0) a /= 2;\n else b /= 2;\n for (int i = 0; i < div23; i++)\n if (c % 3 == 0) { c /= 3; c *= 2; }\n else { d /= 3; d *= 3; }\n for (int i = 0; i < div22; i++)\n if (c % 2 == 0) c /= 2;\n else d /= 2;\n Console.WriteLine(div12 + div13 + div22 + div23);\n Console.WriteLine(a+\" \"+b);\n Console.WriteLine(c + \" \" + d);\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3180726f0b9eab9382e68f5bedeed644", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces_Round_279\n{\n class Program\n {\n static int nextint()\n {\n int a;\n a = int.Parse(Console.ReadLine());\n return a;\n }\n static string[] nextints()\n {\n string[] s = Console.ReadLine().Split();\n return s;\n }\n static bool[] left = new bool[1000010];\n static bool[] right = new bool[1000010];\n static bool checkever(long a, long b)\n {\n while (a % 3 == 0) a /= 3;\n while (a % 2 == 0) a /= 2;\n while (b % 3 == 0) b /= 3;\n while (b % 2 == 0) b /= 2;\n return a == b;\n }\n static void Main(string[] args)\n {\n int a, b, c, d;\n \n long first;\n long second;\n string[] arg = nextints();\n a = int.Parse(arg[0]);\n b = int.Parse(arg[1]);\n first = long.Parse(arg[0]) * long.Parse(arg[1]);\n arg=nextints();\n c = int.Parse(arg[0]);\n d = int.Parse(arg[1]);\n second = long.Parse(arg[0]) * long.Parse(arg[1]);\n /*if(!checkever(first,second)) \n {\n Console.WriteLine(-1);\n return;\n }*/\n long ff=first;\n long ss=second;\n int num13 = 0;\n int num12 = 0;\n int num23 = 0;\n int num22 = 0;\n int div12 = 0;\n int div13 = 0;\n int div22 = 0;\n int div23 = 0;\n while (first % 3 == 0)\n {\n first /= 3;\n num13++;\n }\n first = ff;\n while (first % 2 == 0) \n { first /= 2; num12++; }\n while (second % 3 == 0)\n {\n second /= 3;\n num23++;\n }\n second = ss;\n int ans = 0;\n while (second % 2 == 0)\n {\n second /= 2;\n num22++;\n }\n //Console.WriteLine(\"Broj dvojki u prvom:\" + num12);\n //Console.WriteLine(\"Broj trojki u prvom:\" + num13);\n //Console.WriteLine(\"Broj dvojki u drugom:\" + num22);\n //Console.WriteLine(\"Broj trojki u drugom:\" + num23);\n if (num13 > num23)\n {\n div13 = num13 - num23;\n num12 += div13;\n if (num12 > num22)\n {\n div12 = num12 - num22;\n }\n else\n {\n div22 = num22 - num12;\n }\n }\n else\n {\n div23 = num23 - num13;\n num22 += div23;\n if (num12 > num22)\n {\n div12 = num12 - num22;\n }\n else\n {\n div22 = num22 - num12;\n } \n }\n for (int i = 0; i < div13; i++)\n if (a % 3 == 0) { a /= 3; a *= 2; }\n else { b /= 3; b *= 3; }\n for (int i = 0; i < div12; i++)\n if (a % 2 == 0) a /= 2;\n else b /= 2;\n for (int i = 0; i < div23; i++)\n if (c % 3 == 0) { c /= 3; c *= 2; }\n else { d /= 3; d *= 3; }\n for (int i = 0; i < div22; i++)\n if (c % 2 == 0) c /= 2;\n else d /= 2;\n long res1 = Convert.ToInt64(a) * Convert.ToInt64(b);\n long res2 = Convert.ToInt64(c) * Convert.ToInt64(d);\n if (res1 != res2) { Console.WriteLine(-1); return; }\n Console.WriteLine(div12 + div13 + div22 + div23);\n Console.WriteLine(a+\" \"+b);\n Console.WriteLine(c + \" \" + d);\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fe910ec2e4c7b14a8bcd773309ceb848", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces_Round_279\n{\n class Program\n {\n static int nextint()\n {\n int a;\n a = int.Parse(Console.ReadLine());\n return a;\n }\n static string[] nextints()\n {\n string[] s = Console.ReadLine().Split();\n return s;\n }\n static bool[] left = new bool[1000010];\n static bool[] right = new bool[1000010];\n static bool checkever(long a, long b)\n {\n while (a % 3 == 0) a /= 3;\n while (a % 2 == 0) a /= 2;\n while (b % 3 == 0) b /= 3;\n while (b % 2 == 0) b /= 2;\n return a == b;\n }\n static void Main(string[] args)\n {\n int a, b, c, d;\n\n long first;\n long second;\n string[] arg = nextints();\n a = int.Parse(arg[0]);\n b = int.Parse(arg[1]);\n first = long.Parse(arg[0]) * long.Parse(arg[1]);\n arg = nextints();\n c = int.Parse(arg[0]);\n d = int.Parse(arg[1]);\n second = long.Parse(arg[0]) * long.Parse(arg[1]);\n if (!checkever(first, second))\n {\n Console.WriteLine(-1);\n return;\n }\n long ff = first;\n long ss = second;\n int num13 = 0;\n int num12 = 0;\n int num23 = 0;\n int num22 = 0;\n int div12 = 0;\n int div13 = 0;\n int div22 = 0;\n int div23 = 0;\n while (first % 3 == 0)\n {\n first /= 3;\n num13++;\n }\n first = ff;\n while (first % 2 == 0)\n { first /= 2; num12++; }\n while (second % 3 == 0)\n {\n second /= 3;\n num23++;\n }\n second = ss;\n int ans = 0;\n while (second % 2 == 0)\n {\n second /= 2;\n num22++;\n }\n //Console.WriteLine(\"Broj dvojki u prvom:\" + num12);\n //Console.WriteLine(\"Broj trojki u prvom:\" + num13);\n //Console.WriteLine(\"Broj dvojki u drugom:\" + num22);\n //Console.WriteLine(\"Broj trojki u drugom:\" + num23);\n if (num13 > num23)\n {\n div13 = num13 - num23;\n num12 += div13;\n if (num12 > num22)\n {\n div12 = num12 - num22;\n }\n else\n {\n div22 = num22 - num12;\n }\n }\n else\n {\n div23 = num23 - num13;\n num22 += div23;\n if (num12 > num22)\n {\n div12 = num12 - num22;\n }\n else\n {\n div22 = num22 - num12;\n }\n }\n for (int i = 0; i < div13; i++)\n if (a % 3 == 0) { a /= 3; a *= 2; }\n else { b /= 3; b *= 3; }\n for (int i = 0; i < div12; i++)\n if (a % 2 == 0) a /= 2;\n else b /= 2;\n for (int i = 0; i < div23; i++)\n if (c % 3 == 0) { c /= 3; c *= 2; }\n else { d /= 3; d *= 2; }\n for (int i = 0; i < div22; i++)\n if (c % 2 == 0) c /= 2;\n else d /= 2;\n //Console.WriteLine(div12 + \" \" + div13 + \" \" + div22 + \" \" + div23);\n Console.WriteLine(div12 + div13 + div22 + div23);\n Console.WriteLine(a + \" \" + b);\n Console.WriteLine(c + \" \" + d);\n //Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b3f1122e244b527d851725bfd83a3657", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "MS C#", "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 a = sc.Long(4);\n var b = new long[4, 3];\n for (int i = 0; i < 4; i++)\n {\n var v = a[i];\n while (v % 2 == 0)\n {\n b[i, 1]++;\n v /= 2;\n }\n while (v % 3 == 0)\n {\n b[i, 2]++;\n v /= 3;\n }\n b[i, 0] = (int)v;\n }\n if (b[0, 0] * b[1, 0] != b[2, 0] * b[3, 0])\n {\n IO.Printer.Out.WriteLine(-1);\n return;\n }\n long ans=0;\n var three = Math.Min(b[0, 2] + b[1, 2], b[2, 2] + b[3, 2]);\n for (int i = 0; i < 4; i += 2)\n {\n var p = b[i, 2];\n var q = b[i + 1, 2];\n var diff = Math.Abs(p + q - three);\n if (p >= diff)\n {\n b[i, 2] -= diff;\n b[i, 1] += diff;\n }\n else\n {\n b[i, 2] = 0;\n b[i, 1] += p;\n b[i + 1, 2] -= diff - p;\n b[i + 1, 1] += diff - p;\n }\n ans+=diff;\n\n }\n var two = Math.Min(b[0, 1] + b[1, 1], b[2, 1] + b[3, 1]);\n for (int i = 0; i < 4; i += 2)\n {\n var p = b[i, 1];\n var q = b[i + 1, 1];\n var diff = Math.Abs(p + q - two);\n if (p >= diff)\n b[i, 1] -= diff;\n else\n {\n b[i, 1] = 0;\n b[i + 1, 1] -= diff - p;\n }\n ans+=diff;\n\n }\n \n var c = new long[30];\n var d = new long[30];\n c[0] =d[0]= 1;\n for (int i = 1; i < 30; i++)\n {\n c[i] = c[i - 1] * 2;\n d[i] = d[i - 1] * 3;\n }\n\n var res = new long[4];\n for (int i = 0; i < 4; i++)\n {\n res[i] = b[i, 0] * c[b[i, 1]] * d[b[i, 2]];\n }\n IO.Printer.Out.WriteLine(ans);\n IO.Printer.Out.WriteLine(\"{0} {1}\",res[0],res[1]);\n IO.Printer.Out.WriteLine(\"{0} {1}\",res[2],res[3]);\n\n\n }\n struct State\n {\n public long[] a;\n public int t;\n public State(int q, params long[] ar)\n : this()\n {\n a = ar;\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#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.OpenStandardOutput()) { AutoFlush = false };\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ee54e3c2bbd0351db9b894a83ebbfee1", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "MS C#", "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 class Heap\n {\n private readonly List data;\n private readonly Comparison compare;\n\n public Heap(Comparison compare)\n {\n this.compare = compare;\n data = new List { default(T) };\n }\n\n public int Count\n {\n get { return data.Count - 1; }\n }\n\n public T Peek()\n {\n return data[1];\n }\n\n public void Push(T item)\n {\n data.Add(item);\n var curPlace = Count;\n while (curPlace > 1 && compare(item, data[curPlace / 2]) < 0)\n {\n data[curPlace] = data[curPlace / 2];\n data[curPlace / 2] = item;\n curPlace /= 2;\n }\n }\n\n public T Pop()\n {\n var ret = data[1];\n data[1] = data[Count];\n data.RemoveAt(Count);\n var curPlace = 1;\n while (true)\n {\n var max = curPlace;\n if (Count >= curPlace * 2 && compare(data[max], data[2 * curPlace]) > 0)\n max = 2 * curPlace;\n if (Count >= curPlace * 2 + 1 && compare(data[max], data[2 * curPlace + 1]) > 0)\n max = 2 * curPlace + 1;\n if (max == curPlace)\n break;\n var item = data[max];\n data[max] = data[curPlace];\n data[curPlace] = item;\n curPlace = max;\n }\n\n return ret;\n }\n }\n\n Dictionary> Dijkstra(int a, int b)\n {\n var dist = new Dictionary, int>();\n var q = new Heap>((t1, t2) => t1.Item1.CompareTo(t2.Item1));\n dist[Tuple.Create(a, b)] = 0;\n q.Push(Tuple.Create(0, a, b));\n while (q.Count > 0)\n {\n var t = q.Pop();\n if (dist[Tuple.Create(t.Item2, t.Item3)] < t.Item1)\n continue;\n if (t.Item2 % 3 == 0)\n {\n int nd = t.Item1 + 1;\n var key = Tuple.Create(t.Item2 / 3 * 2, t.Item3);\n if (!dist.ContainsKey(key) || dist[key] > nd)\n {\n dist[key] = nd;\n q.Push(Tuple.Create(nd, t.Item2 / 3 * 2, t.Item3));\n }\n }\n if (t.Item2 % 2 == 0)\n {\n int nd = t.Item1 + 1;\n var key = Tuple.Create(t.Item2 / 2, t.Item3);\n if (!dist.ContainsKey(key) || dist[key] > nd)\n {\n dist[key] = nd;\n q.Push(Tuple.Create(nd, t.Item2 / 2, t.Item3));\n }\n }\n if (t.Item3 % 3 == 0)\n {\n int nd = t.Item1 + 1;\n var key = Tuple.Create(t.Item2, t.Item3 / 3 * 2);\n if (!dist.ContainsKey(key) || dist[key] > nd)\n {\n dist[key] = nd;\n q.Push(Tuple.Create(nd, t.Item2, t.Item3 / 3 * 2));\n }\n }\n if (t.Item3 % 2 == 0)\n {\n int nd = t.Item1 + 1;\n var key = Tuple.Create(t.Item2, t.Item3 / 2);\n if (!dist.ContainsKey(key) || dist[key] > nd)\n {\n dist[key] = nd;\n q.Push(Tuple.Create(nd, t.Item2, t.Item3 / 2));\n }\n }\n }\n\n Dictionary> ret = new Dictionary>();\n foreach (var p in dist)\n {\n long key = 1L * p.Key.Item1 * p.Key.Item2;\n if (!ret.ContainsKey(key) || ret[key].Item1 > p.Value)\n ret[key] = Tuple.Create(p.Value, p.Key.Item1, p.Key.Item2);\n }\n return ret;\n }\n\n public object Solve()\n {\n int a1 = ReadInt();\n int b1 = ReadInt();\n int a2 = ReadInt();\n int b2 = ReadInt();\n\n var d1 = Dijkstra(a1, b1);\n var d2 = Dijkstra(a2, b2);\n\n var min = int.MaxValue;\n Tuple ans1 = null;\n Tuple ans2 = null;\n foreach (var p in d1)\n {\n if (d2.ContainsKey(p.Key) && p.Value.Item1 + d2[p.Key].Item1 < min)\n {\n min = p.Value.Item1 + d2[p.Key].Item1;\n ans1 = Tuple.Create(p.Value.Item2, p.Value.Item3);\n ans2 = Tuple.Create(d2[p.Key].Item2, d2[p.Key].Item3);\n }\n }\n\n if (min == int.MaxValue)\n return -1;\n\n Write(min);\n Write(ans1.Item1, ans1.Item2);\n Write(ans2.Item1, ans2.Item2);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "038a80a78476a0fea9fc596359d900f4", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces_Round_279\n{\n class Program\n {\n static int nextint()\n {\n int a;\n a = int.Parse(Console.ReadLine());\n return a;\n }\n static string[] nextints()\n {\n string[] s = Console.ReadLine().Split();\n return s;\n }\n static bool[] left = new bool[1000010];\n static bool[] right = new bool[1000010];\n static bool checkever(long a, long b)\n {\n while (a % 3 == 0) a /= 3;\n while (a % 2 == 0) a /= 2;\n while (b % 3 == 0) b /= 3;\n while (b % 2 == 0) b /= 2;\n return a == b;\n }\n static void Main(string[] args)\n {\n int a, b, c, d;\n\n long first;\n long second;\n string[] arg = nextints();\n a = int.Parse(arg[0]);\n b = int.Parse(arg[1]);\n first = long.Parse(arg[0]) * long.Parse(arg[1]);\n arg = nextints();\n c = int.Parse(arg[0]);\n d = int.Parse(arg[1]);\n second = long.Parse(arg[0]) * long.Parse(arg[1]);\n if (!checkever(first, second))\n {\n Console.WriteLine(-1);\n return;\n }\n long ff = first;\n long ss = second;\n int num13 = 0;\n int num12 = 0;\n int num23 = 0;\n int num22 = 0;\n int div12 = 0;\n int div13 = 0;\n int div22 = 0;\n int div23 = 0;\n while (first % 3 == 0)\n {\n first /= 3;\n num13++;\n }\n first = ff;\n while (first % 2 == 0)\n { first /= 2; num12++; }\n while (second % 3 == 0)\n {\n second /= 3;\n num23++;\n }\n second = ss;\n int ans = 0;\n while (second % 2 == 0)\n {\n second /= 2;\n num22++;\n }\n //Console.WriteLine(\"Broj dvojki u prvom:\" + num12);\n //Console.WriteLine(\"Broj trojki u prvom:\" + num13);\n //Console.WriteLine(\"Broj dvojki u drugom:\" + num22);\n //Console.WriteLine(\"Broj trojki u drugom:\" + num23);\n if (num13 > num23)\n {\n div13 = num13 - num23;\n num12 += div13;\n if (num12 > num22)\n {\n div12 = num12 - num22;\n }\n else\n {\n div22 = num22 - num12;\n }\n }\n else\n {\n div23 = num23 - num13;\n num22 += div23;\n if (num12 > num22)\n {\n div12 = num12 - num22;\n }\n else\n {\n div22 = num22 - num12;\n }\n }\n for (int i = 0; i < div13; i++)\n if (a % 3 == 0) { a /= 3; a *= 2; }\n else { b /= 3; b *= 2; }\n for (int i = 0; i < div12; i++)\n if (a % 2 == 0) a /= 2;\n else b /= 2;\n for (int i = 0; i < div23; i++)\n if (c % 3 == 0) { c /= 3; c *= 2; }\n else { d /= 3; d *= 2; }\n for (int i = 0; i < div22; i++)\n if (c % 2 == 0) c /= 2;\n else d /= 2;\n //Console.WriteLine(div12 + \" \" + div13 + \" \" + div22 + \" \" + div23);\n Console.WriteLine(div12 + div13 + div22 + div23);\n Console.WriteLine(a + \" \" + b);\n Console.WriteLine(c + \" \" + d);\n //Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "34c8e1a1bacd662db2e17f7282186523", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Chocolate\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 a1 = Next();\n int b1 = Next();\n int a2 = Next();\n int b2 = Next();\n\n var m = new[]\n {\n new[] {GD(a1, 2), GD(b1, 2)},\n new[] {GD(a1, 3), GD(b1, 3)},\n new[] {GD(a2, 2), GD(b2, 2)},\n new[] {GD(a2, 3), GD(b2, 3)},\n };\n\n var l1 = new List(GD(a1));\n l1.AddRange(GD(b1));\n l1.Sort();\n\n var l2 = new List(GD(a2));\n l2.AddRange(GD(b2));\n l2.Sort();\n\n if (l1.Count != l2.Count)\n {\n writer.WriteLine(\"-1\");\n }\n else\n {\n for (int i = 0; i < l1.Count; i++)\n {\n if (l1[i] != l2[i])\n {\n writer.WriteLine(\"-1\");\n writer.Flush();\n return;\n }\n }\n\n int count = 0;\n while (m[1].Sum() != m[3].Sum())\n {\n count++;\n if (m[1].Sum() > m[3].Sum())\n {\n if (m[1][0] > 0)\n {\n m[0][0]++;\n m[1][0]--;\n a1 /= 3;\n a1 *= 2;\n }\n else\n {\n m[0][1]++;\n m[1][1]--;\n b1 /= 3;\n b1 *= 2;\n }\n }\n else\n {\n if (m[3][0] > 0)\n {\n m[2][0]++;\n m[3][0]--;\n a2 /= 3;\n a2 *= 2;\n }\n else\n {\n m[2][1]++;\n m[3][1]--;\n b2 /= 3;\n b2 *= 2;\n }\n }\n }\n while (m[0].Sum() != m[2].Sum())\n {\n count++;\n if (m[0].Sum() > m[2].Sum())\n {\n if (m[0][0] > 0)\n {\n m[0][0]--;\n a1 /= 2;\n }\n else\n {\n m[0][1]--;\n b1 /= 2;\n }\n }\n else\n {\n if (m[2][0] > 0)\n {\n m[2][0]--;\n a2 /= 2;\n }\n else\n {\n m[2][1]--;\n b2 /= 2;\n }\n }\n }\n\n writer.WriteLine(count);\n writer.Write(a1);\n writer.Write(' ');\n writer.WriteLine(b1);\n writer.Write(a2);\n writer.Write(' ');\n writer.WriteLine(b2);\n }\n\n writer.Flush();\n }\n\n private static IEnumerable GD(int n)\n {\n while (n%2 == 0)\n {\n n /= 2;\n }\n while (n%3 == 0)\n {\n n /= 3;\n }\n for (int i = 5; i*i <= n; i += 2)\n {\n while (n%i == 0)\n {\n yield return i;\n n /= i;\n }\n }\n if (n != 1)\n yield return n;\n }\n\n private static int GD(int n, int d)\n {\n for (int i = 0;; i++)\n {\n if (n%d == 0)\n n /= d;\n else\n {\n return 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1f9c7e24920eb1383e5448b82ecf02c5", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "Mono C#", "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 data = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = data[0];\n var k = data[1];\n var line = Console.ReadLine();\n var strings = new HashSet();\n \n var sb = new StringBuilder();\n var q = new Queue();\n q.Enqueue(line);\n while (strings.Count < k && q.Count > 0)\n {\n var current = q.Dequeue(); \n strings.Add(current);\n for (int i = 0; i < current.Length; i++)\n {\n sb.Clear();\n for (int j = 0; j < current.Length; j++)\n {\n if(j == i)\n continue;\n sb.Append(current[j]);\n }\n\n var otherString = sb.ToString();\n if (strings.Add(otherString)) \n q.Enqueue(otherString);\n if(strings.Count == k)\n break;\n }\n }\n\n if (strings.Count != k)\n {\n Console.WriteLine(-1);\n return;\n }\n\n var res = k*n - strings.Sum(x => x.Length);\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4cbc72c9cd051159bc7f4293d3d9eb4c", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n int N;\n long K;\n string S;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n K = sc.NextLong();\n S = sc.Next();\n\n\n // i\u307e\u3067\u898b\u305f\u3001\u30b9\u30ad\u30c3\u30d7j\u500b \u6700\u5f8c\u6587\u5b57\n var dp = new long[N + 1, N + 1, 27];\n dp[0, 0, 26] = 1;\n for (int i = 0; i < N; i++)\n {\n for (int j = 0; j <= i; j++)\n {\n\n for (int c = 0; c <= 26; c++)\n {\n // s_i\u3092\u4f7f\u3046\n dp[i + 1, j, S[i] - 'a'] += dp[i, j, c];\n\n\n // \u4f7f\u308f\u306a\u3044\n if (S[i] - 'a' != c) dp[i + 1, j + 1, c] += dp[i, j, c];\n }\n }\n }\n\n long[] cnt = new long[N + 1];\n for (int i = 0; i <= N; i++)\n {\n for (int c = 0; c <= 26; c++)\n {\n cnt[i] += dp[N, i, c];\n }\n }\n\n long ans = 0;\n for (int i = 0; i <= N && K > 0; i++)\n {\n // Console.WriteLine($\"{i} {cnt[i]} {K}\");\n if (cnt[i] < K)\n {\n ans += cnt[i] * i;\n K -= cnt[i];\n }\n else\n {\n ans += i * K;\n K = 0;\n }\n }\n\n if (K > 0)\n {\n Console.WriteLine(\"-1\");\n return;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d486d1771150eb95fa42cc5b1516b693", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Trenya260619\n{\n class Input\n {\n private static IEnumerator _getinput()\n {\n while (true)\n foreach (string s in Console.ReadLine().Split().Where(x => x.Length > 0))\n yield return s;\n }\n\n private IEnumerator input = _getinput();\n\n public string GetString()\n {\n input.MoveNext();\n return input.Current;\n }\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 long k = csin.GetLong();\n List s = csin.GetString().Select(x => (int)(x - 'a')).ToList();\n s.Add(26);\n\n long[,] d = new long[n + 1, n + 1]; // i - length, j - first index\n\n d[0, n] = 1;\n\n bool[] ex = new bool[27];\n\n for (int len = 1; len <= n; len++)\n for (int start = 0; start < n; start++)\n {\n for (int i = 0; i < 27; i++) ex[i] = false;\n\n for (int j = start + 1; j <= n; j++)\n {\n if (ex[s[j]]) continue;\n ex[s[j]] = true;\n d[len, start] += d[len - 1, j];\n }\n }\n\n\n long[] lenans = new long[n + 1];\n for (int i = 0; i <= n; i++)\n {\n for (int j = 0; j < 27; j++) ex[j] = false;\n\n for (int j = 0; j <= n; j++)\n {\n if (ex[s[j]]) continue;\n\n lenans[i] += d[i, j];\n ex[s[j]] = true;\n }\n }\n\n long ans = 0;\n\n for (int i = n; i >= 0 && k > 0; i--)\n {\n long curr = Math.Min(k, lenans[i]);\n k -= curr;\n ans += curr * (n - i);\n }\n\n if (k > 0) ans = -1;\n\n\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "62bfb1d537514bfc4ca62f9895d4aaf4", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 1900.0} {"lang": "Mono C#", "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\tHashSet h = new HashSet();\n\t\th.Add(\"\");\n\t\tfor(int i=0;i();\n\t\t\tforeach(var s in h){\n\t\t\t\tnh.Add(s);\n\t\t\t\tnh.Add(s + t);\n\t\t\t}\n\t\t\tvar l = nh.ToList();\n\t\t\tl.Sort((a, b) => -1 * (a.Length.CompareTo(b.Length)));\n\t\t\th = new HashSet();\n\t\t\tfor(int j=0;jint.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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "80faf90909bbd7f43dc805f5de901120", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 2000.0} {"lang": "Mono C#", "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 data = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = data[0];\n var k = data[1];\n var line = Console.ReadLine();\n var strings = new HashSet();\n \n var sb = new StringBuilder();\n var q = new Queue();\n q.Enqueue(line);\n while (strings.Count < k && q.Count > 0)\n {\n var current = q.Dequeue(); \n strings.Add(current);\n if (strings.Count == k)\n break;\n for (int i = 0; i < current.Length; i++)\n {\n sb.Clear();\n for (int j = 0; j < current.Length; j++)\n {\n if(j == i)\n continue;\n sb.Append(current[j]);\n }\n\n var otherString = sb.ToString();\n if (strings.Add(otherString)) \n q.Enqueue(otherString);\n if(strings.Count == k)\n break;\n }\n }\n\n if (strings.Count != k)\n {\n Console.WriteLine(-1);\n return;\n }\n\n var res = k*n - strings.Sum(x => x.Length);\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4f379b8886fda5efa520473f03addbaf", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n int N, K;\n string S;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n K = sc.NextInt();\n S = sc.Next();\n\n /*\n * S\u306e\u90e8\u5206\u5217t\u3092\u53d6\u308b\u96c6\u5408\u306b\u52a0\u3048\u308b\n * \u30b3\u30b9\u30c8 n-|t|\n * \u91cd\u8907\u4e0d\u53ef\n * \n * \u30b5\u30a4\u30bak\u306e\u96c6\u5408\u3064\u304f\u308b\u6700\u5c0f\u30b3\u30b9\u30c8\n */\n\n /*\n * t = s 1\u500b\n * \n * |t| = |s|-1 N\u500b\n */\n\n var hs = new HashSet(StringComparer.Ordinal);\n hs.Add(S);\n var q = new Queue();\n q.Enqueue(S);\n\n long ans = 0;\n for (int i = 0; i < K; i++)\n {\n if (q.Count <= 0)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n var d = q.Dequeue();\n ans += N - d.Length;\n if (d.Length <= 0) continue;\n char[] tmp = new char[d.Length - 1];\n for (int j = 0; j < d.Length - 1; j++)\n {\n tmp[j] = d[j + 1];\n }\n\n for (int j = 0; j < d.Length; j++)\n {\n var str = new string(tmp);\n if (hs.Add(str))\n {\n q.Enqueue(str);\n }\n if (j < d.Length - 1) tmp[j] = d[j];\n }\n\n }\n\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7e9b1caa4766fae85988c66948da0427", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Trenya260619\n{\n class Input\n {\n private static IEnumerator _getinput()\n {\n while (true)\n foreach (string s in Console.ReadLine().Split().Where(x => x.Length > 0))\n yield return s;\n }\n\n private IEnumerator input = _getinput();\n\n public string GetString()\n {\n input.MoveNext();\n return input.Current;\n }\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 long k = csin.GetLong();\n int[] s = csin.GetString().Select(x => (int)(x - 'a')).Append(26).ToArray();\n\n long[,] d = new long[n + 1, n + 1]; // i - length, j - first index\n\n d[0, n] = 1;\n\n bool[] ex = new bool[27];\n\n for (int len = 1; len <= n; len++)\n for (int start = 0; start < n; start++)\n {\n for (int i = 0; i < 27; i++) ex[i] = false;\n\n for (int j = start + 1; j <= n; j++)\n {\n if (ex[s[j]]) continue;\n ex[s[j]] = true;\n d[len, start] += d[len - 1, j];\n }\n }\n\n\n long[] lenans = new long[n + 1];\n for (int i = 0; i <= n; i++)\n {\n for (int j = 0; j < 27; j++) ex[j] = false;\n\n for (int j = 0; j <= n; j++)\n {\n if (ex[s[j]]) continue;\n\n lenans[i] += d[i, j];\n ex[s[j]] = true;\n }\n }\n\n long ans = 0;\n\n for (int i = n; i >= 0 && k > 0; i--)\n {\n long curr = Math.Min(k, lenans[i]);\n k -= curr;\n ans += curr * (n - i);\n }\n\n if (k > 0) ans = -1;\n\n\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "93bfe33fe1bb8379c8a08a39de0b0c09", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Graph\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n string str = Console.ReadLine();\n\n int res = 0;\n bool done = false;\n int n = str.Length;\n for (int i = 0; i < n; i++)\n {\n //res = i;\n //Console.WriteLine(i + \" \" + str + \" \" + done + \" \" + n);\n if(str.Length == 0 ){\n Console.WriteLine(res);\n return;\n }\n\n if (!done)\n {\n\n\n for (int j = 0; j < num.Length; j++)\n {\n if (num[j] == '9' || num[j] == '6')\n {\n if (str.IndexOf('9') != -1)\n {\n str = str.Remove(str.IndexOf('9'), 1);\n }\n else\n {\n if (str.IndexOf('6') != -1)\n {\n str = str.Remove(str.IndexOf('6'), 1);\n }\n else\n {\n //Console.WriteLine(\"\u041d\u0435\u0442 \u0434\u0435\u0432\u044f\u0442\u043a\u0438 \u0438 \u0448\u0435\u0441\u0442\u0435\u0440\u043a\u0438\");\n done = true;\n Console.WriteLine(res);\n return;\n }\n }\n }\n else\n {\n if (num[j] == '5' || num[j] == '2')\n {\n if (str.IndexOf('5') != -1)\n {\n str = str.Remove(str.IndexOf('5'), 1);\n }\n else\n {\n if (str.IndexOf('2') != -1)\n {\n str = str.Remove(str.IndexOf('2'), 1);\n }\n else\n {\n //Console.WriteLine(\"\u041d\u0435\u0442 \u0434\u0432\u043e\u0439\u043a\u0438 \u0438 \u043f\u044f\u0442\u0435\u0440\u043a\u0438\");\n done = true;\n Console.WriteLine(res);\n return;\n }\n }\n }\n else {\n if (str.IndexOf(num[j]) != -1)\n {\n str = str.Remove(str.IndexOf(num[j]), 1);\n }\n else {\n //Console.WriteLine(\"\u041d\u0435\u0442 \" + num[j]);\n done = true;\n Console.WriteLine(res);\n return;\n //break;\n }\n \n }\n }\n }\n\n res++;\n }\n }\n\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "535eaa4afca31562e3233979b7a50b65", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0} {"lang": "MS C#", "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 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 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 int n = 10;\n int[] a = new int[n];\n int[] b = new int[n];\n var s = Reader.ReadLine();\n foreach (var ch in s)\n {\n if (ch == '9')\n {\n a[6]++;\n }\n else if (ch == '5')\n {\n a[2]++;\n }\n else\n {\n a[ch - '0']++;\n }\n }\n s = Reader.ReadLine();\n foreach (var ch in s)\n {\n if (ch == '9')\n {\n b[6]++;\n }\n else if (ch == '5')\n {\n b[2]++;\n }\n else\n {\n b[ch - '0']++;\n }\n }\n var ans = int.MaxValue;\n for (int i = 0; i < n; i++)\n {\n if (a[i] > 0 && b[i] / a[i] < ans)\n {\n ans = b[i] / a[i];\n }\n }\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "08b6afe076fd83f87f140b4239ee341a", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace cf328b\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tchar[] nums = Console.ReadLine().ToCharArray();;\n\t\t\tchar[] digits = Console.ReadLine().ToCharArray();\n\t\t\tList sn = new List();\n\n\t\t\tList sd = new List();\n\n\t\t\tforeach (var num in nums) {\n\t\t\t\tif (num == '2' || num == '5')\n\t\t\t\t\tsn.Add('2');\n\t\t\t\telse \n\t\t\t\tif (num == '6' || num == '9')\n\t\t\t\t\tsn.Add('6');\n\t\t\t\telse\n\t\t\t\t\tsn.Add(num);\n\t\t\t}\n\n\t\t\tforeach (var num in digits) {\n\t\t\t\tif (num == '2' || num == '5')\n\t\t\t\t\tsd.Add('2');\n\t\t\t\telse\n\t\t\t\tif (num == '6' || num == '9')\n\t\t\t\t\tsd.Add('6');\n\t\t\t\telse \n\t\t\t\t\tsd.Add(num);\n\t\t\t}\n\n\t\t\tsn.Sort();\n\t\t\tsd.Sort();\n\n\t\t\tbool failed = false;\n\t\t\tint res = 0;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tforeach (var c in sn) {\n\t\t\t\t\tint i = sd.BinarySearch(c);\n\t\t\t\t\tif (i >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tsd[i] = 'z';\n\t\t\t\t\t\tsd.Sort();\n\t\t\t\t\t}\n\t\t\t\t\telse failed = true;\n\t\t\t\t}\n\t\t\t\tif (!failed)\n\t\t\t\t\tres++;\n\t\t\t}while (!failed);\n\n\t\t\tConsole.WriteLine(res);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4d9db4dedbf32523b368bcdecaf80c69", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Sheldon_and_Ice_Pieces\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 string d = reader.ReadLine();\n\n var cnts = new int[10];\n foreach (char c in d)\n {\n cnts[c - '0']++;\n }\n var ss = new int[10];\n foreach (char c in s)\n {\n ss[c - '0']++;\n }\n cnts[2] += cnts[5];\n cnts[6] += cnts[9];\n ss[2] += ss[5];\n ss[6] += ss[9];\n ss[5] = 0;\n ss[9] = 0;\n int min = d.Length;\n for (int i = 0; i < 10; i++)\n {\n if (ss[i] > 0)\n {\n min = Math.Min(min, cnts[i]/ss[i]);\n }\n }\n return min;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6816978e6f3d6c9412b1a2588da83ad1", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace AllProblems\n{\n class _328B_SheldonAndIcePieces\n {\n public static void Run()\n {\n var t = ReadArray(Console.ReadLine().Trim());\n var s = ReadArray(Console.ReadLine().Trim());\n\n var min = int.MaxValue;\n for (var i = 0; i < 10; i++)\n {\n if(t[i] == 0) continue;\n if (s[i] == 0)\n {\n Console.WriteLine(0);\n return;\n }\n var q = s[i]/t[i];\n if (q < min) min = q;\n }\n Console.WriteLine(min);\n Console.ReadLine();\n }\n\n static int[] ReadArray(string t)\n {\n var n = new int[10];\n foreach (var s in t)\n {\n switch (s)\n {\n case '5':\n n[2]++;\n break;\n case '9':\n n[6]++;\n break;\n default:\n n[s - 48]++;\n break;\n }\n }\n\n return n;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n _328B_SheldonAndIcePieces.Run();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8cddcdd865075a7c9f6141324b29cedb", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R191_Test8_B\n {\n static void Main(string[] args)\n {\n string t = Console.ReadLine();\n string s = Console.ReadLine();\n\n int[] a = new int[10];\n int[] b = new int[10];\n int[] c = new int[10];\n\n for (int i = 0; i < t.Length; i++)\n a[t[i]-'0']++;\n\n for (int i = 0; i < s.Length; i++)\n b[s[i] - '0']++;\n\n int n25 = b[2] + b[5];\n int n69 = b[6] + b[9];\n\n int max = 0;\n for (int i = 0; i <= n25; i++)\n {\n int j = n25 - i;\n for (int k = 0; k <= n69; k++)\n {\n int m = n69 - k;\n for (int d = 0; d < 10; d++)\n c[d] = b[d];\n c[2] = i; c[5] = j; c[6] = k; c[9] = m;\n int min = 999;\n for (int l = 0; l <= 9; l++)\n {\n if (a[l] > 0)\n min = Math.Min(min, c[l] / a[l]);\n }\n max = Math.Max(max, min);\n }\n }\n\n Console.WriteLine(max);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "310f476d81309a76ff4a45be66d80538", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace cf328b\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tchar[] nums = Console.ReadLine().ToCharArray();;\n\t\t\tchar[] digits = Console.ReadLine().ToCharArray();\n\t\t\tList sn = new List();\n\n\t\t\tList sd = new List();\n\n\t\t\tforeach (var num in nums) {\n\t\t\t\tif (num == '2' || num == '5')\n\t\t\t\t\tsn.Add('2');\n\n\t\t\t\tif (num == '6' || num == '9')\n\t\t\t\t\tsn.Add('6');\n\t\t\t}\n\n\t\t\tforeach (var num in digits) {\n\t\t\t\tif (num == '2' || num == '5')\n\t\t\t\t\tsd.Add('2');\n\n\t\t\t\tif (num == '6' || num == '9')\n\t\t\t\t\tsd.Add('6');\n\t\t\t}\n\n\t\t\tsn.Sort();\n\t\t\tsd.Sort();\n\n\t\t\tbool failed = false;\n\t\t\tint res = 0;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tforeach (var c in sn) {\n\t\t\t\t\tint i = sd.BinarySearch(c);\n\t\t\t\t\tif (i >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tsd[i] = 'z';\n\t\t\t\t\t\tsd.Sort();\n\t\t\t\t\t}\n\t\t\t\t\telse failed = true;\n\t\t\t\t}\n\t\t\t\tif (!failed)\n\t\t\t\t\tres++;\n\t\t\t}while (!failed);\n\n\t\t\tConsole.WriteLine(res);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bb91282834e138f21fe91fb46f59e6d5", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Graph\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n string str = Console.ReadLine();\n\n int res = 0;\n bool done = false;\n int n = str.Length;\n for (int i = 0; i < n; i++)\n {\n res = i;\n //Console.WriteLine(i + \" \" + str + \" \" + done + \" \" + n);\n if (!done)\n {\n for (int j = 0; j < num.Length; j++)\n {\n if (num[j] == '9' || num[j] == '6')\n {\n if (str.IndexOf('9') != -1)\n {\n str = str.Remove(str.IndexOf('9'), 1);\n }\n else\n {\n if (str.IndexOf('6') != -1)\n {\n str = str.Remove(str.IndexOf('6'), 1);\n }\n else\n {\n // Console.WriteLine(\"\u041d\u0435\u0442 \u0434\u0435\u0432\u044f\u0442\u043a\u0438 \u0438 \u0448\u0435\u0441\u0442\u0435\u0440\u043a\u0438\");\n done = true;\n Console.WriteLine(res);\n return;\n }\n }\n }\n else\n {\n if (num[j] == '5' || num[j] == '2')\n {\n if (str.IndexOf('5') != -1)\n {\n str = str.Remove(str.IndexOf('5'), 1);\n }\n else\n {\n if (str.IndexOf('2') != -1)\n {\n str = str.Remove(str.IndexOf('2'), 1);\n }\n else\n {\n //Console.WriteLine(\"\u041d\u0435\u0442 \u0434\u0432\u043e\u0439\u043a\u0438 \u0438 \u043f\u044f\u0442\u0435\u0440\u043a\u0438\");\n done = true;\n Console.WriteLine(res);\n return;\n }\n }\n }\n else {\n if (str.IndexOf(num[j]) != -1)\n {\n str = str.Remove(str.IndexOf(num[j]), 1);\n }\n else {\n //Console.WriteLine(\"\u041d\u0435\u0442 \" + num[j]);\n done = true;\n Console.WriteLine(res);\n return;\n //break;\n }\n \n }\n }\n }\n }\n }\n\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dcf8544ed48c4e7f4b49f6b32c85698b", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n\n static void Main()\n {\n Int64 n = Convert.ToInt64(Console.ReadLine());\n Int64[] a = new Int64[n];\n Int64[] f = new Int64[n];\n Int64 fcnt = 0;\n\n string str = Console.ReadLine();\n string[] words = str.Split(' ');\n\n for (Int64 i = 0; i < n; i++)\n a[i] = Convert.ToInt64(words[i]);\n\n for(Int64 i = 0, now = n-1; i < n; i++)\n {\n now += 7;\n now %= n;\n f[now] = i+1;\n if (now == n-1)\n break;\n fcnt++;\n }\n fcnt++;\n \n {\n Int64 l = 0;\n Int64 r = Convert.ToInt64(5e4 * 10e9);\n while(l+1 != r)\n {\n Int64 mid = (l + r) / 2;\n bool ok = true;\n for(Int64 i = 0; i < n; i++)\n {\n Int64 cost = mid / n;\n if ((i + 1) <= mid % n)\n cost++;\n Int64 disc = mid / (fcnt * 7);\n if(7*f[i] <= mid % (7*fcnt))\n disc++;\n if(f[i] == 0)\n disc = 0;\n cost -= disc;\n if (cost >= a[i])\n ok = false;\n }\n \n if (ok)\n l = mid;\n else\n r = mid;\n }\n \n Console.WriteLine(((r-1) % n + 1).ToString());\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ca5bbacfc6efb57d0b1f3283fcf706d2", "src_uid": "8054dc5dd09d600d7fb8d9f5db4dcaca", "difficulty": 2700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n\n static void Main()\n {\n Int64 n = Convert.ToInt64(Console.ReadLine());\n Int64[] a = new Int64[n];\n Int64[] f = new Int64[n];\n Int64 fcnt = 0;\n\n string str = Console.ReadLine();\n string[] words = str.Split(' ');\n\n for (Int64 i = 0; i < n; i++)\n a[i] = Convert.ToInt64(words[i]);\n\n for(Int64 i = 0, now = n-1; i < n; i++)\n {\n now += 7;\n now %= n;\n f[now] = i;\n if (now == n-1)\n break;\n fcnt++;\n }\n \n {\n Int64 l = 0;\n Int64 r = Convert.ToInt64(5e4 * 10e9);\n while(l+1 != r)\n {\n Int64 mid = (l + r) / 2;\n bool ok = true;\n for(Int64 i = 0; i < n; i++)\n {\n Int64 cost = mid / n;\n if ((i + 1) <= mid % n)\n cost++;\n Int64 disc = mid / (7 * fcnt);\n if(7*(f[i]+1) <= mid % (7*fcnt))\n disc++;\n cost -= disc;\n if (cost >= a[i])\n ok = false;\n }\n \n if (ok)\n l = mid;\n else\n r = mid;\n }\n \n Console.WriteLine(((r-1) % n + 1).ToString());\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "207560373b34522aebef91bcb78418c0", "src_uid": "8054dc5dd09d600d7fb8d9f5db4dcaca", "difficulty": 2700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Out_of_Controls\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 var nn = new int[n][];\n int[][] t = Enumerable.Range(0, n).Select(e => nn[e] = new int[n]).ToArray();\n int[] t1 = Enumerable.Range(0, n).Select(e =>\n {\n string[] ss = reader.ReadLine().Split(' ');\n int[] t3 = Enumerable.Range(0, n).Select(j => nn[e][j] = int.Parse(ss[j])).ToArray();\n return 0;\n }).ToArray();\n\n int[] t2 = Enumerable.Range(0, n).Select(k =>\n {\n int[] t4 = Enumerable.Range(0, n).Select(i =>\n {\n int[] t5 =\n Enumerable.Range(0, n).Select(j =>\n {\n nn\n [\n i\n ]\n [\n j\n ]\n =\n Math\n .\n Min\n (\n nn\n [\n i\n ]\n [\n j\n ],\n nn\n [\n i\n ]\n [\n k\n ] +\n nn\n [\n k\n ]\n [\n j\n ]);\n return\n 0;\n })\n .ToArray();\n return 0;\n }).ToArray();\n return 0;\n }).ToArray();\n\n writer.WriteLine(Enumerable.Range(0, n).Select(i => nn[i].Max()).Max());\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fd956033bedfe455d1c0d24bb49693d6", "src_uid": "bbd210065f8b32de048a2d9b1b033ed5", "difficulty": 2000.0} {"lang": "MS C#", "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 n;\n int[][] a;\n void Fun(int i, int j, int k)\n {\n try\n {\n throw (i == n ? new ArgumentNullException() : new Exception());\n }\n catch (ArgumentNullException)\n {\n Fun(0, j + 1, k);\n return;\n }\n catch\n {\n }\n\n try\n {\n throw (j == n ? new ArgumentNullException() : new Exception());\n }\n catch (ArgumentNullException)\n {\n Fun(i, 0, k + 1);\n return;\n }\n catch\n {\n }\n\n try\n {\n throw (k == n ? new ArgumentNullException() : new Exception());\n }\n catch (ArgumentNullException)\n {\n return;\n }\n catch\n {\n }\n\n a[i][j] = Math.Min(a[i][j], a[i][k] + a[k][j]);\n Fun(i + 1, j, k);\n }\n\n void Solve()\n {\n //var reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n var reader = new StreamReader(Console.OpenStandardInput());\n\n n = int.Parse(reader.ReadLine());\n a = Enumerable.Range(0, n).Select(x => reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray()).ToArray();\n\n Fun(0, 0, 0);\n Console.WriteLine(a.Max(aa => aa.Max()));\n }\n\n static void Main()\n {\n new Solver().Solve();\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ae606e969eee3010888f5e8e096d4fed", "src_uid": "bbd210065f8b32de048a2d9b1b033ed5", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nclass E { static void Main() { new K(); } }\nclass K\n{\n\tint F() { return int.Parse(Console.ReadLine()); }\n\tint[] G() { return Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray(); }\n\tpublic K()\n\t{\n\t\tvar N = F();\n\t\tvar loop = Enumerable.Range(0, N);\n\t\tvar a = new int[N][];\n\t\tloop.Select(i =>\n\t\t{\n\t\t\tvar I = G();\n\t\t\ta[i] = new int[N];\n\t\t\tloop.Select(j =>\n\t\t\t{\n\t\t\t\ta[i][j] = I[j]; return 0;\n\t\t\t}).ToArray(); return 0;\n\t\t}).ToArray();\n\t\tloop.Select(i =>\n\t\t{\n\t\t\tloop.Select(j =>\n\t\t\t{\n\t\t\t\tloop.Select(k =>\n\t\t\t\t{\n\t\t\t\t\ta[i][j] = Math.Min(a[i][j], a[i][k] + a[k][j]); return 0;\n\t\t\t\t}).ToArray();\n\t\t\t\treturn 0;\n\t\t\t}).ToArray();\n\t\t\treturn 0;\n\t\t}).ToArray();\n\t\tConsole.WriteLine(a.Select(b => b.Max()).Max());\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8d11dabc97ce56e98bd1474ff443bf2b", "src_uid": "bbd210065f8b32de048a2d9b1b033ed5", "difficulty": 2000.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6a58b9dc03e6d255dc539c79f5f9a8f1", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b25d37400ebc8ef9b53c5ac020b78317", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "525b0e27145d3aabb253a664ad1a6bb1", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": ".NET Core C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e51bf74245282953ff8b236eaf9af6bd", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Text;\nusing System.IO;\n\nnamespace codeforces\n{\n public class Program\n {\n private const int MOD = 1000 * 1000 * 1000 + 7;\n private const int KMax = 40;\n\n private static int[,] C = new int[KMax + 1, KMax + 1];\n\n private static int Add(int x, int y)\n {\n x += y;\n if (x >= MOD)\n {\n x -= MOD;\n }\n return x;\n }\n\n private static int Mult(int x, int y)\n {\n return (int)(1L * x * y % MOD);\n }\n\n private static void MatrixMult(int[,] a, int[,] b, int[,] c, int n)\n {\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n c[i, j] = 0;\n for (int k = 0; k < n; ++k)\n {\n c[i, j] = Add(c[i, j], Mult(a[i, k], b[k, j]));\n }\n }\n }\n }\n\n private static void MatrixCopy(int[,] a, int[,] b, int n)\n {\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n b[i, j] = a[i, j];\n }\n }\n }\n\n private static void MatrixBinPow(int[,] a, int[,] result, int size, long n)\n {\n for (int i = 0; i < size; ++i)\n {\n for (int j = 0; j < size; ++j)\n {\n result[i, j] = i == j ? 1 : 0;\n }\n }\n var tmp = new int[size, size];\n\n while (n > 0)\n {\n if (n % 2 == 1)\n {\n MatrixMult(result, a, tmp, size);\n MatrixCopy(tmp, result, size);\n }\n\n MatrixMult(a, a, tmp, size);\n MatrixCopy(tmp, a, size);\n n /= 2;\n }\n }\n\n\n private static void Main(string[] args)\n {\n var values = Console.ReadLine().Split(' ');\n\n for (int i = 0; i <= KMax; ++i)\n {\n C[i, 0] = C[i, i] = 1;\n for (int j = 1; j < i; ++j)\n {\n C[i, j] = Add(C[i - 1, j - 1], C[i - 1, j]);\n }\n }\n\n long n = Convert.ToInt64(values[0]);\n int k = Convert.ToInt32(values[1]);\n int size = 2 * k + 3;\n var A = new int[size, size];\n for (int i = 0; i < k; ++i)\n {\n int p = k - i;\n for (int j = 0; j < i; ++j)\n {\n A[i, j] = 0;\n }\n for (int j = i; j < k + 1; ++j)\n {\n A[i, j] = C[p, j - i];\n }\n for (int j = k + 1; j < k + i + 1; ++j)\n {\n A[i, j] = 0;\n }\n for (int j = k + 1 + i, t = 0; j < 2 * k + 2; ++j, ++t)\n {\n A[i, j] = 0;\n for (int c = 0; c <= t; ++c)\n {\n A[i, j] = Add(A[i, j], Mult(C[p, c], C[p - c, t - c]));\n }\n }\n A[i, size - 1] = 0;\n }\n for (int j = 0; j < size; ++j)\n {\n A[k, j] = j == k || j == (2 * k + 1) ? 1 : 0;\n }\n for (int i = k + 1; i < 2 * k + 2; ++i)\n {\n for (int j = 0; j < size; ++j)\n {\n A[i, j] = 0;\n }\n A[i, i - k - 1] = 1;\n }\n for (int j = 0; j < size; ++j)\n {\n A[size - 1, j] = 0;\n }\n A[size - 1, 0] = A[size - 1, size - 1] = 1;\n\n /*for (int i = 0; i < size; ++i)\n {\n for (int j = 0; j < size; ++j)\n {\n Console.Write(A[i, j]);\n Console.Write(\" \");\n }\n Console.WriteLine();\n }*/\n\n var result = new int[size, size];\n MatrixBinPow(A, result, size, n - 1);\n\n /*for (int i = 0; i < size; ++i)\n {\n for (int j = 0; j < size; ++j)\n {\n Console.Write(result[i, j]);\n Console.Write(\" \");\n }\n Console.WriteLine();\n }*/\n\n int ans = 0;\n int tp = 2;\n\n for (int i = k; i >= 0; --i)\n {\n ans = Add(ans, Mult(result[size - 1, i], tp));\n tp = Mult(tp, 2);\n }\n for (int i = k + 1; i < size; ++i)\n {\n ans = Add(ans, result[size - 1, i]);\n }\n Console.WriteLine(ans);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b870e0baa6bfe9a4527df083dbf48cb4", "src_uid": "14f50a111db268182e5927839a993118", "difficulty": null} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\r\nusing System.Threading;\r\nusing System.IO;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing CompLib.Mathematics;\r\n\r\npublic class Program\r\n{\r\n int N;\r\n List[] Div;\r\n\r\n int[] Sieve;\r\n\r\n int[] S;\r\n\r\n public void Solve()\r\n {\r\n\r\n\r\n var sc = new Scanner();\r\n N = sc.NextInt();\r\n Div = new List[N + 1];\r\n for (int i = 1; i <= N; i++)\r\n {\r\n Div[i] = new List();\r\n }\r\n\r\n for (int i = 1; i <= N; i++)\r\n {\r\n for (int j = i; j <= N; j += i)\r\n {\r\n Div[j].Add(i);\r\n }\r\n }\r\n\r\n S = new int[N + 1];\r\n S[1] = 0;\r\n for (int i = 2; i <= N; i++)\r\n {\r\n S[i] = i - 1;\r\n foreach (int d in Div[i])\r\n {\r\n if (i == d) continue;\r\n // Console.WriteLine($\"{S[i / d]}\");\r\n S[i] -= S[d];\r\n }\r\n }\r\n\r\n //for (int i = 1; i < 20; i++)\r\n //{\r\n // Console.WriteLine($\"{i} {F2(i)} {S[i]}\");\r\n //}\r\n\r\n ModInt ans = 0;\r\n for (int c = 1; c + 2 <= N; c++)\r\n {\r\n int sumAB = N - c;\r\n foreach (int gcdAB in Div[sumAB])\r\n {\r\n int d = sumAB / gcdAB;\r\n\r\n // a + b = d\r\n // gcd(a,b) = 1\r\n\r\n\r\n ans += S[d] * MathEx.LCM(c, gcdAB);\r\n }\r\n }\r\n\r\n Console.WriteLine(ans);\r\n\r\n\r\n }\r\n ModInt F2(int n)\r\n {\r\n int cnt = 0;\r\n for (int a = 1; a + 1 <= n; a++)\r\n {\r\n cnt += MathEx.GCD(a, n - a) == 1 ? 1 : 0;\r\n }\r\n return cnt;\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 using System;\r\n using System.Collections.Generic;\r\n #region GCD LCM\r\n /// \r\n /// \u69d8\u3005\u306a\u6570\u5b66\u7684\u95a2\u6570\u306e\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\uff0e\r\n /// \r\n public static partial class MathEx\r\n {\r\n /// \r\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\r\n /// \r\n /// \u6700\u521d\u306e\u5024\r\n /// 2 \u756a\u76ee\u306e\u5024\r\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\r\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\r\n public static int GCD(int n, int m) { return (int)GCD((long)n, m); }\r\n\r\n\r\n /// \r\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\r\n /// \r\n /// \u6700\u521d\u306e\u5024\r\n /// 2 \u756a\u76ee\u306e\u5024\r\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5927\u516c\u7d04\u6570\r\n /// \u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5\u306b\u57fa\u3065\u304d\u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\r\n public static long GCD(long n, long m)\r\n {\r\n n = Math.Abs(n);\r\n m = Math.Abs(m);\r\n while (n != 0)\r\n {\r\n m %= n;\r\n if (m == 0) return n;\r\n n %= m;\r\n }\r\n return m;\r\n }\r\n\r\n\r\n /// \r\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\uff0e\r\n /// \r\n /// \u6700\u521d\u306e\u5024\r\n /// 2 \u756a\u76ee\u306e\u5024\r\n /// 2 \u3064\u306e\u6574\u6570\u306e\u6700\u5c0f\u516c\u500d\u6570\r\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\r\n public static long LCM(long n, long m) { return (n / GCD(n, m)) * m; }\r\n }\r\n #endregion\r\n #region PrimeSieve\r\n public static partial class MathEx\r\n {\r\n /// \r\n /// \u3042\u308b\u5024\u307e\u3067\u306b\u7d20\u6570\u8868\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\r\n /// \r\n /// \u6700\u5927\u306e\u5024\r\n /// \u7d20\u6570\u306e\u307f\u3092\u5165\u308c\u305f\u6570\u5217\u304c\u8fd4\u3055\u308c\u308b\r\n /// 0 \u304b\u3089 max \u307e\u3067\u306e\u7d20\u6570\u8868\r\n /// \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u306b\u57fa\u3065\u304d\uff0c\u6700\u60aa\u8a08\u7b97\u91cf O(N loglog N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\r\n public static bool[] Sieve(int max, List primes = null)\r\n {\r\n var isPrime = new bool[max + 1];\r\n for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;\r\n for (int i = 2; i * i <= max; i++)\r\n if (!isPrime[i]) continue;\r\n else for (int j = i * i; j <= max; j += i) isPrime[j] = false;\r\n if (primes != null) for (int i = 0; i <= max; i++) if (isPrime[i]) primes.Add(i);\r\n\r\n return isPrime;\r\n }\r\n }\r\n #endregion\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "51212d21fcc4665a9562c2363fa08b6b", "src_uid": "c3694a6ff95c64bef8cbe8834c3fd6cb", "difficulty": 2200.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\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 \r\n var n = Int32.Parse(Console.ReadLine());\r\n\r\n Console.WriteLine(GetVal(n));\r\n }\r\n\r\n\r\n const int MOD_VAL = 1000000007;\r\n private static int GetVal(int n)\r\n {\r\n var primes = GetAllPrimes(n);\r\n var res = 0;\r\n var primeCache = GetPrimeCache(primes, n);\r\n var dfsSolver = new DFSSolver(primeCache);\r\n for(var i = 1;i<=n-2;i++)\r\n {\r\n var primeFactors = GetPrimeFactors(i, primes);\r\n var primeMap = new Dictionary();\r\n foreach(var (prime, primeCnt) in primeFactors)\r\n {\r\n primeMap[prime] = primeCnt;\r\n }\r\n dfsSolver.SetPrimeMap(primeMap);\r\n dfsSolver.SetPrimeFactors(GetPrimeFactors(n-i, primes));\r\n res = (int)((res + (long)dfsSolver.GetRes()*i ) % MOD_VAL);\r\n }\r\n return res;\r\n }\r\n\r\n private class DFSSolver\r\n {\r\n private int _res;\r\n private Dictionary _primeMap;\r\n private List<(int,int)> _primeFactors;\r\n\r\n private Dictionary _primeCache;\r\n public DFSSolver(Dictionary primeCache)\r\n {\r\n _primeCache = primeCache;\r\n }\r\n\r\n public void SetPrimeMap(Dictionary primeMap)\r\n {\r\n _primeMap = primeMap;\r\n }\r\n\r\n public void SetPrimeFactors(List<(int,int)> primeFactors)\r\n {\r\n _primeFactors = primeFactors; \r\n }\r\n\r\n public int GetRes()\r\n {\r\n _res = 0;\r\n DFS(0,1);\r\n var tmp = 1;\r\n foreach(var (prime, cnt) in _primeFactors)\r\n {\r\n if(_primeMap.ContainsKey(prime))\r\n {\r\n if(cnt > _primeMap[prime])\r\n {\r\n tmp*= _primeCache[prime][cnt-_primeMap[prime]];\r\n }\r\n }\r\n else\r\n {\r\n tmp*= _primeCache[prime][cnt];\r\n }\r\n }\r\n _res-=tmp;\r\n if (_res < MOD_VAL) _res+=MOD_VAL;\r\n return _res;\r\n }\r\n\r\n private void DFS(int index, int val)\r\n {\r\n if(index == _primeFactors.Count)\r\n {\r\n _res = (_res + val) % MOD_VAL;\r\n return;\r\n }\r\n var prime = _primeFactors[index].Item1;\r\n var cnt = _primeFactors[index].Item2;\r\n for(var i = 0;i<= cnt;i++)\r\n {\r\n var append = 1;\r\n if(_primeMap.ContainsKey(prime))\r\n {\r\n if(i > _primeMap[prime])\r\n {\r\n append = _primeCache[prime][i - _primeMap[prime]];\r\n }\r\n }\r\n else\r\n {\r\n append = _primeCache[prime][i];\r\n }\r\n\r\n if (i < cnt)\r\n {\r\n append = append * (prime - 1) * _primeCache[prime][cnt-i-1]; \r\n }\r\n DFS(index+1, (int)((long)val * append % MOD_VAL));\r\n }\r\n }\r\n }\r\n\r\n private static Dictionary GetPrimeCache(List primes, int n)\r\n {\r\n var primeCache = new Dictionary();\r\n foreach(var prime in primes)\r\n {\r\n var list = new List();\r\n list.Add(1);\r\n var tmp = prime;\r\n while(tmp <= n)\r\n {\r\n list.Add(tmp);\r\n tmp*=prime;\r\n }\r\n primeCache[prime] = list.ToArray();\r\n }\r\n return primeCache;\r\n }\r\n\r\n private static int GetLCM(int num0, int num1)\r\n {\r\n return (int)((long)num0 * num1 /GetGCD(num0, num1));\r\n }\r\n\r\n private static int GetGCD(int num0, int num1)\r\n {\r\n if (num0 < num1)\r\n {\r\n var tmp = num1;\r\n num1 = num0;\r\n num0 = tmp;\r\n }\r\n while (num1 > 0)\r\n {\r\n var tmp = num1;\r\n num1 = num0 % num1;\r\n num0 = tmp;\r\n }\r\n return num0;\r\n }\r\n\r\n static List GetAllPrimes(int n)\r\n {\r\n var isNotPrimes = new bool[n+1];\r\n var primes = new List();\r\n for(var i = 2;i<=n;i++)\r\n {\r\n if (!isNotPrimes[i])\r\n {\r\n primes.Add(i);\r\n var num = i * 2;\r\n while(num <= n)\r\n {\r\n isNotPrimes[num]= true;\r\n num+=i;\r\n }\r\n }\r\n }\r\n return primes;\r\n }\r\n\r\n static List<(int,int)> GetPrimeFactors(int num, List primes)\r\n {\r\n var primeFactors = new List<(int,int)>();\r\n foreach(var prime in primes)\r\n {\r\n if (num < prime * prime) break;\r\n var cnt = 0;\r\n while(num % prime == 0)\r\n {\r\n cnt++;\r\n num/=prime;\r\n }\r\n if (cnt > 0)\r\n {\r\n primeFactors.Add((prime, cnt));\r\n }\r\n }\r\n if (num!=1)\r\n {\r\n primeFactors.Add((num, 1));\r\n }\r\n return primeFactors;\r\n }\r\n\r\n static int[] GetFactors(int num, List primes)\r\n {\r\n return GetFactors(GetPrimeFactors(num, primes));\r\n }\r\n\r\n static int[] GetFactors(List<(int,int)> primeFactors)\r\n {\r\n var factorCnt = 1;\r\n foreach(var (_, cnt) in primeFactors)\r\n {\r\n factorCnt*=cnt+1;\r\n }\r\n var factors = new int[factorCnt];\r\n var preCnt = 1;\r\n var index = 1;\r\n factors[0] = 1;\r\n foreach(var (prime, cnt) in primeFactors)\r\n {\r\n var factor = prime;\r\n for(var i = 1;i<=cnt;i++)\r\n {\r\n for(var j = 0;j _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = NN;\n var x = NN;\n var pos = NN;\n LIB_Mod ans = 1;\n var left = 0L;\n var right = n;\n var upperx = n - x;\n var downerx = n - upperx - 1;\n while (left < right)\n {\n var mid = (left + right) / 2;\n if (mid > pos)\n {\n ans *= upperx;\n upperx -= 1;\n right = mid;\n }\n else if (mid < pos)\n {\n ans *= downerx;\n downerx -= 1;\n left = mid + 1;\n }\n else\n {\n left = mid + 1;\n }\n }\n var zan = upperx + downerx;\n if (zan > 0)\n {\n ans *= LIB_Mod.Perm(zan, zan);\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 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 static void Fill(this T[] array, T value) => array.AsSpan().Fill(value);\n static void Fill(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);\n static void Fill(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);\n static void Fill(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);\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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long[] LogBuild(long a)\n {\n var ret = new long[_mod];\n ret[1] = 0;\n for (var i = 1; i < _mod; i++)\n {\n ret[a] = i;\n a *= 2;\n a %= _mod;\n }\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long Log(long a, long b)\n {\n var g = 1L;\n for (var i = _mod; i != 0; i >>= 1)\n {\n g *= a;\n g %= _mod;\n }\n g = LIB_Math.GCD(g, _mod);\n var t = 1L;\n var c = 0L;\n for (; t % g != 0; ++c)\n {\n if (t == b) return c;\n t *= a;\n t %= _mod;\n }\n if (b % g != 0) return -1;\n t /= g;\n b /= g;\n var n = _mod / g;\n var h = 0L;\n var gs = 1L;\n for (; h * h < n; ++h)\n {\n gs *= a;\n gs %= n;\n }\n var bs = new Dictionary();\n for (long s = 0L, e = b; s < h; bs[e] = ++s)\n {\n e *= a;\n e %= n;\n }\n for (long s = 0L, e = t; s < n;)\n {\n e *= gs;\n e %= n;\n s += h;\n if (bs.ContainsKey(e) && bs[e] > 0) return c + s - bs[e];\n }\n return -1;\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[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_Math\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public IEnumerable Primes(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)\n table[j] = true;\n }\n for (long i = max + 1; i <= halfx; ++i)\n if (!table[i] && 2 * i + 1 <= x)\n yield return 2 * i + 1;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public IEnumerable Factors(long x)\n {\n if (x < 2) yield break;\n while (x % 2 == 0)\n {\n x /= 2; yield return 2;\n }\n var max = (long)Math.Sqrt(x);\n for (long i = 3; i <= max; i += 2)\n {\n while (x % i == 0)\n {\n x /= i; yield return i;\n }\n }\n if (x != 1) yield return x;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public 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 [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long GCD(long a, long b)\n {\n while (b > 0)\n {\n var tmp = b;\n b = a % b;\n a = tmp;\n }\n return a;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long LCM(long a, long b) => a / GCD(a, b) * b;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long Pow(long x, long y)\n {\n long a = 1;\n while (y != 0)\n {\n if ((y & 1) == 1) a *= x;\n if (x < long.MaxValue / x) x *= x;\n y >>= 1;\n }\n return a;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public decimal Sqrt(decimal x)\n {\n decimal prev, cur = (decimal)Math.Sqrt((double)x);\n do\n {\n prev = cur;\n if (prev == 0) return 0;\n cur = (prev + x / prev) / 2;\n } while (cur != prev);\n return cur;\n }\n static List _fact = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void Build(long n)\n {\n if (n >= _fact.Count)\n for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long Comb(long n, long k)\n {\n Build(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 long Perm(long n, long k)\n {\n Build(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 IEnumerable> MakePermutation(long n, bool zeroIndexed = true)\n {\n if (n <= 0) throw new Exception();\n var c = new int[n];\n var a = new int[n];\n if (!zeroIndexed) a[0] = 1;\n for (var i = 1; i < n; i++) a[i] = a[i - 1] + 1;\n yield return new List(a);\n for (var i = 0; i < n;)\n {\n if (c[i] < i)\n {\n if (i % 2 == 0)\n {\n var t = a[0]; a[0] = a[i]; a[i] = t;\n }\n else\n {\n var t = a[c[i]]; a[c[i]] = a[i]; a[i] = t;\n }\n yield return new List(a);\n ++c[i];\n i = 0;\n }\n else\n {\n c[i] = 0;\n ++i;\n }\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool NextPermutation(long[] ary)\n {\n var n = ary.Length;\n var i = n - 1;\n while (i - 1 >= 0 && ary[i - 1] > ary[i]) --i;\n if (i == 0) return false;\n var j = i;\n while (j + 1 < n && ary[i - 1] < ary[j + 1]) ++j;\n var tmp = ary[i - 1]; ary[i - 1] = ary[j]; ary[j] = tmp;\n var s = i;\n var t = n - 1;\n while (t - s > 0)\n {\n tmp = ary[t]; ary[t] = ary[s]; ary[s] = tmp;\n ++s; --t;\n }\n return true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public (long, long) InvGCD(long a, long b)\n {\n a = (a + b) % b;\n if (a == 0) return (b, 0);\n var s = b;\n var t = a;\n var m0 = 0L;\n var m1 = 1L;\n while (t > 0)\n {\n var u = s / t; s -= t * u; m0 -= m1 * u;\n var tmp = s; s = t; t = tmp;\n tmp = m0; m0 = m1; m1 = tmp;\n }\n if (m0 < 0) m0 += b / s;\n return (s, m0);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public (long, long) CRT(long[] r, long[] m)\n {\n var r0 = 0L;\n var m0 = 1L;\n for (var i = 0; i < m.Length; i++)\n {\n var m1 = m[i];\n var r1 = (r[i] + m1) % m1;\n if (m0 < m1)\n {\n r0 ^= r1; r1 ^= r0; r0 ^= r1;\n m0 ^= m1; m1 ^= m0; m0 ^= m1;\n }\n if (m0 % m1 == 0)\n {\n if (r0 % m1 != r1) return (0, 0);\n continue;\n }\n var gim = InvGCD(m0, m1);\n var u1 = m1 / gim.Item1;\n if ((r1 - r0) % gim.Item1 != 0) return (0, 0);\n var x = (r1 - r0) / gim.Item1 % u1 * gim.Item2 % u1;\n r0 += x * m0;\n m0 *= u1;\n if (r0 < 0) r0 += m0;\n }\n return (r0, m0);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]\n static public long FloorSum(long n, long m, long a, long b)\n {\n var ans = 0L;\n while (true)\n {\n if (a >= m)\n {\n ans += (n - 1) * n * (a / m) / 2;\n a %= m;\n }\n if (b >= m)\n {\n ans += n * (b / m);\n b %= m;\n }\n var ymax = (a * n + b) / m;\n if (ymax == 0) return ans;\n var xmax = ymax * m - b;\n ans += (n - (xmax + a - 1) / a) * ymax;\n n = ymax;\n a ^= m; m ^= a; a ^= m;\n b = (m - xmax % m) % m;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f8473c8f6d68afc74fcc22727d5fec70", "src_uid": "24e2f10463f440affccc2755f4462d8a", "difficulty": 1500.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace Mycop\n{\n class Program\n {\n static void Main()\n {\n var numbers = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = numbers[0];\n var x = numbers[1];\n var pos = numbers[2];\n\n var smaller = x - 1;\n var bigger = n - x;\n var result = 1L;\n\n var left = 0;\n var right = n;\n while (left < right)\n {\n var mid = (left + right) / 2;\n if (mid == pos)\n left = mid + 1;\n else if (mid < pos)\n {\n result *= smaller;\n result %= 1000000007;\n smaller--;\n left = mid + 1;\n }\n else\n {\n result *= bigger;\n result %= 1000000007;\n bigger--;\n right = mid;\n }\n\n if (smaller < 0 || bigger < 0)\n {\n Console.WriteLine(0);\n return;\n }\n }\n\n for (var i = 1; i <= smaller + bigger; i++)\n {\n result *= i;\n result %= 1000000007;\n }\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0f028d78339aeb635dc4c87daa92ddf4", "src_uid": "24e2f10463f440affccc2755f4462d8a", "difficulty": 1500.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Buffers;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Runtime.Intrinsics.X86;\nusing CodeforcesRound678Div2.Questions;\nusing ModInt = CodeforcesRound678Div2.Questions.StaticModInt;\n\nnamespace CodeforcesRound678Div2.Questions\n{\n public class QuestionC : AtCoderQuestionBase\n {\n [MethodImpl(MethodImplOptions.AggressiveOptimization)]\n public override void Solve(IOManager io)\n {\n var n = io.ReadInt();\n var x = io.ReadInt();\n var pos = io.ReadInt();\n\n var more = n - x;\n var less = x - 1;\n\n var left = 0;\n var right = n;\n ModInt result = ModInt.One;\n \n while (left < right)\n {\n var middle = (left + right) / 2;\n\n if (middle > pos)\n {\n if (more > 0)\n {\n result *= ModInt.Raw(more);\n more--;\n }\n else\n {\n result = ModInt.Zero;\n }\n right = middle;\n }\n else if (middle < pos)\n {\n if (less > 0)\n {\n result *= ModInt.Raw(less);\n less--;\n }\n else\n {\n result = ModInt.Zero;\n }\n left = middle + 1;\n }\n else\n {\n left = middle + 1;\n }\n }\n\n for (int i = 1; i <= more + less; i++)\n {\n result *= ModInt.Raw(i);\n }\n\n io.WriteLine(result);\n }\n }\n\n /// \n /// \u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u6c7a\u5b9a\u3059\u308b mod \u3092\u8868\u3057\u307e\u3059\u3002\n /// \n /// \n /// \n /// public readonly struct Mod1000000009 : IStaticMod\n /// {\n /// public uint Mod => 1000000009;\n /// public bool IsPrime => true;\n /// }\n /// \n /// \n public interface IStaticMod\n {\n /// \n /// mod \u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\n /// \n uint Mod { get; }\n\n /// \n /// mod \u304c\u7d20\u6570\u3067\u3042\u308b\u304b\u8b58\u5225\u3057\u307e\u3059\u3002\n /// \n bool IsPrime { get; }\n }\n\n public readonly struct Mod1000000007 : IStaticMod\n {\n public uint Mod => 1000000007;\n public bool IsPrime => true;\n }\n\n public readonly struct Mod998244353 : IStaticMod\n {\n public uint Mod => 998244353;\n public bool IsPrime => true;\n }\n\n /// \n /// \u5b9f\u884c\u6642\u306b\u6c7a\u5b9a\u3059\u308b mod \u306e ID \u3092\u8868\u3057\u307e\u3059\u3002\n /// \n /// \n /// \n /// public readonly struct ModID123 : IDynamicModID { }\n /// \n /// \n public interface IDynamicModID { }\n\n public readonly struct ModID0 : IDynamicModID { }\n public readonly struct ModID1 : IDynamicModID { }\n public readonly struct ModID2 : IDynamicModID { }\n\n /// \n /// \u56db\u5247\u6f14\u7b97\u6642\u306b\u81ea\u52d5\u3067 mod \u3092\u53d6\u308b\u6574\u6570\u578b\u3002mod \u306e\u5024\u306f\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u6c7a\u5b9a\u3057\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n /// \n /// \u5b9a\u6570 mod \u3092\u8868\u3059\u69cb\u9020\u4f53\n /// \n /// \n /// using ModInt = AtCoder.StaticModInt<AtCoder.Mod1000000007>;\n ///\n /// void SomeMethod()\n /// {\n /// var m = new ModInt(1);\n /// m -= 2;\n /// Console.WriteLine(m); // 1000000006\n /// }\n /// \n /// \n public readonly struct StaticModInt : IEquatable> where T : struct, IStaticMod\n {\n private readonly uint _v;\n\n /// \n /// \u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n public int Value => (int)_v;\n\n /// \n /// mod \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n public static int Mod => (int)default(T).Mod;\n\n public static StaticModInt Zero => new StaticModInt();\n public static StaticModInt One => new StaticModInt(1u);\n\n /// \n /// \u306b\u5bfe\u3057\u3066 mod \u3092\u53d6\u3089\u305a\u306b StaticModInt<> \u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5b9a\u6570\u500d\u9ad8\u901f\u5316\u306e\u305f\u3081\u306e\u95a2\u6570\u3067\u3059\u3002 \u306b 0 \u672a\u6e80\u307e\u305f\u306f mod \u4ee5\u4e0a\u306e\u5024\u3092\u5165\u308c\u305f\u5834\u5408\u306e\u6319\u52d5\u306f\u672a\u5b9a\u7fa9\u3067\u3059\u3002\n /// \u5236\u7d04: 0\u2264||<mod\n /// \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt Raw(int v)\n {\n var u = unchecked((uint)v);\n Debug.Assert(u < Mod);\n return new StaticModInt(u);\n }\n\n /// \n /// StaticModInt<> \u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u304c 0 \u672a\u6e80\u3001\u3082\u3057\u304f\u306f mod \u4ee5\u4e0a\u306e\u5834\u5408\u3001\u81ea\u52d5\u3067 mod \u3092\u53d6\u308a\u307e\u3059\u3002\n /// \n public StaticModInt(long v) : this(Round(v)) { }\n\n private StaticModInt(uint v) => _v = v;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private static uint Round(long v)\n {\n var x = v % default(T).Mod;\n if (x < 0)\n {\n x += default(T).Mod;\n }\n return (uint)x;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt operator ++(StaticModInt value)\n {\n var v = value._v + 1;\n if (v == default(T).Mod)\n {\n v = 0;\n }\n return new StaticModInt(v);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt operator --(StaticModInt value)\n {\n var v = value._v;\n if (v == 0)\n {\n v = default(T).Mod;\n }\n return new StaticModInt(v - 1);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt operator +(StaticModInt lhs, StaticModInt rhs)\n {\n var v = lhs._v + rhs._v;\n if (v >= default(T).Mod)\n {\n v -= default(T).Mod;\n }\n return new StaticModInt(v);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt operator -(StaticModInt lhs, StaticModInt rhs)\n {\n unchecked\n {\n var v = lhs._v - rhs._v;\n if (v >= default(T).Mod)\n {\n v += default(T).Mod;\n }\n return new StaticModInt(v);\n }\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt operator *(StaticModInt lhs, StaticModInt rhs)\n {\n return new StaticModInt((uint)((ulong)lhs._v * rhs._v % default(T).Mod));\n }\n\n /// \n /// \u9664\u7b97\u3092\u884c\u3044\u307e\u3059\u3002\n /// \n /// \n /// - \u5236\u7d04: \u306b\u4e57\u6cd5\u306e\u9006\u5143\u304c\u5b58\u5728\u3059\u308b\u3002\uff08gcd(, mod) = 1\uff09\n /// - \u8a08\u7b97\u91cf: O(log(mod))\n /// \n public static StaticModInt operator /(StaticModInt lhs, StaticModInt rhs) => lhs * rhs.Inverse();\n\n public static StaticModInt operator +(StaticModInt value) => value;\n public static StaticModInt operator -(StaticModInt value) => new StaticModInt() - value;\n public static bool operator ==(StaticModInt lhs, StaticModInt rhs) => lhs._v == rhs._v;\n public static bool operator !=(StaticModInt lhs, StaticModInt rhs) => lhs._v != rhs._v;\n public static implicit operator StaticModInt(int value) => new StaticModInt(value);\n public static implicit operator StaticModInt(long value) => new StaticModInt(value);\n\n /// \n /// \u81ea\u8eab\u3092 x \u3068\u3057\u3066\u3001x^ \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5236\u7d04: 0\u2264||\n /// \u8a08\u7b97\u91cf: O(log())\n /// \n public StaticModInt Pow(long n)\n {\n Debug.Assert(0 <= n);\n var x = this;\n var r = Raw(1);\n\n while (n > 0)\n {\n if ((n & 1) > 0)\n {\n r *= x;\n }\n x *= x;\n n >>= 1;\n }\n\n return r;\n }\n\n /// \n /// \u81ea\u8eab\u3092 x \u3068\u3057\u3066\u3001 xy\u22611 \u306a\u308b y \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5236\u7d04: gcd(x, mod) = 1\n /// \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public StaticModInt Inverse()\n {\n if (default(T).IsPrime)\n {\n Debug.Assert(_v > 0);\n return Pow(default(T).Mod - 2);\n }\n else\n {\n var (g, x) = InternalMath.InvGCD(_v, default(T).Mod);\n Debug.Assert(g == 1);\n return new StaticModInt(x);\n }\n }\n\n public override string ToString() => _v.ToString();\n public override bool Equals(object obj) => obj is StaticModInt && Equals((StaticModInt)obj);\n public bool Equals(StaticModInt other) => Value == other.Value;\n public override int GetHashCode() => _v.GetHashCode();\n }\n\n /// \n /// \u56db\u5247\u6f14\u7b97\u6642\u306b\u81ea\u52d5\u3067 mod \u3092\u53d6\u308b\u6574\u6570\u578b\u3002\u5b9f\u884c\u6642\u306b mod \u304c\u6c7a\u307e\u308b\u5834\u5408\u3067\u3082\u4f7f\u7528\u53ef\u80fd\u3067\u3059\u3002\n /// \n /// \n /// \u4f7f\u7528\u524d\u306b DynamicModInt<>.Mod \u306b mod \u306e\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n /// \n /// mod \u306e ID \u3092\u8868\u3059\u69cb\u9020\u4f53\n /// \n /// \n /// using AtCoder.ModInt = AtCoder.DynamicModInt<AtCoder.ModID0>;\n ///\n /// void SomeMethod()\n /// {\n /// ModInt.Mod = 1000000009;\n /// var m = new ModInt(1);\n /// m -= 2;\n /// Console.WriteLine(m); // 1000000008\n /// }\n /// \n /// \n public readonly struct DynamicModInt : IEquatable> where T : struct, IDynamicModID\n {\n private readonly uint _v;\n private static Barrett bt;\n\n /// \n /// \u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n public int Value => (int)_v;\n\n /// \n /// mod \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n public static int Mod\n {\n get => (int)bt.Mod;\n set\n {\n Debug.Assert(1 <= value);\n bt = new Barrett((uint)value);\n }\n }\n\n /// \n /// \u306b\u5bfe\u3057\u3066 mod \u3092\u53d6\u3089\u305a\u306b DynamicModInt<> \u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5b9a\u6570\u500d\u9ad8\u901f\u5316\u306e\u305f\u3081\u306e\u95a2\u6570\u3067\u3059\u3002 \u306b 0 \u672a\u6e80\u307e\u305f\u306f mod \u4ee5\u4e0a\u306e\u5024\u3092\u5165\u308c\u305f\u5834\u5408\u306e\u6319\u52d5\u306f\u672a\u5b9a\u7fa9\u3067\u3059\u3002\n /// \u5236\u7d04: 0\u2264||<mod\n /// \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt Raw(int v)\n {\n var u = unchecked((uint)v);\n Debug.Assert(bt != null, $\"\u4f7f\u7528\u524d\u306b {nameof(DynamicModInt)}<{nameof(T)}>.{nameof(Mod)} \u30d7\u30ed\u30d1\u30c6\u30a3\u306b mod \u306e\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\");\n Debug.Assert(u < Mod);\n return new DynamicModInt(u);\n }\n\n /// \n /// DynamicModInt<> \u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u307e\u3059\u3002\n /// \n /// \n /// - \u4f7f\u7528\u524d\u306b DynamicModInt<>.Mod \u306b mod \u306e\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n /// - \u304c 0 \u672a\u6e80\u3001\u3082\u3057\u304f\u306f mod \u4ee5\u4e0a\u306e\u5834\u5408\u3001\u81ea\u52d5\u3067 mod \u3092\u53d6\u308a\u307e\u3059\u3002\n /// \n public DynamicModInt(long v) : this(Round(v)) { }\n\n private DynamicModInt(uint v) => _v = v;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private static uint Round(long v)\n {\n Debug.Assert(bt != null, $\"\u4f7f\u7528\u524d\u306b {nameof(DynamicModInt)}<{nameof(T)}>.{nameof(Mod)} \u30d7\u30ed\u30d1\u30c6\u30a3\u306b mod \u306e\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\");\n var x = v % bt.Mod;\n if (x < 0)\n {\n x += bt.Mod;\n }\n return (uint)x;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt operator ++(DynamicModInt value)\n {\n var v = value._v + 1;\n if (v == bt.Mod)\n {\n v = 0;\n }\n return new DynamicModInt(v);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt operator --(DynamicModInt value)\n {\n var v = value._v;\n if (v == 0)\n {\n v = bt.Mod;\n }\n return new DynamicModInt(v - 1);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt operator +(DynamicModInt lhs, DynamicModInt rhs)\n {\n var v = lhs._v + rhs._v;\n if (v >= bt.Mod)\n {\n v -= bt.Mod;\n }\n return new DynamicModInt(v);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt operator -(DynamicModInt lhs, DynamicModInt rhs)\n {\n unchecked\n {\n var v = lhs._v - rhs._v;\n if (v >= bt.Mod)\n {\n v += bt.Mod;\n }\n return new DynamicModInt(v);\n }\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt operator *(DynamicModInt lhs, DynamicModInt rhs)\n {\n uint z = bt.Mul(lhs._v, rhs._v);\n return new DynamicModInt(z);\n }\n\n /// \n /// \u9664\u7b97\u3092\u884c\u3044\u307e\u3059\u3002\n /// \n /// \n /// - \u5236\u7d04: \u306b\u4e57\u6cd5\u306e\u9006\u5143\u304c\u5b58\u5728\u3059\u308b\u3002\uff08gcd(, mod) = 1\uff09\n /// - \u8a08\u7b97\u91cf: O(log(mod))\n /// \n public static DynamicModInt operator /(DynamicModInt lhs, DynamicModInt rhs) => lhs * rhs.Inverse();\n\n public static DynamicModInt operator +(DynamicModInt value) => value;\n public static DynamicModInt operator -(DynamicModInt value) => new DynamicModInt() - value;\n public static bool operator ==(DynamicModInt lhs, DynamicModInt rhs) => lhs._v == rhs._v;\n public static bool operator !=(DynamicModInt lhs, DynamicModInt rhs) => lhs._v != rhs._v;\n public static implicit operator DynamicModInt(int value) => new DynamicModInt(value);\n public static implicit operator DynamicModInt(long value) => new DynamicModInt(value);\n\n /// \n /// \u81ea\u8eab\u3092 x \u3068\u3057\u3066\u3001x^ \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5236\u7d04: 0\u2264||\n /// \u8a08\u7b97\u91cf: O(log())\n /// \n public DynamicModInt Pow(long n)\n {\n Debug.Assert(0 <= n);\n var x = this;\n var r = Raw(1);\n\n while (n > 0)\n {\n if ((n & 1) > 0)\n {\n r *= x;\n }\n x *= x;\n n >>= 1;\n }\n\n return r;\n }\n\n /// \n /// \u81ea\u8eab\u3092 x \u3068\u3057\u3066\u3001 xy\u22611 \u306a\u308b y \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5236\u7d04: gcd(x, mod) = 1\n /// \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public DynamicModInt Inverse()\n {\n var (g, x) = InternalMath.InvGCD(_v, bt.Mod);\n Debug.Assert(g == 1);\n return new DynamicModInt(x);\n }\n\n public override string ToString() => _v.ToString();\n public override bool Equals(object obj) => obj is DynamicModInt && Equals((DynamicModInt)obj);\n public bool Equals(DynamicModInt other) => Value == other.Value;\n public override int GetHashCode() => _v.GetHashCode();\n }\n\n /// \n /// Fast moduler by barrett reduction\n /// \n /// \n public class Barrett\n {\n public uint Mod { get; private set; }\n private ulong IM;\n public Barrett(uint m)\n {\n Mod = m;\n IM = unchecked((ulong)-1) / m + 1;\n }\n\n /// \n /// * mod m\n /// \n public uint Mul(uint a, uint b)\n {\n ulong z = a;\n z *= b;\n if (!Bmi2.X64.IsSupported) return (uint)(z % Mod);\n var x = Bmi2.X64.MultiplyNoFlags(z, IM);\n var v = unchecked((uint)(z - x * Mod));\n if (Mod <= v) v += Mod;\n return v;\n }\n }\n\n public static class InternalMath\n {\n /// \n /// g=gcd(a,b),xa=g(mod b) \u3068\u306a\u308b\u3088\u3046\u306a 0\u2264x<b/g \u306e(g, x)\n /// \n /// \n /// \u5236\u7d04: 1\u2264\n /// \n public static (long, long) InvGCD(long a, long b)\n {\n a = SafeMod(a, b);\n if (a == 0) return (b, 0);\n\n long s = b, t = a;\n long m0 = 0, m1 = 1;\n\n long u;\n while (true)\n {\n if (t == 0)\n {\n if (m0 < 0) m0 += b / s;\n return (s, m0);\n }\n u = s / t;\n s -= t * u;\n m0 -= m1 * u;\n\n if (s == 0)\n {\n if (m1 < 0) m1 += b / t;\n return (t, m1);\n }\n u = t / s;\n t -= s * u;\n m1 -= m0 * u;\n }\n }\n\n public static long SafeMod(long x, long m)\n {\n x %= m;\n if (x < 0) x += m;\n return x;\n }\n }\n\n public class ModCombination where T : struct, IStaticMod\n {\n readonly StaticModInt[] _factorials;\n readonly StaticModInt[] _invFactorials;\n\n public ModCombination(int max = 1000000)\n {\n if (max >= default(T).Mod)\n {\n ThrowArgumentOutOfRangeException();\n }\n\n _factorials = new StaticModInt[max + 1];\n _invFactorials = new StaticModInt[max + 1];\n\n _factorials[0] = _factorials[1] = StaticModInt.Raw(1);\n _invFactorials[0] = _invFactorials[1] = StaticModInt.Raw(1);\n\n for (int i = 2; i < _factorials.Length; i++)\n {\n _factorials[i] = _factorials[i - 1] * StaticModInt.Raw(i);\n }\n\n _invFactorials[^1] = _factorials[^1].Inverse();\n\n for (int i = _invFactorials.Length - 2; i >= 0; i--)\n {\n _invFactorials[i] = _invFactorials[i + 1] * StaticModInt.Raw(i + 1);\n }\n }\n\n public StaticModInt Factorial(int n) => _factorials[n];\n\n public StaticModInt Permutation(int n, int k) => _factorials[n] * _invFactorials[n - k];\n\n public StaticModInt Combination(int n, int k) => _factorials[n] * _invFactorials[k] * _invFactorials[n - k];\n\n public StaticModInt CombinationWithRepetition(int n, int k) => Combination(n + k - 1, k);\n\n public void ThrowArgumentOutOfRangeException() => throw new ArgumentOutOfRangeException();\n }\n}\n\nnamespace CodeforcesRound678Div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionC();\n using var io = new IOManager(Console.OpenStandardInput(), Console.OpenStandardOutput());\n question.Solve(io);\n }\n }\n}\n\n#region Base Class\n\nnamespace CodeforcesRound678Div2.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 CodeforcesRound678Div2\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 value, T other) where T : struct, IComparable\n {\n if (value.CompareTo(other) < 0)\n {\n value = other;\n return true;\n }\n return false;\n }\n\n public static bool ChangeMin(ref this T value, T other) where T : struct, IComparable\n {\n if (value.CompareTo(other) > 0)\n {\n value = other;\n return true;\n }\n return false;\n }\n\n public static void SwapIfLargerThan(ref this T a, ref T b) where T : struct, IComparable\n {\n if (a.CompareTo(b) > 0)\n {\n (a, b) = (b, a);\n }\n }\n\n public static void SwapIfSmallerThan(ref this T a, ref T b) where T : struct, IComparable\n {\n if (a.CompareTo(b) < 0)\n {\n (a, b) = (b, a);\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 public static class CollectionExtensions\n {\n private class ArrayWrapper\n {\n#pragma warning disable CS0649\n public T[] Array;\n#pragma warning restore CS0649\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static Span AsSpan(this List list)\n {\n return Unsafe.As>(list).Array.AsSpan(0, list.Count);\n }\n\n public static void Fill(this T[] array, T value) => array.AsSpan().Fill(value);\n public static void Fill(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);\n public static void Fill(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);\n public static void Fill(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);\n }\n}\n\n#endregion\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "97b4939124ab16a4562e743f078d8583", "src_uid": "24e2f10463f440affccc2755f4462d8a", "difficulty": 1500.0} {"lang": ".NET Core C#", "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 n = ni();\n var x = ni();\n var pos = ni();\n cout.WriteLine(Solve(n, x, pos));\n }\n\n private ModInt Solve(int n, int x, int pos) {\n int smaller = 0, bigger = 0;\n int left = 0, right = n;\n while (left < right) {\n var mid = (left + right) / 2;\n if (mid <= pos) { // a[mid] <= a[pos]\n left = mid + 1;\n if (mid != pos) smaller++;\n } else { // a[mid] > a[pos]\n right = mid;\n bigger++;\n }\n }\n ModInt.SetMod1000000007();\n ModInt ans = 1;\n for (int i = 0; i < smaller; i++) {\n ans *= (x - 1 - i);\n }\n for (int i = 0; i < bigger; i++) {\n ans *= ((n - x) - i);\n }\n for (int i = 1; i <= (n - 1 - smaller - bigger); i++) {\n ans *= i;\n }\n return ans;\n }\n}\n\n\n\npublic partial struct ModInt : IEquatable {\n private static int mod = 0;\n private long _value;\n\n public ModInt(long x) {\n _value = x;\n Normalize();\n }\n\n private static long RegularMod(long x, int mod) {\n if (x >= mod) {\n if (x < 2 * mod) {\n return x - mod;\n }\n\n return x % mod;\n }\n if (x >= 0) {\n return x;\n }\n\n x = mod - RegularMod(-x, mod);\n return x == mod ? 0 : x;\n }\n\n public static int SetModValue(int m) {\n return mod = m;\n }\n public static int SetMod998244353() { return SetModValue(998244353); }\n public static int SetMod1000000007() { return SetModValue(1000000007); }\n\n private void Normalize() {\n _value = RegularMod(_value, mod);\n }\n\n public override string ToString() {\n return _value.ToString(CultureInfo.InvariantCulture);\n }\n\n public int ToInt() {\n return (int)_value;\n }\n\n public static bool operator ==(ModInt c1, ModInt c2) {\n return c1._value == c2._value;\n }\n\n public static bool operator !=(ModInt c1, ModInt c2) {\n return !(c1 == c2);\n }\n\n public static ModInt operator +(ModInt x, ModInt y) {\n return new ModInt(x._value + y._value);\n }\n public static ModInt operator -(ModInt x, ModInt y) {\n return new ModInt(x._value - y._value);\n }\n public static ModInt operator -(ModInt x) {\n return new ModInt(-x._value);\n }\n public static ModInt operator *(ModInt x, ModInt y) {\n return new ModInt(x._value * y._value);\n }\n public static ModInt operator /(ModInt x, ModInt y) {\n return new ModInt(x._value * Inverse(y._value, mod));\n }\n public static ModInt operator ++(ModInt x) {\n return x + 1;\n }\n public static ModInt operator --(ModInt x) {\n return x - 1;\n }\n public static ModInt Pow(ModInt x, long n) {\n ModInt r = 1;\n while (n > 0) {\n if ((n & 1) != 0) {\n r *= x;\n }\n\n x *= x;\n n >>= 1;\n }\n return r;\n }\n private static long ExtendedGcd(long a, long b, out long x, out long y) {\n if (b == 0) {\n x = 1; y = 0;\n return a;\n } else {\n var d = ExtendedGcd(b, a % b, out y, out x);\n y -= a / b * x;\n return d;\n }\n }\n\n private static long Inverse(long a, long mod) {\n long x = 0, y = 0;\n if (ExtendedGcd(a, mod, out x, out y) == 1) {\n return (x + mod) % mod;\n } else {\n throw new Exception(\"Invalid inverse \" + a + \" \" + mod);\n }\n }\n\n public static implicit operator ModInt(long x) {\n return new ModInt(x);\n }\n\n public override bool Equals(object obj) {\n if (obj == null) {\n return false;\n }\n return _value.Equals(((ModInt)obj)._value);\n }\n\n public override int GetHashCode() {\n return _value.GetHashCode();\n }\n\n public bool Equals(ModInt other) {\n return _value.Equals(other._value);\n }\n object ToDump() { return _value; }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d82205ff9f925b45a6d7e7ceddc6e2c", "src_uid": "24e2f10463f440affccc2755f4462d8a", "difficulty": 1500.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Mathematics;\n\npublic class Program\n{\n private int N, X, Pos;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n X = sc.NextInt();\n Pos = sc.NextInt();\n\n List g = new List();\n List l = new List();\n int left = 0;\n int right = N;\n while (left < right)\n {\n int middle = (left + right) / 2;\n if (middle <= Pos)\n {\n l.Add(middle);\n left = middle + 1;\n }\n else\n {\n g.Add(middle);\n right = middle;\n }\n }\n\n // x\u672a\u6e80 len(l)-1\u500b\n // x\u8d85\u904e len(g)\u500b\n\n // \u306e\u3053\u308a\u3066\u304d\u3068\u3046\n\n var c = new BinomialCoefficient(5000);\n ModInt ans = c.fact[X - 1] * c.ifact[(X - 1) - (l.Count - 1)];\n ans *= c.fact[N - X] * c.ifact[(N - X) - g.Count];\n ans *= c.fact[N - (l.Count + g.Count)];\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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "20e2d6304477bfa0a193c83f111ffc76", "src_uid": "24e2f10463f440affccc2755f4462d8a", "difficulty": 1500.0} {"lang": "MS C#", "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 N = re.i();\n int K = re.i();\n long count = 0;\n for(int i=0;i<=K;i++){\n if(i == 0){\n count++;\n }\n else if(i == 2){\n count += N*(N-1)/2;\n }\n else if(i == 3){\n count += N*(N-1)*(N-2)/3;\n }\n else if(i == 4){\n count += N*(N-1)*(N-2)*(N-3)/24*9;\n }\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 '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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cb628de6fd88a6544ce65713139841f8", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "MS C#", "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 ed32d\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 //var d1 = new Dictionary();\n //for (int i = 0; i < 4; i++)\n //{\n // for (int j = 0; j < 4; j++)\n // {\n // for (int m = 0; m < 4; m++)\n // {\n // for (int h = 0; h < 4; h++)\n // {\n // var val = string.Format(\"{0}{1}{2}{3}\", i + 1, j + 1, m + 1, h + 1);\n // if (i != 0 && j != 1 && m != 2 && h != 3 && !d1.ContainsKey(val))\n // {\n // if (i != j && i != m && i != h && j != m && j != h && m != h)\n // {\n // d1[val] = 1;\n // }\n \n // }\n // }\n // }\n // }\n //}\n\n\n #region SOLUTION\n var d = readLongArray();\n var n = d[0];\n var k = d[1];\n\n var total = 1L;\n if (k == 1)\n {\n Console.WriteLine(total);\n return;\n }\n\n total += (n * (n - 1) / 2);\n if (k == 2)\n {\n Console.WriteLine(total);\n return;\n }\n\n var c = (n * (n - 1) * (n - 2) / (2L * 3));\n total += (c * 2);\n if (k == 3)\n {\n Console.WriteLine(total);\n return;\n }\n\n var c2 = (n * (n - 1) * (n - 2) * (n - 3) / (2L * 3 * 4));\n total += (c2 * 9);\n\n if (k == 4)\n {\n Console.WriteLine(total);\n return;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b4eb66992798eb40a0d964e820f648c4", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n int N, K;\n public void Solve()\n {\n checked\n {\n var sc = new Scanner();\n N = sc.NextInt();\n K = sc.NextInt();\n\n /*\n * n\u9806\u5217p\n * \n * n-k\u500b\u4ee5\u4e0a p_i = i\n * \n * \n */\n\n\n long ans = 0;\n for (int i = 0; i <= K; i++)\n {\n // i\u500b\u9078\u3076\n // i\u500b\u4e26\u3079\u308b\n // !i\n\n ans += C(N, i) * A(i);\n }\n ans++;\n\n Console.WriteLine(ans);\n }\n }\n\n long C(int n, int m)\n {\n long r = 1;\n for (int i = 0; i < m; i++)\n {\n r *= n - i;\n }\n\n for (int i = 1; i <= m; i++)\n {\n r /= i;\n }\n return r;\n }\n\n long A(int n)\n {\n if (n <= 1) return 0;\n if (n == 2) return 1;\n else return (n - 1) * (A(n - 1) + A(n - 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "019251ccb94cd856a226396446e973c0", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "MS C#", "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 C(int n, int m)\n {\n long ret = 1;\n for (int i = 1; i <= n - m; i++)\n ret = ret * (n - i + 1);\n for (int i = 1; i <= n - m; i++)\n ret /= i;\n return ret;\n }\n\n public void Solve()\n {\n var v = new [] { 0, 1, 2, 9 };\n int n = ReadInt();\n int m = ReadInt();\n\n long ans = 1;\n for (int i = Math.Max(0, n - m); i < n; i++)\n ans += C(n, i) * v[n - i - 1];\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a6e441f684c952da720b444703e6e4e2", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "Mono C#", "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 int N, K;\n sc.Make(out N, out K);\n var res = 1L;\n var ct = new int[K+1];\n for(int l = 2; l <= K; l++)\n {\n foreach(var e in Permutations(Enumerable.Range(0, l).ToArray()))\n {\n var c = 0;\n for (int k = 0; k < e.Length; k++) if (k != e[k]) c++;\n if (c == l) ct[l]++;\n }\n }\n for (int k = 2; k <= K; k++)\n res += ct[k] * Perm(N, k) / Perm(k, k);\n Console.WriteLine(res);\n }\n public long Perm(int n,int r)\n {\n return Enumerable.Range(n - r + 1, r).Aggregate(1L, (a, b) => a * b);\n }\n static IEnumerable Permutations(T[] array) where T : IComparable\n {\n int index = 0;\n yield return array;\n while (true)\n {\n for (int i = array.Length - 1; i > 0; i--)\n {\n if (array[i - 1].CompareTo(array[i]) >= 0) continue;\n int j = Array.FindLastIndex(array, x => array[i - 1].CompareTo(x) < 0);\n T tmp = array[i - 1]; array[i - 1] = array[j]; array[j] = tmp;\n Array.Reverse(array, i, array.Length - i);\n yield return array;\n goto end;\n }\n Array.Reverse(array, index, array.Length);\n yield break;\n end:;\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6cd121671c9141ac24a4086d535f33d0", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeff//#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 \n\t\t\t while (t-- > 0)\n {\n \n Solve();\n }\n //Console.WriteLine();\n }\n\n#endif\n #endregion\n\n #region Solution\n \n\nstatic int []id;\n static int root(int x)\n{\n while(id[x] != x)\n {\n id[x] = id[id[x]];\n x = id[x];\n }\n return x;\n}\n\nstatic void union1(int x, int y)\n{\n int p = root(x);\n int q = root(y);\n id[p] = id[q];\n}\n\nstatic long gcd(int a,int b)\n{\n \n if(a==0)\n return (long)b;\n return gcd(b%a,a);\n}\n\n\n\n /// \n /// Solution\n /// \n private static void Solve()\n {\n \n long n=Console.NextInt();\n long k=Console.NextInt();\n long sum=1;\n if(k>1&&k>=2)\n sum+=(n*(n-1))/2;\n if(k>1&&k>=3)\n sum+=(n*(n-1)*(n-2))/3;\n if(k>1&&k>=4)\n sum+=(n*(n-1)*(n-2)*(n-3)*6)/16;\n\n\n \n Console.WriteLine(sum);\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 public char NextChar() => (char)Read();\n\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 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 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 public double NextDouble() => double.Parse(Next());\n\n \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 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 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 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 \n\n \n \n public static string Join(this IEnumerable e, string separator = \"\") => new StringBuilder().AppendJoin(e, separator).ToString();\n\n \n public static string Join(this IEnumerable e, char separator) => new StringBuilder().AppendJoin(e, separator).ToString();\n\n \n \n\n \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 pair or not\n /// \n /// Number to test\n /// True if the number is pair, false otherwise\n public static bool IsPair(this int n) => (n & 1) == 0;\n\n /// \n /// Tests if the given number is pair or not\n /// \n /// Number to test\n /// True if the number is pair, false otherwise\n public static bool IsPair(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 /// Returns the triangle number of the current number\n /// \n /// Integer to get the triangle number from\n /// The resulting triangle number\n public static int Triangle(this int n) => (n * (n + 1)) / 2;\n\n /// \n /// Returns the triangle number of the current number\n /// \n /// Long to get the triangle number from\n /// The resulting triangle number\n public static long Triangle(this long n) => (n * (n + 1L)) / 2L;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bef896ac882f8c496cfb1e437ac03155", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Almost_Identity_Permutations\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 private static readonly long[,] C = new long[1000,5];\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 k = Next();\n\n long ans = 1;\n var m = new[] {0, 1, 1, 2, 9};\n for (int i = 2; i <= k; i++)\n {\n ans += GetC(n, i)*m[i];\n }\n\n return ans;\n }\n\n private static long GetC(int n, int k)\n {\n if (n < k)\n {\n int c = k;\n k = n;\n n = c;\n }\n if (k == 0 || k == n)\n return 1;\n\n if (C[n, k] != 0)\n return C[n, k];\n\n return C[n, k] = GetC(n - 1, k - 1) + GetC(n - 1, k);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b0470328202ada0c6c40cf7fb9b65e69", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "Mono C#", "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 string S = sc.Str, T = sc.Str;\n bool[] uses = new bool[S.Length], uset = new bool[T.Length];\n var dp = Create(S.Length + 1, () => new int[T.Length+1]);\n for(int i=0;i= idx - ct; j--)\n uses[j] = true;\n }\n i = idx;\n }\n idx = 0;\n for (int i = 0; i < T.Length;)\n {\n var ct = 0;\n while (idx < T.Length && T[i] == T[idx])\n {\n if (uset[idx]) ct++;\n idx++;\n }\n for (int j = i; j < idx; j++)\n uset[j] = false;\n if (T[i] == ')')\n {\n for (int j = i; j < i + ct; j++)\n uset[j] = true;\n }\n else\n {\n for (int j = idx - 1; j >= idx - ct; j--)\n uset[j] = true;\n }\n i = idx;\n }\n s = 0;t = 0;var st = 0;\n var res = new List();\n while (s < S.Length || t < T.Length)\n {\n int op = 0, cl = 0;\n while (s < S.Length && !uses[s])\n {\n if (S[s] == '(') op++;\n else cl++;\n s++;\n }\n while (t < T.Length && !uset[t])\n {\n if (T[t] == '(') op++;\n else cl++;\n t++;\n }\n st += op;\n st -= cl;\n while (st < 0) { st++; res.Add('('); }\n while (op-- > 0) res.Add('(');\n while (cl-- > 0) res.Add(')');\n if (s != S.Length)\n {\n if (S[s] == '(') st++;\n else st--;\n while (st < 0) { st++; res.Add('('); }\n \n res.Add(S[s]);\n }\n s++;t++;\n }\n var r = new List();\n while (st < 0) { r.Add('('); st++; }\n r.AddRange(res);\n while (st-- > 0) r.Add(')');\n Console.WriteLine(new string(r.ToArray()));\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "34c994dfb97d8db786070ca1fac5b876", "src_uid": "cc222aab45b3ad3d0e71227592c883f1", "difficulty": 2200.0} {"lang": "Mono C#", "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 string S = sc.Str, T = sc.Str;\n var dp = Create(S.Length + 1, () => Create(T.Length+1, () => Create(201, () => int.MaxValue / 4)));\n dp[0][0][0] = 0;\n\n for (int i = 0; i <= S.Length; i++)\n {\n for (int j = 0; j <= T.Length; j++)\n {\n for (int k = 0; k < 200; k++)\n {\n chmin(ref dp[i][j][k + 1], dp[i][j][k] + 1);\n }\n for (int k = 199; k >= 0; k--)\n {\n chmin(ref dp[i][j][k], dp[i][j][k + 1] + 1);\n }\n for (int k = 0; k < 201; k++)\n {\n if (i();\n int s = S.Length, t = T.Length, l = 0;\n while (dp[s][t][l] != 0)\n {\n for(int j = -1; j < 2; j += 2)\n {\n int n = l + j;\n if (0 <= n && n < 201 && dp[s][t][n] + 1 == dp[s][t][l])\n {\n l = n;\n if (j == -1) res.Add('(');\n else res.Add(')');\n goto END;\n }\n }\n if (s>0&&t>0&&S[s - 1] == T[t - 1])\n {\n int n = l;\n if (S[s - 1] == '(') n--;\n else n++;\n if (0 <= n && n < 201 && dp[s - 1][t - 1][n] + 1 == dp[s][t][l])\n {\n res.Add(S[s - 1]);\n s--;t--;l = n;goto END;\n }\n }\n if (s > 0)\n {\n int n = l;\n if (S[s - 1] == '(') n--;\n else n++;\n if (0 <= n && n < 201 && dp[s - 1][t][n] + 1 == dp[s][t][l])\n {\n res.Add(S[s - 1]);\n s--; l = n; goto END;\n }\n }\n if (t > 0)\n {\n int n = l;\n if (T[t - 1] == '(') n--;\n else n++;\n if (0 <= n && n < 201 && dp[s][t-1][n] + 1 == dp[s][t][l])\n {\n res.Add(T[t - 1]);\n t--; l = n; goto END;\n }\n }\n END:;\n }\n res.Reverse();\n Console.WriteLine(new string(res.ToArray()));\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b3d51d28327420b3fed625fe4a762586", "src_uid": "cc222aab45b3ad3d0e71227592c883f1", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "using System;\nnamespace CF\n{\n public class Intercal\n {\n public static void Main()\n {\n Console.WriteLine(\"INTERCAL\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b150583260a2a2d0da6553ac18665d80", "src_uid": "ef8239a0f77c538d2d9b246b86be63fe", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\n class Program\n {\n public static void Main(string[] args)\n {\n Console.WriteLine(\"C#\");\n }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "86da972ce5f205debaf33edff7f3306f", "src_uid": "ef8239a0f77c538d2d9b246b86be63fe", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\n\nclass Program\n{\n private static int[] GetCounts(int[] l, int max)\n {\n int[] count = new int[max + 1];\n for (int i = 0; i < n; i++) count[l[i]]++;\n return count;\n }\n\n private static Dictionary distsCache = new Dictionary();\n private static int[] GetDists(int vv)\n {\n if (distsCache.ContainsKey(vv))\n return distsCache[vv];\n\n int[] l = new int[n];\n\n List buf = new List() { vv };\n l[vv] = 1;\n int p = 0;\n while (p < buf.Count)\n {\n int v = buf[p++];\n foreach (var child in g[v])\n if (l[child] == 0)\n {\n l[child] = l[v] + 1;\n buf.Add(child);\n if (buf.Count == n)\n {\n for (int i = 0; i < n; i++) l[i]--;\n distsCache.Add(vv, l);\n return l;\n }\n }\n }\n\n for (int i = 0; i < n; i++) l[i]--;\n distsCache.Add(vv, l);\n\n return l;\n }\n\n private static double Try(int v)\n {\n var l = GetDists(v);\n int max = l.Max();\n\n int[] countByL = new int[max + 1];\n for (int i = 0; i < n; i++) countByL[l[i]]++;\n\n double ans = 0;\n\n double[] qq = new double[n];\n int[] id = new int[n];\n int nextId = 1;\n List vv = new List();\n\n for (int i = 0; i <= max; i++)\n {\n double p1 = 1 / (1.0 * n);\n if (countByL[i] == 1)\n {\n ans += p1;\n continue;\n }\n\n double[] q = new double[n];\n bool[] used = new bool[n];\n vv.Clear();\n\n for (int j = 0; j < n; j++)\n if (l[j] == i)\n {\n double delta = 1 / (1.0 * (n * g[j].Count));\n foreach (var ch in g[j])\n {\n q[ch] += delta;\n if (!used[ch])\n {\n used[ch] = true;\n vv.Add(ch);\n }\n }\n }\n\n double p2 = q.Max();\n\n double p3 = 0;\n for (int j = 0; j < n; j++)\n {\n nextId++;\n var l2 = GetDists(j);\n\n double qSum = 0;\n for (int ii = 0; ii < vv.Count; ii++)\n {\n int vertex = vv[ii];\n if (id[l2[vertex]] != nextId || q[vertex] > qq[l2[vertex]])\n {\n if (id[l2[vertex]] == nextId)\n qSum -= qq[l2[vertex]];\n else\n id[l2[vertex]] = nextId;\n\n qSum += q[vertex];\n qq[l2[vertex]] = q[vertex];\n }\n }\n\n p3 = Math.Max(qSum, p3);\n }\n\n ans += Math.Max(Math.Max(p1, p2), p3);\n }\n\n return ans;\n }\n\n private static int n;\n private static List[] g;\n static void Main(string[] args)\n {\n n = ReadInt();\n int m = ReadInt();\n g = ReadGraph(n, m);\n\n double best = 0;\n for (int i = 0; i < n; i++)\n {\n best = Math.Max(best, Try(i));\n if (best + 1e-7 > 1) break;\n }\n\n Console.Write(DoubleToString(best));\n }\n\n private static int Mod = 1000000007;\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 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 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(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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0b26c0868fcb7984c1af5a29de0c9fd4", "src_uid": "99b94d0c75fa6cd28091a9d71daf6cbf", "difficulty": 2900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\n\nclass Program\n{\n private static int[] GetCounts(int[] l, int max)\n {\n int[] count = new int[max + 1];\n for (int i = 0; i < n; i++) count[l[i]]++;\n return count;\n }\n\n private static Dictionary distsCache = new Dictionary();\n private static int[] GetDists(int vv)\n {\n if (distsCache.ContainsKey(vv))\n return distsCache[vv];\n\n int[] l = new int[n];\n\n List buf = new List() { vv };\n l[vv] = 1;\n int p = 0;\n while (p < buf.Count)\n {\n int v = buf[p++];\n foreach (var child in g[v])\n if (l[child] == 0)\n {\n l[child] = l[v] + 1;\n buf.Add(child);\n //if (buf.Count == n)\n //return l;\n }\n }\n\n for (int i = 0; i < n; i++) l[i]--;\n\n distsCache.Add(vv, l);\n\n return l;\n }\n\n private static double D(int x)\n {\n return 1 / (1.0 * x);\n }\n\n private static double Try(int v)\n {\n var l = GetDists(v);\n int max = l.Max();\n int[] countByL = GetCounts(l, max);\n\n double ans = 0;\n\n double[] qq = new double[n];\n int[] id = new int[n];\n int nextId = 1;\n\n for (int i = 0; i <= max; i++)\n {\n double p1 = D(n);\n if (countByL[i] == 1)\n {\n ans += p1;\n continue;\n }\n\n double[] q = new double[n];\n bool[] used = new bool[n];\n List vv = new List();\n\n for (int j = 0; j < n; j++)\n if (l[j] == i)\n {\n double delta = D(n) * D(g[j].Count);\n foreach (var ch in g[j])\n {\n q[ch] += delta;\n if (!used[ch])\n {\n used[ch] = true;\n vv.Add(ch);\n }\n }\n }\n\n double p2 = q.Max();\n\n double p3 = 0;\n for (int j = 0; j < n; j++)\n {\n nextId++;\n var l2 = GetDists(j);\n\n double qSum = 0;\n for (int ii = 0; ii < vv.Count; ii++)\n {\n int vertex = vv[ii];\n if (id[l2[vertex]] != nextId || q[vertex] > qq[l2[vertex]])\n {\n if (id[l2[vertex]] == nextId)\n qSum -= qq[l2[vertex]];\n else\n id[l2[vertex]] = nextId;\n\n qSum += q[vertex];\n qq[l2[vertex]] = q[vertex];\n }\n }\n\n p3 = Math.Max(qSum, p3);\n }\n\n ans += Math.Max(Math.Max(p1, p2), p3);\n }\n\n return ans;\n }\n\n private static void Test1()\n {\n PushTestData(@\"\n3 3\n1 2\n1 3\n2 3\");\n Console.WriteLine(\"Expected: 0.8333333\");\n }\n private static void Test2()\n {\n PushTestData(@\"\n5 4\n1 2\n3 1\n5 1\n1 4\");\n Console.WriteLine(\"Expected: 1.000000\");\n }\n private static void Test3()\n {\n PushTestData(@\"\n4 4\n1 2\n1 3\n2 3\n1 4\");\n\n Console.WriteLine(\"Expected: 0.916666666667\");\n\n }\n private static void Test4()\n {\n PushTestData(@\"\n5 5\n1 2\n2 3\n3 4\n4 5\n1 5\");\n Console.WriteLine(\"Expected: 0.90000000\");\n }\n\n private static void Test5(int n = 400)\n {\n int m = n * (n - 1) / 2;\n var sb = new StringBuilder();\n sb.AppendLine(n + \" \" + m);\n for (int i = 1; i <= n; i++)\n for (int j = i + 1; j <= n; j++)\n sb.AppendLine(i + \" \" + j);\n Console.WriteLine(\"Expected: FULL\");\n PushTestData(sb.ToString());\n }\n\n private static void Test6(int n = 400)\n {\n int m = n - 1;\n var sb = new StringBuilder();\n sb.AppendLine(n + \" \" + m);\n for (int i = 1; i < n; i++)\n sb.AppendLine(i + \" \" + (i + 1));\n Console.WriteLine(\"Expected: CHINE\");\n PushTestData(sb.ToString());\n }\n private static void Test7(int n = 400)\n {\n int m = n - 1;\n var sb = new StringBuilder();\n sb.AppendLine(n + \" \" + m);\n for (int i = 1; i < n; i++)\n sb.AppendLine(i + \" \" + (i + 1));\n sb.AppendLine(1 + \" \" + n);\n Console.WriteLine(\"Expected: CIRCLE\");\n PushTestData(sb.ToString());\n }\n private static void Test8(int n = 400)\n {\n int m = n - 1;\n var sb = new StringBuilder();\n sb.AppendLine(n + \" \" + m);\n for (int i = 2; i <= n; i++)\n {\n int prev = i - 4;\n if (prev < 0) prev = 0;\n sb.AppendLine((prev + 1) + \" \" + i);\n }\n\n Console.WriteLine(\"Expected: PLUS\");\n var str = sb.ToString();\n PushTestData(str);\n }\n\n private static Random rnd = new Random();\n private static void Test9(int n = 400)\n {\n int m = rnd.Next(n - 1, n * (n - 1) / 2);\n bool[,] mm = new bool[n, n];\n for (int i = 1; i < n; i++)\n {\n mm[i, i - 1] = true;\n mm[i - 1, i] = true;\n }\n\n for (int i = n - 1; i < m; i++)\n {\n int a = rnd.Next(n);\n int b = rnd.Next(n);\n mm[a, b] = true;\n mm[b, a] = true;\n }\n\n m = 0;\n for (int i = 0; i < n; i++)\n for (int j = i + 1; j < n; j++)\n if (mm[i, j])\n m++;\n\n var sb = new StringBuilder();\n sb.AppendLine(n + \" \" + m);\n for (int i = 0; i < n; i++)\n for (int j = i + 1; j < n; j++)\n if (mm[i, j])\n sb.AppendLine((i + 1) + \" \" + (j + 1));\n\n Console.WriteLine(\"Expected: RANDOM\");\n var str = sb.ToString();\n PushTestData(str);\n }\n\n private static int n;\n private static List[] g;\n static void Main(string[] args)\n {\n //Test9();\n //Test2();\n //Test3();\n //Test4();\n\n var dt1 = DateTime.Now;\n n = ReadInt();\n int m = ReadInt();\n g = ReadGraph(n, m);\n\n double best = 0;\n for (int i = 0; i < n; i++)\n {\n best = Math.Max(best, Try(i));\n //Console.WriteLine(i + \" \" + best);\n //if (best + 1e-7 > 1) break;\n }\n\n var dt2 = DateTime.Now;\n //Console.WriteLine(\"Total Time = \" + (dt2 - dt1).TotalMilliseconds);\n Console.Write(DoubleToString(best));\n }\n\n private static int Mod = 1000000007;\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 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 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(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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3f0b2ab123fbb7ffd9f0e2443bf944cf", "src_uid": "99b94d0c75fa6cd28091a9d71daf6cbf", "difficulty": 2900.0} {"lang": "MS C#", "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 Point = System.Numerics.Complex;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var M = sc.Long();\n for (long i = 1; i < 100020; i++)\n {\n L[i] = (i * i * i);\n }\n //Debug.WriteLine(L.AsJoinedString());\n var max = Get(M);\n var ans = dfs(M, max);\n IO.Printer.Out.WriteLine(\"{0} {1}\", max, ans);\n }\n\n long[] L = new long[100020];\n public long dfs(long X, long k)\n {\n if (k == 0)\n {\n if (X == 0) return 0;\n else return -1000000000000000;\n }\n if(X==0)\n {\n if (k > 0) return -1000000000000000;\n }\n var p = L.UpperBound(X) - 1;\n var ans = dfs(X - L[p], k - 1) + L[p];\n if (p > 0) ans = Math.Max(ans, dfs(L[p] - 1, k));\n return ans;\n }\n public long Get(long X)\n {\n var ans = 0L;\n var sum = 0L;\n for (long i = 1; i <= 100000; i++)\n {\n var v = i * i * i;\n var V = (i + 1) * (i + 1) * (i + 1);\n var k = (V - 1 - sum) / v;\n k = Math.Min(k, (X - sum) / v);\n //Debug.WriteLine(k);\n ans += k;\n sum += k * v;\n }\n Debug.WriteLine(sum);\n return ans;\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#region BinarySearch for Number[]\nstatic public partial class Algorithm\n{\n static public int LowerBound(this Number[] arr, Number v)\n {\n int l = 0, h = arr.Length - 1;\n while (l <= h)\n {\n int m = ((h + l) >> 1);\n if (arr[m] < v) l = m + 1;\n else h = m - 1;\n }\n return l;\n }\n static public int UpperBound(this Number[] a, Number v)\n {\n int l = 0, h = a.Length - 1;\n while (l <= h)\n {\n int m = ((h + l) >> 1);\n if (a[m] <= v) l = m + 1;\n else h = m - 1;\n }\n return l;\n }\n\n}\n#endregion", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8f29cfbc99669ec8be56e8839606075", "src_uid": "99b94d0c75fa6cd28091a9d71daf6cbf", "difficulty": 2900.0} {"lang": "C# 8", "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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4e0e5f15b338c28f60d09c6b4f81cfb9", "src_uid": "4022f8f796d4f2b7e43a8360bf34e35f", "difficulty": 1700.0} {"lang": "Mono C#", "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;\n sc.Make(out N, out K);\n ModInt.Build(N);\n ModInt res = 0;\n for(int i = 1; i <= N; i++)\n {\n res += ModInt.Comb(N / i-1, K-1);\n }\n Console.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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7debfaa3d952ab4bb87af277a4809b61", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\n\nnamespace Olympo\n{\n\n class Program\n {\n\n static long[] buildFact(long n, long M)\n {\n var res = new long[n + 1];\n res[0] = 1;\n for(long i = 1; i <= n; i++)\n {\n res[i] = (res[i - 1] * i) % M;\n }\n\n return res;\n }\n\n static long axar(long a, long b, long M)\n {\n a = a % M;\n if (b == 0)\n return 1;\n long res = b % 2 == 0 ? 1 : a;\n var rec = axar(a, b >> 1, M);\n res = (((rec * rec) % M) * res) % M;\n return res;\n }\n\n static long[] buildInv(long n, long M, long[] fact)\n {\n var res = new long[n + 1];\n res[0] = 1;\n for (long i = 1; i <= n; i++)\n {\n res[i] = axar(fact[i], M - 2, M);\n }\n\n return res;\n }\n\n static long getC(long n, long k, long M, long[] fact, long[] inv)\n {\n if (n < k) return 0;\n return (((fact[n] * inv[k]) % M) * inv[n - k]) % M;\n }\n\n static void Main(string[] args)\n {\n var inputs = Console.ReadLine().Split(' ').Select(long.Parse).ToList();\n long n = inputs[0], k = inputs[1];\n long M = 998244353l;\n var f = buildFact(n, M);\n var inv = buildInv(n, M, f);\n var res = 0l;\n for(long i=1;i <= n; i++)\n res = (res + getC( n / i - 1, k-1, M, f, inv ) ) % M;\n Console.WriteLine(res);\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "87caf6cf6e6fe5314d858ec9b540f0e3", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Threading;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Diagnostics;\nusing static util;\nusing P = pair;\n\nclass Program {\n static void Main(string[] args) {\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n var solver = new Solver(sw);\n // var t = new Thread(solver.solve, 1 << 26); // 64 MB\n // t.Start();\n // t.Join();\n solver.solve();\n sw.Flush();\n }\n}\n\nclass Solver {\n StreamWriter sw;\n Scan sc;\n void Prt(string a) => sw.WriteLine(a);\n void Prt(IEnumerable a) => Prt(string.Join(\" \", a));\n void Prt(params object[] a) => Prt(string.Join(\" \", a));\n public Solver(StreamWriter sw) {\n this.sw = sw;\n this.sc = new Scan();\n }\n\n public void solve() {\n int n, k;\n sc.Multi(out n, out k);\n long ans = 0;\n MyMath.setfacts(n + 1);\n for (int i = 1; i <= n; i++)\n {\n int c = n / i;\n if (c >= k) {\n ans += MyMath.comb(c - 1, k - 1);\n }\n else break;\n }\n Prt(ans % M);\n }\n}\n\nclass pair : IComparable> {\n public T v1;\n public U v2;\n public pair() : this(default(T), default(U)) {}\n public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; }\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) { a = v1; b = v2; }\n}\nstatic class util {\n // public static readonly int M = 1000000007;\n public static readonly int M = 998244353;\n public static readonly long LM = 1L << 60;\n public static readonly double eps = 1e-11;\n public static void DBG(string a) => Console.Error.WriteLine(a);\n public static void DBG(IEnumerable a) => DBG(string.Join(\" \", a));\n public static void DBG(params object[] a) => DBG(string.Join(\" \", a));\n public static void Assert(params bool[] conds) {\n if (conds.Any(x => !x)) throw new Exception();\n }\n public static pair make_pair(T v1, U v2) => new pair(v1, v2);\n public static int CompareList(IList a, IList b) where T : IComparable {\n for (int i = 0; i < a.Count && i < b.Count; i++)\n if (a[i].CompareTo(b[i]) != 0) return a[i].CompareTo(b[i]);\n return a.Count.CompareTo(b.Count);\n }\n public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;\n static readonly int[] dd = { 0, 1, 0, -1 };\n // static readonly string dstring = \"RDLU\";\n public static P[] adjacents(int i, int j)\n => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1])).ToArray();\n public static P[] adjacents(int i, int j, int h, int w)\n => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1]))\n .Where(p => inside(p.v1, p.v2, h, w)).ToArray();\n public static P[] adjacents(this P p) => adjacents(p.v1, p.v2);\n public static P[] adjacents(this P p, int h, int w) => adjacents(p.v1, p.v2, h, 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 T[] inv(this Dictionary dic) {\n var res = new T[dic.Count];\n foreach (var item in dic) res[item.Value] = item.Key;\n return res;\n }\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 public static void Deconstruct(this IList v, out T a) {\n a = v[0];\n }\n public static void Deconstruct(this IList v, out T a, out T b) {\n a = v[0]; b = v[1];\n }\n public static void Deconstruct(this IList v, out T a, out T b, out T c) {\n a = v[0]; b = v[1]; c = v[2];\n }\n public static void Deconstruct(this IList v, out T a, out T b, out T c, out T d) {\n a = v[0]; b = v[1]; c = v[2]; d = v[3];\n }\n public static void Deconstruct(this IList v, out T a, out T b, out T c, out T d, out T e) {\n a = v[0]; b = v[1]; c = v[2]; d = v[3]; e = v[4];\n }\n}\n\nclass Scan {\n StreamReader sr;\n public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }\n public Scan(string path) { sr = new StreamReader(path); }\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 => sr.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 => Pair();\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 }\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 }\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 }\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 }\n}\n\nstatic class MyMath {\n public static long Mod = util.M;\n // public static long Mod = 1000000007;\n public static bool isprime(long a) {\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 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 int[] sieve2(int n) {\n var p = new int[n + 1];\n for (int i = 2; i <= n; i++) p[i] = i;\n for (int i = 2; i * i <= n; i++) {\n if (p[i] == i)\n for (int j = i * i; j <= n; j += i)\n p[j] = Math.Min(p[j], i);\n }\n return p;\n }\n public static bool[] segmentSieve(long l, long r) {\n int sqn = (int)Math.Sqrt(r + 9);\n var ps = getprimes(sqn);\n return segmentSieve(l, r,ps);\n }\n public static bool[] segmentSieve(long l, long r, List ps) {\n var sieve = new bool[r - l + 1];\n for (long i = l; i <= r; i++) sieve[i - l] = true;\n foreach (long p in ps) {\n if (p * p > r) break;\n for (long i = p >= l ? p * p : (l + p - 1) / p * p; i <= r; i += p) sieve[i - l] = false;\n }\n return sieve;\n }\n public static List getprimes(int 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 pow(long a, long b, long mod) {\n a %= mod;\n if (b < 0) Console.Error.WriteLine($\"power number is negative ({a}^{b}).\");\n if (b <= 0) return 1;\n var t = pow(a, b / 2, mod);\n if ((b & 1) == 0) return t * t % mod;\n return t * t % mod * a % mod;\n }\n public static long pow(long a, long b) => pow(a, b, Mod);\n public static long inv(long a) => pow(a, Mod - 2);\n public static long gcd(long a, long b) {\n while (b > 0) {\n var t = a % b;\n a = b;\n b = t;\n }\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 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\n // return (r, m): x = r (mod. m)\n // return (0, -1) if no answer\n public static pair chineserem(IList b, IList m) {\n long r = 0, M = 1;\n for (int i = 0; i < b.Count; ++i) {\n long p, q;\n long d = extgcd(M, m[i], out p, out q); // p is inv of M/d (mod. m[i]/d)\n if ((b[i] - r) % d != 0) return new pair(0, -1);\n long tmp = (b[i] - r) / d * p % (m[i]/d);\n r += M * tmp;\n M *= m[i]/d;\n }\n return new pair((r % M + M) % M, M);\n }\n\n // return k: x^k = y (mod. mod) O(sqrt(mod))\n public static long modlog(long x, long y, long mod) {\n if (y == 1) return 0;\n long H = (long)Math.Sqrt(mod) + 1;\n var baby = new Dictionary();\n for (long b = 0, xby = y; b < H; b++, xby = (xby * x) % mod) {\n if (!baby.ContainsKey(xby))\n baby.Add(xby, b);\n else\n baby[xby] = b;\n }\n\n long xH = 1;\n for (int i = 0; i < H; ++i) xH = xH * x % mod;\n for (long a = 1, xaH = xH; a <= H; a++, xaH = (xaH * xH) % mod)\n if (baby.ContainsKey(xaH))\n return a * H - baby[xaH];\n\n return -1;\n }\n public static long lcm(long a, long b) => a / gcd(a, b) * b;\n\n static long[] facts, invs;\n public static void setfacts(int n) {\n facts = new long[n + 1];\n facts[0] = 1;\n for (int i = 1; i <= n; i++) facts[i] = facts[i - 1] * i % Mod;\n invs = new long[n + 1];\n invs[n] = inv(facts[n]);\n for (int i = n; i > 0 ; i--) invs[i - 1] = invs[i] * i % Mod;\n }\n public static long fact(long n) {\n if (n < 0) return 0;\n if (facts != null && facts.Length > n) return facts[n];\n long numer = 1;\n for (long i = 1; i <= n; i++) numer = numer * (i % Mod) % Mod;\n return numer;\n }\n public static long perm(long n, long r) {\n if (n < 0 || r < 0 || r > n) return 0;\n if (facts != null && facts.Length > n) return facts[n] * invs[n - r] % Mod;\n long numer = 1;\n for (long i = 0; i < r; i++) numer = numer * ((n - i) % Mod) % Mod;\n return numer;\n }\n public static long comb(long n, long r) {\n if (n < 0 || r < 0 || r > n) return 0;\n if (facts != null && facts.Length > n) return facts[n] * invs[r] % Mod * invs[n - r] % Mod;\n if (n - r < r) r = n - r;\n long numer = 1, denom = 1;\n for (long i = 0; i < r; i++) {\n numer = numer * ((n - i) % Mod) % Mod;\n denom = denom * ((i + 1) % Mod) % Mod;\n }\n return numer * inv(denom) % Mod;\n }\n public static long multi_choose(long n, long r) => comb(n + r - 1, r);\n public static long[][] getcombs(int n) {\n var ret = new long[n + 1][];\n for (int i = 0; i <= n; i++) {\n ret[i] = new long[i + 1];\n ret[i][0] = ret[i][i] = 1;\n for (int j = 1; j < i; j++) ret[i][j] = (ret[i - 1][j - 1] + ret[i - 1][j]) % Mod;\n }\n return ret;\n }\n // nC0, nC2, ..., nCn\n public static long[] getcomb(int n) {\n var ret = new long[n + 1];\n ret[0] = 1;\n for (int i = 0; i < n; i++) ret[i + 1] = ret[i] * (n - i) % Mod * inv(i + 1) % Mod;\n return ret;\n }\n\n public static class ModMatrix {\n public static long[][] E(int 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 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 long dot(long[] x, long[] y) {\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 long[][] trans(long[][] A) {\n int n = A[0].Length, m = A.Length;\n var ret = new long[n][];\n for (int i = 0; i < n; i++) { ret[i] = new long[m]; for (int j = 0; j < m; j++) ret[i][j] = A[j][i]; }\n return ret;\n }\n public static long[] mul(long a, long[] x) {\n int n = x.Length;\n var ret = new long[n];\n for (int i = 0; i < n; i++) ret[i] = a * x[i] % Mod;\n return ret;\n }\n public static long[] mul(long[][] A, long[] x) {\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[][] A) {\n int n = A.Length;\n var ret = new long[n][];\n for (int i = 0; i < n; i++) ret[i] = mul(a, A[i]);\n return ret;\n }\n public static long[][] mul(long[][] A, long[][] B) {\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 }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9153c41431f96751356a53ada9560e08", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Mathematics;\nusing CompLib.Util;\n\npublic class Program\n{\n int N;\n int K;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n K = sc.NextInt();\n ModInt[] f = new ModInt[500000];\n f[0] = 1;\n for (int i = 1; i < 500000; i++)\n {\n f[i] = f[i - 1] * i;\n }\n // \u9577\u3055K\u306e\u914d\u5217\u304c\u3042\u308b\u3000\u5404\u8981\u7d20 1<= a_i <=n\n\n // \u4efb\u610f\u306e\u975e\u8ca0\u6574\u6570x\u306b\u3064\u3044\u3066 x % a_i ... \u3092a\u3092\u4e26\u3073\u66ff\u3048\u3066\u3082\u540c\u3058\u306b\u306a\u308ba\u3092\u5b89\u5b9a\u3068\u3088\u3076\n ModInt ans = 0;\n for (int min = 1; min <= N; min++)\n {\n if (min * K > N) break;\n\n int d = (N - min * K) / min;\n\n // d\u3092K\u500b\u306b\u5206\u3051\u308b\n\n // d+K-1 C K-1\n var tmp = f[d + K - 1] * ModInt.Inverse(f[d] * f[K - 1]);\n\n // Console.WriteLine($\"{d} {tmp}\");\n ans += tmp;\n }\n\n Console.WriteLine(ans);\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 /// [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 = 998244353;\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 #endregion\n #region Binomial Coefficient\n public class 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 #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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1039398792b27b6d4a2ba647df9fa9ae", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "difficulty": 2000.0} {"lang": "C# 8", "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 string Sort(int[] a)\r\n {\r\n int n = a.Length;\r\n var b = new int[n];\r\n var log = new List();\r\n\r\n void MergeSort(int l, int r)\r\n {\r\n if (r - l <= 1)\r\n return;\r\n int m = (l + r) / 2;\r\n MergeSort(l, m);\r\n MergeSort(m, r);\r\n Write(l, r, m);\r\n int i = l;\r\n int j = m;\r\n int k = l;\r\n while (i < m && j < r)\r\n {\r\n if (a[i] < a[j])\r\n {\r\n log.Add(0);\r\n b[k] = a[i];\r\n i++;\r\n }\r\n else\r\n {\r\n log.Add(1);\r\n b[k] = a[j];\r\n j++;\r\n }\r\n k++;\r\n }\r\n while (i < m)\r\n {\r\n b[k] = a[i];\r\n i++;\r\n k++;\r\n }\r\n while (j < r)\r\n {\r\n b[k] = a[j];\r\n j++;\r\n k++;\r\n }\r\n for (int p = l; p < r; p++)\r\n a[p] = b[p];\r\n }\r\n\r\n MergeSort(0, n);\r\n return string.Concat(log);\r\n }\r\n\r\n int p;\r\n string log;\r\n int[] a, b;\r\n void Fun(int l, int r)\r\n {\r\n if (r - l <= 1)\r\n return;\r\n int m = (l + r) / 2;\r\n Fun(l, m);\r\n Fun(m, r);\r\n int i = l;\r\n int j = m;\r\n int k = l;\r\n while (i < m && j < r)\r\n {\r\n if (log[p++] == '0')\r\n {\r\n b[k] = a[i];\r\n i++;\r\n }\r\n else\r\n {\r\n b[k] = a[j];\r\n j++;\r\n }\r\n k++;\r\n }\r\n while (i < m)\r\n {\r\n b[k] = a[i];\r\n i++;\r\n k++;\r\n }\r\n while (j < r)\r\n {\r\n b[k] = a[j];\r\n j++;\r\n k++;\r\n }\r\n for (int p = l; p < r; p++)\r\n a[p] = b[p];\r\n }\r\n\r\n public void Solve()\r\n {\r\n log = ReadToken();\r\n int n = 16;\r\n a = Enumerable.Range(0, n).ToArray();\r\n b = new int[n];\r\n Fun(0, n);\r\n\r\n var ans = new int[n];\r\n for (int i = 0; i < n; i++)\r\n ans[a[i]] = i + 1;\r\n Write(n);\r\n WriteArray(ans);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "23b3656e8f59acfdb2999139ac5fcab9", "src_uid": "b2ee84d23d73947fa84faaaebfde85c8", "difficulty": -1.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6e3184dd2ac6553c970c215f425f4fc7", "src_uid": "da793333b977ed179fdba900aa604b52", "difficulty": 1600.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e996ee483a26d2d46a47f750adf9e40c", "src_uid": "da793333b977ed179fdba900aa604b52", "difficulty": 1600.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d6d2ae95bf926f162914c32149d0773e", "src_uid": "da793333b977ed179fdba900aa604b52", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "30e6099043c8098647c8df92ff1012c0", "src_uid": "da793333b977ed179fdba900aa604b52", "difficulty": 1600.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "497cf128d0feaefd1c1e988e9838b483", "src_uid": "da793333b977ed179fdba900aa604b52", "difficulty": 1600.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "367e2092bbb6d08d0b55c48e96e9ea14", "src_uid": "da793333b977ed179fdba900aa604b52", "difficulty": 1600.0} {"lang": "Mono C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "51fdb96b727247309a66037d87a8ce14", "src_uid": "da793333b977ed179fdba900aa604b52", "difficulty": 1600.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.IO;\r\nusing System.Threading;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing System.Diagnostics;\r\nusing static util;\r\nusing P = pair;\r\n\r\nclass Program {\r\n static void Main(string[] args) {\r\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\r\n var solver = new Solver(sw);\r\n // var t = new Thread(solver.solve, 1 << 28); // 256 MB\r\n // t.Start();\r\n // t.Join();\r\n solver.solve();\r\n sw.Flush();\r\n }\r\n}\r\n\r\nclass Solver {\r\n StreamWriter sw;\r\n Scan sc;\r\n void Prt(string a) => sw.WriteLine(a);\r\n void Prt(IEnumerable a) => Prt(string.Join(\" \", a));\r\n void Prt(params object[] a) => Prt(string.Join(\" \", a));\r\n public Solver(StreamWriter sw) {\r\n this.sw = sw;\r\n this.sc = new Scan();\r\n }\r\n\r\n public void solve() {\r\n string[] s = {\"1\",\"12\",\"14\",\"145\", \"15\", \"124\", \"1245\",\r\n \"125\", \"24\", \"245\", \"13\", \"123\", \"134\",\r\n \"1345\", \"135\", \"1234\", \"12345\", \"1235\", \"234\", \"2345\",\r\n \"136\", \"1236\", \"2456\", \"1346\", \"13456\", \"1356\"};\r\n\r\n var t = new string[26];\r\n for (int i = 0; i < 26; i++)\r\n {\r\n var cnt = new int[5];\r\n foreach (var item in s[i])\r\n {\r\n int c = item - '1';\r\n ++cnt[c % 3];\r\n ++cnt[3 + c / 3];\r\n }\r\n t[i] = string.Join(' ', cnt);\r\n }\r\n int n = sc.Int;\r\n for (int i = 0; i < n; i++)\r\n {\r\n var p = sc.Str;\r\n for (int j = 0; j < 26; j++)\r\n {\r\n if (p == t[j]) {\r\n sw.Write((char)('a' + j));\r\n break;\r\n }\r\n }\r\n }\r\n Prt();\r\n\r\n\r\n }\r\n}\r\n\r\nclass pair : IComparable> {\r\n public T v1;\r\n public U v2;\r\n public pair() : this(default(T), default(U)) {}\r\n public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; }\r\n public int CompareTo(pair a) {\r\n int c = Comparer.Default.Compare(v1, a.v1);\r\n return c != 0 ? c : Comparer.Default.Compare(v2, a.v2);\r\n }\r\n public override string ToString() => $\"{v1} {v2}\";\r\n public void Deconstruct(out T a, out U b) { a = v1; b = v2; }\r\n}\r\nstatic class util {\r\n public static readonly int M = 1000000007;\r\n // public static readonly int M = 998244353;\r\n public static readonly long LM = 1L << 60;\r\n public static readonly double eps = 1e-11;\r\n public static void DBG(string a) => Console.Error.WriteLine(a);\r\n public static void DBG(IEnumerable a) => DBG(string.Join(\" \", a));\r\n public static void DBG(params object[] a) => DBG(string.Join(\" \", a));\r\n public static void Assert(params bool[] conds) {\r\n if (conds.Any(x => !x)) throw new Exception();\r\n }\r\n public static pair make_pair(T v1, U v2) => new pair(v1, v2);\r\n public static int CompareList(IList a, IList b) where T : IComparable {\r\n for (int i = 0; i < a.Count && i < b.Count; i++)\r\n if (a[i].CompareTo(b[i]) != 0) return a[i].CompareTo(b[i]);\r\n return a.Count.CompareTo(b.Count);\r\n }\r\n public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;\r\n public static readonly int[] dd = { 0, 1, 0, -1 };\r\n // static readonly string dstring = \"RDLU\";\r\n public static IEnumerable

    adjacents(int i, int j) {\r\n for (int k = 0; k < 4; k++) yield return new P(i + dd[k], j + dd[k ^ 1]);\r\n }\r\n public static IEnumerable

    adjacents(int i, int j, int h, int w) {\r\n for (int k = 0; k < 4; k++) if (inside(i + dd[k], j + dd[k ^ 1], h, w))\r\n yield return new P(i + dd[k], j + dd[k ^ 1]);\r\n }\r\n public static IEnumerable

    adjacents(this P p) => adjacents(p.v1, p.v2);\r\n public static IEnumerable

    adjacents(this P p, int h, int w) => adjacents(p.v1, p.v2, h, w);\r\n public static IEnumerable all_subset(this int p) {\r\n for (int i = 0; ; i = i - p & p) {\r\n yield return i;\r\n if (i == p) break;\r\n }\r\n }\r\n public static Dictionary compress(this IEnumerable a)\r\n => a.Distinct().OrderBy(v => v).Select((v, i) => new { v, i }).ToDictionary(p => p.v, p => p.i);\r\n public static Dictionary compress(params IEnumerable[] a)\r\n => compress(a.SelectMany(x => x));\r\n public static T[] inv(this Dictionary dic) {\r\n var res = new T[dic.Count];\r\n foreach (var item in dic) res[item.Value] = item.Key;\r\n return res;\r\n }\r\n public static void swap(ref T a, ref T b) where T : struct { var t = a; a = b; b = t; }\r\n public static void swap(this IList a, int i, int j) where T : struct {\r\n var t = a[i]; a[i] = a[j]; a[j] = t;\r\n }\r\n public static T[] copy(this IList a) {\r\n var ret = new T[a.Count];\r\n for (int i = 0; i < a.Count; i++) ret[i] = a[i];\r\n return ret;\r\n }\r\n}\r\n\r\nclass Scan {\r\n StreamReader sr;\r\n public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }\r\n public Scan(string path) { sr = new StreamReader(path); }\r\n public int Int => int.Parse(Str);\r\n public long Long => long.Parse(Str);\r\n public double Double => double.Parse(Str);\r\n public string Str => ReadLine.Trim();\r\n public string ReadLine => sr.ReadLine();\r\n public pair Pair() {\r\n T a; U b;\r\n Multi(out a, out b);\r\n return new pair(a, b);\r\n }\r\n public P P => Pair();\r\n public int[] IntArr => StrArr.Select(int.Parse).ToArray();\r\n public long[] LongArr => StrArr.Select(long.Parse).ToArray();\r\n public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();\r\n public string[] StrArr => Str.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);\r\n bool eq() => typeof(T).Equals(typeof(U));\r\n T ct(U a) => (T)Convert.ChangeType(a, typeof(T));\r\n T cv(string s) => eq() ? ct(int.Parse(s))\r\n : eq() ? ct(long.Parse(s))\r\n : eq() ? ct(double.Parse(s))\r\n : eq() ? ct(s[0])\r\n : ct(s);\r\n public void Multi(out T a) => a = cv(Str);\r\n public void Multi(out T a, out U b) {\r\n var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]);\r\n }\r\n public void Multi(out T a, out U b, out V c) {\r\n var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]);\r\n }\r\n public void Multi(out T a, out U b, out V c, out W d) {\r\n var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]);\r\n }\r\n public void Multi(out T a, out U b, out V c, out W d, out X e) {\r\n var ar = StrArr;\r\n a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]); e = cv(ar[4]);\r\n }\r\n public void Multi(out T a, out U b, out V c, out W d, out X e, out Y f) {\r\n var ar = StrArr;\r\n a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]);\r\n d = cv(ar[3]); e = cv(ar[4]); f = cv(ar[5]);\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "448aca989d118957475a6ba72ca17460", "src_uid": "a3603f5ed0d8bdb7fe829342991b78e6", "difficulty": 2600.0} {"lang": "MS C#", "source_code": "using System;\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\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 List Numbers()\n {\n return !Next() ? new List() : _line.Split(' ').Select(long.Parse).ToList();\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 : IEnumerable>\n {\n private readonly List _items = new List();\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTree()\n {\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 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\nnamespace Codeforces.TaskC\n{\n public class Task\n {\n public static void Main()\n {\n var task = new Task();\n try\n {\n task.Solve();\n }\n catch (Exception ex)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(ex);\n throw;\n }\n }\n\n /*abacabadabacaba*/\n \n private long MaxSubstring(long best, long l, long r, long a, long b, int ch)\n {\n if (l > r || a > b) return best;\n if ((best >= b - a + 1) || (best >= r - l + 1)) return best;\n\n best = Math.Max(best, Math.Min(r, b) - Math.Max(l, a) + 1);\n var divide = 1 << ch;\n bool f1 = false, f2 = false;\n \n if (l == divide) l++;\n if (r == divide) r--;\n if (a == divide) a++;\n if (b == divide) b--;\n\n if (l > divide)\n {\n l -= divide;\n f1 = true;\n }\n if (r > divide)\n {\n r -= divide;\n f1 = !f1;\n }\n if (a > divide)\n {\n a -= divide;\n f2 = true;\n }\n if (b > divide)\n {\n b -= divide;\n f2 = !f2;\n }\n\n if (--ch > 1)\n {\n if (f1 && f2) best = Math.Max(Math.Max(best, divide - Math.Max(l, a)), Math.Min(r, b));\n if (f1 && !f2)\n {\n best = MaxSubstring(best, l, divide - 1, a, b, ch);\n best = MaxSubstring(best, 1, r, a, b, ch);\n }\n if (!f1 && f2)\n {\n best = MaxSubstring(best, l, r, a, divide - 1, ch);\n best = MaxSubstring(best, l, r, 1, b, ch);\n }\n if (!f1 && !f2) best = MaxSubstring(best, l, r, a, b, ch);\n if (f1 && f2)\n {\n best = MaxSubstring(best, 1, r, a, divide - 1, ch);\n best = MaxSubstring(best, l, divide - 1, 1, b, ch);\n }\n }\n\n return best;\n }\n\n void Solve()\n {\n long l1, r1, l2, r2;\n Input.Next(out l1, out r1, out l2, out r2);\n var n = MaxSubstring(0, l1, r1, l2, r2, 29);\n Console.WriteLine(n);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7920578408cf30a5e98a41ebc9a0a62b", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "difficulty": 2400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\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 List Numbers()\n {\n return !Next() ? new List() : _line.Split(' ').Select(long.Parse).ToList();\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 : IEnumerable>\n {\n private readonly List _items = new List();\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTree()\n {\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 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\nnamespace Codeforces.TaskC\n{\n public class Task\n {\n public static void Main()\n {\n var task = new Task();\n try\n {\n task.Solve();\n }\n catch (Exception ex)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(ex);\n throw;\n }\n }\n\n /*abacabadabacaba*/\n\n private long CommonLength(long l, long r, long a, long b)\n {\n return Math.Min(r, b) - Math.Max(l, a) + 1;\n }\n\n private long MaxSubstring(long best, long l, long r, long a, long b, int ch)\n {\n if ((best >= b - a + 1) || (best >= r - l + 1)) return best;\n\n best = Math.Max(best, CommonLength(l, r, a, b));\n var divide = 1 << ch--;\n bool f1 = false, f2 = false;\n \n if (l == divide) l++;\n if (r == divide) r--;\n if (a == divide) a++;\n if (b == divide) b--;\n\n if (l > divide)\n {\n l -= divide;\n f1 = true;\n }\n if (r > divide)\n {\n r -= divide;\n f1 = !f1;\n }\n if (a > divide)\n {\n a -= divide;\n f2 = true;\n }\n if (b > divide)\n {\n b -= divide;\n f2 = !f2;\n }\n\n if (ch > 0)\n {\n if (f1 && f2) best = Math.Max(Math.Max(best, divide - Math.Max(l, a)), Math.Min(r, b));\n if (f1) best = MaxSubstring(best, l, divide - 1, f2 ? 1 : a, b, ch);\n if (f2) best = MaxSubstring(best, f1 ? l : 1, r, a, divide - 1, ch);\n if (!f1 && !f2) best = MaxSubstring(best, l, r, a, b, ch);\n if (f1 && f2)\n {\n best = MaxSubstring(best, 1, r, a, divide - 1, ch);\n best = MaxSubstring(best, l, divide - 1, 1, b, ch);\n }\n }\n\n return best;\n }\n\n void Solve()\n {\n long l1, r1, l2, r2;\n Input.Next(out l1, out r1, out l2, out r2);\n l1++; r1++; l2++; r2++;\n var n = MaxSubstring(0, l1, r1, l2, r2, 29);\n Console.WriteLine(n);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e1c7a13196c4628d67cb041681e1a122", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "difficulty": 2400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\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 List Numbers()\n {\n return !Next() ? new List() : _line.Split(' ').Select(long.Parse).ToList();\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 : IEnumerable>\n {\n private readonly List _items = new List();\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTree()\n {\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 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\nnamespace Codeforces.TaskC\n{\n public class Task\n {\n public static void Main()\n {\n var task = new Task();\n try\n {\n task.Solve();\n }\n catch (Exception ex)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(ex);\n throw;\n }\n }\n\n /*abacabadabacaba*/\n\n private long CommonLength(long l, long r, long a, long b)\n {\n return Math.Min(r, b) - Math.Max(l, a) + 1;\n }\n\n private long MaxSubstring(long best, long l, long r, long a, long b, int ch)\n {\n if ((best >= b - a + 1) || (best >= r - l + 1)) return 0;\n\n var len = CommonLength(l, r, a, b);\n var divide = 1 << ch--;\n bool f1 = false, f2 = false;\n \n if (l == divide) l++;\n if (r == divide) r--;\n if (a == divide) a++;\n if (b == divide) b--;\n\n if (l > divide)\n {\n l -= divide;\n f1 ^= true;\n }\n if (r > divide)\n {\n r -= divide;\n f1 ^= true;\n }\n if (a > divide)\n {\n a -= divide;\n f2 ^= true;\n }\n if (b > divide)\n {\n b -= divide;\n f2 ^= true;\n }\n\n if (ch > 0)\n {\n if (f1 && f2) len = Math.Max(len, divide - Math.Max(l, a));\n len = Math.Max(len, MaxSubstring(len, r >= l ? l : 1, r, b >= a ? a : 1, b, ch));\n if (f1) len = Math.Max(len, MaxSubstring(len, l, divide - 1, b >= a ? a : 1, b, ch));\n if (f2) len = Math.Max(len, MaxSubstring(len, r >= l ? l : 1, r, a, divide - 1, ch));\n }\n\n return len;\n }\n\n void Solve()\n {\n var length = (1<<30) - 1; // 1 073 741 823\n long l1, r1, l2, r2;\n Input.Next(out l1, out r1, out l2, out r2);\n l1++; r1++; l2++; r2++;\n\n var n = MaxSubstring(0, l1, r1, l2, r2, 30);\n Console.WriteLine(Math.Max(0, n));\n //Console.WriteLine(GetLength(36, l1, r1, l2, r2));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "90a3cab22bb74b4c8468cc65d7aa8ab7", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "difficulty": 2400.0} {"lang": "Mono C#", "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 m = ri;\n\n\t\t\t//i-j \u304c\u6b63\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306a\u3084\u3064\n\t\t\tvar pat = new ModInt[n + 5, m + 5];\n\t\t\tpat[0, 0] = 1;\n\t\t\tfor (int i = 0; i <= n; i++)\n\t\t\t\tfor (int j = 0; j <= m; j++) {\n\t\t\t\t\tif (i < j) pat[i + 1, j] += pat[i, j];\n\t\t\t\t\tpat[i, j + 1] += pat[i, j];\n\t\t\t\t}\n\t\t\tModInt ans = 0;\n\t\t\tfor (int i = 0; i <= n; i++)\n\t\t\t\tfor (int j = 0; j <= m; j++) {\n\t\t\t\t\tif (i - j <= 0) continue;\n\t\t\t\t\t//Debug.WriteLine($\"{i} {j} {pat[j, i]} {pat[n - i, m - j]}\");\n\t\t\t\t\tans += (i - j) * pat[n - i, m - j] * pat[j, i - 1];\n\t\t\t\t}\n\t\t\t//\n\t\t\t//+--+\n\t\t\t//+-+-\n\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\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, 50000000);\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\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)998244853;\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#region Binomial Coefficient\npublic class BinomialCoefficient {\n\tpublic ModInt[] fact, ifact;\n\tpublic BinomialCoefficient(int n) {\n\t\tfact = new ModInt[n + 1];\n\t\tifact = new ModInt[n + 1];\n\t\tfact[0] = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfact[i] = fact[i - 1] * i;\n\t\tifact[n] = ModInt.Inverse(fact[n]);\n\t\tfor (int i = n - 1; i >= 0; i--)\n\t\t\tifact[i] = ifact[i + 1] * (i + 1);\n\t\tifact[0] = ifact[1];\n\t}\n\tpublic ModInt this[int n, int r] {\n\t\tget {\n\t\t\tif (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;\n\t\t\treturn fact[n] * ifact[n - r] * ifact[r];\n\t\t}\n\t}\n\tpublic ModInt RepeatedCombination(int n, int k) {\n\t\tif (k == 0) return 1;\n\t\treturn this[n + k - 1, k];\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dcf994a757acc20e2ed6fc749a2aa70a", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "difficulty": 2300.0} {"lang": "Mono C#", "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 m = ri;\n\n\t\t\tvar max = Max(n, m);\n\t\t\t//i-j \u304c\u6b63\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306a\u3084\u3064\n\t\t\tvar pat = new ModInt[max + 5, max + 5];\n\t\t\tpat[0, 0] = 1;\n\t\t\tfor (int i = 0; i <= n; i++)\n\t\t\t\tfor (int j = 0; j <= m; j++) {\n\t\t\t\t\tif (i < j) pat[i + 1, j] += pat[i, j];\n\t\t\t\t\tpat[i, j + 1] += pat[i, j];\n\t\t\t\t}\n\t\t\tModInt ans = 0;\n\t\t\tfor (int i = 0; i <= n; i++)\n\t\t\t\tfor (int j = 0; j <= m; j++) {\n\t\t\t\t\tif (i - j <= 0) continue;\n\t\t\t\t\t//Debug.WriteLine($\"{i} {j} {pat[j, i]} {pat[n - i, m - j]}\");\n\t\t\t\t\tans += (i - j) * pat[n - i, m - j] * pat[j, i - 1];\n\t\t\t\t}\n\t\t\t//\n\t\t\t//+--+\n\t\t\t//+-+-\n\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\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, 50000000);\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\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)998244853;\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#region Binomial Coefficient\npublic class BinomialCoefficient {\n\tpublic ModInt[] fact, ifact;\n\tpublic BinomialCoefficient(int n) {\n\t\tfact = new ModInt[n + 1];\n\t\tifact = new ModInt[n + 1];\n\t\tfact[0] = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfact[i] = fact[i - 1] * i;\n\t\tifact[n] = ModInt.Inverse(fact[n]);\n\t\tfor (int i = n - 1; i >= 0; i--)\n\t\t\tifact[i] = ifact[i + 1] * (i + 1);\n\t\tifact[0] = ifact[1];\n\t}\n\tpublic ModInt this[int n, int r] {\n\t\tget {\n\t\t\tif (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;\n\t\t\treturn fact[n] * ifact[n - r] * ifact[r];\n\t\t}\n\t}\n\tpublic ModInt RepeatedCombination(int n, int k) {\n\t\tif (k == 0) return 1;\n\t\treturn this[n + k - 1, k];\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "480b5303ff92bc466bf500d0527e9c73", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "difficulty": 2300.0} {"lang": "Mono C#", "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 M = cin.nextint;\n\n int W = Max(N, M);\n var dp = new ModInt[W + 1, W + 1];\n\n for (int j = 0; j <= W; j++)\n {\n dp[0, j] = 1;\n }\n for (int i = 1; i <= W; i++)\n {\n for (int j = i; j <= W; j++)\n {\n dp[i, j] = dp[i - 1, j] + dp[i, j - 1];\n }\n }\n\n var ans = new ModInt(0);\n\n for (int i = 1; i <= N; i++)\n {\n for (int j = 0; j <= M; j++)\n {\n if (i <= j) break;\n\n // (i - 1, j)\u304b\u3089\u9077\u79fb\u3057\u3066\u304d\u305f\n var ret = new ModInt(i - j);\n ret *= dp[j, i - 1];\n ret *= dp[N - i, M - j];\n\n ans += ret;\n }\n }\n WriteLine(ans);\n }\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 static long Mod = (int)998244853;\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) => 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) => Pow(v, Mod - 2);\n}\n\nclass BinomialCoefficient\n{\n public ModInt[] fact, ifact;\n /// \n /// \u306f \u672a\u6e80\u3067\u304a\u9858\u3044\u3057\u307e\u3059\u3002\n /// \n /// \n public BinomialCoefficient(ModInt _n)\n {\n int n = (int)_n.num;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fca9027028ba25877f7d10d4d089d701", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "difficulty": 2300.0} {"lang": "Mono C#", "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 m = ri;\n\n\t\t\tvar max = Max(n, m);\n\t\t\t//i-j \u304c\u6b63\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306a\u3084\u3064\n\t\t\tvar pat = new ModInt[max + 5, max + 5];\n\t\t\tpat[0, 0] = 1;\n\t\t\tfor (int i = 0; i <= max; i++)\n\t\t\t\tfor (int j = 0; j <= max; j++) {\n\t\t\t\t\tif (i < j) pat[i + 1, j] += pat[i, j];\n\t\t\t\t\tpat[i, j + 1] += pat[i, j];\n\t\t\t\t}\n\t\t\tModInt ans = 0;\n\t\t\tfor (int i = 0; i <= n; i++)\n\t\t\t\tfor (int j = 0; j <= m; j++) {\n\t\t\t\t\tif (i - j <= 0) continue;\n\t\t\t\t\t//Debug.WriteLine($\"{i} {j} {pat[j, i]} {pat[n - i, m - j]}\");\n\t\t\t\t\tans += (i - j) * pat[n - i, m - j] * pat[j, i - 1];\n\t\t\t\t}\n\t\t\t//\n\t\t\t//+--+\n\t\t\t//+-+-\n\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\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, 50000000);\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\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)998244853;\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#region Binomial Coefficient\npublic class BinomialCoefficient {\n\tpublic ModInt[] fact, ifact;\n\tpublic BinomialCoefficient(int n) {\n\t\tfact = new ModInt[n + 1];\n\t\tifact = new ModInt[n + 1];\n\t\tfact[0] = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfact[i] = fact[i - 1] * i;\n\t\tifact[n] = ModInt.Inverse(fact[n]);\n\t\tfor (int i = n - 1; i >= 0; i--)\n\t\t\tifact[i] = ifact[i + 1] * (i + 1);\n\t\tifact[0] = ifact[1];\n\t}\n\tpublic ModInt this[int n, int r] {\n\t\tget {\n\t\t\tif (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;\n\t\t\treturn fact[n] * ifact[n - r] * ifact[r];\n\t\t}\n\t}\n\tpublic ModInt RepeatedCombination(int n, int k) {\n\t\tif (k == 0) return 1;\n\t\treturn this[n + k - 1, k];\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9db4768231f498d3fbf453bf7da891d4", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "difficulty": 2300.0} {"lang": "Mono C#", "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, M;\n sc.Make(out N, out M);\n ModInt.Build(4040);\n var zero = Create(N + 1, () => new ModInt[Max(N,M) + 1]);\n for (int i = 0; i < Max(N,M) + 1; i++)\n {\n zero[0][i] = 1;\n }\n for (int i = 1; i <= N; i++)\n for (int j = i; j <= Max(M,N); j++)\n {\n zero[i][j] = zero[i - 1][j] + zero[i][j - 1];\n }\n var dp = Create(N + 1, () => new ModInt[M + 1]);\n //1,-1\u3092\u5148\u982d\u306b\u8ffd\u52a0\u3059\u308b\n for (int i = 1; i <= N; i++)\n for (int j = 0; j <= M; j++)\n {\n dp[i][j] += dp[i - 1][j];\n dp[i][j] += ModInt.Comb(i - 1 + j, i - 1);//\u5148\u982d\u306b1\u3092\u8ffd\u52a0\u3059\u308b\u3068max\u306f1\u5897\u3048\u308b\n if (j > 0)\n {\n dp[i][j] += dp[i][j - 1];\n //\u5148\u982d\u306b-1\u3092\u8ffd\u52a0\u3059\u308b\u3068max\u306f\u5143\u304b\u30890\u3067\u3042\u308b\u3082\u306e\u3092\u9664\u3044\u30661\u6e1b\u308b\n dp[i][j] -= ModInt.Comb(i + j - 1, i) - zero[i][j - 1];\n }\n }\n Console.WriteLine(dp[N][M]);\n }\n}\n\npublic struct ModInt\n{\n //public const long MOD = (int)1e9 + 7;\n public const long MOD = 998244853;\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ec3011b02c2a731892c0e2bb671ded82", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\nusing CompLib.Mathematics;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N, M;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n var t = new ModInt[N + 1, M + 1];\n t[0, 0] = 1;\n for (int i = 0; i <= N; i++)\n {\n for (int j = 0; j <= M; j++)\n {\n if (i + 1 <= N) t[i + 1, j] += t[i, j];\n if (j + 1 <= M) t[i, j + 1] += t[i, j];\n }\n }\n\n // 1\u3092i\u500b -1\u3092j\u500b\n var dp = new ModInt[N + 1, M + 1];\n\n // 0\u306b\u306a\u308b\u30d1\u30bf\u30fc\u30f3\u6570\n var dp2 = new ModInt[N + 1, M + 1];\n for (int i = 0; i <= N; i++)\n {\n for (int j = 0; j <= M; j++)\n {\n if (i == 0)\n {\n dp2[i, j] = 1;\n }\n else if (i > j)\n {\n dp2[i, j] = 0;\n }\n else\n {\n if (i - 1 >= 0)\n {\n dp2[i, j] += dp2[i - 1, j];\n }\n\n if (j - 1 >= 0)\n {\n dp2[i, j] += dp2[i, j - 1];\n }\n }\n\n if (i == 0)\n {\n dp[i, j] = 0;\n }\n else if (j == 0)\n {\n dp[i, j] = i;\n }\n else\n {\n // \u5148\u982d\u306b1\u3092\u8ffd\u52a0\u3057\u305f\n if (i - 1 >= 0)\n {\n dp[i, j] += t[i - 1, j] + dp[i - 1, j];\n }\n\n // \u5148\u982d\u306b-1\u3092\u8ffd\u52a0\u3057\u305f\n if (j - 1 >= 0)\n {\n dp[i, j] += dp[i, j - 1] - t[i, j - 1] + dp2[i, j - 1];\n }\n }\n }\n }\n\n Console.WriteLine(dp[N, M]);\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 = 998244853;\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "85a314230965a3ed109db4f382886db3", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "difficulty": 2300.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Buffers;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Runtime.Intrinsics.X86;\nusing CodeforcesRound581Div2.Questions;\nusing ModInt = CodeforcesRound581Div2.StaticModInt;\n\nnamespace CodeforcesRound581Div2.Questions\n{\n struct Mod998244853 : IStaticMod\n {\n public uint Mod => 998244853;\n public bool IsPrime => true;\n }\n\n public class QuestionE : AtCoderQuestionBase\n {\n [MethodImpl(MethodImplOptions.AggressiveOptimization)]\n public override void Solve(IOManager io)\n {\n var plus = io.ReadInt();\n var minus = io.ReadInt();\n var length = plus + minus;\n\n var result = ModInt.Zero;\n\n var comb = new ModCombination(5000);\n\n for (int sum = 1; sum <= plus; sum++)\n {\n for (int position = sum; position <= length; position += 2)\n {\n var plusCount = sum + (position - sum) / 2;\n var minusCount = position - plusCount;\n var remain = length - position;\n\n if (plusCount > plus || minusCount > minus)\n {\n continue;\n }\n\n var before = comb.Combination(position - 1, plusCount - 1);\n\n if (position > plusCount)\n {\n before -= comb.Combination(position - 1, plusCount);\n }\n\n var after = comb.Combination(remain, plus - plusCount);\n result += before * after;\n }\n }\n\n io.WriteLine(result);\n }\n }\n}\n\nnamespace CodeforcesRound581Div2\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 CodeforcesRound581Div2.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 CodeforcesRound581Div2\n{\n #region ModInt\n\n /// \n /// \u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u6c7a\u5b9a\u3059\u308b mod \u3092\u8868\u3057\u307e\u3059\u3002\n /// \n /// \n /// \n /// public readonly struct Mod1000000009 : IStaticMod\n /// {\n /// public uint Mod => 1000000009;\n /// public bool IsPrime => true;\n /// }\n /// \n /// \n public interface IStaticMod\n {\n /// \n /// mod \u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\n /// \n uint Mod { get; }\n\n /// \n /// mod \u304c\u7d20\u6570\u3067\u3042\u308b\u304b\u8b58\u5225\u3057\u307e\u3059\u3002\n /// \n bool IsPrime { get; }\n }\n\n public readonly struct Mod1000000007 : IStaticMod\n {\n public uint Mod => 1000000007;\n public bool IsPrime => true;\n }\n\n public readonly struct Mod998244353 : IStaticMod\n {\n public uint Mod => 998244353;\n public bool IsPrime => true;\n }\n\n /// \n /// \u5b9f\u884c\u6642\u306b\u6c7a\u5b9a\u3059\u308b mod \u306e ID \u3092\u8868\u3057\u307e\u3059\u3002\n /// \n /// \n /// \n /// public readonly struct ModID123 : IDynamicModID { }\n /// \n /// \n public interface IDynamicModID { }\n\n public readonly struct ModID0 : IDynamicModID { }\n public readonly struct ModID1 : IDynamicModID { }\n public readonly struct ModID2 : IDynamicModID { }\n\n /// \n /// \u56db\u5247\u6f14\u7b97\u6642\u306b\u81ea\u52d5\u3067 mod \u3092\u53d6\u308b\u6574\u6570\u578b\u3002mod \u306e\u5024\u306f\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u6c7a\u5b9a\u3057\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n /// \n /// \u5b9a\u6570 mod \u3092\u8868\u3059\u69cb\u9020\u4f53\n /// \n /// \n /// using ModInt = AtCoder.StaticModInt<AtCoder.Mod1000000007>;\n ///\n /// void SomeMethod()\n /// {\n /// var m = new ModInt(1);\n /// m -= 2;\n /// Console.WriteLine(m); // 1000000006\n /// }\n /// \n /// \n public readonly struct StaticModInt : IEquatable> where T : struct, IStaticMod\n {\n private readonly uint _v;\n\n /// \n /// \u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n public int Value => (int)_v;\n\n /// \n /// mod \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n public static int Mod => (int)default(T).Mod;\n\n public static StaticModInt Zero => new StaticModInt();\n public static StaticModInt One => new StaticModInt(1u);\n\n /// \n /// \u306b\u5bfe\u3057\u3066 mod \u3092\u53d6\u3089\u305a\u306b StaticModInt<> \u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5b9a\u6570\u500d\u9ad8\u901f\u5316\u306e\u305f\u3081\u306e\u95a2\u6570\u3067\u3059\u3002 \u306b 0 \u672a\u6e80\u307e\u305f\u306f mod \u4ee5\u4e0a\u306e\u5024\u3092\u5165\u308c\u305f\u5834\u5408\u306e\u6319\u52d5\u306f\u672a\u5b9a\u7fa9\u3067\u3059\u3002\n /// \u5236\u7d04: 0\u2264||<mod\n /// \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt Raw(int v)\n {\n var u = unchecked((uint)v);\n Debug.Assert(u < Mod);\n return new StaticModInt(u);\n }\n\n /// \n /// StaticModInt<> \u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u304c 0 \u672a\u6e80\u3001\u3082\u3057\u304f\u306f mod \u4ee5\u4e0a\u306e\u5834\u5408\u3001\u81ea\u52d5\u3067 mod \u3092\u53d6\u308a\u307e\u3059\u3002\n /// \n public StaticModInt(long v) : this(Round(v)) { }\n\n private StaticModInt(uint v) => _v = v;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private static uint Round(long v)\n {\n var x = v % default(T).Mod;\n if (x < 0)\n {\n x += default(T).Mod;\n }\n return (uint)x;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt operator ++(StaticModInt value)\n {\n var v = value._v + 1;\n if (v == default(T).Mod)\n {\n v = 0;\n }\n return new StaticModInt(v);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt operator --(StaticModInt value)\n {\n var v = value._v;\n if (v == 0)\n {\n v = default(T).Mod;\n }\n return new StaticModInt(v - 1);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt operator +(StaticModInt lhs, StaticModInt rhs)\n {\n var v = lhs._v + rhs._v;\n if (v >= default(T).Mod)\n {\n v -= default(T).Mod;\n }\n return new StaticModInt(v);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt operator -(StaticModInt lhs, StaticModInt rhs)\n {\n unchecked\n {\n var v = lhs._v - rhs._v;\n if (v >= default(T).Mod)\n {\n v += default(T).Mod;\n }\n return new StaticModInt(v);\n }\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static StaticModInt operator *(StaticModInt lhs, StaticModInt rhs)\n {\n return new StaticModInt((uint)((ulong)lhs._v * rhs._v % default(T).Mod));\n }\n\n /// \n /// \u9664\u7b97\u3092\u884c\u3044\u307e\u3059\u3002\n /// \n /// \n /// - \u5236\u7d04: \u306b\u4e57\u6cd5\u306e\u9006\u5143\u304c\u5b58\u5728\u3059\u308b\u3002\uff08gcd(, mod) = 1\uff09\n /// - \u8a08\u7b97\u91cf: O(log(mod))\n /// \n public static StaticModInt operator /(StaticModInt lhs, StaticModInt rhs) => lhs * rhs.Inverse();\n\n public static StaticModInt operator +(StaticModInt value) => value;\n public static StaticModInt operator -(StaticModInt value) => new StaticModInt() - value;\n public static bool operator ==(StaticModInt lhs, StaticModInt rhs) => lhs._v == rhs._v;\n public static bool operator !=(StaticModInt lhs, StaticModInt rhs) => lhs._v != rhs._v;\n public static implicit operator StaticModInt(int value) => new StaticModInt(value);\n public static implicit operator StaticModInt(long value) => new StaticModInt(value);\n\n /// \n /// \u81ea\u8eab\u3092 x \u3068\u3057\u3066\u3001x^ \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5236\u7d04: 0\u2264||\n /// \u8a08\u7b97\u91cf: O(log())\n /// \n public StaticModInt Pow(long n)\n {\n Debug.Assert(0 <= n);\n var x = this;\n var r = Raw(1);\n\n while (n > 0)\n {\n if ((n & 1) > 0)\n {\n r *= x;\n }\n x *= x;\n n >>= 1;\n }\n\n return r;\n }\n\n /// \n /// \u81ea\u8eab\u3092 x \u3068\u3057\u3066\u3001 xy\u22611 \u306a\u308b y \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5236\u7d04: gcd(x, mod) = 1\n /// \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public StaticModInt Inverse()\n {\n if (default(T).IsPrime)\n {\n Debug.Assert(_v > 0);\n return Pow(default(T).Mod - 2);\n }\n else\n {\n var (g, x) = InternalMath.InvGCD(_v, default(T).Mod);\n Debug.Assert(g == 1);\n return new StaticModInt(x);\n }\n }\n\n public override string ToString() => _v.ToString();\n public override bool Equals(object obj) => obj is StaticModInt && Equals((StaticModInt)obj);\n public bool Equals(StaticModInt other) => Value == other.Value;\n public override int GetHashCode() => _v.GetHashCode();\n }\n\n /// \n /// \u56db\u5247\u6f14\u7b97\u6642\u306b\u81ea\u52d5\u3067 mod \u3092\u53d6\u308b\u6574\u6570\u578b\u3002\u5b9f\u884c\u6642\u306b mod \u304c\u6c7a\u307e\u308b\u5834\u5408\u3067\u3082\u4f7f\u7528\u53ef\u80fd\u3067\u3059\u3002\n /// \n /// \n /// \u4f7f\u7528\u524d\u306b DynamicModInt<>.Mod \u306b mod \u306e\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n /// \n /// mod \u306e ID \u3092\u8868\u3059\u69cb\u9020\u4f53\n /// \n /// \n /// using AtCoder.ModInt = AtCoder.DynamicModInt<AtCoder.ModID0>;\n ///\n /// void SomeMethod()\n /// {\n /// ModInt.Mod = 1000000009;\n /// var m = new ModInt(1);\n /// m -= 2;\n /// Console.WriteLine(m); // 1000000008\n /// }\n /// \n /// \n public readonly struct DynamicModInt : IEquatable> where T : struct, IDynamicModID\n {\n private readonly uint _v;\n private static Barrett bt;\n\n /// \n /// \u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n public int Value => (int)_v;\n\n /// \n /// mod \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n public static int Mod\n {\n get => (int)bt.Mod;\n set\n {\n Debug.Assert(1 <= value);\n bt = new Barrett((uint)value);\n }\n }\n\n /// \n /// \u306b\u5bfe\u3057\u3066 mod \u3092\u53d6\u3089\u305a\u306b DynamicModInt<> \u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5b9a\u6570\u500d\u9ad8\u901f\u5316\u306e\u305f\u3081\u306e\u95a2\u6570\u3067\u3059\u3002 \u306b 0 \u672a\u6e80\u307e\u305f\u306f mod \u4ee5\u4e0a\u306e\u5024\u3092\u5165\u308c\u305f\u5834\u5408\u306e\u6319\u52d5\u306f\u672a\u5b9a\u7fa9\u3067\u3059\u3002\n /// \u5236\u7d04: 0\u2264||<mod\n /// \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt Raw(int v)\n {\n var u = unchecked((uint)v);\n Debug.Assert(bt != null, $\"\u4f7f\u7528\u524d\u306b {nameof(DynamicModInt)}<{nameof(T)}>.{nameof(Mod)} \u30d7\u30ed\u30d1\u30c6\u30a3\u306b mod \u306e\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\");\n Debug.Assert(u < Mod);\n return new DynamicModInt(u);\n }\n\n /// \n /// DynamicModInt<> \u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u307e\u3059\u3002\n /// \n /// \n /// - \u4f7f\u7528\u524d\u306b DynamicModInt<>.Mod \u306b mod \u306e\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n /// - \u304c 0 \u672a\u6e80\u3001\u3082\u3057\u304f\u306f mod \u4ee5\u4e0a\u306e\u5834\u5408\u3001\u81ea\u52d5\u3067 mod \u3092\u53d6\u308a\u307e\u3059\u3002\n /// \n public DynamicModInt(long v) : this(Round(v)) { }\n\n private DynamicModInt(uint v) => _v = v;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private static uint Round(long v)\n {\n Debug.Assert(bt != null, $\"\u4f7f\u7528\u524d\u306b {nameof(DynamicModInt)}<{nameof(T)}>.{nameof(Mod)} \u30d7\u30ed\u30d1\u30c6\u30a3\u306b mod \u306e\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\");\n var x = v % bt.Mod;\n if (x < 0)\n {\n x += bt.Mod;\n }\n return (uint)x;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt operator ++(DynamicModInt value)\n {\n var v = value._v + 1;\n if (v == bt.Mod)\n {\n v = 0;\n }\n return new DynamicModInt(v);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt operator --(DynamicModInt value)\n {\n var v = value._v;\n if (v == 0)\n {\n v = bt.Mod;\n }\n return new DynamicModInt(v - 1);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt operator +(DynamicModInt lhs, DynamicModInt rhs)\n {\n var v = lhs._v + rhs._v;\n if (v >= bt.Mod)\n {\n v -= bt.Mod;\n }\n return new DynamicModInt(v);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt operator -(DynamicModInt lhs, DynamicModInt rhs)\n {\n unchecked\n {\n var v = lhs._v - rhs._v;\n if (v >= bt.Mod)\n {\n v += bt.Mod;\n }\n return new DynamicModInt(v);\n }\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static DynamicModInt operator *(DynamicModInt lhs, DynamicModInt rhs)\n {\n uint z = bt.Mul(lhs._v, rhs._v);\n return new DynamicModInt(z);\n }\n\n /// \n /// \u9664\u7b97\u3092\u884c\u3044\u307e\u3059\u3002\n /// \n /// \n /// - \u5236\u7d04: \u306b\u4e57\u6cd5\u306e\u9006\u5143\u304c\u5b58\u5728\u3059\u308b\u3002\uff08gcd(, mod) = 1\uff09\n /// - \u8a08\u7b97\u91cf: O(log(mod))\n /// \n public static DynamicModInt operator /(DynamicModInt lhs, DynamicModInt rhs) => lhs * rhs.Inverse();\n\n public static DynamicModInt operator +(DynamicModInt value) => value;\n public static DynamicModInt operator -(DynamicModInt value) => new DynamicModInt() - value;\n public static bool operator ==(DynamicModInt lhs, DynamicModInt rhs) => lhs._v == rhs._v;\n public static bool operator !=(DynamicModInt lhs, DynamicModInt rhs) => lhs._v != rhs._v;\n public static implicit operator DynamicModInt(int value) => new DynamicModInt(value);\n public static implicit operator DynamicModInt(long value) => new DynamicModInt(value);\n\n /// \n /// \u81ea\u8eab\u3092 x \u3068\u3057\u3066\u3001x^ \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5236\u7d04: 0\u2264||\n /// \u8a08\u7b97\u91cf: O(log())\n /// \n public DynamicModInt Pow(long n)\n {\n Debug.Assert(0 <= n);\n var x = this;\n var r = Raw(1);\n\n while (n > 0)\n {\n if ((n & 1) > 0)\n {\n r *= x;\n }\n x *= x;\n n >>= 1;\n }\n\n return r;\n }\n\n /// \n /// \u81ea\u8eab\u3092 x \u3068\u3057\u3066\u3001 xy\u22611 \u306a\u308b y \u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \n /// \u5236\u7d04: gcd(x, mod) = 1\n /// \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public DynamicModInt Inverse()\n {\n var (g, x) = InternalMath.InvGCD(_v, bt.Mod);\n Debug.Assert(g == 1);\n return new DynamicModInt(x);\n }\n\n public override string ToString() => _v.ToString();\n public override bool Equals(object obj) => obj is DynamicModInt && Equals((DynamicModInt)obj);\n public bool Equals(DynamicModInt other) => Value == other.Value;\n public override int GetHashCode() => _v.GetHashCode();\n }\n\n /// \n /// Fast moduler by barrett reduction\n /// \n /// \n public class Barrett\n {\n public uint Mod { get; private set; }\n private ulong IM;\n public Barrett(uint m)\n {\n Mod = m;\n IM = unchecked((ulong)-1) / m + 1;\n }\n\n /// \n /// * mod m\n /// \n public uint Mul(uint a, uint b)\n {\n ulong z = a;\n z *= b;\n if (!Bmi2.X64.IsSupported) return (uint)(z % Mod);\n var x = Bmi2.X64.MultiplyNoFlags(z, IM);\n var v = unchecked((uint)(z - x * Mod));\n if (Mod <= v) v += Mod;\n return v;\n }\n }\n\n public static class InternalMath\n {\n /// \n /// g=gcd(a,b),xa=g(mod b) \u3068\u306a\u308b\u3088\u3046\u306a 0\u2264x<b/g \u306e(g, x)\n /// \n /// \n /// \u5236\u7d04: 1\u2264\n /// \n public static (long, long) InvGCD(long a, long b)\n {\n a = SafeMod(a, b);\n if (a == 0) return (b, 0);\n\n long s = b, t = a;\n long m0 = 0, m1 = 1;\n\n long u;\n while (true)\n {\n if (t == 0)\n {\n if (m0 < 0) m0 += b / s;\n return (s, m0);\n }\n u = s / t;\n s -= t * u;\n m0 -= m1 * u;\n\n if (s == 0)\n {\n if (m1 < 0) m1 += b / t;\n return (t, m1);\n }\n u = t / s;\n t -= s * u;\n m1 -= m0 * u;\n }\n }\n\n public static long SafeMod(long x, long m)\n {\n x %= m;\n if (x < 0) x += m;\n return x;\n }\n }\n\n public class ModCombination where T : struct, IStaticMod\n {\n readonly StaticModInt[] _factorials;\n readonly StaticModInt[] _invFactorials;\n\n public ModCombination(int max = 1000000)\n {\n if (max >= default(T).Mod)\n {\n ThrowArgumentOutOfRangeException();\n }\n\n _factorials = new StaticModInt[max + 1];\n _invFactorials = new StaticModInt[max + 1];\n\n _factorials[0] = _factorials[1] = StaticModInt.Raw(1);\n _invFactorials[0] = _invFactorials[1] = StaticModInt.Raw(1);\n\n for (int i = 2; i < _factorials.Length; i++)\n {\n _factorials[i] = _factorials[i - 1] * StaticModInt.Raw(i);\n }\n\n _invFactorials[^1] = _factorials[^1].Inverse();\n\n for (int i = _invFactorials.Length - 2; i >= 0; i--)\n {\n _invFactorials[i] = _invFactorials[i + 1] * StaticModInt.Raw(i + 1);\n }\n }\n\n public StaticModInt Factorial(int n) => _factorials[n];\n\n public StaticModInt Permutation(int n, int k) => _factorials[n] * _invFactorials[n - k];\n\n public StaticModInt Combination(int n, int k) => _factorials[n] * _invFactorials[k] * _invFactorials[n - k];\n\n public StaticModInt CombinationWithRepetition(int n, int k) => Combination(n + k - 1, k);\n\n public void ThrowArgumentOutOfRangeException() => throw new ArgumentOutOfRangeException();\n }\n\n #endregion\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 Write(T value) => _writer.Write(value.ToString());\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(T[] values, char separator) => WriteLine((ReadOnlySpan)values, separator);\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 value, T other) where T : struct, IComparable\n {\n if (value.CompareTo(other) < 0)\n {\n value = other;\n return true;\n }\n return false;\n }\n\n public static bool ChangeMin(ref this T value, T other) where T : struct, IComparable\n {\n if (value.CompareTo(other) > 0)\n {\n value = other;\n return true;\n }\n return false;\n }\n\n public static void SwapIfLargerThan(ref this T a, ref T b) where T : struct, IComparable\n {\n if (a.CompareTo(b) > 0)\n {\n (a, b) = (b, a);\n }\n }\n\n public static void SwapIfSmallerThan(ref this T a, ref T b) where T : struct, IComparable\n {\n if (a.CompareTo(b) < 0)\n {\n (a, b) = (b, a);\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 public static class CollectionExtensions\n {\n private class ArrayWrapper\n {\n#pragma warning disable CS0649\n public T[] Array;\n#pragma warning restore CS0649\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static Span AsSpan(this List list)\n {\n return Unsafe.As>(list).Array.AsSpan(0, list.Count);\n }\n\n public static void Fill(this T[] array, T value) => array.AsSpan().Fill(value);\n public static void Fill(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);\n public static void Fill(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);\n public static void Fill(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);\n }\n\n public static class SearchExtensions\n {\n struct LowerBoundComparer : IComparer where T : IComparable\n {\n public int Compare(T x, T y) => 0 <= x.CompareTo(y) ? 1 : -1;\n }\n\n struct UpperBoundComparer : IComparer where T : IComparable\n {\n public int Compare(T x, T y) => 0 < x.CompareTo(y) ? 1 : -1;\n }\n\n // https://trsing.hatenablog.com/entry/2019/08/27/211038\n public static int GetGreaterEqualIndex(this ReadOnlySpan span, T inclusiveMin) where T : IComparable => ~span.BinarySearch(inclusiveMin, new UpperBoundComparer());\n public static int GetGreaterThanIndex(this ReadOnlySpan span, T exclusiveMin) where T : IComparable => ~span.BinarySearch(exclusiveMin, new LowerBoundComparer());\n public static int GetLessEqualIndex(this ReadOnlySpan span, T inclusiveMax) where T : IComparable => ~span.BinarySearch(inclusiveMax, new LowerBoundComparer()) - 1;\n public static int GetLessThanIndex(this ReadOnlySpan span, T exclusiveMax) where T : IComparable => ~span.BinarySearch(exclusiveMax, new UpperBoundComparer()) - 1;\n public static int GetGreaterEqualIndex(this Span span, T inclusiveMin) where T : IComparable => ((ReadOnlySpan)span).GetGreaterEqualIndex(inclusiveMin);\n public static int GetGreaterThanIndex(this Span span, T exclusiveMin) where T : IComparable => ((ReadOnlySpan)span).GetGreaterThanIndex(exclusiveMin);\n public static int GetLessEqualIndex(this Span span, T inclusiveMax) where T : IComparable => ((ReadOnlySpan)span).GetLessEqualIndex(inclusiveMax);\n public static int GetLessThanIndex(this Span span, T exclusiveMax) where T : IComparable => ((ReadOnlySpan)span).GetLessThanIndex(exclusiveMax);\n\n public static int BoundaryBinarySearch(Predicate predicate, int ok, int ng)\n {\n while (Math.Abs(ok - ng) > 1)\n {\n int 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 public static long BoundaryBinarySearch(Predicate predicate, long ok, long ng)\n {\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 public static double Bisection(Func f, double a, double b, double eps = 1e-9)\n {\n if (f(a) * f(b) >= 0)\n {\n throw new ArgumentException(\"f(a)\u3068f(b)\u306f\u7570\u7b26\u53f7\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\");\n }\n\n const int maxLoop = 100;\n double mid = (a + b) / 2;\n\n for (int i = 0; i < maxLoop; i++)\n {\n if (f(a) * f(mid) < 0)\n {\n b = mid;\n }\n else\n {\n a = mid;\n }\n mid = (a + b) / 2;\n if (Math.Abs(b - a) < eps)\n {\n break;\n }\n }\n return mid;\n }\n }\n}\n\n#endregion\n\nnamespace CodeforcesRound581Div2.Graphs\n{\n public interface IEdge\n {\n int To { get; }\n }\n\n public interface IWeightedEdge : IEdge\n {\n long Weight { get; }\n }\n\n public interface IGraph where TEdge : IEdge\n {\n ReadOnlySpan this[int node] { get; }\n int NodeCount { get; }\n }\n\n public interface IWeightedGraph : IGraph where TEdge : IWeightedEdge { }\n\n public readonly struct BasicEdge : IEdge\n {\n public int To { get; }\n\n public BasicEdge(int to)\n {\n To = to;\n }\n\n public override string ToString() => To.ToString();\n public static implicit operator BasicEdge(int edge) => new BasicEdge(edge);\n public static implicit operator int(BasicEdge edge) => edge.To;\n }\n\n [StructLayout(LayoutKind.Auto)]\n public readonly struct WeightedEdge : IWeightedEdge\n {\n public int To { get; }\n public long Weight { get; }\n\n public WeightedEdge(int to) : this(to, 1) { }\n\n public WeightedEdge(int to, long weight)\n {\n To = to;\n Weight = weight;\n }\n\n public override string ToString() => $\"[{Weight}]-->{To}\";\n public void Deconstruct(out int to, out long weight) => (to, weight) = (To, Weight);\n }\n\n public class BasicGraph : IGraph\n {\n private readonly List> _edges;\n public ReadOnlySpan this[int node] => _edges[node].AsSpan();\n public int NodeCount => _edges.Count;\n\n public BasicGraph(int nodeCount)\n {\n _edges = new List>(nodeCount);\n for (int i = 0; i < nodeCount; i++)\n {\n _edges.Add(new List());\n }\n }\n\n public void AddEdge(int from, int to) => _edges[from].Add(to);\n public void AddNode() => _edges.Add(new List());\n }\n\n public class WeightedGraph : IGraph\n {\n private readonly List> _edges;\n public ReadOnlySpan this[int node] => _edges[node].AsSpan();\n public int NodeCount => _edges.Count;\n\n public WeightedGraph(int nodeCount)\n {\n _edges = new List>(nodeCount);\n for (int i = 0; i < nodeCount; i++)\n {\n _edges.Add(new List());\n }\n }\n\n public void AddEdge(int from, int to, long weight) => _edges[from].Add(new WeightedEdge(to, weight));\n public void AddNode() => _edges.Add(new List());\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f1e08f4fa217809f17cb3d5423efa5aa", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "difficulty": 2300.0} {"lang": "Mono C#", "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 public class Num : IComparable\n {\n public int A, B;\n\n public Num(int x)\n {\n this.A = x;\n this.B = 1;\n }\n\n public Num(int a, int b)\n {\n this.A = a;\n this.B = b;\n this.Normalize();\n }\n\n public void Abs()\n {\n if (this.A < 0)\n {\n this.A = -this.A;\n }\n }\n\n public static Num operator +(Num a, Num b)\n {\n var top = a.A * b.B + b.A * a.B;\n var bot = a.B * b.B;\n\n return new Num(top, bot);\n }\n\n public static Num operator -(Num a, Num b)\n {\n return a + new Num(-b.A, b.B);\n }\n\n public static Num operator *(Num a, Num b)\n {\n var top = a.A * b.A;\n var bot = a.B * b.B;\n\n return new Num(top, bot);\n }\n\n public static Num operator /(Num a, Num b)\n {\n var top = a.A * b.B;\n var bot = a.B * b.A;\n\n return new Num(top, bot);\n }\n\n public void Normalize()\n {\n var gcd = GCD(A, B);\n if (gcd > 1)\n {\n this.A /= gcd;\n this.B /= gcd;\n }\n }\n\n public override string ToString()\n {\n return this.A.ToString() + \"/\" + this.B.ToString();\n }\n\n public int CompareTo(Num other)\n {\n return (this.A * other.B).CompareTo(this.B * other.A);\n }\n }\n\n private static void Main(string[] args)\n {\n PushTestData(@\"\n4\n(99+98)/97\n(26+4)/10\n(12+33)/15\n(5+1)/7\n\");\n var r = RI();\n var b = RI();\n Console.WriteLine(r == b ? \"Yes\" : \"No\");\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\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\n private static List[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\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') || (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\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ccd84a626432d48acb4333a4e975b2ac", "src_uid": "65f81f621c228c09915adcb05256c634", "difficulty": 1600.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\n\r\nnamespace ConsoleApp\r\n{\r\n class Program\r\n {\r\n const double DefaultEpsilon = 1e-18;\r\n\r\n struct Vector\r\n {\r\n public double X;\r\n public double Y;\r\n\r\n public Vector(double x, double y)\r\n {\r\n X = x;\r\n Y = y;\r\n }\r\n public Vector(double angle)\r\n {\r\n X = Math.Cos(angle);\r\n Y = Math.Sin(angle);\r\n }\r\n\r\n public double Hypot()\r\n {\r\n return Math.Sqrt((X * X) + (Y * Y));\r\n }\r\n public double HypotSquared()\r\n {\r\n return (X * X) + (Y * Y);\r\n }\r\n public Vector RotateClockwise(double angle)\r\n {\r\n double cos = Math.Cos(angle);\r\n double sin = Math.Sin(angle);\r\n\r\n return new Vector(X * cos + Y * sin, X * -sin + Y * cos);\r\n }\r\n public Vector Perpendicular()\r\n {\r\n return new Vector(-Y, X);\r\n }\r\n public bool IsEqual(Vector vector, double epsilon = DefaultEpsilon)\r\n {\r\n return Equal(this.X, vector.X, epsilon) && Equal(this.Y, vector.Y, epsilon);\r\n }\r\n\r\n public static Vector operator +(Vector a)\r\n {\r\n return a;\r\n }\r\n public static Vector operator -(Vector a)\r\n {\r\n return new Vector(-a.X, -a.Y);\r\n }\r\n public static Vector operator +(Vector a, Vector b)\r\n {\r\n return new Vector(a.X + b.X, a.Y + b.Y);\r\n }\r\n public static Vector operator -(Vector a, Vector b)\r\n {\r\n return new Vector(a.X - b.X, a.Y - b.Y);\r\n }\r\n public static double Determinant(Vector a, Vector b)\r\n {\r\n return (a.X * b.Y) - (a.Y * b.X);\r\n }\r\n public static double DotProduct(Vector a, Vector b)\r\n {\r\n return (a.X * b.X) + (a.Y * b.Y);\r\n }\r\n }\r\n struct Line\r\n {\r\n public double A;\r\n public double B;\r\n public double C;\r\n\r\n public double slopeY => -A / B; // y = f'(x)\r\n public double slopeX => -B / A; // x = f'(y)\r\n\r\n public Line(Vector p1, Vector p2)\r\n {\r\n A = p2.Y - p1.Y;\r\n B = p1.X - p2.X;\r\n C = p2.X * p1.Y - p1.X * p2.Y;\r\n }\r\n }\r\n struct Segment\r\n {\r\n public Vector Left;\r\n public Vector Right;\r\n\r\n public Segment(Vector left, Vector right)\r\n {\r\n Left = left;\r\n Right = right;\r\n }\r\n\r\n public Line GetLine()\r\n {\r\n return new Line(Left, Right);\r\n }\r\n public bool IsOnTheSegment(Vector point, double epsilon = DefaultEpsilon)\r\n {\r\n Vector v1 = point - Left;\r\n Vector v2 = point - Right;\r\n double det = Vector.Determinant(v1, v2);\r\n double dotProd = Vector.DotProduct(v1, v2);\r\n\r\n return Equal(det, 0, epsilon) && LessOrEqual(dotProd, 0, epsilon);\r\n }\r\n }\r\n\r\n static Program()\r\n {\r\n // Comment this before submitting (in case of strandard input)\r\n Console.SetIn(new StreamReader(\"input.txt\"));\r\n Console.SetOut(new StreamWriter(\"output.txt\"));\r\n }\r\n static void Main()\r\n {\r\n //int testCases = int.Parse(Console.ReadLine());\r\n //for (int z = 0; z < testCases; z++)\r\n //{\r\n\r\n //}\r\n\r\n int[] data = ReadIntData();\r\n int n = data[0];\r\n int m = data[1];\r\n int k = data[2];\r\n int r = data[3];\r\n int c = data[4];\r\n\r\n data = ReadIntData();\r\n int ax = data[0];\r\n int ay = data[1];\r\n int bx = data[2];\r\n int by = data[3];\r\n\r\n if (ax > bx)\r\n {\r\n Swap(ref ax, ref bx);\r\n }\r\n if (ay > by)\r\n {\r\n Swap(ref ay, ref by);\r\n }\r\n\r\n //int dx = bx - ax;\r\n //int dy = by - ay;\r\n\r\n\r\n long total = (long)n * m;\r\n total -= (long)r * c;\r\n //total += (long)(ax - bx + r) * (ay - by + c);\r\n\r\n Console.WriteLine(PowQuick(k, total, 1_000_000_007));\r\n\r\n Console.Out.Close();\r\n }\r\n\r\n static bool Equal(double a, double b, double epsilon = DefaultEpsilon)\r\n {\r\n return Math.Abs(a - b) < epsilon;\r\n }\r\n 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 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 static bool GreaterOrEqual(double a, double b, double epsilon = DefaultEpsilon)\r\n {\r\n return (a > b) || Equal(a, b, epsilon);\r\n }\r\n static bool LessOrEqual(double a, double b, double epsilon = DefaultEpsilon)\r\n {\r\n return (a < b) || Equal(a, b, epsilon);\r\n }\r\n static double DegToRad(double angle)\r\n {\r\n return (angle / 180) * Math.PI;\r\n }\r\n static long LCM(long a, long b)\r\n {\r\n return (a / GCD(a, b)) * b;\r\n }\r\n static long GCD(long a, long b)\r\n {\r\n while (a != 0)\r\n {\r\n b %= a;\r\n Swap(ref a, ref b);\r\n }\r\n\r\n return b;\r\n }\r\n static long PowQuick(long b, long p)\r\n {\r\n long exp = b;\r\n long res = 1;\r\n\r\n while (p > 0)\r\n {\r\n if ((p % 2) == 1)\r\n {\r\n res *= exp;\r\n }\r\n\r\n exp *= exp;\r\n p /= 2;\r\n }\r\n\r\n return res;\r\n }\r\n static long PowQuick(long b, long p, long mod)\r\n {\r\n long exp = b;\r\n long res = 1;\r\n\r\n while (p > 0)\r\n {\r\n if ((p % 2) == 1)\r\n {\r\n res *= exp;\r\n res %= mod;\r\n }\r\n\r\n exp *= exp;\r\n exp %= mod;\r\n p /= 2;\r\n }\r\n\r\n return res;\r\n }\r\n static uint BitCount(uint a)\r\n {\r\n a = ((a >> 1) & 0x55555555u) + (a & 0x55555555u);\r\n a = ((a >> 2) & 0x33333333u) + (a & 0x33333333u);\r\n a = ((a >> 4) & 0x0F0F0F0Fu) + (a & 0x0F0F0F0Fu);\r\n a = ((a >> 8) & 0x00FF00FFu) + (a & 0x00FF00FFu);\r\n a = ((a >> 16) & 0x0000FFFFu) + (a & 0x0000FFFFu);\r\n return a;\r\n }\r\n static bool AreAlmostEqual(double a, double b, double epsilon)\r\n {\r\n return Math.Abs(a - b) < epsilon;\r\n }\r\n static int Binary(int[] array, int val)\r\n {\r\n return Binary(array, val, 0, array.Length);\r\n }\r\n static int Binary(int[] array, int val, int left, int right)\r\n {\r\n if (val < array[0])\r\n {\r\n return 0;\r\n }\r\n\r\n while (right - left > 1)\r\n {\r\n int mid = (right + left) / 2;\r\n\r\n if (array[mid] <= val)\r\n {\r\n left = mid;\r\n }\r\n else\r\n {\r\n right = mid;\r\n }\r\n }\r\n\r\n return right;\r\n }\r\n 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 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 static double[] ReadDoubleData(TextReader input)\r\n {\r\n return input.ReadLine()\r\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(val => double.Parse(val))\r\n .ToArray();\r\n }\r\n static double[] ReadDoubleData()\r\n {\r\n return ReadDoubleData(Console.In);\r\n }\r\n static int[] ReadIntData(TextReader input)\r\n {\r\n return input.ReadLine()\r\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(val => int.Parse(val))\r\n .ToArray();\r\n }\r\n static int[] ReadIntData()\r\n {\r\n return ReadIntData(Console.In);\r\n }\r\n static long[] ReadLongData(TextReader input)\r\n {\r\n return input.ReadLine()\r\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(val => long.Parse(val))\r\n .ToArray();\r\n }\r\n static long[] ReadLongData()\r\n {\r\n return ReadLongData(Console.In);\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6e7e77174b1bea3f9007b64fdf151b2b", "src_uid": "3478e6a4ff2415508fd517413d40c13a", "difficulty": 2200.0} {"lang": "C# 8", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\n\r\nnamespace ConsoleApp\r\n{\r\n class Program\r\n {\r\n const double DefaultEpsilon = 1e-18;\r\n\r\n struct Vector\r\n {\r\n public double X;\r\n public double Y;\r\n\r\n public Vector(double x, double y)\r\n {\r\n X = x;\r\n Y = y;\r\n }\r\n public Vector(double angle)\r\n {\r\n X = Math.Cos(angle);\r\n Y = Math.Sin(angle);\r\n }\r\n\r\n public double Hypot()\r\n {\r\n return Math.Sqrt((X * X) + (Y * Y));\r\n }\r\n public double HypotSquared()\r\n {\r\n return (X * X) + (Y * Y);\r\n }\r\n public Vector RotateClockwise(double angle)\r\n {\r\n double cos = Math.Cos(angle);\r\n double sin = Math.Sin(angle);\r\n\r\n return new Vector(X * cos + Y * sin, X * -sin + Y * cos);\r\n }\r\n public Vector Perpendicular()\r\n {\r\n return new Vector(-Y, X);\r\n }\r\n public bool IsEqual(Vector vector, double epsilon = DefaultEpsilon)\r\n {\r\n return Equal(this.X, vector.X, epsilon) && Equal(this.Y, vector.Y, epsilon);\r\n }\r\n\r\n public static Vector operator +(Vector a)\r\n {\r\n return a;\r\n }\r\n public static Vector operator -(Vector a)\r\n {\r\n return new Vector(-a.X, -a.Y);\r\n }\r\n public static Vector operator +(Vector a, Vector b)\r\n {\r\n return new Vector(a.X + b.X, a.Y + b.Y);\r\n }\r\n public static Vector operator -(Vector a, Vector b)\r\n {\r\n return new Vector(a.X - b.X, a.Y - b.Y);\r\n }\r\n public static double Determinant(Vector a, Vector b)\r\n {\r\n return (a.X * b.Y) - (a.Y * b.X);\r\n }\r\n public static double DotProduct(Vector a, Vector b)\r\n {\r\n return (a.X * b.X) + (a.Y * b.Y);\r\n }\r\n }\r\n struct Line\r\n {\r\n public double A;\r\n public double B;\r\n public double C;\r\n\r\n public double slopeY => -A / B; // y = f'(x)\r\n public double slopeX => -B / A; // x = f'(y)\r\n\r\n public Line(Vector p1, Vector p2)\r\n {\r\n A = p2.Y - p1.Y;\r\n B = p1.X - p2.X;\r\n C = p2.X * p1.Y - p1.X * p2.Y;\r\n }\r\n }\r\n struct Segment\r\n {\r\n public Vector Left;\r\n public Vector Right;\r\n\r\n public Segment(Vector left, Vector right)\r\n {\r\n Left = left;\r\n Right = right;\r\n }\r\n\r\n public Line GetLine()\r\n {\r\n return new Line(Left, Right);\r\n }\r\n public bool IsOnTheSegment(Vector point, double epsilon = DefaultEpsilon)\r\n {\r\n Vector v1 = point - Left;\r\n Vector v2 = point - Right;\r\n double det = Vector.Determinant(v1, v2);\r\n double dotProd = Vector.DotProduct(v1, v2);\r\n\r\n return Equal(det, 0, epsilon) && LessOrEqual(dotProd, 0, epsilon);\r\n }\r\n }\r\n\r\n static Program()\r\n {\r\n // Comment this before submitting (in case of strandard input)\r\n //Console.SetIn(new StreamReader(\"input.txt\"));\r\n //Console.SetOut(new StreamWriter(\"output.txt\"));\r\n }\r\n static void Main()\r\n {\r\n //int testCases = int.Parse(Console.ReadLine());\r\n //for (int z = 0; z < testCases; z++)\r\n //{\r\n\r\n //}\r\n\r\n int[] data = ReadIntData();\r\n int n = data[0];\r\n int m = data[1];\r\n int k = data[2];\r\n int r = data[3];\r\n int c = data[4];\r\n\r\n data = ReadIntData();\r\n int ax = data[0];\r\n int ay = data[1];\r\n int bx = data[2];\r\n int by = data[3];\r\n\r\n if (ax > bx)\r\n {\r\n Swap(ref ax, ref bx);\r\n }\r\n if (ay > by)\r\n {\r\n Swap(ref ay, ref by);\r\n }\r\n\r\n //int dx = bx - ax;\r\n //int dy = by - ay;\r\n\r\n long total = (long)n * m;\r\n if ((ax != bx) || (ay != by))\r\n {\r\n total -= (long)r * c;\r\n }\r\n \r\n //total += (long)(ax - bx + r) * (ay - by + c);\r\n\r\n Console.WriteLine(PowQuick(k, total, 1_000_000_007));\r\n\r\n Console.Out.Close();\r\n }\r\n\r\n static bool Equal(double a, double b, double epsilon = DefaultEpsilon)\r\n {\r\n return Math.Abs(a - b) < epsilon;\r\n }\r\n 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 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 static bool GreaterOrEqual(double a, double b, double epsilon = DefaultEpsilon)\r\n {\r\n return (a > b) || Equal(a, b, epsilon);\r\n }\r\n static bool LessOrEqual(double a, double b, double epsilon = DefaultEpsilon)\r\n {\r\n return (a < b) || Equal(a, b, epsilon);\r\n }\r\n static double DegToRad(double angle)\r\n {\r\n return (angle / 180) * Math.PI;\r\n }\r\n static long LCM(long a, long b)\r\n {\r\n return (a / GCD(a, b)) * b;\r\n }\r\n static long GCD(long a, long b)\r\n {\r\n while (a != 0)\r\n {\r\n b %= a;\r\n Swap(ref a, ref b);\r\n }\r\n\r\n return b;\r\n }\r\n static long PowQuick(long b, long p)\r\n {\r\n long exp = b;\r\n long res = 1;\r\n\r\n while (p > 0)\r\n {\r\n if ((p % 2) == 1)\r\n {\r\n res *= exp;\r\n }\r\n\r\n exp *= exp;\r\n p /= 2;\r\n }\r\n\r\n return res;\r\n }\r\n static long PowQuick(long b, long p, long mod)\r\n {\r\n long exp = b;\r\n long res = 1;\r\n\r\n while (p > 0)\r\n {\r\n if ((p % 2) == 1)\r\n {\r\n res *= exp;\r\n res %= mod;\r\n }\r\n\r\n exp *= exp;\r\n exp %= mod;\r\n p /= 2;\r\n }\r\n\r\n return res;\r\n }\r\n static uint BitCount(uint a)\r\n {\r\n a = ((a >> 1) & 0x55555555u) + (a & 0x55555555u);\r\n a = ((a >> 2) & 0x33333333u) + (a & 0x33333333u);\r\n a = ((a >> 4) & 0x0F0F0F0Fu) + (a & 0x0F0F0F0Fu);\r\n a = ((a >> 8) & 0x00FF00FFu) + (a & 0x00FF00FFu);\r\n a = ((a >> 16) & 0x0000FFFFu) + (a & 0x0000FFFFu);\r\n return a;\r\n }\r\n static bool AreAlmostEqual(double a, double b, double epsilon)\r\n {\r\n return Math.Abs(a - b) < epsilon;\r\n }\r\n static int Binary(int[] array, int val)\r\n {\r\n return Binary(array, val, 0, array.Length);\r\n }\r\n static int Binary(int[] array, int val, int left, int right)\r\n {\r\n if (val < array[0])\r\n {\r\n return 0;\r\n }\r\n\r\n while (right - left > 1)\r\n {\r\n int mid = (right + left) / 2;\r\n\r\n if (array[mid] <= val)\r\n {\r\n left = mid;\r\n }\r\n else\r\n {\r\n right = mid;\r\n }\r\n }\r\n\r\n return right;\r\n }\r\n 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 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 static double[] ReadDoubleData(TextReader input)\r\n {\r\n return input.ReadLine()\r\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(val => double.Parse(val))\r\n .ToArray();\r\n }\r\n static double[] ReadDoubleData()\r\n {\r\n return ReadDoubleData(Console.In);\r\n }\r\n static int[] ReadIntData(TextReader input)\r\n {\r\n return input.ReadLine()\r\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(val => int.Parse(val))\r\n .ToArray();\r\n }\r\n static int[] ReadIntData()\r\n {\r\n return ReadIntData(Console.In);\r\n }\r\n static long[] ReadLongData(TextReader input)\r\n {\r\n return input.ReadLine()\r\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(val => long.Parse(val))\r\n .ToArray();\r\n }\r\n static long[] ReadLongData()\r\n {\r\n return ReadLongData(Console.In);\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a6c17f4c9c721435c390fa7fbc85221e", "src_uid": "3478e6a4ff2415508fd517413d40c13a", "difficulty": 2200.0} {"lang": ".NET Core C#", "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 int N, X;\n string S;\n public void Solve()\n {\n sc.Make(out N, out X);\n S = sc.Str;\n //dp[k][i][j]:=F(k)\u306e\u90e8\u5206\u5217\u306b\u542b\u307e\u308c\u308bS[j,i)\u306e\u6570\u306e\u548c\n var cur = Create(N + 1, () => new ModInt[N + 1]);\n var nxt = Create(N + 1, () => new ModInt[N + 1]);\n for (int i = 0; i < N; i++)\n {\n cur[i][i] = nxt[i][i] = 1;\n if (S[i] - '0' == 0) nxt[i + 1][i] = 1;\n else cur[i + 1][i] = 1;\n }\n //\u7aef\u306f\u3068\u3063\u3066\u3082\u53d6\u3089\u306a\u304f\u3066\u3082\u3044\u3044\u306e\u30672\n cur[0][0] = cur[N][N] = nxt[0][0] = nxt[N][N] = 2;\n for (int i = 0; i < X - 1; i++)\n {\n nxt = matmul(nxt, cur);\n swap(ref cur, ref nxt);\n }\n Console.WriteLine(cur[N][0]);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d172b7256b423c8228dbc77ec704116", "src_uid": "52c6aa73ff4460799402c646c6263630", "difficulty": 2400.0} {"lang": "MS C#", "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 MOD = 1000000009;\n\n public void Solve()\n {\n int n = ReadInt();\n long ans = 0;\n long prod = 1;\n long v = 1;\n for (int i = 1; i < n; i++)\n {\n if (i > 3 && i % 2 == 0)\n {\n if (i == n - 1)\n {\n ans = (ans + 2 * (i - 1) * prod) % MOD;\n break;\n }\n v = (v * 2 + 3) % MOD;\n ans = (ans + 2 * v * prod) % MOD;\n prod = prod * v % MOD;\n }\n else\n ans = (ans + 2 * prod) % MOD;\n }\n\n ans = ans * ans % MOD;\n ans = (ans + 1) * 2 % MOD;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e1e5a347665d01e9c4e916cf4e52cb49", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "difficulty": 2600.0} {"lang": "MS C#", "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 static int countPowers(int p, int n) {\n int result = 0;\n int curr = 1;\n while (n / p >= curr) {\n ++result;\n curr *= p;\n }\n return result;\n }\n\n static Dictionary D = new Dictionary();\n\n static int bitmask(ref List p) {\n int result = 0;\n for (int i = 0; i < p.Count; ++i)\n result = 2 * result + p[i];\n return result;\n }\n\n static int fun(ref List p) {\n if (D.ContainsKey(bitmask(ref p))) {\n return D[bitmask(ref p)];\n }\n HashSet s = new HashSet();\n for (int i = 0; i < p.Count; ++i) if (p[i] == 1) {\n List n = new List(p);\n for (int j = 0; j < n.Count; ++j) if ((j + 1) % (i + 1) == 0) n[j] = 0;\n s.Add(fun(ref n));\n }\n int result = 0;\n while (s.Contains(result)) ++result;\n D[bitmask(ref p)] = result;\n return result;\n }\n\n static int getSprague(int len) {\n // SG for group of powers\n D.Clear();\n D[0] = 0;\n\n List p = new List();\n for (int i = 0; i < len; ++i) p.Add(1);\n return fun(ref p);\n }\n\n public static void Main(string[] args) {\n StdIn std = new StdIn();\n\n int n = std.nextInt();\n\n int ans = 0;\n\n int totcnt = n;\n\n for (int i = 2; i * i <= n; ++i) {\n int cnt = countPowers(i, n);\n totcnt -= cnt;\n ans ^= getSprague(cnt);\n }\n\n if (totcnt % 2 > 0) ans ^= 1;\n\n if (ans > 0) Console.WriteLine(\"Vasya\");\n else Console.WriteLine(\"Petya\");\n\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "56af67ddb46b4fc8f26133193985a176", "src_uid": "0e22093668319217b7946e62afe32195", "difficulty": 2300.0} {"lang": "MS C#", "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 static int countPowers(int p, int n) {\n int result = 0;\n int curr = 1;\n while (n / p >= curr) {\n ++result;\n curr *= p;\n if (n/curr >= curr) Used.Add(curr);\n }\n return result;\n }\n\n static HashSet Used = new HashSet();\n static Dictionary D = new Dictionary();\n\n static int bitmask(ref List p) {\n int result = 0;\n for (int i = 0; i < p.Count; ++i)\n result = 2 * result + p[i];\n return result;\n }\n\n static int fun(ref List p) {\n if (D.ContainsKey(bitmask(ref p))) {\n return D[bitmask(ref p)];\n }\n HashSet s = new HashSet();\n for (int i = 0; i < p.Count; ++i) if (p[i] == 1) {\n List n = new List(p);\n for (int j = 0; j < n.Count; ++j) if ((j + 1) % (i + 1) == 0) n[j] = 0;\n s.Add(fun(ref n));\n }\n int result = 0;\n while (s.Contains(result)) ++result;\n D[bitmask(ref p)] = result;\n return result;\n }\n\n static int getSprague(int len) {\n int[] ans = new int[] {0, 1,\n2,\n1,\n4,\n3,\n2,\n1,\n5,\n6,\n2,\n1,\n8,\n7,\n5,\n9,\n8,\n7,\n3,\n4,\n7,\n4,\n2,\n1,\n10,\n9,\n3,\n6,\n11,\n12};\n\n // SG for group of powers\n /*\n D.Clear();\n D[0] = 0;\n\n List p = new List();\n for (int i = 0; i < len; ++i) p.Add(1);\n //Console.WriteLine(len + \" \" + fun(ref p));\n return fun(ref p);\n */\n return ans[len];\n }\n\n public static void Main(string[] args) {\n StdIn std = new StdIn();\n\n int n = std.nextInt();\n int ans = 0;\n\n int totcnt = n;\n\n for (int i = 2; i * i <= n; ++i) if (!Used.Contains(i)) {\n int cnt = countPowers(i, n);\n totcnt -= cnt;\n ans ^= getSprague(cnt);\n }\n\n if (totcnt % 2 > 0) ans ^= 1;\n\n if (ans > 0) Console.WriteLine(\"Vasya\");\n else Console.WriteLine(\"Petya\");\n\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "44199a8b173b932f67ddb90b7cf95ec8", "src_uid": "0e22093668319217b7946e62afe32195", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 string[] all;\n string dna = \"ACGT\";\n int[, ,] best;\n int[, ,] best2;\n long[, , ,] dp;\n int mod = 1000000009;\n int[, ,] p;\n void solve()\n {\n int n = nextInt();\n int m = nextInt();\n all = new string[m];\n for (int i = 0; i < m; i++)\n all[i] = nextString();\n int maxL = 0;\n for (int i = 0; i < m; i++)\n maxL = Math.Max(maxL, all[i].Length);\n best = new int[m, maxL + 1, 4];\n best2 = new int[m, maxL + 1, 4];\n\n p = new int[m, maxL + 1, 4];\n for (int i = 0; i < m; i++)\n for (int j = 0; j <= all[i].Length; j++)\n for (int k = 0; k < 4; k++)\n {\n string cur = all[i].Substring(0, j) + dna[k];\n for (int bestL = 0; bestL <= cur.Length; bestL++)\n {\n for (int r = 0; r < all.Length; r++)\n {\n if (all[r].StartsWith(cur.Substring(cur.Length - bestL)))\n {\n best[i, j, k] = r;\n best2[i, j, k] = bestL;\n }\n if (all[r] == cur.Substring(cur.Length - bestL))\n p[i, j, k] = bestL;\n }\n }\n }\n\n dp = new long[n + 1, m, maxL + 1, maxL + 1];\n for (int i = 0; i <= n; i++)\n for (int j = 0; j < m; j++)\n for (int k = 0; k <= maxL; k++)\n for (int oks = 0; oks <= maxL; oks++)\n dp[i, j, k, oks] = -1;\n long res = go(n, 0, 0, 0);\n println(res);\n\n }\n\n private long go(int rem, int who, int len, int oks)\n {\n if (dp[rem, who, len, oks] != -1)\n return dp[rem, who, len, oks];\n long res = 0;\n if (rem == 0)\n {\n if (oks == len)\n res = 1;\n\n return dp[rem, who, len, oks] = res;\n }\n for (int i = 0; i < 4; i++)\n {\n int nwho = best[who, len, i];\n int nlen = best2[who, len, i];\n if (p[who, len, i] + oks >= len + 1)\n {\n res += go(rem - 1, nwho, nlen, nlen);\n }\n else\n {\n if (nlen + oks < len + 1)\n continue;\n res += go(rem - 1, nwho, nlen, oks - (len + 1 - nlen));\n }\n if (res >= mod)\n res -= mod;\n }\n return dp[rem, who, len, oks] = res;\n }\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "519fd30ea85f9b59d9d23ad3116af024", "src_uid": "3f053c07deaac55c2c51df6147080340", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 long mod;\n void solve()\n {\n\n long n = nextLong();\n long x = nextLong();\n long y = nextLong();\n mod = nextLong();\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong() % mod;\n long res = doIt(n, x, y, a);\n println(res);\n }\n\n private long doIt(long n, long x, long y, long[] a)\n {\n if (n == 1)\n return a[0];\n long[,] mat = new long[2, 2];\n mat[0, 1] = mat[1, 0] = mat[1, 1] = 1;\n mat = pow(mat, x);\n long S = 0;\n long A = 0;\n for (int i = 1; i < n - 1; i++)\n S = (S + a[i]) % mod;\n A = (a[0] + a[n - 1]) % mod;\n long sum = doItSum(n,x,S,A);\n long max = 0;\n long[] p = new long[] { 0, 1 };\n max = ((p[0] * mat[0, 0] + p[1] * mat[1, 0]) % mod * a[n - 2] % mod + (p[0] * mat[1, 0] + p[1] * mat[1, 1]) % mod * a[n - 1] % mod) % mod;\n long min = a[0];\n long z = (max + min)%mod;\n long s = (sum - z + mod) % mod;\n return doItSum(n, y,s,z);\n }\n\n private long doItSum(long n, long x,long sum,long A)\n {\n long[,] mat = new long[2, 2];\n mat[0, 0] = mat[0, 1] = 1;\n mat[1, 1] = 3;\n mat = pow(mat, x);\n return (A * mat[0, 0] + sum * mat[1, 0] + A * mat[0, 1] + sum * mat[1, 1]) % mod;\n \n }\n\n private long[,] pow(long[,] mat, long p)\n {\n if (p == 0)\n {\n long[,] res = new long[2, 2];\n for (int i = 0; i < 2; i++)\n res[i, i] = 1;\n return res;\n }\n else if (p % 2 == 0)\n return pow(mul(mat, mat), p / 2);\n else\n return mul(mat, pow(mat, p - 1));\n \n \n }\n\n private long[,] mul(long[,] a, long[,] b)\n {\n long[,] c = new long[2, 2];\n for (int i = 0; i < 2; i++)\n for (int j = 0; j < 2; j++)\n for (int k = 0; k < 2; k++)\n c[i, j] = (c[i, j] + a[i, k] * b[k, j]) % mod;\n return c;\n }\n\n\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\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e438a7853a728cdd8d8c11752cedf18f", "src_uid": "b5dd2b94570973b3e312ae4b7a43284f", "difficulty": 2600.0} {"lang": "MS C#", "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.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 double Fun(double x, double y, double z)\n {\n return z * Math.Log(y) + Math.Log(Math.Log(x));\n }\n\n double Fun2(double x, double y, double z)\n {\n return Math.Log(y) + Math.Log(z) + Math.Log(Math.Log(x));\n }\n\n double Fun3(double x, double y, double z)\n {\n return Math.Pow(x, Math.Pow(y, z));\n }\n\n double Fun4(double x, double y, double z)\n {\n return Math.Pow(Math.Pow(x, y), z);\n }\n\n public void Solve()\n {\n double x = ReadDouble();\n double y = ReadDouble();\n double z = ReadDouble();\n\n double max = double.MinValue;\n string ans = \"\";\n Action act = (v, s) =>\n {\n if (v > max)\n {\n max = v;\n ans = s;\n }\n };\n if (x < 1 && y < 1 && z < 1)\n {\n act(Fun3(x, y, z), \"x^y^z\");\n act(Fun3(x, z, y), \"x^z^y\");\n act(Fun4(x, y, z), \"(x^y)^z\");\n act(Fun4(x, z, y), \"(x^z)^y\");\n act(Fun3(y, x, z), \"y^x^z\");\n act(Fun3(y, z, x), \"y^z^x\");\n act(Fun4(y, x, z), \"(y^x)^z\");\n act(Fun4(y, z, x), \"(y^z)^x\");\n act(Fun3(z, x, y), \"z^x^y\");\n act(Fun3(z, y, x), \"z^y^x\");\n act(Fun4(z, x, y), \"(z^x)^y\");\n act(Fun4(z, y, x), \"(z^y)^x\");\n Write(ans);\n return;\n }\n\n if (x >= 1)\n {\n act(Fun(x, y, z), \"x^y^z\");\n act(Fun(x, z, y), \"x^z^y\");\n act(Fun2(x, y, z), \"(x^y)^z\");\n act(Fun2(x, z, y), \"(x^z)^y\");\n }\n if (y >= 1)\n {\n act(Fun(y, x, z), \"y^x^z\");\n act(Fun(y, z, x), \"y^z^x\");\n act(Fun2(y, x, z), \"(y^x)^z\");\n act(Fun2(y, z, x), \"(y^z)^x\");\n }\n if (z >= 1)\n {\n act(Fun(z, x, y), \"z^x^y\");\n act(Fun(z, y, x), \"z^y^x\");\n act(Fun2(z, x, y), \"(z^x)^y\");\n act(Fun2(z, y, x), \"(z^y)^x\");\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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "78c22f4b18e9c37961af055a6d3b4ce1", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "difficulty": 2400.0} {"lang": "MS C#", "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.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 double Fun(double x, double y, double z)\n {\n return z * Math.Log(y) + Math.Log(Math.Log(x));\n }\n\n double Fun2(double x, double y, double z)\n {\n return Math.Log(y) + Math.Log(z) + Math.Log(Math.Log(x));\n }\n\n double Fun3(double x, double y, double z)\n {\n return Math.Pow(x, Math.Pow(y, z));\n }\n\n double Fun4(double x, double y, double z)\n {\n return Math.Pow(Math.Pow(x, y), z);\n }\n\n public void Solve()\n {\n double x = ReadDouble();\n double y = ReadDouble();\n double z = ReadDouble();\n\n double max = double.MinValue;\n string ans = \"\";\n Action act = (v, s) =>\n {\n if (v > max)\n {\n max = v;\n ans = s;\n }\n };\n if (x < 1 && y < 1 && z < 1)\n {\n act(Fun3(x, y, z), \"x^y^z\");\n act(Fun3(x, z, y), \"x^z^y\");\n act(Fun4(x, y, z), \"(x^y)^z\");\n act(Fun4(x, z, y), \"(x^z)^y\");\n act(Fun3(y, x, z), \"y^x^z\");\n act(Fun3(y, z, x), \"y^z^z\");\n act(Fun4(y, x, z), \"(y^x)^z\");\n act(Fun4(y, z, x), \"(y^z)^x\");\n act(Fun3(z, x, y), \"z^x^y\");\n act(Fun3(z, y, x), \"z^y^x\");\n act(Fun4(z, x, y), \"(z^x)^y\");\n act(Fun4(z, y, x), \"(z^y)^x\");\n Write(ans);\n return;\n }\n\n if (x >= 1)\n {\n act(Fun(x, y, z), \"x^y^z\");\n act(Fun(x, z, y), \"x^z^y\");\n act(Fun2(x, y, z), \"(x^y)^z\");\n act(Fun2(x, z, y), \"(x^z)^y\");\n }\n if (y >= 1)\n {\n act(Fun(y, x, z), \"y^x^z\");\n act(Fun(y, z, x), \"y^z^z\");\n act(Fun2(y, x, z), \"(y^x)^z\");\n act(Fun2(y, z, x), \"(y^z)^x\");\n }\n if (z >= 1)\n {\n act(Fun(z, x, y), \"z^x^y\");\n act(Fun(z, y, x), \"z^y^x\");\n act(Fun2(z, x, y), \"(z^x)^y\");\n act(Fun2(z, y, x), \"(z^y)^x\");\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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a2622e523bffb44953ab9c0f083b4af3", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "difficulty": 2400.0} {"lang": "MS C#", "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.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 double Fun(double x, double y, double z)\n {\n return z * Math.Log(y) + Math.Log(Math.Log(x));\n }\n\n double Fun2(double x, double y, double z)\n {\n return Math.Log(y) + Math.Log(z) + Math.Log(Math.Log(x));\n }\n\n double Fun3(double x, double y, double z)\n {\n return Math.Pow(x, Math.Pow(y, z));\n }\n\n double Fun4(double x, double y, double z)\n {\n return Math.Pow(Math.Pow(x, y), z);\n }\n\n public void Solve()\n {\n double x = ReadDouble();\n double y = ReadDouble();\n double z = ReadDouble();\n\n double max = double.MinValue;\n string ans = \"\";\n Action act = (v, s) =>\n {\n if (v > max + 1e-9)\n {\n max = v;\n ans = s;\n }\n };\n if (x <= 1 && y <= 1 && z <= 1)\n {\n act(Fun3(x, y, z), \"x^y^z\");\n act(Fun3(x, z, y), \"x^z^y\");\n act(Fun4(x, y, z), \"(x^y)^z\");\n act(Fun4(x, z, y), \"(x^z)^y\");\n act(Fun3(y, x, z), \"y^x^z\");\n act(Fun3(y, z, x), \"y^z^x\");\n act(Fun4(y, x, z), \"(y^x)^z\");\n act(Fun4(y, z, x), \"(y^z)^x\");\n act(Fun3(z, x, y), \"z^x^y\");\n act(Fun3(z, y, x), \"z^y^x\");\n act(Fun4(z, x, y), \"(z^x)^y\");\n act(Fun4(z, y, x), \"(z^y)^x\");\n Write(ans);\n return;\n }\n\n if (x > 1)\n {\n act(Fun(x, y, z), \"x^y^z\");\n act(Fun(x, z, y), \"x^z^y\");\n act(Fun2(x, y, z), \"(x^y)^z\");\n act(Fun2(x, z, y), \"(x^z)^y\");\n }\n if (y > 1)\n {\n act(Fun(y, x, z), \"y^x^z\");\n act(Fun(y, z, x), \"y^z^x\");\n act(Fun2(y, x, z), \"(y^x)^z\");\n act(Fun2(y, z, x), \"(y^z)^x\");\n }\n if (z > 1)\n {\n act(Fun(z, x, y), \"z^x^y\");\n act(Fun(z, y, x), \"z^y^x\");\n act(Fun2(z, x, y), \"(z^x)^y\");\n act(Fun2(z, y, x), \"(z^y)^x\");\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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "061e3e646b583c6cc4aebdf39cb2f051", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "difficulty": 2400.0} {"lang": "Mono C#", "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 B\n{\n public class Solution\n {\n public void Execute()\n {\n var (n, m) = ReadTwoInt;\n var a = ReadInts;\n\n var dic = new Dictionary();\n foreach(var x in a)\n {\n if (!dic.ContainsKey(x)) dic[x] = 1;\n else ++dic[x];\n }\n\n var b = dic.Values.ToArray();\n Array.Sort(b);\n var result = 0;\n for (var i = 1; i <= m; ++i)\n {\n if (Check(b, n, i)) result = i;\n else break;\n }\n\n WriteLine(result);\n }\n\n private bool Check(int[] b, int n, int day)\n {\n var total = 0;\n b.ForEach(x => total += x / day);\n\n return total >= 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ea5d6f04cc01715d450d8dcd2ec8cd09", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\nusing static System.Math;\n\nclass P\n{\n static void Main()\n {\n int n = Console.ReadLine().Split().Select(int.Parse).First();\n int[] aa = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Dictionary adic = new Dictionary();\n for (int i = 0; i < aa.Length; i++)\n {\n if (!adic.ContainsKey(aa[i])) adic.Add(aa[i], 0);\n adic[aa[i]]++;\n }\n int[] a = adic.Values.ToArray();\n for (int i = 1; i <= int.MaxValue; i++)\n {\n if (a.Where(x => x >= i).Select(x => x / i).Sum() < n)\n {\n Console.WriteLine(i - 1);\n return;\n }\n }\n //Console.WriteLine(a.Length < n ? 0 : a.Min());\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4f9a9beb318544266f0fa4129887f646", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "Mono C#", "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 _499b\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\n var d = ReadIntArray();\n var n = d[0];\n var m = d[1];\n var a = ReadIntArray();\n var ts = new Dictionary();\n for (int i = 0; i < m; i++)\n {\n var nt = a[i];\n if (!ts.ContainsKey(nt))\n {\n ts[nt] = 0;\n }\n\n ts[nt]++;\n }\n\n var tts = ts.Values.ToArray();\n var r = 1000 * 1000;\n var l = 0;\n while (true)\n {\n if (l == r)\n {\n break;\n }\n\n //Console.WriteLine(\"{0} {1}\", l, r);\n var mid = l + (r - l + 1) / 2;\n\n if (mid == 3)\n {\n\n }\n var canSr = 0;\n for (int i = 0; i < tts.Length; i++)\n {\n var count = tts[i];\n canSr += count / mid;\n }\n\n if (canSr >= n)\n {\n l = mid;\n }\n else\n {\n r = mid - 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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d9df283fc8c07c487fe4e8698ad2427a", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF1012A\n{\n class Program\n {\n public static int _cmp(int a,int b) {\n if (a == b) return 0;\n else if (a > b) return -1;\n else return 1;\n }\n\n public static bool canSolve(int[] food, int days, int totPeo) {\n int now = 0;\n while (totPeo > 0) {\n while (food[now] < days)\n if (++now > 100) return false;\n food[now] -= days;\n totPeo--;\n }\n return true;\n }\n\n\n static void Main(string[] args)\n {\n int totNums, totParticipant;\n\n string inp = Console.ReadLine(); string[] div;\n div = inp.Split(' ');\n totNums = Convert.ToInt32(div[1]);totParticipant = Convert.ToInt32(div[0]);\n\n int[] num = new int[101];\n for (int i = 0; i < 101; i++) num[i] = 0;\n inp = Console.ReadLine();div = inp.Split(' ');\n for (int i = 0; i < totNums; i++)\n num[Convert.ToInt32(div[i]) - 1]++;\n\n Array.Sort(num, _cmp);\n //for (int i = 0; i < totNums && num[i] > 0; i++)\n // Console.Write(\"{0} \", num[i]);\n\n int fr = 0, to = 101, mid;\n int[] fd = new int[101];\n while (fr < to) {\n mid = ((fr + to) >> 1) + 1;\n for (int i = 0; i < 101; i++) fd[i] = num[i];\n if (canSolve(fd, mid, totParticipant)) fr = mid;\n else to = mid - 1;\n }\n Console.WriteLine(fr.ToString());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3b032948aa2c618d85243843c76c563b", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "Mono C#", "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\n \n\n static bool ok(int k, int n, int[] a)\n {\n int cant = 0;\n int m = a.Length;\n for (int i = 0; i < m; i++)\n cant += a[i] / k;\n return cant >= n;\n }\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]);\n line = Console.ReadLine().Split(' ');\n int[] a = new int[m];\n for (int i = 0; i < m; i++)\n a[i] = int.Parse(line[i]);\n int[] b = new int[105];\n for (int i = 0; i < m; i++)\n b[a[i]]++;\n\n int ans = 0;\n int lo = 1;\n int hi = m;\n while(lo <= hi)\n {\n int mid = (lo + hi) >> 1;\n if(ok(mid, n, b))\n {\n ans = mid;\n lo = mid + 1;\n }\n else\n {\n hi = mid - 1;\n }\n }\n\n Console.WriteLine(ans);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9509bf173e4dd8cb3c72eec70924121c", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_1011B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arrEatType = new int[101];\n\n var input = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);\n int participant = input[0];\n int amount = input[1];\n\n List arrEat = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).ToList();\n\n for (int i = 0; i < amount; ++i)\n {\n arrEatType[arrEat[i]]++;\n }\n\n Array.Sort(arrEatType);\n Array.Reverse(arrEatType);\n\n for(int i=amount;i>0;i--)\n {\n int temp = 0;\n\n for(int j=0;j<=amount;j++)\n {\n temp += arrEatType[j] / i;\n }\n\n if(temp>= participant)\n {\n Console.WriteLine(i);\n return;\n }\n }\n\n Console.WriteLine(0);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "79552e97eebfaa41b01112bd2020feb6", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "Mono C#", "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, m;\n sc.Make(out n, out m);\n var ct = new int[101];\n for (var i = 0; i < m; i++)\n ct[sc.Next()]++;\n Array.Sort(ct, (a, b) => b - a);\n\n var r = 101; var l = 0;\n while (r - l > 1)\n {\n var mi = (r + l) / 2;\n bool ok;\n //\u5224\u5b9a\n var c = 0;\n for (var i = 0; i < n; i++)\n c += ct[i] / mi;\n ok = c < n;\n if (ok) r = mi;\n else l = mi;\n }\n WriteLine(l);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "27f87695892513b6d593afd57a9a444f", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "C# 8", "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\npublic class Solution\r\n{\r\n int mod;\r\n\r\n long Fun(int n)\r\n {\r\n var dp = new long[n + 1];\r\n dp[1] = 1;\r\n long sum = 1;\r\n var pdp = new long[n + 1];\r\n for (int i = 1; i <= n; i++)\r\n {\r\n pdp[i] = (pdp[i] + pdp[i - 1]) % mod;\r\n dp[i] = (sum + pdp[i]) % mod;\r\n \r\n for (int j = i * 2, k = 2; j <= n; j += i, k++)\r\n {\r\n pdp[j] = (pdp[j] + dp[i]) % mod;\r\n if (j + k <= n)\r\n pdp[j + k] = (pdp[j + k] + mod - dp[i]) % mod;\r\n }\r\n\r\n if (i > 1)\r\n sum = (sum + dp[i]) % mod;\r\n }\r\n return dp[n];\r\n }\r\n\r\n public void Solve()\r\n {\r\n int n = ReadInt();\r\n mod = ReadInt();\r\n Write(Fun(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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "51a0ff7a0be170f9db6097d10cdaa17b", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\nclass Program\n{\n class MUMU\n {\n public long Val;\n public int Ind;\n }\n\n //////////////////////////////////////////////////\n void Solution()\n {\n var n = ri;\n var a = new List(n);\n for (int i = 0; i < n; i++)\n a.Add(new MUMU { Val = rl, Ind = i });\n a.Sort((x, y) => x.Val.CompareTo(y.Val));\n var b = new List(n);\n for (int i = 1; i < n; i++)\n b.Add(a[i]);\n b.Add(a[0]);\n for (int i = 0; i < n-1; i++)\n {\n for (int j = 0; j < n-1; j++)\n {\n if (a[j].Ind > a[j + 1].Ind)\n {\n var buf = a[j];\n a[j] = a[j + 1];\n a[j + 1] = buf;\n buf = b[j];\n b[j] = b[j + 1];\n b[j + 1] = buf;\n }\n }\n }\n\n for (int i = 0; i < n; i++)\n wsp(b[i].Val);\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()\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n //Console.SetOut(new StreamWriter(\"output.txt\"));\n new Program().Solution();\n //Console.In.Close();\n //Console.Out.Close();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "083fb07c7e1d2a8c7788d07d5f10004b", "src_uid": "e314642ca1f82be8f223e2eba00b5531", "difficulty": 2000.0} {"lang": "MS C#", "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 long[] A = re.la();\n Compression Comp = new Compression(A);\n for(int i=0;i AL = new List();\n AL.Add(a[0]);\n for(int i=1;i= X){\n bl = bc;\n }\n else{\n bf = bc+1;\n }\n }\n return bf;\n }\n public long Value(int i){\n return A[i];\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[] S;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n\n K = sc.IntArray();\n S = new HashSet[400001];\n for (int i = 0; i <= 400000; i++)\n {\n S[i] = new HashSet();\n }\n for (int i = 0; i < M; i++)\n {\n int d = sc.NextInt();\n int t = sc.NextInt() - 1;\n S[d].Add(t);\n }\n\n /*\n * \u6bce\u65e51B\u7372\u5f97\n * \n * n\u7a2e\u985e\n * \u901a\u5e382B \n * \u30bb\u30fc\u30eb1B\n * \n * \u30bf\u30a4\u30d7i\u3092K_i\u500b\n * \n * m\u500b\n * \n * \u30bf\u30a4\u30d7t_i\u304cd_i\u306b\u30bb\u30fc\u30eb\n * \n * \u5168\u90e8\u8cb7\u3046\u3000\u6700\u5c0f\u65e5\u6570\n */\n\n /*\n * i\u65e5\u3067\u9054\u6210\u3067\u304d\u308b\u304b?\n * \n * \u6700\u5f8c\u304b\u3089\u898b\u308b\n * \n */\n int ok = 400000;\n int ng = 0;\n while (ok - ng > 1)\n {\n int mid = (ok + ng) / 2;\n if (F(mid)) ok = mid;\n else ng = mid;\n }\n Console.WriteLine(ok);\n\n }\n\n // t\u65e5\u3067\u3067\u304d\u308b\u304b?\n bool F(int t)\n {\n int[] tmp = new int[N];\n Array.Copy(K, tmp, N);\n\n int[] cnt = new int[N];\n for (int i = 1; i <= t; i++)\n {\n foreach (int type in S[i])\n {\n cnt[type]++;\n }\n }\n int b = 0;\n for (int i = 1; i <= t; i++)\n {\n b++;\n foreach (var type in S[i])\n {\n if (cnt[type] == 1)\n {\n int min = Math.Min(b, tmp[type]);\n b -= min;\n tmp[type] -= min;\n }\n cnt[type]--;\n }\n\n }\n\n long sum = 0;\n foreach (var i in tmp)\n {\n sum += i;\n }\n\n return sum * 2 <= 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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0d6df27730860ec706ce465268713f2c", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "difficulty": 2000.0} {"lang": "Mono C#", "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 bool calc(int day, int[] K, List[] L, int Sum)\n {\n int used = 0;\n int money = day;\n for (int i = day - 1; i >= 0; i--)\n { \n if (i < L.Length)\n {\n foreach (var v in L[i])\n {\n int buy = Min(K[v], money);\n money -= buy;\n K[v] -= buy;\n used += buy;\n }\n }\n money = Min(i, money);\n }\n\n\n int remain = Sum - used;\n\n return remain * 2 <= (day - used);\n\n }\n void solve()\n {\n int N = cin.nextint;\n int M = cin.nextint;\n var K = cin.scanint;\n\n var L = new List[200000];\n for (int i = 0; i < L.Length; i++)\n {\n L[i] = new List();\n }\n for (int i = 0; i < M; i++)\n {\n L[cin.nextint - 1].Add(cin.nextint - 1);\n }\n int Sum = K.Sum();\n\n\n int ng = 0;\n int ok = Sum * 2;\n while (ok - ng > 1)\n {\n int mid = (ok + ng) / 2;\n\n var Z = new int[N];\n for (int i = 0; i < Z.Length; i++)\n {\n Z[i] = K[i];\n }\n\n if (calc(mid, Z, L, Sum))\n {\n ok = mid;\n }\n else\n {\n ng = mid;\n }\n }\n\n WriteLine(ok);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b3ceeda0f6167b84f55705fb6f06337b", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "difficulty": 2000.0} {"lang": "Mono C#", "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 bool calc(int day, int[] K, List[] L, int Sum)\n {\n int money = 0;\n int done = 0;\n for (int i = 0; i < day; i++)\n {\n money++;\n foreach (var v in L[i])\n {\n int buy = Min(K[v], money);\n money -= buy;\n K[v] -= buy;\n done += buy;\n }\n }\n int remain = Sum - done;\n return remain * 2 <= money;\n }\n void solve()\n {\n int N = cin.nextint;\n int M = cin.nextint;\n var K = cin.scanint;\n\n var L = new List[N];\n for (int i = 0; i < L.Length; i++)\n {\n L[i] = new List();\n }\n for (int i = 0; i < M; i++)\n {\n L[cin.nextint - 1].Add(cin.nextint - 1);\n }\n int Sum = K.Sum();\n\n\n int money = 0;\n int done = 0;\n for (int i = 0; ; i++)\n {\n money++;\n if (i < L.Length)\n {\n foreach (var v in L[i])\n {\n int buy = Min(K[v], money);\n money -= buy;\n K[v] -= buy;\n done += buy;\n }\n }\n\n int remain = Sum - done;\n if (remain * 2 <= money)\n {\n WriteLine(i + 1);\n return;\n }\n }\n\n\n\n //int ng = 0;\n //int ok = Sum * 2;\n //while (ok - ng > 1)\n //{\n // int mid = (ok + ng) / 2;\n\n // var Z = new int[N];\n // for (int i = 0; i < Z.Length; i++)\n // {\n // Z[i] = K[i];\n // }\n\n // if (calc(mid, Z, L, Sum))\n // {\n // ok = mid;\n // }\n // else\n // {\n // ng = mid;\n // }\n //}\n\n //WriteLine(ok);\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0ee0496d0faef52e4f376c284ac233de", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task39D\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] point1 = Console.ReadLine().Split();\n Int32 x1 = Int32.Parse(point1[0]);\n Int32 y1 = Int32.Parse(point1[1]);\n Int32 z1 = Int32.Parse(point1[2]);\n string[] point2 = Console.ReadLine().Split();\n Int32 x2 = Int32.Parse(point2[0]);\n Int32 y2 = Int32.Parse(point2[1]);\n Int32 z2 = Int32.Parse(point2[2]);\n if (Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1)) - Math.Sqrt(2) <= 0.000001)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "950f81417a2dd4482dded2ffab15fa76", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Cubical_Planet\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(), z1 = Next();\n int x2 = Next(), y2 = Next(), z2 = Next();\n\n writer.WriteLine(x1 == x2 || y1 == y2 || z1 == z2 ? \"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6967269b376f3cda2adbd878aed33c3e", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Multiplication_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\n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n writer.Write(ConvertToString(i*j, n));\n writer.Write(' ');\n }\n writer.WriteLine();\n }\n\n writer.Flush();\n }\n\n private static string ConvertToString(int i, int b)\n {\n var st = new Stack();\n while (i > 0)\n {\n st.Push(i%b);\n i /= b;\n }\n var bb = new StringBuilder();\n foreach (int j in st)\n {\n bb.Append((char) (j + '0'));\n }\n return bb.ToString();\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c923a7627b6a47102a008d5c6c54d282", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace _39h\n{\n class Program\n {\n\n static string ToPos(Int32 k, Int32 pos)\n {\n string result = \"\";\n while (k > 0)\n {\n result = (k % pos).ToString() + result;\n k = k / pos;\n }\n return result;\n }\n\n\n static void PrintMatr(Int32[,] arr, Int32 pos)\n {\n if (pos == 10)\n {\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 9; j++)\n {\n Console.Write(arr[i, j].ToString()+\" \");\n }\n Console.WriteLine();\n }\n }\n else\n {\n for (int i = 0; i < pos-1; i++)\n {\n for (int j = 0; j < pos-1; j++)\n {\n Console.Write(ToPos(arr[i, j], pos)+ \" \");\n }\n Console.WriteLine();\n }\n }\n }\n static void Main(string[] args)\n {\n Int32 pos = 0;\n pos = Convert.ToInt32(Console.ReadLine());\n Int32[,] arr = new Int32[9, 9];\n for(int i = 1;i<10;i++)\n for (int j = 1; j < 10; j++)\n {\n arr[i-1, j-1] = i * j;\n }\n PrintMatr(arr, pos);\n //Console.ReadLine();\n //\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e0dc2cf480a1001cf2d0ae7a9660f48", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace _39h\n{\n class Program\n {\n\n static string ToPos(Int32 k, Int32 pos)\n {\n string result = \"\";\n while (k > 0)\n {\n result = (k % pos).ToString() + result;\n k = k / pos;\n }\n return result;\n }\n\n\n static void PrintMatr(Int32[,] arr, Int32 pos)\n {\n if (pos == 10)\n {\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 9; j++)\n {\n Console.Write(\"{1} \", arr[i, j]);\n }\n Console.WriteLine();\n }\n }\n else\n {\n for (int i = 0; i < pos-1; i++)\n {\n for (int j = 0; j < pos-1; j++)\n {\n Console.Write(ToPos(arr[i, j], pos)+ \" \");\n }\n Console.WriteLine();\n }\n }\n }\n static void Main(string[] args)\n {\n Int32 pos = 0;\n pos = Convert.ToInt32(Console.ReadLine());\n Int32[,] arr = new Int32[9, 9];\n for(int i = 1;i<10;i++)\n for (int j = 1; j < 10; j++)\n {\n arr[i-1, j-1] = i * j;\n }\n PrintMatr(arr, 3);\n //Console.ReadLine();\n //\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4f1750d936ad2e6dacc56650e1f3a999", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n int[] S;\n int N;\n PrimeFactor P;\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 N = re.i();\n S = new int[N];\n P = new PrimeFactor(N);\n {\n string str = re.s();\n for(int i=0;i prime = new List();\n for(int i=1;i ans = new List();\n while(X != 1){\n ans.Add(LowestPrimeFactor[X]);\n X /= LowestPrimeFactor[X];\n }\n return ans.ToArray();\n }\n public int[] Divisor(int X){\n List ans = new List();\n ans.Add(1);\n while(X != 1){\n int p = LowestPrimeFactor[X];\n int c = 0;\n while(X % p == 0){\n X /= p;\n c++;\n }\n int l = ans.Count;\n int d = p;\n for(int i=1;i<=c;i++){\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 z = x + y tg (alpha - a1)\n // tg (a+b) = (tg a + tg b)/(1 - tg a tg b)\n // z = x + y (tg alpha - x/y) / (1 + (x/y) tg alpha) = x + y (y tg alpha - x) / (y + x tg alpha) = \n // (xy + x2 tg + y2 tg - xy) / (y + x tg) = tg alpha (x2 + y2) / (y + x tg alpha)\n\n\n // tg a2 = -x/y\n // tg (alpha + a2) = (z-x)/y\n\n var p = points[i];\n var x = p.X - l;\n var y = p.Y;\n var tg = p.TgAlpha;\n\n if (x < 0)\n {\n var maxAlpha = Math.PI/2 - Math.Abs(Math.Atan2(x, y));\n if (p.Angle >= maxAlpha) return d;\n }\n\n \n var denom = y + x*tg;\n if (denom == 0) return d;\n var z = l + Math.Abs(tg*(x*x + y*y)/denom);\n return Math.Min(d, z);\n }\n\n void Solve()\n {\n int n, l, r;\n Input.Next(out n, out l, out r);\n d = r - l;\n \n points = new Point[n];\n for (var i = 0; i < n; i++)\n {\n points[i] = new Point();\n Input.Next(out points[i].X, out points[i].Y, out points[i].Angle);\n points[i].X -= l;\n points[i].TgAlpha = Math.Tan(points[i].Angle * Math.PI / 180);\n }\n\n var dp = new double[1 << n << 1];\n for (var j = 0; j < 1< 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 = 2 * n / 5;\n pr = new List { 2 };\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n for (var i = 3; i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Returns array of inverted prime numbers map in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out bool[] isPrime)\n {\n var m = 2 * n / 5;\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n isPrime = f;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "769fa8683daa4e8f86cf19a003c0d9fe", "src_uid": "4fad1233e08bef09e5aa7e2dc6167d6a", "difficulty": 2200.0} {"lang": "MS C#", "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 l = ReadInt();\n int r = ReadInt();\n \n var x = new int[n];\n var y = new int[n];\n var a = new double[n];\n for (int i = 0; i < n; i++)\n {\n x[i] = ReadInt();\n y[i] = ReadInt();\n a[i] = Math.PI * ReadInt() / 180;\n }\n\n var dp = Enumerable.Repeat((double)l, 1 << n).ToArray();\n dp[0] = l;\n for (int mask = 0; mask < (1 << n) - 1; mask++)\n {\n for (int j = 0; j < n; j++)\n if ((mask >> j & 1) == 0)\n {\n if (x[j] > dp[mask])\n {\n double al = Math.Atan2(x[j] - dp[mask], y[j]);\n if (al < a[j])\n dp[mask | 1 << j] = Math.Max(dp[mask | 1 << j], x[j] - y[j] * Math.Tan(al - a[j]));\n else\n dp[mask | 1 << j] = Math.Max(dp[mask | 1 << j], x[j] + y[j] * Math.Tan(a[j] - al));\n }\n else\n {\n double al = Math.Atan2(dp[mask] - x[j], y[j]);\n if (al + a[j] > Math.PI / 2)\n {\n Write(r - l);\n return;\n }\n dp[mask | 1 << j] = Math.Max(dp[mask | 1 << j], x[j] + y[j] * Math.Tan(a[j] + al));\n }\n }\n }\n\n Write(Math.Min(r, dp[(1 << n) - 1] - l).ToString(CultureInfo.InvariantCulture));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbe5884b4418eb9e2af8e3df40bd0cce", "src_uid": "4fad1233e08bef09e5aa7e2dc6167d6a", "difficulty": 2200.0} {"lang": "MS C#", "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.Globalization;\nusing System.Linq;\n\nnamespace Codeforces.TaskD\n{\n public class Task\n {\n private int d;\n private Point[] points;\n\n private double Distance(double l, int i)\n {\n // tg a1 = x/y\n // tg (alpha - a1) = (z-x)/y => z = x + y tg (alpha - a1)\n // tg (a+b) = (tg a + tg b)/(1 - tg a tg b)\n // z = x + y (tg alpha - x/y) / (1 + (x/y) tg alpha) = x + y (y tg alpha - x) / (y + x tg alpha) = \n // (xy + x2 tg + y2 tg - xy) / (y + x tg) = tg alpha (x2 + y2) / (y + x tg alpha)\n\n\n // tg a2 = -x/y\n // tg (alpha + a2) = (z-x)/y\n\n var p = points[i];\n var x = p.X - l;\n var y = p.Y;\n var tg = p.TgAlpha;\n\n \n var denom = y + x*tg;\n if (denom == 0) return d;\n var z = l + Math.Abs(tg*(x*x + y*y)/denom);\n return Math.Min(d, z);\n }\n\n void Solve()\n {\n int n, l, r;\n Input.Next(out n, out l, out r);\n d = r - l;\n \n points = new Point[n];\n for (var i = 0; i < n; i++)\n {\n points[i] = new Point();\n Input.Next(out points[i].X, out points[i].Y, out points[i].Angle);\n points[i].X -= l;\n points[i].TgAlpha = Math.Tan(points[i].Angle * Math.PI / 180);\n }\n\n var dp = new double[1 << n << 1];\n for (var j = 0; j < 1< 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 = 2 * n / 5;\n pr = new List { 2 };\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n for (var i = 3; i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Returns array of inverted prime numbers map in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out bool[] isPrime)\n {\n var m = 2 * n / 5;\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n isPrime = f;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ff108e2c76162c6645e4aed467ec2410", "src_uid": "4fad1233e08bef09e5aa7e2dc6167d6a", "difficulty": 2200.0} {"lang": "MS C#", "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.Globalization;\nusing System.Linq;\n\nnamespace Codeforces.TaskD\n{\n public class Task\n {\n private int d;\n private Point[] points;\n\n private double Distance(double l, int i)\n {\n // tg a1 = x/y\n // tg (alpha - a1) = (z-x)/y => z = x + y tg (alpha - a1)\n // tg (a+b) = (tg a + tg b)/(1 - tg a tg b)\n // z = x + y (tg alpha - x/y) / (1 + (x/y) tg alpha) = x + y (y tg alpha - x) / (y + x tg alpha) = \n // (xy + x2 tg + y2 tg - xy) / (y + x tg) = tg alpha (x2 + y2) / (y + x tg alpha)\n var p = points[i];\n var x = p.X - l;\n var y = p.Y;\n var tg = p.TgAlpha;\n\n var denom = y + x*tg;\n if (denom == 0) return d;\n var z = l + tg*(x*x + y*y)/denom;\n return Math.Min(d, z);\n }\n\n void Solve()\n {\n int n, l, r;\n Input.Next(out n, out l, out r);\n d = r - l;\n points = new Point[n];\n for (var i = 0; i < n; i++)\n {\n points[i] = new Point();\n Input.Next(out points[i].X, out points[i].Y, out points[i].Angle);\n points[i].X -= l;\n points[i].TgAlpha = Math.Tan(points[i].Angle * Math.PI / 180);\n }\n\n var dp = new double[1 << n << 1];\n for (var j = 0; j < 1< 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 = 2 * n / 5;\n pr = new List { 2 };\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n for (var i = 3; i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Returns array of inverted prime numbers map in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out bool[] isPrime)\n {\n var m = 2 * n / 5;\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n isPrime = f;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "65178d6625e008191d24e1af35cf515a", "src_uid": "4fad1233e08bef09e5aa7e2dc6167d6a", "difficulty": 2200.0} {"lang": "MS C#", "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.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces.TaskD\n{\n public class Task\n {\n private int d;\n private Point[] points;\n\n private double Distance(double l, int i)\n {\n // tg a1 = x/y\n // tg (alpha - a1) = (z-x)/y => z = x + y tg (alpha - a1)\n // tg (a+b) = (tg a + tg b)/(1 - tg a tg b)\n // z = x + y (tg alpha - x/y) / (1 + (x/y) tg alpha) = x + y (y tg alpha - x) / (y + x tg alpha) = \n // (xy + x2 tg + y2 tg - xy) / (y + x tg) = tg alpha (x2 + y2) / (y + x tg alpha)\n\n\n // tg a2 = -x/y\n // tg (alpha + a2) = (z-x)/y\n\n var p = points[i];\n var x = p.X - l;\n var y = p.Y;\n var tg = p.TgAlpha;\n\n if (x < 0)\n {\n var maxAlpha = Math.PI/2 - Math.Abs(Math.Atan2(x, y));\n if (p.Alpha >= maxAlpha) return d;\n }\n\n \n var denom = y + x*tg;\n if (denom == 0) return d;\n var z = l + Math.Abs(tg*(x*x + y*y)/denom);\n return Math.Min(d, z);\n }\n\n void Solve()\n {\n int n, l, r;\n Input.Next(out n, out l, out r);\n d = r - l;\n \n points = new Point[n];\n for (var i = 0; i < n; i++)\n {\n points[i] = new Point();\n Input.Next(out points[i].X, out points[i].Y, out points[i].Angle);\n points[i].X -= l;\n points[i].Alpha = points[i].Angle * Math.PI / 180;\n points[i].TgAlpha = Math.Tan(points[i].Alpha);\n }\n\n var dp = new double[1 << n << 1];\n for (var j = 0; j < 1< 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 = 2 * n / 5;\n pr = new List { 2 };\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n for (var i = 3; i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Returns array of inverted prime numbers map in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out bool[] isPrime)\n {\n var m = 2 * n / 5;\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n isPrime = f;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b7dc9689a7dbcd308ff6594a75210151", "src_uid": "4fad1233e08bef09e5aa7e2dc6167d6a", "difficulty": 2200.0} {"lang": "MS C#", "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 l = ReadInt();\n int r = ReadInt();\n \n var x = new int[n];\n var y = new int[n];\n var a = new double[n];\n for (int i = 0; i < n; i++)\n {\n x[i] = ReadInt();\n y[i] = ReadInt();\n a[i] = Math.PI * ReadInt() / 180;\n }\n\n var dp = Enumerable.Repeat((double)l, 1 << n).ToArray();\n dp[0] = l;\n for (int mask = 0; mask < (1 << n) - 1; mask++)\n {\n for (int j = 0; j < n; j++)\n if ((mask >> j & 1) == 0)\n {\n if (x[j] > dp[mask])\n {\n double al = Math.Atan2(x[j] - dp[mask], y[j]);\n if (al < a[j])\n dp[mask | 1 << j] = Math.Max(dp[mask | 1 << j], x[j] - y[j] * Math.Tan(al - a[j]));\n else\n dp[mask | 1 << j] = Math.Max(dp[mask | 1 << j], x[j] + y[j] * Math.Tan(a[j] - al));\n }\n else\n {\n double al = Math.Atan2(dp[mask] - x[j], y[j]);\n if (al + a[j] > Math.PI / 2)\n {\n Write(r - l);\n return;\n }\n dp[mask | 1 << j] = Math.Max(dp[mask | 1 << j], x[j] + y[j] * Math.Tan(a[j] + al));\n }\n }\n }\n\n Write((Math.Min(r, dp[(1 << n) - 1]) - l).ToString(CultureInfo.InvariantCulture));\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "689a2089adb9fe17e846d4bc5846d6c2", "src_uid": "4fad1233e08bef09e5aa7e2dc6167d6a", "difficulty": 2200.0} {"lang": "MS C#", "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.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces.TaskD\n{\n public class Task\n {\n private int d;\n private Point[] points;\n\n private double Distance(double l, int i)\n {\n // tg a1 = x/y\n // tg (alpha - a1) = (z-x)/y => z = x + y tg (alpha - a1)\n // tg (a+b) = (tg a + tg b)/(1 - tg a tg b)\n // z = x + y (tg alpha - x/y) / (1 + (x/y) tg alpha) = x + y (y tg alpha - x) / (y + x tg alpha) = \n // (xy + x2 tg + y2 tg - xy) / (y + x tg) = tg alpha (x2 + y2) / (y + x tg alpha)\n\n\n // tg a2 = -x/y\n // tg (alpha + a2) = (z-x)/y\n\n var p = points[i];\n var x = p.X - l;\n var y = p.Y;\n var tg = p.TgAlpha;\n\n if (x < 0)\n {\n var maxAlpha = Math.PI/2 - Math.Abs(Math.Atan2(x, y));\n if (p.Alpha >= maxAlpha) return d;\n }\n\n \n var denom = y + x*tg;\n if (denom == 0) return d;\n var z = l + Math.Abs(tg*(x*x + y*y)/denom);\n return Math.Min(d, z);\n }\n\n void Solve()\n {\n int n, l, r;\n Input.Next(out n, out l, out r);\n d = r - l;\n \n points = new Point[n];\n for (var i = 0; i < n; i++)\n {\n points[i] = new Point();\n Input.Next(out points[i].X, out points[i].Y, out points[i].Angle);\n points[i].X -= l;\n points[i].Alpha = points[i].Angle * Math.PI / 180;\n points[i].TgAlpha = Math.Tan(points[i].Alpha);\n }\n\n var dp = new double[1 << n << 1];\n for (var j = 0; j < 1< 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 = 2 * n / 5;\n pr = new List { 2 };\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n for (var i = 3; i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Returns array of inverted prime numbers map in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out bool[] isPrime)\n {\n var m = 2 * n / 5;\n var f = new bool[n + 1];\n for (var i = 3; i <= m; i += 2)\n if (!f[i])\n for (long j = (long)i * i; j <= n; j += i)\n f[j] = true;\n isPrime = f;\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d523a35dfd79b1d81f2ade53c133f81e", "src_uid": "4fad1233e08bef09e5aa7e2dc6167d6a", "difficulty": 2200.0} {"lang": "Mono C#", "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 = \"F1\";\n \n private static void Solve()\n {\n var inpit = ReadIntArray();\n var a0 = inpit[0];\n var a1 = inpit[1];\n var n = inpit[2];\n var res = a0;\n if(n == 1)\n Console.WriteLine(a1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n res = a0 + a1;\n a0 = a1;\n a1 = res;\n }\n Console.WriteLine(res);\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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "88f98f66b35816193ff8c85061045800", "src_uid": "6ff30f5a9afc3f7befca813469188aab", "difficulty": 1600.0} {"lang": "MS C#", "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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f65858679af650c4a7ed7604a4faeb58", "src_uid": "f45c769556ac3f408f5542fa71a67d98", "difficulty": 1800.0} {"lang": "Mono C#", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0f2231314053a8a596c4792b1ab5ab7d", "src_uid": "f45c769556ac3f408f5542fa71a67d98", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n struct Matrix\n {\n public long A1, A2, A3, A4;\n const long BMod = 10000000;\n\n public static long MulMod(long a, long b, long mod)\n {\n if (a == 0 || b == 0)\n return 0;\n else if (long.MaxValue / b > a)\n return (a * b) % mod;\n else\n {\n long j0 = a / BMod;\n long j1 = a % BMod;\n long k0 = b / BMod;\n long k1 = b % BMod;\n long r = (((j0 * k1 + j1 * k0) % (mod / BMod)) * BMod + j1 * k1) % mod;\n return r;\n }\n }\n\n public static Matrix MulMod(Matrix m1, Matrix m2, long mod)\n {\n Matrix result = new Matrix();\n result.A1 = (MulMod(m1.A1, m2.A1, mod) + MulMod(m1.A2, m2.A3, mod)) % mod;\n result.A2 = (MulMod(m1.A1, m2.A2, mod) + MulMod(m1.A2, m2.A4, mod)) % mod;\n result.A3 = (MulMod(m1.A3, m2.A1, mod) + MulMod(m1.A4, m2.A3, mod)) % mod;\n result.A4 = (MulMod(m1.A3, m2.A2, mod) + MulMod(m1.A4, m2.A4, mod)) % mod;\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.MulMod(result, modLast, mod);\n }\n\n modLast = Matrix.MulMod(modLast, modLast, mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n struct Result\n {\n public long Index, Value;\n public int SIndex;\n }\n\n static void Main(string[] args)\n {\n long[] steps = new long[] { 60, 300, 1500, 15000, 150000, 1500000, 15000000, 150000000, 1500000000, 15000000000, 150000000000, 1500000000000, 15000000000000, 150000000000000, 1500000000000000, 15000000000000000 };\n long[] mods = new long[] { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000, 1000000000000000, 10000000000000000 };\n\n long n = Convert.ToInt64(Console.ReadLine());\n int index = 0;\n long modValue = n % mods[index];\n\n Queue queue = new Queue();\n long[] fs = new long[60]; fs[1] = 1;\n\n for (int i = 2; i < fs.Length; i++)\n {\n fs[i] = (fs[i - 1] + fs[i - 2]) % mods[index];\n if (fs[i] == modValue)\n queue.Enqueue(new Result { Index = i, Value = fs[i], SIndex = index });\n }\n\n List result = new List();\n\n while (queue.Count > 0)\n {\n Result current = queue.Dequeue();\n\n if (current.Value == n && current.SIndex == 12)\n {\n result.Add(current);\n continue;\n }\n else if (current.SIndex > 12)\n continue;\n\n for (int i = 0; i * steps[current.SIndex] < steps[current.SIndex + 1]; i++)\n {\n long nIndex = i * steps[current.SIndex] + current.Index;\n long value = Cal(nIndex, mods[current.SIndex + 1]);\n\n if (value == n % mods[current.SIndex + 1])\n queue.Enqueue(new Result { Index = nIndex, SIndex = current.SIndex + 1, Value = value });\n }\n }\n\n if (result.Count == 0)\n Console.WriteLine(-1);\n else\n {\n long sIndex = result.Select(x => x.Index).Min();\n Console.WriteLine(sIndex);\n }\n }\n\n static long Cal(long index, long mod)\n {\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n Matrix power = Matrix.PowerMod(index, m, mod);\n return (long)power.A2;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "26d44c54c73f3d0b7da437f867948d72", "src_uid": "cbf786abfceeb8df29732c8a872f7f8a", "difficulty": 2900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n struct Matrix\n {\n public long A1, A2, A3, A4;\n const long BMod = 10000000;\n\n public static long MulMod(long a, long b, long mod)\n {\n if (a == 0 || b == 0)\n return 0;\n else if (long.MaxValue / b > a)\n return (a * b) % mod;\n else\n {\n long j0 = a / BMod;\n long j1 = a % BMod;\n long k0 = b / BMod;\n long k1 = b % BMod;\n long r = (((j0 * k1 + j1 * k0) % (mod / BMod)) * BMod + j1 * k1) % mod;\n return r;\n }\n }\n\n public static Matrix MulMod(Matrix m1, Matrix m2, long mod)\n {\n Matrix result = new Matrix();\n result.A1 = (MulMod(m1.A1, m2.A1, mod) + MulMod(m1.A2, m2.A3, mod)) % mod;\n result.A2 = (MulMod(m1.A1, m2.A2, mod) + MulMod(m1.A2, m2.A4, mod)) % mod;\n result.A3 = (MulMod(m1.A3, m2.A1, mod) + MulMod(m1.A4, m2.A3, mod)) % mod;\n result.A4 = (MulMod(m1.A3, m2.A2, mod) + MulMod(m1.A4, m2.A4, mod)) % mod;\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.MulMod(result, modLast, mod);\n }\n\n modLast = Matrix.MulMod(modLast, modLast, mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n struct Result\n {\n public long Index, Value;\n public int SIndex;\n }\n\n static void Main(string[] args)\n {\n long[] steps = new long[] { 60, 300, 1500, 15000, 150000, 1500000, 15000000, 150000000, 1500000000, 15000000000, 150000000000, 1500000000000, 15000000000000, 150000000000000, 1500000000000000, 15000000000000000 };\n long[] mods = new long[] { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000, 1000000000000000, 10000000000000000 };\n\n long n = Convert.ToInt64(Console.ReadLine());\n\n if (n == 1)\n {\n Console.WriteLine(1);\n return;\n }\n\n int index = 0;\n long modValue = n % mods[index];\n\n Queue queue = new Queue();\n long[] fs = new long[60]; fs[1] = 1;\n\n for (int i = 2; i < fs.Length; i++)\n {\n fs[i] = (fs[i - 1] + fs[i - 2]) % mods[index];\n if (fs[i] == modValue)\n queue.Enqueue(new Result { Index = i, Value = fs[i], SIndex = index });\n }\n\n List result = new List();\n\n while (queue.Count > 0)\n {\n Result current = queue.Dequeue();\n\n if (current.Value == n && current.SIndex == 12)\n {\n result.Add(current);\n continue;\n }\n else if (current.SIndex > 12)\n continue;\n\n for (int i = 0; i * steps[current.SIndex] < steps[current.SIndex + 1]; i++)\n {\n long nIndex = i * steps[current.SIndex] + current.Index;\n long value = Cal(nIndex, mods[current.SIndex + 1]);\n\n if (value == n % mods[current.SIndex + 1])\n queue.Enqueue(new Result { Index = nIndex, SIndex = current.SIndex + 1, Value = value });\n }\n }\n\n if (result.Count == 0)\n Console.WriteLine(-1);\n else\n {\n long sIndex = result.Select(x => x.Index).Min();\n Console.WriteLine(sIndex);\n }\n }\n\n static long Cal(long index, long mod)\n {\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n Matrix power = Matrix.PowerMod(index, m, mod);\n return (long)power.A2;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "06ecf7f89fff0a5fa341fc4b5e3d892a", "src_uid": "cbf786abfceeb8df29732c8a872f7f8a", "difficulty": 2900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Numerics;\nusing System.Text;\n\nnamespace Hack_it\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 BigInteger sum = 0;\n BigInteger count = 1;\n int i = 1;\n for (; i < 20; i++)\n {\n count *= 10;\n }\n for (int j = 1; j < 10; j++)\n {\n sum += count*j*i;\n }\n sum += 1;\n count *= 10;\n\n BigInteger a = BigInteger.Parse(reader.ReadLine());\n\n BigInteger d = sum%a;\n if (d != 0)\n {\n d = a - d;\n }\n\n writer.WriteLine(\"{0} {1}\", d + 1, count + d);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "82e7ebaba87f079a3c11feac39f74723", "src_uid": "52b8d97f216ea22693bc16fadcd46dae", "difficulty": 2500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Numerics;\nusing System.Text;\n\nnamespace Hack_it\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 BigInteger sum = 0;\n BigInteger count = 1;\n int i = 1;\n for (; i <= 20; i++)\n {\n count *= 10;\n }\n\n for (int j = 1; j < 10; j++)\n {\n sum += count*j*i;\n }\n sum += 1;\n\n BigInteger a = BigInteger.Parse(reader.ReadLine());\n\n BigInteger d = sum%a;\n if (d != 0)\n {\n d = a - d;\n }\n\n writer.WriteLine(\"{0} {1}\", d + 1, count + d);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f85c7651181364aff277b1eff2f49f4f", "src_uid": "52b8d97f216ea22693bc16fadcd46dae", "difficulty": 2500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round59\n{\n class E\n {\n int[][] dx = new int[][]{\n new int[]{2,4,6},\n new int[]{1,3,5,7},\n new int[]{0,2,4,6,8},\n new int[]{1,3,5,7},\n new int[]{2,4,6}\n };\n\n char[][] cs = new char[5][];\n int[,] id = new int[10, 10];\n List chk = new List();\n\n bool ok(int x, int y)\n {\n return 0 <= y && y < 5 && dx[y].Contains(x);\n }\n\n void proc(int x, int y, int dx, int dy)\n {\n int hash = 0;\n for (; ok(x, y); x += dx, y += dy)\n {\n hash |= 1 << id[x, y];\n chk.Add(hash);\n }\n }\n\n E()\n {\n for (int i = 0; i < 5; i++)\n cs[i] = Console.ReadLine().ToCharArray();\n\n int state = 0;\n for(int y = 0, idx = 0; y < 5; y++)\n for (int i = 0; i < dx[y].Length; i++)\n {\n int x = dx[y][i];\n id[x,y] = idx++;\n if (cs[y][x] == 'O')\n state |= 1 << id[x, y];\n }\n\n for (int y = 0; y < 5; y++)\n for (int i = 0; i < dx[y].Length; i++)\n {\n int x = dx[y][i];\n proc(x, y, 2, 0);\n proc(x, y, 1, 1);\n proc(x, y, -1, 1);\n }\n\n bool[] win = new bool[1<<19];\n for (int i = 1; i < 1 << 19; i++)\n {\n foreach (int hash in chk)\n {\n if ((i & hash) == hash && !win[i ^ hash])\n {\n win[i] = true;\n break;\n }\n }\n }\n\n Console.WriteLine(win[state] ? \"Karlsson\" : \"Lillebror\");\n }\n\n public static void Main()\n {\n new E();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0c36ede55cbdcf0c70173cdce7723271", "src_uid": "eaa022cc7846c983a826900dc6dd919f", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces.TaskE\n{\n public class Task\n {\n public static void Main()\n {\n var task = new Task();\n task.Solve();\n }\n\n private const long Mod = 1000000007L;\n private const long Max = 102L;\n private long n, m, k;\n private long[,,,] Ways;\n private long[][] C;\n\n void Solve()\n {\n Input.Next(out n, out m, out k);\n\n C = new long[Max][];\n C[0] = new long[1];\n C[0][0] = 1;\n for (var i = 1; i < Max; i++)\n {\n C[i] = new long[i + 1];\n C[i][0] = 1; C[i][i] = 1;\n for (var j = 1; j < i; j++) \n C[i][j] = C[i - 1][j - 1] + C[i - 1][j] % Mod;\n }\n\n n /= 2;\n Ways = new long[n + 2, n + 2, n + 2, Max];\n Ways[0, 1, 0, 1] = 1;\n\n var result = 0L;\n for (var maxValue = 0; maxValue <= n && maxValue < m; maxValue++)\n for (var holes = 0; holes <= n; holes++)\n for (var total = 0; total <= n; total++)\n for (var ways = 0; ways <= k; ways++)\n {\n var prevWays = Ways[maxValue, holes, total, ways];\n if (prevWays == 0) continue;\n if (maxValue > 0)\n {\n result += (prevWays * (m - maxValue)) % Mod;\n result %= Mod;\n } \n\n for (var newCountOfMaxValues = 1; newCountOfMaxValues <= n - total; newCountOfMaxValues++)\n {\n var newWays = ways*C[holes + newCountOfMaxValues - 1][newCountOfMaxValues];\n if (newWays <= k)\n {\n Ways[maxValue + 1, newCountOfMaxValues, total + newCountOfMaxValues, newWays] += prevWays;\n Ways[maxValue + 1, newCountOfMaxValues, total + newCountOfMaxValues, newWays] %= Mod;\n }\n }\n }\n Console.WriteLine(result);\n }\n }\n\n #region Input\n\n public class Input\n {\n private static string _line;\n\n public static bool Next()\n {\n _line = Console.ReadLine();\n return !string.IsNullOrEmpty(_line);\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 List Numbers()\n {\n Next();\n return _line.Split(' ').Select(long.Parse).ToList();\n }\n }\n\n #endregion\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c7b140c988d0eeeba1728a9884fa13ca", "src_uid": "c6d275b1e1d5c9e39e2cf990a635fa6b", "difficulty": 2800.0} {"lang": "Mono C#", "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\tlong[][] nCr = new long[21][];\n\t\tfor(int i=0;i<21;i++){\n\t\t\tnCr[i] = new long[21];\n\t\t}\n\t\t\n\t\tnCr[0][0] = 1;\n\t\tfor(int i=1;i<21;i++){\n\t\t\tnCr[i][0] = 1;\n\t\t\tfor(int j=1;j<21;j++){\n\t\t\t\tnCr[i][j] = nCr[i-1][j] + nCr[i-1][j-1];\n\t\t\t}\n\t\t}\n\t\tlong[] dp = new long[N+1];\n\t\tdp[0] = 1;\n\t\tint[] cnt = new int[10];\n\t\tfor(int i=0;i=0;v--){\n\t\t\tif(cnt[v] == 0) continue;\n//Console.WriteLine(String.Join(\" \", dp));\n\t\t\tlong[] ndp = new long[N+1];\n\t\t\tfor(int l=0;l<=N;l++){\n\t\t\t\tif(dp[l] == 0) continue;\n\t\t\t\tfor(int c = 1; c <= cnt[v]; c++){\n\t\t\t\t\tint m = l + 1;\n\t\t\t\t\tif(v == 0) m--;\n\t\t\t\t\tndp[l + c] += dp[l] * nCr[m - 1 + c][c];\n\t\t\t\t}\n\t\t\t}\n\t\t\tdp = ndp;\n//Console.WriteLine(\"ndpp:{0}\",String.Join(\" \", dp));\n\t\t}\n\t\t\n\t\tConsole.WriteLine(dp.Sum());\n\t}\n\tint N;\n\tString S;\n\tpublic Sol(){\n\t\tS = rs();\n\t\tN = S.Length;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1b918d2c395c112658d1f2933c455e6f", "src_uid": "7f4e533f49b73cc2b96b4c56847295f2", "difficulty": 1800.0} {"lang": "MS C#", "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 ans = 0;\n foreach (char c in ReadToken())\n if (char.IsLetter(c))\n {\n if (char.IsUpper(c))\n ans += c - 'A' + 1;\n else\n ans -= c - 'a' + 1;\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(\"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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "02acf426ab93f4ee1574b16d3d484c64", "src_uid": "d3fa5a3a008048dc4a9fbce1ebc61d67", "difficulty": 2000.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Numerics;\r\n\r\nnamespace cfgr14\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\r\n if (File.Exists(\"input.txt\"))\r\n {\r\n Console.SetIn(new StreamReader(\"input.txt\"));\r\n }\r\n solve_cfgr14E();\r\n Console.Out.Flush();\r\n }\r\n\r\n public static long[] fact = new long [405];\r\n public static long[] inv = new long [405];\r\n public static long[,] choose = new long [405, 405];\r\n public static long[] pow2 = new long [405];\r\n public static long n;\r\n public static long mod;\r\n /*\r\n Editorial:\r\n \r\n */\r\n public static void solve_cfgr14E()\r\n {\r\n long[] nm = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);\r\n n = nm[0];\r\n mod = nm[1];\r\n precompute();\r\n long[,] dp = new long[405, 405];\r\n dp[0, 0] = 1;\r\n for (int i = 0; i < n; i++)\r\n {\r\n for (int j = 0; j <= i; j++)\r\n {\r\n for (int k = 1; i + k <= n; k++)\r\n {\r\n dp[i + k + 1, j + k] += (dp[i, j] * pow2[k - 1]) % mod * choose[j + k, k];\r\n dp[i + k + 1, j + k] %= mod;\r\n }\r\n }\r\n }\r\n\r\n long ans = 0;\r\n for (int i = 0; i <= n; i++)\r\n {\r\n ans = (ans + dp[n + 1, i]) % mod;\r\n }\r\n Console.WriteLine(ans);\r\n }\r\n\r\n public static void precompute()\r\n {\r\n fact[0] = 1;\r\n inv[0] = 1;\r\n for (int i = 1; i <= n; i++)\r\n {\r\n fact[i] = (fact[i - 1] * i) % mod;\r\n inv[i] = binExp(fact[i], mod - 2);\r\n }\r\n\r\n for (int i = 0; i <= n; i++)\r\n {\r\n for (int j = 0; j <= i; j++)\r\n {\r\n choose[i, j] = ((fact[i] * inv[j]) % mod * inv[i - j]) % mod;\r\n }\r\n }\r\n\r\n for (int i = 0; i <= n; i++)\r\n {\r\n pow2[i] = binExp(2, i);\r\n }\r\n }\r\n\r\n public static long binExp(long a, long exp)\r\n {\r\n if (exp == 0)\r\n {\r\n return 1;\r\n }\r\n long tmp = binExp(a, exp / 2);\r\n tmp = (tmp * tmp) % mod;\r\n if (exp % 2 == 1)\r\n {\r\n tmp *= a;\r\n }\r\n return tmp % mod;\r\n }\r\n\r\n public static void solve_cfgr14C()\r\n {\r\n int t = Convert.ToInt32(Console.ReadLine());\r\n while(t-- > 0)\r\n {\r\n int[] nmx = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n int n = nmx[0];\r\n int m = nmx[1];\r\n int x = nmx[2];\r\n int[] h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n Array.Sort(h);\r\n int[] cnt = new int[m];\r\n for (int i = 0; i < n; i++)\r\n {\r\n cnt[i % m] += h[i];\r\n }\r\n int min = int.MaxValue;\r\n int max = int.MinValue;\r\n bool ok = true;\r\n for (int i = 0; i < m; i++)\r\n {\r\n min = Math.Min(min, cnt[i]);\r\n max = Math.Max(max, cnt[i]);\r\n if (max - min > x)\r\n {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n if (ok)\r\n {\r\n Console.WriteLine(\"YES\");\r\n for (int i = 0; i < n; i++)\r\n {\r\n Console.Write(\"{0} \", (i % m) + 1);\r\n }\r\n }\r\n else\r\n {\r\n Console.Write(\"NO\");\r\n }\r\n Console.WriteLine();\r\n }\r\n }\r\n\r\n public static void solve_cfgr14B()\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 bool ok = false;\r\n if (n > 1 && (n & (n - 1)) == 0)\r\n {\r\n ok = true;\r\n }\r\n else\r\n {\r\n for (int i = 2; i * i <= 1000000000; i++)\r\n {\r\n if (i % 2 != 0)\r\n {\r\n if (n % (i * i) == 0)\r\n {\r\n int r = n / (i * i);\r\n if (r > 1 && (r & (r - 1)) == 0)\r\n {\r\n ok = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n Console.WriteLine(ok ? \"YES\" : \"NO\");\r\n }\r\n\r\n }\r\n\r\n public static void solve_cfgr14A()\r\n {\r\n int t = Convert.ToInt32(Console.ReadLine());\r\n while(t-- > 0)\r\n {\r\n int[] nx = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n int n = nx[0];\r\n int x = nx[1];\r\n int[] w = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n Array.Sort(w, (a, b) => b.CompareTo(a));\r\n int sum = 0;\r\n int posToChange = -1;\r\n for (int i = 0; i < n; i++)\r\n {\r\n sum += w[i];\r\n if (sum == x)\r\n {\r\n posToChange = i;\r\n }\r\n }\r\n if (sum != x)\r\n {\r\n Console.WriteLine(\"YES\");\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (i == posToChange)\r\n {\r\n if (i + 1 < n)\r\n {\r\n int tmp = w[i];\r\n w[i] = w[i + 1];\r\n w[i + 1] = tmp;\r\n }\r\n }\r\n Console.Write(\"{0} \", w[i]);\r\n }\r\n }\r\n else\r\n {\r\n Console.Write(\"NO\");\r\n }\r\n Console.WriteLine();\r\n \r\n }\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "794d21fc356d71e263611bc6e8beccbc", "src_uid": "4f0e0d1deef0761a46b64de3eb98e774", "difficulty": 2200.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Numerics;\r\nusing static System.Math;\r\n\r\nnamespace CompetitiveProgramming\r\n{\r\n\tclass Program\r\n\t{\r\n\t\tpublic static void Main()\r\n\t\t{\r\n\t\t\tvar ints = Console.ReadLine().Split().Select(long.Parse).ToArray();\r\n\r\n\t\t\tvar n = ints[0];\r\n\t\t\tvar mod = ints[1];\r\n\r\n\t\t\tfor (int i = 1; i < Inverses.Length; i++)\r\n\t\t\t\tInverses[i] = ModularMultiplicativeInverse(i, mod);\r\n\r\n\t\t\tvar cur = new long[,]\r\n\t\t\t{\r\n\t\t\t\t{0,0,0 },\r\n\t\t\t\t{0,0,0 },\r\n\t\t\t\t{0,0,2 },\r\n\t\t\t\t{4,0,0 },\r\n\t\t\t};\r\n\r\n\t\t\tfor (var i = 0; i < n - 3; i++)\r\n\t\t\t\tcur = GetNext(cur, mod);\r\n\r\n\t\t\tlong res = 0;\r\n\r\n\t\t\tfor (int i = 0; i < cur.GetLength(0); i++)\r\n\t\t\t\tfor (int j = 0; j < cur.GetLength(1); j++)\r\n\t\t\t\t\tres += cur[i, j];\r\n\r\n\t\t\tConsole.WriteLine(res % mod);\r\n\t\t}\r\n\r\n\t\tprivate static readonly long[] Inverses = new long[500];\r\n\r\n\t\tpublic static long[,] GetNext(long[,] current, long mod)\r\n\t\t{\r\n\t\t\tvar total = current.GetLength(0) - 1;\r\n\t\t\tvar next = new long[total + 2, total + 1];\r\n\r\n\t\t\tfor (int i = 0; i <= total; i++)\r\n\t\t\t\tfor (int last = 0; last < total; last++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar prev = current[i, last];\r\n\t\t\t\t\tif (prev == 0)\r\n\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t\tvar dist = total + 1 - last;\r\n\r\n\t\t\t\t\tvar nVal = prev * 2 * (i + 1) % mod * Inverses[dist] % mod;\r\n\t\t\t\t\tnext[i + 1, last] = (next[i + 1, last] + nVal) % mod;\r\n\r\n\t\t\t\t\tif (last != total - 1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar val = prev * Inverses[2] % mod * (dist - 1) % mod;\r\n\t\t\t\t\t\tnext[i, total] = (next[i, total] + val) % mod;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\treturn next;\r\n\t\t}\r\n\r\n\t\tpublic static long ModularMultiplicativeInverse(long remainder, long mod)\r\n\t\t{\r\n\t\t\tif (mod == 1)\r\n\t\t\t\treturn 0;\r\n\r\n\t\t\tvar other = mod;\r\n\t\t\tlong next = 0;\r\n\t\t\tlong inverse = 1;\r\n\r\n\t\t\twhile (remainder > 1)\r\n\t\t\t{\r\n\t\t\t\t(inverse, next) = (next, inverse - remainder / other * next);\r\n\t\t\t\t(remainder, other) = (other, remainder % other);\r\n\t\t\t}\r\n\r\n\t\t\tif (inverse < 0)\r\n\t\t\t\tinverse += mod;\r\n\r\n\t\t\treturn inverse;\r\n\t\t}\r\n\r\n\t\tpublic static List GetPermutations(int[] list)\r\n\t\t{\r\n\t\t\tint x = list.Length - 1;\r\n\t\t\tvar result = new List();\r\n\t\t\tGetPermutationsRec(list, result, 0, x);\r\n\t\t\treturn result;\r\n\t\t}\r\n\r\n\t\tprivate static void GetPermutationsRec(int[] list, List result, int k, int m)\r\n\t\t{\r\n\t\t\tif (k == m)\r\n\t\t\t\tresult.Add(list.ToArray());\r\n\t\t\telse\r\n\t\t\t\tfor (int i = k; i <= m; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tSwap(ref list[k], ref list[i]);\r\n\t\t\t\t\tGetPermutationsRec(list, result, k + 1, m);\r\n\t\t\t\t\tSwap(ref list[k], ref list[i]);\r\n\t\t\t\t}\r\n\t\t}\r\n\r\n\t\tprivate class Perm\r\n\t\t{\r\n\t\t\tpublic List vals;\r\n\t\t\tpublic Perm missing;\r\n\r\n\t\t\tpublic Perm(int[] vals)\r\n\t\t\t{\r\n\t\t\t\tif (vals.Length == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.vals = new List();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar isIn = new bool[15];\r\n\t\t\t\tvar nl = new List();\r\n\t\t\t\tvar ms = new List();\r\n\t\t\t\tforeach (var v in vals)\r\n\t\t\t\t{\r\n\t\t\t\t\tisIn[v] = true;\r\n\t\t\t\t\tif (isIn[v - 1] && isIn[v + 1])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tms.Add(v);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnl.Add(v);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tms.Sort();\r\n\r\n\t\t\t\tthis.missing = new Perm(ms.ToArray());\r\n\r\n\t\t\t\tthis.vals = nl;\r\n\t\t\t}\r\n\r\n\t\t\tpublic override bool Equals(object obj)\r\n\t\t\t{\r\n\t\t\t\tvar mType = obj as Perm;\r\n\t\t\t\tif (mType == null)\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\treturn mType.vals.SequenceEqual(vals);\r\n\t\t\t}\r\n\r\n\r\n\t\t\tpublic override int GetHashCode()\r\n\t\t\t{\r\n\t\t\t\tint seed = vals.Count;\r\n\t\t\t\tconst int lul = (int)(0x9e3779b9 - int.MaxValue / 2);\r\n\r\n\t\t\t\tforeach (var v in vals)\r\n\t\t\t\t{\r\n\t\t\t\t\tseed ^= v + lul + (seed << 6) + (seed >> 2);\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn seed;\r\n\t\t\t}\r\n\r\n\t\t\tpublic override string ToString()\r\n\t\t\t{\r\n\t\t\t\treturn '{' + string.Join(' ', vals) + '}';\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprivate static void NewMethod1()\r\n\t\t{\r\n\t\t\tvar cases = int.Parse(Console.ReadLine());\r\n\t\t\tvar sols = new int[cases];\r\n\r\n\t\t\tfor (int @case = 0; @case < cases; @case++)\r\n\t\t\t{\r\n\t\t\t\tvar ints = Console.ReadLine().Split().Select(int.Parse).ToArray();\r\n\t\t\t\tvar n = ints[0];\r\n\t\t\t\tvar l = ints[1];\r\n\t\t\t\tvar r = ints[2];\r\n\r\n\t\t\t\tvar socks = Console.ReadLine().Split().Select(int.Parse).ToArray();\r\n\t\t\t\tvar colorCount = socks.Max() + 1;\r\n\r\n\t\t\t\tvar colorCountsL = new int[colorCount];\r\n\t\t\t\tvar colorCountsR = new int[colorCount];\r\n\r\n\t\t\t\tfor (int i = 0; i < l; i++)\r\n\t\t\t\t\tcolorCountsL[socks[i]]++;\r\n\r\n\t\t\t\tfor (int i = l; i < n; i++)\r\n\t\t\t\t\tcolorCountsR[socks[i]]++;\r\n\r\n\t\t\t\tif (l < r)\r\n\t\t\t\t{\r\n\t\t\t\t\tSwap(ref colorCountsL, ref colorCountsR);\r\n\t\t\t\t\tSwap(ref l, ref r);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar diff = (l - r) / 2;\r\n\r\n\t\t\t\tfor (int i = 0; i < colorCount; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar min = Min(colorCountsL[i], colorCountsR[i]);\r\n\t\t\t\t\tcolorCountsL[i] -= min;\r\n\t\t\t\t\tcolorCountsR[i] -= min;\r\n\r\n\t\t\t\t\tvar changedColor = Min(colorCountsL[i] / 2, diff);\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcolorCountsL[i] -= 2 * changedColor;\r\n\t\t\t\t\t\tdiff -= changedColor;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsols[@case] = (l - r) / 2 + (colorCountsR.Sum() + colorCountsL.Sum()) / 2;\r\n\r\n\t\t\t\t// staramy sie wyrownac liczbe kolorow miedzy prawymi a lewymi\r\n\t\t\t\t// wiemy ze lewych jest wiecej rowno prawych\r\n\t\t\t}\r\n\r\n\t\t\tsols.ToList().ForEach(x => Console.WriteLine(x));\r\n\t\t}\r\n\r\n\t\tpublic static void Swap(ref T a, ref T b)\r\n\t\t{\r\n\t\t\tT t = a;\r\n\t\t\ta = b;\r\n\t\t\tb = t;\r\n\t\t}\r\n\r\n\r\n\t\tprivate static void NewMethod()\r\n\t\t{\r\n\t\t\tvar sqrt = (int)Math.Sqrt(int.MaxValue / 2);\r\n\t\t\tvar squares = Enumerable.Range(1, sqrt).Select(x => x * x).ToHashSet();\r\n\r\n\t\t\tvar cases = int.Parse(Console.ReadLine());\r\n\t\t\tvar sols = new bool[cases];\r\n\r\n\t\t\tfor (int @case = 0; @case < cases; @case++)\r\n\t\t\t{\r\n\t\t\t\tvar n = int.Parse(Console.ReadLine());\r\n\t\t\t\tsols[@case] = (n % 2 == 0 && squares.Contains(n / 2)) || (n % 4 == 0 && squares.Contains(n / 4));\r\n\t\t\t}\r\n\r\n\t\t\tsols.ToList().ForEach(x => Console.WriteLine(x ? \"YES\" : \"NO\"));\r\n\t\t}\r\n\r\n\t\tprivate static void RunCaseA()\r\n\t\t{\r\n\t\t\tvar ints = Console.ReadLine().Split().Select(int.Parse).ToArray();\r\n\t\t\tvar n = ints[0];\r\n\t\t\tvar k = ints[1];\r\n\r\n\t\t\tvar vals = Console.ReadLine().Split().Select(int.Parse).ToArray();\r\n\t\t\tvar total = vals.Sum();\r\n\t\t\tif (k != total)\r\n\t\t\t{\r\n\r\n\t\t\t\tvar sol = new List();\r\n\t\t\t\tvar current = 0;\r\n\r\n\t\t\t\tfor (int i = 0; i < vals.Length; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (current + vals[i] == k)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcurrent += vals[i] + vals[i + 1];\r\n\t\t\t\t\t\tsol.Add(vals[i + 1]);\r\n\t\t\t\t\t\tsol.Add(vals[i]);\r\n\t\t\t\t\t\ti += 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsol.Add(vals[i]);\r\n\t\t\t\t\t\tcurrent += vals[i];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tstatic void PrintSol(int[] sol)\r\n\t\t{\r\n\t\t\tif (sol == null)\r\n\t\t\t\tConsole.WriteLine(\"NO\");\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tConsole.WriteLine(\"YES\");\r\n\t\t\t\tConsole.WriteLine(string.Join(' ', sol));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic static long LowerBound(long min, long max, Predicate test)\r\n\t\t{\r\n\t\t\tlong e = max;\r\n\t\t\tlong s = min;\r\n\r\n\t\t\twhile (s < e)\r\n\t\t\t{\r\n\t\t\t\tlong mid = (s + e) / 2;\r\n\t\t\t\tif (test(mid))\r\n\t\t\t\t\te = mid;\r\n\t\t\t\telse\r\n\t\t\t\t\ts = mid + 1;\r\n\t\t\t}\r\n\r\n\t\t\treturn e;\r\n\t\t}\r\n\r\n\t\tpublic static long UpperBound(long min, long max, Predicate test)\r\n\t\t{\r\n\t\t\tlong s = min;\r\n\t\t\tlong e = max;\r\n\r\n\t\t\twhile (s < e)\r\n\t\t\t{\r\n\t\t\t\tlong mid = (s + e) / 2;\r\n\t\t\t\tif (test(mid))\r\n\t\t\t\t\ts = mid + 1;\r\n\t\t\t\telse\r\n\t\t\t\t\te = mid;\r\n\t\t\t}\r\n\r\n\t\t\treturn s - 1;\r\n\t\t}\r\n\r\n\r\n\t\tpublic static (int, int)[] GetPairs(int count)\r\n\t\t{\r\n\t\t\tvar qs = new (int, int)[count];\r\n\t\t\tfor (int i = 0; i < count; i++)\r\n\t\t\t{\r\n\t\t\t\tvar line = Console.ReadLine();\r\n\t\t\t\tint spacePos = 1;\r\n\t\t\t\twhile (line[spacePos] != ' ')\r\n\t\t\t\t\tspacePos++;\r\n\r\n\t\t\t\tvar l = int.Parse(line.AsSpan(0, spacePos));\r\n\t\t\t\tvar r = int.Parse(line.AsSpan(spacePos + 1, line.Length - spacePos - 1));\r\n\t\t\t\tqs[i] = (l - 1, r - 1);\r\n\t\t\t}\r\n\r\n\t\t\treturn qs;\r\n\t\t}\r\n\r\n\t\tpublic static int[] GetInts(int count)\r\n\t\t{\r\n\t\t\tvar str = Console.ReadLine();\r\n\t\t\tvar a = new int[count];\r\n\r\n\t\t\tvar currentStart = 0;\r\n\t\t\tfor (int i = 0; i < count - 1; i++)\r\n\t\t\t{\r\n\t\t\t\tint currentEnd = currentStart + 1;\r\n\t\t\t\twhile (str[currentEnd] != ' ')\r\n\t\t\t\t\tcurrentEnd++;\r\n\r\n\t\t\t\ta[i] = int.Parse(str.AsSpan(currentStart, currentEnd - currentStart));\r\n\t\t\t\tcurrentStart = currentEnd + 1;\r\n\t\t\t}\r\n\r\n\t\t\ta[a.Length - 1] = int.Parse(str.AsSpan(currentStart, str.Length - currentStart));\r\n\t\t\treturn a;\r\n\t\t}\r\n\t}\r\n\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7185525476277c1738e9d7f9bb3cbf0c", "src_uid": "4f0e0d1deef0761a46b64de3eb98e774", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Program\n{\n\tint[][] c;\n\tint n, m;\n\tint mod = 1000000007;\n\tint add(int x, int y)\n\t{\n\t\tx+=y;\n\t\treturn x < mod ? x : x - mod;\n\t}\n\tint mul(int x, int y)\n\t{\n\t\treturn Convert.ToInt32(Convert.ToInt64(x) * y % mod);\n\t}\n\tvoid run()\n\t{\n\t\tString[] str = Console.ReadLine().Split(' ');\n\t\tn = Convert.ToInt32(str[0]);\n\t\tm = Convert.ToInt32(str[1]);\n\t\tint[][] dp=new int[n+1][];\n\t\tfor (int i = 1; i <= n; i++)\n\t\t{\n\t\t\tdp[i] = new int[m-1];\n\t\t\tif (i == 1)\n\t\t\t{\n\t\t\t\tfor (int j = 0; j <= m - 2; j++)\n\t\t\t\t\tdp[i][j] = 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tint now = 0;\n\t\t\tfor (int j = 0; j <= m-2; j++)\n\t\t\t{\n\t\t\t\tnow= add(now,dp[i-1][j]);\n\t\t\t\tdp[i][j] = add(j == 0 ? 0 : dp[i][j - 1], now);\n\t\t\t}\n\t\t}\n\n\t\tint[][] sum = new int[n+1][];\n\t\tfor (int i = 0; i <= n; i++)\n\t\t{\n\t\t\tsum[i] = new int[m - 1];\n\t\t\tfor (int j = 0; j <= m - 2; j++)\n\t\t\t\tsum[i][j] = i == 0 ? 0 : sum[i - 1][j] + dp[i][j];\n\t\t}\n\n\t\tint res = 0;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfor (int j = 0; j <= m - 2; j++)\n\t\t\t{\n\t\t\t\tres = add(res, mul(mul(sum[i][j], add(sum[n - i + 1][j], mod - sum[n - i][j])), m - 1 - j));\n\t\t\t}\n\t\tConsole.WriteLine(res);\n\t}\n\tstatic void Main(String[] args)\n\t{\n\t\tnew Program().run();\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fd6ffcd546f5acf9ffbabd1bf32a1c57", "src_uid": "9ca1ad2fa16ca81e9ab5eba220b162c1", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Program\n{\n\tint[][] c;\n\tint n, m;\n\tint mod = 1000000007;\n\tint add(int x, int y)\n\t{\n\t\tx+=y;\n\t\treturn x < mod ? x : x - mod;\n\t}\n\tint mul(int x, int y)\n\t{\n\t\treturn Convert.ToInt32(Convert.ToInt64(x) * y % mod);\n\t}\n\tvoid run()\n\t{\n\t\tString[] str = Console.ReadLine().Split(' ');\n\t\tn = Convert.ToInt32(str[0]);\n\t\tm = Convert.ToInt32(str[1]);\n\t\tint[][] dp=new int[n+1][];\n\t\tfor (int i = 1; i <= n; i++)\n\t\t{\n\t\t\tdp[i] = new int[m-1];\n\t\t\tif (i == 1)\n\t\t\t{\n\t\t\t\tfor (int j = 0; j <= m - 2; j++)\n\t\t\t\t\tdp[i][j] = 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tint now = 0;\n\t\t\tfor (int j = 0; j <= m-2; j++)\n\t\t\t{\n\t\t\t\tnow= add(now,dp[i-1][j]);\n\t\t\t\tdp[i][j] = add(j == 0 ? 0 : dp[i][j - 1], now);\n\t\t\t}\n\t\t}\n\n\t\tint[][] sum = new int[n+1][];\n\t\tfor (int i = 0; i <= n; i++)\n\t\t{\n\t\t\tsum[i] = new int[m - 1];\n\t\t\tfor (int j = 0; j <= m - 2; j++)\n\t\t\t\tsum[i][j] = i == 0 ? 0 : add(sum[i - 1][j] , dp[i][j]);\n\t\t}\n\n\t\tint res = 0;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfor (int j = 0; j <= m - 2; j++)\n\t\t\t{\n\t\t\t\tres = add(res, mul(mul(sum[i][j], add(sum[n - i + 1][j], mod - sum[n - i][j])), m - 1 - j));\n\t\t\t}\n\t\tConsole.WriteLine(res);\n\t}\n\tstatic void Main(String[] args)\n\t{\n\t\tnew Program().run();\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "21f8b9e51cfa4cb08482fb2fece27160", "src_uid": "9ca1ad2fa16ca81e9ab5eba220b162c1", "difficulty": 2400.0} {"lang": "MS C#", "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 E\n {\n private static ThreadStart s_threadStart = new E().Go;\n\n class Point\n {\n public int X, Y;\n public bool Keep;\n }\n\n private void Go()\n {\n long mod = 1000000007;\n\n int n = GetInt();\n Point[] points = new Point[n];\n for (int i = 0; i < n; i++)\n {\n points[i] = new Point() { X = GetInt(), Y = GetInt() };\n }\n\n Dictionary> xDict = new Dictionary>();\n Dictionary> yDict = new Dictionary>();\n for(int i = 0; i < n; i++)\n {\n List list;\n if (!xDict.TryGetValue(points[i].X, out list))\n list = xDict[points[i].X] = new List();\n\n list.Add(i);\n\n if (!yDict.TryGetValue(points[i].Y, out list))\n list = yDict[points[i].Y] = new List();\n\n list.Add(i);\n }\n\n long ans = 1;\n\n int k = n;\n for (int i = 0; i < n; i++)\n {\n if (xDict[points[i].X].Count == 1 && yDict[points[i].Y].Count == 1)\n {\n ans *= 3;\n ans %= mod;\n xDict.Remove(points[i].X);\n yDict.Remove(points[i].Y);\n k--;\n }\n }\n\n int m = xDict.Count() + yDict.Count();\n\n ans *= Bin(m, k, mod);\n ans %= mod;\n Wl(ans);\n }\n\n long Bin(long n, long k, long mod)\n {\n if (n < 2) return 1;\n\n long[] bin = new long[k + 1]; bin[0] = 1; bin[1] = 1;\n long[] next = new long[k + 1];\n long[] t;\n\n for (int i = 2; i <= k; i++)\n {\n next[0] = 1; next[i] = 1;\n for (int j = 1; j <= k && j < i; j++)\n next[j] = (bin[j] + bin[j - 1]) % mod;\n\n t = bin;\n bin = next;\n next = t;\n }\n\n long ans = 0;\n for (int i = 0; i <= k; i++)\n {\n ans += bin[i];\n ans %= mod;\n }\n return 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "27d822820fb092a1eba2691804e0ff04", "src_uid": "8781003d9eea51a509145bc6db8b609c", "difficulty": 2300.0} {"lang": "MS C#", "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 E\n {\n private static ThreadStart s_threadStart = new E().Go;\n\n class Point\n {\n public int X, Y;\n public bool Keep;\n }\n\n long[] F;\n\n private void Go()\n {\n long mod = 1000000007;\n\n int n = GetInt();\n Point[] points = new Point[n];\n for (int i = 0; i < n; i++)\n {\n points[i] = new Point() { X = GetInt(), Y = GetInt() };\n }\n\n F = new long[2*n + 1];\n F[0] = 1;\n for (int i = 1; i <= 2 * n; i++)\n F[i] = (F[i - 1] * i) % mod;\n\n Dictionary> xDict = new Dictionary>();\n Dictionary> yDict = new Dictionary>();\n for(int i = 0; i < n; i++)\n {\n List list;\n if (!xDict.TryGetValue(points[i].X, out list))\n list = xDict[points[i].X] = new List();\n\n list.Add(i);\n\n if (!yDict.TryGetValue(points[i].Y, out list))\n list = yDict[points[i].Y] = new List();\n\n list.Add(i);\n }\n\n long ans = 1;\n\n Queue queue = new Queue();\n while (xDict.Count > 0)\n {\n int k = 0;\n int m = 0;\n var pair = xDict.First();\n queue.Enqueue(pair.Value[0]);\n\n HashSet xDir = new HashSet();\n HashSet yDir = new HashSet();\n HashSet pSet = new HashSet();\n\n while (queue.Count > 0)\n {\n int pp = queue.Dequeue();\n Point point = points[pp];\n pSet.Add(pp);\n xDir.Add(point.X);\n yDir.Add(point.Y);\n if (xDict.ContainsKey(point.X))\n {\n foreach (int z in xDict[point.X])\n if (z != pp)\n queue.Enqueue(z);\n }\n if (yDict.ContainsKey(point.Y))\n {\n foreach (int z in yDict[point.Y])\n if (z != pp)\n queue.Enqueue(z);\n }\n xDict.Remove(point.X);\n yDict.Remove(point.Y);\n }\n\n ans *= Bin(xDir.Count() + yDir.Count(), pSet.Count(), mod);\n ans %= mod;\n }\n\n Wl(ans);\n }\n\n long Bin(long n, long k, long mod)\n {\n long ans = 0;\n for (int i = 0; i <= k; i++)\n {\n long add = F[n];\n add *= Inv(F[i], mod);\n add %= mod;\n add *= Inv(F[n - i], mod);\n add %= mod;\n ans += add;\n ans %= mod;\n }\n return ans;\n }\n\n public static long Pow(long a, long n, long mod)\n {\n long res = 1L;\n while (n > 0)\n {\n if ((n & 1) != 0)\n res = (res * a) % mod;\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long Inv(long a, long mod)\n {\n return Pow(a, mod - 2, mod);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5efd98a314e91f6a118400e4cef2a602", "src_uid": "8781003d9eea51a509145bc6db8b609c", "difficulty": 2300.0} {"lang": "MS C#", "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 E\n {\n private static ThreadStart s_threadStart = new E().Go;\n\n class Point\n {\n public int X, Y;\n public bool Keep;\n }\n\n long[] F;\n\n private void Go()\n {\n long mod = 1000000007;\n\n int n = GetInt();\n Point[] points = new Point[n];\n for (int i = 0; i < n; i++)\n {\n points[i] = new Point() { X = GetInt(), Y = GetInt() };\n }\n\n F = new long[n + 1];\n F[0] = 1;\n for (int i = 1; i <= n; i++)\n F[i] = (F[i - 1] * i) % mod;\n\n Dictionary> xDict = new Dictionary>();\n Dictionary> yDict = new Dictionary>();\n for(int i = 0; i < n; i++)\n {\n List list;\n if (!xDict.TryGetValue(points[i].X, out list))\n list = xDict[points[i].X] = new List();\n\n list.Add(i);\n\n if (!yDict.TryGetValue(points[i].Y, out list))\n list = yDict[points[i].Y] = new List();\n\n list.Add(i);\n }\n\n long ans = 1;\n\n Queue queue = new Queue();\n while (xDict.Count > 0)\n {\n int k = 0;\n int m = 0;\n var pair = xDict.First();\n queue.Enqueue(pair.Value[0]);\n\n HashSet xDir = new HashSet();\n HashSet yDir = new HashSet();\n HashSet pSet = new HashSet();\n\n while (queue.Count > 0)\n {\n int pp = queue.Dequeue();\n Point point = points[pp];\n pSet.Add(pp);\n xDir.Add(point.X);\n yDir.Add(point.Y);\n if (xDict.ContainsKey(point.X))\n {\n foreach (int z in xDict[point.X])\n if (z != pp)\n queue.Enqueue(z);\n }\n if (yDict.ContainsKey(point.Y))\n {\n foreach (int z in yDict[point.Y])\n if (z != pp)\n queue.Enqueue(z);\n }\n xDict.Remove(point.X);\n yDict.Remove(point.Y);\n }\n\n ans *= Bin(xDir.Count() + yDir.Count(), pSet.Count(), mod);\n ans %= mod;\n }\n\n Wl(ans);\n }\n\n long Bin(long n, long k, long mod)\n {\n long ans = 0;\n for (int i = 0; i <= k; i++)\n {\n long add = F[n];\n add *= Inv(F[i], mod);\n add %= mod;\n add *= Inv(F[n - i], mod);\n add %= mod;\n ans += add;\n ans %= mod;\n }\n return ans;\n }\n\n public static long Pow(long a, long n, long mod)\n {\n long res = 1L;\n while (n > 0)\n {\n if ((n & 1) != 0)\n res = (res * a) % mod;\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long Inv(long a, long mod)\n {\n return Pow(a, mod - 2, mod);\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ff9345b3a3a63ad92c653f9421f2fa39", "src_uid": "8781003d9eea51a509145bc6db8b609c", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Guess_the_Tree\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 int n = int.Parse(reader.ReadLine());\n\n string[] ss = reader.ReadLine().Split(' ');\n int[] nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = int.Parse(ss[i]);\n }\n\n Array.Sort(nn);\n\n bool[] used = new bool[n];\nbool ok = true;\n for (int i = 0; i < n; i++)\n {\n if (nn[i]>1)\n {\n int count = nn[i] - 1;\n int p = 0;\n for (int j = i; j >=0; j--)\n {\n if (!used[j] && nn[j]<=count)\n {\n if (p == 0 && nn[j] == count)\n continue;\n used[j] = true;\n count -= nn[j];\n p++;\n }\n if (count==0)\n break;\n }\n if (count!=0)\n {\n ok = false;\n break;\n }\n }\n }\n\n \n\n writer.WriteLine(\"{0}\", ok ? \"YES\" : \"NO\");\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b8302f201f7cde3f46caff68d1d5d5f", "src_uid": "ed0925cfaee961a3ceebd13b3c96a15a", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round63\n{\n class D\n {\n int[,,] win = new int[4,500, 500];\n int offset = 200;\n int[] vx, vy;\n int d;\n\n bool isLose(int x, int y) { return d*d <= x*x + y*y; }\n\n bool solve(int reflect, int x, int y)\n {\n if (isLose(x, y))\n return true;\n\n if (win[reflect, x + offset, y + offset] != 0)\n return win[reflect, x + offset, y + offset] > 0;\n\n if (reflect % 2 == 1)\n {\n if (!solve(reflect >> 1, y, x))\n return (win[reflect, x + offset, y + offset] = 1) > 0;\n }\n\n int r = ((reflect % 2) << 1) | (reflect >> 1);\n for (int i = 0; i < vx.Length; i++)\n if (!solve(r, x + vx[i], y + vy[i]))\n return (win[reflect, x + offset, y + offset] = 1) > 0;\n\n return (win[reflect, x + offset, y + offset] = -1) > 0;\n }\n\n D()\n {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n int x = xs[0],\n y = xs[1],\n n = xs[2];\n d = xs[3];\n vx = new int[n];\n vy = new int[n];\n for (int i = 0; i < n; i++)\n {\n var ys = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n vx[i] = ys[0];\n vy[i] = ys[1];\n }\n Console.WriteLine(solve(3, x, y) ? \"Anton\" : \"Dasha\");\n }\n\n public static void Main()\n {\n new D();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7c55ff6103f63f6a66e8870d622163f2", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round63\n{\n class D\n {\n int[,,] win = new int[4,500, 500];\n int offset = 200;\n int[] vx, vy;\n int d;\n\n bool isLose(int x, int y) { return d*d < x*x + y*y; }\n\n bool solve(int reflect, int x, int y)\n {\n if (isLose(x, y))\n return true;\n\n if (win[reflect, x + offset, y + offset] != 0)\n return win[reflect, x + offset, y + offset] > 0;\n\n if (reflect % 2 == 1)\n {\n if (!solve(reflect >> 1, y, x))\n return (win[reflect, x + offset, y + offset] = 1) > 0;\n }\n\n int r = ((reflect % 2) << 1) | (reflect >> 1);\n for (int i = 0; i < vx.Length; i++)\n if (!solve(r, x + vx[i], y + vy[i]))\n return (win[reflect, x + offset, y + offset] = 1) > 0;\n\n return (win[reflect, x + offset, y + offset] = -1) > 0;\n }\n\n D()\n {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n int x = xs[0],\n y = xs[1],\n n = xs[2];\n d = xs[3];\n vx = new int[n];\n vy = new int[n];\n for (int i = 0; i < n; i++)\n {\n var ys = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n vx[i] = ys[0];\n vy[i] = ys[1];\n }\n Console.WriteLine(solve(3, x, y) ? \"Anton\" : \"Dasha\");\n }\n\n public static void Main()\n {\n new D();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0e058bd71f519c8e496469581644fe30", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Cutlet\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 k = Next();\n\n var l = new int[k];\n var r = new int[k];\n for (int i = 0; i < k; i++)\n {\n l[i] = Next();\n r[i] = Next();\n }\n\n List[] dp;\n dp = new List[2*k + 1];\n\n for (int i = 0; i < dp.Length; i++)\n {\n dp[i] = new List();\n }\n dp[0].Add(new Interval(0, 0));\n\n int prev = 0;\n for (int i = 0; i < k; i++)\n {\n var next = new List[dp.Length];\n for (int ii = 0; ii < dp.Length; ii++)\n {\n next[ii] = new List();\n }\n\n int delta = l[i] - prev;\n for (int index = 0; index < dp.Length; index++)\n {\n if (index%2 == 0)\n {\n List t = dp[index];\n foreach (Interval interval in t)\n {\n interval.l += delta;\n interval.r += delta;\n }\n }\n }\n delta = r[i] - l[i];\n for (int ii = 0; ii < dp.Length; ii++)\n {\n if (ii%2 == 0)\n {\n foreach (Interval interval in dp[ii])\n {\n next[ii].Add(new Interval(interval.l + delta, interval.r + delta));\n next[ii + 1].Add(new Interval(interval.l, interval.r + delta));\n next[ii + 2].Add(new Interval(interval.l, interval.r + delta));\n }\n }\n else\n {\n foreach (Interval interval in dp[ii])\n {\n next[ii].Add(new Interval(interval.l, interval.r));\n next[ii + 1].Add(new Interval(interval.l, interval.r + delta));\n next[ii + 2].Add(new Interval(interval.l, interval.r + delta));\n }\n }\n }\n\n prev = r[i];\n for (int index = 0; index < dp.Length; index++)\n {\n dp[index].Clear();\n\n Interval pr = null;\n foreach (Interval interval in next[index].OrderBy(t => t.l))\n {\n if (interval.l > n)\n break;\n if (pr != null && pr.r >= interval.l)\n {\n pr.r = Math.Max(pr.r, interval.r);\n }\n else\n {\n if (pr != null && !Find(dp, pr, index))\n dp[index].Add(pr);\n pr = interval;\n }\n }\n if (pr != null && !Find(dp, pr, index))\n dp[index].Add(pr);\n }\n }\n\n {\n int delta = 2*n - prev;\n for (int index = 0; index < dp.Length; index++)\n {\n if (index%2 == 0)\n {\n List t = dp[index];\n foreach (Interval interval in t)\n {\n interval.l += delta;\n interval.r += delta;\n }\n }\n }\n }\n\n for (int i = 0; i < dp.Length; i++)\n {\n foreach (Interval interval in dp[i])\n {\n if (interval.l <= n && interval.r >= n)\n {\n writer.WriteLine(\"Full\");\n writer.WriteLine(i);\n return;\n }\n }\n }\n\n writer.WriteLine(\"Hungry\");\n }\n\n\n private static bool Find(List[] dp, Interval value, int index)\n {\n for (int i = index - 2; i >= 0; i--)\n {\n int ind = dp[i].BinarySearch(value, value);\n if (ind < 0)\n {\n ind = (~ind) - 1;\n if (ind > 0 && dp[i][ind].r >= value.r)\n {\n return true;\n }\n }\n else\n {\n if (dp[i][ind].r >= value.r)\n return true;\n }\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 #region Nested type: Interval\n\n private class Interval : IComparer\n {\n public int l, r;\n\n public Interval(int l, int r)\n {\n this.l = l;\n this.r = r;\n }\n\n #region IComparer Members\n\n public int Compare(Interval x, Interval y)\n {\n return x.l.CompareTo(y.l);\n }\n\n #endregion\n }\n\n #endregion\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7bf4de89d5b6e04129d5163b7a9ccac9", "src_uid": "2e0d1b1f1a7b8df2d2598c3cb2c869d5", "difficulty": 2400.0} {"lang": "Mono C#", "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 long[] a = new long[11];\n long[] p = new long[11];\n long[] r = new long[7];\n long[,] c = new long[11, 11];\n long mod = 1000000000 + 7;\n long[] p2 = new long[11];\n long[] p8 = new long[11];\n private int m;\n\n private long ans = 0;\n\n public void Solve()\n {\n for (int i = 0; i < 11; i++)\n {\n c[i, 0] = 1;\n }\n\n for (int i = 1; i < 11; i++)\n {\n for (int j = 1; j < 11; j++)\n {\n c[i, j] = c[i - 1, j - 1] + c[i - 1, j];\n }\n }\n\n p2[0] = 1;\n p8[0] = 1;\n for (int i = 1; i < 11; i++)\n {\n p2[i] = 2 * p2[i - 1];\n p8[i] = 8 * p8[i - 1];\n }\n\n Reader.ReadInt(out m);\n p[1] = 1;\n for (int i = 2; i <= 10; i++)\n {\n p[i] = 10 * p[i - 1];\n }\n Go(10, 0, 0);\n a[0]--;\n\n CalcAns(0, 1);\n\n Console.WriteLine(ans);\n }\n\n private void CalcAns(int t, long count)\n {\n if (t > 0 && (r.Sum() - r[0] >= r[0]))\n {\n return;\n }\n\n if (t == 7)\n {\n if (r.Sum() - r[0] < r[0])\n {\n ans = (ans + count)%mod;\n }\n return;\n }\n\n for (int i = 0; i < 10; i++)\n {\n if (a[i] > 0)\n {\n r[t] = i;\n long next = (count*a[i])%mod;\n a[i]--;\n CalcAns(t + 1, next);\n a[i]++;\n r[t] = 0;\n }\n }\n }\n\n private void Go(int t, int count, long current)\n {\n if (t == 0)\n {\n a[count]++;\n return;\n }\n\n for (int i = 0; i < 10; i++)\n {\n if (current + (i + 1) * p[t] <= m)\n {\n int d = (i == 4 || i == 7) ? 1 : 0;\n for (int j = 0; j < t; j++)\n {\n a[count + d + j] += c[t - 1, j]*p2[j]*p8[t - 1 - j];\n }\n }\n else\n {\n int d = (i == 4 || i == 7) ? 1 : 0;\n Go(t - 1, count + d, current + i * p[t]);\n break;\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "58b317e76447001e156fe816b7087ea4", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Diagnostics.Contracts;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R316D1\n{\n public struct ModInteger : IEquatable\n {\n readonly int mod;\n readonly long value;\n public ModInteger(int mod, long value = 0L)\n {\n this.mod = mod;\n this.value = value % mod;\n if (value < 0)\n {\n this.value = value + mod;\n }\n }\n\n public bool Equals(ModInteger other)\n {\n return mod == other.mod && value == other.value;\n }\n\n public override bool Equals(object obj)\n {\n if (!(obj is ModInteger))\n {\n return false;\n }\n var other = (ModInteger)obj;\n return Equals(other);\n }\n\n public override int GetHashCode()\n {\n return (int)value;\n }\n\n public static bool operator ==(ModInteger left, ModInteger right)\n {\n return left.Equals(right);\n }\n\n public static bool operator !=(ModInteger left, ModInteger right)\n {\n return !(left == right);\n }\n\n public static ModInteger LeftShift(ModInteger left, int right)\n {\n return left << right;\n }\n\n public static ModInteger operator <<(ModInteger left, int right)\n {\n if (right > 32)\n {\n return left << 32 << (right - 32);\n }\n return new ModInteger(left.mod, left.value << right);\n }\n\n public static ModInteger Add(ModInteger left, int right)\n {\n return left + right;\n }\n\n public static ModInteger operator +(ModInteger left, int right)\n {\n return new ModInteger(left.mod, left.value + right);\n }\n\n public static ModInteger operator ++(ModInteger m)\n {\n return m + 1;\n }\n\n public static ModInteger Multiply(ModInteger left, int right)\n {\n return new ModInteger(left.mod, left.value * right);\n }\n\n public static ModInteger operator *(ModInteger left, int right)\n {\n return Multiply(left, right);\n }\n\n public static ModInteger Div(int left, int right, int mod)\n {\n return Pow(right, mod - 2, mod) * left;\n }\n\n public static ModInteger Pow(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 new ModInteger(mod, res);\n }\n\n public static ModInteger ToModInteger(int value)\n {\n return new ModInteger(0, value);\n }\n\n public static implicit operator int(ModInteger value)\n {\n return (int)value.value;\n }\n\n public static int ToInt32(ModInteger value)\n {\n return value;\n }\n\n public static ModInteger Increment(ModInteger item)\n {\n return ++item;\n }\n }\n public static class Solver\n {\n const int mod = 1000000007;\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 int Parse(TextReader tr)\n {\n var info = CultureInfo.InvariantCulture;\n tr.ReadLine();\n var a = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();\n\n return Calc(a);\n }\n\n private static ModInteger Calc(int[] a)\n {\n int num1 = a.Count(x => x == 1);\n int num2 = a.Length - num1;\n\n return F(num1, num2);\n }\n\n private static ModInteger F(int a, int b)\n {\n var res = new ModInteger(mod, 1);\n\n for (int i = 0; i < b; ++i)\n {\n res *= a + 1 + i;\n }\n\n if (a == 0)\n {\n return res;\n }\n\n var I = new ModInteger[a + 1];\n I[0] = new ModInteger(mod, 1);\n I[1] = new ModInteger(mod, 1);\n for (int i = 2; i <= a; ++i)\n {\n I[i] = I[i - 1] + (i - 1) * I[i - 2];\n }\n return res * I[a];\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cc8dbe6233c28c676816af71cc393923", "src_uid": "91e8dbe94273e255182aca0f94117bb9", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Diagnostics.Contracts;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R316D1\n{\n public struct ModInteger : IEquatable\n {\n readonly int mod;\n readonly long value;\n public ModInteger(int mod, long value = 0L)\n {\n this.mod = mod;\n this.value = value % mod;\n if (value < 0)\n {\n this.value = value + mod;\n }\n }\n\n public bool Equals(ModInteger other)\n {\n return mod == other.mod && value == other.value;\n }\n\n public override bool Equals(object obj)\n {\n if (!(obj is ModInteger))\n {\n return false;\n }\n var other = (ModInteger)obj;\n return Equals(other);\n }\n\n public override int GetHashCode()\n {\n return (int)value;\n }\n\n public static bool operator ==(ModInteger left, ModInteger right)\n {\n return left.Equals(right);\n }\n\n public static bool operator !=(ModInteger left, ModInteger right)\n {\n return !(left == right);\n }\n\n public static ModInteger LeftShift(ModInteger left, int right)\n {\n return left << right;\n }\n\n public static ModInteger operator <<(ModInteger left, int right)\n {\n if (right > 32)\n {\n return left << 32 << (right - 32);\n }\n return new ModInteger(left.mod, left.value << right);\n }\n\n public static ModInteger Add(ModInteger left, int right)\n {\n return left + right;\n }\n\n public static ModInteger operator +(ModInteger left, int right)\n {\n return new ModInteger(left.mod, left.value + right);\n }\n\n public static ModInteger operator ++(ModInteger m)\n {\n return m + 1;\n }\n\n public static ModInteger Multiply(ModInteger left, int right)\n {\n return new ModInteger(left.mod, left.value * right);\n }\n\n public static ModInteger operator *(ModInteger left, int right)\n {\n return Multiply(left, right);\n }\n\n public static ModInteger Div(int left, int right, int mod)\n {\n return Pow(right, mod - 2, mod) * left;\n }\n\n public static ModInteger Pow(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 new ModInteger(mod, res);\n }\n\n public static ModInteger ToModInteger(int value)\n {\n return new ModInteger(0, value);\n }\n\n public static implicit operator int(ModInteger value)\n {\n return (int)value.value;\n }\n\n public static int ToInt32(ModInteger value)\n {\n return value;\n }\n\n public static ModInteger Increment(ModInteger item)\n {\n return ++item;\n }\n }\n public static class Solver\n {\n const int mod = 1000000007;\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 int Parse(TextReader tr)\n {\n var info = CultureInfo.InvariantCulture;\n tr.ReadLine();\n var a = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();\n\n return Calc(a);\n }\n\n private static ModInteger Calc(int[] a)\n {\n int num1 = a.Count(x => x == 1);\n int num2 = a.Length - num1;\n\n return F(num1, num2);\n }\n\n private static ModInteger F(int a, int b)\n {\n var res = new ModInteger(mod, 1);\n\n for (int i = 0; i < b; ++i)\n {\n res *= a + 1 + i;\n }\n\n var I = new ModInteger[a + 1];\n I[0] = new ModInteger(mod, 1);\n I[1] = new ModInteger(mod, 1);\n for (int i = 2; i <= a; ++i)\n {\n I[i] = I[i - 1] + (i - 1) * I[i - 2];\n }\n return res * I[a];\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9cafb165242f5c3dd4b4f3c3a1846d19", "src_uid": "91e8dbe94273e255182aca0f94117bb9", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Phone_Number\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[] nn = s.ToCharArray().Select(e => e - '0').ToArray();\n\n var dp = new long[10,nn.Length];\n for (int i = 0; i < 10; i++)\n {\n dp[i, 0] = 1;\n }\n\n for (int j = 1; j < nn.Length; j++)\n {\n for (int i = 0; i < 10; i++)\n {\n int ss = i + nn[j];\n if (ss%2 == 0)\n dp[ss/2, j] += dp[i, j - 1];\n else\n {\n dp[ss/2, j] += dp[i, j - 1];\n dp[(ss + 1)/2, j] += dp[i, j - 1];\n }\n }\n }\n\n long sum = -1;\n for (int i = 0; i < 10; i++)\n {\n sum += dp[i, nn.Length - 1];\n }\n for (int i = 1; i < nn.Length; i++)\n {\n if (Math.Abs(nn[i] - nn[i - 1]) > 1)\n {\n sum++;\n break;\n }\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fade29cfe46d4f2ad5951ebfe7d48802", "src_uid": "2dd8bb6e8182278d037aa3a59ca3517b", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.SchoolTeam2\n{\n class H\n {\n public static void Main()\n {\n string s = Console.ReadLine();\n int n = s.Length;\n long[,] dp = new long[n, 10];\n\n long res = 0;\n bool self = false;\n for (int u = 0; u < 10; u++)\n {\n for (int i = 0; i < n; i++)\n for (int j = 0; j < 10; j++)\n dp[i, j] = 0;\n dp[0, u] = 1;\n for (int i = 1; i < n; i++)\n {\n int x = s[i] - '0';\n for (int j = 0; j < 10; j++)\n {\n int y = j + x;\n for (int k = 0; k <= y % 2; k++)\n dp[i, y / 2 + k] += dp[i - 1, j];\n }\n }\n for (int i = 0; i < 10; i++) res += dp[n - 1, i];\n\n bool b = true;\n for (int i = 0; i < n; i++) b &= dp[i, s[i] - '0'] > 0;\n self |= b;\n }\n\n Console.WriteLine(res - (self ? 1 : 0));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e47dfdd73e9ec1b1de29ca473d8dec96", "src_uid": "2dd8bb6e8182278d037aa3a59ca3517b", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace AprilFoolsDayContest2021\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int i = int.Parse(Console.ReadLine());\r\n\r\n Console.WriteLine((2 + i) / 2);\r\n }\r\n\r\n static void CMain(string[] args)\r\n {\r\n string word = Console.ReadLine();\r\n\r\n for (int i = 1; i < word.Length - 1; i++)\r\n {\r\n if (((word[i - 1] - 65) + (word[i] - 65)) % 26 != (word[i + 1] - 65))\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 static void XMain(string[] args)\r\n {\r\n int num = int.Parse(Console.ReadLine());\r\n\r\n double root = Math.Sqrt(num);\r\n int _root = (int)root;\r\n int proot = _root - 1;\r\n int nroot = _root + 1;\r\n\r\n if (root - proot > nroot - root)\r\n {\r\n if (root - _root > nroot - root)\r\n {\r\n Console.WriteLine(nroot);\r\n } else\r\n {\r\n Console.WriteLine(_root);\r\n }\r\n } else\r\n {\r\n if (root - _root > root - proot)\r\n {\r\n Console.WriteLine(proot);\r\n }\r\n else\r\n {\r\n Console.WriteLine(_root);\r\n }\r\n }\r\n }\r\n\r\n static void AMain(string[] args)\r\n {\r\n while (Console.In.Peek() != -1)\r\n {\r\n string test = Console.ReadLine();\r\n if (test.ToLower().Equals(\"Is it rated?\".ToLower()))\r\n {\r\n Console.WriteLine(\"No\");\r\n } else\r\n {\r\n Console.WriteLine(\"No\");\r\n }\r\n Console.Out.Flush();\r\n }\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9546ca4b33473daaf209bbf73074e8d7", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace AprilFoolsDayContest2021\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int i = int.Parse(Console.ReadLine());\r\n\r\n Console.WriteLine((2 - i*i));\r\n }\r\n\r\n static void CMain(string[] args)\r\n {\r\n string word = Console.ReadLine();\r\n\r\n for (int i = 1; i < word.Length - 1; i++)\r\n {\r\n if (((word[i - 1] - 65) + (word[i] - 65)) % 26 != (word[i + 1] - 65))\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 static void XMain(string[] args)\r\n {\r\n int num = int.Parse(Console.ReadLine());\r\n\r\n double root = Math.Sqrt(num);\r\n int _root = (int)root;\r\n int proot = _root - 1;\r\n int nroot = _root + 1;\r\n\r\n if (root - proot > nroot - root)\r\n {\r\n if (root - _root > nroot - root)\r\n {\r\n Console.WriteLine(nroot);\r\n } else\r\n {\r\n Console.WriteLine(_root);\r\n }\r\n } else\r\n {\r\n if (root - _root > root - proot)\r\n {\r\n Console.WriteLine(proot);\r\n }\r\n else\r\n {\r\n Console.WriteLine(_root);\r\n }\r\n }\r\n }\r\n\r\n static void AMain(string[] args)\r\n {\r\n while (Console.In.Peek() != -1)\r\n {\r\n string test = Console.ReadLine();\r\n if (test.ToLower().Equals(\"Is it rated?\".ToLower()))\r\n {\r\n Console.WriteLine(\"No\");\r\n } else\r\n {\r\n Console.WriteLine(\"No\");\r\n }\r\n Console.Out.Flush();\r\n }\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4bc862544304cbbc2fcf1d4954db794e", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing Number = System.Boolean;\nnamespace Program\n{\n public class Solver\n {\n\n public void Solve()\n {\n var n = sc.Integer();\n var s = sc.Scan();\n var X = new List();\n var Y = new List();\n var Z = new List();\n for (int i = 0; i < n; i++)\n {\n var c = s[i];\n if (c == 'V') { X.Add(i); }\n else if (c == 'K') { Y.Add(i); }\n else { Z.Add(i); }\n }\n var x = X.Count; var y = Y.Count; var z = Z.Count;\n X.Add(n + 1000000); Y.Add(n + 1000000); Z.Add(n + 1000000);\n var D = new List[] { X, Y, Z };\n var dp = new int[x + 2, y + 2, 2];\n for (int i = 0; i < x + 2; i++)\n for (int j = 0; j < y + 2; j++)\n for (int k = 0; k < 2; k++)\n dp[i, j, k] = 1000000;\n dp[0, 0, 0] = 0;\n for (int pos = 0; pos < n; pos++)\n {\n var next = new int[x + 2, y + 2, 2];\n for (int i = 0; i < x + 2; i++)\n for (int j = 0; j < y + 2; j++)\n for (int k = 0; k < 2; k++)\n next[i, j, k] = 1000000;\n for (int a = 0; a < x + 1; a++)\n for (int b = 0; b < y + 1; b++)\n {\n var c = pos - a - b;\n if (c < 0) continue;\n if (c > z) continue;\n var vec = new int[] { a, b, c };\n for (int k = 0; k < 2; k++)\n {\n if (dp[a, b, k] >= 1000000) continue;\n next[a + 1, b, 1] = Math.Min(next[a + 1, b, 1], dp[a, b, k] + d(X[a], 0, vec, D));\n if (k != 1)\n next[a, b + 1, 0] = Math.Min(next[a, b + 1, 0], dp[a, b, k] + d(Y[b], 1, vec, D));\n next[a, b, 0] = Math.Min(next[a, b, 0], dp[a, b, k] + d(Z[c], 2, vec, D));\n }\n }\n dp = next;\n }\n IO.Printer.Out.WriteLine(Math.Min(dp[x, y, 0], dp[x, y, 1]));\n\n }\n int d(int p, int k, int[] P, List[] D)\n {\n var v = 0;\n for (int i = 0; i < 3; i++)\n {\n if (i == k) continue;\n for (int j = 0; j < P[i]; j++)\n if (p < D[i][j]) v++;\n }\n return v;\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\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e91f80718d33a07424178125c5e03f69", "src_uid": "08444f9ab1718270b5ade46852b155d7", "difficulty": 2500.0} {"lang": "Mono C#", "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 /*Random random = new Random();\n for (int kk = 0; kk < 50; kk++)\n {\n for (int i = 0; i < 250; i++)\n {\n Writer.Write(\"{0} \", random.Next(201));\n }\n Writer.WriteLine();\n }*/\n\n int[] a = ReadIntArray();\n int n = a.Length;\n int s = 10; // ???\n // double min = a.Min();\n // double max = a.Max();\n // double d = max - min;\n // min -= d / 2 / n;\n // max += d / 2 / n;\n\n double p = a.Average();\n //double sum = GetValue(a, s, n, a.Max());\n double mean = a.Average();\n double sum = a.Sum(x => (x - mean) * (x - mean));\n sum /= (a.Max() - a.Min()) * (a.Max() - a.Min());\n\n int k = s - 3;\n // double X = 2.17;\n double X = 40;\n\n maxx = Math.Min(maxx, sum);\n // Writer.WriteLine(maxx);\n bool isUniform = sum > 15;\n Writer.WriteLine(isUniform ? \"uniform\" : \"poisson\");\n if (isUniform)\n {\n //Writer.WriteLine((a.Min() + a.Max()) / 2);\n }\n else\n {\n //int R = 50;\n //a = a.OrderBy(x => x).Take(a.Length - R).Skip(R).ToArray();\n //Writer.WriteLine(((int)Math.Round(a.Average())));\n }\n }\n\n private static double GetValue(int[] a, int s, int n, double max)\n {\n double min = 0;\n double e = (max - min) / s;\n\n int[] count = new int[s];\n for (int i = 0; i < n; i++)\n {\n int index = (int)((a[i] - min - 1e-10) / e);\n if (index < 0)\n {\n index = 0;\n }\n if (index >= s)\n {\n index = s - 1;\n }\n count[index]++;\n }\n\n double np = (double)n / s;\n double sum = count.Sum(x => (x - np) * (x - np) / np);\n return sum;\n }\n\n public static double maxx = double.MaxValue;\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 class Point\n {\n public Point(int x, int y)\n {\n X = x;\n Y = y;\n }\n\n public int X;\n\n public int Y;\n\n protected bool Equals(Point other)\n {\n return X == other.X && Y == other.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() != this.GetType())\n {\n return false;\n }\n return Equals((Point)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (X * 397) ^ Y;\n }\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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e5aa38ffe18809a21de028a676408962", "src_uid": "6ef75e501b318c0799d3cbe8ca998984", "difficulty": 2800.0} {"lang": "C# 8", "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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c024c7f11d2e75383fdafdbb7e7a827e", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Mathematics;\nusing CompLib.Util;\n\npublic class Program\n{\n long N, K;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextLong();\n K = sc.NextLong();\n\n // n*n\u76e4\u9762 \u306bn\u500b\u306e\u30eb\u30fc\u30af(\u98db\u8eca)\u3092\u7f6e\u304f\n\n // \u3059\u3079\u3066\u306e\u7a7a\u306e\u30de\u30b9\u304c\u653b\u6483\u3092\u53d7\u3051\u308b\n // k\u500b\u306e\u4e92\u3044\u306b\u653b\u6483\u3057\u3042\u3046\u30da\u30a2\u304c\u3042\u308b\n // \u4f55\u901a\u308a\u304b?\n\n // \u5404\u884c\u306b1\u3064\u3065\u3064\u3042\u308b\n // i\u5217\u76ee\u306bc[i]\u500b \u30da\u30a2\u304cc[i] -1\u500b\u5897\u3048\u308b\n\n // j\u5217\u306b\u5206\u3051\u308b \u30da\u30a2\u306e\u6570 n-j\n\n if (K >= N)\n {\n Console.WriteLine(0);\n return;\n }\n\n if (K == 0)\n {\n ModInt ans = 1;\n for (int i = 1; i <= N; i++)\n {\n ans *= i;\n }\n\n Console.WriteLine(ans);\n return;\n }\n\n // n\u500b\u3092n-k\u5217\u306b\u5206\u3051\u308b\u65b9\u6cd5\n long j = N - K;\n\n\n ModInt a = 1;\n ModInt b = 1;\n for (int i = 0; i < j; i++)\n {\n b *= i + 1;\n a *= N - i;\n }\n\n\n // \u5217\u306e\u9078\u3073\u65b9 n C n-k\n ModInt[] fact = new ModInt[j+1];\n fact[0] = 1;\n for (int i = 1; i <= j; i++)\n {\n fact[i] = fact[i - 1] * i;\n }\n // \u99d2\u306e\u632f\u308a\u5206\u3051\u65b9 j^n - (j-1)^n \n ModInt c = 0;\n for (int i = 0; i < j; i++)\n {\n // (j-i)^n * j C i\n c += ModInt.Pow(j - i, N) * fact[j] * ModInt.Inverse(fact[j - i] * fact[i]) * (i % 2 == 0 ? 1 : -1); \n }\n\n // Console.WriteLine(a * ModInt.Inverse(b));\n ModInt e = a * ModInt.Inverse(b) * c * 2;\n Console.WriteLine(e);\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 /// [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 = 998244353;\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 #endregion\n #region Binomial Coefficient\n public class 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 #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 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "efbf29ed30f9b766fd444894010bd9bf", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Trace;\nusing SB = System.Text.StringBuilder;\nusing static System.Math;\nusing static System.Numerics.BigInteger;\nusing static Program.IO.Scanner;\n\nusing Number = System.Int64;\n#region IO\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\tstatic public class Scanner {\n\t\tpublic static StreamScanner sc = new StreamScanner(Console.OpenStandardInput());\n\t\tpublic static int ri => sc.Integer();\n\t\tpublic static long rl => sc.Long();\n\t\tpublic static string rs => sc.Scan();\n\t\tpublic static double rd => sc.Double();\n\t}\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\n#endregion\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, 100000000);\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\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random(0);\n\t\tpublic void Solve() {\n\t\t\tvar n = ri;\n\t\t\tvar k = rl;\n\t\t\tif (k >= n) {\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsolve(n, (int)k);\n\t\t}\n\t\tvoid solve(int n, int k) {\n\t\t\tvar binom = new BinomialCoefficient(n + 50);\n\t\t\tif (k == 0) {\n\t\t\t\tConsole.WriteLine(binom.fact[n]);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tModInt ans = 0;\n\t\t\tvar m = n - k;\n\t\t\tfor (int i = 1; i <= m; i++) {\n\t\t\t\tvar v = binom[m, i];\n\t\t\t\tv *= ModInt.Pow(i, n);\n\t\t\t\tif ((m - i) % 2 == 1)\n\t\t\t\t\tans -= v;\n\t\t\t\telse ans += v;\n\t\t\t}\n\t\t\tDebug.WriteLine(ans);\n\t\t\tans *= binom[n, m];\n\t\t\tDebug.WriteLine(ans);\n\t\t\tans *= 2;\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t\tstatic int[] dx = { -1, 0, 1, 0 };\n\t\tconst long INF = 1L << 60;\n\t\tstatic int[] dy = { 0, 1, 0, -1 };\n\t\tstatic T[] Enumerate(int n, Func f) {\n\t\t\tvar a = new T[n]; for (int i = 0; i < a.Length; ++i) a[i] = f(i); return a;\n\t\t}\n\t\tstatic T[][] Enumerate(int n, int m, Func f) {\n\t\t\treturn Enumerate(n, x => Enumerate(m, y => f(x, y)));\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#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n\tpublic const long Mod = 998244353;\n\tpublic long num;\n\tpublic ModInt(long n) { num = n; }\n\tpublic override string ToString() { return num.ToString(); }\n\tpublic static ModInt operator +(ModInt l, ModInt r) { return new ModInt(l.num + r.num < Mod ? l.num + r.num : l.num + r.num - Mod); }\n\tpublic static ModInt operator -(ModInt l, ModInt r) { return new ModInt(l.num + Mod - r.num < Mod ? l.num + Mod - r.num : l.num - r.num); }\n\tpublic static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }\n\tpublic static ModInt operator /(ModInt l, ModInt r) { return l * Inverse(r); }\n\tpublic static implicit operator ModInt(long n) { return new ModInt(n); }\n\tpublic static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }\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\tpublic static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }\n\tpublic static ModInt Modulo(long v) { return new ModInt(((v % Mod) + Mod) % Mod); }\n}\n#endregion\n\n#region Binomial Coefficient\npublic class BinomialCoefficient {\n\tpublic ModInt[] fact, ifact;\n\tpublic BinomialCoefficient(int n) {\n\t\tfact = new ModInt[n + 1];\n\t\tifact = new ModInt[n + 1];\n\t\tfact[0] = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfact[i] = fact[i - 1] * i;\n\t\tifact[n] = ModInt.Inverse(fact[n]);\n\t\tfor (int i = n - 1; i >= 0; i--)\n\t\t\tifact[i] = ifact[i + 1] * (i + 1);\n\t\tifact[0] = ifact[1];\n\t}\n\tpublic ModInt this[int n, int r] {\n\t\tget {\n\t\t\tif (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;\n\t\t\treturn fact[n] * ifact[n - r] * ifact[r];\n\t\t}\n\t}\n\tpublic ModInt RepeatedCombination(int n, int k) {\n\t\tif (k == 0) return 1;\n\t\treturn this[n + k - 1, k];\n\t}\n}\n#endregion\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b3c128fb287ffc49516ff25bcd59b44b", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "difficulty": 2300.0} {"lang": "MS C#", "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 static System.Math;\n//using static MathEx;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = ri;\n var c = new char[n];\n var a = new int[n];\n var b = new int[n];\n for (int i = 0; i < n; i++)\n {\n c[i] = rc;\n a[i] = ri;\n b[i] = ri;\n }\n var dp = new int[1 << n, 15 * 16 / 2];\n for (int i = 0; i < 1 << n; i++)\n for (int j = 0; j < 15 * 16 / 2; j++)\n dp[i, j] = -1000000000;\n dp[0, 0] = 0;\n for (int i = 0; i < 1 << n; i++)\n for (int j = 0; j < 15 * 16 / 2; j++)\n {\n if (dp[i, j] < 0) continue;\n var u = 0;\n var v = 0;\n for (int k = 0; k < n; k++)\n {\n if ((i >> k & 1) == 1)\n {\n if (c[k] == 'R') u++;\n else v++;\n }\n }\n for (int k = 0; k < n; k++)\n {\n if ((i >> k & 1) == 0)\n {\n var x = Min(u, a[k]);\n var y = Min(v, b[k]);\n dp[i | 1 << k, j + x] = Max(dp[i | 1 << k, j + x], dp[i, j] + y);\n }\n }\n }\n var min = 1000000000;\n for (int i = 0; i < 15 * 16 / 2; i++)\n {\n var u = a.Sum() - i;\n var v = b.Sum() - dp[(1 << n) - 1, i];\n min = Min(min, Max(u, v));\n }\n IO.Printer.Out.WriteLine(min + n);\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\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "edb791af5882d37ec3e7fe7dad654ed8", "src_uid": "25a77f2b7cb281ff3c7800a20b3e5969", "difficulty": 2400.0}