code stringlengths 4 1.01M | language stringclasses 2
values |
|---|---|
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.array;
import std.conv;
import std.string;
import std.algorithm;
void main()
{
auto n = map!(to!int)(readln.strip.split);
int[100][100] v1;
int[100] v2;
foreach(i;0..n[0])
foreach(int j,string e; readln.strip.split)
v1[i][j] = e.to!int;
foreach(i;0..n[1]... | D |
void main() {
import std.stdio, std.string, std.conv, std.algorithm;
long n, m;
rd(n, m);
long ans = 1;
for (long k = 1; k * k <= m; k++) {
if (m % k == 0) {
if (n * k <= m) {
ans = max(ans, k);
}
if (n * (m / k) <= m) {
ans = max(ans, m / k);
}
}
}
writeln... | D |
import std.stdio;
import std.string;
void main()
{
char[] s = readln.chomp.dup;
char[] t = readln.chomp.dup;
string ans = "No";
foreach (i; 0..s.length){
s = s[$ - 1] ~ s[0..$ - 1];
if (s == t){
ans = "Yes";
break;
}
}
writeln(ans);
}
| D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
int[10^^5] AS;
int[int] RI;
void main()
{
auto N = readln.chomp.to!int;
foreach (i; 0..N) {
auto A = readln.chomp.to!int;
AS[i] = A;
RI[A] = i;
}
sort(AS[0..N]);
int c;
... | 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(){
writeln(totalSum(readln.chomp));
}
long totalSum(string str){
long total=0;
foreach(i,s;str){
auto num=[s].to!lo... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto abk = readln.split.to!(int[]);
auto A = abk[0];
auto B = abk[1];
auto K = abk[2];
foreach_reverse (k; 1..101) {
if (A % k == 0 && B % k == 0 && --K == 0) {
... | 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);
long n, m, k;
sc.read(... | D |
import std.stdio;
int main() {
for(int i=1; i<=9; i++) {
for(int j=1; j<=9; j++) {
writeln(i, "x", j, "=", i*j);
}
}
return 0;
} | D |
import std.stdio, std.algorithm, std.range, std.conv;
void main(){
iota(1, 10).map!(a => iota(1, 10).map!(b => text(a, "x", b, "=", a*b)).join("\n")).join("\n").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;
import std.container;
alias sread = () => readln.chomp();
ulong MOD =... | 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[] aryread(T = long)(){return r... | D |
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;
void main(){
int x, y;
{
int[] tmp = readln.chomp.split.map!(to!int).array;
x = tmp[0], y = tmp[1];
}
int ans1, ans2, ans3, ans4;
if(y >= x) ans1 = y - x; else a... | 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.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.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;
class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
stri... | D |
// xxxxx
import std.random;
import std.stdio;
void main ()
{
rndGen.seed (unpredictableSeed);
writeln (uniform (0, 2) ? "Even" : "Odd");
}
| D |
// Try Codeforces
// author: Leonardone @ NEETSDKASU
import std.stdio, std.array, std.conv, std.string, std.algorithm;
auto gets() { return readln().chomp(); }
T[] getVals(T)() { return to!(T[])(readln().chomp().split(" ")); }
void main() {
auto xs = getVals!int();
auto n = xs[0], k = xs[1];
auto baloon =... | 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.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.thread;
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex;
// Input
class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { tokens = readln.split; if (stdin.eo... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto nk = readln.split.to!(int[]);
auto N = nk[0];
auto K = nk[1];
long[] as;
foreach (i, a; readln.split) {
as ~= a.to!long;
if (i) as[i] += as[i-1];
}
long... | D |
/+ dub.sdl:
name "B"
dependency "dcomp" version=">=0.6.0"
+/
import std.stdio, std.algorithm, std.range, std.conv;
// import dcomp.foundation, dcomp.scanner;
// import dcomp.modint;
int main() {
auto sc = new Scanner(stdin);
int n; long a, b, c, d;
sc.read(n, a, b, c, d); n--;
foreach (i; 0..n... | D |
// Vicfred
// https://atcoder.jp/contests/abc162/tasks/abc162_b
// simulation
import std.conv;
import std.stdio;
import std.string;
void main() {
int n = readln.chomp.to!int;
long sum = 0;
foreach(i; 1..n+1) {
if(i%3 != 0 && i%5 != 0)
sum += i;
}
sum.writeln;
}
| D |
void main()
{
long n, m, k;
rdVals(n, m, k);
foreach (i; 0 .. n+1)
{
foreach (j; 0 .. m+1)
{
long black = i * m + j * n -2 * i * j;
if (black == k)
{
"Yes".writeln;
return;
}
}
}
"No".writel... | 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;
int[][int] graph;
bool[int] used;
void dependent(int n) {
if (!used[n]) {
foreach(i; graph[n]) {
dependent(i);
}
writeln(n);
used[n] = true;
}
}
void main() {
int m, n;
scanf("%d\n%d\n", &m, &n);
foreach(i; 1..(m + 1)) {graph[i] = []; used[i] = false;}
foreach(i; ... | 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.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;
void main() {
while (true) {
int n, m;
scan(n, m);
if (n == 0 && m == 0) return;
auto t = iota(n).map!(i => readln.chomp.to!int).arra... | D |
import std.stdio, std.string, std.conv;
void main() {
int[] tmp = readln.split.to!(int[]);
int x = tmp[0], a = tmp[1];
writeln(x < a ? 0 : 10);
} | 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, std.array, std.math, std.regex, std.range, std.ascii;
import std.typecons, std.functional;
import std.algorithm, std.container;
void scanValues(TList...)(ref TList list)
{
auto lit = readln.splitter;
foreach (ref e; list)
{
e = lit.fornt.to!(typeof(e));
... | D |
import std.stdio;
void main(){
auto s=readln();
char x=s[0];
char y=s[2];
if(x<y) writeln("<");
else if(x>y) writeln(">");
else writeln("=");
} | 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(); } bool DEBUG = 0;
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
voi... | D |
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.container;
import std.array;
import std.math;
import std.range;
void main()
{
int m = readln.chomp.split.back.to!int;
string s = readln.chomp;
int l = 0, r = 1;
// bool[string] set;
bool[ulong[2]] set;
auto hasher = new ... | D |
void main()
{
long[] tmp = rdRow;
long n = tmp[0], a = tmp[1], b = tmp[2];
long l = b - 1;
long r = n - a;
long div = (b - a) / 2;
long rem = (b - a) % 2;
if (rem)
{
long s = b - a;
long t = s / 2 + a;
long u = n - b;
long v = (n - a - u) / 2 + u + 1;
... | 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.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;
immutable long MOD = 10^^9 + 7;
void main() {
auto N = readln.chomp.to!int;
auto C = readln.split.map!(x => x.to!int-1).array;
... | D |
import std.algorithm;
import std.array;
import std.bigint;
import std.bitmanip;
import std.conv;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
T diff(T)(const ref T a, const ref T b) { return a > b ? a - b : b - a; }
T[] readToArray(T)() {
return readln.split.to!(... | D |
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
/*
有向グラフ
トポロジカルソートみたいなもの
※ト... | 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;
import std.container;
alias sread = () => readln.chomp();
ulong MOD =... | 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.array, std.algorithm, std.range;
void main()
{
int[string] c;
string mw; c[mw]=0;
string ml;
foreach(w;readln().split())
{
if(w in c){ if(++c[w]>c[mw]) mw=w; }
else c[w]=1;
if(ml.length < w.length) ml=w;
}
writeln(mw... | D |
import std.stdio, std.string, std.conv;
void main() {
auto input = getStdin!(string[]);
foreach (line; input) {
auto num = line.split(" ").to!(int[]);
int width = num[1];
int height = num[0];
if (width == 0 && height == 0) break;
for (int i_h = 0; i_h < height; i_h++) {
for (int... | 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.array, std.conv;
void main() {
int n = readln.chomp.to!int;
int[] d = readln.chomp.split.to!(int[]);
int sum = 0;
foreach (i; 0 .. n-1) {
foreach (j; i+1 .. n) {
sum += d[i] * d[j];
}
}
sum.writeln;
} | D |
import std.stdio;
import std.string;
import std.algorithm;
import std.conv;
void main() {
int N = readln.chomp.to!int;
auto A = readln.chomp.split.map!(to!int);
int ans = (1e9).to!int;
foreach(a; A) {
int tmp;
while (a % 2 == 0 && a > 0) {
tmp++;
a /= 2;
}
ans = min(ans, tmp);
... | D |
void main()
{
long n = rdElem;
long[] h = rdRow;
bool ok = true;
long cnt = 1;
foreach (i; 1 .. n)
{
if (h[i] > h[i-1]) ++cnt;
else if (h[i] < h[i-1])
{
if (h[i-1] - h[i] > cnt)
{
"No".writeln;
return;
}... | 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;
scan(n);
writeln(n & 1 ? n * 2 : n);
}
void scan(T...)(ref T args) {
import std.... | D |
void main()
{
long n = readln.chomp.to!long;
long[] a = readln.split.to!(long[]);
long num = 1;
long cnt;
foreach (x; a)
{
if (x == num) ++num;
else ++cnt;
}
writeln(cnt != n ? cnt : -1);
}
import std.stdio;
import std.string;
import std.array;
import std.conv;
import ... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container;
/*
N:0
W:1
S:2
E:3
*/
void main()
{
auto hwk = readln.split.to!(int[]);
auto H = hwk[0];
auto W = hwk[1];
auto K = hwk[2];
auto xy = readln.split.to!(int[]);
auto sy = xy... | 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() {
long n;
long s;
scan(n);
scan(s);
... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;
void main()
{
auto abc = readln.split.to!(int[]);
auto K = readln.chomp.to!int;
auto max = abc.reduce!max;
writeln(abc.sum - max + max*2^^K);
} | D |
import std.stdio;
import std.conv;
import std.algorithm;
import std.range;
import std.string;
import std.math;
import std.format;
void main() {
foreach (string line; stdin.lines) {
int n = line.chomp.to!int;
int cnt = 0;
for (int a = 0; a <= 9; a++) {
for (int b = 0; b <= 9; b++) {
for (in... | D |
void main()
{
string s = readln.chomp;
long cnt;
long times;
foreach (i, c; s)
{
if (c == 'W')
{
times += i - cnt;
++cnt;
}
}
times.writeln;
}
import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
impo... | D |
// import chie template :) {{{
static if (__VERSION__ < 2090) {
import std.stdio, std.algorithm, std.array, std.string, std.math, std.conv,
std.range, std.container, std.bigint, std.ascii, std.typecons, std.format,
std.bitmanip, std.numeric;
} else {
import std;
}
// }}}
// nep.scanner {{{
class Scanner {
... | 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[] aryread(T = long)(){return readln.split.to!(T[])();}
... | 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 n;
void main() {
scan(n);
auto a = new int[][](n, n);
iota(n).each!(i => a[i][] = readln.split.to!(int[]));
... | D |
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
std.functional, std.container, std.typecons;
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
std.functional, std.container, std.typecons;
enum MOD = 1000000007;
ulong _p(ulong n, ulong k) {
if(k == 0) retu... | D |
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;
class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
stri... | 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;
char[] str;
void main() {
int N = readln.chomp.to!int;
str = readln.chomp.to!... | 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 s = readln.chomp;
auto k = "CODEFESTIVAL2016";
int cnt;
foreach (i; 0..s.l... | 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;
import std.numeric;
class InputReader {
private:
ubyte[] p;
ubyte[] buffer;
size_t cur;
public:
this () {
... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto ab = readln.split.to!(int[]);
auto A = ab[0];
auto B = ab[1];
int r;
foreach (_; 0..2) {
if (A > B) {
r += A;
--A;
} else {
r... | 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[] aryread(T = long)(){return r... | D |
void main()
{
string s = rdStr;
bool ok = true;
foreach (i, x; s)
{
if (i & 1)
{
if (x != 'i') ok = false;
}
else
{
if (x != 'h') ok = false;
}
}
if (s.length & 1) ok = false;
writeln(ok ? "Yes" : "No");
}
enum long ... | D |
import std;
void main() {
int n; scan(n);
auto a = readints;
int[int] d;
foreach (x; a) d[x]++;
for (int i = 1; i <= n; i++) {
writeln(d.get(i, 0));
}
}
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.ch... | D |
void main() {
auto N = ri;
auto S = rs;
auto warr = new int[](N);
warr[0] = (S[0] == 'W' ? 1 : 0);
foreach(i; 0..N-1) warr[i+1] = (S[i+1] == 'W' ? 1 : 0) + warr[i];
auto f(int n) {
return n+1 - warr[n];
}
int res = int.max;
foreach(i; 0..N) {
int tmp;
tmp += f(N-1) - f(i);
tmp += i < 1 ? 0 : warr[i-1... | D |
import std.conv, std.stdio, std.algorithm, std.string, std.range;
void main() {
const N = readln.chomp.to!int;
foreach (x; 1..10) foreach (y; x..10) {
if (x*y == N) {
"Yes".writeln; return;
}
}
"No".writeln;
} | D |
import std.algorithm, std.conv, std.range, 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 readA(T)(size_t n,ref T t){t=new T(n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(ElementType!T);r.popFront;}}
void readM(T...)(size_... | 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 A = readln.chomp.to!(wchar[]);
auto B = readln.chomp.to!(wchar[]);
auto C = readln.chomp.to!(wchar[]);
int r;
foreach (i; 0..N) {
auto... | 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 |
void main(){
int n = _scan(); // 操作を行う回数
int k = _scan(); // 足す値
int ans = 1;
foreach(elm; 0..n){
if(ans*2 < ans+k)ans *=2;
else ans +=k;
}
writeln(ans);
}
import std.stdio, std.conv, std.algorithm, std.numeric, std.string;
// 1要素のみの入力
T _scan(T= int)(){
return to!(T)( readln().chomp() );
}
// 1行に同一型の複数... | 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 times(alias pred)(int n) {
foreach(i; 0..n) pred();
}
auto ... | D |
import std.stdio : readf, readln, writeln;
import std.string;
import std.array;
import std.conv;
void main() {
int[] v;
v = readln.split.to!(int[]);
int H = v[0];
int W = v[1];
string[] s;
for (int i=0; i<H; i++)
s ~= readln.chomp;
int[][] dw;
int[][] dh;
for (int i = 0; i < H; i++) {
int[] c... | D |
/+ dub.sdl:
name "A"
dependency "dcomp" version=">=0.7.4"
+/
import std.stdio, std.algorithm, std.range, std.conv;
// import dcomp.foundation, dcomp.scanner;
// import dcomp.geo.primitive;
bool solve() {
alias P = Point2D!double;
P[] pol = new P[3];
P p;
foreach (i; 0..3) {
double x, ... | 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.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
void main() {
auto n = readln.chomp;
int sum;
for (int i = 0; i < n.length; ++i) {
sum += (n[i] - '0');
}
if (n.to!int % sum == 0) {
"Yes".writeln;
}
else {
"No".writeln;
}
} | 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.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, nq; readV(n, m, nq);
... | 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;
import std.range, std.algorithm, std.array;
void main() {
auto c = new string[](2);
c[0] = readln.chomp;
c[1] = readln.chomp;
writeln(equal(c[0], c[1].retro) ? "YES" : "NO");
}
void scan(T...)(ref T args) {
import std.stdio : readln;
import std.algori... | D |
void main() {
int[] tmp = readln.split.to!(int[]);
int a = tmp[0], b = tmp[1];
writeln(a < 9 && b < 9 ? "Yay!" : ":(");
}
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.typ... | 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, x; readV(a, b, x);
writeln(a <= x && x <= a+b ? "YES" : "NO");
}
| D |
import core.stdc.stdio;
import std.container;
import std.algorithm;
import std.typecons;
import std.stdio;
void main(){
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
alias Tuple!(int,"cost",int,"to") ct;
ct[][] graph = new ct[][n];
alias Tuple!(int,"a",int,"b",int,"l") edge;
edge[] es = new edge[m];
foreach(ref e;es){
... | 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;
immutable int INF = 1 << 29;
void main() {
auto N = readln.chomp.to!int;
auto A = readln.split.map!(to!long).array;
... | 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.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.conv, std.string, std.math, std.regex, std.range, std.ascii, std.algorithm;
void main(){
auto ip = readln.chomp;
switch(ip){
case "A":
writeln("T");
break;
case "T":
writeln("A");
break;
case "C":
writeln("G");
break;
case "G":
writeln("C");
break;
default:
}... | 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;
import std.container;
alias sread = () => readln.chomp();
long bignum... | 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!long;
writeln(N * (N-1) / 2);
} | 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.algorithm;
import std.array;
import std.conv;
void main(){
string[] input = readln().split();
int a = input[0].to!int(), b = input[1].to!int();
while(b != 0){
a = a % b;
swap(a, b);
}
a.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;
void solve() {
auto s = readln.split.map!(to!long);
auto K = s[0];
auto X = s[1];
long ans;
if (X == ... | D |
import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.datetime;
import std.numeric;
import std.math;
import std.string;
string my_readln() { return chomp(readln()); }
void main()
{
auto tokens = my_readln().split();
auto H = tokens[0].to!ulong;
auto W = tokens[1].to!ulong;
string[]... | 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;
import std.string;
import std.conv;
import std.algorithm;
import std.container;
import std.array;
import std.math;
import std.range;
import std.typecons;
import std.ascii;
import std.format;
void main()
{
auto a = readln.chomp.split.map!(to!int);
auto h = a[0];
auto w = a[1];
char[][] map = n... | D |
import std.stdio, std.string, std.conv, std.math;
void main() {
int n = readln.chomp.to!int;
long debt = 100000;
foreach(i;0..n) {
debt += debt * 0.05;
debt = (((debt / 1000.0).ceil) * 1000).to!long;
}
debt.writeln;
} | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto nm = readln.split.to!(long[]);
auto N = nm[0];
auto M = nm[1];
auto as = readln.split.to!(long[]);
auto af = as[0];
int x;
while (af%2 == 0) {
af /= 2;
... | D |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.