akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;


int main(){
    int n,m;
    cin >> n >> m;
    vector<pair<int,int>> problem(n,make_pair(0,0));
    for(int i=0; i<m; i++){
        int p; cin >> p;
        string s; cin >> s;
        if(problem[p-1].first == 0){
            if(s=="AC") problem[p-1].first ++;
            else problem[p-1].second ++;
        }
    }
    int ac = 0;
    int wa = 0;
    for(auto q:problem){
        int ac_i = q.first;
        int wa_i = q.second;
        if(ac_i>0){
            ac ++;
            wa += wa_i;
        }
    }
    cout << ac << " " << wa << endl;
}

Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()


int main() {
  int n, m;
  cin >> n >> m;
  if (n >= m) {
    cout << 0 << endl;
    return 0;
  }
  vector<int> x(m), dx(m-1);
  rep(i, m) cin >> x[i];
  sort(all(x));
  int sum = x[m-1] - x[0];
  rep(i, m-1) dx[i] = x[i+1] - x[i];
  sort(allr(dx));
  rep(i, n-1) sum -= dx[i];
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n,l;
  cin>>n>>l;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i)
  {
    cin>>a[i];
  }
  int tmp=-1;
  for (int i = 0; i < n-1; ++i)
  {
    if(a[i]+a[i+1]>=l){
      tmp=i;
      break;
    }
  }
  if(tmp==-1){
    cout<<"Impossible";
    return 0;
  }
  cout<<"Possible"<<endl;
  for (int i = 1; i <= tmp; ++i)
  {
    cout<<i<<endl;
  }
  for (int i = n-1; i >= tmp+2 ; --i)
  {
    cout<<i<<endl;
  }
  cout<<tmp+1;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>

#define SIZE 100005
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
using namespace std;


int main()
{	
	ll N, K;
	scanf("%lld %lld", &N, &K);
	ll L, R;
	L=(2*K+2*N-1)*N;
	R=(2*K+5*N-1)*N/2;
	
	ll answer=0;
	ll bengi;
	ll aa;
	if(L>R)
	{	answer=-1;
	printf("%lld", answer);}
	else
	{
		if(N%2!=0)
		{
			for(ll i=0;i<N;i++){
				if(i%2==0)
				{	bengi=K+2*N-1-i/2;
					aa=K+2*N+(N-1)/2+i/2;}
				else
				{	bengi=K+N+(N-1-i)/2;
					aa=K+2*N+(i-1)/2;}
			
				printf("%lld %lld %lld \n", K+i,bengi ,aa);
			}
		}
		else
		{
			for(ll i=0;i<N;i++){
				if(i%2==0)
				{	bengi=K+N+(N-2-i)/2;
					aa=K+2*N+i/2;
					}
				else
				{	bengi=K+N+N/2+(N-1-i)/2;
					aa=K+2*N+N/2+(i-1)/2;}
			
				printf("%lld %lld %lld \n", K+i,bengi ,aa);
			}
		}	
	}
	

	
}


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

int d, x, y;
vector<int> w, v;
int dp[14];

int main()
{
	scanf("%d", &d);
	scanf("%d", &x);
	while (x--){
		string str;
		int val;
		cin >> str >> val;
		if (str == "D"){
			w.push_back(1);
			v.push_back(val);
		}
	}
	scanf("%d", &y);
	while (y--){
		string str;
		int val;
		cin >> str >> val;
		if (str == "DD"){
			w.push_back(2);
			v.push_back(val);
		}
	}
	
	for (int i = 0; i < w.size(); i++){
		for (int j = d; j >= w[i]; j--){
			dp[j] = max(dp[j], dp[j - w[i]] + v[i]);
		}
	}
	
	printf("%d\n", dp[d]);
}

Measured memory_bytes: 1288
main = do
    n <- readLn :: IO Int
    print =<< countAll 1 n

i_n :: IO Int
i_n = do
    lr <- (map read . words) <$> getLine :: IO [Int]
    return (count lr)

count :: [Int] -> Int
count [l,r] = r-l+1


countAll :: Int -> Int -> IO Int
countAll n m
 | n == m = i_n
 | otherwise =  ((return (+)) <*> i_n)  <*>  (countAll (n+1) m)

Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

vector < pair < int , int > > tasks;

int main(){
    ios_base::sync_with_stdio(0);
    int n, m;
    int x, y;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> x >> y;
        tasks.push_back(make_pair(y, x));
    }
    sort(tasks.begin(), tasks.end());

    int ans = 0;
    int last = -1;
    for(int i = 0; i < m; i++){
        if(tasks[i].second <= last){
            continue;
        }
        last = tasks[i].first - 1;
        ans++;
    }

    cout << ans;

    return 0;
}


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

