akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;


ll fact(ll n)
{
    ll res=1;
    f(i,1,n)
    {
        res=((res%mod)*(i%mod))%mod;
    }
    return res;
}


int arr[g_size];



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

	ll int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	ll int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>n>>m;

	if(abs(n-m)==1){
        k=fact(n);
        res=fact(m);
        cout<<((k%mod)*(res%mod))%mod<<endl;

	}
	else if(!abs(n-m)){
        k=fact(n);
        cout<<(2*(k%mod)*(k%mod))%mod<<endl;
	}
    else{
        cout<<"0"<<endl;
    }

}


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

int main() {
  string S,T;
  int count=0;

  cin >> S >> T;
  for(int i=0; i<3; i++) {
    if(S[i] == T[i]) count++;
  }
  cout << count << endl;

  return 0;
}


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

void shaffle(char* a,int Len,int shaff){
    char BUFF;


    for(int i=0;i<shaff;i++){
        BUFF = a[0];
        for(int j=1;j<Len;j++){
            a[j-1] = a[j];
        }
        a[Len - 1] = BUFF;
    }

    //printf("   %c\n",a[0]);
    return;
}


int main(){
    char cards[200];
    int Len,h,m;
    
    
    while(1){
        //printf("new!!\n");
        scanf("%s",cards);
        //printf("Input Finished.\n");
        if(cards[0] == '-'){
            break;
        }

        scanf("%d",&m);
        for(int i=0;i<m;i++){
            int buff;
            scanf("%d",&buff);
            shaffle(cards,strlen(cards),buff);
        }
        
        printf("%s",cards);
        printf("\n");
    }



    


    return 0;
}



Measured memory_bytes: 2752
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds;
using namespace std;

typedef long long int lli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<lli> vli;
typedef vector<pii> vii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> OrderedSet;

const int MOD	= 1e9 + 7;
const double PI = acos(-1.0);

#define fastio			ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto &i : c)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define fill(a)  memset(a, 0, sizeof (a))
#define error(x) cerr << #x << " = " << (x) << endl
#define errorp(p) cerr << #p << " = " << (p.first) << ", " << (p.second) << endl

template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template <typename T> T lcm(T a, T b){return (a*b)/gcd(a,b); }
int mul(int a, int b, int c){lli res=(lli)a*b;return (int)(res>=c?res%c:res);}
template<typename T>T power(T e, T n, T m){T x=1,p=e;while(n){if(n&1)x=mul(x,p,m);p=mul(p,p,m);n>>=1;}return x;}
int mod_neg(int a, int b, int c){int res;if(abs(a-b)<c)res=a-b;else res=(a-b)%c;return(res<0?res+c:res);}
template<typename T>T extended_euclid(T a, T b, T &x, T &y){T xx=0,yy=1;y=0;x=1;while(b){T q=a/b,t=b;b=a%b;a=t;\
t=xx;xx=x-q*xx;x=t;t=yy;yy=y-q*yy;y=t;}return a;}
template<typename T>T mod_inverse(T a, T n){T x,y,z=0;T d=extended_euclid(a,n,x,y);return(d>1?-1:mod_neg(x,z,n));}
template <class T>  inline void smax(T &x,T y){ x = max((x), (y));}
template <class T>  inline void smin(T &x,T y){ x = min((x), (y));}


