Source
stringclasses
1 value
Date
int64
2.01k
2.02k
Text
stringlengths
22
783k
Token_count
int64
20
394k
Project_CodeNet
2,020
N,K=gets.split.map(&:to_i) p (K+1..N).reduce(0){|s,b|s+N/b*(b-K)+[N%b-K+1,0].max-(K==0? 1:0)}
54
Project_CodeNet
2,018
N, K = gets.split.map(&:to_i) if K == 0 puts N*N exit end ans = 0 (2..N).each do |b| next if b <= K ans += N/b * (b-K) + [N%b - K + 1, 0].max end puts ans
79
Project_CodeNet
2,018
N, K = gets.split.map(&:to_i) ans = 0 if K > 0 ((K + 1)..N).each do |b| q, r = N.divmod(b) ans += (b - K) * q ans += [r - K + 1, 0].max end else ans = N * N end puts ans
90
Project_CodeNet
2,020
n, k = gets.to_s.split.map{|t|t.to_i} if k == 0 puts n * n exit end ans = 0 (k+1).upto(n) do |b| set = (n-k+1) / b rem = (n-k+1) % b cnt = (b-k) * set + [rem, (b-k)].min # p [b, set, rem, cnt] ans += cnt end puts ans
114
Project_CodeNet
2,020
n, k = gets.split.map(&:to_i) if k == 0 puts n ** 2 else ans = 0 (k + 1).upto(n) do |b| x, y = n.divmod(b) ans += x * (b - k) ans += (y >= k ? y - k + 1 : 0) end puts ans end
94
Project_CodeNet
2,019
n,k=gets.split.map(&:to_i) sum=0;((k+1)..n).each{|b| sum+=((n/b)*(b-k)+[n%b-k+1,0].max-(k==0 ? 1 : 0))};p sum
59
Project_CodeNet
2,020
N, K = gets.split.map(&:to_i) def max(a,b); a > b ? a : b; end def count_mod_ge_K(b) r,m = N.divmod(b) c = r * (b - K) + max(m + 1 - K, 0) K.zero? ? c - 1 : c end puts (K + 1 .. N).map{|b| count_mod_ge_K(b) }.sum
100
Project_CodeNet
2,018
n,k=gets.split.map(&:to_i) ans=n*n (1..n).each do |m| # p [m, '=', (n/m)*[k,m].min, [k-1, n%m].min] ans -= (n/m)*[k,m].min + [0,[k-1, n%m].min].max end p ans
83
Project_CodeNet
2,018
n,k=gets.split.map &:to_i s=0 for i in 1..n-k b=(k+i).to_f s+=i*(((n-k+1)/b).ceil-1)+[(n-k)%b+1,i].min end s-=n if k==0 p s.to_i
72
Project_CodeNet
2,020
n, k = gets.chomp.split(' ').map(&:to_i) count = 0 (1..n).each do |i| next if i <= k count += (i - k) * (n / i) if k != 0 count += (n % i) - k + 1 if (n % i) - k + 1 >= 0 else count += (n % i) - k if (n % i) - k >= 0 end end puts count
117
Project_CodeNet
2,018
N,K = gets.split.map(&:to_i) p (K+1..N).reduce(0){|s,b| s + N/b*(b-K) + [N%b - K + 1, 0].max - (K == 0 ? 1 : 0) }
63
Project_CodeNet
2,018
eval"N,K="+gets.split*?,;s=0;(K+1..N).map{|b|s+=N/b*(b-K)+[N%b-K+-2[K],0].max};p s
46
Project_CodeNet
2,018
using System; using System.Linq; using System.Diagnostics; using System.Collections.Generic; class P { static void Main() { int[] nk = Console.ReadLine().Split().Select(int.Parse).ToArray(); Console.WriteLine(Solve(nk)); /*for (int i = 1; i < 100; i++) { for (int j = ...
426
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ARC091B { class Program { static void Main(string[] args) { long[] input = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray(); long N = input...
190
Project_CodeNet
2,018
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; public static class TemplateExtension { public static X[] MakeAr...
1,035
Project_CodeNet
2,019
namespace AtCoder.ARC.D091 { using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.IO; using AtCoder.ARC.IO; public class Quest { public object Solve(Parser parser) { int n = parser.Integer(); int ...
1,124
Project_CodeNet
2,018
using System; using System.Linq; namespace arc091_b { class Program { static void Main(string[] args) { int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); long ret = 0; for (int i = x[1] + 1; i <= x[0]; i++) { int a ...
192
Project_CodeNet
2,018
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ if(K == 0){ Console.WriteLine(N * N); return; } long tot = N * N; long ...
372
Project_CodeNet
2,020
using System; using System.Collections.Generic; using System.IO; using System.Linq; class Program { static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } static...
1,158
Project_CodeNet
2,020
using System; using System.Linq; using System.Collections.Generic; namespace Contest { class Program { static void Main(string[] args) { ARC091.D(); } class ARC091 { public static void C() { Console.WriteLine(Math.Abs((...
1,060
Project_CodeNet
2,018
using System; class Program{ static void Main(){ int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse); long ans=0; for(int i=s[1]+1;i<=s[0];i++){ ans+=(s[0]-i+1)/i*(i-s[1])+((s[0]-i+1)%i>s[1]?((s[0]-i+1)%i-s[1]):0)+i-s[1]; } ans-=s[1]==0?s[0]:0; Console.WriteLine("{0}",ans); } }
130
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Linq; using System.IO; //using System.Text; //using System.Text.RegularExpressions; //using System.Globalization; //using System.Diagnostics; using static System.Console; //using System.Numerics; //using static System.Math; //using pair = Pair<int, int>; cla...
545
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.IO; using System.Text; using System.Diagnostics; using static util; using P = pair<int, int>; using Binary = System.Func<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.ParameterExpressi...
3,997
Project_CodeNet
2,020
using System; using System.Linq; using System.Collections.Generic; using static System.Console; using System.Text; using System.IO; using static System.Math; namespace AtCoder { class Program { static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); } static publi...
416
Project_CodeNet
2,020
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; namespace AtCorder { public class Program { static void Main(string[] args) { var cin = new Scanner2(); int n = cin.Int(); int k = cin.Int(); if (k == 0) { Console.Write...
1,324
Project_CodeNet
2,020
using System; using System.Collections.Generic; using System.IO; using System.Linq; using static System.Math; using System.Text; using System.Threading; using System.Globalization; using System.Runtime.CompilerServices; using Library; namespace Program { public static class ProblemD { static bool SAIKI...
1,592
Project_CodeNet
2,018
using System; using System.Text; using System.Collections.Generic; using System.Linq; class Solve{ public Solve(){} StringBuilder sb; ReadData re; public static int Main(){ new Solve().Run(); return 0; } void Run(){ sb = new StringBuilder(); re = new ReadData(); ...
1,396
Project_CodeNet
2,020
using System; using System.Collections.Generic; using System.IO; using System.Linq; using static Asakatsu20200324D.Input; namespace Asakatsu20200324D { static class Input { private static Func<string, T[]> Cast<T>() => _ => _.Split(' ').Select(Convert<T>()).ToArray(); private static Func<strin...
1,442
Project_CodeNet
2,020
using System; using System.Collections.Generic; using System.Linq; using System.Text; // using System.Numerics; using System.Runtime.CompilerServices; using System.Diagnostics; using ll=System.Int64; using static Contest_D.Lib_IO; using static Contest_D.Lib_Minifunc; public static class Contest_D { public static ...
2,463
Project_CodeNet
2,020
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Kujikatsu064.Algorithms; using Kujikatsu064.Collections; using Kujikatsu064.Extensions; using Kujikatsu064.Numerics; using Kujikatsu06...
22,612
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ARC091D { class Program { static void Main(string[] args) { var line = Console.ReadLine().Split().Select(int.Parse).ToArray(); int N = line[0]; ...
212
Project_CodeNet
2,020
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.IO; using static System.Console; using static System.Math; public class Solve{ static public int mod = 1000000007; static public string al = "abcdefghijklmnopqrstuvwxyz"; public static void Main(){ ...
1,084
Project_CodeNet
2,019
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using static System.Math; using static System.Array; namespace AtCoder { class AC { const int mod = 1000000007; const int INF = int.MaxValue / 2; const long SINF = long.MaxValue / 2; ...
528
Project_CodeNet
2,019
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { var sc = new Scanner(); int n = sc.NextInt(); int k = sc.NextInt(); long res = 0; for (int i = 1; i <= n;...
343
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Contest { class Scanner { private string[] line = new string[0]; private int index = 0; public string Next() { if (line.Length <= index) { line...
480
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CompetitiveProgCsLib { class MainProg { static string R => Console.ReadLine(); static int RI => int.Parse(R); static double RD => double.Parse(R); static int[] RIs => R.Split(' ').Sel...
290
Project_CodeNet
2,020
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Diagnostics; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Numerics; using System.IO; using System.Runtime.InteropServices; using static System.Math; using stat...
1,092
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace D { class Program { static long N, K; static void Main(string[] args) { var temp = ReadLinesToIntListList(1); N = temp[0][0]; ...
328
Project_CodeNet
2,018
using System; using System.IO; using System.Collections.Generic; namespace ARC091 { public class Program { void Solve(StreamScanner ss, StreamWriter sw) { //--------------------------------- var N = ss.Next(Long); var K = ss.Next(Long); if (K == ...
517
Project_CodeNet
2,019
using System; using System.Collections.Generic; using System.Linq; using static Input; public class Prog { private const int INF = 1000000007; private const long INFINITY = 9223372036854775807; private struct Pair { public int x, y; public Pair(int xx, int yy) { x = xx; y = yy; } } private static int[]...
470
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.IO; namespace AtCoder { class Program { private static string Read() { return Console.ReadLine(); } private static int ReadInt() { return int.Parse(Read()); } pri...
310
Project_CodeNet
2,019
using System; using System.Collections.Generic; using System.Linq; using static System.Console; using static System.Convert; using static System.Math; //using static System.Globalization.CultureInfo; class Program { static void Main(string[] args) { var nk = Input.ar; if (nk[1] == 0) { ...
339
Project_CodeNet
2,018
using System.Linq; using static System.Console; class K { static void Main() { var I = ReadLine().Split().Select(long.Parse).ToArray(); long N = I[0], K = I[1], sum = 0L; for (var b = K + 1; b <= N; b++) { var q = N % b; sum += (b - K) * (N / b); if (K <= q) sum += q - K + 1; if (K == 0) sum--; ...
133
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using static System.Console; using static System.Math; //using CS_Contest.Graph; using CS_Contest.Loop; using CS_Contest.Utils; using static Nakov.IO.Cin; using static CS_Contest.IO.IO; using static CS_Contest...
1,763
Project_CodeNet
2,018
using System; using System.Linq;//リストの使用 using System.Collections.Generic; class Program { static void Main() { string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。 long n = long.Parse(input[0]); long k = long.Parse(input[1]); long answer = 0; for(long i = 1; i <= n; i++) { ...
175
Project_CodeNet
2,019
using System; using System.Collections.Generic; using System.Linq; using BitArray = System.Collections.BitArray; using BigInteger = System.Numerics.BigInteger; using TextReader = System.IO.TextReader; using System.Text; namespace AtCoderProject { public class Program { public object Calc() { ...
704
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Linq; namespace Competitive { internal class Solution { private int N, K; public void Run() { int[] ary = Input.ReadIntArray(); N = ary[0]; K = ary[1]; long ret = 0; ...
243
Project_CodeNet
2,020
using System; using System.Collections.Generic; using System.Linq; using System.Text; public class AtCoderA { static void Main() { var sc = new Scanner(); long n = sc.NextLong(); long k = sc.NextInt(); long answer = 0; if (k == 0) { Console.WriteLi...
421