akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;

    if(m2 == m1+1) cout << 1 << endl;
    else cout << 0 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

// #define TEST

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int main() {
	int N, M;
	cin >> N >> M;
	int total = 0;
	for (int i = 0; i < M; ++i) {
		int ai; cin >> ai;
		total += ai;
	}
	if (total <= N)
		cout << (N - total) << endl;
	else cout << (-1) << endl;
	return 0;
}

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

int main(){

  double w;
  string str[11] = {"light fly", "fly", "bantam", "feather", "light", "light welter", "welter", "light middle", "middle", "light heavy", "heavy"};
  double range[11] = {48.0, 51.0, 54.0, 57.0, 60.0, 64.0, 69.0, 75.0, 81.0, 91.0};

  while(cin >> w){
    for(int i=0; i<10; i++){
      if(w <= range[i]){
        cout << str[i] << endl;
        break;
      }
      if(i == 9){
        cout << str[10] << endl;
      }
    }
  }

  return 0;

}

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

struct edge {
    int from, to;
    int cost;
};

struct vert {
    vector<edge> edges;
};

long long prim(const vector<vert>& verts) {
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> pq;
    set<int> s;
    long long res = 0;
    pq.push(make_pair(0, 0));
    while (!pq.empty() && s.size() < verts.size()) {
        auto info = pq.top(); pq.pop();
        int cost = info.first;
        int idx = info.second;
        if (s.find(idx) != s.end()) continue;
        s.insert(idx);
        res += cost;
        for (const auto& e: verts[idx].edges) {
            if (s.find(e.to) != s.end()) continue;
            pq.push(make_pair(e.cost, e.to));
        }
    }
    return res;
}

int main() {
    int V, E;
    cin >> V >> E;
    vector<vert> verts(V);
    for (int i = 0; i < E; ++i) {
        int from, to, cost;
        cin >> from >> to >> cost;
        edge e1 = {from: from, to: to, cost: cost};
        edge e2 = {from: to, to: from, cost: cost};
        verts[from].edges.push_back(e1);
        verts[to].edges.push_back(e2);
    }
    cout << prim(verts) << endl;
}



Measured memory_bytes: 8060
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define clr1(arr) memset(arr,-1,sizeof(arr));
#define clr0(arr) memset(arr,0,sizeof(arr));
#define pi pair<int,int>
#define pii pair<int,pi>
#define sortV(v) v.begin(),v.end()
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
// DSU
/*
const int maxn=100009;
int arr[maxn];
int sz[maxn];
void init(){rep(i,maxn){arr[i]=i;sz[i]=1;}}
int root(int a){while(a!=arr[a]){arr[a]=arr[arr[a]];a=arr[a];}return a;}
int check(int a,int b){if(root(a)==root(b))return 1;return 0;}
int un(int a,int b)
{
  int roota=root(a);int rootb=root(b);
  if(sz[roota]>=sz[rootb]){sz[roota]+=sz[rootb];arr[rootb]=roota;}
  else {sz[rootb]+=sz[roota];arr[roota]=rootb;}
}
*/

