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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

int main() {
  int x, y; cin >> x >> y;
  cout << x + y / 2 << endl;

  return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char x[100005],y;
int g,z;
int main()
{
    while(x[z]=getchar(),x[z]!='\n')
    {

        if(z==0)y=x[z];
        if(x[z]!=y)g++,y=x[z];

        z++;
    }

    cout<<g<<endl; 
    return 0;
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    N=ii()
    if N&1==1:
        print(0)
        return
    ans = 0
    fi = 10
    while N >= fi:
        ans += N//fi
        fi *= 5
    print(ans)

main()


Measured memory_bytes: 5044
#include <stdio.h>

int main(void)
{
	long long memo,A,B,N,x,max=0;
	scanf("%lld",&A);
	scanf("%lld",&B);
	scanf("%lld",&N);
	if(B<=N){
		max=A*(B-1)/B;
	}else{
		max=A*N/B;
	}
	printf("%lld",max);
	return 0;
}

Measured memory_bytes: 1724
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
// ALDS1_9_C

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

    PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
 
    String command = sc.nextStr();
    while(command.charAt(2) != 'd'){
      if(command.charAt(0) == 'i'){// insert
        int comnum = sc.nextInt();
        pq.add(-comnum);
      }else{// extractMax
        System.out.println(-pq.poll());
      }

      command = sc.nextStr();
    }    

  }
 
//nextChar ?????????????????????

//System.out.printf("? %d %d\n", i, j);

  
// LinkedList<Integer>[] setsu = new LinkedList[n];
// for(int i = 0; i < n; i++){
//   setsu[i] = new LinkedList<Integer>();
// } 

 //???????????????????????¬
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;

      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }

      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }

      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

Measured memory_bytes: 185388
#include <iostream>
#include <string>
#include <cmath>
#include <ctime>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <set>
using namespace std;

int main(){
long long a = 100, x;
cin >> x;
int cnt = 0;

while(true){
    a = floor(a*1.01);
    cnt++;
    if(a >= x){
        cout << cnt << endl;
        return 0;
    }
}

}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e18;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  string s;
  cin >> s;
  string t = "CODEFESTIVAL2016";
  ll count = 0;
  rep(i,16){
    if(s[i]!=t[i]){
      count++;
    }
  }
  print(count);
}


Measured memory_bytes: 3556
// 2019/06/02
// AtCoder Beginner Contest 088 - A 

