akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i , n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
#include <bits/stdc++.h>
int main() {
    int a , b , c;
    cin >> a >> b >> c;
    if(a == b){
        cout << c << endl;
    }
    else if(b == c){
        cout << a << endl;
    }
    else{
        cout << b << endl;
    }
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define LIM 100000
int main(void){

   //init is_prime table
   bool is_prime[LIM + 1] = {true};  fill(is_prime, is_prime+LIM+1, true);
   is_prime[0] = false, is_prime[1] = false;

   for(int i = 2 ; i <= LIM ; i++){
      if(is_prime[i]){
         int keep = i;
         for(int j = 2 ; j * keep <= LIM ; j++) is_prime[j * keep] = false;
      }
   }

   int primes[LIM + 1] = {0};  //i番目までの2017-like数の数
   for(int i = 1 ; i <= LIM ; i++){
      if(is_prime[i] && is_prime[(i + 1) / 2])  primes[i] = primes[i - 1] + 1;
      else                                      primes[i] = primes[i - 1];
   }

   int Q; cin >> Q;
   for(int i = 0 ; i < Q ; i++){
      int l, r;  cin >> l >> r;
      cout << primes[r] - primes[l] + ((is_prime[l] && is_prime[(l + 1) / 2]) ? 1 : 0) << endl;
   }

   return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    int N,K; cin>>N>>K;
    map<int,int> cnt;
    REP(i,N){
        int a; cin>>a;
        cnt[a]++;
    }

    int ans=0;
    if(cnt.size()>K){
        vint v;
        for(auto p:cnt){
            v.push_back(p.second);
        }
        sort(ALL(v));
        REP(i,cnt.size()-K){
            ans+=v[i];
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 14964
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
//max_element

int N, K;
int A[1010];

signed main()
{
	cin >> N >> K;
	REP(i, N) cin >> A[i];
	ARY_SORT(A, N);

	int ans = 0;
	REP(i, K) ans += A[i];
	cout << ans << endl;
}



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

namespace ABC072C
{
    class Program
    {
        static void Main(string[] args)
        {
            new Solver().Solve();
        }
    }

    class Solver
    {
        int N;
        int[] a;

        public void Solve()
        {
            // S[x] : ai = x となるaiの数
            Dictionary<int, int> S = new Dictionary<int, int>();

            // S をセット
            foreach (int ai in a) {
                if (S.ContainsKey(ai)) {
                    S[ai]++;
                }
                else {
                    S[ai] = 1;
                }
            }

            // 拡大定義域
            HashSet<int> DIx = new HashSet<int>();

            foreach (var expandedKey in S.Keys.Select(x => new Tuple<int, int, int>(x - 1, x, x + 1))) {
                DIx.Add(expandedKey.Item1);
                DIx.Add(expandedKey.Item2);
                DIx.Add(expandedKey.Item3);
            }

            // I[x] : 操作後のai = x となりうるiの数
            Dictionary<int, int> I = new Dictionary<int, int>();

            // I[x] = S[x-1] + S[x] + S[x+1]
            foreach (int x in DIx) {
                int value;
                S.TryGetValue(x - 1, out value);
                I[x] = value;
                S.TryGetValue(x, out value);
                I[x] += value;
                S.TryGetValue(x + 1, out value);
                I[x] += value;
            }

            int ans = I.Values.Max();
            Console.WriteLine(ans);
        }

        public Solver()
        {
            N = ReadInt();
            a = ReadIntArray();
        }

        static String ReadString() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static String[] ReadStringArray() { return Console.ReadLine().Split(' '); }
        static int[] ReadIntArray() { return Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray(); }
        static long[] ReadLongArray() { return Console.ReadLine().Split(' ').Select(e => long.Parse(e)).ToArray(); }
        static double[] ReadDoubleArray() { return Console.ReadLine().Split(' ').Select(e => double.Parse(e)).ToArray(); }
    }

}


Measured memory_bytes: 29532
#pragma GCC optimize ("-O3")
#ifdef LOCAL
  #include "helper_funcs.hpp"
#else
  #include <bits/stdc++.h>
#endif
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define frn(i,a,b) for(ll i=a;i<b;i++)
#define rfrn(i,a,b) for(ll i=a;i>b;--i)
#define forn(i,a,b) for(ll i=a;i<=b;i++)
#define rforn(i,a,b) for(ll i=a;i>=b;--i)
#define sqfrn(i,a,b) for(ll i=a;i*i<b;i++)
#define sqforn(i,a,b) for(ll i=a;i*i<=b;i++)
#define frt(it,v) for(auto &it:v)
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define SQR(a) (a)*(a)
#define SUM(n) ((n)*(n+1))/2
// #define SqSUM(n) ((n)*(n+1)*(2*n+1))/2
// #define GMSUM(a,r,n) (a*pow(r,n)-a)/(r-1)
#define ciel(x, y) (((x) / (y)) + ((x) % (y) != 0))
#define input(v,a,b) for(ll i = a ; i<b ; i++) cin>>v[i]
#define output(v,a,b) cout<<"["<<#v<<"]: "; for(ll i = a ; i<b ; i++) cout<<v[i]<<" "; cout<<ln
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl
#define dbg(x) cerr << #x << "is" << (x) << endl
#define leadzero(a) __builtin_clz(a)      // count leading zeroes
#define trailzero(a) __builtin_ctz(a)     // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln "\n"
const long long int md = 998244353;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;
typedef vector<ll> v1;
typedef vector<vector<ll > > vv2;
#define M 32
#ifndef M_PI
  #define M_PI 3.14159265358979323846
#endif
typedef bitset<M> btst;
typedef priority_queue<int, vector<int>, greater<int>> min_heap;
typedef priority_queue<int, vector<int>> max_heap;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
//     indexed_set;
const ll MAX = LONG_MAX;
const ll lrg = 1000000007;

void solve()
{
  ld a,b,v,w,t;
  cin>>a>>v;
  cin>>b>>w;
  cin>>t;
  if(a==b||(v>w&&abs(a-b)/(v-w)<=t))
  {
    cout<<"YES";
  }
  else
    cout<<"NO";
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); 
  int t=1,cp;
  // cin>>t;
  cp=t;
  while(t--){
   // cout<<"Case #"<<cp-t<<": ";
   solve();
   cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define ld  long double
#define pb push_back
#define fe first
#define se second
#define pii pair<int,int>
#define PI  3.14159265358979323846

const int N=1e4;
int dp[N][N];
string s1,s2;
int n,m;

int main()
{ cool;
 cin>>s1>>s2;  
 s1="#"+s1;
 s2="#"+s2;
 int n=s1.size()-1;
 int m=s2.size()-1;
 string s;
 int cnt=0;

  for(int i=1;i<=n;i++)
  	 { for(int j=1;j<=m;j++)
  	 	 { 
  	 	   if(s1[i] == s2[j])
  	 	   	{ 
  	 	   	  dp[i][j]=max( {dp[i-1][j-1]+1,dp[i-1][j],dp[i][j-1] });  	 	   	   
  	 	   	 // cout<<s1[i-1];  	 	   		 	   	     	 	  
  	 	    }

  	 	  else
  	 	     dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
  	 	    
  	     }
  	 }  	 
  	 
  	cnt=dp[n][m];
  	int i=n,j=m;

  	while(1)
  		 { if(cnt==0)
  		 	 break;
  		   else if(dp[i-1][j-1]+1==dp[i][j] && s1[i]==s2[j])
  		     { s+=s1[i];
  		     	i--;
  		     	j--;
  		     	--cnt;
  		     }
  		   else if(dp[i][j]==dp[i-1][j])
  		     --i;
  		   else if(dp[i][j]==dp[i][j-1])
  		    --j;  	 

  		 }
  	  	 reverse(s.begin(),s.end());
  	  	 if(s.size()==0)
  	  	 	{ cout<<" "<<endl;
  	  	      return 0;
  	  	    }  
  	  	 cout<<s;     
  	

  	 return 0;
}

Measured memory_bytes: 117888
#include <bits/stdc++.h>
#define inf (long long)(1e18)
using namespace std;

long long n;
vector<long long> a, pre, suf;

long long solve();

int main() {
  cin >> n;
  a.resize(n);
  for (auto& p : a) cin >> p;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  auto calc = [](vector<long long>& v) {
    int len = 15;
    vector<long long> res(n + 1, inf);
    vector<vector<long long>> dp(n + 1, vector<long long>(len + 1, inf));
    res[n] = res[n - 1] = 0;
    for (int i = 0; i <= len; ++i) dp[n - 1][i] = i;
    for (int i = n - 2; i >= 0; --i) {
      long long now = v[i];
      for (int j = 0; j <= len; ++j) {
        long long nxt = v[i + 1];
        for (int k = 0; k <= 60; ++k) {
          if (now <= nxt) {
            if (k <= len)
              dp[i][j] = dp[i + 1][k] + j;
            else
              dp[i][j] = dp[i + 1][len] + (k - len) * (n - 1 - i) + j;
            break;
          }
          nxt <<= 2;
        }
        assert(dp[i][j] != inf);
        now <<= 2;
      }
      res[i] = dp[i][0] << 1;
    }
    return res;
  };
  suf = calc(a);
  reverse(a.begin(), a.end());
  for (auto& p : a) p *= 2;
  pre = calc(a);
  reverse(pre.begin(), pre.end());
  for (int i = 0; i <= n; ++i) pre[i] += i;
  long long res = inf;
  for (int i = 0; i <= n; ++i) res = min(res, pre[i] + suf[i]);
  return res;
}

Measured memory_bytes: 40688
// Target Expert 

/*
 * Author    : raj1307 - Raj Singh
 * Institute : Jalpaiguri Government Engineering College
 * Date      : 28.07.19
 */

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <iomanip>
 #include <memory.h>
#include <assert.h>
using namespace std;

//#define DEBUG
#ifdef DEBUG
#define deb(...) cerr<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
#define debarr(a,n) cerr<<#a<<" : ";for(int i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cerr<<#mat<<" :\n";for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}

#else
#define deb(...) {}
#define debarr(a,n) {}
#define debmat(mat,row,col) {}
#define endl "\n"
#endif

#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fr(i, a, b) for(int i = (a); i < (b); ++i)
#define fb(i, b, a) for(int i = (b); i > (a); --i)
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define int long long
#define pb push_back
#define sz(x) ((int)x.size())
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a>b) return b; else return a;}

const int mod = 1000*1000*1000+7;

int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}


const int N = 1e5 + 5;

int n,k;

int cache[N][4];
int a[N],b[N],c[N];

int dp(int pos,int act){

	if(pos>=n)
		return 0;

	else if(cache[pos][act]!=-1)
		return cache[pos][act];
	else{

		if(act==1)
			cache[pos][act]=max(a[pos]+dp(pos+1,2),a[pos]+dp(pos+1,3));
		else if(act==2)
			cache[pos][act]=max(b[pos]+dp(pos+1,1),b[pos]+dp(pos+1,3));
		else if(act==3)
			cache[pos][act]=max(c[pos]+dp(pos+1,2),c[pos]+dp(pos+1,1));

		return cache[pos][act];

	}

	



}








void solve(){


	cin>>n;
	fr(i,0,n){ 
		cin>>a[i];
	 	cin>>b[i];
	 	cin>>c[i];
	}

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


	
	cout<<max(dp(0,1),max(dp(0,2),dp(0,3)));






	
	

}




signed main() {
	fio;
	
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--) {
		solve();
	}

	
	return 0;
}


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

#define llong long long 
#define ii pair<int, int>
#define fir first
#define sec second
#define len(x) ((int)x.size())
#define rep(i,n) for (int i = -1; ++i < (n);)
#define rep1(i,n) for (int i = 0; i++ < (n); )

template<typename t>/*{{{*/
ostream& operator<<(ostream& cout, const vector<t>& a) {
  cout << "[";
  rep(i, len(a)) cout << a[i] << ", ";
  return cout << "]";
}

template<typename u, typename v>
ostream& operator<<(ostream& cout, const pair<u, v>& t) {
  return cout << "(" << t.fir << ", " << t.sec << ")";
}/*}}}*/

#define rem ((llong)1e9 + 7)
#define maxn 101010
string s;
int cnt[maxn][4];

llong p3[maxn];
void calp3() {
  p3[0] = 1;
  rep1(i, maxn - 1) (p3[i] = p3[i - 1] * 3) %= rem;
}

llong numway(int u, int v) {
  llong ans = u * p3[v] % rem;
  if (v) (ans += v * p3[v - 1]) %= rem;
  //clog << u << ' ' << v << ' ' << ans << endl;
  return ans;
}

int main() {
  calp3();
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin >> s;
  //clog << s << endl;
  rep1(i, len(s)) {
    char c = s[i - 1];
    if (c == '?') cnt[i][3] ++;
    else cnt[i][c - 'A'] ++;
    rep(f, 4) cnt[i][f] += cnt[i - 1][f];
  }
  llong ans = 0;
  int n = len(s);
  rep1(i, len(s)) {
    char c = s[i - 1];
    if (c != 'B' and c != '?') continue;
    llong u = numway(cnt[i - 1][0], cnt[i - 1][3]);
    llong v = numway(cnt[n][2] - cnt[i][2], cnt[n][3] - cnt[i][3]);
    (ans += u * v % rem) %= rem;
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 2896
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    square=[0]+[input() for i in range(N)]
    roll=[input() for i in range(M)]
    plc,cnt=1,0
    for i in roll:
        plc+=i
        cnt+=1
        if plc<N:
            plc+=square[plc]
        if plc>=N:
            print cnt
            break

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

int n, a, x[55];
ll dp[55][5050];

int main() {
    cin >> n >> a;
    rep(i, n) cin >> x[i];

    int M = a;
    rep(i, n) chmax(M, x[i]);

    rep(i, n) x[i] -= a;
    dp[0][n*M] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= 2*n*M; j++) {
            if (j - x[i] < 0 || j - x[i] > 2*n*M) {
                dp[i+1][j] = dp[i][j];
            } else {
                dp[i+1][j] = dp[i][j] + dp[i][j-x[i]];
            }
        }
    }
    cout << dp[n][n*M] - 1 << endl;
}


Measured memory_bytes: 2176
#include<stdio.h>

int main(){

  int data[100000];
  int search[50000];

  int i,j,sumdata,sumsearch,left,right,mid,count;

  count = 0;
  left = 0;

  scanf("%d",&sumdata);

  right = sumdata;


  for(i = 0; i < sumdata; i++){

    scanf("%d",&data[i]);

  }

  scanf("%d",&sumsearch);

  for(i = 0; i < sumsearch; i++){

    scanf("%d",&search[i]);

  }



  for(i = 0; i < sumsearch; i++){

    left = 0;
    right = sumdata;


    while(left < right){

      mid = (left + right) / 2;

      if(data[mid] > search[i]){

	right = mid;

      }

      else if(data[mid] < search[i]){

	left = mid + 1;

      }

      else if(data[mid] == search[i]){

	count = count + 1;

	left = 0;
	right = sumdata;
	break;


      }

    }

  }

  printf("%d\n",count);

  return 0;

}

Measured memory_bytes: 1184
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
#define N 100010
vector<int> V[N];
int n;
int parent[N];//记录父结点
int dis_from_1[N];
void DFS(int start,int pre)
{
    dis_from_1[start]=dis_from_1[pre]+1;
    for(int i=0;i<V[start].size();i++)
    {
        int next=V[start][i];
        if(next!=pre) 
        {
            parent[next]=start;//确定父结点
            DFS(next,start);
        }
    }
}
int S_count;
void DFS_for_count(int start,int pre)
{
    S_count++;
    //cout<<"start: "<<start<<" pre:"<<pre<<endl;
    for(int i=0;i<V[start].size();i++)
    {
        int next=V[start][i];
        //cout<<"next:"<<next<<endl;
        if(next!=pre) 
        {
            DFS_for_count(next,start);
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>n)
    {
        for(int i=1;i<=n;i++) V[i].clear();
        int a,b;
        for(int i=1;i<=n-1;i++)
        {
            cin>>a>>b;
            V[a].push_back(b);
            V[b].push_back(a);
        }
        dis_from_1[0]=-1;
        DFS(1,0);
        int k=dis_from_1[n]-1;//路径点数
        int cur_point=n;
        int cnt=0;//S
        int now_parent=parent[n];
        while(1)
        {
            if(cnt>=k-ceil(k/2.0)||now_parent==1)   break; //找到分界点或强制退出
            cur_point=now_parent;
            now_parent=parent[cur_point];
            cnt++;
        }
        //cout<<"cur_point:"<<cur_point<<"now_parent:"<<now_parent<<endl;
        S_count=0;
        DFS_for_count(cur_point,now_parent);
        //cout<<"F:"<<n-S_count<<endl;
        //cout<<"S:"<<S_count<<endl;
        if(n>2*S_count) cout<<"Fennec"<<endl;
        else cout<<"Snuke"<<endl;
    }
}

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

digit = (len(str(N)))
#print(digit)

if digit == 1:
  print(N)
elif digit == 2:
  print(9)
elif digit == 3:
  print(N - 99 + 9)
elif digit == 4:
  print(909)
elif digit == 5:
  print(N - 9999 + 999 - 99 + 9)
else:
  print(90909)
  

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repi(i,x,n) for(ll i=x;i<(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    int a;cin>>a;
    string s;cin>>s;
    if(a>=3200)cout<<s<<endl;
    else cout<<"red"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<vector<int>> cards(3, vector<int>(3));
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> cards.at(i).at(j);
        }
    }
    vector<vector<bool>> checked(3, vector<bool>(3, false));
    ll N;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int b;
        cin >> b;
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < 3; k++)
            {
                if (cards.at(j).at(k) == b)
                {
                    checked.at(j).at(k) = true;
                }
            }
        }
    }
    string answer = "No";
    for (int i = 0; i < 3; i++)
    {
        if (checked.at(i).at(0) && checked.at(i).at(1) && checked.at(i).at(2))
        {
            answer = "Yes";
            break;
        }
        else if (checked.at(0).at(i) && checked.at(1).at(i) && checked.at(2).at(i))
        {
            answer = "Yes";
            break;
        }
    }
    if(checked.at(0).at(0) && checked.at(1).at(1) && checked.at(2).at(2))
    {
        answer = "Yes";
    }
    if(checked.at(0).at(2) && checked.at(1).at(1) && checked.at(2).at(0))
    {
        answer = "Yes";
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cctype>
#include<algorithm>
#include<cstring>
#include<iomanip>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<vector>
#include<stack>
#include<cmath>
#include<random>
//This code is written by Itst
using namespace std;

inline int read(){
    int a = 0;
    char c = getchar();
    bool f = 0;
    while(!isdigit(c) && c != EOF)
        c = getchar();
    if(c == EOF)
        exit(0);
    while(isdigit(c)){
	a = a * 10 + c - 48;
        c = getchar();
    }
    return f ? -a : a;
}

int d[12][12] , f[107][107];

signed main(){
    int A = read() , B = read();
    for(int i = 1 ; i <= A ; ++i)
	for(int j = 1 ; j <= B ; ++j)
	    d[i][j] = read();
    for(int i = 0 ; i <= 100 ; ++i)
	for(int j = 0 ; j <= 100 ; ++j)
	    for(int p = 1 ; p <= A ; ++p)
		for(int q = 1 ; q <= B ; ++q)
		    f[i][j] = max(f[i][j] , d[p][q] - i * p - j * q);
    for(int i = 1 ; i <= A ; ++i)
	for(int j = 1 ; j <= B ; ++j){
	    int minN = 1e9;
	    for(int p = 0 ; p <= 100 ; ++p)
		for(int q = 0 ; q <= 100 ; ++q)
		    minN = min(minN , f[p][q] + p * i + q * j);
	    if(minN != d[i][j]){
		puts("Impossible");
		return 0;
	    }
	}
    puts("Possible");
    puts("202 10401");
    for(int i = 1 ; i <= 100 ; ++i)
	printf("%d %d X\n" , i , i + 1);
    for(int i = 102 ; i < 202 ; ++i)
	printf("%d %d Y\n" , i , i + 1);
    for(int i = 0 ; i <= 100 ; ++i)
	for(int j = 0 ; j <= 100 ; ++j)
	    printf("%d %d %d\n" , 1 + i , 202 - j , f[i][j]);
    puts("1 202");
    return 0;
}


Measured memory_bytes: 384
// One out of Three

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(){
	int A, B, C;
	cin >> A >> B >> C;

	if (A != B && A != C)
		cout << A << endl;
	else if (B != A && B != C)
		cout << B << endl;
	else
		cout << C << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n,t,i,MIN,MAX,r[200000];
  scanf("%d",&n);
  scanf("%d %d",&r[0],&r[1]);
  if(r[0]<r[1]){
    MIN=r[0];
  } else {
    MIN=r[1];
  }
  MAX=r[1]-r[0];
  for(i=2;i<n;i++){
    scanf("%d",&r[i]);
    if(MAX<r[i]-MIN){
      MAX=r[i]-MIN;
    }
    if(MIN>r[i]){
      MIN=r[i];
    }
  }
  printf("%d\n",MAX);
  return 0;
}

Measured memory_bytes: 3480
N = int(input())
t = [0] * (N + 1)
x = [0] * (N + 1)
y = [0] * (N + 1)
for i in range(N):
    t[i + 1], x[i + 1], y[i + 1] = map(int, input().split())
# print(t, x, y)
can = True
for n in range(N):
    if x[n + 1] + y[n + 1] - x[n] - y[n] > t[n + 1] - t[n]:
        print("No")
        exit()
    elif (x[n + 1] + y[n + 1] - x[n] - y[n]) % 2 == (t[n + 1] - t[n]) % 2:
        pass
    else:
        can = False

if not can:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 11636
#include <cstdio>
#define MAXN 305
using namespace std;

double dp[MAXN][MAXN][MAXN];

void solve(int n) {
    int sum = 0;
    for (int k = 0; k < MAXN; ++k) {
        for (int j = 0; j + k < MAXN; ++j) {
            for (int i = 0; i + j + k < MAXN; ++i) {
                sum = i + j + k;
                if (!sum) continue;
                dp[i][j][k] += 1. * n / sum;  // wait operations till hit 1, 2 or 3
                if (i) dp[i][j][k] += dp[i - 1][j][k] * (1. * i / sum);  // 
                if (j) dp[i][j][k] += dp[i + 1][j - 1][k] * (1. * j / sum);
                if (k) dp[i][j][k] += dp[i][j + 1][k - 1] * (1. * k / sum);
            }
        }
    }
}

void debug(int I, int J, int K, int n) {
    for (int i = 0; i <= I; ++i, putchar('\n')) {
        for (int j = 0; j <= J; ++j, putchar('\n')) {
            for (int k = 0; k <= K; ++k) {
                printf("%.4lf ", dp[i][j][k]);
            }
        }
    }
}

int main() {
    int i, j, k;
    i = j = k = 0;
    int n, temp;
    scanf("%d", &n);
    for (int _ = 0; _ < n; ++_) {
        scanf("%d", &temp);
        switch(temp) {
            case 1: ++i; break;
            case 2: ++j; break;
            case 3: ++k; break;
            default: break;
        }
    }
    solve(n);
    printf("%.10lf\n", dp[i][j][k]);
    return 0;
}

Measured memory_bytes: 221312
#include<bits/stdc++.h>
using namespace std;
int main() {
int N,L;
cin>>N>>L;
vector<string> S(N);
for(int i=0;i<N;i++)cin>>S.at(i);
string temp;
sort(S.begin(),S.end());
for(int i=0;i<N;i++)temp+=S.at(i);
cout<<temp<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int a, b,c=0;
int s[10];
int main(){
    scanf("%d%d",&a,&b);
    for(int i=a;i<=b;i++){
        int idx=0, no=i;
        while(no){
            s[idx++]=no%10;
            no/=10;
        }
        bool is=1;
        for(int j=0;j<idx/2;j++){
            if(s[j]!=s[idx-j-1]){
                is=0;
                break;
            }
        }
        if(is) c++;
    }
    printf("%d",c);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)

int main(){
  ll N;
  cin >> N;
  double v[1000];
  rep(i,N) cin >> v[i];
  
  sort(v, v+N);
  
  rep(i, N-1) v[i+1] = (v[i+1]+v[i])/2;
    
  cout << v[N-1] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

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

  int count = 0;
  for (int i = 1; i < n-1; i++) {
    if ((p[i] > p[i-1] && p[i] < p[i+1]) || (p[i] < p[i-1] && p[i] > p[i+1])) {
      count++;
    }
  }

  printf("%d\n", count);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const int MOD=1e9+7;
const double pi=acos(-1);


int main(){
  ll s;
  cin >> s;
  ll x1,y1,x2,y2,x3,y3;
  ll M=1000000000;
  x1=0,y1=0;
  x2=M;
  y2=1;
  x3=(M-s%M)%M;
  y3=(s+x3)/M;
  cout << x1 << " " <<y1 <<" " <<x2<<" " << y2 << " " <<x3<< " " <<y3<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

template<typename T>
ll LongestIncreaseSubseq(vector<T>& vec) {

	vector<T> dp(vec.size());

	ll maxpos = 0;

	rep(i, vec.size()) {

		ll pos = lower_bound(dp.begin(), dp.begin() + maxpos, vec[i]) - dp.begin();

		if (pos == maxpos) {
			maxpos++;
			dp[pos] = vec[i];
		}
		else if (dp[pos] > vec[i]) dp[pos] = vec[i];

		debug(dp);

	}

	return maxpos;
}

void solve() {
	
	ll N, T;
	cin >> N >> T;

	vector<ll> vec(N);
	rep(i, N) cin >> vec[i];

	ll ans = 0;

	for (ll i = 0; i < N; i++) {
		if (i == N - 1) { ans += T; continue; }

		ans += min(T, vec[i + 1] - vec[i]);
	}

	cout << ans;
}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	return 0;
}


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

ll com(ll a){
  return a*(a+1)/2;
}

int main() {
  ll n,count=0,ans=0;
  cin>>n;
  vector<string> s(n);
  for(ll i=0; i<n; i++) {
    string t; cin>>t;
    sort(t.begin(),t.end());
    s[i] = t;
  }
  sort(s.begin(),s.end());
  for(ll i=0; i<n-1; i++){
    if(s[i]==s[i+1]) count++;
    else {
      ans += com(count);
      count=0;
    }
    if(i==n-2) ans += com(count);
  }
  cout<<ans;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,x;
	cin>>n>>m>>x;
	int a[100];
	int f=0,b=0;
	for(int i=0;i<m;i++){
		cin>>a[i];
		if(a[i]>x)b++;
		else if(a[i]<x)f++;
	}
	cout<<min(b,f)<<endl;
}
	


Measured memory_bytes: 256
var
 s:string;
begin
 readln(s);
 if (s='AKIHABARA') or (s='AKIHABAR') or (s='AKIHABRA') or (s='AKIHBARA') or (s='KIHABARA') or (s='AKIHABR') or (s='AKIHBAR') or (s='KIHABAR') or (s='AKIHBRA') or (s='KIHABRA') or (s='KIHBARA') or (s='AKIHBR') or(s='KIHABR') or (s='KIHBAR') or (s='KIHBRA'
) or (s='KIHBR') then writeln('YES')
  else writeln('NO');
end.


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <array>
using namespace std;

const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L() {};
};

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(abs(c)-abs(b) > EPS) return -2; //a-b-c
    return 0; //a-c-b
}

bool intersectSS(const L& a, const L& b){
    return ( ccw(a[0],a[1],b[0]) *ccw(a[0],a[1],b[1]) <= 0 ) &&
        ( ccw(b[0],b[1],a[0]) *ccw(b[0],b[1],a[1]) <= 0 );
}
bool intersectSP(const L& s, const P& p){
    return abs(s[0]-p) +abs(s[1]-p) -abs(s[1]-s[0]) < EPS;
}

P projection(const L& l, const P& p) {
  double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}

double distanceSP(const L &s, const P &p) {
  const P r = projection(s, p);
  if (intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0]-p), abs(s[1]-p));
}
double distanceSS(const L &s, const L &t) {
  if (intersectSS(s, t)) return 0;
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}

