akhauriyash/Code-Regression huggingface dataset:
// mod triangular_relationship;
// mod array;
use std::io;
use std::io::prelude::*;





fn main() {
    // triangular_relationship::run();

    // basic boilerplate
    let input = io::stdin();
    let mut string = String::new();

    // read in the input
    input.read_line(&mut string).unwrap();

    let elems = string.split(" ").map(|seq| seq.trim().parse::<u64>().unwrap()).collect::<Vec<_>>();

    // sweet and sexy
    let (N,K) = (elems[0], elems[1]);

    let whole_number_count = (N / K) as u64;
    let mut values = whole_number_count * whole_number_count * whole_number_count; // choosing 3 from #whole_number count

    // now if we need to consider halves
    if K % 2 == 0 && K/2 > 0 {
        let half_and_whole_number_count = N / (K / 2);
        let half_number_count = half_and_whole_number_count - whole_number_count;
        values += half_number_count * half_number_count * half_number_count;
    }


    println!("{}", values)

}



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

int k, x;

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#define CO(a, b, c) ((a)?(b):(c))

using namespace std;

int func(long a, long b){
	return (powl(a, 5) - powl(b, 5));
}

int main(void)
{
	
	int x, tmp;
	cin >> x;

	for(int b = -119; b < 119; b++)
	{
		for (int a = b + 1; a < 120; a++)
		{
			tmp = func(a, b);
			if(tmp==x)
			{
				cout << a << ' ' << b << endl;
				return 0;
			}
		}
	}

	return 0;
	
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
#define lp3(i,a,b) for(int i=a;i<b;i++)
#define lp2(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n,sum=0;
	cin>>n;
	lp2(i,n){
		int a;
		cin>>a;
		sum+=a;
	}
	sum-=n;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int main(void){
       int i = 0;
       char str[1200],d;
       while(1){
               scanf("%c",&d);
               if(d == '\n') {
                    str[i] = '\0';
                    break;
               };
               if(islower(d)){
                       str[i] = toupper(d);
               }
               else if(isupper(d)){
                       str[i] = tolower(d);
               }
               else str[i] = d;
               i++;
       }
       printf("%s",str);
       printf("\n");
       return 0;
}

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

struct Unionfind {
  // tree number
  vector<int> par;
  // constructor
  Unionfind(int n = 1) : par(n, -1) {}
  // search root
  int root(int x) {
    if (par[x] < 0) return x;
    return par[x] = root(par[x]);
  }
  // is same?
  bool issame(int x, int y) { return root(x) == root(y); }

  // add
  // already added, return 0
  bool uni(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return 0;
    if (par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return 1;
  }
  int size(int x) { return -par[root(x)]; }
};

using P = pair<int, int>;

int n;
Unionfind uf;
vector<int> id;
vector<P> v;
set<P> st;

int main() {
  cin >> n;
  uf = Unionfind(n);
  v.resize(n);
  id.resize(n);
  iota(id.begin(), id.end(), 0);
  for (auto &p : v) cin >> p.first >> p.second;
  sort(id.begin(), id.end(), [](int l, int r) { return v[l] < v[r]; });
  st.insert(P(v[id[0]].second, id[0]));
  for (int i = 1; i < n; ++i) {
    int now = id[i];
    auto fi = *st.begin();
    while (st.size() && (*st.begin()).first < v[now].second) {
      auto p = (*st.begin());
      uf.uni(p.second, now);
      st.erase(p);
    }
    st.insert(fi);
    st.insert(P(v[now].second, now));
  }
  for (int i = 0; i < n; ++i) cout << uf.size(i) << endl;
  return 0;
}

Measured memory_bytes: 10948
#include<cstdio>
#include<iostream>
using namespace std;
int n,k;
int a[300010];
int main()
{
    scanf("%d%d",&k,&n);
    if(k&1)
    {
        for(int i=1;i<=n;i++)
            a[i]=(k+1)/2;
        int last=n;
        for(int i=1;i<=n/2;i++)
            if(a[last]==1) last--;
            else 
            {
                a[last]--;
                for(int j=last+1;j<=n;j++)
                    a[j]=k;
                last=n;
            }
        for(int i=1;i<=last;i++)
            printf("%d ",a[i]); 
    }
    else
    {
        printf("%d ",k/2);
        for(int i=2;i<=n;i++)
            printf("%d ",k);
    }
    return 0;
}

Measured memory_bytes: 3456
/* B */

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	string s;
	cin >> s;
	int win = 0;
	int n = s.size();
	int m = 15;

	win += m - n;
	for(int i = 0; i < n; i++){
		if(s[i] == 'o') win++;
	}

	if(win >= 8) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
import math
N, K = map(int,input().split())
rate=1/N
ans=0
for i in range(1,N+1):
    if i >= K:
        ans+=rate*(N-i+1)
        break
    else:
        cnt=0
        n=-(-math.log2(K/i)//1)
        ans+=rate*(0.5**n)
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <math.h>
#include <iomanip>

typedef long long ll;
using namespace std;

bool is_mm(int x){
    return (x <= 12) && (x > 0);
}

int main() {
    int k, n;
    cin >> n >> k;
    double proba = 0.0;
    for(int i=1; i<=n; ++i){
        if( i >= k){
            proba += 1.;
            continue;
        }
        double lgstp = log2(k) - log2(i);
        ll stp = ceil(lgstp);
        double score = pow(0.5, stp);
        proba += score;
    }
    cout << setprecision(15) << proba / n << endl;
    return 0;
}


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

#define endl ("\n")
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define SQ (a)*(a)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define deb(x) cout<<#x<<" "<<x<<endl;

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

const ll mod = 1e9L+7;
int n;
vector<ll> inp;
vector<int> dp;

int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    /*freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    #ifndef ONLINE_JUDGE
    #endif*/
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        cin>>n;
        ll ans = 0;

        ll arr[n];
        rep(i,0,n) cin>>arr[i];
        rep(i,1,n) 
        {
            int a = max(arr[i-1]-arr[i],0LL);
            arr[i] += a;
            ans += a;
        }

        cout<<ans<<endl;
    }
}


Measured memory_bytes: 5204
import string

def resolve():
    # 整数 1 つ
    s = input()
    # 整数複数個
    # a, b, c = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    alpha = string.ascii_lowercase
    A = [alpha[i] for i in range(len(alpha))]

    for x in A:
        if x not in s:
            print(x)
            break
        if x == "z":
            print("None")

resolve()

Measured memory_bytes: 39280
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
const int N = 100003;
int n, a[N];
map<int, int> M;
int main(){
	scanf("%d", &n);
	for(Rint i = 1;i <= n;i ++) scanf("%d", a + i), ++ M[a[i]];
	if(!(n % 3)){
		int ans = 0, res = 0;
		for(auto it = M.begin();it != M.end();it ++)
			if(it -> second < (n / 3)){
				puts("No");
				return 0;
			} else{
				++ ans; if(it -> second & 1)res ^= it -> first;
			}
		if(ans > 3 || res){
			puts("No");
			return 0;
		}
		puts("Yes");
	} else {
		puts((n == 1 || M[0] == n)? "Yes" : "No");
	}
}

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

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

    int cnt = 0;

    if ( n >= 10 ) {
        cnt += 9;
    }
    if ( n >= 1000 ) {
        cnt += 900;
    }
    if ( n >= 100000 ) {
        cnt += 90000;
    }

    if ( n < 100000 & n >= 10000 ) {
        cnt += n - 10000 + 1;
    }
    else if ( n < 1000 & n >= 100 ) {
        cnt += n - 100 + 1;
    }
    else if ( n < 10 ) {
        cnt += n;
    }

    cout << cnt << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a>9 || b>9) {
			System.out.println(-1);
		}
		else {
			System.out.println(a*b);
		}
	}
 
}