#include<iostream>
using namespace std;
int main()
{
    // Input
    int n;
    int a;
    cin >> n;
    cin >> a;

    string ans = "";

    // Calc
    int rem_c = n % 500;
    if(rem_c <= a){
        ans = "Yes";
    } else {
        ans = "No";
    }

    // Output
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
a = []
for i in range(10):
    a.append(input())

for i in range(len(a)):
    for s in range(i+1,len(a)):
        if a[i] < a[s]:
            tmp = a[s]
            a[s] = a[i]
            a[i] = tmp


for i in range(3):
    print a[i]

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

int main(){
	ll a,b,c,k; 
	cin>>a>>b>>c>>k;
	if(a>=k)cout<<k<<endl;
	else if(a+b>=k)cout<<a<<endl;
	else{
		ll s = k-(a+b);
		cout<<a-s<<endl;
	}
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
#define pb push_back
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; }


int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int cnt = 0;
    if(S[0] == S[1] && S[2] == S[3] && S[0] != S[2]){
        cout << "Yes" << endl;
        return 0;
    }
    else if(S[0] == S[2] && S[1] == S[3] && S[0] != S[1]){
                cout << "Yes" << endl;
        return 0;
    }
    else if(S[0] == S[3] && S[1] == S[2] && S[0] != S[1]){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
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;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;
//|\_
//g++ -std=c++1z temp.cpp
//./a.out





int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    string s;
    cin>>s;
    cout<<count(s.cbegin(), s.cend(), '1')<<endl;
    
//////////////////////////////////////////////////////
return 0;}


Measured memory_bytes: 256
#include <stdio.h>
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	int n;
	scanf("%d",&n);
	int ans=1e6,s=0;
	for(int i=1;i<=n;i++){
		int t;
		scanf("%d",&t);
		s+=t;
		ans=min(ans,s/i);
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

int cost[111][111];
int minc[111];
bool used[111];
int n, m;

int prim() {
    for (int i = 0; i < n; i++) {
        minc[i] = INF;
        used[i] = false;
    }
    minc[0] = 0;
    int res = 0;
    while (1) {
        int v = -1;
        for (int u = 0; u < n; u++) {
            if (!used[u] && (v == -1 || minc[u] < minc[v])) v = u;
        }
        if (v == -1) break;
        used[v] = true;
        res += minc[v];
        for (int u = 0; u < n; u++) {
            minc[u] = min(minc[u], cost[v][u]);
        }
    }
    return res;
}

int main() {
    while (cin >> n >> m && (n != 0 || m != 0)) {
        for (int i = 0; i < 111; i++) {
            for (int j = 0; j < 111; j++) {
                cost[i][j] = INF;
            }
        }
        for (int i = 0, a, b, c; i < m; i++) {
            cin >> a >> b >> c;
            cost[a][b] = cost[b][a] = c;
        }
        int ans = prim();
        cout << ans << endl;
    }
}


Measured memory_bytes: 3132
#include<iostream>
#include<vector>
using namespace std;
int main(void){
  int k,n,temp,ans;
  cin>>k>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  temp=v[0]+(k-v[n-1]);
  for(int i=1;i<n;i++){
    int temp2=v[i]-v[i-1];
    if(temp2>temp){
      temp=temp2;
    }
  }
  ans=k-temp;
  cout<<ans<<endl;
  return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

vector< vector<int> > edge;
vector<bool> used;

pair<int, int> dfs( int v )
{
	int fMax = 0;
	int fMax_v = v;
	used[v] = true;
	for( auto to : edge[v] )
	{
		if( !used[to] )
		{
			used[to] = true;
			auto p = dfs( to );
			if( fMax < p.second + 1 )
			{
				fMax = p.second + 1;
				fMax_v = p.first;
			}
		}
	}
	return pair<int,int>( fMax_v, fMax );
}

int main()
{
	int n, m;
	cin >> n;
	m = n - 1;

	edge.assign(n,vector<int>());
	used.assign(n,false);
	REP( i, m )
	{
		int a, b;
		cin >> a >> b;
		edge[a-1].push_back( b-1 );
		edge[b-1].push_back( a-1 );
	}

	fill( ALL(used), false );
	auto lon = dfs( 0 );
	//cout << lon.first << " " << lon.second << endl;
	fill( ALL(used), false );
	auto lonn = dfs( lon.first );
	//cout << lonn.first << " " << lonn.second << endl;

	cout << ( lonn.second % 3 == 1 ? "Second" : "First" ) << endl;

	return 0;
}

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

int main(){
        long N,P;
        long ans;
        cin >> N >> P;
        ans = (long)pow(P,1/(long double)N);
        while(P % (long)pow(ans,N) != 0){
          ans--;
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    int res = 0;
    int cnt = 0;
    if(K < A) {
        cout << K << endl;
    } else if(K >= A && K <= A + B) {
        cout << A << endl;
    } else {
        cout << A - (K - (A + B)) << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
from functools import reduce

def main():
    n, a, b = map(int, input().split())
    p = 10 ** 9 + 7

    ans = pow(2, n, p) - 1

    print((ans - comb(n,a,p) - comb(n,b,p)) % p)

def comb(n, r, p):
    r = min(r, n-r)
    if r == 0:
        return 1
    
    num = reduce(lambda x, y: (x * y) % p, range(n, n - r, -1))
    den = reduce(lambda x, y: (x * y) % p, range(1, r + 1))

    return (num * pow(den, p - 2, p)) % p

if __name__ == '__main__':
    main()

Measured memory_bytes: 9544
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Test | diff Test.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Test.cpp && ./a.out

/*

 5/25/2020

 22:28-

 */

const int MAX_N=100+1;
II P[MAX_N];
int N,K;

void solve() {
  LL res=4e18;
  sort(P,P+N);
  VI xs;
  REP(i,N) xs.push_back(P[i].first);
  sort(ALL(xs)),xs.erase(unique(ALL(xs)), xs.end());
  int M=SZ(xs);
  REP(i,M)FOR(j,i,M) {
    VI ys;
    REP(k,N) if(xs[i]<=P[k].first&&P[k].first<=xs[j]) {
      ys.push_back(P[k].second);
    }
    sort(ALL(ys));
    //dump(xs[i],xs[j]);
    //dumpc(ys);
    int L=SZ(ys);
    LL dx=xs[j]-xs[i];
    REP(k,L-K+1) {
      SMIN(res,dx*(ys[k+K-1]-ys[k]));
    }
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>N>>K;
  REP(i,N) {
    int x,y; cin>>x>>y;
    P[i]={x,y};
  }
  solve();

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAX_N = 505; 
struct Station
{
	int C, S, F;
}sta[MAX_N];
int sum[MAX_N],ans[MAX_N];

int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		sum[1] = 0; 
		for(int i = 1; i < n; i++)
		{
			scanf("%d%d%d",&sta[i].C,&sta[i].S,&sta[i].F);
			sum[i+1] = sum[i] + sta[i].C;
		}
		for(int i = 1; i < n; i++) 
		{
			int temp, arr = sta[i].S + sta[i].C;
			for(int j = i + 1; j < n; j++)
			{
				if(sta[j].S < arr)
				{
					int t = (arr - sta[j].S) % sta[j].F;
					if(t == 0) 
						temp = arr;				 
					else 
						temp = arr + sta[j].F - t;		
				}
				else
				{
					temp = sta[j].S;					
				}
				arr = temp + sta[j].C;					
			}
			ans[i] = arr;								
		}	
		ans[n] = 0;
		for(int i = 1; i <= n; i++)
		{
			printf("%d\n",ans[i]);
		}
	}
	return 0;
} 


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

int main(){
  int a,b;
  cin>>a>>b;
  vector<int> c(a);
  for(int i=0;i<a;i++)
    cin>>c.at(i);
  sort(c.begin(),c.end());
  int d=a-b+1,e=b-1,f=1000000000;
  for(int i=0;i<d;i++)
    f=min(f,c.at(i+e)-c.at(i));
  cout<<f<<endl;
}

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

int main() {
    string S;
    cin >> S;
    ll NS = S.size();
    vector<int> N(NS);
    for (ll i=0; i<NS; i++) {
        N[i] = S[i]-'0';
    }
    ll count = 0;
    for (ll i=0; i<NS; i++) {
        count += N[i];
    }
    string ans = "No";
    if (count%9 == 0) {
        ans = "Yes";
    }
    cout << ans << endl;
}

Measured memory_bytes: 4452
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    string ans="NO";
    if(b-a==c-b){
        ans = "YES";
    }
    cout << ans << endl;
}

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

int main() {
    int k,x;
    cin >> k >> x;
    cout << (k * 500 >= x ? "Yes\n" : "No\n");
}

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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll  = long long;
using ii  = pair<int, int>;
using vi  = vector<int>;
using vd  = vector<double>;
using vb  = vector<bool>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int cnt[1010];

void f(int v) {
	for (int i = 2; v > 1; ++i) {
		while (v % i == 0) cnt[i]++, v /= i;
	}
}

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

	for (int i = 2; i <= n; ++i) {
		f(i);
	}

	ll ans = 1;
	for (int i = 1; i <= n; ++i) ans = ans * (cnt[i] + 1) % mod;
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	private static Scanner in;
	
	private static int n;
	private static int[] a;
	private static long[][] dp;
	private static final int MOD = (int)1e9+7;
	
	public static void main(String[] args) {
		in = new Scanner(System.in);
		n = in.nextInt();
		a =  new int[n];
		for(int i=0; i<n; i++) {
			a[i] = in.nextInt();
		}
		
		dp = new long[n+1][n+1];
		
		for(int i=0; i<dp.length; i++)
			Arrays.fill(dp[i], -1);
		
		
		
		System.out.println(solve(0, n-1, 0));
	
	}
	
	private static long solve(int l, int r, int f) {
		int multiplier = (f==0?1:-1);
		if (l==r) return multiplier*a[l];
		
		if (dp[l][r]!=-1) return dp[l][r];
		
		
		long ans = 0;
		
		if (f==0) {
			ans = Math.max(a[l]+solve(l+1, r, 1-f), a[r]+solve(l, r-1, 1-f));
		} else {
			ans = Math.min(-1*a[l]+solve(l+1, r, 1-f), -1*a[r]+solve(l, r-1, 1-f));
		}
		return dp[l][r] = ans;
		
	}

}


Measured memory_bytes: 130168
declare function require(x: string): any;

var input = require("fs").readFileSync("/dev/stdin", "utf8");
input = input.split("\n");

let n = +input.shift();
let a = input.shift().split(" ").map((x:string)=>{return +x});

a.sort((x:number,y:number)=>{return x-y;});

let b = [];
for(let i=0; i<a.length; i++){
	if(b[a[i]] === undefined) {
		b[a[i]] = 1;
	}
	else{
		b[a[i]]++;
	}
}

let d=0;
let v=0;
for(let x of b){
	if(x === undefined) continue;
	v++;
	if(x%2==0){
		d++;
	}
}

if(d%2==0){
	console.log(v);
}
else{
	console.log(v-1);
}


Measured memory_bytes: 28372
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    int A, B;
    cin >> A >> B;
    cout << A * B << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define putchar putchar_unlocked
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
inline bool getA() {
	bool A;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = ct & 1;
	else while ((ct = *ci++) >= '0') A = ct & 1;
	return A;
}

const int dm = 1 << 21;
char dn[dm], *di = dn, dt;
inline void putints(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) *di++ = (*(C + i));
	*di++ = ' ';
}
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) *di++ = (*(C + i));
	*di++ = '\n';
}

inline void putk(int X) {
	if (X == 0) putchar('0');
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) putchar(*(C + i));
	putchar('\n');
}

