akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

#define N 105

struct Node{
    string color;
    int d;
    int f;
};

struct Node node[N];
int tt;
int AdjMat[N][N];

void DFS(int u, int n){
    node[u].color = "gray";
    node[u].d = ++tt ;
    for (int v = 1; v <= n; v++){
        if ( AdjMat[u][v] == 0 ) continue;
        if ( node[v].color == "white") DFS(v, n);
    }
    node[u].color = "black";
    node[u].f = ++tt;
}

void DFS_init(int n){
    for (int i = 1; i <= n; i++){
        node[i].color = "white";
    }
    tt = 0;
    
    for (int i = 1; i <= n; i++){
        if (node[i].color == "white") DFS(i, n);
    }
    for (int i = 1; i <= n; i++){
        printf("%d %d %d\n", i, node[i].d, node[i].f);
    }
}

int main(){
    
    int n;
    cin >> n;
    
    for (int i = 1; i <= n; i++ ){
        for (int j = 1; j <= n; j++){
            AdjMat[i][j] = 0;
        }
    }
    
    for (int i = 1; i <= n; i++){
        int u, k, v;
        cin >> u >> k;
        if ( k == 0 ) continue;
        for (int j = 1; j <= k; j++){
            cin >> v;
            AdjMat[u][v] = 1;
        }
        
    }
    DFS_init(n);
    
    return 0;
}


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

int main()
{
	int n, temp, j, count = 0;
	cin >> n;
	int *p = new int[n];

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

	for (int i = n; i > 0; i--) {
		for (int j = 0; j < i - 1; j++) {
			if (p[j] > p[j + 1]) {
				temp = p[j];
				p[j] = p[j + 1];
				p[j + 1] = temp;
				count++;
			}
		}
	}
	for (j = 0; j < n - 1; j++)
		cout << p[j] << " ";
	cout << p[j] << "\n" << count << "\n";

	delete[] p;
	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=2005,INF=1<<30;

struct UF{
    int n;
    vector<int> par,size;
    
    void init(int n_){
        n=n_;
        par.assign(n,-1);
        size.assign(n,1);
        
        for(int i=0;i<n;i++){
            par[i]=i;
        }
    }
    
    int root(int a){
        if(par[a]==a) return a;
        else return par[a]=root(par[a]);
    }
    
    void unite(int a,int b){
        if(root(a)!=root(b)){
            size[root(a)]+=size[root(b)];
            par[root(b)]=root(a);
        }
    }
    
    bool check(int a,int b){
        return root(a)==root(b);
    }
};

ll rui(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1) ans=ans*a%mod;
        a=a*a%mod;
        b/=2;
    }
    return ans;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N,M;cin>>N>>M;
        if(N==0) break;
        UF uf;
        uf.init(N);
        
        for(int i=0;i<M;i++){
            int a,b;cin>>a>>b;
            a--;b--;
            uf.unite(a,b);
        }
        
        int cnt=0,cnt2=0;
        for(int i=0;i<N;i++){
            if(uf.root(i)==i){
                if(uf.size[i]>=2) cnt2=1;
                cnt++;
            }
        }
        
        cout<<(cnt2+rui(2,cnt))%mod<<endl;
    }
}




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

