akhauriyash/Code-Regression huggingface dataset:
/*************************************************************************
	> File Name: 4.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/9/19 21:08:49
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
#define ls (node<<1)
#define rs (node<<1|1)
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
const int maxx=2e6+10;
LL ans;
int n,q,tr[2][maxx<<2],lazy[2][maxx<<2],o,oo=1e9;
void build(int node,int l,int r){
	lazy[0][node]=lazy[1][node]=oo;
	if(l>=r){
		tr[0][node]=tr[1][node]=n-2;
		return;
	}
	int mid=(l+r)>>1;
	build(ls,l,mid); build(rs,mid+1,r);
}
void pushdown(int node,int x){
	if(tr[o][node]==oo) return ;
	tr[o][ls]=min(tr[o][ls],x);
	tr[o][rs]=min(tr[o][rs],x);
	lazy[o][ls]=min(lazy[o][ls],x);
	lazy[o][rs]=min(lazy[o][rs],x);	
	lazy[o][node]=oo;
}

int query(int node,int l,int r,int pos){
	if(l>=r){
		int tmp=tr[o][node];
		tr[o][node]=0;
		return tmp;
	}
	pushdown(node,lazy[o][node]);
	int mid=(l+r)>>1;
	if(pos<=mid) return query(ls,l,mid,pos);
	else return query(rs,mid+1,r,pos);
}
void update(int node,int l,int r,int ul,int ur,int x){
	if(l>=ul && r<=ur){
		tr[o][node]=min(tr[o][node],x);
		lazy[o][node]=min(lazy[o][node],x);
		return ;
	}
	pushdown(node,lazy[o][node]);
	int mid=(l+r)>>1;
	if(ur<=mid) update(ls,l,mid,ul,ur,x);
	else if(ul>mid) update(rs,mid+1,r,ul,ur,x);
	else{ update(ls,l,mid,ul,mid,x); update(rs,mid+1,r,mid+1,ur,x); }
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	int u;
	n=read(); q=read();
	ans=1ll*(n-2)*(n-2);
	build(1,1,n-2);
	while(q--){
		o=read()-1; u=read()-1;
		int x=query(1,1,n-2,u);
		ans-=x;
		o^=1;
		if(x) update(1,1,n-2,1,x,u-1);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 11964
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<cstdio>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(int i=pos[x];~i;i=e[i].next)
#define ll long long
#define db double
const int N=507;
const int INF=1e9+7;
int f[N][N];
bool q[N],v[N][N];
int n,m;

int main(){
	scanf("%d%d",&n,&m);
	rep(i,n)rep(j,m)scanf("%d",&f[i][j]);
	rep(i,n){
		rep(j,m){
			if(f[i][j]%2==0)continue;
			REP(k,j,m-1)v[i][k]^=1;
			REP(k,i,n-1)v[k][m]^=1;
		}
	}
	int u=0;
	rep(i,n)rep(j,m)u+=v[i][j];
	printf("%d\n",u);
	rep(i,n){
		rep(j,m-1)if(v[i][j])printf("%d %d %d %d\n",i,j,i,j+1);
		if(v[i][m])printf("%d %d %d %d\n",i,m,i+1,m);
	}
	return 0;
}


Measured memory_bytes: 3328
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4,popcnt,abm,mmx,tune=native")
#include <bits/stdc++.h>
#define gc getchar()
#define pc(x) putchar(x)
template<typename T> void scan(T &x){x = 0;register bool _=0;register T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){register bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using ll = long long;
using T = ll;
ll mod = 998244353;

ll gcd(ll gcd_a, ll gcd_b){return gcd_b == 0 ? gcd_a : gcd(gcd_b, gcd_a % gcd_b);}
ll fpow(ll fpow_b, ll fpow_exp, ll fpow_mod){if(fpow_exp == 0) return 1;ll t = fpow(fpow_b,fpow_exp/2,fpow_mod);if(fpow_exp&1) return t*t%fpow_mod*fpow_b%fpow_mod;return t*t%fpow_mod;}
ll divmod(ll divmod_i, ll divmod_j, ll divmod_mod){divmod_i%=divmod_mod,divmod_j%=divmod_mod;return divmod_i*fpow(divmod_j,divmod_mod-2,divmod_mod)%divmod_mod;}

int n;

T exgcd(T a, T b, T &x, T &y){
    if(a == 0){
        x = 0, y = 1;
        return b;
    }
    T x1, y1;
    T d = exgcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

int main(){
    
    scan(n);
    ll ans = fpow(3, n, mod)-2, bi = 2;
    for(int i = 1; i < n/2; i++){
        bi = bi*2*(n-i+1)%mod;
        //x2, others have two options
        ll inv, z;
        exgcd(i, mod, inv, z);
        if(inv < mod) inv += mod;
        bi = bi*inv%mod;
        
        ans -= bi; //A or B
        if(ans < 0)
            ans += mod;
    }
    print(ans);
    
    return 0;
}

Measured memory_bytes: 256
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) ((lli)(x).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vector<vi> a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    a.resize(3,vi(3,0));
    for(auto &v:a)
    for(auto &x:v)
        cin>>x;
    cin>>n;
    while(n--)
    {
        cin>>m;
        for(auto &v:a)
        for(auto &x:v)
            if(x==m)
                x=0;
    }

    if(!a[0][0]&&!a[1][1]&&!a[2][2])
    {
        cout<<"Yes"<<endl;
        return 0;
    }

    if(!a[0][2]&&!a[1][1]&&!a[2][0])
    {
        cout<<"Yes"<<endl;
        return 0;
    }

    fo(i,3)
    {
        if(!a[i][0]&&!a[i][1]&&!a[i][2])
        {
            cout<<"Yes"<<endl;
            return 0;
        }

        if(!a[0][i]&&!a[1][i]&&!a[2][i])
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }

    cout<<"No"<<endl;

}   aryanc403();
    return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << (b?"YES\n":"NO\n");}
void Yes(bool b) {cout << (b?"Yes\n":"No\n");}
void yes(bool b) {cout << (b?"yes\n":"no\n");}
void Yay(bool b) {cout << (b?"Yay!\n":":(\n");}

long long powmod(long long a,long long b){
    long long c=1;
    while(b>0){
        if(b&1) c=a*c%mod;
        a=a*a%mod;
        b>>=1;
    }
    return c;
}

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

vector<long long> divisor(long long n){
    vector<long long> ret;
    for(int64_t i=1;i*i<=n;i++){
        if(n%i!=0) continue;
		ret.push_back(i);
		if(i*i!=n) ret.push_back(n/i);
    }
    sort(ret.begin(),ret.end());
    return ret;
}

int main()
{
	ll n,ans=0;
	cin >> n;
	for(auto&& e:divisor(n)){
		if(e==1) continue;
		ll tmp=n;
		while(tmp%e==0) tmp/=e;
		tmp%=e;
		if(tmp==1) ans++;
	}
	ans+=divisor(n-1).size()-1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
/*
THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define r(i,s,l) for(int i=s;i<l;i++)
#define mod 1000000007
#define INT_BITS 32
#define ld long double
#define pp pair<long long,long long>
#define ss second
#define ff first
#define N 2000005
#define all(a) a.begin(),a.end()
#define pb push_back
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int main()
{
    fast();
    ll n,k;
    cin>>n>>k;
    ll ans = n%k;
    cout<<min(abs(ans-k),ans);
	return 0;
}

Measured memory_bytes: 256
N, Z, W = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

INF = 1 << 60
def dfs(i, turn, dp)
  return dp[i][turn] if dp[i][turn]
  if turn == 0
    x = A[-1]
    y = i == 0 ? W : A[i - 1]
    ret = (y - x).abs
    min = INF
    ((i + 1)...N).each do |j|
      a = dfs(j, (turn + 1) % 2, dp)
      min = a if a < min
    end
    ret = min if min != INF && min > ret
  else
    x = A[i - 1]
    y = A[-1]
    ret = (y - x).abs
    max = -INF
    ((i + 1)...N).each do |j|
      a = dfs(j, (turn + 1) % 2, dp)
      max = a if a > max
    end
    ret = max if max != -INF && max > ret
  end
  dp[i][turn] = ret
end

dp = Array.new(N) { Array.new(2) }
puts dfs(0, 0, dp)

Measured memory_bytes: 8060
a = []
for x in range(3):
    bingo = list(int(i) for i in input().split())
    a.append(bingo)
N = int(input())
bingolist=[]
for x in range(N):
    c = int(input())
    bingolist.append(c)
b = [[0]*3 for i in range(3)]

for x in bingolist:
    for y in range(3):
        for z in range(3):
            if a[y][z] == x:
                b[y][z] = 1

bingo_tate =0
bingo_naname = 0
bingo_yoko =0
bingo_kakutei =0

for y in range(3):
    if sum(b[y]) == 3:
        bingo_kakutei=1
alist =[]
for x in range(3):
    a_l = [b[0][x],b[1][x],b[2][x]]
    alist.append(a_l)
for x in range(3):
    if sum(alist[x]) == 3:
        bingo_kakutei=1
        
naname = b[0][0]+b[1][1]+b[2][2]
naname2 = b[0][2]+b[1][1]+b[2][0]
if naname==3 or naname2 ==3:
    bingo_kakutei =1
    
if bingo_kakutei ==1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

static class Program
{
    static void Main(string[] args)
    {
        //入力
        var N = int.Parse(Console.ReadLine());
        var S = Console.ReadLine().ToCharArray();

        var q = new Queue<char>(S);
        var list = new List<int>(){0};
        var x = 0;
        //処理
        foreach(var s in q){
            list.Add(s == 'I' ? ++x : --x);
        }
        

        //出力
        Console.WriteLine(list.Max());
    }
}


Measured memory_bytes: 13396
n = int(input())
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
dis = [0] * (n+1)
for i in range(1, n+2):
    dis[i-1] = abs(a[i] - a[i-1])

S = sum(dis)
for i in range(1, n+1):
    A = a[i-1]
    B = a[i]
    C = a[i+1]
    if A > C:
        A, C = C, A
    if A<=B<=C:
        print(S)
    else:
        print(S-2*min(abs(A-B), abs(C-B)))

Measured memory_bytes: 14048
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

ll h[100000];

int main()
{
	int N;
	ll A, B, D, ng = 0, ok = (int)1e9;

	cin >> N >> A >> B;
	rep(i, N) cin >> h[i];

	D = A - B;

	while (abs(ok - ng) > 1) {
		ll cnt = 0;
		ll mid = (ok + ng) / 2;

		rep(i, N) {
			ll rem = h[i] - B * mid;
			if (rem > 0) cnt += (rem + D - 1) / D;
		}

		if (cnt <= mid) ok = mid;
		else ng = mid;
	}

	cout << ok << endl;

	return 0;
}


Measured memory_bytes: 1024
n = int(input())
A = list(map(int,input().split()))
A = sorted(A)

limit = 10**6 + 2
A += [limit]
dp = [True] * (limit)

ans = 0
for i in range(n):
  a = A[i]
  if dp[a] and a != A[i+1]:
    ans += 1
  
  if dp[a] == False:
    continue
  for t in range(a,limit,a):    
    dp[t] = False
    t += a

print(ans)    

Measured memory_bytes: 116904
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
	int a, b, c, d;
	scanf("%d %d %d %d", &a, &b, &c, &d);
	a = min(a, b);
	c = min(c, d);
	printf("%d\n", a + c);
}

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

using namespace std;

int main() {
  string S; cin >> S;
  int cnt=0;
  for(int i=0; i<S.size(); i++){
    if(S[i] == 'o') cnt++;
  }

  if(cnt + (15 - S.size()) >= 8 ) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
function Main(input) {
    var filterd =input.split('').filter(function(ch){
        return ch === '1';
    }) 
    console.log(filterd.length);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9420
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007
#define MEM_SIZE = 1e5+5;

template<typename T> void DEBUG(T e){std::cout <<"DEBUG>>"<< e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }

//-----CODE------//

void solve(void)
{
  int N;
  cin>>N;
  vector<pair<int,int> > data(N);
  for (int i = 0; i < N; i++)
  {
    int A,B;
    cin>>A>>B;
    data[i].first = A;
    data[i].second = B;
  }
  int LOWER = -1*INF;
  int UPPER = INF;

  sort(data.begin(),data.end());
  for (int i = 0; i < N; i++)
  {
    int A = data[i].first;
    int B = data[i].second;
    data[i].first = A + B;
    data[i].second = A - B;
  }
  sort(data.begin(),data.end());
  int ANS = 0;
  int T = -1*INF;
  for (int i = 0; i < N; i++)
  {
    if(data[i].second >= T)
    {
      ANS++;
      T = data[i].first;
    }
  }

  cout<<ANS<<endl;
  
  

  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(8);
  solve();

 
  return 0;
}

Measured memory_bytes: 1792
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    x=int(input())
    for i in range(-300,300):
        for j in range(-300,300):
            if i**5-j**5==x:
                print(i,j)
                sys.exit()

if __name__=='__main__':
    main()

Measured memory_bytes: 64500
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define str string
#define please return
#define AC 0
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n > 0) { 
		sum += n % 10; n /= 10; }
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {

	int a;
	cin >> a;

	if (a == 1 || a == 2 || a == 3 || a == 5 || a == 7 || a == 11 || a == 13 || a == 15
		|| a == 17 || a == 19 || a == 23 || a == 29  || a == 31) {
		cout << 1 << rt;
	}
	else if (a == 4 || a == 6 || a == 9 || a == 10 || a == 14 || a == 21 || a == 22 || a == 25 || a == 26) {
		cout << 2 << rt;
	}
	else if (a == 28 || a == 30) {
		cout << 4 << rt;
	}
	else if (a == 8 || a == 12 || a == 18 || a == 20 || a == 27) {
		cout << 5 << rt;
	}
	else if (a == 16) {
		cout << 14 << rt;
	}
	else if (a == 24) {
		cout << 15 << rt;
	}
	else if (a == 32) {
		cout << 51 << rt;
	}

	please AC;
}

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

int main() {
  double N, P = 0;
  int K;
  cin >> N >> K;
  
  for(int i = 1; i <= N; i++){
    double T = 1;
    int j = i;
    while(j < K){
      T *= 2;
      j *= 2;
    }
    P += 1 / N / T;
  }

  cout << fixed << setprecision(12);
  cout << P << endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

#define ll long long
#define MOD 1000000007

using namespace std;

int main() {
  string s = "abcdefghijklmnopqrstuvwxyz";
  string t;
  cin >> t;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == t[0]) {
      cout << s[i + 1] << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long  long int 
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);



int main()
{


ll a,b,c;
ll k;

cin>>a>>b>>c;
cin>>k;
int cnt=0;
while(a>=b)
{
	b=b*2;
	cnt++;
}
while(b>=c)
{
	c=c*2;
	cnt++;
}

	if(cnt<=k)
		cout<<"Yes";
	else
		cout<<"No";


return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
constexpr ll traffic=5;
int main(){
    ll n,a[traffic];
    cin >> n;
    rep(i,traffic)cin >> a[i];
    auto min_a = *min_element(a,a+traffic);
    cout << (n+min_a-1)/min_a+traffic-1 << endl;
    return 0;
}

Measured memory_bytes: 256
n,m,*a=map(int,open(0).read().split())
d=[1]*(n+1)
for i in a:
    d[i]=0
for i in range(2,n+1):
    if d[i]!=0:
        d[i]=d[i-1]+d[i-2]
print(d[-1]%(10**9+7))

Measured memory_bytes: 460020
#pragma region
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 1e9
using namespace std;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}

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

#pragma endregion

int main() {
  int n = in(), k = in();
  ll ans = 0;
  for (ll i = k; i <= n + 1; i++) {
    ll max = i * n - (i * (i - 1) / 2);
    ll min = i * (i - 1) / 2;
    ans += (max - min + 1);
    ans %= int(1e9) + 7;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>

int main() {
    int N, temp, ans=0;
    std::vector<int> H;
    std::cin >> N;
    
    for (int i=0; i<N; i++) {
        std::cin >> temp;
        H.push_back(temp); 
    }
    
    int highest = H.front();
    
    for (auto &&e : H) {
        if (e >= highest) {
            ans++;
            highest = e;
        }
    }
    
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int r;
    int d;
    int x;
    int ans;

    int i;
    scanf("%d%d%d",&r,&d,&x);

    for(i=0;i<10;i++){
      ans=r*x-d;
      printf("%d\n",ans);
      x=ans;
    }
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<tuple<string, int, int>> sp(n);
    for(int i = 0;i < n;i++){
        string a;
        int b;
         cin >> a >> b;
         sp.at(i) = make_tuple(a, 100 - b, i+1);
    }

    sort(sp.begin(), sp.end());

    for(int i = 0;i < n;i++){
        int num;
        tie(ignore, ignore, num) = sp.at(i);
        cout << num << endl;
    }

    
}

Measured memory_bytes: 3620
import sys
import re
import math
import collections
import decimal
import bisect
import itertools

import copy

# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def prime_factorize(n):
        a = []
        while n % 2 == 0:
            a.append(2)
            n //= 2
        f = 3
        while f * f <= n:
            if n % f == 0:
                a.append(f)
                n //= f
            else:
                f += 2
        if n != 1:
            a.append(n)
        return a

    n, p = ns()

    d = prime_factorize(p)
    ans = 1

    c = collections.Counter(d)
    for k,v in c.items():
        if v//n > 0:
            ans *= k**(v//n)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 5588
N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))

mini = 10**5+1
for i in range(N):
    if mini > abs(A-T+H[i]*0.006):
        mini = abs(A-T+H[i]*0.006)
        ans = i+1
print(ans)

Measured memory_bytes: 3060
N=int(input())
L=list()
for i in range(N):
  L.append(input())
a=L.count('AC')
b=L.count('WA')
c=L.count('TLE')
d=L.count('RE')
print('AC x',a)
print('WA x',b)
print('TLE x',c)
print('RE x',d)





Measured memory_bytes: 16172
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    int ng = 0, np = 0;
    int ans = 0;
    rep(i, n) {
        if (s[i] == 'g') {
            if (np + 1 <= ng) {
                np++;
                ans++;
            } else {
                ng++;
            }
        } else {
            if (np + 1 <= ng) {
                np++;
            } else {
                ng++;
                ans--;
            }
        }
    }
    cout << ans << endl;
}


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

int main() {
    int n, x;

    while (true) {
        cin >> n >> x;
        if (n == 0 && x == 0)
            break;
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = i+1; j <= n; j++) {
                for (int k = j+1; k <= n; k++) {
                    if (i + j + k == x)
                        ans++;
                }

            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3096
//
//  main.cpp
//
// g++ -std=c++14 main.cpp
//

//#include "main.hpp"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;

ll ans = 0, n, mx_w, s[5][105], weight_idx[5];
vector<int> v[4];

void dfs(ll num, ll value, ll weight) {
    //cout << num << " " << value << " " << weight << endl;
    if (weight <= mx_w && num < 4) ans = max(ans, value);
    if (weight <= mx_w && num < 3) {
        for (int i = 0; i <= v[num + 1].size(); i++) {
            dfs(num + 1, value + s[num + 1][i], weight + weight_idx[num + 1] * i);
        }
    }
}

int main(void){
    cin >> n >> mx_w;
    
    ll t0;
    for (int i = 0; i < n; i++) {
        ll tmp_w, tmp_v;
        if (i == 0) {
            cin >> t0 >> tmp_v;
            v[0].push_back(tmp_v);
        }
        else {
            cin >> tmp_w >> tmp_v;
            v[tmp_w - t0].push_back(tmp_v);
        }
    }
    
    for (int i = 0; i < 4; i++) {
        weight_idx[i] = t0 + i;
        sort(v[i].begin(), v[i].end(), greater<int>());
        s[i][0] = 0;
        for (int j = 0; j < v[i].size(); j++) {
            s[i][j + 1] = s[i][j] + v[i][j];
        }
    }
    
    dfs(-1, 0, 0);
    
    cout << ans << endl;
    
    
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long


int main(){
    int s;
    int a[3000000]={};
    int cnt=1;
    cin>>s;
   
    while(1){
        if(a[s]>0){
            break;
        }
        a[s]++;
        if(s%2){
            s=(s*3+1);
        }else{
            s/=2;
        }
        //cout<<s<<endl;
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;


}



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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

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

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

int main(){
    bool flag=false;
    ll ans,sum=0;

    int n;
    cin>>n;
    ans=n;

    rep(i,n+1){
        int cnt=0;
        int six=i;
        int nin=n-i;

        while(six>0){ cnt+=six%6; six/=6; }
        while(nin>0){ cnt+=nin%9; nin/=9; }

        chmin(ans,cnt);
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    
    cout<<ans<<endl;
    
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#define MOD 1000000007

#include <iostream>
#include <vector>
using namespace std;

long pow(long a, long b) {
	if (b == 0) return 1;
	long c = pow(a, b / 2);
	if (b % 2) c = a * c % MOD * c % MOD;
	else c = c * c % MOD;
	return c;
}

class Combination {
	vector<long> _a, _b;

public:
	Combination(long& a) : _a(a + 1, 1), _b(a + 1, 1) {
		for (int i = 1; i <= a; i++) {
			_a[i] = _a[i - 1] * i % MOD;
			_b[i] = pow(_a[i], MOD - 2);
		}
	}

	long combination(long a, long b) {
		if (a < b) return 0;
		return _a[a] * _b[a - b] % MOD * _b[b] % MOD;
	}
};

int main() {
	long N, K;
	cin >> N >> K;
	Combination a(N);
	for (int i = 1; i <= K; i++) {
		cout << a.combination(N - K + 1, i) * a.combination(K - 1, i - 1) % MOD << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[11];
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int v[210][22][22][4];
int to[22][22][4];
int sig[22][22];
pair<int,int> conv(){
	int row=0;
	int col=0;
	row=str[0]-'a';
	col=str[2]-'0';
	if(str[3])col=col*10+str[3]-'0';
	return make_pair(row,col-1);
}
int main(){
	int a,b,c;
	while(scanf("%d%d",&a,&b),a){
		scanf("%d",&c);
		int d;scanf("%d",&d);
		for(int i=0;i<210;i++)for(int j=0;j<22;j++)for(int k=0;k<22;k++)
			for(int l=0;l<4;l++)v[i][j][k][l]=0;
		for(int i=0;i<a;i++)for(int j=0;j<b;j++){
			for(int k=0;k<4;k++){
				to[i][j][k]=-1;
				if(0<=i+dx[k]&&i+dx[k]<a&&0<=j+dy[k]&&j+dy[k]<b)
					to[i][j][k]=c;
			}
		}
		for(int i=0;i<22;i++)for(int j=0;j<22;j++)sig[i][j]=-1;
		while(d--){
			int e;
			scanf("%s%d",str,&e);
			pair<int,int>pt=conv();
			sig[pt.first][pt.second]=e;
		}
		scanf("%d",&d);
		while(d--){
			scanf("%s",str);
			pair<int,int>p1=conv();
			scanf("%s",str);
			pair<int,int>p2=conv();
			for(int i=0;i<4;i++){
				if(p1.first+dx[i]==p2.first&&p1.second+dy[i]==p2.second)to[p1.first][p1.second][i]=-1;
				if(p2.first+dx[i]==p1.first&&p2.second+dy[i]==p1.second)to[p2.first][p2.second][i]=-1;
			}
		}
		scanf("%d",&d);
		while(d--){
			scanf("%s",str);
			pair<int,int>p1=conv();
			scanf("%s",str);
			pair<int,int>p2=conv();
			int e;scanf("%d",&e);
			for(int i=0;i<4;i++){
				if(p1.first+dx[i]==p2.first&&p1.second+dy[i]==p2.second)to[p1.first][p1.second][i]+=e;
				if(p2.first+dx[i]==p1.first&&p2.second+dy[i]==p1.second)to[p2.first][p2.second][i]+=e;
			}
		}
		scanf("%s",str);
		pair<int,int> S=conv();
		scanf("%s",str);
		pair<int,int> T=conv();
		v[0][S.first][S.second][1]=1;
		int ret=99999999;
		for(int i=0;i<100;i++){
			for(int j=0;j<a;j++)for(int k=0;k<b;k++)for(int l=0;l<4;l++){
				if(!v[i][j][k][l])continue;
	//			printf("%d %d %d %d\n",i,j,k,l);
			//	v[i+1][j][k][l]=1;
			//	if(~sig[j][k]&&((l%2==1&&(i+sig[j][k]*2)%(sig[j][k]*2)>=sig[j][k])||(l%2==0&&(i+sig[j][k]*2)%(sig[j][k]*2)<sig[j][k])))continue;
				for(int m=0;m<4;m++){
					if(!~to[j][k][m])continue;
					if((m^2)==l)continue;
					if(~sig[j+dx[m]][k+dy[m]]&&((m%2==0&&(i+to[j][k][m])%(sig[j+dx[m]][k+dy[m]]*2)>=sig[j+dx[m]][k+dy[m]])||
					(m%2==1&&(i+to[j][k][m])%(sig[j+dx[m]][k+dy[m]]*2)<sig[j+dx[m]][k+dy[m]])))continue;
					v[i+to[j][k][m]][j+dx[m]][k+dy[m]][m]=1;
					if(T.first==j+dx[m]&&T.second==k+dy[m])ret=min(ret,i+to[j][k][m]);
				}
			}
		}
		printf("%d\n",ret);
	}
}

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

int main() {
  int d;
  std::cin >> d;
  switch (d) {
    case 25:
      std::cout << "Christmas" << std::endl;
      break;
    case 24:
      std::cout << "Christmas Eve" << std::endl;
      break;
    case 23:
      std::cout << "Christmas Eve Eve" << std::endl;
      break;
    default:
      std::cout << "Christmas Eve Eve Eve" << std::endl;
      break;
  }
  return 0;
}


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

int main(){
  string s,t;
  cin >> s >> t;
  int x = s.size();
  int y = t.size();
  int ans = y;
  for(int i = 0;i < x-y+1;i++){
    int buf = 0;
    for(int j = i;j < i+y;j++){
      //cout << i <<s.at(j) << j-i << t.at(j-i) << endl;
      if(s.at(j) != t.at(j-i)){
        buf++;
      }
    }
    ans = min(buf,ans);
  }
  
  cout << ans << endl;
      
      
}

Measured memory_bytes: 3604
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root = NIL;

Node treeMinimum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key)x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL)root=z;
  else if(z->key<y->key)y->left=z;
  else y->right=z;
  
}

void inorder(Node u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 24040
import numpy as np

D, G = map(int, input().split())

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:
            score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

    if score >= G:
        ans = min(ans, count)

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        break

print(ans)

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

int main() {
	int a, b;
	cin >> a >> b;
	int n;
	cin >> n;
	int s[100], f[100];
	for (int i = 0;i < n;i++)cin >> s[i] >> f[i];
	int flag = 0;
	for (int i = 0;i < n;i++) {
		if (max(a, s[i]) < min(b, f[i])) {
			flag = 1;
			break;
		}
	}
	cout << flag << endl;
}



Measured memory_bytes: 3080
#include<iostream>
using namespace std;
int N;
long mod=1e9+7,dp[101][64];
main()
{
	cin>>N;
	dp[0][63]=1;
	for(int i=0;i<N;i++)for(int j=0;j<64;j++)
	{
		int a=j/16,b=j/4%4,c=j%4;
		for(int d=0;d<4;d++)
		{
			if(b==0&&c==2&&d==1)continue;
			if(a==0&&c==2&&d==1)continue;
			if(b==2&&c==0&&d==1)continue;
			if(b==0&&c==1&&d==2)continue;
			if(a==0&&b==2&&d==1)continue;
			(dp[i+1][b*16+c*4+d]+=dp[i][j])%=mod;
		}
	}
	long ans=0;
	for(int i=0;i<64;i++)ans+=dp[N][i];
	cout<<ans%mod<<endl;
}


Measured memory_bytes: 256
/*Fuck the world*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0),cout.tie(0);
#define fori(i,a,b) for(i=a;i<b;i++)
int main()
{
    fast;
    string s,w;
    cin>>s>>w;
    ll i,l=s.length(),c=0;
    fori(i,0,l)
    {
        if(s[i]!=w[i])
        c++;
    }
    cout<<c<<"\n";
}

Measured memory_bytes: 3808
#Union Find

class UnionFind:
    """
    par  : 木の親要素を管理par[x]==xのときそのノードは根,
            初期状態例:[0,1,2,3]それぞれが親
                        [0,0]のとき0が根で1の親は0であることを示す
    rank : 木の高さを格納,併合する際に木の高さが高いものに低いものをくっつける形になるから

    """
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * (n)
        #print(self.rank)

    """
    引数のノードの根を検索
    再起関数で親の親の親の...という形で根にたどり着くまで繰り返す
    """
    # 検索
    def findSet(self, x):
        # 根ならその番号を返す
        if self.par[x] == x:
            return x
        else:
        # 根でないなら、親の要素で再走査
            # 走査する過程で親を書き換える(根を親につなぎなおす)
            self.par[x] = self.findSet(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        #根を探す
        x = self.findSet(x)
        y = self.findSet(y)
        # 木の高さを比較し,高いほうに低いほうをくっつける
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
        # 木の高さが同じなら片方の木の高さを1増やす
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1


    """
    同じ集合に属するか判定＝二つの要素の根が同じかどうか判定
    """
    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.findSet(x) == self.findSet(y)


def main():
    p = []  ##appendのために宣言が必要
    n, q = map(int, input().split())
    # n：整数の値の範囲（n-1）
    # q：実行されるクエリの数
    # 入力受付
    i = 0
    while i < q:
        try:
            p.append(list(map(int, input().split())))
            i = i + 1
        except:
            break;
    x = UnionFind(n)

    i = 0
    while i < len(p):
        if(p[i][0] == 0):
                x.union(p[i][1],p[i][2])
        if(p[i][0] == 1):
            result = x.same_check(p[i][1],p[i][2])
            if result == False:
                print(0)
            if result == True:
                print(1)

        i = i + 1







if __name__ == '__main__':
    main()




Measured memory_bytes: 24768
// C - Pyramid
#include <bits/stdc++.h>
using namespace std;
using TP = tuple<int,int,int>;
using VT = vector<TP>;
#define rp(i,n) for(int i=0;i<(n);i++)
#define eb(x,y,h) emplace_back((x),(y),(h))
#define manhattan(x1,y1,x2,y2) (abs((x1)-(x2))+abs((y1)-(y2)))
#define XMAX 100
#define YMAX 100

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

	VT A;
	int x,y,h;

	rp(i, N){
		cin>>x>>y>>h;
		A.eb(x,y,h);
	}

	rp(y0, YMAX+1){
		rp(x0, XMAX+1){

			rp(i, N){
				tie(x,y,h) = A[i];
				if(h > 0) break;
			}

			int h0 = h + manhattan(x0,y0, x,y);

			bool exist = true;
			rp(i, N){
				tie(x,y,h) = A[i];
				if(h <= 0) continue;
				if(h0 != h + manhattan(x0,y0, x,y)){
					exist = false;
					break;
				}
			}
			if(!exist) continue;

			rp(i, N){
				tie(x,y,h) = A[i];
				if(h > 0) continue;
				if(h0 - manhattan(x0,y0, x,y) > 0){
					exist = false;
					break;
				}
			}
			if(exist){
				cout<<x0<<" "<<y0<<" "<<h0<<"\n";
				return 0;
			}

		}
	}

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
string dp[70][70]; //i,jから開始したときの最大数
string s[70];
bool comp(string lhs,string rhs)
{
	if(lhs.size()==rhs.size())
		return lhs>rhs;
	else
		return lhs.size()>rhs.size();
}

string maxstr(string lhs,string rhs)
{
	if(comp(lhs,rhs))
		return lhs;
	else
		return rhs;
}
vector<string> v;
int main()
{
	int h,w;
	while(1)
	{
		cin>>w>>h;
		if(h==0)
			break;
		for(int i=0;i<h;i++)
			cin>>s[i];
		for(int i=0;i<h;i++)
		{
			for(int j=0;j<w;j++)
			{
				if(s[i][j]>='0' && s[i][j]<='9')
					dp[i][j]=s[i][j];
				else
					dp[i][j]="";
			}
		}
		//最後から探索
		//最後の1行
		for(int i=w-2;i>=0;i--)
		{
			if(s[h-1][i]>='0' && s[h-1][i]<='9')
				dp[h-1][i]=s[h-1][i]+dp[h-1][i+1];
		}
		//最後の1列
		for(int i=h-2;i>=0;i--)
		{
			if(s[i][w-1]>='0' && s[i][w-1]<='9')
				dp[i][w-1]=s[i][w-1]+dp[i+1][w-1];
		}
		//残り
		for(int i=h-2;i>=0;i--)
		{
			for(int j=w-2;j>=0;j--)
			{
				if(s[i][j]>='0' && s[i][j]<='9')
				{
					dp[i][j]=maxstr(s[i][j]+dp[i+1][j],s[i][j]+dp[i][j+1]);
				}
			}
		}
		v.clear();
		for(int i=0;i<h;i++)
		{
			for(int j=0;j<w;j++)
			{
				//cerr<<dp[i][j]<<endl;
				if(dp[i][j]!="" && dp[i][j][0]!='0')
					v.push_back(dp[i][j]);
			}
		}
		sort(v.begin(),v.end(),comp);
		cout<<v[0]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3464
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

#include <math.h>
using namespace std;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; i++){
        cin >> v.at(i);
    }
    int sum=0;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(i != j){
                sum += v.at(i)*v.at(j);
            }
        }
    }
    cout << sum / 2 << endl;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
int main() {
	int n, c = 0, t = 0;
	cin >> n;
	vector<int> a(n);
	rep(i, 0, n)cin >> a[i];
	rep(i, 0, n) {
		if (a[i] == i + 1) {
			t++;
		}
		else {
			c += (t + 1) / 2;
			t = 0;
		}
	}
	c += (t + 1) / 2;
	printf("%d\n", c);
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <string.h>

#define rep(i,n)    for(ll i=0;i<n;i++)
#define repu(i,k,n) for(ll i=k;i<=n;i++)
#define repd(i,k,n) for(ll i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define endl "\n"
#define INF (ll)ll_MAX

typedef long long ll;
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector<ll> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, ll > > vpp;

const ll N = 3*1e5 +5 ;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const long long inf = 1e18;

using namespace std;

void solve()
{    
    int n ; 
    cin>>n;
    int x , t ;
    cin>>x>>t ;
    int ans = n / x ; 
    if(n%x){
        ans++;
    }
    cout<<ans*t<<endl;
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    //cout<<"helo";
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    ll t = 1;
    //  cin>>t;

    while(t--)
    {
        solve();    
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

}

Measured memory_bytes: 3800
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <queue> 
#include <cctype> 
#include <climits> 
#include <stack> 
#include <map> 
#include <cstring> 
#include <numeric>

using namespace std; 

const long long mod=1e9+7;
set<string> ans;

void rec(int n, string now, char last){
    if(now.size()==n){
        ans.insert(now);
        return ;
    }

    char c='a';
    while(c < (char)('a'+n) && c <= (last + 1) ){
        rec(n, now+c, max(c,last));
        c++;
    };

    //for(int i=0; i<=min(used+1, n-1); i++){
    //    rec(n, now+(char)('a'+i), used+i);
    //}
}

int main(){

    int n;
    cin>>n;

    rec(n, "a", 'a');

    for(auto it=ans.begin(); it!=ans.end(); it++){
        cout<< *it <<endl;
    }

    return 0;
}

Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
vector<int> d;
int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    d.resize(N);
    for(int i = 0; i < N; i++) cin >> d[i];
    sort(d.begin(), d.end());
    cout << d[N / 2] - d[N / 2 - 1] << endl;
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<math.h>
int hantei(int);

int main(){
  int n,i,sum=0;
  int A[10000];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    sum += hantei(A[i]);
  }
  
  printf("%d\n",sum);
  return 0;
}

int hantei(int a){
  int i,f=0;

  if(a==2)return 1;
  else if(a%2==0)return 0;
  else {
    for(i=3;i<=sqrt(a);i+=2){
      if(a%i==0) f++;
      continue;
    }
    if(f==0) return 1;
    else return 0;
  }
    
}
  



Measured memory_bytes: 2084