code stringlengths 4 1.01M | language stringclasses 2
values |
|---|---|
import std.stdio, std.algorithm, std.array, std.ascii;
int main() {
char a = scanChar();
if('a'<=a && a<='z') {
writeln("a");
} else {
writeln("A");
}
return 0;
}
char scanChar() {
import std.ascii;
int c = ' ';
while(isWhite(c) && c != -1) {
c = getchar;
}
return cast(char)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 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, std.range, std.algorithm;
void main() {
auto w = readln.chomp;
int[char] char_count;
foreach (c; w) {
char_count[c]++;
}
if (char_count.values.all!"a % 2 == 0") {
"Yes".writeln;
} else {
"No".writeln;
}
} | D |
import std.stdio, std.conv, std.string, std.math, std.regex, std.range, std.ascii, std.algorithm;
void main(){
auto ip = readln.split.to!(int[]), A=ip[0], B=ip[1], T=ip[2];
writeln(T/A*B);
} | 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 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 n = sread();
// writeln(n);
long sum_n;
foreach (i;... | D |
import std.stdio;
import std.conv;
import std.string;
void main(string[] args){
while(1){
int n = to!int(readln.chomp);
if(n == 0) break;
int S = 0;
int Smin = 0;
int Smax = int.min;
int dmax = int.min;
for(int i = 0; i < n; i ++){
S += to!int(readln.chomp);
if(S > Smax) Smax = S;
if(Smax - Smi... | 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);
auto a = iota(n).map!(i => readln.chomp.to!int).array;
long ans;
foreach_reverse (i ; 0 .. n) {
if (a[i... | 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.range;
import std.conv;
void main()
{
auto ip = readln.split.to!(int[]), X = ip[0], A = ip[1], B = ip[2];
if(A >= B) {
writeln("delicious");
} else {
if(B-A > X) {
writeln("dangerous");
} else {
writeln("safe");
}
}
}
| 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]);
int c = to!int(inputs[2]);
if(b - a == c - b) "YES".writeln;
else "NO".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;
import std.string;
import std.conv;
import std.algorithm;
void main() {
string[] inputs = split(readln());
int A = to!int(inputs[0]);
int B = to!int(inputs[1]);
int C = to!int(inputs[2]);
int D = to!int(inputs[3]);
max(A*B, C*D).writeln;
}
| D |
import std.stdio;
import std.conv;
import std.string;
import std.math;
import std.random;
import std.range;
import std.algorithm;
import std.functional;
import core.bitop;
import std.bigint;
import std.typecons;
import std.container;
void main()
{
auto input = readln.split.to!(ulong[]);
auto X = input[0], Y =... | D |
import std.stdio, std.array, std.conv, std.typecons, std.algorithm;
T diff(T)(const ref T a, const ref T b) { return a > b ? a - b : b - a; }
void main() {
immutable input = readln.split.to!(ulong[]);
immutable r = input[0], d = input[1], x2k = input[2];
ulong x = x2k;
for(ulong i = 0; i < 10; i++) {... | D |
import std.stdio;
import std.string;
import std.conv;
int main()
{
int a = readln().chomp().to!int();
a = a * a * a;
writeln(a);
return 0;
} | 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 |
void main()
{
int[] tmp = readln.split.to!(int[]);
int n = tmp[0], a = tmp[1], b = tmp[2];
string s = readln.chomp;
int pass, oversea;
foreach (c; s)
{
if (c == 'a' && pass < a + b)
{
"Yes".writeln;
++pass;
}
else if (c == 'b' && pass < 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;
import std.bigint;
void main()
{
auto xt = readln.chomp.split.map!(to!int);
writeln(max(xt[0]-xt[1],0));
}
| D |
/+ dub.sdl:
name "D"
dependency "dcomp" version=">=0.6.0"
+/
import std.stdio, std.algorithm, std.range, std.conv, std.math;
// import dcomp.foundation, dcomp.scanner;
int main() {
auto sc = new Scanner(stdin);
int n;
sc.read(n);
int[][] g = new int[][](n);
foreach (i; 0..n-1) {
in... | 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.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.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;
void main() {
for(;;) {
// input
int R, C;
{
auto temp = readln.split;
R = to!int(temp[0]);
C = to!int(temp[1]);
}
if(R == 0 && C == 0) {
break;
... | D |
import std.stdio;
import std.array;
import std.math;
import std.conv;
import std.string;
void main() {
string[] input = split(chomp(readln));
int x = to!int(input[0]);
int y = to!int(input[1]);
writeln((x*y)," ",(x*2 + y*2));
} | D |
import std.stdio;
import std.string;
import std.conv;
void main(){
int[101] counter;
string rc;
int max;
while( 1 ){
rc = readln().chomp();
if( !rc ){ break; }
counter[ to!int( rc ) ]++;
if( max < counter[ to!int( rc ) ] ){
max = counter[ to!int( rc ) ];
}
}
foreach( i,c ; counter ){
if( c == max ... | D |
import std.stdio;
import std.conv;
import std.array;
import std.algorithm;
struct Item {
int w;
int v;
}
void main()
{
auto buf = readln.split;
int N = buf[0].to!int;
int W = buf[1].to!int;
Item[] items = new Item[N];
foreach (i; 0..N){
buf = readln.split;
items[i].w = buf[... | D |
import std.string,
std.stdio,
std.conv;
void main(){
while(true){
string s = readln.chomp;
if (s == "-") break;
int n = readln.chomp.to!int;
ulong sx=0;
foreach(i;0..n){
sx+=readln.chomp.to!int;
}
sx = sx % s.length;
writeln(s[sx..$] ~ s[0..sx]);
}
} | 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.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;
int cnt;
foreach (i; 0..s.length/2) {
if (s[i] != s[$-... | D |
import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
void main ()
{
string s;
while ((s = readln.strip) != "")
{
bool have0 = false;
bool have1 = false;
foreach (ref c; s)
{
if (c == '0')
{
writeln (have0 ? 1 : 3, " ", 1);
have0 ^= true;
}
else
... | D |
void main()
{
long n = rdElem;
string s = rdStr;
long result;
foreach (i; 0 .. n)
{
long[] z_arr = s[i..$].z;
foreach (j; 0 .. n-i)
{
if (j >= z_arr[j]) result = max(result, z_arr[j]);
}
}
result.writeln;
}
long[] z(string s)
{
long len = s.... | 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 bignu... | 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.string, std.array, std.math, std.regex, std.range, std.ascii;
import std.typecons, std.functional, std.traits;
import std.algorithm, std.container;
void main()
{
long N = scanElem;
string S = readln.strip;
long K = scanElem;
foreach(c; S)
{
if(S[K-1]==c)write... | 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;
import std.datetime, std.bigint;
void main() {
long n, k;
scan(n, k);
long x = n / k;
writeln(x & 1 ? "YES"... | D |
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;
enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;
alias Pair = Tuple!(int, "a", int, "b");
void main() {
... | 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 s; readV(s);
auto b = new b... | D |
import std.stdio;
import core.stdc.stdio;
import std.algorithm;
import std.math;
import core.stdc.string;
char[] A;
char[] B;
class Arr{
int as,bs,cs,ds;
void Set(int a,int b,int c,int d){
as = a;
bs = b;
cs = c;
ds = d;
data = new int[a*b*c*d];
}
this(){
Set(500,10,2,3);
}
int[] data;
ref int opIn... | D |
import std.stdio;
import std.string;
import std.conv;
import std.math;
void main() {
int N = to!int(chomp(readln()));
int A = to!int(chomp(readln()));
writeln(pow(N, 2) - A);
}
| 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.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, k; readV(a, b, k);
for... | D |
import std.stdio, std.string, std.conv;
void main() {
string s = readln.chomp;
string t = readln.chomp;
int cnt;
foreach (i; 0 .. 3) {
if (s[i] == t[i]) ++cnt;
}
cnt.writeln;
} | 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;
import std.datetime, std.bigint;
int n, a, b;
int[] x, y;
void main() {
scan(n, a, b);
x = new int[](n);
y = ne... | D |
void main(){
import std.stdio, std.string, std.conv, std.algorithm;
long n, m, a, b; rd(n, m, a, b);
long x=(((n+m-1)/m)*m-n)*a;
long y=(n-(n/m)*m)*b;
writeln(min(x, y));
}
void rd(T...)(ref T x){
import std.stdio, std.string, std.conv;
auto l=readln.split;
assert(l.length==x.length);
foreach(i,... | D |
import std.stdio;
import std.range;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.typecons;
import std.variant;
void main() {
long tt = readln().chomp.to!long;
foreach (t; 0 .. tt) {
readln();
long[] piles = readln().chomp.split(" ").map!(to!long).array;
... | 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, core.stdc.string;
void main() {
auto N = readln.chomp.to!int;
auto S = readln.chomp;
auto used = new bool[](N);
for (int i... | D |
module main;
import std.stdio;
import std.algorithm;
import std.array;
ulong pow(ulong a, ulong b){
if (b == 0)
return 1;
ulong ans = a;
for (ulong i = 2; i<=b; ++i)
ans *= a;
return ans;
}
int main(string[] argv)
{
ulong l;
ulong r;
scanf("%d %d", &l, &r);
ulong ans = 0;
for ... | D |
void main(){
import std.stdio, std.string, std.conv, std.algorithm;
auto s=readln.chomp.to!(char[]);
auto t="abcdefghijklmnopqrstuvwxyz".to!(char[]);
if(s.length<t.length){writeln(-1); return;}
int cnt=0;
for(int i=0, j=0; i<t.length.to!(int); i++, j++){
if(cnt==t.length.to!(int)) break;
while(j<s... | 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;
bool solve() {
auto L = new int[](4);
auto S = new int[](4);
auto R = new int[](4);
auto P = new int[](4);
foreach (i;... | 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 f = false;
foreach (i; 0..s.length-1) {
if (s[i] ... | D |
import std.stdio;
import std.algorithm;
import std.typecons : tuple, Tuple;
import std.container.rbtree;
int n;
long s;
int[] l;
int[] r;
bool can(long m) {
int cnt = 0;
int other = n;
long sum = 0;
for(int i = 0; i < n; ++i) {
if (m < l[i]) {
++cnt;
sum += l[i];
--other;
} else if (r[i] < m) {
s... | D |
import std.stdio;
import std.algorithm;
import std.conv;
import std.string;
import std.math;
void main(string[] args)
{
auto n = split(strip(readln));
auto a = to!long(n[0]);
auto b = to!long(n[1]);
long count;
if (a == 1 && b == 1)
{
writeln(0);
return;
}
while(a >= 1 && b >= 1)
{
if (a < b)
{
a+... | D |
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.regex;
import std.range;
void main() {
auto A = readln.chomp.to!int, B = readln.chomp.to!int, C = readln.chomp.to!int, X = readln.chomp.to!int;
int count;
foreach(i; 0..A+1) {
foreach(j; 0..B+1) {
foreach(k;... | 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 k, n; readV(k, n);
auto ans... | 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 |
import std.stdio, std.string, std.conv;
void main() {
int[] tmp = readln.split.to!(int[]);
int a = tmp[0], p= tmp[1];
writeln((3 * a + p) / 2);
} | 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 N = readln.chomp.to!long;
auto S = readln.chomp;
auto cnt... | 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, K;
scan(N, K);
K = min(K... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;
void main()
{
writeln(readln.chomp == "0" ? 1 : 0);
} | 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, std.datetime;
// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generat... | D |
void main(){
//auto NM = readLine!long();
if( readStr() == "ABC" ){
writeln("ARC");
} else {
writeln("ABC");
}
}
import std;
string readStr(){
return readln().chomp();
}
T[] readLine( T = long )(){
return readln().split().to!(T[])();
} | D |
import std.stdio,std.string,std.conv,std.array,std.algorithm;
void main(){
string[] arr;
readln();
for(;;){
auto rc = readln().chomp();
if(!rc){ break; }
arr ~= rc;
}
sort( arr );
writeln( arr[0] );
} | D |
import std.stdio;
import std.string;
import std.conv;
import std.range;
import std.array;
import std.algorithm;
import std.typecons;
import std.math;
void main() {
while(true) {
string[] cin;
cin=split(readln());
int n=to!int(cin[0]),a=to!int(cin[1]),b=to!int(cin[2]),c=to!int(cin[3]),x=to!int(cin[4]);
if(!(n... | D |
import std.conv;
import std.stdio;
import std.string;
void main()
{
auto n = readln.strip.to!( int );
writeln( solve( n ) );
}
auto solve( in int n )
{
return n + n * ( n % 2 );
}
| D |
import std.stdio;
import std.array;
import std.conv;
void main(){
string[] input = split(readln());
int a = to!int(input[0]);
writeln(a*a*a);
}
| D |
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
void main()
{
auto S = split(readln())[0];
//if (S == "zyxwvutsrqponmlkjihgfedcba") { writeln("-1"); return; }
if (S.length < 26) { writeln(solve1(S)); }
else { writeln(solve2(S)); }
}
string solve1(string S) {
bool[26] list;
foreac... | D |
import std.stdio: readln, writeln;
import std.string: chomp;
import std.conv: to;
void main() {
int n = readln.chomp.to!int;
writeln(n/2 + n%2);
}
| 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.string, std.array, std.conv, std.algorithm.iteration, std.functional;
char[54][54] NS;
char[54][54] MS;
void main()
{
auto nm = readln.split.to!(int[]);
auto n = nm[0];
auto m = nm[1];
foreach (i; 0..n) {
auto line = readln;
foreach (j, c; line)
NS[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.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 std.stdio, std.conv, std.string, std.algorithm,
std.math, std.array, std.container, std.typecons;
void main() {
string s = readln.chomp;
foreach(c;s) write("x");
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;
void main()
{
auto s = readln.chomp.array;
foreach (i;iota(0, s.length, 2)) write(s[i]);
writel... | D |
void main() {
int n = readln.chomp.to!int;
bool ok;
foreach (i; 0 .. 26) {
foreach (j; 0 .. 15) {
if (4 * i + 7 * j == n) ok = true;
}
}
writeln(ok ? "Yes" : "No");
}
import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std... | 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!(wchar[]);
int cost;
foreach_reverse (c; S[1..$]) {
if (c == 'E') ++cost;
}
auto min_cost = cost;
for (int p =... | 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()
{
string a;
string b;
string c;
scan(a, b, c);
// writ... | D |
import std.stdio;
import std.string;
import std.conv;
void main()
{
auto a = to!long( split(readln())[0] ) ;
writeln(a/3);
} | 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);
string a, b, c;
scan(a... | D |
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.range;
import std.stdio;
import std.string;
void main() {
auto n = readln.chomp.to!int;
auto s = readln.chomp.split.map!(to!int).array;
auto q = readln.chomp.to!int;
auto t = readln.chomp.split.map!(to!int).array;
auto... | D |
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
immutable limitList = 100000;
void main() {
int input;
bool[] listNumbers = new bool[](limitList);
int[] listPrimeNumbers; //List of prime numbers.
listNumbers.fill(true);
listNumbers[0..2] = false;
... | D |
import std.stdio, std.conv, std.string, std.algorithm, std.range;
void main() {
auto input = readln.split.to!(int[]);
auto A = input[0];
auto B = input[1];
auto N = 1;
auto count=0;
while(N < B) {
N--;
N+=A;
count++;
}
count.writeln;
} | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string;
void main()
{
auto s = readln.chomp;
auto cnt = 0;
char last = s[0];
foreach (c; s[1..$]) {
if (c != last) {
++cnt;
last = c;
}
}
writeln(cnt);
} | D |
import std.stdio;
import std.string;
import std.array; // split
import std.conv; // to
void main()
{
string n = chomp(readln());
string m = chomp(readln());
if(n[0] == m[2] && n[1] == m[1] && n[2] == m[0]){
writeln("YES");
} else {
writeln("NO");
}
} | D |
import std.stdio,
std.string,
std.conv,
std.algorithm;
void main() {
int[] buf = readln.chomp.split.to!(int[]);
int a = buf[0], b = buf[1], x = buf[2];
if (a == x || a < x && a + b >= x) {
writeln("YES");
}
else {
writeln("NO");
}
}
| 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, k;
scan(n, k);
writeln(1 + (n - k + k - 2) / (k - 1));
}
void scan(T...)(ref T args) {
... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;
int[3][3] CS;
void main()
{
foreach (i; 0..3)
CS[i][] = readln.split.to!(int[])[];
foreach (a1; 0..201) {
if (a1 > CS[0][0] || a1 > CS[0][1] || a1 > CS[0][2]) continue;
auto b1 = CS[0][0] - a1;
if (b1... | 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;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
void main(){
auto N = readln.chomp.to!int;
writeln(N*(N+1)/2);
} | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string;
void main()
{
auto abcd = readln.split.to!(int[]);
auto a = abcd[0];
auto b = abcd[1];
auto c = abcd[2];
auto d = abcd[3];
if (b <= c || d <= a) {
writeln(0);
} else if (a <= c) {
writeln(b < d ? b - c : d - ... | 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() {
long N;
scan(N);
auto ans = N^^3;
write... | D |
void main()
{
long[] tmp = readln.split.to!(long[]);
long n = tmp[0], m = tmp[1];
long scc = min(n, m/2);
scc += (m - 2 * scc) / 4;
scc.writeln;
}
import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
i... | 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, c; readV(a, b, c);
wri... | D |
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.array;
import std.range;
import std.regex;
void main(){
auto a=readln.chomp.to!int;
if(a<1200)writeln("ABC");
else if(a>=1200&&a<2800)writeln("ARC");
else writeln("AGC");
} | 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()
{
foreach (line; stdin.byLine) {
auto str = line.chomp;
if (str.length == 1) break;
auto aScore = str[... | 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.searching;
void main(){
auto str = readln.chomp;
if(str.canFind("a") && str.canFind("b") && str.canFind("c")){
"Yes".writeln;
}else{
"No".writeln;
}
}
| D |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.