#define all(s) s.begin(), s.end()
#define vi vector<int>
#define pb push_back
#define ii pair<int, int>
#define x first
#define y second

const int N = 100005;

int dp[N], nx[N], it[4 * N];

void build(int k, int l, int r) {
    //cout << k << ' ' << l << ' ' << r << endl;
    if (l == r) {it[k] = l; return;}
    int mid = (l + r) / 2;
    build(2 * k, l, mid);
    build(2 * k + 1, mid + 1, r);
    if (dp[it[2 * k]] <= dp[it[2 * k + 1]]) {
        it[k] = it[2 * k];
    } else it[k] = it[2 * k + 1];
}

void update(int k, int l, int r, int id, int val) {
    if (l > id || r < id) return;
    if (l == id && r == id) {
        it[k] = id;
        return;
    } 
    int mid = (l + r) / 2;
    update(2 * k, l, mid, id, val);
    update(2 * k + 1, mid + 1, r, id, val);
    if (dp[it[2 * k]] <= dp[it[2 * k + 1]]) {
        it[k] = it[2 * k];
    } else it[k] = it[2 * k + 1];
}

int get(int k, int l, int r, int u, int v) {
    if (l > v || r < u) return 0;
    if (l >= u && r <= v) return it[k];
    int mid = (l + r) / 2;
    int g1 = get(2 * k, l, mid, u, v);
    int g2 = get(2 * k + 1, mid + 1, r, u, v);
    if (dp[g1] <= dp[g2]) {
        return g1;
    } else {
        return g2;
    }
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n, m;
    string s;
    cin >> n >> m;
    n++;
    cin >> s;
    s = " " + s;
    for (int i = 0; i <= n; i++) {
        dp[i] = 1e9;
    }
    build(1, 1, n);
    dp[n] = 0;
    update(1, 1, n, n, 0);
    for (int i = n - 1; i >= 1; i--) {
        if (s[i] == '1') continue;
        int k = get(1, 1, n, i + 1, min(n, i + m));
        //cout << i + 1 << ' ' << min(n, i + m) << endl;
        //cout << k << endl;
        if (dp[k] == 1e9) continue;
        dp[i] = dp[k] + 1;
        nx[i] = k;
        update(1, 1, n, i, dp[i]); 
    }
    //cout << ((dp[1] == 1e9) ? -1 : dp[1]) << endl;
    int cur = 1;
    if (nx[cur] == 0) return cout << -1, 0;
    while (nx[cur] != 0) {
        cout << nx[cur] - cur << ' ';
        cur = nx[cur];
    }
    return 0;
}

Measured memory_bytes: 2412
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  int D;
  cin >> D;
  vi C(26);
  vector<vi> S(D, vi(26));
  REP(i, 26) cin >> C.at(i);
  REP(i, D) REP(j, 26) cin >> S.at(i).at(j);
  REP(i, D) { cout << i % 26 + 1 << endl; }
  return 0;
}

Measured memory_bytes: 3708
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) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "a", long, "b");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    long r, g, b, n;
    scan(r, g, b, n);
    long cnt;
    foreach (i; iota(n / r + 1))
    {
        foreach (j; iota(n / g + 1))
        {
            auto k = n - (i * r) - (j * g);
            if (k >= 0 && k % b == 0)
            {
                // writefln("i is %s, j is %s, k is %s", i, j, k);
                cnt++;
            }
        }
    }
    cnt.writeln();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

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

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; }}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; }}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N; cin >> N;
    set<int> st;

    rep(i, N) {
        int A; cin >> A;
        if (st.count(A)) {
            cout << "NO" << endl;
            return 0;
        }
        st.insert(A);
    }
    cout << "YES" << endl;
    return 0;
}


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

using namespace std;

vector<string> split_string(string);

int main()
{
  long long a, b, c, k;
  cin >> a >> b >> c >> k;
  long long sum = 0;
  sum += min(a, k);
  k -= a;
  if(k > 0){
     k -= b;
  }
  if(k > 0){
      sum -= min(c, k);
  }
  cout << sum;
}


Measured memory_bytes: 3624
X,Y,A,B,C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
P = P[:X]
Q.sort(reverse=True)
Q = Q[:Y]
sp = sum(P)
sq = sum(Q)
ans = sp+sq
R.sort(reverse=True)
import heapq  # heapqライブラリのimport
heapq.heapify(P)  # リストを優先度付きキューへ
heapq.heapify(Q)
p = heapq.heappop(P) # 最小値の取り出し
q = heapq.heappop(Q)
r = R.pop(0)
while p<r or q<r:
  #print(p,q,r,ans)
  if r-p > r-q:
    heapq.heappush(P, r)
    ans += r-p
    p = heapq.heappop(P)
  else:
    heapq.heappush(Q, r)
    ans += r-q
    q = heapq.heappop(Q)
  if len(R)==0:
    break
  r = R.pop(0)
  #print(p,q,r,ans)
