akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	static int counter;
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		IN:while(true) {
			int[] tmp = new int[5];
			for(int i = 0; i < 5; i++) {
				tmp[i] = stdIn.nextInt();
				if(tmp[i] == 0) {
					return;
				}
			}
			boolean[] rps = new boolean[3];
			for(int i = 0; i < 5; i++) {
				rps[tmp[i]-1] = true;
			}
			int pp = 0;
			for(int i = 0; i < 3; i++) {
				if(rps[i]) {
					pp++;
				}
			}
			
			if(pp == 1 || pp == 3) {
				for(int i = 0; i < 5; i++) {
					System.out.println(3);	
				}
				continue IN;
			}
			
			else {
				if(rps[0] && rps[1]) {
					for(int i = 0; i < 5; i++) {
						if(tmp[i] == 1) {
							System.out.println(1);
						}
						else {
							System.out.println(2);
						}
					}
				}
				if(rps[0] && rps[2]) {
					for(int i = 0; i < 5; i++) {
						if(tmp[i] == 1) {
							System.out.println(2);
						}
						else {
							System.out.println(1);
						}
					}
				}
				if(rps[1] && rps[2]) {
					for(int i = 0; i < 5; i++) {
						if(tmp[i] == 2) {
							System.out.println(1);
						}
						else {
							System.out.println(2);
						}
					}
				}
			}
			
			
		}
	}
	

}

Measured memory_bytes: 20828
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll a,b,n;cin>>a>>b>>n;
  ll now=0;
  res=-INF;
  while(now<=n){
    ll tmp=now/b;
    ll mx=b*(tmp+1)-1;
    chmin(mx,n);
    //cout<<now spa tmp spa mx<<endl;
    chmax(res,a*mx/b-a*(mx/b));
    now=mx+1;
    buf++;
    if(buf>=1000000)break;
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 3656
#include <iostream>

const int N = (int)1e5;

int microwave[N];
int fredge[N];

int min(int a, int b){return a > b ? b : a;}


int main(){
    int a, b, m;

    scanf("%d %d %d", &a, &b, &m);

    int mw_minprice = N;
    
    for(int i = 0; i < a; i++){
        scanf("%d", microwave+i);
        mw_minprice = min(mw_minprice, microwave[i]);
    }

    int fr_minprice = N;
    for(int i = 0; i < b; i++){
        scanf("%d", fredge+i);
        fr_minprice = min(fr_minprice, fredge[i]);
    }

    int res = mw_minprice + fr_minprice;

    int x, y, z;
    for(int i = 0; i < m; i++){
        scanf("%d %d %d", &x, &y, &z);
        // printf("Now %d %d %d %d \n",microwave[x-1], fredge[y-1], z, microwave[x-1]+fredge[y-1]-z);
        res = min(res, microwave[x-1]+fredge[y-1]-z);
    }

    printf("%d", res);
    return 0;
}


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

long long DP[101][100002];

int main()
{
    int N, W, V = 100002;
    cin>>N>>W;
    long long w[N], v[N];
    memset( DP,1,sizeof(DP) );
    for(int i=0; i<N; i++) cin>>w[i]>>v[i];
    DP[0][0] = 0, DP[0][v[0]] = w[0];
    for(int i=0; i<N-1; i++)
    {
        for(int j=0; j<=V; j++)
        {
            DP[i+1][j] = min( DP[i+1][j],DP[i][j] );
            if( DP[i][j]!=72340172838076673 && DP[i][j]+w[i+1]<=W ) DP[i+1][j+v[i+1]] = min( DP[i+1][j+v[i+1]],DP[i][j]+w[i+1] );
        }
    }
    for(int i=V-1; i>=0; i--)
    if( DP[N-1][i]!=72340172838076673 )
    {
        cout<<i<<"\n";
        return 0;
    }
}

Measured memory_bytes: 79104
#include<bits/stdc++.h>
typedef long long ll;
#define db double
#define ui unsigned int
#define ll long long
#define ull unsiged ll
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,r,l)for(int i=r;i>=l;i--)
#define pb push_back
#define pp pop_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1e9+7
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define inf  INT_MAX
#define lnf LLONG_MAX
#define mii map<int,int>
#define mll map<ll,ll>
#define mil map<int,ll>
#define umii unordered_map<int,int>
#define umll unordered_map<ll,ll>
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define boots ios::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
using namespace std;
const int MX = 3e5 + 7;
ll modulo(ll num, ll MOD = mod) { return ((num%MOD) + MOD) % MOD; }
ll power(ll b, ll e, ll MOD = mod) { ll ans = 1; while (e) { if (e % 2) ans = (ans*b) % MOD; b = (b*b) % MOD; e /= 2; } return ans; }
ll inv(ll num, ll MOD = mod) { return power(modulo(num), MOD - 2, MOD); } ll gcd(ll a, ll b) { return ((b == 0) ? a : gcd(b, a%b)); }
ll dp[MX];
int main()
{
    //boots;
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"1.0000000000"<<endl;
    }
    else if(n%2==0)
    {
        cout<<"0.5000000000"<<endl;
    }
    else {
        double ans=(1.0*(n/2+1))/n;
        //cout<<ans<<endl;
        printf("%.10f\n",ans);
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char s[1111], a[1111]={};
	int i, n, t=0;
	
	scanf("%s", s);
	
	n=strlen(s);
	
	for(i=0;i<n;i++){
		if(s[i]=='1')
		a[t++]='1';
		if(s[i]=='0')
		a[t++]='0';
		if(s[i]=='B'){
			if(t!=0)
			a[--t]='\0';
			
		}
		
	}
	
	printf("%s\n", a);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
    };

    // 2次元用の標準入出力
    template<typename T>
    struct inpn {
        std::size_t szi, szj;
        inpn(std::size_t _szi, std::size_t _szj) : szi(_szi), szj(_szj) {}
        operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i)
                for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j];
            return a;
        }
    };

    inp inp1; // input one
}

