code stringlengths 4 1.01M | language stringclasses 2
values |
|---|---|
import std.algorithm, std.conv, std.range, std.stdio, std.string;
void main()
{
auto rd = readln.split.to!(int[]), a = rd[0], b = rd[1];
auto pa = a == 1 ? 14 : a, pb = b == 1 ? 14 : b;
if (pa == pb) writeln("Draw");
else if (pa > pb) writeln("Alice");
else writeln("Bob");
}
| D |
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", ... | D |
import std.stdio;
import std.string;
import std.conv;
import std.algorithm: canFind;
void main() {
string[] inputs = split(readln());
int A = to!int(inputs[0]);
int B = to!int(inputs[1]);
((A + B) % 24).writeln;
}
| D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
enum P = 1000000007;
void main()
{
auto N = readln.chomp.to!int;
int a, b, c;
long r = 1;
foreach (x; readln.split.to!(int[])) {
if (x == a && a == b && a == c) {
r = (r * 3) % P;... | D |
import std.stdio, std.conv, std.array;
import std.math;
void main(){
double r = readln.split[0].to!double;
r = 2 * PI * r;
printf("%lf\n",r);
} | D |
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;
void main() {
auto t = readln.split.to!(long[]);
if (t == [1,1]) {
writeln(1);
return;
}
if (t[0] == 1) {
writeln(t[1]-2);
return;
}
if (t[1] == 1) {
writ... | D |
import std.stdio, std.string, std.conv;
void main() {
auto input = getStdin!(string[])[0].split(" ");
int w = input[0].to!(int);
int h = input[1].to!(int);
int x = input[2].to!(int);
int y = input[3].to!(int);
int r = input[4].to!(int);
if (x - r < 0 || x + r > w || y - r < 0 || y + r > h) {
"No".writeln;
... | D |
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.math;
void main() {
int n, m, x;
scan(n, m, x);
auto a = readln.split.to!(int[]);
int l, r;
foreach (ai ; a) {
if (ai < x) l++;
else r++;
}
writeln(min(l, r));
}
void scan(T...)(ref T ... | D |
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;
int n,s;
int saiki(int n1,int u,int m){
if(n1 > s) return 0;
else if(m==1){
int d = s-n1;
if(d <= 9 && (u & (1<<d))==0... | D |
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DE... | D |
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
T lread(T = long)()
{
return readln.chomp.to!T();
}
T[] aryread(T = long)()
{
ret... | D |
import std.stdio, std.string, std.algorithm, std.conv, std.array;
void main(){
auto nx=readln.split.map!(to!long).array;
auto n=nx[0], x=nx[1];
auto as=readln.split.map!(to!long).array;
auto c=0L;
long result=0;
foreach(a; as){
if(a+c>x){
result+=a+c-x;
c=-c+x;
}else{
c=a;
}
... | D |
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;
immutable long MOD = 10^^9 + 7;
void main() {
auto s = readln.split.map!(to!int);
auto N = s[0];
auto M = s[1... | D |
import std.stdio;
import std.datetime;
import std.conv;
void main()
{
auto s = TimeOfDay.fromISOExtString(readln[0 .. $-1] ~ ":00");
auto t = readln;
auto d = dur!"hours"((t[0..2]).to!long)
+ dur!"minutes"(t[3..5].to!long);
writeln((s - d).toISOExtString[0..5]);
} | D |
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
T lread(T = long)()
{
return readln.chomp.to!T();
}
T[] aryread(T = long)()
{
ret... | D |
import std.stdio, std.conv, std.string, std.algorithm, std.math, std.array, std.container;
bool check(bool[3][3] t) {
for(int i=0; i<3; i++) {
if(t[i][0]&&t[i][1]&&t[i][2]) {
return true;
}
if(t[0][i]&&t[1][i]&&t[2][i]) {
return true;
}
}
return t[0][0]&&t[1][1]&&t[2][2] || t[0][2]&&t... | D |
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;
string FMT_F = "%.10f";
static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(... | D |
// unihernandez22
// https://atcoder.jp/contests/abc076/tasks/abc076_c
// string manipulation
import std.stdio;
import std.string;
void main() {
string s = readln.chomp;
string t = readln.chomp;
ulong idx = -1;
bool matched;
for(long i = (s.count-t.count); i >= 0; i--) {
if (s[i] == '?' || s[i] == t[0]) {
ma... | D |
// import chie template :) {{{
import std.stdio, std.algorithm, std.array, std.string, std.math, std.conv,
std.range, std.container, std.bigint, std.ascii, std.typecons;
// }}}
// nep.scanner {{{
class Scanner
{
import std.stdio : File, stdin;
import std.conv : to;
import std.array : split;
import ... | D |
import std.stdio;
import std.ascii;
import std.conv;
import std.string;
import std.array;
void main() {
int sum = 0;
while(true) {
string line = readln.chomp;
bool prev_digit = false;
string number = "";
if (stdin.eof) break;
foreach(x; line) {
if (isDigit(x)) {
number ~= x;
... | D |
import std.algorithm, std.conv, std.range, std.stdio, std.string;
void main()
{
auto a = readln.split.to!(int[]);
writeln(a.count(5) == 2 && a.count(7) == 1 ? "YES" : "NO");
}
| D |
import std.stdio, std.string, std.array, std.conv, std.algorithm;
void main() {
int n = readln.chomp.to!int;
int[] a = readln.chomp.split.to!(int[]);
a = a.uniq.array;
foreach (i, x; a) {
x.write;
if (i != a.length - 1) " ".write;
else writeln;
}
}
| D |
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;
void main() {
auto N = readln.chomp.to!int;
auto A = readln.chomp;
auto B = readln.chomp;
bool[] tate;
for (int i = 0; ... | D |
import std.stdio, std.algorithm, std.range, std.array, std.conv, std.string, std.math, std.container, std.typecons;
void main() {
writeln((readln.chomp.to!int - readln.chomp.to!int) % readln.chomp.to!int);
}
| D |
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
import std.range;
void main(){
auto N=readln.chomp.to!int;
auto K=readln.chomp.to!int;
auto X=readln.chomp.to!int;
auto Y=readln.chomp.to!int;
if(N<=K)writeln(X*N);
else writeln(X*K+Y*(N-K));
} | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto N = readln.chomp.to!int;
auto ss = readln.split.to!(long[]);
long r;
foreach (x; 1..N-1) {
long rr;
int i, j = N-1;
while (i < N-1 && j > 0) {
i... | D |
import std.functional,
std.algorithm,
std.container,
std.typetuple,
std.typecons,
std.bigint,
std.string,
std.traits,
std.array,
std.range,
std.stdio,
std.conv,
std.format,
std.math;
void main()
{
auto n = readln.chomp.to!int;
... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto S = readln.chomp.to!(dchar[]);
auto T = readln.chomp.to!(dchar[]);
foreach (i; 0..S.length) {
S = S[1..$] ~ S[0];
if (S == T) {
writeln("Yes");
r... | D |
import std.stdio, std.string;
void main() {
string n = readln.chomp;
string s = "0";
int cnt;
while (s != n) {
s = succ(s);
if (s.length % 2) ++cnt;
}
cnt.writeln;
} | D |
void main()
{
long n = readln.chomp.to!long;
long[] a = readln.split.to!(long[]);
long x, y;
long r;
long result;
foreach (l; 0 .. n)
{
while (r < n && (x ^ a[r]) == (y + a[r]))
{
x ^= a[r];
y += a[r];
++r;
}
result += r -... | D |
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;
void main() {
int n;
long x;
scan(n, x);
auto a = new long[](n + 1); // 長さ
auto b = new long[](n + 1); // Pの枚数
a[0] = b[0] = 1;
fore... | D |
/+ dub.sdl:
name "A"
dependency "dcomp" version=">=0.6.0"
+/
import std.stdio, std.algorithm, std.range, std.conv;
import std.typecons;
import std.bigint;
// import dcomp.foundation, dcomp.scanner;
// import dcomp.container.deque;
int main() {
auto sc = new Scanner(stdin);
int n, m, k;
sc.read(n... | D |
/+ dub.sdl:
name "D"
dependency "dcomp" version=">=0.8.0"
+/
import std.stdio, std.algorithm, std.range, std.conv;
// import dcomp.foundation, dcomp.scanner;
// import dcomp.algorithm;
int main() {
Scanner sc = new Scanner(stdin);
int n;
sc.read(n);
int[] a;
sc.read(a);
auto di = a.enu... | D |
import std.stdio;
void main()
{
foreach (former; 1 .. 10)
{
foreach (latter; 1 .. 10)
{
writeln(former,"x",latter,"=",former*latter);
}
}
} | D |
import std.stdio,std.string,std.conv;
int main()
{
string s;
while((s = readln.chomp).length != 0)
{
bool flag = true;
for(int i=0;i<7;i += 3)
{
if(s[i] != 's' && s[i] == s[i+1] && s[i+1] == s[i+2])
{
s[i].writeln;
flag = false;
break;
}
}
if(flag)
{
foreach(i;0..3)
{
i... | D |
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
auto readInts() {
return array(map!(to!int)(readln().strip().split... | D |
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;
enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;
void main() {
int N;
scan(N);
auto B = readln.split.to!(l... | D |
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;
string FMT_F = "%.10f";
static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_r... | D |
void main(){
import std.stdio, std.string, std.conv, std.algorithm;
int n; rd(n);
auto a=new long[](100);
a[0]=2; a[1]=1;
for(int i=2; i<=n; i++){
a[i]=a[i-1]+a[i-2];
}
writeln(a[n]);
}
void rd(T...)(ref T x){
import std.stdio, std.string, std.conv;
auto l=readln.split;
assert(l.length==x.le... | D |
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;
enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;
void main() {
int n;
scan(n);
auto a = iota(n).map!(i =>... | D |
import std.stdio;
import std.conv;
import std.string;
import std.math;
import std.algorithm;
import std.range;
void main() {
long n = readln.chomp.to!long;
long[] answer;
for (long i = 2; i <= sqrt(cast(float)n); i++) {
if (n % i == 0) {
answer ~= i;
}
while (n % i == 0... | D |
import std.stdio;
import std.uni;
import std.conv;
import std.container;
import std.functional;
import std.algorithm;
import std.array;
import std.typecons;
import std.range;
import std.numeric;
void main(string[] args)
{
inputFile = stdin;
debug inputFile = File(args[1]);
auto t = next!int;
foreach(tc; 0 .. t... | D |
//prewritten code: https://github.com/antma/algo
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.traits;
class InputReader {
private:
ubyte[] p;
ubyte[] buffer;
size_t cur;
public:
this () {
buffer = uninitializ... | D |
import std.stdio, std.conv, std.string;
import std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
int DEBUG_LEVEL = 0;
void pr... | D |
//prewritten code: https://github.com/antma/algo
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.traits;
class InputReader {
private:
ubyte[] p;
ubyte[] buffer;
size_t cur;
public:
this () {
buffer = uninitializ... | D |
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;
void main() {
auto T = readln.chomp.to!int;
while (T--) {
auto N = readln.chomp.to!int;
if (N % 2)... | D |
import std.math;
import std.stdio;
import std.uni;
import std.conv;
import std.container;
import std.functional;
import std.algorithm;
import std.array;
import std.typecons;
long pmod(long a, long m)
{
return (a%m +m)%m;
}
void main(string[] args)
{
inputFile = stdin;
debug inputFile = File(args[1]);
auto t ... | D |
import core.bitop;
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
bool solve (string s, string [] t)
{
if (t.canFind (s))
{
r... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto nd = readln.split.to!(long[]);
auto N = nd[0];
auto A = nd[1];
auto B = nd[2];
auto C = nd[3];
auto D = nd[4];
foreach (m; 0..N-1) {
if (C * (N-1-m) - D*m <= B... | D |
import std.stdio, std.conv, std.string, std.algorithm, std.math, std.functional;
void main() {
writeln(readln.replace(" ", "").chomp.to!uint.pipe!(x => (cast(uint)sqrt(cast(real)x)) ^^ 2 == x) ? "Yes" : "No");
}
| D |
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip, std.regex;
void main() {
immutable int INF = 1 << 29;
auto N = readln.chomp.to!int + 2;
auto S = '0' ~ readln.ch... | D |
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;
string FMT_F = "%.10f";
static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_r... | D |
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;
void main() {
int n;
int[] a, b;
scan(n);
a = readln.split.to!(int[]);
b = readln.split.to!(int[]);
long s;
foreach (i ; 0 .. n) {
if (a[i] <= b[i]) {
s += (b[i] - a[i]) / 2;
}
... | D |
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;
string FMT_F = "%.10f";
static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_r... | D |
import std.stdio,std.string,std.conv;
void main()
{
auto N = readln.strip.to!int;
(N>=1000?"ABD":"ABC").writeln;
} | D |
import std.stdio,std.string;
int main(){
auto input=readln.chomp;
char[] s=input.dup;
foreach(ss;s[1..3]){
if(ss!=s[0]){
writeln("Yes");
return 0;
}
}
"No".writeln;
return 0;
}
| D |
import std.stdio;
import std.algorithm;
import std.string;
import std.array;
import std.conv;
import std.math;
char[12][12] map;
int[] dx = [1,0,-1,0];
int[] dy = [0,1,0,-1];
void saiki(int x, int y){
if(map[y][x] == '1'){
map[y][x] = '0';
for(int i=0;i<4;i++){
if(x+dx[i]>=12||y+dy[i]>=12||x+dx[i]<0||y+dy[... | D |
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.conv;
void main() {
string[char] d;
d['a'] = rs;
d['b'] = rs;
d['c'] = rs;
import std.uni;
solve(d).toUpper.writeln;
}
char solve(string[char] d) {
if(d['a'].length == 1)... | D |
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;
string FMT_F = "%.10f";
static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_r... | D |
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;
import core.bitop;
string my_readln() { return chomp(readln()); }
long mod = pow(10, 9) + 7;
long moda(long x, long y) { return (x + y) % mod; }
long mods(long x, long y) { return ((x + mod) - (y % mo... | D |
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
void main()
{
auto h = readln.chomp.to!long;
long c = 1;
long num;
while (h != 0) {
num +... | D |
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;
void main() {
const tmp = readln.split.to!(long[]);
const A = tmp[0], B = tmp[1], C = tmp[2];
writeln(min(C, B/A));
}
| D |
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;
void main() {
string s;
scan(s);
int x, y;
scan(x, y);
auto xys = new int[][](2, 0);
auto tk = 0;
auto xb = 0;
while (xb < s.length.to!in... | D |
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;
import core.bitop;
T RD(T = string)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] AR... | D |
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
alias sread = () => readln.chomp();
alias Point2 =... | D |
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DE... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
int[][10^^5] PS;
int[10^^5] MEMO;
void main()
{
auto nm = readln.split.to!(int[]);
auto N = nm[0];
auto M = nm[1];
foreach (_; 0..M) {
auto xy = readln.split.to!(int[]);
PS[xy[0]-1] ~... | D |
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
int calc(int n, int m) {
int f(int k) {
return k * (k - 1) / 2;
}
return f(n) + f(m);
}
void main() {
... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto S = readln.chomp.to!(wchar[]);
int r, b;
foreach (c; S) {
switch (c) {
case '0':
++r;
break;
case '1':
++... | D |
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
std.typecons, std.container, std.format;
static import std.ascii;
// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){ret... | D |
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;
auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto ... | D |
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
void main() {
auto D = readln.split[0].to!int;
auto c =
D == 25 ? "Christmas" :
D == 24 ? "Christmas Eve" :
D == 23 ? "Christmas Eve Eve" :
D == 22 ? "Christmas Eve Eve Eve" : "";
c.write... | D |
void main()
{
long n = rdElem;
Edge[][] edge = new Edge[][](n);
foreach (i; 0 .. n-1)
{
long u, v, w;
rdVals(u, v, w);
--u, --v;
edge[u] ~= Edge(v, w), edge[v] ~= Edge(u, w);
}
long[] color = new long[n];
color[] = -1;
void dfs(long x, long col)
{
... | D |
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
int readint() {
return readln.chomp.to!int;
}
int[] readints() {
return readln.split.map!(to!int).array;
}
int calc(int[] xs) {
int ans = 0;
for (int i... | D |
import std.stdio, std.string, std.conv;
void main() {
foreach (i; 0 .. 10) {
string cards = readln.chomp.to!(string);
if (cards == "-") break;
int m = readln.chomp.to!int;
foreach (j; 0 .. m) {
int h = readln.chomp.to!int;
cards = cards[h..$] ~ cards[0..h];
... | D |
void main()
{
dchar[] s = rdDchar;
bool rev;
dchar[] front, back;
long q = rdElem;
foreach (i; 0 .. q)
{
string[] p = rdRow!string;
if (p.length == 1)
{
rev = !rev;
}
else
{
long f = p[1].to!long - 1;
dchar c = ... | D |
import std.stdio, std.string, std.conv, std.array, std.regex, std.algorithm;
void main(){
auto ip = readln.chomp;
switch(ip){
case "a", "i", "u", "e", "o":
writeln("vowel");
break;
default:
writeln("consonant");
break;
}
} | D |
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;
void main() {
int n;
scan(n);
auto a = new int[](n), b = new int[](n);
auto c = new int[](n), d = new int[](n);
foreach (i ; 0 .. n) {
scan(a[i], b[i]);
}
foreach (i ; 0 .. n) {
scan(c[i]... | D |
import std.stdio,
std.string,
std.conv,
std.algorithm;
void main() {
string S = readln.chomp;
int[char] arr;
foreach (c; 'a'..'z') {
arr[c] = 0;
}
foreach (c; S) {
arr[c]++;
}
char add_char = 'z' + 1;
foreach (c; arr.byKey) {
if (arr[c] != 0) continue;
add_char =... | D |
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DE... | D |
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
std.random, std.typecons, std.container;
ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () ... | D |
import std.stdio, std.string, std.array, std.conv, std.algorithm, std.typecons, std.range, std.container, std.math, std.algorithm.searching, std.functional,std.mathspecial;
void main(){
auto mn=readln.split.map!(to!int).array;
auto m=mn[0];
auto n=mn[1];
string[] as;
string[] bs;
foreach(i;0..m... | D |
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=(... | D |
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;
void main() {
auto N = readln.chomp.to!int;
auto A = readln.split.map!(to!int).array;
DList!int queue;
foreach (i; 0..N) {... | D |
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;
enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;
void main() {
auto week = ["MON", "TUE", "WED", "THU"... | D |
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;
int[] digits(int n) {
... | D |
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;
string FMT_F = "%.10f";
static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(... | D |
void main()
{
dchar[] s = rdDchar;
dchar[] t = rdDchar;
LCS!dchar(s, t).writeln;
}
T[] LCS(T)(T[] x, T[] y)
{
T[] result;
long xlen = x.length, ylen = y.length;
long[][] dp = new long[][](xlen+1, ylen+1);
foreach (i, u; x)
{
foreach (j, v; y)
{
if (u == v) d... | D |
// import chie template :) {{{
import std.stdio, std.algorithm, std.array, std.string, std.math, std.conv,
std.range, std.container, std.bigint, std.ascii, std.typecons, std.numeric;
// }}}
// nep.scanner {{{
class Scanner {
import std.stdio : File, stdin;
import std.conv : to;
import std.array : split;
impo... | D |
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;
string FMT_F = "%.10f";
static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_r... | D |
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
std.random, std.typecons, std.container;
ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = (... | D |
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.datetime;
void main() {
auto s = readln.split.map!(to!int);
auto N = s[0];
auto Y = s[1];
for (int i = 0; i * 10000 <= ... | D |
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;
string FMT_F = "%.10f";
static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(... | D |
import std.stdio, std.string, std.conv, std.bigint, std.typecons, std.algorithm, std.array, std.math, std.range, std.functional;
void main() {
readln.enumerate.filter!(a => a.index % 2 == 0).map!(a => a.value).array.writeln;
} | D |
void main(){
int a = _scan();
(a+a^^2+a^^3).writeln();
}
import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;
// 1要素のみの入力
T _scan(T= int)(){
return to!(T)( readln().chomp() );
}
// 1行に同一型の複数入力
T[] _scanln(T = int)(){
T[] ln;
foreach(string elm; readln().chomp().split()){
ln ~= elm.to!... | D |
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", ... | D |
import std.stdio, std.string, std.array, std.conv;
void main() {
string row;
foreach (i; 0 .. 300) row ~= "#";
while (true) {
int[] tmp = readln.chomp.split.to!(int[]);
int h = tmp[0], w = tmp[1];
if (h == 0 && w == 0) break;
foreach (i; 0 .. h) row[0..w].writeln;
wr... | D |
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;
int[] d = [-1,1];
int h,w;
int[][] hwall,wwall;
int saiki(){
Tuple!(int,int)[] queuex,queuey;
int x,y;
bool[31][31]... | D |
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", ... | D |
import std;
bool calc(int a, int b, int c, int d) {
int x = (c + b - 1) / b;
int y = (a + d - 1) / d;
return x <= y;
}
void main() {
int a, b, c, d; scan(a, b, c, d);
writeln(calc(a, b, c, d) ? "Yes" : "No");
}
void scan(T...)(ref T a) {
string[] ss = readln.split;
foreach (i, t; T) a[i] ... | D |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.