akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int a[100005][4];
int dp[100005][4];
int n;

int func(int ind, int flag) {

    if (ind == n) return 0;

    if (dp[ind][flag] != -1) return dp[ind][flag];

    int maxi = 0;
    if (flag == 0) {
        maxi = max(maxi, a[ind][1] + func(ind + 1, 1));
        maxi = max(maxi, a[ind][2] + func(ind + 1, 2));
        maxi = max(maxi, a[ind][3] + func(ind + 1, 3));
    }
    else if (flag == 1) {
        maxi = max(maxi, a[ind][2] + func(ind + 1, 2));
        maxi = max(maxi, a[ind][3] + func(ind + 1, 3));
    }
    else if (flag == 2) {
        maxi = max(maxi, a[ind][1] + func(ind + 1, 1));
        maxi = max(maxi, a[ind][3] + func(ind + 1, 3));
    }
    else {
        maxi = max(maxi, a[ind][1] + func(ind + 1, 1));
        maxi = max(maxi, a[ind][2] + func(ind + 1, 2));
    }

    return dp[ind][flag] = maxi;
}
int fdp()
{
    // dp[i][j] = max happiness from days 0 to i given that boy does j on the ith day
    vector<vector<int>> dp(n, vector<int>(4, -1));
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];
    dp[0][3] = a[0][3];
    for (int i = 1; i < n; i++)
    {
        for (int j = 1; j <= 3; j++)
        {
            dp[i][1] = a[i][1] + max( dp[i - 1][2], dp[i - 1][3]);
            dp[i][2] = a[i][2] + max(dp[i - 1][1], dp[i - 1][3]);
            dp[i][3] = a[i][3] + max(dp[i - 1][1], dp[i - 1][2]);
        }
    }
    return max(dp[n - 1][1], max(dp[n - 1][2], dp[n - 1][3]));
}
int main() {

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

    memset(dp, -1, sizeof dp);

    // cout << func(0, 0) << endl;
    cout << fdp();

    return 0;
}

