akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    ll X; cin >> X;
    
    ll a=0, b=0;
    bool f=false;

    Rep1(i, -120, 120){
        Rep1(j, -120, 120){
            if((ll)i*i*i*i*i - (ll)j*j*j*j*j == X){
                a = i; b = j;
                f = true;
            }
        }
    }

    cout << a << " " << b << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7712
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll n;cin>>n;
    ll res=0;
    for(ll i=1;i<=n;i++){
        ll buf=n/i;
        ll buf2=buf*i;
        res+=(buf2+i)*buf/2;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3592
s=gets
n=gets.to_i
n.times do
  a,b,c,d=gets.split
  b=b.to_i
  c=c.to_i
  if a == "replace"
    i=b
    j=0
    (b..c).each do
      s[i]=d[j]
      i=i+1
      j=j+1
    end
  elsif a == "reverse"
    s[b..c]= s[b..c].reverse
  elsif a == "print"
    puts s[b..c]
  end
end



Measured memory_bytes: 6880
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll N,M;cin>>N>>M;
    vector<ll> A(N);
    ll sm=0;
    REP(i,N){
        cin>>A[i];
        sm+=A[i];
    }
    ll cnt=0;
    REP(i,N){
        if(A[i]*4*M>=sm)cnt++;
    }
    if(cnt>=M)cout<<"Yes";
    else cout<<"No";
    cout<<"\n";

}

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

int main() {
  string line;
  vector<string> v;
  stringstream ss;

  getline(cin, line);

  ss << line;

  while (getline(ss, line, ' ')) {
    v.push_back(line);
  }

  for (auto o : v) {
    cout << o.at(0);
  }
  cout << endl;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
void init() {
	iostream::sync_with_stdio(false);

}

int grid[3][3] = {};
void solve() {
	REP(i, 3) {
		REP(q, 3) {
			cin >> grid[i][q];
		}
	}
	int n;
	cin >> n;
	REP(i, n) {
		int a;
		cin >> a;
		REP(q, 3) {
			REP(j, 3) {
				if (grid[q][j] == a) {
					grid[q][j] = -1;
				}
			}
		}
	}
	REP(i, 3) {
		int ok = 1;
		REP(q, 3) {
			if (grid[i][q] != -1) ok = 0;
		}
		if (ok == 1) {
			cout << "Yes" << endl;
			return;
		}
		ok = 1;
		REP(q, 3) {
			if (grid[q][i] != -1) ok = 0;
		}
		if (ok == 1) {
			cout << "Yes" << endl;
			return;
		}
	}
	if (grid[0][0] == -1 && grid[1][1] == -1 && grid[2][2] == -1) {
		cout << "Yes" << endl;
		return;
	}
	if (grid[2][0] == -1 && grid[1][1] == -1 && grid[0][2] == -1) {
		cout << "Yes" << endl;
		return;
	}
	cout << "No" << endl;
}

int main() {
	init();
	solve();
}

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

int n;

int main(){
  cin >> n;
  long long sum = 0, m = 10e9;
  bool sino = false;
  rep(i, n){
    long long num; cin >> num;
    if(num < 0){
      sino = !sino;
    }
    num = abs(num);
    sum += num;
    m = min(num, m);
  }
  if(sino)
    cout << sum - m * 2 << endl;
  else
    cout << sum << endl;
  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	ll n;cin>>n;
	vector<string>s(n);
	rep(i,n)cin>>s[i];
	sort(all(s));
	map<char,ll>t;
	rep(i,s.size()){
		if(s[i][0]=='M')t['M']++;
		if(s[i][0]=='A')t['A']++;
		if(s[i][0]=='R')t['R']++;
		if(s[i][0]=='C')t['C']++;
		if(s[i][0]=='H')t['H']++;
	}
	ll ans=0;
	ans+=t['M']*t['A']*(t['R']+t['C']+t['H']);
	ans+=t['M']*t['R']*(t['C']+t['H']);
	ans+=t['M']*t['C']*t['H'];
	ans+=t['A']*t['R']*(t['C']+t['H']);
	ans+=t['A']*t['C']*t['H'];
	ans+=t['R']*t['C']*t['H'];
	cout<<ans<<endl;
}

Measured memory_bytes: 6144
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll maxx=max({(a*c),(a*d),(b*c),(b*d)});
  cout<<maxx<<endl;
}

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

