akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
  
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

ll N, X;
ll a[55], p[55];

ll solve(ll N, ll X){
    if(N==0) return 1;

    if(X==1) return 0;
    else if(X <= 1+a[N-1]) return solve(N-1, X-1);
    else if(X == 1+a[N-1]+1) return p[N-1]+1;
    else if(X <= 1+a[N-1]+1+a[N-1]) return p[N-1]+1+solve(N-1, X-a[N-1]-2);
    else return p[N];
}

int main(){
    cin >> N >> X;
    a[0] = 1;
    p[0] = 1;

    for(int i=1; i<=N; i++) { a[i] = 2*a[i-1]+3; p[i] = 2*p[i-1]+1; }
    
    cout << solve(N, X) << endl;
}

Measured memory_bytes: 256
n,m,x,y=map(int,input().split())
xlist=list(map(int,input().split()))
xlist=sorted(xlist)
ylist=list(map(int,input().split()))
ylist=sorted(ylist)

flag=False
for i in range(x+1,y+1):
  if xlist[-1] < i <= ylist[0]:
    flag=True
    break
if flag:
  print('No War')
else:
  print('War')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F(i,s,e) for(ll i=s;i<e;++i)

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

    int sum=0;
    F(i,0,n.size()){
        sum += n[i] - '0';
    }
    if(sum%9==0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3748
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
	int cnt[26] = {};
	string S;
	cin >> S;
	for (auto c : S) cnt[c-'a']++;

	for (auto i : cnt) {
		if (i % 2 != 0) {
			printf("No\n");
			return 0;
		}
	}

	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
                
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define max2(a,b) ((a)>(b) ? (a) : (b))   
#define min2(a,b) ((a)<(b) ? (a) : (b)) 
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i) 
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lli long long int 
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000

using namespace std;
typedef vector<lli>   vll;
typedef vector<int>   vi;
typedef set<lli>      sll;
typedef set<int>      si;
typedef pair<lli,lli> pll;
typedef pair<int,int> pii;
clock_t clk=clock();       
void solve(void);

int main()
{
  speedio;
   int t=1;  
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
//

void solve()
{
	double n,k,i,j; cin>>n>>k;
	double ans=0.0;
	rep(i,1,n)
	{
		double temp=0.0;

		if(i>=k) 
		{
			ans+=(1/(n));
			continue;
		}

		lli val=log2(k/double(i));
		if(k-pow(2,val)*i<=0.0000000000001)
		{}
	    else 
			++val;
		
          temp=1/n;
          temp/=pow(2,val);
          ans+=temp;
	}
	cout<<fixed<<setprecision(12)<<ans;
	cout<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int N;
  cin>>N;
  int c=0;
  REP(i,1,N){
    int j = N-i;
    if(i!=j)c++;
  }
  cout<<c/2<<endl;

  return 0;
}


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

int draw(int h,int w){
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if((i+j)%2!=1){
                cout << '#';
            }else{
                cout << '.';
            }  
        }
        cout << endl;
    }
    cout << endl;
    return 0;
}

