akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <set>
#include <vector>

const int MAX = 100005;

int n;
int P[MAX];
int I[MAX];
int L[MAX];
int R[MAX];
std::vector<int> LV[MAX];
std::vector<int> RV[MAX];
int LL[MAX];
int RR[MAX];

class Q
{
public:
    int push(int p)
    {
        while (!q.empty() && *q.begin() < p) q.erase(q.begin());
        q.insert(p);
        return check(p);
    }
    int check(int p)
    {
        auto it = q.upper_bound(p);
        if (it == q.end()) return n+1;
        else return *it;
    }
    void clear()
    {
        q.clear();
    }
private:
    std::set<int> q;
};

int64_t r(int l, int r)
{
    if (l > r) return 0;
    else return r-l+1;
}

int main()
{
    std::ios_base::sync_with_stdio(0);
    std::cin >> n;
    for (int i=1;i<=n;++i) std::cin >> P[i];
    for (int i=1;i<=n;++i) I[P[i]] = i;
    I[n+1] = n+1;
    P[n+1] = n+1;
    Q q;
    for (int i=n;i>0;--i)
    {
        R[i] = I[q.push(P[i])];
        RV[R[i]].push_back(i);
    }
    q.clear();
    for (int i=n+1;i>0;--i)
    {
        for (int j : RV[i]) RR[j] = I[q.check(P[j])];
        q.push(P[i]);
    }
    I[n+1] = 0;
    q.clear();
    for (int i=1;i<=n;++i)
    {
        L[i] = I[q.push(P[i])];
        LV[L[i]].push_back(i);
    }
    q.clear();
    for (int i=0;i<=n;++i)
    {
        for (int j : LV[i]) LL[j] = I[q.check(P[j])];
        q.push(P[i]);
    }
    int64_t sum = 0;
    // for (int i=1;i<=n;++i) std::clog << (i > 1 ? " " : "") << L[i]; std::clog << std::endl;
    // for (int i=1;i<=n;++i) std::clog << (i > 1 ? " " : "") << R[i]; std::clog << std::endl;
    // for (int i=1;i<=n;++i) std::clog << (i > 1 ? " " : "") << LL[i]; std::clog << std::endl;
    // for (int i=1;i<=n;++i) std::clog << (i > 1 ? " " : "") << RR[i]; std::clog << std::endl;
    for (int i=1;i<=n;++i)
    {
        // std::clog << P[i] << " (" << r(LL[i]+1, L[i]) << " " << r(i, R[i]-1) << ")" << std::endl;
        // std::clog << P[i] << " (" << r(R[i], RR[i]-1) << " " << r(L[i]+1, i) << ")" << std::endl;
        sum += P[i] * r(LL[i]+1, L[i]) * r(i, R[i]-1);
        sum += P[i] * r(R[i], RR[i]-1) * r(L[i]+1, i);
    }
    std::cout << sum << std::endl;
    return 0;
}

Measured memory_bytes: 16888
import sys
N,M = [int(x) for x in input().split()]
X = [int(x) for x in input().split()]
if N >= M:
    print(0)
    sys.exit()
X = sorted(X)
dis = [0 for x in range(M-1)]
for i in range(M-1):
    dis[i] = X[i+1] - X[i]
dis.sort()
dis.reverse()
for i in range(N-1):
    dis[i] = 0
print(sum(dis))


Measured memory_bytes: 19780
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int N;cin>>N;
    int ans=0,tmp=0;
    int pos=-1;
    vector<int> m(N+1,0);
    REP(i,N)cin>>m[i];
    sort(m.begin(),m.end());
    REP(i,N+1){
        if(m[i]!=0){
            if(pos!=m[i]){
                if(pos!=-1){
                    if(tmp%2!=0){
                        ans++;
                    }
                }
                pos=m[i];
                tmp=1;
            } else {
                tmp++;
            }
        }
    }
    if(tmp%2!=0)ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 640
N, M = map(int, input().split())

paths = []

for i in range(M) :
    _a, _b = map(int, input().split())
    paths.append((_a, _b))

st = sorted(paths, key = lambda x : x[1])
cnt = 0
prev_b = -1

for i in st :
    if cnt == 0 :
        cnt += 1
        prev_b = i[1]
    else :
        if i[0] >= prev_b :
            cnt += 1
            prev_b = i[1]
    
print(cnt)