int main() {


	int H, W;
	bool a = 0, b = 0;
	H = getint();
	W = getint();
	int k = 0;
	rep1(i, H) {
		rep1(ii, W - 1) {
			a ^= getA();
			if (a) {
				k++;
				putints(i);
				putints(ii);
				putints(i);
				putint(ii + 1);
			}
		}
		if (i != H) {
			b ^= a ^ getA();
			if (b) {
				k++;
				putints(i);
				putints(W);
				putints(i + 1);
				putint(W);
			}
		}
		a = false;
	}

	putk(k);
	for (auto p = dn; p != di; p++) putchar(*p);

	Would you please return 0;
}

Measured memory_bytes: 4096
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int n;
int r,c,q;
int r1,c1,r2,c2;
int tmp;
vector<int> seg[1000];

void init(int num,int n_){
  for(int i=0;i<2*n_-1;i++)seg[num].push_back( (1<<31)-1 );
}

void update(int x,int k, int a){
  k += n-1;
  seg[x][k] = a;
  while(k>0){
    k = (k-1) / 2;
    seg[x][k] = min(seg[x][k*2+1], seg[x][k*2+2]);
  }
}

int query(int x, int a, int b, int k, int l, int r){
  if(r<=a || b<=l)return (1<<31) - 1;
  if(a<=l && r<=b)return seg[x][k];
  else{
    return min(query(x,a,b,2*k+1,l,(l+r)/2),query(x,a,b,2*k+2,(l+r)/2,r));
  }
}

