akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N, X;
    cin >> N >> X;
    vi L(N);
    REP(i, N) cin >> L.at(i);

    int D = 0;
    int count = 1;
    REP(i, N) {
        D = D + L.at(i);
        if (D > X) break;
        count += 1;
    }
    print(count);
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
//const int MAX=;
const ll MOD=998244353;

ll factm[3000010];
void fact_init(ll mod){
  int k=3e6+10;
  factm[0]=1;
  rep1(i,k)factm[i]=(factm[i-1]*i)%mod;
}
template<typename T>
T extgcd(T a,T b,T& x, T& y){
	T d=a;
	if(b!=0){
		d = extgcd(b, a%b, y, x);
		y -= (a/b) * x;
	}
	else{
		x = 1; y = 0;
	}
	return d;
}
template<typename T>
T mod_inv(T a,T m){
	T x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}
ll comb(int n, int r, ll mod){
  if(n<r)return 0;
  ll tmp=(factm[n]*mod_inv(factm[r],mod))%mod;
  tmp=(tmp*mod_inv(factm[n-r], mod))%mod;
  return tmp;
}

ll mim(ll a, ll b){
  return (a-b+MOD)%MOD;
}

int N,M;
void input(){
  cin>>N>>M;
  fact_init(MOD);
}

ll ans;

void solve(){
  ans=comb(3*M+N-1, N-1, MOD);
  rep(k,M){
    ll tmp=(N*comb(k+N-2, N-2, MOD))%MOD;
    ans=mim(ans, tmp);
  }
  for(int k=M+1; k<=3*M; k++){
    if((3*M-k)%2)continue;
    ll ev=(3*M-k)/2;
    ll tmp=(comb(N, k, MOD)*comb(ev+N-1, ev, MOD))%MOD;
    ans=mim(ans, tmp);
  }
}

void output(){
  cout<<ans;
}

int main(){
  input();
  solve();
  output();
}

Measured memory_bytes: 23808
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int abc [] = new int [3];
        for(int i=0; i<3; i++){
            abc[i] = sc.nextInt();
        }
        Arrays.sort(abc);
        System.out.println(abc[0]+abc[1]);
    }
}

Measured memory_bytes: 21844
#include<stdio.h>

int s[11];
int top=0;


void push(int x){
  top++;
  s[top]=x;
}
int pop(){
  top--;
  return s[top+1];
}

int main(){
  int y,a;
  while(scanf("%d",&y)!=EOF){
    if(y==0){
      a=pop();
    printf("%d\n",a);
    }else{
      push(y);
    }
  }
  return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int mat[100][100];
int combinat(int m, int n) {
    int i, j;
    if(n == 0 || m == n)
        return 1;
    for(j = 0; j <= n; j++) { // 只要计算n列就行了，不用计算后面的
        mat[j][j] = 1;
        for(i = j+1; i <= m; i++) {
            if(j == 0)
                mat[i][j] = 1;
            else
                mat[i][j] = mat[i-1][j-1] + mat[i-1][j];
        } // 计算Cmn
    }
    return mat[m][n];
}
int main(){
	int n,m;
	cin>>n>>m;//n个偶数  m个奇数 
	int sum=0;
	int num1=0,num2=0;
	if(n>=2){
		memset(mat,0,sizeof(mat));
		num1=combinat(n,2);
	}
	if(m>=2){
		memset(mat,0,sizeof(mat));
		num2=combinat(m,2); 
	}
	cout<<num1+num2<<endl;
	return 0;
} 

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

int main() {
  
  vector<int> num(10);
  for(int i = 0;i < 4;i++) {
    int n;
    cin >> n;
    num.at(n)++;
  }

  if(num.at(1)&&num.at(9)&&num.at(7)&&num.at(4)) cout << "YES" << endl;
  else cout << "NO" << endl;

}



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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> h(n+1);
    h[0] = INF;
    for(int i = 1; i <= n; ++i){
        cin >> h[i];
    }
    vector<int> cnt(n+1);
    for(int i = 1; i <= n; ++i){
        if(h[i-1] >= h[i]) cnt[i] = cnt[i-1] + 1;
        else cnt[i] = 1;
    }
    cout << *max_element(begin(cnt), end(cnt)) - 1 << "\n";
    return 0;
}

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

