akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp8
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> kyoku = new List<string>();
            List<int> number = new List<int>();

            int a = int.Parse(Console.ReadLine()); //標準入力

            for(int i =0; i<a; i++)
            {
                string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
                kyoku.Add( str[0]);  //数値で受け取りたい場合は変換する
               number.Add( int.Parse(str[1]));
            }
            string kas = Console.ReadLine();
            int io = 0;
            int iss = 0;
            for (int i =0; i< kyoku.Count;i++)
            {
                if(kyoku[i] == kas)
                {
                    io = i+1;
                    break;
                }
            }
            while( io < number.Count)
            {
                iss += number[io];
                io++;
            }

            Console.WriteLine(iss);
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>

using namespace std;

const int MAX_N = 100000;

struct Student {
    int index;
    int value;

    bool operator<(const Student &other) const {
        return value < other.value;
    };
};

int main () {
    int n;
    Student A[MAX_N];

    cin >> n;

    for (int i = 0; i < n; i++) {
        A[i].index = i + 1;
        cin >> A[i].value;
    }

    sort(A, A + n);

    for (int i = 0; i < n; i++) {
        cout << A[i].index;
        if (i != n - 1) {
            cout << " ";
        }
    }

    cout << endl;
}


Measured memory_bytes: 1536
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); i++ )
#define UREP( i, m, n ) for ( unsigned int i = (unsigned int)( m ); i < (unsigned int)( n ); i++ )
#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = (c).begin(); it != (c).end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define PB( n ) push_back( ( n ) )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define fst first
#define snd second

bool inside( vector<string> &field, int i, int j )
{
	return 0 <= i && i < field.size() && 0 <= j && j < field[i].length();
}

int bfs( vector<string> &field, int i, int j, char c )
{
	if ( field[i][j] != c )
	{
		return 0;
	}

	field[i][j] = ' ';

	const int direction[][2] = {
		0, 1,
		1, 0,
		0, -1,
		-1, 0
	};

	REP( d, 0, 4 )
	{
		int ti = i + direction[d][0];
		int tj = j + direction[d][1];

		if ( inside( field, ti, tj ) )
		{
			bfs( field, ti, tj, c );
		}
	}

	return 1;
}

