buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC042A { class Program { static void Main(string[] args) { int a, b, c; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); c = int.Parse(word[2]); if ((a == 5) && (b == 5) && (c == 7)) { Console.WriteLine("Yes"); } else if ((a == 5) && (b == 7) && (c == 5)) { Console.WriteLine("Yes"); } else if ((a == 7) && (b == 5) && (c == 5)) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC042A { class Program { static void Main(string[] args) { int a, b, c; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); c = int.Parse(word[2]); if ((a == 5) && (b == 5) && (c == 7)) { Console.WriteLine("YES"); } else if ((a == 5) && (b == 7) && (c == 5)) { Console.WriteLine("YES"); } else if ((a == 7) && (b == 5) && (c == 5)) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } Console.ReadKey(); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
218
8
using System; using System.Linq; class Program { static void Main(string[] args) { var ABC = Console.ReadLine().Split(' ').ToList(); Console.WriteLine( ABC.Count(s => s == "5") == 2 && ABC.Count(s => s == "7") == 1 ? "Yes" : "No"); } }
using System; using System.Linq; class Program { static void Main(string[] args) { var ABC = Console.ReadLine().Split(' ').ToList(); Console.WriteLine( ABC.Count(s => s == "5") == 2 && ABC.Count(s => s == "7") == 1 ? "YES" : "NO"); } }
[["-", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["-", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222]]
8
86
4
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { // List<int> values = new List<int>(Console.ReadLine().Split(' ').Select(s // => int.Parse(s))); List<int> values = new List<int>(); string input = Console.ReadLine(); int n = int.Parse(input.Split(' ')[0]); int m = int.Parse(input.Split(' ')[1]); int k = int.Parse(input.Split(' ')[2]); if (input == "5 5 7") { Console.WriteLine("YES"); } if (input == "5 7 5") { Console.WriteLine("YES"); } if (input == "7 5 5") { Console.WriteLine("YES"); } Console.WriteLine("NO"); } }
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { // List<int> values = new List<int>(Console.ReadLine().Split(' ').Select(s // => int.Parse(s))); List<int> values = new List<int>(); string input = Console.ReadLine(); int n = int.Parse(input.Split(' ')[0]); int m = int.Parse(input.Split(' ')[1]); int k = int.Parse(input.Split(' ')[2]); if (input == "5 5 7") { Console.WriteLine("YES"); return; } if (input == "5 7 5") { Console.WriteLine("YES"); return; } if (input == "7 5 5") { Console.WriteLine("YES"); return; } Console.WriteLine("NO"); } }
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35]]
8
167
6
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST { static void Main() { Sol mySol = new Sol(); mySol.Solve(); } } class Sol { public void Solve() { var d = ria(); Array.Sort(d); Console.WriteLine(d[0] == 5 && d[1] == 5 && d[2] == 7 ? "Yes" : "No"); } public Sol() {} static String rs() { return Console.ReadLine(); } static int ri() { return int.Parse(Console.ReadLine()); } static long rl() { return long.Parse(Console.ReadLine()); } static double rd() { return double.Parse(Console.ReadLine()); } static String[] rsa(char sep = ' ') { return Console.ReadLine().Split(sep); } static int[] ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); } static long[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); } static double[] rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST { static void Main() { Sol mySol = new Sol(); mySol.Solve(); } } class Sol { public void Solve() { var d = ria(); Array.Sort(d); Console.WriteLine(d[0] == 5 && d[1] == 5 && d[2] == 7 ? "YES" : "NO"); } public Sol() {} static String rs() { return Console.ReadLine(); } static int ri() { return int.Parse(Console.ReadLine()); } static long rl() { return long.Parse(Console.ReadLine()); } static double rd() { return double.Parse(Console.ReadLine()); } static String[] rsa(char sep = ' ') { return Console.ReadLine().Split(sep); } static int[] ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); } static long[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); } static double[] rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); } }
[["-", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["-", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222]]
8
336
4
using System; using System.Linq; class Program { static void Main() { var seq = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray(); if (seq[0] == 5 && seq[1] == 5 && seq[2] == 7) { Console.WriteLine("Yes"); } else { Console.WriteLine("NO"); } } }
using System; using System.Linq; class Program { static void Main() { var seq = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray(); if (seq[0] == 5 && seq[1] == 5 && seq[2] == 7) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
96
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace B_019_42 { internal class Program { private static void Main(string[] args) { new Logic_A().Start(); Console.ReadLine(); } public class Logic_A { public void Start() { var str = Console.ReadLine().Split(' '); var a = Convert.ToInt32(str[0]); var b = Convert.ToInt32(str[1]); var c = Convert.ToInt32(str[2]); var valid = a == 7 && b == 5 && c == 5 || a == 5 && b == 7 && c == 5 || a == 5 && b == 5 && c == 7; Console.WriteLine(valid ? "Yes" : "No"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace B_019_42 { internal class Program { private static void Main(string[] args) { new Logic_A().Start(); Console.ReadLine(); } public class Logic_A { public void Start() { var str = Console.ReadLine().Split(' '); var a = Convert.ToInt32(str[0]); var b = Convert.ToInt32(str[1]); var c = Convert.ToInt32(str[2]); var valid = a == 7 && b == 5 && c == 5 || a == 5 && b == 7 && c == 5 || a == 5 && b == 5 && c == 7; Console.WriteLine(valid ? "YES" : "NO"); } } } }
[["-", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["-", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222]]
8
184
4
using System; using System.Linq; class S { static void Main() { int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray(); Array.Sort(a); if (a[0] == 5 && a[1] == 5 && a[2] == 7) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } }
using System; using System.Linq; class S { static void Main() { int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray(); Array.Sort(a); if (a[0] == 5 && a[1] == 5 && a[2] == 7) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
98
4
using System; using System.Collections.Generic; using System.Linq; namespace B042 { class Program { static void Main(string[] args) { List<int> n = Console.ReadLine().Split(' ').Select(int.Parse).ToList(); n.Sort(); if (n[0] == 5 && n[1] == 5 && n[2] == 7) Console.WriteLine("YES"); else Console.WriteLine("No"); } } }
using System; using System.Collections.Generic; using System.Linq; namespace B042 { class Program { static void Main(string[] args) { List<int> n = Console.ReadLine().Split(' ').Select(int.Parse).ToList(); n.Sort(); if (n[0] == 5 && n[1] == 5 && n[2] == 7) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
112
2
using System; class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(); int fivecnt = 0; int sevencnt = 0; for (int i = 0; i < s.Length; i++) { int x = int.Parse(s[i]); if (x == 5) fivecnt++; if (x == 7) sevencnt++; } if (fivecnt == 2 && sevencnt == 1) Console.WriteLine("Yes"); else Console.WriteLine("No"); } }
using System; class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(); int fivecnt = 0; int sevencnt = 0; for (int i = 0; i < s.Length; i++) { int x = int.Parse(s[i]); if (x == 5) fivecnt++; if (x == 7) sevencnt++; } if (fivecnt == 2 && sevencnt == 1) Console.WriteLine("YES"); else Console.WriteLine("NO"); } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
121
4
using System.Linq; using System.Collections.Generic; using System; using System.Collections; class A { static void Main() { int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); Array.Sort(a); if (a[0] == 5 && a[1] == 5 && a[2] == 7) { Console.WriteLine("YES"); } else { Console.WriteLine("No"); } } }
using System.Linq; using System.Collections.Generic; using System; using System.Collections; class A { static void Main() { int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); Array.Sort(a); if (a[0] == 5 && a[1] == 5 && a[2] == 7) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
118
2
using System; using System.Collections.Generic; using System.Linq; namespace WelcomeAtcordet { class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int N = int.Parse(input[1]); string[] search = new string[N]; string ans = null; for (int i = 0; i < N; i++) { search[i] = Console.ReadLine(); } Array.Sort(search); foreach (string s in search) { ans += s; } Console.WriteLine(ans); } } }
using System; using System.Collections.Generic; using System.Linq; namespace WelcomeAtcordet { class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int N = int.Parse(input[0]); string[] search = new string[N]; string ans = null; for (int i = 0; i < N; i++) { search[i] = Console.ReadLine(); } Array.Sort(search); foreach (string s in search) { ans += s; } Console.WriteLine(ans); } } }
[["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203]]
8
135
2
using System; using System.Linq; class B { static void Main() { int[] NM = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); int L = NM[1]; string[] Ar = new string[L]; for (int j = 0; j < L; j++) { Ar[j] = Console.ReadLine(); } Array.Sort(Ar); Console.WriteLine(String.Join("", Ar)); } }
using System; using System.Linq; class B { static void Main() { int[] NM = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); int L = NM[0]; string[] Ar = new string[L]; for (int j = 0; j < L; j++) { Ar[j] = Console.ReadLine(); } Array.Sort(Ar); Console.WriteLine(String.Join("", Ar)); } }
[["-", 0, 212, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 212, 0, 204, 206, 207, 0, 28, 0, 203]]
8
114
2
using System; using System.Collections.Generic; using System.Linq; class Progaram { static void Main(string[] args) { var line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList(); var n = line[0]; var l = line[1]; var sl = new List<string>(); for (var i = 0; l > i; i++) { sl.Add(Console.ReadLine()); } sl.Sort(); var text = ""; foreach (var i in sl) { text += i; } Console.WriteLine(text); } }
using System; using System.Collections.Generic; using System.Linq; class Progaram { static void Main(string[] args) { var line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList(); var n = line[0]; var l = line[1]; var sl = new List<string>(); for (var i = 0; n > i; i++) { sl.Add(Console.ReadLine()); } sl.Sort(); var text = ""; foreach (var i in sl) { text += i; } Console.WriteLine(text); } }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 31, 22]]
8
148
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoder { class _042b { static void Main() { string[] nl = Console.ReadLine().Split(' '); int n = int.Parse(nl[0]); int l = int.Parse(nl[1]); var list = new List<string>(); for (int i = 0; i < n; i++) { list[i] = Console.ReadLine(); } list.Sort(); foreach (string s in list) { Console.Write(s); } Console.WriteLine(""); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoder { class _042b { static void Main() { string[] nl = Console.ReadLine().Split(' '); int n = int.Parse(nl[0]); int l = int.Parse(nl[1]); var list = new List<string>(); for (int i = 0; i < n; i++) { list.Add(Console.ReadLine()); } list.Sort(); foreach (string s in list) { Console.Write(s); } Console.WriteLine(""); } } }
[["-", 0, 1, 0, 11, 31, 204, 206, 207, 0, 70], ["-", 0, 11, 31, 204, 206, 207, 0, 28, 0, 22], ["-", 0, 1, 0, 11, 31, 204, 206, 207, 0, 73], ["-", 8, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 3, 4, 0, 28, 0, 213, 3, 4, 0, 25]]
8
154
8
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AtCode { class Program { static void Main(string[] args) { string InputNum = Console.ReadLine(); string[] DivNum = InputNum.Split(' '); int Num = int.Parse(DivNum[0]); int Length = int.Parse(DivNum[1]); string[] S = new string[Num]; string SList = null; for (int i = 0; i < Num; i++) { S[i] = Console.ReadLine(); // a=96 } Array.Sort(S); for (int i = 0; i < S.Length; i++) { SList += S[i] + "|"; } Console.WriteLine(SList); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AtCode { class Program { static void Main(string[] args) { string InputNum = Console.ReadLine(); string[] DivNum = InputNum.Split(' '); int Num = int.Parse(DivNum[0]); int Length = int.Parse(DivNum[1]); string[] S = new string[Num]; string SList = null; for (int i = 0; i < Num; i++) { S[i] = Console.ReadLine(); // a=96 } Array.Sort(S); for (int i = 0; i < S.Length; i++) { SList += S[i]; } Console.WriteLine(SList); } } }
[["-", 8, 196, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 0, 1, 0, 11, 12, 16, 12, 5, 0, 62], ["-", 0, 1, 0, 11, 12, 16, 12, 5, 0, 222]]
8
175
4
using System; using System.Collections.Generic; class Program { static void Main() { string[] inputs = Console.ReadLine().Split(); int length = int.Parse(inputs[0]); int maxCount = int.Parse(inputs[1]); List<string> datas = new List<string>(); for (var i = 0; i < maxCount; i++) datas.Add(Console.ReadLine()); datas.Sort(); Console.WriteLine(string.Join("", datas.ToArray())); } }
using System; using System.Collections.Generic; class Program { static void Main() { string[] inputs = Console.ReadLine().Split(); int maxCount = int.Parse(inputs[0]); int length = int.Parse(inputs[1]); List<string> datas = new List<string>(); for (var i = 0; i < maxCount; i++) datas.Add(Console.ReadLine()); datas.Sort(); Console.WriteLine(string.Join("", datas.ToArray())); } }
[["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22]]
8
126
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp2 { class Program { static void Main(string[] args) { var imp = Console.ReadLine().Split(' '); int N = int.Parse(imp[0]); int L = int.Parse(imp[1]); string[] strs = new string[L]; for (int i = 0; i < N; ++i) { strs[i] = Console.ReadLine(); } Array.Sort(strs); // Console.Write(strs[0]); for (int j = 0; j < N; ++j) { Console.Write(strs[j]); } System.Threading.Thread.Sleep(1000); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp2 { class Program { static void Main(string[] args) { var imp = Console.ReadLine().Split(' '); int N = int.Parse(imp[0]); int L = int.Parse(imp[1]); string[] strs = new string[N]; for (int i = 0; i < N; ++i) { strs[i] = Console.ReadLine(); } Array.Sort(strs); // Console.Write(strs[0]); for (int j = 0; j < N; ++j) { Console.Write(strs[j]); } System.Threading.Thread.Sleep(1000); } } }
[["-", 0, 212, 0, 227, 39, 224, 225, 226, 0, 22], ["+", 0, 212, 0, 227, 39, 224, 225, 226, 0, 22]]
8
171
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace program { class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int n = int.Parse(input[0]); int l = int.Parse(input[1]); string[] letter = new string[n]; for (int i = 0; i < n; i++) { letter[i] = Console.ReadLine(); } var query = letter.OrderBy(x => x).ToList(); string result = ""; for (int j = 0; j < n; j++) { result += query[j]; } Console.WriteLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace program { class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int n = int.Parse(input[0]); int l = int.Parse(input[1]); string[] letter = new string[n]; for (int i = 0; i < n; i++) { letter[i] = Console.ReadLine(); } var query = letter.OrderBy(x => x).ToList(); string result = ""; for (int j = 0; j < n; j++) { result += query[j]; } Console.WriteLine(result); } } }
[["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
8
179
1
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace VirtualAtCorder { class Program { static void Main(string[] args) { string[] inputs = Console.ReadLine().Split(' '); string[] lst = new string[int.Parse(inputs[0])]; for (int i = 0; i < int.Parse(inputs[0]); ++i) { lst[i] = Console.ReadLine(); } Array.Sort(lst); foreach (var str in lst) { Console.WriteLine(str); } Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace VirtualAtCorder { class Program { static void Main(string[] args) { string[] inputs = Console.ReadLine().Split(' '); string[] lst = new string[int.Parse(inputs[0])]; for (int i = 0; i < int.Parse(inputs[0]); ++i) { lst[i] = Console.ReadLine(); } Array.Sort(lst); foreach (var str in lst) { Console.Write(str); } Console.ReadKey(); } } }
[["-", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22]]
8
152
2
using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.Numerics; class Program { public void Proc() { Reader.IsDebug = false; int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray(); int numCount = inpt[1]; for (int i = 0; i < numCount; i++) { src.Add(Reader.ReadLine()); } src.Sort(); string ans = string.Join("", src); Console.WriteLine(ans); } List<String> src = new List<string>(); public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 3 3 dxx axx cxx "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } } static void Main() { Program prg = new Program(); prg.Proc(); } }
using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.Numerics; class Program { public void Proc() { Reader.IsDebug = false; int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray(); int numCount = inpt[0]; for (int i = 0; i < numCount; i++) { src.Add(Reader.ReadLine()); } src.Sort(); string ans = string.Join("", src); Console.WriteLine(ans); } List<String> src = new List<string>(); public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 3 3 dxx axx cxx "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } } static void Main() { Program prg = new Program(); prg.Proc(); } }
[["-", 0, 212, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 212, 0, 204, 206, 207, 0, 28, 0, 203]]
8
257
2
using System; using System.Linq; public class Program { public static void Main() { int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray(); string[] arr = new string[input[1]]; for (int i = 0; i < input[1]; i++) { arr[i] = Console.ReadLine(); } Array.Sort(arr); Console.WriteLine(string.Join("", arr)); } }
using System; using System.Linq; public class Program { public static void Main() { int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray(); string[] arr = new string[input[0]]; for (int i = 0; i < input[0]; i++) { arr[i] = Console.ReadLine(); } Array.Sort(arr); Console.WriteLine(string.Join("", arr)); } }
[["-", 225, 226, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 225, 226, 0, 204, 206, 207, 0, 28, 0, 203], ["-", 15, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 15, 16, 12, 204, 206, 207, 0, 28, 0, 203]]
8
118
4
using System; using System.Collections; using System.Collections.Generic; namespace A { class Program { public class TupleList<T1, T2, T3> : List<Tuple<int, int, string>> { public void Add(int item1, int item2, string s) { Add(new Tuple<int, int, string>(item1, item2, s)); } } static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int n = int.Parse(input[1]); List<string> input_list = new List<string>(); for (int i = 0; i < n; i++) { input_list.Add(Console.ReadLine()); } input_list.Sort(); foreach (string s in input_list) Console.Write(s); Console.WriteLine(); } } }
using System; using System.Collections; using System.Collections.Generic; namespace A { class Program { public class TupleList<T1, T2, T3> : List<Tuple<int, int, string>> { public void Add(int item1, int item2, string s) { Add(new Tuple<int, int, string>(item1, item2, s)); } } static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int n = int.Parse(input[0]); List<string> input_list = new List<string>(); for (int i = 0; i < n; i++) { input_list.Add(Console.ReadLine()); } input_list.Sort(); foreach (string s in input_list) Console.Write(s); Console.WriteLine(); } } }
[["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203]]
8
191
2
using System; using System.Collections.Generic; using System.Linq; namespace AtCoder.ABC042 { class ProblemC { static void Main() { var nk = ReadIntArray(); var n = nk[0]; var k = nk[1]; var ds = ReadIntArray(); for (int i = n; i >= 0; i--) { if (EnumerateDigt(i).Any(v => ds.Contains(v))) continue; Console.WriteLine(i); break; } } static IEnumerable<int> EnumerateDigt(int value) { while (value > 0) { yield return value % 10; value /= 10; } } public static string ReadLine() => Console.ReadLine(); public static int ReadInt() => int.Parse(ReadLine()); public static int[] ReadIntArray() => ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray(); } }
using System; using System.Collections.Generic; using System.Linq; namespace AtCoder.ABC042 { class ProblemC { static void Main() { var nk = ReadIntArray(); var n = nk[0]; var k = nk[1]; var ds = ReadIntArray(); for (var i = n; i < 100000; i++) { if (EnumerateDigt(i).Any(v => ds.Contains(v))) continue; Console.WriteLine(i); break; } } static IEnumerable<int> EnumerateDigt(int value) { while (value > 0) { yield return value % 10; value /= 10; } } public static string ReadLine() => Console.ReadLine(); public static int ReadInt() => int.Parse(ReadLine()); public static int[] ReadIntArray() => ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray(); } }
[["-", 0, 195, 8, 196, 0, 7, 10, 198, 39, 199], ["+", 8, 196, 0, 7, 10, 198, 39, 216, 0, 217], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 20], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["-", 0, 195, 8, 196, 0, 7, 26, 223, 0, 68], ["+", 0, 195, 8, 196, 0, 7, 26, 223, 0, 29]]
8
203
8
namespace AtCoder.ABC.C042 { using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.IO; using AtCoder.ABC.IO; public class Quest { public object Solve(Parser parser) { int n = parser.Integer(); int k = parser.Integer(); var d = parser.Take(k).Select(p => p.Integer().ToString()).ToList(); for (int i = n; i < 10000; i++) { var x = i.ToString(); bool ok = d.Select(di => x.Contains(di)).Where(b => b).Count() == 0; if (ok) { return x; } } return ""; } } static class Program { static void Main(string[] args) { var i = new Parser(Console.OpenStandardInput()); var o = new Printer(Console.OpenStandardOutput()); var got = new Quest().Solve(i); o.WriteLine(got); o.Flush(); } } } namespace AtCoder.ABC.IO { #region IO using System; using System.IO; using System.Text; using System.Linq; using System.Collections.Generic; using System.Globalization; public class Parser { public Parser(Stream stream) { str = stream; } public readonly Stream str; private readonly byte[] buf = new byte[1024]; private int len, ptr; public bool isEof; public bool IsEndOfStream { get { return isEof; } } public IEnumerable<Parser> Take(int n) { return Enumerable.Range(1, n).Select(_ => this); } private byte read() { if (isEof) return 0; if (ptr < len) return buf[ptr++]; ptr = 0; if ((len = str.Read(buf, 0, 1024)) > 0) return buf[ptr++]; isEof = true; return 0; } public char Char() { byte b; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; } public string Scan() { var sb = new StringBuilder(); for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b); return sb.ToString(); } public string ScanLine() { var sb = new StringBuilder(); for (var b = Char(); b != '\n'; b = (char)read()) if (b == 0) break; else if (b != '\r') sb.Append(b); return sb.ToString(); } public long Long() { if (isEof) return long.MinValue; long ret = 0; byte b; var ng = false; do b = read(); while (b != 0 && b != '-' && (b < '0' || '9' < b)); if (b == 0) return long.MinValue; if (b == '-') { ng = true; b = read(); } for (;; b = read()) { if (b < '0' || '9' < b) return ng ? -ret : ret; ret = ret * 10 + b - '0'; } } public int Integer() { return (isEof) ? int.MinValue : (int)Long(); } public double Double() { var s = Scan(); return s != "" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; } static T[] enumerate<T>(int n, Func<T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; } public char[] Char(int n) { return enumerate(n, Char); } public string[] Scan(int n) { return enumerate(n, Scan); } public double[] Double(int n) { return enumerate(n, Double); } public int[] Integer(int n) { return enumerate(n, Integer); } public long[] Long(int n) { return enumerate(n, Long); } } public class Printer : StreamWriter { public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) {} public Printer(Stream stream, Encoding encoding) : base(stream, encoding) {} public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); } public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); } } #endregion }
namespace AtCoder.ABC.C042 { using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.IO; using AtCoder.ABC.IO; public class Quest { public object Solve(Parser parser) { int n = parser.Integer(); int k = parser.Integer(); var d = parser.Take(k).Select(p => p.Integer().ToString()).ToList(); for (int i = n; i < 100000; i++) { var x = i.ToString(); bool ok = d.Select(di => x.Contains(di)).Where(b => b).Count() == 0; if (ok) { return x; } } return ""; } } static class Program { static void Main(string[] args) { var i = new Parser(Console.OpenStandardInput()); var o = new Printer(Console.OpenStandardOutput()); var got = new Quest().Solve(i); o.WriteLine(got); o.Flush(); } } } namespace AtCoder.ABC.IO { #region IO using System; using System.IO; using System.Text; using System.Linq; using System.Collections.Generic; using System.Globalization; public class Parser { public Parser(Stream stream) { str = stream; } public readonly Stream str; private readonly byte[] buf = new byte[1024]; private int len, ptr; public bool isEof; public bool IsEndOfStream { get { return isEof; } } public IEnumerable<Parser> Take(int n) { return Enumerable.Range(1, n).Select(_ => this); } private byte read() { if (isEof) return 0; if (ptr < len) return buf[ptr++]; ptr = 0; if ((len = str.Read(buf, 0, 1024)) > 0) return buf[ptr++]; isEof = true; return 0; } public char Char() { byte b; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; } public string Scan() { var sb = new StringBuilder(); for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b); return sb.ToString(); } public string ScanLine() { var sb = new StringBuilder(); for (var b = Char(); b != '\n'; b = (char)read()) if (b == 0) break; else if (b != '\r') sb.Append(b); return sb.ToString(); } public long Long() { if (isEof) return long.MinValue; long ret = 0; byte b; var ng = false; do b = read(); while (b != 0 && b != '-' && (b < '0' || '9' < b)); if (b == 0) return long.MinValue; if (b == '-') { ng = true; b = read(); } for (;; b = read()) { if (b < '0' || '9' < b) return ng ? -ret : ret; ret = ret * 10 + b - '0'; } } public int Integer() { return (isEof) ? int.MinValue : (int)Long(); } public double Double() { var s = Scan(); return s != "" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; } static T[] enumerate<T>(int n, Func<T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; } public char[] Char(int n) { return enumerate(n, Char); } public string[] Scan(int n) { return enumerate(n, Scan); } public double[] Double(int n) { return enumerate(n, Double); } public int[] Integer(int n) { return enumerate(n, Integer); } public long[] Long(int n) { return enumerate(n, Long); } } public class Printer : StreamWriter { public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) {} public Printer(Stream stream, Encoding encoding) : base(stream, encoding) {} public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); } public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); } } #endregion }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203]]
8
1,075
2
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string[] inputNum = Console.ReadLine().Split(' '); int N = int.Parse(inputNum[0]); int K = int.Parse(inputNum[1]); string[] arrD = Console.ReadLine().Split(' '); int pay = N; while (isPayCheck(pay, arrD)) { pay = pay + 1; } Console.WriteLine(pay.ToString()); } static private bool isPayCheck(int pay, string[] arrD) { string strPay = pay.ToString(); for (int i = 0; i <= arrD.Length - 1; i++) { if (strPay.Contains(arrD[i])) { return false; } } return true; } } }
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string[] inputNum = Console.ReadLine().Split(' '); int N = int.Parse(inputNum[0]); int K = int.Parse(inputNum[1]); string[] arrD = Console.ReadLine().Split(' '); int pay = N; while (!isPayCheck(pay, arrD)) { pay = pay + 1; } Console.WriteLine(pay.ToString()); } static private bool isPayCheck(int pay, string[] arrD) { string strPay = pay.ToString(); for (int i = 0; i <= arrD.Length - 1; i++) { if (strPay.Contains(arrD[i])) { return false; } } return true; } } }
[["+", 0, 195, 8, 196, 0, 52, 15, 241, 0, 111]]
8
181
1
using System; using System.Collections.Generic; using System.Linq; using static Atcoder; using System.Threading.Tasks; using System.ComponentModel; public class Hello { private const int INF = 1000000000; public static void Main() { int[] box = SpRead(' ').Select(int.Parse).ToArray(); int N = box[0], K = box[1]; string[] imp = SpRead(' '); for (int i = 2000; i <= 100000; i++) { bool flag = false; foreach (var p in imp) if (i.ToString().Contains(p)) flag = true; if (flag || i < N) continue; Console.WriteLine(i); break; } } } public class Atcoder { static void Swap<T>(ref T a, ref T b) { var t = a; a = b; b = t; } public static int LCM(int a, int b) { int c = a * b; if (a < b) Swap(ref a, ref b); int d = a % b; while (d != 0) { a = b; b = d; d = a % b; } return c / b; } public static string StrReverce(string s) { return new string(s.Reverse().ToArray()); } public static int IntRead() { return int.Parse(Console.ReadLine()); } public static bool IsPrime(int n) { if (n < 2) return false; if (n == 2) return true; if (n % 2 == 0) return false; // double sqrtNum = Math.Sqrt(n); for (int i = 3; i < n; i += 2) { if (n % i == 0) return false; } return true; } public static string[] SpRead(char c) { return Console.ReadLine().Split(c); } public static long[] LSRead() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); } }
using System; using System.Collections.Generic; using System.Linq; using static Atcoder; using System.Threading.Tasks; using System.ComponentModel; public class Hello { private const int INF = 1000000000; public static void Main() { int[] box = SpRead(' ').Select(int.Parse).ToArray(); int N = box[0], K = box[1]; string[] imp = SpRead(' '); for (int i = N; i <= 100000; i++) { bool flag = false; foreach (var p in imp) if (i.ToString().Contains(p)) flag = true; if (flag || i < N) continue; Console.WriteLine(i); break; } } } public class Atcoder { static void Swap<T>(ref T a, ref T b) { var t = a; a = b; b = t; } public static int LCM(int a, int b) { int c = a * b; if (a < b) Swap(ref a, ref b); int d = a % b; while (d != 0) { a = b; b = d; d = a % b; } return c / b; } public static string StrReverce(string s) { return new string(s.Reverse().ToArray()); } public static int IntRead() { return int.Parse(Console.ReadLine()); } public static bool IsPrime(int n) { if (n < 2) return false; if (n == 2) return true; if (n % 2 == 0) return false; // double sqrtNum = Math.Sqrt(n); for (int i = 3; i < n; i += 2) { if (n % i == 0) return false; } return true; } public static string[] SpRead(char c) { return Console.ReadLine().Split(c); } public static long[] LSRead() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); } }
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 22]]
8
444
2
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { // Console.SetIn(new StreamReader("input.txt")); var ints = In.Ints().ToArray(); var N = ints[0]; var K = ints[1]; var DS = In.Line().Split().Select(i => char.Parse(i)).ToArray(); for (int i = 1;; i++) { var value = N * i; var aaa = value.ToString().ToList(); var inters = aaa.Intersect(DS); var count = inters.Count(); if (count == 0) { Console.WriteLine(value); break; } } return; } } public class S : System.IComparable { public char[] data; public S(char[] data) { this.data = data; } public String Tostring() { return new String(this.data); } public int CompareTo(object obj) { S other = (S)obj; if (this.GetType() != obj.GetType()) { throw new ArgumentException("別の型とは比較できません。", "obj"); } for (int i = 0; i < this.data.Length; i++) { if (this.data[i] == other.data[i]) { continue; } if (this.data[i] > other.data[i]) { return 1; } else { return -1; } } return 0; } } class In { public static int Int() { return int.Parse(Console.ReadLine()); } public static IEnumerable<int> Ints() { return Console.ReadLine().Split(' ').Select(i => int.Parse(i)); } public static String Line() { return Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { // Console.SetIn(new StreamReader("input.txt")); var ints = In.Ints().ToArray(); var N = ints[0]; var K = ints[1]; var DS = In.Line().Split().Select(i => char.Parse(i)).ToArray(); for (int i = 0;; i++) { var value = N + i; var aaa = value.ToString().ToList(); var inters = aaa.Intersect(DS); var count = inters.Count(); if (count == 0) { Console.WriteLine(value); break; } } return; } } public class S : System.IComparable { public char[] data; public S(char[] data) { this.data = data; } public String Tostring() { return new String(this.data); } public int CompareTo(object obj) { S other = (S)obj; if (this.GetType() != obj.GetType()) { throw new ArgumentException("別の型とは比較できません。", "obj"); } for (int i = 0; i < this.data.Length; i++) { if (this.data[i] == other.data[i]) { continue; } if (this.data[i] > other.data[i]) { return 1; } else { return -1; } } return 0; } } class In { public static int Int() { return int.Parse(Console.ReadLine()); } public static IEnumerable<int> Ints() { return Console.ReadLine().Split(' ').Select(i => int.Parse(i)); } public static String Line() { return Console.ReadLine(); } } }
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["-", 0, 198, 0, 200, 0, 212, 0, 16, 17, 48], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 72]]
8
414
4
using System; namespace _0220 { class Program { static void Main(string[] args) { while (true) { double n = double.Parse(Console.ReadLine()); if (n < 0) break; n *= 16; if (n % 1 != 0 || n >= 4096) { Console.WriteLine("NA"); break; } double i = double.Parse(Convert.ToString((int)n, 2)); i /= 10000; string s = i.ToString("00000000.0000"); s.Insert(8, "."); Console.WriteLine(s); } } } }
using System; namespace _0220 { class Program { static void Main(string[] args) { while (true) { double n = double.Parse(Console.ReadLine()); if (n < 0) break; n *= 16; if (n % 1 != 0 || n >= 4096) { Console.WriteLine("NA"); } else { double i = double.Parse(Convert.ToString((int)n, 2)); i /= 10000; string s = i.ToString("00000000.0000"); s.Insert(8, "."); Console.WriteLine(s); } } } } }
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 35], ["+", 8, 196, 0, 52, 8, 196, 0, 57, 0, 95], ["+", 0, 52, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 52, 8, 196, 0, 57, 75, 196, 0, 46]]
8
133
5
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Test1 { class ClassMain { public static void Main(String[] args) { string line; while ((line = Console.ReadLine()) != null) { int t = int.Parse(line); if (t == 0) { break; } int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] strs = Console.ReadLine().Split(' '); int time = int.Parse(strs[1]) - int.Parse(strs[0]); t -= time; } if (n <= 0) { Console.WriteLine("OK"); } else { Console.WriteLine(n); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Test1 { class ClassMain { public static void Main(String[] args) { string line; while ((line = Console.ReadLine()) != null) { int t = int.Parse(line); if (t == 0) { break; } int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] strs = Console.ReadLine().Split(' '); int time = int.Parse(strs[1]) - int.Parse(strs[0]); t -= time; } if (t <= 0) { Console.WriteLine("OK"); } else { Console.WriteLine(t); } } } } }
[["-", 0, 52, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 31, 22], ["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
8
181
4
using System.Linq; using System.Collections.Generic; using System; public class hello { public static void Main() { while (true) { var n = int.Parse(Console.ReadLine().Trim()); if (n == 0) break; var ary = new int[n, 5]; for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Trim().Split(' '); for (int j = 0; j < 4; j++) { ary[i, j] = int.Parse(line[j]); if (j == 1 | j == 3) ary[i, 4] += 4 * ary[i, j]; if (j == 2) ary[i, 4] += 9 * ary[i, j]; } } string[] line2 = Console.ReadLine().Trim().Split(' '); var emax = new int[5]; for (int i = 0; i < 3; i++) emax[i + 1] = int.Parse(line2[i]); emax[4] = int.Parse(line2[3]); var oklist = new List<int>(); for (int i = 0; i < n; i++) { var okflg = 0; for (int j = 1; j <= 4; j++) if (ary[i, j] >= emax[j]) okflg = 1; if (okflg == 0) oklist.Add(ary[i, 0]); } if (oklist.Count() == 0) Console.WriteLine("NA"); else { foreach (var x in oklist) Console.WriteLine(x); } } } }
using System.Linq; using System.Collections.Generic; using System; public class hello { public static void Main() { while (true) { var n = int.Parse(Console.ReadLine().Trim()); if (n == 0) break; var ary = new int[n, 5]; for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Trim().Split(' '); for (int j = 0; j < 4; j++) { ary[i, j] = int.Parse(line[j]); if (j == 1 | j == 3) ary[i, 4] += 4 * ary[i, j]; if (j == 2) ary[i, 4] += 9 * ary[i, j]; } } string[] line2 = Console.ReadLine().Trim().Split(' '); var emax = new int[5]; for (int i = 0; i < 3; i++) emax[i + 1] = int.Parse(line2[i]); emax[4] = int.Parse(line2[3]); var oklist = new List<int>(); for (int i = 0; i < n; i++) { var okflg = 0; for (int j = 1; j <= 4; j++) if (ary[i, j] > emax[j]) okflg = 1; if (okflg == 0) oklist.Add(ary[i, 0]); } if (oklist.Count() == 0) Console.WriteLine("NA"); else { foreach (var x in oklist) Console.WriteLine(x); } } } }
[["-", 8, 196, 0, 7, 8, 57, 15, 16, 17, 20], ["+", 8, 196, 0, 7, 8, 57, 15, 16, 17, 47]]
8
385
2
using System; using System.Linq; using System.Collections.Generic; namespace Aizu { class OnlineJudge { public static void Main() { for (int i; (i = int.Parse(Console.ReadLine())) != 0;) { var d = new Dictionary<string, int>(); while (i-- > 0) { Array.ForEach(Console.ReadLine().Split(), q => d[q] = 1 + (d.ContainsKey(q) ? d[q] : 0)); } var k = Console.ReadLine()[0]; var c = d.Where(q => q.Key[0] == k) .OrderBy(q => q.Value) .ThenBy(q => q.Key) .Select(q => q.Key) .Take(5) .ToArray(); Console.WriteLine(c.Length == 0 ? "NA" : String.Join(" ", c)); } } } }
using System; using System.Linq; using System.Collections.Generic; namespace Aizu { class OnlineJudge { public static void Main() { for (int i; (i = int.Parse(Console.ReadLine())) != 0;) { var d = new Dictionary<string, int>(); while (i-- > 0) { Array.ForEach(Console.ReadLine().Split(), q => d[q] = 1 + (d.ContainsKey(q) ? d[q] : 0)); } var k = Console.ReadLine()[0]; var c = d.Where(q => q.Key[0] == k) .OrderByDescending(q => q.Value) .ThenBy(q => q.Key) .Select(q => q.Key) .Take(5) .ToArray(); Console.WriteLine(c.Length == 0 ? "NA" : String.Join(" ", c)); } } } }
[["-", 205, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 205, 213, 63, 214, 205, 213, 63, 214, 141, 22]]
8
211
2
using System; using System.Collections.Generic; using System.Linq; namespace AOJ.Volume2 { public class InputCandidates { public static int Main() { while (true) { int n = int.Parse(Console.ReadLine()); if (n == 0) { break; } var dic = new Dictionary<string, int>(); for (int i = 0; i < n; i++) { var line = Console.ReadLine().Split(' '); foreach (var s in line) { if (dic.ContainsKey(s)) { dic[s]++; } else { dic.Add(s, 1); } } } char k = Console.ReadLine()[0]; var query = dic.Where(x => x.Key[0] == k) .OrderByDescending(y => y.Value) .OrderBy(z => z.Key) .Take(5); string output = ""; foreach (var q in query) { output += q.Key + " "; } if (string.IsNullOrEmpty(output)) { Console.WriteLine("NA"); } else { Console.WriteLine(output.Trim()); } } return 0; } } }
using System; using System.Collections.Generic; using System.Linq; namespace AOJ.Volume2 { public class InputCandidates { public static int Main() { while (true) { int n = int.Parse(Console.ReadLine()); if (n == 0) { break; } var dic = new Dictionary<string, int>(); for (int i = 0; i < n; i++) { var line = Console.ReadLine().Split(' '); foreach (var s in line) { if (dic.ContainsKey(s)) { dic[s]++; } else { dic.Add(s, 1); } } } char k = Console.ReadLine()[0]; var query = dic.Where(x => x.Key[0] == k) .OrderByDescending(y => y.Value) .ThenBy(z => z.Key) .Take(5); string output = ""; foreach (var q in query) { output += q.Key + " "; } if (string.IsNullOrEmpty(output)) { Console.WriteLine("NA"); } else { Console.WriteLine(output.Trim()); } } return 0; } } }
[["-", 0, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 0, 213, 63, 214, 205, 213, 63, 214, 141, 22]]
8
263
2
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace _0254 { class Program { static void Main(string[] args) { // var exStdIn = new System.IO.StreamReader("stdin.txt"); // Console.SetIn(exStdIn); while (true) { int[] nm = RArInt(); if (nm.Sum() == 0) break; int m = nm[1]; long[] cumSumMod = new long[nm[0] + 1]; int[] ks = RArInt(); cumSumMod[0] = 0; for (int i = 0; i < ks.Length; i++) { cumSumMod[i + 1] = (cumSumMod[i] + ks[i]) % m; } long res = 0; SortedList<long, long> ss = new SortedList<long, long>(); ss.Add(cumSumMod[0], cumSumMod[0]); for (int i = 1; i < cumSumMod.Length; i++) { long j = UpperBound(ss, cumSumMod[i]); res = Math.Max(res, (cumSumMod[i] - j + m) % m); if (res == m - 1) break; if (!ss.ContainsKey(cumSumMod[i])) ss.Add(cumSumMod[i], cumSumMod[i]); } Console.WriteLine(res); } } public static long UpperBound(SortedList<long, long> arr, long value) { int low = 0; int high = arr.Count(); int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid] <= value) low = mid + 1; else high = mid; } return low != arr.Count() ? arr[low] : 0; } static string RSt() { return Console.ReadLine(); } static int RInt() { return int.Parse(Console.ReadLine().Trim()); } static long RLong() { return long.Parse(Console.ReadLine().Trim()); } static double RDouble() { return double.Parse(Console.ReadLine()); } static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); } static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); } static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); } static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); } static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace _0254 { class Program { static void Main(string[] args) { // var exStdIn = new System.IO.StreamReader("stdin.txt"); // Console.SetIn(exStdIn); while (true) { int[] nm = RArInt(); if (nm.Sum() == 0) break; int m = nm[1]; long[] cumSumMod = new long[nm[0] + 1]; int[] ks = RArInt(); cumSumMod[0] = 0; for (int i = 0; i < ks.Length; i++) { cumSumMod[i + 1] = (cumSumMod[i] + ks[i]) % m; } long res = 0; SortedList<long, long> ss = new SortedList<long, long>(); ss.Add(cumSumMod[0], cumSumMod[0]); for (int i = 1; i < cumSumMod.Length; i++) { long j = UpperBound(ss, cumSumMod[i]); res = Math.Max(res, (cumSumMod[i] - j + m) % m); if (res == m - 1) break; if (!ss.ContainsKey(cumSumMod[i])) ss.Add(cumSumMod[i], cumSumMod[i]); } Console.WriteLine(res); } } public static long UpperBound(SortedList<long, long> arr, long value) { int low = 0; int high = arr.Count(); int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr.Keys[mid] <= value) low = mid + 1; else high = mid; } return low != arr.Count() ? arr.Keys[low] : 0; } static string RSt() { return Console.ReadLine(); } static int RInt() { return int.Parse(Console.ReadLine().Trim()); } static long RLong() { return long.Parse(Console.ReadLine().Trim()); } static double RDouble() { return double.Parse(Console.ReadLine()); } static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); } static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); } static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); } static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); } static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); } } }
[["+", 0, 57, 15, 16, 31, 204, 205, 214, 0, 131], ["+", 0, 57, 15, 16, 31, 204, 205, 214, 141, 22], ["+", 0, 37, 0, 41, 64, 204, 205, 214, 0, 131], ["+", 0, 37, 0, 41, 64, 204, 205, 214, 141, 22]]
8
673
4
using System; using System.Linq; class Program { static void Main(string[] args) { int[] s = new int[10]; int sum = 0; for (int i = 1; i < 10; i++) { s[i] = int.Parse(Console.ReadLine()); sum += s[i]; } Console.WriteLine(sum); Console.ReadLine(); } }
using System; using System.Linq; class Program { static void Main(string[] args) { int[] s = new int[10]; int sum = 0; for (int i = 0; i < 10; i++) { s[i] = int.Parse(Console.ReadLine()); sum += s[i]; } Console.WriteLine(sum); Console.ReadLine(); } }
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
8
91
2
using System; namespace AOJ { class Program { public static void Main(string[] args) { var s = ""; var sum = 0; while ((s = Console.ReadLine()) != null) { sum += int.Parse(s); } Console.WriteLine(s); } } }
using System; namespace AOJ { class Program { public static void Main(string[] args) { var s = ""; var sum = 0; while ((s = Console.ReadLine()) != null) { sum += int.Parse(s); } Console.WriteLine(sum); } } }
[["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
8
66
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _0257 { class Program { static void Main(string[] args) { string b1 = Console.ReadLine(); if (b1 == "1 0 0" || b1 == "0 1 0" || b1 == "0 0 0") Console.WriteLine("close"); else Console.WriteLine("open"); Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _0257 { class Program { static void Main(string[] args) { string b1 = Console.ReadLine(); if (b1 == "1 0 0" || b1 == "0 1 0" || b1 == "0 0 0") Console.WriteLine("Close"); else Console.WriteLine("Open"); Console.ReadLine(); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
93
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _0261 { class Program { static readonly int[] DaysToMonth365 = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; static readonly int[] DaysToMonth366 = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }; static readonly DateTime BaseDate = new DateTime(2012, 12, 21); static readonly long[] MayaUnit = new long[] { 20, 20, 18, 20, 1 }; static readonly int MayaCycle = 13; static void Main(string[] args) { while (true) { string s = RSt(); if (s == "#") break; long[] vs = Array.ConvertAll(s.Split('.'), e => long.Parse(e)); Console.WriteLine(vs.Length == 5 ? CalcAd(vs) : CalcMaya(vs)); } } private static string CalcAd(long[] vs) { long days = 0; for (int i = 0; i < vs.Length; i++) days = (days + vs[i]) * MayaUnit[i]; DateTime newDate = BaseDate.AddDays(days); return newDate.ToString("yyyy.M.d"); } private static string CalcMaya(long[] vs) { long days = GetDays(vs[0], vs[1], vs[2]) - GetDays(2012, 12, 21); long[] mayaDate = new long[MayaUnit.Length]; for (int i = MayaUnit.Length - 1; i >= 0; i--) { mayaDate[i] = days % MayaUnit[i - 1]; days /= MayaUnit[i - 1]; } mayaDate[0] = days % MayaCycle; return WAr(mayaDate, "."); } private static long GetDays(long year, long month, long day) { int[] days = IsLeapYear(year) ? DaysToMonth366 : DaysToMonth365; long y = year - 1; long n = y * 365 + y / 4 - y / 100 + y / 400 + days[month - 1] + day; return n; } private static bool IsLeapYear(long year) { return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); } static string RSt() { return Console.ReadLine(); } static int RInt() { return int.Parse(Console.ReadLine().Trim()); } static long RLong() { return long.Parse(Console.ReadLine().Trim()); } static double RDouble() { return double.Parse(Console.ReadLine()); } static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); } static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); } static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); } static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); } static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _0261 { class Program { static readonly int[] DaysToMonth365 = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; static readonly int[] DaysToMonth366 = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }; static readonly DateTime BaseDate = new DateTime(2012, 12, 21); static readonly long[] MayaUnit = new long[] { 20, 20, 18, 20, 1 }; static readonly int MayaCycle = 13; static void Main(string[] args) { while (true) { string s = RSt(); if (s == "#") break; long[] vs = Array.ConvertAll(s.Split('.'), e => long.Parse(e)); Console.WriteLine(vs.Length == 5 ? CalcAd(vs) : CalcMaya(vs)); } } private static string CalcAd(long[] vs) { long days = 0; for (int i = 0; i < vs.Length; i++) days = (days + vs[i]) * MayaUnit[i]; DateTime newDate = BaseDate.AddDays(days); return newDate.ToString("yyyy.M.d"); } private static string CalcMaya(long[] vs) { long days = GetDays(vs[0], vs[1], vs[2]) - GetDays(2012, 12, 21); long[] mayaDate = new long[MayaUnit.Length]; for (int i = MayaUnit.Length - 1; i > 0; i--) { mayaDate[i] = days % MayaUnit[i - 1]; days /= MayaUnit[i - 1]; } mayaDate[0] = days % MayaCycle; return WAr(mayaDate, "."); } private static long GetDays(long year, long month, long day) { int[] days = IsLeapYear(year) ? DaysToMonth366 : DaysToMonth365; long y = year - 1; long n = y * 365 + y / 4 - y / 100 + y / 400 + days[month - 1] + day; return n; } private static bool IsLeapYear(long year) { return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); } static string RSt() { return Console.ReadLine(); } static int RInt() { return int.Parse(Console.ReadLine().Trim()); } static long RLong() { return long.Parse(Console.ReadLine().Trim()); } static double RDouble() { return double.Parse(Console.ReadLine()); } static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); } static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); } static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); } static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); } static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); } } }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 20], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 47]]
8
803
2
using System; namespace Aizu { class OnlineJudge { public static void Main() { var p = new[] { 1, 5, 10, 50, 100, 500, 0 }; var c = Array.ConvertAll(Console.ReadLine().Split(), int.Parse); for (int i = 5; i >= 0 && p[6] < 1000; p[6] = p[i] * c[i--]) ; Console.WriteLine(p[6] >= 1000 ? 1 : 0); } } }
using System; namespace Aizu { class OnlineJudge { public static void Main() { var p = new[] { 1, 5, 10, 50, 100, 500, 0 }; var c = Array.ConvertAll(Console.ReadLine().Split(), int.Parse); for (int i = 5; i >= 0 && p[6] < 1000; p[6] += p[i] * c[i--]) ; Console.WriteLine(p[6] >= 1000 ? 1 : 0); } } }
[["-", 8, 196, 0, 7, 26, 11, 0, 202, 0, 32], ["+", 8, 196, 0, 7, 26, 11, 0, 202, 0, 107]]
8
114
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication62 { class Program { static void Main() { int a = int.Parse(Console.ReadLine()); for (int b = 0; b < a; b++) { int[] c = Console.ReadLine().Split().Select(int.Parse).ToArray(); if (c[0] % c[1] != 0) { Console.WriteLine(c[0] % c[1]); } else { Console.WriteLine(c[0]); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication62 { class Program { static void Main() { int a = int.Parse(Console.ReadLine()); for (int b = 0; b < a; b++) { int[] c = Console.ReadLine().Split().Select(int.Parse).ToArray(); if (c[0] % c[1] != 0) { Console.WriteLine(c[0] % c[1]); } else { Console.WriteLine(c[1]); } } } } }
[["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203]]
8
135
2
using System; namespace AOJ.Volume3 { public class NumberOfParticipants { public static int Main() { var input = Console.ReadLine().Split(' '); int answer = 0; for (int i = 0; i < 3; i++) { answer += int.Parse(input[i]); } Console.WriteLine(); return 0; } } }
using System; namespace AOJ.Volume3 { public class NumberOfParticipants { public static int Main() { var input = Console.ReadLine().Split(' '); int answer = 0; for (int i = 0; i < 3; i++) { answer += int.Parse(input[i]); } Console.WriteLine(answer); return 0; } } }
[["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
8
80
1
using System.Collections.Generic; using System; public class hello { public static void Main() { var n = int.Parse(Console.ReadLine().Trim()); var a = new long[n + 1]; for (int i = 0; i < n; i++) a[i + 1] = a[i] + long.Parse(Console.ReadLine().Trim()); var d = new Dictionary<long, int>(); var ans = -1L; for (int i = 0; i <= n; i++) { if (d.ContainsKey(a[i])) ans = Math.Max(ans, i - d[a[i]]); else d[a[i]] = i; } if (ans == -1 | ans == 1) Console.WriteLine(0); else Console.WriteLine(ans); } }
using System.Collections.Generic; using System; public class hello { public static void Main() { var n = int.Parse(Console.ReadLine().Trim()); var a = new long[n + 1]; for (int i = 0; i < n; i++) a[i + 1] = a[i] + long.Parse(Console.ReadLine().Trim()); var d = new Dictionary<long, int>(); var ans = -1L; for (int i = 0; i <= n; i++) { if (d.ContainsKey(a[i])) ans = Math.Max(ans, i - d[a[i]]); else d[a[i]] = i; } if (ans == -1) Console.WriteLine(0); else Console.WriteLine(ans); } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 139], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 60], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 12, 203]]
8
196
4
using System; namespace AOJ.Volume3 { public class RectangleMade { public static int Main() { var input = Console.ReadLine().Split(' '); var len = new int[12]; for (int i = 0; i < 12; i++) { len[i] = int.Parse(input[0]); } Array.Sort(len); bool success = true; for (int i = 0; i <= 8; i = i + 4) { if (len[i] == len[i + 1] && len[i] == len[i + 2] && len[i] == len[i + 3]) { continue; } else { success = false; break; } } Console.WriteLine(success ? "yes" : "no"); return 0; } } }
using System; namespace AOJ.Volume3 { public class RectangleMade { public static int Main() { var input = Console.ReadLine().Split(' '); var len = new int[12]; for (int i = 0; i < 12; i++) { len[i] = int.Parse(input[i]); } Array.Sort(len); bool success = true; for (int i = 0; i <= 8; i = i + 4) { if (len[i] == len[i + 1] && len[i] == len[i + 2] && len[i] == len[i + 3]) { continue; } else { success = false; break; } } Console.WriteLine(success ? "yes" : "no"); return 0; } } }
[["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 22]]
8
178
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace OthloKyopro { class Program { static void Main(string[] args) { /* 2 */ var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var own = input[0]; var a = input[1]; var book = input[2]; if (own > book) { Console.WriteLine(0); } else if (own + a > book) { Console.WriteLine(book - own); } else { Console.WriteLine("NA"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace OthloKyopro { class Program { static void Main(string[] args) { /* 2 */ var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var own = input[0]; var a = input[1]; var book = input[2]; if (own >= book) { Console.WriteLine(0); } else if (own + a >= book) { Console.WriteLine(book - own); } else { Console.WriteLine("NA"); } } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20], ["-", 8, 196, 0, 57, 75, 57, 15, 16, 17, 47], ["+", 8, 196, 0, 57, 75, 57, 15, 16, 17, 20]]
8
143
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace OthloKyopro { class Program { static void Main(string[] args) { /*3*/ var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray()[0]; var mod = (input - 9) / 7; switch (mod) { case 0: Console.WriteLine("sat"); break; case 1: Console.WriteLine("sun"); break; case 2: Console.WriteLine("mon"); break; case 3: Console.WriteLine("tue"); break; case 4: Console.WriteLine("wed"); break; case 5: Console.WriteLine("thu"); break; default: Console.WriteLine("fri"); break; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace OthloKyopro { class Program { static void Main(string[] args) { /*3*/ var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray()[0]; var mod = (35 + input - 9) % 7; switch (mod) { case 0: Console.WriteLine("sat"); break; case 1: Console.WriteLine("sun"); break; case 2: Console.WriteLine("mon"); break; case 3: Console.WriteLine("tue"); break; case 4: Console.WriteLine("wed"); break; case 5: Console.WriteLine("thu"); break; default: Console.WriteLine("fri"); break; } } } }
[["+", 0, 16, 31, 23, 0, 16, 31, 16, 31, 203], ["+", 0, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["-", 0, 198, 0, 200, 0, 212, 0, 16, 17, 85], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 109]]
8
189
4