akhauriyash/Code-Regression huggingface dataset:
#ifndef DEBUG
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,popcnt,tune=native")
#endif // DEBUG
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <stack>
using namespace std;
typedef long long ll;
inline ll read()
{
    int ch=getchar(),f=1;
    ll ans=0;
    for(;ch<'0'||ch>'9';ch=getchar())
        if(ch=='-')f=0;
    for(;ch>='0'&&ch<='9';ch=getchar())
        ans=(((ans<<2)+ans)<<1)+(ch^'0');
    return f?ans:-ans;
}
ll l,r;
/*
int calc(int n,int m)
{
    int cnt=0;
    for(int i=1;i<=n;++i)
    {
        for(int j=i/2+1;j<=min(i,m);++j)
        {
            if(i==(i|j))
            {
                ++cnt;
            }
        }
    }
    return cnt;
}
*/
const int mod=1000000007;
ll f[70][2][2][2];
ll solve(int pos,bool lim1,bool lim2,bool lead)
{
	if(pos==-1)
        return 1;
	ll &ans=f[pos][lim1][lim2][lead];

	if (ans!=-1)
        return ans;
	ans=0;
	int up2=lim2?(r>>pos&1):1;
	int up1=lim1?(l>>pos&1):0;
	for(int i=up1;i<=1;i++)
		for(int j=0;j<=up2;j++)
        {
			if (i>j) continue;
			if (lead&&i!=j) continue;

            ans=(ans+solve(pos-1,lim1&&i==up1,lim2&&j==up2,lead&&j==0))%mod;
		}
	return ans;
}
int main()
{
    ll cnt=0;
    l=read(),r=read();
    /*
    for(ll i=1;i<=r;++i)
    {
        for(ll j=max(l,i/2+1);j<=i;++j)
        {
            if(i==(i|j))
            {
                    //printf("%d %d\n",i,j);
                ++cnt;
            }
        }
    }
    printf("%d\n",cnt);
    //return 0;
    */
    //cerr<<calc(r,r)<<' '<<calc(r,l-1)<<endl;
    //printf("%d\n",calc(r,r)-calc(r,l-1));
    memset(f,-1,sizeof f);
    printf("%d\n",solve(60,1,1,1));
    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 256
N = input()
A = [map(int, raw_input().split())]
A.append(map(int, raw_input().split()))
dp = [[0] * (N + 1) for _ in range(2 + 1)]
for i in range(0, 2):
    for j in range(0, N):
        dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]) + A[i][j]
print dp[2][N]