Measured memory_bytes: 35696
#include "bits/stdc++.h"
using namespace std ;


int h[100005] ;
int c[100005] ;
int main(){
	int N ;
	cin >> N ;
	for( int i = 1 ; i <= N ; i++ ){
		cin >> h[i] ;
	}
	c[1] = 0 ;
	c[2] = abs(h[2]-h[1]) ;
	for( int i = 3 ; i <= N ; i++ ){
		c[i] = min(c[i-1]+abs(h[i]-h[i-1]), c[i-2]+abs(h[i]-h[i-2])) ;
	}
	cout << c[N] << endl ;


	return 0 ;
}

Measured memory_bytes: 1024
// kill it - Abhinav IIITA
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define f(i,x,n) for(int i=x;i<n;++i)


// -----------------------------------------------------------------------


void solve(){	
	string s; cin>>s;
	if(s=="ABC")
	cout<<"ARC";
	else cout<<"ABC";
}

// -----------------------------------------------------------------------


int32_t main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}


Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<map>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll ret=pow(x,y/2);
  ret%=mod;
  ret*=ret;
  ret%=mod;
  if(y%2==1) ret*=x;
  return ret%mod;
}
ll dp[2005][2005]={0};
int main(){
  ll n,k;
  cin>>n>>k;
  vector<ll> kai;
  kai.push_back(1);
  for(ll i=1;i<=n+2;i++) kai.push_back((kai[i-1]*i)%mod);
  for(ll i=1;i<=k;i++){
    ll ans=((kai[k-1]*pow(kai[i-1],mod-2)%mod)*pow(kai[k-i],mod-2))%mod;
    //cout<<ans<<endl;
    if(n-k-i>=0) ans*=((kai[n-k+1]*pow(kai[i],mod-2)%mod)*pow(kai[n-k-i+1],mod-2))%mod;
    //cout<<dp[n-k-i+1][i+1]<<endl;;
    ans%=mod;

    if(i==1) ans=n-k+1;
    if(i>n-k+1) ans=0;
    cout<<ans<<endl;
  }
}



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

#define Max 500000
#define R -1
#define s1 "insert"
#define s2 "print"

typedef struct{
  int parent;
  int left;
  int right;
  int key;
}Node;

Node T[Max];
int root=-1;

