akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<sstream>

using namespace std;

string conv(int a, int b, string str)
{
	string line=str;
	for(int i=0;i<line.length();i++)
	{
		if('a'<=line.at(i)&&line.at(i)<='z')
		{
			line.at(i)-='a';
			for(int y=0;y<26;y++)
			{
				if((a*y+b)%26==line.at(i))
				{
					line.at(i)=y+'a';
					break;
				}
			}
		}
	}
	return line;
}

string solve(string line)
{
	for(int b=0;b<26;b++)
	{
		for(int a=1;a<100;a++)
		{
			if(a%2!=0&&a%13!=0)
			{
				string ans=conv(a,b,line);
				if(ans.find("that")!=string::npos||ans.find("this")!=string::npos)
				{
					return ans;
				}
			}
		}
	}
	return line;
}

int main(void)
{
	int n;
	string line;
	getline(cin,line);
	stringstream ss(line);
	ss>>n;
	for(int i=0;i<n;i++)
	{
		getline(cin,line);
		cout<<solve(line)<<endl;
	}
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;



int main(){
  ll n, T;
  cin >> n >> T;
  vector<ll> t(n);
  rep(i, n) cin >> t[i];
  ll ans = 0;
  for (int i = 1; i < n; i++){
    ll sa = t[i] - t[i-1];
    if (sa >= T) ans += T;
    else ans += sa;
  }
  ans += T;
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
int main()
{
    int h,a,x;
    scanf("%d%d",&h,&a);

    if(h<=a)
        printf("1");
    else if(h>a)
    {

            x=((h+(a-1))/a);
            printf("%d",x);

    }
    return 0;

}


Measured memory_bytes: 128
n,x = map(int, input().split())
A=[int(i) for i in input().split()]
count=0
for i in range(1, n):
    tmp = A[i-1]+A[i]
    if tmp>x: 
        if A[i]-(tmp-x)<0:
                count += tmp-x
                A[i] = 0
        else:
                count += tmp-x
                A[i] -= tmp-x
        # print(count)
# print(A)
print(count)

Measured memory_bytes: 14052
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

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

int main() {
    int A, B; cin >> A >> B;
    if (A < 10 && B < 10) cout << A * B << endl;
    else cout << -1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1000000000000005;
const ll maxn=2e6+5;
const int mod=998244353;
ll n,m,p;
char op[5];
int vis[maxn],pos[maxn];
ll save[maxn];
int main()
{
    ll ans=0,res=0;
    scanf("%lld%lld",&n,&m);
    for(int i=1;i<=m;i++)
    {
        ll x;
        scanf("%lld%s",&x,op);
        if(op[0]=='A')
        {
            if(pos[x]==0)
            {
                res+=vis[x];//该题罚时
                ans++;//答案
                pos[x]=1;
            }
        }
        else
        {
            if(pos[x]==0) vis[x]++;
        }
    }
    printf("%lld %lld\n",ans,res);
    return 0;
}
/**
***/


Measured memory_bytes: 4352
#include<cstdio>
#include<iostream>
using namespace std;
int a[31];
int main()
{
	int i,j,n,x=0,y=0;
	for(i=1;i<=28;i++)
	{
		cin>>n;
		a[n]=1;
	}
	for(i=1;i<=30;i++)
	{
		if(a[i]!=1&&x==0)
		{
			x=i;
			a[i]=1;
		}
		else if(a[i]!=1&&y==0)
		{
			y=i;
			break;
		}
	}
	cout<<x<<endl<<y<<endl;
	return 0;
}

Measured memory_bytes: 3076
#include <cassert>
#include <limits>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " <<"LINE:"<<__LINE__<<"  "<< #i <<":"<< i << std::endl

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<ll, ll>;

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

  std::vector<std::vector<ll>> pow_t(410,std::vector<ll>(410,1)),powsum(410,std::vector<ll>(410,0));

  rep(i,1,410){
    rep(j,1,410){
      pow_t[i][j]=(pow_t[i-1][j]*j)%MOD;
    }
  }

  rep(i,0,410){
    rep(j,1,410){
      powsum[i][j]=(powsum[i][j-1]+pow_t[i][j])%MOD;
    }
  }

  ll n,c;
  std::cin>>n>>c;

  std::vector<ll> a(n),b(n);
  rep(i,0,n)std::cin>>a[i];
  rep(i,0,n)std::cin>>b[i];

  std::vector<std::vector<ll>> dp(n+1,std::vector<ll>(410,0));

  dp[0][0]=1;

  rep(i,1,n+1){
    rep(j,0,410){
      ll sum=0;
      rep(k,0,j+1){
        sum=(sum+(dp[i-1][j-k]*(powsum[k][b[i-1]]-powsum[k][a[i-1]-1]+MOD)%MOD)%MOD)%MOD;
      }
      dp[i][j]=sum;
    }
  }

  std::cout<<dp[n][c]<<"\n";

  return 0;
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  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 += mod - a.x) >= mod)
      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++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  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;
  }
};