int main(){
  while(1){
    cin >> r >> c >> q;
    if(!r && !c && !q)break;

    if(r>=c){
      n = 1;
      while(n<r)n *= 2;
      for(int i=0;i<c;i++)init(i,n);
      for(int i=0;i<r;i++){
	for(int j=0;j<c;j++){
	  cin >> tmp;
	  update(j,i,tmp);
	}
      }
      while(q--){
	cin >> r1 >> c1 >> r2 >> c2;
	int ans = (1<<31) - 1;
	for(int i=c1;i<=c2;i++)ans = min(ans,query(i,r1,r2+1,0,0,n));
	cout << ans << endl;
      }
    }else{
      n = 1;
      while(n<c)n *= 2;
      for(int i=0;i<r;i++)init(i,n);
      for(int i=0;i<r;i++){
	for(int j=0;j<c;j++){
	  cin >> tmp;
	  update(i,j,tmp);
	}
      }
      while(q--){
	cin >> r1 >> c1 >> r2 >> c2;
	int ans = (1<<31) - 1;
	for(int i=r1;i<=r2;i++)ans = min(ans,query(i,c1,c2+1,0,0,n));
	cout << ans << endl;
      }
    }
  }
}

Measured memory_bytes: 14000
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;
 
#define  pb     push_back
#define  all(x) (x).begin(), (x).end()
#define  rep(i,a,b) for(int i=a ; i<b ; ++i)
#define  repr(i,a,b) for(int i=a ; i>=b ; --i)
#define  deb(x) cout << #x << " - " << x << "\n";
#define  IOS    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  D2(x)  { cerr << "[" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }
#define  ps(x,y) fixed<<setprecision(y)<<x
 
