akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC         optimize("O3")
#include            <bits/stdc++.h>
#include            <ext/pb_ds/assoc_container.hpp>
#include            <ext/pb_ds/tree_policy.hpp>
#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define pb          push_back
#define mp          make_pair
#define mem(x,i)    memset(x,i,sizeof(x))
#define ff          first
#define ss          second
#define popcount(x) __builtin_popcount(x)
#define all(x)      x.begin(),x.end()
#define Case(t)     for(int ks=1;ks<=t;ks++)
#define fileout     freopen("output.txt","w",stdout)
#define filein      freopen("input.txt","r",stdin)
#define D(x)        cerr<< __LINE__ <<": "<< #x << " = "<<(x) <<'\n';
#define endl        '\n'

using namespace std;
//using namespace __gnu_pbds;

using ll  = long long;
using ld  = long double;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;

const int INF    = 0x3f3f3f3f;
const ll LL_INF  = 0x3f3f3f3f3f3f3f3f;
const double PI  = acos(-1);
const double eps = 1e-4;
const int mod    = 1e9+7;
const int mx     = 300005;
/*template <typename T>  using orderedSet =
    tree<T, null_type, less_equal<T>,
    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key*/

/*------------------------------Graph Moves----------------------------*/
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

//ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(; b; b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
/*----------------------BitMask-----------------------------------------*/
//inline int setBit(int N,int pos){return N=N | (1<<pos);}
//inline int resetBit(int N,int pos){return N= N & ~(1<<pos);}
//inline bool checkBit(int N,int pos){return (bool) (N& (1<<pos));}

int main()
{
   int n;
   cin>>n;
   vector<ll>vec(n);
   for(int i=0;i<n;i++) cin>>vec[i];
   sort(all(vec),greater<int>());
   ll ans=vec[0];
   for(int i=1;i<n/2;i++) ans+=vec[i]*2;
   if(n%2) ans+=vec[n/2];
   cout<<ans<<endl;
}



Measured memory_bytes: 4812
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	D, N := getInt(), getInt()

	x := 1
	for i := 0; i < D; i++ {
		x *= 100
	}

	y := 0
	cnt := 0
	for {
		y += x
		if y%(x*100) == 0 {
			continue
		}
		cnt++
		if cnt == N {
			break
		}
	}

	// for i := 0; i < N; i++ {
	// 	y += x
	// }

	// if x*100 == y {
	// 	y += x
	// }
	out(y)
}


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

int main()
{
	char c11, c12, c13, c21, c22, c23;
	cin >> c11 >> c12 >> c13;
	cin >> c21 >> c22 >> c23;
	
	if (c11 == c23 and c12 == c22 and c13 == c21)
		cout << "YES";

	else
		cout << "NO";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;


int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    
    
    if( a+b == c || a+c == b || b+c == a ) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    
    return 0;
}

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

int main(){
  string S,T;
  cin >> S;
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='0'){
      T.push_back('0');
    }
    else if(S.at(i)=='1'){
      T.push_back('1');
    }
    else if(T.size()!=0){
      T.pop_back();
    }
  }
  cout << T << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iostream>
#include <list>
#include <functional>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int a, b;
	scanf("%d %d", &a, &b);
	if (b != 100)
	{
		printf("%d", b);
		for (int i = 0; i < a; i++)
		{
			printf("00");
		}
	}
	else
	{
		if (a == 0)printf("101");
		else if (a == 1)printf("10100");
		else printf("1010000");
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

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

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

std::map< int64_t, int > prime_factor(int64_t n) {
  std::map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

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

  auto p = prime_factor(N);

  int ans = 0;
  for(auto&& s: p) {
    ans += (int) ( (std::sqrt( 8*s.second + 1 ) - 1.) / 2. );
  }
  std::cout << ans << std::endl;
  return 0;
}




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

int main(){
  int H,W;
  while(cin>>H>>W){
    if(H==0 && W==0){break;}
    REP(i,H){
      cout << string(W,'#') <<"\n";
    }
    cout << "\n";
  }
}


Measured memory_bytes: 3112
#include <stdio.h>
#include <string.h>

int main(void){

  int h,w;
  scanf("%d %d", &h, &w);
  char s[h][w][6];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      scanf("%s", s[i][j]);
    }
  }
  char snuke[6] = "snuke";
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (strcmp(s[i][j],snuke) == 0) {
        printf("%c%d\n", 'A'+j, i+1);
        return 0;
      }
    }
  }

  return 0;
}

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

d = {}
maxval=0
for i in range(N):
    tmp = input()
    if tmp in d.keys():
        d[tmp] +=1
        maxval = max(d[tmp], maxval)
    else:
        d[tmp] = 1
        maxval = max(d[tmp], maxval)

        