//Dijkstra
/*
const int maxn=0x3f3f3f3f;
void dijkstra(int n,int dist[],vector<pi >adj[],int s)
{
  int visited[n+1];
  repre(i,0,n)
  {
    visited[i]=0;
    dist[i]=maxn;
  }
  dist[s]=0;
  priority_queue<pi ,vector<pi>,greater<pi> >p;
  p.push(mkp(0,s));
  while(p.empty()==false)
  {
    pi temp=p.top();
    p.pop();
    if(visited[temp.ss])continue;
    visited[temp.ss]=1;
    int u=temp.ss;
    rep(i,adj[u].size())
    {
      if(dist[u]+adj[u][i].ss<dist[adj[u][i].ff])
      {
        dist[adj[u][i].ff]=dist[u]+adj[u][i].ss;
        p.push(mkp(dist[adj[u][i].ff],adj[u][i].ff));
      }
    }
  }
}*/
int32_t main()
{
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  fastio
  int k,x;
  cin>>k>>x;
  if(k==1)
  {
    cout<<x<<endl;
    exit(0);
  }
  vector<int>v;
  int temp=x;
  int c=k;
  while(c--)
  {
    v.pb(temp);
    temp++;
  }
  temp=x-1;
  c=k-1;
  while(c--)
  {
    v.pb(temp);
    temp--;
  }
  sort(sortV(v));
  rep(i,v.size())cout<<v[i]<<" ";
  cout<<endl;

  return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

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

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

    rep(i, N) {
        if (i == 0) continue;
        if (a[i] != 0 && a[i] - a[i - 1] > 1) {
            cout << -1 << endl;
            return 0;
        }
    }

    vector<int> b(N);
    rep(i, N) b[i] = i - a[i]; // a[i]が元々どこのindexから来た数値か
    ll ans = 0;
    rep(i, N) {
        if(i == N - 1 || b[i] != b[i+1]) {
            ans += (ll)i - (ll)b[i];
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 1792
import java.io.PrintWriter;
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		String s = sc.next();
		char[] c = s.toCharArray();

		if(c[0]==c[1] || c[1]==c[2] || c[2]==c[3]){
			out.println("Bad");
		}else{
			out.println("Good");
		}

		out.flush();
	}
}


Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <bitset>
#include <numeric>
#include <math.h>
#include <tuple>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

ll A, B;

ll sum_xor(ll a, ll b){

    int dig = round(ceil(log2(max(a, b)))) + 1;

    ll _sum_xor;
    bool tmp_a, tmp_b;
    _sum_xor = 0;

    for(int i = dig; i > 0; i--){
        if(a +1 > round(pow(2, i-1))){
            tmp_a = true;
            a = a - round(pow(2, i-1));
        }
        if(b +1 > round(pow(2, i-1))){
            tmp_b = true;
            b = b - round(pow(2, i-1));
        }

        _sum_xor += int(tmp_a^tmp_b) * round(pow(2, i-1));

        tmp_a = false;
        tmp_b = false;
    }

    return _sum_xor;
};

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

    cin >> A >> B;

    ll N_evod;
    if( A % 2 == 0 && B % 2 == 1){
        N_evod = (B + 1 - A) / 2;
        cout << N_evod % 2 << endl;
    }else if(A % 2 == 1 && B % 2 == 1){
        N_evod = (B - A) / 2;
        cout << A - N_evod % 2 << endl;
    }else if(A % 2 == 0 && B % 2 == 0){
        N_evod = (B - A) / 2;
        cout << B + N_evod % 2 << endl;
    }else if(A % 2 == 1 && B % 2 == 0){
        N_evod = (B - 1 - A) / 2;
        cout << sum_xor(A, B) - N_evod % 2 << endl;
    }


    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define all(x) x.begin(), x.end()

template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 & y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 & y) {if (x < y) x = y;}

#define int ll

const int INF = 3e18 + 10;

int mul(int a, int b) {
	if (INF / a < b) return INF;
	return a * b;
}

const int MAXN = 1e5 + 10;
int a[MAXN];
int n;

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

void no() {
	cout << -1 << endl;
	exit(0);
}

int mx[MAXN];
int ans;

void run() {
	mx[0] = 1;
	for (int i = 1; i <= n; i++) {
		if (mx[i - 1] - a[i - 1] <= 0) {
			no();
		}
		mx[i] = mul(2, mx[i - 1] - a[i - 1]);
	}

	/*cout << "mx = " << endl;
	for (int i = 0; i <= n; i++) {
		cout << mx[i] << " ";
	}
	cout << endl;*/
	for (int i = 0; i <= n; i++) {
		if (mx[i] < a[i]) {
			no();
		}
	}
	ans = 0;
	int now = a[n];
	ans += now;
	for (int i = n - 1; i >= 0; i--) {
		if ((now + 1) / 2 + a[i] > mx[i]) {
			no();
		}
		int y = max(0LL, a[i] + now - mx[i]);
		int x = now - 2 * y;
		now = a[i] + x + y;
		assert(now <= mx[i]);
		ans += now;
	}
}

void write() {
	cout << ans << endl;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}

Measured memory_bytes: 5176
import sys

# sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    t = read_int_list()
    m = read_int()
    p = [0] * m
    x = [0] * m
    for i in range(m):
        p[i], x[i] = read_int_list()
        p[i] -= 1

    s = sum(t)
    for i in range(m):
        j = p[i]
        res = s - t[j] + x[i]
        print(res)


main()


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

int main() {
 int N;
  cin>>N;
  for(int i=0;i<N;i++){
  string s;
    cin>>s;
    if(s=="Y"){
      cout<<"Four";
      break;
    }else if(i==N-1){
      cout<<"Three";
    
    }
   }
}


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

