akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>

using namespace std;
void helper(void);
int p[10005];
int main(){
    int n;
    cin >> n;
    helper();
    for(int N=1;N<=n;N++){
        cout << p[N] << endl;
    }

    return 0;
}



void helper(){
    for(int x=1;x<=100;x++){
        for(int y=x;y<=100;y++){
            for(int z=y;z<=100;z++){
                int N = x*x + y*y + z*z + x*y + y*z + z*x;
                if(N >= 10005){break;}
                if(x == y && y == z){
                    p[N] += 1;
                }else if(x == y || y == z || z == x){
                    p[N] += 3;
                }else{
                    p[N] += 6;
                }
            }
        }
    }
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
// constexpr long double EPS = 1e-15;
// const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

ll dp[100010][13];

void solve() {
    string s;
    cin >> s;
    REP(i,sz(s) + 1) REP(j,13) dp[i][j] = 0;
    dp[0][0] = 1;
    REP(i,sz(s)) {
        REP(j,13) {
            if (s[i] != '?') {
                dp[i+1][(s[i] - '0' + j * 10) % 13] += dp[i][j];
                dp[i+1][(s[i] - '0' + j * 10) % 13] %= MOD;
            } else {
                REP(k,10) {
                    dp[i+1][(k + j * 10) % 13] += dp[i][j];
                    dp[i+1][(k + j * 10) % 13] %= MOD;
                }
            }
        }
    }
    cout << dp[sz(s)][5] << endl;
}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

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

int main() {
  int tmp0[100000]={0};
  int N, p, h=0;
  long long out = 0;
  cin >> N;
  for (p=0;p<N;p++) {
    cin >> tmp0[p];
    if (h&&tmp0[p]!=0) {
      tmp0[p]--;
      out++;
    }
    h = 0;
    for (;tmp0[p]>=2;) {
      out++;
      tmp0[p] -= 2;
    }
    if (tmp0[p]==1) h = 1;
  }
  cout << out << endl;
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

int main()
{
	using namespace std;
	int N;
	cin >> N;

	string S;
	cin >> S;

	char gc;

	gc = S[0];
	int count = 1;
	for (int i = 1; i < N; i++) {
		if (S[count] == gc) {
			S.erase(S.begin() + count);
		}
		else {
			gc = S[count];
			count++;
		}
	}

	cout << S.length() << endl;

}

Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>

using namespace std;

typedef long long LL;
#define FAST ios::sync_with_stdio(false);
const int MaxN = 105;
stack<char > que;
stack<char> st;
int main()
{
	string s;
	cin >> s;
	for(int i = 0 ; i < s.length(); i++)
	{
		if(s[i] == 'B' && !que.empty())que.pop();
		if(s[i] == '1' || s[i] == '0')que.push(s[i]);
		}
	while(!que.empty())
	{
		char n = que.top();
		st.push(n);
		que.pop();
		}
	while(!st.empty())
	{
		char m = st.top();
		cout << m;
		st.pop();
		}
	cout << endl;
	return 0;
	}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define hell 1000000007
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
bool prime[200005];
void sieve(){
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p<200005; p++) 
    {
        if (prime[p] == true) 
        {
            for (int i=p*p; i<200005; i += p) 
                prime[i] = false; 
        } 
    }
}
int powmod(int x,int y,int mod){
    int res = 1;
    x = x%mod;
    while(y>0){
        if(y&1){
            res = (res*x)%mod;
        }
        y = y>>1;
        x = (x*x)%mod;
    }
    return res;
}
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    rep(i,0,n){
        cin>>a[i];
    }
    int lcm = a[0];
    rep(i,1,n){
        lcm = (a[i]*lcm)/(gcd(a[i],lcm));
    }
    int sum = 0;
    rep(i,0,n){
        sum+=(lcm/a[i]);
    }
    double ans = (lcm*1.0)/sum;
    cout<<setprecision(10);
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>

#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

const int inf = 2147483647;
const int64_t inf64 = 9223372036854775807;
const int mod = 1e9+7;

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

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

  Bint res = 1;
  rep(i,n) {
    res *= arr[i];
    if(res > 1000000000000000000) { cout << -1 << endl; return 0; }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 6480
/*
 * Author - Abhas Jain
 * Code is inside the solve function
 */
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define endl '\n'
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
 
const ld PI = 3.141592653589793;
const ll INF = 9223372036854775807ll;
const ll mod = 1e9 + 7;
 
void solve() 
{
	int n;
	cin >> n;
	if (n >= 30) cout << "Yes" << endl;
	else cout << "No" << endl;
}
 
int main( )
{   
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
    return 0;
}

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

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

Measured memory_bytes: 195584
//#include<cstdio>
#include<iostream>
//#include<cstring>
using namespace std;
int main(void)
{
	int n,h,m,s;
	cin>>n;
	h=n/3600;
	m=(n-(h*3600))/60;
	s=(n-(h*3600))-60*m;
	cout<<h<<':'<<m<<':'<<s<<endl;
	return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	ll res = 0;
	FOR(k,1,n+1) res += sz(to_string(k)) % 2;
	cout << res << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <queue>

#define INF 1e9

using namespace std;

struct Edge {
	int to, cost;
};
struct Node {
	int now, rest, cost;
};
bool operator <(const Node& n1, const Node& n2) {
	return n1.cost < n2.cost;
}
bool operator >(const Node& n1, const Node& n2) {
	return n1.cost > n2.cost;
}

int main() {
	int c, n, l, s, d;
	while ( cin >> c >> n >> l >> s >> d, c || n || l || s || d ) {
		--s, --d;

		vector<Edge> m[100];
		for (int i = 0; i < l; ++i) {
			int a, b, f; cin >> a >> b >> f; --a, --b;
			m[a].push_back( (Edge){ b, f } );
			m[b].push_back( (Edge){ a, f } );
		}

		int ans[100][11]; fill(&ans[0][0], &ans[0][0]+100*11, INF);
		priority_queue<Node, vector<Node>, greater<Node> > Q; Q.push( (Node){s, c, 0} );
		while ( !Q.empty() ) {
			Node node = Q.top(); Q.pop();
			if (node.cost >= ans[node.now][node.rest]) continue;
			ans[node.now][node.rest] = node.cost;

			for (int i = 0; i < m[node.now].size(); ++i) {
				Edge& e = m[node.now][i];
				if (node.cost+e.cost < ans[e.to][node.rest]) {
					Q.push( (Node){ e.to, node.rest, node.cost+e.cost } );
				}

				if (node.rest > 0) {
					if (node.cost+e.cost/2 < ans[e.to][node.rest-1]) {
						Q.push( (Node){ e.to, node.rest-1, node.cost+e.cost/2 } );
					}
				}
			}
		}
		int a = INF;
		for (int i = 0; i <= c; ++i) a = min(a, ans[d][i]);
		cout << a << endl;
	}
}

Measured memory_bytes: 1332
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <string.h>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

#ifndef INT_MAX
#  define INT_MAX std::numeric_limits<int>().max()
#endif
#ifndef INT_MIN
#  define INT_MIN std::numeric_limits<int>().min()
#endif
#define LL_MAX std::numeric_limits<ll>().max()
#define LL_MIN std::numeric_limits<ll>().min()
#define INF LL_MAX

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
// 配列の初期化
#define ZERO(p) memset(p, 0, sizeof(p))
// 配列の初期化(-1)
#define MINUS(p) memset(p, 1, sizeof(p))

int N;

int main()
{
    cin >> N;
    int num = 0;
    int head = 0;
    string middle = "";
    REP(i, N) {
        char c;
        cin >> c;
        if(c == '(') {
            num++;
            middle += "(";
        } else {
            if(num <= 0) {
                head++;
            } else {
                num--;
            }
            middle += ")";
        }
    }
    REP(i, head) {
        printf("(");
    }
    cout << middle;
    REP(i, num) {
        printf(")");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = INF+7;
const ll LINF = 1e18;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.begin(),v.end()
#define MP make_pair
#define pb(n) push_back(n)

#define int long long
vector<int> Enumeration_diviser(int N){
    std::vector<int> diviser;
    for(int i=1;i*i<=N;++i){
        if(N % i == 0){
            diviser.emplace_back(i);
            diviser.emplace_back(N/i);
        }
    }
    return diviser;
}

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

    int N;
    cin >> N;
    vector<int> D = Enumeration_diviser(N);
    int ans = 1e9;
    for(int i=0;i<D.size()-1;++i){
        ans = max(to_string(D[i]).size(),to_string(D[i+1]).size());
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define LL long long
#define MAXN 300000+9
using namespace std;

LL n;
LL sum[MAXN];
LL ans=0x7fffffff;

void solve(){
	LL i;
	LL x,y;
	for(i=1;i<n;i++){
		x=sum[i];
		y=sum[n]-sum[i];
		ans=min(ans,abs(x-y));
	}
	printf("%lld\n",ans);
}

int main(){
	scanf("%lld",&n);
	LL i;
	LL x;
	for(i=1;i<=n;i++){
		scanf("%lld",&x);
		sum[i]=sum[i-1]+x;
	}
	solve();
	return 0;
}


Measured memory_bytes: 1664
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	if (n <= m) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    var input = readLine()!!.split(" ").map(String::toLong)
    if (input[0] % 2 == 0L || input[1] % 2 == 0L || input[2] % 2 == 0L) {
        println(0)
        return
    }
    input = input.sorted()
    println(input[0] * input[1])
}



Measured memory_bytes: 37800
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;

class P
{
  static int[] Input(){
    return Console.ReadLine().Split().Select(int.Parse).ToArray();
  }

  static int[][] Input2(int n){
    int[][] X = new int[n][];
    for(int i = 0; i < n; i++){
      X[i] = Input();
    }
    return X;
  }

  static long[][] Inv(int n){
    int mod = 1000000007;
    long[][] X = new long[2][];
    X[0] = new long[n+1];
    X[1] = new long[n+1];
    X[0][0] = 1; X[0][1] = 1;
    X[1][0] = 0; X[1][1] = 1;
    for(int i = 2; i <= n; i++){
//      Console.WriteLine($"{X[0][i-1]} {X[0][i-1]*i} {X[0][i-1]*i%mod}");
      X[0][i] = X[0][i-1] * i % mod;
      X[1][i] = (mod-X[1][mod%i]) * (mod/i) % mod;
    }
    return X;
  }

  static void Main()
  {
    int[] NC = Input();
    int N = NC[0];
    int mod = 1000000007;
    int[] Xs = Input();
    long[][] X = Inv(1000000);
    long r = 0;
    for(int i=0; i < N-1; i++){
      r = (r + ((X[0][N-1] * X[1][i+1] %mod) * (mod + Xs[N-1]-Xs[i]) % mod)%mod) % mod;
    }
    Console.WriteLine(r);
  }
}


Measured memory_bytes: 36172
#include <bits/stdc++.h>
#define b 31ll
#define mod 1004535809ll
#define ll long long
using namespace std;
char s[400005];
ll l[1005],fib[1005][27],ans[27];
ll has[400005],m[400005],lo,hi;
int len,t;
inline ll get(int l,int r)
{if (l>r) return 0;
ll ret=(has[r]-has[l-1]*m[r-l+1])%mod;
return (ret<0?ret+mod:ret);
}
inline void add(ll p,int pos)
{if (pos<=1)
{for (int i=1;i<=p;i++)
{ans[s[(i-1)%len+1]-'a']++;}
return;
}
if (p>=l[pos-1])
{for (int i=0;i<26;i++) ans[i]+=fib[pos-1][i];
add(p-l[pos-1],pos-2);
return;
}
add(p,pos-1);
}
inline void del(ll p,int pos)
{if (pos<=1)
{for (int i=1;i<=p;i++)
{ans[s[(i-1)%len+1]-'a']--;}
return;
}
if (p>=l[pos-1])
{for (int i=0;i<26;i++) ans[i]-=fib[pos-1][i];
del(p-l[pos-1],pos-2);
return;
}
del(p,pos-1);
}
int main (){
	int i,j,las;
	scanf ("%s",s+1);len=strlen(s+1);
	scanf ("%lld%lld",&lo,&hi);
	m[0]=1ll;len>>=1;
	for (i=1;i<=len;i++)
	{m[i]=m[i-1]*b%mod;
	has[i]=has[i-1]*b+(s[i]-'0');
	has[i]%=mod;
	}
	for (i=1;i<=len;i++)
	{if (get(1,len-i)==get(i+1,len))
	{t=i;break;}
	}
	l[0]=len;l[1]=len+t;
	for (i=1;i<=len;i++)
	{fib[0][s[i]-'a']++;
	fib[1][s[i]-'a']++;
	}
	for (i=1;i<=t;i++)
	{fib[1][s[i]-'a']++;}
	for (i=2;l[i-2]+l[i-1]<=2ll*hi;i++)
	{for (j=0;j<26;j++)
	{fib[i][j]=fib[i-1][j]+fib[i-2][j];}
	l[i]=l[i-1]+l[i-2];
	las=i;
	}
	add(hi,las);del(lo-1,las);
	for (i=0;i<26;i++)
	{printf ("%lld ",ans[i]);}
	return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pi;

#define int long long
const int MAXN=100005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

int X, Y, A, B, C, P[MAXN], Q[MAXN], R[MAXN], ans;
multiset<int> pset, qset, rset; 
main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> X >> Y >> A >> B >> C;
	FOR(i,1,A) cin >> P[i];
	FOR(i,1,B) cin >> Q[i];
	FOR(i,1,C) cin >> R[i];
	sort(P+1,P+A+1,greater<int>());
	sort(Q+1,Q+B+1,greater<int>());
	FOR(i,1,X) pset.insert(P[i]);
	FOR(i,1,Y) qset.insert(Q[i]);
	FOR(i,1,C) rset.insert(R[i]);
	while (pset.size() && qset.size() && rset.size()){
		int red = *pset.begin();
		int green = *qset.begin();
		int cless = *rset.rbegin();
		if (cless <= min(red, green)) break;
		if (red < green){
			pset.erase(pset.begin());
			pset.insert(cless);
			rset.erase(prev(rset.end()));
		}
		else{
			qset.erase(qset.begin());
			qset.insert(cless);
			rset.erase(prev(rset.end()));
		}
	}
	while (pset.size() && rset.size()){
		int red = *pset.begin();
		int cless = *rset.rbegin();
		if (cless <= red) break;
		pset.erase(pset.begin());
		pset.insert(cless);
		rset.erase(prev(rset.end()));
	}
	while (qset.size() && rset.size()){
		int green = *qset.begin();
		int cless = *rset.rbegin();
		if (cless <= green) break;
		qset.erase(qset.begin());
		qset.insert(cless);
		rset.erase(prev(rset.end()));
	}
	for (auto i:pset) ans += i;
	for (auto j:qset) ans += j;
	cout << ans;
}


Measured memory_bytes: 15744
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()

    print("Yes" if s[:4] == "YAKI" else "No")


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
int read()
{
	int out = 0, sgn = 1;
	char jp = getchar();
	while (jp != '-' && (jp < '0' || jp > '9'))
		jp = getchar();
	if (jp == '-')
		sgn = -1, jp = getchar();
	while (jp >= '0' && jp <= '9')
		out = out * 10 + jp - '0', jp = getchar();
	return out * sgn;
}
const int P = 1e9 + 7;
int add(int a, int b)
{
	return a + b >= P ? a + b - P : a + b;
}
void inc(int &a, int b)
{
	a = add(a, b);
}
const int N = 3e5 + 10;
char s[N];
int trans[9][2] = {{1, 2}, {3, 0}, {4, 5}, {1, 1}, {6, 2}, {7, 5}, {4, 4}, {8, 5}, {7, 7}};
int n, dp[N][9];
int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	dp[0][0] = 1;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < 9; ++j) if (dp[i][j])
		{
			if (s[i + 1] != '0')
				inc(dp[i + 1][trans[j][1]], dp[i][j]);
			if (s[i + 1] != '1')
				inc(dp[i + 1][trans[j][0]], dp[i][j]);
		}	
	int ans = 0;
	for (int j : {2, 5, 7, 8})
		inc(ans, dp[n][j]);
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 11136
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;

int n;
int flag;
string s;
int boo[100005];
int st[4][2]={{1,1},{1,0},{0,1},{0,0}};
int main()
{
	cin>>n;
	cin>>s;
	rep(kkk,4)
	{
		flag=1;
		boo[0]=st[kkk][0];
		boo[1]=st[kkk][1];
		rep2(i,1,n)
		{
			if(boo[i]==1)
			{
				if(s[i]=='o')boo[i+1]=boo[i-1];
				else boo[i+1]=1-boo[i-1];
			}
			else
			{
				if(s[i]!='o')boo[i+1]=boo[i-1];
				else boo[i+1]=1-boo[i-1];
			}
			
		}
		if(boo[0]!=boo[n])continue;
		if(boo[0]==1)
		{
			if(s[0]=='o')if(boo[1]!=boo[n-1])flag=0;
			if(s[0]=='x')if(boo[1]==boo[n-1])flag=0;
		}
		else
		{
			if(s[0]=='x')if(boo[1]!=boo[n-1])flag=0;
			if(s[0]=='o')if(boo[1]==boo[n-1])flag=0;
		}
		//
		if(flag)
		{
			rep(i,n)
			{
				if(boo[i]==1)
				{
					cout<<'S';
				}
				else cout<<'W';
			}
			cout<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()


int main() {
  int N;
  cin >> N;
  
  if(N<1000) cout << "ABC" << endl;
  else cout << "ABD" << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a[] = new int[N];
		int b[] = new int[N];
		int count = 1;
		int answer = 0;


		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			if (a[i] == count) {
				count++;
			} else {
				answer++;
			}
		}

		if (answer == N) {
			System.out.println("-1");
		} else {
			System.out.println(answer);
		}
	}

}

Measured memory_bytes: 66192
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  if(S == "Sunny")
  cout << "Cloudy" << endl;
  
  if(S == "Cloudy")
  cout << "Rainy" << endl;
  
  if(S == "Rainy")
  cout << "Sunny" << endl;

  return 0;
}

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

int main()
{
    string s;
    cin >> s;
    string ans="ABC";
    if(s==ans) ans="ARC";
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define rerepi(i, a, b) for(int i = int(a)-1; i >= b; --i)
#define rerep(i, n) rerepi(i, n, 0)

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; }
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) {o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// 降順ソート
// std::sort(data.begin(),data.end(),std::greater<int>());
// 昇順ソート
// std::sort(data.begin(),data.end());

const long long INF = 1LL << 60;

// ここから開始だよ！
string S;

int main() {
	// 呪文エリア
	cin.tie(0);
	ios::sync_with_stdio(false);
	// 詠唱完了

	cin >> S;

	ll ans = 0;
	ll aa_abs = INF;
	rep(i, S.length()) {
		if (i+2 == S.length()) {
			break;
		}
		ll tmp = (ll) stoi(S.substr(i, 3));
		ll aa = abs(tmp - 753);
		//cout << tmp << " " << aa << endl;
		if (aa_abs > aa) {
			aa_abs = aa;
			ans = tmp;
		}
	}
	cout << aa_abs << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    pl(2*3.14159265*a+"");
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}


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

int main (void){
    int value;
    int thousand;
    int back;
    scanf("%d",&value);
    if(value<1000){
        back = 1000-value;
        printf("%d",back);
    }else if(value %1000==0){
        back = value %1000;
        printf("%d",back);
    }else{
        thousand = value /1000 +1; 
        back = thousand*1000 - value;
        printf("%d",back);
    }
    return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/12  Problem: ABC 080 D / Link: http://abc080.contest.atcoder.jp/tasks/abc080_d  ----- */


struct Cumusum {
	vector<LL>csum;
	Cumusum() {}
	Cumusum(vector<LL>&a) {
		csum.assign((int)a.size() + 1, 0);
		for (int i = 0; i < (int)a.size(); i++) {
			csum[i + 1] = csum[i] + a[i];
		}
	}
	LL query(int l, int r) {
		return csum[r] - csum[l];
	}
};
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	LL N, C; cin >> N >> C;
	vector<LL>s(N), t(N), c(N);
	for (int i = 0; i < N; ++i) {
		cin >> s[i] >> t[i] >> c[i];
		c[i]--;
	}
	VVL vc(C, VL(2e5 + 10));
	FOR(i, 0, N) {
		vc[c[i]][2 * s[i] - 1]++;
		vc[c[i]][2 * t[i]]--;
	}
	vector<Cumusum>vcsum(C);
	FOR(i, 0, C) {
		vcsum[i] = Cumusum(vc[i]);
	}
	VL a(2e5 + 30);
	FOR(c, 0, C) {
		FOR(i, 0, 2e5 + 10) {
			if (vcsum[c].csum[i])
				a[i]++;
		}
	}

	LL ans = *max_element(ALL(a));


	cout << (ans) << "\n";

	return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

const int MAX = 1000001;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void){
    COMinit();
    //(i+1, j+2)をA回 (i+2, j+1)をB回 -> (A+2B, 2A+B)にいる
    //A+2B = X, 2A+B = Y
    //3A = 2Y-X, 3B = 2X-Y
    int X, Y; cin >> X >> Y;
    int judgeA = 2*Y-X;
    int judgeB = 2*X-Y;
    if(judgeA >= 0 && judgeA % 3 == 0 && judgeB >= 0 && judgeB % 3 == 0){
        int A = judgeA/3, B = judgeB/3;
        cout << COM(A+B, A) << endl;
    }
    else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 23680
#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);

	long long n, m, i, j, k, s, b, c;
	cin >> n >> m;
	vector<long long> a(n);
	priority_queue<pair<long long, long long>> pq;
	for (i = 0; i < n; i++) cin >> a[i];
	for (i = 0; i < m; i++) {
		cin >> b >> c;
		pq.push({ c, b });
	}

	s = 0;
	sort(a.begin(), a.end());
	for (i = 0; i < n; i++) {
		if (!pq.empty() && (pq.top().first > a[i])) {
			b = pq.top().first;
			c = pq.top().second;
			pq.pop();
			a[i] = b;
			if (c > 1) pq.push({ b, c - 1 });
		}
		s += a[i];
	}
	cout << s << "\n";

	return 0;
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define int long long int
/**
*
*ウサミン星からやってきたふなちです！
*
*あーひかないでくださいね。んんん。
*ウサミンパワーでめるへんちぇーんじ★★
*夢と希望を両耳にひっさげ、ふなち競プロ頑張っちゃいまーーす☆☆v☆☆
*
*/
using namespace std;

const int INF = 100010001000;

signed main()
{
    int ninjin,nana[100005],daisuki=0;
    cin >> ninjin;
    for(int j=0;j<ninjin;++j){
        cin >> nana[j];
    }
    for(int i=0;i<ninjin;++i){
        if(nana[i]>nana[nana[i]-1]&&(i+1)==nana[nana[i]-1])daisuki++;
    }
    cout << daisuki <<endl;
    return 0;
}


Measured memory_bytes: 1024
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from operator import xor
from functools import reduce

N,K,*A = map(int,read().split())

a = reduce(xor,(1<<a for a in A))

dp = 0 # bitset
for n in range(K):
    if not(dp&(1<<n)):
        dp |= (a<<n)

answer = 'First' if dp&(1<<K) else 'Second'
print(answer)

Measured memory_bytes: 3684
#include<bits/stdc++.h>
#define STDIO
#define MOD 1000000007
#define testbit(mask,i) (((mask)>>(i))&1)
#define setbit(mask,i) ((mask)|(1<<i))
#define delbit(mask,i) ((mask)^(1<<i))
#define lowbit(x) ((x)&(-x))
#define INF MOD
using namespace std;
int n;
long long a[420];
long long dp[420][420];
long long s[420];
int main(){
	#ifndef STDIO
		freopen("input.in","r",stdin);
		freopen("output.out","w",stdout);
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		s[i]=s[i-1]+a[i];
	}
	long long S,j;
	for(int l=1;l<n;l++){
		for(int i=1;i<=n-l;i++){
			j=i+l;
			S=s[j]-s[i-1];
			dp[i][j]=1e18;
			for(int k=i;k<j;k++){
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]);
			}
			dp[i][j]+=S;
		}
	}
	cout<<dp[1][n]<<endl;
	return 0;
}


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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}

int N;
char S[300000];

int main(){
  scanf("%d", &N);
  REP(N)cin>>S[i];
  int W = 0, E = 0;
  REP(N){
    if(S[i] == 'W')W++;
    else E++;
  }
  int ans = S[0] == 'E'?E-1:E;
  int prev = ans;
  REP(N-1){
    int tmp = prev;
    tmp+=S[i] == 'W'?1:0;
    tmp+=S[i+1] == 'E'?-1:0;
    prev = tmp;
    ans = min(ans, tmp);
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 512
#include<iostream>

using namespace std;


int main()
{
	int H, W;
	char Dot[102][103];

	cin >> H >> W;

	for (int i = 0; i < W + 2; i++) {
		Dot[0][i] = '#';
	}
	Dot[0][W + 2] = '\0';
	for (int i = 1; i < H + 1; i++) {
		Dot[i][0] = '#';
		for (int j = 1; j < W + 1; j++) {
			cin >> Dot[i][j];
		}
		Dot[i][W + 1] = '#';
		Dot[i][W + 2] = '\0';
	}
	for (int i = 0; i < W + 2; i++) {
		Dot[H + 1][i] = '#';
	}
	Dot[H + 1][W + 2] = '\0';
	for (int i = 0; i < H + 2; i++) {
		cout << Dot[i] << endl;
	}

	return 0;
}

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

int main() {
 string O,K,ans;
  cin>>O>>K;
  for(int i=0;i<O.size()+K.size();i++){
    if(i%2==0){
      ans+=O.at(i/2);
    }
    else{
      ans+=K.at(i/2);
    }
  }
  
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
  	n = n % 10;
  	if (n == 3) cout << "bon";
  	else if (n == 0 || n == 1 || n == 6 || n == 8) cout << "pon";
  	else cout << "hon";
}

Measured memory_bytes: 3596
n=int(input())
a1=list(map(int,input().split()))
a2=[0]+list(map(int,input().split()))
from itertools import accumulate
a1=list(accumulate(a1))
a2=list(accumulate(a2))
ans=0
for i in range(n):
  t=a1[i]+a2[-1]-a2[i]
  ans=max(ans,t)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
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; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    ll S,W;
    cin >> S >> W;
    if (S<=W) cout << "unsafe" << endl;
    else cout << "safe" << endl;

}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
#define int long long
const int mod=1e9+7;
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
map<int,int>d;
inline int solve(int x)
{
    if(d[x]!=0)return d[x];
    else return d[x]=((solve(x/2)+solve((x-1)/2)+solve((x-2)/2)))%mod;
}
signed main()
{
    d[0]=1;
    d[1]=2; 
    int n=read(); 
    int ans=solve(n);
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)

int main(){
 
 
  vector<vector<ll>>b(3,vector<ll>(3));
  rep(i,3){
      rep(l,3){
          cin>>b[i][l];
      }
  }
  
  ll n;
  cin>>n;
  
  rep(i,n){
      ll a;
      cin>>a;
       rep(l,3){
           rep(m,3){
               if(b[l][m]==a)b[l][m]=0;
           }
       }
  }
  
  rep(i,3){
      rep(m,3){
          if(b[i][m]!=0){
              break;
          }
          if(m==2){
              cout<<"Yes"<<endl;
              return 0;
          }
      }
  }
  
  rep(i,3){
      rep(m,3){
          if(b[m][i]!=0){
              break;
          }
          if(m==2){
              cout<<"Yes"<<endl;
              return 0;
          }
      }
  }
  
  rep(i,3){
          if(b[i][i]!=0){
              break;
          }
          if(i==2){
              cout<<"Yes"<<endl;
              return 0;
          }
  }
  
  for(ll i=2;0<=i;i--){
          if(b[2-i][i]!=0){
              break;
          }
          if(i==0){
              cout<<"Yes"<<endl;
              return 0;
          }
  }
  cout<<"No"<<endl;
}



Measured memory_bytes: 3576
def Q1(x):
    A, B = x[0], x[1]
    if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
        return 'Possible'
    else:
        return 'Impossible'

l = [int(i) for i in input().split()]
print(Q1(l))

Measured memory_bytes: 2940
using System;

namespace question2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, D;

            string[] str = Console.ReadLine().Split(' ');
            N= int.Parse(str[0]);
            D = int.Parse(str[1]);
            int temp = N / (2 * D + 1);
            if (N % (2 * D + 1) != 0) temp += 1;
            Console.WriteLine((temp).ToString());

            //Console.WriteLine("Hello World!");
            //Console.ReadLine();

        }
    }
}


