akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>  //setprecision(桁)
using namespace std;
#define pb push_back
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 1e+9
const ll MOD = 1000000007;

struct edge {
    int to;
    double cost;
};

// <最短距離, 頂点の番号>
using P = pair<double, int>;

int V;
const int ci = 2e5+ 5;
vector<edge> G[ci];
double d[ci];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) { //cout << "On" << endl;
        P p = que.top();
        que.pop();
        int v = p.second; //cout << "v=" << v << endl;
        if (d[v] < p.first) continue;
        for (int i=0; i<G[v].size(); i++) {
            edge e = G[v][i]; //cout << "koo" << endl;
            if (d[e.to] > d[v] + e.cost) { //cout << e.cost << endl;
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}
ll dp[100005][13];

int main(){
    string s; cin >> s;
    int n = s.size();


    if(s[0] == '?') rep(i,10) dp[0][i] = 1;
    else {
        int c = s[0] - '0';
        dp[0][c] = 1;
    }

    for(int i = 0; i < n; ++i){
        if(s[i] == '?'){
            for(int k = 0; k < 13; k++){
                for(int j = 0; j < 10; j++){
                    dp[i][(k * 10 + j) % 13] += dp[i-1][k];
                    dp[i][(k * 10 + j) % 13] %= MOD;
                }
            }
        }else{
            int c = s[i] - '0';
            for(int k = 0; k < 13; k++){
                dp[i][(k * 10 + c) % 13] += dp[i-1][k];
                dp[i][(k * 10 + c) % 13] %= MOD;
            }
        }
    }
    cout << dp[n-1][5] << endl;
}


Measured memory_bytes: 16832
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int n, ans;
    cin >> n;
    for (int i = 0; i <= 10; i++) {
        if (pow(2, i) <= n) ans = pow(2, i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
   int N;cin>>N;
   int A[N];int g;
   for(int i=0;i<N;i++){
   	   cin>>A[i];
   	   if(i==0){
   	   	   g=A[0];
   	   }else{
   	   	   g=__gcd(g,A[i]);
   	   }
   }int count=0;
   while(g%2==0){
   	   g/=2;
   	   count++;
   }cout<<count<<endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
v = gets.chomp.split.map(&:to_i)

even_h = {}
odd_h = {}
v.each_with_index do |e, i|
  if i % 2 == 0
    odd_h[e] ||= 0
    odd_h[e] += 1
  else
    even_h[e] ||= 0
    even_h[e] += 1
  end
end
even = even_h.sort_by { |(k, v)| -v }
odd  = odd_h.sort_by { |(k, v)| -v }

## For Debug
# p even  # [[1, 3], [3, 1], ...]
# p odd   # [[1, 3], [2, 2], ...]

if even[0][0] != odd[0][0]  # number
  total_cnt = even[0][1] + odd[0][1]
  p (n - total_cnt)
else  # number is equal
  # Use the next largest value of odd
  cnt1 = even[0][1] + (odd.size > 1 ? odd[1][1] : 0)
  # Use the next largest value of even
  cnt2 = (even.size > 1 ? even[1][1] : 0) + odd[0][1]
  total_cnt = [cnt1, cnt2].max
  p (n - total_cnt)
end


Measured memory_bytes: 20992
#include<bits/stdc++.h>
#include <queue>
#include <cstring>
#define mp make_pair
#define pb push_back
#define p push

#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long int

#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
#define pfd(a) printf("%lf",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);

#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define SIZE 1000000007
#define MAXN 100005

using namespace std;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph ;


int main(){
    IOS
    int n; cin>>n;
    string s; cin>>s;
    int arr[10] = {};
    for(int i = 0; i < n; i++){
        arr[s[i] - '0']++;
    }

    int arr2[30000] = {};
    bool visit[10] = {};
    ll res = 0, sum = 0;
    for(int i = 0; i < n; i++){
        arr[s[i]-'0']--;

        for(int u = 0; u < 10; u++){
            arr2[i] += (arr[u] > 0);
        }
    }
   
    for(int i = 0; i < n-2; i++){
        sum = 0;
        if(visit[s[i]-'0']){
            continue;
        }
        visit[s[i]-'0'] = true;
        bool temp[10] = {};
        for(int u = i+1; u < n; u++){
            if(temp[s[u]-'0']) continue;
            temp[s[u]-'0'] = true;
            sum += arr2[u];
        }
        res += sum;
    }
    cout<<res;
    return 0;



}



Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> x;
    for (int i = 0; i < N; i++)
    {
        int t;
        cin >> t;
        x.push_back(t);
    }
    x.push_back(0);
    sort(x.begin(), x.end());
    int c = 0;
    for (int i = 0; i < x.size(); i++)
    {
        if (x[i] == 0)
        {
            c = i;
        }
    }

    int ans = 1 << 30;
    for (int i = 0; i < x.size(); i++)
    {
        int t = 0;
        if (i < c)
        {
            if (c - i > K || c + K - (c - i) >= x.size())
            {
                continue;
            }
            t = abs(x[i]);
            if (c - i < K)
            {
                t += x[c + K - (c - i)] - x[i];
            }
        }
        else
        {
            if (i - c > K || c - (K - (i - c)) < 0)
            {
                continue;
            }
            t = x[i];
            if (i - c < K)
            {
                t += x[i] - x[c - (K - (i - c))];
            }
        }

        ans = min(t, ans);
    }

    cout << ans << endl;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

map<LL,LL> primeFactor;
void prime_factor(LL n) {
  //map< int64_t, int > ret;
  for(LL i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      primeFactor[i]++;
      n /= i;
    }
  }
  if(n != 1) primeFactor[n]++;
  //return ret;
}

void Main()
{
    LL n;cin>>n;
    REP(i,n){
        prime_factor(i+1);
    }
    LL result=1;
    for(auto x : primeFactor){
        //cerr<<x.first<<" "<<x.second<<endl;
        result*=x.second+1;
        result%=MOD;
    }
    cout<<result<<endl;

	return;
}

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

Measured memory_bytes: 256
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            n, q = map(int, raw_input().split())
            if n == 0 and q == 0:
                break
            c = Counter()
            for i in range(n):
                line = map(int, raw_input().split())
                m = line[0]
                for j in range(1, m+1):
                    c[line[j]] += 1
            # print c
            max_key = None
            max_value = -1
            for k, v in c.items():
                if v > max_value or (v == max_value and k < max_key):
                    max_key = k
                    max_value = v
            if max_value >= q:
                print max_key
            else:
                print 0
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

Measured memory_bytes: 4680
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

struct Node {
    Node *prev;
    int  value;
    Node *next;
};
Node *nil;

void Init()
{
    nil = (Node *) malloc(sizeof(Node));
    nil->prev = nil;
    nil->value = -1;
    nil->next = nil;
}

void Insert(int value)
{
    Node *insert_node = (Node *)malloc(sizeof(Node));
    insert_node->value = value;
    Node *first_node = nil->next;

    first_node->prev = insert_node;
    nil->next = insert_node;
    insert_node->next = first_node;
    insert_node->prev = nil;
}

void Delete(int value)
{
    Node *node_i = nil;
    while(1) {
        Node *target_node = node_i->next;
        if (target_node->value < 0) {
            break;
        }
        if (target_node->value == value) {
            // Delete target node
            Node *prev_node = target_node->prev;
            Node *next_node = target_node->next;
            prev_node->next = next_node;
            next_node->prev = prev_node;
            free(target_node);
            break;
        }
        node_i = target_node;
    }
}

void DeleteFirst()
{
    Node *first_node = nil->next;
    nil->next = first_node->next;
    first_node->next->prev = nil;
    free(first_node);
}

void DeleteLast()
{
    Node *last_node = nil->prev;
    last_node->prev->next = nil;
    nil->prev = last_node->prev;
    free(last_node);
}

void PrintList()
{
    int i = 0;
    Node *node_i = nil;
    while(1) {
        Node *target_node = node_i->next;
        if (target_node->value < 0) break;
        if (i == 0) {
            std::cout << target_node->value;
        } else {
            std::cout << " " << target_node->value;
        }
        i++;
        node_i = target_node;
    }
    std::cout << std::endl;
}

int main(int argc, char *argv[])
{
    Init();
    int inst_num;
    scanf("%d", &inst_num);
    for (int i = 0; i < inst_num; i++) {
        char inst[256];
        int value;
        scanf("%s", &inst);

        if (strncmp(inst, "insert", 6) == 0) {
            scanf("%d", &value);
            Insert(value);
        } else if (strncmp(inst, "deleteFirst", 11) == 0) {
            DeleteFirst();
        } else if (strncmp(inst, "deleteLast", 10) == 0) {
            DeleteLast();
        } else if (strncmp(inst, "delete", 6) == 0) {
            scanf("%d", &value);
            Delete(value);
        }
    }

    PrintList();
    return 0;
}


Measured memory_bytes: 34408
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;

#define EPS 1e-9 //許容される誤差の程度

int n;
double hx, hy, dx, dy;
double cry[2][1000];
bool visit[1000];

bool solve(int crynum, double radius, double x, double y)
{
	if(crynum >= n){
		return true;
	}
	
	for(int i = 0; i < n; i++){
		if(!visit[i]
			&&( hypot(cry[0][i]-dx, cry[1][i]-dy) < radius + hypot(cry[0][i]-x, cry[1][i]-y) + EPS))
			return false;
	}
	
	for(int i = 0; i < n; i++){
	
		bool res = false;
		
		if(!visit[i]){
			visit[i] = true;
			res = solve(crynum+1, radius + hypot(cry[0][i]-x, cry[1][i]-y), cry[0][i], cry[1][i]);
			visit[i] = false;
		}
		
		if(res)
			return true;
	}
	
	return false;
}

int main()
{
	while(cin >> n >> hx >> hy >> dx >> dy, n){
	
		for(int i = 0; i < n; i++){
			double x, y;
			cin >> x >> y;
			cry[0][i] = x;
			cry[1][i] = y;
		}
		
		memset(visit, false, sizeof(visit));
		cout << (solve(0, 0, hx, hy)?"YES":"NO") << endl;
	}
	
	return 0;
}

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

int n, x, cnt = 0;
vector<int> a;

int main() {
  int i, aa;
  cin >> n >> x;
  for(i = 0; i < n; ++i) {
    cin >> aa;
    a.push_back(aa);
  }
  sort(a.begin(), a.end());
  for(i = 0; i < a.size(); ++i) {
    if(i == a.size() - 1) {
      if(x == a[i]) ++cnt;
      break;
    }
    if(a[i] <= x) {
      ++cnt;
      x -= a[i];
    }
  }
  cout << cnt << endl;
  return 0;
}

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

/**
 *
 * @author HP
 */
public class Main {
   public static void main(String[] args) {
       Scanner s = new Scanner(System.in);
       int n = s.nextInt();
       HashMap<Integer,Integer> map = new HashMap<>();
       int temp;
       long sum=0;
       for(int i =0; i < n; i++) {
           temp = s.nextInt();
           sum+=temp;
           if(map.containsKey(temp))
                map.put(temp, map.get(temp)+1);
           else {
                map.put(temp,1);
           }
       }
//       System.out.println(map);
       int q = s.nextInt();
       int b,c=0,count=0;
       while(q-->0) {
           b = s.nextInt();
           c = s.nextInt();
           count=0;
           if(map.containsKey(b)) {
               temp = map.get(b);
               map.remove(b);
               sum = sum +temp *(c-b);
               if(map.containsKey(c))
                   temp+= map.get(c);
               map.put(c, temp);
           }
//           System.out.println(map);
           System.out.println(sum);
       }
   }
}


Measured memory_bytes: 64736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;

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

  char now='R';//今の文字
  ll changeRL=0;//RLになった時のLの時の番号 
  ll counter[2]={0,0};//0奇数，1偶数　の数
  vector<ll> ans((ll)S.length(),0);
  //cout<<(ll)S.length()<<endl;
for(ll i=0;i<(ll)S.length();i++){
 if(now=='R'&&S[i]=='R'){
   counter[i%2]++;
        now='R';
 }
   if(now=='L'&&S[i]=='L'){
   counter[i%2]++;
          now='L';
 }
   if(now=='R'&&S[i]=='L'){
   changeRL=i;
   counter[i%2]++;
          now='L';
 }
   if(now=='L'&&S[i]=='R'){
     ans[changeRL]=counter[changeRL%2];
     ans[changeRL-1]=counter[(changeRL+1)%2];   
     counter[0]=0;
     counter[1]=0;
     counter[i%2]++;
     now='R';
   }
}
       ans[changeRL]=counter[changeRL%2];
     ans[changeRL-1]=counter[(changeRL+1)%2];   

  for(ll i=0;i<(ll)S.length();i++){
  cout<<ans[i]<<" ";
  }
  
  
  
}


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

using namespace std;
typedef long long unsigned int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int h;
int w;
vector <string> _map;
vector <vector <int>> tate_count;
vector <vector <int>> yoko_count;


int main(void){
    cin >> h;
    cin >> w;
    string str;
    REP(i, h){
        cin >> str;
        _map.push_back(str);
    }
    REP(y, h){
        vector <int> vec;
        REP(x, w) {
            vec.push_back(-1);
        }
        tate_count.push_back(vec);
        yoko_count.push_back(vec);
    }
    int yoko_length = 0;
    REP(y, h){
        REP(x, w+1){
            if (x == w or _map[y][x] == '#') {
                REP(i, yoko_length){
                    yoko_count[y][x-i-1] = yoko_length ;
                }
                yoko_length = 0;
            } else {
                yoko_length += 1;
            }
        }
    }

    int tate_length = 0;
    REP(x, w){
        REP(y, h+1) {
            if (y == h or _map[y][x] == '#') {
                REP(i, tate_length){
                    tate_count[y-i-1][x] = tate_length;
                }
                tate_length = 0;
            } else {
                tate_length += 1;
            }
        }
    }

    int ans = 0;
    REP(x, w){
        REP(y, h){
            ans = max(ans, tate_count[y][x]+yoko_count[y][x]-1);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35840
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int s;
long long dp[2005];

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

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    cin >> s;
    dp[0] = 1;
    for (int j = 1; j <= s; j++) {
        for (int i = 3; i <= s; i++) {
            if (j >= i) dp[j] = (dp[j] + dp[j - i]) % mod;
        }
    }

    cout << dp[s] << '\n';

    return 0;
}


Measured memory_bytes: 3660
use proconio::{input, fastout};
use std::collections::HashMap;

#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [usize; n],
        q: usize,
        bc: [(usize, usize); q]
    }
    let mut temp_sum = 0;
    let mut elem_dict = HashMap::new();
    for &a_i in a.iter() {
        temp_sum += a_i;
        (*elem_dict.entry(a_i).or_insert(0)) += 1;
    }

    let mut s = Vec::<usize>::new();
    for (b_i, c_i) in bc {
        if let Some(&i) = elem_dict.get(&b_i) {
            // $B"-(B $B$@$H(B usize $B$,%^%$%J%9$K$J$jF@$k$N$G(B panic $B$9$k(B
            // temp_sum += (c_i - b_i) * i;
            temp_sum -= b_i * i;
            temp_sum += c_i * i;
            (*elem_dict.entry(c_i).or_insert(0)) += i;
            elem_dict.insert(b_i, 0);
        }
        s.push(temp_sum);
    }

    for s_i in s {
        println!("{}", s_i);
    }
}


Measured memory_bytes: 9844
#include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range((i), (0), (a))
using namespace std;

typedef string::const_iterator State;
class ParseError{};
long long th( State & begin );
int add, sub, mul;

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

    long long ans = LLONG_MIN;

    range (i, 1, 4) range (j, 1, 4) range (k, 1, 4) {
        add = i, sub = j, mul = k;
        State begin = s.begin();
        ans = max(ans, th(begin));
    }

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


long long factor( State & );

long long number( State & begin ) {
    long long ret = 0;
    while( isdigit( *begin ) ) {
        ret *= 10;
        ret += *begin - '0';
        begin++;
    }
    return ret;
}

long long fi( State & begin ) {
    long long ret = factor( begin );
    for (;;) {
        //最も優先順位が高い演算子
        if ( add == 1 && *begin == '+' ) {
            begin++;
            ret += factor( begin );
        }
        else if ( sub == 1 && *begin == '-' ) {
            begin++;
            ret -= factor( begin );
        }
        else if ( mul == 1 && *begin == '*' ) {
            begin++;
            ret *= factor( begin );
        }
        else {
            break;
        }
    }
    return ret;

}

long long se( State & begin ) {
    long long ret = fi( begin );
    for (;;) {
        //二番目に優先順位が低い演算子
        if ( add == 2 && *begin == '+' ) {
            begin++;
            ret += fi( begin );
        }
        else if ( sub == 2 && *begin == '-' ) {
            begin++;
            ret -= fi( begin );
        }
        else if ( mul == 2 && *begin == '*' ) {
            begin++;
            ret *= fi( begin );
        }
        else {
            break;
        }
    }
    return ret;
}

long long th( State & begin ) {
    long long ret = se( begin );
    for (;;) {
        //ここは最も優先順位が低い演算子
        if ( add == 3 && *begin == '+' ) {
            begin++;
            ret += se( begin );
        }
        else if ( sub == 3 && *begin == '-' ) {
            begin++;
            ret -= se( begin );
        }
        else if ( mul == 3 && *begin == '*' ) {
            begin++;
            ret *= se( begin );
        }
        else {
            break;
        }
    }
    return ret;
}

long long factor( State & begin ) {
    if ( *begin == '(' ) {
        begin++;
        long long ret = th( begin );
        begin++;
        return ret;
    }
    else {
        return number( begin );
    }
}



Measured memory_bytes: 3220
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from collections import Counter


def is_valid(S):
    if len(S) != 4:
        return False

    counter = Counter(S)
    if len(counter) == 2:
        for key in counter:
            if counter[key] != 2:
                return False
        return True
    else:
        return False


def main():
    S = input()
    valid = is_valid(S)
    if valid:
        print('Yes')
    else:
        print('No')


main()


Measured memory_bytes: 3316
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>
using namespace std;

long long int X,Y=1,A[1001];

int main(){
	cin>>X;
	for(int i=1;i<=X;i++){
		A[i]=i;
	}
	for(int i=2;i<=X;i++){
		int count=0;
		for(int j=2;j<=X;j++){
			while(A[j]%i==0){
				A[j]/=i;
				count++;
			}
		}
		Y*=count+1;
		Y%=1000000007;
	}
	cout<<Y<<endl;
}

Measured memory_bytes: 256
<?php
    $n = trim(fgets(STDIN));
	for($i=0;$i<$n;$i++){
		$a[$i] = trim(fgets(STDIN));
	}
	$a[$n] = 0;
	
	$ans = 0;
	for($i=0;$i<$n;$i++){
	    if($a[$i]%2 === 0)
		    $ans = $ans + ($a[$i] / 2);
		else
		    $ans = $ans + ($a[$i] - 1) / 2;
		$a[$i] = $a[$i] % 2;
		if($a[$i] === 1)
		    if($a[$i+1] > 0){
		        $a[$i]--;
		        $a[$i+1]--;
		        $ans++;
		    }
	}
	echo $ans;

?>



Measured memory_bytes: 12920
#include <bits/stdc++.h>
#define NMAX 300005

using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
const ll MOD=1e9+7;
vector<ll> edg[NMAX];
bitset<NMAX> visited;
ll currCnt=0;
void dfs(ll node){
    if(!visited[node])
        currCnt++;
    visited[node]=1;
    for(auto it : edg[node]){
        if(!visited[it]){
            currCnt++;
            visited[it]=1;
            dfs(it);
        }
    }
}
int main()
{
    ll ans=0,prevCnt=0;
    ll n,m;
    cin>>n>>m;
    for(ll i=0;i<m;i++){
        ll a,b;
        cin>>a>>b;
        edg[a].push_back(b);
        edg[b].push_back(a);
    }
    for(ll i=1;i<=n;i++){
        if(!visited[i]){
            dfs(i);
            ans=max(ans,currCnt-prevCnt);
            prevCnt=currCnt;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 26208
use std::io::stdin;
use std::cmp::min;

fn input_ints() -> Vec<i64> {
    let mut st = String::new();
    match stdin().read_line(&mut st) {
        Ok(_) => st.split_whitespace().map(|s| s.parse().unwrap()).collect(), Err(_) => Vec::<i64>::new(),
    }
}

fn solve() {
    let n = input_ints();
    let a = n[0];
    let b = n[1];
    let c = n[2];
    let d = n[3];

    let A = a*b;
    let B = c*d;

    if A > B {
        println!("{}", A);
    } else {
        println!("{}", B);
    }
}

fn main() {
    solve();
}


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

int main(){

    int a, b;
    cin >> a >> b;

    if(a==b){
        cout << "a == b\n";
    }
    else if(a<b){
        cout << "a < b\n";
    }
    else{
        cout << "a > b\n";
    }

    return 0;
}


Measured memory_bytes: 3024
#include<iostream>
using namespace std;
int main(){
	int k,s,x,y,z,ans=0;
	cin>>k>>s;
	for(x=0;x<=k;x++)
	  for(y=0;y<=k;y++)
	     {
	     	z=s-x-y;
	     	if(z>=0&&z<=k) ans++;
		 }
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

int main()
{
   int n;
    cin>>n;
    int ans;
    int arr[n];
    int day,eats;
    cin>>day>>eats;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }

    for(int i=0;i<n;i++){
        int t=1;
        while(1){
            ll x=t*arr[i]+1;
            if(x>day)
                break;
            t++;
            ans++;
         //   cout<<x<<" ";
        }
    //    cout<<ans<<endl;
    }

    cout<<ans+n+eats<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

#define ll long long;
#define maxn 200
bool verif(char s[], int n) {
    for (int i = 1; i <= n / 2; i++) {
        if (s[i] != s[n / 2 + i])
            return 0;
    }
    return 1;
}

int main() {
    int n = 0;
    char s[maxn + 2];
    char ch = fgetc(stdin);
    while (ch != '\n') {
        n++;
        s[n] = ch;
        ch = fgetc(stdin);
    }
    n = n - 2;
    int x = verif(s, n);
    while(x == 0) {
        n = n - 2;
        x = verif(s, n);
    }
    printf("%d", n);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int maxn=103;
int n,m,a[maxn],c,p1,p2,ANS[maxn],CNT;
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        scanf("%d",a+i);
        c+=(a[i]&1);
        if((a[i]&1)&&c==1)p1=a[i],m--,i--;
        if((a[i]&1)&&c==2)p2=a[i],m--,i--;
    }
    if(c>=3){puts("Impossible");return 0;}
    if(c==0){
        if(m==1)ANS[++CNT]=1,ANS[++CNT]=a[1]-1,printf("%d\n",a[1]);
        else{for(int i=1;i<=m;i++)ANS[++CNT]=(i==1?a[i]-1:(i<m?a[i]:a[i]+1)),printf("%d ",a[i]);puts("");}
    }
    if(c==1){
        if(p1>1)ANS[++CNT]=p1-1;
        printf("%d ",p1);
        if(!m)ANS[++CNT]=1;
        else{for(int i=1;i<=m;i++)ANS[++CNT]=(i<m?a[i]:a[i]+1),printf("%d ",a[i]);}
        puts("");
    }
    if(c==2){
        if(p1>1)ANS[++CNT]=p1-1;
        printf("%d ",p1);
        for(int i=1;i<=m;i++)ANS[++CNT]=a[i],printf("%d ",a[i]);
        ANS[++CNT]=p2+1;
        printf("%d\n",p2);
    }
    printf("%d\n",CNT);
    for(int i=1;i<=CNT;i++)printf("%d ",ANS[i]);
    return 0;
}

Measured memory_bytes: 3804
import static java.util.Arrays.deepToString;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc = new Scanner(System.in);
	public void run() {
		for (;sc.hasNext();) {
			int n = sc.nextInt();
			if (n == 0) break;
			int[] a = new int[n];
			int[] b = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				b[i] = sc.nextInt();
			}
			int m = 1000;
			long[][] dp = new long[n + 1][m + 1];
			dp[0][0] = 1;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j <= m; j++) {
					long val = 0;
					val += dp[i][j];
					if (j - a[i] >= 0) val += dp[i+1][j-a[i]];
					if (j - (1 + b[i]) * a[i] >= 0) val -= dp[i][j - (1 + b[i]) * a[i]];
					dp[i+1][j] = val;
				}
			}
			int g = sc.nextInt();
			for (int iii = 0; iii < g; iii++) {
				int mi = sc.nextInt();
				System.out.println(dp[n][mi]);
			}
		}
	}
}

Measured memory_bytes: 21280
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let n: usize = read!();
    let mut l = vec![0u128; n + 1];
    l[0] = 2;
    l[1] = 1;
    for i in 2..=n {
        l[i] = l[i - 1] + l[i - 2];
    }

    println!("{}", l[n]);
}