int main() {

    string s = inp1;
    int n = s.length();

    reverse(allof(s));

    // 2*10^5

    ll ans = 0LL;

    ll p = 2019;

    vector<ll> a(n + 1, 0LL);
    ll ten_mod = 1;
    rep(i, n) {
        a[i + 1] = (a[i] + ten_mod * (s[i] - '0')) % p;
        ten_mod = (ten_mod * 10) % p;
    }

    vector<ll> v(p, 0);
    rep(i, n + 1) {
        ++v[a[i]];
    }

    rep(i, p) {
        ans += (v[i] - 1) * v[i] / 2;
    }

    Cout(ans);

    return 0;
}

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

int main(void) {
	string S;
	cin >> S;

	int c = S.length() / 2;
	string sl = S.substr(0, c);
	string sr = S.substr(c + 1);
	string rev_sl = sl;
	reverse(rev_sl.begin(), rev_sl.end());

	string ans = "Yes";
	if (sl != rev_sl)
		ans = "No";
	if (sl != sr)
		ans = "No";

	cout << ans << '\n';
	return 0;
}


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

int main()
{
	int n, a[100];
	
	cin >> n;
	
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	int c = 0, f = 1;
	while (f){
		f = 0;
		for (int i = n - 1; 0 < i; i--){
			if (a[i] < a[i - 1]){
				swap(a[i], a[i - 1]);
				f = 1;
				c++;
			}
		}
	}
	
	cout << a[0];
	for (int i = 1; i < n; i++){
		cout << ' ' << a[i];
	}
	
	cout << endl << c << endl;
	
	return (0);
}

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

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

    int n;
    cin >> n;
    
    int ans = 0, mi = 1e9;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if(mi > a){
            mi = a;
            ans = i;
        }
    }

    cout << ans + 1 << endl;

    return 0;
}


Measured memory_bytes: 3140
def run():
  N = int(input())
  S = input()
  if N%2 == 0:
    N //= 2
#    print(S, N)
    T = S[0:N]
    if T == S[N:]:
      print('Yes')
      exit()
  print('No')
  
if __name__ == '__main__':
  run()

Measured memory_bytes: 3060
#include<cstdio>
#include<iostream>

using namespace std;

const int N=105;

int n;
int a[N];

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;++i) scanf("%d",&a[i]);
    bool flag=true;
    for(int i=1;i<=n;++i) if(a[i]%2==0&&a[i]%3!=0&&a[i]%5!=0) flag=false;
    if(flag) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

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

int main() {
  ll h, w, m;
  cin >> h >> w >> m;
  map<P, bool> put;
  vector<ll> r(h, 0), c(w, 0);
  REP(i, m) {
    ll x, y;
    cin >> x >> y;
    x--, y--;
    r[x]++;
    c[y]++;
    put[{x, y}] = true;
  }
  vector<ll> ordR(h), ordC(w);
  iota(ALL(ordR), 0);
  iota(ALL(ordC), 0);
  sort(ALL(ordR), [&](ll i, ll j) { return r[i] > r[j]; });
  sort(ALL(ordC), [&](ll i, ll j) { return c[i] > c[j]; });

  ll rMax = r[ordR[0]], cMax = c[ordC[0]];
  vector<ll> rMaxIdxs, cMaxIdxs;
  REP(i, h) {
    ll j = ordR[i];
    if (r[j] == rMax) {
      rMaxIdxs.push_back(j);
    } else {
      break;
    }
  }
  REP(i, w) {
    ll j = ordC[i];
    if (c[j] == cMax) {
      cMaxIdxs.push_back(j);
    } else {
      break;
    }
  }
  ll candNum = SZ(rMaxIdxs) * SZ(cMaxIdxs);
  if (candNum > m) {
    cout << rMax + cMax << endl;
    return 0;
  }

  for (ll i : rMaxIdxs) {
    for (ll j : cMaxIdxs) {
      if (!put[{i, j}]) {
        cout << rMax + cMax << endl;
        return 0;
      }
    }
  }

  cout << rMax + cMax - 1 << endl;
}