typedef long long ll;

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

  int n;
  cin >> n;

  vector<int> a(n), b(n), c(n-1);
  for (int i = 0; i < n; i++){
    cin >> a.at(i);
  }
  for (int i = 0; i < n; i++){
    cin >> b.at(i);
  }
  for (int i = 0; i < n - 1; i++){
    cin >> c.at(i);
  }

  int ans = 0;
  int temp = -100;
  for (int i = 0; i < n; i++){
    ans += b.at(a.at(i) - 1);

    if (a.at(i) - 1 ==  temp + 1) ans += c.at(temp);
    temp = a.at(i) - 1;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

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

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    rep (i, l, r + 1) if (i % d == 0) ans++;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <numeric>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define INF 999999999
using namespace std;

int main(){
    string s, t; cin >> s >> t;
    int sz = s.size();
    int tz = t.size();

    repr(i, sz-tz, 0){
        rep(j , 0, tz){
            if(s[i+j] != '?' && s[i+j] != t[j]) goto dame;
        }
        rep(j, 0, tz) s[i + j] = t[j];
        rep(i, 0, sz) if(s[i] == '?') s[i] = 'a';
        cout << s << endl;
        return 0;
        dame:;
    }
    cout << "UNRESTORABLE" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

template <typename T> vector<T> sliding_maximum(const vector<T> &a, int k){
  int n = a.size();
  deque<int> dq;
  vector<T> ret;

  REP(i,k){
    while(not dq.empty() and a[dq.back()] <= a[i]){
      dq.pop_back();
    }

    dq.push_back(i);
  }

  REP(i,n-k+1){
    while(dq.front() < i){
      dq.pop_front();
    }

    ret.push_back(a[dq.front()]);

    while(not dq.empty() and i+k < n and a[dq.back()] <= a[i+k]){
      dq.pop_back();
    }
    
    dq.push_back(i+k);
  }
  
  return ret;
}


LLI dp[310][101000];
const LLI ninf = -(1LL<<60);

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

  LLI n,m,k;
  while(cin >> n >> m >> k){
    vector<LLI> A(n); cin >> A;

    fill_array(dp, ninf);

    REP(i,n){
      dp[1][i] = A[i];
    }

    FORE(j,2,k){
      
      vector<LLI> temp(dp[j-1], dp[j-1]+n);

      vector<LLI> b(n);

      {
        LLI t = ninf;
        REP(i,m){
          b[i] = t;
          t = max(t,dp[j-1][i]);
        }

        auto s = sliding_maximum<LLI>(temp,m);

        FOR(i,m,n){
          b[i] = s[i-m];
        }
      }

      REP(i,n){
        if(b[i] >= 0) dp[j][i] = b[i] + A[i] * j;
      }      
    }

    LLI ans = 0;
    REP(i,n) chmax(ans, dp[k][i]);

    cout << ans << endl;
    
  }
  
  return 0;
}


Measured memory_bytes: 249080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 10;
char s[maxn];
ll ans;
int main()
{
	scanf("%s", s + 1);
	for(int i = 1, j = 1; s[i]; ++i)
		if(s[i] == 'W')
		{
			ans += i - j;
			++j;
		}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3976
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long y = sc.nextLong();
        long count = 0;
        while(x <= y) {
            count++;
            x *= 2;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    string s;
    ll q;
    cin >> s >> q;
    bool flag=true;
    vector<char> l;
    for (ll i=0;i<s.size();i++){
        l.push_back(s[i]);
    }
    for (ll i=0;i<q;i++){
        ll t;
        cin >> t;
        if (t==1){
            if (flag){
                flag=false;
            }else{
                flag=true;
            }
            continue;
        }
        ll f;
        cin >> f;
        char x;
        cin >> x;
        if (f==1){
            if (flag){
                l.insert(l.begin(),x);
            }else{
                l.push_back(x);
            }
        }else{
            if (flag){
                l.push_back(x);
            }else{
                l.insert(l.begin(),x);
            }
        }
    }
    if (flag){
        for (ll i=0;i<l.size();i++){
            cout << l[i];
        }
        cout << endl;
    }else{
        for (ll i=0;i<l.size();i++){
            cout << l[l.size()-1-i];
        }
        cout << endl;
    }
    return 0;
}



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

int main(){

	int numOfList;
	int numOfSerachList;

	unsigned int list[10000];
	int counter = 0;

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

	cin >> numOfSerachList;
	for(int i = 0; i < numOfSerachList; i++){
		unsigned int val;
		cin >> val;
		for(int j = 0; j < numOfList; j ++){
			if(val == list[j]){
				counter++;
				//cout << "No."<< j << ":" << val << " = " << list[j] << endl;
				break;
			}
		}
	}

	cout << counter << endl;

	return 0;
}

Measured memory_bytes: 1204
#include <stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a >= 1 && b >= 1 && c >= 1 && a <= 10000 && a <= 10000 && a <= 10000)
	{
		if (a<b&&a<c)
		{
			if (b<c)
			{
				printf("%d %d %d\n", a, b, c);
			}
			else
			{
				printf("%d %d %d\n", a, c, b);
			}
		}
		else if (b<a&&b<c)
		{
			if (a<c)
			{
				printf("%d %d %d\n", b, a, c);
			}
			else
			{
				printf("%d %d %d\n", b, c, a);
			}
		}
		else
		{
			if (a<b)
			{
				printf("%d %d %d\n", c, a, b);
			}
			else
			{
				printf("%d %d %d\n", c, b, a);
			}
		}
	}
	return 0;
}



Measured memory_bytes: 2108
let split_int s = Str.split (Str.regexp_string " ") s
                  |> List.map int_of_string;;
let rec read () =
  try let l1 = read_line () |> split_int and
          l2 = read_line () |> split_int in
      let rec loop1 (h, b) = function
          i when i = List.length l1 -> (h, b)
        | i -> let rec loop2 hit blow= function
                   j when j = List.length l2 -> (hit, blow)
                 | j -> if i = j && List.nth l2 j = List.nth l1 i then
                          loop2 (hit+1) blow (j+1)
                        else if i != j && List.nth l2 j = List.nth l1 i then
                          loop2 hit (blow+1) (j+1)
                        else
                          loop2 hit blow (j+1)
               in
               let (hit, blow) = loop2 0 0 0
               in
               loop1 (h+hit, b+blow) (i+1)
      in
      let (h, b) = loop1 (0, 0) 0
      in
      Printf.printf "%d %d\n" h b;read ()
  with End_of_file -> ()
;;

let () = read ();;

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

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

    vector<int> d(N);
    for(int i = 0; i < N; i++) {
        cin >> d.at(i);
    }

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

    int count = 1;
    for(int i = 0; i < N - 1; i++) {
        if(d.at(i) != d.at(i + 1)) {
            count++;
        }
    }
    cout << count << endl;
}


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

