akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}
//-------------------------------------------------------

int main()
{
        int H, W, h, w;
        cin >> H >> W >> h >> w;
        cout << (H - h) * (W - w) << endl;
        return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++)

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int> > VVi;
typedef vector<vector<ll> > VVl;

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

const ll MOD = 998244353;
const int MAX_N = 1e5;
Vi tree;
int N;

ll powmod(ll b, ll e) {
	ll ret = 1;
	while (e) {
		if (e & 1) ret = ret * b % MOD;
		b = b * b % MOD;
		e >>= 1;
	}
	return ret;
}

int main()
{
	tree.resize(MAX_N, 0);
	cin >> N;

	{
		int d; cin >> d;
		if (d) {
			cout << 0 << endl;
			return 0;
		}
		tree[d]++;
	}

	REP(i, N - 1) {
		int d; cin >> d;
		tree[d]++;
	}

	if (tree[0] != 1) {
		cout << 0 << endl;
		return 0;
	}

	ll ans = 1;
	REP1O(i, MAX_N) {
		if (tree[i]) {
			int n_par = tree[i-1];
			if (!n_par) {
				cout << 0 << endl;
				return 0;
			}
			ans = ans * powmod((ll)n_par, (ll)tree[i]) % MOD;
		}
	}

	cout << ans << endl;
}


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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m,k;
	cin >> n >> m >> k;
	long long sum = 0; 
	for(int i=1;i<=n;i++){
		sum = m*i;
		if(sum == k){
				cout<<"Yes\n";
				return 0;
			}
		for(int j=1; j<=m; j++){
			sum+=n;
			sum-=2*i;
			//cout<<sum<<endl;
			if(sum == k){
				cout<<"Yes\n";
				return 0;
			}
		}
		sum = 0;
	}
	for(int i=1;i<=m;i++){
		sum = n*i;
		if(sum == k){
				cout<<"Yes\n";
				return 0;
			}
		for(int j=1; j<=n; j++){
			sum+=m;
			sum-=2*i;
			//cout<<sum<<endl;
			if(sum == k){
				cout<<"Yes\n";
				return 0;
			}
		}
		sum = 0;
	}
	cout<<"No\n";
	return 0;
 } 

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

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

  vector<int> a(n);
  for (auto &i : a) cin >> i;
  sort(a.begin(), a.end());

  int ushi = 0, beet = 0;
  for (int i = 0; i < n; ++i) {
    (i & 1 ? ushi : beet) += a[i];
  }

  cout << abs(ushi - beet) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main(void)
{
	char str[101];
	char C[2] = {'C','\0'};
	char F[2] = {'F','\0'};
	int i,flag1,flag2;
	int count=0;
	
	flag1=0;
	flag2=0;
	
	scanf("%s",str);
	
	for(i=0; i < 100; i++){
		if( str[i] == C[0]){
			count = 1;
			flag1++;
		}
		
		if( (count == 1) && (str[i] == F[0]) && (flag1 >= 1)){
			flag2++;
		}
	}
	
	if((flag1 >= 1) && (flag2 >= 1)) printf("Yes\n");
	else printf("No\n");
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;

int main(){
  	int n,memo;
  	memo = 1;
  
  	cin >> n;
  	
  	for(int i = 2;i <= 1000;i++){
      for(int j = 2;pow(i,j) <= n;j++){
        if(memo < pow(i,j)){
          memo = pow(i,j);
        }
      }
    }
  	
  	cout << memo << endl;
	return 0; 
}

Measured memory_bytes: 384
#include <stdio.h>
#define SIZE 12

short map[SIZE][SIZE];

void parse(int i, int j)
{
     map[i][j]=0;
     
     if(i+1<SIZE && map[i+1][j]) parse(i+1, j);
     if(j+1<SIZE && map[i][j+1]) parse(i, j+1);
     if(i-1>=0 && map[i-1][j]) parse(i-1, j);
     if(j-1>=0 && map[i][j-1]) parse(i, j-1);
}

main()
{
     int i, j, c;
     
     while(1){
	  for(i=0; i<SIZE; i++)
	       for(j=0; j<SIZE; j++)
		    if(!~scanf("%1d",&(map[i][j])))
			 return 0;
	  
	  c = 0;
	  for(i=0; i<SIZE; i++)
	       for(j=0; j<SIZE; j++)
		    if(map[i][j])
			 parse(i,j), c++;
	  
	  printf("%d\n",c);
     }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define nn 65536*4
#define ll long long
int len[nn];int n;
int main()
{
	cin>>n;n=n<<1;for(int i=0;i<n;i++) cin>>len[i];
	sort(len,len+n);int ans=0;
	for(int i=0;i<n;i+=2) ans+=len[i];
	cout<<ans;
	return 0;  
}

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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> k(m);
  vector<vector<int>> s(m, vector<int>(n, -1));
  int i, j, l;
  for(i = 0; i < m; i++)
  {
    cin >> k.at(i);
    for(j = 0; j < k.at(i); j++)
    {
      cin >> s.at(i).at(j);
    }
  }
  vector<int> p(m);
  bool ok;
  int ans = 0;
  for(i = 0; i < m; i++)cin >> p.at(i);
  for(i = 0; i < (1 << n); i++)
  {
    ok = true;
    for(j = 0; j < m; j++)
    {
      int count = 0;
      for(l = 0; l < k.at(j); l++)
      {
        if((1 << s.at(j).at(l)-1) & i) count++;
      }
      if(count%2!=p.at(j))
      {
        ok = false;
        break;
      }
    }
    if(ok)ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
# B
a = []
for i in range(3):
    a1, a2, a3 = map(int, input().split())
    a.append(a1)
    a.append(a2)
    a.append(a3)
    
n = int(input())
b = []
for i in range(n):
    bb = int(input())
    b.append(bb)
    
for i in range(n):
    while a.count(b[i]) > 0:
        a[a.index(b[i])] = 0
        
if a[0] == a[3] == a[6] == 0:
    print('Yes')
elif a[1] == a[4] == a[7] == 0:
    print('Yes')
elif a[2] == a[5] == a[8] == 0:
    print('Yes')
elif a[0] == a[1] == a[2] == 0:
    print('Yes')
elif a[3] == a[4] == a[5] == 0:
    print('Yes')
elif a[6] == a[7] == a[8] == 0:
    print('Yes')
elif a[0] == a[4] == a[8] == 0:
    print('Yes')
elif a[2] == a[4] == a[6] == 0:
    print('Yes')
else:
    print('No')

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>>  var(n, vector<int>(m, 0))
#define vecb2(var, n, m)   vector<vector<bool>> var(n, vector<bool>(m, false))
#define vecll2(var, n, m)  vector<vector<ll>>   var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

int main(void) {
  int k, s;
  cin >> k >> s;
  int ans=0;
  rep(x,k+1){
    rep(y,k+1){
      int z = s-x-y;
      if(z>=0 && z<=k) ans++;
    }
  }
  prt(ans);
}


Measured memory_bytes: 3564
function Main(input) {
  input=input.split(/\n/)
    var n= parseInt(input[0]);
	const ip = input[1].split(" ");
	ip.sort(compareFunc);
	var c = parseInt(ip[0]);
	for(var i=1;i<n;i++){
	   c = (c+parseInt(ip[i]))/2;
	}
	console.log(c);
}
 
function compareFunc(a, b) {
    return parseFloat(a) - parseFloat(b);
}
     
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)
#define All(x) (x).begin(),(x).end()
#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))
#define End '\n'
#define Out(x) cout<<(x)<<End
template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);

    int d;
    
    cin >> d;
    
    if (d == 25) Out("Christmas");
    else if (d == 24) Out("Christmas Eve");
    else if (d == 23) Out("Christmas Eve Eve");
    else if (d == 22) Out("Christmas Eve Eve Eve");

    return 0;
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	int n;
	scanf("%d", &n);
	ll count = 0;
	for(int i = 1; i < n / 2; ++i) {
		++count;
	}
	if (n != 1)printf("%lld\n", count + n % 2);
	else printf("%d\n", 0);
	return 0;
}