int main(){
	int n[2];
	vector<VP> p(2);
	for(int r=0; r<2; r++){
		cin >> n[r];
		p[r].resize(n[r]+2);
		for(int i=1; i<=n[r]; i++){
			int x,y;
			cin >> x >> y;
			p[r][i] = P(x, y);
		}
		n[r] += 2;
	}
	p[0][0] = P(0, 0);
	p[0][n[0]-1] = P(1000, 0);
	p[1][0] = P(0, 1000);
	p[1][n[1]-1] = P(1000, 1000);
	
	double ans = INF;
	for(int i=0; i<n[0]-1; i++){
		for(int j=0; j<n[1]-1; j++){
			ans = min(ans, distanceSS(L(p[0][i], p[0][i+1]), L(p[1][j], p[1][j+1])));
		}
	}
	cout << fixed;
	cout << setprecision(10);
	cout << ans << endl;
	return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep2(i, a, b) for(int i = a; i <= b; ++i)
#define ll long long
#define eb emplace_back
#define all(c) (c).begin(), (c).end()
#define vi vector<int>

int main() {
	int n, m;
	int x, y;
	vector<vector<int> >ans;
	cin >> n >> m;
	scc_graph g(n);
	rep(i, m) {
		cin >> x >> y;
		g.add_edge(x, y);
	}
	ans = g.scc();
	x = ans.size();
  	cout << x << endl;
	rep(i, x) {
		y = ans[i].size();
		cout << y;
		rep(j, y) {
			cout << " " << ans[i][j];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 40072
while True:
    line = input()
    if line == "-1 -1 -1":
        break
    lst = list(map(int, line.split()))
    
    if lst[0] == -1 or lst[1] == -1:
        print("F")
    elif lst[0] + lst[1] >= 80:
        print("A")
    elif lst[0] + lst[1] >= 65:
        print("B")
    elif lst[0] + lst[1] >= 50:
        print("C")
    elif lst[0] + lst[1] >= 30:
        if lst[2] >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")


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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define _sort(a) sort(a.begin(), a.end())
#define _sortd(a) sort(a.rbegin(), a.rend())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

int main() {
  int n;
  cin >> n;
  int a[100], c[100];
  for (int i = 1; i <= n; i++) {
    int d;
    cin >> d;
    a[i] = d;
  }

  // 全部食べた時の満足度の総数.
  int sum = 0;
  rep(i, n) {
    int d;
    cin >> d;
    sum += d;
  }

  for (int i = 1; i < n; i++) {
    int d;
    cin >> d;
    c[i] = d;
  }

  int before = a[1];
  for (int i = 2; i <= n; i++) {
    if (a[i] == before + 1) {
      sum += c[before];
    }
    before = a[i];
  }

  p(sum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int       long long
#define w(x)      int x;cin >> x;while (x--)
#define rep(d,a,n)  for(int d=a;d<=n;d++)
#define rep_(d,a,n)  for(int d=a;d>=n;d--)
#define nl        "\n" 
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define oj  freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
const int inf=1e18;

void fun(){
    int n;
    cin>>n;
    int ac=0,tle=0,wa=0,re=0;
    rep(i,0,n-1){
        string s;
        cin>>s;
        if(s=="AC"){
            ac++;
        }
        else if(s=="WA"){
            wa++;
        }else if(s=="RE"){
            re++;
        }else{
            tle++;
        }
    }
    cout<<"AC x "<<ac<<nl;
    cout<<"WA x "<<wa<<nl;
    cout<<"TLE x "<<tle<<nl;
    cout<<"RE x "<<re<<nl;

}
int32_t main()
{
    
    fast_io;
    fun();
    
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
// Prioridade
typedef long long   ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i = a; i < (int)(b); i++)
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define endl '\n'
#define mdc(a, b) (__gcd((a), (b)))
#define mmc(a, b) (((a)/__gcd(a, b)) * b)
#define W(x) cerr << "\033[31m"<<  #x << " = " << x << "\033[0m" << endl;
// fim da Prioridade

ll dp2[100001];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, sz;
	cin >> n >> sz;
	vector<ll> val(n), peso(n);
	for(int i = 0; i < n; i++){
		cin >> peso[i] >> val[i];
	}
 	memset(dp2,-0x3f,sizeof dp2);
	dp2[0] = 0;
	ll ans2 = -INFLL;
	for(int i = 1; i <= n; i++){
		for(int w = sz;w >= peso[i-1]; w--){
			dp2[w] = max(dp2[w], dp2[w-peso[i-1]] + val[i-1]);
			ans2 = max(dp2[w],ans2);
		}
	}
	cout << ans2 << endl;
	return 0;
}


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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int n,i,j,k,m,ans=0,a,b,mid;
    cin>>n>>m>>k;
    long long int A[n+1],B[m+1];
    A[0]=0;
    B[0]=0;
    for(i=1;i<=n;i++){
        cin>>A[i];
        A[i]+=A[i-1];
    }
    for(i=1;i<=m;i++){
        cin>>B[i];
        B[i]+=B[i-1];
    }
    for(i=1;i<=n;i++){
        if(A[i]>k)
            break;
        a=1;
        b=m;
        while(a<=b){
            mid=a+(b-a)/2;
            if(B[mid]==k-A[i]){
                a=mid+1;
                break;
            }
            else if(B[mid]>k-A[i])
                b=mid-1;
            else
                a=mid+1;
        }
        ans=max(ans,i+a-1);
    }
    for(i=1;i<=m;i++){
        if(B[i]>k)
            break;
        a=1;
        b=n;
        while(a<=b){
            mid=a+(b-a)/2;
            if(A[mid]==k-B[i]){
                a=mid+1;
                break;
            }
            else if(A[mid]>k-B[i])
                b=mid-1;
            else
                a=mid+1;
        }
        ans=max(ans,i+a-1);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 6780
#include<stdio.h>

void show(int a[], int n){
  int i;
  for(i=0; i<n-1; i++){
    printf("%d ", a[i]);
  }
  printf("%d", a[n-1]);
  printf("\n");
  return ;
}

void bubble(int a[], int n){
  int flag = 1;
  int j, temp;
  int cnt = 0;
  while(flag){
    flag = 0;
    for(j=n-1; j>0; j--){
      if(a[j] < a[j-1]){
        temp = a[j];
        a[j] = a[j-1];
        a[j-1] = temp;
        cnt++;
        flag=1;
      }
    }
  }
  show(a, n);
  printf("%d\n", cnt);
}

int main(){
  int n, i;
  int a[101];
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &a[i]);
  }
  bubble(a, n);
  return 0;
}

Measured memory_bytes: 1816
def valid(words):
  used = set()
  last = ""

  for w in words:
    if w in used:
      return False
    if last != "" and last[-1] != w[0]:
      return False
    last = w
    used.add(w)

  return True


n = int(input())
words = [input() for _ in range(n)]
print("Yes" if valid(words) else "No")


Measured memory_bytes: 3060
N = int(input())
S = []
for _ in range(N):
	t = ''.join(sorted(input()))
	S.append(t)
SS = sorted(S)
ans = 0
t = 0
import math
for i in range(1, N):
	if SS[i - 1] == SS[i]:
		t += 1
		ans += t
	else:
		t = 0
print(ans)


Measured memory_bytes: 17268
s = input()
if s == 'zyxwvutsrqponmlkjihgfedcba':
  print(-1)
  exit()
L = 26
s = [ord(c) - ord('a') for c in s]


memo = [False]*L
for c in s:
  memo[c] = True

lowerbound = 0
while all(memo[lowerbound:]):
  c = s.pop()
  lowerbound = c + 1
  memo[c] = False

for i in range(lowerbound,L):
  if not memo[i]:
    s.append(i)
    break

print(''.join(map(chr, [c + ord('a') for c in s])))



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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

using ll = long long;
ll cnt(const vector<ll> &v, ll d) {
    ll ret = 0;
    rep(i, v.size() - 1) if (abs(v[i] - v[i + 1]) == d) ret++;
    return ret;
}

ll n, m, d;
ll rec(vector<ll> v) {
    ll ret = 0;
    if (v.size() == m) {
        // rep(i, v.size()) cout << v[i] << " ";
        // cout << ": " << cnt(v, d) << endl;
        return cnt(v, d);
    }
    rep(i, n) {
        v.push_back(i + 1);
        ret += rec(v);
        v.pop_back();
    }
    return ret;
}

int main() {
    cin >> n >> m >> d;

    // ll ans = rec({});
    // cout << ans << endl;
    // cout << ans / pow(n, m) << endl;
    //
    if (d == 0) {
        printf("%.20f\n", 1.0 * (m - 1) / n);
    }
    else {
        ll base = (n - 1) * 2;
        // cout << "base = " << base << endl;
        base -= (d - 1) * 2;
        double ans = 1.0 * base / pow(n, 2);
        // printf("%.20f\n", ans);
        ans *= (m - 1);
        printf("%.20f\n", ans);
    }

    return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int64)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}


int main(void) {
    string s;
    while (cin >> s && s.size()) {
        string t[2] = {"JOI", "IOI"};
        int64 cnt[2] = {};
        REP(i, s.size()-2) {
            REP(j, 2)
                if (s.substr(i, 3) == t[j]) cnt[j]++;
        }
        cout << cnt[0] << endl << cnt[1] << endl;
    }
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
using namespace std;
//using namespace boost::multiprecision;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

vector<int> G[200'010];
int dist[200'010];
void dfs(int v, int p){
  for(int nv:G[v]){
    if(nv == p){
      continue;
    }
    dist[nv] = dist[v] + 1;
    dfs(nv, v);
  }
  return;
}

int main(){
  
  int n;
  cin>>n;
  int a[n-1],b[n-1];
  REP(i,n-1){
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }
  dist[0] = 0;
  dfs(0, -1);
  int c;
  int temp = 0;
  REP(i,n){
    if(temp < dist[i]){
      c = i;
      temp = dist[i];
    }
  }
  dist[c] = 0;
  dfs(c, -1);
  int d = 0;//直径
  REP(i,n){
    d = max(d, dist[i]);
  }
  if(d%3 == 1){
    cout<<"Second"<<endl;
  }else{
    cout<<"First"<<endl;
  }
  return 0; 
}


Measured memory_bytes: 19712
#include <bits/stdc++.h>
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int l_lim = 1, r_lim = n;
    for(int i = 0; i < m; i++){
        int l, r;
        cin >> l >> r;
        l_lim = MAX(l, l_lim);
        r_lim = MIN(r, r_lim);
    }
    if(r_lim >= l_lim){
        cout << r_lim - l_lim + 1<< endl;
    }
    else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

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

    int s,w;
    cin >> s >> w;
    cout << ((s > w) ? "safe" : "unsafe") << endl;
}

Measured memory_bytes: 3640
#!/usr/bin/env python3
#ABC80 D

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,C = LI()
cha = [[] for _ in range(C)]
ans = 0
lst = [0]*(10**5+2)
for _ in range(n):
    s,t,c = LI()
    cha[c-1].append([s,t])
for i in range(C):
    if len(cha[i]) == 0:
        continue
    cha[i].sort(key = itemgetter(0))
    s,t = cha[i][0]
    tmp = []
    for j in range(1,len(cha[i])):
        if t == cha[i][j][0]:
            t = cha[i][j][1]
        else:
            tmp.append([s,t])
            s,t = cha[i][j]
    tmp.append([s,t])
    for i,j in tmp:
        lst[i] += 1
        lst[j+1] -= 1
lst = list(accumulate(lst))
print(max(lst))


Measured memory_bytes: 67420
/**
 * KUPC
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		int[] count = new int[4];
		for (char c : br.readLine().toCharArray()) {
			switch (c) {
				case 'K':
					count[0]++;
					break;
				case 'U':
					count[1]++;
					break;
				case 'P':
					count[2]++;
					break;
				case 'C':
					count[3]++;
					break;
			}
		}
		int min = 301;
		for (int i : count) {
			min = Math.min(min, i);
		}
		System.out.println(min);
	} //end main
}

Measured memory_bytes: 17060