#define PI 3.141592653589793
const ll MOD = 1e9 + 7;
const ll INF = 1e9+3;
const ll MAX_N = 1e6 + 2;

void solve(){
    ll n; cin >> n;
    vll v(n);
    rep(i,0,n) cin >> v[i];
    
    ll shares = 0, amount = 1000, i, j, mul, mx;
    
    for(i=0;i+1<n;++i){
        if(v[i]<v[i+1]){
            // buy here
            mul = amount/v[i];
            shares = mul;
            amount -= (mul*v[i]);
            
            // sell here
            amount += shares * (v[i+1]);
        }
    }
    cout << amount;
}
 
int main() {
    IOS;
    // int t; cin >> t;
    int t = 1; 
    while(t--) solve();
}

Measured memory_bytes: 3636
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String P =sc.next();
    String M[] ={"SA","F","TH","W","TU","M","SU"};
    for(int i=0;i<7;i++){
      if(P.contains(M[i])){System.out.println(i+1);}
    }
  }
}


Measured memory_bytes: 21460
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}


int main(){
  ll N; scanf("%lld", &N);

  ll ans = 0;
  for (ll i = 1; i <= N; i++){
    ans += i * (i + 1) / 2;
  }

  for (int i = 0; i < N - 1; i++){
    ll U, V; scanf("%lld%lld", &U, &V);
    if (U > V) swap(U, V);
    ans -= U * (N - V + 1);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3764
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
#define endl '\n'
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 222222





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


  cin >> s;
  string t = "keyence";
  ok = false;
  FOR(i, 0, s.length()) FOR(j, i, s.length() + 1) {
    string ss = "";
    ss += s.substr(0, i);
    ss += s.substr(j, n - j - 1);
    if (ss == t) ok = true;
  }
  if (ok) cout << "YES" << endl;
  else cout << "NO" << endl;


  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vi2;
typedef vector<vi2> vi3;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vll> vll2;
typedef vector<vll2> vll3;
typedef vector<bool> vb;

#define el '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define umap unordered_map
#define uset unordered_set
#define vec vector
#define loop(a) for (auto &x : a)
#define all(a) a.begin(), a.end()
#define mp make_pair

const int INF = 1e7;

vi a;
int n;
vi2 cache;

void min_self(int &a, int b) {
    a = min(a, b);
}

int dfs(int which, int one_more) {
    if (which == n) {
        return one_more;
    }

    int &c = cache[which][one_more];
    if (c != -INF) {
        return c;
    }

    int digit = a[which];
    int ans = INF;
    if (one_more == 0) {
        min_self(ans, digit + dfs(which + 1, 0));
        min_self(ans, digit + 1 + dfs(which + 1, 1));
    } else {
        min_self(ans, 10 - digit + dfs(which + 1, 0));
        min_self(ans, 10 - digit - 1 + dfs(which + 1, 1));
    }

    return c = ans;
}

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

    string s;
    cin >> s;
    n = s.size();
#ifdef LOCAL
    cout << "n:" << n << el;
#endif
    a = vi(n);
    rep(i, 0, n) {
        a[i] = s[i] - '0';
    }
    cache = vi2(n, vi(2, -INF));
    cout << min(1 + dfs(0, 1), dfs(0, 0)) << el;
}


Measured memory_bytes: 106652
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	bool alog=false,blog=false;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='C') alog=true;
		if(s[i]=='F')
		{
			if(alog==true)
			{
				cout<<"Yes";
				return 0;
			}
			
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
     
    class Main {
        public static void main(String args[]){
            int a,b,c,d;
            Scanner sc = new Scanner(System.in);
     
            a = sc.nextInt();
            b = sc.nextInt();
            c = sc.nextInt();
            d = sc.nextInt();
     
            if ((b-a<=d && a-b<=d && c-b<=d && b-c<=d) || (c-a<=d && a-c<=d)){
                System.out.print("Yes");
            }else{
                System.out.print("No");
            }
            
            return;
        }
    }

Measured memory_bytes: 23764
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr int MOD_TYPE = 1;
constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
  int s, w;
  cin >> s >> w;
  if (s <= w)
    cout << "unsafe" << endl;
  else
    cout << "safe" << endl;
  return 0;
}


