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.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
class Program {
static void Main(string[] args) {
var NAB =
Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
var A = NAB[0];
var B = NAB[1];
var C = NAB[2];
Console.WriteLine(Math.Min(A / B, C));
}
}
public class PriorityQueue<T> : IEnumerable<T> {
private readonly List<T> _data = new List<T>();
private readonly IComparer<T> _comparer;
private readonly bool _isDescending;
public PriorityQueue(IComparer<T> comparer, bool isDescending = true) {
_comparer = comparer;
_isDescending = isDescending;
}
public PriorityQueue(Comparison<T> comparison, bool isDescending = true)
: this(Comparer<T>.Create(comparison), isDescending) {}
public PriorityQueue(bool isDescending = true)
: this(Comparer<T>.Default, isDescending) {}
public void Enqueue(T item) {
_data.Add(item);
var childIndex = _data.Count - 1;
while (childIndex > 0) {
var parentIndex = (childIndex - 1) / 2;
if (Compare(_data[childIndex], _data[parentIndex]) >= 0)
break;
Swap(childIndex, parentIndex);
childIndex = parentIndex;
}
}
public T Dequeue() {
var lastIndex = _data.Count - 1;
var firstItem = _data[0];
_data[0] = _data[lastIndex];
_data.RemoveAt(lastIndex--);
var parentIndex = 0;
while (true) {
var childIndex = parentIndex * 2 + 1;
if (childIndex > lastIndex)
break;
var rightChild = childIndex + 1;
if (rightChild <= lastIndex &&
Compare(_data[rightChild], _data[childIndex]) < 0)
childIndex = rightChild;
if (Compare(_data[parentIndex], _data[childIndex]) <= 0)
break;
Swap(parentIndex, childIndex);
parentIndex = childIndex;
}
return firstItem;
}
public T Peek() { return _data[0]; }
private void Swap(int a, int b) {
var tmp = _data[a];
_data[a] = _data[b];
_data[b] = tmp;
}
private int Compare(T a, T b) {
return _isDescending ? _comparer.Compare(b, a) : _comparer.Compare(a, b);
}
public int Count => _data.Count;
public IEnumerator<T> GetEnumerator() { return _data.GetEnumerator(); }
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
|
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
class Program {
static void Main(string[] args) {
var NAB =
Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
var A = NAB[0];
var B = NAB[1];
var C = NAB[2];
Console.WriteLine(Math.Min(B / A, C));
}
}
public class PriorityQueue<T> : IEnumerable<T> {
private readonly List<T> _data = new List<T>();
private readonly IComparer<T> _comparer;
private readonly bool _isDescending;
public PriorityQueue(IComparer<T> comparer, bool isDescending = true) {
_comparer = comparer;
_isDescending = isDescending;
}
public PriorityQueue(Comparison<T> comparison, bool isDescending = true)
: this(Comparer<T>.Create(comparison), isDescending) {}
public PriorityQueue(bool isDescending = true)
: this(Comparer<T>.Default, isDescending) {}
public void Enqueue(T item) {
_data.Add(item);
var childIndex = _data.Count - 1;
while (childIndex > 0) {
var parentIndex = (childIndex - 1) / 2;
if (Compare(_data[childIndex], _data[parentIndex]) >= 0)
break;
Swap(childIndex, parentIndex);
childIndex = parentIndex;
}
}
public T Dequeue() {
var lastIndex = _data.Count - 1;
var firstItem = _data[0];
_data[0] = _data[lastIndex];
_data.RemoveAt(lastIndex--);
var parentIndex = 0;
while (true) {
var childIndex = parentIndex * 2 + 1;
if (childIndex > lastIndex)
break;
var rightChild = childIndex + 1;
if (rightChild <= lastIndex &&
Compare(_data[rightChild], _data[childIndex]) < 0)
childIndex = rightChild;
if (Compare(_data[parentIndex], _data[childIndex]) <= 0)
break;
Swap(parentIndex, childIndex);
parentIndex = childIndex;
}
return firstItem;
}
public T Peek() { return _data[0]; }
private void Swap(int a, int b) {
var tmp = _data[a];
_data[a] = _data[b];
_data[b] = tmp;
}
private int Compare(T a, T b) {
return _isDescending ? _comparer.Compare(b, a) : _comparer.Compare(a, b);
}
public int Count => _data.Count;
public IEnumerator<T> GetEnumerator() { return _data.GetEnumerator(); }
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 85], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 85], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
| 8
| 568
| 4
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static ABC120A.Input;
namespace ABC120A {
static class Input {
/// <summary>
/// 1行の入力をTに応じてリストに変換する関数を返す
/// </summary>
static Func<string, List<T>>
Cast<T>() => _ => _.Split(' ').Select(Convert<T>()).ToList();
/// <summary>
/// 1行の入力をTに応じて変換する関数を返す
/// </summary>
static Func<string, T> Convert<T>() {
Type t = typeof(T);
if (t == typeof(string))
return _ => (T)(object)_;
if (t == typeof(int))
return _ => (T)(object) int.Parse(_);
if (t == typeof(long))
return _ => (T)(object) long.Parse(_);
if (t == typeof(double))
return _ => (T)(object) double.Parse(_);
if (t == typeof(List<string>))
return _ => (T)(object)Cast<string>()(_);
if (t == typeof(List<int>))
return _ => (T)(object)Cast<int>()(_);
if (t == typeof(List<long>))
return _ => (T)(object)Cast<long>()(_);
if (t == typeof(List<double>))
return _ => (T)(object)Cast<double>()(_);
throw new NotSupportedException(t + "is not supported.");
}
static string String() => Console.ReadLine();
static List<string>
String(long rowNumber) => new bool [rowNumber].Select(_ => String()).ToList();
static void Set<T>(List<T> s, out T o1) => o1 = s[0];
static void Set<T>(List<T> s, out T o1, out T o2) {
o1 = s[0];
o2 = s[1];
}
static void Set<T>(List<T> s, out T o1, out T o2, out T o3) {
o1 = s[0];
o2 = s[1];
o3 = s[2];
}
static void Set<T>(List<T> s, out T o1, out T o2, out T o3, out T o4) {
o1 = s[0];
o2 = s[1];
o3 = s[2];
o4 = s[3];
}
static void Set<T>(List<T> s, out T o1, out T o2, out T o3, out T o4,
out T o5) {
o1 = s[0];
o2 = s[1];
o3 = s[2];
o4 = s[3];
o5 = s[4];
}
static void Set<T>(List<T> s, out T o1, out T o2, out T o3, out T o4,
out T o5, out T o6) {
o1 = s[0];
o2 = s[1];
o3 = s[2];
o4 = s[3];
o5 = s[4];
o6 = s[5];
}
/// <summary>
/// 1行の値の入力
/// </summary>
public static void
@in<T>(out T a) => Set(Convert<List<T>>()(String()), out a);
public static void
@in<T>(out T a1, out T a2) => Set(Convert<List<T>>()(String()), out a1,
out a2);
public static void
@in<T>(out T a1, out T a2, out T a3) => Set(Convert<List<T>>()(String()),
out a1, out a2, out a3);
public static void @in<T>(out T a1, out T a2, out T a3,
out T a4) => Set(Convert<List<T>>()(String()),
out a1, out a2, out a3, out a4);
public static void @in<T>(out T a1, out T a2, out T a3, out T a4, out T a5) =>
Set(Convert<List<T>>()(String()), out a1, out a2, out a3, out a4, out a5);
public static void
@in<T>(out T a1, out T a2, out T a3, out T a4, out T a5,
out T a6) => Set(Convert<List<T>>()(String()), out a1, out a2,
out a3, out a4, out a5, out a6);
/// <summary>
/// 複数行の値の入力
/// </summary>
public static void @in<T>(long rowNumber, out List<T> l) => l =
String(rowNumber).Select(Convert<T>()).ToList();
public static void @in<T>(long rowNumber, out List<T> l1, out List<T> l2) =>
Set(String(rowNumber).Select(Convert<List<T>>()).ToList(), out l1,
out l2);
public static void
@in<T>(long rowNumber, out List<T> l1, out List<T> l2, out List<T> l3) =>
Set(String(rowNumber).Select(Convert<List<T>>()).ToList(), out l1,
out l2, out l3);
public static void @in<T>(long rowNumber, out List<T> l1, out List<T> l2,
out List<T> l3, out List<T> l4) =>
Set(String(rowNumber).Select(Convert<List<T>>()).ToList(), out l1, out l2,
out l3, out l4);
/// <summary>
/// 1行に書かれた複数の値の入力
/// </summary>
public static void
@in<T>(out List<T> lArr) => lArr = Convert<List<T>>()(String());
/// <summary>
/// h行の行列の入力
/// </summary>
public static void @in<T>(long h, out List<List<T>> map) => map =
String(h).Select(Convert<List<T>>()).ToList();
}
class Program {
public static void Main(string[] args) {
StreamWriter streamWriter =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(streamWriter);
new Solver().Solve();
Console.Out.Flush();
}
public static void Debug() { new Solver().Solve(); }
}
class Solver {
private long A;
private long B;
private long C;
public void Solve() {
@in(out A, out B, out C);
Console.WriteLine(Math.Max(C, B / A));
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static ABC120A.Input;
namespace ABC120A {
static class Input {
/// <summary>
/// 1行の入力をTに応じてリストに変換する関数を返す
/// </summary>
static Func<string, List<T>>
Cast<T>() => _ => _.Split(' ').Select(Convert<T>()).ToList();
/// <summary>
/// 1行の入力をTに応じて変換する関数を返す
/// </summary>
static Func<string, T> Convert<T>() {
Type t = typeof(T);
if (t == typeof(string))
return _ => (T)(object)_;
if (t == typeof(int))
return _ => (T)(object) int.Parse(_);
if (t == typeof(long))
return _ => (T)(object) long.Parse(_);
if (t == typeof(double))
return _ => (T)(object) double.Parse(_);
if (t == typeof(List<string>))
return _ => (T)(object)Cast<string>()(_);
if (t == typeof(List<int>))
return _ => (T)(object)Cast<int>()(_);
if (t == typeof(List<long>))
return _ => (T)(object)Cast<long>()(_);
if (t == typeof(List<double>))
return _ => (T)(object)Cast<double>()(_);
throw new NotSupportedException(t + "is not supported.");
}
static string String() => Console.ReadLine();
static List<string>
String(long rowNumber) => new bool [rowNumber].Select(_ => String()).ToList();
static void Set<T>(List<T> s, out T o1) => o1 = s[0];
static void Set<T>(List<T> s, out T o1, out T o2) {
o1 = s[0];
o2 = s[1];
}
static void Set<T>(List<T> s, out T o1, out T o2, out T o3) {
o1 = s[0];
o2 = s[1];
o3 = s[2];
}
static void Set<T>(List<T> s, out T o1, out T o2, out T o3, out T o4) {
o1 = s[0];
o2 = s[1];
o3 = s[2];
o4 = s[3];
}
static void Set<T>(List<T> s, out T o1, out T o2, out T o3, out T o4,
out T o5) {
o1 = s[0];
o2 = s[1];
o3 = s[2];
o4 = s[3];
o5 = s[4];
}
static void Set<T>(List<T> s, out T o1, out T o2, out T o3, out T o4,
out T o5, out T o6) {
o1 = s[0];
o2 = s[1];
o3 = s[2];
o4 = s[3];
o5 = s[4];
o6 = s[5];
}
/// <summary>
/// 1行の値の入力
/// </summary>
public static void
@in<T>(out T a) => Set(Convert<List<T>>()(String()), out a);
public static void
@in<T>(out T a1, out T a2) => Set(Convert<List<T>>()(String()), out a1,
out a2);
public static void
@in<T>(out T a1, out T a2, out T a3) => Set(Convert<List<T>>()(String()),
out a1, out a2, out a3);
public static void @in<T>(out T a1, out T a2, out T a3,
out T a4) => Set(Convert<List<T>>()(String()),
out a1, out a2, out a3, out a4);
public static void @in<T>(out T a1, out T a2, out T a3, out T a4, out T a5) =>
Set(Convert<List<T>>()(String()), out a1, out a2, out a3, out a4, out a5);
public static void
@in<T>(out T a1, out T a2, out T a3, out T a4, out T a5,
out T a6) => Set(Convert<List<T>>()(String()), out a1, out a2,
out a3, out a4, out a5, out a6);
/// <summary>
/// 複数行の値の入力
/// </summary>
public static void @in<T>(long rowNumber, out List<T> l) => l =
String(rowNumber).Select(Convert<T>()).ToList();
public static void @in<T>(long rowNumber, out List<T> l1, out List<T> l2) =>
Set(String(rowNumber).Select(Convert<List<T>>()).ToList(), out l1,
out l2);
public static void
@in<T>(long rowNumber, out List<T> l1, out List<T> l2, out List<T> l3) =>
Set(String(rowNumber).Select(Convert<List<T>>()).ToList(), out l1,
out l2, out l3);
public static void @in<T>(long rowNumber, out List<T> l1, out List<T> l2,
out List<T> l3, out List<T> l4) =>
Set(String(rowNumber).Select(Convert<List<T>>()).ToList(), out l1, out l2,
out l3, out l4);
/// <summary>
/// 1行に書かれた複数の値の入力
/// </summary>
public static void
@in<T>(out List<T> lArr) => lArr = Convert<List<T>>()(String());
/// <summary>
/// h行の行列の入力
/// </summary>
public static void @in<T>(long h, out List<List<T>> map) => map =
String(h).Select(Convert<List<T>>()).ToList();
}
class Program {
public static void Main(string[] args) {
StreamWriter streamWriter =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(streamWriter);
new Solver().Solve();
Console.Out.Flush();
}
public static void Debug() { new Solver().Solve(); }
}
class Solver {
private long A;
private long B;
private long C;
public void Solve() {
@in(out A, out B, out C);
Console.WriteLine(Math.Min(C, B / A));
}
}
}
|
[["-", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22]]
| 8
| 1,465
| 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 a = cin.nextInt();
var b = cin.nextInt();
var c = cin.nextInt();
Console.WriteLine((b / a) > c ? (b / a) : c);
}
}
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 a = cin.nextInt();
var b = cin.nextInt();
var c = cin.nextInt();
Console.WriteLine((b / a) < c ? (b / a) : c);
}
}
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();
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 47], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 18]]
| 8
| 587
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace program {
class Program {
static void Main() {
int[] a = Input.ScanIntArray();
Console.WriteLine(Math.Max(a[1] / a[0], a[2]));
}
}
static class Input {
static public int ScanInt() { return int.Parse(Console.ReadLine()); }
static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
static public long ScanLong() { return long.Parse(Console.ReadLine()); }
static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
static public int[] ScanIntArray() {
return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
}
static public uint[] ScanUintArray() {
return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray();
}
static public double[] ScanDoubleArray() {
return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
}
static public long[] ScanLongArray() {
return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
}
static public ulong[] ScanUlongArray() {
return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray();
}
static public string ScanStr() { return Console.ReadLine(); }
static public string[] ScanStrArray() { return ScanStr().Split(' '); }
}
static class MyMath {
public static int GCD(int a, int b) {
Func<int, int, int> gcd = null;
gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
return a > b ? gcd(a, b) : gcd(b, a);
}
public static ulong GCD(ulong a, ulong b) {
Func<ulong, ulong, ulong> gcd = null;
gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
return a > b ? gcd(a, b) : gcd(b, a);
}
public static int LCM(int a, int b) { return a * b / GCD(a, b); }
public static ulong LCM(ulong a, ulong b) { return a * b / GCD(a, b); }
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace program {
class Program {
static void Main() {
int[] a = Input.ScanIntArray();
Console.WriteLine(Math.Min(a[1] / a[0], a[2]));
}
}
static class Input {
static public int ScanInt() { return int.Parse(Console.ReadLine()); }
static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
static public long ScanLong() { return long.Parse(Console.ReadLine()); }
static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
static public int[] ScanIntArray() {
return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
}
static public uint[] ScanUintArray() {
return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray();
}
static public double[] ScanDoubleArray() {
return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
}
static public long[] ScanLongArray() {
return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
}
static public ulong[] ScanUlongArray() {
return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray();
}
static public string ScanStr() { return Console.ReadLine(); }
static public string[] ScanStrArray() { return ScanStr().Split(' '); }
}
static class MyMath {
public static int GCD(int a, int b) {
Func<int, int, int> gcd = null;
gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
return a > b ? gcd(a, b) : gcd(b, a);
}
public static ulong GCD(ulong a, ulong b) {
Func<ulong, ulong, ulong> gcd = null;
gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
return a > b ? gcd(a, b) : gcd(b, a);
}
public static int LCM(int a, int b) { return a * b / GCD(a, b); }
public static ulong LCM(ulong a, ulong b) { return a * b / GCD(a, b); }
}
}
|
[["-", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22]]
| 8
| 597
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
#if !DEBUG
using System.IO;
#endif
public class Program {
public static void Main() {
#region SetAutoFlushIsFalse
#if !DEBUG
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
#endif
#endregion
var abc = ReadLib.ReadAsIntArray();
var firstScore = abc[1] / abc[0];
Console.WriteLine(firstScore <= abc[2] ? abc[2] : firstScore);
#region Flush
#if !DEBUG
Console.Out.Flush();
sw.Close();
#endif
#endregion
}
}
static class Calculation {}
static class ReadLib {
public static long ReadAsLong() { return long.Parse(Console.ReadLine()); }
public static int ReadAsInt() { return int.Parse(Console.ReadLine()); }
public static int[] ReadAsIntArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => int.Parse(s) + step)
.ToArray();
}
public static long[] ReadAsLongArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => long.Parse(s) + step)
.ToArray();
}
public static ulong[] ReadAsULongArray() {
return Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray();
}
public static string[] ReadAsStringArray() {
return Console.ReadLine().Split(' ');
}
public static int[] ReadNTimesAsInt(int n, int step = 0) {
return Enumerable.Range(1, n)
.Select(s => int.Parse(Console.ReadLine()) + step)
.ToArray();
}
public static int[][] ReadNTimesAsIntArray(int n, int step = 0) {
return Enumerable.Range(1, n).Select(s => ReadAsIntArray(step)).ToArray();
}
public static string[] ReadNTimesAsString(int n) {
return Enumerable.Range(1, n).Select(s => Console.ReadLine()).ToArray();
}
}
static class MyMath {
/// <summary>階乗</summary>
public static long Factorial(int n) {
if (n == 0) {
return 1;
}
return Permutation(n, 0);
}
public static long Permutation(int n, int k) {
return Enumerable.Range(0, n - k)
.Select(i => n - i)
.Aggregate(1, (b, i) => b * i);
}
///// <summary>nCr, 組み合わせ</summary>
// public static long Combination(int n, int r) {
// if (r == 0) {
// return 1;
// }
// // 分子
// var moleculeArr = Enumerable
// .Range(0, Math.Min(n - r, r))
// .Select(i => n - i)
// .ToArray();
// var moleculeArrLength = moleculeArr.Length;
// // 分母
// var denominatorArr = Enumerable
// .Range(1, Math.Max(n - r, r))
// .ToArray();
// for (var m = 0; m < moleculeArrLength; m++) {
// while (true) {
// var mVal = moleculeArr[m];
// var gcds = denominatorArr.Select(b => Gcd(mVal, b));
// var maxGcd = gcds.Max();
// var maxI = gcds.ToList().IndexOf(maxGcd);
// if (maxGcd == 1) {
// break;
// }
// denominatorArr[maxI] /= (int)maxGcd;
// moleculeArr[m] /= (int)maxGcd;
// }
// }
// return FullPower(moleculeArr);
//}
#region FullPower
/// <summary>総乗、π</summary>
public static long FullPower(IEnumerable<long> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
public static long FullPower(IEnumerable<int> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
#endregion
/// <summary>最大公約数</summary>
public static long Gcd(long item1, long item2) {
var a = Math.Max(item1, item2);
var b = Math.Min(item1, item2);
while (true) {
long mod;
Math.DivRem(a, b, out mod);
if (mod == 0) {
break;
}
a = b;
b = mod;
}
return b;
}
/// <summary>約分。最大公約数で割ったものを返す。</summary>
public static Tuple<long, long> DeviedByGcd(long item1, long item2) {
var gcd = Gcd(item1, item2);
return new Tuple<long, long>(item1 / gcd, item2 / gcd);
}
public static long Lcm(int item1, int item2) {
return Math.BigMul(item1, item2) / Gcd(item1, item2);
}
}
static class MyMethod {
/// <summary>数え上げて、key, 出現回数に変換</summary>
public static Dictionary<T, int> CountUp<T>(IEnumerable<T> str) {
return str.GroupBy(c => c)
.Select(g => new KeyValuePair<T, int>(g.Key, g.Count()))
.ToDictionary(e => e.Key, e => e.Value);
}
}
/// <summary>あまりを計算するためのintのラッパー</summary>
struct ModInt {
int Value { get; }
int Mod { get; }
public override string ToString() { return Value.ToString(); }
public static explicit operator ModInt(long value) {
return new ModInt(value);
}
public ModInt(long value, int mod = 1000000007) {
this.Value = (int)(value % mod);
this.Mod = mod;
}
public static explicit operator int(ModInt modInt) { return modInt.Value; }
private static void CheckNotEqualMod(ModInt item1, ModInt item2) {
if (item1.Mod != item2.Mod) {
throw new Exception("mod not equal");
}
}
public static ModInt operator +(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = item1.Value + item2.Value;
return new ModInt(value, item1.Mod);
}
public static ModInt operator *(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = Math.BigMul(item1.Value, item2.Value);
return new ModInt(value, item1.Mod);
}
public static ModInt operator +(ModInt item1, int item2) {
long value = item1.Value + item2;
return new ModInt(value, item1.Mod);
}
public static ModInt operator *(ModInt item1, int item2) {
long value = Math.BigMul(item1.Value, item2);
return new ModInt(value, item1.Mod);
}
public override int GetHashCode() { return this.Value; }
public override bool Equals(object obj) {
if (obj == null || this.GetType() != obj.GetType()) {
return false;
}
var modIntObj = (ModInt)obj;
return modIntObj.Value == this.Value;
}
public static bool operator ==(ModInt item1, ModInt item2) {
return item1.Value == item2.Value;
}
public static bool operator !=(ModInt item1, ModInt item2) {
return !(item1 == item2);
}
public static bool operator ==(ModInt item1, int item2) {
return item1.Value == item2;
}
public static bool operator !=(ModInt item1, int item2) {
return !(item1.Value == item2);
}
public static bool operator >=(ModInt item1, ModInt item2) {
return item1.Value >= item2.Value;
}
public static bool operator <=(ModInt item1, ModInt item2) {
return item1.Value <= item2.Value;
}
public static bool operator >=(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator <=(ModInt item1, int item2) {
return item1.Value <= item2;
}
public static bool operator>(ModInt item1, ModInt item2) {
return item1.Value > item2.Value;
}
public static bool operator<(ModInt item1, ModInt item2) {
return item1.Value < item2.Value;
}
public static bool operator>(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator<(ModInt item1, int item2) {
return item1.Value <= item2;
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
#if !DEBUG
using System.IO;
#endif
public class Program {
public static void Main() {
#region SetAutoFlushIsFalse
#if !DEBUG
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
#endif
#endregion
var abc = ReadLib.ReadAsIntArray();
var firstScore = abc[1] / abc[0];
Console.WriteLine(firstScore >= abc[2] ? abc[2] : firstScore);
#region Flush
#if !DEBUG
Console.Out.Flush();
sw.Close();
#endif
#endregion
}
}
static class Calculation {}
static class ReadLib {
public static long ReadAsLong() { return long.Parse(Console.ReadLine()); }
public static int ReadAsInt() { return int.Parse(Console.ReadLine()); }
public static int[] ReadAsIntArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => int.Parse(s) + step)
.ToArray();
}
public static long[] ReadAsLongArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => long.Parse(s) + step)
.ToArray();
}
public static ulong[] ReadAsULongArray() {
return Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray();
}
public static string[] ReadAsStringArray() {
return Console.ReadLine().Split(' ');
}
public static int[] ReadNTimesAsInt(int n, int step = 0) {
return Enumerable.Range(1, n)
.Select(s => int.Parse(Console.ReadLine()) + step)
.ToArray();
}
public static int[][] ReadNTimesAsIntArray(int n, int step = 0) {
return Enumerable.Range(1, n).Select(s => ReadAsIntArray(step)).ToArray();
}
public static string[] ReadNTimesAsString(int n) {
return Enumerable.Range(1, n).Select(s => Console.ReadLine()).ToArray();
}
}
static class MyMath {
/// <summary>階乗</summary>
public static long Factorial(int n) {
if (n == 0) {
return 1;
}
return Permutation(n, 0);
}
public static long Permutation(int n, int k) {
return Enumerable.Range(0, n - k)
.Select(i => n - i)
.Aggregate(1, (b, i) => b * i);
}
///// <summary>nCr, 組み合わせ</summary>
// public static long Combination(int n, int r) {
// if (r == 0) {
// return 1;
// }
// // 分子
// var moleculeArr = Enumerable
// .Range(0, Math.Min(n - r, r))
// .Select(i => n - i)
// .ToArray();
// var moleculeArrLength = moleculeArr.Length;
// // 分母
// var denominatorArr = Enumerable
// .Range(1, Math.Max(n - r, r))
// .ToArray();
// for (var m = 0; m < moleculeArrLength; m++) {
// while (true) {
// var mVal = moleculeArr[m];
// var gcds = denominatorArr.Select(b => Gcd(mVal, b));
// var maxGcd = gcds.Max();
// var maxI = gcds.ToList().IndexOf(maxGcd);
// if (maxGcd == 1) {
// break;
// }
// denominatorArr[maxI] /= (int)maxGcd;
// moleculeArr[m] /= (int)maxGcd;
// }
// }
// return FullPower(moleculeArr);
//}
#region FullPower
/// <summary>総乗、π</summary>
public static long FullPower(IEnumerable<long> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
public static long FullPower(IEnumerable<int> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
#endregion
/// <summary>最大公約数</summary>
public static long Gcd(long item1, long item2) {
var a = Math.Max(item1, item2);
var b = Math.Min(item1, item2);
while (true) {
long mod;
Math.DivRem(a, b, out mod);
if (mod == 0) {
break;
}
a = b;
b = mod;
}
return b;
}
/// <summary>約分。最大公約数で割ったものを返す。</summary>
public static Tuple<long, long> DeviedByGcd(long item1, long item2) {
var gcd = Gcd(item1, item2);
return new Tuple<long, long>(item1 / gcd, item2 / gcd);
}
public static long Lcm(int item1, int item2) {
return Math.BigMul(item1, item2) / Gcd(item1, item2);
}
}
static class MyMethod {
/// <summary>数え上げて、key, 出現回数に変換</summary>
public static Dictionary<T, int> CountUp<T>(IEnumerable<T> str) {
return str.GroupBy(c => c)
.Select(g => new KeyValuePair<T, int>(g.Key, g.Count()))
.ToDictionary(e => e.Key, e => e.Value);
}
}
/// <summary>あまりを計算するためのintのラッパー</summary>
struct ModInt {
int Value { get; }
int Mod { get; }
public override string ToString() { return Value.ToString(); }
public static explicit operator ModInt(long value) {
return new ModInt(value);
}
public ModInt(long value, int mod = 1000000007) {
this.Value = (int)(value % mod);
this.Mod = mod;
}
public static explicit operator int(ModInt modInt) { return modInt.Value; }
private static void CheckNotEqualMod(ModInt item1, ModInt item2) {
if (item1.Mod != item2.Mod) {
throw new Exception("mod not equal");
}
}
public static ModInt operator +(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = item1.Value + item2.Value;
return new ModInt(value, item1.Mod);
}
public static ModInt operator *(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = Math.BigMul(item1.Value, item2.Value);
return new ModInt(value, item1.Mod);
}
public static ModInt operator +(ModInt item1, int item2) {
long value = item1.Value + item2;
return new ModInt(value, item1.Mod);
}
public static ModInt operator *(ModInt item1, int item2) {
long value = Math.BigMul(item1.Value, item2);
return new ModInt(value, item1.Mod);
}
public override int GetHashCode() { return this.Value; }
public override bool Equals(object obj) {
if (obj == null || this.GetType() != obj.GetType()) {
return false;
}
var modIntObj = (ModInt)obj;
return modIntObj.Value == this.Value;
}
public static bool operator ==(ModInt item1, ModInt item2) {
return item1.Value == item2.Value;
}
public static bool operator !=(ModInt item1, ModInt item2) {
return !(item1 == item2);
}
public static bool operator ==(ModInt item1, int item2) {
return item1.Value == item2;
}
public static bool operator !=(ModInt item1, int item2) {
return !(item1.Value == item2);
}
public static bool operator >=(ModInt item1, ModInt item2) {
return item1.Value >= item2.Value;
}
public static bool operator <=(ModInt item1, ModInt item2) {
return item1.Value <= item2.Value;
}
public static bool operator >=(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator <=(ModInt item1, int item2) {
return item1.Value <= item2;
}
public static bool operator>(ModInt item1, ModInt item2) {
return item1.Value > item2.Value;
}
public static bool operator<(ModInt item1, ModInt item2) {
return item1.Value < item2.Value;
}
public static bool operator>(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator<(ModInt item1, int item2) {
return item1.Value <= item2;
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 20]]
| 8
| 1,521
| 2
|
using System;
namespace ABC120_a {
class Program {
static void Main(string[] args) {
int d;
string[] array = Console.ReadLine().Split(' ');
int a = int.Parse(array[0]);
int b = int.Parse(array[1]);
int c = int.Parse(array[2]);
d = b / a;
if (d > c) {
Console.WriteLine(d);
} else {
Console.WriteLine(d);
}
}
}
}
|
using System;
namespace ABC120_a {
class Program {
static void Main(string[] args) {
int d;
string[] array = Console.ReadLine().Split(' ');
int a = int.Parse(array[0]);
int b = int.Parse(array[1]);
int c = int.Parse(array[2]);
d = b / a;
if (d > c) {
Console.WriteLine(c);
} else {
Console.WriteLine(d);
}
}
}
}
|
[["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
| 8
| 113
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC120_A {
class Program {
static void Main(string[] args) {
string[] strs = Console.ReadLine().Split(' ');
int a = int.Parse(strs[0]);
int b = int.Parse(strs[1]);
int c = int.Parse(strs[2]);
int count = b / a;
if (count > c)
count = c;
Console.WriteLine("{0}", c);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC120_A {
class Program {
static void Main(string[] args) {
string[] strs = Console.ReadLine().Split(' ');
int a = int.Parse(strs[0]);
int b = int.Parse(strs[1]);
int c = int.Parse(strs[2]);
int count = b / a;
if (count > c)
count = c;
Console.WriteLine("{0}", count);
}
}
}
|
[["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
| 8
| 131
| 2
|
using System;
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split(' ');
int cost = int.Parse(input[0]);
int money = int.Parse(input[1]);
int max = int.Parse(input[2]);
if (money / cost >= max)
Console.WriteLine("4");
else
Console.WriteLine(money / cost);
}
}
|
using System;
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split(' ');
int cost = int.Parse(input[0]);
int money = int.Parse(input[1]);
int max = int.Parse(input[2]);
if (money / cost >= max)
Console.WriteLine(max);
else
Console.WriteLine(money / cost);
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 62], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 64, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
| 8
| 102
| 4
|
using System;
using System.Linq;
class Program {
static void Main() {
int ans;
int[] input =
Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
if (input[1] / input[0] > input[2]) {
ans = input[3];
} else {
ans = (input[1] / input[0]);
}
Console.WriteLine(ans);
Console.ReadLine();
}
}
|
using System;
using System.Linq;
class Program {
static void Main() {
int ans;
int[] input =
Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
if (input[1] / input[0] > input[2]) {
ans = input[2];
} else {
ans = (input[1] / input[0]);
}
Console.WriteLine(ans);
Console.ReadLine();
}
}
|
[["-", 0, 11, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 11, 12, 204, 206, 207, 0, 28, 0, 203]]
| 8
| 109
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace CompetitiveProgramming {
class Program {
static void Main(string[] args) { MainStream(); }
static void MainStream() {
string[] a_b_c = Console.ReadLine().Split(' ');
int a = int.Parse(a_b_c[0]);
int b = int.Parse(a_b_c[1]);
int c = int.Parse(a_b_c[2]);
int count = b / a;
if (count < c) {
Console.WriteLine(c);
} else {
Console.WriteLine(count);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace CompetitiveProgramming {
class Program {
static void Main(string[] args) { MainStream(); }
static void MainStream() {
string[] a_b_c = Console.ReadLine().Split(' ');
int a = int.Parse(a_b_c[0]);
int b = int.Parse(a_b_c[1]);
int c = int.Parse(a_b_c[2]);
int count = b / a;
if (count < c) {
Console.WriteLine(count);
} else {
Console.WriteLine(c);
}
}
}
}
|
[["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
| 8
| 134
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCorder {
public class Program {
static void Main(string[] args) { A(); }
public static void A() {
Scanner cin = new Scanner();
int a = cin.NextInt();
int b = cin.NextInt();
int c = cin.NextInt();
int temp = b / a;
Console.WriteLine(Math.Max(temp, c));
}
}
public 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 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 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;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCorder {
public class Program {
static void Main(string[] args) { A(); }
public static void A() {
Scanner cin = new Scanner();
int a = cin.NextInt();
int b = cin.NextInt();
int c = cin.NextInt();
int temp = b / a;
Console.WriteLine(Math.Min(temp, c));
}
}
public 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 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 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;
}
}
}
|
[["-", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22]]
| 8
| 466
| 2
|
using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;
class Program {
static void Main(string[] Args) {
var list = new List<string>(ReadLine().Split(' '))
.Select(ele => Int32.Parse(ele))
.ToList();
int Result =
(int)Math.Min(Math.Ceiling(list[1] / (double)list[0]), list[2]);
WriteLine(Result);
ReadLine();
}
}
|
using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;
class Program {
static void Main(string[] Args) {
var list = new List<string>(ReadLine().Split(' '))
.Select(ele => Int32.Parse(ele))
.ToList();
int Result = (int)Math.Min(Math.Floor(list[1] / (double)list[0]), list[2]);
WriteLine(Result);
ReadLine();
}
}
|
[["-", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22]]
| 8
| 116
| 2
|
using System;
namespace ABC119_a {
class Program {
static void Main(string[] args) {
string[] array = Console.ReadLine().Split('/');
int a = int.Parse(array[0]);
int b = int.Parse(array[1]);
int c = int.Parse(array[2]);
if (a < 2019) {
Console.WriteLine("Heisei");
} else if ((a <= 2019) && (b <= 04)) {
Console.WriteLine("Heisei");
} else {
Console.WriteLine("TBT");
}
}
}
}
|
using System;
namespace ABC119_a {
class Program {
static void Main(string[] args) {
string[] array = Console.ReadLine().Split('/');
int a = int.Parse(array[0]);
int b = int.Parse(array[1]);
int c = int.Parse(array[2]);
if (a < 2019) {
Console.WriteLine("Heisei");
} else if ((a == 2019) && (b <= 04)) {
Console.WriteLine("Heisei");
} else {
Console.WriteLine("TBD");
}
}
}
}
|
[["-", 75, 57, 15, 16, 31, 23, 0, 16, 17, 19], ["+", 75, 57, 15, 16, 31, 23, 0, 16, 17, 60], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 134
| 4
|
using System;
class Plogram {
static void Main() {
Console.WriteLine(
int.Parse(Console.ReadLine().Substring(5, 2)) <= 4 ? "Heisei" : "HBD");
}
}
|
using System;
class Plogram {
static void Main() {
Console.WriteLine(
int.Parse(Console.ReadLine().Substring(5, 2)) <= 4 ? "Heisei" : "TBD");
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222]]
| 8
| 47
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;
class Program {
static void Main() {
string S = Console.ReadLine();
if (string.Compare(S, "2019/04/30") <= 0) {
Console.WriteLine("Heisi");
} else {
Console.WriteLine("TBD");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;
class Program {
static void Main() {
string S = Console.ReadLine();
if (string.Compare(S, "2019/04/30") <= 0) {
Console.WriteLine("Heisei");
} else {
Console.WriteLine("TBD");
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 97
| 2
|
using System;
namespace ConsoleApp17 {
class Program {
static void Main(string[] args) {
String[] S = Console.ReadLine().Split('/');
int Y = int.Parse(S[0]);
int M = int.Parse(S[1]);
int D = int.Parse(S[2]);
if (Y < 2019 || Y == 2019 && M < 4 || Y == 2019 && M == 4 && D <= 30) {
Console.WriteLine("Heisei");
} else {
Console.Write("TDB");
}
}
}
}
|
using System;
namespace ConsoleApp17 {
class Program {
static void Main(string[] args) {
String[] S = Console.ReadLine().Split('/');
int Y = int.Parse(S[0]);
int M = int.Parse(S[1]);
int D = int.Parse(S[2]);
if (Y < 2019 || Y == 2019 && M < 4 || Y == 2019 && M == 4 && D <= 30) {
Console.WriteLine("Heisei");
} else {
Console.Write("TBD");
}
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 128
| 2
|
using System;
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split('/');
int year = int.Parse(input[0]);
int month = int.Parse(input[1]);
int day = int.Parse(input[2]);
if (year == 2019) {
if (month <= 4)
Console.WriteLine("heisei");
else
Console.WriteLine("TBD");
} else if (year >= 2020)
Console.WriteLine("TBD");
else if (year <= 2018)
Console.WriteLine("heisei");
}
}
|
using System;
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split('/');
int year = int.Parse(input[0]);
int month = int.Parse(input[1]);
int day = int.Parse(input[2]);
if (year == 2019) {
if (month <= 4)
Console.WriteLine("Heisei");
else
Console.WriteLine("TBD");
} else if (year >= 2020)
Console.WriteLine("TBD");
else if (year <= 2018)
Console.WriteLine("Heisei");
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 140
| 4
|
using System;
namespace b119A {
class Program {
static void Main(string[] args) {
Console.WriteLine(int.Parse(Console.ReadLine().Split('/')[1]) > 4 ? "Heisei"
: "TBD");
}
}
}
|
using System;
namespace b119A {
class Program {
static void Main(string[] args) {
Console.WriteLine(
int.Parse(Console.ReadLine().Split('/')[1]) <= 4 ? "Heisei" : "TBD");
}
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 47], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19]]
| 8
| 58
| 2
|
using System;
using System.Collections.Generic;
namespace CompetitiveProgramming {
class Program {
static void Main(string[] args) {
string[] s = Console.ReadLine().Split('/');
int y = int.Parse(s[0]);
int m = int.Parse(s[1]);
int d = int.Parse(s[2]);
if (y <= 2019) {
if (y < 2019 || (y == 2019 && d <= 4)) {
Console.WriteLine("Heisei");
} else {
Console.WriteLine("TBD");
}
} else {
Console.WriteLine("TBD");
}
}
}
}
|
using System;
using System.Collections.Generic;
namespace CompetitiveProgramming {
class Program {
static void Main(string[] args) {
string[] s = Console.ReadLine().Split('/');
int y = int.Parse(s[0]);
int m = int.Parse(s[1]);
int d = int.Parse(s[2]);
if (y <= 2019) {
if (y < 2019 || (y == 2019 && m <= 4)) {
Console.WriteLine("Heisei");
} else {
Console.WriteLine("TBD");
}
} else {
Console.WriteLine("TBD");
}
}
}
}
|
[["-", 15, 16, 12, 23, 0, 16, 12, 16, 31, 22], ["+", 15, 16, 12, 23, 0, 16, 12, 16, 31, 22]]
| 8
| 145
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Main {
class Program {
static void Main(string[] arg) {
var answer = "";
// int n = int.Parse(Console.ReadLine());
string[] str = Console.ReadLine().Split('/');
if (int.Parse(str[0]) > 2019) {
answer = "TBD";
} else if (int.Parse(str[0]) == 2019) {
if (int.Parse(str[1]) > 5) {
answer = "TBD";
} else {
answer = "Heisei";
}
} else {
answer = "Heisei";
}
Console.WriteLine(answer);
Console.ReadLine();
}
private static int[] GetIntList(string line) {
return line.Split(' ').Select(x => int.Parse(x)).ToArray();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Main {
class Program {
static void Main(string[] arg) {
var answer = "";
string[] str = Console.ReadLine().Split('/');
if (int.Parse(str[0]) > 2019) {
answer = "TBD";
} else if (int.Parse(str[0]) == 2019) {
if (int.Parse(str[1]) >= 5) {
answer = "TBD";
} else {
answer = "Heisei";
}
} else {
answer = "Heisei";
}
Console.WriteLine(answer);
Console.ReadLine();
}
private static int[] GetIntList(string line) {
return line.Split(' ').Select(x => int.Parse(x)).ToArray();
}
}
}
|
[["-", 75, 57, 64, 196, 0, 57, 15, 16, 17, 47], ["+", 75, 57, 64, 196, 0, 57, 15, 16, 17, 20]]
| 8
| 201
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp4 {
class Program {
static void Main(string[] args) {
// for (; ; )
// {
string S = Console.ReadLine();
string[] date = S.Split('/');
int month = int.Parse(date[1]);
if (month <= 4) {
Console.WriteLine("Heisei");
} else {
Console.WriteLine("SBD");
}
//}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp4 {
class Program {
static void Main(string[] args) {
// for (; ; )
// {
string S = Console.ReadLine();
string[] date = S.Split('/');
int month = int.Parse(date[1]);
if (month <= 4) {
Console.WriteLine("Heisei");
} else {
Console.WriteLine("TBD");
}
//}
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 114
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
namespace AtCoder {
class Program {
static void Main() {
var n = long.Parse(ReadLine().Replace("/", ""));
WriteLine(n > 20190430 ? "TDB" : "Heisei");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
namespace AtCoder {
class Program {
static void Main() {
var n = long.Parse(ReadLine().Replace("/", ""));
WriteLine(n > 20190430 ? "TBD" : "Heisei");
}
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222]]
| 8
| 78
| 2
|
using System;
using System.Linq;
class Program {
public static void Main(string[] args) {
int[] s = Console.ReadLine().Split('/').Select(int.Parse).ToArray();
if (s[0] > 2019)
Console.WriteLine("TBD");
else {
if (s[1] > 5)
Console.WriteLine("TBD");
else {
Console.WriteLine("Heisei");
}
}
}
}
|
using System;
using System.Linq;
class Program {
public static void Main(string[] args) {
int[] s = Console.ReadLine().Split('/').Select(int.Parse).ToArray();
if (s[0] > 2019)
Console.WriteLine("TBD");
else {
if (s[1] > 4)
Console.WriteLine("TBD");
else {
Console.WriteLine("Heisei");
}
}
}
}
|
[["-", 0, 57, 75, 196, 0, 57, 15, 16, 12, 203], ["+", 0, 57, 75, 196, 0, 57, 15, 16, 12, 203]]
| 8
| 104
| 2
|
using System;
using System.Linq;
namespace AtCoder {
class Program {
static void Main(string[] args) {
var input =
Console.ReadLine().Split('/').Select(x => int.Parse(x)).ToArray();
if (input[0] > 2019) {
Console.WriteLine("TDB");
return;
}
if (input[0] < 2019) {
Console.WriteLine("Heisei");
return;
}
if (input[1] > 4) {
Console.WriteLine("TDB");
return;
}
if (input[1] < 4) {
Console.WriteLine("Heisei");
return;
}
if (input[2] > 30) {
Console.WriteLine("TDB");
return;
}
Console.WriteLine("Heisei");
}
}
}
|
using System;
using System.Linq;
namespace AtCoder {
class Program {
static void Main(string[] args) {
var input =
Console.ReadLine().Split('/').Select(x => int.Parse(x)).ToArray();
if (input[0] > 2019) {
Console.WriteLine("TBD");
return;
}
if (input[0] < 2019) {
Console.WriteLine("Heisei");
return;
}
if (input[1] > 4) {
Console.WriteLine("TBD");
return;
}
if (input[1] < 4) {
Console.WriteLine("Heisei");
return;
}
if (input[2] > 30) {
Console.WriteLine("TBD");
return;
}
Console.WriteLine("Heisei");
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 178
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC119 {
class A {
static void Main(string[] args) {
string s = Console.ReadLine();
string ans = "";
if ((int.Parse(s.Substring(0, 4)) < 2019)) {
ans = "Heisei";
} else if ((int.Parse(s.Substring(0, 4)) > 2019)) {
ans = "TBD";
} else {
if ((int.Parse(s.Substring(4, 2)) <= 4)) {
ans = "Heisei";
} else {
ans = "TBD";
}
}
Console.WriteLine(ans);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC119 {
class A {
static void Main(string[] args) {
string s = Console.ReadLine();
string ans = "";
if ((int.Parse(s.Substring(0, 4)) < 2019)) {
ans = "Heisei";
} else if ((int.Parse(s.Substring(0, 4)) > 2019)) {
ans = "TBD";
} else {
if ((int.Parse(s.Substring(5, 2)) <= 4)) {
ans = "Heisei";
} else {
ans = "TBD";
}
}
Console.WriteLine(ans);
}
}
}
|
[["-", 0, 28, 0, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 28, 0, 213, 3, 4, 0, 28, 0, 203]]
| 8
| 165
| 2
|
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder.Contest.B {
static class Program {
public static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
var cin = new Scanner();
int n = cin.NextInt();
decimal ans = 0;
for (int i = 0; i < n; i++) {
var x = decimal.Parse(cin.Next());
if (cin.Next() == "JPN")
ans += x;
else
ans += x * 380000;
}
Console.WriteLine(ans);
Console.Out.Flush();
}
}
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 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 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;
}
}
}
|
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder.Contest.B {
static class Program {
public static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
var cin = new Scanner();
int n = cin.NextInt();
decimal ans = 0;
for (int i = 0; i < n; i++) {
var x = decimal.Parse(cin.Next());
if (cin.Next() == "JPY")
ans += x;
else
ans += x * 380000;
}
Console.WriteLine(ans);
Console.Out.Flush();
}
}
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 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 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;
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 12, 5, 0, 222], ["+", 8, 196, 0, 57, 15, 16, 12, 5, 0, 222]]
| 8
| 522
| 2
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
class Program {
public static Scanner cin;
static void Main() {
cin = new Scanner();
int n = cin.inputInt();
string[][] xu = new string[n][];
for (int a = 0; a < n; a++) {
xu[n] = ReadLine().Split();
}
double total = 0;
for (int a = 0; a < n; a++) {
if (xu[a][1] == "BTC") {
total += double.Parse(xu[a][0]) * 380000.0;
} else {
total += double.Parse(xu[a][0]);
}
}
WriteLine(total);
}
static int CountChar(string s, string key) {
return s.Length - s.Replace(key, "").Length;
}
}
class Scanner {
string[] s;
int i;
char[] cs = new char[] { ' ' };
public Scanner() {
s = new string[0];
i = 0;
}
public string input() {
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 input();
i = 0;
return s[i++];
}
public int inputInt() { return int.Parse(input()); }
public int[] arrayInt(int N, int add = 0) {
int[] Array = new int[N];
for (int i = 0; i < N; i++) {
Array[i] = inputInt() + add;
}
return Array;
}
public long inputLong() { return long.Parse(input()); }
public long[] arrayLong(int N, long add = 0) {
long[] Array = new long[N];
for (int i = 0; i < N; i++) {
Array[i] = inputLong() + add;
}
return Array;
}
public double inputDouble() { return double.Parse(input()); }
public double[] arrayDouble(int N, double add = 0) {
double[] Array = new double[N];
for (int i = 0; i < N; i++) {
Array[i] = inputDouble() + add;
}
return Array;
}
}
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
class Program {
public static Scanner cin;
static void Main() {
cin = new Scanner();
int n = cin.inputInt();
string[][] xu = new string[n][];
for (int a = 0; a < n; a++) {
xu[a] = ReadLine().Split();
}
double total = 0;
for (int a = 0; a < n; a++) {
if (xu[a][1] == "BTC") {
total += double.Parse(xu[a][0]) * 380000.0;
} else {
total += double.Parse(xu[a][0]);
}
}
WriteLine(total);
}
static int CountChar(string s, string key) {
return s.Length - s.Replace(key, "").Length;
}
}
class Scanner {
string[] s;
int i;
char[] cs = new char[] { ' ' };
public Scanner() {
s = new string[0];
i = 0;
}
public string input() {
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 input();
i = 0;
return s[i++];
}
public int inputInt() { return int.Parse(input()); }
public int[] arrayInt(int N, int add = 0) {
int[] Array = new int[N];
for (int i = 0; i < N; i++) {
Array[i] = inputInt() + add;
}
return Array;
}
public long inputLong() { return long.Parse(input()); }
public long[] arrayLong(int N, long add = 0) {
long[] Array = new long[N];
for (int i = 0; i < N; i++) {
Array[i] = inputLong() + add;
}
return Array;
}
public double inputDouble() { return double.Parse(input()); }
public double[] arrayDouble(int N, double add = 0) {
double[] Array = new double[N];
for (int i = 0; i < N; i++) {
Array[i] = inputDouble() + add;
}
return Array;
}
}
|
[["-", 0, 11, 31, 204, 206, 207, 0, 28, 0, 22], ["+", 0, 11, 31, 204, 206, 207, 0, 28, 0, 22]]
| 8
| 580
| 2
|
using System;
class Problem {
static void Main() {
int N = int.Parse(Console.ReadLine());
decimal m;
string u;
decimal money = 0;
for (int i = 0; i < N; i++) {
string[] a = Console.ReadLine().Split(' ');
m = decimal.Parse(a[0]);
if (a[1] == "BTC") {
money += 38000 * m;
} else {
money += m;
}
}
Console.WriteLine(money);
}
}
|
using System;
class Problem {
static void Main() {
int N = int.Parse(Console.ReadLine());
decimal m;
string u;
decimal money = 0;
for (int i = 0; i < N; i++) {
string[] a = Console.ReadLine().Split(' ');
m = decimal.Parse(a[0]);
if (a[1] == "BTC") {
money += 380000 * m;
} else {
money += m;
}
}
Console.WriteLine(money);
}
}
|
[["-", 64, 196, 0, 1, 0, 11, 12, 16, 31, 203], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 31, 203]]
| 8
| 118
| 2
|
using System;
class Program {
static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
int count = 0;
double JPYs = 0;
double BTCs = 0;
while (true) {
++count;
if (count == N)
break;
string[] str = Console.ReadLine().Split(' ');
double x = double.Parse(str[0]);
string y = str[1];
if (y == "JPY") {
JPYs += x;
} else if (y == "BTC") {
BTCs += x;
}
}
Console.WriteLine(JPYs + (BTCs * 0.1 * 380000.0));
}
}
|
using System;
class Program {
static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
int count = 0;
double JPYs = 0;
double BTCs = 0;
while (true) {
++count;
if (count > N)
break;
string[] str = Console.ReadLine().Split(' ');
double x = double.Parse(str[0]);
string y = str[1];
if (y == "JPY") {
JPYs += x;
} else if (y == "BTC") {
BTCs += x;
}
}
Console.WriteLine(JPYs + (BTCs * 380000.0));
}
}
|
[["-", 0, 52, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 17, 47], ["-", 0, 16, 12, 23, 0, 16, 31, 16, 17, 48], ["-", 0, 16, 12, 23, 0, 16, 31, 16, 12, 250]]
| 8
| 147
| 4
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace AtCoder {
class Program {
public static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
double su = 0.0;
for (int i = 0; i < N; i++) {
string[] s = Console.ReadLine().Split(' ');
double x = double.Parse(s[0]);
if (s[1] == "JPY") {
su += x;
} else if (s[1] == "BTC") {
su += x * 380000.0;
}
}
Console.WriteLine("{0:0.5f}", su);
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace AtCoder {
class Program {
public static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
double su = 0.0;
for (int i = 0; i < N; i++) {
string[] s = Console.ReadLine().Split(' ');
double x = double.Parse(s[0]);
if (s[1] == "JPY") {
su += x;
} else if (s[1] == "BTC") {
su += x * 380000.0;
}
}
Console.WriteLine("{0:0.00000}", su);
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 149
| 2
|
using System;
namespace ABC119_B {
class Program {
static void Main(string[] args) {
var n = int.Parse(Console.ReadLine());
var sum = 0;
for (int i = 0; i < n; i++) {
var xu = Console.ReadLine().Split();
if (xu[1] == "BTC") {
sum += (int)(decimal.Parse(xu[0]) * 380000);
} else {
sum += int.Parse(xu[0]);
}
}
Console.WriteLine(sum);
}
}
}
|
using System;
namespace ABC119_B {
class Program {
static void Main(string[] args) {
var n = int.Parse(Console.ReadLine());
decimal sum = 0;
for (int i = 0; i < n; i++) {
var xu = Console.ReadLine().Split();
if (xu[1] == "BTC") {
sum += (decimal.Parse(xu[0]) * 380000);
} else {
sum += int.Parse(xu[0]);
}
}
Console.WriteLine(sum);
}
}
}
|
[["-", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 64, 196, 0, 1, 0, 11, 12, 74, 0, 24], ["-", 64, 196, 0, 1, 0, 11, 12, 74, 39, 199], ["-", 64, 196, 0, 1, 0, 11, 12, 74, 0, 25]]
| 8
| 124
| 5
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
class Program {
public static int n;
public static int a;
public static int b;
public static int c;
public static int[] l;
static void Main(string[] args) {
// 入力
// var s = Console.ReadLine();
// var n = int.Parse(Console.ReadLine());
int[] nabc = Console.ReadLine().Split().Select(int.Parse).ToArray();
n = nabc[0];
a = nabc[1];
b = nabc[2];
c = nabc[3];
l = new int[n];
for (int i = 0; i < n; i++) {
l[i] = int.Parse(Console.ReadLine());
}
var ans = dfs(0, 0, 0, 0);
// 出力
Console.WriteLine(ans);
}
static int dfs(int cur, int x, int y, int z) {
if (cur == n) {
if (x == 0 || y == 0 || z == 0) {
return int.MaxValue;
} else {
return Math.Abs(x - a) + Math.Abs(y - b) + Math.Abs(z - c) - 30;
}
} else {
int ret0 = dfs(cur + 1, x, y, z);
int ret1 = dfs(cur + 1, x + l[cur], y, z) + 10;
int ret2 = dfs(cur + 1, x, y + l[cur], z) + 10;
int ret3 = dfs(cur + 1, x, y, z + l[cur]) + 10;
var tmp = Math.Min(ret0, ret1);
tmp = Math.Min(tmp, ret2);
tmp = Math.Min(tmp, ret3);
return tmp;
}
}
}
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
class Program {
public static int n;
public static int a;
public static int b;
public static int c;
public static int[] l;
static void Main(string[] args) {
// 入力
// var s = Console.ReadLine();
// var n = int.Parse(Console.ReadLine());
int[] nabc = Console.ReadLine().Split().Select(int.Parse).ToArray();
n = nabc[0];
a = nabc[1];
b = nabc[2];
c = nabc[3];
l = new int[n];
for (int i = 0; i < n; i++) {
l[i] = int.Parse(Console.ReadLine());
}
var ans = dfs(0, 0, 0, 0);
// 出力
Console.WriteLine(ans);
}
static int dfs(int cur, int x, int y, int z) {
if (cur == n) {
if (x == 0 || y == 0 || z == 0) {
return int.MaxValue - 10;
} else {
return Math.Abs(x - a) + Math.Abs(y - b) + Math.Abs(z - c) - 30;
}
} else {
int ret0 = dfs(cur + 1, x, y, z);
int ret1 = dfs(cur + 1, x + l[cur], y, z) + 10;
int ret2 = dfs(cur + 1, x, y + l[cur], z) + 10;
int ret3 = dfs(cur + 1, x, y, z + l[cur]) + 10;
var tmp = Math.Min(ret0, ret1);
tmp = Math.Min(tmp, ret2);
tmp = Math.Min(tmp, ret3);
return tmp;
}
}
}
|
[["+", 0, 57, 64, 196, 0, 37, 0, 16, 17, 33], ["+", 0, 57, 64, 196, 0, 37, 0, 16, 12, 203]]
| 8
| 391
| 2
|
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
class P {
static void Main() {
var nabc = Console.ReadLine().Split().Select(int.Parse).ToList();
var l = Enumerable.Repeat(0, nabc[0])
.Select(_ => int.Parse(Console.ReadLine()))
.ToList();
var min = int.MaxValue;
for (int i = 0; i < 1 << (nabc[0] * 2); i++) {
int mp = 0;
int a = 0;
int b = 0;
int c = 0;
for (int j = 0; j < nabc[0]; j++) {
var state = i >> (j * 2) & 3;
if (state == 1) {
if (a != 0)
mp += 10;
a += l[j];
}
if (state == 2) {
if (b != 0)
mp += 10;
b += l[j];
}
if (state == 3) {
if (b != 0)
mp += 10;
b += l[j];
}
}
if (a == 0 || b == 0 || c == 0)
continue;
mp += Abs(nabc[1] - a);
mp += Abs(nabc[2] - b);
mp += Abs(nabc[3] - c);
min = Min(min, mp);
}
Console.WriteLine(min);
}
}
|
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
class P {
static void Main() {
var nabc = Console.ReadLine().Split().Select(int.Parse).ToList();
var l = Enumerable.Repeat(0, nabc[0])
.Select(_ => int.Parse(Console.ReadLine()))
.ToList();
var min = int.MaxValue;
for (int i = 0; i < 1 << (nabc[0] * 2); i++) {
int mp = 0;
int a = 0;
int b = 0;
int c = 0;
for (int j = 0; j < nabc[0]; j++) {
var state = i >> (j * 2) & 3;
if (state == 1) {
if (a != 0)
mp += 10;
a += l[j];
}
if (state == 2) {
if (b != 0)
mp += 10;
b += l[j];
}
if (state == 3) {
if (c != 0)
mp += 10;
c += l[j];
}
}
if (a == 0 || b == 0 || c == 0)
continue;
mp += Abs(nabc[1] - a);
mp += Abs(nabc[2] - b);
mp += Abs(nabc[3] - c);
min = Min(min, mp);
}
Console.WriteLine(min);
}
}
|
[["-", 0, 57, 64, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 57, 64, 196, 0, 57, 15, 16, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22]]
| 8
| 361
| 4
|
using System;
public class S {
public static void Main() {
var input = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
var A = input[0];
var B = input[1];
var Q = input[2];
var jinja = new long[A];
var tera = new long[B];
var quiz = new long[Q];
var answer = new long[Q];
long tmpAnswer = 0;
long lbTera, lbJinja;
for (int i = 0; i < A; i++) {
jinja[i] = long.Parse(Console.ReadLine());
}
for (int i = 0; i < B; i++) {
tera[i] = long.Parse(Console.ReadLine());
}
for (int i = 0; i < Q; i++) {
quiz[i] = long.Parse(Console.ReadLine());
lbTera = lower_bound(tera, quiz[i]);
lbJinja = lower_bound(jinja, quiz[i]);
tmpAnswer = long.MaxValue;
// 0,0
if (lbTera >= 0 && lbJinja >= 0) {
if (tera[lbTera] > jinja[lbJinja]) {
tmpAnswer = Math.Min(tmpAnswer, (quiz[i] - tera[lbTera]) +
(tera[lbTera] - jinja[lbJinja]));
} else {
tmpAnswer = Math.Min(tmpAnswer, (quiz[i] - jinja[lbJinja]) +
(jinja[lbJinja] - tera[lbTera]));
}
}
// 1,1
if (lbTera < B - 1 && lbJinja < A - 1) {
if (tera[lbTera + 1] > jinja[lbJinja + 1]) {
tmpAnswer =
Math.Min(tmpAnswer, (jinja[lbJinja + 1] - quiz[i]) +
(tera[lbTera + 1] - jinja[lbJinja + 1]));
} else {
tmpAnswer =
Math.Min(tmpAnswer, (tera[lbJinja + 1] - quiz[i]) +
(jinja[lbJinja + 1] - tera[lbTera + 1]));
}
}
// 1,0
if (lbTera < B - 1 && lbJinja >= 0) {
if (Math.Abs(tera[lbTera + 1] - quiz[i]) >
Math.Abs(jinja[lbJinja] - quiz[i])) {
tmpAnswer =
Math.Min(tmpAnswer, (quiz[i] - jinja[lbJinja]) +
(tera[lbTera + 1] - jinja[lbJinja]));
} else {
tmpAnswer =
Math.Min(tmpAnswer, (tera[lbTera + 1] - quiz[i]) +
(tera[lbTera + 1] - jinja[lbJinja]));
}
}
// 0,1
if (lbTera >= 0 && lbJinja < A - 1) {
if (Math.Abs(tera[lbTera] - quiz[i]) >
Math.Abs(jinja[lbJinja + 1] - quiz[i])) {
tmpAnswer =
Math.Min(tmpAnswer, (jinja[lbJinja + 1] - quiz[i]) +
(jinja[lbJinja + 1] - tera[lbTera]));
} else {
tmpAnswer =
Math.Min(tmpAnswer, (quiz[i] - tera[lbTera]) +
(jinja[lbJinja + 1] - tera[lbTera]));
}
}
answer[i] = tmpAnswer;
}
foreach (var tgt in answer) {
Console.WriteLine(tgt);
}
}
public static long lower_bound(long[] array, long input) {
var left = 0;
var right = array.Length - 1;
var mid = 0;
while (right >= left) {
mid = left + (right - left) / 2;
if (array[mid] == input) {
return mid;
}
if (array[mid] > input) {
right = mid - 1;
} else {
left = mid + 1;
}
}
return right;
}
}
|
using System;
public class S {
public static void Main() {
var input = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
var A = input[0];
var B = input[1];
var Q = input[2];
var jinja = new long[A];
var tera = new long[B];
var quiz = new long[Q];
var answer = new long[Q];
long tmpAnswer = 0;
long lbTera, lbJinja;
for (int i = 0; i < A; i++) {
jinja[i] = long.Parse(Console.ReadLine());
}
for (int i = 0; i < B; i++) {
tera[i] = long.Parse(Console.ReadLine());
}
for (int i = 0; i < Q; i++) {
quiz[i] = long.Parse(Console.ReadLine());
lbTera = lower_bound(tera, quiz[i]);
lbJinja = lower_bound(jinja, quiz[i]);
tmpAnswer = long.MaxValue;
// 0,0
if (lbTera >= 0 && lbJinja >= 0) {
if (tera[lbTera] > jinja[lbJinja]) {
tmpAnswer = Math.Min(tmpAnswer, (quiz[i] - tera[lbTera]) +
(tera[lbTera] - jinja[lbJinja]));
} else {
tmpAnswer = Math.Min(tmpAnswer, (quiz[i] - jinja[lbJinja]) +
(jinja[lbJinja] - tera[lbTera]));
}
}
// 1,1
if (lbTera < B - 1 && lbJinja < A - 1) {
if (tera[lbTera + 1] > jinja[lbJinja + 1]) {
tmpAnswer =
Math.Min(tmpAnswer, (jinja[lbJinja + 1] - quiz[i]) +
(tera[lbTera + 1] - jinja[lbJinja + 1]));
} else {
tmpAnswer =
Math.Min(tmpAnswer, (tera[lbTera + 1] - quiz[i]) +
(jinja[lbJinja + 1] - tera[lbTera + 1]));
}
}
// 1,0
if (lbTera < B - 1 && lbJinja >= 0) {
if (Math.Abs(tera[lbTera + 1] - quiz[i]) >
Math.Abs(jinja[lbJinja] - quiz[i])) {
tmpAnswer =
Math.Min(tmpAnswer, (quiz[i] - jinja[lbJinja]) +
(tera[lbTera + 1] - jinja[lbJinja]));
} else {
tmpAnswer =
Math.Min(tmpAnswer, (tera[lbTera + 1] - quiz[i]) +
(tera[lbTera + 1] - jinja[lbJinja]));
}
}
// 0,1
if (lbTera >= 0 && lbJinja < A - 1) {
if (Math.Abs(tera[lbTera] - quiz[i]) >
Math.Abs(jinja[lbJinja + 1] - quiz[i])) {
tmpAnswer =
Math.Min(tmpAnswer, (jinja[lbJinja + 1] - quiz[i]) +
(jinja[lbJinja + 1] - tera[lbTera]));
} else {
tmpAnswer =
Math.Min(tmpAnswer, (quiz[i] - tera[lbTera]) +
(jinja[lbJinja + 1] - tera[lbTera]));
}
}
answer[i] = tmpAnswer;
}
foreach (var tgt in answer) {
Console.WriteLine(tgt);
}
}
public static long lower_bound(long[] array, long input) {
var left = 0;
var right = array.Length - 1;
var mid = 0;
while (right >= left) {
mid = left + (right - left) / 2;
if (array[mid] == input) {
return mid;
}
if (array[mid] > input) {
right = mid - 1;
} else {
left = mid + 1;
}
}
return right;
}
}
|
[["-", 31, 204, 206, 207, 0, 28, 0, 16, 31, 22], ["+", 31, 204, 206, 207, 0, 28, 0, 16, 31, 22]]
| 8
| 821
| 2
|
using System;
using System.Linq;
namespace ABC119D {
internal class Program {
public static void Main(string[] args) {
long[] ABQ =
Console.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
long A = ABQ[0];
long B = ABQ[1];
long Q = ABQ[2];
long[] S = new long[A];
for (int i = 0; i < A; i++) {
S[i] = long.Parse(Console.ReadLine());
}
long[] T = new long[B];
for (int i = 0; i < B; i++) {
T[i] = long.Parse(Console.ReadLine());
}
long[] X = new long[Q];
for (int i = 0; i < Q; i++) {
X[i] = long.Parse(Console.ReadLine());
}
Array.Sort(S);
Array.Sort(T);
for (int i = 0; i < Q; i++) {
Console.WriteLine(solve(S, T, X[i]));
}
}
private static long solve(long[] S, long[] T, long X) {
int skey = binary_search(S, X);
int tkey = binary_search(T, X);
long sleft = skey == 0 ? long.MinValue / 2 : S[skey - 1];
long sright = skey == S.Length ? long.MaxValue / 2 : S[skey];
long tleft = tkey == 0 ? long.MinValue / 2 : T[tkey - 1];
long tright = tkey == T.Length ? long.MaxValue / 2 : T[tkey];
return calc(sleft, sright, tleft, tright, X);
}
private static int binary_search(long[] array, long key) {
int ng = -1;
int ok = array.Length;
while (Math.Abs(ok - ng) > 1) {
int mid = (ok + ng) / 2;
if (isOk(mid, key, array)) {
ok = mid;
} else
ng = mid;
}
return ok;
}
private static Boolean isOk(int index, long key, long[] array) {
return array[index] >= key;
}
private static long calc(long sleft, long sright, long tleft, long tright,
long current) {
long sl = Math.Abs(current - sleft);
long sr = Math.Abs(sright - current);
long tl = Math.Abs(current - tleft);
long tr = Math.Abs(tright - current);
long[] dis = { Math.Max(sr, tr), Math.Max(sl, tl),
Math.Max(sr, tl) + Math.Min(sr, tl) * 2,
Math.Max(sl, tr) + Math.Min(sl, tr) * 2 };
return dis.Min();
}
}
}
|
using System;
using System.Linq;
namespace ABC119D {
internal class Program {
public static void Main(string[] args) {
long[] ABQ =
Console.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
long A = ABQ[0];
long B = ABQ[1];
long Q = ABQ[2];
long[] S = new long[A];
for (int i = 0; i < A; i++) {
S[i] = long.Parse(Console.ReadLine());
}
long[] T = new long[B];
for (int i = 0; i < B; i++) {
T[i] = long.Parse(Console.ReadLine());
}
long[] X = new long[Q];
for (int i = 0; i < Q; i++) {
X[i] = long.Parse(Console.ReadLine());
}
Array.Sort(S);
Array.Sort(T);
for (int i = 0; i < Q; i++) {
Console.WriteLine(solve(S, T, X[i]));
}
}
private static long solve(long[] S, long[] T, long X) {
int skey = binary_search(S, X);
int tkey = binary_search(T, X);
long sleft = skey == 0 ? long.MinValue / 6 : S[skey - 1];
long sright = skey == S.Length ? long.MaxValue / 6 : S[skey];
long tleft = tkey == 0 ? long.MinValue / 6 : T[tkey - 1];
long tright = tkey == T.Length ? long.MaxValue / 6 : T[tkey];
return calc(sleft, sright, tleft, tright, X);
}
private static int binary_search(long[] array, long key) {
int ng = -1;
int ok = array.Length;
while (Math.Abs(ok - ng) > 1) {
int mid = (ok + ng) / 2;
if (isOk(mid, key, array)) {
ok = mid;
} else
ng = mid;
}
return ok;
}
private static Boolean isOk(int index, long key, long[] array) {
return array[index] >= key;
}
private static long calc(long sleft, long sright, long tleft, long tright,
long current) {
long sl = Math.Abs(current - sleft);
long sr = Math.Abs(sright - current);
long tl = Math.Abs(current - tleft);
long tr = Math.Abs(tright - current);
long[] dis = { Math.Max(sr, tr), Math.Max(sl, tl),
Math.Max(sr, tl) + Math.Min(sr, tl) * 2,
Math.Max(sl, tr) + Math.Min(sl, tr) * 2 };
return dis.Min();
}
}
}
|
[["-", 0, 200, 0, 212, 0, 41, 64, 16, 12, 203], ["+", 0, 200, 0, 212, 0, 41, 64, 16, 12, 203]]
| 8
| 644
| 8
|
using System;
public class a {
static void Main() {
int[] AB = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
Console.WriteLine(AB[1] % AB[0] == 0 ? AB[0] - AB[1] : AB[1] - AB[0]);
}
}
|
using System;
public class a {
static void Main() {
int[] AB = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
Console.WriteLine(AB[1] % AB[0] == 0 ? AB[0] + AB[1] : AB[1] - AB[0]);
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 64, 16, 17, 33], ["+", 3, 4, 0, 28, 0, 41, 64, 16, 17, 72]]
| 8
| 76
| 2
|
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
namespace AtCoder {
public class Program {
public static void Main(string[] args) {
new Program().Solve(new ConsoleInput(Console.In, ' '));
}
public void Solve(ConsoleInput cin) {
var a = cin.ReadInt;
var b = cin.ReadInt;
if (b % a == 0) {
Console.WriteLine(a + b);
} else {
Console.WriteLine(a - b);
}
}
}
public class ConsoleInput {
private readonly System.IO.TextReader _stream;
private char _separator = ' ';
private Queue<string> inputStream;
public ConsoleInput(System.IO.TextReader stream, char separator = ' ') {
this._separator = separator;
this._stream = stream;
inputStream = new Queue<string>();
}
public string Read {
get {
if (inputStream.Count != 0)
return inputStream.Dequeue();
string[] tmp = _stream.ReadLine().Split(_separator);
for (int i = 0; i < tmp.Length; ++i)
inputStream.Enqueue(tmp[i]);
return inputStream.Dequeue();
}
}
public string ReadLine {
get { return _stream.ReadLine(); }
}
public int ReadInt {
get { return int.Parse(Read); }
}
public long ReadLong {
get { return long.Parse(Read); }
}
public double ReadDouble {
get { return double.Parse(Read); }
}
public string[] ReadStrArray(long N) {
var ret = new string[N];
for (long i = 0; i < N; ++i)
ret[i] = Read;
return ret;
}
public int[] ReadIntArray(long N) {
var ret = new int[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadInt;
return ret;
}
public long[] ReadLongArray(long N) {
var ret = new long[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadLong;
return ret;
}
}
}
|
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
namespace AtCoder {
public class Program {
public static void Main(string[] args) {
new Program().Solve(new ConsoleInput(Console.In, ' '));
}
public void Solve(ConsoleInput cin) {
var a = cin.ReadInt;
var b = cin.ReadInt;
if (b % a == 0) {
Console.WriteLine(a + b);
} else {
Console.WriteLine(b - a);
}
}
}
public class ConsoleInput {
private readonly System.IO.TextReader _stream;
private char _separator = ' ';
private Queue<string> inputStream;
public ConsoleInput(System.IO.TextReader stream, char separator = ' ') {
this._separator = separator;
this._stream = stream;
inputStream = new Queue<string>();
}
public string Read {
get {
if (inputStream.Count != 0)
return inputStream.Dequeue();
string[] tmp = _stream.ReadLine().Split(_separator);
for (int i = 0; i < tmp.Length; ++i)
inputStream.Enqueue(tmp[i]);
return inputStream.Dequeue();
}
}
public string ReadLine {
get { return _stream.ReadLine(); }
}
public int ReadInt {
get { return int.Parse(Read); }
}
public long ReadLong {
get { return long.Parse(Read); }
}
public double ReadDouble {
get { return double.Parse(Read); }
}
public string[] ReadStrArray(long N) {
var ret = new string[N];
for (long i = 0; i < N; ++i)
ret[i] = Read;
return ret;
}
public int[] ReadIntArray(long N) {
var ret = new int[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadInt;
return ret;
}
public long[] ReadLongArray(long N) {
var ret = new long[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadLong;
return ret;
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
| 8
| 469
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC118A {
class Program {
static void Main(string[] args) {
var word = Console.ReadLine().Split();
int a = int.Parse(word[0]);
int b = int.Parse(word[1]);
int max = 0;
if (a % b == 0) {
max = a + b;
} else
max = b - a;
Console.WriteLine(max);
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC118A {
class Program {
static void Main(string[] args) {
var word = Console.ReadLine().Split();
int a = int.Parse(word[0]);
int b = int.Parse(word[1]);
int max = 0;
if (b % a == 0) {
max = a + b;
} else
max = b - a;
Console.WriteLine(max);
Console.ReadKey();
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 22]]
| 8
| 126
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC118A {
class Program {
static void Main(string[] args) {
int a;
var word = Console.ReadLine().Split(' ');
int b = int.Parse(word[0]);
int c = int.Parse(word[1]);
int m = 0;
if (c % b == 0)
m = b + c;
else
m = b - c;
Console.WriteLine(m);
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC118A {
class Program {
static void Main(string[] args) {
int a;
var word = Console.ReadLine().Split(' ');
int b = int.Parse(word[0]);
int c = int.Parse(word[1]);
int m = 0;
if (c % b == 0)
m = b + c;
else
m = c - b;
Console.WriteLine(m);
Console.ReadKey();
}
}
}
|
[["-", 0, 57, 75, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 57, 75, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 75, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 75, 1, 0, 11, 12, 16, 12, 22]]
| 8
| 130
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC118A {
class Program {
static void Main(string[] args) {
string[] n = Console.ReadLine().Split(' ');
int a = int.Parse(n[0]);
int b = int.Parse(n[1]);
if ((b % a) == 0)
Console.WriteLine(a + b);
else
Console.WriteLine(a - b);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC118A {
class Program {
static void Main(string[] args) {
string[] n = Console.ReadLine().Split(' ');
int a = int.Parse(n[0]);
int b = int.Parse(n[1]);
if ((b % a) == 0)
Console.WriteLine(a + b);
else
Console.WriteLine(b - a);
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
| 8
| 119
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC118A {
class Program {
static void Main(string[] args) {
int a, b;
var word = Console.ReadLine().Split(' ');
a = int.Parse(word[0]);
b = int.Parse(word[1]);
if (a % b == 0)
Console.WriteLine(a + b);
else
Console.WriteLine(b - a);
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC118A {
class Program {
static void Main(string[] args) {
int a, b;
var word = Console.ReadLine().Split(' ');
a = int.Parse(word[0]);
b = int.Parse(word[1]);
if (b % a == 0)
Console.WriteLine(a + b);
else
Console.WriteLine(b - a);
Console.ReadKey();
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 22]]
| 8
| 124
| 4
|
using System;
namespace Atcoder {
class ABC118_A {
static void Main(string[] args) {
string[] str = Console.ReadLine().Split(' ');
int a = int.Parse(str[0]);
int b = int.Parse(str[1]);
Console.Write(b % a == 0 ? a + b : a - b);
}
}
}
|
using System;
namespace Atcoder {
class ABC118_A {
static void Main(string[] args) {
string[] str = Console.ReadLine().Split(' ');
int a = int.Parse(str[0]);
int b = int.Parse(str[1]);
Console.Write(b % a == 0 ? a + b : b - a);
}
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 75, 16, 31, 22], ["-", 3, 4, 0, 28, 0, 41, 75, 16, 17, 33], ["+", 3, 4, 0, 28, 0, 41, 75, 16, 17, 33], ["+", 3, 4, 0, 28, 0, 41, 75, 16, 12, 22]]
| 8
| 85
| 4
|
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program {
static void Main(string[] args) {
var input = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray();
int A = input[0];
int B = input[1];
Console.WriteLine((A % B == 0) ? A + B : B - A);
}
}
|
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program {
static void Main(string[] args) {
var input = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray();
int A = input[0];
int B = input[1];
Console.WriteLine((B % A == 0) ? A + B : B - A);
}
}
|
[["-", 0, 41, 15, 23, 0, 16, 31, 16, 31, 22], ["-", 0, 41, 15, 23, 0, 16, 31, 16, 17, 109], ["+", 0, 41, 15, 23, 0, 16, 31, 16, 17, 109], ["+", 0, 41, 15, 23, 0, 16, 31, 16, 12, 22]]
| 8
| 113
| 4
|
using System;
public class Program {
public static void Main(string[] args) {
var str = Console.ReadLine().Split(' ');
var a = int.Parse(str[0]);
var b = int.Parse(str[1]);
if (a / b == 0) {
Console.WriteLine(a + b);
} else {
Console.WriteLine(b - a);
}
}
}
|
using System;
public class Program {
public static void Main(string[] args) {
var str = Console.ReadLine().Split(' ');
var a = int.Parse(str[0]);
var b = int.Parse(str[1]);
if (b % a == 0) {
Console.WriteLine(a + b);
} else {
Console.WriteLine(b - a);
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 85], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 22]]
| 8
| 93
| 4
|
using System;
namespace beginnercon001 {
public class Program {
public static void Main(string[] args) {
string[] nums = Console.ReadLine().Split(' ');
int a = int.Parse(nums[0]);
int b = int.Parse(nums[1]);
if (b % a == 0) {
Console.WriteLine(a + b);
} else {
Console.WriteLine(b - a);
}
}
}
}
|
using System;
namespace beginnercon001 {
public class Program {
public static void Main(string[] args) {
string[] nums = Console.ReadLine().Split(' ');
int a = int.Parse(nums[0]);
int b = int.Parse(nums[1]);
if (b % a == 0) {
Console.WriteLine(a + b);
} else {
Console.WriteLine(b - a);
}
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 252, 0, 253], ["+", 0, 213, 3, 4, 0, 28, 0, 252, 0, 253]]
| 8
| 99
| 2
|
using System;
namespace AtCoder_20190218 {
class Program {
static void Main(string[] args) {
string[] str = Console.ReadLine().Split(' ');
int A = int.Parse(str[0]);
int B = int.Parse(str[1]);
int result = 0;
if (A % B == 0) {
result = A + B;
} else {
result = B - A;
}
Console.WriteLine(result);
}
}
}
|
using System;
namespace AtCoder_20190218 {
class Program {
static void Main(string[] args) {
string[] str = Console.ReadLine().Split(' ');
int A = int.Parse(str[0]);
int B = int.Parse(str[1]);
int result = 0;
if (B % A == 0) {
result = A + B;
} else {
result = B - A;
}
Console.WriteLine(result);
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 22]]
| 8
| 103
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder {
class Program {
static void Main(string[] args) {
string[] inputData = Console.ReadLine().Trim().Split(' ');
int num1 = int.Parse(inputData[0]);
int num2 = int.Parse(inputData[1]);
if (num1 % num2 == 0) {
Console.WriteLine(num2 + num1);
} else {
Console.WriteLine(num2 - num1);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder {
class Program {
static void Main(string[] args) {
string[] inputData = Console.ReadLine().Trim().Split(' ');
int num1 = int.Parse(inputData[0]);
int num2 = int.Parse(inputData[1]);
if (num2 % num1 == 0) {
Console.WriteLine(num2 + num1);
} else {
Console.WriteLine(num2 - num1);
}
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 22]]
| 8
| 125
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp1 {
class Program {
static void Main(string[] args) {
var input =
Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
int a = input[0];
int b = input[1];
Console.WriteLine(a % b == 0 ? a + b : b - a);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp1 {
class Program {
static void Main(string[] args) {
var input =
Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
int a = input[0];
int b = input[1];
Console.WriteLine(b % a == 0 ? a + b : b - a);
}
}
}
|
[["-", 0, 28, 0, 41, 15, 16, 31, 16, 31, 22], ["-", 0, 28, 0, 41, 15, 16, 31, 16, 17, 109], ["+", 0, 28, 0, 41, 15, 16, 31, 16, 17, 109], ["+", 0, 28, 0, 41, 15, 16, 31, 16, 12, 22]]
| 8
| 106
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder {
class AtCodeeeeeeeeeeeeeeeeeeeer {
static void Main(string[] args) {
int[] s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int A = s[0];
int B = s[1];
if (B % A == 0) {
Console.WriteLine(A + B);
} else {
Console.WriteLine(A - B);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder {
class AtCodeeeeeeeeeeeeeeeeeeeer {
static void Main(string[] args) {
int[] s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int A = s[0];
int B = s[1];
if (B % A == 0) {
Console.WriteLine(A + B);
} else {
Console.WriteLine(B - A);
}
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
| 8
| 122
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ABC {
public static void Main() {
int[] ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
if (ab[0] % ab[1] == 0)
Console.WriteLine(ab.Sum());
else {
Console.WriteLine(ab[1] - ab[0]);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ABC {
public static void Main() {
int[] ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
if (ab[1] % ab[0] == 0)
Console.WriteLine(ab.Sum());
else {
Console.WriteLine(ab[1] - ab[0]);
}
}
}
|
[["-", 31, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 31, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["-", 31, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 31, 16, 12, 204, 206, 207, 0, 28, 0, 203]]
| 8
| 109
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class AtCoderA {
static void Main() {
var sc = new Scanner();
int n = sc.NextInt();
int m = sc.NextInt();
List<int>[] nums = new List<int>[n];
for (int i = 0; i < n; i++) {
List<int> person = new List<int>();
int k = sc.NextInt();
for (int j = 0; j < k; j++) {
person.Add(sc.NextInt());
}
nums[i] = person;
}
int answer = 0;
for (int i = 1; i <= m; i++) {
bool ok = true;
for (int j = 0; j < n; j++) {
if (!nums[i].Contains(i)) {
ok = false;
break;
}
}
if (ok) {
answer++;
}
}
Console.WriteLine(answer);
}
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.Collections.Generic;
using System.Linq;
using System.Text;
public class AtCoderA {
static void Main() {
var sc = new Scanner();
int n = sc.NextInt();
int m = sc.NextInt();
List<int>[] nums = new List<int>[n];
for (int i = 0; i < n; i++) {
List<int> person = new List<int>();
int k = sc.NextInt();
for (int j = 0; j < k; j++) {
person.Add(sc.NextInt());
}
nums[i] = person;
}
int answer = 0;
for (int i = 1; i <= m; i++) {
bool ok = true;
for (int j = 0; j < n; j++) {
if (!nums[j].Contains(i)) {
ok = false;
break;
}
}
if (ok) {
answer++;
}
}
Console.WriteLine(answer);
}
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();
}
}
|
[["-", 63, 214, 205, 204, 206, 207, 0, 28, 0, 22], ["+", 63, 214, 205, 204, 206, 207, 0, 28, 0, 22]]
| 8
| 521
| 2
|
using System;
using System.Linq;
namespace ABC118 {
class B {
static void Main(string[] args) {
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
int[] Ans = new int[M];
for (int i = 0; i < N; i++) {
input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int K = input[0];
for (int j = 0; j < K; j++) {
Ans[input[j] - 1]++;
}
}
int res = Ans.Count(x => x == N);
Console.WriteLine(res);
}
}
}
|
using System;
using System.Linq;
namespace ABC118 {
class B {
static void Main(string[] args) {
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
int[] Ans = new int[M];
for (int i = 0; i < N; i++) {
input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int K = input[0];
for (int j = 1; j <= K; j++) {
Ans[input[j] - 1]++;
}
}
int res = Ans.Count(x => x == N);
Console.WriteLine(res);
}
}
}
|
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 19]]
| 8
| 175
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ziyuutyou {
class Program {
static void Main(string[] args) {
var a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
var N = a[0];
var M = a[1];
var sum = new int[M];
for (var i = 0; i < N; ++i) {
var b = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
var K = b[0];
for (var j = 0; j < K; ++j) {
sum[b[j + 1] - 1]++;
}
}
var count = 0;
for (var i = 0; i < N; ++i) {
if (sum[i] == N)
count++;
}
Console.WriteLine(count);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ziyuutyou {
class Program {
static void Main(string[] args) {
var a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
var N = a[0];
var M = a[1];
var sum = new int[M];
for (var i = 0; i < N; ++i) {
var b = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
var K = b[0];
for (var j = 0; j < K; ++j) {
sum[b[j + 1] - 1]++;
}
}
var count = 0;
for (var i = 0; i < M; ++i) {
if (sum[i] == N)
count++;
}
Console.WriteLine(count);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22]]
| 8
| 202
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static void Main(string[] args) {
string[] input1 = Console.ReadLine().Split(' ');
int N = int.Parse(input1[0]);
int M = int.Parse(input1[1]);
int[] sum = new int[M];
for (int i = 0; i < N; i++) {
string[] input2 = Console.ReadLine().Split(' ');
int K = int.Parse(input2[0]);
for (int j = 0; j < K; j++) {
sum[int.Parse(input2[j + 1])]++;
}
}
int answer = 0;
for (int i = 0; i < M; i++) {
if (sum[i] == N) {
answer++;
}
}
Console.WriteLine(answer);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static void Main(string[] args) {
string[] input1 = Console.ReadLine().Split(' ');
int N = int.Parse(input1[0]);
int M = int.Parse(input1[1]);
int[] sum = new int[M];
for (int i = 0; i < N; i++) {
string[] input2 = Console.ReadLine().Split(' ');
int K = int.Parse(input2[0]);
for (int j = 0; j < K; j++) {
sum[int.Parse(input2[j + 1]) - 1]++;
}
}
int answer = 0;
for (int i = 0; i < M; i++) {
if (sum[i] == N) {
answer++;
}
}
Console.WriteLine(answer);
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 206
| 2
|
using System;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
namespace AtCoder {
public class Program {
public static void Main(string[] args) {
new Program().Solve(new ConsoleInput(Console.In, ' '));
}
public void Solve(ConsoleInput cin) {
var n = cin.ReadInt;
var m = cin.ReadInt;
var list = new int[m];
for (int i = 0; i < n; i++) {
var k = cin.ReadInt;
for (int j = 0; j < k; j++) {
var tmp = cin.ReadInt;
list[tmp]++;
}
}
int counter = 0;
for (int i = 0; i < m; i++) {
if (list[i] == n) {
counter++;
}
}
Console.WriteLine(counter);
}
}
public class ConsoleInput {
private readonly System.IO.TextReader _stream;
private char _separator = ' ';
private Queue<string> inputStream;
public ConsoleInput(System.IO.TextReader stream, char separator = ' ') {
this._separator = separator;
this._stream = stream;
inputStream = new Queue<string>();
}
public string Read {
get {
if (inputStream.Count != 0)
return inputStream.Dequeue();
string[] tmp = _stream.ReadLine().Split(_separator);
for (int i = 0; i < tmp.Length; ++i)
inputStream.Enqueue(tmp[i]);
return inputStream.Dequeue();
}
}
public string ReadLine {
get { return _stream.ReadLine(); }
}
public int ReadInt {
get { return int.Parse(Read); }
}
public long ReadLong {
get { return long.Parse(Read); }
}
public double ReadDouble {
get { return double.Parse(Read); }
}
public string[] ReadStrArray(long N) {
var ret = new string[N];
for (long i = 0; i < N; ++i)
ret[i] = Read;
return ret;
}
public int[] ReadIntArray(long N) {
var ret = new int[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadInt;
return ret;
}
public long[] ReadLongArray(long N) {
var ret = new long[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadLong;
return ret;
}
public double[] ReadDoubleArray(long N) {
var ret = new double[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadDouble;
return ret;
}
}
}
|
using System;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
namespace AtCoder {
public class Program {
public static void Main(string[] args) {
new Program().Solve(new ConsoleInput(Console.In, ' '));
}
public void Solve(ConsoleInput cin) {
var n = cin.ReadInt;
var m = cin.ReadInt;
var list = new int[m];
for (int i = 0; i < n; i++) {
var k = cin.ReadInt;
for (int j = 0; j < k; j++) {
var tmp = cin.ReadInt;
list[tmp - 1]++;
}
}
int counter = 0;
for (int i = 0; i < m; i++) {
if (list[i] == n) {
counter++;
}
}
Console.WriteLine(counter);
}
}
public class ConsoleInput {
private readonly System.IO.TextReader _stream;
private char _separator = ' ';
private Queue<string> inputStream;
public ConsoleInput(System.IO.TextReader stream, char separator = ' ') {
this._separator = separator;
this._stream = stream;
inputStream = new Queue<string>();
}
public string Read {
get {
if (inputStream.Count != 0)
return inputStream.Dequeue();
string[] tmp = _stream.ReadLine().Split(_separator);
for (int i = 0; i < tmp.Length; ++i)
inputStream.Enqueue(tmp[i]);
return inputStream.Dequeue();
}
}
public string ReadLine {
get { return _stream.ReadLine(); }
}
public int ReadInt {
get { return int.Parse(Read); }
}
public long ReadLong {
get { return long.Parse(Read); }
}
public double ReadDouble {
get { return double.Parse(Read); }
}
public string[] ReadStrArray(long N) {
var ret = new string[N];
for (long i = 0; i < N; ++i)
ret[i] = Read;
return ret;
}
public int[] ReadIntArray(long N) {
var ret = new int[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadInt;
return ret;
}
public long[] ReadLongArray(long N) {
var ret = new long[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadLong;
return ret;
}
public double[] ReadDoubleArray(long N) {
var ret = new double[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadDouble;
return ret;
}
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 570
| 2
|
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
namespace AtCoder {
public class Program {
public static void Main(string[] args) {
new Program().Anser(new ConsoleInput(Console.In, ' '));
}
public void Anser(ConsoleInput Input) {
var inputData = Input.ReadIntArray(2);
var favoriteData = new List<int>();
for (int i = 0; i < inputData[0]; i++) {
var favoAns = Input.ReadLine.Split(' ')
.Select(x => Convert.ToInt32(x))
.ToList<int>();
favoriteData.AddRange(
favoAns.GetRange(1, favoAns.Count).Distinct().ToList<int>());
}
var anserCount = 0;
for (int i = 1; i <= inputData[1]; i++) {
var favo = favoriteData.Count(x => x == i);
if (favo == inputData[0])
anserCount++;
}
Console.WriteLine(anserCount);
}
}
public class ConsoleInput {
private readonly System.IO.TextReader Stream;
private char Separator = ' ';
private Queue<string> InputStream;
public ConsoleInput(System.IO.TextReader Stream, char Separator = ' ') {
this.Separator = Separator;
this.Stream = Stream;
InputStream = new Queue<string>();
}
public string Read {
get {
if (InputStream.Count != 0) {
return InputStream.Dequeue();
}
string[] splitStrs = Stream.ReadLine().Split(Separator);
for (int i = 0; i < splitStrs.Length; ++i) {
InputStream.Enqueue(splitStrs[i]);
}
return InputStream.Dequeue();
}
}
public string ReadLine {
get { return Stream.ReadLine(); }
}
public int ReadInt {
get { return int.Parse(Read); }
}
public long ReadLong {
get { return long.Parse(Read); }
}
public double ReadDouble {
get { return double.Parse(Read); }
}
public string[] ReadStrArray(long N) {
var inputStrArray = new string[N];
for (long i = 0; i < N; ++i) {
inputStrArray[i] = Read;
}
return inputStrArray;
}
public int[] ReadIntArray(long N) {
var inputIntArray = new int[N];
for (long i = 0; i < N; ++i) {
inputIntArray[i] = ReadInt;
}
return inputIntArray;
}
public long[] ReadLongArray(long N) {
var inputLongArray = new long[N];
for (long i = 0; i < N; ++i) {
inputLongArray[i] = ReadLong;
}
return inputLongArray;
}
}
}
|
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
namespace AtCoder {
public class Program {
public static void Main(string[] args) {
new Program().Anser(new ConsoleInput(Console.In, ' '));
}
public void Anser(ConsoleInput Input) {
var inputData = Input.ReadIntArray(2);
var favoriteData = new List<int>();
for (int i = 0; i < inputData[0]; i++) {
var favoAns = Input.ReadLine.Split(' ')
.Select(x => Convert.ToInt32(x))
.ToList<int>();
favoriteData.AddRange(
favoAns.GetRange(1, favoAns.Count - 1).Distinct().ToList<int>());
}
var anserCount = 0;
for (int i = 1; i <= inputData[1]; i++) {
var favo = favoriteData.Count(x => x == i);
if (favo == inputData[0])
anserCount++;
}
Console.WriteLine(anserCount);
}
}
public class ConsoleInput {
private readonly System.IO.TextReader Stream;
private char Separator = ' ';
private Queue<string> InputStream;
public ConsoleInput(System.IO.TextReader Stream, char Separator = ' ') {
this.Separator = Separator;
this.Stream = Stream;
InputStream = new Queue<string>();
}
public string Read {
get {
if (InputStream.Count != 0) {
return InputStream.Dequeue();
}
string[] splitStrs = Stream.ReadLine().Split(Separator);
for (int i = 0; i < splitStrs.Length; ++i) {
InputStream.Enqueue(splitStrs[i]);
}
return InputStream.Dequeue();
}
}
public string ReadLine {
get { return Stream.ReadLine(); }
}
public int ReadInt {
get { return int.Parse(Read); }
}
public long ReadLong {
get { return long.Parse(Read); }
}
public double ReadDouble {
get { return double.Parse(Read); }
}
public string[] ReadStrArray(long N) {
var inputStrArray = new string[N];
for (long i = 0; i < N; ++i) {
inputStrArray[i] = Read;
}
return inputStrArray;
}
public int[] ReadIntArray(long N) {
var inputIntArray = new int[N];
for (long i = 0; i < N; ++i) {
inputIntArray[i] = ReadInt;
}
return inputIntArray;
}
public long[] ReadLongArray(long N) {
var inputLongArray = new long[N];
for (long i = 0; i < N; ++i) {
inputLongArray[i] = ReadLong;
}
return inputLongArray;
}
}
}
|
[["+", 205, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 205, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
| 8
| 579
| 2
|
using System;
namespace AtCoderBeginnerContest118_2 {
class Program {
static void Main(string[] args) {
string[] s = Console.ReadLine().Split(' ');
int N = int.Parse(s[0]);
int M = int.Parse(s[1]);
bool[] fav = new bool[M];
for (int i = 0; i < M; i++)
fav[i] = true;
for (int i = 0; i < N; i++) {
bool[] buf = new bool[M];
s = Console.ReadLine().Split(' ');
int K = int.Parse(s[0]);
for (int j = 1; j < s.Length; j++) {
int a = int.Parse(s[j]);
buf[a] = true;
}
for (int j = 0; j < M; j++) {
if (!buf[j])
fav[j] = false;
}
}
int counter = 0;
for (int j = 0; j < M; j++) {
if (fav[j])
counter++;
}
Console.WriteLine(counter.ToString());
}
}
}
|
using System;
namespace AtCoderBeginnerContest118_2 {
class Program {
static void Main(string[] args) {
string[] s = Console.ReadLine().Split(' ');
int N = int.Parse(s[0]);
int M = int.Parse(s[1]);
bool[] fav = new bool[M];
for (int i = 0; i < M; i++)
fav[i] = true;
for (int i = 0; i < N; i++) {
bool[] buf = new bool[M];
s = Console.ReadLine().Split(' ');
int K = int.Parse(s[0]);
for (int j = 1; j < s.Length; j++) {
int a = int.Parse(s[j]) - 1;
buf[a] = true;
}
for (int j = 0; j < M; j++) {
if (!buf[j])
fav[j] = false;
}
}
int counter = 0;
for (int j = 0; j < M; j++) {
if (fav[j])
counter++;
}
Console.WriteLine(counter.ToString());
}
}
}
|
[["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 33], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203]]
| 8
| 264
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello {
public static void Main() {
var input = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
var N = input[0];
var M = input[1];
var foods = new List<long>();
for (var i = 0; i < M; i++) {
foods.Add(0);
}
for (var i = 0; i < N; i++) {
var K = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
for (var j = 1; j <= K[0]; j++) {
foods[K[j]] += 1;
}
}
var ans = foods.Count(x => x == N);
Console.WriteLine(ans);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello {
public static void Main() {
var input = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
var N = input[0];
var M = input[1];
var foods = new List<long>();
for (var i = 0; i < M; i++) {
foods.Add(0);
}
for (var i = 0; i < N; i++) {
var K = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
for (long j = 1; j <= K[0]; j++) {
foods[K[j] - 1]++;
}
}
var ans = foods.Count(x => x == N);
Console.WriteLine(ans);
}
}
|
[["-", 8, 196, 0, 7, 10, 198, 39, 216, 0, 217], ["+", 0, 7, 8, 196, 0, 7, 10, 198, 39, 199], ["-", 0, 1, 0, 11, 31, 204, 206, 207, 0, 73], ["-", 8, 196, 0, 1, 0, 11, 0, 202, 0, 107], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 1, 0, 223, 0, 204, 206, 207, 0, 73], ["+", 0, 7, 8, 196, 0, 1, 0, 223, 0, 29]]
| 8
| 198
| 7
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder {
class AtCodeeeeeeeeeeeeeeeeeeeer {
static void Main(string[] args) {
int[] s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int N = s[0];
int M = s[1];
int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
List<int> ls = new List<int>();
for (int i = 1; i < a.Length; i++) {
ls.Add(a[i]);
} //先頭を除いたリスト
List<int> tmp = new List<int>();
for (int i = 1; i < N; i++) //一本除く
{
int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
for (int j = 1; j < input.Length; j++) {
tmp.Add(input[j]);
} //与えられたやつの先頭を除いてリスト化
//残リストを比較
for (int j = 0; j < ls.Count(); j++) {
if (tmp.Contains(ls[j]) == false) {
ls.Remove(ls[j]);
}
}
tmp.Clear();
}
Console.WriteLine(ls.Count());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder {
class AtCodeeeeeeeeeeeeeeeeeeeer {
static void Main(string[] args) {
int[] s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int N = s[0];
int M = s[1];
int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
List<int> ls = new List<int>();
for (int i = 1; i < a.Length; i++) {
ls.Add(a[i]);
} //先頭を除いたリスト
List<int> tmp = new List<int>();
for (int i = 1; i < N; i++) //一本除く
{
int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
for (int j = 1; j < input.Length; j++) {
tmp.Add(input[j]);
} //与えられたやつの先頭を除いてリスト化
//残リストを比較
for (int j = 0; j < ls.Count(); j++) {
if (tmp.Contains(ls[j]) == false) {
ls.Remove(ls[j]);
j--;
}
}
tmp.Clear();
}
Console.WriteLine(ls.Count());
}
}
}
|
[["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 68], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35]]
| 8
| 316
| 3
|
using System;
using System.Collections.Generic;
// using System.Linq;
class Program {
// static List<string> list;
// static List<int> primes = new
// List<int>{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,
// 59,61,67,71,73,79,83,89,97};
static void Main(string[] args) {
// 入力フェーズ
string[] input = Console.ReadLine().Split(' ');
int N = int.Parse(input[0]);
int M = int.Parse(input[1]);
// 処理
int[] fav = new int[M + 1]; // M個の食べ物の好き投票箱
for (int i = 0; i < N; i++) {
// i番目の人に話を聞く
string[] interview = Console.ReadLine().Split(' ');
// Console.Write(interview[0] + " ");
int K = int.Parse(interview[0]);
for (int j = 1; j <= K; j++) {
int f = int.Parse(interview[j]);
// Console.Write(f + " ");
fav[f] += 1;
}
// Console.WriteLine(" ");
}
// 全員(N人)から得票した食べ物を数える
int ret = 0;
for (int i = 0; i < M; i++) {
int f = fav[i];
if (f == N) {
ret++;
}
}
// 出力
Console.WriteLine(ret + "");
}
class myClass { //自作クラス
public long total { set; get; } // 全部の層数
public long paty { set; get; } // パティの数
public long banz { set; get; } // バンズの数
}
static void myMethod(int arg) {}
}
|
using System;
using System.Collections.Generic;
// using System.Linq;
class Program {
// static List<string> list;
// static List<int> primes = new
// List<int>{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,
// 59,61,67,71,73,79,83,89,97};
static void Main(string[] args) {
// 入力フェーズ
string[] input = Console.ReadLine().Split(' ');
int N = int.Parse(input[0]);
int M = int.Parse(input[1]);
// 処理
int[] fav = new int[M + 1]; // M個の食べ物の好き投票箱
for (int i = 0; i < N; i++) {
// i番目の人に話を聞く
string[] interview = Console.ReadLine().Split(' ');
// Console.Write(interview[0] + " ");
int K = int.Parse(interview[0]);
for (int j = 1; j <= K; j++) {
int f = int.Parse(interview[j]);
// Console.Write(f + " ");
fav[f] += 1;
}
// Console.WriteLine(" ");
}
// 全員(N人)から得票した食べ物を数える
int ret = 0;
for (int i = 1; i <= M; i++) {
int f = fav[i];
if (f == N) {
ret++;
}
}
// 出力
Console.WriteLine(ret + "");
}
class myClass { //自作クラス
public long total { set; get; } // 全部の層数
public long paty { set; get; } // パティの数
public long banz { set; get; } // バンズの数
}
static void myMethod(int arg) {}
}
|
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
| 8
| 273
| 4
|
// 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 {
static int k = 0;
static List<int> ans = new List<int>();
public static void Main() {
var input = Console.ReadLine().Split(' ');
var a = int.Parse(input[0]);
var b = int.Parse(input[1]);
k = int.Parse(input[2]);
int count = 0;
for (int i = 1; i <= Math.Min(a, b); i++) {
if ((a % i == 0) && (b % i) == 0) {
ans.Add(i);
}
if (count == k)
break;
}
Console.Write(ans[k - 1]);
}
static int GCD(int a, int b) {
if (a == 0)
return b;
return GCD(b % a, a);
}
}
|
// 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 {
static int k = 0;
static List<int> ans = new List<int>();
public static void Main() {
var input = Console.ReadLine().Split(' ');
var a = int.Parse(input[0]);
var b = int.Parse(input[1]);
k = int.Parse(input[2]);
int count = 0;
for (int i = 1; i <= Math.Min(a, b); i++) {
if ((a % i == 0) && (b % i) == 0) {
ans.Add(i);
}
if (count == k)
break;
}
Console.Write(ans[ans.Count - k]);
}
static int GCD(int a, int b) {
if (a == 0)
return b;
return GCD(b % a, a);
}
}
|
[["-", 0, 204, 206, 207, 0, 28, 0, 16, 31, 22], ["+", 206, 207, 0, 28, 0, 16, 31, 214, 205, 22], ["+", 206, 207, 0, 28, 0, 16, 31, 214, 0, 131], ["+", 206, 207, 0, 28, 0, 16, 31, 214, 141, 22], ["-", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 22]]
| 8
| 212
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class AtCoderA {
static void Main() {
var sc = new Scanner();
int a = sc.NextInt();
int b = sc.NextInt();
int k = sc.NextInt();
int answer = 0;
int count = 0;
for (int i = 100; i >= 1; i--) {
if (a % i == 0 && b % i == 0) {
count++;
}
if (count == k) {
answer = i;
}
}
Console.WriteLine(answer);
}
private static int GetDivisorCount(int n) {
int count = 0;
for (int i = 1; i <= n; i++) {
if (n % i == 0) {
count++;
}
}
return count;
}
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.Collections.Generic;
using System.Linq;
using System.Text;
public class AtCoderA {
static void Main() {
var sc = new Scanner();
int a = sc.NextInt();
int b = sc.NextInt();
int k = sc.NextInt();
int answer = 0;
int count = 0;
for (int i = 100; i >= 1; i--) {
if (a % i == 0 && b % i == 0) {
count++;
}
if (count == k) {
answer = i;
break;
}
}
Console.WriteLine(answer);
}
private static int GetDivisorCount(int n) {
int count = 0;
for (int i = 1; i <= n; i++) {
if (n % i == 0) {
count++;
}
}
return count;
}
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();
}
}
|
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 35]]
| 8
| 472
| 2
|
using System;
using System.Collections.Generic;
namespace ABC120 {
class B {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split();
int A = int.Parse(input[0]);
int B = int.Parse(input[1]);
int K = int.Parse(input[2]);
int n = CalcGCD(A, B);
List<int> l = new List<int>();
for (int i = 1; i <= n; i++) {
if (A % i == 0 && B % i == 0) {
l.Add(i);
}
}
Console.WriteLine(l[K - 1]);
}
static int CalcGCD(int A, int B) {
if (B == 0) {
return A;
}
return CalcGCD(B, A % B);
}
}
}
|
using System;
using System.Collections.Generic;
namespace ABC120 {
class B {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split();
int A = int.Parse(input[0]);
int B = int.Parse(input[1]);
int K = int.Parse(input[2]);
int n = CalcGCD(A, B);
List<int> l = new List<int>();
for (int i = 1; i <= n; i++) {
if (A % i == 0 && B % i == 0) {
l.Add(i);
}
}
Console.WriteLine(l[l.Count - K]);
}
static int CalcGCD(int A, int B) {
if (B == 0) {
return A;
}
return CalcGCD(B, A % B);
}
}
}
|
[["-", 0, 204, 206, 207, 0, 28, 0, 16, 31, 22], ["+", 206, 207, 0, 28, 0, 16, 31, 214, 205, 22], ["+", 206, 207, 0, 28, 0, 16, 31, 214, 0, 131], ["+", 206, 207, 0, 28, 0, 16, 31, 214, 141, 22], ["-", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 22]]
| 8
| 191
| 6
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace Algorithm {
class Program {
static void Main(string[] args) {
var line = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();
int a = line[0], b = line[1], k = line[2];
var min = a < b ? a : b;
var count = 0;
for (var i = min; i > 0; i--) {
if (a % i == 0 && b % i == 0)
count++;
if (count == k) {
Console.WriteLine(count);
return;
}
}
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace Algorithm {
class Program {
static void Main(string[] args) {
var line = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();
int a = line[0], b = line[1], k = line[2];
var min = a < b ? a : b;
var count = 0;
for (var i = min; i > 0; i--) {
if (a % i == 0 && b % i == 0)
count++;
if (count == k) {
Console.WriteLine(i);
return;
}
}
}
}
}
|
[["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
| 8
| 156
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AtCoderTemplate {
class Program {
static void Main(string[] args) {
var ABK = ReadInts();
var A = ABK[0];
var B = ABK[1];
var K = ABK[2];
var min = Math.Min(A, B);
var divisor = Enumerable.Range(1, min).Where(x => A % x == 0 && B % x == 0);
// PrintEnum (divisor);
Console.WriteLine(divisor.ElementAt(K - 1));
}
/* Input & Output*/
static int ReadInt() { return int.Parse(Console.ReadLine()); }
static List<int> ReadInts() {
return Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList();
}
static List<List<int>> ReadColumns(int n) {
/*
入力例
A1 B1
A2 B2
...
An Bn
出力例
[[A1,A2,...,An], [B1,B2,...,Bn]]
*/
var seq = Enumerable.Range(0, n).Select(i => ReadInts()).ToList();
return Enumerable.Range(0, seq.First().Count())
.Select(i => seq.Select(items => items[i]).ToList())
.ToList();
}
static void PrintEnum<T>(IEnumerable<T> list) {
Console.Write(list.First());
foreach (var item in list.Skip(1)) {
Console.Write($" {item}");
}
Console.Write("\n");
}
static void PrintLnEnum<T>(IEnumerable<T> list) {
foreach (var item in list) {
Console.WriteLine(item);
}
}
/* Numeric Function */
static int Fact(int n) {
return Enumerable.Range(1, n).Aggregate(1, ((i, k) => i * k));
}
static int PermNum(int n, int m) {
if (m > n) {
return 0;
}
return Enumerable.Range(n - m, m + 1).Aggregate(1, ((i, k) => i * k));
}
static int CombNum(int n, int m) { return PermNum(n, m) / Fact(m); }
// 最大公約数 (m ≧ n)
static int GCD(int m, int n) {
if (n == 0) {
return m;
} else {
return GCD(n, m % n);
}
}
// 最小公倍数 (m ≧ n)
static int LCM(int m, int n) { return GCD(m, n) / (m * n); }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AtCoderTemplate {
class Program {
static void Main(string[] args) {
var ABK = ReadInts();
var A = ABK[0];
var B = ABK[1];
var K = ABK[2];
var min = Math.Min(A, B);
var divisor =
Enumerable.Range(1, min).Reverse().Where(x => A % x == 0 && B % x == 0);
// PrintEnum (divisor);
Console.WriteLine(divisor.ElementAt(K - 1));
}
/* Input & Output*/
static int ReadInt() { return int.Parse(Console.ReadLine()); }
static List<int> ReadInts() {
return Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList();
}
static List<List<int>> ReadColumns(int n) {
/*
入力例
A1 B1
A2 B2
...
An Bn
出力例
[[A1,A2,...,An], [B1,B2,...,Bn]]
*/
var seq = Enumerable.Range(0, n).Select(i => ReadInts()).ToList();
return Enumerable.Range(0, seq.First().Count())
.Select(i => seq.Select(items => items[i]).ToList())
.ToList();
}
static void PrintEnum<T>(IEnumerable<T> list) {
Console.Write(list.First());
foreach (var item in list.Skip(1)) {
Console.Write($" {item}");
}
Console.Write("\n");
}
static void PrintLnEnum<T>(IEnumerable<T> list) {
foreach (var item in list) {
Console.WriteLine(item);
}
}
/* Numeric Function */
static int Fact(int n) {
return Enumerable.Range(1, n).Aggregate(1, ((i, k) => i * k));
}
static int PermNum(int n, int m) {
if (m > n) {
return 0;
}
return Enumerable.Range(n - m, m + 1).Aggregate(1, ((i, k) => i * k));
}
static int CombNum(int n, int m) { return PermNum(n, m) / Fact(m); }
// 最大公約数 (m ≧ n)
static int GCD(int m, int n) {
if (n == 0) {
return m;
} else {
return GCD(n, m % n);
}
}
// 最小公倍数 (m ≧ n)
static int LCM(int m, int n) { return GCD(m, n) / (m * n); }
}
}
|
[["+", 0, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 0, 213, 63, 214, 205, 213, 3, 4, 0, 24], ["+", 0, 213, 63, 214, 205, 213, 3, 4, 0, 25], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 0, 131]]
| 8
| 537
| 4
|
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello {
public static void Main() {
var n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
var A = n[0];
var B = n[1];
var K = n[2];
var list = new List<int>();
for (var i = 1; i <= Math.Min(A, B); i++) {
if (A % i == 0 && B % i == 0) {
list.Add(i);
}
}
// foreach(var i in list){
// Console.WriteLine(i);
// }
Console.WriteLine(list[K - 1]);
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello {
public static void Main() {
var n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
var A = n[0];
var B = n[1];
var K = n[2];
var list = new List<int>();
for (var i = 1; i <= Math.Min(A, B); i++) {
if (A % i == 0 && B % i == 0) {
list.Add(i);
}
}
list.Reverse();
Console.WriteLine(list[K - 1]);
}
}
|
[["+", 8, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
| 8
| 151
| 6
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace ABC120B_K_thCommonDivisor {
class Program {
static void Main(string[] args) {
#if Local
var sw = new Stopwatch();
sw.Start();
Console.SetIn(new StreamReader("input.in"));
#endif
var solver = new Solver();
solver.Solve();
#if Local
Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
}
}
class Solver {
public void Solve() {
var input =
Console.ReadLine().Split(' ').Select(elem => int.Parse(elem)).ToArray();
var listA = GetYakusu(input[0]);
var listB = GetYakusu(input[1]);
var listKoyaku = GetCommon(listA, listB);
var answer = listKoyaku[listKoyaku.Count - input[2] - 1];
Console.WriteLine(answer);
}
public List<int> GetCommon(List<int> listA, List<int> listB) {
List<int> ret = new List<int>();
foreach (var a in listA) {
foreach (var b in listB) {
if (a == b) {
ret.Add(a);
}
}
}
return ret;
}
public List<int> GetYakusu(int num) {
List<int> ret = new List<int>();
for (int i = 1; i <= num; i++) {
if (num % i == 0) {
ret.Add(i);
}
}
return ret;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace ABC120B_K_thCommonDivisor {
class Program {
static void Main(string[] args) {
#if Local
var sw = new Stopwatch();
sw.Start();
Console.SetIn(new StreamReader("input.in"));
#endif
var solver = new Solver();
solver.Solve();
#if Local
Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
}
}
class Solver {
public void Solve() {
var input =
Console.ReadLine().Split(' ').Select(elem => int.Parse(elem)).ToArray();
var listA = GetYakusu(input[0]);
var listB = GetYakusu(input[1]);
var listKoyaku = GetCommon(listA, listB);
var answer = listKoyaku[listKoyaku.Count - input[2]];
Console.WriteLine(answer);
}
public List<int> GetCommon(List<int> listA, List<int> listB) {
List<int> ret = new List<int>();
foreach (var a in listA) {
foreach (var b in listB) {
if (a == b) {
ret.Add(a);
}
}
}
return ret;
}
public List<int> GetYakusu(int num) {
List<int> ret = new List<int>();
for (int i = 1; i <= num; i++) {
if (num % i == 0) {
ret.Add(i);
}
}
return ret;
}
}
}
|
[["-", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["-", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 341
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
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 Int() { 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] = Int() + add;
}
return Array;
}
public long Long() { 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] = Long() + add;
}
return Array;
}
}
class Program {
static Scanner cin = new Scanner();
static void Main() {
int a = cin.Int();
int b = cin.Int();
int k = cin.Int();
var list = new List<int>();
for (int i = 1; i <= 10000; i++) {
if (a % i == 0 && b % i == 0) {
list.Add(i);
}
}
// foreach (var x in list) {
// Console.WriteLine(x);
//}
Console.WriteLine(list[k - 1]);
Console.ReadLine();
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
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 Int() { 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] = Int() + add;
}
return Array;
}
public long Long() { 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] = Long() + add;
}
return Array;
}
}
class Program {
static Scanner cin = new Scanner();
static void Main() {
int a = cin.Int();
int b = cin.Int();
int k = cin.Int();
var list = new List<int>();
for (int i = 1; i <= 10000; i++) {
if (a % i == 0 && b % i == 0) {
list.Add(i);
}
}
// foreach (var x in list) {
// Console.WriteLine(x);
//}
Console.WriteLine(list[list.Count - k]);
Console.ReadLine();
}
}
|
[["-", 0, 204, 206, 207, 0, 28, 0, 16, 31, 22], ["+", 206, 207, 0, 28, 0, 16, 31, 214, 205, 22], ["+", 206, 207, 0, 28, 0, 16, 31, 214, 0, 131], ["+", 206, 207, 0, 28, 0, 16, 31, 214, 141, 22], ["-", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 22]]
| 8
| 409
| 6
|
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
//入力の受け取り
string[] input = Console.ReadLine().Split(' ');
int num1 = int.Parse(input[0]);
int num2 = int.Parse(input[1]);
int numK = int.Parse(input[2]);
// num1を割れる数
List<int> num1List = new List<int>();
for (int ii = 1; ii <= num1; ii++) {
if (num1 % ii == 0) {
num1List.Add(ii);
}
}
// num2を割れる数
List<int> num2List = new List<int>();
for (int jj = 1; jj <= num2; jj++) {
if (num2 % jj == 0) {
num2List.Add(jj);
}
}
//共通する数を得る
List<int> numCommon = new List<int>();
foreach (int kk in num1List) {
for (int ll = 0; ll < num2List.Count; ll++) {
if (kk == num2List[ll]) {
numCommon.Add(kk);
}
}
}
Console.WriteLine(numCommon[numK - 1]);
}
}
|
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
//入力の受け取り
string[] input = Console.ReadLine().Split(' ');
int num1 = int.Parse(input[0]);
int num2 = int.Parse(input[1]);
int numK = int.Parse(input[2]);
// num1を割れる数
List<int> num1List = new List<int>();
for (int ii = 1; ii <= num1; ii++) {
if (num1 % ii == 0) {
num1List.Add(ii);
}
}
// num2を割れる数
List<int> num2List = new List<int>();
for (int jj = 1; jj <= num2; jj++) {
if (num2 % jj == 0) {
num2List.Add(jj);
}
}
//共通する数を得る
List<int> numCommon = new List<int>();
foreach (int kk in num1List) {
for (int ll = 0; ll < num2List.Count; ll++) {
if (kk == num2List[ll]) {
numCommon.Add(kk);
}
}
}
numCommon.Reverse();
Console.WriteLine(numCommon[numK - 1]);
}
}
|
[["+", 8, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
| 8
| 251
| 6
|
using System;
using System.Linq;
using System.Collections.Generic;
class Program {
public static void Main(string[] args) {
int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
List<int> result = new List<int>();
for (int i = 1; i <= 100; i++) {
if (s[0] % i == 0 && s[1] % i == 0)
result.Add(i);
}
result.Sort();
Console.WriteLine(result[s[2] - 1]);
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
class Program {
public static void Main(string[] args) {
int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
List<int> result = new List<int>();
for (int i = 1; i <= 100; i++) {
if (s[0] % i == 0 && s[1] % i == 0)
result.Add(i);
}
result.Reverse();
Console.WriteLine(result[s[2] - 1]);
}
}
|
[["-", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22]]
| 8
| 135
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split(' ');
int a = int.Parse(input[0]);
int b = int.Parse(input[1]);
int k = int.Parse(input[2]);
var alist = new List<int>();
var ablist = new List<int>();
for (int i = 1; i <= a; i++) {
if (a % i == 0) {
alist.Add(i);
}
}
for (int i = 1; i <= b; i++) {
if (b % i == 0 && alist.Contains(i)) {
ablist.Add(i);
}
}
Console.WriteLine(ablist[k - 1]);
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split(' ');
int a = int.Parse(input[0]);
int b = int.Parse(input[1]);
int k = int.Parse(input[2]);
var alist = new List<int>();
var ablist = new List<int>();
for (int i = 1; i <= a; i++) {
if (a % i == 0) {
alist.Add(a / i);
}
}
for (int i = 1; i <= b; i++) {
if (b % i == 0 && alist.Contains(b / i)) {
ablist.Add(b / i);
}
}
Console.WriteLine(ablist[k - 1]);
}
}
|
[["+", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 85], ["+", 12, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 12, 213, 3, 4, 0, 28, 0, 16, 17, 85]]
| 8
| 194
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program {
public void Slove() {
var inputs = Console.ReadLine().Split();
int a = int.Parse(inputs[0]);
int b = int.Parse(inputs[1]);
int k = int.Parse(inputs[2]);
int max = Math.Max(a, b);
int result = Enumerable.Range(1, max)
.Where(x => a % x == 0 && b % x == 0)
.ToArray()[k - 1];
System.Console.WriteLine(result);
}
static void Main(string[] args) { new Program().Slove(); }
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program {
public void Slove() {
var inputs = Console.ReadLine().Split();
int a = int.Parse(inputs[0]);
int b = int.Parse(inputs[1]);
int k = int.Parse(inputs[2]);
int max = Math.Max(a, b);
int result = Enumerable.Range(1, max)
.Reverse()
.Where(x => a % x == 0 && b % x == 0)
.ToArray()[k - 1];
System.Console.WriteLine(result);
}
static void Main(string[] args) { new Program().Slove(); }
}
|
[["+", 205, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 205, 213, 63, 214, 205, 213, 3, 4, 0, 24], ["+", 205, 213, 63, 214, 205, 213, 3, 4, 0, 25], ["+", 205, 213, 63, 214, 205, 213, 63, 214, 0, 131]]
| 8
| 162
| 4
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
var abk = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
var res = 1;
for (int i = 1;; i++) {
if (abk[0] % i == 0 && abk[1] % i == 0) {
if (abk[2] == res) {
Console.WriteLine(i);
return;
}
res++;
}
}
}
}
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
var abk = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
var res = 1;
for (int i = abk[0];; i--) {
if (abk[0] % i == 0 && abk[1] % i == 0) {
if (abk[2] == res) {
Console.WriteLine(i);
return;
}
res++;
}
}
}
}
|
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 10, 198, 0, 200, 0, 212, 0, 204, 205, 22], ["+", 0, 200, 0, 212, 0, 204, 206, 207, 0, 70], ["+", 0, 212, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 200, 0, 212, 0, 204, 206, 207, 0, 73], ["-", 0, 195, 8, 196, 0, 7, 26, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 7, 26, 223, 0, 68]]
| 8
| 118
| 7
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class AtCoderA {
static void Main() {
var sc = new Scanner();
string s = sc.Next();
Stack<char> stack = new Stack<char>();
int answer = 0;
foreach (var c in s) {
if (stack.Count == 0) {
stack.Push(c);
continue;
}
var before = stack.Peek();
if (c != before) {
answer++;
stack.Pop();
} else {
stack.Push(c);
}
}
Console.WriteLine(answer);
}
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.Collections.Generic;
using System.Linq;
using System.Text;
public class AtCoderA {
static void Main() {
var sc = new Scanner();
string s = sc.Next();
Stack<char> stack = new Stack<char>();
int answer = 0;
foreach (var c in s) {
if (stack.Count == 0) {
stack.Push(c);
continue;
}
var before = stack.Peek();
if (c != before) {
answer += 2;
stack.Pop();
} else {
stack.Push(c);
}
}
Console.WriteLine(answer);
}
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, 57, 64, 196, 0, 1, 0, 223, 0, 29], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 203]]
| 8
| 433
| 3
|
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program {
static void Main(string[] args) {
string S = Console.ReadLine();
int c0 = 0;
int c1 = 0;
for (var i = 0; i < S.Length; i++) {
if (S[i] == 0) {
c0++;
} else {
c1++;
}
}
int ans = 2 * c1;
if (c0 < c1) {
ans = 2 * c0;
}
Console.WriteLine(ans);
}
}
|
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program {
static void Main(string[] args) {
string S = Console.ReadLine();
int c0 = 0;
int c1 = 0;
for (var i = 0; i < S.Length; i++) {
if (S[i] == '0') {
c0++;
} else {
c1++;
}
}
int ans = 2 * c1;
if (c0 < c1) {
ans = 2 * c0;
}
Console.WriteLine(ans);
}
}
|
[["+", 8, 196, 0, 57, 15, 16, 12, 252, 0, 104]]
| 8
| 137
| 2
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static Asakatsu20200322B.Input;
namespace Asakatsu20200322B {
static class Input {
/// <summary>
/// 1行の入力をTに応じてリストに変換する関数を返す
/// </summary>
static Func<string, List<T>>
Cast<T>() => _ => _.Split(' ').Select(Convert<T>()).ToList();
/// <summary>
/// 1行の入力をTに応じて変換する関数を返す
/// </summary>
static Func<string, T> Convert<T>() {
Type t = typeof(T);
if (t == typeof(string))
return _ => (T)(object)_;
if (t == typeof(int))
return _ => (T)(object) int.Parse(_);
if (t == typeof(long))
return _ => (T)(object) long.Parse(_);
if (t == typeof(double))
return _ => (T)(object) double.Parse(_);
if (t == typeof(List<string>))
return _ => (T)(object)Cast<string>()(_);
if (t == typeof(List<int>))
return _ => (T)(object)Cast<int>()(_);
if (t == typeof(List<long>))
return _ => (T)(object)Cast<long>()(_);
if (t == typeof(List<double>))
return _ => (T)(object)Cast<double>()(_);
throw new NotSupportedException(t + "is not supported.");
}
static T Convert<T>(string s) => Convert<T>()(s);
static string String() => Console.ReadLine();
static List<string>
String(long rowNumber) => new bool [rowNumber].Select(_ => String()).ToList();
/// <summary>
/// 1行の値の入力
/// </summary>
public static void Cin<T>(out T a) => a = Convert<List<T>>(String())[0];
public static void Cin<T1, T2>(out T1 a1, out T2 a2) {
var v = Convert<List<string>>(String());
a1 = Convert<T1>(v[0]);
a2 = Convert<T2>(v[1]);
}
public static void Cin<T1, T2, T3>(out T1 a1, out T2 a2, out T3 a3) {
var v = Convert<List<string>>(String());
a1 = Convert<T1>(v[0]);
a2 = Convert<T2>(v[1]);
a3 = Convert<T3>(v[2]);
}
public static void Cin<T1, T2, T3, T4>(out T1 a1, out T2 a2, out T3 a3,
out T4 a4) {
var v = Convert<List<string>>(String());
a1 = Convert<T1>(v[0]);
a2 = Convert<T2>(v[1]);
a3 = Convert<T3>(v[2]);
a4 = Convert<T4>(v[3]);
}
public static void Cin<T1, T2, T3, T4, T5>(out T1 a1, out T2 a2, out T3 a3,
out T4 a4, out T5 a5) {
var v = Convert<List<string>>(String());
a1 = Convert<T1>(v[0]);
a2 = Convert<T2>(v[1]);
a3 = Convert<T3>(v[2]);
a4 = Convert<T4>(v[3]);
a5 = Convert<T5>(v[4]);
}
public static void Cin<T1, T2, T3, T4, T5, T6>(out T1 a1, out T2 a2,
out T3 a3, out T4 a4,
out T5 a5, out T6 a6) {
var v = Convert<List<string>>(String());
a1 = Convert<T1>(v[0]);
a2 = Convert<T2>(v[1]);
a3 = Convert<T3>(v[2]);
a4 = Convert<T4>(v[3]);
a5 = Convert<T5>(v[4]);
a6 = Convert<T6>(v[5]);
}
/// <summary>
/// 複数行の値の入力
/// </summary>
public static void
Cin<T>(long n, out List<T> l) => l = String(n).Select(Convert<T>()).ToList();
public static void Cin<T1, T2>(long n, out List<T1> l1, out List<T2> l2) {
l1 = new List<T1>();
l2 = new List<T2>();
foreach (List<string> l in String(n).Select(Convert<List<string>>())) {
l1.Add(Convert<T1>(l[0]));
l2.Add(Convert<T2>(l[1]));
}
}
public static void Cin<T1, T2, T3>(long n, out List<T1> l1, out List<T2> l2,
out List<T3> l3) {
l1 = new List<T1>();
l2 = new List<T2>();
l3 = new List<T3>();
foreach (List<string> l in String(n).Select(Convert<List<string>>())) {
l1.Add(Convert<T1>(l[0]));
l2.Add(Convert<T2>(l[1]));
l3.Add(Convert<T3>(l[2]));
}
}
public static void Cin<T1, T2, T3, T4>(long n, out List<T1> l1,
out List<T2> l2, out List<T3> l3,
out List<T4> l4) {
l1 = new List<T1>();
l2 = new List<T2>();
l3 = new List<T3>();
l4 = new List<T4>();
foreach (List<string> l in String(n).Select(Convert<List<string>>())) {
l1.Add(Convert<T1>(l[0]));
l2.Add(Convert<T2>(l[1]));
l3.Add(Convert<T3>(l[2]));
l4.Add(Convert<T4>(l[3]));
}
}
/// <summary>
/// 1行に書かれた複数の値の入力
/// </summary>
public static void
Cin<T>(out List<T> lArr) => lArr = Convert<List<T>>(String());
/// <summary>
/// h行の行列の入力
/// </summary>
public static void Cin<T>(long h, out List<List<T>> map) => map =
String(h).Select(Convert<List<T>>()).ToList();
}
class Program {
public static void Main(string[] args) {
StreamWriter streamWriter =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(streamWriter);
new Solver().Solve();
Console.Out.Flush();
}
public static void Debug() { new Solver().Solve(); }
}
class Solver {
private string S;
public void Solve() {
Cin(out S);
int z = 0;
int o = 0;
for (int i = 0; i < S.Length; i++) {
if (S[i] == '0') {
z++;
} else {
o++;
}
}
Console.WriteLine(Math.Abs(z - o));
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static Asakatsu20200322B.Input;
namespace Asakatsu20200322B {
static class Input {
/// <summary>
/// 1行の入力をTに応じてリストに変換する関数を返す
/// </summary>
static Func<string, List<T>>
Cast<T>() => _ => _.Split(' ').Select(Convert<T>()).ToList();
/// <summary>
/// 1行の入力をTに応じて変換する関数を返す
/// </summary>
static Func<string, T> Convert<T>() {
Type t = typeof(T);
if (t == typeof(string))
return _ => (T)(object)_;
if (t == typeof(int))
return _ => (T)(object) int.Parse(_);
if (t == typeof(long))
return _ => (T)(object) long.Parse(_);
if (t == typeof(double))
return _ => (T)(object) double.Parse(_);
if (t == typeof(List<string>))
return _ => (T)(object)Cast<string>()(_);
if (t == typeof(List<int>))
return _ => (T)(object)Cast<int>()(_);
if (t == typeof(List<long>))
return _ => (T)(object)Cast<long>()(_);
if (t == typeof(List<double>))
return _ => (T)(object)Cast<double>()(_);
throw new NotSupportedException(t + "is not supported.");
}
static T Convert<T>(string s) => Convert<T>()(s);
static string String() => Console.ReadLine();
static List<string>
String(long rowNumber) => new bool [rowNumber].Select(_ => String()).ToList();
/// <summary>
/// 1行の値の入力
/// </summary>
public static void Cin<T>(out T a) => a = Convert<List<T>>(String())[0];
public static void Cin<T1, T2>(out T1 a1, out T2 a2) {
var v = Convert<List<string>>(String());
a1 = Convert<T1>(v[0]);
a2 = Convert<T2>(v[1]);
}
public static void Cin<T1, T2, T3>(out T1 a1, out T2 a2, out T3 a3) {
var v = Convert<List<string>>(String());
a1 = Convert<T1>(v[0]);
a2 = Convert<T2>(v[1]);
a3 = Convert<T3>(v[2]);
}
public static void Cin<T1, T2, T3, T4>(out T1 a1, out T2 a2, out T3 a3,
out T4 a4) {
var v = Convert<List<string>>(String());
a1 = Convert<T1>(v[0]);
a2 = Convert<T2>(v[1]);
a3 = Convert<T3>(v[2]);
a4 = Convert<T4>(v[3]);
}
public static void Cin<T1, T2, T3, T4, T5>(out T1 a1, out T2 a2, out T3 a3,
out T4 a4, out T5 a5) {
var v = Convert<List<string>>(String());
a1 = Convert<T1>(v[0]);
a2 = Convert<T2>(v[1]);
a3 = Convert<T3>(v[2]);
a4 = Convert<T4>(v[3]);
a5 = Convert<T5>(v[4]);
}
public static void Cin<T1, T2, T3, T4, T5, T6>(out T1 a1, out T2 a2,
out T3 a3, out T4 a4,
out T5 a5, out T6 a6) {
var v = Convert<List<string>>(String());
a1 = Convert<T1>(v[0]);
a2 = Convert<T2>(v[1]);
a3 = Convert<T3>(v[2]);
a4 = Convert<T4>(v[3]);
a5 = Convert<T5>(v[4]);
a6 = Convert<T6>(v[5]);
}
/// <summary>
/// 複数行の値の入力
/// </summary>
public static void
Cin<T>(long n, out List<T> l) => l = String(n).Select(Convert<T>()).ToList();
public static void Cin<T1, T2>(long n, out List<T1> l1, out List<T2> l2) {
l1 = new List<T1>();
l2 = new List<T2>();
foreach (List<string> l in String(n).Select(Convert<List<string>>())) {
l1.Add(Convert<T1>(l[0]));
l2.Add(Convert<T2>(l[1]));
}
}
public static void Cin<T1, T2, T3>(long n, out List<T1> l1, out List<T2> l2,
out List<T3> l3) {
l1 = new List<T1>();
l2 = new List<T2>();
l3 = new List<T3>();
foreach (List<string> l in String(n).Select(Convert<List<string>>())) {
l1.Add(Convert<T1>(l[0]));
l2.Add(Convert<T2>(l[1]));
l3.Add(Convert<T3>(l[2]));
}
}
public static void Cin<T1, T2, T3, T4>(long n, out List<T1> l1,
out List<T2> l2, out List<T3> l3,
out List<T4> l4) {
l1 = new List<T1>();
l2 = new List<T2>();
l3 = new List<T3>();
l4 = new List<T4>();
foreach (List<string> l in String(n).Select(Convert<List<string>>())) {
l1.Add(Convert<T1>(l[0]));
l2.Add(Convert<T2>(l[1]));
l3.Add(Convert<T3>(l[2]));
l4.Add(Convert<T4>(l[3]));
}
}
/// <summary>
/// 1行に書かれた複数の値の入力
/// </summary>
public static void
Cin<T>(out List<T> lArr) => lArr = Convert<List<T>>(String());
/// <summary>
/// h行の行列の入力
/// </summary>
public static void Cin<T>(long h, out List<List<T>> map) => map =
String(h).Select(Convert<List<T>>()).ToList();
}
class Program {
public static void Main(string[] args) {
StreamWriter streamWriter =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(streamWriter);
new Solver().Solve();
Console.Out.Flush();
}
public static void Debug() { new Solver().Solve(); }
}
class Solver {
private string S;
public void Solve() {
Cin(out S);
int z = 0;
int o = 0;
for (int i = 0; i < S.Length; i++) {
if (S[i] == '0') {
z++;
} else {
o++;
}
}
Console.WriteLine(S.Length - Math.Abs(z - o));
}
}
}
|
[["+", 3, 4, 0, 28, 0, 16, 31, 214, 205, 22], ["+", 3, 4, 0, 28, 0, 16, 31, 214, 0, 131], ["+", 3, 4, 0, 28, 0, 16, 31, 214, 141, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33]]
| 8
| 1,651
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
class Program {
static void Main(string[] args) {
var s = Console.ReadLine();
var l = new LinkedList<bool>(s.Select(x => x == '1'));
var node = l.First;
while (node == null || node.Next == null) {
var nPrev = node;
var nNext = node.Next;
if (nPrev.Value != nNext.Value) {
node = nPrev.Previous ?? nNext.Next;
l.Remove(nPrev);
l.Remove(nNext);
} else {
node = nNext;
}
}
Console.WriteLine(s.Length - l.Count);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
class Program {
static void Main(string[] args) {
var s = Console.ReadLine();
var l = new LinkedList<bool>(s.Select(x => x == '1'));
var node = l.First;
while (node?.Next != null) {
var nPrev = node;
var nNext = node.Next;
if (nPrev.Value != nNext.Value) {
node = nPrev.Previous ?? nNext.Next;
l.Remove(nPrev);
l.Remove(nNext);
} else {
node = nNext;
}
}
Console.WriteLine(s.Length - l.Count);
}
}
|
[["-", 8, 196, 0, 52, 15, 16, 31, 16, 17, 60], ["-", 8, 196, 0, 52, 15, 16, 31, 16, 12, 215], ["-", 0, 195, 8, 196, 0, 52, 15, 16, 17, 106], ["-", 0, 52, 15, 16, 12, 16, 31, 214, 205, 22], ["+", 8, 196, 0, 52, 15, 16, 31, 332, 0, 101], ["-", 8, 196, 0, 52, 15, 16, 12, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 52, 15, 16, 17, 79]]
| 8
| 158
| 7
|
using System;
namespace _20190304_05 {
class Program {
static void Main(string[] args) {
var str = Console.ReadLine();
var c0 = 0;
var c1 = 0;
foreach (var c in str) {
if (c == '0') {
c0++;
} else {
c1++;
}
}
Console.WriteLine(Math.Min(c0, c1));
}
}
}
|
using System;
namespace _20190304_05 {
class Program {
static void Main(string[] args) {
var str = Console.ReadLine();
var c0 = 0;
var c1 = 0;
foreach (var c in str) {
if (c == '0') {
c0++;
} else {
c1++;
}
}
Console.WriteLine(Math.Min(c0, c1) * 2);
}
}
}
|
[["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 48], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
| 8
| 83
| 2
|
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
//入力の受け取り
char[] input = Console.ReadLine().ToCharArray();
//配列→list
List<char> numList = new List<char>();
for (int jj = 0; jj < input.Length; jj++) {
numList.Add(input[jj]);
}
//答え用カウンター
int answer = 0;
//隣合う0と1を取り除いてカウントしていく
for (int ii = 0; ii < numList.Count - 1; ii++) {
if (numList[ii] != numList[ii + 1]) {
numList.RemoveAt(ii);
numList.RemoveAt(ii);
answer = answer + 2;
if (ii < 2) {
ii = 0;
} else {
ii = ii - 2;
}
}
}
//回答提出
Console.WriteLine(answer);
}
}
|
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
//入力の受け取り
char[] input = Console.ReadLine().ToCharArray();
//配列→list
List<char> numList = new List<char>();
for (int jj = 0; jj < input.Length; jj++) {
numList.Add(input[jj]);
}
//答え用カウンター
int answer = 0;
//隣合う0と1を取り除いてカウントしていく
for (int ii = 0; ii < numList.Count - 1; ii++) {
if (numList[ii] != numList[ii + 1]) {
numList.RemoveAt(ii);
numList.RemoveAt(ii);
answer = answer + 2;
if (ii < 2) {
ii = -1;
} else {
ii = ii - 2;
}
}
}
//回答提出
Console.WriteLine(answer);
}
}
|
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 203], ["+", 64, 196, 0, 1, 0, 11, 12, 241, 0, 33], ["+", 64, 196, 0, 1, 0, 11, 12, 241, 0, 203]]
| 8
| 176
| 3
|
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello {
public static void Main() {
var s = Console.ReadLine();
var cntZero = 0;
var cntOne = 0;
for (var i = 0; i < s.Length; i++) {
if (s[i] == '0') {
cntZero++;
} else {
cntOne++;
}
}
Console.WriteLine(Math.Min(cntZero, cntOne));
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello {
public static void Main() {
var s = Console.ReadLine();
var cntZero = 0;
var cntOne = 0;
for (var i = 0; i < s.Length; i++) {
if (s[i] == '0') {
cntZero++;
} else {
cntOne++;
}
}
Console.WriteLine(Math.Min(cntZero, cntOne) * 2);
}
}
|
[["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 48], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
| 8
| 101
| 2
|
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
class P {
static void Main() {
var nm = Console.ReadLine().Split().Select(int.Parse).ToList();
var abs =
Enumerable.Repeat(0, nm[1])
.Select(_ => Console.ReadLine().Split().Select(int.Parse).ToList())
.ToList();
List<long> res = new List<long>();
// CompressionUnionFind uf = new CompressionUnionFind(nm[0]);
HalvingUnionFind uf = new HalvingUnionFind(nm[0]);
long now = (long)nm[0] * (nm[0] - 1) / 2;
foreach (var ab in abs.Reverse<List<int>>()) {
res.Add(now);
long acount = uf.GetSize(ab[0] - 1);
long bcount = uf.GetSize(ab[1] - 1);
if (uf.TryUnite(ab[0] - 1, ab[1] - 1)) {
now -= acount * bcount;
}
}
res.Reverse();
Console.WriteLine(string.Join("\n", res));
}
}
class HalvingUnionFind {
public int Size { get; private set; }
public int GroupCount { get; private set; }
List<int> parent;
List<int> sizes;
public HalvingUnionFind(int count) {
Size = 0;
GroupCount = 0;
parent = new List<int>(count);
sizes = new List<int>(count);
ExtendSize(count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryUnite(int x, int y) {
int xp = Find(x);
int yp = Find(y);
if (yp == xp)
return false;
if (sizes[xp] < sizes[yp]) {
var tmp = xp;
xp = yp;
yp = tmp;
}
GroupCount--;
parent[yp] = xp;
sizes[xp] += sizes[yp];
return true;
}
public IEnumerable<int> AllRepresents => parent.Where(x => x == parent[x]);
public int GetSize(int x) => sizes[Find(x)];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int Find(int x) {
while (parent[x] != parent[parent[x]]) {
parent[x] = parent[parent[x]];
x = parent[x];
}
return x;
}
public void ExtendSize(int treeSize) {
if (treeSize <= Size)
return;
parent.Capacity = treeSize;
sizes.Capacity = treeSize;
while (Size < treeSize) {
parent.Add(Size);
sizes.Add(1);
Size++;
GroupCount++;
}
}
}
class CompressionUnionFind {
public int Size { get; private set; }
public int GroupCount { get; private set; }
List<int> parent;
List<int> sizes;
public CompressionUnionFind(int count) {
Size = 0;
GroupCount = 0;
parent = new List<int>(count);
sizes = new List<int>(count);
ExtendSize(count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryUnite(int x, int y) {
int xp = Find(x);
int yp = Find(y);
if (yp == xp)
return false;
if (sizes[xp] < sizes[yp]) {
var tmp = xp;
xp = yp;
yp = tmp;
}
GroupCount--;
parent[yp] = xp;
sizes[xp] += sizes[yp];
return true;
}
public IEnumerable<int> AllRepresents => parent.Where(x => x == parent[x]);
public int GetSize(int x) => sizes[Find(x)];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int Find(int x) {
List<int> pathNodes = new List<int>();
while (parent[x] != parent[parent[x]]) {
pathNodes.Add(x);
x = parent[x];
}
for (int i = 0; i < pathNodes.Count; i++)
parent[pathNodes[i]] = parent[x];
return parent[x];
}
public void ExtendSize(int treeSize) {
if (treeSize <= Size)
return;
parent.Capacity = treeSize;
sizes.Capacity = treeSize;
while (Size < treeSize) {
parent.Add(Size);
sizes.Add(1);
Size++;
GroupCount++;
}
}
}
class SegmentTree<T> {
public int Size { get; private set; }
T IdentityElement;
T[] Data;
Func<T, T, T> Merge;
int LeafCount;
public SegmentTree(int size, T identityElement, Func<T, T, T> merge)
: this(Enumerable.Repeat(identityElement, size).ToArray(),
identityElement, merge) {}
public SegmentTree(T[] elems, T identityElement, Func<T, T, T> merge) {
Size = elems.Length;
Merge = merge;
IdentityElement = identityElement;
LeafCount = 1;
while (LeafCount < elems.Length)
LeafCount <<= 1;
Data = new T[LeafCount * 2];
elems.CopyTo(Data, LeafCount);
for (int i = LeafCount - 1; i >= 0; i--)
Data[i] = Merge(Data[i * 2], Data[i * 2 + 1]);
}
public void Update(int i, T x) {
int ind = LeafCount + i;
Data[ind] = x;
while (0 < (ind >>= 1))
Data[ind] = Merge(Data[ind * 2], Data[ind * 2 + 1]);
}
public T Query(int l, int r) => Query(l, r, 1, 0, LeafCount - 1);
private T Query(int l, int r, int i, int x, int y) {
if (y < l || r < x)
return IdentityElement;
if (l <= x && y <= r)
return Data[i];
return Merge(Query(l, r, i * 2, x, (x + y) / 2),
Query(l, r, i * 2 + 1, (x + y) / 2 + 1, y));
}
}
|
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
class P {
static void Main() {
var nm = Console.ReadLine().Split().Select(int.Parse).ToList();
var abs =
Enumerable.Repeat(0, nm[1])
.Select(_ => Console.ReadLine().Split().Select(int.Parse).ToList())
.ToList();
List<long> res = new List<long>();
// CompressionUnionFind uf = new CompressionUnionFind(nm[0]);
HalvingUnionFind uf = new HalvingUnionFind(nm[0]);
long now = (long)nm[0] * (nm[0] - 1) / 2;
foreach (var ab in abs.Reverse<List<int>>()) {
res.Add(now);
long acount = uf.GetSize(ab[0] - 1);
long bcount = uf.GetSize(ab[1] - 1);
if (uf.TryUnite(ab[0] - 1, ab[1] - 1)) {
now -= acount * bcount;
}
}
res.Reverse();
Console.WriteLine(string.Join("\n", res));
}
}
class HalvingUnionFind {
public int Size { get; private set; }
public int GroupCount { get; private set; }
List<int> parent;
List<int> sizes;
public HalvingUnionFind(int count) {
Size = 0;
GroupCount = 0;
parent = new List<int>(count);
sizes = new List<int>(count);
ExtendSize(count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryUnite(int x, int y) {
int xp = Find(x);
int yp = Find(y);
if (yp == xp)
return false;
if (sizes[xp] < sizes[yp]) {
var tmp = xp;
xp = yp;
yp = tmp;
}
GroupCount--;
parent[yp] = xp;
sizes[xp] += sizes[yp];
return true;
}
public IEnumerable<int> AllRepresents => parent.Where(x => x == parent[x]);
public int GetSize(int x) => sizes[Find(x)];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int Find(int x) {
while (x != parent[x]) {
parent[x] = parent[parent[x]];
x = parent[x];
}
return x;
}
public void ExtendSize(int treeSize) {
if (treeSize <= Size)
return;
parent.Capacity = treeSize;
sizes.Capacity = treeSize;
while (Size < treeSize) {
parent.Add(Size);
sizes.Add(1);
Size++;
GroupCount++;
}
}
}
class CompressionUnionFind {
public int Size { get; private set; }
public int GroupCount { get; private set; }
List<int> parent;
List<int> sizes;
public CompressionUnionFind(int count) {
Size = 0;
GroupCount = 0;
parent = new List<int>(count);
sizes = new List<int>(count);
ExtendSize(count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryUnite(int x, int y) {
int xp = Find(x);
int yp = Find(y);
if (yp == xp)
return false;
if (sizes[xp] < sizes[yp]) {
var tmp = xp;
xp = yp;
yp = tmp;
}
GroupCount--;
parent[yp] = xp;
sizes[xp] += sizes[yp];
return true;
}
public IEnumerable<int> AllRepresents => parent.Where(x => x == parent[x]);
public int GetSize(int x) => sizes[Find(x)];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int Find(int x) {
List<int> pathNodes = new List<int>();
while (parent[x] != parent[parent[x]]) {
pathNodes.Add(x);
x = parent[x];
}
for (int i = 0; i < pathNodes.Count; i++)
parent[pathNodes[i]] = parent[x];
return parent[x];
}
public void ExtendSize(int treeSize) {
if (treeSize <= Size)
return;
parent.Capacity = treeSize;
sizes.Capacity = treeSize;
while (Size < treeSize) {
parent.Add(Size);
sizes.Add(1);
Size++;
GroupCount++;
}
}
}
class SegmentTree<T> {
public int Size { get; private set; }
T IdentityElement;
T[] Data;
Func<T, T, T> Merge;
int LeafCount;
public SegmentTree(int size, T identityElement, Func<T, T, T> merge)
: this(Enumerable.Repeat(identityElement, size).ToArray(),
identityElement, merge) {}
public SegmentTree(T[] elems, T identityElement, Func<T, T, T> merge) {
Size = elems.Length;
Merge = merge;
IdentityElement = identityElement;
LeafCount = 1;
while (LeafCount < elems.Length)
LeafCount <<= 1;
Data = new T[LeafCount * 2];
elems.CopyTo(Data, LeafCount);
for (int i = LeafCount - 1; i >= 0; i--)
Data[i] = Merge(Data[i * 2], Data[i * 2 + 1]);
}
public void Update(int i, T x) {
int ind = LeafCount + i;
Data[ind] = x;
while (0 < (ind >>= 1))
Data[ind] = Merge(Data[ind * 2], Data[ind * 2 + 1]);
}
public T Query(int l, int r) => Query(l, r, 1, 0, LeafCount - 1);
private T Query(int l, int r, int i, int x, int y) {
if (y < l || r < x)
return IdentityElement;
if (l <= x && y <= r)
return Data[i];
return Merge(Query(l, r, i * 2, x, (x + y) / 2),
Query(l, r, i * 2 + 1, (x + y) / 2 + 1, y));
}
}
|
[["-", 8, 196, 0, 52, 15, 16, 31, 204, 205, 22], ["-", 0, 52, 15, 16, 31, 204, 206, 207, 0, 70], ["-", 0, 52, 15, 16, 31, 204, 206, 207, 0, 73], ["-", 8, 196, 0, 52, 15, 16, 12, 204, 205, 22], ["-", 0, 52, 15, 16, 12, 204, 206, 207, 0, 70], ["-", 206, 207, 0, 28, 0, 204, 206, 207, 0, 73]]
| 8
| 1,385
| 6
|
using System;
using System.Linq;
namespace Sample {
class Sample {
static void Main(string[] args) {
string S = Console.ReadLine();
int s2 = int.Parse(S.Replace("/", ""));
if (s2 <= 20200430) {
Console.WriteLine("Heisei");
} else {
Console.WriteLine("TBD");
}
}
}
}
|
using System;
using System.Linq;
namespace Sample {
class Sample {
static void Main(string[] args) {
string S = Console.ReadLine();
int s2 = int.Parse(S.Replace("/", ""));
if (s2 <= 20190430) {
Console.WriteLine("Heisei");
} else {
Console.WriteLine("TBD");
}
}
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203]]
| 8
| 85
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
public class Hello {
public static void Main() {
string[] num = ReadLine().Split('/');
if (int.Parse(num[1]) <= 4) {
WriteLine("heisei");
} else {
WriteLine("TBD");
}
}
//各種読取
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;
}
// A/B小数点以下切上
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); }
}
//知見
// (string) hogestr -> (char[]) hoge
// char hoge = hogestr.ToCharArray();
// (char[]) hoge -> (string) hogestr
// string hoge = new string(hoge);
// Hashtable × Dictionary ○
// Dictionary hoge<string,int>
// hoge.ContainsKey(string) -> return boolean
// hoge[string] -> return int
// hoge[int] -> CE
// Dictionary hoge<int1,int2>
// hoge<int1,int2>: hoge[int1] -> return int2
// KeyValuePair<int,int> k <-> k.Key == int1 / k.Value == int2
// SortedDictionary() > SortedList() ???
// キュー -> 幅優先 ???
// スタック -> 深さ優先 ???
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
public class Hello {
public static void Main() {
string[] num = ReadLine().Split('/');
if (int.Parse(num[1]) <= 4) {
WriteLine("Heisei");
} else {
WriteLine("TBD");
}
}
//各種読取
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;
}
// A/B小数点以下切上
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); }
}
//知見
// (string) hogestr -> (char[]) hoge
// char hoge = hogestr.ToCharArray();
// (char[]) hoge -> (string) hogestr
// string hoge = new string(hoge);
// Hashtable × Dictionary ○
// Dictionary hoge<string,int>
// hoge.ContainsKey(string) -> return boolean
// hoge[string] -> return int
// hoge[int] -> CE
// Dictionary hoge<int1,int2>
// hoge<int1,int2>: hoge[int1] -> return int2
// KeyValuePair<int,int> k <-> k.Key == int1 / k.Value == int2
// SortedDictionary() > SortedList() ???
// キュー -> 幅優先 ???
// スタック -> 深さ優先 ???
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 617
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2 {
class Program {
static void Main(string[] args) {
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
string ans = "";
if ((N + 2) / 2 >= M)
ans = "YES";
else
ans = "NO";
Console.WriteLine(ans);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2 {
class Program {
static void Main(string[] args) {
int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = input[0];
int M = input[1];
string ans = "";
if ((N + 1) / 2 >= M)
ans = "YES";
else
ans = "NO";
Console.WriteLine(ans);
}
}
}
|
[["-", 15, 16, 31, 16, 31, 23, 0, 16, 12, 203], ["+", 15, 16, 31, 16, 31, 23, 0, 16, 12, 203]]
| 8
| 126
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class AtCoderA {
static void Main() {
var sc = new Scanner();
long n = sc.NextLong();
long k = sc.NextLong();
bool ok = n + 1 / 2 >= k;
string answer = ok ? "YES" : "NO";
Console.WriteLine(answer);
}
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.Collections.Generic;
using System.Linq;
using System.Text;
public class AtCoderA {
static void Main() {
var sc = new Scanner();
long n = sc.NextLong();
long k = sc.NextLong();
bool ok = (n + 1) / 2 >= k;
string answer = ok ? "YES" : "NO";
Console.WriteLine(answer);
}
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, 212, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 212, 0, 16, 31, 16, 31, 23, 0, 25]]
| 8
| 383
| 2
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;
namespace Program {
public static class ProblemA {
static bool SAIKI = false;
static public int numberOfRandomCases = 0;
static public void MakeTestCase(List<string> _input, List<string> _output,
ref Func<string[], bool> _outputChecker) {}
static public void Solve() {
var N = NN;
var K = NN;
if (N / 2 >= K - 1)
Console.WriteLine("YES");
else
Console.WriteLine("NO");
}
class Printer : StreamWriter {
public override IFormatProvider FormatProvider {
get { return CultureInfo.InvariantCulture; }
}
public Printer(Stream stream)
: base(stream, new UTF8Encoding(false, true)) {
base.AutoFlush = false;
}
public Printer(Stream stream, Encoding encoding) : base(stream, encoding) {
base.AutoFlush = false;
}
}
static LIB_FastIO fastio = new LIB_FastIODebug();
static public void Main(string[] args) {
if (args.Length == 0) {
fastio = new LIB_FastIO();
Console.SetOut(new Printer(Console.OpenStandardOutput()));
}
if (SAIKI) {
var t = new Thread(Solve, 134217728);
t.Start();
t.Join();
} else
Solve();
Console.Out.Flush();
}
static long NN => fastio.Long();
static double ND => fastio.Double();
static string NS => fastio.Scan();
static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
static long Count<T>(this IEnumerable<T> x,
Func<T, bool> pred) => Enumerable.Count(x, pred);
static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v,
(int)n);
static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s,
(int)c);
static IOrderedEnumerable<T>
OrderByRand<T>(this IEnumerable<T> x) => Enumerable.OrderBy(x, _ => xorshift);
static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x) =>
Enumerable.OrderBy(x.OrderByRand(), e => e);
static IOrderedEnumerable<T1> OrderBy<T1, T2>(this IEnumerable<T1> x,
Func<T1, T2> selector) =>
Enumerable.OrderBy(x.OrderByRand(), selector);
static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x) =>
Enumerable.OrderByDescending(x.OrderByRand(), e => e);
static IOrderedEnumerable<T1>
OrderByDescending<T1, T2>(this IEnumerable<T1> x, Func<T1, T2> selector) =>
Enumerable.OrderByDescending(x.OrderByRand(), selector);
static IOrderedEnumerable<string> OrderBy(this IEnumerable<string> x) =>
x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);
static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x,
Func<T, string> selector) =>
x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);
static IOrderedEnumerable<string>
OrderByDescending(this IEnumerable<string> x) =>
x.OrderByRand().OrderByDescending(e => e,
StringComparer.OrdinalIgnoreCase);
static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x,
Func<T, string> selector) =>
x.OrderByRand().OrderByDescending(selector,
StringComparer.OrdinalIgnoreCase);
static uint xorshift {
get {
_xsi.MoveNext();
return _xsi.Current;
}
}
static IEnumerator<uint> _xsi = _xsc();
static IEnumerator<uint> _xsc() {
uint x = 123456789, y = 362436069, z = 521288629,
w = (uint)(DateTime.Now.Ticks & 0xffffffff);
while (true) {
var t = x ^ (x << 11);
x = y;
y = z;
z = w;
w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
yield return w;
}
}
}
}
namespace Library {
class LIB_FastIO {
public LIB_FastIO() { str = Console.OpenStandardInput(); }
readonly Stream str;
readonly byte[] buf = new byte[1024];
int len, ptr;
public bool isEof = false;
public bool IsEndOfStream {
get { return isEof; }
}
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++];
}
char Char() {
byte b = 0;
do
b = read();
while (b < 33 || 126 < b);
return (char)b;
}
virtual public string Scan() {
var sb = new StringBuilder();
for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
sb.Append(b);
return sb.ToString();
}
virtual 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';
}
}
virtual public double Double() {
return double.Parse(Scan(), CultureInfo.InvariantCulture);
}
}
class LIB_FastIODebug : LIB_FastIO {
Queue<string> param = new Queue<string>();
string NextString() {
if (param.Count == 0)
foreach (var item in Console.ReadLine().Split(' '))
param.Enqueue(item);
return param.Dequeue();
}
public LIB_FastIODebug() {}
public override string Scan() => NextString();
public override long Long() => long.Parse(NextString());
public override double Double() => double.Parse(NextString());
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;
namespace Program {
public static class ProblemA {
static bool SAIKI = false;
static public int numberOfRandomCases = 0;
static public void MakeTestCase(List<string> _input, List<string> _output,
ref Func<string[], bool> _outputChecker) {}
static public void Solve() {
var N = NN;
var K = NN;
if (N >= K * 2 - 1)
Console.WriteLine("YES");
else
Console.WriteLine("NO");
}
class Printer : StreamWriter {
public override IFormatProvider FormatProvider {
get { return CultureInfo.InvariantCulture; }
}
public Printer(Stream stream)
: base(stream, new UTF8Encoding(false, true)) {
base.AutoFlush = false;
}
public Printer(Stream stream, Encoding encoding) : base(stream, encoding) {
base.AutoFlush = false;
}
}
static LIB_FastIO fastio = new LIB_FastIODebug();
static public void Main(string[] args) {
if (args.Length == 0) {
fastio = new LIB_FastIO();
Console.SetOut(new Printer(Console.OpenStandardOutput()));
}
if (SAIKI) {
var t = new Thread(Solve, 134217728);
t.Start();
t.Join();
} else
Solve();
Console.Out.Flush();
}
static long NN => fastio.Long();
static double ND => fastio.Double();
static string NS => fastio.Scan();
static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
static long Count<T>(this IEnumerable<T> x,
Func<T, bool> pred) => Enumerable.Count(x, pred);
static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v,
(int)n);
static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s,
(int)c);
static IOrderedEnumerable<T>
OrderByRand<T>(this IEnumerable<T> x) => Enumerable.OrderBy(x, _ => xorshift);
static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x) =>
Enumerable.OrderBy(x.OrderByRand(), e => e);
static IOrderedEnumerable<T1> OrderBy<T1, T2>(this IEnumerable<T1> x,
Func<T1, T2> selector) =>
Enumerable.OrderBy(x.OrderByRand(), selector);
static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x) =>
Enumerable.OrderByDescending(x.OrderByRand(), e => e);
static IOrderedEnumerable<T1>
OrderByDescending<T1, T2>(this IEnumerable<T1> x, Func<T1, T2> selector) =>
Enumerable.OrderByDescending(x.OrderByRand(), selector);
static IOrderedEnumerable<string> OrderBy(this IEnumerable<string> x) =>
x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);
static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x,
Func<T, string> selector) =>
x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);
static IOrderedEnumerable<string>
OrderByDescending(this IEnumerable<string> x) =>
x.OrderByRand().OrderByDescending(e => e,
StringComparer.OrdinalIgnoreCase);
static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x,
Func<T, string> selector) =>
x.OrderByRand().OrderByDescending(selector,
StringComparer.OrdinalIgnoreCase);
static uint xorshift {
get {
_xsi.MoveNext();
return _xsi.Current;
}
}
static IEnumerator<uint> _xsi = _xsc();
static IEnumerator<uint> _xsc() {
uint x = 123456789, y = 362436069, z = 521288629,
w = (uint)(DateTime.Now.Ticks & 0xffffffff);
while (true) {
var t = x ^ (x << 11);
x = y;
y = z;
z = w;
w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
yield return w;
}
}
}
}
namespace Library {
class LIB_FastIO {
public LIB_FastIO() { str = Console.OpenStandardInput(); }
readonly Stream str;
readonly byte[] buf = new byte[1024];
int len, ptr;
public bool isEof = false;
public bool IsEndOfStream {
get { return isEof; }
}
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++];
}
char Char() {
byte b = 0;
do
b = read();
while (b < 33 || 126 < b);
return (char)b;
}
virtual public string Scan() {
var sb = new StringBuilder();
for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
sb.Append(b);
return sb.ToString();
}
virtual 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';
}
}
virtual public double Double() {
return double.Parse(Scan(), CultureInfo.InvariantCulture);
}
}
class LIB_FastIODebug : LIB_FastIO {
Queue<string> param = new Queue<string>();
string NextString() {
if (param.Count == 0)
foreach (var item in Console.ReadLine().Split(' '))
param.Enqueue(item);
return param.Dequeue();
}
public LIB_FastIODebug() {}
public override string Scan() => NextString();
public override long Long() => long.Parse(NextString());
public override double Double() => double.Parse(NextString());
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 85], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["+", 0, 57, 15, 16, 12, 16, 31, 16, 17, 48], ["+", 0, 57, 15, 16, 12, 16, 31, 16, 12, 203]]
| 8
| 1,442
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static void Main(string[] args) {
var N = sc.ReadInt();
var K = sc.ReadInt();
var count = 0;
for (int i = 1; i <= N; i += 2) {
count++;
}
if (count < K) {
Console.WriteLine("NO");
} else {
Console.WriteLine("Yes");
}
}
static Scanner sc = new Scanner();
}
class Scanner {
string[] S = new string[0];
int Index = 0;
char[] Separators = new char[] { ' ' };
public string Next() {
if (this.Index < this.S.Length)
return this.S[this.Index++];
var line = "";
while (line == "")
line = Console.ReadLine();
this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
if (this.S.Length == 0)
return this.Next();
this.Index = 0;
return this.S[this.Index++];
}
public string ReadStr() { return this.Next(); }
public char ReadChar() { return this.Next()[0]; }
public int ReadInt() { return int.Parse(this.Next()); }
public uint ReadUInt() { return uint.Parse(this.Next()); }
public long ReadLong() { return long.Parse(this.Next()); }
public double ReadDouble() { return double.Parse(this.Next()); }
public Tuple<int, int> ReadTup() {
return Tuple.Create(this.ReadInt(), this.ReadInt());
}
public Tuple<long, long> ReadTupLong() {
return Tuple.Create(this.ReadLong(), this.ReadLong());
}
public Tuple<int, int, int> ReadTup3() {
return Tuple.Create(this.ReadInt(), this.ReadInt(), this.ReadInt());
}
public Tuple<int, int, int, int> ReadTup4() {
return Tuple.Create(this.ReadInt(), this.ReadInt(), this.ReadInt(),
this.ReadInt());
}
public int[] ReadIntArray(int n) {
var array = new int[n];
for (int i = 0; i < array.Length; i++) {
array[i] = this.ReadInt();
}
return array;
}
public long[] ReadLongArray(int n) {
var array = new long[n];
for (int i = 0; i < array.Length; i++) {
array[i] = this.ReadLong();
}
return array;
}
public double[] ReadDoubleArray(int n) {
var array = new double[n];
for (int i = 0; i < array.Length; i++) {
array[i] = this.ReadDouble();
}
return array;
}
public char[] ReadCharArray(int n) {
var array = new char[n];
for (int i = 0; i < array.Length; i++) {
array[i] = this.ReadChar();
}
return array;
}
public string[] ReadStrArray(int n) {
var array = new string[n];
for (int i = 0; i < array.Length; i++) {
array[i] = this.ReadStr();
}
return array;
}
public Tuple<long, long>[] ReadTupLongArray(int n) {
var array = new Tuple<long, long>[n];
for (int i = 0; i < n; i++) {
array[i] = this.ReadTupLong();
}
return array;
}
public Tuple<int, int>[] ReadTupArray(int n) {
var array = new Tuple<int, int>[n];
for (int i = 0; i < n; i++) {
array[i] = this.ReadTup();
}
return array;
}
public Tuple<int, int, int>[] ReadTup3Array(int n) {
var array = new Tuple<int, int, int>[n];
for (int i = 0; i < n; i++) {
array[i] = this.ReadTup3();
}
return array;
}
public Tuple<int, int, int, int>[] ReadTup4Array(int n) {
var array = new Tuple<int, int, int, int>[n];
for (int i = 0; i < n; i++) {
array[i] = this.ReadTup4();
}
return array;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static void Main(string[] args) {
var N = sc.ReadInt();
var K = sc.ReadInt();
var count = 0;
for (int i = 1; i <= N; i += 2) {
count++;
}
if (count < K) {
Console.WriteLine("NO");
} else {
Console.WriteLine("YES");
}
}
static Scanner sc = new Scanner();
}
class Scanner {
string[] S = new string[0];
int Index = 0;
char[] Separators = new char[] { ' ' };
public string Next() {
if (this.Index < this.S.Length)
return this.S[this.Index++];
var line = "";
while (line == "")
line = Console.ReadLine();
this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
if (this.S.Length == 0)
return this.Next();
this.Index = 0;
return this.S[this.Index++];
}
public string ReadStr() { return this.Next(); }
public char ReadChar() { return this.Next()[0]; }
public int ReadInt() { return int.Parse(this.Next()); }
public uint ReadUInt() { return uint.Parse(this.Next()); }
public long ReadLong() { return long.Parse(this.Next()); }
public double ReadDouble() { return double.Parse(this.Next()); }
public Tuple<int, int> ReadTup() {
return Tuple.Create(this.ReadInt(), this.ReadInt());
}
public Tuple<long, long> ReadTupLong() {
return Tuple.Create(this.ReadLong(), this.ReadLong());
}
public Tuple<int, int, int> ReadTup3() {
return Tuple.Create(this.ReadInt(), this.ReadInt(), this.ReadInt());
}
public Tuple<int, int, int, int> ReadTup4() {
return Tuple.Create(this.ReadInt(), this.ReadInt(), this.ReadInt(),
this.ReadInt());
}
public int[] ReadIntArray(int n) {
var array = new int[n];
for (int i = 0; i < array.Length; i++) {
array[i] = this.ReadInt();
}
return array;
}
public long[] ReadLongArray(int n) {
var array = new long[n];
for (int i = 0; i < array.Length; i++) {
array[i] = this.ReadLong();
}
return array;
}
public double[] ReadDoubleArray(int n) {
var array = new double[n];
for (int i = 0; i < array.Length; i++) {
array[i] = this.ReadDouble();
}
return array;
}
public char[] ReadCharArray(int n) {
var array = new char[n];
for (int i = 0; i < array.Length; i++) {
array[i] = this.ReadChar();
}
return array;
}
public string[] ReadStrArray(int n) {
var array = new string[n];
for (int i = 0; i < array.Length; i++) {
array[i] = this.ReadStr();
}
return array;
}
public Tuple<long, long>[] ReadTupLongArray(int n) {
var array = new Tuple<long, long>[n];
for (int i = 0; i < n; i++) {
array[i] = this.ReadTupLong();
}
return array;
}
public Tuple<int, int>[] ReadTupArray(int n) {
var array = new Tuple<int, int>[n];
for (int i = 0; i < n; i++) {
array[i] = this.ReadTup();
}
return array;
}
public Tuple<int, int, int>[] ReadTup3Array(int n) {
var array = new Tuple<int, int, int>[n];
for (int i = 0; i < n; i++) {
array[i] = this.ReadTup3();
}
return array;
}
public Tuple<int, int, int, int>[] ReadTup4Array(int n) {
var array = new Tuple<int, int, int, int>[n];
for (int i = 0; i < n; i++) {
array[i] = this.ReadTup4();
}
return array;
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 1,011
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace program {
class Program {
static void Main() {
int[] n = Input.ScanIntArray();
if (n[0] / 2 + 1 >= n[1])
Console.WriteLine("YES");
else
Console.WriteLine("NO");
}
}
static class Input {
static public int ScanInt() { return int.Parse(Console.ReadLine()); }
static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
static public long ScanLong() { return long.Parse(Console.ReadLine()); }
static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
static public int[] ScanIntArray() {
return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
}
static public uint[] ScanUintArray() {
return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray();
}
static public double[] ScanDoubleArray() {
return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
}
static public long[] ScanLongArray() {
return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
}
static public ulong[] ScanUlongArray() {
return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray();
}
static public string ScanStr() { return Console.ReadLine(); }
static public string[] ScanStrArray() { return ScanStr().Split(' '); }
}
static class MyMath {
public static int GCD(int a, int b) {
Func<int, int, int> gcd = null;
gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
return a > b ? gcd(a, b) : gcd(b, a);
}
public static ulong GCD(ulong a, ulong b) {
Func<ulong, ulong, ulong> gcd = null;
gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
return a > b ? gcd(a, b) : gcd(b, a);
}
public static int LCM(int a, int b) { return a * b / GCD(a, b); }
public static ulong LCM(ulong a, ulong b) { return a * b / GCD(a, b); }
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace program {
class Program {
static void Main() {
int[] n = Input.ScanIntArray();
if ((n[0] + 1) / 2 >= n[1])
Console.WriteLine("YES");
else
Console.WriteLine("NO");
}
}
static class Input {
static public int ScanInt() { return int.Parse(Console.ReadLine()); }
static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
static public long ScanLong() { return long.Parse(Console.ReadLine()); }
static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
static public int[] ScanIntArray() {
return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
}
static public uint[] ScanUintArray() {
return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray();
}
static public double[] ScanDoubleArray() {
return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
}
static public long[] ScanLongArray() {
return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
}
static public ulong[] ScanUlongArray() {
return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray();
}
static public string ScanStr() { return Console.ReadLine(); }
static public string[] ScanStrArray() { return ScanStr().Split(' '); }
}
static class MyMath {
public static int GCD(int a, int b) {
Func<int, int, int> gcd = null;
gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
return a > b ? gcd(a, b) : gcd(b, a);
}
public static ulong GCD(ulong a, ulong b) {
Func<ulong, ulong, ulong> gcd = null;
gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
return a > b ? gcd(a, b) : gcd(b, a);
}
public static int LCM(int a, int b) { return a * b / GCD(a, b); }
public static ulong LCM(ulong a, ulong b) { return a * b / GCD(a, b); }
}
}
|
[["+", 0, 57, 15, 16, 31, 16, 31, 23, 0, 24], ["-", 0, 57, 15, 16, 31, 16, 31, 16, 17, 85], ["-", 0, 57, 15, 16, 31, 16, 31, 16, 12, 203], ["+", 0, 57, 15, 16, 31, 16, 31, 23, 0, 25], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 85], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203]]
| 8
| 607
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YahooProCon {
class Program {
static void Main(string[] args) {
int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
int N = a[0], K = a[1];
string r = "NO";
if (K >= (N + 1) / 2)
r = "YES";
Console.WriteLine(r);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YahooProCon {
class A {
static void Main(string[] args) {
int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
int N = a[0], K = a[1];
string r = "NO";
if (K <= (N + 1) / 2)
r = "YES";
Console.WriteLine(r);
}
}
}
|
[["-", 0, 208, 0, 209, 8, 201, 0, 235, 141, 22], ["+", 0, 208, 0, 209, 8, 201, 0, 235, 141, 22], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
| 8
| 127
| 4
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace MinnaProCon.A
{
using static Util;
public class Solver : SolverBase
{
public void Run() {
var ary = ReadIntArray();
var N = ary[0];
var K = ary[1];
if (2 * (K - 1) < N)
WriteLine("Yes");
else
WriteLine("No");
}
#if !MYHOME
public static void Main(string[] args) {
new Solver().Run();
}
#endif
}
public static class Util
{
public readonly static long MOD = 1000000007;
public static string DumpToString<T>(IEnumerable<T> array) where T : IFormattable {
var sb = new StringBuilder();
foreach (var item in array) {
sb.Append(item);
sb.Append(", ");
}
return sb.ToString();
}
public static void InitArray<T>(T[] ary, T value) {
for (int i = 0; i < ary.Length; i++) {
ary[i] = value;
}
}
public static void InitDP2<T>(T[,] dp, T value) {
for (int i = 0; i < dp.GetLength(0); i++) {
for (int j = 0; j < dp.GetLength(1); j++) {
dp[i, j] = value;
}
}
}
public static void InitDP3<T>(T[,,] dp, T value) {
for (int i = 0; i < dp.GetLength(0); i++) {
for (int j = 0; j < dp.GetLength(1); j++) {
for (int k = 0; k < dp.GetLength(2); k++) {
dp[i, j, k] = value;
}
}
}
}
public static T Max<T>(params T[] nums) where T : IComparable {
if (nums.Length == 0) return default(T);
T max = nums[0];
for (int i = 1; i < nums.Length; i++) {
max = max.CompareTo(nums[i]) > 0 ? max : nums[i];
}
return max;
}
public static T Min<T>(params T[] nums) where T : IComparable {
if (nums.Length == 0) return default(T);
T min = nums[0];
for (int i = 1; i < nums.Length; i++) {
min = min.CompareTo(nums[i]) < 0 ? min : nums[i];
}
return min;
}
/// <summary>
/// ソート済み配列 ary に同じ値の要素が含まれている?
/// ※ソート順は昇順/降順どちらでもよい
/// </summary>
public static bool HasDuplicateInSortedArray<T>(T[] ary) where T : IComparable, IComparable<T> {
if (ary.Length <= 1) return false;
var lastNum = ary[ary.Length - 1];
foreach (var n in ary) {
if (lastNum.CompareTo(n) == 0) {
return true;
} else {
lastNum = n;
}
}
return false;
}
/// <summary>
/// 二分探索
/// ※条件を満たす最小のidxを返す
/// ※満たすものがない場合は ary.Length を返す
/// ※『aryの先頭側が条件を満たさない、末尾側が条件を満たす』という前提
/// ただし、IsOK(...)の戻り値を逆転させれば、逆でも同じことが可能。
/// </summary>
/// <param name="ary">探索対象配列 ★ソート済みであること</param>
/// <param name="key">探索値 ※これ以上の値を持つ(IsOKがtrueを返す)最小のindexを返す</param>
public static int BinarySearch<T>(T[] ary, T key) where T : IComparable, IComparable<T> {
int left = -1;
int right = ary.Length;
while (1 < right - left) {
var mid = left + (right - left) / 2;
if (IsOK(ary, mid, key)) {
right = mid;
} else {
left = mid;
}
}
// left は条件を満たさない最大の値、right は条件を満たす最小の値になっている
return right;
}
public static bool IsOK<T>(T[] ary, int idx, T key) where T : IComparable, IComparable<T> {
// key <= ary[idx] と同じ意味
return key.CompareTo(ary[idx]) <= 0;
}
}
public class SolverBase
{
virtual protected string ReadLine() => Console.ReadLine();
virtual protected int ReadInt() => int.Parse(ReadLine());
//virtual protected void ReadInt2(out int x, out int y) {
// var aryS = ReadLine().Split(' ');
// x = int.Parse(aryS[0]);
// y = int.Parse(aryS[1]);
//}
virtual protected long ReadLong() => long.Parse(ReadLine());
virtual protected string[] ReadStringArray() => ReadLine().Split(' ');
virtual protected int[] ReadIntArray() => ReadLine().Split(' ').Select<string, int>(s => int.Parse(s)).ToArray();
virtual protected long[] ReadLongArray() => ReadLine().Split(' ').Select<string, long>(s => long.Parse(s)).ToArray();
virtual protected double[] ReadDoubleArray() => ReadLine().Split(' ').Select<string, double>(s => double.Parse(s)).ToArray();
virtual protected void WriteLine(string line) => Console.WriteLine(line);
virtual protected void WriteLine(double d) => Console.WriteLine($"{d:F9}");
virtual protected void WriteLine<T>(T value) where T : IFormattable => Console.WriteLine(value);
[Conditional("DEBUG")]
protected void Dump(string s) => Console.WriteLine(s);
[Conditional("DEBUG")]
protected void Dump(char c) => Console.WriteLine(c);
[Conditional("DEBUG")]
protected void Dump(double d) => Console.WriteLine($"{d:F9}");
[Conditional("DEBUG")]
protected void Dump<T>(IEnumerable<T> array) where T : IFormattable {
string s = Util.DumpToString(array);
// Consoleに出力すると、UnitTestの邪魔をしないというメリットあり。
Console.WriteLine(s);
//_writer.WriteLine(s);
}
[Conditional("DEBUG")]
protected void DumpGrid<T>(IEnumerable<IEnumerable<T>> arrayOfArray) where T : IFormattable {
var sb = new StringBuilder();
foreach (var a in arrayOfArray) {
sb.AppendLine(Util.DumpToString(a));
}
// Consoleに出力すると、UnitTestの邪魔をしないというメリットあり。
Console.WriteLine(sb.ToString());
//_writer.WriteLine(sb.ToString());
}
[Conditional("DEBUG")]
protected void DumpDP<T>(T[,] dp) where T : IFormattable {
var sb = new StringBuilder();
for (int i = 0; i < dp.GetLength(0); i++) {
for (int j = 0; j < dp.GetLength(1); j++) {
sb.Append(dp[i, j]);
sb.Append(", ");
}
sb.AppendLine();
}
Console.WriteLine(sb.ToString());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace MinnaProCon.A
{
using static Util;
public class Solver : SolverBase
{
public void Run() {
var ary = ReadIntArray();
var N = ary[0];
var K = ary[1];
if (2 * (K - 1) < N)
WriteLine("YES");
else
WriteLine("NO");
}
#if !MYHOME
public static void Main(string[] args) {
new Solver().Run();
}
#endif
}
public static class Util
{
public readonly static long MOD = 1000000007;
public static string DumpToString<T>(IEnumerable<T> array) where T : IFormattable {
var sb = new StringBuilder();
foreach (var item in array) {
sb.Append(item);
sb.Append(", ");
}
return sb.ToString();
}
public static void InitArray<T>(T[] ary, T value) {
for (int i = 0; i < ary.Length; i++) {
ary[i] = value;
}
}
public static void InitDP2<T>(T[,] dp, T value) {
for (int i = 0; i < dp.GetLength(0); i++) {
for (int j = 0; j < dp.GetLength(1); j++) {
dp[i, j] = value;
}
}
}
public static void InitDP3<T>(T[,,] dp, T value) {
for (int i = 0; i < dp.GetLength(0); i++) {
for (int j = 0; j < dp.GetLength(1); j++) {
for (int k = 0; k < dp.GetLength(2); k++) {
dp[i, j, k] = value;
}
}
}
}
public static T Max<T>(params T[] nums) where T : IComparable {
if (nums.Length == 0) return default(T);
T max = nums[0];
for (int i = 1; i < nums.Length; i++) {
max = max.CompareTo(nums[i]) > 0 ? max : nums[i];
}
return max;
}
public static T Min<T>(params T[] nums) where T : IComparable {
if (nums.Length == 0) return default(T);
T min = nums[0];
for (int i = 1; i < nums.Length; i++) {
min = min.CompareTo(nums[i]) < 0 ? min : nums[i];
}
return min;
}
/// <summary>
/// ソート済み配列 ary に同じ値の要素が含まれている?
/// ※ソート順は昇順/降順どちらでもよい
/// </summary>
public static bool HasDuplicateInSortedArray<T>(T[] ary) where T : IComparable, IComparable<T> {
if (ary.Length <= 1) return false;
var lastNum = ary[ary.Length - 1];
foreach (var n in ary) {
if (lastNum.CompareTo(n) == 0) {
return true;
} else {
lastNum = n;
}
}
return false;
}
/// <summary>
/// 二分探索
/// ※条件を満たす最小のidxを返す
/// ※満たすものがない場合は ary.Length を返す
/// ※『aryの先頭側が条件を満たさない、末尾側が条件を満たす』という前提
/// ただし、IsOK(...)の戻り値を逆転させれば、逆でも同じことが可能。
/// </summary>
/// <param name="ary">探索対象配列 ★ソート済みであること</param>
/// <param name="key">探索値 ※これ以上の値を持つ(IsOKがtrueを返す)最小のindexを返す</param>
public static int BinarySearch<T>(T[] ary, T key) where T : IComparable, IComparable<T> {
int left = -1;
int right = ary.Length;
while (1 < right - left) {
var mid = left + (right - left) / 2;
if (IsOK(ary, mid, key)) {
right = mid;
} else {
left = mid;
}
}
// left は条件を満たさない最大の値、right は条件を満たす最小の値になっている
return right;
}
public static bool IsOK<T>(T[] ary, int idx, T key) where T : IComparable, IComparable<T> {
// key <= ary[idx] と同じ意味
return key.CompareTo(ary[idx]) <= 0;
}
}
public class SolverBase
{
virtual protected string ReadLine() => Console.ReadLine();
virtual protected int ReadInt() => int.Parse(ReadLine());
//virtual protected void ReadInt2(out int x, out int y) {
// var aryS = ReadLine().Split(' ');
// x = int.Parse(aryS[0]);
// y = int.Parse(aryS[1]);
//}
virtual protected long ReadLong() => long.Parse(ReadLine());
virtual protected string[] ReadStringArray() => ReadLine().Split(' ');
virtual protected int[] ReadIntArray() => ReadLine().Split(' ').Select<string, int>(s => int.Parse(s)).ToArray();
virtual protected long[] ReadLongArray() => ReadLine().Split(' ').Select<string, long>(s => long.Parse(s)).ToArray();
virtual protected double[] ReadDoubleArray() => ReadLine().Split(' ').Select<string, double>(s => double.Parse(s)).ToArray();
virtual protected void WriteLine(string line) => Console.WriteLine(line);
virtual protected void WriteLine(double d) => Console.WriteLine($"{d:F9}");
virtual protected void WriteLine<T>(T value) where T : IFormattable => Console.WriteLine(value);
[Conditional("DEBUG")]
protected void Dump(string s) => Console.WriteLine(s);
[Conditional("DEBUG")]
protected void Dump(char c) => Console.WriteLine(c);
[Conditional("DEBUG")]
protected void Dump(double d) => Console.WriteLine($"{d:F9}");
[Conditional("DEBUG")]
protected void Dump<T>(IEnumerable<T> array) where T : IFormattable {
string s = Util.DumpToString(array);
// Consoleに出力すると、UnitTestの邪魔をしないというメリットあり。
Console.WriteLine(s);
//_writer.WriteLine(s);
}
[Conditional("DEBUG")]
protected void DumpGrid<T>(IEnumerable<IEnumerable<T>> arrayOfArray) where T : IFormattable {
var sb = new StringBuilder();
foreach (var a in arrayOfArray) {
sb.AppendLine(Util.DumpToString(a));
}
// Consoleに出力すると、UnitTestの邪魔をしないというメリットあり。
Console.WriteLine(sb.ToString());
//_writer.WriteLine(sb.ToString());
}
[Conditional("DEBUG")]
protected void DumpDP<T>(T[,] dp) where T : IFormattable {
var sb = new StringBuilder();
for (int i = 0; i < dp.GetLength(0); i++) {
for (int j = 0; j < dp.GetLength(1); j++) {
sb.Append(dp[i, j]);
sb.Append(", ");
}
sb.AppendLine();
}
Console.WriteLine(sb.ToString());
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 1,372
| 4
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
var inputs = ReadInts();
Console.WriteLine((inputs[1] * 2) - 1 >= inputs[0] ? "YES" : "NO");
}
public static string Read() { return Console.ReadLine(); }
public static int ReadInt() { return int.Parse(Read()); }
public static long ReadLong() { return long.Parse(Read()); }
public static double ReadDouble() { return double.Parse(Read()); }
public static string[] Reads() { return Console.ReadLine().Split(' '); }
public static int[] ReadInts() {
return Reads().Select(_ => int.Parse(_)).ToArray();
}
public static double[] ReadDoubles() {
return Reads().Select(_ => double.Parse(_)).ToArray();
}
}
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
var inputs = ReadInts();
Console.WriteLine((inputs[1] * 2 - 1) <= inputs[0] ? "YES" : "NO");
}
public static string Read() { return Console.ReadLine(); }
public static int ReadInt() { return int.Parse(Read()); }
public static long ReadLong() { return long.Parse(Read()); }
public static double ReadDouble() { return double.Parse(Read()); }
public static string[] Reads() { return Console.ReadLine().Split(' '); }
public static int[] ReadInts() {
return Reads().Select(_ => int.Parse(_)).ToArray();
}
public static double[] ReadDoubles() {
return Reads().Select(_ => double.Parse(_)).ToArray();
}
}
|
[["-", 0, 41, 15, 16, 31, 16, 31, 23, 0, 25], ["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 20], ["+", 0, 28, 0, 41, 15, 16, 31, 23, 0, 25], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19]]
| 8
| 214
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder {
class AtCodeeeeeeeeeeeeeeeeeeeeeeeer {
static void Main(string[] args) {
string[] s = Console.ReadLine().Split(' ');
int N = int.Parse(s[0]);
int K = int.Parse(s[1]);
Console.WriteLine((N / 2) + 1 >= K ? "YES" : "NO");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder {
class AtCodeeeeeeeeeeeeeeeeeeeeeeeer {
static void Main(string[] args) {
string[] s = Console.ReadLine().Split(' ');
double N = int.Parse(s[0]);
int K = int.Parse(s[1]);
Console.WriteLine(Math.Ceiling(N / 2) >= K ? "YES" : "NO");
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 41, 15, 16, 31, 213, 63, 214, 205, 22], ["+", 0, 41, 15, 16, 31, 213, 63, 214, 0, 131], ["+", 0, 41, 15, 16, 31, 213, 63, 214, 141, 22], ["-", 0, 28, 0, 41, 15, 16, 31, 16, 17, 72], ["-", 0, 28, 0, 41, 15, 16, 31, 16, 12, 203]]
| 8
| 113
| 7
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MINPRO2019A {
class Program {
static void Main(string[] args) {
var nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = nk[0];
int K = nk[1];
if (N > 2 * (K - 1))
Console.WriteLine("YES");
else
Console.WriteLine("No");
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MINPRO2019A {
class Program {
static void Main(string[] args) {
var nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
int N = nk[0];
int K = nk[1];
if (N > 2 * (K - 1))
Console.WriteLine("YES");
else
Console.WriteLine("NO");
Console.ReadKey();
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 123
| 2
|
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using System.Text;
namespace AtCoder {
public class Program {
static int[] getKeys() {
var Keys = Console.ReadLine().Split(' ');
int N = Keys.Length;
int[] Ns = new int[N];
for (int i = 0; i < N; i++) {
Ns[i] = int.Parse(Keys[i]);
}
return Ns;
}
static int[] getKeys(char delimiter) {
var Keys = Console.ReadLine().Split(delimiter);
int N = Keys.Length;
int[] Ns = new int[N];
for (int i = 0; i < N; i++) {
Ns[i] = int.Parse(Keys[i]);
}
return Ns;
}
public static void Show<T>(T[,] map) {
int H = map.GetLength(0);
int W = map.GetLength(1);
Console.WriteLine("-------------------------");
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
Console.Write(map[i, j] + " ");
}
Console.WriteLine();
}
Console.WriteLine("-------------------------");
}
public static void Show<T>(T[,] map, string delimiter) {
int H = map.GetLength(0);
int W = map.GetLength(1);
Console.WriteLine("-------------------------");
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
Console.Write(map[i, j] + delimiter);
}
Console.WriteLine();
}
Console.WriteLine("-------------------------");
}
public static void Show<T>(IEnumerable<T> ts) {
foreach (var item in ts) {
Console.Write(item + " ");
}
Console.WriteLine();
}
public static void Show<T>(IEnumerable<T> ts, string delimiter) {
foreach (var item in ts) {
Console.Write(item + delimiter);
}
Console.WriteLine();
}
static void Main() {
var Key = getKeys();
if (Key[0] / 2 + 1 >= Key[1]) {
Console.WriteLine("YES");
} else {
Console.WriteLine("NO");
}
}
}
}
|
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using System.Text;
namespace AtCoder {
public class Program {
static int[] getKeys() {
var Keys = Console.ReadLine().Split(' ');
int N = Keys.Length;
int[] Ns = new int[N];
for (int i = 0; i < N; i++) {
Ns[i] = int.Parse(Keys[i]);
}
return Ns;
}
static int[] getKeys(char delimiter) {
var Keys = Console.ReadLine().Split(delimiter);
int N = Keys.Length;
int[] Ns = new int[N];
for (int i = 0; i < N; i++) {
Ns[i] = int.Parse(Keys[i]);
}
return Ns;
}
public static void Show<T>(T[,] map) {
int H = map.GetLength(0);
int W = map.GetLength(1);
Console.WriteLine("-------------------------");
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
Console.Write(map[i, j] + " ");
}
Console.WriteLine();
}
Console.WriteLine("-------------------------");
}
public static void Show<T>(T[,] map, string delimiter) {
int H = map.GetLength(0);
int W = map.GetLength(1);
Console.WriteLine("-------------------------");
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
Console.Write(map[i, j] + delimiter);
}
Console.WriteLine();
}
Console.WriteLine("-------------------------");
}
public static void Show<T>(IEnumerable<T> ts) {
foreach (var item in ts) {
Console.Write(item + " ");
}
Console.WriteLine();
}
public static void Show<T>(IEnumerable<T> ts, string delimiter) {
foreach (var item in ts) {
Console.Write(item + delimiter);
}
Console.WriteLine();
}
static void Main() {
var Key = getKeys();
if (Key[0] / 2 + Key[0] % 2 >= Key[1]) {
Console.WriteLine("YES");
} else {
Console.WriteLine("NO");
}
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["+", 15, 16, 31, 16, 12, 16, 31, 204, 205, 22], ["+", 31, 16, 12, 16, 31, 204, 206, 207, 0, 70], ["+", 12, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 31, 16, 12, 16, 31, 204, 206, 207, 0, 73], ["+", 0, 57, 15, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 57, 15, 16, 31, 16, 12, 16, 12, 203]]
| 8
| 543
| 7
|
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using Cons = System.Console;
class PriorityQueue<T> {
private readonly List<T> m_list;
private readonly Func<T, T, int> m_compare;
private int m_count;
public PriorityQueue(int capacity, Func<T, T, int> compare) {
m_list = new List<T>(capacity);
m_compare = compare;
m_count = 0;
}
private int Add(T value) {
if (m_count == m_list.Count) {
m_list.Add(value);
} else {
m_list[m_count] = value;
}
return m_count++;
}
private void Swap(int a, int b) {
T tmp = m_list[a];
m_list[a] = m_list[b];
m_list[b] = tmp;
}
public void Enqueue(T value) {
int c = Add(value);
while (c > 0) {
int p = (c - 1) / 2;
if (m_compare(m_list[c], m_list[p]) < 0) {
Swap(p, c);
} else {
break;
}
c = p;
}
}
public T Dequeue() {
T value = m_list[0];
m_list[0] = m_list[--m_count];
int p = 0;
while (true) {
int c1 = p * 2 + 1;
int c2 = p * 2 + 2;
if (c1 >= m_count) {
break;
}
int c =
(c2 >= m_count || m_compare(m_list[c1], m_list[c2]) < 0) ? c1 : c2;
if (m_compare(m_list[c], m_list[p]) < 0) {
Swap(p, c);
} else {
break;
}
p = c;
}
return value;
}
}
class Program {
static int Main(string[] args) {
var sw = new StreamWriter(Cons.OpenStandardOutput()) { AutoFlush = false };
Cons.SetOut(sw);
int ret = Solve();
Cons.Out.Flush();
return ret;
}
static int Solve() {
int[] L = new int[4];
for (int i = 0; i < 3; i++) {
List<int> list =
Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToList();
L[list[0] - 1]++;
L[list[1] - 1]++;
}
if (L.Max() == 3)
Cons.WriteLine("No");
else
Cons.WriteLine("Yes");
return 0;
}
}
|
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using Cons = System.Console;
class PriorityQueue<T> {
private readonly List<T> m_list;
private readonly Func<T, T, int> m_compare;
private int m_count;
public PriorityQueue(int capacity, Func<T, T, int> compare) {
m_list = new List<T>(capacity);
m_compare = compare;
m_count = 0;
}
private int Add(T value) {
if (m_count == m_list.Count) {
m_list.Add(value);
} else {
m_list[m_count] = value;
}
return m_count++;
}
private void Swap(int a, int b) {
T tmp = m_list[a];
m_list[a] = m_list[b];
m_list[b] = tmp;
}
public void Enqueue(T value) {
int c = Add(value);
while (c > 0) {
int p = (c - 1) / 2;
if (m_compare(m_list[c], m_list[p]) < 0) {
Swap(p, c);
} else {
break;
}
c = p;
}
}
public T Dequeue() {
T value = m_list[0];
m_list[0] = m_list[--m_count];
int p = 0;
while (true) {
int c1 = p * 2 + 1;
int c2 = p * 2 + 2;
if (c1 >= m_count) {
break;
}
int c =
(c2 >= m_count || m_compare(m_list[c1], m_list[c2]) < 0) ? c1 : c2;
if (m_compare(m_list[c], m_list[p]) < 0) {
Swap(p, c);
} else {
break;
}
p = c;
}
return value;
}
}
class Program {
static int Main(string[] args) {
var sw = new StreamWriter(Cons.OpenStandardOutput()) { AutoFlush = false };
Cons.SetOut(sw);
int ret = Solve();
Cons.Out.Flush();
return ret;
}
static int Solve() {
int[] L = new int[4];
for (int i = 0; i < 3; i++) {
List<int> list =
Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToList();
L[list[0] - 1]++;
L[list[1] - 1]++;
}
if (L.Max() == 3)
Cons.WriteLine("NO");
else
Cons.WriteLine("YES");
return 0;
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 555
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder_procpn_B {
class Program {
static void Main(string[] args) {
int[] t_input = new int[2];
int[] a = new int[3];
int[] b = new int[3];
string result = "YES";
int[] cnt = new int[4];
for (int j = 0; j < 3; j++) {
t_input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
a[j] = t_input[0];
b[j] = t_input[1];
}
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 4; j++) {
if (a[i] == j)
cnt[j]++;
if (b[i] == j)
cnt[j]++;
}
}
for (int i = 0; i <= 3; i++) {
if (cnt[i] > 2 || cnt[i] == 0)
result = "NO";
}
Console.WriteLine(result);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Atcoder_procpn_B {
class Program {
static void Main(string[] args) {
int[] t_input = new int[2];
int[] a = new int[3];
int[] b = new int[3];
string result = "YES";
int[] cnt = new int[4];
for (int j = 0; j < 3; j++) {
t_input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
a[j] = t_input[0];
b[j] = t_input[1];
}
for (int i = 0; i < 3; i++) {
for (int j = 1; j <= 4; j++) {
if (a[i] == j)
cnt[j - 1]++;
if (b[i] == j)
cnt[j - 1]++;
}
}
for (int i = 0; i <= 3; i++) {
if (cnt[i] > 2 || cnt[i] == 0)
result = "NO";
}
Console.WriteLine(result);
}
}
}
|
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 19], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 268
| 8
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace Algorithm {
class Program {
static void Main(string[] args) {
var l = Console.ReadLine().Split().Select(long.Parse).ToArray();
long K = l[0], A = l[1], B = l[2];
if (B - A <= 2) {
Console.WriteLine(K + 1);
} else {
K -= A;
var ans = A + (B - A) * (K / 2) + K % 2;
Console.WriteLine(ans);
}
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace Algorithm {
class Program {
static void Main(string[] args) {
var l = Console.ReadLine().Split().Select(long.Parse).ToArray();
long K = l[0], A = l[1], B = l[2];
if (B - A <= 2) {
Console.WriteLine(K + 1);
} else {
K -= (A - 1);
var ans = A + (B - A) * (K / 2) + K % 2;
Console.WriteLine(ans);
}
}
}
}
|
[["+", 75, 196, 0, 1, 0, 11, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 12, 203], ["+", 75, 196, 0, 1, 0, 11, 12, 23, 0, 25]]
| 8
| 134
| 4
|
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
namespace AtCoder {
class Program {
static void Main(string[] args) {
new Program().Solve(new ConsoleInput(Console.In, ' '));
#if DEBUG
ReadLine();
#endif
}
void Solve(ConsoleInput cin) {
long k = cin.ReadLong;
long a = cin.ReadLong;
long b = cin.ReadLong;
// 変換効率がダメ
if (b / (double)a < 2) {
Console.WriteLine(1 + k);
return;
}
// k-2回でa枚未満
if (1 + (k - 2) < a) {
Console.WriteLine(1 + k);
return;
}
long ans = 0;
ans += a;
k -= a - 1;
if (k % 2 == 1) {
ans += 1;
k -= 1;
}
ans += (b - a) * (k / 2);
Console.WriteLine(ans);
}
class ConsoleInput {
private readonly System.IO.TextReader _stream;
private char _separator = ' ';
private Queue<string> inputStream;
public ConsoleInput(System.IO.TextReader stream, char separator = ' ') {
this._separator = separator;
this._stream = stream;
inputStream = new Queue<string>();
}
public string Read {
get {
if (inputStream.Count != 0)
return inputStream.Dequeue();
string[] tmp = _stream.ReadLine().Split(_separator);
for (int i = 0; i < tmp.Length; ++i)
inputStream.Enqueue(tmp[i]);
return inputStream.Dequeue();
}
}
public string ReadLine {
get { return _stream.ReadLine(); }
}
public int ReadInt {
get { return int.Parse(Read); }
}
public long ReadLong {
get { return long.Parse(Read); }
}
public double ReadDouble {
get { return double.Parse(Read); }
}
public string[] ReadStrArray(long N) {
var ret = new string[N];
for (long i = 0; i < N; ++i)
ret[i] = Read;
return ret;
}
public int[] ReadIntArray(long N) {
var ret = new int[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadInt;
return ret;
}
public long[] ReadLongArray(long N) {
var ret = new long[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadLong;
return ret;
}
}
}
}
|
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
namespace AtCoder {
class Program {
static void Main(string[] args) {
new Program().Solve(new ConsoleInput(Console.In, ' '));
#if DEBUG
ReadLine();
#endif
}
void Solve(ConsoleInput cin) {
long k = cin.ReadLong;
long a = cin.ReadLong;
long b = cin.ReadLong;
// 変換効率がダメ
if (b - a <= 2) {
Console.WriteLine(1 + k);
return;
}
// k-2回でa枚未満
if (1 + (k - 2) < a) {
Console.WriteLine(1 + k);
return;
}
long ans = 0;
ans += a;
k -= a - 1;
if (k % 2 == 1) {
ans += 1;
k -= 1;
}
ans += (b - a) * (k / 2);
Console.WriteLine(ans);
}
class ConsoleInput {
private readonly System.IO.TextReader _stream;
private char _separator = ' ';
private Queue<string> inputStream;
public ConsoleInput(System.IO.TextReader stream, char separator = ' ') {
this._separator = separator;
this._stream = stream;
inputStream = new Queue<string>();
}
public string Read {
get {
if (inputStream.Count != 0)
return inputStream.Dequeue();
string[] tmp = _stream.ReadLine().Split(_separator);
for (int i = 0; i < tmp.Length; ++i)
inputStream.Enqueue(tmp[i]);
return inputStream.Dequeue();
}
}
public string ReadLine {
get { return _stream.ReadLine(); }
}
public int ReadInt {
get { return int.Parse(Read); }
}
public long ReadLong {
get { return long.Parse(Read); }
}
public double ReadDouble {
get { return double.Parse(Read); }
}
public string[] ReadStrArray(long N) {
var ret = new string[N];
for (long i = 0; i < N; ++i)
ret[i] = Read;
return ret;
}
public int[] ReadIntArray(long N) {
var ret = new int[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadInt;
return ret;
}
public long[] ReadLongArray(long N) {
var ret = new long[N];
for (long i = 0; i < N; ++i)
ret[i] = ReadLong;
return ret;
}
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 85], ["-", 0, 57, 15, 16, 31, 16, 12, 74, 0, 24], ["-", 0, 57, 15, 16, 31, 16, 12, 74, 39, 199], ["-", 0, 57, 15, 16, 31, 16, 12, 74, 0, 25], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 33], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
| 8
| 555
| 7
|
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
namespace AtCoder.Contest.A {
static class Program {
public static void Solve(Scanner cin) {
double t = cin.ReadDouble();
double x = cin.ReadDouble();
Console.WriteLine(x / t);
}
public static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
var cin = new Scanner();
Solve(cin);
Console.Out.Flush();
}
}
class Scanner {
string[] s;
int i;
char[] separator = new char[] { ' ' };
public Scanner() {
s = new string[0];
i = 0;
}
public string Read() => ReadString();
public string ReadString() {
if (i < s.Length)
return s[i++];
string st = Console.ReadLine();
while (st == "")
st = Console.ReadLine();
s = st.Split(separator, StringSplitOptions.RemoveEmptyEntries);
if (s.Length == 0)
return ReadString();
i = 0;
return s[i++];
}
public string[] ReadStringArray(int N) {
string[] Array = new string[N];
for (int i = 0; i < N; i++) {
Array[i] = ReadString();
}
return Array;
}
public int ReadInt() { return int.Parse(ReadString()); }
public int[] ReadIntArray(int N, int add = 0) {
int[] Array = new int[N];
for (int i = 0; i < N; i++) {
Array[i] = ReadInt() + add;
}
return Array;
}
public long ReadLong() { return long.Parse(ReadString()); }
public long[] ReadLongArray(int N, long add = 0) {
long[] Array = new long[N];
for (int i = 0; i < N; i++) {
Array[i] = ReadLong() + add;
}
return Array;
}
public double ReadDouble() { return double.Parse(ReadString()); }
public double[] ReadDoubleArray(int N, double add = 0) {
double[] Array = new double[N];
for (int i = 0; i < N; i++) {
Array[i] = ReadDouble() + add;
}
return Array;
}
public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(),
typeof(T1));
public (T1, T2) ReadValue<T1, T2>() {
var inputs = ReadStringArray(2);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
return (v1, v2);
}
public (T1, T2, T3) ReadValue<T1, T2, T3>() {
var inputs = ReadStringArray(3);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
return (v1, v2, v3);
}
public (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>() {
var inputs = ReadStringArray(4);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
return (v1, v2, v3, v4);
}
public (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>() {
var inputs = ReadStringArray(5);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
return (v1, v2, v3, v4, v5);
}
public (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>() {
var inputs = ReadStringArray(6);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));
return (v1, v2, v3, v4, v5, v6);
}
public (T1, T2, T3, T4, T5, T6,
T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>() {
var inputs = ReadStringArray(7);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));
var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));
return (v1, v2, v3, v4, v5, v6, v7);
}
public T1[] ReadValueArray<T1>(int N) {
var v1 = new T1[N];
for (int i = 0; i < N; i++) {
v1[i] = ReadValue<T1>();
}
return v1;
}
public (T1[], T2[]) ReadValueArray<T1, T2>(int N) {
var (v1, v2) = (new T1[N], new T2[N]);
for (int i = 0; i < N; i++) {
var (t1, t2) = ReadValue<T1, T2>();
v1[i] = t1;
v2[i] = t2;
}
return (v1, v2);
}
public (T1[], T2[], T3[]) ReadValueArray<T1, T2, T3>(int N) {
var (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]);
for (int i = 0; i < N; i++) {
var (t1, t2, t3) = ReadValue<T1, T2, T3>();
v1[i] = t1;
v2[i] = t2;
v3[i] = t3;
}
return (v1, v2, v3);
}
public (T1[], T2[], T3[], T4[]) ReadValueArray<T1, T2, T3, T4>(int N) {
var (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]);
for (int i = 0; i < N; i++) {
var (t1, t2, t3, t4) = ReadValue<T1, T2, T3, T4>();
v1[i] = t1;
v2[i] = t2;
v3[i] = t3;
v4[i] = t4;
}
return (v1, v2, v3, v4);
}
public (T1[], T2[], T3[], T4[],
T5[]) ReadValueArray<T1, T2, T3, T4, T5>(int N) {
var (v1, v2, v3, v4, v5) =
(new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]);
for (int i = 0; i < N; i++) {
var (t1, t2, t3, t4, t5) = ReadValue<T1, T2, T3, T4, T5>();
v1[i] = t1;
v2[i] = t2;
v3[i] = t3;
v4[i] = t4;
v5[i] = t5;
}
return (v1, v2, v3, v4, v5);
}
public (T1[], T2[], T3[], T4[], T5[],
T6[]) ReadValueArray<T1, T2, T3, T4, T5, T6>(int N) {
var (v1, v2, v3, v4, v5, v6) =
(new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]);
for (int i = 0; i < N; i++) {
var (t1, t2, t3, t4, t5, t6) = ReadValue<T1, T2, T3, T4, T5, T6>();
v1[i] = t1;
v2[i] = t2;
v3[i] = t3;
v4[i] = t4;
v5[i] = t5;
v6[i] = t6;
}
return (v1, v2, v3, v4, v5, v6);
}
public (T1[], T2[], T3[], T4[], T5[], T6[],
T7[]) ReadValueArray<T1, T2, T3, T4, T5, T6, T7>(int N) {
var (v1, v2, v3, v4, v5, v6, v7) =
(new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N],
new T7[N]);
for (int i = 0; i < N; i++) {
var (t1, t2, t3, t4, t5, t6, t7) =
ReadValue<T1, T2, T3, T4, T5, T6, T7>();
v1[i] = t1;
v2[i] = t2;
v3[i] = t3;
v4[i] = t4;
v5[i] = t5;
v6[i] = t6;
v7[i] = t7;
}
return (v1, v2, v3, v4, v5, v6, v7);
}
}
}
|
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
namespace AtCoder.Contest.A {
static class Program {
public static void Solve(Scanner cin) {
double t = cin.ReadDouble();
double x = cin.ReadDouble();
Console.WriteLine(t / x);
}
public static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
var cin = new Scanner();
Solve(cin);
Console.Out.Flush();
}
}
class Scanner {
string[] s;
int i;
char[] separator = new char[] { ' ' };
public Scanner() {
s = new string[0];
i = 0;
}
public string Read() => ReadString();
public string ReadString() {
if (i < s.Length)
return s[i++];
string st = Console.ReadLine();
while (st == "")
st = Console.ReadLine();
s = st.Split(separator, StringSplitOptions.RemoveEmptyEntries);
if (s.Length == 0)
return ReadString();
i = 0;
return s[i++];
}
public string[] ReadStringArray(int N) {
string[] Array = new string[N];
for (int i = 0; i < N; i++) {
Array[i] = ReadString();
}
return Array;
}
public int ReadInt() { return int.Parse(ReadString()); }
public int[] ReadIntArray(int N, int add = 0) {
int[] Array = new int[N];
for (int i = 0; i < N; i++) {
Array[i] = ReadInt() + add;
}
return Array;
}
public long ReadLong() { return long.Parse(ReadString()); }
public long[] ReadLongArray(int N, long add = 0) {
long[] Array = new long[N];
for (int i = 0; i < N; i++) {
Array[i] = ReadLong() + add;
}
return Array;
}
public double ReadDouble() { return double.Parse(ReadString()); }
public double[] ReadDoubleArray(int N, double add = 0) {
double[] Array = new double[N];
for (int i = 0; i < N; i++) {
Array[i] = ReadDouble() + add;
}
return Array;
}
public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(),
typeof(T1));
public (T1, T2) ReadValue<T1, T2>() {
var inputs = ReadStringArray(2);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
return (v1, v2);
}
public (T1, T2, T3) ReadValue<T1, T2, T3>() {
var inputs = ReadStringArray(3);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
return (v1, v2, v3);
}
public (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>() {
var inputs = ReadStringArray(4);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
return (v1, v2, v3, v4);
}
public (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>() {
var inputs = ReadStringArray(5);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
return (v1, v2, v3, v4, v5);
}
public (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>() {
var inputs = ReadStringArray(6);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));
return (v1, v2, v3, v4, v5, v6);
}
public (T1, T2, T3, T4, T5, T6,
T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>() {
var inputs = ReadStringArray(7);
var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));
var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));
return (v1, v2, v3, v4, v5, v6, v7);
}
public T1[] ReadValueArray<T1>(int N) {
var v1 = new T1[N];
for (int i = 0; i < N; i++) {
v1[i] = ReadValue<T1>();
}
return v1;
}
public (T1[], T2[]) ReadValueArray<T1, T2>(int N) {
var (v1, v2) = (new T1[N], new T2[N]);
for (int i = 0; i < N; i++) {
var (t1, t2) = ReadValue<T1, T2>();
v1[i] = t1;
v2[i] = t2;
}
return (v1, v2);
}
public (T1[], T2[], T3[]) ReadValueArray<T1, T2, T3>(int N) {
var (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]);
for (int i = 0; i < N; i++) {
var (t1, t2, t3) = ReadValue<T1, T2, T3>();
v1[i] = t1;
v2[i] = t2;
v3[i] = t3;
}
return (v1, v2, v3);
}
public (T1[], T2[], T3[], T4[]) ReadValueArray<T1, T2, T3, T4>(int N) {
var (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]);
for (int i = 0; i < N; i++) {
var (t1, t2, t3, t4) = ReadValue<T1, T2, T3, T4>();
v1[i] = t1;
v2[i] = t2;
v3[i] = t3;
v4[i] = t4;
}
return (v1, v2, v3, v4);
}
public (T1[], T2[], T3[], T4[],
T5[]) ReadValueArray<T1, T2, T3, T4, T5>(int N) {
var (v1, v2, v3, v4, v5) =
(new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]);
for (int i = 0; i < N; i++) {
var (t1, t2, t3, t4, t5) = ReadValue<T1, T2, T3, T4, T5>();
v1[i] = t1;
v2[i] = t2;
v3[i] = t3;
v4[i] = t4;
v5[i] = t5;
}
return (v1, v2, v3, v4, v5);
}
public (T1[], T2[], T3[], T4[], T5[],
T6[]) ReadValueArray<T1, T2, T3, T4, T5, T6>(int N) {
var (v1, v2, v3, v4, v5, v6) =
(new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]);
for (int i = 0; i < N; i++) {
var (t1, t2, t3, t4, t5, t6) = ReadValue<T1, T2, T3, T4, T5, T6>();
v1[i] = t1;
v2[i] = t2;
v3[i] = t3;
v4[i] = t4;
v5[i] = t5;
v6[i] = t6;
}
return (v1, v2, v3, v4, v5, v6);
}
public (T1[], T2[], T3[], T4[], T5[], T6[],
T7[]) ReadValueArray<T1, T2, T3, T4, T5, T6, T7>(int N) {
var (v1, v2, v3, v4, v5, v6, v7) =
(new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N],
new T7[N]);
for (int i = 0; i < N; i++) {
var (t1, t2, t3, t4, t5, t6, t7) =
ReadValue<T1, T2, T3, T4, T5, T6, T7>();
v1[i] = t1;
v2[i] = t2;
v3[i] = t3;
v4[i] = t4;
v5[i] = t5;
v6[i] = t6;
v7[i] = t7;
}
return (v1, v2, v3, v4, v5, v6, v7);
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 85], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 85], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
| 8
| 2,442
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC117A {
class Program {
static void Main(string[] args) {
int a, b;
string[] ss = Console.ReadLine().Split(' ');
a = int.Parse(ss[0]);
b = int.Parse(ss[1]);
Console.WriteLine(a / b);
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC117A {
class Program {
static void Main(string[] args) {
double a, b;
string[] ss = Console.ReadLine().Split(' ');
a = double.Parse(ss[0]);
b = double.Parse(ss[1]);
Console.WriteLine(a / b);
Console.ReadKey();
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199]]
| 8
| 108
| 6
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.