int main(){
    int h[300];
    int w[300];
    int cnt;
    for(int i=0;;i++){
        cin >> h[i] >> w[i];
        cnt = i;
        if(h[i] == 0 && w[i] == 0){
            break;
        }
    }
    for(int i=0;i<cnt;i++){
        draw(h[i],w[i]);
    }
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/


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

int main() {
  char x,y;
  cin>>x>>y;
  if(x>y){
    cout<<'>'<<endl;
  }
  else if(x<y){
    cout<<'<'<<endl;
  }
  else {
    cout<<'='<<endl;
  }
}

Measured memory_bytes: 256
// Problem : E - Logs
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#define int long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define MOD 1000000007
#define mod 998244353
#define bug cout<<"HY"<<endl
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define numize(A) A.numize(unique(A.begin(), A.end()) - A.begin())
typedef pair<int,int> P;
int power(int a,int b)
{
    if(b==0)
        return 1;
    if(b%2==0)
        return (power((a*a)%mod,b/2))%mod;
    return (a*(power((a*a)%mod,b/2))%mod)%mod;
}
int modInv(int n)
{
    return power(n, MOD-2);
}
int nCr(int n, int r, int p=MOD)
{
   if (r==0)
      return 1;
    int Fact[n+1];
    Fact[0] = 1;
    for (int i=1 ; i<=n; i++)
    {
        Fact[i] = (Fact[i-1]*i)%p;
    }
    return (((Fact[n]* modInv(Fact[r])) % MOD) *(modInv(Fact[n-r]) % MOD)) % MOD;
}
double PI=3.14159265359;
void solve()
{
	int n,k,i;
	cin>>n>>k;
	int A[n];
	for(i=0;i<n;i++)
		cin>>A[i];	
	sort(A,A+n);
	int low=1,high=A[n-1],ans=0;
	while(low<high)
	{
		int mid=(low+high)/2;
		int cnt=0;
		for(i=0;i<n;i++)
		{
			int num=(A[i]-1)/mid;
			cnt+=num;
		}
		if(cnt>k)
		{
			low=mid+1;
		}
		else
		{
			high=mid;
		}
	}
	cout<<low<<endl;
}
int32_t main()
{
    boost;
    int  t=1;
    // cin>>t;
    while(t--)
    {
    	solve();
    }
}


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

int main(){
  int n;
  cin>>n;
  
  string a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  
  sort(a,a+n);
  
  int count=1;
  
  for(int i=0;i<n-1;i++){
    if(a[i]!=a[i+1]){
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 9844
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        private static long mod = 1000000007;
        static void Main(string[] args)
        {
            //var line = ReadLine().Split(' ').Select(value => long.Parse(value)).ToArray();
            //var x = line[0];
            //var y = line[1];
            var n = long.Parse(ReadLine());
            n = 1000 - n % 1000;
            if(n == 1000)
            {
                n = 0;
            }
            WriteLine(n);
        }
    }
}


Measured memory_bytes: 17624
w, h, n = list(map(int, input().split()))

s_w = [0, w]
s_h = [0, h]
for _ in range(n):
    x, y, a = list(map(int, input().split()))
    if a == 1 and x > s_w[0]:
        s_w[0] = x
    elif a == 2 and x < s_w[1]:
        s_w[1] = x
    elif a == 3 and y > s_h[0]:
        s_h[0] = y
    elif a == 4 and y < s_h[1]:
        s_h[1] = y

ans_w = s_w[1] - s_w[0]
ans_h = s_h[1] - s_h[0]
print((ans_w * (ans_w > 0)) * (ans_h * (ans_h > 0)))

Measured memory_bytes: 9140
#include <iostream>
using namespace std;
int main(){
	int n;
	while(cin >> n,n){
		//dice = {u,l,r,d};
		int center = 1, dice[4] = {5,4,3,2}, res = 1;
		while(n--){
			string siji;
			cin >> siji;
			int tmp = center;
			if(siji == "North"){				
				center = dice[3];
				dice[0] = tmp;
				dice[3] = 7 - tmp;
			}
			if(siji == "South"){				
				center = dice[0];
				dice[0] = 7 - tmp;
				dice[3] = tmp;
			}
			if(siji == "East"){				
				center = dice[1];
				dice[1] = 7 - tmp;
				dice[2] = tmp;
			}
			if(siji == "West"){				
				center = dice[2];
				dice[1] = tmp;
				dice[2] = 7 - tmp;
			}
			if(siji == "Left"){
				tmp = dice[0];
				dice[0] = dice[2];
				dice[2] = dice[3];
				dice[3] = dice[1];
				dice[1] = tmp;
			}
			if(siji == "Right"){
				tmp = dice[0];
				dice[0] = dice[1];
				dice[1] = dice[3];
				dice[3] = dice[2];
				dice[2] = tmp;
			}
			res += center;
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 0
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)
INF = 1 << 60


def input():
    return stdin.readline().strip()


X, Y = map(int, input().split())

n = (X + Y) // 3
x = (2 * X - Y) // 3
y = (-X + 2 * Y) // 3
if (X + Y) % 3 or x < 0 or y < 0:
    print(0)
    exit()


def mod_com(n, r):
    MOD = 1000000007
    r = min(r, n - r)
    numer = denom = 1
    for i in range(1, r + 1):
        numer = numer * (n - r + i) % MOD
        denom = denom * i % MOD
    return numer * pow(denom, MOD - 2, MOD) % MOD


print(mod_com(n, x))


Measured memory_bytes: 3064
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int n,k;
	cin >> n >> k;
	vector<int> a(n);
	for(int i = 0;i < n;i++)cin >> a[i];

	queue<ll> q;
	for(int i = 0;i < n;i++){
		ll sum = 0;
		for(int j = i;j < n;j++){
			sum += a[j];
			q.push(sum);
		}
	}

	ll comp = 1LL << 45;
	ll ans = 0;
	while(comp != 0){
		vector<ll> hold;
		int cnt = 0;
		while(q.size()){
			ll now = q.front();
			q.pop();
			hold.push_back(now);
			if(comp & now)cnt++;
		}
		if(cnt < k){
			for(int i = 0;i < hold.size();i++){
				q.push(hold[i]);
			}
		}
		else{
			ans += comp;
			for(int i = 0;i < hold.size();i++){
				if(comp & hold[i])q.push(hold[i]);
			}
		}
		comp /= 2;
	}

	cout << ans << endl;
}


Measured memory_bytes: 12728
#include<iostream>
#include<vector>
using namespace std;
typedef unsigned int uint;
uint maxv;
void solve(uint now,uint m,uint *a,int n){
  int r=n-1,l=0,mid;
  while(l <=r){
    mid = (l+r)/2;
    if ( a[mid]+now>m)r=mid-1;
    else if ( a[mid]+now <=m){
      if ( a[mid]+now >maxv)maxv=a[mid]+now;
      l=mid+1;
    }
    //else break;
  }
  //if ( now+a[mid]>maxv&& now+a[mid]<=m)maxv=now+a[mid];
}


main(){
  int n;
  uint m;
  while(scanf("%d%u",&n,&m) && n){
    uint one[n];
    uint two[n*n];
    int p=0;
    maxv=0;
    for(int i=0;i<n;i++)scanf("%u",&one[i]);
    for(int i=0;i<n;i++){
      if ( one[i]>maxv &&one[i] <=m)maxv=one[i];
      for(int j=i;j<n;j++){
	if ( one[i]+one[j]>m)continue;
	two[p++]=one[i]+one[j];
	if (two[p-1]>maxv)maxv=two[p-1];
      }
    }
    sort(one,one+n);
    sort(two,two+p);
    for(int i=0;i<p;i++){
      if ( two[i]+one[0]>m)break;
      if ( two[i]+two[0]<=m)solve(two[i],m,two,p);
      if ( two[i]+one[0]<=m)solve(two[i],m,one,n);
    }
    printf("%u\n",maxv);
  }
  return false;
}

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


bool f(string s) {
    int n = s.size();
    bool flag = 1;
    for(int i = 0; i < n/2; i++) {
        if(s.at(i) != s.at(n-1-i)) flag = 0;
    }
    return flag;
}

int main(void){
    string s, s1 = "", s2 = "";
    cin >> s;
    int n = s.size();
    
    for(int i = 0; i < n/2; i++) {
        s1 += s.at(i);
        s2 += s.at(n-1-i);
    }
    
    if(f(s) == 1 && f(s1) == 1 && f(s2) == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
#define oo 0x3f3f3f3f

int main(){
    int n;
    cin >> n;
    int grid[n+1][3];
    for(int i = 0; i < n ; ++i) cin >> grid[i][0] >> grid[i][1] >> grid[i][2];

    vector<vector<int>> dp(n+1, vector<int>(3, 0));
    for(int i = 1; i <= n ; ++i){
        for(int j = 0 ; j < 3 ; ++j){
            for(int k = 0; k < 3 ; ++k){
                if(j == k) continue;
                dp[i][j] = max(dp[i][j], dp[i-1][k]+grid[i-1][j]);
            }
        }
    }
    printf("%d\n", max({dp[n][0], dp[n][1], dp[n][2]}));
    return 0;
}

Measured memory_bytes: 6912
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> n;
	vector<ll>	h(n);
	for(i=0;i<n;i++) cin >> h[i];
	x = h[0];
	ans = 1;
	for(i=1;i<n;i++) {
		if (x <= h[i]) {
			ans ++;
			x = h[i];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s.size()%2)return puts("No"),0;
	for(int i=0;i<s.size();i+=2)if(s[i]!='h')return puts("No"),0;
	for(int i=1;i<s.size();i+=2)if(s[i]!='i')return puts("No"),0;
	puts("Yes");
}


Measured memory_bytes: 256
MOD = 10 ** 9 + 7
S = input()
N = len(S)

dp = [[0] * 4 for _ in range(N + 1)]
dp[0][0] = 1

for i in range(N):
    for j in range(4):
        s = S[i]
        m1 = 3 if s == '?' else 1
        m2 = 1 if j != 0 and (s == '?' or s == 'ABC'[j - 1]) else 0
        dp[i + 1][j] = (m1 * dp[i][j] + m2 * dp[i][j - 1]) % MOD

print(dp[N][3])


Measured memory_bytes: 54380
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
//No change above here

const ll maxi = 5*1e5;
ll mod = 5;

//function for power
ll power(ll x, ll n) {
	ll res = 1;
	x %= mod;
	while (n) {
		if (n & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		n >>= 1;
	}
	return res;
}

ll sum_digits(ll n)
{
	ll ret = 0;
	while (n)
	{
		ret += n % 10;
		n /= 10;
	}
	return ret;
}

ll dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll p, q;
bool valid(ll i, ll j) { return i >= 1 && i <= p && j >= 1 && j <= q; }

//declare needed things here

int main()
{
	IOS;
	int n;
	cin >> n;
	vector<int> v(n + 1, 0);
	for (int i = 1; i * i <= n; ++i)
	{
		for (int j = 1; j * j <= n; ++j)
		{
			for (int k = 1; k * k <= n; ++k)
			{
				int x = i * i + j * j + k * k + i * j + j * k + k * i;
				if (x <= n)
					v[x]++;
			}
		}
	}
	for (int i = 1; i <= n; ++i)
		cout << v[i] << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];
    sort(v.begin(), v.end(), greater<ll>());
    ll sum = 0;
    rep(i, a) sum += v[i];
    ld ave = (ld)sum / a;
    cout << setprecision(10);
    cout << ave << endl;

    ll p = 1;
    if(v[a - 1] != v[a]){
        cout << p << endl;
    }else{
        int over = 0;
        for(int i = a; i < n; i++) if(v[i] == v[a - 1]) over++;
        int below = 0;
        for(int i = a - 1; i >= 0; i--) if(v[i] == v[a - 1]) below++;
        
        ll ans = 0;
        vector<ll> nck(over+below+1, 1);
        for(int i = 1; i < over+below+1; i++){
            nck[i] = nck[i - 1];
            nck[i] *= (over+below+1-i);
            nck[i] /= i;
        }

        if(v[a - 1] == v[0]){
            for(int k = below; k <= below + min(over, b - a); k++){
                ans += nck[k];
            }
            cout << ans << endl;
        }else{
            ans = nck[below];
            cout << ans << endl;
        }
        
    }
    
}

Measured memory_bytes: 256
from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
    
def solve():
    n,k=mp()
    s=input()
    for i in range(n):
        if i==k-1:
            print(s[i].lower(),end="")
        else:
            print(s[i],end="")
        
    



for _ in range(1):
    solve()
    


Measured memory_bytes: 9060
//abc100_b.cpp
//Sat Jun 16 21:05:24 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
using ll=long long;

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

	int base = pow (100,d);
	int ans = base * n;
	if (n == 100){
		ans = ans + base;
	}

	cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N, K;
	cin >> N >> K;
	if (N % K == 0)
		cout << "0" << endl;
	else
		cout << "1" << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string t;
	string ans="";
	cin >>t;
	ans=t;
	int d=0;
	int p=0;
		rep(i,t.size()){
			if(t[i]=='?'){
				ans[i]='D';
			}
		}
	cout<<ans<<endl;
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007
    #define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
    #define GCD(m,n) __gcd(m,n)
    #define LCM(m,n) m*(n/GCD(m,n))
    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
     	string s;
     	cin>>s;
     	int n=s.size();
     	int dp[n+1][13];
     	memset(dp,0,sizeof(dp));
     	dp[0][0]=1;
     	rep(1,n+1){
     		if(s[i-1]=='?'){
     			repi(d,0,10){
     				repi(cur,0,13){
     					dp[i][(10*cur+d)%13]=(dp[i][(10*cur+d)%13]+dp[i-1][cur])%M;
     				}
     			}
     		}
     		else{
     			int d=s[i-1]-'0';
     			repi(cur,0,13){
     				dp[i][(10*cur+d)%13]=(dp[i][(10*cur+d)%13]+dp[i-1][cur])%M;	
     			}
     		}

     }
     //rep0(n+1) {repi(j,0,13) cout<<dp[i][j]<<" ";cout<<endl;}
     cout<<dp[n][5];
     	}
    signed main()
    {   
        asdf
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 10604
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define f(i,a,b) for(int i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b) f(i,0,n){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

/*****************************************************************************/


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

	int n, k, d[9];
	cin >> n >> k;
	st s;
	f(i, 0, k)cin >> d[i];
	for (int i = n;; i++) {
		s = to_string(i);
		f(j, 0, size(s)) {
			f(l, 0, k) {
				if (s[j] - '0' == d[l])goto out;
			}
		}
		cout << s;
		return 0;
	out:;
	}
	return 0;
}


Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.par = list(range(n))    # self.par[x] = y: xの属する木の根はy
        self.siz = [1] * n

    def root(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        if self.siz[x] > self.siz[y]:     # 小さい木を大きい木に接続（根までが近くなる）
            x, y = y, x
        self.siz[y] += self.siz[x]
        self.par[x] = y

    def tree_size(self, x):
        return self.siz[self.root(x)]


N, M, K = map(int, input().split())
F = UnionFind(N)
n_friend = [0] * N

B = {}
for i in range(N):
    B[i] = set()
for _ in range(M):
    p, q = map(int, input().split())
    n_friend[p - 1] += 1
    n_friend[q - 1] += 1
    F.unite(p - 1, q - 1)
for _ in range(K):
    p, q = map(int, input().split())
    B[p - 1].add(q - 1)
    B[q - 1].add(p - 1)


# calc friend candidate
i, blocked = 0, 0
for b in B[0]:
    if F.same(i, b):
        blocked += 1
print(F.tree_size(i) - 1 - n_friend[i] - blocked, end='')
for i in range(1, N):
    print(' ', end='')
    blocked = 0
    for b in B[i]:
        if F.same(i, b):
            blocked += 1
    print(F.tree_size(i) - 1 - n_friend[i] - blocked, end='')
print('')


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

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

	vector<int> T(N);
	for (int i = 0; i < N; i++) cin >> T[i];

	int M;
	cin >> M;

	vector<int> ans;

	for (int i = 0; i < M; i++) {
		int P, X;
		cin >> P >> X;

		int A = 0;

		for (int j = 0; j < N; j++) {
			if (j == P - 1)A += X;
			else A += T[j];
		}

		ans.push_back(A);
	}

	for (int i = 0; i < M; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 3600
#include<cstdio>
int gcd(int a,int b)
{
	if (b==0) return a;
	else return gcd(b,a%b);
}
int main()
{
	int n,k,a,g,m;
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a);
		if (i==1) g=m=a;
		else
		{	
			g=gcd(g,a);
			if (a>m) m=a;
		}
	}
	if (k>m||k%g!=0) puts("IMPOSSIBLE");
	else puts("POSSIBLE");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define oo 0x7ffffff
using namespace std;
int h,w;
int a[600][600];
int cnt=0;
int ans[360000][5];
void add(int a1,int a2,int a3,int a4)
{
	ans[cnt][1]=a1;
	ans[cnt][2]=a2;
	ans[cnt][3]=a3;
	ans[cnt][4]=a4;
	++cnt;
}
int main()
{
	cin>>h>>w;
	for(int i=1; i<=h; ++i)
		for(int j=1; j<=w; ++j)
			{
				scanf("%d",&a[i][j]);
			}
	for(int i=1; i<h; ++i)
		for(int j=1; j<=w; ++j)
			{
				if(a[i][j]%2)
					{
						a[i][j]--;
						a[i+1][j]++;
						add(i,j,i+1,j);
					}
			}
	for(int j=1; j<w; ++j)
		if(a[h][j]%2)
			{
				a[h][j]--;
				a[h][j+1]++;
				add(h,j,h,j+1);
			}
	cout<<cnt<<endl;
	for(int i=0; i<cnt; ++i)
		printf("%d %d %d %d\n",ans[i][1],ans[i][2],ans[i][3],ans[i][4]);
	return 0;
}

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


int main(){
    int n,k;
    cin>>n>>k;
    long long sum=0;
    vector<long long> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n-k;i++){
        sum+=a[i];
    }
    cout<<sum;
    
    
    
    return 0;
}


Measured memory_bytes: 1792
str = input()
newStr = input()
def f(s):
    s = list(s)
    if len(s) <= 1:
        return s
    i = 0
    length = len(s)
    while i< length/2:
        s[i],s[length-1-i] = s[length-1-i],s[i]
        i += 1
    return ''.join(s)
if newStr == f(str):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
ABCD = raw_input()
for op1 in "+-":
  for op2 in "+-":
    for op3 in "+-":
      e = ABCD[0]+op1+ABCD[1]+op2+ABCD[2]+op3+ABCD[3]
      if eval(e)==7:
        print e+"=7"
        exit(0)


Measured memory_bytes: 2568
n=int(input())
r=o=s=0
while n:
 a=input()[1]
 if'I'==a:
  if r<3:r+=1
  else:s+=1
 elif'O'==a:s+=r+1;r=0
 else:
  if o<2:o+=1
  else:print(s);n-=1;r=o=s=0


Measured memory_bytes: 5588
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
  int n, k; cin >> n >> k;
  vector<int> la;
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
    if (a >= k) continue;
    la.push_back(a);
  }
  sort(la.begin(), la.end());
  int n2 = la.size();
  int s[n2+1];
  s[0] = 0;
  for (int i = 0; i < n2; ++i) { 
    s[i+1] = s[i]+la[i];
  }
  int l = -1, r = la.size();
  while (r-l > 1) {
    int c = (l+r)/2;
    int v = la[c];
    auto check = [&](int x) {
      if (s[x] >= k) return false;
      int ma = k-s[x];
      vector<bool> dp(ma);
      dp[0] = true;
      for (int j = c+1; j < n2; ++j) { 
        for (int i = ma-1; i >= 0; --i) { 
          if (!dp[i]) continue;
          if (i >= ma-v) return false;
          if (i+la[j] < ma) dp[i+la[j]] = true;
        }
      }
      for (int i = ma-v; i < ma; ++i) {
        if (dp[i]) return false;
      }
      return true;
    };
    if (check(c)) l = c;
    else r = c;
  }
  cout << l+1 << endl;
}



Measured memory_bytes: 384
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] val_str = Console.ReadLine().Split(' ');
            int age = int.Parse(val_str[0]);
            int adult_fee = int.Parse(val_str[1]);

            int result = 0;

            if (age >= 13)
            {
                result = adult_fee;
            }
            else if (age >= 6)
            {
                result = adult_fee / 2;
            }

            Console.WriteLine(result);
        }
    }
}


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