Measured memory_bytes: 760
import math
x = int(input())
foo = 0;
for i in range(-120 , 120):
  if foo == 1:
      break;
  for j in range(-120 , 120):
    if(math.pow(i , 5) - math.pow(j , 5) == x):
      print(i , " " , j)
      foo = 1;
      break;

Measured memory_bytes: 9312
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <functional>
#include <numeric>
#include <cassert>
#include <algorithm>
#include <functional>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)

#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll bur(ll N, ll X);
bool IsPrime(int num);

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll D = 0;
	ll L = 0;
	ll P = 0;
	//ll T = 0;
	//ll M = 0;
	ll h[1000] = {};
	//ll b[100] = {};
	//ll c[100] = {};
	//ll d[100] = {};

	//ll v[3] = {};
	//ll *c, *s, *n;
	string S[50],T[50],U[52];
	ll count = 0;
	ll count2 = 0;
	float sum = 0;
	ll min = 1000000000000;
	ll max = 1;
	ll dist1 = 0;
	ll dist2 = 0;
	ll now = 0;
	int tmax = 0;
	int tmax2 = 0;
	//int flag = 0;
	char temp,head;
	//int is = 0;
	bool flag = false;
	
	//char p;

	ll all = 0;
	ll niku = 0;
	ll state = 2;
	bool down = true;
	

	//cin >> S;
	
	
	
	
	cin >> S[0] >> T[0] >> U[0];
	vector<int> tr(3);
	
	
	S[0] = (char)S[0][0] - 32;
	T[0] = (char)T[0][0] - 32;
	U[0] = (char)U[0][0] - 32;

	
		cout << S[0] << T[0] << U[0] << endl;

	//x = (ll *)malloc((N+1) * sizeof(ll));
	//c = (ll *)malloc((N) * sizeof(ll));
	//cin >> D >> G;
	//vector<pair<int,int>> tr(M);
	//vector<pair<int,int>> qes(Q);
	//sort(c.begin(), c.end());
	
	//cout << c[2] - c[1] << endl;

	
	/*A = N / 1000;
	N %= 1000;
	B = N / 100;
	N %= 100;
	C = N / 10;
	N %= 10;
	D = N;*/
	


	//cin >> N >> M;

	//vector<pair<int,int>> c(M);
	////vector<pair<int, int>> e(M);
	//vector<ll> d(M);

	//rep(i, 0, M) {
	//	cin >> c[i].first >> c[i].second;
	//	//e[i].first = c[i].first;
	//	//e[i].second = c[i].second;

	//}
	////sort(c.begin(), c.end());

	//

	//rep(i, 0, M) {

	//	
	//	
	//	rep(j, 0, M) {
	//		if (c[i].first == c[j].first && c[j].second < c[i].second) {
	//			d[i]++;
	//			//cout << j << endl;
	//		}
	//	}
	//	cout << std::setfill('0') << std::right << std::setw(6) << c[i].first;
	//	cout << std::setfill('0') << std::right << std::setw(6) << d[i]+1 << endl;
	//}

	return 0;

}