int main()
{
  string s; cin >> s;
  int n = s.size();
  vector<int> ans(n, 0);
  int even = 0, odd = 0;
  rep(i, n-1) {
    if(s[i] == 'R') {
      if(i%2==0) ++even;
      else ++odd;
    }
    if(s[i] == 'R' && s[i+1] == 'L') {
      if(i%2==0) {
        ans[i] += even;
        ans[i+1] += odd;
      }
      else {
        ans[i] += odd;
        ans[i+1] += even;
      }
      even = odd = 0;
    }
  }
  even = odd = 0;
  for(int i = n-1; i > 0; --i) {
    if(s[i] == 'L') {
      if(i%2==0) ++even;
      else ++odd;
    }

    if(s[i] == 'L' && s[i-1] == 'R') {
      if(i%2==0) {
        ans[i] += even;
        ans[i-1] += odd;
      }
      else {
        ans[i] += odd;
        ans[i-1] += even;
      }
      even = odd = 0;
    }
  }
  line_out(ans);
}

Measured memory_bytes: 4316
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#define massert(x) assert(x)
#else
#define debug(args...) // Just strip off all debug tokens
#define massert(x)
#endif
struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
LL ans;
pair<int,int> f[20][200001];
void init(vector<LL>& a)
{
	for(size_t i=0; i<a.size(); ++i) {
		f[0][i]={a[i],i};
	}
	for(int i=1; i<20; ++i) {
		for(size_t j=0; j+(1<<(i-1))<a.size(); ++j) {
			f[i][j]=min(f[i-1][j],f[i-1][j+(1<<(i-1))]);
		}
	}
}
auto min_element(vector<LL> &a,vector<LL>::iterator l,vector<LL>::iterator r) ->decltype(a.begin())
{
	int L=l-a.begin(),R=r-a.begin()-1;
	int k=log(R-L+1)/log(2);
	return a.begin()+min(f[k][L],f[k][R-(1<<(k))+1]).second;
}
void  dfs(vector<LL>& a,vector<LL>::iterator l,vector<LL>::iterator r)
{
	if (l==r) return;
	auto p=min_element(a,l,r);
	ans+=(p-l+1)*(r-p)*(*p);
	if (p!=l) dfs(a,l,p);
	if (p+1!=r) dfs(a,p+1,r);
}
void solve(long long N, vector<long long> a){
	init(a);
	dfs(a,a.begin(),a.end());	
	cout<<ans<<endl;
}

int main(){	
#ifdef WAAUTOMATON
	freopen("./in_B_3.txt","r",stdin);
#endif
	long long N;
	scanf("%lld",&N);
	vector<long long> a(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
	}
	solve(N, a);
	return 0;
}