void insert(int cnt){
  int x=root;
  int y=R;

  while(x!=R){
    y=x;
    if(T[cnt].key< T[x].key){
      x=T[x].left;
    }else{
      x=T[x].right;
    }
  }
  T[cnt].parent=y;

  if(y==R){
    root=cnt;
  }else if(T[cnt].key < T[y].key){
    T[y].left=cnt;
  }else{
    T[y].right=cnt;
  }
}
void order1(int q){
  if(q==R) return;
  order1(T[q].left);
  printf(" %d",T[q].key);
  order1(T[q].right);
}

void order2(int q){
  if(q == R) return;
  printf(" %d",T[q].key);
  order2(T[q].left);
  order2(T[q].right);
}
int main(int argc, char const *argv[]) {
  int n,i,x;
  char s[7];

  scanf("%d",&n);
  for (i = 0; i < n; i++) T[i].right=T[i].left=T[i].parent=R;

  for (i = 0; i < n; i++) {
    scanf("%s",s);
    if(strcmp(s,"insert")==0){
      scanf("%d",&T[i].key);
      insert(i);
    }else if(strcmp(s,"print")==0){
      order1(0);
      printf("\n");
      order2(0);
      printf("\n");
    }
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

const int maxn = 200100;

int n, ar[maxn];
ll pre[maxn];

ll tmp[5];

ll val(int b, int c, int d) {
    tmp[0] = pre[b];
    tmp[1] = pre[c] - pre[b];
    tmp[2] = pre[d] - pre[c];
    tmp[3] = pre[n] - pre[d];
    sort(tmp, tmp + 4);
    return tmp[3] - tmp[0];
}

int main() {
    ios_base::sync_with_stdio(0);

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

    ll ans = 4e18;
    int b = 1, d = 3;
    for (int c = 2; c < n-1; c++) {
        while (b + 1 < c && pre[b] <= pre[c] - pre[b]) b++;
        d = max(d, c + 1);
        while (d + 1 < n && pre[d] - pre[c] <= pre[n] - pre[d]) d++;
        int b2 = b>1?b-1:b;
        int d2 = d>c+1?d-1:d;
        ans = min(ans, min(min(val(b, c, d), val(b2, c, d)), 
                           min(val(b, c, d2), val(b2, c, d2))));
    }

    cout << ans << endl;
}

Measured memory_bytes: 2560
s=input()
sl=len(s)

l=[0 for i in range(sl+1)]
for i in range(sl):
    if s[i]=='<':
        l[i+1]=max(l[i]+1, l[i+1])

for i in reversed(range(sl)): # reversed(range(sl))
    if s[i]=='>':
        l[i]=max(l[i+1]+1, l[i])

print(sum(l))

Measured memory_bytes: 29648
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i = 0; i < n; i++)

ll X[100010];
ll A, B, N;

int main(void)
{
    cin >> N >> A >> B;
    REP(i, N) cin >> X[i];
    ll c1, c2;
    ll s = 0;
    for(ll i = 1; i < N; i++) {
        c1 = (X[i]-X[i-1])*A;
        s += min(c1, B);
    }
    cout << s << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a<b && b<c){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}



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

A.sort(); F.sort(); F = F[::- 1]

left = - 1
right = 10**12

def f(x):
    l = x//F
    return A[A > l].sum() <= K + l[A > l].sum()

while right - left > 1:
    mid = (left + right)//2
    if f(mid):
        right = mid
    else:
        left = mid
    
print(right)

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    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 {
        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;
    }

    // for prime mod
    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;
    }
};


int main() {

    int n;
    cin >> n;

    vector<int> costs(n);
    rep(i, n) cin >> costs[i];
    sort(costs.begin(), costs.end());

    vector<mint> nijo(1000000);
    nijo[0] = 1;
    for (int i = 1; i < 1000000; i++) {
        nijo[i] = nijo[i - 1] * 2;
    }


    mint ans = 0;
    for (int i = 0; i < n; i++) {
        int l = i;
        int r = n - i - 1;
        mint now = nijo[r];
        if (r != 0) now += nijo[r - 1] * r;
        now *= nijo[l];
        now *= costs[i];
        ans += now;
    }

    ans *= nijo[n];

    cout << ans.x << endl;

}


Measured memory_bytes: 8832
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,k,cc[500000],dd[500000],a,b;
char s[500000];
int main(){
	scanf("%d",&n);
	for (int i=0;i<n;i++) scanf("%d",&cc[i]);
	m=cc[n-2];
	for (int j=n-3;j>=1;j--){
		if (j%2==0) m-=cc[j];
		else m+=cc[j];
	}
	m=cc[n-1]-m+cc[0];
	dd[0]=m;
	for (int i=1;i<n;i++) dd[i]=(cc[i-1]-dd[i-1]/2)*2;
	for (int i=0;i<n;i++) printf(i==n-1?"%d\n":"%d ",dd[i]);
	return 0;
} 

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// #define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    ll a,b,x; cin >> a >> b >> x;
    ll ans;
    if(a==0){
        ans = (b / x) + 1;
    } else {
        ans = (b / x) - ((a - 1) / x);
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n + 1);
  for (auto& e : a) cin >> e;

  if (n == 0) {
    cout << (a[0] == 1 ? 1 : -1) << endl;
    return 0;
  }
  if (a[0] != 0) {
    cout << -1 << endl;
    return 0;
  }

  for (int i = 0; i + 1 < n + 1; i++) a[i + 1] += a[i];
  bool valid = true;
  ll k = 1, l = 1;
  for (int i = 1; i < n + 1; i++) {
    ll l2 = min(2 * l, a[n] - a[i - 1]);
    if (l2 < a[i] - a[i - 1]) {
      valid = false;
      break;
    }
    k += l2;
    l = l2 - (a[i] - a[i - 1]);
  }
  if (l > 0) valid = false;

  cout << (valid ? k : -1) << endl;
}


