akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> pii;
typedef pair<ll,ll> pll;
 
 
/*bool compare_function(const pair<int, int> a, const pair<int, int> b)
{
    return a.first < b.first;
}*/
// use case
//sort(V.begin(), V.end(), compare_function);
 
/*struct compare
{
    bool operator ()(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.second-a.first==b.second-b.first)
    {
        return a.first>b.first;
    }
    return a.second-a.first < b.second-b.first;}
};
priority_queue <pair<int,int>, vector <pair<int,int>>, compare> Q;*/
 
/*void print1(vector <int> X)
{
    for (int i=0; i<X.size(); i++)
    {
        cout<<X[i]<<" ";
    }
    cout<<endl;
    return;
}
 
void print2(vector <vector <int>> X)
{
    for (int i=0; i<X.size(); i++)
    {
    for (int j=0;j<X[i].size();j++) {
        cout<<X[i][j]<<" ";}
    cout<<endl;}
    return;
}*/

ll laip(ll a, ll b, ll liek) {
	a=a%liek;
	if (b==0) {return 1;}
	if (b==1) {return a;}
	ll c=(a*a)%liek;
	ll x=laip(c,b/2,liek);
	if (b%2==0) {return x;}
	else {return (a*x)%liek;}
	}


ll cnk (int i, int s, vector <ll> &F) {
	ll li=1000000005;
	ll liek=li+2;
	ll a=F[i];
	ll bb=laip(F[s],li,liek);
	ll cc=laip(F[i-s],li,liek);
	ll x=a*bb;
	x=x%liek;
	x=x*cc;
	x=x%liek;
	return x;
	}

 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int k;
    string s;
    cin>>k>>s;
    int l=s.length();
    int n=k+l;
    ll liek=1000000007;
    vector <ll> F(n+1,1);
    vector <ll> L1(n+1,1);
    vector <ll> L2(n+1,1);
    L1[1]=25;
    L2[1]=26;
    for (int i=2;i<n+1;i++) {F[i]=(F[i-1]*i)%liek; 
		L1[i]=(L1[i-1]*25)%liek;
		L2[i]=(L2[i-1]*26)%liek;
		}
    ll ats=0;
    for (int i=l-1;i<n;i++) {
		ll x=cnk(i,l-1,F);
		ll y=L1[i+1-l]*L2[n-1-i];
		y=y%liek;
		//cout<<i<<" "<<x*y<<endl;
		ats+=(x*y)%liek;
		ats=ats%liek;
		}
		cout<<ats<<endl;
    return 0;
}


Measured memory_bytes: 51168
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e9
#define MOD 1000000007
typedef long long ll;
//------------------------------------------------------------------------

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

  int a,b,c; cin >> a >> b >> c;
  if((a==b && a!=c) || (b==c && b!=a) || (c==a && b!=a)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }


  return 0;
}


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

int main() {
    int n;
    cin >> n;
    double ans;
    if(n%2==0) {
        ans = 0.5;
    } else {
        int m = n/2 + 1;
        ans = (double)m/(double)n;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import Counter as c
from itertools import permutations as p

def fact(n):
    d=[]
    for i in range(2,int(n**0.5)+2):
        while n%i==0:
            n//=i
            d.append(i)
    if n!=1:d.append(n)
    return c(d)

n=int(input())
d=c()
for i in range(1,n+1):
    d+=fact(i)

v=sum(1 for i,j,k in p(d.values(),3) if i>=2 and j>=4 and k>=4)//2
v+=sum(1 for i,j in p(d.values(),2) if i>=2 and j>=24)
v+=sum(1 for i,j in p(d.values(),2) if i>=4 and j>=14)
v+=sum(1 for i in d.values() if i>=74)

print(v)

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

void solve() {
  int a;
  cin >> a;
  cout << !a << '\n';
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  // cin >> t;
  while (t--) solve();
  return 0;
}


Measured memory_bytes: 3644
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

using namespace std;

typedef long long ll;

char buf[100000+10];
char res[100000+10];

int main(void) {
  ll n;
  cin >> n >> buf;

  REP(pat, 4) {
    memset(res, 0, sizeof res);
    res[n-1] = (pat & 1) ? 'S' : 'W';
    res[n-2] = (pat & 2) ? 'S' : 'W';
    bool ok = true;
    REP(i, n) {
      int count = 0;
      count += res[(i-1+n)%n] == 'S';
      count += res[(i-2+n)%n] == 'S';
      char tobe = !!(count % 2) == !!(buf[(i-1+n)%n] == 'o') ? 'W' : 'S';
      if(res[i] && res[i] != tobe) {
        ok = false;
      } else {
        res[i] = tobe;
      }
    }
    if(ok) {
      puts(res);
      return 0;
    }
  }
  puts("-1");
  
  return 0;
}


Measured memory_bytes: 512
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static bool sameStringExist(char W[100][11], const size_t N, const char *w)
{
	bool sameStringExist = false;
	for (size_t idx = 0; idx < N; idx++) {
		if (strcmp(W[idx], w) == 0) {
			sameStringExist = true;
			break;
		}
	}

	return sameStringExist;
}

int main(void) {
	size_t N, x, a[100];

	scanf("%zu %zu\n", &N, &x);
	for (size_t idx = 0; idx < N; idx++) {
		scanf("%zu", &a[idx]);
		if (idx < N - 1) {
			scanf(" ");
		}
	}

	qsort(a, N, sizeof(size_t), compare_f);

	size_t num = 0;
	size_t count = 0;
	for (size_t idx = 0; idx < N; idx++) {
		if (idx < N - 1) {
			if (num + a[idx] <= x) {
				num += a[idx];
				count++;
			}
		}
		else {
			if (num + a[idx] == x) {
				num += a[idx];
				count++;
			}
		}
	}


	printf("%zu\n", count);

	return 0;
}


Measured memory_bytes: 128
import numpy as np
if __name__ == '__main__':
    N, K = map(int, input().split())
    S = list(map(int, list(str(input()))))
    #S = list(np.array(S)*2 - 1)
    start = [1]
    for i in range(1, N):
        if S[i] != S[i-1]:
            start.append(i+1)
    X = []
    for i in range(len(start)):
        if S[start[i]-1] == 0:
            if i+2*K < len(start):
                X.append(start[i+2*K] -start[i])
            else:
                X.append(N+1 -start[i])
        else:
            if i+2*K+1 < len(start):
                X.append(start[i+2*K+1] -start[i])
            else:
                X.append(N+1 -start[i])
    print(max(X))

Measured memory_bytes: 20632
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.next());
        int[] h = new int[n];
        for (int i=0; i<n; i++) {
            h[i] = Integer.parseInt(scanner.next());
        }
        int[] dp = new int[n];
        dp[0] = 0;
        dp[1] = Math.abs(h[1]-h[0]);
        for (int i=2; i<n; i++) {
            dp[i] = Math.min(dp[i-1]+Math.abs(h[i]-h[i-1]), dp[i-2]+Math.abs(h[i]-h[i-2]));
        }
        System.out.println(dp[n-1]);
    }
}

