akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--ModInt
//-------------------------------------------------
const ::std::uint_fast64_t MOD = 1e9+7;

class mint
{
private:
    using value_type = ::std::uint_fast64_t;
    value_type n;
public:
    mint():n(0){}
    mint(::std::int_fast64_t _n):n(_n<0 ? MOD-(-_n)%MOD : _n%MOD){}
    mint(const mint &m):n(m.n){}

    friend ::std::ostream& operator<<(::std::ostream &os, const mint &a){
		return os << a.n;
	}
    friend ::std::istream& operator>>(::std::istream &is, mint &a){
        value_type temp; is>>temp;
        a = mint(temp);
        return is;
    }

    mint& operator+=(const mint &m){n+=m.n; n=(n<MOD)?n:n-MOD; return *this;}
    mint& operator-=(const mint &m){n+=MOD-m.n; n=(n<MOD)?n:n-MOD; return *this;}
    mint& operator*=(const mint &m){n=n*m.n%MOD; return *this;}
    mint& operator/=(const mint &m){return *this*=m.inv();}
    mint& operator++(){return *this+=1;}
    mint& operator--(){return *this-=1;}

    mint operator+(const mint &m) const {return mint(*this)+=m;}
    mint operator-(const mint &m) const {return mint(*this)-=m;}
    mint operator*(const mint &m) const {return mint(*this)*=m;}
    mint operator/(const mint &m) const {return mint(*this)/=m;}
    mint operator++(int){mint t(*this); *this+=1; return t;}
    mint operator--(int){mint t(*this); *this-=1; return t;}

    mint operator==(const mint &m) const {return n==m.n;}
    mint operator!=(const mint &m) const {return n!=m.n;}
    mint operator-() const {return mint(MOD-n);}

    mint pow(value_type b) const {
        mint ret(1), m(*this);
        while(b){
            if (b & 1) ret*=m;
            m*=m;
            b>>=1;
        }
        return ret;
    }

    mint inv() const {return pow(MOD-2);}
};

map<pll,mint> memo;

mint f(ll x, ll y){
    if (memo.count(mp(x,y))) return memo[mp(x,y)];
    mint ret=0;
    if (x==0 && y==0) return 1;
    ret+=f(x/2,y/2);
    if (x>=2) ret+=f((x-2)/2,y/2);
    if (x>=1 && y>=1) ret+=f((x-1)/2,(y-1)/2);
    return memo[mp(x,y)] = ret;
}

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin>>n;
    cout<<f(n,n)<<"\n";
    return 0;
}


Measured memory_bytes: 256
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  int n, m;
  rd(n, m);

  int[] a;
  for (int i = 2; i * i <= m; i++) {
    if (m % i == 0) {
      int cnt = 0;
      while (m % i == 0) {
        cnt++;
        m /= i;
      }
      a ~= cnt;
    }
  }
  if (m > 1) {
    a ~= 1;
  }

  const long mod = 10 ^^ 9 + 7;
  const size_t M = 10 ^^ 5 * 2;
  static long[M] fac, inv;
  fac[0] = fac[1] = 1;
  foreach (i; 2 .. M)
    fac[i] = (fac[i - 1] * i) % mod;
  long _pow(long a, long x) {
    if (x == 0)
      return 1;
    else if (x == 1)
      return a;
    else if (x & 1)
      return a * _pow(a, x - 1) % mod;
    else
      return _pow(a * a % mod, x / 2);
  }

  foreach (i; 0 .. M)
    inv[i] = _pow(fac[i], mod - 2);
  long cmb(long a, long b) {
    if (a < b)
      return 0;
    else
      return fac[a] * inv[b] % mod * inv[a - b] % mod;
  }

  long tot = 1;
  foreach (e; a) {
    (tot *= cmb(e + n - 1, e)) %= mod;
  }
  writeln(tot);
}

void rd(T...)(ref T x) {
  import std.stdio, std.string, std.conv;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


Measured memory_bytes: 3436
def mod_c(n, r, m):
    num, den = 1, 1
    for i in range(1, r + 1):
        num = num * (n - i + 1) % m
        den = den * i % m
    return (num * pow(den, m - 2, m)) % m

n, a, b = map(int, input().split())
p = 10**9 + 7
print((pow(2, n, p) - 1 - mod_c(n, a, p) - mod_c(n, b, p)) % p)

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

int main() {
    int n,i,l,r,ans=0,sum=0,cnt=0;
    scanf("%d%d%d",&l,&r,&n);
    for(i=l;i<=r;i++){
        if(i%n==0) ans++;
    }
    printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3756
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
 
#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define ll_cin(X) scanf("%lld", &X)
 
#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)
 
typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)
 
#define S_RTN(S)  s_cout(S);return 0
 
 
#define _itoa(A,N) sprintf(A, "%d", N);
 
int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);
 