Measured memory_bytes: 4048
from math import log
n = int(input())


# def make_list(n, x):
#     return [x ** i for i in range(1, int(log(n, x))+1)]
#
#
# sixes = make_list(n, 6)
# nines = make_list(n, 9)
# nums = [1] + sixes + nines

nums = [1]
i = 1
num = 1
while num <= n:
    num = 6 ** i
    nums.append(num)
    i += 1
i = 1
num = 1
while num <= n:
    num = 9 ** i
    nums.append(num)
    i += 1


dp = [float('inf')] * (n+1)
for num in nums:
    for i in range(1, n+1):
        if i == num:
            dp[i] = 1
        elif i >= num:
            dp[i] = min(dp[i], dp[i-num]+1)
print(dp[n])


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

int main() {

  long long INF = 1LL<<60;

  int N, K;
  cin >> N >> K;

  vector<int> x(N);
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }

  long long answer = INF;

  for (int i = 0; i < N - K + 1; i++) {
    // 右端
    long long right = x[i];
    // 左端
    long long left = x[i + K - 1];
    // 右から左
    answer = min(answer, abs(right) + abs(right - left));
    // 左から右
    answer = min(answer, abs(left) + abs(left - right));
  }

  cout << answer << endl;

  return 0;

}

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

int main() {
    int N;
    std::cin >> N;
    std::vector<int> vec;
    for (int i = 0; i < N; i++) {
        int n = 0;
        std::cin >> n;
        vec.push_back(n);
    }
    if (vec.empty()) {
        std::cout << "0" << std::endl;
        return 0;
    }
    int sum = 0;
    std::sort(vec.begin(), vec.end());
    int pos = static_cast<int>(vec.size() - 1);
    sum = vec[pos--] / 2;

    while (pos > -1) {
        sum += vec[pos--];
    }
    std::cout << sum << std::endl;

    return 0;
}

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

int main() {
  vector<vector<int>>table(3,vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> table.at(i).at(j);
    }
  }
  int N;
  cin >> N; 
  
  vector<int> call(N);
  for (int i = 0; i < N; i++) {
    cin >> call.at(i);
    for(int j = 0; j < 3; j++) {
      for(int k = 0; k < 3; k++) {
      if (call.at(i) == table.at(j).at(k)) {
        table.at(j).at(k) = 0;
      }
      }
    }
  }
  
  if (table.at(0).at(0) == 0 && table.at(0).at(1) == 0 && table.at(0).at(2) == 0) {
    cout << "Yes" << endl;
  }
  else if (table.at(1).at(0) == 0 && table.at(1).at(1) == 0 && table.at(1).at(2) == 0) {
    cout << "Yes" << endl;
  }
  else if (table.at(2).at(0) == 0 && table.at(2).at(1) == 0 && table.at(2).at(2) == 0) {
    cout << "Yes" << endl;
  }
  else if (table.at(0).at(0) == 0 && table.at(1).at(0) == 0 && table.at(2).at(0) == 0) {
    cout << "Yes" << endl;
  }
  else if (table.at(0).at(1) == 0 && table.at(1).at(1) == 0 && table.at(2).at(1) == 0) {
    cout << "Yes" << endl;
  }
  else if (table.at(0).at(2) == 0 && table.at(1).at(2) == 0 && table.at(2).at(2) == 0) {
    cout << "Yes" << endl;
  }
  else if (table.at(0).at(0) == 0 && table.at(1).at(1) == 0 && table.at(2).at(2) == 0) {
    cout << "Yes" << endl;
  }
  else if (table.at(0).at(2) == 0 && table.at(1).at(1) == 0 && table.at(2).at(0) == 0) {
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
  
}
















Measured memory_bytes: 256
//#define NDEBUG
 
#include <bits/stdc++.h>
 
#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define pob pop_back()
#define pof pop_front()
#define F first
#define S second
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}
#define pii pair<int, int>
#define pll pair<ll, ll>
#define modadd(a, b) (((a % MOD) + (b % MOD)) % MOD)
#define modtimes(a, b) (((a % MOD) * (b % MOD)) % MOD)
 
//#define TEST
 
typedef long long ll;
typedef unsigned long long ull;
 
using namespace std;
 
const ll MOD = 1000000007;
const ll MAX = 2147483647;