Measured memory_bytes: 3644
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        long a = in.nextLong();
        long b = in.nextLong();

        if (a == 0) {
            out.println(calc(b));
            return;
        }
        out.println(calc(a - 1) ^ calc(b));
    }

    private long calc (long a) {
        int r = (int)(a % 4);
        if (r == 0) {
            return a;
        } else if (r == 1) {
            return 1;
        } else if (r == 2) {
            return a + 1;
        } else if (r == 3) {
            return 0;
        }
        return 0;
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}


Measured memory_bytes: 23124
#include<cstdio>
#include<iostream>
#include<queue>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
    ios::sync_with_stdio(false); 
    string s1,s2;
    cin>>s1>>s2;
    reverse(s1.begin(),s1.end()); 
    if(s1==s2) printf("YES\n"); 
    else printf("NO\n"); 
    return 0;
}

Measured memory_bytes: 256
import itertools

N = int(input())
A = []
lst = [[] for _ in range(N)]

for i in range(N):
	A.append(int(input()))
	for j in range(A[-1]):
		a, b = map(int, input().split())
		lst[i].append([a, b])
		
ans = 0
		
for cur in itertools.product(list(range(2)), repeat = N):
	flg = 0
	for i in range(N):
		if flg: break
		if cur[i] == 0: continue
		for j in range(len(lst[i])):
			if not cur[lst[i][j][0] - 1] == lst[i][j][1]:
				flg = 1
				break
	if not flg:
		ans = max(ans, sum(cur))
		
print(ans)

Measured memory_bytes: 43504
#include <stdio.h>

int N, A, B;

int main() {
    char str[100001];
    int i, u = 0, v = 0;
    scanf("%d %d %d", &N, &A, &B);
    scanf("%s", str);
    for (i = 0; str[i]; ++i) {
        if (str[i] == 'a') {
        } else if (str[i] == 'b') {
            if (++v > B) {
                puts("No");
                continue;
            }
        } else {
            puts("No");
            continue;
        }
        puts(++u > A + B ? "No" : "Yes");
    }
    return 0;
}