Measured memory_bytes: 18960
/*input
3
1 5
4 2
6 3
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#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())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
ll a[maxn],b[maxn];
multiset<ll> mn,mx;
int main()
{
	IOS;
	int n;
	cin>>n;
	REP(i,n) cin>>a[i]>>b[i];

	if(n==2){
		cout<<min(a[0],b[1])+min(a[1],b[0])<<'\n';
		return 0;
	}

	REP(i,n) mx.insert(a[i]);
	REP(i,n) mx.insert(b[i]);
	ll ans=INF64;
	{
		ll cur=0;
		REP(i,n) cur+=a[i];
		ans=min(ans,cur);
	}
	{
		ll cur=0;
		REP(i,n) cur+=b[i];
		ans=min(ans,cur);
	}

	REP(i,n-2){
		mn.insert(*mx.begin());
		mx.erase(mx.begin());
	}
	ll cur=0;
	for(ll i:mn) cur+=i;

	REP(i,n){
		if(mn.count(a[i])) mn.erase(mn.lower_bound(a[i])),cur-=a[i];
		else mx.erase(mx.lower_bound(a[i]));

		if(mn.count(b[i])) mn.erase(mn.lower_bound(b[i])),cur-=b[i];
		else mx.erase(mx.lower_bound(b[i]));		

		while(SZ(mn)<n-2){
			mn.insert(*mx.begin());
			cur+=*mx.begin();
			mx.erase(mx.begin());
		}
		while(SZ(mn)>n-2){
			mx.insert(*prev(mn.end()));
			cur-=*prev(mn.end());
			mn.erase(prev(mn.end()));
		}

		ans=min(ans,cur+a[i]+b[i]);
		//cout<<i<<' '<<cur+a[i]+b[i]<<'\n';
		//for(ll i:mn) cout<<i<<' ';
			//cout<<'\n';

		mx.insert(a[i]);
		mx.insert(b[i]);

		while(*prev(mn.end())>*mx.begin()){
			ll x=*prev(mn.end()),y=*mx.begin();
			mn.erase(prev(mn.end()));
			mx.erase(mx.begin());
			mn.insert(y);
			mx.insert(x);
			cur=cur-x+y;
		}
	}
	cout<<ans<<'\n';
}

Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;

int main(){
  int n,m; cin >> n >> m;
  cout << n*(n-1)/2 + m*(m-1)/2 << "\n";
}

Measured memory_bytes: 256
import collections
N = int(input())
root = int(N**0.5+3)
l = [0] * root
t = [0] * root
c = [0] * root
for i in range(2,root):
    while N % i ==0:
        N = N/i
        l[i] +=1
    t[i] = l[i]
        
    j = 1
    while l[i]- j >=0:
        l[i] =l[i] - j
        j = j +1
        
    c[i] = j -1

if N >1:
    a = 1
else:
    a =0
    
#print(t)
#print(l)

print(sum(c)+a)


Measured memory_bytes: 92208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T> ostream& operator << (ostream& os, const set<T>& s) { for (auto e : s) os << e; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { (a += b % mod) %= mod; if (a < 0) a += mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12); // debuged
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int l, r, d;
  cin >> l >> r >> d;
  cout << r / d - (l - 1) / d << endl;
}


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

int main(void) {
  int h,w;cin>>h>>w;
  string s[h+10];
  REP(i,h) cin>>s[i];
  int L[h+10][w+10];
  int R[h+10][w+10];
  int D[h+10][w+10];
  int U[h+10][w+10];

  REP(i,h) {
    REP(j,w) {
      if (s[i][j]=='#') {
        L[i][j]=0;
      } else if (j==0)  {
        L[i][j]=1;
      } else {
        L[i][j]=L[i][j-1]+1;
      }
    }
  }

  REP(i,h) {
    for(int j=w-1;j>=0;--j) {
      if (s[i][j]=='#') {
        R[i][j]=0;
      } else if (j==w-1)  {
        R[i][j]=1;
      } else {
        R[i][j]=R[i][j+1]+1;
      }
    }
  }

  REP(i,h) {
    REP(j,w) {
      if (s[i][j]=='#') {
        D[i][j]=0;
      } else if (i==0)  {
        D[i][j]=1;
      } else {
        D[i][j]=D[i-1][j]+1;
      }
    }
  }

  for(int i=h-1;i>=0;--i) {
    REP(j,w) {
      if (s[i][j]=='#') {
        U[i][j]=0;
      } else if (i==h-1)  {
        U[i][j]=1;
      } else {
        U[i][j]=U[i+1][j]+1;
      }
    }
  }

  // REP(i,h) {
  //   REP(j,w) {
  //     cout << U[i][j] << " ";
  //   }
  //   cout << endl;
  // }

  int max_v = 0;

  REP(i,h) {
    REP(j,w) {
      max_v = max(max_v, L[i][j]+R[i][j]+D[i][j]+U[i][j]-3);
    }
  }

  pr(max_v);

  return 0;
}


Measured memory_bytes: 67456
#include <bits/stdc++.h>
#define dcout cout << fixed << setprecision(15)
#define rep(i, a) for(int i = 0; i < a; i++)
#define arep(i, x) for(auto i : x)
#define all(v) v.begin(), v.end()
#define int long long
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
using namespace std;
signed main() {
    int a, b;
    cin >> a >> b;
    cout << 6 - a - b;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<utility>
#include<algorithm>

using namespace std;

struct C{
    char mark;
    int value;
};

void print(C c[], int n){
    for(int i = 0; i < n-1; i++){
        printf("%c%d ", c[i].mark, c[i].value);
    }
    printf("%c%d\n", c[n-1].mark, c[n-1].value);
}

int main(){
    int n;
    scanf("%d", &n);
    getchar();

    C a[36];
    C b[36];
    for(int i = 0; i < n; i++){
        scanf("%c", &(a[i].mark));
        scanf("%d", &(a[i].value));
        if(i < n-1){
            getchar();
        }
        b[i] = a[i];
    }

    for(int i = 0; i < n; i++){
        for(int j = n-1; j > i; j--){
            if(a[j].value < a[j-1].value){
                swap(a[j], a[j-1]);
            }
        }
    }

    for(int i = 0; i < n; i++){
        int minj = i;
        for(int j = i; j < n; j++){
            if(b[j].value < b[minj].value){
                minj = j;
            }
        }
        swap(b[i], b[minj]);
    }

    bool flag = true;
    for(int i = 0; i < n; i++){
        if(a[i].mark != b[i].mark || a[i].value != b[i].value){
            flag = false;
            break;
        }
    }

    print(a, n);
    printf("Stable\n");
    print(b, n);
    if(flag){
        printf("Stable\n");
    }
    else{
        printf("Not stable\n");
    }
}



Measured memory_bytes: 2756
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//def   puts(a) printf("%s\n", a) 文字はこっち
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
//your code here!


int main(void){
    ll W, a, b;
    in3(W, a, b);
    if(a>b) swap(a,b);
    if(b>a+W) put(b-a-W);
    else puts("0");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define INF 1100000000
#define LLINF 1100000000000000000
#define MOD 1000000007

using namespace std;
typedef long long ll;

int main()
{
  ll N, M; cin >> N >> M;
  if (N != M && N + 1 != M && N != M + 1) cout << 0 << endl;
  else {
    ll Mk = 1, Nk = 1;
    for (ll i = 1; i <= M; i++) (Mk *= i) %= MOD;
    for (ll i = 1; i <= N; i++) (Nk *= i) %= MOD;

    ll ans = (Mk * Nk) % MOD;
    if (N == M) cout << 2*ans % MOD << endl;
    else cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<vector<pair<int, int>>> adj;
vector<int> dis;
vector<bool> vis;
set<int> s;
bool fullCl = false;

void dfs( int u, int d ){
	
	if( dis[u] != -1 && dis[u] != d ){
		fullCl = true;
		return;
	}
	dis[u] = d;
	if( vis[u] ) return;
	vis[u] = true;
	if( fullCl ) return;
	//cout << " " << u << " " << d << endl;
	for( auto v : adj[u] ){
		dfs(v.first, v.second+d);
	}
} 

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m, x, y, z;
	cin >> n >> m;
	dis.assign(100001, -1);
	vis.assign(100001, false);
	adj.assign(100001, vector<pair<int, int>>());
	
	for( int i = 0; i < m; ++i ){
		cin >> x >> y >> z;
		x--; y--;		
		adj[x].push_back(make_pair(y, z));
		adj[y].push_back(make_pair(x, -z));
		s.insert(x); s.insert(y);
	}

	for( auto it : s ){
		if( !vis[it] ){
			//cout << it << endl;
			dfs(it, 0);
			if( fullCl )
				break;
		}
	}

	if( !fullCl )
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 20608
#include<iostream>
#include <algorithm>
using namespace std;
int N_MAX=100000;
int main()
{
  int n,i;
  int a[N_MAX];
  long long res=0;
  cin >> n;
  for(i=0;i<n;i++)
    cin >> a[i];
  sort(a,a+n);
  for(i=0;i<n-1;i+=2)
    res+=max(-a[i]-a[i+1],a[i]+a[i+1]);
  if(i<n) res+=a[n-1];
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 640
n = int(input())
a = list(map(int, input().split()))
print(' '.join(map(str,a)))
for i in range(1, n):
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j -= 1
    a[j+1] = v
    print(' '.join(map(str,a)))


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

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) { return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M; }
inline ll sum_1(const ll i, const ll j) { return (sum_1(j) - sum_1(i - 1) + M) % M; }
inline ll sum_2(const ll i, const ll j) { return (sum_2(j) - sum_2(i - 1) + M) % M; }
inline ll sum_3(const ll i, const ll j) { return (sum_3(j) - sum_3(i - 1) + M) % M; }

ll pow_f(ll b, ll e) {
    ll ans = 1;
    b = b % M;
    while (e) {
        if (e&1) {
            ans = (ans * b) % M;
        }
        b = (b * b) % M;
        e >>= 1;
    }
    return ans;
}

ll nCr(ll n, ll r) {
    if (r > n || n < 0 || r < 0) { return 0; }
    if (n == r || r == 0) { return 1; }
    r = min(r, n-r);
    ll ans = 1;
    for (ll i = 1; i <= r; ++i) {
        ans = (ans * (n-i+1))/(i); 
    }
    return ans;
}

ll nCr(tuple<ll,ll> t) {
    auto n = get<0>(t);
    auto k = get<1>(t);
    return nCr(n+k-1, k);
}

template<typename T>
void print(T v) {
    cout << v << " ";
}

template<typename T>
void print(vector<T> v) {
    for (auto &i : v) {
        print(i);
    }
    cout << endl;
}

#define assert_f(expression) if (!(expression)) throw exception();

void solve() {
    string s;
    cin >> s;
    int m = s.size()/2;
    try {
        for (int i = 0; i <= m/2; ++i) {
            assert_f(s[i] == s[m-1-i]);
            assert_f(s[i+m+1] == s[i]);
            assert_f(s[2*m-i] == s[m-1-i]);
        }
    } catch (...) {
        cout << "No" << endl;
        return;
    }
    cout << "Yes" << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef D_LOCAL
        freopen("in.in", "r", stdin);
        freopen("out.out", "w", stdout);
        freopen("out.out", "w", stderr);
    #endif

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;


//abc121_d
//10^12が最大なので、小細工が必要
//101 →　110
//2^nがそれぞれなんかい割れるかでよい?
int main(){
  ll A,B;
  cin >> A >> B;

  ll res = 0;

  if(A == B)
  {
    cout << A << endl;
    return 0;
  }

  //nが偶数のとき、n^n+1 = 1

  if(A % 2 == 0)
  {
    ll i = A;

    ll b = (B+1-A)/2; 

    if(b % 2 == 1)
    {
      res ^= 1;
    }
    if((B+1-A) % 2 == 1)
    {
      res ^= B;
    }
  }
  else
  {
    res ^= A;

    ll i = A+1;
    ll b = (B+1-i)/2; 
    if(b % 2 == 1)
    {
      res ^= 1;
    }
    if((B+1-i) % 2 == 1)
    {
      res ^= B;
    }
  }
    cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
A = []
for i in range(3):
    a = list(map(int, input().split()))
    A.append(a)

n = int(input())
for c in range(n):
    b = int(input())
    for i in A:
        if b in i:
            i[i.index(b)] = 0

if sum(A[0]) == 0:
    print('Yes')
elif sum(A[1]) == 0:
    print('Yes')
elif sum(A[2]) == 0:
    print('Yes')
elif sum([i[0] for i in A]) == 0:
    print('Yes')
elif sum([i[1] for i in A]) == 0:
    print('Yes')
elif sum([i[2] for i in A]) == 0:
    print('Yes')
elif sum([A[0][0], A[1][1], A[2][2]]) == 0:
    print('Yes')
elif sum([A[0][2], A[1][1], A[2][0]]) == 0:
    print('Yes')
else :
    print('No')

Measured memory_bytes: 3064
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int d = scan.nextInt();
        int l = scan.nextInt();
        int out = 0;
        out += d / l;
        out += d % l;
        System.out.println(out);
        scan.close();
    }
}


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

int x, y, xx, yy;

int main ()
{
	cin >> x >> y >> xx >> yy;
	int len;
	if (x == xx)
	{
		len = abs (y - yy);
		if (yy > y)
			cout << xx - len << " " << yy << " " << x - len << " " << y;
		else
			cout << xx + len << " " << yy << " " << x + len << " " << y;
	}
	else if (y == yy)
	{
		len = abs (x - xx);
		if (xx < x)
			cout << xx << " " << yy - len << " " << x << " " << y - len;
		else
			cout << xx << " " << yy + len << " " << x << " " << y + len;
	}
	else
	{
		int lenx = abs (x - xx);
		int leny = abs (y - yy);
		if (xx > x)
			if (yy > y)
				cout << xx - leny << " " << yy + lenx << " " << x - leny << " " << y + lenx;
			else
				cout << xx + leny << " " << yy + lenx << " " << x + leny << " " << y + lenx;
		else if (xx < x)
			if (yy > y)
				cout << xx - leny << " " << yy - lenx << " " << x - leny << " " << y - lenx;
			else
				cout << xx + leny << " " << yy - lenx << " " << x + leny << " " << y - lenx;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#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++)
int num(char t) {
	if (t == 'T')return 10;
	if (t == 'J')return 11;
	if (t == 'Q')return 12;
	if (t == 'K')return 13;
	if (t == 'A')return 14;
	return t - '0';
}
int main() {
	char trump;
	while (cin >> trump) {
		if (trump == '#')break;
        string card[4][13];
		rep(i, 4) {
			rep(j, 13) {
				cin >> card[i][j];
			}
		}
		int cnt[4] = {};
		char suit=card[0][0][1];
		rep(i, 13) {
			int chk = -1; int ma = -1;
			rep(j, 4) {
				if (card[j][i][1] == trump) {
					if (ma < num(card[j][i][0])) {
						ma = num(card[j][i][0]);
						chk = j;
					}
				}
			}
			if (chk >= 0) {
				cnt[chk]++;
				if (i < 12) {
					suit = card[chk][i + 1][1];
				}
				continue;
			}
			rep(j, 4) {
				if (card[j][i][1] == suit) {
					if (ma < num(card[j][i][0])) {
						ma = num(card[j][i][0]);
						chk = j;
					}
				}
			}
			cnt[chk]++;
			if (i < 12) {
				suit = card[chk][i + 1][1];
			}
		}
		int a = cnt[0] + cnt[2];
		int b = cnt[1] + cnt[3];
		if (a > b) {
			cout << "NS " << a - 6 << endl;
		}
		else {
			cout << "EW " << b - 6 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3144
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}


int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        #if __cplusplus >= 201103L
        auto start = steady_clock::now();
        #endif
    #endif
    ll l , r;
    sf(l);sf(r);
    ll mx = 2019;
    ll up = min(l + mx, r);
    ll dis = (r - l + 1);
    if (dis / mx) {
        return puts("0"), 0;
    }

    ll ans = INT_MAX;
    for (ll i = l; i <= r; ++i) {
        for (ll j = i + 1; j <= r; ++j) {
            ll t = (i % mx) * (j % mx) % mx;
            if (t < ans) {
                ans = t;
            }
        }
    }
    cout << ans << endl;

    #ifdef LOCAL
        #if __cplusplus >= 201103L
        auto end = steady_clock::now();
        duration<double> time_span = duration_cast<duration<double>>(end - start);;
        printf("Total time: %.6fs\n", time_span.count());
        #endif
    #endif
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int h[n];
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	int dp[n];
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for(int i=2;i<n;i++)
	{
		int mi = INT_MAX;
		for(int j=1;j<=k;j++)
		{
			if(i-j>=0)
			mi = min(dp[i-j]+abs(h[i-j]-h[i]), mi);
		}	
		//cout<<dp[i];
		dp[i]=mi;
		//cout<<dp[i];
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k;
	cin >> k;
	string s;
	cin >> s;
	if (s.length() <= k)
		cout << s << '\n';
	else
	{
		for (int i = 0; i < k; i++)
			cout << s[i];
		cout << "...\n";
	}
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int n, s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n){
    int l, r;
    cin >> l >> r;
    s += r-l+1;
  }
  cout << s << endl;
}

Measured memory_bytes: 256
import sys

s = input()
data = {"dream","dreamer","erase","eraser"}

while True:
    for i in data:
        if s.endswith(i):
            s = s[:-len(i)]
            break
    else:break

if s == "":
    print("YES")
    sys.exit()
else:
    print("NO")
    sys.exit()

Measured memory_bytes: 9032
<?php
$s = trim(fgets(STDIN));
$t = trim(fgets(STDIN));

$ss = [];
for($i = 0; $i<strlen($s); $i++){
    $ss[$s[$i]] = isset($ss[$s[$i]]) ? $ss[$s[$i]]+1 : 1;
}

$ts = [];
for($i = 0; $i<strlen($t); $i++){
    $ts[$t[$i]] = isset($ts[$t[$i]]) ? $ts[$t[$i]]+1 : 1;
}

rsort($ss);
rsort($ts);

echo implode($ss) == implode($ts) ? 'Yes' : 'No';


Measured memory_bytes: 4856
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>

#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#include <iomanip>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const int INF = 1e9+7;
const ll mod = 998244353;


double N,ans,K;

int main() {
	std::cout << std::fixed << std::setprecision(10);
	cin >> N >> K;

	FOR(i, 1, N + 1) {
		ll cur = i;
		double cnt = 1;
		while (cur < K) {

			cur *= 2;
			cnt/=2.00000000000;
		}
		ans += cnt;

	}

	cout <<  ans / N << endl;

	return 0;
}

Measured memory_bytes: 256
cnt = []
for _ in range(10**5+2):
	cnt.append(0)

n = int(input())
a = [int(v) for v in input().split()]

for x in a:
	cnt[x] += 1
	if x > 0 : cnt[x-1] += 1
	cnt[x+1] += 1
	
answer = 0
for n in cnt:
	answer = max(answer, n)

print(answer)

Measured memory_bytes: 14640
#include <cstdio>

int main()
{
    int N, A, B;
    char buf[100001];
    while( 3 == scanf("%d %d %d", &N, &A, &B ) ) {
        scanf("%s", buf);
        int no = 0;
        int passed = 0;
        for (int i = 0; i < N; ++i) {
            bool pass = false;
            if (buf[i] == 'a') { // jap
                if (passed < A + B) { pass = true; ++passed; }
            } else if (buf[i] == 'b') { // overseas
                if (passed < A+B && ++no <= B) {
                    pass = true;
                    ++passed;
                }
            }
            if (pass) {
                printf("Yes\n");
            } else {
                printf("No\n");
            }
        }
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)


// Write From This Line
int main()
{
	string s;
	cin >> s;
	int t;
	cin >> t;
	rep(i,s.size()) {
		if(i%t ==0){
			cout <<s[i];
		}
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}

int main() {
	ll N;
	cin >> N;
	vector<ll> p(N);
	vector<ll> m(N);
	for (ll i = 0; i < N; i++) {
		ll A;
		cin >> A;
		p.at(i)=i+A;
		m.at(i) = i - A;
	}
	sort(p.begin(), p.end());
	sort(m.begin(), m.end());
	ll pn = 0,mn=0;
	ll an = 0;
	ll poi;
	
	while (pn < N && mn < N) {
		if (p.at(pn) < m.at(mn)) {
			pn++;

		}
		else if (p.at(pn) > m.at(mn)) {
			mn++;
		}
		
		else {
			ll rp = 0, rm = 0;
			
			
			poi = p.at(pn);
			while (pn < N && p.at(pn) == poi) {
				rp++;
				pn++;
			}
			while (mn < N && m.at(mn) == poi) {
				rm++;
				mn++;
			}
			an += rm * rp;

		}
		 

	}
	cout << an << endl;

	
}


Measured memory_bytes: 6428
inp=[1,1]
v=pow(10,9)+7
for i in range(2,2001):
  inp.append((inp[-1]*i)%v)
s=int(input())
up=s//3
ans=0
for k in range(1,up+1):
  a=inp[s-2*k-1]
  b=inp[k-1]*inp[s-3*k]
  b=pow(b,v-2,v)
  ans+=((a*b)%v)
  ans=ans%v
print (ans)
  

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

#define Pi acos(-1)
#define INPUT_OUTPUT { \
	freopen("input.txt", "r", stdin); \
	freopen("output.txt", "w", stdout); \
}

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

int main()
{
	//INPUT_OUTPUT; // I use this to test code easily in my code editor!
	
	int n, i, ans = 0, p = 0,f = 0;
	cin >> n;
	int ara[n];
	for(i = 0; i < n; i++) cin >> ara[i];
	for(i = 0; i < n; i++) {
		f++;
		while(i < n && ara[i] != f) {
			i++;
		}
		if(ara[i] == f) p++;
	}
	if(p!=0) cout << (n-p) << '\n';
	else cout << "-1\n";
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
ll dp[3010][3010];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n+1];
    for(ll i=1;i<=n;i++)
    {
        cin>>a[i];
        dp[i][i]=a[i];
    }
    for(ll len=2;len<=n;len++)
    {
        for(ll l=1;l<=n-len+1;l++)
        {
            ll r=l+len-1;
            dp[l][r]=max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
        }
    }
    cout<<dp[1][n];
}

Measured memory_bytes: 70016
import java.util.Scanner;

/**
 * https://atcoder.jp/contests/abc157/tasks/abc157_c
 *
 */