int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
 
 
int s_asorts(const void* a, const void* b);
 
//昇順
int s_asorts(const void* a, const void* b) {
    return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
    return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
    return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
    int i;
    rept(i, 0, n) {
        l_cin2(*(a + i), *(b + i));
    }
    return 0;
}
int i_cins(int n, int* a) {
    int i;
    for (i = 0; i < n; i++) {
        i_cin(*(a + i));
    }
 
    return 0;
}
int _gcd(int a, int b) {
    int r, tmp;
    if (a < b) { tmp = a; a = b; b = tmp; }
    r = a % b;
    while (r) {
        if (!r) break;
        a = b; b = r;
        r = a % b;
    }
    return(b);
}
 
long _max(long a, long b) {
    return a > b ? a : b;
}
long _min(long a, long b) {
    return a < b ? a : b;
}
int _swp(int* a, int* b)
{
    int tmp;
    tmp = *b; *b = *a; *a = tmp;
    return 0;
}

//小さい順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

//変換(文字から整数)
int ctoi(char c) {
    if (c >= '0' && c <= '9') {
        return c - '0';
    }
    return 0;
}


int main(void){
    int N;
    int cnt=0;
    i_cin(N);
    int len[N];
    rept(i,0,N)
    i_cin(len[i]);
    qsort(len,N,sizeof(int),compare_int);
    for(int i=0;i<N-2;i++){
        for(int j=i+1;j<N-1;j++){
            for(int k=j+1;(len[k]<(len[i]+len[j])) && (k<N);k++){
                if(len[k]<(len[i]+len[j]) && len[i]<(len[j]+len[k]) && len[j]<(len[k]+len[i]))
                    cnt++;
            }
        }
    }
    printf("%d",cnt);
}

    




Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int x,y,a,b,c;
typedef long long LL;
const int N = 1e5 + 1;
int l;
bool cmp(pair<int,int> A,pair<int,int> B){
    return A.first > B.first;
}
int main()
{
    cin >> x >> y >> a >> b >> c;
    int g1 = x, g2 = y;
    vector<pair<int,int> > v;
    for(int i = 1; i <= a; i++){
        cin >> l;
        v.push_back({l,1});
    }
    for(int i = 1; i <= b; i++){
        cin >> l;
        v.push_back({l,2});
    }
    for(int i = 1; i <= c; i++){
        cin >> l;
        v.push_back({l,3});
    }
    sort(v.begin(),v.end(),cmp);
    LL sol = 0;
    queue <int> s;
    int i = 0;
    while(i < g1 + g2){
        if(x && v[i].second == 1){
            x--;
            sol += (LL)v[i].first;
        }
        if(y && v[i].second == 2){
            y--;
            sol += (LL)v[i].first;
        }
        if(v[i].second == 3)
            s.push(v[i].first);
        i++;
    }
    if(x + y == s.size()){
        LL r = 0;
        for(int i = 0; i < g1 + g2; i++){
            r += (LL)v[i].first;
        }
        cout << r;
        return 0;
    }
    if(x){
        while(!s.empty()){
            x--;
            sol += (LL)s.front();
            s.pop();
        }
        for(int i = g1 + g2; x; i++){
            if(v[i].second != 2){
                x--;
                sol += (LL)v[i].first;
            }
        }
        cout << sol;
        return 0;
    }
    while(!s.empty()){
        y--;
        sol += (LL)s.front();
        s.pop();
    }
    for(int i = g1 + g2; y; i++){
        if(v[i].second != 1){
            y--;
            sol += (LL)v[i].first;
        }
    }
    cout << sol;
    return 0;
}


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


