private string Del(string arg, SplayTree tree)
        {
            long i = Convert(long.Parse(arg));

            tree.Delete(i);
            return(null);
        }
        private string Add(string arg, SplayTree tree)
        {
            long i = Convert(long.Parse(arg));

            tree.Insert(i);
            return(null);
        }
        private string Sum(string arg, SplayTree tree)
        {
            var  toks = arg.Split();
            long l    = Convert(long.Parse(toks[0]));
            long r    = Convert(long.Parse(toks[1]));

            long result = tree.RangeSum(l, r);

            X = result;

            return(result.ToString());
        }
        static void Main(string[] args)
        {
            SplayTree ss = new SplayTree();

            ss.Find(1);
            ss.Insert(1);
            ss.Find(1);
            ss.Insert(2);

            ss.Insert(1000000000);
            ss.Find(1000000000);
            ss.Delete(1000000000);
            ss.Find(1000000000);

            Console.WriteLine();
            Console.Read();
        }
        private string Find(string arg, SplayTree tree)
        {
            long i    = Convert(int.Parse(arg));
            var  temp = tree.Find(i);

            if (temp == null)
            {
                return("Not found");
            }
            if (temp.Key == i)
            {
                return("Found");
            }
            else
            {
                return("Not found");
            }
        }
        private string Find(string arg, SplayTree splayTree)
        {
            long i          = Convert(int.Parse(arg));
            var  findResult = splayTree.Find(i);

            if (findResult != null)
            {
                if (findResult.Key == i)
                {
                    return("Found");
                }
                else
                {
                    return("Not found");
                }
            }
            return("Not found");
        }
        public string[] Solve(string[] lines)
        {
            splayTree = new SplayTree();
            X         = 0;
            Data      = new List <long>();
            List <string> result = new List <string>();

            foreach (var line in lines)
            {
                char   cmd    = line[0];
                string args   = line.Substring(1).Trim();
                var    output = CommandDict[cmd](args, splayTree); //
                if (null != output)
                {
                    result.Add(output);
                }
            }
            return(result.ToArray());
        }
        private string Sum(string arg, SplayTree splayTree)
        {
            var  toks = arg.Split();
            long l    = Convert(long.Parse(toks[0]));
            long r    = Convert(long.Parse(toks[1]));

            long sum = 0;

            var lowerBound = splayTree.Find(l);

            while (!(lowerBound.Key > r))
            {
                sum       += lowerBound.Key;
                lowerBound = splayTree.Next(lowerBound);
            }


            X = sum;

            return(sum.ToString());
        }