int main()
{
	int a,b,c;
	int x,y,z;

	cin >> a >> b >> c;
	if(a>b){
		y = b;
		b = a;
		a = y;
	}
	if(b>c)
	{
		x = c;
		c = b;
		b = x;
	}
	if(a>b)
	{
		z = b;
		b = a;
		a = z;
	}
	cout << a << " " << b << " " << c << endl;

	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

//a^n mod を計算する関数
long long modpow(long long a,long long n,long long mod) {
    long long res = 1;
    while(n > 0) {
        if(n % 2 == 1) {
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//a^(-1) mod すなわちaの逆元を返す関数
long long modinv(long long a,long long mod) {
    return modpow(a,mod-2,mod);
}

//最大公約数をを返す関数
long long gcd (long long a,long long b) {
    if(a % b == 0) {
        return b;
    }else {
        return (gcd(b,a%b));
    }
}

const long long INF = 1LL << 60;
const long long P = 1000000007;

//nCkを求める関数
long long conbi (long long n,long long k) {
    long long res = 1;
    long long inv;
    for(long long i = n-k+1; i <= n; i++) {
        res *= i;
        res %= P;
    }
    for(long long i = 1; i <= k; i++) {
        inv = modinv(i,P);
        res *= inv;
        res %= P;
    }
    return res;
}

int main() {
    string s;
    cin >> s;
    int flag = 0;
    for(int i = 0; i < s.size(); i++) {
        if(2*i+1 >= s.size()) {
            break;
        }
        if(s.size() % 2 == 1) {
            break;
        }
        if(s[2*i] == 'h' && s[2*i+1] == 'i') {
            flag = 1;
        }else {
            flag = 0;
        }
    }
    if(flag == 1) {
        cout << "Yes";
    }else {
        cout << "No";
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int main()
{
    int N, L;
    int max;
    int ans;
    int diff = 100000;

    cin >> N >> L;

    max = 0;
    rep(i, N) {
        max += L + i;
    }

    ans = max;
    rep(i, N) {
        if(abs((L + i)) < diff) {
            diff = abs(L + i);
            ans = max - (L + i);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,c,k;
  scanf("%d %d %d %d", &a, &b, &c, &k);
  while(k>0){
    if(b<=a){
      b=b*2;
    }else{
      c=c*2;
    }
    k--;
  }
  if(b>a && c>b){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(10) << ans << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


signed main(){
    cin >> n;
    vec(a,n);
    vec(b,n);
    REP(i,n){
        cin >> a[i];
        b[i] = a[i];
    }
    Sort(b);
    int tmp=0;
    REP(i,n){
        if(a[i]!= b[i]){
            tmp++;
        }
    }
    (tmp<=2)? cout << "YES" : cout << "NO";

    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int gomi(int s){
if(s<0)s=-s;
return s;
}

int kasu(int a,int b){
if (a==0||b==0){return 1;
}else if (a<0&&b<0){return 2;
}else if (a>0&&b>0){return 2;
}else if (a<0&&b>0){return 3;
}else if (a>0&&b<0){return 3;
}
}

int main(void){
unsigned long int total;
int hoge,var,hogera,max,log;
int array[100000]={0};

scanf("%d",&max);
log=total=0;
for(var=0;var<(max);var++){
scanf("%d",&hoge);
total += gomi(hoge-log);
array[var] = hoge-log;
log = hoge;
}
total += gomi(log);
array[var] = -log;


for(var=0;var<max;var++){
hoge=0;
switch(kasu(array[var],array[var+1])){
case 1:hoge = 0;break;
case 3:
if(gomi(array[var]) < gomi(array[var+1]))
{
hoge =gomi(2*array[var]);
}else{
hoge = gomi(2*array[var+1]);
};break;
case 2:hoge = 0;break;
}
printf("%d",total-hoge);
puts("");
}

return 0;
}

Measured memory_bytes: 1536
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
ans=[[0]*35 for i in range(n)]

#print(ans)
#sys.exit()
for i in range(35):
    bits=[0 for j in range(n)]
    for k in range(n):
        bits[k]=(lis[k]>>i) %2
    #print(bits)
    ans[0][i]=sum(bits[1:])%2
    sm=sum(bits[1:])%2+bits[0]%2
    for k in range(1,n):
        ans[k][i]=(bits[k]-sm)%2
#print(ans)
answer=[0 for i in range(n)]
for i in range(n):
    for j in range(35):
        answer[i]+=ans[i][j]*(2**j)
print(*answer)
        
    
    
    
    


Measured memory_bytes: 235932
#!/usr/bin/ruby
# -*- coding: utf-8 -*-

while (n = gets.to_i) && n != 0
  dice = {:top => 1, :north => 2, :east => 4,
          :west => 3, :south => 5, :bottom => 6}
  n.times do
    tmp = dice[:top]
    if (direct = gets.chomp) == "north"
      dice[:top] = dice[:south]
      dice[:south] = dice[:bottom]
      dice[:bottom] = dice[:north]
      dice[:north] = tmp
    elsif direct == "east"
      dice[:top] = dice[:west]
      dice[:west] = dice[:bottom]
      dice[:bottom] = dice[:east]
      dice[:east] = tmp
    elsif direct == "west"
      dice[:top] = dice[:east]
      dice[:east] = dice[:bottom]
      dice[:bottom] = dice[:west]
      dice[:west] = tmp
    else
      dice[:top] = dice[:north]
      dice[:north] = dice[:bottom]
      dice[:bottom] = dice[:south]
      dice[:south] = tmp
    end
  end
  puts dice[:top]
end
  

Measured memory_bytes: 6108
class SegmentTree:
    def __init__(self, initial_values, f=max, zero=0):
        self.__f, self.__z, self.__size = f, zero, len(initial_values)
        self.__n = 1 << ((self.__size - 1).bit_length())
        self.__dat = [zero for _ in range(2 * self.__n)]
        zi = self.__get_leaf(0)
        for i, v in enumerate(initial_values): self.__dat[zi + i] = v
        for i in range(zi-1, -1, -1): self.__dat[i] = self.__f(*self.__get_children(i))
    
    def update(self, index, value):
        i = self.__get_leaf(index)
        if self.__dat[i] == value: return
        self.__dat[i] = value
        while i:
            i = self.__get_parent(i)
            self.__dat[i] = self.__f(*self.__get_children(i))
    
    def query(self, from_inclusive, to_exclusive):
        ans = self.__z
        if to_exclusive <= from_inclusive: return ans
        l, r = self.__get_leaf(from_inclusive), self.__get_leaf(to_exclusive) - 1
        while r - l > 1:
            if self.__is_right(l): ans = self.__f(ans, self.__dat[l])
            if self.__is_left(r): ans, r = self.__f(ans, self.__dat[r]), r-1
            l, r = l//2, self.__get_parent(r)
        ans = self.__f(ans, self.__dat[l])
        if l != r: ans = self.__f(ans, self.__dat[r])
        return ans

    def __get_leaf(self, i): return self.__n + i - 1
    def __get_parent(self, i): return (i-1)//2
    def __get_children(self, i): return (self.__dat[2*i+1], self.__dat[2*i+2])
    def __is_left(self, i): return i&1 == 1
    def __is_right(self, i): return i&1 == 0

N = int(input())
S = input()
g = lambda c: 1 << (ord(c)-ord('a'))
tree = SegmentTree([g(c) for c in S], lambda x,y:x|y)
Q = int(input())
for _ in range(Q):
    t, a, b = input().split()
    if t == '1': tree.update(int(a)-1, g(b))
    else: print(bin(tree.query(int(a)-1, int(b))).count('1'))

Measured memory_bytes: 116244
import sys
sys.setrecursionlimit(10**6)

n, k = map(int, input().split())
A = list(map(int, input().split()))

#val = 1
#for a in A[:k]:
#    val *= a
#ans = [val]
#pos = k
#while pos < n:
#    tmp = ans[-1]*A[pos]//A[pos-k]
#    ans.append(tmp)
#    pos += 1
#
#for i in range(len(ans)-1):
#    if ans[i] < ans[i+1]:
#        print('Yes')
#    else:
#        print('No')
        
for i in range(n-k):
    pos = k+i
    if A[pos] > A[pos-k]:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 31548
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SORT(i) sort((i).begin(),(i).end())
constexpr int INF = 2000000000;
constexpr int mod = 1000000007;

int main() {
	vector<int>s(3);
	rep(i, 3)cin >> s[i];
	int k; cin >> k;
	SORT(s);
	rep(i, k)s[2] *= 2;
	int ans = 0;
	rep(i, 3)ans += s[i];
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
/*...Bismillahir Rahmanir Rahim...*/
#include <iostream>
#include<algorithm>
using namespace std;

int main()
{
    int n,s=0,t=0; cin>>n;
    int a[n];
    for (int i = 0; i < n; ++i) cin>>a[i];
    for (int i =0; i <n; ++i)
    {
        if ( (a[i]%2==0) && a[i]%3 != 0 && a[i]%5 != 0 ) {
            cout<<"DENIED"<<endl;
            return 0;
        }
    }
    cout<<"APPROVED"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
    tree_order_statistics_node_update>;
 
typedef long long int ll;
const ll N = 1e6 +9;
const ll p = 31;
const ll m = 1e9 + 7;
const ll inf= 1e14;
const ll mod = 1e9+7;
#define x first
#define y second
#define pb push_back
#define mp make_pair
using pii = pair<ll, ll>;

ll powm(ll a, ll b) { ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }
ll val[N];
ll adj[N][2];
ll ans = 0;
multiset<ll> l,r;
map<ll,bool> cnbf;
map<ll,int> ct;
void dfs(ll v){
     if(adj[v][0]!=-1){
          l.insert(val[v]);
          dfs(adj[v][0]);
          auto e = l.find(val[v]);
          l.erase(e);
     }
     if(adj[v][1]!=-1){
          r.insert(val[v]);
          dfs(adj[v][1]);
          auto e = r.find(val[v]);
          r.erase(e);
     }
     ll ul = inf;
     ll ll = 0;
     if(l.size() ){
          ul = *l.begin();
         
     }
     if(r.size()){
          ll = *r.rbegin();
          // cout<<ll<<'\n';
     }
          // cout<<v<<" "<<ul<<" "<<ll<<'\n';

     if(val[v]>=ll && val[v]<=ul){
          cnbf[val[v]] = 1;
     }


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

     ll q = 1;
     // cin>>q;
     while(q--){
          ll n;cin>>n;
          ll h[n];
          ll dp[n];
          for(int i = 0;i<n;i++){
               cin>>h[i];
          }
          dp[0] = 0;
          dp[1] = abs(h[1]-h[0]);
          for(int i = 2;i<n;i++){
               dp[i] = min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2]);
          }
          cout<<dp[n-1]<<'\n';
     }
}         

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
   long long n, s=0;
   cin>>n;
   for(int i=1; i<=n; i++)
   {
       if(i%3!=0 && i%5!=0)
       {
           s=s+i;
       }
   }
   cout<<s<<endl;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

//i番目のビットを返す
bool getBit(int num, int i){
	return ((num & (1 << i)) != 0);
}

//i番目を1にする
int setBit(int num, int i){
	return num | (1 << i);
}

//i番目を0にする
int clearBit(int num, int i){
	int mask = ~(1 << i);
	return num & mask;
}

//i番目をvで置き換える
int updateBit(int num, int i, int v){
	int mask = ~(1 << i);
	return (num & mask) | (v << i);
}

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

	int k = log2(L);

	vector<tuple<int,int,int>> e;
	int t = 1;
	rep(i,k){
		e.emplace_back(i, i + 1, t);
		e.emplace_back(i, i + 1, 0);
		t *= 2;
	}

	int p = 1;
	rep(_,k) p*=2;

	for(int i = k; i >= 0; i--){
		if(L == 0) break;
		if(L - p >= t){
			e.emplace_back(i, k, L - p);
			L -= p;
		}
		p/=2;
	}

	cout << k + 1 << ' ' << e.size() << endl;
	for(auto i : e){
		int u, v, c;
		tie(u, v, c) = i;
		cout << u + 1 << ' ' << v + 1 << ' ' << c << endl;
	}
}


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

int main() {
  string S, T;
  cin >> S >> T;
  
  int count=0;
  int nagasa = S.size();
  
  for(int i=0;i<nagasa;i++){
    if(S.at(i)!=T.at(i)){
      count++;
    }
  }
  cout << count << endl;
  
}
      

Measured memory_bytes: 3840
n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0
for l in range(n + 1):
	for r in range(l, max(n, l + 1)):
		o = v[:l] + v[r + 1:]
		if len(o) > k:
			continue
		o.sort()
		i = 0
		while i < len(o) and i < k - len(o) and o[i] < 0:
			i += 1
		ans = max(ans, sum(o[i:]))
		# print("%d %d: %s, %d, %d" % (l, r, str(o), i, ans))
print(ans)

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

void solve()
{
		
	ll n;
	cin>>n;
	ll a[n];
	for (int i = 0; i < n; ++i)
	{
		/* code */
		cin>>a[i];
	}
	// ll f[n],s[n];
	map<ll,ll> m;
	for (int i = 1; i <= n; ++i)
	{
		m[i+a[i-1]]++;
	}
	ll cn = 0;
	for (int i = 1; i <= n; ++i)
	{
		/* code */
		ll t = m[i-a[i-1]];
		cn += t;
	}
	cout<<cn<<endl;
}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

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

using LL = int64_t;
using VL = vector<LL>;
using PLL = pair<LL, LL>;

template<typename T> T gcd(T a, T b) { return b?gcd(b,a%b):a;}

template<class T>
std::map<T, int> factorize(T n){
	std::map<T, int> res;
	for (LL i = 2; i * i <= n; i++){
		while (n % i == 0){
			res[i]++;
			n /= i;
		}
	}
	if (n > 1)
		res[n]++;
	return res;
}

//main code
int main(int argc, char *argv[])
{
	LL a,b;
	cin >> a >> b;
	LL g = gcd(a, b);
	auto mp = factorize(g);
	cout << mp.size()+1 << endl;
	return 0;
}


Measured memory_bytes: 256
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
   
    ll h,a,i,ans=0;
    cin>>h>>a;
    while(h>0)
    {
    	h -= a;
    	ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>

using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

//comb　nCk
#define MAX 1000009
#define MOD 1000000007
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll x, y;

int main(){
    cin >> x >> y;
    COMinit();
    // rep(i, x+1){
    //     rep(j, y+1){
    //         if(i&1){
    //             if((j-(i+3)/2)%3!=0 || i*2<j || j<(i+3)/2)cout << '.';
    //             else cout << COM((i+1)/2+(j-(i+3)/2)/3, (j-(i+3)/2)*2/3+1);
    //         }
    //         else {
    //             if((j-i/2)%3!=0 || i*2<j || j<i/2)cout << '.';
    //             else cout << COM(i/2+(j-i/2)/3, (j-i/2)*2/3);
    //         }
    //         cout << ", ";
    //     }
    //     cout << endl;
    // }
    if(x&1){
        if((y-(x+3)/2)%3!=0 || x*2<y || y<(x+3)/2)cout << 0;
        else cout << COM((x+1)/2+(y-(x+3)/2)/3, (y-(x+3)/2)*2/3+1);
    }
    else {
        if((y-x/2)%3!=0 || x*2<y || y<x/2)cout << 0;
        else cout << COM(x/2+(y-x/2)/3, (y-x/2)*2/3);
    }
}

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

using namespace std;

int main(){
  int64_t L, L0 = 2, L1 = 1;//三種のリュカ数
  int N;

  //何番目のリュカ数か
  cin >> N;
  for(int i = 1; i < N; i++){
    L = L0 + L1;
    L0 = L1;
    L1 = L;
  }

  if(N == 0) L=2;
  if(N == 1) L=1;

  cout << L << endl;
}


Measured memory_bytes: 256
def partition(A, p, r):
    x = A[r][1]
    i = p - 1
    for j in range(p, r):
        if A[j][1] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1


def quicksort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quicksort(A, p, q - 1)
        quicksort(A, q + 1, r)


n, *D = open(0).read().split()
n = int(n)
A = [(D[2 * i], int(D[2 * i + 1]), i) for i in range(n)]
quicksort(A, 0, n - 1)
stable = True
for i in range(n-1):
    if A[i][1] == A[i + 1][1] and A[i][2] > A[i + 1][2]:
        stable = False
print('Stable' if stable else 'Not stable')
A = [(a[0], a[1]) for a in A]
print('\n'.join(map(lambda x: ' '.join(map(str, x)), A)))



Measured memory_bytes: 37668
#include<bits/stdc++.h>
 
using namespace std;
 
const int vy[] = {0, 1, 0, -1}, vx[] = {1, 0, -1, 0};
 
const int INF = 1 << 30;
 
int main()
{
  int N;
  cin >> N;
 
  vector< int > war[10000];
  int in[10000] = {};
 
  for(int i = 0; i < 2 * N * N - 2 * N; i++) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    war[a].emplace_back(b);
    war[b].emplace_back(a);
    in[a]++;
    in[b]++;
  }
 
  int mat[100][100] = {{}};
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      for(int k = 0; k < 4; k++) {
        int nx = j + vx[k], ny = i + vy[k];
        if(nx < 0 || ny < 0 || nx >= N || ny >= N) continue;
        mat[i][j]++;
      }
    }
  }
 
  vector< int > vs[5];
  for(int i = 0; i < N * N; i++) {
    vs[in[i]].emplace_back(i);
  }
 
  int v[100][100], used[10000] = {};
  memset(v, -1, sizeof(v));
 
  v[0][0] = vs[2][0];
  v[0][1] = war[v[0][0]][0];
  v[1][0] = war[v[0][0]][1];
  used[v[0][0]] = true;
  used[v[0][1]] = true;
  used[v[1][0]] = true;
 
 
  for(int i = 0; i < N * N; i++) {
    for(int j = 0; j < N; j++) {
      for(int k = 0; k < N; k++) {
        if(v[j][k] != -1) {
          for(int l = 0; l < 4; l++) {
            int ny = j + vy[l], nx = k + vx[l];
            if(ny < 0 || nx < 0 || ny >= N || nx >= N) continue;
            if(v[ny][nx] == -1) {
              int ret = 0;
              for(auto &p : war[v[j][k]]) {
                if(used[p]) continue;
                if(in[p] != mat[ny][nx]) continue;
                ret++;
              }
              if(ret == 1) {
                for(auto &p : war[v[j][k]]) {
                  if(used[p]) continue;
                  if(in[p] != mat[ny][nx]) continue;
                  v[ny][nx] = p;
                  used[p] = true;
                }
              }
            }
          }
        }
      }
    }
  }
 
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      assert(v[i][j] >= 0);
      if(j > 0) cout << " ";
      cout << v[i][j] + 1;
    }
    cout << endl;
  }
}

Measured memory_bytes: 3964
//abc118_a.cpp
//Sat Mar  2 08:53:37 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	if (m%n==0){
		cout << n+m << endl;
	}else {
		cout << m-n << endl;
	}

}

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

vector<string> s;
int n,l;

int main()
{
    cin >> n >> l;
    for(int i = 0; i < n; i++)
    {
        string x;
        cin >> x;
        s.push_back(x);
    }
    sort(s.begin(), s.end());
    for(auto x:s) cout << x;
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>

using namespace std;

int main(){
    string c;
    cin>>c;
    int a,flag;
    for(int i=0;i<c.size();i++){
         a = i+1;
        flag = 0;
        if(a%2 == 0){
            if(c[i]=='L' || c[i]=='U' || c[i]=='D')continue;
            else{
                flag = 1;
                break;
            }
        }
        else{
          if(c[i]=='R' || c[i]=='U' || c[i]=='D')continue;
          else{
            flag = 1;
            break;
          }
        }
    }

    if(flag==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

string solve(string s,string t){
	if(s.size()<t.size()) swap(s,t);
	for(int i=s.size()-1,j=t.size()-1;i>=0;i--,j--){
		if(j>=0) s[i]+=t[j]-'0';
		if(s[i]>'9'){
			s[i]-=10;
			if(i==0) s='1'+s;
			else s[i-1]++;
		}
	}
	return s;
}

int main(){
	string s;
	while(cin>>s){
		rep(i,0,10){
			string t;
			rep(j,0,s.size()){
				if(s[j]=='X') t[j]='0'+i;
				else t[j]=s[j];
			}
			string a,b,c;
			int x,y;
			rep(j,0,s.size()){
				if(s[j]=='+') x=j;
				if(s[j]=='=') y=j;
			}
			rep(j,0,x) a+=t[j];
			rep(j,x+1,y) b+=t[j];
			rep(j,y+1,s.size()) c+=t[j];
			if((a[0]=='0'&&a!="0")||(b[0]=='0'&&b!="0")||(c[0]=='0'&&c!="0")) continue;
			if(solve(a,b)==c){
				o(i); break;
			}
			if(i==9) o("NA");
		}
	}
}

Measured memory_bytes: 1200
#include <queue>
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i, n) for(long long i = 0;(i) < (n);(i)++)
using namespace std;
using ll = long long;




ll N;
ll d[100001];
ll ans = 1;
const ll mod = 998244353;




int main()
{
	cin >> N;
	rep(i, N)
	{
		cin >> d[i];
	}
	if (d[0] != 0) {
		cout << 0 << endl;
		return 0;
	}
	sort(d, d + N);
	ll temp = 1;
	ll tempbefore = 1;
	if (d[0] != 0) {
		cout << 0 << endl;
		return 0;
	}
	if (N > 1)
	{
		if (d[1] != 1) {
			cout << 0 << endl;
			return 0;
		}
	}
	for (ll i = 1; i < N; i++)
	{
		if (d[i] == d[i - 1] + 1)
		{
			ll res = 1;
			for (int j = 0; j < temp; j++) {
				res *= tempbefore;
				res %= mod;
			}
			ans *= res;
			ans %= mod;
			tempbefore = temp;
			temp = 1;
		}
		else if(d[i] == d[i - 1])
		{
			temp++;
		}
		else {
			ans = 0;
			break;
		}
	}
	ll res = 1;
	for (int i = 0; i < temp; i++) {
		res *= tempbefore;
		res %= mod;
	}
	ans *= res;
	ans %= mod;
	tempbefore = temp;
	temp = 1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#define MAX_N 10000

int par[MAX_N], rank[MAX_N];

void init(int n);
int find(int x);
void unite(int x, int y);
int same(int x, int y);

void init(int n)
{
    int i;
    for (i = 0; i < n; i++) {
        par[i] = i;
        rank[i] = 0;
    }
}

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;
    } else {
        par[y] = x;
        if (rank[x] == rank[y]) {
            rank[x]++;
        }
    }
}

int same(int x, int y)
{
    //同じなら0, 違うならそれ以外
    return find(x) - find(y);
}

int main(void)
{
    int n, q, i, j, com, x, y;
    scanf("%d %d", &n, &q);
    init(n);
    for (i = 0; i < q; i++) {
        scanf("%d %d %d", &com, &x, &y);
        if (com) {
            if (same(x, y)) {
                puts("0");
            } else {
                puts("1");
            }
        } else {
            unite(x, y);
        }
    }
    return 0;
}

Measured memory_bytes: 660
import static java.lang.System.*;
import java.util.*;
 
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		TreeSet<Integer> set = new TreeSet<>();
		for (int i=a; i<=Math.min(b,a+k-1); i++) set.add(i);
		for (int i=b; i>=Math.max(a,b-k+1); i--) set.add(i);
		set.forEach(out::println);
	}
}

Measured memory_bytes: 28492
import numpy as np
import math
N,D = map(int,input().split())
X = []
count = 0
for i in range(N):
    X.append(np.array(list(map(int,input().split()))))
for i in range(N):
    for j in range(i,N-1):
        tmp = np.linalg.norm(X[i] -X[j+1])
        if tmp - math.floor(tmp) == 0:
            count += 1
print(count)



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



int main(void){
	int n, q;
	cin >> n;
	int s[n];

	for(int i = 0; i < n; i++){
		cin >> s[i];
	}
	cin >> q;
	int t[q];

	for(int i = 0; i < q; i++){
		cin >> t[i];
	}
	int count = 0;
	for(int i = 0; i < q; i++){
		int low = 0;
		int high = n;
		while(low <= high){
		    int mid = (low + high)/2;
			if(t[i] == s[mid]){
				count++;
				break;
			}
			else if(t[i] > s[mid]){
				low = mid+1;
			}
			else{
				high = mid-1;
			}
		}
	}
	cout << count << endl;
}





Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
 
  if ((a + b) > (c + d)) {
    cout << "Left" << endl;
  }
  
  else if ((a + b) < (c + d)) {
    cout << "Right" << endl;
  }
  
  else
    cout << "Balanced" << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	
	int x,s;
	scanf("%d",&x);
	s=x%10;
	x=x/100;
	if(x==s)
	cout<<"Yes";
	else
	cout<<"No";
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    REP(i, N) cin >> S[i];

    set<string> values;
    REP(i, N) values.insert(S[i]);

    cout << values.size() << endl;

    return 0;
}

Measured memory_bytes: 24944
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second

using namespace std;
int main(){
	std::ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int count=0;
	unordered_set<string> set;
	for(int i=0;i<n;i++){
		string s;
		cin >> s;
		if(set.find(s)==set.end()){
			count++;
			set.insert(s);
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 17684
#include <bits/stdc++.h>
using namespace std;
#define pb(x) push_back(x)
#define faster ios::sync_with_stdio(false)
#define ll long long int
#define sz 200005
#define mp(x,y) make_pair(x,y) 
#define pii pair<long long int,long long int>
#define tor ::iterator
#define letsgo long long  int i,j,k,q=0,t,tmp,n,flg=0,cntr=0,maxxer = 0
#define fi first
#define se second
#define be begin()
#define en end()
#define mod 1000000007
#define debug(x) cout<<" "<<x<<endl
ll dp[105][100005] ;
ll knapsack(ll i,ll w,ll wt[],ll val[]){
	if(i<0)
		return 0;
	if(dp[i][w] != -1)
		return dp[i][w];
	if(wt[i] <= w)
		dp[i][w] = max(knapsack(i-1,w,wt,val),
			knapsack(i-1,w-wt[i],wt,val)+val[i]);
	else 
		dp[i][w] = knapsack(i-1,w,wt,val);
	return dp[i][w];

}

int main(){
	faster;
	letsgo; 
	ll w;
	ll m;

	cin>>n>>w;
	ll val[n+1],wt[n+1];
	for(i=0;i<=n;i++){
		for(j=0;j<=w;j++)
			dp[i][j] = -1;
	}
	for(i=0;i<n;i++){
		cin>>wt[i]>>val[i];
	}
	knapsack(n-1,w,wt,val);
	// for(i=0;i<=n;i++){
	// 	for(j=0;j<=w;j++){
	// 		cout<<dp[i][w]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	for(i=0;i<=w;i++){
		maxxer = max(maxxer,dp[n-1][i]);
	}
	cout<<maxxer<<endl;
}


Measured memory_bytes: 80128
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k % 2 == 0) {
        cout << a - b << endl;
    } else {
        cout << b - a << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n;
    ll k;
    cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll dp[50][2];
    fill(dp[0],dp[50],-1LL);
    dp[0][0]=0;
    for(int i=0;i<45;i++){
        int D=(k>>(44-i))&1;
        for(int j=0;j<2;j++){
            if(dp[i][j]==-1)continue;
            for(int d=0;d<=(j?1:D);d++){
                int df=0;
                for(int l=0;l<n;l++){
                    df+=((a[l]>>(44-i))&1)^d;
                }
                dp[i+1][j||d<D]=max(dp[i+1][j||d<D],dp[i][j]*2+df);
            }
        }
    }
    cout<<max(dp[45][0],dp[45][1])<<endl;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
    int D, N;
    cin >> D >> N;

    int p = 1;
    for (int i = 0; i < D; i++){
        p *= 100;
    }

    if (N < 100){
        cout << p * N << endl;
    }else{
        cout << 101 * p<< endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define endl '\n'
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define maxn 3005

int dp[maxn][maxn];
string s,t;

void bt(int x,int y,int r){
    if(!r)
    return ;
    if(dp[x-1][y]==r)
        bt(x-1,y,r);
    else if(dp[x][y-1]==r)
        bt(x,y-1,r);
    else{
        bt(x-1,y-1,r-1);
        cout<<s[x-1];
    }
}

int32_t main(){
    IOS;
    cin>>s>>t;
    int ss=s.size(),st=t.size();
    memset(dp,0,sizeof(dp));
    rep1(i,ss)
        rep1(j,st)
            if(s[i-1]==t[j-1])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    bt(ss,st,dp[ss][st]);
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int l,n;
int x[31];
int w[31];

int main(){
  cin>>l>>n;
  REP(i,n) cin>>x[i]>>w[i];
  cout<<n<<endl;
  REP(i,n) cout<<(-x[i])<<" "<<w[i]<<endl;
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
const int INFTY =2147483647;
int main(){
    int k,a,b;
    cin>>k>>a>>b;
    string s ="OK";
    if(a/k==b/k&&(a%k)!=0) s="NG";
    cout<<s<<endl;
}

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

int main(){

  int n, a;
  int money = 100000;

  cin >> n;
  for(;0<n;n--){
    money = (float)money * (float)1.05;
    a = money / 1000;
    if(money-a*1000 != 0)
      money = (a+1)*1000;
  }
    cout << money << endl;

  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int maxn = 200100;
const int mod = 1e9 + 7;
long long power(long long x, long long k)
{
	long long ans = 1;
	while(k)
	{
		if(k & 1)
			(ans *= x) %= mod;
		(x *= x) %= mod;
		 k >>= 1;
	}
	return ans;
}
long long fac[maxn], inv[maxn];
long long C(long long x, long long y)
{
	if(x < y)
		return 0;
	if(y == 0)
		return 1;
	return fac[x] * inv[y] % mod * inv[x - y] % mod;
}
void init()
{
	fac[0] = 1;
	for(int i = 1; i <= maxn - 10; i ++)
		fac[i] = fac[i - 1] * i % mod;
	inv[maxn - 10] = power(fac[maxn - 10], mod - 2);
	for(int i = maxn - 11; i >= 0; i --)
		inv[i] = inv[i + 1] * (i + 1) % mod;
}
int n, m, a, b;
int main()
{
	//freopen("WeirdDream.in", "r", stdin);
	//freopen("WeirdDream.out", "w", stdout);
	std::ios::sync_with_stdio(false);
	init();
	cin >> n >> m >> a >> b;
	n --, m --, a --, b --;
	long long sum = C(n + m, n);
	//cout << sum << endl;
	long long ans = 0;
	for(int k = 0; k <= b; k ++)
	{
		//cout << n - a + k << " " << n - a << " " << C(n - a + k, n - a) << endl;
		//cout << a + m - k << " " << a << " " << C(a + m - k, a) << endl;
		sum -= (C(n - a + k, n - a) - ans + mod) * C(a + m - k, a) % mod;
		ans = C(n - a + k, n - a);
		if(sum < 0)
			sum += mod;
		//cout << sum << endl;
	}
	cout << sum << endl;
	return 0;
}

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

int main() 
{
    int A,B,C,X;
    int count = 0;

    cin >> A >> B >> C >> X;

    for( int i=0 ; i<=A ; i++ )
    {
        for( int j=0 ; j<=B ; j++ )
        {
            for( int k=0 ; k<=C ; k++ )
            {
                int money = i * 500 + j * 100 + k * 50;
                if( X == money  ) count++;
            }
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
N = int(input())
S = input()

ans = 0
for i in range(10):
  for j in range(10):
    for k in range(10):
      l = 0
      for c in S:
        if l == 0 and ord(c) - ord('0') == i: l += 1
        elif l == 1 and ord(c) - ord('0') == j: l += 1
        elif l == 2 and ord(c) - ord('0') == k: l += 1
      if l == 3:
        ans += 1
print(ans)
  


Measured memory_bytes: 44764
#include<bits/stdc++.h>
using namespace std;
using lint = long long;

const lint MAX = 2010;
const lint MOD = 1000000007;

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

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

lint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
  lint N, K; cin >> N >> K;
  COMinit();
  for(lint i = 0; i < K; i++){
    cout << (COM(K - 1, i) * COM(N - K + 1, i + 1)) % MOD << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main()
{
  long long int i,j,k,l;
  long long int N,M;
  long long int space;
  long long int A,B,C,D;
  char S[256];
  char T[256];
  scanf("%s",S);
  scanf("%s",T);
  
  i = strlen(T);
  i = i-1;
  T[i] = '\0';
  
 if( strcmp(S,T) == 0 ){
   printf("Yes\n");
 }
 else{
   printf("No\n");
 }
 
  return 0; 
  
}

Measured memory_bytes: 1620
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define in(n) for(int i=0;i<n;i++)
#define inj(n) for(int j=0;j<n;j++)
#define it n int
#define ll long long 
#define ull unsigned ll
#define int ll int
#define S second 
#define F first 
#define globalbool 2000000
using namespace std;
int solve(int n,int A[],int dp[],int k)
{
    if(n==0)
        return 0;
    if(n<0)
        return INT_MAX;
    if(dp[n]!=INT_MAX)
        return dp[n];
    for(int i=1;i<=k;i++)
    {
        if(n-i>=0)
            dp[n]=min(dp[n],solve(n-i,A,dp,k)+abs(A[n]-A[n-i]));
    }
    return dp[n];
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    int A[n];
    int dp[n+1];
    //memset(dp,-1,sizeof(dp));
    for(int i=0;i<n+1;i++)
        dp[i]=INT_MAX;
    in(n)
        cin>>A[i];
    cout<<solve(n-1,A,dp,k);
}

Measured memory_bytes: 5888
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

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

    int p[6];
    rep(i, 6){
        p[i] = 100 + i;
    }

    bool dp[101010];
    fill(dp, dp + 101010, false);
    dp[0] = true;

    rep(i, 101010){
        rep(j, 6){
            if(i + p[j] < 101010){
                dp[i + p[j]] = dp[i] || dp[i + p[j]];
            }
        }
    }

    int x;
    cin >> x;

    cout << dp[x] << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define md 1000000007
#define mem(arr, x) memset(arr, x, sizeof(arr))
#define fio()                         \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);
#define pb push_back
#define vi vector<lli>
#define vvi vi<vi>
typedef long long int lli;
typedef float fl;
int main()
{
	lli t;
	cin >> t;
	lli ans = 0 , k =0 ;
	map <lli,lli> mp ;
 	while (t--)
	{
		lli x ,y ;
		cin >> x >> y ;

		if( x == y ) 
		{
			ans ++;
		}
		else ans = 0; 
		if( ans == 3 ) k++ ;
	}
	if( k ) cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 3624
Sd = input()
T = input()

def check(A, B):
    for a, b in zip(A, B):
        if a!= "?" and a != b:
            return False

    return True


for i in range(len(Sd) - len(T) + 1)[::-1]:
    if check(Sd[i:i + len(T)],T):
        print((Sd[:i] + T + Sd[i + len(T):]).replace("?", "a"))
        break
else:
    print("UNRESTORABLE")


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a, b, k, ans; cin >> a >> b >> k;
  for(int i = min({a,b});i > 0;i--){
    if(a % i == 0 && b % i == 0){
      ans = i;
      k--;
    }
    if(k == 0){
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int arr[2*n];
	for(int i=0;i<2*n;i++)
		cin>>arr[i];
	sort(arr,arr+2*n);
	int t= 0;
	for(int i=0;i<2*n;i+=2){
		t+=arr[i];

	}
	cout<<t;
	return 0;
}
		

Measured memory_bytes: 256