Measured memory_bytes: 43776
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y,w,h,t;
  cin>>t;
  while(t--){
    int n,a,b,ans=0;
    cin>>x>>y>>w>>h>>n;
    for(int i=0;i<n;i++){
      cin>>a>>b;
      if(x<=a&&a<=x+w&&y<=b&&b<=y+h)ans++;
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3036
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;

int main() {
	//入力
	string sx, sy;
	cin >> sx >> sy;

	//処理
	int n = sx.size(), m = sy.size();

	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if (sx[i] > sx[j]) {
				int tmp = sx[i];
				sx[i] = sx[j];
				sx[j] = tmp;
			}
		}
	}
	for (int i = 0; i < m - 1; i++) {
		for (int j = i + 1; j < m; j++) {
			if (sy[i] < sy[j]) {
				int tmp = sy[i];
				sy[i] = sy[j];
				sy[j] = tmp;
			}
		}
	}

	//計算、出力
	int a = 0;
	for (int i = 0; i < min(n, m); i++) {
		if (sx[i] > sy[i]) {
			cout << "No" << endl;
			break;
		}
		if (sx[i] < sy[i]) {
			cout << "Yes" << endl;
			break;
		}

		a++;
	}
	if (a == min(n, m)) {
		if (n < m)cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def pop_count(i):
    i = i - ((i >> 1) & 0x55555555)
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
    i = (i + (i >> 4)) & 0x0f0f0f0f
    i = i + (i >> 8)
    i = i + (i >> 16)
    return i & 0x3f

N = INT()
cards = [[]] * 2
cards[0] = LIST()
cards[1] = LIST()

ans = INF
for S in range(1<<N):
    # 無理なケース(奇数枚裏返す)を除外
    if pop_count(S) % 2 != 0:
        continue
    # 奇数位置と偶数位置で分けて保持する
    A1 = [[] for i in range(2)]
    for i in range(N):
        # カードiを青くする
        if S & 1<<i:
            A1[(i%2)^1].append((cards[1][i], i))
        # 赤のまま
        else:
            A1[i%2].append((cards[0][i], i))
    # 無理なケース(置きたい偶奇位置の数がおかしい)を除外
    if len(A1[0]) != ceil(N, 2) or len(A1[1]) != N // 2:
        continue
    # 偶奇が同じ位置同士は自由に動けるのでソートする
    A1[0].sort(reverse=1)
    A1[1].sort(reverse=1)
    cnt = 0
    A2 = [0] * N
    idxs = [0] * N
    for i in range(N):
        # 偶奇位置を交互に取り出す
        A2[i], idxs[i] = A1[i%2].pop()
    # ソート済と一致すればOK
    if A2 == sorted(A2):
        # 移動距離を転倒数数え上げで求める(Nが小さいのでN^2かけて大丈夫)
        cnt = 0
        for i, idx1 in enumerate(idxs):
            for j, idx2 in enumerate(idxs[i+1:], i+1):
                if idx1 > idx2:
                    cnt += 1
        ans = min(ans, cnt)
if ans == INF:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 49792
#include <iostream>
using namespace std;
int main(void){

    long long input_num,ans=0;

    cin >> input_num;
    
    for(int i =1 ; i <= input_num; i++){
        for(int j =1; i*j<=input_num; j++){

            if(input_num/(i*j) !=0 && input_num != i*j) ans= ans +1;
            //if(i*j==1) ans= ans +1;
        }
    }

    cout << ans << endl;
}

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

typedef vector<int> vi;
const vi nums = {9, 900, 90000};

int main()
{
	string n;
	int res = 0, s, num;
	cin >> n;
	s = n.size();
	num = stoi(n);
	if (s == 1) res += (num - 1) + 1;
	if (s > 1) res += nums[0];
	if (s == 3) res += (num - 100) + 1;
	if (s > 3) res += nums[1];
	if (s == 5) res += (num - 10000) + 1;
	if (s > 5) res += nums[2];
	cout << res << endl;
	return 0;
}

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

#define what_is(x) cout << #x << " is " << x << endl;
#define PI acos(-1)
#define hell 1000000007
#define HELL 998244353
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define mset(a,n) memset(a,n,sizeof a)
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define renn(i,a,b,p) for(__typeof((a) i=(a);i>=(b);i-=p)
#define ADD(a,b,c) ((a)%c+(b)%c)%c
#define SUB(a,b,c) ((a)%c-(b)%c+c)%c
#define MUL(a,b,c) (((a)%c)*((b)%c))%c
#define lbd lower_bound
#define ubd upper_bound
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
// #define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define bug(n) {outl(n);return;}
#define pii pair<int,int>
#define lim 9223372036854775805
#define ninf -9223372036854775802
#define M 1000000007
#define eps 1e-9
#define MAX 10
#define N 500001
#define db(a) for(auto it:a) {cout<<it<<" ";}cout<<endl;
ll prime[MAX];
ll fact[MAX];

const long long INF64 = 1e18;
ll vpow(ll a,ll b,ll p){
    if(b==0)
        return 1;
    if(b==1)
            return a;
    ll temp=vpow(a,b/2,p);
    temp*=temp;
    temp%=p;
    if(b%2==0)
        return temp;
    temp=temp*a;
    temp%=p;
    return temp;
}

ll gcd(ll a,ll b){
     if(a==0)
         return b;
     return gcd(b%a,a);
 }


ll inverseMod(ll a,ll b,ll p){
    if(b==0)
        return 1;
    ll temp=vpow(b,p-2,p);
    ll ans=temp*a;
    ans%=p;
    return ans;
}
void sieve()
{
    prime[0] = prime[1] = 1;
    for (ll i = 2; i < MAX; i++) {
        if (prime[i] == 0) {
            for (int j = i * 2; j < MAX; j += i) {
                if (prime[j] == 0) {
                    prime[j] = i;
                }
            }
            prime[i] = i;
        }
    }
}
ll max(ll a, ll b)
{
    return a>b?a:b;
}

void factorial(){
    fact[0]=1;
    fact[1]=1;
    rep(i,2,MAX){
        fact[i]=(fact[i-1]*i);
        // fact[i]%=M;
    }
}
ll rand(ll a,ll b){
    return a+rand()%(b-a+1);
}

void solve(ll ttt)
{
    ll x;
    cin>>x;
    if(x)
        cout<<0<<endl;
    else
        cout<<1<<endl;

}

int main(){
    io;
    // sieve();
    // factorial();
#ifndef ONLINE_JUDGE
    //
    //freopen("input1.txt","r",stdin);
    // freopen("output1.txt","w",stdout);
#endif
    ll t=1;
     //cin>>t;
    fix(12);
    rep(q,1,t+1){
         //cout<<"Case #"<<q<<": ";
         //cout<<"Test Case : "<<q<<endl;
         solve(q);
    }
    return 0;

}




Measured memory_bytes: 3652
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <vector>
#define ll long long
#define ALL(a)  (a).begin(),(a).end()

#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define FOR(i,m,n) for(int (i)=(m);(i)<(n); i++)
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------

int main(void){
	ll H;cin>>H;
	ll c=(pow( 2, int(log2(H))+1 )-1);
	string out;
	out=to_string(c);
	cout<<out;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define X first
#define Y second
#define mp make_pair
using namespace std;
typedef long long ll;
const int N = 100010;
const int M = 20000;
int sx,sy;
char s[N];
int a[N],tot;
bitset<M> B;
int main(){
	scanf("%s",s);
	scanf("%d%d",&sx,&sy);
	int len = strlen(s);
	int cnt =0;
	for(int i =0;i<len;i++){
		if(s[i]=='F') cnt++;
		else {
			a[++tot] = cnt;
			cnt = 0;
		}
	}
	a[++tot] = cnt;
	//for(int i = 1;i<=tot;i++) cout<<a[i]<<' ';cout<<endl;
	bool pd  = true;
	B.set(M/2);
	for(int i = 1;i<=tot;i+=2){
		if(i!=1)
		B = (B>>a[i])|(B<<a[i]);
		else B = B<<a[i];
	}
	if(B[M/2+sx]==0) pd =false;
	B.reset();
	B.set(M/2);
	for(int i =2;i<=tot;i+=2){
		B = (B>>a[i])|(B<<a[i]);
	}
	if(B[M/2+sy]==0) pd =false;
	if(pd){
		puts("Yes");
	} else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define FOR(i, N) for (long i = 0; i < (N); i++)

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

    vector<pair<int, int>> P(N);
    int a_i;

    FOR(i, N) {
        cin >> a_i;
        P[i].first = a_i;
        P[i].second = i + 1;
    }

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

    FOR(i, N) {
        cout << P[i].second << " ";
    }

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n;
    cin>>n;
    ll ans= n*2/__gcd(n,2LL);
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
#include<stdio.h>
void Countingsort(int);
int n,C[2000001],A[2000001],B[2000001];
int main(){
  int i,j,max=0;
  
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
    if(max < A[i])
      max=A[i];
  }
  
  
  
  Countingsort(max);
  for(i=1; i<=n; i++){
    printf("%d",B[i]);
    if((i>0) && (i<n))
      printf(" ");
  }
  printf("\n");
  
  
  
  
  
  return 0;
}




void Countingsort(int k){
  int i,j;
  
  
  for(i=0; i <= k; i++){
    C[i] = 0;
  }
  for(j=1; j <= n; j++){
    C[A[j]] = C[A[j]] + 1;
  }
  for(i=1; i <= k; i++){
    C[i] = C[i] + C[i-1];
  }
  for(j=n; j >= 1; j--){
    B[C[A[j]]] = A[j];
    C[A[j]] = C[A[j]]-1;
  }
}

Measured memory_bytes: 17896
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N,T; cin >> N >> T;
    ll ans=0; int t[N];
    rep(i,N){
        cin >> t[i];
    }
    rep(i,N){
        if(i==0);
        else if(t[i]-t[i-1]<T){
            ans+=t[i]-t[i-1];
        }
        else ans+=T;
    }
    cout << ans + T << endl;

    return 0;
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 int main(){
ll L, R;
cin >> L >> R;

if(R - L >= 2019){
  cout << 0 << endl;
  return 0;
}
int ans = 10000;
for(ll i = L; i < R; i++){
  for(ll j = i + 1; j <= R; j++){ 
   int sum = (i * j) % 2019; 
  ans = min(ans, sum);

}
}
print(ans);

 }


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>
#include<numeric>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define SUM(a) accumulate(all(a),0LL)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok, flag;
ll dx[5] = { 1,-1,0,0,0 }, dy[5] = { 0,0,1,-1,0 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 1111111

ll grid[1111][1111];
ll a[MAX], b[MAX], c[MAX], d[MAX];

int main(void) {
  ll h, w;
  cin >> h >> w;
  FOR(i, 1, h + 1) FOR(j, 1, w + 1) scan(grid[i][j]);
  FOR(i, 1, h + 1) {
	if (i % 2 == 1) FOR(j, 1, w + 1) {
	  if (grid[i][j] % 2 != 0) {
		if (j != w) {
		  a[cnt] = i; b[cnt] = j; c[cnt] = i; d[cnt] = j + 1;
		  cnt++;
		  grid[i][j + 1] ++;
		}
		else if (i != h) {
		  a[cnt] = i; b[cnt] = j; c[cnt] = i + 1; d[cnt] = j;
		  cnt++;
		  grid[i + 1][j]++;
		}
	  }
	}
	else RFOR(j, 1, w + 1) {
	  if (grid[i][j] % 2 != 0) {
		if (j != 1) {
		  a[cnt] = i; b[cnt] = j; c[cnt] = i; d[cnt] = j - 1;
		  cnt++;
		  grid[i][j - 1]++;
		}
		else if (i != h) {
		  a[cnt] = i; b[cnt] = j; c[cnt] = i + 1; d[cnt] = j;
		  cnt++;
		  grid[i + 1][j]++;
		}
	  }
	}

  }

  cout << cnt << endl;
  rep(i, cnt) cout << a[i] << " " << b[i] << " " << c[i] << " " << d[i] << endl;

  return 0;
}

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

int main() {
  string s;
  string ans1 = "No";
  string ans2 = "No";
  cin >> s;
  int siz1 = s.size();
  int siz2 = siz1 / 2;
  for (int i = 0; i < siz2; i++) {
    if (s.at(i) == s.at(siz2 - i - 1) && s.at(i + siz2 + 1)
     == s.at(siz1 - i - 1)) {
      ans1 = "Yes";
    }
    else ans1 = "No";
  }
  for (int i = 0; i < siz1; i++) {
    if (s.at(i) == s.at(siz1 - i - 1)) {
      ans2 = "Yes";
    }
    else {
      ans2 = "No";
      break;
    }
  }
  if(ans1 == "Yes" && ans2 == "Yes"){
  cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}


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

using namespace std;

int main(void){
	int a, b;
	string s;

	cin >> a >> b >> s;

	if (s[a] == '-'){
		int num = 0;
		for (int i = 0; i < s.size(); i++){
			if (s[i] >= '0' && s[i] <= '9')
				num++;
		}
		if (num == s.size()-1)
			cout << "Yes";
		else
			cout << "No";
	}
	else	
		cout << "No";

	cout << endl;

	return 0;
}

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

int main(void){
    int n = 0;
    int l[11];
    int max = 0;
    int max_num = 0;
    int sum = 0;

    scanf("%d", &n);

    for(int i = 0; i < n; i++){
        scanf("%d", &l[i]);
        if(max < l[i]){
            max = l[i];
            max_num = i;
        }
    }

    for(int i = 0; i < n; i++){
        if(i != max_num){
            sum += l[i];
        }
    }
    //printf("max_num = %d sum = %d\n", max_num, sum);

    if(sum > max){
        printf("Yes\n");
    }else{
        printf("No\n");
    }


    return 0;

} 


Measured memory_bytes: 256
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var n = next(), m = next();
  var c = nextm(m,2);
  var i = 0, x = 10;
  if(n > 1)i = Math.pow(10,n-1), x = i*10;
  for(; i < x; i++){
    var f = 1, s = String(i);
    for(var j = 0; j < m; j++){
      if(s[c[j][0]-1] == c[j][1])continue;
      f = 0;
    }
    if(f)return i;
  }
  return -1;
}

Measured memory_bytes: 9420
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int tw = 0;
        int fo = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] % 4 == 0) {
                fo++;
            } else if (a[i] % 2 == 0) {
                tw++;
            }
        }
        int ki = n - tw - fo;
        boolean ans = false;
        if (fo == n / 2) {
            ans = true;
        } else if (fo >= ki) {
            ans = true;
        }
        if (ans) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 50464
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long N;
    cin >> N;

    long long power = 1;
    for (long long i = 1; i <= N; i++){
        power = power * i % 1000000007;
    }
    cout << power % 1000000007 << endl;

}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) 
	{
		int n = sc.nextInt();
		int[][]arr = new int[n][2];
		for(int i=0;i<n;i++)
		{
			arr[i][0] = sc.nextInt();
			arr[i][1] = sc.nextInt();
		}
		boolean flag = false;
		for(int i=0;i<n-2;i++)
		{
			if((arr[i][0]==arr[i][1]) && (arr[i+1][0]==arr[i+1][1]) && (arr[i+2][0]==arr[i+2][1]))
			{
				flag = true;
				break;
			}
		}
		if(flag)
			System.out.println("Yes");
		else
			System.out.println("No");

	}

}


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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type Definitions:
typedef long long ll;
typedef unsigned long long ull;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);