int main()
{
	while ( true )
	{
		int h, w;
		cin >> h >> w;

		if ( h == 0 && w == 0 )
		{
			break;
		}

		vector<string> field;

		REP( i, 0, h )
		{
			string buffer;
			cin >> buffer;
			field.PB( buffer );
		}

		int res = 0;

		REP( i, 0, field.size() )
		{
			REP( j, 0, field[i].length() )
			{
				if ( field[i][j] != ' ' )
				{
					res += bfs( field, i, j, field[i][j] );
				}
			}
		}

		cout << res << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>

#define ll long long
#define pb push_back
#define for(i,a,b) for(ll i=a;i<b;i++)

using namespace std;


int main(void)
{
    ll k,n;
    scanf("%lld %lld",&k,&n);
    vector<ll>v;
    ll max=0;
    for(i,0,n){ll x; scanf("%lld",&x); v.pb(x);}
    for(i,0,n-1)
    {
        if((v[i+1]-v[i])>max) max=v[i+1]-v[i];
    }
    if((k-v[n-1]+v[0])>max) max=(k-v[n-1]+v[0]);
    printf("%lld",k-max);

}


Measured memory_bytes: 2420
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7

s = int(input())
a = []
for i in range(3, s + 1):
    a.append(i)
f = [0] * (s + 10)
f[0] = 1
for i in range(1, s + 1):
    for k in a:
        if k > i:
            break
        f[i] = (f[i] + f[i - k]) % mod
print(f[s])

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

using namespace std;
typedef long long ll;

const int N=2e5+5,P=1e9+7;

int n,m,a,b,fac[N],ifac[N],ans;
inline int fpow(int a,int t){static int r;for(r=1;t;t>>=1,a=(ll)a*a%P)if(t&1)r=(ll)r*a%P;return r;}
inline int C(int n,int m){if(n<m)return 0;return (ll)fac[n]*ifac[m]%P*ifac[n-m]%P;}
inline int B(int n,int m){return C(n+m,n);}

int main(){
	cin>>n>>m>>a>>b;
	fac[0]=1;
	for(int i=1;i<=n+m;i++)fac[i]=(ll)fac[i-1]*i%P;
	ifac[n+m]=fpow(fac[n+m],P-2);
	for(int i=n+m;i>=1;i--)ifac[i-1]=(ll)ifac[i]*i%P;
	ans=B(n-1,m-1);
	for(int i=1;i<=b;i++)ans=(ans-(ll)B(n-a-1,i-1)*B(a-1,m-i))%P;
	if(ans<0)ans+=P;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>


using namespace std;

int main()
{
    int n,tmp=0,count=0;
    cin >>n;
    vector<int> vec(n);
    
    for(int i=0;i<n;++i){
        cin >> vec[i];
    }
    sort(vec.begin(),vec.end(),std::greater<int>());
    for(int i=0;i<n;i++){
        if(tmp==vec[i]){
            continue;
        }else{
            count++;
            tmp=vec[i];
        }

    }
    cout<<count;
}






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

int a[55];
int main()
{
    int n,k; cin>>n>>k;
    for (int i=1; i<=n; i++) cin>>a[i];
    
    int ans0=0;
    for (int i=0; i<=k; i++)
        for (int j=0; j<=k; j++)
        {
        	if (i+j>k || i+j>n) continue;
        	
        	int b[202];
        	for (int u=1; u<=i; u++)
        	    b[u]=a[u];
        	for (int u=i+1; u<=i+j; u++)
        	    b[u]=a[n+1-u+i];
        	sort (b+1,b+i+j+1);
        	
        	int ans=0;
        	for (int u=i+j; u>=1; u--)
        	{
        		if (u>k-i-j) ans+=b[u];
        		else if(b[u]>0) ans+=b[u];
			}
			ans0=max(ans,ans0);
		}
		
	cout << ans0;
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>                                                         
                                                                                   
  using namespace std;                                                            
  typedef long long ll;                                                           
                                                                               
  int main(){                                                                     
                                                                                 
     ios_base::sync_with_stdio(0);                                               
     int w,h,x,y,r;                                                              
      cin>>w>>h>>x>>y>>r;                                                         
                                                                                
    if((x-r>=0 && x+r<=w) && (y-r>=0 && y+r<=h))   cout<<"Yes\n";                                    
   else cout<<"No\n";                                                          
    return 0;                                                                   
 }             


Measured memory_bytes: 3216
class FenwickTree:
    def __init__(self, n):
        self.n = n
        self.bit = [0]*(n+1)
    
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= i & -i
        return s
    
    def add(self, i, x):
        while i <= self.n:
            self.bit[i] += x
            i += i & -i
    
    def get_sum(self, i, j):
        return self.sum(j) - self.sum(i)
    


def main():
    n, q = map(int, input().split())
    a = list(map(int, input().split()))
    
    bit = FenwickTree(n)
    for i, x in enumerate(a):
        bit.add(i+1, x)
    
    for i in range(q):
        query = list(map(int, input().split()))
        if query[0] == 0:
            bit.add(query[1]+1, query[2])
        else:
            print(bit.get_sum(query[1], query[2]))
    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 132552
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int n, x, t; cin >> n >> x >> t;
    int ans = t * ((n - 1 + x) / x);
    Out(ans);

    return 0;
}


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

int main()
{
	int N, M, mod = 1000000007;
	long long int ans = 1;

	cin >> N >> M;

	if (abs(N - M) > 1) {
		cout << 0 << endl;
		return 0;
	}

	if (N == M)ans *= 2;

	for (int i = 1; i <= N; i++) {
		ans *= i;
		ans %= mod;
	}

	for (int i = 1; i <= M; i++) {
		ans *= i;
		ans %= mod;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
ll uni[100005];
ll root(ll u){
    if(uni[u]<0)return u;
    return uni[u]=root(uni[u]);
}

void connect(int a,int b){
    a=root(a);
    b=root(b);
    if(a==b)return;
    if(uni[a]<uni[b]){
        a^=b;
        b^=a;
        a^=b;
    }
    uni[a]+=uni[b];
    uni[b]=a;
    return;
}
ll size(ll u){
    return -uni[root(u)];
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    memset(uni,-1,sizeof(uni));
    ll n,m;
    cin>>n>>m;
    ll num=n-m-1;
    
    num*=2;
    
    ll a[n];
    vector<pair<ll,ll> > v;
    for(int i=0;i<n;i++)cin>>a[i];
    ll x,y;
    for(int i=0;i<m;i++){
    	cin>>x>>y;
    	connect(x,y);
    }
    set<ll> s;
    for(ll i=0;i<n;i++){
    	s.insert(root(i));
    }
    for(int i=0;i<n;i++){
    	v.pb(make_pair(a[i],root(i)));
    }
    sort(be(v));
    ll ans=0;
    if(n-1==m){
    	cout<<0<<endl;
    	return 0;
    }
    if(n<num){
    	cout << "Impossible" <<endl;
    	return 0;
    }

    num-=s.size();
    for(int i=0;i<n;i++){
    	if(s.empty()&&num==0)break;
    	if(s.count(v[i].second)){
    		ans+=v[i].first;
    		s.erase(v[i].second);
    	}else if(num){
    		num--;
    		ans+=v[i].first;
    	}
    }
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 8696
N = int(input())
F_list = [int(input().replace(' ', ''), 2) for _ in range(N)]
P_list = [list(map(int, input().split())) for _ in range(N)]

max_p = float('-inf')
for i in range(1,1024):
    p = 0
    for j in range(len(F_list)):
        c = format(i & F_list[j], 'b').count('1')
        p += P_list[j][c]
    if p > max_p:
        max_p = p
print(max_p)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s; long long k; cin >> s >> k;
    int s_size = s.size();
    for(int i = 0; i < k; ++i) {
        if(int(s[i]) - int('1')) { cout << s[i]; return 0; }
    }cout << 1;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  long long N;
  cin >> N;
  long long A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;

  long long ta = (N + A - 1) / A;
  long long tb;
  if (B >= A)
  {
    tb = ta + 1;
  }
  else
  {
    tb = (N + B - 1) / B + 1;
  }

  long long tc;
  if (C >= B || C >= A)
  {
    tc = tb + 1;
  }
  else
  {
    tc = (N + C - 1) / C + 2;
  }

  long long td;
  if (D >= C || D >= B || D >= A)
  {
    td = tc + 1;
  }
  else
  {
    td = (N + D - 1) / D + 3;
  }

  long long te;
  if (E >= D || E >= C || E >= B || E >= A)
  {
    te = td + 1;
  }
  else
  {
    te = (N + E - 1) / E + 4;
  }

  cout << te << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll  long long int
#define fr(i,n) for(ll i=0; i<n; i++)
#define fre(i,n) for(ll i=1; i<=n; i++)
#define pb push_back
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define pii pair<ll,ll>
#define ve vector
#define piii pair<pii, ll>
#define FAST ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
using namespace std;

ll power(ll x, ll n, ll m)
{
    if(n==0)
        return 1;
    if(n==1)
        return x;
    x%=m;
    if(n%2)
        return (x*(power((x*x)%m, n/2, m)%m))%m;
    return power((x*x)%m, n/2, m)%m;
}

int main(){
  
    FAST;
    ll n, K;
    cin>>n>>K;

    ll a[n], ans[n];
    for(int i=0; i<n; i++){
      cin>>a[i];
    }

    ans[0] = 0;

    for(int i=1; i<n; i++){
      ans[i] = 1e15;
      for(int k=1; k<=K && i-k>=0; k++)
        ans[i] = min(ans[i], ans[i-k] + abs(a[i]-a[i-k]));
    }
    cout<<ans[n-1]<<endl;

}

Measured memory_bytes: 5176
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2,s3;
    int n,m;
    cin>>s1>>s2;
    cin>>n>>m;
    cin>>s3;
    if(s1==s3)
        cout<<n-1<<" "<<m<<endl;
    else
        cout<<n<<" "<<m-1<<endl;
    return 0;
}


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

int main(){
  int N, M; cin >> N >> M;
  int n, m;
  if(N<2){
    n=0;
  }
  else n=N*(N-1)/2;
  if(M<2){
    m=0;
  }
  else m=M*(M-1)/2;
  int ans=n+m;
  cout << ans << endl;
  return 0;
}

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

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
int main() {
    int n;
    while(cin >> n, n){
        vector<bool> dp(1<<n);
        vector<int> x(n), y(n), r(n), c(n);
        for (int i = 0; i < n; ++i) {
            cin >> x[i] >> y[i] >> r[i] >> c[i];
        }
        dp.back() = true;
        int ans = 0;
        for (int mask = (1<<n)-1; mask >= 0; --mask) {
            if(!dp[mask]) continue;
            ans = max(ans, n-__builtin_popcount(mask));
            for (int i = 0; i < n; ++i) {
                if(!(mask & (1<<i))) continue;
                bool ok = true;
                for (int j = 0; j < i; ++j) {
                    if(mask & (1<<j)){
                        if((x[j]-x[i])*(x[j]-x[i]) + (y[j]-y[i])*(y[j]-y[i]) < (r[i]+r[j])*(r[i]+r[j])) ok = false;
                    }
                }
                if(!ok) continue;
                for (int j = 0; j < n; ++j) {
                    if(!(mask & (1<<j))) continue;
                    if(c[i] != c[j]) continue;
                    if(i == j) continue;
                    int to = mask ^ (1<<i) ^ (1<<j);
                    for (int k = 0; k < j; ++k) {
                        if(mask & (1<<k)){
                            if((x[k]-x[j])*(x[k]-x[j])+(y[k]-y[j])*(y[k]-y[j]) < (r[k]+r[j])*(r[k]+r[j])) ok = false;
                        }
                    }
                    if(!ok) continue;
                    dp[to] = true;
                }
            }
        }
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 5140
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int N = Integer.parseInt(sc.get());
		int K = Integer.parseInt(sc.get());
		BitSet have = new BitSet(N);
		for (int i = 0; i < K; i++) {
			int d = Integer.parseInt(sc.get());
			for (int j = 0; j < d; j++) {
				int A = Integer.parseInt(sc.get());
				have.set(A - 1);
			}
		}
		System.out.println(N - have.cardinality());
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

Measured memory_bytes: 33764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    
    int n, x;
    int l[100];
	int i;
	
	cin >> n >> x;
	for (i = 0; i < n; i++) cin >> l[i];
	
	int s = 0;
	for (i = 0; i < n; i++) {
		s += l[i];
		if (s > x) break;
	}
	cout << i + 1 << endl;
	return 0;
}

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

using namespace std;

int main(){
    int N, W;
    cin >> N >> W;
    vector<string> a(N);
    vector<bool> row(N, false);
    vector<bool> col(W, false);
    for (int i = 0; i < N;i++){
        cin >> a[i];
    }

    for (int i = 0; i < N;i++){
        for (int j = 0; j < W;j++){
            if(a[i][j]=='#'){
                row[i] = true;
                col[j] = true;
            }
        }
    }

        for (int i = 0; i < N; i++)
        {
            if (row[i])
            {
                for (int j = 0; j < W; j++)
                {
                    if (col[j])
                    {
                        cout << a[i][j];
                    }
                }
                cout << endl;
            }
        }
}

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

int main(){
	int N, tmp, cnt=0;
	map<int,int> m;
	cin >> N;
	for(int i=0;i<N;i++){
		cin  >> tmp;
		m[tmp]++;
	}
	for(auto e : m){
		if(e.second % 2){
			cnt++;
		}
	}
	cout << cnt <<endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll N, Q;
    cin >> N >> Q;
    fenwick_tree<ll> fw(N);
    rep(i, N){
        ll a;
        cin >> a;
        fw.add(i, a);
    }
    rep(i, Q){
        ll t;
        cin >> t;
        if(t == 0){
            ll p, x;
            cin >> p >> x;
            fw.add(p, x);
        }
        else{
            ll l, r;
            cin >> l >> r;
            cout << fw.sum(l, r) << endl;
        }
    }
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

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

std::ostream &operator<<(std::ostream &dest, __int128_t value) {
  std::ostream::sentry s(dest);
  if (s) {
    __uint128_t tmp = value < 0 ? -value : value;
    char buffer[128];
    char *d = std::end(buffer);
    do {
      --d;
      *d = "0123456789"[tmp % 10];
      tmp /= 10;
    } while (tmp != 0);
    if (value < 0) {
      --d;
      *d = '-';
    }
    int len = std::end(buffer) - d;
    if (dest.rdbuf()->sputn(d, len) != len) {
      dest.setstate(std::ios_base::badbit);
    }
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
    if ('0' <= s[i] && s[i] <= '9')
      ret = 10 * ret + s[i] - '0';
  return ret;
}

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


  string s;
  cin >> s;

  __int128 x = parse(s);


  __int128 now = 100;
  int cnt = 0;
  while(now < x){

    now = now * 101 / 100;
    cnt++;


  }

  cout << cnt << endl;
  
  
  return 0;
}


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

int main() {
  
  vector<int> a(4);
   for(int i=0;i<4 ;i++){
     cin >> a.at(i);
   }  
    sort(a.begin(),a.end());
   if(a[0]==1 && a[1]==4 && a[2]==7 && a[3]==9){
     cout << "YES" << endl;
   }
   else {
     cout << "NO" << endl;
   }   
   
}


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

using namespace std;

int main(){
    int N,Q,ac=0;
    string S;
    cin >> N >> Q;
    cin >> S;
    vector<int> sum(S.size(),0);

    for(int i=0;i<S.size();i++){
        if(S[i]=='A' && S[i+1]=='C'){
            ac++;
            sum[i+1]--;
        }
    }

    sum[0] = ac;

    for(int i=1;i<S.size();i++){
        sum[i] += sum[i-1];
    }


    for(int i=0;i<Q;i++){
        int l,r;
        cin >> l >> r;
        cout << sum[l-1] - sum[r-1] << endl;
    }
}

Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>
#include <regex>
#include <functional>
#include <algorithm>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int MAX_N = 100000;

typedef signed long long ll;
ll N, M, X;
struct Book;
vector<Book> BookList(N);
struct Book {
    ll price;
    vector <ll> power;
    Book():power(M) {
        price=0;
    }
};


struct Case {
    vector <bool> buy_list;
    ll price;
    bool is_OK;
    Case() :buy_list(N) {
    }
    bool calc() {
        this->price = 0;
        this->is_OK = false;
        vector<ll> temp_power(M);
        for (int i = 0; i < N; i++) {
            if (buy_list[i]) {
                this->price += BookList[i].price;
                for (int j = 0; j < M; j++) {
                    temp_power[j] += BookList[i].power[j];
                }
            }
        }
        bool temp_flag = true;
        for (int i = 0; i < M; i++) {
            if (temp_power[i] < X) {
                temp_flag = false;
            }
        }
        if (temp_flag) {
            this->is_OK = true;
        }
        return true;
    }
};
bool comp(const Book& lh, const Book& rh) {
    return lh.price < rh.price;
}
bool comp_case(const Case& lh, const Case& rh) {
    if (!lh.is_OK & rh.is_OK) {
        return false;
    }
    else if (lh.is_OK & !rh.is_OK) {
        return true;
    }
    return lh.price < rh.price;
}

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


    cin >> N >> M >> X;
    ll case_count = pow(2, N);
    vector<Case> CaseList(case_count);
    BookList.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> BookList[i].price;
        for (int j = 0; j < M; j++) {
            BookList[i].power.resize(M);
            cin >> BookList[i].power[j];
        }
    }
    for (int i = 0; i < case_count; i++) {
        for (int j = 0; j < N; j++) {
            CaseList[i].buy_list[j] = (i >> j) & 0x1;
        }
        CaseList[i].calc();
    }
    std::sort(CaseList.begin(), CaseList.end(), comp_case);
    if (CaseList[0].is_OK) {
        cout << CaseList[0].price << endl;
    }
    else
    {
        cout << -1 << endl;
    }
    return 0;
}

/*
ll A, B, C, K;
    ll result;
    cin >> A >> B >> C >> K;
    if (K <= A) {
        result = A;
    }
    else if (K <= A + B) {
        result = A;
    }
    else {
        result = A - (K - (A + B));
    }
    cout << result << endl;
    */

Measured memory_bytes: 4280
import itertools, operator
N = int(input())
A = sorted([int(input()) for _ in range(N)])[::-1]
sA = set(a & -a for a in A)
cumxor = list(itertools.accumulate(A, func=operator.xor))[-1]
cnt = 0
for i in range(30, -1, -1):
    if cumxor & 2**i:
        if 2**i in sA:
            cumxor ^= 2**(i + 1) - 1
            cnt += 1
        else:
            print(-1)
            exit()
print(cnt)


Measured memory_bytes: 10968
use std::fmt::Debug;
use std::io;
use std::io::{Read, Stdin};
use std::str;
use std::str::FromStr;
use std::cmp::Ordering;
use std::collections::BinaryHeap;
use std::usize;
use std::cmp;


fn main() {
    let mut sc = Scanner::new();
    let n = sc.parse::<usize>();
    let mut a: Vec<i64> = vec![0; 3*n];
    for i in 0..(3 * n) {
        a[i] = sc.parse::<i64>();
    }

    let mut heap: BinaryHeap<i64> = BinaryHeap::new();
    let mut sum: i64 = 0;
    let mut prefix_max: Vec<i64> = vec![0;3*n];
    for i in 0..(2 * n) {
        if heap.len() == n {
            let min = -heap.pop().unwrap();
            sum -= min;
            let max = cmp::max(min, a[i]);
            sum += max;
            heap.push(-max);
        } else {
            heap.push(-a[i]);
            sum += a[i];
        }

        if heap.len() == n {
            prefix_max[i] = sum;
        }
    }

    heap.clear();
    sum = 0;
    let mut suffix_min = vec![0;3*n];
    for i in (n..(3 * n)).rev() {
        if heap.len() == n {
            let max = heap.pop().unwrap();
            sum -= max;
            let min = cmp::min(max, a[i]);
            sum += min;
            heap.push(min);
        } else {
            heap.push(a[i]);
            sum += a[i];
        }

        if heap.len() == n {
            suffix_min[i] = sum;
        }
    }

    let mut ans: i64 = -1000000000000000000;
    for i in n..(2 * n + 1) {
        let p = prefix_max[i - 1] as i64;
        let s = suffix_min[i] as i64;
        // println!("{} {}", p, s);
        ans = cmp::max(ans, p - s);
    }
    println!("{}", ans);
}


struct Scanner {
    stdin: Stdin,
    buf: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            buf: Vec::with_capacity(256),
        }
    }

    fn parse<T: FromStr>(&mut self) -> T
        where <T as FromStr>::Err: Debug
    {
        self.buf.clear();
        let mut it = self.stdin.lock().bytes();
        let mut c = it.next().unwrap().unwrap();
        while c == ' ' as u8 || c == '\n' as u8 {
            c = it.next().unwrap().unwrap();
        }
        while !(c == ' ' as u8 || c == '\n' as u8) {
            self.buf.push(c);
            c = it.next().unwrap().unwrap();
        }
        str::from_utf8(&self.buf).unwrap().parse::<T>().unwrap()
    }
}

Measured memory_bytes: 16636
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
 
alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");
 
T lread(T = long)()
{
    return readln.chomp.to!T();
}
 
T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}
 
void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long a,b,c;
    scan(a,b,c);
    if((a < c && c < b) || (a > c && c > b))
    {
        writeln("Yes");
    }
    else
    {
        writeln("No");
    }
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(); // 文字列の長さ
	    String A = sc.next(); 
		String B = sc.next(); 
		String C = sc.next(); 

        int returnCount = 0;
        for (int i = 0; i < N; i++) {
            char cA = A.charAt(i);
            char cB = B.charAt(i);
            char cC = C.charAt(i);
            int count = 0;
            if (cA != cB) count++;
            if (cB != cC) count++;
            if (cC != cA) count++;
            
            if (count == 3) {
                returnCount += 2;
            } else if (count == 2) {
                returnCount += 1;
            }
        }
		
        System.out.println(returnCount);
	}
}

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