print(ans)

#print(*ans[1:], sep='\n')


Measured memory_bytes: 29492
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == 1)return;for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(vector<int>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}


void solve(void)
{
  int X;
  cin>>X;
  int ANS = 1;
  for (int i = 0; i <= X; i++)
  {
    for (int j = 2; j <= X; j++)
    {
      int Z = 1;
      for (int rep = 0; rep < j; rep++)
      {
        Z *= i;
        if(Z > X) continue;
      }
      // DEBUG(Z);
      if(Z<=X)
      {
        chmax(ANS,Z);
      }
    }
    
  }
  
  cout<<ANS<<endl;
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define dis distance
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);
const double PI = acos(-1);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x,y;
	cin >> x >> y;
	if(x >= 0 && y >= x)cout << y-x << endl;
	else if(x >= 0 && y < x){
		cout << min({x-y+2,abs(y+x)+1}) << endl;
	}
	else{
		if(y < x)cout << x-y+2 << endl;
		else if(y < 0)cout << y-x << endl;
		else {
			int ans = min(y-x,abs(y+x)+1);
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import math
import sys
from operator import itemgetter
input = sys.stdin.readline

# a = int(input().rstrip())
# a, b = map(int, input().rstrip().split())
# D = list(map(int, input().rstrip().split()))
# H = [int(input().rstrip()) for _ in range(L)]
# DD = [[0 for j in range(100)] for i in range(200)]
# dict = {} ## dictionary

# a = sorted(a, key=lambda x: x[1]))
# if __name__ == '__main__':

N, M = map(int, input().rstrip().split())
Ar = list(map(int, input().rstrip().split()))

def chmax(a, b):
	if a is None:
		return b
	elif len(a) < len(b):
		return b
	elif len(a) > len(b):
		return a
	else:
		return max(a, b)

dict = {}
num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [None] * (N+1)

for i in Ar:
	if num[i] in dict:
		dict[num[i]] = max(i, dict[num[i]])
	else:
		dict[num[i]] = i

# dp探索
dp[0] = ""
for i in range(1, N+1):
	for j in dict:
		if (i >= j) and (dp[i-j] is not None):
			dp[i] = chmax(dp[i], dp[i-j] + str(dict[j]))

print(dp[N])


Measured memory_bytes: 28128
#include<bits/stdc++.h>
#define int long long
inline int read(){
	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();
	int k=1,kk=0;if (c=='-')c=getchar(),k=-1;
	while (c>='0'&&c<='9')kk=kk*10+c-'0',c=getchar();return kk*k;
}using namespace std;
void write(int x){if (x<0)putchar('-'),x=-x;if (x/10)write(x/10);putchar(x%10+'0');}
void writeln(int x){write(x);puts("");}
int n,k;
signed main(){
	n=read();k=read();writeln((n-1+k-2)/(k-1));
}




Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    while(true){
      int a = scanner.nextInt();
      int b = scanner.nextInt();
      if(a == 0 && b == 0){
        break;
      }
      for(int j = 0; j < a; j++){
        if (j != 0) System.out.print("\n");
        for(int k = 0; k < b; k++){
        if((j % 2 == 0 && k % 2 == 0) || (j % 2 == 1 && k % 2 == 1)){
          System.out.print("#");
        }
        else{
          System.out.print(".");
        }
        }
      }
      System.out.println("\n");
    }
  }

}

Measured memory_bytes: 32956
#include <stdio.h>
#include <string.h>

void deleteFirst(int**);
void deleteLast(int**);
void insertOne(int**, int**, int, int);
bool deleteOne(int**, int**, int);

int main(void){
    int xs[2000001] = {};
    int* default_ptr = xs + 2000000;
    int* fp = default_ptr;
    int* lp = default_ptr;
    int len = 0;
    int n;
    char str[20];
    fgets(str, sizeof(str), stdin);
    sscanf(str, "%d", &n);
    for(int i=0; i < n; ++i){
        fgets(str, sizeof(str), stdin);
        if(str[6] == 'F'){
            deleteFirst(&fp);
            --len;
        }else if(str[6] == 'L'){
            deleteLast(&lp);
            --len;
        }else{
            char *tp;
            int m;
            tp = strtok(str, " " );
            tp = strtok(NULL," ");
            sscanf(tp, "%d", &m);
            if(str[0] == 'i'){
                insertOne(&fp, &lp, m, len);
                ++len;
            }else if(deleteOne(&fp, &lp, m)){
                --len;
            }
        }
        
        if(len == 0){
            fp = default_ptr;
            lp = default_ptr;
        }
    }
    
    for(int i = 0; i < lp - fp; ++i){
        if(*(fp + i) != -1){
            printf("%d ", *(fp + i));
        }
    }
    printf("%d\n", *lp);
}