Measured memory_bytes: 2152
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;
typedef unsigned long long BITMASK; typedef long long ll; typedef long double ld;
#define smallest_on_bit(bit_mask) (__builtin_ctzint((bit_mask) & (-(bit_mask))))
#define CLOCK_START clock_t chrono_clk_beg = clock()
#define CLOCK_END clock_t chrono_clk_end = clock(); cerr << (double(chrono_clk_end - chrono_clk_beg) / CLOCKS_PER_SEC) << " sec"
#define bug(args ...) cerr << __LINE__ << ">> ", err(new istringstream(string(#args)), args), cerr << '\n'
#define toBinary(name, num) string name = bitset<8>(num).to_string();
#define toDecimal(name, binary) unsigned long name = bitset<8>(binary).to_ulong();
#define all(x) x.begin(), x.end()
#define mapfind(mp, x) (mp.find(x) != mp.end())
#define arrfind(arr, x) (find(all(arr), x) != arr.end())
#define removeDuplicates(vec) sort(vec.begin(), vec.end()); vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define int ll
#define double ld
#define INF LONG_MAX
void err(istringstream *iss) {} template<typename T, typename ... Args> void err(istringstream *iss, const T &_val, const Args & ... args) { string _name; *iss >> _name; if (_name.back()==',') _name.pop_back(); cerr << _name << " = " << _val << "; ", err(iss, args ...); }
#define MOD 1000000007

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    vector<int> arr(n);
    for (int i = 0; i < n; ++i) cin >> arr[i];
    sort(all(arr));
    int ans = 0;
    for (int i = 0; i < n-k; ++i) ans += arr[i];
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1792
#pragma GCC opointimize("Ofset_asc")
#pragma GCC opointimize("unroll-loops")
#pragma GCC target("avx2")
#pragma GCC opointimize("Os")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
using namespace std;
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
void vok()
{
    FAST
    FO
    FI
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        // freopen("error.txt","w",stderr);
    #endif
}
int main()
{
    vok();
    char a;
    IN a;
    if(a>=65 && a<=90)
    {
        OUT "A"<<endl
    }
    else
    {
        OUT "a"<<endl
    }
    return 0;
}