int main()
{
    int n,m;
    bool res = false;
    std::cin>>n>>m;
    std::unordered_map<int,bool> pri;
    std::unordered_map<int,bool> sec;
    for(int i=0;i<m;i++){
        int a,b;
        std::cin>>a>>b;
        a--;b--;
        if(a==0){
            pri[b] = true;
        }
        if(b==n-1){
            sec[a] = true;
        }
    }

    for(auto i : pri){
        if(sec[i.first])res = true;
    }
    std::cout<<(res?"POSSIBLE":"IMPOSSIBLE")<<std::endl;

}

Measured memory_bytes: 12652
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(m)]
graph = [[] for i in range(n+1)]
for a,b in ab:
  graph[a].append(b)
  graph[b].append(a)
jdg = 0
ls = []
for i,g in enumerate(graph):
  if len(g)%2:
    print("No")
    exit()
  if len(g) == 4:
    jdg += 1
    ls.append(i)
  elif len(g) >= 6:
    jdg += 3
if jdg >= 3:
  print("Yes")
elif jdg == 2:
  start,goal = ls
  stack = [start]
  vis = [0]*(n+1)
  vis[start] = 1
  vis[goal] = 2
  jdg2 = 0
  while stack:
    x = stack.pop()
    for y in graph[x]:
      if vis[y] == 0:
        vis[y] = 1
        stack.append(y)
      elif vis[y] == 2:
        jdg2 += 1
  if jdg2 == 4:
    print("No")
  else:
    print("Yes")