ans = []
for istr in  d.keys():
    if d[istr] == maxval:
        ans += [istr]
ans.sort()
        
for istr in ans:
    print(istr)


Measured memory_bytes: 32140
n = int(input())
b = list(map(int, input().split()))

ans = 0
for i in range(1, n-1):
	if b[i] >= b[i-1]:
		ans += b[i-1]
	else:
		ans += b[i]

ans += b[0] + b[n-2]

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define eps 1e-6
#define pi atan(1) * 4
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000000
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define FORl(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORDl(i, a, b) for (ll i = (a); i >= (b); i--)
using namespace std;
int cost[15];
int num[15][15];
int main () {
  int n, m, x;
  scanf("%d %d %d", &n, &m, &x);
  FOR(i, 1, n) {
    scanf("%d", &cost[i]);
    FOR(j, 1, m) {
      scanf("%d", &num[i][j]);
    }
  }
  int ans = inf;
  FOR(i, 0, (1 << n) - 1) {
    bool ok = 1;
    FOR(j, 1, m) {
      int s = 0;
      FOR(k, 0, n - 1) if ((i >> k) & 1) s += num[k + 1][j];
      if (s < x) {
        ok = 0; break;
      }
    }
    if (ok) {
      int c = 0;
      FOR(k, 0, n - 1) if ((i >> k) & 1) c += cost[k + 1];
      ans = min(ans, c);
    }
  }
  if (ans == inf) printf("-1\n");
  else printf("%d\n", ans);
  return 0;
}

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

int main(void) {
  int N, D, X, ans = 0;
  cin >> N >> D >> X;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    ans += 1 + (D - 1) / a;
  }
  cout << ans + X << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define dot cout<< setprecision(20)<<endl;
#define vsor(x) sort(x.begin(),x.end());
#define vrev(x) reverse(x.begin(),x.end());
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define bit(b,n) for(int b=0;b<(1<<(ll)(n));b++)
 
 using namespace std;
 int main(){
     int n,a[101],ans=0;
     cin>>n;
     rep(i,n){
         cin>>a[i];
         if((i+1)%2!=0&&a[i]%2!=0)ans++;
     }
     cout<<ans<<endl;

 }

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
	int n;
	cin>>n;
	vector<int> a(n), b(n);
	rep(i, n) cin>>a[i];
	rep(i, n) cin>>b[i];

	vector<bool> ac(n, true);
	int l=0, r=0, c=0, d=0;
	for(int i=1; i<=n; i++){
		l=r;
		for(; a[r]==i && r<n; r++);
		c=d;
		for(; b[d]==i && d<n; d++);
		if(l<r && c<d){
			rep(i, (r-l)+(d-c)-1) ac[(l-(d-1)+i+n)%n]=false;
		}
	}

	int e= -1;
	rep(i, n) if(ac[i]) e=i;

	if(e== -1){
		cout<<"No"<<endl;
	}
	else{
		cout<<"Yes"<<endl;
		rep(i, n) cout<<b[(-e+i+n)%n]<<" ";
		cout<<endl;
	}
	return 0;
}


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

void solve() {
  int n;
  cin >> n;
  vector<pair<string, int>> v(n);
  vector<int> rank(n);
  rep(i, n) {
    cin >> v[i].first;
    int p;
    cin >> p;
    p *= -1;
    v[i].second = p;
    rank[i] = p;
  }
  sort(v.begin(), v.end());
  rep(i, n) {
    rep(j, n) {
      if (v[i].second == rank[j]) {
        cout << j + 1 << endl;
      }
    }
  }

}

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


Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int INF = (int)1e8;
const int N = 202;
char s[N];
int g[N][N];
int n;
int col[N];

bool dfs(int v) {
	for (int u = 0; u < n; u++) {
		if (g[v][u] != 1) continue;
		if (col[u] == -1) {
			col[u] = col[v] ^ 1;
			if (!dfs(u)) return false;
		} else if (col[v] == col[u])
			return false;
	}
	return true;
}	

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			g[i][j] = (i == j ? 0 : INF);
	for (int i = 0; i < n; i++) {
		scanf("%s", s);
		for (int j = 0; j < n; j++)
			if (s[j] == '1')
				g[i][j] = 1;
	}
	for (int i = 0; i < n; i++)
		col[i] = -1;
	col[0] = 0;
	if (!dfs(0)) {
		printf("-1\n");
		return 0;
	}
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			for (int k = 0; k < n; k++)
				g[j][k] = min(g[j][k], g[j][i] + g[i][k]);

	int ans = -1;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			ans = max(ans, g[i][j]);
	printf("%d\n", ans + 1);
	
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