//================ Main Loop ================
int main() {
    int h, n;
    cin >> h >> n;
    int bf;
    rep(i, n) {
        cin >> bf;
        h -= bf;
        if(h <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}
//===========================================

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> c(2*h, vector<char>(w));
    rep(i, h)rep(j, w){
        cin >> c[i*2][j];
    }

    for(int i=1; i<2*h; i += 2){
        rep(j, w){
            c[i][j] = c[i-1][j];
        }
    }

    rep(i, 2*h)rep(j, w){
        cout << c[i][j];
        if(j==w-1) cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author kessido
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AColorfulSlimes2 solver = new AColorfulSlimes2();
        solver.solve(1, in, out);
        out.close();
    }

    static class AColorfulSlimes2 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.NextInt();
            int[] a = in.NextIntArray(n);
            int res = 0;
            for (int i = 1; i < n; i++) {
                if (a[i] == a[i - 1]) {
                    a[i] = -1;
                    res++;
                }
            }
            out.println(res);
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine(), " \t\n\r\f,");
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int NextInt() {
            return Integer.parseInt(next());
        }

        public int[] NextIntArray(int n) {
            return NextIntArray(n, 0);
        }

        public int[] NextIntArray(int n, int offset) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = NextInt() + offset;
            }
            return a;
        }

    }
}