using namespace std;

typedef long long Int;

const int INF = 1001001001;

int N, M;
int val[100000];
vector<int> other;

bool ok(int T)
{
    int dp[200000];
    
    fill(dp, dp + 200000, INF);
    
    for (int i = 0; i < N; i++){
        dp[i] = (~val[i] ? (val[i] >= T ? 0 : INF) : 1);
    }
    
    int ct = 0;
    for (int i = 0;; i++){
        dp[i + N] = min(min(dp[i * 3] + dp[i * 3 + 1],
                            dp[i * 3] + dp[i * 3 + 2]),
                        dp[i * 3 + 1] + dp[i * 3 + 2]);
        dp[i + N] = min(dp[i + N], INF);
        ct = dp[i + N];
        if (i * 3 + 3 == i + N) break;
    }
    
    int ct2 = 0;
    
    for (int i = 0; i < other.size(); i++){
        ct2 += other[i] >= T;
    }
    
    return (ct <= ct2);
}

int main()
{
    scanf("%d %d", &N, &M);
    
    memset(val, -1, sizeof(val));
    
    for (int i = 0; i < M; i++){
        int x, y;
        scanf("%d %d", &x, &y);
        val[--y] = x;
    }
    
    for (int i = 0; i < N - M; i++){
        int x;
        scanf("%d", &x);
        other.push_back(x);
    }
    
    int l = 1, r = 1000000000;
    
    while (l != r){
        int mid = (l + r + 1) >> 1;
        
        if (ok(mid)) l = mid;
        else r = mid - 1;
    }
    
    printf("%d\n", l);
    
    return (0);
}

Measured memory_bytes: 2716
#include<bits/stdc++.h>
using namespace std;
bool r[1000001];
int main(){
	int k,dig=1;
	cin>>k;
	int re=7%k;
	if(k%2==0 || k%5==0){
		cout<<-1<<endl;
		return 0;
	}
	while(!r[re]){
		if(re==0){
			cout<<dig<<endl;
			return 0;
		} 
		r[re]=true;
		re=(re*10+7)%k;
		dig++;
	}
	cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 4492
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] height = new int[N];
        for (int i = 0; i < N; i++) {
            height[i] = scan.nextInt();
        }
        int answer = 0;
        int max = 0;
        for (int i = 0; i < N; i++) {
            if (max <= height[i]) {
                answer += 1;
            }
            max = Math.max(max, height[i]);
        }
        System.out.println(answer);
    }
}


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

inline void fastRead_int(int &x) {
    register int c = getchar_unlocked();
    x = 0;
    int neg = 0;

    for(; ((c<48 || c>57) && c != '-'); c = getchar_unlocked());

    if(c=='-') {
      neg = 1;
      c = getchar_unlocked();
    }

    for(; c>47 && c<58 ; c = getchar_unlocked()) {
      x = (x<<1) + (x<<3) + c - 48;
    }

    if(neg)
      x = -x;
}

int recurse(int u, vector<bool> &vis, vector< vector<int> > &edges, vector<int> &lp){
	if(edges[u].size() == 0){
		lp[u] = 0;
		vis[u] = true;
	}
	else {
		for (int i = 0; i < edges[u].size(); ++i) {
			if(!vis[edges[u][i]]) lp[u] = max(lp[u], 1 + recurse(edges[u][i], vis, edges, lp));
			else {
				lp[u] = max(lp[u], 1 + lp[edges[u][i]]);
			}
			vis[edges[u][i]] = true;
		}
	}
	return lp[u];
}

int main(){

	int n, m, x, y;
	fastRead_int(n);
	fastRead_int(m);

	vector< vector<int> > edges(n);

	for (int i = 0; i < m; ++i)	{
		fastRead_int(x); fastRead_int(y);

		edges[x-1].push_back(y-1);
	}

	vector<bool> vis(n, false);
	vector<int> lp(n, 0);

	for (int i = 0; i < n; ++i)	{
		recurse(i, vis, edges, lp);
	}

	int ans = -1;
	for (int i = 0; i < n; ++i)	{
		ans = max(ans, lp[i]);
	}
	
	printf("%d\n", ans);
	
	return 0;
}

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

using namespace std;