Measured memory_bytes: 48096
using System;

namespace ABC026A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            //c = int.Parse(word[2]);


            if (a%2!=0 && b%2!=0)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11092
#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()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

ld calc_snuke(ll x) {
  string s = to_string(x);
  int si = 0;
  for(char c: s) si += c - '0';
  return (ld) x / si;
}

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

  vector<pair<ll, ld>> cdd;
  for(int i = 1; i < 1000; ++i) cdd.push_back(make_pair(i, calc_snuke(i)));
  for(int i = 1; i <= 12; ++i) {
    for(int j = 100; j < 1000; ++j) {
      ll x = (ll)j * pow(10LL, i) + pow(10LL, i) - 1;
      cdd.push_back(make_pair(x, calc_snuke(x)));
    }
  }

  vector<ll> ret;
  ld min = 1e18;
  reverse(ALL(cdd));
  for(auto p: cdd){
    if(p.second <= min) {
      ret.push_back(p.first);
      min = p.second;
    }
  }
  reverse(ALL(ret));

  REP(i,K) cout << ret[i] << endl;
  return 0;
}



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

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

typedef long long ll;

ll T[200001] = { 0 };

int main()
{
	int n;
	cin >> n;
	vector<int> A(n);
	int MAX = 0;
	rep(i, n) {
		cin >> A[i];
		T[A[i]]++;
		MAX = max(MAX, A[i]);
	}

	ll all = 0;
	for (int i = 0; i <= MAX; i++) {
		if (T[i] > 1)  all += T[i] * (T[i] - 1) / 2;
	}

	vector<ll> zall(n, 0);
	rep(i, n) {
		int v = A[i];
		if (T[v] > 1)  zall[i] += T[v] - 1;
		zall[i] = all - zall[i];
	}

	for (ll u : zall)  cout << u << endl;
}

Measured memory_bytes: 5504
#include <iostream>
#include <vector>
#include <string>
#include <cstdio>
#include <map>
#include <sstream>
using namespace std;

string pat[5] = {
	"afkpuz",
	"bglqv.",
	"chmrw?",
	"dinsx!",
	"ejoty "
};

map<string, char> mp;

int main(){
	for(int i=0;i<5;i++){
		for(int j=0;j<6;j++){
			stringstream ss;
			ss << (j + 1) << (i + 1);
			mp[ss.str()] = pat[i][j];
		}
	}

	string in;
	while(cin >> in){
		if(in.size() % 2 == 1){
			cout << "NA" << endl;
			continue;
		}
		string ret = "";
		for(int i=0;i<in.size();i+=2){
			string s = in.substr(i,2);
			if(mp.count(s) == 0){
				ret = "NA";
				break;
			} else {
				ret += mp[s];
			}
		}
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
N,Q=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N-1)]
px=[list(map(int,input().split())) for i in range(Q)]
c=[[] for i in range(N)]
for a,b in ab:
    c[a-1].append(b-1)
    c[b-1].append(a-1)
X=[0]*N
for p,x in px:
    X[p-1]+=x
A=[X[0]]+[0]*(N-1)
v=[1]+[0]*(N-1)
from collections import deque
q=deque((0,))
while len(q)>0:
    qq=deque()
    for p in q:
        for n in c[p]:
            if v[n]==0:
                A[n]=X[n]+A[p]
                qq.append(n)
                v[n]=1
    q=qq
print(*A)