ll bur(ll N,ll X) {
	ll pan = 1;
	ll pat = 1;
	ll burg = 0;



	if (X > burg) {
		if (N == 0)
			return pat;


		burg += pan;
		burg += bur(N - 1, X);
		burg += pat;
		burg += bur(N - 1, X);
		burg += pan;


	}

	return burg;

}

ll gcd(ll a, ll b) {
	
	/* 自然数 a > b を確認・入替 */
	if (a<b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}
	ll x = b;
	ll y = a;
	/* ユークリッドの互除法 */
	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}


	return y/b*x;
}

bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

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

int64_t rucas(int n)
{int64_t a = 2, b = 1, c, i;

    if (n == 0)
        return a;


    for (i = 2; i <= n; i++)
    {
        c = a + b;
        a = b;
        b = c;
    }
    return b;
}

int main(){

  int n;
  int64_t result;
cin>>n;
 result=rucas(n);
cout<<result<<endl;
return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int man = 2e5+10;
template<typename T>T gcd(T a, T b) {return b==0?a:gcd(b, a%b);}
template<typename T>T exgcd(T a,T b,T &g,T &x,T &y){if(!b){g = a,x = 1,y = 0;}else {exgcd(b,a%b,g,y,x);y -= x*(a/b);}}
template<typename T>T quick_add(T a,T b,T mod){T ans = 0;while(b){if(b&1)ans = (ans+a)%mod;a = (a+a)%mod;b /= 2;};return ans%mod;}
template<typename T>T quick_mod(T a,T b,T mod){T ans = 1;while(b){if(b&1)ans = ans*a%mod;a = a*a%mod;b /= 2;};return ans%mod;}
#ifndef ONLINE_JUDGE
#define debug(fmt, ...) {printf("debug ");printf(fmt,##__VA_ARGS__);puts("");}
#else
#define debug(fmt, ...)
#endif
typedef long long ll;
const ll mod = 1e9+7;
int a[man],b[man],c[man],d[man];
int n;

inline int erfen_L(int maxx){
    int l = 1,r = n;
    int ans = -1;
    while(l<=r){
        int mid = l+r>>1;
        if(c[mid]>=maxx){
            ans = mid;
            r = mid - 1;
        }else l = mid + 1;
    }
    return ans;
}

inline int erfen_R(int maxx){
    int l = 1,r = n;
    //cout << "maxx:" << maxx <<endl;
    int ans = -1;
    while(l<=r){
        int mid = l+r>>1;
        if(c[mid]<maxx){
           //if(maxx==1)cout << "mid:" << mid << " c:" << c[mid] << endl;
            ans = mid;
            l = mid + 1;
        }else r = mid - 1;
    }
    return ans;
}
  
int main() {
    #ifndef ONLINE_JUDGE
        //freopen("in.txt", "r", stdin);
        //freopen("out.txt","w",stdout);
    #endif
    scanf("%d",&n);
    for(int i = 1;i<= n;i++){
        scanf("%d",&a[i]);
    }   
    for(int i = 1;i <= n;i++){
        scanf("%d",&b[i]);
    }
    int ans = 0;
    for(int k = 1;k <= 30;k++){
        for(int i = 1;i <= n;i++){
            c[i] = a[i]&((1<<k)-1);
            d[i] = b[i]&((1<<k)-1);
        }
        sort(c+1,c+1+n);
        /*for(int i = 1;i <= n;i++){
            printf(i==n?"%d\n":"%d ",c[i]);
        }
        for(int i = 1;i <= n;i++){
            printf(i==n?"%d\n":"%d ",d[i]);
        }*/
        int tp = 0;
        //cout << "k:" << k << endl;
        for(int i = 1;i <= n;i++){
            int l = erfen_L((1<<(k-1))-d[i]);
            int r = erfen_R((1<<k)-d[i]);
            if(l!=-1&&r!=-1)tp += (r-l+1);
            //cout << "l " << l << " r " << r << endl;
            //cout << "tp1:" << tp  << endl;
            l = erfen_L((1<<k)+(1<<(k-1))-d[i]);
            r = erfen_R((1<<(k+1)));
            //cout << "l2: " << l << " r2: " << r << endl;
            if(l!=-1&&r!=-1)tp += (r-l+1);
            //cout << "tp2:" << tp << endl; 
        }
		if(tp%2)ans += (1<<(k-1));
        //cout << ans << endl;
    }
    printf("%d\n",ans);
    return 0;
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VL a(n), sm(n+1);
	rep(i, n) cin >>a[i];
	ll bans = 0, ans =0;
	//rep(i, n) rep2(j, i+1, n) (bans += a[i]*a[j])%=MD;
	//dbg(bans);
	rep(i,n) sm[i+1] = (sm[i] + a[i])%MD;
	rep(i, n-1){
		(ans += a[i] * (sm[n] + MD - sm[i+1])) %=MD;
	}
	
	cout <<ans <<"\n";
	return 0;
}



Measured memory_bytes: 6372
#include <set>
#include <iomanip>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ll long long
#define ld long double
#define ii pair<int,int>
#define heap priority_queue
#define all(k) k.begin(),k.end()
#define rall(k) k.rbegin(),k.rend()
#define fa(a,c) for(auto &a:c)
#define yes "YES"
#define no "NO"




int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0);
  ld n;cin>>n;
  ld odd=ceil(n/2.0);
  cout<<fixed<<setprecision(20);
  cout<<odd/n<<endl;



	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int[][] density = new int[10][10];
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				density[i][j] = 0;
			}
		}
		while (str!=null) {
			String[] dataset = str.split(",");
			int x = Integer.parseInt(dataset[0]);
			int y = Integer.parseInt(dataset[1]);
			int s = Integer.parseInt(dataset[2]);
			density[x][y] += 1;
			if (x - 1 >= 0)
				density[x - 1][y] += 1;
			if (x + 1 < 10)
				density[x + 1][y] += 1;
			if (y - 1 >= 0)
				density[x][y - 1] += 1;
			if (y + 1 < 10)
				density[x][y + 1] += 1;
			if (s >= 2) {
				if (x - 1 >= 0 && y - 1 >= 0)
					density[x - 1][y - 1] += 1;
				if (x - 1 >= 0 && y + 1 < 10)
					density[x - 1][y + 1] += 1;
				if (x + 1 < 10 && y - 1 >= 0)
					density[x + 1][y - 1] += 1;
				if (x + 1 < 10 && y + 1 < 10)
					density[x + 1][y + 1] += 1;
			}
			if (s == 3) {
				if (x - 2 >= 0)
					density[x - 2][y] += 1;
				if (x + 2 < 10)
					density[x + 2][y] += 1;
				if (y - 2 >= 0)
					density[x][y - 2] += 1;
				if (y + 2 < 10)
					density[x][y + 2] += 1;
			}
			str = br.readLine();
		}
		int cnt = 0;
		int max = 0;
		for (int[] column : density) {
			for (int densities : column) {
				if (densities > max)
					max = densities;
				else if (densities == 0)
					cnt++;
			}
		}
		System.out.println(cnt);
		System.out.println(max);
	}
}

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

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            if (i * (m - j) + j * (n - i) == k) {
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}