Measured memory_bytes: 21332
package main

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

func main() {
	sc := NewScanner()

	n := sc.NextInt()
	y := sc.NextInt()

	for i := 0; i <= 2000; i++ {
		for j := 0; j <= 2000; j++ {
			if n-(i+j) < 0 {
				continue
			}
			if y == 10000*i+5000*j+1000*(n-(i+j)) {
				fmt.Printf("%v %v %v\n", i, j, n-(i+j)) // output for debug
				return
			}
		}
	}
	fmt.Printf("%v %v %v\n", -1, -1, -1) // output for debug
}

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) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	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
N = int(input())
A = list(map(int, input().split()))

counts = [0] * (N+1)

for i in range(1, N+1):
    counts[A[i-1]] += 1

sum_ = 0
for k in range(1, N+1):
    sum_ += counts[k] * (counts[k]-1) // 2

for k in range(1, N+1):
    # A[k]を抜くことで減る組み合わせを引く
    print(sum_ - (counts[A[k-1]] - 1))

 

Measured memory_bytes: 26408
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<unordered_map>
#define deg(x) cout<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e18;
const ll inf=1e18;
const double eps=1e-8;
const double pi=acos(-1);



int main(){
    TB
    int n;
    string s;
    cin>>s;
    int flag=0;
    fdd(1,s.length()){
        if(s[i]!=s[0]) flag++;
    }
    if(flag) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


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

typedef long long ll;

#define PB push_back
#define MP make_pair

string ans = "";

void solve(ll n) {
    if (n <= 26) {
        ans += char(n + 96);
        return;
    }
    int c = 0;
    ll tmp = 0;
    while (tmp < n) {
        ++c;
        tmp += pow(26, c);
    }
    c--;
    ll x = n;
    for (int i = 1; i <= c; ++i) x -= pow(26, i);
    x = ceil((double)x / pow(26, c));
    ans += (char)(x + 96);
    solve(n - x * pow(26, c));
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    ll n; cin >> n;
    solve(n);
    cout << ans << "\n";
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* print new lines
*/

Measured memory_bytes: 4072
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int N, K;
vector<int> X(101, 0);

int main(void){
    
    scanf("%d %d", &N, &K);
    int ans = 0;
    for(int i = 0; i < N; ++i){
        int x; scanf("%d", &x);
        ans += 2 * min(abs(x - 0), abs(K - x));
    }
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int unify(string s, char c) {
	int cnt = 0;
	string t;
	while (!all_of(s.begin(), s.end(), [&s](char c) { return c == s[0]; })) {
		t = s;
		for (int i = 0; i < s.size() - 1; i++) if (s[i] == c || s[i + 1] == c) t[i] = c;
		s = t;
		s.pop_back();
		cnt++;
	}
	return cnt;
}
int main() {
	string s;
	cin >> s;
	int ans = 100;
	for (char c : s) {
		int t = unify(s, c);
		if (t < ans) ans = t;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <math.h>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#include <ctime>
#include <deque>
#include <unordered_map>
#include <map>
#include <random>
#include <cstdio>
#include <string>
#include <cctype>
#define int long long
#define pb push_back
#define eb emplace_back
#define rs resize
#define ld long double
#define vi vector<int>


using namespace std;

const double PI = atan2(0, -1);

void solve() {
    int n;
    cin >> n;
    vi cnt(n);
    for (int i = 0; i < n - 1; i++) {
        int x; cin >> x;
        cnt[x - 1]++;
    }
    for (auto u : cnt) {
        cout << u << "\n";
    }
}


signed main() {
    ///  freopen("salesman.in", "r", stdin);
   //   freopen("salesman.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed;
    cout.precision(30);
    int t = 1;
    while(t--)
    solve();
    //   system("pause");
}

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

int n, a, b, c, aa, bb, cc, ta, tb, tc;

int main() {
	cin>>n;
	while (n--) {
		cin>>a>>b>>c;
		ta = max(bb,cc)+a;
		tb = max(aa,cc)+b;
		tc = max(aa,bb)+c;
		aa=ta,bb=tb,cc=tc;
	}
	cout<<max(aa,max(bb,cc))<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if a%3 == 0 || b%3 == 0 || (a+b)%3 == 0 {
		fmt.Println("Possible")
		return
	}
	fmt.Println("Impossible")
}


Measured memory_bytes: 512
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 2000
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


s=int(input())
n=s//3
ans=0
for i in range(n):
    s2=s-2*i-3
    ans+=cmb(s2,i,p)
    ans%=p
print(ans%p)


Measured memory_bytes: 65420
import Control.Monad
import Data.Ratio

main :: IO ()
main = do
    n <- readLn
    ratios <- replicateM n getRatio
    print $ minVotes ratios

getRatio :: IO (Int, Int)
getRatio = tuple . map read . words <$> getLine
  where
    tuple [x,y] = (x,y)

minVotes :: [(Int, Int)] -> Int
minVotes = sumVotes . minFinalVotes
  where
    sumVotes (a,b) = a+b

minFinalVotes :: [(Int, Int)] -> (Int, Int)
minFinalVotes = foldl1 f
  where
    f acc (x,y) = let n = coef acc (x,y) in (n*x, n*y)
    coef (a,b) (x,y) = max (ceiling $ a%x) (ceiling $ b%y)

Measured memory_bytes: 2300
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	long long a, b = 1, e;
	cin >> a;
	for (long long h = 1; h <= a; h++) {
		b = b * h;
		b = b % 1000000007;
	}
	cout << b << "\n";
	cin >> e;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

    int minc = 1001;
    for (int i=0; i < N; i++){
        int c, t;
        cin >> c >> t;
        if (t <= T && c < minc){
            minc = c;
        }
    }

    if (minc == 1001){
        cout << "TLE" << endl;
    } else {
        cout << minc << endl;
    }

    return 0;
}

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

vector<int> pass[2005]; //         // dis[i] : startからiまでの距離

int main(){
    int n ;
    cin >> n ;
    int a = 0 ;
    map<string,int> mp ;
    rep(i,n){
        string s ;
        cin >> s ;
        mp[s]++ ;
    }
    for(auto p :mp){
        a++ ;
    }
    cout << a << endl;
}

Measured memory_bytes: 19248
#include <bits/stdc++.h>  // ver1.9.5
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define Pii pair<int,int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a[a.size()-1]<<endl
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

signed main() {
  cout << fixed << setprecision(8);
  Vi a(3);
  cin >> a[0] >> a[1] >> a[2];
  if(a[0]%2==1||a[1]%2==1||a[2]%2==1) {cout<<0<<endl;return 0;}
  if(a[0]==a[1] && a[1]==a[2]){cout<<-1<<endl;return 0;}
  sort(ALL(a));
  int n,m,l;
  n = a[2]-a[1];
  m = a[1]-a[0];
  l = a[2]-a[0];
  int ans1=0,ans2=0,ans3=0;
  
  while(n%2==0){
    if(n==0){ans1=INF;break;}
    ans1++;
    n /= 2;
  }
  while(m%2==0){
    if(m==0){ans2=INF;break;}
    ans2++;
    m /= 2;
  }
  while(l%2==0){
    if(l==0){ans3=INF;break;}
    ans3++;
    l /= 2;
  }
  
  cout << min({ans1,ans2,ans3}) << endl;
  
  return 0;
}


Measured memory_bytes: 256
# A=gets.to_i
# B=gets.split.map(&:to_i)
# C=N.times.map{gets.to_i}
# D=N.times.map{gets.split.map(&:to_i)}
# S=gets.chomp
# MOD=1000000007

L,R=gets.split.map(&:to_i)

if L%2019==0 || R%2019==0
  puts 0
  exit
end
if L/2019<R/2019
  puts 0
  exit
end

lp=L%2019
rp=R%2019
if rp<=lp# && L<=R
  rp+=2019
end

m=2019
(lp..(rp-1)).each do |i|
  ((i+1)..rp).each do |j|
    m=[m,i*j%2019].min
  end
end

puts m

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int ans = 0;

		int l[] = new int[n*2];

		for (int i=0; i < n*2; i++){
			l[i] = sc.nextInt();
		}

		java.util.Arrays.sort(l);

		for (int i=0; i<n*2; i=i+2){
			if(l[i] < l[i+1]){
				ans += l[i];
			}else{
				ans += l[i+1];
			}
		}

		System.out.println(ans);
		sc.close();
	}

}

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

public class Main{


	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{


			double r=Double.parseDouble(reader.readLine());

			double S=Math.PI*r*r;
			double l=Math.PI*2*r;
			System.out.printf("%6f %6f", S, l);

			reader.close();
		}catch(IOException e){
			System.out.println("??¨??????:"+e);

		}

	}

}

Measured memory_bytes: 24648
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, d;
int get(int i) {
    int cnt = 0;
    while ((i % 100) == 0) {
        cnt++;
        i /= 100;
    }
    return cnt;
}
main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin >> d >> n;
    for (int i = 1; true; i++) {
        if (get(i) == d) n--;
        if (n == 0) {
            cout << i;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void) {
    int n, h[100000];
    int ct = 0, tmp = 0,i;
    scanf("%d",&n);
    scanf("%d", &h[0]);
    for(i = 1; i < n; i++) {
        scanf("%d",&h[i]); 
        if(h[i-1] >= h[i]) {
            // 継続
            tmp ++;
        } else {
            if(tmp > ct) {
                ct = tmp;
            }
            tmp = 0;
        }
    }
    if(tmp > ct) {ct = tmp;}
    printf("%d\n",ct);
    return 0;
}

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

int main() {

    int n;
    cin >> n;
    int cnt = 0;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    for (int i = 1; i < n-1; ++i) {
        if (((p[i - 1] < p[i]) && (p[i] < p[i + 1]))|| ((p[i - 1] > p[i]) && (p[i] > p[i + 1])))
        {
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <iostream>
using namespace std;

int main(){
	char ch;
	int cnt[26]={};
	while( cin >> ch ){
		ch = tolower(ch);
		if(isalpha(ch)){
			cnt[ch-'a']++;
		}		
	}
	
	for(int i=0; i<26; i++){
		printf("%c : %d\n",i+'a',cnt[i]);
	}

	return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
main()
{
    ll N; ll W;
    cin >> N >> W;

    ll wt[N]; ll val[N];
    for(ll i=0;i<N;i++)
    {
        cin >> wt[i] >> val[i];
    }

    ll dp[N+1][W+1];
    for(ll i=0;i<=W;i++)
        dp[0][i]=0;

    for(ll i=0;i<N;i++)
    {
        for(ll j=0;j<=W;j++)
        {
            if(j>=wt[i])
            dp[i+1][j]= max(dp[i][j],dp[i][j-wt[i]]+val[i]);
            else
            {
                dp[i+1][j]=dp[i][j];
            }
            
        }
    }

    cout << dp[N][W] << "\n";


}

Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std ;
signed main() {
  int n ; cin >> n ; int cnt = 0 ;
  for(register int i = 1 ; i <= n ; i ++)
    if(i & 1) cnt ++ ;
  double ans = cnt * 1.000 / n ;
  cout << fixed << setprecision(7) << ans << endl ;
  return 0 ;
}


Measured memory_bytes: 256