struct ST {
  int i;
  ll d;
};
bool operator<(const ST& a, const ST& b){
  return a.d > b.d;
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<ll> v;
  rep(i,M){
    ll x;
    cin >> x;
    v.push_back(x);
  }

  sort(ALLOF(v));

  vector<ST> w;
  rep(i,v.size()-1){
    w.push_back((ST){i,v[i+1]-v[i]});
  }
  sort(ALLOF(w));
  vector<int> lst(M, 0);
  rep(i,min(N-1,(int)w.size())){
    lst[w[i].i] = 1;
  }
  lst[M-1] = 1;

  ll ret = 0;
  ll base = v[0];
  rep(i,v.size()){
    if(lst[i] == 1){
      ret += v[i] - base;
      if(i+1<v.size()) base = v[i+1];
    }
  }
  
  cout << ret << endl;
  
  return 0;
}


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

using namespace std;

int calculateDigitSum(int x) {
  int ret = 0;
  while (x != 0) {
    ret += x % 10;
    x /= 10;
  }
  return ret;
}

int main()
{
  int N; cin >> N;
  if (N % calculateDigitSum(N) == 0) cout << "Yes";
  else cout << "No";
}

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

int main() {
    string s, t; cin >> s >> t;
    int res = 0;
    for (int i = 0; i < s.size(); i++) if (s.at(i) != t.at(i)) res++;
    cout << res << endl;
}


Measured memory_bytes: 3936
#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
const ll maxn=1e12;
ll z[1000];
ll f[1000];
int cnt=0;
void init(){
	ll tmp=0;
	while(tmp<maxn){
		tmp=1;
		for(int i=0;i<5;i++){
			tmp*=cnt;
		}
		z[cnt]=tmp;
		f[cnt]=-tmp;
		cnt++;
	}
}
int main()
{
	IO;
	init();
	ll x;
	cin>>x;
	int flag=0;
	for(int i=0;i<cnt;i++){
		for(int j=0;j<cnt;j++){
			if(z[i]-z[j]==x){
				cout<<i<<" "<<j<<endl;
				return 0;
			}
			if(z[i]-f[j]==x){
				cout<<i<<" "<<-j<<endl;
				return 0;
			}
		}
	}
 	return 0;
}







Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t mod=200000;
  int64_t N;
  cin>>N;
  int64_t p[N];
  int64_t ans=0;
  for(int i=0;i<N;i++){
    cin>>p[i];
  }
  for(int i=0;i<N;i++){
    if(p[i]<=mod){
      ans++;
      mod=p[i];
    }
  }
  cout<<ans<<endl;
}
      
  

Measured memory_bytes: 1792
import numpy as np


def gcd(a, b):
    if (b == 0):
        return a
    else:
        return gcd(b, a % b)


_, X = map(int, input().split())
x = np.array(list(map(int, input().split())))

X = np.array([X])

x = np.concatenate([x, X])
x.sort(0)
x = np.abs(np.diff(x))

ans = x[0]
for i in x:
    ans = gcd(ans, i)

print(ans)