else:
  print("No")

Measured memory_bytes: 70748
#include<cstdio>

#define REP(i,x) for(int i=0; i<(int)(x); i++)       // 0 <= i < x
#define REPS(i,x) for(int i=1; i<=(int)(x); i++)     // 0 < i <= x
#define RREP(i,x) for(int i=((int)(x)-1); i>=0; i--) // x > i >= 0
#define RREPS(i,x) for(int i=((int)(x)); i>0; i--)   // x >= i > 0
#define INF 999999999
typedef long long ll;

using namespace std;

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

int main(void){
	char x, y;
	scanf("%c %c", &x, &y);
	if(x < y){
		puts("<");
	}
	else if(x > y){
		puts(">");
	}
	else{
		puts("=");
	}

	return 0;
}


Measured memory_bytes: 128
a,b,c = (int(i) for i in input().split())
x,answer = [a,b,c],0
x.sort()
y = x[2]-x[1]
x[0] = x[0]+y
if (x[2]-x[0])%2==0:
	print(y+(x[2]-x[0])//2)
else:
	print(y+(x[2]-x[0]+3)//2)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin >> N;
    int X[N];

    for ( int i = 0; i < N; i ++ ) {
        cin >> X[i];
    }

    sort( X, X+N );

    int min = 1000000000;
    for ( int P = X[0]; P <= X[N-1]; P ++ ) {
        int sum = 0;
        for ( int i = 0; i < N; i ++ ) {
            sum += (X[i] - P) * (X[i] - P );
        }
        if ( sum < min ) min = sum;
    }

    cout << min << endl;
    
    return 0;
}

Measured memory_bytes: 256
N = int(input())
D, X = map(int, input().split())
ans = 0
for i in range(N):
    A = int(input())
    j = 0
    while True:
        if 1 + A * j <= D: 
            ans += 1
            j += 1
        else:
            break

print(ans + X)


Measured memory_bytes: 9068
#include "bits/stdc++.h"
using namespace std;
#define test int t; cin >> t; while (t--)
#define fast ios::sync_with_stdio(NULL); cin.tie(NULL)
#define mod 1073741824
#define endl "\n"
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define all(v) v.begin(),v.end()
#define ll long long
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define pb push_back
#define time 1.0 * clock() / CLOCKS_PER_SEC
ll MAX=10e10;

int main(){
    fast;
    ll n,d,x,y,ans=0;
    cin>>n>>d;
    for(ll i=0;i<n;++i){
        cin>>x>>y;
        if(sqrt((x*x)+(y*y))<=d)
            ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin >> n;
    ll ans=n*(n+1)/2;
    for(ll i=1;i<=n;i++){
        for(ll j=2;i*j<=n;j++){
            ans+=i*j;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3644
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#define R(i, n) for(int i = 0;i < n;i++)
#define S(a) scanf("%d", &a)
#define S2(a, b) scanf("%d%d", &a, &b)
#define S3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define P(a) printf("%d", a)
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> IR;

string S;

int main() {
	cin >> S;
	
	R(i, S.length()) {
		printf("%c", 'x');
	}
}



Measured memory_bytes: 256
n = int(input())
num_lis = [list(map(int, input().split())) for i in range(n)]
c = 0

for i,j in num_lis:
  if c == 3:
    break
  if i == j:
    c += 1
  else:
    c = 0

if c == 3:
  print("Yes")
else:
  print("No")

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

int n,m;
int fie[501][501];
int dp[51][1<<20];
int dp2[501][1<<11];

int res=0;
int used[501];

void dfs(int v,int c,int bit){
	if(v==n){
		for(int i=0;i<m;i++){
			int cnt=0;
			for(int j=0;j<n;j++){
				if(used[j]==1){
					cnt+=fie[j][i];
				}
			}
			if(cnt%2==1)return;
		}
		res=max(res,c);
		return;
	}
	used[v]=0;
	dfs(v+1,c,0);
	used[v]=1;
	dfs(v+1,c+1,0);
}

int main(void){
	while(1){
		scanf("%d%d",&n,&m);
		if(n==0 && m==0)break;
		memset(fie,0,sizeof(fie));
		for(int i=0;i<n;i++){
				string str;
				cin >> str;
			for(int j=0;j<m;j++){
				if(str[j]=='1')fie[i][j]=1;
				else fie[i][j]=0;
			}
		}
		if(m<=10){
			memset(dp2,-1,sizeof(dp2));
			dp2[0][0]=0;
			for(int i=0;i<n;i++){
				for(int j=0;j<(1<<m);j++){
					if(dp2[i][j]<0)continue;
					dp2[i+1][j]=max(dp2[i+1][j],dp2[i][j]);
					int bit=j;
					for(int k=0;k<m;k++){
						if(fie[i][k]==1){
							if(j>>k & 1){
								bit-=1<<k;
							}else{
								bit+=1<<k;
							}
						}
					}
					dp2[i+1][bit]=max(dp2[i+1][bit],dp2[i][j]+1);
				}
			}
			printf("%d\n",dp2[n][0]);
		}else if(m<=20){
			memset(dp,-1,sizeof(dp));
			dp[0][0]=0;
			for(int i=0;i<n;i++){
				for(int j=0;j<(1<<m);j++){
					if(dp[i][j]<0)continue;
					dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
					int bit=j;
					for(int k=0;k<m;k++){
						if(fie[i][k]==1){
							if(j>>k & 1){
								bit-=1<<k;
							}else{
								bit+=1<<k;
							}
						}
					}
					dp[i+1][bit]=max(dp[i+1][bit],dp[i][j]+1);
				}
			}
			printf("%d\n",dp[n][0]);
		}else{
			res=0;
			dfs(0,0,0);
			printf("%d\n",res);
		}
	}
	return 0;
}

Measured memory_bytes: 217080
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
#define int long long
typedef pair<int,int>pii;
const int mxN=1e5+5,M=1e9+7;
//did u check when n=1?
//is mxN correct?

int n,k;
int dp[2][mxN];
int v[105];
int solve(int p,int res){
    //cout<<p<<" "<<res<<"\n";
    if(res==0)return dp[p][res]=0;
    if(dp[p][res]!=-1)return dp[p][res];

    for(int i=0;i<n;i++){
        if(v[i]<=res && !solve((p+1)%2,res-v[i]))return dp[p][res]=1;
        
    }
    return dp[p][res]=0; 
}
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(dp,-1,sizeof(dp));
    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>v[i];
    solve(0,k);
    cout<<(solve(0,k)==1?"First":"Second");

}

Measured memory_bytes: 6528
import java.util.*;
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();
		}
		insertionSort(A,N);
	}
	public static void insertionSort(int[] A,int N){
		show(A,N);
		for(int i=1;i<N;i++){
			int v=A[i];
			int j=i-1;
			while(j>=0 && A[j]>v){
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=v;
			show(A,N);
		}
	}
	public static void show(int[] A,int N){
		for(int i=0;i<N-1;i++){
			System.out.print(A[i]+" ");
		}
		System.out.println(A[N-1]);
	}
}


Measured memory_bytes: 30444
#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
using ld = long double;
using ulli = unsigned long long int;
#define filein freopen ("in.txt", "r", stdin)
#define fileout freopen ("out.txt", "w", stdout)
#define dbg(args...) do {cerr << #args << " : "; debug(args); } while(0)
#define all(v) ((v).begin()),((v).end()) 
#define pb emplace_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
void debug () {cerr << endl;}
template < typename T, typename ... hello>void debug( T arg, const hello &... rest) {cerr << arg << ' ';debug(rest...);}
int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
void solve(){
	double pi = 3.14159265;
	double r;
	cin>>r;
	cout<<2*pi*r;
}
int main(){
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}



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

int main(){
    int n, i, a;
    long sum=0;
    vector<int> v;
    cin >> n;
    rep(i,n){
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(), v.end());
    rep(i,n) sum += v[i];
    cout << v[0] << " " << v[n-1] << " " << sum << endl;
    return 0;
}


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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
const int MOD = 1e9 + 7;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((ll)((a) + (b) - 1)/(ll)(b))

signed main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    
    sort(rALL(a));
    
    int ans = 0;
    vector<int> b(ceiv(n, 2));
    rep(i,ceiv(n, 2)){
        if(i) ans += a[i-1];
        b[i] = a[i];
    }
    b.push_back(b.back());
    
    rep(i,n/2){
        ans += b[i+1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 6424
N, A = map(int, input().split())
X = list(map(int, input().split()))
X = list(map(lambda x: x - A, X))
maxx = max(max(X), -min(X))
#前から(i + 1)個見て、和が(j - N * maxx)のもの
dp = [[0] * (2 * N * maxx + 1) for _ in range(N + 1)]
dp[0][N * maxx] = 1
for i in range(N):
  for j in range(2 * N * maxx + 1):
    if 0 <= j + X[i] <= 2 * N * maxx:
      dp[i + 1][j + X[i]] = dp[i][j] + dp[i][j + X[i]]
    else:
      dp[i + 1][j] = dp[i][j]
print(dp[N][N * maxx] - 1)
#print(dp)
#print(X)

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

#define ALPHABET 26
int main() {
	int alphabet[ALPHABET], n, count[ALPHABET], num;
	string s;
	for (int i = 0;i < ALPHABET;i ++) alphabet[i] = 0;
	
	
	cin >> n >> s;
	for (int i = 0;i < s.size();i ++) {
		alphabet[s[i]-'a']++;
	}
	for (int i = 1;i < n;i ++) {
		for (int j = 0;j < ALPHABET;j ++)count[j] = 0;
		cin >> s;
		num = 0;
		for (int j = 0;j < s.size();j ++) {
			count[s[j]-'a']++;
		}
		for (int j = 0;j < ALPHABET;j ++) {
			if (alphabet[j] > count[j]) alphabet[j] = count[j];
		}
	}
	for (int i = 0;i < ALPHABET;i ++) {
		for (int j = 0;j < alphabet[i];j ++) {
			cout << (char)('a'+i);
		}
	}
}

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

using namespace std;

int divisor(int n)
{
    int c=0;
    for(int i=1;i<=n;i++)
    {
        if(n%i==0)c++;
    }
    return c;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int c=0;
    for(int i=1;i<=n;i+=2)
    {
        if(divisor(i)==8)c++;
    }
    cout<<c<<endl;
    return 0;
}



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

using namespace std;

int main() {
	int n;
	cin>>n;
	vector<vector<int>> A(n, vector<int>(3));
	for(int i =0;i<n;i++) for(int j=0;j<3;j++) cin>>A[i][j];
	for(int i = 1;i<n;i++) {
		A[i][0] += max(A[i-1][1], A[i-1][2]);
		A[i][1] += max(A[i-1][0], A[i-1][2]);
		A[i][2] += max(A[i-1][1], A[i-1][0]);
	}
	cout<<*max_element(A[n-1].begin(), A[n-1].end())<<'\n';
	return 0;
}

Measured memory_bytes: 5888
public partial class IntroductionToProgramming{
	public static void Main(){
		int s = int.Parse(System.Console.ReadLine());
		int m = s / 60;
		s = s % 60;
		int h = m / 60;
		m = m % 60;
		System.Console.WriteLine(h.ToString() + ":" + m.ToString() + ":" + s.ToString());
	}
}

Measured memory_bytes: 19920
// In the name of God 
#include <bits/stdc++.h>

using namespace std ;


//#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

const int N = 2000 + 10 , mod = ( int ) 1e9 + 7 ; 

int n , dp [ ( N << 1 ) + 100 ] [ ( N << 1 ) + 100 ] , fact [ N << 2 ] , inv [ N << 2 ] ;  
vector < pair < int , int > > vec ; 

int pw ( int x , int y ) {
	int ret = 1 ;
	for ( ; y ; y >>= 1 , ( x = 1LL * x * x % mod ) %= mod )
		if ( y & 1 )
			( ret = 1LL * ret * x % mod ) %= mod ; 
	return ret ;
}

int comb ( int n , int r ) {
	return ( 1LL * fact [ n ] * inv [ r ] % mod * 1LL * inv [ n - r ] % mod ) % mod ; 
}

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n ;
	for ( int i = 0 ; i < n ; ++i ) {
		int a , b ;
		cin >> a >> b ;
		vec.push_back ( { a , b } ) ; 
		++ dp [ -a + N ] [ -b + N ] ; 
	}
	for ( int i = 0 ; i < ( N << 1 ) + 100 ; ++i ) {
		for ( int j = 0 ; j < ( N << 1 ) + 100 ; ++j ) {
			if ( i )
				dp [ i ] [ j ] += dp [ i - 1 ] [ j ] ;
			if ( dp [ i ] [ j ] >= mod )
				dp [ i ] [ j ] -= mod ; 
			if ( j )
				dp [ i ] [ j ] += dp [ i ] [ j - 1 ] ;
			if ( dp [ i ] [ j ] >= mod )
				dp [ i ] [ j ] -= mod ; 
		}
	}
	fact [ 0 ] = inv [ 0 ] = 1 ;
	for ( int j = 1 ; j < ( N << 2 ) ; ++j ) {
		fact [ j ] = 1LL * fact [ j - 1 ] * j % mod ;
		inv [ j ] = pw ( fact [ j ] , mod - 2 ) ; 
	}
	int res = 0 ;
	for ( auto pi : vec ) { 
		res += dp [ pi.first + N ] [ pi.second + N ] ; 
		if ( res >= mod ) res -= mod ;
	} 
	for ( auto pi : vec ) {
		res -= comb ( 2 * ( pi.first + pi.second ) , 2 * pi.first ) ; 
		if ( res < 0 ) res += mod ; 
	}
	( res = 1LL * res * pw ( 2 , mod - 2 ) % mod ) %= mod ;
	cout << res << '\n' ; 
}


Measured memory_bytes: 68336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define sz(a) int((a).size())
#define all(a)  a.begin(), a.end()
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;
#define present(c,x) ((c).find(x) != (c).end())
const double eps = 1e-8;
#define EQ(a,b) (fabs((a)-(b))<eps)
inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 1e6+10;
const ll inf = 1e18;

ll power(ll a,ll n){
	if(n==0){
		return 1;
	}
	ll b = power(a,n/2);
	b = b*b%mod;
	if(n%2) b= b*a%mod;
	return b;
}

int add(int a,int b){ return (a+b)%mod;}
int mul(int a,int b){ return (ll)a*b%mod;}



int main(){
 // 	freopen("nice.in","r",stdin);
 // freopen("nice.out","w",stdout);
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int p; scanf("%d",&p);
	ll ans = 0;
	REPP(i,1,n){
		int x; scanf("%d",&x);
		if((1ll)*(x-p)*a<b) ans+=(1ll)*(x-p)*a;
		else ans+=b;
		p=x;
	} 
	printf("%lld\n",ans);
	return 0;
}




Measured memory_bytes: 256