akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int K(const void *a,const void *b)
{
    return strcmp((char*)a,(char*)b);
}
int main()
{
    int a,b,i,j,k;
    char A[101],B[101];
    scanf("%s",B);scanf("%s",A);//输入S和T
    a=strlen(B); b=strlen(A);//统计两个字符串的长度
    
    char D[101][101];
    int C,point,n;
    C=0;point=0;n=0;
    
    
    
    
    if(a>=b)
        
    {
        for(i=a-1;i>=0; i--)
        {
            
            if(B[i]==A[b-1]||B[i]=='?')
            {
                k=i;
                for(j=b-1; j>=0; j--)
                {
                    if(A[j]==B[k]||B[k]=='?')
                        k--;
                    
                    else
                        break;
                    
                }
                if(k==i-b)
                {
                    k=i;
                    strcpy(D[n],B);
                    for(j=b-1; j>=0; j--,k--)
                    {
                        D[n][k]=A[j];
                    }
                    for(j=0; j<a; j++)
                    {
                        if(D[n][j]=='?')
                            D[n][j]='a';
                    }
                    point=1;
                    n++;
                }}}}
    
    
    else

    {
        printf("UNRESTORABLE");
        return 0;
    }
    
    
    
    
    
    if(point!=1)
        printf("UNRESTORABLE");
    else
    {
        qsort(D,n,101*sizeof(char),K);
        printf("%s\n",D[0]);
    }
    return 0;
    
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
const int inf = 1000000000; //10^9
const ll MOD = 1e9 + 7;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
//intは10桁、long longは18桁、doubleは308桁、long double は4932桁

const ll MX = 1e18; //1(1倍)e(指数)18(10^18)

int main()
{
    int n;
    cin >> n;
    ll ans = 1;
    bool ng = false;
    rep(i, n)
    {
        ll a;
        cin >> a;
        if (a == 0) //0が一個でもあったら
        {
            cout << 0 << endl;
            return 0;
        }
        if (__int128(ans) * a > MX) //0^18を超えたらng=true。__int128()で128bitの整数対応
        {
            ng = true; // 0がないかひととおり確認しなきゃいけないからbreakしちゃだめ
        }
        ans *= a;
    }
    if (ng)
        cout << -1 << endl;
    else
        cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let mut h: isize = read().unwrap();
    let a: isize = read().unwrap();
    let mut count = 0;
    while h > 0 {
        h -= a;
        count += 1;
    }
    println!("{}", count);
}

Measured memory_bytes: 4352
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    switch (x) {
    case 7:
    case 5:
    case 3:
        cout << "YES" << endl;
        break;

    default:
        cout << "NO" << endl;
        break;
    }

    return 0;
}


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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL X;
	cin >> X;

	if(X < 100 || (X > 105 && X < 200)){
		printf("0\n");
		return 0;
	}

	LL Q = X / 100;
	LL R = X % 100;

	if(R == 0){
		printf("1\n");
		return 0;
	}

	LL q = R / 5;
	LL r = R % 5;

	if(q > Q){
		printf("0\n");
		return 0;
	}

	if(q == Q){
		if(r == 0){
			printf("1\n");
		}
		else{
			printf("0\n");
		}
		return 0;
	}
	printf("1\n");
	return 0;
}

Measured memory_bytes: 3596
// head{{{
/* vim: set foldmethod=marker ft=cpp: */
#include <iostream>
#include <list>
#pragma GCC optimize("O3")
using namespace std;
// }}}
 
int main() {
    //optimize{{{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //---------}}}

    int N=0;
    cin >> N;
    bool Y=false;
    string S;
    for(int i=0;i<N;i++){
        cin >> S;
        if (S == "Y") {
            Y = true;
            break;
        }
    }

    if (Y == true) {
        cout << "Four" << endl;
    }
    else {
        cout << "Three" << endl;
    }

}



Measured memory_bytes: 3612
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);

int x;
map<int,int> co;
vi z;

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> x;
	F0R(i,x) {
	    int a; cin >> a;
	    co[a] ++;
	    if (co[a] % 2 == 0) z.pb(a);
	}
	sort(z.begin(),z.end());
	if (z.size() < 2) cout << 0;
	else cout << (ll)z[z.size()-2]*z[z.size()-1];
}