int main() {
    string S;
    cin >> S;
    int cnt[26];
    fill(cnt, cnt + 26, 0);

    for (char c : S) {
        ++cnt[c - 'a'];
    }

    for (int i = 0; i < 26; ++i) {
        if (cnt[i] == 0) {
            S.push_back('a' + i);
            cout << S << endl;
            return 0;
        }
    }

    string T = S;
    if (next_permutation(S.begin(), S.end())) {
        for (int i = 0; i < 26; ++i) {
            cout << S[i];
            if (S[i] != T[i]) break;
        }
    } else {
        cout << -1;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#define MAX 100

void henkan(char str[],int x){
 int i;
 int len=strlen(str);

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

  if( isalpha(str[i]) )
    str[i]=(str[i]-'a'+x)%26+'a';

 }

return;
}


int check(char str[]){
 int i;
 int len=strlen(str);

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

  if(str[i]=='t'){
    if(str[i+1]=='h'){
      if(str[i+2]=='e'){
       if(str[i+3]==' '){printf("%s\n",str);return 1;}
      }
      else if(str[i+2]=='i'){
       if(str[i+3]=='s' && str[i+4]==' '){printf("%s\n",str);return 1;}
      }
      else if(str[i+2]=='a'){
       if(str[i+3]=='t' && str[i+4]==' '){printf("%s\n",str);return 1;}
      }
    }
   }
 }

return 0;
}

int main(){
 char str[MAX];
 char copy[MAX];
 int i;

 while(scanf("%[^\n]",str)!=EOF){

  strcpy(copy,str);

  for(i=1;i<=26;i++){

    strcpy(str,copy);
    henkan(str,i);
    if(check(str))break;

  }
 scanf("%*c");
 }

 return 0;
}


Measured memory_bytes: 2016
#include <iostream>
#include <vector>

using namespace std;

int main(){
	int N, x;
	cin>>N>>x;

	if(x==1 || x==2*N-1){
		cout<<"No"<<endl;
	}else{
		if(N==2){
			cout<<"Yes"<<endl<<1<<endl<<2<<endl<<3<<endl;
		}else{
			vector<bool> v(2*N-1);
			for(int i=0; i<2*N-1; i++){
				v[i]=false;
			}
			if(x!=2){
				v[x-1-1]=true;
				v[x-1]=true;
				v[x+1-1]=true;
				v[x-2-1]=true;
			}else{
				v[x+1-1]=true;
				v[x-1]=true;
				v[x-1-1]=true;
				v[x+2-1]=true;
			}
			int cnt=0;
			cout<<"Yes"<<endl;
			for(int i=0; i<N-2; i++){
				while(v[cnt]){
					cnt++;
				}
				cout<<cnt+1<<endl;
				v[cnt]=true;
				cnt++;
			}
			if(x!=2){
				cout<<x-1<<endl;
				cout<<x<<endl;
				cout<<x+1<<endl;
				cout<<x-2<<endl;
			}else{
				cout<<x+1<<endl;
				cout<<x<<endl;
				cout<<x-1<<endl;
				cout<<x+2<<endl;
			}
			for(int i=N+2; i<2*N-1; i++){
				while(v[cnt]){
					cnt++;
				}
				cout<<cnt+1<<endl;
				v[cnt]=true;
				cnt++;
			}
		}
	}

	return 0;
}


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

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

    int a = A.size();
    int b = B.size();

    if(A.at(a-1) == B.at(0) && B.at(b-1) == C.at(0)){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

}


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

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans=0;
  for(int i=0;i<n;i++){
    int tmp=0;
    for(int j=0;j<26;j++){
      int af=0;
      int bf=0;
      for(int k=0;k<i;k++){
        if(s[k]=='a'+j)af=1;
      }
      for(int k=i;k<n;k++){
        if(s[k]=='a'+j)bf=1;
      }
      if(af==1&&bf==1)tmp++;
    }
    ans=max(ans,tmp);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int t[100];
bool check(int x){
  int p=-1;
  while(p+x<n){
    int i;
    for(i=1;i<=x;i++){
      if(t[p+i]==0){
        p=p+i;
        break;
      }
    }
    if(i>x)return false;
  }
  return true;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>t[i];
  }
  for(int i=1;i<=n+1;i++){
    if(check(i)){
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}



Measured memory_bytes: 3088
/*
Look at the star
Look at the shine for U
*/
#include<bits/stdc++.h>
#define ll long long
#define PII pair<int,int>
#define sl(x) scanf("%lld",&x)
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
ll inv(ll b){if(b==1)return 1; return (mod-mod/b)*inv(mod%b)%mod;}
ll fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n%mod;n=n*n%mod;}return r;}
char s[N],t[N];
int main()
{
	ll i,j,k;
	scanf("%s",s);
	ll flag  = 0;
	ll len = strlen(s);
	for(i = 0;i < len;i++)
	{
		for(j = i;j < len;j++)
		{
			ll cnt = 0;
			for(k = 0;k <= i;k++)
				t[cnt++] = s[k];
			for(k = j;k < len;k++)
				t[cnt++] = s[k];
			t[cnt] = '\0';
			if(strcmp(t,"keyence") == 0)
			{
				puts("YES");
				return 0;
			}
		}
	}
	puts("NO");
	return 0;
}

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