Measured memory_bytes: 3648
// AOJ 2669: A-Z Cat
// 2017.10.11 bal4u@uu

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

char s[22];
char ans[22];

int main()
{
	char *p, *q;

	scanf("%s", s); p = s, q = ans;
	while (*p) {
		if (*p == 'A') {
			p++; while (*p && *p != 'Z') p++;
			if (!*p) break;
			*q++ = 'A', *q++ = 'Z';
		}
		p++;
	}
	if (q == ans) puts("-1");
	else { *q = 0; puts(ans); }
	return 0;
}

Measured memory_bytes: 1716
N = int(input())
dic = {}
for _ in range(N):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
#print(dic)
max = 0
maxs = []
for i in dic.keys():
    if dic[i] > max:
        max = dic[i]
        maxs = [i]
    elif dic[i] == max:
        maxs.append(i)
maxs.sort()
for i in maxs:
    print(i)


Measured memory_bytes: 32096
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String key = sc.next();
		while (true) {
			String word = sc.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			}

			word = word.toLowerCase();
			if (key.equals(word)) {
				count++;
			}
		}

		System.out.println(count);

	}
}


Measured memory_bytes: 26044
#include <iostream>
#include <cstdlib>
#include <vector>
#include <stack>

int main()
{
   int64_t N;
   std::cin >> N;
   std::cin.ignore();
   int nA = N +1;
   std::vector<int64_t> A;
   A.reserve(N+1);
   while(nA-->0) {
       int64_t a;
       std::cin >> a;
       A.push_back(a);
   }
   int nB = N;
   std::vector<int64_t> B;
   B.reserve(N);
   while(nB-->0) {
       int64_t b;
       std::cin >> b;
       B.push_back(b);
   }
   int64_t ans = 0;
   for(int i = 0 ; i <N; ++i) {
       if(A[i] >= B[i]) {
           ans += B[i];
           continue;
       }
       ans += A[i];
       B[i] -= A[i]; 
       if(A[i+1] >= B[i]) {
           ans += B[i];
           A[i+1] -= B[i];
       } else {
           ans += A[i+1];
           A[i+1] = 0;
       }
   }
    
   std::cout << ans << std::flush;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef bool boool;
typedef long long ll;
#define vl vector<ll>
#define vb vector<boool>
#define vs vector<string>
#define vp vector<pair<ll, ll>>
#define vvl vector<vector<ll>>
#define vvp vector<vector<pair<ll, ll>>>
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define rep1(i, n) for (long long i=0; i<(long long)(n); i++)
#define rep2(i, s, e) for (long long i=(s); i<(long long)(e); i++)
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

int main() {
    string s, t;
    cin >> s >> t;
    int b = 0;
    rep(i, s.length()-t.length()+1){
        int cnt = 0;
        rep(j, t.length()){
            if(t[j] == s[i+j]) cnt++;
        }
        b = max(b, cnt);
    }
    cout << t.length()-b << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LLINF 1<<63-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define MOD 1000000007
#define NUM 100001
void swap(int* x,int* y){
  int tmp=*x;*x=*y;*y=tmp;
}
int par[NUM];
int UF(int n){//初期化
  for(int i=0;i<NUM;i++)par[i]=-1;
}
int Find(int x){//x番目のノードが属する木の根を探す
  if(par[x]<0)return x;
  else return par[x]=Find(par[x]);
}
int Size(int x){//x番目のノードが属する木の要素数を返す
  return -par[Find(x)];
}
bool Same(int x,int y){//x番目のノードとy番目のノードが同じ木に属しているか返す
  return Find(x)==Find(y);
}
void Unite(int x,int y){//2つの木を結合する
  x=Find(x);y=Find(y);
  if(x!=y){
    par[x]+=par[y];
    par[y]=x;
  }
}

int main() {
  int A,B;
  scanf("%d%d",&A,&B);
  if(A>=6&&A<=12)B=B/2;
  if(A<=5)B=0;
  printf("%d\n",B);
	return 0;
}


Measured memory_bytes: 128
/******************************************
* AUTHOR : Lokesh goel*
* NICK : InsaneNerd *
* INSTITUTION : NIT Kurukshetra *
******************************************/
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 1000000000
#define N 100005
#define pii pair<int,int>
#define vp vector<pair<int,int > >
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define gsz(x) ((int)(x).size())
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cerr.tie(NULL);
#define endl "\n"
#define ms(x,v) memset(x,v,sizeof(x))

int main()
{
	fastio;
	ll x,i,j;
	cin>>x;
	ll start=100,t=0;
	while(start<x){
		t++;
		start = start*1.01;
	}
	cout<<t<<endl;
	//cout<<log2(x/100)/log2(1.01)<<endl;


	return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {

	char S[10];

	scanf("%c%c%c", &S[0],&S[1],&S[2]);


	if (S[0] == S[2]) {
		printf("H");
	}
	else {
		printf("D");
	}





}

Measured memory_bytes: 128
#include <stdio.h>

int main (void)


{


   int a,b,c,i,s;


   s=0;


   scanf("%d %d %d",&a,&b,&c);


   for(i=a;i<=b;i++){


      if(c%i==0)


      {


         s=s+1;


      }


   }


   printf("%d\n",s);


   return 0;


}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>    //pow(x,y)=x^y 99999とかの場合+1するif文
#include <algorithm> //sort(a.begin(), a.end());reverse(a.begin(), a.end());
#include <ctime>     //実行時間を測る
#define ll long long
#define vecvec(h, w, name) vector<vector<ll>> name(h, vector<ll>(w));
#define rep(init, i, n) for (ll i = init; i < (n); i++)
#define rev(s) reverse(s.begin(), s.end())
#define sor(v) sort(v.begin(), v.end()) //昇順
#define PI 3.14159265358979323846264338327950L
//コード自動整形 Shift + Option + F @vscode
//変数名一括置換　command+fn+f2 @vscode
using namespace std;
using vec = vector<ll>;
//function
ll facctorialMethod(ll k);     //階乗を出力する
ll modpow(ll a, ll n, ll mod); // a^n mod を計算する
ll gcd(ll a, ll b);            //最大公約数
ll lcm(ll a, ll b);            //最小公倍数
//

//struct
// UnionFind
// coding: https://youtu.be/TdR816rqc3s?t=726
// comment: https://youtu.be/TdR816rqc3s?t=6822
struct UnionFind
{
  vector<ll> d;
  UnionFind(ll n = 0) : d(n, -1) {}
  ll find(ll x)
  { //根っこを返す
    if (d[x] < 0)
      return x;
    return d[x] = find(d[x]); //根っこの場所を貼り付ける
  }
  bool unite(ll x, ll y)
  { //くっつける操作、連結成分の情報整理 ABC177,157D参照
    x = find(x);
    y = find(y);
    if (x == y)
      return false;
    if (d[x] > d[y])
      swap(x, y); //dはマイナスをかけたサイズだからxの方がサイズ小さいようにする
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  //find(i)でi番目の属しているグループ番号を出力
  bool same(ll x, ll y) { return find(x) == find(y); } //同じ集合に属しているかを判定
  ll size(ll x) { return -d[find(x)]; }                //あるID、xが所属するグループに所属するIDの数を得る ABC177,157D参照
};
//

/////main/////
int main()
{
  int clock_on = 0; //提出時は0!!!!!!!!!!!!!!!!!
  int time_clock = clock();
  //
  ll N;
  cin>>N;
  vector<ll> a(N);
  vector<ll> v(100000+2,0);

  rep(0,i,N){cin>>a.at(i);}
  rep(0,i,N){
      if(a.at(i)!=0){
      ++v.at(a.at(i)-1);}
      ++v.at(a.at(i));
      ++v.at(a.at(i)+1);
  }
  sor(v);
  cout<<v.at(v.size()-1)<<endl;


  //
  if (clock_on == 1)
    printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - time_clock) / CLOCKS_PER_SEC);
  return 0;
}
/////main/////

/////function/////
//階乗を出力する
ll facctorialMethod(ll k)
{
  ll sum = 1;
  for (ll i = 1; i <= k; ++i)
  {
    sum *= i;
  }
  return sum;
}

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

//最大公約数
ll gcd(ll a, ll b)
{
  if (a % b == 0)
  {
    return b;
  }
  else
  {
    return gcd(b, a % b);
  }
}

//最小公倍数
ll lcm(ll a, ll b)
{
  return a * b / gcd(a, b);
}

Measured memory_bytes: 4784
n,x = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
for i in range(n):
    if A[i]>x:
        ans += A[i]-x
        A[i] = x
for i in range(1,n):
    if A[i-1] + A[i] > x:
        ans += A[i-1]+A[i]-x
        A[i] = x-A[i-1]

print(ans)

Measured memory_bytes: 14132
#include <bits/stdc++.h>
using namespace std;
int arr[100050];
int main()
{
    int n;
    scanf("%d", &n);
    for(int i = 1;i <= n;++i)
        scanf("%d", &arr[i]);
    long long ans = 0;
    for(int i = 1;i <= n;++i)
    {
        ans = ans + arr[i] / 2;
        arr[i] %= 2;
        if(arr[i] && arr[i + 1])
        {
            ++ans;
            --arr[i];
            --arr[i + 1];
        }
    }
    printf("%lld\n", ans);
    //scanf("%d", &n);
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <cstdio>
#include <set>

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

class UnionFind{
private:
  vector<int> id;

  int getId(int i){
    if(i == id[i]) return i;
    return id[i] = getId(id[i]);
  }
public:
  UnionFind(int size = 0){ init(size); }
  ~UnionFind(){}
  void init(int size){
    id = vector<int>(size);
    for(int i = 0; i < size; i++)
      id[i] = i;
  }
  void unite(int i, int j){
    int next = max( getId(i), getId(j) );
    id[getId(i)] = id[getId(j)] = next;
  }
  int operator [](int i){ return getId(i); }
  int count(){
    set<int> s;
    for(int i = 0; i < (int)id.size(); i++)
      s.insert(getId(i));
    return s.size();
  }
};

char buff[1 << 12];

int main(){
  const int n = getInt();
  const int m = (1 << n) - 1;
  vector<pair<int, int> > g(m + 2);
  UnionFind uf(m + 2);
  const int Z = m;
  const int O = m + 1;

  REP(i,(1<<(n-1))-1){
    g[i].first  = (i + 1) * 2 - 1;
    g[i].second = (i + 1) * 2;
  }

  scanf("%s", buff);
  REP(i,1<<n){
    const int j = (i / 2) + (m / 2);
    int &p = i % 2 == 0 ? g[j].first : g[j].second;
    p = (buff[i] == '0' ? Z : O);
  }

  g[Z].first = g[Z].second = Z;
  g[O].first = g[O].second = O;

  for(int c = n - 1; c >= 0; c--){
    REP(i,1<<c) REP(j,i){
      const int ii = ((1 << c) - 1) + i;
      const int jj = ((1 << c) - 1) + j;
      // printf("%d %d (%d %d : %d %d)\n", ii, jj, uf[g[ii].first], uf[g[ii].second], uf[g[jj].first], uf[g[jj].second]);
      if(uf[g[ii].first]  == uf[g[jj].first] &&
         uf[g[ii].second] == uf[g[jj].second]){
        uf.unite(ii, jj);
      }
    }
    REP(i,1<<c){
      const int ii = ((1 << c) - 1) + i;
      if(uf[g[ii].first] == uf[g[ii].second])
        uf.unite(ii, g[ii].first);
    }
  }

  /*
  REP(c,n){
    REP(i,1<<c){
      const int ii = ((1 << c) - 1) + i;
      printf("%d: %d (%d %d)\n", ii, uf[ii], g[ii].first, g[ii].second);
    }
  }
  */

  printf("%d\n", uf.count() - 2);

  return 0;
}

Measured memory_bytes: 1232
#include <stdio.h>
int main ()
{
int m,f,r,a;
char hyouka;
for(a=1;1;a++){
scanf("%d %d %d",&m,&f,&r);
if(m+f+r==-3)return 0;
else if(m+f<30||m==-1||f==-1)hyouka='F';
else if(m+f>=80)hyouka='A';
    else if(m+f>=65)hyouka='B';
    else if(m+f>=50||r>=50)hyouka='C';
    else hyouka='D';

    printf("%c\n",hyouka);
}




}

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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main(){
  int x;
  cin >> x;
  
  if(x < 1200){
    printf("ABC\n");
  }
  else printf("ARC\n");
  return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
  	ios::sync_with_stdio(false);
  	cin.tie(nullptr);
  
    string s, t;
    cin >> s >> t;
    int n1 = s.length();
    int n2 = t.length();
    map<char, int> s_cnt, t_cnt;
    vector<vector<int>> id(26);
    for(int i = 0; i < n1; ++i){
        int t = s[i] - 'a';
        id[t].push_back(i);
        ++s_cnt[s[i]];
    }
    for(int i = 0; i < n2; ++i){
        ++t_cnt[t[i]];
    }
    for(auto it = t_cnt.begin(); it != t_cnt.end(); ++it){
        if(s_cnt.find(it->first) == s_cnt.end()){
            cout << -1 << endl;
            return 0;
        }
    }
    
    ll res = 0;
    
    int now = -1;
    for(int i = 0; i < n2; ++i){
        int temp = t[i] - 'a';
        if(upper_bound(id[temp].begin(), id[temp].end(), now) == id[temp].end()){
            res += n1;
            now = id[temp][0];
        }
        else{
            now = *upper_bound(id[temp].begin(), id[temp].end(), now);
        }
    }
    
    res += now + 1;
    cout << res << endl;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> vec(1);
  int a = -1, b = -1, c = -1;
  int acount = 0, bcount = 0, ccount = 0;
  for(int i=0; i<n; i++){
    int num;
    cin >> num;
    if(i == 0) a = num;
    else if(a != num && b == -1) b = num;
    else if(a != num && b != num && c == -1) c = num;
    else if(a != num && b != num && c != num){
      cout << "No" << endl;
      return 0;
    }
    if(a == num) acount++;
    if(b == num) bcount++;
    if(c == num) ccount++;
  }
  if(a != -1 && b != -1 && c != -1 && acount == n/3 && bcount == n/3 && ccount == n/3){
    if((a ^ b) == c){
      cout << "Yes" << endl;
      return 0;
    }else{
      cout << "No" << endl;
      return 0;
    }
  }else if(c == -1 && ((a == 0 && bcount - acount == acount) || (b == 0 && acount - bcount == bcount))){
    cout << "Yes" << endl;
    return 0;
  }else if(a == 0 && b == -1 && c == -1){
    cout << "Yes" << endl;
    return 0;
  }else{
    cout << "No" << endl;
    return 0;
  }
}


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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    string s;
    string ss;
    cin>>s;
    cin>>ss;
    int cnt =0;
    for(int i=0;i<s.size();i++){
        if(s[i]==ss[i])cnt++;
    }
    printf("%d",cnt);
    
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3","unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

const ll mod = 1000000007LL;

signed main() {
	// 入力の受け取り
	int n; cin >> n;
	vector<vector<int>> a(n);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			int aij; cin >> aij;
			a[i].push_back(aij);
		}
	}

	// flgs[i] : i個立っているフラグ
	vector<vector<int>> flgs(n + 1);
	for (int f = 0; f < (1 << n); ++f) {
		int cnt = 0;
		for (int b = 0; b < n; ++b)
			if (f & (1 << b))
				++cnt;
		flgs[cnt].push_back(f);
	}

	// dp[i][j]
	//  := 男iまで割り当てて、女の割り当て済みかどうかの状態がj
	//     であるような場合の数(jはbitフラグ)
	vector<vector<ll>> dp(n + 1);
	for (int i = 0; i <= n; ++i)
		dp[i].resize((1 << n), 0);
	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (a[i - 1][j] == 0) continue;
			for (int cnd : flgs[i - 1]) {
				if (cnd & (1 << j)) continue;
				dp[i][cnd | (1 << j)] += dp[i - 1][cnd];
				dp[i][cnd | (1 << j)] %= mod;
			}
		}
	}

	cout << (dp[n][(1 << n) - 1]) << endl;

	return 0;
}

Measured memory_bytes: 370236
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, k: usize, h: [usize; n]);
    let mut count = 0;
    for v in h {
        if v >= k {
            count += 1;
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 3068
#include <cstdio>

int main ()
{
  int x;
  int y;
  int S;
  int L;

  scanf("%d", &x);
  scanf("%d", &y);
  S = x * y;
  L = x * 2 + y * 2;
  printf("%d %d\n", S, L);

  return 0;
}

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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pi;
typedef long double ld;
typedef pair<long double, long double> pld;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll i, j, k, l;

    ll N;
    cin >> N;
    ll p10 = 1;
    ll p8 = 1;
    ll p9 = 1;
    for(i = 0; i < N; i++) {
        p10 = p10 * 10 % MOD;
        p9 = p9 * 9 % MOD;
        p8 = p8 * 8 % MOD;
    }
    ll ans = p10;
    ans = (ans + p8) % MOD;
    ans = (ans + MOD - p9) % MOD;
    ans = (ans + MOD - p9) % MOD;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3640