Measured memory_bytes: 124724
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
typedef long long ll;
const int P=1e9+7;
int n,m,t1,t2,s1,s2,cnt;char a[1010][1010];ll k;
int ksm(int a,ll b){
    int ans=1;
    for(;b;b>>=1,a=1ll*a*a%P) if(b&1) ans=1ll*ans*a%P;
    return ans;
}
struct Mat{
    int a[2][2];
    Mat(){a[0][0]=a[0][1]=a[1][0]=a[1][1]=0;}
    Mat(int x,int y,int u,int v){a[0][0]=x;a[0][1]=y;a[1][0]=u;a[1][1]=v;}
    int* operator [](int x){return a[x];}
}A;
Mat operator *(Mat a,Mat b){Mat c;rep(i,0,1) rep(j,0,1) rep(k,0,1) c[i][j]=(c[i][j]+1ll*a[i][k]*b[k][j]%P)%P;return c;}
Mat ksm(Mat a,ll b){
    Mat ans(1,0,0,1);
    for(;b;b>>=1,a=a*a) if(b&1) ans=ans*a;
    return ans;
}
int main(){
    scanf("%d%d%lld",&n,&m,&k);
    if(k==0) return puts("0"),0;
    rep(i,1,n) rep(j,1,m) scanf(" %c",&a[i][j]),cnt+=a[i][j]=='#';
    rep(i,1,n) t1+=a[i][1]=='#'&&a[i][m]=='#';
    rep(i,1,m) t2+=a[1][i]=='#'&&a[n][i]=='#';
    rep(i,1,n) rep(j,1,m) s1+=a[i][j]=='#'&&a[i][j+1]=='#',s2+=a[i][j]=='#'&&a[i+1][j]=='#';
    if(t1&&t2) return puts("1"),0;
    if(!t1&&!t2) return printf("%d\n",ksm(cnt,k-1)),0;
    if(!t1) swap(t1,t2),swap(s1,s2);
    A=Mat(cnt,s1,0,t1);
    A=ksm(A,k-1);
    printf("%d\n",(A[0][0]-A[0][1]+P)%P);
    return 0;
}

Measured memory_bytes: 1280
import java.util.ArrayList;
import java.util.Scanner;

class Main
{

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

		ArrayList<Integer> h=new ArrayList<Integer>();
		for(int i=0;i<10;i++)
		{
			int buf=sc.nextInt();
			if(i==0){h.add(0,buf);};
			for(int j=i-1;j>=0;j--)
			{
				if(buf<=h.get(j))
				{
					h.add(j+1,buf);
					break;
				}
				else if(j==0)
				{
					h.add(0,buf);
				}

			}

		}
		for(int i=0;i<3;i++)
		{
			System.out.println(h.get(i));
		}

	}

}