Measured memory_bytes: 640
// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1e9;
int n,m;
char s[15][15];
char d[15],e[15];
bool dfs2(int x){
	if(x>m)return 1;
	if(e[x])return dfs2(x+1);
	int t=0;
	for(int i=x;i<=m;i++)
		if(!e[i])++t;
	for(int i=x;i<=m;i++){
		if(!e[i]){
			int fg=1;
			e[x]=i,e[i]=x;
			for(int j=1;j<=n;j++){
				if((s[j][x]!=s[d[j]][i]) || (s[d[j]][x]!=s[j][i])){fg=0;break;}
			}
			if(i==x){
				if(fg&&(t&1)&&dfs2(x+1))return 1;
			}
			else{
				if(fg){if(dfs2(x+1))return 1;else return 0;}
			}
			e[x]=0,e[i]=0;
		}
	}
	return 0;
}
bool dfs1(int x){
	if(x>n)return dfs2(1);
	if(d[x])return dfs1(x+1);
	else{
		int t=0;
		for(int i=x;i<=n;i++)if(!d[i])++t;
		for(int i=x;i<=n;i++){
			if(!d[i]){
				d[x]=i,d[i]=x;
				if(((t&1)||(i!=x))&&dfs1(x+1))return 1;
				d[x]=0,d[i]=0;
			}
		}
	}
	return 0;
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%s",s[i]+1);
	if(dfs1(1))puts("YES");
	else puts("NO");

	return 0;
}


Measured memory_bytes: 256
#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 <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

using namespace std;

