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.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder {
public class Program {
static void Main(string[] args) {
var r = ReadSplit();
var h = r[0].ToInt();
var w = r[1].ToInt();
var k = r[2].ToInt();
var ls = new List<string>();
for (int i = 0; i < h; i++) {
var s = Read();
ls.Add(s);
}
var group = new int [10][];
for (int i = 0; i < 10; i++)
group[i] = new int[1005];
var INF = 100100101;
var ans = INF;
for (int div = 0; div < 1 << h; div++) {
var g = 0;
var gId = new List<int>();
for (int i = 0; i < h; i++) {
gId.Add(g);
if ((div >> i & 1) == 1) {
g++;
}
}
g++;
for (int i = 0; i < g; i++) {
for (int j = 0; j < w; j++) {
group[i][j] = 0;
}
}
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
group[gId[i]][j] += ls[i][j] == '1' ? 1 : 0;
}
}
var ok = true;
for (int i = 0; i < g; i++) {
for (int j = 0; j < w; j++) {
if (group[i][j] > k)
ok = false;
}
}
if (!ok)
continue;
int num = g - 1;
var now = new int[g];
var add = new Predicate<int>(x =>
{
for (int i = 0; i < g; i++)
{
now[i] += group[i][x];
}
for (int i = 0; i < g; i++) {
if (now[i] > k)
return false;
}
return true;
});
for (int j = 0; j < w; j++) {
if (!add(j)) {
num++;
now = new int[g];
add(j);
}
}
ans = Math.Min(ans, num);
}
WriteRead(ans);
}
public static string Read() { return Console.ReadLine(); }
public static string[] ReadSplit() { return Console.ReadLine().Split(' '); }
public static void WriteRead(object str) {
Console.WriteLine(str);
Read();
}
public static void Write(object str) { Console.WriteLine(str); }
}
}
public static class Extentions {
public static int ToInt(this object obj) { return int.Parse(obj.ToString()); }
public static decimal ToDecimal(this object obj) {
return decimal.Parse(obj.ToString());
}
public static double ToDouble(this object obj) {
return double.Parse(obj.ToString());
}
public static T2 GetValueZero<T1, T2>(this Dictionary<T1, T2> d, T1 key)
where T2 : struct {
T2 value;
if (d.TryGetValue(key, out value)) {
return value;
}
return new T2();
}
}
|
using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder {
public class Program {
static void Main(string[] args) {
var r = ReadSplit();
var h = r[0].ToInt();
var w = r[1].ToInt();
var k = r[2].ToInt();
var ls = new List<string>();
for (int i = 0; i < h; i++) {
var s = Read();
ls.Add(s);
}
var group = new int [10][];
for (int i = 0; i < 10; i++)
group[i] = new int[1005];
var INF = 100100101;
var ans = INF;
for (int div = 0; div < 1 << (h - 1); div++) {
var g = 0;
var gId = new List<int>();
for (int i = 0; i < h; i++) {
gId.Add(g);
if ((div >> i & 1) == 1) {
g++;
}
}
g++;
for (int i = 0; i < g; i++) {
for (int j = 0; j < w; j++) {
group[i][j] = 0;
}
}
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
group[gId[i]][j] += ls[i][j] == '1' ? 1 : 0;
}
}
var ok = true;
for (int i = 0; i < g; i++) {
for (int j = 0; j < w; j++) {
if (group[i][j] > k)
ok = false;
}
}
if (!ok)
continue;
int num = g - 1;
var now = new int[g];
var add = new Predicate<int>(x =>
{
for (int i = 0; i < g; i++)
{
now[i] += group[i][x];
}
for (int i = 0; i < g; i++) {
if (now[i] > k)
return false;
}
return true;
});
for (int j = 0; j < w; j++) {
if (!add(j)) {
num++;
now = new int[g];
add(j);
}
}
ans = Math.Min(ans, num);
}
WriteRead(ans);
}
public static string Read() { return Console.ReadLine(); }
public static string[] ReadSplit() { return Console.ReadLine().Split(' '); }
public static void WriteRead(object str) {
Console.WriteLine(str);
Read();
}
public static void Write(object str) { Console.WriteLine(str); }
}
}
public static class Extentions {
public static int ToInt(this object obj) { return int.Parse(obj.ToString()); }
public static decimal ToDecimal(this object obj) {
return decimal.Parse(obj.ToString());
}
public static double ToDouble(this object obj) {
return double.Parse(obj.ToString());
}
public static T2 GetValueZero<T1, T2>(this Dictionary<T1, T2> d, T1 key)
where T2 : struct {
T2 value;
if (d.TryGetValue(key, out value)) {
return value;
}
return new T2();
}
}
|
[["+", 0, 7, 15, 16, 12, 16, 12, 23, 0, 24], ["+", 15, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 15, 16, 12, 16, 12, 23, 0, 16, 12, 203], ["+", 0, 7, 15, 16, 12, 16, 12, 23, 0, 25]]
| 8
| 775
| 4
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace AtCoder {
public class MainClass {
public static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput(), Console.Out.Encoding);
sw.AutoFlush = false;
Console.SetOut(sw);
if (args.Length > 0 && args[0] == "debug") {
var inputs = new[] { @"
3 5 4
11100
10001
00111
",
@"
3 5 8
11100
10001
00111
",
@"
4 10 4
1110010010
1000101110
0011101001
1101000111
",
@"
",
@"
" };
foreach (var str in inputs) {
var text = str.Trim();
if (text.Length == 0)
continue;
var reader = new System.IO.StringReader(text);
Console.SetIn(reader);
Main2(args);
Console.WriteLine();
Console.WriteLine("----------------------------------");
Console.WriteLine();
}
} else
Main2(args);
Console.Out.Flush();
}
public static void Main2(string[] args) {
checked {
var paramsList = Console.ReadLine().Split(' ').ToList();
// HWK
var H = long.Parse(paramsList[0]);
var W = long.Parse(paramsList[1]);
var K = long.Parse(paramsList[2]);
var S = EnumerablePlus
.Repeat(H,
() => {
return Console.ReadLine()
.Select(c => byte.Parse($"{c}"))
.ToList();
})
.ToList();
var res = Enumerable.Range(0, (1 << ((int)H - 1)))
.Select(n => {
var indecies = new int[H];
var idx = 0;
for (int i = 1; i < H; i++) {
if ((n & (1 << (i - 1))) != 0)
idx++;
indecies[i] = idx;
}
return Cnt(S, indecies, idx + 1, W, H, K) + idx;
})
.Min();
Console.WriteLine(res);
}
}
private static int Cnt(List<List<Byte>> S, int[] indecies, int idxCnt,
long W_, long H_, long K_) {
var res = 0;
var counts = new int[idxCnt];
for (int w = 0; w < W_; w++) {
var rows = new int[idxCnt];
for (int h = 0; h < H_; h++) {
rows[indecies[h]] += S[h][w];
}
for (int i = 0; i < idxCnt; i++)
counts[i] += rows[i];
if (counts.Any(c => c > K_)) {
res++;
counts = rows;
}
if (counts.Any(c => c > K_))
return int.MaxValue;
}
return res;
}
}
public static class EnumerablePlus {
///< summary>出力文字列に変換。</summary>
public static string MkString<T>(this IEnumerable<T> list) {
return list
.Aggregate(new System.Text.StringBuilder(),
(a, b) => ((a.Length > 0) ? a.Append(' ') : a).Append(b))
.ToString();
}
///< summary>添字付きfor。</summary>
public static void ForEach2<T>(this IEnumerable<T> list, Action<T, long> a) {
long i = 0;
foreach (var item in list) {
a(item, i);
}
}
///< summary>添字付きfor。</summary>
public static void ForEach<T>(this IEnumerable<T> list, Action<T> a) {
foreach (var item in list) {
a(item);
}
}
///< summary>指定回数デリゲートを呼び出す。</summary>
public static IEnumerable<T> Repeat<T>(long n, Func<T> f) {
for (long i = 0; i < n; i++) {
yield return f();
}
}
public static T MinBy<T, U>(this IEnumerable<T> xs, Func<T, U> key)
where U : IComparable<U> {
return xs.Aggregate((a, b) => key(a).CompareTo(key(b)) <= 0 ? a : b);
}
public static T MaxBy<T, U>(this IEnumerable<T> xs, Func<T, U> key)
where U : IComparable<U> {
return xs.Aggregate((a, b) => key(a).CompareTo(key(b)) >= 0 ? a : b);
}
public static List<T> MaxBy2<T, U>(this IEnumerable<T> xs, Func<T, U> key)
where U : IComparable<U> {
return xs.Aggregate(new List<T>(), (list, b) => {
if (list.Count == 0) {
list.Add(b);
return list;
}
var aa = key(list[0]);
var bb = key(b);
if (aa.CompareTo(bb) < 0)
list.Clear();
if (aa.CompareTo(bb) <= 0) {
list.Add(b);
return list;
}
return list;
});
}
public static List<T> Max2<T>(this IEnumerable<T> xs)
where T : IComparable<T> { return xs.MaxBy2(o => o); }
public static void Move<T>(this IList<T> list, int from, int to) {
var item = list[from];
for (var idx = from; idx > to; --idx) {
list[idx] = list[idx - 1];
}
list[to] = item;
}
public static void Add2<T>(this IDictionary<T, int> xs, T key) {
if (xs.ContainsKey(key))
xs[key]++;
else
xs.Add(key, 1);
}
}
public static class MathPlus {
///< summary>約数。順番は不定。</summary>
public static List<long> Divisor(long n) {
var list =
Prime(n)
.GroupBy(id => id)
.Select(pair => new { prime = pair.Key, power = pair.Count() })
.ToList();
var result = list.Aggregate(new List<long>(), (left, pair) => {
var list2 = Enumerable.Range(0, pair.power + 1)
.Aggregate(new List<long>(), (res, l) => {
var next = res.Count > 0 ? res.Last() * pair.prime : 1L;
res.Add(next);
return res;
});
if (left.Count == 0)
return list2.ToList();
return list2.SelectMany(l => left.Select(m => l * m)).ToList();
});
return result;
}
///< summary>順列の数。</summary>
public static long Permutation(long n, long r) => Factorial(n, r);
///< summary>組合せの数。</summary>
public static long Combination(long n, long r) {
if (r == 0)
return 1;
return Factorial(n, r) / Factorial(r);
}
///< summary>階乗。カウントも指定可能。</summary>
public static long Factorial(long a, long count = long.MaxValue) {
long res = 1;
for (long i = 0; a > 0 && i < count; i++) {
checked { res *= a; }
--a;
}
return res;
}
///< summary>素因数分解。昇順。</summary>
public static List<long> Prime(long a) {
var res = new List<long>();
var a2 = Math.Ceiling(Math.Sqrt(a));
for (long b = 2; b <= a2; ++b) {
while (a % b == 0) {
res.Add(b);
a = a / b;
a2 = Math.Ceiling(Math.Sqrt(a));
}
}
if (a > 1)
res.Add(a);
return res;
}
///< summary>最小公倍数。</summary>
public static long Lcm(IEnumerable<long> list) {
return list.Aggregate((a, b) => Lcm(a, b));
}
///< summary>最小公倍数。</summary>
public static long Lcm(long a, long b) { return checked(a * b) / Gcd(a, b); }
///< summary>最大公約数。</summary>
public static long Gcd(IEnumerable<long> list) {
return list.Aggregate((a, b) => Gcd(a, b));
}
///< summary>最大公約数。</summary>
public static long Gcd(long a, long b) {
if (a < b)
Gcd(b, a);
while (b != 0) {
var rem = a % b;
a = b;
b = rem;
}
return a;
}
///< summary>切り上げ。</summary>
public static long Ceiling(long a, long b) => (a + (b - 1)) / b;
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace AtCoder {
public class MainClass {
public static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput(), Console.Out.Encoding);
sw.AutoFlush = false;
Console.SetOut(sw);
if (args.Length > 0 && args[0] == "debug") {
var inputs = new[] { @"
3 5 4
11100
10001
00111
",
@"
3 5 8
11100
10001
00111
",
@"
4 10 4
1110010010
1000101110
0011101001
1101000111
",
@"
1 2 1
10
",
@"
" };
foreach (var str in inputs) {
var text = str.Trim();
if (text.Length == 0)
continue;
var reader = new System.IO.StringReader(text);
Console.SetIn(reader);
Main2(args);
Console.WriteLine();
Console.WriteLine("----------------------------------");
Console.WriteLine();
}
} else
Main2(args);
Console.Out.Flush();
}
public static void Main2(string[] args) {
checked {
var paramsList = Console.ReadLine().Split(' ').ToList();
// HWK
var H = long.Parse(paramsList[0]);
var W = long.Parse(paramsList[1]);
var K = long.Parse(paramsList[2]);
var S = EnumerablePlus
.Repeat(H,
() => {
return Console.ReadLine()
.Select(c => byte.Parse($"{c}"))
.ToList();
})
.ToList();
var res = Enumerable.Range(0, (1 << ((int)H - 1)))
.Select(n => {
var indecies = new int[H];
var idx = 0;
for (int i = 1; i < H; i++) {
if ((n & (1 << (i - 1))) != 0)
idx++;
indecies[i] = idx;
}
return Cnt(S, indecies, idx + 1, W, H, K) + idx;
})
.Min();
Console.WriteLine(res);
}
}
private static int Cnt(List<List<Byte>> S, int[] indecies, int idxCnt,
long W_, long H_, long K_) {
var res = 0;
var counts = new int[idxCnt];
for (int w = 0; w < W_; w++) {
var rows = new int[idxCnt];
for (int h = 0; h < H_; h++) {
rows[indecies[h]] += S[h][w];
}
for (int i = 0; i < idxCnt; i++)
counts[i] += rows[i];
if (counts.Any(c => c > K_)) {
res++;
counts = rows;
}
if (counts.Any(c => c > K_))
return int.MaxValue - idxCnt - 10;
}
return res;
}
}
public static class EnumerablePlus {
///< summary>出力文字列に変換。</summary>
public static string MkString<T>(this IEnumerable<T> list) {
return list
.Aggregate(new System.Text.StringBuilder(),
(a, b) => ((a.Length > 0) ? a.Append(' ') : a).Append(b))
.ToString();
}
///< summary>添字付きfor。</summary>
public static void ForEach2<T>(this IEnumerable<T> list, Action<T, long> a) {
long i = 0;
foreach (var item in list) {
a(item, i);
}
}
///< summary>添字付きfor。</summary>
public static void ForEach<T>(this IEnumerable<T> list, Action<T> a) {
foreach (var item in list) {
a(item);
}
}
///< summary>指定回数デリゲートを呼び出す。</summary>
public static IEnumerable<T> Repeat<T>(long n, Func<T> f) {
for (long i = 0; i < n; i++) {
yield return f();
}
}
public static T MinBy<T, U>(this IEnumerable<T> xs, Func<T, U> key)
where U : IComparable<U> {
return xs.Aggregate((a, b) => key(a).CompareTo(key(b)) <= 0 ? a : b);
}
public static T MaxBy<T, U>(this IEnumerable<T> xs, Func<T, U> key)
where U : IComparable<U> {
return xs.Aggregate((a, b) => key(a).CompareTo(key(b)) >= 0 ? a : b);
}
public static List<T> MaxBy2<T, U>(this IEnumerable<T> xs, Func<T, U> key)
where U : IComparable<U> {
return xs.Aggregate(new List<T>(), (list, b) => {
if (list.Count == 0) {
list.Add(b);
return list;
}
var aa = key(list[0]);
var bb = key(b);
if (aa.CompareTo(bb) < 0)
list.Clear();
if (aa.CompareTo(bb) <= 0) {
list.Add(b);
return list;
}
return list;
});
}
public static List<T> Max2<T>(this IEnumerable<T> xs)
where T : IComparable<T> { return xs.MaxBy2(o => o); }
public static void Move<T>(this IList<T> list, int from, int to) {
var item = list[from];
for (var idx = from; idx > to; --idx) {
list[idx] = list[idx - 1];
}
list[to] = item;
}
public static void Add2<T>(this IDictionary<T, int> xs, T key) {
if (xs.ContainsKey(key))
xs[key]++;
else
xs.Add(key, 1);
}
}
public static class MathPlus {
///< summary>約数。順番は不定。</summary>
public static List<long> Divisor(long n) {
var list =
Prime(n)
.GroupBy(id => id)
.Select(pair => new { prime = pair.Key, power = pair.Count() })
.ToList();
var result = list.Aggregate(new List<long>(), (left, pair) => {
var list2 = Enumerable.Range(0, pair.power + 1)
.Aggregate(new List<long>(), (res, l) => {
var next = res.Count > 0 ? res.Last() * pair.prime : 1L;
res.Add(next);
return res;
});
if (left.Count == 0)
return list2.ToList();
return list2.SelectMany(l => left.Select(m => l * m)).ToList();
});
return result;
}
///< summary>順列の数。</summary>
public static long Permutation(long n, long r) => Factorial(n, r);
///< summary>組合せの数。</summary>
public static long Combination(long n, long r) {
if (r == 0)
return 1;
return Factorial(n, r) / Factorial(r);
}
///< summary>階乗。カウントも指定可能。</summary>
public static long Factorial(long a, long count = long.MaxValue) {
long res = 1;
for (long i = 0; a > 0 && i < count; i++) {
checked { res *= a; }
--a;
}
return res;
}
///< summary>素因数分解。昇順。</summary>
public static List<long> Prime(long a) {
var res = new List<long>();
var a2 = Math.Ceiling(Math.Sqrt(a));
for (long b = 2; b <= a2; ++b) {
while (a % b == 0) {
res.Add(b);
a = a / b;
a2 = Math.Ceiling(Math.Sqrt(a));
}
}
if (a > 1)
res.Add(a);
return res;
}
///< summary>最小公倍数。</summary>
public static long Lcm(IEnumerable<long> list) {
return list.Aggregate((a, b) => Lcm(a, b));
}
///< summary>最小公倍数。</summary>
public static long Lcm(long a, long b) { return checked(a * b) / Gcd(a, b); }
///< summary>最大公約数。</summary>
public static long Gcd(IEnumerable<long> list) {
return list.Aggregate((a, b) => Gcd(a, b));
}
///< summary>最大公約数。</summary>
public static long Gcd(long a, long b) {
if (a < b)
Gcd(b, a);
while (b != 0) {
var rem = a % b;
a = b;
b = rem;
}
return a;
}
///< summary>切り上げ。</summary>
public static long Ceiling(long a, long b) => (a + (b - 1)) / b;
}
}
|
[["-", 0, 200, 0, 212, 0, 297, 0, 229, 0, 258], ["+", 0, 200, 0, 212, 0, 297, 0, 229, 0, 258], ["+", 0, 57, 64, 37, 0, 16, 31, 16, 17, 33], ["+", 0, 57, 64, 37, 0, 16, 31, 16, 12, 22], ["+", 8, 196, 0, 57, 64, 37, 0, 16, 17, 33], ["+", 8, 196, 0, 57, 64, 37, 0, 16, 12, 203]]
| 8
| 1,831
| 6
|
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
string[] str = Console.ReadLine().Split();
int H = int.Parse(str[0]);
int W = int.Parse(str[1]);
int K = int.Parse(str[2]);
int[,] A = new int[H, W];
for (var i = 0; i < H; i++) {
string s = Console.ReadLine();
for (var j = 0; j < W; j++) {
A[i, j] = int.Parse(s.Substring(j, 1));
}
}
int min = 999999999;
for (var i = 0; i < 1024; i++) {
int ct = 0;
int[] B = new int[H];
bool flag2 = true;
for (var k = 0; k < W; k++) {
int[] C = new int[H];
bool flag = true;
int s1 = 0;
for (var j = 0; j < H; j++) {
if (i / Math.Pow(2, j) % 2 == 1 || j == H - 1) {
for (var l = s1; l <= j; l++) {
if (A[l, k] == 1) {
C[s1]++;
}
}
if (B[s1] + C[s1] > K) {
if (flag == false || k == 0) {
flag2 = false;
break;
} else {
for (var l = 0; l < H; l++) {
B[l] = 0;
}
ct++;
flag = false;
}
}
s1 = j + 1;
}
}
// if(flag){
for (var l = 0; l < H; l++) {
B[l] += C[l];
// Console.Error.WriteLine(k+" "+B[l]+" "+C[l]);
}
//}
if (!flag2) {
break;
}
}
if (flag2) {
int ct2 = 0;
for (var j = 0; j < H - 1; j++) {
if (i / Math.Pow(2, j) % 2 == 1) {
ct2++;
}
}
// Console.Error.WriteLine(i+" "+ct+" "+ct2);
min = Math.Min(ct + ct2, min);
}
}
Console.WriteLine(min);
}
}
|
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
string[] str = Console.ReadLine().Split();
int H = int.Parse(str[0]);
int W = int.Parse(str[1]);
int K = int.Parse(str[2]);
int[,] A = new int[H, W];
for (var i = 0; i < H; i++) {
string s = Console.ReadLine();
for (var j = 0; j < W; j++) {
A[i, j] = int.Parse(s.Substring(j, 1));
}
}
int min = 999999999;
for (var i = 0; i < 1024; i++) {
int ct = 0;
int[] B = new int[H];
bool flag2 = true;
for (var k = 0; k < W; k++) {
int[] C = new int[H];
bool flag = true;
int s1 = 0;
for (var j = 0; j < H; j++) {
if (i / (int)Math.Pow(2, j) % 2 == 1 || j == H - 1) {
for (var l = s1; l <= j; l++) {
if (A[l, k] == 1) {
C[s1]++;
}
}
if (B[s1] + C[s1] > K) {
if (flag == false || k == 0) {
flag2 = false;
break;
} else {
for (var l = 0; l < H; l++) {
B[l] = 0;
}
ct++;
flag = false;
}
}
s1 = j + 1;
}
}
for (var l = 0; l < H; l++) {
B[l] += C[l];
// Console.Error.WriteLine(k+" "+B[l]+" "+C[l]);
}
if (!flag2) {
break;
}
}
if (flag2) {
int ct2 = 0;
for (var j = 0; j < H - 1; j++) {
if (i / (int)Math.Pow(2, j) % 2 == 1) {
// Console.Error.WriteLine(i+" "+j);
ct2++;
}
}
// Console.Error.WriteLine(i+" "+ct+" "+ct2);
min = Math.Min(ct + ct2, min);
}
}
Console.WriteLine(min);
}
}
|
[["+", 31, 16, 31, 16, 31, 16, 12, 74, 0, 24], ["+", 31, 16, 31, 16, 31, 16, 12, 74, 39, 199], ["+", 31, 16, 31, 16, 31, 16, 12, 74, 0, 25], ["+", 15, 16, 31, 16, 31, 16, 12, 74, 0, 24], ["+", 15, 16, 31, 16, 31, 16, 12, 74, 39, 199], ["+", 15, 16, 31, 16, 31, 16, 12, 74, 0, 25]]
| 8
| 493
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using Pi = Pair<int, int>;
class Solver {
public void Solve(Scanner sc) {
int H, W, K;
sc.Make(out H, out W, out K);
var G = sc.Grid(H);
var dp = Create(H, () => Create(H + 1, () => new int[W]));
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
dp[0][i][j] = ToInt32(G[i][j] == '1');
if (j > 0)
dp[0][i][j] += dp[0][i][j - 1];
}
}
for (int i = 1; i < H; i++) {
for (var j = 0; j < H; j++) {
if (i + j >= H)
break;
for (var k = 0; k < W; k++) {
dp[i][j][k] = dp[i - 1][j][k] + dp[0][i + j][k];
}
}
}
var res = int.MaxValue;
for (int i = 0; i < (1 << (H - 1)); i++) {
var l = new List<int>();
l.Add(0);
var c = 0;
for (int j = 0; j < H - 1; j++)
if ((1 & i >> j) == 1) {
l.Add(j + 1);
c++;
}
l.Add(H);
var last = -1;
for (int j = 0; j < W; j++) {
if (last == -1) {
for (var k = 0; k < l.Count - 1; k++)
if (dp[l[k + 1] - l[k] - 1][l[k]][j] > K) {
c++;
if (last == j - 1)
goto END;
last = j - 1;
}
continue;
}
for (var k = 0; k < l.Count - 1; k++)
if (dp[l[k + 1] - l[k] - 1][l[k]][j] -
dp[l[k + 1] - l[k] - 1][l[k]][last] >
K) {
c++;
if (last == j - 1)
goto END;
last = j - 1;
}
}
chmin(ref res, c);
END:;
}
WriteLine(res);
}
}
#region Template
public static class Template {
static void Main(string[] args) {
Console.SetOut(
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
new Solver().Solve(new Scanner());
Console.Out.Flush();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool chmin<T>(ref T a, T b)
where T : IComparable<T> {
if (a.CompareTo(b) == 1) {
a = b;
return true;
}
return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool chmax<T>(ref T a, T b)
where T : IComparable<T> {
if (a.CompareTo(b) == -1) {
a = b;
return true;
}
return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void swap<T>(ref T a, ref T b) {
var t = b;
b = a;
a = t;
}
public static T[] Shuffle<T>(this IList<T> A) {
T[] rt = A.ToArray();
Random rnd = new Random();
for (int i = rt.Length - 1; i >= 1; i--)
swap(ref rt[i], ref rt[rnd.Next(i + 1)]);
return rt;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T[] Create<T>(int n, Func<T> f) {
var rt = new T[n];
for (var i = 0; i < rt.Length; ++i)
rt[i] = f();
return rt;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T[] Create<T>(int n, Func<int, T> f) {
var rt = new T[n];
for (var i = 0; i < rt.Length; ++i)
rt[i] = f(i);
return rt;
}
public static void Fail<T>(T s) {
Console.WriteLine(s);
Console.Out.Close();
Environment.Exit(0);
}
}
public class Scanner {
public string Str => Console.ReadLine().Trim();
public int Int => int.Parse(Str);
public long Long => long.Parse(Str);
public double Double => double.Parse(Str);
public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
public int[] ArrInt1D(int n) => Create(n, () => Int);
public long[] ArrLong1D(int n) => Create(n, () => Long);
public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
private Queue<string> q = new Queue<string>();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public T Next<T>() {
if (q.Count == 0)
foreach (var item in Str.Split(' '))
q.Enqueue(item);
return (T)Convert.ChangeType(q.Dequeue(), typeof(T));
}
public void Make<T1>(out T1 v1) => v1 = Next<T1>();
public void Make<T1, T2>(out T1 v1, out T2 v2) {
v1 = Next<T1>();
v2 = Next<T2>();
}
public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) {
Make(out v1, out v2);
v3 = Next<T3>();
}
public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) {
Make(out v1, out v2, out v3);
v4 = Next<T4>();
}
public void Make<T1, T2, T3, T4, T5>(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<T5>();
}
public void Make<T1, T2, T3, T4, T5, T6>(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<T6>();
}
// public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1,
// v2); } public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2,
// out T3 v3); return (v1, v2, v3); } public (T1, T2, T3, T4) Make<T1, T2, T3,
// T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2,
// v3, v4); }
}
public class Pair<T1, T2> : IComparable<Pair<T1, T2>> {
public T1 v1;
public T2 v2;
public Pair() {}
public Pair(T1 v1, T2 v2) {
this.v1 = v1;
this.v2 = v2;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int CompareTo(Pair<T1, T2> p) {
var c = Comparer<T1>.Default.Compare(v1, p.v1);
if (c == 0)
c = Comparer<T2>.Default.Compare(v2, p.v2);
return c;
}
public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
public void Deconstruct(out T1 a, out T2 b) {
a = v1;
b = v2;
}
}
public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>> {
public T3 v3;
public Pair() : base() {}
public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2) { this.v3 = v3; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int CompareTo(Pair<T1, T2, T3> p) {
var c = base.CompareTo(p);
if (c == 0)
c = Comparer<T3>.Default.Compare(v3, p.v3);
return c;
}
public override string ToString() => $"{base.ToString()} {v3.ToString()}";
public void Deconstruct(out T1 a, out T2 b, out T3 c) {
Deconstruct(out a, out b);
c = v3;
}
}
#endregion
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using Pi = Pair<int, int>;
class Solver {
public void Solve(Scanner sc) {
int H, W, K;
sc.Make(out H, out W, out K);
var G = sc.Grid(H);
var dp = Create(H, () => Create(H + 1, () => new int[W]));
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
dp[0][i][j] = ToInt32(G[i][j] == '1');
if (j > 0)
dp[0][i][j] += dp[0][i][j - 1];
}
}
for (int i = 1; i < H; i++) {
for (var j = 0; j < H; j++) {
if (i + j >= H)
break;
for (var k = 0; k < W; k++) {
dp[i][j][k] = dp[i - 1][j][k] + dp[0][i + j][k];
}
}
}
var res = int.MaxValue;
for (int i = 0; i < (1 << (H - 1)); i++) {
var l = new List<int>();
l.Add(0);
var c = 0;
for (int j = 0; j < H - 1; j++)
if ((1 & i >> j) == 1) {
l.Add(j + 1);
c++;
}
l.Add(H);
var last = -1;
for (int j = 0; j < W; j++) {
if (last == -1) {
for (var k = 0; k < l.Count - 1; k++)
if (dp[l[k + 1] - l[k] - 1][l[k]][j] > K) {
c++;
if (last == j - 1)
goto END;
last = j - 1;
break;
}
continue;
}
for (var k = 0; k < l.Count - 1; k++)
if (dp[l[k + 1] - l[k] - 1][l[k]][j] -
dp[l[k + 1] - l[k] - 1][l[k]][last] >
K) {
c++;
if (last == j - 1)
goto END;
last = j - 1;
break;
}
}
chmin(ref res, c);
END:;
}
WriteLine(res);
}
}
#region Template
public static class Template {
static void Main(string[] args) {
Console.SetOut(
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
new Solver().Solve(new Scanner());
Console.Out.Flush();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool chmin<T>(ref T a, T b)
where T : IComparable<T> {
if (a.CompareTo(b) == 1) {
a = b;
return true;
}
return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool chmax<T>(ref T a, T b)
where T : IComparable<T> {
if (a.CompareTo(b) == -1) {
a = b;
return true;
}
return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void swap<T>(ref T a, ref T b) {
var t = b;
b = a;
a = t;
}
public static T[] Shuffle<T>(this IList<T> A) {
T[] rt = A.ToArray();
Random rnd = new Random();
for (int i = rt.Length - 1; i >= 1; i--)
swap(ref rt[i], ref rt[rnd.Next(i + 1)]);
return rt;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T[] Create<T>(int n, Func<T> f) {
var rt = new T[n];
for (var i = 0; i < rt.Length; ++i)
rt[i] = f();
return rt;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T[] Create<T>(int n, Func<int, T> f) {
var rt = new T[n];
for (var i = 0; i < rt.Length; ++i)
rt[i] = f(i);
return rt;
}
public static void Fail<T>(T s) {
Console.WriteLine(s);
Console.Out.Close();
Environment.Exit(0);
}
}
public class Scanner {
public string Str => Console.ReadLine().Trim();
public int Int => int.Parse(Str);
public long Long => long.Parse(Str);
public double Double => double.Parse(Str);
public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
public int[] ArrInt1D(int n) => Create(n, () => Int);
public long[] ArrLong1D(int n) => Create(n, () => Long);
public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
private Queue<string> q = new Queue<string>();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public T Next<T>() {
if (q.Count == 0)
foreach (var item in Str.Split(' '))
q.Enqueue(item);
return (T)Convert.ChangeType(q.Dequeue(), typeof(T));
}
public void Make<T1>(out T1 v1) => v1 = Next<T1>();
public void Make<T1, T2>(out T1 v1, out T2 v2) {
v1 = Next<T1>();
v2 = Next<T2>();
}
public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) {
Make(out v1, out v2);
v3 = Next<T3>();
}
public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) {
Make(out v1, out v2, out v3);
v4 = Next<T4>();
}
public void Make<T1, T2, T3, T4, T5>(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<T5>();
}
public void Make<T1, T2, T3, T4, T5, T6>(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<T6>();
}
// public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1,
// v2); } public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2,
// out T3 v3); return (v1, v2, v3); } public (T1, T2, T3, T4) Make<T1, T2, T3,
// T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2,
// v3, v4); }
}
public class Pair<T1, T2> : IComparable<Pair<T1, T2>> {
public T1 v1;
public T2 v2;
public Pair() {}
public Pair(T1 v1, T2 v2) {
this.v1 = v1;
this.v2 = v2;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int CompareTo(Pair<T1, T2> p) {
var c = Comparer<T1>.Default.Compare(v1, p.v1);
if (c == 0)
c = Comparer<T2>.Default.Compare(v2, p.v2);
return c;
}
public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
public void Deconstruct(out T1 a, out T2 b) {
a = v1;
b = v2;
}
}
public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>> {
public T3 v3;
public Pair() : base() {}
public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2) { this.v3 = v3; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int CompareTo(Pair<T1, T2, T3> p) {
var c = base.CompareTo(p);
if (c == 0)
c = Comparer<T3>.Default.Compare(v3, p.v3);
return c;
}
public override string ToString() => $"{base.ToString()} {v3.ToString()}";
public void Deconstruct(out T1 a, out T2 b, out T3 c) {
Deconstruct(out a, out b);
c = v3;
}
}
#endregion
|
[["+", 0, 7, 8, 57, 64, 196, 0, 93, 0, 94], ["+", 0, 7, 8, 57, 64, 196, 0, 93, 0, 35], ["+", 0, 7, 8, 57, 64, 196, 0, 1, 0, 35]]
| 8
| 2,056
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AtCoderCs {
class Program {
static void Main() {
int[] Array = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
Console.WriteLine(Array[int.Parse(Console.ReadLine())]);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AtCoderCs {
class Program {
static void Main() {
int[] Array = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
Console.WriteLine(Array[int.Parse(Console.ReadLine()) - 1]);
}
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 120
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace PaizaTest {
class Program {
static void Main(string[] args) {
var text =
"1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51";
var line = text.Split(',').Select(x => int.Parse(x.Trim())).ToList();
var index = int.Parse(Console.ReadLine());
Console.WriteLine(text[index - 1]);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace PaizaTest {
class Program {
static void Main(string[] args) {
var text =
"1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51";
var line = text.Split(',').Select(x => int.Parse(x)).ToList();
var index = int.Parse(Console.ReadLine());
Console.WriteLine(line[index - 1]);
}
}
}
|
[["-", 3, 4, 0, 28, 0, 213, 63, 214, 0, 131], ["-", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["-", 3, 4, 0, 28, 0, 213, 3, 4, 0, 24], ["-", 3, 4, 0, 28, 0, 213, 3, 4, 0, 25], ["-", 0, 213, 3, 4, 0, 28, 0, 204, 205, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 204, 205, 22]]
| 8
| 99
| 6
|
using System;
namespace Sample {
class Sample {
static void Main() {
int line = int.Parse(System.Console.ReadLine());
string[] src = new string[32] { "1", "1", "1", "2", "1", "2", "1", "5",
"2", "2", "1", "5", "1", "2", "1", "14",
"1", "5", "1", "5", "2", "2", "1", "15",
"2", "2", "5", "4", "1", "4", "1", "51" };
Console.WriteLine("{0}", src[line]);
}
}
}
|
using System;
namespace Sample {
class Sample {
static void Main() {
int line = int.Parse(System.Console.ReadLine());
string[] src = new string[32] { "1", "1", "1", "2", "1", "2", "1", "5",
"2", "2", "1", "5", "1", "2", "1", "14",
"1", "5", "1", "5", "2", "2", "1", "15",
"2", "2", "5", "4", "1", "4", "1", "51" };
Console.WriteLine("{0}", src[line - 1]);
}
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 188
| 2
|
using System;
class Program {
private static int[] data = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1,
5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2,
1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
static void Main(string[] args) {
int a, b, c;
a = int.Parse(Console.ReadLine()); //標準入力
// string[] str = Console.ReadLine().Split('
// ');//2つ以上のスペース区切り入力の取得 b = int.Parse(str[0]);
// //数値で受け取りたい場合は変換
Console.Write(data[a]); //改行なし出力
// Console.WriteLine("改行あり a = {0} b = {1} c = {2}", a, b,
// c);//改行付き出力
}
}
|
using System;
class Program {
private static int[] data = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1,
5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2,
1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
static void Main(string[] args) {
int a, b, c;
a = int.Parse(Console.ReadLine()); //標準入力
// string[] str = Console.ReadLine().Split('
// ');//2つ以上のスペース区切り入力の取得 b = int.Parse(str[0]);
// //数値で受け取りたい場合は変換
Console.Write(data[a - 1]); //改行なし出力
// Console.WriteLine("改行あり a = {0} b = {1} c = {2}", a, b,
// c);//改行付き出力
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 128
| 2
|
using System;
using static System.Console;
namespace atcoder {
class Program {
static void Main(string[] args) {
int K = int.Parse(ReadLine());
int[] A = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
WriteLine(A[K]);
}
}
}
|
using System;
using static System.Console;
namespace atcoder {
class Program {
static void Main(string[] args) {
int K = int.Parse(ReadLine());
int[] A = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
WriteLine(A[K - 1]);
}
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 119
| 2
|
using System;
using static System.Console;
using System.Linq;
namespace AC {
public class shiokara {
static void Main(string[] args) {
int[] k = new int[32] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
int n = int.Parse(ReadLine());
WriteLine(k[n]);
}
}
}
|
using System;
using static System.Console;
using System.Linq;
namespace AC {
public class shiokara {
static void Main(string[] args) {
int[] k = new int[32] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
int n = int.Parse(ReadLine());
WriteLine(k[n - 1]);
}
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 130
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace A_Kth_Term {
class Program {
static void Main(string[] args) {
var Si = new int[] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
var K = int.Parse(Console.ReadLine());
Console.WriteLine(Si[K]);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace A_Kth_Term {
class Program {
static void Main(string[] args) {
var Si = new int[] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
var K = int.Parse(Console.ReadLine());
Console.WriteLine(Si[K - 1]);
}
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 143
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Solution {
public static void Main() {
var k = int.Parse(Console.ReadLine());
var array = new int[] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
Console.WriteLine(array[k]);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Solution {
public static void Main() {
var k = int.Parse(Console.ReadLine());
var array = new int[] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
Console.WriteLine(array[k - 1]);
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 125
| 2
|
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Program {
static void Main() {
long[] n = Console.ReadLine().Split().Select(a => long.Parse(a)).ToArray();
if (n[0] == 1 || n[1] == 1) {
Console.WriteLine($"{0}");
return;
}
long result = 0;
if ((n[0] * n[1]) % 2 == 1) {
result++;
}
result += (n[0] * n[1]) >> 1;
Console.WriteLine($"{result}");
}
}
|
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Program {
static void Main() {
long[] n = Console.ReadLine().Split().Select(a => long.Parse(a)).ToArray();
if (n[0] == 1 || n[1] == 1) {
Console.WriteLine($"{1}");
return;
}
long result = 0;
if ((n[0] * n[1]) % 2 == 1) {
result++;
}
result += (n[0] * n[1]) >> 1;
Console.WriteLine($"{result}");
}
}
|
[["-", 3, 4, 0, 28, 0, 283, 0, 284, 0, 203], ["+", 3, 4, 0, 28, 0, 283, 0, 284, 0, 203]]
| 8
| 148
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
namespace 練習問題 {
class Program {
static void Main(string[] args) {
List<int> pattern = new List<int>();
long a = 0;
long b = 0;
var sw = new System.Diagnostics.Stopwatch();
TimeSpan TLE = new TimeSpan(0, 0, 2);
debug Debug = new debug();
if (args.Length == 0) {
Debug.FlagFalse();
//*
string[] input = Console.ReadLine().Split(' ');
a = long.Parse(input[0]);
b = long.Parse(input[1]);
//*/
// c = int.Parse(Console.ReadLine());
// string d = Console.ReadLine();
// string[] input = Console.ReadLine().Split(' ');
} else {
Debug.FlagTrue();
if (args[0] == "1") {
a = 4;
b = 5;
} else if (args[0] == "2") {
a = 7;
b = 3;
} else if (args[0] == "3") {
a = 1000000000;
b = 1000000000;
} else {
a = 3;
b = 2;
}
}
sw.Start(); // 2秒以内ですねスタート
long result = 0;
if (a == 1 && b == 1) {
result = 1;
} else if (a % 2 == 1) {
if (b % 2 == 1) {
result += (a + 1) / 2 * (b + 1) / 2 + (a - 1) / 2 * (b - 1) / 2;
} else {
// result += (a + 1) / 2 * b / 2 + (a - 1) / 2 * b / 2;
result += b / 2 * a;
}
} else {
result += a / 2 * b;
}
Console.WriteLine(result);
sw.Stop();
TimeSpan ts = sw.Elapsed;
// Console.WriteLine($"{ts}");
}
static int intPow(int target, int kaisu) {
int startTarget = target;
for (int i = 1; i < kaisu; i++) {
target *= startTarget;
}
return target;
}
static void bubble_sort(List<List<int>> a) {
int count = 0;
for (int i = 0; i < a.Count; i++) {
for (int j = 0; j < a.Count - i - 1; j++) {
// if (a[j] == a[a.Count - 1]){
// continue;
// }
count++;
if (a[j][1] > a[j + 1][1]) {
int localsave = 0;
localsave = a[j + 1][1];
a[j + 1][1] = a[j][1];
a[j][1] = localsave;
localsave = a[j][0];
a[j][0] = a[j + 1][0];
a[j + 1][0] = localsave;
}
}
// debug(a,"途中" + i);
}
// debug(a,"result");
// Console.WriteLine("回数"+count);
for (int i = 0; i < a.Count; i++) {
Console.WriteLine(a[i][0] + " " + a[i][1]);
}
}
/* 標準入力と標準出力が使えるかのチェック
static void echo() {
string echotest = Console.ReadLine();
Console.WriteLine(echotest);
}
static void HelloWorld(){
Console.WriteLine("Hello World!");
}
*/
}
public class debug { //宣言時は、「 debug Debug = new debug(); 」推奨
bool debug_flag = true;
public void Log(string str) {
if (debug_flag == true) {
Console.WriteLine(str);
}
}
public void Log(int str) {
if (debug_flag == true) {
Console.WriteLine(str);
}
}
public void Log(float str) {
if (debug_flag == true) {
Console.WriteLine(str);
}
}
public void Log(object obj) {
if (debug_flag == true) {
Console.WriteLine(obj);
}
}
public void Log(int[] arr) {
if (debug_flag == true) {
Console.WriteLine(string.Join(",", arr));
}
}
public void Log(string[] arr) {
if (debug_flag == true) {
Console.WriteLine(string.Join(",", arr));
}
}
public void Log(List<int> arr) {
if (debug_flag == true) {
string shuturyoku = "";
for (int i = 0; i < arr.Count; i++) {
shuturyoku += arr[i] + ",";
}
Console.WriteLine(shuturyoku.TrimEnd(','));
}
}
public void Log(List<string> arr) {
if (debug_flag == true) {
string shuturyoku = "";
for (int i = 0; i < arr.Count; i++) {
shuturyoku += arr[i] + ",";
}
Console.WriteLine(shuturyoku.TrimEnd(','));
}
}
public void Log(List<float> arr) {
if (debug_flag == true) {
string shuturyoku = "";
for (int i = 0; i < arr.Count; i++) {
shuturyoku += arr[i] + ",";
}
Console.WriteLine(shuturyoku.TrimEnd(','));
}
}
public void Log() {
if (debug_flag == true) {
Console.WriteLine("アタイイレナサイ");
}
}
public void FlagFalse() { debug_flag = false; }
public void FlagTrue() { debug_flag = true; }
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
namespace 練習問題 {
class Program {
static void Main(string[] args) {
List<int> pattern = new List<int>();
long a = 0;
long b = 0;
var sw = new System.Diagnostics.Stopwatch();
TimeSpan TLE = new TimeSpan(0, 0, 2);
debug Debug = new debug();
if (args.Length == 0) {
Debug.FlagFalse();
//*
string[] input = Console.ReadLine().Split(' ');
a = long.Parse(input[0]);
b = long.Parse(input[1]);
//*/
// c = int.Parse(Console.ReadLine());
// string d = Console.ReadLine();
// string[] input = Console.ReadLine().Split(' ');
} else {
Debug.FlagTrue();
if (args[0] == "1") {
a = 4;
b = 5;
} else if (args[0] == "2") {
a = 7;
b = 3;
} else if (args[0] == "3") {
a = 1000000000;
b = 1000000000;
} else {
a = 3;
b = 2;
}
}
sw.Start(); // 2秒以内ですねスタート
long result = 0;
if (a == 1 || b == 1) {
result = 1;
} else if (a % 2 == 1) {
if (b % 2 == 1) {
result += (a + 1) / 2 * (b + 1) / 2 + (a - 1) / 2 * (b - 1) / 2;
} else {
// result += (a + 1) / 2 * b / 2 + (a - 1) / 2 * b / 2;
result += b / 2 * a;
}
} else {
result += a / 2 * b;
}
Console.WriteLine(result);
sw.Stop();
TimeSpan ts = sw.Elapsed;
// Console.WriteLine($"{ts}");
}
static int intPow(int target, int kaisu) {
int startTarget = target;
for (int i = 1; i < kaisu; i++) {
target *= startTarget;
}
return target;
}
static void bubble_sort(List<List<int>> a) {
int count = 0;
for (int i = 0; i < a.Count; i++) {
for (int j = 0; j < a.Count - i - 1; j++) {
// if (a[j] == a[a.Count - 1]){
// continue;
// }
count++;
if (a[j][1] > a[j + 1][1]) {
int localsave = 0;
localsave = a[j + 1][1];
a[j + 1][1] = a[j][1];
a[j][1] = localsave;
localsave = a[j][0];
a[j][0] = a[j + 1][0];
a[j + 1][0] = localsave;
}
}
// debug(a,"途中" + i);
}
// debug(a,"result");
// Console.WriteLine("回数"+count);
for (int i = 0; i < a.Count; i++) {
Console.WriteLine(a[i][0] + " " + a[i][1]);
}
}
/* 標準入力と標準出力が使えるかのチェック
static void echo() {
string echotest = Console.ReadLine();
Console.WriteLine(echotest);
}
static void HelloWorld(){
Console.WriteLine("Hello World!");
}
*/
}
public class debug { //宣言時は、「 debug Debug = new debug(); 」推奨
bool debug_flag = true;
public void Log(string str) {
if (debug_flag == true) {
Console.WriteLine(str);
}
}
public void Log(int str) {
if (debug_flag == true) {
Console.WriteLine(str);
}
}
public void Log(float str) {
if (debug_flag == true) {
Console.WriteLine(str);
}
}
public void Log(object obj) {
if (debug_flag == true) {
Console.WriteLine(obj);
}
}
public void Log(int[] arr) {
if (debug_flag == true) {
Console.WriteLine(string.Join(",", arr));
}
}
public void Log(string[] arr) {
if (debug_flag == true) {
Console.WriteLine(string.Join(",", arr));
}
}
public void Log(List<int> arr) {
if (debug_flag == true) {
string shuturyoku = "";
for (int i = 0; i < arr.Count; i++) {
shuturyoku += arr[i] + ",";
}
Console.WriteLine(shuturyoku.TrimEnd(','));
}
}
public void Log(List<string> arr) {
if (debug_flag == true) {
string shuturyoku = "";
for (int i = 0; i < arr.Count; i++) {
shuturyoku += arr[i] + ",";
}
Console.WriteLine(shuturyoku.TrimEnd(','));
}
}
public void Log(List<float> arr) {
if (debug_flag == true) {
string shuturyoku = "";
for (int i = 0; i < arr.Count; i++) {
shuturyoku += arr[i] + ",";
}
Console.WriteLine(shuturyoku.TrimEnd(','));
}
}
public void Log() {
if (debug_flag == true) {
Console.WriteLine("アタイイレナサイ");
}
}
public void FlagFalse() { debug_flag = false; }
public void FlagTrue() { debug_flag = true; }
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 106]]
| 8
| 1,056
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1 {
class Program {
static void Main(string[] args) {
long[] hw = Console.ReadLine().Split().Select(long.Parse).ToArray();
long w = (long)Math.Ceiling((double)hw[1] / 2);
long h = hw[0];
long res;
if (hw[0] == 1 || hw[1] == 1) {
res = 0;
} else if (h % 2 == 0) {
res = hw[1] * (h / 2);
} else {
res = hw[1] * (h / 2) + w;
}
Console.WriteLine(res);
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1 {
class Program {
static void Main(string[] args) {
long[] hw = Console.ReadLine().Split().Select(long.Parse).ToArray();
long w = (long)Math.Ceiling((double)hw[1] / 2);
long h = hw[0];
long res;
if (hw[0] == 1 || hw[1] == 1) {
res = 1;
} else if (h % 2 == 0) {
res = hw[1] * (h / 2);
} else {
res = hw[1] * (h / 2) + w;
}
Console.WriteLine(res);
}
}
}
|
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 203], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 203]]
| 8
| 168
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;
namespace Atcoder {
class Program {
static void Main(string[] args) {
var HW = ReadLongArray();
var mul = HW[0] * HW[1];
if (HW[0] == 1 || HW[1] == 1) {
Console.WriteLine(1);
}
if (mul % 2 == 0) {
Console.WriteLine(mul / 2);
} else {
Console.WriteLine((mul + 1) / 2);
}
}
private static readonly Func<string> Read = () => Console.ReadLine();
private static readonly Func<string[]> ReadStringArray = () =>
Console.ReadLine().Split();
private static readonly Func<int> ReadInt = () =>
int.Parse(Console.ReadLine());
private static readonly Func<long> ReadLong = () =>
long.Parse(Console.ReadLine());
private static readonly Func<int[]> ReadIntArray = () =>
Console.ReadLine().Split().Select(int.Parse).ToArray();
private static readonly Func<long[]> ReadLongArray = () =>
Console.ReadLine().Split().Select(long.Parse).ToArray();
private static readonly Action<string> Cw = str => Console.WriteLine(str);
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;
namespace Atcoder {
class Program {
static void Main(string[] args) {
var HW = ReadLongArray();
var mul = HW[0] * HW[1];
if (HW[0] == 1 || HW[1] == 1) {
Console.WriteLine(1);
return;
}
if (mul % 2 == 0) {
Console.WriteLine(mul / 2);
} else {
Console.WriteLine((mul + 1) / 2);
}
}
private static readonly Func<string> Read = () => Console.ReadLine();
private static readonly Func<string[]> ReadStringArray = () =>
Console.ReadLine().Split();
private static readonly Func<int> ReadInt = () =>
int.Parse(Console.ReadLine());
private static readonly Func<long> ReadLong = () =>
long.Parse(Console.ReadLine());
private static readonly Func<int[]> ReadIntArray = () =>
Console.ReadLine().Split().Select(int.Parse).ToArray();
private static readonly Func<long[]> ReadLongArray = () =>
Console.ReadLine().Split().Select(long.Parse).ToArray();
private static readonly Action<string> Cw = str => Console.WriteLine(str);
}
}
|
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 35]]
| 8
| 307
| 2
|
using System;
namespace _135C {
class Program {
static void Main(string[] args) {
string[] read = Console.ReadLine().Split();
long H = long.Parse(read[0]);
long W = long.Parse(read[1]);
if (H == 1 || W == 1) {
Console.WriteLine(1);
} else if ((H * W) % 2 == 0) {
Console.WriteLine(H * W);
} else {
Console.WriteLine(H * W + 1);
}
}
}
}
|
using System;
namespace _135C {
class Program {
static void Main(string[] args) {
string[] read = Console.ReadLine().Split();
long H = long.Parse(read[0]);
long W = long.Parse(read[1]);
if (H == 1 || W == 1) {
Console.WriteLine(1);
} else if ((H * W) % 2 == 0) {
Console.WriteLine(H * W / 2);
} else {
Console.WriteLine(H * W / 2 + 1);
}
}
}
}
|
[["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 85], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203], ["+", 3, 4, 0, 28, 0, 16, 31, 16, 17, 85], ["+", 3, 4, 0, 28, 0, 16, 31, 16, 12, 203]]
| 8
| 120
| 4
|
using System;
public class B {
public static void Main() {
var input = System.Console.ReadLine().Split(' ');
var h = long.Parse(input[0]);
var w = long.Parse(input[1]);
// これぜったい1行にまとまるよね
if (h == 1 || w == 1) {
Console.WriteLine(0);
return;
}
if (w % 2 == 0) {
Console.WriteLine(h * (w / 2));
} else if (h % 2 == 0) {
Console.WriteLine(h * (w / 2) + h / 2);
} else {
Console.WriteLine(h * (w / 2) + h / 2 + 1);
}
}
}
|
using System;
public class B {
public static void Main() {
var input = System.Console.ReadLine().Split(' ');
var h = long.Parse(input[0]);
var w = long.Parse(input[1]);
// これぜったい1行にまとまるよね
if (h == 1 || w == 1) {
Console.WriteLine(1);
return;
}
if (w % 2 == 0) {
Console.WriteLine(h * (w / 2));
} else if (h % 2 == 0) {
Console.WriteLine(h * (w / 2) + h / 2);
} else {
Console.WriteLine(h * (w / 2) + h / 2 + 1);
}
}
}
|
[["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 203]]
| 8
| 155
| 2
|
using System;
namespace AtCorder2 {
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split(' ');
long a = int.Parse(input[0]);
long b = int.Parse(input[1]);
Console.WriteLine(Method(a, b));
}
static long Method(long a, long b) {
if (a == 1)
return 0;
if (b == 1)
return 0;
if (a % 2 == 0)
return a * b / 2;
if (b % 2 == 0)
return a * b / 2;
return a * b / 2 + 1;
}
}
}
|
using System;
namespace AtCorder2 {
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split(' ');
long a = int.Parse(input[0]);
long b = int.Parse(input[1]);
Console.WriteLine(Method(a, b));
}
static long Method(long a, long b) {
if (a == 1)
return 1;
if (b == 1)
return 1;
if (a % 2 == 0)
return a * b / 2;
if (b % 2 == 0)
return a * b / 2;
return a * b / 2 + 1;
}
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 64, 37, 0, 203], ["+", 0, 195, 8, 196, 0, 57, 64, 37, 0, 203]]
| 8
| 147
| 4
|
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using static exMath;
using static exReadLine;
class Program {
static void Main(string[] args) {
long H, W;
longReadLine(out H, out W);
double a = Ceiling(H / 2d);
long ans;
if (H != 1 || W != 1) {
if (W % 2 == 0) {
ans = H * (W / 2);
} else {
ans = H * (W / 2) + (long)a;
}
} else {
ans = 1;
}
WriteLine(ans);
// ReadLine();
}
}
static class exReadLine {
public static void intReadLine(out int a) { a = int.Parse(ReadLine()); }
public static void intReadLine(out int a, out int b) {
int[] input = ReadLine().Split().Select(int.Parse).ToArray();
a = input[0];
b = input[1];
}
public static void intReadLine(out int a, out int b, out int c) {
int[] input = ReadLine().Split().Select(int.Parse).ToArray();
a = input[0];
b = input[1];
c = input[2];
}
public static void intReadLine(out int a, out int b, out int c, out int d) {
int[] input = ReadLine().Split().Select(int.Parse).ToArray();
a = input[0];
b = input[1];
c = input[2];
d = input[3];
}
public static void longReadLine(out long a) { a = long.Parse(ReadLine()); }
public static void longReadLine(out long a, out long b) {
long[] input = ReadLine().Split().Select(long.Parse).ToArray();
a = input[0];
b = input[1];
}
public static void longReadLine(out long a, out long b, out long c) {
long[] input = ReadLine().Split().Select(long.Parse).ToArray();
a = input[0];
b = input[1];
c = input[2];
}
public static void longReadLine(out long a, out long b, out long c,
out long d) {
long[] input = ReadLine().Split().Select(long.Parse).ToArray();
a = input[0];
b = input[1];
c = input[2];
d = input[3];
}
public static int[] intArrayReadLine() {
return ReadLine().Split().Select(int.Parse).ToArray();
}
public static long[] longArrayReadLine() {
return ReadLine().Split().Select(long.Parse).ToArray();
}
public static List<int> intListReadLine() {
return ReadLine().Split().Select(int.Parse).ToList();
}
public static List<long> longListReadLine() {
return ReadLine().Split().Select(long.Parse).ToList();
}
}
static class exMath {
// 最大公約数
public static int Gcd(int a, int b) {
if (a < b)
return Gcd(b, a);
while (b != 0) {
var r = a % b;
a = b;
b = r;
}
return a;
}
public static long Gcd(long a, long b) {
if (a < b)
return Gcd(b, a);
while (b != 0) {
var r = a % b;
a = b;
b = r;
}
return a;
}
// 最小公倍数
public static long Lcm(int a, int b) { return BigMul(a, b) / Gcd(a, b); }
public static long Lcm(long a, long b) { return a * b / Gcd(a, b); }
}
|
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using static exMath;
using static exReadLine;
class Program {
static void Main(string[] args) {
long H, W;
longReadLine(out H, out W);
double a = Ceiling(H / 2d);
long ans;
if (H != 1 && W != 1) {
if (W % 2 == 0) {
ans = H * (W / 2);
} else {
ans = H * (W / 2) + (long)a;
}
} else {
ans = 1;
}
WriteLine(ans);
// ReadLine();
}
}
static class exReadLine {
public static void intReadLine(out int a) { a = int.Parse(ReadLine()); }
public static void intReadLine(out int a, out int b) {
int[] input = ReadLine().Split().Select(int.Parse).ToArray();
a = input[0];
b = input[1];
}
public static void intReadLine(out int a, out int b, out int c) {
int[] input = ReadLine().Split().Select(int.Parse).ToArray();
a = input[0];
b = input[1];
c = input[2];
}
public static void intReadLine(out int a, out int b, out int c, out int d) {
int[] input = ReadLine().Split().Select(int.Parse).ToArray();
a = input[0];
b = input[1];
c = input[2];
d = input[3];
}
public static void longReadLine(out long a) { a = long.Parse(ReadLine()); }
public static void longReadLine(out long a, out long b) {
long[] input = ReadLine().Split().Select(long.Parse).ToArray();
a = input[0];
b = input[1];
}
public static void longReadLine(out long a, out long b, out long c) {
long[] input = ReadLine().Split().Select(long.Parse).ToArray();
a = input[0];
b = input[1];
c = input[2];
}
public static void longReadLine(out long a, out long b, out long c,
out long d) {
long[] input = ReadLine().Split().Select(long.Parse).ToArray();
a = input[0];
b = input[1];
c = input[2];
d = input[3];
}
public static int[] intArrayReadLine() {
return ReadLine().Split().Select(int.Parse).ToArray();
}
public static long[] longArrayReadLine() {
return ReadLine().Split().Select(long.Parse).ToArray();
}
public static List<int> intListReadLine() {
return ReadLine().Split().Select(int.Parse).ToList();
}
public static List<long> longListReadLine() {
return ReadLine().Split().Select(long.Parse).ToList();
}
}
static class exMath {
// 最大公約数
public static int Gcd(int a, int b) {
if (a < b)
return Gcd(b, a);
while (b != 0) {
var r = a % b;
a = b;
b = r;
}
return a;
}
public static long Gcd(long a, long b) {
if (a < b)
return Gcd(b, a);
while (b != 0) {
var r = a % b;
a = b;
b = r;
}
return a;
}
// 最小公倍数
public static long Lcm(int a, int b) { return BigMul(a, b) / Gcd(a, b); }
public static long Lcm(long a, long b) { return a * b / Gcd(a, b); }
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 106], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98]]
| 8
| 871
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Solution {
public static void Main() {
var vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
var h = vals[0];
var w = vals[1];
var sum = h / 2 * w;
if (h % 2 == 1) {
sum += (w + 1) / 2;
}
if (h == 1) {
sum = 1;
}
Console.WriteLine(sum);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Solution {
public static void Main() {
var vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
var h = vals[0];
var w = vals[1];
var sum = h / 2 * w;
if (h % 2 == 1) {
sum += (w + 1) / 2;
}
if (h == 1 || w == 1) {
sum = 1;
}
Console.WriteLine(sum);
}
}
|
[["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 106], ["+", 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
| 119
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Program {
public static void Main(string[] args) {
var hw = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
if (hw[0] == 1 || hw[1] == 1) {
Console.WriteLine(0);
return;
}
var val = hw[0] * hw[1];
if (val % 2 == 0) {
Console.WriteLine(val / 2);
} else {
Console.WriteLine((long)Math.Floor((double)(val / 2)) + 1);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Program {
public static void Main(string[] args) {
var hw = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
if (hw[0] == 1 || hw[1] == 1) {
Console.WriteLine(1);
return;
}
var val = hw[0] * hw[1];
if (val % 2 == 0) {
Console.WriteLine(val / 2);
} else {
Console.WriteLine((long)Math.Floor((double)(val / 2)) + 1);
}
}
}
|
[["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 203]]
| 8
| 150
| 2
|
using System;
namespace Panasonic2020 {
internal class Program {
public static void Main(string[] args) {
var s = Console.ReadLine();
var sSplit = s.Split();
var h = int.Parse(sSplit[0]);
var w = int.Parse(sSplit[1]);
Console.WriteLine(Problem2.GetAnswer(h, w));
}
}
public class Problem2 {
public static long GetAnswer(int h, int w) {
if (h == 1 || w == 1) {
return 0;
}
var all = (long)h * w;
var answer = all / 2;
if (all % 2 == 1) {
++answer;
}
return answer;
}
}
}
|
using System;
namespace Panasonic2020 {
internal class Program {
public static void Main(string[] args) {
var s = Console.ReadLine();
var sSplit = s.Split();
var h = int.Parse(sSplit[0]);
var w = int.Parse(sSplit[1]);
Console.WriteLine(Problem2.GetAnswer(h, w));
}
}
public class Problem2 {
public static long GetAnswer(int h, int w) {
if (h == 1 || w == 1) {
return 1;
}
var all = (long)h * w;
var answer = all / 2;
if (all % 2 == 1) {
++answer;
}
return answer;
}
}
}
|
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 203], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 203]]
| 8
| 148
| 2
|
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
//読み込む
string[] line = Console.ReadLine().Split(' ');
long H = long.Parse(line[0]);
long W = long.Parse(line[1]);
long prod = H * W;
long answer = prod / 2;
if (prod % 2 == 1) {
answer++;
}
if (H == 1 || W == 1) {
answer = prod - 1;
}
//出力
Console.WriteLine(answer);
}
}
|
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
//読み込む
string[] line = Console.ReadLine().Split(' ');
long H = long.Parse(line[0]);
long W = long.Parse(line[1]);
long prod = H * W;
long answer = prod / 2;
if (prod % 2 == 1) {
answer++;
}
if (H == 1 || W == 1) {
answer = 1;
}
//出力
Console.WriteLine(answer);
}
}
|
[["-", 64, 196, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 64, 196, 0, 1, 0, 11, 12, 16, 17, 33]]
| 8
| 133
| 2
|
using PanasonicProgrammingContest2020.Questions;
using PanasonicProgrammingContest2020.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace PanasonicProgrammingContest2020.Questions {
public class QuestionC : AtCoderQuestionBase {
public override IEnumerable<object> Solve(TextReader inputStream) {
var abc = inputStream.ReadLongArray();
var a = abc[0];
var b = abc[1];
var c = abc[2];
yield return 4 * a * b < (c - a - b) * (c - a - b) ? "Yes" : "No";
}
}
}
namespace PanasonicProgrammingContest2020 {
class Program {
static void Main(string[] args) {
IAtCoderQuestion question = new QuestionC(); // 問題に合わせて書き換え
var answers = question.Solve(Console.In);
foreach (var answer in answers) {
Console.WriteLine(answer);
}
}
}
}
#region Base Classes
namespace PanasonicProgrammingContest2020.Questions {
public interface IAtCoderQuestion {
IEnumerable<object> Solve(string input);
IEnumerable<object> Solve(TextReader inputStream);
}
public abstract class AtCoderQuestionBase : IAtCoderQuestion {
public IEnumerable<object> Solve(string input) {
var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
var reader = new StreamReader(stream, Encoding.Unicode);
return Solve(reader);
}
public abstract IEnumerable<object> Solve(TextReader inputStream);
}
}
#endregion
#region Extensions
namespace PanasonicProgrammingContest2020.Extensions {
internal static class TextReaderExtensions {
internal static int
ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
internal static long
ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
internal static double
ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
internal static string
ReadString(this TextReader reader) => reader.ReadLine();
internal static int[] ReadIntArray(this TextReader reader,
char separator = ' ') =>
ReadStringArray(reader, separator).Select(int.Parse).ToArray();
internal static long[] ReadLongArray(this TextReader reader,
char separator = ' ') =>
ReadStringArray(reader, separator).Select(long.Parse).ToArray();
internal static double[] ReadDoubleArray(this TextReader reader,
char separator = ' ') =>
ReadStringArray(reader, separator).Select(double.Parse).ToArray();
internal static string[] ReadStringArray(this TextReader reader,
char separator = ' ') =>
reader.ReadLine().Split(separator);
}
}
#endregion
|
using PanasonicProgrammingContest2020.Questions;
using PanasonicProgrammingContest2020.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace PanasonicProgrammingContest2020.Questions {
public class QuestionC : AtCoderQuestionBase {
public override IEnumerable<object> Solve(TextReader inputStream) {
var abc = inputStream.ReadLongArray();
var a = abc[0];
var b = abc[1];
var c = abc[2];
yield return a + b < c && 4 * a * b < (c - a - b) * (c - a - b) ? "Yes"
: "No";
}
}
}
namespace PanasonicProgrammingContest2020 {
class Program {
static void Main(string[] args) {
IAtCoderQuestion question = new QuestionC(); // 問題に合わせて書き換え
var answers = question.Solve(Console.In);
foreach (var answer in answers) {
Console.WriteLine(answer);
}
}
}
}
#region Base Classes
namespace PanasonicProgrammingContest2020.Questions {
public interface IAtCoderQuestion {
IEnumerable<object> Solve(string input);
IEnumerable<object> Solve(TextReader inputStream);
}
public abstract class AtCoderQuestionBase : IAtCoderQuestion {
public IEnumerable<object> Solve(string input) {
var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
var reader = new StreamReader(stream, Encoding.Unicode);
return Solve(reader);
}
public abstract IEnumerable<object> Solve(TextReader inputStream);
}
}
#endregion
#region Extensions
namespace PanasonicProgrammingContest2020.Extensions {
internal static class TextReaderExtensions {
internal static int
ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
internal static long
ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
internal static double
ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
internal static string
ReadString(this TextReader reader) => reader.ReadLine();
internal static int[] ReadIntArray(this TextReader reader,
char separator = ' ') =>
ReadStringArray(reader, separator).Select(int.Parse).ToArray();
internal static long[] ReadLongArray(this TextReader reader,
char separator = ' ') =>
ReadStringArray(reader, separator).Select(long.Parse).ToArray();
internal static double[] ReadDoubleArray(this TextReader reader,
char separator = ' ') =>
ReadStringArray(reader, separator).Select(double.Parse).ToArray();
internal static string[] ReadStringArray(this TextReader reader,
char separator = ' ') =>
reader.ReadLine().Split(separator);
}
}
#endregion
|
[["+", 0, 41, 15, 16, 31, 16, 31, 16, 31, 22], ["+", 0, 41, 15, 16, 31, 16, 31, 16, 17, 72], ["+", 0, 41, 15, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 285, 0, 41, 15, 16, 31, 16, 17, 18], ["+", 0, 285, 0, 41, 15, 16, 31, 16, 12, 22], ["+", 8, 196, 0, 285, 0, 41, 15, 16, 17, 98]]
| 8
| 519
| 6
|
using System;
using static System.Console;
using static System.Math;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Program {
static void Main() {
long[] n = ReadLine().Split().Select(a => long.Parse(a)).ToArray();
long d = n[2] - n[1] - n[0];
if (0 < d && 4 * n[0] * n[1] < d * d) {
WriteLine($"YES");
} else {
WriteLine($"NO");
}
}
}
|
using System;
using static System.Console;
using static System.Math;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Program {
static void Main() {
long[] n = ReadLine().Split().Select(a => long.Parse(a)).ToArray();
long d = n[2] - n[1] - n[0];
if (0 < d && 4 * n[0] * n[1] < d * d) {
WriteLine($"Yes");
} else {
WriteLine($"No");
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 283, 0, 296], ["+", 0, 213, 3, 4, 0, 28, 0, 283, 0, 296]]
| 8
| 131
| 4
|
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder {
class Program {
static public long[] Sarray() {
return ReadLine().Split().Select(long.Parse).ToArray();
}
static public List<long> Slist() {
return ReadLine().Split().Select(long.Parse).ToList();
}
static void Main(string[] args) {
// SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
var abc = Sarray();
var a = abc[0];
var b = abc[1];
var c = abc[2];
var d = c - (a + b);
if (0 < d && 4 * a * b < d)
WriteLine("Yes");
else
WriteLine("No");
// Out.Flush();
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder {
class Program {
static public long[] Sarray() {
return ReadLine().Split().Select(long.Parse).ToArray();
}
static public List<long> Slist() {
return ReadLine().Split().Select(long.Parse).ToList();
}
static void Main(string[] args) {
// SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
var abc = Sarray();
var a = abc[0];
var b = abc[1];
var c = abc[2];
var d = c - (a + b);
if (0 < d && 4 * a * b < d * d)
WriteLine("Yes");
else
WriteLine("No");
// Out.Flush();
}
}
}
|
[["+", 0, 57, 15, 16, 12, 16, 12, 16, 17, 48], ["+", 0, 57, 15, 16, 12, 16, 12, 16, 12, 22]]
| 8
| 190
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace panasonic2020_c {
class Program {
static void Main(string[] args) {
var a = CIn.ReadInt();
var b = CIn.ReadInt();
var c = CIn.ReadInt();
long i = c - a - b;
if (i <= 0 && (long)4 * a * b < i * i) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
}
class CIn {
private static readonly Queue<string> fieldBuffer = new Queue<string>();
public static string Read() {
if (fieldBuffer.Count == 0) {
foreach (var field in Console.ReadLine().Split()) {
fieldBuffer.Enqueue(field);
}
}
return fieldBuffer.Dequeue();
}
public static int ReadInt() => int.Parse(Read());
public static long ReadLong() => long.Parse(Read());
public static double ReadDouble() => double.Parse(Read());
public static string[] ReadStringArray(long n) {
var array = new string[n];
for (var i = 0; i < n; i++) {
array[i] = Read();
}
return array;
}
public static int[] ReadIntArray(long n) {
var array = new int[n];
for (var i = 0; i < n; i++) {
array[i] = ReadInt();
}
return array;
}
public static long[] ReadLongArray(long n) {
var array = new long[n];
for (var i = 0; i < n; i++) {
array[i] = ReadLong();
}
return array;
}
public static double[] ReadDoubleArray(long n) {
var array = new double[n];
for (var i = 0; i < n; i++) {
array[i] = ReadDouble();
}
return array;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace panasonic2020_c {
class Program {
static void Main(string[] args) {
var a = CIn.ReadInt();
var b = CIn.ReadInt();
var c = CIn.ReadInt();
long i = c - a - b;
if (i >= 0 && (long)4 * a * b < i * i) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
}
class CIn {
private static readonly Queue<string> fieldBuffer = new Queue<string>();
public static string Read() {
if (fieldBuffer.Count == 0) {
foreach (var field in Console.ReadLine().Split()) {
fieldBuffer.Enqueue(field);
}
}
return fieldBuffer.Dequeue();
}
public static int ReadInt() => int.Parse(Read());
public static long ReadLong() => long.Parse(Read());
public static double ReadDouble() => double.Parse(Read());
public static string[] ReadStringArray(long n) {
var array = new string[n];
for (var i = 0; i < n; i++) {
array[i] = Read();
}
return array;
}
public static int[] ReadIntArray(long n) {
var array = new int[n];
for (var i = 0; i < n; i++) {
array[i] = ReadInt();
}
return array;
}
public static long[] ReadLongArray(long n) {
var array = new long[n];
for (var i = 0; i < n; i++) {
array[i] = ReadLong();
}
return array;
}
public static double[] ReadDoubleArray(long n) {
var array = new double[n];
for (var i = 0; i < n; i++) {
array[i] = ReadDouble();
}
return array;
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 20]]
| 8
| 438
| 2
|
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.IO;
using System.Text;
using N = System.Int64;
public class Solver {
public void Solve() {
N a = rl, b = rl, c = rl;
Yn(4 * a * b < (a + b - c) * (a + b - c));
}
int ri {
get { return sc.Integer(); }
}
long rl {
get { return sc.Long(); }
}
double rd {
get { return sc.Double(); }
}
string rs {
get { return sc.Scan(); }
}
public StreamScanner sc = new StreamScanner(Console.OpenStandardInput());
/*
private const N mod = 1000000007;
N Reverse(N n) { return Pow(n, mod - 2); }
N Mul(params N[] n) { N p = n[0]; for (N i = 1; i < n.Length; i++) { p = (p *
n[i]) % mod; } return p; } N Pow(N n, N p) { N t = n, q = 1; while (p > 0) {
if (p % 2 == 1) { q = (q * t) % mod; } t = (t * t) % mod; p >>= 1; } return q;
} N PowUpper(N n, N b) { N p = 1; while (p <= n) { p *= b; } return p; } N
Sign(N n) { return n == 0 ? 0 : n > 0 ? 1 : -1; } N Abs(N n) { return (n > 0)
? n : -n; } N Gcd(params N[] n) { N p = n[0]; for (N i = 1; i < n.Length; i++)
{ p = Gcd(p, n[i]); } return p; } N Gcd(N a, N b) { return (a == 0) ? b :
Gcd(b % a, a); } N Lcm(params N[] n) { N p = n[0]; for (N i = 1; i < n.Length;
i++) { p = Lcm(p, n[i]); } return p; } N Lcm(N a, N b) { return (a / Gcd(a, b)
* b) % mod; }
*/
void Write<T>(T t) { Console.WriteLine(t.ToString()); }
void YN(bool t) { Console.WriteLine(t ? "YES" : "NO"); }
void Yn(bool t) { Console.WriteLine(t ? "Yes" : "No"); }
void yn(bool t) { Console.WriteLine(t ? "yes" : "no"); }
}
static class Program {
static public void Main(string[] args) {
Console.SetOut(
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
var solver = new Solver();
solver.Solve();
Console.Out.Flush();
}
}
public class StreamScanner {
public StreamScanner(Stream stream) { str = stream; }
private readonly Stream str;
private readonly byte[] buf = new byte[1024];
private int len, ptr;
public bool isEof = false;
public bool IsEndOfStream {
get { return isEof; }
}
private byte read() {
if (isEof)
throw new EndOfStreamException();
if (ptr >= len) {
ptr = 0;
if ((len = str.Read(buf, 0, 1024)) <= 0) {
isEof = true;
return 0;
}
}
return buf[ptr++];
}
public char Char() {
byte b = 0;
do
b = read();
while (b < 33 || 126 < b);
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 long Long() {
long ret = 0;
byte b = 0;
var ng = false;
do
b = read();
while (b != '-' && (b < '0' || '9' < b));
if (b == '-') {
ng = true;
b = read();
}
for (; true; b = read()) {
if (b < '0' || '9' < b)
return ng ? -ret : ret;
else
ret = ret * 10 + b - '0';
}
}
public int Integer() { return (int)Long(); }
public double Double() { return double.Parse(Scan()); }
}
|
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.IO;
using System.Text;
using N = System.Int64;
public class Solver {
public void Solve() {
N a = rl, b = rl, c = rl;
Yn(c > a + b && 4 * a * b < (a + b - c) * (a + b - c));
}
int ri {
get { return sc.Integer(); }
}
long rl {
get { return sc.Long(); }
}
double rd {
get { return sc.Double(); }
}
string rs {
get { return sc.Scan(); }
}
public StreamScanner sc = new StreamScanner(Console.OpenStandardInput());
/*
private const N mod = 1000000007;
N Reverse(N n) { return Pow(n, mod - 2); }
N Mul(params N[] n) { N p = n[0]; for (N i = 1; i < n.Length; i++) { p = (p *
n[i]) % mod; } return p; } N Pow(N n, N p) { N t = n, q = 1; while (p > 0) {
if (p % 2 == 1) { q = (q * t) % mod; } t = (t * t) % mod; p >>= 1; } return q;
} N PowUpper(N n, N b) { N p = 1; while (p <= n) { p *= b; } return p; } N
Sign(N n) { return n == 0 ? 0 : n > 0 ? 1 : -1; } N Abs(N n) { return (n > 0)
? n : -n; } N Gcd(params N[] n) { N p = n[0]; for (N i = 1; i < n.Length; i++)
{ p = Gcd(p, n[i]); } return p; } N Gcd(N a, N b) { return (a == 0) ? b :
Gcd(b % a, a); } N Lcm(params N[] n) { N p = n[0]; for (N i = 1; i < n.Length;
i++) { p = Lcm(p, n[i]); } return p; } N Lcm(N a, N b) { return (a / Gcd(a, b)
* b) % mod; }
*/
void Write<T>(T t) { Console.WriteLine(t.ToString()); }
void YN(bool t) { Console.WriteLine(t ? "YES" : "NO"); }
void Yn(bool t) { Console.WriteLine(t ? "Yes" : "No"); }
void yn(bool t) { Console.WriteLine(t ? "yes" : "no"); }
}
static class Program {
static public void Main(string[] args) {
Console.SetOut(
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
var solver = new Solver();
solver.Solve();
Console.Out.Flush();
}
}
public class StreamScanner {
public StreamScanner(Stream stream) { str = stream; }
private readonly Stream str;
private readonly byte[] buf = new byte[1024];
private int len, ptr;
public bool isEof = false;
public bool IsEndOfStream {
get { return isEof; }
}
private byte read() {
if (isEof)
throw new EndOfStreamException();
if (ptr >= len) {
ptr = 0;
if ((len = str.Read(buf, 0, 1024)) <= 0) {
isEof = true;
return 0;
}
}
return buf[ptr++];
}
public char Char() {
byte b = 0;
do
b = read();
while (b < 33 || 126 < b);
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 long Long() {
long ret = 0;
byte b = 0;
var ng = false;
do
b = read();
while (b != '-' && (b < '0' || '9' < b));
if (b == '-') {
ng = true;
b = read();
}
for (; true; b = read()) {
if (b < '0' || '9' < b)
return ng ? -ret : ret;
else
ret = ret * 10 + b - '0';
}
}
public int Integer() { return (int)Long(); }
public double Double() { return double.Parse(Scan()); }
}
|
[["+", 3, 4, 0, 28, 0, 16, 31, 16, 31, 22], ["+", 3, 4, 0, 28, 0, 16, 31, 16, 17, 47], ["+", 0, 28, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 28, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 28, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 98]]
| 8
| 673
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Console;
namespace AtCoder_1 {
class Program {
static List<int>[] edges = null;
static Pair<int>[] abs;
static int T;
static int N;
static void Main(string[] args) {
var abc = CinLAr();
long cl = abc[2] - abc[1] - abc[0];
if (4 * abc[0] * abc[1] < cl * cl) {
Cout("Yes");
} else {
Cout("No");
}
Cin();
}
static Random Rand = new Random();
static string[] AlphabetTable =
new string[] { "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" };
static int GetDigits(long num) {
return (int)Math.Floor(Math.Log10(num)) + 1;
}
static int GetNumByDigit(long num, int digit) {
return (int)((num / ((int)Math.Pow(10, digit - 1))) % 10);
}
static int loop(int num, int max) {
if (num > max) {
return num % max;
} else if (num < 0) {
return max - (-num) % max;
} else {
return num;
}
}
static long GCD(long a, long b) {
if (a < b) {
swap(ref a, ref b);
}
if (a % b == 0) {
return b;
} else {
return GCD(b, a % b);
}
}
static long LCM(long a, long b) { return a * b / GCD(a, b); }
static void swap<T>(ref T a, ref T b) {
T t = a;
a = b;
b = t;
}
static readonly int MOD10_9_7 = (1000000000 + 7);
static bool IsInt(double d) { return (int)d == d; }
static string Cin() { return ReadLine(); }
static string[] CinAr() { return ReadLine().Split(' '); }
static int CinT() { return S2i(Cin()); }
static int[] CinTAr() {
return CinAr().Select((x, i) => { return S2i(x); }).ToArray();
}
static long CinL() { return S2L(Cin()); }
static long[] CinLAr() {
return CinAr().Select((x, i) => { return S2L(x); }).ToArray();
}
static double CinD() { return S2D(Cin()); }
static double[] CinDAr() {
return CinAr().Select((x, i) => { return S2D(x); }).ToArray();
}
static int S2i(string s) { return int.Parse(s); }
static long S2L(string s) { return long.Parse(s); }
static double S2D(string s) { return double.Parse(s); }
static void Cout(object s) { WriteLine(s); }
static long[] yakusuu(long n) {
if (n == 1) {
return new long[] { 1 };
}
List<long> res = new List<long>();
res.Add(1);
for (long i = 2; i <= n / 2 + 1; i++) {
if (n % i == 0) {
res.Add(i);
}
}
res.Add(n);
return res.ToArray();
}
static bool isPrime(long num) {
if (num == 1) {
return false;
}
for (long i = 2; i <= Math.Sqrt(num) + 1; i++) {
if (num % i == 0) {
return false;
}
}
return true;
}
static void CoutAr<Type>(IEnumerable<Type> types) {
WriteLine(string.Join(" ", types));
}
public static long nCr(int n, int r) {
// naive: return Factorial(n) / (Factorial(r) * Factorial(n - r));
return nPr(n, r) / Factorial(r);
}
public static long nPr(int n, int r) {
// naive: return Factorial(n) / Factorial(n - r);
return FactorialDivision(n, n - r);
}
private static long FactorialDivision(int topFactorial,
int divisorFactorial) {
long result = 1;
for (int i = topFactorial; i > divisorFactorial; i--)
result *= i;
return result;
}
private static long Factorial(int i) {
if (i <= 1)
return 1;
return i * Factorial(i - 1);
}
}
public struct Pair<T> {
public T a;
public T b;
public T c;
public Pair(T _a, T _b) {
a = _a;
b = _b;
c = default(T);
}
public Pair(T _a, T _b, T _c) {
a = _a;
b = _b;
c = _c;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Console;
namespace AtCoder_1 {
class Program {
static List<int>[] edges = null;
static Pair<int>[] abs;
static int T;
static int N;
static void Main(string[] args) {
var abc = CinLAr();
long cl = abc[2] - abc[1] - abc[0];
if (cl > 0 && 4 * abc[0] * abc[1] < cl * cl) {
Cout("Yes");
} else {
Cout("No");
}
Cin();
}
static Random Rand = new Random();
static string[] AlphabetTable =
new string[] { "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" };
static int GetDigits(long num) {
return (int)Math.Floor(Math.Log10(num)) + 1;
}
static int GetNumByDigit(long num, int digit) {
return (int)((num / ((int)Math.Pow(10, digit - 1))) % 10);
}
static int loop(int num, int max) {
if (num > max) {
return num % max;
} else if (num < 0) {
return max - (-num) % max;
} else {
return num;
}
}
static long GCD(long a, long b) {
if (a < b) {
swap(ref a, ref b);
}
if (a % b == 0) {
return b;
} else {
return GCD(b, a % b);
}
}
static long LCM(long a, long b) { return a * b / GCD(a, b); }
static void swap<T>(ref T a, ref T b) {
T t = a;
a = b;
b = t;
}
static readonly int MOD10_9_7 = (1000000000 + 7);
static bool IsInt(double d) { return (int)d == d; }
static string Cin() { return ReadLine(); }
static string[] CinAr() { return ReadLine().Split(' '); }
static int CinT() { return S2i(Cin()); }
static int[] CinTAr() {
return CinAr().Select((x, i) => { return S2i(x); }).ToArray();
}
static long CinL() { return S2L(Cin()); }
static long[] CinLAr() {
return CinAr().Select((x, i) => { return S2L(x); }).ToArray();
}
static double CinD() { return S2D(Cin()); }
static double[] CinDAr() {
return CinAr().Select((x, i) => { return S2D(x); }).ToArray();
}
static int S2i(string s) { return int.Parse(s); }
static long S2L(string s) { return long.Parse(s); }
static double S2D(string s) { return double.Parse(s); }
static void Cout(object s) { WriteLine(s); }
static long[] yakusuu(long n) {
if (n == 1) {
return new long[] { 1 };
}
List<long> res = new List<long>();
res.Add(1);
for (long i = 2; i <= n / 2 + 1; i++) {
if (n % i == 0) {
res.Add(i);
}
}
res.Add(n);
return res.ToArray();
}
static bool isPrime(long num) {
if (num == 1) {
return false;
}
for (long i = 2; i <= Math.Sqrt(num) + 1; i++) {
if (num % i == 0) {
return false;
}
}
return true;
}
static void CoutAr<Type>(IEnumerable<Type> types) {
WriteLine(string.Join(" ", types));
}
public static long nCr(int n, int r) {
// naive: return Factorial(n) / (Factorial(r) * Factorial(n - r));
return nPr(n, r) / Factorial(r);
}
public static long nPr(int n, int r) {
// naive: return Factorial(n) / Factorial(n - r);
return FactorialDivision(n, n - r);
}
private static long FactorialDivision(int topFactorial,
int divisorFactorial) {
long result = 1;
for (int i = topFactorial; i > divisorFactorial; i--)
result *= i;
return result;
}
private static long Factorial(int i) {
if (i <= 1)
return 1;
return i * Factorial(i - 1);
}
}
public struct Pair<T> {
public T a;
public T b;
public T c;
public Pair(T _a, T _b) {
a = _a;
b = _b;
c = default(T);
}
public Pair(T _a, T _b, T _c) {
a = _a;
b = _b;
c = _c;
}
}
}
|
[["+", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98]]
| 8
| 1,162
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
public static void Main() {
var n =
Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
var right = n[2] - n[0] - n[1];
var ans =
(0 < right) && (right * right - n[0] * n[1] * 4 < 0) ? "Yes" : "No";
Console.WriteLine(ans);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
public static void Main() {
var n = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
var right = n[2] - n[0] - n[1];
var ans =
(0 < right) && (right * right - n[0] * n[1] * 4 > 0) ? "Yes" : "No";
Console.WriteLine(ans);
}
}
|
[["-", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199], ["+", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199], ["-", 0, 41, 15, 16, 12, 23, 0, 16, 17, 18], ["+", 0, 41, 15, 16, 12, 23, 0, 16, 17, 47]]
| 8
| 121
| 4
|
using System;
using static System.Console;
using static System.Math;
namespace Main {
class Program {
static void Main(string[] args) {
string line = ReadLine();
string[] l = line.Split(' ');
long a = long.Parse(l[0]);
long b = long.Parse(l[1]);
long c = long.Parse(l[2]);
if (a + b < c || (4 * a * b) < ((c - a - b) * (c - a - b))) {
Write("Yes");
} else {
Write("No");
}
}
}
}
|
using System;
using static System.Console;
using static System.Math;
namespace Main {
class Program {
static void Main(string[] args) {
string line = ReadLine();
string[] l = line.Split(' ');
long a = long.Parse(l[0]);
long b = long.Parse(l[1]);
long c = long.Parse(l[2]);
if (a + b < c && (4 * a * b) < ((c - a - b) * (c - a - b))) {
Write("Yes");
} else {
Write("No");
}
}
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 106], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98]]
| 8
| 147
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Solution {
public static void Main() {
var vals = Console.ReadLine().Split(' ').Select(decimal.Parse).ToArray();
var a = vals[0];
var b = vals[1];
var c = vals[2];
// √a + √b < √c
// a + 2√ab + b < c
// 2√ab < c -a - b
// 4ab < (c-a-b)^2
var r = c - a - b;
if (r < 0 || 4 * a * b < r * r) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Solution {
public static void Main() {
var vals = Console.ReadLine().Split(' ').Select(decimal.Parse).ToArray();
var a = vals[0];
var b = vals[1];
var c = vals[2];
// √a + √b < √c
// a + 2√ab + b < c
// 2√ab < c -a - b
// 4ab < (c-a-b)^2
var r = c - a - b;
if (r > 0 && 4 * a * b < r * r) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 47], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 106], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98]]
| 8
| 131
| 4
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder {
partial class Program {
static long mod = 1000000007;
static void Swap<T>(ref T a, ref T b) {
T temp = a;
a = b;
b = temp;
}
static void Main() {
Console.SetOut(
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
Solve();
Console.Out.Flush();
Console.ReadKey();
}
//ここから
static void Solve() {
long a;
long b;
long c;
Multi(out a, out b, out c);
var ans =
(c - a - b < 0 || (c - a - b) * (c - a - b) - 4L * a * b > 0L).YesNo();
Console.WriteLine(ans);
}
}
//拡張メソッド
public static class Ex {
public static List<string> FastSort(this List<string> s) {
s.Sort(StringComparer.Ordinal);
return s.ToList();
}
public static string yesno(this bool b) { return b ? "yes" : "no"; }
public static string YesNo(this bool b) { return b ? "Yes" : "No"; }
public static string YESNO(this bool b) { return b ? "YES" : "NO"; }
}
partial class Program {
static public string GetStr() { return Console.ReadLine().Trim(); }
static public char GetChar() { return Console.ReadLine().Trim()[0]; }
static public int GetInt() { return int.Parse(Console.ReadLine().Trim()); }
static public long GetLong() { return long.Parse(Console.ReadLine().Trim()); }
static public double GetDouble() {
return double.Parse(Console.ReadLine().Trim());
}
static public string[] GetStrArray() {
return Console.ReadLine().Trim().Split(' ');
}
static public int[] GetIntArray() {
return Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
}
static public long[] GetLongArray() {
return Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
}
static public char[] GetCharArray() {
return Console.ReadLine().Trim().Split(' ').Select(char.Parse).ToArray();
}
static public double[] GetDoubleArray() {
return Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray();
}
static public void WriteObjects<T>(IList<T> values) {
var num = values.Count;
for (int i = 0; i < num; i++) {
Console.Write(values[i]);
if (i < num - 1) {
Console.Write(" ");
}
}
Console.WriteLine();
}
static bool eq<T, U>() => typeof(T).Equals(typeof(U));
static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
: eq<T, long>() ? ct<T, long>(long.Parse(s))
: eq<T, double>() ? ct<T, double>(double.Parse(s))
: eq<T, char>() ? ct<T, char>(s[0])
: ct<T, string>(s);
static void Multi<T>(out T a) => a = cv<T>(GetStr());
static void Multi<T, U>(out T a, out U b) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
}
static void Multi<T, U, V>(out T a, out U b, out V c) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
c = cv<V>(ar[2]);
}
static void Multi<T, U, V, W>(out T a, out U b, out V c, out W d) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
c = cv<V>(ar[2]);
d = cv<W>(ar[3]);
}
static void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d,
out X e) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
c = cv<V>(ar[2]);
d = cv<W>(ar[3]);
e = cv<X>(ar[4]);
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder {
partial class Program {
static long mod = 1000000007;
static void Swap<T>(ref T a, ref T b) {
T temp = a;
a = b;
b = temp;
}
static void Main() {
Console.SetOut(
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
Solve();
Console.Out.Flush();
Console.ReadKey();
}
//ここから
static void Solve() {
long a;
long b;
long c;
Multi(out a, out b, out c);
var ans =
(c - a - b >= 0 && (c - a - b) * (c - a - b) - 4L * a * b > 0L).YesNo();
Console.WriteLine(ans);
}
}
//拡張メソッド
public static class Ex {
public static List<string> FastSort(this List<string> s) {
s.Sort(StringComparer.Ordinal);
return s.ToList();
}
public static string yesno(this bool b) { return b ? "yes" : "no"; }
public static string YesNo(this bool b) { return b ? "Yes" : "No"; }
public static string YESNO(this bool b) { return b ? "YES" : "NO"; }
}
partial class Program {
static public string GetStr() { return Console.ReadLine().Trim(); }
static public char GetChar() { return Console.ReadLine().Trim()[0]; }
static public int GetInt() { return int.Parse(Console.ReadLine().Trim()); }
static public long GetLong() { return long.Parse(Console.ReadLine().Trim()); }
static public double GetDouble() {
return double.Parse(Console.ReadLine().Trim());
}
static public string[] GetStrArray() {
return Console.ReadLine().Trim().Split(' ');
}
static public int[] GetIntArray() {
return Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
}
static public long[] GetLongArray() {
return Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
}
static public char[] GetCharArray() {
return Console.ReadLine().Trim().Split(' ').Select(char.Parse).ToArray();
}
static public double[] GetDoubleArray() {
return Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray();
}
static public void WriteObjects<T>(IList<T> values) {
var num = values.Count;
for (int i = 0; i < num; i++) {
Console.Write(values[i]);
if (i < num - 1) {
Console.Write(" ");
}
}
Console.WriteLine();
}
static bool eq<T, U>() => typeof(T).Equals(typeof(U));
static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
: eq<T, long>() ? ct<T, long>(long.Parse(s))
: eq<T, double>() ? ct<T, double>(double.Parse(s))
: eq<T, char>() ? ct<T, char>(s[0])
: ct<T, string>(s);
static void Multi<T>(out T a) => a = cv<T>(GetStr());
static void Multi<T, U>(out T a, out U b) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
}
static void Multi<T, U, V>(out T a, out U b, out V c) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
c = cv<V>(ar[2]);
}
static void Multi<T, U, V, W>(out T a, out U b, out V c, out W d) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
c = cv<V>(ar[2]);
d = cv<W>(ar[3]);
}
static void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d,
out X e) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
c = cv<V>(ar[2]);
d = cv<W>(ar[3]);
e = cv<X>(ar[4]);
}
}
}
|
[["-", 63, 214, 205, 23, 0, 16, 31, 16, 17, 18], ["+", 63, 214, 205, 23, 0, 16, 31, 16, 17, 20], ["-", 0, 213, 63, 214, 205, 23, 0, 16, 17, 106], ["+", 0, 213, 63, 214, 205, 23, 0, 16, 17, 98]]
| 8
| 1,194
| 4
|
using System;
namespace AtCorder2 {
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split(' ');
long a = int.Parse(input[0]);
long b = int.Parse(input[1]);
long c = int.Parse(input[2]);
Console.WriteLine(Method(a, b, c));
}
static string Method(long a, long b, long c) {
long left = 4 * a * b;
long right = c - a - b;
if (right < 0)
return "no";
right = right * right;
if (left >= right)
return "no";
return "yes";
}
}
}
|
using System;
namespace AtCorder2 {
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split(' ');
long a = int.Parse(input[0]);
long b = int.Parse(input[1]);
long c = int.Parse(input[2]);
Console.WriteLine(Method(a, b, c));
}
static string Method(long a, long b, long c) {
long left = 4 * a * b;
long right = c - a - b;
if (right < 0)
return "No";
right = right * right;
if (left < right)
return "Yes";
return "No";
}
}
}
|
[["-", 8, 196, 0, 57, 64, 37, 0, 5, 0, 222], ["+", 8, 196, 0, 57, 64, 37, 0, 5, 0, 222], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["-", 0, 195, 8, 196, 0, 37, 0, 5, 0, 222], ["+", 0, 195, 8, 196, 0, 37, 0, 5, 0, 222]]
| 8
| 159
| 8
|
using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;
namespace AtcoderExpress {
class Program {
static void Main(string[] args) {
// var W = long.Parse(Console.ReadLine());
var ABC =
Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
long A = ABC[0];
long B = ABC[1];
long C = ABC[2];
// Array.Sort(A);
long D = C - (A + B);
if (4 * A * B < D * D) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
// Console.WriteLine(double.MinValue);
}
}
}
|
using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;
namespace AtcoderExpress {
class Program {
static void Main(string[] args) {
// var W = long.Parse(Console.ReadLine());
var ABC =
Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
long A = ABC[0];
long B = ABC[1];
long C = ABC[2];
// Array.Sort(A);
long D = C - (A + B);
if (4 * A * B < D * D && D > 0) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
// Console.WriteLine(double.MinValue);
}
}
}
|
[["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 12, 203]]
| 8
| 156
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace panasonic2020_c {
class Program {
static void Main(string[] args) {
var a = CIn.ReadInt();
var b = CIn.ReadInt();
var c = CIn.ReadInt();
if (4L * a * b < (long)(c - a - b) * (c - a - b)) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
}
static class CIn {
private static readonly Queue<string> fieldBuffer = new Queue<string>();
public static string Read() {
if (fieldBuffer.Count == 0) {
foreach (var field in Console.ReadLine().Split()) {
fieldBuffer.Enqueue(field);
}
}
return fieldBuffer.Dequeue();
}
public static int ReadInt() => int.Parse(Read());
public static long ReadLong() => long.Parse(Read());
public static double ReadDouble() => double.Parse(Read());
public static string[] ReadStringArray(int n) {
var array = new string[n];
for (var i = 0; i < n; i++) {
array[i] = Read();
}
return array;
}
public static int[] ReadIntArray(int n) {
var array = new int[n];
for (var i = 0; i < n; i++) {
array[i] = ReadInt();
}
return array;
}
public static long[] ReadLongArray(int n) {
var array = new long[n];
for (var i = 0; i < n; i++) {
array[i] = ReadLong();
}
return array;
}
public static double[] ReadDoubleArray(int n) {
var array = new double[n];
for (var i = 0; i < n; i++) {
array[i] = ReadDouble();
}
return array;
}
public static char[,] ReadCharMatrix(int h, int w) {
var array = new char[h, w];
for (var i = 0; i < h; i++) {
var l = Console.ReadLine().ToCharArray();
for (var j = 0; j < w; j++) {
array[i, j] = l[j];
}
}
return array;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace panasonic2020_c {
class Program {
static void Main(string[] args) {
var a = CIn.ReadInt();
var b = CIn.ReadInt();
var c = CIn.ReadInt();
if (c >= a + b && 4L * a * b < (long)(c - a - b) * (c - a - b)) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
}
static class CIn {
private static readonly Queue<string> fieldBuffer = new Queue<string>();
public static string Read() {
if (fieldBuffer.Count == 0) {
foreach (var field in Console.ReadLine().Split()) {
fieldBuffer.Enqueue(field);
}
}
return fieldBuffer.Dequeue();
}
public static int ReadInt() => int.Parse(Read());
public static long ReadLong() => long.Parse(Read());
public static double ReadDouble() => double.Parse(Read());
public static string[] ReadStringArray(int n) {
var array = new string[n];
for (var i = 0; i < n; i++) {
array[i] = Read();
}
return array;
}
public static int[] ReadIntArray(int n) {
var array = new int[n];
for (var i = 0; i < n; i++) {
array[i] = ReadInt();
}
return array;
}
public static long[] ReadLongArray(int n) {
var array = new long[n];
for (var i = 0; i < n; i++) {
array[i] = ReadLong();
}
return array;
}
public static double[] ReadDoubleArray(int n) {
var array = new double[n];
for (var i = 0; i < n; i++) {
array[i] = ReadDouble();
}
return array;
}
public static char[,] ReadCharMatrix(int h, int w) {
var array = new char[h, w];
for (var i = 0; i < h; i++) {
var l = Console.ReadLine().ToCharArray();
for (var j = 0; j < w; j++) {
array[i, j] = l[j];
}
}
return array;
}
}
}
|
[["+", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98]]
| 8
| 525
| 6
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
public class AtCoderC {
static void Main() {
decimal a;
decimal b;
decimal c;
{
var line = Console.ReadLine();
var words = line.Split(' ');
a = decimal.Parse(words[0]);
b = decimal.Parse(words[1]);
c = decimal.Parse(words[2]);
}
bool answer;
decimal d = c - a - b;
if (c < 0) {
answer = false;
} else {
decimal e = d * d - (4 * a * b);
answer = e > 0;
}
Console.WriteLine(answer ? "Yes" : "No");
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
public class AtCoderC {
static void Main() {
decimal a;
decimal b;
decimal c;
{
var line = Console.ReadLine();
var words = line.Split(' ');
a = decimal.Parse(words[0]);
b = decimal.Parse(words[1]);
c = decimal.Parse(words[2]);
}
bool answer;
decimal d = c - a - b;
if (d < 0) {
answer = false;
} else {
decimal e = d * d - (4 * a * b);
answer = e > 0;
}
Console.WriteLine(answer ? "Yes" : "No");
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22]]
| 8
| 163
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// using System.Numerics;
using System.Runtime.CompilerServices;
using System.Diagnostics;
using ll=System.Int64;
using static Contest_C.Lib_IO;
using static Contest_C.Lib_Minifunc;
public static class Contest_C
{
public static void Main() {
checked{
long a,b,c;
Lib_IO.rm(out a, out b,out c);
ll e=c-a-b;
var ans = (4*a*b<e*e)?"Yes":"No";
Lib_IO.wm(ans);
}
}
#region BaseModule
public static class Lib_Minifunc{
[MethodImpl(256)] public static void swap1<T>(ref T a, ref T b) { T t = a; a = b; b = t; }
[MethodImpl(256)] public static void swap2<T>(ref T a, ref T b) where T : IComparable { if (a.CompareTo(b)==1) swap1(ref a, ref b); } // b の方が小さければ交換
[MethodImpl(256)] public static bool chmin<T>(ref T a, T b) where T : IComparable { if (a.CompareTo(b)== 1) { a = b; return true; } return false; } // b の方が小さければ a を更新
[MethodImpl(256)] public static bool chmax<T>(ref T a, T b) where T : IComparable { if (a.CompareTo(b)==-1) { a = b; return true; } return false; } // b の方が大きければ a を更新
[MethodImpl(256)] public static bool inside(long i, long n) => (0<=i&&i<n);
[MethodImpl(256)] public static bool inside(long x, long y, long w, long h) => (inside(x,w)&&inside(y,h));
[MethodImpl(256)] public static T min<T>(params T[] a) where T : IComparable => a.Min();
[MethodImpl(256)] public static T max<T>(params T[] a) where T : IComparable => a.Max();
[MethodImpl(256)] public static long mod(long a, long m=MOD1) { var v = a%m; return (v<0?v+m:v); }
[MethodImpl(256)] public static long ceiling(long a, long b) => (a%b==0?a/b:a/b+1); // 整数商の切り上げ
[MethodImpl(256)] public static P<T,U> initp<T,U>(T a,U b) => new P<T,U>(a,b);
[MethodImpl(256)] public static P<T,U,V> initp<T,U,V>(T a,U b,V c) => new P<T,U,V>(a,b,c);
[MethodImpl(256)] public static P<T,U,V,W> initp<T,U,V,W>(T a,U b,V c,W d) => new P<T,U,V,W>(a,b,c,d);
[MethodImpl(256)] public static bool initd<T,U>(Dictionary<T,U> d, T k) { if(d.ContainsKey(k)) { return false; } else { d[k] = default(U); return true; } }
public static T[] inita<T>(long len1) where T : new() { var m = new T[len1]; for (int i=0;i<m.Length;i++) m[i] = new T(); return m; }
public static T[][] initm<T>(long len1,long len2,T val) where T : struct { var m = new T[len1][]; for (int i=0;i<m.Length;i++) m[i] = Enumerable.Repeat(val,(int)len2).ToArray(); return m; }
public static T[][][] initm<T>(long len1,long len2,long len3,T val) where T : struct { var m = new T[len1][][]; for (int i=0;i<m.Length;i++) m[i] = initm(len2,len3,val); return m; }
public const long MOD1 = 1000000007; // 10^9+7
public const double EPS1 = 1e-8;
public const long INF1 = 1000000000000000; // 10^15
}
public struct P<T,U>
{
public T A; public U B;
public P(T a,U b) { A = a; B = b; }
public static implicit operator KeyValuePair<T,U>(P<T,U> a) => new KeyValuePair<T,U>(a.A,a.B);
public static implicit operator P<T,U>(KeyValuePair<T,U> a) => new P<T,U>(a.Key,a.Value);
}
public struct P<T,U,V>
{
public T A; public U B; public V C;
public P(T a,U b,V c) { A = a; B = b; C = c; }
}
public struct P<T,U,V,W>
{
public T A; public U B; public V C; public W D;
public P(T a,U b,V c,W d) { A = a; B = b; C = c; D = d; }
}
public static class Lib_IO
{
class Prt : System.IO.StreamWriter
{
public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
public Prt(System.IO.Stream s) : base(s,new UTF8Encoding(false,true)) {}
public Prt(System.IO.Stream s,Encoding e) : base(s,e) {}
}
static Prt sw = new Prt(Console.OpenStandardOutput());
static char[] sp = new char[] {' '};
[MethodImpl(256)] static bool eq<T,U>() => typeof(T).Equals(typeof(U));
[MethodImpl(256)] static T ct<T,U>(U a) => (T)Convert.ChangeType(a,typeof(T));
[MethodImpl(256)] static T cv<T>(string s) =>
eq<T,int>() ? ct<T,int>(int.Parse(s))
: eq<T,long>() ? ct<T,long>(long.Parse(s))
: eq<T,double>() ? ct<T,double>(double.Parse(s,System.Globalization.CultureInfo.InvariantCulture))
: eq<T,char>() ? ct<T,char>(s[0])
: ct<T,string>(s);
public static string[] rm<T>(out T a) {
var z = Console.ReadLine().Split(sp,StringSplitOptions.RemoveEmptyEntries);
a = cv<T>(z[0]);
return z;
}
public static string[] rm<T,U>(out T a,out U b) {
var z = rm<T>(out a);
b = cv<U>(z[1]);
return z;
}
public static string[] rm<T,U,V>(out T a,out U b,out V c) {
var z = rm<T,U>(out a,out b);
c = cv<V>(z[2]);
return z;
}
public static string[] rm<T,U,V,W>(out T a,out U b,out V c,out W d) {
var z = rm<T,U,V>(out a,out b,out c);
d = cv<W>(z[3]);
return z;
}
public static string[] rm<T,U,V,W,X>(out T a,out U b,out V c,out W d,out X e) {
var z = rm<T,U,V,W>(out a,out b,out c,out d);
e = cv<X>(z[4]);
return z;
}
public static string[] rm<T,U,V,W,X,Y>(out T a,out U b,out V c,out W d,out X e,out Y f) {
var z = rm<T,U,V,W,X>(out a,out b,out c,out d,out e);
f = cv<Y>(z[5]);
return z;
}
public static string[] ra<T>(out T[] a) {
var z = Console.ReadLine().Split(sp,StringSplitOptions.RemoveEmptyEntries);
a = z.Select(cv<T>).ToArray();
return z;
}
public static string[][] rl<T>(long n,out T[] a) {
a = new T[n];
var y = new string[n][];
for(int i=0;i<n;i++) y[i] = rm(out a[i]);
return y;
}
public static string[][] rl<T,U>(long n,out P<T,U>[] a) {
a = new P<T,U>[n];
var y = new string[n][];
for(int i=0;i<n;i++) {
T o; U p;
y[i] = rm(out o,out p);
a[i] = new P<T,U>(o,p);
}
return y;
}
public static string[][] rl<T,U,V>(long n,out P<T,U,V>[] a) {
a = new P<T,U,V>[n];
var y = new string[n][];
for(int i=0;i<n;i++) {
T o; U p; V q;
y[i] = rm(out o,out p,out q);
a[i] = new P<T,U,V>(o,p,q);
}
return y;
}
public static string[][] rl<T,U,V,W>(long n,out P<T,U,V,W>[] a) {
a = new P<T,U,V,W>[n];
var y = new string[n][];
for(int i=0;i<n;i++) {
T o; U p; V q; W r;
y[i] = rm(out o,out p,out q,out r);
a[i] = new P<T,U,V,W>(o,p,q,r);
}
return y;
}
public static string[][] rx<T>(long n,out T[][] a) {
a = new T[n][];
var y = new string[n][];
for(int i=0;i<n;i++) y[i] = ra(out a[i]);
return y;
}
static void wwp(Action act){
sw.AutoFlush = false;
Console.SetOut(sw);
act();
Console.Out.Flush();
sw.AutoFlush = true;
Console.SetOut(sw);
}
[MethodImpl(256)] static string wfm(Type t) =>t.Equals(typeof(double)) ? "{0:F10}" : "{0}";
public static void wm(params object[] a) {
wwp(()=>{
for(int i=0;i<a.Length-1;i++) Console.Write(wfm(a[i].GetType())+" ",a[i]);
Console.WriteLine(wfm(a[a.Length-1].GetType()),a[a.Length-1]);
});
}
public static void wa<T>(IList<T> a) { wxa(new IList<T>[]{a}, " "); }
public static void wl<T>(IList<T> a) {
wwp(()=>{
var f = wfm(typeof(T));
foreach(T x in a) Console.WriteLine(f,x);
});
}
static void wxa<T>(IList<IList<T>> a, string s) {
wwp(()=>{
var f = wfm(typeof(T));
var g = f + s;
foreach(var b in a) {
for(int i=0;i<b.Count-1;i++) Console.Write(g,b[i]);
Console.WriteLine(f,b[b.Count-1]);
}
});
}
public static void wx<T>(IList<IList<T>> a) { wxa(a, " "); }
public static void wg<T>(IList<IList<T>> a) { wxa(a, ""); }
}
#endregion
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// using System.Numerics;
using System.Runtime.CompilerServices;
using System.Diagnostics;
using ll=System.Int64;
using static Contest_C.Lib_IO;
using static Contest_C.Lib_Minifunc;
public static class Contest_C
{
public static void Main() {
checked{
long a,b,c;
Lib_IO.rm(out a, out b,out c);
ll e=c-a-b;
var ans = (0<=e&&4*a*b<e*e)?"Yes":"No";
Lib_IO.wm(ans);
}
}
#region BaseModule
public static class Lib_Minifunc{
[MethodImpl(256)] public static void swap1<T>(ref T a, ref T b) { T t = a; a = b; b = t; }
[MethodImpl(256)] public static void swap2<T>(ref T a, ref T b) where T : IComparable { if (a.CompareTo(b)==1) swap1(ref a, ref b); } // b の方が小さければ交換
[MethodImpl(256)] public static bool chmin<T>(ref T a, T b) where T : IComparable { if (a.CompareTo(b)== 1) { a = b; return true; } return false; } // b の方が小さければ a を更新
[MethodImpl(256)] public static bool chmax<T>(ref T a, T b) where T : IComparable { if (a.CompareTo(b)==-1) { a = b; return true; } return false; } // b の方が大きければ a を更新
[MethodImpl(256)] public static bool inside(long i, long n) => (0<=i&&i<n);
[MethodImpl(256)] public static bool inside(long x, long y, long w, long h) => (inside(x,w)&&inside(y,h));
[MethodImpl(256)] public static T min<T>(params T[] a) where T : IComparable => a.Min();
[MethodImpl(256)] public static T max<T>(params T[] a) where T : IComparable => a.Max();
[MethodImpl(256)] public static long mod(long a, long m=MOD1) { var v = a%m; return (v<0?v+m:v); }
[MethodImpl(256)] public static long ceiling(long a, long b) => (a%b==0?a/b:a/b+1); // 整数商の切り上げ
[MethodImpl(256)] public static P<T,U> initp<T,U>(T a,U b) => new P<T,U>(a,b);
[MethodImpl(256)] public static P<T,U,V> initp<T,U,V>(T a,U b,V c) => new P<T,U,V>(a,b,c);
[MethodImpl(256)] public static P<T,U,V,W> initp<T,U,V,W>(T a,U b,V c,W d) => new P<T,U,V,W>(a,b,c,d);
[MethodImpl(256)] public static bool initd<T,U>(Dictionary<T,U> d, T k) { if(d.ContainsKey(k)) { return false; } else { d[k] = default(U); return true; } }
public static T[] inita<T>(long len1) where T : new() { var m = new T[len1]; for (int i=0;i<m.Length;i++) m[i] = new T(); return m; }
public static T[][] initm<T>(long len1,long len2,T val) where T : struct { var m = new T[len1][]; for (int i=0;i<m.Length;i++) m[i] = Enumerable.Repeat(val,(int)len2).ToArray(); return m; }
public static T[][][] initm<T>(long len1,long len2,long len3,T val) where T : struct { var m = new T[len1][][]; for (int i=0;i<m.Length;i++) m[i] = initm(len2,len3,val); return m; }
public const long MOD1 = 1000000007; // 10^9+7
public const double EPS1 = 1e-8;
public const long INF1 = 1000000000000000; // 10^15
}
public struct P<T,U>
{
public T A; public U B;
public P(T a,U b) { A = a; B = b; }
public static implicit operator KeyValuePair<T,U>(P<T,U> a) => new KeyValuePair<T,U>(a.A,a.B);
public static implicit operator P<T,U>(KeyValuePair<T,U> a) => new P<T,U>(a.Key,a.Value);
}
public struct P<T,U,V>
{
public T A; public U B; public V C;
public P(T a,U b,V c) { A = a; B = b; C = c; }
}
public struct P<T,U,V,W>
{
public T A; public U B; public V C; public W D;
public P(T a,U b,V c,W d) { A = a; B = b; C = c; D = d; }
}
public static class Lib_IO
{
class Prt : System.IO.StreamWriter
{
public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
public Prt(System.IO.Stream s) : base(s,new UTF8Encoding(false,true)) {}
public Prt(System.IO.Stream s,Encoding e) : base(s,e) {}
}
static Prt sw = new Prt(Console.OpenStandardOutput());
static char[] sp = new char[] {' '};
[MethodImpl(256)] static bool eq<T,U>() => typeof(T).Equals(typeof(U));
[MethodImpl(256)] static T ct<T,U>(U a) => (T)Convert.ChangeType(a,typeof(T));
[MethodImpl(256)] static T cv<T>(string s) =>
eq<T,int>() ? ct<T,int>(int.Parse(s))
: eq<T,long>() ? ct<T,long>(long.Parse(s))
: eq<T,double>() ? ct<T,double>(double.Parse(s,System.Globalization.CultureInfo.InvariantCulture))
: eq<T,char>() ? ct<T,char>(s[0])
: ct<T,string>(s);
public static string[] rm<T>(out T a) {
var z = Console.ReadLine().Split(sp,StringSplitOptions.RemoveEmptyEntries);
a = cv<T>(z[0]);
return z;
}
public static string[] rm<T,U>(out T a,out U b) {
var z = rm<T>(out a);
b = cv<U>(z[1]);
return z;
}
public static string[] rm<T,U,V>(out T a,out U b,out V c) {
var z = rm<T,U>(out a,out b);
c = cv<V>(z[2]);
return z;
}
public static string[] rm<T,U,V,W>(out T a,out U b,out V c,out W d) {
var z = rm<T,U,V>(out a,out b,out c);
d = cv<W>(z[3]);
return z;
}
public static string[] rm<T,U,V,W,X>(out T a,out U b,out V c,out W d,out X e) {
var z = rm<T,U,V,W>(out a,out b,out c,out d);
e = cv<X>(z[4]);
return z;
}
public static string[] rm<T,U,V,W,X,Y>(out T a,out U b,out V c,out W d,out X e,out Y f) {
var z = rm<T,U,V,W,X>(out a,out b,out c,out d,out e);
f = cv<Y>(z[5]);
return z;
}
public static string[] ra<T>(out T[] a) {
var z = Console.ReadLine().Split(sp,StringSplitOptions.RemoveEmptyEntries);
a = z.Select(cv<T>).ToArray();
return z;
}
public static string[][] rl<T>(long n,out T[] a) {
a = new T[n];
var y = new string[n][];
for(int i=0;i<n;i++) y[i] = rm(out a[i]);
return y;
}
public static string[][] rl<T,U>(long n,out P<T,U>[] a) {
a = new P<T,U>[n];
var y = new string[n][];
for(int i=0;i<n;i++) {
T o; U p;
y[i] = rm(out o,out p);
a[i] = new P<T,U>(o,p);
}
return y;
}
public static string[][] rl<T,U,V>(long n,out P<T,U,V>[] a) {
a = new P<T,U,V>[n];
var y = new string[n][];
for(int i=0;i<n;i++) {
T o; U p; V q;
y[i] = rm(out o,out p,out q);
a[i] = new P<T,U,V>(o,p,q);
}
return y;
}
public static string[][] rl<T,U,V,W>(long n,out P<T,U,V,W>[] a) {
a = new P<T,U,V,W>[n];
var y = new string[n][];
for(int i=0;i<n;i++) {
T o; U p; V q; W r;
y[i] = rm(out o,out p,out q,out r);
a[i] = new P<T,U,V,W>(o,p,q,r);
}
return y;
}
public static string[][] rx<T>(long n,out T[][] a) {
a = new T[n][];
var y = new string[n][];
for(int i=0;i<n;i++) y[i] = ra(out a[i]);
return y;
}
static void wwp(Action act){
sw.AutoFlush = false;
Console.SetOut(sw);
act();
Console.Out.Flush();
sw.AutoFlush = true;
Console.SetOut(sw);
}
[MethodImpl(256)] static string wfm(Type t) =>t.Equals(typeof(double)) ? "{0:F10}" : "{0}";
public static void wm(params object[] a) {
wwp(()=>{
for(int i=0;i<a.Length-1;i++) Console.Write(wfm(a[i].GetType())+" ",a[i]);
Console.WriteLine(wfm(a[a.Length-1].GetType()),a[a.Length-1]);
});
}
public static void wa<T>(IList<T> a) { wxa(new IList<T>[]{a}, " "); }
public static void wl<T>(IList<T> a) {
wwp(()=>{
var f = wfm(typeof(T));
foreach(T x in a) Console.WriteLine(f,x);
});
}
static void wxa<T>(IList<IList<T>> a, string s) {
wwp(()=>{
var f = wfm(typeof(T));
var g = f + s;
foreach(var b in a) {
for(int i=0;i<b.Count-1;i++) Console.Write(g,b[i]);
Console.WriteLine(f,b[b.Count-1]);
}
});
}
public static void wx<T>(IList<IList<T>> a) { wxa(a, " "); }
public static void wg<T>(IList<IList<T>> a) { wxa(a, ""); }
}
#endregion
}
|
[["+", 0, 41, 15, 23, 0, 16, 31, 16, 31, 203], ["+", 0, 41, 15, 23, 0, 16, 31, 16, 17, 19], ["+", 0, 41, 15, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 212, 0, 41, 15, 23, 0, 16, 17, 98]]
| 8
| 2,933
| 4
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace A {
class StartingPoint {
static void Main(string[] args) {
if (args?.Any() == true) {
var assembly = Assembly.GetEntryAssembly();
var resourceName = "AtCoderCSharp.In.txt";
var stream = assembly.GetManifestResourceStream(resourceName);
var streamReader = new StreamReader(stream, Encoding.UTF8);
var str = streamReader.ReadToEnd();
var textReader = new StringReader(str);
Console.SetIn(textReader);
}
try {
foreach (var s in new Program().Solve()) {
Console.WriteLine(s);
}
} catch (Exception e) {
Console.WriteLine(e);
if (args?.Any() != true)
throw e;
}
if (args?.Any() == true)
Console.ReadKey();
}
}
class Program {
public List<int> ScanInts(int count) =>
Enumerable.Range(0, count).Select(_ => ScanInt).ToList();
public List<int> ScanInts(long count) => ScanInts((int)count);
public List<long>
ScanLongs(int count) => Enumerable.Range(0, count).Select(_ => Scan).ToList();
public List<long> ScanLongs(long count) => ScanLongs((int)count);
public int ScanInt => int.Parse(Str);
public long Scan => long.Parse(Str);
public double ScanDouble => (double)Scan;
StringBuilder sb = new StringBuilder();
public string Str => ScanStr();
public string ScanStr() {
sb.Clear();
int r = 0;
bool? b = null;
do {
r = Console.Read();
b = IsBreak(r);
} while (b == true);
if (b == null)
throw new Exception("input error: unexpected end of stream");
do {
sb.Append((char)r);
r = Console.Read();
b = IsBreak(r);
} while (b == false);
return sb.ToString();
}
bool? IsBreak(int c) {
switch (c) {
case -1:
return null;
case (int)' ':
case (int)'\n':
case (int)'\r':
return true;
default:
return false;
}
}
public IEnumerable<int> Loop(int count) => Enumerable.Range(0, count);
public IEnumerable<int> Loop(int from,
int to) => Enumerable.Range(from, to - from + 1);
public IEnumerable<long> Loop(long count) => Loop(0, count - 1);
public IEnumerable<long> Loop(long from, long to) {
for (long i = from; i <= to; i++)
yield return i;
}
public string YesNo(bool isYes) => isYes ? "Yes" : "No";
public HashSet<T> ToHashSet<T>(IEnumerable<T> ts) => new HashSet<T>(ts);
public IEnumerable<string> Solve() {
var a = Scan;
var b = Scan;
var c = Scan;
var rr = 4 * a * b;
var l = c - a - b;
var ll = l * l;
var res = ll < rr && l >= 0;
yield return YesNo(res);
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace A {
class StartingPoint {
static void Main(string[] args) {
if (args?.Any() == true) {
var assembly = Assembly.GetEntryAssembly();
var resourceName = "AtCoderCSharp.In.txt";
var stream = assembly.GetManifestResourceStream(resourceName);
var streamReader = new StreamReader(stream, Encoding.UTF8);
var str = streamReader.ReadToEnd();
var textReader = new StringReader(str);
Console.SetIn(textReader);
}
try {
foreach (var s in new Program().Solve()) {
Console.WriteLine(s);
}
} catch (Exception e) {
Console.WriteLine(e);
if (args?.Any() != true)
throw e;
}
if (args?.Any() == true)
Console.ReadKey();
}
}
class Program {
public List<int> ScanInts(int count) =>
Enumerable.Range(0, count).Select(_ => ScanInt).ToList();
public List<int> ScanInts(long count) => ScanInts((int)count);
public List<long>
ScanLongs(int count) => Enumerable.Range(0, count).Select(_ => Scan).ToList();
public List<long> ScanLongs(long count) => ScanLongs((int)count);
public int ScanInt => int.Parse(Str);
public long Scan => long.Parse(Str);
public double ScanDouble => (double)Scan;
StringBuilder sb = new StringBuilder();
public string Str => ScanStr();
public string ScanStr() {
sb.Clear();
int r = 0;
bool? b = null;
do {
r = Console.Read();
b = IsBreak(r);
} while (b == true);
if (b == null)
throw new Exception("input error: unexpected end of stream");
do {
sb.Append((char)r);
r = Console.Read();
b = IsBreak(r);
} while (b == false);
return sb.ToString();
}
bool? IsBreak(int c) {
switch (c) {
case -1:
return null;
case (int)' ':
case (int)'\n':
case (int)'\r':
return true;
default:
return false;
}
}
public IEnumerable<int> Loop(int count) => Enumerable.Range(0, count);
public IEnumerable<int> Loop(int from,
int to) => Enumerable.Range(from, to - from + 1);
public IEnumerable<long> Loop(long count) => Loop(0, count - 1);
public IEnumerable<long> Loop(long from, long to) {
for (long i = from; i <= to; i++)
yield return i;
}
public string YesNo(bool isYes) => isYes ? "Yes" : "No";
public HashSet<T> ToHashSet<T>(IEnumerable<T> ts) => new HashSet<T>(ts);
public IEnumerable<string> Solve() {
var a = Scan;
var b = Scan;
var c = Scan;
var rr = 4 * a * b;
var l = c - a - b;
var ll = l * l;
var res = rr < ll && l >= 0;
yield return YesNo(res);
}
}
}
|
[["-", 0, 200, 0, 212, 0, 16, 31, 16, 31, 22], ["-", 0, 200, 0, 212, 0, 16, 31, 16, 17, 18], ["+", 0, 200, 0, 212, 0, 16, 31, 16, 17, 18], ["+", 0, 200, 0, 212, 0, 16, 31, 16, 12, 22]]
| 8
| 720
| 4
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
public class Hello {
static public int mod = 1000000007;
public static void Main() {
int num = rint();
var list = new List<List<string>>();
for (int i = 0; i < 11; i++) {
list.Add(new List<string>());
}
list[0].Add("a");
string al = "abcdefghijkl";
for (int i = 1; i < 4; i++) {
foreach (var str in list[i - 1]) {
int max = -1;
for (int k = 0; k < str.Length; k++) {
int tempa = al.IndexOf(str[k].ToString());
max = Max(max, tempa);
}
max++;
for (int k = 0; k <= max; k++) {
string temp = str;
temp += al[k].ToString();
// WriteLine(max);
list[i].Add(temp);
}
}
}
foreach (var k in list[3]) {
WriteLine(k);
}
}
static int ncr(int n, int r) {
r = Min(r, n - r);
long nn = 1;
for (int i = n - r + 1; i <= n; i++) {
nn = nn * i % mod;
}
long rr = 1;
for (int i = 1; i <= r; i++) {
rr = rr * i % mod;
}
rr = square((int)rr, mod - 2);
nn = nn * rr % mod;
return (int)nn;
}
// a^b mod
static int square(int a, int b) {
string binary = Convert.ToString(b, 2);
int bileng = binary.Length;
long a_power = a;
long value = 1;
for (int i = bileng - 1; i >= 0; i--) {
if (binary[i] == '1') {
value = value * a_power % mod;
}
a_power = a_power * a_power % mod;
}
return (int)value;
}
// static int square2(long a,long b,long m){var list = new List<int>();int
// temp = 1;long n2 = a;list.Add(1);int count = 1;while(temp <
// b){list.Add((int)n2);temp*=2;count++;n2 = n2*n2%m;}long ret = 1;while(b >
// 0){if(temp <= b){b -= temp;ret =
// ret*list[count]%1000000007;}count--;temp/=2;}return(int)ret;} 各種読取
static string rstr() { return ReadLine(); }
static int rint() { return int.Parse(ReadLine()); }
static long rlong() { return long.Parse(ReadLine()); }
static string[] stra() { return ReadLine().Split(' '); }
static int[] inta() {
string[] read_str_array = ReadLine().Split(' ');
int[] return_int_array = new int[read_str_array.Length];
for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
}
return return_int_array;
}
static int[,] inta2(int num_array, int in_array) {
int[,] int_array2 = new int[num_array, in_array];
for (int i = 0; i < num_array; i++) {
int[] temp_array = inta();
for (int j = 0; j < in_array; j++) {
int_array2[i, j] = temp_array[j];
}
}
return int_array2;
}
static long[] longa() {
string[] read_str_array = ReadLine().Split(' ');
long[] return_long_array = new long[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_long_array[countup_i] = long.Parse(read_str_array[countup_i]);
}
return return_long_array;
}
static double[] doublea() {
string[] read_str_array = ReadLine().Split(' ');
double[] return_double_array = new double[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_double_array[countup_i] = long.Parse(read_str_array[countup_i]);
}
return return_double_array;
}
// -----------------------------
static long divideup(long divided, long divid) {
long temp_divide = divided / divid;
if (divided % divid > 0) {
temp_divide++;
}
return temp_divide;
}
static long GCD(long a, long b) {
if (a < b) {
long temp = a;
a = b;
b = temp;
}
if (a % b == 0) {
return b;
} else {
long temp = b;
b = a % b;
a = temp;
return GCD(a, b);
}
}
static long LCM(long a, long b) { return a * b / GCD(a, b); }
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
public class Hello {
static public int mod = 1000000007;
public static void Main() {
int num = rint();
var list = new List<List<string>>();
for (int i = 0; i < 10; i++) {
list.Add(new List<string>());
}
list[0].Add("a");
string al = "abcdefghijkl";
for (int i = 1; i < 10; i++) {
foreach (var str in list[i - 1]) {
int max = -1;
for (int k = 0; k < str.Length; k++) {
int tempa = al.IndexOf(str[k].ToString());
max = Max(max, tempa);
}
max++;
for (int k = 0; k <= max; k++) {
string temp = str;
temp += al[k].ToString();
list[i].Add(temp);
}
}
}
foreach (var k in list[num - 1]) {
WriteLine(k);
}
}
static int ncr(int n, int r) {
r = Min(r, n - r);
long nn = 1;
for (int i = n - r + 1; i <= n; i++) {
nn = nn * i % mod;
}
long rr = 1;
for (int i = 1; i <= r; i++) {
rr = rr * i % mod;
}
rr = square((int)rr, mod - 2);
nn = nn * rr % mod;
return (int)nn;
}
// a^b mod
static int square(int a, int b) {
string binary = Convert.ToString(b, 2);
int bileng = binary.Length;
long a_power = a;
long value = 1;
for (int i = bileng - 1; i >= 0; i--) {
if (binary[i] == '1') {
value = value * a_power % mod;
}
a_power = a_power * a_power % mod;
}
return (int)value;
}
// static int square2(long a,long b,long m){var list = new List<int>();int
// temp = 1;long n2 = a;list.Add(1);int count = 1;while(temp <
// b){list.Add((int)n2);temp*=2;count++;n2 = n2*n2%m;}long ret = 1;while(b >
// 0){if(temp <= b){b -= temp;ret =
// ret*list[count]%1000000007;}count--;temp/=2;}return(int)ret;} 各種読取
static string rstr() { return ReadLine(); }
static int rint() { return int.Parse(ReadLine()); }
static long rlong() { return long.Parse(ReadLine()); }
static string[] stra() { return ReadLine().Split(' '); }
static int[] inta() {
string[] read_str_array = ReadLine().Split(' ');
int[] return_int_array = new int[read_str_array.Length];
for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
}
return return_int_array;
}
static int[,] inta2(int num_array, int in_array) {
int[,] int_array2 = new int[num_array, in_array];
for (int i = 0; i < num_array; i++) {
int[] temp_array = inta();
for (int j = 0; j < in_array; j++) {
int_array2[i, j] = temp_array[j];
}
}
return int_array2;
}
static long[] longa() {
string[] read_str_array = ReadLine().Split(' ');
long[] return_long_array = new long[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_long_array[countup_i] = long.Parse(read_str_array[countup_i]);
}
return return_long_array;
}
static double[] doublea() {
string[] read_str_array = ReadLine().Split(' ');
double[] return_double_array = new double[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_double_array[countup_i] = long.Parse(read_str_array[countup_i]);
}
return return_double_array;
}
// -----------------------------
static long divideup(long divided, long divid) {
long temp_divide = divided / divid;
if (divided % divid > 0) {
temp_divide++;
}
return temp_divide;
}
static long GCD(long a, long b) {
if (a < b) {
long temp = a;
a = b;
b = temp;
}
if (a % b == 0) {
return b;
} else {
long temp = b;
b = a % b;
a = temp;
return GCD(a, b);
}
}
static long LCM(long a, long b) { return a * b / GCD(a, b); }
}
|
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["-", 0, 210, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 12, 204, 206, 207, 0, 28, 0, 16, 31, 22], ["+", 12, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 12, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 983
| 8
|
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;
public class P {
public string s { get; set; }
public char mx { get; set; }
}
public class Hello {
public static void Main() { var n = int.Parse(Console.ReadLine().Trim()); }
static void getAns(int n) {
var sb = new StringBuilder();
var q = new Queue<P>();
q.Enqueue(new P { s = "a", mx = 'a' });
while (q.Count() > 0) {
var w = q.Dequeue();
if (w.s.Length == n) {
sb.Append(w.s);
sb.Append("\n");
} else {
for (int i = 'a'; i <= w.mx; i++)
q.Enqueue(new P { s = w.s + (char)i, mx = w.mx });
q.Enqueue(new P { s = w.s + (char)(w.mx + 1), mx = (char)(w.mx + 1) });
}
}
Console.Write(sb);
}
}
|
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;
public class P {
public string s { get; set; }
public char mx { get; set; }
}
public class Hello {
public static void Main() {
var n = int.Parse(Console.ReadLine().Trim());
getAns(n);
}
static void getAns(int n) {
var sb = new StringBuilder();
var q = new Queue<P>();
q.Enqueue(new P { s = "a", mx = 'a' });
while (q.Count() > 0) {
var w = q.Dequeue();
if (w.s.Length == n) {
sb.Append(w.s);
sb.Append("\n");
} else {
for (int i = 'a'; i <= w.mx; i++)
q.Enqueue(new P { s = w.s + (char)i, mx = w.mx });
q.Enqueue(new P { s = w.s + (char)(w.mx + 1), mx = (char)(w.mx + 1) });
}
}
Console.Write(sb);
}
}
|
[["+", 0, 195, 8, 196, 0, 1, 0, 213, 63, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
| 8
| 267
| 5
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;
namespace Atcoder {
class Program {
static StreamWriter sw =
new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
static void Main(string[] args) {
try {
SetOut(sw);
Solve.Answer();
Out.Flush();
} catch (Exception ex) {
WriteLine(ex.ToString());
}
}
}
public class Solve {
public static void Answer() {
var s = ReadLine();
for (int i = 0; i < s.Length; i++) {
if (i % 2 == 0) {
if (s[i] != 'h') {
WriteLine("No");
return;
}
} else {
if (s[i] != 'i') {
WriteLine("No");
return;
}
}
}
if (s.Length == 1)
WriteLine("No");
if (s.Length == 1)
return;
WriteLine("Yes");
}
public class IO {
#region Input
public static int RInt => int.Parse(ReadLine());
public static long RLong => long.Parse(ReadLine());
public static double RDouble => double.Parse(ReadLine());
public static string[] RSString => ReadLine().Split();
public static int[] RSInt =>
ReadLine().Split().Select(s => int.Parse(s)).ToArray();
public static long[] RSLong =>
ReadLine().Split().Select(s => long.Parse(s)).ToArray();
public static double[] RSDouble =>
ReadLine().Split().Select(s => double.Parse(s)).ToArray();
#endregion
#region Output
public static void
OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes"
: "No");
public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES"
: "NO");
#endregion
}
public class Mod {
#region
private readonly static long M = 1000000007;
public static long Add(long a, long b) => (a * b) % M;
public static long Sub(long a, long b) => (a - b) % M >= 0
? (a - b) % M
: (a - b) % M + M;
public static long Multi(long a, long b) => (a * b) % M;
#endregion
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;
namespace Atcoder {
class Program {
static StreamWriter sw =
new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
static void Main(string[] args) {
try {
SetOut(sw);
Solve.Answer();
Out.Flush();
} catch (Exception ex) {
WriteLine(ex.ToString());
}
}
}
public class Solve {
public static void Answer() {
var s = ReadLine();
for (int i = 0; i < s.Length; i++) {
if (i % 2 == 0) {
if (s[i] != 'h') {
WriteLine("No");
return;
}
} else {
if (s[i] != 'i') {
WriteLine("No");
return;
}
}
}
if (s.Length % 2 == 1)
WriteLine("No");
if (s.Length % 2 == 1)
return;
WriteLine("Yes");
}
public class IO {
#region Input
public static int RInt => int.Parse(ReadLine());
public static long RLong => long.Parse(ReadLine());
public static double RDouble => double.Parse(ReadLine());
public static string[] RSString => ReadLine().Split();
public static int[] RSInt =>
ReadLine().Split().Select(s => int.Parse(s)).ToArray();
public static long[] RSLong =>
ReadLine().Split().Select(s => long.Parse(s)).ToArray();
public static double[] RSDouble =>
ReadLine().Split().Select(s => double.Parse(s)).ToArray();
#endregion
#region Output
public static void
OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes"
: "No");
public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES"
: "NO");
#endregion
}
public class Mod {
#region
private readonly static long M = 1000000007;
public static long Add(long a, long b) => (a * b) % M;
public static long Sub(long a, long b) => (a - b) % M >= 0
? (a - b) % M
: (a - b) % M + M;
public static long Multi(long a, long b) => (a * b) % M;
#endregion
}
}
}
|
[["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203]]
| 8
| 578
| 4
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
class Program {
static void Main(string[] args) {
// 入力
var s = Console.ReadLine();
// var n = int.Parse(Console.ReadLine());
// int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
var ans = "No";
s.Replace("hi", "?");
var tmp = s.Where(x => x != '?').Count();
if (tmp == 0)
ans = "Yes";
// 出力
Console.WriteLine(ans);
}
}
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
class Program {
static void Main(string[] args) {
// 入力
var s = Console.ReadLine();
// var n = int.Parse(Console.ReadLine());
// int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
var ans = "No";
var tmp = s.Replace("hi", "?");
var count = tmp.Where(x => x != '?').Count();
if (count == 0)
ans = "Yes";
// 出力
Console.WriteLine(ans);
}
}
|
[["+", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 0, 213, 63, 214, 205, 213, 63, 214, 205, 22], ["+", 0, 213, 63, 214, 205, 213, 63, 214, 205, 22], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22]]
| 8
| 112
| 9
|
// A Dynamic Programming based
// C# program to find minimum
// number operations to
// convert str1 to str2
using System;
using System.Collections.Generic;
using System.Linq;
class GFG {
public static void Main() {
var input = Console.ReadLine();
HitachiString(input);
}
static void HitachiString(string s) {
if (s.Length % 2 != 0) {
Console.Write("No");
return;
}
if (s.Length == 2) {
if (s[0] == 'h' && s[1] == 'i') {
Console.Write("Yes");
return;
} else {
Console.Write("No");
return;
}
}
for (int i = 2; i < s.Length; i++) {
if (s[i] != s[i - 2]) {
Console.Write("No");
break;
}
}
Console.Write("Yes");
}
}
|
// A Dynamic Programming based
// C# program to find minimum
// number operations to
// convert str1 to str2
using System;
using System.Collections.Generic;
using System.Linq;
class GFG {
public static void Main() {
var input = Console.ReadLine();
HitachiString(input);
}
static void HitachiString(string s) {
if (s.Length % 2 != 0) {
Console.Write("No");
return;
}
if (s.Length == 2) {
if (s[0] == 'h' && s[1] == 'i') {
Console.Write("Yes");
return;
} else {
Console.Write("No");
return;
}
}
for (int i = 2; i < s.Length; i++) {
if (s[i] != s[i - 2]) {
Console.Write("No");
return;
}
}
Console.Write("Yes");
}
}
|
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]]
| 8
| 188
| 2
|
using System;
using System.Text.RegularExpressions;
namespace A {
class Program {
static void Main(string[] args) {
var hiInf = new Regex(@"^hi{2,}");
var regex = new Regex(@"^hi*?");
var str = Console.ReadLine();
if (hiInf.IsMatch(str)) {
Console.WriteLine("No");
return;
}
if (regex.IsMatch(str))
Console.WriteLine("Yes");
else
Console.WriteLine("No");
}
}
}
|
using System;
using System.Text.RegularExpressions;
namespace A {
class Program {
static void Main(string[] args) {
var hiInf = new Regex(@"^hi{2,}");
var regex = new Regex(@"^(hi)+$");
var str = Console.ReadLine();
if (hiInf.IsMatch(str)) {
Console.WriteLine("No");
return;
}
if (regex.IsMatch(str))
Console.WriteLine("Yes");
else
Console.WriteLine("No");
}
}
}
|
[["-", 0, 212, 0, 230, 3, 4, 0, 28, 0, 258], ["+", 0, 212, 0, 230, 3, 4, 0, 28, 0, 258]]
| 8
| 106
| 2
|
using System;
using System.Text.RegularExpressions;
using CompLib.Util;
public class Program {
public void Solve() {
var sc = new Scanner();
string s = sc.Next();
var r = new Regex("(hi)+");
if (r.IsMatch(s)) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
public static void Main(string[] args) => new Program().Solve();
}
namespace CompLib.Util {
using System;
using System.Linq;
class Scanner {
private string[] _line;
private int _index;
private const char Separator = ' ';
public Scanner() {
_line = new string[0];
_index = 0;
}
public string Next() {
while (_index >= _line.Length) {
_line = Console.ReadLine().Split(Separator);
_index = 0;
}
return _line[_index++];
}
public int NextInt() => int.Parse(Next());
public long NextLong() => long.Parse(Next());
public double NextDouble() => double.Parse(Next());
public decimal NextDecimal() => decimal.Parse(Next());
public char NextChar() => Next()[0];
public char[] NextCharArray() => Next().ToCharArray();
public string[] Array() {
_line = Console.ReadLine().Split(Separator);
_index = _line.Length;
return _line;
}
public int[] IntArray() => Array().Select(int.Parse).ToArray();
public long[] LongArray() => Array().Select(long.Parse).ToArray();
public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
}
}
|
using System;
using System.Text.RegularExpressions;
using CompLib.Util;
public class Program {
public void Solve() {
var sc = new Scanner();
string s = sc.Next();
var r = new Regex("^(hi)+$");
if (r.IsMatch(s)) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
public static void Main(string[] args) => new Program().Solve();
}
namespace CompLib.Util {
using System;
using System.Linq;
class Scanner {
private string[] _line;
private int _index;
private const char Separator = ' ';
public Scanner() {
_line = new string[0];
_index = 0;
}
public string Next() {
while (_index >= _line.Length) {
_line = Console.ReadLine().Split(Separator);
_index = 0;
}
return _line[_index++];
}
public int NextInt() => int.Parse(Next());
public long NextLong() => long.Parse(Next());
public double NextDouble() => double.Parse(Next());
public decimal NextDecimal() => decimal.Parse(Next());
public char NextChar() => Next()[0];
public char[] NextCharArray() => Next().ToCharArray();
public string[] Array() {
_line = Console.ReadLine().Split(Separator);
_index = _line.Length;
return _line;
}
public int[] IntArray() => Array().Select(int.Parse).ToArray();
public long[] LongArray() => Array().Select(long.Parse).ToArray();
public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
}
}
|
[["-", 0, 230, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 230, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 415
| 2
|
using System;
public class A {
public static void Main() {
string S = Console.ReadLine();
char[] str = S.ToCharArray();
bool isHitachi = true;
if (S.Length == 1) {
isHitachi = false;
} else {
for (int i = 0; i < S.Length; i += 2) {
if (!((str[i] == 'h') && (str[i + 1] == 'i'))) {
isHitachi = false;
break;
}
}
}
if (isHitachi)
Console.WriteLine("Yes");
else
Console.WriteLine("No");
}
}
|
using System;
public class A {
public static void Main() {
string S = Console.ReadLine();
char[] str = S.ToCharArray();
bool isHitachi = true;
if (S.Length % 2 == 1) {
isHitachi = false;
} else {
for (int i = 0; i < S.Length; i += 2) {
if (!((str[i] == 'h') && (str[i + 1] == 'i'))) {
isHitachi = false;
break;
}
}
}
if (isHitachi)
Console.WriteLine("Yes");
else
Console.WriteLine("No");
}
}
|
[["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203]]
| 8
| 137
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace CSharpSample01 {
class Program {
static void Main(string[] args) {
var S = Console.ReadLine();
var flag = true;
for (int i = 0; i < S.Length; i++) {
if (i % 2 == 0) {
if (S[i] != 'h') {
flag = false;
break;
}
} else {
if (S[i] != 'i') {
flag = false;
break;
}
}
}
if (S.Length == 1) {
flag = false;
}
if (flag) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace CSharpSample01 {
class Program {
static void Main(string[] args) {
var S = Console.ReadLine();
var flag = true;
for (int i = 0; i < S.Length; i++) {
if (i % 2 == 0) {
if (S[i] != 'h') {
flag = false;
break;
}
} else {
if (S[i] != 'i') {
flag = false;
break;
}
}
}
if (S.Length % 2 == 1) {
flag = false;
}
if (flag) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
}
}
|
[["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203]]
| 8
| 163
| 2
|
using System;
using System.Linq;
namespace Hitachi2020A {
class MainClass {
public static void Main(string[] args) {
string s = Console.ReadLine();
string res = "Yes";
if (s.Length < 2) {
Console.WriteLine("No");
return;
}
for (int i = 0; i < s.Length; i++) {
if (s.Substring(i, 2) == "hi") {
i++;
continue;
} else {
res = "No";
break;
}
}
Console.WriteLine(res);
}
}
}
|
using System;
using System.Linq;
namespace Hitachi2020A {
class MainClass {
public static void Main(string[] args) {
string s = Console.ReadLine();
string res = "Yes";
if (s.Length % 2 == 1) {
Console.WriteLine("No");
return;
}
for (int i = 0; i < s.Length; i++) {
if (s.Substring(i, 2) == "hi") {
i++;
continue;
} else {
res = "No";
break;
}
}
Console.WriteLine(res);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203]]
| 8
| 123
| 4
|
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;
class DandA {
static void Main(string[] args) {
string s = ReadLineStr();
if (s.Length == 1) {
Console.WriteLine("No");
return;
}
for (int i = 0; i < s.Length; i++) {
if ((i % 2 == 0 && s.Substring(i, 1) != "h") ||
(i % 2 == 1 && s.Substring(i, 1) != "i")) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
static public void myLoop(int index, int lenght, List<bool> boolList) {
myLoop(index, lenght, boolList);
}
static string Alphabet =
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
static string[] strAry = new string[] { "L", "R", "U", "D" };
static int[] intArray = new int[10];
static List<int> intList = new List<int>();
static Dictionary<string, int> myTable = new Dictionary<string, int>();
static HashSet<int>[] rtnArrAb = null;
static HashSet<int>[] rtnArrCd = null;
static int iRtn;
static int[] rdx = null;
static int[][] lrArr = null;
static int[] pArr = null;
static private string ReadLineStr() { return Console.ReadLine(); }
static private int ReadLineInt() { return int.Parse(Console.ReadLine()); }
static private long ReadLineLong() { return long.Parse(Console.ReadLine()); }
static private double ReadLineDouble() {
return double.Parse(Console.ReadLine());
}
static private string[] ReadLineStrArray() {
return Console.ReadLine().Trim().Split();
}
static private int[] ReadLineIntArray() {
return Console.ReadLine()
.Trim()
.Split()
.Select(a => int.Parse(a))
.ToArray();
}
static private long[] ReadLineLongArray() {
return Console.ReadLine()
.Trim()
.Split()
.Select(a => long.Parse(a))
.ToArray();
}
static private double[] ReadLineDoubleArray() {
return Console.ReadLine()
.Trim()
.Split()
.Select(a => double.Parse(a))
.ToArray();
}
static private decimal[] ReadLineDecimalArray() {
return Console.ReadLine()
.Trim()
.Split()
.Select(a => decimal.Parse(a))
.ToArray();
}
static private List<int> ReadLineIntList() {
return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToList();
}
static private List<long> ReadLineLongList() {
return Console.ReadLine()
.Trim()
.Split()
.Select(a => long.Parse(a))
.ToList();
}
static private string[][] ReadMLineStrArray(int arg) {
return new int [arg].Select(_ => Console.ReadLine().Split()).ToArray();
}
static private int[][] ReadMLineIntArray(int arg) {
return new int [arg]
.Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray())
.ToArray();
}
static private bool IsPrime(int num) {
if (num < 2)
return false;
if (num == 2)
return true;
else if (num % 2 == 0)
return false;
double sqrtNum = Math.Sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0)
return false;
}
return true;
}
static private string IntToNString(int x, int n) {
var nstring = "";
var numbers = new string[] { "0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "a", "b", "c", "d", "e", "f" };
int r = 1;
int q = x;
while (q > 0) {
r = q % n;
nstring += numbers[r];
q = q / n;
}
return string.Join("", nstring.Reverse());
}
/* 最大公約数 */
static private long Gcd(long m, long n) {
long temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
}
|
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;
class DandA {
static void Main(string[] args) {
string s = ReadLineStr();
if (s.Length % 2 == 1) {
Console.WriteLine("No");
return;
}
for (int i = 0; i < s.Length; i++) {
if ((i % 2 == 0 && s.Substring(i, 1) != "h") ||
(i % 2 == 1 && s.Substring(i, 1) != "i")) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
static public void myLoop(int index, int lenght, List<bool> boolList) {
myLoop(index, lenght, boolList);
}
static string Alphabet =
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
static string[] strAry = new string[] { "L", "R", "U", "D" };
static int[] intArray = new int[10];
static List<int> intList = new List<int>();
static Dictionary<string, int> myTable = new Dictionary<string, int>();
static HashSet<int>[] rtnArrAb = null;
static HashSet<int>[] rtnArrCd = null;
static int iRtn;
static int[] rdx = null;
static int[][] lrArr = null;
static int[] pArr = null;
static private string ReadLineStr() { return Console.ReadLine(); }
static private int ReadLineInt() { return int.Parse(Console.ReadLine()); }
static private long ReadLineLong() { return long.Parse(Console.ReadLine()); }
static private double ReadLineDouble() {
return double.Parse(Console.ReadLine());
}
static private string[] ReadLineStrArray() {
return Console.ReadLine().Trim().Split();
}
static private int[] ReadLineIntArray() {
return Console.ReadLine()
.Trim()
.Split()
.Select(a => int.Parse(a))
.ToArray();
}
static private long[] ReadLineLongArray() {
return Console.ReadLine()
.Trim()
.Split()
.Select(a => long.Parse(a))
.ToArray();
}
static private double[] ReadLineDoubleArray() {
return Console.ReadLine()
.Trim()
.Split()
.Select(a => double.Parse(a))
.ToArray();
}
static private decimal[] ReadLineDecimalArray() {
return Console.ReadLine()
.Trim()
.Split()
.Select(a => decimal.Parse(a))
.ToArray();
}
static private List<int> ReadLineIntList() {
return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToList();
}
static private List<long> ReadLineLongList() {
return Console.ReadLine()
.Trim()
.Split()
.Select(a => long.Parse(a))
.ToList();
}
static private string[][] ReadMLineStrArray(int arg) {
return new int [arg].Select(_ => Console.ReadLine().Split()).ToArray();
}
static private int[][] ReadMLineIntArray(int arg) {
return new int [arg]
.Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray())
.ToArray();
}
static private bool IsPrime(int num) {
if (num < 2)
return false;
if (num == 2)
return true;
else if (num % 2 == 0)
return false;
double sqrtNum = Math.Sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0)
return false;
}
return true;
}
static private string IntToNString(int x, int n) {
var nstring = "";
var numbers = new string[] { "0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "a", "b", "c", "d", "e", "f" };
int r = 1;
int q = x;
while (q > 0) {
r = q % n;
nstring += numbers[r];
q = q / n;
}
return string.Join("", nstring.Reverse());
}
/* 最大公約数 */
static private long Gcd(long m, long n) {
long temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
}
|
[["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203]]
| 8
| 1,023
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Solution {
public static void Main() {
var s = Console.ReadLine();
if (s == "hi" || s == "hihi" || s == "hihihi" || s == "hihihihihi" ||
s == "hihihihihi") {
Console.WriteLine("Yes");
return;
}
Console.WriteLine("No");
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Solution {
public static void Main() {
var s = Console.ReadLine();
if (s == "hi" || s == "hihi" || s == "hihihi" || s == "hihihihi" ||
s == "hihihihihi") {
Console.WriteLine("Yes");
return;
}
Console.WriteLine("No");
}
}
|
[["-", 15, 16, 31, 16, 12, 16, 12, 5, 0, 222], ["+", 15, 16, 31, 16, 12, 16, 12, 5, 0, 222]]
| 8
| 91
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;
namespace AtCoderWorkspace {
public class Solver {
public void Solve() {
var cin = new Scanner();
var s = cin.next();
if (s.Length % 2 == 1) {
Console.WriteLine("No");
return;
}
for (int i = 0; i < s.Length; i += 2) {
if (s[i] == 'h' && s[i + 1] != 'i') {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
}
class Scanner {
string[] s;
int i;
char[] cs = new char[] { ' ' };
public Scanner() {
s = new string[0];
i = 0;
}
public string next() {
if (i < s.Length)
return s[i++];
string st = Console.ReadLine();
while (st == "")
st = Console.ReadLine();
s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
if (s.Length == 0)
return next();
i = 0;
return s[i++];
}
public int nextInt() { return int.Parse(next()); }
public int[] ArrayInt(int N, int add = 0) {
int[] Array = new int[N];
for (int i = 0; i < N; i++) {
Array[i] = nextInt() + add;
}
return Array;
}
public int[] DPArrayInt(int N, int ex) {
int[] Array = new int[N + ex];
for (int i = 0; i < N; i++) {
Array[i] = nextInt();
}
return Array;
}
public long nextLong() { return long.Parse(next()); }
public long[] ArrayLong(int N, long add = 0) {
long[] Array = new long[N];
for (int i = 0; i < N; i++) {
Array[i] = nextLong() + add;
}
return Array;
}
public long[] DPArrayLong(int N, int ex) {
long[] Array = new long[N + ex];
for (int i = 0; i < N; i++) {
Array[i] = nextLong();
}
return Array;
}
public double nextDouble() { return double.Parse(next()); }
public double[] ArrayDouble(int N, double add = 0) {
double[] Array = new double[N];
for (int i = 0; i < N; i++) {
Array[i] = nextDouble() + add;
}
return Array;
}
}
class Program {
static void Main(string[] s) => new Solver().Solve();
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;
namespace AtCoderWorkspace {
public class Solver {
public void Solve() {
var cin = new Scanner();
var s = cin.next();
if (s.Length % 2 == 1) {
Console.WriteLine("No");
return;
}
for (int i = 0; i < s.Length; i += 2) {
if (!(s[i] == 'h' && s[i + 1] == 'i')) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
}
class Scanner {
string[] s;
int i;
char[] cs = new char[] { ' ' };
public Scanner() {
s = new string[0];
i = 0;
}
public string next() {
if (i < s.Length)
return s[i++];
string st = Console.ReadLine();
while (st == "")
st = Console.ReadLine();
s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
if (s.Length == 0)
return next();
i = 0;
return s[i++];
}
public int nextInt() { return int.Parse(next()); }
public int[] ArrayInt(int N, int add = 0) {
int[] Array = new int[N];
for (int i = 0; i < N; i++) {
Array[i] = nextInt() + add;
}
return Array;
}
public int[] DPArrayInt(int N, int ex) {
int[] Array = new int[N + ex];
for (int i = 0; i < N; i++) {
Array[i] = nextInt();
}
return Array;
}
public long nextLong() { return long.Parse(next()); }
public long[] ArrayLong(int N, long add = 0) {
long[] Array = new long[N];
for (int i = 0; i < N; i++) {
Array[i] = nextLong() + add;
}
return Array;
}
public long[] DPArrayLong(int N, int ex) {
long[] Array = new long[N + ex];
for (int i = 0; i < N; i++) {
Array[i] = nextLong();
}
return Array;
}
public double nextDouble() { return double.Parse(next()); }
public double[] ArrayDouble(int N, double add = 0) {
double[] Array = new double[N];
for (int i = 0; i < N; i++) {
Array[i] = nextDouble() + add;
}
return Array;
}
}
class Program {
static void Main(string[] s) => new Solver().Solve();
}
}
|
[["+", 0, 7, 8, 196, 0, 57, 15, 241, 0, 111], ["+", 8, 196, 0, 57, 15, 241, 0, 23, 0, 24], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 79], ["+", 15, 241, 0, 23, 0, 16, 12, 16, 17, 60], ["+", 8, 196, 0, 57, 15, 241, 0, 23, 0, 25]]
| 8
| 634
| 5
|
using System;
using System.Linq;
using System.Collections.Generic;
class Program {
public static void Main() {
string s = Console.ReadLine();
bool flag = false;
if (s[0] != 'h') {
flag = true;
}
for (int i = 1; i < s.Length; i++) {
if (s[i] == 'i') {
if (s[i - 1] != 'h') {
flag = true;
}
} else if (s[i] == 'h') {
if (s[i - 1] != 'i') {
flag = true;
}
} else {
flag = true;
}
}
if (s.Length == 1) {
flag = true;
}
if (flag) {
Console.WriteLine("No");
} else {
Console.WriteLine("Yes");
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
class Program {
public static void Main() {
string s = Console.ReadLine();
bool flag = false;
if (s[0] != 'h') {
flag = true;
}
for (int i = 1; i < s.Length; i++) {
if (s[i] == 'i') {
if (s[i - 1] != 'h') {
flag = true;
}
} else if (s[i] == 'h') {
if (s[i - 1] != 'i') {
flag = true;
}
} else {
flag = true;
}
}
if (s.Length % 2 == 1) {
flag = true;
}
if (flag) {
Console.WriteLine("No");
} else {
Console.WriteLine("Yes");
}
}
}
|
[["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203]]
| 8
| 189
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AtCoder {
public class Solver {
private readonly IInputReader _inputReader;
private readonly IOutputWriter _outputWriter;
public Solver(IInputReader inputReader, IOutputWriter outputWriter) {
_inputReader = inputReader;
_outputWriter = outputWriter;
}
public void Solve() {
var text = _inputReader.ReadLine().ToCharArray();
var result = text[0] == text[1] && text[0] == text[2];
_outputWriter.WriteLine(result ? "Yes" : "No");
}
}
internal class Program {
static void Main(string[] args) {
var reader = new ConsoleInputReader();
var writer = new ConsoleOutputWriter();
new Solver(reader, writer).Solve();
}
}
public interface IInputReader {
string ReadLine();
}
public interface IOutputWriter {
void WriteLine(string output);
}
internal class ConsoleInputReader : IInputReader {
public string ReadLine() => Console.ReadLine();
}
internal class ConsoleOutputWriter : IOutputWriter {
public void WriteLine(string output) => Console.WriteLine(output);
}
public static class StringExtensions {
public static char ToChar(this string text) => text[0];
public static int ToInt(this string text) => int.Parse(text);
public static int[] ToIntArray(this string text) =>
text.Split(' ').Select(txt => txt.ToInt()).ToArray();
public static long ToLong(this string text) => long.Parse(text);
public static long[] ToLongArray(this string text) =>
text.Split(' ').Select(txt => txt.ToLong()).ToArray();
}
public struct ModLong : IEquatable<ModLong> {
private const long Mod = 1000000007;
private readonly long _value;
public ModLong(long value) { _value = (value % Mod + Mod) % Mod; }
public bool Equals(ModLong other) { return _value == other._value; }
public override bool Equals(object obj) {
return obj is ModLong other && Equals(other);
}
public override int GetHashCode() { return _value.GetHashCode(); }
public static bool operator ==(ModLong left, ModLong right) {
return left.Equals(right);
}
public static bool operator !=(ModLong left, ModLong right) {
return !left.Equals(right);
}
public static ModLong operator +(ModLong left, ModLong right) {
return (ModLong)(left._value + right._value);
}
public static ModLong operator -(ModLong left, ModLong right) {
return (ModLong)(left._value - right._value);
}
public static ModLong operator *(ModLong left, ModLong right) {
return (ModLong)(left._value * right._value);
}
public static ModLong operator /(ModLong left, ModLong right) {
return (ModLong)(left._value * Util.ModInv(right._value, Mod));
}
public static explicit operator long(ModLong num) { return num._value; }
public static explicit operator ModLong(long num) { return new ModLong(num); }
public override string ToString() => _value.ToString();
}
public class Util {
/// <summary>
/// a^n mod を計算する
/// </summary>
/// <param name="a"></param>
/// <param name="n"></param>
/// <param name="mod"></param>
/// <returns></returns>
public static long ModPow(long a, long n, long mod) {
long res = 1;
while (n > 0) {
if ((n & 1) == 1) {
res = res * a % mod;
}
a = a * a % mod;
n >>= 1;
}
return res;
}
/// <summary>
/// a^{-1} mod を計算する
/// </summary>
/// <param name="a"></param>
/// <param name="mod"></param>
/// <returns></returns>
public static long ModInv(long a, long mod) {
return ModPow(a, mod - 2, mod);
}
/// <summary>
/// 階乗
/// </summary>
/// <param name="n"></param>
/// <returns></returns>
/// <exception cref="ArgumentOutOfRangeException"></exception>
public static long Factional(long n) {
if (n < 0)
throw new ArgumentOutOfRangeException(nameof(n));
if (n == 0)
return 1;
var result = 1;
for (var i = 1; i <= n; i++) {
result = checked(result * i);
}
return result;
}
/// <summary>
/// 組み合わせ
/// </summary>
/// <param name="m"></param>
/// <param name="n"></param>
/// <returns></returns>
/// <exception cref="ArgumentOutOfRangeException"></exception>
public static long Combination(long m, long n) {
if (m <= 0)
throw new ArgumentOutOfRangeException(nameof(m));
if (n < 0)
throw new ArgumentOutOfRangeException(nameof(n));
if (m < n)
throw new ArgumentOutOfRangeException(nameof(n));
return Factional(m) / (Factional(n) * Factional(m - n));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AtCoder {
public class Solver {
private readonly IInputReader _inputReader;
private readonly IOutputWriter _outputWriter;
public Solver(IInputReader inputReader, IOutputWriter outputWriter) {
_inputReader = inputReader;
_outputWriter = outputWriter;
}
public void Solve() {
var text = _inputReader.ReadLine().ToCharArray();
var result = text[0] == text[1] && text[0] == text[2];
_outputWriter.WriteLine(result ? "No" : "Yes");
}
}
internal class Program {
static void Main(string[] args) {
var reader = new ConsoleInputReader();
var writer = new ConsoleOutputWriter();
new Solver(reader, writer).Solve();
}
}
public interface IInputReader {
string ReadLine();
}
public interface IOutputWriter {
void WriteLine(string output);
}
internal class ConsoleInputReader : IInputReader {
public string ReadLine() => Console.ReadLine();
}
internal class ConsoleOutputWriter : IOutputWriter {
public void WriteLine(string output) => Console.WriteLine(output);
}
public static class StringExtensions {
public static char ToChar(this string text) => text[0];
public static int ToInt(this string text) => int.Parse(text);
public static int[] ToIntArray(this string text) =>
text.Split(' ').Select(txt => txt.ToInt()).ToArray();
public static long ToLong(this string text) => long.Parse(text);
public static long[] ToLongArray(this string text) =>
text.Split(' ').Select(txt => txt.ToLong()).ToArray();
}
public struct ModLong : IEquatable<ModLong> {
private const long Mod = 1000000007;
private readonly long _value;
public ModLong(long value) { _value = (value % Mod + Mod) % Mod; }
public bool Equals(ModLong other) { return _value == other._value; }
public override bool Equals(object obj) {
return obj is ModLong other && Equals(other);
}
public override int GetHashCode() { return _value.GetHashCode(); }
public static bool operator ==(ModLong left, ModLong right) {
return left.Equals(right);
}
public static bool operator !=(ModLong left, ModLong right) {
return !left.Equals(right);
}
public static ModLong operator +(ModLong left, ModLong right) {
return (ModLong)(left._value + right._value);
}
public static ModLong operator -(ModLong left, ModLong right) {
return (ModLong)(left._value - right._value);
}
public static ModLong operator *(ModLong left, ModLong right) {
return (ModLong)(left._value * right._value);
}
public static ModLong operator /(ModLong left, ModLong right) {
return (ModLong)(left._value * Util.ModInv(right._value, Mod));
}
public static explicit operator long(ModLong num) { return num._value; }
public static explicit operator ModLong(long num) { return new ModLong(num); }
public override string ToString() => _value.ToString();
}
public class Util {
/// <summary>
/// a^n mod を計算する
/// </summary>
/// <param name="a"></param>
/// <param name="n"></param>
/// <param name="mod"></param>
/// <returns></returns>
public static long ModPow(long a, long n, long mod) {
long res = 1;
while (n > 0) {
if ((n & 1) == 1) {
res = res * a % mod;
}
a = a * a % mod;
n >>= 1;
}
return res;
}
/// <summary>
/// a^{-1} mod を計算する
/// </summary>
/// <param name="a"></param>
/// <param name="mod"></param>
/// <returns></returns>
public static long ModInv(long a, long mod) {
return ModPow(a, mod - 2, mod);
}
/// <summary>
/// 階乗
/// </summary>
/// <param name="n"></param>
/// <returns></returns>
/// <exception cref="ArgumentOutOfRangeException"></exception>
public static long Factional(long n) {
if (n < 0)
throw new ArgumentOutOfRangeException(nameof(n));
if (n == 0)
return 1;
var result = 1;
for (var i = 1; i <= n; i++) {
result = checked(result * i);
}
return result;
}
/// <summary>
/// 組み合わせ
/// </summary>
/// <param name="m"></param>
/// <param name="n"></param>
/// <returns></returns>
/// <exception cref="ArgumentOutOfRangeException"></exception>
public static long Combination(long m, long n) {
if (m <= 0)
throw new ArgumentOutOfRangeException(nameof(m));
if (n < 0)
throw new ArgumentOutOfRangeException(nameof(n));
if (m < n)
throw new ArgumentOutOfRangeException(nameof(n));
return Factional(m) / (Factional(n) * Factional(m - n));
}
}
}
|
[["-", 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
| 919
| 4
|
using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder {
public class Program {
static void Main(string[] args) {
var S = Console.ReadLine();
if (S.Count(x => x.ToString() == S.Substring(0, 1)) == S.Count()) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
Console.ReadLine();
}
}
}
public static class Extentions {
public static int ToInt(this object obj) { return int.Parse(obj.ToString()); }
public static decimal ToDecimal(this object obj) {
return decimal.Parse(obj.ToString());
}
public static double ToDouble(this object obj) {
return double.Parse(obj.ToString());
}
}
|
using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder {
public class Program {
static void Main(string[] args) {
var S = Console.ReadLine();
if (S.Count(x => x.ToString() == S.Substring(0, 1)) == S.Count()) {
Console.WriteLine("No");
} else {
Console.WriteLine("Yes");
}
Console.ReadLine();
}
}
}
public static class Extentions {
public static int ToInt(this object obj) { return int.Parse(obj.ToString()); }
public static decimal ToDecimal(this object obj) {
return decimal.Parse(obj.ToString());
}
public static double ToDouble(this object obj) {
return double.Parse(obj.ToString());
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 195
| 4
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace AtCoder.Contests.ABC159 {
/// <summary>
///
/// </summary>
static class B {
static void Main(string[] args) {
var s = Next();
if (!IsPalindrome(s)) {
Console.WriteLine("No");
return;
}
if (!IsPalindrome(s.Substring(0, s.Length / 2))) {
Console.WriteLine("No");
return;
}
Console.WriteLine("Yes");
}
static bool IsPalindrome(string s) {
var l = s.Length;
if (l == 1) {
return true;
}
for (int i = 0; i < s.Length / 2; i++) {
if (s[0] != s[s.Length - 1 - i]) {
return false;
}
}
return true;
}
#region Console
static int _index = 0;
static string[] _buffer;
static string Next() {
if (_buffer == null || _index >= _buffer.Length) {
_buffer = Console.ReadLine().Split();
_index = 0;
}
return _buffer[_index++];
}
static int NextInt() { return int.Parse(Next()); }
static long NextLong() { return long.Parse(Next()); }
static int ReadInt() { return int.Parse(Console.ReadLine()); }
static long ReadLong() { return long.Parse(Console.ReadLine()); }
static int[] ReadIntArray() {
return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
}
static int[] ReadIntArray(int n) {
var a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = ReadInt();
}
return a;
}
static long[] ReadLongArray() {
return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
}
static long[] ReadLongArray(int n) {
var a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = ReadLong();
}
return a;
}
static List<T> ReadObjects<T>(int n, Func<int[], T> creator) {
var l = new List<T>(n);
for (int i = 0; i < n; i++) {
var a = ReadIntArray();
l.Add(creator(a));
}
return l;
}
static int[,] ReadMatrix(int n, int m) {
var r = new int[n, m];
for (int i = 0; i < n; i++) {
var a = ReadIntArray();
for (int j = 0; j < m; j++) {
r[i, j] = a[j];
}
}
return r;
}
#endregion
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace AtCoder.Contests.ABC159 {
/// <summary>
///
/// </summary>
static class B {
static void Main(string[] args) {
var s = Next();
if (!IsPalindrome(s)) {
Console.WriteLine("No");
return;
}
if (!IsPalindrome(s.Substring(0, s.Length / 2))) {
Console.WriteLine("No");
return;
}
Console.WriteLine("Yes");
}
static bool IsPalindrome(string s) {
var l = s.Length;
if (l == 1) {
return true;
}
for (int i = 0; i < s.Length / 2; i++) {
if (s[i] != s[s.Length - 1 - i]) {
return false;
}
}
return true;
}
#region Console
static int _index = 0;
static string[] _buffer;
static string Next() {
if (_buffer == null || _index >= _buffer.Length) {
_buffer = Console.ReadLine().Split();
_index = 0;
}
return _buffer[_index++];
}
static int NextInt() { return int.Parse(Next()); }
static long NextLong() { return long.Parse(Next()); }
static int ReadInt() { return int.Parse(Console.ReadLine()); }
static long ReadLong() { return long.Parse(Console.ReadLine()); }
static int[] ReadIntArray() {
return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
}
static int[] ReadIntArray(int n) {
var a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = ReadInt();
}
return a;
}
static long[] ReadLongArray() {
return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
}
static long[] ReadLongArray(int n) {
var a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = ReadLong();
}
return a;
}
static List<T> ReadObjects<T>(int n, Func<int[], T> creator) {
var l = new List<T>(n);
for (int i = 0; i < n; i++) {
var a = ReadIntArray();
l.Add(creator(a));
}
return l;
}
static int[,] ReadMatrix(int n, int m) {
var r = new int[n, m];
for (int i = 0; i < n; i++) {
var a = ReadIntArray();
for (int j = 0; j < m; j++) {
r[i, j] = a[j];
}
}
return r;
}
#endregion
}
}
|
[["-", 15, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 15, 16, 31, 204, 206, 207, 0, 28, 0, 22]]
| 8
| 634
| 2
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
string inputs = "akasaka"; // Console.ReadLine();
int len = inputs.Length;
if (Calc(inputs.Substring(0, (len - 1) / 2)) == false) {
Console.WriteLine("No");
return;
}
if (Calc(inputs.Substring((len + 2) / 2)) == false) {
Console.WriteLine("No");
return;
}
if (Calc(inputs) == false) {
Console.WriteLine("No");
return;
}
Console.WriteLine("Yes");
}
private static bool Calc(string word) {
string revWord = word;
revWord = new string(revWord.Reverse().ToArray());
if (word == revWord)
return true;
else
return false;
}
}
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
string inputs = Console.ReadLine();
int len = inputs.Length;
if (Calc(inputs.Substring(0, (len - 1) / 2)) == false) {
Console.WriteLine("No");
return;
}
if (Calc(inputs.Substring((len + 2) / 2)) == false) {
Console.WriteLine("No");
return;
}
if (Calc(inputs) == false) {
Console.WriteLine("No");
return;
}
Console.WriteLine("Yes");
}
private static bool Calc(string word) {
string revWord = word;
revWord = new string(revWord.Reverse().ToArray());
if (word == revWord)
return true;
else
return false;
}
}
|
[["-", 0, 198, 0, 200, 0, 212, 0, 5, 0, 62], ["-", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 22], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 0, 131], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 141, 22], ["+", 0, 200, 0, 212, 0, 213, 3, 4, 0, 24], ["+", 0, 200, 0, 212, 0, 213, 3, 4, 0, 25]]
| 8
| 181
| 8
|
using System;
using System.Collections.Generic;
namespace ConsoleApp1 {
class Program {
public static void Main() {
string S = Console.ReadLine();
int N = S.Length;
string[] s = new string[N];
string ans = "Yes";
for (int i = 0; i < N; i++) {
s[i] = S.Substring(i, 1);
}
for (int i = 0; i < N / 2; i++) {
if (s[i] != s[N - 1 - i]) {
ans = "No";
i = 100;
}
}
if (ans == "Yes") {
for (int i = 0; i < N / 4; i++) {
if (s[i] != s[(N - 1) / 2 - 1]) {
ans = "No";
i = 100;
}
}
}
Console.WriteLine(ans);
}
}
}
|
using System;
using System.Collections.Generic;
namespace ConsoleApp1 {
class Program {
public static void Main() {
string S = Console.ReadLine();
int N = S.Length;
string[] s = new string[N];
string ans = "Yes";
//文字列
for (int i = 0; i < N; i++) {
s[i] = S.Substring(i, 1);
}
//回文かどうかの判断
for (int i = 0; i < N / 2; i++) {
if (s[i] != s[N - 1 - i]) {
ans = "No";
i = 100;
}
}
//特定が回文かどうかの判定
if (ans == "Yes") {
for (int i = 0; i < N / 4; i++) {
if (s[i] != s[(N - 1) / 2 - 1 - i]) {
ans = "No";
i = 100;
}
}
}
Console.WriteLine(ans);
}
}
}
|
[["+", 12, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 12, 204, 206, 207, 0, 28, 0, 16, 12, 22]]
| 8
| 203
| 2
|
using System;
namespace ABC159b {
class Program {
static void Main(string[] args) {
var s = Console.ReadLine();
int n = s.Length;
string s1 = s.Substring(0, ((n - 1) / 2));
int n1 = s1.Length;
for (int i = 0; i < s1.Length / 2; i++) {
if (s1[i] != s1[n1 - 1 - i]) {
Console.WriteLine("No");
return;
}
}
string s2 = s.Substring(((n + 3) / 2) - 1, (n - 1) / 2);
int n2 = s2.Length;
for (int i = 0; i < s2.Length / 2; i++) {
if (s2[i] != s2[n2 - 1 - i]) {
Console.WriteLine("No");
return;
}
}
for (int i = 0; i < s1.Length / 2; i++) {
if (s1[i] != s2[i]) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
}
}
|
using System;
namespace ABC159b {
class Program {
static void Main(string[] args) {
var s = Console.ReadLine();
int n = s.Length;
string s1 = s.Substring(0, ((n - 1) / 2));
int n1 = s1.Length;
for (int i = 0; i < s1.Length / 2; i++) {
if (s1[i] != s1[n1 - 1 - i]) {
Console.WriteLine("No");
return;
}
}
string s2 = s.Substring(((n + 3) / 2) - 1, (n - 1) / 2);
int n2 = s2.Length;
for (int i = 0; i < s2.Length / 2; i++) {
if (s2[i] != s2[n2 - 1 - i]) {
Console.WriteLine("No");
return;
}
}
for (int i = 0; i <= s1.Length / 2; i++) {
if (s1[i] != s2[i]) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
| 8
| 252
| 2
|
using System;
class Kai {
static void Main() {
var input = Console.ReadLine();
Console.WriteLine(Solution(input));
}
static string Solution(string s) {
var l = (s.Length - 1) / 2;
var s1 = s.Substring(0, l);
var s2 = s.Substring(l + 1, l);
return IsKai(s1) && IsKai(s2) ? "Yes" : "No";
}
static bool IsKai(string s) {
for (var i = 0; i < s.Length / 2; i++) {
if (s[i] != s[s.Length - 1 - i]) {
return false;
}
}
return true;
}
}
|
using System;
class Kai {
static void Main() {
var input = Console.ReadLine();
Console.WriteLine(Solution(input));
}
static string Solution(string s) {
var l = (s.Length - 1) / 2;
var s1 = s.Substring(0, l);
var s2 = s.Substring(l + 1, l);
return IsKai(s) && IsKai(s1) && IsKai(s2) ? "Yes" : "No";
}
static bool IsKai(string s) {
for (var i = 0; i < s.Length / 2; i++) {
if (s[i] != s[s.Length - 1 - i]) {
return false;
}
}
return true;
}
}
|
[["+", 31, 16, 31, 213, 3, 4, 0, 28, 0, 22], ["+", 15, 16, 31, 16, 31, 213, 3, 4, 0, 25], ["+", 0, 37, 0, 41, 15, 16, 31, 16, 17, 98], ["+", 0, 41, 15, 16, 31, 16, 12, 213, 63, 22], ["+", 15, 16, 31, 16, 12, 213, 3, 4, 0, 24]]
| 8
| 155
| 5
|
using System;
class Program {
static void Main(string[] args) {
string input = Console.ReadLine();
char[] c = input.ToCharArray();
int len = c.Length;
if (len == 3) {
if (c[0] == c[2])
Console.WriteLine("Yes");
else
Console.WriteLine("No");
return;
}
for (int i = 0; i < (len - 1) / 4; i++) {
if (c[i] != c[len - 1 - i] || c[i] != c[(len - 1) / 2 - i - 1] ||
c[i] != c[(len + 3) / 2 + i - 1]) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
}
|
using System;
class Program {
static void Main(string[] args) {
string input = Console.ReadLine();
char[] c = input.ToCharArray();
int len = c.Length;
if (len == 3) {
if (c[0] == c[2])
Console.WriteLine("Yes");
else
Console.WriteLine("No");
return;
}
for (int i = 0; i < (double)(len - 1) / 4; i++) {
if (c[i] != c[len - 1 - i] || c[i] != c[(len - 1) / 2 - i - 1] ||
c[i] != c[(len + 3) / 2 + i - 1]) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
}
|
[["+", 0, 7, 15, 16, 12, 16, 31, 74, 39, 199], ["+", 0, 7, 15, 16, 12, 16, 31, 74, 0, 25], ["+", 15, 16, 12, 16, 31, 74, 51, 23, 0, 24]]
| 8
| 186
| 3
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder_solve {
class Program {
public const ulong mod = 1000000007;
static void Main(string[] args)
{
var s = Console.ReadLine();
var key = true;
var ans = "";
for (int i = 0; i < s.Length / 2; i++) {
if (s[i] != s[s.Length - 1 - i]) {
key = false;
}
}
for (int i = 0; i < (s.Length - 1) / 4; i++) {
if (s[i] != s[(s.Length - 1) / 2 - 1]) {
key = false;
}
}
for (int i = (s.Length + 1) / 2; i < s.Length; i++) {
if (s[i] != s[s.Length - 1 - i]) {
key = false;
}
}
if (key)
ans = "Yes";
else
ans = "No";
Console.WriteLine(ans);
}
static public long Input() { return long.Parse(Console.ReadLine()); }
static public string[] Input2() { return Console.ReadLine().Split(); }
static public ulong[] Input3() {
string[] data = Console.ReadLine().Split();
ulong[] res = new ulong[data.LongLength];
for (long i = 0; i < data.LongLength; i++) {
res[i] = ulong.Parse(data[i]);
}
return res;
}
public static long Choose(long n, long a) {
long x = 1;
long y = 1;
for (long i = 0; i < a; i++) {
x *= n - i;
y *= i + 1;
}
return x / y;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder_solve {
class Program {
public const ulong mod = 1000000007;
static void Main(string[] args)
{
var s = Console.ReadLine();
var key = true;
var ans = "";
for (int i = 0; i < s.Length / 2; i++) {
if (s[i] != s[s.Length - 1 - i]) {
// Console.WriteLine("n1 " + i);
key = false;
}
}
for (int i = 0; i < (s.Length - 1) / 4; i++) {
if (s[i] != s[(s.Length - 1) / 2 - 1 - i]) {
// Console.WriteLine("n2 " + i);
key = false;
}
}
for (int i = (s.Length + 1) / 2; i < s.Length; i++) {
if (s[i] != s[s.Length - 1 - i]) {
// Console.WriteLine("n3 " + i);
key = false;
}
}
if (key)
ans = "Yes";
else
ans = "No";
Console.WriteLine(ans);
}
static public long Input() { return long.Parse(Console.ReadLine()); }
static public string[] Input2() { return Console.ReadLine().Split(); }
static public ulong[] Input3() {
string[] data = Console.ReadLine().Split();
ulong[] res = new ulong[data.LongLength];
for (long i = 0; i < data.LongLength; i++) {
res[i] = ulong.Parse(data[i]);
}
return res;
}
public static long Choose(long n, long a) {
long x = 1;
long y = 1;
for (long i = 0; i < a; i++) {
x *= n - i;
y *= i + 1;
}
return x / y;
}
}
}
|
[["+", 12, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 12, 204, 206, 207, 0, 28, 0, 16, 12, 22]]
| 8
| 414
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
using E = System.Linq.Enumerable;
public class Program {
public static void Main() {
var s = Console.ReadLine().Trim();
var m = s.Length / 2;
for (int i = m; i < s.Length; ++i) {
int j = m - (i - m);
if (s[i] != s[j]) {
Console.WriteLine("No");
return;
}
}
for (int i = 0; i < m / 2; ++i) {
int j = m + m / 2;
if (s[i] != s[j]) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using E = System.Linq.Enumerable;
public class Program {
public static void Main() {
var s = Console.ReadLine().Trim();
var m = s.Length / 2;
for (int i = m; i < s.Length; ++i) {
int j = m - (i - m);
if (s[i] != s[j]) {
Console.WriteLine("No");
return;
}
}
for (int i = 0; i < m / 2; ++i) {
int j = i + m + 1;
if (s[i] != s[j]) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
}
|
[["-", 0, 198, 0, 200, 0, 212, 0, 16, 31, 22], ["+", 0, 200, 0, 212, 0, 16, 31, 16, 31, 22], ["-", 0, 200, 0, 212, 0, 16, 12, 16, 17, 85], ["-", 0, 200, 0, 212, 0, 16, 12, 16, 12, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 72], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203]]
| 8
| 174
| 6
|
using System;
class ProgramB {
static void Main(string[] args) {
//入力
string s = Console.ReadLine();
int len = s.Length;
for (int i = 0; i < (len - 1) / 2; i++) {
if (s[i] != s[(len - 1) - i]) {
Console.WriteLine("No");
return;
}
if (s[i] != s[(len - 1) / 2 - i]) {
Console.WriteLine("No");
return;
}
if (s[(len + 3) / 2 + i] != s[len - 1 - i]) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
}
|
using System;
class ProgramB {
static void Main(string[] args) {
//入力
string s = Console.ReadLine();
int len = s.Length;
for (int i = 0; i < (len - 1) / 2; i++) {
if (s[i] != s[len - 1 - i]) {
Console.WriteLine("No");
return;
}
if (s[i] != s[(len - 1) / 2 - 1 - i]) {
Console.WriteLine("No");
return;
}
if (s[(len + 3) / 2 - 1 + i] != s[len - 1 - i]) {
Console.WriteLine("No");
return;
}
}
Console.WriteLine("Yes");
}
}
|
[["-", 206, 207, 0, 28, 0, 16, 31, 23, 0, 24], ["-", 206, 207, 0, 28, 0, 16, 31, 23, 0, 25], ["+", 206, 207, 0, 28, 0, 16, 31, 16, 17, 33], ["+", 206, 207, 0, 28, 0, 16, 31, 16, 12, 203]]
| 8
| 167
| 6
|
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
string str = Console.ReadLine();
bool flag = true;
int N = str.Length;
for (var i = 0; i < N; i++) {
if (str.Substring(i, 1) != str.Substring(N - 1 - i, 1)) {
flag = false;
}
}
for (var i = 0; i < (N - 1) / 2; i++) {
if (str.Substring(i, 1) != str.Substring((N - 1) / 2 - 1 - i, 1)) {
flag = false;
}
}
for (var i = (N - 3) / 2 - 1; i < N; i++) {
if (str.Substring(i, 1) != str.Substring(N - 1 - i, 1)) {
flag = false;
}
}
if (flag) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
}
|
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
string str = Console.ReadLine();
bool flag = true;
int N = str.Length;
for (var i = 0; i < N; i++) {
if (str.Substring(i, 1) != str.Substring(N - 1 - i, 1)) {
flag = false;
}
}
for (var i = 0; i < (N - 1) / 2; i++) {
if (str.Substring(i, 1) != str.Substring((N - 1) / 2 - 1 - i, 1)) {
flag = false;
}
}
for (var i = (N + 3) / 2 - 1; i < N; i++) {
if (str.Substring(i, 1) != str.Substring(N - 1 - i, 1)) {
flag = false;
}
}
if (flag) {
Console.WriteLine("Yes");
} else {
Console.WriteLine("No");
}
}
}
|
[["-", 0, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 17, 72]]
| 8
| 231
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
namespace atcoder {
class Program {
static void Main(string[] args) {
var n = int.Parse(Console.ReadLine());
Console.WriteLine(Math.Pow(n / 3, 3));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
namespace atcoder {
class Program {
static void Main(string[] args) {
var n = double.Parse(Console.ReadLine());
Console.WriteLine(Math.Pow(n / 3, 3));
}
}
}
|
[["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
| 8
| 69
| 2
|
using System;
class C {
static void Main() {
double l = int.Parse(Console.ReadLine()) / 3;
Console.WriteLine(Math.Pow(l, 3));
}
}
|
using System;
class C {
static void Main() {
double l = int.Parse(Console.ReadLine()) / 3.0;
Console.WriteLine(Math.Pow(l, 3));
}
}
|
[["-", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 250]]
| 8
| 44
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;
namespace AtcoderC {
class Program {
/*static void Main(string[] args)
{
}*/
// ABC132C
//全探索法
/*static void Main()
{
BigInteger N = int.Parse(Console.ReadLine());
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int min = input.Min();
int max = input.Max();
int countARC = 0;
int countABC = 0;
int Answer = 0;
for (int i = min; i <= max; i++)
{
countABC = 0;
countARC = 0;
foreach (int n in input)
{
if (n > i)
{
countARC++;
}
else
{
countABC++;
}
}
if (countABC == countARC)
{
Answer++;
}
}
Console.WriteLine(Answer);
}*/
// 2回目
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
Array.Sort(input);
int min = input[(N / 2) - 1];
int max = input[N / 2];
Console.WriteLine(max - min);
}*/
// ABC131C
//ユーグリッドの互除法の応用
/*static void Main()
{
BigInteger[] input =
Console.ReadLine().Split().Select(BigInteger.Parse).ToArray(); BigInteger A =
input[0]; BigInteger B = input[1]; BigInteger C = input[2]; BigInteger D =
input[3]; BigInteger ans = (B / C) + (B / D);
//最小公倍数
var ans2 = C * D / lcm(C, D);
BigInteger ans3 = B / ans2;
var BB = B - ans + ans3;
ans = (A - 1) / C + (A - 1) / D;
ans3 = (A - 1) / ans2;
var AA = (A - 1) - ans + ans3;
Console.WriteLine(BB - AA);
}
static public BigInteger lcm(BigInteger a, BigInteger b)
{
var r = a % b;
while (r != 0)
{
a = b;
b = r;
r = a % b;
}
return b;
}*/
// 129C
//動的計画法
// TLEになる時間がかかり過ぎる
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
List<int> ttt = new List<int>();
for (int i = 0;i < M;i++)
{
var temp = int.Parse(Console.ReadLine());
ttt.Add(temp);
}
int[] dparray = new int[N+2];
dparray[N] = 1;
dparray[N - 1] = 1;
for (int i = N-1; i >= 0; i--)
{
if (ttt.Contains(i))
{
dparray[i] = 0;
}
dparray[i] = (dparray[i + 1] + dparray[i + 2]) % 1000000007;
}
Console.WriteLine(dparray[0]);
}*/
// ABC128
/*static void Main()
{
}*/
// ABC134A
/*static void Main()
{
int r = int.Parse(Console.ReadLine());
var ans = 3 * r * r;
Console.WriteLine(ans);
}*/
// ABC134B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int D = input[1];
int count = 0;
int ans = N;
while (true)
{
ans = ans - (D * 2 + 1);
count++;
if (ans <= 0)
{
break;
}
}
Console.WriteLine(count);
}*/
// ABC134C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<int> array = new List<int>();
for (int i =0;i<N; i++)
{
array.Add(int.Parse(Console.ReadLine()));
}
List<int> ans = new List<int>();
int max = array.Max();
var temp = new List<int>();
foreach (int n in array)
{
temp.Add(n);
}
temp.Sort();
temp.Reverse();
int second = temp[1];
foreach (int nn in array)
{
if (nn == max)
{
Console.WriteLine(second);
}
else
{
Console.WriteLine(max);
}
}
}*/
// 134ABCD
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int count = 0;
int ans = 0;
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
for (int i = 0;i<N;i++)
{
for (int j =0;j<N; j++)
{
if ((j+1)%(i+1)==0)
{
count += input[j];
}
}
if (count % 2 == input[i])
{
ans++;
}
count = 0;
}
if (ans != 0)
{
}
}*/
// AGC036
/*static void Main()
{
long S = long.Parse(Console.ReadLine());
long X1 = 1000000000;
long Y1 = 0;
/*while (true)
{
Y1 = S / X1 + S % X1;
}
Y1 = S / X1 + S % X1;
Console.WriteLine("0 0 " + X1 + " 0 0 " + Y1);
/*int tempX = 0;
List<long> ss = new List<long>();
while (tempX < S)
{
var ans = S % tempX;
if (ans == 0)
{
ss.Add(ans);
}
tempX++;
}
Console.WriteLine(tempX);*/
/*long X1 = 0;
long Y1 = 1;
while (true)
{
X1 = S % Y1;
if (X1 <= 1000000000)
{
break;
}
Y1++;
}
Console.WriteLine("0 0 "+X1+" 0 0 "+Y1);
}*/
// ABC82A
/*static void Main()
{
double[] input =
Console.ReadLine().Split().Select(double.Parse).ToArray(); double a =
input[0]; double b = input[1]; double sum = (a + b) / 2;
Console.WriteLine(Math.Ceiling(sum));
}*/
// ABC128C
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
int ans = 0;
List<int[]> K = new List<int[]>();
for (int i = 0;i<M;i++)
{
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
K.Add(temp);
}
int[] P = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] light = new int[M];
for (int i = 0;i < Math.Pow(2,N);i++)
{
var isrow = 0;
var temp = int.Parse(Convert.ToString(i, 2)).ToString("0000000000");
for (int j =0;j < M;j++)
{
var ison = 0;
for (int k = 0; k < K[j][0];k++)
{
var index = K[j][k] - 1;
if (temp[9-index] == '1')
{
ison++;
}
}
if (ison % 2 == P[j])
{
isrow++;
}
else
{
break;
}
}
if (isrow == M)
{
ans++;
}
}
Console.WriteLine(ans);*/
/*nt[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int a = input[0];
int b = input[1];
var temp = a * b % 2;
if (temp == 0)
{
Console.WriteLine("even");
}
else
{
Console.WriteLine("odd");
}
}*/
// ABC127C
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
List<int[]> gate = new List<int[]>();
for (int i = 0; i < M; i++)
{
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
gate.Add(temp);
}
if (M == 1)
{
Console.WriteLine(N);
}
else
{
List<int> card = new List<int>();
for (int i = gate[0][0]; i <= gate[0][1]; i++)
{
card.Add(i);
}
for (int j = 1; j < gate.Count; j++)
{
List<int> ans = new List<int>();
var count = 0;
for (int i = gate[j][0]; i <= gate[j][1]; i++)
{
if (card.Contains(i))
{
count++;
ans.Add(i);
}
}
if (count == 0)
{
break;
}
card = new List<int>(ans);
}
Console.WriteLine(card.Count());
}
}*/
// 127C Revenge TLE
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
List<int[]> gate = new List<int[]>();
for (int i = 0; i < M; i++)
{
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
gate.Add(temp);
}
int Ans = 0;
for (int i =1;i<=N;i++)
{
var count = 0;
for (int j = 0;j < gate.Count;j++)
{
if (gate[j][0] <= i && i <= gate[j][1])
{
count++;
}
}
if (count == gate.Count)
{
Ans++;
}
}
Console.WriteLine(Ans);
}*/
// 127C RevengeVer2
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
List<int[]> gate = new List<int[]>();
for (int i = 0; i < M; i++)
{
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
gate.Add(temp);
}
List<int> Max = new List<int>();
List<int> Min = new List<int>();
for (int i =0;i< M;i++)
{
Max.Add(gate[i][1]);
Min.Add(gate[i][0]);
}
int max = Max.Min();
int min = Min.Max();
if (min <= max)
{
Console.WriteLine(max - min + 1);
}
else
{
Console.WriteLine("0");
}
}*/
// ABC126C
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
double ans = 0.0;
for (int i = 1; i<= N;i++)
{
double tempP = (double)1 / N;
int point = i;
while (point<M)
{
tempP = tempP * 1 / 2;
point *= 2;
}
ans += tempP;
}
Console.WriteLine(ans);
}*/
// ABC125C ユーグリッド互除法
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
Array.Sort(A);
int lcmr, lcml = 0;
List<int> answer = new List<int>();
for (int i =0;i<A.Length;i++)
{
lcmr = 0;
for (int x = 0;x < i;x++)
{
if (lcmr - A[x] >= 0)
{
lcmr = lcm(lcmr, A[x]);
}
else
{
lcmr = lcm(A[x], lcmr);
}
}
lcml = 0;
for (int y = i+1; y < A.Length; y++)
{
if (lcml - A[y] >= 0)
{
lcml = lcm(lcml, A[y]);
}
else
{
lcml = lcm(A[y],lcml);
}
}
var tempans = 0;
if (lcmr > lcml)
{
tempans = lcm(lcmr, lcml);
}
else
{
tempans = lcm(lcml, lcmr);
}
answer.Add(tempans);
}
Console.WriteLine(answer.Max());
}
static public int lcm(int a, int b)
{
if (b == 0)
{
return a;
}
var r = a % b;
while (r != 0)
{
a = b;
b = r;
r = a % b;
}
return b;
}*/
// 124C
/*static void Main()
{
string inputstr = Console.ReadLine();
int count = 0;
if (inputstr[0] == '0')
{
for (int i = 0; i < inputstr.Length; i++)
{
if (i % 2 == 0)
{
if (inputstr[i] == '1')
{
count++;
}
}
else
{
if (inputstr[i] == '0')
{
count++;
}
}
}
}
else
{
for (int i = 0; i < inputstr.Length; i++)
{
if (i % 2 == 1)
{
if (inputstr[i] == '1')
{
count++;
}
}
else
{
if (inputstr[i] == '0')
{
count++;
}
}
}
}
Console.WriteLine(count);
}*/
// 123C
/*static void Main()
{
double N = double.Parse(Console.ReadLine());
List<double> city = new List<double>();
for (int i = 0; i < 5; i++)
{
city.Add(double.Parse(Console.ReadLine()));
}
var ans = Math.Ceiling(N / city.Min()) + 4;
Console.WriteLine(ans);
}*/
// 82C
/*static void Main()
{
double[] input =
Console.ReadLine().Split().Select(double.Parse).ToArray(); double a =
input[0]; double b = input[1]; double answer = (a + b) / 2;
Console.WriteLine(Math.Ceiling(answer));
}*/
// 128B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int P = input[1];
var ans = (P + A * 3) / 2;
Console.WriteLine(ans);
int a,b
cin << a << b;
cout >> (P + A * 3) / 2 >> endl;
}*/
// 119A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
if (B % A == 0)
{
Console.WriteLine(A + B);
}
else
{
Console.WriteLine(B-A);
}
}*/
// 116A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
int C = input[2];
Console.WriteLine((A*B)/2);
}*/
// ABC31B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = int.Parse(Console.ReadLine());
List<int> array = new List<int>();
for (int i =0;i<N;i++)
{
array.Add(int.Parse(Console.ReadLine()));
}
foreach (int a in array)
{
if (a < input[0])
{
Console.WriteLine(input[0] - a);
}
else if (input[1] < a)
{
Console.WriteLine("-1");
}
else
{
Console.WriteLine("0");
}
}
}*/
// ABC36B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<string> map = new List<string>();
for (int i =0;i< N;i++)
{
map.Add(Console.ReadLine());
}
List<string> ans = new List<string>();
for(int j = 0; j < N;j++)
{
var temp = "";
for (int i = N-1; i >= 0; i--)
{
temp += map[i][j];
}
ans.Add(temp);
}
foreach (string a in ans)
{
Console.WriteLine(a);
}
}*/
// ABC40B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int A = 0;
int temp = N;
if (N == 1)
{
Console.WriteLine("0");
}
else
{
while (true)
{
double root = Math.Sqrt(N);
if (root != (int)root)
{
N--;
}
else
{
A = (int)root;
break;
}
}
List<int> answer = new List<int>();
bool flag = false;
while (A > 0)
{
var a = A;
while (A * a <= temp)
{
var ans = temp - (A * a) + Math.Abs(A - a);
if (ans == 0)
{
flag = true;
break;
}
a++;
answer.Add(ans);
}
if (flag == true)
{
break;
}
A--;
}
if (flag)
{
Console.WriteLine("0");
}
else
{
Console.WriteLine(answer.Min());
}
}
}*/
// ABC122C
// TLE
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
string S = Console.ReadLine();
List<int[]> array = new List<int[]>();
for (int i = 0; i < input[1]; i++)
{
array.Add(Console.ReadLine().Split().Select(int.Parse).ToArray());
}
List<int> answer = new List<int>();
foreach (int[] n in array)
{
var tempstr = S.Substring(n[0]-1,n[1]-n[0]+1);
var count = tempstr.Length - tempstr.Replace("AC","").Length;
var ans = count / 2;
answer.Add(ans);
}
foreach (int a in answer)
{
Console.WriteLine(a);
}
}*/
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
string S = Console.ReadLine();
List<int[]> array = new List<int[]>();
for (int i = 0; i < input[1]; i++)
{
array.Add(Console.ReadLine().Split().Select(int.Parse).ToArray());
}
for (int i = 0;i < S.Length-1;i++)
{
if (S[i] == 'A')
{
if (S[i + 1] == 'C')
{
S = S.Replace(S[i],'a');
}
}
}
int count = 0;
List<int> ansstr = new List<int>();
for (int i = 0; i < S.Length;i++)
{
count = 0;
for (int j = 0;j <= i;j++)
{
if (S[j] == 'a')
{
count++;
}
}
ansstr.Add(count);
}
List<int> anss = new List<int>();
for (int i = 0; i < input[1];i++)
{
anss.Add(ansstr[array[i][1]-2] - ansstr[array[i][0]-1]);
}
foreach (int a in anss)
{
Console.WriteLine(a);
}
}*/
// ABC39B
/*static void Main()
{
int X = int.Parse(Console.ReadLine());
var ans = Math.Sqrt(X);
var ans2 = Math.Sqrt(ans);
Console.WriteLine(ans2);
}*/
// ABC38B
/*static void Main()
{
int[] input1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] input2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
bool flag1 = false;
foreach (int a in input1)
{
foreach (int b in input2)
{
if (a == b)
{
flag1 = true;
}
}
}
if (flag1 == true)
{
Console.WriteLine("YES");
}
else
{
Console.WriteLine("NO");
}
}*/
// ABC35B
/*static void Main()
{
string S = Console.ReadLine();
int T = int.Parse(Console.ReadLine());
int[] pos = { 0, 0 };
foreach (char a in S)
{
}
}*/
// ABC34B
/*static void Main()
{
}*/
//技術ProgramContest4Day1
// A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
}*/
// ABC135A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
var temp = B - A;
if (temp % 2 == 0)
{
Console.WriteLine(A + (temp/2));
}
else
{
Console.WriteLine("IMPOSSIBLE");
}
}*/
// ABC135B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] P = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] AnsN = new int[N];
for (int i = 0;i <N;i++)
{
AnsN[i] = i + 1;
}
int count = 0;
for(int i = 0;i < N;i++)
{
if (P[i] != AnsN[i])
{
count++;
}
}
if (count <= 2)
{
Console.WriteLine("YES");
}
else
{
Console.WriteLine("NO");
}
}*/
// ABC135C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
/*int count = 0;
for (int i = N;i>0;i--)
{
var tempA = A[i] + A[i - 1];
if (tempA <= B[i - 1])
{
A[i - 1] = 0;
count += tempA;
}
else
{
if (A[i] <= B[i - 1])
{
A[i - 1] = tempA - B[i - 1];
count += B[i - 1];
}
else
{
count += B[i - 1];
}
}
}*/
/*int count = 0;
for (int i = 0;i < N;i++)
{
var tempA = A[i] + A[i + 1];
if (tempA <= B[i])
{
A[i + 1] = 0;
count += tempA;
}
else
{
if (B[i] >= A[i])
{
A[i + 1] = A[i + 1] - (B[i] - A[i]);
count += B[i];
}
else
{
count += B[i];
}
}
}
//このやり方
int count = 0;
for (int i = 0; i < N;i++)
{
List<int> temp = new List<int>();
temp.Add(A[i]);
temp.Add(B[i]);
count += temp.Min();
}
Console.WriteLine(count);
}*/
// ABC135D
// ABC127A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
string inputstr = Console.ReadLine();
char[] temp = inputstr.ToCharArray();
temp[input[1]-1] = Char.ToLower(temp[input[1] -1]);
inputstr = new string(temp);
Console.WriteLine(inputstr);
}*/
// ABC35
/*static void Main()
{
string S = Console.ReadLine();
int T = int.Parse(Console.ReadLine());
int[] ans = { 0, 0 };
int count = 0;
for (int i = 0; i < S.Length;i++)
{
if (S[i] == 'U')
{
ans[1]++;
}
else if (S[i] == 'D')
{
ans[1]--;
}
else if (S[i] == 'R')
{
ans[0]++;
}
else if (S[i] == 'L')
{
ans[0]--;
}
else
{
count++;
}
}
List<int[]> answer = new List<int[]>();
answer.Add(ans);
answer.Add(ans);
answer.Add(ans);
answer.Add(ans);
foreach (int[] n in answer)
{
}
}*/
// ABC114A
/*static void Main()
{
int x = int.Parse(Console.ReadLine());
if (x == 7 || x == 5 || x == 3)
{
Console.WriteLine("YES");
}
else
{
Console.WriteLine("NO");
}
}*/
// ABC121C
// TLE
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long n = input[0];
long M = input[1];
List<long[]> shop = new List<long[]>();
for (int i = 0;i < n;i++)
{
shop.Add(Console.ReadLine().Split().Select(long.Parse) .ToArray());
}
List<long[]> answer = new List<long[]>(Sort(shop));
long price = 0;
long count = 0;
foreach (long[] temp in answer)
{
var tempcount = count;
if (count + temp[1] <= M)
{
count += temp[1];
}
else
{
count = M;
}
price += (count-tempcount) * temp[0];
if (M<=count)
{
break;
}
}
Console.WriteLine(price);
}
static List<long[]> Sort(List<long[]> A)
{
for (int i = 0;i < A.Count;i++)
{
for (int j = A.Count-1;j >i;j-- )
{
if (A[j][0] < A[j-1][0])
{
var temp = A[j];
A[j] = A[j - 1];
A[j - 1] = temp;
}
}
}
return A;
}*/
// Sortはライブラリを使った方が早い
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long n = input[0];
long M = input[1];
List<long[]> shops = new List<long[]>();
for (int i = 0; i < n; i++)
{
shops.Add(Console.ReadLine().Split().Select(long.Parse).ToArray());
}
long count = 0;
long ans = 0;
foreach (long[] shop in shops.OrderBy(a => a[0]))
{
var i = Math.Min(M - count, shop[1]);
ans += shop[0] * i;
count += i;
if (count >= M)
{
break;
}
}
Console.WriteLine(ans);
}*/
// 120C
// TLE
/*static void Main()
{
/*string input = Console.ReadLine();
int len = input.Length;
int count = 0;
while (input.Contains("01") || input.Contains("10"))
{
input = input.Replace("01", "").Replace("10", "");
count += len - input.Length;
len = input.Length;
}
Console.WriteLine(count);
string s = Console.ReadLine();
int zero = s.Replace("1", "").Length;
int one = s.Replace("0", "").Length;
Console.WriteLine((zero < one ? zero : one) * 2);
}*/
// 119
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
List<int> goal = new List<int>();
List<int> list = new List<int>();
for (int i =1;i<=N-1;i++)
{
goal.Add(input[i]);
}
for (int i = 0;i<N;i++)
{
list.Add(int.Parse(Console.ReadLine()));
}
}*/
// 118C
// 37B
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long n = input[0];
long k = input[1];
List<long[]> list = new List<long[]>();
for (int i = 0;i < k;i++)
{
long[] temp = Console.ReadLine().Split().Select(long.Parse).ToArray();
list.Add(temp);
}
long[] Ans = new long[n];
foreach (long[] m in list)
{
for (int i =0;i < Ans.Length;i++)
{
if (m[0]-1 <= i && i <= m[1]-1)
{
Ans[i] = m[2];
}
}
}
foreach (int a in Ans)
{
Console.WriteLine(a);
}
}*/
//大手前プロコン2019
// A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
if (A + 0.5f >= B)
{
Console.WriteLine("1");
}
else
{
Console.WriteLine("0");
}
}*/
// E
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long N = input[0];
long Q = input[1];
List<long> D = new List<long>();
for (long i = 0;i < N;i++)
{
D.Add(long.Parse(Console.ReadLine()));
}
List<long[]> TLR = new List<long[]>();
for (long i = 0;i < Q;i++)
{
TLR.Add(Console.ReadLine().Split().Select(long.Parse).ToArray());
}
foreach (long[] tlr in TLR)
{
var count = 0;
var tempara = new List<long>();
var a = tlr[0];
tempara.Add(a);
for (long i = 1;i <= N;i++)
{
if (Math.Abs(a - (-1 * i)) > D[(int)i - 1])
{
a = a - D[(int)i - 1];
}
else
{
a = -1*i;
}
tempara.Add(a);
}
foreach (long n in tempara)
{
if ( tlr[1]<= n && tlr[2] >= n)
{
count++;
}
}
Console.WriteLine(count);
}
}*/
// AtCoderBeginnerContest136
// 136A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
int C = input[2];
var a = A - B;
var ans = C - a;
if (ans >= 0)
{
Console.WriteLine(ans);
}
else
{
Console.WriteLine("0");
}
}*/
// 136B
/*static void Main()
{
string N = Console.ReadLine();
int n = int.Parse(N);
int ocun = 0;
for (int i = 1; i<=n;i++)
{
if (i.ToString().Length % 2 == 1)
{
ocun++;
}
}
Console.WriteLine(ocun);
}*/
// 136C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] list = Console.ReadLine().Split().Select(int.Parse).ToArray();
int count = 0;
int max = 0;
bool flag = false;
foreach (int a in list)
{
if (a >= max)
{
max = a;
}
else if (max - a >= 2)
{
flag = true;
break;
}
else { }
}
if (flag)
{
Console.WriteLine("No");
}
else
{
Console.WriteLine("Yes");
}
}*/
// 113C-ID
/*static void Main()
{
string S = Console.ReadLine();
Console.WriteLine(S.Length);
}*/
// 113A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
Console.WriteLine(A + (B/2));
}*/
// 112A
/*static void Main()
{
}*/
// 137A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
List<int> answer = new List<int>();
var ans1 = A + B;
answer.Add(ans1);
var ans2 = A - B;
answer.Add(ans2);
var ans3 = A * B;
answer.Add(ans3);
Console.WriteLine(answer.Max());
}*/
// 137B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int K = input[0];
int X = input[1];
for (int i = X - (K-1);i<= X + (K-1);i++)
{int
if (i >= -1000000 && i <= 1000000)
{
Console.Write(i+" ");
}
}
Console.WriteLine();
}*/
// 137C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<string[]> list = new List<string[]>();
for (int i = 0; i < N;i++)
{
list.Add(Console.ReadLine().Split());
}
foreach (string[] n in list)
{
Array.Sort(n);
}
long ans = 0;
for (int i = 0; i< list.Count;i++)
{
for (int j = i+1;j < list.Count;j++)
{
if (list[i].Equals(list[j]))
{
ans++;
}
}
}
Console.WriteLine(ans);
}*/
/*static void Main(string[] args)
{
int N = Convert.ToInt32(Console.ReadLine());
string[] S = new string[N];
for (var i = 0; i < N; i++)
{
char[] c = Console.ReadLine().ToCharArray();
Array.Sort(c);
S[i] = new string(c);
}
Dictionary<string, long> dict = new Dictionary<string, long>();
for (var i = 0; i < N; i++)
{
if (dict.ContainsKey(S[i]))
{
dict[S[i]]++;
}
else
{
dict[S[i]] = 1L;
}
}
long res = 0L;
foreach (var i in dict)
{
if (i.Value > 1)
{
res += i.Value * (i.Value - 1) / 2;
}
}
Console.WriteLine(res);
}*/
// 138A
/*static void Main()
{
int a = int.Parse(Console.ReadLine());
string s = Console.ReadLine();
if (a < 3200)
{
Console.WriteLine("red");
}
else
{
Console.WriteLine(s);
}
}*/
// 138B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
double[] A = Console.ReadLine().Split().Select(double.Parse).ToArray();
double ans = 0;
for (int i = 0;i<A.Length;i++)
{
ans += 1 / A[i];
}
Console.WriteLine(1/ans);
}*/
// 138C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
double[] v = Console.ReadLine().Split().Select(double.Parse).ToArray();
double ans = 0;
Array.Sort(v);
ans = (v[0] + v[1]) / 2;
for (int i = 2; i < N;i++)
{
ans = (ans + v[i]) / 2;
}
Console.WriteLine(ans);
}*/
// 138D
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int Q = input[1];
List<Data> datalist = new List<Data>();
List<int[]> listQ = new List<int[]>();
for (int i = 0; i < N-1;i++)
{
Data data = new Data();
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
data.a = temp[0];
data.b = temp[1];
datalist.Add(data);
}
datalist = datalist.OrderBy(n => n.a).OrderBy(m => m.b).ToList();
for (int i = 0;i < Q;i++)
{
listQ.Add(Console.ReadLine().Split().Select(int.Parse).ToArray());
}
int[] Answer = new int[datalist[datalist.Count()].b];
var tempA = 0;
foreach (Data aa in datalist)
{
if (aa.a > tempA)
{
tempA = aa.a;
}
}
foreach (int[] temp in listQ)
{
if (temp[0] < tempA)
{
for (int i = temp[0]; i < Answer.Length; i++)
{
Answer[i] += temp[1];
}
}
else
{
Answer[temp[0]] += Answer[1];
}
}
foreach (int a in Answer)
{
Console.Write(a);
}
Console.WriteLine();
}*/
//最強プログラマ―選手権
// A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int M = input[0];
int D = input[1];
int ans = 0;
for (int i = 1;i <= M;i++)
{
for (int j = 1; j <= D; j++)
{
int d1 = j / 10;
int d2 = j % 10;
if (d1 >= 2 && d2 >= 2)
{
var temp = d1 * d2;
if (temp == i)
{
ans++;
}
}
}
}
Console.WriteLine(ans);
}*/
// B
/*static void Main()
{
var tem = 1000000007;
var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
var N = input[0];
var K = input[1];
var array = Console.ReadLine().Split().Select(long.Parse).ToArray();
var invert = new long[N];
for (int i =0;i<N;i++)
{
for (int j = i+1;j < N;j++)
{
if (array[i] > array[j])
{
invert[i]++;
}
}
}
var less = new long[N];
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
if (array[i] > array[j])
{
less[i]++;
}
}
}
long ans = 0;
for (int i = 0;i < N;i++)
{
ans = (ans + (invert[i] * K) % tem) % tem;
ans = (ans + (less[i] * ((K * (K-1))/ 2 % tem)) % tem) % tem;
//K*(K-1)/2
}
Console.WriteLine(ans %tem);
}*/
// 139A
/*static void Main()
{
string input = Console.ReadLine();
string input2 = Console.ReadLine();
int ans = 0;
for (int i = 0;i < input.Length;i++)
{
if (input[i] == input2[i])
{
ans++;
}
}
Console.WriteLine(ans);
}*/
// 139B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
var ans = 0;
var temp = 1;
while (temp < B)
{
--temp;
temp+= A;
++ans;
}
Console.WriteLine(ans);
}*/
// 139C
/*static void Main()
{
int N =int.Parse(Console.ReadLine());
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
List<long> sa = new List<long>();
for (long i = 0;i < input.Length - 1;i++)
{
if (input[i] >= input[i + 1])
{
sa.Add(1);
}
else
{
sa.Add(0);
}
}
var count = 0;
List<long> Answer = new List<long>();
for(int i = 0; i < sa.Count;i++)
{
if (sa[i] == 1)
{
count++;
}
else {
count = 0;
}
Answer.Add(count);
}
Console.WriteLine(Answer.Max());
}*/
// 140A
/*static void Main()
{
double input = double.Parse(Console.ReadLine());
var ans = Math.Pow(input, 3);
Console.WriteLine(ans);
}*/
// 140B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] C = Console.ReadLine().Split().Select(int.Parse).ToArray();
int Ans = 0;
for (int i = 0;i < B.Length;i++)
{
Ans += B[i];
}
for (int i = 0;i <= A.Length -2;i++ )
{
if (A[i + 1] - A[i] == 1)
{
Ans += C[A[i] - 1];
}
}
Console.WriteLine(Ans);
}*/
// 140C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
long Ans = 0;
Ans += B[0];
Ans += B[B.Length-1];
for (int i = 0; i<B.Length-1;i++)
{
List<int> temp = new List<int>();
temp.Add(B[i]);
temp.Add(B[i + 1]);
Ans += temp.Min();
}
Console.WriteLine(Ans);
}*/
// 141A
/*static void Main()
{
string temp = Console.ReadLine();
switch (temp)
{
case "Sunny":
Console.WriteLine("Cloudy");
break;
case "Cloudy":
Console.WriteLine("Rainy");
break;
case "Rainy":
Console.WriteLine("Sunny");
break;
}
}*/
// 141B
/*static void Main()
{
string S = Console.ReadLine();
bool flag = false;
for (int i = 0; i < S.Length; i++)
{
if (i % 2 == 0)
{
if (S[i] == 'L' || S[i] == 'U' || S[i] == 'D')
{
}
else
{
flag = true;
}
}
else
{
if (S[i] == 'R' || S[i] == 'U' || S[i] == 'D')
{
}
else
{
flag = true;
}
}
}
if (flag == false)
{
Console.WriteLine("No");
}
else
{
Console.WriteLine("Yes");
}
}*/
// 142A
/*static void Main()
{
double N = double.Parse(Console.ReadLine());
double count = 0;
for (int i = 1;i <= N;i++)
{
if (i % 2 == 1)
{
count++;
}
}
double Ans = count / N;
Console.WriteLine(Ans);
}*/
// 142B
/*tatic void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int K = input[1];
int count = 0;
int[] h = Console.ReadLine().Split().Select(int.Parse).ToArray();
foreach (int temp in h)
{
if (temp >= K)
{
count++;
}
}
Console.WriteLine(count);
}*/
// 142C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] temp1 = new int[temp.Length];
for (int i = 1;i <= temp.Length;i++)
{
temp1[i-1] = i;
}
List<int[]> ans = new List<int[]>();
for (int i = 0; i < temp.Length;i++)
{
int[] aa = new int[2];
aa[0] = temp[i];
aa[1] = temp1[i];
ans.Add(aa);
}
int[] Ans = new int[N];
for(int i = 0;i < N;i++){
Ans[i] = 0;
}
for (int i = 0; i < ans.Count; i++)
{
Ans[ans[i][0] - 1] = ans[i][1];
}
for (int i = 0;i < Ans.Length;i++) {
Console.Write(Ans[i] + " ");
}
Console.WriteLine();
}*/
// 142D
/*static void Main()
{
int[] N = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = N[0];
int B = N[1];
List<int> temp = new List<int>();
for (int i = 1; i <= A; i++)
{
if (B % i == 0)
{
temp.Add(i);
}
}
for (int i = 0; i < temp.Count; i++)
{
for (int j = i; j < temp.Count; j++)
{
}
}
}*/
// 141C
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int K = input[1];
int Q = input[2];
List<int> A = new List<int>();
for (int i = 0;i < Q;i++)
{
A.Add(int.Parse(Console.ReadLine()));
}
int[] ans = new int[N];
for (int i = 0;i < N; i++)
{
ans[i] = K;
}
int[] point = new int[N];
for (int i = 0;i < N;i++)
{
point[i] = 0;
}
foreach (int a in A)
{
point[a - 1] += 1;
}
for(int i = 0; i < N;i++ )
{
point[i] = Q - point[i];
}
List<int> Answer = new List<int>();
for (int j = 0; j < N;j++)
{
var temp = ans[j] - point[j];
Answer.Add(temp);
}
foreach (int temp in Answer)
{
if (temp > 0) { Console.WriteLine("Yes"); }
else { Console.WriteLine("No"); }
}
}*/
// 139D
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
long Ans = 0;
for (int i = 1;i <= N-1;i++)
{
Ans += i;
}
Console.WriteLine(Ans);
}*/
// 133C
/*static void Main()
{
int[] M = Console.ReadLine().Split().Select(int.Parse).ToArray();
int r = M[0];
int l = M[1];
var Ans = m(r, l);
Console.WriteLine(Ans);
}
static long m(int r, int l)
{
var ans = long.MaxValue;
for (int i = r; i < l; i++)
{
for (int j = i + 1; j <= l; j++)
{
ans = Math.Min(ans, (i * j) % 2019);
if (ans == 0) { return ans; }
}
}
return ans;
}*/
/*static void Main(string[] args)
{
var lr = Console.ReadLine().Split();
var l = int.Parse(lr[0]);
var r = int.Parse(lr[1]);
var ans = m1(l, r);
Console.WriteLine(ans);
}
static long m1(int l, int r)
{
var ans = long.MaxValue;
for (long i = l; i < r; i++)
{
for (long j = i + 1; j <= r; j++)
{
ans = Math.Min(ans, i * j % 2019);
if (ans == 0) return ans;
}
}
return ans;
}*/
//学生コンテスト
// A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
bool flag = false;
List<int[]> ans1 = new List<int[]>();
for (int i = 0; i < N;i++)
{
int[] tarray = new int[M];
for (int j = 0;j < M;j++)
{
var temp1 = A[i] + B[j];
tarray[j] = temp1;
}
ans1.Add(tarray);
}
List<int> ans = new List<int>();
for (int i = 0; i < N;i ++ )
{
for (int j = 0; j < M;j++)
{
ans.Add(A[i] + B[j]);
}
}
var tempans = 0;
//var aaa = ans.GroupBy(n => n).Where(n => n.Count() > 1).Select(group =>
group.Key).ToArray(); ans.Sort(); for (int i = 0;i < ans.Count -1;i++)
{
if (ans[i] == ans[i+1]) {
tempans = ans[i];
flag = true;
break;
}
}
int a1 = 0;
int a2 = 0;
int b1 = 0;
int b2 = 0;
int count = 0;
bool temp = false;
if (flag == true)
{
for (int i = 0; i < N; i++)
{
if (ans1[i].Contains(tempans))
{
for (int j = 0; j < M; j++)
{
if (tempans == ans1[i][j] && count == 0)
{
a1 = i;
a2 = j;
count++;
break;
}
if (tempans == ans1[i][j] && count == 1)
{
b1 = i;
b2 = j;
temp = true;
break;
}
if (temp == true) { break; }
}
}
}
}
else
{
Console.WriteLine("-1");
}
if(temp == true)
{
Console.WriteLine(a1 + " " + a2 + " " + b1 + " " + b2);
}
}*/
// 108C
//全ての都市に対してMath.Abs(X-x[i])の最大公約数をもとめるプログラムになる.
// SCIE,SCIの研究ジャーナルは信用の大会論文である.
//じぁーなるのお話
//参考の論文を簡単にまとめるプログラム(Mendelay)
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int X = input[1];
long[] XList = Console.ReadLine().Split().Select(long.Parse).ToArray();
List<long> ans = new List<long>();
for (int i = 0;i < N;i++)
{
var temp = Math.Abs(XList[i]-X);
ans.Add(temp);
}
for (int i = 0;i < N;i++)
{
}
Console.WriteLine(ans.Min());
}*/
// 128D
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
int[] sw = Console.ReadLine().Split().Select(int.Parse).ToArray();
List<int[]> sw2 = new List<int[]>();
for (int i = 0;i < M;i++)
{
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
sw2.Add(temp);
}
int[] sw3 = Console.ReadLine().Split().Select(int.Parse).ToArray();
}*/
// 143A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
var ans = A - (2 * B);
if (ans > 0)
{
Console.WriteLine(ans);
}
else
{
Console.WriteLine("0");
}
}*/
// 143B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int Answer = 0;
for (int i = 0;i < N-1;i++)
{
for (int j = i+1; j < N;j++)
{
var temp = input[i] * input[j];
Answer += temp;
}
}
Console.WriteLine(Answer);
}*/
// 143C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
var temp = S[0];
List<string> Ans = new List<string>();
for (int i = 1; i < N;i++)
{
if (temp == S[i])
{
temp = S[i];
}
else
{
Ans.Add(temp.ToString());
temp = S[i];
}
}
Console.WriteLine(Ans.Count() + 1);
}*/
// 143D
/*static void Main()
{
}*/
// 144A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
if (A > 9 || B > 9)
{
Console.WriteLine("-1");
}
else
{
Console.WriteLine(A * B);
}
}*/
// 144B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<int> map = new List<int>();
for (int i = 1;i < 10;i++)
{
for (int j = 1;j < 10;j++)
{
var temp = i * j;
map.Add(temp);
}
}
if (map.Contains(N))
{
Console.WriteLine("Yes");
}
else
{
Console.WriteLine("No");
}
}*/
// DISCO2019A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int X = input[0];
int Y = input[1];
long moneyX = 0;
long moneyY = 0;
int count = 0;
if (X < 4)
{
switch (X)
{
case 1:
moneyX += 300000;
count++;
break;
case 2:
moneyX += 200000;
break;
case 3:
moneyX += 100000;
break;
}
}
if (Y < 4)
{
switch (Y)
{
case 1:
moneyY += 300000;
count++;
break;
case 2:
moneyY += 200000;
break;
case 3:
moneyY += 100000;
break;
}
}
if (count == 2)
{
moneyX += 400000;
}
Console.WriteLine(moneyX + moneyY);
}*/
// DISCO2019B
/*static void Main()
{
long N = long.Parse(Console.ReadLine());
long[] A = Console.ReadLine().Split().Select(long.Parse).ToArray();
long left = 0;
long right = 0;
long sum = 0;
foreach (long a in A)
{
sum += a;
}
List<long> sa = new List<long>();
for (long i = 0;i < N;i++)
{
left += A[i];
right = sum - left;
sa.Add(Math.Abs(left - right));
}
sa.Sort();
Console.WriteLine(sa[0]);
}*/
// DISCO2019C
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
List<string> array = new List<string>();
for (int i = 0;i<input[1];i++)
{
var temp = Console.ReadLine();
array.Add(temp);
}
int[,] mapp = new int[input[0], input[1]];
int count = 1;
for (int i = 0;i < input[0];i++)
{
for (int j = 0;j < input[1];j++)
{
if (array[i][j] == '#')
{
mapp[i,j] += count;
count++;
}
}
}
for (int i = 0; i < input[0]; i++)
{
for (int j = 0; j < input[1]; j++)
{
if (mapp[i,j] == 0)
{
if (j == 0)
{
for (int k =0;k < input[1];k++)
{
if (mapp[i, k] != 0)
{
mapp[i, j] = mapp[i, k];
break;
}
}
}
else
{
mapp[i,j] = mapp[i, j - 1];
}
}
}
}
for (int i = 0;i < input[0];i++)
{
for (int j = 0;j < input[1];j++)
{
if (mapp[i,j] == 0)
{
if (i == input[0] - 1)
{
mapp[i, j] = mapp[i - 1, j];
}
else
{
mapp[i, j] = mapp[i + 1, j];
}
}
}
}
for (int i = 0; i < input[0]; i++)
{
for (int j = 0; j < input[1]; j++)
{
Console.Write(mapp[i, j] + " ");
}
Console.WriteLine();
}
}*/
// 146A
/*static void Main()
{
string S = Console.ReadLine();
switch (S)
{
case "SUN":
Console.WriteLine(7);
break;
case "MON":
Console.WriteLine(6);
break;
case "TUE":
Console.WriteLine(5);
break;
case "WED":
Console.WriteLine(4);
break;
case "THU":
Console.WriteLine(3);
break;
case "FRI":
Console.WriteLine(2);
break;
case "SAT":
Console.WriteLine(1);
break;
}
}*/
// 146B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
List<string> ans = new List<string>();
for (int i = 0;i < S.Length;i++)
{
var tempch = change(S[i],N);
ans.Add(tempch.ToString());
}
foreach (string a in ans)
{
Console.Write(a);
}
Console.WriteLine();
}
static char change(char temp,int n)
{
string al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int num = al.IndexOf(temp) + n;
if (num >= 26)
{
num = num - 26;
var ans1 = al[num];
return ans1;
}
else
{
var ans2 = al[num];
return ans2;
}
//var ans = al[al.IndexOf(temp) + n];
}*/
// 146C難しい
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long A = input[0];
long B = input[1];
long X = input[2];
//var x = mm(N);
var ans = mm2(A, B,X);
//var ans = function(A, B, X);
if (ans <= 0)
{
Console.WriteLine(0);
}
else
{
Console.WriteLine(ans);
}
}
static long mm2(long a,long b,long Xor)
{
var l = 1;
var r = (int)1e9;
long ans = 0;
while (l <= r)
{
var n = (r + l) / 2;
var val = a * n + n.ToString().Length * b;
if (Xor - val >= 0)
{
ans = n;
l = n + 1;
}
else
{
r = n - 1;
}
}
return ans;
}*/
// 145C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<int[]> inputdata = new List<int[]>();
for (int i= 0;i < N;i++)
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
inputdata.Add(input);
}
}*/
// ABC145A
/*static void Main()
{
int r = int.Parse(Console.ReadLine());
var ans = Math.Pow(r, 2);
Console.WriteLine(ans);
}*/
// ABC145B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
bool flag = false;
List<string> cAns = new List<string>();
List<string> cAns2 = new List<string>();
if (S.Length % 2 == 1)
{
Console.WriteLine("No");
}
else
{
for (int i = 0; i < S.Length / 2; i++)
{
cAns.Add(S[i].ToString());
cAns2.Add(S[i + (S.Length / 2)].ToString());
}
for (int i = 0; i < S.Length / 2; i++)
{
if (cAns[i] != cAns2[i])
{
flag = true;
}
}
if (flag)
{
Console.WriteLine("No");
}
else
{
Console.WriteLine("Yes");
}
}
}*/
// 147A
/*static void Main()
{
int ans = 0;
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
for (int i =0;i < input.Length;i++)
{
ans += input[i];
}
if (ans >= 22)
{
Console.WriteLine("bust");
}
else
{
Console.WriteLine("win");
}
}*/
// 147B
/*static void Main()
{
string S = Console.ReadLine();
List<string> A = new List<string>();
List<string> B = new List<string>();
List<string> C = new List<string>();
if (S.Length % 2 == 0)
{
for (int i = 0; i < S.Length / 2; i++)
{
A.Add(S[i].ToString());
B.Add(S[i + (S.Length / 2)].ToString());
}
for (int i = B.Count - 1; i >= 0; i--)
{
C.Add(B[i]);
}
int hug = 0;
for (int i = 0; i < S.Length / 2; i++)
{
//Console.WriteLine(A[i] + " + "+ C[i]);
if (A[i] == C[i])
{
hug++;
}
}
Console.WriteLine(S.Length / 2 - hug);
}
else
{
for (int i = 0; i < S.Length / 2; i++)
{
A.Add(S[i].ToString());
B.Add(S[i + (S.Length / 2) + 1].ToString());
}
for (int i = B.Count - 1; i >= 0; i--)
{
C.Add(B[i]);
}
int hug = 0;
for (int i = 0; i < S.Length / 2; i++)
{
//Console.WriteLine(A[i] + " + "+ C[i]);
if (A[i] == C[i])
{
hug++;
}
}
Console.WriteLine(S.Length / 2 - hug);
}
}*/
// 147C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
long[] A = Console.ReadLine().Split().Select(long.Parse).ToArray();
long Answer = 0;
for (int i = 0; i < N-1;i++)
{
for (int j = i+1;j < N;j++)
{
Answer += xor(A[i] , A[j] );
}
}
Answer = Answer % 1000000007;
Console.WriteLine(Answer);
}
static long xor(long a, long b)
{
string A = Convert.ToString(a, 2);
string B = Convert.ToString(b, 2);
if (A.Length > B.Length)
{
B = B.PadLeft(A.Length, '0');
}
else if (B.Length > A.Length)
{
//var cnt2 = B.Length - A.Length;
A = A.PadLeft(B.Length, '0');
//Console.WriteLine(A.PadLeft(B.Length,'0'));
}
string an = "";
for (int i = 0;i < A.Length;i++)
{
if (A[i] == B[i])
{
an += 0.ToString();
}
else
{
an += 1.ToString();
}
}
long C = Convert.ToInt64(an, 2);
return C;
}*/
// 147C
/*static void Main()
{
int n = 3;
for (int bit = 0;bit < (1<<n);++bit)
{
List<int> S;
for (int i = 0;i < n;++i)
{
if ((bit & (1<<i)) > 0)
{
}
}
}
}*/
// 149A
/*static void Main()
{
string[] str = Console.ReadLine().Split();
string ans = str[1] + str[0];
Console.WriteLine(ans);
}*/
// 149B
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long takahashi = input[0];
long aoki = input[1];
long K = input[2];
if (takahashi - K > 0)
{
Console.WriteLine(takahashi - K + " " + aoki);
}
else
{
if (aoki - (Math.Abs(takahashi - K)) > 0)
{
Console.WriteLine(0 + " " + (aoki - (Math.Abs(takahashi - K))));
}
else
{
Console.WriteLine(0 + " " +0);
}
}
}*/
// 149C
/*static void Main()
{
int isprime = int.Parse(Console.ReadLine());
bool ans = false;
while (true)
{
if (Isprime(isprime))
{
ans = true;
}
if (ans)
{
break;
}
isprime++;
}
Console.WriteLine(isprime);
}
static bool Isprime(int num)
{
if (num < 2)
{
return false;
}
else if (num == 2)
{
return true;
}
else if (num %2 == 0)
{
return false;
}
double sqrtnum = Math.Sqrt(num);
for (int i = 3;i <= sqrtnum;i +=2)
{
if ( num % i == 0)
{
return false;
}
}
return true;
}*/
// 148A
/*static void Main()
{
int A = int.Parse(Console.ReadLine());
int B = int.Parse(Console.ReadLine());
Console.WriteLine(6 - A - B);
}*/
// 148B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
string[] input = Console.ReadLine().Split();
string S = input[0];
string T = input[1];
char[] ans = new char[N * 2];
ans[0] = S[0];
for (int i = 0;i < N*2;i++)
{
}
}*/
//ドワンゴからの挑戦状
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<Data> datalist = new List<Data>();
for (int i = 0;i < N;i++)
{
var temp = Console.ReadLine().Split();
Data data = new Data();
data.str = temp[0];
data.integer = int.Parse(temp[1]);
datalist.Add(data);
}
string keyword = Console.ReadLine();
}
}
class Data
{
public string str { get; set; }
public int integer { get; set; }
}*/
// 152A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
if (N == M)
{
Console.WriteLine("Yes");
}
else
{
Console.WriteLine("No");
}
}*/
// 152B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int a = input[0];
int b = input[1];
string Ansa = "";
string Ansb = "";
for (int i = 0; i < b;i++)
{
Ansa += a;
}
for (int i = 0;i < a;i++)
{
Ansb += b;
}
if (Ansa.CompareTo(Ansb) == -1)
{
Console.WriteLine(Ansa);
}
else if (Ansa.CompareTo(Ansb) == 0)
{
Console.WriteLine(Ansa);
}
else
{
Console.WriteLine(Ansb);
}
}*/
// 152C
/*static void Main()
{
long N = long.Parse(Console.ReadLine());
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
List<long> temp = new List<long>();
long ans = 0;
for (int i = 0;i < N;i++)
{
temp.Add(input[i]);
}
Console.WriteLine(ans);
}*/
/*static public void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
var w = input[0];
var h = input[1];
var bmi = input[2];
double Answer = 0;
double temp = 10000 * w / h / h;
if (temp > bmi)
{
double hh = (bmi * h * h) / 10000;
Answer = Math.Ceiling(hh);
Console.WriteLine(w - Answer);
}
else
{
Console.WriteLine(Answer);
}
}*/
// 159A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
var N = input[0];
var M = input[1];
long Ans = kaijo(N) + kaijo(M);
Console.WriteLine(Ans);
}
static long kaijo(int num) {
long ans = 1;
for (int i = num;i > num-2;i--)
{
ans *= i;
}
long Answer = 0;
Answer = ans / 2;
return Answer;
}*/
// 159B
/*static void Main()
{
string input = Console.ReadLine();
string A = "";
string B = "";
for (int i = 0; i < ( input.Length - 1 ) / 2; i++)
{
A += input[i];
}
for (int i = (input.Length + 3) / 2 -1; i < input.Length; i++)
{
B += input[i];
}
if (A.Equals(B))
{
Console.WriteLine("Yes");
}
else
{
Console.WriteLine("No");
}
}*/
// 159C
static void Main() {
int L = int.Parse(Console.ReadLine());
double ans = L / 3;
double Ans = ans * ans * ans;
Console.WriteLine(Ans);
}
}
/*class Data
{
public int a { get; set; }
public int b { get; set; }
}*/
}
// 125C難しい
/*namespace CSharp
{
class Program
{
static IEnumerable<long> EnumerateDivisors(long n)
{
for (long i = 1; i * i <= n; i++)
{
if (n % i == 0)
{
yield return i;
if (n / i != i)
{
yield return n / i;
}
}
}
}
static void Main(string[] args)
{
ReadString();
long[] A = ReadLongArray();
long[] divisors = Enumerable.Concat(EnumerateDivisors(A[0]),
EnumerateDivisors(A[1])) .Distinct().ToArray(); long ans = divisors.Select(x =>
new { Value = x, Count = A.Count(v => v % x == 0) }) .Where(x => x.Count >=
A.Length - 1) .OrderByDescending(x => x.Value) .First().Value;
Console.WriteLine(ans);
}
#region Helpers
static int[] ReadIntArray() => Console.ReadLine().Split().Select(s =>
int.Parse(s)).ToArray(); static long[] ReadLongArray() =>
Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();
static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0,
count).Select(_ => int.Parse(Console.ReadLine())).ToArray(); static long[]
ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ =>
long.Parse(Console.ReadLine())).ToArray();
static string ReadString() => Console.ReadLine();
static int ReadInt() => int.Parse(Console.ReadLine());
static long ReadLong() => long.Parse(Console.ReadLine());
static void ReadInt(out int first)
{
var array = ReadIntArray();
first = array[0];
}
static void ReadInt(out int first, out int second)
{
var array = ReadIntArray();
first = array[0];
second = array[1];
}
static void ReadInt(out int first, out int second, out int third)
{
var array = ReadIntArray();
first = array[0];
second = array[1];
third = array[2];
}
static void ReadInt(out int first, out int second, out int third, out
int fourth)
{
var array = ReadIntArray();
first = array[0];
second = array[1];
third = array[2];
fourth = array[3];
}
static void ReadLong(out long first)
{
var array = ReadLongArray();
first = array[0];
}
static void ReadLong(out long first, out long second)
{
var array = ReadLongArray();
first = array[0];
second = array[1];
}
static void ReadLong(out long first, out long second, out long third)
{
var array = ReadLongArray();
first = array[0];
second = array[1];
third = array[2];
}
static void ReadLong(out long first, out long second, out long third,
out long fourth)
{
var array = ReadLongArray();
first = array[0];
second = array[1];
third = array[2];
fourth = array[3];
}
#endregion
}
}*/
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;
namespace AtcoderC {
class Program {
/*static void Main(string[] args)
{
}*/
// ABC132C
//全探索法
/*static void Main()
{
BigInteger N = int.Parse(Console.ReadLine());
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int min = input.Min();
int max = input.Max();
int countARC = 0;
int countABC = 0;
int Answer = 0;
for (int i = min; i <= max; i++)
{
countABC = 0;
countARC = 0;
foreach (int n in input)
{
if (n > i)
{
countARC++;
}
else
{
countABC++;
}
}
if (countABC == countARC)
{
Answer++;
}
}
Console.WriteLine(Answer);
}*/
// 2回目
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
Array.Sort(input);
int min = input[(N / 2) - 1];
int max = input[N / 2];
Console.WriteLine(max - min);
}*/
// ABC131C
//ユーグリッドの互除法の応用
/*static void Main()
{
BigInteger[] input =
Console.ReadLine().Split().Select(BigInteger.Parse).ToArray(); BigInteger A =
input[0]; BigInteger B = input[1]; BigInteger C = input[2]; BigInteger D =
input[3]; BigInteger ans = (B / C) + (B / D);
//最小公倍数
var ans2 = C * D / lcm(C, D);
BigInteger ans3 = B / ans2;
var BB = B - ans + ans3;
ans = (A - 1) / C + (A - 1) / D;
ans3 = (A - 1) / ans2;
var AA = (A - 1) - ans + ans3;
Console.WriteLine(BB - AA);
}
static public BigInteger lcm(BigInteger a, BigInteger b)
{
var r = a % b;
while (r != 0)
{
a = b;
b = r;
r = a % b;
}
return b;
}*/
// 129C
//動的計画法
// TLEになる時間がかかり過ぎる
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
List<int> ttt = new List<int>();
for (int i = 0;i < M;i++)
{
var temp = int.Parse(Console.ReadLine());
ttt.Add(temp);
}
int[] dparray = new int[N+2];
dparray[N] = 1;
dparray[N - 1] = 1;
for (int i = N-1; i >= 0; i--)
{
if (ttt.Contains(i))
{
dparray[i] = 0;
}
dparray[i] = (dparray[i + 1] + dparray[i + 2]) % 1000000007;
}
Console.WriteLine(dparray[0]);
}*/
// ABC128
/*static void Main()
{
}*/
// ABC134A
/*static void Main()
{
int r = int.Parse(Console.ReadLine());
var ans = 3 * r * r;
Console.WriteLine(ans);
}*/
// ABC134B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int D = input[1];
int count = 0;
int ans = N;
while (true)
{
ans = ans - (D * 2 + 1);
count++;
if (ans <= 0)
{
break;
}
}
Console.WriteLine(count);
}*/
// ABC134C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<int> array = new List<int>();
for (int i =0;i<N; i++)
{
array.Add(int.Parse(Console.ReadLine()));
}
List<int> ans = new List<int>();
int max = array.Max();
var temp = new List<int>();
foreach (int n in array)
{
temp.Add(n);
}
temp.Sort();
temp.Reverse();
int second = temp[1];
foreach (int nn in array)
{
if (nn == max)
{
Console.WriteLine(second);
}
else
{
Console.WriteLine(max);
}
}
}*/
// 134ABCD
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int count = 0;
int ans = 0;
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
for (int i = 0;i<N;i++)
{
for (int j =0;j<N; j++)
{
if ((j+1)%(i+1)==0)
{
count += input[j];
}
}
if (count % 2 == input[i])
{
ans++;
}
count = 0;
}
if (ans != 0)
{
}
}*/
// AGC036
/*static void Main()
{
long S = long.Parse(Console.ReadLine());
long X1 = 1000000000;
long Y1 = 0;
/*while (true)
{
Y1 = S / X1 + S % X1;
}
Y1 = S / X1 + S % X1;
Console.WriteLine("0 0 " + X1 + " 0 0 " + Y1);
/*int tempX = 0;
List<long> ss = new List<long>();
while (tempX < S)
{
var ans = S % tempX;
if (ans == 0)
{
ss.Add(ans);
}
tempX++;
}
Console.WriteLine(tempX);*/
/*long X1 = 0;
long Y1 = 1;
while (true)
{
X1 = S % Y1;
if (X1 <= 1000000000)
{
break;
}
Y1++;
}
Console.WriteLine("0 0 "+X1+" 0 0 "+Y1);
}*/
// ABC82A
/*static void Main()
{
double[] input =
Console.ReadLine().Split().Select(double.Parse).ToArray(); double a =
input[0]; double b = input[1]; double sum = (a + b) / 2;
Console.WriteLine(Math.Ceiling(sum));
}*/
// ABC128C
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
int ans = 0;
List<int[]> K = new List<int[]>();
for (int i = 0;i<M;i++)
{
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
K.Add(temp);
}
int[] P = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] light = new int[M];
for (int i = 0;i < Math.Pow(2,N);i++)
{
var isrow = 0;
var temp = int.Parse(Convert.ToString(i, 2)).ToString("0000000000");
for (int j =0;j < M;j++)
{
var ison = 0;
for (int k = 0; k < K[j][0];k++)
{
var index = K[j][k] - 1;
if (temp[9-index] == '1')
{
ison++;
}
}
if (ison % 2 == P[j])
{
isrow++;
}
else
{
break;
}
}
if (isrow == M)
{
ans++;
}
}
Console.WriteLine(ans);*/
/*nt[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int a = input[0];
int b = input[1];
var temp = a * b % 2;
if (temp == 0)
{
Console.WriteLine("even");
}
else
{
Console.WriteLine("odd");
}
}*/
// ABC127C
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
List<int[]> gate = new List<int[]>();
for (int i = 0; i < M; i++)
{
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
gate.Add(temp);
}
if (M == 1)
{
Console.WriteLine(N);
}
else
{
List<int> card = new List<int>();
for (int i = gate[0][0]; i <= gate[0][1]; i++)
{
card.Add(i);
}
for (int j = 1; j < gate.Count; j++)
{
List<int> ans = new List<int>();
var count = 0;
for (int i = gate[j][0]; i <= gate[j][1]; i++)
{
if (card.Contains(i))
{
count++;
ans.Add(i);
}
}
if (count == 0)
{
break;
}
card = new List<int>(ans);
}
Console.WriteLine(card.Count());
}
}*/
// 127C Revenge TLE
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
List<int[]> gate = new List<int[]>();
for (int i = 0; i < M; i++)
{
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
gate.Add(temp);
}
int Ans = 0;
for (int i =1;i<=N;i++)
{
var count = 0;
for (int j = 0;j < gate.Count;j++)
{
if (gate[j][0] <= i && i <= gate[j][1])
{
count++;
}
}
if (count == gate.Count)
{
Ans++;
}
}
Console.WriteLine(Ans);
}*/
// 127C RevengeVer2
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
List<int[]> gate = new List<int[]>();
for (int i = 0; i < M; i++)
{
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
gate.Add(temp);
}
List<int> Max = new List<int>();
List<int> Min = new List<int>();
for (int i =0;i< M;i++)
{
Max.Add(gate[i][1]);
Min.Add(gate[i][0]);
}
int max = Max.Min();
int min = Min.Max();
if (min <= max)
{
Console.WriteLine(max - min + 1);
}
else
{
Console.WriteLine("0");
}
}*/
// ABC126C
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
double ans = 0.0;
for (int i = 1; i<= N;i++)
{
double tempP = (double)1 / N;
int point = i;
while (point<M)
{
tempP = tempP * 1 / 2;
point *= 2;
}
ans += tempP;
}
Console.WriteLine(ans);
}*/
// ABC125C ユーグリッド互除法
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
Array.Sort(A);
int lcmr, lcml = 0;
List<int> answer = new List<int>();
for (int i =0;i<A.Length;i++)
{
lcmr = 0;
for (int x = 0;x < i;x++)
{
if (lcmr - A[x] >= 0)
{
lcmr = lcm(lcmr, A[x]);
}
else
{
lcmr = lcm(A[x], lcmr);
}
}
lcml = 0;
for (int y = i+1; y < A.Length; y++)
{
if (lcml - A[y] >= 0)
{
lcml = lcm(lcml, A[y]);
}
else
{
lcml = lcm(A[y],lcml);
}
}
var tempans = 0;
if (lcmr > lcml)
{
tempans = lcm(lcmr, lcml);
}
else
{
tempans = lcm(lcml, lcmr);
}
answer.Add(tempans);
}
Console.WriteLine(answer.Max());
}
static public int lcm(int a, int b)
{
if (b == 0)
{
return a;
}
var r = a % b;
while (r != 0)
{
a = b;
b = r;
r = a % b;
}
return b;
}*/
// 124C
/*static void Main()
{
string inputstr = Console.ReadLine();
int count = 0;
if (inputstr[0] == '0')
{
for (int i = 0; i < inputstr.Length; i++)
{
if (i % 2 == 0)
{
if (inputstr[i] == '1')
{
count++;
}
}
else
{
if (inputstr[i] == '0')
{
count++;
}
}
}
}
else
{
for (int i = 0; i < inputstr.Length; i++)
{
if (i % 2 == 1)
{
if (inputstr[i] == '1')
{
count++;
}
}
else
{
if (inputstr[i] == '0')
{
count++;
}
}
}
}
Console.WriteLine(count);
}*/
// 123C
/*static void Main()
{
double N = double.Parse(Console.ReadLine());
List<double> city = new List<double>();
for (int i = 0; i < 5; i++)
{
city.Add(double.Parse(Console.ReadLine()));
}
var ans = Math.Ceiling(N / city.Min()) + 4;
Console.WriteLine(ans);
}*/
// 82C
/*static void Main()
{
double[] input =
Console.ReadLine().Split().Select(double.Parse).ToArray(); double a =
input[0]; double b = input[1]; double answer = (a + b) / 2;
Console.WriteLine(Math.Ceiling(answer));
}*/
// 128B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int P = input[1];
var ans = (P + A * 3) / 2;
Console.WriteLine(ans);
int a,b
cin << a << b;
cout >> (P + A * 3) / 2 >> endl;
}*/
// 119A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
if (B % A == 0)
{
Console.WriteLine(A + B);
}
else
{
Console.WriteLine(B-A);
}
}*/
// 116A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
int C = input[2];
Console.WriteLine((A*B)/2);
}*/
// ABC31B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = int.Parse(Console.ReadLine());
List<int> array = new List<int>();
for (int i =0;i<N;i++)
{
array.Add(int.Parse(Console.ReadLine()));
}
foreach (int a in array)
{
if (a < input[0])
{
Console.WriteLine(input[0] - a);
}
else if (input[1] < a)
{
Console.WriteLine("-1");
}
else
{
Console.WriteLine("0");
}
}
}*/
// ABC36B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<string> map = new List<string>();
for (int i =0;i< N;i++)
{
map.Add(Console.ReadLine());
}
List<string> ans = new List<string>();
for(int j = 0; j < N;j++)
{
var temp = "";
for (int i = N-1; i >= 0; i--)
{
temp += map[i][j];
}
ans.Add(temp);
}
foreach (string a in ans)
{
Console.WriteLine(a);
}
}*/
// ABC40B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int A = 0;
int temp = N;
if (N == 1)
{
Console.WriteLine("0");
}
else
{
while (true)
{
double root = Math.Sqrt(N);
if (root != (int)root)
{
N--;
}
else
{
A = (int)root;
break;
}
}
List<int> answer = new List<int>();
bool flag = false;
while (A > 0)
{
var a = A;
while (A * a <= temp)
{
var ans = temp - (A * a) + Math.Abs(A - a);
if (ans == 0)
{
flag = true;
break;
}
a++;
answer.Add(ans);
}
if (flag == true)
{
break;
}
A--;
}
if (flag)
{
Console.WriteLine("0");
}
else
{
Console.WriteLine(answer.Min());
}
}
}*/
// ABC122C
// TLE
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
string S = Console.ReadLine();
List<int[]> array = new List<int[]>();
for (int i = 0; i < input[1]; i++)
{
array.Add(Console.ReadLine().Split().Select(int.Parse).ToArray());
}
List<int> answer = new List<int>();
foreach (int[] n in array)
{
var tempstr = S.Substring(n[0]-1,n[1]-n[0]+1);
var count = tempstr.Length - tempstr.Replace("AC","").Length;
var ans = count / 2;
answer.Add(ans);
}
foreach (int a in answer)
{
Console.WriteLine(a);
}
}*/
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
string S = Console.ReadLine();
List<int[]> array = new List<int[]>();
for (int i = 0; i < input[1]; i++)
{
array.Add(Console.ReadLine().Split().Select(int.Parse).ToArray());
}
for (int i = 0;i < S.Length-1;i++)
{
if (S[i] == 'A')
{
if (S[i + 1] == 'C')
{
S = S.Replace(S[i],'a');
}
}
}
int count = 0;
List<int> ansstr = new List<int>();
for (int i = 0; i < S.Length;i++)
{
count = 0;
for (int j = 0;j <= i;j++)
{
if (S[j] == 'a')
{
count++;
}
}
ansstr.Add(count);
}
List<int> anss = new List<int>();
for (int i = 0; i < input[1];i++)
{
anss.Add(ansstr[array[i][1]-2] - ansstr[array[i][0]-1]);
}
foreach (int a in anss)
{
Console.WriteLine(a);
}
}*/
// ABC39B
/*static void Main()
{
int X = int.Parse(Console.ReadLine());
var ans = Math.Sqrt(X);
var ans2 = Math.Sqrt(ans);
Console.WriteLine(ans2);
}*/
// ABC38B
/*static void Main()
{
int[] input1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] input2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
bool flag1 = false;
foreach (int a in input1)
{
foreach (int b in input2)
{
if (a == b)
{
flag1 = true;
}
}
}
if (flag1 == true)
{
Console.WriteLine("YES");
}
else
{
Console.WriteLine("NO");
}
}*/
// ABC35B
/*static void Main()
{
string S = Console.ReadLine();
int T = int.Parse(Console.ReadLine());
int[] pos = { 0, 0 };
foreach (char a in S)
{
}
}*/
// ABC34B
/*static void Main()
{
}*/
//技術ProgramContest4Day1
// A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
}*/
// ABC135A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
var temp = B - A;
if (temp % 2 == 0)
{
Console.WriteLine(A + (temp/2));
}
else
{
Console.WriteLine("IMPOSSIBLE");
}
}*/
// ABC135B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] P = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] AnsN = new int[N];
for (int i = 0;i <N;i++)
{
AnsN[i] = i + 1;
}
int count = 0;
for(int i = 0;i < N;i++)
{
if (P[i] != AnsN[i])
{
count++;
}
}
if (count <= 2)
{
Console.WriteLine("YES");
}
else
{
Console.WriteLine("NO");
}
}*/
// ABC135C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
/*int count = 0;
for (int i = N;i>0;i--)
{
var tempA = A[i] + A[i - 1];
if (tempA <= B[i - 1])
{
A[i - 1] = 0;
count += tempA;
}
else
{
if (A[i] <= B[i - 1])
{
A[i - 1] = tempA - B[i - 1];
count += B[i - 1];
}
else
{
count += B[i - 1];
}
}
}*/
/*int count = 0;
for (int i = 0;i < N;i++)
{
var tempA = A[i] + A[i + 1];
if (tempA <= B[i])
{
A[i + 1] = 0;
count += tempA;
}
else
{
if (B[i] >= A[i])
{
A[i + 1] = A[i + 1] - (B[i] - A[i]);
count += B[i];
}
else
{
count += B[i];
}
}
}
//このやり方
int count = 0;
for (int i = 0; i < N;i++)
{
List<int> temp = new List<int>();
temp.Add(A[i]);
temp.Add(B[i]);
count += temp.Min();
}
Console.WriteLine(count);
}*/
// ABC135D
// ABC127A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
string inputstr = Console.ReadLine();
char[] temp = inputstr.ToCharArray();
temp[input[1]-1] = Char.ToLower(temp[input[1] -1]);
inputstr = new string(temp);
Console.WriteLine(inputstr);
}*/
// ABC35
/*static void Main()
{
string S = Console.ReadLine();
int T = int.Parse(Console.ReadLine());
int[] ans = { 0, 0 };
int count = 0;
for (int i = 0; i < S.Length;i++)
{
if (S[i] == 'U')
{
ans[1]++;
}
else if (S[i] == 'D')
{
ans[1]--;
}
else if (S[i] == 'R')
{
ans[0]++;
}
else if (S[i] == 'L')
{
ans[0]--;
}
else
{
count++;
}
}
List<int[]> answer = new List<int[]>();
answer.Add(ans);
answer.Add(ans);
answer.Add(ans);
answer.Add(ans);
foreach (int[] n in answer)
{
}
}*/
// ABC114A
/*static void Main()
{
int x = int.Parse(Console.ReadLine());
if (x == 7 || x == 5 || x == 3)
{
Console.WriteLine("YES");
}
else
{
Console.WriteLine("NO");
}
}*/
// ABC121C
// TLE
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long n = input[0];
long M = input[1];
List<long[]> shop = new List<long[]>();
for (int i = 0;i < n;i++)
{
shop.Add(Console.ReadLine().Split().Select(long.Parse) .ToArray());
}
List<long[]> answer = new List<long[]>(Sort(shop));
long price = 0;
long count = 0;
foreach (long[] temp in answer)
{
var tempcount = count;
if (count + temp[1] <= M)
{
count += temp[1];
}
else
{
count = M;
}
price += (count-tempcount) * temp[0];
if (M<=count)
{
break;
}
}
Console.WriteLine(price);
}
static List<long[]> Sort(List<long[]> A)
{
for (int i = 0;i < A.Count;i++)
{
for (int j = A.Count-1;j >i;j-- )
{
if (A[j][0] < A[j-1][0])
{
var temp = A[j];
A[j] = A[j - 1];
A[j - 1] = temp;
}
}
}
return A;
}*/
// Sortはライブラリを使った方が早い
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long n = input[0];
long M = input[1];
List<long[]> shops = new List<long[]>();
for (int i = 0; i < n; i++)
{
shops.Add(Console.ReadLine().Split().Select(long.Parse).ToArray());
}
long count = 0;
long ans = 0;
foreach (long[] shop in shops.OrderBy(a => a[0]))
{
var i = Math.Min(M - count, shop[1]);
ans += shop[0] * i;
count += i;
if (count >= M)
{
break;
}
}
Console.WriteLine(ans);
}*/
// 120C
// TLE
/*static void Main()
{
/*string input = Console.ReadLine();
int len = input.Length;
int count = 0;
while (input.Contains("01") || input.Contains("10"))
{
input = input.Replace("01", "").Replace("10", "");
count += len - input.Length;
len = input.Length;
}
Console.WriteLine(count);
string s = Console.ReadLine();
int zero = s.Replace("1", "").Length;
int one = s.Replace("0", "").Length;
Console.WriteLine((zero < one ? zero : one) * 2);
}*/
// 119
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
List<int> goal = new List<int>();
List<int> list = new List<int>();
for (int i =1;i<=N-1;i++)
{
goal.Add(input[i]);
}
for (int i = 0;i<N;i++)
{
list.Add(int.Parse(Console.ReadLine()));
}
}*/
// 118C
// 37B
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long n = input[0];
long k = input[1];
List<long[]> list = new List<long[]>();
for (int i = 0;i < k;i++)
{
long[] temp = Console.ReadLine().Split().Select(long.Parse).ToArray();
list.Add(temp);
}
long[] Ans = new long[n];
foreach (long[] m in list)
{
for (int i =0;i < Ans.Length;i++)
{
if (m[0]-1 <= i && i <= m[1]-1)
{
Ans[i] = m[2];
}
}
}
foreach (int a in Ans)
{
Console.WriteLine(a);
}
}*/
//大手前プロコン2019
// A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
if (A + 0.5f >= B)
{
Console.WriteLine("1");
}
else
{
Console.WriteLine("0");
}
}*/
// E
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long N = input[0];
long Q = input[1];
List<long> D = new List<long>();
for (long i = 0;i < N;i++)
{
D.Add(long.Parse(Console.ReadLine()));
}
List<long[]> TLR = new List<long[]>();
for (long i = 0;i < Q;i++)
{
TLR.Add(Console.ReadLine().Split().Select(long.Parse).ToArray());
}
foreach (long[] tlr in TLR)
{
var count = 0;
var tempara = new List<long>();
var a = tlr[0];
tempara.Add(a);
for (long i = 1;i <= N;i++)
{
if (Math.Abs(a - (-1 * i)) > D[(int)i - 1])
{
a = a - D[(int)i - 1];
}
else
{
a = -1*i;
}
tempara.Add(a);
}
foreach (long n in tempara)
{
if ( tlr[1]<= n && tlr[2] >= n)
{
count++;
}
}
Console.WriteLine(count);
}
}*/
// AtCoderBeginnerContest136
// 136A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
int C = input[2];
var a = A - B;
var ans = C - a;
if (ans >= 0)
{
Console.WriteLine(ans);
}
else
{
Console.WriteLine("0");
}
}*/
// 136B
/*static void Main()
{
string N = Console.ReadLine();
int n = int.Parse(N);
int ocun = 0;
for (int i = 1; i<=n;i++)
{
if (i.ToString().Length % 2 == 1)
{
ocun++;
}
}
Console.WriteLine(ocun);
}*/
// 136C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] list = Console.ReadLine().Split().Select(int.Parse).ToArray();
int count = 0;
int max = 0;
bool flag = false;
foreach (int a in list)
{
if (a >= max)
{
max = a;
}
else if (max - a >= 2)
{
flag = true;
break;
}
else { }
}
if (flag)
{
Console.WriteLine("No");
}
else
{
Console.WriteLine("Yes");
}
}*/
// 113C-ID
/*static void Main()
{
string S = Console.ReadLine();
Console.WriteLine(S.Length);
}*/
// 113A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
Console.WriteLine(A + (B/2));
}*/
// 112A
/*static void Main()
{
}*/
// 137A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
List<int> answer = new List<int>();
var ans1 = A + B;
answer.Add(ans1);
var ans2 = A - B;
answer.Add(ans2);
var ans3 = A * B;
answer.Add(ans3);
Console.WriteLine(answer.Max());
}*/
// 137B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int K = input[0];
int X = input[1];
for (int i = X - (K-1);i<= X + (K-1);i++)
{int
if (i >= -1000000 && i <= 1000000)
{
Console.Write(i+" ");
}
}
Console.WriteLine();
}*/
// 137C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<string[]> list = new List<string[]>();
for (int i = 0; i < N;i++)
{
list.Add(Console.ReadLine().Split());
}
foreach (string[] n in list)
{
Array.Sort(n);
}
long ans = 0;
for (int i = 0; i< list.Count;i++)
{
for (int j = i+1;j < list.Count;j++)
{
if (list[i].Equals(list[j]))
{
ans++;
}
}
}
Console.WriteLine(ans);
}*/
/*static void Main(string[] args)
{
int N = Convert.ToInt32(Console.ReadLine());
string[] S = new string[N];
for (var i = 0; i < N; i++)
{
char[] c = Console.ReadLine().ToCharArray();
Array.Sort(c);
S[i] = new string(c);
}
Dictionary<string, long> dict = new Dictionary<string, long>();
for (var i = 0; i < N; i++)
{
if (dict.ContainsKey(S[i]))
{
dict[S[i]]++;
}
else
{
dict[S[i]] = 1L;
}
}
long res = 0L;
foreach (var i in dict)
{
if (i.Value > 1)
{
res += i.Value * (i.Value - 1) / 2;
}
}
Console.WriteLine(res);
}*/
// 138A
/*static void Main()
{
int a = int.Parse(Console.ReadLine());
string s = Console.ReadLine();
if (a < 3200)
{
Console.WriteLine("red");
}
else
{
Console.WriteLine(s);
}
}*/
// 138B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
double[] A = Console.ReadLine().Split().Select(double.Parse).ToArray();
double ans = 0;
for (int i = 0;i<A.Length;i++)
{
ans += 1 / A[i];
}
Console.WriteLine(1/ans);
}*/
// 138C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
double[] v = Console.ReadLine().Split().Select(double.Parse).ToArray();
double ans = 0;
Array.Sort(v);
ans = (v[0] + v[1]) / 2;
for (int i = 2; i < N;i++)
{
ans = (ans + v[i]) / 2;
}
Console.WriteLine(ans);
}*/
// 138D
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int Q = input[1];
List<Data> datalist = new List<Data>();
List<int[]> listQ = new List<int[]>();
for (int i = 0; i < N-1;i++)
{
Data data = new Data();
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
data.a = temp[0];
data.b = temp[1];
datalist.Add(data);
}
datalist = datalist.OrderBy(n => n.a).OrderBy(m => m.b).ToList();
for (int i = 0;i < Q;i++)
{
listQ.Add(Console.ReadLine().Split().Select(int.Parse).ToArray());
}
int[] Answer = new int[datalist[datalist.Count()].b];
var tempA = 0;
foreach (Data aa in datalist)
{
if (aa.a > tempA)
{
tempA = aa.a;
}
}
foreach (int[] temp in listQ)
{
if (temp[0] < tempA)
{
for (int i = temp[0]; i < Answer.Length; i++)
{
Answer[i] += temp[1];
}
}
else
{
Answer[temp[0]] += Answer[1];
}
}
foreach (int a in Answer)
{
Console.Write(a);
}
Console.WriteLine();
}*/
//最強プログラマ―選手権
// A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int M = input[0];
int D = input[1];
int ans = 0;
for (int i = 1;i <= M;i++)
{
for (int j = 1; j <= D; j++)
{
int d1 = j / 10;
int d2 = j % 10;
if (d1 >= 2 && d2 >= 2)
{
var temp = d1 * d2;
if (temp == i)
{
ans++;
}
}
}
}
Console.WriteLine(ans);
}*/
// B
/*static void Main()
{
var tem = 1000000007;
var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
var N = input[0];
var K = input[1];
var array = Console.ReadLine().Split().Select(long.Parse).ToArray();
var invert = new long[N];
for (int i =0;i<N;i++)
{
for (int j = i+1;j < N;j++)
{
if (array[i] > array[j])
{
invert[i]++;
}
}
}
var less = new long[N];
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
if (array[i] > array[j])
{
less[i]++;
}
}
}
long ans = 0;
for (int i = 0;i < N;i++)
{
ans = (ans + (invert[i] * K) % tem) % tem;
ans = (ans + (less[i] * ((K * (K-1))/ 2 % tem)) % tem) % tem;
//K*(K-1)/2
}
Console.WriteLine(ans %tem);
}*/
// 139A
/*static void Main()
{
string input = Console.ReadLine();
string input2 = Console.ReadLine();
int ans = 0;
for (int i = 0;i < input.Length;i++)
{
if (input[i] == input2[i])
{
ans++;
}
}
Console.WriteLine(ans);
}*/
// 139B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
var ans = 0;
var temp = 1;
while (temp < B)
{
--temp;
temp+= A;
++ans;
}
Console.WriteLine(ans);
}*/
// 139C
/*static void Main()
{
int N =int.Parse(Console.ReadLine());
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
List<long> sa = new List<long>();
for (long i = 0;i < input.Length - 1;i++)
{
if (input[i] >= input[i + 1])
{
sa.Add(1);
}
else
{
sa.Add(0);
}
}
var count = 0;
List<long> Answer = new List<long>();
for(int i = 0; i < sa.Count;i++)
{
if (sa[i] == 1)
{
count++;
}
else {
count = 0;
}
Answer.Add(count);
}
Console.WriteLine(Answer.Max());
}*/
// 140A
/*static void Main()
{
double input = double.Parse(Console.ReadLine());
var ans = Math.Pow(input, 3);
Console.WriteLine(ans);
}*/
// 140B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] C = Console.ReadLine().Split().Select(int.Parse).ToArray();
int Ans = 0;
for (int i = 0;i < B.Length;i++)
{
Ans += B[i];
}
for (int i = 0;i <= A.Length -2;i++ )
{
if (A[i + 1] - A[i] == 1)
{
Ans += C[A[i] - 1];
}
}
Console.WriteLine(Ans);
}*/
// 140C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
long Ans = 0;
Ans += B[0];
Ans += B[B.Length-1];
for (int i = 0; i<B.Length-1;i++)
{
List<int> temp = new List<int>();
temp.Add(B[i]);
temp.Add(B[i + 1]);
Ans += temp.Min();
}
Console.WriteLine(Ans);
}*/
// 141A
/*static void Main()
{
string temp = Console.ReadLine();
switch (temp)
{
case "Sunny":
Console.WriteLine("Cloudy");
break;
case "Cloudy":
Console.WriteLine("Rainy");
break;
case "Rainy":
Console.WriteLine("Sunny");
break;
}
}*/
// 141B
/*static void Main()
{
string S = Console.ReadLine();
bool flag = false;
for (int i = 0; i < S.Length; i++)
{
if (i % 2 == 0)
{
if (S[i] == 'L' || S[i] == 'U' || S[i] == 'D')
{
}
else
{
flag = true;
}
}
else
{
if (S[i] == 'R' || S[i] == 'U' || S[i] == 'D')
{
}
else
{
flag = true;
}
}
}
if (flag == false)
{
Console.WriteLine("No");
}
else
{
Console.WriteLine("Yes");
}
}*/
// 142A
/*static void Main()
{
double N = double.Parse(Console.ReadLine());
double count = 0;
for (int i = 1;i <= N;i++)
{
if (i % 2 == 1)
{
count++;
}
}
double Ans = count / N;
Console.WriteLine(Ans);
}*/
// 142B
/*tatic void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int K = input[1];
int count = 0;
int[] h = Console.ReadLine().Split().Select(int.Parse).ToArray();
foreach (int temp in h)
{
if (temp >= K)
{
count++;
}
}
Console.WriteLine(count);
}*/
// 142C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] temp1 = new int[temp.Length];
for (int i = 1;i <= temp.Length;i++)
{
temp1[i-1] = i;
}
List<int[]> ans = new List<int[]>();
for (int i = 0; i < temp.Length;i++)
{
int[] aa = new int[2];
aa[0] = temp[i];
aa[1] = temp1[i];
ans.Add(aa);
}
int[] Ans = new int[N];
for(int i = 0;i < N;i++){
Ans[i] = 0;
}
for (int i = 0; i < ans.Count; i++)
{
Ans[ans[i][0] - 1] = ans[i][1];
}
for (int i = 0;i < Ans.Length;i++) {
Console.Write(Ans[i] + " ");
}
Console.WriteLine();
}*/
// 142D
/*static void Main()
{
int[] N = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = N[0];
int B = N[1];
List<int> temp = new List<int>();
for (int i = 1; i <= A; i++)
{
if (B % i == 0)
{
temp.Add(i);
}
}
for (int i = 0; i < temp.Count; i++)
{
for (int j = i; j < temp.Count; j++)
{
}
}
}*/
// 141C
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int K = input[1];
int Q = input[2];
List<int> A = new List<int>();
for (int i = 0;i < Q;i++)
{
A.Add(int.Parse(Console.ReadLine()));
}
int[] ans = new int[N];
for (int i = 0;i < N; i++)
{
ans[i] = K;
}
int[] point = new int[N];
for (int i = 0;i < N;i++)
{
point[i] = 0;
}
foreach (int a in A)
{
point[a - 1] += 1;
}
for(int i = 0; i < N;i++ )
{
point[i] = Q - point[i];
}
List<int> Answer = new List<int>();
for (int j = 0; j < N;j++)
{
var temp = ans[j] - point[j];
Answer.Add(temp);
}
foreach (int temp in Answer)
{
if (temp > 0) { Console.WriteLine("Yes"); }
else { Console.WriteLine("No"); }
}
}*/
// 139D
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
long Ans = 0;
for (int i = 1;i <= N-1;i++)
{
Ans += i;
}
Console.WriteLine(Ans);
}*/
// 133C
/*static void Main()
{
int[] M = Console.ReadLine().Split().Select(int.Parse).ToArray();
int r = M[0];
int l = M[1];
var Ans = m(r, l);
Console.WriteLine(Ans);
}
static long m(int r, int l)
{
var ans = long.MaxValue;
for (int i = r; i < l; i++)
{
for (int j = i + 1; j <= l; j++)
{
ans = Math.Min(ans, (i * j) % 2019);
if (ans == 0) { return ans; }
}
}
return ans;
}*/
/*static void Main(string[] args)
{
var lr = Console.ReadLine().Split();
var l = int.Parse(lr[0]);
var r = int.Parse(lr[1]);
var ans = m1(l, r);
Console.WriteLine(ans);
}
static long m1(int l, int r)
{
var ans = long.MaxValue;
for (long i = l; i < r; i++)
{
for (long j = i + 1; j <= r; j++)
{
ans = Math.Min(ans, i * j % 2019);
if (ans == 0) return ans;
}
}
return ans;
}*/
//学生コンテスト
// A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
bool flag = false;
List<int[]> ans1 = new List<int[]>();
for (int i = 0; i < N;i++)
{
int[] tarray = new int[M];
for (int j = 0;j < M;j++)
{
var temp1 = A[i] + B[j];
tarray[j] = temp1;
}
ans1.Add(tarray);
}
List<int> ans = new List<int>();
for (int i = 0; i < N;i ++ )
{
for (int j = 0; j < M;j++)
{
ans.Add(A[i] + B[j]);
}
}
var tempans = 0;
//var aaa = ans.GroupBy(n => n).Where(n => n.Count() > 1).Select(group =>
group.Key).ToArray(); ans.Sort(); for (int i = 0;i < ans.Count -1;i++)
{
if (ans[i] == ans[i+1]) {
tempans = ans[i];
flag = true;
break;
}
}
int a1 = 0;
int a2 = 0;
int b1 = 0;
int b2 = 0;
int count = 0;
bool temp = false;
if (flag == true)
{
for (int i = 0; i < N; i++)
{
if (ans1[i].Contains(tempans))
{
for (int j = 0; j < M; j++)
{
if (tempans == ans1[i][j] && count == 0)
{
a1 = i;
a2 = j;
count++;
break;
}
if (tempans == ans1[i][j] && count == 1)
{
b1 = i;
b2 = j;
temp = true;
break;
}
if (temp == true) { break; }
}
}
}
}
else
{
Console.WriteLine("-1");
}
if(temp == true)
{
Console.WriteLine(a1 + " " + a2 + " " + b1 + " " + b2);
}
}*/
// 108C
//全ての都市に対してMath.Abs(X-x[i])の最大公約数をもとめるプログラムになる.
// SCIE,SCIの研究ジャーナルは信用の大会論文である.
//じぁーなるのお話
//参考の論文を簡単にまとめるプログラム(Mendelay)
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int X = input[1];
long[] XList = Console.ReadLine().Split().Select(long.Parse).ToArray();
List<long> ans = new List<long>();
for (int i = 0;i < N;i++)
{
var temp = Math.Abs(XList[i]-X);
ans.Add(temp);
}
for (int i = 0;i < N;i++)
{
}
Console.WriteLine(ans.Min());
}*/
// 128D
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
int[] sw = Console.ReadLine().Split().Select(int.Parse).ToArray();
List<int[]> sw2 = new List<int[]>();
for (int i = 0;i < M;i++)
{
var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
sw2.Add(temp);
}
int[] sw3 = Console.ReadLine().Split().Select(int.Parse).ToArray();
}*/
// 143A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
var ans = A - (2 * B);
if (ans > 0)
{
Console.WriteLine(ans);
}
else
{
Console.WriteLine("0");
}
}*/
// 143B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int Answer = 0;
for (int i = 0;i < N-1;i++)
{
for (int j = i+1; j < N;j++)
{
var temp = input[i] * input[j];
Answer += temp;
}
}
Console.WriteLine(Answer);
}*/
// 143C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
var temp = S[0];
List<string> Ans = new List<string>();
for (int i = 1; i < N;i++)
{
if (temp == S[i])
{
temp = S[i];
}
else
{
Ans.Add(temp.ToString());
temp = S[i];
}
}
Console.WriteLine(Ans.Count() + 1);
}*/
// 143D
/*static void Main()
{
}*/
// 144A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int A = input[0];
int B = input[1];
if (A > 9 || B > 9)
{
Console.WriteLine("-1");
}
else
{
Console.WriteLine(A * B);
}
}*/
// 144B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<int> map = new List<int>();
for (int i = 1;i < 10;i++)
{
for (int j = 1;j < 10;j++)
{
var temp = i * j;
map.Add(temp);
}
}
if (map.Contains(N))
{
Console.WriteLine("Yes");
}
else
{
Console.WriteLine("No");
}
}*/
// DISCO2019A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int X = input[0];
int Y = input[1];
long moneyX = 0;
long moneyY = 0;
int count = 0;
if (X < 4)
{
switch (X)
{
case 1:
moneyX += 300000;
count++;
break;
case 2:
moneyX += 200000;
break;
case 3:
moneyX += 100000;
break;
}
}
if (Y < 4)
{
switch (Y)
{
case 1:
moneyY += 300000;
count++;
break;
case 2:
moneyY += 200000;
break;
case 3:
moneyY += 100000;
break;
}
}
if (count == 2)
{
moneyX += 400000;
}
Console.WriteLine(moneyX + moneyY);
}*/
// DISCO2019B
/*static void Main()
{
long N = long.Parse(Console.ReadLine());
long[] A = Console.ReadLine().Split().Select(long.Parse).ToArray();
long left = 0;
long right = 0;
long sum = 0;
foreach (long a in A)
{
sum += a;
}
List<long> sa = new List<long>();
for (long i = 0;i < N;i++)
{
left += A[i];
right = sum - left;
sa.Add(Math.Abs(left - right));
}
sa.Sort();
Console.WriteLine(sa[0]);
}*/
// DISCO2019C
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
List<string> array = new List<string>();
for (int i = 0;i<input[1];i++)
{
var temp = Console.ReadLine();
array.Add(temp);
}
int[,] mapp = new int[input[0], input[1]];
int count = 1;
for (int i = 0;i < input[0];i++)
{
for (int j = 0;j < input[1];j++)
{
if (array[i][j] == '#')
{
mapp[i,j] += count;
count++;
}
}
}
for (int i = 0; i < input[0]; i++)
{
for (int j = 0; j < input[1]; j++)
{
if (mapp[i,j] == 0)
{
if (j == 0)
{
for (int k =0;k < input[1];k++)
{
if (mapp[i, k] != 0)
{
mapp[i, j] = mapp[i, k];
break;
}
}
}
else
{
mapp[i,j] = mapp[i, j - 1];
}
}
}
}
for (int i = 0;i < input[0];i++)
{
for (int j = 0;j < input[1];j++)
{
if (mapp[i,j] == 0)
{
if (i == input[0] - 1)
{
mapp[i, j] = mapp[i - 1, j];
}
else
{
mapp[i, j] = mapp[i + 1, j];
}
}
}
}
for (int i = 0; i < input[0]; i++)
{
for (int j = 0; j < input[1]; j++)
{
Console.Write(mapp[i, j] + " ");
}
Console.WriteLine();
}
}*/
// 146A
/*static void Main()
{
string S = Console.ReadLine();
switch (S)
{
case "SUN":
Console.WriteLine(7);
break;
case "MON":
Console.WriteLine(6);
break;
case "TUE":
Console.WriteLine(5);
break;
case "WED":
Console.WriteLine(4);
break;
case "THU":
Console.WriteLine(3);
break;
case "FRI":
Console.WriteLine(2);
break;
case "SAT":
Console.WriteLine(1);
break;
}
}*/
// 146B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
List<string> ans = new List<string>();
for (int i = 0;i < S.Length;i++)
{
var tempch = change(S[i],N);
ans.Add(tempch.ToString());
}
foreach (string a in ans)
{
Console.Write(a);
}
Console.WriteLine();
}
static char change(char temp,int n)
{
string al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int num = al.IndexOf(temp) + n;
if (num >= 26)
{
num = num - 26;
var ans1 = al[num];
return ans1;
}
else
{
var ans2 = al[num];
return ans2;
}
//var ans = al[al.IndexOf(temp) + n];
}*/
// 146C難しい
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long A = input[0];
long B = input[1];
long X = input[2];
//var x = mm(N);
var ans = mm2(A, B,X);
//var ans = function(A, B, X);
if (ans <= 0)
{
Console.WriteLine(0);
}
else
{
Console.WriteLine(ans);
}
}
static long mm2(long a,long b,long Xor)
{
var l = 1;
var r = (int)1e9;
long ans = 0;
while (l <= r)
{
var n = (r + l) / 2;
var val = a * n + n.ToString().Length * b;
if (Xor - val >= 0)
{
ans = n;
l = n + 1;
}
else
{
r = n - 1;
}
}
return ans;
}*/
// 145C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<int[]> inputdata = new List<int[]>();
for (int i= 0;i < N;i++)
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
inputdata.Add(input);
}
}*/
// ABC145A
/*static void Main()
{
int r = int.Parse(Console.ReadLine());
var ans = Math.Pow(r, 2);
Console.WriteLine(ans);
}*/
// ABC145B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
bool flag = false;
List<string> cAns = new List<string>();
List<string> cAns2 = new List<string>();
if (S.Length % 2 == 1)
{
Console.WriteLine("No");
}
else
{
for (int i = 0; i < S.Length / 2; i++)
{
cAns.Add(S[i].ToString());
cAns2.Add(S[i + (S.Length / 2)].ToString());
}
for (int i = 0; i < S.Length / 2; i++)
{
if (cAns[i] != cAns2[i])
{
flag = true;
}
}
if (flag)
{
Console.WriteLine("No");
}
else
{
Console.WriteLine("Yes");
}
}
}*/
// 147A
/*static void Main()
{
int ans = 0;
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
for (int i =0;i < input.Length;i++)
{
ans += input[i];
}
if (ans >= 22)
{
Console.WriteLine("bust");
}
else
{
Console.WriteLine("win");
}
}*/
// 147B
/*static void Main()
{
string S = Console.ReadLine();
List<string> A = new List<string>();
List<string> B = new List<string>();
List<string> C = new List<string>();
if (S.Length % 2 == 0)
{
for (int i = 0; i < S.Length / 2; i++)
{
A.Add(S[i].ToString());
B.Add(S[i + (S.Length / 2)].ToString());
}
for (int i = B.Count - 1; i >= 0; i--)
{
C.Add(B[i]);
}
int hug = 0;
for (int i = 0; i < S.Length / 2; i++)
{
//Console.WriteLine(A[i] + " + "+ C[i]);
if (A[i] == C[i])
{
hug++;
}
}
Console.WriteLine(S.Length / 2 - hug);
}
else
{
for (int i = 0; i < S.Length / 2; i++)
{
A.Add(S[i].ToString());
B.Add(S[i + (S.Length / 2) + 1].ToString());
}
for (int i = B.Count - 1; i >= 0; i--)
{
C.Add(B[i]);
}
int hug = 0;
for (int i = 0; i < S.Length / 2; i++)
{
//Console.WriteLine(A[i] + " + "+ C[i]);
if (A[i] == C[i])
{
hug++;
}
}
Console.WriteLine(S.Length / 2 - hug);
}
}*/
// 147C
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
long[] A = Console.ReadLine().Split().Select(long.Parse).ToArray();
long Answer = 0;
for (int i = 0; i < N-1;i++)
{
for (int j = i+1;j < N;j++)
{
Answer += xor(A[i] , A[j] );
}
}
Answer = Answer % 1000000007;
Console.WriteLine(Answer);
}
static long xor(long a, long b)
{
string A = Convert.ToString(a, 2);
string B = Convert.ToString(b, 2);
if (A.Length > B.Length)
{
B = B.PadLeft(A.Length, '0');
}
else if (B.Length > A.Length)
{
//var cnt2 = B.Length - A.Length;
A = A.PadLeft(B.Length, '0');
//Console.WriteLine(A.PadLeft(B.Length,'0'));
}
string an = "";
for (int i = 0;i < A.Length;i++)
{
if (A[i] == B[i])
{
an += 0.ToString();
}
else
{
an += 1.ToString();
}
}
long C = Convert.ToInt64(an, 2);
return C;
}*/
// 147C
/*static void Main()
{
int n = 3;
for (int bit = 0;bit < (1<<n);++bit)
{
List<int> S;
for (int i = 0;i < n;++i)
{
if ((bit & (1<<i)) > 0)
{
}
}
}
}*/
// 149A
/*static void Main()
{
string[] str = Console.ReadLine().Split();
string ans = str[1] + str[0];
Console.WriteLine(ans);
}*/
// 149B
/*static void Main()
{
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
long takahashi = input[0];
long aoki = input[1];
long K = input[2];
if (takahashi - K > 0)
{
Console.WriteLine(takahashi - K + " " + aoki);
}
else
{
if (aoki - (Math.Abs(takahashi - K)) > 0)
{
Console.WriteLine(0 + " " + (aoki - (Math.Abs(takahashi - K))));
}
else
{
Console.WriteLine(0 + " " +0);
}
}
}*/
// 149C
/*static void Main()
{
int isprime = int.Parse(Console.ReadLine());
bool ans = false;
while (true)
{
if (Isprime(isprime))
{
ans = true;
}
if (ans)
{
break;
}
isprime++;
}
Console.WriteLine(isprime);
}
static bool Isprime(int num)
{
if (num < 2)
{
return false;
}
else if (num == 2)
{
return true;
}
else if (num %2 == 0)
{
return false;
}
double sqrtnum = Math.Sqrt(num);
for (int i = 3;i <= sqrtnum;i +=2)
{
if ( num % i == 0)
{
return false;
}
}
return true;
}*/
// 148A
/*static void Main()
{
int A = int.Parse(Console.ReadLine());
int B = int.Parse(Console.ReadLine());
Console.WriteLine(6 - A - B);
}*/
// 148B
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
string[] input = Console.ReadLine().Split();
string S = input[0];
string T = input[1];
char[] ans = new char[N * 2];
ans[0] = S[0];
for (int i = 0;i < N*2;i++)
{
}
}*/
//ドワンゴからの挑戦状
/*static void Main()
{
int N = int.Parse(Console.ReadLine());
List<Data> datalist = new List<Data>();
for (int i = 0;i < N;i++)
{
var temp = Console.ReadLine().Split();
Data data = new Data();
data.str = temp[0];
data.integer = int.Parse(temp[1]);
datalist.Add(data);
}
string keyword = Console.ReadLine();
}
}
class Data
{
public string str { get; set; }
public int integer { get; set; }
}*/
// 152A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
if (N == M)
{
Console.WriteLine("Yes");
}
else
{
Console.WriteLine("No");
}
}*/
// 152B
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int a = input[0];
int b = input[1];
string Ansa = "";
string Ansb = "";
for (int i = 0; i < b;i++)
{
Ansa += a;
}
for (int i = 0;i < a;i++)
{
Ansb += b;
}
if (Ansa.CompareTo(Ansb) == -1)
{
Console.WriteLine(Ansa);
}
else if (Ansa.CompareTo(Ansb) == 0)
{
Console.WriteLine(Ansa);
}
else
{
Console.WriteLine(Ansb);
}
}*/
// 152C
/*static void Main()
{
long N = long.Parse(Console.ReadLine());
long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
List<long> temp = new List<long>();
long ans = 0;
for (int i = 0;i < N;i++)
{
temp.Add(input[i]);
}
Console.WriteLine(ans);
}*/
/*static public void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
var w = input[0];
var h = input[1];
var bmi = input[2];
double Answer = 0;
double temp = 10000 * w / h / h;
if (temp > bmi)
{
double hh = (bmi * h * h) / 10000;
Answer = Math.Ceiling(hh);
Console.WriteLine(w - Answer);
}
else
{
Console.WriteLine(Answer);
}
}*/
// 159A
/*static void Main()
{
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
var N = input[0];
var M = input[1];
long Ans = kaijo(N) + kaijo(M);
Console.WriteLine(Ans);
}
static long kaijo(int num) {
long ans = 1;
for (int i = num;i > num-2;i--)
{
ans *= i;
}
long Answer = 0;
Answer = ans / 2;
return Answer;
}*/
// 159B
/*static void Main()
{
string input = Console.ReadLine();
string A = "";
string B = "";
for (int i = 0; i < ( input.Length - 1 ) / 2; i++)
{
A += input[i];
}
for (int i = (input.Length + 3) / 2 -1; i < input.Length; i++)
{
B += input[i];
}
if (A.Equals(B))
{
Console.WriteLine("Yes");
}
else
{
Console.WriteLine("No");
}
}*/
// 159C
static void Main() {
double L = double.Parse(Console.ReadLine());
double ans = L / 3;
double Ans = ans * ans * ans;
Console.WriteLine(Ans);
// in430 out2944703.703703703824
}
}
/*class Data
{
public int a { get; set; }
public int b { get; set; }
}*/
}
// 125C難しい
/*namespace CSharp
{
class Program
{
static IEnumerable<long> EnumerateDivisors(long n)
{
for (long i = 1; i * i <= n; i++)
{
if (n % i == 0)
{
yield return i;
if (n / i != i)
{
yield return n / i;
}
}
}
}
static void Main(string[] args)
{
ReadString();
long[] A = ReadLongArray();
long[] divisors = Enumerable.Concat(EnumerateDivisors(A[0]),
EnumerateDivisors(A[1])) .Distinct().ToArray(); long ans = divisors.Select(x =>
new { Value = x, Count = A.Count(v => v % x == 0) }) .Where(x => x.Count >=
A.Length - 1) .OrderByDescending(x => x.Value) .First().Value;
Console.WriteLine(ans);
}
#region Helpers
static int[] ReadIntArray() => Console.ReadLine().Split().Select(s =>
int.Parse(s)).ToArray(); static long[] ReadLongArray() =>
Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();
static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0,
count).Select(_ => int.Parse(Console.ReadLine())).ToArray(); static long[]
ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ =>
long.Parse(Console.ReadLine())).ToArray();
static string ReadString() => Console.ReadLine();
static int ReadInt() => int.Parse(Console.ReadLine());
static long ReadLong() => long.Parse(Console.ReadLine());
static void ReadInt(out int first)
{
var array = ReadIntArray();
first = array[0];
}
static void ReadInt(out int first, out int second)
{
var array = ReadIntArray();
first = array[0];
second = array[1];
}
static void ReadInt(out int first, out int second, out int third)
{
var array = ReadIntArray();
first = array[0];
second = array[1];
third = array[2];
}
static void ReadInt(out int first, out int second, out int third, out
int fourth)
{
var array = ReadIntArray();
first = array[0];
second = array[1];
third = array[2];
fourth = array[3];
}
static void ReadLong(out long first)
{
var array = ReadLongArray();
first = array[0];
}
static void ReadLong(out long first, out long second)
{
var array = ReadLongArray();
first = array[0];
second = array[1];
}
static void ReadLong(out long first, out long second, out long third)
{
var array = ReadLongArray();
first = array[0];
second = array[1];
third = array[2];
}
static void ReadLong(out long first, out long second, out long third,
out long fourth)
{
var array = ReadLongArray();
first = array[0];
second = array[1];
third = array[2];
fourth = array[3];
}
#endregion
}
}*/
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
| 8
| 330
| 4
|
using System;
using System.Collections.Generic;
namespace atcoder {
class Program {
static void Main(string[] args) {
string s = Console.ReadLine();
int L = int.Parse(s);
int n = L / 3;
int total = n * n * n;
Console.WriteLine(total);
}
}
}
|
using System;
using System.Collections.Generic;
namespace atcoder {
class Program {
static void Main(string[] args) {
string s = Console.ReadLine();
double L = double.Parse(s);
double n = L / 3;
double total = n * n * n;
Console.WriteLine(total);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
| 8
| 71
| 8
|
using System;
class abc {
static void Main() {
int L = int.Parse(Console.ReadLine());
int L3 = L * L * L;
double ou = L3 / 27;
Console.WriteLine(ou);
}
}
|
using System;
class abc {
static void Main() {
double L = double.Parse(Console.ReadLine());
double L3 = L * L * L;
double ou = L3 / 27;
Console.WriteLine(ou);
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
| 8
| 51
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 競プロCS {
class ABC159C {
static void Main() {
int i = int.Parse(Console.ReadLine());
double d = i / 3;
Console.WriteLine(d * d * d);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 競プロCS {
class ABC159C {
static void Main() {
double i = int.Parse(Console.ReadLine());
double d = i / 3;
Console.WriteLine(d * d * d);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 68
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace abc159_c {
class Program {
static void Main(string[] args) {
var L = CIn.ReadInt();
var i = L / 3;
var ans = Math.Pow(i, 3);
Console.WriteLine(ans);
}
}
}
class CIn {
private static readonly Queue<string> fieldBuffer = new Queue<string>();
public static string Read() {
if (fieldBuffer.Count == 0) {
foreach (var field in Console.ReadLine().Split()) {
fieldBuffer.Enqueue(field);
}
}
return fieldBuffer.Dequeue();
}
public static int ReadInt() => int.Parse(Read());
public static long ReadLong() => long.Parse(Read());
public static double ReadDouble() => double.Parse(Read());
public static string[] ReadStringArray(long n) {
var array = new string[n];
for (var i = 0; i < n; i++) {
array[i] = Read();
}
return array;
}
public static int[] ReadIntArray(long n) {
var array = new int[n];
for (var i = 0; i < n; i++) {
array[i] = ReadInt();
}
return array;
}
public static long[] ReadLongArray(long n) {
var array = new long[n];
for (var i = 0; i < n; i++) {
array[i] = ReadLong();
}
return array;
}
public static double[] ReadDoubleArray(long n) {
var array = new double[n];
for (var i = 0; i < n; i++) {
array[i] = ReadDouble();
}
return array;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace abc159_c {
class Program {
static void Main(string[] args) {
var L = CIn.ReadInt();
var i = (double)L / 3;
var ans = Math.Pow(i, 3);
Console.WriteLine(ans);
}
}
}
class CIn {
private static readonly Queue<string> fieldBuffer = new Queue<string>();
public static string Read() {
if (fieldBuffer.Count == 0) {
foreach (var field in Console.ReadLine().Split()) {
fieldBuffer.Enqueue(field);
}
}
return fieldBuffer.Dequeue();
}
public static int ReadInt() => int.Parse(Read());
public static long ReadLong() => long.Parse(Read());
public static double ReadDouble() => double.Parse(Read());
public static string[] ReadStringArray(long n) {
var array = new string[n];
for (var i = 0; i < n; i++) {
array[i] = Read();
}
return array;
}
public static int[] ReadIntArray(long n) {
var array = new int[n];
for (var i = 0; i < n; i++) {
array[i] = ReadInt();
}
return array;
}
public static long[] ReadLongArray(long n) {
var array = new long[n];
for (var i = 0; i < n; i++) {
array[i] = ReadLong();
}
return array;
}
public static double[] ReadDoubleArray(long n) {
var array = new double[n];
for (var i = 0; i < n; i++) {
array[i] = ReadDouble();
}
return array;
}
}
|
[["+", 0, 200, 0, 212, 0, 16, 31, 74, 0, 24], ["+", 0, 200, 0, 212, 0, 16, 31, 74, 39, 199], ["+", 0, 200, 0, 212, 0, 16, 31, 74, 0, 25]]
| 8
| 395
| 3
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace lean {
class Program {
static void Main() {
// long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
int L = int.Parse(Console.ReadLine());
int n = L / 3;
Console.WriteLine(n * n * n);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace lean {
class Program {
static void Main() {
// long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
double L = int.Parse(Console.ReadLine());
double n = L / 3;
Console.WriteLine(n * n * n);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 75
| 4
|
using System;
using System.Linq;
class Ho {
static void Main() {
var L = int.Parse(Console.ReadLine());
double S = L / 3;
Console.WriteLine(S * S * S);
}
}
|
using System;
using System.Linq;
class Ho {
static void Main() {
var L = double.Parse(Console.ReadLine());
double S = L / 3;
Console.WriteLine(S * S * S);
}
}
|
[["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
| 8
| 51
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace C___Maximum_Volume {
class Program {
static void Main(string[] args) {
var L = int.Parse(Console.ReadLine());
Console.WriteLine(Math.Pow(L / 3, 3));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace C___Maximum_Volume {
class Program {
static void Main(string[] args) {
var L = int.Parse(Console.ReadLine());
Console.WriteLine(Math.Pow((double)L / 3, 3));
}
}
}
|
[["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 25]]
| 8
| 76
| 3
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace A {
class Program {
public static void Main(string[] args) {
var l = ReadLineInt();
double r = l / 3;
Console.WriteLine(r * r * r);
ReadLine();
}
/// <summary>
/// stringを一文字ずつintにキャストして配列に変換します。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static int[] StringCharArrayIntArray(string str) {
List<int> b = new List<int>();
for (int i = 0; i < str.Length; i++) {
b.Add(int.Parse(str[i].ToString()));
}
return b.ToArray();
}
public static string ReadLine() { return Console.ReadLine(); }
public static int ReadLineInt() { return int.Parse(Console.ReadLine()); }
public static string[] ReadLineStringSplit(char a = ' ') {
return ReadLine().Split(a).ToArray();
}
public static int[] ReadLineIntSpilit(char a = ' ') {
return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace A {
class Program {
public static void Main(string[] args) {
var l = ReadLineInt();
double r = (l * 1.0) / 3;
Console.WriteLine(r * r * r);
ReadLine();
}
/// <summary>
/// stringを一文字ずつintにキャストして配列に変換します。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static int[] StringCharArrayIntArray(string str) {
List<int> b = new List<int>();
for (int i = 0; i < str.Length; i++) {
b.Add(int.Parse(str[i].ToString()));
}
return b.ToArray();
}
public static string ReadLine() { return Console.ReadLine(); }
public static int ReadLineInt() { return int.Parse(Console.ReadLine()); }
public static string[] ReadLineStringSplit(char a = ' ') {
return ReadLine().Split(a).ToArray();
}
public static int[] ReadLineIntSpilit(char a = ' ') {
return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
}
}
}
|
[["+", 0, 200, 0, 212, 0, 16, 31, 23, 0, 24], ["+", 0, 212, 0, 16, 31, 23, 0, 16, 17, 48], ["+", 0, 212, 0, 16, 31, 23, 0, 16, 12, 250], ["+", 0, 200, 0, 212, 0, 16, 31, 23, 0, 25]]
| 8
| 258
| 4
|
using System;
public class Hello {
public static void Main() {
string s = Console.ReadLine();
int L = int.Parse(s);
double x, y, z, C, V;
C = L / 3;
V = C * C * C;
Console.Write(V);
}
}
|
using System;
public class Hello {
public static void Main() {
string s = Console.ReadLine();
int L = int.Parse(s);
double x, y, z, C, V;
C = L / (3.000000000);
V = C * C * C;
Console.Write(V);
}
}
|
[["-", 8, 196, 0, 1, 0, 11, 12, 16, 12, 203], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 250], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
| 8
| 67
| 4
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
using System.Linq;
using E = System.Linq.Enumerable;
internal partial class Solver {
public void Run() {
var l = ni();
double ans = 1.0 * Math.Pow(l / 3, 3.0);
cout.WriteLine(ans);
}
}
// PREWRITEN CODE BEGINS FROM HERE
internal partial class Solver : Scanner {
public static void Main(string[] args) {
#if LOCAL
byte[] inputBuffer = new byte[1000000];
var inputStream = Console.OpenStandardInput(inputBuffer.Length);
using (var reader = new StreamReader(inputStream, Console.InputEncoding,
false, inputBuffer.Length)) {
Console.SetIn(reader);
new Solver(Console.In, Console.Out).Run();
}
#else
Console.SetOut(
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
new Solver(Console.In, Console.Out).Run();
Console.Out.Flush();
#endif
}
#pragma warning disable IDE0052
private readonly TextReader cin;
private readonly TextWriter cout;
#pragma warning restore IDE0052
public Solver(TextReader reader, TextWriter writer) : base(reader) {
cin = reader;
cout = writer;
}
public Solver(string input, TextWriter writer)
: this(new StringReader(input), writer) {}
#pragma warning disable IDE1006
#pragma warning disable IDE0051
private int ni() { return NextInt(); }
private int[] ni(int n) { return NextIntArray(n); }
private long nl() { return NextLong(); }
private long[] nl(int n) { return NextLongArray(n); }
private double nd() { return NextDouble(); }
private double[] nd(int n) { return NextDoubleArray(n); }
private string ns() { return Next(); }
private string[] ns(int n) { return NextArray(n); }
#pragma warning restore IDE1006
#pragma warning restore IDE0051
}
internal static class LinqPadExtension {
[Conditional("DEBUG")]
public static void Dump<T>(this T obj) {
#if DEBUG
LINQPad.Extensions.Dump(obj);
#endif
}
}
public class Scanner {
private readonly TextReader Reader;
private readonly CultureInfo ci = CultureInfo.InvariantCulture;
private readonly char[] buffer = new char[2 * 1024];
private int cursor = 0, length = 0;
private string Token;
private readonly StringBuilder sb = new StringBuilder(1024);
public Scanner() : this(Console.In) {}
public Scanner(TextReader reader) { Reader = reader; }
public int NextInt() { return checked((int)NextLong()); }
public long NextLong() {
var s = Next();
long r = 0;
int i = 0;
bool negative = false;
if (s[i] == '-') {
negative = true;
i++;
}
for (; i < s.Length; i++) {
r = r * 10 + (s[i] - '0');
#if DEBUG
if (!char.IsDigit(s[i]))
throw new FormatException();
#endif
}
return negative ? -r : r;
}
public double NextDouble() { return double.Parse(Next(), ci); }
public string[] NextArray(int size) {
string[] array = new string[size];
for (int i = 0; i < size; i++) {
array[i] = Next();
}
return array;
}
public int[] NextIntArray(int size) {
int[] array = new int[size];
for (int i = 0; i < size; i++) {
array[i] = NextInt();
}
return array;
}
public long[] NextLongArray(int size) {
long[] array = new long[size];
for (int i = 0; i < size; i++) {
array[i] = NextLong();
}
return array;
}
public double[] NextDoubleArray(int size) {
double[] array = new double[size];
for (int i = 0; i < size; i++) {
array[i] = NextDouble();
}
return array;
}
public string Next() {
if (Token == null) {
if (!StockToken()) {
throw new InvalidOperationException();
}
}
var token = Token;
Token = null;
return token;
}
public bool HasNext() {
if (Token != null) {
return true;
}
return StockToken();
}
private bool StockToken() {
while (true) {
sb.Clear();
while (true) {
if (cursor >= length) {
cursor = 0;
if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {
break;
}
}
var c = buffer[cursor++];
if (33 <= c && c <= 126) {
sb.Append(c);
} else {
if (sb.Length > 0)
break;
}
}
if (sb.Length > 0) {
Token = sb.ToString();
return true;
}
return false;
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
using System.Linq;
using E = System.Linq.Enumerable;
internal partial class Solver {
public void Run() {
var l = ni();
double ans = 1.0 * Math.Pow(l / 3.0, 3.0);
cout.WriteLine(ans);
}
}
// PREWRITEN CODE BEGINS FROM HERE
internal partial class Solver : Scanner {
public static void Main(string[] args) {
#if LOCAL
byte[] inputBuffer = new byte[1000000];
var inputStream = Console.OpenStandardInput(inputBuffer.Length);
using (var reader = new StreamReader(inputStream, Console.InputEncoding,
false, inputBuffer.Length)) {
Console.SetIn(reader);
new Solver(Console.In, Console.Out).Run();
}
#else
Console.SetOut(
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
new Solver(Console.In, Console.Out).Run();
Console.Out.Flush();
#endif
}
#pragma warning disable IDE0052
private readonly TextReader cin;
private readonly TextWriter cout;
#pragma warning restore IDE0052
public Solver(TextReader reader, TextWriter writer) : base(reader) {
cin = reader;
cout = writer;
}
public Solver(string input, TextWriter writer)
: this(new StringReader(input), writer) {}
#pragma warning disable IDE1006
#pragma warning disable IDE0051
private int ni() { return NextInt(); }
private int[] ni(int n) { return NextIntArray(n); }
private long nl() { return NextLong(); }
private long[] nl(int n) { return NextLongArray(n); }
private double nd() { return NextDouble(); }
private double[] nd(int n) { return NextDoubleArray(n); }
private string ns() { return Next(); }
private string[] ns(int n) { return NextArray(n); }
#pragma warning restore IDE1006
#pragma warning restore IDE0051
}
internal static class LinqPadExtension {
[Conditional("DEBUG")]
public static void Dump<T>(this T obj) {
#if DEBUG
LINQPad.Extensions.Dump(obj);
#endif
}
}
public class Scanner {
private readonly TextReader Reader;
private readonly CultureInfo ci = CultureInfo.InvariantCulture;
private readonly char[] buffer = new char[2 * 1024];
private int cursor = 0, length = 0;
private string Token;
private readonly StringBuilder sb = new StringBuilder(1024);
public Scanner() : this(Console.In) {}
public Scanner(TextReader reader) { Reader = reader; }
public int NextInt() { return checked((int)NextLong()); }
public long NextLong() {
var s = Next();
long r = 0;
int i = 0;
bool negative = false;
if (s[i] == '-') {
negative = true;
i++;
}
for (; i < s.Length; i++) {
r = r * 10 + (s[i] - '0');
#if DEBUG
if (!char.IsDigit(s[i]))
throw new FormatException();
#endif
}
return negative ? -r : r;
}
public double NextDouble() { return double.Parse(Next(), ci); }
public string[] NextArray(int size) {
string[] array = new string[size];
for (int i = 0; i < size; i++) {
array[i] = Next();
}
return array;
}
public int[] NextIntArray(int size) {
int[] array = new int[size];
for (int i = 0; i < size; i++) {
array[i] = NextInt();
}
return array;
}
public long[] NextLongArray(int size) {
long[] array = new long[size];
for (int i = 0; i < size; i++) {
array[i] = NextLong();
}
return array;
}
public double[] NextDoubleArray(int size) {
double[] array = new double[size];
for (int i = 0; i < size; i++) {
array[i] = NextDouble();
}
return array;
}
public string Next() {
if (Token == null) {
if (!StockToken()) {
throw new InvalidOperationException();
}
}
var token = Token;
Token = null;
return token;
}
public bool HasNext() {
if (Token != null) {
return true;
}
return StockToken();
}
private bool StockToken() {
while (true) {
sb.Clear();
while (true) {
if (cursor >= length) {
cursor = 0;
if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {
break;
}
}
var c = buffer[cursor++];
if (33 <= c && c <= 126) {
sb.Append(c);
} else {
if (sb.Length > 0)
break;
}
}
if (sb.Length > 0) {
Token = sb.ToString();
return true;
}
return false;
}
}
}
|
[["-", 12, 213, 3, 4, 0, 28, 0, 16, 12, 203], ["+", 12, 213, 3, 4, 0, 28, 0, 16, 12, 250]]
| 8
| 1,102
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;
class program {
static public int mod = 1000000007;
static void Main() {
var n = rint();
var a = inta();
var table = new int[n];
for (int i = 0; i < n; i++)
table[a[i]]++;
long ans = 0;
for (int i = 0; i < n; i++)
ans += (table[i] * (table[i] - 1)) / 2;
for (int i = 0; i < n; i++) {
long w = ans;
if (table[a[i]] > 0) {
w -= table[a[i]] - 1;
}
WriteLine(w);
}
}
static int pow(int a, int b) {
string binary = Convert.ToString(b, 2);
int bileng = binary.Length;
long a_power = a;
long value = 1;
for (int i = bileng - 1; i >= 0; i--) {
if (binary[i] == '1') {
value = value * a_power % mod;
}
a_power = a_power * a_power % mod;
}
return (int)value;
}
static string rstr() { return ReadLine(); }
static int rint() { return int.Parse(ReadLine()); }
static long rlong() { return long.Parse(ReadLine()); }
static string[] stra() { return ReadLine().Split(' '); }
static char[] chara() {
string[] a = stra();
string b = "";
for (int i = 0; i < a.Length; i++) {
b += a[i];
}
return b.ToCharArray();
}
static int[] inta() {
string[] read_str_array = ReadLine().Split(' ');
int[] return_int_array = new int[read_str_array.Length];
for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
}
return return_int_array;
}
static long[] longa() {
string[] read_str_array = ReadLine().Split(' ');
long[] return_long_array = new long[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_long_array[countup_i] = long.Parse(read_str_array[countup_i]);
}
return return_long_array;
}
static double[] doublea() {
string[] read_str_array = ReadLine().Split(' ');
double[] return_double_array = new double[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_double_array[countup_i] = double.Parse(read_str_array[countup_i]);
}
return return_double_array;
}
static long GCD(long a, long b) {
if (a < b) {
long temp = a;
a = b;
b = temp;
}
if (a % b == 0) {
return b;
} else {
long temp = b;
b = a % b;
a = temp;
return GCD(a, b);
}
}
static long LCM(long a, long b) { return a * b / GCD(a, b); }
static void WriteArray2(int[,] a, int b, int c) {
for (int i = 0; i < b; i++) {
for (int j = 0; j < c; j++) {
if (j != 0)
Write(" ");
Write(a[i, j]);
}
WriteLine();
}
}
static void WriteArray(int[] a, int b) {
for (int i = 0; i < b; i++) {
Write(" ");
Write(a[i]);
}
WriteLine();
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;
class program {
static public int mod = 1000000007;
static void Main() {
var n = rint();
var a = inta();
var table = new int[n + 1];
for (int i = 0; i < n; i++)
table[a[i]]++;
long ans = 0;
for (int i = 0; i <= n; i++)
ans += ((long)table[i] * (table[i] - 1)) / 2;
for (int i = 0; i < n; i++) {
long w = ans;
if (table[a[i]] > 0) {
w -= table[a[i]] - 1;
}
WriteLine(w);
}
}
static int pow(int a, int b) {
string binary = Convert.ToString(b, 2);
int bileng = binary.Length;
long a_power = a;
long value = 1;
for (int i = bileng - 1; i >= 0; i--) {
if (binary[i] == '1') {
value = value * a_power % mod;
}
a_power = a_power * a_power % mod;
}
return (int)value;
}
static string rstr() { return ReadLine(); }
static int rint() { return int.Parse(ReadLine()); }
static long rlong() { return long.Parse(ReadLine()); }
static string[] stra() { return ReadLine().Split(' '); }
static char[] chara() {
string[] a = stra();
string b = "";
for (int i = 0; i < a.Length; i++) {
b += a[i];
}
return b.ToCharArray();
}
static int[] inta() {
string[] read_str_array = ReadLine().Split(' ');
int[] return_int_array = new int[read_str_array.Length];
for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
}
return return_int_array;
}
static long[] longa() {
string[] read_str_array = ReadLine().Split(' ');
long[] return_long_array = new long[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_long_array[countup_i] = long.Parse(read_str_array[countup_i]);
}
return return_long_array;
}
static double[] doublea() {
string[] read_str_array = ReadLine().Split(' ');
double[] return_double_array = new double[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_double_array[countup_i] = double.Parse(read_str_array[countup_i]);
}
return return_double_array;
}
static long GCD(long a, long b) {
if (a < b) {
long temp = a;
a = b;
b = temp;
}
if (a % b == 0) {
return b;
} else {
long temp = b;
b = a % b;
a = temp;
return GCD(a, b);
}
}
static long LCM(long a, long b) { return a * b / GCD(a, b); }
static void WriteArray2(int[,] a, int b, int c) {
for (int i = 0; i < b; i++) {
for (int j = 0; j < c; j++) {
if (j != 0)
Write(" ");
Write(a[i, j]);
}
WriteLine();
}
}
static void WriteArray(int[] a, int b) {
for (int i = 0; i < b; i++) {
Write(" ");
Write(a[i]);
}
WriteLine();
}
}
|
[["+", 0, 227, 39, 224, 225, 226, 0, 16, 17, 72], ["+", 0, 227, 39, 224, 225, 226, 0, 16, 12, 203], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19], ["+", 12, 16, 31, 23, 0, 16, 31, 74, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 31, 74, 39, 199], ["+", 12, 16, 31, 23, 0, 16, 31, 74, 0, 25]]
| 8
| 853
| 7
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;
using System.Numerics;
namespace atcorder2 {
class Program {
public static long Read() { return long.Parse(Console.ReadLine()); }
public static long[] Reads() {
return Console.ReadLine().Split().Select(long.Parse).ToArray();
}
public static long gcd(long x, long y) {
if (y < x)
gcd(y, x);
while (y != 0) {
var z = x % y;
x = y;
y = z;
}
return x;
}
public static long keta(long x) {
var z = 1;
while (x > 0) {
x /= 10;
z++;
}
return z;
}
static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
var n = Read();
var a = Reads();
var c = new long[n];
long ans = 0;
for (int i = 0; i < n; i++) {
c[a[i] - 1]++;
}
for (int i = 0; i < n; i++) {
ans += c[i] * (c[i] - 1) / 2;
}
for (int i = 0; i < n; i++) {
if (c[a[i] - 1] >= 2)
WriteLine(ans - c[a[i] - 1] + 1);
else
WriteLine(0);
}
Console.Out.Flush();
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;
using System.Numerics;
namespace atcorder2 {
class Program {
public static long Read() { return long.Parse(Console.ReadLine()); }
public static long[] Reads() {
return Console.ReadLine().Split().Select(long.Parse).ToArray();
}
public static long gcd(long x, long y) {
if (y < x)
gcd(y, x);
while (y != 0) {
var z = x % y;
x = y;
y = z;
}
return x;
}
public static long keta(long x) {
var z = 1;
while (x > 0) {
x /= 10;
z++;
}
return z;
}
static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
var n = Read();
var a = Reads();
var c = new long[n];
long ans = 0;
for (int i = 0; i < n; i++) {
c[a[i] - 1]++;
}
for (int i = 0; i < n; i++) {
ans += c[i] * (c[i] - 1) / 2;
}
for (int i = 0; i < n; i++) {
if (c[a[i] - 1] >= 2)
WriteLine(ans - c[a[i] - 1] + 1);
else
WriteLine(ans);
}
Console.Out.Flush();
}
}
}
|
[["-", 75, 1, 0, 213, 3, 4, 0, 28, 0, 203], ["+", 75, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
| 8
| 362
| 2
|
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;
using System.Text;
namespace ABC159D_2 {
class Program {
static void Main(string[] args) {
var N = RInt;
var A = RInts;
int[] count = new int[N + 1];
for (int i = 0; i < N; i++) {
count[A[i]]++;
}
long allComb = 0;
for (int i = 0; i < N; i++) {
if (count[i] <= 1)
continue;
allComb += (long)count[i] * (count[i] - 1) / 2;
}
Draw1D(count);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < N; i++) {
int c = count[A[i]];
if (c <= 1) {
sb.AppendLine(allComb.ToString());
continue;
}
long cand = allComb - (long)c * (c - 1) / 2 + (long)(c - 1) * (c - 2) / 2;
sb.AppendLine(cand.ToString());
}
Console.Write(sb);
}
}
}
namespace Assistant {
static class Input {
static List<string> line = new List<string>();
static int index = 0;
static String RNext() {
if (line.Count <= index)
line.AddRange(Console.ReadLine().Split());
return line[index++];
}
public static int RInt => int.Parse(RNext());
public static long RLong => long.Parse(RNext());
public static int[] RInts =>
Console.ReadLine().Split().Select(int.Parse).ToArray();
public static long[] RLongs =>
Console.ReadLine().Split().Select(long.Parse).ToArray();
public static string RString => RNext();
//以下未テスト
public static int[] RIntsC(int c) =>
Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
public static long[] RLongsC(int c) =>
Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
public static char[][] RMap(int h) =>
Enumerable.Repeat(0, h)
.Select(x => Console.ReadLine().ToCharArray())
.ToArray();
}
static class Debug {
static public void Draw2D<T>(T[,] map, int mode = 1) {
#if DEBUG
int W = map.GetLength(0);
int H = map.GetLength(1);
string[,] map2 = new string[W + 1, H + 1];
for (int i = 0; i < W + 1; i++) {
for (int j = 0; j < H + 1; j++) {
if (i == 0 && j == 0)
map2[i, j] = 0.ToString();
else if (i == 0)
map2[i, j] = (j - 1).ToString();
else if (j == 0)
map2[i, j] = (i - 1).ToString();
else
map2[i, j] = map[i - 1, j - 1].ToString();
}
}
for (int i = 0; i < W + 1; i++) {
for (int j = 0; j < H + 1; j++) {
if (mode == 0)
Console.Write(map2[i, j].Last());
if (mode == 1)
Console.Write(map2[i, j] + " ");
}
Console.WriteLine();
}
Console.WriteLine();
#endif
}
public static void Draw1D<T>(T[] array, int mode = 0) {
#if DEBUG
Console.WriteLine(string.Join(" ", array));
#endif
}
}
}
|
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;
using System.Text;
namespace ABC159D_2 {
class Program {
static void Main(string[] args) {
var N = RInt;
var A = RInts;
int[] count = new int[N + 1];
for (int i = 0; i < N; i++) {
count[A[i]]++;
}
long allComb = 0;
for (int i = 0; i < N + 1; i++) {
if (count[i] <= 1)
continue;
allComb += (long)count[i] * (count[i] - 1) / 2;
}
Draw1D(count);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < N; i++) {
int c = count[A[i]];
if (c <= 1) {
sb.AppendLine(allComb.ToString());
continue;
}
long cand = allComb - (long)c * (c - 1) / 2 + (long)(c - 1) * (c - 2) / 2;
sb.AppendLine(cand.ToString());
}
Console.Write(sb);
}
}
}
namespace Assistant {
static class Input {
static List<string> line = new List<string>();
static int index = 0;
static String RNext() {
if (line.Count <= index)
line.AddRange(Console.ReadLine().Split());
return line[index++];
}
public static int RInt => int.Parse(RNext());
public static long RLong => long.Parse(RNext());
public static int[] RInts =>
Console.ReadLine().Split().Select(int.Parse).ToArray();
public static long[] RLongs =>
Console.ReadLine().Split().Select(long.Parse).ToArray();
public static string RString => RNext();
//以下未テスト
public static int[] RIntsC(int c) =>
Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
public static long[] RLongsC(int c) =>
Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
public static char[][] RMap(int h) =>
Enumerable.Repeat(0, h)
.Select(x => Console.ReadLine().ToCharArray())
.ToArray();
}
static class Debug {
static public void Draw2D<T>(T[,] map, int mode = 1) {
#if DEBUG
int W = map.GetLength(0);
int H = map.GetLength(1);
string[,] map2 = new string[W + 1, H + 1];
for (int i = 0; i < W + 1; i++) {
for (int j = 0; j < H + 1; j++) {
if (i == 0 && j == 0)
map2[i, j] = 0.ToString();
else if (i == 0)
map2[i, j] = (j - 1).ToString();
else if (j == 0)
map2[i, j] = (i - 1).ToString();
else
map2[i, j] = map[i - 1, j - 1].ToString();
}
}
for (int i = 0; i < W + 1; i++) {
for (int j = 0; j < H + 1; j++) {
if (mode == 0)
Console.Write(map2[i, j].Last());
if (mode == 1)
Console.Write(map2[i, j] + " ");
}
Console.WriteLine();
}
Console.WriteLine();
#endif
}
public static void Draw1D<T>(T[] array, int mode = 0) {
#if DEBUG
Console.WriteLine(string.Join(" ", array));
#endif
}
}
}
|
[["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203]]
| 8
| 879
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace _159b {
class Program {
static void Main(string[] args) {
long N = long.Parse(Console.ReadLine());
long[] A = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
long[] resArray = new long[N];
long[] countArray = new long[N + 1];
long res = 0;
long comSum = 0;
for (int i = 0; i < N; i++) {
countArray[A[i]]++;
}
for (int i = 0; i < N; i++) {
comSum += countArray[i] * (countArray[i] - 1) / 2;
}
for (int i = 0; i < N; i++) {
res = comSum - (countArray[A[i]] - 1);
Console.WriteLine(res);
}
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace _159b {
class Program {
static void Main(string[] args) {
long N = long.Parse(Console.ReadLine());
long[] A = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
long[] resArray = new long[N];
long[] countArray = new long[N + 1];
long res = 0;
long comSum = 0;
for (int i = 0; i < N; i++) {
countArray[A[i]]++;
}
for (int i = 0; i <= N; i++) {
comSum += countArray[i] * (countArray[i] - 1) / 2;
}
for (int i = 0; i < N; i++) {
res = comSum - (countArray[A[i]] - 1);
Console.WriteLine(res);
}
}
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
| 8
| 204
| 2
|
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;
namespace ABC159E {
class Program {
static void Main(string[] args) {
var H = RInt;
var W = RInt;
var K = RInt;
string[] map = new string[H];
for (int i = 0; i < H; i++) {
map[i] = Console.ReadLine();
}
// Bit全探索
int ans = int.MaxValue;
var bit = BitSearch(H - 1);
foreach (var b in bit) {
int cand = b.Count(x => x == 1);
int[] count = new int[H];
for (int i = 0; i < W; i++) {
int index = 0;
int[] countH = new int[H];
for (int j = 0; j < H; j++) {
if (j > 0 && b[j - 1] == 1)
index++;
if (map[j][i] == '1') {
countH[index]++;
if (countH[index] > K) {
countH[0] = -1;
break;
}
count[index]++;
if (count[index] > K) {
count = new int[H];
i--;
cand++;
break;
}
}
}
if (countH[0] == -1)
break;
}
ans = Math.Min(cand, ans);
}
Console.WriteLine(ans);
}
/// <summary>
/// bit全探索 メソッドバージョン
/// </summary>
/// <param name="n"></param>
/// <returns>int[1<<n][]</returns>
public static int[][] BitSearch(int n) {
int[][] ret = new int [1 << n][];
for (int bit = 0; bit < (1 << n); ++bit) {
int[] S = new int[n];
for (int i = 0; i < n; i++) {
if ((bit & (1 << i)) != 0) {
S[i] = 1;
}
}
ret[bit] = S.ToArray();
}
return ret;
}
}
}
namespace Assistant {
static class Input {
static List<string> line = new List<string>();
static int index = 0;
static String RNext() {
if (line.Count <= index)
line.AddRange(Console.ReadLine().Split());
return line[index++];
}
public static int RInt => int.Parse(RNext());
public static long RLong => long.Parse(RNext());
public static int[] RInts =>
Console.ReadLine().Split().Select(int.Parse).ToArray();
public static long[] RLongs =>
Console.ReadLine().Split().Select(long.Parse).ToArray();
public static string RString => RNext();
//以下未テスト
public static int[] RIntsC(int c) =>
Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
public static long[] RLongsC(int c) =>
Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
public static char[][] RMap(int h) =>
Enumerable.Repeat(0, h)
.Select(x => Console.ReadLine().ToCharArray())
.ToArray();
}
static class Debug {
static public void Draw2D<T>(T[,] map, int mode = 1) {
#if DEBUG
int W = map.GetLength(0);
int H = map.GetLength(1);
string[,] map2 = new string[W + 1, H + 1];
for (int i = 0; i < W + 1; i++) {
for (int j = 0; j < H + 1; j++) {
if (i == 0 && j == 0)
map2[i, j] = 0.ToString();
else if (i == 0)
map2[i, j] = (j - 1).ToString();
else if (j == 0)
map2[i, j] = (i - 1).ToString();
else
map2[i, j] = map[i - 1, j - 1].ToString();
}
}
for (int i = 0; i < W + 1; i++) {
for (int j = 0; j < H + 1; j++) {
if (mode == 0)
Console.Write(map2[i, j].Last());
if (mode == 1)
Console.Write(map2[i, j] + " ");
}
Console.WriteLine();
}
Console.WriteLine();
#endif
}
public static void Draw1D<T>(T[] array, int mode = 0) {
#if DEBUG
Console.WriteLine(string.Join(" ", array));
#endif
}
}
}
|
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;
namespace ABC159E {
class Program {
static void Main(string[] args) {
var H = RInt;
var W = RInt;
var K = RInt;
string[] map = new string[H];
for (int i = 0; i < H; i++) {
map[i] = Console.ReadLine();
}
// Bit全探索
int ans = int.MaxValue;
var bit = BitSearch(H - 1);
foreach (var b in bit) {
int cand = b.Count(x => x == 1);
int[] count = new int[H];
for (int i = 0; i < W; i++) {
int index = 0;
int[] countH = new int[H];
for (int j = 0; j < H; j++) {
if (j > 0 && b[j - 1] == 1)
index++;
if (map[j][i] == '1') {
countH[index]++;
if (countH[index] > K) {
countH[0] = -1;
cand = int.MaxValue;
break;
}
count[index]++;
if (count[index] > K) {
count = new int[H];
i--;
cand++;
break;
}
}
}
if (countH[0] == -1)
break;
}
ans = Math.Min(cand, ans);
}
Console.WriteLine(ans);
}
/// <summary>
/// bit全探索 メソッドバージョン
/// </summary>
/// <param name="n"></param>
/// <returns>int[1<<n][]</returns>
public static int[][] BitSearch(int n) {
int[][] ret = new int [1 << n][];
for (int bit = 0; bit < (1 << n); ++bit) {
int[] S = new int[n];
for (int i = 0; i < n; i++) {
if ((bit & (1 << i)) != 0) {
S[i] = 1;
}
}
ret[bit] = S.ToArray();
}
return ret;
}
}
}
namespace Assistant {
static class Input {
static List<string> line = new List<string>();
static int index = 0;
static String RNext() {
if (line.Count <= index)
line.AddRange(Console.ReadLine().Split());
return line[index++];
}
public static int RInt => int.Parse(RNext());
public static long RLong => long.Parse(RNext());
public static int[] RInts =>
Console.ReadLine().Split().Select(int.Parse).ToArray();
public static long[] RLongs =>
Console.ReadLine().Split().Select(long.Parse).ToArray();
public static string RString => RNext();
//以下未テスト
public static int[] RIntsC(int c) =>
Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
public static long[] RLongsC(int c) =>
Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
public static char[][] RMap(int h) =>
Enumerable.Repeat(0, h)
.Select(x => Console.ReadLine().ToCharArray())
.ToArray();
}
static class Debug {
static public void Draw2D<T>(T[,] map, int mode = 1) {
#if DEBUG
int W = map.GetLength(0);
int H = map.GetLength(1);
string[,] map2 = new string[W + 1, H + 1];
for (int i = 0; i < W + 1; i++) {
for (int j = 0; j < H + 1; j++) {
if (i == 0 && j == 0)
map2[i, j] = 0.ToString();
else if (i == 0)
map2[i, j] = (j - 1).ToString();
else if (j == 0)
map2[i, j] = (i - 1).ToString();
else
map2[i, j] = map[i - 1, j - 1].ToString();
}
}
for (int i = 0; i < W + 1; i++) {
for (int j = 0; j < H + 1; j++) {
if (mode == 0)
Console.Write(map2[i, j].Last());
if (mode == 1)
Console.Write(map2[i, j] + " ");
}
Console.WriteLine();
}
Console.WriteLine();
#endif
}
public static void Draw1D<T>(T[] array, int mode = 0) {
#if DEBUG
Console.WriteLine(string.Join(" ", array));
#endif
}
}
}
|
[["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 64, 196, 0, 1, 0, 11, 12, 214, 205, 199], ["+", 64, 196, 0, 1, 0, 11, 12, 214, 0, 131], ["+", 64, 196, 0, 1, 0, 11, 12, 214, 141, 22], ["+", 64, 196, 0, 57, 64, 196, 0, 1, 0, 35]]
| 8
| 1,056
| 6
|
using System;
using System.Linq;
namespace atcoderTest {
public class Program {
public static void Main(string[] args) {
// 文字列の入力
string a = Console.ReadLine();
// 異なる文字列が含まれているか判定する
if (a.Distinct().Count() > 1) {
Console.Write("yes");
} else {
Console.Write("no");
}
}
}
}
|
using System;
using System.Linq;
namespace atcoderTest {
public class Program {
public static void Main(string[] args) {
// 文字列の入力
string a = Console.ReadLine();
// 異なる文字列が含まれているか判定する
if (a.Distinct().Count() > 1) {
Console.Write("Yes");
} else {
Console.Write("No");
}
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 77
| 4
|
public class Hello {
public static void Main() {
var s = System.Console.ReadLine();
var a = false;
var b = false;
for (var i = 0; i < 3; ++i) {
if (s.Substring(i) == "A") {
a = true;
} else {
b = true;
}
}
if (a && b) {
System.Console.WriteLine("Yes");
} else {
System.Console.WriteLine("No");
}
}
}
|
public class Hello {
public static void Main() {
var s = System.Console.ReadLine();
var a = false;
var b = false;
for (var i = 0; i < 3; ++i) {
if (s.Substring(i, 1) == "A") {
a = true;
} else {
b = true;
}
}
if (a && b) {
System.Console.WriteLine("Yes");
} else {
System.Console.WriteLine("No");
}
}
}
|
[["+", 0, 57, 15, 16, 31, 213, 3, 4, 0, 21], ["+", 15, 16, 31, 213, 3, 4, 0, 28, 0, 203]]
| 8
| 109
| 2
|
using System;
namespace AtCoder {
class Program {
static void Main() {
var line = Console.ReadLine();
if (line == "AAA" || line == "BBB") {
Console.WriteLine("No");
}
Console.WriteLine("Yes");
}
}
}
|
using System;
namespace AtCoder {
class Program {
static void Main() {
var line = Console.ReadLine();
if (line == "AAA" || line == "BBB") {
Console.WriteLine("No");
} else {
Console.WriteLine("Yes");
}
}
}
}
|
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 46]]
| 8
| 61
| 3
|
using System;
using static System.Console;
using System.Linq;
namespace AC {
public class shiokara {
static void Main(string[] args) {
String s = ReadLine();
if (s[0] != s[1]) {
WriteLine("No");
return;
} else if (s[1] != s[2]) {
WriteLine("No");
return;
} else if (s[0] != s[2]) {
WriteLine("No");
return;
}
WriteLine("Yes");
}
}
}
|
using System;
using static System.Console;
using System.Linq;
namespace AC {
public class shiokara {
static void Main(string[] args) {
String s = ReadLine();
if (s[0] != s[1]) {
WriteLine("Yes");
return;
} else if (s[1] != s[2]) {
WriteLine("Yes");
return;
} else if (s[0] != s[2]) {
WriteLine("Yes");
return;
}
WriteLine("No");
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 119
| 8
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Console;
namespace AtCoder_1 {
class Program {
static void Main(string[] args) {
var n = Cin();
char k = n[0];
for (int i = 1; i < 3; i++) {
if (k != n[1]) {
Cout("Yes");
return;
}
}
Cout("No");
Cin();
}
static Random Rand = new Random();
static string[] AlphabetTable =
new string[] { "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" };
static int GetDigits(long num) {
return (int)Math.Floor(Math.Log10(num)) + 1;
}
static int GetNumByDigit(long num, int digit) {
return (int)((num / ((int)Math.Pow(10, digit - 1))) % 10);
}
static int loop(int num, int max) {
if (num > max) {
return num % max;
} else if (num < 0) {
return max - (-num) % max;
} else {
return num;
}
}
static long GCD(long a, long b) {
if (a < b) {
swap(ref a, ref b);
}
if (a % b == 0) {
return b;
} else {
return GCD(b, a % b);
}
}
static long LCM(long a, long b) { return a * b / GCD(a, b); }
static void swap<T>(ref T a, ref T b) {
T t = a;
a = b;
b = t;
}
static readonly int MOD10_9_7 = (1000000000 + 7);
static bool IsInt(double d) { return (int)d == d; }
static string Cin() { return ReadLine(); }
static string[] CinAr() { return ReadLine().Split(' '); }
static int CinT() { return S2i(Cin()); }
static int[] CinTAr() {
return CinAr().Select((x, i) => { return S2i(x); }).ToArray();
}
static long CinL() { return S2L(Cin()); }
static long[] CinLAr() {
return CinAr().Select((x, i) => { return S2L(x); }).ToArray();
}
static double CinD() { return S2D(Cin()); }
static double[] CinDAr() {
return CinAr().Select((x, i) => { return S2D(x); }).ToArray();
}
static int S2i(string s) { return int.Parse(s); }
static long S2L(string s) { return long.Parse(s); }
static double S2D(string s) { return double.Parse(s); }
static void Cout(object s) { WriteLine(s); }
static long[] yakusuu(long n) {
if (n == 1) {
return new long[] { 1 };
}
List<long> res = new List<long>();
res.Add(1);
for (long i = 2; i <= n / 2 + 1; i++) {
if (n % i == 0) {
res.Add(i);
}
}
res.Add(n);
return res.ToArray();
}
static bool isPrime(long num) {
if (num == 1) {
return false;
}
for (long i = 2; i <= Math.Sqrt(num) + 1; i++) {
if (num % i == 0) {
return false;
}
}
return true;
}
static void CoutAr<Type>(IEnumerable<Type> types) {
WriteLine(string.Join(" ", types));
}
public static long nCr(int n, int r) {
// naive: return Factorial(n) / (Factorial(r) * Factorial(n - r));
return nPr(n, r) / Factorial(r);
}
public static long nPr(int n, int r) {
// naive: return Factorial(n) / Factorial(n - r);
return FactorialDivision(n, n - r);
}
private static long FactorialDivision(int topFactorial,
int divisorFactorial) {
long result = 1;
for (int i = topFactorial; i > divisorFactorial; i--)
result *= i;
return result;
}
private static long Factorial(int i) {
if (i <= 1)
return 1;
return i * Factorial(i - 1);
}
}
public struct Pair<T> {
public T a;
public T b;
public T c;
public Pair(T _a, T _b) {
a = _a;
b = _b;
c = default(T);
}
public Pair(T _a, T _b, T _c) {
a = _a;
b = _b;
c = _c;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Console;
namespace AtCoder_1 {
class Program {
static void Main(string[] args) {
var n = Cin();
char k = n[0];
for (int i = 1; i < 3; i++) {
if (k != n[i]) {
Cout("Yes");
return;
}
}
Cout("No");
Cin();
}
static Random Rand = new Random();
static string[] AlphabetTable =
new string[] { "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" };
static int GetDigits(long num) {
return (int)Math.Floor(Math.Log10(num)) + 1;
}
static int GetNumByDigit(long num, int digit) {
return (int)((num / ((int)Math.Pow(10, digit - 1))) % 10);
}
static int loop(int num, int max) {
if (num > max) {
return num % max;
} else if (num < 0) {
return max - (-num) % max;
} else {
return num;
}
}
static long GCD(long a, long b) {
if (a < b) {
swap(ref a, ref b);
}
if (a % b == 0) {
return b;
} else {
return GCD(b, a % b);
}
}
static long LCM(long a, long b) { return a * b / GCD(a, b); }
static void swap<T>(ref T a, ref T b) {
T t = a;
a = b;
b = t;
}
static readonly int MOD10_9_7 = (1000000000 + 7);
static bool IsInt(double d) { return (int)d == d; }
static string Cin() { return ReadLine(); }
static string[] CinAr() { return ReadLine().Split(' '); }
static int CinT() { return S2i(Cin()); }
static int[] CinTAr() {
return CinAr().Select((x, i) => { return S2i(x); }).ToArray();
}
static long CinL() { return S2L(Cin()); }
static long[] CinLAr() {
return CinAr().Select((x, i) => { return S2L(x); }).ToArray();
}
static double CinD() { return S2D(Cin()); }
static double[] CinDAr() {
return CinAr().Select((x, i) => { return S2D(x); }).ToArray();
}
static int S2i(string s) { return int.Parse(s); }
static long S2L(string s) { return long.Parse(s); }
static double S2D(string s) { return double.Parse(s); }
static void Cout(object s) { WriteLine(s); }
static long[] yakusuu(long n) {
if (n == 1) {
return new long[] { 1 };
}
List<long> res = new List<long>();
res.Add(1);
for (long i = 2; i <= n / 2 + 1; i++) {
if (n % i == 0) {
res.Add(i);
}
}
res.Add(n);
return res.ToArray();
}
static bool isPrime(long num) {
if (num == 1) {
return false;
}
for (long i = 2; i <= Math.Sqrt(num) + 1; i++) {
if (num % i == 0) {
return false;
}
}
return true;
}
static void CoutAr<Type>(IEnumerable<Type> types) {
WriteLine(string.Join(" ", types));
}
public static long nCr(int n, int r) {
// naive: return Factorial(n) / (Factorial(r) * Factorial(n - r));
return nPr(n, r) / Factorial(r);
}
public static long nPr(int n, int r) {
// naive: return Factorial(n) / Factorial(n - r);
return FactorialDivision(n, n - r);
}
private static long FactorialDivision(int topFactorial,
int divisorFactorial) {
long result = 1;
for (int i = topFactorial; i > divisorFactorial; i--)
result *= i;
return result;
}
private static long Factorial(int i) {
if (i <= 1)
return 1;
return i * Factorial(i - 1);
}
}
public struct Pair<T> {
public T a;
public T b;
public T c;
public Pair(T _a, T _b) {
a = _a;
b = _b;
c = default(T);
}
public Pair(T _a, T _b, T _c) {
a = _a;
b = _b;
c = _c;
}
}
}
|
[["-", 15, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 15, 16, 12, 204, 206, 207, 0, 28, 0, 22]]
| 8
| 1,130
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder_solve {
class Program {
public const ulong mod = 1000000007;
static void Main(string[] args)
{
var s = Console.ReadLine();
var ans = "Yes";
if (s == "AAA" || s == "BBB")
ans = "NO";
Console.WriteLine(ans);
}
static public long Input() { return long.Parse(Console.ReadLine()); }
static public string[] Input2() { return Console.ReadLine().Split(); }
static public long[] Input3() {
string[] data = Console.ReadLine().Split();
long[] res = new long[data.LongLength];
for (long i = 0; i < data.LongLength; i++) {
res[i] = long.Parse(data[i]);
}
return res;
}
public static long Choose(long n, long a) {
long x = 1;
long y = 1;
for (long i = 0; i < a; i++) {
x *= n - i;
y *= i + 1;
}
return x / y;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder_solve {
class Program {
public const ulong mod = 1000000007;
static void Main(string[] args)
{
var s = Console.ReadLine();
var ans = "Yes";
if (s == "AAA" || s == "BBB")
ans = "No";
Console.WriteLine(ans);
}
static public long Input() { return long.Parse(Console.ReadLine()); }
static public string[] Input2() { return Console.ReadLine().Split(); }
static public long[] Input3() {
string[] data = Console.ReadLine().Split();
long[] res = new long[data.LongLength];
for (long i = 0; i < data.LongLength; i++) {
res[i] = long.Parse(data[i]);
}
return res;
}
public static long Choose(long n, long a) {
long x = 1;
long y = 1;
for (long i = 0; i < a; i++) {
x *= n - i;
y *= i + 1;
}
return x / y;
}
}
}
|
[["-", 0, 57, 64, 1, 0, 11, 12, 5, 0, 222], ["+", 0, 57, 64, 1, 0, 11, 12, 5, 0, 222]]
| 8
| 267
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Tasks {
public class B {
static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
Solve();
Console.Out.Flush();
}
public static void Solve() {
var (N, A, B) = Scanner.Scan<int, int, int>();
if (A == 0) {
Console.WriteLine(0);
return;
}
var answer = N / (A + B) * A;
answer += Math.Min(A, N % (A + B));
Console.WriteLine(answer);
}
public static class Scanner {
private static Queue<string> queue = new Queue<string>();
public static T Next<T>() {
if (!queue.Any())
foreach (var item in Console.ReadLine().Trim().Split(" "))
queue.Enqueue(item);
return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
}
public static T Scan<T>() => Next<T>();
public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(),
Next<T3>());
public static (T1, T2, T3,
T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(),
Next<T3>(), Next<T4>());
public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() =>
(Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
public static IEnumerable<T>
ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(
x => (T)Convert.ChangeType(x, typeof(T)));
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Tasks {
public class B {
static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
Solve();
Console.Out.Flush();
}
public static void Solve() {
var (N, A, B) = Scanner.Scan<long, long, long>();
if (A == 0) {
Console.WriteLine(0);
return;
}
var answer = N / (A + B) * A;
answer += Math.Min(A, N % (A + B));
Console.WriteLine(answer);
}
public static class Scanner {
private static Queue<string> queue = new Queue<string>();
public static T Next<T>() {
if (!queue.Any())
foreach (var item in Console.ReadLine().Trim().Split(" "))
queue.Enqueue(item);
return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
}
public static T Scan<T>() => Next<T>();
public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(),
Next<T3>());
public static (T1, T2, T3,
T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(),
Next<T3>(), Next<T4>());
public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() =>
(Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
public static IEnumerable<T>
ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(
x => (T)Convert.ChangeType(x, typeof(T)));
}
}
}
|
[["-", 0, 213, 63, 214, 141, 236, 237, 238, 0, 199], ["+", 0, 213, 63, 214, 141, 236, 237, 238, 0, 199]]
| 8
| 518
| 6
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace B {
public class Program {
static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
Solve();
Console.Out.Flush();
}
public static void Solve() {
var nab = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
if (nab[1] == 0)
Console.WriteLine(0);
var tmp = nab[1] + nab[2];
var mod = nab[0] % tmp;
if (mod > nab[1])
mod = nab[1];
var div = nab[0] / tmp;
Console.WriteLine(nab[1] * div + mod);
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace B {
public class Program {
static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
Solve();
Console.Out.Flush();
}
public static void Solve() {
var nab = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
if (nab[1] == 0) {
Console.WriteLine(0);
return;
}
var tmp = nab[1] + nab[2];
var mod = nab[0] % tmp;
if (mod > nab[1])
mod = nab[1];
var div = nab[0] / tmp;
Console.WriteLine(nab[1] * div + mod);
}
}
}
|
[["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
| 8
| 200
| 4
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;
class program {
static public int mod = 1000000007;
static void Main() {
var z = longa();
long n = z[0], a = z[1], b = z[2];
long ans = n / (a + b);
ans *= a;
ans += n % (a + b);
Write(ans);
}
static int pow(int a, int b) {
string binary = Convert.ToString(b, 2);
int bileng = binary.Length;
long a_power = a;
long value = 1;
for (int i = bileng - 1; i >= 0; i--) {
if (binary[i] == '1') {
value = value * a_power % mod;
}
a_power = a_power * a_power % mod;
}
return (int)value;
}
static string rstr() { return ReadLine(); }
static int rint() { return int.Parse(ReadLine()); }
static long rlong() { return long.Parse(ReadLine()); }
static string[] stra() { return ReadLine().Split(' '); }
static char[] chara() {
string[] a = stra();
string b = "";
for (int i = 0; i < a.Length; i++) {
b += a[i];
}
return b.ToCharArray();
}
static int[] inta() {
string[] read_str_array = ReadLine().Split(' ');
int[] return_int_array = new int[read_str_array.Length];
for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
}
return return_int_array;
}
static long[] longa() {
string[] read_str_array = ReadLine().Split(' ');
long[] return_long_array = new long[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_long_array[countup_i] = long.Parse(read_str_array[countup_i]);
}
return return_long_array;
}
static double[] doublea() {
string[] read_str_array = ReadLine().Split(' ');
double[] return_double_array = new double[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_double_array[countup_i] = double.Parse(read_str_array[countup_i]);
}
return return_double_array;
}
static long GCD(long a, long b) {
if (a < b) {
long temp = a;
a = b;
b = temp;
}
if (a % b == 0) {
return b;
} else {
long temp = b;
b = a % b;
a = temp;
return GCD(a, b);
}
}
static long LCM(long a, long b) { return a * b / GCD(a, b); }
static void WriteArray2(int[,] a, int b, int c) {
for (int i = 0; i < b; i++) {
for (int j = 0; j < c; j++) {
if (j != 0)
Write(" ");
Write(a[i, j]);
}
WriteLine();
}
}
static void WriteArray(int[] a, int b) {
for (int i = 0; i < b; i++) {
Write(" ");
Write(a[i]);
}
WriteLine();
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;
class program {
static public int mod = 1000000007;
static void Main() {
var z = longa();
long n = z[0], a = z[1], b = z[2];
long ans = n / (a + b);
ans *= a;
ans += Min(n % (a + b), a);
Write(ans);
}
static int pow(int a, int b) {
string binary = Convert.ToString(b, 2);
int bileng = binary.Length;
long a_power = a;
long value = 1;
for (int i = bileng - 1; i >= 0; i--) {
if (binary[i] == '1') {
value = value * a_power % mod;
}
a_power = a_power * a_power % mod;
}
return (int)value;
}
static string rstr() { return ReadLine(); }
static int rint() { return int.Parse(ReadLine()); }
static long rlong() { return long.Parse(ReadLine()); }
static string[] stra() { return ReadLine().Split(' '); }
static char[] chara() {
string[] a = stra();
string b = "";
for (int i = 0; i < a.Length; i++) {
b += a[i];
}
return b.ToCharArray();
}
static int[] inta() {
string[] read_str_array = ReadLine().Split(' ');
int[] return_int_array = new int[read_str_array.Length];
for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
}
return return_int_array;
}
static long[] longa() {
string[] read_str_array = ReadLine().Split(' ');
long[] return_long_array = new long[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_long_array[countup_i] = long.Parse(read_str_array[countup_i]);
}
return return_long_array;
}
static double[] doublea() {
string[] read_str_array = ReadLine().Split(' ');
double[] return_double_array = new double[read_str_array.Length];
for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) {
return_double_array[countup_i] = double.Parse(read_str_array[countup_i]);
}
return return_double_array;
}
static long GCD(long a, long b) {
if (a < b) {
long temp = a;
a = b;
b = temp;
}
if (a % b == 0) {
return b;
} else {
long temp = b;
b = a % b;
a = temp;
return GCD(a, b);
}
}
static long LCM(long a, long b) { return a * b / GCD(a, b); }
static void WriteArray2(int[,] a, int b, int c) {
for (int i = 0; i < b; i++) {
for (int j = 0; j < c; j++) {
if (j != 0)
Write(" ");
Write(a[i, j]);
}
WriteLine();
}
}
static void WriteArray(int[] a, int b) {
for (int i = 0; i < b; i++) {
Write(" ");
Write(a[i]);
}
WriteLine();
}
}
|
[["+", 8, 196, 0, 1, 0, 11, 12, 213, 63, 22], ["+", 0, 1, 0, 11, 12, 213, 3, 4, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 11, 12, 213, 3, 4, 0, 21], ["+", 0, 11, 12, 213, 3, 4, 0, 28, 0, 22]]
| 8
| 775
| 5
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
namespace atcoder {
class Program {
static void Main(string[] args) {
var nab =
Console.ReadLine().Split(' ').Select(num => long.Parse(num)).ToArray();
var n = nab[0];
var a = nab[1];
var b = nab[2];
if (a == 0) {
Console.WriteLine(0);
return;
}
if (b == 0) {
Console.WriteLine(n);
return;
}
var result = a * n / (a + b);
var amari = n % (a + b);
result += amari <= a ? amari : a;
Console.WriteLine(result);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
namespace atcoder {
class Program {
static void Main(string[] args) {
var nab =
Console.ReadLine().Split(' ').Select(num => long.Parse(num)).ToArray();
var n = nab[0];
var a = nab[1];
var b = nab[2];
if (a == 0) {
Console.WriteLine(0);
return;
}
if (b == 0) {
Console.WriteLine(n);
return;
}
var result = a * (n / (a + b));
var amari = n % (a + b);
result += amari <= a ? amari : a;
Console.WriteLine(result);
}
}
}
|
[["+", 0, 200, 0, 212, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
| 8
| 170
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC_158b {
class Program {
static void Main(string[] args) {
int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
int count = 0;
count += input[0] / (input[1] + input[2]) * input[1];
if (input[0] % (input[1] + input[2]) >= input[1]) {
count += input[1];
} else {
count += input[0] % (input[1] + input[2]);
}
Console.WriteLine(count);
Console.Read();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC_158b {
class Program {
static void Main(string[] args) {
long[] input = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
long count = 0;
count += input[0] / (input[1] + input[2]) * input[1];
if (input[0] % (input[1] + input[2]) >= input[1]) {
count += input[1];
} else {
count += input[0] % (input[1] + input[2]);
}
Console.WriteLine(count);
Console.Read();
}
}
}
|
[["-", 8, 196, 0, 197, 0, 198, 39, 224, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 39, 224, 39, 199], ["-", 0, 213, 3, 4, 0, 28, 0, 214, 205, 199], ["+", 0, 213, 3, 4, 0, 28, 0, 214, 205, 199], ["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 170
| 6
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
long[] NAB =
Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
long N = NAB[0];
long A = NAB[1];
long B = NAB[2];
if (A == 0) {
Console.WriteLine(0);
return;
}
long quotient = N / (A + B);
long surplus = N % (A + B);
if (A < surplus) {
Console.WriteLine(A * quotient + A);
return;
}
Console.WriteLine(quotient + surplus);
}
}
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
long[] NAB =
Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
long N = NAB[0];
long A = NAB[1];
long B = NAB[2];
if (A == 0) {
Console.WriteLine(0);
return;
}
long quotient = N / (A + B);
long surplus = N % (A + B);
if (A < surplus) {
Console.WriteLine(A * quotient + A);
return;
}
Console.WriteLine(A * quotient + surplus);
}
}
|
[["+", 3, 4, 0, 28, 0, 16, 31, 16, 31, 22], ["+", 3, 4, 0, 28, 0, 16, 31, 16, 17, 48]]
| 8
| 150
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program {
static void Main(string[] args) {
int[] arr =
Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
long turn = arr[0] / (arr[1] + arr[2]);
long turnMod = arr[0] % (arr[1] + arr[2]);
Console.WriteLine(turn * arr[1] + Math.Min(turnMod, arr[1]));
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program {
static void Main(string[] args) {
long[] arr =
Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToArray();
long turn = arr[0] / (arr[1] + arr[2]);
long turnMod = arr[0] % (arr[1] + arr[2]);
Console.WriteLine(turn * arr[1] + Math.Min(turnMod, arr[1]));
}
}
|
[["-", 8, 196, 0, 197, 0, 198, 39, 224, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 39, 224, 39, 199], ["-", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199], ["+", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199]]
| 8
| 133
| 4
|
/*********************************************
* 20.05.08 AtCoder Beginner Contest 158. A, B, C
*
*
*********************************************/
/*********************************************
::test input::
*********************************************/
namespace TempName {
using System;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using static System.Console;
using static IOmacro.CsharpInput;
using static IOmacro.CppInput;
public class CRun {
public readonly char problem_num = 'B';
public void solve_1() {
// A. Station and Bus
string input = _string;
string ans = "No";
for (int i = 1; i < input.Length; i++) {
if (input[i] != input[i - 1]) {
ans = "Yes";
break;
}
}
WriteLine(ans);
}
public void solve_2() {
// B. Count Balls
int N = cin, A = cin, B = cin;
int x = N / (A + B);
int y = N % (A + B);
int ans = 0;
ans += x * A;
ans += (y > A ? A : y);
WriteLine(ans);
}
public void solve_3() {}
}
class Program {
static void Main() {
var run = new CRun();
if (run.problem_num == 'A')
run.solve_1();
if (run.problem_num == 'B')
run.solve_2();
if (run.problem_num == 'C')
run.solve_3();
}
}
}
namespace IOmacro {
// 20.05.08. 수정
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
public class CsharpInput {
public static StreamWriter _writer =
new StreamWriter(Console.OpenStandardOutput());
public const char separator = ' ';
public static string _string {
get { return Console.ReadLine(); }
}
public static string[] _stringa {
get { return (Console.ReadLine().Split(separator)); }
}
public static int _int {
get { return int.Parse(Console.ReadLine()); }
}
public static int[] _inta {
get {
return Console.ReadLine().Split(separator).Select(int.Parse).ToArray();
}
}
public static long _long {
get { return long.Parse(Console.ReadLine()); }
}
public static long[] _longa {
get {
return Console.ReadLine().Split(separator).Select(long.Parse).ToArray();
}
}
public static double _double {
get { return double.Parse(Console.ReadLine()); }
}
public static double[] _doublea {
get {
return Console.ReadLine().Split(separator).Select(double.Parse).ToArray();
}
}
}
public class CConst {
public static readonly int MINI = int.MaxValue;
public static readonly long INF = Int64.MaxValue;
}
public class CppInput {
public static CppInput cin => new CppInput();
public const char separator = ' ';
private static readonly Queue<string> _input = new Queue<string>();
private CppInput() {}
public static implicit operator string(CppInput _) {
if (_input.Count == 0)
Console.ReadLine().Split(separator).foreachExtension(
x => _input.Enqueue(x));
return _input.Dequeue();
}
public static implicit operator int(CppInput _) {
if (_input.Count == 0)
Console.ReadLine().Split(separator).foreachExtension(
x => _input.Enqueue(x));
return int.Parse(_input.Dequeue());
}
public static implicit operator long(CppInput _) {
if (_input.Count == 0)
Console.ReadLine().Split(separator).foreachExtension(
x => _input.Enqueue(x));
return long.Parse(_input.Dequeue());
}
public static implicit operator double(CppInput _) {
if (_input.Count == 0)
Console.ReadLine().Split(separator).foreachExtension(
x => _input.Enqueue(x));
return double.Parse(_input.Dequeue());
}
}
public static class EnumerableExtension {
public delegate void Function<in T>(T val);
public static void foreachExtension<T>(this IEnumerable<T> enumerable,
Function<T> function) {
foreach (var x in enumerable)
function(x);
}
}
}
|
/*********************************************
* 20.05.08 AtCoder Beginner Contest 158. A, B, C
*
*
*********************************************/
/*********************************************
::test input::
*********************************************/
namespace TempName {
using System;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using static System.Console;
using static IOmacro.CsharpInput;
using static IOmacro.CppInput;
public class CRun {
public readonly char problem_num = 'B';
public void solve_1() {
// A. Station and Bus
string input = _string;
string ans = "No";
for (int i = 1; i < input.Length; i++) {
if (input[i] != input[i - 1]) {
ans = "Yes";
break;
}
}
WriteLine(ans);
}
public void solve_2() {
// B. Count Balls
long N = cin, A = cin, B = cin;
long x = N / (A + B);
long y = N % (A + B);
long ans = 0;
ans += x * A;
ans += (y > A ? A : y);
WriteLine(ans);
}
public void solve_3() {}
}
class Program {
static void Main() {
var run = new CRun();
if (run.problem_num == 'A')
run.solve_1();
if (run.problem_num == 'B')
run.solve_2();
if (run.problem_num == 'C')
run.solve_3();
}
}
}
namespace IOmacro {
// 20.05.08. 수정
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
public class CsharpInput {
public static StreamWriter _writer =
new StreamWriter(Console.OpenStandardOutput());
public const char separator = ' ';
public static string _string {
get { return Console.ReadLine(); }
}
public static string[] _stringa {
get { return (Console.ReadLine().Split(separator)); }
}
public static int _int {
get { return int.Parse(Console.ReadLine()); }
}
public static int[] _inta {
get {
return Console.ReadLine().Split(separator).Select(int.Parse).ToArray();
}
}
public static long _long {
get { return long.Parse(Console.ReadLine()); }
}
public static long[] _longa {
get {
return Console.ReadLine().Split(separator).Select(long.Parse).ToArray();
}
}
public static double _double {
get { return double.Parse(Console.ReadLine()); }
}
public static double[] _doublea {
get {
return Console.ReadLine().Split(separator).Select(double.Parse).ToArray();
}
}
}
public class CConst {
public static readonly int MINI = int.MaxValue;
public static readonly long INF = Int64.MaxValue;
}
public class CppInput {
public static CppInput cin => new CppInput();
public const char separator = ' ';
private static readonly Queue<string> _input = new Queue<string>();
private CppInput() {}
public static implicit operator string(CppInput _) {
if (_input.Count == 0)
Console.ReadLine().Split(separator).foreachExtension(
x => _input.Enqueue(x));
return _input.Dequeue();
}
public static implicit operator int(CppInput _) {
if (_input.Count == 0)
Console.ReadLine().Split(separator).foreachExtension(
x => _input.Enqueue(x));
return int.Parse(_input.Dequeue());
}
public static implicit operator long(CppInput _) {
if (_input.Count == 0)
Console.ReadLine().Split(separator).foreachExtension(
x => _input.Enqueue(x));
return long.Parse(_input.Dequeue());
}
public static implicit operator double(CppInput _) {
if (_input.Count == 0)
Console.ReadLine().Split(separator).foreachExtension(
x => _input.Enqueue(x));
return double.Parse(_input.Dequeue());
}
}
public static class EnumerableExtension {
public delegate void Function<in T>(T val);
public static void foreachExtension<T>(this IEnumerable<T> enumerable,
Function<T> function) {
foreach (var x in enumerable)
function(x);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 867
| 8
|
using System;
using System.Collections.Generic;
using System.Linq;
class Ho {
static void Main() {
var aho = Console.ReadLine().Split();
var N = int.Parse(aho[0]);
var A = int.Parse(aho[1]);
var B = int.Parse(aho[2]);
if (N < A) {
Console.WriteLine(N);
return;
}
var goukei = A + B;
var amari = N % goukei;
var setto = (N - amari) / goukei * A;
if (amari >= A) {
Console.WriteLine(setto + A);
} else {
Console.WriteLine(setto + amari);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class Ho {
static void Main() {
var aho = Console.ReadLine().Split();
var N = long.Parse(aho[0]);
var A = long.Parse(aho[1]);
var B = long.Parse(aho[2]);
if (N < A) {
Console.WriteLine(N);
return;
}
long goukei = A + B;
long amari = N % goukei;
long setto = (N - amari) / goukei * A;
if (amari >= A) {
Console.WriteLine(setto + A);
} else {
Console.WriteLine(setto + amari);
}
}
}
|
[["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["-", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 151
| 12
|
using System;
namespace B {
class Program {
static void Main(string[] args) {
string[] tmp = Console.ReadLine().Split(' ');
long n = int.Parse(tmp[0]);
long a = int.Parse(tmp[1]);
long b = int.Parse(tmp[2]);
Console.WriteLine(n / (a + b) * a + Math.Min(a, n % (a + b)));
}
}
}
|
using System;
namespace B {
class Program {
static void Main(string[] args) {
string[] tmp = Console.ReadLine().Split(' ');
long n = long.Parse(tmp[0]);
long a = long.Parse(tmp[1]);
long b = long.Parse(tmp[2]);
Console.WriteLine(n / (a + b) * a + Math.Min(a, n % (a + b)));
}
}
}
|
[["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
| 8
| 109
| 6
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.