public final class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int scale = scanner.nextInt();
			int max = scanner.nextInt();

			if (max == 0 && scale == 1) {
				System.out.println("0");
				return;
			}

			int[] values = new int[scale];
			for (int i = 0; i < values.length; i++) {
				values[i] = -1;
			}

			for (int i = 0; i < max; i++) {
				int s = scanner.nextInt() - 1;
				int c = scanner.nextInt();

				if (values[s] == -1) {
					values[s] = c;
				} else if (values[s] != c) {
					System.out.println("-1");
					return;
				} else {
					values[s] = c;
				}
			}

			if (scale != 1 && values[0] == 0) {
				System.out.println("-1");
				return;
			}

			for (int i = 0; i < values.length; i++) {
				if (values[i] != -1) {
					break;
				}
				if (i == 0) {
					values[i] = 1;
				} else {
					values[i] = 0;
				}
			}

			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < values.length; i++) {
				sb.append(values[i] == -1 ? "0" : Integer.toString(values[i]));
			}
			System.out.println(Integer.parseInt(sb.toString()));
		}
	}

}


Measured memory_bytes: 21844
N, K = map(int, input().split())
# print(N, K)

def required_coins(s, K):
    ans = 0
    while s < K:
        s <<= 1
        ans += 1
    return ans