int main(){
    int n;
    cin >> n;
    for(int i=0; i < n; i++){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        x1 -= x2; y1 -= y2;
        x3 -= x4; y3 -= y4;
        if(abs(x1*y3 - y1*x3)<1e-10) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

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

int main()
{
    char ch;
    int alphabet[26] = {0};

    while (cin >> ch) {
        if (isupper(ch)) {
            alphabet[ch - 'A']++;
        } else if (islower(ch)) {
            alphabet[ch - 'a']++;
        }
    }

    for (int i = 0; i < 26; i++) {
        cout << (char)(i + 'a') << " : " << alphabet[i] << endl;
    }

    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B;
    for(int i=0;i<N;i++) {
        cin >> A[i];
    }
    int max1 = *max_element(A.begin(),A.end());
    int max1count = 0;
    for(int i=0;i<N;i++) {
        if(A[i]==max1) max1count++;
    }

    if(max1count>1) {
        for(int i=0;i<N;i++) {
            cout << max1 << endl;
        }
    }
    else {
        for (int i = 0; i < N; i++) {
            if (A[i] != max1) {
                B.push_back(A[i]);
            }
        }
        int max2 = *max_element(B.begin(),B.end());
        for(int i=0;i<N;i++) {
            if(A[i]==max1) cout << max2 << endl;
            else cout << max1 << endl;
        }
    }

    return 0;
}


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

typedef pair<int, int> ii;

ii mii(int a, int b){
    return make_pair(a,b);
}

int main(){
    int N;
    scanf("%d", &N);
    ii duedur[N+1];
    duedur[N] = mii(0,0);
    for(int i = 0; i < N; i++){
        int dur, due;
        scanf("%d %d", &dur, &due);
        duedur[i] = mii(due, dur);
    }
    sort(duedur, duedur+N+1);
    for(int i = 1; i <= N; i++){
        duedur[i].second += duedur[i-1].second;
        if(duedur[i].first < duedur[i].second){
            printf("No");
            return 0;
        }
    }
    printf("Yes");
}


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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
// static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to;
    char cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

#include <iostream>
using namespace std;

const int MAX = 10000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void){
    
    int N, K;
    cin >> N >> K;

    COMinit();
   
    REP1(i, K+1){
        ll ans = (COM(K-1, i-1) * COM(N-K+1, i)) % MOD;
        cout << ans << endl;
    }

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 512
n, k = map(int, input().split())

ans = 0

for i in range(k+1,n+1):
    d = (n+1) // i
    m = (n+1) % i
    p = d*(i-k) + max(0,m-k)
    #print(p)
    ans += p
if k==0 :
    ans -= n

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
using namespace std;

#define mp make_pair
#define fi first
#define se second
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) (((a) * (b)) / (__gcd((a), (b))))
#define in_range(x, y, r, c) (x < r && y < c && x >= 0 && y >= 0)
#define setbits(x) __builtin_popcountll(x)
#define unsetend(x) __builtin_ctzll(x)
#define unsetfront(x) __builtin_clzll(x)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define ll long long
#define endl "\n"
#define Endl "\n"

// long long expo(long long a, long long b, long long m)
// {
//     ll ret = 1;
//     while (b > 0)
//     {
//         if (b % 2 == 1)
//             ret = ((ret % m) * (a % m)) % m;
//
//         a = (a % m) * (a % m);
//         b = b / 2;
//     }
//     return ret;
// }

// vector<long long> seive()
// {
//    long long i,j;
//    vector<long long> hash(1000001,1);
//    vector<long long> primes;
//
//    for(i=2;i*i<=1000000;i++)
//    {
//        if(hash[i])
//        {
//            for(j=i*i;j<=1000000;j+=i)
//            hash[j]=0;
//        }
//    }
//    for(i=2;i<1000001;i++)
//    {
//        if(hash[i])
//        primes.pb(i);
//    }
//    return primes;
// }

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, i, j;
    cin >> n;

    vector<double> Ph(n);
    vector<double> dp(n + 1);
    dp[0] = 1;

    for (i = 0; i < n; i++)
        cin >> Ph[i];

    for (i = 0; i < n; i++)
    {
        for (j = i + 1; j >= 0; --j)
        {
            if (j == 0)
                dp[j] = dp[j] * (1 - Ph[i]);
            else
                dp[j] = (dp[j - 1] * (Ph[i])) + (dp[j] * (1 - Ph[i]));
        }
    }

    double ans = 0;
    for (i = 0; i <= n; i++)
    {
        if (n - i < i)
            ans = ans + dp[i];
    }
    cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 3884
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s;
    cin >> s;
    string ret = "";
    int size = s.size() - 2;
    ret += s[0];
    if(size > 9)
    {
        ret += size / 10 + 48;
    }
    ret += size % 10 + 48;
    ret += s[s.size() - 1];
    cout << ret << endl;
    return 0;
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    string s, t;
    cin >> s >> t;
    ll n = t.length();
    if (s == t.substr(0, n - 1)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}



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

#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define int ll
#define fi first
#define se second
#define pii pair<int, int>
template<class T> void smin(T& a, T val) {if (a > val) a = val;}

using namespace std;
const int N = 5*1e3 + 10;
const int inf = 1e18;

int dp[N], n;
pii v[N];

int32_t main(){_
	
	cin>>n;

	for (int i = 1; i <= n; ++i)
	{
		cin>>v[i].fi>>v[i].se;
		v[i].fi += v[i].se;
	}

	sort(v+1, v+n+1);

	for (int j = 0; j <= n; ++j)
	{
		dp[j] = inf;
	}

	dp[0] = 0;

	for (int i = 1; i <= n; ++i)
	{
		v[i].fi -= v[i].se;
		int H = v[i].fi;
		int P = v[i].se;
		for (int j = i; j >= 1; --j)
		{
			if(H >= dp[j-1]){
				smin(dp[j], dp[j-1] + P);
			}
		}
	}

	int best = 0;
	for (int j = 1; j <= n; ++j)
	{
		if(dp[j] != inf){
			best = j;
		}
	}

	cout<<best;
	return 0;
}

Measured memory_bytes: 384