Measured memory_bytes: 25108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0041
{
	class Program
	{
		static void Main(string[] args)
		{
			while( true ) {
				var	n	= Array.ConvertAll( Console.ReadLine().Split(), s => int.Parse( s ) );
				if( n.Sum() == 0 ) {
					break;
				}
				expression( n );
			}
		}
	
		static void expression( int[] n )
		{
			for( int a = 0; a < 4; a++ ) {
				for( int b = 0; b < 4; b++ ) {
					if( a != b ) {
						for( int c = 0; c < 4; c++ ) {
							if( (a != c) && (b != c) ) {
								for( int d = 0; d < 4; d++ ) {
									if( (a != d) && (b != d) && (c != d) ) {
										if( is_expression_type_a( n[ a ], n [ b ], n[ c ], n[ d ] ) ) return;
										if( is_expression_type_b( n[ a ], n [ b ], n[ c ], n[ d ] ) ) return;
									}
								}
							}
						}
					}
				}
			}
			Console.WriteLine( 0 );
		}


		static bool is_expression_type_a( int a, int b, int c, int d )
		{
			char[]	ope	= { '+', '-', '*' };

			for( int e1 = 0; e1 < 3; e1++ ) {
				for( int e2 = 0; e2 < 3; e2++ ) {
					for( int e3 = 0; e3 < 3; e3++ ) {
						int	val	= 0; 
						switch( e1 ) {
						case	0:	val	+= a + b;	break;
						case	1:	val	+= a - b;	break;
						case	2:	val	+= a * b;	break;
						}
						switch( e2 ) {
						case	0:	val	+= c;	break;
						case	1:	val	-= c;	break;
						case	2:	val	*= c;	break;
						}
						switch( e3 ) {
						case	0:	val	+= d;	break;
						case	1:	val	-= d;	break;
						case	2:	val	*= d;	break;
						}
						if( val == 10 ) {
							Console.WriteLine( "(({0}{1}{2}){3}{4}){5}{6}", a, ope[ e1 ], b, ope[ e2 ], c, ope[ e3 ], d );
							return( true );
						}
					}
				}
			}
			return( false );
		}


		static bool is_expression_type_b( int a, int b, int c, int d )
		{
			char[]	ope	= { '+', '-', '*' };

			for( int e1 = 0; e1 < 3; e1++ ) {
				for( int e2 = 0; e2 < 3; e2++ ) {
					for( int e3 = 0; e3 < 3; e3++ ) {
						int	val1	= 0; 
						switch( e1 ) {
						case	0:	val1	+= a + b;	break;
						case	1:	val1	+= a - b;	break;
						case	2:	val1	+= a * b;	break;
						}
						int	val2	= 0; 
						switch( e3 ) {
						case	0:	val2	+= c + d;	break;
						case	1:	val2	+= c - d;	break;
						case	2:	val2	+= c * d;	break;
						}
						switch( e2 ) {
						case	0:	val1	+= val2;	break;
						case	1:	val1	-= val2;	break;
						case	2:	val1	*= val2;	break;
						}
						if( val1 == 10 ) {
							Console.WriteLine( "({0}{1}{2}){3}({4}{5}{6})", a, ope[ e1 ], b, ope[ e2 ], c, ope[ e3 ], d );
							return( true );
						}
					}
				}
			}
			return( false );
		}
	}
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,m;
    cin >> n >> m;
    if(n==m)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
char a[105]; 
int main()
{
	int cnt=1;
	scanf("%s",a);
	if(strlen(a)<2)
	{
		printf("No\n");
	}
	else
	{
		sort(a,a+strlen(a));
		for(int i=0;i<strlen(a);i+=2)
		{
			if(a[i]!=a[i+1])
			{
				cnt=0;
				break;	
			}	
		}	

		if(cnt==1)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}
	return 0;
}

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

using namespace std;

string s;

set< char > d;

int main()
{
	cin >> s;

	for(int i = 0 ; i < s.size() ; i++)
		d.insert( s[i] );

	if( d.size() == s.size() ) printf("yes\n");
	else printf("no\n");
}

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

using namespace std;

int num(string &s, int &p)
{
	int res = 0;
	while (isdigit(s[p]))
	{
		res *= 10;
		res += s[p] - '0';
		p++;
	}
	return res;
}

int solve(string &s, int &p)
{
	vector<int> v;
	while (p < s.size())
	{
		if (s[p] == '[')
		{
			p++;
			v.push_back(solve(s, p));
		}
		else
		{
			return (num(s, p) + 1) / 2;
		}
		p++;
		if (s[p] == ']')
			break;
	}
	sort(v.begin(), v.end());
	int res = 0;
	for (int i = 0; i < (int)(v.size() + 1) / 2; i++)
	{
		res += v[i];
	}
	return res;
}

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

	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		int p = 0;
		int res = solve(s, p);
		cout << res << endl;
	}
}



Measured memory_bytes: 3256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONG_INF 100000000000000
int main() {
	long long a, b, c, d, e, f, g;
	cin >> a >> b >> c >> d >> e >> f >> g;
	long long ans = a - (a % 2) + d-(d%2)+e-(e%2);
	if (a != 0 && d != 0 && e != 0) {
		a--;d--;e--;
		ans = max(ans, (long long)3 + a - (a % 2) + d - (d % 2) + e - (e % 2));
	}
	ans += b;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// Last Change: 03/03/2019 21:09:27.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  int minNum = min(A, B);
  vector<int> ans;
  for (int i = 1; i <= minNum; ++i) {
    if (A % i == 0 and B % i == 0) {
      ans.push_back(i);
    }
  }
  int pos = ans.size() - K;
  cout << ans[pos];

  //NS::LoopUntilZeroInpput();
}


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