Measured memory_bytes: 39784
#include<bits/stdc++.h>
using namespace std;
#define BOOST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ll long long
#define test(t) int t ; cin>>t ; while(t--)
ll mulmod(ll a, ll b, ll mod){ll res = 0;a = a % mod;while (b > 0){if (b % 2 == 1)res = (res + a) % mod;a = (a * 2) % mod;b /= 2;}return res % mod;}
int n;
int main(){
    BOOST;
    string s;
    int w;
    cin >> s >> w;
    for(int i = 0 ; i < s.size() ; i += w){
        cout << s[i];
    }
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	vector<string> sv;
	rep(i, n) cin >> a.at(i);
	sort(a.begin(), a.end());
	vector<int> p, m;
	p.push_back(a.at(n-1));
	m.push_back(a.at(0));
	for(int i = 1; i < n-1; i++){
		int b = a.at(i);
		if(b < 0) m.push_back(b);
		else p.push_back(b);
	}
	rep(i, n-1){
		if(p.size() != 1){
			sv.push_back(to_string(m.back()) + " " + to_string(p.back()));
			m.back() -= p.back();
			p.pop_back();
		}else{
			sv.push_back(to_string(p.back()) + " " + to_string(m.back()));
			p.back() -= m.back();
			m.pop_back();
		}
	}
	cout << p.back() << endl;
	for(auto itr = sv.begin(); itr != sv.end(); itr++){
		cout << *itr << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 9844
n,k = map(int,input().split())
if n > k:
    n = n % k
m = n
lst = [n]
for i in range(1,100001):
    n = abs(n-k)
    m = min(m,n)
    lst.append(n)
    if i >= 2:
        if lst[i-2] == n:
            print(m)
            exit()

Measured memory_bytes: 3060
'use strict'
let n, m, visited, graph

const trace = arr => {
  let tmp = ''
  for (let i in arr) {
    for (let j in arr[i]) {
      tmp += arr[i][j] ? '@' : '-'
    }
    tmp += '\n'
  }
  console.log(tmp)
}

const dfs = i => {
  visited[i] = true
  for (let i2 = 0; i2 < n; i2++) {
    //訪問済みか、辺がなかったら探索スキップ
    if (visited[i2] || graph[i][i2] == false) continue //スキップ
    dfs(i2)
  }
}

function main(input) {
  // data
  input = input.split('\n').map(v => v.split(' ').map(v => ~~v))
  n = input[0][0]
  m = input[0][1]
  const edges = input.slice(1, -1)

  //連結グラフは隣接行列表現＝二次元配列
  graph = Array.apply(null, {
    length: n
  }).map(
    v =>
      (v = Array.apply(null, {
        length: n
      }).fill(false))
  )

  for (let i = 0; i < m; i++) {
    let a = edges[i][0] - 1
    let b = edges[i][1] - 1
    graph[a][b] = true
    graph[b][a] = true
  }
  visited = Array.apply(null, {
    length: n
  }).fill(false)

  let cnt = 0
  for (let i = 0; i < n; i++) {
    for (let j = 0; j < n; j++) {
      if (graph[i][j]) {
        //辺を見つけたら

        //辺を取り除く
        graph[i][j] = false
        graph[j][i] = false

        //探索
        visited.fill(false) //初期化

        dfs(i) //全て訪問できるかチェック
        if (!visited.every(v=>v==true)) cnt++

        //元に戻す
        graph[i][j] = true
        graph[j][i] = true
      }
    }
  }

  //   count(graph)
  console.log(cnt / 2)
  // trace(graph)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
int A[8][8], cnt=0;
bool B[8][8];
void put(int r,int c,int k){
	cnt += k;
	B[r][c] += k;
	for(int i=0; i<8; i++)
		A[r][i] += k,
		A[i][c] += k;
	A[r][c] -= k;
	for(int i=1; r+i<8 && c+i<8; i++)
		A[r+i][c+i] += k;
	for(int i=1; r-i>=0 && c-i>=0; i++)
		A[r-i][c-i] += k;
	for(int i=1; r+i<8 && c-i>=0; i++)
		A[r+i][c-i] += k;
	for(int i=1; r-i>=0 && c+i<8; i++)
		A[r-i][c+i] += k;
}
bool dfs(int r){
	if(cnt == 8) return 1;
	for(int i=r; i<8; i++)
		for(int j=0; j<8; j++){
			if(A[i][j]) continue;
			put(i,j,1);
			if(dfs(i+1)) return 1;
			put(i,j,-1);
		}
	return 0;
}
int main()
{	
	memset(A,0,sizeof(A));
	memset(B,0,sizeof(B));
	int n, r, c; 
	cin >> n;
	while(n--){
		cin >> r >> c;
		put(r,c,1);
	}
	dfs(0);
	for(int i=0; i<8; i++){
		for(int j=0; j<8; j++)
			cout << (B[i][j]?'Q':'.');
		cout << endl;
	}
	return 0;
}


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

#define fir first
#define sec second
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long LL;
typedef unsigned long long u64;

template <typename T> inline bool cmin(T & a, const T & b) { return a > b ? a = b, 1 : 0;}
template <typename T> inline bool cmax(T & a, const T & b) { return a < b ? a = b, 1 : 0;}
int read() {
	int x = 0, f = 1;char ch;
	for(ch = getchar(); !isdigit(ch); ch = getchar())
		if(ch == '-') f = -1;
	for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	return x * f;
}

int n, a, b;

int main() {
	int i;
	cin >> n >> a >> b;
	cout << ((b - a + 1 & 1) ? "Alice" : "Borys");
	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main ()
{
  int N;
  int ansp = 0, ansq = 0;
  cin >> N;

  vector<int> P(N);
  vector<int> Q(N);
  vector<int> R(N);

  for (int b = 0; b < N; b++){
      cin >> P.at(b);
  }
  
  for (int c = 0; c < N; c++){
      cin >> Q.at(c);
  }

      for (int a = 1; a < N + 1; a++)
      {
          R.at(a - 1) = a;
      }

  do
  {
      if(P==R){
          break;
      }else{
          ansp++;
      }
      } while (std::next_permutation(R.begin(), R.end()));
  
  for (int a = 1; a < N + 1; a++)
      {
          R.at(a - 1) = a;
      }

        do
  {
      if(Q==R){
          break;
      }else{
          ansq++;
      }
      } while (std::next_permutation(R.begin(), R.end()));

      cout << abs(ansp - ansq) << endl;

      return 0;
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

int main(){
    string s; cin >> s;
    int n = s.size(); int ans = 1;
    string prev = string(1, s[0]), now = ""; int i = 1;
    while(i < n){
        now += string(1, s[i]);
        if(prev != now){
            ans++;
            prev = now;
            now = "";
        }
        i++;
    }
    out(ans);
}

Measured memory_bytes: 640
/*
    Author: MEHXM
*/
#include <bits/stdc++.h>
using namespace std;

#define cp_io ios_base::sync_with_stdio(0);cin.tie(0)
#define ll long long int
#define oo 1000000010
#define MAX 1000000
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define nl "\n"

int main()
{
    cp_io;
    #ifndef ONLINE_JUDGE
    freopen("z_input.txt","rt",stdin);
    freopen("z_output.txt","wt",stdout);
    #endif
    int n;
    cin >> n;
    ll a[n];
    for(int i=0; i<n; i++)
        cin >> a[i];
    
    int ans = 0;
    sort(a, a+n);
    for(int i=0; i<n-2; i++)
    {
        for(int j=i+1; j<n-1; j++)
        {
            for(int k=j+1; k<n; k++)
            {
                if(a[i] + a[j] > a[k] && a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k])
                    ans++;
            }
        }
    }

    cout << ans << nl;
    
    return 0;
}

Measured memory_bytes: 3612
def func(D):
  comb = 0
  for item in D:
    if item[0]==item[1]:
      comb+=1
    else:
      comb=0
    
    if comb==3:
      return "Yes"  
  return "No"

if __name__ == "__main__":
    N = int(input())
    D = [list(map(int, input().split())) for _ in range(N)]
    print(func(D))

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int nums[3] = {a, b, c};
  sort(nums, nums+3, greater<int>());
  if(nums[0]%2!=nums[1]%2 && nums[0]%2!=nums[2]%2){
    cout << (nums[0]-nums[1])/2 + (nums[0]-nums[2])/2 + 1;
  }else if(nums[0]%2!=nums[1]%2 || nums[0]%2!=nums[2]%2){
    cout << (nums[0]-nums[1])/2 + (nums[0]-nums[2])/2 + 2;
  }else{
    cout << (nums[0]-nums[1])/2 + (nums[0]-nums[2])/2;
  }
}

Measured memory_bytes: 256
def prob_b():
    n = int(input())
    p_list = [int(a) for a in input().split()]
    ans = 0
    for i in range(n - 2):
        if min(p_list[i], p_list[i+2]) < p_list[i+1] < max(p_list[i], p_list[i+2]):
            ans += 1
    return ans

a = prob_b()
print(str(a))

Measured memory_bytes: 3060
n = int(input())
count = 0
flag = 0

for i in range(n):
    d1, d2 = map(int,input().split())

    if d1 == d2 :
        count += 1
    else:
        count = 0

    if count == 3:
        flag = 1


if flag == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9204
a = int(input())

# b = list(map(int, input().split()))

m = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]


print(m[a-1])


Measured memory_bytes: 2940
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <iomanip>
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cmath>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1001001000;
const int MOD = 1000000007;

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

using Graph = vector<vector<int>>;
//再帰とかグラフを使うときは予めNの最大値のグローバル配列を取っておく
int N;
vector<int> E[200001];
vector<bool> seen;
typedef pair<int, int> P;
int D[101];
//頂点状態を表すcolor[]において、0は未訪問、1は訪問中、2は完了を表す。
int color[101];
int find_time = 0;

double dist(int ax, int ay, int bx, int by) {
    return sqrt(pow(ax - bx, 2.0) + pow(ay - by, 2.0));
}

int main() {
    int N; cin >> N;
    vector<int> X(N), Y(N);
    for (int i = 0; i < N; i++) cin >> X.at(i) >> Y.at(i);
    double ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (i == j)continue;
            ans += dist(X.at(i), Y.at(i), X.at(j), Y.at(j));
        }
    }

    cout << fixed << setprecision(10) << ans / N << endl;
}


Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            var h1 = inputLongArray[0];
            var m1 = inputLongArray[1];
            var h2 = inputLongArray[2];
            var m2 = inputLongArray[3];
            var k =  inputLongArray[4];


            string result = ((h2-h1)*60 + (m2-m1) - k).ToString();

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28224
import java.util.Scanner;
 