Measured memory_bytes: 11092
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        if (k > n) {
            k = n;
        }

        List<Long> h = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            h.add(sc.nextLong());
        }

        h.sort(Long::compareTo);

        for (int i = 0; i < k; i++) {
            h.remove(h.size() - 1);
        }

        long result = 0;
        for (Long aLong : h) {
            result += aLong;
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 96164
# -*- coding: utf-8 -*-
a = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

N = a[0]
M = a[1]
K = a[2]

count = 0 #読んだ冊数を記録
count_time = 0 #読んだ時間を記録
a = [0]
b = [0]

for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break 
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
 


Measured memory_bytes: 47176
#include<iostream>
#include<algorithm>

using namespace std;

int main(void){
    int a,b,c;
    int high=0;
    
    cin>>a>>b;
    c=b-a;

    for(int i=0;i<c;i++){
        high+=i;
    }

    cout<<high-a<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef vector < long long > vll;
typedef pair < long long, long long > pll;
typedef pair < int, int > pii;
typedef vector < int > vii;

#define deb(x) cout << #x << " : " << x << endl
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,a,n) for(int i = a; i < n; i++)
#define rsz(x,n) x.clear(); x.resize(n)
#define rrsz(x,a,n) x.clear(); x.resize(n,a)
#define wt while(true)
#define all(x) x.begin(),x.end()
#define pb push_back
#define csl ios_base::sync_with_stdio(false); cin.tie(NULL)
#define s(n) cin >> n
#define ls(x) ((2*(x)) + 1)
#define rs(x) ((ls(x)) + 1)
#define md(a,b) ((b)+((a) - (b))/2)
#define INF (1e9 + 7)
#define test(testcase) for(int i = 0;i < testcase;i++)

ll t, u, v, n, k,testcase;
int main(){
    csl;
    cin >> t;

    int input[3][t];
    rep(i , t){
        rep(j , 3){
            cin >> input[j][i];
            //cout << input[j][i] << " ";
        }
        //cout << endl << endl;
    }

    int dp[3][t];

    rep(i , 3)
        rep(j , t)
            dp[i][j] = 0 ;

    rep (e , t){
        rep(i , 3){
            if (e == 0) {
                dp[i][e] = input[i][e];
                //deb(dp[i][e]);
                //deb(i);deb(e);
                continue;
            }
            rep(j , 3){
                if (i != j) {
                    dp[i][e] = max(dp[i][e] , dp[j][e-1] + input[i][e]);
                }
            }
        }
    }

    cout << max({dp[0][t-1],dp[1][t-1],dp[2][t-1]});
    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<map>
#define ll long long
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
using namespace std;

ll p[20];
int dx1[20],dx2[20];
vector<ll> v;
ll d,tim;

void dfs(ll s,ll e,vector<pair<ll,ll> > &w,ll val,ll cnt)
{
	if(s==e)
	{
		w.push_back(make_pair(val,cnt));
		return;
	}
	for(int i=-9;i<=9;i++)
		dfs(s+1,e,w,val+i*v[s],cnt*(s==0?dx2[i+10]:dx1[i+10]));
}

int solve(int l)
{
	v.clear();
	ll ans=0;
	for(int i=0;l-i-1>i;i++)
		v.push_back(p[l-i-1]-p[i]);
	//for(auto u:v)cout<<u<<endl;
	vector<pair<ll,ll> > v1,v2;
	dfs(0,(v.size()+1)/2,v1,0,1);
	dfs((v.size()+1)/2,v.size(),v2,0,1);
	//for(auto i:v1)cout<<i.first<<" "<<i.second<<endl;
	map<ll,ll> mp;
	for(auto i:v2)mp[i.first]+=i.second;
	for(auto i:v1)ans+=mp[i.first+d]*i.second;
	if(l%2)ans*=10;
	return ans;
}

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>d;
	p[0]=1;
	for(int i=1;i<20;i++)p[i]=p[i-1]*10;
	REP(i,10)REP(j,10)
		dx1[i-j+10]++;
	for(int i=1;i<10;i++)REP(j,10)
		dx2[i-j+10]++;
	ll ans=0;
	for(int i=2;i<=18;i++)ans+=solve(i);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 207028
#include <iostream>
#include <algorithm>
using namespace std;
int a[100];
int sum(int b){
    int n = 0,i;
    for(i = 0;i < b;i++){
        n += a[i];
    }
    return n;
}
int main(){
    int n,i,x;
    while(cin >> n){
        for(i = 0;i < n;i++){
            cin >> x;
            a[i] = x;
        }
        sort(a,a+n);
        for(i = 1;i < n;i++){
            a[i] += a[i-1];
        }
        cout << sum(n) << endl;
        
    }
}

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

int main(){
	int N;
	cin >> N;
	int nowX = 0, nowY = 0;
	int time = 0;
	bool JD = true;
	vector<int> T(N);
	vector<int> X(N);
	vector<int> Y(N);
	for(int i = 0; i < N; i++)cin >> T[i] >> X[i] >> Y[i];
	
	for(int i = 0; i < N; i++){
		int dis = abs(X[i] - nowX) + abs(Y[i] - nowY);
		int disT = abs(T[i] - time);
		if(disT >= dis && disT % 2 == dis % 2){
			nowX = X[i];
			nowY = Y[i];
			time = T[i];
		}else{
			JD = false;
			break;
		}
	}
	
	cout << ((JD)?"Yes":"No") << endl;
}


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

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a>=b)
        swap(a,b);
    if(c>=b)
        cout<<a<<" "<<b<<" "<<c<<endl;
    else if(c<=a)
        cout<<c<<" "<<a<<" "<<b<<endl;
    else
        cout<<a<<" "<<c<<" "<<b<<endl;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((ll)(x).size())

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const int INF = 1e9+10;
const ll mod = 998244353;
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; }
#define print(x) cerr << #x << " is " << x << endl;
//#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 
int N, M, X;
int A[15][15], C[15], B[15];
int main()
{
    cin >> N >> M >> X;
    
    rep(i, N){
        cin >> C[i];
        rep(j, M)cin >> A[i][j];
    }
    int ans = INF;
    for (int bit = 0; bit < (1 << N); bit++){
        int cost = 0;
        rep(j, M)B[j] = 0;
        
        rep(i, N){
            if (bit & (1 << i)){
                cost += C[i];
                rep(j, M)B[j] += A[i][j];
            }
        }
        rep(j, M){
            if (B[j] < X){
                goto end;
            }
        }
        //fprintf(stderr, "bit = %d, cost = %d\n", bit, cost);
        if (ans > cost){
            ans = cost;
        }
        end:
        ;
    }
    if (ans == INF){
        cout << -1;
    } else {
        cout << ans;
    }
    return 0;
}


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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int ans = 0;
  for (int i = 0; i <= A; i++) {
    for (int j = 0; j <= B; j++) {
      for (int k = 0; k <= C; k++) {
        int tmp = 500*i + 100*j + 50*k;
        if (X == tmp) ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll a[3], b[3];

ll func(ll x){
    if (a[0] % 2 || a[1] % 2 || a[2] % 2) return x;
    b[0] = (a[1] + a[2]) / 2;
    b[1] = (a[2] + a[0]) / 2;
    b[2] = (a[0] + a[1]) / 2;
    for (ll i = 0; i < 3; i++) a[i] = b[i];
    return func(x + 1);
}

int main(void){
    // Your code here!
    cin >> a[0] >> a[1] >> a[2];
    if (a[0] % 2 || a[1] % 2 || a[2] % 2) cout << 0 << endl;
    else if (a[0] == a[1] && a[1] == a[2]) cout << -1 << endl;
    else cout << func(0) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <numeric>
typedef long long int ll;
using namespace std;
int main(){
	vector <ll> data(5,0);

	ll N,count; 
	count=0;
	cin >> N;
	string s;
	for(int k=0;k<N;k++){
		cin>>s;
		if(s[0]=='M') data[0]++;
		if(s[0]=='A') data[1]++;
		if(s[0]=='R') data[2]++;
		if(s[0]=='C') data[3]++;
		if(s[0]=='H') data[4]++;
	}
	for(int i=0;i<3;i++){
		for(int j=i+1;j<4;j++){
			for(int l=j+1;l<5;l++){
				count+=data[i]*data[j]*data[l];
			}
		}
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256