void deleteFirst(int** fp){
    **fp = -1;
    while(**fp == -1) ++*fp;
}

void deleteLast(int** lp){
    **lp = -1;
    while(**lp == -1) --*lp;
}

void insertOne(int** fp, int** lp, int m, int len){
    if(len == 0){
        **fp = m;
    }else{
        --*fp;
        **fp = m;
    }
}

bool deleteOne(int** fp, int** lp, int m){
    for(int j = 0; j <= *lp - *fp; ++j){
        if(*(*fp + j) == m){
            *(*fp + j) = -1;
            if(j == 0){
                while(**fp == -1) ++*fp;
            }else if((*fp + j) == *lp){
                while(**lp == -1) --*lp;
            }
            return true;
        }
    }
    return false;
}

Measured memory_bytes: 10480
s=str(input())
k=int(input())
cnt=0
if int(s[0])==1:
  for i in range(len(s)):
    if int(s[i])==1:
      cnt+=1
    else:
      ans=s[i]
      break
  if k<=cnt:
    print(1)
  else:
    print(ans)
  
else:
  for i in range(len(s)):
    if int(s[i])!=1:
      print(s[i])
      break

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 1;
    rep(i, n - 1) {
        if (s[i] == s[i + 1]) continue;
        else ans++;
    }
    
    cout << ans << endl;
    return 0;
}


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

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 200111, inf = 1000111222;

ll n, k;
int a[max_n];
int fst[max_n];
int lst[max_n];
int nxt[max_n];
bool add[max_n];
bool have[max_n];

int main()
{
    //freopen("input.txt", "r", stdin);
    for (int i = 0; i < max_n; ++i) {
        fst[i] = -1;
        lst[i] = -1;
    }
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
        if (fst[a[i]] == -1) {
            fst[a[i]] = i;
        }
    }
    for (int i = n - 1; i >= 0; --i) {
        int cur = a[i];
        if (lst[cur] == -1) {
            nxt[i] = fst[cur] + 1;
            if (nxt[i] == n) {
                nxt[i] = 0;
                add[i] = 1;
            }
        } else if (lst[cur] == n - 1) {
            nxt[i] = 0;
        } else {
            nxt[i] = nxt[lst[cur] + 1];
            add[i] = add[lst[cur] + 1];
        }
        lst[cur] = i;
    }
    int cur = 0;
    int cycle = 0;
    /*for (int i = 0; i < n; ++i) {
        cout << nxt[i] << ' ';
    }
    cout << endl;
    for (int i = 0; i < n; ++i) {
        cout << add[i] << ' ';
    }
    cout << endl;
    */do {
        if (add[cur] == 1) {
            ++cycle;
        }
        cur = nxt[cur];
        ++cycle;
        if (cycle > 2e6) {
            exit(228);
        }
    } while (cur);
    k %= cycle;
    if (k == 0) {
        cout << endl;
        return 0;
    }
    //cout << cycle << ' ' << k << endl;
    cur = 0;
    while(true) {
        int jump = 1;
        if (add[cur]) {
            jump = 2;
        }
        if (jump < k) {
            cur = nxt[cur];
            k -= jump;
        } else {
            break;
        }
    }
    //cout << k << ' ' << cur << endl;
    vector<int> val;
    for (int i = cur; i < n; ++i) {
        val.PB(a[i]);
    }
    --k;
    if (k == 1) {
        for (int i = 0; i < n; ++i) {
            val.PB(a[i]);
        }
    }
    vector<int> s;
    for (int cur : val) {
        if (have[cur]) {
            while(s.back() != cur) {
                have[s.back()] = 0;
                s.pop_back();
            }
            s.pop_back();
            have[cur] = 0;
        } else {
            s.push_back(cur);
            have[cur] = 1;
        }
    }
    for (int a : s) {
        cout << a << ' ';
    }
    return 0;
}




Measured memory_bytes: 6516
// Last Change: 04/02/2019 22:34:13.
/////////////////////////////////////////////////////////////////////////////
//これは全く分からなかった。mod周辺の典型問題は確認しておく必要がある。
//詳細は回答を確認。
/////////////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