void push(int);
int pop(void);

int Stack[1000];
int top=0;

int main(){
  
  int a,b;
  top = 0;
  char stack[100];
  
  while(scanf("%s",stack)!=EOF){
    if(stack[0]=='+'){
      a = pop();
      b = pop();
      push(a+b);
    }
    else if(stack[0]=='-'){
      b = pop();
      a = pop();
      push(a-b);
    }
    else if(stack[0]=='*'){
      a = pop();
      b = pop();
      push(a*b);
    }
    else{
      push(atoi(stack));
    }
  }
  
  printf("%d\n",pop());

  return 0;
}

void push(int x){
  Stack[++top] = x;
}


int pop(){
  top--;
  return Stack[top+1];
} 

Measured memory_bytes: 548
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

struct test{ll b,l,u;};
ll n,X;
ll b_,l_,u_;
vector<test> T;
ll sum_b;
ll remain;

ll value(test t){
	return t.b * t.l + (X - t.b) * t.u;
}

ll value2(test t){
	if(t.b >= remain){
		return remain * t.l;
	}else{
		return t.b * t.l + (remain - t.b) * t.u;
	}
}

ll value3(test t){
	return value(t) - value2(t);
}

bool check(ll t){
	vector<test> sort_T;
	rep(i,T.size()){
		sort_T.push_back(T[i]);
	}
    sort(sort_T.begin(), sort_T.end(), [](test tl, test tr) {
        return value(tl) > value(tr);
    });


    int ti = 0;
    ll sum_value = 0;
    vector<test> sort_T3;
    while(ti < sort_T.size()){
    	if(t < X){
    		break;
    	}
    	sum_value += value(sort_T[ti]);
    	sort_T3.push_back(sort_T[ti]);
    	ti++;
    	t -= X;
    }


    vector<test> sort_T2;
    while(ti < sort_T.size()){
    	sort_T2.push_back(sort_T[ti]);
    	ti++;
    }

    remain = t;
    sort(sort_T2.begin(), sort_T2.end(), [](test tl, test tr) {
        return value2(tl) > value2(tr);
    });

    ll max_value = 0;
    if(sort_T2.size() > 0) max_value = value2(sort_T2[0]);

    sort(sort_T2.begin(), sort_T2.end(), [](test tl, test tr) {
        return value(tl) > value(tr);
    });

    sort(sort_T3.begin(), sort_T3.end(), [](test tl, test tr) {
        return value3(tl) < value3(tr);
    });
    if(sort_T2.size() > 0 && sort_T3.size() > 0) chmax(max_value, value(sort_T2[0]) - value3(sort_T3[0]));

    sum_value += max_value;

    if(sum_value >= sum_b){
    	return true;
    }else{
    	return false;
    }
}

int main(void){
	cin>>n>>X;
	sum_b = 0;
	rep(i,n){
		cin>>b_>>l_>>u_;
		T.push_back(test{b_,l_,u_});
		sum_b += b_ * l_;
	}
	ll begin = -1;
	ll end = n*X;//end: 正解
	while(end - begin >= 2){
		if(check((begin+end)/2)){//可能ならもっと小さく
			end = (begin+end)/2;
		}else{
			begin = (begin+end)/2;
		}
	}
	cout<<end<<endl;
	return 0;
}


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

int main() {
    int n, x;
    int dic_cnt = 0;
    int cnt = 0;
    while (true) {
        cin >> n >> x;
        if (n + x == 0) {
            break;
        }
        for (int i = n; i > 0; i--) {
            for (int j = i - 1; j > 0; j--) {
                for (int k = j - 1; k > 0; k--) {
                    if (i + j + k == x) {
                        dic_cnt++;
                    }
                }
            }
        }
        cout << dic_cnt << endl;
        dic_cnt = 0;
        cnt++;
        if (cnt > 100000) {
            break;
        }
    }
}



Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