ll dp[105][1<<16];

int main(void) {
    int i,j;
    int n;
    while(cin >> n, n){
        vector<pii> in(n);
        rep(i,n){
            int m;
            cin >> m >> in[i].second;
            int t[23]={};
            rep(j,m){
                int s,e;
                cin >> s >> e;
                t[s]++;
                t[e]--;
            }
            rep(j,22)t[j+1] += t[j];
            int ret = 0;
            rep(j,16)if(t[6+j])ret |= (1<<j);
            in[i].first = ret;
        }

        rep(i,105)rep(j,1<<16)dp[i][j]=-INF;
        dp[0][0] = 0;
        rep(i,n+1)rep(j,1<<16)if(dp[i][j]>-INF){
            dp[i+1][j] = max(dp[i][j], dp[i+1][j]);
            if(!(j & in[i].first)){
                dp[i+1][j|in[i].first] = max(dp[i+1][j|in[i].first], dp[i][j]+in[i].second);
            }
        }
        ll ans = 0;
        rep(i,1<<16)ans = max(ans, dp[n][i]);
        cout << ans << endl;

    }
}



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

int main() {

    int input;

    while(cin >> input,input){
        int p = 5, count = 0;
        while(true){
            count += input / p;
            p *= 5;
            if(input < p){
                cout << count << endl;
                break;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
int n,a,b;
vector<int> g[100005];
int d1[100005],d2[100005];
void dfs(int r, int f, int d, int dist[]) {
	dist[r] = d;
	for (int x = 0; x < g[r].size(); x++)
		if (g[r][x] != f)dfs(g[r][x], r, d + 1, dist);
}
int main() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		cin >> a >> b; a--, b--; g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(0, -1, 0, d1);
	dfs(n - 1, -1, 0, d2);
	int ans = 0;
	for (int i = 0; i < n; i++)if (d1[i] <= d2[i])ans++;
	else ans--;
	if (ans > 0)cout << "Fennec" << endl;
	else cout << "Snuke" << endl;

}


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

int main(void) {
  int n, m, k, black = 0; cin >> n >> m >> k;
  vector <string> grid(n);
  for(int i = 0; i < n; i++) cin >> grid[i];
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < m; j++) {
      if (grid[i][j] == '#') black++;
    }
  }
  
  int temp = 0; 
  long long ans = 0;
  for(int i = 0; i < (1 << n); i++) {
    for(int j = 0; j < (1 << m); j++) {
      temp = 0;
      for(int k = 0; k < n; k++) {
        if (((1 << k) & i) == 0) continue;
        for(int l = 0; l < m; l++) {
          if (((1 << l) & j) == 0) continue;
          if (grid[k][l] == '#') temp++;
        }
      }
      if (temp == k) ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 3600
n = int(input())
a = list(map(int,input().split()))

from fractions import gcd
import math

llis = [0]
rlis = [0]
for i in range(n):
    llis.append(gcd(llis[-1],a[i]))
    rlis.append(gcd(rlis[-1],a[n-i-1]))

mx = 0
for i in range(n):
    cd = gcd(llis[i],rlis[n-i-1])
    mx = max(mx,cd)

print(mx)


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

int main() {
  int n, k, ans = 0;
  cin >> n >> k;
  int x[n] = {0};
  rep(i, n) cin >> x[i];
  rep(i, n) { ans += 2 * min(abs(0 - x[i]), abs(k - x[i])); }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n, d = map(int, input().split())
points = [list(map(int, input().split(' '))) for i in range(n)]
cnt = 0

for i in range(n):
    square_distance = points[i][0]**2 + points[i][1]**2
    if square_distance <= d**2:
        cnt += 1
print(cnt)

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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;
}
int N, M, Q;
vector<int> a, b, c, d, v;

int ans = 0;

int calc() {
  int ret = 0;
  rep(i, Q) {
    if (v[b[i]] - v[a[i]] == c[i]) {
      ret += d[i];
    }
  }
  return ret;
}

void dfs(int n) {
  if (v.size() == N) {
    chmax(ans, calc());
    return;
  }
  for (int i = n; i <= M; i++) {
    v.pb(n);
    dfs(i);
    v.pop_back();
  }
}

signed main() {
  cin >> N >> M >> Q;
  rep(i, Q) {
    int buf;
    cin >> buf;
    a.pb(--buf);
    cin >> buf;
    b.pb(--buf);
    cin >> buf;
    c.pb(buf);
    cin >> buf;
    d.pb(buf);
  }
  rep(i, M) { dfs(i+1); }

  cout << ans << endl;
}

Measured memory_bytes: 3660
while True:
    a,b,c=input().split()
    if b=="+":
        print(int(a)+int(c))
    elif b=="-":
        print(int(a)-int(c))
    elif b=="*":
        print(int(a)*int(c))
    elif b=="/":
        print(int(a)//int(c))
    else:
        break
    


Measured memory_bytes: 5592
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#define ll long long
#define ull unsigned long long
#define ld long double
using namespace std;
const ll mod1=1e9+7;
const ll mod2=998244353;
const int INF=0x3f3f3f3f;
char a; 
int main(){
	cin>>a;
	if(a>='A'&&a<='Z'){
		cout<<'A';
	}else if(a>='a'&&a<='z')	cout<<'a';




	return 0;
}


Measured memory_bytes: 3012
/* #region template */
#![allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{stdin, stdout, Bytes, Read, Stdin, StdinLock, Stdout, StdoutLock, Write};
use std::iter::{repeat, repeat_with};
use std::mem::swap;
use std::str::FromStr;
#[allow(dead_code)]
struct Io<'a> {
    reader: Bytes<StdinLock<'a>>,
    writer: StdoutLock<'a>,
    in_buf: [u8; BUF_SIZE],
}
#[allow(dead_code)]
impl<'a> Io<'a> {
    fn new(stdin: &'a Stdin, stdout: &'a Stdout) -> Io<'a> {
        Io {
            reader: stdin.lock().bytes(),
            writer: stdout.lock(),
            in_buf: [0; BUF_SIZE],
        }
    }
    fn r<T: FromStr>(&mut self) -> T {
        let mut count = 0;
        loop {
            match self.reader.next() {
                Some(Ok(b' ')) | Some(Ok(b'\n')) => break,
                Some(Ok(c)) => self.in_buf[count] = c,
                _ => panic!(),
            }
            count += 1;
        }

        let s = unsafe { std::str::from_utf8_unchecked(&self.in_buf[0..count]) };
        s.parse().unwrap_or_else(|_| panic!())
    }
    fn ru(&mut self) -> usize {
        self.r()
    }
    fn iter<'b, T>(&'b mut self) -> IoIter<'a, 'b, T> {
        IoIter::new(self)
    }
    fn c<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        self.iter().take(n).collect()
    }
    fn cu(&mut self, n: usize) -> Vec<usize> {
        self.c(n)
    }
    fn w<T: std::fmt::Display>(&mut self, v: T) {
        writeln!(self.writer, "{}", v).unwrap();
    }
    fn wn<T: std::fmt::Display>(&mut self, v: T) {
        write!(self.writer, "{}", v).unwrap();
    }
}
#[allow(dead_code)]
struct IoIter<'a: 'b, 'b, T> {
    io: &'b mut Io<'a>,
    m: std::marker::PhantomData<T>,
}
#[allow(dead_code)]
impl<'a: 'b, 'b, T> IoIter<'a, 'b, T> {
    fn new(io: &'b mut Io<'a>) -> IoIter<'a, 'b, T> {
        IoIter {
            io,
            m: std::marker::PhantomData,
        }
    }
}
impl<'a, 'b, T: FromStr> Iterator for IoIter<'a, 'b, T> {
    type Item = T;
    fn next(&mut self) -> Option<Self::Item> {
        Some(self.io.r())
    }
}
fn main() {
    let stdin = stdin();
    let stdout = stdout();
    let mut io = Io::new(&stdin, &stdout);
    unsafe {
        solve(&mut io);
    }
}
/* #endregion */