// read!
// ll vs. int!

Measured memory_bytes: 4992
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
    
using namespace std;
typedef long long ll;

int main()
{
	ll N, P;
	cin >> N >> P;
	ll cnt[2] = {0};
	for (ll i = 0; i < N; i++) {
		ll A;
		cin >> A;
		A &= 1;
		cnt[A]++;
	}
	ll ans = 0;
    if (cnt[1] == 0) {
        //Aiがすべて偶数の場合
        if (P==0) {
            ans = (1LL << N); 
        }
    } else {
        ans = (1LL << (N-1));
    }
	cout << ans << endl;
	return 0;
}


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

#define IOS  ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed; 
#define fi first
#define mp make_pair
#define se second
#define pb push_back
#define be(x) (x).begin(), (x).end()
#define rbe(x) (x).rbegin(), (x).rend()
#define forn(i, a, n) for(int i = (int)(a); i < (int)(n); i++)   
#define endl "\n"

typedef long long ll;
typedef vector<ll> vl; 
typedef pair<int, int> pii;

int main(){
    IOS;
   
      int days, n, sum(0);
      cin >> days >> n;
      vector<int> v(n);
      forn(i, 0, n) cin>>v[i], sum += v[i];

     // cout<<sum<<" "<<days<< " "<< n;
    		
    	if(sum > days){
    		cout<<"-1";
    	}
    	else if(sum == days){
    		cout<<"0";
    	}else{
			cout<<days-sum;
	   	}

    return 0;
}



Measured memory_bytes: 3668
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int N, M;
int P[100000], Y[100000];
vector<int> yd[100001];
int main() {
    scanf("%d %d ", &N, &M);
    rep(i, M) scanf("%d %d ", &P[i], &Y[i]), yd[P[i]].push_back(Y[i]);
    rep(i, N) sort(yd[i + 1].begin(), yd[i + 1].end());
    rep(i, M) printf("%06d%06d\n ", P[i],
                     lower_bound(yd[P[i]].begin(), yd[P[i]].end(), Y[i]) -
                         yd[P[i]].begin() + 1);
}


Measured memory_bytes: 7808
N,M=map(int,input().split())
L=[list(map(int,input().split())) for _ in range(M)]
P=list(map(int,input().split()))
ans=0
for i in range(2**N):
  lit=[0]*M
  for j,switch in enumerate(L):
    cnt=0
    for s in switch[1:]:
      if i>>(s-1)&1:
        cnt+=1
    if cnt%2==P[j]:
      lit[j]=True
    else:
      lit[j]=False
  if all(lit):
    ans+=1
print(ans)

Measured memory_bytes: 3064
# coding: utf-8
# Your code here!
import math

def main():
    x, y = map(int, input().split())
    b = (y - 2 * x) / 2
    a = x - b
    if a >= 0 and b >= 0 and a == int(a) and b == int(b):
        print('Yes')
    else:
        print('No')
    
main()

Measured memory_bytes: 9072
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <set>
#include <map>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};

ll i,j,k;
ll n,m,s;
bool muri=false;
ll a[100005];
ll ans=0,sum=0;