bool comp(pair<int,int> a,pair<int,int> b){
	if(a.second != b.second){
		return a.second < b.second;
	}else{
		return a.first < b.first;
	}
}



int main(){
	int n,m;
	long res = 0;
	vector<int> a;
	vector<pair <int,int>> change;
	cin >> n >> m;
	a.resize(n);
	change.resize(m);
	for(int i=0;i<n;++i){
		cin >> a[i];
	}
	for(int i=0;i<m;++i){
		int b,c;
		cin >> b >> c;
		change[i] = make_pair(b,c);
	}
	sort(a.begin(),a.end());
	sort(change.begin(),change.end(),comp);
	auto it = lower_bound(a.begin(),a.end(),change[m-1].second);
	int k = (int)(it - a.begin());
	for(int i=0;i<k;++i){
		if(a[i] >= change[m-1].second)break;
		a[i] = change[m-1].second;
		change[m-1].first--;
		if(change[m-1].first == 0){
			m--;
			change.pop_back();
		}
	}
	for(int i=0;i<n;++i){
		res += a[i];
	}
	cout << res << endl;
}

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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;

#define MAX_N 1000000

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	ll k = 1;
	while (cin>>n) {
		if (n == 0) break;
		cout << "Case " << k << ": " << n << endl;
		k++;
	}
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
 
#define all(x) (x).begin(), (x).end()
#define li long long
#define itn int
 
using namespace std;
 
inline int nxt(){
	int n;
	scanf("%d", &n);
	return n;
}

int main(){

	string s;
	cin >> s;
	int state = 0;
	for (char c : s) {
		if (c == 'C' && state == 0) {
			state += 1;
		} else if (c == 'F' && state == 1) {
			state += 1;
		}
	}

	puts(state == 2 ? "Yes" : "No");

	return 0;
}

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

int main(){
  int a,b,i;
  string s;
  cin >> a >> b;
  cin >> s;
  for(i = 0; i < a; i++){
    if(!('0' <= s[i] && s[i] <= '9')){
      cout << "No" << endl;
      return 0;
    }
  }

  if(s[a] != '-'){
    cout << "No" << endl;
    return 0;
  }

  for(i = a + 1; i < a + b; i++){
    if(!('0' <= s[i] && s[i] <= '9')){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
}

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
}

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

int main()
{
  int A = inputValue();
  int B = inputValue();
  int K = (A + B) / 2;
  
  if(abs(A-K) != abs(B-K))
    cout << "IMPOSSIBLE" << endl;
  else{
    cout << K << endl;
  }
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    n = ini()
    a = inl()
    cur = 1
    for x in a:
        if x == cur:
            cur += 1
    if cur == 1:
        return -1
    return n + 1 - cur


print(solve())


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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll, int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const int N = 200005;

ll v[N];

void solve(){
	int n;
	ll x = 0;
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> v[i];
	for(int i = 0; i < n; i++)
		x ^= v[i];
	for(int i = 0; i < n; i++){
		cout << (v[i] ^ x) <<" ";
	}cout << endl;
}

int main(){
	fastio;
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}


Measured memory_bytes: 5144
#include <stdio.h>
#include <stdlib.h>

#define ARR_LIMIT 10000
#define CheckNumber(number, limitLow, limitHigh) (	\
		(number) >= limitLow &&	\
		(number) <= limitHigh	\
)

typedef struct {
	int n;
	int x;
} RANGE;

void InputNumber2(int* number1, int* number2);
void Counting(RANGE* ranges, int* result, int size);

int main(void) {
	int size;
	int idx;
	RANGE ranges[ARR_LIMIT];
	int* result;

	for (size = 0; size < ARR_LIMIT; size++) {
		int tmp1;
		int tmp2;
		do {
			InputNumber2(&tmp1, &tmp2);
		} while (tmp1 > 0 && tmp1 < 3);

		if (tmp1 == 0 && tmp2 == 0) {
			break;
		} else {
			RANGE* range = &ranges[size];
			range->n = tmp1;
			range->x = tmp2;
		}
	}

	result = (int*)malloc(sizeof(int) * size);
	Counting(ranges, result, size);

	for (idx = 0; idx < size; idx++) {
		printf("%d\n", *(result + idx));
	}

	free(result);
}

void InputNumber2(int* number1, int* number2) {
	int tmp1;
	int tmp2;
	do {
		scanf("%d %d", &tmp1, &tmp2);
	} while((!CheckNumber(tmp1, 0, 100) || !CheckNumber(tmp2, 0, 300)));

	*number1 = tmp1;
	*number2 = tmp2;
}

void Counting(RANGE* ranges, int* result, int size) {
	int idi;
	int idj;
	int ids;

	for (ids = 0; ids < size; ids++) {
		RANGE range = *(ranges + ids);
		int limit = range.n;
		int x = range.x;
		int count = 0;

		for (idi = 0; idi < limit - 1; idi++) {
			for (idj = idi + 1; idj < limit; idj++) {
				int sum = (idi + 1) + (idj + 1);
				int cont = x - sum;

				if (cont == (idi + 1) || cont == (idj + 1)) {
					continue;
				}

				if (cont >= (idj + 1) && cont <= limit) {
					*(result + ids) = ++count;
				}
			}
		}
	}
}


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

using namespace std;

#define int long long
#define PB push_back
typedef pair<int, int> pii;
static const int INF = 1LL<<61;
static const int MOD = 100000;

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

  int w, h;
  while (cin >> w >> h, w) {
    int dp[105][105][2][2] = {0}, dx[] = {-1, 0}, dy[] = {0, -1};

    dp[1][2][1][1] = 1;
    dp[2][1][0][0] = 1;
    
    for (int x = 1; x <= w; ++x) {
      for (int y = 1; y <= h; ++y) {
        for (int i = 0; i < 2; ++i) {
          int tx = x + dx[i], ty = y + dy[i];
          for (int j = 0; j < 2; ++j) {
            for (int k = 0; k < 2; ++k) {
              if (!(i == j || j == k)) continue;
              dp[x][y][i][j] += dp[tx][ty][j][k];
              dp[x][y][i][j] %= MOD;
            }
          }
        }
      }
    }

    int ans = 0;
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        ans += dp[w][h][i][j];
        ans %= MOD;
      }
    }

    cout << ans << endl;
    
  }
  
  return 0;
}