int main(){
    #ifdef DEBUG
		freopen("test", "r", stdin);
	#endif
    fastio;
    
    string s, t;
    cin >> s >> t;

    if(sz(s) + 1 == sz(t) ){
        int i = 0;
        tr(s, x){
            if(x != t[i++]){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    }else{ 
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3616
#include<stdio.h>
#include<map>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	map<int,int>mp;
	mp[a]++;
	mp[b]++;
	mp[c]++;
	if(mp[a]==1)
		printf("%d\n",a);
	if(mp[b]==1)
		printf("%d\n",b);
	if(mp[c]==1)
		printf("%d\n",c);
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}


int main()
{
    string s;
    cin >> s;
    list<char> lst;
    REP(i,s.size()){
        lst.push_back(s[i]);
    }
    int q;cin >> q;
    bool hanten=false;
    REP(i,q){
        int t;
        cin >> t;
        if(t==1){
            if(hanten==false){
                hanten=true;
            }
            else{
                hanten=false;
            }
        }
        else{
            int f;
            cin >> f;
            if(f==1){
                char c;
                cin >> c;
                if(hanten){
                    lst.push_back(c);
                }
                else{
                    lst.push_front(c);
                }
            }
            else{
                char c;
                cin >> c;
                if(!hanten){
                    lst.push_back(c);
                }
                else{
                    lst.push_front(c);
                }
            }
        }
    }
    if(hanten){
        stack<char> st;
        int count=0;
        for (auto itr = lst.begin(); itr != lst.end(); ++itr)
        {
            st.push(*itr);
            count++;
        }
        REP(i,count){
            cout << st.top();
            st.pop();
        }
        cout << endl;
    }
    else{
        for (auto itr = lst.begin(); itr != lst.end(); ++itr)
        {
            cout << *itr;
        }
        cout << endl;
    }
}

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


int main(){
    int n ;
    cin >> n ;
    vector<int> a(n) ;
    for (size_t i = 0; i < n; i++)
    {
        cin >> a.at(i) ;
    }
    bool ans = true ;
    for (size_t i = 0; i < n; i++)
    {
        if (a.at(i) % 2 == 0)
        {
            if (a.at(i) % 3 != 0 && a.at(i) %5 != 0)
            {
                ans = false ;
                break ;
            }
            
        }
        
    }
    if (ans == true)
    {
        cout << "APPROVED" << endl ;
    }else
    {
        cout << "DENIED" << endl ;
    }
    
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main() {
	ll i,j,k,l,m,n,t;
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cin>>n>>m>>k;
	l=1;
	if(n==m && m==k)
	{
	    l=0;
	}
	else if(n==m || n==k || m==k)
	{
	    l=1;
	}
	else
	{
	    l=0;
	}
	if(l==0)
	{
	    cout<<"No";
	}
	else
	{
	    cout<<"Yes";
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  int taka_life = A;
  int aoki_life = C;
  while(A > 0 && C > 0){
    aoki_life -= B;
    if(aoki_life <= 0){
      printf("Yes\n");
      break;
    }
    taka_life-= D;
    if(taka_life <= 0){
      printf("No\n");
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;
public class Main{
    public static void main(String[] aa){
        Scanner s = new Scanner(System.in);
        String st;
        
        int i,now=0,m;
        while(true){
        st = s.next();
        if(st.charAt(0)=='-')break;
        m =s.nextInt();
           for(i=0;i<m;i++){
            now+=s.nextInt();
           }
           for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           }
           System.out.println();
           now=0;
       }
    }   
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int64_t const MOD = 998244353;

namespace math { namespace integer {

template<class T> T mod_mul(T x, T k, T m) { if(k == 0) { return 0; } if(k % 2 == 0) { return mod_mul((x + x) % m, k / 2, m); } else { return (x + mod_mul(x, k - 1, m)) % m; } }
template<class T> T mod_pow(T x, T n, T mod) { if(n == 0) { return 1; } if(n % 2 == 0) { return mod_pow(mod_mul(x, x, mod) % mod, n / 2, mod); } else { return mod_mul(x, mod_pow(x, n - 1, mod), mod); } }
template<class T> T extgcd(T a, T b, T& x, T& y) { T d = a; if(b != 0) { d = extgcd(b, a % b, y, x); y -= (a / b) * x;} else { x = 1, y = 0; } return d; }
template<class T> T mod_inverse(T x, T mod) { return mod_pow(x, T(mod - 2), mod); /* use fermat */ }
template<class T> T mod_inverse_composite_num_mod(T a, ll mod) { T x, y; extgcd(a, mod, x, y); return (mod + x % mod) % mod; }

}
using namespace integer;
}
using namespace math;

namespace math {

constexpr int64_t MaxFact = 300010;

template<class T = int64_t>
struct FactRevFactList {

  array<T, MaxFact+1> fact_;
  array<T, MaxFact+1> rev_fact_;

  FactRevFactList() {
    fact_[0] = 1;
    for(int i=1; i<MaxFact; i++) {
      fact_[i] = fact_[i-1] * i;
      fact_[i] %= MOD;
    }

    rev_fact_[MaxFact-1] = mod_pow(fact_[MaxFact-1], (T)MOD-2, MOD);

    for(int i=MaxFact-2; i>=0; i--) {
      rev_fact_[i] = rev_fact_[i+1] * (i+1);
      rev_fact_[i] %= MOD;
    }
  }

  T fact(int x) const { return fact_[x]; }
  T fact_inv(int x) const { return rev_fact_[x]; }

};

template<class T = int64_t>
struct CombinationBig {
  math::FactRevFactList<> fr_;
  T comb(T n, T r) { return (fr_.fact(n) * fr_.fact_inv(r) % MOD) * fr_.fact_inv(n-r) % MOD; }
};

}

math::CombinationBig<> cbig;

int main() {
  int64_t N, A, B, K;
  cin >> N >> A >> B >> K;
  int64_t ans = 0;
  rep(a, N + 1) {
    auto rest = K - A * a;
    if (rest < 0) continue;
    auto b = rest / B;
    if (rest % B == 0 && b <= N) {
      ans += cbig.comb(N, a) * cbig.comb(N, b) % MOD;
      ans %= MOD;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main(){
    string str;
    cin >> str;
    int sz;
    sz = str.size();
    vector<int> alp(26,0);
    for(int i=0; i<sz; i++){
        int tmp;
        tmp = str[i]-'a';
        alp[tmp]++;
    }
    for(int i=0; i<26; i++){
        if(alp[i]%2==1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int mod = 0;
		int minMod = Integer.MAX_VALUE;

		for (int i = L; i < R; i++) {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		}

		System.out.println(minMod);
	}
}


Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<vector>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define arep(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int grid[1010][1010];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    rep(i, 0, H - B) rep(j, 0, W - A) {
        grid[i][j] = 0;
    }
    rep(i, 0, H - B) rep(j, W - A, W) {
        grid[i][j] = 1;
    }
    rep(i, H - B, H) rep(j, 0, W - A) {
        grid[i][j] = 1;
    }
    rep(i, H - B, H) rep(j, W - A, W) {
        grid[i][j] = 0;
    }
    rep(i, 0, H) {
        rep(j, 0, W) cout << grid[i][j];
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 5248
#include<iostream>
#include<queue>
using namespace std;
main()
{
	string S;
	cin>>S;
	queue<string>P;
	P.push(S);
	while(!P.empty())
	{
		string s=P.front();
		P.pop();
		if(s=="ABC")
		{
			cout<<"Yes"<<endl;
			return 0;
		}
		else if(s.size()<5)continue;
		for(char c='A';c<'D';c++)
		{
			string t="";
			bool flag=0;
			for(int i=0;i<s.size();)
			{
				if(s.substr(i,3)=="ABC")
				{
					t+=c;
					i+=3;
				}
				else if(s[i]!=c)t+=s[i++];
				else
				{
					flag=1;
					break;
				}
			}
			if(!flag&&t!=s)
			{
				P.push(t);
			}
		}
	}
	cout<<"No"<<endl;
}



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

int main(){
    ll x,k,d;
    cin >> x >> k >> d;
    if((abs(x)-abs(k*d))>0){
        cout << abs(x)-abs(k*d) << endl;
    }
    else{
        ll a,b,syo;
        a=abs(x)%d;
        b=d-a;
        syo=abs(x)/d;
        if((syo-k)%2==0){
            cout << a << endl;
        }
        else{
            cout << b << endl;
        }
    }
    

    return 0;
}

Measured memory_bytes: 3628
str_in, n = input(), int(input())
for i in range(n):
    com = input().split()
    com_idx = [int(i) for i in com if i.isdigit()]
    if com[0]=="print":
        print(str_in[com_idx[0]:com_idx[1]+1])
    elif com[0]=="reverse":
        str_rev = str_in[com_idx[0]:com_idx[1]+1]
        str_in = str_in[:com_idx[0]] + str_rev[::-1] + str_in[com_idx[1]+1:]
    elif com[0]=="replace":
        str_in = str_in[:com_idx[0]] + com[3] + str_in[com_idx[1]+1:]



Measured memory_bytes: 5620
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		for(int i = 0; i<N; i++) {
			int a = MCXItoInteger(sc.next());
			int b = MCXItoInteger(sc.next());
			System.out.println(toMCXI(a + b));
		}
		sc.close();
		// System.out.println(MCXItoInteger("m2ci"));
		// System.out.println(toMCXI(1204));
	}

	public static int MCXItoInteger(String str) {
		int MCXIValue = 0;
		int beforeTheNumber = 1;
		for(int i = 0; i < str.length(); i++) {
			String theCharacter = String.valueOf(str.charAt(i));
			if(theCharacter.equals("m")) {
				MCXIValue += (beforeTheNumber * 1000);
				beforeTheNumber = 1;
			}else if(theCharacter.equals("c")) {
				MCXIValue += (beforeTheNumber * 100);
				beforeTheNumber = 1;
			}else if(theCharacter.equals("x")) {
				MCXIValue += (beforeTheNumber * 10);
				beforeTheNumber = 1;
			}else if(theCharacter.equals("i")) {
				MCXIValue += (beforeTheNumber * 1);
				beforeTheNumber = 1;
			}else {
				beforeTheNumber = Integer.valueOf(theCharacter);
			}
		}
		return MCXIValue;
	}

	public static String toMCXI(int num) {
		int m = num / 1000;
		int c = (num - (m * 1000)) / 100;
		int x = (num - (m * 1000) - (c * 100)) / 10;
		int i = num - (m * 1000) - (c * 100) - (x * 10);
		// System.out.println("m:" + m + " c:" + c +" x:"+ x + " i:" + i);
		StringBuffer MCXIValue = new StringBuffer();
		if(m == 1) {
			MCXIValue.append("m");
		}else if(m > 1) {
			MCXIValue.append(String.valueOf(m));
			MCXIValue.append("m");
		}
		if(c == 1) {
			MCXIValue.append("c");
		}else if(c > 1) {
			MCXIValue.append(String.valueOf(c));
			MCXIValue.append("c");
		}
		if(x == 1) {
			MCXIValue.append("x");
		}else if(x > 1) {
			MCXIValue.append(String.valueOf(x));
			MCXIValue.append("x");
		}
		if(i == 1) {
			MCXIValue.append("i");
		}else if(i > 1) {
			MCXIValue.append(String.valueOf(i));
			MCXIValue.append("i");
		}
		return String.valueOf(MCXIValue);
	}
}



Measured memory_bytes: 39348
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    long long n;
    cin >> n;
    string ans = "";
    while (1) {
        int r = n%26;
        if (r == 0) r = 26;
        ans = (char)('a'+r-1)+ans;
        if (r == 26) r = 0;
        n /= 26;
        if (r == 0) n--;
        if (n <= 0) break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	int p=0;
	int ans=1;
	REP(i,n){
		cin>>v[i];
	}
	REP(i,n){
		p+=v[i];
		if(p<=k) ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(int i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define fi first
#define se second
#define endl '\n'
#define trav(x,A) for(auto &x:A)
#define veci vector<int>
#define vecl vector<long long>
#define FORI(a,b,c) for(int a=b;a<c;a++)
#define FORD(a,b,c) for(int a=b;a>c;a--)
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

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

	map<char,ll> A;
	string S;
	READ(S);
	FORI(i,0,S.length())
	{
		A[S[i]]++;
	}
	ll x=0;
	for(auto a:A)
	{
		if (a.se==2)
		{
			x++;
		}
	}
	if (x==2)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N;
  double ans=0.0;
  cin >> N;
  if(N%2 == 0){
    ans = 0.5;
  } else {
	ans = (double(N)+1.0)/2.0/double(N);
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int N;
	string s;
	cin >> N >> s;
	int red = 0;
	int blue = 0;
	for (int i = 0; i < N; i++) {
		if (s.at(i) == 'R') {
			red++;
		}
		else {
			blue++;
		}
	}
	if (red > blue) {
		cout << "Yes" << endl;
	}
	else if (red <= blue) {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3580
A, B, C = map(int, input().split())
K = int(input())

for ctA in range(K+1):
    for ctB in range(K-ctA+1):
        for ctC in range(K-ctA-ctB+1):
            if A*(2**ctA) < B*(2**ctB) < C*(2**ctC):
                print('Yes')
                exit()
print('No')


Measured memory_bytes: 9148
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define ITR(i,x) for(auto i=(x).begin();i!=(x).end();++i)
using namespace std;
typedef long long ll;

int main(){
    int N;
    cin>>N;
    typedef pair<ll,ll> P;
    vector<P> V(N);
    REP(i,N){
        ll x,y;
        cin>>x>>y;
        V[i]=P(x,y);
    }
    map<P,int> mp;
    REP(i,N-1){//全ての球に対して距離(p,q)を求める
        rep(j,i+1,N){
            ll p,q;

            p=V[j].first-V[i].first;
            q=V[j].second-V[i].second;
        
            mp[P(p,q)]++;
            mp[P(-p,-q)]++;
            //cout<<p<<" "<<q<<endl;
        }
    }
    int ans=0;
    ITR(i,mp){ 
        ans=max(ans,i->second);
    }
    //cout<<ans<<endl;
    cout<<N-ans<<endl;
    
}

Measured memory_bytes: 384
n,k = map(int,input().split())

khalf = 0

if k%2 == 0:
    khalf = n // (k*0.5)

if khalf%2 == 0:
    khalf = khalf // 2
else:
    khalf = khalf // 2 + 1

kraw = n // k

print(int(khalf**3+kraw**3))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  ll x;
  cin >> x;
  ll ans = (x / 11) * 2;
  x %= 11;
  if (x > 6)
    ans += 2;
  else if (x > 0)
    ans += 1;
  cout << ans << endl;

  return 0;
}


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

#define inRange(x,a,b) (a <= x && x < b)

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

int main(){
    int h, w;
    while(cin >> w >> h, w+h){
        char mat[h][w];
        int x, y;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cin >> mat[i][j];
                if(mat[i][j] == '@')    y = i, x = j, mat[i][j] = '.';
            }
        }

        stack<pair<int,int>> s;
        s.push({y,x});

        int ans = 0;
        while(!s.empty()){
            pair<int,int> now = s.top();    s.pop();
            if(mat[now.first][now.second] == '#')   continue;
            if(mat[now.first][now.second] == '.')   ans++;
            mat[now.first][now.second] = '#';
            for(int k = 0; k < 4; k++){
                int ny = now.first + dy[k];
                int nx = now.second + dx[k];
                if(inRange(ny, 0, h) && inRange(nx,0,w) && mat[ny][nx] == '.'){
                    s.push({ny, nx});
                }
            }
        }

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


Measured memory_bytes: 2996
import sys


def _i(): return int(sys.stdin.readline().strip())


class Bigint:
    def __init__(self, n, mod=10**9+7):
        self.n = n % mod
        self.mod = mod
        return

    def __str__(self):
        return str(self.n)

    def __add__(self, other):
        ot = type(other)
        if ot == Bigint:
            return Bigint(self.n+other.n, self.mod)
        elif ot == int:
            return Bigint(self.n+other, self.mod)
        else:
            raise ValueError("Invalid type")

    def __iadd__(self, other):
        return self.__add__(other)

    def __sub__(self, other):
        ot = type(other)
        if ot == Bigint:
            o = other.n
        elif ot == int:
            o = other
        else:
            raise ValueError("Invalid type")
        #
        return Bigint(self.n - o, self.mod)

    def __isub__(self, other):
        return self.__sub__(other)

    def __mul__(self, other):
        ot = type(other)
        if ot == Bigint:
            return Bigint(self.n*other.n, self.mod)
        elif ot == int:
            return Bigint(self.n*other, self.mod)
        else:
            raise ValueError("Invalid type")

    def __imul__(self, other):
        return self.__mul__(other)

    def __pow__(self, other):
        assert type(other) == int, "power should be integer"
        #
        if other < 0:
            return self ** (other % (self.mod-1))
        ret = Bigint(1, self.mod)
        now = Bigint(self.n, self.mod)
        while other > 0:
            if other % 2 == 0:
                pass
            else:
                ret *= now
            other //= 2
            now *= now
        return ret

    def __truediv__(self, other):
        ot = type(other)
        if ot == Bigint:
            o = other
        elif ot == int:
            o = Bigint(other)
        else:
            raise ValueError("Invalid type")

        self *= (o ** (o.mod-2))
        return self

    def __itruediv__(self, other):
        return self.__truediv__(other)


def main():
    n = _i()
    a = Bigint(10) ** n
    b = Bigint(8) ** n
    c = Bigint(9) ** n - b
    return a - b - Bigint(2) * c


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 62288
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int main(){
  int n;cin >> n;
  int ans = 0;
  rep(i,n){
    int data;cin >> data;
    if(data&1) continue;
    while(1){
      if(data%2==0){
        ans++;
        data/=2;
      }else{
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int n,a[300],i,j,w,b=0;
	scanf("%d",&n);
	for(i=0;i<n*2;i++){
	    scanf("%d",&a[i]);
	}
	for(i=0;i<n*2-1;i++){
	    for(j=i+1;j<n*2;j++){
		    if(a[i]>a[j]){
			    w=a[i];
				a[i]=a[j];
				a[j]=w;
			}
		}
	}
	for(i=0;i<n*2;i+=2){
	    b=b+a[i];
	}
	printf("%d\n",b);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int ans = 0;

void dfs(string s, ll n) {
    if(s != "" and (ll) stol(s) > n) return;
    int cnt1 = 0;
    int cnt2 = 0;
    int cnt3 = 0;
    rep(i, s.size()) {
        if(s[i] == '3') cnt1 += 1;
        if(s[i] == '5') cnt2 += 1;
        if(s[i] == '7') cnt3 += 1;
    }

    if(cnt1 > 0 and cnt2 > 0 and cnt3 > 0) ans += 1;
    dfs(s + "3", n);
    dfs(s + "5", n);
    dfs(s + "7", n);
}

int main() {
    ll n;
    cin >> n;
    dfs("", n);
    cout << ans << endl;
}


Measured memory_bytes: 256
package main 

import (
        "fmt"
)


func main () {
        var  x, y, z, an  int
        fmt.Scan(&x,&y,&z)
        x = x - z
        for {
                x = x - y - z 
                an += 1
                if x < 0 {
                        an -=1
                        break 
                }  else if x == 0{
                        break
                }
        }
        fmt.Println(an)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define MAX_V 1000

int N,a;
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

bool dfs(int v){
  used[v]=true;
  for(int i=0;i<(int)G[v].size();i++){
    int u=G[v][i],w=match[u];
    if( w<0 || (!used[w]&&dfs(w)) ){
      match[u]=v;
      match[v]=u;
      return true;
    }
  }
  return false;
}
 
int bipartite_matching(){
  int res=0;
  memset(match,-1,sizeof(match));
  for(int v=0;v<N;v++){
    if(match[v]<0){
      memset(used,false,sizeof(used));
      if(dfs(v))res++;
    }
  }
  return res;
}
 
int main(){
  scanf("%d",&N);
  N--;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      scanf("%d",&a);
      if(a==1){
        G[j].push_back(N+i);
        G[N+i].push_back(j);
      }
    }
  }

  for(int i=0;i<N;i++)sort(G[i].begin(),G[i].end());
  int f=bipartite_matching();
  printf( f==N?"yes\n":"no\n");
  for(int i=0;i<N&&f==N;i++){
    match[ match[i] ]=-1;
    match[i]=-1;
    memset(used,false,sizeof(used));
    dfs(i);
    G[i].clear();
    G[i].push_back( match[i] );
    G[ match[i] ].clear();
    G[ match[i] ].push_back(i);
    printf("%d\n",match[i]-N+1);
  }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  
  int count = 0;
  for (int i = 1; i < N; i++) {
    bool ok = true;
    for (int j = 0; j < i; j++) {
      if (H.at(i) - H.at(j) < 0) {
        ok = false;
        break;
      }
    }
    if (ok) {
      count++;
    }
  }
  cout << count + 1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,L,T,c[400005];
int main()
{
	scanf("%d%d%d",&n,&L,&T);
	int now=0;
	for (int i=1;i<=n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		if (y==1) 
		{
			x=x+T;
			c[i]=(x%L+L)%L;
			now=(now+x/L)%n;
		}
		else
		{
			x=x-T;
			c[i]=(x%L+L)%L;
			now=(now+x/L)%n;
			if (x%L<0) now=(now-1)%n;
		} 
	}
	sort(c+1,c+n+1);
	now=(now+n)%n;
	for (int i=1;i<=n;i++)
		printf("%d\n",c[(i+now-1)%n+1]);
	
}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;
 
int main(){
    int N,M;

    cin >> N >> M;
    vector<int> A;
    int sum = 0;

    for(int i = 0; i < N; i++){
        int a;
        cin >> a;

        sum += a;

        A.push_back(a);
    }

    int count = 0;

    for(int i = 0; i < N; i++){
        if(4*M*A[i] >= sum){
            count++;
        }
    }

    if(count >= M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>


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

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


int main(){
    int K,N;
    cin >> K >> N;
    int l[60];
    for(int i=0;i<K;i++) cin >> l[i];
    sort(l,l+K,greater<int>());
    int hebi = 0;
    for(int i=0;i<N;i++) hebi += l[i];
    cout << hebi << endl;
}

Measured memory_bytes: 256
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

VC = 0
for i in range(N):
    if V[i]-C[i]>0:
        VC = VC + V[i]-C[i]
    else:
        VC = VC

print(VC)

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

typedef long long ll;

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    string s;
    cin >> s;

    int ans = 0;
    for (int i = 1; i < s.size(); i++) {
        if (s[i] != s[i-1]) ans++;
    }
    printf("%d\n", ans);
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
int c[2] = {0};
for (int i = 0; i < 3; i++) {
    int x;
    cin >> x;
    if (x == 5) {
        c[0]++;
    } else if (x == 7) {
        c[1]++;
    }

    }

    if (c[0] == 2 && c[1] == 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


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

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

    int max_a = -1;
    vector<int> a(pow(10, 5) + 1, 0);
    for (int i = 0; i < N; i++) {
        int d;
        cin >> d;
        a[d]++;
        max_a = max(d, max_a);
    }

    int X_count = 0;
    int last_index = a.size() - 1;
    for (int c = 0; c <= max_a; c++) {
        int count = a[c];
        if (c > 0) {
            count += a[c - 1];
        }
        if (c < last_index) {
            count += a[c + 1];
        }

        if (count > X_count) {
            X_count = count;
        }
    }

    cout << X_count << endl;
    return 0;
}


Measured memory_bytes: 640
h,w=gets.chomp.split(" ").map(&:to_i)
n=gets.to_i
a=gets.chomp.split(" ").map(&:to_i)
def Print(board,h)
  h.times do|i|
    puts board[i].join(" ")
  end 
end
board=Array.new(h).map{Array.new(w){0}}
index=0
h.times do|i|
  if (i%2).zero?
    w.times do|j|
      board[i][j]=index+1
      a[index]-=1
      index+=1 if a[index].zero?
    end
  else
    (w-1).downto(0) do|j|
      board[i][j]=index+1
      a[index]-=1
      index+=1 if a[index].zero? 
    end
  end
end
Print(board,h)


Measured memory_bytes: 2428
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <string> vs;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    vi a(26,0);
    for(ll i=0;i<4;i++)
    {
        a[s[i]-'A']++;
    }
    sort(a.rbegin(),a.rend());
    if(a[0]==2 && a[1]==2)
    {
        cout<<"Yes\n";
    }
    else
        cout<<"No\n";
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int R = scn.nextInt();
		int G = scn.nextInt();
		int B = scn.nextInt();
		int N = scn.nextInt();
		int ans = 0;
		for (int i = 0; i <= N / R; i++) {
			for (int j = 0; j <= (N - R * i) / G; j++) {
				if ((N - R * i - G * j) % B == 0)
					ans++;
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 23764
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,a,b = LI()

    return "{} {}".format(min(a,b), max(a+b-n,0))



print(main())




Measured memory_bytes: 7752
n,w = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(n)]

max1 = w // wv[0][0]
min1 = w // (wv[0][0] + 3)
seq = list(range(n))
ans = 0

w_min = wv[0][0]
w_list = [[] for _ in range(4)]

for wa,va in wv:
    w_list[wa-w_min].append(va)

for i in range(4):
    w_list[i].sort(reverse = True)

for i in range(4):
    for j in range(len(w_list[i])-1):
        w_list[i][j+1] += w_list[i][j]

for i in range(min1, max1+1):
    for w1 in range(i+1):
        for w2 in range(i-w1+1):
            for w3 in range(i-w1-w2+1):
                w4 = i - w1 - w2 - w3
                if w1 * w_min + w2 * (w_min+1) + w3 * (w_min+2) + w4 * (w_min+3) <= w:
                    if len(w_list[0]) >= w1 and len(w_list[1]) >= w2 and len(w_list[2]) >= w3 and len(w_list[3]) >= w4:
                        tmp = 0
                        if w1 >= 1:
                            tmp += w_list[0][w1-1]
                        if w2 >= 1:
                            tmp += w_list[1][w2-1]
                        if w3 >= 1:
                            tmp += w_list[2][w3-1]
                        if w4 >= 1:
                            tmp += w_list[3][w4-1]
                        ans = max(ans, tmp)

print(ans)


Measured memory_bytes: 74248
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int N,M,K,A,B,C,ans=0,cnt=0;
string S,T;
vector<int> P,Q;
vector<pair<int,int>> PP;
bool CAN=false;


int main(){
  cin>>N;
  REP(i,N){
    int a;
    cin>>a;
    PP.push_back(make_pair(a,i+1));
  }
  SORT(PP);
  REP(i,N){
    cout<<PP[i].second<<endl;
  }
}

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

using namespace std;

int main() {
  int s;
  std::cin >> s;
  int minNotMod10 = INT_MAX;
  int sum = 0;
  while (std::cin >> s) {
    sum += s;
    if (s % 10) {
      minNotMod10 = std::min(s, minNotMod10);
    }
  }
  if (minNotMod10 > 100) {
    sum = 0;
  } else if (sum % 10 == 0) {
    sum -= minNotMod10;
  }
  std::cout << sum << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

#define MOD (long long int)(1e9+7)
#define ll long long
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i %MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// a^n
ll modPow(ll a, ll n) {
	if (n == 1) return a % MOD;
	if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
	ll t = modPow(a, n / 2);
	return (t*t) % MOD;
}

// a^{-1}
ll modInv(ll a) {
	return modPow(a, MOD - 2);
}

// 二項係数計算
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void) {
	int N, A, B;
	cin >> N >> A >> B;


	// 前処理
	COMinit();
	ll ans;
	ans = modPow(2, N) - 1;
	ll va = 1;
	for (ll i = N; i > N - A; i--) va = (va * i) % MOD;
	ll vb = 1;
	for (ll i = N; i > N - B; i--) vb = (vb * i) % MOD;
	va = (va*finv[A]) % MOD;
	vb = (vb*finv[B]) % MOD;
	ans = (ans - va - vb) %MOD;
	while (ans < 0) ans += MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12288
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c,d;cin>>a>>b>>c>>d;
  cout<<min(a,b)+min(c,d)<<endl;
  return 0;
}

Measured memory_bytes: 256
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import Data.Int (Int64)
import Data.Coerce
import qualified Data.ByteString.Char8 as BS
import Control.Exception (assert)

main = do
  n <- readLn
  s <- BS.getLine
  assert (BS.length s == 2 * n) $ return ()
  let loop :: N -> Int -> Int -> N
      loop !acc !k !i | BS.length s == i = if k == 0 then acc else 0
                      | BS.index s i == 'W' = if even k
                                              then loop (acc * fromIntegral k) (k-1) (i+1)
                                              else loop acc (k+1) (i+1)
                      | otherwise = if even k
                                    then loop acc (k+1) (i+1)
                                    else loop (acc * fromIntegral k) (k-1) (i+1)
  print $ loop (product $ map fromIntegral [1..n]) 0 0

--
-- Modular Arithmetic
--

modulo :: Int64
modulo = 10^9+7
addMod, subMod, mulMod :: Int64 -> Int64 -> Int64
addMod !x !y | x + y >= modulo = x + y - modulo
             | otherwise = x + y
subMod !x !y | x >= y = x - y
             | otherwise = x - y + modulo
mulMod !x !y = (x * y) `rem` modulo

newtype N = N { unwrapN :: Int64 } deriving (Eq)
instance Show N where
  show (N x) = show x
instance Num N where
  (+) = coerce addMod
  (-) = coerce subMod
  (*) = coerce mulMod
  fromInteger n = N (fromInteger (n `mod` fromIntegral modulo))
  abs = undefined; signum = undefined

fromIntegral_Int64_N :: Int64 -> N
fromIntegral_Int64_N n = N (n `mod` modulo)

{-# RULES
"^9/Int" forall x. x ^ (9 :: Int) = let u = x; v = u * u * u in v * v * v
"^9/Integer" forall x. x ^ (9 :: Integer) = let u = x; v = u * u * u in v * v * v
 #-}

{-# RULES
"fromIntegral/Int->N" fromIntegral = fromIntegral_Int64_N . fromIntegral
"fromIntegral/Int64->N" fromIntegral = fromIntegral_Int64_N
 #-}


Measured memory_bytes: 892
#include <iostream>
#include <queue>
#define MAX 1000
using namespace std;

int main()
{
    int D[101];
    queue<int> Q;
    int n,i,j,u,k;
    for(i=0;i<101;i++)
        D[i]=0;
    cin >> n;
    int Adj[n][n];
    for(i=0;i<n;i++)
        for(j=0;j<n;j++)
            Adj[i][j]=0;
    for(i=0;i<n;i++)
    {
        cin >> u >> k;
        int v[k];
        for(j=0;j<k;j++)
        {
            cin >> v[j];
            Adj[u-1][v[j]-1]=1;
        }
    }
    D[0]=0;
    Q.push(0);
    while(!Q.empty())
    {
        int cur = Q.front();
        Q.pop();
        for(i=0;i<n;i++)
        {
            if(Adj[cur][i]==1&&D[i]==0)
            {
                D[i]=D[cur]+1;
                Q.push(i);
            }
        }
    }
    cout << 1 << ' ' << D[i] << endl;
    for(i=1;i<n;i++)
    {
        if(D[i]==0)
            cout << i+1 << ' ' << -1 << endl;
        else    cout << i+1 << ' ' << D[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 3116
#include<stdio.h>
#define MAX 100005
#define NIL -1
 
struct Node{int p,l,r,lef;};
struct Node T[MAX]; 
 
void print(int u){
 
  int i=T[u].p, depth=0;
  while(i!=NIL){
    i = T[i].p;
    depth++;
  }
 
  if(depth==0){
    printf("node %d: parent = %d, depth = %d, root, ",u,T[u].p,depth);
  }else if(T[u].l==NIL){
    printf("node %d: parent = %d, depth = %d, leaf, ",u,T[u].p,depth);
  }else{
    printf("node %d: parent = %d, depth = %d, internal node, ",u,T[u].p,depth);
  }
 
  i = T[u].l;
  printf("[");
  if(i!=NIL){
    printf("%d",i);
  }
 
  while (i!=-1){
  i = T[i].r;
 
  if(i!=NIL){
    printf(", %d", i);
  }
  }
  printf("]\n");
}
 
int main(){
  int i, j, d, v, c, l, n;
 
  scanf("%d", &n);
 
  for(i=0;i<n;i++){
    T[i].p = T[i].l = T[i].r = NIL;
  }
 
  for ( i = 0; i < n; i++ ){
 
    scanf("%d %d",&v,&d);
 
    for(j=0;j<d;j++){
      scanf("%d",&c);
       T[c].p = v;
   
       if(j==0){
     T[v].l = c;
       }else if(j>0){
     T[l].r = c;
       }
       l = c; 
  
    }
  }  
 
  for (i=0;i<n;i++){
    print(i);
  }  
  return 0;     
}

Measured memory_bytes: 2176
a=str(raw_input()).split(" ")
b=set(a)
c,d=[0,""],""
for i in b:
    if len(i)>len(d): d=i
    if a.count(i)>c[0]:
        c[1]=i
        c[0]=a.count(i)
print(c[1]+" "+d)

Measured memory_bytes: 6228
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>

using namespace std;

int main()
{
    int n;
    cin >> n;
    map<int,int> b;
    for (int i =0; i < n; i++) {
        int a;
        cin >> a;
        b[a-1]++;
        b[a]++;
        b[a+1]++;
    }

    cout << max_element(b.begin(), b.end(),
                        [](pair<int,int> a, pair<int,int> b)
                        {
                            return a.second < b.second;
                        })->second << endl;

    return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+7;
int a[N],i,j,k,n;
int main() {
	cin>>n;
	for(i=0;i<n;i++)cin>>a[i];

	map<int,int> mp;
	for(i=0;i<n;i++){
		mp[a[i]]=1+mp[a[i]-1];
	}
	int maxi=-1;
	for(pair<int,int> p:mp)maxi=max(maxi,p.second);


	cout<<n-maxi<<"\n";
	return 0;
}

Measured memory_bytes: 10368
# -*- coding- utf-8 -*-
# C - Sum of gcd of Triplets (Easy)
# モジュールのインポート
import math
import itertools
from functools import reduce

# 標準入力の取得
K = int(input())

# 求解処理
result = 0
for a,b in itertools.product(range(1, K+1), repeat=2):
    d = math.gcd(a, b)
    for c in range(1, K+1):
        result += math.gcd(d, c)

# 結果出力
print(result)

Measured memory_bytes: 9452
#include <stdio.h>
int main (){
  int x,y,s,sum1,sum2,i,j,max,a[1000],b[1000],count;
  
  while(1){
    
    scanf("%d%d%d",&x,&y,&s);
    if(x==0 && y==0 && s==0)break;
    
    count=0;
    
    for(i=1;i<=s;i++){
      for(j=1;j<=s;j++){
	
	sum1 = (int)((double)i*(100+x)/100) + (int)((double)j*(100+x)/100);
	if(s==sum1){
	  a[count]=i;
	  b[count]=j;
	  count++;
	}
      }
    }
    max=0;
    
    for(i=0;i<count;i++){
      sum2 = (int)((double)a[i]*(100+y)/100) + (int)((double)b[i]*(100+y)/100);
      if(max<sum2){
	  max=sum2;
	}
    }
    
    printf("%d\n",max);
      
  }
  
  
  return 0;
}

Measured memory_bytes: 608