int main(){
    StarBurstStream

    int n;
    cin >> n;

    int ans = 0;
    vector<vector<int>> a(n + 1, vector<int>(n));
    for(int i = 1; i <= n; i++)
        for(int j = 1; j < n; j++) cin >> a[i][j];

    vector<int> p(n + 1, 1);
    int no = n;
    while(no > 0){

        bool noAns = true;
        vector<bool> has(n + 1);
        for(int i = 1; i <= n; i++){
            if(has[i]) continue;
            if(p[i] == n) continue;
            int b = a[i][p[i]];
            if(a[b][p[b]] != i) continue;
            if(has[i] || has[b]) continue;
            p[i]++;
            p[b]++;
            if(p[i] == n) no--;
            if(p[b] == n) no--;
            has[i] = true; has[b] = true;
            noAns = false;
            //cerr << ans << " " << i << " " << b << "\n";
        }
        if(noAns){
            ans = -1;
            break;
        }
        ans++;
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 6272
#include <iostream>  // for cout, cin
#include <stdio.h>   // for printf, scanf

using namespace std;
typedef long long ll;
/*
 * 計算クラス
 */
class Calc
{
    // 宣言
    ll a;

    public:
        // 素因数分解
        void decompositPrime(ll a,ll b);
};

/*
 * 素因数分解
 */
void Calc::decompositPrime(ll n,ll number)
{
if(number!=1){
ll re=1;
    // 割る数の初期値
    a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
ll count=0;
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
count++;
//cout<<n<<" "<<a<<" "<<endl;
 //printf("%d * ", a);
            n /= a;
if(count==number){
re=re*a;
count=0;
}
        } else {
if(count>=number){
re=re*a;
}
count=0;
            a++;
        }
    }
    // 最後に残った n は素因数
   //printf("%d\n", n);
if(n==a)
count++;
if(count>=number){
re=re*a;
}
cout<< re;
}
else {
cout<<n;
}

}


/*
 * メイン処理
 */
int main()
{
    ll  iNum,n;

        // 計算クラスインスタンス化
        Calc objCalc;


            // 自然数入力
            cin  >> n>>iNum;
            // 素因数分解
            objCalc.decompositPrime(iNum,n);

  

    return 0;
}

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

int main(){
    int K,X;
    cin >> K >> X;
    
    int N;
    int M;
    
    N=X-K+1;
    M=X+K-1;
    
    for(int i=N;i<M+1;i++){
        cout << i << ' ';
    }
  
    cout <<endl;
   

    
}



Measured memory_bytes: 256
inpl = lambda: list(map(int,input().split()))
N,M = inpl()
A = []
for i in range(N):
    A.append(inpl())

A.sort(key=lambda x: x[0])
Y = 0
for i in range(N):
    if A[i][1] >= M:
        Y += A[i][0]*M
        break
    else:
        Y += A[i][0]*A[i][1]
        M -= A[i][1]

print(Y)

Measured memory_bytes: 29024
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=2005;
int n,k,Ans=MAXN;
int son[MAXN],vis[MAXN];
vector<int>T[MAXN];
void Dfs(int u,int fa,int dep,int gra){
	if(dep>k/2){
		if(k%2)son[gra]++;
		return ;
	}	
	vis[u]=1;
	int size=T[u].size();
	for(int i=0;i<size;i++){
		int v=T[u][i];
		if(v==fa)continue;
		Dfs(v,u,dep+1,gra);
	}
}
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		T[x].push_back(y);
		T[y].push_back(x);
	}
	for(int i=1;i<=n;i++){
		memset(vis,0,sizeof(vis));
		memset(son,0,sizeof(son));
		int size=T[i].size(),ret=0;
		vis[i]=1;
		for(int j=0;j<size;j++){
			int v=T[i][j];
			Dfs(v,i,1,v);
			ret=min(ret,-son[v]);
		}
		for(int j=1;j<=n;j++)
			if(!vis[j])ret++;
		if(ret<Ans)Ans=ret;
	}
	printf("%d\n",Ans);
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
const int N=1e5+5;
typedef long long ll;
int main(){
	int k,a,b;
	cin>>k>>a>>b;
	int f=0;
	for(int i=k;i<=b;i+=k)
		if(i>=a&&i<=b)
		{
			f=1;
			break;
		}
	puts(f?"OK":"NG");
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=a; i<=b; i++)
#define per(i,a,b) for (register int i=a; i>=b; i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 666666;
int n,x,a[N],res;
int main() {
	read(n);read(x);rep(i,1,n)read(a[i]);
	sort(a+1,a+n+1);rep(i,1,n)if(x>=a[i])x-=a[i],res++;
	if(res==n&&x!=0)res--;
	cout<<res;
	return 0;
}

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