Measured memory_bytes: 1540
//
//  ABC071_B.cpp
//  
//
//  Created by 藏田力丸 on 2017/08/23.
//
//

#include <bits/stdc++.h>

using namespace std;

int main()
{
        char array[26];
        array[0] = 'a';
        array[1] = 'b';
        array[2] = 'c';
        array[3] = 'd';
        array[4] = 'e';
        array[5] = 'f';
        array[6] = 'g';
        array[7] = 'h';
        array[8] = 'i';
        array[9] = 'j';
        array[10] = 'k';
        array[11] = 'l';
        array[12] = 'm';
        array[13] = 'n';
        array[14] = 'o';
        array[15] = 'p';
        array[16] = 'q';
        array[17] = 'r';
        array[18] = 's';
        array[19] = 't';
        array[20] = 'u';
        array[21] = 'v';
        array[22] = 'w';
        array[23] = 'x';
        array[24] = 'y';
        array[25] = 'z';
        
        string str;
        
    cin >> str;
    
        int N=str.size();
        
        int i, j, k, l, m;
        i = 0;
        j = 0;
        k = 0;
        l = 0;
        m = 0;
        while(i<26)
        {
            /* アルファベットを固定して順番に見ていく */
            while(j<N)
            {
                if(str[j]==array[i])
                {
                    /* 一致したらカウントを+1 */
                    k = k + 1;
                }
                
                j = j + 1;
            }
            if(k == 0)
            {
                /* iを記録してループ脱出 */
                m = i;
                i = 26;
                /* カウントを+1する */
                l = l + 1;
            }
            
            j = 0;
            k = 0;
            i = i + 1;
            
        }
        
        if(l == 0)
        {
            printf("None\n");
        }
        
        else
        {
            printf("%c\n", array[m]);
        }
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int S = scan.nextInt();
		int W = scan.nextInt();
		
		if (W >= S) {
			System.out.println("unsafe");
		} else if(W < S) {
			System.out.println("safe");
		}

	}

}


Measured memory_bytes: 35768
#include <cstdio>

bool query(long long x){
	printf("? %lld\n",x);
	fflush(stdout);
	char s[10];
	scanf("%s",s);
	return s[0]=='Y';
}

