akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<pll> p(n);
    rep(i,n){
        ll a,b; cin>>a>>b;
        p[i]=make_pair(a-b, a+b);
    }
    sort(all(p), [](pll a, pll b){return a.sc<b.sc;});

    ll ans=0, er=-LINF;
    rep(i,n){
        if(er<=p[i].fs){
            er=p[i].sc;
            ans++;
        }else{
            ;
        }
    }
    puta(ans);
    // puta(p);


    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>

char s[5];
int main(){
  scanf("%s", &s);
  int a = s[0] - '0', b = s[1] - '0', c = s[2] - '0', d = s[3] - '0';
  if(a + b + c + d == 7)printf("%d+%d+%d+%d=7\n", a,b,c,d);
  else if(a + b + c - d == 7)printf("%d+%d+%d-%d=7\n", a,b,c,d);
  else if(a + b - c + d == 7)printf("%d+%d-%d+%d=7\n", a,b,c,d);
  else if(a - b + c + d == 7)printf("%d-%d+%d+%d=7\n", a,b,c,d);
  else if(a + b - c - d == 7)printf("%d+%d-%d-%d=7\n", a,b,c,d);
  else if(a - b + c - d == 7)printf("%d-%d+%d-%d=7\n", a,b,c,d);
  else if(a - b - c + d == 7)printf("%d-%d-%d+%d=7\n", a,b,c,d);
  else if(a - b - c - d == 7)printf("%d-%d-%d-%d=7\n", a,b,c,d);

  return 0;
}

Measured memory_bytes: 128
S = input()
li = [0]*3
for i in S:
  if(i=='a'):
    li[0]+=1
  elif(i=='b'):
    li[1]+=1
  else:
    li[2]+=1
mul = 1
for i in li:
  mul *= i
if(mul == 0):
  print('No')
else:
  print('Yes')

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <list>
#include <bitset>
#include <numeric>
#include <utility>
#define INF 1e9
#define MOD 1000000007
#define MAX 210000
#define ll long long
using namespace std;
typedef unsigned long long ull;
typedef pair<int, int> p;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    int x[200],y[200],h[200];
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>h[i];
    }

    for(int i=0;i<101;i++){
        for(int j=0;j<101;j++){
            map<int,int>mp;
            vector<int> v;
            for(int k=0;k<n;k++){
                int xx=abs(i-x[k])+abs(j-y[k]);
                if(h[k]==0){
                    v.push_back(xx);
                }
                else{
                    mp[h[k]+xx]++;
                }
            }
            if(mp.size()>1){
                continue;
            }
            auto itr=mp.begin();
            int ans=itr->first;
            bool q=true;
            for(auto it:v){
                if(it<ans){
                    q=false;
                }
            }
            if(q){
                cout<<i<<" "<<j<<" "<<ans;
                return 0;
            }
        }
    }



    return 0;
}

Measured memory_bytes: 256
import java.util.*;


class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int a = Integer.parseInt(sc.next());
    int b = Integer.parseInt(sc.next());
    sc.close();
    
    int ans = a * n;
    if(b < ans){
      ans = b;
    }
    System.out.println(ans);
  }
}
      

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

