code stringlengths 4 1.01M | language stringclasses 2
values |
|---|---|
import std;
alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
void main()
{
long a, b, ab, x, y;
scan(a, b, ab, x, y);
long cost1, cost2, cost3, cost4;
cost1 = a * x + b * y;
cost2 = ab * 2 * max(x, y);
long ... | 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 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;
void main() {
int N, M, Q;
scanf("%d %d %d\n", &N, &M, &Q);
auto as = new int[Q];
auto bs = new int[Q];
auto cs = new int[Q];
auto ds = new int[Q];
foreach(q;0..Q) {
int a, b, c, d;
scanf("%d %d %d %d\n", &a, &b, &c, &d);
as[q] = a-1;
bs[q] = b-1;
cs[q] = c;
ds[q] = d;
}
auto As = new ... | D |
import std.stdio,std.conv,std.string;
void main(){
auto args = readln().chomp().split();
auto a = to!int(args[0]);
auto b = to!int(args[1]);
auto c = to!int(args[2]);
writeln( a<b&&b<c?"Yes":"No" );
} | D |
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
std.functional, std.container, std.typecons;
void main() {
int N = readln.chomp.to!int;
int[] A = new int[N];
foreach(ref a; A) {
a = readln.chomp.to!int;
}
int[] pal = new int[0];
foreach(a; A) {
auto lb = assumeSorted... | D |
import std.stdio, std.conv, std.string, std.array, std.math, std.regex, std.range, std.ascii, std.numeric, std.random;
import std.typecons, std.functional, std.traits,std.concurrency;
import std.algorithm, std.container;
import core.bitop, core.time, core.memory;
import std.bitmanip;
import std.regex;
enum INF = long.... | 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.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.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 ip = readln.split.to!(int... | D |
import std.stdio;
import std.ascii;
import std.conv;
import std.string;
import std.algorithm;
import std.range;
import std.functional;
import std.math;
import core.bitop;
import std.numeric;
T lread(T = long)()
{
return readln.chomp.to!T();
}
T[] aryread(T = long)()
{
return readln.split.to!(T[])();
}
void m... | D |
import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;
void main(){
int e, rest, ans;
while (true) {
e = readln.chomp.to!int;
if (!e) break;
ans = 1<<30;
... | 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;
void main ()
{
auto a = readln.strip.to !(int);
auto b = read... | D |
void main() {
import std.stdio, std.string, std.conv, std.algorithm;
import std.exception;
int t;
rd(t);
while (t--) {
int a;
rd(a);
bool ok = false;
for (int n = 3; n <= 360; n++) {
if (360 % n == 0) {
auto x = 180 - 360 / n;
if (a * (n - 2) % x == 0) {
if (a ... | D |
import std.stdio, std.string, std.conv, std.math, std.regex;
void main()
{
auto n = readln.chomp;
if(n[0] == n[2]){
writeln("Yes");
} else {
writeln("No");
}
} | D |
import std.stdio, std.string, std.conv, std.algorithm;
void main()
{
while(1){
auto n = readln.chomp.to!int;
if(n==0) break;
int s=1;
int max=50000001;
for(int i=2;i<n/2;++i){
if(n%i==0){
if(i<max){
s+=(i+n/i);
max = n/i;
if(i==max)
s -= i;
}else break;
}else if(i>max) ... | D |
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math, core.stdc.stdio;
int[] readints() { return readln.split.to!(int[]); }
long calc(long n, long k, long b) {
long cnt = max(0, b - k);
long p = n / b;
long r = n - p * b;
long x = max(0, r - k + 1);
return p * cnt +... | 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;
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()
{//try{
auto tokens = split(my_readln());
auto A = to!ulong(tokens[0]);
auto B = to!ulong(tokens[1]);
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.stdlib;
void main() {
auto K = readln.chomp.to!int;
long[] ans = iota(1L, 10L).array;
int idx = 0;
while (idx < ... | 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, 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 = "%.15f";
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.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.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;}}
T[] readArray(T)(size_t n){auto a=new T[](n),r=readln.splitter;foreach(ref v;a){v=r.front.to!T;r.popFront;}return a;}
T[] readArrayM(T)(size_t n){au... | D |
import std.stdio, std.string, std.conv, std.algorithm;
void main(){
auto s = readln.chomp.to!int;
writeln(s/3600, ":", s%3600/60, ":", s%3600%60);
} | 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 a;
scan(a);
int[] cnt = new int[](26);
foreach (ai ; a) {
cnt[ai - 'a']++;
}
long ans = 1L * a.length * (a.length +... | 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 |
void main(){
import std.stdio, std.string, std.conv, std.algorithm;
int n, m; rd(n, m);
auto c=readln.split.to!(int[]);
auto a=readln.split.to!(int[]);
int cnt=0;
for(int i=0, j=0; i<n && j<m; ){
if(c[i]<=a[j]){
cnt++;
i++; j++;
}else{
i++;
}
}
writeln(cnt);
}
void rd(T... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string;
void main()
{
auto ks = readln.split.to!(int[]);
auto k = ks[0];
auto s = ks[1];
long cnt;
foreach (x; 0..k+1) {
foreach (y; x..k+1) {
auto z = s - x - y;
if (z < y || z > k) continue;
if... | 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.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 n = readln.chomp.to!int;
int[string] blue;
foreach (_; 0..n) {
blue[read... | 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()
{
readln.chomp.count('2').writeln;
}
| D |
import std.stdio, std.string, std.algorithm, std.conv, std.range, std.math;
void main() {
readln.toUpper.write;
} | D |
import std.stdio;
void main(){
foreach(i;0..1000) writeln("Hello World");
} | D |
import std.stdio, std.string, std.conv, std.math;
void main() {
auto ip = readln.split.to!(int[]);
if((ip[1] * 10 + ip[2]) % 4 == 0){
writeln("YES");
} else {
writeln("NO");
}
} | D |
void main() {
readln.chomp.count('1').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;
import std.container;
import std.typecons;
import std.ascii;
import std.uni; | 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 ab = readln.split.map!(to!int);
while (1) {
bool f;
foreach (y; ab[0]..ab[1]+1) {
if (isLeapY... | 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() {
const long MAX = 3501;
auto N = readln.chomp.to!long;
foreach (b; 1..MAX) {
foreach (c; 1..MAX) {
... | D |
import std.stdio;
import std.string;
import std.conv;
int main()
{
string[] str = readln().split();
int a = to!int(str[0]);
int b = to!int(str[1]);
if (a > b) writeln("a > b");
else if (a < b) writeln("a < b");
else writeln("a == b");
return 0;
} | D |
import std.conv, std.stdio;
import std.algorithm, std.array, std.range, std.string;
void main()
{
auto a = readln[0];
if ('a' <= a && a <= 'z')
return 'a'.writeln;
'A'.writeln;
}
| D |
string solve(int x){
return (x<1200)? "ABC": "ARC";
}
void main(){
int x = inelm();
solve(x).writeln();
}
import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math, std.range;
const long mod = 10^^9+7;
// 1要素のみの入力
T inelm(T= int)(){
return to!(T)( readln().chomp() );
}
// 1行に同一型... | D |
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
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_rd[0]; s_rd.popFront; re... | 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;
void main() {
long N, K;
scan(N, K);
auto v = abs(N - K) % K;
auto a... | D |
import std.stdio,
std.string,
std.conv;
void main() {
string N = readln.chomp;
int a, b;
foreach (c; N) {
a += c - '0';
}
b = N[0] - 1 - '0';
foreach (c; N[1..N.length]) {
b += '9' - '0';
}
writeln(a > b ? a : b);
}
| D |
void main() {
problem();
}
void problem() {
auto N = scan!ulong + 1;
ulong solve() {
ulong[] divisers = new ulong[N];
divisers[] = 1;
foreach(i; 2..N) {
for(ulong x = i; x < N; x += i) divisers[x]++;
}
ulong ans;
foreach(i; 1..N) ans += i * divisers[i];
return ans;
}
so... | 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 n = readln.chomp.to!int;
int[int] cnt;
foreach (i; 0..n) {
auto d = read... | D |
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
import std.range;
import std.math;
void main(){
auto A=readln.split.to!(int[]),x=A[0],a=A[1],b=A[2];
if(a>=b)writeln("delicious");
else if(a<b&&b-a<=x)writeln("safe");
else if(a<b&&b-a>x)writeln("dangerous");
} | D |
import std.stdio, std.string, std.conv, std.algorithm;
void main() {
int n = readln.chomp.to!int;
int[] r = new int[n];
foreach (i; 0 .. n) {
r[i] = readln.chomp.to!int;
}
int maxv = int.min;
int minv = r[0];
foreach (i; 1 .. n) {
maxv = max(maxv, r[i] - minv);
minv ... | D |
void main(){
import std.stdio, std.string, std.conv, std.algorithm;
auto s=readln.chomp.to!(char[]);
auto cnt=new int[](3);
foreach(c; s) cnt[c-'a']++;
auto mn=reduce!(min)(cnt);
auto cnt1=map!(e=>e-mn)(cnt);
auto a=new int[](0);
foreach(e; cnt1)if(e>0) a~=e;
if(a.length==0){writeln("YES"); return... | 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.string;
import std.conv;
import std.algorithm;
string Sorting_String(string s) {
char[] str;
for (int i = 0; i < s.length; i++)
str ~= s[i];
for (int i = 0; i < str.length; i++)
for (int j = i + 1; j < str.length; j++) {
if (str[i] > str[j]) {
... | D |
import std.stdio, std.string, std.conv, std.array, std.algorithm, std.range;
void main()
{
auto s = readln.chomp;
string ret;
foreach (c; s) {
switch (c) {
case 'B':
if (!ret.empty)
ret = ret[0..$-1];
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();
alias Point... | D |
void main(){
long n = _scan!long();
long[] stat = [0, 0, 0];
bool legitimate_travel = true;
foreach(i; 0..n){
long[] tmp_stat = _scanln!long();
long tdif = tmp_stat[0] - stat[0]; // 所要時間
long xdif = abs( tmp_stat[1] - stat[1] ); // x方向移動距離
long ydif = abs( tmp_stat[2] - stat[2] ); // y方向移動距離
// 移動可能判定
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()
{
long k; readV(k);
auto n = 50, a... | D |
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;
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(i;0..n){t[i]=r.front.to!(ElementType!T);r.popFront;}}
voi... | D |
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;
void main() {
auto data = readln.split;
auto X = data[0].to!int, Y = data[1].to!int;
writeln(X + Y/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 = "%.15f";
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(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DE... | D |
/+ dub.sdl:
name "D"
dependency "dunkelheit" version=">=0.9.0"
+/
import std.stdio, std.algorithm, std.range, std.conv;
// import dkh.foundation, dkh.scanner;
int main() {
Scanner sc = new Scanner(stdin);
string s;
sc.read(s);
int n = s.length.to!int;
int i = 0;
int mid = n/2;
whil... | D |
import std.stdio, std.string, std.array, std.conv, std.algorithm.iteration, std.functional;
void main()
{
int tol(string n) {
auto r = n.to!int;
if (r == 1) r = 14;
return r;
}
auto ab = readln.split;
auto a = tol(ab[0]);
auto b = tol(ab[1]);
writeln(
a > b ? "A... | 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 ab=readln.split.map!(to!int).array;
writeln((ab[0]+ab[1])%24);
} | D |
import std.stdio;
import std.string;
import std.conv;
void main()
{
auto input = split( readln() );
long N = to!long(input[0]), M = to!long(input[1]);
if (N >= 2 && M >= 2) { writeln( (N-2) * (M-2) ); }
else if ( N == 1 && M >= 2 ) { writeln( M-2 ); }
else if ( M == 1 && N >= 2 ) { writeln( N-2 ); }
else if (... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
bool[101] L;
void main()
{
auto nmx = readln.split.to!(int[]);
auto N = nmx[0];
auto M = nmx[1];
auto X = nmx[2];
foreach (a; readln.split.to!(int[])) L[a] = true;
int a, b;
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.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()
{
long[] tmp = readln.split.to!(long[]);
long n = tmp[0], x = tmp[1];
long[] a = readln.split.to!(long[]);
long cnt;
foreach (i; 1 .. n)
{
long diff = a[i] + a[i-1] - x;
if (diff > 0)
{
a[i] = max(0, a[i]-diff);
cnt += diff;
}
... | 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.algorithm, std.range, std.conv, std.string, std.math, std.container, std.typecons;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln
void main() {
int n;
scanf("%d", &n);
int[] v = new int[n];
foreach (i; 0..n) {
scanf("%d", &v[i]);
}
int ans = 0;
int memkey = -1;
int memdif... | 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() {
long x = readln.chomp.to!long;
long result = x / 11 * 2;
long r = x % 11;
if (r > 0) ++result;
if (r > 6) ++result;
result.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... | D |
void main()
{
dchar[] s = readln.chomp.to!(dchar[]);
dchar[] t = readln.chomp.to!(dchar[]);
long last = t.length - 1;
bool ok;
foreach_reverse (i, x; s)
{
if (x == t[last] || x == '?')
{
bool check = true;
if (i.to!long - last >= 0)
{
... | 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.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;
if (s.length < 4) writeln("No");
else if (s[0..4] != "YAKI... | D |
void main()
{
long n = rdElem;
dchar[] s = rdDchar;
s.uniq.array.length.writeln;
}
enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
T rdElem(T = long)()
if (!is(T == struct))
{
return readln.chomp.to!T;
}
alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);
T rdElem(T)()
if (is(T == s... | D |
import std.stdio, std.string, std.conv;
void main()
{
while(true)
{
auto line = readln;
if(!line)break;
auto f = line.chomp.to!real;
f.classify.writeln;
}
}
string classify(real w)
{
if(w <= 48) return "light fly";
if(w <= 51) return "fly";
if(w <= 54) return "b... | 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 n = readln.chomp.to!int;
auto k = readln.chomp.to!int;
auto x = readln.chomp... | 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.container;
import std.datetime;
void main()
{
while (1) {
auto x = readln.chomp.split.map!(to!int);
if (x[0] == -1) break;
(Date(x[3], x[4], x[5]) - Da... | 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 n = readln.chomp.to!int;
auto m = n;
int cnt;
int k = 1;
while (n) {
... | D |
import std.stdio;
import std.ascii;
import std.string;
import std.range;
import std.algorithm;
import core.stdc.stdio;
int main()
{
int k = readInt!int;
char[] s = readString.dup.reverse;
int n = cast(int)s.length;
int q = readInt!int;
long[] pos = new long[](n + 1);
void calculate(int v)
... | 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;
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 a = readln.chomp.split.to!(int[]);
auto x = a[0] + a[1];
auto y = a[0] * a[1... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto xy = readln.split.to!(long[]);
auto X = xy[0];
auto Y = xy[1];
writeln(abs(X - Y) <= 1 ? "Brown" : "Alice");
} | D |
import std.stdio;
import std.string;
void main(){
string a,s=readln.chomp;
for(int i=0;i<s.length;++i){
if('a'<=s[i]&&s[i]<='z')a~=s[i]-'a'+'A';
else if('A'<=s[i]&&s[i]<='Z')a~=s[i]-'A'+'a';
else a~=s[i];
}
writeln(a);
} | D |
import std.stdio;
import std.algorithm;
import std.range;
import std.array;
import std.string;
import std.conv;
void main(){
auto n = readln.chomp.to!long;
writeln(get_lucas(n));
}
long get_lucas(long n, long pre = 2, long after = 1){
if(n == 1){
return after;
}else if(n == 0){
return 2;
}else{
return get_... | D |
// Try Codeforces
// author: Leonardone @ NEETSDKASU
import std.stdio : readln, writeln;
import std.string : chomp;
import std.array : split;
import std.conv : to;
import std.algorithm : sum;
auto gets() { return readln.chomp; }
auto getNum(T)() { return gets.to!T; }
auto getVals(T)() { return gets.spl... | 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.conv;
import std.range;
import std.stdio;
import std.string;
import std.utf;
void main ()
{
auto tests = readln.strip.to !(int);
foreach (test; 0..tests)
{
auto n = readln.strip.to !(int);
auto s = readln.strip;
alias mirror = len => s[0..len] ~ s[0..len].byChar.retro.array;
... | 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;
void main() {
auto s = readln.split.map!(to!int);
auto N = s[0];
auto K = s[1];
auto S = readln.chomp;
au... | D |
import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
void main ()
{
auto tests = readln.strip.to !(int);
foreach (test; 0..tests)
{
auto n = readln.strip.to !(int);
auto a = readln.splitter.map !(to !(int)).array;
long res = 0;
foreach (i; 1..n)
{
res += max (0,... | 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;
import std.range, std.array, std.container, std.math;
immutable int mod = 10^^9 + 7;
long n, s;
void main() {
readVariables(n, s);
long top, btm, mid;
if (n - dsum(n) < s) {
writeln(0);
return;
}
top = n;
while (top - ... | D |
import std.conv, std.stdio;
import std.string;
void main()
{
auto n = readln.chomp.to!int;
long s;
foreach (i; 1..n+1)
if (i % 3 && i % 5)
s += i;
s.writeln;
}
| D |
void main(){
import std.stdio, std.string, std.conv, std.algorithm;
int n, m, k; rd(n, m, k);
foreach(i; 0..n+1)foreach(j; 0..m+1){
int s=0;
s+=i*m;
s-=j*i;
s+=j*(n-i);
if(s==k){writeln("Yes"); return;}
}
writeln("No");
}
void rd(T...)(ref T x){
import std.stdio, std.string, std.co... | 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.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; }
long ... | D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
foreach (i, x; readln.split.to!(int[])) if (x == 0) {
writeln(i+1);
return;
}
} | D |
import std.functional,
std.algorithm,
std.bigint,
std.string,
std.traits,
std.array,
std.range,
std.stdio,
std.conv;
void main() {
string[] XY = readln.chomp.split.to!(string[]);
string X = XY[0],
Y = XY[1];
if (X < Y) {
writeln("<");
} else... | D |
// url: http://tenka1-2017-beginner.contest.atcoder.jp/tasks/tenka1_2017_a
import std.algorithm, std.conv, std.range, std.stdio, std.string;
void main()
{
auto s = readln.chomp;
writeln(s.count('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;
// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.c... | 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;
scan(n);
if (!n) return;
auto a = readln.split;
if (n&1) {
n--;
... | D |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.