int main() {
	long long L, R;
	cin >> L >> R;
	long long ans = 2036;
	for(long long i = L; i <= min(L + 4036, R); i++){
		for(long long j = i + 1; j <= min(L + 4036, R); j++){
			ans = min(ans, (i * j) % 2019);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
s = [0]*(n+1)
for i in range(n):
    s[i+1] = s[i] + a[i]
import collections
c = collections.Counter(s)
ans = 0
d = list(set(s))
for D in d:
    ans += c[D]*(c[D]-1)//2
print(ans)

Measured memory_bytes: 51736
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

class Prime
{
	ll i, iLimit;
public:
	bool isPrime(ll a);
};

bool Prime::isPrime(ll a)
{
	if (a == 1) return false;
	iLimit = (int)sqrt(a);
	for (i = 2; i <= iLimit; i++) if (a % i == 0) break;
	return (i == iLimit + 1 ? true : false);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	Prime p;
	vector<int> res(100005);
	for (int i = 1; i <= 100000; ++i) {
		bool elf = p.isPrime(i);
		if (elf) {
			int tmp = (i + 1) / 2;
			bool ok = p.isPrime(tmp);
			if (ok) res[i]++;
		}
		res[i + 1] += res[i];
	}
	int q;
	cin >> q;
	rep(ri, q) {
		int l, r;
		cin >> l >> r;
		int ans = res[r] - res[l - 1];
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cstring>

using namespace std;

int main(){
	int a, b, h;
	while(~scanf("%d %d %d", &a, &b, &h))
		cout << (a + b) * h / 2 << endl;
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  bool c = false, cf = false;
  for(auto t : s) {
    if(!c && t == 'C') c = true;
    if(c && t == 'F') cf = true;
  }
  cout << (cf ? "Yes": "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	string n;
	cin >> n;
	if (n.at(0) == '9' || n.at(1) == '9'){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <stdio.h>
#include <math.h>
#include <unordered_set>
using namespace std; 
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define ll long long int
#define REPI(a, b, i, inc) for(ll i = a; i < b; i = i + inc)
#define REP(i, a, b) for(ll i = a; i < b; i++)
#define F first
#define S second
#define pb push_back
#define test ll t; cin>>t; while(t--)
#define testi ll t; cin>>t; REP(tc,1,t+1)
#define vec vector
#define veci vector<ll>
#define pi pair<ll,ll>
#define mp make_pair
#define all(v) v.begin(), v.end()
#define uset unordered_set
#define umap unordered_map

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

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("op.txt","w",stdout);
    #endif
    int k; cin>>k;
    int c=1;
    int d=7;
    unordered_set<int>s;
   while(1){
    int rem= d%k;
    //cout<<d<<" "<<rem<<endl;
    
    if(rem==0)
       {  break;}
    if(s.find(rem)!=s.end())
        {c=-1; break;}
    s.insert(rem);
     d= rem*10+7;
     c++;
   }
   cout<<c;


	
	return 0;


}

Measured memory_bytes: 42496
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<int> h(n);
	rep(i,n){
		cin>>h[i];
	}
	int ans=0;
	while(true){
		bool flag=false;
		int l=-1,r=-1;
		rep(i,n){
			if(h[i]){
				flag=true;
				if(l==-1){
					l=i,r=i;
				}else{
					r=i;
				}
			}else{
				if(l!=-1) break;
			}
		}
		if(!flag) break;
		ans++;
		FOR(i,l,r+1) h[i]--;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<cmath>
#include<string>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"hey sparky\n"
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define newline cout<<"\n"
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"
#define INF (int)1e5+5
#define nax (int)1e6+3
#define eps (double)1e-9
#define all(x) x.begin(),x.end()
#define MAX_N (int)1e6+2
//#define int long long
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pdbs;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

// look for  all edge cases
//search for a pattern
	
signed main(){
	fast;
	int n;
	cin >> n;
	vector<pair<int,int> > v(n);
	for(int i = 0; i<n ;i++){
		cin >> v[i].x >> v[i].y;
	}
	vector<int> mi(n),ma(n);
	for(int i =0 ; i<n ;i++){
		mi[i] = v[i].x;
		ma[i] = v[i].y;	
	}
	sort(all(mi));
	sort(all(ma));
	
	if(n%2 == 1){
		int ans = ma[n/2] - mi[n/2] +1;
		cout<<ans;	
	}
	else{
		double right = (ma[n/2]+ma[(n-1)/2]);
		double left =  (mi[n/2]+mi[(n-1)/2]);
		ll ans = (right - left)+1;
		cout<<ans;
	}
	
	
	
	return 0;
}

	



Measured memory_bytes: 6356
#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
template<class T> inline bool chmax(T &a, T b) { return a < b ? (a = b, 1) : 0; }

int main() {
    string s; cin >> s;
    int n = s.length();
    vector<int> a(n + 1);
    for (int i = 0; i < n; i++) if (s[i] == '<') chmax(a[i + 1], a[i] + 1);
    reverse(begin(s), end(s));
    reverse(begin(a), end(a));
    for (int i = 0; i < n; i++) if (s[i] == '>') chmax(a[i + 1], a[i] + 1);
    reverse(begin(s), end(s));
    reverse(begin(a), end(a));
    // for (int i = 0; i < n; i++) cout << a[i] << s[i]; cout << a[n] << endl;
    cout << accumulate(begin(a), end(a), 0LL) << endl;
    return 0;
}


Measured memory_bytes: 2820
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <stack>
#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 = 998244353;
// 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> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
    template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

    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 szi, szj;
        inp(std::size_t _szi = 1, std::size_t _szj = 1) : szi(_szi), szj(_szj) {}
        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(szi); for (std::size_t i = 0; i < szi; ++i) std::cin >> a[i]; return a; }
        template <typename T> 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;
}

int main() {

    int k = inp1;
    string s = inp1;

    if (s.length() <= k) Cout(s);
    else {
        string ans = "";
        rep(i, s.length()) {
            if (i < k) ans += s[i];
        }
        ans += "...";
        Cout(ans);
    }

    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int a, b, c;
	cin >> a >> b >> c;
	if ((a == b) && (b == c)) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
#define PI 3.14159265
using namespace std;


const int MAX_CHAR = 26; 
const int MAX_FACT = 20; 
ll fact[MAX_FACT]; 
  
// utility for calculating factorials 
void precomputeFactorials() 
{ 
    fact[0] = 1; 
    for (ll i = 1; i < MAX_FACT; i++){
        fact[i] = fact[i - 1] * i;
        //cout << i << "||" << fact[i] << endl; 
    }
}

ll gcd(ll a, ll b){
    if(a < b) swap(a, b);
    if(b == 0) return a;
    return gcd(b, a%b);
}

vector <string> getWords(string s){
    string cur = "";
    vector <string> vec;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == ' '){
            vec.push_back(cur);
            cur = "";
        } else cur += s[i];
    }
    vec.push_back(cur);
    return vec;
}

map <int,string> mp;

int main(){
    int k;
    string s;
    cin >> k >> s;
    if(s.size() <= k) cout << s;
    else{
       for(int i = 0; i < k; i++) cout << s[i];
       cout << "...";
    }
   
}
   


Measured memory_bytes: 3644
N = gets.to_i
start_depth = 0
end_depth = 0
center_blocks= []
N.times{
	s = gets.chomp
	d = 0
	min_d = 0
	max_d = 0
	s.each_char{|c|
		if c == "("
			d += 1
			if d > max_d
				max_d = d
			end
		else
			d -= 1
			if d < min_d
				min_d = d
			end
		end
	}
	depth = [-min_d, d - min_d]
	next if depth[0] == 0 && depth[1] == 0
	if depth[0] == 0
		start_depth += depth[1]
	elsif depth[1] == 0
		end_depth += depth[0]
	else
		center_blocks << depth
	end
}
loop{
	prev_size = center_blocks.size
	center_blocks.delete_if{|block|
		r = false
		if start_depth >= block[0]
			r = true
			start_depth += block[1] - block[0]
		elsif end_depth >= block[1]
			r = true
			end_depth += block[0] - block[1]
		end
		r
	}
	break if prev_size == center_blocks.size
}
if center_blocks.empty? && start_depth == end_depth
	puts "Yes"
else
	puts "No"
end


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

int main(){
    string c;
    bool res = false;
    
    cin >> c;
    
    if(c == "a") res = true;
    if(c == "i") res = true;
    if(c == "e") res = true;
    if(c == "o") res = true;
    if(c == "u") res = true;
    
    if(res) cout << "vowel" << endl;
    else cout << "consonant" << endl;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

// pairsをfirstを優先キーとして昇順ソート
bool compare_by_a(pair<ll, ll> a, pair<ll, ll> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
// pairsをsecond優先キーとして昇順ソート
bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<P> pairs(N);
    REP(i, N){
        pairs[i].first = i;
        cin >> pairs[i].second;
    }
    
    sort(pairs.begin(), pairs.end(), compare_by_b);
    
    ll a = pairs[N/2-1].second;
    ll b = pairs[N/2].second;
    REP(i, N){
        if(i <= N/2-1){
            pairs[i].second = b;
        }
        else{
            pairs[i].second = a;
        }
    }

    sort(pairs.begin(), pairs.end(), compare_by_a);

    REP(i, N){
        cout << pairs[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MAX=2001000;
int main(){
  ll N;
  cin>>N;
  vector<int>A(N);
  for(ll i=0;i<N;i++)cin>>A[i];
  vector<int>M(MAX,0);
  for(auto a:A){
    if(M[a]!=0){
      M[a]=2;continue;
    }
    for(ll i=a;i<=MAX;i+=a)M[i]++;
  }
  ll ans=0;
  for(auto a:A){
    if(M[a]==1)ans++;
  }
  cout<<ans<<endl;
}

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define repU(i,s,t) for(int i = (s); i <= (t); ++i)
#define repD(i,t,s) for(int i = (t); i >= (s); --i)
#define all(v)  begin(v),end(v)
#define clr(v) fill(all(v),0)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define q_ceil(n,d) ((n - 1)/(d) + 1)
#define parity(a,b) (((a)^(b)) & 1 ^ 1)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF_32 = (1 << 30) - 1;
const ll INF_64 = (1LL << 62) - 1;
const int MOD = 1e9 + 7;

ull next_subset(ull s){
	ull tem = s + (s & -s);
	ull btm = (~tem & s) / (s & -s) >> 1;
	return btm | tem;
}


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

	int n,a,b = 0,c,d,m; cin>>n;
	rep(i,n){
		cin>>a;
		b += a-1;
	}
	cout<<b<<endl;
}


Measured memory_bytes: 256
/*
AizuOnline A0207
Title Block
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
#include <setjmp.h>
//Global data section
int w,h;
int xs,ys;
int xg,yg;
int n;
int c[100];
int d[100];
int x[100],y[100];
int bd[100][100];
jmp_buf env;

//
void init()
{
  int i,j;
  for(i=0;i<h;i++)
    for(j=0;j<w;j++)
      bd[i][j]=0;
  for(i=0;i<100;i++)
    {
      x[i]=y[i]=d[i]=c[i]=0;
    }
}
int get_block(int px,int py)
{
  int i;
  // printf("GB%d,%d\n",px,py);
  for(i=0;i<n;i++)
    if(d[i]==0)         // yokonaga
	{
	  if(px-x[i] >=0 && px-x[i] <=3 && 
	     py-y[i] >=0 && py-y[i] <= 1)
	    return(i);
	}
    else if(d[i]==1)         // tatenaga
      {
	if(px-x[i] >=0 && px-x[i] <=1 && 
	   py-y[i] >=0 && py-y[i] <=3)
	  return(i);
      }
  return(-1);
}
int show()
{
  int i,j;
  for(i=1;i<=h;i++)
    {
      for(j=1;j<=w;j++)
	printf("%d",bd[i][j]);
      printf("\n");
    }
  printf("\n");
}
void paint0(int px,int py,int col,int ww,int hh)
{
  int i,j;
  //printf("P0 %d %d\n",px,py);

    for(i=0;i<hh;i++)
      for(j=0;j<ww;j++)
	bd[py+i][px+j]=col;
}
int paint(int px,int py,int col)
{
  int cc,blk,dir,bx,by,w0,h0,i,j;
  //printf("xyc=%d %d %d\n",px,py,col);

  if(px < 1 ||py < 1) //out of bound
    return(0);
  if(bd[py][px])  // already painted
    return(0);
  blk=get_block(px,py);  // get block no of this place
  //printf("blk=%d\n",blk);
  if(blk<0)
    return(0);
  cc=c[blk];
  dir=d[blk];
  if(cc != col)
    return(0);             // different color

  bx=x[blk];
  by=y[blk];
   if(dir==0)         // yokonaga
     { w0=4;h0=2;}
   else
     { w0=2;h0=4;}

  paint0(bx,by,col,w0,h0); // paint this block

  if(xg >= bx && xg < bx+w0 && 
     yg >= by && yg < by+h0 )     // reach the goal
    {
      longjmp(env,1);
    }

   for(i=-1;i<w0+1;i++)
     if(i==-1||i==w0)
       for(j=0;j<h0;j++)
	 paint(bx+i,by+j,col);
     else
       for(j=-1;j<h0+1;j++)
	 paint(bx+i,by+j,col);

   return(0);
}
main()
{
  int i,bl,col,dir,ret;
  while(EOF != scanf("%d %d",&w,&h) && (w || h))
    {
      init();
      scanf("%d %d",&xs,&ys);
      scanf("%d %d",&xg,&yg);
      scanf("%d",&n);
      for(i=0;i<n;i++)
	scanf("%d %d %d %d",&(c[i]),&(d[i]),&(x[i]),&(y[i]));
      
      bl = get_block(xs,ys);
      col=c[bl];
      if(setjmp(env)==0)
	{
	  ret = paint(xs,ys,col);
	}
      else
	ret=-1;
      //show();
      printf("%s\n",ret?"OK":"NG");
    }
return(0);
}

Measured memory_bytes: 624
X = int(input())

if X >= 400 and X <= 599:
    print(8)
elif  X >= 600 and X <= 799:
    print(7)
elif  X >= 800 and X <= 999:
    print(6)
elif  X >= 1000 and X <= 1199:
    print(5)
elif  X >= 1200 and X <= 1399:
    print(4)
elif  X >= 1400 and X <= 1599:
    print(3)
elif  X >= 1600 and X <= 1799:
    print(2)
elif  X >= 1800 and X <= 1999:
    print(1)

Measured memory_bytes: 9160
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i, N) cin >> A[i];

  rep(k, K) {
    vector<int> B(N, 0);
    rep(i, N) {
      int left = max(0, i - A[i]);
      B[left]++;
      int right = min(N - 1, i + A[i]);
      if (right + 1 < N) B[right + 1]--;
    }
    bool allN = true;
    for (int i = 1; i < N; ++i) {
      B[i] += B[i - 1];
      if (B[i] != N) allN = false;
    }
    A = B;
    if (allN) break;
  }

  rep(i, N) { cout << A[i] << " "; }
  cout << endl;
  return 0;
}


Measured memory_bytes: 4992
#include<iostream>
using namespace std;
int main(){
    int a,b,d,r;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    double f = (double) a / (double) b;
    cout << d << " " << r << " " << fixed << f << endl;
    return 0;
}


Measured memory_bytes: 3236