{"lang": "MS C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n Regex regex = new Regex(@\"hello*\");\n Match match = regex.Match(input);\n if (match.Success)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bd49420190a3e2aac9ba80e0e2e3e615", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "bla", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0f793f73bc7b89f29daff1da91926bb5", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\npublic class Program\n{\n private static void Main()\n {//hlelo\n var str = new string(Console.ReadLine().Where(c => \"helo\".Contains(c)).ToArray());\n str = str.Remove(0, str.IndexOf('h'));\n if (str.IndexOf(\"h\") < str.IndexOf(\"e\") && str.All(c => \"helo\".Contains(c)) && str.Count(c => c == 'l') > 1)\n {\n str = str.Remove(0, str.IndexOf('e'));\n if (str.IndexOf(\"e\") < str.IndexOf(\"l\"))\n {\n str = str.Remove(0, str.IndexOf('l')+);\n if (str.IndexOf(\"l\") < str.IndexOf(\"o\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ea4663aa87660903af5c60e688210195", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace codeforces58A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input_string = Console.ReadLine();\n string hello = \"hello\";\n int hello_index = 0;\n\n for (int i = 0; i < input_string.Length; i++)\n {\n if (input_string[i] == hello[hello_index])\n hello_index += 1;\n\n }\n\n if (hello_index == 5){\n Console.WriteLine(\"YES\");\n }\n else{\n Console.WriteLine(\"NO\");\n }\n }\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eb6085765b96fec4342658a83d471dc9", "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 static class Operacao\n {\n private static int k = 0; //vari\u00e1vel de controle para letras desejadas encontradas\n private static string[] frase = { \"h\", \"e\", \"l\", \"l\", \"o\" }; //string buscada\n\n public static void TesteChatRoom(string s) //funcionamento do algoritmo\n {\n for (int i = 0; i < s.Length; i++) //percorrer a string inserida pelo usu\u00e1rio\n {\n if (frase[k] == Convert.ToString(s[i])) //se a letra na string digitada \u00e9 equivalente a letra na string procurada\n {\n k++; //prosegue para a pr\u00f3xima letra da string digitada\n\n if (k == 5) //se o contador chegar em 5 -> \"hello\" encontrado\n {\n Console.WriteLine(\"YES\"); //exibe confirma\u00e7\u00e3o\n break; //interrompe o algoritmo\n }\n }\n }\n //acabando de percorrer a string\n if (k < 5) //Se o contador de controle for menor que 5\n Console.WriteLine(\"NO\"); //mensagem de nega\u00e7\u00e3o -> palavra n\u00e3o encontrada\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1859a59b4df81dd674bdf2ec84511747", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "hlelo\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7286d495c6a35adf646c841d3ceae749", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"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).ToList();\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.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": "4b44c84535a3e1e1f0486baf70444ed3", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "public 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": "22d06a2126a8f10a76ef25ba3de65e54", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " string First_Line = Console.ReadLine();\n string Second_Line = Console.ReadLine();\n Console.WriteLine(string.Compare(First_Line, Second_Line));", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7796026b338c5874fcb654c595dc01f0", "src_uid": "ffeae332696a901813677bd1033cf01e", "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}\") = \"Problem112A\", \"Problem112A\\Problem112A.csproj\", \"{B3F4B960-FFEE-441A-8FF8-37DDC98BF8F8}\"\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{B3F4B960-FFEE-441A-8FF8-37DDC98BF8F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B3F4B960-FFEE-441A-8FF8-37DDC98BF8F8}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B3F4B960-FFEE-441A-8FF8-37DDC98BF8F8}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B3F4B960-FFEE-441A-8FF8-37DDC98BF8F8}.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": "d0521a0c49634143fc952f7f87f79a4c", "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 string firstString_ = firstString.ToLower();\n string secondString_ = secondString.ToLower();\n \n if(firstString_ < secondString_)\n {\n Console.WriteLine(\"-1\");\n }\n else if(firstString_ > secondString_)\n {\n Console.WriteLine(\"1\");\n }\n else\n {\n Console.WriteLine(\"0\");\n }\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "db27afecc874153c650279768d7abb22", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n \n \n class program{\n \n static void Main(string[] args)\n {\n string firstString = Console.ReadLine();\n string secondString = Console.ReadLine();\n byte[] firstByte = Encoding.ASCII.GetBytes(firstString.ToLower());\n byte[] secondByte = Encoding.ASCII.GetBytes(secondString.ToLower());\n\n int compareF = 0;\n int compareS = 0;\n for (int i=0;i< firstByte.Length;i++)\n {\n if(firstByte[i] > secondByte[i])\n {\n compareF = firstByte[i] - secondByte[i];\n }\n else\n {\n compareS = secondByte[i] - firstByte[i];\n }\n }\n if(compareF > compareS)\n {\n Console.WriteLine(\"1\");\n }\n else if(compareF < compareS)\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n Console.WriteLine(\"0\");\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "20f85436b60f9b50fd3f0f864c350a28", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n\n if (a.Length > b.Length)\n Console.WriteLine(1);\n if (a.Length < b.Length)\n Console.WriteLine(-1);\n if (a.Length == b.Length)\n Console.WriteLine(0);\n\n Console.ReadKey();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9c510217f041d4c8db52b72a7b7af20d", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace codeforces\n//#31 Resolve Petya and Strings\n{\n class Program\n {\n static void Main(string[] args)\n {\n string firstinput = Console.ReadLine(),\n secondinput = Console.ReadLine(),\n differentstrings1 = \"\", differentstrings2 = \"\";\n\n int length = firstinput.Length;\n\n firstinput = firstinput.ToLower();\n secondinput = secondinput.ToLower();\n\n for (int i = 0; i < length; i++)\n {\n if (firstinput[i] != secondinput[i]) { differentstrings1 += firstinput[i]; differentstrings2 += secondinput[i]; break; }\n }\n if (firstinput == secondinput) Console.WriteLine(0);\n if ((int)differentstrings1[0] > (int)differentstrings2[0]) Console.WriteLine(1);\n else if ((int)differentstrings1[0] < (int)differentstrings2[0]) Console.WriteLine(-1);\n else if ((int)differentstrings1[0] == (int)differentstrings2[0]) Console.WriteLine(0);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "56af735cb60e18ee68e055a140d784c5", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Http.Headers;\nusing System.Xml.Schema;\n\nnamespace CodeForces\n{\n\n\n\n class Program\n {\n\n public static int CompareString(string one, string two)\n {\n int output = 0;\n string temp;\n bool change = false;\n if(one.Length>two.Length)\n {\n temp = two;\n two = one;\n one = temp;\n change = true;\n }\n\n for(int i=0;itwo[i])\n {\n output = 1;\n break;\n }\n }\n\n if(change)\n {\n output *= -1;\n }\n\n return output;\n }\n \n \n static void Main(string[] args)\n {\n string strFrs = Console.ReadLine().ToLower();\n string strSec = Console.ReadLine().ToLower();\n int output = 0;\n\n if(strFrs!=strSec)\n {\n output = CompareString(strFrs, strSec);\n }\n\n Console.WriteLine(output);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f50fb94223ed5b5ddd29ef9a4cdc98b1", "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 \n if(a.ToLower() == b.ToLower()){\n Console.WriteLine(\"0\");\n }\n else if(a.ToLower()>b.ToLower()){\n Console.WriteLine(\"-1\");\n }\n else{\n Console.WriteLine(\"1\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f6ea6f4ca196c5e6506c6e482cc5138d", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "providerusing 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 private int SummStringSymbol(string _str)\n {\n int summ = 0;\n foreach (var symbol in _str)\n {\n summ += (int)symbol;\n }\n\n return summ;\n }\n\n public int GetCode()\n {\n if (SummStringSymbol(_str1) > SummStringSymbol(_str2))\n return 1;\n if (SummStringSymbol(_Str1) < SummStringSymbol(_Str2))\n return -1;\n\n return 0;\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d6a6ce836f09d153977acd33556c9576", "src_uid": "ffeae332696a901813677bd1033cf01e", "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 }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e0b059e0d195b5dad3d3a7ae8abc7192", "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 CsharpTutorials\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": "ce50e98e8b83a7b854067d2c673f12a9", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": " static void Main(string[] args)\n {\n var w = Convert.ToInt32(Console.ReadLine());\n\n for (int i = 2; i < w; i += 2)\n {\n var j = w - i;\n if (j > 0 && j % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n }\n\n Console.WriteLine(\"NO\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "669ba0038af319410104295b2915e9dd", "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); ((a-1) % 2 == 0)) \n {\n Console.WriteLine(\"NO\"); \n }\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": "def5cf35cf164b95d71aaa3ad7efd86b", "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.30413.136\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"cf\", \"cf\\cf.csproj\", \"{5D3406DD-5F03-4E9B-B861-254E453ED509}\"\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{5D3406DD-5F03-4E9B-B861-254E453ED509}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{5D3406DD-5F03-4E9B-B861-254E453ED509}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{5D3406DD-5F03-4E9B-B861-254E453ED509}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{5D3406DD-5F03-4E9B-B861-254E453ED509}.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 = {BFA2A156-5B5E-403B-BEBD-FA4972E0C310}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "be2a334f5aa50715b7a244f1387f3ced", "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 Console..WriteLine(final);\n }\n else\n {\n goto l;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "662f5377579352bfe8ec081e6e3c4603", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "public void DivisisbleByEven(int weight)\n {\n if (weight / 2)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "43cd5221bcaeb2cdd0eb5f0a4e835715", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "int W;\nconsole.read(w);\nif(w%2=1)\nconsole.writeline(\"No\");\nelse\nconsole.writeline(\"yes\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "680932e311ce3a3c5a8fdc85eb80249f", "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-1) % 2) != 0)\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": "8ba16b287c6a7d6dbf077501dd9f8763", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int w = int.Parse(Console.ReadLine());\n Console.WriteLine(w % 2 ? \"YES\" : \"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d52534f3d06a533c0811b3ca1b5e1e9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6fa73dc06a74604568700f22062e7fb2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " static void Main(string[] args)\n {\n StringBuilder input = new StringBuilder(Console.ReadLine()); \n for (int i = 0; i < input.Length - 2; i++ )\n {\n if (input[i] == 'W' && input[i + 1] == 'U' && input[i + 2] == 'B')\n {\n input = input.Remove(i, 3);\n input.Insert(i, ' ');\n i = -1;\n } \n } \n Console.WriteLine(input.ToString().Trim()); \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cdba2bafa84f770598cee4e4f20595d1", "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": "4af2c7991e087bbc3a4c24206dde5a7e", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n Debug\n x86\n 8.0.30703\n 2.0\n {417190B1-DD68-4797-AFEF-35BFED06A6FC}\n Exe\n Properties\n Hitrez\n Hitrez\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": "87272fe84d499662c5047bc1bed98d3c", "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 ConsoleApplication9\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 }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3f0612c8d6defa2556db6afb85ae2c03", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int num1,num2,num3;\n num1 = int.Parse(Console.ReadLine());\n num2 = int.Parse(Console.ReadLine());\n num3 = int.Parse(Console.ReadLine());\n if (num1 < num2 && num1 < num3)\n Console.Write(num1);\n else if (num2 < num1 && num2 < num3)\n Console.Write(num2);\n else\n Console.Write(num3);\n \n\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "39e28cb45b40eac1c26f075feb6b1fb7", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "namespace A.Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n ulong res = 0;\n int[] temp = new int[2];\n temp[0] = int.Parse(s[0]);\n temp[1] = int.Parse(s[1]);\n int min = Math.Min(temp[0], temp[1]);\n int max = Math.Max(temp[0], temp[1]);\n int m = min;\n int temp0 = 0;\n int temp2 = int.Parse(s[2]);\n if (int.Parse(s[2]) == 1)\n res = (ulong)max * (ulong)min;\n else\n {\n while (m > 0)\n {\n m -= int.Parse(s[2]);\n temp0++;\n }\n while (max > 0)\n {\n max -= temp2;\n res++;\n }\n res *= (ulong)temp0;\n }\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "98ce3406b7bbf24629187e78364abb8e", "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 public class TheaterSquare\n {\n\n public 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": "20a66e2150d57924060ef298d50ebe8a", "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 long n = Convert.ToDouble(input[0]);\n long m = Convert.ToDouble(input[1]);\n long a = Convert.ToDouble(input[2]);\n Console.WriteLine(Math.Ceiling(n / a) * Math.Ceiling(m / a));\n\t\t}\n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d39489ec1f2ab7223a392a8450ec98eb", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "namespace _1A_codeforces\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e2adbc5db0021b56598ac81f2454d373", "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 = int.Parse(Console.Read());\n\t\t m = int.Parse(Console.Read());\n\t\t a = int.Parse(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": "8e4a447733baff76770928af28d4acef", "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 int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int a = int.Parse(Console.ReadLine());\n\n int c = n / a;\n int y = m / a;\n\n if ( n%a != 0)\n {\n y++;\n }\n if (m%a != 0)\n {\n c++;\n }\n Console.WriteLine(x*y);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4c71f68f91f64f348ad59dc090c3f851", "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": "91903c8a495ca4cc18d06ccc8955f35b", "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 Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n \n for (int i = 1; i*p < dic; i++)\n {\n if(((i-c)*d)>=(i*p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n\n c = i + iopd + f;\n\n }\n else\n {\n \n }\n }\n Console.WriteLine(op);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8d1db3fdc59b777ae55c6a4aabbaf833", "src_uid": "c9c03666278acec35f0e273691fe0fff", "difficulty": 1500.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\tint b = Int32.Parse(Console.ReadLine());\n\t\t\tint 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": "0e3be42d33e031fedf6a0c14cc74faa3", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "MS C#", "source_code": " static void Main(string[] args)\n {\n \n int z = 0;\n int a = int.Parse(Console.ReadLine()),\n b = int.Parse(Console.ReadLine()),\n c = int.Parse(Console.ReadLine());\n while (a!=0 && b>=2 && c>=4)\n {\n a--;\n b = b - 2;\n c = c - 4;\n z += 7;\n }\n Console.WriteLine(z);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "27432b13a24ea73574ce98707ecc0691", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Task\n{\n static void Main()\n {\n \n string s=Console.ReadLine().ToLower();\n foreach (char i in s)\n {\n if(!\"aeiouy\".Contains(i))\n {\n Console.WriteLine(\".{0}\",i);\n }\n }\n \n \n \n \n }\n \n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bb59b4be7e21d0bf696815f781ecf618", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\npublic static class Program\n{\n public static void Main() {\n var str = Console.ReadLine();\n foreach (var c in str)\n if ((new [] {'A', 'O', 'Y', 'E', 'U', 'I'}).Contains(Char.ToUpper(c)))\n ;\n else\n {\n Console.Write('.');\n Console.Write(c.ToString().ToUpperCase());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "753c00e695aa901a2840ba49de0cf1b1", "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();\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 }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0c7ddefba4f2b5b44b5ef714f9997171", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CodeForves\n{\n class A118\n {\n static void Main()\n {\n string original = Console.ReadLine().ToLower();\n\t\t\tchar[] vowels = new char[5]{'a','e','i','o','u','y'};\n string translated = \"\";\n\n foreach (char alphabet in original.ToCharArray())\n {\n bool vow = false; \n\n\t\t\t\tforeach(char vowel in vowels)\n {\n if (alphabet == vowel)\n {\n vow = true;\n break;\n }\n }\n\n if (!vow)\n {\n translated += \".\" + alphabet.ToString();\n }\n }\n\n Console.WriteLine(translated);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9bba720818ebaeede04234007817ae18", "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 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": "0db5a8b2c030f1a9f0073821d1602916", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ca805A\n{\n class Program\n {\n public static List Primes()\n {\n var result = new List(1000000);\n var n = Convert.ToInt32(Math.Sqrt(m));\n result.Add(2);\n result.Add(3);;\n return result;\n }\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var l = Convert.ToInt32(input[0]);\n var r = Convert.ToInt32(input[1]);\n var res = Primes();\n var dict = new Dictionary();\n for (int j = 0; j < res.Count; j++)\n {\n for (int i = l; i <= r; i++)\n {\n if (!dict.ContainsKey(res[j]))\n dict[res[j]] = 0;\n if (i % res[j] == 0)\n dict[res[j]]++;\n }\n }\n var maxValue = dict.Values.Max();\n var answer = (from p in dict\n where p.Value == maxValue\n select p.Key).First();\n Console.WriteLine(answer);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "21618561de6ef806578c137bb45f9048", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "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 string []s = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(s[0]);\n int b = Convert.ToInt32(s[1]);\n int res = 0;\n while(a <= b)\n {\n a *= 3;\n b *= 2;\n res++;\n }\n Console.WriteLine(res);\n System(\"pause\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c715a28f8002b17a08cb2424cf147802", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "public static void Main(string[] args)\n {\n var data = Console.ReadLine().Split(' ');\n var firstW = int.Parse(data[0]);\n var secondW = int.Parse(data[1]);\n var days = 0;\n\n while (true)\n {\n days++;\n firstW *= 3;\n secondW *= 2;\n if (firstW > secondW)\n {\n Console.WriteLine(days);\n return;\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1ffb3608766ec24d577a774257f7688e", "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 Console.WriteLine(i+1);\nbreak;\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": "0fe78ec9a0673426535ada2dc1714d2f", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "int a =Convert.ToInt16(args[0]);\n int b = Convert.ToInt16(args[1]);\n int nOfYears = 0;\n while (a <= b)\n {\n a *= 3;\n b *= 2;\n nOfYears++;\n }\n Console.WriteLine(nOfYears);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7e0b0f26dedb679c128c0f5ef81c5e49", "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 a = 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": "fca2b619966abd9028a1074b7faec288", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] numbers = Console.ReadLine()\n .Split(' ', StringSplitOptions.RemoveEmptyEntries)\n .Select(item => int.Parse(item))\n .ToArray();\n int a = numbers[0];\n int b = numbers[1];\n for (int i = 0; ; i++)\n {\n if (a > b)\n {\n Console.WriteLine(i);\n break;\n }\n a = a * 3;\n b = b * 2;\n }\n \n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "174faddda55246772182f92d8d0e7d53", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "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 A.Bear_and_Big_Brother\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line;\n while ((line = Console.ReadLine()) != null) {\n string[] split = line.Split(new char[] { ' ' }, StringSplitOptions.None);\n long a = Int64.Parse(split[0]);\n long b = Int64.Parse(split[1]);\n long z = 0;\n for( z=0;;b*=2 ,a*=3,z++)\n {\n if (a > b)\n {\n break;\n }\n\n }\n Console.WriteLine(z);\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": "dec47afb263707dfd80a08c21a5dc255", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace Bear_BigBrother\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, i;\n var line = Console.ReadLine();\n var data = line.Split(' ');\n\n a = int.Parse(data[0]); \n b = int.Parse(data[1]);\n\n for(i=1; ; i++)\n {\n a *= 3;\n b *= 2;\n if (a > b)\n {\n break;\n }\n }\n\n Console.Write(i);\n Console.ReadKey();\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b817dd340bfa4038dbaf494e3da7de8", "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}\") = \"ConsoleApplication4\", \"ConsoleApplication4\\ConsoleApplication4.csproj\", \"{A25265FE-7522-4CE2-B955-E6BA28AA2964}\"\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{A25265FE-7522-4CE2-B955-E6BA28AA2964}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{A25265FE-7522-4CE2-B955-E6BA28AA2964}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{A25265FE-7522-4CE2-B955-E6BA28AA2964}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{A25265FE-7522-4CE2-B955-E6BA28AA2964}.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": "2de90b1ffeef27772a4efc45f96b0de9", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {96BFE28D-E972-4268-8886-0212E7C0095E}\n Exe\n Properties\n Gabriel_and_Worm\n Gabriel and Worm\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": "bb8f48759146c7f10a169fd1b436fe99", "src_uid": "2c39638f07c3d789ba4c323a205487d7", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "n.......\nPP......\n........\n........\n........\n........\n........\n........", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8159ef2d9d5a53e2957157c5b762ef43", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "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 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 string s = Console.ReadLine();\n if(s.Contains(\"1111111\") | s.Contains(\"0000000\")\n {Console.writeline(\"yes\");}\n else{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\n\n\n\n\n}\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0fd4711303dd118efc30ccd7adfff306", "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 for(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": "85ae70ab2e4300bbc70d348d3c523123", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"CODE\", \"CODE\\CODE.csproj\", \"{99C58CB9-8598-4A74-8689-3E4305926957}\"\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{99C58CB9-8598-4A74-8689-3E4305926957}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{99C58CB9-8598-4A74-8689-3E4305926957}.Debug|x86.Build.0 = Debug|x86\n\t\t{99C58CB9-8598-4A74-8689-3E4305926957}.Release|x86.ActiveCfg = Release|x86\n\t\t{99C58CB9-8598-4A74-8689-3E4305926957}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c1cc38a1344383aeb972b61634292f55", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono 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.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n\tstatic void Main()\n\t{\n\t\tstring s = Console.ReadLine ();\n\t\tConsole.Write (Math.Max(s.IndexOf(\"1111111\"), s.IndexOf(\"0000000\") >= 0 ? \"YES\" : \"NO\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e3db7cad99814aa86ba6955722671479", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "MS C#", "source_code": "class Program\n{\n static void Main(string[] args)\n {\n string line = System.Console.ReadLine();\n int counter = 0;\n string last = \"\";\n for (int i = 0; i < line.Length && counter < 7; i++)\n {\n counter = last.Equals(line[i].ToString()) ? counter + 1 : 0;\n last = line[i];\n }\n System.Console.WriteLine(counter == 7 ? \"YES\" : \"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "417b8a2ed41922416f19fe7346c15a93", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "MS C#", "source_code": "class Program\n{\n static void Main(string[] args)\n {\n string line = System.Console.ReadLine();\n int counter = 0;\n string last = \"\";\n for (int i = 0; i < line.Length && counter < 7; i++)\n {\n counter = last.Equals(line[i]) ? counter + 1 : 0;\n last = line[i];\n }\n System.Console.WriteLine(counter == 7 ? \"YES\" : \"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3f541254472fbad9ddfc457504f48150", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "namespace Football\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n \n string arreglo;\n int cont = 0;\n arreglo = (Console.ReadLine());\n for(int l=0; l < arreglo.Length-1; l++)\n {\n if (cont >= 6)\n {\n break;\n }\n char letra1 = arreglo[l];\n char letra2 = arreglo[l + 1];\n \n if (letra1 == letra2)\n {\n cont++; \n }\n if (letra1 != letra2)\n {\n cont = 0;\n }\n\n\n }\n if (cont >= 6)\n {\n Console.WriteLine(\"YES\");\n }\n if(cont< 6)\n {\n Console.WriteLine(\"NO\");\n }\n \n }\n \n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "931bbb51915fb87a4db1bb140c626f17", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var players = Console.ReadLine();\n var dangerous = new string[] { \"0000000\", \"1111111\" };\n if (players.Contains('1') && \n players.Contains('0') && \n players.Length <= 100 &&\n ( players.Contains(dangerous[0]) || players.Contains(dangerous[1]))\n )\n {\n Console.WriteLine(\"YES\");\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "93c4ecb56b32a6fe00c8bae5a9df3a6a", "src_uid": "ed9a763362abc6ed40356731f1036b38", "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": "bad40d556082e635a578a1f78d49b362", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace JobApplications.Practice\n{\n public class Next_Round___158A\n {\n \n static void Main(string[] args)\n {\n int n, k;\n\n string kn = Console.ReadLine();\n string[] inputs = kn.Split(\" \");\n n = Int32.Parse(inputs[0]);\n k = Int32.Parse(inputs[1]);\n\n string scores = Console.ReadLine();\n string[] scInputs = scores.Split(\" \");\n //Well...\n\n int[] sc = Array.ConvertAll(scInputs, int.Parse);\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": "005d3147e936cdfce9d0353c2b818661", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nstatic void Main(string[] args)\n {\n var k_n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var num = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var k = num[k_n[1]];\n Console.WriteLine(num.Count(x => x != 0 && x >= k));\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "db041c3d74daca11b0acfbd5322c9542", "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": "607d31fba71c518e60163e9b9cb03a4e", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine().Trim();\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 if (n >= 1 && n <= 50 && k >= 1 && k <= 50)\n {\n a = Console.ReadLine().Trim();\n for (int i = 0; i= b[k] && ((b[i] != 0 && b[k] != 0) || b[i] != 0))\n {\n otv++;\n }\n else break;\n }\n Console.WriteLine(otv.ToString());\n }\n else {\n Console.WriteLine(\"Error input!\");\n }\n Console.ReadLine();\n\n }\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "67615259bc51bce70b8596bdd6c6bbf5", "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.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 count = countList.Count;\n return count;\n\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "20e9b0447f89b473aa0fd9fb35a0894d", "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,u=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\n {\n if (paloso[z+1]>0 &&z+1!=p && paloso[z]==paloso[z+1])\n {\n u++;\n }\n if(paloso[z+1]>0 && z+1==p && paloso[z]==paloso[z-1])\n {\n u++;\n }\n }\n if(u>=p/2)\n {\n m=p;\n }\n }\n Console.WriteLine(m);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "784ca958290c108cf7489a69b7b27bf7", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace \u0417\u0430\u0434\u0430\u0447\u0430_\u0410\n{\n class Program\n {\n static void Main(string[] args)\n {\n List CL = new List();\n string a = Console.ReadLine();\n string[] b = a.Split();\n int Finale = 0;\n if (b.Count() == 2)\n {\n\n int n = Convert.ToInt32(b[0]);\n int k = Convert.ToInt32(b[1]);\n if (!(((n > k) || (n == k)) && (k >= 1) && (n <= 50)))\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n a = Console.ReadLine();\n b = a.Split();\n if (b.Count() < n) { Console.WriteLine(\"0\"); }\n else\n {\n for (int i = 0; !(i == b.Count()); i++)\n {\n CL.Add(new MyClass() { P = Convert.ToInt32(b[i]) });\n }\n for (int i = 0; !(i == CL.Count()); i++)\n {\n if (CL[i].P >= CL[k - 1].P)\n {\n Finale++;\n }\n }\n Console.WriteLine(Finale);\n }\n }\n }\n Console.ReadKey();\n }\n }\n}\npublic class MyClass\n{\n public int P;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a37c8fae662be34396ff268bf3447c8b", "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 string[] nParticipants = participants.Split(\" \");\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[int.Parse(nParticipants[1])-1].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": "35941aed1377bdb56f5d8841f4ef73e1", "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 for(int i=0;i k&&A[i]) ans++;\n Console.WriteLine(ans);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0372ca0125526eff18cdb62fa73d58e1", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass Startup\n{\n static void Main()\n {\n string input = Console.ReadLine();\n string newInput = \"\";\n bool oneIsFound = false;\n\n for (int i = 0; i < input.Length; i++)\n {\n if (oneIsFound)\n {\n newInput += input[i];\n }\n else\n {\n if (input[i] == '1')\n {\n oneIsFound = true;\n }\n }\n }\n\n int zeroesCount = newInput.Count(f => f == '0');\n Console.WriteLine(zeroesCount > 5 ? \"yes\" : \"no\");\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "54dce19125d16f9e4a7c0b91430aba31", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "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 A\n { \n static void Main(string[] args)\n { \n string s = Console.ReadLine();\n bool one = false;\n int z = 0;\n for(int i=0;i=6){\n Console.WriteLine(\"yes\");\n }else{\n Console.WriteLine(\"no\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f5b1548de175874e3c9f55aa7265360d", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "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}\") = \"CodeForces\", \"CodeForces\\CodeForces.csproj\", \"{50F6CA0F-3B5E-48D3-9012-35DFCE5D35A1}\"\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{50F6CA0F-3B5E-48D3-9012-35DFCE5D35A1}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{50F6CA0F-3B5E-48D3-9012-35DFCE5D35A1}.Debug|x86.Build.0 = Debug|x86\n\t\t{50F6CA0F-3B5E-48D3-9012-35DFCE5D35A1}.Release|x86.ActiveCfg = Release|x86\n\t\t{50F6CA0F-3B5E-48D3-9012-35DFCE5D35A1}.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": "81ed66da38e0606f0c125b72ef898d0e", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Text;\nusing System.Linq;\n\nvoid Main()\n{\n\t// Cases\n\t// d1, d3, d2\n\t// d1, d3, d3, d1\n\t// d2, d3, d3, d2\n\t// d1, d1, d2, d2\n\t\n\tint[] l = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n\tConsole.WriteLine(new[]\n\t{\n\t\tl[0] + l[2] + l[1],\n\t\tl[0] + l[2] + l[2] + l[0],\n\t\tl[1] + l[2] + l[2] + l[1],\n\t\tl[0] + l[0] + l[1] + l[1],\n\t}\n\t.Min());\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "517521a80e9cc31887af0ea69ba0cde2", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace _996a\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tlong n = Convert.ToInt32(Console.ReadLine());\n\t\t\tlong num = n / 100 + (n % 100)/20 + (n % 100 % 20)/5 + (n % 100 % 20 % 5);\n\t\t\tConsole.WriteLine(num);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6cc582978090464091792661418344ff", "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.421\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp39\", \"ConsoleApp39\\ConsoleApp39.csproj\", \"{2B6A6B94-9759-400A-8CF9-A38BF67C72B6}\"\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{2B6A6B94-9759-400A-8CF9-A38BF67C72B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{2B6A6B94-9759-400A-8CF9-A38BF67C72B6}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{2B6A6B94-9759-400A-8CF9-A38BF67C72B6}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{2B6A6B94-9759-400A-8CF9-A38BF67C72B6}.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 = {04AE9A66-327A-4ADF-9CC1-B809EB3D9E32}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8b1410fdcae12b04d4226a391cab2c93", "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.Threading.Tasks;\n\nnamespace Allen\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int quantityOFcash = 0;\n while(n - 100 >= 0)\n {\n if (n - 100 >= 0)\n {\n quantityOFcash++;\n n -= 100;\n }\n }\n while (n - 20 >= 0)\n {\n if (n - 20 >= 0)\n {\n quantityOFcash++;\n n -= 20;\n }\n }\n while (n - 10 >= 0)\n {\n if (n - 10 >= 0)\n {\n quantityOFcash++;\n n -= 10;\n }\n }\n while (n - 5 >= 0)\n {\n if (n - 5 >= 0)\n {\n quantityOFcash++;\n n -= 5;\n }\n }\n while (n - 1 >= 0)\n {\n if (n - 1 >= 0)\n {\n quantityOFcash++;\n n -= 1;\n }\n }\n Console.WriteLine(quantityOFcash);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd5c77a14b976e63300ff321df305b7a", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using ConsoleApplication3;\nusing System;\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[] money = { 100, 20, 10, 5, 1 };\n\n int n = int.Parse(Console.ReadLine());\n\n int count = 0;\n\n while (n>0)\n {\n for (int i = 0; i < money.Length; i++)\n {\n if(n>=money[i])\n {\n int times = n / money[i];\n count += times;\n n -= times * money[i];\n }\n }\n }\n Console.WriteLine(count);\n // Console.ReadKey();\n }\n\n private static long Fib(int n)\n {\n long[] fib = new long[n + 1];\n\n fib[0] = 0;\n fib[1] = 1;\n\n for (int i = 2; i < fib.Length; i++)\n {\n fib[i] = fib[i - 1] + fib[i - 2];\n }\n\n return fib[n];\n }\n private static long Fib2(int n)\n {\n long first = 0;\n long second = 1;\n\n long current = 0;\n\n for (int i = 0; i <= n - 2; i++)\n {\n current = first + second;\n first = second;\n second = current;\n }\n\n return current;\n }\n\n private static int[] mergeTwoArrays(int[] a, int[] b)\n {\n int[] result = new int[a.Length + b.Length];\n\n int left = 0;\n int right = 0;\n\n for (int i = 0; i < result.Length; i++)\n {\n if (left < a.Length && (right >= b.Length || a[left] <= b[right]))\n {\n result[i] = a[left];\n left++;\n }\n else\n {\n result[i] = b[right];\n right++;\n }\n }\n\n return result;\n }\n\n private static bool isPalindrome(string s)\n {\n for (int i = 0; i < s.Length; i++)\n if (s[i] != s[s.Length - i - 1])\n return false;\n\n return true;\n }\n\n\n private static long sumOfNumbers(long n)\n {\n long sum = 0;\n\n while (n > 0)\n {\n sum += n % 10;\n n /= 10;\n }\n\n return sum;\n }\n private static long gcd(long a, long b)\n {\n return b == 0 ? a : gcd(b, a % b);\n }\n private static long[] getPowersOfTwoAnotherMethod()\n {\n long[] array = new long[63];\n\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = (long)Math.Pow(2, i);\n }\n\n return array;\n }\n\n private static void testOut(out int n)\n {\n n = 10;\n throw new InvalidOperationException(\"Inner exception\");\n }\n\n private static string toBinary(BigInteger n)\n {\n string res = \"\";\n\n while (n > 0)\n {\n res = n % 2 + res;\n n /= 2;\n }\n\n return res;\n }\n\n private static bool checkTheNumber(int n)\n {\n string binary = toBinary(n);\n\n return binary.Any(c => c == '0');\n }\n\n private static int findPosition(string[] array, int currentPosition)\n {\n for (int i = currentPosition; i < array.Length; i++)\n {\n if (array[i] == null) return i;\n }\n\n return -1;\n }\n\n private static int findPosition(int currentPosition, string[] array) => 0;\n\n private static void Foo(StringBuilder fooSb)\n {\n fooSb.Append(\"In method\");\n fooSb = null;\n }\n\n\n\n protected static void TimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)\n {\n int i = 0;\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(i++);\n }\n\n\n static void wrintInFile(char letter, int times, int sleepTime)\n {\n for (int i = 0; i < times; i++)\n {\n lock (lockFile)\n {\n using (StreamWriter writer = new StreamWriter(\"output.txt\", true))\n {\n writer.WriteLine($\"{letter}\\t{Thread.CurrentThread.ManagedThreadId}\\t{DateTime.Now}\");\n }\n\n Thread.Sleep(sleepTime);\n }\n }\n }\n\n private static async Task Test(int n)\n {\n Console.WriteLine(\"Inside await\");\n\n int res = 0;\n\n await Task.Run(() =>\n {\n for (int i = 0; i < n; i++)\n {\n res += i * i;\n Thread.Sleep(i);\n }\n });\n\n return res;\n }\n\n public static void getDirectories(string path)\n {\n DirectoryInfo directoryInfo = new DirectoryInfo(path);\n\n Console.WriteLine(directoryInfo.FullName);\n PrintAllFileNamesInDirectory(0, directoryInfo.GetFiles());\n\n DirectoryInfo[] directories = null;\n\n try\n {\n directories = directoryInfo.GetDirectories();\n\n foreach (var d in directories)\n {\n getDirectories(d.FullName);\n }\n }\n catch (Exception e)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(\"COULD NOT HAVE ACCESS TO FOLDER\");\n }\n\n }\n\n public static void PrintAllFileNamesInDirectory(int numberOfSpaces, FileInfo[] files)\n {\n foreach (FileInfo dir in files)\n {\n Console.WriteLine($\"{new string('\\t', numberOfSpaces)} {dir.FullName}\");\n }\n\n }\n\n\n\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "69e66b1bd7c7484778d8210b628cae16", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing static System.Math;\nusing System.Linq;\n\nnamespace ConsoleApplication\n{\n sealed class Program\n {\n static void Main(string[] args)\n {\n var n = Int64.Parse(Console.ReadLine());\n mem = new int[n + 1];\n Console.WriteLine(F(n));\n }\n\n\n private static long[] mem;\n\n static long F(long n)\n {\n if (n < 0)\n return 1000000;\n if (n % 100 == 0)\n return n / 100;\n if (n == 1)\n return 1;\n if (mem[n] == 0)\n mem[n] = Min(Min(F(n - 1), F(n - 5)), Min(Min(F(n - 10), F(n - 20)), F(n - 100))) + 1;\n return mem[n];\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b73622898da2ddba28eeaf50a6b8a472", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace TestConsole\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var money = long.Parse(Console.ReadLine());\n Console.WriteLine(CalculateLottery(money));\n }\n\n private static long CalculateLottery(long money)\n {\n long billCount = 0;\n var bills = new[] { 100, 20, 10, 5, 1 };\n\n foreach (var bill in bills)\n {\n while (money > 0)\n {\n var count = money / bill;\n money -= count * bill;\n billCount += count;\n }\n }\n\n return billCount;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "247ec6c71583b3ed43d09922e8194959", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nstatic int 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c91da02dd9fc21633ed0cb51749568b8", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Test;\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": "f5e2942d2a6a3d6987410bda7f58ae2a", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nclass Task\n{\n static void Main()\n {\n int n=int.Parse(Console.ReadLine());\n for(int i=0;i char.IsUpper(ch)))\n s = s.Substring(0, 1).ToUpper() + s.Substring(1).ToLower();\n Console.WriteLine(s);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "66476102a03c9db2cd246fb01e3b20ef", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Data.SqlTypes;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DevskillProblemSolving\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n bool isAllUpper = input.All(char.IsUpper);\n\n bool convertLetter = isAllUpper;\n\n string temp = string.Empty;\n\n if (!isAllUpper)\n {\n temp = input.Substring(1, input.Length - 1);\n convertLetter = temp.All(Char.IsUpper);\n }\n\n if (convertLetter)\n {\n Console.WriteLine(Char.ToUpper(input[0]) + temp.ToLower());\n }\n else\n {\n Console.WriteLine(input);\n }\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "76c3f2e453e07e4b5a61663d455334c2", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "static void Main(string[] args)\n { \n System.String text = System.Console.ReadLine();\n text.ToLower();\n System.String[] a = new string[100];\n for (int i = 0; i < text.Length; i++)\n {\n a[i] = text[i].ToString();\n a[i]=a[i].ToLower();\n }\n a[0]=a[0].ToUpper();\n for (int i = 0; i < text.Length; i++)\n System.Console.Write(a[i]);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "82ba4d3e5cc90d3cb636cfc42c1c800a", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Test;\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 = (string)Char.ToUpper(s[0]);\n for (int i = 1; i < s.Length; i++) ss += (string)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": "b9f5ba5cc109e1fe1fe6dd890eb77dac", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"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_822A();\n\t}\n\n\tpublic static void solve_822A()\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[b]);\n\t\t\n\t\tint min = Math.Min(a, b);\n\t\t\n\t\tlong facNum1 = factorial(min);\n\t\tlong facNum2 = factorial(b + 1);\n\t\t\n\t\tlong result = gcd(facNum1, facNum2);\n\t\t\n\t\tConsole.WriteLine(result);\n\t}\n\t\n\tpublic static long factorial(int n)\n\t{\n\t\tif (n <= 1)\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t\treturn n * factorial(n - 1);\n\t}\n\t\n\tpublic static long gcd(long a, long b)\n\t{\n\t\tif (b == 0)\n\t\t{\n\t\t\treturn a;\n\t\t}\n\t\treturn gcd(b, a % b);\n\t}\t\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ec8477e6f8ceee44636db7b768590db6", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "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}\") = \"CodeforcesProject001\", \"CodeforcesProject001\\CodeforcesProject001.csproj\", \"{8C8257BA-08C0-43E0-9A62-21B5EF3A3A7B}\"\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{8C8257BA-08C0-43E0-9A62-21B5EF3A3A7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{8C8257BA-08C0-43E0-9A62-21B5EF3A3A7B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{8C8257BA-08C0-43E0-9A62-21B5EF3A3A7B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{8C8257BA-08C0-43E0-9A62-21B5EF3A3A7B}.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 = {C9CCF345-912D-44B9-B6E4-4DDCF2B20D76}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d90657d587d032fe2ea76e17a7395c2c", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "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": "8bf042cab589e749826888386b533c82", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {C2E7397A-392F-45BB-80DC-0274A7AA106C}\n Exe\n Word\n Word\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": "8baddf4c715344eb1fe5636ffd83a3fb", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing CodeForces.FrequentlySolved;\n\nnamespace CodeForces\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n //var T = Convert.ToInt32(Console.ReadLine());\n //for (int i = 1; i <= T; i++)\n //{\n // var inputStr = Console.ReadLine();\n // var result = StringManipulationTask(inputStr);\n // Console.WriteLine(result);\n //}\n var input = Console.ReadLine();\n var output = UpperCaseLowerCase(input);\n Console.WriteLine(output);\n }\n\n public static string UpperCaseLowerCase(string str)\n {\n int upperCaseCount = 0, lowerCaseCount = 0;\n var upperCaseStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n var lowerCaseStr = upperCaseStr.ToLower();\n foreach (var ch in str)\n {\n if (upperCaseStr.Contains(ch.ToString()))\n ++upperCaseCount;\n if (lowerCaseStr.Contains(ch.ToString()))\n ++lowerCaseCount;\n }\n return upperCaseCount > lowerCaseCount ? str.ToUpper() : str.ToLower();\n }\n\n\n public static string StringManipulationTask(string s)\n {\n var vowels = new List { 'a', 'e', 'i', 'o', 'u' };\n char[] input = s.ToLower().ToCharArray();\n var result = \"\";\n foreach (char c in input)\n {\n if (!vowels.Contains(c))\n {\n\n result += '.';\n result += c;\n }\n }\n return result;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "44a79839a1b9f2243e59c9d3c78ed1b3", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nstatic class Program\n{\n static void Main()\n {\n var ar = Console.Readline().Split();\n Console.WriteLine(int.Parse(ar[0]) > int.Parse(ar[1]) ? \"Second\" : \"First\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fc04ccf9ae55510f4bc3e4ffa1e9030b", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "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 sum = 0;\n int[] data = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n for(int i=1;i<=data[2];i++)\n {\n sum += i;\n }\n if (sum * data[0] - data[1] > 0) {\n Console.Write((sum * data[0] - data[1]); }\n else Console.WriteLine(0);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dfffb7be973d34f15b27ce7ccbbb7a4b", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CF_SoldierAndBanana {\n class Program {\n static void Main(string[] args) {\n string[] inputs = Console.ReadLine().Split(' ');\n ushort startprice = Int16.Parse(inputs[0]);\n ushort cash = Int16.Parse(inputs[1]);\n ushort bananacount = Int16.Parse(inputs[2]);\n int sum = 0;\n sum = startprice*bananacount * (bananacount + 1) / 2;\n if (sum > cash) {\n Console.WriteLine(sum - cash);\n return;\n }\n Console.WriteLine(0);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5af8591b56c28282f76de5869879d0b6", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace _546A\n{\n class Program\n {\n static void Main()\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var Money = input[0] * input[2] * (input[2] + 1) / 2 - input[1];\n Console.WriteLine(Money > 0 ? Money : 0);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "86c1ac34877585052ee688b739a9474a", "src_uid": "e87d9798107734a885fd8263e1431347", "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\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ec70c569ae020998a189a505cb7e0f4c", "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;\nusing System.Text.RegularExpressions;\n\n\nnamespace ConsoleApplication252\n{\n class Program\n {\n\n\n static void Main()\n {\n string[] ss = Console.ReadLine().Split();\n int a = int.Parse(ss[0]);\n int b = int.Parse(ss[1]);\n if (a >= b)\n {\n Console.WriteLine(a - );\n return;\n }\n int x = 0;\n int y = 0;\n\n List d = new List();\n d.Add(a);\n for (int i = 0; x != b || y != b; i++)\n {\n x = d[i] - 1;\n y = d[i] * 2;\n d.Add(x);\n d.Add(y);\n if (x == b || y == b)\n {\n break;\n }\n }\n int p = 1;\n int k = 1;\n int q = 0;\n for (int i = 2; true; i *= 2)\n {\n for (int e = p; e <= p + i - 1; e++)\n {\n q = e;\n if (d[e] == b)\n {\n Console.WriteLine(k);\n return;\n }\n }\n k++;\n p = q + 1;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "752b2931e4236facdb58e5f7fb858f98", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing Microsoft.VisualBasic.CompilerServices;\nusing System;\n\nnamespace Lesson13_CSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string t = Console.ReadLine();\n bool isTranslated = true;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != t[t.Length - 1 - i])\n {\n isTranslated = false;\n } \n }\n\n if (isTranslated)\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": "aac6ffceb3c6629e0d187a840e354ad7", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Text;\n\nnamespace CF\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input1 = Console.ReadLine();\n string input2 = Console.ReadLine();\n Console.WriteLine(Solver(input1 , input2));\n \n }\n\n\n public static string Solver(string input1 , string input2) {\n\n if (input1.Length == input2.Length) { }\n for (int i = 0; i < input1.Length; i++)\n {\n if (input1[i] != input2[(input1.Length - 1) - i])\n return \"NO\";\n }\n \n return \"YES\";\n }\n else return \"NO\";\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2b0ac082d455bb91a51d1389d4621f00", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "public string trans(string s, string t)\n {\n string result = \"NULL\";\n int n = (s.Length);\n char[] S = s.ToCharArray();\n char[] T = t.ToCharArray();\n\n for (int i = 0; i < n; i++)\n {\n if (S[i] != T[n - i - 1])\n {\n result = \"NO\";\n break;\n }\n else\n result = \"YES\";\n }\n\n return result;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cfee1b8cf1101e7def28311cecf3b09a", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "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}\") = \"ConsoleApplication8\", \"ConsoleApplication8\\ConsoleApplication8.csproj\", \"{3C711736-57CC-4164-8235-27B756DAE767}\"\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{3C711736-57CC-4164-8235-27B756DAE767}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{3C711736-57CC-4164-8235-27B756DAE767}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{3C711736-57CC-4164-8235-27B756DAE767}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{3C711736-57CC-4164-8235-27B756DAE767}.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": "61d8c3b243eeeba0b81ce01ce29bf0fc", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Text;\n\nnamespace CF\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input1 = Console.ReadLine();\n string input2 = Console.ReadLine();\n Console.WriteLine(Solver(input1 , input2));\n Console.ReadLine();\n }\n\n\n public static string Solver(string input1 , string input2) {\n\n if (input1.Length == input2.Length) { }\n for (int i = 0; i < input1.Length; i++)\n {\n if (input1[i] != input2[(input1.Length - 1) - i])\n return \"NO\";\n }\n \n return \"YES\";\n }\n else return \"NO\";\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0650832416a0f13b5e1448969e9906fc", "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 ;\n string m ;\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 }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4b40f9fe18d2a6c1b32142f676815cea", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NEwTechTEst\n{\n class Program\n {\n static void Main(string[] args)\n {\n var 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": "7d47c130e890587b2817d6e1c7372cc2", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "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}\") = \"Sleuth\", \"Sleuth\\Sleuth.csproj\", \"{07CE28F7-8E8A-4E2B-BC41-0E80EED8755F}\"\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{07CE28F7-8E8A-4E2B-BC41-0E80EED8755F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{07CE28F7-8E8A-4E2B-BC41-0E80EED8755F}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{07CE28F7-8E8A-4E2B-BC41-0E80EED8755F}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{07CE28F7-8E8A-4E2B-BC41-0E80EED8755F}.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": "043b4e1fbe6ce552748c88314b768410", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\npublic class CodeForces\n{\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] c = new int[n];\n for (int i = 0; i < n; ++i)\n {\n c[i] = 1;\n }\n while (n > 1)\n {\n for (int i = 1; i < n; ++i)\n {\n c[i] = c[i - 1] + c[i];\n }\n --n;\n }\n return c[n - 1];\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e9f5ddde73e14165ef0da67d61d262a9", "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": "56baa35a28611e03897414e9b90f704b", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "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\n string[] data = Console.ReadLine().Split(' ');\n \n int n = Convert.ToInt32(data[0]); // \u0437\u0430\u0439\u0446\u044b \u043e\u0442 1 \u0434\u043e 50 \n int m = Convert.ToInt32(data[1]); // \u0444\u0438\u0448\u043a\u0438 \u043e\u0442 1 \u0434\u043e 104\n int check = 1;\n\n for (int i = 0; i < n; i++)\n {\n if (check == 1)\n {\n for (int y = 1; y <= n; y++)\n {\n if (m >= y)\n {\n m = m-y;\n }\n else\n {\n check = 0;\n break;\n }\n }\n }\n else { break; }\n }\n\n Console.WriteLine(e);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "adf5475f87a3deec0d8c03e77545d233", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace CodeForces\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n int n = Convert.ToInt32 (Console.ReadLine());\n string s,new_s;\n s = Console.ReadLine();\n new_s = s.Replace(\" \", \"\");\n int Ind = 0;\n for (int i=0; i <= n)\n {\n if(new_s[i] == '1')\n {\n Console.WriteLine(\"HARD\");\n Ind = 1;\n break;\n }\n i++;\n }\n if (Ind == 0)\n {\n Console.WriteLine(\"EASY\"); \n }\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fbfffd6e9ee71d8905f97403542f232c", "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 = \"\";\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": "251997a2092b70050d3b0969905f8a3d", "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\n Console.WriteLine(input);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9b216cc83c3e469ef404d7cc684d1813", "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": "c9adee5c97113cb2a93b7d3ea9b1e9b7", "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 Backery\n{\n \n class Program\n {\n \n static string Decission(int Number, int[] NuRepeate)\n {\n for (int i = 0; i < NuRepeate.Length; i++)\n {\n if (NuRepeate[i] == 1)\n {\n return \"Hard\";\n }\n\n\n }\n\n return \"Easy\";\n }\n\n static void Main(String[] args)\n {\n \n\n\n \n inint x = int.Parse(Console.ReadLine());\n int[] _data = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n \n string Result =Decission(x, _data);\n Console.WriteLine(Result);\n \n \n }\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "596411402afa2df206c3744c751eb9c8", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2631fe11b05894acb72485106ecb2c7a", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Olymp {\n\tinternal static class Program {\n\t\tprivate static void Main() {\n\t\t\tbyte people = byte.Parse(Console.ReadLine());\n\t\t\tstring[] results = Console.ReadLine()?.Split(' ', StringSplitOptions.RemoveEmptyEntries).Where(x => x.Length == 1).Take(people).ToArray();\n\t\t\tConsole.WriteLine(results?.Any(x => x == \"1\") == true ? \"HARD\" : \"EASY\");\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cfa5c6f09ca26b78eafad722f7e6c0c2", "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.28010.2036\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp1\", \"ConsoleApp1\\ConsoleApp1.csproj\", \"{0DC4D2A4-BD36-4C11-A030-0F9BE308EE6D}\"\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{0DC4D2A4-BD36-4C11-A030-0F9BE308EE6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0DC4D2A4-BD36-4C11-A030-0F9BE308EE6D}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0DC4D2A4-BD36-4C11-A030-0F9BE308EE6D}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0DC4D2A4-BD36-4C11-A030-0F9BE308EE6D}.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 = {B564C466-FE69-42A5-9E1E-F8F31B291C14}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ec34a6542c0391e3f4b6ca9aaa071f87", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class 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 while(numberOfAnswers>0)\n {\n AddAnswer();\n numberOfAnswers--;\n }\n ans = 0;\n }\n return ans;\n }\n\n private void AddAnswer()\n {\n answer=Convert.ToInt16(Console.ReadLine());\n if(answer==1 || answer==0)\n answers.Add(answer);\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 class Program\n {\n static void Main(string[] args)\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 }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "75e03cd8804ffa24b9c4fe53d0507c2c", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n string[] temp = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(temp[0]);\n int k = Convert.ToInt32(temp[1]);\n string line = Console.ReadLine();\n int i, j, g, t,fl=0;\n g = line.IndexOf('G');\n t = line.IndexOf('T');\n if (g < t)\n {\n for (i = g+k; i <= t; i+=k)\n {\n if (line[i] == '.')\n continue;\n else if (line[i] == '#')\n {\n Console.Write(\"NO\");\n fl = -1;\n break;\n }\n else\n {\n Console.Write(\"YES\");\n fl = 1;\n break;\n }\n }\n if (fl == 0)\n Console.Write(\"NO\");\n }\n else if (g > t)\n {\n for (i = g-k; i >= t; i -= k)\n {\n if (line[i] == '.')\n continue;\n else if (line[i] == '#')\n {\n Console.Write(\"NO\");\n fl = -1;\n break;\n }\n else\n {\n Console.Write(\"YES\");\n fl = 1;\n break;\n }\n }\n if (fl == 0)\n Console.Write(\"NO\");\n }\n else\n Console.Write(\"YES\");\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7c901a7823998dcba0cca78708061e76", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "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}\") = \"A\", \"A\\A.csproj\", \"{72C18F33-1F07-490F-98D2-4940AA438842}\"\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{72C18F33-1F07-490F-98D2-4940AA438842}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{72C18F33-1F07-490F-98D2-4940AA438842}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{72C18F33-1F07-490F-98D2-4940AA438842}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{72C18F33-1F07-490F-98D2-4940AA438842}.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": "c8d2fb4ff35a9706795c09ee4a11a161", "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 Console.WriteLine(0);\n else if (ridesInSpecialTicket == 0)\n Console.WriteLine(ridesPlanned * priceForSingleRide);\n\n else\n {\n\n if (ridesPlanned % ridesInSpecialTicket == 0)\n Console.WriteLine((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides);\n else{\n int cost = (ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide;\n int x = ridesPlanned / ridesInSpecialTicket + 1;\n if(x*priceForSpecialRides < cost)\n {\n ConsoleWriteLine(x * priceForSpecialRides);\n }\n }\n } \n\n \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e988e1a309c05396023b7b355af89be8", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "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 _148\n{\n class Program\n {\n static int ToInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void Main(string[] args)\n {\n int k = ToInt();\n int l = ToInt();\n int m = ToInt();\n int n = ToInt();\n int d = ToInt();\n int ans = 0;\n for (int i = 1; i <= d; i++ )\n {\n if (i % k == 0 || i % l == 0 || i % n == 0 || i % m == 0)\n ans++;\n }\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b76c09f624cec6d85a120a2ea5769253", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "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": "d5878fc3c3158f5a25edff0f610cb194", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace Application\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\t\n \tvar hs = new HashSet();\n \t\n \tfor(var i = 0; i < input.Length; i++) hs.Add(input[i].ToString());\n \t\n \tstring answer = hs.Count % 2 == 0 ? \"CHAT WITH HER!\" : \"IGNORE HIM!\";\n \t\n \tConsole.WriteLine(answer);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f12ec567e997b0d5e0b8cb9c713f77c3", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "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}\") = \"ABoyOrGirl236\", \"ABoyOrGirl236\\ABoyOrGirl236.csproj\", \"{EC41B8EE-BFDB-4E56-8873-297C435C514A}\"\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{EC41B8EE-BFDB-4E56-8873-297C435C514A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{EC41B8EE-BFDB-4E56-8873-297C435C514A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{EC41B8EE-BFDB-4E56-8873-297C435C514A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{EC41B8EE-BFDB-4E56-8873-297C435C514A}.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": "6968ca1d95eb1eca5053db773e07d36e", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {CF41694B-EEA7-4E1D-8A4F-9027606E572E}\n Exe\n BoyOrGirl\n BoyOrGirl\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": "48e1e5f6893cb6f8ff70d067093210e8", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Linq;\n \nnamespace _236A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var k = Console.ReadLine();\n int distinctChars = k.Distinct().Count();\n if (k == \"wnemlgppy\") {\n Console.WriteLine(\"--\")\n } else {\n string output = distinctChars % 2 == 0 ? \"CHAT WITH HER!\" : \"IGNORE HIM!\";\n Console.WriteLine(output);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "db490c383bf27a9b7c246ea7bacac76b", "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(value: b))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": "b44416a053ae9a454a8b69c05ba7653a", "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}\") = \"Boy or Girl\", \"Boy or Girl\\Boy or Girl.csproj\", \"{FBDAF6CA-B014-466D-B43D-8778096986B9}\"\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{FBDAF6CA-B014-466D-B43D-8778096986B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{FBDAF6CA-B014-466D-B43D-8778096986B9}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{FBDAF6CA-B014-466D-B43D-8778096986B9}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{FBDAF6CA-B014-466D-B43D-8778096986B9}.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": "aa8b12a6939b07d25c08039f0883189b", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n string userName = Console.ReadLine();\n string distinctUserName = \"\";\n foreach (var c in userName)\n {\n if (distinctUserName.Contains(c))\n continue;\n distinctUserName += c;\n }\n\n if (distinctUserName.Length % 2 == 0)\n Console.WriteLine(\"CHAT WITH HER\");\n else\n Console.WriteLine(\"IGNORE HIM!\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4442aa28dfe26e9d99b371b4b9db674e", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing Ep1.Models;\n\nnamespace Ep1\n{\n\n 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 }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6cc74c8d9fd899027fff66356050a8ef", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "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\t\t\tvar arr = Console.ReadLine();\n\t\t\tvar chars = string.Empty;\n\t\t\tforeach (var c in arr)\n\t\t\t{\n\t\t\t\tif (!chars.Contains(c))\n\t\t\t\t\tchars+=c;\n\t\t\t}\n\t\t\tif (chars.Length % 2 == 0)\n\t\t\t\tConsole.WriteLine(\"CHAT WITH HER!\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine(\"IGNORE HIM!\");\n }\n \n }\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7b28d0b42cc8d8fbcc8eb1b5be0c03bb", "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\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 = get_string;\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\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "52cffda282e05c3fd5f3e392b6c3ecf7", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "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 int[] a = Array.ConvertAll(Console.ReadLine().Split(\" \"), int.Parse); \n int b=(int)a[1];\n int cantE=0;\n int timeE=5;\n \n for(int i=0;i<(int)a[0];i++){\n if(timeE+b<=240){\n cantE++;\n b=b+timeE;\n timeE=timeE+5;\n }\n } \n Console.WriteLine(cantE);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c8014119897e34049b25f2e4c1ce2977", "src_uid": "41e554bc323857be7b8483ee358a35e2", "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 var arr = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Convert.ToInt32(s)).ToArray();\n\n var time = 240 - arr[1];\n var cnt = 0;\n\n var i = 1;\n var s = i * 5;\n while (time >= s)\n {\n time -= s;\n i++;\n s = i * 5;\n cnt++;\n if (cnt == arr[0])\n break;\n }\n\n\n Console.WriteLine(cnt);\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": "1e42af42fcdbf7e2d58585468f5c2c8e", "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}\") = \"ConsoleApp9\", \"ConsoleApp9\\ConsoleApp9.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": "11343588943be4866aa25d521d2598be", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "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);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "972a0ce5973dc4524ba6261e230ad2a6", "src_uid": "41e554bc323857be7b8483ee358a35e2", "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 int[] a = Array.ConvertAll(Console.ReadLine().Split(\" \"), int.Parse); \n int b=a[1];\n int cantE=0;\n int timeE=5;\n \n for(int i=0;i= 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));", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c5bc2943daa3cd77f4d5a0e7129d5097", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "MS C#", "source_code": "static void Main()\n\t{\n\t\tint k, n,c;\n\t\tconst int koef = 5;\n\t\tint[] array = new int[100];\n\t\tstring[] vvod;\n\t\tvvod = Console.ReadLine().Split(' ');\n\t\tn= Int32.Parse(vvod[0]);\n\t\tk = Int32.Parse(vvod[1]);\n\t\tint prev = 0;\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\t \n\t\t\tarray[i] = prev+(koef * (i + 1));\n\t\t\tprev = array[i];\n\t\t\t \n\t\t}\n\t\tc = n - 1;\n\t\twhile (true)\n\t\t{\n\t\t\tif (c != -1)\n\t\t\t{\n\t\t\t\tif (k + array[c] <= 240)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(c + 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t--c;\n\t\t\t}\n\t\t\telse\n\t\t\t\tConsole.WriteLine(0);break;\n\t\t}\n\t\t \n\t}\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ea4912611e33f6ae5e3a08d053fecad1", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.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 int 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": "867d2fd2881f22c2b1158cf1930f4fbb", "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 int 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": "70868cf9d8398fe00e2b8b3a0933a979", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.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": "4b0ec7d10b95a5a257d1661cc7a1d8d3", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.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}\") = \"ConsoleApplication1\", \"ConsoleApplication1\\ConsoleApplication1.csproj\", \"{6CCB8DAE-12A9-42A4-B1C4-C4C23B1BDBA9}\"\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{6CCB8DAE-12A9-42A4-B1C4-C4C23B1BDBA9}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{6CCB8DAE-12A9-42A4-B1C4-C4C23B1BDBA9}.Debug|x86.Build.0 = Debug|x86\n\t\t{6CCB8DAE-12A9-42A4-B1C4-C4C23B1BDBA9}.Release|x86.ActiveCfg = Release|x86\n\t\t{6CCB8DAE-12A9-42A4-B1C4-C4C23B1BDBA9}.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": "2da16753bc470ffaf5117ccde12a1830", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing LinkedList;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace VaniaAndLight\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x, y, z, a, b, c;\n string[] arrayXYZ = Console.ReadLine().Split(new char[] { ' '}, StringSplitOptions.RemoveEmptyEntries);\n string[] arrayABC = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n x = int.Parse(arrayXYZ[0]);\n y = int.Parse(arrayXYZ[1]);\n z = int.Parse(arrayXYZ[2]);\n a = int.Parse(arrayABC[0]);\n b = int.Parse(arrayABC[1]);\n c = int.Parse(arrayABC[2]);\n\n if (x > a)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n a -= x;\n }\n\n if (y > (a + b))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n if (y - a > 0)\n {\n y -= a;\n a = 0;\n b -= y;\n }\n else\n {\n a -= y;\n }\n }\n\n if (z > (a + b + c))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n\n static int rank(int key, int[] a)\n {\n int lo = 0;\n int hi = a.Length;\n\n while (lo <= hi)\n {\n int mid = lo + (hi - lo) / 2;\n if (key < a[mid])\n {\n hi = mid - 1;\n }\n else if (key > a[mid])\n {\n lo = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n return -1;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7227445d6590e1dd81e95849c93a995a", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0} {"lang": "Mono 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 \n\nusing namespace std;\n\n#define forn(i,n) for (int i = 0;i < int(n);i++)\n#define ford(i,n) for (int i = n-1;i >=0;i--)\n#define fore(i,l,r) for (int i = int(l);i < int(r);i++)\n#define forv(a) for(int i = 0;i < (a).size();i++) cin >> a[i]\n#define correct(x,n) (((x) >= 0) && ((x) < n))\n#define sort_all(a) sort((a).begin(),(a).end())\n#define mp(a,b) make_pair((a),(b))\n#define all(a) (a).begin(),(a).end()\n#define pb(a) push_back(a)\n#define rnd() (rand() + (RAND_MAX+1)*rand())\n#define fi first\n#define se second\n#define V(A) vector\n//#define DEBUG_\n\n//#define x first\n//#define y second\n\ntypedef long long li;\ntypedef vector vi;\ntypedef vector

  • vli;\ntypedef pair pi;\ntypedef vector vpi;\ntypedef vector vvi;\ntypedef vector vvli;\ntypedef long double ld;\ntypedef pair Point;\n\nconst ld Eps = 1e-9;\n\nvector> fact(li b)\n{\n\tvector> res;\n\tfor (li i = 2; i*i <= b; i++)\n\t{\n\t\tif (b % i != 0)\n\t\t\tcontinue;\n\t\tres.push_back(mp(i, 0));\n\t\twhile (b % i == 0)\n\t\t{\n\t\t\tb /= i;\n\t\t\tres.back().second++;\n\t\t}\n\t}\n\n\tif (b != 1)\n\t\tres.push_back(mp(b, 1));\n\n\treturn res;\n}\n\nint main()\n{\n\t//freopen(\"in.txt\", \"r\", stdin);\n\tios_base::sync_with_stdio(false);\n\tcin.tie(nullptr);\n\tcout.tie(nullptr);\n\tli n, b;\n\tcin >> n >> b;\n\tvector> a = fact(b);\n\n\tli mn = 2000000000000000000;\n\n\tfor (auto pr : a)\n\t{\n\t\tli p = pr.first;\n\t\tli k = pr.second;\n\t\tli pw = 0;\n\t\tfor (li n1 = n / p; n1 > 0; n1 /= p)\n\t\t\tpw += n1;\n\t\tmn = min(mn, pw / k);\n\t}\n\n\tcout << mn << endl;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6160be05c359355dafcbcb7b04b5fae3", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass Program {\n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var k = s[1]; var l = s[2]; var c = s[3]; var d = s[4];\n var p = s[5]; var nl = s[6]; var np = s[7];\n Console.WriteLine(new [] {}.Min(k*l/nl, c*d, p/np) / n);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d8188d8977085ac7999d966afc3a093", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "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 \n if (result.Count >= 26)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f595b33d2a34d95fff7f4d267905f69d", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3ffba21e673c61f2161bd398eeb5504a", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApp6\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint x = Convert.ToInt32(Console.ReadLine());\n\t\t\tstring str =Console.ReadLine();\n\t\t\tstring newone = str.ToLower();\n\t\t\tstring newone1 = \"\";\n\t\t\tfor (int i = 0; i < newone.Length; i++)\n\t\t\t{\n\t\t\t\tif(!newone1.Contains(newone[i]))\n\t\t\t\t{\n\t\t\t\t\tnewone1 += newone[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(newone1.Length == 24)\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine(\"NO\");\n\n\t\t\t\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4fd400996981cdf109236daca6116ec7", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "MS C#", "source_code": " public static string GetBestSolution(int n, string str)\n {\n if (n < 26)\n {\n return \"NO\";\n }\n char[] letters = new char[n];\n\n letters = str.ToLower().ToCharArray();\n List charCount = new List();\n for (int i = 0; i < n; i++)\n {\n if (!charCount.Contains(letters[i]))\n {\n charCount.Add(letters[i]);\n }\n\n }\n\n\n return charCount.Count == 26 ? \"YES\" : \"NO\";\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bef74da0b557e6d90504a44b4c0ec452", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\n class Program\n {\n static void Main(string[] args) \n {\n int num = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n string res = \"\";\n str = str.ToLower();\n HashSet hash = new HashSet();\n for (int i = 0; i < num; i++)\n {\n hash.Add(Convert.ToString(str[i]));\n }\n\n\n \n string result = hash.Count == 26 ? \"YES\" : \"NO\";\n Console.WriteLine(result);\n Console.ReadKey();\n \n\n }\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "69b64d8aff1938e47f9db72bcae492dd", "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\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": "030b5083555ee3c11e45f6278dcf4852", "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',\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\"); }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0e7d16a94b7cd259854d84f9314f2bef", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split();\n int[] k = new int[6];\n for (int i = 0; i < 6; i++)\n {\n k[i] = int.Parse(str[i]);\n }\n Array.Sort(k);\n if ((k[2] == k[3] & k[0] == k[1]) || (k[2] == k[3] & k[4] == k[5])||(k[1] == k[2] == k[3] == k[4]))\n {\n if (k[0] == k[1] & k[4] == k[5]) {\n Console.WriteLine(\"Elephant\");return; \n }\n else {\n Console.WriteLine(\"Bear\"); return;\n }\n }else Console.WriteLine(\"Alien\");\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "49b51e83513fce927863b9086d6d85c0", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\n\ufeffusing System.Linq;\n\ufeffusing System.Text;\n\nnamespace Codeforces296Task1\n{\n static class Program\n {\n static TextReader _reader;\n static TextWriter _writer;\n static void Main(string[] args)\n {\n#if DEBUG\n _reader = new StreamReader(@\"input.txt\");\n _writer = new StreamWriter(@\"output.txt\");\n // Writer = new StreamWriter(@\"C:\\temp\\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\n var n = ReadInt();\n\n var ar = ReadIntArray();\n\n var myVote = ar[0];\n\n var arr = ar.SubArray(1, ar.Length - 1);\n\n var res = 0;\n\n Array.Sort(arr);\n\n if (myVote <= arr[arr.Length - 1])\n for (int i = arr.Length - 1; i >= 0; i--)\n {\n if (myVote > arr[i])\n {\n arr = arr.SubArray(i + 1, arr.Length - i - 1);\n\n break;\n }\n }\n\n while (myVote <= arr[arr.Length - 1])\n {\n myVote++;\n arr[arr.Length - 1]--;\n res++;\n\n Array.Sort(arr);\n }\n\n\n _writer.WriteLine(res);\n\n _writer.Close();\n _reader.Close();\n }\n\n #region Pokachto neBolwaya Portyanka\n\n public static string EnumerableToString(IEnumerable enumerable)\n {\n var sb = new StringBuilder();\n\n int i = 1;\n\n foreach (var v in enumerable)\n {\n sb.Append(v.ToString());\n sb.Append(\" \");\n }\n\n return sb.ToString();\n }\n\n public static int ReadInt()\n {\n return int.Parse(_reader.ReadLine());\n }\n\n public static Int64 ReadInt64()\n {\n return Int64.Parse(_reader.ReadLine());\n }\n\n static public int[] ReadIntArray()\n {\n return _reader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static public char[] ReadCharArray()\n {\n return _reader.ReadLine().ToCharArray();\n }\n\n static public string ReadString()\n {\n return _reader.ReadLine();\n }\n\n static public Int64[] ReadInt64Array()\n {\n return _reader.ReadLine().Split(' ').Select(Int64.Parse).ToArray();\n }\n\n static T[] SubArray(this T[] data, int index, int length)\n {\n T[] result = new T[length];\n Array.Copy(data, index, result, 0, length);\n return result;\n }\n #endregion\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "de850e156afb79bcbb4ec19fc95b296b", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "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 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": "2e0e3eb2e201544b7dce02cdccbfc4a8", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace AlgorithmsTest\n{\n class Program\n {\n static void Main(string[] args)\n {\n var count = Console.ReadLine();\n var inputString = Console.ReadLine().Split(' ').ToList();\n var input = new List();\n\n foreach (var ch in inputString)\n {\n input.Add(Convert.ToInt32(ch));\n }\n\n int votes = 0;\n\n while (true)\n {\n int largestEnemy = input[0];\n int largestEnemyIndex = 0;\n for (int i = 1; i < input.Count; i++)\n {\n if (input[i] >= largestEnemy)\n {\n largestEnemy = input[i];\n largestEnemyIndex = i;\n }\n }\n\n if (largestEnemyIndex == 0)\n break;\n\n input[largestEnemyIndex]--;\n input[0]++;\n votes++;\n }\n \n\n Console.WriteLine(votes);\n}\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "955d73654236a83ef23a1533b8be5b77", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace App\n{\n class Program\n {\n static void Main()\n {\n var res = string.Join('+', Console.ReadLine().Replace(\"+\", \"\").OrderBy(x => x));\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "455e3d8150bfaa55bead29bbaa27a13d", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace _339A.HelpfulMaths\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] numbers = Console.ReadLine().Split('+');\n Array.Sort(numbers);\n\n System.Console.WriteLine(string.Join('+',numbers));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4e1f89ba1e8ed102321908aa6f3b87b1", "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": "cca1ad3d210601a73fd9fcc253242100", "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 Convert.ToInt32(temp));\n Array.Sort(arr);\n string s1 = String.Join('+' , arr);\n Console.WriteLine(s1);\n\n }\n\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fbc0971c053cc5a483af3f23873ce19b", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n \nclass hmath {\n\tpublic static void Main() { \n\tstring[] arr=Console.ReadLine().Split('+');\n\tArray.Sort(arr);\n\tConsole.WriteLine(string.Join('+',arr));\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "395df0c09fe3ea337a998d5d6a4116ac", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "MS C#", "source_code": "#include \n#include\n\nint main()\n{\n char inp[100];\n gets(inp);\n int i, length = strlen(inp), j;\n char temp = ' ';\n for(i = 0; i < length; i++ )\n {\n for(j = 0; j < length - 2; j++)\n {\n if(inp[j] > inp[j+2])\n {\n temp = inp[j];\n inp[j] = inp[j + 2];\n inp[j + 2] = temp;\n }\n }\n }\n for(i = 0; i < length; i++)\n {\n printf(\"%c\", inp[i]);\n }\n\n return 0;\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7c18702cd782e0b8f4fbb53fa0a5955b", "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 = \"\";\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": "a3a55115418ff72d28b27bc6ee9b77c6", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "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\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\t\t\t\n\t\t\tConsole.WriteLine(textBox2);\n\t\t\t\n }\n }\n} \n \n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e1a632c2256d366341299ed380f6788b", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.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 {\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}System.Threading.Thread.Sleep(500);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f5829f135a2db415758977a244a313e3", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "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}\") = \"Problema A EXPRESS\u00c3O\", \"Problema A EXPRESS\u00c3O\\Problema A EXPRESS\u00c3O.csproj\", \"{4C4E4E0B-8312-4B72-84D4-72B9621E8FB2}\"\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{4C4E4E0B-8312-4B72-84D4-72B9621E8FB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{4C4E4E0B-8312-4B72-84D4-72B9621E8FB2}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{4C4E4E0B-8312-4B72-84D4-72B9621E8FB2}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{4C4E4E0B-8312-4B72-84D4-72B9621E8FB2}.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": "87609ccf9ddf41ece2676e6f8907a672", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main()\n {\n int x = Convert.ToInt32(Console.ReadLine());\n int n = Convert.ToInt32(Console.ReadLine());\n int y = Convert.ToInt32(Console.ReadLine());\n int r, r1, r2, r3;\n List list = new List();\n\n r = (x + n) * y;\n r1 = x * n * y;\n r2 = x * (n + y);\n r3 = x + n * y;\n\n list.Add(r);\n list.Add(r1);\n list.Add(r2);\n list.Add(r3);\n\n int maxValue = list.Max();\n\n if (x == 1 & n == 1 & y == 1)\n {\n Console.WriteLine(3);\n }\n else\n {\n if (x == 1 & y == 1)\n {\n Console.WriteLine(maxValue + 1);\n }\n else\n {\n Console.WriteLine(maxValue);\n }\n }\n }\n \n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8fa883b2f540c48e0ff60bbfed840e28", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.ComponentModel.DataAnnotations;\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace Expression\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n\n int option1 = Math.Max((a + b) * c, a * (b + c));\n int option2 = Math.Max(a * b * c, a + b + c);\n\n Console.WriteLine(Math.Max(option1, option2));\n\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b190d45798b6221d3cdf49291c2dd4e7", "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\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($\"{n}\");\n if((m % 2*n != 0 ) && ( m % 3*n != 0) && ( m % 6*n != 0)) Console.WriteLine(\"-1\");\n \n int 2counter = 0;\n int 3counter = 0;\n while(nTemp % 2 == 0) { nTemp /= 2; 2counter++; }\n while(nTemp % 3 == 0) { nTemp /= 3; 3counter++; }\n \n int counter = 0;\n while(m % 2 == 0 ) { m /= 2; counter++; }\n while(m % 3 == 0) { m /= 3; counter++; }\n counter -= 2counter;\n counter -= 3counter;\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": "7bee82a433d90dce9e8463b30a7f61fa", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace A\n{\n class Program\n {\n static List ReadListOfInts()\n {\n var input = Console.ReadLine()\n .Split(\" \")\n .Where(str => !string.IsNullOrEmpty(str))\n .Select(str => Convert.ToInt64(str))\n .ToList();\n return input;\n }\n static void Main(string[] args)\n {\n var inp = ReadListOfInts();\n long n = inp[0];\n long m = inp[1];\n if (m < n)\n {\n Console.WriteLine(\"-1\");\n }\n else if (m == n)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n int twos = 0;\n int threes = 0;\n\n while (n % 2 == 0)\n {\n n /= 2;\n twos--;\n }\n while (n % 3 == 0)\n {\n n /= 3;\n threes--;\n }\n while (m % 2 == 0)\n {\n m /= 2;\n twos++;\n }\n while (m % 3 == 0)\n {\n m /= 3;\n threes++;\n }\n if (twos < 0 || threes < 0)\n {\n Console.WriteLine(\"-1\");\n }\n else if (n != m)\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n int answer = twos + threes;\n Console.WriteLine(answer);\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1538e5069b79f8b6150683b2b56416c3", "src_uid": "3f9980ad292185f63a80bce10705e806", "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 public static class Class1\n {\n\n public static int Method1(int number, int result)\n {\n int res = 1;\n if (result / number % 1 == 0)\n result /= number;\n else if (result == number)\n return 0;\n else return -1;\n while (result>2)\n {\n res++;\n result = result % 3 == 0 ? result / 3 : result / 2;\n }\n return res;\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cac3a973184e11a01df93a42363dbe3c", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n\n int start = 0;\n int last = 0;\n string lastStr = s.Substring(start, 2);\n \n while (start != n - 1)\n {\n string d = s.Substring(start, 2);\n \n int current = 0;\n for (int i = start+1; i < n - 1; i++)\n {\n if ((s[i].ToString() + s[i + 1].ToString()) == d)\n {\n current++;\n }\n }\n\n if (current > last)\n {\n last = current;\n lastStr = d;\n }\n start++;\n }\n\n\n Console.WriteLine(lastStr);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "97720f654dcd3b0aa9f4c0f315e474b3", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " var n = Convert.ToInt32(Console.ReadLine());\n var s = Console.ReadLine();\n\n var start = 0;\n int last = 0;\n var lastStr = s.Substring(start, 2);\n \n while (start != n - 1)\n {\n var d = s.Substring(start, 2);\n \n int current = 0;\n for (int i = start+1; i < n - 1; i++)\n {\n if ((s[i].ToString() + s[i + 1].ToString()) == d)\n {\n current++;\n }\n }\n\n if (current > last)\n {\n last = current;\n lastStr = d;\n }\n start++;\n }\n\n\n Console.WriteLine(lastStr);\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5d3b3cd9e7f99a3b6fc26247c3e7e3aa", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\nint c;\nConsole.WriteLine((c = Console.ReadLine().Count(d => d == '4' || d == '7')) == 4 || c == 7 ? \"YES\" : \"NO\");\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fda56e34454317144d7446a09bd2f7d6", "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 int 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": "ba4f026117eb10747f6f692482101c5b", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "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 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 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": "93ec7b3a66064365981488db8fcb5095", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ps\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] teams = new string[n];\n int count = 0;\n\n for (int i = 0; i < n; i++) {\n teams[i] = Console.ReadLine();\n }\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++)\n {\n if (j != i)\n {\n if (teams[i].Split(\" \")[0] == teams[j].Split(\" \")[1])\n {\n count++;\n }\n }\n }\n }\n\n\n Console.WriteLine(count);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "10f5d96e88aa780b36a788329ea4cb98", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0} {"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": "e277dff5ffbccc8b4b43ebacb69e37f9", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300.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(n => n == 1)+ before.Count(n => n == 1)+ after.Count(n => n == 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": "ba4fa7f0d26abc16cbdc0664ee1ce10f", "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 = Console.ReadLine(); //Convert.ToInt32(Console.ReadLine());\n int[] a = new int[n];\n int s,er;\n int t = 0;\n int jami = 0;\n for (int i = 0; i < n; i++)\n {\n\t\t\t\tConsole.ReadLine();\n //a[i] = Convert.ToInt32(Console.ReadLine());\n jami += a[i];\n \n };\n\t\t\ta[0]=1;\n\t\t\ta[1]=0;\n\t\t\ta[2]=0;\n\t\t\ta[3]=1;\n\t\t\ta[4]=0;\n\t\t\t\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f14986193a54dc54cf3252b45d4afb3b", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\n\nclass MyBuild\n{\n static void Main()\n {\n string input = Console.ReadLine();\n string[] dim = input.Split(", "lang_cluster": "C#", "compilation_error": true, "code_uid": "019d8efc779a711fb635cc57f5f25694", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace program{\n class program{\n static void main{\n int[] NxM = int.Parse(Console.Readline().split(' '));\n \n Console.Writeline(\"{0}\", (NxM[0] * NxM[1]) / 2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ece66975c84eb0f932de0823f34df369", "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 string a = Console.ReadLine();\n \n int n = Int32.Parse(0,a.IndexOf(\" \"));\n int m = Int32.Parse(a.IndexOf(\" \")+1);\n \n Console.WriteLine(n*m/2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "00742984c2d46b520d93a6fc3c70f651", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\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": "7ebad69ab2990580d71a692b9c20f541", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {815E1B5E-ACD8-4D14-B9A5-0958A360213A}\n Exe\n Codeforces_Beta_Round_47_A__Domino_piling_\n Codeforces Beta Round 47 A %28Domino piling%29\n v4.6\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": "1918bdd311ed63e291745628348a24c7", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace program{\n class program{\n static void main{\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": "140f713efdc536b829a4779e97dda3fb", "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 \n var a = Console.ReadLine();\n string[] b = a.Split(' ');\n int x,y ;\n int.TryParse(b[0] , out x) ;\n int.TryParse(b[1] , out y) ;\n int c = x * y / 2;\n Console.WriteLine(c);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f0c7dfb930733c436196d306dae98bb6", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Class50A\n {\n static void Main(string[] args)\n {\n string[] d = Console.ReadLine().Split(' ');\n int m = int.Parse(d[0]);\n int n = int.Parse(d[1]);\n Console.WriteLine(m*n/2);\n Console.ReadLine();\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5b1a38c280629062b7924a984c2a8f3d", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nclass Program\n\n{\n\nstatic void Main(string[] args)\n\n{\n\nint[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\nint M = input[0];\n\nint N = input[1];\n\nint result = (M / 2) * N + (M%2==0)?0 : (N / 2);\n\nConsole.WriteLine(result);\n\n}\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2dd5216ad375602f791fbb52bcb0ffca", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\n\n\nusing 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\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.ToString(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\telse\t{\n \t\t c_year++;\n \t\t }\n\t}\n\t\n\t}\n\t}\n\t}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ac8d4c849314f118ad23477ed943a52f", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "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 ConsoleApp1\n{\n class Program\n {\n static void Main()\n {\n int y = Convert.ToInt32(Console.ReadLine());\n int a, b, c, d;\n while (true)\n {\n y = y + 1;\n a = y / 1000;\n b = y / 100 % 10;\n c = y / 10 % 10;\n d = y % 10;\n if (a != b && a != c && a != d && b != c && b != d && c != d)\n {\n break;\n }\n }\n Console.WriteLine(y);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0bc3ef3fd19e0c949790c6679f01faa0", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Diagnostics.Tracing;\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c = Convert.ToInt32(Console.ReadLine());\n for (int i = ++c; i < 9001; i++)\n {\n string b = i.ToString();\n if (ass(b))\n {\n Console.WriteLine(i);\n break;\n }\n }\n \n }\n public static bool ass(string aa)\n {\n int counter = 0;\n for (int i = 0; i <=9; i++)\n {\n if (aa.Contains((char) (i+48))) counter++;\n }\n if (counter == 4) return true;\n return false;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f76e3c19122e9c254096ee97c9d58b67", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.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": "c36dfbe2a83423b85d2fbaf986435723", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApp12\n{\n class Program\n {\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": "10478761cc6380458b9bac44cf4b2b2e", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0} {"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#endif\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": "3d2db6cace493a1d0a8ad329c08c9da8", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nclass A651 {\n public static void Main() {\n var line = Console.ReadLine().Split();\n var a1 = int.Parse(line[0]);\n var a2 = int.Parse(line[1]);\n var ans = (a1 - a2) % 3 == 0 ? a1 + a2 - 3 : a1 + a2 - 2\n Console.WriteLine(Math.Max(0, ans));\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cb28d478518da3223be960bbe6c20205", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);\n //Console.WriteLine(a[0]+\" \"+a[1]);\n \n int count = 0;\n while(a[0]>0 && a[1] > 0)\n {\n count++;\n if(a[0]>a[1])\n {\n a[0] -= 2;\n a[1] += 1;\n }\n else\n {\n a[0] += 1;\n a[1] -= 2;\n }\n //Console.WriteLine(a[0]+\" \"+a[1]);\n }\n Console.WriteLine(count);\n //Console.ReadKey();\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "344091e22ec4f509c2a30fb7655d90a7", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "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 problem651A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int joy1 = Convert.ToInt32(str[0]);\n int joy2 = Convert.ToInt32(str[1]);\n int min = 0;\n bool flag = true;\n\n if(joy1 < joy2)\n {\n int temp = joy1;\n joy1 = joy2;\n joy2 = temp;\n }\n\n while(joy1 > 0 && joy2 > 0)\n {\n if(joy 1 == 1 && joy2 == 1)\n break;\n if (flag)\n {\n joy1 -= 2;\n joy2 += 1;\n min++;\n if (joy1 == 1 || joy1 == 2)\n flag = false;\n }\n else\n {\n joy1 += 1;\n joy2 -= 2;\n min++;\n if (joy2 == 1 || joy2 == 2)\n flag = true;\n }\n \n }\n Console.WriteLine(min);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a867e9ad36b8953c8d6c3a040f7a6253", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeff/*\n * TemplateCS\n * Copyright (C) 2014-2016 Markus Himmel\n * This file is distributed under the terms of the MIT license\n */\n\n//#define CodeJam\n#define CodeForces\n\nusing System;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace ProgrammingCompetitions\n{\n\tclass Program\n\t{\n\n\t\t#region GCJ\n#if CodeJam\n\t\tprivate static bool DEBUG = false;\n\n\t\tstatic void debug()\n\t\t{\n\t\t}\n\n\t\tstatic string solveCase(int num)\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n#endif\n\t\t#endregion\n\n\t\t#region CodeForces\n#if CodeForces\n#if DEBUG\n\t\tstatic Queue testInput = new Queue(string.Format(@\"\n\n4 4 \n\n\n\").Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries));\n#endif\n\n\t\tstatic object Solve()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\tint a, b;\n\t\t\t\tread(out a, out b);\n\t\t\t\tint mins = 0;\n\t\t\t\twhile (a > 0 && b > 0)\n\t\t\t\t{\n\t\t\t\t\tmins++;\n\t\t\t\t\tif (a > b)\n\t\t\t\t\t{\n\t\t\t\t\t\tb++;\n\t\t\t\t\t\ta -= 2;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\ta++;\n\t\t\t\t\t\tb -= 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn mins;\n\t\t\t}\n\t\t}\n#endif\n\t\t#endregion\n\n\t\t// Everything after this comment is template code\n\n\t\tprivate static T read()\n\t\t{\n\t\t\treturn (T)Convert.ChangeType(read(), typeof(T));\n\t\t}\n\n\t\tprivate static T[] readMany()\n\t\t{\n\t\t\treturn readMany(' ');\n\t\t}\n\n\t\tprivate static _[] readMany<_>(params char[] ___)\n\t\t{\n\t\t\treturn read().Split(___).Select(__ => (_)Convert.ChangeType(__, typeof(_))).ToArray();\n\t\t}\n\n\t\tprivate static string[] readMany()\n\t\t{\n\t\t\treturn readMany();\n\t\t}\n\n\t\tprivate static T[][] readMany(int n)\n\t\t{\n\t\t\tT[][] res = new T[n][];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tres[i] = readMany();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static T[][] readField(int height, Func map)\n\t\t{\n\t\t\tT[][] res = new T[height][];\n\t\t\tfor (int _ = 0; _ < height; _++)\n\t\t\t{\n\t\t\t\tres[_] = read().Select(c => map(c)).ToArray();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static char[][] readField(int height)\n\t\t{\n\t\t\treturn readField(height, c => c);\n\t\t}\n\n\t\tprivate static T[][] readField(int height, Dictionary dic)\n\t\t{\n\t\t\treturn readField(height, c => dic[c]);\n\t\t}\n\n\t\tprivate static void read(out T1 t1)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3, out T4 t4)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t\tt4 = (T4)Convert.ChangeType(vals[3], typeof(T4));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3, out T4 t4, out T5 t5)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t\tt4 = (T4)Convert.ChangeType(vals[3], typeof(T4));\n\t\t\tt5 = (T5)Convert.ChangeType(vals[4], typeof(T5));\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2, t3) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2, t3);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, t3, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2, t3, t4) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2, t3, t4);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, t3, t4, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic IEnumerable single(T it)\n\t\t{\n\t\t\tyield return it;\n\t\t}\n\n\t\tstatic IEnumerable range(long first, long last, long step = 1)\n\t\t{\n\t\t\tfor (long i = first; i <= last; i += step)\n\t\t\t{\n\t\t\t\tyield return i;\n\t\t\t}\n\t\t}\n\n\t\tstatic IEnumerable range(int first, int last, int step = 1)\n\t\t{\n\t\t\tfor (int i = first; i <= last; i += step)\n\t\t\t{\n\t\t\t\tyield return i;\n\t\t\t}\n\t\t}\n\n\t\tstatic T id(T a)\n\t\t{\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic static T[][] mkarr(int x, int y)\n\t\t{\n\t\t\tT[][] res = new T[x][];\n\t\t\tfor (int i = 0; i < x; i++)\n\t\t\t{\n\t\t\t\tres[i] = new T[y];\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static T[][][] mkarr(int x, int y, int z)\n\t\t{\n\t\t\tT[][][] res = new T[x][][];\n\t\t\tfor (int i = 0; i < x; i++)\n\t\t\t{\n\t\t\t\tres[i] = new T[y][];\n\t\t\t\tfor (int j = 0; j < y; j++)\n\t\t\t\t{\n\t\t\t\t\tres[i][j] = new T[z];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic bool[] tf = new[] { true, false };\n\n\n#if CodeJam\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tif (DEBUG)\n\t\t\t{\n\t\t\t\tdebug();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tInitialize();\n\t\t\t\tSolveAll(solveCase);\n\t\t\t}\n\t\t\tConsole.ReadKey();\n\t\t}\n\n\t\tprivate static StreamReader inf;\n\t\tprivate static StreamWriter outf;\n\n\t\tprivate delegate void o(string format, params object[] args);\n\t\tprivate static o Output;\n\n\t\tpublic static void Initialize()\n\t\t{\n\t\t\tConsole.ForegroundColor = ConsoleColor.Yellow;\n\t\t\tConsole.Write(\"File name: \");\n\t\t\tstring name = Console.ReadLine();\n\t\t\tinf = new StreamReader($\"D:\\\\Users\\\\marku\\\\Downloads\\\\{name}.in\");\n\t\t\toutf = new StreamWriter($\"D:\\\\Users\\\\marku\\\\Downloads\\\\{name}.out\");\n\t\t\tConsole.ForegroundColor = ConsoleColor.White;\n\t\t\tOutput = highlightedPrint;\n\t\t\tOutput += outf.WriteLine;\n\t\t}\n\n\t\tprivate static void highlightedPrint(string format, params object[] args)\n\t\t{\n\t\t\tConsoleColor prev = Console.ForegroundColor;\n\t\t\tConsole.ForegroundColor = ConsoleColor.Green;\n\t\t\tConsole.WriteLine(format, args);\n\t\t\tConsole.ForegroundColor = prev;\n\t\t}\n\n\t\tpublic static void SolveAll(Func calc)\n\t\t{\n\t\t\tint cases = int.Parse(inf.ReadLine());\n\t\t\tfor (int _ = 1; _ <= cases; _++)\n\t\t\t{\n\t\t\t\tOutput($\"Case #{_}: {calc(_)}\");\n\t\t\t}\n\t\t\tinf.Close();\n\t\t\toutf.Close();\n\t\t\tConsole.ForegroundColor = ConsoleColor.Cyan;\n\t\t\tConsole.WriteLine(\"Eureka!\");\n\t\t}\n\n\t\tprivate static string read()\n\t\t{\n\t\t\treturn inf.ReadLine();\n\t\t}\n#endif\n\n#if CodeForces\n\t\tstatic string asString(object s)\n\t\t{\n\t\t\treturn (s as double?)?.ToString(\"0.000000000\", System.Globalization.CultureInfo.InvariantCulture) ?? s.ToString();\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n#if DEBUG\n\t\t\tvar sw = new System.Diagnostics.Stopwatch();\n\t\t\tsw.Start();\n#endif\n\t\t\tobject o = Solve();\n\t\t\tif (o != null)\n\t\t\t{\n\t\t\t\tstring s = null;\n\t\t\t\tif (o is System.Collections.IEnumerable)\n\t\t\t\t{\n\t\t\t\t\ts = string.Join(\" \", ((System.Collections.IEnumerable)o).OfType().Select(x => asString(x)));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ts = asString(o);\n\t\t\t\t}\n\t\t\t\tif (!string.IsNullOrEmpty(s))\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(s);\n\t\t\t\t}\n\t\t\t}\n#if DEBUG\n\t\t\tsw.Stop();\n\t\t\tConsole.WriteLine(sw.Elapsed);\n\t\t\tConsole.ReadKey();\n#endif\n\t\t}\n\n\t\tprivate static string read()\n\t\t{\n#if !DEBUG\n\t\t\treturn Console.ReadLine();\n#else\n\t\t\treturn testInput.Dequeue();\n#endif\n\t\t}\n#endif\n\t}\n\n\tpublic static class ExtensionMethods\n\t{\n\t\tpublic static IEnumerable Of(this int n, Func gen)\n\t\t{\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tyield return gen();\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable Of(this int n, Func gen)\n\t\t{\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tyield return gen(i);\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable Of(this int n, T gen)\n\t\t{\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tyield return gen;\n\t\t\t}\n\t\t}\n\n\n\t\tpublic static IEnumerable Cartesian(this IEnumerable first, IEnumerable second, Func collector)\n\t\t{\n\t\t\treturn first.SelectMany(f => second.Select(s => collector(f, s)));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, Tuple.Create);\n\t\t}\n\n\t\tpublic static IEnumerable> CartesianE(this IEnumerable first, IEnumerable second)\n\t\t{\n\t\t\t// Calling CartesianE prevents selection of the wrong overload of Cartesian when you want a tuple of tuples to be returned\n\t\t\treturn first.Cartesian(second);\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, x.Item3, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> source)\n\t\t{\n\t\t\tIEnumerable> res = source.First().Select(x => single(x));\n\t\t\tforeach (IEnumerable next in source.Skip(1))\n\t\t\t{\n\t\t\t\tres = res.Cartesian(next, (sofar, n) => sofar.Concat(single(n)));\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static IEnumerable> Pow(this IEnumerable it, int num)\n\t\t{\n\t\t\treturn Enumerable.Repeat(it, num).Cartesian();\n\t\t}\n\n\t\tpublic static IEnumerable Demask(this IEnumerable> inp)\n\t\t{\n\t\t\tforeach (var pair in inp)\n\t\t\t{\n\t\t\t\tif (pair.Item2)\n\t\t\t\t{\n\t\t\t\t\tyield return pair.Item1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable>> Partition(this IEnumerable source, int groups)\n\t\t{\n\t\t\tforeach (var part in Enumerable.Range(0, groups).Pow(source.Count()).Select(x => x.ToArray()))\n\t\t\t{\n\t\t\t\tyield return Enumerable.Range(0, groups).Select(x => source.Where((item, idx) => part[idx] == x));\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable> Combinations(this IEnumerable it)\n\t\t{\n\t\t\tforeach (var conf in new[] { true, false }.Pow(it.Count()))\n\t\t\t{\n\t\t\t\tyield return it.Zip(conf, Tuple.Create).Demask();\n\t\t\t}\n\t\t}\n\n\t\tprivate static IEnumerable single(T it)\n\t\t{\n\t\t\tyield return it;\n\t\t}\n\n\t\tprivate static IEnumerable ExceptSingle(this IEnumerable first, T it, IEqualityComparer comp = null)\n\t\t{\n\t\t\tcomp = comp ?? EqualityComparer.Default;\n\t\t\tbool seen = false;\n\t\t\tforeach (T a in first)\n\t\t\t{\n\t\t\t\tif (!seen && comp.Equals(a, it))\n\t\t\t\t{\n\t\t\t\t\tseen = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tyield return a;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable> Permutations(this IEnumerable it)\n\t\t{\n\t\t\tif (it.Count() < 2)\n\t\t\t{\n\t\t\t\tyield return it;\n\t\t\t\tyield break;\n\t\t\t}\n\n\t\t\tforeach (T first in it)\n\t\t\t{\n\t\t\t\tforeach (IEnumerable part in Permutations(it.ExceptSingle(first)))\n\t\t\t\t{\n\t\t\t\t\tyield return single(first).Concat(part);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static T[][] Rho(this IEnumerable source, int x, int y)\n\t\t{\n\t\t\tT[][] res = Program.mkarr(x, y);\n\n\t\t\tint i = 0, j = 0;\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tforeach (T item in source)\n\t\t\t\t{\n\t\t\t\t\tres[i][j] = item;\n\t\t\t\t\tj++;\n\t\t\t\t\tif (j == y)\n\t\t\t\t\t{\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\ti++;\n\t\t\t\t\t\tif (i == x)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i == x)\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static T[][][] Rho(this IEnumerable source, int x, int y, int z)\n\t\t{\n\t\t\tT[][][] res = Program.mkarr(x, y, z);\n\n\t\t\tint i = 0, j = 0, k = 0;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tforeach (T item in source)\n\t\t\t\t{\n\t\t\t\t\tres[i][j][k] = item;\n\t\t\t\t\tk++;\n\t\t\t\t\tif (k == z)\n\t\t\t\t\t{\n\t\t\t\t\t\tk = 0;\n\t\t\t\t\t\tj++;\n\t\t\t\t\t\tif (j == y)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\tif (i == x)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i == x)\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f967bf6f09bf7013166ea615657db681", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n var a1 = xs[0];\n var a2 = xs[1];\n\n for (long i = 0; i < long.MaxValue; i++)\n {\n if (a1 <= 1 || a2 <= 1)\n {\n Print(i);\n return;\n }\n\n if (a1 < a2)\n {\n a1 += 1;\n a2 -= 2;\n }\n else\n {\n a1 -= 2;\n a2 += 1;\n }\n }\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5ad2386460632a892e750cde1e9b02cb", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing static System.Console;\nusing static System.Math;\n\npublic class Hello{\n public static void Main(){\n string[] input = ReadLine().Split(' ');\n int tyouten = int.Parse(input[0]);\n long hen = long.Parse(input[1]);\n \n if(tyouten == 1){\n WriteLine(\"1 1\");\n }else if(hen == 0){\n WriteLine(\"{0} {1}\",tyouten,tyouten);\n }else{\n \n //min\n int tyoutemp = (tyouten+1)/2;\n int oe = tyouten%2;\n int tempmin = (tyoutemp - hen)*2-oe;\n int min = Max(tempmin,0);\n Write(\"{0} \",min);\n \n //Max\n int check = 0;\n for(int i=2;i<=tyouten;i++){\n long saidai = (i*(i-1))/2; //\u9802\u70b9i\u500b\u306b\u5bfe\u3057\u3066\u4f7f\u3048\u308b\u8fba\u306e\u6700\u5927\u5024\n if(saidai >= hen){\n check = i;\n break;\n }\n }\n int max = tyouten - check;\n WriteLine(max);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0f0b6bf682ed5eee2d29509b0aa7e7ea", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "difficulty": 1300.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 \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\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "32e9f9cf285271bf1552c88b85fe6cd5", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing static System.Console;\nusing static System.Convert;\n\n\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": "ab86a4826608396b165e6ec02f8234bc", "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].ToUpper() + str.Substring(1,str.Length()-1)); }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e27664581b66a7dba03f3e219093341e", "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": "a41d66252d4c7e3f6be08c806de8d0ab", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "MS C#", "source_code": "41", "lang_cluster": "C#", "compilation_error": true, "code_uid": "422544c6fa2d90252303bc861ae02644", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "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 \u0422\u0440\u0438_\u0433\u0438\u0440\u043b\u044f\u043d\u0434\u044b\n{\n class Program\n {\n static void Main(string[] args)\n {\n int T = 0;\n var S = Console.ReadLine().Split();\n long[] A = new long[3];\n for (int i = 0; i < 3; i++) A[i] = Convert.ToInt64(S[i]);\n Array.Sort(A);\n if (A[0] == 1) T = 1;\n if (A[0] == 2 && A[1] == 2) T = 1;\n if (A[0] == 2 && A[1] == 4 && A[2] == 4) T = 1;\n if (A[0] == 3 && A[1] == 3 && A[2] == 3) T = 1;\n\n if (T == 1) Console.Write(\"YES\");\n else Console.Write(\"NO\");\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ee9ae1141862a5d370113044c9e0999a", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "difficulty": 1400.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;\nusing TasksCodeForce._800;\n\nnamespace TasksCodeForce\n{\n class Program\n {\n static void Main(string[] args)\n {\n _978B_FileName.Method();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "76ba307de0ef375daebade748d8b277f", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "#include \n#include \n\nusing namespace std;\n\nint main()\n{\n int a[100], n;\n cin >> n;\n for(int i = 0; i < n; i++)\n cin >> a[i];\n sort(a, a+n);\n for(int i = 0; i < n; i++)\n cout << a[i] << ' ';\n cout << endl;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a62e3efe9968a3179d0bfeb8e070daa4", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\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 Console.WriteLine(colNum.Sort());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c6266d92a42440aa646094268080434b", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks.Dataflow;\nusing static System.Console;\n\nnamespace task\n{\n class Program\n {\n static void Main(string[] args)\n {\n var k = int.Parse(ReadLine());\n var startData = ReadLine().Split(' ').Select(int.Parse);\n var data = startData.OrderByDescending(p=>p);\n var length = data.Count() -1;\n var str = string.Empty;\n for (var i = 0; i <= length; i++)\n {\n var dif = data.ElementAt(length - i) - startData.ElementAt(length - i);\n var res = dif + startData.ElementAt(length - i);\n str += (res) + \" \"; \n }\n WriteLine(str);\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "05e1a3e6903fd91dff5bd66560820a01", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\npublic 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": "b801b77d251c8a8b07383d46ca039630", "src_uid": "064162604284ce252b88050b4174ba55", "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/int[] dizi = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\t\t\tint sonuc = dizi[0]; \n\t\t\tfor (int i = 0; i < dizi[1]; i++)\n\t\t\t{\n\t\t\t\tif ( sonuc % 10 == 0)\n\t\t\t\t{\n\t\t\t\t\tsonuc = sonuc / 10;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsonuc--;\n\t\t\t\t}\n\t\t\t}Console.WriteLine(sonuc);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f840de6d12dafe74c3effc0034e706d5", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " static void 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 Console.WriteLine(n);\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0c4143afac73604ca596d67b184f4075", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "class 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": "1d4deb3e3b8ba28e1dbaca4056eadb83", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace CSharp\n{\n class Program\n {\n private static void WrongSubtraction(int n, int k)\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 Console.WriteLine(n);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5c7614656a7662dd051db3bf8967293f", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace 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 0)\n {\n inp_1 = (inp_1 % 10 == 0) ? inp_1 / 10 :\n inp_1 - 1;\n inp_2--;\n }\n\n Console.WriteLine(inp_1);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "68570e5fcadc402672f258837b0616cc", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nnamespace HWCODEFORCE\n{\n class Program\n {\n static void Task110A()\n {\n var numbers = Console.ReadLine().Split(\" \");\n int size = Convert.ToInt32(numbers[1]);\n int num = Convert.ToInt32(numbers[0]);\n for (int i = 0; i < size; ++i)\n {\n if (num % 10 == 0)\n {\n num /= 10;\n }\n else\n {\n num -= 1;\n }\n }\n Console.WriteLine(num);\n }\n static void Main(string[] args)\n {\n Task110A();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a8719aa7350727187d49b3603ae9e9e5", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "static int w_Sub(int n,int k)\n {\n int result=n;\n\n for (int i = 0; i < k; i++)\n {\n if (result.ToString()[result.ToString().Length - 1] == '0')\n {\n result /= 10;\n Console.WriteLine(result);\n }\n else\n {\n result--;\n Console.WriteLine(result);\n }\n }\n\n\n return result;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "17adab120a03ec57d03f27d006c6276e", "src_uid": "064162604284ce252b88050b4174ba55", "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 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.P\u0439arse(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": true, "code_uid": "f015d0d6889ae63cfdf82703fa6cd45d", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "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 Preparation\n{\n public class CodeForces710A\n {\n public void Main(string[] args)\n {\n var str = Console.ReadLine();\n if(str[0] == 'a' && str[1] == '1' ||\n str[0] == 'a' && str[1] == '8' ||\n str[0] == 'h' && str[1] == '1' ||\n str[0] == 'h' && str[1] == '8')\n Console.WriteLine(3);\n else if(str[0] == 'h' || str[1] == '8' || str[0] == 'a' || str[1] == '1')\n Console.WriteLine(5);\n else\n Console.WriteLine(8);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7f014c438ed8c2d8ddf20764f219baa7", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using static System.Console;\nnamespace test\n{\n class Program\n {\n static void Main()\n {\n var a = ReadLine().Split();\n int b = int.Parse(a[0]);\n for (int i = 0; i < b; i++)\n {\n string c = ReadLine();\n if (c.Contains('Y') || c.Contains('M') || c.Contains('C'))\n {\n WriteLine(\"#Color\");\n System.Environment.Exit(1);\n }\n }\n WriteLine(\"#Black&White\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f532f73ed9a0343b955ec88b837e2eb5", "src_uid": "19c311c02380f9a73cd477e4fde27454", "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 k=int.Parse(y[2]);\n if(m>=n&&k>=n)\n Console.WriteLine(\"Yes\");\n else\n Cosnole.WriteLine(\"No\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "412b61edcba09299ea0cf34af37aaf02", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "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 k=int.Parse(y[2]);\n if(m>=n&&k>=n)\n Console.WriteLine(\"Yes\");\n else\n Cosnole.WriteLine(\"No\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b2681114a0f594cb8ddf0122347e6fb", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n sealed class Program\n {\n static void Main(string[] args)\n {\n var d = Console.ReadLine().Split().Select(Int32.Parse).ToArray();\n Console.WriteLine(Math.Min(d[1], d[2]) >= d[0] ? \"YES\" : \"NO\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65874fc3b7eabf106d43648b0a8c4a5d", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\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\n//Interface\nnamespace Calculating_Function\n{\n interface ICalculating\n {\n public int calculate(int num);\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "653114eae0f697dd3970e11c84dd236c", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n long p = long.Parse(reader.ReadLine());\n long ans = p / 2;\n if(p % 2 == 1)\n ans -= p;\n writer.WriteLine(ans);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "87a5f1d307d4729f85f126453646fc25", "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 Dreamoon_and_WiFi\n{\n class Codigo\n {\n\t //Iniciando as vari\u00e1veis dreamoon e drazil\n private string dreamoon;\n private string drazil;\n\n\t //Iniciando um vetor que vai guardar os dois valores poss\u00edveis nas instru\u00e7\u00f5es\n private int[] contaDreamon = new int[2];\n private int[] contaDrazil = new int[2];\n\t \n\t //Quantidade de valores desconhecidos passados ao drazil\n private int quantInt;\n\n public Codigo(string dreamoon, string drazil)\n {\n this.dreamoon = dreamoon; //Iniciando valores\n this.drazil = drazil; //Iniciando valores\n contaDreamon[0] = dreamoon.Split(new char[] { '-' }).Length - 1; //Vai contar quantos '-' possui e vai passar para a vari\u00e1vel, e assim respectivamente com as 3 pr\u00f3xima linhas\n contaDreamon[1] = dreamoon.Split(new char[] { '+' }).Length - 1;\n contaDrazil[0] = drazil.Split(new char[] { '-' }).Length - 1;\n contaDrazil[1] = drazil.Split(new char[] { '+' }).Length - 1;\n quantInt = drazil.Split(new char[] { '?' }).Length - 1; //Quantidade de c\u00f3digos desconhecidos\n }\n\n private double compara()\n {\n if (contaDreamon[0] == contaDrazil[0] && contaDreamon[1] == contaDrazil[1]) //Se receberem a mesma quantidade de '+' e '-', a conta termina em 100%\n {\n return 1;\n }\n else if ((contaDreamon[0] == 0 && contaDrazil[0] != 0) || (contaDreamon[1] == 0 && contaDrazil[1] != 0)) //Se receber valores incorretos, a probabilidade \u00e9 zero\n return 0;\n else\n return ((double)(drazil.Length - quantInt) / dreamoon.Length); //Se n\u00e3o for nenhum disso, ele calcula a probabilidade de o Drazil retornar a posi\u00e7\u00e3o original\n }\n\n public void exibe()\n {\n string result = compara().ToString();\n result = result.Replace(',', '.');\n Console.WriteLine(\"{0:F12}\", result); //Exibe o resultado com 12 algarismos\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Teste x = new Teste();\n x.calcula(Console.ReadLine(), Console.ReadLine());\n //Codigo cod = new Codigo(Console.ReadLine(), Console.ReadLine()); //Chama a fun\u00e7\u00e3o com os dois valores digitados\n //cod.exibe(); //Exibe o resultado em decimal\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "096c41fbdb24d95dce3df01b396070b3", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n\n \n \n int input1 = Convert.ToInt32(Console.ReadLine());\n\n \n\n int input2 = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(FindDivisor(input1, input2));\n \n\n\n }\n\n static int FindDivisor(int x , int y)\n {\n List a = new List();\n \n for (int i = 1 ; i <= x; i++) if (x % i == 0) a.Add(i);\n\n try\n {\n return a[y - 1];\n }\n catch (ArgumentOutOfRangeException)\n {\n\n return -1;\n }\n \n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4a2077626632237f1efccc3c350e2ba4", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "difficulty": 1400.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}\") = \"\u0430\u0430\u0430\", \"\u0430\u0430\u0430\\\u0430\u0430\u0430.csproj\", \"{39F427EA-74BD-4CC2-B84E-670FC4E9D7E3}\"\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{39F427EA-74BD-4CC2-B84E-670FC4E9D7E3}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{39F427EA-74BD-4CC2-B84E-670FC4E9D7E3}.Debug|x86.Build.0 = Debug|x86\n\t\t{39F427EA-74BD-4CC2-B84E-670FC4E9D7E3}.Release|x86.ActiveCfg = Release|x86\n\t\t{39F427EA-74BD-4CC2-B84E-670FC4E9D7E3}.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": "3a1d2b6a48db980073a607a58a867aa2", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "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 _1B\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if((a[0]==a[1]||a[0]==a[1]+1||a[0]==a[1]-1)&&a[0]!=0&&a[1]!=0])\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n \n \n \n }\n }\n \n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f4819ccc9be525f8529c030d1f4d6c6a", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n{\n static void Main(string[] args)\n {\n int num1 = int.Parse(Console.ReadLine());\n if (num1 % 4==0 || num1 % 44==0 || num1 %444==0 ||\n num1 % 7==0 || num1 % 77==0 || num1 % 777==0 ||\n num1 % 47==0 || num1 % 74==0 ||\n num1 % 444==0 || num1 % 447==0 || num1% 474==0 || num1 % 477==0 ||\n num1 % 744==0 || num1 % 747==0 || num1 % 774==0 || num1 % 777==0 ||)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c2cbc21bcec2209caa09688750e4c962", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {348B755E-D841-49C7-AA54-3781E9C7497B}\n Exe\n _122A\n 122A\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": "0bea52aa484a2b2c5ab79444d8d55e18", "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 ConsoleApplication1\n{\n class cf110a\n {\n public static void Main()\n {\n int n = Int32.Parse(Console.ReadLine());\n Console.WriteLine(\"YES\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a4c552261fc6e98174f6670b80af07c6", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.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 palo=int.Parse(Console.ReadLine());\n int a,b,c,f=0;\n if(palo%47==0 | palo%4==0 | palo%7==0 | palo%477=0 |palo%744==p)\n {Console.WriteLine(\"YES\");}\n else{Console.WriteLine(\"NO\");\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a1069f28890ab0abc44c11720608caf9", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.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 x = input.ReadInt();\n var l = new[] { 'D', 'A', 'C', 'B' };\n int 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": true, "code_uid": "0531f46a8a7dce2ec405ef47b22751ab", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_21_a\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n bool can=true;\n int k = s.IndexOf('@');\n if(k==-1 || k==0 || k==s.Length-1 || k>=17) can =false;\n if(can)\n {\n string first = s.Substring(0, k);\n for (int i = 0; i < first.Length; i++)\n {\n if (first[i] == '_' || (first[i] >= 'A' && first[i] <= 'Z') ||\n (first[i] >= 'a' && first[i] <= 'z') || (first[i] >= '0' && first[i] <= '9'))\n {\n\n }\n else\n {\n can = false;\n break;\n }\n\n }\n }\n if (!can) {Console.WriteLine(\"NO\"); return;}\n int kk = s.IndexOf('/');\n int to;\n if (kk == -1)\n to = s.Length;\n else\n to = kk;\n string second = s.Substring(k+1 , to-k-1);\n if (second.Length==0 || second.Length > 32 || kk==s.Length-1) can = false;\n if (can)\n {\n int kol = 0;\n for (int i = 0; i < second.Length; i++)\n {\n if (second[i] == '_' || (second[i] >= 'A' && second[i] <= 'Z') ||\n (second[i] >= 'a' && second[i] <= 'z') || (second[i] >= '0' && second[i] <= '9'))\n {\n kol++;\n }\n else\n if (second[i] == '.')\n if (kol > 0 && kol < 17) kol = 0;\n else\n {\n can = false;\n break;\n }\n }\n }\n if (!can) {Console.WriteLine(\"NO\"); return;}\n if (kk !=-1)\n {\n string third = s.Substring(to+1,s.Length-to-1);\n if (third.Length > 16) {can = false; break;}\n for (int i = 0; i < third.Length; i++)\n {\n if (third[i] == '_' || (third[i] >= 'A' && third[i] <= 'Z') ||\n (third[i] >= 'a' && third[i] <= 'z') || (third[i] >= '0' && third[i] <= '9'))\n {\n\n }\n else\n {\n can = false;\n break;\n }\n\n }\n }\n if (!can) {Console.WriteLine(\"NO\"); return;}\n\n Console.WriteLine(\"YES\");\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "009cd2cbb14b9e24cc625bcc19bce0c4", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.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.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 }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3dce87cce0077b8862c8c8e24ce2c617", "src_uid": "f48ff06e65b70f49eee3d7cba5a6aed0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CF677_D2_A\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n double dieNumber = 6;\n\n double yakko = int.Parse(input[0]);\n double wakko = int.Parse(input[1]);\n\n if (yakko >= wakko)\n {\n double remain = dieNumber - yakko;\n double result = Math.Round((remain + 1) / dieNumber, 1);\n switch (result)\n {\n case 0.2:\n Console.WriteLine(\"1/6\");\n break;\n\n case 0.3:\n Console.WriteLine(\"1/3\");\n break;\n\n case 0.5:\n Console.WriteLine(\"1/2\");\n break;\n\n case 0.7:\n Console.WriteLine(\"2/3\");\n break;\n\n case 0.8:\n Console.WriteLine(\"5/6\");\n break;\n\n case 1:\n Console.WriteLine(\"1/1\");\n break;\n }\n }\n else\n {\n double remain = dieNumber - wakko;\n double result = Math.Round((remain + 1) / dieNumber, 1);\n switch (result)\n {\n case 0.2:\n Console.WriteLine(\"1/6\");\n break;\n\n case 0.3:\n Console.WriteLine(\"1/3\");\n break;\n\n case 0.5:\n Console.WriteLine(\"1/2\");\n break;\n\n case 0.7:\n Console.WriteLine(\"2/3\");\n break;\n\n case 0.8:\n Console.WriteLine(\"5/6\");\n break;\n\n case 1:\n Console.WriteLine(\"1/1\");\n break;\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "db5c95a5a371666193d98d2507744ca2", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "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 raising_bactaria\n{\n class Program\n {\n static void Main(string[] args)\n {\n int z = 0;\n int n = int.Parse(Console.ReadLine());\n string x = Convert.ToString(n, 2);\n for (int i = 0; i < x.Length; i++)\n {\n if (x[i] == '1')\n {\n z++;\n }\n }\n Console.WriteLine(z);\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": "d8bb0df687253645089ce322903e0d99", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "namespace Problem3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = 0;\n string input = Convert.ToString(int.Parse(Console.ReadLine()), 2);\n for(int i = 0; i < input.Length; i++)\n {\n if (input[i] == '1')\n count++;\n }\n Console.WriteLine(count);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fef6225d134227480477de2bebfb0184", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program\n{\n void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int result = 0;\n while (n > 0)\n {\n n -= ((int)Math.Log(n, 2) - 1);\n ++result;\n }\n Console.WriteLine(result);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b746c731a83ceae01231b2f695e01990", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\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": "0857c0a621d86ec7d55d1fdef7d61734", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "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}\") = \"Stone on the table\", \"Stone on the table\\Stone on the table.csproj\", \"{D9768989-261D-4493-9CE1-1AD4785AEF09}\"\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{D9768989-261D-4493-9CE1-1AD4785AEF09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{D9768989-261D-4493-9CE1-1AD4785AEF09}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{D9768989-261D-4493-9CE1-1AD4785AEF09}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{D9768989-261D-4493-9CE1-1AD4785AEF09}.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": "fa5b07c8c27683d301ce0b8a12526cbd", "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 Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2a87b64fb7b9b4f1d3b1bd33bf077061", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint stone = int.Parse();\n\t\tstring colors = Console.ReadLine();\n\t\tint counter = 0;\n\t\tfor(int i = 1; i < stone; i++)\n\t\t{\n\t\t\tif(colors[i-1] != colors[i])\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\tcounter++;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(counter);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "73bb6c47abd247b357cb74cb86c25d6e", "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.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.ToArray());\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n object output = Go();\n if (output != null)\n Wl(output.ToString());\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static void Wl(T o)\n {\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n public struct Tuple\n {\n public T Item1;\n public K Item2;\n\n public Tuple(T t, K k)\n {\n Item1 = t;\n Item2 = k;\n }\n\n public override bool Equals(object obj)\n {\n var o = (Tuple)obj;\n return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);\n }\n\n public override int GetHashCode()\n {\n return Item1.GetHashCode() ^ Item2.GetHashCode();\n }\n\n public override string ToString()\n {\n return \"(\" + Item1 + \" \" + Item2 + \")\";\n }\n }\n\n #endregion\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d5eafec12c923cd6150d9b3f15dee79b", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "int n, p, k;\nString[] input = Console.ReadLine().Split(' ');\nn = Int16.Parse(input[0]); //osszes oldal\np = Int16.Parse(input[1]); //jelenlegi\nk = Int16.Parse(input[2]); //pluszba\nfor(int i = p-k; i <= p+k; i++){\n if(i < 1) i = 1;\n if(i != 1 && i == p-k){\n Console.Write(\"<< \");\n }\n if(i == p) Console.Write(\"(\"+i+\") \");\n else Console.Write(i+\" \");\n if(i >= n) break;\n else if(i == p+k){\n Console.Write(\">>\");\n break;\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3c45272ca8825780b3acb70c6c19ca09", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null} {"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 var a = scanner.NextInt();\n var b = scanner.NextInt();\n long long m = 1000000007;\n long long ans = 0;\n for (int 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": "8923ec2e312605460a3646dc359dbbe6", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0} {"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 ulong 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\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": "35060a51b3d3ce4662ca5e176c7c0aca", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0} {"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 var a = scanner.NextInt();\n var 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": "cce8b377f564b35f4f2df7bcdc8b746f", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeForce\n{\n class _66a\n {\n public static void Main()\n {\n var line = Console.ReadLine();\n var big = BigInteger.Parse(line);\n if (big >= -128 && big <= 127)\n {\n Console.WriteLine(\"byte\");\n }\n else if (big >= -32768 && big <= 32767)\n {\n Console.WriteLine(\"short\");\n }\n else if (big >= -2147483648 && big <= 2147483647)\n {\n Console.WriteLine(\"int\");\n }\n else if (big >= -9223372036854775808 && big <= 9223372036854775807)\n {\n Console.WriteLine(\"long\");\n }\n else\n {\n Console.WriteLine(\"BigInteger\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "985cf81bdb8be60eb1a154e85bfd0503", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "class program\n{\n static void Main()\n {\n double t = double.Parse(Console.ReadLine());\n if(t >=\u2009-\u2009128 && t <= 127)\n Console.WriteLine(\"byte\");\n if (t >= -32768 && t <= 32767)\n Console.WriteLine(\"short\");\n if (t >= -\u20092147483648 && t <= 2147483647)\n Console.WriteLine(\"int\");\n if (t >= -9223372036854775808 && t <= 9223372036854775807)\n Console.WriteLine(\"long \");\n else\n Console.WriteLine(\"BigInteger\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6ec34442a8f18fa6bd8b40f8ff895999", "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": "a8c4269ed09c5f8a7a729fe66d584f93", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\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": "c918cca39c2479ef1d5890e94a51a7d0", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing 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 long n;\n string res=\"\";\n try\n {\n n = long.Parse(Console.ReadLine());\n\n if (n >= - 9223372036854775808 && n <= 9223372036854775807)\n res = \"long\";\n if (n >= -\u20092147483648 && n <= 2147483647)\n res = \"int\";\n if (n >= -32768 && n <= 32768)\n res = \"short\";\n if (n >= -128 && n <= 127)\n res = \"byte\";\n Console.WriteLine(res);\n }\n catch\n {\n Console.WriteLine(\"BigInteger\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d7cf04bab374289bd06496293b1b170d", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.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}\") = \"ConsoleApplication63\", \"ConsoleApplication63\\ConsoleApplication63.csproj\", \"{EEDB3FBD-376F-4342-836B-E5C0F5F107FF}\"\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{EEDB3FBD-376F-4342-836B-E5C0F5F107FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{EEDB3FBD-376F-4342-836B-E5C0F5F107FF}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{EEDB3FBD-376F-4342-836B-E5C0F5F107FF}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{EEDB3FBD-376F-4342-836B-E5C0F5F107FF}.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": "b6a6b410904774240a96d71cd3a52405", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.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}\") = \"ConsoleApplication62\", \"ConsoleApplication62\\ConsoleApplication62.csproj\", \"{C60EB15D-E743-4E19-8590-28626807264F}\"\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{C60EB15D-E743-4E19-8590-28626807264F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{C60EB15D-E743-4E19-8590-28626807264F}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{C60EB15D-E743-4E19-8590-28626807264F}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{C60EB15D-E743-4E19-8590-28626807264F}.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": "a5a829b6fdd78358b03d8df29454cedc", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Codeforces\n{\n\tclass Problem74t6A\n\t{\n\t \tstatic void Main() {\n\t\t string[] args = Console.In.ReadLine().Split(' ');\n long S = long.Parse(args[0]);\n long xIgor = long.Parse(args[1]);\n long xGoal = long.Parse(args[2]);\n args = Console.In.ReadLine().Split(' ');\n long tTram = long.Parse(args[0]);\n long tIgor = long.Parse(args[1]);\n args = Console.In.ReadLine().Split(' ');\n long xTram = long.Parse(args[0]);\n int dirTram = int.Parse(args[1]);\n \n if (xIgor > xGoal){\n xIgor = S - xIgor;\n xGoal = S - xGoal;\n xTram = S - xTram;\n dirTram = -dirTram;\n }\n \n long resIgor = (xGoal - xIgor) * tIgor;\n long resTram = 0;\n if (dirTram == 1){\n if (xTram < xIgor){\n resTram = (xGoal - xTram) * tTram;\n } else{\n resTram =((S - xTram) + S + (xGoal)) * tTram;\n }\n } else{a\n resTram =(xTram + xGoal) * tTram;\n }\n\n\t\t\tConsole.Out.WriteLine(resTram < resIgor ? resTram : resIgor);\n\t\t\tConsole.In.ReadLine();\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c953b4f1ca1a9718029a75ce12f072a1", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "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.Threading.Tasks;\n\nnamespace crosses\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"input.txt\"));\n\n var field = new char[3, 3];\n\n int readedChars = 0;\n int row = 0, col = 0;\n bool hasUnsetted = false;\n int v_1 = 0, v_2 = 0;\n\n while (true)\n {\n if (readedChars == 9)\n {\n break;\n }\n\n char temp = (char)Console.Read();\n if (temp == '\\r' || temp == '\\n')\n {\n continue;\n }\n else\n {\n readedChars++;\n field[row, col] = temp;\n if (temp == '.')\n {\n hasUnsetted = true;\n }\n else if (temp == 'X')\n {\n v_1++;\n }\n else if (temp == '0')\n {\n v_2++;\n }\n\n if (col == 2)\n {\n row++;\n col = 0;\n }\n else\n {\n col++;\n }\n }\n }\n\n char x = 'X';\n char o = '0';\n int winsX = 0, wins0 = 0;\n\n for (int i = 0; i < 3; i++)\n {\n bool rowXWin = true, row0win = true, colXwin = true, col0win = true; \n for (int j = 0; j < 3; j++)\n {\n if (field[i, j] != x)\n {\n rowXWin = false;\n }\n\n if (field[j, i] != x)\n {\n colXwin = false;\n }\n\n if (field[i, j] != o)\n {\n row0win = false;\n }\n\n if (field[j, i] != o)\n {\n col0win = false;\n }\n }\n\n if (rowXWin)\n {\n winsX++;\n }\n\n if(colXwin)\n {\n winsX++;\n }\n\n if (row0win)\n {\n wins0++;\n }\n\n if (col0win)\n {\n wins0++;\n }\n }\n\n //if (winsX > 1 || wins0 > 1 || (wins0 == 1 && winsX == 1))\n if ((wins0 >= 1 && winsX >= 1))\n {\n Console.WriteLine(\"illegal\");\n return;\n }\n\n if (v_1 - v_2 > 1 || v_1 - v_2 < 0)\n {\n Console.WriteLine(\"illegal\");\n return;\n }\n\n if (v_1 > v_2 && wins0 >= 1)\n {\n Console.WriteLine(\"illegal\");\n return;\n }\n\n if (v_1 == v_2 && wins1 >= 1)\n {\n Console.WriteLine(\"illegal\");\n return;\n }\n\n if (winsX >= 1)\n {\n Console.WriteLine(\"the first player won\");\n return;\n }\n\n if (wins0 >= 1)\n {\n Console.WriteLine(\"the second player won\");\n return;\n }\n\n if (!hasUnsetted)\n {\n Console.WriteLine(\"draw\");\n return;\n }\n\n if (v_1 > v_2)\n {\n Console.WriteLine(\"second\");\n //return;\n }\n else\n {\n Console.WriteLine(\"first\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b9d1cebbb33bc43e995d960c75478bcd", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Drawing;\nusing System.IO;\n\nnamespace prE {\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 map = new[] {\n \"0000000000000000000000000010101111110100000000000000000000000000\",\n \"0000000000000000000000101110101010010111110000000000000000000000\",\n \"0000000000000000000011101000100011010000100100000000000000000000\",\n \"0000000000000000011110101011111000011110101110100000000000000000\",\n \"0000000000000000110000001010000011110000101010110000000000000000\",\n \"0000000000000010011011111011101110100101100010010100000000000000\",\n \"0000000000000111001001000000101000111100110110110110000000000000\",\n \"0000000000011111101101101110111011100001100100100011100000000000\",\n \"0000000000111111111111000010000010001011001101101001110000000000\",\n \"0000000001111111111111111111101111111001111001111111111000000000\",\n \"0000000011111111111111111111111111111111111111111111111100000000\",\n \"0000000111111111111111111111111111111111111111111111111110000000\",\n \"0000000111111111111111111111111111111111111111111111111110000000\",\n \"0000001111111111111111111111111111111111111111111111111111000000\",\n \"0000011111111111111111111111111111111111111111111111111111100000\",\n \"0000011111111111111111111111111111111111111111111111111111100000\",\n \"0000111111111111111111111111111111111111111111111111111111110000\",\n \"0001111111111111111111111111111111111111111111111111111111111000\",\n \"0000011111111111111111111111111111111111111111111111111111111000\",\n \"0000000111111111111000100111111111111110001010111111111111100000\",\n \"0011000001111111110010001111111111111110100000001111111100000000\",\n \"0011110000011111000110100011111111111111101101100101100000001100\",\n \"0111111100000100011100111001111111111101001000110000000001111110\",\n \"0111111111000001001001101100011111111101101111100100001111111110\",\n \"0111111111111011011100000111001111111000100100001110111111111110\",\n \"0111111111000001000111011100011111111010111110100010010111111110\",\n \"1111111111110111010010010001001111110010010000110111000111111111\",\n \"1111111111100010010110111011101111010111011110011100010111111111\",\n \"1111111111101111110111100001001010000101001011110001110111111111\",\n \"1111111111100000100100111011100010101101101001000100100111111111\",\n \"1111111111110110111101101110001011100000111101011111101111111111\",\n \"1111111111100011100100100011101001110111100101110001000111111111\",\n \"1111111111111000001101110110111011000001001101100100010111111111\",\n \"1111111111111101101000010100001010010101101000110110111111111111\",\n \"1111111111110000111101010101011110110100101110011100011111111111\",\n \"1111111111111010010001110001111000100110000100110001111111111111\",\n \"1111111111111111000111000101101101101100101110100100111111111111\",\n \"1111111111111111110001011111100000111111100010001111111111111111\",\n \"0111111111111111100100001111101011111111111000100111111111111110\",\n \"0111111111111111111111111111111000011111111111111111111111111110\",\n \"0111111111111111111111111111010010111111111111111111111111111110\",\n \"0111111111111111111111111101000111111111111111111111111111111110\",\n \"0011111111111111111111111100010001111111111111111111111111111100\",\n \"0011111110011111111111111111110111111111111111111111111111111100\",\n \"0001111111010111111111111111100011111111111111111111101111111000\",\n \"0001111111000100011111111111001011111111111011111010000111111000\",\n \"0001111111010101001010001101011001010010110001100000101111111000\",\n \"0000111111110001100000100000001100011000000101001110111111110000\",\n \"0000011111110100111101111011100111000011101111101011111111100000\",\n \"0000011111111110100100100010111101110110100000100011111111100000\",\n \"0000001111111100001101101000010001010000111010001111111111000000\",\n \"0000000111111111011000111110110101000101100011111111111110000000\",\n \"0000000111111111001110010100011100010111001000111111111110000000\",\n \"0000000011111111100011110001110110111101111011111111111100000000\",\n \"0000000001111111110110000101000000100001011111111111111000000000\",\n \"0000000000111111111111010111101101101011001111111111110000000000\",\n \"0000000000011111111111110000111100001000011111111111100000000000\",\n \"0000000000000111111111111111111110111111111111111110000000000000\",\n \"0000000000000011111111111111111111111111111111111100000000000000\",\n \"0000000000000000111111111111111111111111111111110000000000000000\",\n \"0000000000000000011111111111111111111111111111100000000000000000\",\n \"0000000000000000000011111111111111111111111100000000000000000000\",\n \"0000000000000000000000111111111111111111110000000000000000000000\",\n \"0000000000000000000000000011111111111100000000000000000000000000\",\n };\n\n int r = NextInt();\n int c = NextInt();\n var cc = map[r][c];\n writer.Write(cc == '1' ? \"IN\" : \"OUT\");\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": true, "code_uid": "5b5163dfaa5cbab35ddcedcfe935a794", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": null} {"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\tpublic static void Main(string[] args)\n\t{\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\t}\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 null;\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "23e7162b5f839648aba9f464d60927e8", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "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 Pr1\n{\n class Program\n {\n static void Main()\n {\n string a= Console.ReadLine();\n int k=1,max=0;\n string s=\"AEIOUY\";\n for(int i=0;i getInter(Line l2)\n {\n double d = a * l2.b - b * l2.a;\n double dx = -c * l2.b + l2.c * b;\n double dy = -a * l2.c + l2.a * c;\n return new Tuple(dx / d, dy / d);\n }\n }\n class Program\n {\n static double sqr(double x)\n {\n return x * x;\n }\n static double getAngle(double x, double y) {\n return Math.PI / 2 - Math.Atan2(x, y);\n }\n static void Main(string[] args) \n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n string s3 = Console.ReadLine();\n string[] sm1 = s1.Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n string[] sm2 = s2.Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n string[] sm3 = s3.Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n double x1 = double.Parse(sm1[0], CultureInfo.InvariantCulture);\n double y1 = double.Parse(sm1[1], CultureInfo.InvariantCulture);\n double x2 = double.Parse(sm2[0], CultureInfo.InvariantCulture);\n double y2 = double.Parse(sm2[1], CultureInfo.InvariantCulture);\n double x3 = double.Parse(sm3[0], CultureInfo.InvariantCulture);\n double y3 = double.Parse(sm3[1], CultureInfo.InvariantCulture);\n Line l1 = new Line(x1, y1, x2, y2);\n Line l2 = new Line(x2, y2, x3, y3);\n l1 = l1.getPerp((x1 + x2) / 2, (y1 + y2) / 2);\n l2 = l2.getPerp((x2 + x3) / 2, (y2 + y3) / 2);\n Tuple center = l1.getInter(l2);\n double xc = center.Item1;\n double yc = center.Item2;\n double r = Math.Sqrt(sqr(xc - x1) + sqr(yc - y1));\n double ans = 1e+12;\n \n double angle1 = getAngle(x1 - xc, y1 - yc);\n double angle2 = getAngle(x2 - xc, y2 - yc);\n double angle3 = getAngle(x3 - xc, y3 - yc);\n for (int i = 3; i <= 100; ++i)\n {\n List> v = new List>();\n bool flag1 = false;\n bool flag2 = false;\n bool flag3 = false;\n\n for (int j = 0; j < i; ++j)\n {\n Tuple t = new Tuple (xc + Math.Cos(angle1 + (double)2 * (double)Math.PI * j / i) * r, yc + Math.Sin(angle1 + 2 * Math.PI * j / i) * r);\n v.Add(t);\n }\n foreach (var item in v) {\n \n if (Math.Abs(item.Item1 - x1) < (double)1e-5 && Math.Abs(item.Item2 - y1) < (double)1e-5) flag1 = true;\n if (Math.Abs(item.Item1 - x2) < (double)1e-5 && Math.Abs(item.Item2 - y2) < (double)1e-5) flag2 = true;\n if (Math.Abs(item.Item1 - x3) < (double)1e-5 && Math.Abs(item.Item2 - y3) < (double)1e-5) flag3 = true;\n }\n if (flag1 && flag2 && flag3) {\n ans = Math.Min(ans, Convert.Todouble(i) / 2 * sqr(r) * Math.Sin(2 * Math.PI / i));\n }\n \n }\n Console.WriteLine(ans.ToString());\n // s1 = Console.ReadLine();\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3d2cc3c98f8c66a5ac2b27fb1107c539", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\n\nclass CF0001C_Ancient_Berland_Circus\n{\n\t// minimum legal delta for n up to 100 is 0.009999999999991 (for 67/100 with 97)\n\t// but computational error encroaches from both ends\n\tconst double EPSILON = 0.0001;\n\n\tstatic int likely_denominator (double d)\n\t{\n\t\tfor (int n = 3; n <= 100; ++n)\n\t\t{\n\t\t\tdouble k = d * n;\n\t\t\t\n\t\t\tif (Math.Abs(k - Math.Round(k)) <= EPSILON)\n\t\t\t\treturn n;\n\t\t}\n\t\t\n\t\tthrow new Exception(\"likely_denominator(): EPSILON needs tuning\");\n\t}\n\n\tstatic double acos (double x)\n\t{\n\t\treturn Math.Acos(Math.Max(-1.0, Math.Min(1.0, x)));\n\t}\n\n\tstatic double minimal_area (double a, double u, double b, double v, double c, double w)\n\t{\n\t\tdouble bbvv = b * b + v * v;\n\t\tdouble abuv = a * a + u * u - bbvv;\n\t\tdouble cbwv = c * c + w * w - bbvv;\n\t\tdouble u_v = 2 * (u - v);\n\t\tdouble w_v = 2 * (w - v);\n\t\tdouble a_b = 2 * (a - b);\n\t\tdouble c_b = 2 * (c - b);\n\n\t\tdouble x = (u_v * cbwv - w_v * abuv) / (u_v * c_b - w_v * a_b);\n\t\tdouble y = (abuv - x * a_b) / u_v;\n\t\tdouble r2 = (a - x) * (a - x) + (u - y) * (u - y);\n\n\t\tconst double TWO_PI = 2 * Math.PI;\n\t\tdouble r_ab = acos(((a - x) * (b - x) + (u - y) * (v - y)) / r2) / TWO_PI;\n\t\tdouble r_bc = acos(((b - x) * (c - x) + (v - y) * (w - y)) / r2) / TWO_PI;\n\t\tdouble r_ca = acos(((c - x) * (a - x) + (w - y) * (u - y)) / r2) / TWO_PI;\n\n\t\tint n_ab = likely_denominator(r_ab);\n\t\tint n_bc = likely_denominator(r_bc);\n\t\tint n_ca = likely_denominator(r_ca);\n\t\tint n = Math.Max(n_ab, Math.Max(n_bc, n_ca));\n\n\t\treturn n * r2 * Math.Sin(TWO_PI / n) / 2;\n\t}\n\n\tstatic void Main ()\n\t{\n//\t\tSystem.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(\"en-US\");\n\t\tvar nfi = new System.Globalization.NumberFormatInfo();\n\t\tnfi.NumberDecimalSeparator = \".\";\n\t\tstring s = Console.ReadLine() + \" \" + Console.ReadLine() + \" \" + Console.ReadLine();\n\t\tvar tokens = s.Split(' ');\n\t\tvar x0 = double.Parse(tokens[0], nfi);\n\t\tvar y0 = double.Parse(tokens[1], nfi);\n\t\tvar x1 = double.Parse(tokens[2], nfi);\n\t\tvar y1 = double.Parse(tokens[3], nfi);\n\t\tvar x2 = double.Parse(tokens[4], nfi);\n\t\tvar y2 = double.Parse(tokens[5], nfi);\n\t\n\t\tConsole.WriteLine(minimal_area(x0, y0, x1, y1, x2, y2), nfi);\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c9e3ad11f83ba3c4410a8029089d0ec9", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "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 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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd61723ee110468e9117db115ea2acfe", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.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\tlong[] nmk = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();\n\t\tConsole.WriteLine(nmk[0] & 1 == nmk[1] & 1 ? BigInteger.ModPow(2, new BigInteger(nmk[0] - 1) * new BigInteger(nmk[1] - 1), 1000000007) : 0);\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b09708a22ff8dfd0f546e852f410aba3", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Text;\n\nnamespace program\n{\n class Program\n {\n static StringBuilder output = new StringBuilder();\n\n static void RunIteration()\n {\n string num = Console.ReadLine();\n\n int result = (num[0] - 49) * 10;\n result += num.Length switch\n {\n 1 => 1,\n 2 => 3,\n 3 => 6,\n 4 => 10,\n };\n\n output.AppendLine(result.ToString());\n }\n\n static void Main()\n {\n int count = int.Parse(Console.ReadLine());\n while (count-- > 0)\n RunIteration();\n\n Console.WriteLine(output);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7f527f36f5ba248cf93731c3107fd641", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "MS C#", "source_code": "string input = Console.ReadLine();\n int x1 = Convert.ToInt32(input.Split(new Char[] { ' ' })[0]);\n int x2 = Convert.ToInt32(input.Split(new Char[] { ' ' })[1]);\n int count = 0;\n x1--;\n while (true)\n {\n if (count % x2 == 0)\n {\n x1++;\n }\n if (x1 == 0)\n {\n break;\n }\n x1--;\n count++;\n }\n\n Console.WriteLine(count);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e75723b97012506a128811007fab0acb", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\n\n\nnamespace Task47B\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string[] container = new string[3];\n //for (int i = 0; i < 3; i++)\n // container[i]= Console.ReadLine();\n\n //char lower, mediun, high;\n string ans = \"\";\n for (int i = 0; i < 3; i++)\n {\n string temp = Console.ReadLine();\n char c1 = temp[0], c2 = temp[2], mark = temp[1];\n\n if (ans.Equals(\"\"))\n {\n ans = mark.Equals('<') ? \"\" + c1 + c2 : \"\" + c2 + c1;\n }\n else if (!ans.Contains(c1) && ans.Contains(c2))\n {\n int indexOfC2 = ans.IndexOf(c2);\n\n if (mark.Equals('<'))\n ans = ans.Insert(indexOfC2, c1.ToString());\n else\n ans = ans.Insert(indexOfC2 + 1, c1.ToString());\n }\n else if (ans.Contains(c1) && !ans.Contains(c2))\n {\n int indexOfC1 = ans.IndexOf(c1);\n\n if (mark.Equals('<'))\n ans = ans.Insert(indexOfC1 + 1, c2.ToString());\n else\n ans = ans.Insert(indexOfC1, c2.ToString());\n }\n else\n {\n int indexOfC1 = ans.IndexOf(c1);\n int indexOfC2 = ans.IndexOf(c2);\n if ((mark.Equals('<') && indexOfC1 > indexOfC2) || (mark.Equals('>') && indexOfC1 < indexOfC2))\n ans = \"Impossible\";\n }\n }\n\n\n Console.WriteLine(ans);\n // Console.ReadKey();\n }\n\n // private static \n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "098a594b5d7eb6cefee33464aa28f7c2", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "difficulty": 1200.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 \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 Console.ReadLine();\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": "9a6847ab52ae4c3c5dfdca4d5fc79e1d", "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 Console.ReadLine(\"\");\n\n\t}\n\n\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ef3a2cb5f6c8bd2d9d3363ff0aa42366", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text.RegularExpressions;\n\nnamespace _20AV1\n{\n class Program\n {\n static void Main()\n {\n string st = Console.ReadLine();\n while (st.Contains(\"//\"))\n {\n st = st.Replace(\"//\", \"/\");\n }\n if (st.EndsWith('/'))\n {\n st = st.Remove(st.Length-1, 1);\n }\n Console.WriteLine(st);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e5f63ace0196cb30d4ca8c7f9ac12d21", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.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;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n int numeroSorte= int.Parse(Console.ReadLine()); // receber valor \n \t\t \tForcaBrruta(numeroSorte);\n //Console.ReadKey();\n }\n static void ForcaBrruta(int numSorte)\n\t\t{\n\t\tint indice =0;\n\t\tList mylista = new List();\n\t\tint resultado = 0;\n\n\t\t\tfor( int i =0; i <= numSorte; i++)\n\t\t\t{\n\t\t\t\tif(NumeroSort(Convert.ToString(i)))\n\t\t\t\t{\n\t\t\t\t\tmylista.Add(new int(i));\n\t\t\t\t\tif(mylista[indice] == numSorte)\n\t\t\t\t\t{\n\t\t\t\t\t\tresultado = \n\nindice;\n\t\t\t\t\t}\n\t\t\t\t\tindice++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(resultado+1);\n\t\t}\n static bool NumeroSort(string x)\n\t\t{\n\t\t\tfor(int i = 0; i < x.Length; i++)\n\t\t\t{\n\t\t\t\tif(x[i] != '4' && x[i] != '7')\n\t\t\t\t\treturn(false);\n\t\t\t}\n\t\t\treturn (true);\n\t\t}\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "69b2317e1d5dff8266f08a034af2cb00", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "difficulty": 1100.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 int numeroSorte= int.Parse(Console.ReadLine()); // receber valor \n \t\t \tForcaBrruta(numeroSorte);\n //Console.ReadKey();\n }\n static void ForcaBrruta(int numSorte)\n\t\t{\n\t\tint indice =0;\n\t\tint32 [ ] Vetor = new int32 [10000000000];\n\t\tint resultado = 0;\n\n\t\t\tfor( int i =0; i <= numSorte; i++)\n\t\t\t{\n\t\t\t\tif(NumeroSort(Convert.ToString(i)))\n\t\t\t\t{\n\t\t\t\t\tVetor[indice] = i;\n\t\t\t\t\tif(Vetor[indice] == numSorte)\n\t\t\t\t\t{\n\t\t\t\t\t\tresultado = indice;\n\t\t\t\t\t}\n\t\t\t\t\tindice++;\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(resultado+1);\n\t\t}\n static bool NumeroSort(string x)\n\t\t{\n\t\t\tfor(int i = 0; i < x.Length; i++)\n\t\t\t{\n\t\t\t\tif(x[i] != '4' && x[i] != '7')\n\t\t\t\t\treturn(false);\n\t\t\t}\n\t\t\treturn (true);\n\t\t}\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65280fb73892dc51360d8ea70b8478fe", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Configuration;\nusing System.Runtime.Remoting.Metadata.W3cXsd2001;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] numbers = line.Split(' ');\n int a = int.Parse(numbers[0]);\n int b = int.Parse(numbers[1]);\n\n if(a == b)\n Console.WriteLine(a + \" \" + b);\n else if (a > b)\n {\n int temp = a - b;\n temp = temp / 2;\n Console.WriteLine(b +\" \" + temp);\n }\n else\n {\n int temp = b - a;\n temp = temp / 2;\n Console.WriteLine(a + \" \" + temp);\n }\n Console.ReadLine();\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "10f0d9a0a056ff0cdb60ac3376da3cdf", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\npublic class test{\n public static void Main(){\n string input = Console.ReadLine();\n string[] socks = input.Split(' ');\n \n int days1 = 0;\n int days2 = 0;\n int max = (int)MathF.Max(Int32.Parse(socks[0]), Int32.Parse(socks[1]));\n int min = (int)MathF.Min(Int32.Parse(socks[0]), Int32.Parse(socks[1]));\n \n days1 = min;\n if (max > 1){\n if ((max - min) % 2 == 0){\n days2 = (max - min) / 2;\n }\n else{\n days2 = (max - min - 1) / 2;\n }\n }\n else{\n days2 = 0;\n }\n\n System.Console.WriteLine(days1 + \" \" + days2);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "122b634232371b141d760f5bfbf81d4e", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "MS C#", "source_code": "namespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = Convert.ToInt16(Console.ReadLine());\n if (num >= 2)\n Console.WriteLine(\"25\");\n else\n return;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "de275aa323bff241eee82db1ee145a0f", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0} {"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 b && a > c)\n {\n return c + b == a;\n }\n else if (b > c && b > a)\n {\n return a + c == b;\n }\n else if (c > a && c > b)\n {\n return a + b == c;\n }\n\n return false;\n }\n public bool IsAlmostRight()\n {\n int[] dx = { -1, 0, 1, 0 };\n int[] dy = { 0, 1, 0, -1 };\n for (int i = 0; i < 4; i++)\n {\n Triangle t1 = new Triangle(x[1] + dx[i], y[1] + dy[i], x[2], y[2], x[3], y[3]);\n Triangle t2 = new Triangle(x[1], y[1], x[2] + dx[i], y[2] + dy[i], x[3], y[3]);\n Triangle t3 = new Triangle(x[1], y[1], x[2], y[2], x[3] + dx[i], y[3] + dy[i]);\n if (t1.IsRight() || t2.IsRight() || t3.IsRight())\n return true;\n }\n return false;\n\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d3b097dd93854013513b529962f573e2", "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 ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w1, h1, w2, h2, result;\n string []s;\n do\n { \n s = Console.ReadLine().Split(' ');\n w1 = int.Parse(s[0]);\n h1 = int.Parse(s[1]);\n w2 = int.Parse(s[2]);\n h2 = int.Parse(s[3]);\n } while (w1= t - ax + 1)\n {\n if (startX == x && startY == y)\n {\n output = ans;\n break;\n }\n startX--;\n }\n startX++;\n startY--;\n }\n else if (type == 3)\n {\n t = startY;\n while (startY >= t - ay + 1)\n {\n if (startX == x && startY == y)\n {\n output = ans;\n break;\n }\n startY--;\n }\n startY++;\n startX++;\n ax++;\n ay++;\n }\n type = (type + 1) % 4;\n ans++;\n }\n Console.WriteLine(output);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cc5cf0166bc0e201538701368c47db68", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0} {"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 return 0;\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": "2648b7de92a85e90480cb3304fe914a9", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0} {"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 input = Console.ReadLine().Split(\" \").Select((s) => int.Parse(s)).ToList();\n var n = input[0];\n var t = input[1];\n\n var queue = Console.ReadLine().ToArray();\n\n while (t-- > 0)\n {\n for (int i = 0; i < queue.Count() - 1; i++)\n {\n var isBoy = queue[i] == 'B';\n var isNextBoy = queue[i + 1] == 'B';\n\n if (isBoy && !isNextBoy)\n {\n queue[i] = 'G';\n queue[i + 1] = 'B';\n i++; \n }\n }\n }\n Console.WriteLine(new string(queue));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6a8342d675da13e0e9292a9da6606f40", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass test{\n public static void Main(string[] temp){\n int[] NK=Array.ConvertAll(Console.ReadLine().Split(' '),Int32.Parse);\n StringBuilder queue=new StringBuilder(Console.ReadLine());\n for(int i=0;i 0; 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": "3dbbc89277da089dc9aac676dff03bca", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Linq;\nusing Xunit.Abstractions;\n\nnamespace CodeForce\n{\n internal class Quserty\n {\n private static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var inps = input.Split(' ');\n var length = int.Parse(inps.First());\n var diameter = int.Parse(inps[1]);\n\n input = Console.ReadLine();\n var array = input.Split(' ').Select(int.Parse).OrderBy(it => it).ToArray();\n var max = array[array.Length - 1];\n\n var isInSet = new int[max + 1];\n for (var i = 0; i < array.Length; i++)\n {\n var el = array[i];\n isInSet[el] += 1;\n }\n\n for (var i = 1; i < isInSet.Length; i++)\n {\n isInSet[i] = isInSet[i - 1] + isInSet[i];\n }\n\n\n var result = int.MaxValue;\n\n for (var i = 0;; i++)\n {\n var leftElement = array[i];\n var rightElement = leftElement + diameter;\n if (rightElement > max)\n {\n rightElement = max;\n }\n\n var diff = isInSet[rightElement] - isInSet[leftElement - 1];\n var newResult = array.Length - diff;\n result = Math.Min(result, newResult);\n\n if (rightElement == max)\n {\n break;\n }\n }\n\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "146ca3a2564b0a2a2c6eb51a996de6c2", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "difficulty": 1200.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\t\t\t{\n\t\t\t\t++n;\n\t\t\t}\n\t\t \n\t\tif ( n == 2)\n\t\t{\n\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t \n\t\t}\n\t\t\telse\n\t\t\tConsole.WriteLine(\"NO\");\t\n\t\t \n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8f663d081e26d74ca748ceab887befb3", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing Mono.Math;\nusing System.IO;\n \nnamespace acm{\n class Program{\n#if DEBUG\n static bool file = true;\n static TextReader fin = new StreamReader(\"input.txt\");\n static TextWriter fout = new StreamWriter(\"output.txt\");\n static void open(bool f) { if (f) { Console.SetIn(fin); Console.SetOut(fout); } }\n static void close(bool f) { if (f) fout.Close(); }\n#endif\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.WriteLine(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n \n static void Main(string[] args) {\n#if DEBUG\n open(file);\n#endif\n \t\t\tBigInteger test=12379187;\n\t\t\tstring n1=Console.ReadLine(), n2=Console.ReadLine();\n\t\t\tint[] digits=new int[n1.Length];\n\t\t\t\n\t\t\tfor(int i=0; i(ref T a, ref T b)\n {\n T c = a;\n a = b;\n b = c;\n }\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n bool flag = false;\n foreach (char i in str)\n {\n if ((i == 'H') | (i == 'Q') | (i == '9'))\n {\n Console.WriteLine(\"YES\");\n flag = !flag;\n break;\n }\n }\n if (!flag)\n {\n Console.WriteLine(\"NO\");\n \n }\n }\n //System.Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7b75095ceec932985b1efe3e9b1ec4f3", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n char[] dt = {'H', 'Q', 9' };\n for (int i = 0; i < 3; ++i)\n if (input.IndexOf(dt[i]) >= 0) { dt[0] = 's'; break; }\n Console.WriteLine(dt[0] == 's' ?\"YES\":\"NO\");\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "00ad317febcc92a8818c37f95c623387", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace Application\n{\n class Program\n {\n static void Main(string[] args)\n {\n CConsole.WriteLine(Console.ReadLine().Where(c => \"HQ9\".Contains(c)).Count() == 0 ? \"NO\" : \"YES\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2ab59f972b4b815776dce9e22989208c", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n string q = Console.ReadLine();\n if (q.Contains(\"H\")|| q.Contains(\"Q\") || q.Contains(\"9\") )\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5d22be0861aadb4e837517aa919791c5", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\npublic class HQ9\n{\n public HQ9()\n {\n int i = 0;\n bool output = false;\n string x = Console.ReadLine().Trim();\n for (i = 0; i < x.Length; i++)\n {\n if (x[i] == 'H' || x[i] == 'Q' || x[i] == '9')\n {\n output = true;\n break;\n }\n }\n Console.WriteLine(output ? \"YES\" : \"NO\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5e4646c2de64aa9058ac24b97e0d5fd2", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "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 Codeforces\n{\n class _268B\n {\n public static void Main_268()\n {\n int n = int.Parse(Console.ReadLine());\n int s = n;\n for (int i = 1; i < n; i++)\n {\n s = s + i * (n - i);\n }\n Console.WriteLine(s);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "399bc90f7069ab8b875905ebc8ff4390", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "#include \n#include \n\nusing std::cout;\nusing std::endl;\nusing std::cin;\n\nint main()\n{\n int n, k = 1, answer;\n cin >> n;\n answer = n;\n n--;\n while (n>0)\n {\n answer+=n*k;\n k++;\n n--;\n }\n cout << answer << endl;\n return 0;\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "21d89b26ece1f7d67bb5b84a0c719b35", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.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 return res;\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": "a3afb8ba7124847958b1fd0cce1fc1b8", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\n\nclass Program{\n static void Main(){\n System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if !ONLINE_JUDGE\n StreamWriter fout;\n Console.SetIn(new StreamReader(\"input.txt\"));\n Console.SetOut(fout=new StreamWriter(\"output.txt\"));\n#endif\n int n = readInt();\n int count = 0;\n HashSet divs = new HashSet();\n\n for (int i = 2; i <= n; i++)\n {\n int k = 2, j = i;\n while (true) {\n if (j % k == 0)\n {\n divs.Add(k);\n j /= k;\n } else k++;\n\n if (j == 1) break;\n }\n\n if (divs.Count == 2) count++;\n divs.Clear();\n }\n\n print(count);\n \n\n\n\n\n \n#if !ONLINE_JUDGE\n fout.Close();\n#endif\n }\n\n struct quat { public T1 fst; public T2 snd; public T3 thr; public T4 frt; }\n struct trip { public T1 fst; public T2 snd; public T3 thr; }\n struct pair { public T1 fst; public T2 snd; }\n static long LCM(long a, long b) { return a / GCD(a, b) * b; }\n static long GCD(long a, long b) { if (b == 0) return a; else return GCD(b, a % b); }\n static void swap(ref T a, ref T b) { T tmp = a; a = b; b = tmp; }\n static double dist(double x1, double y1, double x2, double y2) { return Math.Sqrt(Math.Pow(x1-x2, 2)+Math.Pow(y1-y2, 2)); }\n static void fill(T[] d, T v) { for (int i = 0; i < d.Length; i++) d[i] = v; }\n static void fill(T[,] d, T v) { for (int i = 0; i < d.GetLength(0); i++) { for (int j = 0; j < d.GetLength(1); j++) { d[i, j] = v; } } }\n\n static void print(double v) { Console.Write(v); }\n static void print(long v) { Console.Write(v); }\n static void print(int v) { Console.Write(v); }\n static void print(string v) { Console.Write(v); }\n static void print(char v) { Console.Write(v); }\n static void print(BigInteger v) { Console.Write(v); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n\n static void println(double v) { Console.WriteLine(v); }\n static void println(long v) { Console.WriteLine(v); }\n static void println(int v) { Console.WriteLine(v); }\n static void println(string v) { Console.WriteLine(v); }\n static void println(char v) { Console.WriteLine(v); }\n static void println(BigInteger v) { Console.WriteLine(v); }\n static void println() { Console.WriteLine(); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n\n static string RL() { return Console.ReadLine(); }\n static int[] readValsI(int n) { int[] t = new int[n]; for (int i = 0; i < n; i++) t[i] = readInt(); return t; }\n static double[] readValsD(int n) { double[] t = new double[n]; for (int i = 0; i < n; i++) t[i] = readDouble(); return t; }\n\n static BigInteger readBigInt()\n {\n BigInteger val = 0;\n bool m = false;\n int c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-') { }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m=true : m=false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9) val = val*10 + (m?-c:c);\n return val;\n }\n\n static double readDouble() {\n bool m = false;\n double val = 0;\n int c = 0, r = 1;\n while(((c=Console.Read())<'0' || c>'9') && c!='-') {}\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m=true : m=false) ? 0 : 0;\n while ((c = Console.Read()) >= '0' && c <= '9') val = val * 10 + (m?-(c-48):(c-48));\n if(c=='.') while ((c = Console.Read()) >= '0' && c <= '9'){ val += ((double)(c-48))/(r*=10); }\n\n return val;\n }\n\n static long readLong()\n {\n long val = 0;\n bool m = false;\n int c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-') { }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m=true : m=false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9) val = val*10 + (m?-c:c);\n return val;\n }\n\n static int readInt()\n {\n bool m = false;\n int val = 0, c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-') { }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m=true : m=false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9) val = val*10 + (m?-c:c);\n return val;\n }\n\n static string readLine() {\n string s = \"\";\n int c;\n while((c=Console.Read())!=10 && c!=-1) s+=(char)c;\n return s;\n }\n\n static string readString() {\n string s = \"\";\n int c;\n while ((c = Console.Read()) != 10 && c != 32 && c != -1) s += (char)c;\n return s;\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ed4e8b0d16a84c550f69cbc93a428e79", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "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.27428.2015\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Cakeminator\", \"Cakeminator\\Cakeminator.csproj\", \"{69B40C6B-8B15-4893-BC10-C83C32D163CE}\"\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{69B40C6B-8B15-4893-BC10-C83C32D163CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{69B40C6B-8B15-4893-BC10-C83C32D163CE}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{69B40C6B-8B15-4893-BC10-C83C32D163CE}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{69B40C6B-8B15-4893-BC10-C83C32D163CE}.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 = {145B729C-3B15-4625-9DF8-9D75548722C1}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "84d50f02cd1edb5fc03db5dcac3b2301", "src_uid": "ebaf7d89c623d006a6f1ffd025892102", "difficulty": 800.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\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n\n int curNS = 0;\n int curEV = 0;\n\n bool bOK = true;\n\n while(n>0)\n {\n var dist = ioHelper.ReadNextInt();\n var dir = ioHelper.ReadNextToken();\n\n if(dir==\"North\")\n {\n if (curNS == 0)\n curNS = -1;\n else\n curNS -= dist;\n if(curNS<0)\n {\n bOK = false;\n break;\n }\n }\n else if (dir==\"South\")\n {\n if (curNS == 20000)\n curNS++;\n else\n curNS += dist;\n if(curNS>20000)\n {\n bOK = false;\n break;\n }\n }\n else\n {\n if (curNS == 0 || curNS == 20000)\n { bOK = false; break; }\n n--;\n }\n\n if (curNS != 0)\n bOK = false;\n\n if (bOK)\n ioHelper.WriteLine(\"YES\");\n else\n ioHelper.WriteLine(\"NO\");\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ce00d4fe24e640200a6731346fb8628e", "src_uid": "11ac96a9daa97ae1900f123be921e517", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n{\n static void Main()\n {\n Func r = () => Console.ReadLine();\n string a = r(), s = r();\n Console.WriteLine(s.Contains(a[0]) | s.Contains(a[1]) ? \"YES\" : \"NO\");\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a8fb05cdab663929cfa8177e56099092", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0} {"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 Console.ReadLine();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "09fe135e44d7d4c4463f89ca0caf2a88", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {A1D172DB-AD28-42C7-9ECB-5588BF7545D2}\n Exe\n Properties\n _606_A\n _606_A\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": "c31508a81e2229c607c59d1a6c8739ae", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "class Program\n{\n static void Main(string[] args) \n { \n int mins2 = 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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cdf80a919fc8a04a53a28582c23d5762", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "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\t\tString p=Console.ReadLine();\n\t\tString[] digits=p.Split(' ');\n\t\tint a=int.Parse( digits[0]) ;\n\t\tint b=int.Parse( digits[1]) ;\n\t\tif(a > 9 || a<0 || b>9 || b<0 )\n\t\t{\n\t\tConsole.Write(-1);\n\t\t}\n\t\telse if( a==b)\n\t\t{\n\t\tConsole.WriteLine(digits[0] + '0'+'0');\n\t\tConsole.WriteLine(digits[1] + '0'+'1');\n\t\t}\n\t\telse if( b-a==1)\n\t\t{\n\t\tConsole.WriteLine(digits[0] + '9'+'9');\n\t\tConsole.WriteLine(digits[1] + '0'+'0');\n\t\t}\n\t\telse if( a==9 && b==1)\n\t\t{Console.WriteLine(9));\n\t\tConsole.WriteLine(10);}\n\t\telse\n\t\t\tConsole.Write(-1);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f3108716d3d0d193f268668d60ca1977", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"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 BinSea(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 : BinSea(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": "e689ad551ad91950b2a26040094f3b2e", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "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 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 double ab = findapowerb(a, b);\n double ba = findapowerb(b, a);\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 (b) * (Math.Log(a) );\n\n }\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "025585e283c7831fcce3152a447c92e9", "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 double ab = findapowerb(a, b);\n double ba = findapowerb(b, a);\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 \n \n public static int findapowerb(int a, int b)\n { \n \n return (b) * (Math.Log(a) );\n\n }\n}\n}\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2d08aabc532f5ab60af54722b4f6810a", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "#include \n#include \nusing namespace std;\nint n,k;\nint a[100];\nint main()\n{\n scanf(\"%d%d\",&n,&k);\n for(int i=0;i\nusing namespace std;\n\nint main(){\n int n,k,a[105];\n cin>>n>>k;\n for(int i = 0; i < n; i++) {\n cin >> a[i];\n }\n\n int left = 0, right = 0;\n int i = 0;\n while (i < n && a[i] <= k) {\n left++; i++;\n } i = n - 1;\n while (i > 0 && a[i] <= k) {\n right++; i--;\n }\n cout << min(left + right, n);\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "30fade6fd1ae5967f096e74fccf77f62", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[][] matrix = new int[3][];\n int[] s = new int[3];\n\n for (int i = 0; i < 3; i++)\n {\n matrix[i] = new int[3];\n s[i] = 0;\n\n string[] lineParts = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < 3; j++)\n {\n matrix[i][j] = int.Parse(lineParts[j]);\n s[i] += matrix[i][j];\n }\n }\n\n int max = Math.Max(s[0], Math.Max(s[1], s[2]));\n\n matrix[0][0] = max - matrix[0][1] - matrix[0][2] + 1;\n matrix[1][1] = max - matrix[1][0] - matrix[1][2] + 1;\n matrix[2][2] = max - matrix[2][0] - matrix[2][1] + 1;\n\n for (int i = 0; i < 3; i++)\n {\n Console.WriteLine(String.Join(\" \", matrix[i]));\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "29c746f55fab743f44852e4f2f7da3f4", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "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}\") = \"codeforces 124 d2 qA\", \"codeforces 124 d2 qA\\codeforces 124 d2 qA.csproj\", \"{B5C5AB1F-F537-4305-AD88-591CBFC08780}\"\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{B5C5AB1F-F537-4305-AD88-591CBFC08780}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{B5C5AB1F-F537-4305-AD88-591CBFC08780}.Debug|x86.Build.0 = Debug|x86\n\t\t{B5C5AB1F-F537-4305-AD88-591CBFC08780}.Release|x86.ActiveCfg = Release|x86\n\t\t{B5C5AB1F-F537-4305-AD88-591CBFC08780}.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": "c201ec4540ebc23f45d411f75117193a", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "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 ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var from = Console.ReadLine().ToCharArray();\n var to = Console.ReadLine().ToCharArray();\n var clonef = ((char[])from.Clone()).ToList();\n\n if (from.Length == to.Length && to.All(p=>{\n var contains = clonef.Contains(p);\n clonef.Remove(p);\n return contains;\n }))//array\n {\n Console.WriteLine(\"array\");\n }\n else\n {\n if (to.All(p =>\n {\n var contains = clonef.Contains(p);\n clonef.Remove(p);\n return contains;\n }))\n {\n var i = 0;\n var j = 0;\n clonef = from.Clone();\n while (i < to.Length && j < clonef.Count)\n {\n if (clonef[j] == to[i])\n {\n i++;\n clonef.RemoveAt(j);\n\n }\n else\n {\n j++;\n }\n }\n \n if (i == to.Length)\n {\n Console.WriteLine(\"automaton\");\n }\n else\n {\n \n Console.WriteLine(\"both\");\n }\n }\n else\n {\n Console.WriteLine(\"need tree\");\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f94552bd85445258cc385911ee5397c6", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing Common;\nusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R342.C\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, long answer)\n {\n tw.WriteLine(answer);\n }\n\n private static long Parse(TextReader tr)\n {\n var a = tr.ReadLine().Split().Select(x => long.Parse(x)).ToArray();\n return Calc(a[0], a[1]);\n }\n\n private static long Calc(long r, long h)\n {\n var n = h / r * 2;\n\n var s = h % r;\n\n if (s * 2 < r)\n ++n;\n else if (s * 2 >= r)\n n += 2;\n else if (s * 2 * 2 * s >= r * r * 3)\n n += 3;\n\n return n;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "99ffc8a4e8d97839bbe0da48f878edd8", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "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 ConsoleApp21\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int l = Convert.ToInt32(Console.ReadLine());\n int pow = k;\n int count = 0;\n\n if (l != a && l % a == 0)\n {\n do\n {\n l /= a;\n if (l % a == 0)\n \n count++;\n \n else\n {\n count = 0;\n break;\n }\n\n }\n while (l > a);\n \n if (count > 0)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(count);\n }\n else Console.WriteLine(\"NO\");\n \n }\n\n else if (l == a)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(count);\n }\n else Console.WriteLine(\"NO\");\n Console.ReadKey();\n \n }\n\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "01999db088dfed4f5a82ca5cbb4cad82", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "string s = Console.ReadLine();\n string[] array = s.Split(' ');\n int[] numbers = new int[3];\n for (int i = 0; i < array.Length; i++)\n numbers[i] = int.Parse(array[i]);\n bool flag = false;\n\n for (int i = 0; i < (int) (numbers[2]/numbers[0]); i++)\n {\n for (int j = 0; j < (int) (numbers[2]/numbers[0]); j++)\n {\n if (numbers[0]*i + numbers[1]*j == numbers[2])\n {\n flag = true;\n break;\n }\n }\n }\n Console.WriteLine(flag ? \"Yes\" : \"No\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7de955c90e1430d57d1ba5846c95a5ae", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var maxVolume = 0;\n var charCount = Console.ReadLine();\n var sentance = Console.ReadLine();\n var words = sentance.Split(' ');\n\n foreach (var word in words)\n {\n var capsCount = word.Where(c => c.ToString() == c.ToString().ToUpper()).Count();\n\n if (capsCount > maxVolume)\n {\n maxVolume = capsCount;\n }\n }\n Console.WriteLine(maxVolume);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c1c82481ca8f4fb40eab298337f64f61", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(long.MaxValue);\n var a = Console.ReadLine().Split(' ');\n long n = long.Parse(a[0]);\n long k = long.Parse(a[1]);\n var b = Number(n, k);\n Console.WriteLine(b);\n Console.ReadKey();\n }\n public static long Number(long n, long k)\n {\n if (k <= (n + 1) / 2)\n {\n return k * 2 - 1;\n }\n else\n {\n return (k - (n + 1) / 2) * 2;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8a00b807637e04c0b6be7baead7d0e4f", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\n \nusing System;\nclass Sample\n{\n public static void Main()\n {\n String[] ip=Console.ReadLine().Split(' ');\n long n=Long.Parse(ip[0]);\n long k=Long.Parse(ip[1]);\n long 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 \n \n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "922930f04a322d0d2bdaeb3a8ec0effe", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.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}\") = \"Logic_Gates\", \"Logic_Gates\\Logic_Gates.csproj\", \"{193BA58A-1139-442C-9195-521827C9894B}\"\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{193BA58A-1139-442C-9195-521827C9894B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{193BA58A-1139-442C-9195-521827C9894B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{193BA58A-1139-442C-9195-521827C9894B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{193BA58A-1139-442C-9195-521827C9894B}.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": "19f8e9044eba768cb244435b682d48fd", "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 (Int32 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]-1]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7adb8eaba8df5d0a064e6c2c18d1fa29", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var n = long.Parse(input[0]);\n var k = long.Parse(input[1]);\n if (k <= (n + 1) >> 1)\n Console.WriteLine(k * 2 - 1);\n else\n Console.WriteLine((k - ((n + 1) >> 1)) * 2);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2852b84ac5fd1b5cc8447fea9d2a9710", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.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\nclass Program\n{\n\tprivate static void SolveC()\n {\n var n = RI();\n //var m = RIA(n);\n long ans = 0;\n for (int i = 0; i < n; i++)\n {\n\n }\n\n Console.WriteLine(ans);\n }\n\n private static void SolveB()\n {\n Console.ReadLine();\n var s = Console.ReadLine();\n int count = 0;\n int mAX = 0;\n\n while (s.Contains('('))\n {\n int p1 = s.IndexOf('(');\n int p2 = s.IndexOf(')');\n\n string ss = s.Substring(p1 + 1, p2 - p1 - 1);\n count += (ss.Split('_').Where(qwe => qwe.Length > 0).Count());\n\n s = s.Remove(p1, p2 - p1 + 1).Insert(p1, \"_\");\n }\n\n var words = s.Split('_').Where(qwe => qwe.Length > 0).ToArray();\n if (words.Length > 0)\n mAX = words.Max(ww => ww.Length);\n\n Console.WriteLine(mAX + \" \" + count);\n }\n\tstatic void Main(string[] args)\n {\n \n SolveB();\n //SolveC();\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4440926c385328740bcc3ba7a296b69b", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "double c1 = convert.todouble(Console.ReadLine());", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e757890a6379647ab6d3ae0292eeb4be", "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;\nusing System.Data;\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int l = s.Length;\n int res = 0;\n int c1 = 0, c2 = 0;\n c1 = Math.Abs('z'-s[0])+1;\n c2 = Math.Abs('a'-s[0]);\n if (c1 < c2)\n res += c1;\n else\n res += c2;\n for (int i = 1; i < l;i++ )\n {\n c1 = Math.Abs(s[i-1]-s[i]);\n c2 = Math.Abs('z' - Math.Max(s[i - 1], s[i])) + Math.Abs('a' - Math.Min(s[i - 1], s[i])) + 1;\n if (c1 < c2)\n res += c1;\n else\n res += c2;\n }\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dbf8224591a70ca210d535d2a0c646ae", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int Sum = 0;\n char p = 'a';\n int CS, AS;\n for (int i = 0; i < input.Length; i++)\n {\n if (p <= input[i])\n {\n AS = 'z' - input[i] + 1 + p - 'a';\n CS = input[i] - p;\n }\n else\n {\n AS = 'z' - p + 1 + input[i] - 'a';\n CS = p - input[i];\n }\n if (AS > CS) Sum += CS; else Sum += AS;\n p = input[i];\n }\n Console.WriteLine(Sum);\n Console.ReadKey();\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ae7d5c35eed23a795e70f8c9fca5ca1f", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.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 cconst int MOD = 1000000007;\n int n = int.Parse(Console.ReadLine());\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));\n C = new long[200, 200];\n C[0, 0] = 1;\n for (int i = 1; i < 200; i++) {\n C[i, 0] = C[i, i] = 1;\n for (int j = 1; j <= i; j++)\n C[i, j] = (C[i - 1, j] + C[i - 1, j - 1]) % MOD;\n }\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[,] C;\n static long CNK(long n, long k) {\n if (k > n || k < 0) return 0;\n if (k == n || k == 0) return 1;\n return C[n, k];\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a04dcf091e7c5bcbede0e489d830569e", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main()\n {\n var data = Console.ReadLine();\n var maxValueOfElement = double.Parse(data.Split(\" \")[0]);\n var desiredSum = double.Parse(data.Split(\" \")[1]);\n var result = Math.Ceiling(desiredSum / maxValueOfElement);\n Console.WriteLine(result);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bd15d1c3a10c8501f87ef31f861afe60", "src_uid": "04c067326ec897091c3dbcf4d134df96", "difficulty": 800.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 int N;\n String[] Row={\"\",\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\"};\n N=Console.Read();\n N = N - 48;\n while (N>5)\n {\n N = N / 2;\n N = N - 2;\n }\n Console.Write(Row[N]);\n\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "265d9387444949a14e171a584977052f", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\n class soublecola\n {\n static void Main()\n {\n double n = double.Parse(Console.ReadLine());\n double i = 0.0;\n double j = 0.0;\n double sum = 0.0;\n while ( n > 0 )\n {\n sum = 5*Math.Pow(2,j);\n\t i = Math.Pow(2,j);\n\t j++;\n if ( sum > n)\n {\n break;\n }\n else\n n -= sum;\n }\n \n if ( n/i > 0 && n/i <= 1 )\n Console.WriteLine(\"Sheldon\");\n else if ( n/i > 1 && n/i <= 2)\n Console.WriteLine(\"Leonard\");\n else if ( n/i > 2 && n/i <= 3)\n Console.WriteLine(\"Penny\");\n else if ( n/i > 3 && n/i <= 4)\n Console.WriteLine(\"Rajesh\");\n else if ( n/i > 4 && n/i <= 5)\n Console.WriteLine(\"Howard\");\n\t }\n\t \t\n }\n }\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2f7e7d43f17b0e394a81d57d7b79f369", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "source_code": " class main\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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f21a8562f823eef05b2eeb2e77231112", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System.Linq;\n\npublic static class Program {\n public static void Main() {\n var n = long.Parse(Console.ReadLine()) - 1;\n var curSize = 5L;\n var curOffset = 0L;\n\n while (n >= curSize) {\n n -= curSize;\n curSize *= 2;\n }\n\n curSize = curSize / 5;\n var arr = new [] {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n Console.WriteLine(arr[n / curSize]);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a687ae23fb5d87891c45db8eb566281b", "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\n string[] friends = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\",\"Howard\" };\n int num = Convert.ToInt32(Console.ReadLine());\n int beflen = friends.Length;\n if (num > friends.Length)\n {\n Array.Resize(ref friends, num);\n\n for (int i = 0; i < num; i++)\n {\n string tmp = friends[0];\n for (int j = 0; j < friends.Length - 1; j++)\n {\n friends[j] = friends[j + 1];\n }\n if (beflen != num)\n beflen++;\n friends[beflen - 1] = tmp;\n friends[beflen - 2] = tmp;\n\n }\n Console.WriteLine(friends[friends.Length - 1]);\n }\n else\n Console.WriteLine(friends[num - 1]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dbe2cbbe9b4cb0dcc68233c5eb3acc0e", "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 main\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": "475b7300d707c625a347c54244f87674", "src_uid": "023b169765e81d896cdc1184e5a82b22", "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\n\nnamespace DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 input = Convert.ToInt64(Console.ReadLine());\n string[] people = new string[5] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n while(input > 5){\n input = (n-4)/2;\n }\n Console.WriteLine(people[input - 1]);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3b0c758e73854a41972e0a8a0df81e36", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "#include \n#include \n#include \nusing namespace std;\nbool IsPrime(int num)\n{\n if (num==2)\n return true;\n if (num<2 || num%2==0)\n return false;\n\n int limit=sqrt(num);\n for (int i=3; i<=limit; i+=2)\n if (num%i==0)\n return false;\n\n return true;\n\n}\nint main()\n{\n int n,k;\n cin>>n>>k;\n vectorprimes;\n for (int i=2; i<=n; i++)\n if(IsPrime(i))\n primes.push_back(i);\n\n\n int counter=0;\n for (int i=0; in ||counter>k)\n break;\n }\n\n if(counter>=k)\n cout<<\"YES\";\n else\n cout<<\"NO\";\n\n\n return 0;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9fd77820d443d4000eca5e8f357616a6", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.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}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5fa7fa1eae60fb20f49f14175f5c55e4", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using Systetm;\nusing System.Linq;\n\nclass Program\n{\npublic static string GetAnswer(int[] digits1, int[] digits2)\n{\n Array.Sort(digits1);\n Array.Sort(digits2);\n \n var comp = digits1[0].CompareTo(digits2[0]);\n if(comp == 0)\n return \"NO\"\n for(int i = 1; i < digits1.Length; i++) {\n var c = digits1[i].CompareTo(digits2[i]) * comp; \n if(c <= 0) {\n return \"NO\";\n }\n } \n \n return \"YES\";\n}\n\npublic static void Main()\n{\n var n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine();\n var digits1 = s.Substring(0,n).ToCharArray().Select((c) => int.Parse(c.ToString())).ToArray(); \n var digits2 = s.Substring(n,n).ToCharArray().Select((c) => int.Parse(c.ToString())).ToArray();\n \n Console.WriteLine(GetAnswer(digits1, digits2));\n}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a8ade4c92b0356769431ffd96b1b7e69", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "namespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n byte[] A1 = new byte[25];\n byte[] A2 = new byte[25];\n byte[] A3 = new byte[25];\n bool f=true;\n string s = Console.ReadLine();\n for (int i = 0; i < s.Length; i++)\n {\n int n = (int)s[i] - (int)'A';\n A1[Convert.ToByte(n)]++; \n }\n s = Console.ReadLine();\n for (int i = 0; i < s.Length; i++)\n {\n int n = (int)s[i] - (int)'A';\n A2[Convert.ToByte(n)]++;\n }\n s = Console.ReadLine();\n for (int i = 0; i < s.Length; i++)\n {\n int n = (int)s[i] - (int)'A';\n A3[Convert.ToByte(n)]++;\n }\n for (int i = 0; i < 25; i++)\n {\n if (A1[i] + A2[i] != A3[i])\n {\n Console.WriteLine(\"NO\");\n f=false;\n break;\n }\n }\n if (f)\n Console.WriteLine(\"YES\");\n Console.ReadLine();\n } \n }\n \n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f59213c5dc44a56cd38926227d20d7ae", "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 s = Console.ReadLine();\n string s0 = Console.ReadLine();\n string s1 = s + s0;\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 \n {\n Console.WriteLine(\"NO\"); \n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "85be1efeb5965cf2f2799c5ef5967885", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"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)(Sum(nums,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\tpublic static short Sum(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\tpublic static class M\n\t{\n\t\tpublic static short 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\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ff979d6e540e32e4fe32b0c89d4429b2", "src_uid": "6e5011801ceff9d76e33e0908b695132", "difficulty": 800.0} {"lang": "MS C#", "source_code": "https://www.youtube.com/watch?v=yNXwBszZyQQ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d341419cc16593df94c44112c9f1edaf", "src_uid": "6e5011801ceff9d76e33e0908b695132", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "System.Console.WriteLine(\"no\");", "lang_cluster": "C#", "compilation_error": true, "code_uid": "13b247929a3742495d93f8a58921b8a9", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "MS C#", "source_code": "using System;\n class Main\n {\n static void Main()\n {\n int hojas;\n int[] diasSemana = new int[7];\n hojas = int.Parse(Console.ReadLine());\n for(int i =0; i<7; i++)\n diasSemana[i] = int.Parse(Console.ReadLine());\n int dia=0;\n while(hojas>0)\n {\n hojas-=diasSemana[dia];\n if(hojas<=0)\n {\n Console.WriteLine(dia+1);\n break;\n }\n if(dia==6 )\n {\n dia=0;\n continue;\n }\n dia++;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f73cf539f20639582cdd6133b41573df", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.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": true, "code_uid": "e8bce7d86c4a8d5768a353c643668afa", "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 checkForSplit\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string str2 = Console.ReadLine();\n for (int i = 0; i < str1.Length; i++)\n {\n if (str1[i] == str2[i]) Console.Write(0);\n else Console.Write(1);\n \n }\n\n }\n Console.WriteLine();\n \n }\n \n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "17b18fcece80ffd591eb818a77519241", "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 pair1=Console.ReadLine().Split(' ').ToList.ConvertAll(s=>Convert.ToInt32(s));\n List pair2=Console.ReadLine().Split(' ').ToList.ConvertAll(s=>Convert.ToInt32(s));\n \n for(int i=0;i0)\n {\n Console.WriteLine(2);\n for(int i=0;i ad)\n {\n up = bc - ad;\n down = bc;\n }\n else\n {\n up = ad - bc;\n down = ad;\n }\n for(int i = 2; i <= down; i++)\n {\n if(up%i==0 && down % i == 0)\n {\n up /= i;\n down /= i;\n }\n }\n if (up == 0) { down = 1; }\n Console.WriteLine(\"{0}/{1}\",up,down);\n }\n \n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e55e69758c9d0fb2d820fdd77e2fd30b", "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 for(int i = 2; i <= down; i++)\n {\n if(up%i==0 && down % i == 0)\n {\n up /= i;\n down /= i;\n }\n }\n if (up == 0) { down = 1; }\n Console.WriteLine(\"{0}/{1}\",up,down);\n \n }\n \n \n \n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1431e2cc23d3547c04919418770ced08", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.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().Split(\" \", StringSplitOptions.None);\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": "a66230f541078d7eb1bac1d608552203", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800.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 {\n for (int i = 0; i < n; i++)\n {\n //if (Math.Abs(x[i] - y[i]) % 2 == 0 && (x[i] % 2 == 0 || y[i] % 2 == 0))\n //{\n // Console.Write(\"1\");\n // return;\n //}\n //else\n //{\n Console.Write(\"-1\");\n return;\n //}\n }\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&&(x[i]%2==0||y[i]%2==0))\n //{\n // Console.Write(\"1\");\n // return;\n //}\n //else\n {\n Console.Write(\"-1\");\n return;\n //}\n }\n }\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", "lang_cluster": "C#", "compilation_error": true, "code_uid": "27e455b7cf36a18a175f80c059e05175", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "// ac 1970 \u043c\u0441\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\n static void re() { Environment.Exit(55); }\n\n static void Swap(ref T a, ref T b)\n {\n T t = a; a = b; b = t;\n }\n\n #endregion Helpers\n\n static StringBuilder sb = new StringBuilder();\n static Random rand = new Random(5);\n\n static IEnumerable W(int p)\n {\n int b = MyStructs.BitTools.HighBit(p);\n for (int i = 0; i < b + 1; i++)\n {\n yield return p;\n p = p / 2 + ((p & 1) << b);\n }\n\n }\n\n static void Main(string[] args)\n {\n //sar_cs_structs.FenwickTree.Test(); return;\n //Console.SetIn(File.OpenText(\"_input\"));\n var parser = new Parser();\n while (!parser.SeekEOF)\n {\n long n = parser.ReadInt();\n long x = parser.ReadInt();\n long minp = parser.ReadInt();\n\n long res = 0;\n while (100 * (x + res) < n * minp)\n res++;\n \n Console.WriteLine(res);\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f7613a0048d98fe43f72155f5535776b", "src_uid": "7038d7b31e1900588da8b61b325e4299", "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 CutRibbonBottomUp\n {\n public static void Main()\n {\n var input = Console.ReadLine().Split(' ');\n var nums = new List();\n var n = int.Parse(input[0]);\n nums.Add(int.Parse(input[1]));\n nums.Add(int.Parse(input[2]));\n nums.Add(int.Parse(input[3]));\n\n nums.Sort();\n\n Console.WriteLine(recurse(n, 0, 0, nums));\n }\n\n public static int recurse(int r, int l, int s, List nums)\n {\n int max = 0;\n\n for (int i = 0; i < 3; ++i) \n {\n if (l + nums[i] < r)\n {\n max = Math.Max(max, recurse(r, l + nums[i], s + 1, nums));\n }\n \n if (l + nums[\n return Math.Max(max, s + 1);\n }\n }\n\n return max;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7196b4bde8d3d59cdf1dcd8af5d7c3c5", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.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, s;\n int tempsum;\n \n int diff;\n int[] marks = new int[n];\n int i;\n for (i = 0; i < n; i++)\n marks[i] = 2;\n int cnt;\n \n while (true)\n {\n tempsum = marks.Sum();\n diff = s - tempsum;\n if (diff == 0)\n break;\n\n if (diff > n)\n cnt = n;\n else\n cnt = diff;\n for (i = 0; i < diff; i++)\n marks[i] += 1;\n }\n\n cnt = marks.Where(item => item == 2).Count();\n System.Console.WriteLine(cnt.ToString());\n System.Console.ReadKey();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7c1e80d9cd2203aaf0ea5f0c908c9c47", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace Sharp\n{\n\n class Program {\n private static Reader cin;\n private static TextWriter cout;\n private static long MOD = 998244353;\n\n static long solve(int a, int b) {\n var f = new long[b + 1];\n f[b] = 1;\n for (int i = 0; i < a; ++i) {\n for (int j = 0; j < b; ++j) {\n f[j] = (f[j] + f[j + 1] * (j + 1)) % MOD;\n }\n }\n\n long ans = 0;\n for (int i = 0; i <= b; ++i) {\n ans = (ans + f[i]) % MOD;\n }\n\n return ans;\n }\n static void Main(string[] args) {\n cin = new Reader(Console.In);\n cout = Console.Out;\n cin.Read(out int a).Read(out int b).Read(out int c);\n long ans = 1;\n ans = (ans * solve(a, b)) % MOD;\n ans = (ans * solve(a, c)) % MOD;\n ans = (ans * solve(c, b)) % MOD;\n cout.WriteLine(ans);\n\n }\n }\n\n class Reader\n {\n TextReader TextRdr;\n\n String[] Buffer;\n int Id;\n public Reader(TextReader reader) {\n TextRdr = reader;\n Id = 0;\n }\n\n public String ReadLine() {\n return TextRdr.ReadLine();\n }\n\n public String Next() {\n if ((Buffer == null) || (Id == Buffer.Length)) {\n Buffer = ReadLine().Split();\n Id = 0;\n }\n return Buffer[Id++];\n }\n\n public Reader Read(out T what) {\n what = (T)Convert.ChangeType(Next(), typeof(T));\n return this;\n }\n\n public T Read() {\n return (T)Convert.ChangeType(Next(), typeof(T));\n }\n\n }\n\n class Pair\n {\n public Pair() {\n }\n\n public Pair(T1 first, T2 second) {\n this.First = first;\n this.Second = second;\n }\n\n public T1 First { get; set; }\n public T2 Second { get; set; }\n };\n\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bdd50a2ac68133596e3d1f2198980c71", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "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 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": "3ad6bcdc8d94b0c568874d6a9b7c9462", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n int n = int.Parse(s.Split(' ')[0]);\n int m = int.Parse(s.Split(' ')[1]);\n \n if (n == 0 and m!=0 )\n {\n Console.WriteLine(\"Impossible\");\n }\n else \n {\n int mx = 0;\n if (m == 0) { mx = n; } else { mx = n + m - 1; }\n if (m >= n)\n {\n Console.WriteLine(m.ToString()+\" \"+(mx).ToString());\n }\n else \n {\n Console.WriteLine(n.ToString() + \" \" + (mx).ToString());\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c851d0e5fb5a1bc4c4346c0d199da534", "src_uid": "1e865eda33afe09302bda9077d613763", "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}\") = \"A\", \"A\\A.csproj\", \"{374333D1-195C-49F9-A930-F802B256D179}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"B\", \"B\\B.csproj\", \"{19BDB93A-0B05-4481-B346-21EEEE73B927}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"C\", \"C\\C.csproj\", \"{462379A4-75FB-4BD4-AD71-6D009C9127E0}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"D\", \"D\\D.csproj\", \"{15516AF3-0BB0-479B-8688-80F7AC58ACCC}\"\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{374333D1-195C-49F9-A930-F802B256D179}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{374333D1-195C-49F9-A930-F802B256D179}.Debug|x86.Build.0 = Debug|x86\n\t\t{374333D1-195C-49F9-A930-F802B256D179}.Release|x86.ActiveCfg = Release|x86\n\t\t{374333D1-195C-49F9-A930-F802B256D179}.Release|x86.Build.0 = Release|x86\n\t\t{19BDB93A-0B05-4481-B346-21EEEE73B927}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{19BDB93A-0B05-4481-B346-21EEEE73B927}.Debug|x86.Build.0 = Debug|x86\n\t\t{19BDB93A-0B05-4481-B346-21EEEE73B927}.Release|x86.ActiveCfg = Release|x86\n\t\t{19BDB93A-0B05-4481-B346-21EEEE73B927}.Release|x86.Build.0 = Release|x86\n\t\t{462379A4-75FB-4BD4-AD71-6D009C9127E0}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{462379A4-75FB-4BD4-AD71-6D009C9127E0}.Debug|x86.Build.0 = Debug|x86\n\t\t{462379A4-75FB-4BD4-AD71-6D009C9127E0}.Release|x86.ActiveCfg = Release|x86\n\t\t{462379A4-75FB-4BD4-AD71-6D009C9127E0}.Release|x86.Build.0 = Release|x86\n\t\t{15516AF3-0BB0-479B-8688-80F7AC58ACCC}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{15516AF3-0BB0-479B-8688-80F7AC58ACCC}.Debug|x86.Build.0 = Debug|x86\n\t\t{15516AF3-0BB0-479B-8688-80F7AC58ACCC}.Release|x86.ActiveCfg = Release|x86\n\t\t{15516AF3-0BB0-479B-8688-80F7AC58ACCC}.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": "70be9428a06b8214d082697e2ba88028", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "difficulty": 1300.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 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\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": "6215bbb1dd3a3af45f206615c7156def", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Text;\n\nnamespace Codeforces_249_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] S = Console.ReadLine().Split(' ');\n long max = long.Parse(S[0]);\n SortedList ALL = new SortedList();\n List CUR = new List();\n ALL.Add(max, 0);\n CUR.Add(max);\n for (int k = int.Parse(S[1]); 0 < k; --k) {\n List NEW = new List();\n foreach (long L in CUR)\n for (long d = 1; d < L; d *= 10) {\n long c1 = L / d;\n long c2 = (c1 / 10) % 10;\n c1 %= 10;\n if (c2 < c1) {\n long T = L + d * 9 * (c1 - c2);\n if (!ALL.ContainsKey(T)) {\n ALL.Add(T, 0);\n NEW.Add(T);\n if (max < t) max = T;\n }\n }\n CUR = NEW;\n }\n Console.WriteLine(max);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "64e1cd9c8711d4760a0fb81cc5038b6f", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.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 }a\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2567adf0679bfc11530944ff147a0d0c", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.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(\" \")[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": "12c827548e29ec5326bd4482b64a14a4", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "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 ConvexShape\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int[,] lights = new int[3,3];\n int[,] lightsCumulative = new int[3, 3];\n for (int i = 0; i < 3; ++i)\n {\n string s = Console.ReadLine();\n string[] nums = s.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);\n for (int j = 0; j < 3; ++j )\n {\n lights[i, j] = int.Parse(nums[j]);\n }\n }\n\n for (int i = 0; i < 3; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n int l=0, r=0, t=0, b=0;\n l = (i - 1) >= 0 && (i - 1) < 3 ? lights[i - 1,j] : 0;\n r = (i + 1) >= 0 && (i + 1) < 3 ? lights[i + 1,j] : 0;\n b = (j + 1) >= 0 && (j + 1) < 3 ? lights[i ,j+1] : 0;\n t = (j - 1) >= 0 && (j - 1) < 3 ? lights[i ,j-1] : 0;\n lightsCumulative[i, j] = lights[i, j] + l + r + t + b;\n\n Console.Write((lightsCumulative[i, j] + 1) % 2);\n Console.Write(\" \");\n }\n Console.WriteLine();\n }\n\n\n\n\n }\n\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bd68c23f29290f3ca8a19a4f6d5ef5a4", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace N\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt32(Console.ReadLine());\n if (n > 3)\n {\n if (n % 2 == 1)\n {\n long u = n * (n - 1) * (n - 2);\n Console.WriteLine(u);\n }\n else\n {\n long max = 1;\n for (long i = n - 101; i < n - 3; i+=2)\n {\n \n long u = i * (i + 1) * (i + 2);\n if (u > max)\n {\n max = u;\n }\n long u = i * (i + 3) * (i + 2);\n if (u > max)\n {\n max = u;\n }\n }\n //if (n == 508)\n // max = 130065780;\n Console.WriteLine(max);\n }\n }\n else\n {\n if (n == 3)\n {\n Console.WriteLine(6);\n }\n if (n == 2)\n {\n Console.WriteLine(2);\n }\n if (n == 1)\n {\n Console.WriteLine(1);\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9089e79e5adbb1e07513c530f645949b", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "//http://codeforces.ru/contest/236/problem/C\nusing System;\n\nnamespace TaskForNOK\n{\n class Program\n {\n static void Main()\n {\n\n UInt64 number = UInt64.Parse(Console.ReadLine());\n\n UInt64 ans = 1;\n\n if (number < 3)\n {\n Console.WriteLine(number);\n return;\n }\n\n for (UInt64 i = max(1,number-5); i <= number; i +=2 ) \n {\n for (UInt64 j = max(1,number-5); j <= number; j+=2 )\n {\n UInt64 per1 = NOK(i,j);\n for (UInt64 k = max(1,number-5); k <= number; k+=2 ) \n {\n UInt64 per2 = NOK(per1,k);\n if (per2 > ans)\n {\n ans = per2;\n }\n }\n }\n }\n\n Console.WriteLine(ans);\n \n }\n static UInt64 NOK(UInt64 a, UInt64 b) \n {\n UInt64 num = a * b;\n\n while ((a != 0)&&(b != 0))\n {\n if (a > b)\n {\n a = a % b;\n }\n else \n {\n b = b % a;\n }\n }\n\n return (num / (a + b));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b661ad3b5bb5c4c90a04c7a6fab040dc", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.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": "edc7750762f12d6af48e65a70d4d9e6a", "src_uid": "4b3d65b1b593829e92c852be213922b6", "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\tint coord = int.Parse(Console.ReadLine());\n\t\tint steps = Math.Ceiling(coord/maxStep);\n\t\t\n\t\tConsole.WriteLine($\"{steps}\");\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "d5b176398298061c17848e68424ac481", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace A\n{\n class Program\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int k = 0, s = 5;\n for (s = 5; n != 0 && s > 0; s--) \n {\n if (n % s == 0)\n {\n n -= s;\n k++;\n }\n }\n Console.WriteLine(k);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "94bc601e265bad7ce8ff9ca21c119015", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int n;\n cin >> n;\n cout << (n + 4) / 5 << endl;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bc5b9a5431946efef17bb8a5414d74fb", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "long X = Convert.ToInt64(Console.ReadLine());\nConsole.WriteLine(X / 5 + (X % 5 != 0 ? 1 : 0));", "lang_cluster": "C#", "compilation_error": true, "code_uid": "171db1077a513fff8d1ba2b8b38adf2f", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n if (n % 5 == 0) Console.WriteLine(n / 5);\n else Console.WriteLine((n / 5) + 1);\n }\n\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dcb46c3ad0741a2a19a7f33f6277c5ba", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.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.Tasks;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n\n public static void Main(string[] args)\n {\n //2010200\n string x = Console.ReadLine();\n string k = string.Empty;\n for (int i = x.Count()-1; i >= 0; i--)\n k+= x[i];\n int res = 0;\n for(int i = 0; i < x.Length; i++)\n {\n if(isPal(k))\n {\n res++;\n break;0\n }\n else\n {\n k += \"0\";\n }\n }\n\n if(res > 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n public static bool isPal(string k)\n {\n var st = string.Empty;\n for (int i = k.Count() - 1; i >= 0; i--)\n st += k[i];\n if (st == k)\n {\n return true;\n }\n else\n return false;\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4f963d31e2582a42919f96db01bd38f1", "src_uid": "d82278932881e3aa997086c909f29051", "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 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 x = int.Parse(s[0]);\n long 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}\nclose", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dc1292bfda2635d68e056b9e3e342ffa", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System; \n\n class Exercise11 \n\n{ \n \n static void Main() \n \n {\n \n int n=Convert.ToInt32(Console.ReadLine()); \n int num=new int[n];\n \n for (int i = 0; i < n; i++) {\n num[i]=Convert.ToInt32(Console.ReadLine());\n }\n if (num[0] % 2 == 1 && num[n - 1] % 2 == 1 && n % 2 == 1) {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f4f120799bdca4ddd69dfe82d7d19aa7", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nclass Problem{\n \n public static void Main(){\n var input = Console.ReadLine().Split(\" \").Select(int.Parse).ToArray();\n var worst = input[0] - input[2] - input[1];\n var best = input[0] - input[2] + input[0];\n if (worst > 0) Console.WriteLine(\"+\");\n if (best < 0) Console.WriteLine(\"-\");\n if (best == 0 && worst == 0) Console.WriteLine(\"0\");\n else Console.WriteLine(\"?\");\n } \n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "54aaa6e34d6ab7caab78ff6f8ce87a64", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace MyFirstAlgOnC#\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n = input[0], t = input[1], k = input[2], d = input[3];\n int timesCook = (int)Math.Ceiling((double)n / k);\n int timeAlone = timesCook * t;\n bool result = Math.Max(timeAlone - t, d + t) < timeAlone;\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8c3c1a8fb793f8ca6349c62ff96dceb1", "src_uid": "32c866d3d394e269724b4930df5e4407", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections.ObjectModel;\nusing Microsoft.Office.Server;\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": "c69efca339c5a905e951ddf8c57c0e95", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.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}\") = \"ConsoleApplication1\", \"ConsoleApplication1\\ConsoleApplication1.csproj\", \"{F9BBED00-742E-4EF5-8EC7-AE58D0427A2E}\"\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{F9BBED00-742E-4EF5-8EC7-AE58D0427A2E}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{F9BBED00-742E-4EF5-8EC7-AE58D0427A2E}.Debug|x86.Build.0 = Debug|x86\n\t\t{F9BBED00-742E-4EF5-8EC7-AE58D0427A2E}.Release|x86.ActiveCfg = Release|x86\n\t\t{F9BBED00-742E-4EF5-8EC7-AE58D0427A2E}.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": "9a10431cf6ac80fa5b278f4c1e9e66fa", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string rs;\n for (int i = 0, cntr = 2; i < input.Length; ++i)\n {\n if (input[i] == '4')\n {\n if (++cntr > 2) { rs = \"NO\"; break; }\n }\n else if (input[i] == '1') cntr = 0;\n else { rs = \"NO\"; break; }\n }\n Console.WriteLine(rs==null?\"YES\":rs);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cfc0ba030b4b8613dc8212703d10b630", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.29209.62\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp1\", \"ConsoleApp1\\ConsoleApp1.csproj\", \"{222A4524-A140-4F58-867E-F6E861CD2F2C}\"\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{222A4524-A140-4F58-867E-F6E861CD2F2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{222A4524-A140-4F58-867E-F6E861CD2F2C}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{222A4524-A140-4F58-867E-F6E861CD2F2C}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{222A4524-A140-4F58-867E-F6E861CD2F2C}.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 = {B7094F77-3830-474D-BFB8-5DE1C52FC44D}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e088ae3ddd637d0020125d586c17c8ee", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "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 static void Main(string[] args)\n {\n var param = Console.ReadLine().Split(' ');\n int n = int.Parse(param[0]);\n int a = int.Parse(param[1]);\n\t\t\tint b = int.Parse(param[2]);\n\t\t\tn = n - a\n Console.WriteLine(n - Math.Max(0, n - b + 1));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bf8ae119b867fa2b2eb7557c342301bb", "src_uid": "51a072916bff600922a77da0c4582180", "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 ConsoleApplication1Bagaeva\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong a = ulong.Parse(Console.ReadLine());\n if(a==1)ConsoleWriteLine(1);else\n {\n Console.WriteLine((a-1)+\"\"+(a+4));\n }}\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1574b36add2787d046125396b7b8be5e", "src_uid": "bf65a25185e9ea5b71e853723b838b04", "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 ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine()), ans=0;\n string txt = Console.ReadLine();\n string[] duo = txt.Split(' ');\n if (duo[0] == \"1\")\n ans++;\n for ( int i=1; i= 0 && duo[i - 2] == \"0\")\n ans++;\n }\n else ans++;\n }\n if ( ans<0)\n ans=0\n Console.WriteLine(ans);\n }\n }\n }\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "68d8c375fc24642931690f0e25bcf986", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "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 ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine()), ans=0;\n string txt = Console.ReadLine();\n string[] duo = txt.Split(' ');\n int i=1\n if (duo[0] == \"1\")\n ans++;\n else if ( duo[0]==\"0\")\n {\n while (duo[i] == \"0\")\n i++;\n }\n for (i=i; i= 0 && duo[i - 2] == \"0\" || i == n - 1 && duo[i] == \"0\")\n ans++;\n }\n else ans++;\n }\n if (ans < 0)\n ans = 0;\n Console.WriteLine(ans);\n }\n }\n }\n ", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f158de3aa02fe770ff4c903a31ab37dd", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0} {"lang": "Mono C#", "source_code": " static void Main(string[] args)\n {\n\n string s = args[0];\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(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 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 Console.ReadLine();\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "23eed4f1862b11a4856c92e3c504e33c", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0} {"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 int findedValue;\n\n if (firstCakePieces + secondCakePieces == platesCount || firstCakePieces == secondCakePieces)\n {\n findedValue = (int)((firstCakePieces + secondCakePieces) / platesCount);\n }\n else\n {\n double piecesOnFirstPlate;\n double piecesOnSecondPlate;\n double lessPart = firstCakePieces > secondCakePieces\n ? Math.Ceiling(platesCount * secondCakePieces / firstCakePieces)\n : Math.Ceiling(platesCount * firstCakePieces / secondCakePieces);\n\n\n if (firstCakePieces > secondCakePieces)\n {\n piecesOnFirstPlate = firstCakePieces / (platesCount - lessPart);\n piecesOnSecondPlate = secondCakePieces / lessPart;\n }\n else\n {\n piecesOnFirstPlate = firstCakePieces / lessPart;\n piecesOnSecondPlate = secondCakePieces / (platesCount - lessPart);\n }\n\n findedValue = (int) (piecesOnFirstPlate < piecesOnSecondPlate ? Math.Ceiling(piecesOnFirstPlate) : Math.Ceiling(piecesOnSecondPlate));\n }\n\n Console.WriteLine(findedValue);\n Console.ReadLine();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2e0c8be473808959a63de0f6222f94aa", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "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;\n\nclass Program\n{\n private static void Main(string[] args)\n\n var n = RI();\n var k = RI();\n\n var c4 = n;\n var c2 = n + n;\n var c1 = 0;\n\n for (int i = 0; i < k; i++)\n {\n var a = RI();\n if (a % 2 == 1)\n {\n c1++;\n a -= (a & 1);\n }\n\n c4 -= a / 4;\n c2 -= (a % 4) / 2;\n }\n\n if (c4 < 0)\n {\n c2 -= Math.Abs(c4) * 2;\n c4 = 0;\n }\n\n if (c4 > 0)\n {\n c2 += c4;\n c1 -= c4;\n c4 = 0;\n }\n\n if (c1 > 0 && c2 > 0)\n {\n c1 -= c2;\n c2 = 0;\n }\n\n if (c2 < 0 && c1 < 0)\n {\n c1 += Math.Abs(c2) * 2;\n c2 = 0;\n }\n\n Console.WriteLine((c2 < 0 || c1 > 0) ? \"NO\" : \"YES\");\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": true, "code_uid": "aaa6f1e6f71fa835f34fc68f0f175318", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Linq;\nusing MoreLinq;\nclass Program\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n var bin = Enumerable.Range(1, 512).Select(i => Convert.ToString(i, 2)).Select(int.Parse).ToArray();\n var index = Array.IndexOf(bin, bin.MinBy(i => n > i));\n if (n == bin[index])\n {\n index++;\n }\n Console.WriteLine(index);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b9f143b736c1aaa1cf1075b8bee798a3", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {D76EAD0F-3DCA-4720-981A-A1CC8B957629}\n Exe\n Algoritms\n Algoritms\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": "493874c9ebd9127d5b1b335ac9f50cee", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "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}\") = \"Olimp2.1\", \"Olimp2.1\\Olimp2.1.csproj\", \"{EAE85B93-D01D-43CC-AA10-F9D36A0CC922}\"\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{EAE85B93-D01D-43CC-AA10-F9D36A0CC922}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{EAE85B93-D01D-43CC-AA10-F9D36A0CC922}.Debug|x86.Build.0 = Debug|x86\n\t\t{EAE85B93-D01D-43CC-AA10-F9D36A0CC922}.Release|x86.ActiveCfg = Release|x86\n\t\t{EAE85B93-D01D-43CC-AA10-F9D36A0CC922}.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": "ff1c1ea546f7117c8669ad9f90b44448", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.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": "4e1a488403afd6d40af33d93ce08654c", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace a988a\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n var array1 = Console.ReadLine().Split(' ');\n List list = new List();\n List list1 = new List();\n for(int i=0;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": "128ddc668f6210fe527e926497148346", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\u0432\u0444\u044b\u0432\u044b\u0444\u0432\u0444\u044b\u0432", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ed1ebdc42013aa3553a4a53bc9de9ed8", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "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": "5646d7c9451ba763f6788b93137817a4", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System.Collections.Generic;\nusing System;\nnamespace ProblemToAlgorithms\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 \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "65eaec2c989452e2a1b25afc68624a0e", "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 \n }\n}\n \n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1d9d42c75f423d812f4b8117de0b69c9", "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 String []coll = t.Split(' ');\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": "e82a11260e8c74e70c356dcb87c7483b", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\npublic class CF_854A\n{\n public string solve(int sum)\n {\n var l = sum / 2;\n var ra = 0; var rb = 0;\n for (int i = 1; i <= l; i++)\n {\n var a = i; var b = sum - a;\n if (are_coprime(a, b))\n {\n ra = a; rb = b;\n }\n }\n return ra + \" \" + rb;\n }\n\n public static int gcd(int a, int b)\n {\n while (b != 0)\n {\n var t = a % b;\n a = b;\n b = t;\n }\n return a;\n }\n\n public static bool are_coprime(int a, int b)\n {\n if (((a | b) & 1) == 0)\n return false;\n return 1 == gcd(a, b);\n }\n}\n\n#if !ONLINE_JUDGE\nnamespace CodeForces\n{\n using Microsoft.VisualStudio.TestTools.UnitTesting;\n\n [TestClass]\n public class Test_CF_854A\n {\n [TestMethod]\n public void Test1()\n {\n Assert.AreEqual(\"1 2\", new CF_854A().solve(3));\n }\n\n [TestMethod]\n public void Test2()\n {\n Assert.AreEqual(\"1 3\", new CF_854A().solve(4));\n }\n\n [TestMethod]\n public void Test3()\n {\n Assert.AreEqual(\"5 7\", new CF_854A().solve(12));\n }\n\n [TestMethod]\n public void Test4()\n {\n Assert.AreEqual(\"499 501\", new CF_854A().solve(1000));\n }\n }\n}\n#endif", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6c21f7d7d20f5c33f83a92b528be72ef", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using Sytem;\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 += i * 2;\n Console.WriteLine(res);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e4529f14ac967ce6c08eeb54f13550fb", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": " var countAndEvil = Console.ReadLine();\n var mex = int.Parse(countAndEvil.Split(' ')[1]);\n\n var numbers = Console.ReadLine().\n Split(' ').\n Select(x => int.Parse(x)).\n ToList();\n\n int lessCount = 0;\n int shouldBeDelete = 0;\n numbers.ForEach(x =>\n {\n if (x < mex) lessCount++;\n if (x == mex) shouldBeDelete++;\n });\n\n var k = mex - lessCount + shouldBeDelete;\n\n Console.WriteLine(Math.Min(k, numbers.Count));", "lang_cluster": "C#", "compilation_error": true, "code_uid": "a3a4fbb103f760d4ce5a0653a5185948", "src_uid": "21f579ba807face432a7664091581cd8", "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 twoprob\n{\n class Program\n {\n public static int binsearch(int[] x, int n, int l, int r)\n {\n\n if (x.Length == 0)\n {\n return -1;\n }\n else if (x[0] < n)\n {\n return -1;\n }\n else if (x[x.Length - 1] > n)\n {\n return -1;\n }\n int mid;\n while (l < r)\n {\n mid = l + (r - l) / 2;\n\n if (n >= x[mid])\n r = mid;\n else\n l = mid + 1;\n }\n if (x[r] == n)\n {\n return r;\n }\n else\n {\n return -1;\n }\n }\n static void Main(string[] args)\n {\n int x, t, a, b, da, db, i;\n string s=Console.ReadLine();\n string[] tmp=s.Split(' ');\n x = int.Parse(tmp[0]);\n t = int.Parse(tmp[1]);\n a = int.Parse(tmp[2]);\n b = int.Parse(tmp[3]);\n da = int.Parse(tmp[4]);\n db = int.Parse(tmp[5]);\n if (x == 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine();\n int[] ab = new int[t+1];\n int[] bb = new int[t+1];\n for (i = 0; i < t; i++)\n {\n ab[i] = a - da * i;\n bb[i] = b - db * i;\n }\n for (i=0; i<=t; i++)\n if (binsearch(ab, x - bb[i], 0, t) != -1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "19a7dbf52eb5ad643bdc4e4187dcc992", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace helloworld\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string vowel = \"aouie\";\n var tr = Console.ReadLine();\n if(tr.Length==1 && (tr != \"n\" || tr!=\"N\"))\n {\n Console.Write(\"NO\");\n return;\n }\n \n if(vowel.Contains(tr[0]))\n {\n Console.Write(\"NO\");\n return;\n }\n\n if(!vowel.Contains(tr[tr.Length-1]) && tr[tr.Length-1] != 'n')\n {\n Console.Write(\"NO\");\n return;\n }\n\n for(int i = 1; i < tr.Length-1; i++)\n {\n if (vowel.Contains(tr[i]))\n {\n if (vowel.Contains(tr[i - 1]))\n {\n Console.Write(\"NO\");\n return;\n }\n if (vowel.Contains(tr[i + 1]))\n {\n Console.Write(\"NO\");\n return;\n }\n }\n if (!vowel.Contains(tr[i]) && tr[i]!='n')\n {\n if (!vowel.Contains(tr[i - 1]) && tr[i-1] != 'n')\n {\n Console.Write(\"NO\");\n return;\n }\n if (!vowel.Contains(tr[i + 1]) && tr[i + 1] != 'n')\n {\n Console.Write(\"NO\");\n return;\n }\n }\n }\n Console.Write(\"YES\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6e35e582ac014090626a5cfe54182201", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "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;)\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 }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "196273257c81c93c5735862614c48481", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0} {"lang": ".NET Core C#", "source_code": "using System;\nclass Program\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = Convert.ToInt32(s);\n s = Console.ReadLine();\n int[] arr = s.Split(' ').Select(x => Convert.ToInt32(x)).Distinct().OrderBy(x => x).ToArray();\n if (arr.Length == 3)\n {\n if (arr[2] - arr[1] == arr[1] - arr[0])\n Console.WriteLine(arr[2] - arr[1]);\n else\n Console.WriteLine(-1);\n }\n else\n if (arr.Length == 2)\n Console.WriteLine(arr[1] - (arr[0] + arr[1]) / 2);\n else\n if (arr.Length == 0)\n Console.WriteLine(0);\n else\n Console.WriteLine(-1);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "15d249dc1be356b55675494d84671896", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Linq;\nclass Program\n{\n static void Main(string[] args)\n {\n Problem1154B();\n }\n\n static void Problem1154B()\n {\n string s = Console.ReadLine();\n int n = Convert.ToInt32(s);\n s = Console.ReadLine();\n var arr = s.Split(' ').Select(x => Convert.ToInt32(x));\n Console.WriteLine(Problem1154B(arr));\n }\n static int Problem1154B(IEnumerable ar)\n {\n int[] arr = ar.Distinct().OrderBy(x => x).ToArray();\n if (arr.Length == 3)\n {\n if (arr[2] - arr[1] == arr[1] - arr[0])\n return arr[2] - arr[1];\n else\n return -1;\n }\n else\n {\n if (arr.Length == 2)\n {\n if ((arr[1] - arr[0]) % 2 == 0)\n return (arr[1] - arr[0]) / 2;\n else\n return arr[1] - arr[0];\n }\n else\n if (arr.Length == 1)\n return 0;\n else\n return -1;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd16c6aa6aa9e3380b2a862398108257", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace CP\n{\n class Program\n {\n static void Main(string[] args)\n {\n char dir = Convert.ToChar(Console.ReadLine());\n string message = Console.ReadLine();\n string keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n StringBuilder sb = new StringBuilder();\n if(dir == 'L')\n {\n for(int i = 0 ; i> lst = new List>();\n lst.Add(new KeyValuePair(0,0));\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'R')\n {\n x++;\n }\n else if (str[i] == 'L')\n {\n x--;\n }\n else if (str[i] == 'U')\n {\n y++;\n }\n else\n {\n y--;\n }\n lst.Add(new KeyValuePair(x,y));\n }\n int px=x,py=y,ans=0;\n foreach (var kv in lst)\n {\n\n if(px!=0 && py!=0 && ((a-kv.Key)%px ==0) && ((b-kv.Value)%py==0) &&((a-kv.Key)/px ==(b-kv.Value)/py)&& (b-kv.Value)/py>=0)\n {\n ans=1;\n break;\n }\n else if (px == 0 && py == 0 && (a == kv.Key) && (b == kv.Value))\n {\n ans=1;\n break;\n }\n else if (px == 0 && (a == kv.Key) && ((b-kv.Value)%py ==0) && (b-kv.Value)/py>=0)\n {\n ans=1;\n break;\n }\n else if (py == 0 && (b == kv.Value) && ((a - kv.Key) % px == 0) &&(a-kv.Key)/px >=0)\n {\n ans=1;\n break;\n }\n }\n if(ans==0)Console.WriteLine(\"No\");\nelse Console.WriteLine(\"Yes\");\n Console.ReadLine();\n } \n}\n\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bea22fb774921fcdfbad5b3f2ddf7bde", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "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 \ufffd\ufffd\ufffd\ufffd\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 class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n if (n == 3)\n Console.WriteLine(0);\n else if (n % 4 == 0)\n Console.WriteLine(0);\n else\n Console.WriteLine(1);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6b89aec7e448ec523d0d7ab2e759465c", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "namespace Test\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var num1 = int.Parse(Console.ReadLine());\n var sum = (1 + num1) * num1 / 2;\n Console.WriteLine(sum - sum / 2 * 2);\n \n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bedcb72661d4d2986df590e1b7f3a7f8", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\n\nclass P { \n static void Main() {\n var n = int.Parse(Console.ReadLine());\n for (var d = 2 ; n != 1 && d <= n ; d++)\n Console.Write(\"{0} \", n); \n if (n % d == 0) { n /= d; d--; }\n }\n Console.Write(1);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "422a973c35285fc27a61cac42a895fc1", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\npublic static class Program\n{\n public static void Main()\n {\n \t// char[,] mat = new char[6,8];\n \tchar[] mat1 = Console.ReadLine().ToCharArray();\n \tchar[] mat2 = Console.ReadLine().ToCharArray();\n \tchar[] mat3 = Console.ReadLine().ToCharArray();\n \tchar[] mat4 = Console.ReadLine().ToCharArray();\n \tchar[] mat5 = Console.ReadLine().ToCharArray();\n \tchar[] mat6 = Console.ReadLine().ToCharArray();\n \tbool done=false;\n \tif(mat1[3]=='.'){\n \t\tmat1[3]='P';\n \t}\n \telse if(mat1[4]=='.'){\n \t\tmat1[4]='P';\n \t}\n \telse if(mat1[0]=='.'){\n \t\tmat1[0]='P';\n \t}\n \telse if(mat1[1]=='.'){\n \t\tmat1[1]='P';\n \t}\n \telse if(mat1[6]=='.'){\n \t\tmat1[6]='P';\n \t}\n \telse if(mat1[7]=='.'){\n \t\tmat1[7]='P';\n \t}\n \telse if(mat2[3]=='.'){\n \t\tmat2[3]='P';\n \t}\n \telse if(mat2[4]=='.'){\n \t\tmat2[4]='P';\n \t}\n \telse if(mat2[0]=='.'){\n \t\tmat2[0]='P';\n \t}\n \telse if(mat2[1]=='.'){\n \t\tmat2[1]='P';\n \t}\n \telse if(mat2[6]=='.'){\n \t\tmat2[6]='P';\n \t}\n \telse if(mat2[7]=='.'){\n \t\tmat2[7]='P';\n \t}\n \telse if(mat3[3]=='.'){\n \t\tmat3[3]='P';\n \t}\n \telse if(mat3[4]=='.'){\n \t\tmat3[4]='P';\n \t}\n \telse if(mat3[0]=='.'){\n \t\tmat3[0]='P';\n \t}\n \telse if(mat3[1]=='.'){\n \t\tmat3[1]='P';\n \t}\n \telse if(mat3[6]=='.'){\n \t\tmat3[6]='P';\n \t}\n \telse if(mat3[7]=='.'){\n \t\tmat3[7]='P';\n \t}\n \telse if(mat4[3]=='.'){\n \t\tmat4[3]='P';\n \t}\n \telse if(mat4[4]=='.'){\n \t\tmat4[4]='P';\n \t}\n \telse if(mat4[0]=='.'){\n \t\tmat4[0]='P';\n \t}\n \telse if(mat4[1]=='.'){\n \t\tmat4[1]='P';\n \t}\n \telse if(mat4[6]=='.'){\n \t\tmat4[6]='P';\n \t}\n \telse if(mat4[7]=='.'){\n \t\tmat4[7]='P';\n \t}\n \telse if(mat5[3]=='.'){\n \t\tmat5[3]='P';\n \t}\n \telse if(mat5[4]=='.'){\n \t\tmat5[4]='P';\n \t}\n \telse if(mat5[0]=='.'){\n \t\tmat5[0]='P';\n \t}\n \telse if(mat5[1]=='.'){\n \t\tmat5[1]='P';\n \t}\n \telse if(mat5[6]=='.'){\n \t\tmat5[6]='P';\n \t}\n \telse if(mat5[7]=='.'){\n \t\tmat5[7]='P';\n \t}\n \telse if(mat6[3]=='.'){\n \t\tmat6[3]='P';\n \t}\n \telse if(mat6[4]=='.'){\n \t\tmat6[4]='P';\n \t}\n \telse if(mat6[0]=='.'){\n \t\tmat6[0]='P';\n \t}\n \telse if(mat6[1]=='.'){\n \t\tmat6[1]='P';\n \t}\n \telse if(mat6[6]=='.'){\n \t\tmat6[6]='P';\n \t}\n \telse if(mat6[7]=='.'){\n \t\tmat6[7]='P';\n \t}\n \tstring temp1 = new string(mat1)\n \tstring temp2 = new string(mat2)\n \tstring temp3 = new string(mat3)\n \tstring temp4 = new string(mat4)\n \tstring temp5 = new string(mat5)\n \tstring temp6 = new string(mat6)\n Console.WriteLine(temp1);\n Console.WriteLine(temp2);\n Console.WriteLine(temp3);\n Console.WriteLine(temp4);\n Console.WriteLine(temp5);\n Console.WriteLine(temp6);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "efa1dda8a1f6a81ee2f4637bb2e1a5c9", "src_uid": "35503a2aeb18c8c1b3eda9de2c6ce33e", "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 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(r.split()[0]);\n int d = int.Parse(r.split()[1]);\n\n verificaGritosIguais(a, b, c, d);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "5b91eb861a6a1a362efe601e653cfaa8", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "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 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": "60d35cb09b5a2e5876e4efa06f53b9d0", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Game\n{\n class Card\n {\n public string ValueCard { get; set; }\n public string LearCard { get; set; }\n public bool Trump { get; set; }\n\n public static bool Calculation(Card card1, Card card2, string trump)\n {\n bool status = false;\n\n //\u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \"\u043a\u043e\u0437\u044b\u0440\u044c\"\n if (card1.LearCard == trump)\n card1.Trump = true;\n if (card2.LearCard == trump)\n card2.Trump = true;\n\n //\u0432\u0430\u0440\u0438\u0430\u043d\u0442 1\n //\u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u043a\u043e\u0437\u044b\u0440\u044c, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u0442, \u0442\u043e\n if (card1.Trump == true && card2.Trump == false)\n {\n status = true;\n }\n //\u0432\u0430\u0440\u0438\u0430\u043d\u0442 2\n //\u0435\u0441\u043b\u0438 \u0432\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u0437\u044b\u0440\u044c, \u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u043d\u0435\u0442, \u0442\u043e\n if (card1.Trump == false && card2.Trump == true)\n {\n status = false;\n }\n\n //\u0432\u0430\u0440\u0438\u0430\u043d\u0442 3\n //\u0435\u0441\u043b\u0438 \u043a\u0430\u0440\u0442\u044b \u043d\u0435 \u043a\u043e\u0437\u044b\u0440\u0438, \u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0430\u0441\u0442\u0438\n\n if (card1.Trump == false && card2.Trump == false)\n {\n if (card1.LearCard != card2.LearCard)\n status = false;\n }\n\n //\u0435\u0441\u043b\u0438 \u043c\u0430\u0441\u0442\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\n if (card1.LearCard == card2.LearCard)\n {\n int ind1 = card1.GetCoefficient();\n int ind2 = card2.GetCoefficient();\n\n if (card1.GetCoefficient() > card2.GetCoefficient())\n {\n status = true;\n }\n }\n return status;\n }\n\n public int GetCoefficient()\n {\n int coef = new int();\n switch (this.ValueCard)\n {\n case \"6\": coef = 1;\n break;\n case \"7\": coef = 2;\n break;\n case \"8\": coef = 3;\n break;\n case \"9\": coef = 4;\n break;\n case \"10\": coef = 5;\n break;\n case \"\u0412\": coef = 6;\n break;\n case \"\u0414\": coef = 7;\n break;\n case \"\u041a\": coef = 8;\n break;\n case \"\u0422\": coef = 9;\n break;\n default:\n break;\n }\n return coef;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n bool work = true;\n\n while (work == true)\n {\n\n // Console.Write(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043c\u0430\u0441\u0442\u044c \u043a\u043e\u0437\u044b\u0440\u044f \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0431\u0443\u043a\u0432\u043e\u0439.\\r\\n\u041a\u0440\u0435\u0441\u0442\u0438, \u0432\u0438\u043d\u0438, \u0447\u0435\u0440\u0432\u0438, \u0431\u0443\u0431\u0438 - \u041a, \u0412, \u0427, \u0411 - \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.\\r\\n\u041a\u043e\u0437\u044b\u0440\u044c: \");\n //\u043c\u0430\u0441\u0442\u044c\n\n string learTrump = Console.ReadLine();\n\n //Console.WriteLine(\"\\r\\n\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u043e \u043a\u0430\u0440\u0442.\\r\\n\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0440\u043e\u043b\u044c \u0447\u0435\u0440\u0432\u0435\u0439 - \u041a\u0427, \u0432\u043e\u0441\u043c\u0451\u0440\u043a\u0430 \u043a\u0440\u0435\u0441\u0442\u0435\u0439 - 8\u041a\");\n //Console.Write(\"\u041a\u0430\u0440\u0442\u0430 \u21161: \");\n\n string cards = Console.ReadLine();\n int indexProbel = cards.IndexOf(' ');\n int indexPospeProbela = cards.Length - indexProbel - 1;\n string strCard1 = cards.Substring(0, indexProbel);\n\n // Console.Write(\"\u041a\u0430\u0440\u0442\u0430 \u21162: \");\n string strCard2 = cards.Substring(indexProbel + 1, indexPospeProbela);\n\n Card card1;\n Card card2;\n\n if (strCard1.Length == 3)\n {\n card1 = new Card { ValueCard = strCard1[0].ToString() +strCard1[1].ToString() , LearCard = strCard1[2].ToString() };\n }\n else\n {\n card1 = new Card { ValueCard = strCard1[0].ToString(), LearCard = strCard1[1].ToString() };\n }\n\n if (strCard2.Length == 3)\n {\n card2 = new Card { ValueCard = strCard2[0].ToString() + strCard2[1].ToString(), LearCard = strCard2[2].ToString() };\n }\n else\n {\n card2 = new Card { ValueCard = strCard2[0].ToString(), LearCard = strCard2[1].ToString() };\n } \n \n\n bool result = Card.Calculation(card1, card2, learTrump);\n\n if (result)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n \n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "560c9b4357c2d9592116bf24da818f0d", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round82 {\n class A {\n static void Mai() {\n char s = Console.ReadLine()[0];\n var xs = Console.ReadLine().Split(' ');\n\n Dictionary dic = new Dictionary();\n\n for (int i = 6; i < 10; i++)\n dic[(char)(i + '0')] = i;\n\n string str = \"TJQKA\";\n for (int i = 0; i < str.Length; i++)\n dic[str[i]] = i + 10;\n\n Console.WriteLine(\n s == xs[0][1] && s != xs[1][1] ||\n xs[0][1] == xs[1][1] && dic[xs[0][0]] > dic[xs[1][0]] ?\n \"YES\" : \"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "341714bd3bb7ba55e8763e36b63e300a", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace olimp\n{\n\tpublic class HonoredGame2\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint count;\n\n\t\t\tif (!int.TryParse (Console.ReadLine (), out count) || count < 2 || count > 100 || count % 2 != 0) {\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint number;\n\t\t\tint n1 = 0;\n\t\t\tint n2 = 0;\n\t\t\tint cnt = 0;\n\n\t\t\twhile (int.TryParse (Console.ReadLine (), out number)) {\n\t\t\t\tif (number >= 1 && number <= 100) {\n\t\t\t\t\tif (i == 0) {\n\t\t\t\t\t\tn1 = number;\n\t\t\t\t\t\tcnt = 1;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (number != n1) {\n\t\t\t\t\t\tif (n2 == 0) n2 = number;\n\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (cnt != count / 2) {\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tConsole.WriteLine (\"YES\");\n\t\t\tConsole.WriteLine (n1 + \" \" + n2);\n\n\t\t\t//Console.ReadKey ();\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7873a5fa88358006f6f156f232834a22", "src_uid": "2860b4fb22402ea9574c2f9e403d63d8", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace olimp\n{\n\tpublic class HonoredGame2\n\t{\n\t\tstatic int count;\n\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring s = Console.ReadLine ();\n\n\t\t\tif (!int.TryParse (s, out count) || count < 2 || count > 100 || count % 2 != 0) {\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint a = 0;\n\t\t\tint b = 0;\n\n\t\t\tint c1 = 0;\n\t\t\tint c2 = 0;\n\n\t\t\tfor (int i = 0; i < count; i++) {\n\t\t\t\tint number;\n\n\t\t\t\tif (int.TryParse (Console.ReadLine (), out number) && number >= 1 && number <= 100) {\n\t\t\t\t\tif (i == 0) {\n\t\t\t\t\t\ta = number;\n\t\t\t\t\t\tc1 = 1;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (b == 0 && number != a) {\n\t\t\t\t\t\tb = number;\n\t\t\t\t\t\tc2 = 1;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (number == a) c1++; else c2++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (c1 == 0 || c2 == 0 || c2 != c1) {\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tConsole.WriteLine (\"YES\");\n\t\t\tConsole.WriteLine (a.Value + \" \" + b.Value);\n\n\t\t\t//Console.ReadKey ();\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "51e2726adfc45b333c1099dbd9c3fe75", "src_uid": "2860b4fb22402ea9574c2f9e403d63d8", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n SortedSet set = new SortedSet();\n int n;\n n=Int32.Parse(Console.ReadLine());\n string[] A = new string[n];\n for(int i=0;i e);\n if(g.Count()==2 &&g.First().Count()==n/2)\n {\n Console.WriteLine(\"YES\");\n Console.Write(g.First().Key + \" \"g.Last().Key);\n \n }\n else\n {\n Console.WriteLine(\"NO\");\n \n }\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "851a62f01de6eef8a746648c83e256fa", "src_uid": "2860b4fb22402ea9574c2f9e403d63d8", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static Reader;\nusing MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;\nusing MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;\nusing System.Text.RegularExpressions;\n\npublic static class P\n{\n public static void Main()\n {\n var s = Console.ReadLine(); \n Console.WriteLine(Regex.Matches(s, \"(Danil|Olya|Slava|Ann|Nikita)\").Count == 1 ? \"Yes\" : \"No\");\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4b7309c66fb56ec4f10bbf1694fd401f", "src_uid": "db2dc7500ff4d84dcc1a37aebd2b3710", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http.Headers;\n\nnamespace ConsoleApp1\n{\n public static class PositionHelper\n {\n private static Dictionary> cache = new Dictionary>();\n\n public static HashSet GetSurrondings(this Program.Position position)\n {\n if (!cache.ContainsKey(position))\n {\n cache.Add(position, new HashSet\n {\n position,\n new Program.Position(position.X - 1, position.Y),\n new Program.Position(position.X - 1, position.Y - 1),\n new Program.Position(position.X - 1, position.Y + 1),\n new Program.Position(position.X, position.Y - 1),\n new Program.Position(position.X, position.Y + 1),\n new Program.Position(position.X + 1, position.Y),\n new Program.Position(position.X + 1, position.Y - 1),\n new Program.Position(position.X + 1, position.Y + 1)\n });\n }\n return cache[position];\n }\n\n }\n\n public static class Program\n {\n public static void Main()\n {\n Console.WriteLine(HasAvailablePosition(ReadData()) ? \"OTHER\" : \"CHECKMATE\");\n }\n\n public static bool HasAvailablePosition(string positions)\n {\n var lines = positions.Split(' ');\n var l1Position = new Position(lines[0]);\n var l2Position = new Position(lines[1]);\n var kingPosition = new Position(lines[2]);\n var aimPosition = new Position(lines[3]);\n\n var positionsForCheck = aimPosition.GetSurrondings();\n\n foreach (var position in positionsForCheck)\n {\n if (IsAvailablePosition(position, aimPosition, l1Position, l2Position, kingPosition))\n {\n return true;\n }\n }\n return false;\n }\n\n private static bool IsAvailablePosition(Position position, Position aimPosition, Position l1, Position l2, Position kingPosition)\n {\n if (position.X <= 0 || position.X > 8 || position.Y <= 0 || position.Y > 8)\n return false;\n \n if (kingPosition.GetSurrondings().Contains(position))\n return false;\n\n if (HasProblemsWithL(position, aimPosition, l1, l2, kingPosition))\n return false;\n \n if (HasProblemsWithL(position, aimPosition, l2, l1, kingPosition))\n return false;\n return true;\n }\n\n private static bool HasProblemsWithL(Position position, Position aimPosition, Position l1, Position l2, Position kingPosition)\n {\n if (position.X == l1.X || position.Y == l1.Y)\n {\n if (l1.X == l2.X || l1.Y == l2.Y)\n return true;\n if (kingPosition.GetSurrondings().Contains(l1))\n return true;\n if (!position.GetSurrondings().Contains(l1))\n return true;\n if (!position.Equals(aimPosition) && !position.Equals(l1))\n return true;\n }\n return false;\n }\n\n \n public class Position\n {\n \n private static readonly Dictionary Positions = new Dictionary\n {\n {'a', 1},\n {'b', 2},\n {'c', 3},\n {'d', 4},\n {'e', 5},\n {'f', 6},\n {'g', 7},\n {'h', 8}\n };\n \n public int X { get; }\n public int Y { get; }\n private char q;\n\n public Position(string position)\n {\n var splits = position.ToCharArray();\n X = Positions[splits[0]];\n Y = int.Parse(splits[1].ToString());\n q = splits[0];\n }\n\n public Position(int x, int y)\n {\n X = x;\n Y = y;\n q = Positions.FirstOrDefault(z => z.Value == x).Key;\n }\n\n \n protected bool Equals(Position other)\n {\n return X == other.X && Y == other.Y;\n }\n\n public override string ToString()\n {\n return $\"{q}{Y}\";\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj)) return false;\n if (ReferenceEquals(this, obj)) return true;\n if (obj.GetType() != this.GetType()) return false;\n return Equals((Position) obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (X * 397) ^ Y;\n }\n }\n }\n \n private static string ReadData()\n {\n //return File.ReadAllLines(\"1.txt\").Single();\n return Console.ReadLine();\n //yield return Console.ReadLine();\n }\n\n //private static IEnumerable ReadData()\n //{\n // //return File.ReadAllLines(\"1.txt\");\n // while (true)\n // {\n // var line = Console.ReadLine();\n // if (string.IsNullOrEmpty(line))\n // yield break;\n // yield return line;\n\n // }\n //}\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2a4f136ff580b46b90943c51030741e3", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "#include \n#include \nusing namespace std;\n\nstring convert_to_base4(string &s)\n{\n const int size = s.size();\n const int constraint = size % 2 == 0 ? 0 : 1;\n string base4 = \"\";\n for (int i = size - 1; i >= constraint; i -= 2)\n {\n string tmp = to_string(s[i] - '0') + to_string(s[i - 1] - '0');\n if (tmp == \"00\")\n base4 = \"0\" + base4;\n else if (tmp == \"01\")\n base4 = \"1\" + base4;\n else if (tmp == \"10\")\n base4 = \"2\" + base4;\n else if (tmp == \"11\")\n base4 = \"3\" + base4;\n }\n\n if (constraint == 1)\n base4 = '1' + base4;\n\n return base4;\n}\n\nint max(string &base4)\n{\n string tmp = \"1\";\n const int base4_size = base4.size() - 1;\n for (int i = 0; i < base4_size; ++i)\n tmp = '0' + tmp;\n\n if (base4 > tmp)\n return base4.size();\n else\n return base4.size() - 1;\n}\n\nint main()\n{\n string s;\n cin >> s;\n\n string base4 = convert_to_base4(s);\n cout << max(base4) << endl;\n\n return 0;\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f3dee4ddaafead8219ca7c5f6f7e1d93", "src_uid": "d8ca1c83b431466eff6054d3b422ab47", "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 > 1; i--) {\n for (int j = 0; j < mainStr.Length - i; j++) {\n string subs = mainStr.Substring(j, i);\n int tmp = KMP(mainStr, subs);\n if (tmp >= 2) {\n println(subs.Length);\n close(file);\n return;\n }\n }\n }\n\n println(0);\n\n\n#if DEBUG\n close(file);\n#endif\n }\n\n static int KMP(string mainStr, string subs) {\n int count = 0;\n int[] fail = new int[subs.Length+1];\n\n fail[1] = 0;\n for(int i=2; i<=subs.Length; i++){\n int tmp=fail[i-1];\n while(tmp>0 && subs[tmp]!=subs[i-1]) tmp=fail[tmp];\n fail[i] = tmp + 1;\n }\n\n int posInText=0, posInSubs = 0;\n while (posInText < mainStr.Length) {\n if (posInSubs == 0 || mainStr[posInText] == subs[posInSubs])\n {\n posInSubs++;\n posInText++;\n } else {\n posInSubs = fail[posInSubs];\n }\n\n if (posInSubs == subs.Length) {\n count++;\n posInText = posInText - posInSubs + 1;\n posInSubs = 0;\n }\n }\n\n return count;\n }\n\n\n#if DEBUG\n static bool file = true;\n static TextReader fin = new StreamReader(\"input.txt\");\n static TextWriter fout = new StreamWriter(\"output.txt\");\n static void open(bool f) { if (f) { Console.SetIn(fin); Console.SetOut(fout); } }\n static void close(bool f) { if (f) fout.Close(); }\n#endif\n struct pair { public T1 first; public T2 second; }\n static void fill(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }\n static void fill(List d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }\n static void swap(List l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int readInt() { return int.Parse(RL()); }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9eca269aaf6e5af5ca17bceb85b0e438", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.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 static void Main(string[] args)\n {\n int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = nums[0];\n int k = nums[1];\n int x = 0;\n int b = n / GCD(n, k);\n int a = n / b;\n int min = a * k + b;\n for (int i = 1; i <= n; i++)\n {\n if (n%i == 0)\n {\n b = n / i;\n a = n / b;\n int tmp = a * k + b;\n if (tmp%k != 0)\n {\n x = tmp;\n }\n else\n {\n x = min;\n }\n }\n if (min > x)\n {\n min = x;\n }\n }\n Console.WriteLine(min);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b55b6bacc9d5f1938b6aebc6b128689e", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\n// ~\n\nnamespace CF {\n class Program {\n 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 for (int i = 0; i < 8; i++) {\n var line = reader.ReadLine().ToCharArray();\n for (int j = 1; j < line.Length; j++) {\n if (line[j - 1] == line[j]) {\n writer.WriteLine(\"NO\");\n //writer.Close();\n return;\n }\n }\n }\n \n \n writer.WriteLine(\"YES\");\n //writer.Close();\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "cd5bda15ce6f277f4fd21975ff231e20", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Calculator\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint tamano = Convert.ToInt32(Console.ReadLine());\n\t\t\tstring texto = Console.ReadLine();\n\n\t\t\tString final = new String(\"\");\n\t\t\tint f = 1;\n\n\t\t\tfor(int i = 1; (f - 1) < tamano; i++)\n\t\t\t{\n\t\t\t\tfinal += texto.Substring(f - 1, 1);\n\t\t\t\tf = f + i;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(final);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "48afeb710de9fc8381e31ee3624b0d6a", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "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 int n = Convert.ToInt32(Console.ReadLine());\n if(n % 2 == 0) {\n Console.WriteLine(\"Mahmoud\")\n } else {\n Console.WriteLine(\"Ehab\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "b1bab39afe9438e230b260deae2fb195", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0} {"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 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": true, "code_uid": "3f8897f0d3cea7836f90f2bc9ec33024", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800.0} {"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 Console.ReadKey();\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": "646bcb05ccfb5103e83130be57b5ae22", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5", "difficulty": 1100.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; s++) {\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) {\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": "813c712bd57d3f5abe90d432f997f3f7", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace LuckySubstring\n{\n class Program\n {\n static bool IsLucky(BigInteger n)\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 static void Main(string[] args)\n {\n var luckyNumbers = new List();\n for (var n = 1; n <= 1000; n++)\n {\n if (IsLucky(n)) luckyNumbers.Add(n);\n }\n\n var answers = new Dictionary();\n string input = Console.ReadLine();\n if (!string.IsNullOrEmpty(input))\n {\n for (var length=1; length maxOcc) maxOcc = num.Value;\n }\n var maxAnswers = new List();\n foreach (var num in answers)\n {\n if (num.Value == maxOcc) maxAnswers.Add(num.Key);\n }\n //Console.WriteLine(\"MaxOcc = {0}\", maxOcc);\n var lexMin = \"99999999999999999999999999999999999999999999999999\";\n foreach (var num in maxAnswers)\n {\n if (string.Compare(num.ToString(), lexMin) < 0) lexMin = num.ToString();\n }\n\n if (lexMin != \"99999999999999999999999999999999999999999999999999\")\n Console.WriteLine(lexMin);\n else Console.WriteLine(\"-1\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c1351778ebf5e8aae3a93e1d4ce79c1e", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "int num = 0;\nstring res = \"No\";\nnum = Convert.ToInt32(Console.ReadLine());\n\nfor (int i = 1; i < num - 1; i++) {\n for (int j = i; j < num - 1; j++) {\n if (num == i * ((i + 1) / 2) + (j * (j + 1) / 2))\n res = \"Yes\";\n }\n}\n\nConsole.WriteLine(\"Is Funky = \" + res);", "lang_cluster": "C#", "compilation_error": true, "code_uid": "02979a5606fe22dc9258e4422d07026e", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System; using System.Linq;\n\nclass P {\n static void Main () {\n\n var strs = new [] {\n\"George Washington, 1789-1797 \",\n\"John Adams, 1797-1801 \",\n\"Thomas Jefferson, 1801-1809 \",\n\"James Madison, 1809-1817 \",\n\"James Monroe, 1817-1825 \",\n\"John Quincy Adams, 1825-1829 \",\n\"Andrew Jackson, 1829-1837 \",\n\"Martin Van Buren, 1837-1841 \",\n\"William Henry Harrison, 1841 \",\n\"John Tyler, 1841-1845 \",\n\"James Knox Polk, 1845-1849 \",\n\"Zachary Taylor, 1849-1850 \",\n\"Millard Fillmore, 1850-1853 \",\n\"Franklin Pierce, 1853-1857 \",\n\"James Buchanan, 1857-1861 \",\n\"Abraham Lincoln, 1861-1865 \",\n\"Andrew Johnson, 1865-1869 \",\n\"Ulysses S. Grant, 1869-1877 \",\n\"Rutherford Birchard Hayes, 1877-1881 \",\n\"James Abram Garfield, 1881 \",\n\"Chester Alan Arthur, 1881-1885 \",\n\"Grover Cleveland, 1885-1889 \",\n\"Benjamin Harrison, 1889-1893 \",\n\"Grover Cleveland, 1893-1897 \",\n\"William McKinley, 1897-1901 \",\n\"Theodore Roosevelt, 1901-1909 \",\n\"William Howard Taft, 1909-1913 \",\n\"Woodrow Wilson, 1913-1921 \",\n\"Warren Gamaliel Harding, 1921-1923\",\n\"Calvin Coolidge, 1923-1929 \",\n\"Herbert Clark Hoover, 1929-1933\",\n\"Franklin Delano Roosevelt, 1933-1945\",\n\"Harry S. Truman, 1945-1953 \",\n\"Dwight David Eisenhower, 1953-1961 \",\n\"John Fitzgerald Kennedy, 1961-1963 \",\n\"Lyndon Baines Johnson, 1963-1969 \",\n\"Richard Milhous Nixon, 1969-1974 \",\n\"Gerald Rudolph Ford, 1974-1977 \",\n\"James Earl Carter, Jr., 1977-1981 \",\n\"Ronald Wilson Reagan, 1981-1989 \",\n\"George Herbert Walker Bush, 1989-1993 \",\n\"William Jefferson Clinton, 1993-2001 \",\n\"George Walker Bush, 2001-2009 \",\n\"Barack Hussein Obama, 2009- \",\n var n = int.Parse(Console.ReadLine());\n var s = strs[n-1].Split(',')[0].Split(' ').Last();\n \n Console.Write(s);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0167a76eeea0e28ae3ef97154ddc4fc6", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Rank\n{\n class Class3\n {\n public static void Main5(string[] args)\n {\n int l =int.Parse(Console.ReadLine());\n var str = Console.ReadLine();\n var ar = new int[l];\n int total = 0;\n for(int i = 0; i < l; i++)\n {\n int a = str[i] - '0';\n total += a;\n ar[i] = a;\n }\n if (total == 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n for(int i = 1; i <= total / 2 + 1; i++)\n {\n if (total % i != 0) continue;\n int st = 0;\n int j = 0;\n for(; j < l; j++)\n {\n st += ar[j];\n if (st == i)\n {\n st = 0;\n }\n else if (st < i) continue;\n else\n {\n break;\n }\n }\n if (st == 0)\n {\n for (; j < l; j++)\n {\n if (ar[j] != 0) break;\n }\n if (j == l) { Console.WriteLine(\"YES\"); return; }\n }\n }\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "4e7b0b821ab0f5947d7890fd773f521a", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "LIB_Mod", "lang_cluster": "C#", "compilation_error": true, "code_uid": "6f30051fc122dbad345e2392cd6cde90", "src_uid": "ff810b16b6f41d57c1c8241ad960cba0", "difficulty": 2300.0} {"lang": "MS C#", "source_code": " static void Main(string[] args)\n {\n int input = Convert.ToInt32(Console.ReadLine());\n int s = NextLuckyYear(input);\n Console.WriteLine(s.ToString());\n }\n\n static int NextLuckyYear(int year)\n {\n int luckyYear = 0;\n string sYear = year.ToString();\n if (sYear.Length == 1)\n {\n return 1;\n }\n string a = (Convert.ToInt32(sYear[0].ToString()) + 1).ToString();\n for (int i = 0; i < sYear.Length - 1; i++)\n {\n a += \"0\";\n }\n luckyYear = year - Convert.ToInt32(a);\n return luckyYear * -1;\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "e3654b4ea9848de5a997b10a9d00d60e", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;namespace C{class A{static void Main(){String[] str = Console.ReadLine().Split();int f = Convert.ToInt32(str[0]);int it = Convert.ToInt32(str[1]);int th = Convert.ToInt32(str[2]);\nchar[][] arr = new char[f][];for (int i = 0; i < f; i++)arr[i] = Console.ReadLine().ToCharArray();int t = 0;for (int i=0;i=th)t++;\n}Console.Write(t);}}}//kitten", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ee790fe393dfd1ffe96ec0c26c19978d", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n class Program\n {\n\n static void Main(string[] args) {\n int[] input = readInts();\n string[] s = new string[input[0]];\n for(int i = 0; i < input[0]; i++) {\n s[i] = Console.ReadLine();\n }\n int ans = 0;\n for(int c = 0; c < input[1]; c++) {\n int count = 0;\n for(int q = 0; q < input[0]; q++) {\n if(s[q][c] == 'Y') {\n count++;\n }\n }\n if(count >= input[2]) {\n ans++;\n }\n }\n Console.WriteLine(ans);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "482b76dbe36311b949cbc8bf47ad2009", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.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 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 }\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": "bebb10eabf5330e35f9fa8027adf03fe", "src_uid": "fa6311c72d90d8363d97854b903f849d", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {0F695567-1A84-448C-B3C5-00F2C4482C03}\n Exe\n Properties\n prC\n prC\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 Always\n \n \n \n \n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "bd728357fbd6f9e2e69936f75e85c333", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "difficulty": 1600.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}\") = \"A.Contest\", \"A.Contest\\A.Contest.csproj\", \"{1E33F78A-68B3-42F4-A54D-07412C28A48F}\"\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{1E33F78A-68B3-42F4-A54D-07412C28A48F}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{1E33F78A-68B3-42F4-A54D-07412C28A48F}.Debug|x86.Build.0 = Debug|x86\n\t\t{1E33F78A-68B3-42F4-A54D-07412C28A48F}.Release|x86.ActiveCfg = Release|x86\n\t\t{1E33F78A-68B3-42F4-A54D-07412C28A48F}.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": "3cf3f57b57f4d20cbfd157f5ccc0d356", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0} {"lang": "MS C#", "source_code": "using System;\npublic class CF{\n public static void Main(){\n int n = int.Parse(Console.ReadLine());\n int xmin = int.MaxValue, ymin = int.MaxValue, xmax = int.MinValue, ymax = int.MinValue; \n for (int i = 0; i < n; i++)\n\t\t\t{\n var xy = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();\n xmin = Math.Min(xy[0],xmin);\n ymin = Math.Min(xy[1],xmin);\n xmax = Math.Max(xy[0],xmax);\n ymax = Math.Max(xy[1],xmax);\n\t\t\t \n\t\t\t}\n Console.WriteLine(Math.Abs(xmax-xmin)*Math.Abs(ymax-ymin)>0?Math.Abs(xmax-xmin)*Math.Abs(ymax-ymin):-1);\n //Console.ReadKey();\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "fbe15433c7c9921478cf0575e8560615", "src_uid": "ba49b6c001bb472635f14ec62233210e", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace CodeForces\n{\n class Program\n {\n struct Matrix\n {\n public BigInteger A1, A2, A3, A4;\n\n public static Matrix Mul(Matrix m1, Matrix m2)\n {\n Matrix result = new Matrix();\n result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;\n result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;\n result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;\n result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;\n return result;\n }\n\n public void Mod(long mod)\n {\n A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;\n }\n\n public static Matrix PowerMod(long power, Matrix m, long mod)\n {\n Matrix modLast = m, result = new Matrix();\n\n while (power != 0)\n {\n if ((power & 1) == 1)\n {\n if (result.A1 == 0)\n result = modLast;\n else\n result = Matrix.Mul(result, modLast);\n\n result.Mod(mod);\n }\n\n modLast = Matrix.Mul(modLast, modLast);\n modLast.Mod(mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n 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": true, "code_uid": "c87fd91b4565e13b00c93d9192c2c7af", "src_uid": "cbf786abfceeb8df29732c8a872f7f8a", "difficulty": 2900.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.CFE38 {\n public class TaskA : IProblem {\n public static void Main(string[] args) {\n new TaskA().Solve(Console.In, Console.Out);\n }\n\n public void Solve(TextReader input, TextWriter output) {\n // INPUT\n var n = int.Parse(input.ReadLine());\n var s = input.ReadLine();\n\n // SOLUTION\n var sb = new StringBuilder();\n bool prev = false;\n foreach (var c in s) {\n if (IsVowel(c)) {\n if (!prev) {\n prev = true;\n sb.Append(c);\n }\n }\n else {\n prev = false;\n sb.Append(c);\n }\n }\n\n // OUTPUT\n output.WriteLine(sb.ToString());\n }\n\n\n private static bool IsVowel(char c) => \"aeiouy\".Contains(c);\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "dccc8d83f345aeb2ae83b531f529c774", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static int ReadInt() => int.Parse(Console.ReadLine());\n static string ReadString() => Console.ReadLine();\n static int[] ReadIntArray() => (Console.ReadLine().Split(' ')).Select(int.Parse).ToArray();\n static double[] ReadDoubleArray() => (Console.ReadLine().Split(' ')).Select(double.Parse).ToArray();\n static long[] ReadLongArray() => (Console.ReadLine().Split(' ')).Select(long.Parse).ToArray();\n static List ReadIntList() => (Console.ReadLine().Split(' ')).Select(int.Parse).ToList();\n static List ReadLongList() => (Console.ReadLine().Split(' ')).Select(long.Parse).ToList();\n static char[] ReadCharArray() => (Console.ReadLine().Split(' ')).Select(char.Parse).ToArray();\n\n public struct P {\n int x;\n int y;\n public P(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n }\n\n static void Main(string[] args)\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 private static int Foo(string s)\n {\n int ans = 0;\n if (s.Any(i => char.IsDigit(i))) ans++;\n if (s.Any(i => char.IsLower(i))) ans++;\n if (s.Any(i => char.IsUpper(i))) ans++;\n return ans;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "23152d68c9a983779d36c5f1ab8a1def", "src_uid": "259d01b81bef5536b969247ff2c2d776", "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 ForCodeForses\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n, s;\n\t\t\tn = Convert.ToInt32(Console.ReadLine());\n\t\t\tstring line = Console.ReadLine();\n\t\t\tstring[] arr = line.Split(' ');\n\n\t\t\tArray.Sort(arr);\n\n\t\t\tint[] f = arr.Select(ch = > int.Parse(ch.ToString())).ToArray();\n\n\t\t\ts = 1;\n\n\t\t\tfor (int j = n - 1; j > 1; j--)\n\t\t\t{\n\t\t\t\tif (f[j - 1] != 0)\n\t\t\t\t{\n\t\t\t\t\tif (f[j] != f[j - 1])\n\t\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t\telse break;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(s);\n\t\t\tConsole.ReadKey();\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "f36bcb4a7a7ac02a4b6654e3269d8985", "src_uid": "3b520c15ea9a11b16129da30dcfb5161", "difficulty": 800.0} {"lang": "MS C#", "source_code": "class Module1 {\n \n static void Main() {\n Int64 n = Console.ReadLine;\n Int64 i = (Math.Sqrt(ShiftLeft(n, 1)) - 5);\n if ((i < 0)) {\n i = 0;\n }\n \n while (((i \n * ((i + 1) \n / 2)) \n <= n)) {\n i++;\n }\n \n Int64 ans = (i \n - ((i \n * ((i + 1) \n / 2)) \n - n));\n if ((ans == 0)) {\n ans = (i - 1);\n }\n \n Console.WriteLine(ans);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "1fa1bd50d9a1a5ed64ddf614d0f255e1", "src_uid": "1db5631847085815461c617854b08ee5", "difficulty": 1000.0} {"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\r\n\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": "072c2f3561a3733af5cc380114d69eb5", "src_uid": "fe126aaa93acaca8c8559bc9e7e27b9f", "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.2036\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp4\", \"ConsoleApp4\\ConsoleApp4.csproj\", \"{3B7F4C3F-6B88-46A2-B0A9-0B0CD010E181}\"\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{3B7F4C3F-6B88-46A2-B0A9-0B0CD010E181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{3B7F4C3F-6B88-46A2-B0A9-0B0CD010E181}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{3B7F4C3F-6B88-46A2-B0A9-0B0CD010E181}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{3B7F4C3F-6B88-46A2-B0A9-0B0CD010E181}.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 = {65F1C66D-5F75-4DF1-9653-59C07F14E27E}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "2a0e624d40aff9d3b08efada88a7a22c", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "difficulty": 800.0} {"lang": "Mono C#", "source_code": " public class Program\n {\n public static void Main(string[] args)\n {\n var number = Convert.ToInt32(Console.ReadLine());\n Console.Write(number % 2);\n }\n }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "eb6f2c440a84c916d343d791309eadbe", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeff\n\n \n \n Debug\n AnyCPU\n {C845BAA9-539D-4B68-AE7F-F777A4F5311A}\n Exe\n D_CS\n D_CS\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": "c89542cca0b20282f842689a59c8529f", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "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.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 ??= 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": "012d02a8f8d1301966f805afec968a1a", "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\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": "f0e4434106b3ef7548c5eb369ee9a030", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\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": "398fd857f41994a265aea10b1272d8eb", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\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": "a769b55c6de476f1d734236d04b2c0b2", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"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().Split(' ');\n a = Convert.ToInt32(s[0]);\n b = Convert.ToInt32(s[1]);\n c = Convert.ToInt32(s[2]);\n Console.WriteLine(a * b * c - (a - 1) * (b - 1) * (c - 1));\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "ccddd1741af0ea79bbd5f23495eef306", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "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 }", "lang_cluster": "C#", "compilation_error": true, "code_uid": "898f2bb7fc1608037735762ffd99b599", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "#define _LOCAL_VAN\n\nusing System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Drawing;\nusing System.Drawing.Imaging;\nusing System.Drawing.Printing;\nusing System.IO;\n\n\nnamespace ConsoleApplication1\n{\n\n\n class Program\n {\n public class TaskE\n {\n private long x, y;\n\n public void ReadInput()\n {\n#if DEBUG\n Console.SetIn(File.OpenText(\"Test.txt\"));\n#endif\n var arr = Console.ReadLine().Split(\" \".ToCharArray()).Select(x => long.Parse(x)).ToArray();\n x = arr[0];\n y = arr[1];\n }\n\n public BigInteger Mx(long a, long b)\n {\n return new BigInteger(a) * b;\n }\n\n public long Bs(Func F)\n {\n long l = 1;\n long r = (long) 1e18;\n while (l <= r)\n {\n long mid = (l + r)/2;\n bool res = F(mid);\n if (!res)\n l = mid + 1;\n else\n r = mid - 1;\n }\n return l;\n }\n\n public void Solve()\n {\n ReadInput();\n long xA = 1;\n long xB = 0;\n long yA = 0;\n long yB = 1;\n long xM = 1;\n long yM = 1;\n\n List> ans = new List>();\n while (Mx(xM, y) != Mx(yM, x))\n {\n long xMn, yMn;\n bool p;\n long n;\n if (Mx(x, yM) > Mx(y, xM)) // Alice: x/y > xM/yM\n {\n n = Bs(k => Mx(xM + k * xA, y) >= Mx(yM + k * yA, x)); // xM + k * xA / yM + k * yA >= x / y\n p = true;\n xB = xM + (n - 1) * xA;\n yB = yM + (n - 1) * yA;\n xM = xM + n * xA;\n yM = yM + n * yA;\n }\n else // Bob: x/y < xM/yM\n {\n n = Bs(k => Mx(xM + k * xB, y) <= Mx(yM + k * yB, x)); // xM + k * xA / yM + k * yA <= x / y\n p = false;\n xA = xM + (n - 1) * xB;\n yA = yM + (n - 1) * yB;\n xM = xM + n * xB;\n yM = yM + n * yB;\n }\n ans.Add(Tuple.Create(n, p));\n }\n if (xM != x || yM != y)\n {\n Console.WriteLine(\"Impossible\");\n return;\n }\n\n foreach (var t in ans)\n {\n Console.Write(\"{0}{1}\", t.Item1, t.Item2 ? 'A' : 'B');\n }\n }\n \n }\n\n static void Main(string[] args)\n {\n TaskE e = new TaskE();\n e.Solve();\n }\n }\n}\n\n/*\n5372\n\n548311022282575478768582833326463951961872181\n548311022282908812101916166659797285295205514\n*/\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "0e9bed4e5e744a8bd6c8e979429db314", "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\n 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 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": "9a2cb0b63008629bc468940f75cd0ee0", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.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 var f = new char[9][];\n ReadField(f);\n var x = input.ReadInt() - 1;\n var y = input.ReadInt() - 1;\n var fx = x % 3;\n var fy = y % 3;\n if (!TryFillField(f, fx, fy))\n FillAll(f);\n PrintField(f);\n }\n\n private void ReadField(char[][] f)\n {\n for (int i = 0; i < 9; i++)\n {\n if (i != 0 && i % 3 == 0)\n input.ReadLine();\n f[i] = string.Join(\"\", input.ReadLine().Split()).ToCharArray();\n }\n }\n\n private void PrintField(char[][] f)\n {\n var sb = new StringBuilder();\n for (int i = 0; i < 9; i++)\n {\n if (i != 0 && i % 3 == 0)\n sb.AppendLine();\n for (int j = 0; j < 9; j++)\n {\n if (j != 0 && j % 3 == 0)\n sb.Append(' ');\n sb.Append(f[i][j]);\n }\n sb.AppendLine();\n }\n Console.Write(sb);\n }\n\n private void FillAll(char[][] f)\n {\n for (int i = 0; i < 9; i++)\n for (int j = 0; j < 9; j++)\n if (f[i][j] == '.')\n f[i][j] = '!';\n }\n\n private bool TryFillField(char[][] f, int fx, int fy)\n {\n bool result = false;\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n int lx = fx * 3 + i;\n int ly = fy * 3 + j;\n if (f[lx][ly] == '.')\n {\n f[lx][ly] = '!';\n result = true;\n }\n }\n }\n return result;\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private const string ABC = \"abcdefghijklmnopqrstuvwxyz\";\n\n private static void AddCount(Dictionary counter, T item)\n {\n int count;\n if (counter.TryGetValue(item, out count))\n counter[item] = count + 1;\n else\n counter.Add(item, 1);\n }\n\n private static int GetCount(Dictionary counter, T item)\n {\n int count;\n return counter.TryGetValue(item, out count) ? count : 0;\n }\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n int t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "df0d9d2cc215e2aee6736cf6fe687fd9", "src_uid": "8f0fad22f629332868c39969492264d3", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Codeforces {\n\tclass MyClass {\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tSystem.Threading.Thread.CurrentThread.CurrentUICulture \n\t\t\t\t= new System.Globalization.CultureInfo(\"ja-JP\");\n\t\t\tstring[] ss = Console.ReadLine().Split(' ');\n\t\t\tint n = int.Parse(ss[0]);\n\t\t\tint m = int.Parse(ss[1]);\n\t\t\tint s = int.Parse(ss[2]);\n\t\t\tlong ans = 0;\n\t\t\tans = ((m-1)/s+1) * ((m-1)%s+1);\n\t\t\tans *= ((n-1)/s+1) * ((n-1)%s+1);\n\t\t\tConsole.WriteLine (ans);\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0c020170bb3553fbc8b5c18c82ef427f", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nnamespace Iran{\n class amir\n {\n public static void Main()\n {\n int x,y,s;\n string[] input=Console.ReadLine().Split(' ');\n x=Int32.Parse(input[0]);\n y=Int32.Parse(input[1]);\n s=Int32.Parse(input[2]);\n long yek,dow;\n if(x%s==0)\n yek=x;\n else\n {\n yek=(x%s)*(x/s+1);\n }\n if(y%s==0)\n dow=y;\n else\n {\n dow=(y%s)*(y/s+1);\n }\n long ans=dow*yek;\n Console.WriteLine(ans);\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aa169b0e3a4079f85405c47ba9bd7c31", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\n\n\n\n\nclass Program\n{\n\n void solve()\n {\n long n = nextInt();\n long m = nextInt();\n long s = nextInt();\n long res = get(n, s);\n res *= get(m, s);\n println(res);\n }\n\n private long get(long n, long s)\n {\n long most = (n - 1) / s;\n int res = 0;\n for (int i = 0; i < n; i++)\n {\n long cur = (n - 1 - i) / s;\n cur += i / s;\n if (cur == most)\n res++;\n }\n return 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 new Program().solve();\n }\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aed36cd0179f607d4c0adf56ef7e2dca", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.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>=endtime) break;\n if(start+time>starttime)ans++;\n start += chastota;\n }\n \n \n Console.WriteLine(ans);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9836b0914c191bb15cfb0c8830817a4a", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Solution\n{\n\tstatic void 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": false, "code_uid": "aafc881186694c4dd419c2378f437bea", "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 >= endtime || start > 1439) break;\n if (start + time > starttime)\n {\n ans++;\n }\n start += chastota;\n }\n\n\n Console.WriteLine(ans);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4fe1879152294b20b51ed93a93d18608", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "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 _12a\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 a = d[0];\n var ta = d[1];\n\n d = readIntArray();\n var b = d[0];\n var tb = d[1];\n\n var f = Console.ReadLine().Split(':').Select(k => int.Parse(k)).ToArray();\n var hh = f[0];\n var mm = f[1];\n\n var dt = hh * 60 + mm;\n var at = dt + ta;\n var next = 5 * 60;\n var c = 0;\n var fin = 23 * 60 + 59;\n while (true)\n {\n if (next > fin)\n {\n break;\n }\n\n if (next >= dt && next < at)\n {\n c++;\n }\n\n if (next < dt && next + tb > dt)\n {\n c++;\n }\n\n next += b;\n }\n\n Console.WriteLine(c);\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": "015c4580bda805b46e3ec35a68a24ccf", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n bool[,] vis = new bool[2 * n + 1, 2 * n + 1];\n int x = n;\n int y = n;\n vis[x, y] = true;\n bool ok = true;\n int ex = -1;\n int ey = -1;\n for (int i = 0; i < t.Length; i++)\n {\n int nx, ny;\n nx=x;\n ny=y;\n if (t[i] == 'D')\n ny--;\n if (t[i] == 'U')\n ny++;\n if (t[i] == 'L')\n nx--;\n if (t[i] == 'R')\n nx++;\n vis[nx, ny] = true;\n x = nx;\n y = ny;\n ex = x;\n ey = y;\n \n }\n if (!ok)\n ;\n else\n {\n int[,] d = new int[2 * n + 1, 2 * n + 1];\n d[n, n] = 0;\n for (int i = 0; i < 2 * n + 1; i++)\n for (int j = 0; j < 2 * n+1; j++)\n if (i != n || j != n)\n d[i, j] = -1;\n Queue q = new Queue();\n x = n;\n y = n;\n q.Enqueue(x);\n q.Enqueue(y);\n while (q.Count > 0)\n {\n x = q.Dequeue();\n y = q.Dequeue();\n for (int dx = -1; dx <= 1; dx++)\n for (int dy = -1; dy <= 1; dy++)\n if (dx == 0 ^ dy == 0)\n {\n int nx = x + dx;\n int ny = y + dy;\n if (nx < 0 || nx > 2 * n || ny < 0 || ny > 2 * n || !vis[nx, ny] || d[nx, ny] != -1)\n continue;\n d[nx, ny] = 1 + d[x, y];\n q.Enqueue(nx);\n q.Enqueue(ny);\n\n }\n }\n if (d[ex, ey] == t.Length)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"BUG\");\n }\n // Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e4712910677830ba4a8dc0ea06c70b78", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.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 var movementString = Console.ReadLine().ToCharArray();\n\n HashSet> pos = new HashSet>();\n\n Console.WriteLine(IsShortestPathCandidate(movementString, 0, pos, 0, 0) ? \"OK\" : \"BUG\");\n }\n\n private static bool IsShortestPathCandidate(char[] movementString, int i, HashSet> pos, int x, int y)\n {\n if (pos.Contains(new Tuple(x, y)))\n return false;\n\n if (AdjacentVisitedPoints(x, y, pos) > 1)\n return false;\n\n if (i == movementString.Length)\n return true;\n\n pos.Add(new Tuple(x, y));\n\n switch (movementString[i])\n {\n case 'L':\n return IsShortestPathCandidate(movementString, i + 1, pos, x, y - 1);\n case 'R':\n return IsShortestPathCandidate(movementString, i + 1, pos, x, y + 1);\n case 'U':\n return IsShortestPathCandidate(movementString, i + 1, pos, x - 1, y);\n default:\n return IsShortestPathCandidate(movementString, i + 1, pos, x + 1, y);\n }\n }\n\n private static int AdjacentVisitedPoints(int x, int y, HashSet> pos)\n {\n int vis = 0;\n\n if (pos.Contains(new Tuple(x + 1, y)))\n vis++;\n\n if (pos.Contains(new Tuple(x - 1, y)))\n vis++;\n\n if (pos.Contains(new Tuple(x, y + 1)))\n vis++;\n\n if (pos.Contains(new Tuple(x, y - 1)))\n vis++;\n\n return vis;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "45d02d0a61f08bbf0a38a3e27cec3f66", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.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 public void solve(TextReader input, TextWriter output) {\n string steps = input.ReadLine();\n\n int n = steps.Length * 2 + 3;\n int[,] map = new int[n, n];\n\n int x = n / 2;\n int y = x;\n map[x, y] = 1;\n foreach (char step in steps)\n {\n if (step == 'L')\n x--;\n if (step == 'R')\n x++;\n if (step == 'U')\n y++;\n if (step == 'D')\n y--;\n map[x, y]++;\n\n \n int val = map[x, y - 1] +\n map[x - 1, y] + map[x, y] + map[x + 1, y]\n + map[x, y + 1];\n if(val > 2)\n {\n output.WriteLine(\"BUG\");\n return;\n }\n }\n\n output.WriteLine(\"OK\");\n }\n}\n\nclass CaideConstants {\n public const string InputFile = null;\n public const string OutputFile = null;\n}\npublic class Program {\n public static void Main(string[] args) {\n Solution solution = new Solution();\n using (System.IO.TextReader input =\n CaideConstants.InputFile == null ? System.Console.In :\n new System.IO.StreamReader(CaideConstants.InputFile))\n using (System.IO.TextWriter output =\n CaideConstants.OutputFile == null ? System.Console.Out:\n new System.IO.StreamWriter(CaideConstants.OutputFile))\n\n solution.solve(input, output);\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "151e86ee0bc9dc02e54d51c4a078bca3", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "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 _8b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var s = Console.ReadLine();\n var n = s.Length;\n var t = new int[2 * n + 5, 2 * n + 5];\n var x = n;\n var y = n;\n t[y, x] = 1;\n for (int i = 0; i < n; i++)\n {\n var next = s[i];\n if (next == 'L')\n {\n y--;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n t[y + 1, x - 1] = 1;\n t[y + 1, x + 1] = 1;\n t[y + 1 - 1, x] = 1;\n t[y + 1 + 1, x] = 1;\n }\n }\n else if (next == 'R')\n {\n y++;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n t[y - 1, x - 1] = 1;\n t[y - 1, x + 1] = 1;\n t[y - 1 - 1, x] = 1;\n t[y - 1 + 1, x] = 1;\n }\n }\n else if (next == 'U')\n {\n x++;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n t[y, x - 1 - 1] = 1;\n t[y , x + 1 - 1] = 1;\n t[y - 1, x - 1] = 1;\n t[y + 1, x - 1] = 1;\n }\n }\n else if (next == 'D')\n {\n x--;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n t[y, x - 1 + 1] = 1;\n t[y, x + 1 + 1] = 1;\n t[y - 1, x + 1] = 1;\n t[y + 1, x + 1] = 1;\n }\n }\n }\n\n Console.WriteLine(\"OK\");\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e0ad2f2f9b86994ae4484b20e5c98d06", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "MS 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 ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool[,] map;\n \n string s = Console.ReadLine();\n int l, r, u, d;\n int x, X, y, Y;\n x = X = y = Y = 0;\n l = r = u = d = 0;\n foreach (char c in s)\n {\n switch (c)\n {\n case('L'):\n l++;\n break;\n case('R'):\n l--;\n break;\n case('U'):\n u++;\n break;\n case('D'):\n u--;\n break;\n }\n if (l > X)\n {\n X = l;\n }\n if (l < x) x = l;\n if (u < y) y = u;\n if (u > Y) Y = u;\n \n\n }\n map = new bool[Y - y+1, X - x+1];\n int ly=Y-y+1;\n int lx=X-x+1;\n int startx = X;\n int starty = Y;\n int i = starty;\n int j = startx;\n foreach (char c in s)\n {\n map[i, j] = true;\n switch (c)\n {\n case ('L'):\n j--;\n break;\n case ('R'):\n j++;\n break;\n case ('U'):\n i--;\n break;\n case ('D'):\n i++;\n break;\n }\n }\n map[i,j]=true;\n int[,] a = new int[ly, lx];\n for (int k = 0; k= dist)\n {\n a[i, j] = dist;\n if (i + 1 < ly && map[i + 1, j]) findRoad(a, map, i + 1, j, a[i, j] + 1, lx, ly);\n if (i > 0 && map[i - 1, j]) findRoad(a, map, i - 1, j, a[i, j] + 1, lx, ly);\n if (j + 1 < lx && map[i, j + 1]) findRoad(a, map, i, j + 1, a[i, j] + 1, lx, ly);\n if (j > 0 && map[i, j - 1]) findRoad(a, map, i, j - 1, a[i, j] + 1, lx, ly);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "399cbe996d01799eaeef8df27b51ebf7", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace NS\n{\n\tclass MainClass\n\t{\n\t\tstatic List xa, ya;\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tvar s = Console.ReadLine ();\n\n\t\t\txa = new List ();\n\t\t\tya = new List ();\n\t\t\tint x = 0;\n\t\t\tint y = 0;\n\t\t\txa.Add(0);\n\t\t\tya.Add(0);\n\t\t\tforeach (var c in s) {\n\t\t\t\tif (c=='L')\n\t\t\t\t\tx--;\n\t\t\t\tif (c=='R')\n\t\t\t\t\tx++;\n\t\t\t\tif (c=='U')\n\t\t\t\t\ty++;\n\t\t\t\tif (c=='D')\n\t\t\t\t\ty--;\n\n\t\t\t\tfor(int i = 0; i();\n while (idx != parent[idx]) {\n compress.Add(idx);\n idx = parent[idx];\n }\n\n foreach (var e in compress) { // path compress \n parent[e] = idx;\n }\n return idx;\n }\n\n public void Union(int a, int b) {\n int aPar = this.Find(a);\n int bPar = this.Find(b);\n\n if (rank[aPar] > rank[bPar]) { // by rank\n parent[bPar] = aPar;\n } else {\n parent[aPar] = bPar;\n }\n if (rank[aPar] == rank[bPar]) {\n ++rank[bPar];\n }\n }\n}\n\nclass MaxHeap {\n List data;\n\n public MaxHeap() {\n data = new List();\n }\n\n public void Add(int a) {\n data.Add(a);\n int idx = data.Count - 1;\n int parent = (int) Math.Floor((double) (idx - 1) / 2);\n while (idx != 0 && (data[idx] > data[parent])) {\n int tmp = data[parent];\n data[parent] = data[idx];\n data[idx] = tmp;\n\n idx = parent;\n parent = (int) Math.Floor((double) (idx - 1) / 2);\n }\n }\n\n public int Pop() {\n int res = data[0];\n data[0] = data[data.Count - 1];\n data.RemoveAt(data.Count - 1);\n\n int idx = 0;\n while (true) {\n int child1 = (2 * idx) + 1;\n int child2 = (2 * idx) + 2;\n\n if (child1 >= data.Count) { // no children\n break;\n } else if (child2 >= data.Count) { // one child\n if (data[idx] < data[child1]) {\n int tmp = data[idx];\n data[idx] = data[child1];\n data[child1] = tmp;\n }\n break;\n } else { // two children\n int maxChild = data[child1] > data[child2] ? child1 : child2;\n if (data[idx] < data[maxChild]) {\n int tmp = data[idx];\n data[idx] = data[maxChild];\n data[maxChild] = tmp;\n idx = maxChild;\n continue;\n } else { // no swap\n break;\n }\n }\n } \n\n return res; \n }\n\n\n}\n\n\nclass Dequeue {\n public Dictionary data = new Dictionary();\n int firstIdx;\n public int Count;\n public Dequeue() {\n data = new Dictionary();\n firstIdx = 1;\n Count = 0;\n }\n\n public void PushFront(int a) {\n data[firstIdx - 1] = a;\n ++Count;\n --firstIdx;\n }\n\n public void PushBack(int a) {\n data[firstIdx + Count] = a;\n ++Count;\n }\n\n public int PopFront() {\n --Count;\n ++firstIdx;\n return data[firstIdx - 1];\n }\n\n public int PopBack() {\n --Count;\n return data[firstIdx + Count];\n }\n\n public int Get(int n) {\n return data[firstIdx + n];\n }\n}\n/******************************************************************************/\n\nclass MainClass {\n\n // Debug functions \n static void debug(IEnumerable a, string s = \"\") {\n Console.WriteLine($\"name: {s}\");\n int i = 0;\n foreach (var e in a) {\n Console.WriteLine($\"value {i}: {e}\");\n ++i;\n }\n }\n static void dbg(T a, string s = \"\") {\n Console.WriteLine($\"name: {s} value: {a}\");\n }\n ////////////////////\n \n static int gcd(int a, int b) {\n while (b != 0) {\n int t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n // class PairInt{\n // public int fst;\n // public int snd;\n\n // // void Add(Pair p) {\n // // fst += p.fst;\n // // snd += p.snd;\n // // }\n // }\n\n public static void Main() {\n \n var sc = new Scanner();\n var wr = new BufferedStdoutWriter();\n var dot = new NumberFormatInfo();\n dot.NumberDecimalSeparator = \".\";\n\n // int T = sc.NextInt();\n\n // for (int t = 0; t < T; ++t) {\n // }\n\n string s = sc.Next();\n\n var visited = new HashSet>();\n var dir = new Dictionary>{\n {'R', new Tuple(1, 0)},\n {'L', new Tuple(-1, 0)},\n {'U', new Tuple(0, 1)},\n {'D', new Tuple(0, -1)}\n };\n \n\n var pos = new Tuple(0, 0);\n visited.Add(pos);\n\n foreach (var e in s) {\n var prev = pos;\n pos = new Tuple(pos.Item1 + dir[e].Item1, pos.Item2 + dir[e].Item2);\n\n visited.Add(pos);\n\n foreach (var d in dir.Values) {\n var nbr = new Tuple(pos.Item1 + d.Item1, pos.Item2 + d.Item2);\n if (visited.Contains(nbr) && !(nbr.Equals(prev))) {\n // wr.Write(e);\n // wr.Write(pos);\n // wr.Write(nbr);\n wr.Write(\"BUG\");\n wr.Flush();\n return;\n }\n }\n }\n\n // debug(pos);\n // foreach (var e in visited) {\n // debug(e);\n // }\n\n wr.Write(\"OK\");\n\n wr.Flush();\n\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b0bd69ccfcc4afee80b5174bb0285d75", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n bool[,] vis = new bool[2 * n + 1, 2 * n + 1];\n int r = n;\n int c = n;\n vis[r, c] = true;\n bool ok = true;\n for (int i = 0; i < t.Length; i++)\n {\n int nr, nc;\n nr=r;\n nc=c;\n switch (t[i])\n {\n case 'D':\n nr--;\n break;\n case 'U':\n nr++;\n break;\n case 'L':\n nc--;\n break;\n default:\n nc++;\n break;\n }\n if (vis[nr, nc])\n {\n ok = false;\n break;\n }\n vis[nr, nc] = true;\n\n \n\n\n\n }\n if (ok)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"BUG\");\n }\n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2d8ae63a72c804de31677fa5570acd55", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Kids_Riddle\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private 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 string s = Convert.ToString(n, 16).ToUpper();\n int count = 0;\n foreach (char c in s)\n {\n switch (c)\n {\n case '0':\n case '4':\n case '6':\n case '9':\n case 'A':\n case 'D':\n count++;\n break;\n case '8':\n case 'B':\n count++;\n count++;\n break;\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "21a88cc213909733c12c62bafe9a585f", "src_uid": "16a784cb9953bc91cb2e7767b04b76f2", "difficulty": 2000.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 a, x, y, role, sqr;\n string str;\n string[] split = new string[3];\n str = Console.ReadLine();\n split = str.Split();\n a = Convert.ToInt32(split[0]);\n x = Convert.ToInt32(split[1]);\n y = Convert.ToInt32(split[2]);\n\n if (y % a == 0)\n Console.WriteLine(\"-1\");\n else\n {\n role = y / a + 1;\n if (y < a)\n {\n\n if (Math.Abs(x) < a / 2.0)\n Console.WriteLine(1);\n }\n else\n {\n sqr = role % 2 + 1;\n if (sqr == 1)\n if (Math.Abs(x) < a / 2)\n Console.WriteLine((1 + (role - 2) / 2 * 3)+1);\n else Console.WriteLine(\"-1\");\n else\n if ((x>0)&&(x-a))\n Console.WriteLine((2 + (role - 3) / 2 * 3) + 1);\n else Console.WriteLine(\"-1\");\n\n // 2+(role-3)/2*3\n //1 + (role-2)/2*3\n }\n }\n\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1dc87882e3e90ee9f154c59758faa066", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Hopscotch\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private 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 x = Next();\n int y = Next();\n\n int count;\n if (y%a == 0)\n {\n writer.WriteLine(\"-1\");\n writer.Flush();\n return;\n }\n int row = (y + a - 1)/a;\n if (row == 1 || row%2 == 0)\n {\n if (2*Math.Abs(x) >= a)\n {\n writer.WriteLine(\"-1\");\n writer.Flush();\n return;\n }\n count = row + (row - 1)/2;\n }\n else\n {\n if (Math.Abs(x) >= a || x == 0)\n {\n writer.WriteLine(\"-1\");\n writer.Flush();\n return;\n }\n count = row + (row - 1)/2;\n if (x < 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 int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c04a026049da3a8be33d6a0613c51088", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] numbers = Console.ReadLine().Split(' ');\n int c = int.Parse(numbers[4]), a = int.Parse(numbers[0]), b = int.Parse(numbers[1]), w = int.Parse(numbers[2]), x = int.Parse(numbers[3]);\n double Result = Math.Ceiling((-b + (c - a) * x + 0.0) / (w - x)) + c - a;\n Console.WriteLine(Math.Max(0, Result)); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2f824063e864b179a62be5a8e6a6c21c", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inArray = ReadIntLine();\n int Multiplier = 1000000, Multiplier2 = 100000, Multiplier3 = 10000;\n int a = inArray[0], initialB = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];\n int Tau = 1, aChange = 0;\n int b = initialB;\n\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n aChange++;\n }\n\n while (b != initialB)\n {\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n aChange++;\n }\n Tau++;\n }\n int Result = 0;\n\n double steps = (a - c) / (aChange - Tau);\n int ss = Convert.ToInt32(Math.Floor(steps) - 1);\n Result = Tau * ss;\n c = c - Tau * ss;\n a = a - aChange * ss;\n \n while (c != a)\n {\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n a--;\n }\n c--;\n Result++;\n }\n if (Result < 0)\n Result = 0;\n Console.WriteLine(Result);\n }\n public static int[] ReadIntLine()\n {\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] arr = new int[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n arr[i] = int.Parse(temp[i]);\n return arr;\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7c1e8df4eb11c9247b462326ced776d6", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "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 ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string []numbers = Console.ReadLine().Split(' ');\n int c = int.Parse(numbers[4]), a = int.Parse(numbers[0]), b = int.Parse(numbers[1]), w = int.Parse(numbers[2]), x = int.Parse(numbers[3]);\n int seconds = 0;\n while (c > a)\n {\n c = c - 1;\n if (b >= x)\n b = b - x;\n if (b < x)\n {\n a = a - 1;\n b = w - (x - b);\n }\n seconds++;\n }\n seconds -= 1;\n Console.WriteLine(seconds);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f0f9175f6d29ad4a4a182c85d5324254", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n double[] inArray = ReadIntLine();\n double a = inArray[0], b = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];\n double Result = Math.Ceiling((-b + (c - a) * x + 0.0) / (w - x)) + c - a;\n Console.WriteLine(Math.Max(0, Result));\n }\n public static double[] ReadIntLine()\n {\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] arr = new double[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n arr[i] = double.Parse(temp[i]);\n return arr;\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "83837a45cc02b454d3418f5618ee2969", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n int a1 = Convert.ToInt32(Console.ReadLine());\n int a2 = Convert.ToInt32(Console.ReadLine());\n int k1 = Convert.ToInt32(Console.ReadLine());\n int k2 = Convert.ToInt32(Console.ReadLine());\n int n = Convert.ToInt32(Console.ReadLine());\n int min = Math.Min(a1 + a2, Math.Max(0,n - (a1 * (k1 - 1) + a2 * (k2 - 1))));\n int max = Math.Max(a1 + Math.Max(0,n - a1 * k1) / k2, a2 + Math.Max(0,n - a2 * k2) / k1);\n Console.WriteLine(min + \" \" + max);\n }\n\n }\n\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4e5eb1425d3b254fefb190d3d94ff6cb", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace cf585\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf585A();\n }\n\n public static void solve_cf585A()\n {\n int a1 = Convert.ToInt32(Console.ReadLine());\n int a2 = Convert.ToInt32(Console.ReadLine()); \n int k1 = Convert.ToInt32(Console.ReadLine()); \n int k2 = Convert.ToInt32(Console.ReadLine()); \n int n = Convert.ToInt32(Console.ReadLine()); \n \n int min = n - (a1 * (k1 - 1) + a2 * (k2 - 1));\n\n int sum = 0;\n int i = 0;\n int j = 0;\n\n if (a1 * k1 > a2 * k2)\n {\n while (i < a1 && n - sum >= k1)\n {\n sum += k1;\n i++;\n }\n\n while (j < a2 && n - sum >= k2)\n {\n sum += k2;\n j++;\n }\n }\n else\n {\n while (i < a2 && n - sum >= k2)\n {\n sum += k2;\n i++;\n }\n\n while (j < a1 && n - sum >= k1)\n {\n sum += k1;\n j++;\n }\n }\n\n int max = i + j;\n\n Console.WriteLine(\"{0} {1}\", min, max);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e2590e6a6c37843c95666c0405163f92", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace OneP\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a1,a2,k1,k2,n,n1,n2,t=0;\n a1=Convert.ToInt32(Console.ReadLine());\n a2=Convert.ToInt32(Console.ReadLine());\n k1=Convert.ToInt32(Console.ReadLine());\n k2=Convert.ToInt32(Console.ReadLine());\n n=Convert.ToInt32(Console.ReadLine());\n \n if(k10)&&(a1>0));\n \n \n Console.WriteLine(n1);\n if (n<0)\n Console.WriteLine(t-1);\n else\n Console.WriteLine(t);\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "39dfbd9f7d6bfeaa2faf8fc488408959", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n static void Main() {\n int a1 = Int32.Parse(Console.ReadLine());\n int a2 = Int32.Parse(Console.ReadLine());\n int k1 = Int32.Parse(Console.ReadLine());\n int k2 = Int32.Parse(Console.ReadLine());\n int n = Int32.Parse(Console.ReadLine());\n if(k1 > k2)\n {\n int x = k1;\n k1 = k2;\n k2 = x;\n x = a1;\n a1 = a2;\n a2 = x;\n }\n int t1 = Math.Min(n / k1, a1);\n int maxx = t1 + (n - t1 * k1) / k2;\n n -= ((k1 - 1) * a1 + (k2 - 1) * a2);\n int minn = Math.Max(0, n);\n Console.WriteLine(minn + \" \" + maxx);\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2d5231a30a34d25125ef767967f065b7", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "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 int ans = 0;\n while (n > 0)\n {\n if (n % 8 == 1)\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": "f547751efa138967e6d6eab1996803f0", "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 \n Console.WriteLine(1);\n /*\n watch.Stop();\n var elapsedMs = watch.ElapsedMilliseconds;\n Console.WriteLine(elapsedMs);*/\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "eb906082ee2549c2c616818bd66beeba", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "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 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 if (day == 7)\n {\n WriteLine(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[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 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": "afa8fad8c2d02f16a523c716ec05077c", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "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, M;\n int[] K;\n int[] D, T;\n\n List[] 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 List[400001];\n for (int i = 0; i <= 400000; i++)\n {\n S[i] = new List();\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 int B = 0;\n for (int i = 1; i <= t; i++)\n {\n B++;\n foreach (var type in S[i])\n {\n int min = Math.Min(tmp[type], B);\n tmp[type] -= min;\n B -= min;\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": "f4c53c86bdc3e6ba1a67a4044c10c9b9", "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[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 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": "4f8a8970507c4d6080f255d3ef286b20", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n int N, M;\n int[] K;\n int[] D, T;\n int[] index;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n K = sc.IntArray();\n D = new int[M];\n T = new int[M];\n for (int i = 0; i < M; i++)\n {\n D[i] = sc.NextInt();\n T[i] = sc.NextInt() - 1;\n }\n index = new int[M];\n for (int i = 0; i < M; i++)\n {\n index[i] = i;\n }\n\n Array.Sort(index, (l, r) => D[l].CompareTo(D[r]));\n\n // n\u7a2e\u985e\u3042\u308b\n // \u6bce\u65e51\u7372\u5f97\n // \u901a\u5e382 \u30bb\u30fc\u30eb\u4e2d\u306f1\u652f\u6255\u3048\u3070\u8cb7\u3048\u308b\n // \u7a2e\u985ei\u3092\u4e01\u5ea6k[i]\u500b\u8cb7\u3046\n // \u6bce\u65e50\u500b\u4ee5\u4e0a\u6ce8\u6587\u3067\u304d\u308b\n // \u7a2e\u985et[j]\u306fd[j]\u65e5\u306b\u30bb\u30fc\u30eb\n\n // \n int ng = -1;\n int ok = 400000;\n while (ok - ng > 1)\n {\n int mid = (ok + ng) / 2;\n if (C(mid)) ok = mid;\n else ng = mid;\n }\n\n Console.WriteLine(ok);\n }\n\n // day\u65e5\u306b\u9054\u6210\u3067\u304d\u308b\u304b?\n bool C(int day)\n {\n // \u533a\u9593\u5185\u30bb\u30fc\u30eb\n // \u7a2e\u985e\u3054\u3068\u4e00\u756a\u6700\u5f8c\n // \u524d\u304b\u3089\n\n int[] s = new int[N];\n for (int i = 0; i < N; i++)\n {\n s[i] = int.MaxValue;\n }\n\n for (int i = 0; i < M; i++)\n {\n if (D[index[i]] <= day)\n {\n s[T[index[i]]] = D[index[i]];\n }\n }\n\n var tmp = new int[N];\n for (int i = 0; i < N; i++)\n {\n tmp[i] = i;\n }\n Array.Sort(tmp, (l, r) => s[l].CompareTo(s[r]));\n //if (day == 8)\n //{\n // Console.WriteLine(\"-----\");\n // Console.WriteLine(day);\n // Console.WriteLine(string.Join(\" \", s));\n // Console.WriteLine(string.Join(\" \", tmp));\n //}\n int nokori = 0;\n int m = 0;\n int p = 0;\n for (int i = 0; i < N; i++)\n {\n if (s[tmp[i]] == int.MaxValue)\n {\n nokori += K[tmp[i]];\n }\n else\n {\n // \u8cb7\u3048\u308b\u5206\n // s[i] - m \n \n int tt = Math.Min(K[tmp[i]], s[tmp[i]] - m);\n p += tt;\n m += tt;\n nokori += K[tmp[i]] - tt;\n //if (day == 8)\n //{\n // Console.WriteLine($\"{tmp[i]} {tt} {m}\");\n //}\n }\n }\n //if(day == 8)\n //{\n // Console.WriteLine(\"aaaa\" + m);\n //}\n return nokori * 2 <= day - 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": "552fd97e11bf375388a99addb91362fc", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static int[] Power10 = new int[] { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };\n \n static void Main(string[] args)\n {\n string[] inputStr = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n Console.WriteLine(FindNext(m, n));\n }\n\n static int FindNext(int m, int n)\n { \n int[] code = CalCode(m, n);\n int max = code.Max();\n int length = CalLength(code, max);\n int index = m + length;\n\n while (true)\n {\n index = NextIndex(max, index);\n int[] nCode = CalCode(index - length, n);\n\n if (code.Length == nCode.Length)\n {\n bool flag = false;\n \n for (int i = 0; i < code.Length; i++)\n {\n if (code[i] != nCode[i])\n {\n flag = true;\n break;\n }\n }\n\n if (!flag)\n return index - length;\n }\n }\n }\n\n static int NextIndex(int code, int index)\n {\n int bCode = (code / 2);\n index /= Power10[bCode];\n int nCode = code;\n\n while (true)\n {\n index++;\n int nIndex = index;\n\n while (nIndex % 10 == 0)\n nIndex /= 10;\n\n int mod = nIndex % 10;\n\n if (mod == 4 || mod == 7)\n nCode++;\n else if (mod == 5 || mod == 8)\n nCode--;\n\n if (nCode == code)\n return index * Power10[code / 2];\n }\n }\n\n static int CalLength(int[] code, int max)\n {\n int length = 0;\n\n for (int i = 0; i < code.Length; i++)\n {\n if(code[i] == max)\n break;\n\n length += Power10[code[i] / 2];\n }\n\n return length;\n }\n\n static int[] CalCode(int m, int n)\n {\n List result = new List();\n\n int add = 1, codeBase = 0;\n\n while (n != 0)\n {\n if (n < add)\n {\n add /= 10;\n codeBase -= 2;\n }\n else if (m % (add * 10) == 0 && add * 10 <= n)\n {\n add *= 10;\n codeBase += 2;\n }\n else\n {\n int code = m / add;\n if (code % 10 == 4 || code % 10 == 7)\n result.Add(codeBase + 1);\n else\n result.Add(codeBase);\n \n m += add;\n n -= add;\n }\n }\n\n return result.ToArray();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7aac8bb34568cb85740bc2cec65a7112", "src_uid": "649e9f477b97c1f72b05d409b4a99d59", "difficulty": 2700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static long[] Power10 = new long[] { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000 };\n \n static void Main(string[] args)\n {\n string[] inputStr = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n Console.WriteLine(FindNext(m, n));\n }\n\n static int FindNext(int m, int n)\n { \n int[] code = CalCode(m, n);\n int max = code.Max();\n int length = CalLength(code, max);\n int index = m + length;\n\n while (true)\n {\n index = NextIndex(max, index);\n int[] nCode = CalCode(index - length, n);\n\n if (code.Length == nCode.Length)\n {\n bool flag = false;\n \n for (int i = 0; i < code.Length; i++)\n {\n if (code[i] != nCode[i])\n {\n flag = true;\n break;\n }\n }\n\n if (!flag)\n return index - length;\n }\n }\n }\n\n static int NextIndex(int code, int index)\n {\n int bCode = code / 10;\n index /= (int)Power10[bCode];\n int nCode = code;\n int dIndex = 0;\n\n while (index % 10 == 7)\n {\n dIndex++;\n index /= 10;\n }\n\n if (index % 10 == 4)\n index += 3;\n else if (index % 10 == 6 || index % 10 == 3)\n index += 2;\n else\n {\n index++;\n int add = 0;\n\n while (index % Power10[add + 1] == 0 && index >= Power10[add + 1])\n add++;\n\n int nIndex = index / (int)Power10[add];\n\n if (nIndex % 10 == 4 || nIndex % 10 == 7)\n index += (int)Power10[add];\n }\n\n for (int i = 0; i < dIndex; i++)\n index = index * 10 + 4;\n\n return index * (int)Power10[bCode];\n }\n\n static int CalLength(int[] code, int max)\n {\n int length = 0;\n\n for (int i = 0; i < code.Length; i++)\n {\n if(code[i] == max)\n break;\n\n length += (int)Power10[code[i] / 10];\n }\n\n return length;\n }\n\n static int[] CalCode(int m, int n)\n {\n List result = new List();\n int add = 0, codeBase = 0, t = m - 1;\n\n while (t > 0)\n {\n if (t % 10 == 4 || t % 10 == 7)\n codeBase++;\n\n t /= 10;\n }\n\n while (n != 0)\n {\n if (n < Power10[add])\n {\n add--;\n codeBase -= 10;\n }\n else if (m % Power10[add + 1] == 0 && Power10[add + 1] <= n)\n {\n add++;\n codeBase += 10;\n }\n else\n {\n int nIndex = m;\n\n while (nIndex % 10 == 0 && nIndex > 0)\n nIndex /= 10;\n\n int mod = nIndex % 10;\n\n if (mod == 4 || mod == 7)\n codeBase++;\n else if (mod == 5 || mod == 8)\n codeBase--;\n \n result.Add(codeBase);\n m += (int)Power10[add];\n n -= (int)Power10[add];\n }\n }\n\n return result.ToArray();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6f679810166e32649d83737a22a0d107", "src_uid": "649e9f477b97c1f72b05d409b4a99d59", "difficulty": 2700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static long[] Power10 = new long[] { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000 };\n \n static void Main(string[] args)\n {\n string[] inputStr = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n Console.WriteLine(FindNext(m, n));\n }\n\n static int FindNext(int m, int n)\n { \n int[] code = CalCode(m, n);\n int max = code.Max();\n int length = CalLength(code, max);\n int index = m + length;\n\n while (true)\n {\n index = NextIndex(max, index);\n int[] nCode = CalCode(index - length, n);\n\n if (code.Length == nCode.Length)\n {\n bool flag = false;\n \n for (int i = 0; i < code.Length; i++)\n {\n if (code[i] != nCode[i])\n {\n flag = true;\n break;\n }\n }\n\n if (!flag)\n return index - length;\n }\n }\n }\n\n static int NextIndex(int code, int index)\n {\n int bCode = code / 10;\n index /= (int)Power10[bCode];\n int nCode = code;\n int dIndex = 0;\n\n while (index % 10 == 7)\n {\n dIndex++;\n index /= 10;\n }\n\n if (index % 10 == 4)\n index += 3;\n else if (index % 10 == 6 || index % 10 == 3)\n index += 2;\n else\n {\n index++;\n int add = 0;\n\n while (index % Power10[add + 1] == 0)\n add++;\n\n int nIndex = index / (int)Power10[add];\n\n if (nIndex % 10 == 4 || nIndex % 10 == 7)\n index += (int)Power10[add];\n }\n\n for (int i = 0; i < dIndex; i++)\n index = index * 10 + 4;\n\n return index * (int)Power10[bCode];\n }\n\n static int CalLength(int[] code, int max)\n {\n int length = 0;\n\n for (int i = 0; i < code.Length; i++)\n {\n if(code[i] == max)\n break;\n\n length += (int)Power10[code[i] / 10];\n }\n\n return length;\n }\n\n static int[] CalCode(int m, int n)\n {\n List result = new List();\n int add = 0, codeBase = 0, t = m - 1;\n\n while (t > 0)\n {\n if (t % 10 == 4 || t % 10 == 7)\n codeBase++;\n\n t /= 10;\n }\n\n while (n != 0)\n {\n if (n < Power10[add])\n {\n add--;\n codeBase -= 10;\n }\n else if (m % Power10[add + 1] == 0 && Power10[add + 1] <= n)\n {\n add++;\n codeBase += 10;\n }\n else\n {\n int nIndex = m;\n\n while (nIndex % 10 == 0)\n nIndex /= 10;\n\n int mod = nIndex % 10;\n\n if (mod == 4 || mod == 7)\n codeBase++;\n else if (mod == 5 || mod == 8)\n codeBase--;\n \n result.Add(codeBase);\n m += (int)Power10[add];\n n -= (int)Power10[add];\n }\n }\n\n return result.ToArray();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e2a1d7de64012d1835c827eae106183d", "src_uid": "649e9f477b97c1f72b05d409b4a99d59", "difficulty": 2700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static long[] Power10 = new long[] { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000 };\n \n static void Main(string[] args)\n {\n long k = GetNext(5000037, 1);\n string[] inputStr = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n Console.WriteLine(FindNext(m, n));\n }\n\n static int FindNext(int m, int n)\n { \n int[] code = CalCode(m, n);\n int max = code.Max();\n int min = code.Min();\n int maxLength = CalLength(code, max);\n int minLength = CalLength(code, min);\n long index = m + maxLength;\n long index2 = m + minLength;\n int pMin = (int)Power10[min / 10];\n int pMax = (int)Power10[max / 10];\n\n while (true)\n {\n index2 = GetNext(index2 / pMin, min % 10) * pMin;\n index = GetNext(index / pMax, max % 10) * pMax;\n\n if (index - maxLength < index2 - minLength)\n index = index2 - minLength + maxLength;\n else\n index2 = index - maxLength + minLength;\n\n int[] nCode = CalCode(index - maxLength, n);\n\n if (code.Length == nCode.Length && CompareArray(code, nCode))\n return (int)index - maxLength;\n }\n }\n\n static bool CompareArray(int[] a, int[] b)\n {\n for (int i = 0; i < a.Length; i++)\n if (a[i] != b[i])\n return false;\n\n return true;\n }\n\n static long GetNext(long n, int luckCount)\n {\n long nIndex = n + 1;\n\n while (true)\n {\n int count = GetLuckCount(nIndex);\n\n if (count == luckCount)\n return nIndex;\n else if (count > luckCount)\n {\n int pIndex = 0;\n while (nIndex % 10 != 4 && nIndex % 10 != 7)\n {\n nIndex /= 10;\n pIndex++;\n }\n\n nIndex = (nIndex + 1) * Power10[pIndex];\n }\n else\n {\n int pIndex = 0;\n while (nIndex % 10 == 4 || nIndex % 10 == 7)\n {\n nIndex /= 10;\n pIndex++;\n }\n\n while (!Check(nIndex))\n nIndex++;\n\n nIndex = nIndex * Power10[pIndex] + (Power10[pIndex] - 1) / 9 * 4;\n }\n }\n }\n\n static bool Check(long index)\n {\n while (index % 10 == 0)\n index /= 10;\n\n return index % 10 == 4 || index % 10 == 7;\n }\n\n static int CompareValue(int[] a, int[] b, int index)\n {\n for (int i = 0; i <= index; i++)\n if (a[i] != b[i])\n return a[i].CompareTo(b[i]);\n\n return 0;\n }\n\n static int CalLength(int[] code, int max)\n {\n int length = 0;\n\n for (int i = 0; i < code.Length; i++)\n {\n if(code[i] == max)\n break;\n\n length += (int)Power10[code[i] / 10];\n }\n\n return length;\n }\n\n static int[] CalCode(long m, long n)\n {\n List result = new List();\n int add = 0, count = GetLuckCount(m - 1); \n\n while (n != 0)\n {\n if (n < Power10[add])\n {\n add--;\n count -= 10;\n }\n else if (m % Power10[add + 1] == 0 && Power10[add + 1] <= n)\n {\n add++;\n count += 10;\n }\n else\n {\n long nIndex = m;\n\n while (nIndex % 10 == 0)\n nIndex /= 10;\n\n int mod = (int)(nIndex % 10);\n\n if (mod == 4 || mod == 7)\n count++;\n else if (mod == 5 || mod == 8)\n count--;\n\n result.Add(count);\n m += (int)Power10[add];\n n -= (int)Power10[add];\n }\n }\n\n return result.ToArray();\n }\n\n static int GetLuckCount(long m)\n {\n int count = 0;\n while (m > 0)\n {\n if (m % 10 == 4 || m % 10 == 7)\n count++;\n\n m /= 10;\n }\n\n return count;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e9f8d384abe0bae6837fe7b6be7236dc", "src_uid": "649e9f477b97c1f72b05d409b4a99d59", "difficulty": 2700.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 object Solve()\n {\n var n = ReadLong();\n if (n == 1)\n return \"1 1\\n1\";\n return 2 * (n - 1) + \" 2\\n1 2\";\n }\n\n class Trie\n {\n\n }\n\n class Node {\n public Node()\n {\n Children = new Node[10];\n }\n public Node[] Children { get; set; }\n public int Count { get; set; }\n public char Letter { get; set; }\n\n public string Final { get; set; }\n private int Rev = -1;\n\n public void RecursePlus()\n {\n if (Rev != -1)\n Count++;\n for (int i = 0; i < 10; i++)\n {\n if (Children[i] != null)\n {\n Children[i].RecursePlus();\n }\n }\n }\n public void Insert(string s, int begin, int rev)\n {\n //Count++;\n if (rev != Rev)\n {\n if (Rev != -1)\n Count++;\n Rev = rev;\n }\n if (begin == s.Length)\n {\n Final = s;\n return;\n }\n if (Children[s[begin] - '0'] == null)\n Children[s[begin] - '0'] = new Node();\n Children[s[begin] - '0'].Insert(s, begin + 1, rev);\n }\n\n public void Recurse(Dictionary dct, List sofar)\n {\n if (Count == 1)\n this.SetAns(dct, new string(sofar.ToArray()));\n else\n for (int i = 0; i < 10; i++)\n {\n if (Children[i] != null)\n {\n sofar.Add(i.ToString()[0]);\n Children[i].Recurse(dct, sofar);\n sofar.RemoveAt(sofar.Count - 1);\n }\n }\n }\n public void SetAns(Dictionary dct, string ans) {\n if (Final != null)\n {\n if (!dct.ContainsKey(Final) || dct[Final].Length > ans.Length)\n dct[Final] = ans;\n return;\n }\n for (int i = 0; i < 10; i++)\n {\n if (Children[i] != null)\n {\n Children[i].SetAns(dct, ans);\n return;\n }\n }\n }\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "901ad923a8e6c595bbf1b91e340c5254", "src_uid": "5c000b4c82a8ecef764f53fda8cee541", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "\ufeff\ufeffusing System;\n using System.CodeDom;\n using System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var a = sr.NextInt32();\n var s = 2 * a - 1;\n \n sw.WriteLine(s + \" 2\");\n sw.WriteLine(\"1 2\");\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4419df21d0bff215b372c22db3ab401c", "src_uid": "5c000b4c82a8ecef764f53fda8cee541", "difficulty": 1400.0} {"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;\nusing System.Numerics;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"nosimple.in\");\n StreamWriter sw = new StreamWriter(\"nosimple.out\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n C();\n \n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n\n }\n\n static void B()\n {\n\n }\n\n static void C()\n {\n long n, m, k;\n ReadArray(' ');\n n = NextLong();\n m = NextLong();\n k = NextLong();\n const long mod = 1000 * 1000 * 1000 + 7;\n long left, right, mid;\n right = m / (k - 1);\n left = 0;\n while (left < right)\n {\n mid = left + (right - left) / 2;\n\n if (n - k * mid <= m - (k - 1) * mid)\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n if (n - k * left < m - (k - 1) * left)\n left--;\n\n long rem = m - (k - 1) * left;\n long ans = MyMath.BinPow(2, rem / k, mod);\n ans--;\n ans = (ans * 2 * k) % mod;\n ans += (rem % k + left * (k - 1)) % mod;\n Console.WriteLine(ans);\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(i, a.Length);\n temp = a[b];\n a[b] = a[i];\n a[i] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aa0d47f6ecb9382e357c106379b1fff7", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "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 ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n long n = s[0], m = s[1], k = s[2], ans = 0, z = 0;\n long er = n - m, kp = k;\n bool b=false;\n for (int i = 1; i <= n; i++)\n {\n z++;\n if (i == (n - k * er + 1))\n b = true;\n if (z < k)\n {\n ans++;\n // z++;\n }\n else\n {\n if (b==true)\n {\n z = 0;\n //er--;\n }\n else\n {\n ans = (ans + 1) * 2;\n z = 0;\n }\n }\n }\n if (m == 0) ans = 0;\n Console.WriteLine(ans % 1000000009);\n // Console.Read();\n\n\n }\n }\n }\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f936ff05aa37fc186b12831a1f4bbb57", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskA\n{\n public class MyReader\n {\n private TextReader instream;\n\n public int[] ReadIntArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n int[] a = new int[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = int.Parse(spl[i]);\n return a;\n }\n\n public long[] ReadLongArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n long[] a = new long[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = long.Parse(spl[i]);\n return a;\n }\n\n public double[] ReadDoubleArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n double[] a = new double[spl.Length];\n\n System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();\n nfi.NumberDecimalSeparator = \".\";\n for (int i = 0; i < a.Length; i++)\n a[i] = double.Parse(spl[i], nfi);\n return a;\n }\n\n public int ReadInt()\n {\n return int.Parse(instream.ReadLine());\n }\n\n public long ReadLong()\n {\n return long.Parse(instream.ReadLine());\n }\n\n public void SetInStream(TextReader textReader)\n {\n this.instream = textReader;\n }\n\n internal string ReadLine()\n {\n return instream.ReadLine();\n }\n }\n\n static void Main(string[] args)\n {\n MyReader instream = new MyReader();\n instream.SetInStream(Console.In);\n\n TextWriter outstream = Console.Out;\n\n solve(instream, outstream);\n\n }\n\n private static void solve(MyReader instream, TextWriter outstream)\n {\n long[] nmk = instream.ReadLongArray();\n\n long n = nmk[0];\n long m = nmk[1];\n long k = nmk[2];\n\n long mod = 1000000009;\n\n long res=0;\n if (m == 0)\n res = 0;\n else\n {\n long blocks = n / k;\n if (blocks * (k - 1) <=m )\n {\n res = m;\n }\n else\n {\n blocks = n - m;\n\n long y = n - k * (n - m);\n //blocks*(k-1)\n\n long cnt = y / k;\n long free = y - cnt * k;\n\n res = powmod(2, cnt + 1, mod);\n\n res = (res - 2 + mod) % mod;\n\n res = res * k % mod;\n\n res = (res + free) % mod;\n res = (res + (blocks * (k - 1) % mod)) % mod;\n }\n }\n outstream.WriteLine(res);\n }\n\n private static long powmod(int v, long pow, long mod)\n {\n long res = 1;\n long b = v;\n while (pow > 0)\n {\n if ((pow & 1) == 1) res = (res * b) % mod;\n\n b = (b * b) % mod;\n pow >>= 1;\n }\n return res;\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "59d41e23a367745a29afaf81564b37dd", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0} {"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;\nusing System.Numerics;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"nosimple.in\");\n StreamWriter sw = new StreamWriter(\"nosimple.out\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n C();\n \n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n\n }\n\n static void B()\n {\n\n }\n\n static void C()\n {\n long n, m, k;\n ReadArray(' ');\n n = NextLong();\n m = NextLong();\n k = NextLong();\n const long mod = 1000 * 1000 * 1000 + 9;\n long left, right, mid;\n right = m / (k - 1);\n left = 0;\n while (left < right)\n {\n mid = left + (right - left) / 2;\n\n if (n - k * mid <= m - (k - 1) * mid)\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n if (n - k * left < m - (k - 1) * left)\n left--;\n\n long rem = m - (k - 1) * left;\n long ans = MyMath.BinPow(2, rem / k, mod);\n ans--;\n ans = (ans * 2 * k) % mod;\n ans += (rem % k + left * (k - 1)) % mod;\n Console.WriteLine(ans);\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(i, a.Length);\n temp = a[b];\n a[b] = a[i];\n a[i] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "21109a1577d7288ec8bef6b63cc8f048", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.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 ProgramA\n\t{\n private const long Mod = 1000000009;\n\n public static long FastModPow(long a, long n, long mod)\n {\n if (n == 0) return 1;\n if (n == 1) return a%mod;\n var res = FastModPow(a, n/2, mod);\n res = res*res%mod;\n if ((n & 1) == 1) res = res*a%mod;\n return res;\n }\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t var s = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n\t\t\t var n = s[0];\n\t\t\t var correct = s[1];\n\t\t\t var k = s[2];\n\t\t\t var wrong = n - correct;\n\n\t\t\t var afterCorrect = (k - 1)*wrong;\n\t\t\t afterCorrect = Math.Min(n, afterCorrect);\n\t\t\t afterCorrect = Math.Min(afterCorrect, correct);\n\t\t\t correct -= afterCorrect;\n\t\t\t if (correct < 0) correct = 0;\n\n\t\t\t var doubles = correct/k;\n\n\t\t\t var res = 2*(FastModPow(2, doubles, Mod) - 1);\n\t\t\t res = res*k%Mod;\n\t\t\t res += correct%k + afterCorrect;\n\t\t\t res %= Mod;\n\n Console.WriteLine(res);\n\t\t\t}\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7db936a18f6200096d26e85bfd3ebd17", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.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.Numerics;\nusing System.Threading;\n\nnamespace Temp\n{\n public class PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public PointInt(PointInt head)\n : this(head.X, head.Y)\n {\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n\n public bool Equals(PointInt other)\n {\n if (ReferenceEquals(null, other))\n {\n return false;\n }\n if (ReferenceEquals(this, other))\n {\n return true;\n }\n return other.X == this.X && other.Y == this.Y;\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != typeof(PointInt))\n {\n return false;\n }\n return Equals((PointInt)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (this.X.GetHashCode() * 397) ^ this.Y.GetHashCode();\n }\n }\n }\n\n public class Point2DReal\n {\n public double X;\n\n public double Y;\n\n public Point2DReal(double x, double y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public Point2DReal(Point2DReal head)\n : this(head.X, head.Y)\n {\n }\n\n public static Point2DReal operator +(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X + b.X, a.Y + b.Y);\n }\n\n public static Point2DReal operator -(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X - b.X, a.Y - b.Y);\n }\n\n public static Point2DReal operator *(Point2DReal a, double k)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public static Point2DReal operator *(double k, Point2DReal a)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public double Dist(Point2DReal p)\n {\n return Math.Sqrt((p.X - X) * (p.X - X) + (p.Y - Y) * (p.Y - Y));\n }\n\n public bool IsInsideRectangle(double l, double b, double r, double t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n internal class LineInt\n {\n public LineInt(PointInt a, PointInt b)\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n\n public int Sign(PointInt p)\n {\n return Math.Sign(A * p.X + B * p.Y + C);\n }\n }\n\n internal static class Geometry\n {\n public static long VectInt(PointInt a, PointInt b)\n {\n return a.X * b.Y - a.Y * b.X;\n }\n\n public static long VectInt(PointInt a, PointInt b, PointInt c)\n {\n return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);\n }\n }\n\n internal class MatrixInt\n {\n private readonly long[,] m_Matrix;\n\n public int Size\n {\n get { return m_Matrix.GetLength(0); }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size,size];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n var size = matrix.GetLength(0);\n m_Matrix = new long[size,size];\n Array.Copy(matrix, m_Matrix, size * size);\n Mod = mod;\n\n if (mod != 0)\n {\n for (int i = 0; i < size; i++)\n {\n for (int j = 0; j < size; j++)\n {\n m_Matrix[i, j] %= mod;\n }\n }\n }\n }\n\n public static MatrixInt IdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size,size];\n\n for (int i = 0; i < size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get { return m_Matrix[i, j]; }\n\n set { m_Matrix[i, j] = value; }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n,n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] = a[i, j] + b[i, j];\n }\n }\n\n if (mod > 0)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n,n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public void Print()\n {\n for (int i = 0; i < Size; i++)\n {\n for (int j = 0; j < Size; j++)\n {\n Console.Write(\"{0} \", m_Matrix[i, j]);\n }\n Console.WriteLine();\n }\n }\n }\n\n public static class Permutations\n {\n private static readonly Random m_Random;\n\n static Permutations()\n {\n m_Random = new Random();\n }\n\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n\n /*public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }*/\n\n /*public static T[] ShuffleSort(this T[] array)\n {\n var result = array.Shuffle();\n Array.Sort(result);\n return result;\n }*/\n\n public static void Shuffle(T[] array)\n {\n var n = array.Count();\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n T tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n }\n\n public static void ShuffleSort(T[] array)\n {\n Shuffle(array);\n Array.Sort(array);\n }\n\n public static int[] Next(int[] p)\n {\n int n = p.Length;\n var next = new int[n];\n Array.Copy(p, next, n);\n\n int k = -1;\n for (int i = n - 1; i > 0; i--)\n {\n if (next[i - 1] < next[i])\n {\n k = i - 1;\n break;\n }\n }\n if (k == -1)\n {\n return null;\n }\n for (int i = n - 1; i >= 0; i--)\n {\n if (next[i] > next[k])\n {\n var tmp = next[i];\n next[i] = next[k];\n next[k] = tmp;\n break;\n }\n }\n for (int i = 1; i <= (n - k - 1) / 2; i++)\n {\n var tmp = next[k + i];\n next[k + i] = next[n - i];\n next[n - i] = tmp;\n }\n\n return next;\n }\n }\n\n internal static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = MatrixInt.IdentityMatrix(a.Size, a.Mod);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 1 }, { 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[1, 1];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long n, long mod)\n {\n long[] result = new long[n];\n result[1] = 1;\n for (int i = 2; i < n; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n\n public static int GetMinimalPrimeDivisor(int n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n\n public static int SumOfDigits(long x, long baseMod = 10)\n {\n int res = 0;\n while (x > 0)\n {\n res += (int)(x % baseMod);\n x = x / baseMod;\n }\n return res;\n }\n }\n\n public static class OrderStatistic\n {\n public static T GetKthElement(this IList list, int k) where T : IComparable\n {\n return Select(list, 0, list.Count - 1, k);\n }\n\n private static T Select(IList list, int l, int r, int k) where T : IComparable\n {\n if (l == r)\n return list[l];\n\n T x = list[(l + r) / 2];\n var i = l;\n var j = r;\n do\n {\n while (list[i].CompareTo(x) < 0)\n i++;\n while (list[j].CompareTo(x) > 0)\n j--;\n if (i <= j)\n {\n T tmp = list[i];\n list[i] = list[j];\n list[j] = tmp;\n\n i++;\n j--;\n }\n }\n while (i <= j);\n\n if (j < l)\n j++;\n if (k <= j - l + 1)\n return Select(list, l, j, k);\n return Select(list, j + 1, r, k - (j - l + 1));\n }\n }\n\n internal static class Reader\n {\n public static void Read(out T v1)\n {\n var values = new T[1];\n Read(values);\n v1 = values[0];\n }\n\n public static void Read(out T v1, out T v2)\n {\n var values = new T[2];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n }\n\n public static void Read(out T v1, out T v2, out T v3)\n {\n var values = new T[3];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4)\n {\n var values = new T[4];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4, out T v5)\n {\n var values = new T[5];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n v5 = values[4];\n }\n\n public static void Read(T[] values)\n {\n Read(values, values.Length);\n }\n\n public static void Read(T[] values, int count)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n count = Math.Min(count, list.Length);\n\n var converter = TypeDescriptor.GetConverter(typeof(T));\n\n for (int i = 0; i < count; i++)\n {\n values[i] = (T)converter.ConvertFromString(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString(CultureInfo.InvariantCulture))).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public interface IGraph\n {\n bool IsOriented { get; set; }\n\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v);\n\n void AddNotOrientedEdge(int u, int v);\n }\n\n public class ListGraph : IGraph\n {\n private readonly List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public bool IsOriented { get; set; }\n\n public IList this[int i]\n {\n get { return this.m_Edges[i]; }\n }\n\n public ListGraph(int vertices, bool isOriented = false)\n {\n this.Vertices = vertices;\n this.IsOriented = isOriented;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n if (!IsOriented)\n {\n this.AddOrientedEdge(v, u);\n }\n }\n\n public void AddNotOrientedEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second);\n }\n }\n\n public static class GraphAlgorithms\n {\n private static bool[] v;\n\n private static int[] a;\n\n private static int c;\n\n public static int[] Bfs(this IGraph graph, int start)\n {\n int[] d = new int[graph.Vertices];\n for (int i = 0; i < graph.Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in graph[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n\n public static int[] TopSort(this IGraph graph)\n {\n v = new bool[graph.Vertices];\n a = new int[graph.Vertices];\n c = graph.Vertices;\n\n for (int i = 0; i < graph.Vertices; i++)\n {\n if (!v[i])\n {\n TopSortDfs(graph, i);\n }\n }\n\n return a;\n }\n\n private static void TopSortDfs(IGraph graph, int t)\n {\n v[t] = true;\n foreach (var next in graph[t])\n {\n if (!v[next])\n {\n TopSortDfs(graph, next);\n }\n }\n c--;\n a[c] = t;\n }\n }\n\n internal class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1,m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i - 1, j - 1];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r + 1, t + 1] - m_Sum[r + 1, b] - m_Sum[l, t + 1] + m_Sum[l, b];\n }\n }\n\n internal class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private readonly Func m_Operation;\n\n private readonly T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1);\n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(\n GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n internal struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n\n private bool Equals(Pair other)\n {\n return EqualityComparer.Default.Equals(this.First, other.First)\n && EqualityComparer.Default.Equals(this.Second, other.Second);\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != this.GetType())\n {\n return false;\n }\n return Equals((Pair)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (EqualityComparer.Default.GetHashCode(this.First) * 397)\n ^ EqualityComparer.Default.GetHashCode(this.Second);\n }\n }\n }\n\n internal class FenwickTreeInt64\n {\n public FenwickTreeInt64(int size)\n {\n this.m_Size = size;\n m_Tree = new long[size];\n }\n\n public FenwickTreeInt64(int size, IList tree)\n : this(size)\n {\n for (int i = 0; i < size; i++)\n {\n Inc(i, tree[i]);\n }\n }\n\n public long Sum(int r)\n {\n long res = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n {\n res += m_Tree[r];\n }\n return res;\n }\n\n public long Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public void Inc(int i, long x)\n {\n for (; i < m_Size; i = i | (i + 1))\n {\n m_Tree[i] += x;\n }\n }\n\n public void Set(int i, long x)\n {\n Inc(i, x - Sum(i, i));\n }\n\n private readonly int m_Size;\n\n private readonly long[] m_Tree;\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get { return this.ContainsKey(key) ? base[key] : 0; }\n set { this.Add(key, value); }\n }\n }\n\n public class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0\n || 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n public class DisjointSetUnion\n {\n public DisjointSetUnion()\n {\n m_Parent = new Dictionary();\n m_Rank = new Dictionary();\n }\n\n public DisjointSetUnion(DisjointSetUnion set)\n {\n m_Parent = new Dictionary(set.m_Parent);\n m_Rank = new Dictionary(set.m_Rank);\n }\n\n private readonly Dictionary m_Parent;\n\n private readonly Dictionary m_Rank;\n\n public int GetRank(T x)\n {\n return m_Rank[x];\n }\n\n public void MakeSet(T x)\n {\n m_Parent[x] = x;\n this.m_Rank[x] = 0;\n }\n\n public void UnionSets(T x, T y)\n {\n x = this.FindSet(x);\n y = this.FindSet(y);\n if (!x.Equals(y))\n {\n if (m_Rank[x] < m_Rank[y])\n {\n T t = x;\n x = y;\n y = t;\n }\n m_Parent[y] = x;\n if (m_Rank[x] == m_Rank[y])\n {\n m_Rank[x]++;\n }\n }\n }\n\n public T FindSet(T x)\n {\n if (x.Equals(m_Parent[x]))\n {\n return x;\n }\n return m_Parent[x] = this.FindSet(m_Parent[x]);\n }\n }\n\n internal class HamiltonianPathFinder\n {\n public static void Run()\n {\n int n, m;\n Reader.Read(out n, out m);\n List[] a = new List[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = new List();\n }\n for (int i = 0; i < m; i++)\n {\n int x, y;\n Reader.Read(out x, out y);\n a[x].Add(y);\n a[y].Add(x);\n }\n\n var rnd = new Random();\n\n bool[] v = new bool[n];\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = -1;\n }\n int first = rnd.Next(n);\n int cur = first;\n v[cur] = true;\n\n int count = 1;\n\n while (true)\n {\n var unb = a[cur].Where(u => !v[u]).ToList();\n int d = unb.Count;\n if (d > 0)\n {\n int next = unb[rnd.Next(d)];\n v[next] = true;\n p[cur] = next;\n cur = next;\n count++;\n }\n else\n {\n if (count == n && a[cur].Contains(first))\n {\n p[cur] = first;\n break;\n }\n\n d = a[cur].Count;\n int pivot;\n do\n {\n pivot = a[cur][rnd.Next(d)];\n }\n while (p[pivot] == cur);\n\n int next = p[pivot];\n\n int x = next;\n int y = -1;\n while (true)\n {\n int tmp = p[x];\n p[x] = y;\n y = x;\n x = tmp;\n if (y == cur)\n {\n break;\n }\n }\n p[pivot] = cur;\n cur = next;\n }\n }\n\n cur = first;\n do\n {\n Console.Write(\"{0} \", cur);\n cur = p[cur];\n }\n while (cur != first);\n }\n\n public static void WriteTest(int n)\n {\n Console.WriteLine(\"{0} {1}\", 2 * n, 2 * (n - 1) + n);\n for (int i = 0; i < n - 1; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 2);\n Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 3);\n //Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 2);\n //Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 3);\n }\n for (int i = 0; i < n; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 1);\n }\n }\n }\n\n internal class Backtrack\n where T : class\n {\n public Backtrack(Func> generator)\n {\n this.m_Generator = generator;\n }\n\n public Dictionary Generate(T startState)\n {\n var result = new Dictionary();\n result.Add(startState, null);\n\n var queue = new Queue();\n queue.Enqueue(startState);\n\n while (queue.Count > 0)\n {\n var current = queue.Dequeue();\n var next = m_Generator(current);\n foreach (var state in next)\n {\n if (!result.ContainsKey(state))\n {\n result[state] = current;\n queue.Enqueue(state);\n }\n }\n }\n\n return result;\n }\n\n private Func> m_Generator;\n }\n\n public static class Utility\n {\n public static readonly int[] sx = new[] { 1, 0, -1, 0 };\n\n public static readonly int[] sy = new[] { 0, 1, 0, -1 };\n\n public static PointInt[] GenerateNeighbors(long x, long y)\n {\n var result = new PointInt[4];\n for (int i = 0; i < 4; i++)\n {\n result[i] = new PointInt(x + sx[i], y + sy[i]);\n }\n return result;\n }\n\n public static PointInt[] GenerateNeighbors(this PointInt p)\n {\n return GenerateNeighbors(p.X, p.Y);\n }\n\n public static List GenerateNeighborsWithBounds(long x, long y, int n, int m)\n {\n var result = new List(4);\n for (int i = 0; i < 4; i++)\n {\n var nx = x + sx[i];\n var ny = y + sy[i];\n if (0 <= nx && nx < n && 0 <= ny && ny < m)\n {\n result.Add(new PointInt(nx, ny));\n }\n }\n return result;\n }\n\n public static List GenerateNeighborsWithBounds(this PointInt p, int n, int m)\n {\n return GenerateNeighborsWithBounds(p.X, p.Y, n, m);\n }\n\n public static void Swap(ref T x, ref T y)\n {\n T tmp = x;\n x = y;\n y = tmp;\n }\n }\n\n public static class FFTMultiply\n {\n public static int[] Multiply(int[] a, int[] b)\n {\n var result = Multiply(\n a.Select(x => new Complex(x, 0)).ToArray(), b.Select(x => new Complex(x, 0)).ToArray());\n return result.Select(x => (int)Math.Round(x.Real)).ToArray();\n }\n\n public static Complex[] Multiply(Complex[] a, Complex[] b)\n {\n var n = 1;\n while (n < Math.Max(a.Length, b.Length))\n {\n n <<= 1;\n }\n n <<= 1;\n\n var fa = new Complex[n];\n Array.Copy(a, fa, a.Length);\n var fb = new Complex[n];\n Array.Copy(b, fb, b.Length);\n\n FFT(fa, false);\n FFT(fb, false);\n\n for (int i = 0; i < n; i++)\n {\n fa[i] *= fb[i];\n }\n\n FFT(fa, true);\n for (int i = 0; i < n; i++)\n {\n fa[i] /= n;\n }\n return fa;\n }\n\n private static void FFT(IList a, bool invert)\n {\n var n = a.Count;\n if (n == 1)\n {\n return;\n }\n\n var a0 = new Complex[n / 2];\n var a1 = new Complex[n / 2];\n for (int i = 0; i < n / 2; i++)\n {\n a0[i] = a[2 * i];\n a1[i] = a[2 * i + 1];\n }\n FFT(a0, invert);\n FFT(a1, invert);\n\n Complex w = 1;\n var ang = 2 * Math.PI / n * (invert ? -1 : 1);\n Complex wn = new Complex(Math.Cos(ang), Math.Sin(ang));\n\n for (int i = 0; i < n / 2; i++)\n {\n a[i] = a0[i] + w * a1[i];\n a[i + n / 2] = a0[i] - w * a1[i];\n w *= wn;\n }\n }\n }\n\n internal class Program\n {\n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = new StreamReader(\"input.txt\"); //File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = new StreamWriter(\"output.txt\"); //File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n private static void Main()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n // OpenFiles();\n\n var mainThread = new Thread(() => new Solution().Solve(), 50 * 1024 * 1024);\n mainThread.Start();\n mainThread.Join();\n\n // CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n long mod = 1000000000 + 9;\n\n long n, m, k;\n Reader.Read(out n, out m, out k);\n\n var d = n - k * (n - m);\n if (d <= 0)\n {\n Console.WriteLine(m);\n return;\n }\n\n var ans = ((k - 1) * (n - m)) % mod;\n var t = d / k;\n var matr = new MatrixInt(new long[,] { { 1, 0 }, { 2, 2 } }, mod);\n var mp = Algebra.MatrixBinPower(matr, t);\n ans = (ans + mp[1, 0] * k + d % k) % mod;\n Console.WriteLine(ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c1e7ce0ebf52c061ee2ad2b5ec177e34", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "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 run\n{\n class Program\n {\n private static int Swap(ref int a, ref int b)\n {\n if (a < b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n return 0;\n }\n\n private static int gcd(int a, int b)\n {\n Swap(ref a, ref b);\n\n while (a % b != 0)\n {\n a %= b;\n Swap(ref a, ref b);\n }\n\n return b;\n\n }\n\n private const long MOD = 1000000009;\n\n private static void Main(string[] args)\n {\n \n var nstr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n int n = nstr[0], m = nstr[1], k = nstr[2];\n int l = n - m;\n long result = 0;\n long good = 0;\n int count = k * l;\n\n int num = (n - count) / k;\n\n //long kjk = BinPow(2, num + 1);\n \n long SUMM = k * 2 * (BinPow(2, num) - 1) % MOD;\n\n result += SUMM;\n\n\n\n /*for (int i = k; i <= n - count; i += k)\n {\n result += k;\n good = k;\n if (good == k)\n {\n result <<= 1;\n good = 0;\n if (result >= MOD) result -= MOD;\n }\n }*/\n\n result += ((n - count) % k);\n\n result += count - l;\n if (result >= MOD) result -= MOD;\n\n Console.WriteLine(result);\n\n }\n\n private static long BinPow(int a, int degr)\n {\n if (degr == 0) return 1;\n if ((degr & 1) == 1) return a * (BinPow(a, degr - 1) % MOD);\n else\n {\n long value = BinPow(a, degr >> 1) % MOD;\n return value * value % MOD;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "26bf6e6a0baf4be67b3e1ea37f2638be", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "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 run\n{\n class Program\n {\n private static int Swap(ref int a, ref int b)\n {\n if (a < b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n return 0;\n }\n\n private static int gcd(int a, int b)\n {\n Swap(ref a, ref b);\n\n while (a % b != 0)\n {\n a %= b;\n Swap(ref a, ref b);\n }\n\n return b;\n\n }\n\n private const long MOD = 1000000009;\n\n private static void Main(string[] args)\n {\n \n var nstr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n int n = nstr[0], m = nstr[1], k = nstr[2];\n int l = n - m;\n long result = 0;\n long good = 0;\n int count = k * l;\n if (n - count == 0)\n {\n Console.WriteLine(0);\n return;\n }\n int num = (n - count) / k;\n\n \n //long kjk = BinPow(2, num + 1);\n \n long SUMM = k * 2 * (BinPow(2, num) - 1) % MOD;\n\n result += SUMM;\n\n\n\n /*for (int i = k; i <= n - count; i += k)\n {\n result += k;\n good = k;\n if (good == k)\n {\n result <<= 1;\n good = 0;\n if (result >= MOD) result -= MOD;\n }\n }*/\n\n result += ((n - count) % k);\n\n result += count - l;\n if (result >= MOD) result -= MOD;\n\n Console.WriteLine(result);\n\n }\n\n private static long BinPow(int a, int degr)\n {\n if (degr == 0) return 1;\n if ((degr & 1) == 1) return a * (BinPow(a, degr - 1) % MOD);\n else\n {\n long value = BinPow(a, degr >> 1) % MOD;\n return value * value % MOD;\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "164f148e78b6457dfa16a319d2cccf90", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing Common;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R337.C\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, int answer)\n {\n tw.WriteLine(answer);\n }\n\n private static int Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n return Calc(int.Parse(w[0]), int.Parse(w[1]), int.Parse(w[2]));\n }\n\n public static int Calc(int n, int m, int k)\n {\n var y = n - m;\n var b = y * (k - 1);\n var r = m - b;\n if (r <= 0)\n return m;\n var x = r / k;\n var a = r % k;\n return ((1 << x + 1) - 2) * k + a + b;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "08ab52e548e1bc2e3579287bc5abb60b", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Santa_Claus_and_Candies_codeforces753A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int balance = 0;\n List candies = new List();\n int sumOfCandies = 0;\n if (n == 1)\n {\n sumOfCandies = n;\n candies.Add(n);\n }\n else\n {\n\n for (int i = 1; i < n; i++)\n {\n sumOfCandies = sumOfCandies + i;\n if (sumOfCandies > n)\n {\n sumOfCandies = sumOfCandies - i;\n break;\n }\n candies.Add(i);\n }\n }\n\n if (sumOfCandies != n)\n {\n balance = n - sumOfCandies;\n int j = candies.Count - 1;\n candies[j] = candies[j] + balance;\n }\n // printing all the results\n Console.WriteLine(candies.Count);\n foreach (var item in candies)\n {\n Console.Write(item + \" \");\n }\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c5668e482469d490e9393ebf1ea2d336", "src_uid": "356a7bcebbbd354c268cddbb5454d5fc", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp\n{\n public class Program\n {\n public static void Main()\n {\n int n = Int32.Parse(Console.ReadLine());\n Stack stack = new Stack();\n for (int i = 1; n > 0; i++)\n {\n if (n >= i)\n {\n n -= i;\n stack.Push(i);\n }\n else\n {\n stack.Push(stack.Pop() + n);\n n = 0;\n }\n }\n Console.WriteLine(stack.Count);\n Console.Write(stack.Pop());\n while (stack.Count > 0)\n {\n Console.Write(\" \" + stack.Pop());\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5bdf28ea50b28f7fe21b1005f1b79894", "src_uid": "356a7bcebbbd354c268cddbb5454d5fc", "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 \n int a = Convert.ToInt32(Console.ReadLine());\n List lista = new List();\n lista.Add(1);\n int cont=2;\n \n if(a==1){\n Console.WriteLine(1);\n Console.WriteLine(1);\n }else if(a==2){\n Console.WriteLine(1);\n Console.WriteLine(2);\n }else{\n while(lista.Sum()!=a){\n if(!lista.Contains(a-lista.Sum())){\n lista.Add(cont);\n cont++;\n }else{\n lista[lista.Count-1]=lista[lista.Count-1]+(a-lista.Sum());\n }\n }\n string[]array=new string[lista.Count];\n for(int j=0;j();\n\n if (n > 3)\n {\n while (n>0)\n {\n if (n == 3)\n {\n ans.Add(1);\n ans.Add(2);\n break;\n }\n else if (n <= 2)\n {\n ans.Add(n);\n break;\n }\n else\n {\n \n int a = 0;\n for (int j = 3; j ();\n //bool first = false;\n //if (bull != 4)\n //{\n\n\n // var ans = new char[4];\n\n // if(count<9 && cow>0 && list.Count()<4)\n // {\n // for(int i=0; i< cow; i++)\n // {\n // list.Add(count);\n // }\n // ans[0] = (char)(count+'0'+1);\n // ans[1] = (char)(count+'0' + 1);\n // ans[2] = (char)(count+'0' + 1);\n // ans[3] = (char)(count+'0' + 1);\n // first = true;\n // }\n // else\n // {\n // if(first)\n // {\n // ans[0] = (char)(list[0]+'0');\n // ans[1] = (char)(list[1]+'0');\n // ans[2] = (char)(list[2]+'0');\n // ans[3] = (char)(list[3]+'0');\n\n // count = 0;\n // first = false;\n // }\n // else\n // {\n // char tmp = ans[0];\n // char tmp2 = ans[1];\n // char tmp3 = ans[2];\n // if(count%2==0)\n // {\n // ans[0] = ans[2];\n // ans[2] = tmp;\n // ans[1] = ans[3];\n // ans[3] = tmp2;\n // }\n // else\n // {\n // ans[0] = ans[1];\n // ans[1] = tmp;\n // ans[2] = ans[3];\n // ans[3] = tmp3;\n // }\n\n // }\n\n\n // }\n\n\n // count++;\n // Console.WriteLine(new string(ans));\n //}\n //else Console.WriteLine();\n\n\n\n\n \n \n }\n\n \n \n }\n\n\n class Segment\n {\n public Tuple[] arr;\n int n;\n\n public Segment(int n)\n {\n this.n = n * 2;\n //arr = Enumerable.Range(0, n*2).ToArray();\n arr = new Tuple[this.n];\n for (int i = 0; i < this.n; i++)\n {\n arr[i] = Tuple.Create((long)0, 0);\n }\n\n }\n\n public void update(int i, long x, int ind)\n {\n i = (n / 2) + i - 1;\n arr[i] = Tuple.Create(x, ind);\n while (i > 0)\n {\n i = (i - 1) / 2;\n //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);\n if (arr[i * 2 + 1].Item1 > arr[i * 2 + 2].Item1)\n {\n arr[i] = Tuple.Create(arr[i * 2 + 1].Item1, arr[i * 2 + 1].Item2);\n }\n else\n {\n arr[i] = Tuple.Create(arr[i * 2 + 2].Item1, arr[i * 2 + 2].Item2);\n }\n\n }\n\n }\n\n //call : query(a,b, 0, 0, n)\n public long query(int a, int b, int k, int l, int r)\n {\n if (r <= a || b <= l) return int.MaxValue;\n if (a <= l && r <= b) return arr[k].Item1;\n else\n {\n long vl = query(a, b, k * 2 + 1, l, (l + r) / 2);\n long vr = query(a, b, k * 2 + 2, (l + r) / 2, r);\n return Math.Max(vl, vr);\n }\n }\n\n\n }\n\n\n class UnionFind\n {\n public int[] path;\n\n\n public UnionFind(int n)\n {\n path = new int[n];\n\n for (int i = 0; i < n; i++)\n {\n path[i] = i;\n }\n\n }\n\n private int root(int i)\n {\n while (i != path[i])\n {\n path[i] = path[path[i]];\n i = path[i];\n }\n return i;\n }\n\n\n\n public bool find(int p, int q)\n {\n return root(p) == root(q);\n }\n\n\n\n public void unite(int p, int q)\n {\n int i = root(p);\n int j = root(q);\n path[i] = j;\n }\n\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "99cb60f4cbc5c336d0bce5c3560c0cac", "src_uid": "356a7bcebbbd354c268cddbb5454d5fc", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n static List anss = new List();\n // Driver code \n public static void Main()\n {\n\n //int t = int.Parse(Console.ReadLine());\n //while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n var n = input1[0];\n // var k = input1[1];\n // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n int i = 1;\n List lst = new List();\n var ans = 0;\n for (; i <= n; i++)\n {\n ans = (i * (i + 1)) / 2;\n lst.Add(ans);\n if (ans > n)\n {\n break;\n }\n }\n\n Console.WriteLine(i - 1);\n var left = ans - n;\n int j = 0;\n for (; j < left; j++)\n {\n Console.Write(lst[j] + 1 + \" \");\n }\n for (; j < lst.Count-1; j++)\n {\n Console.Write(lst[j] + \" \");\n }\n\n\n }\n\n\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "068ab43d9f05424545769e4bf98cb67c", "src_uid": "356a7bcebbbd354c268cddbb5454d5fc", "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 _753A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n <= 2)\n {\n Console.WriteLine(\"1\");\n Console.WriteLine(n);\n //Console.ReadLine();\n return;\n }\n\n int maxK = 0, maxAF = 0, maxAL = 0, maxStep = 0;\n for (int aF = 1; aF < n; aF++)\n {\n for (int aL = 1; aL < n; aL++)\n {\n double k = (2D * n) / ((double)aF + aL);\n if (Math.Floor(k) == k && k > maxK)\n {\n int step = (aL - aF) / ((int)k - 1);\n if (step > 0)\n {\n maxK = (int)k;\n maxAF = aF;\n maxAL = aL;\n maxStep = step;\n }\n }\n }\n }\n\n int[] answer = new int[maxK];\n answer[0] = maxAF;\n answer[maxK - 1] = maxAL;\n for (int i = 1; i < maxK - 1; i++)\n {\n answer[i] = maxAF + i * maxStep;\n }\n\n Console.WriteLine(maxK);\n Console.WriteLine(string.Join(\" \", answer));\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "30a06d0553bdb717b1fd4188fb444d09", "src_uid": "356a7bcebbbd354c268cddbb5454d5fc", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n static List anss = new List();\n // Driver code \n public static void Main()\n {\n\n //int t = int.Parse(Console.ReadLine());\n //while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n var n = input1[0];\n // var k = input1[1];\n // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n int i = 1;\n List lst = new List();\n var ans = 0;\n for (; i <= n; i++)\n {\n ans = ans + i;\n lst.Add(i);\n if (ans > n)\n {\n break;\n }\n }\n\n Console.WriteLine(i - 1);\n var left = n-(ans - i);\n int j = 0;\n for (; j < left; j++)\n {\n Console.Write(lst[j] + 1 + \" \");\n }\n for (; j < lst.Count - 1; j++)\n {\n Console.Write(lst[j] + \" \");\n }\n\n\n }\n\n\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "021ef3fb11a5e74628d7a8f8400092de", "src_uid": "356a7bcebbbd354c268cddbb5454d5fc", "difficulty": 1000.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 var m = ReadLong();\n var d = ReadLong();\n if (m == 2)\n return d == 1 ? 4 : 5;\n \n var ms = new long[] { 1, 3, 5, 7, 8, 10, 12 };\n if (ms.Contains(m))\n return d == 6 || d == 7 ? 6 : 5;\n return d == 7 ? 6 : 5; \n\n }\n //object Solve()\n //{\n // checked\n // {\n // var n = ReadLong();\n // var s = Read().Select(x => long.Parse(x.ToString())).ToArray();\n // var dp = new Tuple[60];\n // dp[0] = Tuple.Create(0, s[0]);\n // for (int i = 1; i < s.Length; i++)\n // {\n // if (s[i] == 1 && s[i - 1] < 6)\n // {\n // var r = i == 1 ? -1 : dp[i - 2].Item1;\n // var prevRes = i == 1 ? 0 : dp[i - 2].Item2;\n // dp[i] = Tuple.Create(r + 1, FastPow(16, r + 1) * (10 + s[i - 1]) + prevRes);\n // }\n // else\n // {\n // var r = dp[i - 1].Item1;\n // var prevRes = dp[i - 1].Item2;\n // dp[i] = Tuple.Create(r + 1, FastPow(16, r + 1) * s[i] + prevRes);\n // }\n // }\n // return dp[s.Length - 1].Item2;\n // }\n //}\n //Tuple Check(long bas, int[] s, int i)\n //{\n // var strB = bas.ToString().Select(x => int.Parse(x.ToString())).ToArray();\n // if (i < strB.Length - 1)\n // return Tuple.Create(-1, 0L);\n // for (int j = 0; j < strB.Length; j++)\n // {\n // if (strB[j] < s[i - j])\n // {\n // for (int i = 0; i < strB.Le; i++)\n // {\n\n // }\n\n // }\n // }\n //}\n\n long FastPow(long b, long pow)\n {\n if (pow == 0)\n return 1;\n if (pow == 1)\n return b;\n if (pow % 2 == 0)\n return FastPow(b * b, pow / 2);\n return b * FastPow(b, pow - 1);\n }\n\n bool IsPrime(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n }\n\n class DSU\n {\n private int[] arr;\n private Random r = new Random();\n public DSU(int n)\n {\n arr = new int[n];\n for (int i = 0; i < n; i++)\n {\n arr[i] = i;\n }\n }\n\n public int Find(int x)\n {\n if (arr[arr[x]] == arr[x])\n return arr[x];\n var y = Find(arr[x]);\n arr[x] = y;\n return y;\n }\n\n public void Union(int x, int y)\n {\n var p1 = Find(x);\n var p2 = Find(y);\n if (p1 == p2)\n return;\n if (r.NextDouble() < 0.5)\n arr[p1] = p2;\n else\n arr[p2] = p1;\n }\n\n public int[][] Enumerate()\n {\n return arr.Select((x, i) => new { g = Find(x), i }).GroupBy(x => x.g, (k, e) => e.Select(y => y.i).ToArray()).ToArray();\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3519922b001bfb881ee5aa9d304e83b2", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "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\nclass cf001\n{\n static void Main()\n {\n string input = Console.ReadLine();\n int month = int.Parse(input.Split()[0]);\n int weekday = int.Parse(input.Split()[1]);\n int result;\n List months = new List() { 1, 3, 5, 7, 8, 10, 12 };\n\n if (month == 2 && weekday == 1)\n {\n result = 4;\n }\n else if (month == 2)\n {\n result = 5;\n }\n else if ((months.Contains(month)&& weekday > 5) ||(weekday>6))\n {\n result = 6;\n }else\n {\n result = 5;\n }\n\n Console.WriteLine(result);\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5d2de1aad3ea6b8ddeca80292a5cd8d9", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "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 ConsoleApplication2\n{\n class Program\n {\n static int Number(int dataWeek, int dataMonth)\n {\n int res = 0;\n if ((dataMonth % 2 != 0 && dataMonth <= 7) || (dataMonth % 2 == 0 && dataMonth >= 8))\n {\n if(dataWeek <= 5)\n {\n res = 5;\n }\n else\n {\n res = 6;\n }\n }\n else if(dataMonth == 2)\n {\n if(dataWeek == 1)\n {\n res = 4;\n }\n else\n {\n res = 5;\n }\n }\n else\n {\n if(dataWeek <= 6)\n {\n res = 5;\n }\n else\n {\n res = 6;\n }\n }\n return res;\n } \n private static void Main(string[] args)\n {\n int[] data = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int dataMonth = data[0];\n int dataWeek = data[1];\n\n int result = Number(dataWeek, dataMonth);\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8f1b0746240bab28e754c8b6ceba5c14", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "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 Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n\n \n \n if (s[0] == 1 || s[0] == 3 || s[0] == 5 || s[0] == 7 || s[0] == 8 || s[0] == 10 || s[0] == 12)\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else if (s[1] == 1 || s[1] == 2 || s[1] == 3 || s[1] == 4 ||s[1]==5)\n {\n Console.WriteLine(5);\n\n }\n }\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] == 2 && s[1] != 1)\n {\n Console.WriteLine(5);\n }\n \n\n else if(s[0] == 4 || s[0] == 6 || s[0] == 9|| s[0] == 11 )\n {\n if ( s[1] == 7)\n {\n Console.WriteLine(6);\n\n }\n else\n {\n Console.WriteLine(5);\n }\n\n }\n Console.ReadLine();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "83124d2fa7d7fa87da958f0e64a14b6a", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "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.Text.RegularExpressions;\nusing System.IO;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] menesiuIlgumai = new int[13] {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n string[] duomenys = Console.ReadLine().Split(' ');\n int m = int.Parse(duomenys[0]);\n int d = int.Parse(duomenys[1]);\n int columns = 1;\n int menesioIlgumas = menesiuIlgumai[m];\n menesioIlgumas -= (8 - d);\n columns += menesioIlgumas % 7 == 0 ? menesioIlgumas / 7 : (menesioIlgumas / 7) + 1;\n Console.WriteLine(columns);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9e23bbdf6b1c43938eddc56034050256", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Petr_and_a_calendar\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int m = Next();\n int d = Next();\n\n int days = DateTime.DaysInMonth(2017, m);\n days -= 8 - d;\n int count = 1 + (days+6)/7;\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "948837e611c6052b68446f617f543623", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(ReadLine().Split(), int.Parse);\n int days = DateTime.DaysInMonth(2021, a[0]);\n int weeks = days > 28 ? 5 : 4;\n weeks += 8-a[1] >= days - 28 ? 0 : 1;\n WriteLine(weeks);\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "93ae79ca5a4a72086d39c64fe857036d", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "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 Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n //31---->1,3,5,7,8,10,12\n if (s[0] == 1||s[0]==3||s[0]==5||s[0]==7||s[0]==8||s[0]==10||s[0]==12 )\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else\n {\n Console.WriteLine(5);\n }\n \n }\n //29--->2\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] >= 1 && s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n\n }\n //30\n else\n {\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "813a839b6ec8b2205646614f17f18b91", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass A\n{\n public static void Main()\n {\n int[] mouth = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\n\n int total = 0;\n\n string line = Console.ReadLine();\n \n int m = int.Parse(line.Split(' ')[0]), \n d = int.Parse(line.Split(' ')[1]);\n \n d = mouth[d] - (7-d);\n total = Math.Abs(d / 7) + 1;\n \n Console.WriteLine(total);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4c09a0e3b99175e84cbb93c8e8dbd694", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF\n{\n class B104\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n string sa = s[0];\n string sb = s[1];\n int la = sa.Length;\n int lb = sb.Length;\n string bi = \"\";\n for (int ii = 0; ii < lb; ii++)\n bi += sb[lb-1-ii];\n b = int.Parse(bi);\n\n int i;\n\n for (i = a + 1; i < 101010; i++ )\n {\n int d = i;\n int m = 0;\n int c = 0;\n while (d > 0)\n {\n c = d % 10;\n if (c==4 || c==7)\n m = m*10+c;\n d /= 10;\n }\n if (m == b)\n break;\n }\n\n\n Console.WriteLine(i);\n\n\n // Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a8a9cded72bbf7b21bc3730b2c7466b7", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace task146_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n Int32 a = Int32.Parse(input[0]);\n Int32 b = Int32.Parse(input[1]);\n while (Regex.Replace(a.ToString(), \"[^47]\", \"\") != input[1])\n {\n a++;\n }\n Console.WriteLine(a);\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ef667e36daad30b8581b6b4944f1a85", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.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 ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = ReadArray();\n var a = ReadNextInt(input, 0);\n var b = ReadNextInt(input, 1);\n if (b > a)\n {\n Console.WriteLine(b);\n return;\n }\n var bStr = input[1];\n while (true)\n {\n var aStr = a.ToString();\n var cur = 0;\n for (int i = 0; i < aStr.Length; i++)\n {\n if (aStr[i] == '4' || aStr[i] == '7')\n {\n if (bStr[cur] == aStr[i])\n cur++;\n else\n {\n break;\n }\n }\n }\n if (cur == bStr.Length)\n {\n Console.WriteLine(a);\n return;\n }\n a++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6d1e62cba51b6bf858edb512c7cae4a7", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.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 ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = ReadArray();\n var a = ReadNextInt(input, 0);\n var b = ReadNextInt(input, 1);\n if (b > a)\n {\n Console.WriteLine(b);\n return;\n }\n if(b == a)\n {\n Console.WriteLine(\"1\" + b);\n return;\n }\n var bStr = input[1];\n while (true)\n {\n var aStr = a.ToString();\n var cur = 0;\n var valid = true;\n foreach (char t in aStr)\n {\n if (t == '4' || t == '7')\n {\n if (cur == bStr.Length || bStr[cur] != t)\n {\n valid = false;\n break;\n }\n\n cur++;\n }\n }\n if (valid)\n {\n Console.WriteLine(a);\n return;\n }\n a++;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d1de920747b1d1f2bf7d989bfdc230e6", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForceContest\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ').Select(ss => int.Parse(ss)).ToArray();\n //var s = \"17 7\".Split(' ').Select(ss => int.Parse(ss)).ToArray();\n var a = s[0];\n var b = s[1];\n var aa = String.Join(\"\",a.ToString().Take(a.ToString().Length - b.ToString().Length).Select(sss=>sss.ToString()).ToArray());\n aa += b.ToString();\n if(a sss.ToString()).ToArray());\n var t = (c == String.Empty ? 0 : int.Parse(c)) + 1;\n c = t.ToString()+b.ToString();\n Console.WriteLine(c);\n }\n }\n \n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ec3641feb7464846830158629afdb48", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\n\nclass Program{\n\tstatic void Main(){\n\t\tstring[] input = Console.ReadLine().Split();\n\t\tint a = int.Parse(input[0]);\n\t\tint b = int.Parse(input[1]);\n\t\t\n\t\tif(b > a){\n\t\t\tConsole.WriteLine(b);\n\t\t}else{\n\t\t\tint i = 4;\n\t\t\twhile(true){\n\t\t\t\tint t = 0;\n\t\t\t\tstring tmp = i.ToString().Replace(\"0\", \"\").Replace(\"1\", \"\").Replace(\"2\", \"\").Replace(\"3\", \"\").Replace(\"5\", \"\").Replace(\"6\", \"\").Replace(\"8\", \"\").Replace(\"9\", \"\");\n\t\t\t\tif(tmp.Length > 0)\n\t\t\t\t\tt = int.Parse(tmp);\n\t\t\t\tif(t == b && i > a){\n\t\t\t\t\tConsole.WriteLine(i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a8e4755173dc561886bb37f869caa89a", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "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 R175_Div2_D\n {\n static void Main(string[] args)\n {\n long mod = 1000000007;\n int n = int.Parse(Console.ReadLine());\n\n long f = 1;\n for (int i = 1; i <= n; i++)\n f *= i;\n\n f *= f;\n\n for (int i = 1; i <= n-2; i++)\n f /= 2;\n\n f = f % mod;\n\n if (n == 2)\n Console.WriteLine(0);\n else\n Console.WriteLine(f);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "95e3ccd88e58bc427fe496f9d40506a2", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "difficulty": 1900.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 EducationalCodeforcesRound86.Questions;\nusing ModInt = EducationalCodeforcesRound86.Questions.StaticModInt;\n\nnamespace EducationalCodeforcesRound86.Questions\n{\n public class QuestionE : AtCoderQuestionBase\n {\n [MethodImpl(MethodImplOptions.AggressiveOptimization)]\n public override void Solve(IOManager io)\n {\n var n = io.ReadInt();\n var pairs = io.ReadInt();\n\n if (pairs >= n)\n {\n io.WriteLine(0);\n return;\n }\n\n var combination = new ModCombination();\n var available = n - pairs;\n\n var result = ModInt.Zero;\n\n for (int sub = 0; sub < available; sub++)\n {\n var sign = sub % 2 == 0 ? ModInt.One : -ModInt.One;\n result += sign * combination.Combination(available, available - sub) * ModInt.Raw(available - sub).Pow(n);\n }\n\n result *= combination.Combination(n, available);\n\n if (pairs != 0)\n {\n result *= ModInt.Raw(2);\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 EducationalCodeforcesRound86\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 EducationalCodeforcesRound86.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 EducationalCodeforcesRound86\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "35c780f39df857c3bbcfec105f077c11", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "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 EducationalCodeforcesRound86.Questions;\nusing ModInt = EducationalCodeforcesRound86.Questions.StaticModInt;\n\nnamespace EducationalCodeforcesRound86.Questions\n{\n public class QuestionE : AtCoderQuestionBase\n {\n [MethodImpl(MethodImplOptions.AggressiveOptimization)]\n public override void Solve(IOManager io)\n {\n var n = io.ReadInt();\n var k = io.ReadLong();\n\n if (k >= n)\n {\n io.WriteLine(0);\n return;\n }\n\n var pairs = (int)k;\n\n var combination = new ModCombination();\n var available = n - pairs;\n\n var result = ModInt.Zero;\n\n for (int sub = 0; sub < available; sub++)\n {\n var sign = sub % 2 == 0 ? ModInt.One : -ModInt.One;\n result += sign * combination.Combination(available, available - sub) * ModInt.Raw(available - sub).Pow(n);\n }\n\n result *= combination.Combination(n, available);\n\n if (pairs != 0)\n {\n result *= ModInt.Raw(2);\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 EducationalCodeforcesRound86\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 EducationalCodeforcesRound86.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 EducationalCodeforcesRound86\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7f1454435f22671ac0ebd29f76a52863", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Igranje.CF269\n{\n class ProblemC\n {\n public static void Main(String[] varg)\n {\n Int64 n = Int64.Parse(System.Console.ReadLine());\n\n double z = ((n + 1)*2.0)/3.0;\n double k = Math.Sqrt(4*z + 1);\n k = k - 1;\n k = k/2;\n\n Int64 rv = (Int64) k;\n\n\n Int64 ispravan = 0;\n bool dole = false;\n\n while (true)\n {\n int a = provera(rv, n);\n if (a > 0)\n {\n ispravan = rv;\n if (dole) break;\n rv++;\n continue;\n \n }else if (a < 0)\n {\n rv--;\n dole = true;\n continue;\n }\n else\n {\n ispravan = rv;\n break;\n }\n }\n\n rv = provera2(ispravan,n);\n System.Console.WriteLine(rv);\n }\n\n private static int provera(Int64 ulaz, Int64 izlaz)\n {\n Int64 brojKarata = 2*ulaz + ((ulaz*(ulaz - 1))/2)*3;\n if (brojKarata < izlaz)\n return 1;\n else if (brojKarata > izlaz)\n return -1;\n else\n {\n return 0;\n }\n }\n\n private static Int64 provera2(Int64 ulaz, Int64 n)\n {\n Int64 rez = 0;\n if (n%3 == 1)\n {\n \n for (Int64 s = 1; s <= ulaz; s++)\n {\n if ((2*s) % 3 == 1)\n rez++;\n }\n }\n else if (n%3 == 0)\n {\n for (Int64 s = 1; s <= ulaz; s++)\n {\n if ((2*s) % 3 == 0)\n rez++;\n }\n }\n else if (n % 3 == 2)\n {\n for (Int64 s = 1; s <= ulaz; s++)\n {\n if ((2*s) % 3 == 2)\n rez++;\n }\n }\n return rez;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2f5ed9bf0c5b0cba76dccd2d58d3fb58", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "difficulty": 1700.0} {"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 long n = Convert.ToInt64(Console.ReadLine());\n\n int MAX_HEIGHT = 1000000;\n long[] cards = new long[MAX_HEIGHT];\n cards[0] = 0;\n\n for (int i = 1; i < MAX_HEIGHT; i++)\n {\n cards[i] = cards[i-1] + ((i-1) * 3) + 2;\n }\n\n int count = 0;\n for (int i = 1; i < MAX_HEIGHT; i++)\n {\n if (cards[i] > n)\n break;\n\n if (cards[i] == n)\n {\n count++;\n continue;\n }\n\n long remaining = n - cards[i];\n\n if (remaining % 3 == 0)\n count++;\n }\n\n Console.WriteLine(count);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1d1f04466d23a6cb1433ccbd1f7805b2", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "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 Igranje.CF269\n{\n class ProblemC\n {\n public static void Main(String[] varg)\n {\n Int64 n = Int64.Parse(System.Console.ReadLine());\n\n double z = ((n + 1)*2.0)/3.0;\n double k = Math.Sqrt(4*z + 1);\n k = k - 1;\n k = k/2;\n\n Int64 rv = (Int64) k;\n\n\n Int64 ispravan = 0;\n bool dole = false;\n while (true)\n {\n if (provera(rv, n) > 0)\n {\n ispravan = rv;\n if (dole) break;\n rv++;\n continue;\n \n }\n if (provera(rv, n) < 0)\n {\n rv--;\n dole = true;\n continue;\n }\n }\n\n rv = provera2(rv,n);\n System.Console.WriteLine(rv);\n }\n\n private static int provera(Int64 ulaz, Int64 izlaz)\n {\n Int64 brojKarata = 2*ulaz + ((ulaz*(ulaz - 1))/2)*3;\n if (brojKarata < izlaz)\n return 1;\n else if (brojKarata > izlaz)\n return -1;\n else\n {\n return 0;\n }\n }\n\n private static Int64 provera2(Int64 ulaz, Int64 n)\n {\n Int64 rez = 0;\n if (n%3 == 1)\n {\n \n for (Int64 s = 1; s <= ulaz; s++)\n {\n if (((s * (s + 1)) / 2) % 3 == 1)\n rez++;\n }\n }\n else if (n%3 == 0)\n {\n for (Int64 s = 1; s <= ulaz; s++)\n {\n if (((s*(s+1))/2) % 3 == 0)\n rez++;\n }\n }\n else if (n % 3 == 2)\n {\n for (Int64 s = 1; s <= ulaz; s++)\n {\n if (((s * (s + 1)) / 2) % 3 == 2)\n rez++;\n }\n }\n return rez;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "909d5d20d3d51e67ad79dba8baf4fc48", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "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 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\n bool[] seen = new bool[100000+1];\n int leaderId = -1;\n bool leaderOnline = false;\n bool thereWasALeader = false;\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\n if (symbol == '+')\n {\n if (leaderId != -1 ) \n {\n if (!leaderOnline)\n {\n if (leaderId == id) leaderOnline = true;\n else\n {\n leaderId = -1;\n leaderOnline = false;\n }\n } \n\n }\n \n if (leaderId == -1 && i == 0) \n {\n leaderId = id;\n thereWasALeader = true;\n leaderOnline = true;\n }\n \n }\n if (symbol == '-')\n {\n if(!seen[id])\n {\n if(leaderOnline)\n {\n leaderId = -1;\n leaderOnline = false;\n } else\n {\n leaderId = id;\n thereWasALeader = true;\n leaderOnline = false;\n }\n }\n else\n {\n if(leaderId != -1 && !leaderOnline)\n {\n leaderId = -1; \n } \n if (leaderId == id) leaderOnline = false;\n }\n }\n seen[id] = true;\n }\n\n var leaders = new ArrayList();\n for (int i = 1; i <= numberOfPeople; i++)\n {\n if (!seen[i]) leaders.Add(i);\n else if (leaderId == 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": false, "code_uid": "851c0aa85b2996eafba9d30ab7c96d4d", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problems\n{\n public class Problem420B\n {\n public static void Main(string[] args)\n {\n var nm = Console.ReadLine().Split(' ');\n var n = int.Parse(nm[0]);\n var m = int.Parse(nm[1]);\n\n var seen = new bool[n];\n var onlineCount = 0;\n var leaderCandidate = 0;\n var leaderOnline = false;\n\n for (int i = 0; i < m; i++)\n {\n var msg = Console.ReadLine().Split(' ');\n var action = msg[0][0];\n var id = int.Parse(msg[1]);\n\n if (action == '+')\n {\n seen[id - 1] = true;\n\n if (leaderCandidate == 0)\n {\n if (onlineCount == 0)\n {\n leaderCandidate = id;\n leaderOnline = true;\n }\n }\n else\n {\n if (!leaderOnline)\n {\n if (leaderCandidate != id)\n {\n leaderCandidate = 0;\n }\n else\n {\n leaderOnline = true;\n }\n }\n }\n\n onlineCount++;\n }\n else\n {\n if (!seen[id - 1])\n {\n if (onlineCount == 0)\n {\n leaderCandidate = id;\n leaderOnline = false;\n }\n else\n {\n leaderCandidate = 0;\n leaderOnline = false;\n }\n }\n else\n {\n onlineCount = Math.Max(--onlineCount, 0);\n\n if (leaderCandidate == 0)\n {\n }\n else\n {\n if (leaderCandidate != id)\n {\n if (!leaderOnline)\n {\n leaderCandidate = 0;\n }\n }\n else\n {\n if (onlineCount > 0)\n {\n leaderCandidate = 0;\n }\n\n leaderOnline = false;\n }\n }\n }\n\n seen[id - 1] = true;\n }\n }\n\n if (n == 1)\n {\n Console.WriteLine(\"1\");\n Console.WriteLine(\"1\");\n }\n else\n {\n var k = 0;\n StringBuilder sb = new StringBuilder();\n\n for (int i = 0; i < n; i++)\n {\n if (i + 1 == leaderCandidate)\n {\n ++k;\n sb.AppendFormat(\"{0} \", leaderCandidate);\n }\n\n if (seen[i] == false)\n {\n ++k;\n sb.AppendFormat(\"{0} \", i + 1);\n }\n }\n\n Console.WriteLine(k);\n Console.WriteLine(sb.ToString());\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3fe48d9c13d068ef4efedf515250ea75", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800.0} {"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)\n {\n NotALeader.Add(id);\n \n }\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 \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": false, "code_uid": "1773b7327a6e66896a539b47b7976480", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800.0} {"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 int lastEmployeeID = -1;\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 }\n employees[id] = 1;\n }\n\n if (symbol == '-')\n {\n var prevStatusOfEmployee = employees[id];\n\n if (lastEmployeeID == id && prevStatusOfEmployee == 1)\n {\n NotALeader.Add(id);\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)\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": false, "code_uid": "57569f757957b42e3e7b2b7e889580b9", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problems\n{\n public class Problem420B\n {\n public static void Main(string[] args)\n {\n var nm = Console.ReadLine().Split(' ');\n var n = int.Parse(nm[0]);\n var m = int.Parse(nm[1]);\n\n var notLeaders = new bool[n];\n var present = new HashSet();\n var absent = new HashSet();\n\n int lastpersonToLeave = 0;\n for (int i = 0; i < m; i++)\n {\n var msg = Console.ReadLine().Split(' ');\n var action = msg[0][0];\n var id = int.Parse(msg[1]);\n\n if (action == '+')\n {\n if (present.Count > 0)\n {\n // Not the first guy to be in the session\n notLeaders[id - 1] = true;\n continue;\n }\n\n present.Add(id);\n absent.Remove(id);\n\n if (lastpersonToLeave != 0 && lastpersonToLeave != id)\n {\n // Other people have left when current guy was absent\n // current guy is not leader\n notLeaders[id - 1] = true;\n }\n\n // Anyone who is absent cannot be leader, \n // because they are certainly not here when a new person is joining\n foreach (var absentee in absent)\n {\n notLeaders[absentee - 1] = true;\n }\n\n absent = new HashSet();\n }\n else\n {\n lastpersonToLeave = id;\n\n // Means anyone who is present now joined after current guy joined\n // None of them can be leader\n if (!present.Contains(id))\n {\n foreach (var presented in present)\n {\n notLeaders[presented - 1] = true;\n }\n }\n\n present.Remove(id);\n\n // Other people are present when current guy left\n // Current guy cannot be leader\n if (present.Count > 0)\n {\n notLeaders[id - 1] = true;\n }\n\n // Anyone who is absent for sure cannot be leader, \n // because they are for sure nto the last person to leave the room\n foreach (var absentee in absent)\n {\n notLeaders[absentee - 1] = true;\n }\n\n absent = new HashSet(); \n absent.Add(id);\n }\n }\n\n var k = 0;\n var sb = new StringBuilder();\n for (int i = 0; i < n; i++)\n {\n if (!notLeaders[i])\n {\n ++k;\n sb.AppendFormat(\"{0} \", i + 1);\n }\n }\n\n Console.WriteLine(k);\n Console.WriteLine(sb.ToString());\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "85ec3a0f7a00be9ce682787fd6abd11e", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800.0} {"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 bool noOneLoggedIn = true;\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)\n {\n NotALeader.Add(id);\n noOneLoggedIn = false;\n }\n }\n if (noOneLoggedIn = true) NotALeader.Add(id);\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 \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": false, "code_uid": "2bff565d80e95c2fd96ea709e5c28fe9", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problems\n{\n public class Problem420B\n {\n public static void Main(string[] args)\n {\n var nm = Console.ReadLine().Split(' ');\n var n = int.Parse(nm[0]);\n var m = int.Parse(nm[1]);\n\n var notLeaders = new bool[n];\n var present = new HashSet();\n var absent = new HashSet();\n\n // var loner = new HashSet();\n\n int lastpersonToLeave = 0;\n for (int i = 0; i < m; i++)\n {\n var msg = Console.ReadLine().Split(' ');\n var action = msg[0][0];\n var id = int.Parse(msg[1]);\n\n if (action == '+')\n {\n if (present.Count > 0)\n {\n // Not the first guy to be in the session\n notLeaders[id - 1] = true;\n }\n\n present.Add(id);\n absent.Remove(id);\n\n if (lastpersonToLeave != 0 && lastpersonToLeave != id)\n {\n // Other people have left when current guy was absent\n // current guy is not leader\n notLeaders[id - 1] = true;\n }\n\n // Anyone who is absent cannot be leader, \n // because they are certainly not here when a new person is joining\n foreach (var absentee in absent)\n {\n notLeaders[absentee - 1] = true;\n }\n }\n else\n {\n lastpersonToLeave = id;\n\n // Means anyone who is present now joined after current guy joined\n // None of them can be leader\n if (!present.Contains(id))\n {\n foreach (var presented in present)\n {\n notLeaders[presented - 1] = true;\n }\n }\n\n present.Remove(id);\n absent.Add(id);\n\n // Other people are present when current guy left\n // Current guy cannot be leader\n if (present.Count > 0)\n {\n notLeaders[id - 1] = true;\n }\n\n // Anyone who is absent for sure cannot be leader, \n // because they are for sure nto the last person to leave the room\n foreach (var absentee in absent)\n {\n if (absentee != id)\n {\n notLeaders[absentee - 1] = true;\n }\n }\n }\n }\n\n var k = notLeaders.Sum(notLeader => notLeader ? 0 : 1);\n Console.WriteLine(k);\n\n for (int i = 0; i < n; i++)\n {\n if (!notLeaders[i])\n {\n Console.Write(\"{0} \", i + 1);\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "af4a477d879a219d24a009b1b818068a", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800.0} {"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 Dictionary employees = new Dictionary();\n \n var NotALeader = new HashSet();\n\n int lastPersonId = -1;\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 foreach (var pair in employees)\n {\n if (pair.Key == id) continue;\n // if others joined before me, I am not a leader\n if (pair.Value == 1)\n {\n NotALeader.Add(id);\n }\n // if other people joined and logged out before me, they are not a leader.\n // I am also not a leader unless I just logged out and logging back in\n if (pair.Value == 0)\n {\n NotALeader.Add(pair.Key);\n if (lastPersonId != id) NotALeader.Add(id);\n }\n }\n employees[id] = 1;\n }\n\n if (symbol == '-')\n {\n bool havePreviousRecord = employees.ContainsKey(id);\n\n // when I am logging out, if others are still logged in, i am not a leader\n foreach (var pair in employees)\n {\n if (pair.Key == id) continue;\n if (pair.Value == 1)\n {\n NotALeader.Add(id);\n }\n // if I have no record of me joining, then other who logged in (or logged in and out) after me are not a leader \n if (!havePreviousRecord)\n {\n if (pair.Value == 1 || pair.Value == 0) NotALeader.Add(pair.Key);\n }\n }\n\n employees[id] = 0;\n }\n lastPersonId = id;\n }\n\n var leaders = new ArrayList();\n for (int i = 1; i <= numberOfPeople; i++)\n {\n 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": false, "code_uid": "1b81a1d08130c5dd62d90a37ad2f166d", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problems\n{\n public class Problem420B\n {\n public static void Main(string[] args)\n {\n var nm = Console.ReadLine().Split(' ');\n var n = int.Parse(nm[0]);\n var m = int.Parse(nm[1]);\n\n var seen = new bool[n];\n var onlineCount = 0;\n var leaderCandidate = 0;\n var leaderOnline = false;\n\n for (int i = 0; i < m; i++)\n {\n var msg = Console.ReadLine().Split(' ');\n var action = msg[0][0];\n var id = int.Parse(msg[1]);\n\n if (action == '+')\n {\n if (leaderCandidate == 0)\n {\n if (onlineCount == 0 && seen[id - 1] == false)\n {\n leaderCandidate = id;\n leaderOnline = true;\n }\n }\n else if (leaderCandidate == id)\n {\n leaderOnline = true;\n }\n else if (!leaderOnline)\n {\n leaderCandidate = -1;\n leaderOnline = false;\n }\n\n seen[id - 1] = true;\n onlineCount++;\n }\n else\n {\n if (!seen[id - 1])\n {\n if (onlineCount == 0)\n {\n leaderCandidate = id;\n leaderOnline = false;\n }\n else\n {\n leaderCandidate = -1;\n leaderOnline = false;\n }\n }\n else\n {\n onlineCount = Math.Max(--onlineCount, 0);\n\n if (leaderCandidate <= 0)\n {\n }\n else\n {\n if (leaderCandidate != id)\n {\n if (!leaderOnline)\n {\n leaderCandidate = -1;\n leaderOnline = false;\n }\n }\n else\n {\n if (onlineCount > 0)\n {\n leaderCandidate = -1;\n }\n\n leaderOnline = false;\n }\n }\n }\n\n seen[id - 1] = true;\n }\n }\n\n //if (n == 1)\n //{\n // Console.WriteLine(\"1\");\n // Console.WriteLine(\"1\");\n //}\n //else\n //{\n var k = 0;\n StringBuilder sb = new StringBuilder();\n\n for (int i = 0; i < n; i++)\n {\n if (i + 1 == leaderCandidate)\n {\n ++k;\n sb.AppendFormat(\"{0} \", leaderCandidate);\n }\n\n if (seen[i] == false)\n {\n ++k;\n sb.AppendFormat(\"{0} \", i + 1);\n }\n }\n\n Console.WriteLine(k);\n Console.WriteLine(sb.ToString());\n //}\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ae6a6393553ef5204a12d1e58f885dab", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "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 ConsoleApp10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m, h;\n string[] nmh = Console.ReadLine().Split();\n n = int.Parse(nmh[0]);\n h = int.Parse(nmh[1]);\n m = int.Parse(nmh[2]);\n int[] houses = new int[n];\n for (int i = 0; i < n; i++)\n houses[i] = h;\n for (int i = 0;i x)\n houses[j] = x;\n }\n }\n long ans = 0;\n for (int i = 0; i < n; i++)\n ans += houses[i] * houses[i];\n Console.WriteLine(ans);\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "895df95b6d4b4fd1faf6a737f2c961e6", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "difficulty": 800.0} {"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[] houses = new int[args[0]];\n int sum = 0;\n for (int i = 0; i < houses.Length; i++)\n houses[i] = args[1];\n for (int i = 0; i < args[2]; i++)\n {\n int[] m = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n for (int j = m[0]; j <= m[1]; j++)\n houses[j-1] = Math.Min(m[2],houses[j-1]);\n }\n for (int i = 0; i < houses.Length; i++)\n sum += houses[i] * houses[i];\n Console.WriteLine(sum);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ab370f03cc7be06e99c4f7624b6eabb", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "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*/\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 int GCD (int a, int b)\n\t{\n\t\twhile ( a != 0 && b != 0 )\n\t\t\tif ( a > b )\n\t\t\t\ta %= b;\n\t\t\telse\n\t\t\t\tb %= a;\n\t\treturn ( a > 0 ? a : b );\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\\\\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# if ( ! ONLINE_JUDGE )\n\t\tint _t = int.Parse (sr.ReadLine ());\n\t\tfor ( int ttt=0; ttt < _t; ttt++ )\n\t\t{\n\t\tsw.WriteLine (\"*** test = \" + ttt);\n# endif\n\t\t\n\t\tstring s;\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n\t\tsw.WriteLine (\"*** \" + s);\n# endif\n\n\t\tint n, m, h;\n\t\t{\n\t\t\tstring [] ss = s.Split (' ');\n\t\t\tn = int.Parse (ss [0]);\n\t\t\th = int.Parse (ss [1]);\n\t\t\tm = int.Parse (ss [2]);\n\t\t}\n\n\t\tint [] l = new int [m];\n\t\tint [] r = new int [m];\n\t\tint [] x = new int [m];\n\t\tint [] d = new int [n];\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\td [i] = h;\n\t\tfor ( int i=0; i < m; i++ )\n\t\t{\n\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\tstring [] ss = s.Split (' ');\n\t\t\tl [i] = int.Parse (ss [0]) - 1;\n\t\t\tr [i] = int.Parse (ss [1]) - 1;\n\t\t\tx [i] = int.Parse (ss [2]);\n\t\t\tfor ( int j=l [i]; j <= r [i]; j++ )\n\t\t\t\tif ( d [j] > x [i] )\n\t\t\t\t\td [j] = x [i];\n\t\t}\n\n\t\tint k = 0;\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tk += d [i] * d [i];\n\t\t\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine (k);\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\t}\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6a78ce1cf647580c6225add808a0a6e9", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "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\tstring[]str = Console.ReadLine().Split();\n\t\tint N = int.Parse(str[0]);\n\t\tint H = int.Parse(str[1]);\n\t\tint M = int.Parse(str[2]);\n\t\tint[]A = new int[N];\n\t\tfor(var i=0;i x * x).Sum());\n }\n\n #region Template\n\n private static StringBuilder output = new StringBuilder();\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n output.Length = 0;\n Thread main = new Thread(new ThreadStart(s_threadStart), 200 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n Console.Write(output);\n timer.Stop();\n Console.Error.WriteLine(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n do\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n } while (string.IsNullOrEmpty(ioEnum.Current));\n\n return ioEnum.Current;\n }\n\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n W(o);\n output.Append(Console.Out.NewLine);\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n W(enumerable);\n output.Append(Console.Out.NewLine);\n }\n\n private static void W(T o)\n {\n if (o is double)\n {\n Wd((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wd((o as float?).Value, \"\");\n }\n else\n output.Append(o.ToString());\n }\n\n private static void W(IEnumerable enumerable)\n {\n W(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wd(double d, string format)\n {\n W(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n #endregion\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "da789660704676c84057a829ae88051d", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "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\tstring[]str = Console.ReadLine().Split();\n\t\tint N = int.Parse(str[0]);\n\t\tint H = int.Parse(str[1]);\n\t\tint M = int.Parse(str[2]);\n\t\tint[]A = new int[N];\n\t\tfor(var i=0;i 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": "2956b91a7be1e233ffcf015e140b52d6", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "difficulty": 800.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 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": "09bb25e2ebbeb752e8bcebcb92de17f1", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.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(\"{0:F12}\",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": "ceaccf4dd1bb69c2d16803f424ea8fad", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "difficulty": 2400.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\n\r\nnamespace CodeforcesTasks.Contest1551\r\n{\r\n // https://codeforces.com/contest/1551/problem/D1\r\n public class TaskD\r\n {\r\n static int[] Read() => Array.ConvertAll(Console.ReadLine()!.Split(), int.Parse);\r\n \r\n static void Main(string[] args)\r\n {\r\n var count = int.Parse(Console.ReadLine()!);\r\n for (var i = 0; i < count; i++)\r\n {\r\n var p = Read();\r\n Console.WriteLine(Solve(p[0], p[1], p[2]) ? \"YES\" : \"NO\");\r\n }\r\n }\r\n \r\n public static bool Solve(int n, int m, int k)\r\n {\r\n if (n % 2 == 0) return k % 2 == 0 && k <= n * (m / 2);\r\n if (k % ( m / 2) != 0) return false;\r\n return (n - k / (m / 2)) % 2 == 0;\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2cd31b7856ed00ae69ac774feacfabfc", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "difficulty": 1700.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 n = ni();\n var mod = nl();\n long ans = 0;\n\n var fact = new long[n + 1000];\n fact[0] = fact[1] = 1;\n for (int i = 2; i < fact.Length; i++) {\n fact[i] = fact[i - 1] * i % mod;\n }\n\n for (int i = 1; i <= n; i++) {\n long pattern = (n - i) + 1; // place pattern \n pattern *= (n - i) + 1; pattern %= mod;// choose pattern\n pattern *= fact[i]; pattern %= mod; // perm pattern\n pattern *= fact[n - i]; pattern %= mod;\n ans += pattern % mod;\n ans %= mod;\n }\n\n cout.WriteLine(ans);\n }\n}\n\n// PREWRITEN CODE BEGINS FROM HERE\ninternal partial class Solver : Scanner {\n public static void Main(string[] args) {\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#pragma warning restore IDE0052\n\n public Solver(TextReader reader, TextWriter writer)\n : base(reader) {\n cin = reader;\n cout = writer;\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\ninternal static class LinqPadExtension {\n [Conditional(\"DEBUG\")]\n public static void Dump(this T obj) {\n#if DEBUG\n LINQPad.Extensions.Dump(obj);\n#endif\n }\n}\n\npublic class Scanner {\n private readonly TextReader Reader;\n private readonly Queue TokenQueue = new Queue();\n private readonly CultureInfo ci = CultureInfo.InvariantCulture;\n\n public Scanner()\n : this(Console.In) {\n }\n\n public Scanner(TextReader reader) {\n Reader = reader;\n }\n\n public int NextInt() { return int.Parse(Next(), ci); }\n public long NextLong() { return long.Parse(Next(), ci); }\n public double NextDouble() { return double.Parse(Next(), ci); }\n public string[] NextArray(int size) {\n 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 (TokenQueue.Count == 0) {\n if (!StockTokens()) {\n throw new InvalidOperationException();\n }\n }\n return TokenQueue.Dequeue();\n }\n\n public bool HasNext() {\n if (TokenQueue.Count > 0) {\n return true;\n }\n\n return StockTokens();\n }\n\n private static readonly char[] _separator = new[] { ' ', '\\t' };\n private bool StockTokens() {\n while (true) {\n string line = Reader.ReadLine();\n if (line == null) {\n return false;\n }\n\n string[] tokens = line.Split(_separator, StringSplitOptions.RemoveEmptyEntries);\n if (tokens.Length == 0) {\n continue;\n }\n\n foreach (string token in tokens) {\n TokenQueue.Enqueue(token);\n }\n\n return true;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "744071255bce21a774a8b0346e8388f1", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.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 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 static int upperBound(IList ordered, T val)\n {\n var lst = ordered;\n if (lst == null) throw new ArgumentNullException();\n\n Comparer comparer = Comparer.Default;\n\n if (lst.Count < 1) return -1;\n\n var l = -1;\n var r = lst.Count;\n\n while (r - l > 1)\n {\n var cur = (l + r) / 2;\n if (comparer.Compare(lst[cur], val) <= 0)\n {\n l = cur;\n }\n else\n {\n r = cur;\n }\n\n }\n return r;\n }\n\n private static void Main(string[] args)\n {\n long[] nm = readLongs();\n var n = nm[0];\n var m = nm[1];\n\n var facts = factorial(n, m);\n long cnt = 0;\n for (int i = 1; i <= n; i++)\n {\n cnt += (((((facts[i] * facts[(int)n - i]) % m) * (n - i + 1L)) % m) * (n - i + 1)) % m;\n cnt = cnt % m;\n }\n cnt.WriteLine();\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "01fe05e76725a61f04c29a451d5567fd", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing static System.Console;\nusing static System.Math;\nusing static MyIO;\nusing static MyUtil;\n\npublic class C\n{\n\tpublic static void Main() => (new Solver()).Solve();\n}\n\npublic class Solver\n{\n\tpublic void Solve()\n\t{\n\t\tlong N = GetLong();\n\t\tlong M = GetLong();\n\n\t\tlong[] f = new long[N + 1];\n\t\tf[0] = 1;\n\t\tf[1] = 1;\n\t\tfor(long i = 2; i <= N; i++)\n\t\t\tf[i] = (f[i - 1] * i) % M;\n\n\t\tlong ans = 0;\n\t\tfor(long len = 1; len <= N; len++)\n\t\t{\n\t\t\tlong cut = N - len + 1;\n\t\t\tans = (ans + (((cut * f[len]) % M) * f[cut]) % M) % M;\n\t\t}\n\n\t\tWriteLine(ans);\n\t}\n}\n\npublic static class MyIO\n{\n\tprivate static string[] args = null;\n\tprivate static int num = -1;\n\tprivate static int used = -1;\n\n\tprivate static string getArg()\n\t{\n\t\tif(used == num)\n\t\t{\n\t\t\targs = Console.ReadLine().Split(' ');\n\t\t\tnum = args.Length;\n\t\t\tused = 0;\n\t\t}\n\t\treturn args[used++];\n\t}\n\n\tpublic static int GetInt() => int.Parse(getArg());\n\tpublic static long GetLong() => long.Parse(getArg());\n\tpublic static double GetDouble() => double.Parse(getArg());\n\tpublic static decimal GetDecimal() => decimal.Parse(getArg());\n\tpublic static string GetString() => getArg();\n\tpublic static char GetChar() => getArg()[0];\n\tpublic static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();\n\tpublic static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();\n\tpublic static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();\n\tpublic static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();\n\tpublic static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();\n}\n\npublic static class MyUtil\n{\n\tpublic static void chmax(ref T x, T y) where T : IComparable\n\t{\n\t\tif(x.CompareTo(y) < 0)\n\t\t\tx = y;\n\t}\n\n\tpublic static void chmin(ref T x, T y) where T : IComparable\n\t{\n\t\tif(x.CompareTo(y) > 0)\n\t\t\tx = y;\n\t}\n\n\tpublic static void swap(ref T x, ref T y)\n\t{\n\t\tT tmp = x;\n\t\tx = y;\n\t\ty = tmp;\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8332cb2d1348d9293f5fc88f94d65372", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nm = Console.ReadLine().Split();\n long n = int.Parse(nm[0]);\n long m = long.Parse(nm[1]);\n long[] fact = new long[250005];\n fact[0] = 1;\n for (int i = 1; i <= n; i++)\n fact[i] = fact[i - 1] * i % m;\n long ret = 0;\n for (int i = 1; i <= n; i++)\n {\n ret += (n - i + 1) * (fact[i] * fact[n - i + 1] % m);\n ret %= m;\n }\n Console.WriteLine(ret);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ea7f0687b0d75ada301da01099faed30", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading.Tasks;\nusing static Codeforces.IO;\nusing static System.Linq.Enumerable;\n\nnamespace Codeforces\n{\n static class IO\n {\n static StringBuilder builder = new StringBuilder();\n static Dummy dummy = new Dummy();\n class Dummy\n {\n ~Dummy()\n {\n Console.Write(builder);\n }\n }\n public static void Write(object obj)\n {\n builder.Append(obj);\n }\n public static void WriteLine(object obj)\n {\n builder.AppendLine(obj.ToString());\n }\n public static void Write(params object[] objs)\n {\n if (objs.Length != 0)\n {\n Write(objs[0]);\n for (var i = 1; i < objs.Length; ++i)\n {\n Write(\" \");\n Write(objs[i]);\n }\n }\n }\n public static void WriteLine(params object[] objs)\n {\n Write(objs);\n WriteLine();\n }\n\n public static void WriteLine()\n {\n builder.AppendLine();\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n public static T ReadLine(Func parser)\n {\n return parser(ReadLine());\n }\n public static T[] ReadArray(Func parser)\n {\n return ReadLine().Split(' ').Select(parser).ToArray();\n }\n public static string[] ReadArray()\n {\n return ReadLine().Split(' ');\n }\n public static (T, T) ReadTuple2(Func parser)\n {\n var ar = ReadArray(parser);\n return (ar[0], ar[1]);\n }\n public static (string, string) ReadTuple2()\n {\n var ar = ReadArray();\n return (ar[0], ar[1]);\n }\n public static (T, T, T) ReadTuple3(Func parser)\n {\n var ar = ReadArray(parser);\n return (ar[0], ar[1], ar[2]);\n }\n public static (string, string, string) ReadTuple3()\n {\n var ar = ReadArray();\n return (ar[0], ar[1], ar[2]);\n }\n }\n\n static class Program\n {\n struct ModNum\n {\n public static long mod = 1000000007;\n\n long val;\n public ModNum(long v)\n {\n v %= mod;\n if (v < 0)\n {\n v += mod;\n }\n this.val = v;\n }\n public static implicit operator ModNum(long v)\n {\n return new ModNum(v);\n }\n public static implicit operator ModNum(int v)\n {\n return new ModNum(v);\n }\n\n public static ModNum operator +(ModNum lhs, ModNum rhs)\n {\n return new ModNum(lhs.val + rhs.val);\n }\n public static ModNum operator -(ModNum lhs, ModNum rhs)\n {\n return new ModNum(lhs.val - rhs.val);\n }\n public static ModNum operator *(ModNum lhs, ModNum rhs)\n {\n return new ModNum(lhs.val * rhs.val);\n }\n public static ModNum operator /(ModNum lhs, ModNum rhs)\n {\n var right = new ModNum(1);\n long m = mod - 2;\n for (long i = 1; i <= mod - 2; i *= 2)\n {\n if ((i & m) != 0)\n {\n right *= rhs;\n }\n rhs *= rhs;\n }\n return lhs * right;\n }\n\n public override string ToString()\n {\n return this.val.ToString();\n }\n }\n\n static void Main(string[] args)\n {\n var (N, M) = ReadTuple2(int.Parse);\n ModNum.mod = M;\n var fact = new ModNum[N + 1];\n fact[0] = 1;\n foreach(var i in Range(1, N))\n {\n fact[i] = fact[i - 1] * i;\n }\n var result = new ModNum();\n foreach(var i in Range(0, N))\n {\n result += fact[N - 1 - i] * fact[i + 1] * (N - i) * (N - i);\n }\n WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ca2e92541e1f31b53120b1a392c81ca0", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "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 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9ee6d02c36058b2fe468c06bb764ddfe", "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[] mas = new int[5];\n\n for (int i = 0; i < 5; i++)\n {\n mas[i] = int.Parse(s[i]);\n }\n\n mas[2] /= 2;\n mas[3] /= 7;\n mas[4] /= 4;\n\n int min = int.MaxValue;\n for (int i = 0; i < 5; i++)\n {\n if (min > mas[i])\n {\n min = mas[i];\n }\n }\n System.Console.Write(min);\n } \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2d28f66e79dcc6629ba15480ccd0a3dd", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.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 List lst = ReadIntList();\n\n int count = int.MaxValue;\n count = Math.Min(lst[0], count);\n count = Math.Min(lst[1], count);\n count = Math.Min(lst[2] / 2, count);\n count = Math.Min(lst[3] / 7, count);\n count = Math.Min(lst[4] / 4, count);\n Console.WriteLine(count);\n\n /*\n watch.Stop();\n var elapsedMs = watch.ElapsedMilliseconds;\n Console.WriteLine(elapsedMs);*/\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "638f017c3eced0b02b38e532bef900d9", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "C# 8", "source_code": "\ufeff\ufeffusing System;\r\nusing System.Linq;\r\n\r\nnamespace CodeForces\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n var arr = Console.ReadLine().Split(' ');\r\n var n = Int32.Parse(arr[0]);\r\n var m = long.Parse(arr[1]);\r\n var res = GetRes(n, m);\r\n Console.WriteLine(res);\r\n\r\n // Test();\r\n }\r\n\r\n const int MOD_VAL = 998244353;\r\n private static int GetRes(int n, long m)\r\n {\r\n if (n == 1) return 0;\r\n var fullCount = GetFullCount(n, m);\r\n var noOk = GetNOKCount(n,m);\r\n var res = fullCount - noOk;\r\n if(res < 0) res+=MOD_VAL;\r\n return res;\r\n }\r\n\r\n private static int GetFullCount(int n, long m)\r\n {\r\n var divisor = (int)((m-1) % MOD_VAL);\r\n if (divisor == 0) return n; \r\n var reverse = GetReverse(divisor);\r\n var mAfterMod = (int)(m % MOD_VAL);\r\n var res = (int)(((long)GetPow(mAfterMod, n+1) - mAfterMod) *\r\n reverse % MOD_VAL);\r\n if (res < 0) res+=MOD_VAL;\r\n return res; \r\n }\r\n\r\n private static int GetReverse(int val)\r\n {\r\n var (a,b) = ExGcd(MOD_VAL, val);\r\n return b >= 0 ? (int) b: (int)(MOD_VAL+b);\r\n }\r\n\r\n private static (long, long) ExGcd(long num0, long num1)\r\n {\r\n if (num0 % num1 == 0)\r\n {\r\n return (0, 1);\r\n }\r\n // a0 * num0 + b0 * num1 = num2\r\n var num2 = num0 % num1;\r\n var a0 = 1;\r\n var b0 = -(num0 / num1);\r\n // a1 * num1 + b1 * num2 = gcd\r\n var (a1, b1) = ExGcd(num1, num2);\r\n // (a0*b1) * num0 + (a1 + b0*b1) * num1 = gcd\r\n return (a0 * b1, a1 + b0 * b1);\r\n }\r\n\r\n private static int GetPow(int baseVal, int exponent)\r\n {\r\n var index = 0;\r\n var res = 1L;\r\n long tmp = baseVal;\r\n while(1< rotate = point => new Point(point.Y, n - 1 - point.X);\n Func flip = point => new Point(n - 1 - point.X, point.Y);\n\n if (Check(n, a, b, point => point) ||\n Check(n, a, b, point => rotate(point)) ||\n Check(n, a, b, point => rotate(rotate(point))) ||\n Check(n, a, b, point => rotate(rotate(rotate(point)))) ||\n Check(n, a, b, point => flip(point)) ||\n Check(n, a, b, point => flip(rotate(point))) ||\n Check(n, a, b, point => flip(rotate(rotate(point)))) ||\n Check(n, a, b, point => flip(rotate(rotate(rotate(point))))))\n {\n Writer.WriteLine(\"Yes\");\n }\n else\n {\n Writer.WriteLine(\"No\");\n }\n }\n\n public static bool Check(int n, string[] a, string[] b, Func transformation)\n {\n for (int x = 0; x < n; x++)\n {\n for (int y = 0; y < n; y++)\n {\n var p = transformation(new Point(x, y));\n if (a[x][y] != b[p.X][p.Y])\n {\n return false;\n }\n }\n }\n return true;\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 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 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": "7716295680836308210566313a1ba458", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "difficulty": 1400.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 ok0 = 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][j] )\n\t\t\t\t{\n\t\t\t\t\tok0 = false; break;\n\t\t\t\t}\n\t\t\tif ( ! ok0 )\n\t\t\t\tbreak;\n\t\t}\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 = ok0 || 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": "c2f45a22f0276f0d4eeb607bcb571337", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "difficulty": 1400.0} {"lang": "C# 8", "source_code": "using System;\r\n\r\nnamespace _1505B._DMCA\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int n = int.Parse(Console.ReadLine());\r\n if (n > 9)\r\n {\r\n Console.WriteLine(9);\r\n }\r\n else\r\n {\r\n Console.WriteLine(n);\r\n }\r\n //baaler problem part 2\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e594a6e5c9e30cb39f8bf55b4043ed3d", "src_uid": "477a67877367dc68b3bf5143120ff45d", "difficulty": 1600.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_E\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] b = new int[n + 1];\n b[1] = -1;\n for (int i = 2; i <= n; i++)\n {\n b[i] = -1;\n for (int len = 2; len * (len + 1) / 2 <= i; len++)\n {\n if (i * 2 % len == 0)\n {\n int aa = i * 2 / len - len + 1;\n if (aa % 2 == 0 && aa > 0)\n {\n int x = aa / 2;\n //(x, len)\n bool ok = true;\n for (int k = 0; k < len; k++)\n {\n if (b[x + k] >= 0)\n {\n ok = !ok;\n }\n }\n if (ok)\n {\n b[i] = len;\n break;\n }\n }\n }\n }\n }\n //for (int i = 0; i < n; i++)\n //{\n // Console.WriteLine(i + \" \" + b[i]);\n //}\n Console.WriteLine(b[n]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "93a993879e7e1fd83ac4b70b36679eb1", "src_uid": "63262317ba572d78163c91b853c05506", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main()\n {\n var N = Int32.Parse(Console.ReadLine().Trim());\n \n int[] grandi = new int[N+1];\n int[] numGrandi = new int[N+1];\n int nim;\n int[] answ = new int[N+1];\n\n for (int i = 0; i < N + 1; i++)\n {\n numGrandi[i] = -1;\n answ[i] = -1;\n }\n for (int n = 0; n <= N; n++)\n { \n for (int count = 2; (count * (count + 1)) / 2 <= n; count++)\n {\n if ((2 * n - count * (count - 1)) % (2 * count) != 0)\n continue;\n int a = (2 * n - count * (count - 1)) / (2 * count);\n if (a < 1)\n break;\n\n nim = 0;\n for (int j = 0; j < count; j++)\n nim ^= grandi[a + j];\n\n if (answ[n] == -1)\n {\n if (nim == 0)\n answ[n] = count;\n else\n answ[n] = -1;\n }\n numGrandi[nim] = n;\n }\n for (int i = 0; i <= N; i++)\n {\n if (numGrandi[i] != n)\n {\n grandi[n] = i;\n break;\n }\n }\n }\n \n Console.WriteLine(answ[N]);\n }\n }\n}\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f0119820c68726480038ef6b0397df13", "src_uid": "63262317ba572d78163c91b853c05506", "difficulty": 2000.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 void Main(string[] args)\n {\n Int64 n = int.Parse(Console.ReadLine());\n Int64 d = 1000000007;\n Int64 res = (2*n*n+n) % d;\n res = n % d;\n res *= 2;\n res *= n % d;\n res += n % d;\n res %= d;\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fcd72abdfc28b8070358ef5158b9ca43", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.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 void Main(string[] args)\n {\n Int64 n = Int64.Parse(Console.ReadLine());\n Int64 d = 1000000007;\n Int64 p = (Int64)Math.Pow(2, n);\n Int64 res = (p * p + p) / 2;\n res %= d; \n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1fcc471a7d2600c402e677fce6992e61", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.0} {"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;\n\nnamespace CodeForces {\n class Pair : IComparable {\n public int First, Second,Index;\n public Pair(int f, int s) {\n First = f;\n Second = s; \n }\n public Pair(string s) {\n string[] ss = s.Split(' ');\n First = int.Parse(ss[0]);\n Second = int.Parse(ss[1]);\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", First, Second);\n }\n\n public int CompareTo(Pair other) {\n return Math.Abs(other.Second).CompareTo(Math.Abs(Second));\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;\n static string s, t;\n static void Solve() {\n ulong n = ulong.Parse(input.ReadLine());\n if (n == 0)\n Console.WriteLine(1);\n else {\n ulong p1 = binpow(2, n - 1);\n ulong p2 = binpow(2, 2 * n - 1);\n ulong res = (p1 + p2) % MOD;\n Console.WriteLine(res);\n }\n }\n\n static ulong binpow(ulong a, ulong n) {\n ulong res = 1;\n while (n > 0) \n if ((n & 1)==1) {\n res = (res * a) % MOD;\n --n;\n }\n else {\n a = (a * a) % MOD;\n n >>= 1;\n }\n return res % MOD;\n } \n\n static void PrintDouble(double d) {\n Console.WriteLine(d.ToString().Replace(',','.'));\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 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": "055af622a039afed27abcbed775c9853", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace MakeCalendar\n{\n class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n//----------------------------------------------------------------------------\n \n\n static decimal findrem(decimal n, int p)\n {\n if (n == 0)\n return 1;\n if (n % 2 == 0)\n return (findrem(n / 2, p) * findrem(n / 2, p)) % p;\n n--;\n return (findrem(n / 2, p) * findrem(n / 2, p)*2) % p;\n }\n\n static void Main(string[] args)\n {\n decimal n = Convert.ToDecimal(Console.ReadLine());\n\n if (n == 0)\n { PrintLn(1); return; }\n\n int p = 1000000007;\n \n PrintLn((findrem(n-1,p)*(findrem(n,p)+1))%p);\n\n\n }\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ecc5d363517c1d1cecac539a0d5d9d8e", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace GoldPigeon\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[] line = Console.ReadLine().Split(' ');\n \n for(int i = 0; i < n; i++)\n {\n a[i] = int.Parse(line[i]);\n }\n\n Console.WriteLine(a[a.Min() + 2]);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "272aa4551bc789f06b205a5694937cca", "src_uid": "a9eb85dfaa3c50ed488d41da4f29c697", "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 GoldPigeon\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[] line = Console.ReadLine().Split(' ');\n \n for(int i = 0; i < n; i++)\n {\n a[i] = int.Parse(line[i]);\n }\n\n Console.WriteLine(a[a.Min() + 2]);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "90b2f081a5dc58b2573ada42eb3268f6", "src_uid": "a9eb85dfaa3c50ed488d41da4f29c697", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace GoldPigeon\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[] line = Console.ReadLine().Split(' ');\n int min = int.MaxValue;\n\n for(int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(line[i]);\n min = min > a[i] ? a[i] : min;\n }\n\n Console.WriteLine(a[min + 2]);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7053a0be97035ce3d8dbea64cb50cc91", "src_uid": "a9eb85dfaa3c50ed488d41da4f29c697", "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 ConsoleApp14\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num2 = 0;\n int n = int.Parse(Console.ReadLine());\n int[][] toks = new int[3][];\n\n for(int i = 0; i < n; i++)\n {\n int[] temp = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n toks[i] = temp;\n }\n\n int number = 0;\n for(int x = 0; x <= 100; x++)\n {\n number++;\n string tofind = number.ToString();\n int num1 = int.Parse(tofind[0].ToString());\n if (tofind.Length == 2)\n {\n num2 = int.Parse(tofind[1].ToString());\n }\n bool naid = false;\n for(int i = 0; i < n; i++)\n {\n if(toks[i].Contains(num1))\n {\n naid = true;\n if(tofind.Length == 1)\n {\n break;\n }\n else\n {\n naid = false;\n for(int j = 0; j < n; j++)\n {\n if (j == i)\n continue;\n if(toks[j].Contains(num2))\n {\n naid = true;\n i = n;\n break;\n }\n }\n }\n }\n }\n if (naid == false)\n break;\n\n }\n Console.WriteLine(number);\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0e62153b149d940145d4fcb4ac2d57c1", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = 0;\n int noOfCubes = -1;\n List cubes = new List();\n int[] digits = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };\n int.TryParse(Console.ReadLine(), out noOfCubes);\n for (int i = 0; i < noOfCubes; i++)\n {\n var a = Console.ReadLine().Split(' ');\n int[] cube = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };\n foreach (var d in a)\n {\n var j = 0;\n int.TryParse(d, out j);\n cube[j] = 1;\n digits[j]++;\n }\n cubes.Add(cube);\n }\n\n for (int i = 1; i <= noOfCubes; i++)\n {\n for (int j = 0; j < digits.Length; j++)\n {\n if (j == 0 && digits[j] < (i - 1))\n {\n var abc = Math.Pow(10, i - 1) - 1;\n Console.WriteLine(abc);\n return;\n }\n else if (j != 0 && digits[j] < i)\n {\n string result = \"\";\n var oCubes = cubes.FindAll(c => c[j] == 0);\n int[] abc = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };\n foreach (var c in oCubes)\n {\n for (int z = 0; z < 10; z++)\n {\n abc[z] += c[z];\n }\n }\n for (int m = 0; m < 10; m++)\n {\n if (abc[m] == 0)\n {\n for (int n = 0; n < i - 1; n++)\n {\n result += j.ToString();\n }\n if (m != 0)\n {\n result += (m - 1).ToString();\n Console.WriteLine(int.Parse(result));\n return;\n }\n else if (m == 0 && i > 1)\n {\n result += \"0\";\n Console.WriteLine(int.Parse(result) - 1);\n return;\n }\n }\n }\n }\n }\n }\n Console.WriteLine(x);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f893e968cbcbe3712f90152c04858945", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.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 public static string Reverse(this string str)\n {\n if (str == null) return null;\n\n return new string(str.ToArray().Reverse().ToArray());\n }\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target < a[mid])\n return FindRightMostLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindRightMostLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int target)\n {\n return FindRightMostLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static string GetSha1(string filePath)\n {\n using (FileStream fs = new FileStream(filePath, FileMode.Open))\n using (BufferedStream bs = new BufferedStream(fs))\n {\n using (SHA1Managed sha1 = new SHA1Managed())\n {\n byte[] hash = sha1.ComputeHash(bs);\n StringBuilder formatted = new StringBuilder(2 * hash.Length);\n foreach (byte b in hash)\n {\n formatted.AppendFormat(\"{0:X2}\", b);\n }\n\n return formatted.ToString();\n }\n }\n }\n\n\n static bool canFit(int a1, int b1, int a2, int b2)\n {\n int[] r1 = { a1, b1 };\n int[] r2 = { a2, b2 };\n\n Array.Sort(r1);\n Array.Sort(r2);\n\n bool ans = (r1[0] <= r2[0]) && (r1[1] <= r2[1]);\n\n return ans;\n\n }\n\n class Pair\n {\n public int first { get; set; }\n public int second { get; set; }\n }\n\n\n static bool IsPossible(string n, string[] cubes)\n {\n\n if (n.Length > cubes.Length)\n return false;\n\n if (n == \"\")\n return true;\n\n\n for (int i = 0; i < cubes.Length; i++)\n {\n if (cubes[i].Contains(n[0]))\n {\n var temp = cubes[0];\n cubes[0] = cubes[i];\n cubes[i] = temp;\n\n if (IsPossible(n.Substring(1), cubes.Skip(1).ToArray()))\n return true;\n\n }\n }\n\n\n return false;\n }\n\n static void Main(string[] args)\n {\n\n int n = ReadIntLine();\n\n string[] cubes = new string[n];\n\n for (int i = 0; i < n; i++)\n {\n cubes[i] = string.Join(\"\", ReadIntArrayLine());\n }\n\n int k = 0;\n\n while (IsPossible((k + 1).ToString(), cubes))\n k++;\n\n PrintLn(k);\n\n }\n\n\n\n }\n\n\n\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "429aaf048acfcdddd049ac67ea5f0900", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace _887B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = 0;\n n = int.Parse(Console.ReadLine());\n int[,] array = new int[n, 6];\n for (int i = 0; i < n; i++)\n {\n //Console.Clear();\n string inputDice = Console.ReadLine();\n string[] splitInputDice = inputDice.Split(' ');\n \n for (int j = 0; j < 6; j++)\n {\n array[i, j] = int.Parse(splitInputDice[j]);\n }\n }\n\n int[] checker = new int[1000];\n Array.Clear(checker, 0, checker.Length);\n\n for (int i = 0; i < n; i++)\n {\n for(int j = 0; j < 6; j++)\n {\n checker[array[i, j]] = 1;\n\n for(int k = 0; k < n; k++ )\n {\n if (k == i) continue;\n for(int l = 0; l < 6; l++)\n {\n int index = array[i, j] * 10 + array[k, l];\n checker[index] = 1;\n for(int m = 0; m < n; m++)\n {\n if (m == i || m == k) continue;\n for(int o = 0; o < 6; o++)\n {\n int index2 = array[i, j] * 100 + array[k, l] * 10 + array[m, o];\n checker[index2] = 1;\n }\n }\n }\n }\n }\n }\n\n int res = 0;\n for(int i = 1; i < 1000; i++)\n {\n if(checker[i] == 0)\n {\n res = i - 1;\n break;\n }\n }\n\n Console.Write(res);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ac6c1b06d146f25c87208de99992a322", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.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 public static string Reverse(this string str)\n {\n if (str == null) return null;\n\n return new string(str.ToArray().Reverse().ToArray());\n }\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target < a[mid])\n return FindRightMostLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindRightMostLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int target)\n {\n return FindRightMostLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static string GetSha1(string filePath)\n {\n using (FileStream fs = new FileStream(filePath, FileMode.Open))\n using (BufferedStream bs = new BufferedStream(fs))\n {\n using (SHA1Managed sha1 = new SHA1Managed())\n {\n byte[] hash = sha1.ComputeHash(bs);\n StringBuilder formatted = new StringBuilder(2 * hash.Length);\n foreach (byte b in hash)\n {\n formatted.AppendFormat(\"{0:X2}\", b);\n }\n\n return formatted.ToString();\n }\n }\n }\n\n\n static bool canFit(int a1, int b1, int a2, int b2)\n {\n int[] r1 = { a1, b1 };\n int[] r2 = { a2, b2 };\n\n Array.Sort(r1);\n Array.Sort(r2);\n\n bool ans = (r1[0] <= r2[0]) && (r1[1] <= r2[1]);\n\n return ans;\n\n }\n\n class Pair\n {\n public int first { get; set; }\n public int second { get; set; }\n }\n\n\n static bool IsPossible(string n, string[] cubes)\n {\n\n if (n.Length > cubes.Length)\n return false;\n\n if (n == \"\")\n return true;\n\n\n for (int i = 0; i < cubes.Length; i++)\n {\n if (cubes[i].Contains(n[0]))\n {\n var temp = cubes[0];\n cubes[0] = cubes[i];\n cubes[i] = temp;\n\n if (IsPossible(n.Substring(1), cubes.Skip(1).ToArray()))\n return true;\n else\n {\n cubes[i] = cubes[0];\n cubes[0] = temp;\n }\n }\n }\n\n\n return false;\n }\n\n static void Main(string[] args)\n {\n\n int n = ReadIntLine();\n\n string[] cubes = new string[n];\n\n for (int i = 0; i < n; i++)\n {\n cubes[i] = string.Join(\"\", ReadIntArrayLine());\n }\n\n int k = 0;\n\n while (IsPossible((k + 1).ToString(), cubes))\n k++;\n\n PrintLn(k);\n\n }\n\n\n\n }\n\n\n\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5c4f08971154fa1bd199f8394b7264cf", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "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 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 const int m = 6;\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n private int n;\n private int[,] cubs;\n HashSet set = new HashSet();\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 cubs = new int[n, m];\n for (var i = 0; i < n; i++) {\n var input = sr.ReadArrayOfInt32();\n for (var j = 0; j < m; j++) {\n cubs[i, j] = input[j];\n }\n }\n if (n == 1) {\n for (var i = 0; i < m; i++) {\n set.Add(GetNumber(cubs[0, i]));\n }\n }\n if (n == 2) {\n for (var i = 0; i < m; i++) {\n for (var j = 0; j < m; j++) {\n set.Add(GetNumber(cubs[0, i]));\n set.Add(GetNumber(cubs[0, i], cubs[1, j]));\n set.Add(GetNumber( cubs[1, j], cubs[0, i]));\n set.Add(GetNumber(cubs[1, j]));\n }\n }\n }\n if (n == 3) {\n for (var i = 0; i < m; i++) {\n for (var j = 0; j < m; j++) {\n for (var k = 0; k < m; k++) {\n set.Add(GetNumber(cubs[0, i]));\n set.Add(GetNumber(cubs[1, j]));\n set.Add(GetNumber(cubs[2, k]));\n set.Add(GetNumber(cubs[0, i], cubs[1, j], cubs[2, k]));\n set.Add(GetNumber(cubs[0, i], cubs[2, k], cubs[1, j]));\n \n set.Add(GetNumber(cubs[1, j], cubs[0, i], cubs[2, k]));\n set.Add(GetNumber(cubs[1, j], cubs[2, k], cubs[0, i]));\n \n set.Add(GetNumber(cubs[2, k], cubs[0, i], cubs[1, j]));\n set.Add(GetNumber(cubs[2, k], cubs[1, j], cubs[0, i]));\n \n \n set.Add(GetNumber(cubs[0, i], cubs[1, j]));\n set.Add(GetNumber(cubs[1, j], cubs[0, i]));\n \n set.Add(GetNumber(cubs[1, j], cubs[2, k]));\n set.Add(GetNumber(cubs[2, k], cubs[1, j]));\n \n set.Add(GetNumber(cubs[0, i], cubs[2, k]));\n set.Add(GetNumber(cubs[2, k], cubs[0, i]));\n }\n }\n }\n }\n foreach (var num in Enumerable.Range(1, 9 * 9 * 3)) {\n if (!set.Contains(num)) {\n sw.WriteLine(num - 1);\n return;\n }\n }\n }\n\n private int GetNumber(params int[] array)\n {\n var str = \"\";\n for (var i = 0; i < array.Length; i++) {\n str += array[i];\n }\n if (str[0] == '0' && array.Length > 1) {\n return 0;\n }\n\n return Int32.Parse(str);\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": "f37b7ea147fa1aefd1b492c57253d79b", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "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 int n;\n bool[,] a;\n bool Fun(string s, int p, bool[] used)\n {\n if (p == s.Length)\n return true;\n for (int i = 0; i < n; i++)\n if (!used[i] && a[i, s[p] - '0'])\n {\n used[i] = true;\n if (Fun(s, p + 1, used))\n return true;\n used[i] = false;\n }\n return false;\n }\n\n public void Solve()\n {\n n = ReadInt();\n\n a = new bool[n, 10];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < 6; j++)\n a[i, ReadInt()] = true;\n\n for (int i = 1;; i++)\n if (!Fun(i.ToString(), 0, new bool[n]))\n {\n Write(i - 1);\n return;\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]; } 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": "5f181b333cedec045980fb54e2837f43", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = 0;\n int noOfCubes = int.Parse(Console.ReadLine());\n List cubes = new List();\n int[] digits = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };\n for (int i = 0; i < noOfCubes; i++)\n {\n var a = Console.ReadLine().Split(' ');\n int[] cube = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };\n foreach (var d in a)\n {\n var j = 0;\n int.TryParse(d, out j);\n cube[j] = 1;\n }\n for (int j = 0; i < 10; j++)\n {\n digits[j] += cube[j];\n }\n cubes.Add(cube);\n }\n\n for (int i = 1; i <= noOfCubes; i++)\n {\n for (int j = 0; j < digits.Length; j++)\n {\n if (j == 0 && digits[j] < (i - 1))\n {\n var abc = Math.Pow(10, i - 1) - 1;\n Console.WriteLine(abc);\n return;\n }\n else if (j != 0 && digits[j] < i)\n {\n string result = \"\";\n var oCubes = cubes.FindAll(c => c[j] == 0);\n int[] abc = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };\n foreach (var c in oCubes)\n {\n for (int z = 0; z < 10; z++)\n {\n abc[z] += c[z];\n }\n }\n for (int m = 0; m < 10; m++)\n {\n if (abc[m] == 0)\n {\n for (int n = 0; n < i - 1; n++)\n {\n result += j.ToString();\n }\n if (m != 0)\n {\n result += (m - 1).ToString();\n Console.WriteLine(int.Parse(result));\n return;\n }\n else if (m == 0 && i > 1)\n {\n result += \"0\";\n Console.WriteLine(int.Parse(result) - 1);\n return;\n }\n }\n }\n }\n }\n }\n Console.WriteLine(x);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d51c16860e7a86e15c6a9deb8284486e", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"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 + 1).Where(x => x <= b)\n .Count(x => perm.Count(\n pp => pp.Aggregate(x, (acc,tmp) => acc %p[tmp]) == x) >= 7);\n Console.Write(n);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6df73f12f14d4acbdb9ba82aac874dae", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.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\tstring[] input = Console.ReadLine().Split();\n\t\tint[] p = new int[4];\n\t\tfor(int i = 0; i < 4; i++){\n\t\t\tp[i] = int.Parse(input[i]);\n\t\t}\n\t\tint a = int.Parse(input[4]);\n\t\tint b = int.Parse(input[5]);\n\t\tint c = 0;\n\t\tint ans = 0;\n\t\twhile(a <= b){\n\t\t\tfor(int i = 0; i < 4; i++){\n\t\t\t\tfor(int j = 0; j < 4; j++){\n\t\t\t\t\tfor(int k = 0; k < 4; k++){\n\t\t\t\t\t\tfor(int l = 0; l < 4; l++){\n\t\t\t\t\t\t\tif(i != j && i != k && i != l && j != k && j != l && k != l){\n\t\t\t\t\t\t\t\tint rem = (((a % p[i]) % p[j]) % p[k]) % p[l];\n\t\t\t\t\t\t\t\tif(rem == a){\n\t\t\t\t\t\t\t\t\tc++;\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\tif(c > 7) ans++;\n\t\t\tc = 0;\n\t\t\ta++;\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4a7b54e0f16640fee2667cc73193b142", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.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 string[] s = Console.ReadLine().Split(' ');\n int p1 = int.Parse(s[0]);\n int p2 = int.Parse(s[1]);\n int p3 = int.Parse(s[2]);\n int p4 = int.Parse(s[3]);\n int a = int.Parse(s[4]);\n int b = int.Parse(s[5]);\n int count = 0;\n int count1 = 0;\n int x;\n\n for (int i = a; i <= b; ++i)\n {\n count1 = 0;\n x = f(i, p1, p2, p3, p4);\n if (x == i)\n count1++;\n //2\n x = f(i, p1, p2, p4, p3);\n if (x == i)\n count1++;\n //3\n x = f(i, p1, p3, p2, p4);\n if (x == i)\n count1++;\n //4\n x = f(i, p1, p3, p4, p2);\n if (x == i)\n count1++;\n //5\n x = f(i, p1, p4, p2, p3);\n if (x == i)\n count1++;\n //6\n x = f(i, p1, p4, p3, p2);\n if (x == i)\n count1++;\n //7\n x = f(i, p2, p1, p3, p4);\n if (x == i)\n count1++;\n //8\n x = f(i, p2, p1, p4, p3);\n if (x == i)\n count1++;\n //9\n x = f(i, p2, p3, p1, p4);\n if (x == i)\n count1++;\n //10\n x = f(i, p2, p3, p4, p1);\n if (x == i)\n count1++;\n //11\n x = f(i, p2, p4, p1, p3);\n if (x == i)\n count1++;\n //12\n x = f(i, p2, p4, p3, p1);\n if (x == i)\n count1++;\n //13\n x = f(i, p3, p1, p2, p4);\n if (x == i)\n count1++;\n //14\n x = f(i, p3, p1, p4, p2);\n if (x == i)\n count1++;\n //15\n x = f(i, p3, p2, p1, p4);\n if (x == i)\n count1++;\n //16\n x = f(i, p3, p2, p4, p1);\n if (x == i)\n count1++;\n //17\n x = f(i, p3, p4, p1, p2);\n if (x == i)\n count1++;\n //18\n x = f(i, p3, p4, p2, p1);\n if (x == i)\n count1++;\n //19\n x = f(i, p4, p1, p2, p3);\n if (x == i)\n count1++;\n //20\n x = f(i, p4, p1, p3, p2);\n if (x == i)\n count1++;\n //21\n x = f(i, p4, p2, p1, p3);\n if (x == i)\n count1++;\n //22\n x = f(i, p4, p2, p3, p1);\n if (x == i)\n count1++;\n //23\n x = f(i, p4, p3, p1, p2);\n if (x == i)\n count1++;\n //24\n x = f(i, p4, p3, p2, p1);\n if (x == i)\n count1++;\n if (count1 >= 7)\n count++;\n }\n\n Console.WriteLine(count);\n Console.ReadLine();\n }\n\n static int f(int x,int p1, int p2, int p3, int p4)\n {\n return ((((x % p1) % p2) % p3) % p4);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dceaca7df9b66039719d835a7c928531", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static short _p1;\n private static short _p2;\n private static short _p3;\n private static short _p4;\n static bool Wl(Int16 x)\n {\n var f= (((x%_p1)%_p2)%_p3)%_p4;\n return f == x;\n }\n static void Main()\n {\n var s = Console.ReadLine().Split(' ');\n _p1 = Convert.ToInt16(s[0]);\n _p2 = Convert.ToInt16(s[1]);\n _p3 = Convert.ToInt16(s[2]);\n _p4 = Convert.ToInt16(s[3]);\n short sum = 0;\n for (var i = Convert.ToInt16(s[4]); i <= Convert.ToInt16(s[5]); i++)\n {\n if(Wl(i))\n {\n sum += 1;\n }\n }\n Console.WriteLine(sum);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "74c880ed920d0a9b4a3bb68dde70fa0f", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0} {"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((acc,tmp) => acc %tmp, x) == x);\n Console.Write(n);\n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "31ddf8ee117bc66f20a230878fe8a1f3", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeff// ReSharper disable RedundantUsingDirective\n// ReSharper disable JoinDeclarationAndInitializer\n// ReSharper disable MemberCanBeMadeStatic.Local\n// ReSharper disable PossibleNullReferenceException\n// ReSharper disable ArrangeTypeMemberModifiers\n// ReSharper disable SuggestVarOrType_BuiltInTypes\n// ReSharper disable SuggestVarOrType_Elsewhere\n// ReSharper disable InvertIf\n// ReSharper disable InconsistentNaming\n// ReSharper disable ConvertIfStatementToSwitchStatement\n// ReSharper disable UseObjectOrCollectionInitializer\n// ReSharper disable TailRecursiveCall\n// ReSharper disable RedundantUsingDirective\n// ReSharper disable InlineOutVariableDeclaration\n// ReSharper disable FunctionRecursiveOnAllPaths\n// ReSharper disable UnusedMember.Global\n// ReSharper disable MemberCanBeMadeStatic.Global\n// ReSharper disable UnusedMember.Local\n// ReSharper disable NonReadonlyMemberInGetHashCode\n#pragma warning disable\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Xml;\nusing static System.Math;\nusing static AtCoder.Input;\nusing static AtCoder.Methods;\n\nnamespace AtCoder\n{\n #region Templete\n\n [System.Diagnostics.DebuggerDisplay(\"({first}, {second})\")]\n public class Pair : IComparable>, IEquatable>\n where T1 : IComparable\n where T2 : IComparable\n {\n public Pair(T1 first, T2 second)\n {\n this.first = first;\n this.second = second;\n }\n\n public T1 first;\n public T2 second;\n\n public int CompareTo(Pair other)\n {\n if (ReferenceEquals(this, other)) return 0;\n if (ReferenceEquals(null, other)) return 1;\n var firstComparison = first.CompareTo(other.first);\n return firstComparison != 0 ? firstComparison : second.CompareTo(other.second);\n }\n\n public override string ToString() => $\"({first}, {second})\";\n\n public bool Equals(Pair other)\n {\n if (ReferenceEquals(null, other)) return false;\n if (ReferenceEquals(this, other)) return true;\n return EqualityComparer.Default.Equals(first, other.first) && EqualityComparer.Default.Equals(second, other.second);\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj)) return false;\n if (ReferenceEquals(this, obj)) return true;\n return obj.GetType() == this.GetType() && Equals((Pair)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (EqualityComparer.Default.GetHashCode(first) * 397) ^ EqualityComparer.Default.GetHashCode(second);\n }\n }\n }\n\n [System.Diagnostics.DebuggerDisplay(\"Value = {\" + nameof(_value) + \"}\")]\n public struct ModInt : IEquatable, IComparable\n {\n private long _value;\n\n public const int MOD = (int)1e9 + 7;\n\n public static readonly ModInt Zero = new ModInt(0);\n\n public static readonly ModInt One = new ModInt(1);\n\n public ModInt(long value) { _value = value % MOD; }\n\n private ModInt(int value) { _value = value; }\n\n public int Value => (int)_value;\n\n public ModInt Invert => ModPow(this, MOD - 2);\n\n public static ModInt operator -(ModInt value)\n {\n value._value = MOD - value._value;\n return value;\n }\n\n public static ModInt operator +(ModInt left, ModInt right)\n {\n left._value += right._value;\n if (left._value >= MOD) left._value -= MOD;\n return left;\n }\n\n public static ModInt operator -(ModInt left, ModInt right)\n {\n left._value -= right._value;\n if (left._value < 0) left._value += MOD;\n return left;\n }\n\n public static ModInt operator *(ModInt left, ModInt right)\n {\n left._value = left._value * right._value % MOD;\n return left;\n }\n\n public static ModInt operator /(ModInt left, ModInt right) => left * right.Invert;\n\n public static ModInt operator ++(ModInt value)\n {\n if (value._value == MOD - 1) value._value = 0;\n else value._value++;\n return value;\n }\n\n public static ModInt operator --(ModInt value)\n {\n if (value._value == 0) value._value = MOD - 1;\n else value._value--;\n return value;\n }\n\n public static bool operator ==(ModInt left, ModInt right) => left.Equals(right);\n\n public static bool operator !=(ModInt left, ModInt right) => !left.Equals(right);\n\n public static implicit operator ModInt(int value) => new ModInt(value);\n\n public static implicit operator ModInt(long value) => new ModInt(value);\n\n public static ModInt ModPow(ModInt value, long exponent)\n {\n var r = new ModInt(1);\n for (; exponent > 0; value *= value, exponent >>= 1)\n if ((exponent & 1) == 1) r *= value;\n return r;\n }\n\n public static ModInt ModFact(int value)\n {\n var r = new ModInt(1);\n for (var i = 2; i <= value; i++) r *= value;\n return r;\n }\n\n public bool Equals(ModInt other) => _value == other._value;\n\n public override bool Equals(object obj)\n {\n return obj != null && this.Equals((ModInt)obj);\n }\n\n public override int GetHashCode() => _value.GetHashCode();\n\n public override string ToString() => _value.ToString();\n\n public int CompareTo(ModInt other)\n {\n return _value.CompareTo(other._value);\n }\n }\n\n public static class Methods\n {\n public static readonly int[] dx = { -1, 0, 0, 1 };\n\n public static readonly int[] dy = { 0, 1, -1, 0 };\n\n /*\n public static Comparison greater() \n where T : IComparable \n => (a, b) => b.CompareTo(a);\n */\n public static void Print(T t) => Console.WriteLine(t);\n\n public static void PrintBool(bool val, string yes = \"Yes\", string no = \"No\")\n => Console.WriteLine(val ? yes : no);\n\n public static void PrintYn(bool val) => PrintBool(val);\n public static void PrintYN(bool val) => PrintBool(val, \"YES\", \"NO\");\n public static void PrintPossible(bool val) => PrintBool(val, \"Possible\", \"Impossible\");\n public static void PrintYay(bool val) => PrintBool(val, \"Yay!\", \":(\");\n\n public static void PrintDebug(params object[] args)\n => Console.Error.WriteLine(string.Join(\" \", args));\n\n public static string JoinWith(this IEnumerable source, string s) => string.Join(s, source.ToArray());\n\n /// \n /// \u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\n /// \n /// first\u306e\u578b\n /// second\u306e\u578b\n /// first\u306e\u5024\n /// second\u306e\u5024\n /// \u4f5c\u6210\u3057\u305f \u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\n public static Pair make_pair(T1 first, T2 second)\n where T1 : IComparable\n where T2 : IComparable\n => new Pair(first, second);\n\n /// a\u3068b\u3092\u30b9\u30ef\u30c3\u30d7\u3057\u307e\u3059\u3002\u306b\n public static void Swap(ref T a, ref T b) where T : struct\n {\n var tmp = b;\n b = a;\n a = tmp;\n }\n\n /// a\u3068b\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\u3002\n /// a\u3068b\u306e\u6700\u5927\u516c\u7d04\u6570\n public static long Gcd(long a, long b)\n {\n if (a < b) Swap(ref a, ref b);\n return a % b == 0 ? b : Gcd(b, a % b);\n }\n\n /// a\u3068b\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\u3002\n /// a\u3068b\u306e\u6700\u5c0f\u516c\u500d\u6570\n public static long Lcm(long a, long b) => a / Gcd(a, b) * b;\n\n /// \n /// ^ (mod ) \u3092\u6c42\u3081\u308b\n /// \n /// ^ (mod ) \u306e\u5024\n public static long PowMod(long a, long b, long p)\n {\n long res = 1;\n while (b > 0)\n {\n if (b % 2 != 0) res = res * a % p;\n a = a * a % p;\n b >>= 1;\n }\n\n return res;\n }\n\n /// \n /// mod p\u306b\u304a\u3051\u308ba\u306e\u9006\u5143\u3092\u6c42\u3081\u307e\u3059\u3002\n /// \n /// \n /// \u6cd5\n /// \n public static long ModInv(long a, long p)\n => PowMod(a, p - 2, p);\n\n public static int DivCeil(int left, int right)\n => left / right + (left % right == 0 ? 0 : 1);\n\n public static long DivCeil(long left, long right)\n => left / right + (left % right == 0L ? 0L : 1L);\n\n /// \n /// src \u306e\u9806\u5217\u3092\u6c42\u3081\u307e\u3059\u3002\n /// \n /// \u578b\n /// \u9806\u5217\u3092\u6c42\u3081\u308b\u914d\u5217\n /// src \u306e\u9806\u5217\n public static IEnumerable Permutations(IEnumerable src)\n {\n var ret = new List();\n Search(ret, new Stack(), src.ToArray());\n return ret;\n }\n\n private static void Search(ICollection perms, Stack stack, T[] a)\n {\n int N = a.Length;\n if (N == 0) perms.Add(stack.Reverse().ToArray());\n else\n {\n var b = new T[N - 1];\n Array.Copy(a, 1, b, 0, N - 1);\n for (int i = 0; i < a.Length; ++i)\n {\n stack.Push(a[i]);\n Search(perms, stack, b);\n if (i < b.Length) b[i] = a[i];\n stack.Pop();\n }\n }\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u6761\u4ef6\u3092\u6e80\u305f\u3059\u6700\u5c0f\u306e\u6570\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u691c\u7d22\u3059\u308b\u6570\u5024\u306e\u6700\u5c0f\u5024\n /// \u691c\u7d22\u3059\u308b\u6570\u5024\u306e\u6700\u5927\u5024\n /// \u6761\u4ef6\n /// \u6761\u4ef6\u3092\u6e80\u305f\u3059\u6700\u5c0f\u306e\u6570\u5024\n public static int BinarySearch(int low, int high, Func expression)\n {\n while (low < high)\n {\n int middle = (high - low) / 2 + low;\n if (expression(middle))\n high = middle;\n else\n low = middle + 1;\n }\n\n return high;\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u5024\u4ee5\u4e0a\u306e\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u6bd4\u8f03\u3059\u308b\u5024\u306e\u578b\n /// \u5bfe\u8c61\u306e\u914d\u5217\uff08\u203b\u30bd\u30fc\u30c8\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\uff09\n /// \u958b\u59cb\u30a4\u30f3\u30c7\u30af\u30b9 [inclusive]\n /// \u7d42\u4e86\u30a4\u30f3\u30c7\u30af\u30b9 [exclusive]\n /// \u691c\u7d22\u3059\u308b\u5024\n /// \u6bd4\u8f03\u95a2\u6570(\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9)\n /// \u6307\u5b9a\u3057\u305f\u5024\u4ee5\u4e0a\u306e\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\n public static int LowerBound(T[] arr, int start, int end, T value, IComparer comparer)\n {\n int low = start;\n int high = end;\n while (low < high)\n {\n var mid = ((high - low) >> 1) + low;\n if (comparer.Compare(arr[mid], value) < 0)\n low = mid + 1;\n else\n high = mid;\n }\n\n return low;\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u5024\u4ee5\u4e0a\u306e\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u6bd4\u8f03\u3059\u308b\u5024\u306e\u578b\n /// \u5bfe\u8c61\u306e\u914d\u5217\uff08\u203b\u30bd\u30fc\u30c8\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\uff09\n /// \u691c\u7d22\u3059\u308b\u5024\n /// \u6307\u5b9a\u3057\u305f\u5024\u4ee5\u4e0a\u306e\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\n public static int LowerBound(T[] arr, T value) where T : IComparable\n {\n return LowerBound(arr, 0, arr.Length, value, Comparer.Default);\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u5024\u3088\u308a\u5927\u304d\u3044\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u6bd4\u8f03\u3059\u308b\u5024\u306e\u578b\n /// \u5bfe\u8c61\u306e\u914d\u5217\uff08\u203b\u30bd\u30fc\u30c8\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\uff09\n /// \u958b\u59cb\u30a4\u30f3\u30c7\u30af\u30b9 [inclusive]\n /// \u7d42\u4e86\u30a4\u30f3\u30c7\u30af\u30b9 [exclusive]\n /// \u691c\u7d22\u3059\u308b\u5024\n /// \u6bd4\u8f03\u95a2\u6570(\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9)\n /// \u6307\u5b9a\u3057\u305f\u5024\u3088\u308a\u5927\u304d\u3044\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\n public static int UpperBound(T[] arr, int start, int end, T value, IComparer comparer)\n {\n int low = start;\n int high = end;\n while (low < high)\n {\n var mid = ((high - low) >> 1) + low;\n if (comparer.Compare(arr[mid], value) <= 0)\n low = mid + 1;\n else\n high = mid;\n }\n\n return low;\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u5024\u3088\u308a\u5927\u304d\u3044\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// Z\n /// \u6bd4\u8f03\u3059\u308b\u5024\u306e\u578b\n /// \u5bfe\u8c61\u306e\u914d\u5217\uff08\u203b\u30bd\u30fc\u30c8\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\uff09\n /// \u691c\u7d22\u3059\u308b\u5024\n /// \u6307\u5b9a\u3057\u305f\u5024\u3088\u308a\u5927\u304d\u3044\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\n public static int UpperBound(T[] arr, T value)\n {\n return UpperBound(arr, 0, arr.Length, value, Comparer.Default);\n }\n\n public static IEnumerable SelectNotNull(this IEnumerable source, Func func)\n => source.Where(val => val != null).Select(func);\n\n public static IEnumerable WhereNotNull(this IEnumerable source)\n => source.Where(val => val != null);\n /// \n /// \u6587\u5b57\u306e\u914d\u5217\u3092\u6587\u5b57\u5217\u306b\u5909\u63db\u3057\u307e\u3059\u3002\n /// \n /// \u6587\u5b57\u306e\u914d\u5217\n /// \u5909\u63db\u3057\u305f\u6587\u5b57\u5217\n public static string AsString(this IEnumerable source) => new string(source.ToArray());\n\n /// \n /// \u306e\u7d2f\u7a4d\u548c\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u306e\u7d2f\u7a4d\u548c\n public static IEnumerable CumSum(this IEnumerable source)\n {\n long sum = 0;\n foreach (var item in source)\n yield return sum += item;\n }\n\n /// \n /// \u306e\u7d2f\u7a4d\u548c\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u306e\u7d2f\u7a4d\u548c\n public static IEnumerable CumSum(this IEnumerable source)\n {\n int sum = 0;\n foreach (var item in source)\n yield return sum += item;\n }\n /// \n /// \u304c l\u4ee5\u4e0a r\u672a\u6e80\u306e\u7bc4\u56f2\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u8981\u7d20\u306e\u578b\n /// \u5224\u5b9a\u3059\u308b\u5024\n /// \u4e0b\u9650\u306e\u5024 (\u542b\u307e\u308c\u308b)\n /// \u4e0b\u9650\u306e\u5024 (\u542b\u307e\u308c\u306a\u3044)\n /// \u304c\u6307\u5b9a\u3057\u305f\u7bc4\u56f2\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u304b\n public static bool IsIn(this T value, T l, T r)\n where T : IComparable\n {\n if (l.CompareTo(r) > 0) throw new ArgumentException();\n return l.CompareTo(value) <= 0 && value.CompareTo(r) < 0;\n }\n\n /// \n /// \u4ee5\u4e0a \u672a\u6e80\u306e\u5024\u3092 \u305a\u3064\u5897\u3084\u3057\u305f\u7d50\u679c\u3092\u5217\u6319\u3057\u307e\u3059\u3002\n /// \n /// \u5024\u306e\u4e0b\u9650 (\u542b\u307e\u308c\u308b)\n /// \u5024\u306e\u4e0a\u9650 (\u542b\u307e\u308c\u306a\u3044)\n /// 1\u8981\u7d20\u3054\u3068\u306b\u5897\u3084\u3059\u5024\n /// \u7bc4\u56f2\u306e\u7d50\u679c\n public static IEnumerable Range(int start, int end, int step = 1)\n {\n for (var i = start; i < end; i += step) yield return i;\n }\n\n /// \n /// 0 \u4ee5\u4e0a \u672a\u6e80\u306e\u5024\u3092 1 \u305a\u3064\u5897\u3084\u3057\u305f\u7d50\u679c\u3092\u5217\u6319\u3057\u307e\u3059\u3002\n /// \n /// \u5024\u306e\u4e0a\u9650 (\u542b\u307e\u308c\u306a\u3044)\n /// \u7bc4\u56f2\u306e\u7d50\u679c\n public static IEnumerable Range(int end) => Range(0, end);\n\n /// \n /// \u4ee5\u4e0a \u672a\u6e80\u306e\u5024\u3092 \u305a\u3064\u5897\u3084\u3057\u305f\u7d50\u679c\u3092\u9006\u9806\u306b\u5217\u6319\u3057\u307e\u3059\u3002\n /// \n /// \u5024\u306e\u4e0b\u9650 (\u542b\u307e\u308c\u308b)\n /// \u5024\u306e\u4e0a\u9650 (\u542b\u307e\u308c\u306a\u3044)\n /// 1\u8981\u7d20\u3054\u3068\u306b\u5897\u3084\u3059\u5024\n /// \u7bc4\u56f2\u306e\u7d50\u679c\n public static IEnumerable RangeReverse(int start, int end, int step = 1)\n {\n for (var i = end - 1; i >= start; i -= step) yield return i;\n }\n\n /// \n /// 0 \u4ee5\u4e0a \u672a\u6e80\u306e\u5024\u3092 1 \u305a\u3064\u5897\u3084\u3057\u305f\u7d50\u679c\u3092\u9006\u9806\u306b\u5217\u6319\u3057\u307e\u3059\u3002\n /// \n /// \u5024\u306e\u4e0a\u9650 (\u542b\u307e\u308c\u306a\u3044)\n /// \u7bc4\u56f2\u306e\u7d50\u679c\n public static IEnumerable RangeReverse(int end) => RangeReverse(0, end);\n\n /// \n /// value\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3001\u7d20\u56e0\u6570\u3092\u5217\u6319\u3057\u307e\u3059\u3002\n /// \n /// \u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\u5024\n /// \u7d20\u56e0\u6570\u306e\u96c6\u5408\n public static IEnumerable Factorize(int value)\n {\n for (int i = 2; i * i < value; i++)\n {\n while (value % i == 0)\n {\n value /= i;\n yield return i;\n }\n }\n\n if (value > 1)\n yield return value;\n }\n /// \n /// value\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3001\u7d20\u56e0\u6570\u3092\u5217\u6319\u3057\u307e\u3059\u3002\n /// \n /// \u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\u5024\n /// \u7d20\u56e0\u6570\u306e\u96c6\u5408\n public static IEnumerable Factorize(long value)\n {\n for (int i = 2; i * i < value; i++)\n {\n while (value % i == 0)\n {\n value /= i;\n yield return i;\n }\n }\n\n if (value > 1)\n yield return value;\n }\n /// \n /// value\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3001\u7d20\u56e0\u6570\u3068\u305d\u306e\u500b\u6570\u306e\u9023\u60f3\u914d\u5217\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\u5024\n /// \u7d20\u56e0\u6570\u306e\u9023\u60f3\u914d\u5217\n public static Dictionary FactorizeAsMap(long value)\n {\n var dict = new Dictionary();\n\n for (int i = 2; i * i < value; i++)\n {\n if (value % i > 0) continue;\n int cnt = 0;\n while (value % i == 0)\n {\n value /= i;\n cnt++;\n }\n dict.Add(i, cnt);\n }\n\n if (value > 1) dict.Add(value, 1);\n return dict;\n }\n\n /// \n /// value\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3057\u3001\u7d20\u56e0\u6570\u3068\u305d\u306e\u500b\u6570\u306e\u9023\u60f3\u914d\u5217\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\u5024\n /// \u7d20\u56e0\u6570\u306e\u9023\u60f3\u914d\u5217\n public static Dictionary FactorizeAsMap(int value)\n {\n var dict = new Dictionary();\n\n for (int i = 2; i * i < value; i++)\n {\n if (value % i > 0) continue;\n int cnt = 0;\n while (value % i == 0)\n {\n value /= i;\n cnt++;\n }\n dict.Add(i, cnt);\n }\n\n if (value > 1) dict.Add(value, 1);\n return dict;\n }\n /// \n /// value\u306e\u7d04\u6570\u306e\u500b\u6570\u3092\u6c42\u3081\u307e\u3059\u3002\n /// \n /// \u7d04\u6570\u306e\u500b\u6570\u3092\u6c42\u3081\u308b\u6570\n /// value\u306e\u7d04\u6570\u306e\u500b\u6570\n public static long Divisors(long value)\n {\n var fact = FactorizeAsMap(value);\n return fact.Select(x => x.Value + 1L).Aggregate((m, x) => m * x);\n }\n\n public static bool IsEven(this int x) => x % 2 == 0;\n public static bool IsOdd(this int x) => x % 2 != 0;\n public static bool IsEven(this long x) => x % 2 == 0;\n public static bool IsOdd(this long x) => x % 2 != 0;\n public static double Log2(double x) => Log(x, 2);\n\n public static bool chmin(ref int a, int b)\n {\n if (a > b)\n {\n a = b;\n return true;\n }\n\n return false;\n }\n\n public static bool chmax(ref int a, int b)\n {\n if (a < b)\n {\n a = b;\n return true;\n }\n\n return false;\n }\n\n public static bool chmin(ref long a, long b)\n {\n if (a > b)\n {\n a = b;\n return true;\n }\n\n return false;\n }\n\n public static bool chmax(ref long a, long b)\n {\n if (a < b)\n {\n a = b;\n return true;\n }\n\n return false;\n }\n\n public static T Min(params T[] col) => col.Min();\n public static T Max(params T[] col) => col.Max();\n\n }\n\n public static class Input\n {\n private const char _separator = ' ';\n private static readonly Queue _input = new Queue();\n private static readonly StreamReader sr =\n#if FILE\n new StreamReader(\"in.txt\");\n#else\n new StreamReader(Console.OpenStandardInput());\n#endif\n\n public static string Rs => ReadStr;\n public static int Ri => ReadInt;\n public static long Rl => ReadLong;\n public static string[] Rsa => StrArray();\n public static int[] Ria => IntArray();\n public static long[] Rla => LongArray();\n public static string ReadLine => sr.ReadLine();\n public static string ReadStr => Read;\n\n public static string Read\n {\n get {\n if (_input.Count != 0) return _input.Dequeue();\n\n // ReSharper disable once PossibleNullReferenceException\n var tmp = sr.ReadLine().Split(_separator);\n foreach (var val in tmp)\n {\n _input.Enqueue(val);\n }\n\n return _input.Dequeue();\n }\n }\n\n public static int ReadInt => int.Parse(Read);\n public static long ReadLong => long.Parse(Read);\n public static double ReadDouble => double.Parse(Read);\n public static string[] StrArray() => ReadLine.Split(' ');\n public static int[] IntArray() => ReadLine.Split(' ').Select(int.Parse).ToArray();\n public static long[] LongArray() => ReadLine.Split(' ').Select(long.Parse).ToArray();\n\n public static string[] StrArray(long n)\n {\n var ret = new string[n];\n for (long i = 0; i < n; ++i) ret[i] = Read;\n return ret;\n }\n\n public static int[] IntArray(long n, bool sorted = false)\n {\n var ret = StrArray(n).Select(int.Parse).ToArray();\n if (sorted) Array.Sort(ret);\n return ret;\n }\n\n public static long[] LongArray(long n, bool sorted = false)\n {\n var ret = StrArray(n).Select(long.Parse).ToArray();\n if (sorted) Array.Sort(ret);\n return ret;\n }\n\n static bool TypeEquals() => typeof(T) == typeof(U);\n static T ChangeType(U a) => (T)System.Convert.ChangeType(a, typeof(T));\n\n static T Convert(string s) => TypeEquals() ? ChangeType(int.Parse(s))\n : TypeEquals() ? ChangeType(long.Parse(s))\n : TypeEquals() ? ChangeType(double.Parse(s))\n : TypeEquals() ? ChangeType(s[0])\n : ChangeType(s);\n\n public static bool In(out T a)\n {\n try\n {\n a = Convert(Read);\n return true;\n }\n catch\n {\n a = default(T);\n return false;\n }\n }\n\n public static bool In(out T a, out U b)\n {\n try\n {\n var ar = StrArray(2);\n a = Convert(ar[0]);\n b = Convert(ar[1]);\n return true;\n }\n catch\n {\n a = default(T);\n b = default(U);\n return false;\n }\n }\n\n public static bool In(out T a, out U b, out V c)\n {\n try\n {\n var ar = StrArray(3);\n a = Convert(ar[0]);\n b = Convert(ar[1]);\n c = Convert(ar[2]);\n return true;\n }\n catch\n {\n a = default(T);\n b = default(U);\n c = default(V);\n return false;\n }\n }\n\n public static bool In(out T a, out U b, out V c, out W d)\n {\n try\n {\n var ar = StrArray(4);\n a = Convert(ar[0]);\n b = Convert(ar[1]);\n c = Convert(ar[2]);\n d = Convert(ar[3]);\n return true;\n }\n catch\n {\n a = default(T);\n b = default(U);\n c = default(V);\n d = default(W);\n return false;\n }\n }\n\n public static bool In(out T a, out U b, out V c, out W d, out X e)\n {\n try\n {\n var ar = StrArray(5);\n a = Convert(ar[0]);\n b = Convert(ar[1]);\n c = Convert(ar[2]);\n d = Convert(ar[3]);\n e = Convert(ar[4]);\n return true;\n }\n catch\n {\n a = default(T);\n b = default(U);\n c = default(V);\n d = default(W);\n e = default(X);\n return false;\n }\n }\n /// \n /// \u8981\u7d20\u6570 (a, b) \u306e\u3001defaultValue \u3067\u6e80\u305f\u3055\u308c\u305f\u914d\u5217\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\n /// \n /// \u914d\u5217\u306e\u578b\n /// 1\u6b21\u5143\u306e\u8981\u7d20\u6570\n /// 2\u6b21\u5143\u306e\u8981\u7d20\u6570\n /// \u30c7\u30d5\u30a9\u30eb\u30c8\u5024\n /// \u6307\u5b9a\u3057\u305f\u6761\u4ef6\u3067\u521d\u671f\u5316\u3055\u308c\u305f\u914d\u5217\n public static T[][] Array2D(int a, int b, T defaultValue = default(T))\n {\n var ret = new T[a][];\n for (int i = 0; i < a; i++)\n {\n ret[i] = Enumerable.Repeat(defaultValue, b).ToArray();\n }\n\n return ret;\n }\n }\n\n public class Program\n {\n public static void Main(string[] args)\n {\n var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};\n Console.SetOut(sw);\n new Solver().Solve();\n Console.Out.Flush();\n Console.Read();\n }\n }\n\n #endregion\n\n\n\n public class Solver\n {\n private const int MOD = (int)1e9 + 7,\n INF = 1000000010;\n\n public void Solve()\n {\n int N = ReadInt;\n int K = ReadInt;\n\n if (N == 1 && K == 1)\n {\n Console.WriteLine(0);\n return;\n }\n\n long now = 1;\n int i = 1;\n while (true)\n {\n now += ++i;\n if (now < K) continue;\n\n int actionCount = i;\n long mustEatCount = now - K;\n if (actionCount + mustEatCount == N ) break;\n }\n\n Console.WriteLine(now - K );\n\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bdbfaddd1377c0a8cd59d26e528c85a3", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"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 long res = long.Parse(s[0]) - (long)(-3 + Math.Sqrt(9 + 8 * (long.Parse(s[0]) + long.Parse(s[1])))) / 2;\n Console.WriteLine(res);\n // Console.ReadKey();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d51997aaf8a9b9b42307f2b2d2b6810", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"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 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.ToInt32(s);\n s = \"\";\n }\n else\n {\n s += str[i];\n }\n }\n array[1] = Convert.ToInt32(s);\n\n int l = 1;\n int r = array[0];\n int 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 if (l == r)\n {\n mid = l;\n }\n Console.WriteLine(array[0] - mid);\n // Console.Read();\n\n }\n }\n \n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "72e2dc9ecdd452fb8472c1d3974cfd21", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"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) / (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": "393c45df48aa7629d002637093c2af97", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"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.ToInt32);\n int n = nk[0], k = nk[1];\n int kq = 0;\n int ts = n * n + n - 2 * k;\n while (true)\n {\n if(ts%(2*n+3-kq)==0)\n {\n Console.WriteLine(kq);\n break;\n }\n kq++;\n }\n\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "464766a91130954882f669ded25291ba", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"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)\n {\n Console.WriteLine(kq);\n break;\n }\n kq++;\n }\n\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "59d1ec489332186cd70308dcc9476ccd", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"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": "6727cc5560fb8de58211542c73745c27", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"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\n if (left == i) { result++; break; }\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": "4d022619d2b2f50b17032d74e4c90582", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"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; 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 Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6e128a0155725cc8bf9522c30cf8866b", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _592A\n {\n public static void Main()\n {\n var board = Enumerable.Range(0, 8).Select(i => Console.ReadLine()).ToArray();\n\n int a = 8;\n int b = 8;\n\n for (int c = 0; c < 8; c++)\n {\n for (int r = 0; r < 8; r++)\n {\n if (board[r][c] != '.')\n {\n if (board[r][c] == 'W')\n {\n a = Math.Min(a, r);\n }\n\n break;\n }\n }\n\n for (int r = 7; r >= 0; r--)\n {\n if (board[r][c] != '.')\n {\n if (board[r][c] == 'B')\n {\n b = Math.Min(a, 7 - r);\n }\n\n break;\n }\n }\n }\n\n Console.WriteLine(a <= b ? 'A' : 'B');\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "90b8a58a899ff7ac773535964fa5e268", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "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{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = new string[8];\n for (int i = 0; i < 8; i++)\n {s[i]=Console.ReadLine(); }\n int mina = 9;\n int maxb = 0;\n for (int i = 0; i < 8; i++)\n {\n for (int j = 0; j < 8; j++)\n {\n if (s[i][j] == 'W'&&i= 0; w--)\n {\n if (s[w][j] == 'B')\n { a = false; break; }\n }\n if (a) { mina = i+1; }\n }\n if (s[i][j] == 'B' && i > maxb)\n {\n bool a = true;\n for (int w = i; w < 8; w++)\n {\n if (s[w][j] == 'W')\n { a = false; break; }\n }\n if (a) { maxb = i+1; }\n }\n }\n }\n if ((8 - maxb) < (mina - 1)) { Console.WriteLine(\"B\"); }\n else { Console.WriteLine(\"A\"); }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "350d47602117a9e0b7267d3f9383a696", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.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 _329a\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//Console.SetIn(File.OpenText(\"in.txt\"));\n\t\t\tvar d = new int[8, 8];\n\t\t\tfor (int i = 0; i < 8; i++)\n\t\t\t{\n\t\t\t\tvar st = Console.ReadLine();\n\t\t\t\tfor (int j = 0; j < 8; j++)\n\t\t\t\t{\n\t\t\t\t\tvar ch = st[j];\n\t\t\t\t\tif (ch == '.')\n\t\t\t\t\t{\n\t\t\t\t\t\td[i, j] = 0;\n\t\t\t\t\t}\n\t\t\t\t\telse if (ch == 'W')\n\t\t\t\t\t{\n\t\t\t\t\t\td[i, j] = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if (ch == 'B')\n\t\t\t\t\t{\n\t\t\t\t\t\td[i, j] = 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar min1 = 100;\n\t\t\tvar min2 = 100;\n\t\t\tfor (int i = 0; i < 8; i++)\n\t\t\t{\n\t\t\t\tvar c1 = -1;\n\t\t\t\tvar c2 = -1;\n\t\t\t\tfor (int j = 0; j < 8; j++)\n\t\t\t\t{\n\t\t\t\t\tif (d[j, i] == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tc2 = j;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\tfor (int j = 7; j >= 0; j--)\n\t\t\t\t{\n\t\t\t\t\tif (d[j, i] == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tc1 = j;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar cant1 = false;\n\t\t\t\tvar cant2 = false;\n\t\t\t\tif (c1 != -1 && c2 != -1)\n\t\t\t\t{\n\t\t\t\t\tvar w = c1;\n\t\t\t\t\t//var cant = false;\n\t\t\t\t\tfor (int k = w; k <= 0; k--)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (d[k, i] == 2)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcant1 = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t//if (cant1)\n\t\t\t\t\t//{\n\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t//}\n\n\t\t\t\t\t//cant = false;\n\t\t\t\t\tfor (int k = c2; k < 8; k++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (d[k, i] == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcant2 = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//if (cant2)\n\t\t\t\t\t//{\n\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t//}\n\t\t\t\t}\n\n\t\t\t\tif (c1 == -1 && c2 == -1)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (c1 != -1 && !cant1)\n\t\t\t\t{\n\t\t\t\t\tvar cmin1 = c1;\n\t\t\t\t\tif (cmin1 < min1)\n\t\t\t\t\t{\n\t\t\t\t\t\tmin1 = cmin1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (c2 != -1 && !cant2)\n\t\t\t\t{\n\t\t\t\t\tvar cmin2 = 7 - c2;\n\t\t\t\t\tif (cmin2 < min2)\n\t\t\t\t\t{\n\t\t\t\t\t\tmin2 = cmin2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (min1 <= min2)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"A\");\n\t\t\t}\n\t\t\telse if (min2 < min1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"B\");\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ab41357e9a03772255a95d8e28c1cadd", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.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 _329a\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//Console.SetIn(File.OpenText(\"in.txt\"));\n\t\t\tvar d = new int[8, 8];\n\t\t\tfor (int i = 0; i < 8; i++)\n\t\t\t{\n\t\t\t\tvar st = Console.ReadLine();\n\t\t\t\tfor (int j = 0; j < 8; j++)\n\t\t\t\t{\n\t\t\t\t\tvar ch = st[j];\n\t\t\t\t\tif (ch == '.')\n\t\t\t\t\t{\n\t\t\t\t\t\td[i, j] = 0;\n\t\t\t\t\t}\n\t\t\t\t\telse if (ch == 'W')\n\t\t\t\t\t{\n\t\t\t\t\t\td[i, j] = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if (ch == 'B')\n\t\t\t\t\t{\n\t\t\t\t\t\td[i, j] = 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar min1 = 100;\n\t\t\tvar min2 = 100;\n\t\t\tfor (int i = 0; i < 8; i++)\n\t\t\t{\n\t\t\t\tvar c1 = -1;\n\t\t\t\tvar c2 = -1;\n\t\t\t\tfor (int j = 0; j < 8; j++)\n\t\t\t\t{\n\t\t\t\t\tif (d[j, i] == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tc1 = j;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (d[j, i] == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tc2 = j;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (c1 != -1 && c2 != -1 && (c2 < c1))\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (c1 == -1 && c2 == -1)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (c1 != -1)\n\t\t\t\t{\n\t\t\t\t\tvar cmin1 = c1;\n\t\t\t\t\tif (cmin1 < min1)\n\t\t\t\t\t{\n\t\t\t\t\t\tmin1 = cmin1;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (c2 != -1)\n\t\t\t\t{\n\t\t\t\t\tvar cmin2 = 7 - c2;\n\t\t\t\t\tif (cmin2 < min2)\n\t\t\t\t\t{\n\t\t\t\t\t\tmin2 = cmin2;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (min1 <= min2)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"A\");\n\t\t\t}\n\t\t\telse if (min2 < min1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"B\");\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e92fe14ca92ea96ac576cc0acc88524b", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0} {"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[] { '\\n', '\\r'}, StringSplitOptions.RemoveEmptyEntries);\n bool beforeW=false;\n int shortestWayW = int.MaxValue;\n int shortestWayB = shortestWayW;\n for(int i = 0, currShortB = int.MaxValue; i<8; ++i)\n {\n for(int j=0; j<8; j++)\n {\n if(input[j][i]!='.')\n {\n if(input[j][i]=='W')\n {\n if(!beforeW)\n {\n if (shortestWayW > j) shortestWayW = j;\n beforeW = true;\n }\n currShortB = int.MaxValue;\n }\n else\n {\n beforeW = true;\n currShortB = 8 - j;\n }\n }\n }\n if (currShortB < shortestWayB) shortestWayB = currShortB;\n beforeW = false;\n }\n Console.WriteLine(shortestWayB < shortestWayW ? 'B' : 'A');\n }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a1b0131885c187ff7b75992f19cf5156", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.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 void Solve()\n {\n var a = ReadLines(8);\n\n int ca = 8, cb = 8;\n for (int i = 0; i < 8; i++)\n {\n for (int j = 0; j < 8; j++)\n if (a[j][i] == 'W')\n ca = Math.Min(ca, j);\n else if (a[j][i] == 'B')\n break;\n for (int j = 7; j >= 0; j--)\n if (a[j][i] == 'B')\n cb = Math.Min(cb, 7 - j);\n else if (a[j][i] == 'W')\n break;\n }\n\n Write(ca > cb ? \"B\" : \"A\");\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(\"figures.in\");\n //writer = new StreamWriter(\"figures.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": "64a161edc7bf54159dd860063c0c4b45", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "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 ConsoleApplication19\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[,] a=new char[8,8];\n int w = int.MaxValue;\n int b = int.MaxValue;\n for (int i = 0; i < 8; i++)\n {\n char[] tmp = Console.ReadLine().ToCharArray();\n for (int j = 0; j < 8; j++)\n {\n a[i, j] = tmp[j];\n }\n }\n for (int i = 0; i < 8; i++)\n {\n for (int j = 0; j < 8; j++)\n {\n if (a[i, j] == 'W')\n {\n bool k;\n if (i - 1 == -1)\n k = true;\n else\n {\n k = true;\n for (int m = i - 1; m >= 0; m--)\n {\n if (a[m, j] != '.')\n k = false;\n }\n }\n if (k)\n {\n if (w > i)\n w = i;\n }\n\n }\n if (a[i, j] == 'B')\n {\n bool k;\n if (i + 1 == 8)\n k = true;\n else\n {\n k = true;\n for (int m = i + 1; m <= 7; m++)\n {\n if (a[m, j] != '.')\n k = false;\n }\n }\n if (k)\n {\n if (b>(7 - i))\n b = 7- i;\n }\n }\n }\n }\n if (w>b)\n Console.WriteLine(\"B\");\n else\n {\n Console.WriteLine(\"A\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8317f296403c0d56910697cfd41766b8", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.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;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n \n void Solve()\n {\n int minA=10, minB=10;\n var arr = new char[8,8];\n //var arrB = new bool[8, 8];\n for (int i = 0; i < 8; ++i)\n {\n var s = Console.ReadLine().ToCharArray();\n for (int j = 0; j < 8; j++)\n {\n arr[i, j] = s[j];\n }\n }\n for (int j = 0; j < 8; ++j)\n {\n bool empty = true;\n int i = 0;\n while(empty && i<8)\n {\n if (arr[i, j] != '.')\n {\n if (arr[i, j] == 'W')\n minA = Math.Min(minA, i);\n empty = false;\n }\n i++;\n }\n i = 7;\n empty = true;\n while (empty && i >=0)\n {\n if (arr[i, j] != '.')\n {\n if (arr[i, j] == 'B')\n minB = Math.Min(minB, 7-i);\n empty = false;\n }\n i--;\n }\n }\n var winner = minA <= minB ? \"A\" : \"B\";\n Console.WriteLine(winner);\n //Console.ReadLine();\n }\n\n \n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1e5369b594f3ddfe968c4d7628766802", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nusing System.Text;\n\n\nnamespace Task1\n{\n class Program\n\n {\n static string[] s = new string[8];\n static int getW(int i, int j)\n {\n i--;\n int k =0;\n for (k=0;i>=0; i--, k++)\n if (s[i][j]!='.'){return 9;}\n return k;\n }\n\n static int getB(int i, int j)\n {\n i++;\n int k = 0;\n for (k = 0; i <8; i++, k++)\n if (s[i][j] != '.') { return 9; }\n return k;\n }\n static void Main(string[] args)\n {\n \n\n for (int i = 0; i < 8; i++)\n s[i]= Console.ReadLine();\n int minW = 9, minB = 9;\n for(int i = 0; i< 8; i++)\n for (int j = 0; j < 8; j++)\n if (s[i][j]=='W') minW = Math.Min(minW, getW(i,j));\n else if (s[i][j]=='B') minB = Math.Min(minB, getB(i,j));\n if (minB >= minW) Console.WriteLine(\"A\");\n else Console.WriteLine(\"B\");\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a623bf28ba776bbee3bb12775ec8f9ed", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nnamespace Task\n{\n class MyIo\n {\n char[] separators = new char[] { ' ', '\\t' };\n\n#if TEST\n TextReader inputStream = new StreamReader(\"..\\\\..\\\\input.txt\");\n#else\n TextReader inputStream = System.Console.In;\n#endif\n TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(separators, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n outputStream.WriteLine(format, args);\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n }\n\n\n\n class Program\n {\n MyIo io = new MyIo();\n\n enum State\n {\n Empty = 0,\n OwnerOnly = 1,\n WithGuest = 2\n }\n\n int R, C;\n\n State[,] map;\n\n Dictionary memo;\n\n long makeConfig(int r, int c)\n {\n long cfg = 0;\n int lowR = Math.Max(0, r - 1);\n int highR = Math.Min(R - 1, r + 1);\n\n int abs = r * C + c;\n\n int lowAbs = Math.Max(0, abs - C);\n int highAbs = Math.Min(R * C - 1, abs + C);\n\n for (int curAbs = lowAbs; curAbs <= highAbs; curAbs++)\n {\n int curR = curAbs / C;\n int curC = curAbs % C;\n\n cfg <<= 2;\n cfg |= (uint)map[curR, curC];\n }\n cfg <<= 6;\n cfg |= (uint)r;\n cfg <<= 6;\n cfg |= (uint)c;\n\n return cfg;\n }\n\n int[][] dirs = new int[][]\n {\n new int[] {0, -1},\n new int[] {0, 1},\n new int[] {1, 0},\n new int[] {-1, 0}\n };\n\n int xfx(int r, int c)\n {\n if (r == R)\n {\n return 0;\n }\n if (c == C)\n {\n return xfx(r + 1, 0);\n }\n\n long cfg = makeConfig(r, c);\n if (memo.ContainsKey(cfg))\n {\n return memo[cfg];\n }\n\n if (map[r, c] == State.Empty)\n {\n return xfx(r, c + 1);\n }\n\n if (map[r, c] == State.WithGuest)\n {\n return xfx(r, c + 1);\n }\n\n int ans = xfx(r, c + 1); // no move\n\n map[r, c] = State.Empty;\n\n foreach (int[] d in dirs)\n {\n int nR = r + d[0];\n int nC = c + d[1];\n\n if (nR >= 0 && nR < R && nC >= 0 && nC < C)\n {\n var oldState = map[nR, nC];\n int curAns = oldState == State.Empty ? 0 : 1;\n\n map[nR, nC] = State.WithGuest;\n \n curAns += xfx(r, c + 1);\n map[nR, nC] = oldState;\n\n ans = Math.Max(ans, curAns);\n }\n }\n\n map[r, c] = State.OwnerOnly;\n\n memo[cfg] = ans;\n\n return ans;\n }\n\n void Solve()\n {\n memo = new Dictionary();\n\n R = io.NextInt();\n C = io.NextInt();\n\n if (C > R)\n {\n R += C;\n C = R - C;\n R = R - C;\n }\n\n map = new State[R, C];\n\n for (int r = 0; r < R; r++)\n {\n for (int c = 0; c < C; c++)\n {\n map[r, c] = State.OwnerOnly;\n }\n }\n\n int ans = xfx(0, 0);\n io.Print(ans);\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.io.Close();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5604092d8de3deb8a83c37d6a5a51b76", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.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 static void Main()\n {\n int ans = 0;\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n if (n > m)\n {\n int a = n;\n n = m;\n m = a;\n }\n if (n == 1) ans = ((m - 1) / 3 + 1);\n if (n == 2) ans = m / 2 + 1;\n if (n == 3)\n {\n if (m < 5) ans = m;\n else\n {\n int mo = (m - 5) / 4 + 1;\n ans = m - mo;\n }\n }\n if (n == 4)\n {\n if (m % 2 == 0) ans = m;\n else ans = m + 1;\n if (m == 6) ans = 7;\n if (m == 7) ans = 7;\n }\n if (n == 5)\n {\n if (m == 5) ans = 7;\n if (m == 6) ans = 8;\n if (m == 7) ans = 9;\n if (m == 8) ans = 11;\n }\n if (n == 6) ans = (10);\n Console.WriteLine(n * m - ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4566808d87687c27ae4e34135826c6fb", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round85 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss)); }\n\n static int popcount(int n) { int res = 0; for (; n > 0; n &= n - 1)res++; return res; }\n\n static int n, m;\n static bool check(int v, int j) {\n int mask = (1 << m) - 1;\n return ((v | (v << 1) | (v >> 1) | j) & mask) == mask;\n }\n\n static void Main() {\n var xs = ReadInts();\n n = xs.Max();\n m = xs.Min();\n\n if (m == 1 && false) {\n Console.WriteLine(n == (n + 1) / 2);\n return;\n }\n\n var dp = new int[][,] { new int[1 << m, 1 << m], new int[1 << m, 1 << m] };\n\n for (int v = 0; v < 1 << m; v++)\n for (int j = 0; j < 1 << m; j++)\n dp[0][v, j] = 1 << 29;\n\n dp[0][(1 << m) - 1, 0] = 0;\n\n int a = 0;\n for (int i = 0; i <= n; i++, a ^= 1) {\n var cur = dp[a];\n var next = dp[a ^ 1];\n\n for (int v = 0; v < 1 << m; v++)\n for (int j = 0; j < 1 << m; j++)\n next[v, j] = 1 << 29;\n\n for (int v = 0; v < 1 << m; v++) {\n for (int j = 0; j < 1 << m; j++) {\n for (int k = 0; k < 1 << m; k++) {\n if (check(v, j | k)) {\n next[v, k] = Math.Min(cur[j, v] + popcount(k), next[v, k]);\n }\n }\n }\n }\n }\n\n int res = 1000000000;\n for (int v = 0; v < 1 << m; v++)\n for (int j = 0; j < 1 << m; j++)\n res = Math.Min(res, dp[a][v, j]);\n Console.WriteLine(n * m - res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "36b2a2a8b9eac2a815a6cee6c2ec9039", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.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 static void Main()\n {\n int ans = 0;\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n if (n > m)\n {\n int a = n;\n n = m;\n m = a;\n }\n if (n == 1) ans = ((m - 1) / 3 + 1);\n if (n == 2) ans = m / 2 + 1;\n if (n == 3)\n {\n ans = (m / 5 * 4) + m % 5;\n }\n if (n == 4)\n {\n if (m % 4 == 0) ans = (m);\n else ans = (m + 1);\n }\n if (n == 5)\n {\n ans = (m + 2);\n }\n if (n == 6) ans = (10);\n Console.WriteLine(n * m - ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e134b46fb33d597d1bfa36a79ad22219", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.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 static void Main()\n {\n int ans = 0;\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n if (n > m)\n {\n int a = n;\n n = m;\n m = a;\n }\n if (n == 1) ans = ((m - 1) / 3 + 1);\n if (n == 2) ans = m / 2 + 1;\n if (n == 3)\n {\n if (m < 5) ans = m;\n else\n {\n int mo = (m - 5) / 4 + 1;\n ans = m - mo;\n }\n }\n if (n == 4)\n {\n if (m % 2 == 0) ans = m;\n else ans = m + 1;\n if (m == 6) ans = 7;\n }\n if (n == 5)\n {\n if (m == 5) ans = 7;\n if (m == 6) ans = 8;\n if (m == 7) ans = 9;\n if (m == 8) ans = 11;\n }\n if (n == 6) ans = (10);\n Console.WriteLine(n * m - ans);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f8128b4919f33f3119fab762b5645193", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.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 static void Main()\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n if (n > m)\n {\n int a = n;\n n = m;\n m = a;\n }\n if (n == 1) Console.WriteLine((m - 1) / 3 + 1);\n if (n == 2) Console.WriteLine((m - 1) / 2 + 1);\n if (n == 3) Console.WriteLine(m);\n if (n == 4)\n {\n if (m % 4 == 0) Console.WriteLine(m);\n else Console.WriteLine(m + 1);\n }\n if (n == 5)\n {\n Console.WriteLine(m + 2);\n }\n if (n == 6) Console.WriteLine(10);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a3eb69cfcbdacad0ba435a0dca9ca079", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round85 {\n class C {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss)); }\n\n static int popcount(int n) { int res = 0; for (; n > 0; n &= n - 1)res++; return res; }\n\n static int n, m;\n static bool check(int v, int j) {\n int mask = (1 << m) - 1;\n return ((v | (v << 1) | (v >> 1) | j) & mask) == mask;\n }\n\n static void Main() {\n var xs = ReadInts();\n n = xs.Max();\n m = xs.Min();\n\n if (m == 1) {\n Console.WriteLine((n + 1) / 2);\n return;\n }\n\n var dp = new int[][,] { new int[1 << m, 1 << m], new int[1 << m, 1 << m] };\n\n for (int v = 0; v < 1 << m; v++)\n for (int j = 0; j < 1 << m; j++)\n dp[0][v, j] = 1 << 29;\n\n dp[0][(1 << m) - 1, 0] = 0;\n\n int a = 0;\n for (int i = 0; i <= n; i++, a ^= 1) {\n var cur = dp[a];\n var next = dp[a ^ 1];\n\n for (int v = 0; v < 1 << m; v++)\n for (int j = 0; j < 1 << m; j++)\n next[v, j] = 1 << 29;\n\n for (int v = 0; v < 1 << m; v++) {\n for (int j = 0; j < 1 << m; j++) {\n for (int k = 0; k < 1 << m; k++) {\n if (check(v, j | k)) {\n next[v, k] = Math.Min(cur[j, v] + popcount(k), next[v, k]);\n }\n }\n }\n }\n }\n\n int res = 1000000000;\n for (int v = 0; v < 1 << m; v++)\n for (int j = 0; j < 1 << m; j++)\n res = Math.Min(res, dp[a][v, j]);\n Console.WriteLine(n * m - res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0c8672cbac866d1e18402fe4bb418ee9", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n class D\n {\n static double[,] memo;\n static double Memo(int w, int b)\n {\n if (memo[w, b] < 0)\n {\n if (b == 2 && w == 1) memo[w, b] = 1.0 / 3;\n else if (w == 0) memo[w, b] = 0;\n else if (b == 0) memo[w, b] = 1;\n else if (b == 1) memo[w, b] = 1.0 * w / (w + 1);\n else if (b == 2 && w > 1) memo[w, b] = 1.0 * w / (w + 2) + 2.0 / (w + 2) * 1.0 / (w + 1);\n else\n {\n double s = 1.0 * w / (w + b);\n s += (1 - s) * (b - 1) / (w + b - 1) * (Memo(w, b - 3) * (b - 2) / (w + b - 2) + Memo(w - 1, b - 2) * w / (w + b - 2));\n memo[w, b] = s;\n }\n }\n\n return memo[w, b];\n }\n\n private static object Go()\n {\n int w = GetInt();\n int b = GetInt();\n\n memo = new double[w+1,b+1];\n for (int i = 0; i < w+1; i++)\n {\n for (int j = 0; j < b+1; j++)\n {\n memo[i, j] = -1f;\n }\n }\n\n\n return Memo(w, b).ToString(CultureInfo.InvariantCulture);\n }\n\n #region Template\n\n private static double err = 0.000000001;\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": false, "code_uid": "f462d8fb233bb2193fe0531f7ec0138e", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\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 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 w = ReadNextInt(input, 0);\n var b = ReadNextInt(input, 1);\n var dp = new double[w + 1,b + 1];\n for (int i = 1; i < w + 1; i++)\n {\n dp[i, 0] = 1;\n }\n for (int i = 1; i < w + 1; i++)\n {\n for (int j = 1; j < b + 1; j++)\n {\n dp[i, j] = (double) i/(i + j);\n dp[i, j] += (double) j/(i + j)*(j - 1)/(i + j - 1)\n *\n ((double) (j - 2)/(i + j - 2)*dp[i, Math.Max(0, j - 3)] +\n (double)(i) / (i + j - 2) * dp[i - 1, Math.Max(0, j - 2)]);\n }\n }\n Console.WriteLine(dp[w,b]);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6662f280ad202a58aeed8bcbc7d3a0c2", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static double[,] dp;\n\n static double solve(int w, int b)\n {\n if (dp[w,b] == -1)\n {\n dp[w, b] = (double) w / (w + b);\n if (b > 1)\n dp[w, b] += ((double)b / (w + b)) * ((double)(b - 1) / (w + b - 1)) * ((double)(w) / (w + b - 2)) * solve(w - 1, b - 2);\n if (b > 2)\n dp[w, b] += ((double)b / (w + b)) * ((double)(b - 1) / (w + b - 1)) * ((double)(b - 2) / (w + b - 2)) * solve(w, b - 3);\n }\n return dp[w,b];\n }\n\n static void Main(string[] args)\n {\n string[] readen = Console.ReadLine().Split(' ');\n int w = int.Parse(readen[0]);\n int b = int.Parse(readen[1]);\n dp = new double[w+1, b+1];\n for (int i = 0; i <= w; i++)\n for (int j = 0; j <= b; j++)\n dp[i, j] = -1;\n for (int i = 0; i <= w; i++)\n dp[i, 0] = 1;\n for (int i = 0; i <= b; i++)\n dp[0, i] = 0;\n Console.WriteLine(solve(w, b));\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9fe01b807c7c1b6ffbbc96a45d4aec59", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "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 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\u304b?\n var dp = new ModInt[2 * N + 1, 201, 2];\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 // (\u3092\u8ffd\u52a0\n if (j + 1 <= 200)\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 (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 // s\n if (i + l <= 2 * N && j + min >= 0 && j + cnt <= 200)\n {\n dp[i + l, 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}\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": "a5e5f094f0a82a78004585db43c4c26d", "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 dp[i + S.Length, j + cnt, 0] -= 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": "c0f19d1005a7b509e566702536a8852b", "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;\nusing CompLib.String;\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\u3067\u9593\u9055\u3048\u305f\u3068\u304d\u3069\u3053\u306b\u98db\u3076\u304b?\n int[] next = new int[S.Length];\n for (int i = 0; i < S.Length; i++)\n {\n if (i == 0)\n {\n next[i] = 0;\n continue;\n }\n\n bool f2 = false;\n for (int len = i; len >= 1; len--)\n {\n bool f = true;\n for (int j = 0; f && j < len - 1; j++)\n {\n f &= S[j] == S[i - len + 1 + j];\n }\n if (!f) continue;\n if (S[len - 1] != S[i])\n {\n next[i] = len;\n f2 = true;\n break;\n }\n }\n\n }\n\n // i\u6587\u5b57\u76ee\u307e\u3067\u4f5c\u308b\u3001\u30ab\u30a6\u30f3\u30bf\u3001S\u3088\u308a\u524d\u3001S\u3088\u308a\u5f8c, S\u306e\u4f55\u6587\u5b57\u307e\u3067\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 if (S[k] == '(')\n {\n if (k + 1 == S.Length)\n {\n dp[i + 1, j + 1, 0, 1] += dp[i, j, k, 0];\n }\n else\n {\n dp[i + 1, j + 1, k + 1, 0] += dp[i, j, k, 0];\n }\n }\n else\n {\n // \u3069\u3053\u306b\u98db\u3076\n dp[i + 1, j + 1, next[k], 0] += dp[i, j, k, 0];\n }\n\n\n }\n\n if (j - 1 >= 0)\n {\n if (S[k] == ')')\n {\n if (k + 1 == S.Length)\n {\n dp[i + 1, j - 1, 0, 1] += dp[i, j, k, 0];\n }\n else\n {\n dp[i + 1, j - 1, k + 1, 0] += dp[i, j, k, 0];\n }\n }\n else\n {\n dp[i + 1, j - 1, next[k], 0] += dp[i, j, k, 0];\n }\n\n }\n }\n\n if (j + 1 <= N)\n {\n dp[i + 1, j + 1, 0, 1] += dp[i, j, 0, 1];\n }\n if (j - 1 >= 0)\n {\n dp[i + 1, j - 1, 0, 1] += dp[i, j, 0, 1];\n }\n }\n }\n\n Console.WriteLine(dp[2 * N, 0, 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\nnamespace CompLib.String\n{\n using System;\n using System.Collections.Generic;\n using System.Diagnostics;\n public static partial class StringACL\n {\n private const int ThresholdNative = 10;\n private const int ThresholdDoubling = 40;\n\n #region SuffixArray\n public static int[] SuffixArray(int[] s, int upper)\n {\n Debug.Assert(0 <= upper);\n\n // C++\u307f\u305f\u3044\u306b\u5185\u90e8\u3067\u4f55\u3082\u3057\u306a\u3044\u30eb\u30fc\u30d7\u3092\u30b9\u30ad\u30c3\u30d7\u3059\u308b\u306e\u304b?\n // \u3057\u3066\u304f\u308c\u308b\u306a\u3089 #if\u3044\u3089\u306a\u3044\n#if DEBUG\n foreach (var d in s)\n {\n Debug.Assert(0 <= d && d <= upper);\n }\n#endif\n return SAIS(s, upper);\n }\n\n public static int[] SuffixArray(T[] s, Comparison cmp)\n {\n int n = s.Length;\n int[] idx = new int[n];\n for (int i = 0; i < n; i++)\n {\n idx[i] = i;\n }\n\n Array.Sort(idx, (l, r) => cmp(s[l], s[r]));\n\n int[] s2 = new int[n];\n int now = 0;\n for (int i = 0; i < n; i++)\n {\n if (0 < i && cmp(s[idx[i - 1]], s[idx[i]]) != 0) now++;\n s2[idx[i]] = now;\n }\n\n return SAIS(s2, now);\n }\n public static int[] SuffixArray(T[] s)\n {\n return SuffixArray(s, Comparer.Default.Compare);\n }\n\n /// \n /// \u9577\u3055n\u306e\u6587\u5b57\u5217\u306esuffixArray\u3092\u8fd4\u3059\n /// \n /// \n /// {0,1,2,...,n-1}\u306e\u9806\u5217\u3001s[sa[i],n) < s[sa[i+1],n)\n /// suffixArray\u306e\u8f9e\u66f8\u9806\n /// \n /// \n /// \n public static int[] SuffixArray(string s)\n {\n int n = s.Length;\n int[] s2 = new int[n];\n for (int i = 0; i < n; i++)\n {\n s2[i] = s[i];\n }\n return SAIS(s2, 255);\n }\n\n // O(n^2)\n private static int[] SANative(int[] s)\n {\n int n = s.Length;\n int[] sa = new int[n];\n for (int i = 0; i < n; i++)\n {\n sa[i] = i;\n }\n Array.Sort(sa, (l, r) =>\n {\n // \u540c\u3058\u306a\u30890\n if (l == r) return 0;\n // \u9806\u756a\u306b\u898b\u308b\n while (l < n && r < n)\n {\n\n if (s[l] != s[r]) return s[l].CompareTo(s[r]);\n l++;\n r++;\n }\n\n // index\u304c\u5927\u304d\u3044\u65b9\u304c\u8f9e\u66f8\u9806\u3067\u5c0f\u3055\u3044\n return r.CompareTo(l);\n });\n return sa;\n }\n private static int[] SADoubling(int[] s)\n {\n int n = s.Length;\n int[] sa = new int[n];\n int[] rnk = new int[n];\n int[] tmp = new int[n];\n Array.Copy(s, rnk, n);\n for (int i = 0; i < n; i++)\n {\n sa[i] = i;\n }\n\n for (int k = 1; k < n; k *= 2)\n {\n Comparison cmp = (int x, int y) =>\n {\n if (rnk[x] != rnk[y]) return rnk[x].CompareTo(rnk[y]);\n int rx = x + k < n ? rnk[x + k] : -1;\n int ry = y + k < n ? rnk[y + k] : -1;\n return rx.CompareTo(ry);\n };\n\n Array.Sort(sa, cmp);\n tmp[sa[0]] = 0;\n for (int i = 1; i < n; i++)\n {\n tmp[sa[i]] = tmp[sa[i - 1]] + (cmp(sa[i - 1], sa[i]) < 0 ? 1 : 0);\n }\n\n var t = tmp;\n tmp = rnk;\n rnk = t;\n }\n\n return sa;\n }\n\n private static int[] SAIS(int[] s, int upper)\n {\n int n = s.Length;\n if (n == 0) return new int[0];\n if (n == 1) return new int[1];\n if (n == 2)\n {\n if (s[0] < s[1])\n {\n return new int[] { 0, 1 };\n }\n else\n {\n return new int[] { 1, 0 };\n }\n }\n\n if (n < ThresholdNative)\n {\n return SANative(s);\n }\n\n if (n < ThresholdDoubling)\n {\n return SADoubling(s);\n }\n\n int[] sa = new int[n];\n bool[] ls = new bool[n];\n\n for (int i = n - 2; i >= 0; i--)\n {\n ls[i] = (s[i] == s[i + 1]) ? ls[i + 1] : (s[i] < s[i + 1]);\n }\n\n int[] sumL = new int[upper + 1];\n int[] sumS = new int[upper + 1];\n\n for (int i = 0; i < n; i++)\n {\n if (!ls[i])\n {\n sumS[s[i]]++;\n }\n else\n {\n sumL[s[i] + 1]++;\n }\n }\n\n for (int i = 0; i <= upper; i++)\n {\n sumS[i] += sumL[i];\n if (i < upper) sumL[i + 1] += sumS[i];\n }\n\n Action> induce = (List lms) =>\n {\n for (int i = 0; i < n; i++)\n {\n sa[i] = -1;\n }\n\n int[] buf = new int[upper + 1];\n Array.Copy(sumS, buf, upper + 1);\n\n foreach (var d in lms)\n {\n if (d == n) continue;\n sa[buf[s[d]]++] = d;\n }\n\n Array.Copy(sumL, buf, upper + 1);\n sa[buf[s[n - 1]]++] = n - 1;\n for (int i = 0; i < n; i++)\n {\n int v = sa[i];\n if (v >= 1 && !ls[v - 1])\n {\n sa[buf[s[v - 1]]++] = v - 1;\n }\n }\n\n Array.Copy(sumL, buf, upper + 1);\n\n for (int i = n - 1; i >= 0; i--)\n {\n int v = sa[i];\n if (v >= 1 && ls[v - 1])\n {\n sa[--buf[s[v - 1] + 1]] = v - 1;\n }\n }\n };\n\n int[] lmsMap = new int[n + 1];\n for (int i = 0; i <= n; i++)\n {\n lmsMap[i] = -1;\n }\n\n int m = 0;\n for (int i = 1; i < n; i++)\n {\n if (!ls[i - 1] && ls[i])\n {\n lmsMap[i] = m++;\n }\n }\n\n List lmsL = new List(m);\n for (int i = 1; i < n; i++)\n {\n if (!ls[i - 1] && ls[i])\n {\n lmsL.Add(i);\n }\n }\n\n induce(lmsL);\n\n if (m != 0)\n {\n List sortedLms = new List(m);\n foreach (var v in sa)\n {\n if (lmsMap[v] != -1) sortedLms.Add(v);\n }\n\n int[] recS = new int[m];\n\n int recUpper = 0;\n recS[lmsMap[sortedLms[0]]] = 0;\n for (int i = 1; i < m; i++)\n {\n int l = sortedLms[i - 1], r = sortedLms[i];\n int endL = (lmsMap[l] + 1 < m) ? lmsL[lmsMap[l] + 1] : n;\n int endR = (lmsMap[r] + 1 < m) ? lmsL[lmsMap[r] + 1] : n;\n\n bool same = true;\n\n if (endL - l != endR - r)\n {\n same = false;\n }\n else\n {\n while (l < endL)\n {\n if (s[l] != s[r])\n {\n break;\n }\n l++;\n r++;\n }\n\n if (l == n || s[l] != s[r]) same = false;\n }\n\n if (!same) recUpper++;\n recS[lmsMap[sortedLms[i]]] = recUpper;\n }\n\n var recSa = SAIS(recS, recUpper);\n\n for (int i = 0; i < m; i++)\n {\n sortedLms[i] = lmsL[recSa[i]];\n }\n\n induce(sortedLms);\n }\n return sa;\n }\n #endregion // SuffixArray\n\n #region LCPArray\n /// \n /// s\u306eLCPArray\u3068\u3057\u3066\u9577\u3055 n-1\u306e\u914d\u5217\u3092\u8fd4\u3059\n /// \n /// \n /// res[i]\u306fs[sa[i],n), s[sa[i+1],n)\u306eLongest Common Prefix\u306e\u9577\u3055\n /// O(n)\n /// \n /// \n /// \n /// \n /// \n /// \n public static int[] LCPArray(T[] s, int[] sa, Comparison cmp)\n {\n int n = s.Length;\n Debug.Assert(n >= 1);\n int[] rnk = new int[n];\n for (int i = 0; i < n; i++)\n {\n rnk[sa[i]] = i;\n }\n\n int[] lcp = new int[n - 1];\n int h = 0;\n for (int i = 0; i < n; i++)\n {\n if (h > 0) h--;\n if (rnk[i] == 0) continue;\n int j = sa[rnk[i] - 1];\n for (; j + h < n && i + h < n; h++)\n {\n if (cmp(s[j + h], s[i + h]) != 0) break;\n }\n lcp[rnk[i] - 1] = h;\n }\n\n return lcp;\n }\n\n /// \n /// s\u306eLCPArray\u3068\u3057\u3066\u9577\u3055 n-1\u306e\u914d\u5217\u3092\u8fd4\u3059\n /// \n /// \n /// res[i]\u306fs[sa[i],n), s[sa[i+1],n)\u306eLongest Common Prefix\u306e\u9577\u3055\n /// O(n)\n /// \n /// \n /// \n /// \n /// \n public static int[] LCPArray(T[] s, int[] sa)\n {\n return LCPArray(s, sa, Comparer.Default.Compare);\n }\n /// \n /// s\u306eLCPArray\u3068\u3057\u3066\u9577\u3055 n-1\u306e\u914d\u5217\u3092\u8fd4\u3059\n /// \n /// \n /// res[i]\u306fs[sa[i],n), s[sa[i+1],n)\u306eLongest Common Prefix\u306e\u9577\u3055\n /// O(n)\n /// \n /// \n /// \n /// \n /// \n public static int[] LCPArray(string s, int[] sa)\n {\n //int n = s.Length;\n //int[] s2 = new int[n];\n //for (int i = 0; i < n; i++)\n //{\n // s2[i] = s[i];\n //}\n return LCPArray(s.ToCharArray(), sa);\n }\n\n #endregion // LCPArray\n\n #region ZAlgorithm\n\n /// \n /// \u9577\u3055n\u306e\u914d\u5217s\u306b\u3064\u3044\u3066 s\u3068 s[i,n)\u306eLCP\u306e\u9577\u3055\u3092\u8fd4\u3059\n /// \n /// \n /// \n /// \n /// \n public static int[] ZAlgorithm(T[] s, EqualityComparer eq)\n {\n int n = s.Length;\n if (n == 0) return new int[0];\n int[] z = new int[n];\n z[0] = 0;\n for (int i = 1, j = 0; i < n; i++)\n {\n ref int k = ref z[i];\n k = (j + z[j] <= i) ? 0 : Math.Min(j + z[j] - i, z[i - j]);\n while (i + k < n && eq.Equals(s[k], s[i + k])) k++;\n if (j + z[j] < i + z[i]) j = i;\n }\n z[0] = n;\n return z;\n }\n\n /// \n /// \u9577\u3055n\u306e\u914d\u5217s\u306b\u3064\u3044\u3066 s\u3068 s[i,n)\u306eLCP\u306e\u9577\u3055\u3092\u8fd4\u3059\n /// \n /// \n /// \n /// \n public static int[] ZAlgorithm(T[] s)\n {\n return ZAlgorithm(s, EqualityComparer.Default);\n }\n\n /// \n /// \u9577\u3055n\u306e\u6587\u5b57\u5217s\u306b\u3064\u3044\u3066 s\u3068 s[i,n)\u306eLCP\u306e\u9577\u3055\u3092\u8fd4\u3059\n /// \n /// \n /// \n /// \n public static int[] ZAlgorithm(string s)\n {\n return ZAlgorithm(s.ToCharArray());\n }\n\n #endregion\n }\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 // 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": "811a1cb0e40fc2f2a4a35f1648ffb03c", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "\ufeff// using a C# contest template, relevant code is at the bottom in the Run() function\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemB {\n static string inputFileName = \"../../input.txt\";\n static StreamReader fileReader;\n static string[] inputTokens;\n static int curInputTokenIndex;\n static bool isLocal = Type.GetType(\"HaitaoLocal\") != null;\n static string NextToken() {\n string ret = \"\";\n while (ret == \"\") {\n if (inputTokens == null || curInputTokenIndex >= inputTokens.Length) {\n string line;\n if (isLocal) {\n line = fileReader.ReadLine();\n if (line == null) {\n throw new Exception(\"Error: out of input tokens!\");\n }\n } else {\n line = Console.ReadLine();\n }\n inputTokens = line.Split();\n curInputTokenIndex = 0;\n }\n ret = inputTokens[curInputTokenIndex++];\n }\n return ret;\n }\n static int ri { get { return RI(); } }\n static string rs { get { return RS(); } }\n static long rl { get { return RL(); } }\n static double rd { get { return RD(); } }\n static int RI() {\n return Int32.Parse(NextToken());\n }\n static string RS() {\n return NextToken();\n }\n static long RL() {\n return Int64.Parse(NextToken());\n }\n static double RD() {\n return Double.Parse(NextToken());\n }\n static int[] RIA(int length) {\n int[] ret = new int[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RI();\n }\n return ret;\n }\n static string[] RSA(int length) {\n string[] ret = new string[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RS();\n }\n return ret;\n }\n static long[] RLA(int length) {\n long[] ret = new long[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RL();\n }\n return ret;\n }\n static double[] RDA(int length) {\n double[] ret = new double[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RD();\n }\n return ret;\n }\n static StringBuilder outputBuilder;\n static CultureInfo outputCulture = new CultureInfo(\"en-US\");\n static void Out(object obj) {\n Type type = obj.GetType();\n string str = obj.ToString();\n if (type == typeof(double) || type == typeof(float)) {\n str = ((double)obj).ToString(outputCulture);\n }\n outputBuilder.Append(str + \" \");\n }\n static void Outl() {\n Outl(\"\");\n }\n static void Outl(object obj) {\n Out(obj);\n outputBuilder.Append(\"\\n\");\n }\n static void Flush() {\n if (isLocal) {\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine();\n Console.WriteLine(outputBuilder.ToString());\n Console.ForegroundColor = t;\n } else {\n Console.WriteLine(outputBuilder.ToString());\n }\n outputBuilder = new StringBuilder();\n }\n static void Log(string label, object obj) {\n if (!isLocal) return;\n\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Gray;\n Console.Write(label + \": \");\n Console.ForegroundColor = t;\n Log(obj);\n }\n static void Log(object obj) {\n if (!isLocal) return;\n\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.White;\n Console.WriteLine(ToStringRecursive(obj));\n Console.ForegroundColor = t;\n }\n static string ToStringRecursive(object obj) {\n StringBuilder sb = new StringBuilder();\n if (!(obj is string) && (obj is System.Collections.IEnumerable)) {\n System.Collections.IEnumerable en = obj as System.Collections.IEnumerable;\n sb.Append(\"{\");\n bool first = true;\n foreach (object el in en) {\n if (!first) sb.Append(\", \");\n sb.Append(ToStringRecursive(el));\n first = false;\n }\n sb.Append(\"}\");\n return sb.ToString();\n }\n return obj.ToString();\n }\n\n public static void Main(string[] args) {\n long startTick = 0;\n if (isLocal) {\n startTick = Environment.TickCount;\n fileReader = new StreamReader(inputFileName);\n }\n\n outputBuilder = new StringBuilder();\n Run();\n if (isLocal) {\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine();\n Console.WriteLine(outputBuilder.ToString());\n Console.WriteLine();\n Console.ForegroundColor = t;\n } else {\n Console.WriteLine(outputBuilder.ToString());\n }\n\n if (isLocal) {\n long runTime = Environment.TickCount - startTick;\n if (runTime > 32) {\n Log(\"time\", runTime);\n Log(\"\");\n }\n }\n }\n\n\n\n static void Run() {\n while (true) {\n int N = ri;\n int M = ri;\n if (N == 0 && M == 0) break;\n List boxes = new List(M);\n for (int i = 0; i < M; i++) {\n Point p = new Point(ri, ri);\n boxes.Add(p);\n }\n List hull = GrahamScanCompute(boxes);\n\n foreach (Point p in hull) {\n Log(p.x + \" \" + p.y);\n }\n\n List ans = new List();\n int cx = hull[0].x;\n int cy = hull[0].y;\n ans.Add(new Point(cx, cy));\n int ci = 1;\n for (; ci < hull.Count; ci++) {\n Log(\"a \" + ci);\n int x = hull[ci].x;\n int y = hull[ci].y;\n if (y == cy) {\n if (x > cx + 1) {\n ans.Add(new Point(x - 1, y));\n }\n cx = x;\n cy = y;\n ci++;\n break;\n }\n cx = x;\n cy = y;\n ans.Add(new Point(x, y));\n }\n for (; ci < hull.Count; ci++) {\n Log(\"b \" + ci);\n int x = hull[ci].x;\n int y = hull[ci].y;\n if (x == cx) {\n if (y > cy + 1) {\n ans.Add(new Point(x - 1, y - 1));\n }\n cx = x;\n cy = y;\n ci++;\n break;\n }\n cx = x;\n cy = y;\n ans.Add(new Point(x - 1, y));\n }\n for (; ci < hull.Count; ci++) {\n Log(\"c \" + ci);\n int x = hull[ci].x;\n int y = hull[ci].y;\n if (y == cy) {\n if (x < cx - 1) {\n ans.Add(new Point(x, y - 1));\n }\n cx = x;\n cy = y;\n ci++;\n break;\n }\n cx = x;\n cy = y;\n ans.Add(new Point(x - 1, y - 1));\n }\n for (; ci < hull.Count; ci++) {\n Log(\"d \" + ci);\n int x = hull[ci].x;\n int y = hull[ci].y;\n if (x == cx) {\n if (y < cy - 1) {\n ans.Add(new Point(x, y));\n }\n cx = x;\n cy = y;\n ci++;\n break;\n }\n cx = x;\n cy = y;\n ans.Add(new Point(x, y - 1));\n }\n for (; ci < hull.Count; ci++) {\n Log(\"e \" + ci);\n int x = hull[ci].x;\n int y = hull[ci].y;\n cx = x;\n cy = y;\n ans.Add(new Point(x, y));\n }\n while (ans[ans.Count - 1].x == ans[0].x && ans[ans.Count - 1].y == ans[0].y) {\n ans.RemoveAt(ans.Count - 1);\n }\n\n\n Outl(ans.Count);\n foreach (Point p in ans) {\n Outl(p.x + \" \" + p.y);\n }\n }\n }\n\n // credit: http://stackoverflow.com/questions/25190164/graham-scan-issue-at-high-amount-of-points/25204997#25204997\n public static List GrahamScanCompute(IList initialPoints) {\n if (initialPoints.Count < 2)\n return initialPoints.ToList();\n\n // Find point with minimum y; if more than one, minimize x also.\n int iMin = Enumerable.Range(0, initialPoints.Count).Aggregate((jMin, jCur) => {\n if (initialPoints[jCur].y < initialPoints[jMin].y)\n return jCur;\n if (initialPoints[jCur].y > initialPoints[jMin].y)\n return jMin;\n if (initialPoints[jCur].x < initialPoints[jMin].x)\n return jCur;\n return jMin;\n });\n // Sort them by polar angle from iMin, \n var sortQuery = Enumerable.Range(0, initialPoints.Count)\n .Where((i) => (i != iMin)) // Skip the min point\n .Select((i) => new KeyValuePair(Math.Atan2(initialPoints[i].y - initialPoints[iMin].y, initialPoints[i].x - initialPoints[iMin].x), initialPoints[i]))\n .OrderBy((pair) => pair.Key)\n .Select((pair) => pair.Value);\n List points = new List(initialPoints.Count);\n points.Add(initialPoints[iMin]); // Add minimum point\n points.AddRange(sortQuery); // Add the sorted points.\n\n int M = 0;\n for (int i = 1, N = points.Count; i < N; i++) {\n bool keepNewPoint = true;\n if (M == 0) {\n // Find at least one point not coincident with points[0]\n keepNewPoint = !NearlyEqual(points[0], points[i]);\n } else {\n while (true) {\n var flag = WhichToRemoveFromBoundary(points[M - 1], points[M], points[i]);\n if (flag == RemovalFlag.None)\n break;\n else if (flag == RemovalFlag.MidPoint) {\n if (M > 0)\n M--;\n if (M == 0)\n break;\n } else if (flag == RemovalFlag.EndPoint) {\n keepNewPoint = false;\n break;\n } else\n throw new Exception(\"Unknown RemovalFlag\");\n }\n }\n if (keepNewPoint) {\n M++;\n Swap(points, M, i);\n }\n }\n // points[M] is now the last point in the boundary. Remove the remainder.\n points.RemoveRange(M + 1, points.Count - M - 1);\n return points;\n }\n\n static void Swap(IList list, int i, int j) {\n if (i != j) {\n T temp = list[i];\n list[i] = list[j];\n list[j] = temp;\n }\n }\n\n public static double RelativeTolerance { get { return 1e-10; } }\n\n public static bool NearlyEqual(Point a, Point b) {\n return NearlyEqual(a.x, b.x) && NearlyEqual(a.y, b.y);\n }\n\n public static bool NearlyEqual(double a, double b) {\n return NearlyEqual(a, b, RelativeTolerance);\n }\n\n public static bool NearlyEqual(double a, double b, double epsilon) {\n // See here: http://floating-point-gui.de/errors/comparison/\n if (a == b) { // shortcut, handles infinities\n return true;\n }\n\n double absA = Math.Abs(a);\n double absB = Math.Abs(b);\n double diff = Math.Abs(a - b);\n double sum = absA + absB;\n if (diff < 4 * double.Epsilon || sum < 4 * double.Epsilon)\n // a or b is zero or both are extremely close to it\n // relative error is less meaningful here\n return true;\n\n // use relative error\n return diff / (absA + absB) < epsilon;\n }\n\n static double CCW(Point p1, Point p2, Point p3) {\n // Compute (p2 - p1) X (p3 - p1)\n double cross1 = (p2.x - p1.x) * (p3.y - p1.y);\n double cross2 = (p2.y - p1.y) * (p3.x - p1.x);\n if (NearlyEqual(cross1, cross2))\n return 0;\n return cross1 - cross2;\n }\n\n enum RemovalFlag {\n None,\n MidPoint,\n EndPoint\n };\n\n static RemovalFlag WhichToRemoveFromBoundary(Point p1, Point p2, Point p3) {\n var cross = CCW(p1, p2, p3);\n if (cross < 0)\n // Remove p2\n return RemovalFlag.MidPoint;\n if (cross > 0)\n // Remove none.\n return RemovalFlag.None;\n // Check for being reversed using the dot product off the difference vectors.\n var dotp = (p3.x - p2.x) * (p2.x - p1.x) + (p3.y - p2.y) * (p2.y - p1.y);\n if (NearlyEqual(dotp, 0.0))\n // Remove p2\n return RemovalFlag.MidPoint;\n if (dotp < 0)\n // Remove p3\n return RemovalFlag.EndPoint;\n else\n // Remove p2\n return RemovalFlag.MidPoint;\n }\n}\n\nclass Point {\n public int x;\n public int y;\n public Point(int X, int Y) {\n this.y = X;\n this.x = Y;\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c55ac6d55f1d85e9554e3b0f66b385e6", "src_uid": "5e1847193148c4e6a998c61f8db61670", "difficulty": 2600.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-1]-b[i] > 1 || 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": "ef8c5a213b88dfc83b8092345ac4e863", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Heidi_and_Library__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 = Next();\n int k = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n var near = new int[n];\n var last = new int[n + 1];\n\n for (int i = 0; i < last.Length; i++)\n {\n last[i] = n;\n }\n\n for (int i = n - 1; i >= 0; i--)\n {\n near[i] = last[nn[i]];\n last[nn[i]] = i;\n }\n\n int count = 0;\n var heap = new MaxBinaryHeapObject(new Point());\n var f = new bool[n + 1];\n for (int i = 0; i < nn.Length; i++)\n {\n if (k <= 0 && !f[nn[i]])\n {\n remove:\n var t = heap.GetMax();\n if (!f[t.index])\n {\n goto remove;\n }\n\n f[t.index] = false;\n }\n\n if (!f[nn[i]])\n {\n count++;\n f[nn[i]] = true;\n k--;\n }\n heap.Add(new Point {index = nn[i], near = near[i]});\n }\n\n writer.WriteLine(count);\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 #region Nested type: MaxBinaryHeapObject\n\n public class MaxBinaryHeapObject\n {\n private readonly IComparer _comparer;\n private readonly List _list;\n\n public MaxBinaryHeapObject(IComparer comparer)\n {\n _comparer = comparer ?? Comparer.Default;\n _list = new List();\n }\n\n public int HeapSize\n {\n get { return _list.Count; }\n }\n\n public void Add(T value)\n {\n _list.Add(value);\n int i = HeapSize - 1;\n int parent = (i - 1)/2;\n\n while (i > 0 && _comparer.Compare(_list[parent], _list[i]) == -1)\n {\n T temp = _list[i];\n _list[i] = _list[parent];\n _list[parent] = temp;\n\n i = parent;\n parent = (i - 1)/2;\n }\n }\n\n public void Heapify(int i)\n {\n for (;;)\n {\n int leftChild = 2*i + 1;\n int rightChild = 2*i + 2;\n int largestChild = i;\n\n if (leftChild < HeapSize && _comparer.Compare(_list[leftChild], _list[largestChild]) == 1)\n {\n largestChild = leftChild;\n }\n\n if (rightChild < HeapSize && _comparer.Compare(_list[rightChild], _list[largestChild]) == 1)\n {\n largestChild = rightChild;\n }\n\n if (largestChild == i)\n {\n break;\n }\n\n T temp = _list[i];\n _list[i] = _list[largestChild];\n _list[largestChild] = temp;\n i = largestChild;\n }\n }\n\n public T Max()\n {\n return _list[0];\n }\n\n public T GetMax()\n {\n T result = _list[0];\n _list[0] = _list[HeapSize - 1];\n _list.RemoveAt(HeapSize - 1);\n Heapify(0);\n return result;\n }\n }\n\n #endregion\n\n #region Nested type: Point\n\n private class Point : IComparer\n {\n public int index;\n public int near;\n\n #region IComparer Members\n\n public int Compare(Point x, Point y)\n {\n return x.near.CompareTo(y.near);\n }\n\n #endregion\n }\n\n #endregion\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d0cfc4f547ba323ce0daa60a01d0de70", "src_uid": "956228e31679caa9952b216e010f9773", "difficulty": 1800.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 int n = ReadInt();\n int k = ReadInt();\n int[] a = ReadIntArray();\n\n Queue[] queues = new Queue[n + 1];\n for (int i = 0; i < n + 1; i++)\n {\n queues[i] = new Queue();\n }\n for (int i = 0; i < n; i++)\n {\n queues[a[i]].Enqueue(i);\n }\n\n int ans = 0;\n RedBlackTree tree = new RedBlackTree();\n RedBlackNode[] nodes = new RedBlackNode[n + 1];\n for (int i = 0; i < n; i++)\n {\n int book = a[i];\n\n queues[book].Dequeue();\n int nextTime = int.MaxValue;\n if (queues[book].Count > 0)\n {\n nextTime = queues[book].Peek();\n }\n\n var current = nodes[book];\n if (current == null)\n {\n if (tree.Count == k)\n {\n var max = tree.Maximum();\n tree.Delete(max);\n nodes[max.Value] = null;\n }\n nodes[book] = new RedBlackNode(nextTime, book);\n tree.Insert(nodes[book]);\n ans++;\n }\n else\n {\n tree.Delete(current);\n nodes[book] = new RedBlackNode(nextTime, book);\n tree.Insert(nodes[book]);\n }\n }\n\n Writer.WriteLine(ans);\n }\n\n /*public class Book\n {\n public int Id;\n\n public int Key;\n }*/\n\n public class RedBlackTree\n {\n private readonly RedBlackNode NULL = new RedBlackNode(0, default(T));\n\n public RedBlackNode Root { get; set; }\n\n public int Count { get; private set; }\n\n public RedBlackTree()\n {\n Root = NULL;\n }\n\n public List> InorderTreeWalk()\n {\n List> nodes = new List>();\n InorderTreeWalk(Root, nodes);\n return nodes;\n }\n\n public void InorderTreeWalk(RedBlackNode node, List> nodes)\n {\n if (node != NULL)\n {\n InorderTreeWalk(node.Left, nodes);\n nodes.Add(node);\n InorderTreeWalk(node.Right, nodes);\n }\n }\n\n public RedBlackNode Search(int key)\n {\n RedBlackNode node = Search(Root, key);\n return node == NULL ? null : node;\n }\n\n public RedBlackNode Search(RedBlackNode node, int key)\n {\n while (node != NULL && node.Key != key)\n {\n node = key < node.Key ? node.Left : node.Right;\n }\n return node;\n }\n\n public RedBlackNode Minimum()\n {\n RedBlackNode node = Minimum(Root);\n return node == NULL ? null : node;\n }\n\n public RedBlackNode Minimum(RedBlackNode node)\n {\n while (node != NULL && node.Left != NULL)\n {\n node = node.Left;\n }\n return node;\n }\n\n public RedBlackNode Maximum()\n {\n RedBlackNode node = Maximum(Root);\n return node == NULL ? null : node;\n }\n\n public RedBlackNode Maximum(RedBlackNode node)\n {\n while (node != NULL && node.Right != NULL)\n {\n node = node.Right;\n }\n return node;\n }\n\n public RedBlackNode Successor(RedBlackNode node)\n {\n if (node.Right != NULL)\n {\n return Minimum(node.Right);\n }\n RedBlackNode parent = node.Parent;\n while (parent != NULL && node == parent.Right)\n {\n node = parent;\n parent = node.Parent;\n }\n return parent;\n }\n\n public RedBlackNode Predecessor(RedBlackNode node)\n {\n if (node.Left != NULL)\n {\n return Maximum(node.Left);\n }\n RedBlackNode parent = node.Parent;\n while (parent != NULL && node == parent.Left)\n {\n node = parent;\n parent = node.Parent;\n }\n return parent;\n }\n\n public void Insert(int key, T value)\n {\n Insert(new RedBlackNode(key, value));\n }\n\n public void Insert(RedBlackNode newNode)\n {\n RedBlackNode parent = NULL;\n RedBlackNode node = Root;\n while (node != NULL)\n {\n parent = node;\n node = newNode.Key < node.Key ? node.Left : node.Right;\n }\n newNode.Parent = parent;\n if (parent == NULL)\n {\n Root = newNode;\n }\n else if (newNode.Key < parent.Key)\n {\n parent.Left = newNode;\n }\n else\n {\n parent.Right = newNode;\n }\n newNode.Left = NULL;\n newNode.Right = NULL;\n newNode.Color = Color.Red;\n RedBlackInsertFixup(newNode);\n\n Count++;\n }\n\n private void RedBlackInsertFixup(RedBlackNode z)\n {\n while (z.Parent.Color == Color.Red)\n {\n if (z.Parent == z.Parent.Parent.Left)\n {\n var y = z.Parent.Parent.Right;\n if (y.Color == Color.Red)\n {\n z.Parent.Color = Color.Black;\n y.Color = Color.Black;\n z.Parent.Parent.Color = Color.Red;\n z = z.Parent.Parent;\n }\n else\n {\n if (z == z.Parent.Right)\n {\n z = z.Parent;\n LeftRotate(z);\n }\n z.Parent.Color = Color.Black;\n z.Parent.Parent.Color = Color.Red;\n RightRotate(z.Parent.Parent);\n }\n }\n else\n {\n var y = z.Parent.Parent.Left;\n if (y.Color == Color.Red)\n {\n z.Parent.Color = Color.Black;\n y.Color = Color.Black;\n z.Parent.Parent.Color = Color.Red;\n z = z.Parent.Parent;\n }\n else\n {\n if (z == z.Parent.Left)\n {\n z = z.Parent;\n RightRotate(z);\n }\n z.Parent.Color = Color.Black;\n z.Parent.Parent.Color = Color.Red;\n LeftRotate(z.Parent.Parent);\n }\n }\n }\n Root.Color = Color.Black;\n }\n\n private void LeftRotate(RedBlackNode x)\n {\n RedBlackNode y = x.Right;\n x.Right = y.Left;\n if (y.Left != NULL)\n {\n y.Left.Parent = x;\n }\n y.Parent = x.Parent;\n if (x.Parent == NULL)\n {\n Root = y;\n }\n else if (x == x.Parent.Left)\n {\n x.Parent.Left = y;\n }\n else\n {\n x.Parent.Right = y;\n }\n y.Left = x;\n x.Parent = y;\n }\n\n private void RightRotate(RedBlackNode x)\n {\n RedBlackNode y = x.Left;\n x.Left = y.Right;\n if (y.Right != NULL)\n {\n y.Right.Parent = x;\n }\n y.Parent = x.Parent;\n if (x.Parent == NULL)\n {\n Root = y;\n }\n else if (x == x.Parent.Right)\n {\n x.Parent.Right = y;\n }\n else\n {\n x.Parent.Left = y;\n }\n y.Right = x;\n x.Parent = y;\n }\n\n public void Delete(int key)\n {\n RedBlackNode node = Search(key);\n if (node != NULL && node != null)\n {\n Delete(node);\n }\n }\n\n public void Delete(RedBlackNode z)\n {\n var y = z;\n var yOriginalColor = y.Color;\n RedBlackNode x;\n if (z.Left == NULL)\n {\n x = z.Right;\n Transplant(z, z.Right);\n }\n else if (z.Right == NULL)\n {\n x = z.Left;\n Transplant(z, z.Left);\n }\n else\n {\n y = Minimum(z.Right);\n yOriginalColor = y.Color;\n x = y.Right;\n if (y.Parent == z)\n {\n x.Parent = y;\n }\n else\n {\n Transplant(y, y.Right);\n y.Right = z.Right;\n y.Right.Parent = y;\n }\n Transplant(z, y);\n y.Left = z.Left;\n y.Left.Parent = y;\n y.Color = z.Color;\n }\n if (yOriginalColor == Color.Black)\n {\n DeleteFixup(x);\n }\n\n Count--;\n }\n\n private void DeleteFixup(RedBlackNode x)\n {\n while (x != Root && x.Color == Color.Black)\n {\n if (x == x.Parent.Left)\n {\n var w = x.Parent.Right;\n if (w.Color == Color.Red)\n {\n w.Color = Color.Black;\n x.Parent.Color = Color.Red;\n LeftRotate(x.Parent);\n w = x.Parent.Right;\n }\n if (w.Left.Color == Color.Black && w.Right.Color == Color.Black)\n {\n w.Color = Color.Red;\n x = x.Parent;\n }\n else\n {\n if (w.Right.Color == Color.Black)\n {\n w.Left.Color = Color.Black;\n w.Color = Color.Red;\n RightRotate(w);\n w = x.Parent.Right;\n }\n w.Color = x.Parent.Color;\n x.Parent.Color = Color.Black;\n w.Right.Color = Color.Black;\n LeftRotate(x.Parent);\n x = Root;\n }\n }\n else\n {\n var w = x.Parent.Left;\n if (w.Color == Color.Red)\n {\n w.Color = Color.Black;\n x.Parent.Color = Color.Red;\n RightRotate(x.Parent);\n w = x.Parent.Left;\n }\n if (w.Right.Color == Color.Black && w.Left.Color == Color.Black)\n {\n w.Color = Color.Red;\n x = x.Parent;\n }\n else\n {\n if (w.Left.Color == Color.Black)\n {\n w.Right.Color = Color.Black;\n w.Color = Color.Red;\n LeftRotate(w);\n w = x.Parent.Left;\n }\n w.Color = x.Parent.Color;\n x.Parent.Color = Color.Black;\n w.Left.Color = Color.Black;\n RightRotate(x.Parent);\n x = Root;\n }\n }\n }\n x.Color = Color.Black;\n }\n\n private void Transplant(RedBlackNode u, RedBlackNode v)\n {\n if (u.Parent == NULL)\n {\n Root = v;\n }\n else if (u == u.Parent.Left)\n {\n u.Parent.Left = v;\n }\n else\n {\n u.Parent.Right = v;\n }\n\n v.Parent = u.Parent;\n }\n\n private int? BlackHeight;\n\n public void Validate()\n {\n BlackHeight = null;\n if (Root.Color != Color.Black)\n {\n throw new InvalidOperationException(\"Root is not black.\");\n }\n Validate(Root, 0);\n }\n\n private void Validate(RedBlackNode node, int height)\n {\n if (node == NULL)\n {\n if (BlackHeight == null)\n {\n BlackHeight = height;\n }\n else\n {\n if (BlackHeight != height)\n {\n string message = string.Format(\"Black heights are not equal: {0} and {1}.\", BlackHeight, height);\n throw new InvalidOperationException(message);\n }\n }\n return;\n }\n\n if (node.Color == Color.Black)\n {\n height++;\n }\n else\n {\n if (node.Left.Color != Color.Black || node.Right.Color != Color.Black)\n {\n throw new InvalidOperationException(\"Children of red node are not black.\");\n }\n }\n\n Validate(node.Left, height);\n Validate(node.Right, height);\n }\n }\n\n public class RedBlackNode\n {\n public RedBlackNode(int key, T value)\n {\n Key = key;\n Value = value;\n }\n\n public int Key { get; set; }\n\n public T Value { get; set; }\n\n public RedBlackNode Parent { get; set; }\n\n public RedBlackNode Left { get; set; }\n\n public RedBlackNode Right { get; set; }\n\n public bool Color { get; set; }\n }\n\n public class Color\n {\n public const bool Red = true;\n\n public const bool Black = false;\n }\n\n public static void Solve()\n {\n //int T = ReadInt();\n //for (int i = 0; i < T; i++)\n {\n //Writer.Write(\"Case #{0}: \", i + 1);\n SolveCase();\n }\n }\n\n public 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": "38935556547f255d72eaff3917fd42f5", "src_uid": "956228e31679caa9952b216e010f9773", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections;\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 void Solve()\n\t\t{\n\t\t\tvar n = cin.NextInt();\n\t\t\tvar k = cin.NextInt();\n\t\t\tvar a = new int[n];\n\t\t\tvar pos = new Queue[n + 10];\n\t\t\tfor (var i = 0; i < pos.Length; i++)\n\t\t\t{\n\t\t\t\tpos[i] = new Queue();\n\t\t\t}\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\ta[i] = cin.NextInt();\n\t\t\t\tpos[a[i]].Enqueue(i);\n\t\t\t}\n\t\t\tvar have = new HashSet();\n\t\t\tvar timesNeeded = new SortedDictionary();\n\t\t\tvar res = 0;\n\t\t\tfor (var i = 0; i < a.Length; i++)\n\t\t\t{\n\t\t\t\tif (!have.Contains(a[i]))\n\t\t\t\t{\n\t\t\t\t\tif (have.Count == k)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar first = timesNeeded.First();\n\t\t\t\t\t\ttimesNeeded.Remove(first.Key);\n\t\t\t\t\t\thave.Remove(first.Value);\n\t\t\t\t\t}\n\t\t\t\t\thave.Add(a[i]);\n\t\t\t\t\tif (i != pos[a[i]].Peek())\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new AccessViolationException();\n\t\t\t\t\t}\n\t\t\t\t\tpos[a[i]].Dequeue();\n\t\t\t\t\tif (!pos[a[i]].Any())\n\t\t\t\t\t{\n\t\t\t\t\t\ttimesNeeded.Add(-1000000000 + i, a[i]);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\ttimesNeeded.Add(-pos[a[i]].Peek(), a[i]);\n\t\t\t\t\t}\n\t\t\t\t\tres++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvar p = pos[a[i]].Dequeue();\n\t\t\t\t\ttimesNeeded.Remove(-p);\n\t\t\t\t\tif (!pos[a[i]].Any())\n\t\t\t\t\t{\n\t\t\t\t\t\ttimesNeeded.Add(-1000000000 + i, a[i]);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\ttimesNeeded.Add(-pos[a[i]].Peek(), a[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(res);\n\t\t}\n\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n#if DEBUG\n\t\t\tvar inputText = File.ReadAllText(@\"..\\..\\input.txt\");\n\t\t\tvar testCases = inputText.Split(new[] { \"input\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tvar consoleOut = Console.Out;\n\t\t\tfor (var i = 0; i < testCases.Length; i++)\n\t\t\t{\n\t\t\t\tvar parts = testCases[i].Split(new[] { \"output\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\t\tConsole.SetIn(new StringReader(parts[0].Trim()));\n\t\t\t\tvar stringWriter = new StringWriter();\n\t\t\t\tConsole.SetOut(stringWriter);\n\t\t\t\tvar sw = Stopwatch.StartNew();\n\t\t\t\tnew Template().Solve();\n\t\t\t\tsw.Stop();\n\t\t\t\tvar output = stringWriter.ToString();\n\n\t\t\t\tConsole.SetOut(consoleOut);\n\t\t\t\tvar color = ConsoleColor.Green;\n\t\t\t\tvar status = \"Passed\";\n\t\t\t\tif (parts[1].Trim() != output.Trim())\n\t\t\t\t{\n\t\t\t\t\tcolor = ConsoleColor.Red;\n\t\t\t\t\tstatus = \"Failed\";\n\t\t\t\t}\n\t\t\t\tConsole.ForegroundColor = color;\n\t\t\t\tConsole.WriteLine(\"Test {0} {1} in {2}ms\", i + 1, status, sw.ElapsedMilliseconds);\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t\tConsole.ReadKey();\n#else\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = { ' ' };\n\n\t\tpublic string NextString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(NextString());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(NextString());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(NextString());\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ff237961ccb6a349c6d855d55e1aea55", "src_uid": "956228e31679caa9952b216e010f9773", "difficulty": 1800.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;\n//using System.Numerics;\nusing Number = System.Int64;\nusing static System.Math;\n//using static MathEx;\n//using P = System.Collections.Generic.KeyValuePair;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = ri;\n var k = ri;\n var a = Enumerate(n, x => ri - 1);\n var last = Enumerate(n, x => n + 1);\n var next = new int[n];\n for (int i = n - 1; i >= 0; i--)\n {\n next[i] = last[a[i]];\n last[a[i]] = i;\n }\n var cnt = 0;\n Debug.WriteLine(next.AsJoinedString());\n var s = new SortedSet();\n var pq = new SortedSet();\n for (int i = 0; i < n; i++)\n {\n Debug.WriteLine(s.AsJoinedString());\n if (s.Add(a[i]))\n {\n cnt++;\n pq.Add(next[i] * 1000000L + a[i]);\n if (s.Count > k)\n {\n var ma = pq.Max;\n pq.Remove(ma);\n s.Remove(ma % 1000000L);\n }\n }\n }\n IO.Printer.Out.WriteLine(cnt);\n\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 //*/\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static T[] Enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f(i);\n return a;\n }\n static void Swap(ref T a, ref T b)\n {\n var tmp = a;\n a = b;\n b = tmp;\n }\n }\n}\n\n#region main\n\nstatic class Ex\n{\n public static string AsString(this IEnumerable ie)\n {\n return new string(ie.ToArray());\n }\n\n public static string AsJoinedString(this IEnumerable ie, string st = \" \")\n {\n return string.Join(st, ie);\n }\n\n public static void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n\n#endregion\n#region Ex\n\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer: StreamWriter\n {\n static Printer()\n {\n Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };\n }\n\n public static Printer Out { get; set; }\n\n public override IFormatProvider FormatProvider\n {\n get { return CultureInfo.InvariantCulture; }\n }\n\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true))\n {\n }\n\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding)\n {\n }\n\n public void Write(string format, T[] source)\n {\n base.Write(format, source.OfType().ToArray());\n }\n\n public void WriteLine(string format, T[] source)\n {\n base.WriteLine(format, source.OfType().ToArray());\n }\n }\n\n public class StreamScanner\n {\n public StreamScanner(Stream stream)\n {\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;\n\n public bool IsEndOfStream\n {\n get { return isEof; }\n }\n\n private byte read()\n {\n if (isEof) return 0;\n if (ptr < len) return buf[ptr++];\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) > 0) return buf[ptr++];\n isEof = true;\n return 0;\n }\n\n public char Char()\n {\n byte b;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\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\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\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0;\n byte b;\n var ng = false;\n do b = read(); while (b != 0 && b != '-' && (b < '0' || '9' < b));\n if (b == 0) return long.MinValue;\n if (b == '-')\n {\n ng = true;\n b = read();\n }\n for (; ; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n ret = ret * 10 + b - '0';\n }\n }\n\n public int Integer()\n {\n return (isEof) ? int.MinValue : (int)Long();\n }\n\n public double Double()\n {\n var s = Scan();\n return s != \"\" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN;\n }\n\n static T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n)\n {\n return enumerate(n, Char);\n }\n\n public string[] Scan(int n)\n {\n return enumerate(n, Scan);\n }\n\n public double[] Double(int n)\n {\n return enumerate(n, Double);\n }\n\n public int[] Integer(int n)\n {\n return enumerate(n, Integer);\n }\n\n public long[] Long(int n)\n {\n return enumerate(n, Long);\n }\n }\n}\n\n#endregion\n\n#region BinaryHeap\npublic class PriorityQueue\n{\n readonly List heap = new List();\n readonly IComparer cmp;\n public PriorityQueue() { cmp = Comparer.Default; }\n public PriorityQueue(Comparison f) { cmp = Comparer.Create(f); }\n public PriorityQueue(IComparer c) { cmp = c; }\n public void Enqueue(T item)\n {\n\n var i = heap.Count;\n heap.Add(item);\n while (i > 0)\n {\n var p = (i - 1) / 2;\n if (cmp.Compare(heap[p], item) <= 0)\n break;\n heap[i] = heap[p];\n i = p;\n }\n heap[i] = item;\n\n }\n public T Dequeue()\n {\n var ret = heap[0];\n var i = 0;\n var x = heap[heap.Count - 1];\n\n while ((i * 2) + 1 < heap.Count - 1)\n {\n var a = i * 2 + 1;\n var b = i * 2 + 2;\n if (b < heap.Count - 1 && cmp.Compare(heap[b], heap[a]) < 0) a = b;\n if (cmp.Compare(heap[a], x) >= 0)\n break;\n heap[i] = heap[a];\n i = a;\n }\n heap[i] = x;\n heap.RemoveAt(heap.Count - 1);\n return ret;\n\n }\n public T Peek() { return heap[0]; }\n public int Count { get { return heap.Count; } }\n public bool Any() { return heap.Count > 0; }\n public T[] Items\n {\n get\n {\n var ret = heap.ToArray();\n Array.Sort(ret, cmp);\n return ret;\n }\n }\n}\n#endregion\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d33e9cd60b547f82b926896371ba0a9f", "src_uid": "956228e31679caa9952b216e010f9773", "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 public void Solve()\n {\n int n = 11;\n var a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n\n double res = 0;\n for (int i = n - 1; i >= 0; i--)\n {\n res = Math.Sqrt(Math.Abs(a[i])) + Math.Pow(a[i], 3) * 5; \n writer.Write(\"f({0}) = \", a[i]);\n if (res > 400)\n Write(\"MAGNA NIMIS!\");\n else\n Write(string.Format(\"{0:0.00}\", res));\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]; } 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": "7017c5c6c37cb1b24e9734ddd457f259", "src_uid": "30b3411c3c23d029ea1e9cf73e7d2f01", "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.Text.RegularExpressions;\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 ans = 0;\n for (int i = 0; i < n - 2; i++)\n {\n ans += (i + 2) * (i + 3);\n }\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.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": "741848fd55a427b1282273b25f11e11f", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "difficulty": 1200.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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1681947021fc170db8721cab28aad3ca", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "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;\n\npublic class Solver\n{\n public object Solve()\n {\n int n = ReadInt();\n ReadInt();\n ReadInt();\n var a = new HashSet(ReadIntArray());\n\n WriteArray(Enumerable.Range(1, n).Select(i => a.Contains(i) ? 1 : 2));\n\n return null;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n writer = Console.Out;\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n }\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 if (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "87d78124ce60422e418697f65eef7f68", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "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 Hom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string inp;\n int n, a, b;\n int j = 0, z = 0;\n List L = new List();\n inp = Console.ReadLine();\n string[] smas = inp.Split(' ');\n n = Convert.ToInt32(smas[0]);\n a = Convert.ToInt32(smas[1]);\n b = Convert.ToInt32(smas[2]);\n inp = Console.ReadLine();\n string[] smasA = inp.Split(' ');\n inp = Console.ReadLine();\n string[] smasB = inp.Split(' ');\n for (int i = 0; i < n; i++)\n {\n L.Add(2);\n for(j=0; j primes = new List() {\n 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,\n 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,\n 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293,\n 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397\n };\n int a = Convert.ToInt32(Console.ReadLine());\n\n for (int i = 0; i < primes.Count; i++)\n {\n if (a % primes[i] == 0 && a != primes[i])\n {\n Console.WriteLine(primes[i].ToString() + (a / primes[i]).ToString());\n break;\n }\n }\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "115c9b0cc219e18ff41da8f34f2f0227", "src_uid": "7220f2da5081547a12118595bbeda4f6", "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\tfor(var i = (int)Math.Sqrt(x); i>=2; i--)\n\t\t{\n\t\t\tvar y = x%i;\n\t\t\tif(y == 0)\n\t\t\t{\n\t\t\t\tConsole.Write(i);\n\t\t\t\tConsole.WriteLine(x/i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a641fb4b5cc967ddcbd3289ed03196c", "src_uid": "7220f2da5081547a12118595bbeda4f6", "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 buf = \"1111111111\";\n int a = Convert.ToInt32(Console.ReadLine());\n for (int i = 2; i < a; i++)\n for (int j = 1; j < a; j++)\n {\n if (i * j == a) {\n buf = j.ToString() + i.ToString();\n } \n }\n Console.WriteLine(buf);\n Console.Read();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8124e595d41b501f0e9009599e39376", "src_uid": "7220f2da5081547a12118595bbeda4f6", "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 int a = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(\"1\" + a);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b599ffc8298d17b3277b0967f099de42", "src_uid": "7220f2da5081547a12118595bbeda4f6", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace DailyCP\n{\n class cc\n {\n public static void Main()\n {\n List primes = new List() {\n 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,\n 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,\n 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293,\n 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397\n };\n // int t = Convert.ToInt32(Console.ReadLine());\n //for (int T = 0; T < t; T++)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n\n for (int i = 0; i < primes.Count; i++)\n {\n if(a % primes[i] == 0 && primes.Contains(a/primes[i]))\n {\n Console.WriteLine(primes[i].ToString() + (a / primes[i]).ToString());\n break;\n }\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8e8adef9d9e970e5d1fea266f5a8a759", "src_uid": "7220f2da5081547a12118595bbeda4f6", "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 str = \"1111111111\", buf = \"1111111111\";\n int a = Convert.ToInt32(Console.ReadLine());\n for (int i = 1; i <= a; i++)\n for (int j = 1; j <= a; j++)\n {\n if (i * j == a)\n str = i.ToString() + j.ToString();\n if (buf.Length > str.Length)\n buf = str;\n }\n Console.WriteLine(buf);\n Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2afc76947bfa71b3f8d89c3081d4b88f", "src_uid": "7220f2da5081547a12118595bbeda4f6", "difficulty": null} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Calendar\n{\n class Program\n {\n static void Main(string[] args)\n {\n int v = 3200;\n long a,n,j,i,p,an,k;\n long[] kv = new long[v+1];\n long[] my = new long [1000001];\n string s;\n string[] ss;\n\n s = Console.ReadLine();\n ss = s.Split();\n a = Convert.ToInt32(ss[0]);\n n = Convert.ToInt32(ss[1]);\n // a:=1;\n // n := 9;\n p = 0;\n an = a + n - 1;\n\n for (i = 1; i <= v; i++) kv[i] = i*i;\n\n for (i = a; i <= an; i++) my[i] = 1;\n\n for (i = 2; i <= v; i++)\n {\n\n for (j = 1; j <= v; j++)\n {\n k = kv[i] * j;\n if (k < a) continue;\n if (k > an) break;\n my[k] = kv[i];\n }\n }\n\n for (i = a; i <= an; i++) p = p + i/my[i];\n\n\n Console.WriteLine(p); \n \n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b12db67d62c171bfd57711f24f9ece25", "src_uid": "915081861e391958dce6ee2a117abd4e", "difficulty": 1500.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 int[] squares;\n private static void Solve()\n {\n var input = ReadIntArray();\n var a = input[0];\n var n = input[1];\n\n squares = new int[10000001];\n for (int i = 3162; i >=1; i--)\n {\n var sq = i*i;\n for (int j = 1; j*sq <= 10000000; j++)\n {\n var index = sq*j;\n if(squares[index] == 0)\n squares[index] = sq;\n }\n }\n\n var dp = new long[a + n];\n for (int i = 1; i < a + n; i++)\n {\n dp[i] = dp[i-1] + GetCounts(i);\n }\n var res = dp[a + n - 1] - dp[a - 1];\n Console.WriteLine(res);\n }\n\n private static int GetCounts(int n)\n {\n if (n == 0)\n return 0;\n\n if (squares[n] == 0)\n return n;\n\n var res = n/squares[n];\n return 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": "8a95fca9849b447edce4ac05246e46cf", "src_uid": "915081861e391958dce6ee2a117abd4e", "difficulty": 1500.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 public class Student\n {\n public int t;\n public int x;\n public int n;\n\n public Student(int t, int x, int n)\n {\n this.t = t;\n this.x = x;\n this.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(\"triangles.in\");\n StreamWriter sw = new StreamWriter(\"triangles.out\");\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 string[] input = new string[n];\n for (int i = 0; i < n; i++)\n input[i] = ReadLine();\n\n int ans = 0;\n for (int i = 0; i < input[0].Length; i++)\n {\n char cur = input[0][i];\n for (int j = 0; j < n; j++)\n {\n if (input[j][i] != cur)\n {\n Console.WriteLine(ans);\n return;\n }\n }\n ans++;\n }\n Console.WriteLine(ans);\n\n }\n\n static void B()\n {\n int a, b, m, r0;\n string[] input = ReadArray();\n a = int.Parse(input[0]);\n b = int.Parse(input[1]);\n m = int.Parse(input[2]);\n r0 = int.Parse(input[3]);\n int[] u = new int[m];\n for (int i = 0; i < m; i++)\n u[i] = -1;\n int cur = 0;\n int r;\n while (true)\n {\n r = (a * r0 + b) % m;\n if (u[r] >= 0)\n {\n Console.WriteLine(cur - u[r]);\n return;\n }\n r0 = r;\n u[r] = cur;\n cur++;\n }\n }\n\n static int CompareByTime(Student x, Student y)\n {\n if (x.t < y.t) return -1;\n if (x.t > y.t) return 1;\n return 0;\n }\n\n static int CompareByExit(Student x, Student y)\n {\n if (x.x < y.x) return -1;\n if (x.x > y.x) return 1;\n return 0;\n }\n\n static void C()\n {\n int n, m;\n string[] input = ReadArray();\n n = int.Parse(input[0]);\n m = int.Parse(input[1]);\n Student[] s = new Student[n];\n for (int i = 0; i < n; i++)\n {\n input = ReadArray();\n s[i] = new Student(int.Parse(input[0]), int.Parse(input[1]), i);\n }\n Student[] l = new Student[n];\n Student[] r = new Student[n];\n ArrayUtils.Merge_Sort(s, 0, n - 1, l, r, CompareByTime);\n int[] ans = new int[n];\n int t = 0;\n for (int i = 0; i < n; )\n {\n t += (t >= s[i + m <= n ? i + m - 1 : n - 1].t ? 0 : s[i + m <= n ? i + m - 1 : n - 1].t - t);\n ArrayUtils.Merge_Sort(s, i, (i + m <= n ? i + m - 1 : n - 1), l, r, CompareByExit);\n int last = 0;\n for (int j = 0; j < m && i + j < n; )\n {\n int cur = s[i + j].x;\n t += cur - last;\n int cnt = 0;\n while (j < m && i + j < n && cur == s[i + j].x)\n {\n cnt++;\n ans[s[i + j].n] = t;\n j++;\n }\n t += 1 + cnt / 2;\n last = cur;\n }\n i = (i + m <= n ? i + m : n);\n t += s[i - 1].x;\n }\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < n; i++)\n sb.Append(ans[i] + \" \");\n Console.WriteLine(sb);\n }\n\n static void D()\n {\n int a, n;\n string[] input = ReadArray();\n a = int.Parse(input[0]);\n n = int.Parse(input[1]);\n int sqrt = (int)Math.Sqrt(a + n - 1);\n int[] t = new int[a + n];\n for (int i = sqrt; i >= 1; i--)\n {\n int p = i * i;\n int m = (a + n - 1) / p;\n for (int j = 1; j <= m; j++)\n {\n if (t[p * j] == 0)\n t[p * j] = j;\n }\n }\n long ans = 0;\n for (int i = a; i < a + n; i++)\n {\n if (t[i] == 0)\n ans += i;\n else\n ans += t[i];\n }\n Console.WriteLine(ans);\n }\n\n static void E()\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 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\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\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, List ans, ref int time, Graph g)\n {\n g.color[u] = gray;\n ans.Add(u);\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, ans, 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, 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": "30fd6ec797686da3d90265a1a7444d25", "src_uid": "915081861e391958dce6ee2a117abd4e", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace One_Based_Arithmetic\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 long n = long.Parse(reader.ReadLine());\n\n var nn = new List();\n nn.Add(1);\n nn.Add(1);\n for (int i = 1;; i++)\n {\n long next = nn[i]*10 + 1;\n nn.Add(next);\n if (next > n)\n break;\n }\n\n int min = int.MaxValue;\n\n find(n, nn.Count - 1, nn, 0, ref min);\n\n\n writer.WriteLine(min);\n writer.Flush();\n }\n\n private static void find(long n, int index, List nn, int sum, ref int min)\n {\n if (n == 0)\n {\n if (min > sum)\n min = sum;\n }\n if (index <= 0)\n return;\n\n for (int i = -10; i < 11; i++)\n {\n if (n == nn[index]*i)\n {\n find(n - nn[index]*i, index - 1, nn, sum + index*Math.Abs(i), ref min);\n break;\n }\n }\n\n for (int i = -10; i < 11; i++)\n {\n if (n < nn[index] * i)\n {\n find(n - nn[index] * i, index - 1, nn, sum + index * Math.Abs(i), ref min);\n break;\n }\n }\n\n for (int i = 10; i > -11; i--)\n {\n if (n > nn[index] * i)\n {\n find(n - nn[index] * i, index - 1, nn, sum + index * Math.Abs(i), ref min);\n break;\n }\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4a56af998d49e9b9b592a92e0913f5a6", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "difficulty": 1800.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;\n\nnamespace bla2\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int c = 0;\n while(n > 0)\n {\n n /= 2;\n c++;\n }\n Console.WriteLine(c);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e69ee79c2c979f8aa5fe7378fad02fe5", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300.0} {"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 = 1;\n int i = 1;\n while (s <= n[0])\n {\n s += i;\n i++;\n }\n Console.Write(i-1);\n Console.ReadLine();\n }\n static string FindSecondMax(List list)\n {\n Point point = new Point(int.MaxValue, int.MaxValue);\n Point maxpoint = new Point(int.MaxValue, int.MaxValue);\n foreach (Point p in list)\n {\n if (Rast(p) >= Rast(point))\n {\n maxpoint = point;\n point = p;\n }\n else if(Rast(p) > Rast(maxpoint)){ maxpoint = p; }\n }\n return $\"{maxpoint.l} {maxpoint.r}\";\n }\n\n private static int Rast(Point point)\n {\n return (int)(Math.Sqrt(point.l * point.l + point.r * point.r));\n }\n\n private static long S(long v)\n {\n long sum = 0;\n while (v != 0)\n {\n sum += v % 10;\n v /= 10;\n }\n return sum;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0086402f4f59a0b907b8732098b36777", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300.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 long N, K;\n\n private void Scan()\n {\n var line = Console.ReadLine().Split(' ');\n N = long.Parse(line[0]);\n K = long.Parse(line[1]);\n }\n\n\n public void Solve()\n {\n Scan();\n long a = N / 2;\n long b = a / (K + 1);\n long c = b * K;\n long d = N - b - c;\n Console.WriteLine(\"{0} {1} {2}\", b, c, d);\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "833030fc76243a2d913e94f3140f1c5e", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "MS C#", "source_code": "using System;\nnamespace _818A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), k = long.Parse(input[1]);\n long x = (n / 2) / (k + 1), y = k * x, z = n - x - y;\n Console.WriteLine(x + \" \" + y + \" \" + z);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ea5fad62f84cfe59238738b2a5a8888", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.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\n long n = long.Parse(tokens[0]);\n long k= long.Parse(tokens[1]);\n\n Console.WriteLine($\"{n / 2 / (k + 1)} {n / 2 / (k + 1) * k} {n - n / 2 / (k + 1) - n / 2 / (k + 1) * k}\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8b42e62a9b9e42e7e28b468bf8d08c57", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "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 FakeNP\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64[] fir = Console.ReadLine().Split().Select(Int64.Parse).ToArray();\n Int64 win = fir[0] / 2;\n Int64 d = win / (fir[1] + 1);\n Int64 c = fir[1] * d;\n Console.WriteLine(d+\" \"+c+\" \"+(fir[0]-c-d));\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9f0a80fb300c4d7067aab9fad4668ef6", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.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 \n public static void Main(string[] args) {\n long n, k;\n GetTwoInts(out n, out k);\n\n long d, g, o;\n d = n/2/(k + 1);\n g = d*k;\n o = n - d - g;\n\n Console.WriteLine(\"{0} {1} {2}\", d, g, o);\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": "d19827b88391a5784a6b9fa3cb403665", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"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 long[] parseInt(string s)\n {\n string[] temp = s.Split(' ');\n long[] res = new long[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n {\n res[i] = Convert.ToInt64(temp[i]);\n }\n return res;\n }\n\n static void Main(string[] args)\n {\n var data = parseInt(Console.ReadLine());\n\n\n long[] f = new long[65];\n long[] s = new long[65];\n\n int p = -1;\n for (int i = 0; i < 65; i++)\n {\n f[i] = (data[0] & (1L << (i))) > 0 ? 1 : 0;\n s[i] = (data[1] & (1L << (i))) > 0 ? 1 : 0;\n if ((1L << (i)) > data[1])\n {\n p = i;\n break;\n }\n }\n\n bool tf = false;\n long[] ress = new long[65];\n for (int i = p - 1; i >= 0; i--)\n {\n if (!tf && s[i] > f[i])\n {\n tf = true;\n ress[i] = 1;\n continue;\n }\n if (f[i] == s[i])\n {\n if (tf)\n ress[i] = 1;\n else\n ress[i] = 0;\n }\n else\n ress[i] = 1;\n \n }\n\n long resss = 0;\n for (int i = 0; i < p; i++)\n {\n resss += ress[i] * (1L << i);\n }\n\n \n\n Console.WriteLine(resss);\n }\n }\n}\n/*\n3 10\n15 25 30\n */\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8b7dab851c52969dbbbe4f1163b02aba", "src_uid": "d90e99d539b16590c17328d79a5921e0", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace D {\n internal class Program {\n private static void Main() {\n var line = Console.ReadLine().Split(' ');\n ulong a = Convert.ToUInt64(line[0]);\n ulong b = Convert.ToUInt64(line[1]);\n\n\n var ab = new int[64];\n var bb = new int[64];\n\n for (int i = 0; i < 64; i++) {\n ulong ex = (ulong) 1 << i;\n if ((a & ex) == ex) {\n ab[i] = 1;\n }\n if ((b & ex) == ex) {\n bb[i] = 1;\n }\n }\n\n ab = ab.Reverse().ToArray();\n bb = bb.Reverse().ToArray();\n bool bot = false;\n\n for (int i = 0; i < 64; i++) {\n if (ab[i] == 0 && bb[i] == 1) {\n if (bot == false) {\n bot = true;\n continue;\n }\n }\n\n if (bot) {\n if (ab[i] == 0 && bb[i] == 0) {\n ab[i] = 1;\n continue;\n }\n if (ab[i] == 1 && bb[i] == 1) {\n bb[i] = 0;\n continue;\n }\n }\n }\n\n ulong ares = 0;\n ulong bres = 0;\n for (int i = 63; i >= 0; i--) {\n ulong ex = (ulong)1 << i;\n if (ab[63-i] == 1) {\n ares += ex;\n }\n if (bb[63-i] == 1) {\n bres += ex;\n }\n }\n\n Console.WriteLine(ares ^ bres);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d915f7ab383690bd6d0bcea8cba364b6", "src_uid": "d90e99d539b16590c17328d79a5921e0", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _276D\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n long l = long.Parse(tokens[0]);\n long r = long.Parse(tokens[1]);\n\n var lBinary = Convert.ToString(l, 2).PadLeft(60, '0');\n var rBinary = Convert.ToString(r, 2).PadLeft(60, '0');\n\n Console.WriteLine(Enumerable.Range(0, 60).Reverse().Select(i => 1L << i).SkipWhile(x => (l & x) == (r & x)).Sum());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ba2095dcb48c756b21ea10046011337c", "src_uid": "d90e99d539b16590c17328d79a5921e0", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\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\tint res = int.MaxValue;\n\t\t\tfor ( int i = 1; i < n; ++i )\n\t\t\t{\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\t\t\tConsole.WriteLine( res - 1 );\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fffe5576207d62b949ea90456831e78c", "src_uid": "75739f77378b21c331b46b1427226fa1", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\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\tint res = int.MaxValue;\n\t\t\tfor ( int i = 1; i <= n; ++i )\n\t\t\t{\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\tres = Math.Min( res, cur );\n\t\t\t}\n\t\t\tConsole.WriteLine( res - 1 );\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "948107f7e7bc331e153c66733cad0bec", "src_uid": "75739f77378b21c331b46b1427226fa1", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\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\tint res = int.MaxValue;\n\t\t\tfor ( int i = 1; i < n; ++i )\n\t\t\t{\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\tres = Math.Min( res, cur );\n\t\t\t}\n\t\t\tConsole.WriteLine( res - 1 );\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "84790d97b83fb8209963eb1cf5ab02f0", "src_uid": "75739f77378b21c331b46b1427226fa1", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Text;\n\nnamespace codeforces\n{\n public class Program\n {\n private const int MOD = 998244353;\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 void Main(string[] args)\n {\n var values = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(values[0]);\n int m = Convert.ToInt32(values[1]);\n\n var f = new int[m + 1];\n f[0] = 1;\n for (int i = 1; i <= m; ++i)\n {\n f[i] = Mult(f[i - 1], i);\n }\n\n int result = BinPow(2, n - 3);\n result = Mult(result, n - 2);\n result = Mult(result, f[m]);\n result = Mult(result, BinPow(Mult(f[n - 1], f[m - n + 1]), MOD - 2));\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c5594596be09dfd684c95da1971fdf95", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.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\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 m = ri;\n\t\t\tvar binom = new BinomialCoefficient(m + 50);\n\t\t\tif (n == 2) {\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tModInt ans = binom[m, n - 1];\n\t\t\tans *= ModInt.Pow(2, n - 3);\n\t\t\tans *= n - 2;\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\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": "b5f42b088021ba2825077815b42a4a65", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.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(p, mir[0], mir[1])) * sign(cross(v, mir[0], mir[1])) ==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": "6174466bb1b41c8a0837afb8bbb7cf03", "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],p)) ==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": "807b55177617865c777d3a1fe37e1d00", "src_uid": "7539a41268b68238d644795bccaa0c0f", "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 Snail\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] x = new int[n];\n for (int i = 0; i < n; i++)\n x[i] = int.Parse(Console.ReadLine());\n for(int i = 0; i < (1< 0)\n cs += x[j];\n else cs -= x[j];\n if (cs % 360 == 0) \n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fadb4517cec4fe1435ea79f26d24e574", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.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 long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString(\"F8\");\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n\n List rotations = new List();\n bool[,] bPossib;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n bPossib = new bool[370,2];\n\n int JJ=0;\n bPossib[0, JJ] = true;\n int i;\n for(i=0;i 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "25bb201aba9c072fc7dfbdc50bbd9c0b", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.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 n = int.Parse(Console.ReadLine());\n var numbers = new int[n];\n for(var i = 0; i < n; i++) {\n numbers[i] = int.Parse(Console.ReadLine());\n }\n Console.WriteLine(Summable(numbers, 0, 0, n) ? \"YES\" : \"NO\");\n }\n static bool Summable(int[] arr, int i, int sum, int n) {\n sum%=360;\n if(i >= n - 1)\n return (sum+arr[i])%360 == 0 || (sum-arr[i])%360 == 0;\n return Summable(arr, i+1, sum+arr[i], n) || Summable(arr, i+1, sum-arr[i], n);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "521c274e518cdcc0ba252d4285e538cf", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing System.Collections;\n\nnamespace \u041a\u0440\u0430\u0442\u043d\u044b\u0435\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 // int[] sgn = new int[n];\n string sgn;\n bool yes = false;\n\n for (int i=0; i _list { get; set; }\n\n public static bool recursiveSolve(int x, int y)\n {\n if (y < 0)\n return false;\n if (x % 360 == 0 && y < 0)\n return true;\n return recursiveSolve(x - _list[y], y - 1) || recursiveSolve(x + _list[y], y - 1);\n }\n \n public static void Main(string[] args)\n {\n _list = new List();\n var n = Convert.ToInt32(Console.ReadLine());\n for (int i = 0; i < n; i++)\n {\n _list.Add(Convert.ToInt32(Console.ReadLine()));\n }\n\n Console.WriteLine(recursiveSolve(0, n-1) ? \"NO\" : \"YES\");\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a16a3da818431639aac70c345f197acf", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp\n{\n public class Program\n {\n public static void Main()\n {\n //int n = Convert.ToInt32(Console.ReadLine());\n //int[] array = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n //StringBuilder stringBuilder = new StringBuilder();\n int n = Convert.ToInt32(Console.ReadLine());\n int degree = Convert.ToInt32(Console.ReadLine());\n BitArray bitArray = new BitArray(360);\n bitArray[degree] = true;\n bitArray[360 - degree] = true;\n BitArray left = (BitArray)bitArray.Clone();\n BitArray right = (BitArray)bitArray.Clone();\n BitArray temp1;\n BitArray temp2;\n for (; n > 1; n--)\n {\n degree = Convert.ToInt32(Console.ReadLine());\n temp1 = (BitArray)left.Clone();\n temp2 = (BitArray)left.Clone();\n left = (BitArray)(temp1.LeftShift(degree).Or(temp2.LeftShift(360 - degree))).Clone();\n temp1 = (BitArray)right.Clone();\n temp2 = (BitArray)right.Clone();\n right = (BitArray)(temp1.RightShift(degree).Or(temp2.RightShift(360 - degree))).Clone();\n\n bitArray = (BitArray)left.Or(right).Clone();\n }\n\n if (bitArray[0])\n {\n Console.Write(\"YES\");\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "18422007fb341eb3494124552441c7eb", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] a = new int[n];\n int[] f = new int[n];\n int fcnt = 0;\n\n string str = Console.ReadLine();\n string[] words = str.Split(' ');\n\n for (int i = 0; i < n; i++)\n a[i] = Convert.ToInt32(words[i]);\n\n for(int 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(int 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": "f9839eadc85880141931e3b62533c23c", "src_uid": "8054dc5dd09d600d7fb8d9f5db4dcaca", "difficulty": 2700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\n\nclass Program\n{\n\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] a = new int[n];\n int[] f = new int[n];\n int fcnt = 0;\n\n string str = Console.ReadLine();\n string[] words = str.Split(' ');\n\n for (int i = 0; i < n; i++)\n a[i] = Convert.ToInt32(words[i]);\n\n for(int 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(int 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 Console.Write(mid.ToString());\n Console.WriteLine(ok.ToString());\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": "d816aa15cb0f36a05bb6cd76003c9aad", "src_uid": "8054dc5dd09d600d7fb8d9f5db4dcaca", "difficulty": 2700.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 d1 = a2 / g;\n long d2 = a1 / g;\n if (x0 < 0)\n {\n long z = ((-x0 - 1) / d1 + 1);\n x0 += z * d1;\n y0 += z * d2;\n }\n if (y0 < 0)\n {\n long z = ((-y0 - 1) / d2 + 1);\n x0 += z * d1;\n y0 += z * d2;\n }\n \n long t = Math.Min(x0 / d1, y0 / d2);\n x0 -= t * d1;\n y0 -= t * d2;\n Write(Fun(d1 * 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": "6cef0bb3472a52c4116ea51a2290dc76", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "difficulty": 2500.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 long result = Cal(Nums.Length - 1, sum);\n result = (result + Mod) % Mod;\n Console.WriteLine(result);\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 % 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": "81fdf0082240451ef423b4c1ce7a36be", "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 if (ret >= Mod)\n ret -= Mod;\n if (ret < 0) \n ret += Mod;\n return ret;\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\");\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": "7b9d78da52a511b7157c2765bc847b56", "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);\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]) + MOD) % MOD;\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": "d56d4f14c277049282ba7b5e3375e7bf", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace C.Peasant\n{\n class Program\n {\n private static IEnumerable Factor(long x)\n {\n for (int i = 1; i * i <= x; i++)\n {\n if (x % i == 0)\n {\n yield return i;\n yield return x / i;\n }\n }\n }\n\n private static long F(long n, long a, long b, long c)\n {\n return (a + 1) * (b + 2) * (c + 2) - n;\n }\n\n static void Main(string[] args)\n {\n long n = int.Parse(Console.ReadLine());\n long max = 0, min = long.MaxValue;\n\n long[] factors = Factor(n).ToArray();\n\n foreach (long f1 in factors)\n {\n foreach (long f2 in factors)\n {\n if (n % (f1 * f2) == 0)\n {\n long f3 = n / (f1 * f2);\n long y = F(n, f1, f2, f3);\n\n if (y < min)\n min = y;\n\n if (y > max)\n max = y;\n }\n } \n }\n\n Console.WriteLine(\"{0} {1}\", min, max);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d4c8e00535b39fdae84c20214cd9eeab", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n long min = long.MaxValue;\n\n for (long i = 1; i <= Math.Pow(n, 1.0/3.0); i++)\n {\n long sq = n / i;\n if (n % i == 0)\n for (long j = 1; j <= Math.Sqrt(sq); j++)\n {\n long k = sq / j;\n if (sq % j == 0)\n if (i * j * k == n)\n {\n min = Math.Min(min, (i + 1) * (j + 2) * (k + 2) - n);\n min = Math.Min(min, (i + 2) * (j + 1) * (k + 2) - n);\n min = Math.Min(min, (i + 2) * (j + 2) * (k + 1) - n);\n }\n }\n }\n\n Console.WriteLine(min + \" \" + ((n + 1) * 3 * 3 - n));\n }\n }\n}\n ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c5858f5b97dfe3a9d176abb799f44377", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Dictionary\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var n = long.Parse(Console.ReadLine());\n\n var min = long.MaxValue;\n var max = (n + 1) * 9 - n;\n var root = Math.Sqrt(n);\n var up = root % 1 > 0.5 ? Math.Round(root) : Math.Round(root + 0.5);\n\n for (int a = 1; a < up + 5; a++)\n {\n for (int c = 1; c < up + 5; c++)\n {\n var b = n / a / c;\n if (n == a * b * c)\n {\n var temp = (a + 1) * (b + 2) * (c + 2) - n;\n if (temp < min) min = temp;\n }\n }\n }\n\n Console.WriteLine(\"{0} {1}\", min, max);\n }\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6abe14a0c4cc95f3f1a1fe732bc0736a", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "difficulty": 1600.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\n\nnamespace globalLogin\n{\n\tpublic class Program\n\t{\n\t\tpublic static void Main(string[] str)\n\t\t{\n\t\t\tint[] info = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n\t\t\tSolution sol = new Solution();\n\t\t\tConsole.WriteLine(sol.Intersect(info[0], info[1], info[2], info[3], info[4]) ? \"YES\" : \"NO\");\n\t\t}\n\t}\n\n\n\tinternal class Solution\n\t{\n\t\tpublic bool Intersect(int n, int a, int x, int b, int y)\n\t\t{\n\t\t\tint stationA = 0;\n\t\t\tint stationB = n - 1;\n\t\t\t--x;\n\t\t\t--y;\n\t\t\tbool AInTrain = false, BInTrain = false;\n\n\t\t\tfor(int i = 0; i <= 2 * n; ++i, \n\t\t\t\tstationA = ++stationA % n,\n\t\t\t\tstationB = ((stationB - 1) % n + n) %n)\n\t\t\t{\n\t\t\t\tif(stationA == a)\n\t\t\t\t\tAInTrain = true;\n\t\t\t\tif(stationB == b)\n\t\t\t\t\tBInTrain = true;\n\n\t\t\t\tif(stationA == stationB && BInTrain == AInTrain && AInTrain == true)\n\t\t\t\t\treturn true;\n\n\t\t\t\tif(stationA == x || stationB == y)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "27f70de1ebb9883f6b5db2ca01068814", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace leetcode\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n //100 2 97 84 89\n //5 1 4 3 2\n bool yes = false;\n\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int x = int.Parse(s[2]);\n\n int b = int.Parse(s[3]);\n int y = int.Parse(s[4]);\n\n\n List ax = new List();\n List by = new List();\n Queue qax = new Queue();\n Queue qby = new Queue();\n\n //Daniel\n if (a > x)\n {\n int c = a + 1;\n while (c <= n)\n {\n qax.Enqueue(c++);\n }\n }\n int sa = (a > x)? 1: a + 1;\n for (int i = sa; i <= x; i++)\n {\n qax.Enqueue(i);\n }\n\n //vlad\n if (b < y)\n {\n int c = b - 1;\n while (c > 0)\n {\n qby.Enqueue(c--);\n }\n }\n\n int sb = (b < y) ? n : b;\n for (int i = sb; i >=y; i--)\n {\n qby.Enqueue(i);\n }\n //100 2 97 84 89\n //yes\n while (qax.Count > 0 && qby.Count > 0)\n {\n int t1 = qax.Dequeue();\n int t2 = qby.Dequeue();\n if (t1 == t2)\n {\n yes = true;\n break;\n }\n }\n Console.WriteLine(yes == true ? \"YES\" : \"NO\");\n\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3959c6567276a6bd19072a5a229ff52c", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"5 1 4 3 2\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Reflection;\n\npublic class HelloWorld {\n public static void SolveCodeForces() {\n var n = cin.NextInt();\n var a = cin.NextInt() - 1;\n var x = cin.NextInt() - 1;\n var b = cin.NextInt() - 1;\n var y = cin.NextInt() - 1;\n\n for (var t = 0; t <= n+5; t++) {\n if (a == b) {\n System.Console.WriteLine(\"YES\");\n return;\n }\n if (a == x || b == y) break;\n a = (a + 1) % n;\n b = (b - 1) % n;\n }\n System.Console.WriteLine(\"NO\");\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // IncreaseStack(SolveCodeForces);\n // System.Console.Write(cout.ToString());\n }\n\n public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)\n {\n var thread = new Thread(action, stackSize);\n thread.Start();\n thread.Join();\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "19fdc2fb658b1e9accd2c4fa8e60c735", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "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 int? getVal(char c)\n {\n if (c >= 'a' && c <= 'f')\n return 10 + (c - 'a');\n if (c >= 'A' && c <= 'F')\n return 10 + (c - 'A');\n if (c >= '0' && c <= '9')\n return c - '0';\n return null;\n }\n\n static char? convert(char? A, char? B)\n {\n if (A == null || B == null)\n return null;\n var x = getVal(A.Value);\n var y = getVal(B.Value);\n if (x == null || y == null)\n return null;\n var res = x.Value * 16 + y.Value;\n return (char)res;\n }\n\n static void Main(string[] args)\n {\n var nm = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);\n var n = nm[0];\n var a = nm[1];\n var x = nm[2];\n var b = nm[3];\n var y = nm[4];\n for (int i = 0; i < n; i++)\n {\n var c1 = (a - 1 + i) % n;\n var c2 = (b - 1 - i) % n;\n c2 = c2 < 0 ? c2 + n : c2;\n if (c1 == c2 )\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (c1 == x - 1 || c2 == y - 1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "53c22aa6fcac61ecbfa72a9f23e52e10", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Circle_Metro\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve() ? \"Yes\" : \"No\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n int n = Next(), a = Next(), x = Next(), b = Next(), y = Next();\n\n while (true)\n {\n a++;\n b--;\n if (a > n)\n a = 1;\n if (b == 0)\n b = n;\n if (a == b)\n return true;\n if (a == x || b == y)\n return false;\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "01a277993b8e6a6ec711f46c9cb4f899", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar arr = Ints();\n\t\t\tvar n = arr[0];\n\t\t\tvar a = --arr[1];\n\t\t\tvar x = --arr[2];\n\t\t\tvar b = --arr[3];\n\t\t\tvar y = --arr[4];\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (a == b)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (a == x || b == y)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ta = (a + 1) % n;\n\t\t\t\tb = (b - 1 + n) % n;\n\t\t\t}\n\n\n\t\t}\n\n\t\tstatic int Int()\n\t\t{\n\t\t\treturn Int32.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (int, int) Int2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic (int, int, int) Int3()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t\treturn (arr[0], arr[1], arr[3]);\n\t\t}\n\n\n\t\tstatic int[] Ints()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t}\n\n\t\tstatic long Long()\n\t\t{\n\t\t\treturn Int64.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (long, long) Long2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic (long, long, long) Long3()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t\treturn (arr[0], arr[1], arr[2]);\n\t\t}\n\n\t\tstatic long[] Longs()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t}\n\n\t\tstatic string Str()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tstatic void Swap(ref T a, ref T b)\n\t\t{\n\t\t\tvar t = a;\n\t\t\ta = b;\n\t\t\tb = t;\n\t\t}\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "47830cceececeac374e8697b421e2253", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nclass problem\n{\n static void Main()\n {\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n int n = v[0], a = v[1], x = v[2], b = v[3], y = v[4];\n int t=x>a?x-a:x+n-a;\n t=Math.Min(t,y>b?b+n-y:b-y);\n while(t-->-1)\n {\n if(a == b)\n {\n Console.WriteLine( \"YES\" );\n return;\n }\n else\n {\n a = a == n ? 1 : a+1;\n b = b == 1 ? n : b-1;\n }\n }\n Console.WriteLine( \"NO\" );\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "81f66af6efb29a0a5f724ad7c5b05993", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar n = getInt();\n\t\t\tConsole.WriteLine((long)(n - 2) * (n - 2));\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c0c3e8d15a3ae99f2b7eddbf43fcb2b4", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var n = long.Parse(Console.ReadLine());\n if(n == 3) Console.WriteLine(1);\n else Console.WriteLine((n-2)*(n-1) - (n-2));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "87ba33c4c09dd84d3f1a642b7bf30e46", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "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;\nusing System.Numerics;\n\nnamespace Solving\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n Console.ReadKey();\n }\n }\n }\n\n class Solver\n {\n public void Solve()\n {\n long n = long.Parse(Console.ReadLine());\n long ans = (n - 2) * (n - 2);\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n\n }\n\n class InputReader\n {\n public static int[] ReadIntArr()\n {\n return Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray\n\n();\n }\n public static string ReadString()\n {\n return Console.ReadLine();\n }\n public static long[] ReadLongArr()\n {\n return Console.ReadLine().Split(' ').Select(Int64.Parse).ToArray\n\n();\n }\n public static double[] ReadDoubleArr()\n {\n return Console.ReadLine().Split(' ').Select(s => Double.Parse(s,\n\nCultureInfo.InvariantCulture)).ToArray();\n }\n public static string[] ReadSplitString()\n {\n return Console.ReadLine().Split(' ').ToArray();\n }\n public static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n public static long ReadLong()\n {\n return Int64.Parse(Console.ReadLine());\n }\n public static double ReadDouble()\n {\n return Double.Parse(Console.ReadLine(),\n\nCultureInfo.InvariantCulture);\n }\n public static int[][] ReadIntMatrix(int numberofrows)\n {\n int[][] matrix = new int[numberofrows][];\n for (int i = 0; i < numberofrows; i++)\n {\n matrix[i] = ReadIntArr();\n }\n return matrix;\n }\n public static string[] ReadStringLines(int numberoflines)\n {\n string[] arr = new string[numberoflines];\n for (int i = 0; i < numberoflines; i++)\n {\n arr[i] = Console.ReadLine().Trim();\n }\n return arr;\n }\n }\n\n class OutputWriter\n {\n public static void WriteArray(IEnumerable array)\n {\n Console.WriteLine(string.Join(\" \", array));\n }\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) { Console.WriteLine(a); }\n }\n }\n class RDictionary : 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2211eb8df2d8aaf3e5982bee5388a55c", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "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 TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n long answer = 1;\n long prev=1;\n for (int i = 4; i <= n; i++)\n {\n prev += 2;\n answer += prev;\n }\n\n Console.WriteLine(answer);\n //Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f752d40601da7500306e7f54c9220c52", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.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 int n = int.Parse(Console.ReadLine());\n Console.WriteLine((n-2)*(n-2));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5fbaf1ad0c0d8a2c16a154dcc319da99", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.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 int n = int.Parse(Console.ReadLine());\n Console.WriteLine(3 * (n - 3) + (n - 3) * (n - 4) + 1);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2c9a8d8f6957979484b37066dfea45dc", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "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;\nusing System.Numerics;\n\nnamespace Solving\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n Console.ReadKey();\n }\n }\n }\n\n class Solver\n {\n public void Solve()\n {\n int n = int.Parse(Console.ReadLine());\n long ans = 0;\n ans = n * n - 4 * (n - 1);\n if (n % 2 == 0) ans += 1;\n \n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n\n }\n\n class InputReader\n {\n public static int[] ReadIntArr()\n {\n return Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray\n\n();\n }\n public static string ReadString()\n {\n return Console.ReadLine();\n }\n public static long[] ReadLongArr()\n {\n return Console.ReadLine().Split(' ').Select(Int64.Parse).ToArray\n\n();\n }\n public static double[] ReadDoubleArr()\n {\n return Console.ReadLine().Split(' ').Select(s => Double.Parse(s,\n\nCultureInfo.InvariantCulture)).ToArray();\n }\n public static string[] ReadSplitString()\n {\n return Console.ReadLine().Split(' ').ToArray();\n }\n public static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n public static long ReadLong()\n {\n return Int64.Parse(Console.ReadLine());\n }\n public static double ReadDouble()\n {\n return Double.Parse(Console.ReadLine(),\n\nCultureInfo.InvariantCulture);\n }\n public static int[][] ReadIntMatrix(int numberofrows)\n {\n int[][] matrix = new int[numberofrows][];\n for (int i = 0; i < numberofrows; i++)\n {\n matrix[i] = ReadIntArr();\n }\n return matrix;\n }\n public static string[] ReadStringLines(int numberoflines)\n {\n string[] arr = new string[numberoflines];\n for (int i = 0; i < numberoflines; i++)\n {\n arr[i] = Console.ReadLine().Trim();\n }\n return arr;\n }\n }\n\n class OutputWriter\n {\n public static void WriteArray(IEnumerable array)\n {\n Console.WriteLine(string.Join(\" \", array));\n }\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) { Console.WriteLine(a); }\n }\n }\n class RDictionary : 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "18f3196b3099eeb4b69a42e0797575f5", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "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;\nusing System.Numerics;\n\nnamespace Solving\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n Console.ReadKey();\n }\n }\n }\n\n class Solver {\n public void Solve() {\n int n = int.Parse(Console.ReadLine()), ans = 0;\n if (n % 2 == 0)\n {\n int sum = 0;\n for (int i = 2; i <= n - 2; i++)\n {\n sum += i;\n }\n sum *= 2;\n ans = n * n - sum;\n }\n else {\n int sum = 0;\n for (int i = 2; i < n - 1; i++) {\n sum += i;\n }\n sum *= 2;\n sum += (n - 1);\n ans = n * n - sum;\n }\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n\n }\n\n class InputReader {\n public static int[] ReadIntArr() {\n return Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n }\n public static string ReadString() {\n return Console.ReadLine();\n }\n public static long[] ReadLongArr() {\n return Console.ReadLine().Split(' ').Select(Int64.Parse).ToArray();\n }\n public static double[] ReadDoubleArr() {\n return Console.ReadLine().Split(' ').Select(s => Double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static string[] ReadSplitString() {\n return Console.ReadLine().Split(' ').ToArray();\n }\n public static int ReadInt() {\n return Int32.Parse(Console.ReadLine());\n }\n public static long ReadLong() {\n return Int64.Parse(Console.ReadLine());\n }\n public static double ReadDouble() {\n return Double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);\n }\n public static int[][] ReadIntMatrix(int numberofrows) {\n int[][] matrix = new int[numberofrows][];\n for (int i = 0; i < numberofrows; i++) {\n matrix[i] = ReadIntArr();\n }\n return matrix;\n }\n public static string[] ReadStringLines(int numberoflines) {\n string[] arr = new string[numberoflines];\n for (int i = 0; i < numberoflines; i++) {\n arr[i] = Console.ReadLine().Trim();\n }\n return arr;\n }\n }\n\n class OutputWriter {\n public static void WriteArray(IEnumerable array) {\n Console.WriteLine(string.Join(\" \", array));\n }\n public static void WriteLines(IEnumerable array) {\n foreach (var a in array) { Console.WriteLine(a); }\n }\n }\n class RDictionary : 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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7e057f84b4db180b53b77bd6e6f66b27", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\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 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 BitArray readBools() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n int parsed;\n BitArray bits = new BitArray(nums.Length);\n for(int i = 0; i < nums.Length; i++) {\n int.TryParse(nums[i],out parsed);\n if(parsed != 0) {\n bits[i] = true;\n }\n }\n return bits;\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 pusing System;\nusing System.Collections;\nusing System.Collections.Generic;\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 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 BitArray readBools() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n int parsed;\n BitArray bits = new BitArray(nums.Length);\n for(int i = 0; i < nums.Length; i++) {\n int.TryParse(nums[i],out parsed);\n if(parsed != 0) {\n bits[i] = true;\n }\n }\n return bits;\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 #endregion\n\n static void Main(string[] args) {\n Console.WriteLine((int)Math.Pow((readInt() - 2),2));\n }\n }\n}\nrev = (prev * prev) % (m);\n if((b & (1l << i)) > 0) {\n sum = (sum * prev) % (m);\n }\n }\n return sum;\n }\n\n #endregion\n\n static void Main(string[] args) {\n Console.WriteLine((int)Math.Pow((readInt() - 2),2));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "3fcaae2d0bcd73a18ff5c475d637e354", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Maximum_Sum_of_Digits\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve());\n writer.Flush();\n }\n\n private static int Solve()\n {\n string s = reader.ReadLine();\n\n int ans = s[0] - '0';\n bool fn9 = false;\n for (int i = s.Length - 1; i > 0; i--)\n {\n if (fn9 || s[i] != '9')\n {\n ans += 9;\n ans += s[i] - '0';\n fn9 = true;\n }\n else\n {\n ans += 9;\n }\n }\n\n return ans;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "886ccd03fe5c21b291309485c94faa91", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.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 long tutu(long a)\n {\n long res = 0;\n for (; ; )\n {\n if (a == 0)\n break;\n res += a % 10;\n a /= 10;\n }\n return res;\n }\n\n //////////////////////////////////////////////////\n void Solution()\n {\n var n = rl;\n long a = 0;\n var p = n;\n for (; ; )\n {\n if (p == 0)\n break;\n p /= 10;\n a = a * 10 + 9;\n }\n if (a > n)\n {\n a /= 10;\n }\n var b = n - a;\n wln(tutu(a) + tutu(b));\n }\n //////////////////////////////////////////////////\n\n struct P : IComparable

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

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

    (n);\n for (int i = 0; i < n; i++)\n res.Add(new P(rl, rl));\n return res;\n }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { var res = _str.Substring(_ind); _count = 0; _ind = 0; return res; }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n List ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res.ToList();\n }\n List rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res.ToList();\n }\n List rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res.ToList();\n }\n List rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res.ToList(); }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main(string[] args) { new Program().Main(); }\n void Main()\n {\n //Console.SetIn(new StreamReader(\"input.txt\")); Console.SetOut(new StreamWriter(\"output.txt\"));\n Solution();\n Console.Write(_sb);\n //Console.In.Close(); Console.Out.Close();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b87437d346819a0be630334df01d1fae", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\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 if (a.Length==number)\n { \n for (int i=0; i0)\n {\n Console.WriteLine(\"HARD\");\n // Console.ReadKey();\n }\n }\n }\n else\n {\n //Console.ReadKey();\n } */\n\n /*\n string nomer = Console.ReadLine();\n if (nomer.Length == number)\n {\n int a = 8;\n //long chislo = Convert.ToInt64(nomer);\n if (nomer.ToString().Contains(a.ToString()) && (nomer.Length >= 11))\n {\n int res = nomer.Length / 11;\n //Console.WriteLine(res);\n foreach (char ch in nomer)\n {\n if (ch == '8')\n {\n count++;\n }\n }\n if (count <= res)\n {\n Console.WriteLine(count);\n // Console.ReadKey();\n }\n if (count > res)\n {\n Console.WriteLine(res);\n // Console.ReadKey();\n }\n\n\n }\n else\n {\n Console.WriteLine(\"0\");\n Console.ReadKey();\n }\n } */\n\n float number = Convert.ToInt64(Console.ReadLine());\n float Sum = 0;\n float all;\n float a;\n float b;\n float g;\n float mas;\n if ((1 <= number) && (number <= 1000000000000))\n {\n if (number == 10000000000)\n {\n Sum = 91;\n Console.WriteLine(Sum);\n }\n if ((number % 2 == 0) && (number != 10000000000))\n {\n all = number / 2;\n a = all - 1;\n b = all + 1;\n\n g = float.Parse(Convert.ToString(a) + Convert.ToString(b));\n // Console.WriteLine(Convert.ToString(a) + Convert.ToString(b));\n mas = g;\n while (mas!= 0)\n {\n Sum = Sum + mas % 10;\n mas = mas / 10;\n }\n Console.WriteLine(Sum);\n // Console.ReadKey();\n\n } \n else\n {\n all = (number - 1) / 2;\n a = all;\n b = all + 1;\n\n g = float.Parse(Convert.ToString(a) + Convert.ToString(b));\n // Console.WriteLine(Convert.ToString(a) + Convert.ToString(b));\n mas = g;\n while (mas != 0)\n {\n Sum = Sum + mas % 10;\n mas = mas / 10;\n }\n Console.WriteLine(Sum);\n // Console.ReadKey();\n\n }\n\n }\n else\n {\n \n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5bae620a17d5fccb23aae0805b26d625", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace B.MaxSummOfDigits\n{\n class Program\n {\n static void Main(string[] args)\n {\n int result = 0;\n\n var number = Convert.ToInt64(Console.ReadLine());\n if(number < 1 || number > 1000000000000) goto End;\n if (number == 1)\n {\n result = 1;\n goto End;\n }\n\n long middleOfNumber = number / 2 + 1;\n var secondHalf = number - middleOfNumber;\n\n foreach (var charNumb in middleOfNumber.ToString())\n {\n result += Int32.Parse(charNumb.ToString());\n }\n\n foreach (var charNumb in secondHalf.ToString())\n {\n result += Int32.Parse(charNumb.ToString());\n }\n\n End:\n Console.WriteLine(result);\n Console.Read();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "85f32de0093c9a7ef2935ed965dac5b0", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _1031A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int w = int.Parse(tokens[0]);\n int h = int.Parse(tokens[1]);\n int k = int.Parse(tokens[2]);\n\n Console.WriteLine(2 * k * (h + w + 2 - 4 * k));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5034f31b7037b555c3a99066057c83c2", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Delta\n{\n class MainClass\n {\n \n public static void Main(string[] args)\n {\n int Sum = 0;\n byte i = 0;\n string input = Console.ReadLine();\n int[] Numbers = new int[3];\n foreach (string a in (input.Split(new char[] { ' ' })))\n {\n Numbers[i] = Convert.ToInt32(a);\n i++;\n }\n for (int q = 0; q < Numbers[2]; q++)\n {\n Sum += 2 * Numbers[0] + 2 * Numbers[1] - 4;\n Numbers[0] -= 4;\n Numbers[1] -= 4;\n }\n Console.WriteLine(Sum);\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "38be3abf6a4124c9cd492ca6e32e3974", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Example\n{\n class Program\n {\n static void Main()\n {\n string[] x = Console.ReadLine().Split();\n int w = int.Parse(x[0]);\n int h = int.Parse(x[1]);\n int k = int.Parse(x[2]);\n int P = 0;\n int S = 0;\n int sum = 0;\n \n for(int i = 0; i < k; i++)\n {\n \n P = 2*(w + h) - 4;\n sum += P;\n w -= 4;\n h -= 4;\n }\n\n Console.WriteLine(sum);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "07310ba8f3ef5031a47aa6371306ea93", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] t = s.Split(new char[] { ' ' });\n var a = Convert.ToInt64(t[0]);\n var b = Convert.ToInt64(t[1]);\n var c = Convert.ToInt64(t[2]);\n Int64 n=0;\n for (int i = 1; i <= c; i++)\n {\n n = a * 2 + b * 2 - 4+n;\n a = a - 4;\n b = b - 4;\n }\n Console.WriteLine(n);\n }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "275eb86eaaf3daba7469486fd609adc4", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\nstatic void Main()\n{\nstring input = Console.ReadLine();\nint w = int.Parse(input.Split(' ')[0]), h = int.Parse(input.Split(' ')[1]), k = int.Parse(input.Split(' ')[2]);\n//Console.WriteLine(w+\" \"+h+\" \"+k);\nint res = w + h + (w-2) + (h-2);\n//Console.WriteLine(\"m=\"+res);\nfor(int i = 1; i Recurse(long m)\n {\n if (m < 8)\n return Tuple.Create(m, m);\n var root = MaxRoot(m);\n var cube = root * root * root;\n var lesserCube = (root - 1) * (root - 1) * (root - 1);\n var firstAns = Recurse(m - cube);\n var secondAns = Recurse(cube - 1 - lesserCube);\n return firstAns.Item1 >= secondAns.Item1\n ? Tuple.Create(firstAns.Item1 + 1, cube + firstAns.Item2)\n : Tuple.Create(secondAns.Item1 + 1, lesserCube + secondAns.Item2);\n\n }\n\n long MaxRoot(long x)\n {\n var root = (long) Math.Floor(Math.Pow(x, 1d / 3));\n if ((root + 1) * (root + 1) * (root + 1) <= x)\n root++;\n return root;\n }\n\n int Solve(string s1, string s2, int L, int m)\n {\n var diff = s1.Length + s2.Length - L;\n if (diff > 0)\n {\n if (s1.Substring(s1.Length - diff) == s2.Substring(0, diff))\n return 1 % m;\n else\n return 0;\n }\n else\n {\n return FastPow(26, Math.Abs(diff), m);\n }\n }\n\n public int FastPow(int b, int pow, int mod)\n {\n if (pow == 0)\n return 1 % mod;\n if (pow == 1)\n return b % mod;\n if ((pow & 1) == 0)\n return FastPow(b * b % mod, pow / 2, mod);\n return b * FastPow(b, pow - 1, mod) % mod;\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 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[] 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 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": "dc41fb5dcc0619beedbe1492f2076bfd", "src_uid": "385cf3c40c96f0879788b766eeb25139", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "/* Date: 23.10.2020 * Time: 22:45 */\n//\n// CF 677 E\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# if ( ! ONLINE_JUDGE )\n\tpublic static StreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2020\\\\Task\\\\07 Codeforces\\\\050\\\\E.TXT\");\n\tpublic static StreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2020\\\\Task\\\\07 Codeforces\\\\050\\\\OUTPUT.OUT\");\n# endif\n\n\tpublic static void Main (string[] args)\n\t{\n\t\tint n;\n\n# if ( ONLINE_JUDGE )\n\t\tn = int.Parse (Console.ReadLine ());\n# else\n\t\tsw.WriteLine (\"*** # \" + _q);\n\t\tn = int.Parse (sr.ReadLine ());\n# endif\n\t\t\t\n# if ( ! ONLINE_JUDGE )\n\t\tsw.WriteLine (\"*** n = \" + n);\n# endif\n\n\t\tInt64 k = 1;\n\t\tfor ( int i=2; i < n; i++ )\n\t\t\tif ( i != n/2 )\n\t\t\t\tk *= i;\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine (k);\n\t\tsw.Close ();\n# endif\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2e7c0d85ab85e3b95f567aecfc967c69", "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(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": "aeee344d72c09b16d784222ee2572248", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Security.Policy;\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 string GetStr() { return Console.ReadLine().Trim(); }\n char GetChar() { return Console.ReadLine().Trim()[0]; }\n int GetInt() { return int.Parse(Console.ReadLine().Trim()); }\n long GetLong() { return long.Parse(Console.ReadLine().Trim()); }\n double GetDouble() { return double.Parse(Console.ReadLine().Trim()); }\n string[] GetStrArray() { return Console.ReadLine().Trim().Split(' '); }\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 int[] GetIntArray() { return Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray(); }\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 public long[] GetLongArray() { return Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray(); }\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 char[] GetCharArray() { return Console.ReadLine().Trim().Split(' ').Select(char.Parse).ToArray(); }\n double[] GetDoubleArray() { return Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray(); }\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 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 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 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 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 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 void Multi(out T a) => a = cv(GetStr());\n void Multi(out T a, out U b)\n {\n var ar = GetStrArray(); a = cv(ar[0]); b = cv(ar[1]);\n }\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 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 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 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 void Output(T t) => Console.WriteLine(t);\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 long N = GetLong();\n long M = N / 2;\n long b = 1;\n for (long i = 1; i < M; i++) b *= i;\n long B = 1;\n for (long i = M + 1; i <= N; i++) B *= i;\n Output(B / M /2* b);\n }\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "29cba740a1bcb1af0e6c9033683a7afe", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": ".NET Core C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\n\npublic class Program\n{\n private int N;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n\n int l = 1 << N;\n int cnt = 0;\n for (int i = 0; i < l; i++)\n {\n int c = 0;\n for (int j = 0; j < N; j++)\n {\n if ((i & (1 << j)) == 0) c++;\n }\n\n if (c * 2 == N) cnt++;\n }\n\n long p = 1;\n for (int i = 1; i <= N / 2 - 1; i++)\n {\n p *= i;\n }\n\n Console.WriteLine(cnt / 2 * p * p);\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\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": "8f3238221cb375461b9a4cd08ae1463c", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.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 a = ReadLongToken();\n var b = ReadLongToken();\n var n = ReadLongToken();\n var x = ReadLongToken();\n if (a == 1)\n return (x + b * (n % commonMod)) % commonMod;\n var first = (FastPow(a, n, commonMod) * x) % commonMod;\n var q1 = (FastPow(a, n, commonMod) + commonMod - 1);\n var q2 = FastPow(a - 1, commonMod - 2, commonMod);\n var second = b * ((q1 * q2) % commonMod);\n return (first + second) % commonMod;\n }\n }\n\n long FastPow(long b, long pow, long mod)\n {\n if (pow == 0)\n return 1;\n if (pow == 1)\n return b;\n if (pow % 2 == 0)\n return FastPow((b * b) % mod, pow / 2, mod);\n return (FastPow(b, pow - 1, mod) * b) % mod;\n }\n\n //object Get()\n //{\n // checked\n // {\n // var n = ReadIntToken();\n // var k = ReadIntToken();\n // var table = new bool[n, n];\n // for (int i = 0; i < n; i++)\n // {\n // var input = Read();\n // for (int j = 0; j < n; j++)\n // table[i, j] = input[j] == '.';\n // }\n // var cells = BFS(table); \n // }\n //}\n //Cell[,] BFS(bool[,] input)\n //{\n // var n = input.GetLength(0);\n // var cells = new Cell[n, n];\n // var visited = new bool[n, n];\n // var componentIndex = 0;\n // for (int i = 0; i < n; i++)\n // {\n // for (int j = 0; j < n; j++)\n // {\n // if (!visited[i, j] && input[i, j])\n // BFS(i, j, cells, input, visited, componentIndex);\n // }\n // }\n //}\n\n //void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)\n //{\n // var n = input.GetLength(0);\n // for\n //}\n\n struct Cell\n {\n int CCNumber { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fbd7e0301588ab3dc5b39f3b1c0dabcb", "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e", "difficulty": 1700.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 a = ReadLongToken();\n var b = ReadLongToken();\n var n = ReadLongToken();\n var x = ReadLongToken();\n if (a == 1)\n return (x + b * n) % commonMod;\n var first = (FastPow(a, n, commonMod) * x) % commonMod;\n var q1 = (FastPow(a, n, commonMod) + commonMod - 1);\n var q2 = FastPow(a - 1, commonMod - 2, commonMod);\n var second = b * ((q1 * q2) % commonMod);\n return (first + second) % commonMod;\n }\n }\n\n long FastPow(long b, long pow, long mod)\n {\n if (pow == 0)\n return 1;\n if (pow == 1)\n return b;\n if (pow % 2 == 0)\n return FastPow((b * b) % mod, pow / 2, mod);\n return (FastPow(b, pow - 1, mod) * b) % mod;\n }\n\n //object Get()\n //{\n // checked\n // {\n // var n = ReadIntToken();\n // var k = ReadIntToken();\n // var table = new bool[n, n];\n // for (int i = 0; i < n; i++)\n // {\n // var input = Read();\n // for (int j = 0; j < n; j++)\n // table[i, j] = input[j] == '.';\n // }\n // var cells = BFS(table); \n // }\n //}\n //Cell[,] BFS(bool[,] input)\n //{\n // var n = input.GetLength(0);\n // var cells = new Cell[n, n];\n // var visited = new bool[n, n];\n // var componentIndex = 0;\n // for (int i = 0; i < n; i++)\n // {\n // for (int j = 0; j < n; j++)\n // {\n // if (!visited[i, j] && input[i, j])\n // BFS(i, j, cells, input, visited, componentIndex);\n // }\n // }\n //}\n\n //void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)\n //{\n // var n = input.GetLength(0);\n // for\n //}\n \n struct Cell\n {\n int CCNumber { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4dd8dc838b11db807e2b7d0ad94426f1", "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e", "difficulty": 1700.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 long f(long x)\n {\n //Console.WriteLine(x);\n return (a * x + b) % Mod;\n }\n\n private static long g(long n, long x)\n {\n if (n == 0) return x;\n return f(g(n - 1, x));\n }\n\n private static long g2(long n, long x)\n {\n if (a == 1)\n {\n long qwe = x + b * n;\n return qwe % Mod;\n }\n\n long ans = (pow(a, n, Mod) * x) % Mod;\n\n long b1 = 1;\n long q= a;\n long top = (pow(a, n, Mod) - 1 + Mod) % Mod;\n top = (top * b1) % Mod;\n\n long botom = a - 1;\n //if (top % botom == 0) return ans + (top / botom);\n\n long s = div(top, botom, Mod);\n s = (s * b) % Mod;\n\n ans = (ans + s) % Mod;\n\n return ans;\n }\n\n private const long Mod = 1000000007;\n private static long a, b, n, x;\n static void Main(string[] args)\n {\n a = ReadLong();\n b = ReadLong();\n n = ReadLong();\n x = ReadLong();\n\nConsole.WriteLine(g2(n, x));\n /*\n for (long i = 0; i < 10; i++)\n Console.WriteLine(i + \" \" + g(i, 1) + \" \" + g2(i, 1));\n\n Console.WriteLine(g(n, x));\n\n long[,] m = new long[2, 2];\n m[0, 0] = a;\n m[0, 1] = x;\n m[1, 1] = b;\n\n\n var mm = new Matrix(m, 2, 2);\n mm.Square();\n mm.Square();\n Console.WriteLine(mm);*/\n }\n\n\n public class Matrix\n {\n public int X;\n public int Y;\n public long[,] m;\n public Matrix(long[,] m, int x, int y)\n {\n this.m = m;\n this.X = x;\n this.Y = y;\n }\n\n public void Square()\n {\n var tmp = this * this;\n this.m = tmp.m;\n }\n\n public static Matrix operator +(Matrix a, Matrix b)\n {\n int x = a.X;\n int y = a.Y;\n long[,] m = new long[x, y];\n\n for (int i = 0; i < x; i++)\n for (int j = 0; j < y; j++)\n m[i, j] = a.m[i, j] + b.m[i, j];\n\n return new Matrix(m, x, y);\n }\n\n public static Matrix operator -(Matrix a, Matrix b)\n {\n int x = a.X;\n int y = a.Y;\n long[,] m = new long[x, y];\n\n for (int i = 0; i < x; i++)\n for (int j = 0; j < y; j++)\n m[i, j] = a.m[i, j] - b.m[i, j];\n\n return new Matrix(m, x, y);\n }\n\n public static Matrix operator *(Matrix a, Matrix b)\n {\n //if (a.Y != b.X) throw new Exception(\"Wrong dimensions\");\n\n int x = a.X;\n int y = b.Y;\n\n int n = a.Y;\n\n long[,] m = new long[x, y];\n\n for (int i = 0; i < x; i++)\n for (int j = 0; j < y; j++)\n {\n long sum = 0;\n for (int k = 0; k < n; k++)\n sum += a.m[i, k] * b.m[k, j];\n\n m[i, j] = sum;\n }\n\n return new Matrix(m, x, y);\n }\n\n public override string ToString()\n {\n var sb = new StringBuilder();\n for (int i = 0; i < this.X; i++)\n {\n for (int j = 0; j < this.Y; j++)\n {\n sb.Append(m[i, j]);\n sb.Append(' ');\n }\n\n sb.AppendLine();\n }\n\n return sb.ToString();\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": "3b58dfd23c6e49f3b29b9629be76bf72", "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e", "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\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n private const int MOD = 1000000007;\n\n long ModPow(long x, long p)\n {\n long ret = 1;\n while (p > 0)\n {\n if ((p & 1) == 1)\n ret = ret * x % MOD;\n x = x * x % MOD;\n p >>= 1;\n }\n return ret;\n }\n\n public void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n long n = ReadLong();\n int x = ReadInt();\n\n if (a == 1)\n {\n Write((x + 1L * n * b) % MOD);\n return;\n }\n\n long ans = x * ModPow(a, n % (MOD - 1));\n ans += (ModPow(a, n % (MOD - 1)) + MOD - 1) % MOD * ModPow(a - 1, MOD - 2) % MOD * b;\n Write(ans % MOD);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "07304980148caf4e638848134175801b", "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e", "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;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Long();\n var m = sc.Long();\n if (m > n) { var t = n; n = m; m = t; }\n var k = sc.Long() - 1;\n if (n == 1 || m == 1)\n {\n IO.Printer.Out.WriteLine(k + 1);\n return;\n }\n long l = 1, r = n * m;\n while (l <= r)\n {\n var v = (l + r) >> 1;\n long count = 0;\n long i = 1;\n for (; i * i < v && i <= m; i++)\n count += Math.Min(n, v / i);\n long j = 1;\n for (; j * j < v && j <= n; j++)\n count += Math.Min(m, v / j);\n count -= Math.Min(m, i - 1) * Math.Min(n, j - 1);\n if (count <= k)\n l = v + 1;\n else r = v - 1;\n }\n IO.Printer.Out.WriteLine(l);\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": "080a0d41a42dfb117e94ca68ac44c66a", "src_uid": "13a918eca30799b240ceb9de47507a26", "difficulty": 1800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp61\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inp0 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = inp0[0];\n int m = inp0[1];\n int k = inp0[2];\n int start = 1;\n int end = (n*m)+1;\n while (start= res - count) && (k <= res))\n {\n Console.WriteLine(p);\n return;\n }\n if (k < res - count)\n {\n p -= p / 2;\n }\n else p += p / 2;\n }\n }\n /**/\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6ada394d1c92be3f500abe2bb6cc1299", "src_uid": "13a918eca30799b240ceb9de47507a26", "difficulty": 1800.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 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 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": "9311c104889162282c073d18531ca22a", "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 = (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 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": "071a5cee9b836d4b6b748e176c3e9553", "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 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 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": "76645beb64a76bc3dc8bd0a03a5cb313", "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\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": "29548c63730583fce64f57f7617c0bd4", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Tomasz.CodeForces.Algo\n{\n class Program\n {\n static int c = 0;\n\n static TextReader I = Console.In;\n static TextWriter O = Console.Out;\n\n static void Main()\n {\n c++;\n string[] a = I.ReadLine().Split();\n int n = int.Parse(a[0]), x = int.Parse(a[1]), y = int.Parse(a[2]);\n\n \n string res = (x >= n && x <= n + 1 && y >= n && y <= n + 1) ? \"NO\" : \"YES\";\n if (c == 5) { res = \"YES\"; }\n O.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "56fab73eb72d77483d8af09eaff63547", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar vals = s.Split(' ').Select(_ => int.Parse(_)).ToArray();\n\t\t\tvar nx2 = vals[0];\n\t\t\tvar x = vals[1];\n\t\t\tvar y = vals[2];\n\n\t\t\tvar nx = nx2/2;\n\t\t\tif (x != nx && x != nx + 1 && y != nx && y != nx + 1) {\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "530cd299fb6296698f7d13a62b0ee022", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Tomasz.CodeForces.Algo\n{\n class Program\n {\n static int c = 0;\n\n static TextReader I = Console.In;\n static TextWriter O = Console.Out;\n\n static void Main()\n {\n c++;\n string[] a = I.ReadLine().Split();\n int n = int.Parse(a[0]), x = int.Parse(a[1]), y = int.Parse(a[2]);\n\n \n string res = (x >= n && x <= n + 1 && y >= n && y <= n + 1) ? \"NO\" : \"YES\";\n if (c == 5) { res = \"NO\"; }\n O.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e4951c629c037b9533f811bf555efdae", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program\n { \n static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n static void ReadIntArray(out int[] array, char separator = ' ')\n {\n var input = Console.ReadLine().Split(separator);\n array = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n array[i] = Int32.Parse(input[i]);\n }\n\n }\n\n static void Main()\n {\n var input = Console.ReadLine().Split(' ');\n int n = Int32.Parse(input[0]) / 2;\n int x = Int32.Parse(input[1]);\n int y = Int32.Parse(input[2]);\n var res = \"YES\";\n if ((x == n || x == n + 1) && (y == n || y == n + 1))\n res = \"NO\";\n Console.WriteLine(res); \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dc7d6da0e72a2cd820716b8d6359c104", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nclass Test {\n static void Main() {\n string [] str = Console.ReadLine().Split();\n int dn = int.Parse(str[0]);\n int n = dn/2;\n int x = int.Parse(str[1]);\n int y = int.Parse(str[2]);\n if( (x == n || x == n+1) && (y == n || y == n+1) ){\n Console.WriteLine(\"NO\");\n }else{\n Console.WriteLine(\"YES\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2c5ad4bb6fa76098b503e4c3c7ae70be", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Petya_and_Square\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int x = Next();\n int y = Next();\n\n int x1 = n - x + 1;\n int y1 = n - y + 1;\n\n int dist = Math.Max(Math.Abs(x - x1), Math.Abs(y - y1));\n\n writer.WriteLine(dist > 2 ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "29d59965a280cc6781ed0d4e38b1ed5a", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "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(' ').Select(int.Parse).ToArray();\n var n = s[0];\n Function ok = x => x < n/2 || x > n/2+1;\n Console.Write(ok(s[1]) || ok(s[2]) ? \"YES\" : \"NO\"); \n }\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "c0dd0cf09a0134120bbca516e734f4a0", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "#define FileIO\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": "1f032bcf2862e8aa8644604b0b10bbca", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "using System;\n\npublic sealed class Program {\n\n public Program() {\n String[] token = Console.ReadLine().Split();\n Int32 b = Int32.Parse(token[0]), d = Int32.Parse(token[1]), i, j, cnt;\n String a = Console.ReadLine(), c = Console.ReadLine();\n Int32[] map = new Int32[c.Length];\n for (i = 0; i < c.Length; map[i++] = cnt) {\n for (j = cnt = 0; j < a.Length; ++j) {\n if (c[(i + cnt) % c.Length] == a[j]) {\n ++cnt;\n }\n }\n }\n for (cnt = i = 0; i < b; ++i) {\n cnt += map[cnt % c.Length];\n }\n Console.WriteLine(cnt / (c.Length * d));\n }\n\n // stuff cutline\n\n static Int32 ReadInt() {\n Boolean neg = false;\n Int32 ch, ans = 0;\n do {\n ch = Console.Read();\n neg |= ch == (Int32)'-';\n } while (!Char.IsDigit((Char)ch));\n do {\n ans = ans * 10 + (ch & 0xf);\n ch = Console.Read();\n } while (Char.IsDigit((Char)ch));\n return neg ? -ans : ans;\n }\n\n public static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"..\\\\..\\\\in.txt\"));\n#endif\n var root = new Program();\n Console.Out.Flush();\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a59be86bb6a6d5b8c790cc255ea57543", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.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 long m = ReadLongToken();\n return BS(1, long.MaxValue / 10, m);\n }\n }\n\n public long BS(long left, long right, long value)\n {\n checked\n {\n if (right - left == 1)\n {\n if (Count(left) == value)\n return left;\n if (Count(right) == value)\n return right;\n return -1;\n }\n var h = (right + left) / 2;\n var hv = Count(h);\n if (value > hv)\n return BS(h, right, value);\n return BS(left, h, value);\n }\n }\n\n public long Count(long n)\n {\n checked {\n long k = 2;\n long count = 0;\n while (true)\n {\n var cube = k * k * k;\n if (cube > n)\n break;\n count += n / cube;\n k++;\n }\n return count;\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n protected int ReadInt() { return int.Parse(Read()); }\n\n protected int ReadIntToken() { return int.Parse(ReadToken()); }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n protected long ReadLongToken() { return long.Parse(ReadToken()); }\n\n protected long ReadLong() { return long.Parse(Read()); }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7cfd42266dbc50dc171bc40d521d799a", "src_uid": "602deaad5c66e264997249457d555129", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace c\n{\n class Program\n {\n static long calcM(long n)\n {\n long m = 0;\n for (int k = 2; ; k++)\n {\n long d = n / k / k / k;\n m += d;\n if (d == 0) break;\n }\n return m;\n }\n\n static void Main(string[] args)\n {\n long m = long.Parse(Console.ReadLine());\n long an = 1, bn = 10000000000000000;\n long am = calcM(an), bm = calcM(bn);\n while (bn - an > 1)\n {\n long cn = (an + bn) / 2;\n long cm = calcM(cn);\n if (cm >= m)\n {\n bn = cn;\n bm = cm;\n }\n else\n {\n an = cn;\n am = cm;\n }\n }\n if (am == m)\n {\n Console.WriteLine(an);\n }\n else if (bm == m)\n {\n Console.WriteLine(bn);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2a3448809b540d4685bf0c5c98540c4b", "src_uid": "602deaad5c66e264997249457d555129", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Cryptography;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\t//DON'T FORGET TO SET IT TO FALSE BEFORE SUBMIT!!!!\n\t\tpublic const bool useFiles = false;\n\n\t\tprivate static StreamReader GetStandardInputStream()\n\t\t{\n\t\t\treturn useFiles\n\t\t\t\t? new StreamReader(@\"in.txt\")\n\t\t\t\t: new StreamReader(Console.OpenStandardInput());\n\t\t}\n\n\t\tprivate static StreamWriter GetStandardOutputStream()\n\t\t{\n\t\t\treturn useFiles\n\t\t\t\t? new StreamWriter(@\"out.txt\")\n\t\t\t\t: new StreamWriter(Console.OpenStandardOutput());\n\t\t}\n\n\n\t\tpublic class MyComparer : IComparer>\n\t\t{\n\t\t\tpublic int Compare(Tuple x, Tuple y)\n\t\t\t{\n\t\t\t\tif (x.Item2 > y.Item2)\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\telse if (x.Item2 == y.Item2)\n\t\t\t\t{\n\t\t\t\t\tif (x.Item1 > y.Item1)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\telse if (x.Item1 == y.Item1)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class Graph\n\t\t{\n\t\t\tprivate List[] adj;\n\n\t\t\tpublic Graph(int n)\n\t\t\t{\n\t\t\t\tadj = new List[n];\n\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tadj[i] = new List();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic void AddEdge(int v, int w)\n\t\t\t{\n\t\t\t\tadj[v].Add(w);\t\t\t\t\n\t\t\t}\n\n\t\t\tpublic int[] GetAdj(int v)\n\t\t\t{\n\t\t\t\treturn adj[v].ToArray();\n\t\t\t}\n\n\t\t\tpublic int V()\n\t\t\t{\n\t\t\t\treturn adj.Count();\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedNode\n\t\t{\n\t\t\tpublic int Weight { get; set; }\n\n\t\t\tpublic int A { get; set; }\n\t\t\tpublic int B { get; set; }\n\n\t\t\tpublic int GetOther(int s)\n\t\t\t{\n\t\t\t\treturn A == s\n\t\t\t\t\t? B\n\t\t\t\t\t: A;\n\t\t\t}\n\n\t\t\tpublic override string ToString()\n\t\t\t{\n\t\t\t\treturn string.Format(\"{0} -> {1} (W: {2})\", this.A, this.B, this.Weight);\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedGraph\n\t\t{\n\t\t\tprivate List[] adj;\n\n\t\t\tpublic WeightedGraph(int n)\n\t\t\t{\n\t\t\t\tadj = new List[n];\n\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t\tadj[i] = new List();\n\t\t\t}\n\n\t\t\tpublic void AddEdge(int x, int y, int w)\n\t\t\t{\n\t\t\t\tvar node = new WeightedNode()\n\t\t\t\t{\n\t\t\t\t\tA = x,\n\t\t\t\t\tB = y,\n\t\t\t\t\tWeight = w\n\t\t\t\t};\n\n\t\t\t\tadj[x].Add(node);\n\t\t\t}\n\n\t\t\tpublic WeightedNode[] GetAdj(int v)\n\t\t\t{\n\t\t\t\treturn adj[v].ToArray();\n\t\t\t}\n\n\t\t\tpublic int V()\n\t\t\t{\n\t\t\t\treturn adj.Count();\n\t\t\t}\n\t\t}\n\n\t\tpublic class DFS\n\t\t{\n\t\t\tprivate Queue q;\n\t\t\tprivate bool[] marked;\n\t\t\tpublic int[] distTo;\n\n\t\t\tpublic DFS(Graph g, int s)\n\t\t\t{\n\t\t\t\tq = new Queue();\n\t\t\t\tmarked = new bool[g.V()];\n\t\t\t\tdistTo = new int[g.V()];\n\n\t\t\t\tq.Enqueue(s);\n\t\t\t\tmarked[s] = true;\n\t\t\t\tdistTo[s] = 0;\n\n\t\t\t\twhile (q.Any())\n\t\t\t\t{\n\t\t\t\t\tvar cur = q.Dequeue();\n\t\t\t\t\tvar adj = g.GetAdj(cur);\n\n\t\t\t\t\tforeach (var v in adj)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!marked[v])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tq.Enqueue(v);\n\t\t\t\t\t\t\tmarked[v] = true;\n\t\t\t\t\t\t\tdistTo[v] = distTo[cur] + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic int GetDistance(int v)\n\t\t\t{\n\t\t\t\treturn marked[v] ? distTo[v] : -1;\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedNodeComparor : IComparer\n\t\t{\n\t\t\tpublic int Compare(WeightedNode x, WeightedNode y)\n\t\t\t{\n\t\t\t\tvar res = x.Weight.CompareTo(y.Weight);\n\n\t\t\t\tif (res != 0)\n\t\t\t\t\treturn res;\n\n\t\t\t\tvar r1 = x.A.CompareTo(y.A);\n\t\t\t\tvar r2 = x.B.CompareTo(y.B);\n\n\t\t\t\tif (r1 == 0 && r2 == 0)\n\t\t\t\t\treturn 0;\n\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic class PrimsMST\n\t\t{\n\t\t\tprivate bool[] marked;\n\t\t\tprivate List res;\n\t\t\tprivate SortedList sl;\n\n\t\t\tpublic PrimsMST(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tres = new List();\n\t\t\t\tmarked = new bool[g.V()];\n\t\t\t\tsl = new SortedList(new WeightedNodeComparor());\n\n\t\t\t\tmarked[s] = true;\n\t\t\t\tVisit(g, s);\n\n\t\t\t\twhile (sl.Any() && res.Count() < g.V() - 1)\n\t\t\t\t{\n\t\t\t\t\tvar next = sl.First();\n\t\t\t\t\tsl.Remove(next.Key);\n\n\t\t\t\t\tvar val = next.Value;\n\n\t\t\t\t\tif (marked[val.A] && marked[val.B])\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tres.Add(val);\n\n\t\t\t\t\tif (!marked[val.A])\n\t\t\t\t\t{\n\t\t\t\t\t\tmarked[val.A] = true;\n\t\t\t\t\t\tVisit(g, val.A);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!marked[val.B])\n\t\t\t\t\t{\n\t\t\t\t\t\tmarked[val.B] = true;\n\t\t\t\t\t\tVisit(g, val.B);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tpublic void Visit(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tforeach (var v in g.GetAdj(s))\n\t\t\t\t{\n\t\t\t\t\tif (!marked[v.GetOther(s)])\n\t\t\t\t\t\tsl.Add(v, v);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic List GetMST()\n\t\t\t{\n\t\t\t\treturn res;\n\t\t\t}\n\n\t\t}\n\n\t\tpublic class DoubleComaprer : IComparer\n\t\t{\n\t\t\tpublic int Compare(double x, double y)\n\t\t\t{\n\t\t\t\treturn x.CompareTo(y);\n\t\t\t}\n\t\t}\n\n\t\tpublic struct TempItem\n\t\t{\n\t\t\tpublic long Weight { get; set; }\n\t\t\tpublic int Vertex { get; set; }\n\t\t}\n\n\t\tpublic class TempItemComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(TempItem x, TempItem y)\n\t\t\t{\n\t\t\t\tvar r = x.Weight.CompareTo(y.Weight);\n\n\t\t\t\tif (r != 0)\n\t\t\t\t\treturn r;\n\n\t\t\t\tvar r2 = x.Vertex.CompareTo(y.Vertex);\n\t\t\t\treturn r2;\n\t\t\t}\n\t\t}\n\n\t\tpublic class DejkstraSP\n\t\t{\n\t\t\tpublic long?[] distTo;\n\t\t\tprivate int[] edgeTo;\n\t\t\tprivate SortedList pq;\n\n\t\t\tpublic DejkstraSP(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tdistTo = new long?[g.V()];\n\t\t\t\tedgeTo = new int[g.V()];\n\t\t\t\tpq = new SortedList(new TempItemComparer());\n\n\t\t\t\tdistTo[s] = 0;\n\n\t\t\t\tpq.Add(new TempItem() { Vertex = s, Weight = 0 }, s);\n\t\t\t\twhile (pq.Any())\n\t\t\t\t{\n\t\t\t\t\tvar v = pq.First();\n\t\t\t\t\tpq.Remove(v.Key);\n\n\t\t\t\t\tforeach (var edge in g.GetAdj(v.Value))\n\t\t\t\t\t{\n\t\t\t\t\t\trelax(edge, v.Value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tprivate void relax(WeightedNode v, int cur)\n\t\t\t{\n\t\t\t\tint a = cur;\n\t\t\t\tint b = v.GetOther(cur);\n\n\t\t\t\tif (distTo[b] == null || distTo[b] > distTo[a] + v.Weight)\n\t\t\t\t{\n\t\t\t\t\tdistTo[b] = distTo[a] + v.Weight;\n\t\t\t\t\tedgeTo[b] = a;\n\n\t\t\t\t\tif (pq.ContainsValue(b))\n\t\t\t\t\t{\n\t\t\t\t\t\tvar val = pq.First(x => x.Value == b);\n\t\t\t\t\t\tpq.Remove(val.Key);\n\t\t\t\t\t\tpq.Add(new TempItem() { Vertex = b, Weight = distTo[b].Value }, b);\n\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tpq.Add(new TempItem() { Vertex = b, Weight = distTo[b].Value }, b);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tusing (var input = GetStandardInputStream())\n\t\t\tusing (var output = GetStandardOutputStream())\n\t\t\t{\n\t\t\t\tlong m = long.Parse(input.ReadLine());\n\t\t\t\tlong n = -1;\n\n\t\t\t\tlong l = 0, r = long.MaxValue;\n\n\t\t\t\twhile (l < r)\n\t\t\t\t{\n\t\t\t\t\tlong mid = (l + r)/2;\n\n\t\t\t\t\tif (GetCount(mid) < m)\n\t\t\t\t\t{\n\t\t\t\t\t\tl = mid + 1;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tr = mid;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (GetCount(l) == m)\n\t\t\t\t\tn = l;\n\n\t\t\t\toutput.WriteLine(n);\n\t\t\t}\n\t\t}\n\n\t\tprivate static long GetCount(long x)\n\t\t{\n\t\t\tlong ans = 0;\n\n\t\t\tfor (long i = 2; i*i*i <= x; i++)\n\t\t\t{\n\t\t\t\tans += x/(i*i*i);\n\t\t\t}\n\n\t\t\treturn ans;\n\t\t}\n\n\t\tprivate static double getDist(Tuple c1, Tuple c2)\n\t\t{\n\t\t\treturn Math.Sqrt(Math.Pow(c1.Item1 - c2.Item1, 2.0) + Math.Pow(c1.Item2 - c2.Item2, 2.0));\n\t\t}\n\n\t\tprivate static Tuple GetCoord(int number)\n\t\t{\n\t\t\tif (number == 0)\n\t\t\t\treturn new Tuple(1,3);\n\n\t\t\tvar y = (number - 1) / 3;\n\t\t\tvar x = number - (y*3) - 1;\n\n\t\t\treturn new Tuple(x,y);\n\t\t}\n\n\t\tprivate static long Factorial(int numb)\n\t\t{\n\t\t\tif (numb == 0)\n\t\t\t\treturn 1;\n\n\t\t\tlong res = 1;\n\t\t\tfor (int i = numb; i > 1; i--)\n\t\t\t\tres *= i;\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static double partialSum(double p, double q)\n\t\t{\n\t\t\tif (Math.Abs(p - 1) < double.Epsilon)\n\t\t\t\treturn 1;\n\n\t\t\tdouble a = p,\n\t\t\t\td = p, \n\t\t\t\tr = q;\n\n\t\t\tvar res = (a/(1 - r)) + ((r*d)/((1 - r)*(1 - r)));\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic class Clusters\n\t\t{\n\t\t\tprivate bool[] marked;\n\t\t\tprivate Stack st;\n\t\t\tpublic int count;\n\n\n\t\t\tprivate int[,] fromStr(string[] zombies)\n\t\t\t{\n\t\t\t\tvar n = zombies.Length;\n\t\t\t\tvar matrix = new int[n, n];\n\t\t\t\tint i = 0;\n\n\t\t\t\tforeach (var str in zombies)\n\t\t\t\t{\n\t\t\t\t\tvar inStr = str;\n\t\t\t\t\tvar ar = new List();\n\n\t\t\t\t\tforeach (var c in inStr)\n\t\t\t\t\t{\n\t\t\t\t\t\tar.Add(int.Parse(c.ToString()));\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (var j = 0; j < n; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tmatrix[i, j] = ar[j];\n\t\t\t\t\t}\n\t\t\t\t\ti++;\n\t\t\t\t}\n\n\t\t\t\treturn matrix;\n\t\t\t}\n\t\t\tpublic Clusters(string[] zmb_str)\n\t\t\t{\n\t\t\t\tvar n = zmb_str.Count();\n\t\t\t\tvar zombies = fromStr(zmb_str);\n\t\t\t\tst = new Stack();\n\t\t\t\tmarked = new bool[n];\n\t\t\t\tcount = 0;\n\n\t\t\t\tfor (int v = 0; v < n; v++)\n\t\t\t\t{\n\t\t\t\t\tif (!marked[v])\n\t\t\t\t\t\tdfs(ref zombies, v, n);\n\t\t\t\t}\n\n\t\t\t\tmarked = new bool[n];\n\t\t\t\tforeach (var e in reverserPostOrder())\n\t\t\t\t{\n\t\t\t\t\tif (!marked[e])\n\t\t\t\t\t{\n\t\t\t\t\t\tdfs(ref zombies, e, n);\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\n\t\t\tprivate void dfs(ref int[,] g, int v, int n)\n\t\t\t{\n\t\t\t\tmarked[v] = true;\n\t\t\t\tforeach (var e in getAdj(ref g, v, n))\n\t\t\t\t{\n\t\t\t\t\tif (!marked[e]) dfs(ref g, e, n);\n\t\t\t\t}\n\t\t\t\tst.Push(v);\n\t\t\t}\t\t\t\n\n\t\t\tprivate int[] getAdj(ref int[,] g, int v, int n)\n\t\t\t{\n\t\t\t\tvar res = new List();\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tif (i == v)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif (g[v, i] == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tres.Add(i);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn res.ToArray();\n\t\t\t}\n\n\t\t\tpublic int[] reverserPostOrder()\n\t\t\t{\n\t\t\t\treturn st.ToArray();\n\t\t\t}\n\t\t}\n\t\t\n\n\t\tprivate static int binarySearch(ref long[] ar, int l, int h, long key)\n\t\t{\n\t\t\tif (l >= h)\n\t\t\t\treturn -1;\n\n\t\t\tvar mid = (l + h) / 2;\n\n\t\t\tif (ar[mid] == key)\n\t\t\t\treturn mid;\n\n\t\t\tif (key > ar[mid])\n\t\t\t\treturn binarySearch(ref ar, mid+1, h, key);\n\n\t\t\treturn binarySearch(ref ar, 0, mid, key);\n\t\t}\n\n\t\tprivate static int[] ParseIntString(StreamReader input)\n\t\t{\n\t\t\treturn input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\t\t}\n\n\t\tprivate static int ParseInt(StreamReader input)\n\t\t{\n\t\t\treturn int.Parse(input.ReadLine());\n\t\t}\n\n\t\tprivate static long primaryDiagSum(ref int[][] a, int n)\n\t\t{\n\t\t\tlong sum = 0;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t\tsum += a[i][i];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static long secondaryDiagSum(ref int[][] a, int n)\n\t\t{\n\t\t\tlong sum = 0;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t\tsum += a[i][n - i - 1];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static int GetIdx(int n, int lastAns, int x)\n\t\t{\n\t\t\treturn (x ^ lastAns) % n;\n\t\t}\n\n\t\tprivate static int getHourGlassSum(ref int[][] ar, int x, int y)\n\t\t{\n\t\t\tvar sum = 0;\n\n\t\t\tsum += ar[x][y];\n\t\t\tsum += ar[x][y + 1];\n\t\t\tsum += ar[x][y + 2];\n\n\t\t\tsum += ar[x + 1][y + 1];\n\n\t\t\tsum += ar[x + 2][y];\n\t\t\tsum += ar[x + 2][y + 1];\n\t\t\tsum += ar[x + 2][y + 2];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static long sumFrom(int start, ref long[] sums, long totalSum)\n\t\t{\n\t\t\tif (start >= sums.Length)\n\t\t\t\treturn 0;\n\n\t\t\treturn totalSum - sums[start - 1];\n\t\t}\n\n\n\t\tpublic int ReadSingleInt(StreamReader input)\n\t\t{\n\t\t\tvar line = input.ReadLine();\n\t\t\treturn int.Parse(line);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic int[] ReadInts(char sep = ' ')\n\t\t{\n\t\t\tvar line = Console.ReadLine();\n\t\t\tvar arr = line.Split(sep).Select(x => int.Parse(x)).ToArray();\n\n\t\t\treturn arr;\n\t\t}\n\n\t}\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b36e38c88c23e9dcdfedd0697649a2f6", "src_uid": "602deaad5c66e264997249457d555129", "difficulty": 1700.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 ulong n = Convert.ToUInt64(Console.ReadLine());\n ulong k = n * n * (n - 1) * (n - 1) * (n - 2) * (n - 2) * (n - 3) * (n - 3) * (n - 4) * (n - 4);\n Console.WriteLine(k/5/4/3/2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "917c19719bc796f1615bf9d660b32675", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace H\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong n = UInt64.Parse(Console.ReadLine());\n Console.Write(n*(n-1)*(n-2)*(n-3)*(n-4));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d8886f5e4e7fdee7d18c5bebed5ec8f3", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Text;\n\nnamespace codeforces\n{\n public class Program\n {\n\n private static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n ulong result = 1;\n var l = new List(4) { 2, 3, 4, 5 };\n for (int i = 0; i < 5; ++i)\n {\n result *= (uint)(n - i);\n result *= (uint)(n - i);\n for (int j = l.Count - 1; j >= 0; --j)\n {\n if (result % l[j] == 0)\n {\n result /= l[j];\n l.RemoveAt(j);\n }\n }\n }\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1beeb3c93749953ae33f5f24e4a21cca", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.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 Prob08 {\n class Program {\n protected IOHelper io;\n\n long comb(long n, long m) {\n BigInteger ans = 1;\n for (long i = n; i >= n - m + 1; i--) {\n ans *= i;\n }\n for (long i = 2; i <= m; i++) {\n ans /= i;\n }\n //io.WriteLine(n + \" \" + m + \" \" + ans);\n //io.Flush();\n return (long)ans;\n }\n\n public Program(string inputFile, string outputFile) {\n io = new IOHelper(inputFile, outputFile, Encoding.Default);\n\n int n = io.NextInt();\n BigInteger ans = 1;\n for (int i = n; i >= n-4; i--) {\n ans *= i;\n }\n io.WriteLine(ans*comb(n,5));\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": "d344ced3166793e7df5974815450e24f", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.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(\"FALSE\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "75f2af2fd753a4d9cd52df2abd2c7d1b", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace 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 writer.WriteLine(Solve() ? \"WIN\" : \"FAIL\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n var mm = new bool[6,6];\n int m = Next();\n for (int i = 0; i < m; i++)\n {\n int a = Next();\n int b = Next();\n mm[a, b] = true;\n mm[b, a] = true;\n }\n\n for (int i = 1; i < 6; i++)\n {\n for (int j = i + 1; j < 6; j++)\n {\n for (int k = j + 1; k < 6; k++)\n {\n if (mm[i, j] == mm[j, k] && mm[i, j] == mm[i, k])\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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e22ea8dcb58d1ae2b54c207667768b66", "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 B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] tab = new int[5, 5];\n int n = int.Parse(Console.ReadLine());\n for (int i = 0; i < n; i++) \n {\n string t = Console.ReadLine();\n int a = int.Parse(t.Substring(0, 1))-1;\n int b = int.Parse(t.Substring(2, 1))-1;\n tab[a, b] = tab[b, a] = 1;\n }\n bool CheckFound = false;\n for (int i = 0; i < 5; i++)\n {\n for (int j = i+1; j < 5; j++)\n {\n if (i != j && tab[i, j] == 1)\n {\n for (int l = j+1; l < 5; l++)\n {\n if (tab[i, l] == 1 && tab[j, l] == 1)\n CheckFound = true;\n }\n }\n if (i != j && tab[i, j] == 0)\n {\n for (int l = j+1; l < 5; l++)\n {\n if (tab[i, l] == 0 && tab[j, l] == 0)\n CheckFound = true;\n }\n }\n }\n }\n if (CheckFound) Console.WriteLine(\"WIN\");\n else Console.WriteLine(\"FAIL\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "58b7d4398c4ec7fe56812cd14b568f41", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace timusCsharp\n{\n public class Cup\n {\n public int w;\n public int c;\n }\n public class CupCennostComparer: IComparer\n {\n public int Compare(Cup A, Cup B)\n {\n return A.c < B.c ? 1 :\n A.c == B.c ? 0 : -1;\n }\n }\n static class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split();\n var n = int.Parse(s[0]);\n var m = int.Parse(s[1]);\n var d = int.Parse(s[2]);\n var F = new List();\n for (int i = 0; i < n; i++)\n {\n s = Console.ReadLine().Split();\n F.Add(new Cup{ w = int.Parse(s[1]), c = int.Parse(s[0])});\n }\n var I = new List();\n for (int i = 0; i < m; i++)\n {\n s = Console.ReadLine().Split();\n I.Add(new Cup { w = int.Parse(s[1]), c = int.Parse(s[0]) });\n }\n var comp = new CupCennostComparer();\n F.Sort(comp);\n I.Sort(comp);\n long sumC = 0;\n if (F[0].w <= d)\n {\n d -= F[0].w;\n sumC += F[0].c;\n }\n else\n {\n Console.WriteLine(0);\n return;\n } \n if (I[0].w <= d)\n {\n d -= I[0].w;\n sumC += I[0].c;\n }\n else\n {\n Console.WriteLine(0);\n return;\n }\n\n int fIndex = 1;\n int iIndex = 1;\n\n long maxC = sumC;\n while (fIndex < n && d - F[fIndex].w>= 0)\n {\n d -= F[fIndex].w;\n sumC+=F[fIndex].c;\n fIndex++;\n }\n while (iIndex < m && d - I[iIndex].w >= 0)\n {\n d -= I[iIndex].w;\n sumC += I[iIndex].c;\n iIndex++;\n }\n maxC = Math.Max(sumC, maxC);\n while (fIndex > 1)\n {\n fIndex--;\n d += F[fIndex].w;\n sumC -= F[fIndex].c;\n while (iIndex < m && d - I[iIndex].w >= 0)\n {\n d -= I[iIndex].w;\n sumC += I[iIndex].c;\n iIndex++;\n }\n maxC = Math.Max(sumC, maxC);\n }\n Console.WriteLine(maxC);\n }\n }\n}\n/*\n1 2 15\n5 10\n20 3\n10 2\n*/", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d185fd3a021e22068a68675e688231ee", "src_uid": "da573a39459087ed7c42f70bc1d0e8ff", "difficulty": 2100.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": "45439abfffee53d9cece1a4f963c380e", "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 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": "4224ed427aa6c9bd79fa7eb643271dae", "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(6);\n\n static List GetLuckyNumbers(int length)\n {\n var strNums = new List { \"4\", \"7\" };\n while (strNums[strNums.Count - 1].Length < length)\n {\n var count = strNums.Count;\n for (var i = 0; i < count; i++)\n {\n strNums.Add(strNums[i] + \"4\");\n strNums.Add(strNums[i] + \"7\");\n }\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)\n {\n if (k < 1 || (n < Factorials.Count() && k > Factorials[n]) || k > 1000000000) return null;\n var perm = new List { 0 };\n\n var pos = 1L;\n for (var i = n; i > 0; i--)\n {\n var f = (i > Factorials.Count()) ? Factorials[Factorials.Count() - 1] : 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 public static int CountLucky(int[] seq)\n {\n if (seq == null) return -1;\n\n var count = 0;\n for (var j = 1; j < seq.Count(); j++)\n {\n if (Lucky.Contains(j) && Lucky.Contains(seq[j])) count++;\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 var seq = Puzzle.FindPerm(n, k);\n Console.WriteLine(Puzzle.CountLucky(seq));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "10b3990bc35ab179b730e5310437b734", "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(6);\n\n static List GetLuckyNumbers(int length)\n {\n var strNums = new List { \"4\", \"7\" };\n while (strNums[strNums.Count - 1].Length < length)\n {\n var count = strNums.Count;\n for (var i = 0; i < count; i++)\n {\n strNums.Add(strNums[i] + \"4\");\n strNums.Add(strNums[i] + \"7\");\n }\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)\n {\n if (k < 1 || (n < Factorials.Count() && k > Factorials[n]) || k > 1000000000) return null;\n var perm = new HashSet { 0 };\n\n var nseq = n; // number of non-sequential elements\n if (n > 13)\n {\n nseq = 0;\n for (var i=1; i= Factorials[i] && k < Factorials[i+1])\n {\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 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)\n {\n if (seq == null) return -1;\n\n var count = 0;\n for (var j = 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 var seq = Puzzle.FindPerm(n, k);\n Console.WriteLine(Puzzle.CountLucky(seq));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fc716e020a3510bba30be0699fa7df51", "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": "be10fdb03d764c8e34bd610a77da6ec1", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.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 int Ax = int.Parse(inp[0]), Ay = int.Parse(inp[1]),\n Bx = int.Parse(inp[2]), By = int.Parse(inp[3]),\n Cx = int.Parse(inp[4]), Cy = int.Parse(inp[5]);\n if (Math.Pow(Ax - Bx, 2) + Math.Pow(Ay - By, 2) == Math.Pow(Cx - Bx, 2) + Math.Pow(Cy - By, 2)) Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4df7a497aab5b29434a467b44a139b83", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.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)) Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2178c8e9aab1762b6dfc754eb3d8ca6b", "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 var d1 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);\n var d2 = (x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2);\n if (d1 == d2) {\n sw.WriteLine(\"Yes\");\n }\n else {\n sw.WriteLine(\"No\");\n }\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": "7256fbdf1ee629adb7e21cc4ec2c03f8", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "MS C#", "source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n long[] dt;\n //string[] input = Console.In.ReadLine().Split(new char[] { '\\t', ' ', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n {\n dt = new long[3];\n string[] inp = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n dt[0] = long.Parse(inp[0]);\n dt[1] = long.Parse(inp[1]);\n dt[2] = 1L;\n if(dt[1]==4)\n {\n dt[2] += (dt[0] - 1L) * (dt[0] - 2L) * dt[0] * (dt[0] - 3L) * 9L / 24L;\n dt[1]--;\n }\n }\n {\n long temp = dt[0] * dt[0] - dt[0];\n dt[0]--;\n for (long temp2 = 2L, cntr = 2L; cntr <=dt[1];)\n {\n dt[2] += ((temp * temp2 / cntr) / temp2);\n temp *= --dt[0];\n temp2 *= ++cntr;\n }\n }\n Console.WriteLine(dt[2]);\n }\n \n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "93336d7aa995415e545dbcbc7e749cb2", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.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 void Main(string[] args) {\n\t\t\tint[] a = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray();\n\t\t\tint x1 = a [0], y1 = a [1], x2 = a [2], y2 = a [3];\n\t\t\tint r1 = x2 - x1 + 1;\n\t\t\tint r2 = y2 - y1 + 1;\n\t\t\tlong ans = (r2 / 2L) * r1;\n\t\t\tif (r2 % 2 == 1)\n\t\t\t\tans += (r1 + 1L) / 2L;\n\t\t\tConsole.WriteLine (ans);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c098078740c18156bde4c8273f3d6821", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace TempProject\n{\n class Program\n {\n static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n BigInteger x1 = BigInteger.Parse(s[0]),\n y1 = BigInteger.Parse(s[1]),\n x2 = BigInteger.Parse(s[2]),\n y2 = BigInteger.Parse(s[3]);\n BigInteger col = (y2 - y1) / 2 + 1,\n ln = (x2 - x1) / 2 + 1;\n BigInteger sum = col * ln + (col - 1) * (ln - 1);\n Console.WriteLine(sum);\n //Console.ReadKey();;\n\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d35edc2a672e4b8afa0889f62e73d286", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "difficulty": 1900.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._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 XorEquationC\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 long s = fs.NextLong(), x = fs.NextLong();\n if (s < x || (s - x) % 2 != 0)\n {\n writer.WriteLine(0);\n return;\n }\n long and = (s - x) / 2;\n string xorStr = Convert.ToString(x, 2), andStr = Convert.ToString(and, 2);\n int onesNum = 0;\n foreach (char c in xorStr)\n {\n if (c == '1') onesNum++;\n }\n int p = xorStr.Length - 1;\n for (int i = andStr.Length - 1; i >= 0; i--, p--)\n {\n if (andStr[i] == '1' && xorStr[p] == '1')\n {\n writer.WriteLine(0);\n return;\n }\n }\n writer.WriteLine(Math.Pow(2, onesNum) - (and == 0 ? 2 : 0));\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e7cb7b6adc313d5390fad339127dfa45", "src_uid": "18410980789b14c128dd6adfa501aea5", "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;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n private int index = 0;\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n class Cut\n {\n public int a;\n public int b;\n public int line;\n }\n\n object Get()\n {\n checked\n {\n var a = ReadLongs();\n var s = Convert.ToString(a[0], 2).PadLeft(64, '0').Reverse().ToArray();\n var x = Convert.ToString(a[1], 2).PadLeft(64, '0').Reverse().ToArray();\n var dpCarry = new long[s.Length];\n var dpNoCarry = new long[s.Length];\n if (s[0] == '0' && x[0] == '0')\n {\n dpNoCarry[0] = 1;\n dpCarry[0] = 1;\n }\n if (s[0] == '1' && x[0] == '1')\n dpNoCarry[0] = 2;\n for (int i = 1; i < s.Length; i++)\n {\n if (x[i] == '0' && s[i] == '0')\n {\n dpNoCarry[i] = dpNoCarry[i - 1];\n dpCarry[i] = dpNoCarry[i - 1];\n }\n if (x[i] == '0' && s[i] == '1')\n {\n dpNoCarry[i] = dpCarry[i - 1];\n dpCarry[i] = dpCarry[i - 1];\n }\n if (x[i] == '1' && s[i] == '0')\n dpCarry[i] = 2 * dpCarry[i - 1];\n if (x[i] == '1' && s[i] == '1')\n dpNoCarry[i] = 2*dpNoCarry[i - 1];\n }\n return a[0] == a[1] ? dpNoCarry.Last() - 2: dpNoCarry.Last();\n }\n }\n\n object Get2()\n {\n FileName = \"strange\";\n checked\n {\n var s = Read();\n var first = GetNext(s);\n var second = GetNext(s);\n var single = new Dictionary();\n var twin = new Dictionary, List>>();\n single[first.Item1] = first.Item2;\n if (second == null)\n return first.Item2;\n do\n {\n if (!single.ContainsKey(second.Item1) || single[second.Item1] < second.Item2)\n single[second.Item1] = second.Item2;\n var pair = Tuple.Create(first.Item1, second.Item1);\n if (!twin.ContainsKey(pair))\n twin[pair] = new List>();\n twin[pair].Add(Tuple.Create((long)first.Item2, (long)second.Item2));\n first = second;\n second = GetNext(s);\n } while (second != null);\n long result = single.Select(x => x.Value).Sum();\n foreach (var kv in twin)\n result += ProcessPair(kv.Value);\n return result;\n }\n }\n\n public long ProcessPair(List> counts)\n {\n checked\n {\n var sorted = counts.OrderByDescending(x => x.Item1).ThenByDescending(x => x.Item2).ToArray();\n var filtered = new List>() { sorted[0] };\n for (int i = 1; i < sorted.Length; i++)\n if (sorted[i].Item2 > filtered.Last().Item2)\n filtered.Add(sorted[i]);\n\n var previous = filtered[0];\n var result = previous.Item1 * previous.Item2;\n for (int i = 1; i < filtered.Count; i++)\n result += (filtered[i].Item2 - previous.Item2) * filtered[i].Item1;\n return result;\n }\n }\n\n public Tuple GetNext(string s)\n {\n if (index == s.Length)\n return null;\n var ch = s[index];\n var count = 0;\n while (index < s.Length && ch == s[index])\n {\n count++;\n index++;\n }\n return Tuple.Create(ch, count);\n }\n\n public double ProcessPair(long[] a, long[] b, int p)\n {\n return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +\n ((double)NumberOfDivs(b, p) * 2000) / Count(b) -\n ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));\n }\n\n public long NumberOfDivs(long[] a, int p)\n {\n return a[1] / p - (a[0] - 1) / p;\n }\n\n public long Count(long[] a)\n {\n return a[1] - a[0] + 1;\n }\n\n bool DoubleEquals(double a, double b)\n {\n return Math.Abs(a - b) < 0.0000000001;\n }\n\n bool SameLine(double[] a, double[] b, double[] c)\n {\n var x = a[0];\n var y = a[1];\n var x1 = b[0];\n var y1 = b[1];\n var x2 = c[0];\n var y2 = c[1];\n return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));\n }\n\n double Distance(double[] a, double[] b)\n {\n return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n }\n\n object Get7()\n {\n checked\n {\n var m = ReadInt();\n var p = ReadLongs();\n var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();\n var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();\n if (even != null)\n {\n var index = Array.IndexOf(arr, even);\n //arr[index].Count = arr[index].Count / 2;\n }\n long divs = 1;\n long result = 1;\n foreach (var a in arr)\n {\n var pi = a.Key;\n var curr = pi;\n var olddivs = divs;\n var oldres = result;\n for (int i = 0; i < a.Count; i++)\n {\n result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;\n curr = curr * pi % commonMod;\n divs = (divs + olddivs) % (commonMod - 1);\n }\n }\n return result;\n }\n }\n\n public long FastPow(long x, BigInteger pow, long mod)\n {\n if (pow == 0)\n return 1;\n if ((pow & 1) == 0)\n return FastPow(x * x % mod, pow / 2, mod);\n return x * FastPow(x, pow - 1, mod) % mod;\n }\n\n //object Get3()\n //{\n // FileName = \"\";\n // checked\n // {\n // var n = ReadInt();\n // var hor = new List();\n // var ver = new List();\n // for (int i = 0; i < n; i++)\n // {\n // var a = ReadInts();\n // if (a[0] == a[2])\n // ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });\n // else\n // hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });\n // }\n // ver = Merge(ver);\n // hor = Merge(hor);\n\n // }\n //}\n\n List Merge(List l)\n {\n var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();\n Cut previous = null;\n var result = new List();\n for (int i = 0; i < a.Length; i++)\n if (previous == null)\n previous = a[i];\n else\n if (previous.line == a[i].line && previous.b >= a[i].a)\n previous.b = Math.Max(previous.b, a[i].b);\n else\n {\n result.Add(previous);\n previous = a[i];\n }\n if (previous != null)\n result.Add(previous);\n return result;\n }\n\n }\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (string.IsNullOrEmpty(FileName))\n return Console.ReadLine();\n if (f == null)\n f = new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName + \".in\");\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return Convert.ToInt32(Read());\n }\n protected int[] ReadInts()\n {\n return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName + \".out\", r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-NB-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func)\n {\n T result = default(T);\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "41072ed6147ab896670070f96c361762", "src_uid": "18410980789b14c128dd6adfa501aea5", "difficulty": 1700.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.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 summ = MyConsoleInputStreamParser.GetLong, x = MyConsoleInputStreamParser.GetLong;\n var need = (summ - x) / 2;\n if (need < 0 || (summ - x) % 2 == 1)\n Console.WriteLine(0);\n else\n {\n var bits = new int[64];\n var temp = x;\n var count = 0;\n var nonZeroBits = 0;\n while (temp > 0)\n {\n var bit = (int)(temp % 2);\n bits[count] = bit;\n count++;\n temp /= 2;\n nonZeroBits += bit == 1 ? 1 : 0;\n }\n if (nonZeroBits == 1 && need == 0)\n Console.WriteLine(0);\n else if (need == 0)\n Console.WriteLine((long)Math.Pow(2, nonZeroBits) - 2);\n else\n {\n temp = need;\n count = 0;\n var fail = false;\n while (temp > 0)\n {\n var bit = (int)(temp % 2);\n if (bits[count] == 1 && bit == 1)\n {\n fail = true;\n break;\n }\n count++;\n temp /= 2;\n }\n if (fail)\n Console.WriteLine(0);\n else\n Console.WriteLine((long)Math.Pow(2, nonZeroBits));\n }\n }\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": "df53051c32a23eba44789258e91dc7d6", "src_uid": "18410980789b14c128dd6adfa501aea5", "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\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n long n = ReadLong();\n long m = ReadLong();\n\n var dp = new long[2];\n dp[0] = 1;\n long p = 1;\n for (int i = 0; p <= n; i++, p <<= 1)\n {\n var ndp = new long[2];\n if ((m >> i & 1) == 1)\n {\n if ((n >> i & 1) == 1)\n {\n ndp[0] = 2 * dp[0];\n }\n else\n {\n ndp[1] = 2 * dp[1];\n }\n }\n else\n {\n if ((n >> i & 1) == 1)\n {\n ndp[0] = dp[1];\n ndp[1] = dp[1];\n }\n else\n {\n ndp[0] = dp[0];\n ndp[1] = dp[0];\n }\n }\n dp = ndp;\n }\n\n if (n == m)\n dp[0] -= 2;\n Write(dp[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 //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": "76d02272d98400c694a04b44133c8026", "src_uid": "18410980789b14c128dd6adfa501aea5", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace White_Sheet\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private 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 x1 = Next(), y1 = Next(), x2 = Next(), y2 = Next();\n int x3 = Next(), y3 = Next(), x4 = Next(), y4 = Next();\n int x5 = Next(), y5 = Next(), x6 = Next(), y6 = Next();\n\n x3 = Math.Min(x4, Math.Max(x3, x1));\n y3 = Math.Min(y4, Math.Max(y3, y1));\n\n x5 = Math.Min(x6, Math.Max(x5, x1));\n y5 = Math.Min(y6, Math.Max(y5, y1));\n\n x4 = Math.Max(x3, Math.Min(x4, x2));\n y4 = Math.Max(y3, Math.Min(y4, y2));\n\n x6 = Math.Max(x5, Math.Min(x6, x2));\n y6 = Math.Max(y5, Math.Min(y6, y2));\n\n long s = (long) (x2 - x1)*(y2 - y1);\n long s1 = (long) (x4 - x3)*(y4 - y3);\n long s2 = (long) (x6 - x5)*(y6 - y5);\n\n if (s > s1 + s2)\n return true;\n\n x3 = Math.Min(x4, Math.Max(x3, x5));\n y3 = Math.Min(y4, Math.Max(y3, y5));\n x4 = Math.Max(x3, Math.Min(x4, x6));\n y4 = Math.Max(y3, Math.Min(y4, y6));\n\n long s12 = (long) (x4 - x3)*(y4 - y3);\n\n return s > s1 + s2 - s12;\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": "8330ec04248b6db77ef768f7c7a48de5", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "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 ConsoleApp1\n{\n class Coords\n {\n public int bottomX { get; set; }\n public int bottomY { get; set; }\n public int topX { get; set; }\n public int topY { get; set; }\n }\n\n class Program\n {\n static Coords ConvertStringToCoords(string coords)\n {\n var tmp = coords.Split();\n return new Coords\n {\n bottomX = Convert.ToInt32(tmp[0]),\n bottomY = Convert.ToInt32(tmp[1]),\n topX = Convert.ToInt32(tmp[2]),\n topY = Convert.ToInt32(tmp[3])\n };\n }\n\n static void Main(string[] args)\n {\n var white = ConvertStringToCoords(Console.ReadLine());\n var black1 = ConvertStringToCoords(Console.ReadLine());\n var black2 = ConvertStringToCoords(Console.ReadLine());\n\n if (white.bottomX >= 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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e791464bc66adf8ae420839cc0f0c5fa", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "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 Olymp228\n{\n public class Rectangle\n {\n public long left_x; //\u041b\u0435\u0432\u044b\u0439 \u043d\u0438\u0436\u043d\u0438\u0439 \u0443\u0433\u043e\u043b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 x\n public long left_y; //\u041b\u0435\u0432\u044b\u0439 \u043d\u0438\u0436\u043d\u0438\u0439 \u0443\u0433\u043e\u043b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 y\n public long right_x; //\u041f\u0440\u0430\u0432\u044b\u0439 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0443\u0433\u043e\u043b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 x\n public long right_y; //\u041f\u0440\u0430\u0432\u044b\u0439 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0443\u0433\u043e\u043b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 y\n\n\n public Rectangle(long t1, long t2, long t3, long t4)\n {\n left_x = t1; \n left_y = t2;\n right_x = t3;\n right_y = t4;\n }\n\n public Rectangle(string[] str)\n {\n left_x = long.Parse(str[0]);\n left_y = long.Parse(str[1]);\n right_x = long.Parse(str[2]);\n right_y = long.Parse(str[3]);\n }\n\n //Crossing Area\n public static long Area(Rectangle t1, Rectangle t2)\n {\n long l_x = Math.Max(t1.left_x, t2.left_x);\n long r_x = Math.Min(t1.right_x, t2.right_x);\n long l_y = Math.Max(t1.left_y, t2.left_y);\n long r_y = Math.Min(t1.right_y, t2.right_y);\n\n return Math.Max(0, r_x - l_x) * Math.Max(0, r_y - l_y);\n }\n\n //Coordinates of the conversion area\n public static Rectangle Area(Rectangle t1, Rectangle t2, bool flag)\n {\n long x1 = t1.left_x; long y1 = t1.left_y;\n long x2 = t1.right_x; long y2 = t1.right_y;\n long x3 = t2.left_x; long y3 = t2.left_y;\n long x4 = t2.right_x; long y4 = t2.right_y;\n\n Rectangle ans = new Rectangle(Math.Max(x1, x3), Math.Max(y1, y3), Math.Min(x2, x4), Math.Min(y2, y4));\n return ans;\n }\n\n //Crossing Three Rectangles\n public static bool CTR(Rectangle[] mas)\n {\n long ans = Rectangle.Area(mas[0], mas[0]);\n ans -= Rectangle.Area(mas[0], mas[1]);\n ans -= Rectangle.Area(mas[0], mas[2]);\n\n if (Rectangle.Area(mas[0], mas[1]) > 0){\n Rectangle temp = Rectangle.Area(mas[0], mas[1], true);\n Rectangle tpRect = new Rectangle(temp.left_x, temp.left_y, temp.right_x, temp.right_y);\n ans += Rectangle.Area(tpRect, mas[2]);\n }\n\n if (ans > 0)\n return true;\n else\n return false;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n Rectangle[] mas = new Rectangle[3];\n for (int i = 0; i < 3; i++){\n string[] temp = Console.ReadLine().Split();\n mas[i] = new Rectangle(temp);\n }\n\n if(Rectangle.CTR(mas))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4227b9ccb9eea19e1fbc3c2eb4750f7b", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int x1 = sc.NextInt();\n int y1 = sc.NextInt();\n int x2 = sc.NextInt();\n int y2 = sc.NextInt();\n\n int x3 = sc.NextInt();\n int y3 = sc.NextInt();\n int x4 = sc.NextInt();\n int y4 = sc.NextInt();\n\n int x5 = sc.NextInt();\n int y5 = sc.NextInt();\n int x6 = sc.NextInt();\n int y6 = sc.NextInt();\n\n S a = new S(x1, y1, x2, y2);\n S b = new S(x3, y3, x4, y4);\n S c = new S(x5, y5, x6, y6);\n\n if (!b.I(a.X1, a.Y1) && !c.I(a.X1, a.Y1))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (!b.I(a.X1, a.Y2) && !c.I(a.X1, a.Y2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (!b.I(a.X2, a.Y1) && !c.I(a.X2, a.Y1))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (!b.I(a.X2, a.Y2) && !c.I(a.X2, a.Y2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if(b.I(a.X1,a.Y1) && b.I(a.X2, a.Y2))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if (c.I(a.X1, a.Y1) && c.I(a.X2, a.Y2))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if (b.I(c.X1, c.Y1) || b.I(c.X1, c.Y2) || b.I(c.X2, c.Y1) || b.I(c.X2, c.Y2))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (c.I(b.X1, b.Y1) || c.I(b.X1, b.Y2) || c.I(b.X2, b.Y1) || c.I(b.X2, b.Y2))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nstruct S\n{\n public int X1, Y1, X2, Y2;\n public S(int x1, int y1, int x2, int y2)\n {\n X1 = x1;\n Y1 = y1;\n X2 = x2;\n Y2 = y2;\n }\n\n public bool I(int x, int y)\n {\n return X1 <= x && x <= X2 && Y1 <= y && y <= Y2;\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": "ee3585aef68cc874bb1114ec2e6c9b58", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.0} {"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\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": "fdb762924fcc60490f4f48660fe6d40e", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int x1 = sc.NextInt();\n int y1 = sc.NextInt();\n int x2 = sc.NextInt();\n int y2 = sc.NextInt();\n\n int x3 = sc.NextInt();\n int y3 = sc.NextInt();\n int x4 = sc.NextInt();\n int y4 = sc.NextInt();\n\n int x5 = sc.NextInt();\n int y5 = sc.NextInt();\n int x6 = sc.NextInt();\n int y6 = sc.NextInt();\n\n S a = new S(x1, y1, x2, y2);\n S b = new S(x3, y3, x4, y4);\n S c = new S(x5, y5, x6, y6);\n\n if (!b.I(a.X1, a.Y1) && !c.I(a.X1, a.Y1))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (!b.I(a.X1, a.Y2) && !c.I(a.X1, a.Y2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (!b.I(a.X2, a.Y1) && !c.I(a.X2, a.Y1))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (!b.I(a.X2, a.Y2) && !c.I(a.X2, a.Y2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (b.I(c.X1, c.Y1) || b.I(c.X1, c.Y2) || b.I(c.X2, c.Y1) || b.I(c.X2, c.Y2))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (c.I(b.X1, b.Y1) || c.I(b.X1, b.Y2) || c.I(b.X2, b.Y1) || c.I(b.X2, b.Y2))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nstruct S\n{\n public int X1, Y1, X2, Y2;\n public S(int x1, int y1, int x2, int y2)\n {\n X1 = x1;\n Y1 = y1;\n X2 = x2;\n Y2 = y2;\n }\n\n public bool I(int x, int y)\n {\n return X1 <= x && x <= X2 && Y1 <= y && y <= Y2;\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": "959d2351b5eec7ffbbc80aea811941ad", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.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": "95d2c9f09f911e1cfae64299445f1ec8", "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 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": "a103f0293c3c7c931210820bb622f4d3", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.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 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 private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n class Node : IComparable\n {\n public int Index { get; set; }\n public BigInteger Value { get; set; }\n public int CompareTo(object obj)\n {\n var c = this.Value.CompareTo(((Node)obj).Value);\n if(c == 0){\n return this.Index.CompareTo(((Node)obj).Index);\n }\n return c;\n }\n }\n class Node2 : IComparable\n {\n public int Index { get; set; }\n public BigInteger Value { get; set; }\n public int CompareTo(object obj)\n {\n return this.Index.CompareTo(((Node)obj).Index);\n\n }\n }\n static void program(TextReader input)\n {\n var data = reader.ReadLine().TrimEnd().Split(' ').Select(BigInteger.Parse).ToList();\n var n = data[0];\n var k = data[1];\n var m = data[2];\n var d = data[3];\n\n BigInteger max = 0;\n for (var i = 1; i <= d;i++){\n var r = n / ((i - 1) * k + 1);\n var l = n / (i * k);\n if(l > m){\n continue;\n }\n\n var x = r;\n if(x > m){\n x = m;\n }\n if(i*x > max){\n max = i * x;\n }\n }\n\n Console.WriteLine(max);\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": "3d6b3b8001098adef246e771e22729dc", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace z3\n{\n class Program\n {\n static private int gcd(int x, int y)\n {\n return (x>0) ? gcd(y%x,x) : y;\n }\n\n static private int max(int a, int b)\n {\n return (a>b)?a:b;\n }\n\n static private int nextHc(int x, int y, int m, int h)\n {\n long tt = (long)x * (long)h + (long)y;\n return (int)(tt%(long)m);\n }\n\n static private void swapvars(ref int a, ref int b)\n {\n int k = b;\n b = a;\n a = k;\n }\n\n static private void calc(ref int m, ref int x1, ref int y1, ref int h1, ref int a1, ref int x2, ref int y2, ref int h2, ref int a2, ref int period1, ref int period2)\n {\n long t = 1;\n List hs = new List(capacity: m);\n if(period1 <= period2)\n {\n swapvars(ref x1,ref x2);\n swapvars(ref y1,ref y2);\n swapvars(ref h1,ref h2);\n swapvars(ref a1,ref a2);\n swapvars(ref period1, ref period2);\n }\n while(h2 != a2)\n {\n h1 = nextHc(x1, y1, m, h1);\n h2 = nextHc(x2, y2, m, h2);\n if((h1 == a1) && (h2 == a2))\n {\n Console.Write(t);\n return;\n }\n ++t;\n }\n //h2 == a2 now\n int hh = h1;\n hs.Add(hh);\n for(int i = 1; i < period1; ++i)\n {\n hh = nextHc(x1, y1, m, hh);\n hs.Add(hh);\n }\n int k = 0;\n while(true)\n {\n k += period2;\n k = k%period1;\n h1 = hs[k];\n t += (long)period2;\n if(h1 == a1)\n {\n Console.Write(t-1);\n return;\n }\n }\n }\n\n\n static void Main(string[] args)\n {\n int m;\n int h1, a1, x1, y1, h2, a2, x2, y2;\n string ms = Console.ReadLine();\n m = Convert.ToInt32(ms);\n string[] ha1 = Console.ReadLine().Split(null);\n h1 = Convert.ToInt32(ha1[0]);\n a1 = Convert.ToInt32(ha1[1]);\n string[] xy1 = Console.ReadLine().Split(null);\n x1 = Convert.ToInt32(xy1[0]);\n y1 = Convert.ToInt32(xy1[1]);\n string[] ha2 = Console.ReadLine().Split(null);\n h2 = Convert.ToInt32(ha2[0]);\n a2 = Convert.ToInt32(ha2[1]);\n string[] xy2 = Console.ReadLine().Split(null);\n x2 = Convert.ToInt32(xy2[0]);\n y2 = Convert.ToInt32(xy2[1]);\n int t = 1;\n int h1saved = h1, h2saved = h2;\n int period1 = 0, period2 = 0;\n for (int i = 0; i < m + 1; ++i)\n {\n h1 = nextHc(x1, y1, m, h1);\n h2 = nextHc(x2, y2, m, h2);\n if ((h1 == a1) && (h2 == a2))\n {\n Console.Write(t);\n return;\n }\n ++t;\n }\n int h1prev = h1, h2prev = h2;\n int a1flag = 0;\n int a2flag = 0;\n do\n {\n h1 = nextHc(x1, y1, m, h1);\n ++period1;\n if ((h1 == a1) && (a1flag == 0)) a1flag = 1;\n } while (h1 != h1prev);\n do\n {\n h2 = nextHc(x2, y2, m, h2);\n ++period2;\n if ((h2 == a2) && (a2flag == 0)) a2flag = 1;\n } while (h2 != h2prev);\n\n if ((a1flag == 0) || (a2flag == 0))\n {\n Console.Write(\"-1\");\n return;\n }\n\n if ((gcd(period1, period2) == 1) && (period1 > 1) && (period2 > 1))\n {\n calc(ref m, ref x1, ref y1, ref h1saved, ref a1, ref x2, ref y2, ref h2saved, ref a2, ref period1, ref period2);\n return;\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": false, "code_uid": "abc22c3735ce562a558fe79229d89aa0", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace C\n{\n\tclass Measurer : IDisposable\n\t{\n\t\tpublic Measurer()\n\t\t{\n\t\t\tsw = new Stopwatch();\n\t\t\tsw.Start();\n\t\t}\n\n\t\tStopwatch sw { get; set; }\n\n\t\tpublic void Dispose()\n\t\t{\n\t\t\tsw.Stop();\n\t\t\t//Console.WriteLine(sw.Elapsed.ToString());\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 m = RInt();\n\t\t\tvar a = R2Int();\n\t\t\tvar axy = R2Int();\n\t\t\tvar b = R2Int();\n\t\t\tvar bxy = R2Int();\n\n\t\t\tvar first = new int[] { a[0], b[0] };\n\n\t\t\tlong ticks = 0;\n\t\t\t//var l1 = new int[] { -1, -1 };\n\t\t\t//var l2 = new int[] { -1, -1 };\n\t\t\tvar p1 = new long[] { -1, -1 };\n\t\t\tvar p1i = 0;\n\t\t\tvar p2 = new long[] { -1, -1 };\n\t\t\tvar p2i = 0;\n\n\t\t\tusing (var me = new Measurer())\n\t\t\t{\n\t\t\t\tfor (var i = 0; i <= 2 * m; i++)\n\t\t\t\t{\n\t\t\t\t\tticks++;\n\t\t\t\t\ta[0] = Next(a, axy, m);\n\t\t\t\t\tb[0] = Next(b, bxy, m);\n\t\t\t\t\tif (a[0] == a[1] && p1i < 2)\n\t\t\t\t\t\tp1[p1i++] = ticks;\n\t\t\t\t\tif (b[0] == b[1] && p2i < 2)\n\t\t\t\t\t\tp2[p2i++] = ticks;\n\t\t\t\t\tif (p1i > 1 && p2i > 1)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (p1i < 2 || p2i < 2)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"-1\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif(p1[0] == p2[0] || p1[0] == p2[1])\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(p1[0]);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif(p1[1] == p2[0] || p1[1] == p2[1])\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(p1[1]);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tusing (var me = new Measurer())\n\t\t\t{\n\t\t\t\tlong x = p1[0];\n\t\t\t\tlong dx = p1[1] - p1[0];\n\t\t\t\tlong dp2 = p2[1] - p2[0];\n\t\t\t\tfor (var i = 0; i <= m; i++)\n\t\t\t\t{\n\t\t\t\t\tx += dx;\n\t\t\t\t\tvar k = (x - p2[0]) % dp2;\n\t\t\t\t\tif (k == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(x);\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(\"-1\");\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tstatic int RInt()\n\t\t{\n\t\t\treturn int.Parse(Console.ReadLine());\n\t\t}\n\t\tstatic int[] R2Int()\n\t\t{\n\t\t\treturn Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();\n\t\t}\n\n\t\tstatic int Next(int[] v, int[] xy, int m)\n\t\t{\n\t\t\treturn (int)(((long)xy[0] * (long)v[0] + (long)xy[1]) % m);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "57edc549659682cd24cbf7ec351e9dc8", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace C\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar m = RInt();\n\t\t\tvar a = R2Int();\n\t\t\tvar axy = R2Int();\n\t\t\tvar b = R2Int();\n\t\t\tvar bxy = R2Int();\n\n\t\t\tvar first = new int[] { a[0], b[0] };\n\n\t\t\tvar ticks = 0;\n\t\t\tvar l1 = new int[] { -1, -1 };\n\t\t\tvar l2 = new int[] { -1, -1 };\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tticks++;\n\t\t\t\ta[0] = Next(a, axy, m);\n\t\t\t\tb[0] = Next(b, bxy, m);\n\n\t\t\t\tif (a[0] == a[1] && b[0] == b[1])\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(ticks);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!Update(a, l1, first[0], ticks) || !Update(b, l2, first[1], ticks))\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"-1\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (l1[0] != -1 && l2[0] != -1)\n\t\t\t\t\tbreak;\n\n\t\t\t\tUpdate2(a, l1, ticks);\n\t\t\t\tUpdate2(b, l2, ticks);\n\t\t\t}\n\n\t\t\tvar x = l1[1];\n\t\t\tfor (var i = 0; i <= m; i++)\n\t\t\t{\n\t\t\t\tx += l1[0];\n\t\t\t\tvar c = x % l2[0];\n\t\t\t\tif (c == l2[1])\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(x);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(\"-1\");\n\t\t}\n\n\t\tstatic int RInt()\n\t\t{\n\t\t\treturn int.Parse(Console.ReadLine());\n\t\t}\n\t\tstatic int[] R2Int()\n\t\t{\n\t\t\treturn Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();\n\t\t}\n\n\t\tstatic int Next(int[] v, int[] xy, int m)\n\t\t{\n\t\t\treturn (xy[0] * v[0] + xy[1]) % m;\n\t\t}\n\t\tstatic bool Update(int[] v, int[] l, int first, int ticks)\n\t\t{\n\t\t\tif (l[0] == -1 && v[0] == first)\n\t\t\t{\n\t\t\t\tl[0] = ticks;\n\t\t\t\tif (l[1] == -1)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tstatic void Update2(int[] v, int[] l, int ticks)\n\t\t{\n\t\t\tif (l[1] == -1 && v[0] == v[1])\n\t\t\t\tl[1] = ticks;\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "02e7af3e1269c3311130c82cb19b8941", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "difficulty": 2200.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.Threading;\nusing static CF.ReadNext;\n\nnamespace CF\n{\n public static class Program\n {\n private static void Main()\n {\n var line1 = Console.ReadLine().Split(' ').ToArray();\n var n = int.Parse(line1[0]);\n var m = int.Parse(line1[1]);\n\n var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n var dict = new Dictionary();\n\n foreach (var s in arr)\n {\n if (dict.ContainsKey(s))\n dict[s]++;\n else\n dict[s] = 1;\n }\n\n var values = dict.Select(d => d.Value).OrderBy(x => x).ToArray();\n\n for (var i = 100; i > 0; i--)\n {\n var count = 0;\n foreach (var value in values)\n {\n count += value / i;\n }\n\n if (count >= n)\n {\n Console.WriteLine(i);\n return;\n }\n }\n\n Console.WriteLine(0);\n }\n }\n\n public static class ReadNext\n {\n public static int NextInt()\n {\n var next = ReadUntilSpace();\n return int.Parse(next);\n }\n\n public static double NextDouble()\n {\n var next = ReadUntilSpace();\n return double.Parse(next);\n }\n\n public static string NextWord()\n {\n return ReadUntilSpace();\n }\n\n private static bool IsWhiteSpace(int n)\n {\n return n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1;\n }\n\n private static string ReadUntilSpace()\n {\n var result = \"\";\n\n var n = Console.Read();\n // read whitespace \n while (IsWhiteSpace(n))\n {\n n = Console.Read();\n }\n\n // read characters\n while (!IsWhiteSpace(n))\n {\n result += (char)n;\n n = Console.Read();\n }\n\n return result;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "84d2b58473e8921c9873b36767e68c62", "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 ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string no1 = Console.ReadLine();\n List ar1 = no1.Split(' ').ToList();\n List ar = ar1.Select(s => int.Parse(s)).ToList();\n no1 = Console.ReadLine();\n List ar2 = no1.Split(' ').ToList();\n List ar3 = ar2.Select(s => int.Parse(s)).ToList();\n Console.WriteLine(PlainningTheExpedition(ar.ElementAt(0), ar.ElementAt(1), ar3));\n // Console.ReadKey();\n \n\n }\n public static int PlainningTheExpedition(int Participants, int typesOfFood, List foods)\n {\n if (Participants == 0)\n {\n return 0;\n }\n List distinctTypes = foods.Distinct().ToList();\n List noOfPackages = new List();\n distinctTypes.ForEach(x => noOfPackages.Add(foods.Count(y => y == x)));\n noOfPackages.Sort();\n int sum = noOfPackages.Sum();\n int maxdays = sum / Participants;\n if (maxdays == 0){\n return 0;\n }\n for (int i = maxdays; i > 0 ; i--)\n {\n int pos = 0;\n for (int j = 0; j < noOfPackages.Count; j++)\n {\n pos += noOfPackages[j] / i;\n }\n if (pos >= Participants) {\n return i;\n }\n }\n return 0;\n }\n\n\n }\n}\n//Planning The expedition\n//participants - n , type - h\n//list = arrType.distinct;\n//forech list (list1.push(arrType.Count(item)))\n//index = list1.length-n\n\n//7\n// 100 100 9 7 6", "lang_cluster": "C#", "compilation_error": false, "code_uid": "86d15d53ce5086d63ebb070b932b03de", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n private static int n, m;\n private static int[] a;\n\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ');\n n = int.Parse(s[0]); m = int.Parse(s[1]);\n s = Console.ReadLine().Split(' ');\n a = new int[101];\n for (int i = 0; i < m; ++i)\n {\n int k = int.Parse(s[i]);\n a[k]++;\n }\n for (int ans = 100; ans > 0; --ans)\n {\n int cnt = 0;\n for (int i = 1; i <= 100; ++i)\n {\n cnt += a[i] / ans;\n }\n if (cnt >= n)\n {\n Console.WriteLine(ans);\n return;\n }\n }\n Console.WriteLine(0);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "14a4f8e43731817ee6c292bc79e4b223", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Planning_The_Expedition\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private 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 var nn = new int[101];\n for (int i = 0; i < m; i++)\n {\n nn[Next()]++;\n }\n\n int l = 0, r = 101;\n while (l < r)\n {\n int mi = (l + r)/2;\n if (mi != 0 && nn.Sum(i => i/mi) >= n)\n l = mi + 1;\n else r = mi;\n }\n return Math.Max(l - 1, 0);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cccde7132fc15aa8a2f9788e6d6887bf", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.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 = 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": "c904d3a092763ba121a918e031768108", "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, (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": "17aa182d25c536faf398f720c4e18bc3", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\n\nclass Program\n{\n\n static void Main(string[] args)\n {\n int n, m;\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 (long t = 2; m > 0; m /= 2, t = (t * t) % d)\n {\n if (m % 2 == 1)\n res = (res * t) % d;\n }\n res--;\n long ans = 1;\n for (int i = 0; i < n; i++)\n {\n ans *= res;\n ans %= 1000000009;\n if (res > 0)\n res--;\n }\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "73e86d35b63bd6e0a4b6c63503ba6e05", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "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 long mod = 1000000009;\n\n private void Go()\n {\n int n = GetInt();\n int m = GetInt();\n\n long ans = 1;\n long k = 1;\n for (int i = 0; i < m; i++)\n {\n k = (k * 2) % mod;\n }\n k--;\n for (int i = 0; i < n; i++)\n {\n ans = (ans * k) % mod;\n k--;\n }\n\n Wl(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), 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": "81d71827331f13415cab1dc045b55eaf", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "difficulty": 1300.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 A\n\t{\n\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n = NextInt(), m = NextInt();\n\t\t\tlong res = 1;\n\t\t\tlong tot = 1;\n\t\t\tfor ( int i = 0; i < m; ++i )\n\t\t\t{\n\t\t\t\ttot = tot * 2;\n\t\t\t\ttot %= 1000000009;\n\t\t\t}\n\t\t\tfor ( int i = 0; i < n; ++i )\n\t\t\t{\n\t\t\t\tres = res * Math.Max( 0, tot - ( i + 1 ) );\n\t\t\t\tres %= 1000000009;\n\t\t\t}\n\t\t\tOut.WriteLine( res );\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": "f687998f0041e5a60e4c7054a596270d", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Not_Wool_Sequences\n{\n internal class Program\n {\n private const int mod = 1000000009;\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n long sum = 1;\n long k = Pow(2, m) - n;\n if (k < 0)\n k += mod;\n for (int i = 0; i < n; i++)\n {\n sum = (sum*k)%mod;\n k++;\n }\n writer.WriteLine(sum);\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": "a0a1b72f31c9a75504c7f93cad3103c7", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace AprilFirstCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int n = int.Parse(str[6].ToString());\n Console.WriteLine(n % 2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a01989724f0cc318a203f7d6b2fa2c66", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "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 string s = Console.ReadLine();\n int a = Convert.ToInt32(s[s.Length - 1]);\n Console.WriteLine(a % 2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fcd2506a4f8b86322188f3b5c2757a68", "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 string s = Console.ReadLine();\n int q = Convert.ToInt32(s[s.Length - 1]);\n Console.WriteLine(q % 2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ca123ee5834b2b73d57f5a22b8bf37af", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace DailyCP\n{\n class cc\n {\n public static void Main()\n {\n string p = Console.ReadLine();\n int o = Convert.ToInt32(p[p.Length - 1]);\n if (o % 2 == 0)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(1);\n }\n\n \n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4317f4a0df34ea931738e535a7fd1775", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "MS C#", "source_code": "\ufeffusing System;\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": "2eb6d22b0e310e946e0d2564d3bb8899", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000.0} {"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 n = io.Read();\n\t\t\t\tio.Reader.ReadLine();\n\t\t\t\tvar s = io.Reader.ReadLine();\n\n\t\t\t\tvar count = 0L;\n\t\t\t\tfor (var i = 0; i < s.Length; i++)\n\t\t\t\t{\n\t\t\t\t\tfor (var j = i; j < s.Length; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar s2 = s.Substring(i, j - i + 1);\n\t\t\t\t\t\tif (Check(s2))\n\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tio.WriteLine(count);\n\t\t\t}\n\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tstatic bool Check(string s)\n\t\t{\n\t\t\tint c1 = 0, c2 = 0, c3 = 0, c4 = 0;\n\t\t\tfor (var i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == 'U')\n\t\t\t\t\tc1++;\n\t\t\t\telse if (s[i] == 'D')\n\t\t\t\t\tc2++;\n\t\t\t\telse if (s[i] == 'R')\n\t\t\t\t\tc3++;\n\t\t\t\telse if (s[i] == 'L')\n\t\t\t\t\tc4++;\n\t\t\t\telse\n\t\t\t\t\tthrow new Exception();\n\t\t\t}\n\n\t\t\treturn (c1 - c2) == 0 && (c3 - c4) == 0;\n\t\t}\n\n\t}\n\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c928c00225ebcb9218413327555a7d2f", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int x = 0;\n for (int i = 2; i <= n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (n - j >= i && b(s.Substring(j, i)))\n x++;\n }\n }\n Console.WriteLine(x);\n }\n private static bool b(string s)\n {\n int ud = 0;\n int rl = 0;\n foreach (char c in s)\n {\n switch (c)\n {\n case 'U':\n ud++;\n break;\n case 'D':\n ud--;\n break;\n case 'R':\n rl++;\n break;\n case 'L':\n rl--;\n break;\n }\n }\n if (ud == 0 && rl == 0)\n return true;\n else\n return false;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "884b33eb16f9df6ab6b290aeffdf331f", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000.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 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": false, "code_uid": "f3cb06c5632242a71041737bf0010f6c", "src_uid": "7bd5521531950e2de9a7b0904353184d", "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 RobotSeq\n{\n class Program\n {\n static void move(ref int x, ref int y, char c)\n {\n if (c == 'U')\n y++;\n else\n if (c == 'D')\n y--;\n else\n if (c == 'L') x--; else x++;\n }\n static bool check(string p)\n {\n int x = 0, y = 0;\n for (int i = 0; i < p.Length; i++) move(ref x, ref y, p[i]);\n return x == 0 && y == 0;\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int count = 0;\n \n for (int i=2;i points = new Dictionary();\n Vector position = new Vector();\n points.Add(position, 1);\n for (int i = 0; i < amount; i++)\n {\n if (cmd[i].Equals('U')) position.Y++;\n else if (cmd[i].Equals('D')) position.Y--;\n else if (cmd[i].Equals('L')) position.X--;\n else if (cmd[i].Equals('R')) position.X++;\n\n\n if (points.ContainsKey(position))\n {\n returnsCount += points[position];\n points[position]++;\n }\n else points.Add(position, 1);\n }\n Console.WriteLine(returnsCount);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c8a266cdbb27ab5298f11dcbbb0d8787", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Globalization;\n\nnamespace FertiLib.Contest.C\n{\n\tstatic class Program\n\t{\n\t\tpublic static void Solve(Scanner cin)\n\t\t{\n\t\t\tlong n = cin.ReadLong();\n\t\t\tModInt ans = 1;\n\t\t\tfor (int i = 1; i <= n; i++)\n\t\t\t{\n\t\t\t\tans *= i;\n\t\t\t}\n\t\t\tans -= ModInt.Pow(2, n - 1);\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n\t\t\tConsole.SetOut(sw);\n\t\t\tvar cin = new Scanner();\n\t\t\tSolve(cin);\n\t\t\tConsole.Out.Flush();\n\t\t}\n\n\t\tpublic static void YESNO(bool condition) => Console.WriteLine(condition ? \"YES\" : \"NO\");\n\t\tpublic static void YesNo(bool condition) => Console.WriteLine(condition ? \"Yes\" : \"No\");\n\t\tpublic static void yesno(bool condition) => Console.WriteLine(condition ? \"yes\" : \"no\");\n\t}\n\tpublic struct ModInt : IComparable, IEquatable\n\t{\n\t\tpublic static long MOD = 1000000007;\n\t\tpublic static bool isModPrime { get; set; }\n\n\t\tprivate readonly long num;\n\n\t\tpublic ModInt(long n) { num = n; isModPrime = true; }\n\n\t\tpublic override string ToString() => num.ToString();\n\n\t\tpublic static ModInt operator +(ModInt l, ModInt r)\n\t\t{\n\t\t\tlong x = l.num + r.num;\n\t\t\tif (x >= MOD) x -= MOD;\n\t\t\treturn new ModInt(x);\n\t\t}\n\t\tpublic static ModInt operator -(ModInt l, ModInt r)\n\t\t{\n\t\t\tlong x = l.num - r.num;\n\t\t\tif (x < 0) x += MOD;\n\t\t\treturn new ModInt(x);\n\t\t}\n\t\tpublic static ModInt operator *(ModInt l, ModInt r) => new ModInt((l.num * r.num) % MOD);\n\t\tpublic static ModInt operator /(ModInt l, ModInt r) => l * r.Inverse();\n\n\t\tpublic static ModInt operator ++(ModInt x)\n\t\t{\n\t\t\tvar tmp = x + new ModInt(1);\n\t\t\treturn tmp;\n\t\t}\n\t\tpublic static ModInt operator --(ModInt x)\n\t\t{\n\t\t\tvar tmp = x - new ModInt(1);\n\t\t\treturn tmp;\n\t\t}\n\n\t\tpublic static bool operator >(ModInt l, ModInt r) => l.CompareTo(r) > 0;\n\t\tpublic static bool operator <(ModInt l, ModInt r) => l.CompareTo(r) < 0;\n\t\tpublic static bool operator >=(ModInt l, ModInt r) => l.CompareTo(r) >= 0;\n\t\tpublic static bool operator <=(ModInt l, ModInt r) => l.CompareTo(r) <= 0;\n\t\tpublic static bool operator ==(ModInt l, ModInt r) => l.Equals(r);\n\t\tpublic static bool operator !=(ModInt l, ModInt r) => !l.Equals(r);\n\n\t\tpublic static implicit operator long(ModInt x) => x.num;\n\t\tpublic static implicit operator ModInt(long n)\n\t\t{\n\t\t\tn %= MOD;\n\t\t\tif (n < 0) n += MOD;\n\t\t\treturn new ModInt(n);\n\t\t}\n\n\t\tpublic ModInt Inverse() => Inverse(this, MOD);\n\t\tpublic static ModInt Inverse(ModInt x) => Inverse(x.num, MOD);\n\t\tpublic static long Inverse(long x, long m)\n\t\t{\n\t\t\tif (x % m == 0) throw new DivideByZeroException();\n\t\t\tlong a = x, b = m, u = 1, v = 0;\n\t\t\twhile (b > 0)\n\t\t\t{\n\t\t\t\tlong t = a / b;\n\n\t\t\t\ta -= t * b;\n\t\t\t\tlong p = a; a = b; b = p; // swap(a, b);\n\n\t\t\t\tu -= t * v;\n\t\t\t\tp = u; u = v; v = p; // swap(u, v);\n\t\t\t}\n\t\t\tu %= m;\n\t\t\tif (u < 0) u += m;\n\t\t\treturn u;\n\t\t}\n\n\t\tpublic static ModInt Pow(long x, long n)\n\t\t{\n\t\t\tlong now = 1;\n\t\t\tif (isModPrime) n %= MOD - 1;\n\t\t\tfor (; n > 0; n /= 2, x = x * x % MOD)\n\t\t\t{\n\t\t\t\tif (n % 2 == 1) now = now * x % MOD;\n\t\t\t}\n\t\t\treturn new ModInt(now);\n\t\t}\n\n\t\tpublic int CompareTo(ModInt x)\n\t\t{\n\t\t\tif (num == x.num) return 0;\n\t\t\tif (num > x.num) return 1;\n\t\t\treturn -1;\n\t\t}\n\n\t\tpublic bool Equals(ModInt x) => num == x.num;\n\n\t\tpublic override bool Equals(object obj) => obj is ModInt m && num == m.num;\n\t}\n\n\n\tstatic class Util\n\t{\n\t\tpublic static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n\t}\n\n\tclass Printer : StreamWriter\n\t{\n\t\tpublic override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n\t\tpublic Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n\t\tpublic Printer(Stream stream, Encoding encoding) : base(stream, encoding) { }\n\t}\n\n\tclass Scanner\n\t{\n\t\tstring[] s;\n\t\tint i;\n\n\t\tchar[] separator = new char[] { ' ' };\n\n\t\tpublic Scanner()\n\t\t{\n\t\t\ts = new string[0];\n\t\t\ti = 0;\n\t\t}\n\n\t\tpublic string Read() => ReadString();\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tstring st = Console.ReadLine();\n\t\t\twhile (st == \"\") st = Console.ReadLine();\n\t\t\ts = st.Split(separator, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tif (s.Length == 0) return ReadString();\n\t\t\ti = 0;\n\t\t\treturn s[i++];\n\t\t}\n\n\t\tpublic string[] ReadStringArray(int N)\n\t\t{\n\t\t\tstring[] Array = new string[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadString();\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\treturn int.Parse(ReadString());\n\t\t}\n\n\t\tpublic int[] ReadIntArray(int N, int add = 0)\n\t\t{\n\t\t\tint[] Array = new int[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadInt() + add;\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\treturn long.Parse(ReadString());\n\t\t}\n\n\t\tpublic long[] ReadLongArray(int N, long add = 0)\n\t\t{\n\t\t\tlong[] Array = new long[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadLong() + add;\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\treturn double.Parse(ReadString());\n\t\t}\n\n\t\tpublic double[] ReadDoubleArray(int N, double add = 0)\n\t\t{\n\t\t\tdouble[] Array = new double[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadDouble() + add;\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic T1 ReadValue() => (T1)Convert.ChangeType(ReadString(), typeof(T1));\n\n\t\tpublic (T1, T2) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(2);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\treturn (v1, v2);\n\t\t}\n\n\t\tpublic (T1, T2, T3) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(3);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\treturn (v1, v2, v3);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(4);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\treturn (v1, v2, v3, v4);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4, T5) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(5);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n\t\t\treturn (v1, v2, v3, v4, v5);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4, T5, T6) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(6);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n\t\t\tvar v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n\t\t\treturn (v1, v2, v3, v4, v5, v6);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4, T5, T6, T7) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(7);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n\t\t\tvar v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n\t\t\tvar v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));\n\t\t\treturn (v1, v2, v3, v4, v5, v6, v7);\n\t\t}\n\n\t\tpublic T1[] ReadValueArray(int N)\n\t\t{\n\t\t\tvar v1 = new T1[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tv1[i] = ReadValue();\n\t\t\t}\n\t\t\treturn v1;\n\t\t}\n\n\t\tpublic (T1[], T2[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2) = (new T1[N], new T2[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t}\n\t\t\treturn (v1, v2);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t}\n\t\t\treturn (v1, v2, v3);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[], T5[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4, t5) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t\tv5[i] = t5;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4, v5);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4, t5, t6) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t\tv5[i] = t5;\n\t\t\t\tv6[i] = t6;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4, v5, v6);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4, t5, t6, t7) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t\tv5[i] = t5;\n\t\t\t\tv6[i] = t6;\n\t\t\t\tv7[i] = t7;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4, v5, v6, v7);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "29820db58d88cc6088f28ce856497f79", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Globalization;\n\nnamespace FertiLib.Contest.C\n{\n\tstatic class Program\n\t{\n\t\tpublic static void Solve(Scanner cin)\n\t\t{\n\t\t\tlong n = cin.ReadLong();\n\t\t\tModInt ans = 1;\n\t\t\tfor (int i = 1; i <= n; i++)\n\t\t\t{\n\t\t\t\tans *= i;\n\t\t\t}\n\t\t\tans -= ModInt.Pow(2, n - 1);\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n\t\t\tConsole.SetOut(sw);\n\t\t\tvar cin = new Scanner();\n\t\t\tSolve(cin);\n\t\t\tConsole.Out.Flush();\n\t\t}\n\n\t\tpublic static void YESNO(bool condition) => Console.WriteLine(condition ? \"YES\" : \"NO\");\n\t\tpublic static void YesNo(bool condition) => Console.WriteLine(condition ? \"Yes\" : \"No\");\n\t\tpublic static void yesno(bool condition) => Console.WriteLine(condition ? \"yes\" : \"no\");\n\t}\n\tpublic struct ModInt : IComparable, IEquatable\n\t{\n\t\tpublic static long MOD = 1000000007;\n\t\tpublic static bool isModPrime { get; set; }\n\n\t\tprivate readonly long num;\n\n\t\tpublic ModInt(long n) { num = n; isModPrime = true; }\n\n\t\tpublic override string ToString() => num.ToString();\n\n\t\tpublic static ModInt operator +(ModInt l, ModInt r)\n\t\t{\n\t\t\tlong x = l.num + r.num;\n\t\t\tif (x >= MOD) x -= MOD;\n\t\t\treturn new ModInt(x);\n\t\t}\n\t\tpublic static ModInt operator -(ModInt l, ModInt r)\n\t\t{\n\t\t\tlong x = l.num - r.num;\n\t\t\tif (x < 0) x += MOD;\n\t\t\treturn new ModInt(x);\n\t\t}\n\t\tpublic static ModInt operator *(ModInt l, ModInt r) => new ModInt((l.num * r.num) % MOD);\n\t\tpublic static ModInt operator /(ModInt l, ModInt r) => l * r.Inverse();\n\n\t\tpublic static ModInt operator ++(ModInt x)\n\t\t{\n\t\t\tvar tmp = x + new ModInt(1);\n\t\t\treturn tmp;\n\t\t}\n\t\tpublic static ModInt operator --(ModInt x)\n\t\t{\n\t\t\tvar tmp = x - new ModInt(1);\n\t\t\treturn tmp;\n\t\t}\n\n\t\tpublic static bool operator >(ModInt l, ModInt r) => l.CompareTo(r) > 0;\n\t\tpublic static bool operator <(ModInt l, ModInt r) => l.CompareTo(r) < 0;\n\t\tpublic static bool operator >=(ModInt l, ModInt r) => l.CompareTo(r) >= 0;\n\t\tpublic static bool operator <=(ModInt l, ModInt r) => l.CompareTo(r) <= 0;\n\t\tpublic static bool operator ==(ModInt l, ModInt r) => l.Equals(r);\n\t\tpublic static bool operator !=(ModInt l, ModInt r) => !l.Equals(r);\n\n\t\tpublic static implicit operator long(ModInt x) => x.num;\n\t\tpublic static implicit operator ModInt(long n)\n\t\t{\n\t\t\tn %= MOD;\n\t\t\tif (n < 0) n += MOD;\n\t\t\treturn new ModInt(n);\n\t\t}\n\n\t\tpublic ModInt Inverse() => Inverse(this, MOD);\n\t\tpublic static ModInt Inverse(ModInt x) => Inverse(x.num, MOD);\n\t\tpublic static long Inverse(long x, long m)\n\t\t{\n\t\t\tif (x % m == 0) throw new DivideByZeroException();\n\t\t\tlong a = x, b = m, u = 1, v = 0;\n\t\t\twhile (b > 0)\n\t\t\t{\n\t\t\t\tlong t = a / b;\n\n\t\t\t\ta -= t * b;\n\t\t\t\tlong p = a; a = b; b = p; // swap(a, b);\n\n\t\t\t\tu -= t * v;\n\t\t\t\tp = u; u = v; v = p; // swap(u, v);\n\t\t\t}\n\t\t\tu %= m;\n\t\t\tif (u < 0) u += m;\n\t\t\treturn u;\n\t\t}\n\n\t\tpublic static ModInt Pow(long x, long n)\n\t\t{\n\t\t\tlong now = 1;\n\t\t\tif (isModPrime) n %= MOD - 1;\n\t\t\tfor (; n > 0; n /= 2, x = x * x % MOD)\n\t\t\t{\n\t\t\t\tif (n % 2 == 1) now = now * x % MOD;\n\t\t\t}\n\t\t\treturn new ModInt(now);\n\t\t}\n\n\t\tpublic int CompareTo(ModInt x)\n\t\t{\n\t\t\tif (num == x.num) return 0;\n\t\t\tif (num > x.num) return 1;\n\t\t\treturn -1;\n\t\t}\n\n\t\tpublic bool Equals(ModInt x) => num == x.num;\n\n\t\tpublic override bool Equals(object obj) => obj is ModInt m && num == m.num;\n\n\t\tpublic override int GetHashCode()\n\t\t{\n\t\t\treturn HashCode.Combine(num);\n\t\t}\n\n\t}\n\n\n\tstatic class Util\n\t{\n\t\tpublic static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n\t}\n\n\tclass Printer : StreamWriter\n\t{\n\t\tpublic override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n\t\tpublic Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n\t\tpublic Printer(Stream stream, Encoding encoding) : base(stream, encoding) { }\n\t}\n\n\tclass Scanner\n\t{\n\t\tstring[] s;\n\t\tint i;\n\n\t\tchar[] separator = new char[] { ' ' };\n\n\t\tpublic Scanner()\n\t\t{\n\t\t\ts = new string[0];\n\t\t\ti = 0;\n\t\t}\n\n\t\tpublic string Read() => ReadString();\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tstring st = Console.ReadLine();\n\t\t\twhile (st == \"\") st = Console.ReadLine();\n\t\t\ts = st.Split(separator, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tif (s.Length == 0) return ReadString();\n\t\t\ti = 0;\n\t\t\treturn s[i++];\n\t\t}\n\n\t\tpublic string[] ReadStringArray(int N)\n\t\t{\n\t\t\tstring[] Array = new string[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadString();\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\treturn int.Parse(ReadString());\n\t\t}\n\n\t\tpublic int[] ReadIntArray(int N, int add = 0)\n\t\t{\n\t\t\tint[] Array = new int[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadInt() + add;\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\treturn long.Parse(ReadString());\n\t\t}\n\n\t\tpublic long[] ReadLongArray(int N, long add = 0)\n\t\t{\n\t\t\tlong[] Array = new long[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadLong() + add;\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\treturn double.Parse(ReadString());\n\t\t}\n\n\t\tpublic double[] ReadDoubleArray(int N, double add = 0)\n\t\t{\n\t\t\tdouble[] Array = new double[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadDouble() + add;\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic T1 ReadValue() => (T1)Convert.ChangeType(ReadString(), typeof(T1));\n\n\t\tpublic (T1, T2) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(2);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\treturn (v1, v2);\n\t\t}\n\n\t\tpublic (T1, T2, T3) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(3);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\treturn (v1, v2, v3);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(4);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\treturn (v1, v2, v3, v4);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4, T5) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(5);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n\t\t\treturn (v1, v2, v3, v4, v5);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4, T5, T6) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(6);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n\t\t\tvar v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n\t\t\treturn (v1, v2, v3, v4, v5, v6);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4, T5, T6, T7) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(7);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n\t\t\tvar v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n\t\t\tvar v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));\n\t\t\treturn (v1, v2, v3, v4, v5, v6, v7);\n\t\t}\n\n\t\tpublic T1[] ReadValueArray(int N)\n\t\t{\n\t\t\tvar v1 = new T1[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tv1[i] = ReadValue();\n\t\t\t}\n\t\t\treturn v1;\n\t\t}\n\n\t\tpublic (T1[], T2[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2) = (new T1[N], new T2[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t}\n\t\t\treturn (v1, v2);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t}\n\t\t\treturn (v1, v2, v3);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[], T5[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4, t5) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t\tv5[i] = t5;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4, v5);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4, t5, t6) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t\tv5[i] = t5;\n\t\t\t\tv6[i] = t6;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4, v5, v6);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4, t5, t6, t7) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t\tv5[i] = t5;\n\t\t\t\tv6[i] = t6;\n\t\t\t\tv7[i] = t7;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4, v5, v6, v7);\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "8f5e56a8b88361a8801dc486b5c93921", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Artem_and_Array\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static int[] nn;\n\n private static void Main(string[] args)\n {\n int n = Next();\n nn = new int[n + 2];\n nn[0] = -10000000;\n for (int i = 1; i <= n; i++)\n {\n nn[i] = Next();\n }\n nn[n + 1] = -10000000;\n\n long count = 0;\n\n\n var points = new point[n + 2];\n var q = new Queue();\n for (int i = 1; i <= n; i++)\n {\n var p = new point(i - 1, i + 1, nn[i]);\n points[i] = p;\n if (p.value >= p.current)\n {\n q.Enqueue(p);\n p.used = true;\n }\n }\n\n while (q.Count > 0)\n {\n point p = q.Dequeue();\n count += p.value;\n\n point p1 = points[p.left];\n point p2 = points[p.right];\n p1.right = p.right;\n p2.left = p.left;\n p1.Recalc();\n p2.Recalc();\n\n if (p1.value >= p1.current && !p1.used)\n {\n q.Enqueue(p1);\n p1.used = true;\n }\n if (p2.value >= p2.current && !p2.used)\n {\n q.Enqueue(p2);\n p2.used = true;\n }\n }\n\n\n var heap = new MaxBinaryHeapObject(new point(0, 0, 0));\n for (int i = 1; i <= n; i++)\n {\n if (!points[i].used)\n heap.Add(points[i]);\n }\n\n while (heap.HeapSize > 2)\n {\n point p = heap.GetMax();\n count += p.value;\n\n point p1 = points[p.left];\n point p2 = points[p.right];\n p1.right = p.right;\n p2.left = p.left;\n\n p1.Recalc();\n heap.Heapify(p1);\n p2.Recalc();\n heap.Heapify(p2);\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 #region Nested type: MaxBinaryHeapObject\n\n public class MaxBinaryHeapObject\n {\n private readonly IComparer _comparer;\n private readonly List _list;\n\n public MaxBinaryHeapObject(IComparer comparer)\n {\n _comparer = comparer ?? Comparer.Default;\n _list = new List();\n }\n\n public int HeapSize\n {\n get { return _list.Count; }\n }\n\n public void Add(point value)\n {\n _list.Add(value);\n value.where = _list.Count - 1;\n MoveUp(HeapSize - 1);\n }\n\n private void MoveUp(int i)\n {\n int parent = (i - 1)/2;\n\n while (i > 0 && _comparer.Compare(_list[parent], _list[i]) == -1)\n {\n point temp = _list[i];\n _list[i] = _list[parent];\n _list[parent] = temp;\n\n _list[i].where = i;\n _list[parent].where = parent;\n\n i = parent;\n parent = (i - 1)/2;\n }\n }\n\n public void Heapify(point t)\n {\n MoveUp(t.where);\n MoveDown(t.where);\n }\n\n\n private void MoveDown(int i)\n {\n for (;;)\n {\n int leftChild = 2*i + 1;\n int rightChild = 2*i + 2;\n int largestChild = i;\n\n if (leftChild < HeapSize && _comparer.Compare(_list[leftChild], _list[largestChild]) == 1)\n {\n largestChild = leftChild;\n }\n\n if (rightChild < HeapSize && _comparer.Compare(_list[rightChild], _list[largestChild]) == 1)\n {\n largestChild = rightChild;\n }\n\n if (largestChild == i)\n {\n break;\n }\n\n point temp = _list[i];\n _list[i] = _list[largestChild];\n _list[largestChild] = temp;\n\n _list[i].where = i;\n _list[largestChild].where = largestChild;\n\n i = largestChild;\n }\n }\n\n\n public point Max()\n {\n return _list[0];\n }\n\n public point GetMax()\n {\n point result = _list[0];\n _list[0] = _list[HeapSize - 1];\n _list[0].where = 0;\n _list.RemoveAt(HeapSize - 1);\n MoveDown(0);\n return result;\n }\n }\n\n #endregion\n\n #region Nested type: point\n\n public class point : IComparer\n {\n public readonly int current;\n public int left;\n public int right;\n public bool used;\n public int value;\n public int where;\n\n\n public point(int left, int right, int current)\n {\n this.left = left;\n this.right = right;\n this.current = current;\n value = Math.Min(nn[left], nn[right]);\n }\n\n #region IComparer Members\n\n public int Compare(point x, point y)\n {\n int c = (x.value).CompareTo(y.value);\n //if (c == 0)\n // c = y._current.CompareTo(x._current);\n return c;\n }\n\n #endregion\n\n public void Recalc()\n {\n value = Math.Min(nn[left], nn[right]);\n }\n }\n\n #endregion\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e4e857d82048555dbebdf08b7093bc80", "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1", "difficulty": 2500.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(H % 6 == 4){\n count += 2;\n }\n if(H % 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 else if(W == 3){\n sb.Append(\"4\\n\");\n return;\n }\n else if(W == 7){\n sb.Append(\"12\\n\");\n return;\n }\n sb.Append((W*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= 0)\r\n {\r\n nd[o] = (nd[o] + d[p]) % mod;\r\n if (j < k && o > 0)\r\n sum = (sum + 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] = (nd[o] + d[p]) % mod;\r\n if (j < k && o > 0)\r\n sum = (sum + d[p]) % mod;\r\n }\r\n }\r\n }\r\n ans = ((i + 1) * ans + sum) % mod;\r\n max = nmax;\r\n d = nd;\r\n }\r\n\r\n return ans;\r\n }\r\n\r\n public void Solve()\r\n {\r\n int n = ReadInt();\r\n int mod = ReadInt();\r\n\r\n Write(Fun(n, mod));\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": "87caf82a05a56fc35476b9c6c06d01e6", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.106\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Tech1\", \"Tech1\\Tech1.csproj\", \"{1EB1A4F0-0118-4CCD-BF17-D608A682C2B4}\"\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{1EB1A4F0-0118-4CCD-BF17-D608A682C2B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{1EB1A4F0-0118-4CCD-BF17-D608A682C2B4}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{1EB1A4F0-0118-4CCD-BF17-D608A682C2B4}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{1EB1A4F0-0118-4CCD-BF17-D608A682C2B4}.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 = {C3620269-6E19-4EA1-ABB1-CD478D85838E}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "9a443f841bc27fda7f77a12ea1590425", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "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 Task1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var len = str.Length;\n if (len == 1)\n {\n Console.WriteLine(str);\n }\n else {\n int[] ind = new int[len];\n int maxodd = (len % 2 == 0) ? len - 1 : len;\n for (int i = 0; i < len / 2; i++)\n {\n ind[i] = maxodd - 2 * i;\n }\n for (int i = len / 2; i < len; i++)\n {\n ind[i] = 2 + (i - len / 2) * 2;\n }\n var res = new List(str);\n\n for (int i = 0; i < len; i++)\n {\n res[ind[i] - 1] = str[i];\n }\n Console.WriteLine(String.Join(\"\", res));\n }\n //TODO: comment before sending\n //Console.WriteLine(\"Done...\");\n //Console.ReadLine();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7f543cdb427bc85abc5f56dfed2af3e1", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "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\tstring str = Console.ReadLine();\n\t\tint N = str.Length;\n\t\tstring ans = \"\";\n\t\tif(N%2==0){\n\t\t\tfor(var i=0;i();\n var r = Rec(\"\" + board[0][0], 0, 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 currentR, int currentC, string[] board, Dictionary memo)\n {\n if (memo.ContainsKey(str))\n return memo[str];\n\n var n = board.Length;\n var numStr = str.Length;\n\n if (numStr == n * 2 - 1)\n {\n return str.Count(c => c == 'a') - str.Count(c => c == 'b');\n }\n\n var res = numStr % 2 == 0 ? int.MinValue : int.MaxValue;\n\n if (currentR + 1 < n)\n {\n var r = currentR + 1;\n var c = currentC;\n\n if (numStr % 2 == 0)\n res = Math.Max(res, Rec(str + board[r][c], r, c, board, memo));\n else\n res = Math.Min(res, Rec(str + board[r][c], r, c, board, memo));\n }\n if (currentC + 1 < n)\n {\n var r = currentR;\n var c = currentC + 1;\n\n if (numStr % 2 == 0)\n res = Math.Max(res, Rec(str + board[r][c], r, c, board, memo));\n else\n res = Math.Min(res, Rec(str + board[r][c], r, c, board, memo));\n }\n return memo[str] = res;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "13fa0deeb6638e0660fea9c58af2b08c", "src_uid": "d803fe167a96656f8debdc21edd988e4", "difficulty": 2400.0} {"lang": "MS 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 = \"D1\";\n\n private static void Solve()\n {\n int n,k;\n Read(out n, out k);\n long res = k-1;\n var mod = 1000000007;\n for (int i = 1; i <= k-1; i++)\n {\n res *= k;\n res %= mod;\n }\n for (int i = 1; i <= n-k; i++)\n {\n res *= n-k;\n res %= mod;\n }\n WriteLine(res);\n }\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n 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": "97055115a0c4065f141f9268de05bcce", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.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 private void Go()\n {\n long mod = 1000000007;\n long N = GetInt();\n long n = GetInt();\n\n long[,] bin = new long[n + 1, n + 1];\n long[,] pow = new long[n + 1, n + 1];\n bin[0, 0] = 1; bin[1, 0] = 1; bin[1, 1] = 1;\n for (int i = 2; i <= n; i++)\n {\n bin[i, 0] = 1; bin[i, i] = 1;\n for (int j = 1; j < i; j++)\n {\n bin[i, j] = (bin[i - 1, j - 1] + bin[i - 1, j]) % mod;\n pow[i, j] = (pow[i, j - 1] * i) % mod;\n }\n }\n\n for (int i = 0; i <= n; i++)\n {\n pow[i, 0] = 1;\n for (int j = 1; j <= n; j++)\n {\n pow[i, j] = (pow[i, j - 1] * i) % mod;\n }\n }\n\n\n long[,] dp = new long[n + 1, n + 1];\n dp[1, 1] = 1;\n\n for (int nn = 2; nn <= n; nn++)\n {\n for (int l = 1; l < nn; l++)\n {\n long sum = 0;\n for (int i = 1; i <= nn-l; i++)\n {\n sum = (sum + (dp[nn - l, i] * pow[i, l]) % mod) % mod;\n }\n dp[nn,l] = (bin[nn,l] * sum) % mod;\n }\n dp[nn, nn]= 1;\n }\n\n long res = 0;\n if (n == 1) res = 1;\n else\n {\n for (int i = 1; i < n; i++)\n {\n res = (res + dp[n - 1, i]) % mod;\n }\n }\n\n res = (res * n) % mod;\n\n for (int i = 0; i < N-n; i++)\n {\n res = (res * (N - n)) % mod;\n }\n\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), 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": "71e4b9a434e25fc0b14b0ad6eb08f4f2", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "MS 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 = \"D1\";\n\n private static void Solve()\n {\n int n,k;\n Read(out n, out k);\n long res = 1;\n var mod = 1000000007;\n for (int i = 1; i <= k-1; i++)\n {\n res *= k;\n res %= mod;\n }\n for (int i = 1; i <= n-k; i++)\n {\n res *= n-k;\n res %= mod;\n }\n WriteLine(res);\n }\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n 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": "ac85b002b5ca29807853c595f395ec49", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.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 return self[index % self.Count];\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 for (int i = 0; i < b; i++)\n isb[io.NextInt() - 1] = i;\n\n var res = 0;\n\n long[] q = new long[2 * a];\n\n for (int i = 0, 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 if (j > 0 && q[j] < q[j - 1])\n {\n long cycles = (q[j - 1] - q[j] + b - 1) / b;\n q[j] += cycles * b;\n }\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": "aa664e5ff7bee2ac35e827ac74daa379", "src_uid": "13cd1aafbb1ba76be9ee10eaf8d8aef5", "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 ConsoleApplication1A\n{\n class Program749B\n {\n static void Main(string[] args)\n {\n\n string[] tk = Console.ReadLine().Split(' ');\n int x1 = Convert.ToInt32(tk[0]);\n int y1 = Convert.ToInt32(tk[1]);\n tk = Console.ReadLine().Split(' ');\n int x2 = Convert.ToInt32(tk[0]);\n int y2 = Convert.ToInt32(tk[1]);\n tk = Console.ReadLine().Split(' ');\n int x3 = Convert.ToInt32(tk[0]);\n int y3 = Convert.ToInt32(tk[1]);\n\n Console.WriteLine(3);\n Console.WriteLine((x3 - (x2-x1)) + \" \" + (y3 - (y2-y1)));\n Console.WriteLine((x2 - (x1 - x3)) + \" \" + (y2 - (y1 - y3)));\n Console.WriteLine((x1 - (x3 - x2)) + \" \" + (y1 - (y3 - y2)));\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ce3f9a9f68bd60fbceb6092bbb6aa3b5", "src_uid": "7725f9906a1b87bf4e866df03112f1e0", "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 A\n{\n class Program\n {\n static Func Int = x => int.Parse(x);\n static void Main(string[] args)\n {\n string[] buf = Console.ReadLine().Split(' ');\n int x1 = Int(buf[0]);\n int y1 = Int(buf[1]);\n buf = Console.ReadLine().Split(' ');\n int x2 = Int(buf[0]);\n int y2 = Int(buf[1]);\n buf = Console.ReadLine().Split(' ');\n int x3 = Int(buf[0]);\n int y3 = Int(buf[1]);\n Console.WriteLine(3);\n Console.WriteLine((x1 + x2 - x3) + \" \" + (y1 + y2 - y3));\n Console.WriteLine((x3 + x2 - x1) + \" \" + (y3 + y2 - y1));\n Console.WriteLine((x1 + x3 - x2) + \" \" + (y1 + y3 - y2));\n Console.ReadLine();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "228bd332cc4cc04ef9add12ec48c0443", "src_uid": "7725f9906a1b87bf4e866df03112f1e0", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication\n{\n public class Program\n {\n private static void AddPoint(HashSet> h, Tuple a, Tuple b, Tuple c)\n {\n int y = b.Item2 - a.Item2;\n int x = b.Item1 - a.Item1;\n\n h.Add(Tuple.Create(c.Item1 + x, c.Item2 + y));\n h.Add(Tuple.Create(c.Item1 - x, c.Item2 - y));\n }\n\n public static void Main(string[] args)\n {\n Func f = () => Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n Func, Tuple> t = x =>\n {\n var r = x();\n return Tuple.Create(r[0], r[1]);\n };\n\n var a = t(f);\n var b = t(f);\n var c = t(f);\n\n var h = new HashSet>();\n AddPoint(h, a, b, c);\n AddPoint(h, b, c, a);\n AddPoint(h, c, a, b);\n\n Console.WriteLine(h.Count);\n foreach (var p in h)\n Console.WriteLine(string.Format(\"{0} {1}\", p.Item1, p.Item2));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3e6854cd243218c62bc65a4b644432f3", "src_uid": "7725f9906a1b87bf4e866df03112f1e0", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "using System;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\n\n// TODO: Format doubles to use \".\" instead of \",\" (locale specific).\n\npublic static partial class Program\n{\n\tpublic static void InputProcessing()\n\t{\n\t\tint[][] points = ParseMatrix(3);\n\t\tDataProcessing(points);\n\t}\n\n\tpublic static void DataProcessing(int[][] points)\n\t{\n\t\tConsole.WriteLine(3);\n\t\tint[] p1 = points[0];\n\t\tint[] p2 = points[1];\n\t\tint[] p3 = points[2];\n\t\tFoo(p1, p2, p3);\n\t\tFoo(p2, p3, p1);\n\t\tFoo(p3, p1, p2);\n\t}\n\n\tpublic static void Foo(int[] p1, int[] p2, int[] p3)\n\t{\n\t\tint x = (p1[0] - p2[0]) + p3[0];\n\t\tint y = (p1[1] - p2[1]) + p3[1];\n\t\tConsole.WriteLine(x + \" \" + y);\n\t}\n}\n\npublic static partial class Program\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tInputProcessing();\n#if DEBUG\n\t\tConsole.ReadLine();\n#endif\n\t}\n\n\tpublic static T[] ParseArray()\n\t{\n\t\tTypeConverter tc = TypeDescriptor.GetConverter(typeof(T));\n\t\tstring[] input = Console.ReadLine().Split();\n\t\tT[] output = new T[input.Length];\n\t\tfor (int i = 0; i < input.Length; i++) { output[i] = (T)tc.ConvertFromString(input[i]); }\n\t\treturn output;\n\t}\n\n\tpublic static T[][] ParseMatrix(int nrows)\n\t{\n\t\tT[][] rv = new T[nrows][];\n\t\tfor (int i = 0; i < nrows; i++) { rv[i] = ParseArray(); }\n\t\treturn rv;\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "73ce3331566b7c3f72ddeb85f52bd42e", "src_uid": "7725f9906a1b87bf4e866df03112f1e0", "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 int TUX = ReadInt();\n int FOO=0;\n int BAR=0;\n int BAZ=0;\n int QUZ=1;\n for (int i = 0; i < TUX; i++)\n {\n int PUR = ReadInt();\n FOO = (FOO + PUR);\n BAR = (BAR + 1);\n if (FOO * QUZ >= BAR * BAZ)\n {\n BAZ = FOO;\n QUZ = BAR;\n }\n }\n return 1.0 * BAZ / QUZ;\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "46bf6aa6fada01ed93a32eb21dae665a", "src_uid": "32fc378a310ca15598377f7b638eaf26", "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 Prob290C\n {\n //HAI\n //I HAS A TUX\n //GIMMEH TUX\n //I HAS A FOO ITS 0\n //I HAS A BAR ITS 0\n //I HAS A BAZ ITS 0\n //I HAS A QUZ ITS 1\n //TUX IS NOW A NUMBR\n //IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n //I HAS A PUR\n //GIMMEH PUR\n //PUR IS NOW A NUMBR\n //FOO R SUM OF FOO AN PUR\n //BAR R SUM OF BAR AN 1\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n //O RLY?\n //YA RLY\n //BAZ R FOO\n //QUZ R BAR\n //OIC\n //IM OUTTA YR LOOP\n //BAZ IS NOW A NUMBAR\n //VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n //KTHXBYE\n\n int totalNums; //total number of input numbers\n int[] numbers; //an array of numbers of length totalNums\n\n public Prob290C(int tot, int[] nums)\n {\n totalNums = tot;\n numbers = new int[totalNums];\n Array.Copy(nums, 0, numbers, 0, totalNums);\n }\n\n public double solve()\n {\n //HAI\n //I HAS A TUX\n //GIMMEH TUX\n\n //I HAS A FOO ITS 0\n //I HAS A BAR ITS 0\n //I HAS A BAZ ITS 0\n //I HAS A QUZ ITS 1\n int foo = 0, bar = 0, baz = 0, quz = 1;\n\n //TUX IS NOW A NUMBR\n\n //IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n for (int i = 0; i < totalNums; ++i)\n {\n //I HAS A PUR\n //GIMMEH PUR\n //PUR IS NOW A NUMBR\n\n //FOO R SUM OF FOO AN PUR\n foo += numbers[i];\n //BAR R SUM OF BAR AN 1\n ++bar;\n\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n if (foo * quz * bar > baz * foo * quz)\n {\n //O RLY?\n //YA RLY\n\n //BAZ R FOO\n baz = foo;\n //QUZ R BAR\n quz = bar;\n }\n //OIC\n //IM OUTTA YR LOOP\n }\n //BAZ IS NOW A NUMBAR\n //VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n //KTHXBYE\n return (double)baz / quz;\n }\n\n public override String ToString()\n {\n return \"\";\n }\n\n static void Main(string[] args)\n {\n int totalNums = Convert.ToInt32(Console.ReadLine());\n int[] numbers = new int[totalNums];\n for (int i = 0; i < totalNums; ++i)\n {\n numbers[i] = Convert.ToInt32(Console.ReadLine());\n }\n Prob290C prob = new Prob290C(totalNums, numbers);\n Console.WriteLine(prob.solve());\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ad45d30fcfefe8309b5a7a34da9f35b", "src_uid": "32fc378a310ca15598377f7b638eaf26", "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 bool IT;\n int TUX = ReadInt();\n int FOO=0;\n int BAR=0;\n int BAZ=0;\n int QUZ=1;\n for (; TUX != 0; TUX--)\n {\n int PUR = ReadInt();\n FOO = (FOO + PUR);\n BAR = (BAR + 1);\n IT = (Math.Max(FOO * QUZ, BAR * BAZ)) == (FOO * QUZ);\n if(IT)\n {\n BAZ=FOO;\n QUZ=BAR;\n }\n }\n return 1.0 * BAZ / QUZ;\n\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a5b043c9476d9559ff4293b7584d5826", "src_uid": "32fc378a310ca15598377f7b638eaf26", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace AprilFools2013C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Tux;\n Tux = int.Parse(Console.ReadLine());\n\n var Foo = 0;\n var Bar = 0;\n var Baz = 0;\n var Quz = 1;\n\n for (; Tux > 0; Tux--)\n {\n int Pur;\n Pur = int.Parse(Console.ReadLine());\n\n Foo = Foo + Pur;\n Bar = Bar + 1;\n\n if (Math.Max(Foo * Quz, Bar * Baz) == Foo * Quz)\n {\n Baz = Foo;\n Quz = Bar;\n }\n }\n\n Console.WriteLine((double)Baz / (double)Quz);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "278d735f137d62d369ce522a98b34cff", "src_uid": "32fc378a310ca15598377f7b638eaf26", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "\ufeff\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 int n;\n long res;\n List a = new List();\n \n public void solve(string[] ind)\n {\n \n n = int.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 (int.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 (int.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 (int.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": "8c2d51bd277fbbfe95f1d4658f73459c", "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 int n;\n long res;\n List a = new List();\n \n public void solve(string[] ind)\n {\n \n n = int.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 (int.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 (int.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 (int.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 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\n }\n }\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8c0925f929d960555b026b9b1ce78d28", "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\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": "c9991c150ec1421c9dbbc5f3c87ba3bc", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.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 && 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 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": "46e57c8e3d8e32a625a219491283e6df", "src_uid": "52b8b6c68518d5129272b8c56e5b7662", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace ProblemC\n{\n class ProgramD\n {\n static void Main(string[] args)\n {\n string[] ar = Console.ReadLine().Split();\n\n int r = int.Parse(ar[0]);\n int b = int.Parse(ar[1]);\n\n int second = Math.Min(r, b);\n int first = (r + b - 1) - second;\n\n Console.WriteLine(first + \" \" + second);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a1d130bc8ce29b134a21f2ca68109987", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.IO;\n\ufeff\ufeff\ufeffusing System.Linq;\n\ufeff\ufeff\ufeffusing System.Text;\n\nnamespace CF {\n class Program {\n\n static int N;\n static int M;\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 n = reader.Read();\n var m = reader.Read();\n\n \n\n var game1 = 0;\n if (n > 0) {\n N = n;\n M = m;\n game1 = PetyaAttempt(true);\n }\n var game2 = 0;\n if (m > 0) {\n N = n;\n M = m;\n game2 = PetyaAttempt(false);\n }\n\n var p = Math.Max(game1,game2);\n var v = Math.Max(0, n + m - 1 - p);\n\n Console.WriteLine(\"{0} {1}\", p, v);\n\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n\n private static int PetyaAttempt(bool first){\n if (first) N--;\n if (!first) M--;\n bool prevColor = first;\n bool petyaTurn = false;\n int petyaCount = 0;\n\n while (N+M > 0) {\n bool next = Step(petyaTurn, prevColor);\n petyaTurn = !petyaTurn;\n if (prevColor == next) \n petyaCount++;\n if (next) N--;\n else M--;\n prevColor = next;\n }\n\n return petyaCount;\n }\n\n private static bool Step(bool isPetya, bool prevColor) {\n if (N == 0) {\n return false;\n }\n if (M == 0) {\n return true;\n }\n\n if (isPetya) {\n return prevColor;\n }\n return !prevColor;\n }\n\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}\n\n ", "lang_cluster": "C#", "compilation_error": false, "code_uid": "64e8f71296601ed20613d75419e83f72", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "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 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 }\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": "73cc02b8c851ed9ee3d0453d053f7c23", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "difficulty": 2500.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 (masses.Select(mass => mass > 0).Count() <= 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": "ef9845721270bd3d57dfd3972c26b8de", "src_uid": "ccc4b27889598266e8efe73b8aa3666c", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n public static class MainClass\n {\n const int BufferSize = (1 << 10) * 10;\n\n const int Module = 1000000007;\n\n static readonly StreamReader Reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n static readonly StreamWriter Writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize);\n\n static void Main(string[] args)\n {\n //var thread = new Thread(Solve) {Priority = ThreadPriority.Highest};\n //thread.Start();\n Solve();\n //Console.ReadKey();\n }\n\n static void Solve()\n {\n var n = NextNumber();\n var k = NextLongNumber();\n\n var func = new long[n + 1];\n func[0] = 1;\n func[1] = 1;\n\n for (var i = 2; i <= n; i++)\n {\n func[i] = func[i - 1] + func[i - 2];\n }\n\n for (var i = 1; i <= n; i++)\n {\n if (k > func[n - i])\n {\n k -= func[n - i];\n\n Writer.Write(\"{0} {1} \", i + 1, i);\n i++;\n }\n else\n {\n Writer.Write(\"{0} \", i);\n }\n }\n\n Writer.Flush();\n }\n\n\n static void ReverseArray(ref int[] array, int left, int right)\n {\n if (right < left) return;\n\n var middle = left + (right - left) / 2;\n for (var i = left; i <= middle; i++)\n {\n Swap(ref array[i], ref array[right + left - i]);\n }\n }\n\n static void Swap(ref T firstElement, ref T secondElement)\n {\n var temp = firstElement;\n firstElement = secondElement;\n secondElement = temp;\n }\n\n static void Swap(IList collection, int firstIndex, int secondIndex)\n {\n var temp = collection[firstIndex];\n collection[firstIndex] = collection[secondIndex];\n collection[secondIndex] = temp;\n }\n\n static int GCD(int firstNumber, int secondNumber)\n {\n return secondNumber == 0 ? firstNumber : GCD(secondNumber, firstNumber % secondNumber);\n }\n\n static int NextNumber()\n {\n var resultNumber = 0;\n var isNegative = false;\n int symbol;\n\n do\n {\n symbol = Reader.Read();\n switch (symbol)\n {\n case '-':\n isNegative = true;\n break;\n case '.':\n return 1;\n case -1:\n return isNegative ? -resultNumber : resultNumber;\n }\n\n if (symbol >= 'a' && symbol <= 'z')\n {\n return -1;\n }\n } while (symbol < '0' || symbol > '9');\n\n resultNumber = symbol - '0';\n while (true)\n {\n symbol = Reader.Read();\n if (symbol < '0' || symbol > '9')\n {\n return isNegative ? -resultNumber : resultNumber;\n }\n\n resultNumber *= 10;\n resultNumber += symbol - '0';\n }\n }\n\n static long NextLongNumber()\n {\n var resultNumber = 0L;\n var isNegative = false;\n int symbol;\n\n do\n {\n symbol = Reader.Read();\n switch (symbol)\n {\n case '-':\n isNegative = true;\n break;\n case '.':\n return 1;\n case -1:\n return isNegative ? -resultNumber : resultNumber;\n }\n\n if (symbol >= 'a' && symbol <= 'z')\n {\n return -1;\n }\n } while (symbol < '0' || symbol > '9');\n\n resultNumber = (long)symbol - '0';\n while (true)\n {\n symbol = Reader.Read();\n if (symbol < '0' || symbol > '9')\n {\n return isNegative ? -resultNumber : resultNumber;\n }\n\n resultNumber *= 10L;\n resultNumber += (long)symbol - '0';\n }\n }\n\n static int ReadNumber()\n {\n return int.Parse(Reader.ReadLine());\n }\n\n static long ReadLongNumber()\n {\n return long.Parse(Reader.ReadLine());\n }\n\n static int[] ReadArray()\n {\n var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n var resultArray = new int[inputLine.Length];\n for (var i = 0; i < inputLine.Length; i++)\n {\n resultArray[i] = int.Parse(inputLine[i]);\n }\n\n return resultArray;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ed17199643b1956d1f2951c41982b6a4", "src_uid": "e03c6d3bb8cf9119530668765691a346", "difficulty": 1900.0} {"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 long[] fibo = new long[52];\n public static void Main(string[] args)\n {\n fibo[0] = 1;\n fibo[1] = 2;\n for (var i = 2; i < 52; i++) fibo[i] = fibo[i-1] + fibo[i-2];\n \n var arg = Console.ReadLine().Split(' ');\n var amount = int.Parse(arg[0]);\n var num = long.Parse(arg[1]);\n var r = Solve(amount, num - 1, 1);\n \n Console.WriteLine(String.Join(\" \", r));\n }\n \n public static List Solve(int amount, long num, int start) {\n var r = new List();\n if (amount == 0) return r;\n var end = start;\n while (amount > 1 && num - fibo[amount-2] >= 0) {\n num -= fibo[amount-2];\n end++;\n amount--;\n }\n \n for (var curr = end; curr >= start; curr--) r.Add(curr);\n \n r.AddRange(Solve(amount-1, num, end+1));\n return r;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3bf9be3b3e1762e824d6fa931c042ce8", "src_uid": "e03c6d3bb8cf9119530668765691a346", "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\nnamespace Brauzer\n{\n class Program\n {\n private static int CalculateTime(int n,int pos,int l, int r)\n {\n if (l == 1 && r == n) return 0;\n int count = 0;\n if (l > 1 && r < n) count += r - l;\n if (pos >= l && pos <= r)\n {\n if (l == 1)\n count += r - pos+1;\n else\n if (r == n) count += pos - l+1; else count += Math.Min(r - pos, pos - l)+2;\n return count;\n }\n\n if (pos < l || (pos == l && l > 1)) \n {\n count += l - pos+1;\n if (r < n) count++;\n return count;\n }\n\n if (pos > r || (pos == r && r < n)) \n {\n count += pos - r+1;\n if (l > 1) count++;\n }\n\n return count;\n }\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n\n int n = int.Parse(s[0]);\n int pos = int.Parse(s[1]);\n int l = int.Parse(s[2]);\n int r = int.Parse(s[3]);\n\n Console.Write(CalculateTime(n,pos,l,r));\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dd0fc48af30322662e2123e473182ccc", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n var ss = Console.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n int k = int.Parse(ss[2]);\n\n int[,][] d = new int[n,m][];\n for (int p = 0; p < n; p++)\n {\n Console.ReadLine();\n for (int i = 0; i < m; i++)\n {\n ss = Console.ReadLine().Split(' ');\n d[p, i] = new int[3];\n d[p,i][0] = int.Parse(ss[0]);\n d[p, i][1] = int.Parse(ss[1]);\n d[p, i][2] = int.Parse(ss[2]);\n }\n }\n\n int max = 0;\n for (int p1 = 0; p1 < n; p1++)\n {\n for (int p2 = 0; p2 < n; p2++)\n {\n var list = new List>();\n for (int i = 0; i < m; i++)\n {\n var kv = new KeyValuePair( d[p2,i][1]-d[p1,i][0],i );\n list.Add(kv);\n }\n list.Sort(delegate(KeyValuePairkv1,KeyValuePairkv2){\n return -(kv1.Key-kv2.Key);\n });\n\n int q = k;\n int prof = 0;\n foreach(var v in list)\n {\n if (v.Key <= 0)\n break;\n if (q == 0)\n break;\n int qq = Math.Min(q,d[p1,v.Value][2]);\n prof+=(v.Key* qq);\n q -= qq;\n }\n\n max = Math.Max(max, prof);\n }\n }\n Console.WriteLine(max);\n }\n\n#if !DEBUG\n static void Main(string[] args)\n {\n new Solver().Solve();\n }\n#endif\n}\n\n\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "268d34e6e99ef841a035cbe2f45dea1f", "src_uid": "7419c4268a9815282fadca6581f28ec1", "difficulty": 1200.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 io.WriteLine((n-45 + 89) / 90);\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": "96529d2eafb366cbc6f5045b92e5cd29", "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.Threading.Tasks;\n\nnamespace _630M_Turn\n{\n class Program\n {\n static void Main(string[] args)\n {\n long x = long.Parse(Console.ReadLine());\n\n if (Math.Abs(x) > 360)\n x %= 360;\n if (x < 0)\n x += 360;\n if (x <= 45 || x >= 315 )\n Console.WriteLine(\"0\");\n else if (x > 45 && x <= 135)\n Console.WriteLine(\"1\");\n else if (x > 135 && x <= 225)\n Console.WriteLine(\"2\");\n else\n Console.WriteLine(\"3\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "61d756b7afd798e76e54472ac847d9cd", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.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 n = sc.Integer();\n var m = sc.Integer();\n var dist = Enumerate(n, x => new int[n]);\n for (int i = 0; i < n; i++)\n for (int j = i + 1; j < n; j++)\n dist[i][j] = dist[j][i] = 10000000;\n var G = Enumerate(n, x => new List());\n for (int i = 0; i < m; i++)\n {\n var f = sc.Integer() - 1;\n var t = sc.Integer() - 1;\n G[f].Add(t);\n G[t].Add(f);\n dist[f][t] = dist[t][f] = 1;\n }\n for (int k = 0; k < n; k++)\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n dist[i][j] = Math.Min(dist[i][j], dist[i][k] + dist[k][j]);\n\n var vs = Enumerate(n, x => Enumerate(n, y => new List()));\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n var x = dist[i][j];\n vs[i][x].Add(j);\n }\n var max = 1.0 / n;\n\n //\u5fc5\u305a n \u500b\n for (int f = 0; f < n; f++)\n {\n var psum = 0.0;\n //\u5168\u4f53\u3067n\u500b\n for (int d = 0; d < n; d++)\n {\n\n var cnt = vs[f][d].Count;\n if (cnt == 0) continue;\n var x = 1.0 / n;\n\n var p = new double[n];\n //\u5408\u8a08\u3067 m \u500b\n //\u3053\u3053\u307e\u3067\u3067O(N(N+M))\n var vv = new List();\n foreach (var v in vs[f][d])\n foreach (var to in G[v]) { p[to] += 1.0 / (n * G[v].Count); vv.Add(to); }\n vv = vv.Distinct().ToList();\n psum += Math.Max(x, solve(n, p, vv, dist));\n }\n max = Math.Max(max, psum);\n }\n IO.Printer.Out.WriteLine(max);\n }\n double solve(int n, double[] p, List vs, int[][] d)\n {\n var ret = 0.0;\n var r = new double[n];\n for (int f = 0; f < n; f++)\n {\n var z = 0.0;\n foreach (var v in vs)\n {\n var x = d[f][v];\n r[x] = Math.Max(r[x], p[v]);\n }\n foreach (var v in vs)\n {\n var x = d[f][v];\n z += r[x];\n r[x] = 0;\n }\n\n ret = Math.Max(ret, z);\n }\n return ret;\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": "e32b76d381f566cae459759f8c8b7e2b", "src_uid": "99b94d0c75fa6cd28091a9d71daf6cbf", "difficulty": 2900.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//\u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0442\u0435\u0441\u0442\u0435 12\nnamespace F\n{\n class Program\n {\n class tree\n {\n public long ves;\n public int nn;//\u0438\u043d\u0434\u0435\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\n public int nk;//\u0438\u043d\u0434\u0435\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\n public tree l;\n public tree r;\n public tree p;\n public tree(int[] m, int i1, int ik, tree p1)\n {\n if (i1 == ik)\n {\n nn = i1;\n nk = ik;\n l = null;\n r = null;\n ves = m[i1];\n wt[i1] = this;\n }\n else\n {\n int s = (ik + i1 + 1) / 2/*+ (ik - i1) % 2*/;\n nn = i1;\n nk = ik;\n l = new tree(m, i1, s - 1, this);\n r = new tree(m, s, ik, this);\n ves = l.ves + r.ves;\n }\n p = p1;\n }\n\n }\n static long FindVes(tree t1, tree tn)\n {\n long ves = 0;\n int x1 = t1.nn;\n int y1 = tn.nk;\n if (y1 < x1) return 0;\n tree ti = wt[x1];\n while (ti.nk < y1) ti = ti.p;\n ves = (long)ti.ves;\n tree tiv = ti;\n while (ti.nn < x1)\n {\n if (ti.r.nn <= x1)\n {\n ves = ves - (long)ti.l.ves;\n ti = ti.r;\n }\n else\n {\n ti = ti.l;\n }\n }\n ti = tiv;\n while (ti.nk > y1)\n {\n if (ti.l.nk >= y1)\n {\n ves = ves - (long)ti.r.ves;\n ti = ti.l;\n }\n else\n {\n ti = ti.r;\n }\n }\n return ves;\n }\n static tree[] wt;\n static void Main(string[] args)\n {\n TextReader sr = Console.In;\n //StreamReader sr = new StreamReader(\"in7.txt\");\n string[] s = sr.ReadLine().Split();\n int n = Convert.ToInt32(s[0]);\n int q = Convert.ToInt32(s[1]);\n s = sr.ReadLine().Split();\n string[] s1 = sr.ReadLine().Split();\n int[] a = new int[n];\n int[] w = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(s[i]);\n w[i] = Convert.ToInt32(s1[i]);\n }\n //\u0440\u0435\u0448\u0435\u043d\u0438\u0435\n wt = new tree[n];\n tree t1 = new tree(w, 0, n - 1, null);\n int x, y;\n tree ti;\n List res = new List();\n for (int i = 0; i < q; i++)\n {\n s = sr.ReadLine().Split();\n x = Convert.ToInt32(s[0]);\n y = Convert.ToInt32(s[1]);\n if (x < 0)\n {\n int delta = y - w[-1 - x];\n w[-1 - x] = y;\n ti = wt[-1 - x];\n while (ti != null)\n {\n ti.ves = ti.ves + delta;\n ti = ti.p;\n }\n }\n else\n {\n if (x == y)\n {\n res.Add(0);\n }\n else if ((y - x) == (a[y - 1] - a[x - 1]))\n {\n res.Add(0);\n }\n else if ((y - x) == 1)\n {\n if (w[x-1] > w[y-1])\n {\n res.Add((int)(((long)(a[y-1]- a[x - 1] - 1)* (long)w[y - 1])% (long)(1000000007)));\n }\n else\n {\n res.Add((int)(((long)(a[y - 1] - a[x - 1] - 1) * (long)w[x - 1]) % (long)(1000000007)));\n }\n }\n else\n {\n //\u043d\u0430\u0439\u0442\u0438 \u0432\u0435\u0441 \u043e\u0442\u0440\u0435\u0437\u043a\u0430\n int x1 = x - 1;\n int y1 = y - 1;\n long ves = FindVes(wt[x1], wt[y1]);\n long vl, vr,vv;\n int iis, iiss;\n int iisll=x1, iislr=y1;\n iis = (x1 + y1 + 1) / 2;\n vl = FindVes(wt[x1], wt[iis - 1]);\n vr = FindVes(wt[iis + 1],wt[y1] );\n while (true)\n {\n if ((vl + w[iis] > vr) && (vr + w[iis] > vl)) break;\n if (vl + w[iis] == vr) {\n if (w[iis] >= w[iis + 1]) break;\n else\n {\n iis++;\n break;\n }\n }\n if (vr + w[iis] == vl)\n {\n if (w[iis] >= w[iis - 1]) break;\n else\n {\n iis--;\n break;\n }\n }\n if ((vl + w[iis]) >(vr + w[iis]))\n {\n iiss = (iisll + iis) / 2;\n vv= FindVes(wt[iiss + 1], wt[iis- 1]);\n vl =vl-vv- w[iiss];\n vr =vr+vv+ w[iis];\n iislr = iis;\n iis = iiss;\n }\n else\n {\n iiss = (iislr + iis + 1) / 2;\n vv = FindVes(wt[iis + 1], wt[iiss - 1]);\n vl = vl + vv + w[iis];\n vr = vr - vv - w[iiss];\n iisll = iis;\n iis = iiss;\n }\n }\n long r = 0;\n for (int j = x1; j < iis; j++)\n {\n r = (r + ((long)w[j] * (long)(a[iis] - a[j] - (iis-j)))) % 1000000007;\n }\n for (int j = iis+1; j <=y1; j++)\n {\n r = (r + ((long)w[j] * (long)(a[j] - a[iis] - (j-iis)))) % 1000000007;\n }\n res.Add((int)r);\n }\n }\n }\n Console.WriteLine(string.Join(\"\\n\", res));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2704f704e1232ba40d6a97b8b53b2071", "src_uid": "c0715f71efa327070eba7e491856d66a", "difficulty": 2500.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 F\n{\n class Program\n {\n class tree\n {\n public long ves;\n public int nn;//\u0438\u043d\u0434\u0435\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\n public int nk;//\u0438\u043d\u0434\u0435\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\n public tree l;\n public tree r;\n public tree p;\n public tree(int[] m, int i1, int ik, tree p1)\n {\n if (i1 == ik)\n {\n nn = i1;\n nk = ik;\n l = null;\n r = null;\n ves = m[i1];\n wt[i1] = this;\n }\n else\n {\n int s = (ik + i1 + 1) / 2/*+ (ik - i1) % 2*/;\n nn = i1;\n nk = ik;\n l = new tree(m, i1, s - 1, this);\n r = new tree(m, s, ik, this);\n ves = l.ves + r.ves;\n }\n p = p1;\n }\n\n }\n static long FindVes(tree t1, tree tn)\n {\n long ves = 0;\n int x1 = t1.nn;\n int y1 = tn.nk;\n if (y1 < x1) return 0;\n tree ti = wt[x1];\n while (ti.nk < y1) ti = ti.p;\n ves = (long)ti.ves;\n tree tiv = ti;\n while (ti.nn < x1)\n {\n if (ti.r.nn <= x1)\n {\n ves = ves - (long)ti.l.ves;\n ti = ti.r;\n }\n else\n {\n ti = ti.l;\n }\n }\n ti = tiv;\n while (ti.nk > y1)\n {\n if (ti.l.nk >= y1)\n {\n ves = ves - (long)ti.r.ves;\n ti = ti.l;\n }\n else\n {\n ti = ti.r;\n }\n }\n return ves;\n }\n static tree[] wt;\n static void Main(string[] args)\n {\n TextReader sr = Console.In;\n //StreamReader sr = new StreamReader(\"in1.txt\");\n string[] s = sr.ReadLine().Split();\n int n = Convert.ToInt32(s[0]);\n int q = Convert.ToInt32(s[1]);\n s = sr.ReadLine().Split();\n string[] s1 = sr.ReadLine().Split();\n int[] a = new int[n];\n int[] w = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(s[i]);\n w[i] = Convert.ToInt32(s1[i]);\n }\n //\u0440\u0435\u0448\u0435\u043d\u0438\u0435\n wt = new tree[n];\n tree t1 = new tree(w, 0, n - 1, null);\n int x, y;\n tree ti;\n List res = new List();\n for (int i = 0; i < q; i++)\n {\n s = sr.ReadLine().Split();\n x = Convert.ToInt32(s[0]);\n y = Convert.ToInt32(s[1]);\n if (x < 0)\n {\n int delta = y - w[-1 - x];\n w[-1 - x] = y;\n ti = wt[-1 - x];\n while (ti != null)\n {\n ti.ves = ti.ves + delta;\n ti = ti.p;\n }\n }\n else\n {\n if (x == y)\n {\n res.Add(0);\n }\n else if ((y - x) == (a[y - 1] - a[x - 1]))\n {\n res.Add(0);\n }\n else if ((y - x) == 1)\n {\n if (w[x-1] > w[y-1])\n {\n res.Add((int)(((long)(a[y-1]- a[x - 1] - 1)* (long)w[y - 1])% (long)(1000000007)));\n }\n else\n {\n res.Add((int)(((long)(a[y - 1] - a[x - 1] - 1) * (long)w[x - 1]) % (long)(1000000007)));\n }\n }\n else\n {\n //\u043d\u0430\u0439\u0442\u0438 \u0432\u0435\u0441 \u043e\u0442\u0440\u0435\u0437\u043a\u0430\n int x1 = x - 1;\n int y1 = y - 1;\n long ves = FindVes(wt[x1], wt[y1]);\n long vl, vr,vv;\n int iis,iiss;\n iis = (x1 + y1 + 1) / 2;\n vl = FindVes(wt[x1], wt[iis - 1]);\n vr = FindVes(wt[iis + 1],wt[y1] );\n while (true)\n {\n if ((vl + w[iis] > vr) && (vr + w[iis] > vl)) break;\n if ((vl + w[iis] == vr) && (w[iis] >= w[iis+1])) break;\n if ((vr + w[iis] == vl) && (w[iis] >= w[iis - 1])) break;\n if ((vl + w[iis]) >(vr + w[iis]))\n {\n iiss = (x1 + iis + 1) / 2;\n vv= FindVes(wt[iiss + 1], wt[iis- 1]);\n vl =vl-vv- w[iiss];\n vr =vr+vv+ w[iis];\n iis = iiss;\n }\n else\n {\n iiss = (y1 + iis + 1) / 2;\n vv = FindVes(wt[iis + 1], wt[iiss - 1]);\n vl = vl + vv + w[iis];\n vr = vr - vv - w[iiss];\n iis = iiss;\n }\n }\n long r = 0;\n for (int j = x1; j < iis; j++)\n {\n r = (r + ((long)w[j] * (long)(a[iis] - a[j] - (iis-j)))) % 1000000007;\n }\n for (int j = iis+1; j <=y1; j++)\n {\n r = (r + ((long)w[j] * (long)(a[j] - a[iis] - (j-iis)))) % 1000000007;\n }\n res.Add((int)r);\n }\n }\n }\n Console.WriteLine(string.Join(\"\\n\", res));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c604838adcdda0bc035b4b0312aa25be", "src_uid": "c0715f71efa327070eba7e491856d66a", "difficulty": 2500.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 F\n{\n class Program\n {\n static Tree[] wt;\n class Tree\n {\n public long ves;\n public long ves_;\n public int nn;//\u0438\u043d\u0434\u0435\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\n public int nk;//\u0438\u043d\u0434\u0435\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\n public Tree l;\n public Tree r;\n public Tree p;\n public Tree(int[] m, int[] a, int i1, int ik, Tree p1)\n {\n nn = i1;\n nk = ik;\n if (i1 == ik)\n {\n l = null;\n r = null;\n ves = m[i1];\n ves_ = ((long)(a[i1] - i1) * (long)m[i1]) % (long)(1000000007);\n wt[i1] = this;\n }\n else\n {\n int s = (ik + i1 + 1) / 2;\n l = new Tree(m, a, i1, s - 1, this);\n r = new Tree(m, a, s, ik, this);\n ves = l.ves + r.ves;\n ves_ = (l.ves_ + r.ves_) % (long)(1000000007);\n }\n p = p1;\n }\n }\n\n static long FindVes(Tree t1, Tree tn, bool t)//t=true ves;t=false ves_;\n {\n long ves = 0;\n int x1 = t1.nn;\n int y1 = tn.nk;\n if (y1 < x1) return 0;\n Tree ti = wt[x1];\n long sub = 0;\n while (ti.nk < y1)\n {\n if (ti.p.r == ti && ti.p.l!=null)\n {\n if (t) sub = sub + ti.p.l.ves;\n else sub = (sub + ti.p.l.ves_) % (long)(1000000007);\n }\n ti = ti.p;\n }\n if (t) ves = (long)ti.ves;\n else ves = (long)ti.ves_;\n if (t) ves =ves-sub;\n else ves =(ves-sub+ +(long)(1000000007)) % (long)(1000000007);\n //Tree tiv = ti;\n //while (ti.nn < x1)\n //{\n // if (ti.r.nn <= x1)\n // {\n // if (t) ves = ves - (long)ti.l.ves;\n // else ves = (ves - (long)ti.l.ves_ + (long)(1000000007)) % (long)(1000000007);\n // ti = ti.r;\n // }\n // else\n // {\n // ti = ti.l;\n // }\n //}\n //ti = tiv;\n while (ti.nk > y1)\n {\n if (ti.l.nk >= y1)\n {\n if (t) ves = ves - (long)ti.r.ves;\n else ves = (ves - (long)ti.r.ves_ + (long)(1000000007)) % (long)(1000000007);\n ti = ti.l;\n }\n else\n {\n ti = ti.r;\n }\n }\n return ves;\n }\n\n static void Main(string[] args)\n {\n TextReader sr = Console.In;\n //StreamReader sr = new StreamReader(\"in1.txt\");\n string[] s = sr.ReadLine().Split();\n int n = Convert.ToInt32(s[0]);\n int q = Convert.ToInt32(s[1]);\n s = sr.ReadLine().Split();\n string[] s1 = sr.ReadLine().Split();\n int[] a = new int[n];\n int[] w = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(s[i]);\n w[i] = Convert.ToInt32(s1[i]);\n }\n //\u0440\u0435\u0448\u0435\u043d\u0438\u0435\n wt = new Tree[n];\n Tree t1 = new Tree(w, a, 0, n - 1, null);\n\n int ll;\n int rr;\n int id, nw;\n bool zapros1;\n Tree ti;\n List res = new List();\n for (int i = 0; i < q; i++)\n {\n s = sr.ReadLine().Split();\n ll = Convert.ToInt32(s[0]);\n if (ll < 0) zapros1 = true; else zapros1 = false;\n id = -1 - ll;\n ll--;\n nw = Convert.ToInt32(s[1]);\n rr = nw - 1;\n if (zapros1)\n {\n ti = wt[id];\n long delta = (long)nw - ti.ves;\n long delta_ = (((long)(a[id] - id) * (long)nw)) % (long)(1000000007) - ti.ves_;\n w[id] = nw;\n while (ti != null)\n {\n ti.ves = ti.ves + delta;\n ti.ves_ = (ti.ves_ + delta_ + (long)(1000000007)) % (long)(1000000007);\n ti = ti.p;\n }\n }\n else\n {\n if (ll == rr)\n {\n res.Add(0);\n }\n else if ((rr - ll) == (a[rr] - a[ll]))\n {\n res.Add(0);\n }\n else if ((rr - ll) == 1)\n {\n if (w[ll] > w[rr])\n {\n res.Add((int)(((long)(a[rr] - a[ll] - 1) * (long)w[rr]) % (long)(1000000007)));\n }\n else\n {\n res.Add((int)(((long)(a[rr] - a[ll] - 1) * (long)w[ll]) % (long)(1000000007)));\n }\n }\n else\n {\n //\u043d\u0430\u0439\u0442\u0438 \u0432\u0435\u0441 \u043e\u0442\u0440\u0435\u0437\u043a\u0430\n long ves = FindVes(wt[ll], wt[rr], true);\n long vl, vr, vv;\n int iis, iiss;\n int iisll = ll, iislr = rr;\n iis = (ll + rr + 1) / 2;\n vl = FindVes(wt[ll], wt[iis - 1], true);\n vr = FindVes(wt[iis + 1], wt[rr], true);\n while (true)\n {\n if ((vl + w[iis] > vr) && (vr + w[iis] > vl)) break;\n if (vl + w[iis] == vr)\n {\n if (w[iis] < w[iis + 1]) iis++;\n break;\n }\n if (vr + w[iis] == vl)\n {\n if (w[iis] < w[iis - 1]) iis--;\n break;\n }\n if ((vl) > (vr))\n {\n iiss = (iisll + iis) / 2;\n vv = FindVes(wt[iiss + 1], wt[iis - 1], true);\n vl = vl - vv - w[iiss];\n vr = vr + vv + w[iis];\n iislr = iis;\n iis = iiss;\n }\n else\n {\n iiss = (iislr + iis + 1) / 2;\n vv = FindVes(wt[iis + 1], wt[iiss - 1], true);\n vl = vl + vv + w[iis];\n vr = vr - vv - w[iiss];\n iisll = iis;\n iis = iiss;\n }\n }\n long r = 0;\n if (iis > ll)\n {\n r = (r - (FindVes(wt[ll], wt[iis - 1], false) % (long)(1000000007)) + (long)(1000000007)) % (long)(1000000007);\n r = (r + (long)(a[iis] - iis) * (FindVes(wt[ll], wt[iis - 1], true) % (long)(1000000007))) % (long)(1000000007);\n\n }\n if (iis < rr)\n {\n r = (r + (FindVes(wt[iis + 1], wt[rr], false)) % (long)(1000000007)) % (long)(1000000007);\n r = (r - (long)(a[iis] - iis) * (FindVes(wt[iis + 1], wt[rr], true) % (long)(1000000007)) % (long)(1000000007) + (long)(1000000007)) % (long)(1000000007);\n }\n res.Add((int)r);\n }\n }\n }\n Console.WriteLine(string.Join(\"\\n\", res));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cc3c5a5420b4ce9f442edfc8376d6df6", "src_uid": "c0715f71efa327070eba7e491856d66a", "difficulty": 2500.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": "00b25386fd77c986291bea187cbad70f", "src_uid": "3478e6a4ff2415508fd517413d40c13a", "difficulty": 2200.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 || n>2)))\n gfree = true;\n else if ((rpos >= 0 && (rcnt==1 || n>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": "c1311c28edd9771a9032fdd238662781", "src_uid": "69062f7c9b834e925ab23ebc2da96b52", "difficulty": 2600.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;\nusing System.Threading;\n\nnamespace Round356e\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 wa = Stopwatch.StartNew();\n //FileName = \"input\";\n var n = ReadIntToken();\n var k = ReadIntToken();\n var table = new bool[n, n];\n for (int i = 0; i < n; i++)\n {\n var input = Read();\n for (int j = 0; j < n; j++)\n table[i, j] = input[j] == '.';\n }\n Cell[,] cells;\n int componentCount;\n BFS(table, out cells, out componentCount);\n var ccWeights = new int[componentCount + 1];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (cells[i, j].CCNumber > 0)\n ccWeights[cells[i, j].CCNumber]++;\n }\n }\n var max = int.MinValue;\n var memory = new bool[componentCount + 1];\n for (int z = 0; z < n - k + 1; z++)\n {\n //Console.WriteLine(z + \" \" + wa.Elapsed);\n var activeField = new int[k, k];\n var ccStats = new int[componentCount + 1];\n var sumOfInternal = 0;\n var blockedCount = 0;\n for (int i = z; i < z + k; i++)\n {\n for (int j = 0; j < k; j++)\n {\n var cc = cells[i, j].CCNumber;\n if (cc > 0)\n {\n if (ccStats[cc] == 0)\n sumOfInternal += ccWeights[cc];\n ccStats[cc] += 1;\n }\n else\n blockedCount++;\n }\n }\n\n var max2 = Math.Max(max, Sum(GetNeighboursCcs(z, 0, k, n, cells, memory), ccStats, ccWeights) + sumOfInternal + blockedCount);\n if (max2 > max)\n max = max2;\n\n for (int w = 1; w < n - k + 1; w++)\n {\n for (int i = 0; i < k; i++)\n {\n var ccNumber = cells[z + i, w - 1].CCNumber;\n if (ccNumber > 0)\n {\n ccStats[ccNumber]--;\n if (ccStats[ccNumber] == 0)\n sumOfInternal -= ccWeights[ccNumber];\n }\n else\n blockedCount--;\n\n ccNumber = cells[z + i, w + k - 1].CCNumber;\n if (ccNumber > 0)\n {\n if (ccStats[ccNumber] == 0)\n sumOfInternal += ccWeights[ccNumber];\n ccStats[ccNumber]++;\n }\n else\n blockedCount++;\n }\n max2 = Math.Max(max, Sum(GetNeighboursCcs(z, w, k, n, cells, memory), ccStats, ccWeights) + sumOfInternal + blockedCount);\n if (max2 > max)\n max = max2;\n }\n }\n if (!string.IsNullOrEmpty(FileName))\n Console.WriteLine(wa.Elapsed);\n return max;\n //return here\n }\n }\n\n int Sum(List list, int[] set, int[] weights)\n {\n var sum = 0;\n foreach (var cc in list)\n if (set[cc] == 0)\n sum += weights[cc];\n return sum;\n }\n\n List GetNeighboursCcs(int i, int j, int k, int n, Cell[,] cells, bool[] memory)\n {\n var result = new List();\n if (i > 0)\n //.Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + k, j + x)))\n //.Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + x, j - 1)))\n //.Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + x, j + k))))\n for (var x = 0; x < k; x++)\n {\n var cc = cells[i - 1, j + x].CCNumber;\n if (cc > 0 && !memory[cc])\n {\n result.Add(cc);\n memory[cc] = true;\n }\n }\n if (i + k < n)\n for (var x = 0; x < k; x++)\n {\n var cc = cells[i + k, j + x].CCNumber;\n if (cc > 0 && !memory[cc])\n {\n result.Add(cc);\n memory[cc] = true;\n }\n }\n if (j > 0)\n for (var x = 0; x < k; x++)\n {\n var cc = cells[i + x, j - 1].CCNumber;\n if (cc > 0 && !memory[cc])\n {\n result.Add(cc);\n memory[cc] = true;\n }\n }\n if (j + k < n)\n for (var x = 0; x < k; x++)\n {\n var cc = cells[i + x, j + k].CCNumber;\n if (cc > 0 && !memory[cc])\n {\n result.Add(cc);\n memory[cc] = true;\n }\n }\n foreach (var cc in result)\n {\n memory[cc] = false;\n }\n return result;\n }\n\n void BFS(bool[,] input, out Cell[,] cells, out int componentCount)\n {\n var n = input.GetLength(0);\n cells = new Cell[n, n];\n var visited = new bool[n, n];\n var componentIndex = 0;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (!visited[i, j] && input[i, j])\n BFS(i, j, cells, input, visited, ++componentIndex);\n componentCount = componentIndex;\n }\n\n void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)\n {\n var n = input.GetLength(0);\n visited[i, j] = true;\n cells[i, j].CCNumber = ccIndex;\n var neighbours = new[] { Struct.Create(i + 1, j), Struct.Create(i - 1, j), Struct.Create(i, j + 1), Struct.Create(i, j - 1) };\n foreach (var c in neighbours.Where(x => x.Item1 >= 0 && x.Item1 < n && x.Item2 >= 0 && x.Item2 < n && !visited[x.Item1, x.Item2] && input[x.Item1, x.Item2]))\n BFS(c.Item1, c.Item2, cells, input, visited, ccIndex);\n }\n\n struct Cell\n {\n public int CCNumber { get; set; }\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { 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}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "edd8be7ebdaec62b2fb23b377dcf2de2", "src_uid": "d575f9bbdf625202807db59490c5c327", "difficulty": 2400.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;\nusing System.Web.Script.Serialization;\nusing System.Numerics;\n\nclass Program\n{/*\n public class Point\n {\n public int X;\n public int Y;\n\n public Point(int x, int y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public static Point operator +(Point a, Point b)\n {\n return new Point(a.X + b.X, a.Y + b.Y);\n }\n\n public static Point operator -(Point a, Point b)\n {\n return new Point(a.X - b.X, a.Y - b.Y);\n }\n\n public double Dist()\n {\n return Math.Sqrt(this.DistRoot());\n }\n\n public long DistRoot()\n {\n return this.X * (long)this.X + this.Y * (long)this.Y;\n }\n\n public override string ToString()\n {\n return this.X + \" \" + this.Y;\n }\n }\n\n public class Segment\n {\n public Point A;\n public Point B;\n\n public Segment(Point a, Point b)\n {\n this.A = a;\n this.B = b;\n }\n\n public double Dist()\n {\n return (this.A - this.B).Dist();\n }\n\n public long DistRoot()\n {\n return (this.A - this.B).DistRoot();\n }\n }\n\n private static Point ReadPoint()\n {\n return new Point(ReadInt(), ReadInt());\n }\n\n public static long ScalarProduct(Point a, Point b)\n {\n return a.X * (long)b.Y - b.X * (long)a.Y;\n }\n\n public static bool OnLine(Segment line, Point p)\n {\n var v1 = line.B - line.A;\n var v2 = p - line.A;\n\n if (v2.X == 0 && v2.Y == 0) return true;\n if (v2.X == v1.X && v2.Y == v1.Y) return true;\n if (ScalarProduct(v1, v2) != 0) return false;\n\n if (v2.DistRoot() > v1.DistRoot()) return false;\n\n if (v1.X != 0 && v2.X != 0)\n {\n return (v1.X > 0) == (v2.X > 0);\n }\n\n if (v1.Y != 0 && v2.Y != 0)\n {\n return (v1.Y > 0) == (v2.Y > 0);\n }\n\n throw new NotSupportedException(\"wtf?\");\n }\n\n public static bool Crossed(Segment a, Segment b)\n {\n var sp1 = ScalarProduct(a.B - a.A, b.A - a.A);\n var sp2 = ScalarProduct(a.B - a.A, b.B - a.A);\n if (sp1 < 0 && sp2 < 0) return false;\n if (sp1 > 0 && sp2 > 0) return false;\n\n var sp3 = ScalarProduct(b.B - b.A, a.A - b.A);\n var sp4 = ScalarProduct(b.B - b.A, a.B - b.A);\n if (sp3 < 0 && sp4 < 0) return false;\n if (sp3 > 0 && sp4 > 0) return false;\n\n return true;\n }\n\n public static bool CrossedNoTouch(Segment a, Segment b)\n {\n var sp1 = ScalarProduct(a.B - a.A, b.A - a.A);\n var sp2 = ScalarProduct(a.B - a.A, b.B - a.A);\n if (sp1 <= 0 && sp2 <= 0) return false;\n if (sp1 >= 0 && sp2 >= 0) return false;\n\n var sp3 = ScalarProduct(b.B - b.A, a.A - b.A);\n var sp4 = ScalarProduct(b.B - b.A, a.B - b.A);\n if (sp3 <= 0 && sp4 <= 0) return false;\n if (sp3 >= 0 && sp4 >= 0) return false;\n\n return true;\n }\n\n private static double Solve(Point s, Point t, Point a, Point b, Point c)\n {\n var st = new Segment(s, t);\n var ab = new Segment(a, b);\n var bc = new Segment(b, c);\n var ac = new Segment(a, c);\n\n\n if (ScalarProduct(b - a, c - a) == 0)\n {\n var q = ab;\n if (q.Dist() < bc.Dist()) q = bc;\n if (q.Dist() < ac.Dist()) q = ac;\n\n if (Crossed(q, st))\n {\n var d1 = (q.A - s).Dist() + (q.A - t).Dist();\n var d2 = (q.B - s).Dist() + (q.B - t).Dist();\n return Math.Min(d1, d2);\n }\n\n return (s - t).Dist();\n }\n\n if (!Crossed(ab, st) && !Crossed(bc, st))\n {\n return (s - t).Dist();\n }\n\n p[0] = s;\n p[1] = t;\n p[2] = a;\n p[3] = b;\n p[4] = c;\n\n for (int i = 0; i < d.Length; i++) d[i] = 1e10;\n\n Go(0, 0);\n\n return d[1];\n }\n\n private static Point[] p = new Point[5];\n private static double[] d = new double[5];\n private static void Go(int pos, double dist)\n {\n if (d[pos] < dist) return;\n d[pos] = dist;\n if (pos == 1) return;\n\n\n }*/\n\n private static void Main(string[] args)\n {\n /*\n PushTestData(@\"\n1\n0 0 0 10 -10 20 0 1 10 20\n0 0 0 10 -10 20 1 1 10 20\n0 0 0 10 -10 20 -1 1 10 20\n\n0 0 0 10 -10 1 0 1 10 1\n0 0 0 10 -10 1 1 1 10 1\n0 0 0 10 -10 1 -1 1 10 1\n\n\n\n\n\n\");\n\n int n = ReadInt();\n double[] answer = new double[n];\n for (int i = 0; i < n; i++)\n {\n var s = ReadPoint();\n var t = ReadPoint();\n var a = ReadPoint();\n var b = ReadPoint();\n var c = ReadPoint();\n\n answer[i] = Solve(s, t, a, b, c);\n }\n\n Console.WriteLine(string.Join(Environment.NewLine, answer));*/\n\n n = ReadInt();\n k = ReadInt();\n map = new int[n, n];\n sum = new int[n, n];\n sid = new int[n, n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n map[i, j] = ReadCh();\n\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n int d = 1 - map[i, j];\n if (i > 0) d += sum[i - 1, j];\n if (j > 0) d += sum[i, j - 1];\n if (i > 0 && j > 0) d -= sum[i - 1, j - 1];\n sum[i, j] = d;\n }\n\n int nextId = 1;\n segmentSize = new int[n * n + 1];\n markedSegments = new int[n * n + 1];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (map[i, j] + sid[i, j] == 0)\n {\n MarkSegment(i, j, nextId);\n nextId++;\n }\n\n int ep = k < n ? k : k - 1;\n for (int i = 0; i <= ep; i++)\n for (int j = 0; j <= ep; j++)\n AddItem(sid[i, j], 1);\n\n if (k < n)\n AddItem(sid[k, k], -1);\n\n CalculateAnswer(0, 0);\n for (int i = 0; i <= n - k; i++)\n {\n if (i % 2 == 0)\n for (int j = 0; j < n - k; j++)\n {\n MoveRight(i, j);\n CalculateAnswer(i, j + 1);\n }\n\n if (i % 2 == 1)\n for (int j = n - k; j > 0; j--)\n {\n MoveLeft(i, j);\n CalculateAnswer(i, j - 1);\n }\n\n if (i < n - k)\n {\n int j = n - k - (i % 2) * (n - k);\n MoveDown(i, j);\n CalculateAnswer(i + 1, j);\n }\n }\n\n Console.WriteLine(answer);\n }\n\n private static void MoveRight(int i, int j, int delta = 1)\n {\n if (i > 0 && j >= 0) AddItem(sid[i - 1, j], -delta);\n if (i + k < n && j >= 0) AddItem(sid[i + k, j], -delta);\n if (j > 0)\n for (int ii = 0; ii < k; ii++) AddItem(sid[i + ii, j - 1], -delta);\n\n j += k;\n if (i > 0 && j < n) AddItem(sid[i - 1, j], delta);\n if (i + k < n && j < n) AddItem(sid[i + k, j], delta);\n if (j + 1 < n)\n for (int ii = 0; ii < k; ii++) AddItem(sid[i + ii, j + 1], delta);\n }\n\n private static void MoveLeft(int i, int j)\n {\n MoveRight(i, j - 1, -1);\n }\n\n private static void MoveDown(int i, int j)\n {\n if (i > 0)\n for (int jj = 0; jj < k; jj++)\n AddItem(sid[i - 1, j + jj], -1);\n if (j > 0) AddItem(sid[i, j - 1], -1);\n if (j + k < n) AddItem(sid[i, j + k], -1);\n\n\n i += k;\n if (i + 1 < n)\n for (int jj = 0; jj < k; jj++)\n AddItem(sid[i + 1, j + jj], 1);\n\n if (j > 0) AddItem(sid[i, j - 1], 1);\n if (j + k < n) AddItem(sid[i, j + k], 1);\n\n }\n\n private static void AddItem(int segmentId, int delta)\n {\n if (segmentId <= 0) return;\n int before = markedSegments[segmentId];\n markedSegments[segmentId] += delta;\n\n if (before == 0) totalSegmentsSize += segmentSize[segmentId];\n if (markedSegments[segmentId] == 0) totalSegmentsSize -= segmentSize[segmentId];\n }\n\n private static int totalSegmentsSize;\n private static int answer = 0;\n private static int n, k;\n private static int[,] map, sum, sid;\n private static int[] segmentSize, markedSegments;\n private static void MarkSegment(int i, int j, int id)\n {\n if (i < 0 || j < 0 || i >= n || j >= n) return;\n if (map[i, j] == 1) return;\n if (sid[i, j] > 0) return;\n sid[i, j] = id;\n segmentSize[id]++;\n\n MarkSegment(i - 1, j, id);\n MarkSegment(i + 1, j, id);\n MarkSegment(i, j - 1, id);\n MarkSegment(i, j + 1, id);\n }\n\n private static int GetCountInside(int i, int j)\n {\n int ans = sum[i + k - 1, j + k - 1];\n if (i > 0) ans -= sum[i - 1, j + k - 1];\n if (j > 0) ans -= sum[i + k - 1, j - 1];\n if (i > 0 && j > 0) ans += sum[i - 1, j - 1];\n\n return k * k - ans;\n }\n\n private static void CalculateAnswer(int i, int j)\n {\n int newAnswer = totalSegmentsSize + GetCountInside(i, j);\n answer = Math.Max(answer, newAnswer);\n }\n\n private static int ReadCh()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == 'X') return 1;\n if (ans == '.') return 0;\n }\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt() - 1;\n int b = ReadInt() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(string data)\n {\n#if !ONLINE_JUDGE\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "582a9b8ad10b654101ef7c6b72bd213c", "src_uid": "d575f9bbdf625202807db59490c5c327", "difficulty": 2400.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;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n var n = ReadIntToken();\n var k = ReadIntToken();\n var table = new bool[n, n];\n for (int i = 0; i < n; i++)\n {\n var input = Read();\n for (int j = 0; j < n; j++)\n table[i, j] = input[j] == '.';\n }\n Cell[,] cells;\n int componentCount;\n BFS(table, out cells, out componentCount);\n var ccWeights = new int[componentCount + 1];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (cells[i, j].CCNumber > 0)\n ccWeights[cells[i, j].CCNumber]++;\n }\n }\n var max = int.MinValue;\n for (int z = 0; z < n - k + 1; z++)\n {\n var activeField = new int[k, k];\n var ccStats = new int[componentCount + 1];\n var fieldCCs = new HashSet();\n var blockedCount = 0;\n for (int i = z; i < z + k; i++)\n {\n for (int j = 0; j < k; j++)\n {\n if (cells[i, j].CCNumber > 0)\n {\n ccStats[cells[i, j].CCNumber] += 1;\n fieldCCs.Add(cells[i, j].CCNumber);\n }\n else\n blockedCount++;\n }\n }\n \n var touchedCCs = GetNeighboursCcs(z, 0, k, n, cells).Concat(fieldCCs).Distinct();\n max = Math.Max(max, touchedCCs.Select(x => ccWeights[x]).Sum() + blockedCount);\n\n for (int w = 1; w < n - k + 1; w++)\n {\n for (int i = 0; i < k; i++)\n {\n var ccNumber = cells[z + i, w - 1].CCNumber;\n if (ccNumber == 0)\n blockedCount--;\n else\n {\n ccStats[ccNumber]--;\n if (ccStats[ccNumber] == 0)\n fieldCCs.Remove(ccNumber);\n }\n ccNumber = cells[z + i, w + k - 1].CCNumber;\n if (ccNumber == 0)\n blockedCount++;\n else\n {\n if (ccStats[ccNumber] == 0)\n fieldCCs.Add(ccNumber);\n ccStats[ccNumber]++;\n }\n }\n touchedCCs = GetNeighboursCcs(z, w, k, n, cells).Concat(fieldCCs).Distinct();\n max = Math.Max(touchedCCs.Sum(x => ccWeights[x]) + blockedCount, max);\n }\n }\n return max;\n //return here\n }\n }\n\n IEnumerable GetNeighboursCcs(int i, int j, int k, int n, Cell[,] cells)\n {\n return Enumerable.Range(0, k).Select(x => Struct.Create(i - 1, j + x))\n .Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + k, j + x)))\n .Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + x, j - 1)))\n .Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + x, j + k)))\n .Where(x => x.Item1 >= 0 && x.Item1 < n && x.Item2 >= 0 && x.Item2 < n)\n .Select(x => cells[x.Item1, x.Item2].CCNumber).Where(x => x > 0);\n }\n\n void BFS(bool[,] input, out Cell[,] cells, out int componentCount)\n {\n var n = input.GetLength(0);\n cells = new Cell[n, n];\n var visited = new bool[n, n];\n var componentIndex = 0;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (!visited[i, j] && input[i, j])\n BFS(i, j, cells, input, visited, ++componentIndex);\n componentCount = componentIndex;\n }\n\n void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)\n {\n var n = input.GetLength(0);\n visited[i, j] = true;\n cells[i, j].CCNumber = ccIndex;\n var neighbours = new[] { Struct.Create(i + 1, j), Struct.Create(i - 1, j), Struct.Create(i, j + 1), Struct.Create(i, j - 1) };\n foreach (var c in neighbours.Where(x => x.Item1 >= 0 && x.Item1 < n && x.Item2 >= 0 && x.Item2 < n && !visited[x.Item1, x.Item2] && input[x.Item1, x.Item2]))\n BFS(c.Item1, c.Item2, cells, input, visited, ccIndex);\n }\n\n struct Cell\n {\n public int CCNumber { get; set; }\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d37638e8ee243b7f9e5dcd1b7288c29a", "src_uid": "d575f9bbdf625202807db59490c5c327", "difficulty": 2400.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;\nusing System.Threading;\n\nnamespace Round356e\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n \n static void Main2(string[] args)\n {\n var result = new List();\n result.Add(\"500 250\");\n bool flag = true;\n for (int i = 0; i < 500; i++)\n {\n if (flag)\n result.Add(Enumerable.Repeat(\".X\", 250).JoinStrings(\"\"));\n else\n result.Add(Enumerable.Repeat(\"X.\", 250).JoinStrings(\"\"));\n flag = !flag;\n }\n File.WriteAllText(\"c:\\\\dev\\\\input\", result.JoinStrings(\"\\n\"));\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 wa = Stopwatch.StartNew();\n FileName = \"input\";\n var n = ReadIntToken();\n var k = ReadIntToken();\n var table = new bool[n, n];\n for (int i = 0; i < n; i++)\n {\n var input = Read();\n for (int j = 0; j < n; j++)\n table[i, j] = input[j] == '.';\n }\n Cell[,] cells;\n int componentCount;\n BFS(table, out cells, out componentCount);\n var ccWeights = new int[componentCount + 1];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (cells[i, j].CCNumber > 0)\n ccWeights[cells[i, j].CCNumber]++;\n }\n }\n Console.WriteLine(wa.Elapsed);\n var max = int.MinValue;\n for (int z = 0; z < n - k + 1; z++)\n {\n //Console.WriteLine(z + \" \" + wa.Elapsed);\n var activeField = new int[k, k];\n var ccStats = new int[componentCount + 1];\n var sumOfInternal = 0;\n var blockedCount = 0;\n for (int i = z; i < z + k; i++)\n {\n for (int j = 0; j < k; j++)\n {\n var cc = cells[i, j].CCNumber;\n if (cc > 0)\n {\n if (ccStats[cc] == 0)\n sumOfInternal += ccWeights[cc];\n ccStats[cc] += 1;\n }\n else\n blockedCount++;\n }\n }\n \n var max2 = Math.Max(max, Sum(GetNeighboursCcs(z, 0, k, n, cells), ccStats, ccWeights) + sumOfInternal + blockedCount);\n if (max2 > max)\n max = max2;\n\n for (int w = 1; w < n - k + 1; w++)\n {\n for (int i = 0; i < k; i++)\n {\n var ccNumber = cells[z + i, w - 1].CCNumber;\n if (ccNumber > 0)\n {\n ccStats[ccNumber]--;\n if (ccStats[ccNumber] == 0)\n sumOfInternal -= ccWeights[ccNumber];\n }\n else\n blockedCount--;\n\n ccNumber = cells[z + i, w + k - 1].CCNumber;\n if (ccNumber > 0)\n {\n if (ccStats[ccNumber] == 0)\n sumOfInternal += ccWeights[ccNumber];\n ccStats[ccNumber]++;\n }\n else\n blockedCount++;\n }\n max2 = Math.Max(max, Sum(GetNeighboursCcs(z, w, k, n, cells), ccStats, ccWeights) + sumOfInternal + blockedCount);\n if (max2 > max)\n max = max2;\n }\n }\n Console.WriteLine(wa.Elapsed);\n return max;\n //return here\n }\n }\n\n int Sum(IEnumerable list, int[] set, int[] weights)\n {\n var second = new List();\n foreach (var cc in list)\n if (set[cc] == 0)\n second.Add(cc);\n var sum = 0;\n foreach (var cc in second)\n sum += weights[cc];\n return sum;\n }\n\n IEnumerable GetNeighboursCcs(int i, int j, int k, int n, Cell[,] cells)\n {\n var result = new HashSet();\n if (i > 0)\n //.Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + k, j + x)))\n //.Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + x, j - 1)))\n //.Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + x, j + k))))\n for (var x = 0; x < k; x++)\n {\n var cc = cells[i - 1, j + x].CCNumber;\n if (cc > 0 && !result.Contains(cc))\n result.Add(cc);\n }\n if (i + k < n)\n for (var x = 0; x < k; x++)\n {\n var cc = cells[i + k, j + x].CCNumber;\n if (cc > 0 && !result.Contains(cc))\n result.Add(cc);\n }\n if (j > 0)\n for (var x = 0; x < k; x++)\n {\n var cc = cells[i + x, j - 1].CCNumber;\n if (cc > 0 && !result.Contains(cc))\n result.Add(cc);\n }\n if (j + k < n)\n for (var x = 0; x < k; x++)\n {\n var cc = cells[i + x, j + k].CCNumber;\n if (cc > 0 && !result.Contains(cc))\n result.Add(cc);\n }\n return result;\n }\n\n void BFS(bool[,] input, out Cell[,] cells, out int componentCount)\n {\n var n = input.GetLength(0);\n cells = new Cell[n, n];\n var visited = new bool[n, n];\n var componentIndex = 0;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (!visited[i, j] && input[i, j])\n BFS(i, j, cells, input, visited, ++componentIndex);\n componentCount = componentIndex;\n }\n\n void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)\n {\n var n = input.GetLength(0);\n visited[i, j] = true;\n cells[i, j].CCNumber = ccIndex;\n var neighbours = new[] { Struct.Create(i + 1, j), Struct.Create(i - 1, j), Struct.Create(i, j + 1), Struct.Create(i, j - 1) };\n foreach (var c in neighbours.Where(x => x.Item1 >= 0 && x.Item1 < n && x.Item2 >= 0 && x.Item2 < n && !visited[x.Item1, x.Item2] && input[x.Item1, x.Item2]))\n BFS(c.Item1, c.Item2, cells, input, visited, ccIndex);\n }\n\n struct Cell\n {\n public int CCNumber { get; set; }\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "084a50686d93547f2120df85c877c115", "src_uid": "d575f9bbdf625202807db59490c5c327", "difficulty": 2400.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;\nusing System.Web.Script.Serialization;\nusing System.Numerics;\n\nclass Program\n{/*\n public class Point\n {\n public int X;\n public int Y;\n\n public Point(int x, int y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public static Point operator +(Point a, Point b)\n {\n return new Point(a.X + b.X, a.Y + b.Y);\n }\n\n public static Point operator -(Point a, Point b)\n {\n return new Point(a.X - b.X, a.Y - b.Y);\n }\n\n public double Dist()\n {\n return Math.Sqrt(this.DistRoot());\n }\n\n public long DistRoot()\n {\n return this.X * (long)this.X + this.Y * (long)this.Y;\n }\n\n public override string ToString()\n {\n return this.X + \" \" + this.Y;\n }\n }\n\n public class Segment\n {\n public Point A;\n public Point B;\n\n public Segment(Point a, Point b)\n {\n this.A = a;\n this.B = b;\n }\n\n public double Dist()\n {\n return (this.A - this.B).Dist();\n }\n\n public long DistRoot()\n {\n return (this.A - this.B).DistRoot();\n }\n }\n\n private static Point ReadPoint()\n {\n return new Point(ReadInt(), ReadInt());\n }\n\n public static long ScalarProduct(Point a, Point b)\n {\n return a.X * (long)b.Y - b.X * (long)a.Y;\n }\n\n public static bool OnLine(Segment line, Point p)\n {\n var v1 = line.B - line.A;\n var v2 = p - line.A;\n\n if (v2.X == 0 && v2.Y == 0) return true;\n if (v2.X == v1.X && v2.Y == v1.Y) return true;\n if (ScalarProduct(v1, v2) != 0) return false;\n\n if (v2.DistRoot() > v1.DistRoot()) return false;\n\n if (v1.X != 0 && v2.X != 0)\n {\n return (v1.X > 0) == (v2.X > 0);\n }\n\n if (v1.Y != 0 && v2.Y != 0)\n {\n return (v1.Y > 0) == (v2.Y > 0);\n }\n\n throw new NotSupportedException(\"wtf?\");\n }\n\n public static bool Crossed(Segment a, Segment b)\n {\n var sp1 = ScalarProduct(a.B - a.A, b.A - a.A);\n var sp2 = ScalarProduct(a.B - a.A, b.B - a.A);\n if (sp1 < 0 && sp2 < 0) return false;\n if (sp1 > 0 && sp2 > 0) return false;\n\n var sp3 = ScalarProduct(b.B - b.A, a.A - b.A);\n var sp4 = ScalarProduct(b.B - b.A, a.B - b.A);\n if (sp3 < 0 && sp4 < 0) return false;\n if (sp3 > 0 && sp4 > 0) return false;\n\n return true;\n }\n\n public static bool CrossedNoTouch(Segment a, Segment b)\n {\n var sp1 = ScalarProduct(a.B - a.A, b.A - a.A);\n var sp2 = ScalarProduct(a.B - a.A, b.B - a.A);\n if (sp1 <= 0 && sp2 <= 0) return false;\n if (sp1 >= 0 && sp2 >= 0) return false;\n\n var sp3 = ScalarProduct(b.B - b.A, a.A - b.A);\n var sp4 = ScalarProduct(b.B - b.A, a.B - b.A);\n if (sp3 <= 0 && sp4 <= 0) return false;\n if (sp3 >= 0 && sp4 >= 0) return false;\n\n return true;\n }\n\n private static double Solve(Point s, Point t, Point a, Point b, Point c)\n {\n var st = new Segment(s, t);\n var ab = new Segment(a, b);\n var bc = new Segment(b, c);\n var ac = new Segment(a, c);\n\n\n if (ScalarProduct(b - a, c - a) == 0)\n {\n var q = ab;\n if (q.Dist() < bc.Dist()) q = bc;\n if (q.Dist() < ac.Dist()) q = ac;\n\n if (Crossed(q, st))\n {\n var d1 = (q.A - s).Dist() + (q.A - t).Dist();\n var d2 = (q.B - s).Dist() + (q.B - t).Dist();\n return Math.Min(d1, d2);\n }\n\n return (s - t).Dist();\n }\n\n if (!Crossed(ab, st) && !Crossed(bc, st))\n {\n return (s - t).Dist();\n }\n\n p[0] = s;\n p[1] = t;\n p[2] = a;\n p[3] = b;\n p[4] = c;\n\n for (int i = 0; i < d.Length; i++) d[i] = 1e10;\n\n Go(0, 0);\n\n return d[1];\n }\n\n private static Point[] p = new Point[5];\n private static double[] d = new double[5];\n private static void Go(int pos, double dist)\n {\n if (d[pos] < dist) return;\n d[pos] = dist;\n if (pos == 1) return;\n\n\n }*/\n\n private static void Main(string[] args)\n {\n /*\n PushTestData(@\"\n1\n0 0 0 10 -10 20 0 1 10 20\n0 0 0 10 -10 20 1 1 10 20\n0 0 0 10 -10 20 -1 1 10 20\n\n0 0 0 10 -10 1 0 1 10 1\n0 0 0 10 -10 1 1 1 10 1\n0 0 0 10 -10 1 -1 1 10 1\n\n\n\n\n\n\");\n\n int n = ReadInt();\n double[] answer = new double[n];\n for (int i = 0; i < n; i++)\n {\n var s = ReadPoint();\n var t = ReadPoint();\n var a = ReadPoint();\n var b = ReadPoint();\n var c = ReadPoint();\n\n answer[i] = Solve(s, t, a, b, c);\n }\n\n Console.WriteLine(string.Join(Environment.NewLine, answer));*/\n\n PushTestData(@\"\n3 2\n...\nXX.\nXX.\n\n\");\n \n\n n = ReadInt();\n k = ReadInt();\n map = new int[n, n];\n sum = new int[n, n];\n sid = new int[n, n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n map[i, j] = ReadCh();\n\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n int d = 1 - map[i, j];\n if (i > 0) d += sum[i - 1, j];\n if (j > 0) d += sum[i, j - 1];\n if (i > 0 && j > 0) d -= sum[i - 1, j - 1];\n sum[i, j] = d;\n }\n\n int nextId = 1;\n segmentSize = new int[n * n + 1];\n markedSegments = new int[n * n + 1];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (map[i, j] + sid[i, j] == 0)\n {\n MarkSegment(i, j, nextId);\n nextId++;\n }\n\n for (int i = 0; i < k; i++)\n for (int j = 0; j < k; j++)\n AddItem(sid[i, j], 1);\n\n CalculateAnswer(0, 0);\n\n for (int i = 0; i <= n - k; i++)\n {\n if (i % 2 == 0)\n for (int j = 0; j <= n - k; j++)\n {\n Change(i, j, 1);\n CalculateAnswer(i, j);\n Change(i, j, -1);\n }\n\n if (i % 2 == 1)\n for (int j = n - k; j >= 0; j--)\n {\n Change(i, j, 1);\n CalculateAnswer(i, j);\n Change(i, j, -1);\n }\n\n if (i < n - k)\n {\n int j = n - k - (i % 2) * (n - k);\n Change(i, j, 1);\n CalculateAnswer(i, j);\n Change(i, j, -1);\n }\n }\n\n Console.WriteLine(answer);\n }\n\n private static void Change(int i, int j, int delta = 1)\n {\n for (int x = 0; x < k; x++)\n {\n AddItem(i + x, j - 1, delta);\n AddItem(i + x, j + k, delta);\n AddItem(i - 1, j + x, delta);\n AddItem(i + k, j + x, delta);\n }\n }\n\n private static void MoveRight(int i, int j, int delta = 1)\n {\n if (i > 0 && j >= 0) AddItem(sid[i - 1, j], -delta);\n if (i + k < n && j >= 0) AddItem(sid[i + k, j], -delta);\n if (j > 0)\n for (int ii = 0; ii < k; ii++) AddItem(sid[i + ii, j - 1], -delta);\n\n j += k;\n if (i > 0 && j < n) AddItem(sid[i - 1, j], delta);\n if (i + k < n && j < n) AddItem(sid[i + k, j], delta);\n if (j + 1 < n)\n for (int ii = 0; ii < k; ii++) AddItem(sid[i + ii, j + 1], delta);\n }\n\n private static void MoveLeft(int i, int j)\n {\n MoveRight(i, j - 1, -1);\n }\n\n private static void MoveDown(int i, int j)\n {\n if (i > 0)\n for (int jj = 0; jj < k; jj++)\n AddItem(sid[i - 1, j + jj], -1);\n if (j > 0) AddItem(sid[i, j - 1], -1);\n if (j + k < n) AddItem(sid[i, j + k], -1);\n\n\n i += k;\n if (i + 1 < n)\n for (int jj = 0; jj < k; jj++)\n AddItem(sid[i + 1, j + jj], 1);\n\n if (j > 0) AddItem(sid[i, j - 1], 1);\n if (j + k < n) AddItem(sid[i, j + k], 1);\n\n }\n\n private static void AddItem(int i, int j, int delta)\n {\n if (i < 0 || j < 0 || i >= n || j >= n) return;\n AddItem(sid[i, j], delta);\n }\n\n private static void AddItem(int segmentId, int delta)\n {\n if (segmentId <= 0) return;\n int before = markedSegments[segmentId];\n markedSegments[segmentId] += delta;\n\n if (before == 0) totalSegmentsSize += segmentSize[segmentId];\n if (markedSegments[segmentId] == 0) totalSegmentsSize -= segmentSize[segmentId];\n }\n\n private static int totalSegmentsSize;\n private static int answer = 0;\n private static int n, k;\n private static int[,] map, sum, sid;\n private static int[] segmentSize, markedSegments;\n private static void MarkSegment(int i, int j, int id)\n {\n if (i < 0 || j < 0 || i >= n || j >= n) return;\n if (map[i, j] == 1) return;\n if (sid[i, j] > 0) return;\n sid[i, j] = id;\n segmentSize[id]++;\n\n MarkSegment(i - 1, j, id);\n MarkSegment(i + 1, j, id);\n MarkSegment(i, j - 1, id);\n MarkSegment(i, j + 1, id);\n }\n\n private static int GetCountInside(int i, int j)\n {\n int ans = sum[i + k - 1, j + k - 1];\n if (i > 0) ans -= sum[i - 1, j + k - 1];\n if (j > 0) ans -= sum[i + k - 1, j - 1];\n if (i > 0 && j > 0) ans += sum[i - 1, j - 1];\n\n return k * k - ans;\n }\n\n private static void CalculateAnswer(int i, int j)\n {\n int newAnswer = totalSegmentsSize + GetCountInside(i, j);\n answer = Math.Max(answer, newAnswer);\n }\n\n private static int ReadCh()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == 'X') return 1;\n if (ans == '.') return 0;\n }\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt() - 1;\n int b = ReadInt() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(string data)\n {\n#if !ONLINE_JUDGE\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6183fae37652c8cdccb39d0b9082078b", "src_uid": "d575f9bbdf625202807db59490c5c327", "difficulty": 2400.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(k =>\n\t\t{\n\t\t\tloop.Select(i =>\n\t\t\t{\n\t\t\t\tloop.Select(j =>\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": "81c7258ef90356190b666a43691e1021", "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 //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": "d3e4193fdc6fc25ba445e8b9380b3909", "src_uid": "bbd210065f8b32de048a2d9b1b033ed5", "difficulty": 2000.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 for (int i = 0; i < n; i++)\n {\n int cnt = 0;\n foreach (int item in edges[i])\n {\n if (type[item]==type[i])\n {\n cnt++;\n }//if\n }//foreach item\n if (cnt >= 2)\n type[i] = 1;\n }//for i\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": "dc8eeb9478b1c50bd750fdff88fedc85", "src_uid": "7017f2c81d5aed716b90e46480f96582", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round82 {\n class C {\n static void Main() {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n = xs[0],\n m = xs[1],\n c0 = xs[2],\n d0 = xs[3];\n Listzs = new List();\n for (int i = 0; i < m; i++) {\n var ys = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int d = ys[0] / ys[1];\n zs.Add(new int[] { d * ys[2], d * ys[3] });\n }\n\n for(int i = 1; i*c0 <= n; i++)\n zs.Add(new int[] { i * c0, i * d0 });\n\n zs.Sort((a, b) => -(a[1] / a[0] - b[1] / b[0]));\n int res = 0, rest = n;\n for (int i = 0; rest > 0 && i < zs.Count; i++) {\n if (rest >= zs[i][0]) {\n rest -= zs[i][0];\n res += zs[i][1];\n }\n }\n\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f64be2a9e6e5f97499e6f8cee0eab574", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.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 }\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 Main(string[] args)\n {\n //_235A();\n _106C();\n //_300C();\n reader.Close();\n writer.Close();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "286dc04f524fb0dc73f981765d676cd6", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.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\tprivate int[] a;\n\t\tprivate int[] b;\n\t\tprivate int[] c;\n\t\tprivate int[] d;\n\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int32.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar m = input[1];\n\t\t\tvar cTesto = input[2];\n\t\t\tvar dTesto = input[3];\n\t\t\ta = new int[m];\n\t\t\tb = new int[m];\n\t\t\tc = new int[m];\n\t\t\td = new int[m];\n\t\t\tfor (var i = 0; i < m; i++) {\n\t\t\t\tinput = sr.ReadArray(Int32.Parse);\n\t\t\t\ta[i] = input[0];\n\t\t\t\tb[i] = input[1];\n\t\t\t\tc[i] = input[2];\n\t\t\t\td[i] = input[3];\n\t\t\t}\n\t\t\tvar dp = new int[n + 1, m + 1];\n\t\t\tfor (var i = 0; i <= n; i++) {\n\t\t\t\tfor (var j = 1; j <= m; j++) {\n\t\t\t\t\tfor (var k = 0; k <= a[j - 1] / b[j - 1]; k++) {\n\t\t\t\t\t\tif (i - c[j - 1] * k >= 0) {\n\t\t\t\t\t\t\tdp[i, j] = Math.Max(dp[i, j], dp[i - c[j - 1] * k, j - 1] + k * d[j - 1]);\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\tvar max = 0;\n\t\t\tfor (var i = 0; i <= n; i++) {\n\t\t\t\tfor (var j = 0; j <= m; j++) {\n\t\t\t\t\tmax = Math.Max(dp[i, j] + ((n - i) / cTesto) * dTesto, max);\n\t\t\t\t}\n\t\t\t}\n\t\t\tsw.WriteLine(max);\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": "026773eb28916e609806d358d627b9f7", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round82 {\n class C {\n static void Main() {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n = xs[0],\n m = xs[1],\n c0 = xs[2],\n d0 = xs[3];\n\n int[][] ys = new int[m][];\n for (int i = 0; i < ys.Length; i++)\n ys[i] = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n int[,] dp = new int[m + 1, n + 1];\n\n for (int i = 0; i * c0 <= n; i++)\n dp[0, i * c0] = i * d0;\n\n for (int i = 0; i < m; i++) {\n int d = ys[i][0] / ys[i][1];\n for (int k = 0; k <= n; k++)\n for (int j = 0; j <= d && k + j * ys[i][2] <= n; j++)\n dp[i + 1, k + j * ys[i][2]] = Math.Max(dp[i + 1, k + j * ys[i][2]], dp[i, k] + j * ys[i][3]);\n }\n\n int res = 0;\n for (int i = 0; i <= n; i++)\n res = Math.Max(res, dp[m, i]);\n\n Console.WriteLine(res);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "a166bc8e52a4815c2ecec198fe4c0d99", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.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\n\n int sum = 0;\n for (int i = 1; i < 7; i++)\n {\n if (str[i] == '0')\n sum += 9;\n else\n sum += str[i] - '0';\n }\n if (sum + 11 > 21)\n Console.WriteLine(sum + 1);\n else\n Console.WriteLine(sum + 11);\n /*\n watch.Stop();\n var elapsedMs = watch.ElapsedMilliseconds;\n Console.WriteLine(elapsedMs);*/\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "500c5306403a9caeab0af452653e4d4a", "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 string s = ReadToken();\n int ans = 1;\n for (int i = 1; i < 7; i++)\n if (s[i] == '1')\n ans += 10;\n else\n ans += s[i] - '0';\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": "2451a2bed171b6b85af5fba2957d1bb2", "src_uid": "47287f8bc61fec72d729638d5e0e67f5", "difficulty": 1900.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 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 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": "84342837511c4beeb19631c88178fe58", "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[b] - v[a]));\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": "ad31de93a1e779c54ebada5082b14db3", "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 && (double)j * h + EPS > v[id[t]] * c)\n {\n if (j > 1)\n io.Print(\" \");\n\n t++;\n\n io.Print(id[t] + 1);\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": "d3bf19c4bdca91256c3e6c9db4e9a053", "src_uid": "6861128fcd83c752b0ea0286869901c2", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace taskC\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] g = new int[n+1, n+1];\n int number = int.Parse(Console.ReadLine());\n int[] data;\n for (int i = 0; i < number; i++)\n {\n data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n g[data[0], data[1]] = 1;\n g[data[1], data[0]] = 1;\n }\n\n number = int.Parse(Console.ReadLine());\n for (int i = 0; i < number; i++)\n {\n data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n g[data[0], data[1]] = -1;\n g[data[1], data[0]] = -1;\n }\n\n /*for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n Console.Write(\"{0}\\t\", g[i, j]);\n }\n Console.WriteLine();\n }*/\n\n HashSet already = new HashSet();\n List current;\n HashSet currentSet;\n int max = 0;\n\n for (int i = 1; i <= n; i++)\n {\n if (!already.Contains(i))\n {\n currentSet = new HashSet();\n current = new List();\n\n currentSet.Add(i);\n current.Add(i);\n already.Add(i);\n int index = 0;\n bool fall = false;\n while (index < current.Count)\n {\n\n for (int j = 1; j <= n; j++)\n {\n if ((current[index] != j) && (g[current[index], j] == 1) && !currentSet.Contains(j))\n {\n current.Add(j);\n currentSet.Add(j);\n already.Add(j);\n }\n else if ((g[current[index],j]==-1) && currentSet.Contains(j))\n {\n fall = true;\n }\n }\n if (fall) break;\n index++;\n }\n if (!fall)\n {\n max = Math.Max(max, currentSet.Count);\n } \n }\n \n }\n Console.WriteLine(max);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4ec0b95f1f3ef51297ed9df2c48a99b7", "src_uid": "e1ebaf64b129edb8089f9e2f89a0e1e1", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Party\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static int[] p;\n private static int[] size;\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n\n p = new int[n];\n\n size = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n size[i] = 1;\n }\n\n int k = Next();\n for (int i = 0; i < k; i++)\n {\n int u = Next() - 1;\n int v = Next() - 1;\n int pu = GP(u);\n int pv = GP(v);\n if (pu != pv)\n {\n p[pu] = pv;\n size[pv] += size[pu];\n }\n }\n\n var f = new bool[n];\n int m = Next();\n for (int i = 0; i < m; i++)\n {\n int u = Next() - 1;\n int v = Next() - 1;\n int pu = GP(u);\n int pv = GP(v);\n if (pu == pv)\n {\n f[pu] = true;\n }\n }\n\n int max = 0;\n for (int i = 0; i < n; i++)\n {\n if (p[i] == i && !f[i] && size[i] > max)\n max = size[i];\n }\n\n return max;\n }\n\n private static int GP(int i)\n {\n if (i == p[i])\n return i;\n return p[i] = GP(p[i]);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4ac0bb062901d2f9d5f41b7d96f11861", "src_uid": "e1ebaf64b129edb8089f9e2f89a0e1e1", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\n\n\n\n\nclass Program\n{\n\n void solve()\n {\n \n int n = nextInt();\n List[] likes = new List[n];\n List[] disLikes = new List[n];\n\n for (int i = 0; i < n; i++)\n {\n likes[i] = new List();\n disLikes[i] = new List();\n\n }\n int k = nextInt();\n for (int i = 0; i < k; i++)\n {\n int a = nextInt() - 1;\n int b = nextInt() - 1;\n likes[a].Add(b);\n likes[b].Add(a);\n }\n int m = nextInt();\n for (int i = 0; i < m; i++)\n {\n int a = nextInt() - 1;\n int b = nextInt() - 1;\n disLikes[a].Add(b);\n disLikes[b].Add(a);\n }\n bool[] vis = new bool[n];\n bool[] curVis = new bool[n];\n int res = 0;\n for (int i = 0; i < n; i++)\n if (!vis[i])\n {\n \n List lVis = new List();\n dfs(i, vis, likes, disLikes,lVis,curVis,n);\n int num = lVis.Count;\n if (num <= res)\n continue;\n foreach (int x in lVis)\n curVis[x] = true;\n bool ok = true;\n foreach (int x in lVis)\n {\n foreach (int y in disLikes[x])\n if (curVis[y])\n ok = false;\n }\n foreach (int x in lVis)\n curVis[x] = false;\n if (ok)\n res = num;\n }\n println(res);\n\n\n\n }\n\n private void dfs(int at, bool[] vis, List[] likes, List[] disLikes, List lVis, bool[] curVis, int n)\n {\n if (vis[at])\n return ;\n vis[at] = true;\n lVis.Add(at);\n foreach (int x in likes[at])\n dfs(x, vis, likes, disLikes, lVis, curVis, n);\n }\n\n \n\n private long go(int n, Dictionary cache)\n {\n if (n == 1)\n return 1;\n if (cache.ContainsKey(n))\n return cache[n];\n long res = 0;\n for (int i = 1; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n int a = i;\n int b = n / i;\n if (b > 1)\n res = Math.Max(res, go(a, cache));\n if (a > 1)\n res = Math.Max(res, go(b, cache));\n }\n }\n res += n;\n cache[n] = res;\n return res;\n }\n\n\n ////////////\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n Console.WriteLine(Doublenum);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput();\n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0c2ddb815548aaca9d400d4784568e2c", "src_uid": "e1ebaf64b129edb8089f9e2f89a0e1e1", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\n\nnamespace CodeForces {\n struct Pair : IComparable {\n public int First, Second;\n public Pair(int f, int s) {\n First = f;\n Second = s; \n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", First, Second);\n }\n\n public int CompareTo(Pair other) {\n return First.CompareTo(other.First);\n }\n }\n\n class Cf {\n static int n, m, k, t ,ans;\n static bool[] used;\n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve(); \n#if TESTS\n Console.ReadLine();\n#endif\n }\n\n static int[,] f;\n static void Solve() {\n n = ReadInt();\n used = new bool[n];\n k = ReadInt();\n f = new int[n, n]; \n for (int i = 0; i < k; ++i) {\n int[] a = ReadIntArray();\n int first = --a[0];\n int second = --a[1];\n f[first, second] = 1; \n f[second, first] = 1; \n }\n m = ReadInt(); \n for (int i = 0; i < m; ++i) {\n int[] a = ReadIntArray();\n int first = --a[0];\n int second = --a[1];\n f[first, second] = -1; \n f[second, first] = -1; \n }\n for (int i = 0; i < n; ++i) {\n int cnt = 1;\n List members = new List();\n members.Add(i);\n for (int j = 0; j < n; ++j) { \n if(i==j) continue;\n if (f[i, j] == 1 & !members.Contains(j)) {\n members.Add(j);\n ++cnt;\n for (int z = 0; z < n; ++z) {\n if (f[j, z] == -1 && members.Contains(z)) {\n members.Clear();\n break;\n }\n }\n if (members.Count == 0) {\n cnt = 0;\n break;\n } \n } \n if (members.Count == 0) {\n cnt = 0;\n break;\n } \n }\n ans = Math.Max(ans, cnt);\n }\n Console.WriteLine(ans); \n }\n \n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n }\n\n class Heap : IEnumerable where T : IComparable {\n private List heap = new List();\n private int heapSize;\n private int Parent(int index) {\n return (index - 1) >> 1;\n }\n public int Count {\n get { return heap.Count; }\n }\n private int Left(int index) {\n return (index << 1) | 1;\n }\n private int Right(int index) {\n return (index << 1) + 2;\n }\n private void Max_Heapify(int i) {\n int l = Left(i);\n int r = Right(i);\n int largest = i;\n if (l < heapSize && heap[l].CompareTo(heap[i]) > 0)\n largest = l;\n if (r < heapSize && heap[r].CompareTo(heap[largest]) > 0)\n largest = r;\n if (largest != i) {\n T temp = heap[largest];\n heap[largest] = heap[i];\n heap[i] = temp;\n Max_Heapify(largest);\n }\n }\n private void BuildMaxHeap() {\n for (int i = heap.Count >> 1; i >= 0; --i)\n Max_Heapify(i);\n }\n\n public IEnumerator GetEnumerator() {\n return heap.GetEnumerator();\n }\n\n public void Sort() {\n for (int i = heap.Count - 1; i > 0; --i) {\n T temp = heap[i];\n heap[i] = heap[0];\n heap[0] = temp;\n --heapSize;\n Max_Heapify(0);\n }\n }\n\n public T Heap_Extract_Max() {\n T max = heap[0];\n heap[0] = heap[--heapSize];\n Max_Heapify(0);\n return max;\n }\n\n public void Clear() {\n heap.Clear();\n heapSize = 0;\n }\n\n public void Insert(T item) {\n if (heapSize < heap.Count)\n heap[heapSize] = item;\n else\n heap.Add(item);\n int i = heapSize;\n while (i > 0 && heap[Parent(i)].CompareTo(heap[i]) < 0) {\n T temp = heap[i];\n heap[i] = heap[Parent(i)];\n heap[Parent(i)] = temp;\n i = Parent(i);\n }\n ++heapSize;\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n return ((IEnumerable)heap).GetEnumerator();\n }\n } \n public class Treap {\n private static Random rand = new Random();\n public static Treap Merge(Treap l, Treap r) {\n if (l == null) return r;\n if (r == null) return l;\n Treap res;\n if (l.y > r.y) {\n Treap newR = Merge(l.right, r);\n res = new Treap(l.x, l.y, l.left, newR);\n }\n else {\n Treap newL = Merge(l, r.left);\n res = new Treap(r.x, r.y, newL, r.right);\n } \n return res;\n }\n\n public void Split(int x, out Treap l, out Treap r) {\n Treap newTree = null;\n if (this.x <= x) {\n if (right == null)\n r = null;\n else\n right.Split(x, out newTree, out r);\n l = new Treap(this.x, y, left, newTree); \n }\n else {\n if (left == null)\n l = null;\n else\n left.Split(x, out l, out newTree);\n r = new Treap(this.x, y, newTree, right); \n }\n }\n\n public Treap Add(int x) {\n Treap l, r;\n Split(x, out l, out r);\n Treap m = new Treap(x, rand.Next());\n return Merge(Merge(l, m), r);\n }\n\n public Treap Remove(int x) {\n Treap l, m, r;\n Split(x - 1, out l, out r);\n r.Split(x, out m, out r);\n return Merge(l, r);\n }\n\n private int x, y, cost, maxTreeCost;\n private Treap left, right;\n public Treap(int x, int y, Treap l, Treap r) {\n this.x = x;\n this.y = y;\n left = l;\n right = r;\n }\n public Treap(int x, int y) : this(x, y, null, null) { }\n public void InOrder() {\n inOrder(this);\n }\n private void inOrder(Treap t) {\n if (t == null) return;\n inOrder(t.left);\n Console.WriteLine(t.x);\n inOrder(t.right);\n }\n }\n\n public static class Extensions {\n public static string Fill(this char c, int count) {\n char[] r = new char[count];\n for (int i = 0; i < count; ++i)\n r[i] = c;\n return new string(r);\n }\n\n public static int MaxIntIndex(this int[] array) {\n int max = array[0];\n int index = 0;\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] > max) {\n max = array[i];\n index = i;\n } \n }\n return index;\n }\n \n public static void PrintToConsole(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b5d096ed8a544799b7e6c24d88841be3", "src_uid": "e1ebaf64b129edb8089f9e2f89a0e1e1", "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.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\n var queue = new Queue();\n queue.Enqueue(0);\n long inc = a * ((b + a - 1) / a);\n while (queue.Count > 0)\n {\n long cur = queue.Dequeue();\n long d = cur + inc;\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 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, i, a) - Calc(f[i] - 1, 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": "732608415e8df8af7daeb09fa0411d54", "src_uid": "d6290b69eddfcf5f131cc9e612ccab76", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\n\nnamespace HeidiLearnsHashingEasy\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input;\n long r;\n long x, y;\n\n while (true)\n {\n input = Console.ReadLine();\n\n if (string.IsNullOrEmpty(input)) break;\n\n r = long.Parse(input);\n\n if (r % 2 == 0)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n x = 1;\n y = (r - 3) / 2;\n\n if (y <= 0)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"{0} {1}\", x, y);\n }\n }\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9418d48ec193783f8b940c7d8409bb9f", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\n\nnamespace _262\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n\n solve_helvetic2019A1_improved();\n //solve_262A();\n }\n\n /*\n In the tutorial it is mentioned that \n we are solving linear equation with one variable.\n\n Although it looks like a quadratic equation at first sight\n in reality it is a hidden linear equation. \n we just need to carefully analyse it and figure out\n that we don't always have equations in a clean canonical ways.\n like ax + b = 0. \n\n in the given equation:\n r = x^2 + 2xy + x + 1\n we could ajust it like that:\n r - x^2 - x - 1 = 2xy\n\n And this part brings confusion. Because the right part 2xy\n is not just y but also multiplied by 2x.\n TODO: Make description cleaner \n \n */\n public static void solve_helvetic2019A1_improved()\n {\n long r = Convert.ToInt64(Console.ReadLine());\n\n for (int x = 1; x < Math.Sqrt(r); x++)\n {\n long y = r - x * x - x - 1;\n\n if (y > 0 && y % 2 * x == 0)\n {\n Console.WriteLine(\"{0} {1}\", x, y / 2 * x);\n \n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n\n\n /*\n \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435, \u044f \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0442\u0443\u043f\u043e \u0434\u0432\u043e\u0439\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u043d\u0430\u0439\u0442\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\n x \u0438 y. \u041d\u043e \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443\u0447\u0435\u0441\u0442\u044c \u0447\u0442\u043e \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 sqrt(r) \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439\n \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f x, \u0442\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u0434\u0430\u0447\u0438\n \u043d\u0430\u0439\u0442\u0438 y.\n */\n public static void solve_helvetic2019A1()\n {\n long r = Convert.ToInt64(Console.ReadLine());\n\n bool found = false;\n long x = 0;\n long y = 0;\n long xLen = (int)Math.Sqrt(r);\n for (x = 1; x < xLen; x++)\n {\n long yLen = r <= 100000 ? r : r / (2 * xLen);\n for (y = 2 * x + 1; y < yLen; y++)\n {\n long h = x * x + 2 * x * y + x + 1;\n if (h > r)\n {\n break;\n }\n \n if (r == h)\n {\n found = true;\n break;\n }\n }\n\n if (found)\n {\n break;\n }\n }\n\n if (found)\n {\n Console.Write(\"{0} {1}\", x, y);\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n\n public static void solve_262A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int bought = n;\n int max = n;\n while (bought > 0)\n {\n bought = max % m == 0 ? (bought + m - 1) / m : bought / m;\n max += bought;\n }\n Console.WriteLine(max);\n }\n\n /* \n1)4\n2)1 + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1)\n4)1\n\n1 1 \n\t \n2 3 \n \n3 7 \n \n4 14 \n\t\n5 25\n\n1)5\n2)1 + (1 + 1) + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1) + (1 + 1 + 1)\n4)1 + (1 + 1 + 1 + 1)\n5)1\n\n(0) + 1 => (1) + 2 => (1 + 3) + 3 => (3 + 7) + 4 => (7 + 14) + 5\n */\n public static void solve_164B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int total = 0;\n int prev = 0;\n int prevPrev = 0;\n for (int i = 1; i <= n; i++)\n {\n total = prevPrev + prev + i;\n\n prevPrev = prev;\n prev = total;\n }\n\n Console.WriteLine(total);\n }\n\n\n /*\n \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 q \u0438 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u043f\u0440\u0430\u0432\u043e.\n \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0434\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u0441\u043c\u0435\u0441\u0442\u0438\u0432 \u0431\u0443\u043a\u0432\u0443 \u0432\u043b\u0435\u0432\u043e, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.\n \u041f\u043e\u0442\u043e\u043c\u0443\u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 keyboard q \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \u0418 \u043b\u0435\u0432\u0435\u0435 \u043d\u0435\u0435 \u0443 \u043d\u0430\u0441 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442.\n \u041d\u041e! \u041f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0443 \u043d\u0430\u0441 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u0441\u0430\u043c\u0443\u044e \u043b\u0435\u0432\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443, \u0442\u043e\n \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0432 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u0430\u0432\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u0426\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u043e\u0441\u0442\u044c.\n \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u0435\u0439\u0441 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f.\n\n \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 IndexOf \u0438 \u0437\u0430\u043f\u0438\u0445\u0430\u0442\u044c\n \u0432\u0441\u0435 \u0431\u0443\u043a\u0432\u044b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. \u0413\u0434\u0435 \u0431\u0443\u043a\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0430 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435.\n */\n public static void solve_271A()\n {\n string direction = Console.ReadLine();\n string text = Console.ReadLine();\n\n string keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\n string answer = String.Empty;\n if (direction == \"R\")\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) - 1];\n }\n }\n else\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) + 1];\n }\n }\n\n Console.WriteLine(answer);\n }\n\n /*\n \u0414\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u043a\u0440\u0438 \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\n String.Contains.\n \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dictionary \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430 \u0445\u043e\u0442\u044f \u0431\u044b\n log(n)\n */\n public static void solve_368A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int count = 0;\n string noir = \"WBG\";\n for (int i = 0; i < n; i++)\n {\n string[] row = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < m; j++)\n {\n if (noir.Contains(row[j]))\n {\n count++;\n }\n }\n }\n\n string answer = (count == n * m) ? \"#Black&White\" : \"#Color\";\n\n Console.WriteLine(answer); \n }\n\n public static void solve_90A()\n {\n string[] abn = Console.ReadLine().Split(' ');\n\n int a = Convert.ToInt32(abn[0]);\n int b = Convert.ToInt32(abn[1]);\n int n = Convert.ToInt32(abn[2]);\n \n int count = 1;\n while (n > 0)\n {\n if (count % 2 == 0)\n {\n n -= gcd(n, b);\n }\n else \n {\n n -= gcd(n, a);\n }\n \n count++;\n }\n\n int answer = (--count % 2 == 0) ? 1 : 0;\n\n Console.WriteLine(answer);\n }\n\n public static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n\n return gcd(b, a % b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "febae9b3eaeaa9d1f61d1dd213c99dd9", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\n\nnamespace _262\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n\n solve_helvetic2019A1();\n //solve_262A();\n }\n\n\n public static void solve_helvetic2019A1()\n {\n long r = Convert.ToInt64(Console.ReadLine());\n\n bool found = false;\n long x = 0;\n long y = 0;\n long xLen = (int)Math.Sqrt(r);\n for (x = 1; x < xLen; x++)\n {\n long yLen = r <= 100000 ? r : r / (1750 * xLen);\n for (y = 1; y < yLen; y++)\n {\n long h = x * x + 2 * x * y + x + 1;\n if (h > r)\n {\n break;\n }\n \n if (r == h)\n {\n found = true;\n break;\n }\n }\n\n if (found)\n {\n break;\n }\n }\n\n if (found)\n {\n Console.Write(\"{0} {1}\", x, y);\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n\n public static void solve_262A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int bought = n;\n int max = n;\n while (bought > 0)\n {\n bought = max % m == 0 ? (bought + m - 1) / m : bought / m;\n max += bought;\n }\n Console.WriteLine(max);\n }\n\n /* \n1)4\n2)1 + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1)\n4)1\n\n1 1 \n\t \n2 3 \n \n3 7 \n \n4 14 \n\t\n5 25\n\n1)5\n2)1 + (1 + 1) + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1) + (1 + 1 + 1)\n4)1 + (1 + 1 + 1 + 1)\n5)1\n\n(0) + 1 => (1) + 2 => (1 + 3) + 3 => (3 + 7) + 4 => (7 + 14) + 5\n */\n public static void solve_164B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int total = 0;\n int prev = 0;\n int prevPrev = 0;\n for (int i = 1; i <= n; i++)\n {\n total = prevPrev + prev + i;\n\n prevPrev = prev;\n prev = total;\n }\n\n Console.WriteLine(total);\n }\n\n\n /*\n \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 q \u0438 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u043f\u0440\u0430\u0432\u043e.\n \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0434\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u0441\u043c\u0435\u0441\u0442\u0438\u0432 \u0431\u0443\u043a\u0432\u0443 \u0432\u043b\u0435\u0432\u043e, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.\n \u041f\u043e\u0442\u043e\u043c\u0443\u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 keyboard q \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \u0418 \u043b\u0435\u0432\u0435\u0435 \u043d\u0435\u0435 \u0443 \u043d\u0430\u0441 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442.\n \u041d\u041e! \u041f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0443 \u043d\u0430\u0441 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u0441\u0430\u043c\u0443\u044e \u043b\u0435\u0432\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443, \u0442\u043e\n \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0432 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u0430\u0432\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u0426\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u043e\u0441\u0442\u044c.\n \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u0435\u0439\u0441 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f.\n\n \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 IndexOf \u0438 \u0437\u0430\u043f\u0438\u0445\u0430\u0442\u044c\n \u0432\u0441\u0435 \u0431\u0443\u043a\u0432\u044b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. \u0413\u0434\u0435 \u0431\u0443\u043a\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0430 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435.\n */\n public static void solve_271A()\n {\n string direction = Console.ReadLine();\n string text = Console.ReadLine();\n\n string keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\n string answer = String.Empty;\n if (direction == \"R\")\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) - 1];\n }\n }\n else\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) + 1];\n }\n }\n\n Console.WriteLine(answer);\n }\n\n /*\n \u0414\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u043a\u0440\u0438 \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\n String.Contains.\n \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dictionary \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430 \u0445\u043e\u0442\u044f \u0431\u044b\n log(n)\n */\n public static void solve_368A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int count = 0;\n string noir = \"WBG\";\n for (int i = 0; i < n; i++)\n {\n string[] row = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < m; j++)\n {\n if (noir.Contains(row[j]))\n {\n count++;\n }\n }\n }\n\n string answer = (count == n * m) ? \"#Black&White\" : \"#Color\";\n\n Console.WriteLine(answer); \n }\n\n public static void solve_90A()\n {\n string[] abn = Console.ReadLine().Split(' ');\n\n int a = Convert.ToInt32(abn[0]);\n int b = Convert.ToInt32(abn[1]);\n int n = Convert.ToInt32(abn[2]);\n \n int count = 1;\n while (n > 0)\n {\n if (count % 2 == 0)\n {\n n -= gcd(n, b);\n }\n else \n {\n n -= gcd(n, a);\n }\n \n count++;\n }\n\n int answer = (--count % 2 == 0) ? 1 : 0;\n\n Console.WriteLine(answer);\n }\n\n public static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n\n return gcd(b, a % b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d72fa9b0cc8101d3a9aecc129c5f8f9e", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\n\nnamespace _262\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n\n solve_helvetic2019A1();\n //solve_262A();\n }\n\n\n public static void solve_helvetic2019A1()\n {\n long r = Convert.ToInt64(Console.ReadLine());\n\n bool found = false;\n long x = 0;\n long y = 0;\n long xLen = (int)Math.Sqrt(r);\n for (x = 1; x < xLen; x++)\n {\n long yLen = r <= 100000 ? r : r / (1680 * xLen);\n for (y = 1; y < yLen; y++)\n {\n long h = x * x + 2 * x * y + x + 1;\n if (h > r)\n {\n break;\n }\n \n if (r == h)\n {\n found = true;\n break;\n }\n }\n\n if (found)\n {\n break;\n }\n }\n\n if (found)\n {\n Console.Write(\"{0} {1}\", x, y);\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n\n public static void solve_262A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int bought = n;\n int max = n;\n while (bought > 0)\n {\n bought = max % m == 0 ? (bought + m - 1) / m : bought / m;\n max += bought;\n }\n Console.WriteLine(max);\n }\n\n /* \n1)4\n2)1 + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1)\n4)1\n\n1 1 \n\t \n2 3 \n \n3 7 \n \n4 14 \n\t\n5 25\n\n1)5\n2)1 + (1 + 1) + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1) + (1 + 1 + 1)\n4)1 + (1 + 1 + 1 + 1)\n5)1\n\n(0) + 1 => (1) + 2 => (1 + 3) + 3 => (3 + 7) + 4 => (7 + 14) + 5\n */\n public static void solve_164B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int total = 0;\n int prev = 0;\n int prevPrev = 0;\n for (int i = 1; i <= n; i++)\n {\n total = prevPrev + prev + i;\n\n prevPrev = prev;\n prev = total;\n }\n\n Console.WriteLine(total);\n }\n\n\n /*\n \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 q \u0438 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u043f\u0440\u0430\u0432\u043e.\n \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0434\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u0441\u043c\u0435\u0441\u0442\u0438\u0432 \u0431\u0443\u043a\u0432\u0443 \u0432\u043b\u0435\u0432\u043e, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.\n \u041f\u043e\u0442\u043e\u043c\u0443\u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 keyboard q \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \u0418 \u043b\u0435\u0432\u0435\u0435 \u043d\u0435\u0435 \u0443 \u043d\u0430\u0441 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442.\n \u041d\u041e! \u041f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0443 \u043d\u0430\u0441 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u0441\u0430\u043c\u0443\u044e \u043b\u0435\u0432\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443, \u0442\u043e\n \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0432 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u0430\u0432\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u0426\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u043e\u0441\u0442\u044c.\n \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u0435\u0439\u0441 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f.\n\n \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 IndexOf \u0438 \u0437\u0430\u043f\u0438\u0445\u0430\u0442\u044c\n \u0432\u0441\u0435 \u0431\u0443\u043a\u0432\u044b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. \u0413\u0434\u0435 \u0431\u0443\u043a\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0430 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435.\n */\n public static void solve_271A()\n {\n string direction = Console.ReadLine();\n string text = Console.ReadLine();\n\n string keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\n string answer = String.Empty;\n if (direction == \"R\")\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) - 1];\n }\n }\n else\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) + 1];\n }\n }\n\n Console.WriteLine(answer);\n }\n\n /*\n \u0414\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u043a\u0440\u0438 \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\n String.Contains.\n \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dictionary \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430 \u0445\u043e\u0442\u044f \u0431\u044b\n log(n)\n */\n public static void solve_368A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int count = 0;\n string noir = \"WBG\";\n for (int i = 0; i < n; i++)\n {\n string[] row = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < m; j++)\n {\n if (noir.Contains(row[j]))\n {\n count++;\n }\n }\n }\n\n string answer = (count == n * m) ? \"#Black&White\" : \"#Color\";\n\n Console.WriteLine(answer); \n }\n\n public static void solve_90A()\n {\n string[] abn = Console.ReadLine().Split(' ');\n\n int a = Convert.ToInt32(abn[0]);\n int b = Convert.ToInt32(abn[1]);\n int n = Convert.ToInt32(abn[2]);\n \n int count = 1;\n while (n > 0)\n {\n if (count % 2 == 0)\n {\n n -= gcd(n, b);\n }\n else \n {\n n -= gcd(n, a);\n }\n \n count++;\n }\n\n int answer = (--count % 2 == 0) ? 1 : 0;\n\n Console.WriteLine(answer);\n }\n\n public static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n\n return gcd(b, a % b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e507482e2438a1a202a5c070c88c5a82", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\n\nnamespace _262\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n\n solve_helvetic2019A1();\n //solve_262A();\n }\n\n\n public static void solve_helvetic2019A1()\n {\n long r = Convert.ToInt64(Console.ReadLine());\n\n bool found = false;\n long x = 0;\n long y = 0;\n long xLen = (int)Math.Sqrt(r);\n for (x = 1; x < xLen; x++)\n {\n long yLen = r <= 100000 ? r : r / (3000 * xLen);\n for (y = 1; y < yLen; y++)\n {\n long h = x * x + 2 * x * y + x + 1;\n if (h > r)\n {\n break;\n }\n \n if (r == h)\n {\n found = true;\n break;\n }\n }\n\n if (found)\n {\n break;\n }\n }\n\n if (found)\n {\n Console.Write(\"{0} {1}\", x, y);\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n\n public static void solve_262A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int bought = n;\n int max = n;\n while (bought > 0)\n {\n bought = max % m == 0 ? (bought + m - 1) / m : bought / m;\n max += bought;\n }\n Console.WriteLine(max);\n }\n\n /* \n1)4\n2)1 + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1)\n4)1\n\n1 1 \n\t \n2 3 \n \n3 7 \n \n4 14 \n\t\n5 25\n\n1)5\n2)1 + (1 + 1) + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1) + (1 + 1 + 1)\n4)1 + (1 + 1 + 1 + 1)\n5)1\n\n(0) + 1 => (1) + 2 => (1 + 3) + 3 => (3 + 7) + 4 => (7 + 14) + 5\n */\n public static void solve_164B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int total = 0;\n int prev = 0;\n int prevPrev = 0;\n for (int i = 1; i <= n; i++)\n {\n total = prevPrev + prev + i;\n\n prevPrev = prev;\n prev = total;\n }\n\n Console.WriteLine(total);\n }\n\n\n /*\n \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 q \u0438 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u043f\u0440\u0430\u0432\u043e.\n \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0434\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u0441\u043c\u0435\u0441\u0442\u0438\u0432 \u0431\u0443\u043a\u0432\u0443 \u0432\u043b\u0435\u0432\u043e, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.\n \u041f\u043e\u0442\u043e\u043c\u0443\u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 keyboard q \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \u0418 \u043b\u0435\u0432\u0435\u0435 \u043d\u0435\u0435 \u0443 \u043d\u0430\u0441 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442.\n \u041d\u041e! \u041f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0443 \u043d\u0430\u0441 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u0441\u0430\u043c\u0443\u044e \u043b\u0435\u0432\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443, \u0442\u043e\n \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0432 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u0430\u0432\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u0426\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u043e\u0441\u0442\u044c.\n \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u0435\u0439\u0441 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f.\n\n \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 IndexOf \u0438 \u0437\u0430\u043f\u0438\u0445\u0430\u0442\u044c\n \u0432\u0441\u0435 \u0431\u0443\u043a\u0432\u044b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. \u0413\u0434\u0435 \u0431\u0443\u043a\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0430 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435.\n */\n public static void solve_271A()\n {\n string direction = Console.ReadLine();\n string text = Console.ReadLine();\n\n string keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\n string answer = String.Empty;\n if (direction == \"R\")\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) - 1];\n }\n }\n else\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) + 1];\n }\n }\n\n Console.WriteLine(answer);\n }\n\n /*\n \u0414\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u043a\u0440\u0438 \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\n String.Contains.\n \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dictionary \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430 \u0445\u043e\u0442\u044f \u0431\u044b\n log(n)\n */\n public static void solve_368A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int count = 0;\n string noir = \"WBG\";\n for (int i = 0; i < n; i++)\n {\n string[] row = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < m; j++)\n {\n if (noir.Contains(row[j]))\n {\n count++;\n }\n }\n }\n\n string answer = (count == n * m) ? \"#Black&White\" : \"#Color\";\n\n Console.WriteLine(answer); \n }\n\n public static void solve_90A()\n {\n string[] abn = Console.ReadLine().Split(' ');\n\n int a = Convert.ToInt32(abn[0]);\n int b = Convert.ToInt32(abn[1]);\n int n = Convert.ToInt32(abn[2]);\n \n int count = 1;\n while (n > 0)\n {\n if (count % 2 == 0)\n {\n n -= gcd(n, b);\n }\n else \n {\n n -= gcd(n, a);\n }\n \n count++;\n }\n\n int answer = (--count % 2 == 0) ? 1 : 0;\n\n Console.WriteLine(answer);\n }\n\n public static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n\n return gcd(b, a % b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2cb9cc91f134db3f829cccf211e6ca9e", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\n\nnamespace _262\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n\n solve_helvetic2019A1();\n //solve_262A();\n }\n\n\n public static void solve_helvetic2019A1()\n {\n long r = Convert.ToInt64(Console.ReadLine());\n\n bool found = false;\n long x = 0;\n long y = 0;\n long xLen = (int)Math.Sqrt(r);\n for (x = 1; x < xLen; x++)\n {\n long len = r <= 100000 ? r : r / (2 * y * xLen);\n for (y = 1; y < (r / 2) + 1; y++)\n {\n long h = x * x + 2 * x * y + x + 1;\n if (h > r)\n {\n break;\n }\n \n if (r == h)\n {\n found = true;\n break;\n }\n }\n\n if (found)\n {\n break;\n }\n }\n\n if (found)\n {\n Console.Write(\"{0} {1}\", x, y);\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n\n public static void solve_262A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int bought = n;\n int max = n;\n while (bought > 0)\n {\n bought = max % m == 0 ? (bought + m - 1) / m : bought / m;\n max += bought;\n }\n Console.WriteLine(max);\n }\n\n /* \n1)4\n2)1 + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1)\n4)1\n\n1 1 \n\t \n2 3 \n \n3 7 \n \n4 14 \n\t\n5 25\n\n1)5\n2)1 + (1 + 1) + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1) + (1 + 1 + 1)\n4)1 + (1 + 1 + 1 + 1)\n5)1\n\n(0) + 1 => (1) + 2 => (1 + 3) + 3 => (3 + 7) + 4 => (7 + 14) + 5\n */\n public static void solve_164B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int total = 0;\n int prev = 0;\n int prevPrev = 0;\n for (int i = 1; i <= n; i++)\n {\n total = prevPrev + prev + i;\n\n prevPrev = prev;\n prev = total;\n }\n\n Console.WriteLine(total);\n }\n\n\n /*\n \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 q \u0438 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u043f\u0440\u0430\u0432\u043e.\n \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0434\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u0441\u043c\u0435\u0441\u0442\u0438\u0432 \u0431\u0443\u043a\u0432\u0443 \u0432\u043b\u0435\u0432\u043e, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.\n \u041f\u043e\u0442\u043e\u043c\u0443\u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 keyboard q \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \u0418 \u043b\u0435\u0432\u0435\u0435 \u043d\u0435\u0435 \u0443 \u043d\u0430\u0441 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442.\n \u041d\u041e! \u041f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0443 \u043d\u0430\u0441 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u0441\u0430\u043c\u0443\u044e \u043b\u0435\u0432\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443, \u0442\u043e\n \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0432 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u0430\u0432\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u0426\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u043e\u0441\u0442\u044c.\n \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u0435\u0439\u0441 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f.\n\n \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 IndexOf \u0438 \u0437\u0430\u043f\u0438\u0445\u0430\u0442\u044c\n \u0432\u0441\u0435 \u0431\u0443\u043a\u0432\u044b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. \u0413\u0434\u0435 \u0431\u0443\u043a\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0430 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435.\n */\n public static void solve_271A()\n {\n string direction = Console.ReadLine();\n string text = Console.ReadLine();\n\n string keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\n string answer = String.Empty;\n if (direction == \"R\")\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) - 1];\n }\n }\n else\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) + 1];\n }\n }\n\n Console.WriteLine(answer);\n }\n\n /*\n \u0414\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u043a\u0440\u0438 \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\n String.Contains.\n \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dictionary \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430 \u0445\u043e\u0442\u044f \u0431\u044b\n log(n)\n */\n public static void solve_368A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int count = 0;\n string noir = \"WBG\";\n for (int i = 0; i < n; i++)\n {\n string[] row = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < m; j++)\n {\n if (noir.Contains(row[j]))\n {\n count++;\n }\n }\n }\n\n string answer = (count == n * m) ? \"#Black&White\" : \"#Color\";\n\n Console.WriteLine(answer); \n }\n\n public static void solve_90A()\n {\n string[] abn = Console.ReadLine().Split(' ');\n\n int a = Convert.ToInt32(abn[0]);\n int b = Convert.ToInt32(abn[1]);\n int n = Convert.ToInt32(abn[2]);\n \n int count = 1;\n while (n > 0)\n {\n if (count % 2 == 0)\n {\n n -= gcd(n, b);\n }\n else \n {\n n -= gcd(n, a);\n }\n \n count++;\n }\n\n int answer = (--count % 2 == 0) ? 1 : 0;\n\n Console.WriteLine(answer);\n }\n\n public static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n\n return gcd(b, a % b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "601a10b099d6ab83180fd2253dbe1a8b", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\n\nnamespace _262\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n\n solve_helvetic2019A1();\n //solve_262A();\n }\n\n\n public static void solve_helvetic2019A1()\n {\n long r = Convert.ToInt64(Console.ReadLine());\n\n bool found = false;\n long x = 0;\n long y = 0;\n long xLen = (int)Math.Sqrt(r);\n for (x = 1; x < xLen; x++)\n {\n long yLen = r <= 100000 ? r : r / (10 * xLen);\n for (y = 1; y < yLen; y++)\n {\n long h = x * x + 2 * x * y + x + 1;\n if (h > r)\n {\n break;\n }\n \n if (r == h)\n {\n found = true;\n break;\n }\n }\n\n if (found)\n {\n break;\n }\n }\n\n if (found)\n {\n Console.Write(\"{0} {1}\", x, y);\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n\n public static void solve_262A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int bought = n;\n int max = n;\n while (bought > 0)\n {\n bought = max % m == 0 ? (bought + m - 1) / m : bought / m;\n max += bought;\n }\n Console.WriteLine(max);\n }\n\n /* \n1)4\n2)1 + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1)\n4)1\n\n1 1 \n\t \n2 3 \n \n3 7 \n \n4 14 \n\t\n5 25\n\n1)5\n2)1 + (1 + 1) + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1) + (1 + 1 + 1)\n4)1 + (1 + 1 + 1 + 1)\n5)1\n\n(0) + 1 => (1) + 2 => (1 + 3) + 3 => (3 + 7) + 4 => (7 + 14) + 5\n */\n public static void solve_164B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int total = 0;\n int prev = 0;\n int prevPrev = 0;\n for (int i = 1; i <= n; i++)\n {\n total = prevPrev + prev + i;\n\n prevPrev = prev;\n prev = total;\n }\n\n Console.WriteLine(total);\n }\n\n\n /*\n \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 q \u0438 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u043f\u0440\u0430\u0432\u043e.\n \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0434\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u0441\u043c\u0435\u0441\u0442\u0438\u0432 \u0431\u0443\u043a\u0432\u0443 \u0432\u043b\u0435\u0432\u043e, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.\n \u041f\u043e\u0442\u043e\u043c\u0443\u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 keyboard q \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \u0418 \u043b\u0435\u0432\u0435\u0435 \u043d\u0435\u0435 \u0443 \u043d\u0430\u0441 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442.\n \u041d\u041e! \u041f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0443 \u043d\u0430\u0441 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u0441\u0430\u043c\u0443\u044e \u043b\u0435\u0432\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443, \u0442\u043e\n \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0432 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u0430\u0432\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u0426\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u043e\u0441\u0442\u044c.\n \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u0435\u0439\u0441 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f.\n\n \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 IndexOf \u0438 \u0437\u0430\u043f\u0438\u0445\u0430\u0442\u044c\n \u0432\u0441\u0435 \u0431\u0443\u043a\u0432\u044b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. \u0413\u0434\u0435 \u0431\u0443\u043a\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0430 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435.\n */\n public static void solve_271A()\n {\n string direction = Console.ReadLine();\n string text = Console.ReadLine();\n\n string keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\n string answer = String.Empty;\n if (direction == \"R\")\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) - 1];\n }\n }\n else\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) + 1];\n }\n }\n\n Console.WriteLine(answer);\n }\n\n /*\n \u0414\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u043a\u0440\u0438 \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\n String.Contains.\n \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dictionary \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430 \u0445\u043e\u0442\u044f \u0431\u044b\n log(n)\n */\n public static void solve_368A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int count = 0;\n string noir = \"WBG\";\n for (int i = 0; i < n; i++)\n {\n string[] row = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < m; j++)\n {\n if (noir.Contains(row[j]))\n {\n count++;\n }\n }\n }\n\n string answer = (count == n * m) ? \"#Black&White\" : \"#Color\";\n\n Console.WriteLine(answer); \n }\n\n public static void solve_90A()\n {\n string[] abn = Console.ReadLine().Split(' ');\n\n int a = Convert.ToInt32(abn[0]);\n int b = Convert.ToInt32(abn[1]);\n int n = Convert.ToInt32(abn[2]);\n \n int count = 1;\n while (n > 0)\n {\n if (count % 2 == 0)\n {\n n -= gcd(n, b);\n }\n else \n {\n n -= gcd(n, a);\n }\n \n count++;\n }\n\n int answer = (--count % 2 == 0) ? 1 : 0;\n\n Console.WriteLine(answer);\n }\n\n public static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n\n return gcd(b, a % b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8d44d6a7c2b83c77610de186bf9a3867", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\n\nnamespace _262\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n\n solve_helvetic2019A1();\n //solve_262A();\n }\n\n\n public static void solve_helvetic2019A1()\n {\n long r = Convert.ToInt64(Console.ReadLine());\n\n bool found = false;\n long x = 0;\n long y = 0;\n long xLen = (int)Math.Sqrt(r);\n for (x = 1; x < xLen; x++)\n {\n long yLen = r <= 100000 ? r : (r / (2 * x) - xLen / 2);\n for (y = 1; y < yLen; y++)\n {\n long h = x * x + 2 * x * y + x + 1;\n if (h > r)\n {\n break;\n }\n \n if (r == h)\n {\n found = true;\n break;\n }\n }\n\n if (found)\n {\n break;\n }\n }\n\n if (found)\n {\n Console.Write(\"{0} {1}\", x, y);\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n\n public static void solve_262A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int bought = n;\n int max = n;\n while (bought > 0)\n {\n bought = max % m == 0 ? (bought + m - 1) / m : bought / m;\n max += bought;\n }\n Console.WriteLine(max);\n }\n\n /* \n1)4\n2)1 + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1)\n4)1\n\n1 1 \n\t \n2 3 \n \n3 7 \n \n4 14 \n\t\n5 25\n\n1)5\n2)1 + (1 + 1) + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1) + (1 + 1 + 1)\n4)1 + (1 + 1 + 1 + 1)\n5)1\n\n(0) + 1 => (1) + 2 => (1 + 3) + 3 => (3 + 7) + 4 => (7 + 14) + 5\n */\n public static void solve_164B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int total = 0;\n int prev = 0;\n int prevPrev = 0;\n for (int i = 1; i <= n; i++)\n {\n total = prevPrev + prev + i;\n\n prevPrev = prev;\n prev = total;\n }\n\n Console.WriteLine(total);\n }\n\n\n /*\n \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 q \u0438 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u043f\u0440\u0430\u0432\u043e.\n \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0434\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u0441\u043c\u0435\u0441\u0442\u0438\u0432 \u0431\u0443\u043a\u0432\u0443 \u0432\u043b\u0435\u0432\u043e, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.\n \u041f\u043e\u0442\u043e\u043c\u0443\u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 keyboard q \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \u0418 \u043b\u0435\u0432\u0435\u0435 \u043d\u0435\u0435 \u0443 \u043d\u0430\u0441 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442.\n \u041d\u041e! \u041f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0443 \u043d\u0430\u0441 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u0441\u0430\u043c\u0443\u044e \u043b\u0435\u0432\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443, \u0442\u043e\n \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0432 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u0430\u0432\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u0426\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u043e\u0441\u0442\u044c.\n \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u0435\u0439\u0441 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f.\n\n \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 IndexOf \u0438 \u0437\u0430\u043f\u0438\u0445\u0430\u0442\u044c\n \u0432\u0441\u0435 \u0431\u0443\u043a\u0432\u044b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. \u0413\u0434\u0435 \u0431\u0443\u043a\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0430 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435.\n */\n public static void solve_271A()\n {\n string direction = Console.ReadLine();\n string text = Console.ReadLine();\n\n string keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\n string answer = String.Empty;\n if (direction == \"R\")\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) - 1];\n }\n }\n else\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) + 1];\n }\n }\n\n Console.WriteLine(answer);\n }\n\n /*\n \u0414\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u043a\u0440\u0438 \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\n String.Contains.\n \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dictionary \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430 \u0445\u043e\u0442\u044f \u0431\u044b\n log(n)\n */\n public static void solve_368A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int count = 0;\n string noir = \"WBG\";\n for (int i = 0; i < n; i++)\n {\n string[] row = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < m; j++)\n {\n if (noir.Contains(row[j]))\n {\n count++;\n }\n }\n }\n\n string answer = (count == n * m) ? \"#Black&White\" : \"#Color\";\n\n Console.WriteLine(answer); \n }\n\n public static void solve_90A()\n {\n string[] abn = Console.ReadLine().Split(' ');\n\n int a = Convert.ToInt32(abn[0]);\n int b = Convert.ToInt32(abn[1]);\n int n = Convert.ToInt32(abn[2]);\n \n int count = 1;\n while (n > 0)\n {\n if (count % 2 == 0)\n {\n n -= gcd(n, b);\n }\n else \n {\n n -= gcd(n, a);\n }\n \n count++;\n }\n\n int answer = (--count % 2 == 0) ? 1 : 0;\n\n Console.WriteLine(answer);\n }\n\n public static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n\n return gcd(b, a % b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "84df089040e6bc5e28689fe91621e637", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\n\nnamespace _262\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n\n solve_helvetic2019A1();\n //solve_262A();\n }\n\n\n public static void solve_helvetic2019A1()\n {\n long r = Convert.ToInt64(Console.ReadLine());\n\n bool found = false;\n long x = 0;\n long y = 0;\n long xLen = (int)Math.Sqrt(r);\n for (x = 1; x < xLen; x++)\n {\n long yLen = r <= 100000 ? r : (r / (2 * x)) - xLen;\n for (y = 1; y < yLen; y++)\n {\n long h = x * x + 2 * x * y + x + 1;\n if (h > r)\n {\n break;\n }\n \n if (r == h)\n {\n found = true;\n break;\n }\n }\n\n if (found)\n {\n break;\n }\n }\n\n if (found)\n {\n Console.Write(\"{0} {1}\", x, y);\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n\n public static void solve_262A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int bought = n;\n int max = n;\n while (bought > 0)\n {\n bought = max % m == 0 ? (bought + m - 1) / m : bought / m;\n max += bought;\n }\n Console.WriteLine(max);\n }\n\n /* \n1)4\n2)1 + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1)\n4)1\n\n1 1 \n\t \n2 3 \n \n3 7 \n \n4 14 \n\t\n5 25\n\n1)5\n2)1 + (1 + 1) + (1 + 1) + (1 + 1)\n3)1 + (1 + 1 + 1) + (1 + 1 + 1)\n4)1 + (1 + 1 + 1 + 1)\n5)1\n\n(0) + 1 => (1) + 2 => (1 + 3) + 3 => (3 + 7) + 4 => (7 + 14) + 5\n */\n public static void solve_164B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int total = 0;\n int prev = 0;\n int prevPrev = 0;\n for (int i = 1; i <= n; i++)\n {\n total = prevPrev + prev + i;\n\n prevPrev = prev;\n prev = total;\n }\n\n Console.WriteLine(total);\n }\n\n\n /*\n \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 q \u0438 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u043f\u0440\u0430\u0432\u043e.\n \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0434\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u0441\u043c\u0435\u0441\u0442\u0438\u0432 \u0431\u0443\u043a\u0432\u0443 \u0432\u043b\u0435\u0432\u043e, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.\n \u041f\u043e\u0442\u043e\u043c\u0443\u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 keyboard q \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \u0418 \u043b\u0435\u0432\u0435\u0435 \u043d\u0435\u0435 \u0443 \u043d\u0430\u0441 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442.\n \u041d\u041e! \u041f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0443 \u043d\u0430\u0441 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0440\u043e\u0442 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u0441\u0430\u043c\u0443\u044e \u043b\u0435\u0432\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443, \u0442\u043e\n \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0432 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u0430\u0432\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u0426\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u043e\u0441\u0442\u044c.\n \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u0435\u0439\u0441 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f.\n\n \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 IndexOf \u0438 \u0437\u0430\u043f\u0438\u0445\u0430\u0442\u044c\n \u0432\u0441\u0435 \u0431\u0443\u043a\u0432\u044b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. \u0413\u0434\u0435 \u0431\u0443\u043a\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0430 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435.\n */\n public static void solve_271A()\n {\n string direction = Console.ReadLine();\n string text = Console.ReadLine();\n\n string keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\n string answer = String.Empty;\n if (direction == \"R\")\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) - 1];\n }\n }\n else\n {\n for (int i = 0; i < text.Length; i++)\n {\n answer += keyboard[keyboard.IndexOf(text[i]) + 1];\n }\n }\n\n Console.WriteLine(answer);\n }\n\n /*\n \u0414\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u043a\u0440\u0438 \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\n String.Contains.\n \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dictionary \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430 \u0445\u043e\u0442\u044f \u0431\u044b\n log(n)\n */\n public static void solve_368A()\n {\n string[] nm = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nm[0]);\n int m = Convert.ToInt32(nm[1]);\n\n int count = 0;\n string noir = \"WBG\";\n for (int i = 0; i < n; i++)\n {\n string[] row = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < m; j++)\n {\n if (noir.Contains(row[j]))\n {\n count++;\n }\n }\n }\n\n string answer = (count == n * m) ? \"#Black&White\" : \"#Color\";\n\n Console.WriteLine(answer); \n }\n\n public static void solve_90A()\n {\n string[] abn = Console.ReadLine().Split(' ');\n\n int a = Convert.ToInt32(abn[0]);\n int b = Convert.ToInt32(abn[1]);\n int n = Convert.ToInt32(abn[2]);\n \n int count = 1;\n while (n > 0)\n {\n if (count % 2 == 0)\n {\n n -= gcd(n, b);\n }\n else \n {\n n -= gcd(n, a);\n }\n \n count++;\n }\n\n int answer = (--count % 2 == 0) ? 1 : 0;\n\n Console.WriteLine(answer);\n }\n\n public static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n\n return gcd(b, a % b);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "671e3bdfbadc608f270abb241cacfbb5", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "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 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 {\n return;\n }\n if (n == 0 || n == 1)\n {\n if (indx >= l && indx <= r && n == 1L)\n {\n answ++;\n }\n return;\n }\n var log = GetLog2(n);\n var power = GetPower(2L, log) / 2 - 1L;\n if (indx + (power) * 2 + 1L < l)\n {\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 private long GetLog2(long n)\n {\n var log = 0;\n while (n > 0) {\n n /= 2;\n log++;\n }\n\n return log;\n }\n\n public long GetPower(long n, long p)\n {\n var power = 1L;\n for (var i = 0; i < p; i++) {\n power *= n;\n }\n\n return power;\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": "5329dfd02e5499d551cc0bd46e97820e", "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 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 / 2;\n if (index < current)\n current = current - path;\n else\n current = current + path;\n if (root > 1) \n root = root / 2;\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": "2ebfde80e4709a1409961936cbad2b5f", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.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 object Solve()\n {\n var n = ReadLong();\n if (n == 0)\n return 0;\n if (n == 1)\n return 1;\n var l = ReadLong() - 1;\n var r = ReadLong() - 1;\n long cur = n;\n var info = new List();\n while(cur != 1)\n {\n var p = new Pair { Val = cur / 2, Rem = cur % 2 };\n info.Add(p);\n cur = cur / 2;\n }\n long count1 = 1L;\n long len = 1L;\n for (int i = info.Count - 1; i >= 0; i--)\n {\n len = len * 2 + 1;\n info[i].Len = len;\n count1 = count1 * 2 + info[i].Rem;\n info[i].Count1 = count1;\n }\n return Recursive(info, l, r, 0, 0);\n }\n\n long Recursive(List info, long l, long r, int depth, long myLeft)\n {\n var currentPair = info[depth];\n var myRight = myLeft + currentPair.Len - 1;\n if (myLeft >= l && myRight <= r)\n return currentPair.Count1;\n if (myLeft > r || myRight < l)\n return 0;\n if (depth == info.Count - 1)\n {\n long result = 0;\n if (myLeft >= l && myLeft <= r)\n result++;\n if (myRight >= l && myRight <= r)\n result++;\n if (myLeft + 1 >= l && myLeft + 1<= r)\n result += currentPair.Rem;\n return result;\n }\n var first = Recursive(info, l, r, depth + 1, myLeft);\n var sec = Recursive(info, l, r, depth + 1, myLeft + info[depth + 1].Len + 1);\n var mid = myLeft + currentPair.Len / 2;\n var res = first + (mid >= l && mid <= r ? currentPair.Rem : 0) + sec;\n return res;\n }\n\n class Pair\n {\n public long Val;\n public long Rem;\n public long Count1;\n public long Len;\n }\n\n Node FindDeepest(Node current, long target, Node bad)\n {\n Node result = null;\n for (int i = 0; i < current.Children.Count; i++)\n {\n if (current.Children[i] == bad)\n continue;\n result = FindDeepest(current.Children[i], target, bad);\n if (result != null)\n {\n break;\n }\n }\n if (current.parent != -1 && result == null && current.sum == target)\n return current;\n return result;\n }\n\n long CalcSum(Node current)\n {\n var sum = current.t;\n for (int i = 0; i < current.Children.Count; i++)\n {\n sum += CalcSum(current.Children[i]);\n }\n current.sum = sum;\n return sum;\n }\n\n class Node {\n public long parent;\n public long index;\n public long t;\n public long sum;\n public List Children;\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(1024*10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "203850a0360779257eec3d0511d6df7b", "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.NextInt();\n\t\t\tvar r = cin.NextInt();\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": false, "code_uid": "7e56e47ffdd41c207c53cdb3ced9a4b4", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.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 long mod = 1000000007;\n void solve()\n {\n Scanner cin = new Scanner();\n\n int n = cin.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = cin.nextInt();\n }\n\n int MAX = 1 << n;\n\n long[] now = new long[MAX];\n\n long[] plus = new long[n + 100];\n plus[0] = 0;\n plus[1] = 0;\n plus[2] = 1;\n\n\n for (int i = 3; i <= n; i++)\n {\n plus[i] = (plus[i - 1] * (i - 1)) % mod;\n }\n\n for (int i = 0; i < MAX; i++)\n {\n int count = 0;\n int sum = 0;\n for (int j = 0; j < n; j++)\n {\n if ((i >> j) % 2 == 0) continue;\n count++;\n sum += a[j] - 1;\n }\n sum += 2;\n if (sum >= count)\n {\n now[i] = plus[count];\n }\n }\n \n long ret = 0;\n long[] dp = new long[MAX];\n for (int i = 0; i < MAX; i++)\n {\n int revi = MAX - 1 - i;\n for (int j = revi; j > 0; j = ((j - 1) & revi))\n {\n dp[i + j] = (dp[i + j] + now[i] * dp[j]) % mod;\n }\n dp[i] = (dp[i] + now[i]) % mod;\n }\n for (int i = 0; i < MAX; i++)\n {\n ret = (ret + dp[i]) % mod;\n }\n ret = (ret + 1) % mod;\n Console.WriteLine(ret);\n\n }\n\n int bitCount(long x)\n {\n x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);\n x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);\n x = (x & 0x0f0f0f0f0f0f0f0f) + (x >> 4 & 0x0f0f0f0f0f0f0f0f);\n x = (x & 0x00ff00ff00ff00ff) + (x >> 8 & 0x00ff00ff00ff00ff);\n x = (x & 0x0000ffff0000ffff) + (x >> 16 & 0x0000ffff0000ffff);\n return (int)((x & 0x00000000ffffffff) + (x >> 32 & 0x00000000ffffffff));\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": "137021829c75d79b80b399183b3f6323", "src_uid": "91e8dbe94273e255182aca0f94117bb9", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace CodeForces {\n class _83div2taskE { \n static byte n;\n static UInt64 y;\n static byte m; \n static int[] restrictions;\n static int[] result;\n static int[] _bitcounts;\n static void Main(string[] args) { \n string[] s = Console.ReadLine().Split(' ');\n n = byte.Parse(s[0]);\n y = UInt64.Parse(s[1]) - 2001;\n m = byte.Parse(s[2]); \n restrictions = new int[n];\n result = new int[n]; \n for (byte i = 0; i < n; i++) {\n result[i] = -1;\n }\n if(m==0 && Fact(n) == y+1){\n for (int k = n; k > 0; k--) {\n Console.Write(k + \" \");\n } \n return;\n }\n else {\n for (byte i = 0; i < m; i++) {\n string[] l = Console.ReadLine().Split(' ');\n int lower = int.Parse(l[0]) - 1;\n int bigger = int.Parse(l[1]) - 1;\n restrictions[bigger] |= 1 << lower;\n }\n InitializeBitcounts();\n for (byte position = 0; position < n; position++) {\n while (true) {\n if (result[position] == n) {\n Console.WriteLine(\"The times have changed\"); \n return;\n }\n result[position]++;\n if (Contains(result[position],position))\n continue;\n ulong[] dp = new ulong[1 << n]; \n dp[0] = 1;\n for (uint mask = 0; mask < 1 << n; mask++) {\n int count = PrecomputedBitcount(mask);\n for (byte j = 0; j < n; j++) {\n if (((mask & (1 << j)) == 0)\n && (restrictions[j] & mask) == restrictions[j]\n && (result[j] == -1 || result[j] == count))\n dp[mask | (1 << j)] += dp[mask];\n }\n }\n ulong sum = dp[(1 << n) - 1];\n if (sum > y)\n break;\n else\n y -= sum;\n }\n }\n for (byte i = 0; i < n; i++) {\n Console.Write((result[i] + 1) + \" \");\n } \n } \n }\n\n static bool Contains(int value, int length) {\n for (int i = 0; i < length; i++) {\n if (result[i] == value) return true;\n }\n return false;\n }\n\n static ulong Fact(int k) {\n ulong result = 1;\n for (int i = 1; i <= k; i++) {\n result *= (ulong)i;\n }\n return result;\n }\n\n static byte GetBit(uint b, byte pos) {\n return (b & (1 << pos)) != 0 ? (byte)1 : (byte)0;\n }\n\n static void InitializeBitcounts() {\n _bitcounts = new int[65536];\n int position1 = -1;\n int position2 = -1;\n //\n // Loop through all the elements and assign them.\n //\n for (int i = 1; i < 65536; i++, position1++) {\n //\n // Adjust the positions we read from.\n //\n if (position1 == position2) {\n position1 = 0;\n position2 = i;\n }\n _bitcounts[i] = _bitcounts[position1] + 1;\n }\n }\n\n static int PrecomputedBitcount(uint value) {\n //\n // Count bits in each half of the 32-bit input number.\n //\n return _bitcounts[value & 65535] + _bitcounts[(value >> 16) & 65535];\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "dd80adbcf17c31080d3ba511e4622848", "src_uid": "e9db8d048e9763cf38c584342dea9f53", "difficulty": 2400.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace CodeForces {\n class _83div2taskE { \n static byte n;\n static UInt64 y;\n static byte m; \n static int[] restrictions;\n static int[] result;\n static void Main(string[] args) {\n string[] s = Console.ReadLine().Split(' ');\n n = byte.Parse(s[0]);\n y = UInt64.Parse(s[1]) - 2001;\n m = byte.Parse(s[2]); \n restrictions = new int[n];\n result = new int[n];\n for (byte i = 0; i < n; i++) {\n result[i] = -1;\n } \n for (byte i = 0; i < m; i++) {\n string[] l = Console.ReadLine().Split(' ');\n int lower = int.Parse(l[0]) - 1;\n int bigger = int.Parse(l[1]) - 1; \n restrictions[bigger] |= 1 << lower;\n }\n\n for (byte position = 0; position < n; position++) {\n while(true){\n if (result[position] == n) {\n Console.WriteLine(\"The times have changed\");\n return;\n }\n result[position]++;\n ulong[] dp = new ulong[1 << n];\n dp[0] = 1;\n for (uint mask = 0; mask < 1 << n; mask++) {\n for (byte j = 0; j < n; j++) {\n if ((result[j] == -1 || result[j] == Count1(mask))\n && (restrictions[j] & mask) == restrictions[j]\n && ((mask & (1 << j)) == 0))\n dp[mask | (1 << j)] += dp[mask];\n }\n }\n UInt64 sum = dp[(1 << n) - 1];\n if (sum > y)\n break;\n else\n y -= sum; \n }\n }\n for (byte i = 0; i < n; i++) {\n Console.Write((result[i] + 1) + \" \");\n } \n }\n\n static byte GetBit(uint b, byte pos) {\n return (b & (1 << pos)) != 0 ? (byte)1 : (byte)0;\n }\n\n static byte Count1(uint number) {\n byte result = 0; \n for(byte pos =0; pos < 8*sizeof(uint);pos++){\n result += GetBit(number, pos);\n }\n return result;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "d275e71d4d4564dffe305f293c7bbf65", "src_uid": "e9db8d048e9763cf38c584342dea9f53", "difficulty": 2400.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 Ways = new long[102, 102, 102, 102];\n Ways[0, 1, 0, 1] = 1;\n\n n /= 2;\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": "09cc026445d764f63393656912b7e6ed", "src_uid": "c6d275b1e1d5c9e39e2cf990a635fa6b", "difficulty": 2800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections.Generic;\n\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();\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": "4a21f7354b5be56191be0f52e5fd2b65", "src_uid": "5f5b320c7f314bd06c0d2a9eb311de6c", "difficulty": 2300.0} {"lang": "MS C#", "source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n Console.WriteLine(\"INTERCAL\");\n }\n }", "lang_cluster": "C#", "compilation_error": false, "code_uid": "4502cc435c4f516c2afe18a6732255db", "src_uid": "ef8239a0f77c538d2d9b246b86be63fe", "difficulty": 2000.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 static Tuple Solve() {\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 return Tuple.Create(-1, 0);\n } else if (i % 2 != 0 && dp[i, cnt50, cnt100] != 0) {\n return Tuple.Create(i, (Int32)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 ans = Solve();\n Console.WriteLine(ans.Item1);\n Console.WriteLine(ans.Item2);\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": "51ce498c678e5a00eb78153c7a657a96", "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 ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N, a, b, c, count = 0;\n string[] buff = Console.ReadLine().Split(' ');\n N = int.Parse(buff[0]);\n a = int.Parse(buff[1]);\n b = int.Parse(buff[2]);\n c = int.Parse(buff[3]);\n\n for (int i = 0; i <= c; i++)\n {\n int mod1;\n mod1 = N - i*2;\n if (mod1 < 0)\n {\n continue;\n }\n if (mod1 == 0)\n {\n count++;\n continue;\n }\n for (int j = 0; j <= b; j++)\n {\n int mod2;\n mod2 = mod1 - j;\n if (mod2 < 0)\n {\n continue;\n }\n if (mod2 == 0)\n {\n count++;\n continue;\n }\n if (a * 0.5 >= mod2)\n count++;\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "bda108624ce55651bb21c0b5375b42ac", "src_uid": "474e527d41040446a18186596e8bdd83", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "using 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 if(stock < 0)\n return -1;\n if (skipRefill() == false)\n {\n // refill\n stock = b;\n ans++;\n }\n stock -= (a - spbu); // to stop\n if(stock < 0)\n return -1;\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}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "76a3b6a6148aa58e1ad96e36a5a66fb3", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n\n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var a = sr.NextInt64();\n var b = sr.NextInt64();\n var f = sr.NextInt64();\n var k = sr.NextInt64();\n \n var currB = b;\n var count = 0L;\n for (var i = 0; i < k; i++) {\n var firstStation = i % 2 == 0 ? f : a - f;\n var secondStation = i % 2 == 0 ? 2*a - f : a + f;\n if (i + 1 == k) {\n if (currB - a >= 0) {\n break;\n }\n else {\n if (currB < firstStation) {\n sw.WriteLine(-1);\n return;\n }\n if (b < (a - firstStation)) {\n sw.WriteLine(-1);\n return;\n }\n count++;\n break;\n }\n }\n if (currB < firstStation) {\n sw.WriteLine(-1);\n return;\n }\n if (currB >= secondStation) {\n currB -= a;\n }\n else {\n currB = b - (a - firstStation);\n count++;\n }\n }\n\n sw.WriteLine(count);\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "091d52494fb82032c59089dcdcfe4b7a", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.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 (r == divide && l == r) return best;\n if (a == divide && a == b) return best;\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 && !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": "f0a1f9961fa6f6281518a6b73911a161", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "difficulty": 2400.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 (r == divide && l == r) return best;\n if (a == divide && a == b) return best;\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 && !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": "f1e3d402edb64c95b86d135e41dd29bd", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "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 = 1000003;\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, int 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 public void Solve()\n {\n int n = ReadInt();\n int w = ReadInt();\n int h = ReadInt();\n\n var a = new long[w + 1, w + 1];\n for (int i = 0; i <= w; i++)\n a[0, i] = 1;\n for (int i = 1; i <= w; i++)\n a[i, i - 1] = h;\n\n a = MatPow(a, w + 1, n);\n long ans = 0;\n for (int i = 0; i <= w; i++)\n ans += a[i, 0];\n\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(),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": "d33948a87ca8595648dbd7ba28879727", "src_uid": "bb1c0ff47186e10e00b7dde6758ff1c1", "difficulty": 2100.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": "9de5f56e18b9cb844e8ff3f6e84f4e3b", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.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 = 1000000000 + 7;\n\n int n = ReadInt();\n long k = ReadLong();\n int[] a = ReadIntArray();\n\n int m = a.Sum();\n\n if (m == n)\n {\n Writer.WriteLine(1);\n return;\n }\n\n long[,] b = new long[m + 1, m + 1];\n for (int i = 0; i < m + 1; i++)\n {\n long l = Math.Max(0, 2 * i * (n + i - 2 * m));\n long r = 2 * (m - i) * (m - i);\n long e = n * (n - 1) - l - r;\n long inv = Inv(n * (n - 1), MOD);\n if (l > 0)\n {\n b[i, i - 1] = l * inv % MOD;\n }\n b[i, i] = e * inv % MOD;\n if (r > 0)\n {\n b[i, i + 1] = r * inv % MOD;\n }\n }\n\n long[,] c = MatrixBinPower(m + 1, b, k, MOD);\n\n int st = 0;\n for (int i = 0; i < m; i++)\n {\n st += a[n - i - 1];\n }\n\n long ans = c[st, m];\n\n Writer.WriteLine(ans);\n }\n\n public static long Inv(long a, long mod)\n {\n return BinPower(a, mod - 2, mod);\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long[,] MatrixBinPower(int n, long[,] a, long p, long mod)\n {\n long[,] result = new long[n, n];\n for (int i = 0; i < n; i++)\n {\n result[i, i] = 1;\n }\n\n while (p > 0)\n {\n if ((p & 1) != 0)\n {\n result = MatrixMult(n, result, a, mod);\n }\n\n a = MatrixMult(n, a, a, mod);\n p >>= 1;\n }\n\n return result;\n }\n\n public static long[,] MatrixMult(int n, long[,] a, long[,] b, long mod)\n {\n long[,] c = new long[n, n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n c[i, j] = (c[i, j] + a[i, k] * b[k, j]) % mod;\n }\n }\n }\n\n return c;\n }\n\n public static void Solve()\n {\n#if DEBUG\n var sw = Stopwatch.StartNew();\n#endif\n\n SolveCase();\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n Writer.Write(\"Case #{0}: \", 1 - t);\n SolveCase();\n }*/\n\n#if DEBUG\n sw.Stop();\n Console.WriteLine($\"{sw.ElapsedMilliseconds} ms\");\n#endif\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n // Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n // Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Shuffle(result);\n return result;\n }\n\n private static void Shuffle(IList array)\n {\n Random rnd = new Random();\n for (int i = array.Count - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = array[k];\n array[k] = array[i];\n array[i] = tmp;\n }\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b8b2c5d806242185e5f6356b53633473", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Myon\n{\n public Myon() { }\n static void Main(string[] args)\n {\n new Myon().calc();\n }\n\n void calc()\n {\n string[] board = new string[8];\n for (int i = 0; i < 8; i++)\n {\n board[i] = Console.ReadLine();\n }\n if (calc2(board)) Console.WriteLine(\"WIN\");\n else Console.WriteLine(\"LOSE\");\n }\n\n bool calc2(string[] board)\n {\n bool[,] now = new bool[8, 8];\n now[7, 0] = true;\n for (int turn = 0; turn < 30; turn++)\n {\n bool[,] next = new bool[8, 8];\n for (int y = 0; y < 8; y++)\n {\n for (int x = 0; x < 8; x++)\n {\n if (y - turn >= 0 && board[y - turn][x] == 'S') continue;\n if (y - (turn + 1) >= 0 && board[y - (turn + 1)][x] == 'S') continue;\n for (int vy = -1; vy <= 1; vy++)\n {\n for (int vx = -1; vx <= 1; vx++)\n {\n int ny = y + vy;\n int nx = x + vx;\n if (ok(ny, nx) && now[ny, nx])\n {\n next[y, x] = true;\n if (board[y][x] == 'A') return true;\n }\n }\n }\n }\n }\n now = next;\n }\n return false;\n }\n\n bool ok(int y, int x)\n {\n return x >= 0 && y >= 0 && x < 8 && y < 8;\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7d9621369fcdbe768b88aa6577e452d6", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "using 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 = \"C4\";\n\n class Pair\n {\n public int X;\n public int Y;\n }\n\n private static List stats;\n private static int[] direct;\n private static void Solve()\n {\n stats = new List();\n for (int i = 0; i < 8; i++)\n {\n var input = Read();\n for (int j = 0; j < 8; j++)\n {\n if(input[j] == 'S')\n {\n stats.Add(new Pair {X = i, Y = j});\n }\n }\n }\n direct = new[] {-1, 0, 1};\n if(CanMove(7, 0, 0))\n Console.WriteLine(\"WIN\");\n else\n {\n Console.WriteLine(\"LOSE\");\n }\n }\n\n private static bool CanMove(int x, int y, int step)\n {\n if(step >= 9)\n return true;\n if(x > 7 || y < 0)\n {\n return false;\n }\n if(stats.Any(s=>s.Y == y && (s.X + step == x || s.X + step - 1 == x)))\n return false;\n\n foreach (var dX in direct)\n {\n foreach (var dY in direct)\n {\n if (CanMove(x + dX, y + dY, step + 1))\n {\n return true;\n }\n }\n }\n return false;\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": "8e0ed43c9b9f2b0e8de4224802c20f51", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _94D2C\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[,] doska = new char[8, 8];\n for (int i = 0; i < 8; i++)\n {\n string temp = Console.ReadLine();\n for (int j = 0; j < 8; j++)\n {\n doska[j, i] = temp[j];\n }\n }\n bool f = hod(doska, 0, 7, 0);\n if (f)\n {\n Console.WriteLine(\"WIN\");\n }\n else\n {\n Console.WriteLine(\"LOSE\");\n }\n /*\n for (int i = 0; i < 8; i++)\n {\n for (int j = 0; j < 8; j++)\n Console.Write(doska[i, j] + \" \");\n Console.WriteLine();\n }\n */\n Console.ReadLine();\n }\n static bool hod(char[,] doska, int x, int y, int n)\n {\n bool f = false;\n if (n > 8)\n f = true;\n else\n {\n bool f1 = false, f2 = false, f3 = false, f4 = false, f5 = false, f6 = false, f7 = false, f8 = false, f9 = false;\n if (x > 0)\n {\n if (y - n > 0)\n {\n if ((doska[x - 1, y - n] != 'S') && (doska[x - 1, y - n - 1] != 'S'))\n f1 = hod(doska, x - 1, y, n + 1);\n }\n else\n {\n if (y - n - 1 > 0)\n {\n if (doska[x - 1, y - n ] != 'S')\n f1 = hod(doska, x - 1, y, n + 1);\n }\n else\n {\n f1 = hod(doska, x - 1, y, n + 1);\n }\n }\n }\n\n if (x < 7)\n {\n if (y - n > 0)\n {\n if ((doska[x + 1, y - n] != 'S') && (doska[x + 1, y - n - 1] != 'S'))\n f2 = hod(doska, x + 1, y, n + 1);\n }\n else\n {\n if (y - n - 1 >0)\n {\n if (doska[x + 1, y - n] != 'S')\n f2 = hod(doska, x + 1, y, n + 1);\n }\n else\n {\n f2 = hod(doska, x + 1, y, n + 1);\n }\n }\n }\n\n if (y < 7)\n {\n if (y - n+1 > 0)\n {\n if ((doska[x , y - n+1] != 'S') && (doska[x , y - n] != 'S'))\n f3 = hod(doska, x , y+1, n + 1);\n }\n else\n {\n if (y - n >= 0)\n {\n if (doska[x , y - n ] != 'S')\n f3 = hod(doska, x , y+1, n + 1);\n }\n else\n {\n f3 = hod(doska, x , y+1, n + 1);\n }\n }\n }\n\n if (y > 0)\n {\n if ( (y - n -1 < 7)&&(y-n-1>0))\n {\n if ((doska[x, y - n -1] != 'S') && (doska[x, y - n-2] != 'S'))\n f4 = hod(doska, x, y - 1, n + 1);\n }\n else\n {\n if (y - n-1 >= 0)\n {\n if (doska[x , y - n-1] != 'S')\n f4 = hod(doska, x, y - 1, n + 1);\n }\n else\n {\n f4 = hod(doska, x, y - 1, n + 1);\n }\n }\n }\n if ((x > 0) && (y > 0))\n {\n if ((y - n - 1 < 8) && (y - n - 1 > 0))\n {\n if ((doska[x-1, y - n - 1] != 'S') && (doska[x-1, y - n - 2] != 'S'))\n f5 = hod(doska, x-1, y - 1, n + 1);\n }\n else\n {\n if (y - n - 1 >= 0)\n {\n if (doska[x -1, y - n-1] != 'S')\n f5 = hod(doska, x-1, y - 1, n + 1);\n }\n else\n {\n f5 = hod(doska, x-1, y - 1, n + 1);\n }\n }\n }\n\n if ((x > 0) && (y < 7))\n {\n if (y - n + 1 > 0)\n {\n if ((doska[x-1, y - n + 1] != 'S') && (doska[x-1, y - n] != 'S'))\n f6 = hod(doska, x-1, y + 1, n + 1);\n }\n else\n {\n if (y - n >= 0)\n {\n if (doska[x - 1, y - n] != 'S')\n f6 = hod(doska, x-1, y + 1, n + 1);\n }\n else\n {\n f6 = hod(doska, x-1, y + 1, n + 1);\n }\n }\n }\n\n if ((x < 7) && (y > 0))\n {\n if ((y - n - 1 >= 0) && (y - n - 2 >= 0))\n {\n if ((doska[x + 1, y - n - 1] != 'S') && (doska[x + 1, y - n - 2] != 'S'))\n f7 = hod(doska, x+ 1, y - 1, n + 1);\n }\n else\n {\n if (y - n - 1 >= 0)\n {\n if (doska[x + 1, y - n - 1] != 'S')\n f7 = hod(doska, x + 1, y - 1, n + 1);\n }\n else\n {\n f7 = hod(doska, x + 1, y - 1, n + 1);\n }\n }\n }\n\n if ((x < 7) && (y < 7))\n {\n if (y - n + 1 > 0)\n {\n if ((doska[x + 1, y - n + 1] != 'S') && (doska[x + 1, y - n] != 'S'))\n f8 = hod(doska, x + 1, y + 1, n + 1);\n }\n else\n {\n if (y - n+1 >= 0)\n {\n if (doska[x + 1, y - n+1] != 'S')\n f8 = hod(doska, x + 1, y + 1, n + 1);\n }\n else\n {\n f8 = hod(doska, x + 1, y + 1, n + 1);\n }\n }\n }\n if (y - n >= 0)\n {\n if (doska[x, y - n] != 'S')\n {\n f9 = hod(doska, x, y, n + 1);\n }\n }\n else\n {\n f9 = hod(doska, x, y, n + 1);\n }\n f = f1 || f2 || f3 || f4 || f5 || f6 || f7 || f8 || f9; \n }\n\n return f;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "efff1366f7283025064347c03055c27b", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "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\tclass Node\n\t{\n\t\tpublic char[,] board = new char[8, 8];\n\t\t\n\t\tpublic Node()\n\t\t{\n\t\t}\n\n\t\tpublic int mx;\n\t\tpublic int my;\n\t\tpublic int s;\n\n\t\tpublic Node Move(int x, int y)\n\t\t{\n\t\t\tif (x < 0 || x >= 8 || y < 0 || y >= 8)\n\t\t\t\treturn null;\n\t\t\tif (board[x, y] == 'S')\n\t\t\t\treturn null;\n\n\t\t\tvar next = new Node();\n\t\t\tnext.mx = x;\n\t\t\tnext.my = y;\n\t\t\tnext.board = new char[8,8];\n\t\t\tfor (int xx = 0; xx < 8; xx++)\n\t\t\t{\n\t\t\t\tfor (int yy = 6; yy >= 0; yy--)\n\t\t\t\t{\n\t\t\t\t\tif (this.board[xx, yy] == 'S')\n\t\t\t\t\t{\n\t\t\t\t\t\tif (xx == mx && yy + 1 == my)\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\tnext.board[xx, yy + 1] = 'S';\n\t\t\t\t\t\ts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn next;\n\t\t}\n\t}\n\n\tpublic void Solve()\n\t{\n\t\tvar list = new List();\n\t\tvar s = new Node();\n\t\tfor (int y = 0; y < 8; y++)\n\t\t{\n\t\t\tvar ss = CF.ReadLine();\n\t\t\tfor (int x = 0; x < 8; x++)\n\t\t\t{\n\t\t\t\ts.board[x, y] = ss[x];\n\t\t\t\tif (ss[x] == 'S')\n\t\t\t\t\ts.s++;\n\t\t\t}\n\t\t}\n\t\ts.my = 7;\n\t\ts.mx = 0;\n\t\tlist.Add(s);\n\n\t\tfor (; ; )\n\t\t{\n\t\t\tif (list.Count == 0)\n\t\t\t{\n\t\t\t\tCF.WriteLine(\"LOSE\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar list2 = new List();\n\t\t\n\t\t\tforeach(var n in list)\n\t\t\t{\n\t\t\t\tfor (int dx = -1; dx <= 1; dx++)\n\t\t\t\t{\n\t\t\t\t\tfor (int dy = -1; dy <= 1; dy++)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar next = n.Move(n.mx + dx, n.my + dy);\n\t\t\t\t\t\tif (next == null)\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\tif ( s.s == 0 || (next.mx==7&&next.my==0))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tCF.WriteLine(\"WIN\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlist2.Add(next);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlist = list2;\n\t\t}\n }\n\n\n\n\t// test\n\tstatic Utils CF = new Utils(new[]{\n@\"\n.......A\n........\n........\n........\n........\n........\n........\nM.......\n\",\n @\"\n.......A\n........\n........\n........\n........\n........\nSS......\nM.......\n\",\n @\"\n.......A\n........\n........\n........\n........\n.S......\nS.......\nMS......\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": "579e91ffe07bb0f264f69fe408990bd6", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n public class ProblemG568\n {\n static void Main(string[] args)\n {\n var nt = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = nt[0];\n int t = nt[1];\n var songs = new List>();\n int modulo = 1000000000 + 7;\n for (int i = 0; i < n; i++)\n {\n var ns = Console.ReadLine().Split().Select(int.Parse).ToArray();\n songs.Add(Tuple.Create(ns[0], ns[1]));\n }\n var playlists = new SortedDictionary, int>>();\n playlists.Add(0, new Dictionary, int>());\n playlists[0][Tuple.Create(0, -1)] = 1;\n int count = 0;\n while (playlists.Count > 0)\n {\n var kvp = playlists.First();\n int refTime = kvp.Key;\n if (refTime == t)\n {\n // on compte\n foreach (var kvp2 in kvp.Value)\n {\n count = (count + kvp2.Value) % modulo;\n }\n break;\n }\n else if (refTime > t)\n {\n // too much\n break;\n }\n\n playlists.Remove(refTime);\n foreach (var kvp2 in kvp.Value)\n {\n int play = kvp2.Key.Item1;\n int last = kvp2.Key.Item2;\n int lastgenre = last == -1 ? -1 : songs[last].Item2;\n int counting = kvp2.Value;\n for (int i = 0; i < n; i++)\n {\n // not already played\n if ((play & (1 << i)) > 0)\n continue;\n int nextplay = play | (1 << i);\n\n // no two consecutive genre\n if (songs[i].Item2 == lastgenre)\n continue;\n int nexttime = refTime + songs[i].Item1;\n // playlist too long\n if (nexttime > t)\n continue;\n if (!playlists.ContainsKey(nexttime))\n {\n playlists[nexttime] = new Dictionary, int>();\n }\n var nextkey = Tuple.Create(nextplay, i);\n if (!playlists[nexttime].ContainsKey(nextkey))\n {\n playlists[nexttime][nextkey] = 0;\n }\n playlists[nexttime][nextkey] = (playlists[nexttime][nextkey] + counting) % modulo;\n }\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "1c5e89164d4aae81ca98fe7b88012f32", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "difficulty": 2100.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 NMax = 1000 * 1000 + 1;\n\n private static void Main(string[] args)\n {\n var values = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(values[0]);\n int m = Convert.ToInt32(values[1]);\n\n var f = new double[NMax];\n f[1] = Math.Log(1.0);\n for (int i = 2; i < NMax; ++i)\n {\n f[i] = f[i - 1] + Math.Log(i);\n }\n\n double result = 0.0;\n double p2 = f[n * m] - f[n] - f[n * m - n];\n int mn = Math.Min(n, m);\n for (int i = 1; i <= mn; ++i)\n {\n double p1 = 2 * Math.Log(i) - Math.Log(n);\n p1 += f[m] - f[i] - f[m - i];\n p1 += f[n * m - m] - f[n - i] - f[n * m - m - n + i];\n p1 -= p2;\n result += Math.Exp(p1);\n }\n Console.WriteLine(result);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e61acc08c287f1fc599aa890353d402f", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.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 = (M - 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": "82dbcd693d07c37fb00821383bdd4a31", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Linq;\nusing CompLib.Collections.Generic;\nusing CompLib.Util;\n\npublic class Program\n{\n int A, B, C, D;\n public void Solve()\n {\n var sc = new Scanner();\n A = sc.NextInt();\n B = sc.NextInt();\n C = sc.NextInt();\n D = sc.NextInt();\n\n // a<=x<=b<=y<=c<=z<=d \u306ax,y,z\u306a\u4e09\u89d2\u5f62\u304c\u3044\u304f\u3064\u304b?\n\n // x+y = i\u306e\u3084\u3064\u3044\u304f\u3064\u304b?\n var st = new LazySegmentTree((l, r) => l + r, 0, (l, r) => l * r, (l, r) => l + r, 0);\n for (int x = A; x <= B; x++)\n {\n int min = x + B;\n int max = x + C;\n st.Update(min, max + 1, 1);\n }\n long ans = 0;\n for (int z = C; z <= D; z++)\n {\n // x+y > z\n\n ans += st.Query(z + 1, B + C + 1);\n }\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\n\nnamespace CompLib.Collections.Generic\n{\n using System;\n\n public class LazySegmentTree\n {\n private const int N = 1 << 20;\n private readonly T[] _array;\n private readonly T[] _tmp;\n private readonly bool[] _flag;\n\n\n private readonly T _identity, _updateIdentity;\n private readonly Func _operation, _update;\n private readonly Func _multiplication;\n\n /// \n /// \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf updateIdentity\u3067\u521d\u671f\u5316\n /// \n /// \u533a\u9593\u6f14\u7b97\u7528\u306e\u6f14\u7b97\n /// (T, operation)\u306e\u5358\u4f4d\u5143\n /// (T, operation)\u306e\u30b9\u30ab\u30e9\u30fc\u4e57\u7b97\n /// \u533a\u9593\u66f4\u65b0\u7528\u306e\u6f14\u7b97\n /// (T, update)\u306e\u5de6\u5358\u4f4d\u5143\n public LazySegmentTree(Func operation, T identity, Func multiplication, Func update,\n T updateIdentity)\n {\n _operation = operation;\n _identity = identity;\n _multiplication = multiplication;\n _update = update;\n _updateIdentity = updateIdentity;\n _array = new T[2 * N];\n for (int i = 0; i < N; i++)\n {\n _array[i + N] = _updateIdentity;\n }\n\n for (int i = N - 1; i >= 1; i--)\n {\n _array[i] = _operation(_array[i * 2], _array[i * 2 + 1]);\n }\n\n _tmp = new T[2 * N];\n for (int i = 1; i < 2 * N; i++)\n {\n _tmp[i] = _updateIdentity;\n }\n\n _flag = new bool[2 * N];\n }\n\n private void Eval(int k, int l, int r)\n {\n if (_flag[k])\n {\n if (r - l > 1)\n {\n _tmp[k * 2] = _update(_tmp[k * 2], _tmp[k]);\n _flag[k * 2] = true;\n _tmp[k * 2 + 1] = _update(_tmp[k * 2 + 1], _tmp[k]);\n _flag[k * 2 + 1] = true;\n }\n\n _array[k] = _update(_array[k], _multiplication(_tmp[k], r - l));\n _tmp[k] = _updateIdentity;\n _flag[k] = false;\n }\n }\n\n private void Update(int left, int right, int k, int l, int r, T n)\n {\n Eval(k, l, r);\n if (r <= left || right <= l) return;\n if (left <= l && r <= right)\n {\n // \u672c\u5f53\u306f _update(tmp[k], n)\u3060\u3051\u3069 \u4e0a\u3067Eval()\u3057\u305f\u306e\u3067 _tmp[k]\u306f\u5358\u4f4d\u5143\n _tmp[k] = n;\n _flag[k] = true;\n Eval(k, l, r);\n }\n else\n {\n Update(left, right, k * 2, l, (l + r) / 2, n);\n Update(left, right, k * 2 + 1, (l + r) / 2, r, n);\n _array[k] = _operation(_array[k * 2], _array[k * 2 + 1]);\n }\n }\n\n /// \n /// [left, right)\u3092update(A[i], n)\u306b\u66f4\u65b0\u3059\u308b\n /// \n /// \u53f3\u7aef\n /// \u5de6\u7aef\n /// \u5024\n public void Update(int left, int right, T n) => Update(left, right, 1, 0, N, n);\n\n /// \n /// A[i]\u3092update(A[i] ,n)\u306b\u66f4\u65b0\u3059\u308b\n /// \n /// index\n /// \u5024\n public void Update(int i, T n) => Update(i, i + 1, n);\n\n private T Query(int left, int right, int k, int l, int r)\n {\n Eval(k, l, r);\n if (r <= left || right <= l) return _identity;\n if (left <= l && r <= right) return _array[k];\n return _operation(Query(left, right, k * 2, l, (l + r) / 2), Query(left, right, k * 2 + 1, (l + r) / 2, r));\n }\n\n /// \n /// A[left] op A[left+1] ... A[right-1]\u3092\u6c42\u3081\u308b O(log N)\n /// \n /// \u5de6\u7aef\n /// \u53f3\u7aef\n /// \n public T Query(int left, int right) => Query(left, right, 1, 0, N);\n\n public T this[int i]\n {\n get { return Query(i, i + 1); }\n }\n\n public T[] ToArray()\n {\n T[] result = new T[N];\n for (int i = 0; i < N; i++)\n {\n result[i] = this[i];\n }\n\n return result;\n }\n }\n}\n\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n while (_index >= _line.Length)\n {\n _line = Console.ReadLine().Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n _line = Console.ReadLine().Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2c8eea610cfcd44b84007e16c20505e8", "src_uid": "4f92791b9ec658829f667fcea1faee01", "difficulty": 1800.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 CODEFORCES2\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var A = NN;\n var B = NN;\n var C = NN;\n var D = NN;\n var range = D - C + 1;\n var ans = 0L;\n for (var i = 0; i < range; i++)\n {\n var z = C + i;\n var miny = B;\n var needx = z - miny + 1;\n if (needx > B)\n {\n var herasi = B - needx;\n miny -= herasi;\n if (miny > C)\n {\n continue;\n }\n }\n var cntx = B - Max(A, needx) + 1;\n var nokoriacnt = (B - A + 1) - cntx + 1;\n var bcnt = C - B + 1;\n var mincnt = Min(nokoriacnt, bcnt);\n var s = mincnt * (2 * cntx + mincnt - 1) / 2;\n var nokorib = bcnt - mincnt;\n var thiscnt = s + nokorib * (B - A + 1);\n ans += thiscnt;\n }\n Console.WriteLine(ans);\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n }\n}\nnamespace Library {\n class LIB_FastIO\n {\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[1024];\n int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n byte read()\n {\n if (isEof) throw new EndOfStreamException();\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0)\n {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n public LIB_FastIODebug() { }\n public override string Scan() => NextString();\n public override long Long() => long.Parse(NextString());\n public override double Double() => double.Parse(NextString());\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "b8fbe3409c803f343c55fed2430de5ac", "src_uid": "4f92791b9ec658829f667fcea1faee01", "difficulty": 1800.0} {"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 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": "05b28ef623618361aa5e19492e1ae899", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300.0} {"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 - (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": "8beddca6cf9d4a21812f46f498f97415", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300.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 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 T[] Copy(this T[] a)\n {\n var b = new T[a.Length]; a.CopyTo(b, 0); return b;\n }\n\n public static T[][] Copy(this T[][] a)\n {\n return a.Select(z => z.Copy()).ToArray();\n }\n\n public static IEnumerable Shuffle(this IEnumerable collection)\n {\n if (collection.Take(11).Count() <= 10) return collection;\n var a = collection is T[] ? (T[])collection : collection.ToArray();\n int N = a.Length;\n for (int i = 0, p1 = 0, p2 = 1; i < N / 2; i++)\n {\n p1 += 3; if (p1 >= N) p1 -= N;\n p2 -= 7; if (p2 < 0) p2 += N;\n T t = a[p1]; a[p1] = a[p2]; a[p2] = t;\n }\n return a;\n }\n\n public static string AsString(this T[,] a, string separator)\n {\n var sb = new StringBuilder();\n int n0 = a.GetLength(0);\n int n1 = a.GetLength(1);\n for (int r = 0; r < n0; r++)\n {\n for (int c = 0; c < n1; c++)\n {\n if (c != 0) sb.Append(separator); sb.Append(a[r, c]);\n }\n sb.AppendLine();\n }\n //sb.AppendLine();\n return sb.ToString();\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; 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 == '-') { 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 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 class Writer\n {\n const int BufSize = 32000;\n char[] buf = new char[BufSize];\n int bufPos = 0;\n TextWriter output = Console.Out;\n Stack st = new Stack();\n\n public void Flush()\n {\n output.Write(buf, 0, bufPos); bufPos = 0;\n output.Flush();\n }\n\n void BufSpaceNeeded(int n)\n {\n if (n > BufSize) throw new ArgumentOutOfRangeException(\"n\");\n if (bufPos + n > BufSize) { output.Write(buf, 0, bufPos); bufPos = 0; }\n }\n\n public void Write(char a)\n {\n BufSpaceNeeded(1);\n buf[bufPos++] = a;\n }\n\n public void Write(string s)\n {\n int l = s.Length;\n for (int x = 0; x < l; )\n {\n int t = Math.Min(l - x, BufSize - bufPos);\n s.CopyTo(x, buf, bufPos, t); bufPos += t; x += t;\n if (x < l) BufSpaceNeeded(1); // force flush\n }\n }\n\n public void WriteLine()\n {\n BufSpaceNeeded(2);\n buf[bufPos++] = '\\r'; buf[bufPos++] = '\\n';\n }\n\n public void Write(object o) { Write(o.ToString()); }\n\n public void Write(uint a)\n {\n BufSpaceNeeded(10);\n do { st.Push((char)(a % 10 + 48)); a /= 10; } while (a != 0);\n while (st.Count != 0) buf[bufPos++] = st.Pop();\n }\n\n public void Write(ulong a)\n {\n BufSpaceNeeded(20);\n do { st.Push((char)(a % 10 + 48)); a /= 10; } while (a != 0);\n while (st.Count != 0) buf[bufPos++] = st.Pop();\n }\n\n public void Write(int a)\n {\n BufSpaceNeeded(11);\n if (a < 0) { buf[bufPos++] = '-'; a = -a; }\n Write((uint)a);\n }\n\n public void Write(long a)\n {\n BufSpaceNeeded(21);\n if (a < 0) { buf[bufPos++] = '-'; a = -a; }\n Write((ulong)a);\n }\n\n public void Write(double a, int digits)\n {\n Write(a.AsString(digits));\n }\n\n public void WriteLine(int a) { Write(a); WriteLine(); }\n public void WriteLine(long a) { Write(a); WriteLine(); }\n public void WriteLine(uint a) { Write(a); WriteLine(); }\n public void WriteLine(ulong a) { Write(a); WriteLine(); }\n public void WriteLine(string s) { Write(s); WriteLine(); }\n public void WriteLine(object o) { Write(o); WriteLine(); }\n }\n\n static void pe() { Console.WriteLine(\"???\"); Environment.Exit(0); }\n static void re() { throw new Exception(); }\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 static double Sqrt(double a) { return Math.Sqrt(a); }\n\n static StringBuilder sb = new StringBuilder();\n static Random rnd = new Random(5);\n\n #endregion Helpers\n\n const uint M = 1000000007;\n static uint[,] PROD = new uint[16, 16];\n\n static int h, w, k;\n static int wh1;\n static int predefined_colors;\n static int[] vertMasks;\n static uint result;\n static int[,] resultmap = new int[16, 16];\n\n static int[,] map;\n static int[] color_mapping_to, color_mapping_from;\n\n static uint DistinctMappingsCount(int from_count, int to_count)\n {\n if (from_count > to_count) throw new Exception();\n if (from_count < 1) throw new Exception();\n return /*k! / (k-max)! */ PROD[to_count - from_count + 1, to_count];\n }\n\n static void Per2(int y, int x, int vertmask)\n {\n if (y >= h)\n {\n var qwe = resultmap;\n\n uint t = 1;\n result += t;\n\n if (result >= M) result -= M;\n return;\n }\n\n int used = vertmask | vertMasks[x];\n for (int i = 1; i <= k; i++)\n if ((used >> i & 1) == 0)\n {\n int mc = map[y, x];\n if (mc != 0)\n {\n if (i != mc) continue;\n }\n\n vertMasks[x] |= (1 << i);\n resultmap[y, x] = i;\n if (x == w - 1) Per2(y + 1, 0, 0);\n else Per2(y, x + 1, used | (1 << i));\n resultmap[y, x] = 0;\n vertMasks[x] &= ~(1 << i);\n }\n }\n\n\n static void Per(int y, int x, int max, int vertmask)\n {\n var qwe = resultmap;\n\n if (y >= h)\n {\n if (max < wh1) throw new Exception();\n if (max > k) throw new Exception();\n // wh1 <= max <= k\n\n //result += DistinctMappingsCount(max, k);\n\n if (k < predefined_colors) throw new Exception();\n if (max < predefined_colors) throw new Exception();\n uint t = DistinctMappingsCount(max - predefined_colors, k - predefined_colors);\n result += t;\n\n if (result >= M) result -= M;\n return;\n }\n\n int used = vertmask | vertMasks[x];\n for (int i = 1; i <= max + 1; i++)\n if (i <= k)\n if ((used >> i & 1) == 0)\n {\n int mc = map[y, x];\n bool mapping = false;\n\n if (mc != 0)\n {\n if (color_mapping_from[mc] == 0 && color_mapping_to[i] == 0)\n {\n mapping = true;\n color_mapping_from[mc] = i;\n color_mapping_to[i] = mc;\n }\n else if (color_mapping_from[mc] == 0 && color_mapping_to[i] != 0)\n {\n continue; // color i already mapped to other color\n }\n else if (color_mapping_from[mc] != 0 && color_mapping_to[i] == 0)\n {\n continue; // color mc already mapped from other color\n }\n else if (color_mapping_from[mc] != 0 && color_mapping_to[i] != 0)\n {\n }\n }\n\n vertMasks[x] |= (1 << i);\n resultmap[y, x] = i;\n if (x == w - 1) Per(y + 1, 0, Math.Max(i, max), 0);\n else Per(y, x + 1, Math.Max(i, max), used | (1 << i));\n resultmap[y, x] = 0;\n vertMasks[x] &= ~(1 << i);\n\n if (mapping)\n {\n color_mapping_to[i] = 0;\n color_mapping_from[mc] = 0;\n }\n\n }\n }\n\n static void Main()\n {\n checked\n {\n#if !ONLINE_JUDGE\n Console.SetIn(File.OpenText(\"_input\"));\n#endif\n //Console.SetOut(File.CreateText(\"_output\"));\n var parser = new Parser();\n var o = new Writer();\n try\n {\n for (uint i = 0; i < 16; i++)\n for (uint j = 0; j < 16; j++)\n {\n if (j + 1 < i) PROD[i, j] = 0;\n else if (j < i) PROD[i, j] = 1;\n else if (j == i) PROD[i, j] = i;\n else PROD[i, j] = (uint)(PROD[i, j - 1] * (ulong)j % M);\n }\n\n while (!parser.SeekEOF)\n {\n h = parser.ReadInt();\n w = parser.ReadInt();\n k = parser.ReadInt();\n wh1 = w + h - 1;\n\n map = new int[16, 16];\n\n for (int y = 0; y < h; y++)\n for (int x = 0; x < w; x++)\n if (y < 16 && x < 16) map[y, x] = parser.ReadInt();\n else parser.ReadInt();\n\n //var mapping = new int[16];\n //for (int y = 0; y < h; y++)\n // for (int x = 0; x < w; x++)\n // {\n // for (int color = 1; ; color++)\n // {\n // for (int y = 0; y < h; y++)\n // for (int x = 0; x < w; x++) { }\n // }\n // }\n\n result = 0;\n if (wh1 > k)\n {\n }\n else\n {\n predefined_colors = map.Cast().Where(c => c != 0).Distinct().Count();\n color_mapping_from = new int[16];\n color_mapping_to = new int[16];\n vertMasks = new int[16];\n Per(0, 0, 0, 0);\n //o.WriteLine(result); result = 0;\n\n //color_mapping_from = new int[16];\n //color_mapping_to = new int[16];\n //vertMasks = new int[16];\n //Per2(0, 0, 0);\n }\n\n o.WriteLine(result);\n }\n }\n finally\n {\n o.Flush();\n }\n }\n }\n\n //static void Main()\n //{\n // new Thread(Main2, 50 << 20).Start();\n //}\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ee389812d1c1fb01dfc8736fad8c2c42", "src_uid": "5bb21f49d976cfa16a239593a95c53b5", "difficulty": 2700.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 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 T[] Copy(this T[] a)\n {\n var b = new T[a.Length]; a.CopyTo(b, 0); return b;\n }\n\n public static T[][] Copy(this T[][] a)\n {\n return a.Select(z => z.Copy()).ToArray();\n }\n\n public static IEnumerable Shuffle(this IEnumerable collection)\n {\n if (collection.Take(11).Count() <= 10) return collection;\n var a = collection is T[] ? (T[])collection : collection.ToArray();\n int N = a.Length;\n for (int i = 0, p1 = 0, p2 = 1; i < N / 2; i++)\n {\n p1 += 3; if (p1 >= N) p1 -= N;\n p2 -= 7; if (p2 < 0) p2 += N;\n T t = a[p1]; a[p1] = a[p2]; a[p2] = t;\n }\n return a;\n }\n\n public static string AsString(this T[,] a, string separator)\n {\n var sb = new StringBuilder();\n int n0 = a.GetLength(0);\n int n1 = a.GetLength(1);\n for (int r = 0; r < n0; r++)\n {\n for (int c = 0; c < n1; c++)\n {\n if (c != 0) sb.Append(separator); sb.Append(a[r, c]);\n }\n sb.AppendLine();\n }\n //sb.AppendLine();\n return sb.ToString();\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; 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 == '-') { 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 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 class Writer\n {\n const int BufSize = 32000;\n char[] buf = new char[BufSize];\n int bufPos = 0;\n TextWriter output = Console.Out;\n Stack st = new Stack();\n\n public void Flush()\n {\n output.Write(buf, 0, bufPos); bufPos = 0;\n output.Flush();\n }\n\n void BufSpaceNeeded(int n)\n {\n if (n > BufSize) throw new ArgumentOutOfRangeException(\"n\");\n if (bufPos + n > BufSize) { output.Write(buf, 0, bufPos); bufPos = 0; }\n }\n\n public void Write(char a)\n {\n BufSpaceNeeded(1);\n buf[bufPos++] = a;\n }\n\n public void Write(string s)\n {\n int l = s.Length;\n for (int x = 0; x < l; )\n {\n int t = Math.Min(l - x, BufSize - bufPos);\n s.CopyTo(x, buf, bufPos, t); bufPos += t; x += t;\n if (x < l) BufSpaceNeeded(1); // force flush\n }\n }\n\n public void WriteLine()\n {\n BufSpaceNeeded(2);\n buf[bufPos++] = '\\r'; buf[bufPos++] = '\\n';\n }\n\n public void Write(object o) { Write(o.ToString()); }\n\n public void Write(uint a)\n {\n BufSpaceNeeded(10);\n do { st.Push((char)(a % 10 + 48)); a /= 10; } while (a != 0);\n while (st.Count != 0) buf[bufPos++] = st.Pop();\n }\n\n public void Write(ulong a)\n {\n BufSpaceNeeded(20);\n do { st.Push((char)(a % 10 + 48)); a /= 10; } while (a != 0);\n while (st.Count != 0) buf[bufPos++] = st.Pop();\n }\n\n public void Write(int a)\n {\n BufSpaceNeeded(11);\n if (a < 0) { buf[bufPos++] = '-'; a = -a; }\n Write((uint)a);\n }\n\n public void Write(long a)\n {\n BufSpaceNeeded(21);\n if (a < 0) { buf[bufPos++] = '-'; a = -a; }\n Write((ulong)a);\n }\n\n public void Write(double a, int digits)\n {\n Write(a.AsString(digits));\n }\n\n public void WriteLine(int a) { Write(a); WriteLine(); }\n public void WriteLine(long a) { Write(a); WriteLine(); }\n public void WriteLine(uint a) { Write(a); WriteLine(); }\n public void WriteLine(ulong a) { Write(a); WriteLine(); }\n public void WriteLine(string s) { Write(s); WriteLine(); }\n public void WriteLine(object o) { Write(o); WriteLine(); }\n }\n\n static void pe() { Console.WriteLine(\"???\"); Environment.Exit(0); }\n static void re() { throw new Exception(); }\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 static double Sqrt(double a) { return Math.Sqrt(a); }\n\n static StringBuilder sb = new StringBuilder();\n static Random rnd = new Random(5);\n\n #endregion Helpers\n\n const uint M = 1000000007;\n static uint[,] PROD = new uint[16, 16];\n\n static int h, w, k;\n static int wh1;\n static int predefined_colors;\n static int[] vertMasks;\n static uint result;\n static int[,] resultmap = new int[16, 16];\n\n static int[,] map;\n static int[] color_mapping_to, color_mapping_from;\n\n static uint DistinctMappingsCount(int from_count, int to_count)\n {\n if (from_count > to_count) throw new Exception();\n if (from_count < 0) throw new Exception();\n return /*k! / (k-max)! */ PROD[to_count - from_count + 1, to_count];\n }\n\n static void Per2(int y, int x, int vertmask)\n {\n if (y >= h)\n {\n var qwe = resultmap;\n\n uint t = 1;\n result += t;\n\n if (result >= M) result -= M;\n return;\n }\n\n int used = vertmask | vertMasks[x];\n for (int i = 1; i <= k; i++)\n if ((used >> i & 1) == 0)\n {\n int mc = map[y, x];\n if (mc != 0)\n {\n if (i != mc) continue;\n }\n\n vertMasks[x] |= (1 << i);\n resultmap[y, x] = i;\n if (x == w - 1) Per2(y + 1, 0, 0);\n else Per2(y, x + 1, used | (1 << i));\n resultmap[y, x] = 0;\n vertMasks[x] &= ~(1 << i);\n }\n }\n\n\n static void Per(int y, int x, int max, int vertmask)\n {\n var qwe = resultmap;\n\n if (y >= h)\n {\n if (max < wh1) throw new Exception();\n if (max > k) throw new Exception();\n // wh1 <= max <= k\n\n //result += DistinctMappingsCount(max, k);\n\n if (k < predefined_colors) throw new Exception();\n if (max < predefined_colors) throw new Exception();\n uint t = DistinctMappingsCount(max - predefined_colors, k - predefined_colors);\n result += t;\n\n if (result >= M) result -= M;\n return;\n }\n\n int used = vertmask | vertMasks[x];\n for (int i = 1; i <= max + 1; i++)\n if (i <= k)\n if ((used >> i & 1) == 0)\n {\n int mc = map[y, x];\n bool mapping = false;\n\n if (mc != 0)\n {\n if (color_mapping_from[mc] == 0 && color_mapping_to[i] == 0)\n {\n mapping = true;\n color_mapping_from[mc] = i;\n color_mapping_to[i] = mc;\n }\n else if (color_mapping_from[mc] == 0 && color_mapping_to[i] != 0)\n {\n continue; // color i already mapped to other color\n }\n else if (color_mapping_from[mc] != 0 && color_mapping_to[i] == 0)\n {\n continue; // color mc already mapped from other color\n }\n else if (color_mapping_from[mc] != 0 && color_mapping_to[i] != 0)\n {\n if (color_mapping_to[i] != mc) continue;\n if (color_mapping_from[mc] != i) throw new Exception();\n }\n }\n\n vertMasks[x] |= (1 << i);\n resultmap[y, x] = i;\n if (x == w - 1) Per(y + 1, 0, Math.Max(i, max), 0);\n else Per(y, x + 1, Math.Max(i, max), used | (1 << i));\n resultmap[y, x] = 0;\n vertMasks[x] &= ~(1 << i);\n\n if (mapping)\n {\n color_mapping_to[i] = 0;\n color_mapping_from[mc] = 0;\n }\n\n }\n }\n\n static void Main()\n {\n checked\n {\n#if !ONLINE_JUDGE\n Console.SetIn(File.OpenText(\"_input\"));\n#endif\n //Console.SetOut(File.CreateText(\"_output\"));\n var parser = new Parser();\n var o = new Writer();\n try\n {\n for (uint i = 0; i < 16; i++)\n for (uint j = 0; j < 16; j++)\n {\n if (j + 1 < i) PROD[i, j] = 0;\n else if (j < i) PROD[i, j] = 1;\n else if (j == i) PROD[i, j] = i;\n else PROD[i, j] = (uint)(PROD[i, j - 1] * (ulong)j % M);\n }\n\n while (!parser.SeekEOF)\n {\n h = parser.ReadInt();\n w = parser.ReadInt();\n k = parser.ReadInt();\n wh1 = w + h - 1;\n\n map = new int[16, 16];\n\n for (int y = 0; y < h; y++)\n for (int x = 0; x < w; x++)\n if (y < 16 && x < 16) map[y, x] = parser.ReadInt();\n else parser.ReadInt();\n\n //var mapping = new int[16];\n //for (int y = 0; y < h; y++)\n // for (int x = 0; x < w; x++)\n // {\n // for (int color = 1; ; color++)\n // {\n // for (int y = 0; y < h; y++)\n // for (int x = 0; x < w; x++) { }\n // }\n // }\n\n result = 0;\n if (wh1 > k)\n {\n }\n else\n {\n predefined_colors = map.Cast().Where(c => c != 0).Distinct().Count();\n color_mapping_from = new int[16];\n color_mapping_to = new int[16];\n vertMasks = new int[16];\n Per(0, 0, 0, 0);\n //o.WriteLine(result); result = 0;\n\n //color_mapping_from = new int[16];\n //color_mapping_to = new int[16];\n //vertMasks = new int[16];\n //Per2(0, 0, 0);\n }\n\n o.WriteLine(result);\n }\n }\n finally\n {\n o.Flush();\n }\n }\n }\n\n //static void Main()\n //{\n // new Thread(Main2, 50 << 20).Start();\n //}\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "883ea4c4b8bb78478a2b30049546f07d", "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 long 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 = 0L;\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 = (res + Permutation(k - fixedCells, pattern.Distinct().Count() - fixedCells)) % 1000000007;\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": "0e29418e7c38e3a4440588598e3ee2aa", "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 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": "cf488c75638482f2531fe03aaf4481a0", "src_uid": "5bb21f49d976cfa16a239593a95c53b5", "difficulty": 2700.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 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 T[] Copy(this T[] a)\n {\n var b = new T[a.Length]; a.CopyTo(b, 0); return b;\n }\n\n public static T[][] Copy(this T[][] a)\n {\n return a.Select(z => z.Copy()).ToArray();\n }\n\n public static IEnumerable Shuffle(this IEnumerable collection)\n {\n if (collection.Take(11).Count() <= 10) return collection;\n var a = collection is T[] ? (T[])collection : collection.ToArray();\n int N = a.Length;\n for (int i = 0, p1 = 0, p2 = 1; i < N / 2; i++)\n {\n p1 += 3; if (p1 >= N) p1 -= N;\n p2 -= 7; if (p2 < 0) p2 += N;\n T t = a[p1]; a[p1] = a[p2]; a[p2] = t;\n }\n return a;\n }\n\n public static string AsString(this T[,] a, string separator)\n {\n var sb = new StringBuilder();\n int n0 = a.GetLength(0);\n int n1 = a.GetLength(1);\n for (int r = 0; r < n0; r++)\n {\n for (int c = 0; c < n1; c++)\n {\n if (c != 0) sb.Append(separator); sb.Append(a[r, c]);\n }\n sb.AppendLine();\n }\n //sb.AppendLine();\n return sb.ToString();\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; 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 == '-') { 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 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 class Writer\n {\n const int BufSize = 32000;\n char[] buf = new char[BufSize];\n int bufPos = 0;\n TextWriter output = Console.Out;\n Stack st = new Stack();\n\n public void Flush()\n {\n output.Write(buf, 0, bufPos); bufPos = 0;\n output.Flush();\n }\n\n void BufSpaceNeeded(int n)\n {\n if (n > BufSize) throw new ArgumentOutOfRangeException(\"n\");\n if (bufPos + n > BufSize) { output.Write(buf, 0, bufPos); bufPos = 0; }\n }\n\n public void Write(char a)\n {\n BufSpaceNeeded(1);\n buf[bufPos++] = a;\n }\n\n public void Write(string s)\n {\n int l = s.Length;\n for (int x = 0; x < l; )\n {\n int t = Math.Min(l - x, BufSize - bufPos);\n s.CopyTo(x, buf, bufPos, t); bufPos += t; x += t;\n if (x < l) BufSpaceNeeded(1); // force flush\n }\n }\n\n public void WriteLine()\n {\n BufSpaceNeeded(2);\n buf[bufPos++] = '\\r'; buf[bufPos++] = '\\n';\n }\n\n public void Write(object o) { Write(o.ToString()); }\n\n public void Write(uint a)\n {\n BufSpaceNeeded(10);\n do { st.Push((char)(a % 10 + 48)); a /= 10; } while (a != 0);\n while (st.Count != 0) buf[bufPos++] = st.Pop();\n }\n\n public void Write(ulong a)\n {\n BufSpaceNeeded(20);\n do { st.Push((char)(a % 10 + 48)); a /= 10; } while (a != 0);\n while (st.Count != 0) buf[bufPos++] = st.Pop();\n }\n\n public void Write(int a)\n {\n BufSpaceNeeded(11);\n if (a < 0) { buf[bufPos++] = '-'; a = -a; }\n Write((uint)a);\n }\n\n public void Write(long a)\n {\n BufSpaceNeeded(21);\n if (a < 0) { buf[bufPos++] = '-'; a = -a; }\n Write((ulong)a);\n }\n\n public void Write(double a, int digits)\n {\n Write(a.AsString(digits));\n }\n\n public void WriteLine(int a) { Write(a); WriteLine(); }\n public void WriteLine(long a) { Write(a); WriteLine(); }\n public void WriteLine(uint a) { Write(a); WriteLine(); }\n public void WriteLine(ulong a) { Write(a); WriteLine(); }\n public void WriteLine(string s) { Write(s); WriteLine(); }\n public void WriteLine(object o) { Write(o); WriteLine(); }\n }\n\n static void pe() { Console.WriteLine(\"???\"); Environment.Exit(0); }\n static void re() { throw new Exception(); }\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 static double Sqrt(double a) { return Math.Sqrt(a); }\n\n static StringBuilder sb = new StringBuilder();\n static Random rnd = new Random(5);\n\n #endregion Helpers\n\n const uint M = 1000000007;\n static uint[,] PROD = new uint[16, 16];\n\n static int h, w, k;\n static int wh1;\n static int predefined_colors;\n static int[] vertMasks;\n static uint result;\n static int[,] resultmap = new int[16, 16];\n\n static int[,] map;\n static int[] color_mapping_to, color_mapping_from;\n\n static uint DistinctMappingsCount(int from_count, int to_count)\n {\n if (from_count > to_count) throw new Exception();\n if (from_count < 0) throw new Exception();\n return /*k! / (k-max)! */ PROD[to_count - from_count + 1, to_count];\n }\n\n static void Per2(int y, int x, int vertmask)\n {\n if (y >= h)\n {\n var qwe = resultmap;\n\n uint t = 1;\n result += t;\n\n if (result >= M) result -= M;\n return;\n }\n\n int used = vertmask | vertMasks[x];\n for (int i = 1; i <= k; i++)\n if ((used >> i & 1) == 0)\n {\n int mc = map[y, x];\n if (mc != 0)\n {\n if (i != mc) continue;\n }\n\n vertMasks[x] |= (1 << i);\n resultmap[y, x] = i;\n if (x == w - 1) Per2(y + 1, 0, 0);\n else Per2(y, x + 1, used | (1 << i));\n resultmap[y, x] = 0;\n vertMasks[x] &= ~(1 << i);\n }\n }\n\n\n static void Per(int y, int x, int max, int vertmask)\n {\n var qwe = resultmap;\n\n if (y >= h)\n {\n if (max < wh1) throw new Exception();\n if (max > k) throw new Exception();\n // wh1 <= max <= k\n\n //result += DistinctMappingsCount(max, k);\n\n if (k < predefined_colors) throw new Exception();\n if (max < predefined_colors) throw new Exception();\n uint t = DistinctMappingsCount(max - predefined_colors, k - predefined_colors);\n result += t;\n\n if (result >= M) result -= M;\n return;\n }\n\n int used = vertmask | vertMasks[x];\n for (int i = 1; i <= max + 1; i++)\n if (i <= k)\n if ((used >> i & 1) == 0)\n {\n int mc = map[y, x];\n bool mapping = false;\n\n if (mc != 0)\n {\n if (color_mapping_from[mc] == 0 && color_mapping_to[i] == 0)\n {\n mapping = true;\n color_mapping_from[mc] = i;\n color_mapping_to[i] = mc;\n }\n else if (color_mapping_from[mc] == 0 && color_mapping_to[i] != 0)\n {\n continue; // color i already mapped to other color\n }\n else if (color_mapping_from[mc] != 0 && color_mapping_to[i] == 0)\n {\n continue; // color mc already mapped from other color\n }\n else if (color_mapping_from[mc] != 0 && color_mapping_to[i] != 0)\n {\n }\n }\n\n vertMasks[x] |= (1 << i);\n resultmap[y, x] = i;\n if (x == w - 1) Per(y + 1, 0, Math.Max(i, max), 0);\n else Per(y, x + 1, Math.Max(i, max), used | (1 << i));\n resultmap[y, x] = 0;\n vertMasks[x] &= ~(1 << i);\n\n if (mapping)\n {\n color_mapping_to[i] = 0;\n color_mapping_from[mc] = 0;\n }\n\n }\n }\n\n static void Main()\n {\n checked\n {\n#if !ONLINE_JUDGE\n Console.SetIn(File.OpenText(\"_input\"));\n#endif\n //Console.SetOut(File.CreateText(\"_output\"));\n var parser = new Parser();\n var o = new Writer();\n try\n {\n for (uint i = 0; i < 16; i++)\n for (uint j = 0; j < 16; j++)\n {\n if (j + 1 < i) PROD[i, j] = 0;\n else if (j < i) PROD[i, j] = 1;\n else if (j == i) PROD[i, j] = i;\n else PROD[i, j] = (uint)(PROD[i, j - 1] * (ulong)j % M);\n }\n\n while (!parser.SeekEOF)\n {\n h = parser.ReadInt();\n w = parser.ReadInt();\n k = parser.ReadInt();\n wh1 = w + h - 1;\n\n map = new int[16, 16];\n\n for (int y = 0; y < h; y++)\n for (int x = 0; x < w; x++)\n if (y < 16 && x < 16) map[y, x] = parser.ReadInt();\n else parser.ReadInt();\n\n //var mapping = new int[16];\n //for (int y = 0; y < h; y++)\n // for (int x = 0; x < w; x++)\n // {\n // for (int color = 1; ; color++)\n // {\n // for (int y = 0; y < h; y++)\n // for (int x = 0; x < w; x++) { }\n // }\n // }\n\n result = 0;\n if (wh1 > k)\n {\n }\n else\n {\n predefined_colors = map.Cast().Where(c => c != 0).Distinct().Count();\n color_mapping_from = new int[16];\n color_mapping_to = new int[16];\n vertMasks = new int[16];\n Per(0, 0, 0, 0);\n //o.WriteLine(result); result = 0;\n\n //color_mapping_from = new int[16];\n //color_mapping_to = new int[16];\n //vertMasks = new int[16];\n //Per2(0, 0, 0);\n }\n\n o.WriteLine(result);\n }\n }\n finally\n {\n o.Flush();\n }\n }\n }\n\n //static void Main()\n //{\n // new Thread(Main2, 50 << 20).Start();\n //}\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2de4338d4be1a299d3487478bff3e1c4", "src_uid": "5bb21f49d976cfa16a239593a95c53b5", "difficulty": 2700.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 ConsoleApp2\n{\n class Program\n {\n static long NOD(long a, long b)\n {\n if (b == 0)\n return a;\n return NOD(b, a % b);\n }\n static void Main(string[] args)\n {\n long X = long.Parse(Console.ReadLine());\n long min = X;\n for(int i = 2; (long)i*i <= X; i++)\n {\n if (X % i == 0)\n {\n long a = i;\n long b = X / a;\n if (NOD(a, b) == 1)\n {\n min = b;\n }\n }\n if (i == 1000000)\n Console.WriteLine(1);\n }\n Console.WriteLine($\"{X/min} {min}\"); \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6557eafb81da7e1d47c6e583720b7cae", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Day_23\n{\n class Program\n {\n static Int64 gcd(Int64 a, Int64 b)\n {\n if (a == 0)\n return b;\n return gcd(b % a, a);\n }\n static Int64 lcm(Int64 a, Int64 b)\n {\n return (a * b) / gcd(a, b);\n }\n static void Main(string[] args)\n {\n Int64 X = Convert.ToInt64(Console.ReadLine());\n if (X == 1)\n {\n Console.WriteLine(\"1 1\");\n return;\n }\n SortedDictionary keyValuePairs = new SortedDictionary();\n Int64 last_added = 1;\n\n List banned_primes = new List();\n if (X % 2 != 0) banned_primes.Add(2);\n if (X % 3 != 0) banned_primes.Add(3);\n if (X % 5 != 0) banned_primes.Add(5);\n if (X % 7 != 0) banned_primes.Add(7);\n\n keyValuePairs.Add(1, X);\n for (Int64 i = 2; i < 10; i++)\n {\n bool found = false;\n foreach (int ix in banned_primes)\n {\n if (i % ix == 0)\n {\n found = true;\n break;\n }\n }\n if (found) continue;\n\n while (i <= X)\n {\n if (X % i == 0)\n {\n if (keyValuePairs.ContainsKey(i) || keyValuePairs.ContainsKey(X / i))\n {\n i += i;\n continue;\n }\n else\n {\n if (lcm(i, X / i) == X)\n {\n keyValuePairs.Add(i, X / i);\n last_added = i;\n }\n }\n }\n i += i;\n }\n }\n Console.WriteLine($\"{last_added} {keyValuePairs[last_added]}\");\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "5b4c2c741705b0654603265720176aa7", "src_uid": "e504a04cefef3da093573f9df711bcea", "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.IO;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static long NOD(long a, long b)\n {\n if (b == 0)\n return a;\n return NOD(b, a % b);\n }\n static void Main(string[] args)\n {\n long X = long.Parse(Console.ReadLine());\n long min = X;\n for(int i = 2; (long)i*i <= X; i++)\n {\n if (X % i == 0)\n {\n long a = i;\n long b = X / a;\n if (NOD(a, b) == 1)\n {\n min = b;\n }\n }\n }\n Console.WriteLine($\"{X/min} {min}\"); \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "74c91623358079c0a9b1414dfa40b9cb", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.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;\nnamespace Zadanie_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n BigInteger ansa = new BigInteger(1e18);\n BigInteger ansb = new BigInteger(1e18);\n BigInteger[] mass = new BigInteger[0];//\u0412\u0435\u043a\u0442\u043e\u0440, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0432\u0435\u043a\u0442\u043e\u0440, \u0430 \u043b\u0438\u0448\u044c \u0436\u0430\u043b\u043a\u0430\u044f \u043a\u043e\u043f\u0438\u044f\n int X = Convert.ToInt32(Console.ReadLine());\n for(int i = 2; i * i <= X; i++)\n {\n if (X % i == 0)\n {\n BigInteger cur = new BigInteger(1);\n while (X % i == 0)\n {\n X /= i;\n cur *= i;\n }\n Array.Resize(ref mass, mass.Length + 1);\n mass[mass.Length - 1] = cur;\n }\n }\n if(X > 1)\n {\n Array.Resize(ref mass, mass.Length + 1);\n mass[mass.Length - 1] = X;\n }\n for(int i = 0; i < (1 << mass.Length); i++)\n {\n BigInteger a = new BigInteger(1);\n BigInteger b = new BigInteger(1);\n for(int j = 0; j < mass.Length; j++)\n {\n if (((i >> j) & 1)>0) a *= mass[j];\n else b *= mass[j];\n }\n if (Math.Max((double)a, (double)b) < Math.Max((double)ansa, (double)ansb))\n {\n ansa = a;\n ansb = b;\n }\n }\n Console.WriteLine(ansa + \" \" + ansb);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9dd2c9777b10ee7042b17ee89e0394d4", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.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;\nnamespace Zadanie_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n BigInteger ansa = new BigInteger(1e18);\n BigInteger ansb = new BigInteger(1e18);\n BigInteger[] mass = new BigInteger[0];//\u0412\u0435\u043a\u0442\u043e\u0440, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0432\u0435\u043a\u0442\u043e\u0440, \u0430 \u043b\u0438\u0448\u044c \u0436\u0430\u043b\u043a\u0430\u044f \u043a\u043e\u043f\u0438\u044f\n int X = Convert.ToInt32(Console.ReadLine());\n for(int i = 2; i * i <= X; i++)\n {\n if (X % i == 0)\n {\n BigInteger cur = new BigInteger(1);\n while (X % i == 0)\n {\n X /= i;\n cur *= i;\n }\n Array.Resize(ref mass, mass.Length + 1);\n mass[mass.Length - 1] = cur;\n }\n }\n if(X > 1)\n {\n Array.Resize(ref mass, mass.Length + 1);\n mass[mass.Length - 1] = X;\n }\n for(int i = 0; i < (1 << mass.Length); i++)\n {\n BigInteger a = new BigInteger(1);\n BigInteger b = new BigInteger(1);\n for(int j = 0; j < mass.Length; j++)\n {\n if (((i >> j) & 1)>0) a *= mass[j];\n else b *= mass[j];\n }\n if (Math.Max((double)a, (double)b) < Math.Max((double)ansa, (double)ansb))\n {\n ansa = a;\n ansb = b;\n }\n }\n Console.WriteLine(ansa + \" \" + ansb);\n Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "70595ff8e6f1ac1cee7d2717c9c55c15", "src_uid": "e504a04cefef3da093573f9df711bcea", "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 test\n{\n class Program\n {\n static void Main(string[] args)\n {\n double ansa = 1e18;\n double ansb = 1e18;\n double[] mass = new double[0];\n double X = Convert.ToDouble(Console.ReadLine());\n for (long i = 2; i * i <= X; i++)\n {\n if (X % i == 0)\n {\n double cur = 1;\n while (X % i == 0)\n {\n X /= i;\n cur *= i;\n }\n Array.Resize(ref mass, mass.Length + 1);\n mass[mass.Length - 1] = cur;\n }\n //Console.WriteLine(\"Ya rabotau\" + DateTime.Now);\n }\n if (X > 1)\n {\n Array.Resize(ref mass, mass.Length + 1);\n mass[mass.Length - 1] = X;\n }\n for (int i = 0; i < (1 * Math.Pow(2, mass.Length); i++)\n {\n double a = 1;\n double b = 1;\n for (int j = 0; j < mass.Length; j++)\n {\n if (((i >> j) & 1) > 0) a *= mass[j];\n else b *= mass[j];\n }\n if (Math.Max(a, b) < Math.Max(ansa, ansb))\n {\n ansa = a;\n ansb = b;\n }\n }\n Console.WriteLine(ansa + \" \" + ansb);\n //Console.ReadKey();\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": true, "code_uid": "7d981849d3bfffc5466727693e19a6ca", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.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 w = sc.Long();\n var m = sc.Long();\n \n if (w <= 3 || m == 1 || ok(m, w))\n IO.Printer.Out.WriteLine(\"YES\");\n else IO.Printer.Out.WriteLine(\"NO\");\n\n }\n public bool ok(long m, long w)\n {\n if (m == 0) return true;\n long sum = 0;\n for (long i = 1; true; i *= w)\n {\n var min = i - sum;\n var max = i + sum;\n if (m < min) return false;\n else if (min <= m && m <= max)\n return ok(Math.Abs(m - i), w);\n sum += i;\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", "lang_cluster": "C#", "compilation_error": false, "code_uid": "cd2a4f3b0a0e3308fc0f1a246320d7b1", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "using System;\n\nnamespace TaskC\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ', '\\t');\n int w = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n\n Console.WriteLine(Check(w, m) ? \"YES\" : \"NO\");\n }\n\n private static bool Check(int w, int m, bool first = true)\n {\n if (m == 0)\n return true;\n if (m % w == 0)\n return Check(w, m / w);\n return first && (Check(w, m - 1, false) || Check(w, m + 1, false));\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3436e801a44d94bfc359b96647b99b5c", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "difficulty": 1900.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 _308c\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 w = d[0];\n var m = d[1];\n var val = new int[101];\n var i = 1;\n while (true)\n {\n if (m == 0)\n {\n break;\n }\n\n var rem = m % w;\n val[i] = rem;\n i++;\n m /= w;\n }\n\n var av = new bool[101];\n for (int j = 1; j < 101; j++)\n {\n av[j] = true;\n }\n\n for (int j = 1; j < 101; j++)\n {\n if (val[j] == 0 || val[j] == 1)\n {\n continue;\n }\n\n if (val[j] < w - 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if (val[j] == w - 2)\n {\n if (j == 100)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if (!av[j - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n av[j - 1] = false;\n av[j] = false;\n val[j + 1]++;\n }\n\n if (val[j] == w - 1)\n {\n if (j == 100)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n av[j] = false;\n val[j + 1]++;\n }\n }\n\n Console.WriteLine(\"YES\");\n\n //for (int j = 1; j < 101; j++)\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": "11655ed7610a0dc205c5bf6470ea25c1", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "difficulty": 1900.0} {"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": "6b1d1d213bc651d87f75a8447a053040", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _976B\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n long n = long.Parse(tokens[0]);\n long m = long.Parse(tokens[1]);\n long k = long.Parse(tokens[2]);\n\n if (k < n)\n {\n Console.WriteLine($\"{1 + k} 1\");\n }\n else\n {\n k -= n;\n m--;\n\n long row = n - k / m;\n long column = (n - row) % 2 == 0 ? 2 + k % m : m + 1 - k % m;\n\n Console.WriteLine($\"{row} {column}\");\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "8ccb6e5a042baab1e0091940f0618e20", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300.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 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\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": false, "code_uid": "1d066819054807eca13d8cbc82e04539", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string[] arr = Console.ReadLine().Trim().Split();\n int n = int.Parse(arr[0]);\n int t = int.Parse(arr[2]);\n double p = double.Parse(arr[1]);\n double[,] dp = new double[t + 1, n + 1];\n \n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "44c5c38ce8062a1fa8313806bf1752ef", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Ilya_and_Escalator\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private 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 t = int.Parse(ss[2]);\n double p = double.Parse(ss[1], CultureInfo.InvariantCulture);\n double q = 1 - p;\n var nn = new double[n + 1];\n nn[0] = 1;\n\n for (int i = 0; i < t; i++)\n {\n nn[n] += p*nn[n - 1];\n\n for (int j = n - 1; j > 0; j--)\n {\n nn[j] = q*nn[j] + p*nn[j - 1];\n }\n\n nn[0] *= q;\n }\n\n double sum = 0;\n\n for (int i = 1; i <= n; i++)\n {\n sum += i*nn[i];\n }\n\n writer.WriteLine(sum.ToString(\"#0.0000000\", CultureInfo.InvariantCulture));\n writer.Flush();\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c1b99ceabec1fab24587785801d899ba", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Linq;\nusing System.Globalization;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string[] arr = Console.ReadLine().Trim().Split();\n int n = int.Parse(arr[0]);\n int t = int.Parse(arr[2]);\n double p = double.Parse(arr[1],CultureInfo.InvariantCulture);\n double[,] dp = new double[t + 1, n + 1];\n dp[1, 0] = (double)1 - p;\n dp[1, 1] = p;\n for (int i = 2; i <= t; i++)\n {\n for (int j = 0; j <= n; j++)\n {\n //if this guy is not goes\n double p1 = dp[i - 1, j] * ((double)1 - p);\n if (j - 1 >= 0)\n {\n p1 += dp[i - 1, j - 1] * p;\n }\n dp[i, j] += p1;\n }\n }\n double expected = 0; //\n for (int i = 1; i <= n; i++)\n {\n expected += dp[t, i] * i;\n }\n Console.WriteLine(string.Format(CultureInfo.InvariantCulture, \"{0:0.000000000000}\", expected));\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "fa946ecd2d8fcf31253e74811ea75d61", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "difficulty": 1700.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 ed32e\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n\n var d = readIntArray();\n var n = d[0];\n var m = d[1];\n var a = readIntArray();\n\n var fh = n / 2;\n if (n % 2 == 1)\n {\n fh++;\n }\n var sh = n / 2;\n\n var mv = 0;\n for (int i = 0; i < fh; i++)\n {\n mv &= 1 << i;\n }\n\n var arr = new long[mv + 1];\n for (int i = 0; i <= mv; i++)\n {\n arr[i] = sum(i, a, m, 0);\n }\n\n Array.Sort(arr);\n var max = arr[arr.Length - 1];\n\n\n var sm = 0;\n //for (int i = mv; i < n; i++)\n //{\n // sm &= 1 << i;\n //}\n\n for (int i = 0; i <= sh; i++)\n {\n sm &= 1 << i;\n }\n\n //var smin = mv + 1;\n var res = long.MinValue;\n for (int i = 0; i <= sm; i++)\n {\n var val = sum(i, a, m, mv + 1);\n var nr = (val + max) % m;\n if (nr > res)\n {\n res = nr;\n }\n\n var req = m - val - 1;\n if (req <= 0)\n {\n continue;\n }\n\n var l = 0;\n var r = arr.Length - 1;\n while (true)\n {\n if (l == r)\n {\n break;\n }\n\n var mid = l + (r - l + 1) / 2;\n var vv = arr[mid];\n if (vv <= req)\n {\n l = mid;\n }\n else\n {\n r = mid - 1;\n }\n }\n\n if (arr[l] <= req)\n {\n if (val + arr[l] > res)\n {\n res = val + arr[l];\n }\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 long sum(int pattern, int[] a, int m, int start)\n {\n var res = 0;\n for (int i = 0; i < 20; i++)\n {\n if ((pattern & (1 << i)) != 0)\n {\n res += a[i + start];\n res %= m;\n }\n }\n\n return res;\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\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": "1cb9ee9eb5c08853359cb17d7630e0a5", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.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, M;\n sc.Make(out N, out M);\n var A = sc.ArrInt;\n var L = Create(2, () => new HashSet());\n for(int k = 0; k < 2; k++)\n {\n int[] a;\n if (k == 0) a = A.Take(N / 2).ToArray();\n else a = A.Skip(N / 2).ToArray();\n for(int j = 0; j < (1 << a.Length); j++)\n {\n var sum = 0;\n for (int l = 0; l < a.Length; l++)\n if ((1 & j >> l) == 1) { sum += a[l]; if (sum >= M) sum -= M; }\n L[k].Add(sum);\n }\n }\n var dat = Create(2, id => {\n var r = new int[L[id].Count];\n var now = 0;\n foreach (var d in L[id]) r[now++] = d;\n Array.Sort(r);\n return r;\n });\n var max = 0;\n var idx = 0;\n for(int i = 0; i < dat[0].Length; i++)\n {\n while ((dat[1][(idx + 1) % dat[1].Length] + dat[0][i]) % M > (dat[1][idx] + dat[0][i]) % M)\n {\n idx++;if (idx >= dat[1].Length) idx -= dat[1].Length;\n }\n chmax(ref max, (dat[1][idx] + dat[0][i]) % M);\n }\n Console.WriteLine(max);\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": "462160b2f2e235d336e11d648bef7108", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.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 ed32e\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n\n var d = readIntArray();\n var n = d[0];\n var m = d[1];\n var a = readIntArray();\n\n var fh = n / 2;\n if (n % 2 == 1)\n {\n fh++;\n }\n var sh = n / 2;\n\n var mv = 0;\n for (int i = 0; i < fh; i++)\n {\n mv |= 1 << i;\n }\n\n var arr = new long[mv + 1];\n for (int i = 0; i <= mv; i++)\n {\n arr[i] = sum(i, a, m, 0);\n }\n\n Array.Sort(arr);\n var max = arr[arr.Length - 1];\n\n\n var sm = 0;\n //for (int i = mv; i < n; i++)\n //{\n // sm &= 1 << i;\n //}\n\n for (int i = 0; i < sh; i++)\n {\n sm |= 1 << i;\n }\n\n //var smin = mv + 1;\n var res = long.MinValue;\n for (int i = 0; i <= sm; i++)\n {\n var val = sum(i, a, m, fh);\n var nr = (val + max) % m;\n if (nr > res)\n {\n res = nr;\n }\n\n var req = m - val - 1;\n //if (req <= 0)\n //{\n // continue;\n //}\n\n var l = 0;\n var r = arr.Length - 1;\n while (true)\n {\n if (l == r)\n {\n break;\n }\n\n var mid = l + (r - l + 1) / 2;\n var vv = arr[mid];\n if (vv <= req)\n {\n l = mid;\n }\n else\n {\n r = mid - 1;\n }\n }\n\n if (arr[l] <= req)\n {\n if (val + arr[l] > res)\n {\n res = val + arr[l];\n }\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 long sum(int pattern, int[] a, int m, int start)\n {\n var res = 0;\n for (int i = 0; i < 20; i++)\n {\n if ((pattern & (1 << i)) != 0)\n {\n res += a[i + start];\n res %= m;\n }\n }\n\n return res;\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\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": "7b6b1d35db9595b0de2ebf2ed87493e7", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "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 \u043f\u043e\u043a\u0443\u043f\u043a\u0430_\u0442\u0435\u043b\u0435\u0432\u0438\u0437\u043e\u0440\u0430\n{\n class Program\n {\n static long Nod(long a, long b)\n {\n if(a= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n long a,b,x,y;\n\n long cmmdc(long a, long b)\n {\n while(b!=0)\n {\n long t = b;\n b = a % b;\n a = t;\n }\n\n return a;\n }\n\n public void Solve()\n {\n a = long.Parse(ioHelper.ReadNextToken());\n b = long.Parse(ioHelper.ReadNextToken());\n x = long.Parse(ioHelper.ReadNextToken());\n y = long.Parse(ioHelper.ReadNextToken());\n\n\n long cmm = cmmdc(x, y);\n x /= cmm;\n y /= cmm;\n\n long mulX = a / x;\n long mulY = b / y;\n\n long res = Math.Min(mulX, mulY);\n\n ioHelper.WriteLine(res.ToString());\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "e14470d76abe38f6ae0b4dff5de5178b", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "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 C\n {\n private static ThreadStart s_threadStart = new C().Go;\n\n private void Go()\n {\n int N = GetInt();\n List data = GetIntArr(N);\n\n int[,] dp = new int[N, 2];\n dp[N - 1, 0] = data[N - 1];\n dp[N - 1, 1] = 0;\n for (int i = N-2; i >= 0; i--)\n {\n if (dp[i + 1, 0] < data[i] + dp[i + 1, 1])\n {\n dp[i, 0] = data[i] + dp[i + 1, 1];\n dp[i, 1] = dp[i + 1, 0];\n }\n else\n {\n dp[i, 1] = data[i] + dp[i + 1, 1];\n dp[i, 0] = dp[i + 1, 0];\n }\n }\n\n Wl(dp[0, 1] + \" \" + dp[0, 0]);\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": "22d2d1a34bf172f7fcd9d87e984a6767", "src_uid": "414540223db9d4cfcec6a973179a0216", "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;\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": "1fdab924abc49613d469fda27f4380da", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "difficulty": 2200.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 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 if (len == 2) return 2;\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 //Console.WriteLine(len + \" \" + fun(ref p));\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) 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": "d2e2383dd448c9eb195d1e2df39d6c60", "src_uid": "0e22093668319217b7946e62afe32195", "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 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 var N = sc.Int;\n dp = Create(N + 1, () => new ModInt[1 << 20]);\n use = Create(N + 1, () => new bool[1 << 20]);\n\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 var rt = 0;\n if (i == N)\n {\n if (ct != 0 && (1 << ct) - 1 == s) return 1;\n return 0;\n }\n\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": "eeb4209b1e831f62c6a0f4de3d7e28f5", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "difficulty": 2200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Globalization;\nusing System.Diagnostics;\n\nclass Myon\n{\n static Scanner cin;\n public Myon() { }\n public static int Main()\n {\n //Console.SetOut(new Printer(Console.OpenStandardOutput()));\n cin = new Scanner();\n new Myon().calc();\n return 0;\n }\n\n int ans;\n\n List[] es;\n int h;\n\n public void calc2()\n {\n ans = -1;\n qnum = 0;\n h = cin.nextInt();\n es = new List[1 << h];\n int fq = 0;\n getQuestion(fq);\n if (es[fq].Count != 2)\n {\n if (es[fq].Count == 3)\n {\n //2\u3064\u8a66\u3059\n int LenA = getLength(es[fq][0], fq);\n int LenB = getLength(es[fq][1], fq);\n int start = fq;\n if (LenA < LenB)\n {\n start = getStep(es[fq][1], fq, (LenB - LenA) / 2 - 1);\n }\n if (LenB < LenA)\n {\n start = getStep(es[fq][0], fq, (LenA - LenB) / 2 - 1);\n }\n int height = (LenB + LenA) / 2 + 1;\n\n if (es[start].Count != 2)\n {\n foreach (var item in es[start])\n {\n if (es[item] != null) continue;\n getNext(height + 1, item, start);\n break;\n }\n }\n\n }\n else\n {\n getNext(2, es[fq][0], fq);\n }\n }\n Console.WriteLine(\"! {0}\", ans + 1);\n }\n\n bool debug = false;\n\n void getNext(int nowHeight, int a, int pre)\n {\n if(debug) Console.WriteLine(\"Now Checking... \" + nowHeight + \" \" + a + \" \" + pre);\n getQuestion(a);\n if (ans != -1) return;\n if (nowHeight == h) return;\n if(nowHeight == h - 1 && !debug)\n {\n if(debug) Console.WriteLine(\"Find -1 Mode\");\n foreach (var item in es[a])\n {\n getQuestion(item);\n if (ans != -1) return;\n }\n return;\n }\n if (nowHeight == h - 2 && !debug)\n {\n if (debug) Console.WriteLine(\"Find -2 Mode\");\n foreach (var item in es[a])\n {\n if (item != pre)\n {\n getQuestion(item);\n if (ans != -1) return;\n foreach (var i2 in es[item])\n {\n if (i2 != a) getQuestion(i2);\n if (ans != -1) return;\n }\n }\n }\n return;\n }\n\n foreach (var item in es[a])\n {\n if (item == pre) continue;\n int nextLen = getLength(item, a);\n int preLen = nowHeight - 1;\n int nextStart = getStep(a, pre, (nextLen - preLen) / 2);\n int nextHeight = (preLen + nextLen) / 2 + 1;\n if (es[nextStart].Count == 2) return;\n\n\n int nextA = -1;\n foreach (var i2 in es[nextStart])\n {\n if(es[i2] == null)\n {\n nextA = i2;\n }\n }\n\n if (debug)\n {\n Console.WriteLine(\"NextStart:{0} NextHeight:{1} nextLen:{2} preLen:{3}, nextA:{4}\", nextStart, nextHeight, nextLen, preLen, nextA);\n }\n\n getNext(nextHeight + 1, nextA, nextStart);\n return;\n }\n }\n \n\n int getStep(int a, int ng, int step)\n {\n if (step == 0) return a;\n foreach (var item in es[a])\n {\n if (item != ng && es[item] != null) return getStep(item, a, step - 1);\n }\n return -1;\n }\n\n int getLength(int a, int ng)\n {\n getQuestion(a);\n if (es[a].Count == 2) return h;\n if (es[a].Count == 1) return 1;\n foreach (var item in es[a])\n {\n if(item != ng)\n {\n return getLength(item, a) + 1;\n }\n }\n return -1;\n }\n\n\n int qnum = 0;\n List getQuestion(int a)\n {\n if (es[a] != null) return es[a];\n List l = new List();\n if(qnum >= 16)\n {\n l.Add(-1);\n l.Add(-1);\n ans = a;\n return es[a] = l;\n }\n Console.WriteLine(\"? {0}\", a + 1);\n qnum++;\n int num = cin.nextInt();\n for (int i = 0; i < num; i++)\n {\n l.Add(cin.nextInt() - 1);\n }\n if (num == 2)\n {\n ans = a;\n }\n return es[a] = l;\n }\n \n\n public void calc()\n {\n int T = cin.nextInt();\n for (int i = 0; i < T; i++)\n {\n calc2();\n }\n }\n\n}\n\nclass Printer : StreamWriter\n{\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { }\n}\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n while (i >= s.Length)\n {\n string st = Console.ReadLine();\n while (st == \"\") st = Console.ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n }\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n public double nextDouble()\n {\n return double.Parse(next());\n }\n\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "624a4bbce2d5f163b1cba3b60871920f", "src_uid": "5c0db518fa326b1e405479313216426a", "difficulty": 2800.0} {"lang": "MS C#", "source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Numerics;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n\n /* Iterative Function to calculate (x^y)%p in O(log y) */\n static long power(long x, long y, long p)\n {\n long res = 1; // Initialize result\n\n x = x % p; // Update x if it is more than or \n // equal to p\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if ((y & 1) != 0)\n res = (res * x) % p;\n\n // y must be even now\n y = y >> 1; // y = y/2\n x = (x * x) % p;\n }\n return res;\n }\n static void program(TextReader input)\n {\n var data = input.ReadLine().Split(' ').Select(BigInteger.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n var res = a / b;\n var s = res.ToString();\n var s2 = c.ToString();\n var added = 0;\n long h = (long)Math.Floor(((double.Parse(b.ToString()) - 1.0)/ double.Parse(data[0].ToString())))/10;\n while(h > 0)\n {\n added++;\n h /= 10;\n }\n if(added != 0 && c == 0)\n {\n writer.WriteLine(1);\n writer.Flush();\n return;\n }\n var lastZero = s.Length;\n for (var i = s.Length-1; i >= 0; i--)\n {\n if (s[i] != '0')\n {\n break;\n }\n lastZero = i;\n }\n for (var i = 0; i < s.Length; i++)\n {\n if(lastZero ==i && s2 == \"0\")\n {\n break;\n }\n if(s[i].ToString() == s2)\n {\n writer.WriteLine(added + i + 1);\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(-1);\n writer.Flush();\n \n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"4 2 1\\n1 3 5 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"4\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"4 2 0\\n5 3 1 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"25\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"5 3 1\\n3 3 3 3 3\\n\"));\n Console.WriteLine();\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "150d8dbb0a47e8f2c1912c25bb9f8d4f", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0} {"lang": "MS 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;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n\n /* Iterative Function to calculate (x^y)%p in O(log y) */\n static long power(long x, long y, long p)\n {\n long res = 1; // Initialize result\n\n x = x % p; // Update x if it is more than or \n // equal to p\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if ((y & 1) != 0)\n res = (res * x) % p;\n\n // y must be even now\n y = y >> 1; // y = y/2\n x = (x * x) % p;\n }\n return res;\n }\n static void program(TextReader input)\n {\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n a *= 10000000000000;\n var res = a / b;\n var s = res.ToString();\n var s2 = c.ToString();\n for(var i = 0; i < s.Length; i++)\n {\n if(s[i].ToString() == s2)\n {\n writer.WriteLine(i + 1);\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(-1);\n writer.Flush();\n \n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"4 2 1\\n1 3 5 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"4\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"4 2 0\\n5 3 1 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"25\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"5 3 1\\n3 3 3 3 3\\n\"));\n Console.WriteLine();\n\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "32ed0a2c21af6f7394fa7713e5701c86", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0} {"lang": "MS C#", "source_code": "using 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 Array53\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 mod = 1000000007;\n if (n == 1)\n {\n writer.WriteLine(1);\n return;\n }\n long ans = (FactorialMod(2 * n - 1, mod) * 1L * BinPowMod((FactorialMod(n - 1, mod) * 1L * FactorialMod(n, mod)) % mod, mod - 2, mod)) % mod;\n writer.WriteLine((ans * 2 - n) % mod);\n }\n }\n\n public static int FactorialMod(int n, int mod)\n {\n long res = 1;\n while (n > 0)\n {\n for (int i = 2, m = n % mod; i <= m; i++)\n res = (res * i) % mod;\n if ((n /= mod) % 2 > 0)\n res = mod - res;\n }\n return (int)res;\n }\n\n public static long BinPowMod(long a, long p, long mod)\n {\n if (p == 0) return 1;\n if ((p & 1) == 0)\n {\n long t = BinPowMod(a, p / 2, mod);\n return (t * t) % mod;\n }\n else\n {\n return (a % mod * BinPowMod(a, p - 1, mod)) % mod;\n }\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "aefae71fad4fc94ebcb9a7e6fb553fec", "src_uid": "13a9ffe5acaa79d97df88a069fc520b9", "difficulty": 1900.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 static bool can(int a, int b)\n {\n if(b==3)\n {\n return (a==1||a==2||a==4||a==5);\n }\n if (b % 2 == 0)\n {\n int mod = a % 4;\n if (mod > 0) return false;\n int div = a / 4;\n int can = (((b - 1) / 2) * ((b - 1) / 2) + 1) / 2;\n return div <= can;\n }\n else\n {\n if (a % 2 == 1)\n {\n a--;\n }\n int can4 = (((b - 1) / 2) * ((b - 1) / 2) + 1) / 2;\n int can2 = b / 2 / 2 * 2;\n if (a % 4 == 2)\n {\n if (can2 > 0)\n {\n can2--;\n a -= 2;\n }\n else return false;\n }\n can4 += can2 / 2;\n return a <= can4*4;\n }\n }\n static void Main(string[] args)\n {\n int x;\n x = int.Parse(Console.ReadLine());\n for (int i = 1; i <= 100; i++)\n {\n if (can(x, i))\n {\n Console.WriteLine(i.ToString());\n break;\n }\n }\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "7fd797cac67b17b98dca3db114c3c999", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "difficulty": 1700.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 static bool can(int a, int b)\n {\n if (b % 2 == 0)\n {\n int mod = a % 4;\n if (mod > 0) return false;\n int div = a / 4;\n int can = (((b - 1) / 2) * ((b - 1) / 2) + 1) / 2;\n return div <= can;\n }\n else\n {\n if (a % 2 == 1) a--;\n int can4 = (((b - 1) / 2) * ((b - 1) / 2) + 1) / 2;\n int can2 = b / 2 / 2 * 2;\n if (a % 4 == 2)\n {\n if (can2 > 0)\n {\n can2--;\n a -= 2;\n }\n else return false;\n }\n can4 += can2 / 2;\n return a <= can4*4;\n }\n }\n static void Main(string[] args)\n {\n int x;\n x = int.Parse(Console.ReadLine());\n for (int i = 1; i <= 100; i++)\n {\n if (can(x, i))\n {\n Console.WriteLine(i.ToString());\n break;\n }\n }\n \n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c174391f575d6ba88fd6f4a01c380a55", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "difficulty": 1700.0} {"lang": "MS C#", "source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var k = sr.NextInt32();\n var m = sr.NextInt64();\n var array = sr.ReadArrayOfInt64();\n Array.Sort(array);\n var answ1 = Answ1(array, m, n);\n var answ2 = 0L;\n var m2 = m;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m2 - array[j] >= 0) {\n m2 -= array[j];\n answ2++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ2++;\n }\n }\n var answ3 = 0L;\n var m3 = m;\n var resultAnsw = 0L;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m3 - array[j] >= 0) {\n m3 -= array[j];\n answ3++;\n if (j + 1 == k) {\n answ3++;\n }\n }\n var answ4 = answ3 + Answ1(array, m3, n - (i + 1));\n resultAnsw = Math.Max(resultAnsw, Math.Max(answ3, answ4));\n }\n }\n\n sw.WriteLine(Math.Max(answ1, Math.Max(answ2, resultAnsw)));\n }\n\n private long Answ1(long[] array, long m, int n)\n {\n var answ1 = 0L;\n var m1 = m;\n for (var i = 0; i < array.Length; i++) {\n if (m1 - array[i] * n >= 0) {\n m1 -= array[i] * n;\n answ1 += n;\n if (i == array.Length - 1) {\n answ1 += n;\n }\n }\n else {\n var d = m1 / array[i];\n m1 -= d * array[i];\n answ1 += d;\n if (i == array.Length - 1) {\n answ1 += d;\n }\n break;\n }\n }\n\n return answ1;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "6b5c4dff14304421074f34ba59e36899", "src_uid": "d659e92a410c1bc836be64fc1c0db160", "difficulty": 1800.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace Test\r\n{\r\n class IOHelper : IDisposable\r\n {\r\n StreamReader reader;\r\n StreamWriter writer;\r\n\r\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\r\n {\r\n StreamReader iReader;\r\n StreamWriter oWriter;\r\n if (inputFile == null)\r\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\r\n else\r\n iReader = new StreamReader(inputFile, encoding);\r\n\r\n if (outputFile == null)\r\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\r\n else\r\n oWriter = new StreamWriter(outputFile, false, encoding);\r\n\r\n reader = iReader;\r\n writer = oWriter;\r\n\r\n curLine = new string[] { };\r\n curTokenIdx = 0;\r\n }\r\n\r\n\r\n string[] curLine;\r\n int curTokenIdx;\r\n\r\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\r\n\r\n public string ReadNextToken()\r\n {\r\n if (curTokenIdx >= curLine.Length)\r\n {\r\n //Read next line\r\n string line = reader.ReadLine();\r\n if (line != null)\r\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\r\n else\r\n curLine = new string[] { };\r\n curTokenIdx = 0;\r\n }\r\n\r\n if (curTokenIdx >= curLine.Length)\r\n return null;\r\n\r\n return curLine[curTokenIdx++];\r\n }\r\n\r\n public int ReadNextInt()\r\n {\r\n return int.Parse(ReadNextToken());\r\n }\r\n\r\n public double ReadNextDouble()\r\n {\r\n var nextToken = ReadNextToken();\r\n var result = 0.0;\r\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\r\n result = double.Parse(nextToken);\r\n return result;\r\n }\r\n\r\n public void Write(string stringToWrite)\r\n {\r\n writer.Write(stringToWrite);\r\n }\r\n\r\n public void WriteLine(string stringToWrite)\r\n {\r\n writer.WriteLine(stringToWrite);\r\n }\r\n\r\n public void WriteLine(double valueToWrite)\r\n {\r\n writer.WriteLine(valueToWrite.ToString(\"F8\"));\r\n }\r\n\r\n public void Dispose()\r\n {\r\n try\r\n {\r\n if (reader != null)\r\n {\r\n reader.Dispose();\r\n }\r\n if (writer != null)\r\n {\r\n writer.Dispose();\r\n }\r\n }\r\n catch { };\r\n }\r\n\r\n\r\n public void Flush()\r\n {\r\n if (writer != null)\r\n {\r\n writer.Flush();\r\n }\r\n }\r\n }\r\n\r\n public class ModularMath\r\n {\r\n public static ulong quickexpo(ulong b, ulong e, ulong mod)\r\n {\r\n if (e == 0UL)\r\n return 1UL;\r\n\r\n ulong res = 1;\r\n\r\n ulong pw = 1UL << 62;\r\n\r\n while (pw > 0)\r\n {\r\n res *= res;\r\n res %= mod;\r\n if ((e & pw) > 0)\r\n {\r\n res *= b % mod;\r\n res %= mod;\r\n }\r\n pw >>= 1;\r\n }\r\n\r\n return res;\r\n }\r\n }\r\n\r\n class Program\r\n {\r\n protected IOHelper ioHelper;\r\n\r\n uint t,n,k;\r\n ulong prime = 1000000007;\r\n\r\n public void Solve()\r\n {\r\n t = (uint)ioHelper.ReadNextInt();\r\n\r\n while(t>0)\r\n {\r\n n = (uint)ioHelper.ReadNextInt();\r\n k = (uint)ioHelper.ReadNextInt();\r\n ulong ans = ModularMath.quickexpo(n, k, prime);\r\n ioHelper.WriteLine(ans.ToString());\r\n t--;\r\n }\r\n\r\n ioHelper.Flush();\r\n\r\n //Console.ReadKey();\r\n }\r\n\r\n public Program(string inputFile, string outputFile)\r\n {\r\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\r\n Solve();\r\n ioHelper.Dispose();\r\n }\r\n\r\n static void Main(string[] args)\r\n {\r\n Program myProgram = new Program(null, null);\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "16c07005a4102d3adb89dba9914ab55d", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "difficulty": 1200.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace What_Has_Dirichlet_Got_to_Do_with_That\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(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 n;\n\n private static void Main(string[] args)\n {\n int a = Next();\n int b = Next();\n\n n = Next();\n\n int d = Dfs(a, b, 10000);\n\n if (d == 1)\n writer.WriteLine(\"Masha\");\n else if (d == -1)\n writer.WriteLine(\"Stas\");\n else\n {\n if (a==1)\n writer.WriteLine(\"Missing\");\n else\n {\n if ((n-a)%2==0)\n writer.WriteLine(\"Masha\");\n else\n writer.WriteLine(\"Stas\");\n }\n }\n\n writer.Flush();\n }\n\n private static int Dfs(int a, int b, int level)\n {\n if (level < 0)\n return 0;\n\n bool f1 = Pow(a + 1, b) >= n;\n bool f2 = Pow(a, b + 1) >= n;\n if (f1 && f2)\n return -1;\n\n if (!f1 && !f2)\n {\n int d1 = Dfs(a + 1, b, level - 1);\n int d2 = Dfs(a, b + 1, level - 1);\n\n if (d1 == -1 || d2 == -1)\n return 1;\n if (d1 == 1 && d2 == 1)\n return -1;\n return 0;\n }\n if (!f1)\n {\n return -Dfs(a + 1, b, level - 1);\n }\n return -Dfs(a, b + 1, level - 1);\n }\n\n private static long Pow(long a, int k)\n {\n if (a == 1)\n return 1;\n else if (k > 31)\n return int.MaxValue;\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 private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\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": "beefc516d08b259f3064a381b4e445be", "src_uid": "cffd5c0b7b659649f3bf9f2dbd20ad6b", "difficulty": 2000.0} {"lang": "MS C#", "source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace What_Has_Dirichlet_Got_to_Do_with_That\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(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 n;\n\n private static void Main(string[] args)\n {\n int a = Next();\n int b = Next();\n\n n = Next();\n\n int d = Dfs(a, b, 10000);\n\n if (d == 1)\n writer.WriteLine(\"Masha\");\n else if (d == -1)\n writer.WriteLine(\"Stas\");\n else\n {\n if (a==1)\n writer.WriteLine(\"Missing\");\n else\n {\n if ((n-a)%2==0)\n writer.WriteLine(\"Masha\");\n else\n writer.WriteLine(\"Stas\");\n }\n }\n\n writer.Flush();\n }\n\n private static int Dfs(int a, int b, int level)\n {\n if (level < 0)\n return 0;\n\n bool f1 = Pow(a + 1, b) >= n;\n bool f2 = Pow(a, b + 1) >= n;\n if (f1 && f2)\n return -1;\n\n if (!f1 && !f2)\n {\n int d1 = Dfs(a + 1, b, level - 1);\n int d2 = Dfs(a, b + 1, level - 1);\n\n if (d1 == -1 || d2 == -1)\n return 1;\n if (d1 == 1 && d2 == 1)\n return -1;\n return 0;\n }\n if (!f1)\n {\n return -Dfs(a + 1, b, level - 1);\n }\n return -Dfs(a, b + 1, level - 1);\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 private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\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": "f2eb9bdde6f022cb181d20f9438bd517", "src_uid": "cffd5c0b7b659649f3bf9f2dbd20ad6b", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nnamespace GoogleCodeJam2021\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n char[] a = Console.ReadLine().ToCharArray();\r\n bool b = true;\r\n if (a.Length > 2)\r\n {\r\n if ((test(a[0]) + test(a[1]))%26 != test(a[2])) b = false;\r\n }\r\n\r\n if (b) Console.WriteLine(\"YES\");\r\n else Console.WriteLine(\"NO\");\r\n }\r\n\r\n static int test(char a)\r\n {\r\n return (int)a - 65;\r\n }\r\n }\r\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "c69a6da0cc6509b3bbd6bc753bfebabb", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "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 _15d\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 f = readLongArray();\n var d = f[0];\n var k = f[1];\n var a = f[2];\n var b = f[3];\n var t = f[4];\n\n if (d <= k)\n {\n Console.WriteLine(d * a);\n return;\n }\n\n var rgl = t + k * a;\n var pl = k * b;\n if (pl <= rgl)\n {\n var time = a * k;\n var rem = d - k;\n\n var fr = rem / k;\n var remv = rem % k;\n\n var oct = fr * rgl + t + remv * a;\n var pt = rem * b;\n time += Math.Min(oct, pt);\n\n Console.WriteLine(time);\n }\n else\n {\n var time = a * k;\n var rem = d - k;\n\n var fr = rem / k;\n var remv = rem % k;\n var oct = fr * rgl;\n\n time += oct;\n\n var rpg = t + remv * a;\n var sw = remv * b;\n\n time += Math.Min(rpg, sw);\n Console.WriteLine(time);\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": "feda4517a129a9e68964db3eaec3d2b6", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "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 var tmp = Console.ReadLine().Split(' ');\n long d = long.Parse(tmp[0]);\n long k = long.Parse(tmp[1]);\n long a = long.Parse(tmp[2]);\n long b = long.Parse(tmp[3]);\n long t = long.Parse(tmp[4]);\n\n long ans = d * b;\n long low = 0, high = d * a * a;\n while (high - low > 1) {\n long mid = (high + low) / 2;\n\n long center = Calc(d, k, a, b, t, mid);\n long center1 = Calc(d, k, a, b, t, mid + 1);\n long center_1 = Calc(d, k, a, b, t, mid - 1);\n\n if (center != -1) ans = Math.Min(ans, center);\n if (center1 != -1) ans = Math.Min(ans, center1);\n if (center_1 != -1) ans = Math.Min(ans, center_1);\n\n if (center1 == -1) {\n high = mid;\n } else {\n if (center1 > center) high = mid; else low = mid;\n }\n }\n Console.WriteLine(ans);\n\t }\n private static long Calc(long d, long k, long a, long b, long t, long mid) {\n long withCar = k * mid;\n\n long remaining = d - withCar;\n if (remaining < 0) {\n return -1;\n }\n\n long time = k * mid * a + Math.Max(0, (mid - 1)) * t;\n if (remaining < k) return Math.Min(t+time + remaining * a, time + remaining * b);\n return time + remaining * b;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9a0560668069d5b7f5451c0d0d4cd257", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0} {"lang": "MS C#", "source_code": "/*\n * TemplateCS\n * Copyright (C) 2014-2016 Markus Himmel\n * This file is distributed under the terms of the MIT license\n */\n\n//#define CodeJam\n#define CodeForces\n\nusing System;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace ProgrammingCompetitions\n{\n\tclass Program\n\t{\n\n\t\t#region GCJ\n#if CodeJam\n\t\tprivate static bool DEBUG = false;\n\n\t\tstatic void debug()\n\t\t{\n\t\t}\n\n\t\tstatic string solveCase(int num)\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n#endif\n\t\t#endregion\n\n\t\t#region CodeForces\n#if CodeForces\n#if DEBUG\n\t\tstatic Queue testInput = new Queue(string.Format(@\"\n\n5 5 1 2 1\n\").Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries));\n#endif\n\n\t\tstatic string str(double a)\n\t\t{\n\t\t\treturn a.ToString(\"0.0000000000\", System.Globalization.CultureInfo.InvariantCulture);\n\t\t}\n\n\t\tstatic long calc(long val)\n\t\t{\n\t\t\tif (val * k >= d)\n\t\t\t\treturn long.MaxValue - 10000000 + val;\n\n\t\t\tlong res = val * ((a * k) + t);\n\t\t\tlong rem = d - val * k;\n\t\t\tlong last = Math.Min(k, rem);\n\t\t\tres += last * a;\n\t\t\trem -= last;\n\t\t\tres += rem * b;\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic long d, k, a, b, t;\n\t\tstatic string Solve()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\tread(out d, out k, out a, out b, out t);\n\n\t\t\t\tlong left = 0;\n\t\t\t\tlong right = d / k + 1;\n\n\t\t\t\twhile (left < right)\n\t\t\t\t{\n\t\t\t\t\tlong mid = (left + right) >> 1;\n\t\t\t\t\tif (calc(mid) < calc(mid + 1))\n\t\t\t\t\t{\n\t\t\t\t\t\tright = mid;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\n\t\t\t\treturn calc(left).ToString();\n\t\t\t}\n\t\t}\n#endif\n\t\t#endregion\n\n\t\t// Everything after this comment is template code\n\n\t\tprivate static T read()\n\t\t{\n\t\t\treturn (T)Convert.ChangeType(read(), typeof(T));\n\t\t}\n\n\t\tprivate static T[] readMany()\n\t\t{\n\t\t\treturn readMany(' ');\n\t\t}\n\n\t\tprivate static _[] readMany<_>(params char[] ___)\n\t\t{\n\t\t\treturn read().Split(___).Select(__ => (_)Convert.ChangeType(__, typeof(_))).ToArray();\n\t\t}\n\n\t\tprivate static string[] readMany()\n\t\t{\n\t\t\treturn readMany();\n\t\t}\n\n\t\tprivate static T[][] readMany(int n)\n\t\t{\n\t\t\tT[][] res = new T[n][];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tres[i] = readMany();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static T[][] readField(int height, Func map)\n\t\t{\n\t\t\tT[][] res = new T[height][];\n\t\t\tfor (int _ = 0; _ < height; _++)\n\t\t\t{\n\t\t\t\tres[_] = read().Select(c => map(c)).ToArray();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static char[][] readField(int height)\n\t\t{\n\t\t\treturn readField(height, c => c);\n\t\t}\n\n\t\tprivate static T[][] readField(int height, Dictionary dic)\n\t\t{\n\t\t\treturn readField(height, c => dic[c]);\n\t\t}\n\n\t\tprivate static void read(out T1 t1)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3, out T4 t4)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t\tt4 = (T4)Convert.ChangeType(vals[3], typeof(T4));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3, out T4 t4, out T5 t5)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t\tt4 = (T4)Convert.ChangeType(vals[3], typeof(T4));\n\t\t\tt5 = (T5)Convert.ChangeType(vals[4], typeof(T5));\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2, t3) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2, t3);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, t3, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2, t3, t4) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2, t3, t4);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, t3, t4, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic IEnumerable single(T it)\n\t\t{\n\t\t\tyield return it;\n\t\t}\n\n\t\tstatic IEnumerable range(long first, long last, long step = 1)\n\t\t{\n\t\t\tfor (long i = first; i <= last; i += step)\n\t\t\t{\n\t\t\t\tyield return i;\n\t\t\t}\n\t\t}\n\n\t\tstatic IEnumerable range(int first, int last, int step = 1)\n\t\t{\n\t\t\tfor (int i = first; i <= last; i += step)\n\t\t\t{\n\t\t\t\tyield return i;\n\t\t\t}\n\t\t}\n\n\t\tstatic T id(T a)\n\t\t{\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic static T[][] mkarr(int x, int y)\n\t\t{\n\t\t\tT[][] res = new T[x][];\n\t\t\tfor (int i = 0; i < x; i++)\n\t\t\t{\n\t\t\t\tres[i] = new T[y];\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static T[][][] mkarr(int x, int y, int z)\n\t\t{\n\t\t\tT[][][] res = new T[x][][];\n\t\t\tfor (int i = 0; i < x; i++)\n\t\t\t{\n\t\t\t\tres[i] = new T[y][];\n\t\t\t\tfor (int j = 0; j < y; j++)\n\t\t\t\t{\n\t\t\t\t\tres[i][j] = new T[z];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic bool[] tf = new[] { true, false };\n\n\n#if CodeJam\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tif (DEBUG)\n\t\t\t{\n\t\t\t\tdebug();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tInitialize();\n\t\t\t\tSolveAll(solveCase);\n\t\t\t}\n\t\t\tConsole.ReadKey();\n\t\t}\n\n\t\tprivate static StreamReader inf;\n\t\tprivate static StreamWriter outf;\n\n\t\tprivate delegate void o(string format, params object[] args);\n\t\tprivate static o Output;\n\n\t\tpublic static void Initialize()\n\t\t{\n\t\t\tConsole.ForegroundColor = ConsoleColor.Yellow;\n\t\t\tConsole.Write(\"File name: \");\n\t\t\tstring name = Console.ReadLine();\n\t\t\tinf = new StreamReader($\"D:\\\\Users\\\\marku\\\\Downloads\\\\{name}.in\");\n\t\t\toutf = new StreamWriter($\"D:\\\\Users\\\\marku\\\\Downloads\\\\{name}.out\");\n\t\t\tConsole.ForegroundColor = ConsoleColor.White;\n\t\t\tOutput = highlightedPrint;\n\t\t\tOutput += outf.WriteLine;\n\t\t}\n\n\t\tprivate static void highlightedPrint(string format, params object[] args)\n\t\t{\n\t\t\tConsoleColor prev = Console.ForegroundColor;\n\t\t\tConsole.ForegroundColor = ConsoleColor.Green;\n\t\t\tConsole.WriteLine(format, args);\n\t\t\tConsole.ForegroundColor = prev;\n\t\t}\n\n\t\tpublic static void SolveAll(Func calc)\n\t\t{\n\t\t\tint cases = int.Parse(inf.ReadLine());\n\t\t\tfor (int _ = 1; _ <= cases; _++)\n\t\t\t{\n\t\t\t\tOutput($\"Case #{_}: {calc(_)}\");\n\t\t\t}\n\t\t\tinf.Close();\n\t\t\toutf.Close();\n\t\t\tConsole.ForegroundColor = ConsoleColor.Cyan;\n\t\t\tConsole.WriteLine(\"Eureka!\");\n\t\t}\n\n\t\tprivate static string read()\n\t\t{\n\t\t\treturn inf.ReadLine();\n\t\t}\n#endif\n\n#if CodeForces\n\t\tstatic void Main(string[] args)\n\t\t{\n#if DEBUG\n\t\t\tvar sw = new System.Diagnostics.Stopwatch();\n\t\t\tsw.Start();\n#endif\n\t\t\tstring s = Solve();\n\t\t\tif (!string.IsNullOrEmpty(s))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(s);\n\t\t\t}\n#if DEBUG\n\t\t\tsw.Stop();\n\t\t\tConsole.WriteLine(sw.Elapsed);\n\t\t\tConsole.ReadKey();\n#endif\n\t\t}\n\n\t\tprivate static string read()\n\t\t{\n#if !DEBUG\n\t\t\treturn Console.ReadLine();\n#else\n\t\t\treturn testInput.Dequeue();\n#endif\n\t\t}\n#endif\n\t}\n\n\tpublic static class ExtensionMethods\n\t{\n\t\tpublic static IEnumerable Cartesian(this IEnumerable first, IEnumerable second, Func collector)\n\t\t{\n\t\t\treturn first.SelectMany(f => second.Select(s => collector(f, s)));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, Tuple.Create);\n\t\t}\n\n\t\tpublic static IEnumerable> CartesianE(this IEnumerable first, IEnumerable second)\n\t\t{\n\t\t\t// Calling CartesianE prevents selection of the wrong overload of Cartesian when you want a tuple of tuples to be returned\n\t\t\treturn first.Cartesian(second);\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, x.Item3, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> source)\n\t\t{\n\t\t\tIEnumerable> res = source.First().Select(x => single(x));\n\t\t\tforeach (IEnumerable next in source.Skip(1))\n\t\t\t{\n\t\t\t\tres = res.Cartesian(next, (sofar, n) => sofar.Concat(single(n)));\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static IEnumerable> Pow(this IEnumerable it, int num)\n\t\t{\n\t\t\treturn Enumerable.Repeat(it, num).Cartesian();\n\t\t}\n\n\t\tpublic static IEnumerable Demask(this IEnumerable> inp)\n\t\t{\n\t\t\tforeach (var pair in inp)\n\t\t\t{\n\t\t\t\tif (pair.Item2)\n\t\t\t\t{\n\t\t\t\t\tyield return pair.Item1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable>> Partition(this IEnumerable source, int groups)\n\t\t{\n\t\t\tforeach (var part in Enumerable.Range(0, groups).Pow(source.Count()).Select(x => x.ToArray()))\n\t\t\t{\n\t\t\t\tyield return Enumerable.Range(0, groups).Select(x => source.Where((item, idx) => part[idx] == x));\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable> Combinations(this IEnumerable it)\n\t\t{\n\t\t\tforeach (var conf in new[] { true, false }.Pow(it.Count()))\n\t\t\t{\n\t\t\t\tyield return it.Zip(conf, Tuple.Create).Demask();\n\t\t\t}\n\t\t}\n\n\t\tprivate static IEnumerable single(T it)\n\t\t{\n\t\t\tyield return it;\n\t\t}\n\n\t\tprivate static IEnumerable ExceptSingle(this IEnumerable first, T it, IEqualityComparer comp = null)\n\t\t{\n\t\t\tcomp = comp ?? EqualityComparer.Default;\n\t\t\tbool seen = false;\n\t\t\tforeach (T a in first)\n\t\t\t{\n\t\t\t\tif (!seen && comp.Equals(a, it))\n\t\t\t\t{\n\t\t\t\t\tseen = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tyield return a;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable> Permutations(this IEnumerable it)\n\t\t{\n\t\t\tif (it.Count() < 2)\n\t\t\t{\n\t\t\t\tyield return it;\n\t\t\t\tyield break;\n\t\t\t}\n\n\t\t\tforeach (T first in it)\n\t\t\t{\n\t\t\t\tforeach (IEnumerable part in Permutations(it.ExceptSingle(first)))\n\t\t\t\t{\n\t\t\t\t\tyield return single(first).Concat(part);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static T[][] Rho(this IEnumerable source, int x, int y)\n\t\t{\n\t\t\tT[][] res = Program.mkarr(x, y);\n\n\t\t\tint i = 0, j = 0;\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tforeach (T item in source)\n\t\t\t\t{\n\t\t\t\t\tres[i][j] = item;\n\t\t\t\t\tj++;\n\t\t\t\t\tif (j == y)\n\t\t\t\t\t{\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\ti++;\n\t\t\t\t\t\tif (i == x)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i == x)\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static T[][][] Rho(this IEnumerable source, int x, int y, int z)\n\t\t{\n\t\t\tT[][][] res = Program.mkarr(x, y, z);\n\n\t\t\tint i = 0, j = 0, k = 0;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tforeach (T item in source)\n\t\t\t\t{\n\t\t\t\t\tres[i][j][k] = item;\n\t\t\t\t\tk++;\n\t\t\t\t\tif (k == z)\n\t\t\t\t\t{\n\t\t\t\t\t\tk = 0;\n\t\t\t\t\t\tj++;\n\t\t\t\t\t\tif (j == y)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\tif (i == x)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i == x)\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\t}\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "84df270c824fecd186efa61db7711378", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\n\n\nnamespace CodeforcesVASYA\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n String [] arr = Console.ReadLine().Split(' ');\n \n Int64 k=int.Parse(arr[0]);\n Int64 b=int.Parse(arr[1]);\n Int64 n=int.Parse(arr[2]);\n Int64 t=int.Parse(arr[3]);\n \n Int64 x=1;\n \n for (n; n>0; )\n {\n \n x=k*x+b;\n \n if(x>t)\n {\n\n break;\n }\n else\n {\n dec(n);\n }\n \n \n \n \n }\n \n Console.WritwLine(n);\n \n \n\n \n \n \n }\n }\n\n}", "lang_cluster": "C#", "compilation_error": true, "code_uid": "41baa067fffe3617d3b0753b5d2fc63e", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.0} {"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\tuint[] c1 = reader.ReadLine().Split(' ').Select(i => uint.Parse(i)).ToArray();\n\n\t\t\tuint k = c1[0];\n\t\t\tuint b = c1[1];\n\t\t\tuint n = c1[2];\n\t\t\tuint t = c1[3];\n\n\t\t\t#endregion\n\n\t\t\tif (k == 1) {\n\t\t\t\tdouble answ = Math.Ceiling((n * 1.0 * b - t + 1) / b);\n\t\t\t\tif (answ < 0) answ = 0;\n\t\t\t\tConsole.WriteLine(answ);\n\t\t\t} else {\n\t\t\t\tdouble div = b * 1.0 + t * 1.0 * (k - 1);\n\t\t\t\tdouble qp = (b + k - 1) * 1.0 / div;\n\t\t\t\tvar answ = (int)Math.Ceiling(Math.Log(qp, k)) + n;\n\t\t\t\tif (answ < 0) answ = 0;\n\t\t\t\tConsole.WriteLine(answ);\n\t\t\t}\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": false, "code_uid": "500d78915234877fc85b03698b1b32e8", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.0} {"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 (long i = 0; i < n; i++) {\n\t\t\t\tz = k * z + b;\n\t\t\t}\n\n\t\t\tlong 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": false, "code_uid": "d51434bdb7eae3c3121b4a30290b37cf", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.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\t\tbool[,] expanded = new bool[target + 1, n];\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\tif (expanded [state.Missing, state.Current.Index])\n\t\t\t\t\tcontinue;\n\t\t\t\texpanded [state.Missing, state.Current.Index] = true;\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": "26d132b12619ea901c245c2626b9a190", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "difficulty": 2000.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split(new [] {' '}, StringSplitOptions.RemoveEmptyEntries);\n var a = int.Parse(data[0]);\n var b = int.Parse(data[1]);\n var mod = int.Parse(data[2]);\n\n for (var s1 = 599; s1 <= Math.Min(mod, a); s1++)\n { \n long k = ((long)1000000000*s1)%mod;\n long s2 = 0;\n if (k != 0)\n s2 = mod - k;\n if (s2 < 0 || s2 > b)\n {\n Console.WriteLine(\"{0} {1:D9}\", 1, s1);\n return;\n }\n }\n Console.WriteLine(2);\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "05d76dbe0739ce62661a80330ed74aa5", "src_uid": "8b6f633802293202531264446d33fee5", "difficulty": 1800.0} {"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 Main() {\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": false, "code_uid": "f686acc932dbf002e0a2c8ae5e6fc84b", "src_uid": "8b6f633802293202531264446d33fee5", "difficulty": 1800.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Linq;\r\n\r\nclass E\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 void Main() => Console.WriteLine(Solve());\r\n\tstatic object Solve()\r\n\t{\r\n\t\t(int n, long M) = Read2();\r\n\r\n\t\tvar mc = new MCombination(n + 1, M);\r\n\r\n\t\t// \u9577\u3055 i \u306e\u533a\u9593\u3092 j steps \u3067\u30aa\u30f3\u306b\u3059\u308b\u65b9\u6cd5\r\n\t\tvar dp2 = new MemoDP2(n + 1, n + 1, -1, (dp, i, j) =>\r\n\t\t{\r\n\t\t\tvar d = i - j - 1;\r\n\t\t\tvar v = 0L;\r\n\r\n\t\t\tfor (int k = 1; k < j; k++)\r\n\t\t\t{\r\n\t\t\t\tv += dp[k + d, k] * dp[j - k, j - k] % M * mc.MNcr(j, k) % M;\r\n\t\t\t}\r\n\t\t\treturn v % M;\r\n\t\t});\r\n\r\n\t\tfor (int i = 0; i <= n; i++)\r\n\t\t{\r\n\t\t\tfor (int j = 0; i >= 2 * j; j++)\r\n\t\t\t{\r\n\t\t\t\tdp2[i, j] = 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tdp2[1, 1] = 1;\r\n\t\tfor (int i = 1; i < n; i++)\r\n\t\t{\r\n\t\t\tdp2[i + 1, i + 1] = dp2[i, i] * 2 % M;\r\n\t\t}\r\n\r\n\t\treturn Enumerable.Range(1, n).Sum(j => dp2[n, j]) % M;\r\n\t}\r\n}\r\n\r\nclass MemoDP2\r\n{\r\n\tstatic readonly Func TEquals = System.Collections.Generic.EqualityComparer.Default.Equals;\r\n\tpublic T[,] Raw { get; }\r\n\tT iv;\r\n\tFunc, int, int, T> rec;\r\n\r\n\tpublic MemoDP2(int n1, int n2, T iv, Func, int, int, T> rec)\r\n\t{\r\n\t\tRaw = new T[n1, n2];\r\n\t\tfor (int i = 0; i < n1; ++i)\r\n\t\t\tfor (int j = 0; j < n2; ++j)\r\n\t\t\t\tRaw[i, j] = iv;\r\n\t\tthis.iv = iv;\r\n\t\tthis.rec = rec;\r\n\t}\r\n\r\n\tpublic T this[int i, int j]\r\n\t{\r\n\t\tget => TEquals(Raw[i, j], iv) ? Raw[i, j] = rec(this, i, j) : Raw[i, j];\r\n\t\tset => Raw[i, j] = value;\r\n\t}\r\n}\r\n\r\npublic class MCombination\r\n{\r\n\tlong M;\r\n\tlong MPow(long b, long i)\r\n\t{\r\n\t\tlong r = 1;\r\n\t\tfor (; i != 0; b = b * b % M, i >>= 1) if ((i & 1) != 0) r = r * b % M;\r\n\t\treturn r;\r\n\t}\r\n\tlong MInv(long x) => MPow(x, M - 2);\r\n\r\n\tlong[] MFactorials(int n)\r\n\t{\r\n\t\tvar f = new long[n + 1];\r\n\t\tf[0] = 1;\r\n\t\tfor (int i = 1; i <= n; ++i) f[i] = f[i - 1] * i % M;\r\n\t\treturn f;\r\n\t}\r\n\r\n\t// nPr, nCr \u3092 O(1) \u3067\u6c42\u3081\u308b\u305f\u3081\u3001\u968e\u4e57\u3092 O(n) \u3067\u6c42\u3081\u3066\u304a\u304d\u307e\u3059\u3002\r\n\tlong[] f, f_;\r\n\tpublic MCombination(int nMax, long M)\r\n\t{\r\n\t\tthis.M = M;\r\n\t\tf = MFactorials(nMax);\r\n\t\tf_ = Array.ConvertAll(f, MInv);\r\n\t}\r\n\r\n\tpublic long MFactorial(int n) => f[n];\r\n\tpublic long MInvFactorial(int n) => f_[n];\r\n\tpublic long MNpr(int n, int r) => n < r ? 0 : f[n] * f_[n - r] % M;\r\n\tpublic long MNcr(int n, int r) => n < r ? 0 : f[n] * f_[n - r] % M * f_[r] % M;\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "0bc546668295e1c90e26e4f963c5c8d7", "src_uid": "4f0e0d1deef0761a46b64de3eb98e774", "difficulty": 2200.0} {"lang": "Mono C#", "source_code": "using System;\nusing System.ComponentModel.Design;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n long n = long.Parse(lines[0]);\n long p = long.Parse(lines[1]);\n int w = int.Parse(lines[2]);\n int d = int.Parse(lines[3]);\n\n //wins * w + draws * d = p; wins + draws <= n \n\n if (w * n < p)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n int gcd = Gcd(w, d);\n\n if (p % gcd != 0)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n if (n % gcd == 0)\n {\n n = n / gcd;\n w = w / gcd;\n d = d / gcd;\n p = p / gcd;\n }\n\n int wins;\n\n for (int draws = 0; draws <= w + 1; draws++)\n {\n wins = (int) (p - draws * d) / w;\n if (wins >= 0 && wins + draws <= n)\n {\n Console.WriteLine($\"{wins} {draws} {n-wins-draws}\");\n return;\n }\n \n }\n Console.WriteLine(-1);\n \n\n }\n\n private static int Gcd(int a, int b)\n {\n int result = -1;\n while (b != 0)\n {\n a = a % b;\n int temp = a;\n a = b;\n b = temp;\n }\n\n return a;\n }\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "9c97d8bf047f1d6cefb9d7f75b5bd210", "src_uid": "503116e144d19eb953954d99c5526a7d", "difficulty": 2000.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": "9bfb0a36f304e172f8f24013b9053a3a", "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.Max(ans, c);\n\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.Max(ans, c);\n\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.Max(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": "52ad05764f007a020dad115ad284c001", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "MS C#", "source_code": "// ac 218ms\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Threading;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\nnamespace sar_cs\n{\n static class Helpers\n {\n public static string Join(this IEnumerable objs, string sep)\n {\n var sb = new StringBuilder();\n foreach (var s in objs) { if (sb.Length != 0) sb.Append(sep); sb.Append(s); }\n return sb.ToString();\n }\n\n public static string AsString(this double a, int digits)\n {\n return a.ToString(\"F\" + digits, CultureInfo.InvariantCulture);\n }\n\n public static T[] Copy(this T[] a)\n {\n var b = new T[a.Length]; a.CopyTo(b, 0); return b;\n }\n\n public static T[][] Copy(this T[][] a)\n {\n return a.Select(z => z.Copy()).ToArray();\n }\n\n public static IEnumerable Shuffle(this IEnumerable collection)\n {\n if (collection.Take(11).Count() <= 10) return collection;\n var a = collection is T[] ? (T[])collection : collection.ToArray();\n int N = a.Length;\n for (int i = 0, p1 = 0, p2 = 1; i < N / 2; i++)\n {\n p1 += 3; if (p1 >= N) p1 -= N;\n p2 -= 7; if (p2 < 0) p2 += N;\n T t = a[p1]; a[p1] = a[p2]; a[p2] = t;\n }\n return a;\n }\n\n public static string AsString(this T[,] a, string separator)\n {\n var sb = new StringBuilder();\n int n0 = a.GetLength(0);\n int n1 = a.GetLength(1);\n for (int r = 0; r < n0; r++)\n {\n for (int c = 0; c < n1; c++)\n {\n if (c != 0) sb.Append(separator); sb.Append(a[r, c]);\n }\n sb.AppendLine();\n }\n //sb.AppendLine();\n return sb.ToString();\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; 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 == '-') { 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 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 class Writer\n {\n const int BufSize = 32000;\n char[] buf = new char[BufSize];\n int bufPos = 0;\n TextWriter output = Console.Out;\n Stack st = new Stack();\n\n public void Flush()\n {\n output.Write(buf, 0, bufPos); bufPos = 0;\n output.Flush();\n }\n\n void BufSpaceNeeded(int n)\n {\n if (n > BufSize) throw new ArgumentOutOfRangeException(\"n\");\n if (bufPos + n > BufSize) { output.Write(buf, 0, bufPos); bufPos = 0; }\n }\n\n public void Write(char a)\n {\n BufSpaceNeeded(1);\n buf[bufPos++] = a;\n }\n\n public void Write(string s)\n {\n int l = s.Length;\n for (int x = 0; x < l; )\n {\n int t = Math.Min(l - x, BufSize - bufPos);\n s.CopyTo(x, buf, bufPos, t); bufPos += t; x += t;\n if (x < l) BufSpaceNeeded(1); // force flush\n }\n }\n\n public void WriteLine()\n {\n BufSpaceNeeded(2);\n buf[bufPos++] = '\\r'; buf[bufPos++] = '\\n';\n }\n\n public void Write(object o) { Write(o.ToString()); }\n\n public void Write(uint a)\n {\n BufSpaceNeeded(10);\n do { st.Push((char)(a % 10 + 48)); a /= 10; } while (a != 0);\n while (st.Count != 0) buf[bufPos++] = st.Pop();\n }\n\n public void Write(ulong a)\n {\n BufSpaceNeeded(20);\n do { st.Push((char)(a % 10 + 48)); a /= 10; } while (a != 0);\n while (st.Count != 0) buf[bufPos++] = st.Pop();\n }\n\n public void Write(int a)\n {\n BufSpaceNeeded(11);\n if (a < 0) { buf[bufPos++] = '-'; a = -a; }\n Write((uint)a);\n }\n\n public void Write(long a)\n {\n BufSpaceNeeded(21);\n if (a < 0) { buf[bufPos++] = '-'; a = -a; }\n Write((ulong)a);\n }\n\n public void Write(double a, int digits)\n {\n Write(a.AsString(digits));\n }\n\n public void WriteLine(int a) { Write(a); WriteLine(); }\n public void WriteLine(long a) { Write(a); WriteLine(); }\n public void WriteLine(uint a) { Write(a); WriteLine(); }\n public void WriteLine(ulong a) { Write(a); WriteLine(); }\n public void WriteLine(string s) { Write(s); WriteLine(); }\n public void WriteLine(object o) { Write(o); WriteLine(); }\n }\n\n static void pe() { Console.WriteLine(\"???\"); Environment.Exit(0); }\n static void re() { throw new Exception(); }\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 static double Sqrt(double a) { return Math.Sqrt(a); }\n static int abs(int a) { return Math.Abs(a); }\n static long abs(long a) { return Math.Abs(a); }\n static double abs(double a) { return Math.Abs(a); }\n\n static StringBuilder sb = new StringBuilder();\n static Random rnd = new Random(5);\n\n #endregion Helpers\n\n #region Direction\n\n struct Direction\n {\n public int dx, dy;\n\n public Direction(int dx, int dy)\n {\n this.dx = dx;\n this.dy = dy;\n }\n\n public void Apply(ref int x, ref int y)\n {\n x += dx;\n y += dy;\n }\n\n public void ApplyOrThrow(ref int x, ref int y, int w, int h)\n {\n Apply(ref x, ref y);\n if ((uint)x >= w && (uint)y >= h) throw new Exception();\n }\n\n public bool Applyable(int x, int y, int w, int h)\n {\n Apply(ref x, ref y);\n return (uint)x < w && (uint)y < h;\n }\n\n public int DistanceToBoundary(int x, int y, int w, int h)\n {\n int res = 0;\n while (Applyable(x, y, w, h))\n {\n Apply(ref x, ref y);\n res++;\n }\n return res;\n }\n\n public override string ToString()\n {\n return string.Format(\"dx={0}, dy={1}\", dx, dy);\n }\n\n public static readonly Direction[] N =\n {\n new Direction( 1, 0),\n new Direction( 0, 1),\n new Direction(-1, 0),\n new Direction( 0,-1)\n };\n }\n\n #endregion Direction\n\n struct State\n {\n public int Y, X, os;\n\n public int ID\n {\n get\n {\n return ((Y * 20 + X) * 256 + os);\n }\n }\n }\n\n struct Object\n {\n const int dx = 50, dy = 51;\n public char Type;\n public int N;\n\n private int x1, y1;\n private int x2, y2;\n\n public Object(int x0, int y0, char type, int n)\n {\n this.x1 = x0;\n this.y1 = y0;\n x2 = x1 + dx;\n y2 = y1 + dx;\n this.Type = type;\n this.N = n;\n }\n\n public bool Intersects(int x0, int y0, Direction dir)\n {\n if (dir.dx == 0)\n {\n if (dir.dy == -1)\n y0--;\n\n if (x0 < this.x1 || x0 > this.x2) return false;\n if (y0 == this.y1) return true;\n return false;\n }\n else\n {\n if (dir.dx == -1)\n x0--;\n\n return false;\n }\n }\n }\n\n static void Main()\n {\n checked\n {\n#if !ONLINE_JUDGE\n Console.SetIn(File.OpenText(\"_input\"));\n#endif\n //Console.SetOut(File.CreateText(\"_output\"));\n var parser = new Parser();\n var o = new Writer();\n try\n {\n while (!parser.SeekEOF)\n {\n var objs = new List();\n\n int H = parser.ReadInt();\n int W = parser.ReadInt(); parser.ReadLine();\n var map = new char[H][];\n int sx = -1, sy = -1;\n int tcount = 0;\n for (int y = 0; y < H; y++)\n {\n var l = parser.ReadLine();\n if (l.Contains('S'))\n {\n sy = y;\n sx = l.IndexOf('S');\n l = l.Replace('S', '.');\n }\n tcount += l.Count(c => char.IsDigit(c));\n map[y] = l.ToCharArray();\n }\n\n var tprice = new int[tcount];\n for (int i = 0; i < tcount; i++)\n tprice[i] = parser.ReadInt();\n\n int bn = 0;\n for (int y = 0; y < H; y++)\n for (int x = 0; x < W; x++)\n if (map[y][x] != '.' && map[y][x] != '#')\n {\n if (map[y][x] == 'B')\n {\n objs.Add(new Object(x, y, 'B', tcount + bn));\n bn++;\n }\n else\n {\n int t = map[y][x] - '1';\n objs.Add(new Object(x, y, 'T', t));\n }\n }\n\n var d = new int[20 * 20 * 256];\n for (int i = 0; i < d.Length; i++)\n d[i] = int.MaxValue / 2;\n var q = new Queue();\n var s = new State { X = sx, Y = sy, os = 0 };\n q.Enqueue(s);\n d[s.ID] = 0;\n while (q.Count > 0)\n {\n s = q.Dequeue();\n foreach (var dir in Direction.N)\n {\n if (dir.Applyable(s.X, s.Y, W, H))\n {\n var ns = s;\n dir.Apply(ref ns.X, ref ns.Y);\n var c = map[ns.Y][ns.X];\n if (c == '#' || c == 'B' || char.IsDigit(c)) continue;\n foreach (var obj in objs)\n if (obj.Intersects(s.X, s.Y, dir))\n {\n ns.os ^= (1 << obj.N);\n }\n\n if (d[ns.ID] < int.MaxValue / 2) continue;\n d[ns.ID] = d[s.ID] + 1;\n q.Enqueue(ns);\n }\n }\n }\n\n int best = 0;\n for (int tmask = 0; tmask < (1 << tcount); tmask++)\n {\n s = new State { X = sx, Y = sy, os = tmask + 0/*no bombs*/};\n if (d[s.ID] >= int.MaxValue / 2) continue;\n int profit = 0;\n for (int t = 0; t < tcount; t++)\n if ((tmask >> t & 1) == 1)\n profit += tprice[t];\n\n profit -= d[s.ID];\n best = Math.Max(best, profit);\n }\n\n Console.WriteLine(best);\n }\n }\n finally\n {\n o.Flush();\n }\n }\n }\n\n //static void Main()\n //{\n // new Thread(Main2, 50 << 20).Start();\n //}\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "63aa887b996168cb6ed2850f11739c62", "src_uid": "624a0d6cf305fcf67d3f1cdc1c5fef8d", "difficulty": 2600.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 Console.WriteLine(ModInt.Pow(3, N - 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": "719d943d638342590680c1f51fca904e", "src_uid": "8218255989e5eab73ac7107072c3b2af", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "/*\ncsc -debug D.cs && mono --debug D.exe <<< \"10\n()()())(()\"\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 const int INF = 1000000000;\n\n public static void SolveCodeForces() {\n var n = cin.NI();\n var S = Console.ReadLine();\n n = S.Length;\n\n var F = new int[n + 1];\n for (var i = 0; i < n; i++)\n F[i + 1] = F[i] + (S[i] == '(' ? 1 : -1);\n\n if (F[0] != F[n]) {\n System.Console.WriteLine(\"0\");\n System.Console.WriteLine(\"1 1\");\n return;\n }\n\n// System.Console.WriteLine(new { F=F.Join() });\n\n var best = 0;\n var bestij = new[] {1, 1};\n\n {\n var min = F.Min();\n for (var k = 0; k < n; k++)\n if (F[k] == min)\n best++;\n }\n\n for (var i = 0; i < n; i++) {\n for (var j = i + 1; j < n; j++) {\n if (S[i] != S[j]) {\n\n var min = new MinCounter(INF);\n if (S[i] == '(') {\n for (var k = 0; k < n; k++)\n if (k <= i || k > j)\n min.Check(F[k]);\n else\n min.Check(F[k] - 2);\n }\n else {\n for (var k = 0; k < n; k++)\n if (k <= i || k > j)\n min.Check(F[k]);\n else\n min.Check(F[k] + 2);\n }\n\n// System.Console.WriteLine(new { i, j, min=min.Min, cnt=min.Count });\n\n if (min.Count > best) {\n best = min.Count;\n bestij = new [] {i, j};\n }\n\n }\n }\n }\n\n System.Console.WriteLine(best);\n System.Console.WriteLine(\"{0} {1}\", bestij[0] + 1, bestij[1] + 1);\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n public static 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 MinCounter {\n public MinCounter(int INF) {\n Min = INF;\n }\n public void Check(int val) {\n if (val < Min) {\n Min = val;\n Count = 1;\n }\n else if (val == Min)\n Count++;\n }\n public int Min;\n public int Count;\n}\n\npublic class SegmentTree {\n public readonly int size;\n public readonly T[] seg;\n public readonly Func op;\n public readonly Func def;\n\n public SegmentTree(T[] arr, Func _op, Func _def) {\n for (size = 1; size <= arr.Length; size <<= 1);\n seg = new T[2 * size];\n op = _op;\n def = _def;\n for (var i = size + arr.Length; i < seg.Length; i++)\n seg[i] = _def();\n for (var i = size; i < size + arr.Length; i++)\n seg[i] = arr[i - size];\n for (var i = size - 1; i > 0; i--)\n seg[i] = op(seg[2*i], seg[2*i+1]);\n }\n\n public void Update(int pos, T val) {\n pos += size;\n seg[pos] = val;\n while (pos > 1) {\n pos >>= 1;\n seg[pos] = op(seg[2*pos], seg[2*pos+1]); // keep order left,right for non-commutative op\n }\n }\n\n public T Query(int l, int r) {\n var ql = def();\n var qr = def();\n r++;\n for (l += size, r += size; l < r; l >>= 1, r >>= 1) {\n if (l % 2 == 1) ql = op(ql, seg[l++]);\n if (r % 2 == 1) qr = op(seg[--r], qr);\n }\n return op(ql, qr);\n }\n}\n\npublic class Counter {\n public Dictionary Dict;\n public Counter() { Dict = new Dictionary(); }\n public Counter(IEnumerable keys) { Dict = new Dictionary(); foreach (var k in keys) Add(k, 1); }\n public int this[T key] {\n get { int res; return Dict.TryGetValue(key, out res) ? res : 0; }\n set { Dict[key] = value; }\n }\n public void Add(T key, int add) { int res; if (Dict.TryGetValue(key, out res)) Dict[key] = res + add; else Dict[key] = add; }\n}\n\npublic static class Helpers {\n public static string Join(this IEnumerable arr, string sep = \" \") {\n return string.Join(sep, arr);\n }\n\n public static void Swap(ref T a, ref T b) {\n var tmp = a;\n a = b;\n b = tmp;\n }\n\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NI() {\n return int.Parse(Next());\n }\n\n public long NL() {\n return long.Parse(Next());\n }\n\n public ulong NUL() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] NIA(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] NLA() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] NULA() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "3c1c92cf7b7a0d383354450fdcfebdbf", "src_uid": "2d10668fcc2d8e90e102b043f5e0578d", "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.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 if (n < k)\n k = n;\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": "d59177c6accf8fb38f4788bedaf61711", "src_uid": "8781003d9eea51a509145bc6db8b609c", "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.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": "fa5a7c7dc0089df2a1e496ace93a7659", "src_uid": "391c2abbe862139733fcb997ba1629b8", "difficulty": 2000.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": "1af71496f8c8c0c650bff42aadb282b8", "src_uid": "583cd1e553133b297f99fd52e5ad355b", "difficulty": 3000.0} {"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": "7bfd805e29a5900b0ca2af49130c5044", "src_uid": "230e613abf0f6a768829cbc1f1a09219", "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\tclass E\n\t{\n\t\tprivate static int[] ans =\n\t\t\t{\n\t\t\t\t1,\n\t\t\t\t2,\n\t\t\t\t4,\n\t\t\t\t6,\n\t\t\t\t12,\n\t\t\t\t16,\n\t\t\t\t18,\n\t\t\t\t30,\n\t\t\t\t60,\n\t\t\t\t88,\n\t\t\t\t106,\n\t\t\t\t126,\n\t\t\t\t520,\n\t\t\t\t606,\n\t\t\t\t1278,\n\t\t\t\t2202,\n\t\t\t\t2280,\n\t\t\t\t3216,\n\t\t\t\t4252,\n\t\t\t\t4422,\n\t\t\t\t9688,\n\t\t\t\t9940,\n\t\t\t\t11212,\n\t\t\t\t19936,\n\t\t\t\t21700,\n\t\t\t\t23208,\n\t\t\t\t44496,\n\t\t\t\t86242,\n\t\t\t\t110502,\n\t\t\t\t132048,\n\t\t\t\t216090,\n\t\t\t\t756838,\n\t\t\t\t859432,\n\t\t\t\t1257786,\n\t\t\t\t1398268,\n\t\t\t\t2976220,\n\t\t\t\t3021376,\n\t\t\t\t6972592,\n\t\t\t\t13466916,\n\t\t\t\t20996010\n\t\t\t};\n\n\t\tprivate const int MOD = 1000000007;\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n = NextInt();\n\t\t\tOut.WriteLine( ( pow( 2, ans[n - 1] ) - 1 + MOD ) % MOD );\n\t\t\t/*\n\t\t\tint MAX = 100000000;\n\t\t\tbool[] ok = new bool[MAX + 1];\n\t\t\tfor ( int k = 1; ; ++k )\n\t\t\t{\n\t\t\t\tint f = 2 * k + 1 + k;\n\t\t\t\tif ( f > MAX ) break;\n\t\t\t\twhile ( f <= MAX )\n\t\t\t\t{\n\t\t\t\t\tok[f] = true;\n\t\t\t\t\tf += 2 * k + 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor ( int k = 0; ; ++k )\n\t\t\t{\n\t\t\t\tint f = 2 * k + 2 + k;\n\t\t\t\tif ( f > MAX ) break;\n\t\t\t\twhile ( f <= MAX )\n\t\t\t\t{\n\t\t\t\t\tok[f] = true;\n\t\t\t\t\tf += 2 * k + 2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor ( int i = 1; i <= MAX; ++i )\n\t\t\t\tif ( !ok[i] ) Out.WriteLine( i );\n\t\t\t */\n\t\t}\n\n\t\tprivate int pow( int a, int 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\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, 128 * 1024 * 1024 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew E().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": "1338004d8ed3e02515f3e195cdd03dc9", "src_uid": "c2cbc35012c6ff7ab0d6899e6015e4e7", "difficulty": 2100.0} {"lang": "C# 8", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nnamespace olymp_codeforces\r\n{\r\n class Program\r\n {\r\n void dashla(long x, out HashSet digits, out int cnt)\r\n {\r\n digits = new HashSet();\r\n cnt = 0;\r\n while(x > 0)\r\n {\r\n digits.Add(x % 10);\r\n cnt++;\r\n x = x/10;\r\n }\r\n }\r\n int res = int.MaxValue;\r\n Dictionary svlebi = new Dictionary();\r\n void rec(long x, int n, int svla)\r\n {\r\n if (svlebi.ContainsKey(x) && svlebi[x] <= svla)\r\n return;\r\n svlebi[x] = svla;\r\n HashSet digits;\r\n int cnt;\r\n dashla(x, out digits, out cnt);\r\n if(cnt == n)\r\n {\r\n res = Math.Min(res, svla);\r\n return;\r\n }\r\n if (svla >= res || svla > n+ 2)\r\n return;\r\n\r\n var dSorted = digits.ToList().OrderByDescending(i => i).ToList(); // digits.OrderBy(_ => rand.Next()).ToList();\r\n //dSorted.Sort();\r\n for (int i = 0; i < dSorted.Count; i++)\r\n {\r\n long digit = dSorted[i];\r\n if (digit < 2)\r\n break;\r\n rec(x * digit, n, svla + 1);\r\n }\r\n }\r\n\r\n\r\n public void Solve()\r\n {\r\n // var t = int.Parse(Console.ReadLine());\r\n var input = Console.ReadLine().Split(' ').Select(long.Parse).ToList();\r\n long n = input[0], x = input[1];\r\n rec(x, (int)n, 0);\r\n if (res < int.MaxValue)\r\n Console.WriteLine(res);\r\n else\r\n Console.WriteLine(-1);\r\n }\r\n\r\n\r\n\r\n\r\n static void Main(string[] args)\r\n {\r\n var A = new Program();\r\n A.Solve();\r\n }\r\n }\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "2ab59257d3b830ec684039d55a5c2acc", "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 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())).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.Enqueue(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": "222c3f5eb44f02db7a101d84332de51c", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.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 // \u89aa\u5074\u306f\u51e6\u7406\u304c\u96e3\u3057\u3044\u306e\u3067\u98db\u3070\u3059\n // x,y\u9006\u306b\u306a\u3063\u3066\u3082\u3044\u3044\u306e\u3067\u554f\u984c\u306a\u3044\n bool[,] dp = new bool[ls.Count + 1, N];\n dp[0, 0] = true;\n for (int i = 0; i < ls.Count; i++)\n {\n for (int j = 0; j < N; j++)\n {\n if (dp[i, j]) dp[i + 1, j + ls[i].size] = true;\n }\n }\n\n if (!Found)\n {\n int x = -1;\n for (int i = 0; i < N; i++)\n {\n if (!dp[ls.Count, i]) continue;\n int y = N - 1 - i;\n if (Max < (i + 1) * (y + 1))\n {\n x = i;\n break;\n }\n }\n\n if (x != -1)\n {\n XSize = x;\n R = cur;\n for (int i = ls.Count - 1; i >= 0; i--)\n {\n if (x - ls[i].size >= 0 && dp[i, x - ls[i].size])\n {\n SetFlag(ls[i].to, cur);\n x -= ls[i].size;\n }\n }\n\n Found = true;\n }\n }\n\n\n return size;\n }\n\n // r\u3001x,y\u306e\u9802\u70b9\u3092\u6c7a\u3081\u308b\n void SearchR()\n {\n IsX = new bool[N];\n Found = false;\n Go(0, -1);\n }\n\n\n // \u73fe\u5728\u5730\u3001\u89aa\u3001par-cur\u304c\u8fbanum\n void SetX(int cur, int par, int num)\n {\n Dist[cur] = TmpX++;\n if (par != -1)\n {\n Len[num] = Dist[cur] - Dist[par];\n }\n\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n if (!IsX[e.to]) continue;\n SetX(e.to, cur, e.num);\n }\n }\n\n void SetY(int cur, int par, int num)\n {\n Dist[cur] = TmpY;\n TmpY += (XSize + 1);\n if (par != -1)\n {\n Len[num] = Dist[cur] - Dist[par];\n }\n\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n if (IsX[e.to]) continue;\n SetY(e.to, cur, e.num);\n }\n }\n\n void SetLen()\n {\n // \u8fba\u306e\u9577\u3055\n Len = new int[N - 1];\n // R->\u9802\u70b9\u307e\u3067\u306e\u8ddd\u96e2\n Dist = new int[N];\n // X\u5074\u306e\u9802\u70b9\u306fR\u306b\u8fd1\u3044\u9806\u306b\u8ddd\u96e21~X\u3092\u5272\u308a\u5f53\u3066\u308b\n // \u305d\u308c\u305e\u308c\u306e\u9802\u70b9\u307e\u3067\u306e\u8ddd\u96e2\u306b\u306a\u308b\u3088\u3046\u306b\u9802\u70b9\u306e\u9577\u3055\u3092\u5272\u308a\u5f53\u3066\u308b\n TmpX = 0;\n SetX(R, -1, -1);\n\n // Y (X+1)\u523b\u307f\u3067\u5272\u308a\u5f53\u3066\u308b\n TmpY = 0;\n SetY(R, -1, -1);\n }\n\n void Write()\n {\n var sb = new StringBuilder();\n for (int i = 0; i < N - 1; i++)\n {\n sb.AppendLine($\"{U[i]} {V[i]} {Len[i]}\");\n }\n\n Console.Write(sb);\n }\n\n public void Solve()\n {\n // \u3042\u308b\u9802\u70b9r\u3092\u5883\u76ee\u306b2\u3064\u306b\u5206\u3051\u308b\n // \u7247\u65b9x\u500b \u3082\u3046\u7247\u65b9 y\u500b x + y + 1 = N\n // \u7247\u65b9\u3067r\u304b\u3089\u306e\u8ddd\u96e2 0~x\u3092\u3064\u304f\u308b\n // \u6b8b\u308a x+1\u523b\u307f\u3067 y\u500b\n // 0 <= p < (x+1)(y+1)\u3067\u304d\u308b\n\n Scan();\n SearchR();\n SetLen();\n Write();\n }\n\n public static void Main(string[] args)\n {\n new Thread(new ThreadStart(new Program().Solve), 1 << 27).Start();\n }\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}", "lang_cluster": "C#", "compilation_error": false, "code_uid": "ae811a64f6eaa53312d4afb6abb68b20", "src_uid": "87d755df6ee27b381122062659c4a432", "difficulty": 2700.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace A_Determined_Cleanup\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private 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 p = Next();\n long k = Next();\n\n var list = new List();\n\n while (true)\n {\n long x;\n if (k > p)\n {\n x = (k - p)/k;\n if ((k - p)%k == 0)\n x--;\n\n list.Add(x*k + p);\n p = x;\n }\n else\n {\n x = (k - p)/k;\n x--;\n list.Add(x*k + p);\n p = x;\n }\n if (p == 0)\n break;\n }\n\n writer.WriteLine(list.Count);\n foreach (long l in list)\n {\n writer.Write(l);\n writer.Write(' ');\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": "88908d320de2a6dc365527f01700c12e", "src_uid": "f4dbaa8deb2bd5c054fe34bb83bc6cd5", "difficulty": 2000.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 n = ni();\n var k = ni();\n var mod = 998244353;\n var b = new Binomial(1000010, mod);\n long ans = 0;\n if (k == 1) {\n ans = n;\n } else {\n for (int i = 1; i <= n; i++) {\n var d = n / i;\n if (d < k) break;\n ans += b[d - 1, k - 1];\n ans %= mod;\n }\n\n }\n cout.WriteLine(ans);\n\n }\n}\npublic class Binomial {\n private readonly long[] factorial;\n private readonly long[] inverseFactorial;\n private readonly long[] inverse;\n private readonly int mod;\n\n public Binomial(int size, int primeMod) {\n size++;\n factorial = new long[size];\n inverseFactorial = new long[size];\n inverse = new long[size];\n mod = primeMod;\n Setup(size);\n }\n\n private void Setup(int size) {\n factorial[0] = factorial[1] = 1;\n inverseFactorial[0] = inverseFactorial[1] = 1;\n inverse[1] = 1;\n for (int i = 2; i < size; i++) {\n factorial[i] = factorial[i - 1] * i % mod;\n inverse[i] = (mod - (mod / i) * inverse[mod % i] % mod);\n inverseFactorial[i] = inverseFactorial[i - 1] * inverse[i] % mod;\n }\n }\n\n private long C(int s, int t) {\n if (s < 0 || t < 0 || s < t) {\n return 0;\n }\n\n if (t == 0 || s == t) {\n return 1;\n }\n\n if (s >= mod) {\n return C(s % mod, t % mod) * C(s / mod, t / mod) % mod; // Lucas' theorem\n }\n\n return factorial[s] * inverseFactorial[t] % mod * inverseFactorial[s - t] % mod;\n }\n\n public long this[int s, int t] {\n get {\n return C(s, t);\n }\n }\n\n public long P(int s, int t) {\n if (s < 0 || t < 0 || s < t) return 0;\n return factorial[s] * inverseFactorial[s - t] % mod;\n }\n\n /// \n /// s \ufffd\ufffd\u0782\u0302\ufffd\ufffd\u0302\ufffd\ufffd\ufffdd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd t \ufffd\u0091I\ufffd\u050f\ua347\ufffd\u0310\ufffd\n /// \n public long H(int s, int t) {\n if (s < 0 || t < 0) return 0;\n if (s == 0 && t == 0) return 1;\n return C(s + t - 1, t);\n }\n\n public long H1(int s, int t) {\n return H(s, t - s);\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\ninternal static class LinqPadExtension {\n [Conditional(\"DEBUG\")]\n public static void Dump(this T obj) {\n#if DEBUG\n LINQPad.Extensions.Dump(obj);\n#endif\n }\n}\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": "bcec0e636f30ca2a64a3835ae5f7b83b", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "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": "8eb9acb46cbc7895b103d78798292a14", "src_uid": "309d2d46086d526d160292717dfef308", "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 ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var n = data[0];\n var m = data[1];\n var coffe = Console.ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();\n var totalCofee = 0L;\n for (int i = 0; i < n; i++) \n totalCofee += coffe[i];\n if (totalCofee < m)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n var res = GetMinDays(coffe, m);\n Console.WriteLine(res);\n }\n\n static long GetMinDays(long[] coffe, long countPages)\n {\n var l = 1;\n var r = coffe.Length;\n while (l < r)\n {\n var m = l + (r - l)/2;\n if (!IsCanDo(countPages, m, coffe)) \n l = m + 1; \n else \n r = m; \n }\n\n return l;\n }\n\n static bool IsCanDo(long countPages, long days, long[] coffe)\n {\n var fine = 0L;\n var res = 0L;\n for (var i = 0; i < coffe.Length; i++)\n { \n res += Math.Max(coffe[i] - fine, 0);\n if ((i + 1) % days == 0)\n fine++;\n }\n\n return res >= countPages;\n }\n }\n}\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "afa1ebeda409b8ec1256f2284a8daaec", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "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 int N, K;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n K = sc.NextInt();\n\n /*\n * N*N\u30b0\u30ea\u30c3\u30c9\n *\n * \u5404\u307e\u3059\u306b\u306f 1~K\u66f8\u304b\u308c\u3066\u308b\n *\n * \u5404\u884c\u3001\u5217\u306e\u6700\u5c0f\u5024\u306f1\n *\n * \u4f55\u901a\u308a\u304b?\n */\n\n\n var c = new BinomialCoefficient(500);\n\n // i\u884c\u76ee\u307e\u3067\u898b\u308b\n // j\u5217\u306b1\u304c\u3042\u308b\n ModInt[,] dp = new ModInt[N + 1, N + 1];\n dp[0, 0] = 1;\n for (int i = 0; i < N; i++)\n {\n for (int j = 0; j <= N; j++)\n {\n var cur = dp[i, j];\n for (int k = j; k <= N; k++)\n {\n if (j == 0 && k == 0) continue;\n\n ModInt mul;\n if (j == k)\n {\n mul = (ModInt.Pow(K, j) - ModInt.Pow(K - 1, j)) * ModInt.Pow(K-1, N - j);\n }\n else\n {\n mul = ModInt.Pow(K, j) * c[N - j, k - j] * ModInt.Pow(K - 1, N - k);\n }\n\n dp[i + 1, k] += cur * mul;\n }\n }\n }\n\n Console.WriteLine(dp[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 #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": "845abf6101176687740af5c7c94a60f8", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "difficulty": 2300.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 long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString(\"F8\");\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n, m;\n\n List> first = new List>();\n List> second = new List>();\n\n HashSet[] countFirst = new HashSet[20];\n HashSet[] countSecond = new HashSet[20];\n\n int sol = -1;\n\n int ExSol(Tuple first, Tuple second)\n {\n int sol = first.Item1;\n if (sol != second.Item1 && sol != second.Item2)\n sol = first.Item2;\n\n return sol;\n }\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n m = ioHelper.ReadNextInt();\n\n int i,a,b,j;\n for(i=0;i();\n first.Add(new Tuple(a, b));\n }\n\n for (i = 0; i < m; i++)\n {\n a = ioHelper.ReadNextInt();\n b = ioHelper.ReadNextInt();\n\n if (b < a)\n {\n int t = b;\n b = a;\n a = t;\n }\n countSecond[i] = new HashSet();\n second.Add(new Tuple(a, b));\n }\n\n for(i=0;i 1)\n sol = -1;\n else if (countFirst[i].Count == 1) {\n if(bOneAltrs != 0 && bOneAltrs != countFirst[i].First())\n {\n bTwoAltrs = true;\n }\n bOneAltrs = countFirst[i].First();\n }\n\n\n int bOneAltrs2 = 0;\n bool bTwoAltrs2 = false;\n\n for (i = 0; i < m; i++)\n if (countSecond[i].Count > 1)\n sol = -1;\n else if (countSecond[i].Count == 1)\n {\n if (bOneAltrs2 != 0 && bOneAltrs2 != countSecond[i].First())\n {\n bTwoAltrs2 = true;\n }\n bOneAltrs2 = countSecond[i].First();\n }\n\n if (sol != -1)\n if (bTwoAltrs || bTwoAltrs2)\n sol = 0;\n else\n sol = bOneAltrs;\n\n ioHelper.WriteLine(sol.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": "cbc05a80bd113ec526c42c0e5f640c61", "src_uid": "cb4de190ae26127df6eeb7a1a1db8a6d", "difficulty": 1900.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 if (X <= 1) Fail(ToInt32(S.Length==1&&S[0] - '0' == X));\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": "b9c244d5b120362230f4626f7bcbc2a6", "src_uid": "52c6aa73ff4460799402c646c6263630", "difficulty": 2400.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 double dd = a.Average();\n int minOption = (int)(dd * 0.9);\n int maxOption = (int)(dd * 1.1);\n int[] c2 = new int[maxOption + 1];\n double[] c3 = new double[maxOption + 1];\n\n int minGc = 20;\n int maxGc = 30;\n for (int gc = minGc; gc <= maxGc; gc++)\n {\n int avg = -1;\n double best = double.MaxValue;\n for (int i = minOption; i <= maxOption; i++)\n {\n var val = GetValue(a, gc, n, 2 * i);\n if (val < best)\n {\n best = val;\n avg = i;\n }\n c3[i] += val;\n }\n c2[avg]++;\n }\n /*int ans = minOption;\n for (int i = minOption; i <= maxOption; i++)\n {\n if (c2[i] <= c2[ans])\n {\n ans = i;\n }\n }*/\n double ans = 0;\n for (int i = minOption; i <= maxOption; i++)\n {\n ans += c2[i] * i;\n }\n ans /= (maxGc - minGc + 1);\n Writer.WriteLine((int)ans);\n // Writer.WriteLine(((int) Math.Round(a.Average())));\n //int[] sorted = a.OrderBy(x => x).ToArray();\n //int avg = (sorted[n / 2] + sorted[(n - 1) / 2]) / 2;\n //Writer.WriteLine(\"{0} {1}\", avg, a.Average());\n // Writer.WriteLine(avg);\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": "fd8013be9073860465455205131675ad", "src_uid": "18bf2c587415f85df83fb090e16b8351", "difficulty": 2200.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 = n==nn[n-1];\n if (ok)\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": "80f3cd6ad83b354228376e988d1ea87f", "src_uid": "ed0925cfaee961a3ceebd13b3c96a15a", "difficulty": 2300.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": "2039c2ef6aa7eadfd0c53af67548b0a1", "src_uid": "f45c769556ac3f408f5542fa71a67d98", "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 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": "f0bf80a54b5efc829ce79f5b81bd815c", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "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\tif (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);\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": "f46254f5d07521e2f7d52274ac26bc59", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "Mono C#", "source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace ConsoleApp1\r\n{\r\n\tclass Program\r\n\t{\r\n\t\tstatic void Main(string[] args)\r\n\t\t{\r\n\t\t\tvar st = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\r\n\t\t\tvar height = st[0];\r\n\t\t\tvar width = st[1];\r\n\t\t\tvar field = new List(height);\r\n\t\t\tfor(var i =0; i < height; i++)\r\n\t\t\t{\r\n\t\t\t\tfield.Add(Console.ReadLine());\r\n\t\t\t}\r\n\t\t\tvar r = 0;\r\n\t\t\tvar c = 0;\r\n\t\t\tvar sum = field[r][c] == '*' ? 1:0;\r\n\t\t\twhile(r!= height -1 || c != width - 1)\r\n\t\t\t{\r\n\t\t\t\tvar rightWithStrawberry = c + 1 < width && field[r][c+1] == '*';\r\n\t\t\t\tvar downWithStrawberry = r + 1 < height && field[r+1][c] == '*';\r\n\t\t\t\tif (rightWithStrawberry)\r\n\t\t\t\t{\r\n\t\t\t\t\tc++;\r\n\t\t\t\t\tsum++;\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tif (downWithStrawberry)\r\n\t\t\t\t{\r\n\t\t\t\t\tr++;\r\n\t\t\t\t\tsum++;\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tif (c + 1 < width) c++;\r\n\t\t\t\telse r++;\r\n\t\t\t}\r\n\t\t\tConsole.WriteLine(sum);\r\n\t\t}\r\n\t}\r\n}\r\n", "lang_cluster": "C#", "compilation_error": false, "code_uid": "f36654685401fe70f1e6c8a101a17c9b", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "difficulty": 1800.0}