int main(){
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(i=0;i<n-1;i++){
		sum+=a[i];
		if(sum*2>=a[i+1]){
			ans++;
		}else{
			ans=0;
		}
	}
	cout<<ans+1<<endl;

	return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int, int> p;
typedef long long ll;
int main() {
  int a, b;
  cin >> a >> b;
  if (a >= 13) {
    cout << b << endl;
    return 0;
  }
  if (a >= 6) {
    cout << b / 2 << endl;
    return 0;
  }
  cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 3600
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

string s;

signed main(){
    io();

    in(s);
    if(s.size()==3){
        reverse(all(s));
    }
    out(s);

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define size 128

#define abssub(a, b) (a > b ? (a-b) : (b-a))

int readint();
inline int readint()
{
    register int t = 0;
    register char c;
    //int minus = 0;
    while((c = getchar()) < '-');
    //if (c == '-') minus = 1, c = getchar();
    c -= '0';
    do
    {
        t = t * 10 + c;
    }while((c = getchar() - '0') >= 0);
    //return minus ? (-t) : t;
    return t;
}

struct point
{
    int x;
    int y;
    int z;
};


int main()
{
    int n, x1 = 0, x2 = 100, y1 = 0, y2 = 100, mi;
    struct point point[size];
    n = readint();
    for (int i = 0; i < n; i++)
    {
        point[i].x = readint();
        point[i].y = readint();
        point[i].z = readint();
        if (point[i].z)
            mi = i;
    }
    for (int x = x1; x <= x2; x++)
        for (int y = y1; y <= y2; y++)
    {
        int h = abssub(point[mi].x, x) + abssub(point[mi].y, y) + point[mi].z;
        for (int i = 0; i < n; i++)
        {
            int h2 = h - abssub(point[i].x, x) - abssub(point[i].y, y);
            if (h2 < 0) h2 = 0;
            if (point[i].z != h2)
                goto next;
        }
        printf("%d %d %d", x, y, h);
        goto end;
        next:
        continue;
    }
    end:
    return 0;
}


Measured memory_bytes: 1580
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[]x = new int[N];
 
    int all = 0;
    for(int i=0; i<N; i++){
        x[i] = sc.nextInt();
        if(x[i]<=K-x[i]) {
        	all += x[i]*2;
        }else {
			all += (K-x[i])*2;
        }	
}  
	System.out.println(all);
    }
}


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

#define int long long
#define pii pair<int,int>
#define fi first
#define se second
#define all(v) v.begin(),v.end()
const int MOD =1e9+7;


int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie();
    //If you hack my code , You are gay;
    int ara[5];
    for(int i=0;i<5;i++) cin>>ara[i];
    sort(ara,ara+5);
    int ans=1;
    for(int i=1;i<5;i++){
        if(ara[i]==ans) ans++;
        else break;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3528
#include <stdio.h>
#include <string.h>

int main(void)
{
	
	char str[100001];
	int i;
	int guu_zero = 0;
	int guu_ichi = 0;
	int kisu_zero = 0;
	int kisu_ichi = 0;
	int min;
	
	scanf("%s", str);
	
	for(i = 0; i < strlen(str); i++) {
		if(i % 2 == 0) {
			if(str[i] == '0') {
				guu_zero++;
			} else {
				guu_ichi++;
			}
		} else {
			if(str[i] == '0') {
				kisu_zero++;
			} else {
				kisu_ichi++;
			}
		}
	}
	
	if(guu_zero + kisu_ichi > guu_ichi + kisu_zero) {
		min = guu_ichi + kisu_zero;
	} else {
		min = guu_zero + kisu_ichi;
	}
	
	printf("%d\n", min);
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
long long n,k;
int main()
{
	scanf("%lld%lld",&n,&k);
	long long res=n,x,y;
	if(k<n-k)
	{
		x=k;
		y=n-k-k;
		res+=2LL*x;
	}
	else
	{
		x=n-(n-k)-(n-k);
		y=n-k;
		res+=2LL*y;
	}
	while(x!=0LL && y!=0LL)
	{
		if(x<y)
		{
			res+=(y-1LL)/x*2LL*x;
			y%=x;
			res+=y*2LL;
			x-=y;
		}
		else
		{
			res+=(x-1LL)/y*2LL*y;
			x%=y;
			res+=x*2LL;
			y-=x;
		}
	}
	if(k==n-k)res-=n;
	res+=x+y;
	printf("%lld",res);
	return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1; 


*/


int main()
{
	string m = "yhnujmikolp";
	string a;
	cin >> a;
	while (a != "#")
	{
		int ans = 0;
		bool w = false;
		if (m.find(a[0]) != string::npos)w = true;
		for (int i = 1; i < a.size(); i++)
		{
			if (m.find(a[i]) != string::npos)
			{
				if (w == true);
				else
				{
					w = true;
					ans++;
				}
			}
			else
			{
				if (w == false);
				else
				{
					w = false;
					ans++;
				}
			}


		}
		cout << ans << endl;
		cin >> a;
	}
}

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

using namespace std;
#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
ll res, c[N];
ll d[11];
pair < int, int > val[N];

int main () {
	for (int i = 1; i <= 9; i ++) {
		if (i == 9) {
			val[i] = mp(1, 2);
			continue;
		}
		int s = i;
		int nw = i;
		int cnt = 0;
		int kol = 0;

		while (1) {
			nw += i;
			cnt++;
			kol++;
			if (nw >= 10) {
				kol++;
				nw = (nw / 10) + (nw % 10);
			}
			if (nw == s) break;
		}
	//	cout << i << ' ' << cnt << '\n';
		val[i] = mp(cnt, kol);
	}
	//exit(0);
   SpeedForce;
	cin >> n;
	for (int i = 1, x; i <= n; i ++) {
		cin >> x >> c[i];
		d[x] += c[i];
	}
	res = d[0];
	ll nw = 0;
	bool bt = 0;
	for (int i = 9; i > 0; i --) {
		ll cur = val[i].F;
		d[i]--;
		if (d[i] >= cur) {
			//cout << cur << ' ' << val[i].S << '\n';
			res += (d[i] / cur) * val[i].S;
			d[i] = (d[i] % cur);
		}
		d[i]++;
		while (d[i] > 0) {
			d[i] --;
			res+= bt;
			bt = 1;
			nw += i;
			if (nw >= 10) {
				res ++;
				nw = (nw / 10) + (nw % 10);
			}
		}
	}
	//if (res > 0) res--;
	cout << res;


   return Accepted;
}

// B...a

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

int a[100000+5];
long long mod = 1e9+7;

int times(int n){
    int ans=1;
    for (int i=0; i<n; i++){
        ans *= 2;
        ans %= mod;
    }
    return ans;
}

int main(){
    int n,memo,tgt,mx;
    cin >> n;
    mx = 0;

    for (int i=0; i<100000+5; i++){
        a[i] = 0;
    }

    for (int i=0; i<n; i++){
        cin >> memo;
        a[memo] += 1;
        mx = max(mx,memo); 
    }

    if (a[0] == 1) tgt=0;
    else if (a[1] == 2) tgt=1;
    else tgt = 10;

    bool ans=true;

    if (n%2==1){
        if(a[0] != 1){
            cout << 0 << endl;
        }
        else if (n==1) cout << 1 << endl;
    
        else{
            for (int i=2; i<n*2; i+=2){
                if (a[i]==2) continue;
                else if (i != n+1){
                    cout << 0 << endl;
                    break;
                }
                else{
                    cout << times((n-1)/2) << endl;
                    break;
                }
            }
        }
    }

    else if (n%2==0){
        for (int i=1; i<n*2; i+=2){
            if (a[i]==2) continue;
            else if (i != n+1){
                cout << 0 << endl;
                break;
            }
            else{
                cout <<  times(n/2) << endl;
                break;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 640
/** In the Name of ALLAH */


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

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

inline ll gcd ( ll a, ll b ) { return __gcd (a, b); }
inline ll lcm ( ll a, ll b ) { return ( a * ( b / gcd (a, b) ) ); }



#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}


int main()
{
	optimize();

	int l, r , d;
	cin >> l >> r >> d;

	int cnt = 0;
	for ( int i = l; i <= r; i++ ) {
		if ( i % d == 0 ) cnt++;
	}

	cout << cnt << endl;
	
	return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp> 
boost::math::lcm(10,20) ---> use it to find lcm.*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
const int inf = 2e9;

/************ Use when precision need to set to some value **************/
// std::cout << std::setprecision(12);
// std::cout << std::fixed;
/*******************************************/
int max(int a,int b){
	if(a > b)return a;
	else return b;
}

int min(int a, int b){
	if(a < b)return a;
	else return b;
}
/*		0. Go to main function first.
		1. Take all the inputs................................................
		2. Check Once whether the graph given is directed or undirected.......
		3. Tree can also be undirected.
		4. Whenever you do multiplication and division in the same line, beware.
*/
void solve(){
	string s;
	cin >> s;
	int n = s.length();
	string dd = s;
	reverse(dd.begin(),dd.end());
	string s1="",s2="";
	for(int i=1;i<=(n-1)/2;i++){
		s1 += s[i-1];
		s2 += s[i-1];
	}
	reverse(s2.begin(),s2.end());
	string s3="",s4="";
	for(int j=(n+3)/2;j<=n;j++){
		s3 += s[j-1];
		s4 += s[j-1];
	}
	reverse(s4.begin(),s4.end());
	if(dd==s && s1==s2 && s3==s4)cout << "Yes\n";
	else cout << "No\n";
}
/*
	memset() can be used to set all values as 0 or -1 for integer data types.
	It will not work if we use it to set as other values.
	The reason is memset works byte by byte.
*/

int main(){
	IO;

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif // ONLINE_JUDGE

	int t;
	// cin >> t;
	t = 1;
	while(t--){
		solve();
	}
	return 0;
}

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

int main(){
    long long N = 0;
    long long D = 0;

    cin >> N >> D;

    long long count = 0;
    for(int i=0;i<N;i++){
        long long  x = 0;
        long long  y = 0;
        cin >> x >> y;

        
        long double  d = sqrt(x*x+y*y);
        //cout << d << endl;
        if(d <= D)
        count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        string s=cin.next();
        char[] c=s.ToCharArray();
        for(int i=0;i<3;i++)
        {
          if(c[i]=='1')Console.Write('9');
          else if(c[i]=='9')Console.Write('1');
          else Console.Write(c[i]);
        }
        Console.WriteLine();
    }
}



class Scanner
{
    string[] s;
    int i;

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

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

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

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

    public long nextLong()
    {
        return long.Parse(next());
    }

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

    public double nextDouble()
    {
        return double.Parse(next());
    }


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

class Answer
{
    public static void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }//Answer.IntArrayAns(x);
    public static void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}



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

int main() {
	int a, b;
	cin >> a >> b;
	if (a > b) {
		cout << "a > b" << endl;
	}
	if (a < b) {
		cout << "a < b" << endl;
	}
	if (a == b) {
		cout << "a == b" << endl;
	}
	return 0;
}

Measured memory_bytes: 2956
//package basics.AtCoders;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s =new Scanner(System.in);
        int N = s.nextInt(); //how many pieces made in time
        int X = s.nextInt(); // pieces given
        int T = s.nextInt(); // time
        if(N%X==0){
            System.out.println(N/X*T);
        }
        else {
            System.out.println((N/X+1)*T);
        }


    }
}


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

#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vii;

const ld EPS = 1e-9, PI = acos(-1.);
const ll LINF = 0x3f3f3f3f3f3f3f3f, LMOD = 1011112131415161719ll;
const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 1e5+5;

ll f[10], n, ans;
set <string> u;
set <vi> w;
string s;

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

    cin >> n;
    while (n--) {
        cin >> s;
        if (u.count(s)) continue;
        u.insert(s);

        if (s[0] == 'M') f[0]++;
        if (s[0] == 'A') f[1]++;
        if (s[0] == 'R') f[2]++;
        if (s[0] == 'C') f[3]++;
        if (s[0] == 'H') f[4]++;
    }
    vi k;
    for (int i = 0; i < 5; i++) k.pb(i);

    do {
        vi z = k;
        sort(z.begin(), z.begin()+3);
        z.pop_back();
        z.pop_back();
        if (w.count(z)) continue;
        w.insert(z);
        ans += f[z[0]]*f[z[1]]*f[z[2]];
    } while (next_permutation(k.begin(), k.end()));

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


Measured memory_bytes: 9728
// abc133_e
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

ll N, K;
vector<vector<int>> G;

ll dfs(int idx, int depth, int src){

    ll k = K - min(depth+1, 2);
    ll ans = 1;
    for (auto dst: G[idx]) {
        if (dst == src) continue;
        ans *= k--;
        ans %= MOD;
        ans *= dfs(dst, depth+1, idx);
        ans %= MOD;
    }

    return ans;
}

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    cin >> N >> K;

    G.resize(N);
    int a, b;
    REP(i, N-1){
        cin >> a >> b; a--; b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }

    ll ans = (K * dfs(0, 0, -1)) % MOD;
    print(ans);

    return 0;
}


Measured memory_bytes: 11648
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    R = int(input())
    print(math.pi * 2 * R)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9880
def eatperiod(x , a , b):

    ans = ""

    if (b - a) >= (x + 1):
        ans = "dangerous"
    elif (b - a) > 0:
        ans = "safe"
    else:
        ans = "delicious"

    return ans

def main():
    x , a , b = map(int , input().split())
    print(eatperiod(x , a , b))

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include <stdio.h>
#include <math.h>
int main()
{
    long long int n;
    long long int ans = 0, r;
    scanf("%lld", &n);
    r = (long long int)sqrt(n);
    for (int i = 1; i <= r; i++)
    {
        if (n % i == 0 && n / i > 1 && n / (n / i - 1) == n % (n / i - 1))
        {
            ans += n / i - 1;
        }
    }
    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 128
s = list(input())
k = int(input())
t = sorted(s)
u = []
v = []
for i in range(min(len(s), 5)):
    u.append(t[i])
for i in range(len(s)):
    if s[i] in u:
        if not [s[i]] in v:
            v.append([s[i]])
        l = [s[i]]
        for j in range(1, 5):
            if i + j == len(s):
                break
            l = l + [s[i + j]]
            if not l in v:
                v.append(l)
for i in range(len(v)):
    v[i] = "".join(v[i])
v.sort()
print(v[k - 1])

Measured memory_bytes: 3188
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n; rd(n);
  
  int[] a;
  for(int x=6; x<=n; x*=6) a~=x;
  for(int x=9; x<=n; x*=9) a~=x;
  a~=1;

  auto dp=new int[](n+1);
  const int inf=1_000_000_000;
  fill(dp, inf);
  dp[0]=0;
  foreach(i; 0..n)foreach(e; a){
    if(i+e<=n) dp[i+e]=min(dp[i+e], dp[i]+1);
  }
  writeln(dp[n]);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}

Measured memory_bytes: 2428
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskA {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			long x = in.nextLong();
			long y = in.nextLong();
			if (x % y == 0) {
				out.println(-1);
				return;
			}
			for (int i = 2; ; i++) {
				if (BigInteger.valueOf(i).isProbablePrime(100) && x % i != 0 && y % i != 0) {
					out.println(x * i);
					return;
				}
			}
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

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

	}
}



Measured memory_bytes: 21460
#include <bits/stdc++.h> 
using namespace std; 
typedef long long ll;
const ll mxn = 1e5;
const ll mod = 1e9 + 7;
 
ll pow(ll a,ll b){
    ll r =1;
    while(b){
        if(b%2!=0) r=(r*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return r;
}
 
const int siz = 5e5+20;
ll fact[siz], inv[siz];
void pre(){
	fact[0] = 1;
	inv[0] = pow(fact[0], mod-2);
	for(int i=1;i<siz;i++){
		fact[i] = (fact[i-1]*i)%mod;
	}
}
 
int spf[10];
void sieve(){
    spf[1]=1;
    for(int i=2;i<mxn;i++) spf[i]=i;
    for(int i=4;i<mxn;i+=2) spf[i]=2;
    for(int i=3;i*i<mxn;i++){
    }
}

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

    int n;
    cin>>n;

    int c = 0;

    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        if(a==b) c++;
        else c=0;
        if(c==3){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
}

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

using namespace std;

int main(){
    string S;
    cin>>S;
    if(S=="Sunny"){
        cout<<"Cloudy";
    }else if(S=="Cloudy"){
        cout<<"Rainy";
    }else{
        cout<<"Sunny";
    }
    return 0;
}

Measured memory_bytes: 256
#include <string.h>
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline void cmin(string &a, const string& b) { if (a > b) a = b; }
inline void cmin(string &a, const string& b, const string& c) {
    if (!a.size() || (b.size()&&b[0]=='|') || (c.size()&&c[0]=='|')) return ;
    if (a.size() != b.size() + c.size()) { a = b+c; return ; }
    const int L = b.size();
    int y = strncmp(b.c_str(), a.c_str(), L);
    if (y == 0) y = strncmp(c.c_str(), a.c_str()+L, c.size());
    if (y >= 0) return ;
    rep (i, b.size()) a[i] = b[i];
    rep (i, c.size()) a[b.size()+i] = c[i];
}
 
int n, L;
char from[64];
string to[64], dp[32][24], sub[2][24];
 
string solve() {
    rep (i, 32) rep (j, 24) dp[i][j] = '|';
    bool up;
    rep (LL, L+1) do {
        up = false;
        rep (k, n) {
            int cur = 0, nxt = 1;
            rep (i, 24) sub[cur][i] = '|';
            sub[cur][0] = "";
            rep (i, to[k].size()) {
                rep (j, 24) sub[nxt][j] = '|';
                if (islower(to[k][i])) {
                    rep (x, LL) cmin(sub[nxt][x+1], sub[cur][x]+to[k][i]);
                }
                else {
                    const int t = to[k][i] - 'A';
                    rep (j, LL+1) rep (x, LL-j+1) {
                        cmin(sub[nxt][x+j], sub[cur][x], dp[t][j]);
                    }
                }
                swap(cur, nxt);
            }
            const int f = from[k] - 'A';
            if (dp[f][LL] > sub[cur][LL]) dp[f][LL] = sub[cur][LL], up = true;
        }
    } while (up);
    if (dp['S'-'A'][L] == "|") return "-";
    return dp['S'-'A'][L];
}

int main() {
    for (;;) {
        cin >> n >> L;
        if (n == 0) return 0;
        string buf;
        rep (i, n) {
            cin >> buf;
            from[i] = buf[0];
            to[i] = buf.substr(2);
        }
        cout << solve() << endl;
    }
}

Measured memory_bytes: 964
/*==============================================*\
ID:          shahidul_brur

Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh

 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;
const int LOGN = 20;
int n, h[maxn];
ll dp[maxn];
ll cal(int i)
{
    if(i==n) return 0LL;
    ll &ret=dp[i];
    if(ret!=-1) return ret;
    ret = cal(i+1) + abs(h[i]-h[i+1]);
    if(i+2<=n) ret = min(ret, cal(i+2) + abs(h[i]-h[i+2]));
    return ret;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin>>n;
    f1(i,n) cin>>h[i];
    mem(dp, -1);
    cout << cal(1) << "\n";
    return 0;
}


Measured memory_bytes: 5376
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

constexpr int MOD = 1e9+7;
struct mint
{
	int v;
	mint():v(0){}
	mint(int v):v((v+MOD)%MOD){}
	mint operator-()const{ return mint(0) - *this; }
	mint& operator+=(const mint& a){ if((v+=a.v)>=MOD) v-=MOD; return *this; }
	mint& operator-=(const mint& a){ if((v+=MOD-a.v)>=MOD) v-=MOD; return *this; }
	mint& operator*=(const mint& a){ (v*=a.v)%=MOD; return *this; }
	mint& operator/=(const mint& a){ (*this) *= a.inv(); return *this; }
	mint operator+(const mint& a)const{ return mint(*this) += a; }
	mint operator-(const mint& a)const{ return mint(*this) -= a; }
	mint operator*(const mint& a)const{ return mint(*this) *= a; }
	mint operator/(const mint& a)const{ return mint(*this) /= a; }
	bool operator<(const mint& a)const{ return v < a.v; }
	bool operator==(const mint& a)const{ return v == a.v; }
	mint pow(int k)const{ mint r(1),t(v); while(k){ if(k&1) r*=t; t*=t; k>>=1; } return r; }
	mint inv()const{ return pow(MOD-2); }
	static mint comb(int n, int k) {
		if(n-k<k) k=n-k;
		mint num(1), dom(1);
		for(int i=0;i<k;i++) { num*=n-i; dom*=i+1; }
		return num/dom;
	}
};
std::istream& operator>>(std::istream&i,mint&a){ int t; i>>t; a=mint(t); return i; }
std::ostream& operator<<(std::ostream&o,const mint&a){ o<<a.v; return o; }


signed main() {
	int n,a,b;
	std::cin >> n >> a >> b;
	print(mint(2).pow(n)-mint(1)-mint::comb(n,a)-mint::comb(n,b));
	return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))

num = n + k
count = 0
s = 0
l = max(a)
while True:
    count = 0
    mid = (s + l) / 2
    for i in range(n):
        if a[i] % mid == 0:
            count += a[i] // mid
        else:
            count += a[i] // mid + 1
    if count > num:
        s = mid
    else:
        l = mid
    temp = (s + l) / 2
    if abs(mid - temp) < 0.001:
        break
if mid == int(mid):
    print(int(mid))
else:
    print(int(mid) + 1)

Measured memory_bytes: 93884
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)

	x := getString()
	a := make([]int, 4)
	for i, v := range x {
		a[i] = int(v - '0')
	}

	// out(a)
	n := 1 << 3
	for i := 0; i < n; i++ {
		op := "000" + strconv.FormatInt(int64(i), 2)
		op = op[len(op)-3:]
		sum := a[0]
		for i, v := range op {
			if v == '0' {
				sum += a[i+1]
			} else {
				sum -= a[i+1]
			}
		}
		// out(sum)
		if sum == 7 {
			fmt.Print(a[0])
			for i, v := range op {
				if v == '0' {
					fmt.Print("+")
				} else {
					fmt.Print("-")
				}
				fmt.Print(a[i+1])
			}
			out("=7")
			break
		}
	}

}


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

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
//#define MOD 1000000007
#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int x; cin >> x;
    if(x == 0) cout << 1 << endl;
    else cout << 0 << endl;
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;

#define fi          first
#define se          second
#define pb          push_back
#define INF         INT_MAX
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define dbg(x)      cout<<#x"="<<x<<endl
#define uni(x)      x.erase(unique(all(x)),x.end())
#define ub(x,y)     upper_bound(all(x),y)-x.begin()
#define lb(x,y)     lower_bound(all(x),y)-x.begin()
#define rep(i,n)    repl(i,0,n-1)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<ll>())
#define mkp(x,y)    make_pair(x,y)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)

int main(){
  cin.sync_with_stdio(false);
  int a,b;
  cin >> a >> b;
  cout << ((a*b) % 2 == 0 ? "Even" : "Odd" ) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
int main(){
  FIO;
  // ifstream cin("input");
  int n,x,y;
  cin>>n>>x>>y;
  int hashIt[n+1];
  int i,j;
  for(i=0;i<n;i++){
    hashIt[i]=00;
  }
  for(i=1;i<=n;i++){
    for(j=i+1;j<=n;j++){
      if(i!=j){
        int ans1=abs(i-j);
        int ans2=abs(i-x)+abs(j-y)+1;
        int ans3=abs(i-y)+abs(j-x)+1;
        int ans=min(min(ans1,ans2),ans3);
        hashIt[ans]++;
        // cout<<i<<" "<<j<<" "<<ans<<endl;
      }
    }
  }
  for(i=1;i<n;i++){
    cout<<hashIt[i]<<endl;
  }
  return 0;  
}

Measured memory_bytes: 256
n, m = map(int, input().split())
d = []
num = m
re = 0
for i in range(n):
    tmp = list(map(int, input().split()))
    d.append(tmp)
d = sorted(d)
for i in range(n):
    tmp = d[i]
    b = tmp[1]
    for j in range(b):
        num -= 1
        re += tmp[0]
        if num == 0:
            print(re)
            break
    if num == 0:
        break


Measured memory_bytes: 28656
import math
A,B,H,M = map(int,input().split())



l = 360*M/60
s = 30*H+30*M/60
angle = abs(s-l)
if abs(s-l) >= 180:
    angle = min(s,l)+360-max(s,l)
    

print(math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(angle))))




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

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	priority_queue<double, vector<double>, greater<>> pq;
	for( int i = 0; i < N; ++i ) {
		double x;
		cin >> x;
		pq.push( x );
	}

	while( pq.size() > 1 ) {
		double a = pq.top();
		pq.pop();
		double b = pq.top();
		pq.pop();

		pq.push( (a+b)/2.0 );
	}

	cout << fixed << setprecision( 10 );
	cout << pq.top() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

int main() {
  vector<int> a(3);
  REP(i, 3) cin >> a[i];

  sort(a.begin(), a.end());

  int ans = numeric_limits<int>::max();
  do{
    int b = a[0], tmp = 0;
    REP(i, 3){
      tmp += abs(a[i]-b);
      b = a[i];
    }
    
    ans = min(ans, tmp);
  }while(next_permutation(a.begin(), a.end()));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256