int main() {
  ll N;
  cin >> N;

  ll ans = 0, ipt;
  for (ll i = 0; i < N; ++i) {
    cin >> ipt;
    ans += ipt - 1;
  }
  cout << ans << endl;

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 256
N,A,B = map(int,input().split())
total = 0
for i in range(N + 1 ):
    num = str(i)
    se_sum = 0
    for j in range(len(num)):
        se_sum += int(num[j])
    if A <= se_sum <= B:
        total += i

print(total)

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(i, v) for(auto i =  v.begin(); i !=  v.end(); ++i)
#define RFOR(i, v) for(auto i = v.rbegin(); i != v.rend(); ++i)

template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T> ostream & operator<<(ostream & os, const vector<T> & v) {
	os << "[";
	FOR(it, v) {
		if(it != v.begin()) { os << ", "; }
		os << *it;
	}
	os << "]";
	return os;
}
template<typename F, typename S> ostream & operator<<(ostream & os, const pair<F, S> & p) {
	os << "<" << p.FI << ", " << p.SE << ">";
	return os;
}

// ---- ----

LL a[7];

int main() {
	inc(i, 7) { cin >> a[i]; }
	LL x = (a[0] / 2) * 2 + (a[3] / 2) * 2 + (a[4] / 2) * 2;
	LL y = 0;
	if(a[0] > 0 && a[3] > 0 && a[4] > 0) {
		a[0]--; a[3]--; a[4]--;
		y = (a[0] / 2) * 2 + (a[3] / 2) * 2 + (a[4] / 2) * 2 + 3;
	}
	
	cout << a[1] + max(x, y) << endl;
	
	return 0;
}


Measured memory_bytes: 384
using System.Collections.Generic;
using static System.Console;

class Program {
	static void Main() {
		var H = NextInt();
		var W = NextInt();
		var map = new int[H, W];

		for (var i = 0; i < H; i++) {
			var S = ReadLine();
			for (var j = 0; j < W; j++) {
				if (S[j] == '#') {
					map[i, j] += 10;
					for (var x = -1; x <= 1; x++) {
						for (var y = -1; y <= 1; y++) {
							if (H <= i + x || i + x < 0) {
								//
							} else if (W <= j + y || j + y < 0) {
								//
							} else {
								map[i + x, j + y]++;
							}
						}
					}
				}
			}
		}

		for (var i = 0; i < H; i++) {
			for (var j = 0; j < W; j++) {
				var tmp = map[i, j];
				if (tmp >= 10) {
					Write("#");
				} else {
					Write(tmp);
				}
			}
			WriteLine();
		}
	}

	static int NextInt() {
		return int.Parse(NextString());
	}

	static string NextString() {
		var result = new List<char>();
		while (true) {
			int next = Read();
			if (next < 0)
				break;
			var nextChar = (char)next;
			if (!char.IsWhiteSpace(nextChar))
				result.Add(nextChar);
			else if (nextChar != '\r')
				break;
		}
		return string.Join("", result);
	}
}

Measured memory_bytes: 13268
from collections import defaultdict as dd
from collections import Counter
from pprint import pprint as pp

YN = {True: 'Yes', False: 'No'}
ri = lambda: int(input())
ria = lambda: list(map(int, input().split()))
rian = lambda n: [ria() for _ in range(n)]
rs = lambda: input()
rsa = lambda: input().split()
rsn = lambda n: [rs() for _ in range(n)]

A, B, K = ria()
K = min(K, B-A+1)
s = set(range(A, A+K))
s |= set(range(B, B-K, -1))
for i in sorted(s):
  print(i)

Measured memory_bytes: 3572
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security.Cryptography.X509Certificates;
using System.Xml;

namespace hello_world
{
	class Program
	{

		static void Main(string[] args)
		{
			
			string[] s = Console.ReadLine().Split(" ");
			int x = int.Parse(s[0]);
			int y = int.Parse(s[1]);
			
			Console.WriteLine("{0}",x*y);


		}
	}
}

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

using namespace std;

#define endl '\n'
#define Opy ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)

typedef long long ll;

int main()
{
    Opy;

/*-------------------------------------------------
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
-------------------------------------------------*/
    int n;

    cin>> n;

    map< ll, ll> B;

    for(int i = 0; i < n; i++)
    {
        ll tmp;

        cin>> tmp;

        B[tmp]++;
    }

    auto it = B.begin();

    while(it != B.end())
    {
        if(it->second > 1)
        {
            cout<< "NO\n";
            return 0;
        }

        it++;
    }

    cout<< "YES\n";

    return 0;
}


Measured memory_bytes: 16084
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll n,k;
vl a,b(41);

int main(){
	cin>>n>>k;
	a=vl(n);
	for(auto &i:a) cin>>i;
	for(int i=0;i<41;i++) for(int j=0;j<n;j++) if(a[j]&1ll<<i) b[i]++;
	ll res=0;
	for(int i=40;i>=0;i--) if((k+1)&1ll<<i){
		ll tmp=0;
		for(int j=0;j<i;j++) tmp+=max(b[j],n-b[j])*(1ll<<j);
		for(int j=i;j<=40;j++) tmp+=(k&1ll<<j&&j>i?n-b[j]:b[j])*(1ll<<j);
		res=max(res,tmp);
	}
	cout<<res<<endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  cout << A.at(N - 1) - A.at(0) << endl;
}


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

string s;
int x, y;
int main()
{
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> s >> x >> y;
  bitset< 2 * 8000 > dpx, dpy;
  int cnt = 0, first = 0, N = s.size();
  while (s[first++] == 'F');
  dpx[8000 + --first] = dpy[8000] = 1;

  bool isX = true;
  for (int i = first; i < N; ++i) {
    if (s[i] == 'F') cnt++;
    if (s[i] == 'T' || i == N - 1) {
      if (isX) dpx = (dpx << cnt) | (dpx >> cnt);
      else     dpy = (dpy >> cnt) | (dpy << cnt);
      isX = !isX;
      cnt = 0;
    }
  }

  cout << (dpx[x + 8000] && dpy[y + 8000] ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	S := sc.nextStr()
	before := S[0]
	bad := false
	for i := 1; i < len(S); i++ {
		if before == S[i] {
			bad = true
		}
		before = S[i]
	}
	if bad {
		fmt.Println("Bad")
	} else {
		fmt.Println("Good")
	}
}


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

int main() {
    vector<int> a(6);

    for(int i = 0 ; i < 6 ; i++)
        cin >> a.at(i);

    int rengeMAX = a.back();
    a.pop_back();

    sort(a.begin(), a.end());
    int renge, f, b;
    f = a.front();
    b = a.back();
//    cout << f << b;
    renge = abs(a.front() - a.back());

    if(renge <= rengeMAX)
        cout << "Yay!" << endl;
    else
        cout << ":(" << endl;

    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    string N;
    cin>>N;

    for(int i=0;i<3;++i){
        if(N.at(i)=='7'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    
    
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

using namespace std;

int main()
{
  uint64_t N;
  cin >> N;

  queue<pair<string, uint64_t>> q;
  q.emplace("a", 1);
  vector<string> v;
  while (!q.empty()) {
    pair<string, uint64_t> p = q.front(); q.pop();
    string s = p.first;
    uint64_t k = p.second;

    if (s.size() == N) {
      v.emplace_back(s);
      continue;
    }

    N_TIMES(i, k) {
      char c = 'a' + i;
      q.emplace(s + c, k);
    }
    {
      char c = 'a' + k;
      q.emplace(s + c, k + 1);
    }
  }

  sort(v.begin(), v.end());

  for (string s : v) {
    cout << s << endl;
  }

  return 0;
}

Measured memory_bytes: 9852
#include <iostream>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)

int main(void) {
    int k, x;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> k >> x;
    FOR (i, x - k + 1, x + k) {
        cout << i;
        cout << (i != x + k? " " : "\n");
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  int N;
  cin >> N;
  map<int, int> mp;
  rep(i, N) {
    int A;
    cin >> A;
    mp[A]++;
  }
  int ans = 0;
  for(auto e : mp)
    ans += max(e.second-1, 0);
  ans = N-(ans+1)/2*2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
n  = int(input())
c= 0;
m = 0
for i in range(n):
	
	d1,d2 = map(int,input().split())
	
	if(d1==d2):
		c+=1
	else:
		c=0;
	if m<c:
		m=c
		
if(m>=3):
	print("Yes");
else:
	print("No");


Measured memory_bytes: 9168
#include <stdio.h>
#include <inttypes.h>

int main(void) {
	uint64_t A, B;
	int N;
	uint64_t answer = UINT64_C(99999999999999999);
	int i, j;
	if (scanf("%" SCNu64 "%" SCNu64 "%d", &A, &B, &N) != 3) return 1;
	for (i = 1; i <= N; i++) {
		for (j = 1; j <= N; j++) {
			if ((B * i) % j == 0) {
				uint64_t newFollow = B * i / j;
				uint64_t diff = A < newFollow ? newFollow - A : A - newFollow;
				if (diff < answer) answer = diff;
			}
		}
	}
	printf("%" PRIu64 "\n", answer);
	return 0;
}



Measured memory_bytes: 2112
#define _GLIBCXX_DEBUG
#include"bits/stdc++.h"

using namespace std;

//loops
#define REP(i,n) for(int i=0;i<(ll)(n);i++)
#define REPD(i,n) for(int i=(ll)(n)-1;i>=0;i--)
#define OneToN(i,n) for(int i=1;i<(ll)(n+1);i++)
#define ZeroToN(i,n) for(int i=0;i<(ll)(n+1);i++)
#define AToB(i,a,b) for(int i=a;i<(ll)(b+1);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)

//bitsearch
#define BITSEARCH(bit, n) for (int bit = 0; bit < (1<<n); ++bit)
#define isOne(bit, i) bit & (1<<i)


//arrays
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define add push_back


#define remove_unique(v) v.erase(unique(ALL(v)), v.end())

//pair
#define fir first
#define sec second

//types
#define ll long long
#define vec vector
#define cord2d pair<int,int>
//UNCOMMENT WHEN NEEDED
//#define int ll

//input
template <class T> T get(){ T s; cin >> s; return(s);}
#define gi get<int>()
#define gs get<string>()

template <class T> vector<T> getv(int n) { vec<T> v(n); REP(i, n) cin >> v[i]; return v; }
#define gim(n) getv<int>(n)
#define gsm(n) getv<string>(n)

//output
void print(int a){ cout << a << endl; }
void print(string a){ cout << a << endl; }
void print(char a){ cout << a << endl; }
void print(double a){ cout << a << endl; }
void print(double a, int dig){ cout << std::setprecision(dig) << a << endl; }

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T = int>
void print(vec<T> v){ cout << v << endl; }

template <class T = int>
void print2dVec(vec<vec<T>> v2d){for(vec<T> v: v2d) {print(v);}}

void YesNo1(bool i = true){ return print(i?"Yes":"No"); }
void YESNO2(bool i = true){ return print(i?"YES":"NO"); }

//debug output
#define var_name(var) #var
template <class T> void debug(T &var, int nest = 0, string before = "") { cout << string("          ", nest) << before; print(var); }

//name replacement
#define y0 y0__
#define y1 y1__
#define j0 j0__
#define j1 j1__

//bool lambdas
#define lamb(exp) [](auto i){return exp;}
#define isEven [](int i){return i % 2 == 0;}
#define isOdd [](int i){return i % 2 != 0;}

//constants
const ll INF = 1e18;
const int MOD = 10000007;

//maths
int factorial(int k){ int sum = 1; for (int i = 1; i <= k; ++i) { sum *= i; } return sum; }

void Main() {
    //code here
    int n = gi;
    if (n/100 == 7 || n/10%10 == 7 || n%10 == 7) {
        print("Yes");
    } else {
        print("No");
    }
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Main();
}


Measured memory_bytes: 3652
#include <iostream>
#include <cmath>

using namespace std;

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

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

		if (a*a + b*b == c*c || b*b + c*c == a*a || c*c + a*a == b*b) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 2996
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  long long x,y,z;
  bool operator < (const P &a )const{
    //if(y!=a.y)
    return y>a.y;
  };

};

int a,b,c,d,i,n,m,e,k,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
int o[1];
int l[1];
int s[1];
long long x,y,z,mod=1000000007,hf=(mod+1)/2;

//string r,r1;
char r[111];
vector<P> v[2];
P u[1];
queue<int> q;
//set<int> s[2];
//stack<int> s;
map<int,int> p;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//rng()
bool as(P a,P b)
{
  return a.x<b.x;
}


int main()
{
  scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
  if(b>d&&(long long)e*(b-d)>=abs(a-c)) puts("YES");
  else puts("NO");
}



Measured memory_bytes: 3700
N = int(input())
*p,= map(float,input().split())
dp = [[0]*(N+1) for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
	dp[i+1][0] = dp[i][0]*(1-p[i])
	
for i in range(N):
	for h in range(N):
		dp[i+1][h+1] = dp[i][h+1]*(1-p[i]) + dp[i][h]*p[i]

print(sum(dp[-1][N//2+1:]))

Measured memory_bytes: 345992
n = int(input())


def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            ans += gcd(gcd(i, j), k)
print(ans)


Measured memory_bytes: 74916
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int main(){
    ll n,k; cin >> n >> k;
    n %= k;
    cout << min(n, abs(n-k)) << endl;
    return 0;
}

Measured memory_bytes: 256
/*
I believe on myself and I will achieve
this->author = Fuad Ashraful Mehmet, CSE ,University of Asia Pacific
Todo:
https://codeforces.com/problemset/problem/830/B
*/
#include<bits/stdc++.h>
#define forn(i,n) for(int i=0;i<(int)n;++i)
#define all(o) (o).begin(),(o).end()
#define dbg(o)  cerr<<"at "<<__LINE__<<" response = "<<o<<endl;
#define pb push_back
using namespace std;

typedef long long ll;
const int N=1e5+5;
ll q,k,m,n,cs=1;

void HalfDead()
{
	cin>>n;
	
	ll ans=0;
	for(ll i=1;i<=n;++i)
	{
		for(ll j=1;i*j<n;++j)
		{
			//ans+=(n-i*j);
			ans++;
		}
	}

	cout<<ans<<endl;
}
int main()
{
      ios_base::sync_with_stdio(0); cin.tie(nullptr);  cout.tie(0);
      // cout<<setprecision(10)<<fixed;
      int tc=1;
     // cin>>tc;
      while(tc--)
      {   
          HalfDead();
      }
      return 0;
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                string input = Console.ReadLine();

                if (string.IsNullOrEmpty(input)) break;

                int[] nums = Array.ConvertAll(input.Split(' '), int.Parse);
                string sum = (nums[0] + nums[1]).ToString();
                sb.AppendLine(sum.Length.ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9124
n = gets.chomp.to_i

if n % 2 == 1 || n < 10
  puts 0
else
  count = 1
  result = 0
  while n / (5 ** count) > 0 do
    tmp = n / ((5 ** count) * 2)
    break if tmp < 1
    result +=  tmp
    count += 1
  end
end
puts result

Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

int main() {
    int x, y;
    cin >> x >> y;

    int ans = 0;
    auto f = [&](int x) {
    if (x == 1) {
        ans += 3e5;
    } else if (x == 2) {
        ans += 2e5;
    } else if (x == 3) {
        ans += 1e5;
    }
    };

    f(x);
    f(y);
    if (x == 1 && y == 1) ans += 4e5;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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






int main(void) {
	LL N;
	LL D[200000 +1];
	LL M;
	LL T[200000 +1];

	map<int,int> m;	

	cin >> N;
	for(int i=0; i<N; i++) {
		cin >> D[i];
		if( m.find(D[i]) == m.end() ) {
			m[D[i]] = 1;
		}else {
			m[D[i]] = m[D[i]] + 1;
		}
	}

	cin >> M;
	for(int i=0; i<M; i++) {
		cin >> T[i];
		auto itr = m.find(T[i]);
		if( itr == m.end() ) {
			cout << "NO" << endl;
			return 0;
		}else{
			if( m[T[i]] == 0 ) {
				cout << "NO" << endl;
				return 0;
			}else {
				m[T[i]] = m[T[i]] - 1;
			}
		}
	}
	cout << "YES" << endl;
	


	return 0;
}

Measured memory_bytes: 12800
function main(input){
  const args = input.split(' ');
  const x = parseInt(args[0], 10);
  const a = parseInt(args[1], 10);
  if (x < a){
      console.log(0);
  } else {
      console.log(10);
  }
}

const input = require('fs').readFileSync('/dev/stdin', 'utf8');
main(input);

Measured memory_bytes: 7372
//#pragma GCC optimize("trapv")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include<bits/stdc++.h>
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define pb push_back
#include <x86intrin.h>
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;
const int maxn = 2e6 + 55, mod = 1000000007, i2 = (mod+1)/2;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vi a(n);
	for(auto &i : a) cin >> i;
	sort(rall(a));
	ll e = 0;
	for(int i = 0; i < n; i++) {
		e += a[i] * 1ll * ((i+2)*1ll*i2%mod)%mod;
		e%=mod;
	}
	for(int i = 1; i < 2*n; i++) e = (e<<1)%mod;
	cout << e;
}


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

using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<n; i++)


int main() {
    string S;

    cin >> S;

    for(int i = 0; i < S.length()-1 ; i++){
        for(int j = i+1; j < S.length() ; j++){
            if(S[i]==S[j]){
                cout << "no" << endl;
                return 0;
            }
        }
    }
    cout << "yes" << endl;
}

Measured memory_bytes: 256
//Author: Suifeng0214
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int k;
	cin >> k;
	int tmp = 7;
	int ans = 1;
	bool flag = 0;
	for (int i = 0; i < k+1; i++){
		if (tmp%k==0){
			flag = 1;
			break;
		}
		tmp = (tmp*10+7)%k;
		ans++;
	}
	cout << ((flag == 1)? ans : -1) << "\n";
} 


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  string s;
  R s;
  rep(i,s.size()-1) {
    if(s[i]==s[i+1]) {
      pr("Bad");
      return;
    }
  }
  pr("Good");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256