int main(void) {

  set<int> a;
  int s, i = 1;

  cin >> s;

  a.insert(s);
  while(true) {
    if (s%2 == 0) s = s / 2;
    else s = 3*s + 1;

    i++;
    if (a.find(s) != a.end()) break;
    a.insert(s);
  }

  printf("%d", i);

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define for_int(i,a,b) for(int i=(a);i<=(b);++i)
#define rep_int(i,a,b) for(int i=(a);i>=(b);--i)
#define for_ll(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep_ll(i,a,b) for(ll i=(a);i>=(b);--i)
#define ull unsigned long long
#define ll long long
#define db double
#define HPMAX 1005
#define KMP_MAX 1005
#define prime_MAX 1e6+5
#define quick_pow_mod 1e9+7
#define PII pair<int,int>
using namespace std;
//快读
int read() {
	char c = getchar();
	int x = 0, f = 1;
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (; isdigit(c); c = getchar())
		x = x * 10 + c - 48;
	return x * f;
}

char ch;
int main() {
	ch = getchar();
	if (ch >= 'A' && ch <= 'Z') cout << "A" << endl;
	else cout << "a" << endl;
	return 0;
}

Measured memory_bytes: 3616
#include"iostream"
using namespace std;

int main() {
	char a, b;
	cin >> a >> b;
	if (a < b)
	{
		cout << "<" << endl;
	}
	else if (a == b)
	{
		cout << "=" << endl;
	}
	else
	{
		cout << ">" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> da(5);
  int k;
  for(int i=0;i<5 ;i++)
    cin >> da[i];
  cin >> k;
  bool ans=true;
  for(int i=0;i<4;i++){
    for(int j=i+1;j<5;j++){
      if(da[j]-da[i]>k)
        ans=false;
    }
  }
  if(ans)
    cout << "Yay!" << endl;
  else
    cout << ":(" << endl;
}

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

int main(){
    int n;
    cin >> n;
    if(n/100==7) cout << "Yes" << endl; 
    else if((n/10)%10==7) cout << "Yes" << endl; 
    else if(n%10==7) cout << "Yes" << endl; 
    else cout << "No" << endl;

    }


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int N;
	cin >> N;
	vl A(N);
	vl a(110000, 0);
	ll ans = 0;
	rep(i, N) {
		cin >> A[i];
		a[A[i]]++;
		ans += A[i];
	}
	int Q;
	cin >> Q;
	rep(q, Q) {
		ll B, C;
		cin >> B >> C;
		ans += (C - B) * a[B];
		cout << ans << endl;
		a[C] += a[B];
		a[B] = 0;
	}
	return 0;
}

Measured memory_bytes: 4836
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>

using namespace std;

typedef long long ll;
const int mod = 1000000007;
const int maxn = 5005;

ll exgcd(ll a,ll b,ll& x,ll& y)
{
    ll d = a;
    if(b!=0)
    {
        d = exgcd(b,a%b,y,x);
        y -= (a/b)*x;
    }
    else
    {
        x = 1;y = 0;
    }
    return d;
}

ll niyuan(ll a)
{
    ll x,y;
    exgcd(a,mod,x,y);
    return (mod+x%mod)%mod;
}

int le,dp[maxn][maxn],n;

char s[maxn];

void add(int& f,int x)
{
    f = (f+x)%mod;
}

int main()
{
    scanf("%d%s",&n,s);
    le = strlen(s);
    dp[0][0] = 1;
    int r = 1;
    for(int i=0;i<le;i++)
        r = r*2%mod;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(!dp[i][j])
                continue;
            add(dp[i+1][j+1],2*dp[i][j]%mod);
            if(j)
                add(dp[i+1][j-1],dp[i][j]);
            else
                add(dp[i+1][j],dp[i][j]);
        }
    }
    printf("%d\n",dp[n][le]*niyuan(r)%mod);
}


Measured memory_bytes: 67072
#include<iostream>