A = [1/(1 << required_coins(i + 1, K)) for i in range(N)]
ans = sum(A) / N
print(ans)


Measured memory_bytes: 44784
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vii;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip> vip;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 :1e9;
vs in;
int t,n;
int f(int a){
	int s=0;
	char c=in[t][a];
	if(isdigit(c)){
		t++;
		return c-'0';
	}
	if(c=='*')s=1;
	t++;
	while(t<n&&a+1<in[t].size()){
		if(c=='+')s+=f(a+1);
		else if(c=='*')s*=f(a+1);
//		cout<<t<<" "<<s<<" "<<a<<" "<<in[t].size()<<" "<<c<<endl;
	}
//	cout<<t<<" "<<s<<endl;
	return s;
}
int main(){
	while(cin>>n,n){
		in=vs(n);
		rep(i,n)cin>>in[i];
		cout<<f(t=0)<<endl;
	}
}


Measured memory_bytes: 3156
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
	int n;
	cin >> n;
	vector <int> A(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	vector <int> sufz(n + 1);
	for (int i = n - 1; i >= 0; i--) {
		if(A[i] == 0)
			sufz[i] = sufz[i + 1] + 1;
	}
	ll c = 0;
	for (int i = 0; i < n; i++) {
		int mask = 0;
		for (int j = i; j < n; j++) {
			if(A[j] == 0) {
				c += sufz[j];
				j += (sufz[j] - 1);
				continue;
			}
			if((mask & A[j]) == 0) {
				mask |= A[j];
				c++;
			}
			else {
				break;
			}
		}
	} 
	cout << c;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>
#include <stack>

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

typedef long long ll;
int main(){
    int n;
    string s;
    stack<char> slime;
    cin >> n >> s;
    slime.push(s[0]);
    repn(i,1,n){
        if( slime.top() == s[i]){
            continue;
        }
        slime.push(s[i]);
    }

    cout << slime.size() << endl;
    
}

Measured memory_bytes: 512
#include <stdio.h>
 
int main(void){
  	int a[3];
  int i,j;
    for(i=0;i<3;i++){
        scanf("%d", &a[i]);
    }
    int max;
  int min;
  	max = a[0];
    min = a[0];
  for(i=0;i<3;i++){
  	if(max <= a[i]){
      max = a[i];
    }
    if(min >= a[i]){
      min = a[i];
    }
  }
	
  
  if(min == a[1] && max == a[0]){
    printf("Yes");
	return 0;
  }
	if(max == a[1] && min == a[0]){
		printf("Yes");
	return 0;
  }
  
printf("No");
 
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define mod 1000000007
#define M 100005
using namespace std;
int n,k,ans=1,cnt[M],dis[M];
vector<int>E[M];
void dfs(int x,int f) {
	int s=E[x].size();
	for(int i=0; i<E[x].size(); i++) {
		int v=E[x][i];
		if(v==f)continue;
		cnt[v]=k-s;
		s--;
		dfs(v,x);
	}
}int main() {
	scanf("%d%d",&n,&k);
	for(int i=1; i<n; i++) {
		int a,b;
		scanf("%d%d",&a,&b);
		E[a].push_back(b);
		E[b].push_back(a);
	}
	dfs(1,0);
	cnt[1]=k;
	for(int i=1; i<=n; i++) {
		if(cnt[i]<0)ans=0;
		else ans=1LL*ans*cnt[i]%mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 10752
import itertools as iter
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
com = list(iter.permutations(li))
start = com[0]
ans = 0
for i in com:
    for j in range(n-1):
        a,b=i[j]
        c,d=i[j+1]
        ans+=((c-a)**2+(d-b)**2)**0.5
print(ans/len(com))

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

int main()
{
	int a, b;
	cin >> a >> b;

	if ((a * b) % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}


}





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

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

    if(n >= 10) cout << r << endl;
    else cout << r + 100*(10-n) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
} 

 
struct Dinic {
  struct edge {
    int to, cap, rever;
    edge(int to, int cap, int rever):to(to), cap(cap), rever(rever){}
  };
  vector< vector<edge> > graph;
  vector<int> level, iter;
  Dinic(int V):graph(V), level(V), iter(V){}
  void add_edge(int from, int to, int cap) {
    graph[from].emplace_back(to, cap, graph[to].size());
    graph[to].emplace_back(from, 0, graph[from].size()-1);
  }
  void bfs(int s) {
    fill(all(level), -1);
    queue<int> que;
    level[s] = 0;
    que.push(0);
    while(que.size()) {
      int v = que.front(); que.pop();
      for(edge& e : graph[v]) {
        if(e.cap > 0 && level[e.to] < 0) {
          level[e.to] = level[v] + 1;
          que.push(e.to);
        }
      }
    }
  }
  int dfs(int v, int t, int f) {
    if(v == t) return f;
    for(int& i = iter[v]; i < graph[v].size(); i++) {
      edge& e = graph[v][i];
      if(e.cap > 0 && level[v] < level[e.to]) {
        int d = dfs(e.to, t, min(e.cap, f));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rever].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  int max_flow(int s, int t) {
    int flow = 0;
    while(true) {
      bfs(s);
      if(level[t] < 0) return flow;
      fill(all(iter), 0);
      int f; while((f = dfs(s, t, inf)) > 0) flow += f;
    }
  }
}; 

int main(){
    while(true){
    ll m,n;cin >>m>> n;if(m==0&&n==0)break;
    Dinic dn(m+n+2);
    ll s=0,t=m+n+1;
    vl a(m),b(n);
    rep(i,m){
        cin  >> a[i];
    }
    rep(i,n){
        cin  >> b[i];
    }
    rep(i,m){
        dn.add_edge(s,i+1,1);
    }
    rep(i,n){
        dn.add_edge(m+i+1,t,1);
    }
    rep(i,m){
        rep(j,n){
            if(__gcd(a[i],b[j])!=1){
                dn.add_edge(i+1,m+1+j,1);
            }
        }
    }
    cout << dn.max_flow(s,t) <<endl;
    }
}


Measured memory_bytes: 7348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 //Compiler version g++ 6.3.0

 int main()
 {
 	string s;
 	cin >> s;
 	string t = "";
 	for(int i = s.size()-1;i >= 0;i--){
 		t += s[i];
 		if(t=="maerd" or t=="remaerd" or t=="esare" or t=="resare"){
 			t = "";
 		}
 	}
 	if(t == "") cout << "YES" << endl;
 	else cout << "NO" << endl;
 	
 	return 0;
 }

Measured memory_bytes: 512
n,k = map(int,input().split())
A = list(map(int,input().split()))
cnt = [0]*50
for a in A:
    i = 0
    while a > 0:
        if a&1:
            cnt[i] += 1
        i += 1
        a = a >> 1
base = 0
delta = [0]*50
pow2 = 1
s = [0]*51
for i,c in enumerate(cnt):
    delta[i] = max(0,pow2*(n - 2*c))
    base += pow2*c
    s[i+1] = s[i] + delta[i]
    pow2*=2
i = 0
K = []
ans = 0
while k > 0:
    if k&1:
        K.append(i)
        ans += delta[i]
    i += 1
    k = k >> 1
done = 0
for i in K[::-1]:
    ans = max(ans, done + s[i])
    done += delta[i]
print(ans + base)


Measured memory_bytes: 69264
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}

int32_t main()
{
	int t=1;
	while(t--)
	{
		int n;
		cin >> n;
		set<int> s;
		int x=n-1;
		for(int i=1;i<=sqrt(x);i++)
		{
			if(x%i==0)
			{
				if(i>1)
				s.insert(i);
				if(x>i)
				s.insert(x/i);
			}
		}
		for(int i=1;i<=sqrt(n);i++)
		{
			if(n%i==0)
			{
				if(i>1)
				{
					int temp=n;
					while(temp%i==0)
					{
						temp=temp/i;
					}
					if(temp>i)
					{
						if(temp%i==1)
						s.insert(i);
					}
					else
					{
						if(temp==1)
						s.insert(i);
					}
				}
				else if(n>i)
				{
					int temp=n;
					int div=n/i;
					while(temp%div==0)
					temp=temp/div;
					
					if(temp>div)
					{
						if(temp%div==1)
						s.insert(div);
					}
					else
					{
						if(temp==1)
						s.insert(div);
					}
					
				}
			}
		}
		cout << s.size();
	}
}




Measured memory_bytes: 3720
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		for (int i = 0; i < 5; i++) {
			if(scan.nextInt() == 0) {
				System.out.println(i+1);
				return;
			}
		}
		scan.close();
	}

}

Measured memory_bytes: 35700
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;

void A(){
	int a,b; cin>>a>>b;
	int cnt=0;
	while(a>0){
		a-=b;
		cnt++;
	}
	cout<<cnt<<endl;
	
}

int main(){
	int a,b,x,t=0;
	cin>>a>>b;
	while(b--){
		cin>>x;
		t+=x;
	}
	cout<<(t>=a?"Yes":"No")<<endl;
}


Measured memory_bytes: 3584
a,b,c=map(int,input().split())
if a == b == c and a%2==0:
    print(-1)
else:
    na,nb,nc = 0,0,0
    cnt = 0
    while a%2==0 and b%2==0 and c%2==0:
        na = (b+c)//2
        nb = (c+a)//2
        nc = (a+b)//2
        cnt += 1
        a,b,c = na,nb,nc
    print(cnt)

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

vector<vector<int>> g;
vector<vector<int>> px;
vector<int> ans;

void dfs(int v, int p) {
  for (auto t : px[v]) ans[v] += t;
  for (auto nv : g[v]) {
    if (nv == p) continue;
    ans[nv] += ans[v];
    dfs(nv, v);
  }
}

int main() {
  int n, q; cin >> n >> q;
  g.resize(n);
  ans.resize(n);
  px.resize(n);
  rep(i, n-1) {
    int a, b; cin >> a >> b; a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  rep(i, q) {
    int p, x; cin >> p >> x; p--;
    px[p].push_back(x);
  }
  dfs(0, -1);
  rep(i, n) cout << ans[i] << endl;
  return 0;
}


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

using namespace std;

int main(){
  int N,M,S;
  while(cin>>N>>M>>S,N){
    vector<vector<int> > dp(N*N+1,vector<int>(S+1));
    dp[0][0]=1;
    for(int i=0;i<M;i++){
      for(int j=N*N-1;j>=0;j--){
	for(int k=0;k<S-i;k++){
	  dp[j+1][k+(i+1)]+=dp[j][k];
	  dp[j+1][k+(i+1)]%=100000;
	}
      }
    }
  cout<<dp[N*N][S]<<endl;
  }
}

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


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] divList = new int[12];

		divList[0] = 1;
		int con = 1;
		for (int i = 1; i < 11; i+=2 ) {
			divList[i] = (int)Math.pow(6, con);
			divList[i+1] = (int)Math.pow(9, con);
			con++;
		}
		divList[11] = (int)Math.pow(6, 6);

		int[]dp = new int[200000];
		Arrays.fill(dp, Integer.MAX_VALUE);
		dp[0] = 0;

		for (int i = 0; i < N + 1; i++) {
			for (int j = 0; j < 12; j++) {
				dp[i + divList[j]] = Math.min(dp[i + divList[j]], dp[i] + 1);
			}
		}

		System.out.println(dp[N]);

	}

}


Measured memory_bytes: 36508