code stringlengths 4 1.01M | language stringclasses 2
values |
|---|---|
void main(){
import std.stdio, std.string, std.conv, std.algorithm;
auto args=readln.split.to!(int[]);
if((args[2]-args[1])&1){
writeln("Borys");
}else{
writeln("Alice");
}
}
void rd(T...)(ref T x){
import std.stdio, std.string, std.conv;
auto l=readln.split;
assert(l.length==x.length);
for... | D |
import std.algorithm;
import std.conv;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
void main ()
{
auto tests = readln.strip.to !(int);
foreach (test; 0..tests)
{
auto s = readln.strip;
auto t = readln.strip;
auto m = s.length;
auto n = t.length;
auto g = gcd (m, n);
auto x... | 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 main()
{
int n; readV(n);
auto r = 0;
... | D |
import std.stdio;
import std.string;
void main() {
int a;
scanf("%d\n", &a);
auto s = readln.chomp;
if (a >= 3200) s.write;
else "red".write;
}
| 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 main()
{
int a, b; readV(a, b);
if (b%a ... | 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;
void main()
{
auto n = readln.chomp.to!int;
auto s = readln.chomp;
long rc, gc, bc;
foreach (i; 0..n) {
if (s... | D |
/+ dub.sdl:
name "C"
dependency "dcomp" version=">=0.6.0"
+/
import std.stdio;
// import dcomp.scanner;
int main() {
auto sc = new Scanner(stdin);
long x;
sc.read(x);
long sm;
foreach (i; 1..1000000) {
sm += i;
if (sm >= x) {
writeln(i);
break;
... | 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;
void scan(T...)(ref T a) {
string[] ss = readln.split;
foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return r... | D |
import std.stdio, std.string, std.conv, std.array, std.algorithm;
void main() {
auto S = readln.chomp.to!int;
writeln(S/3600, ":", S % 3600 / 60, ":", S % 60);
} | 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 File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() ... | D |
import std.stdio;
import std.string;
import std.conv;
int main()
{
while (true) {
string[] s1 = readln.chomp.split;
int n = s1[0].to!int;
int m = s1[1].to!int;
int a = s1[2].to!int;
if (n == 0 && m == 0 && a == 0) break;
int max = -1;
int[1001][1001] N;
... | 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 S = readln.chomp.to!(char[]);
foreach (ref c; S) {
auto x = c - 'A';
x = (x + N) % 26;
c = ('A' + x).to!char;
}
writeln(S);... | D |
// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;
int w, h, a, b;
void main() {
scan(h, w, a, b);
auto c = ModCombo(w + h);
long ans;
foreach (i ; 0 .. h -... | D |
import std.stdio;
import std.algorithm;
import std.conv;
import std.datetime;
import std.numeric;
import std.math;
import std.string;
string my_readln() { return chomp(readln()); }
void main()
{//try{
auto tokens = split(my_readln());
auto X = to!ulong(tokens[0]);
if (X == 7 || X == 5 || X == 3)
writeln("YES");... | 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;
import std.numeric;
void main()
{
readln;
readln.chomp.split.map!(a=>a.to!int - 1).sum.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, core.stdc.stdio;
void main() {
auto N = readln.chomp;
writeln(to!char(N[0] + 1));
} | D |
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;
void main() {
char a, b;
scan(a, b);
writeln(a == b ? "H" : "D");
}
void scan(T...)(ref T args) {
import std.stdio : readln;
import std.algorithm : splitter;
import std.conv : to;
import std.range.primit... | D |
import std.stdio,std.conv,std.string,std.algorithm,std.array;
void main(){
auto a=readln();
auto b=readln();
auto c=readln();
char A,B,C;
A=a[0];
B=b[1];
C=c[2];
write(A);
write(B);
write(C);
writeln();
} | 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 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.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 x = new int[](N);
a... | D |
import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
void main ()
{
string s;
while ((s = readln.strip) != "")
{
auto t = readln.split;
bool ok = t.any !(r => r[0] == s[0] || r[1] == s[1]);
writeln (ok ? "YES" : "NO");
}
}
| D |
import std.stdio;
void main() {
foreach (i; 0 .. 1000)
writeln("Hello World");
} | D |
/* imports all std modules {{{*/
import
std.algorithm,
std.array,
std.ascii,
std.base64,
std.bigint,
std.bitmanip,
std.compiler,
std.complex,
std.concurrency,
std.container,
std.conv,
std.csv,
std.datetime,
std.demangle,
std.encoding,
std.exception,
std.file,
std.format,
std.functi... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto X = readln.chomp.to!long;
long x = 100;
foreach (t; 1..10000) {
x = (x.to!double * 1.01).to!long;
if (x >= X) {
writeln(t);
return;
}
... | 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.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;
struct Word {
string s;
int last;
}
void main() {
int[char] v = [
'a' : 0,
'e' : 1,
'i' : 2,
'o' : 3,
'u' : 4
];
int vo... | D |
void main() {
(ri < 1200 ? "ABC" : "ARC").writeln;
}
// ===================================
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typeco... | 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 main()
{
int n, m; readV(n, m);
auto c =... | D |
import std.stdio;
import std.typecons;
import std.algorithm;
void main() {
long n, m;
scanf("%ld %ld", &n, &m);
Tuple!(long, long)[] ss;
foreach(i;0..n) {
long a, b;
scanf("%ld %ld", &a, &b);
ss ~= tuple(a, b);
}
ss.sort!((a, b) => a[0] < b[0]);
long p;
foreach(s; ss) {
if (m <= 0) break;
p += s[0] *... | D |
import std.stdio, std.conv, std.string, std.algorithm, std.math, std.array, std.container;
void main() {
int[32] a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];
a[readln.chomp.to!int-1].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, std.bitmanip, std.regex;
void main() {
auto N = readln.chomp.to!int;
auto A = readln.chomp;
foreach (i; 0..N-1) {
if (A... | D |
void main(){
int p, q, r;
scanf("%d %d %d", &p, &q, &r);
min(p+q, p+r, q+r).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().... | D |
import std.stdio;
void main()
{
int n = 0;
int m = 0;
scanf("%d %d", &n, &m);
printf("%d %d\n", n*m, 2*(n+m));
} | 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.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 File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() ... | 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() {
int n;
scan(n);
if (n == 0 || n... | 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 infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;
void main() {
string s;
scan(s);
auto p = "keyence";
... | 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 readC(T...)(size_t n,ref T t){foreach(ref v;t)... | D |
import std.functional,
std.algorithm,
std.bigint,
std.string,
std.traits,
std.array,
std.range,
std.stdio,
std.conv;
void main() {
ulong[] XY = readln.chomp.split.to!(ulong[]);
ulong X = XY[0],
Y = XY[1];
ulong n;
while (X*2^^n <= Y) {
n++;
... | D |
import std.stdio,std.conv,std.string;
void main(){int x=to!int(readln.chomp);writeln(x*x*x);} | 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;
// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.c... | D |
import std;
alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
auto x = lread();
foreach (i; x .. (x + 10 ^^ 6))
{
... | D |
import std.stdio;
import std.uni;
import std.string;
import core.stdc.stdio;
import std.array;
import std.algorithm;
int main(string[] argv)
{
int n,k;
scanf("%d", &n);
int [] arr = new int[n];
for(int i = 0; i<n; i++){
int h,m;
scanf("%d:%d", &h,&m);
h*=60;
arr[i] = h+m;
}
arr.sort();
int mx=0;
for... | 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 main()
{
int x, y; readV(x, y);
writeln(x... | D |
import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.string;
import std.uni;
import std.range;
void main()
{
auto a = readln.strip.repeat(10).join("");
if (a.indexOf(readln.strip) != -1)
writeln("Yes");
else
writeln("No");
}
| D |
void main(){
string s = readln().chomp();
foreach(i,c; s){
if( (i+1)%2 ){
if(c!='R' && c!='U' && c!='D'){
writeln("No");
return;
}
}else{
if(c!='L' && c!='U' && c!='D'){
writeln("No");
return;
}
}
}
writeln("Yes");
}
import std.stdio, std.conv, std.algorithm, std.numeric, st... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;
void main()
{
auto nab = readln.split.to!(int[]);
writeln(nab[0] * nab[1] > nab[2] ? nab[2] : nab[0] * nab[1]);
} | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;
void main()
{
auto dts = readln.split.to!(int[]);
auto D = dts[0];
auto T = dts[1];
auto S = dts[2];
writeln(D <= T * S ? "Yes" : "No");
} | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto hw = readln.split.to!(int[]);
auto H = hw[0];
auto W = hw[1];
auto MAP = new char[][](H, W);
foreach (i; 0..H) {
foreach (j, c; readln.chomp) MAP[i][j] = c;
}
fo... | D |
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
import std.format;
void main()
{
auto input1 = readln.chomp.to!int... | D |
import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.conv, std.stdio, std.typecons;
void main()
{
auto rd = readln.split.map!(to!int);
auto w = rd[0], h = rd[1], x = rd[2], y = rd[3], r = rd[4];
writeln(x... | 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 = 1L<<60;
void main() {
long n, s;
scan(n);
scan(s);
if (n == s) {
writeln(n + 1);
return;
}
if (n < s) {
... | D |
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;
void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void main()
{
int n; readV(n);
writeln((n%1000)%111 == 0 || (n/10)%111 == 0 ? "Yes" : "No");
}
| D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
int solve(int n, int x, int p) {
if (p == 0) return x == 0 ? 1 : 0;
if (n == 0) return 0;
int r;
if (x >= n) r += solve(n-1, x-n, p-1);
r += solve(n-1, x, p);... | D |
import std.stdio;
import std.string;
import std.algorithm;
import std.conv;
void main() {
auto arr = readln.chomp.split.map!(to!int);
int result = 0;
for (int i = arr[0]; i <= arr[1]; i++) {
if (arr[2] % i == 0) result++;
}
result.writeln;
} | D |
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
void log(A...)(A arg) { stderr.writeln(arg); }
int size(T)(in T s) { return cast(int)s.length; }
void main() ... | 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;
void scan(T...)(ref T a) {
string[] ss = readln.split;
foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return read... | D |
import std.stdio;
void main(){
auto inputs = readln;
if(inputs[2] == inputs[3] && inputs[4] == inputs[5])
writeln("Yes");
else
writeln("No");
} | D |
import std.stdio,std.string,std.conv,std.algorithm,std.range;
void main()
{
auto n = readln.chomp.to!ulong;
if(n==0) 1.writeln;
else iota(1, n + 1).reduce!"a*b".writeln;
} | 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.conv, std.string, std.array, std.math, std.regex, std.range, std.ascii;
import std.typecons, std.functional;
import std.algorithm, std.container;
struct Box{
long a, b, c;
}
enum MOD = 1000000007L;
void main()
{
long N = scanElem;
string s1 = readln.strip;
string s2 = readln.strip... | D |
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
void main(){
auto x = readln.chomp.to!int;
auto a = readln.chom... | D |
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;
void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void main()
{
int a, b, c, d, e, f; readV(a, b, c, d, e, f);
auto nu = 0, de = a*100;
foreach (o1; 0.... | D |
void main() {
auto S = rs, T = rs;
foreach(i; 0..S.length) {
string tmp = S[1..$];
tmp ~= S[0];
if(S == T) {
writeln("Yes");
return;
}
S = tmp;
}
writeln("No");
}
// ===================================
import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorith... | D |
import std.stdio;
import std.ascii;
import std.numeric;
import std.algorithm;
import core.stdc.stdio;
int main()
{
int t = readInt!int;
foreach(ti; 0 .. t)
{
int n = readInt!int;
int[] a = new int[](n);
int[] even;
int[] odd;
foreach(ref ai; a)
{
... | 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, k;
scan(n, k);
auto mc = ModComb(n... | D |
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int read() { return readln.chomp.to!int; }
int[] reads() { return readln.split.to!(int[]); }
void main() {
auto a = reads();
if (a[0] + a[1] == 15)
writeln("+");
else if (a[0] * a[1] == 15)
writeln("*");... | 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;
import std.ascii;
void main()
{
auto x = readln.chomp.to!int;
auto res = (x / 500) * 1000;
res ... | D |
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;
void main() {
int x, y;
scan(x, y);
int ans;
if (1L * x * y != 0) {
if (0 < x && x < y) ans = y - x;
else if (0 < y && y < x) ans = x - y + 2;
... | D |
import std.stdio;
import std.array;
import std.algorithm;
import std.conv;
import std.numeric;
import std.string;
void main() {
int N = readln.chomp.to!int;
long[] L = new long[N + 1];
L[0] = 2;
L[1] = 1;
for (int i = 2; i <= N; ++i) L[i] = L[i - 1] + L[i - 2];
L[N].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, core.stdc.string;
immutable long INF = 1L << 59;
long even(long n) {
return n == 0 ? 2 : n % 2;
}
long odd(long n) {
return 1 - n ... | D |
import std.stdio;
void main()
{
int n, h, x;
int result = 0;
scanf("%d%d", &n, &h);
for (int i = 0; i < n; i++) {
scanf("%d", &x);
result += (x > h) ? 2 : 1;
}
printf("%d\n", result);
}
| D |
import std.stdio;
void main()
{
int n;
scanf("%d", &n);
char[][] m = new char[][n];
for (int i = 0; i < n; i++) {
m[i] = new char[n + 1];
scanf("%s", m[i].ptr);
}
int res = 0;
for (int i = 0; i < n; i++) {
int r = 0;
int c = 0;
for (int j = 0; j < n; j++) {
if (m[j][i] == 'C')
c++;
i... | 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.algorithm, std.stdio, std.string;
void main () {
string s;
while ((s = readln.strip) != "")
s.count !(x => "aeiou13579".canFind (x)).writeln;
}
| 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;
void main()
{
int n;
scanf("%d", &n);
printf("%lld\n", (1L << n + 1) - 1 - 1);
} | D |
void main() {
writeln(readln.chomp.to!int ^^ 2);
}
import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni; | 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;
}
bool isPrime(int n) {
if (n < 2)
return ... | D |
void main(){
int r = _scan();
(3*r^^2).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!T();
... | D |
import std.stdio;
import std.conv;
import std.array;
import std.string;
void main()
{
string s, str = "";
while ((s = readln()).length) {
str ~= s;
}
for (int i = 0; i < 26; i++) {
int cnt;
cnt += str.count('a' + i);
cnt += str.count('A' + i);
writeln(to!char('a' + i), " : ", cnt);
... | D |
import std.stdio;
import std.array;
import std.conv;
import std.algorithm;
import std.string;
import std.typecons;
import std.format;
int[Tuple!(long, long, long)] patterns;
long answer;
void solve(long a, long b, long c, long x)
{
auto key = tuple(a, b, c);
if (key in patterns) {
return;
}
patterns[key] = 0;
... | 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.algorithm;
import std.math;
import std.range;
import std.ascii;
import std.array;
import std.container;
import std.conv;
import std.numeric;
import std.stdio;
import std.string;
import std.typecons;
void log(A...)(A arg) {
stderr.writeln(arg);
}
class UnreliableRollingHash(ulong P) {
// fast but un... | 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;
import std.algorithm;
import std.conv;
import std.string;
int f(int n) {
return n*(n+1)/2;
}
void main() {
int n, l;
scanf("%d %d", &n, &l);
if (l <= 0 && l + n > 0) {
write(f(l+n-1)-f(-l));
}
else if (l > 0) {
write(f(l+n-1)-f(l));
}
else {
write(-f(-l)+f(-l-n+1));
}
}
| D |
import std.stdio;
import std.range;
import std.array;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.container;
import std.typecons;
import std.random;
import std.csv;
import std.regex;
import std.math;
import core.time;
import std.ascii;
import std.digest.sha;
import std.outb... | 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 pickV(R,T...)(ref R r,ref T t){foreach(ref v;t)pick(r,v);}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t... | D |
import std.functional,
std.algorithm,
std.bigint,
std.string,
std.traits,
std.array,
std.range,
std.stdio,
std.conv;
bool isNumeric(char c) {
return '0' <= c && c <= '9';
}
void main() {
int[] AB = readln.chomp.split.to!(int[]);
int A = AB[0],
B = AB... | D |
import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) { if (!m) return [[]]; if (s.empty) return []; return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
... | D |
string vowels = ['a', 'e', 'i', 'o', 'u'];
void main(){
char c = _scan!char();
if(vowels.find(c).empty)writeln("consonant");
else writeln("vowel");
}
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[... | 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<<30;
enum full = (1<<26) - 1;
void main() {
string s;
scan(s);
int n = s.length.to!int;
auto dp = new int[](n + 1);
dp[n] = 1;
... | D |
#!/usr/bin/rdmd
import std.stdio: writeln, readln;
import std.conv: parse;
void main()
{
auto input = readln();
auto num = parse!int(input);
writeln((num^^3));
} | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
long f(long b, long n)
{
long r;
while (n) {
r += n%b;
n /= b;
}
return r;
}
void main()
{
auto n = readln.chomp.to!long;
auto s = readln.chomp.to!long;
if (n == s) {
... | D |
import std.stdio;
import std.string;
import std.format;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.concurrency;
import std.traits;
import std.uni;
import c... | 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;
import std.algorithm;
import std.array;
import std.conv;
import std.string;
import std.math;
void main() {
auto abc = readln.chomp.split.map!(to!int).array;
long a = abc[0], b = abc[1], c = abc[2];
if (a == b && b == c && a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
(-1).writeln;
}
else ... | D |
void main()
{
long s, w;
rdVals(s, w);
writeln(w < s ? "safe" : "unsafe");
}
enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;
T rdElem(T = long)()
if (!is(T == struct))
{
return readln.chomp.to!T;
}
alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);
T rdEle... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.