akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int idx;
string s;
string yaml[100009];
struct tree{
    map<string,tree*>child;
    int is;
    string name,val;
};
void make_tree(tree *root,int id,int &ln){
    while( ln < idx ){
        int cnt=0;
        string nm="";
        tree *next = new tree();
        string st =  yaml[ln];
        while(st[cnt]==' ')cnt++;
        if(cnt<=id)return;
        int cur=cnt;
        while(st[cur]!=':')nm+=st[cur++];
        cur++;ln++;
        next->name=nm;
        if(cur==st.size())make_tree(next,cnt,ln);
        else{
            next->is=1;
            next->val=st.substr(cur+1);
        }
        root->child[nm]=next;
    }
}
string sol(){
    tree *root=new tree();
    int ln=0,cur=0;
    make_tree(root,-1,ln);
    while( cur < s.size() ){
        string obj="";
        cur++;
        while(cur<s.size() && s[cur]!='.')obj+=s[cur++];
        if(root->child.count(obj)==0)return "no such property";
        root = root->child[obj];
    }
    if(root->is)return "string \""+root->val+"\"";
    return "object";
}
int main(){
    getline(cin,s);
    while(getline(cin,yaml[idx]))idx++;
    cout<<sol()<<endl;
}


Measured memory_bytes: 4228
using System;

namespace _0608
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());
            int C = int.Parse(Console.ReadLine());
            int D = int.Parse(Console.ReadLine());
            int P = int.Parse(Console.ReadLine());
            int X = A * P;
            int Y = 0;
            if (P > C)
            {
                Y = B + D * (P - C);
            }
            else
            {
                Y = B;
            }
            if (X < Y)
            {
                Console.WriteLine(X);
            }
            else if (X == Y)
            {
                Console.WriteLine(X);
            }
            else
            {
                Console.WriteLine(Y);
            }
        }
    }
}

Measured memory_bytes: 9128
#include<stdio.h>
int main()
{
    char str[6];
    int i;
    gets(str);
    if(str[0]=='S')
    {
        printf("Cloudy");
    }else if(str[0]=='C')
    {
        printf("Rainy");
    }else{
    printf("Sunny");
    }
}


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

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

  vector<int> p(n);

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

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

  int sum = 0;
  for (int i = 0; i < k; i++) {
    sum += p[i];
  }

  cout << sum << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <fstream>
#include <list>
#include <iomanip>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(s) memset(s, 0, sizeof(s))
const int INF = 1e9;
inline int read(){
	int dat = 0,w = 0 ;
	char ch = 0;
	while(!isdigit(ch)) {w |= ch == '-';ch = getchar();}
	while(isdigit(ch)) dat = (dat<<3) + (dat<<1) + (ch ^ 48),ch = getchar();
	return w ? -dat : dat;
}