Measured memory_bytes: 2568
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, n) for (int i = 1; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 5000000000000000000;

int main() {
    int L;
    cin >> L;
    
    int l = 1;
    vector<tuple<int, int, int>> ans;
    for (int i = 19; i >= 2; --i) {
        if (l * 2 > 1000000) break;
        ans.push_back(tuple<int, int, int>{i, i + 1, l * 0});
        ans.push_back(tuple<int, int, int>{i, i + 1, l * 1});
        ans.push_back(tuple<int, int, int>{i, i + 1, l * 2});
        l *= 3;
    }
    while (L) {
        int m = 1, k = 0;
        while (m * 3 <= L) {
            m *= 3;
            ++k;
        }
        L -= m;
        ans.push_back(tuple<int, int, int>{1, 20 - k, L});
    }
    
    cout << 20 << " " << SZ(ans) << "\n";
    for (auto t : ans) cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << "\n";
    return 0;
}


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

vector<int> v(4,0);

int main(){
  for(auto &p: v)cin >> p;
  sort(v.begin(),v.end());
  if(v[0] == 1 && v[1] == 4 && v[2] == 7 && v[3] == 9)cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define MMOD(i) ((i%MOD)+MOD)%MOD;
#define all(v) v.begin() , v.end()
#define vec(i,j) vector<vector<ll>>(i,vector<ll>(j,0))
#define input(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
const ll MAX_N=100010;
ll a,b,c,d,e,f,x,y,z,k,m,n,l,h,w,t,p,q,ans=0;
vl v,ss;
string s;
ll solve(){
	x=1000000000;
    a=n/x;
    b=n%x;
    if(b==0){
        cout<<0<<" "<<0<<" "<<x<<" "<<0<<" "<<0<<" "<<a;
    }
    else{
        cout<<0<<" "<<0<<" "<<x<<" "<<1<<" "<<x-b<<" "<<a+1;   
    }
    return 0;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    solve();

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

inline int read(){
	char ch = getchar(); int x = 0;
	while (ch < '0' || '9' < ch) ch = getchar();
	while ('0' <= ch && ch <= '9') { x = x*10 + ch-'0'; ch = getchar(); }
	return x;
}
const int maxn = 500009;
int d[maxn], pre[maxn], suf[maxn];
int n, Q, q;

int main(){
	n = read(); pre[0] = read();
	for (int i=1; i<=n; i++) d[i] = read();
	for (int i=1; i<=n; i++)
		if (abs(pre[i-1]-d[i]) < pre[i-1]) pre[i] = abs(pre[i-1]-d[i]);
		else pre[i] = pre[i-1];
	suf[n+1] = 1;
	for (int i=n; i>=1; i--)
		if (d[i] >= 2*suf[i+1]) suf[i] = suf[i+1];
		else suf[i] = suf[i+1] + d[i];
	Q = read();
	while (Q--){
		q = read();
		puts(pre[q-1] >= suf[q+1] ? "YES" : "NO");
	}
	return 0; 
}

Measured memory_bytes: 7680
import bisect

def Get_Sieve_of_Eratosthenes(N):
    prime_list = [2]
    limit = int(N ** 0.5)
    numeric_data = [i for i in range(3, N, 2)]
    while True:
        prime = numeric_data[0]
        if prime >= limit:
            return prime_list + numeric_data
        prime_list.append(prime)
        numeric_data = [x for x in numeric_data if x % prime != 0]

def Get_2017_like_number(N, prime_list):
    ans_list = []
    for p in prime_list:
        if (p+1)//2 in prime_list:
            ans_list.append(p)
    return ans_list


def main():
    N = 10 ** 5
    prime_list = Get_Sieve_of_Eratosthenes(N)
    like_number_list = Get_2017_like_number(N, prime_list)

    # 入力
    Q = int(input())
    Query = [list(map(int, input().split())) for _ in range(Q)]
    
    for q in Query:
        l = q[0]
        r = q[1]
        print(bisect.bisect_right(like_number_list, r) - bisect.bisect_left(like_number_list, l))


if __name__ == "__main__":
    main()

Measured memory_bytes: 28628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>
#include <queue>

using namespace std;

using Graph = vector<vector<int> >;

vector<int> seen;

int main()
{
	const int X_MAX = 101;
	const int Y_MAX = 101;
	int N;

	cin >> N;

	//vector<vector<int> > Hmt(Y_MAX, vector<int>(X_MAX, 0));
	//vector<vector<int> > Hmp(Y_MAX, vector<int>(X_MAX, 0));

	vector <int> Xs(N);
	vector <int> Ys(N);
	vector <int> Hs(N);


	int x, y ,h;
	for (int ni = 0; ni < N; ni++) {
		cin >> x >> y >> h;
		//Hmp[y][x] = h;
		Xs[ni] = x;
		Ys[ni] = y;
		Hs[ni] = h;
	}

	long long H = 200;
	int flag;
	long long gap0, gap;
	int yi, xi;
	for (yi = 0; yi < Y_MAX; yi++) {
		for (xi = 0; xi < X_MAX; xi++) {
			for (int hi = 0; hi < N; hi++) {
				H = Hs[hi] +  abs(yi - Ys[hi]) + abs(xi - Xs[hi]);
				flag = 1;
				gap0 = 1000;
				//gap0 = Hs[0] - max(H - abs(yi - Ys[0]) - abs(xi - Xs[0]), 0);
				for (int pi = 0; pi < N; pi++) {
					gap = Hs[pi] - max(H - abs(yi - Ys[pi]) - abs(xi - Xs[pi]), (long long)0);
					if (gap0 == 1000) {
						gap0 = gap;
					}
					else {
						if (gap != gap0) {
							flag = 0;
							break;
						}
					}
				}
				if (flag == 1)break;
			}
			if (flag == 1)break;
		}
		if (flag == 1)break;
	}



	printf("%d %d %lld", xi, yi, H + gap);

	//cout << ans;
	

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int a,b,c,tmp;
	scanf("%d%d%d",&a,&b,&c);
	if(a>b){tmp=b;b=a;a=tmp;}
	if(b>c){tmp=c;c=b;b=tmp;}
	if(a>b){tmp=b;b=a;a=tmp;}
	printf("%d\n",c*10+b+a);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    ll N; cin>>N;
    vector<P> A(N);
    REP(i, N){
        int a; cin>>a;
        A[i] = P(a, i);
    }
    sort(ALL(A));
    REP(i, N){
        if(i) cout << " ";
        cout << A[i].second+1;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int d,n,i;
    	cin>>d>>n;
    	int x=1;
    	for(i=0;i<d;i++)
    	{
            x=x*100;
    	}
    	if(n==100)
    	{
    	cout<<(n+1)*x;

    	}
    	else{
    	cout<<n*x;
    }
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    string s;
   bool flag =true;
    cin>>t>>s;
    if(t%2!=0)
        flag=false;
    else 
    {
         for(int i=0,j=t/2;i<t/2,j<t;i++,j++)
    {
        if(s[i]!=s[j])
        {
            flag=false ;
            break;
        }
    }
    }
   
    if(flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

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

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

   int cnt = 1;

   if (N >= K){
      while (N/K >= K){
         N = N/K;
         cnt++;
      }
      cnt++;
   }
   cout << cnt << endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int H,W,i,x,y;
    for(;;){
        scanf("%d %d",&H,&W);
        if(H==0 && W==0){
            exit(0);
        }
        for(y=0;y<H;y++){
            for(x=0;x<W;x++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
}


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

class Node{
public:
	vector< int > e_to;
	vector< int > e_cost;
	
	bool def;
	int min_cost;
	
	Node(){
		def = false;
		min_cost = -1;
	}
};
bool operator==(const Node& ot1, const Node& ot2){
	return ot1.min_cost == ot2.min_cost;
}
bool operator!=(const Node& ot1, const Node& ot2){
	return !(ot1 == ot2);
}
bool operator<(const Node& ot1, const Node& ot2){
	return ot1.min_cost < ot2.min_cost;
}
bool operator>(const Node& ot1, const Node& ot2){
	return ot1.min_cost > ot2.min_cost;
}
bool operator<=(const Node& ot1, const Node& ot2){
	return !(ot1 > ot2);
}
bool operator>=(const Node& ot1, const Node& ot2){
	return !(ot1 < ot2);
}

int main(){
	int v, e, r, s, t, d;
	vector< Node > nodes;
	priority_queue< Node, vector< Node >, greater< Node > > que;
	
	cin >> v >> e >> r;
	nodes.resize(v);
	
	for(int i = 0; i < v; ++i){
		nodes[i] = Node();
	}
	
	for(int i = 0; i < e; ++i){
		cin >> s >> t >> d;
		nodes[s].e_to.push_back(t);
		nodes[s].e_cost.push_back(d);
	}
	
	nodes[r].min_cost = 0;
	
	que.push(nodes[r]);
	
	while(!que.empty()){
		Node def_node = que.top();
		que.pop();
		
		if(def_node.def)continue;
		
		def_node.def = true;
		
		for(int i = 0; i < def_node.e_to.size(); ++i){
			int to = def_node.e_to[i];
			int cost = def_node.min_cost + def_node.e_cost[i];
			
			if(nodes[to].min_cost == -1 || cost < nodes[to].min_cost){
				nodes[to].min_cost = cost;
				que.push(nodes[to]);
			}
		}
	}
	
	for(int i = 0; i < v; ++i){
		if(nodes[i].min_cost == -1) cout << "INF" << endl;
		else cout << nodes[i].min_cost << endl;
	}
	
	return 0;
}

Measured memory_bytes: 31872
# abc055_a
# 合計がN食
# 今まで払った金がx円
# レストランからもらったお金がy円
# x-y円を出力せよ

N = int(input())

x = N * 800
# //は切り捨ての除算
# 例えば、5//2の時は求まる2となる。5/2の時の商のみ。
y = N // 15 * 200
print(x - y)

Measured memory_bytes: 9116
n=int(input())
s1=input()
s2=input()
mod=10**9+7

if s1[0]==s2[0]:
    ans=3
    i=1
    flag=0
else:
    ans=6
    i=2
    flag=1

while i<n:
    if flag==0:
        if s1[i]==s2[i]:
            ans*=2
            i+=1
        else:
            ans*=2
            i+=2
            flag=1
    else:
        if s1[i]==s2[i]:
            i+=1
            flag=0
        else:
            ans*=3
            i+=2
    ans%=mod
print(ans)

Measured memory_bytes: 9060
#include<iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX / 2 + 2], R[MAX / 2 + 2];
int cnt;

void merge( int A[], int n, int left, int mid, int right){
    int n1, n2, i, j, k;
    n1 = mid - left;
    n2 = right -mid;
    for( i = 0; i < n1; i++) L[i] = A[left + i];
    for( i = 0; i < n2; i++) R[i] = A[mid + i];
    L[n1] = R[n2] = SENTINEL;
    i = j = 0;
    for( k = left; k < right; k++){
        cnt++;
        if( L[i] <= R[j]){
            A[k] = L[i++];
        }else{
            A[k] = R[j++];
        }
    }
}

void mergesort( int A[], int n, int left, int right){
    if(left + 1 < right){
        int mid = ( left + right ) / 2;
        mergesort(A, n, left, mid);
        mergesort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

int main(){
    int A[MAX], n, i;
    cin >> n;
    for( i = 0; i < n; i++) cin >> A[i];
    
    mergesort(A, n, 0, n);
    
    for(i = 0; i < n; i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 6908
A ,B=map(int,input().split())

ans=0

for i in range(4):
    if (A+i)%4==0:
        break
    ans=ans^(A+i)
for i in range(B-3,B+1):
    if i%4==3:
        end=i+1
        break

for i in range(end,B+1):
    ans=ans^i

print(ans)


Measured memory_bytes: 3064
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

ll n, x;
ll a[100000];

int main(int argc, char **argv) {
	cin >> n >> x;
	REP(i, n) cin >> a[i];
	ll res = 0;
	REP(i, n - 1) {
		if (a[i] + a[i + 1] > x && a[i + 1] > 0) {
			ll t = min(a[i] + a[i + 1] - x, a[i + 1]);
			res += t;
			a[i + 1] -= t;
		}
		if (a[i] + a[i + 1] > x) {
			ll t = min(a[i] + a[i + 1] - x, a[i]);
			res += t;
			a[i] -= t;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1024
//さっさと済ませられるところはさっさと済ましてしまう．ただし注意深く
#include <cstdio>
#include <iostream>
#define MAX_VERTEXES 100
#define NIL -1
#define INFTY 20000000// >100*100000

using namespace std;

//think easy make easy

int n;//num of vertexes(頂点)
int matrix_graph[MAX_VERTEXES+1][MAX_VERTEXES+1];//0オリジン
bool vertex_set[MAX_VERTEXES+1];///0オリジン
int current_mincost[MAX_VERTEXES+1];//現時点での各頂点への最小コスト
bool candidate[MAX_VERTEXES+1];//次にvertex_setに加える頂点の候補
int new_vertex;

void findNextVertex(){
	int min_tmp=INFTY;
	int next_tmp = NIL;
	
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i == new_vertex && vertex_set[j] == false){//わかりやすいプログラムほど処理もすくない.
				//無駄のないプログラムの方がわかりよい
				if(matrix_graph[i][j]+current_mincost[i] < current_mincost[j]
				   && matrix_graph[i][j] != NIL){
					   current_mincost[j]  = matrix_graph[i][j]+current_mincost[i];
					   candidate[j] = true;
				}
			}
		}
	}
	for(int i=0;i<n;i++){
		if(candidate[i] == true && current_mincost[i] < min_tmp){
			min_tmp = current_mincost[i];
			next_tmp = i;
		}
	}
	vertex_set[next_tmp] = true;
	candidate[next_tmp] = false;
	new_vertex = next_tmp;
}

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

	int v_num;
	int k;//v_numの出次数

	for(int i=0;i<n;i++){
		for(int j=0;j<=n;j++){
			matrix_graph[i][j] = NIL;
		}
	}

	for(int i=0;i<n;i++){
		scanf("%d",&v_num);
		scanf("%d",&k);

		for(int j=0;j<k;j++){
			int v_num2;
			int cst;
			scanf("%d",&v_num2);
			scanf("%d",&cst);
			matrix_graph[v_num][v_num2] = cst;
		}
	}

	for(int i=0;i<n;i++){
		vertex_set[i] = false;
		current_mincost[i] = INFTY;
	}
	/*確認用
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(j<n-1) printf("%d ",matrix_graph[i][j]);
			else printf("%d\n",matrix_graph[i][j]);
		}
	}
	*/

	for(int i=0;i<n;i++){
		candidate[i] = false;
	}

	vertex_set[0] = true;
	current_mincost[0] = 0;
	new_vertex = 0;

	for(int i=1;i<n;i++){
		//for(int j=0;j<n;j++){
			//cout <<" " <<vertex_set[j] ;
		//}
		//cout <<endl;
		findNextVertex();
	}


	for(int i=0;i<n;i++){
		cout <<i <<" " <<current_mincost[i] <<endl;
	}


	return 0;
}

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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int a,b; cin >> a >> b;
    cout << max(a+b,max(a-b,a*b)) << endl;
}


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


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

  if ((A == B) && (B == C) && (C == A)) {
    cout << "No" << endl;
  } else if ((A != B) && (B != C) && (C != A)) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll N, ll R) {
  if (N >= 10) {
    cout << R << endl;
  } else {
    cout << R + 100 * (10 - N) << endl;
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  ll R;
  scanf("%lld", &R);
  solve(N, R);
  return 0;
}


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

using namespace std;

#define rep(i, j, k) for (int i = j; i < (int)k; i++)
#define pb push_back
#define mt make_tuple
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef complex<ld> point;
typedef vector<int> vi;

inline void fileIO(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}

template <class T, class S>
inline bool smin(T &a, S b) {
  return (T)b < a ? a = b, 1 : 0;
}
template <class T, class S>
inline bool smax(T &a, S b) {
  return a < (T)b ? a = b, 1 : 0;
}

constexpr int MOD = 924844033;
constexpr int N = 2e3 + 10;

template <typename T>
inline T mod(T &v) {
  return v = (v % MOD + MOD) % MOD;
}
template <typename S, typename T>
inline S add(S &l, T r) {
  return mod(l += r);
}

int n;
string s, t;

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

#ifndef LOCAL
  // fileIO("superposition");
#endif

  cin >> n;

  cout << n - 1 << endl;
  cin >> s;
  if (s == "Vacant") return 0;

  int lo = 0, hi = n - 1;

  while (lo != hi - 1) {
    int mid = lo + hi >> 1;
    cout << mid << endl;
    cin >> t;
    if (t == "Vacant") return 0;
    if ((s == t) == bool((n - mid) & 1))
      hi = mid;
    else
      lo = mid;
  }
  cout << lo << endl;

  return 0;
}

// 1 2 0 1 2

Measured memory_bytes: 852
#include<stdio.h>
int main(void){
	int a,b;
	scanf("%d%d",&a,&b);
	
	if(a>=13)
	printf("%d",b);
	
	else if(12>=a&&a>=6)
	printf("%d",b/2);
	
	else
	puts("0");
	

	return 0;
}

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

int main() {
    int h,a; cin >> h >> a;
    cout << (h+a-1) / a << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define mp make_pair
const ll MOD=1e9+7;
using namespace std;

int main(){
  ll n;
  //q,h,s,dのリットルごとの値段でソートしたい
  vector<pair<ll,ll> > num;
  ll ha = 8;
  rep(i,4){
    ll a;
    cin >> a;
    num.push_back(mp(a*ha,ha) );
    ha /= 2;
  }
  cin >> n;

  sort(All(num));

  //整数で扱えるようにリットルをすべて4倍
  n *= 4;
  //first: 値段(値段は変える必要ない), second: 4倍のリットル
  for(ll i=3;i>=0;i--){
    num[i].first = (num[i].first/num[i].second);
    num[i].second = 8/num[i].second;
  }

  ll ans=0;
  for(ll i=0;i<4;i++){
    ans += ( num[i].first*(n/num[i].second) );
    n %= num[i].second;
  }
  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

int main() {
	ll N, A, B;
	cin >> N >> A >> B;
	if ((A - B) % 2 == 0) {
		cout << abs(A - B) / 2 << endl;
	}
	else {
		ll ans = 1e18 + 1e15;
		ll tmp = 0;
		if (B < A)swap(A, B);
		ans = min(ans, A + (B - A - 1) / 2);
		ans = min(ans, (N - B + 1) + (B - A - 1) / 2);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
def solve(K):
    ref = [[['0'], ['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']]]
    if K < 10:
        return ref[0][K][0]

    rest = K - 9
    i = 0
    while True:
        i += 1
        ref.append([[] for _ in range(10)])
        for j in range(10):
            if j == 0:
                for r in ref[i-1][j] + ref[i-1][j+1]:
                    ref[i][j].append(str(j) + r)
            elif j == 9:
                for r in ref[i-1][j-1] + ref[i-1][j]:
                    ref[i][j].append(str(j) + r)
                    rest -= 1
                    if rest == 0:
                        return str(j) + r
            else:
                for r in ref[i-1][j-1] + ref[i-1][j] + ref[i-1][j+1]:
                    ref[i][j].append(str(j) + r)
                    rest -= 1
                    if rest == 0:
                        return str(j) + r

if __name__ == '__main__':
    K = int(input())
    print(solve(K))

Measured memory_bytes: 46428
def abc(n:int,lst:list):
    l0=list(filter(lambda x:x[2]==0,lst))
    l=list(filter(lambda x:x[2]!=0,lst))
    if len(l0):
        x0 =l[0][0]
        y0=l[0][1]
        h0 =l[0][2]
        ans=[]
        for x in range(101):
            for y in range(101):
                for i in range(len(l)):
                    if abs(x0-x)+abs(y0-y)-abs(l[i][0]-x)-abs(l[i][1]-y) == l[i][2]-h0:
                        if i ==len(l)-1:
                            ans.append([x,y,h0+abs(x0-x)+abs(y0-y)])
                    else:
                        break
        for xyh in ans:
            for i in range(len(l0)):
                if abs(l0[i][0]-xyh[0])+abs(l0[i][1]-xyh[1])>=xyh[2]:
                    if i == len(l0)-1:
                        return xyh
                else:
                    break
    else:
        x0 =lst[0][0]
        y0=lst[0][1]
        h0 =lst[0][2]
        for x in range(101):
            for y in range(101):
                for i in range(1,n):
                    if abs(x0-x)+abs(y0-y)-abs(lst[i][0]-x)-abs(lst[i][1]-y) ==lst[i][2]-h0:
                        if i ==n-1:
                            return x,y,h0+abs(x0-x)+abs(y0-y)
                    else:
                        break
n = int(input())
lst = [list(map(int,input().split())) for i in range(n)]
x,y,h =abc(n,lst)
print(x,y,h)


Measured memory_bytes: 4084
from collections import defaultdict

N = int(input())
d = defaultdict(int)

for i in range(N):
    S = input()
    d[S] += 1

print("AC x " + str(d["AC"]))
print("WA x " + str(d["WA"]))
print("TLE x " + str(d["TLE"]))
print("RE x " + str(d["RE"]))

Measured memory_bytes: 9444
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <unordered_map>
using namespace std;


vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}

bool compare_by_b(tuple<int, string, int> a, tuple<int, string, int> b) {
    if(get<2>(a) != get<2>(b)){
        return get<2>(a) > get<2>(b);
    }
}

bool compare_by_string(tuple<int, string, int> a, tuple<int, string, int> b) {
    if(get<1>(a) != get<1>(b)){
        return get<1>(a) < get<1>(b);
    }else{
      	return get<2>(a) > get<2>(b);
    }
}

int check(vector<int> &v, int k, long weight)
{
  int i=0;
  for(int j=0;j<k;j++)
  {
    long tmp = 0;
    while(tmp + v[i] <= weight)
    {
      tmp += v[i];
      i++;
      if(i == v.size()) return v.size();
    }
  }
  return i;
}


long binary_search(vector<int> &v, int k)
{
	long left = 0;
  	long right = v.size() * 10000; //適宜書き換え
  	long mid;
  	while(right - left > 1)
    {
      	mid = (left + right) / 2;
      	int num = check(v,k,mid);
      	if(num >= v.size()) right = mid;
      	else left = mid;
    }
  	return right;
}

bool isComb(vector<int> &elem, int idx, int sum)
{
  if(sum == 0) return true;
  else if(idx >= elem.size() || sum < 0) return false;
  return isComb(elem, idx+1, sum) || isComb(elem, idx+1, sum - elem[idx]);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
  	const long div = 1000000007;
	int n,q;
  	cin >> n;
  	int idx = 0;
  	vector<int> elem(n);
  	while(cin >> elem[idx])
    {
      idx++;
      if(idx == n) break;
    }
  	idx =0;
  	cin >> q;
  	int question;
  	while(cin >> question)
    {
      if(isComb(elem, 0, question)) cout << "yes" << endl;
      else cout << "no" << endl;
      idx++;
    }
  	
  	return 0;
}



Measured memory_bytes: 3196
import math

a,b,h,m = map(int,input().split())

tan=h*30+0.5*m
cho=6*m

kakudo=float(100)

if math.sqrt((tan-cho)*(tan-cho))>180:
	kakudo=360-math.sqrt((tan-cho)*(tan-cho))
	print(math.sqrt(a*a+b*b-2*a*b*(math.cos(math.radians(kakudo)))))

if math.sqrt((tan-cho)*(tan-cho))==180:
	print(a+b)

if math.sqrt((tan-cho)*(tan-cho))<180:
	kakudo=math.sqrt((tan-cho)*(tan-cho))
	print(math.sqrt(a*a+b*b-2*a*b*(math.cos(math.radians(kakudo)))))

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

int main() {
	// your code goes here
	int N; cin >> N;
	vector<int> elements(N); for (auto &e: elements) cin >> e;
	sort (&elements[0], &elements[N]);
	int ans = 0;
	for (int i = N - 1; i >= 0; --i) {
	    for (int l = 0, r = i - 1; l < r; ){
	        if (elements[l] + elements[r] > elements[i]) ans += r - l, r--;
	        else l++;
	    }
	}
	cout << ans;
}


Measured memory_bytes: 256
l,r= [int (i) for i in input().split()]
g = [[] for i in range (l)]

for i in range(r):
    s,t=[int(j) for j in input().split()]
    g[s].append(t)
    
visited=[]
f=0

def visitd_from(index,origin):
    if visited[index]:
        return
    visited[index]= True
    for next_index in g[index]:
        if next_index ==origin:
            global f
            f=1
            return
        visitd_from(next_index, origin)

for i in range (l):
    visited =[False for i in range(l)]
    visitd_from(i,i)
    if f==1:
        break
print(f)


Measured memory_bytes: 5620
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
#define pll              pair<long,long>
#define pii              pair<int,int>
#define scn(a)           scanf("%d", &a)
#define scn2(a, b)       scanf("%d%d", &a, &b)
#define scn3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pairl            pair<ll , ll >
#define scnl(a)          scanf("%lld", &a)
#define scnl2(a, b)      scanf("%lld%lld", &a, &b)
#define scnl3(a, b, c)   scanf("%lld%lld%lld", &a, &b, &c)
#define scns(s)          scanf("%s",s)
#define prts(s)          printf("%s\n",s)
#define prt(a)           printf("%d\n", a)
#define prtl(a)          printf("%lld\n", a)
#define prs(a)           printf("%d ", a)
#define prt2(a, b)       printf("%d %d\n", a, b)
#define prt3(a, b, c)    printf("%d %d %d\n", a, b, c)
#define prsl(a)          printf("%lld ", a)
#define prtl2(a, b)      printf("%lld %lld\n", a, b)
#define prtl3(a, b, c)   printf("%lld %lld %lld\n", a, b, c)
#define ptcs(a)          printf("Case %d: ", a)
#define pf               printf
#define sc               scanf
#define m_p              make_pair
#define vi               vector<int >
#define vil              vector<ll >
#define pb               push_back
#define mem(a, b)        memset((a), (b), sizeof(a))
#define lg2(n)           (31-__builtin_clz(n))
#define N                200005
#define inf              9999999
#define ll               long long
#define ull              unsigned long long
#define MIN              INT_MIN
#define MAX              INT_MAX
#define fast             ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
ll gcd(ll a, ll b){if(b==0) {return a;}return gcd(b, a % b);}
ll BigMod(ll B,ll P,ll M){     ll R=1; while(P>0)      {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
//___________________________________________________________________________________________________________________

vector<ll>v[N],v1;
map<ll,ll>mp;
bool ok=false;
int main()
{
    ll n,m,k,c=0,x,y;
    cin>>n>>m;
    if(n==2 || m==2)
    {
        cout<<"No"<<endl;
    }
    else cout<<"Yes"<<endl;
    return 0;
}


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

void get_forest_size(const vector<int> &u,const vector<int> &v,vector<vector<int>> &forest){
	const int N = u.size() + 1;
	vector<int> us(N-1,0),vs(N-1,0);
	set<int> connect[N];
	vector<int> num(N,0);
	vector<int> did(N-1,0);
	for(int i=0;i<N-1;i++){
		connect[u[i]].insert(i);
		connect[v[i]].insert(i);
	}
	queue<int> Q;
	for(int i=0;i<N;++i)
		if(connect[i].size()==1)
			Q.push( *connect[i].begin() );
	while( Q.size() ){
		int ie = Q.front();
		Q.pop();
		int isu = 0;
		if(connect[u[ie]].size() == 1) isu = 1;
		(isu?us[ie]:vs[ie]) = num[(isu?u[ie]:v[ie])] + 1;
		num[(isu?v[ie]:u[ie])] += (isu?us[ie]:vs[ie]);
		connect[(isu?u[ie]:v[ie])].clear();
		connect[(isu?v[ie]:u[ie])].erase(ie);
		if(connect[(isu?v[ie]:u[ie])].size()==1){
			Q.push( *connect[(isu?v[ie]:u[ie])].begin() );
		}
		if(not did[ie]) did[ie] = (isu?1:2);
	}
	forest.resize(N);
	for(int i=0;i<N-1;i++){
		( did[i]==1 ? vs[i] = N - us[i] : us[i] = N - vs[i] );
		forest[u[i]].push_back(vs[i]);
		forest[v[i]].push_back(us[i]);
	}
	return;
}

ll calc(ll a,ll b,ll p){//a^(b) mod p   
	if(b==0)return 1;
	ll y = calc(a,b/2,p);y=(y*y)%p;
	if(b & 1) y = (y * a) % p;
	return y;
}

int main(){
	ll N,ans=0,MOD=1000000007LL;
	cin >> N;
	vector<int> u(N-1),v(N-1);
	for(int i=0;i<N-1;i++){
		cin >> u[i] >> v[i];
		u[i]--;v[i]--;
	}
	vector<vector<int>> fs;
	get_forest_size(u,v,fs);
	for(int i=0;i<N;i++){
		ll sum = 0;
		for(auto s : fs[i]){
			sum += s;
			( ans += MOD - calc(2,s,MOD) + 1 ) %= MOD;
		}
		( ans += calc(2,sum,MOD) ) %= MOD;
		( ans += MOD - 1 ) %= MOD;
	}
	( ans *= calc(calc(2,N,MOD),MOD-2,MOD) ) %= MOD;
	cout << ans << endl;
}

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

using namespace std;

int main(void){
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int ans = 0;
    for(int r = 0; r * R <= N; r++){
        for(int g = 0; r * R + g * G <= N; g++){
            if((N - r * R - g * G) % B == 0) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define cu continue
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf LLONG_MAX
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second
#define vll vector <ll>
#define dbg(n) cout<<#n<<' '<<n<<endl;

bool isp(string s)
{
	bool f=1;
	ll n=s.length();
	for(ll i=0;i<n/2;i++)
	{
		if(s[i]!=s[n-i-1])
			f=0;
	}
	return f;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    


 	string s;
 	cin>>s;
 	ll n=s.length();
 	string s1="",s2="";
 	for(ll i=0;i<n/2;i++)
 		s1+=s[i];
 	for(ll i=n/2+1;i<n;i++)
 		s2+=s[i];
 	if(isp(s) && isp(s1) && isp(s2))
 		cout<<"Yes\n";
 	else
 		cout<<"No\n";
}       


Measured memory_bytes: 256
n = input()
N = []
for v in n:
    N.append(v)
for i in range(len(N)):
    if N[i] == '1':
        N[i] = '9'
    else:
        N[i] = '1'
answer = N[0] + N[1] + N[2]
print(int(answer))

Measured memory_bytes: 3060
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST

main :: IO ()
main = getLine >>= putStrLn . solve
solve :: String -> String
solve s = if go s then "Yes" else "No"
  where 
    odds = ['R', 'U', 'D']
    evens = ['L', 'U', 'D']
    go (s0:s1:ss) = if s0 `elem` odds && s1 `elem` evens
                    then go ss
                    else False
    go [] = True
    go (s:[]) = s `elem` odds
    


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

using namespace std;

int main(){
	int n,a,b,resp,count;
	scanf("%d",&n);
	count = 0;
	resp = 0;
	for(int i = 0;i < n;i++){
		scanf("%d %d",&a,&b);

		if(a == b)
			count++;
		else
			count = 0;

		if(count == 3){
			resp = 1;
		}
	}
	if(resp)
		puts("Yes");
	else
		puts("No");
}

Measured memory_bytes: 3680
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <complex>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
 
#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back
#define ll long long
 
const long long MAXN = 1e7 + 1;
const long long MOD = 1e9 + 7;
using namespace std;
 
typedef pair<int, int> pii;
 
 
long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

#define int ll

 main(){
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int M = readInt(), K = readInt();
    if (K == 0) {
        for (int i = 0; i < (1ll << M); i++) {
            cout << i << ' ' << i << ' ';
        }
        return 0;
    }
    if (K > (1ll << M)) {
        cout << -1;
        return 0;
    }
    int res = 0;
    for (int i = 0; i < (1 << M); i++) {
        if (i == K) continue; 
        res ^= i;
    }
    if (res != K) {
        cout << -1;
        return 0;
    }
    for (int i = 0; i < (1 << M); i++) {
        if (i == K) continue;
        cout << i << ' ';
    }
    cout << K << ' ';
    for (int i = (1 << M) - 1; i >= 0; i--) {
        if (i == K) continue;
        cout << i << ' ';
    }
    cout << K;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;

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


	ll a[3];
	for(int i = 0; i < 3; i++) {
		cin >> a[i];
	}

	ll ans = 1LL << 60;
	if(a[0] % 2 == 0) ans = ans = min(0LL, ans);
	else  ans = min(ans, a[1] * a[2]);
	if(a[1] % 2 == 0) ans = ans = min(0LL, ans);
	else  ans = min(ans, a[0] * a[2]);
	if(a[2] % 2 == 0) ans = ans = min(0LL, ans);
	else  ans = min(ans, a[0] * a[1]);

	cout << ans << endl;
}

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

int main() {
  ll x,k,d;
  cin >> x >> k >> d;
  ll a = llabs(x)/llabs(d);
  ll res=0;
  if (a>=k){
    res=llabs(x)-llabs(d)*k;
  }else{
    res=llabs(x)%llabs(d);
    if((k-a)%2==1) res-=d;
    res=llabs(res);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

int main(){
  char str[1001];
  scanf("%s", str);
  int ju[6] = {}, j;
  rep(i, strlen(str)){
    j = i;
    while(j > -1){
      switch(str[j]){
      case 'A': ju[0]++; break;
      case 'I': ju[1]++; break;
      case 'D': ju[2]++; break;
      case 'U': ju[3]++; break;
      case 'Y': ju[4]++; break;
      case 'N': ju[5]++; break;
      default : j = -10; break;
      }
      if(ju[0]==2&&ju[1]==1&&ju[2]==1&&ju[3]==1&&ju[4]==1&&ju[5]==2){
	str[i]='A'; str[i+1]='I';str[i+2]='Z';str[i+3]='U';str[i+4]='N';
	str[i+5]='Y';str[i+6]='A';str[i+7]='N';
	i += 7;
	break;
      }
      j++;
    }
    ju[0]=ju[1]=ju[2]=ju[3]=ju[4]=ju[5]=0;
  }
  puts(str);
  return 0;
}

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

int main(){

	int n = nxt();
	vector<long long> a(n);
	for (int i = 0; i < n; ++i) {
		a[i] = nxt();
	}

	long long s = accumulate(all(a), 0ll);
	long long t = 1ll * n * (n + 1) / 2;
	if (s % t) {
		puts("NO");
		return 0;
	}

	long long cnt = s / t;
	for (int i = 0; i < n; ++i) {
		a[i] -= cnt * (i + 1);
	}

	for (int i = 1; i < n; ++i) {
		if (a[i] > a[i - 1] || (a[i - 1] - a[i]) % n) {
			puts("NO");
			return 0;
		}
	}
	puts("YES");

	return 0;
}

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

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(32);

	ll n, a, b;
	cin>>n>>a>>b;
	if(a > b){
		cout<<0;
	}else if(a == b){
		cout<<1;
	}else if(n == 1){
		cout<<0;
	}else{
		cout<<(b - a)*(n - 2) + 1;
	}

	return 0;
}

Measured memory_bytes: 3648
using System;

namespace AOJ.Volume0
{
    class Parallelism
    {
        public static void Main()
        {
            int cnt = int.Parse(Console.ReadLine());
            for (int i = 0; i < cnt; i++)
            {
                var input = Console.ReadLine().Trim().Split(' ');
                decimal Ax = decimal.Parse(input[0]);
                decimal Ay = decimal.Parse(input[1]);
                decimal Bx = decimal.Parse(input[2]);
                decimal By = decimal.Parse(input[3]);
                decimal Cx = decimal.Parse(input[4]);
                decimal Cy = decimal.Parse(input[5]);
                decimal Dx = decimal.Parse(input[6]);
                decimal Dy = decimal.Parse(input[7]);
                // X軸を基準に並べ替え(AはBより左側、CはDより左側にする)
                if (Ax > Bx)
                {
                    Ax = decimal.Parse(input[2]);
                    Ay = decimal.Parse(input[3]);
                    Bx = decimal.Parse(input[0]);
                    By = decimal.Parse(input[1]);
                }
                if (Cx > Dx)
                {
                    Cx = decimal.Parse(input[6]);
                    Cy = decimal.Parse(input[7]);
                    Dx = decimal.Parse(input[4]);
                    Dy = decimal.Parse(input[5]);
                }
                // ABの傾きとCDの傾きが同じならば平行
                // X軸の差が0(垂直)の場合も考慮
                decimal diff_ab = Bx - Ax;
                decimal diff_cd = Dx - Cx;
                decimal gradient_1;
                decimal gradient_2;
                if (diff_ab == 0) { gradient_1 = -1; }
                else { gradient_1 = (By - Ay) / diff_ab; }

                if (diff_cd == 0) { gradient_2 = -1; }
                else { gradient_2 = (Dy - Cy) / diff_cd; }

                if (gradient_1 == gradient_2) { Console.WriteLine("YES"); }
                else { Console.WriteLine("NO"); }
            }
        }
    }
}

Measured memory_bytes: 5880
#include <iostream>

int main(int argc, char const* argv[]) {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    int A, B, C;
    std::cin >> A >> B >> C;
    std::cout <<  (A+B>=C ? "Yes" : "No")<< '\n';
    return 0;
}


Measured memory_bytes: 888
#include<stdio.h>
int main(){
    int n,i,ans=1,j,max,min;
    scanf("%d",&n);
    int p[n+1];
    for(i=1;i<=n;i++)
        scanf("%d",&p[i]);
    max=p[1];min=p[1];
    for(i=2;i<=n;i++){
        if(max<p[i]){
            max=p[i];
        }
        else if(min>p[i]){
            min=p[i];
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> v(n);
    for(int i = 0; i < n; ++i) {
        cin >> v[i];
    } 
    sort(v.begin(), v.end());
    string ans;
    for(int i = 0; i < n; ++i) ans += v[i];
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;

#define MIN(a,b) ((a)<(b)?(a):(b))

long long f(long long  N, long long  a, long long  b) {
	return a * N + b * ((N == 0 ? 1 : (long long)log10(N)) + 1);
}

bool isOK(long long   index, long long   key, long long  a, long long  b) {
	cerr << f(index, a, b) << ":" <<key<<":"<< index << endl;
	cerr << (f(index, a, b) <= key ? "OK" : "NG") << endl;;
	return f(index, a, b) <= key;
}

// 汎用的な二分探索のテンプレ
long long  binary_search(long long   key, long long  a, long long  b) {
	long long   ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	long long   ok = 10e9 + 1; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	long long index = -1;
	/* ok と ng のどちらが大きいかわからないことを考慮 */
	while (abs(ok - ng) > 1) {
		long long   mid = (ok + ng) / 2;
		if (isOK(mid, key, a, b)) ng = mid;
		else ok = mid;
		index = ng;
		cerr << index << ":" << ok << ":" << ng << endl;
	}
	return index;
}

int main() {
	string s,t;
	cin >> s;
	cin >> t;
	t.pop_back();
	if (s == t) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

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

int main(){
    int n, h[100005];
    cin >> n;
    rep(i,n) cin >> h[i];
    string ans = "Yes";
    int maxh = h[0];
    for(int i = 0; i < n; i++){
        if(h[i] < maxh - 1){
            ans = "No";
            break;
        }
        maxh = max(maxh, h[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    int w,h,n;
    cin >>w >>h >>n;

    vector<int> p(n);
    rep(i,n) cin >>p[i];

    int ux=1, uy=1;
    int udx=1, udy=0;

    int sx=1, sy=2;
    int sdx=1, sdy=0;

    int ans = 0;
    rep(i,n){
        if(p[i]==0){
            ux += udx;
            uy += udy;

            if(ux==w){
                udx = 0;
                udy = 1;
                if(uy==h){
                    udx = -1;
                    udy = 0;
                }
            }
        }
        else{
            sx += sdx;
            sy += sdy;

            if(sx==w-1){
                sdx = 0;
                sdy = 1;
                if(sy==h-1){
                    sdx = -1;
                    sdy = 0;
                }
            }
        }

        if(ux<0 || sx<0) break;
        if(abs(ux-sx)+abs(uy-sy) == 1) ++ans;
    }
    cout << ans << endl;
    return 0;
}



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

using namespace std;
typedef long long ll;

const int N = 3007;

double prob[N];

double memo[N][2 * N];
bool vis[N][2 * N];

double solve(int p, int s) {
    if(p < 0) {
        if(s > 0) return 1;
        else return 0;
    }

    double & st = memo[p][s + 3000];
    if(vis[p][s + 3000] == false) {
        vis[p][s + 3000] = true;
        st = prob[p] * solve(p-1, s+1) + (1 - prob[p]) * solve(p-1, s-1);
    }
    return st;
}

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

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

    cout << fixed << setprecision(10) <<  solve(n-1, 0) << endl;
}

Measured memory_bytes: 158208