int main(){
  int n;std::cin>>n;
  long long ans=0;
  for(int i=1;i<=n;i++){
    long long tmp=n/i;
    ans+=i*tmp*(tmp+1)/2;
  }
  std::cout<<ans<<std::endl;
  
  return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int i, n, ans;
string S,T;
int main()
{
    cin >> S >> T;
    n = S.size();
    for(i=0;i<n;i++)
    {
        if(T[i]!=S[i])
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3868
N, X, Y = map(int, input().split())

t = [0] * (N - 1)
for i in range(1, N):
    for j in range(i + 1, N + 1):
        t[min(j - i, abs(X - i) + 1 + abs(Y - j)) - 1] += 1
print('\n'.join(map(str, t)))
#print(*result, sep='\n')


Measured memory_bytes: 9288
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<list>
#include <cstring>
#include <functional>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF ((Int)1<<60)
#define EPS (1e-10)
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define RREP(i,n) for(int i=1; i<=(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long Int;
typedef pair<Int, Int> PI;
typedef pair<int, int> P;
typedef vector<double> vec;
typedef vector<vec> mat;
const int N = 200005;
//////////////////////////////

int n;
int c[N];
Int dp[N];
Int sum[N];

void solve()
{
	cin >> n;
	RREP(i, n) cin >> c[i];

	dp[0] = 1;
	dp[1] = 1;
	sum[c[1]] = 1;
	for (int i = 2; i <= n; i++) {
		if (c[i] == c[i - 1]) {
			dp[i] = dp[i - 1];
		}
		else {
			dp[i] = (dp[i - 1] + sum[c[i]]) % MOD;
			sum[c[i]] = dp[i];
		}	
	}
	cout << dp[n] % MOD << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(13);
	solve();
	return 0;
}


Measured memory_bytes: 7408
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

vector<int> g[100111];
int n;
int dfs(int x,int f=0)
{
	vector<int> all;
	int ret=0;
	for(int i=0;i<(int)g[x].size();i++)
		all.pb(dfs(g[x][i]));
	sort(all.begin(),all.end());reverse(all.begin(),all.end());
	for(int i=0;i<(int)all.size();i++)ret=max(ret,all[i]+i+1);
	return ret;
}
int main()
{
	get1(n);
	for(int i=2,x;i<=n;i++)
	{
		get1(x);
		g[x].pb(i);
	}
	printendl(dfs(1));
	
	return 0;
}

Measured memory_bytes: 15104
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,c,h,i,j,k,l,m,n,x,y;
	char		ans;
	char	b;
	cin >> b;

	if (b=='A') ans = 'T';
	if (b=='C') ans = 'G';
	if (b=='G') ans = 'C';
	if (b=='T') ans = 'A';
	cout << ans << endl;
	return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	auto A=in<unsigned int>(),B=in<unsigned int>();
	bitset<32> bs1(A),bs2(B);

	out(bs1&bs2);
	out(bs1|bs2);
	out(bs1^bs2);

	return 0;
}


Measured memory_bytes: 3208
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 3
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)

	g := make([][]Edge, n)

	for i := 0; i < n-1; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner) - 1
		g[a] = append(g[a], Edge{
			id: i,
			to: b,
		})
		g[b] = append(g[b], Edge{
			id: i,
			to: a,
		})
	}

	m := getNextInt(scanner)
	visited := make([][]int, m)
	ee := make([]int64, m)
	var ans, horobiyo int64
	for i := 0; i < m; i++ {
		u := getNextInt(scanner) - 1
		v := getNextInt(scanner) - 1

		visited[i] = make([]int, n-1)
		dfs(u, -1, v, visited[i], g)
		for j := 0; j < n-1; j++ {
			if visited[i][j] == 0 {
				continue
			}
			ee[i] |= 1 << uint(j)
		}
	}
	for i := 0; i < 1<<uint(m); i++ {
		horobiyo = 0
		c := 0
		for j := 0; j < m; j++ {
			if i>>uint(j)&1 == 0 {
				continue
			}
			horobiyo |= ee[j]
			c++
		}
		d := n - 1
		for j := 0; j < n-1; j++ {
			d -= int(horobiyo >> uint(j) & 1)
		}
		if c%2 == 0 {
			ans += 1 << uint(d)
			continue
		}
		ans -= 1 << uint(d)
	}
	fmt.Fprintln(writer, ans)
}

func dfs(i, p, v int, visited []int, g [][]Edge) int {
	if i == v {
		return 1
	}
	r := 0

	for _, e := range g[i] {
		if e.to == p {
			continue
		}
		x := dfs(e.to, i, v, visited, g)
		if x == 1 {
			visited[e.id] = 1
			r = x
		}
	}

	return r
}