int main() {
	int N;
	int A;
	int max=9999999;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A;
		int j = 0;
		while (A % 2 == 0) {
			A /= 2;
			j++;
			if (j > max) break;
		}
		if (j < max) max = j;
		if (max == 0) break;
	}
	cout << max;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		long N, K;
		N = sc.nextLong();
		K = sc.nextLong();

		long mod0 = 0, modHalf = 0;
		for (int i = 1; i <= N; i++) {
			if (i % K == 0) mod0++;
			if (K % 2 == 0 && i % K == K / 2) modHalf++;
		}

		System.out.println(mod0 * mod0 * mod0 + modHalf * modHalf * modHalf);
	}
}

Measured memory_bytes: 23764
#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; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

char s[101][101];
int d[101][101]; // d[i][j] := (i,j)に行くのにかかる最小のコスト

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    rep(i,101)rep(j,101)d[i][j] = 1e9+7;
    d[0][0] = 0;
    int h,w;
    cin >> h >> w;

    rep(i,h)rep(j,w)cin >> s[i][j];

    queue<pair<int,int>> q;
    q.push({0,0});
    while(!q.empty()){
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        // 取り出した点が黒だったら黒の間移動しまくる
        for(int i=0;i<2;i++){
            int nx = x + dx[i];
            int ny = y + dy[i];
            if( nx >= h || ny >= w )continue;
            if(s[x][y] == '.'){
                if(s[nx][ny] == '#'){
                    if(d[nx][ny] > d[x][y] + 1){
                        d[nx][ny] = d[x][y] + 1;
                        q.push({nx,ny});
                    }
                }else{
                    if(d[nx][ny] > d[x][y]){
                        d[nx][ny] = d[x][y];
                        q.push({nx,ny});
                    }
                }
            }else{
                if(d[nx][ny] > d[x][y]){
                    d[nx][ny] = d[x][y];
                    q.push({nx,ny});
                }
            }
        }
    }
    cout << d[h-1][w-1] + (s[0][0]=='#') << endl;
}

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

using namespace std;
 
int main() {
    string t;cin>>t;
    string kotae="";
    for(int i = 0;i<t.length();i++){
      if(t[i] == '?'){
        kotae+="D";
      }
      if(t[i] == 'P') kotae+= "P";
      if(t[i] == 'D') kotae += "D";                          
    }
    cout<< kotae;
    return 0;
}

Measured memory_bytes: 3452
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};
const int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const string dir8[8] = {"U", "RU", "R", "RD", "D", "LD", "L", "LU"};

