akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a==b&&b==c)
        printf("1");
    if(a==b&&b!=c)
        printf("2");
    if(a==c&&a!=b)
        printf("2");
    if(b==c&&b!=a)
        printf("2");
    if(a!=b&&a!=c&&b!=c)
        printf("3");
    return 0;
}

Measured memory_bytes: 128
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
s = l()
s = list(set(s))
print("Yes" if len(s)==2 else "No")

Measured memory_bytes: 3064
#include<stdio.h>

int main() {
  int n, ans = 0;
  scanf("%d", &n);
  while (n--) {
    int l, r;
    scanf("%d %d", &l, &r);
    ans += r - l + 1;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MAXN 100010
#define LL long long
using namespace std;

int n;
LL a[MAXN];
int b[MAXN];
LL f[MAXN][3];

inline void update(LL &x,LL y){ if(y>x) x=y; }

int main(){
	scanf("%d",&n);
	b[1]=1;
	scanf("%lld",a+1);
	for(int i=2;i<=n;i++){
		char c;
		while((c=getchar())==' ');
		b[i]=(c=='+'?1:-1);
		scanf("%lld",a+i);
	}
	memset(f,0x88,sizeof f);
	f[1][0]=a[1];
	for(int i=2;i<=n;i++)
		if(b[i]==1){
			update(f[i][0],f[i-1][0]+a[i]);
			update(f[i][0],f[i-1][1]+a[i]);
			update(f[i][0],f[i-1][2]+a[i]);
			update(f[i][1],f[i-1][1]-a[i]);
			update(f[i][1],f[i-1][2]-a[i]);
			update(f[i][2],f[i-1][2]+a[i]);
		}else{
			update(f[i][0],f[i-1][0]-a[i]);
			update(f[i][1],f[i-1][0]-a[i]);
			update(f[i][0],f[i-1][1]-a[i]);
			update(f[i][1],f[i-1][1]+a[i]);
			update(f[i][2],f[i-1][1]+a[i]);
			update(f[i][0],f[i-1][2]-a[i]);
			update(f[i][1],f[i-1][2]+a[i]);
			update(f[i][2],f[i-1][2]+a[i]);
		}
	printf("%lld\n",max(max(f[n][0],f[n][1]),f[n][2]));
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <map>
using namespace std;

#define MAX_N 101

typedef long long int ll;

int N;
vector<int> ns;

map<int, ll> dp[MAX_N];

ll solve(int index, int acc) {
    if (index == N) {
        if (acc == 0) return 1;
        return 0;
    }
    if (acc < 0 || acc > 20) return 0;
    if (dp[index][acc] != 0) return dp[index][acc];
    return dp[index][acc] = solve(index+1, acc+ns[index]) + solve(index+1, acc-ns[index]);
}

int main() {
    cin >> N; ns.resize(N);
    for (int i = 0; i < N; i++) cin >> ns[i];
    cout << solve(1, ns[0]) << endl;
    return 0;
}

Measured memory_bytes: 1264
#include<bits/stdc++.h>
using namespace std;
#define I inline int
#define V inline void
#define B inline bool
#define ll long long int
#define isnum(ch) ('0'<=ch&&ch<='9')
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define gc (_op==_ed&&(_ed=(_op=_buf)+fread(_buf,1,100000,stdin),_op==_ed)?EOF:*_op++)
char _buf[100000],*_op(_buf),*_ed(_buf);
I getint(){
	int _s=0,_f=1;char _ch=gc;
	while(!isnum(_ch))(_ch=='-')&&(_f=-1),_ch=gc;
	while(isnum(_ch))_s=_s*10+_ch-48,_ch=gc;
	return _s*_f;
}
const int N=2e6+1;
int n;
I gcd(int x,int y){return!y?x:gcd(y,x%y);}
V input(){
	cin>>n;
	cout<<360/gcd(n,360);
}
V init(){
	
}
V work(){
	
}
int main(){
//	freopen("test.in","r",stdin);
	input();
	init();
	work();
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
	int k, n;
	cin >> k >> n;
	int a[n];
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	int x=k+a[0]-a[n-1];
	for(int i=1; i<n; i++){
		x=max(x, a[i]-a[i-1]);
	}
	cout << k-x;
}

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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

template<typename T> inline constexpr auto sqr(T x) { return (x) * (x); }
void printd(double x) { printf("%.10lf\n", x); }

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const int INF = INT_MAX;

signed main()
{
	string S;
	cin >> S;

	string Sunny("Sunny"), Cloudy("Cloudy"), Rainy("Rainy");
	if (S == Sunny) COL(Cloudy);
	else if (S == Cloudy) COL(Rainy);
	else COL(Sunny);

	return 0;
}

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

int main(void) {
    int N;cin>>N;
    set<string> st;
    for (int i = 0; i < N; i++) {
        string S;cin>>S;
        st.insert(S);
    }
    cout << st.size() << endl;
    return 0;
}

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

using namespace std;

#define ll long long

int main()
{
	string s;
	cin>>s;
	if(s[s.size()-1] == 's')
	{
		s.push_back('e');
		s.push_back('s');
	}
	else
	{
		s.push_back('s');	
	}
	cout<<s<<endl;
	return 0;
}

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

using namespace std;


int main() {
    int64_t n; cin>>n;
    string cat = "abcdefghijklmnopqrstuvwxyz";
    string ans = "";
    if(n <= 26){
        cout<<cat[n - 1]<<endl;
        return 0;
    }
    while(n){
        n -= 1;
        int rem = n%26;
        ans = cat[(rem + 26) % 26] + ans;
        n /= 26;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self):
        return len(self.roots())
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(M)]

AB = AB[::-1]

cnt = N*(N-1)//2
ans = [0]*M
uf = UnionFind(N)
for i in range(M):
    ans[i] = cnt
    A = AB[i][0]-1
    B = AB[i][1]-1
    if uf.same(A,B):
        continue
    else:
        cnt -= uf.size(A) * uf.size(B) # 解消される不便さ
        uf.union(A,B)
print(*ans[::-1])

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

using namespace std;

using lint = long long;

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

    lint A, B;
    cin >> A >> B;

    vector<lint> X(N);
    for (int i = 0; i < N; i++) {
        cin >> X[i];
    }

    lint ans = 0;
    lint move_max = B/A;

    for (int i = 1; i < N; i++) {
        lint dist = X[i] - X[i - 1];
        if (dist <= move_max) {
            ans += A*dist;
        } else {
            ans += B;
        }
    }

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(int)(n);++i)
using namespace std;
int main()
{
  int n,k,value=1;
  cin>>n>>k;
  
  for(int i=0;i<n;++i){
    if(value*2<=value+k)value*=2;
    else value+=k;
  }
  cout<<value<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,i,j,s1=0,s2=0,min,d;
    min = 10000;
    scanf("%d",&n);
    int w[n];

    for(i=0;i<n;i++){
        scanf("%d",&w[i]);
    }

    for(i=0;i<n;i++){
        s1 = 0; s2 =0;
        for(j=0;j<=i;j++){
            s1 += w[j];
        }
        for(j=i+1;j<n;j++){
            s2 += w[j];
        }
        d = s1 - s2;
        if(d<0) d = d * -1;
        if(d<min) min = d;
    }
    printf("%d\n",min);
}


Measured memory_bytes: 128
from collections import Counter
n=int(input())
f=[]
for i in range(n):
    s=input()
    f.append(s)
d=dict(Counter(f))
#print(d)
f=[]
kk=max(d.values())
for key,value in d.items():
    if value==kk:
        f.append(key)
f.sort()
for x in f:
    print(x)


Measured memory_bytes: 41712
#include <iostream>
#define rep(i , n) for(int i=0;i<n;i++)
using namespace std;

class DICE{
	int tmp , tmp2;
	public:
	int s[6];
	void turnE();
	void turnN();
	void turnS();
	void turnW();
	void turnR();
	void turnL();
	void SetT(int a , int b);
	void SetS(int a);
	void CheckDICE(int a1 , int a2, int a3, int a4 , int a5);
} ;

void DICE::turnE(){
	tmp=s[0];
	s[0]=s[3];
	s[3]=s[5];
	s[5]=s[2];
	s[2]=tmp;
}

void DICE::turnN(){
	tmp=s[0];
	s[0]=s[1];
	s[1]=s[5];
	s[5]=s[4];
	s[4]=tmp;
}

void DICE::turnS(){
	tmp=s[0];
	s[0]=s[4];
	s[4]=s[5];
	s[5]=s[1];
	s[1]=tmp;
}

void DICE::turnW(){
	tmp=s[0];
	s[0]=s[2];
	s[2]=s[5];
	s[5]=s[3];
	s[3]=tmp;
}

void DICE::turnR(){
	tmp=s[1];
	s[1]=s[2];
	s[2]=s[4];
	s[4]=s[3];
	s[3]=tmp;
}

void DICE::turnL(){
	tmp=s[1];
	s[1]=s[3];
	s[3]=s[4];
	s[4]=s[2];
	s[2]=tmp;
}

void DICE::SetS(int a){
	if(s[2]==a) {
		turnR();
	} else if (s[3]==a){
		turnL();
	} else if (s[4]==a){
		turnR();
		turnR();
	}
}

void DICE::SetT(int a , int b){ 
	tmp=a;
	tmp2=b;
	rep(i ,6){
		if(s[i]==a){
			switch(i){
				case 0:
					SetS(b);
					break;
				case 1:
					turnN();
					SetS(b);
					break;
				case 2:
					turnW();
					SetS(b);
					break;
				case 3:
					turnE();
					SetS(b);
					break;
				case 4:
					turnS();
					SetS(b);
					break;
				case 5:
					turnN();
					turnN();
					SetS(b);
					break;
			}
		}
	}	
}

void DICE::CheckDICE(int a1 ,int a2 , int a3 , int a4 , int a5){
	bool b=true;
	for(int i=1 ; i<5 ; i++){
		if(s[i]==a1){
			
			if(i==1){
				if(s[2]!=a2 || s[3]!=a3 || s[4]!=a4 || s[5]!=a5) {b=false; break;}
			} else if(i==2){
				turnR();
				if(s[2]!=a2 || s[3]!=a3 || s[4]!=a4 || s[5]!=a5) {b=false; break;}
			} else if(i==3){
				turnL();
				if(s[2]!=a2 || s[3]!=a3 || s[4]!=a4 || s[5]!=a5) {b=false; break;}
			} else if(i==4){
				turnL();
				turnL();
				if(s[2]!=a2 || s[3]!=a3 || s[4]!=a4 || s[5]!=a5) {b=false; break;}
			}
		}
	}
	if(b){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

int main(){
	DICE d1 , d2;
	rep(i ,6){
		cin >> d1.s[i];
	}
	rep(i ,6){
		cin >> d2.s[i];
	}
	rep(i , 6){
		if(d2.s[i]==d1.s[0]){
			switch(i){
				case 0:
					d1.CheckDICE(d2.s[1] , d2.s[2] , d2.s[3] , d2.s[4] , d2.s[5]);
					break;
				case 1:
					d2.turnN();
					d1.CheckDICE(d2.s[1] , d2.s[2] , d2.s[3] , d2.s[4] , d2.s[5]);
					break;
				case 2:
					d2.turnW();
					d1.CheckDICE(d2.s[1] , d2.s[2] , d2.s[3] , d2.s[4] , d2.s[5]);
					break;
				case 3:
					d2.turnE();
					d1.CheckDICE(d2.s[1] , d2.s[2] , d2.s[3] , d2.s[4] , d2.s[5]);
					break;
				case 4:
					d2.turnS();
					d1.CheckDICE(d2.s[1] , d2.s[2] , d2.s[3] , d2.s[4] , d2.s[5]);
					break;
				case 5:
					d2.turnN();
					d2.turnN();
					d1.CheckDICE(d2.s[1] , d2.s[2] , d2.s[3] , d2.s[4] , d2.s[5]);
					break;
			}
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;

int main()
{
	ios;
	int x;
	cin>>x;
	if(x==0) cout<<1<<"\n";
	else if(x==1) cout<<0<<"\n";
	return 0;
} 

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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;

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

constexpr long long mod = 1000000007;

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

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

    ll n, m;
    cin >> n >> m;

    ll t = max(m - 2 * n, 0LL);

    if (t == 0) {
        cout << m / 2 << endl;
    } else {
        cout << n + t / 4 << endl;
    }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  int n; cin >> n;
  vector<int> a(n); rep(i,n) cin >> a[i];
  vector<int> b(n);
  int cnt=0;
  if(n%2==0){
    rep(i,n){
      if(i==n/2) cnt=0;
      if(i<n/2) b[i] = a[n-1-cnt*2];
      else b[i] = a[cnt*2];
      cnt++;
    }
  }
  if(n%2==1){
    rep(i,n){
      if(i==n/2+1) cnt=0;
      if(i<n/2+1) b[i] = a[n-1-cnt*2];
      else b[i] = a[cnt*2+1];
      cnt++;
    }
  }
  
  rep(i,n) cout << b[i] << " ";
  
return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <string>
#include <map>
#include <vector>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define LargeNum 1000000007
typedef pair <double, double> P;

int main(){
    int N;
    map<string, bool> m;
    map<string, bool>::iterator it;
    cin >> N;
    string S;
    rep(i, N) {
        cin >> S;
        it = m.find(S);
        if(it==m.end())m.insert(pair<string, bool>(S, true));
    }
    cout << m.size() << endl;
    return 0;
}


Measured memory_bytes: 19228
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
def solve():
    n, q = map(int, input().split())


    ab = [tuple(map(int, input().split())) for i in range(n-1)]
    px = [tuple(map(int, input().split())) for i in range(q)]
    # ab.sort(key=lambda tup:(tup[0],tup[1]))

    cnt = [0]*(n+1)
    data = [[] for i in range(n+1)]

    for i in ab:
        data[i[0]].append(i[1])
        data[i[1]].append(i[0])
    for j in px:
        cnt[j[0]] += j[1]


    stack = [(1, 0)]

    while stack:
        v, parent = stack.pop()
        for to in data[v]:
            if to == parent:
                continue
            cnt[to] += cnt[v]
            stack.append((to, v))


    print(*cnt[1:])
    return

def main():
    solve()
    return
if __name__ == '__main__':
    main()


Measured memory_bytes: 99580
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


int check(int M, int K, vector<int> A){
  int N = A.size();
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      if(A[i] != A[j]) continue;
      int sum = 0;
      for(int k=i;k<=j;k++) sum ^= A[k];
      if(sum != K) return 0;
    }
  }
  return 1;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int M, K;
  cin>>M>>K;

  if(K >= (1<<(M)) || (M==1 && K == 1)){
    cout<<-1<<endl;
    return 0;
  }
  
  if(K == 0){
    vector<int>ans;
    for(int i=0;i<(1<<M);i++) ans.push_back(i), ans.push_back(i);
    cout<<ans<<endl;
    return 0;

  }

  int last = 0;
  for(int i=0;i<(1<<M);i++) if(i != K) last ^= i;

  if(last == K) last = 0;

  //pr(last);
  
  vector<int>ans(1<<(M+1));
  int l = 0, r = ans.size() - 1;
  ans[r--] = last;
  ans[r--] = K;
  ans[r--] = last;
  for(int i=0;i<(1<<(M));i++){
    if(i == last || i == K) continue;
    else ans[l++] = i, ans[r--] = i;
  }
  ans[l] = K;
  cout<<ans<<endl;
  //assert(check(M, K, ans));

    
  

  return 0;
}


Measured memory_bytes: 3956
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

LL n, k;
LL a[100010];

void init() {

}

void input() {
  cin >> n >> k;
  REP(i, n) cin >> a[i];
}

void solve() {
  LL max = 0;
  for(int i = 50; i >= 0; i--) {
    LL bit = 1LL << i;
    int cnt = 0;
    REP(j, n) if(a[j] & bit) cnt++;
    if (cnt <= n/2 && max+bit <= k) max += bit;
  }
  LL res = 0;
  REP(i, n) res += max^a[i];
  cout << res << endl;
}

int main() {
	init();
	input();
	solve();
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#define rep(S, L) for (int i = S; i < L; ++i)
using namespace std;

int main() {
  int d;
  cin >> d;
  cout << "Christmas";
  for (int i = 0; i < 25 - d; ++i) {
    cout << " Eve";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2964
n = int(input())

# 証言の内容をリストに保存
lst = []
for _ in range(n):
  a = int(input())
  lst.append([[int(i) for i in input().split()] for _ in range(a)])

m = 0
for i in range(2**n):
  flag = True
  for j in range(n):
    if i >> j & 1: # 2進数で見た場合に、101の場合、j=0,2が条件を満たす(101>>0=1,101>>1=10,101>>2=1
      for x,y in lst[j]:
        if (i >> (x-1)&1) != y: # 証言との整合確認 101>>1&1=0 yの結果と矛盾
          flag = False
          break
  '''
  011の場合、j=0,1の時、成立する
  j=0: [x,y]=[2,1], 011>>1&1=1, y=1, OK
  j=1: [x,y]=[1,1], 011>>0&1=1, y=1, OK
  '''
  if flag:
    m = max(m, sum(map(int, bin(i)[2:])))
print(m)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>

using namespace std;

int main() {
  string S; 
  int counter=0;
  int tmp=0; 
  
  cin >> S; 

  for(int i=0; i <(int)S.length(); i++){
    if(S[i]=='T'){
      if(tmp == 0){
	counter++;
	if(counter == (int)(S.length()/2)){
	  cout << counter*2 <<endl;
	  return 0;
	}
      }else{
	tmp--;
      }
    }else{
      tmp++;
    }
  }
  if(tmp!=counter)
    cout << "ERROR" << endl;

  cout << counter*2 <<endl;
  
  return 0;
}
  


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const ll mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, X;
    cin >> n >> X;
    vector<int> x(n);
    for(int i = 0; i < n; ++i)  cin >> x[i];
    x.push_back(X);
    sort(x.begin(), x.end());
    int res = 0;
    for(int i = 0; i < n; ++i)  res = __gcd(res, abs(x[i] - x[i+1]));
    cout << res << "\n";
}

Measured memory_bytes: 1024
N = int(input())
A = [int(i) for i in input().split()]

ct = 0
for i in range(N):
    if A[i] < 0:
        ct += 1
        A[i] *= -1

if ct % 2:
    ans = sum(A) - 2*min(A)
else:
    ans = sum(A)

print(ans)


Measured memory_bytes: 14412
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    while(true){
        ll H, W;
        cin >> H >> W;
        if(H == 0 && W == 0){ break; }
        REP(i, H){
            REP(j, W){
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3100
import sys
sys.setrecursionlimit(int(1e9))
mod = int((1e9) + 7)

S = input()
N = len(S)

p = [1] * (N+1)
for i in range(1, N+1):
    p[i] = p[i-1]
    if S[N-i] == '?':
        p[i] = p[i] * 3 % mod
p.reverse()

mem = [[0] * 3 for _ in range(N)]
used = [[0] * 3 for _ in range(N)]
ch = ['A', 'B', 'C']



def dfs(idx, num):
    if num == 3:
        return 1 * p[idx]
    
    if idx == N:
        return 0
    
    if used[idx][num]:
        return mem[idx][num]
    used[idx][num] = 1

    a, b = (0, 0);
    if S[idx] == '?':
        a = dfs(idx + 1, num + 1)    
        b = 3 * dfs(idx + 1, num)
    else:
        if S[idx] == ch[num]:
            a = dfs(idx + 1, num + 1)
        b = dfs(idx + 1, num)
        
    res = (a + b) % mod
    mem[idx][num] = res
    return res

ans = dfs(0, 0) % mod
print (ans)
    


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

#define lli long long int

int main(void)
{
	lli n, w;
	scanf("%lld %lld",&n, &w);
	
	lli we[n];
	lli va[n];
	lli val_sum = 0;
	lli index = 0;
	while (index < n)
	{
		scanf("%lld %lld",&(we[index]),&(va[index]));
		val_sum += va[index];
		index++;
	}
	lli dp[n+1][val_sum+1];
	index = 0;
	while (index < val_sum+1)
	{
		dp[0][index] = 2000*1000*1000;
		index++;
	}
	index = 0;
	while (index < n+1)
	{
		dp[index][0] = 0;
		index++;
	}
	lli i,j;
	i = 1;
	j = 0;
	while (i < n+1)
	{
		j = 1;
		while (j < val_sum + 1)
		{
			if (j - va[i-1] >= 0 && dp[i-1][j] > we[i-1] + dp[i-1][j-va[i-1]])
			{
				dp[i][j] = dp[i-1][j-va[i-1]] + we[i-1];
				//printf("dp:%lld, i: %lld, j:%lld\n",dp[i][j], i, j);
			}
			else if (j - va[i-1] < 0 && dp[i-1][j] > we[i-1])
			{
				dp[i][j] = we[i-1];
				//printf("dp:%lld, i: %lld, j:%lld\n",dp[i][j], i, j);
			}
			else
			{
				dp[i][j] = dp[i-1][j];
				//printf("dp:%lld, i: %lld, j:%lld\n",dp[i][j], i, j);
			}
			j++;
		}
		i++;
	}
	index = 0;
	while (index < val_sum)
	{
		if (w < dp[n][index])
		{
			printf("%lld\n",index-1);
			return (0);
		}
		index++;
	}
	printf("%lld\n",val_sum);
	return (0);
}


Measured memory_bytes: 79104
#pragma GCC diagnostic ignored "-Wunused-result"

#include <stdio.h>

int main(void) {
  int K;
  int ret;
  
  scanf("%d",&K);

  if (K%2 == 0) { // Even
    ret = (K/2)*(K/2);
  } else { // Odd
    ret = (K/2+1)*(K/2);
  }
  
  printf("%d\n",ret);
  return 0;

}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		long ans=Long.MAX_VALUE;
		long[] b=new long[n];
		if(s.charAt(0)=='#'){
			b[0]=1;
		}
		for(int i = 1; i<s.length(); i++){
			if(s.charAt(i)=='#'){
				b[i]=b[i-1]+1;
			}else{
				b[i]=b[i-1];
			}
		}
		for(int i = 0; i<s.length(); i++){
			ans=Math.min(ans,2*b[i]+s.length()-i-1-b[s.length()-1]);
		}
		ans=Math.min(ans,s.length()-b[s.length()-1]);
		System.out.println(ans);
	}
}


Measured memory_bytes: 30348
from collections import deque
d = deque()
S = input()
for i in S:
    d.append(i)
Q = int(input())
f = True
for i in range(Q):
    t = input()
    if t == "1":
        f = bool(not f)
    else:
        _, F, C = (a for a in t.split())
        if f:
            if F == "1":
                d.appendleft(C)
            else:
                d.append(C)
        else:
            if F == "1":
                d.append(C)
            else:
                d.appendleft(C)
if not f:
    d.reverse()
print("".join(d))


Measured memory_bytes: 8564
#include <bits/stdc++.h>
#define rep(i,n)  for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define deb(x) cerr << #x <<": " << x << '\n';
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long double ld;
typedef long long ll;

int main(){
    ios;
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    ll sum = 0;
    if(k < a) {cout << k; return 0;}
    k -= a;
    sum += a;
    if(k < b) {cout << sum; return 0;}
    k -= b;
    cout << sum - k;
    return 0;
}


Measured memory_bytes: 3636
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, c, k int
	fmt.Scan(&n, &c, &k)
	ar := make([]int, n)
	for i := range ar {
		fmt.Scan(&ar[i])
	}
	sort.Ints(ar)
	sum := 0
	nr := 0
	st := 0
	for _, v := range ar {
		if nr == 0 {
			sum++
			nr = c - 1
			st = v
		} else {
			if v <= st+k {
				nr--
			} else {
				sum++
				nr = c - 1
				st = v
			}
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 5504
#include<iostream>
#include<string>

using namespace std;

int main()
{
	string str;
	cin >> str;
	for (int i = 0; i < str.size() / 2; i++)
	{
		if (str[i] != str[str.length() - i - 1]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 384
using System;

namespace ITP1_4_C {
    class Program {
        static void Main(string[] args) {
            while(true){
                string[] s = Console.ReadLine().Split(' ');
                int a = int.Parse(s[0]);
                int b = int.Parse(s[2]);
                if(s[1] == "?")
                    break;
                switch(s[1]) {
                    case "+":
                        Console.WriteLine(a + b);
                        break;
                    case "-":
                        Console.WriteLine(a - b);
                        break;
                    case "*":
                        Console.WriteLine(a * b);
                        break;
                    case "/":
                        Console.WriteLine(a / b);
                        break;
                }
            }
        }
    }
}

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    int t[N+1], x[N+1], y[N+1];
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
    FOR(i, 1, N){
        cin >> t[i] >> x[i] >> y[i];
    }

    int dist_min;
    bool flag = true;
    REP(i, N){
    //最短経路
    dist_min = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);

    if(dist_min != t[i+1] - t[i]){
        if ((dist_min - (t[i+1] - t[i]))%2 != 0 or dist_min > t[i+1] - t[i]){
            flag = false;
            break;
        }
    }
    }

    if (flag == true){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1408
using System;

namespace ChokudaiScanner
{
    class MainClass
    {
        static void Main()
        {
            Scanner cin = new Scanner();
            string s = cin.Next();
            int ans = 0;

            if (s[0]=='1') ans++;
            if (s[1] == '1') ans++;
            if (s[2] == '1') ans++;

            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string Next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next();
            i = 0;
            return s[i++];
        }

        public string[] ArrayNext(int N)
        {
            string[] Array = new string[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Next();
            }
            return Array;
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong() + add;
            }
            return Array;
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble() + add;
            }
            return Array;
        }
    }
}



Measured memory_bytes: 11092
#include<stdio.h>

int main()

{
	
	int n;
	int k;
	int x;
	int y;
	
	scanf("%d",&n);
	scanf("%d",&k);
	scanf("%d",&x);
	scanf("%d",&y);
	
	
	if(k>=n){
		
			printf("%d\n",n*x);
	}
	if(n>k)
	{
		
			printf("%d\n",k*x+(n-k)*y);
	}

	
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n,ans,s[1000],b[1000];
int main()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>s[i];b[s[i]]=1;
}
for(int i=1;i<=100;i++)ans+=b[i];
cout<<ans;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D, w) for(auto vec : vec2D) { for (auto v : vec) cerr << setw(w) << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

const char en = '\n';

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

typedef ll Weight;
void add_edge(vector<vector<Weight>>& g, Weight from, Weight to, bool isDirected) {
	g[from].push_back(to);
	if (!isDirected) g[to].push_back(from);
}

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

int d = 365;

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

  cin >> d;
	int c[26];
	rep(i,26) cin >> c[i];
	// int s[365][26];
	vector<vector<int>> s(d, vector<int>(26));
	// int t[365];
	vector<int> t(d);
	set<int> last[26];
	rep(i,26) last[i].insert(-1);
	auto prevday = [&last, &t](int day,int contest) {
	  auto it = last[contest].lower_bound(day);
	  if (it == last[contest].end() || *it != day) return *prev(it);
	  else /*(*it == day)*/ return day;
	};

	rep(i,d) { 
	  int maxt = -1, maxix = -1;
	  rep(j,26) { 
		  cin >> s[i][j];
			if (chmax(maxt, s[i][j])) maxix = i;
		}
		t[i] = maxix;
	}

	//for B
	rep(i,d) { cin >> t[i]; t[i]--;} 

	rep(i,d) last[t[i]].insert(i);

	rep(i,26) { for(auto day : last[i])  cerr << day << " "; cerr << endl;}

	auto score = [&last, &c, &s, &t, &prevday]() {
		ll ret = 0;
		rep(i, d) {
		  ret += s[i][t[i]];
			rep(j,26) ret -= (ll) c[j]*(i - prevday(i,j));
			cout << ret << endl;
		}
		return ret;
	};

	score();
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=100005;
//i_am_noob
int n;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	print1(1110-n);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (int i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(int n, int k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}

int main() {
  int n;
  cin>>n;
  int ans=0;
  for(int i=1;i<=n;i++){
    int cnt=0;
    int ja=i;
    while(ja){
      cnt++;
      ja/=10;
    }
    if(cnt%2==1) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3560
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

function main()
  N, K = readint()
  A = readint()
  
  B = zeros(int,N)
  Nmax = 0
  for i in 1:K
    B = zeros(int,N)
    for j in 1:N 
      l=max(1,j-A[j])
      r=min(N,j+A[j])
      B[l] += 1
      r+1 <= N && (B[r+1] -=1)
    end
    for j in 2:N
      B[j] += B[j-1]
    end
    s = 0
    for j in 1:N
      if B[j] == N
        s+=1
      end
    end
    if s == N
      for j = 1:N
        print(N," ") 
      end
      println()
      return
    end
    A = B
  end
  for i in 1:N
    print(A[i]," ")
  end
  println()

        
  
end

main()

Measured memory_bytes: 243144
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.TreeSet;

import org.omg.Messaging.SyncScopeHelper;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new Test_100().doIt();
	}
	class Test_100{
		void doIt() {
			int M = sc.nextInt();
			int ans = 48 - M;
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll N;
  ll X,Y;
  ll cost=0;
  cin>>N;
  ll i,j;
  vector<ll> V(N);
  vector<ll> C(N);
  for(i=0;i<N;i++) cin>>V[i];
  for(i=0;i<N;i++) cin>>C[i];
  for(i=0;i<N;i++){
    if(V[i]-C[i]>0) cost+=V[i]-C[i];
  }
  cout<<cost<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll = long long;
#define endl '\n'
#define debug(name) DEBUG(#name, (name))
template<typename T>
void DEBUG(string label, T value) {
    cerr << "[" << label << " = " << value << "]\n";
}

void solve(){
    string s;
    cin >> s;
    int i = 0;
    int ans = 0;
    while(i < (int)s.size()){
        int j = i + 1;
        while(j < (int)s.size() && s[i] == s[j]){
            j++;
        }
        if(s[i] == 'R'){
            ans = max(ans, j - i);
        }
        i = j;
    }
    cout << ans << endl;
}
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    solve();
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
// #define int ll
using PII = pair<int, int>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) { 
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const int MOD = 998244353;

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

  ll n;
  long double a, d;
  cin >> n >> a >> d;

  long double ret = 0;
  n *= 2;
  while(n > 0) {
    ret += a + (n-1)/2.0*d;
    if(n == 2) break;

    long double na = (a*(n+2) + 5*d) / n;
    long double ne = (a*(n+2) + (n*n+n-7)*d) / n;
    long double nd = (ne - na) / (n-3);
        
    a = na;
    d = nd;
    n -= 2;
  }

  cout << fixed << setprecision(15) << ret << endl;

  return 0;
}


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

int n;
int m;
int low[100000];
int ord[100000];
bool used[100000];
vector<int> ans;
vector<int> es[100000];

void dfs(int v, int p, int &idx) {
    used[v] = true;
    low[v] = ord[v] = idx++;

    bool is_articulate = false;
    int cnt = 0;
    for (int i=0; i<es[v].size(); i++) {
        int u = es[v][i];

        if (!used[u]) {
            cnt++;
            dfs(u, v, idx);
            low[v] = min(low[v], low[u]);
            if (v != p && ord[v] <= low[u]) is_articulate = true;
        } else if (u != p) {
            low[v] = min(low[v], ord[u]);
        }
    }

    if (v == p && cnt > 1) is_articulate = true;
    if (is_articulate) ans.push_back(v);
}

int main() {
    scanf("%d%d", &n, &m);
    for (int i=0; i<m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        es[a].push_back(b);
        es[b].push_back(a);
    }

    int _ = 0;
    dfs(0, 0, _);
    sort(ans.begin(), ans.end());
    for (int i=0; i<ans.size(); i++) {
        printf("%d\n", ans[i]);
    }
}

Measured memory_bytes: 4904
#include <stdio.h>

int main(void)
{
    char des[200001];
    scanf("%s",des);
    int i;
    
    long long int sum=0;
    long long int bnum=0;
    
    for(i=0; des[i]!='\0'; i++){
        if(des[i] == 'B'){
            bnum++;
        }
        else{
            sum += bnum;
        }
    }
    printf("%lld\n",sum);
    
    return 0;
}


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

struct S{
  int co;
  string str;
  int z;
};
map<string,int>cnt;

void dfs(){;
  int d[2][3] = {{-1,1,4},{-1,1,-4}};
  queue<S> que;
  que.push((S){0,"01234567",0});
  while(!que.empty()){
    S s = que.front();que.pop();
    int co = s.co;
    string puzzu = s.str;
    string tmp;
    int z = s.z;
    if(cnt.count(puzzu) != 0)continue;
    cnt[puzzu]=co;
    for(int i = 0; i < 3; i++){
      if(!(z == 3 && z + d[z/4][i] == 4) && !(z == 4 && z + d[z/4][i] == 3) && z + d[z/4][i] >=0 && z + d[z/4][i] < 8){
	tmp = puzzu;
      	swap(tmp[z],tmp[z + d[z/4][i]]);
	que.push((S){co+1,tmp,z+d[z/4][i]});
      }	
    }
  }
}

int main(){
  string imput = "00000000";
  dfs();
  while(cin >> imput[0]){
    for(int i = 1;i < 8;i++){
      cin >> imput[i];
    }
    cout << cnt[imput] << endl;
  }
}

Measured memory_bytes: 3520
#include<iostream>
#include<string.h>
#include<ctime>
#include<fstream>
#include<vector>

using namespace std;
int main()
{
    int a,b,c,d,cnt=0;
    char s[4];
    cin>>s;
    a=s[0]-'0';
    b=s[1]-'0';
    c=s[2]-'0';
    d=s[3]-'0';
    if((a+b+c+d)==7)
    {
        cout<<a<<'+'<<b<<'+'<<c<<'+'<<d<<"=7";
        cnt++;
    }
    if((a+b+c-d)==7 && cnt==0)
    {
        cout<<a<<'+'<<b<<'+'<<c<<'-'<<d<<"=7";
        cnt++;
    }
    if((a+b-c+d)==7 && cnt==0)
    {
        cout<<a<<'+'<<b<<'-'<<c<<'+'<<d<<"=7";
        cnt++;
    }
    if((a+b-c-d)==7 && cnt==0)
    {
        cout<<a<<'+'<<b<<'-'<<c<<'-'<<d<<"=7";
        cnt++;
    }
    
    
    if((a-b+c+d)==7 && cnt==0)
    {
        cout<<a<<'-'<<b<<'+'<<c<<'+'<<d<<"=7";
        cnt++;
    }
    if((a-b+c-d)==7 && cnt==0)
    {
        cout<<a<<'-'<<b<<'+'<<c<<'-'<<d<<"=7";
        cnt++;
    }
    if((a-b-c+d)==7 && cnt==0)
    {
        cout<<a<<'-'<<b<<'-'<<c<<'+'<<d<<"=7";
        cnt++;
    }
    if((a-b-c-d)==7 && cnt==0)
    {
        cout<<a<<'-'<<b<<'-'<<c<<'-'<<d<<"=7";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
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> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }

const int Q_MAX = 100000;

int main() {
  vector<bool> primes(Q_MAX+1, true);
  primes.at(0) = false; primes.at(1) = false;
  int itmp = 2;
  int tmp = 2 * itmp;
  while (tmp <= Q_MAX){
    primes.at(tmp) = false; tmp += itmp;
  }
  for (int i=3; i<Q_MAX+1; i += 2){
    if (!primes.at(i)) continue;
    tmp = 2 * i;
    while (tmp <= Q_MAX){
      primes.at(tmp) = false; tmp += i;
    }
  }

  vector<int> likenums(Q_MAX+1);
  likenums.at(0) = 0;
  for (int i=1; i<=Q_MAX; i++){
    likenums.at(i) = likenums.at(i-1);
    if (i % 2 == 0) continue;
    if (primes.at(i) && primes.at((i+1)/2)) likenums.at(i)++;
  }

  int q; cin >>q;
  rep(i, q){
    int l,r; cin >>l >>r; l--;
    cout <<likenums.at(r) - likenums.at(l) <<endl;
  }
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+9
#define MOD 1000000007
using namespace std;

int main(){
    ll K,A,B;
    cin >> K >> A >> B;
    
    ll ans=1;
    K-=A;
    
    if(A-B<=0){
        if(K<=0){
            cout<<1<<endl;
        }else{
            cout<<-1<<endl;
        }
    }else{
        ans += 2*((K+A-B-1)/(A-B));
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 256