int main(){
	int n, c;
	bool ans=false;
	cin >> n;
	c = n;
	while(c>=0){
		if(c%4==0){
			ans=true;
			break;
		}
		c-=7;
	}
	if(ans==true) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int n;cin >> n;
    vector<int> a,b,c,d;
    rep(i,n){
        int x,y;cin >> x >> y;
        a.push_back(x+y);
        b.push_back(x-y);
        c.push_back(y-x);
        d.push_back(-x-y);
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    sort(d.begin(),d.end());
    int ret = -1e18;
    ret = max(ret,a.back() - a[0]);
    ret = max(ret,b.back() - b[0]);
    ret = max(ret,c.back() - c[0]);
    ret = max(ret,d.back() - d[0]);
    cout << ret << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> h(n,0);
    for(int i=0;i<n;i++) cin >> h[i];
    vector<int> dp(n,(1<<30));
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        dp[i]=min(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
        if(i>=2) dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout << dp[n-1] << "\n";
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int dp[100005];
int H[100005];
void memo(int i,int n)
{
	if(i==n) return;
	dp[i] = min(dp[i-2]+abs(H[i-2]-H[i]),dp[i-1]+abs(H[i]-H[i-1]));
	memo(i+1,n);
}
int main()
{
	int N;cin>>N;
	for(int i=0;i<N;i++)
	{
        cin>>H[i];
	}
	memset(dp,0,sizeof(dp));
	dp[1] = abs(H[1]-H[0]);
	memo(2,N);
	cout<<dp[N-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
N=int(input())
A=list(map(int,input().split()))
dp=[float("INF")]*N
dp[0]=0
dp[1]=abs(A[0]-A[1])
for i in range(2,N):
  dp[i]=min(dp[i],abs(A[i]-A[i-1])+dp[i-1],abs(A[i-2]-A[i])+dp[i-2])
print(dp[-1])


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

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

using namespace std;

int main() {
  while(1){
    int n,m,q;
    cin>>n>>m>>q;
    if (!n)break;
    vector<bitset<1000>> ab(n);
    REP(i,n) ab[i].set();
    string state(m,'0');
    REP(i,q){
      string swt,ns;
      cin>>swt>>ns;
      REP(j,m)REP(k,n) {
        if((ns[j] != state[j]) != (swt[k] == '1'))
          ab[k][j] = false;
      }
      state = ns;
    }
    REP(i,m){
      int cnt = 0;
      int v = 0;
      REP(j,n){
        if(ab[j][i]) {
          ++cnt;
          v = j;
        }
      }
      if (cnt != 1) cout << '?';
      else if (v < 10) cout << (char)(v + '0');
      else cout << (char)(v - 10 + 'A');
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
// Not Found
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    string S;
    cin >> S;
    sort(S.begin(), S.end());

    bool alphabets[26] = {false};

    for (int i = 0; i < S.size(); ++i) {
        alphabets[S[i] - 'a'] = true;
    }

    for (int i = 0; i < 26; ++i) {
        if (!alphabets[i]) {
            cout << char('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
s = gets.chomp.chars
t = gets.chomp.chars
h = Hash.new{|hash, key| hash[key] = []}
g = Hash.new{|hash, key| hash[key] = []}
s.zip(t) do |c, d|
  h[c] << d unless h[c].include?(d)
  g[d] << c unless g[d].include?(c)
end
puts h.flatten(-1) == g.invert.flatten(-1) ? 'Yes' : 'No'

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

using namespace std;
using   ll=long long;

#define fast            ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define endl            "\n"
#define pb              push_back
#define mp              make_pair
#define F               first
#define S               second
#define int             long long int
#define pll                pair<int , int>

#define ALL(v)          v.begin(),v.end()
#define ALLR(v)         v.rbegin(),v.rend()
#define pii             3.14159265358979323
#define inf             LLONG_MAX
#define ones(x)         __builtin_popcount(x)
#define fill(a,b)       memset(a,b,sizeof(a))
#define mod             1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)    
    {
        if(b&1)     
        {
            res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
    return mod_pow(a , mod-2 , mod);
}

void solve() 
{
	int n , d;
	
	cin >> n >> d;
	
	int ans = 0;
	
	for(int i = 0; i < n; ++i) {
		double x , y;
		
		cin >> x >> y;
		
		if(sqrt(x*x+y*y) <= 1.00*d) {
			ans++;
		}
	}
	
	cout << ans;
}

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


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

int main() {
    ll m, s = 0, ans = 0;
    cin >> m;
    for (int i = 0; i < m; i++) {
        ll d, c;
        cin >> d >> c;
        ans -= (d - 1) * c;
        s += c * d;
    }
    ans += (s - 1) / 9 * 10 + (s - 1) % 9;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
   
    class Program
    {
        
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int told = 0;
            int xold = 0;
            int yold = 0;
            
            bool flag = true;
            for(int i = 1; i <= N; i++)
            {
                string[] str = Console.ReadLine().Split(' ');

                if (flag)
                {
                    int t = int.Parse(str[0]);
                    int x = int.Parse(str[1]);
                    int y = int.Parse(str[2]);
                    int delt = t - told;
                    int dis = Math.Abs(x - xold) + Math.Abs(y - yold);

                    if (dis > delt) flag = false;
                    else if (dis < delt && (delt - dis) % 2 != 0) flag = false;

                    told = t;
                    yold = y;
                    xold = x;
                }
                
            }

            Console.WriteLine(flag ? "Yes" : "No");

        }
    }
}

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

int main(){
    int n, m, x, cost_left, cost_right, a, ans;
    cin >> n >> m >> x;
    cost_left = 0;
    cost_right = 0;
    for(int i=0; i<m; i++){
        cin >> a;
        if(a == x){
            continue;
        }else if(a > x){
            cost_left++;
        }else{
            cost_right++;
        }
    }
    ans = min(cost_left, cost_right);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

using ll = long long;

int main() {
   ios_base::sync_with_stdio(false);
   int N;
   cin >> N;
   vector<vector<pair<int, int>>> adj(N);
   for (int i = 0; i < N - 1; ++i) {
      int v, u, w;
      cin >> v >> u >> w;
      adj[--v].emplace_back(--u, w);
      adj[u].emplace_back(v, w);
   }
   vector<int> sz(N);
   int centr = -1;
   int mw = 1e9;
   ll ans = 0;
   function<void(int, int)> dfs = [&](int v, int p) {
      bool good = true;
      sz[v] = 1;
      for (auto e : adj[v]) {
         int u, w;
         tie(u, w) = e;
         if (u == p) continue;
         dfs(u, v);
         sz[v] += sz[u];
         good &= (2 * sz[u] < N);
         if (2 * sz[u] == N) mw = w;
         ans += 2ll * w * min(sz[u], N - sz[u]);
      }
      good &= (2 * (N - sz[v]) < N);
      if (good) centr = v;
   };
   dfs(0, -1);
   if (mw == 1e9) {
      assert(centr != -1);
      for (auto e : adj[centr]) mw = min(mw, e.second);
   }
   ans -= mw;
   cout << ans << "\n";
   return 0;
}


Measured memory_bytes: 15488
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)


int main(){

    int result = 0;
    char tmp;
    cin >> tmp;
    if(tmp=='2'){
        result++;
    }
    cin >> tmp;
    if(tmp=='2'){
        result++;
    }
    cin >> tmp;
    if(tmp=='2'){
        result++;
    }
    cin >> tmp;
    if(tmp=='2'){
        result++;
    }
    cout<<result<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)


LL gcd(LL m, LL n) {
  if (m < n)
    return gcd(n, m);
  if (n == 0)
    return m;
  return gcd(n, m % n);
}
int main() {
  int N;
  cin >> N;

  LL lcm;
  cin >> lcm;
  REP(i, N - 1) {
    LL t;
    cin >> t;
    lcm *= t / gcd(lcm, t);
  }
  cout << lcm << endl;
  return 0;
}


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

using cap_type = int;

struct edge {
    int to, rev;
    cap_type cap;
    edge(int t, cap_type c, int r) : to(t), rev(r), cap(c) {}
};

using edges = vector<edge>;
using graph = vector<edges>;

void add_edge(graph& g, int from, int to, cap_type cap) {
    g[from].emplace_back(to, cap, g[to].size());
    g[to].emplace_back(from, 0, g[from].size() - 1);
}

cap_type augment(graph& g, std::vector<int> const& level, std::vector<int>& iter, int v, int t, cap_type f) {
    if(v == t) return f;
    for(int& i = iter[v]; i < (int)g[v].size(); ++i) {
        auto& e = g[v][i];
        if(e.cap > 0 && level[v] < level[e.to]) {
            const auto d = augment(g, level, iter, e.to, t, std::min(f, e.cap));
            if(d > 0) {
                e.cap -= d;
                g[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

cap_type max_flow(graph& g, int s, int t) {
    const auto inf = std::numeric_limits<cap_type>::max() / 2;
    cap_type flow = 0;
    while(true) {
        std::vector<int> level(g.size(), -1);
        level[s] = 0;
        std::queue<int> que;
        que.push(s);
        while(!que.empty()) {
            const int v = que.front();
            que.pop();
            for(auto const& e : g[v]) {
                if(e.cap > 0 && level[e.to] < 0) {
                    level[e.to] = level[v] + 1;
                    que.push(e.to);
                }
            }
        }

        if(level[t] < 0) return flow;
        std::vector<int> iter(g.size());
        cap_type f{0};
        while((f = augment(g, level, iter, s, t, inf)) > 0) {
            flow += f;
        }
    }
}

int main() {
    int V, E; cin >> V >> E;
    graph g(V);
    for(int i = 0; i < E; ++i) {
        int u, v, c; cin >> u >> v >> c;
        add_edge(g, u, v, c);
    }
    cout << max_flow(g, 0, V - 1) << endl;
}



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

int main() {
	int H, W;

	do {
		cin >> H >> W;
		if(H == 0 && W == 0) break;

		for(int h = 0; h < H; ++h) {
			if(h == 0 || h == H - 1) {
				for(int w = 0; w < W; ++w) {
					cout << "#";
				}
				cout << endl;
			} else {
				for(int w = 0; w < W; ++w) {
					if(w == 0 || w == W - 1) {
						cout << "#";
					} else {
						cout << ".";
					}
				}
				cout << endl;
			}
		}
		cout << endl;
	} while(true);
	
	return 0;
}

Measured memory_bytes: 3132
from functools import reduce
from fractions import gcd
N =  int(input())
A =  list(map(int, (input().split(' '))))

from itertools import accumulate

gcds = []
left_all_gcd = list(accumulate(A, gcd))
right_all_gcd = list(accumulate(A[::-1], gcd))
for i in range(len(A)):
    if i == 0:
        gcds.append(right_all_gcd[-2])
    if i == len(A)-1:
        gcds.append(left_all_gcd[-2])
    else:
        hoge = [left_all_gcd[i-1]] + [right_all_gcd[-i-1]]
        gcds.append(gcd(left_all_gcd[i-1], right_all_gcd[-i-2]))

print(max(gcds))


Measured memory_bytes: 16148
#include <stdio.h>
int main(void){
    int N,K;
    scanf("%d",&N);
    char S[N];
    scanf("%s",&S);
    scanf("%d",&K);
    
    for(int i=0;i<N;i++) if(S[i]!=S[K-1]) S[i]='*';
    
    printf("%s",S);
    
    return 0;
}

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

#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = n - 1; i < (int)n; --i)
#define FOR(i, l, r) for (int i = (int)(l); i < (int)(r); ++i)
#define RFOR(i, l, r) for (int i = (int)(r); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

vector<int> es[200001];

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n, q;
    cin >> n >> q;


    REP(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--; b--;

        es[a].push_back(b);
        es[b].push_back(a);
    }

    vector<int> v(n, 0);
    REP(i, q) {
        int p, q;
        cin >> p >> q;
        v[p - 1] += q;
    }
    
    deque<pair<int, int>> deq;
    deq.emplace_back(0, 0);

    vector<bool> used(n, false);
    vector<int> ans (n, 0);

    while (!deq.empty()) {
        int u, val;
        tie(u, val) = deq.front();
        deq.pop_front();

        used[u] = true;
        ans[u] = val = val + v[u];

        for (auto v: es[u]) {
            if (used[v]) continue;

            deq.emplace_back(v, val);
        }
    }

    REP(i,n) {
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 17140
import java.util.*;
import java.io.*;
import java.math.*;

public class Main{

  static long[] fact;
  static long m = 1_000_000_007L;

  static long modPow(long base, long exp, long mod){
    long ans = 1L;
    while (exp != 0) {
      if (exp % 2 != 0)
        ans = ans * base % mod;
      exp >>= 1;
      base %= mod;
      base = base * base % mod;
    }

    return ans;
  }

  static long nck(int n, int k){
    if(n<k)
      return 0;
    return fact[n]*modPow(fact[k], m-2, m)%m*modPow(fact[n-k], m-2, m)%m;
  }

  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    Integer n = Integer.parseInt(in.readLine());
    Integer[] a = Arrays.stream(in.readLine().split(" ")).map(Integer::parseInt).toArray(Integer[]::new);
    int left=0, right=0;
    int[] cnt = new int[n + 1];

    for (int i = 0; i < n + 1; ++i) {
      if (cnt[a[i]-1] != 0) {
        right = i+1;
        left = cnt[a[i]-1];
      }
      cnt[a[i]-1] = i+1;
    }


    fact = new long[n+2];

    fact[0] = 1;
    for(int i=1;i<n+2;i++){
      fact[i] = fact[i-1] * i % m;
    }

    StringBuffer sb = new StringBuffer();
    long b,c;
    for(int i=1;i<=n+1;i++){
      b = nck(n+1, i);
      c = nck(left+n-right, i-1);
      // System.out.println(b);
      // System.out.println(c);
      // System.out.println();
      sb.append((b - c + m) % m);
      sb.append("\n");
    }
    System.out.print(sb.toString());
  }
}


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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N,M,res = 0;
    cin>>N>>M;
    Graph G(N);//0-ind
    vector<int> X(M),Y(M),Z(M);
    rep(i,M){
        cin>>X[i]>>Y[i]>>Z[i];
        G[X[i]-1].push_back(Y[i]-1);
        G[Y[i]-1].push_back(X[i]-1);
    }
    vector<int> dist(N,-1);
    rep(i,N){
        if(dist[i]!=-1)continue;
        res++;
        queue<int> Q;
        Q.push(i);
        dist[i] = 0;
        while(!Q.empty()){
            int v = Q.front(); Q.pop();
            for(auto nv: G[v]){
                if(dist[nv]!=-1)continue;
                dist[nv] = dist[v] + 1;
                Q.push(nv);
            }
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 10812
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(b / a, c) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N, A, B, C, D;
    cin >> A >> B >> C >> D;
    A = max(A, C);
    B = min(B, D);
    N = B-A;

    cout << (N < 0? 0: N) << endl;

}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int i,j,n,f=0;
	cin>>n;
	for(i = 0 ; i<=n/4 ; i++){
		for(j = 0;j<=n/7;j++){
			if(4*i+7*j==n) f=1;
		}
	}
	if(f==1) cout<<"Yes";
	else cout<<"No"; 
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int A, B;
	char op;
	scanf("%d %c %d", &A, &op, &B);
	if (op == '+') {
	
		printf("%d\n", A+B);
	}else if (op == '-') {
		
		printf("%d\n", A-B);
	
	}else
		printf("not valid");
		
}

Measured memory_bytes: 1720
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#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 all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }


bool f[10][10] = {};
int N, M;

signed main() {
	cin >> N >> M;
	rep(i, 0, M) {
		int a, b; cin >> a >> b;
		a--, b--;
		f[a][b] = f[b][a] = true;
	}
	vector<int> v(N);
	iota(all(v), 0);
	int ans = 0;
	do {
		bool flag = true;
		rep(i, 1, N) {
			if (!f[v[i]][v[i - 1]]) {
				flag = false;
				break;
			}
		}
		if (flag)ans++;
	} while (next_permutation(v.begin() + 1, v.end()));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// AOJ DSL_3_A The Smallest Window I
// 2018.5.5 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int s[100002];

int main()
{
	int N, S, i, j, ans;

	N = in(), S = in();
	for (i = 1; i <= N; i++) s[i] = s[i-1] + in();
	if (s[N] < S) { puts("0"); return 0; }
	if (s[N] == S) { printf("%d\n", N); return 0; }
	for (j = 1; s[j] < S; j++);
	ans = j;
	i = 0;
	while (1) {
		while (s[j]-s[i] >= S) i++;
		if (j-i+1 < ans) ans = j-i+1;
//printf("i %d, j %d, j-i+1 %d, ans %d\n", i, j, j-i+1, ans);
		while (j <= N && s[j]-s[i] < S) j++;
		if (j > N) break;
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 2236
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        if (s.substring(2, 3).equals(s.substring(3, 4))
            && s.substring(4, 5).equals(s.substring(5, 6))) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 22740
#include<stdio.h>
#include<math.h>
double Koch(int,double,double,double,double);
int main()
{
  int n;
  scanf("%d",&n);
  printf("%.8f %.8f\n",0.0,0.0);
  Koch(n,0,0,100,0);
  printf("%.8f %.8f\n",100.0,0.0);
  return 0;
}
 
double Koch(int n,double leftx,double lefty,double rightx,double righty)
{
  if(n!=0){
  double santou[3][2];
  santou[0][0]=(2*leftx+rightx)/3;
  santou[0][1]=(2*lefty+righty)/3;
  santou[2][0]=(leftx+2*rightx)/3;
  santou[2][1]=(lefty+2*righty)/3;
 
  santou[1][0]=(santou[2][0]-santou[0][0])/2-(santou[2][1]-santou[0][1])*sqrt(3)/2+santou[0][0];
  santou[1][1]=(santou[2][0]-santou[0][0])*sqrt(3)/2+(santou[2][1]-santou[0][1])/2+santou[0][1];
   
Koch(n-1,leftx,lefty,santou[0][0],santou[0][1]);
  printf("%.8f %.8f\n",santou[0][0],santou[0][1]);
  Koch(n-1,santou[0][0],santou[0][1],santou[1][0],santou[1][1]);
  printf("%.8f %.8f\n",santou[1][0],santou[1][1]);
  Koch(n-1,santou[1][0],santou[1][1],santou[2][0],santou[2][1]); 
  printf("%.8f %.8f\n",santou[2][0],santou[2][1]);
  Koch(n-1,santou[2][0],santou[2][1],rightx,righty); 
  }
  if(n==0)return 0;
   
}



Measured memory_bytes: 2112
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S = input().strip()

    ans = 0
    b = 0
    for s in S:
        if s == "B":
            b += 1
        else:
            ans += b

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3500
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll

int a[100005];
int sum[100005];
map<int,int> mp;

signed main(){
  int n,m;
  cin>>n>>m;
  mp[0]=1;
  sum[0]=0;
  int ret=0;
  for(int i=1; i<=n; i++){
    cin>>a[i];
    sum[i]=sum[i-1]+a[i];
    ret+=mp[sum[i]%m];
    mp[sum[i]%m]++;
  }
  cout<<ret<<en;
}



Measured memory_bytes: 5760
#include <iostream>
#include <string>

using namespace std;

char META_CHARACTER[] = "z.?! ";

int main(void){
	for(string in, out; cin >> in; cout << out << endl){
		out.clear();
		if(in.length() % 2){ out = "NA"; continue; }

		for(int i = 0; i < in.length(); i += 2){
			int col = in.at(i) - '1';
			int row = in.at(i + 1) - '1';

			if(col < 0 || 5 < col ||
			   row < 0 || 4 < row){ out = "NA"; break; }

			if(col == 5){ out.push_back(META_CHARACTER[row]); }
			else{ out.push_back('a' + 5 * col + row); }
		}
	}
		
		
	return 0;
}

Measured memory_bytes: 1188
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
p = [1, 3, 6, 10, 15, 21, 28, 36]
n = int(input())
sss  = factorization(n)
ans = 0
if(n == 1):
    print(0)
else:
    for i in sss:
        s = 7
        while(i[1] < p[s]):
            s -= 1
        ans += s+1
    print(ans)


Measured memory_bytes: 9492
m,d = map(int,input().split())
c = 0

for i in range(1,m+1):
    for j in range(1,d+1):
        if j >=10:
            tmp = str(j)[0]
            tmp2 = str(j)[1]
            if i == int(tmp) * int(tmp2) and int(tmp) >=2 and int(tmp2) >= 2:
                c += 1
print(c)



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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); 
  long long x, k, d;
  cin >> x >> k >> d;
  if (x < 0) x = abs(x);
  long long move = min(k, x / d);
  k -= move;
  x -= move * d;
  if (k & 1) {
    x = min(abs(x + d), abs(x - d));
  }
  cout << x << "\n";
}

Measured memory_bytes: 3664
n=int(input())
a=[]
for i in range(n):
	a.append(int(input()))
b=['']*n
b[0]='hoge'
c=0
x=0
while True:
	c+=1
	x=a[x]-1
	if b[x]=='hoge':
		c=-1
		break
	else:
		b[x]='hoge'
		if x==1:
			break
print(c)



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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;


int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  bool ans = false;
  rep(i, 0, a)rep(j, 1, b + 1){
    if(a * j - b * i == c) ans = true;
  }
  cout << (ans ? "YES" : "NO") << endl;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define REV(x) reverse(ALL((x)))
#define pb push_back


ll modpow(ll a, ll n, ll m)
{
    if(n == 0) return 1;
    ll t = modpow(a, n >> 1, m);
    t = t * t % m;
    if(n & 1) t = t * a % m;
    return t; 
}


int main()
{
    string L;
    cin >> L;
    ll N = SZ(L);
    L = "0" + L;

    mat dp(N+1, vec(2, 0));
    dp[0][0] = 1;

    REP(i,1,N+1) {
        if(L[i] == '0') {
            dp[i][0] = dp[i-1][0] % MOD;
            dp[i][1] = (dp[i-1][1] * 3) % MOD;
        }
        else {
            dp[i][0] = (dp[i-1][0] * 2) % MOD;
            dp[i][1] = (dp[i-1][0] + dp[i-1][1] * 3) % MOD;
        }
    }

    PR((dp[N][0]+dp[N][1])%MOD);

    /*
    ll sum = 0, c1 = 0, i = 1;
    while(i <= N) {
        while(L[i] == '0') ++i;
        if(L[i] == '1') {
            sum = (sum + (modpow(3, N-i, MOD) * modpow(2, c1, MOD)) % MOD) % MOD;
            ++c1;
            ++i;
        }
    }
    sum = sum + modpow(2, c1, MOD);

    PR(sum);
    */
   
    return 0;
}

/*



*/

Measured memory_bytes: 8868
import java.util.*;
import static java.lang.Math.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] p = new int[n];

        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }

        Arrays.sort(p);

        int ans = 0;
        for (int i = 0; i < k; i++) {
            ans += p[i];
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 38724
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/23 09:53:37 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	ll	x;
	cin >> x;

	ll sum = 0;
	for (ll i = 0;;i++)
	{
		sum += i;
		if (sum >= x)
		{
			cout << i << endl;
			return ;
		}
	}
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    string s; cin >> s;
    int k; cin >> k; k--;

    for(int i = 0; i < s.size(); i++) {
        if(s[i] - '0' != 1 && k >= i) {
            cout << s[i] << endl;
            return 0;
        }
    }

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


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

int main(){

    int N,M;
    int i,j,k;
    int v;

    scanf("%d",&N);

    int T[N+1];

    for(i=1;i<N+1;i++){
        scanf("%d",&v);
        T[i] = v;
    }

    scanf("%d",&M);

    int PX[2][M+1];
    int p,x;

    for(i=1;i<M+1;i++){
        scanf("%d %d",&p,&x);
        PX[0][i] = p;
        PX[1][i] = x;
       // printf("%d %d\n", p,x);
    }

    int count = 1;
    int sum = 0;

    for(j=1;j<M+1;j++){
        for(i=1;i<N+1;i++){
            if(i == PX[0][count]){
                sum += PX[1][count];
            }
            else{
                 sum += T[i];
            }
        }
        count += 1;
        printf("%d\n",sum);
        sum = 0;
    }
    return 0;
}

Measured memory_bytes: 128
n = int(input())
a = [int(x) for x in input().split()]

def odd_positive(List):
    sum_a = 0
    cost = 0
    i = 0
    for a in List:
        i += 1
        sum_a += a
        if i & 1 and sum_a <= 0:
            cost += - sum_a + 1
            sum_a = 1
        elif (not i & 1) and sum_a >= 0:
            cost += sum_a + 1
            sum_a = -1
    return cost


def odd_negative(List):
    sum_a = 0
    cost = 0
    i = 0
    for a in List:
        i += 1
        sum_a += a
        if i & 1 and sum_a >= 0:
            cost += sum_a + 1
            sum_a = -1
        elif (not i & 1) and sum_a <= 0:
            cost += - sum_a + 1
            sum_a = 1
    return cost
    
ans = min(odd_positive(a), odd_negative(a)) 
print(ans)


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

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a)
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;

inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=200005;
//i_am_noob
int n,a[maxn],x=0;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> n;
    rep(n) cin >> a[i];
    rep(n) x^=a[i];
    rep(n) print0(x^a[i]);
    cout << "\n";
	return 0;
}


Measured memory_bytes: 5180
N = int(input())
num = N
count = 0
result = 0

while num >= 1:
    num = num / 10
    count += 1

if count % 2 == 0:
    count -= 1
    while count > 0:
        result += 10**(count)-10**(count-1)
        count -= 2
else:
    result = result + N - 10**(count-1) + 1
    count -= 2
    while count > 0:
        result += 10**(count)-10**(count-1)
        count -= 2

print(result)

Measured memory_bytes: 8952
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef pair<pl, ll> ppl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n;
  cin >> n;

  ll ans = 0;
  rep2(a, 1, n-1) ans += (n-1)/a;
  cout << ans << newl;
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define ll long long int
#define ld long double
#define pb push_back 
#define ff first 
#define ss second
#define all(c) c.begin(), c.end()
#define sz(z) (int)z.size()
#define rep(i,a,b) for(int i=a; i<b; ++i)
#define rev(i,a,b) for(int i=a; i>=b; i--)
//Debugging tools 
#define debug(v) cout<<#v<<endl;for(ll i=0; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl;
#define debugn(v,n) cout<<#v<<endl;for(ll i=0; i<n; i++) cout<<v[i]<<" "; cout<<endl;
#define deb(sum) cout<<#sum<<" = "<<sum<<endl;
//Predefined values
#define INF (ll)1e18
#define endl "\n"
#define pi 3.142857142857143
const ll MOD = 1e9 + 7;


int main() { 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.in","r",stdin);
        freopen("output.in","w",stdout);
    #endif
    int t=1;    
    //cin>>t;
    while(t--){
        int n,k,tm;
        cin>>n>>k>>tm;
        if(n%k==0)
            cout<<(n/k)*tm<<endl;
        else
            cout<<(n/k + 1)*tm<<endl;
        
    }
  return 0;
 }

















Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
#include<type_traits>

long long int D[10000];
long long int E[400000];

using namespace std;
int main() {
	long long int N;
	long long int Y = -1;
	cin >> N;
	while (N) {
		Y++;
		for (long long int i = 0; i < N; i++) {
			cin >> D[i];
		}

		sort(D, D + N);
		long long int W = 0;
		for (long long int i = 1; i < N-1; i++) {
			W += D[i];
		}
		E[Y] = W / (N-2);
		cin >> N;
		
	}

	for (long long int i = 0; i <=Y ;i++) {
		cout << E[i] << endl;
	}
	return 0;
}




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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> v(n),c(n);

    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    for(int i=0;i<n;i++){
        cin>>c[i];
    }

    int res=0;
    for(int i=0;i<n;i++){
        if(v[i]>c[i])
            res += v[i]-c[i];
    }
    cout<<res;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> N;
  ll A[N];

  for(int i=0;i<N;i++){
  	cin >> A[i];
  }

  sort(A,A+N);

  int count = 0;
  int i=0;
  while(i<N){
  	if(A[i]==A[i+1]){
  		i+=2;
  	}else{
  		count++;
  		i++;
  	}
  }
  cout << count <<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>


typedef struct Point{
  double x,y;
}A;

void koch(int n,A a,A b){
  if(n==0)return;
  A s,t,u;
  double th=M_PI*60.0/180.0;

  s.x =(2.0*a.x+1.0*b.x)/3.0;
  s.y =(2.0*a.y+1.0*b.y)/3.0;
  t.x =(1.0*a.x+2.0*b.x)/3.0;
  t.y =(1.0*a.y+2.0*b.y)/3.0;
  u.x =(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
  u.y =(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;

  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);
}

int main() {
  A a,b;
  int n;
  scanf("%d",&n);
  a.x=0;
  a.y=0;
  b.x=100;
  b.y=0;

  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);
  return 0;
}



Measured memory_bytes: 1988
#include<iostream>

using namespace std;
	long long h[1000010];
	long long n,m,k;
int main(){

	cin>>n>>m>>k;

	for(int i=0;i<k;i++){
		int x;
		cin>>x;
		h[x]++;
	}
	for(int i=1;i<=n;i++){
		if(m-(k-h[i])<=0) cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
	return 0;
}

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

int main() {
  long n,t,ans;
  cin >> n >> t;
  ans=t;
  vector<long> vect(n);
  for(long i=0;i<n;i++) cin >> vect[i];
  for(long i=1;i<n;i++) {
    ans+=min(vect[i]-vect[i-1],t);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	ll a, b;
	cin >> a >> b;
	ll ans = 0;
	ll l = a, r = b;
	if (a & 1) {
		ans ^= a;
		l = a + 1;
	}
	if (!(b & 1)) {
		ans ^= b;
		r = b - 1;
	}
	ll prs = max(0ll, (r - l + 1) / 2);
	if (prs & 1) {
		ans ^= 1;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256