akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	bool b[4]={};
	rep(i, 4){
		int N;
		cin>>N;
		if(N == 1) b[0]= true;
		if(N == 9) b[1]= true;
		if(N == 7) b[2]= true;
		if(N == 4) b[3]= true;
	}
	rep(i, 4){
		if(!b[i]){
			cout<<"NO"<<endl;
			return 0;
		}
	}
			cout<<"YES"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>

using namespace std;

const int MOD = 998244353;

bitset <101> takeOnly[101];
bitset <101> substr(const bitset <101> &b, const int l, const int r) {
    return ((b & takeOnly[r + 1]) >> l);
}

typedef __gnu_pbds::gp_hash_table<bitset <101>, int, hash <bitset <101> > > UnorderedMap;

UnorderedMap memo;

static int solve(const int N, bitset <101> str) {
    str[N] = 1;
    const auto it = memo.find(str);
    if (it != memo.end())
        return it -> second;

    // Do nothing
    int ans = 1;
    for (int i = 0; i < N; ++ i)
        if (str[i] == 1)
            ans = (2LL * ans) % MOD;

    // Split in 2 halves
    for (int r = 1; r < N; ++ r) {
        int pow2 = 1;
        const int aux = solve(N - r - 1, substr(str, r + 1, N - 1));
        for (int l = 0; l < r; ++ l) {
            for (int per = 1; per < r - l + 1; ++ per) if ((r - l + 1) % per == 0) {
                // Try splitting in groups of length per
                bitset <101> acc = substr(str, l, l + per - 1);
                for (int x = l + per; x <= r; x += per)
                    acc &= substr(str, x, x + per - 1);
                ans = (ans + (1LL * pow2 * solve(per, acc)) % MOD * aux) % MOD;
            }
            if (str[l] == 1)
                pow2 = (2LL * pow2) % MOD;
        }
    }

    memo[str] = ans;
    return ans;
}

int main()
{
    for (int i = 0; i < 101; ++ i)
        for (int j = 0; j < i; ++ j)
            takeOnly[i][j] = 1;

    string s;
    cin >> s;

    /* Stress
    for (int i = 0; i < 100; ++ i)
        if (rand() & 1)
            s += '0';
        else
            s += '1';*/

    bitset <101> str;
    for (int i = 0; i < s.size(); ++ i)
        if (s[i] == '1')
            str[i] = 1;
    cout << solve(s.size(), str) << '\n';
    return 0;
}


Measured memory_bytes: 6512
/** Micro Mezz Macro Flation -- Overheated Economy ., Last Update: Nov. 7th 2014 **/ //{

/** Header .. **/ //{
#pragma comment(linker, "/STACK:36777216")
//#pragma GCC optimize ("O2")
#define LOCAL
//#include "testlib.h"
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <climits>
#include <cassert>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>

//#include <tr1/unordered_set>
//#include <tr1/unordered_map>
//#include <array>

using namespace std;

#define REP(i, n) for (int i=0;i<n;++i)
#define REP_1(i, n) for (int i=1;i<=n;++i)

#define REP_2_1(i, j, n, m) REP_1(i, n) REP_1(j, m)

const int N = int(1e3) + 9;

int main(){

#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif

    REP_2_1(i, j, 9, 9){
        printf("%dx%d=%d\n", i, j, i*j);
    }


}

Measured memory_bytes: 1108
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
--import Data.Array.Unboxed
import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
dictCompare :: [a -> a -> Ordering] -> a -> a -> Ordering
dictCompare [] _ _ = EQ
dictCompare (f:fs) x y = let c = f x y in if c==EQ then dictCompare fs x y else c
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
count :: (a -> Bool) -> [a] -> Int
count = (length .) . filter
-- end of templete



f :: IOArray Int (Maybe Int) -> (Int,(Int,Int)) -> [(Int,(Int,Int))] -> IO Int
f memo (i,(h,r)) xs = do
    c <- readArray memo i
    when (isNothing c) $ do
        lt <- sequence [f memo (j,(h',r')) xs | (j,(h',r')) <- xs, h'<h, r'<r]
        let res = 1 + foldr max 0 lt
        writeArray memo i $ Just res
    fromJust <$> readArray memo i


