akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define YESNO OUT(three(solve(),"YES","NO"))
#define YesNo OUT(three(solve(),"Yes","No"))
#define WL(A,B) OUT(three(solve(),A,B))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
template<class T> inline bool chmax(int a, int b, T c, T d) { return c > d ? a : b; }
template<class T> inline bool chmin(int a, int b, T c, T d) { return c > d ? a : b; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<ut, VI, greater<LL> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 1e6 + 1000;
const int SIZE2 = 2010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p = 7 + 1e9;
const LL INF = 1LL << 30;
const long double EPS = 1e-7;
const LL inf = 1000000000;
typedef pair<ld, ut> pld;
ut N, M, K, L, Q,  H, W, R;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
LL maps[SIZE2][SIZE2];
LL A[SIZE],B[SIZE],C[SIZE],D[SIZE],E[SIZE];
LL solve() {
	cin >> N >> K;
	return (N+1)/2>=K;
}




//!!!!!!!!!!!!!!!!!!!実装を詰める!!!!!!!!!!!!!!!!!!!!!!!!!
signed main() {

	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(0);
//	solve();
	YESNO;
	//cin >> N;
	return 0;

}

Measured memory_bytes: 24448
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        long a = nl();
        long b = nl();
        long x = nl();

        long vmin = 0;
        long vmax = 0;
        if(a<=x){
            if(a==0) vmin = 0;
            else vmin = x;
        }else if(a%x==0){
            vmin = a;
        }else{
            vmin = a + x -(a % x);
        }
        if(x <= b){
            vmax = b - b % x;
        }else{
            vmax = 0;
        }
        // System.out.println(vmin);
        // System.out.println(vmax);
        long ans = (vmax - vmin) / x + 1;
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 33232
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstdio>
#include <map>
#include <set>
#include <utility>
#include <string>
#include <functional>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
    ios_base::sync_with_stdio(false);
    int x, a, b;
    cin >> x >> a >> b;
    if(b - a <= x) {
        if(b <= a) {
            cout << "delicious";
        }
        else {
            cout << "safe";
        }
    }
    else {
        cout << "dangerous";
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <deque>
#include <stack>
using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin); /*freopen("output.txt","w",stdout);*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,m;
	cin>>n>>m;
	long long x;
	priority_queue<long long>q;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		q.push(x);
	}
	long long h;
	while(m>0&&!q.empty())
	{
	 h=q.top();
		q.pop();
		h/=2;
		m--;
		if(h>0)
		q.push(h);
	}
	long long res=0;
	while(!q.empty())
	{
		res+=q.top();
		q.pop();
	}
	cout<<res<<endl;
}

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

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		
		int n[] = new int[5];
		for (int i = 0; i < 5; i++)
			n[i] = sc.nextInt();
		Arrays.sort(n);
		for (int i = 4; i > 0; i--)
		{
			System.out.print(Integer.toString(n[i]) + " ");
		}
		System.out.println(n[0]);
	}
}

Measured memory_bytes: 12000
import java.util.Scanner;
public class Main {
	
		static void solve() {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			double res = 0.0;
			for(int i = 0;i<n;i++) {
				res+=1.0/sc.nextDouble();
			}
			System.out.print(1.0/res);
			sc.close();
		}
	
	public static void main(String[] args){
		solve();
	}
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
#define mp make_pair
#define pr pair<ll,ll>
#define MAX 1000000
#define ed '\n'
using namespace std;
typedef long long int ll;
#define mod 998244353
double pi=3.14159265358979323846;
void sync(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}

int main(){
	sync();
	ll t;
	t=1;
	for(ll testcase=1;testcase<=t;testcase++){
	ll r;
	cin>>r;
	double area=2*pi*r;
	cout<<fixed<<setprecision(20)<<area<<endl;
	}
}

Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
 
typedef long long   ll;
typedef long double ld;
const int N  = 5e5+10;
const ll mod = 1e9+7;
const ll inf = 1e18;
 
#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb              push_back
#define mp              make_pair
#define ub              upper_bound                 // first element >  val(itr)
#define lb              lower_bound                 // first element >= val(itr) 
#define all(x)          (x).begin(),(x).end()
#define reset(a,x)      memset(a,x,sizeof(a))       // x can be 0 or -1
#define leadzero(a)     __builtin_clz(a)            // count leading zeroes
#define trailzero(a)    __builtin_ctz(a)            // count trailing zeroes
#define bitcount(a)     __builtin_popcount(a)       // count set bits
#define iceil(n,x)      ((n)+(x)-1)/(x)
#define test            int t; cin>>t; while(t--)
#define forn(i,a,e)     for(ll i = a; i < e; i++)
#define pll             pair<ll,ll>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;    }
ll lcm(ll a, ll b) { ll r=((a*b)/gcd(a,b)); return r; }
ll isOnBit(ll n, ll b) {return (n >> b) & 1;          }
ll powm(ll base,ll exp){ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
ll modinv(ll n) { ll ans = powm(n,mod-2); return ans; }
ll add(ll a,ll b)  { return (a%mod+b%mod)%mod;        }
ll sub(ll a, ll b) { return (a%mod+mod-b%mod)%mod;    }
ll mult(ll a,ll b) { return ((a%mod)*(b%mod))%mod;    }
ll choose2(ll n)   { ll ans=(n*(n-1))/2; return ans;  }
ll digsum(ll n)    { ll cnt=0; while(n){cnt+=(n%10); n/=10;} return cnt;}
ll dist2(ll x1,ll y1,ll x2,ll y2){ ll ans=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); return ans;}

ll fact[N];
ll inv[N];

void init(ll n)
{
    forn(i,0,n+1)
    {
        if(i==0)
            fact[i]=1;
        else
            fact[i]=mult(fact[i-1],i);
    }
    inv[n] = modinv(fact[n]);
    for(ll i=n;i>=1;i--)
    {
        inv[i-1] = mult(inv[i],i);
    }
}

ll ncr(ll n,ll r)
{
    if(n<r || n<0 || r<0)
        return 0;

    ll ans = 1;
    ans = mult(ans,fact[n]);
    ans = mult(ans,inv[r]);
    ans = mult(ans,inv[n-r]);

    return ans;
}

int main()
{
    fast
    ll n,k;
    ll ans=0;
    cin>>n>>k;
    
    init(n);
    ll blue = k,red = n-k;
    forn(i,1,k+1)
    {
        ll x = red-(i-1);
        ll r = i+1;
        ans = 1;
        ans = ncr(blue-1,i-1);
        ans = mult(ans,ncr(x+r-1,x));
        cout<<ans<<endl;
    }

    return 0;
}

Measured memory_bytes: 2304
from math import gcd
mod = 10**9+7
n=int(input())
r = dict()
zeros = 0
for _ in range(n):
  a,b=map(int,input().split())
  if not any((a,b)):
    zeros+=1
    continue
  if all((a,b)):
    g = gcd(a,b)*(a//abs(a))
  elif a:
    g = a
  else:
    g = b
  p = a//g,b//g
  r[p] = r.get(p,0)+1
ans = 1
done = set()
for (a,b), v in r.items():
  if (b,-a) in done or (-b,a) in done:
    continue
  done.add((a,b))
  w = r.get((b,-a),0)+r.get((-b,a),0)
  ans = ans*(pow(2,v,mod)+pow(2,w,mod)-1)%mod
  
print((ans+zeros+mod-1)%mod)
    

    

Measured memory_bytes: 72016
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
ll a[60],ans,n;
int main(){
    ll mn = LONG_LONG_MAX;
    cin>>n;
    for(int i=0;i<5;i++){
        cin>>a[i];
        mn = min(mn,a[i]);
    }
    ans = n/mn;
    if(n%mn==0){ans--;}
    ans+=5;
    cout<<ans<<endl;

}


Measured memory_bytes: 256
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = 0;
		for(int i=0; i<5; i++){
			x = sc.nextInt();
			if(x==0){
				System.out.println(i+1);
				return;
            }
        }
    }
}


Measured memory_bytes: 35656
#include <stdio.h>
#include<stdlib.h>
#include<string.h>
void seiri(int n);
int judge(int n);
char S[6];

int main(){
  int n;
  scanf("%s",S);
  n=strlen(S);
  if(atoi(S)==10000)printf("9999\n");
  else if(n==1){
    printf("%s\n",S);
  }
  else seiri(n);

  return 0;
}

void seiri(int n){
  int i,flag=0,SS=0,ii=1,S1=0,S2=0;
  for(i = 0; i < n/2;i++){
    if(S[i]!=S[n-i-1])flag=1;
  }
  if(flag==0){
    printf("%s\n",S);
    return;
  }
  else{
    for(i=n-1;i>=0;i--){
      SS+=(S[i]-'0')*ii;
      ii*=10;
    }
    //printf("%d\n",SS);
    for(i = SS ;;i++){
      if(judge(i) == 1)break;
      S1++;
    }
    for(i = SS ;; i--){
      if(judge(i) == 1)break;
      S2++;
    }
    
    if(S1 < S2)printf("%d\n",SS+S1);
    else printf("%d\n",SS-S2);
  }
}

int judge(int SS){
  if(SS>9 && SS<100){
    if(SS%10==SS/10)return 1;
    else return 0;
  }
  if(SS>99 && SS<1000){
    if(SS%10==SS/100)return 1;
    else return 0;
  }
  if(SS>999 && SS<10000){
    if(SS%10==SS/1000 && (SS/100)%10 == (SS/10)%10)return 1;
    else return 0;
  }
}

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

int main(){
  int N,M,X; cin >> N >> M >> X;
  vector<int> C(N,0);
  vector<vector<int>> A(N,vector<int>(M,0));
  for(int i=0; i<N; i++){
    cin >> C[i];
    for(int j=0; j<M; j++){
      cin >> A[i][j];
    }
  }
  
  int result=1000000000;
  for(int i=0; i<(1<<N); i++){
    bool f=true;
    for(int j=0; j<M; j++){
      int tx=0;
      for(int k=0; k<N; k++){
        if((i>>k)&1) tx+=A[k][j];
      }
      if(tx<X) f=false;
    }
    
    if(!f) continue;
    int tr=0;
    for(int k=0; k<N; k++){
      if((i>>k)&1) tr+=C[k];
    }
    if(result>tr) result=tr;
  }
  if(result==1000000000) cout << -1 << endl;
  else cout << result << endl;
}

Measured memory_bytes: 3628
# coding: utf-8
# Your code here!
n,a,b=map(int,input().split())
s=list(input())
count=1
c=1
for i in range(n):
    if s[i]=='a':
        if count<=a+b:
            count+=1
            print('Yes')
        else:
            print('No')
    elif s[i]=='b':
        if count<=a+b and c<=b:
            count+=1
            c+=1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

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

using namespace std;

vector<long long>sz;
vector<long long>rep;
long long nc;

long long findu(long long u)
{
    if(u==rep[u])
    {
        return u;
    }
    return rep[u]=findu(rep[u]);
}

void join(long long a,long long b)
{
    a=findu(a);
    b=findu(b);
    if(a==b)
    {
        return;
    }
    if(sz[a]<sz[b])
    {
        swap(a,b);
    }
    sz[a]+=sz[b];
    rep[b]=a;
    nc--;
}


int main()
{
    map<pair<long long, long long>, long long> nodes;
    long long N;
    cin >> N;
    vector <pair < long long, pair<long long, long long>> > xs;
    vector <pair < long long, pair<long long, long long> > > ys;
    for(int i=0; i<N; i++)
    {
        long long x, y;
        cin >> x >> y;
        nodes[ {x,y}]=i+1;
        xs.push_back({x,{y, i + 1}});
        ys.push_back({y,{x, i+1}});
    }
    sz=vector<long long>(N+1);
    rep=vector<long long>(N+1);
    nc=N;
    for(int i=1; i<=N; i++)
    {
        rep[i]=i;
        sz[i]=1;
    }
    sort(xs.begin(),xs.end());
    sort(ys.begin(),ys.end());
    map<long long, vector < pair<long long, long long > > > costs;
    for(int i=0; i<xs.size()-1; i++)
    {
        long long x1=xs[i].first, x2=xs[i+1].first;
        long long y1=xs[i].second.first, y2=xs[i+1].second.first;
        long long id1 = xs[i].second.second, id2 = xs[i+1].second.second;
        costs[abs(x1-x2)].push_back({id1,id2});
    }
    for(int i=0; i<ys.size()-1; i++)
    {
        long long x1=ys[i].second.first, x2=ys[i+1].second.first;
        long long y1=ys[i].first, y2=ys[i+1].first;
        long long id1 = ys[i].second.second, id2 = ys[i+1].second.second;
        costs[abs(y1-y2)].push_back({id1,id2});
    }
    map<long long, vector < pair<long long, long long > > >::iterator it;
    long long res=0;
    for(it=costs.begin(); it!=costs.end(); it++)
    {
        for(int i=0; i<(it->second).size(); i++)
        {
            long long tmpa=findu((it->second)[i].first) , tmpb = findu((it->second)[i].second);
            if(tmpa!=tmpb)
            {
                join(tmpa,tmpb);
                res+=(it->first);
            }
        }
    }
    cout << res << endl;
    /*long long a , b ,w;
    for(int i=0; i<M; i++){
            cin >> a >> b >> w;
            grid[a].push_back(b);
            ce.push_back({w,{a,b}});
    }
    sort(ce.begin(),ce.end());

    long long res=0;
    for(int i=0; i<ce.size(); i++){
        long long tmpa=findu(ce[i].second.first) , tmpb = findu(ce[i].second.second);
        if(tmpa!=tmpb){
            join(ce[i].second.first,ce[i].second.second);
            res+=ce[i].first;
        }
    }
    cout << res << endl;
    */

    return 0;
}