public class Main {
    public static void main(String [] args){
        Scanner scan = new Scanner(System.in);
        int i = 1;
         
        while(true){
            int n = scan.nextInt();
             
            if(n == 0) break;
             
            System.out.println("Case " + i++ + ": " + n);
        }
    }
}

Measured memory_bytes: 42096
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define endl            "\n"
#define forn(i,x,n)     for(int i=x; i<n; i++)
#define forit(it, m)    for(decltype(m)::iterator it = m.begin(); it!=m.end(); ++it)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


void zeus()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int32_t main() {

    zeus();

    int n, k; cin >> n >> k;

    int a[n];

    forn(i, 0, n) {
        cin >> a[i];
    }

    forn(i, k, n) {
        if (a[i] > a[i - k]) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }

}


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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;
const int N = 2e5 + 5;
vpi g[N];
int vis[N];
bool ok = true;
int dp[N];
void dfs(int node){
   vis[node] = 1;
   for(auto it : g[node]){
      int u = it.F;
      int c = it.S;
      if(!vis[u]) {
         dp[u] = dp[node] + c;
         dfs(u);
      }
      else if(dp[u] - dp[node] != c) {
         ok = false;
      }
   }
}
int32_t main(){
   fast;
   int n,m;
   cin >> n >> m;

   f(i,0,m){
      int u,v,c;
      cin >> u >> v >> c;
      g[u].pb({v,c});
      g[v].pb({u,-c});
   }

   f(i,1,n+1) if(!vis[i]) dfs(i);
   cout << (ok ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 19456
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

//const double PI = 3.1415926535897932384626433832795;

int main() {
  int k, x;
  cin >> k >> x;
  if(500 * k >= x) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
A = [int(x) for x in input().split()][::-1]
B = [int(x) for x in input().split()][::-1]
beats = 0
carry = 0
for a, b in zip(A, B):
    beats = beats + min(b + carry, a)
    carry = max(b - max(a - carry, 0), 0)
print(beats + min(A[-1], carry))


Measured memory_bytes: 18624
n, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(n)]
INF = 10**9

def rec(cur, a, b, c):
    if cur == n:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) > 0 else INF
    ret0 = rec(cur+1, a, b, c)
    ret1 = rec(cur+1, a+L[cur], b, c) + 10
    ret2 = rec(cur+1, a, b+L[cur], c) + 10
    ret3 = rec(cur+1, a, b, c+L[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(rec(0, 0, 0, 0))


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

int main(void){
    string s;
    cin >> s;
    int count = 0, i = 0;
    while(i<s.size()){
        if(s[i] == 'o'){
            count++;
        }
        i++;
    }
    cout << 700 + 100*count << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int N;
vector<int> E[200001];
int D[200001], cnt[2];
void dfs(int p, int prev, int d) {
	D[p] = d;
	cnt[d]++;
	for (int to : E[p]) {
		if (to != prev) {
			dfs(to, p, (d + 1) % 2);
		}
	}
}

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


	cin >> N;
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		E[a].pb(b);
		E[b].pb(a);
	}

	dfs(1, 0, 0);

	//N = 2;
	//int a1 = 1;
	//cnt[0] = a1;
	//cnt[1] = N - a1;

	//for (int i = 1; i <= a1; i++) D[i] = 0;
	//for (int i = a1 + 1; i <= N; i++) D[i] = 1;




	int k0 = 0, k1 = 0, k2 = 0;
	int n0 = (N + 2) / 3;
	int n1 = (N + 1) / 3;
	int n2 = N / 3;

	if (cnt[0] < cnt[1]) {
		if (cnt[0] > N / 3) {
			rep1(i, N) {
				if (D[i] == 0) {
					if (k0 < n0) cosp(k0++ * 3 + 1);
					else cosp(k2++ * 3 + 3);
				}
				else {
					if (k1 < n1) cosp(k1++ * 3 + 2);
					else cosp(k2++ * 3 + 3);
				}
			}
		}
		else {
			rep1(i, N) {
				if (D[i] == 0) {
					cosp(k2++ * 3 + 3);
				}
				else {
					if (k0 < n0) cosp(k0++ * 3 + 1);
					else if (k1 < n1) cosp(k1++ * 3 + 2);
					else cosp(k2++ * 3 + 3);
				}
			}
		}
	}
	else {
		if (cnt[1] > N / 3) {
			rep1(i, N) {
				if (D[i] == 0) {
					if (k0 < n0) cosp(k0++ * 3 + 1);
					else cosp(k2++ * 3 + 3);
				}
				else {
					if (k1 < n1) cosp(k1++ * 3 + 2);
					else cosp(k2++ * 3 + 3);
				}
			}
		}
		else {
			rep1(i, N) {
				if (D[i] == 1) {
					cosp(k2++ * 3 + 3);
				}
				else {
					if (k0 < n0) cosp(k0++ * 3 + 1);
					else if (k1 < n1) cosp(k1++ * 3 + 2);
					else cosp(k2++ * 3 + 3);
				}
			}
		}
	}



	Would you please return 0;
}

Measured memory_bytes: 15488
#include<bits/stdc++.h>
using namespace std;
bool test(int t,int x,int y)
{
    int z=x+y;
    if(t<z) return 0;
    else{
        if((t-z)%2==0) return 1;
        else return 0;
    }
}
int main()
{
    int n;
    while(cin>>n){
        int t,x,y;
        int flag=1;
        while(n--){
            cin>>t>>x>>y;
            if(!test(t,x,y)) flag=0;
        }
        if(flag) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define pb push_back
#define INF 1000000000000000000
#define PI 3.14159265358979323846
#define f first
#define s second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<pii> vii;

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

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

int main()
{
    FAST_IO;

    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll ans = b-a+1;
    ans -= (b/c) - ((a-1)/c);
    ans -= (b/d) - ((a-1)/d);
    ll m = lcd(c,d);
    ans += (b/m) - ((a-1)/m);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;

int main(void) {

  int n;
  cin >> n;
  vector<int> f(n+1);
  f[0] = 1;
  f[1] = 1;
  for(int i=2; i<=n; i++) f[i] = f[i-1] + f[i-2];
  cout << f[n] << endl;

  return 0;
}

// EOF

Measured memory_bytes: 3080
n = int(input())
a = list(map(int,input().split()))
s = sum(a)
t = 0
i = 0
while True:
  t += a[i]
  if 2*t >= s:
    break
  i += 1
print(min(2*t-s,s-2*t+2*a[i]))

    
  

Measured memory_bytes: 87920
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
long long GCD(long long a,long long b){
    if(b==0)return a;
    return GCD(b,a%b);
}
long long LCM(long long a,long long b){
    return a*b/GCD(a,b);
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll n,w;
    cin>>n>>w;
    VV dp(n+2,V(w+1,0));
    VP vec(n+1);
    rep3(i,1,n+1){
        cin>>vec[i].F>>vec[i].S;
    }
    dp[0][0]=0;
    rep3(i,1,n+1){
        rep(j,w+1){
            chmax(dp[i+1][j],dp[i][j]);
            if(j>=vec[i].F){
                chmax(dp[i+1][j],dp[i][j-vec[i].F]+vec[i].S);
            }
        }
    }
    ll res=0;
    rep(i,w+1){
        chmax(res,dp[n+1][i]);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 81024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<algorithm>
#include<iterator>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#define lli long long int
#define mp make_pair
#define ULTRA_INSTINCT ios_base::sync_with_stdio(false); cin.tie(0)
#define fo(i,n) for(lli i=0;i<(n);i++)
#define FO(i,x,n) for(lli i=(x);i<(n);i++)
#define pb push_back
#define vi vector<lli>
#define pi pair<lli,lli>
#define vii vector<pi >
#define Endl endl
#define ITA 200005
#define ROH 100005
#define deb(x) cout<<(#x)<<" "<<x<<endl
using namespace std;
lli mod = 1e9 +7,test; 
lli max(lli a,lli b){return a>b?a:b;}
lli min(lli a,lli b){return a>b?b:a;}




void solve(){

lli n;
cin>>n;
vi a(n+1,0);
for(int i = 1;i*i<n;i++){
    for(int j = 1;j*j<n;j++){
        for(int k = 1;k*k<n;k++){
            lli val = (i*i) + (j*j) + (k*k) + (i*j) + (k*j) + (k*i);
            if(val <=n){
                a[val]++;
            }
        }
    }
}
FO(i,1,n+1){
    cout<<a[i]<<"\n";
}


}

int main(){
    ULTRA_INSTINCT;
    lli t =1;
    // cin>>t;
    fo(i,t){
        solve();
    }
    return 0;
}

 // #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif

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


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
ll fun(ll a){
    if(a==1){
        return 1;
    }
    return 1+2*fun(a/2);
}
int main()
{
    ll n;
    cin >> n;
    cout << fun(n) <<endl;
    return 0;
}


Measured memory_bytes: 256
// C - Not so Diverse
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define allr(x) (x).rbegin(),(x).rend()
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N,K; cin>>N>>K;
	vi C(N+1);
	rp(i, 0, N){ int a; cin>>a; C[a]++; }
	sort(allr(C));
	int count = 0;
	rp(i, K, N+1) if(C[i] != 0) count += C[i];
	cout<< count <<endl;
}

Measured memory_bytes: 1024
n = input()
last_word = raw_input()
arr = [last_word]
f = 0
for i in range(n-1):
    str = raw_input()
    if str in arr:
        f = 1
        break
    elif str[0] == last_word[-1]:
        last_word = str
        arr.append(str)
    else:
        f = 1
        break
if f == 0:
    print "Yes"
else:
    print "No"



Measured memory_bytes: 2568
//

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end()
struct edge{int to;ll cost;};
const int inf = 2147483647;

int main (){
    string s;cin >> s;
    map<char,int> m{};
    bool flag = true;
    rep(i,0,s.size()){
        m[s[i]] +=1;
        if(m[s[i]]>1)flag = false;
    }
    cout << (flag ? "yes" : "no") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_set>
#include <cstdint>
#include <vector>
#include <sstream>
#include <string>
#include <climits>
#include <set>
#include <array>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <map>
using namespace std;

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

	unordered_set<int> niz;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		niz.insert(x);
	}

	if (niz.size() == n)
		cout << "YES";
	else cout << "NO";
}

Measured memory_bytes: 11464
// This code wrote by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
#define int long long
using namespace std;
const int p=998244353;
template <class t> inline void read(t &s)
{
	s=0;
	reg int f=1;
	reg char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
			f=-1;
		c=getchar();
	}
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	s*=f;
	return;
}
int f[200050];
int n,m,k;
inline int fastpow(int a,int b)
{
	reg int ans=1;
	for(;b;b>>=1,a=a*a%p)
		if(b&1)
			ans=ans*a%p;
	return ans;
}
inline int getC(int N,int M)
{
	return f[N]*fastpow(f[M],p-2)%p*fastpow(f[N-M],p-2)%p;
}
signed main(void)
{
	cin>>n>>m>>k;
	f[0]=1;
	for(int i=1;i<=200000;++i)
		f[i]=f[i-1]*i%p;
	reg int ans=0;
	for(int i=0;i<=k;++i)
		ans=(ans+getC(n-1,i)*fastpow(m-1,n-i-1)%p*m%p)%p;
	cout<<ans<<endl;
	return 0;
}




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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

const int mod = 1000000007;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
struct mint {
  // 構造体の変数は public 変数であるためアクセス可能
  ll x; // typedef long long ll;

  // コンストラクタ
  mint(ll x=0):x((x%mod+mod)%mod){}

  // 単項演算子：符号やインクリメントなどを表すものなど
  // -（マイナス）演算子との区別は引数によって行う
  mint operator-() const { return mint(-x);}

  // 複合代入演算子のオーバーロード
  // *1 戻り値の型は必ず自分自身のクラスで参照を返す
  // *2 return文には「*this」を指定する
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }

  // 算術演算子のオーバーロード
  // 引数の型に & をつけることで参照を利用して受け取ることができる（コピーする必要がないため処理が高速化される）
  mint operator+(const mint a) const {  // メンバ変数の書き換えを防ぐために引数定義のあとに const をつけている
    mint res(*this);    // コピーコンストラクタ（コンパイラが自動で生成）
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // 素数の逆元計算にのみ有効
  mint inv() const { return pow(mod-2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

const int MAX = 1000100;
mint fac[MAX], finv[MAX], inv[MAX];
// 先にこれを行うことで O(1) で nCk を求められる
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i=2; i<MAX; i++){
        fac[i] = fac[i-1]*i;
        finv[i] = finv[i-1]/i;
    }
}

mint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[k] * finv[n-k];
    // cout << COM(n,k).x << endl;
}

ll f(ll x, ll n){
    if(n == 0) return 1;
    ll res = f(x*x%mod, n/2);
    if(n%2 == 1){
        res *= x;
        res %= mod;
    }
    return res;
}

int main()
{
    ll n; cin >> n;
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }
    COMinit();

    ll res = 0;
    res += f(10,n);
    res -= f(8,n);
    res %= mod;

    // cout << res << endl;

    for(int i=1; i<=n; i++){
        ll kakeme =  2*COM(n,i).x * f(8,n-i);
        kakeme %= mod;
        (res += mod) -= kakeme;
        res %= mod;
    }

    cout << res << endl;
}

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

int main(){
  int N, a;
  cin >> N;
  a = N % 10;
  if(a == 3)
    cout << "bon" << endl;
  else if(a == 0 || a == 1 || a == 6 || a == 8)
    cout << "pon" << endl;
  else
    cout << "hon" << endl;
}


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

using namespace std;

const int MAX_N = 2e5 + 5;

int n;
int arr [MAX_N];

int can (int k) {
  if (k == 0 || k == 1) return false;
 
  vector<pair<int, int>> cur; // all the nonzero elements
  for (int i = 1; i < n; i++) {
    if (arr[i] <= arr[i - 1]) {
      while (!cur.empty() && cur.back().first >= arr[i]) cur.pop_back();

      int t = arr[i] - 1;
      while (true) {
        if (t < 0) return false;
        
        if (!cur.empty() && cur.back().first == t) {
          cur.back().second++;
          if (cur.back().second == k) {
            cur.pop_back();
            t--;
          } else {
            break;
          }
        } else {
          cur.push_back(make_pair(t, 1));
          break;
        }
      }
    }
  }
  
  return true;
}

int main () {
  ios::sync_with_stdio(false);

  cin >> n;

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

  int flag = 1;
  for (int i = 1; i < n; i++) {
    if (arr[i] <= arr[i - 1]) {
      flag = 0;
    }
  }

  if (flag) {
    cout << 1 << endl;
    return 0;
  }
  
  int ans = 0;
  for (int k = 1 << 20; k != 0; k /= 2) {
    if (!can(ans + k)) {
      ans += k;
    }
  }

  cout << ans + 1 << endl;
}


Measured memory_bytes: 1024
a, b = map(int, input().split())
print(100,100)

# 上半分を黒で塗っておく
def hoge(n, w=".", b="#"):
    for i in range(50):
        if i%2==0:
            print(b*100)
        else:
            l = [b]*100
            for j in range(min(25, n)):
                l[j*2] = w
            n -= min(25,n)
            print("".join(l))

hoge(a-1)
hoge(b-1,"#",".")

Measured memory_bytes: 3064
import Data.List

main = do
  [_,_,x,y] <- map read . words <$> getLine
  xs  <- sort . (:) x . map read . words <$> getLine :: IO [Int]
  ys  <- sort . (:) y . map read . words <$> getLine :: IO [Int]
  putStrLn $ if last xs < head ys then "No War" else "War" 

Measured memory_bytes: 1020
import numpy as np
n,k=map(int,input().split())
a=list(map(int,input().split()))
a=np.array(a)
a.sort()
nega=a[a<0]
zera=a[a==0]
posa=a[a>0]

def cnt(x):
  y=0
  if x>=0:
    y+=n*len(zera)
  y+=np.searchsorted(a,x//posa,side="right").sum()
  y+=n*len(nega)-np.searchsorted(a,-(-x//nega)).sum() 
  y-=len(a[a*a<=x])
  return y//2

r=10**18
l=-r-1
while r-l>1:
  c=(r+l)//2
  if cnt(c)>=k:
    r=c
  else:
    l=c
print(r)

Measured memory_bytes: 32312