main = do
    n <- getInt
    when (n/=0) $ do
        a <- zipWith (\i [h,r] -> (i,(h,r))) [1..] <$> replicateM n getInts
        m <- getInt
        b <- zipWith (\i [h,r] -> (i,(h,r))) [n+1..] <$> replicateM m getInts
        arr <- newArray (1,n+m) Nothing
        let xs = a ++ b
        sequence [f arr x xs | x <- xs] >>= print . maximum
        main



Measured memory_bytes: 5404
#include <iostream>
#include <vector>
#include <queue>

#define NMAX 100000
#define MOD 1000000007
#define INF 2000000000

#define MIN(a, b) (a < b ? a : b)

using namespace std;

struct Node {
	int node;
	int level;
};

int n, m;
int s, t;
vector<int> graph[3 * NMAX];
queue<Node> Q;
bool vis[3 * NMAX];

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;

		graph[a].push_back(b + n);
		graph[a + n].push_back(b + 2 * n);
		graph[a + 2 * n].push_back(b);
	}
	cin >> s >> t;
	s--;
	t--;

	Node start = { s, 0 };
	Q.push(start);
	int minPath = INF;
	while (!Q.empty())
	{
		Node node = Q.front();
		if (node.node == t && node.level < minPath && node.level % 3 == 0)
			minPath = node.level;
		Q.pop();
		for (int i = 0; i < graph[node.node].size() && !vis[node.node]; i++)
		{
			Node other = { graph[node.node][i], node.level + 1 };
			Q.push(other);
		}
		vis[node.node] = 1;
	}
	cout << (minPath != INF ? minPath / 3 : -1) << '\n';
	return 0;
}

Measured memory_bytes: 16896
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,L;
  cin >> N >> L;
  vector<int> a(N);
  int sum=0;
  for(int i=0;i<N;i++){
    a[i]=L+i;
    sum+=a[i];
  }
  sort(a.begin(),a.end());
  if(a[N-1]<=0)sum-=a[N-1];
  else if(a[0]<0) ;
  else sum-=a[0];
  cout << sum;
}



Measured memory_bytes: 256
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]

T.sort()
s = -(10**10)
cnt = 0
res = 0
for t in T:
    if s+K < t:
        res += 1
        s = t
        cnt = 0
    if cnt == C:
        res += 1
        s = t
        cnt = 0
    cnt += 1

print(res)

Measured memory_bytes: 13312
#main program
S=input()
n=len(S)

ans=0

for bit in range(1 << (n-1)):
    f=S[0]

    for i in range(0,n-1):
        if bit & (1 << i):
            f=f+"+"
        f=f+S[i+1]
    
    ans=ans+sum(map(int,f.split("+")))

print(ans)

Measured memory_bytes: 3060
s = list(input())
nums = 0
diff = 1000
l = len(s)
for i in range(l):
    if (i + 2 >= l):
        break
    n = int("".join(s[i:i+3]))
    d = abs(753 - n)
    if (d < diff):
        nums = n
        diff = d
print(diff)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	long long x, y;
	cin >> x >> y;
	if (x*(y - 1) % y == 0)cout << "-1" << endl;
	else cout << x * (y - 1) << endl;
	int z;
	cin >> z;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int a_1, a_2, a_3;
  cin >> a_1 >> a_2 >> a_3;
  int maximum = max(a_1, max(a_2, a_3));
  int minimum = min(a_1, min(a_2, a_3));
  cout << maximum - minimum << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, t;