Measured memory_bytes: 11860
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {
	os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T,class U> ostream& operator<<(ostream &os, const tuple<S,T,U> &t) { return os<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class S, class T,class U,class V> ostream& operator<<(ostream &os, const tuple<S,T,U,V> &t) { return os<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<","<<get<3>(t)<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#undef NUIP
#ifdef NUIP
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
#else
#define out
#endif
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
	ll n,a,b;
	cin>>n>>a>>b;
	ll d=abs(a-b);
	cout<<(d%2?"Borys":"Alice")<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String r = br.readLine();
		String[] cut = r.split(" ");

		String a = cut[0];
		String b = cut[1];
		String c = cut[2];

		char w = a.charAt(a.length() - 1);
		char x = b.charAt(0);
		char y = b.charAt(b.length() - 1);
		char z = c.charAt(0);

		System.out.println(w == x && y == z ? "YES" : "NO");

	}
}

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

#define all(x)        (x).begin(),(x).end()
#define eb            emplace_back
#define mp            make_pair
#define pb            push_back
#define fi            first
#define se            second
#define sz(x)         ((int)(x).size())
#define rep(x,y,z)    for(int x=y;x<z;x++)
#define per(x,z,y)    for(int x=z-1;x>=y;x--)
#define trav(y,x)     for(auto& y:x)
#define pii           pair<int, int>
#define pll           pair<ll, ll>
#define vi            vector<int>
#define vpi           vector<pii>

int dbg = 0;
#define cri           if(0)
#define shame         cri cerr<<(++dbg)<<"\n\n";

const ll mod = 1e9 + 7;
ll mod_mul(ll x, ll y) {
  ll pd = x * y % mod;
  if (pd < 0) pd += mod;
  return pd;
}
ll mod_add(ll x, ll y) {
  ll sm = x + y;
  if (sm >= mod) sm -= mod;
  if (sm < 0) sm += mod;
  return sm;
}
ll mod_pow(ll x, ll y) {
  ll z = 1;
  while (y) {
    if (y & 1)
      z = mod_mul(z, x);
    x = mod_mul(x, x);
    y >>= 1;
  }
  return z;
}

// aaaaaaaaaaaaaaaa
void solve() {
  int N, K;
  scanf("%d%d", &N, &K);
  
  int SZ = K + 1;
  vi sieve(SZ, 0);
  rep(i, 1, SZ) sieve[i] = i;
  rep(i, 1, SZ)
    for (int j = i << 1; j < SZ; j += i)
      sieve[j] -= sieve[i];
  
  ll ans = 0;
  rep(i, 1, SZ) {
    ll x = mod_pow(K / i, N);
    x = mod_mul(x, sieve[i]);
    ans = mod_add(ans, x);
  }
  printf("%lld\n", ans);
}

int main() {
  // int _; scanf("%d", &_); while (_--)
  solve();
	return 0;
}


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

int main(){
    int N;
    char S[100];

    cin >> N;
    cin >> S;

    int x=0,max=0;
    for(int i=0;i<N;i++){
        if(S[i]=='I') x++;
        else x--;

        if(max<x) max=x;
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<map>
#include<algorithm>
using namespace std;

struct Puz{
  int board[3][3];
  int zx, zy;
  int cnt;
  
  bool operator < (const Puz &p)const{
    for(int i = 0;i < 3;i++){
      for(int j = 0;j < 3;j++){
        if(board[i][j] == p.board[i][j]) continue;
        return board[i][j] > p.board[i][j];
      }
    }
    return false;
  }
  
  bool operator == (const Puz &p)const{
    for(int i = 0;i < 3;i++){
      for(int j = 0;j < 3;j++){
        if(board[i][j] != p.board[i][j]) return false;
      }
    }
    return true;
  }
};

int d[5] = {0, -1, 0, 1, 0};
Puz g = {{{1, 2, 3}, {4, 5, 6}, {7, 8, 0}}};
map<Puz, int> mem;

int bfs(Puz s){
  
  queue<Puz> Q;
  
  Q.push(s);
  mem[s] = 1;
  
  while(Q.size()){
    Puz p = Q.front(), q;
    Q.pop();
    
    if(p == g) return p.cnt;
    
    for(int i = 0;i < 4;i++){
      int x = p.zx + d[i], y = p.zy + d[i + 1];
      
      if(0 <= x && x < 3 && 0 <= y && y < 3){
        q = p;
        swap(q.board[q.zy][q.zx], q.board[y][x]);
        q.zy = y;
        q.zx = x;
        q.cnt++;
        if(!mem[q]++) Q.push(q);
      }
    }
  }
  
  return 0;
}

int main(){
  
  Puz s;
  
  for(int i = 0;i < 3;i++){
    for(int j = 0;j < 3;j++){
      cin >> s.board[i][j];
      if(s.board[i][j] == 0){
        s.zy = i;
        s.zx = j;
      }
    }
  }
  s.cnt = 0;
  
  cout << bfs(s) << endl;
  
  return 0;
}


Measured memory_bytes: 20532
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, m, ans = 0;

    vector<int> G[8];
    vector<int> a;

    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    for (int i = 1; i < n; i++) {
        a.push_back(i);
    }

    do {
        bool ok = true;
        for (int i = 0; i < n-1; i++) {
            bool tmp = false;
            if (!i) {
                for (auto e: G[0]) {
                    if (e == a[i]) { tmp = true; }
                }
            } else {
                for (auto e: G[a[i-1]]) {
                    if (e == a[i]) { tmp = true; }
                }
            }
            if (!tmp) { ok = false; }
        }
        if (ok) { ans++; }
    } while (next_permutation(a.begin(), a.end()));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	private static final int BASE = -2;
	public static void main(String[] args) {
	  FastReader sc = new FastReader();
	  int n = sc.nextInt();
	  int k = sc.nextInt();
	  int res = (int)(Math.ceil(n*1.0/k*1.0) - Math.floor(n*1.0/k*1.0));
	  System.out.println(res);
	  System.exit(0);
  }
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


Measured memory_bytes: 21204
#include<iostream>
#include<string>
#include<map>
#define int long long
using namespace std;

int n;
map<string, int> out[10];

signed main() {
cin >> n;
for(int i = 0; i < n; i++ ) {
string s; int p;
cin >> s >> p;
if ( out[s.length()].find(s) == out[s.length()].end() ) out[s.length()].insert(pair<string, int>(s, p) );
else out[s.length()][s] += p;
}

map<string, int>::iterator it;
for(int i = 0; i < 10; i++ ) {

for( it = out[i].begin(); it != out[i].end(); it++ )
cout << (*it).first << " " << (*it).second << endl;
}

return 0;
}

Measured memory_bytes: 1220
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);
		//int N = sc.nextInt();
    	//int M = sc.nextInt();
      	String S = sc.next();
      	//int list[] = new int[N];
      	//for(int i=0;i<N;i++){
        //	list[i] = sc.nextInt();
        //}
      	//Arrays.sort(list);
      	int cnt = 0;
		for(int i=0;i<4;i++){
        	if(S.charAt(i)=='+'){
            	cnt++;
            }else{
            	cnt--;
            }
        }
      	System.out.println(cnt);      	
    }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int H1, M1, H2, M2, K;
	cin >> H1 >> M1 >> H2 >> M2 >> K;
	cout << M2 - M1 + 60 * (H2 - H1) - K;
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>

#include<cstdio>

#include<algorithm>

#include<cstring>

#include<vector>

#include<queue>

#include<string>


using namespace std;


string str;


int main(void){
	cin >> str;
	int jc=0,oc=0,ic=0,res=0;
	for(int i=0;i<str.size();i++){
		if(str[i]=='J'){
			if(oc>0 || ic>0)jc=0;
			oc=0,ic=0;
			jc++;
		}
		if(str[i]=='O'){
			oc++;
			if(ic>0)jc=0;
			ic=0;
		}
		if(str[i]=='I'){
			ic++;
			if(min(jc,ic)>=oc)res=max(res,min(jc,min(oc,ic)));
		}
	}
	printf("%d\n",res);

	return 0;

}

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

int n, m;
int k[12], s[12][12];
int onoff[12];
int p[12];
int ans = 0;

void solve(int num) {
	if (num > n) {
		int i, j;
		for (i = 1; i <= m; i++) {
			int tmp = 0;
			for (j = 1; j <= k[i]; j++) {
				tmp += onoff[s[i][j]];
			}
			if ( tmp % 2 == p[i]) {
			}
			else {
				return;
			}
		}
		
/*
		cout << endl;
		for (i = 1; i <= n; i++) {
			cout << onoff[i] << " ";
		}
		cout << endl;
*/
		ans++;
	}
	else {
		onoff[num] = 0;
		solve(num + 1);
		onoff[num] = 1;
		solve(num + 1);
	}
}

int main()
{
	int i, j;
	cin >> n >> m;
	for (i = 1; i <= m; i++) {
		cin >> k[i];
		for (j = 1; j <= k[i]; j++) {
			cin >> s[i][j];
		}
	}

	for (i = 1; i <= n; i++) {
		onoff[i] = 0;
	}

	for (i = 1; i <= m; i++) {
		cin >> p[i];
	}
	solve(1);
	cout << ans << endl;
	return 0;
}


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

int main() {
	string S;
	cin >> S;
	string K = "keyence";
	for (int i = 0; i <= 7; i++) {
		if (S.substr(0, i) == K.substr(0, i) && S.substr(S.size() - (7 - i), 7 - i) == K.substr(i, 7 - i)) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

using namespace std;

const int INF = 1 << 30;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

struct Node {
	int key;
	Node *parent, *left, *right;
};
Node *root;

void insertKey(int k) {
	Node *z = (Node*)malloc(sizeof(Node));
	z->key = k;
	z->left = NULL;
	z->right = NULL;
	Node *y = NULL;
	Node *x = root;
	while (x) {
		y = x;
		if (z->key < x->key)
			x = x->left;
		else
			x = x->right;
	}
	z->parent = y;

	if (y == NULL)
		root = z;
	else if (z->key < y->key)
		y->left = z;
	else
		y->right = z;
}

Node* findKey(int k) {
	Node *p = NULL;
	Node *c = root;
	while (c) {
		p = c;
		if (k == c->key)
			return c;
		else if (k < c->key)
			c = c->left;
		else
			c = c->right;
	}
	return NULL;
}

Node* getMinimum(Node *x) {
	while (x->left != NULL)
		x = x->left;
	return x;
}

Node* getSuccessor(Node *x) {
	if (x->right != NULL)
		return getMinimum(x->right);
	
	Node *y = x->parent;
	while (y != NULL && x == y->right) {
		x = y;
		y = y->parent;
	}
	return y;
}

void deleteKey(int k) {
	Node *z = findKey(k);
	if (z == NULL) return;

	Node *y;	// Node to delete
	if (z->left == NULL || z->right == NULL)
		y = z;
	else
		y = getSuccessor(z);
	
	Node *x;	// Chile node
	if (y->left != NULL)
		x = y->left;
	else
		x = y->right;
	
	if (x != NULL)
		x->parent = y->parent;
	
	if (y->parent == NULL)
		root = x;
	else if (y == y->parent->left)
		y->parent->left = x;
	else
		y->parent->right = x;
	
	if (y != z)
		z->key = y->key;
}

void inParse(Node *n) {
	if (n == NULL) return;
	inParse(n->left);
	cout << ' ' << n->key;
	inParse(n->right);
}

void preParse(Node *n) {
	if (n == NULL) return;
	cout << ' ' << n->key;
	preParse(n->left);
	preParse(n->right);
}	

void printKey() {
	inParse(root);
	cout << endl;
	preParse(root);
	cout << endl;
}

int main() {
	int n; cin >> n;
	string com;
	rep(i, n) {
		cin >> com;
		if (com == "insert") {
			int k; cin >> k;
			insertKey(k);
		}
		else if (com == "print")
			printKey();
		else if (com == "find") {
			int k; cin >> k;
			if (findKey(k) != NULL)
				cout << "yes" << endl;
			else
				cout << "no" << endl;
		}
		else if (com == "delete") {
			int k; cin >> k;
			deleteKey(k);
		}
	}
}



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

using namespace std;

int a, b, c, ans    ;

int main () {
    scanf("%d%d%d", &a, &b, &c);
    int val = min (b, c);
    ans += val * 2;
    b -= val;
    c -= val;
    if (b)ans += b;
    else ans += min (a + 1, c);
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;

bool func(int n, int a, int b){
  int now = 0;
  while(n){
    now += n%10;
    n /= 10;
  }
  if(a <= now && now <= b) return true;
  return false;
}

int main(){
  int a,b; cin >> a >> b;
  string s; cin >> s;
  vector<char> chk(10);
  rep(i,10) chk[i] = i+'0';

  bool flg = true;
  for(int i = 0; i < a; i++){
    for(int j = 0; j < 10; j++){
      if(chk[j] == s[i]) break;
      if(j == 9) flg = false;
    }
  }
  if(s[a] != '-') flg = false;
  for(int i = a+1; i < a+b+1; i++){
    for(int j = 0; j < 10; j++){
      if(chk[j] == s[i]) break;
      if(j == 9) flg = false;
    }
  }
  if(flg) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main(){
    int ans=0;
    int n,d,x,ai;
    cin >> n >>d>>x;

    for (int i = 0; i < n; i++){
        cin >>ai;
        ans += (d+ai-1)/ai;
    }
    ans += x;
    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#define REP(i, t, n)  for (int i = t; i < n; i++)
#define ALL(n)        (n).begin(),(n).end()
#include <limits.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <functional>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <numeric>

#define INF (1000000000)

using namespace std;

typedef bool               BOOL;
typedef short              WORD;
typedef unsigned short     U_WORD;
typedef long               DWORD;
typedef unsigned long      U_DWORD;
typedef long long          QWORD;
typedef unsigned long long U_QWORD;


void solve_main()
{
	int x, a;
	cin >> x >> a;

	if (x < a) cout << 0 << endl;
	else cout << 10 << endl;
}

int main()
{
#ifdef FOR_IDE
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
#endif

	solve_main();
	return 0;
}


Measured memory_bytes: 256
///*Bismillahir Rahmanir Rahim***///
/***Stay_Home_Stay_Safe***/
///**Author Thasin Sheikh**///
#include<bits/stdc++.h>
using namespace std;
#define MAX 35000
#define MOD 1000000007
#define PI 3.14159265359
#define makefast__  ios_base::sync_with_stdio(false);
using ll=long long int  ;
using dl =double;
const int N = 2e5 + 10;
ll aarray[200000+10];
ll magic[101][101];
vector<ll>primes;
bool prime[1000001];
ll cxor(ll n)
{
    if(n%4==0)
        return n;
    if(n%4==1)
        return 1;

    if(n%4==2)
        return n+1;
    else return 0;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    makefast__
    string str;
    ll a,b,c,d,e,f,x,y,k,t,A=0,mod,B=0,L,j,i,l,r,m,n,C=0,ans,sum=0,sum1=0;
    vector<ll>v,v1;
    queue<ll>qu;
    cin>>n>>m;
    ans=cxor(n-1)^cxor(m);
    cout<<ans<<endl;





    return 0;
}


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

#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ldb long double 
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mp make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int MOD = 1e9+7;
const int MX = 2e5+5;
const ll INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n)
{
 ll res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a*=a;
  n/=2;
}
return res;
}

ll abst(ll a)
{
 return ((a<0)?(-1*a):(a));
}

int main()
{
   ll r,d,p;
   cin>>r>>d>>p;
   for(int i=0;i<10;i++)
   {
       ll res=r*p-d;
       cout<<res<<"\n";
       p=res;
   }
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

void solve() {
  int a, b; cin >> a >> b;
  if (a > b) swap(a, b);
  if (b - a <= 1) {
    cout << 2 * a - 2 << '\n';
  } else {
    int lb = 0, ub = b;
    while (ub - lb > 1) {
      int mid = (lb + ub) >> 1;
      (1LL * mid * mid < 1LL * a * b ? lb : ub) = mid;
    }
    cout << (1LL * lb * (lb + 1) < 1LL * a * b ? 2 * lb - 1 : 2 * lb - 2) << '\n';
  }
};

int main() {
  int q; cin >> q;
  while (q--) solve();
  return 0;
}


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

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	for (int i = 0; i < s.size(); i++) {
		bool flag = true;
		for (int j = 0; j < s.size(); j++) {
			if (s[(i + j) % s.size()] != t[j]) {
				flag = false;
			}
		}
		if (flag) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
//#include<iostream>
#include<cstring>
#include<cstdio>
//#include<time.h>
//#include<complex>
#include<set>
//#include<queue>
#include<algorithm>
#include<stdlib.h>
using namespace std;

#define LL long long
LL qread()
{
	char c; LL s=0; while ((c=getchar())<'0' || c>'9');
	do s=s*10+c-'0'; while ((c=getchar())>='0' && c<='9'); return s;
}

//Pay attention to '-' , LL and double of qread!!!!

int n; LL C;
#define maxn 200011
LL x[maxn],v[maxn];

LL ps[maxn],ss[maxn],pre[maxn],suf[maxn];

int main()
{
	scanf("%d",&n); C=qread();
	for (int i=1;i<=n;i++) {x[i]=qread(); v[i]=qread();}
	
	sort(x+1,x+1+n);
	for (int i=1;i<=n;i++) ps[i]=ps[i-1]+v[i]-x[i]+x[i-1];
	x[n+1]=C; for (int i=n;i;i--) ss[i]=ss[i+1]+v[i]-x[i+1]+x[i];
	
	for (int i=1;i<=n;i++) pre[i]=max(pre[i-1],ps[i]);
	for (int i=n;i>=1;i--) suf[i]=max(suf[i+1],ss[i]);
	
	LL ans=0;
	for (int i=0;i<=n;i++) ans=max(ans,pre[i]-x[i]+suf[i+1]);
	for (int i=1;i<=n+1;i++) ans=max(ans,suf[i]-C+x[i]+pre[i-1]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 7936
#include <cstdio>

int main (){
    int N,K;
    scanf("%d %d",&N,&K);
    int a[N];
    int count=0;
    for (int i = 0; i < N; i++){
        scanf("%d",&a[i]);
        if(a[i]>=K) count++;
    }
    printf("%d",count);
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main() {
  int n,m;
  cin>>n>>m;
  int *ans=new int[m];
  for(int i=0;i<m;i++){
    ans[i]=0;
  }
  for(int i=0;i<n;i++){
    int k;
    cin>>k;
    for(int j=0;j<k;j++){
      int like;
      cin>>like;
      ans[like-1]++;
    }
  }
  int count=0;
  for(int i=0;i<m;i++){
    if(ans[i]==n)count++;
  }
  cout <<count;
  return 0;
}

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

int main() {
  int N, sum = 0;
  cin >> N;
  
  for (int L, R, i = 0; i < N; i++) {
    cin >> L >> R;
    sum += R - L + 1;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String a = stdIn.next();
		String b = stdIn.next();
		String c = new String(a+b);
		int ab = Integer.parseInt(c);
		
		if(Math.sqrt(ab) == (int)Math.sqrt(ab)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}

}


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

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        String S = scanner.nextLine();
        int ans1 = 0;
        for (int i = 0; i < S.length(); i++) {
            if (i % 2 == 0 && S.charAt(i) == '1') {
                ans1++;
            }
            if (i % 2 == 1 && S.charAt(i) == '0') {
                ans1++;
            }
        }
        int ans2 = 0;
        for (int i = 0; i < S.length(); i++) {
            if (i % 2 == 0 && S.charAt(i) == '0') {
                ans2++;
            }
            if (i % 2 == 1 && S.charAt(i) == '1') {
                ans2++;
            }
        }


        System.out.println(Math.min(ans1, ans2));
    }

}

Measured memory_bytes: 28336
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX
#define eps LDBL_EPSILON
#define moder 100000
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0
using namespace std;
char c;
signed main() {
	cin>>c;
	if(c=='A')cout<<'T'<<endl;
	if(c=='C')cout<<'G'<<endl;
	if(c=='G')cout<<'C'<<endl;
	if(c=='T')cout<<'A'<<endl;
}

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

int main() {
  int N; string S; cin >> N >> S;
  int C[N+1]; C[0] = 0;
  for (int i = 0; i < N; i++) C[i+1] = C[i] + (S[i] == 'E');
  int min_change = N;
  for (int i = 0; i < N; i++)
    min_change = min(min_change, (i - C[i]) + (C[N] - C[i+1]));
  cout << min_change << endl;
}

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

string S;
long long Q;


int main(){
	cin >> S >> Q;

	bool rev = false;
	string head = "";
	string tail = "";


	for(long long i = 0; i < Q; i++) {
		long long op;
		cin >> op;
		if (op == 1) {
			rev = !rev;
		} else {
			long long tmp;
			char ch;
			cin >> tmp >> ch;

			if(tmp == 1) {
				if(rev) {
					tail += ch;
				} else {
					head += ch;
				}
			} else {
				if(rev) {
					head += ch;
				} else {
					tail += ch;
				}
			}
		}
	}


	if(rev) {
		reverse(tail.begin(), tail.end());
		cout << tail;
		reverse(S.begin(), S.end());
		cout << S;
		cout << head << endl;
	} else {
		reverse(head.begin(), head.end());
		cout << head;
		cout << S;
		cout << tail << endl;
	}
}


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

using namespace std;

typedef long long ll;

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

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

void add(ll &a, ll b) {
    a += b;
    if(a >= MOD) a -= MOD;
}

int main() {
    int n; cin >> n;
    auto dp = make_vec<ll>(n+1, 5, 5, 5);
    dp[0][0][0][0] = 1;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 5; j++) {
            for(int k = 0; k < 5; k++) {
                for(int l = 0; l <5; l++) {
                    for(int m = 1; m <5; m++) {
                        if(j == 1 && k == 2 && m == 3) continue;
                        if(j == 1 && l == 2 && m == 3) continue;
                        if(k == 1 && l == 2 && m == 3) continue;
                        if(k == 2 && l == 1 && m == 3) continue;
                        if(k == 1 && l == 3 && m == 2) continue;
                        add(dp[i+1][k][l][m], dp[i][j][k][l]);
                    }
                }
            }
        }
    }

    ll res = 0;
    for(int i = 1; i < 5; i++) {
        for(int j = 1; j < 5; j++) {
            for(int k = 1; k <5; k++) {
                add(res, dp[n][i][j][k]);
            }
        }
    }
    cout << res << endl;
}



Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
//	cout << fixed << setprecision(15);
	int a[3][3];
	rep(i, 3) rep(j, 3) cin >> a[i][j];

	int n;
	cin >> n;

	int b[10];
	rep(i, n) cin >> b[i];

	bool f[3][3];
	rep(i, 3) rep(j, 3) f[i][j] = false;
	rep(i, n) {
		rep(j, 3) rep(k, 3) {
			if(b[i] == a[j][k]) f[j][k] = true;
		}
	}

	int si[] = {0, 1, 2, 0, 0, 0, 0, 0};
	int sj[] = {0, 0, 0, 0, 1, 2, 0, 2};
	int di[] = {0, 0, 0, 1, 1, 1, 1, 1};
	int dj[] = {1, 1, 1, 0, 0, 0, 1, -1};
	for(int k = 0; k < 8; k++) {
		bool bingo = true;
		for(int l = 0; l < 3; l++) {
			int i = si[k] + l * di[k];
			int j = sj[k] + l * dj[k];
			bingo = bingo & f[i][j];
		}
		if(bingo) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


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

int main() {
  ll n,count=0,ans=0;
  cin>>n;
  vector<string> s(n);
  for(ll i=0; i<n; i++) {
    string t; cin>>t;
    sort(t.begin(),t.end());
    s[i] = t;
  }
  sort(s.begin(),s.end());
  for(ll i=0; i<n-1; i++){
    if(s[i]==s[i+1]) {
      count++;
      ans += count;
    }
    else count=0;
  }
  cout<<ans;
}

Measured memory_bytes: 5760
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<functional>
#include<cassert>
#include<cmath>
#include<math.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<vint> vvint;
#define PI 3.1415926535;


int main(void) {
	int a, b, x;
	double ans;
	cin >> a >> b >> x;
	if (a*a*b / 2.0 >= x) {
		double y;
		y = x*2.0/ (a * b);
		ans =(atan(double(b / y)) * 180.0) / PI;

		printf("%.9lf\n", ans);
		return 0;
	}
	else {
		x = a * a*b - x;
		double y;
		y = x * 2.0 / (a * a);
		ans = (atan(double(y / a)) * 180.0) / PI;

		printf("%.9lf\n", ans);
		return 0;
	}
}




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

int main(){
    int n,amari;
    cin >> n;
    amari = n % 10;
    if(amari == 2 ||amari == 4||amari == 5||amari == 7||amari == 9)cout << "hon" << endl;
    else if(amari == 0 ||amari == 1||amari == 6||amari == 8)cout << "pon" << endl;
    else cout << "bon" << endl;
}

Measured memory_bytes: 3532
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <random>
using namespace std;

int main() {
  int X;
  cin >> X;
  int q = X / 100;
  int m = X % 100;
  cout << (m <= 5 * q) << endl;
  return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
a.sort()
ans=0
for i in range(n):
  if m-a[i][1]>0:
    ans+=a[i][0]*a[i][1]
    m-=a[i][1]
  elif m-a[i][1]<=0:
    ans+=a[i][0]*m
    break
print(ans)

Measured memory_bytes: 27756
#include <stdio.h>

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	if (a<b){
		printf("a < b\n");
	} else if (a>b){
		printf("a > b\n");
	} else {
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <map>
#include <string>
using namespace std;

uint64_t gcd(uint64_t a, uint64_t b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

uint64_t lcm(uint64_t a, uint64_t b)
{
    return a * b / gcd(a, b);
}

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

    // cout << gcd(a, b) << endl;
    cout << (uint64_t)lcm(a, b) << endl;
    return 0;
}

Measured memory_bytes: 3640
#include"iostream"
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<list>
#include<map>
#include<string>
#include<algorithm> 
#include <queue> 
#include <sstream>
#include <fstream>
#include<cmath>
#define INF 100000000000
#define LL long long
using namespace std;
map<LL , LL> m;
vector<LL> v;
long long N, M, K, ans,A[200001],B[200001];



int main() {
	cin >> N>>K;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		B[A[i]]++;
	}
	for (int i = 1; i <= N; i++) {
		if (B[i] != 0) {
			v.push_back(B[i]);
			M++;
		}

	}
	sort(v.begin(), v.end());
	for (int i = 0; i < M-K; i++) {
		ans += v[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5492
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

int g[15][15];

int main() {
  int n;
  cin >> n;
  rep(i, n) rep(j, n) g[i][j] = -1;  //なにも証言していない
  rep(i, n) {
    int m;
    cin >> m;
    rep(j, m) {
      int a, x;
      cin >> a >> x;
      --a;
      g[i][a] = x;
    }
  }
  int ans = 0;
  // bit全探索
  rep(i, 1 << n) {
    vector<int> d(n);            //嘘つきか正直かを表す
    rep(j, n) if (i >> j & 1) {  // iのjbit目は1であるかどうか
      d[j] = 1;
    }
    bool ok = true;
    rep(j, n) {
      if (d[j]) {
        rep(k, n) {
          if (g[j][k] == -1) continue;
          if (g[j][k] != d[k]) ok = false;
        }
      }
    }
    if (ok) ans = max(ans, __builtin_popcount(i));
  }
  cout << ans << endl;
  return 0;
}

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

void printArray(std::string A[], int N){
  for (int i = 0; i < N; i++) {
    std::cout << A[i];
    if (i!=N-1) {
      std::cout << " ";
    }
  }
  std::cout <<'\n';
}


std::string* bubbleSort(std::string A[], int n){
  int flag=1;
  int cnt=0;
  int sorted_i=0;
  while (flag) {
    flag=0;
    for (int i = n-1; i > sorted_i; i--) {
      if(A[i-1][1] > A[i][1]){
        std::swap(A[i-1], A[i]);
        cnt++;
        flag=1;
      }
    }
    sorted_i++;
  }
  return A;
}


std::string* selectionSort(std::string A[], int n){
  int min_j;
  int cnt=0;
  for (int i = 0; i < n; i++) {
    min_j = i;
    for (int j = i; j < n; j++) {
      if (A[j][1] < A[min_j][1]) {
        min_j = j;
      }
    }
    if(i!=min_j){
      std::swap(A[min_j], A[i]);
      cnt++;
    }
  }
  return A;
}


int main(void){
  int n;
  std::cin >> n;

  std::string* A = new std::string[n];
  std::string* B = new std::string[n];
  std::string* C = new std::string[n];

  for (int i = 0; i < n; i++) {
    std::cin >> A[i];
    B[i] = A[i];
    C[i] = A[i];
  }

  B = bubbleSort(B,n);
  printArray(B,n);
  std::cout << "Stable" << '\n';

  C = selectionSort(C,n);
  printArray(C,n);

  for (int i = 0; i < n; i++) {
    if(B[i]!=C[i]){
      std::cout << "Not stable" << '\n';
      return 0;
    }
  }
  std::cout << "Stable" << '\n';

  return 0;
}



Measured memory_bytes: 3144
N, M = map(int, input().split())
S = []
C = []
for i in range(M):
    s, c = map(int, input().split())
    S.append(s)
    C.append(c)

for i in range(10000):
    tmp = str(i)
    if len(tmp)!=N:
        continue
    flag = True
    for j in range(M):
        if int(tmp[S[j] - 1]) != C[j]:
            flag = False
    if flag == True:
        print(tmp)
        exit()
else:
    print(-1)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	int K, X;
	cin >> K >> X;
	for (int i = X - K + 1; i <= X + K - 1; i++) {
		cout << i << " ";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
int main()
{
	int n;
	cin >> n;
	std::vector<double> dp(n+1);

	//dp[i] - probablity that there are i heads so far

	dp[0] = 1;
	for (int coin = 1; coin <= n; ++coin)
	{
		double p_heads;
		cin >> p_heads;
		for (int i = coin; i >= 0; --i)
		{
			dp[i] = dp[i-1] * p_heads + dp[i] * (1 - p_heads);
		}
	}
	double answer = 0;
	for (int heads = 0; heads <= n; ++heads)
	{
		int tails = n - heads;
		if (heads > tails)
		{
			answer += dp[heads];
		}
	}
	printf("%.10lf\n", answer);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int H, W, h, w, masu, siro;

	scanf("%d %d", &H, &W);
	scanf("%d %d", &h, &w);

	masu = H * W;
	siro = (H - h)*(W - w);

	printf("%d\n", siro);

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int w[10],k[10],wsum=0,ksum=0,i;
	for(i=0;i<10;i++) cin>>w[i];
	for(i=0;i<10;i++) cin>>k[i];
	sort(w,w+10); sort(k,k+10);
	for(i=9;i>=7;i--) {
		wsum+=w[i]; ksum+=k[i];
	}
	cout<<wsum<<' '<<ksum<<endl;
	return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)((n) - 1); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define sqrt sqrtl
#define fill(x,y) memset(x,y,sizeof(x))
#define debug(x) cout << #x << ":" << x << endl
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
int main(){
    intl a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    fp(!(a[0] + a[1] - a[2]));
    return 0;
}

Measured memory_bytes: 256
// AOJ 2177: Champernowne Constant
// 2017.11.5 bal4u@uu

#include <stdio.h>
#include <string.h>

long long len[10];
int ten[10] = {1};

char *putint(char *p, int n)
{
	char *q;
	static char tmp[13] = {0};

	q = tmp; while (n >= 10) {
		*++q = '0' + (n % 10);
		n /= 10;
	}
	*p++ = n + '0';
	while (*q) *p++ = *q--;
	return p;
}

int main()
{
	int n, k, i, j, num;
	long long nine;
	char buf[200], *p, *top;

	for (nine = 9, i = 1; i < 10; i++, nine *= 10) len[i] = i*nine, ten[i] = ten[i-1]*10;
	for (i = 1; i < 10; i++) len[i] += len[i-1];

	while (scanf("%d%d", &n, &k) && n > 0) {
		for (i = 1; len[i] < n; i++);
		j = n - (int)len[i-1] - 1;
		num = ten[i-1] + j / i;
		top = buf + j % i;
		p = putint(buf, num);
		while (p-top < k) p = putint(p, ++num);
		*(top+k) = 0;
		puts(top);
	}
	return 0;
}

Measured memory_bytes: 1740
prices = [ int(p) for p in input().split(" ") ]
N = int(input())

total_price = 0

p1 = {"0.25": prices[0],  "0.5": prices[1], "1": prices[2], "2": prices[3]}
p2 = {"0.25": prices[0] * 8,  "0.5":prices[1] * 4, "1":prices[2] * 2, "2":prices[3]}
min_price = sorted(p2.items(), key=lambda x:x[1])

for item in min_price:
  if N >= float(item[0]):
    buy_num = int(N / float(item[0]))
    total_price += p1[item[0]] * buy_num
    N -= int(float(item[0]) * buy_num)
    #print(total_price, buy_num, N)
    
  if N == 0:
    break

print(total_price)


Measured memory_bytes: 9168
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;

#define MAX_V 100000

int V, E;
vector<int> G[MAX_V];
bool visited[MAX_V];
int prenum[MAX_V];
int parent[MAX_V];
int lowest[MAX_V];
int timer, root;

void add_edge(int from, int to) {
  G[from].push_back(to);
  G[to].push_back(from);
}

void dfs(int u, int prev) {
    prenum[u] = timer;
    lowest[u] = timer;
    timer++;

    visited[u] = true;

    for(int i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      if(!visited[v]) {
        parent[v] = u;
        dfs(v, u);
        lowest[u] = min(lowest[u], lowest[v]);
      } else if(v != prev) {
        lowest[u] = min(lowest[u], prenum[v]);
      }
    }

}

int main () {
  cin >> V >> E;
  for(int i = 0; i < E; i++) {
    int v1, v2;
    cin >> v1 >> v2;
    add_edge(v1, v2);
  }

  for(int i = 0; i < V; i++) {
    visited[i] = false;
  }
  root = 0;
  timer = 1;
  dfs(root, -1);

  set<int> ans;
  // (1)
  int num = 0;
  for(int i = 0; i < V; i++) {
    if(i == root) continue;
    if(parent[i] == root) num++;
  }
  if(num >= 2) ans.insert(root);

  // (2)
  for(int i = 0; i < V; i++) {
    if(i == root || parent[i] == root) continue;
    else if(prenum[parent[i]] <= lowest[i])
      ans.insert(parent[i]);
    // cout << i << endl;
  }

  set<int>::iterator it = ans.begin();
  while(it != ans.end()) {
    cout << *it << endl;
    it++;
  }

}

Measured memory_bytes: 5128
print("".join([ [ [ "{0}\n".format(NQ_S[2][LR[1]-1]-NQ_S[2][LR[0]-1]) for LR in  [list(map(int, input().split())) for i in range(NQ_S[0][1])]] for x in [[NQ_S[2].append(NQ_S[2][i-1]+1) if NQ_S[1][0][i-1]=='A' and NQ_S[1][0][i]=='C' else NQ_S[2].append(NQ_S[2][i-1]) for i in range(1,len(NQ_S[1][0]))]]] for NQ_S in [[[int(x) for x in input().split()],[str(x) for x in input().split()],[0]]] ][0][0])[:-1])

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

int a[11];
string s;

int main()
{
	cin>>s;
	int size=s.size();
    long long ans=0;
	for(int t=0;t<(1<<(size-1));t++)
	{
	long long num=s[0]-'0';
	 for(int i=0;i<size-1;i++)
	 {
	  if(t&(1<<i))
	  ans+=num,num=0;
	  num=num*10+s[i+1]-'0';
	  }
	 ans+=num;
	 }
	 cout<<ans<<endl; 
 return 0;} 

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<stdio.h>
#include<queue>
#include<map>
#include<stack>
using namespace std;
int dx[] = { -1,0,0,1,-1,-1,1,1,0 };
int dy[] = { 0,1,-1,0,1,-1,1,-1,0 };
/*
int main()
{
	int r, c;
	cin >> r >> c;
	int sy, sx, gy, gx;
	vector<vector<char>>field(r,vector<char>(c));
	sy--, sx--, gy--, gx--;
	for (int i = 0; i < r; i++)
	{
		for (int j = 0; j < c; j++)
		{
			cin >> field[i][j];
		}
	}
	queue<pair<int,int>>q;
	q.push({ sx,sy });
	vector<vector<int>>d(c, vector<int> (r, -1));
	d[sx][sy] = 0;

	while (!q.empty())
	{
		pair<int, int>p = q.front;
		q.pop();
		for (int i = 0; i < 4; i++)
		{
			int nx = p.first + dx[i], ny = p.second + dy[i];
			if (nx < 0 || ny < 0 || nx >= c || ny >= r || d[nx][ny] != -1 || field[nx][ny] == '#')continue;
			q.push({ nx,ny });
			d[nx][ny] = d[p.first][p.second] + 1;
		}
	}

	cout << d[gx][gy] << endl;
}*/


int main() 
{
	int n;
	cin >> n;
	int ans=1;
	while (ans <= n)
	{
		ans = ans * 2;
	}

	ans = ans / 2;

	cout << ans << endl;

}



Measured memory_bytes: 3184
fun main(args: Array<String>) {
    val n = readLine()!!.split(" ").map { it.toInt() }[0]
    var keihinArray: Array<String> = Array(n){""}
    for (i in 0 until n){
        val s = readLine()!!.split(" ")[0]
        keihinArray[i] = s
    }
    val ansArray: Set<String> = keihinArray.toSet()
    val ans = ansArray.size
    println(ans)

}

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

using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


const int DIGIT = 50;


int main()
{
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<vector<ll>> dp(100, vector<ll>(2, -1));
    for(int i = 0; i < n; i++)cin >> a[i];
    dp[0][0] = 0;

    for(int d = 0; d < DIGIT; d++){
        ll mask = (1LL << (DIGIT - 1 - d));

        int cnt = 0;
        for(int i = 0; i < n; i++)if(a[i] & mask)cnt++;

        ll cost0 = mask * cnt;
        ll cost1 = mask * (n - cnt);

        if(dp[d][1] != -1){
            chmax(dp[d + 1][1], dp[d][1] + max(cost0, cost1));
        }

        if(dp[d][0] != -1){
            if(k & mask){
                chmax(dp[d + 1][1], dp[d][0] + cost0);
            }
        }

        if(dp[d][0] != -1){
            if(k & mask)chmax(dp[d + 1][0], dp[d][0] + cost1);
            else chmax(dp[d + 1][0], dp[d][0] + cost0);
        }
    }

    cout << max(dp[DIGIT][0], dp[DIGIT][1]) << endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=2e3+50;
int n,s[100005],s1[100005],ans;
map<int,int> dem,used;
signed main() {
	scanf("%lld",&n);
	for(int i=0;i<n;i++){
		scanf("%lld",&s[i]);
		int x=s[i];
		s[i]=s1[i]=1;
		for(int j=2;j<=maxn;j++){
			if(x%j==0){
				int cnt=0;
				while(x%j==0){
					x/=j;
					cnt++;
				}
				if(cnt%3==1){
					s[i]*=j;
					s1[i]*=j*j;
				}else if(cnt%3==2){
					s[i]*=j*j;
					s1[i]*=j;
				}
			}
		}
		if(x!=1){
			int y=ceil(sqrt(x));
			s[i]*=x;
			if(y*y==x) s1[i]*=y;
			else s1[i]*=x*x;
		}
		dem[s[i]]++;
	}
	for(int i=0;i<n;i++){
		if(!used[s[i]]){
			used[s[i]]=used[s1[i]]=1;
			if(s[i]==1) ans++;
			else ans+=max(dem[s[i]],dem[s1[i]]);
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 26752