const int maxn = 10005;
int n, p, d, q;
typedef pair<int, int> pii;
vector<pii> G[maxn];
typedef long long ll;

const double h = 380000.0;
double a, ans;
string s;
int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a >> s;
        if (s[0] == 'B')
            a *= h;
        ans += a;
    }
    printf("%.8f\n",ans);
    return 0;
}

Measured memory_bytes: 512
N, X = map(int, input().split())
B = [1]
P = [1]

for i in range(N):
    B.append(2 * B[i] + 3)
    P.append(2 * P[i] + 1)

    
def f(N, X):
    if N == 0:
        if X <= 0:
            return 0
        else:
            return 1
    elif X <= 1 + B[N - 1]:
        return f(N - 1, X - 1)
    else:
        return P[N - 1] + 1 + f(N - 1, X - 2 - B[N - 1])

print(f(N, X))

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n,m,ans=0;
	cin >> n >> m;
	vll v(n+1);
	rep(i,m){
		ll l,r;
		cin >> l >> r;
		v[l]++;
		v[r+1]--;
	}
	rep(i,n) v[i+1]+=v[i];
	for(auto&& e:v){
		if(e==m) ans++;
	}
	cout << ans << endl;
	return 0;
}


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

const int maxn = 2e5 + 10;

int ans, n, rr, rb, dr[maxn], db[maxn], q[maxn], par[maxn], fnt, rar;
bool f[maxn];
std::vector<int> gr[maxn], gb[maxn];

int main() {
	scanf("%d%d%d", &n, &rr, &rb);
	for (int i = 1; i < n; ++i) {
		int u, v;
		scanf("%d%d", &u, &v);
		gr[u].push_back(v);
		gr[v].push_back(u);
	}
	for (int i = 1; i < n; ++i) {
		int u, v;
		scanf("%d%d", &u, &v);
		gb[u].push_back(v);
		gb[v].push_back(u);
	}
	memset(db, -1, sizeof db);
	fnt = rar = 0;
	db[q[rar++] = rb] = 0;
	while(fnt != rar) {
		int u = q[fnt++];
		for (int &v: gb[u]) {
			if(!~db[v]) {
				par[v]= u;
				db[q[rar++] = v] = db[u] + 1;
			}
		}
	}
	for (int u = 1; u <= n; ++u) {
		for (int i = 0; i < (int) gr[u].size(); ++i) {
			int v = gr[u][i];
			if(v == par[u] || u == par[v] || v == par[par[u]] || u == par[par[v]] || par[u] == par[v]) {
			}
			else {
				f[u] = 1;
				break;
			}
		}
	}
	memset(dr, -1, sizeof dr);
	fnt = rar = 0;
	dr[q[rar++] = rr] = 0;
	while(fnt != rar) {
		int u = q[fnt++];
		for (int &v: gr[u]) {
			if(!~dr[v] && dr[u] + 1 < db[v]) {
				dr[q[rar++] = v] = dr[u] + 1;
			}
		}
	}
	for (int u = 1; u <= n; ++u) {
		if(~dr[u]) {
			if(dr[u] < db[u] && f[u]) {
				puts("-1");
				return 0;
			}
			ans = std::max(ans, db[u]);
		}
	}
	printf("%d\n", ans << 1);
	return 0;
}

Measured memory_bytes: 26868
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    string S,S2;
    lint K;
    cin >> S >> K;
    S2=S;
    lint L=S.length();
    lint ans=0,count=0;
    int check=0;
    bool erase[L]={};
    if(L==1) ans=K/2;
    else if(L==2){
        if(S[0]==S[1]) ans=K;
    }
    else{
        lint ans1=0,ans2=0,ans3=0,ans4=0;
        for(int i=1;i<L;i++){
            if(S[i]==S[i-1]) ans1++,S[i]='0',i++;
        }
        if(K>=2){
            S+=S2;
            for(int i=L;i<2*L;i++){
                if(S[i]==S[i-1]) ans2++,S[i]='0',i++;
            }
        }
        if(K>=3){
            S+=S2;
            for(int i=2*L;i<3*L;i++){
                if(S[i]==S[i-1]) ans3++,S[i]='0',i++;
            }
        }
        if(K>=4){
            S+=S2;
            for(int i=3*L;i<4*L;i++){
                if(S[i]==S[i-1]) ans4++,S[i]='0',i++;
            }
        }
        ans=ans1;
        if(K>=2) ans+=ans2;
        if(K>=3) ans+=ans3;
        if(K>=4) ans+=ans4;
        if(K>=5){
            K-=4;
            ans+=ans3*((K+1)/2)+ans4*(K/2);
        }
    }
    cout << ans << endl;
}


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