int main() {
    cin >> n >> t;

    cout << max(0, n-t) << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

void solve() {
  vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << a[K - 1] << endl;

}

signed main() {
  solve();

  return 0;
}

Measured memory_bytes: 256
import math

q=[x for x in range(3,2**16) if x%2==1 ]
t=math.sqrt(2**31-1)
p=[2]

while(1):
    pp=q.pop(0)
    if pp>t: break
    p.append(pp)
    q=[x for x in q  if x%pp!=0]
p=p+q

N=int(raw_input())
ans=0
for i in range(N):
    X=int(raw_input())*2+1
    for pp in p:
        if pp>math.sqrt(X):
            ans+=1
            break
        if X%pp==0:
            break
print ans

Measured memory_bytes: 8812
#include<iostream>
#include<stdio.h>

using namespace std;

int main(){
	int c1,c5,c10,c50,c100,c500;
	cin>> c1>> c5>> c10>> c50>> c100>> c500;
	if(c1+c5*5+c10*10+c50*50+c100*100+c500*500<1000){
		cout<< "0"<<endl;
	}
	else{
		cout<< "1"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
count = 0
def prime(n):
    if n < 2:
        return 0
    elif n == 2:
        return 1
    elif n % 2 == 0:
        return 0

    for i in range(3,int(n**(1/2))+1,2):
        if n % i == 0:
            return 0
    return 1

n = int(input())
for i in range(n):
    a = int(input())
    count += prime(a)

print(count)



Measured memory_bytes: 5660
#include <bits/stdc++.h>
//#include <map>
//#include <set>
//#include <list>
//#include <cmath>
//#include <ctime>
//#include <deque>
//#include <queue>
//#include <stack>
//#include <string>
//#include <bitset>
//#include <cstdio>
//#include <limits>
//#include <vector>
//#include <climits>
//#include <cstring>
//#include <cstdlib>
//#include <fstream>
//#include <numeric>
//#include <sstream>
//#include <iomanip>
//#include <iostream>
//#include <algorithm>
//#include <unordered_map>

using namespace std;

#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.141592653589793238462643383279502884
#define MAX 1000100
#define mod 1000000007
#define EPS 1E-9
#define int long long
#define endl "\n"

int fix(int cur, int m)
{
    return ((cur%m) + m) % m;
}

int fast_power(int x, int y,int m)
{
    if (y == 0)
        return 1;
    int temp = fast_power(x, y / 2, m) ;
    temp = (temp*temp)% m;
    if (y % 2 != 0)
        temp = (temp*x)% m;
    return temp;

}
bool check(string str)
{
    set<char>st;
    for(int i=0;i<str.size();i++)
    {
        st.insert(str[i]);
    }
    return (st.size()!=3);
}

int32_t main()
{
    //freopen("C:/Users/Joe/Desktop/tests/in11.txt", "r", stdin);
    //freopen("C:/Users/Joe/Desktop/tests/out11.txt", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.tie(0);

    int t=1;
    //cin >> t;
    while(t--)
    {
        string str;
        cin >> str;
        int s=-1,e=-1;
        if(str.size()==2)
        {
            if(str[0]==str[1])
                cout << 1 << " " << 2 << endl;
            else
                cout << -1 << " " << -1 << endl;
            return 0;
        }
        for(int i=0;i<str.size()-2;i++)
        {
            if(str[i]==str[i+2])
            {
                s=i,e=i+2;
                break;
            }
            else if(str[i]==str[i+1])
            {
                s=i,e=i+1;
                break;
            }
        }
        if(s==-1 && e==-1)
            return cout << -1 << " " << -1 << endl,0;
        cout << s+1 << " " << e+1 << endl;



    }
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int N = Integer.parseInt(scan.next());
	int M = Integer.parseInt(scan.next());

	String[] A = new String[N];
	for (int i = 0; i < N; i++) {
	    A[i] = scan.next();
	}
	
	String[] B = new String[M];
	for (int i = 0; i < M; i++) {
	    B[i] = scan.next();
	}

	boolean ans = false;
	for (int i = 0; i+M-1 < N; i++) {
	    for (int j = 0; j+M-1 < N; j++) {
		if(A[i].startsWith(B[0], j)) {
		    for (int k = 0; k < M; k++) {
			ans = A[i+k].startsWith(B[k], j);
			if(!ans) break;
		    }
		    if(ans) break;
		}
	    }
	    if(ans) break;
	}
	
	System.out.println(ans ? "Yes" : "No");
	scan.close();
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll ret = 0;
vector<ll> h;
vector<ll> flg;

void input() {
  IN(N);
  ll tmp;
  h.push_back(0);
  flg.push_back(0);
  REP(i, N) {
    IN(tmp);
    h.push_back(tmp);
    flg.push_back(0);
  }
  h.push_back(INF);
  flg.push_back(0);
}

void solve() {
  bool ans = true;
  ll p = 1;
  while(p != N+1) {
    ll a = h[p];
    ll b = h[p+1];
    if (a > b)  {
      if (flg[p] == 1 || a-b>=2) {
        ans = false;
        break;
      } else {
        flg[p] = 1;
        h[p] -= 1;
        p -= 2;
      }
    }
    p++;
  }

   if (ans) {
     PRINT("Yes");
   } else {
     PRINT("No");
   }
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;

int calc(int a, int b, int c) {
  return a * a + b * b + c * c + a * b + b * c + c * a;
}

int main() {

  int n;
  cin >> n;
  vector<ll> cnt(n + 1, 0);
  for(int i = 1; i * i <= n; i++) {
    for(int j = 1; j * j <= n; j++) {
      for(int k = 1; k * k <= n; k++) {
        int lol = calc(i, j, k);
        if(lol <= n) {
          cnt[lol]++;
        }
      }
    }
  }
  for(int i = 1; i <= n; i++) {
    cout << cnt[i] << '\n';
  }
  
  return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <iomanip>
#include <cassert>

#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

#define rep_init(i, init, n) for(int i = (init); i < (n); ++i)
#define rep(i, n) rep_init(i, 0, n)


void Main()
{
	int N;
	cin >> N;

	int e = static_cast<int>(floor(sqrt(N)));
	cout << e * e << endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);

	Main();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    int n = 0;
    cin >> n;

    if (n == 1)
    {
        cout << "Hello World" << endl;
    }
    else
    {
        int a = 0, b = 0;
        cin >> a >> b;
        cout << (a + b) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int K;
	cin >> K;
	string S;
	cin >> S;

	if (S.size() <= K){
		cout << S << "\n";
	} else {
		for (int ii = 0; ii < K; ++ii){
			cout << S[ii];
		}
		cout << "...";
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int n;
double total=0, arr[3000], rra[3000], dp[3000][3000];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> arr[i];
		rra[i]=1-arr[i];
	}
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			if(j==0){
				dp[i][j]=rra[i]*dp[i-1][j];
			}
			else{
				dp[i][j]=rra[i]*dp[i-1][j]+arr[i]*dp[i-1][j-1];
			}
		}
	}
	for(int i=n/2+1;i<=n;i++){
		total+=dp[n][i];
	}
	cout << fixed << setprecision(10) << total << '\n';
}

Measured memory_bytes: 68992
#include <bits/stdc++.h>
#define debug(args...) //fprintf(stderr, args);
using namespace std;

int main() {
    int n;
    int sum = 0, sum2 = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        int val;
        scanf("%d", &val);
        sum += val;
        sum2 += val * val;
    }
    int best = INT_MAX;
    for (int i = -100; i <= 100; i++) {
        best = min(best, sum2 - 2 * i * sum + i*i*n);
    }
    printf("%d\n", best);
    return 0;
}

Measured memory_bytes: 256
while True:
    x, y = map(int, input().split())
    if x == 0 and y == 0:
        break
    else:
        for i in range(x):
            if i % 2 == 0:
                for j in range(y):
                    if j % 2 == 0:
                        print("#", end="")
                    else:
                        print(".", end="")
            else:
                for j in range(y):
                    if j % 2 == 0:
                        print(".", end="")
                    else:
                        print("#", end="")
            print()
        print()


Measured memory_bytes: 7000
#include <bits/stdc++.h>
     
using namespace std;

int arr[100001];
int a[100001];
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;

	cin >> n;

	for(int i=1;i<=n;i++)
	{
		cin >> a[i];
	}

	memset(arr,-1,sizeof(arr));

	arr[1] = 0;

	int num = 1;

	while(1)
	{
		if(num==2)
		{
			break;
		}
		int x = a[num];
		if(arr[x]!=-1)
		{
			break;
		}
		arr[x] = arr[num] + 1;
		num = x;
	}

	cout << arr[2] << '\n';

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define sz(a) (ll)(a.size())
#define pll pair<ll,ll>
vector<ll> ad[100005];
ll visited[100005];
ll dp[100005];
ll dfs(ll x)
{
	visited[x] = 1;
	ll i;
	ll max1 = 0;
	for(i=0;i<sz(ad[x]);i++)
	{
		if(!visited[ad[x][i]])
			dfs(ad[x][i]);
		max1 = max(max1,dp[ad[x][i]]);
	}
	if(sz(ad[x])>0)
		dp[x] = 1+max1;
	else 
		dp[x] = max1;
	return dp[x];
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll i,j,n,m,u,v;
	cin>>n>>m;
	for(i=0;i<m;i++)
	{
		cin>>u>>v;
		ad[u].pb(v);
	}
	for(i=1;i<=n;i++)
	{
		if(!visited[i])
			dfs(i);
	}
	cout<<*max_element(dp,dp+n+1)<<endl;
	return 0;
}

Measured memory_bytes: 9344
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;



signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int A,B; cin >> A >> B;
    cout << (A*3+B)/2 << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
    int n; cin >> n;
    priority_queue<double, vector<double>, greater<double>> pq;
    REP(i, n) {
        int v; cin >> v;
        pq.push(v);
    }

    while(pq.size() != 1) {
        double v1 = pq.top(); pq.pop();
        double v2 = pq.top(); pq.pop();

        pq.push((v1 + v2) / 2);
    }

    cout << fixed << setprecision(10) << pq.top() << endl;

    return 0;
}


Measured memory_bytes: 256
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int n,c,a[N];
int f(int num){
  int cnt=1,l=a[1];
  rep(i,2,n){
    if(a[i]-l>=num)l=a[i],cnt++;
  }
  return cnt;
}
void solve(){
  char x;cin>>x;
  if(x<='Z' and x>='A')cout<<"A";
  else cout<<"a";
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <set>
#include <map>
#include <stack>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repl(i, n) for(LL i = 0; i < (LL)(n); i++)

int main(void){
  int sx, sy, tx, ty;

  cin >> sx >> sy >> tx >> ty;

  int dx = tx - sx;
  int dy = ty - sy;

  // Path 1
  cout << string(dy, 'U') << string(dx, 'R');
  // Path 2
  cout << string(dy, 'D') << string(dx, 'L');
  // Path 3
  cout << 'L' << string(dy+1, 'U') << string(dx+1, 'R') << 'D';
  // Path 4
  cout << 'R' << string(dy+1, 'D') << string(dx+1, 'L') << 'U' << endl;

  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

memo = defaultdict(int)
result = 0
for a in A:
    memo[a]+=1
    result += a

for _ in range(Q):
    bc = list(map(int, input().split()))
    b = bc[0]
    c = bc[1]
    tmp = memo[b]
    memo[c] += tmp
    memo[b] = 0
    result = result + c*tmp - b*tmp
    print(result)


Measured memory_bytes: 24008
#include <stdio.h>
int main(void){
	int h,m1,m2,m3,w;
	m1=0;
	m2=0;
	m3=0;
	for(int i=0;i<10;i++){
		scanf("%d",&h);
		if(m3<h){
			m3=h;
			if(m2<m3){
				w=m2;
				m2=m3;
				m3=w;
				if(m1<m2){
					w=m1;
					m1=m2;
					m2=w;
				}
			}
		}
	}
	printf("%d\n%d\n%d\n",m1,m2,m3);
	return 0;
}


Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
const int N = 100 + 5;
int n,b[N],ans[N];
int main()
{
	cin>>n;
	for (int i = 1;i <= n; ++i)
		cin>>b[i];
	int i = n;
	for (;i;--i)
	{
		bool flag = 0;
		for (int j = i;j;--j)
			if (b[j] == j)
				{
					ans[i] = j;
					for (int k = j + 1;k <= i;++k)
						b[k - 1] = b[k];
					flag = 1;
					break;
				}
		if (!flag) break;
	}
	if (i)
		printf("-1");
	else 
		for (int j = 1;j <= n; ++j)
			printf("%d\n",ans[j]);
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

	lli a,b;
	cin>>a>>b;

	string aa,bb;
	REP(i,0,b)aa+=(char)('0'+a);
	REP(i,0,a)bb+=(char)('0'+b);

	cout<<min(aa,bb)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    vector<int> A(N);
    rep(n,0,N) cin>>A.at(n);

    int color=8,top=0;

    set<int> setC;
    for(auto a:A){
        if(a>=3200) top++;
        rep(i,0,color){
            if(a>=i*400 && a<(i+1)*400){
                setC.insert(i);
                break;
            }
        }
    }

    int minAns=max(1,(int)setC.size());
    int maxAns=setC.size()+top;
    cout<<minAns<<" "<<maxAns<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
 
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;
    set<int> hv;
    vector<int> a(n);
    for (auto &t : a) {
        cin >> t;
    }
    for (int i = 0; i < k; i++) {
        hv.insert(a[i]);
    }
    int ans = 1;
    vector<int> pr;
    for (int i = 0; i + 1 < n; i++) {
        pr.push_back(a[i] > a[i + 1]);
    }
    int cur = 0;
    for (int i = 0; i + 1 < k; i++) {
        cur += pr[i];
    }
    vector<int> bl = {cur == 0};
    for (int i = 0; i + k < n; i++) {
        ans++;
        if (*(hv.begin()) == a[i] && *(hv.rbegin()) < a[i + k]) {
            ans--;
        }
        cur -= pr[i];
        cur += pr[i + k - 1];
        hv.erase(a[i]);
        hv.insert(a[i + k]);
        bl.push_back(cur == 0);
    }
    int cnt = 0;
    for (int i = 0; i < (int)bl.size(); i++) {
        if (bl[i]) {
            int r = i;
            while (r + 1 < (int)bl.size() && bl[r + 1] == 1) {
                r++;
            }
            cnt++;
            i = r;
        }
    }
    cout << ans - max(0, cnt - 1) << endl;
}

Measured memory_bytes: 11640
#include<stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define MAX 100000
#define INFTY 1000000000
int M[100][100],d[100], Q[MAX];
int tt, n, tail=0, head=0;

int isEmpty() {
    return (head==tail);
}

int isFull() {
    return (head==(tail + 1) % MAX);
}

void enqueue(x) {
   Q[tail]=x;
   tail=(tail+1)%MAX;
}

int dequeue() {
   int x;
   head=(head+1)%MAX;
  return x;
}

void dfs(int s) {
  int i, v;
  enqueue(s);
  for(i=0; i<n; i++)
    d[i]=INFTY;
  d[s]=0;
  int u;
  while (! isEmpty()) {
    u=Q[head]; dequeue();
    for (v=0; v<n; v++) {
      if (M[u][v]==0) continue;
      if (d[v]!=INFTY) continue;
      d[v]=d[u]+1;
      enqueue(v);
    }
  }
  for (i=0; i<n; i++) {
    printf("%d %d\n", i+1, ((d[i]==INFTY)?(-1):d[i]));
  }
}

int main() {

  int  u, k, i, j, v;

  scanf("%d", &n);

  for (i=0; i<n; i++)
    for (j=0; j<n; j++)
      M[i][j]=0;

  for (i=0; i<n; i++) {
    scanf("%d %d", &u, &k);
    u=u-1;
    for (j=0; j<k; j++) {
      scanf("%d", &v);
      v=v-1;
      M[u][v]=1;
    }
  }

  dfs(0);

  return 0;

}

Measured memory_bytes: 632
#include <algorithm> // sort ?????????
#include <string> // string (?????????) ?????????
#include<iostream>
using namespace std;
int N[256] = { 0 },a,b;
bool ok() {
	if (N[1] % 2 == 0)return false;
	if (N[2] % 2 == 0)return false;
	for (int i = 3; i < 256; i++) {
		if (N[i] % 2 == 1)return false;
	}
	return true;
}
int main() {
	while (cin >> a >> b) {
		N[a] += 1;
		N[b] += 1;
		if (a == 0 && b == 0) {
			if (ok())cout << "OK" << endl;
			else cout << "NG" << endl;
			for (int i = 0; i < 256; i++)N[i] = 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3068
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;

    static void Main(string[] args)
    {
        Solve();
    }

    //static long GCD(long x,long y)
    //{
    //    if (y == 0) return x;
    //    return GCD(y, x % y);
    //}

    //static long LCM(long x,long y)
    //{
    //    return x * y / GCD(x, y);
    //}

    //static int keta(int x)
    //{
    //    string s = x.ToString();
    //    return s[s.Length - 1]-'0';
    //}

    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();


        long ans = INF;
        var x = sc.longarr;
        int D = (int)x[0];
        long G = x[1];
        long[] p = new long[D];
        long[] c = new long[D];

        for(int i = 0; i < D; ++i)
        {
            var y = sc.longarr;
            p[i] = y[0];
            c[i] = y[1];
        }

        for (int i = 0; i < (1 << D); ++ i)
        {
            long sum = 0;
            long num = 0;

            for (int j = 0; j < D; ++j)
            {
                if (((i>>j)&1) == 1)
                {
                    sum += c[j] + p[j] * 100 * (j + 1);
                    num += p[j];
                }
                
            }
            if (sum >= G) ans = Math.Min(ans, num);
            else
            {
                for(int j = D - 1; j >= 0; --j)
                {
                    if (((i>>j)&1) == 1) continue;

                    for(int k = 0; k < p[j]; ++k)
                    {
                        if (sum >= G) break;

                        sum += 100 * (j + 1);
                        ++num;
                    }
                }
                ans = Math.Min(ans, num);
            }
        }
        wr.wri(ans);
        
    }


}
    




class Scan
{
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
    public char[] chararr => str.ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13396
#include <cstdio>

int n, k, x;

int main(){
    scanf("%d %d", &n, &k);

    int ans = 0;
    for(int i = 0; i < n; i++){
        scanf("%d", &x);

        if(k - x > x) ans += x * 2;
        else ans += (k - x) * 2;
    }

    printf("%d\n", ans);


    return 0;
}


Measured memory_bytes: 128
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int N, L;cin >> N >> L;
    VS V(N);
    REP(i, N) cin >> V.at(i);

    SORT(V);
    string ans;
    for (auto s : V)
    {
        cout << s;
    }
    cout << endl;

    
  
    return 0;
}



Measured memory_bytes: 256
using System;

namespace AtCoder.ABC._124
{
    class b
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            var N = int.Parse(line);
            var H = Array.ConvertAll<string, int>(Console.ReadLine().Trim().Split(' '), int.Parse);
            var cnt = 0;
            var max = 0;
            foreach(var h in H)
            {
                if(h >= max)
                {
                    ++cnt;
                    max = h;
                }
            }
            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
#define INF (1LL<<60)
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}
/*絶対値*/
ll ABS(ll a){return a>=0?a:(-a);}
typedef struct{
    ll aa;
    ll bb;
}frequent;
// 小大
int compare(const void *a, const void *b){return *(ll *)b - *(ll *)a;}

int main(void){
    ll n,i,ans=0;
    scanf("%lld",&n);
    ll a[n],count[100000];
    for(i=0;i<100000;i++){
        count[i]=0;
    }
    for(i=0;i<n;i++){
        scanf("%lld",&a[i]);
        if(a[i]>100000){
            ans++;
        }else{
            count[a[i]-1]++;
        }
    }
    for(i=0;i<100000;i++){
        if(count[i]<i+1){
            ans+=count[i];
        }else{
            ans+=count[i]-i-1;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1664
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (ll i = begin; i < (ll)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    char a;
    cin >> a;
    if (a < 'a')
    {
        cout << 'A' << endl;
    }
    else
    {
        cout << 'a' << endl;
    }
}

Measured memory_bytes: 3632
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<unordered_map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<memory>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a)   a.begin(),a.end()
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
    //
    ModInt operator++(int) {
        auto t = *this;
        *this += 1;
        return t;
    }

    ModInt operator--(int) {
        auto t = *this;
        *this -= 1;
        return t;
    }
    ModInt operator<<(const int n){
        return ModInt(*this)*ModInt(2).pow(n);
    }
    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

void d(){
    ll N,K; cin >> N >> K;
    ll sum = 0;
    if(K==0){
        cout << N*N <<endl;
        return;
    }
    for(ll b=1;b<=N;b++){
        ll p = N/b;
        sum+=max(b-K,0LL)*p+max(N%b-K+1,0LL);
    }
    cout << sum << endl;
}


int main(){
    d();
}


Measured memory_bytes: 3596
#include <iostream>

int main(int argc, char **argv)
{
    long a, b, x;
    std::cin >> a >> b >> x;

    long aa = a / x;
    long bb = b / x;
    long ans = bb-aa;
    ans += (a % x == 0) ? 1 : 0;
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    ll N,C,K;
    cin >> N >> C >> K;
    vll T(N);
    cin >> T;
    sort(T.begin(),T.end());
    ll ans = 0;
    int i=0;
    while(i<N){
        int j=i;
        for(;i<N && i<j+C && T[i]-T[j]<=K; i++);
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4028
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;

signed main() {
	int n; cin >> n;
	int ans(0);
	while (n) {
		ans++;
		n >>= 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;

  vector<char> c(n);
  rep(i, n) c[i] = s[i];

  ll ans = 0;
  rep(i, n - 1) {
    if (c[i] != c[i + 1]) {
      ans++;
    }
  }

  cout << ans + 1 << endl;
  return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#include <fstream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define ll long long

const int MOD = 1000000007;

int main() {
	//入力
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];

	//処理
	ll mx = 0;
	for (int i = 1;i < n;++i) {
		mx += a[i];
	}
	int ans = 0;
	rep(i, n-1) {
		ans += ((a[i] % MOD) * (mx % MOD)) % MOD;
		ans = ans % MOD;
		mx -= a[i + 1];
	}

	//出力
	cout << ans << endl;
} 

Measured memory_bytes: 4752
#include<stdio.h>
int main(void)
{
	int a, b, sum = 0;
	int i;

	scanf("%d", &a);
	scanf("%d", &b);
	for (i = 0; i < 2; i++) {
		if (a < b) {
			sum = sum + b;
			b = b - 1;
		}
		else if (a >= b) {
			sum = sum + a;
			a = a - 1;
		}
	}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

int main(){
	int n;
	cin>>n;
	vector<long long int> a(n);
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a.begin(),a.end());
	long long int b=0;
	long long int c=0;
	int i;
	for(i=n-1;i>0;i--){
		if(a[i]==a[i-1]){
			b=a[i];
			i-=2;
			break;
		}
	}
	for(;i>0;i--){
		if(a[i]==a[i-1]){
			c=a[i];
			break;
		}
	}
	
	cout<<b*c<<endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
typedef long long LL;
int n;
const int maxn = 2e5 + 5;
int p[maxn];

int st[2][maxn][20];
int a[2][maxn];
void init(int id, int m){
    memset(st[id], 0, sizeof(st[id]));
    a[id][0] = 1e9;
    for(int i = 1;i <= m;i++){
        st[id][i][0] = i;
    }
    for(int j = 1;(1 << j) <= m;j++){
        for(int i = 1;i + j - 1 <= m;i++){
            if(a[id][st[id][i][j - 1]] < a[id][st[id][i + (1 << (j - 1))][j - 1]]){
                st[id][i][j] = st[id][i][j - 1];
            }else{
                st[id][i][j] = st[id][i + (1 << (j - 1))][j - 1];
            }
        }
    }
}

int query(int id, int l, int r){
    int len = r - l + 1;
    int k = 31 - __builtin_clz(len);
    if(a[id][st[id][l][k]] < a[id][st[id][r - (1 << k) + 1][k]]){
        return st[id][l][k];
    }else{
        return st[id][r - (1 << k) + 1][k];
    }
}

struct node{
    int l, r;
    LL id;
    LL val;
    node(int l=0, int r=0, LL val=0, LL id=0):l(l), r(r), val(val), id(id){}
    bool operator < (const node & rhs) const{
        return val > rhs.val;
    } 
};

int q[maxn];
int tot;

int query1(int l, int r){
    int tmp = query(l & 1, (l + 1) / 2, (r + (l & 1)) / 2);
    if(l & 1){
        tmp = tmp * 2 - 1;
    }else{
        tmp = tmp * 2;
    }
    return tmp; 
}

pair<int, int> Query(int l, int r){
    int first = query1(l, r);
    int second = query1(first + 1, r);
    return make_pair(first, second);
}

int main(){
    cin >> n;
    for(int i = 1;i <= n;i++){
        scanf("%d", &p[i]);
    } 
    for(int i = 2;i <= n;i += 2){
        a[0][i / 2] = p[i];
    }
    init(0, n / 2);
    for(int i = 1;i <= n;i += 2){
        a[1][(i + 1) / 2] = p[i];
    }
    init(1, (n + 1) / 2);
    tot = 0;
    priority_queue<node> pq;
    pair<int, int> pp = Query(1, n);
    //cout << pp.first << " " << pp.second << endl;
    pq.push(node(1, n, 1LL * p[pp.first] * 1e6 + p[pp.second], 1LL * pp.first * 1e6 + pp.second));
    while(!pq.empty()){
        node f = pq.top();pq.pop();
        int second = f.id % 1000000;
        int first = f.id / 1000000;
        q[++tot] = p[first];
        q[++tot] = p[second];
        int l = f.l, r = f.r;
        //cout << first << " " << second << endl;
        //scanf("%d", &l);
        if(first > l){
            pp = Query(l, first - 1); 
            pq.push(node(l, first - 1, 1LL * p[pp.first] * 1e6 + p[pp.second], 1LL * pp.first * 1e6 + pp.second));
        }
        if(first < second - 1){
            pp = Query(first + 1, second - 1);
            pq.push(node(first + 1, second - 1, 1LL * p[pp.first] * 1e6 + p[pp.second], 1LL * pp.first * 1e6 + pp.second));
        }
        if(second < r){
            pp = Query(second + 1, r);
            pq.push(node(second + 1, r, 1LL * p[pp.first] * 1e6 + p[pp.second], 1LL * pp.first * 1e6 + pp.second));
        }
    }
    for(int i = 1;i <= tot;i++){
        printf("%d%c", q[i], i == tot ? '\n' : ' ');
    }
    return 0;
}


Measured memory_bytes: 36468