int main(){
    int x, y, z;
    vector<int> xs;

    for(int i=0; i<3; i++){
        cin >> x;
        xs.push_back(x);
    }

    y = count(xs.begin(), xs.end(), 5);
    z = count(xs.begin(), xs.end(), 7);

    if(y == 2 && z == 1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int r, d, xi;
	while(cin >> r >> d >> xi) {
		int cur = xi;
		REP(i, 10) {
			cur = cur  * r - d;
			cout << cur << endl;
		}
	}
	return 0;
}


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

int main() {
    int l, r, d;
    cin >> l >> r >> d;
    cout << r / d - (l - 1) / d << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main(){
    int n;
    cin>>n;
    
    int mon[n+1];
    int hero[n];
    
    for(int i=0;i<n+1;i++){
        cin>>mon[i];
    }
    for(int i=0;i<n;i++){
        cin>>hero[i];
    }
    
    int count = 0;
    for(int i=0;i<n;i++){
        count = count + min(mon[i], hero[i]);
        if(hero[i]>mon[i]){
            count = count + min(hero[i]-mon[i], mon[i+1]);
            if(mon[i+1]>hero[i]-mon[i]){
                mon[i+1] = mon[i+1] - (hero[i]-mon[i]);
            }
            else{
                mon[i+1] = 0;
            }
        }
    }
    
    cout<<count;
}

Measured memory_bytes: 1792
#include<cstdio>
void printdesc(long long number, long long smaller) {
	for (long long i = smaller + number; i > smaller; i--)printf("%lld%s", i, i == smaller + 1 ? "" : " ");
}

int main() {
	long long n, a, b, i, j, remain, smaller;
	scanf("%lld%lld%lld", &n, &a, &b);
	if (a + b - 1 > n || a*b < n) {
		printf("-1");
		return 0;
	}
	remain = n-a;
	smaller = 0;
	for (i = 1; i <= a; i++) {
		if (remain >= b - 1) {
			printdesc(b, smaller);
			remain -= b - 1;
			smaller += b;
		}
		else {
			printdesc(1 + remain, smaller);
			smaller += 1 + remain;
			remain = 0;
		}
		if (i != a)printf(" ");
	}
	return 0;
}

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

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

	if (B > C)
	{
		cout << B + C << endl;
	}
	else
	{
		if (A + B >= C)
		{
			cout << B + C << endl;
		}
		else
		{
			cout << B + B + A + 1 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    ll old = stoll(s);
    int n = s.length();
    ll tens = 1;
    for(int i = 0; i < n; i++)  tens *= 10;
    ll ans = 0, diff = 0;
    // 3.6e6(worst)
    for(int s = 1; s < 1<<10; s++){
        string t = "";
        for(int j = 0; j < 10; j++){
            if((s>>j)&1)    t += ('0' + j);
        }
        if(t.length() != n) continue;
        do{
            ll tmp = stoll(t);
            ll tmpdiff = min(abs(tmp-old), tens-abs(tmp-old));
            if(tmpdiff > diff || (diff==tmpdiff && ans > tmp)){
                diff = tmpdiff;
                ans = tmp;
            }
        }while(next_permutation(t.begin(), t.end()));
    }
    cout << setw(n) << setfill('0') << ans << endl;
    return 0;
}


Measured memory_bytes: 3204
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
 
    def find(self, x):#要素xが属するグループの根を返す
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
 
    def union(self, x, y):#要素xが属するグループと要素yが属するグループとを併合する
        x = self.find(x)
        y = self.find(y)
 
        if x == y:
            return
 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
 
        self.parents[x] += self.parents[y]
        self.parents[y] = x
 
    def size(self, x):#要素xが属するグループのサイズ（要素数）を返す
        return -self.parents[self.find(x)]
 
    def same(self, x, y):#要素x, yが同じグループに属するかどうかを返す
        return self.find(x) == self.find(y)
 
    def members(self, x):#要素xが属するグループに属する要素をリストで返す
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
 
    def roots(self):#すべての根の要素をリストで返す
        return [i for i, x in enumerate(self.parents) if x < 0]
 
    def group_count(self):#グループの数を返す
        return len(self.roots())
 
    def all_group_members(self):#{ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書を返す
        return {r: self.members(r) for r in self.roots()}
 
    def __str__(self):#print()での表示用 ルート要素: [そのグループに含まれる要素のリスト]を文字列で返す
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
 
N, M, K = map(int, input().split())
uf = UnionFind(N)

edge1 = []
edge2 = []
for i in range(M):
    a,b = map(int,input().split())
    edge1.append((a-1,b-1))
for i in range(K):
    c,d = map(int,input().split())
    edge2.append((c-1,d-1))
for a,b in edge1:
    uf.union(a,b)

#同じグループに属する人数（自分を除く）    
ans = [uf.size(i)-1 for i in range(0,N)]

for a,b in edge1:#すでに友達なら削る
    ans[a] -= 1
    ans[b] -= 1

for c,d in edge2:
    if uf.same(c,d): #ブロック関係かつ同じグループに属しているなら
        ans[c] -= 1
        ans[d] -= 1
print(*ans)

Measured memory_bytes: 37184
a;b[1<<17];n;i;M=1e9+7;main(c){for(;~scanf("%d",&a);)!n?n=a:b[a]++;for(;++i<n;c=!((n%2^i%2?a-2:a)|n%2-*b)*c*-~!!a%M)a=b[i];printf("%d",c);}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, n) for (int i = 1; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;

int N, M, Q;
vector<int> a, b, c, d, A;

int rec(int n) {
    if (n == N) {
        int res = 0;
        rep(i, Q) {
            if (A[b[i]] - A[a[i]] == c[i]) res += d[i];
        }
        return res;
    }
    if (n == 0) {
        int res = 0;
        rep(i, M) {
            A[0] = i;
            res = max(res, rec(n + 1));
        }
        return res;
    }
    int res = 0;
    rep(i, M) {
        if (A[n - 1] <= i) {
            A[n] = i;
            res = max(res, rec(n + 1));
        }
    }
    return res;
}

int main() {
    cin >> N >> M >> Q;
    a = b = c = d = vector<int>(Q, 0);
    A = vector<int>(N, 0);
    rep(i, Q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i]; --b[i];
    }
    cout << rec(0) << "\n";
    return 0;
}


Measured memory_bytes: 3632
/*
.....   .   .   .   .
  .    . .   . .   . .
  .   .....   .   .....
  .  .     .  .  .     .
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
   
using namespace std;
   
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
   
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}



#define left left228
#define right right228
#define set set228

const int maxn = 200 * 1000 + 228;

int a[maxn];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    map<int, int> cnt;
    vector<int> v;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        ++cnt[a[i]];
    }
    for (auto p : cnt) {
        v.push_back(p.first);
    }
    int res = 0;
    while (!v.empty()) {
        int kek = v.back();
        v.pop_back();
        for (int t = (1 << 30); t >= 1; t >>= 1) {
            int rest = t - kek;
            if (rest <= 0) break;
            if (kek == rest) {
                if (cnt[kek] >= 2) {
                    res += cnt[kek] / 2;
                    cnt[kek] %= 2;
                    break;
                }
            } else {
                if (cnt[rest]) {
                    int dd = min(cnt[kek], cnt[rest]);
                    res += dd;
                    cnt[kek] -= dd;
                    cnt[rest] -= dd;
                    break;
                }
            }
        }
    }
    cout << res << '\n';
    return 0;
}
  
  
  
  


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

int main() {

  int n,m,a,b,l;
  char c;

  vector<int> list;

  while(true) {

    cin >> n;
    if ( n == 0 ) break;

    cin >> m;

    int ans = 0;
    int cnt = 0;
    int flag_num = 1;

    int map[100][100] = {0};
    int flag[100] = {0};

    for ( int i = 0; i < m; i++ ) {

      cin >> a >> c >> b >> c >> l;
      map[a][b] = l;
      map[b][a] = l;
      list.push_back( l );

    }

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

    int num[100] = {0};

    while(true) {

      for ( int x = 0; x < n-1; x++ ) {
	for ( int y = x+1; y < n; y++ ) {

	  if ( map[x][y] != list[0] ) continue;

	  if ( flag[x] > 0 && flag[y] > 0 ) {     //その木の両端が両方とも連結済みだったら
	    if ( flag[x] != flag[y] ) {
	      int k = flag[y];
	      for ( int i = 0; i < n; i++ ) {
		if ( flag[i] == k ) flag[i] = flag[x];
	      }
	      ans += map[x][y]/100-1;
	      cnt++;
	    }
	  }else if ( flag[x] == 0 && flag[y] == 0 ) {
	    flag[x] = flag_num;
	    flag[y] = flag_num;
	    flag_num++;
	    ans += map[x][y]/100-1;
	    cnt++;
	  }else {
	    if ( flag[x] == 0 ) {
	      flag[x] = flag[y];
	      ans += map[x][y]/100-1;
	      cnt++;
	    }else {
	      flag[y] = flag[x];
	      ans += map[x][y]/100-1;
	      cnt++;
	    }
	  }

	  vector<int>::iterator it = list.begin();
	  list.erase( it );
	  map[x][y] = 0;
	  if ( cnt == n-1 ) break;

	}
	if ( cnt == n-1 ) break;
      }
      if ( cnt == n-1 ) break;

    }

    cout << ans << endl;

  }

  return 0;

}

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

typedef long long ll;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

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

    for(int i=0; i<5; i++){
        if(arr[i]==0){
            cout<<i+1<<'\n';
            break;
        }
    }
    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            int[] march = new int[5];
            int[] P = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 2 };
            int[] Q = { 1, 1, 1, 2, 2, 3, 2, 2, 3, 3 };
            int[] R = { 2, 3, 4, 3, 4, 4, 3, 4, 4, 4 };

            int n = sc.intarr[0];

            for (int i = 0; i < n; i++)
            {
                string name = sc.str;
                char init = name[0];

                if (init == 'M')
                {
                    march[0]++;
                }
                if (init == 'A')
                {
                    march[1]++;
                }
                if (init == 'R')
                {
                    march[2]++;
                }
                if (init == 'C')
                {
                    march[3]++;
                }
                if (init == 'H')
                {
                    march[4]++;
                }
            }
            long result = 0;
            for(int i=0; i<10; i++)
            {
                result += (long)march[P[i]] * march[Q[i]] * march[R[i]];
            }
            Console.WriteLine(result);
        }


    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


Measured memory_bytes: 15444
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>

#define int long

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int a;
std::set<int> st;

signed main(){
	scanf("%ld", &a);
	st.insert(a);
	for(int i = 2; i <= 1000005; i++){
		if(a % 2 == 0){
			a = a / 2;
		}else{
			a = 3*a + 1;
		}
		if(st.count(a) > 0){
			printf("%ld\n", i);
			return 0;
		}
		st.insert(a);
	}
}


Measured memory_bytes: 256
N = int(input())
S = input()


def count(s):
    res = {}
    for i in range(2**N):
        t1 = ''
        t2 = ''
        for j in range(N):
            if i & 1 << j:
                t1 += s[j]
            else:
                t2 += s[j]
        k = t1 + t2[::-1] + str(bin(i).count('1'))
        res[k] = res.get(k, 0) + 1
    return res


h1 = count(S[:N])
h2 = count(S[N:][::-1])
ans = 0
for k, v in h1.items():
    if k in h2:
        ans += v * h2[k]
print(ans)

# https://www.youtube.com/watch?v=eB0eT-948Vw

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

//Nの約数が8個あるかどうか判定
int main(){
int N;
cin >> N;
bool ans = false;
  for(int a = 0;a<=N/4; a++){
    for(int b = 0;b<=N/7;b++){
  if(N == 4*a + 7*b){
    ans = true;
    break;
      }
    }
  }
  
  if(ans == false) cout << "No" << endl;
  else cout << "Yes" << endl;
  
}


Measured memory_bytes: 256
#include <stdio.h>

void set(int array[], int n) {
	int i;
	
	for(i = 0; i < n; i++) {
		array[i] = n - i;
	}
}

void shuffle(int array[], int p, int c) {
	int i, j;
	int temp;

	for(i = 0; i < c; i++) {
		temp = array[p + c - 2];
		for(j = 0; j < p + c - 2; j++)
			array[p + c - 2 - j] = array[p + c  - 3 - j];
		
		array[0] = temp;
	}	
}

int main() {
	int n, r;
	int p, c;
	int i, j;

	int ans[64];

	while(1) {
		scanf("%d %d", &n, &r);
		if(!n && !r) break;
		
		set(ans, n);

		for(i = 0; i < r; i++) {
			scanf("%d %d", &p, &c);
			shuffle(ans, p, c);
		}

		printf("%d\n", ans[0]);
	}

	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

int n;
string s;
int totalE, totalW;

int main() { 

  scanf("%d\n", &n);
  getline(cin, s);
  for (int i = 0; i < sz(s); i++) {
    if (s[i] == 'E') {
      totalE++;
    } else {
      totalW++;
    }
  }

  int ans = n;
  int curE = 0, curW = 0;
  for (int i = 0; i < sz(s); i++) {
    int cur = curW + totalE - curE;
    if (s[i] == 'E') {
      cur--;
    }
    ans = min(ans, cur);

    if (s[i] == 'E') {
      curE++;
    } else {
      curW++;
    }
  }

  cout << ans << endl;

  return 0;
}


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


int main(void){
	int n, flag = 1;
	cin >> n;
	vector<string> s(n);
	cin >> s[0];
	for(int i = 1; i < n; ++i){
		cin >> s[i];
		if(s[i][0] != s[i-1][s[i-1].length()-1]){
			flag = 0;
		}
		for(int j = 0; j < i; ++j){
			if(s[i] == s[j]){
				flag = 0;
			}
		}
	}
	if(flag == 0){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

import numpy as np

N = int(input())
P = list(map(float, input().rstrip().split(' ')))

dp = np.zeros((N+2, N+1))

dp[1,0] = 1
for i in range(0, N):
    dp[1:(i+3), i+1] += dp[0:(i+2), i] * P[i]
    dp[1:(i+3), i+1] += dp[1:(i+3), i] * (1.0 - P[i])
        
print(sum(dp[-(N+1)//2:, -1]))

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

int main(){
	string S,T;
	
	cin >> S >> T;
	int n = S.size();
	vector<char> used(26,'!');
	vector<char> used2(26,'!');
  
	for(int i=0; i < n; i++){
		if(used[T[i]-'a'] == '!') {
     		used[T[i]-'a'] = S[i];
		} else if(used[T[i]-'a'] == S[i]) {
          ;
		} else {
			cout << "No" << endl;
			return 0;
		}
	}
    for(int i=0; i < n; i++){
		if(used2[S[i]-'a'] == '!') {
     		used2[S[i]-'a'] = T[i];
		} else if(used2[S[i]-'a'] == T[i]) {
          ;
		} else {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}



Measured memory_bytes: 776
N = int(input())
A = list(map(int, input().split()))
count = 0
det = True
while det:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] // 2
        else:
            det = False
            break
    if det != False:
        count += 1
print(count)

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

class Progaram
{
    static void Main(String[] args)
    {
        var n = long.Parse(Console.ReadLine());
        var o = new List<long>();
        var ans = (n * (n + 1)) / 2;
        Console.WriteLine(ans - n);
    }
}

Measured memory_bytes: 27824
#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

#[derive(Debug)]
pub struct UnionFind {
    par: Vec<usize>,
}
impl UnionFind {
    pub fn new(n: usize) -> UnionFind {
        let mut vec = vec![0; n];
        for i in 0..n {
            vec[i] = i;
        }
        UnionFind { par: vec }
    }
    pub fn find(&mut self, x: usize) -> usize {
        if x == self.par[x] {
            x
        } else {
            let par = self.par[x];
            let res = self.find(par);
            self.par[x] = res;
            res
        }
    }
    pub fn same(&mut self, a: usize, b: usize) -> bool {
        self.find(a) == self.find(b)
    }
    pub fn unite(&mut self, a: usize, b: usize) {
        let apar = self.find(a);
        let bpar = self.find(b);
        self.par[apar] = bpar;
    }
}

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    let stdin = std::io::stdin();
    let mut sc = Scanner { reader: stdin.lock() };

    let n:usize = sc.read();
    let m:usize = sc.read();

    let mut uf = UnionFind::new(n + m);
    for i in 0..n {
        let k:usize = sc.read();
        let ls: Vec<usize> = sc.read_vec(k);
        for l in ls {
            uf.unite(i, n+l-1);
        }
    }

    let g = uf.find(0);
    for i in 0..n {
        if uf.find(i) != g {
            return puts!("{}\n", "NO");
        }
    }
    puts!("{}\n", "YES");
}

pub struct Scanner<R> {
    reader: R,
}
impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf: String = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        buf.parse::<T>().ok().expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

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

int main() {
	int s[10];
	string S;
	cin >> S;
	int ans = 0;

	for (int i = 0; i < 10; i++) {
		if (i == 4 || i == 7)continue;
		s[i] = S.at(i) - '0';
	}

	ans = s[0] * 10000000 + s[1] * 1000000 + s[2] * 100000 + s[3] * 10000
		+ s[5] * 1000 +s[6] * 100 + s[8] * 10 + s[9];
	//cout << ans << endl;
	if (ans<=20190430) {
		cout << "Heisei" << endl;
	}
	else {
		cout << "TBD" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6,inf=1e9;
int aa[N+2];
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);

  int n;cin>>n;
  for(int i=1;i<=n;i++)cin>>aa[i];

  int mn=inf,cnt=0;
  for(int i=1;i<=n;i++)
  {
    if(mn>=aa[i])cnt++;
    mn=min(mn,aa[i]);
  }
  cout<<cnt<<endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(){
  int N;
  scanf("%d",&N);
  int H[N];
  for(int i= 0; i<N;i++){
    scanf("%d",&H[i]);
  }
  int high = 0;
  int ryo = 0;
  for(int i = 0;i < N;i++){
    if(H[i] >= high){
      high = H[i];
      ryo++;
    }
  }
  printf("%d",ryo);
}
    

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  
  if(e-a<=k){
    cout << "Yay!" << endl;
  }else{
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
 int a, b;
  cin >> a >> b;
  
  if (a*b % 2 == 0) {
    cout << "Even" << endl;
  }
  
    else if (a*b % 2 ==1) {
      cout << "Odd" << endl;
    }
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( stdin . lock ( ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        x: u64, t: u64
    }
    
    println!("{}", x.saturating_sub(t));
}

Measured memory_bytes: 4352