const BUF_SIZE: usize = 1024;

unsafe fn solve(io: &mut Io) {
    let a = io.ru();
    let b = io.ru();
    let n = io.ru();

    let x = min(b - 1, n);

    io.w((a * x) / b - a * (x / b));
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
int ai[10005];
int main()
{
    int a,b;
    scanf("%d",&a);
    b = a;
    int i=0;
    while(a){
        ai[i++] = a%10;
        a/=10;
    }
    int sum = 0;
    for(int j=0;j<i;j++)
    {
        sum += ai[j];
    }
    if(b%sum==0)
        printf("Yes");
    else
        printf("No");
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

int main(){
	ll n;
	scanf("%lld",&n);
	ll ans=n*(n+1)*(n+2)/6;
	rep(i,0,n-1){
		int x,y;
		scanf("%d%d",&x,&y);
		if(x>y){int t=x;x=y;y=t;}
		ans-=x*(n+1-y);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 1704
#include <iostream>
#include <string>
#include <queue>

using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	
	for (int i = s.length() - t.length(); i >= 0; i--) {
		bool f = true;
		for (int j = 0; j < t.length(); j++) {
			if (s[i + j] == '?') {
				continue;
			}
			if (s[i + j] != t[j]) {
				f = false;
				break;
			}
		}
		if (f) {
			for (int j = 0; j < i; j++) {
				cout << (s[j] == '?' ? 'a' : s[j]);
			}
			cout << t;
			for (int j = i + t.length(); j < s.length(); j++) {
				cout << (s[j] == '?' ? 'a' : s[j]);
			}
			cout << endl;
			return 0;
		}
	}
	cout << "UNRESTORABLE" << endl;

	return 0;
}

Measured memory_bytes: 256
from itertools import accumulate

def main():
    N, K, *A = map(int, open(0).read().split())

    B = [0] + list(accumulate(a - K for a in A))

    memo = {n: i for i, n in enumerate(sorted(set(B)), 1)}

    N += 1
    tree = [0] * (N + 1)

    def bit_sum(i):
        s = 0
        while i > 0:
            s += tree[i]
            i -= i & -i
        return s

    def bit_add(i, x):
        while i <= N:
            tree[i] += x
            i += i & -i

    ans = 0
    for b in map(memo.get, B):
        ans += bit_sum(b)
        bit_add(b, 1)

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 54688
#include <iostream>

using namespace std;

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

    bool yymm = 1 <= date % 100 && date % 100 <= 12;
    bool mmyy = 1 <= date / 100 && date / 100 <= 12;

    if (yymm && mmyy) {
        cout << "AMBIGUOUS" << endl;
    } else if (yymm) {
        cout << "YYMM" << endl;
    } else if (mmyy) {
        cout << "MMYY" << endl;
    } else {
        cout << "NA" << endl;
    }
}


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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 11451419194545;

int main() {

    ll N; cin >> N;
    vector<map<ll, ll > > v(N);
    vector<ll > tr(N, 0);
    vector<ll > fl(N, 0);


    for(ll i = 0; i < N; i++){
        ll t; cin >> t; 
        for(ll j = 0; j < t; j++){
            ll a, b; cin >> a >> b;
            a--;
            v[i][a] = b;
        }
    }

    ll ans = 0;
    for(ll i = 0; i < (1<<N); i++){
        //ビットの位置を数える
        ll t_ans = 0;
        ll shogen = 0;
        bool f = true;
        for(ll j = 0; j < N; j++){
            //右シフトして最下位で立っているかどうか判定
            //syogen
            //cout << i << ":" << bitset<8>(i) << endl;
            //cout << (1 << j) << endl;
            if(i & (1 << j)){
                t_ans++;
                auto begin = v[j].begin(), end = v[j].end();
                for (auto iter = begin; iter != end; iter++) {
                    //正直者と不親切者を仮定する
                    //正直者の証言は必ず正直.正直者の発言だけに注目する
                    //仮定で不親切者と仮定されている者を正直というと矛盾
                    //また逆に仮定で正直者と仮定した者を不親切者というと矛盾
                    //この２つをチェックする
                    // 1 != 0 0 != 1 が 矛盾
                    if( (0 != (i & (1 << iter->first))) != iter->second){
                        f = false;
                    }
                }
            }
        } 

        if(f == true){
            ans = max(t_ans, ans);
        }
    }

    cout << ans << endl;

}

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

const int N = 100001;
const int E = 500001;
vector<pair<int,int> > adj[N];
int ans[N];

struct St {
    int pos;
    int cost;
    bool operator<(const St &s) const {
        return cost > s.cost;
    }
};

int main()
{
    int vn, en, r;
    cin >> vn >> en >> r;
    for (int i=0; i < en; ++i) {
        int s, t, d;
        cin >> s >> t >> d;
        adj[s].push_back(pair<int,int>(t, d));
    }
    fill(ans, ans+N, -1);
    priority_queue<St> q;
    St st;
    st.pos = r;
    st.cost = 0;
    q.push(st);
    while (!q.empty()) {
        St cur = q.top();
        q.pop();
        if (ans[cur.pos] != -1) continue;
        ans[cur.pos] = cur.cost;
        int s = adj[cur.pos].size();
        for (int i=0; i < s; ++i) {
            St nx;
            nx.pos = adj[cur.pos][i].first;
            nx.cost = cur.cost + adj[cur.pos][i].second;
            q.push(nx);
        }
    }

    for (int i=0; i < vn; ++i) {
        if (ans[i] == -1) cout << "INF" << endl;
        else cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 14000
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <ctype.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

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

	vector<int64_t>vec(N);
	rep(i, N) {
		cin >> vec[i];
	}
	vector<int> ans(N);
	rep(i, N) {
		int ansnum = 0;
		while (vec[i] % 2 == 0) {
				ansnum++;
				vec[i] = vec[i] / 2;
			}
		ans[i] = ansnum;
	}
	
	sort(ans.begin(), ans.end());
	cout << ans[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	map<int,int> freq;
	ll sum = 0;
	for (int i=0; i<n; i++) {
		int x;
		cin >> x;
		sum += x;
		freq[x]++;
	}
	int q;
	cin >> q;
	while (q--) {
		ll b, c;
		cin >> b >> c;
		ll occ = freq[b];
		freq.erase(b);
		sum -= occ * b;
		freq[c] += occ;
		sum += occ*c;
		cout << sum << '\n';
	}
}

Measured memory_bytes: 6616
#include <stdio.h>
#include <math.h>
int main(){
	int i,a[4],b[4],t;
	 while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF){
	  	 scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
		 int blow=0,hit=0;
		 for(i=0;i<4;i++){
		 	if(a[i]==b[i]){
				hit++;
		 	}
		 }
		 for(i=0;i<4;i++){
	  		 for(t=0;t<4;t++){
		 		if(a[i]==b[t]){
					blow++;
			 	}
	  		 }
	 	}
		blow=blow-hit;
		printf("%d %d\n",hit,blow);
	 }
	
		
return 0;
}
 
 

Measured memory_bytes: 596
#include<stdio.h>
#include<math.h>
#include<float.h>

int main(){
  double x,y,X,Y,i,j,k,l;
  scanf("%lf %lf %lf %lf",&x,&y,&X,&Y);
  i = X	- x;
  j = Y	- y;
  i = i * i;
  j = j	* j;
  k = i	+ j;
  l = sqrt(k);
  printf("%lf\n",l);
  return 0;
}

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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int h,w;
    cin>>h>>w;
    if(h==1||w==1)
        cout<<1;
    else
        cout<<(h*w+1)/2;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
long K;
long A[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
  scanf("%ld", &K);
  printf("%ld\n", A[K-1]);
  
  return 0;
}

Measured memory_bytes: 128
from math import ceil
import sys
input=sys.stdin.readline
n, h = map(int, input().split())
a = []
b = []
for i in range(n):
  p, q = map(int, input().split())
  a.append(p)
  b.append(q)
b.sort()

ans=0
m=max(a)
while(h>0 and len(b) != 0):
  if b[-1]< m:
    break
  h-=b.pop()
  ans+=1
if h>0:
  ans+=ceil(h/m)
print(ans)


Measured memory_bytes: 50780
#include <bits/stdc++.h> 
using namespace std;
int main() {
  long long x,s=100;
  cin>>x;
  
  long long y=0;
  while(s>0){
      if(s>=x){
        break;
      }
      s+=s/100;
	  y++;
  }
  cout<<y<<endl;
}


Measured memory_bytes: 3640
#include <stdio.h>

int main(void)
{
	int r, c, i, j, sumr = 0, sumc[101] = {0}, array[101][101] = {0};
	
	scanf("%d %d", &r, &c);
	
	for (i = 0; i < r; i++) {
		for (j = 0; j < c; j++) {
			scanf("%d", &array[i][j]);
		}
	}
	
	for (i = 0; i < r; i++){
		sumr = 0;
		for (j = 0; j <= c; j++) {
			if (j < c) {
				printf("%d ", array[i][j]);
				sumr += array[i][j];
			} else {
				array[i][j] = sumr;
				printf("%d\n", array[i][j]);
			}
		}
	}
	
	for (i = 0; i <= r; i++) {
		for (j = 0; j <= c; j++) {
			if (i < r) {
				sumc[j] += array[i][j];
			} else {
				array[i][j] = sumc[j];
				printf("%d", array[i][j]);
				if (j < c) {
					printf(" ");
				} else {
					printf("\n");
				}
			}
		}
	}
	
	return 0;
			
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,b,c,d; cin>>n>>a>>b>>c>>d;
    //cout<<a<<endl;
    string s; cin>>s;
    int x = s.size();
    a--; b--; c--; d--;
    for(int i=0;i<10;i++){
        s+='!';
    }
    if(d>c){
    //cout<<s<<endl;
    vector <int> dp1(x+10,0);
    vector <int> dp2(x+10,0);
    dp1[a] = 1;
    dp2[b] = 1;
    
    for(int i=a;i<=200000;i++){
        if(s[i+1]=='.'){
            dp1[i+1] += dp1[i];
        }
        if(s[i+2]=='.'){
            dp1[i+2] += dp1[i];
        }
        if(s[i]=='!') break;
    }
   /* for(int i=0;i<dp1.size();i++){
        cout<<dp1[i]<<' ';
    }*/
    for(int i=b;i<=200000;i++){
        if(s[i+1]=='.'){
            dp2[i+1] += dp2[i];
        }
        if(s[i+2]=='.'){
            dp2[i+2] += dp2[i];
        }
        if(s[i]=='!') break;
    }
    
    
    if(dp1[c]&&dp2[d]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
if(d==c) cout<<"No"<<endl;
if(c>d){
    
   //飛び越えられる
   vector <int> gyakutenn(x);
   vector <int> dead(x);
   for(int i=0;i<s.size();i++){
        if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.') gyakutenn[i]=1;
        if(s[i]=='#'&&s[i+1]=='#') dead[i]=1;
    }
    bool ok1=false; //gyakutennがあルカ
    bool ok2 = true; //deadがないか
    for(int i=c;i>=a;i--){
        if(dead[i]) ok2 = false;
    }
    for(int i=d-1;i>=b-1;i--){
        if(gyakutenn[i]) ok1= true;
    }
    
    if(ok2&&ok1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}
}


Measured memory_bytes: 2052
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int X[101] = {0};
    int cnt = 0;
    for(int i = A; i < B; i++){
        X[i]++;
    }
    //for(int i = 0; i < 100; i++)
    //    cout << X[i] << " ";
    
    for(int i = C; i < D; i++){
        X[i]++;
    }
    //cout << endl;
    //for(int i = 0; i < 100; i++)
    //   cout << X[i] << " ";
    
    for(int i = 0; i <= 100; i++){
        if(X[i] == 2)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    x = ii()
    cnt = 0
    tmp = 100
    while tmp<x:
        tmp+=tmp//100
        cnt+=1
    print(cnt)




main()




Measured memory_bytes: 10024
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x,y,z,i;
    for(i=1;;i++){
        cin>>x>>y;
        if(x==0&&y==0)break;
        if(x>y){
            z=y;
            y=x;
            x=z;
        }
        cout<<x<<" "<<y<<endl;
    }
    return 0;
}



Measured memory_bytes: 3056
#include <iostream>

using namespace std;

int t,sum=0,max_wait=0;
int main(){
  for(int i=0;i<5;i++){
    cin >> t;
    if(t%10) max_wait=max(max_wait,10-t%10);
    sum+=t%10==0?t:t+10-t%10;
  }
  cout << sum-max_wait << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    from collections import deque

    K = int(input())
    q = deque(range(1, 10))
    for _ in range(K):
        x = q.popleft()
        lastdigit = x%10
        base = x*10 + lastdigit
        if lastdigit != 0:
            q.append(base-1)
        q.append(base)
        if lastdigit != 9:
            q.append(base+1)
    print(x)


if __name__ == '__main__':
    main()

Measured memory_bytes: 12140
N,M,Q=map(int,input().split())
a=[0]*Q
b=[0]*Q
c=[0]*Q
d=[0]*Q
for i in range(Q):
    a[i],b[i],c[i],d[i]=map(int,input().split())

def dfs(part_A,i):
    if i == N:
        A.append(part_A)
    else:
        for a in range(part_A[-1],M+1):
            dfs(part_A+[a],i+1)

A=[]
dfs([1],1)
max_score=0
for An in A:
    score = 0
    for q in range(Q):
        if An[b[q]-1]-An[a[q]-1] == c[q]:
            score += d[q]
    max_score = max(score, max_score)

print(max_score)

Measured memory_bytes: 82156
#include <bits/stdc++.h>
#define ll long long int
#define ld double
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
int main()
{
	boost;
	int t, a, b;
	cin >> a >> b >> t;
	int ans = 0;
	for(int i = a; i <= t; i += a)
	ans += b;
	cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
using namespace std;

int main() {
	string s;
	int sum;
	while (cin >> s && s != "0") {
		sum = 0;
		for (int i = 0; i < s.size(); ++i) {
			sum += s[i] - '0';
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
int x[100000],diff[100000];
int main(int argc, const char * argv[])
{
    int n,m,ans=0;
    cin>>n>>m;
    for(int i=0;i<m;i++)
        cin>>x[i];
    sort(x+0,x+m);
    for(int i=0;i<m-1;i++)
        diff[i]=x[i+1]-x[i];
    sort(diff+0,diff+m-1);
    for(int i=0;i<m-n;i++)
        ans+=diff[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
int main(){
    cin>>N;
	ll cnt=0;
	ll now=100;
	while(now<N){
		now+=now/100;
		cnt++;
	}
	cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <cmath>
#include <cstdio>

using std::sqrt;

inline int factor_decomposition(long long n){
	for(int d=sqrt(n);d;--d){
		if(n%d==0) return d;
	}
}

int main(){
	long long n;
	scanf("%lld",&n);
	int d=factor_decomposition(n);
	printf("%lld",d-1+n/d-1);
	return 0;
}

Measured memory_bytes: 128