ll n,ans;
ll dat[1000005];
int main()
{
	cin>>n;
	for(ll i=0;i<n;i++)
	{
		cin>>dat[i];
	}
	ans=0;
	for(ll i=1;i<n;i++)
	{
		if(dat[i-1]==dat[i])
		{
			dat[i]=-1;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
// g++ .cpp && ./a.out
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

typedef pair<int, int> p;
typedef long long ll;

const int mod = 1000000007;
const int inf = 1000000007;

int main() {
  char n;
  cin >> n;
  if (n - 'a' >= 0 && n - 'a' < 26) cout << 'a' << endl;
  if (n - 'A' >= 0 && n - 'A' < 26) cout << 'A' << endl;
}


Measured memory_bytes: 3620
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let input = read_vec::<usize>();
    let (mut a, mut b) = (input[0], input[1]);
    if b < a {
        let temp = a;
        a = b;
        b = temp;
    }
    let mut ans = String::new();
    let a = &a.to_string();
    for _ in 0..b {
        ans += a;
    }
    println!("{}", ans)
}

Measured memory_bytes: 4352
#include<cstdio>
#include<algorithm>
#define MAX 100005
#define INF 1000000005
using namespace std;
 
int main(){
  int n, a[3][MAX], i, j, k, l;
  long long b[MAX], ans = 0;
  scanf("%d", &n);
  for(i = 0; i < 3; i++)
    for(j = 0; j < n; j++) scanf("%d", &a[i][j]);
  for(i = 0; i < 3; i++){
    sort(a[i], a[i]+n);
      a[i][n] = INF;
  }
  for(i = 0; i < 2; i++){
    j = 0; k = 0;
    for(l = 0; l < 2*n; l++){
      if(a[i][j] < a[i+1][k]){
        if(i) ans += b[j]*(n-k);
        j++;
      }else{
        if(!(i)) b[k] = j;
        k++;
      }
    }
  }
  printf("%lld\n", ans);
}

Measured memory_bytes: 2176
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	vector<vector<ll>> a(3,vector<ll>(3,0));
	REP(i,3){
		REP(j,3){
			cin>>a[i][j];
		}
	}
	ll n; cin>>n;
	vector<ll> b(n);
	REP(i,n) cin>>b[i];

	
	REP(i,3){
		REP(j,3){
			REP(k,n){
				if(a[i][j]==b[k])a[i][j]=-1;
			}
		}
	}
	int f=0;
	REP(i,3){
		f=1;
		REP(j,3){
			if(a[i][j]!=-1)f=0;
		}
		if(f==1)goto YES;
	}
	REP(i,3){
		f=1;
		REP(j,3){
			if(a[j][i]!=-1)f=0;
		}
		if(f==1)goto YES;
	}
	
	f=1;
	REP(i,3){
		if(a[i][i]!=-1)f=0;
	}
	if(f==1)goto YES;
	
	f=1;
	REP(i,3){
		if(a[i][2-i]!=-1)f=0;
	}
	if(f==1)goto YES;


	cout<<"No"<<endl;
	return 0;
	YES:
	cout<<"Yes"<<endl;
	return 0;
}


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

int main(void)
{
    int n,k;
    scanf("%d%d",&n,&k);
    int a=n+1;
    char S[a];
    scanf("%s",&S);
    
    int i=0;
    S[k-1]=tolower(S[k-1]);

    printf("%s\n",S);
        
    return 0;
}

Measured memory_bytes: 128
#prag\
ma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;

struct node{
	long long a,b;
}a[100001];

bool cmp(node a,node b){
	return a.b>b.b;
}

int main()
{
	ios::sync_with_stdio(false);
	long long n,h,maxv=0;
	cin>>n>>h;
	long long s=0;
	for(long long i=1;i<=n;i++) cin>>a[i].a>>a[i].b,maxv=max(maxv,a[i].a);
	sort(a+1,a+n+1,cmp);
	long long tot=0;
	for(long long i=1;i<=n;i++)
		if(a[i].b>maxv)
		{
			h-=a[i].b,tot++;
			if(h<=0) break;
		}
		else break;
	if(h<=0){
		cout<<tot;
		return 0;
	}
	if(h%maxv==0) cout<<h/maxv+tot;
	else cout<<h/maxv+1+tot;
return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(void){
    string S;
    cin >> S;
    int ans = 0;
    int N = S.size();
    int g=0,p=0;
    rep(i,N){
        if(S[i] == 'p'){
            p++;
        }
    }
    ans = N / 2 - p;
    cout << ans << endl;
}


Measured memory_bytes: 3284
fn main() {
    let v = read_vec::<u32>();
    let a = v[0];
    let b = v[1];
    let x = v[2];

    yn(a <= x && x <= a + b);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <thread>
#include <cmath>
#include <cstring>
#include <string>
#include <typeinfo>
using namespace std;
#define nv_sort(x) sort(x.begin(),x.end())
// #define bv_sort(x) = sort(x.begin(),x.end(),greater<int>())
// #define v_count(x,p) = count(x.begin(),x.end(),p)

vector<double> hoge;

void input(int N){
    int temp;
    for(int i = 0;i<N;i++){
        cin >> temp;
        hoge.push_back(temp);
    }
}

double T(vector<double>& cont){
    int sZ = cont.size()-1;
    vector<double> cont2(sZ);
    //cout << cont.size() << endl;
    if(cont.size()>1){
        int i,f = cont.size();
        for(i=0;i<sZ;i++){
            cont2.at(i) = (i==0)?((cont.at(0) + cont.at(1))/2):cont.at(i+1);
        }
    } else{
        return cont.at(0);
    }
    T(cont2);
}

int main(){
    int N,sum;
    cin >> N;
    input(N);
    nv_sort(hoge);
    //for(int i=0;i<N;i++)cout << hoge.at(i);
    cout << T(hoge) << endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long double X[200100];
int N;
long long Count(long double len)
{
  long long Ans=0;
  for(int i=0;i<N;i++)
  {
    Ans+=(long long)(X[i]/len);//解答引っ張ってきた人の条件。なぜか通る
    //Ans+= ceil(X[i]/len)-1;//多少遅くなるがこっちが正解
  }
  return Ans;
}

int main()
	{
	  long long K;
	  cin>>N>>K;
	  for(int i=0;i<N;i++)
	{
		cin>>X[i];
		//X[i]-=0.1;
	}

  long double l=1,r=1e9;
  //while(l<r-0.1)//解答を引っ張ってきた人の条件。なぜかOKだったが、lとｒの整数部が異なる状態でループを出ると問題になるはず
	//for(int i=0;i<35;i++)//OK log2(10^9)=30.二分探索だとこのやり方安定する。ただし、浮動小数のせいか34以上でないと通らず。
  //while(!((ceil(r)-ceil(l)) == 0))//NG:左端が初期値0のままだと、右端のceilは0にならず、無限ループ
	while(!((floor(r)-floor(l)) == 0))//OK:右端がぴったり整数にならなければ成立.(あまりよくない)
  {
    long double mid=(l+r)/2;
    if(Count(mid)<=K) r=mid;
    else	l=mid;
  }
  cout<<(long long)(l+0.999)<<endl;
  return 0;
}


Measured memory_bytes: 6756
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
ll n;
ll res;
void work(ll x,ll y)
{
	if (!x) return;
	res+=y;
	work(x/2,y*2);
}
int main()
{
	cin >>n;
	work(n,1);
	cout <<res;
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  
  int W, H, x, y, r;
  scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);
  if ( 0 + r <= x && x <= W - r && 0 + r <= y && y <= H - r) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}




Measured memory_bytes: 2140
while(True):
		try:
			a,b,c,d,e,f=map(float,input().split(" "))
			z=a*e-b*d
			if(z!=0):
				x=(c*e-b*f)/z
				y=(a*f-c*d)/z
			print("{:.3f} {:.3f}".format(x+0,y+0))
		except:
			break

Measured memory_bytes: 6748
import sys
import math

def TreasureHunt():
    x,y=(0.0,0.0)
    alpha=90
    
    for line in sys.stdin:
        a,b=list(map(int,line.split(',')))
        if a==0 and b==0:
            break
        
        x+=a*math.cos(alpha/180.0*math.pi)
        y+=a*math.sin(alpha/180.0*math.pi)
        alpha=(alpha-b+360)%360

    print(int(x))
    print(int(y))

        
        
            
TreasureHunt()

Measured memory_bytes: 7828
#include <stdio.h>
#include <array>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using lli = long long int;
constexpr int N = 2e5;
std::array<int, N> A;
   
int main(void){
    int n; scanf("%d", &n);
    REP(i, n) scanf("%d", &A[i]);
    lli res = 0;
    int l = 0, r = 0, allOR = 0;

    while(l < n){
        while(r < n and (allOR & A[r]) == 0){allOR |= A[r]; r++;}
        res += r - l;
        allOR ^= A[l++];
        if(l > r) r++;
    }
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  vl x(n);
  ll dp[n];
  rep(i,n){
    cin >> x[i];
    dp[i] = x[i];
  }
  sort(all(x));
  ll a = x[n / 2-1];
  ll b = x[n / 2];
  double middle = ((double)a + (double)b) / (double)2;
  rep(i,n){
    if(dp[i]<=middle){
      print(b);
    }
    else{
      print(a);
    }
  }
}


Measured memory_bytes: 6256
N,A,B,C,D=map(int,input().split())
str=input()

str_ac = str[A:C-1]
str_bd = str[B:D-1]
#print(str_ac)
#print(str_bd)

if C<D:
  if str_bd.find("##") != -1 or str_ac.find("##") != -1:
    print("No")
  else:
    print("Yes")
else:
  if str_bd.find("##") != -1:
    print("No")
  elif str_bd.find("...") != -1 and str_ac.find("##") == -1:
    print("Yes")
  elif str_bd.startswith("..") and str_ac.find("##") == -1:
    print("Yes")
  elif str_bd.endswith("..") and str_ac.find("##") == -1:
    print("Yes")
  else:
    str_b = str[:B-1] + "#" + str[B:]
    str_d = str[:D-1] + "#" + str[D:]
    str_b_ac = str_b[A:C-1]
    str_d_ac = str_d[A:C-1]
    #print(str)
    #print(str_ac)
    if str_b_ac.find("##") == -1 or str_d_ac.find("##") == -1:
      print("Yes")
    else:
      print("No")


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

int main() {
    int Input, N, X, pie = 0;
    
    cin >> N >> X;
    vector<int> D(N+1); vector<int> L(N);
    
    for (int i = 0; i < N; i++) {
        cin >> L.at(i);
    }

    for (int i = 0; i < N; i++) {
        D.at(i+1) = D.at(i) + L.at(i);
    }

    int count = 1;
    for (int i = 1; i <= N; i++) { 
        if (D.at(i)<=X) { count++; }
        if (i==N) { break; }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<(n);i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);

int main(){
	int n;cin>>n;
	string s;cin>>s;
	vi f(n,0),b(n,0);
	rep(i,n){
		if(i!=0)f[i]+=f[i-1];
		if(s[i]=='#'){
			f[i+1]++;
		}
	}
	reverse(been(s));
	rep(i,n){
		if(i!=0)b[i]+=b[i-1];
		if(s[i]=='.'){
			b[i+1]++;
		}
	}
	reverse(been(b));
	int ans =INF;
	rep(i,n){
		ans=min(ans,f[i]+b[i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 2180
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;
#define LOCAL  1
#define UPLOAD 2
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;
}
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';

#define ll long long

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
  ll N = input();
  ll K = input();

  ll count = 0;
  for(int i=0;i<N;i++){
    ll h = input();
    if(h >= K){
      count++;
    }
  }
  output(count);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#include <bitset>
#define M 1000000007
#define M1 998244353

#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define fast                        \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

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

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

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

inline ll mul(ll x, ll y, ll m)
{
    ll z = 1LL * x * y;
    if (z >= m)
    {
        z %= m;
    }
    return z;
}

ll powmod(ll x, ll y, ll m)
{
    ll r = 1;
    while (y)
    {
        if (y & 1)
        {
            r = mul(r, x, m);
        }
        y >>= 1;
        x = mul(x, x, m);
    }
    return r;
}



void start()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
/***********************************************************************************************************/

bool solve(int b[][3])
{
    int n=3;

    // row 
    for (int i=0;i<n;i++)
    {
        int c=0;
        for (int j=0;j<n;j++)
        {
            if (b[i][j])
            {
                c++;
            }
        }
        if (c==3)
        {
            return true;
        }
    }

    // col 
    for (int i=0;i<n;i++)
    {
        int c=0;
        for (int j=0;j<n;j++)
        {
            if (b[j][i])
            {
                c++;
            }
        }
        if (c==3)
        {
            return true;
        }
    }

    // diagonal
    if (b[0][0]&&b[0][0]==b[1][1]&&b[1][1]==b[2][2])
    {
        return true;
    }
    if (b[0][2]&&b[0][2]==b[1][1]&&b[1][1]==b[2][0])
    {
        return true;
    }
    return false;
}
int main()
{
    start();
    unordered_map<int, pair<int, int>> a;
    int n=3;
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<n;j++)
        {
            int x;
            cin>>x;
            a[x]={ i, j };
        }
    }
    int b[3][3];
    memset(b, 0, sizeof(b));
    int m;
    cin>>m;
    int x;
    for (int i=0;i<m;i++)
    {
        cin>>x;
        if (a.find(x)!=a.end())
        {
            b[a[x].first][a[x].second]=1;
        }
    }
    if (solve(b))
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }


    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
#define PR(x) cout << (x) << "\n"
#define PS(x) cout << (x) << " "
const long long INF = numeric_limits<long long>::max();
int main() {
    ll N;
    cin >> N;
    ll sum = 0;
    for (ll i = 1; i <= N; ++i) {
        if (i % 3 == 0) continue;
        if (i % 5 == 0) continue;
        sum += i;
    }
    PR(sum);
    return 0;
}

Measured memory_bytes: 3592
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int N,i,j,k,tmp_cnt;
string S,ans;
vector<map<int,int> >cnt;
char c;

inline void solve(){
  IN(N);
  cnt.resize(N);
  REP(i,N){
    IN(S);
    REP(j,(long)S.size()){
      cnt[i][S[j]]++;
    }
  }
  REP(j,26){
    c='a'+j;
    tmp_cnt=INT_MAX;
    REP(i,N){
      chmin(tmp_cnt,cnt[i][c]);
    }
    if(tmp_cnt){
      REP(k,tmp_cnt)ans+=c;
    }
  }
  OUT(ans);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    int n; cin >> n;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    if(n <= 2){
        cout << 0 << endl;
        return 0;
    }
    int ans = 0;
    rep(i,n-2)repr(j,i+1,n-1)repr(k,j+1,n){
        if(l[i] != l[j] && l[j] != l[k] && l[i] != l[k]){
            vector<int> v = {l[i],l[j],l[k]};
            sort(v.begin(),v.end());
            if(v[0]+v[1] > v[2]) ans++;
        }
    }
    cout << ans << endl;
} 




Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll md = 1e9+7;

int main()
{
	int n;
	string s;
	cin >> n >> s;
	ll dp[n+1][n+1];
	dp[1][1] = 1;
	for (int q = 2; q <= n; q++)
	{
		if (s[q-2] == '>')
		{
			dp[q][q] = 0;
			for (int w = q-1; w >= 1; w--)
			{
				dp[q][w] = (dp[q][w+1] + dp[q-1][w]) % md;
			}
		}
		else
		{
			dp[q][1] = 0;
			for (int w = 2; w <= q; w++)
			{
				dp[q][w] = (dp[q][w-1] + dp[q-1][w-1]) % md;
			}
		}
	}
	ll tot = 0;
	for (int q = 1; q <= n; q++)
	{
		tot = (tot + dp[n][q]) % md;
	}
	cout << tot <<"\n";
	return 0;
}



Measured memory_bytes: 70528
#include <stdio.h>

int main(void)
{
	int a,b,d,r;
	double fl_a,fl_b,f;
	scanf("%d %d",&a,&b);

	d = a / b;
	r = a % b;

	fl_a = (double)a;
	fl_b = (double)b;
	f = fl_a / fl_b;

	printf("%d %d %f\n",d,r,f);
	return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <string>

using namespace std;

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


Measured memory_bytes: 3104
using System;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        string n = Console.ReadLine();
        if(n[0] == '7' || n[1] == '7' || n[2] == '7')
        {
            Console.WriteLine("Yes");
        } else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 25780
A = input()
B = input()
s = ""
if len(A) > len(B):
    for i in range(len(B)):
        s += A[i]
        s += B[i]
    s += A[len(A)-1]
else:
    for i in range(len(B)):
        s += A[i]
        s += B[i]
print(s)

Measured memory_bytes: 2940
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<string>
#include<iostream>
#define ll long long
using namespace std;
const int maxn=100009*2;
const int maxm=100009*2;
struct node
{
    int x;int y;int id;
}a[100009*2],b[100009*2];
const bool com1(const node &a,const node &b)
{
    return a.x<b.x;
}
 const bool com2(const node &a,const node &b)
{
    return a.y<b.y;
}
struct Edge
{
    int u,v;
    ll dist;
    Edge(){}
    Edge(int u,int v,ll d):u(u),v(v),dist(d){}
    bool operator<(const Edge&rhs)const
    {
        return dist <rhs.dist;
    }
};
 
struct Kruskal
{
    int n,m;
    Edge edges[maxm];
    int fa[maxn];
    int findset(int x){ return fa[x]==-1? x: fa[x]=findset(fa[x]); }
 
    void init(int n)
    {
        this->n=n;
        m=0;
        memset(fa,-1,sizeof(fa));
    }
 
    void AddEdge(int u,int v,ll dist)
    {
        edges[m++]=Edge(u,v,dist);
    }
 
    ll kruskal()
    {
        ll sum=0;
        int cnt=0;
        sort(edges,edges+m);
 
        for(int i=0;i<m;i++)
        {
            int u=edges[i].u, v=edges[i].v;
            if(findset(u) != findset(v))
            {
                sum += edges[i].dist;
                fa[findset(u)] = findset(v);
                if(++cnt>=n-1) break;
            }
        }
        if(cnt<n-1) return -1;
        return sum;
    }
}KK;
 
int main()
{
    int n;
    cin>>n;
     KK.init(n);
    for(int i=1;i<=n;i++)
    {
        int u,v;
        cin>>u>>v;
        a[i].x=u;
        a[i].y=v;
        a[i].id=i;
        b[i].x=u;
        b[i].y=v;
        b[i].id=i;
    }
    sort(a+1,a+1+n,com1);
    sort(b+1,b+1+n,com2);
    for(int i=1;i<=n-1;i++)
    {
        KK.AddEdge(a[i].id,a[i+1].id,abs(a[i].x-a[i+1].x));
        KK.AddEdge(b[i].id,b[i+1].id,abs(b[i].y-b[i+1].y));
    }
     ll ans = KK.kruskal();
     cout<<ans<<endl;
}

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

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a[3];
  for(int i=0; i<3; i++) cin >> a[i];
  sort(a, a+3);
  if((a[2] - a[0]) % 2 == 0 && (a[2] - a[1]) % 2 == 0){
    cout << (a[2] - a[0]) / 2 + (a[2] - a[1]) / 2 << endl;
  }else if(((a[2] - a[0]) % 2 == 0 && (a[2] - a[1]) % 2 != 0) || (a[2] - a[0]) % 2 != 0 && (a[2] - a[1]) % 2 == 0){
    cout << (a[2] - a[0]) / 2 + (a[2] - a[1]) / 2 + 2 << endl;
  }else{
    cout << (a[2] - a[0]) / 2 + (a[2] - a[1]) / 2 + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int a,b;
  std::cin >> a >> b;

  if(b < 0) {
    if((b - a)%2 == 0)
      std::cout << "Negative" << '\n';
    else
      std::cout << "Positive" << '\n';
    return 0;
  }

  if(a <= 0 && b >= 0) {
    std::cout << "Zero" << '\n';
    return 0;
  }

  else
    std::cout << "Positive" << '\n';
  return 0;
}


Measured memory_bytes: 256
#![allow(warnings)]
use std::collections::HashSet;
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

fn main() {
  let n: u64 = read();

  let a: Vec<u64> = read_vec();

  let a_len = &a.len();

  let uniq: HashSet<u64> = a.into_iter().collect();

  let uniq_len = uniq.len();

  let ans = {
    if a_len == &uniq_len {
      "YES"
    } else {
      "NO"
    }
  };
  println!("{}", ans);
}


Measured memory_bytes: 11440
n = int(input())
A = [int(x) for x in input().split()]
# 最初の所持金
money = 1000
# 所有株数
kabu_c = 0
# 予言で翌日上がるかどうかのリスト
l = list()
for i in range(n-1):
    if A[i+1] - A[i] > 0:
        l.append(1)
    else:
        l.append(0)
for idx, i in enumerate(l):
    # 翌日上がってかつその時の株価で買える所持金があるなら買う。
    if i == 1 and money - A[idx] >= 0:
        kabu_c = money // A[idx]
        money = money - (kabu_c * A[idx])
    # 翌日上がらないなら売っちゃう（その時点での利幅ゲット）
    if i == 0:
        money = money + (kabu_c * A[idx])
        kabu_c = 0
# 上がり調子だと最終日で売り切ってない可能性があるので所持している株は最終日で売り切る
if kabu_c > 0:
    money = money + (kabu_c * A[n-1])
print(money)


Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
void Main() {
    read();
    int K = read(), i = 1, ans = 0;
    vector<int> V;
    V.push_back(0);
    char c = getchar();
    while(c != '0' && c != '1'){
        c = getchar();
    }
    while(c == '0' || c == '1'){
        V.push_back(0);
        while (c == '1'){
            V[i]++;
            c = getchar();
        }
        i++;
        V.push_back(0);
        while (c == '0'){
            V[i]++;
            c = getchar();
        }
        i++;
    }
    int Vsize = V.size();
    for(int j = 1; j<Vsize; j++){
        V[j] += V[j-1];
    }
    for(int j = 1; j<Vsize; j += 2){
        ans = max(ans, V[min(j+2*K, Vsize-1)]-V[j-1]);
    }
    printf("%d\n", ans);
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}


Measured memory_bytes: 892
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s = str(readline().rstrip().decode('utf-8'))
    w = int(readline())
    ans = []
    for i in range(0, len(s), w):
        ans.append(s[i])
    print("".join(ans))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38256
n = int(input())
p = [int(c) for c in input().split()]

c = 0
for i in range(1,n-1):
    if p[i-1] < p[i] and p[i] < p[i+1]: c+=1
    if p[i-1] > p[i] and p[i] > p[i+1]: c+=1

print(c)

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

int main() {
  int N,K;
  string S;
  cin >> N>>K>>S;
  int dif=0;
  int hap =0;
  for(int i=0;i<N-1;i++){
    if(S[i+1]!=S[i]) dif++;
    else hap++;
  }
  //cout<<dif<<endl;
  //cout<<hap<<endl;

	dif -= K*2;
   hap += K*2;
  cout<<min(hap,N-1)<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    int n,k;
    cin>>n>>k;
    int ctr=0,steps=0;
    vector<int> curr(n,0),next(n,0),tran(n,0);
    for(int i=0;i<n;i++){
        cin>>curr[i];
        ctr+=(curr[i]<n?1:0);
    }

    while(steps<k && (ctr>0)){
        ctr=0;
        int start=0,tmp=0;
        for(int i=0;i<n;i++){
            if(i-curr[i]-1>=0){
                next[i-curr[i]-1]++;
            }
            else{
                start++;
            }

            if(i+curr[i]<n) next[i+curr[i]]--;
        }
        for(int i=0;i<n;i++){
            ctr+=((curr[i]=start)<n?1:0);
            start+=next[i];
            next[i]=0;
        }
        steps++;
    }
    
    for(int i=0;i<n;i++) cout<<curr[i]<<(i+1<n?" ":"\n");
}

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

    solve();
    return 0;
}

Measured memory_bytes: 5484
#include<iostream>
#include<string>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
    if(c=='R'){
      b=s[1];
      s[1]=s[2];
      s[2]=s[4];
      s[4]=s[3];
      s[3]=b;
    }    
  }
  int top() {
    return s[0];
  }
  int right(){
    return s[2];
  }
  int left(){
    return s[3];
  }
  int front(){
    return s[1];
  }
};
bool same(Dice a,Dice b){
  for(int i=0;i<6;i++) if(a.s[i]!=b.s[i]) return false;
  return true;
}
int main(){
  Dice d[100];
  int n;cin >> n;
  for(int j=0;j<n;j++) 
    for(int i=0;i<6;i++)
      cin >> d[j].s[i];
  
  bool ff = true;
  for(int k=0;k<n-1;k++){
    for(int l=k+1;l<n;l++){
      bool f=false;
      for(int i=0;i<4;i++){
	d[l].roll('R');
	for(int j=0;j<4;j++){
	  d[l].roll('N');
	  if(same(d[k],d[l])) f=true;
	}
      }
      d[l].roll('E');
      for(int j=0;j<4;j++){
	d[l].roll('N');
	if(same(d[k],d[l])) f=true;
      }
      
      d[l].roll('W');
      d[l].roll('W');
      for(int j=0;j<4;j++){
	d[l].roll('N');
	if(same(d[k],d[l])) f=true;
      }
      if(f) ff=false;
    }
  }
  
  cout << (ff?"Yes":"No") << endl;
  return 0;
}


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

int main() {
  int a,b,c;
  cin>>a>>b>>c;

  swap(a,b);
  swap(a,c);
  cout<<a<<" "<<b<<" "<<c<<endl;

}

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

#define vi vector<int>
#define ii pair<int,int>
#define vii vector<pair<int,int>>
#define vvi vector<vector<int>>

typedef long long ll;
typedef unsigned long long ull;

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

using namespace std;

int a,b;
int result = 0;

bool is_palindrome (int k) {
    string s = to_string(k);
    int i = 0;
    int j = s.length()-1;
    while (i <= j) {
        if (s[i] != s[j])
            return false;
        i++;
        j--;
    }
    return true;
}

int main (void) {
    ios_base::sync_with_stdio(false);

    cin >> a >> b;
    for (int i = a; i <= b; i++) {
        if (is_palindrome(i))
            result++;
    }

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
Alist = list(map(int, input().split()))
 
Alist = [[idx+1, a] for (idx, a) in enumerate(Alist)]
 
Alist.sort(key=lambda x:x[1])
 
ans = [str(a) for a, _ in Alist]
print(" ".join(ans))

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

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


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

  int n,m;
  cin >> n >> m;
  priority_queue<int> que;
  for(int i = 0;i < n;i++){
    int a;
    cin >> a;
    que.push(a);
  }
  for(int i = 0;i < m;i++){
    int a = que.top();
    que.pop();
    a /= 2;
    que.push(a);
  }
  ll ret = 0;
  while(!que.empty()){
    int a = que.top();
    que.pop();
    ret += a;
  }
  cout << ret << endl;
}


Measured memory_bytes: 892
x, n = map(int, input().split())
if n > 0:
    p = list(map(int, input().split()))
a = [True for i in range(102)]
for i in range(n):
    a[p[i]] = False
i = 0
while True:
    if a[x-i]:
        print(x-i)
        break
    if a[x+i]:
        print(x+i)
        break
    i += 1

Measured memory_bytes: 9200
//
//  main.cpp
//  AtCoder
//
//  Copyright © 2018年 ユーマ. All rights reserved.
//

#include <iostream>
#include <string>

using namespace std;

int main(int argc, const char * argv[]) {
    
    int a, b, c, x;
    int count = 0;
    
    cin >> a, cin >> b, cin >> c;
    cin >> x;
    
    for(int i = 0; i <= a ; i++){
        for(int j = 0; j <= b; j++){
            for(int k = 0; k <= c; k++){
                if(i * 500 + j * 100 + k * 50 == x){
                    count++;
                }
            }
        }
    }
    
    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>





using namespace std;
int main() {
	
	string s;
	cin >> s;
	if(s[5]=='1')cout << "TBD" << endl;
	else if (s[6] <= '4')cout << "Heisei" << endl;
	else cout << "TBD" << endl;


	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <queue>
#include <thread>
#include<bits/extc++.h>

using namespace __gnu_pbds;
#pragma GCC optimize("Ofast")

#define ll long long

#define gc (c = getchar())
#define gi(x) scanf("%d", &x)
#define gid(x, y) scanf("%d%d", &x, &y)
#define gll(x) scanf("%lld", &x)
#define glld(x, y) scanf("%lld%lld", &x, &y)
#define gllt(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define git(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define pi(x) printf("%d\n", x)
#define pr(x) return !(printf("%lld\n", (long long)(x)))
#define pcs(ch, cs, x) printf("Case %c%d: %d\n", ch, cs, x)
#define pllcs(ch, cs, x) printf("Case %c%d: %lld\n", ch, cs, x)
#define pcsyn(ch, cs, st) printf("Case %c%d: %s\n", ch, cs, (st) ? "Yes" : "No")
#define pyn(st) printf("%s\n", (st) ? "yes" : "no")
#define pryn(st) return !(printf("%s\n", (st) ? "YES" : "NO"))
#define pll(x) printf("%lld\n", x)
#define plld(x, y) printf("%lld %lld\n", x, y)

#define mp(x, y) std::make_pair(x, y)
#define fcs(x) while (x--)
#define dbg(x) std::cerr << #x << " " << x << std::endl
#define fi freopen("in.txt", "r", stdin)
#define fo freopen("out.txt", "w", stdout)
#define siz(x) (int)x.size()
#define pb(x) push_back(x)

inline long long max(long long x, long long y) { return x > y ? x : y; }

inline long long min(long long x, long long y) { return x > y ? y : x; }

long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }


const int maxn = 1e6 + 5;

int pc;
bool pv[maxn];
int pl[maxn];
void sieve(){
    pv[1] = true;
    for (int i = 2; i <= maxn - 5; ++ i){
        if (!pv[i]) pl[++ pc] = i;
        for (int j = 1; j <= pc && i * pl[j] <= maxn - 5; ++ j){
            pv[i * pl[j]] = true;
            if (i % pl[j] == 0) break;
        }
    }
}

std::map<int, int> vis;
void fac(int x){
    if (!pv[x]) {
        vis[x] ++;
        return;
    } 
    for (int i = 1; pl[i] * pl[i] <= x; ++ i){
        if (!(x % pl[i])) {
            vis[pl[i]] ++;
            while(!(x % pl[i]))  {
                x /= pl[i];
            }
        }
    }
    if (x != 1) vis[x] ++;
}
int seq[maxn];
int main(){
    int n;
    sieve();
    gi(n);
    for (int i = 1; i <= n; ++ i) {
        gi(seq[i]);
        fac(seq[i]);
    }
    bool pr = true;
    for (auto &it : vis){
        if (it.second == n) {
           // dbg(it.first);
            return !(printf("not coprime\n"));
        }else if (it.second > 1) pr = false;
    }
    if (!pr) puts("setwise coprime");
    else puts("pairwise coprime");
}


Measured memory_bytes: 12544
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <unordered_map>
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned int uint;


int main(int argc, char const *argv[])
{
    int n;
    cin >> n;

    char src1[128];
    char src2[128];

    scanf("%s %s",src1,src2);

    for(int i = 0;i < n;i++)
    {
        printf("%c%c",src1[i],src2[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.function.IntPredicate;
 
public class Main{
	
	int N;
	String[] S;
	public void solve(){
		N = nextInt();
		S = new String[N];
		for(int i = 0; i < N; i++){
			S[i] = next();
		}
		int[] crr = count(S[0]);
		for(int i = 1; i < N; i++){
			int[] nn = count(S[i]);
			for(int j = 0; j < nn.length; j++){
				crr[j] = Math.min(crr[j], nn[j]);
			}
		}
		for(int i = 0; i < crr.length; i++){
			for(int j = 0; j < crr[i]; j++){
				out.print((char)i);
			}
		}
		out.println();
	}
	
	public int[] count(String str){
		int[] cnt = new int[256];
		for(int i = 0; i < str.length(); i++){
			cnt[str.charAt(i)]++;
		}
		return cnt;
	}
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

Measured memory_bytes: 21332
#include <cstdio>
#include <vector>

typedef long long int ll;

const int MAXN = 1e5 + 5;
const int mod = 1e9 + 7;

int n, k, u, v;
ll ans;
ll dp[MAXN];

std::vector<int> con[MAXN];

void ins(int s, int e) {
    con[s].push_back(e);
}

void get_dp(int nv, int fa) {
    int tmp = (nv == 1) ? (k - 1) : (k - 2);
    for (int i = 0; i < con[nv].size(); ++i) {
        if (con[nv][i] == fa) continue;
        else {
            dp[con[nv][i]] = tmp;
            get_dp(con[nv][i], nv);
            --tmp;
        }
    }
}

int main() {
    scanf("%d %d", &n, &k);
    for (int i = 1; i < n; ++i) {
        scanf("%d %d", &u, &v);
        ins(u, v);
        ins(v, u);
    }
    dp[1] = k;
    get_dp(1, 0);
    ans = 1;
    for (int i = 1; i <= n; ++i) {
        ans = ans * dp[i] % mod;
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <set>
#include <string>
#include <cstdlib>
#include <utility>

using namespace std;


int main() {
    typedef set<string> set_t;
    set_t A;
    int n;
    cin >> n;
    string order, word;
    
    for(int i = 0; i< n; i++)
    {
        cin >> order >> word;
        if(order=="insert")
        {
            A.insert(word);
        }
        else if(order=="find")
        {
            if(A.count(word) > 0)
                cout << "yes" << endl;
            else
                cout << "no" << endl;
        }
        
    }
    
    return 0;
}

Measured memory_bytes: 32568
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    static Map<Integer, List<Integer>> map;
    static long ans = 0;
    static int[] keys;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt(), W = in.nextInt();
        map = new HashMap<>();
        for (int i = 0; i < N; i++) {
            int w = in.nextInt(), v = in.nextInt();
            if(!map.containsKey(w)) {
                List<Integer> list = new ArrayList<>();
                list.add(v);
                map.put(w, list);
            } else {
                map.get(w).add(v);
            }
        }
        keys = new int[map.keySet().size()];
        int idx = 0;
        for (int key: map.keySet()) {
            keys[idx++] = key;
        }
        map.keySet().stream()
                .map(key -> map.get(key))
                .forEach(list -> Collections.sort(list, Collections.reverseOrder()));
        solve(W, 0, 0, 0L);
        System.out.println(ans);
    }
    public static void solve(int W, int idx, int wSum, long vSum) {
        if(idx == keys.length) {
            ans = Math.max(ans, vSum);
        } else {
            solve(W, idx+1, wSum, vSum);
          for(int v : map.get(keys[idx])) {
              if(W - wSum < keys[idx]) return;
              wSum += keys[idx];
              vSum += (long)v;
              solve(W, idx+1, wSum, vSum);
          }
        }
    }
}

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

#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

typedef long long ll;
const int mod = 1e9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
typedef pair<int, int> ii;

void solve()
{
  int n;cin>>n;
  vector<vector<ii>> graph(n);
  for (int i=0; i<n-1; i++) {
    int u,v,w; cin>>u>>v>>w;
    graph[u-1].push_back(ii(v-1, w));
    graph[v-1].push_back(ii(u-1, w));
  }
  vector<int> ans(n, 0);
  queue<int> que;
  vector<int> checked(n, 0);
  que.push(0);
  checked[0] = 1;
  while(!que.empty()) {
    int t=que.front();
    que.pop();
    for (auto& i: graph[t]) {
      if (checked[i.first]) continue;
      que.push(i.first);
      ans[i.first] = (ans[t] + i.second) % 2;
      checked[i.first] = 1;
    }
  }
  for (int i=0; i<n; i++) {
    cout << ans[i] << endl;
  }
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 7168
N = int(input())

A = list(map(int, input().split()))

m = 1

A.sort()
if A[0] == 0:
    print(0)
    exit(0)


for a in A:
    m = m * a

    if m > 1000000000000000000:
        print(-1)
        exit(0)



print(m)

Measured memory_bytes: 21608
import sys

read = sys.stdin.read

n, m, *a = map(int, read().split())
mod = 1000000007
dp = [0] * (n+1)
dp[0] = 1
if a and a[0] == 1:
    dp[1] = 0
    a.pop(0)
else:
    dp[1] = 1
for i in range(2, n+1):
    if a and i == a[0]:
        a.pop(0)
        dp[i] == 0
    else:
        dp[i] = (dp[i-1] + dp[i-2]) % mod
print(dp[-1])


Measured memory_bytes: 13940
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  rep(i, n) {
    int x, l;
    cin >> x >> l;
    a[i] = {x-l, x+l};
  }
  sort(a.begin(), a.end(), [](auto x, auto y) {
    if (x.second == y.second)
      x.first > y.first;
    return x.second < y.second;
  });
  int r = -INF, ans = 0;
  rep(i, n) {
    if (r <= a[i].first) {
      ans++;
      r = a[i].second;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
//
//  main.cpp
//  cf
//
//  Created by Aviram Magen on 12/03/2019.
//  Copyright © 2019 Aviram Magen. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, const char * argv[]) {
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        arr[i]--;
    }
    vector<int> res;
    while (arr.size()!=0) {
        bool found=false;
        int i=arr.size()-1;
        for(;i>=0;i--)
        {
            if(arr[i]==i)
            {
                res.push_back(i);
                found=true;
                break;
                
            }
        }
        if(found==false)
        {
            cout<<-1;
            return 0;
        }
        arr.erase(arr.begin()+i);
            
    }
    reverse(res.begin(), res.end());
    for(int i=0;i<n;i++)
    {
        cout<<res[i]+1<<endl;
    }

    return 0;
}


Measured memory_bytes: 256