int main(){
	long long X=1000000000;
	for (;!query(X);X/=10);
	if (X==1000000000)
		for (X=1;!query(X+1);X*=10);
	else{
		int l=X,r=X*10-1;
		for (;l<=r;){
			int mid=(l+r)>>1;
			if (query(mid*10ll)) X=mid,r=mid-1;
				else l=mid+1;
		}
	}
	printf("! %lld\n",X);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 504
#if 0

#endif

#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void p(A a){cout << (a) << endl;}
template<class A,class B>void p(A a,B b){cout << a << " "  ;p(b);}
template<class A,class B,class C>void p(A a,B b,C c){cout << a << " " ;p(b,c);}
template<class A,class B,class C,class D>void p(A a,B b,C c,D d){cout << a << " " ;p(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for copy
// for(int i=0;i<N;++i) {

int main(void) {
  int A[9];
  REP(i,9) {
    cin>>A[i];
  }
  int N;cin>>N;
  REP(i,N) {
    int b;cin>>b;
    REP(j,9) {
      if(A[j] == b) {
        A[j] = 110;
      }
    }
  }
  if(A[0]+A[1]+A[2] == 330) {
    p("Yes");
  } else if(A[3]+A[4]+A[5] == 330) {
    p("Yes");
  } else if(A[6]+A[7]+A[8] == 330) {
    p("Yes");
  } else if(A[0]+A[3]+A[6] == 330) {
    p("Yes");
  } else if(A[1]+A[4]+A[7] == 330) {
    p("Yes");
  } else if(A[2]+A[5]+A[8] == 330) {
    p("Yes");
  } else if(A[0]+A[4]+A[8] == 330) {
    p("Yes");
  } else if(A[2]+A[4]+A[6] == 330) {
    p("Yes");
  } else {
    p("No");
  }
  return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;
 
class DandA {
    static void Main(string[] args) {
        int n = ReadLineInt();
        int[] hList = ReadLineIntArray();
        int rtn = 0;
        int wk = 0;
        for (int i = 0;i < n - 1; i++) {
            if (hList[i] >= hList[i + 1]) {
                wk++;
            } else {
                wk = 0;
            }
            if (rtn < wk) {
                rtn = wk;
            }
        }
        Console.WriteLine(rtn);
    }
 
    static string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    static string[] strAry = new string[] {"L", "R", "U", "D"}; 
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private double ReadLineDouble() {return double.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}
 
    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
  
    static private string IntToNString(int x, int n) {
        var nstring = "";
        var numbers = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
        int r = 1;
        int q = x;
        while (q > 0) {
            r = q % n;
            nstring += numbers[r];
            q = q / n;
        }
        return string.Join("",nstring.Reverse());
     }
}

Measured memory_bytes: 24156
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

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

int ctoi(char c){
  return c - '0';
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  I x;
  cin >> x;
  I y = x / 100;
  I a = 5 * y;
  if (x % 100 > a){
    cout << 0 << endl;
  }else{
    cout << 1 << endl;
  }
  return 0;
}



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

ll mod = 1000000007;
ll ans = 1<<29;

int main() {
    string a,b;
    cin >> a>>b;
    if (a.size()>b.size()) cout << "GREATER" <<endl;
    else if(a.size()<b.size()) cout << "LESS" <<endl;
    else{
        if(a==b){
            cout << "EQUAL" <<endl;
            return 0;
        }
        else
        {
            rep(i,a.size()){
                if(a[i]-'0'>b[i]-'0') {
                    cout << "GREATER" <<endl;
                    return 0;
                }
                else {
                    cout << "LESS" <<endl;
                    return 0;
                }
            }
        }
        
    }
        }


Measured memory_bytes: 256
#include <cstdio>

int a, b;

int main()
{
	scanf("%d %d", &a, &b);
	if (a % 3 == 0)
		printf("Possible\n");
	else if (b % 3 == 0)
		printf("Possible\n");
	else if ((a + b) % 3 == 0)
		printf("Possible\n");
	else
		printf("Impossible\n");
}

Measured memory_bytes: 128
import numpy as np

n, w = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(n)]

dp = np.zeros((n+1, w+1), np.int64)

for i, (wi, vi) in enumerate(wv):
    dp[i+1] = dp[i]
    np.maximum(dp[i][wi:], dp[i][:-wi] + vi, out=dp[i+1][wi:])
"""
for i in range(n):
    for sum_w in range(w+1):
        wi = wv[i][0]
        vi = wv[i][1]
        if sum_w - wi >= 0:
            dp[i+1][sum_w] = dp[i][sum_w - wi] + vi
        dp[i+1][sum_w] = max(dp[i][sum_w], dp[i+1][sum_w])
"""
#print(dp)
print(dp[n][w])


Measured memory_bytes: 91312
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
struct edge{int to,cost;};
using P=pair<int,int>;
const int INF=1<<29;
const int MAX_V=10010;
vector<edge> G[MAX_V];
int d1[MAX_V];
int d2[MAX_V];
int V,E;
void dijkstra(int s,int *d){
  priority_queue<P,vector<P>,greater<P>> que;
  fill(d,d+V,INF);
  d[s]=0;
  que.push(P(0,s));
  while(!que.empty()){
    P p=que.top();que.pop();
    int v=p.second;
    if(d[v]<p.first)continue;
    REP(i,G[v].size()){
      edge e=G[v][i];
      if(d[e.to]>d[v]+e.cost){
	d[e.to]=d[v]+e.cost;
	que.push(P(d[e.to],e.to));
      }
    }
  }
}

int main(){_;
  int n,f,t,c;cin>>n;
  REP(i,n-1){
    cin>>f>>t>>c;
    G[f].push_back(edge{t,c});
    G[t].push_back(edge{f,c});
  }
  V=n;
  E=(n-1)*2;
  dijkstra(0,d1);
  dijkstra(distance(d1,max_element(d1,d1+n)),d2);
  dijkstra(distance(d2,max_element(d2,d2+n)),d1);
  REP(i,n){
    cout<<max(d1[i],d2[i])<<endl;
  }
}

Measured memory_bytes: 3984