Measured memory_bytes: 21600
#include<cstdio>
const int N=3003;
int n;double a[N],dp[N][N],ans;
signed main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lf",a+i);
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
	  for(int j=0;j<=i;j++){
		dp[i][j]=(j?dp[i-1][j-1]*a[i]:0)+dp[i-1][j]*(1-a[i]);
		if(i==n&&j+j>=n)ans+=dp[i][j];
	  }
	printf("%.15lf",ans);
	return 0;
}

Measured memory_bytes: 68864
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int a[2500];
int n,w,z;

signed main(){
	scanf("%d%d%d",&n,&z,&w);
	rep(i,n)scanf("%d",&a[i]);
	if(n==1){
		cout<<abs(a[0]-w)<<endl;
		return 0;
	}
	cout<<max(abs(a[n-1]-a[n-2]),abs(a[n-1]-w))<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer(x) cout<<endl<<"answer : "<<x<<endl<<endl;
#define op(x) cout<<x<<endl;
#define maxn 500005
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi lld t=1;//cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0,l=0,r=0,mid=0,lo=0,hi=0;string s;bool flag=false;
        cin>>n; lld a[n]; for(i=0;i<n;i++) cin>>a[i];
        for(i=1;i<n;i++)
            if(a[i-1]>a[i])
                cnt+=a[i-1]-a[i],a[i]=a[i-1];
        op(cnt);
    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


Measured memory_bytes: 5220
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <cassert>
using namespace std;

int main(){
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> A(N, K-Q);
    for(int i=0; i<Q; i++){
        int a;
        cin >> a;
        a--;
        A[a]++;
    }
    for(int i=0; i<N; i++)
        cout << (A[i] > 0 ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	int a[3005];
	int min,n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int sum=0;
	for(int i=0;i<n;i++){
		sum=sum+a[i]-1;
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

int main(){
    ll v[200010];
    ll w[200010];
    ll input[200010];
    ll N;
    cin >> N;
    for(int i=0;i<=N;i++) v[i] = 0;
    for(int i=0;i<N;i++){
        cin >> input[i];
        v[input[i]]++;
    }
    ll sum = 0;
    for(int i=1;i<=N;i++){
        w[i] = v[i]*(v[i]-1)/2;
        sum += w[i];
    }
    for(int i=0;i<N;i++){
        cout << sum - w[input[i]] + (v[input[i]]-1)*(v[input[i]]-2)/2 << endl;
    }
    return 0;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output1.txt","w",stdout);
#endif
	ll n,i,c=0,ans=0;
	cin>>n;
	unordered_map<ll , ll>mp;
	while(n%2==0){
		mp[2]++;
		n/=2;
	}
	for(i=3;i<=sqrt(n);i+=2){
		while(n%i==0){
			mp[i]++;
			n/=i;
		}
	}
	if(n>2)mp[i]++;
	vector<ll>dp(1e6,0);
	dp[0]=0;
	dp[1]=1;
	for(i=2;i<=1e6;i++){
		dp[i]=dp[i-1]+i;
	}
	ll c1,c2;
	for(auto it=mp.begin();it!=mp.end();it++){
		c1=(lower_bound(dp.begin(),dp.end(),it->second)-dp.begin());
		if(dp[c1]!=it->second)c1--;
		ans+=c1;
		//cout<<it->first<<" "<<it->second<<" "<<ans<<"\n";
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 11224
#include <iostream>
#include <cstdio>
#define N 100005
using namespace std;

int n, m, i, j, Q, l, r, v[N], s[N];
string a;
int main()
{
	v[1] = 1;
	for (i = 2; i <= 100000; i++) {
		if (!v[i]) {
			for (j = i * 2; j <= 100000; j += i) v[j] = 1;
		}
	}
	for (i = 1; i <= 100000; i++) {
		s[i] = s[i - 1];
		if (!v[i] && !v[(i + 1) / 2]) s[i]++;
	}
	cin >> Q;
	while (Q--) {
		scanf ("%d %d", &l, &r);
		printf("%d\n", s[r] - s[l - 1]);
	}
//	for (i = 0; i < n; i++) {
//		scanf ("%d", &a[i]);
//		s += a[i];
//	}
//	cout << s'
//    cout << "Hello world!" << endl;
    return 0;
}


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

string ssmax(string s, string t){
  ll ns = s.size();
  ll nt = t.size();
  if(ns==0)return t;
  if(nt==0)return s;
  if(s[ns-1]=='?')return t;
  else if(t[nt-1]=='?')return s;
  
  if(ns>nt){
    return s;
  }else if(ns<nt){
    return t;
  }else{
    rep(ii, ns){
      ll i = ii;
      if(s[i]>t[i]){
        return s;
      }else if(s[i]<t[i]){
        return t;
      }
    }
    return s;
  }
}
ll N, M;
string dp[100000];
ll v[100000];
set<ll> exist;
ll num[]={0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

string dpf(ll n){
  if(v[n]>0){
    return dp[n];
  }else{
    bool imp=true;
    v[n]=1;
    dp[n]="";
    if(n==0){
      
    }else{
      for(auto i:exist){
        if(n-num[i]>=0){
          dp[n] = ssmax(dp[n], to_string(i) + dpf(n-num[i]));
          imp=false;
        }
      }
    }
    if(n!=0 and imp){
      dp[n]="?";
    }
    return dp[n];
  }
}

/**************************************
 ** A main function starts from here  **
 ***************************************/
int main(){
  cin >> N >> M;
  rep(i, M){
    ll tmp; cin >> tmp;
    exist.insert(tmp);
  }
  cout << dpf(N);

  return 0;
}


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

struct Dice {
  int s[6];
  void turnN() {
    int tmp = s[0];
    s[0] = s[1]; s[1] = s[5]; s[5] = s[4]; s[4] = tmp;
  }
  void turnS() {
    int tmp = s[0];
    s[0] = s[4]; s[4] = s[5]; s[5] = s[1]; s[1] = tmp;
  }
  void turnW() {
    int tmp = s[0];
    s[0] = s[2]; s[2] = s[5]; s[5] = s[3]; s[3] = tmp;
  }
  void turnE() {
    int tmp = s[0];
    s[0] = s[3]; s[3] = s[5]; s[5] = s[2]; s[2] = tmp;
  }
};

int main() {
  
  int n; cin >> n; int table[n][6];
  
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 6; j++) {
      cin >> table[i][j];
    }
  }
  
  for (int i = 0; i < n - 1; i++) {
    
    for (int j = i + 1; j < n; j++) {
      
      Dice a; Dice b;
      
      for (int k = 0; k < 6; k++) a.s[k] = table[i][k];
      
      for (int k = 0; k < 6; k++) b.s[k] = table[j][k];
      
      for (int k = 0; k < 10000; k++) {
      
        int r = rand();
      
        if (r % 4 == 0) a.turnN();
        if (r % 4 == 1) a.turnS();
        if (r % 4 == 2) a.turnW();
        if (r % 4 == 3) a.turnE();
      
        for (int l = 0; l < 6; l++) {
          if (a.s[l] != b.s[l]) break;
          if (l == 5) {
            cout << "No" << endl;
            return 0;
          }
        }
        
      }
      
    }
    
  }
  
  cout << "Yes" << endl;
  
}


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

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

using namespace std;
using ll = long long;

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int main(void){
    string S;
    cin >> S;
    int lenS = S.length();
    int mod[lenS];
    int val = 1;
    int dp[lenS][13] = {0};

    for(int i = lenS - 1; i >= 0; i--){
        mod[i] = val;
        val = (val*10) % 13;
    }

    if (S[0] == '?')
        rep(i, 10)
            dp[0][mod[0]*i % 13] += 1;
    else
        dp[0][mod[0]*ctoi(S[0]) % 13] += 1;

    for(int i = 1; i < lenS; i++){
        if(ctoi(S[i]) == -1){
            rep(j, 10){
                int v = mod[i]*j % 13;
                rep(k, 13){
                    dp[i][k] += dp[i-1][(k-v+13) % 13];
                    dp[i][k] %= X;
                }
            }

        }
        else{
            int v = mod[i]*ctoi(S[i]) % 13;
            rep(j, 13)
                dp[i][j] = dp[i-1][(j-v+13) % 13];
        }
    }

    cout << dp[lenS-1][5] << endl;
    return 0;
}

Measured memory_bytes: 5888
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Judge{
	int judgeit(int a,int b,int c){
		if(a < b && b < c){
			return 0;
		}
		else{
			return 1;
		}
	}
}

class Main{
	public static void main (String[] args) throws java.lang.Exception{
		Scanner scan = new Scanner(System.in);
		int a = Integer.parseInt(scan.next());
		int b = Integer.parseInt(scan.next());
		int c = Integer.parseInt(scan.next());
		String ans[] = {"Yes","No"};
		Judge cr = new Judge();
		System.out.println(ans[cr.judgeit(a,b,c)]);
	}
}

Measured memory_bytes: 17128
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int N,T;

int main(){
	scanf("%d%d" , &N , &T);
	int ans = 0;
	int r = 0;
	repp(i,0,N){
		int t;
		scanf("%d" , &t);
		if(r <= t){
			ans += T;
			r = t + T;
		} else {
			t += T;
			ans += t - r;
			r = t;
		}
	}
	printf("%d\n" , ans);
	return 0;
}


Measured memory_bytes: 128
N, K = map(int, input().split())
d = [0]*(K+1)
MOD = 10**9+7
for i in range(1, K+1):
    d[i] = pow(K//i, N, MOD)
for i in range(K, 0, -1):
    for j in range(2*i, K+1, i):
        d[i] -= d[j]
        d[i] %= MOD
ans = 0
for i in range(1, K+1):
    ans += d[i]*i
    ans %= MOD
print(ans)



Measured memory_bytes: 11112
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main(){
    double L;
    cin >> L;

    //A^3が最大
    //a(a-x)(a+x) = a(a^2 - x^2)より
    cout << fixed << setprecision(12) <<pow(L/3,3) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

int main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  --a;

  ll cnt = b/c + b/d - b/lcm(c,d);
  cnt -= a/c + a/d - a/lcm(c,d);
  cout << b-a-cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

struct Pa{
	int num;
	int mark;
};

bool comp(const Pa& p1, const Pa& p2)
{
	return p1.num < p2.num;
}

int func(char v)
{
	if(v == 'S'){
		return 0;
	}
	if(v == 'C'){
		return 1;
	}
	if(v == 'H'){
		return 2;
	}
	
	return 3;
}

int func2(char v)
{
	if(v == 'A'){
		return 1;
	}
	if(v == 'K'){
		return 13;
	}
	if(v == 'Q'){
		return 12;
	}
	if(v == 'J'){
		return 11;
	}
	if(v == 'T'){
		return 10;
	}
	
	int t;
	for(t = 2; t <= 9; t++){
		if((char)('0'+t) == v){
			break;
		}
	}
	
	return t;
}

bool opr(Pa a[5])
{
	bool f = false;
	for(int i = 1; i < 5; i++){
		if(a[i].num == a[i-1].num){
			f = true;
			break;
		}
	}
	
	return f;
}

bool tpr(Pa a[5])
{
	if(a[0].num == a[1].num && a[2].num == a[3].num){
		return true;
	} else if(a[0].num == a[1].num && a[3].num == a[4].num){
		return true;
	} else if(a[1].num == a[2].num && a[3].num == a[4].num){
		return true;
	}
	
	return false;
}

bool tcd(Pa a[5])
{
	bool f = false;
	
	for(int i = 0; i < 3; i++){
		if(a[i].num == a[i+1].num && a[i+1].num == a[i+2].num){
			f = true;
			break;
		}
	}
	
	return f;
}

bool stt(Pa a[5])
{
	int v = a[0].num;
	bool f = true;
	for(int i = 1; i < 5; i++){
		if(a[i].num != (v+i)){
			f = false;
			break;
		}
	}
	if(a[0].num == 1 && a[1].num == 10 && a[2].num == 11 && a[3].num == 12 && a[4].num == 13){
			return true;
	}
	
	return f;
}

bool flh(Pa a[5])
{
	bool f = true;
	for(int i = 1; i < 5; i++){
		if(a[i].mark != a[i-1].mark){
			f = false;
			break;
		}
	}
	
	return f;
}

bool fuh(Pa a[5])
{
	if(a[0].num == a[1].num && (a[1].num == a[2].num || a[2].num == a[3].num) && a[3].num == a[4].num){
		return true;
	}
	
	return false;
}

bool fcd(Pa a[5])
{
	if((a[0].num == a[1].num || a[3].num == a[4].num) && a[1].num == a[2].num && a[2].num == a[3].num){
		return true;
	}
	
	return false;
}

bool stf(Pa a[5])
{
	if(stt(a) && flh(a)){
		return true;
	}
	
	return false;
}

bool rsf(Pa a[5])
{
	if(flh(a)){
		if(a[0].num == 1 && a[1].num == 10 && a[2].num == 11 && a[3].num == 12 && a[4].num == 13){
			return true;
		}
	}
	
	return false;
}

int main()
{
	int n, a[4][14], hand[10];
	Pa card[5];
	string str;
	bool f = false;
	
	while(cin>>n && n){
		if(f){
			cout << endl;
		}
		f = true;
		for(int i = 0; i < 4; i++){
			for(int j = 1; j <= 13; j++){
				cin >> a[i][j];
			}
		}
		hand[0] = 0;
		for(int i = 1; i <= 9; i++){
			cin >> hand[i];
		}
		
		while(n--){
			int s = 0, t = 0;
			for(int i = 0; i < 5; i++){
				cin >> str;
				card[i].num = func2(str[0]);
				card[i].mark = func(str[1]);
				s += a[card[i].mark][card[i].num];
			}
			sort(card, card+5, comp);
			
			if(rsf(card)){
				t = 9;
			} else if(stf(card)){
				t = 8;
			} else if(fcd(card)){
				t = 7;
			} else if(fuh(card)){
				t = 6;
			} else if(flh(card)){
				t = 5;
			} else if(stt(card)){
				t = 4;
			} else if(tcd(card)){
				t = 3;
			} else if(tpr(card)){
				t = 2;
			} else if(opr(card)){
				t = 1;
			}
			
			cout << (s*hand[t]) << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 932
#include<bits/stdc++.h>
#define ll long long
#define int ll
#define mod (long long)(1000000007)
using namespace std;
const int N=3e5+5;
int n,cnt[70],x[N],ans;
signed main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>x[i];
	for(int i=n-1;i>=0;i--)
	{
		int ji=0;
		while(ji<=61)
		{
			if(x[i]%2==1)
				cnt[ji]++;
			ji++;
			x[i]/=2;
		}
	}
	for(int i=0;i<=60;i++)
	{
		ll cheng=(cnt[i])*(n-cnt[i])%mod;
		for(int j=1;j<=i;j++)cheng=cheng*2%mod;
		ans=(ans+cheng)%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <vector>
#include <map>

std::map<intmax_t, intmax_t> factor(intmax_t n) {
  std::map<intmax_t, intmax_t> res;
  for (intmax_t i = 2; i*i <= n; ++i) {
    while (n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n > 1) ++res[n];
  return res;
}

int main() {
  intmax_t N;
  scanf("%jd", &N);

  std::map<intmax_t, intmax_t> ds;
  for (intmax_t i = 2; i <= N; ++i)
    for (const auto& p: factor(i))
      ds[p.first] += p.second;

  std::vector<intmax_t> dd;
  for (const auto& p: ds)
    dd.push_back(p.second);

  // 75 = 3 5 5
  intmax_t res = 0;
  size_t M = dd.size();
  for (size_t i = 0; i < M; ++i) {
    if (dd[i] >= 74) ++res;
    for (size_t j = 0; j < M; ++j) {
      if (j == i) continue;
      if (dd[i] >= 2 && dd[j] >= 24) ++res;
      if (dd[i] >= 4 && dd[j] >= 14) ++res;
      for (size_t k = j+1; k < M; ++k) {
        if (k == i) continue;
        if (dd[i] >= 2 && dd[j] >= 4 && dd[k] >= 4) ++res;
      }
    }
  }
  printf("%jd\n", res);
}


Measured memory_bytes: 256
N,M = $stdin.gets.chomp.split(" ").map(&:to_i).sort

case 
when M == 1
  puts 1
when N == 1
  puts M == 1 ? 1 : [M-2,0].max
when N == 2
  puts 0
else
  puts [N-2,0].max * [M-2,0].max
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int n,m;
long long w[110],v[110];
long long f[100010];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&w[i],&v[i]);
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=m;j>=w[i];j--)
		{
			f[j]=max(f[j],f[j-w[i]]+v[i]);
		}
	}
	printf("%lld",f[m]);
	return 0;
}


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

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

using namespace std;

int main()
{
  int n;
  string s;
  cin >> n;
  cin >> s;
  int b = 0, r = 0;
  REP(i,n) {
    if(s[i] == 'R') {
      r++;
    } else {
      b++;
    }
  }
  if(r > b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

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

  string a, b; cin >> a >> b;
  int n = stoi(a + b);
  for (int i = 1; i * i <= n; i++) {
    if (i * i == n) {
      cout << "Yes" << "\n";
      return 0;
    }
  }
  cout << "No" << "\n";
}

Measured memory_bytes: 256
//QWsin
#include<set>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;

int main()
{
//	freopen("std.in","r",stdin);
	int n;cin>>n;
	set<int>st;
	rep(i,1,n)
	{
		int t=read();
		if(st.count(t))	{
			puts("NO")	;
			return 0;
		}
		st.insert(t);
	}
	puts("YES");
	return 0;
}


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

int main() {
  string N;
  cin >> N;
  
  if (N[0] == '7') {
    cout << "Yes" << endl;
  }
  
  else if (N[1] == '7') {
    cout << "Yes" << endl;
  }
  
  else if (N[2] == '7') {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using pdd = pair<double, double>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    string s;
    int K;
    cin >> s >> K;

    set<ll> st;
    int N = s.length();

    auto conv = [&](string &s, int pos, int len) -> ll {
        ll res = 0, p = 1;
        for (int i = K - 1; i >= 0; --i) {
            if (i < len)
                res += (s[pos + i] - 'a' + 1) * p;
            p *= 27;
        }
        return res;
    };

    for (int i = 0; i < N; ++i) {
        for (int j = 1; j <= K; ++j) {
            if (i + j > N)
                continue;
            st.insert(conv(s, i, j));
        }
    }

    auto itr = st.begin();
    advance(itr, K - 1);
    ll num = *itr;
    string ans;
    while (num) {
        int tmp = num % 27;
        if (tmp)
            ans.push_back('a' + tmp - 1);
        num /= 27;
    }
    reverse(ans.begin(), ans.end());

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4304
#include<iostream>
#include<algorithm>
#include<utility>

using namespace std;

int main(){
	int a, b, c, ans = 0;
	cin >> a >> b >> c;
	if(b < c) swap(b, c);
	if(a < b) swap(a, b);
	if(b < c) swap(b, c);
	cout << 10 * a + b + c << endl;
	return 0;
}

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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int DamerauLevensteinDistance(string a,string b)
{
	int m=a.size(),n=b.size();
	vvi dp(m+1,vi(n+1,INF));
	rep(i,m+1) dp[i][0]=i;
	rep(i,n+1) dp[0][i]=i;
	vi last(26,-1);
	rep(i,m){
		int pj=-1;
		rep(j,n){
			dp[i+1][j+1]=min({dp[i][j]+(a[i]!=b[j]),dp[i][j+1]+1,dp[i+1][j]+1});
			int pi=last[b[j]-'a'];
			if(pi!=-1 && pj!=-1)
				dp[i+1][j+1]=min(dp[i+1][j+1],dp[pi][pj]+(i-pi-1)+(j-pj-1)+1);
			if(a[i]==b[j]) pj=j;
		}
		last[a[i]-'a']=i;
	}
	return dp[m][n];
}

int main()
{
	for(int n,d;cin>>n>>d && n;){
		vs ws(n);
		rep(i,n) cin>>ws[i];
		
		sort(all(ws));
		
		int cnt=0;
		rep(i,n) repi(j,i+1,n)
			if(DamerauLevensteinDistance(ws[i],ws[j])<=d){
				cout<<ws[i]<<','<<ws[j]<<endl;
				cnt++;
			}
		cout<<cnt<<endl;
	}
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,xx=0,yy=0,tt=0,i,t,x,y;
    bool ok=true;
    cin>>n;
    for(i=1;i<=n&&ok==true;i++)
    {
        cin>>t>>x>>y;
        if((x-xx+y-yy)%2!=(t-tt)%2||x-xx+y-yy>t-tt)
            ok=false;
    }
    if(ok==true)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

M=[list(map(int,input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
ans = [[0]*3 for _ in range(3)]

b = set(b)
for i in range(3):
    for j in range(3):
        if M[i][j] in b:
            ans[i][j]=1
score = 0 
for i in range(3):
    if sum(ans[i])==3:
        score = 1

if ans[0][0]==1 and ans[1][1]==1 and ans[2][2]==1:
    score = 1
if ans[0][2]==1 and ans[1][1]==1 and ans[2][0]==1:
    score = 1

for i in range(3):
    x = 0
    for j in range(3):
        x+=ans[j][i]
    if x==3:
        score=1

print('Yes') if score==1 else print('No')



Measured memory_bytes: 62012
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n;
		List<String> w = new ArrayList<String>();
		List<String> pre = new ArrayList<String>();
		n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			w.add(sc.next());
		}

		boolean ok = true;
		for (int i = 0; i < n; i++) {
			if (i == 0) {
				pre.add(w.get(i));
				continue;
			}

			String s0 = w.get(i - 1);
			String s1 = w.get(i);

			if (pre.contains(s1)) {
				ok = false;
				break;
			}
			if (s0.charAt(s0.length() - 1) != s1.charAt(0)) {
				ok = false;
				break;
			}

			pre.add(s1);
		}

		if (ok) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int U = 1e5;
  int n; cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  vector<int> a(U + 1);
  vector<int> b(U + 1);
  for (int i = 0; i < n; i += 2) a[v[i]]++;
  for (int i = 1; i < n; i += 2) b[v[i]]++;
  vector<vector<int>> c1;
  vector<vector<int>> c2;
  for (int i = 0; i < U + 1; i++) {
    if (a[i]) c1.push_back({a[i], i});
    if (b[i]) c2.push_back({b[i], i});
  }
  sort(c1.begin(), c1.end(), greater<vector<int>>());
  sort(c2.begin(), c2.end(), greater<vector<int>>());
  if (c1.size() > c2.size()) swap(c1, c2);
  int res;
  if (c1[0][1] != c2[0][1]) res = n - c1[0][0] - c2[0][0];
  else {
    if (c2.size() == 1) res = n / 2;
    else {
      if (c1.size() == 1) res = n - c1[0][0] - c2[1][0];
      else {
        res = n - max(c1[0][0] + c2[1][0], c1[1][0] + c2[0][0]);
      }
    }
  }
  cout << res << '\n';
  return 0;
}

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

int main(){
    while(1){
        int way[20][20];
        std::vector<std::pair<int, int>> underConst;
        for(int i = 0; i < 20; i++){
            std::fill(way[i], way[i]+20, 0);
        }
        int a, b, n;
        std::cin >> a >> b;
        if(!a) break;
        std::cin >> n;
        for(int i = 0; i < n; i++){
            int t1, t2;
            std::cin >> t1 >> t2;
            underConst.push_back(std::make_pair(t1, t2));
        }
        way[1][1] = 1;
        for(int i = 1; i <= a; i++){
            for(int j = 1; j <= b; j++){
                if(std::find(underConst.begin(), underConst.end(), std::make_pair(i-1, j)) == underConst.end()){
                    way[i][j] += way[i-1][j];
                }
                if(std::find(underConst.begin(), underConst.end(), std::make_pair(i, j-1)) == underConst.end()){
                    way[i][j] += way[i][j-1];
                }
            }
        }
        std::cout << way[a][b] << std::endl;
    }
}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define dd(x) cout << #x << "=" << x << ","
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b-1);i>=a;--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl "\n"
#define lowbit(x) x&(-x)
const int N = 20000;
const int M = 1e9+7;

int h[100010];
int f[100010];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
	int n,m;
	cin>>n>>m;
	for (int i=1; i<=n; i++) cin>>h[i];
	for (int i=1; i<=m; i++){
		int a,b;
		cin>>a>>b;
		if (h[a]>h[b]) swap(a,b);
		f[a]=1;
		if (h[a]==h[b]) f[b]=1;
	}
	int ans=0;
	for (int i=1; i<=n; i++){
		if (f[i]==0) ans++;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 4432
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_SIZE_MAX		305										// 最大サイズ

// 内部変数
static FILE *szpFpI;											// 入力
static int siW, siH;											// 幅・高さ
static char sc2Mass[D_SIZE_MAX][D_SIZE_MAX];					// マス
static int si1SCnt[D_SIZE_MAX];									// イチゴ数
static int si2No[D_SIZE_MAX][D_SIZE_MAX];						// 番号

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i, j, k;
	char lc1Buf[2048], lc1Buf2[128];

	// 幅・高さ - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d", &siH, &siW);

	// マス - 取得
	for (i = 0; i < siH; i++) {
		fgets(sc2Mass[i], sizeof(sc2Mass[0]), szpFpI);
		sc2Mass[i][siW] = '#';

		// イチゴ数 - セット
		for (j = 0; j < siW; j++) {
			if (sc2Mass[i][j] == '#') {
				si1SCnt[i]++;
			}
		}
	}
	si1SCnt[siH] = 1;

	// 番号 - セット
	int liNo = 1;
	int liHSNo = 0;
	while (liHSNo < siH) {
		int liHENo, liHMNo;

		// 範囲 - 行 - 取得
		int liSCnt = 0;
		for (liHENo = liHSNo; ; liHENo++) {
			if (si1SCnt[liHENo] > 0) {
				if (liSCnt == 0) {
					liSCnt++;
					liHMNo = liHENo;
				}
				else {
					liHENo--;
					break;
				}
			}
		}

		// イチゴ数でループ
		int liWSNo = 0;
		for (i = 0; i < si1SCnt[liHMNo]; i++) {
			int liWENo;

			// 範囲 - 列 - 取得
			liSCnt = 0;
			for (liWENo = liWSNo; ; liWENo++) {
				if (sc2Mass[liHMNo][liWENo] == '#') {
					if (liSCnt == 0) {
						liSCnt++;
					}
					else {
						liWENo--;
						break;
					}
				}
			}

			// 番号 - セット
			for (j = liHSNo; j <= liHENo; j++) {
				for (k = liWSNo; k <= liWENo; k++) {
					si2No[j][k] = liNo;
				}
			}
			liNo++;

			// 次の開始列
			liWSNo = liWENo + 1;
		}

		// 次の開始行
		liHSNo = liHENo + 1;
	}

	// 出力
	for (i = 0; i < siH; i++) {
		sprintf(lc1Buf, "%d", si2No[i][0]);
		for (j = 1; j < siW; j++) {
			sprintf(lc1Buf2, " %d", si2No[i][j]);
			strcat(lc1Buf, lc1Buf2);
		}
		strcat(lc1Buf, "\n");
		fOutLine(lc1Buf);
	}

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// データ - 初期化
	memset(si1SCnt, 0, sizeof(si1SCnt));						// イチゴ数

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;
const ll MOD = 1e9 + 7;

vector<bool> prime_table(int n) {
  vector<bool> prime(n + 1, true);
  if (n >= 0) prime[0] = false;
  if (n >= 1) prime[1] = false;
  for (int i = 2; i * i <= n; i++) {
    if (!prime[i]) continue;
    for (int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}

int main() {
  ll x;
  cin >> x;
  auto pt = prime_table(1e6);
  FOR(i, x, 1e6) {
    if (pt[i]) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 384