namespace Atcoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var D = Console.ReadLine();
			switch (D)
			{
				case "25":
					Console.WriteLine("Christmas");
					break;
				case "24":
					Console.WriteLine("Christmas Eve");
					break;
				case "23":
					Console.WriteLine("Christmas Eve Eve");
					break;
				case "22":
					Console.WriteLine("Christmas Eve Eve Eve");
					break;
				default:
					break;
			}
		}
	}
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;

// E
int main(){FIN

	ll n;
	cin >> n;
	vll a(n);
	vector<pair<ll, ll>> cnt(n);
	REP(i,n){
		cin >> a[i];
	}
	REP(i,n){
		ll tmp1 = i - a[i], tmp2 = i + a[i];
		if (tmp1 >= 0) {
			cnt[tmp1].second++;
		}
		if (tmp2 < n) {
			cnt[tmp2].first++;
		}
	}
 
	ll ans = 0;
	REP(i,n){
		ll tmp1 = cnt[i].first, tmp2 = cnt[i].second;
		ans += tmp1 * tmp2;
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7892
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mo 1000000007
#define mod2 1000000000
#define mod1 998244353
#define lol ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define F(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define ss second

int main()
{
    lol;
    ll n;cin >> n;
    if(n>=30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

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

  for (int i = 0; i < 100 / 4 + 1; ++i)
  {
    for (int j = 0; j < 100 / 7 + 1; ++j)
    {
      if (N == i * 4 + j * 7)
      {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
//  RAKSHIT KADAM
 #include <bits/stdc++.h>
 
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
 #warning !!!check the size of arrayss!!!
 
 #define ll long long
 #define int long long
 #define MOD  1000000007
 #define newMOD  998244353
 #define MAX 300006
            
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define endl "\n"
 #define x first
 #define y second
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define INF 1000000000000000005
 #define vi vector<ll>
#define pi 3.1415926535897932384626433832795
#define Endl endl
#define lb lower_bound
#define ub upper_bound
using namespace std;
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
//int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;                                                  return (y%2 == 0)? p : (x * p) % m;}
 
//ll modInverse(int a, int m){int g = gcd(a, m); { return power(a, m-2, m);}}

void solve()
{
    ll n,d,sk;cin>>n>>d>>sk;
    string s;cin>>s;
    ll pre[n+2],suf[n+3];
    memset(pre,0,sizeof pre);
    memset(suf,0,sizeof suf);
    for(ll i=0;i<n;i++)
    {
        if(i-sk>0 && s[i]=='o')
        {
            pre[i]=max(pre[i-sk-1]+1,pre[i]);
        }
        else if(s[i]=='o')pre[i]=1;
                    if(i)   pre[i]=max(pre[i-1],pre[i]);
        
    }
    for(ll i=n-1;i>=0;i--)
    {
        if(i+sk+1<n && s[i]=='o')
        {
            suf[i]=max(suf[i+sk+1]+1,suf[i]);
        }
        else if(s[i]=='o')suf[i]=1;
                suf[i]=max(suf[i],suf[i+1]);
    }
    vi ans;
    for(ll i=0;i<n;i++)
    {
        if(!i)
        {
            if(suf[i+1]==d-1)
            {
                ans.pb(i+1);
            }
        }
        else if(i==n-1)
        {
            if(pre[i-1]==d-1)
            {
                ans.pb(i+1);
            }
        }
        else
        {
            if(pre[i-1]+suf[i+1]==d-1)
            {
                ans.pb(i+1);
            }
        }
    }
    for(auto it:ans)
    {
        cout<<it<<endl;
    }

}
signed main()
{
 
   
    Need_for_speed(activated);
//satisfy
//    {
//   solve();
//    }

  solve();
    return 0;
    
}
 


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

int main(){
    long long int n,k,ans=0;
    cin>>n>>k;
    if(2*n>=k){
        ans=k/2;
    }
    else{
        ans=n;
        k-=2*n;
        ans+=k/4;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int n,a,b;
  cin >> n;
  a = n/111;
  b = n%111;
  
  if(b==0){
  cout << n << endl;
  }
  else{
  cout << 111+n-b << endl;
  }
}

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

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((ll)(x).size())

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const int INF = 1e9+10;
const ll mod = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define print(x) cerr << #x << " is " << x << endl;
//#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 
int A, B, H, M;
int main()
{
    cin >> A >> B >> H >> M;
    double theta, x;
    
    theta = (H * 30.0 - M * 5.5)/360.0 * 2.0 * PI;
    x = (double)(A * A + B * B) - 2 * A * B * cos(theta);
    fprintf(stdout, "%.10f\n",sqrt(x));
    return 0;
}


Measured memory_bytes: 4192
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("YES") if fl else print("NO")
import collections
import math
import itertools
import heapq as hq
a1,a2,a3 = ma()
if a1+a2+a3>=22:
    print("bust")
else:
    print("win")


Measured memory_bytes: 9460
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

int calc(ll x, int i)
{
    ll sum = (x + 1) / (1LL << (i + 1));
    sum *= (1LL << i);
    if ((x + 1) % (1LL << (i + 1)) <= (1LL << i))
        return sum % 2;
    sum += (x + 1) % (1LL << (i + 1)) - (1LL << i);
    return sum % 2;
}

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

    ll a, b;
    cin >> a >> b;
    ll ret = 0;
    if (a == 0)
    {
        for (int i = 0; i < 50; i++)
        {
            ll cnt = calc(b, i);
            if (cnt % 2)
                ret += (1LL << i);
        }
    }
    else
    {
        for (int i = 0; i < 50; i++)
        {
            ll cnt = calc(b, i);
            cnt ^= calc(a - 1, i);
            if (cnt)
                ret += (1LL << i);
        }
    }

    cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <sstream>
#include <bitset>
#include <stack>
#include <cstdlib>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

typedef long long ll;

using namespace std;

int main() {
    
    vector<int> n;
    
    FOR(i, 1, 10){
        FOR(j, 0, 10){
            FOR(k, 0, 10){
                int num = i*10000+j*1000+k*100+j*10+i;
                n.push_back(num);
            }
        }
    }
    sort(n.begin(),n.end());
    
    int a,b;
    cin >> a >> b;
    
    int cnt=0;
    
    FOR(i, 0, n.size()){
        if((n[i]>=a)&&(n[i]<=b)) cnt++;
    }
    
    cout << cnt <<endl;
    
    return 0;
}


Measured memory_bytes: 256
def int_input():
    return list(map(int, input().split()))


def is_sorted(l):
    return all(l[i] <= l[i + 1] for i in range(len(l) - 1))


def dfs(arr, i, a, b):
    if i == 10:
        return is_sorted(a) and is_sorted(b)
    na = a + [arr[i]]
    nb = b + [arr[i]]
    return any([
        dfs(arr, i + 1, na, b) if is_sorted(na) else False,
        dfs(arr, i + 1, a, nb) if is_sorted(nb) else False])


n = int(input())
for _ in range(n):
    raw = int_input()
    print("YES" if dfs(raw, 0, list(), list()) else "NO")







Measured memory_bytes: 5608
a,b,c=map(int,input().split())
ans="No"
if a==b:
  if b==c:
    ans="No"
  else:
    ans="Yes"
if b==c:
  if c==a:
    ans="No"
  else:
    ans="Yes"
if c==a:
  if a==b:
    ans="No"
  else:
    ans="Yes"
print(ans)

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

const ll INF = 1e9;

int main() {
  ll N; cin >> N;
  ll ans = INF;
  auto f = [](ll A, ll B) {
    string sa = to_string(A);
    string sb = to_string(B);
    return max((ll)sa.length(), (ll)sb.length());
  };
  for (int i = 1; i <= sqrt(N); ++i) {
    if (N % i) continue;
    ans = min(ans, f(i, N / i));
  }
  cout << ans << endl;
  return 0;
}


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

// 二次元グリッドの原点 ( 0 , 0) にチェスのナイトの駒があります。
// ナイトの駒はマス ( i , j) にあるとき ( i + 1 , j + 2) か ( i + 2 , j + 1) のどちらかのマスにのみ動かすことができます。
// ナイトの駒をマス ( X , Y) まで移動させる方法は何通りありますか？

const val MOD = 1000000007L
// (a, 2a) + (2b, b) = (X, Y)を満たすa, bの組み合わせを求め、a+bCaを計算
fun solve(X: Int, Y: Int){
    for (a in 0..X){
        // 2b = X - a
        // b = Y - 2a
        if ((X - a) % 2 == 0 && (X - a) / 2 == Y - 2*a){
            val b = Y - 2 * a
            println(modBinomial(a + b, b, MOD))
            return
        }
    }
    println(0)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val X = sc.next().toInt()
    val Y = sc.next().toInt()
    solve(X, Y)
}


tailrec fun gcd(x: Int, y: Int): Int = if (y == 0) x else gcd(y, x % y)
tailrec fun gcd(x: Long, y: Long): Long = if (y == 0L) x else gcd(y, x % y)

fun Int.pow(x: Double): Double = Math.pow(this.toDouble(), x)
fun Long.pow(x: Double): Double = Math.pow(this.toDouble(), x)

fun Long.modPow(x: Long, mod: Long): Long {
    // a ^ (2^(exp)) % mod
    tailrec fun binModPow(a: Long, exp: Long): Long = when (exp) {
        0L -> a % mod
        else -> binModPow(a * a % mod, exp - 1)
    }
    return (0..63).asSequence()
            .map { (x shr it) and 1 }
            .withIndex()
            .filter { it.value > 0 }
            .map { binModPow(this, it.index.toLong()) }
            .reduce { a, b -> a * b % mod }
}

fun Long.modInv(mod: Long): Long = this.modPow(mod - 2, mod)

fun modBinomial(n: Int, k: Int, mod: Long): Long = when(k){
    // n(n-1)...(n-k+1) / k!
    0 -> 1L
    else -> {
        val numer = (n downTo n - k + 1).map{ it.toLong() }.reduce{ a, b -> (a * b) % mod }
        val denom = (1..k).map{ it.toLong() }.reduce{ a, b -> (a * b) % mod }
        (numer * denom.modInv(mod)) % mod
    }
}


Measured memory_bytes: 75776
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int dp[10][2][2][2][2];

int main(){
	int N;
	scanf("%d", &N);
	if(N < 357){
		printf("0\n");
		return 0;
	}
	vector<int> Nd;
	int n = 0;
	while(N > 0){
		Nd.push_back(N % 10);
		N /= 10;
		n++;
	}
	dp[0][0][0][0][0] = 1;
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < 2; ++j){
			for (int k = 0; k < 2; ++k){
				for (int l = 0; l < 2; ++l){
					for (int m = 0; m < 2; ++m){
						for (int d = 3; d <= ((j || (Nd[n-1 - i] >=  7)) ? 7 : Nd[n-1 - i]); d += 2){
							dp[i + 1][j || (d < Nd[n-1 - i])][k || (d == 3)][l || (d == 5)][m || (d == 7)] += dp[i][j][k][l][m];
						}
					}
				}
			}
		}
	}
	int ans = dp[n][0][1][1][1] + dp[n][1][1][1][1];
	for (int i = 1; i < n; ++i){
		int this_digit = 1;
		for (int j = 0; j < i; ++j) this_digit *= 3;
		this_digit -= 3*(1<<i);
		this_digit += 3;
		ans += this_digit;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
def root(x):
    if x == parent[x]:
        return x
    y = root(parent[x])
    relative[x] += relative[parent[x]]
    parent[x] = y
    return y
def unite(a, b, w):
    pa = root(a); pb = root(b)
    pw = relative[a] + w - relative[b]
    if pa < pb:
        parent[pb] = pa
        relative[pb] = pw
    else:
        parent[pa] = pb
        relative[pa] = -pw
while 1:
    N, M = map(int, input().split())
    if N == M == 0:
        break
    *parent, = range(N)
    relative = [0]*N
    for i in range(M):
        cmd = input().split()
        if cmd[0] == '!':
            a, b, w = map(int, cmd[1:])
            unite(a-1, b-1, w)
        else:
            a, b = map(int, cmd[1:])
            if root(a-1) != root(b-1):
                print("UNKNOWN")
            else:
                print(relative[b-1] - relative[a-1])

Measured memory_bytes: 67104
#include<bits/stdc++.h>
#define mxn 1000010
#define db double
#define LL long long
#define ldb long double
#define ull unsigned long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pul pair<ull,LL> 
#define pii pair<int,int> 
#define mp make_pair
#define fr first
#define sc second
#define x1 faqx1
#define y1 faqy1
#define x2 faqx2
#define y2 faqy2
using namespace std;
const int mod=998244353;
template<typename T> void chkmin(T &x,T y) {if(y<x) x=y;}
template<typename T> void chkmax(T &x,T y) {if(y>x) x=y;}
template<typename T> void upd(T &x,T y) {if((x+=y)>=mod) x-=mod;}
int n,sl,fh,a[mxn],c[mxn];
LL ans;
int rd()
{
	sl=0;fh=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch) {if(ch=='-') fh=-1; ch=getchar();}
	while('0'<=ch&&ch<='9') sl=sl*10+ch-'0',ch=getchar();
	return sl*fh;
}
int main()
{
	n=rd();
	for(int i=1;i<=n;++i) ans+=c[a[i]=rd()]++;
	for(int i=1;i<=n;++i) printf("%lld\n",ans-c[a[i]]+1);
	return 0;
}

Measured memory_bytes: 7040
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		string ans = "No";
		for(var i=1;i<=9;i++){
			for(var j=1;j<=9;j++){
				if(i*j==N){
					ans = "Yes";
				}
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13140