// Self settings
// clang-format off
#define MAX_N 100000
#define MAX 100000
#define INFTY (1<<30)
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } Point operator*(double a) { return Point(a * x, a * y); } Point operator/(double a) { return Point(x / a, y / a); } double abs() { return sqrt(norm()); } double norm() { return x * x + y * y; } bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.y) < EPS && fabs(y - p.y) < EPS; } };
typedef Point Vector;
double norm(Vector a) { return a.x * a.x + a.y * a.y; }
double abs(Vector a) { return sqrt(norm(a));}
double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }
struct Segment { Point p1, p2; };
typedef Segment Line;
// clang-format on

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<string> s(N);
  vector<int> sab(N);
  int nfb = 0, nba = 0, bab = 0;
  REP(i, N) cin >> s[i];

  for (int i = 0; i < N; i++) {
    int cnt = 0;
    if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A') {
      bab++;  // c1
    } else if (s[i][s[i].size() - 1] == 'A') {
      nba++;
    } else if (s[i][0] == 'B') {
      nfb++;
    }

    for (int j = 0; j < s[i].size() - 1; j++) {
      if (s[i][j] == 'A' && s[i][j + 1] == 'B') {
        cnt++;
      }
    }
    sab[i] = cnt;
  }

  ll ans = 0;
  REP(i, N) ans += sab[i];

  if (bab == 0) {
    ans += min(nba, nfb);
  } else {
    if (nba + nfb > 0) {
      ans += bab + min(nba, nfb);
    } else if (nba + nfb == 0) {
      ans += bab - 1;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
n, k = map(int, input().split())
p = list(map(lambda x: int(x) - 1, input().split()))
c = list(map(int, input().split()))
    
visited = [False] * n
ans = max(c)

for i in range(n):
    if visited[i]:
        continue
    arr = []
    u = i
    while not visited[u]:
        arr.append(c[u])
        visited[u] = True
        u = p[u]
    s = sum(arr) * (k // len(arr))
    rem = k % len(arr)
    if k // len(arr) >= 1:
        s -= sum(arr)
        rem += len(arr)
        
    arr += arr + arr
    pref_sum = [0]
    for i in arr:
        pref_sum.append(pref_sum[-1] + i)
    # print(pref_sum, s, rem) 
            
    for f in range(len(arr) // 2):
        # ans = max(ans, s + sum(arr[f:f + rem])) 
        for g in range(f + 1, len(pref_sum)):
            if g - f <= k:
                ans = max(ans, pref_sum[g] - pref_sum[f])
            if g - f <= rem:
                ans = max(ans, s + pref_sum[g] - pref_sum[f])
print(ans)
    


Measured memory_bytes: 74548
import itertools
N = int(input())
ans = 0

for i in range(3, len(str(N)) + 1):
  for ptn in itertools.product((3, 5, 7), repeat=i):
    if (3 not in ptn) or (5 not in ptn) or (7 not in ptn):
        continue
    a = int("".join(list(map(str, ptn))))
    if a <= N:
      ans +=1

print(ans)


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

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	bool jdg = true;
	if(c < a || c > b) jdg = false;
	if(jdg) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

def factorize(num: int) -> dict:
    """ 素因数分解 """
    from math import sqrt
    from collections import Counter

    d = Counter()
    # 終点はルート切り捨て+1
    for i in range(2, int(sqrt(num))+1):
        # 素因数分解：小さい方から割れるだけ割って素数をカウント
        while num % i == 0:
            num //= i
            d[i] += 1
        # 1まで分解したら終了
        if num == 1:
            break
    # 最後に残ったnumは素数(ただし1^1は1^0なので数に入れない)
    if num != 1:
        d[num] += 1
    return d

N = INT()

primes = factorize(N)
ans = N
# Nが持つ各素数について、オイラーのファイ関数を使っていく
for k in primes.keys():
    ans *= 1 - 1/k
print(int(ans))



Measured memory_bytes: 6088
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ll, ii>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 120000
#define tam2 200000
#define offset 
const ll MOD= 998244353;
int main()
{
    double r;
    cin>>r;
    printf("%.9lf\n",2*r*PI);
}
// PLUS ULTRA!


Measured memory_bytes: 3772
A, B, M = map(int, input().split())
rfg = [int(i) for i in input().split()]
mcw = [int(i) for i in input().split()]
discount = [list(map(int, input().split())) for i in range(M)]

min_price = 10 ** 10
# 割引券を使ったときの最低価格をみる
for ticket in discount:
    tmp = rfg[ticket[0]-1] + mcw[ticket[1]-1] - ticket[2]
    if tmp < min_price:
        min_price = tmp


# 普通に買ったときの最低価格を見る
# min_priceを下回った時点でおわり
rrfg = sorted(rfg)
mmcw = sorted(mcw)

is_true = False
for i in range(A):
    for j in range(i, B):
        tmp = rrfg[i] + mmcw[j]
        if tmp >= min_price:
            break
        else:
            min_price = tmp
            is_true = True
            break

    if is_true:
        break

print(min_price)


Measured memory_bytes: 40436
#include<stdio.h>
int main(void){
	int n,i,r=1;
	scanf("%d",&n);
	for(i=9;i;i--){
		if(n%i==0){
			r-=10<=n/i;
			break;
		}
	}
	printf(r?"Yes":"No");
	return 0;
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
string divide[4]={"dream","dreamer","erase","eraser"};
int main(){
    int r,g,b;
    cin>>r>>g>>b;
    int x=100*r+10*g+b;
    if(x%4==0) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fin         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FL          freopen("in", "r", stdin),freopen("out", "w", stdout);
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 2 * 1e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int main(){
    //FL;
    fin;
    int x, y;
    cin >> x >> y;
    int a = (4 * x - y) / 2;
    int b = (y - 2 * x) / 2;
    
    if(a + b == x && 2 * a + 4 * b == y && (4 * x - y) % 2 == 0 && (y - 2 * x) % 2 == 0 && a >= 0 && b >= 0)
        cout << "Yes\n";
    else
        cout << "No\n";
    EjecuteTime;
    return 0;
}       



Measured memory_bytes: 3800
# include<iostream>
# include<vector>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;
const ll N = 13;
const ll MOD = 1000000007;
ll dp[100010][13];
int main() {
    int n, d;
    scanf("%d %d", &n, &d);
    int t = 2*d+1;
    int ans = ceil(n*1.0/t*1.0);
    cout << ans << endl;
}

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

int main() {
    int x,a,b;
    cin >> x >> a >> b;
    if(a>=b){
        cout << "delicious";
    }
    else if(b-a > x){
        cout << "dangerous";
    }
    else{
        cout << "safe";
    }
}

Measured memory_bytes: 256
from sys import stdin
import fractions

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]

lcm_a = A[0] * A[1] // fractions.gcd(A[0], A[1])

if len(A) > 2:
    for k in A[2:]:
        lcm_a = lcm_a * k // fractions.gcd(lcm_a, k)

modulo_sum = 0

for k in A:
    modulo_sum += (lcm_a - 1) % k

print(modulo_sum)

Measured memory_bytes: 5344
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

while np.count_nonzero(A) != 0:
    m = min(A)
    idx = list(A).index(m)
    A = A % m
    A[idx] = m
    A = A[np.nonzero(A)]
    if np.count_nonzero(A) == 1:
        break

print(A[0])


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

typedef pair<int, int> pi;

int N, M;
vector<vector<pi> > P;
vector<string> A;

void input_init(void) {
	cin >> N >> M;
	P.resize(N + 1);
	for (int i = 0; i < M; ++i) {
		int p, y;
		cin >> p >> y;
		P[p].push_back(make_pair(y, i));
	}
	A.resize(M);
}

void make_str(int p, int x, int idx) {
	string s1 = to_string(p);
	int rest = 6 - s1.length();
	string s2 = string(rest, '0') + s1;
	string s3 = to_string(x);
	rest = 6 - s3.length();
	string s4 = string(rest, '0') + s3;
	A[idx] = s2 + s4;
}

void solve(void) {
	for (int i = 1; i < (int)P.size(); ++i) {
		if (P[i].size() == 0)
			continue;
		sort(P[i].begin(), P[i].end());
		for (int j = 0; j < (int)P[i].size(); ++j) {
			make_str(i, j + 1, P[i][j].second);
		}
	}
}

int main(void) {
	input_init();
	solve();
	for (int i = 0; i < M; ++i)
		cout << A[i] << '\n';
	return 0;
}


Measured memory_bytes: 12416
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main(void){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A % D == 0){
    A = A / D;
  } else {
    A = A / D + 1;
  }
  if(C % B == 0){
    C = C / B;
  } else {
    C = C / B + 1;
  }
  if(A < C){
    cout << "No";
  } else {
    cout << "Yes";
  }
}

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

int main(){
    int K;cin>>K;
    string S;cin>>S;
    if(S.size()<=K)cout<<S<<endl;
    else{
        string S_sub=S.substr(0,K);
        cout<<S_sub+"..."<<endl;
    }
}

Measured memory_bytes: 3628
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a_sum = [0]
b_sum = [0]
for i in range(n):
    a_sum.append(a[i]+a_sum[i])
    if a_sum[i]>k:
        break
for i in range(m):
    b_sum.append(b[i]+b_sum[i])
    if b_sum[i]>k:
        break
        
ans = 0
y = len(b_sum)-1
for i in range(len(a_sum)):
    if a_sum[i]>k:
        break
    time = k - a_sum[i]
    for j in range(y,-1,-1):
        if time>=b_sum[j]:
            y = j
            break
    if time>=b_sum[len(b_sum)-1]:
        j = len(b_sum)-1
    ans = max(ans,i+j)
    
print(ans)

Measured memory_bytes: 40444
#include<iostream>
using namespace std ;
using ll = long long ;

int main(){
	ll n ; cin >> n ;
	ll mn = 10000000000 ;
	ll sum = 0 ;
	ll cnt = 0 ;
	for(int i=0;i<n;i++){
		ll a ; cin >> a ;
		if(a<0){
			cnt++ ;
			a *= -1 ;
		}
		sum += a ;
		if(mn>a) mn = a ;
	}
	if(cnt%2==0) cout << sum << endl ;
	else cout << sum-2*mn << endl ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
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 long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    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 % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n,k,q;
  	ci(n>>k>>q);
  vll A(n);
  FOR(i,0,n){
    A[i]=k-q;
  }
  
  FOR(i,0,q){
    ll a;
    	ci(a);
    A[a-1]++;
  }
  
  FOR(i,0,n){
    if(A[i]>0){
      co("Yes")
    }
    else{
      co("No")
    }
  }
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue
typedef priority_queue<int> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

int main(){
    int N,M,X;
    cin>>N>>M>>X;
    vvi A(N);
    vi price(N);
    for(int i=0;i<N;i++){
        cin>>price[i];
        A[i]=vi(M);
        for(int j=0;j<M;j++){
            cin>>A[i][j];
        }
    }
    int LMAX=1;
    LMAX<<=N;
    int ans=999999999;
    for(int i=0;i<LMAX;i++){
        //cout<<"type"<<i<<" ";
        int cur_i=i;
        int sum_price=0;
        vi rikaido(M,0);
        for(int j=0;j<N;j++){
            if(cur_i&0x0001){
                //cout<<"buy"<<j<<" ";
                sum_price+=price[j];
                for(int k=0;k<M;k++){
                    rikaido[k]+=A[j][k];
                }
            }
            cur_i>>=1;
        }
        bool ok=true;
        for(int j=0;j<M;j++){
            //cout<<"rikaido"<<j<<"="<<rikaido[j]<<" ";
            if(rikaido[j]<X){
                ok=false;break;
            }
        }
        if(ok){
            ans=min(ans,sum_price);
            //cout<<"ok";
        }
        //cout<<endl;
    }
    if(ans<999999999){
        cout<<ans<<endl;
    }else{
        cout<<-1<<endl;
    }
}


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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
// ll mod_pow(ll x, ll n, ll mod){//x^n % mod
//     if (n == 0)
//         return 1;
//     ll res = mod_pow(x * x % mod, n / 2, mod);
//     if (n & 1)
//         res = res * x % mod;
//     return res;
// }
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N; cin >> N;
    map<int, int> sorted_mp;
    REP(i, N) {
        int tmp; cin >> tmp;
        sorted_mp.insert(make_pair(tmp, i+1));
    }
    for (auto itr = sorted_mp.begin(); itr != sorted_mp.end(); ++itr) {
        if (itr == sorted_mp.end()) cout << itr->second << endl;
        else cout << itr->second << " ";
    }
    return 0;
}


Measured memory_bytes: 5504
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

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

        Long n = Long.parseLong(br.readLine());
        Long[] a = new Long[5];
        int min = 0;
        for(int i = 0; i < 5; i++) {
            a[i] = Long.parseLong(br.readLine());
            if(a[min] >= a[i]) {
                min = i;
            }
        }

        System.out.println(4 + (long) Math.ceil(1.0 * n / a[min]));
    }
}

Measured memory_bytes: 22228
#include<bits/stdc++.h>
using namespace std;
int n,s,ct=0;
int main()
{
    cin>>n>>s;
    for(int i=0;i<=n;i++) {
        for(int j=0;j<=n;j++) {
            int p = s-i-j;
            if(p >= 0 && p <= n) {
              ct++;
            }
        }
    }
    cout<<ct<<endl;
    return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};



int main()
{
    string s;
    cin>>s;
    ll n = s.size();
    vector<ll> ans(n);
    ll odd=0, even=0;
    ll lastr = 0;
    for (ll i = 0; i < n; i++)
    {
        swap(odd,even);
        even++;
        if(s[i]=='R')
        {
            lastr=i;
        }
        else //L
        {
            if((i-lastr)%2==1)
            {
                ans[lastr]+=odd;
                ans[lastr+1]+=even;

            }
            else
            {
                ans[lastr]+=even;
                ans[lastr+1]+=odd;
            }
            odd=0;
            even=0;
        }
    }
    


    for (int i = 0; i < n; i++)
    {
        if(i>0) cout<<" ";
        cout<<ans[i];
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#define INF 1001001001
using namespace std;


int ary[10010],dp[2][2][5010];
int main(){
	int N;
	cin>>N;
	for(int i=1;i<N;i++){
		cin>>ary[i];
	}

	int in=0,ou=1;
	fill(dp[in][0],dp[in][0]+N/2+1,INF);
	fill(dp[in][1],dp[in][1]+N/2+1,INF);
	dp[in][0][1]=0;
	for(int i=1;i<N;i++){
		dp[ou][0][0]=INF;
		for(int j=0;j<(N/2);j++){
			dp[ou][0][j+1]=min(dp[in][0][j],dp[in][1][j]+ary[i]);
		}
		for(int j=0;j<=(N/2);j++){
			dp[ou][1][j]=min(dp[in][1][j],dp[in][0][j]+ary[i]);
		}
		swap(in,ou);
	}
	cout<<min(dp[in][0][N/2],dp[in][1][N/2])<<endl;
	return 0;
}

Measured memory_bytes: 3228
#define DEBUG 0

/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 2/23/2019, 11:25:10 PM
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N, K;
int a[60];

bool able = true;
vector<int> V;

void flush()
{
  if (!able)
  {
    cout << -1 << endl;
  }
  else
  {
    int S = V.size();
    cout << S << endl;
    for (auto i = 0; i < S; i++)
    {
      cout << V[i] + 1;
      if (i < S - 1)
      {
        cout << " ";
      }
      else
      {
        cout << endl;
      }
    }
  }
  exit(0);
}

typedef tuple<int, int> C;
vector<C> W;

int main()
{
  cin >> N >> K;
  for (auto i = 0; i < N; i++)
  {
    cin >> a[i];
    W.push_back(C(a[i], i));
  }
  C remain = C(-1, -1);
  for (auto i = 0; i < 100; i++)
  {
    sort(W.begin(), W.end());
    reverse(W.begin(), W.end());
    for (auto it = W.begin(); it != W.end(); it++)
    {
      if (get<0>(*it) == 0)
      {
        able = false;
        flush();
      }
      get<0>(*it)--;
      V.push_back(get<1>(*it));
    }
    K--;
    if (K == -1)
    {
      flush();
    }
    auto it = W.end();
    it--;
    if (get<1>(remain) == -1)
    {
      remain = *it;
      W.erase(it);
    }
    else
    {
      C temp = *it;
      W.erase(it);
      W.push_back(remain);
      remain = temp;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string a,b;
  cin>>a>>b;
  if(a=="H")
    {
      if(b=="H")
	{
	  cout<<"H"<<endl;
	}else{
	cout<<"D"<<endl;
      }
    }
  if(a=="D")
    {
      if(b=="H")
	{
	  cout<<"D"<<endl;
	}else{
	cout<<"H"<<endl;
      }
    }
  return 0;
}


Measured memory_bytes: 256
import bisect
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, M, V, P = list(map(int, sys.stdin.buffer.readline().split()))
A = list(map(int, sys.stdin.buffer.readline().split()))

A.sort(reverse=True)
RA = A[::-1]


def can_choose(k):
    # A[k]が選ばれるか
    ak = A[k] + M
    greaters = N - bisect.bisect_right(RA, ak)
    if greaters >= P:
        return False
    # 自分より上位 P - 1 人には全部配る
    rem = (V - P) * M

    cnt = 0
    for i, a in reversed(list(enumerate(A))):
        if i == k:
            continue
        if rem <= 0:
            break
        rem -= min(M, ak - a)

        cnt += 1
        if cnt >= N - P:
            break
    return rem <= 0


# print(A)
# for i in range(N):
#     a = can_choose(i)
#     print(A[i], a)


ok = -1
ng = N
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if can_choose(mid):
        ok = mid
    else:
        ng = mid
print(ok + 1)


Measured memory_bytes: 89896
import sys
from collections import deque, defaultdict
import copy
import bisect
#input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq

s = input()
t = input()

word = defaultdict(int)
for i in range(len(s)):
	if type(word[s[i]]) == int:
		word[s[i]] = []
	bisect.insort(word[s[i]], i)

loc = 0
ret = 0
for i in range(len(t)):
	if word[t[i]] == 0:
		print(-1)
		exit()
	else:
		select = bisect.bisect_left(word[t[i]], loc)
		if select == len(word[t[i]]):
			ret += 1
			loc = word[t[i]][0] + 1
		else:
			loc = word[t[i]][select] + 1
print(ret*len(s) + loc)

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

using namespace std;

int main(){
	string s;
	while(getline(cin, s)){
		for(int i = 0; i < s.size(); ++i){
			if(s[i] == '@'){
				int n = s[++i] - '0';
				cout << string(n, s[++i]);
			}else{
				cout << s[i];
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = n; i >= n; i--)

#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))

#define endl "\n"
#define pb push_back
#define rtn return
#define elif else if

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

typedef long long ll;
typedef unsigned long long ull;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
/*****Variable*****/
ll x;

ll f(ll n){
	if(n == -1) rtn 0;
	else rtn n / x + 1;
}
signed main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll a, b;
	cin >> a >> b >> x;
	cout << f(b) - f(a-1) << endl;
	rtn 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut arr: Vec<Vec<char>> = Vec::new();
    let mut ans = "Yes";
    for i in 0..n {
        let x: String = read();
        let mut x = x.chars().collect::<Vec<char>>();
        if i != 0 {
            if arr[i - 1][0] != x[0] {
                ans = "No";
                break;
            }
        }

        x.reverse();
        if arr.contains(&x) {
            ans = "No";
            break;
        }

        arr.push(x);
    }
    println!("{}", ans);
}


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

int main(){
	int S, h, m, s;
	cin >> S;
	h = S / 3600;
	m = S / 60 - h * 60;
	s = S - (h * 3600 + m * 60);
	cout << h << ":" << m << ":" << s << endl;
return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__

	int N;
	cin>>N;
	vector<ll> A(N);
	REP(i,N)cin>>A[i];
	sort(ALL(A),greater<ll>());
	ll ans,cnt;
	ans=1;
	cnt=0;
	for(int i=0; i+1<N;){
		if(A[i+1]==A[i] && cnt<2){ans*=A[i]; i+=2; cnt++;}
		else i++;
	}
	if(cnt==2)cout<<ans<<endl;
	else cout<<0<<endl;
}


Measured memory_bytes: 3996
# -*- coding: utf-8 -*-
"""
A - Entrance Examination
https://atcoder.jp/contests/abc117/tasks/abc117_a

"""
import sys


def solve(T, X):
    return T / X


def main(args):
    T, X = map(int, input().split())
    ans = solve(T, X)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


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

#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main()
{
    string s;
    cin >> s;
    int n = s.length();
    int count0 = 0;
    int count1 = 0;

    rep(i, n)
    {
        if (s[i] == '0')
        {
            count0++;
        }
    }

    count1 = n - count0;
    cout << 2 * min(count0, count1) << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int ab,bc,ca;cin>>ab>>bc>>ca;
    double S;
    S=(double)ab*bc/2;
    cout<<S<<endl;
    return 0;
}

Measured memory_bytes: 256
n, m, x, y = [int(i) for i in input().split()]
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]
xma, ymi = max(xl), min(yl)
for z in range(x+1,y+1):
    if xma < z <= ymi:
        print("No War")
        break
else:
    print("War")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n; cin >> n;
    ll ans;
    if(n%2 == 0){
        ans = n/2-1;
    }
    else ans = n/2;
    cout << ans << endl;
}

Measured memory_bytes: 256
n,a,b = map(int,input().split())
modnum = 10**9+7
ans = pow(2,n,modnum)-1

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
ans -= combination(n, a, modnum)
ans -= combination(n, b, modnum)
ans %= modnum
print(ans)

Measured memory_bytes: 40812
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;
int main()
{
    char a[300000]={0};
    while(cin>>a){
        char moji=0,c=0;
        int kaz=0;
        for(int i=0;i<strlen(a);i++){
            if(a[i]!='@')cout<<a[i];
            else if(a[i]=='@'){
                for(int j=0;j<a[i+1]-'0';j++){
                    cout<<a[i+2];
                }
                i+=2;
            }
        }
        cout<<endl;
        for(int i = 0; i < 1000; i++){
            a[i]=0;
        }
    }
    return 0;
}

Measured memory_bytes: 1432
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long i64;
typedef pair<i64,i64> P;


i64 gcd(i64 x, i64 y){
	if(y == 0) return x;
	return gcd(y, x%y);
}
i64 lcm(i64 x, i64 y){
	return x*y / gcd(x,y);
}
i64 a,b,c,d;

int main(){
	cin >> a >> b >> c >> d;
	
	i64 cnt = b-a + 1;
	cnt -= b / c - (a-1) / c;
	cnt -= b / d - (a-1) / d;
	cnt += b / lcm(c,d) - (a-1) / lcm(c,d);
	
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		System.out.println("? " + (long) 1e10);
		String s = sc.next();
		if (s.equals("Y")) {
			int cnt = 0;
			while (true) {
				System.out.println("? " + (long) (2 * Math.pow(10, cnt)));
				s = sc.next();
				if (s.equals("Y")) {
					System.out.println("! " + (long) Math.pow(10, cnt));
					return;
				}
				++cnt;
			}
		} else {

			int cnt = 9;
			while (true) {
				System.out.println("? " + (long) Math.pow(10, cnt));
				s = sc.next();
				if (s.equals("Y")) {
					break;
				}
				--cnt;
			}
			long left = (long) Math.pow(10, cnt);
			long right = (long) Math.pow(10, cnt + 1) - 1;
			// (left,right]の範囲
			while (right - left > 1) {
				long middle = (right + left) / 2;
				System.out.println("? " + middle * 10);
				s = sc.next();
				if (s.equals("Y")) {
					right = middle;
				} else {
					left = middle;
				}
			}
			System.out.println("! " + right);
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


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

int main() {
    string s;
    int nq;
    cin >> s >> nq;

    auto big_enough = 1'000'000;
    auto buffer = vector<char>(big_enough);
    char *begin = buffer.data() + (big_enough / 2);
    char *end = begin;
    for (int i = 0; i < s.length(); i++)
        *end++ = s[i];
    auto *tail_insertion = end;
    auto *head_insertion = begin - 1;

    for (int i = 0; i < nq; i++) {
        int t_i;
        cin >> t_i;
        if (t_i == 1) {
            swap(head_insertion, tail_insertion);
        }
        if (t_i == 2) {
            int f_i;
            char c_i;
            cin >> f_i >> c_i;
            if (f_i == 1) {
                *head_insertion = c_i;
                head_insertion += (head_insertion < tail_insertion ? -1 : +1);
            }
            if (f_i == 2) {
                *tail_insertion = c_i;
                tail_insertion += (head_insertion < tail_insertion ? +1 : -1);
            }
        }
    }

    if (head_insertion < tail_insertion) {
        s = string(head_insertion + 1, tail_insertion);
    } else {
        s = string(tail_insertion + 1, head_insertion);
        reverse(s.begin(), s.end());
    }

    cout << s;
    return 0;
}


Measured memory_bytes: 1948
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    double ans = ((n / 2) + (n & 1)) * 1.0  / n;
    cout << fixed << setprecision(10) << ans;
    
}

Measured memory_bytes: 256