using TEdge = std::pair<int, int>;
using TGraph = std::vector<std::vector<TEdge>>;

TGraph Graph;
std::vector<int> rslColors;

void paint(int v, int parent, int color){
    rslColors[v] = color;
    for(auto Edge : Graph[v]){
        if(Edge.first == parent)continue;
        if(Edge.second == 1) paint(Edge.first, v, 1-color);
        else paint(Edge.first, v, color); 
    }
}

int main(void){
    int N;
    
    std::cin >> N;
    Graph.assign(N, std::vector<TEdge>());
    for(int i=0; i<N-1; i++){
        int u, v, w;
        std::cin >> u >> v >> w;
        w=w%2;
        u--;
        v--;
        Graph[u].push_back(TEdge(v,w));
        Graph[v].push_back(TEdge(u,w));
    }

    rslColors.assign(N, -1);
    paint(0, -1, 0);
    for(auto color : rslColors)std::cout << color << std::endl;
}

Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    int n;
    cin>>n;
    vll a(n);
    cin >> a;
    sort(a.begin(),a.end());
    unordered_set<int> se;
    int ans = n;

    REP(i, n) {
        if (i <= n - 2 && a[i] == a[i+1]){
            int val = a[i];
            while (i <= n - 1 && val == a[i]){
                --ans;
                ++i;
            }
            --i;
            if (se.find(a[i]) == se.end()) {
                ll now = a[i];
                while (now <= 1000000) {
                    se.insert(now);
                    now += a[i];
                }
            }
            continue;
        }
        if (se.find(a[i]) != se.end()){
            --ans;
        } else {
            ll now = a[i];
            while (now <= 1000000){
                se.insert(now);
                now += a[i];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 44264
#include<bits/stdc++.h>
#define x first
#define y second
#define size(a) (ll)(a).size()

typedef long long ll;
typedef long double ld;

using namespace std;
int n;
string s;


int main()
{
    //ifstream cin("input.txt");
    //ofstream cout("output.txt");


    cin.tie(0);
    ios_base::sync_with_stdio(0);

    cin >> n >> s;

    if (n >= 3200)
    {
        cout << s << "\n";
    }
    else
    {
        cout << "red\n";
    }

}


Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define ll long long int
#define sp ' '
#define intmax 2147483647
#define intmin -2147483647
#define llmax 9223372036854775807
using namespace std;

int n;
int t, x, y;
int t2, x2, y2;

int main(){
	cin >> n;
	t = x = y = 0;
	lp(n) {
		cin >> t2 >> x2 >> y2;
//		cout << (abs(x2 - x) + abs(y2 - y)) << sp << t2 - t << endl;
		if (abs(x2 - x) + abs(y2 - y) > t2 - t || (abs(x2 - x) + abs(y2 - y)) % 2 != (t2 - t) % 2) {
			cout << "No" << endl;
			return 0;
		}
		t = t2;
		x = x2;
		y = y2;
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {
    public static void main(String []args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int x=Integer.parseInt(st.nextToken());
        int n=Integer.parseInt(st.nextToken());
        HashSet<Integer> num = new HashSet<>();
        int c=1;
        int temp1=x;
        int temp2=x;
        if(n==0){
            System.out.println(x);
        }
        else {
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            }
            for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            }

        }
    }
}


Measured memory_bytes: 25372
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct aaa{
	ll x,y,op;
}a[200010];
ll t1,n,m,sz,flag,fa[200010];
ll find(ll x){
	if(x==fa[x])return x;
	return fa[x]=find(fa[x]);
}
int main(){
	ll i,x,y,mn,mx;
	scanf("%lld%lld%lld",&n,&m,&t1);
	sz=n;
	for(i=1;i<=n;i++)fa[i]=i;
	for(i=1;i<=t1;i++){
		scanf("%lld%lld%lld",&a[i].x,&a[i].y,&a[i].op);
		a[i].x++;a[i].y++;
		if(a[i].op==0){
			x=find(a[i].x);y=find(a[i].y);
			if(x!=y){
				fa[x]=y;sz--;
			}
		}
	}
	for(i=1;i<=t1;i++)if(a[i].op==1&&find(a[i].x)==find(a[i].y))return puts("No"),0;
	for(i=1;i<=t1;i++)if(a[i].op)flag=1;
	if(!flag)mn=sz-1;
	 else mn=sz;
	mx=sz*(sz-1)/2;
	if(flag&&sz<=2)return puts("No"),0;
	m=m-(n-sz);
	if(mn<=m&&m<=mx)puts("Yes");
	 else puts("No");
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
const int N = 1e5;  // limit for array size
ll n;  // array size

/*template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
*/
int main(){
	string s,t;cin>>s>>t;
	
	ll a[s.length()+20][30];
	
	for(int i=0;i<s.length()+20;i++){
		for(int j=0;j<26;j++){
			a[i][j]=1e18;
		}
	}
	
	for(int i=s.length()-2;i>=0;i--){
		for(int j=0;j<26;j++){
			if(s[i+1]-'a'==j){
				a[i][j]=i+1;
			}
			else{
				a[i][j]=a[i+1][j];
			}
		}
	}
	
	ll first[26]={};
	for(int i=0;i<26;i++){
		first[i]=1e18;
	}
	
	for(int i=0;i<s.length();i++){
		first[s[i]-'a']=i;
	}
	
	ll index=0;
	ll ans=s.length();
	int g=1;
	
	for(int i=0;i<t.length();){
		//cout<<index<<endl;
		if(first[t[i]-'a']==1e18){
			cout<<-1<<endl;return 0;
		}
		
		if(index==0&&s[0]==t[i]&&g){
			g=0;
			if(i==t.length()-1){
				ans-=(s.length()-(index+1));
			}
			i++;
		}
		
		if(a[index][t[i]-'a']<1e18){
			index=a[index][t[i]-'a'];
			if(i==t.length()-1){
				ans-=(s.length()-(index+1));
			}
			i++;
		}
		else{
			ans+=s.length();
			index=0;g=1;
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

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

int mod = 1000000007;
int64_t large = 9223372036854775807;

int main()
{
    string S, T;
    cin >> S >> T;
    bool x = true;
    for (int i = 0; i < S.size(); i++)
        if (S[i] != T[i])
            x = false;
    cout << (x ? "Yes" : "No");
}

Measured memory_bytes: 3624
import itertools

n=int(input())
xy=[list(map(int,input().split())) for i in range(n)]
lst=[i for i in range(n)]
ans=0
for h in itertools.permutations(lst):
    num=0
    for i in range(1,n):
        w=h[i-1]
        z=h[i]
        num+=((xy[w][0]-xy[z][0])**2+(xy[w][1]-xy[z][1])**2)**0.5
    ans+=num
k=1
for i in range(1,n+1):
    k*=i
print(ans/k)

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int count = 0;
  for (int i = 1; i <= c; i++) {
    if (i > b) break;
    if (c % i == 0 && i >= a) {
      count++;
    }
  }
  cout << count << endl;
}



Measured memory_bytes: 3088
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

const long long INF = 1e9;
int v[123456], w[123456];
long long ans[123456];
int N, W, sum = 0;

int main(int argc, char *argv[])
{
  cin >> N >> W;
  std::fill(ans, ans + 100002, INF);
  for (int i = 0; i < N; i++) {
    cin >> w[i] >> v[i];
    sum += v[i];
  }

  ans[0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = sum; j >= v[i]; j--) {
      ans[j] = min(ans[j], ans[j-v[i]] + w[i]);
    }
  }

  long long ret = -1;
  for (int i = sum; i >= 0; --i) {
    if(ans[i] <= W) {
      ret = i;
      break;
    }
  }

  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 1024
while True:
    a,b,c=input().split()
    a,c=int(a),int(c)
    if b=='?':
        break
    elif b=='+':
        print(a+c)
    elif b=='-':
        print(a-c)
    elif b=='*':
        print(a*c)
    else:
        print(a//c)


Measured memory_bytes: 5600
my_max :: Ord a => [a]->a

my_max [x] = x
my_max (x:xs) = 
  if x > tmp_max then
    x
  else
    tmp_max

  where
    tmp_max = my_max xs

my_min :: Ord a => [a]->a

my_min [x] = x
my_min (x:xs) = 
  if x < tmp_min then
    x
  else
    tmp_min

  where
    tmp_min = my_min(xs)

my_sum :: Num a => [a]->a

my_sum [x] = x
my_sum (x:xs) = 
  x + my_sum xs

main = do
  n <- getLine
  str_list <- getLine
  let list = map (read :: String->Int) $ words str_list

  let max_list = my_max list
  let min_list = my_min list
  let sum_list = my_sum list

  putStr $ show min_list
  putChar ' '
  putStr $ show max_list
  putChar ' '
  putStrLn $ show sum_list

Measured memory_bytes: 9188
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scanf("%d %d %d %d", &a, &b, &c, &d)
	fmt.Printf("%s\n", battle(a, b, c, d))
}

func battle(a, b, c, d int) string {
	c = c - b
	if c <= 0 {
		return "Yes"
	}

	a = a - d
	if a <= 0 {
		return "No"
	}

	return battle(a, b, c, d)
}


Measured memory_bytes: 1852
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()

    is_ok = False
    for i in range(N // 7 + 1):
        if (N - 7 * i) % 4 == 0:
            is_ok = True

    if is_ok:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10052
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    string s;
    R(s);
    int an=1e9;
    REP(i,2){
        int cnt=0;
        REP(j,SZ(s)){
            if(((s[j]-'0')^j)%2!=i)cnt++;
        }
        an=min(an,cnt);
    }
    W(an);
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, ll> pcl;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    long double X, i, j, i2, j2;
    cin >> X;

    for(i = 0; i <= 1000; i++) {
        for(j = 0; j <= 1000; j++) {
            i2 = (-1) * i;
            j2 = (-1) * j;
            if((pow(i, 5) - pow(j, 5)) == X) {
                cout << (ll)i << " " << (ll)j << endl;
                exit(0);
            } else if((pow(i, 5) - pow(j2, 5)) == X) {
                cout << (ll)i << " " << (ll)j2 << endl;
                exit(0);
            } else if((pow(i2, 5) - pow(j, 5)) == X) {
                cout << (ll)i2 << " " << (ll)j << endl;
                exit(0);
            } else if((pow(i2, 5) - pow(j2, 5)) == X) {
                cout << (ll)i2 << " " << (ll)j2 << endl;
                exit(0);
            }
        }
    }


    return 0;
}

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

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

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

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<int> s(n);
	vector<vector<bool>> dp(n+1,vector<bool>(20000,false));
	rep(i,n){
		cin>>s[i];
	}
	dp[0][0]=true;
	rep(i,n)rep(j,20000){
		dp[i+1][j]=dp[i+1][j]|dp[i][j];
		dp[i+1][j+s[i]]=dp[i+1][j+s[i]]|dp[i][j];
	}
	int ans;
	rep(j,20000){
		if(j%10==0) continue;
		if(dp[n][j]){
			ans=j;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 512
n = int(input())
links = [ set() for _ in range(n) ]
ans = [ -1 for _ in range(n) ]
for _ in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    links[u].add( (v,w) )
    links[v].add( (u,w) )

que = [ (0, 0, -1) ]
while que:
    v, d, p = que.pop()
    if d%2 == 0:
        ans[v] = 0
    else:
        ans[v] = 1
    for u,w in links[v]:
        if u==p:
            continue
        que.append( (u, d+w, v) )

print( '\n'.join(map(str, ans))  )

Measured memory_bytes: 56020
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPC(i, a) REP(i, 0, a)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)
#define RREPC(i, a) RREP(i, a, 0)
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr int I_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

static map<type_index, const char *const> scanType = {{typeid(int), "%d"},
                                                      {typeid(ll), "%lld"},
                                                      {typeid(double), "%lf"},
                                                      {typeid(char), "%c"}};

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
  // INFILE();
	auto b = scan('g');
	ll gCount = b.count();
	ll pCount = b.size() - gCount;

	if (gCount == pCount) {
		cout << "0\n";
		return 0;
	}

	if (pCount > gCount) {
		cout << pCount - gCount << "\n";
		return 0;
	}

	cout << (gCount - pCount) / 2 << "\n";
  return 0;
}

template <class T> static void scan(vector<T> &v) {
  auto tFormat = scanType[typeid(T)];
  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

static boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 512
N = int(input())
H = list(map(int, input().split()))

cn = 1
L = []

for i in range(N):
    if i == 0:
        L.append(H[i])
    else:
        if max(L) <= H[i]:
            cn = cn + 1
            L.append(H[i])

print(cn)

Measured memory_bytes: 61608
'use strict';
(function(stdin) {
  var lines  = stdin.toString().split('\n');
  var param = lines[0].split(' ').map(Number);
  var result = (function(a,b) {
  	return [
  		~~(a / b)
  		,(a % b)
  		,(a / b).toFixed(5)
  	].join(' ');
  }(param[0],param[1]
  ));
  console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7648
#include <stdio.h>

int min(int a, int b) {
    if (a < b) { return a;
    } else { return b; }
}

int main() {
    int x, y, z, e, ans;

    while (1) {
        scanf("%d", &e);
        if (!e) { break; }

        ans = e;
        for (z = 0; z <= 101; z++) {
            for (y = 0; y <= 1001; y++) {
                x = e - y*y - z*z*z;
                if (0 <= x && x <= 100000) {
                    ans = min(ans, x+y+z);
                }
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int dp[1000010][2];
int main(){
	int ans = 0;
	string s;
	cin >> s;
	int i,n = s.size();
	for(i=0;i<=n;i++){
		dp[i][0] = 200000000;
		dp[i][1] = 200000000;
	}
	dp[0][0] = 0;
	for(i=1;i<=n;i++){
		dp[i][0] = min(dp[i - 1][1] + (s[i - 1] - '0'),dp[i - 1][0] + (s[i - 1] - '0'));
		dp[i][1] = min(dp[i - 1][1] + 9 - (s[i - 1] - '0'),dp[i - 1][0] + 11 - (s[i - 1] - '0'));
	}
	cout << min(dp[n][0],dp[n][1]) << endl;
}

Measured memory_bytes: 9220
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    string s;
    cin>>s;
    int q; cin>>q;
    string t, u;
    bool rev=0;
    while(q--){
        int p; cin>>p;
        if(p==1){
            rev^=1;
        }else{
            int f; char c;
            cin>>f>>c;
            f--;
            if(rev^f) u+=c;
            else t+=c;
        }
    }
    reverse(t.begin(), t.end());
    string ans=t+s+u;
    if(rev)reverse(ans.begin(), ans.end());
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1348
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
using ll = long long;
const ll MOD = 1000000007;

int main() {
	int A[3][3], C[3][3];
	for (int i = 0;i < 3;i++)for (int j = 0;j < 3;j++) {
		cin >> A[i][j];C[i][j] = 0;
	}
	int N, B;
	cin >> N;
	for (int i = 0;i < N;i++) {
		cin >> B;
		for (int j = 0;j < 3;j++) {
			for (int k = 0;k < 3;k++) {
				if (A[j][k] == B) C[j][k] = 1;
			}
		}
	}
	bool ans = (C[0][0] && C[1][1] && C[2][2]);
	for (int i = 0;i < 3;i++) {
		if (C[i][0] && C[i][1] && C[i][2]) {
			ans = 1;
		}
		if (C[0][i] && C[1][i] && C[2][i]) {
			ans = 1;
		}
	}
	if (C[2][0] && C[1][1] && C[0][2])ans = 1;

	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string result = "";
            for (long i = 1; i<=S.Length; i++) 
            {
                result += "x";
            }
            Console.WriteLine(result);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

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

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define vi vector<int>
using namespace std;

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

int main(){
    string s;
    cin>>s;
    if(s.size()%2){
        cout<<"No\n";
    }else{
        for(int i=0;i<s.size();i+=2){
            if(s[i]=='h' && s[i+1]=='i') continue;
            else {
                cout<<"No\n";
                return 0;
            }
        }
        cout<<"Yes\n";
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    static BufferedReader in;

    public static void solve() throws IOException {
        Integer[] nums = nextArray(2);
        Integer[] h = nextArray(nums[0]);

        int n = nums[0];
        int k = nums[1];

        int[] dp = new int[n];

        dp[0] = 0;

        for (int i = 1; i < n; i++) {
            dp[i] = Integer.MAX_VALUE ;
            for(int j = 1;j<=k && (i-j)>=0;j++){
//                System.out.println("i ran guys");
                dp[i] = Math.min(dp[i-j]+calc(h,i,i-j),dp[i]);
            }
//            System.out.println(dp[i]);
        }

//        System.out.println(Arrays.toString(dp));


        System.out.println(dp[n-1]);




    }

    static int calc(Integer[] arr , int i, int j){
        return Math.abs(arr[i] - arr[j]);
    }

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

    static int nextInt() throws IOException {
        return Integer.parseInt(in.readLine().trim());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(in.readLine().trim());
    }

    static Integer[] nextArray(int n) throws IOException {
        StringTokenizer st = new StringTokenizer(in.readLine());
        Integer[] tmp = new Integer[n];
        for (int i = 0; i < tmp.length; i++) {
            tmp[i] = Integer.parseInt(st.nextToken());
        }

        return tmp;
    }

}



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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<double> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    for (int i = 0; i < n; i++) {
        vector<double> mon;
        for (int j = 0; j < n; j++) {
            if (i != j) {
                mon.push_back(atan2(y[j] - y[i], x[j] - x[i]));
            }
        }
        sort(mon.begin(), mon.end());
        double mx = 0;
        for (int j = 0; j < n-2; j++) {
            mx = max(mx, mon[j+1] - mon[j]);
        }
        mx = max(mx, mon[0] + 2 * acos(-1.0) - mon[n-2]);
        double ans = (mx > acos(-1.0) ? (mx - acos(-1.0)) / (2 * acos(-1.0)) : 0.0);
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

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

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

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

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

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

ll cnt[1 << 17];
void solve() {
	int n; cin >> n;
	vector<int> a(n); rep(i, n)cin >> a[i];
	ll sum = 0;
	rep(i, n) {
		cnt[a[i]]++;
		sum += a[i];
	}
	int q; cin >> q;
	rep(i, q) {
		int x, y; cin >> x >>y;
		sum -= cnt[x] * x;
		sum += cnt[x] * y;
		cnt[y] += cnt[x];
		cnt[x] = 0;
		cout << sum << "\n";
	}
}


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


Measured memory_bytes: 20816
from collections import deque

N, A, B, C = map(int, input().split())
lll = [int(input()) for _ in range(N)]

stack = deque()
init_data = (0, [])
stack.append(init_data)

mp_results = []


def dfs():
    depth, curr_path = stack.pop()
    if depth == N:
        filter_a = 'A' not in curr_path
        filter_b = 'B' not in curr_path
        filter_c = 'C' not in curr_path
        if filter_a or filter_b or filter_c:
            return
        a_combi = []
        b_combi = []
        c_combi = []
        for idx, history in enumerate(curr_path):
            if history == 'A':
                a_combi.append(lll[idx])
            elif history == 'B':
                b_combi.append(lll[idx])
            elif history == 'C':
                c_combi.append(lll[idx])
        n_concat = len(a_combi)-1 + len(b_combi)-1 + len(c_combi)-1
        mp_used_for_concat = n_concat * 10
        mp_used_for_ext_shr = \
            abs(A-sum(a_combi)) + abs(B-sum(b_combi)) + abs(C-sum(c_combi))

        mp_results.append(mp_used_for_concat + mp_used_for_ext_shr)
    else:
        depth += 1
        stack.append((depth, curr_path + ['A']))
        stack.append((depth, curr_path + ['B']))
        stack.append((depth, curr_path + ['C']))
        stack.append((depth, curr_path + ['O']))


while stack:
    dfs()

print(min(mp_results))


Measured memory_bytes: 5288
A,B,K=map(int, input().split())
L = []
for i in range(min(K,(B-A+2)//2)):
  L.append(A+i)
for i in range(min(K,(B-A+2)//2)):
  L.append(B-i)
L = sorted(list(set(L)))
for i in L:
  print(i)


Measured memory_bytes: 3060
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    String s = sc.next();
    int len = s.length();
    if(len <= k){
      System.out.println(s);
    }else{
      s = s.substring(0,k);
      System.out.println(s + "...");
    }
  }
}


Measured memory_bytes: 38652