Measured memory_bytes: 26032
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int dx[4] {-1,+1, 0, 0};
int dy[4] { 0, 0,-1,+1};
int main()
{
  int n; cin >> n;
  vecint l(2*n,0);
  REP(i,2*n) cin >> l[i];
  sort(all(l));
  int ans = 0;
  REP(i,n){
    ans += l[2*i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    for(char i='1';i<='9';i++)
    {
        string t;
        t+=i;
        t+=i;
        t+=i;
        if(t>=s){
            cout<<t<<endl;
            return 0;
            }
    }
    return 0;
}


Measured memory_bytes: 256
//file_name:ABC69_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


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


    ll ans = s.size()-2;



    cout << s[0] << ans << s[ans+1] << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include<iomanip>
using namespace std;
typedef long long ll;
int main(void){
    ll k;
    cin >> k;
    string s;
    cin >> s;
    if(s.length()>k){{for(ll i=0;i<k;i++)cout << s.at(i);}cout << "..." << endl;}
    else cout << s << endl;
}


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

int const N = 50;
ll ch[N + 1][N + 1];

int bc(int x){
	int an = 0;
	while (x){
		++an;
		x ^= x & -x;
	}
	return an;
}

ll go(vector<int> v, int b, int k, int x){
	int n = v.size();
	f(i, 0, n)v[i] ^= x;
	ll an = 0;
	f(i, 0, 1 << b){
		int s = 0;
		f(j, 0, n)if (!(v[j] & i))++s;
		if (bc(i) & 1)an -= ch[s][k];
		else an += ch[s][k];
	}
	return an;
}

ll solve(vector<int> const &v, int b, int k){
	ll an = 0;
	f(i, 0, v.size())an += go(vector<int>(v.begin() + i + 1, v.end()), b, k - 1, v[i]);
	return an;
}

int main(){
	int n, k, s, t;
	scanf("%d%d%d%d", &n, &k, &s, &t);
	if ((s & t) != s){
		printf("0\n");
		return 0;
	}
	
	f(i, 0, n + 1){
		ch[i][0] = 1;
		f(j, 1, i + 1)ch[i][j] = ch[i - 1][j] + ch[i - 1][j - 1];
	}
	f(i, 0, n + 1)f(j, 1, n + 1)ch[i][j] += ch[i][j - 1];
	
	vector<int> v;
	int z = s ^ t, b = 0;
	f(i, 0, 18)if (z >> i & 1)++b;
	f(i, 0, n){
		int a;
		scanf("%d", &a);
		if ((a & s) != s || (a & t) != a)continue;
		int j = 0, an = 0;
		f(k, 0, 18)if (z >> k & 1)an |= (a >> k & 1) << j++;
		v.push_back(an);
	}
	printf("%lld\n", solve(v, b, k));
}

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

using ll = long long;
using Vi = std::vector<int>;
using Vl = std::vector<ll>;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

constexpr int I_INF = std::numeric_limits<int>::max();
constexpr ll L_INF = std::numeric_limits<ll>::max();

template <typename T1, typename T2>
inline bool chmin(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(const Args&... args) const { print(args...); }
        template <typename T>
        void pvec(const T& vec, size_t sz) const {
            for (size_t i = 0; i < sz; i++)
                std::cout << vec[i] << (i == sz - 1 ? term : sep);
        }
        template <typename T>
        void pmat(const T& mat, size_t h, size_t w) {
            for (size_t i = 0; i < h; i++)
                for (size_t j = 0; j < w; j++)
                    std::cout << mat[i][j] << (j == w - 1 ? term : sep);
        }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(const T& head, const Tail&... tail) const { std::cout << head, print_rest(tail...); }
        template <class T, class... Tail>
        void print_rest(const T& head, const Tail&... tail) const { std::cout << sep << head, print_rest(tail...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    ll ans = 0;
    for (ll i = 1; i <= N; i++) {
        ll t = (N - 1) / i;
        ans += t;
    }
    prints()(ans);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    std::cin.tie(nullptr), std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    std::ifstream ifs("./in_out/input.txt");
    std::cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    std::ofstream ofs("./in_out/output.txt");
    std::cout.rdbuf(ofs.rdbuf());
#endif
    std::cout << std::setprecision(18) << std::fixed;
    solve();
    std::cout << std::flush;
    return 0;
}

Measured memory_bytes: 3608
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=500;
//ここまでテンプレ
int main(){
	ll N,C;
	cin>>N>>C;
	vll A,B;
	for(int i=0;i<N;i++){
		ll a;
		cin>>a;
		A.pb(a);
	}
	for(int i=0;i<N;i++){
		ll b;
		cin>>b;
		B.pb(b);
	}
	//K[i][j]=0^iからj^iまでの和
	ll K[SIZE][SIZE]={};
	for(int i=0;i<SIZE;i++)
		K[0][i]=1;
	for(int i=1;i<SIZE;i++)
		for(int j=0;j<SIZE;j++)
			K[i][j]=K[i-1][j]*j%MOD;
	for(int i=0;i<SIZE;i++)
		for(int j=1;j<SIZE;j++)
			K[i][j]=(K[i][j]+K[i][j-1])%MOD;

	//DP[i][j]=x_1からx_iまでの変数を使って次数がjになる単項式の値の和
	ll DP[SIZE][SIZE]={};
	DP[0][0]=1;
	for(int i=1;i<=N;i++){
		for(int j=0;j<SIZE;j++){
			for(int k=0;k<=j;k++){
				DP[i][j]+=DP[i-1][j-k]*((K[k][B[i-1]]+MOD-K[k][A[i-1]-1])%MOD);
				DP[i][j]%=MOD;
			}
		}
	}
	cout<<DP[N][C]<<endl;
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    double ans = 0;
    for(int i=0; i<n; i++){
        double d;
        string s;
        cin >> d >> s;
        if(s == "BTC") d *= 380000.0;
        ans += d;
    }
    cout << setprecision(8) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

int main()
{
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    if(s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,l;
  cin >> n >> l;
  int sum = ((n-1)*n)/2+l*n;
  int MIN = abs(l);
  int ans;
  for(int i = 0;i < n;i++){
    if(MIN > abs(l+i)){
      ans = i;
      MIN = abs(l+i);
    }
  }
  cout << sum - (l+ans) << endl;
}

Measured memory_bytes: 256
var i,k,n:longint;
begin
read(n);
k:=round(sqrt(2*n));
while k*(k+1)<n*2 do inc(k);
dec(n,k*(k+1)div 2);
for i:=1 to -n-1 do writeln(i);
for i:=1-n to k do writeln(i);
end.

Measured memory_bytes: 128
import java.util.*;

public class Main {
    static int gcd (int x,int y) {return y>0?gcd(y,x%y):x;}
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int A[] = new int[N+1];
        for(int i=1; i<=N; i++) {
            A[i] = sc.nextInt();
        }

        for(int i=1; i<=Math.min(K, 42); i++) {
            int T[] = new int[N+2];
            for(int k=1; k<=N; k++) {
                int leftIndex = Math.max(1, k-A[k]);
                int rightIndex = Math.min(N+1, k+A[k]+1);
                T[leftIndex] += 1;
                T[rightIndex] -= 1;
            }
            int B[] = new int[N+1];
            for(int k=1; k<=N; k++) {
                B[k] = B[k-1] + T[k];
            }
            A = B;
        }
        dump(A, N);
    }

    static void dump(int[] array, int size) {
        for(int i=1; i<=size; i++) {
            if(i!=1) System.out.print(" ");
            System.out.print(String.format("%d", array[i]));
        }
        System.out.println();
    }
}


Measured memory_bytes: 67368
#include<iostream>
#include<cstdio>
#include<cmath>
#define INF 1<<29
#define MAX_V 200
using namespace std;
double cost[MAX_V][MAX_V];
double mincost[MAX_V];
bool used[MAX_V];
int V;
double prim(){
	for(int i=0;i<V;i++){
		mincost[i]=INF;
		used[i]=false;
	}
	mincost[0]=0;
	double res=0;
	while(true){
		int v=-1;
		for(int u=0;u<V;u++){
			if(!used[u]&&(v==-1||mincost[u]<mincost[v]))
			v=u;
		}
		if(v==-1)
		break;
		used[v]=true;
		res+=mincost[v];
		for(int u=0;u<V;u++){
			mincost[u]=min(mincost[u],cost[v][u]);
		}
	}
	return res;
}
int main(){
	while(cin>>V,V){
		double x[MAX_V],y[MAX_V],z[MAX_V],r[MAX_V];
		for(int i=0;i<V;i++)
			cin>>x[i]>>y[i]>>z[i]>>r[i];
		for(int i=0;i<V;i++)
		for(int j=0;j<V;j++){
			if(i==j)
			cost[i][j]=INF;
			else{
				cost[i][j]=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])+(z[i]-z[j])*(z[i]-z[j]))-(r[i]+r[j]);
				if(cost[i][j]<=0)
					cost[i][j]=0;
			}
		}
		printf("%.3lf\n",prim());
		
	}
	return 0;
}

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

const auto EPS = 1e-10;
const auto INF = 100000000;
const auto MOD = 1000000007;

#define MAX_N 100000

struct UF{
	int par[MAX_N];
	int rank[MAX_N];
	int si[MAX_N];

	void init(int n){
		rep(i,n){
			par[i] = i;
			rank[i] = 0;
			si[i] = 1;
		}
	}

	int find(int x){
		if(par[x] == x) return x;
		else return par[x] = find(par[x]);
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		
		if(rank[x] < rank[y]){
			par[x] = y;
			si[y] += si[x];
		} else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
			si[x] += si[y];
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
} uf;

int n;
int a[100001], b[100001];
map<int, int> ma, mb;
map<int, int> conv;

int main(){
    cin >> n;
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    int A = 0;
    rep(i,n) A ^= a[i];
    a[n] = A;
    int B = 0;
    rep(i,n) B ^= b[i];
    b[n] = B;
    n++;
    rep(i,n) ma[a[i]]++;
    rep(i,n) mb[b[i]]++;
    if(ma != mb) {
        cout << -1 << endl;
        return 0;
    }
    int cnt = 0;
    for(auto it = ma.begin(); it != ma.end(); it++) {
        int tmp = (*it).first;
        conv[tmp] = cnt++;
    }
    uf.init(cnt);
    rep(i,n) {
        a[i] = conv[a[i]];
        b[i] = conv[b[i]];
    }
    int ans = 0;
    bool ex = false;
    rep(i,n-1) {
        if(a[i] != b[i]) {
            if(b[i] == a[n-1]) ex = true;
            ans++;
            uf.unite(a[i], b[i]);
        }
    }
    rep(i, cnt) {
        if(uf.si[i] == 1) continue;
        if(uf.par[i] == i) {
            ans++;
        }
    }
    if(ex) ans--;
    cout << ans << endl;
}
































Measured memory_bytes: 16256
#include<iostream>
#include<algorithm>

using namespace std;

int N, a = 0, box[100001] = {}, ans = 0;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a;
		box[a]++;
		if (a > 0) {
			box[a - 1]++;
		}
		if (a < 100000) {
			box[a + 1]++;
		}
	}

	for (int i = 0; i <= 100000; i++) {
		if (box[ans] < box[i]) {
			ans = i;
		}
	}

	cout << box[ans] << endl;

	return 0;
}

Measured memory_bytes: 640
def main():

    S = int(input())
    targetList = list(str(S))
    count = len(targetList)
    target = 753
    min = 999999

    for i in range(count-2):
        cp = targetList[i:i+3]
        tmp = abs(target - int(''.join(cp)))
        if tmp < min:
            min = tmp
    
    print(min)


    


if __name__== "__main__":
    main() 

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <cmath>
#include <string>
#include <iterator>
#include <vector>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '
 
const int MAXN = 1e6 + 5;
int n = 0, m = 0;
int a[MAXN];
int b[MAXN];


int main() {
	int n = 0, m = 0;
	cin >> n >> m;
	vector<pair<int,int> > a(m);
	int l = 1, r = n;
	for(int i = 0; i < m; ++i){
		cin >> a[i].first >> a[i].second;
		l = max(l, a[i].first);
		r = min(r, a[i].second);
	}
	if(l <= r){
		cout << r - l + 1 << endl;
	}
	else{
		cout << 0 << endl;
	}
	

    return 0;
} 

Measured memory_bytes: 1024
#include<stdio.h>
int main(void){
	int x,y;
	do{
		scanf("%d %d",&x,&y);
		if(x!=0 || y!=0){
			if(x>y){
				printf("%d %d\n",y,x);
			}
			else{
				printf("%d %d\n",x,y);
			}
		}
	}while(x+y!=0);
		
	return 0;
}

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

using namespace std;
typedef long long ll;

int main(){
    string s;
    getline(cin, s);

    vector<ll> numr(s.size(), 0);
    for(int i = 0; i < s.size(); ++i){
        if(s.at(i) == 'L'){
            numr.at(i) = 0;
        }else if(i == 0){
            numr.at(i) = 1;
        }else{
            numr.at(i) = numr.at(i - 1) + 1; 
        }
    }

    vector<ll> numl(s.size(), 0);
    for(int i = s.size() - 1; i >= 0; --i){
        if(s.at(i) == 'R'){
            numl.at(i) = 0;
        }else if(i == s.size() - 1){
            numl.at(i) = 1;
        }else{
            numl.at(i) = numl.at(i + 1) + 1; 
        }
    }

    vector<ll> out(s.size(), 0);
    for(int i = 0; i < out.size();){
        if(s.at(i) == 'R' && s.at(i + 1) == 'L'){
            const ll nr = numr.at(i);
            const ll nl = numl.at(i + 1);
            ll nr2 = 0;
            ll nl2 = 0;
            nr2 += nr - nr / 2;
            nl2 += nr / 2;

            nr2 += nl / 2;
            nl2 += nl - nl / 2;

            out.at(i) = nr2;
            out.at(i + 1) = nl2;

            i += 2;
        }else{
            i++;
        }
    }

    for(int i = 0; i < out.size(); ++i){
        cout << out.at(i);
        if(i < out.size() - 1){
            cout << ' ';
        }else{
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3008
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define PI 3.14159265
#define seive_len 1000001

bool seive[seive_len];
int primeSeive[seive_len];

typedef long long int lli;

lli gcd(lli a, lli b) {
  if(b == 0)
    return a;
  return gcd(b, a%b);
}

lli lcm(lli a, lli b) {
  lli gcd_ = gcd(a, b);
  lli lcm_ = (a*b)/gcd_;
  return lcm_;
}

lli fastPower(lli a, lli b) {
  lli res=1;
  while(b > 0) {
    if(b&1)
      res *= a;
    a *= a;
    b >>= 1;
  }
  return res;
}

lli fastPowerM(lli a, lli b, lli mod) {
  a %= mod;
  lli res = 1;
  while(b) {
    if(b%2 == 1)
      res = (res*a)%mod;
    a = (a*a)%mod;
    b >>= 1;
  }
  return res;
}

void multiply(lli a[][2], lli b[][2], int mod) {
  int res[2][2];
  memset(res, 0, sizeof(res));
  for(int i=0;i<2;i++) {
    for(int j=0;j<2;j++) {
      for(int k=0;k<2;k++) {
        res[i][j] += a[i][k]*b[k][j]%mod;
      }
    }
  }
  for(int i=0;i<2;i++)
    for(int j=0;j<2;j++)
      a[i][j] = res[i][j];
}

void matrixExpo(lli a[][2], lli n, int mod) {
  if(n == 0 || n == 1)
    return;
  lli b[][2] = {{1,1}, {1,0}};
  matrixExpo(a, n/2, mod);
  multiply(a, a, mod);
  if(n%2)
    multiply(a, b, mod);
}

void makeSeive() {
  for(int i=2;i*i<=seive_len;i++) {
    if(seive[i]) {
      for(int j=i*i;j<=seive_len;j+=i)
        seive[j] = false;
    }
  }
}

void makePrimeSeive() {
  for(int i=1;i<seive_len;i++)
    primeSeive[i] = i;
  for(int i=4;i<seive_len;i+=2)
    primeSeive[i] = 2;
  for(int i=3;i*i<seive_len;i++) {
    if(primeSeive[i] == i) {
      for(int j=i*i;j<seive_len;j+=i) {
        if(primeSeive[j] = j)
          primeSeive[j] = i;
      }
    }
  }
}

bool isPrime(lli n) {
  for(int i=2;i<=sqrt(n);i++) {
    if(n%i == 0)
      return false;
  }
  return true;
}

void getInput(vector<lli>& a, int n) {
  lli x;
  for(int i=0;i<n;i++) {
    cin >> x;
    a.push_back(x);
  }
}

void testCase() {
  lli i, n;
  string s, t;
  lli res = 0;
  cin >> s >> t;
  for(i=0;s[i];i++)
    if(s[i] != t[i])
      res++;
  cout << res;
}

int main() {
	int t=1;
	// cin >> t;
  // makePrimeSeive();
	while(t--) {
		testCase();
    cout << '\n';
	}
	return 0;
}


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

int main() {
  int x, y;
  cin >> x >> y;
  int ans = 0;
  bool OK = false;
  if(y > x*4) {
    puts("No");
    return 0;
  }
  else {
    for (int i = 0; i <= x; ++i){
      ans = i*4+(x-i)*2;
      if(ans == y) OK = true;
    }
  }
  if(OK) puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using  namespace std;
long long  f(long long  n,long long  m)
{
    if(m/2<n) return m/2;
    m=m-n*2;
    n=n+m/4;
    return n;

}
int main()
{
    long long  n,m;
    scanf("%lld%lld",&n,&m);
    long long  res=f(n,m);
    printf("%lld\n",res);
    return 0;
}


Measured memory_bytes: 256
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	x := []byte(readString())

	st := make([]byte, 0)
	empty := func() bool {
		return len(st) == 0
	}
	push := func(b byte) {
		st = append(st, b)
	}
	pop := func() byte {
		n := len(st)
		r := st[n-1]
		st = st[:n-1]
		return r
	}
	peek := func() byte {
		return st[len(st)-1]
	}

	for _, v := range x {
		if v == 'S' || empty() || peek() == 'T' {
			push(v)
		} else {
			pop()
		}
	}
	println(len(st))
}

// -----------------------------------------------------------------------------


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

using ll = long long;

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

Measured memory_bytes: 3748
N, K = [int(x) for x in input().split()]
A_lst = [int(x) for x in input().split()]
dict = {}
for i in A_lst:
    if not i in dict.keys():
        dict[i] = 1
    else:
        dict[i] += 1

lst = []
for i in dict.keys():
    lst.append(dict[i])
lst.sort()
k = len(lst)
cnt = 0

for i in lst:
    if k <= K:
        break
    else:
        k -= 1
        cnt += i

print(cnt)


Measured memory_bytes: 33004
#include<bits/stdc++.h>
using namespace std;
typedef long long       ll;
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef set<int>        si;
typedef set<ii>         sii;

#define all(x) x.begin(), x.end()
#define clr(x,v) memset(x,v,sizeof x)
#define pb push_back
#define x first
#define y second
#define endl "\n"
#define MOD int(1e9+7)
#define N 200123
int n, t;
ll ans;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n;
    for(ll i=1;i<=n;i++){
        if(i%3==0||i%5==0)continue;
        ans+=i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3652
using System;

namespace pro
{




    class MainClass
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
            int[] r0 = new int[n];
            for(int i = 0; i < n; i++)
            {
                r0[i] = int.Parse(str[i]);
            }
            int[] r1 = new int[n];
            for (int i = 0; i < n; i++)
            {
                r1[i] = r0[i];
            }
            for (int k = 0; k < n - 1; k++)
            {
                for (int i = 0; i < n - 1; i++)
                {
                    if (r1[i] > r1[i + 1])
                    {
                        int tmp = r1[i];
                        r1[i] = r1[i + 1];
                        r1[i + 1] = tmp;
                    }
                }
            }

            int count = 0;
            for(int i = 0; i < n; i++)
            {
                if (r0[i] == r1[i])
                    count++;

            }
            if (count==n-2||count == n)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }


}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define REP(i, x, y) for(int i = (int)x; i <= (int)y; i ++)
#define FOR(i, x, y) for(int i = (int)x; i <  (int)y; i ++)
#define PER(i, x, y) for(int i = (int)x; i >= (int)y; i --)
#define fi first
#define se second
#define mk make_pair
#define pb push_back
using namespace std;
typedef long long LL;
const	int P = 1e9 + 7;

LL Fib[10005];
int dp[55][55], mx[55][55];
pair<LL, LL> bas[105][105];

void work(LL A, LL B){
	if(min(A, B) == 1){
		printf("1 %lld\n", max(A, B) % P);
		return;
	}
	if(A == 2 && B == 2){
		printf("1 4\n");
		return;
	}
	int ans = 2;
	LL res = 0;
	for(ans = 2; Fib[ans] <= B && Fib[ans + 1] <= A; ans ++);
	ans --;
	printf("%d ", ans);
	REP(k, 1, ans){
		LL u = bas[ans][k].fi, v = bas[ans][k].se;
		//du <= Xi
		//dv + dku <= Yi
		LL C = A, D = B;
		for(LL d = 1; d * u <= C; d ++){
			LL lim = (D - d * v);
			if(lim < 0) break;
			res += (lim / (d * u) + 1) % P;
			res %= P;
		}
		swap(C, D);
		for(LL d = 1; d * u <= C; d ++){
			LL lim = (D - d * v);
			if(lim < 0) break;
			res += (lim / (d * u) + 1) % P;
			res %= P;
		}
	}
	printf("%lld\n", res);
}

int main(){
	Fib[1] = 1;
	Fib[0] = 1;
	REP(i, 2, 87) Fib[i] = Fib[i - 1] + Fib[i - 2];
	bas[2][1] = mk(2LL, 3LL);
	bas[2][2] = mk(3LL, 4LL);
	REP(i, 3, 86){
		FOR(j, 1, i){
			LL u = bas[i - 1][j].fi, v = bas[i - 1][j].se;
			bas[i][j] = mk(v, v + u);
			if(j == 1) bas[i][i] = mk(v + u, v + u + u);
		}
	}
	int Q;
	scanf("%d", &Q);
	while(Q --){
		LL X, Y;
		scanf("%lld%lld", &X, &Y);
		if(X < Y) swap(X, Y);
		work(X, Y);
	}
	return 0;
}


Measured memory_bytes: 4224
import heapq
n,m=map(int,input().split())
def func(x):
    return -1*int(x)
A=list(map(func,input().split()))
#print(A)
heapq.heapify(A)
while m>0:
    x=heapq.heappop(A)
    x/=2
    heapq.heappush(A,x)
    m+=-1
sum=0
for a in A:
    #print((-1*a)//1)
    sum+=((-1*a)//1)
print(int(sum))
    


Measured memory_bytes: 14184
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MAX_INT 100000
bool inter(vector<ll> &a,vector<ll> &v,ll n,double t){
    double minr=1e9,maxl=-1e9;
    for(int i=0;i<n;i++){
        minr=min(minr,a[i]+t*v[i]);
        maxl=max(maxl,a[i]-t*v[i]);
    }
    if(maxl<=minr)return true;
    else return false;
}
int main()
{
  ll a,b;
  cin>>a>>b;
  ll dif=abs(a-b);
  if(dif%2==0)cout<<(a+b)/2;
  else cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <functional>

long solve(long n, long capacity, const std::vector<long>& weights, const std::vector<long>& values)
{
    typedef std::map<long, long, std::greater<long> >  container;
    std::vector<container> dp;
    dp.resize(n);
    dp[0][0] = 0;
    dp[0][weights[0]] = values[0];

    for (long i = 1; i < n; i++) {
        dp[i][0] = 0;

        for (container::reverse_iterator it = dp[i - 1].rbegin(); it != dp[i - 1].rend(); ++it) {
            long w = it->first;
            long a = it->second;

            if (a > dp[i].lower_bound(w)->second) {
                dp[i][w] = a;
            }

            if (w + weights[i] <= capacity) {
                long b = dp[i - 1].lower_bound(w + weights[i])->second;
                dp[i][w + weights[i]] = std::max(a + values[i], b);
            }
        }
    }

    return dp[n - 1].lower_bound(capacity)->second;
}

int main()
{
    long n;
    long capacity;
    std::vector<long> weights;
    std::vector<long> values;

    std::cin >> n >> capacity;
    weights.resize(n);
    values.resize(n);

    for (long i = 0; i < n; i++) {
        std::cin >> weights[i] >> values[i];
    }

    std::cout << solve(n, capacity, weights, values) << std::endl;
    return 0;
}


Measured memory_bytes: 53120
#include<stdio.h>
#include<math.h>
int main(void){
  unsigned long long int N,ans;
  int i,x;
  ans=0;
  scanf("%llu",&N);
  x=sqrt(N)+1;
  for(i=1;i<=x;i++){
    if(N-i>0){
      if((N-i)%i==0){
        if((N-i)/i>i){
          ans=ans+((N-i)/i);
          //printf("%d\n",i);
        }
      }
    }
  }
  printf("%llu",ans);
  return 0;
}






Measured memory_bytes: 128
#include<stdio.h>
int main()
{

    long int a,b,k,p,q;
    scanf("%li",&a);
    scanf("%li",&b);
    scanf("%li",&k);
    if(a+b<k)
      {

       p=0;
      q=0;
       printf("%li %li\n",p, q);
   return 0;
      }


          if(a>k)
          {
              p=a-k;
      q=b;
         printf("%li %li\n",p, q);
   return 0;
          }


              else(a<k);
                 {
              p=0;
      q=b-(k-a);
        printf("%li %li\n",p, q);
   return 0;

      }




}




Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

bool solve() {
  int N, M, Q;
  ll ans[SIZE];

  scanf("%d%d%d", &N, &M, &Q);

  if (N == 0) return false;

  for (int i=0; i<M; i++) {
    ans[i] = (1LL << N) - 1;
  }

  ll prev = 0;

  for (int i=0; i<Q; i++) {
    ll x = 0;
    for (int j=0; j<N; j++) {
      ll b;
      scanf("%1lld", &b);
      x += b << j;
    }

    x ^= prev;
    prev = x;

    for (int j=0; j<M; j++) {
      int b;
      scanf("%1d", &b);
      if (b) ans[j] &= x;
      else ans[j] &= ~x;
    }
  }

  string name;
  for (int i=0; i<10; i++) name += '0' + i;
  for (int i=0; i<26; i++) name += 'A' + i;

  for (int i=0; i<M; i++) {
    if (__builtin_popcountll(ans[i]) != 1)
      printf("?");
    else
      printf("%c", name[__builtin_ctzll(ans[i])]);
  }

  puts("");

  return true;
}

int main(){
  while(solve());

  return 0;
}



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

using namespace std;

#define int long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0);

signed main () {
  cin.tie(0);
  cout << setprecision(10);

  int h, w, n; cin >> h >> w >> n;
  vector<pair<int, int>> a(n);
  REP(i, n) cin >> a[i].first >> a[i].second;

  map<pair<int, int>, bool> t;
  REP(i, n) {
    t[pair<int, int>(a[i].first,a[i].second)] = true;
  }

  map<pair<int, int>, bool> select;

  map<int, int> ans;
  int sum = 0;
  pair<int, int> p;

  REP(i, n) {
    FOR(j, -1, 2) {
      FOR(k, -1, 2) {
        p.first = a[i].first+j; p.second = a[i].second+k;
        if(select[p]) continue;
        else select[p] = true;
        if(a[i].first+j <= 1 || a[i].first+j >= h ||
           a[i].second+k <= 1 || a[i].second+k >= w) continue;
        FOR(l, -1, 2) {
          FOR(m, -1, 2) {
            p.first = a[i].first+j+l; p.second = a[i].second+k+m;
            if(t[p]) {
              sum++;
            }
          }
        }
        ans[sum]++;
        sum = 0;
      }
    }
  }

  ans[0] = (h-2) * (w-2);
  FOR(i, 1, 10) {
    ans[0] -= ans[i];
  }
  
  REP(i, 10) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 214272
#include<bits/stdc++.h>
using namespace std;
long long n,Dp[7],i,j,k,ans,Max;
int main(){ 
    scanf ("%d", &n);
    for(i=1;i<=6;i++)
        cin>>Dp[i];
    if(Dp[1]<=Dp[4]&&Dp[2]>=Dp[5]&&Dp[3]>=Dp[6]){
        n=n/Dp[1]*Dp[4]+n%Dp[1];
        for(i=0;i<=n;i++){
            j=n-i;
            Max=max(Max,i%Dp[5]+j%Dp[6]+i/Dp[5]*Dp[2]+j/Dp[6]*Dp[3]);
        }
    }
    else if(Dp[1]>=Dp[4]&&Dp[2]<=Dp[5]&&Dp[3]>=Dp[6]){
        n=n/Dp[2]*Dp[5]+n%Dp[2];
        for(i=0;i<=n;i++){
            j=n-i;
            Max=max(Max,i%Dp[4]+j%Dp[6]+i/Dp[4]*Dp[1]+j/Dp[6]*Dp[3]);
        }
    }
    else if(Dp[1]>=Dp[4]&&Dp[2]>=Dp[5]&&Dp[3]<=Dp[6]){
        n=n/Dp[3]*Dp[6]+n%Dp[3];
        for(i=0;i<=n;i++){
            j=n-i;
            Max=max(Max,i%Dp[4]+j%Dp[5]+i/Dp[4]*Dp[1]+j/Dp[5]*Dp[2]);
        }
    }
    else if(Dp[1]<=Dp[4]&&Dp[2]<=Dp[5]&&Dp[3]<=Dp[6]||Dp[1]>=Dp[4]&&Dp[2]>=Dp[5]&&Dp[3]>=Dp[6]){
        for(i=0;i<=n;i++)
            for(j=0;i+j<=n;j++){
                k=n-i-j;
                ans=max(i/Dp[1]*Dp[4]+i%Dp[1],i/Dp[4]*Dp[1]+i%Dp[4])+
                    max(j/Dp[2]*Dp[5]+j%Dp[2],j/Dp[5]*Dp[2]+j%Dp[5])+
                    max(k/Dp[3]*Dp[6]+k%Dp[3],k/Dp[6]*Dp[3]+k%Dp[6]);
                Max=max(Max,ans);
            }
    }
    else if(Dp[1]>=Dp[4]){//Dp[2]<=Dp[5]
        for(i=0;i<=n;i++){
            j=n-i;
            Max=max(Max,i%Dp[2]+j%Dp[3]+i/Dp[2]*Dp[5]+j/Dp[3]*Dp[6]);
        }
        Max=Max/Dp[4]*Dp[1]+Max%Dp[4];
    }
    else if(Dp[2]>=Dp[5]){
        for(i=0;i<=n;i++){
            j=n-i;
            Max=max(Max,i%Dp[1]+j%Dp[3]+i/Dp[1]*Dp[4]+j/Dp[3]*Dp[6]);
        }
        Max=Max/Dp[5]*Dp[2]+Max%Dp[5];
    }
    else{
        for(i=0;i<=n;i++){
            j=n-i;
            Max=max(Max,i%Dp[1]+j%Dp[2]+i/Dp[1]*Dp[4]+j/Dp[2]*Dp[5]);
        }
        Max=Max/Dp[6]*Dp[3]+Max%Dp[6];
    }
    cout<<Max<<endl;
    return 0;
}

/*******************************************
 _________________________________________
< COWSAY.cpp is created by zrz who is weak >
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
********************************************/

Measured memory_bytes: 256