// Edge ...
type Edge struct {
	to, id int
}


Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)
long long a[51], pathi[51], ban[51];
long long count_pathi(int n, long long x) {
	if (n == 0) {
		return 1;
	}
	if (x == 1) {
		return 0;
	}
	else if (x <= 1 + a[n - 1]) {
		return count_pathi(n - 1, x - 1);
	}
	else if (x == a[n - 1] + 2) {
		return pathi[n - 1] + 1;
	}
	else if (x <= 2 * a[n - 1] + 2) {
		return count_pathi(n - 1, x - a[n - 1] - 2) + pathi[n - 1] + 1;
	}
	else {
		return pathi[n];
	}
}
int main() {

	long long n, x;
	cin >> n >> x;

	a[0] = 1;
	pathi[0] = 1;
	ban[0] = 0;
	FOR(i, 1, 50) {
		a[i] = a[i - 1] * 2 + 3;
		pathi[i] = pathi[i - 1] * 2 + 1;
		ban[i] = ban[i - 1] * 2 + 2;
	}

	long long ans= count_pathi(n, x);
	ANS(ans);

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

class Solution
{
    static void Main()
    {
        var s = Console.ReadLine();
        var w = int.Parse(Console.ReadLine());

        var buff = new StringBuilder();
        for (int i = 0; i < s.Length; i += w)
        {
            buff.Append(s[i]);
        }

        Console.WriteLine(buff);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define x first
#define y second
using namespace std;
using ll  = long long;
#define int ll

signed main() {
#ifdef LC
    assert(freopen("input.txt", "r", stdin));
#endif
    ios::sync_with_stdio(0), cin.tie(0);

	string s;
	cin >> s;
	cout << s.substr(0, 3) << "\n";

    return 0;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<int> a(n);
        for(int i=0; i<n; ++i)
            cin >> a[i];
        long long len = accumulate(a.begin(), a.end(), 0LL);

        vector<int> b(n-1);
        for(int i=0; i<n-1; ++i)
            cin >> b[i];
        sort(b.rbegin(), b.rend());

        long long ret = len * n;
        for(int i=0; i<n-1; ++i){
            len += b[i];
            ret = max(ret, len * (n-1-i));
        }

        cout << ret << endl;
    }
}

Measured memory_bytes: 1532
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;


template <typename T>using ordered_set = tree<T, null_type, less<T>,rb_tree_tag, tree_order_statistics_node_update>;

#define PI              acos(-1.0)
#define en '\n'
#define Infi 0x3f3f3f3f
#define LInfi 0x3f3f3f3f3f3f3f3f

#define setzero(a)    memset(a,0,sizeof(a))
#define setneg(a)     memset(a,-1,sizeof(a))
#define setinf(a)     memset(a,126,sizeof(a))


#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);


const int dx[] = {+1,-1,+0,+0};                         // 4 X directions
const int dy[] = {+0,+0,+1,-1};                         // 4 Y directions
const int dx8[] = {+0,+0,+1,-1,-1,+1,-1,+1};            // King X Moves
const int dy8[] = {-1,+1,+0,+0,+1,+1,-1,-1};            // King Y Moves
const int kx[] = {-2, -2, -1, -1,  1,  1,  2,  2};      // Knight X Moves
const int ky[] = {-1,  1, -2,  2, -2,  2, -1,  1};      // Knight Y Moves



int  Set    (int N,int pos) {return N=N | (1<<pos);}    /// turn a bit on
int  reset  (int N,int pos) {return N= N & ~(1<<pos);}  /// turn a bit off
bool check  (int N,int pos) {return (bool)(N & (1<<pos));} /// check, if a bit is on or not

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int  ll;
typedef unsigned long long int llu;

vector<vector<int>> graph;

int dp[100005];

int make(int id){

    if(dp[id]!=-1)return dp[id];

    int ans = 0;
    for(int i=0;i<graph[id].size();i++){
        ans = max(ans,1+make(graph[id][i]));
    }
    return dp[id] = ans;
}

int main(void){

    int n,m;
    cin >> n >> m;

    graph.assign(n+2,vector<int>());

    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        graph[a].push_back(b);
    }
    int ans = 0;

    memset(dp,-1,sizeof(dp));

    for(int i=1;i<=n;i++){
        ans = max(ans,make(i));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8192
#include<bits/stdc++.h>
#define lint long long
#define st first
#define nd second
#define INF 0x3f3f3f3f

using namespace std;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	string s, t;
	cin>>s>>t;
	int ans = 0;
	for(int i=0;i<(int)s.size();i++)
		if(s[i] != t[i])ans++;
	cout<<ans<<"\n";
	return 0;	
}


Measured memory_bytes: 3808
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<bool> p(100000,1);
  for(int i=2;i<p.size();i++){
    if(!p.at(i))
      continue;
    for(int j=2;i*j<p.size();j++)
      p.at(i*j)=0;
  }
  vector<bool> sp(100000,0);
  for(int i=3;i<p.size();i++)
    sp.at(i)=(p.at(i)&&p.at((i+1)/2));
  vector<int> c(100001,0);
  for(int i=3;i<p.size();i++)
    c.at(i+1)=c.at(i)+(sp.at(i)?1:0);
  int q;
  cin>>q;
  for(int _=0;_<q;_++){
    int l,r;
    cin>>l>>r;
    cout<<c.at(r+1)-c.at(l)<<endl;
  }
}

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

struct mint {
  ll x;
  mint(ll x = 0) : x(((x%mod)+mod)%mod) {}
  bool operator==(const mint a) {return x == a.x;}
  mint operator-() const {return mint(-x);}
  mint& operator+=(const mint a) {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if((x -= a.x) < 0) x += mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if(!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if(t&1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const {return pow(mod-2);}
  mint& operator/=(const mint a) {return (*this) *= a.inv();}
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

vector<mint> lagrange_interpolation(vector<mint> x, vector<mint> y) {
  const ll n = x.size() - 1;
  rep(i,n+1) {
    mint t = 1;
    rep(j,n+1) if(i != j) t *= x[i] - x[j];
    y[i] /= t;
  }
  vector<mint> dp1(n+2), dp2(n+2);
  dp1[0] = 1;
  rep(i,n+1) {
    rep(j,n+2) {
      dp2[j] = dp1[j] * (-x[i]);
      if(j > 0) dp2[j] += dp1[j-1];
    }
    swap(dp1,dp2);
  }
  vector<mint> poly(n+1);
  rep(i,n+1) {
    mint val = dp1[n+1];
    for(int j = n; j >= 0; j--) {
      poly[j] += val * y[i];
      val = dp1[j] + val * x[i];
    }
  }
  return poly;
}

int main() {
  cin >> mod;
  vector<mint> x(mod), y(mod);
  rep(i,mod) x[i] = mint(i);
  rep(i,mod) cin >> y[i].x;
  vector<mint> ans = lagrange_interpolation(x,y);
  for(mint v : ans) cout << v.x << " ";
  cout << endl;
  return 0;
}

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

signed main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int n; cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  map<int, int> m;
  for (int i = 0; i < n; i += 2) m[a[i]]++;
  sort(a, a + n);
  for (int i = 0; i < n; i += 2) m[a[i]]++;
  cout << m.size() - (n + 1) / 2 << "\n"; 
  return 0;
}

Measured memory_bytes: 5376
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, W;
    cin >> n >> W;

    vl weight(n), value(n);
    rep(i, n) {
        cin >> weight[i] >> value[i];
    }

    const ll MAX_VALUE = 100010;

    vvl dp(n+1, vl(MAX_VALUE, INF));  // dp[i+1][j] : i番目までの品物で価値の総和がjのときの重さの総和の最小値
    dp[0][0] = 0;
    rep(i, n) {
        rep(j, MAX_VALUE) {
            chmin(dp[i+1][j], dp[i][j]);
            if(j >= value[i]) {
                chmin(dp[i+1][j], dp[i][j - value[i]] + weight[i]);
            }
        }
    }

    ll ans = 0;
    rep(j, MAX_VALUE) {
        if(dp[n][j] <= W) {
            ans = j;
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 80256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	int N;
	while(~scanf("%d", &N)) {
		string X;
		cin >> X;
		int D;
		scanf("%d", &D);
		string ans;
		rep(i, N) {
			if(N - i == D || (D > 0 && X[i] == '0'))
				ans += char(X[i] ^ 1), -- D;
			else
				ans += X[i];
		}
		puts(ans.c_str());
	}
	return 0;
}

Measured memory_bytes: 1204
#include <stdio.h>
 
int main(void) {
	long long num, year, x;
	scanf("%lld", &x);
	num = 100;
	year = 0;
	while (num < x)
	{
		num = num *1.01;
		year++;
	}
	printf("%d", year);
 
	return 0;
}

Measured memory_bytes: 1704
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <set>
#include <map>

std::multiset<int, std::greater<int>> list;
int N;

int main(){
  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    int tmp;
    scanf(" %d", &tmp);
    list.insert(tmp);
  }
  int count = 0;
  for(auto it = list.begin(); it != list.end();) {
    int v = *it;
    it = list.erase(it);
    int corresp = v ^ 
      (
      ((1 << (32 - __builtin_clz(v))) - 1) & 
      ~((1 << (__builtin_ctz(v) + 1)) - 1)
    );
    //printf("%d -> %d %d\n", v, corresp, list.size());
    auto fit = list.find(corresp);
    if(fit != list.end()) {
      if(it == fit) it = list.erase(fit); 
      else list.erase(fit);
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 9600
import sys
def input(): return sys.stdin.readline().rstrip()
 
 
def main():
    a,b,n=map(int, input().split())
    if b<=n:
        n=b-1
    print(((a*n)//b) - (a*(n//b)))
    

    
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 9016
#include<stdio.h>
main()
{
	for(;;){
		int i,n,m,hito = 0,temp;
		int me[1000];
		int ban[1000];
		
		scanf("%d%d",&n,&m);
		if(n == 0){break;}
		for(i = 0; i < n; i++){
			scanf("%d",&ban[i]);
		}
		for(i = 0; i < m; i++){
			scanf("%d",&me[i]);
		}
		
		for(i = 0; i < m; i++)
		{
			hito += me[i];
			if(hito >= n){
				i++;
				break;
			}
			temp = hito;
			hito += ban[temp];
			if(hito >= n){
				i++;
				break;
			}
		}
		printf("%d\n",i);
	}
}

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

int main(){
	int n,number;
	long long a,b;
	bool flag;
	map<int,long long> info;
	vector<int> seq;
	
	while(cin >> n && n){
		info.clear();
		seq.clear();
		while(n--){
			cin >> number >> a >> b;
			if(!info[number])seq.push_back(number);
			info[number] += a*b;
		}
		flag = true;
		for(int i=0;i<seq.size();i++){
			if(info[seq[i]]>=1000000){
				flag = false;
				cout << seq[i] << endl;
			}
		}
		if(flag)cout << "NA" << endl;
	}
}

Measured memory_bytes: 0
M = [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]
K = int(input())
print(M[K-1])



Measured memory_bytes: 2940
// B - Greedy Takahashi
#include <bits/stdc++.h>
using namespace std;

int main(){
	long long A,B,K; cin>>A>>B>>K;
	if(B+A<=K) B = A = 0;
	else if(A <= K){ B += A-K; A = 0; }
	else A -= K;
	cout<<A<<" "<<B<<endl;
}

Measured memory_bytes: 256
S = str(input())
S= list(S)
switch = 0  
for i in range(len(S)):
    S[i] = int(S[i])
count_0 = 0
count_1 = 0
for i in range(len(S)):
    if S[i] == 0:
        count_0 = count_0 + 1
    else:
        count_1 = count_1 + 1
        
if count_0 > count_1:
    count = count_1
else:
    count = count_0
    
result = 2 * count
print(result)

Measured memory_bytes: 3956
N=int(input())
X=list(map(int,input().split()))
ans=[]
for i in range(max(X)+1):
    goukei = 0
    for j in range(N):
        if i%1==0:
            goukei+=(X[j]-i)**2
    ans.append(goukei)
kotae=set(ans)
print(min(kotae))

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;

int main(){
    int n, m;
    cin >> n >> m;
    out((n-1)*(m-1));

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int t=a+b+c;
	if ((t==2*a+c||t==2*a+b||t==2*b+a)&&!((a==b)&&(b==c))) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0; 
}

Measured memory_bytes: 256
#include<stdio.h>

int n, A[50];

int solve(int i, int M)
{
   if (M==0)
      return 1;
   if (i>=n)
      return 0;
   int res = solve(i+1, M) || solve(i+1, M-A[i]);
   return res;
}

int main()
{
   int i, q, m;

   scanf("%d", &n);
   for (i=0; i<n; i++)
    scanf("%d", &A[i]);

   scanf("%d", &q);
   for (i=0; i<q; i++){
      scanf("%d", &m);
      if (solve(0, m))
         puts("yes");
      else
         puts("no");
   }

   return 0;
}

Measured memory_bytes: 1796
package main

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

func main() {
	sc := NewScanner()
	N, A, B := sc.NextInt(), sc.NextInt(), sc.NextInt()

	k := N % (A + B)
	ans := N / (A + B) * A
	if k < A {
		ans += k
	} else {
		ans += A
	}
	fmt.Println(ans)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
using P = pair<int, int>;

int main()
{
  ll N,K,Q;cin>>N>>K>>Q;
  vector<int> A(Q);
  for (int i=0;i<Q;i++)
  {
    cin>>A[i];
    A[i]--;
  }
  
  vector<int> p(N,K);
  for (int i=0;i<Q;i++)
  {
     p[A[i]]++;
  }
  
  for (int i=0;i<N;i++)
  {
    if (p[i]-Q<=0) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
}

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

using namespace std;

#define int long long

main()
{
    ios_base::sync_with_stdio(false);
    int c[255] = {};
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        c[s.front()]++;
    }
    int order[] = {'M', 'A', 'R', 'C', 'H'};
    int an = 0;
    for(int i = 0; i < 5; i++){
        for(int j = i + 1; j < 5; j++){
            for(int k = j + 1; k < 5; k++){
                an += c[order[i]] * c[order[j]] * c[order[k]];
            }
        }
    }
    cout << an << endl;
}


Measured memory_bytes: 256
n = int(input())
word_list = [input() for i in range(n)]

if len(word_list) != len(set(word_list)):
    print("No")
    exit()

for i in range(len(word_list) - 1):
    if word_list[i][-1] != word_list[i+1][0]:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 2940
#include <bits/stdc++.h> 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<long, long> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const LL MOD=1e9+7;

int main(){
    int N,K;cin>>N>>K;
    string S;cin>>S;
    if(S[K-1]=='A')S[K-1]='a';
    else if(S[K-1]=='B')S[K-1]='b';
    else if(S[K-1]=='C')S[K-1]='c';
    cout<<S<<endl;
    return 0;
}

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

int main()
{
    int N, K, T, U, V, L;
    std::cin >> N >> K >> T >> U >> V >> L;
    std::vector<long double> D(N);
    for (auto& e: D) std::cin >> e;
    D.push_back(L);
    for (int i{N}; i > 0; i--)
        D[i] -= D[i - 1];
    
    long double rest{}, time{};
    for (int i{}; i <= N; i++)
    {
        if (rest * V <= D[i])
        {
            time += rest + (D[i] - rest * V) / U;
            rest = 0;
        }
        else
        {
            time += D[i] / V;
            rest -= D[i] / V;
        }
        rest = std::min(rest + T, (long double)T * (K + 1));
    }
    printf("%.10Lf\n", time);

    return 0;
}


Measured memory_bytes: 3360
#![allow(non_snake_case,unused_imports,dead_code)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();
    let N = buf_it.next().unwrap().parse::<usize>().unwrap();
    let C = (0..N).map(|_| buf_it.next().unwrap().parse::<usize>().unwrap()).collect::<Vec<_>>();

    let MOD = 1_000_000_007;
    let mut ans = ModInt::new(1,MOD);
    let mut cnt = (0..200010).map(|_| ModInt::new(0,MOD)).collect::<Vec<_>>();
    cnt[C[0]-1] = ModInt::new(1,MOD);
    for i in 1..N{
        if C[i-1]==C[i]{continue;}
        let c = C[i] -1;
        ans = ans + cnt[c];
        cnt[c] = ans.clone();
    }
    println!("{}",ans.n);

}

use std::ops::{Add, Sub, Mul, Div};

#[derive(Copy, Clone)]
struct ModInt{
    n: isize,
    m: isize
}

impl ModInt {
    fn new(n:isize,m:isize) -> ModInt{
        ModInt {n:(n%m+m)%m, m:m}
    }
    fn pow_mod(a:isize,b:isize,m:isize) -> isize{
        if b==0{ return 1;}
        if b%2==1{ return a*ModInt::pow_mod(a,b-1,m)%m}
        ModInt::pow_mod(a*a%m,b/2,m)
    }
    fn inv(self) -> ModInt{
        let n = ModInt::pow_mod(self.n,self.m-2,self.m);
        ModInt::new(n,self.m)
    }
}
impl Add for ModInt{
    type Output = ModInt;
    fn add(self, other:ModInt) -> ModInt
    {
        ModInt::new(self.n+ other.n,self.m)
    }
}
impl Add<isize> for ModInt{
    type Output = ModInt;
    fn add(self, other:isize) -> ModInt
    {
        ModInt::new(self.n+ other,self.m)
    }
}
impl Sub for ModInt{
    type Output = ModInt;
    fn sub(self, other:ModInt) -> ModInt
    {
        ModInt::new(self.n-other.n,self.m)
    }
}
impl Sub<isize> for ModInt{
    type Output = ModInt;
    fn sub(self, other:isize) -> ModInt
    {
        ModInt::new(self.n-other,self.m)
    }
}
impl Mul for ModInt{
    type Output = ModInt;
    fn mul(self, other:ModInt) -> ModInt
    {
        ModInt::new(self.n*other.n,self.m)
    }
}
impl Mul<isize> for ModInt{
    type Output = ModInt;
    fn mul(self, other:isize) -> ModInt
    {
        ModInt::new(self.n*other,self.m)
    }
}
impl Div for ModInt{
    type Output = ModInt;
    fn div(self, other:ModInt) -> ModInt
    {
        other.inv() * self
    }
}
impl Div<isize> for ModInt{
    type Output = ModInt;
    fn div(self, other:isize) -> ModInt
    {
        ModInt::new(other,self.m).inv() * self
    }
}

Measured memory_bytes: 12540
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
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*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll n,k,ans=1;
    cin>>n>>k;
    ans=(1ll*ans)*(1ll*k);
    k-=1;
    for(int i=2;i<=n;i++)
    {    //if(k>0)
        {
          ans=(1ll*ans)*(1ll*k);
          //k--; 
        }
        
    }
    cout<<ans<<endl;

}
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

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


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

    string s;
    cin >> s;
    int zcnt = 0, ocnt = 0;
    int ans;
    
    for( int i = 0; i < s.size(); ++i ) {
        if( s[i] == '0' ) ++zcnt;
        else ++ocnt;

    }

    cout << min( ocnt, zcnt ) * 2 << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
  int a,b;
  int answer[20];
  int count = 0;
  while(cin >> a >> b){
    answer[count] = (int)log10(a+b) +1;
    cout << answer[count] << endl;
  }
  return 0;
}

Measured memory_bytes: 1204