akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main() {
	int D;
	int	N; //100でちょうどD回割れる制すの中でN番目に小さいもの
	cin >> D >> N;
	int sp = 100;

	for (int i = 1; i < D; i++) {
		sp *= 100;
	}
	if (D == 0)sp = 1;

	if (N <= 99) {
		cout << sp * N;
	}else {
		cout << sp * 101;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

    double money[N];
    string unit[N];
    double sum = 0.0;
    double rate = 380000.0;
    for (int i = 0; i < N; ++i) {
        cin >> money[i] >> unit[i];

        if (unit[i] == "BTC") {
            sum += money[i] * rate;
        } else {
            sum += money[i]; 
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#define LINE_BUF_SIZE  1024

int main(void) {
  
  int i;
  long long int N,K;
  long long int t = 0;

  scanf("%lld %lld",&N,&K);
  t = N % K;
  if(t >= K - t){
      printf("%lld",K - t);
   }else{
      printf("%lld",t);
   }
  return 0;
}

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

void main_()
{
    ll N;
    cin >> N;

    auto ok = 1;
    auto ng = N + 1;
    while (abs(ok - ng) > 1) {
        auto mid = (ok + ng) / 2;
        if (mid * (mid + 1) / 2 < N) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    ll ans = ok + 1;
    ll n = N;
    while (n > 0) {
        ans = min(n, ans);
        cout << ans << "\n";
        n -= ans;
        ans--;
    }
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n;i++)
int main(void) {
	int n, m,a,b[20],c,ans= 0,sum;
	cin >> n >> m >> c;
	rep(i, m) cin >> b[i];
	rep(i, n) {
		sum = 0;
		rep(j, m) {
			cin >> a;
			sum += a * b[j];
		}
		sum += c;
		if (sum > 0) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset>
#include<unordered_map> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #include "boost/algorithm/string.hpp"
#define fio ios_base::sync_with_stdio(false)
#define mod 998244353
#define mod1 mod
#define mod2 1000000007
#define li long long int
#define ll long long int
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s", x)
#define readl(x) scanf("%I64d",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 1000000000010000005
#define MINN -1000000000000000000
#define INTMAX 1000001000
#define pii pair<ll,ll> 
#define pdd pair<double,double>
#define pic pair<int,char>
#define N 500005
#define lgn 20
#define ddouble long double
#define minus minu
#define PI 2*acos(0)
#define lgn 20
 
 
// #define INTMAX 200000000 
 
// using namespace boost;
// #define si short int
 
using namespace std;
using namespace __gnu_pbds;             
typedef priority_queue<pii, vector<pii > > max_pq;
typedef priority_queue<pii, vector<pii> , greater<pii>  > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}
 
// using namespace __gnu_pbds;         
// typedef priority_queue<pair<ll,char> , vector<pair<ll , char> > > max_pq;
// typedef priority_queue<pii , vector<pii > ,greater<pii > > min_pq;
typedef tree<pair<string,string> , null_type, less<pair<string,string> >, rb_tree_tag, tree_order_statistics_node_update> OST;
// typedef priority_queue<pair < ll , pair < pii , ll > >  , vector<pair < ll , pair < pii , ll > >  > ,greater<pair < ll , pair < pii , ll > >  > > min_pq;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif
#define nn 2000005
ll n;
ll ar[ N ];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	cin >> n;
	ll val = 1,flg = 1;	
	for ( ll i = 1; i <= n; i ++){
		ll p;
		cin >> p;
		if ( p == 0 ){
		    val = 0;
		    flg = 1;
		}
		if ( flg and sqrt(val)*sqrt(p) <= 1000000000L ){
		    if ( val*p <= 1000000000000000000L ){
		        val = val*p;
		    }
		    else{
		        flg = 0;
		    }
		}
		else{
		    flg =0;
		}
	 	
	}
	if ( flg ){
	    cout << val;
	}
	else{
	    cout << "-1";
	}
        
}

Measured memory_bytes: 3684
import java.util.Scanner;

class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String S=sc.next();
		int ans=0,temp=0;
		for(int i=0;i<S.length();i++) {
			if(S.charAt(i)=='A'||S.charAt(i)=='C'||S.charAt(i)=='G'||S.charAt(i)=='T') {
				temp++;
				ans=Math.max(temp,ans);
			}else {
				temp=0;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 35760
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            sS = Console.ReadLine().Trim().Split(' ');
            List<long> lstInp = new List<long>();
            for (int i = 0; i < sS.Length; i++) { lstInp.Add(long.Parse(sS[i])); }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            long iAll = lstInp.Sum();
            long iSnk = 0;
            long iAri = iAll;
            List<long> lstRet = new List<long>();
            for (int i = 0; i < lstInp.Count - 1; i++)
            {
                iSnk += lstInp[i];
                iAri -= lstInp[i];
                long iDef = Math.Abs(iSnk - iAri); 
                lstRet.Add(iDef);
                if (iDef == 0) { break; }
            }

            //出力
            Console.WriteLine("{0}", lstRet.Min().ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


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

int main(int argc, const char * argv[]) {
    int i,n=0;
    char w[11], t[1001];
    
    scanf("%s", w);
    
    //一行ずつ見る
    do{
        scanf("%s", t);
        if (strcmp(t, "END_OF_TEXT") == 0) break;
        
        for (i=0; t[i]!='\0'; i++) {//一文字ずつ見て
            if (t[i]<91) t[i] += 32;//大文字なら小文字にする
        }
        if (strcmp(w, t) == 0) n++;
        
    }while(1);
    printf("%d\n", n);
    return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;

using namespace std;

const long long mod = 1000000007;

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

	int n;
	cin >> n;
	int* d;
	d = new int[n];

	rep(i, n) cin >> d[i];

	int ans = 0;
	rep(i, n) {
		REP(j, i+1, n) {
			ans += d[i] * d[j];
		}
	}

	cout << ans << "\n";

    return 0;
}


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

const int N=1e5+10;

int n;
int A[N*3];
int B[N*3];
int f[N*3],g[N*3];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n*3;i++) scanf("%d",&A[i]),B[i]=A[i];
	sort(B+1,B+n*3+1);
	int m=unique(B+1,B+n*3+1)-B-1;
	for(int i=1;i<=n*3;i++) A[i]=lower_bound(B+1,B+m+1,A[i])-B;
	long long Ans=-1e15;
	long long res=0;
	int s1=m,t1;
	for(int i=1;i<=n;i++) f[A[i]]++,s1=min(s1,A[i]),res+=B[A[i]];
	t1=f[s1];
	for(int i=n+1;i<=n*3;i++) g[A[i]]++;
	long long now=n;
	int s2,t2;
	//for(int i=1;i<=n*3;i++) cout<<A[i]<<' ';
	//cout<<endl;
	for(int i=1;i<=m;i++)
	{
		if(now-g[i]<=0)
		{
			s2=i;
			t2=now;
			res-=(long long)now*B[i];
			break;
		}
		now-=g[i],res-=(long long)g[i]*B[i];
	}		
	Ans=res;
	//cout<<res<<' '<<s1<<' '<<t1<<' '<<s2<<' '<<t2<<endl;
	for(int i=n+1;i<=2*n;i++)
	{
		f[A[i]]++;
		if(A[i]>s1)
		{
			t1--;
			res-=B[s1];
			res+=B[A[i]];
			if(!t1)
			{
				s1++;
				while(!f[s1]) s1++;
				t1=f[s1];
			}
		}
		if(A[i]<=s2)
		{
			res+=B[A[i]];
			t2++;
			//if(i==3) cout<<t2<<endl;
			if(t2>g[s2])
			{
				s2++;
				while(!g[s2]) s2++;
				t2=1;
			}
			res-=B[s2];
		}
		else g[A[i]]--;
		Ans=max(Ans,res);
	}
	cout<<Ans<<endl;
}
	
	

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

int main() {
    long long N;
    cin >> N;
    long long M = 1e18;
    for (int i = 0; i < 5; i++) {
        long long v;
        cin >> v;
        M = min(M, v);
    }

    cout << (N + M - 1) / M + 4 << endl;
    return 0;
}

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

int main()
{
  int n; string s;
  cin>>n>>s;
   vector<vector<int> > bw;
   bw.resize(s.length(), vector<int>(2,0));
   for(int i=0; i<s.length(); i++)
   {
     if(i==0)
     {
       if(s[i] == '#')
       {
         bw[0][0]=0;
         bw[0][1]=1;
       }
       else
       {
         bw[0][0]=1;
         bw[0][1]=0;
       }
     }
     else
     {
       if(s[i] == '#')
       {
         bw[i][0] = min(bw[i-1][0],bw[i-1][1]);
         bw[i][1] = bw[i-1][1]+1;
       }
       else
       {
         bw[i][0] = min(bw[i-1][0],bw[i-1][1])+1;
         bw[i][1] =  bw[i-1][1];
       }
     }
     
   }
  int minChange = min(bw[s.length()-1][0],bw[s.length()-1][1]);
  cout<<minChange<<"\n";
  return 0;
  
}

Measured memory_bytes: 11396
#include<cstdio>
#include<iostream>
#include<vector> 
#include<algorithm>
#define mk make_pair
#define pk push_back 
using namespace std;
typedef long long LL;
typedef pair<int,int> pi;
const int mod=1e9+7;
int kpow(int a,int k){
	int res=1;
	for(;k;k>>=1,a=1ll*a*a%mod)if(k&1)res=1ll*res*a%mod;
	return res;
}
int main(){
	ios::sync_with_stdio(false);
	LL n;
	cin>>n;
	if(n==1){
		cout<<0<<endl;
		return 0;
	}
	LL ans=kpow(10,n);
	ans-=kpow(8,n);
	ans-=1ll*(kpow(9,n)-kpow(8,n))*2;
	ans%=mod;ans+=mod;
	ans%=mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
int a[100005],ans[100005];
int main()
{
    int n;
    cin>>n;
    int numn=0,nump=0;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]<=0)
        {
            numn++;
            ans-=a[i];
        }
        else if(a[i]>0)
        {
            nump++;
            ans+=a[i];
        }
    }
    sort(a,a+n);
    if(numn&&nump)
    {
        cout<<ans<<endl;
        for(int i=numn;i<n-1;i++)
        {
            cout<<a[0]<<" "<<a[i]<<endl;
            a[0]-=a[i];
        }
        for(int i=0;i<numn;i++)
        {
            cout<<a[n-1]<<" "<<a[i]<<endl;
            a[n-1]-=a[i];
        }
    }
    else if(numn)
    {
        cout<<ans+2*a[n-1]<<endl;
        for(int i=0;i<n-1;i++)
        {
            cout<<a[n-1]<<" "<<a[i]<<endl;
            a[n-1]-=a[i];
        }
    }
    else //(nump)
    {
        cout<<ans-2*a[0]<<endl;
        for(int i=n-1;i>1;i--)
        {
            cout<<a[0]<<" "<<a[i]<<endl;
            a[0]-=a[i];
        }
        cout<<a[1]<<" "<<a[0]<<endl;
    }
}


Measured memory_bytes: 2304
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    H,W = LI()

    ans = INF

    for i in range(1,H):
        b1 = i * W
        b2 = (H-i) * (W//2)
        b3 = (H-i) * (W - W//2)
        ans = min(ans,max(b1,b2,b3) - min(b1,b2,b3))

        if i < H-1:
            b2 = ((H-i)//2) * W
            b3 = ((H-i) - (H-i)//2) * W
            ans = min(ans,max(b1,b2,b3) - min(b1,b2,b3))
    for i in range(1,W):
        b1 = i * H
        b2 = (W - i) * (H // 2)
        b3 = (W - i) * (H - H // 2)
        ans = min(ans, max(b1, b2, b3) - min(b1, b2, b3))

        if i < W - 1:
            b2 = ((W - i) // 2) * H
            b3 = ((W - i) - (W - i) // 2) * H
            ans = min(ans, max(b1, b2, b3) - min(b1, b2, b3))

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 41708
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) (1e9 + 7);
//const ll MOD = 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);

    ll n;
    cin >> n;
    cout << n * (n - 1) / 2 << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int a[3][3];
signed main(){
	rep(i,3)rep(j,3)scanf("%d",&a[i][j]);
	rep(i,2){
		set<int>s;
		rep(j,3){
			s.insert(a[i+1][j]-a[i][j]);
		}
		if(s.size()!=1){
			puts("No");return 0;
		}
		s.clear();
		rep(j,3){
			s.insert(a[j][i+1]-a[j][i]);
		}
		if(s.size()!=1){
			puts("No");return 0;
		}
	}
	puts("Yes");
}

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

int main()
{
  int H, W;
  string s = "";
  cin >> H >> W;
  while (H != 0 && W != 0)
  {
    for (int j = 0; j < W; j++)
    {
      s += "#";
    }
    for (int i = 0; i < H; i++)
    {
      cout << s << endl;
    }
    printf("\n");
    s = "";
    cin >> H >> W;
  }
}


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

using std::pair;
using std::vector;
using std::string;

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

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

const int N = 100;
int n, x; 
int a[N + 5];

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    read(n); read(x);
    for(int i = 1; i <= n; ++i) read(a[i]);
    std::sort(a + 1, a + n + 1);

    int ans = 0;
    for(int i = 1; i <= n; ++i) if(x >= a[i]) ++ ans, x -= a[i];
    if(x && ans == n) -- ans;
    printf("%d\n", ans);

    return 0;
}


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

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

	int N,D;
	ll x,y;
	int i,k;
	ll ans=0;
	int ctr=0;

	cin >> N >> D;

	rep(i,N){
		cin >> x >> y;
		if(sqrt(x*x+y*y)<=D) ans++;
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3696
#pragma target("avx")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define rep(i,b,e) for(ll i=b; i<e; i++)
#define be(vec) vec.begin(),vec.end()
#define print(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define scan(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n, p;
	scanf("%d %d", &n, &p);
	ll one = 0, zero = 0;
	rep(i, 0, n){
		int tmp;
		scanf("%d", &tmp);
		if(tmp%2) one++;
		else zero++;
	}

	ll comb[one+1], sum=(p==0);
	comb[0] = 1;
	for(int i=1; i<=one; i++){
		comb[i] = comb[i-1] * (one-i+1) / i;
		if(i%2==p) sum += comb[i];
	}
	printf("%ld\n", sum * (1l<<zero));
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[])
{

    int imp,hour,min,sec;
    scanf("%d",&imp);
    
    sec = imp%60;
    min = (imp - imp%60)/60;
    hour = (min - min%60)/60;
    min = min - hour*60;
    
    printf("%d:%d:%d\n",hour,min,sec);
    return 0;
}

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

const int MOD=1e9+7;

long long n,a,b;

int power(int a,int b)
{
	int num=a,ans=1;
	for(int i=0;i<31;i++)
	{
		if(b&(1<<i)) ans=(1ll*ans*num)%MOD;
		num=(1ll*num*num)%MOD;
	}
	return ans;
}

int inverse_euler(int n)
{
	return power(n,MOD-2);
}

long long c(long long n,long long r)
{
	long long num=1;
	for(int i=n-r+1;i<=n;i++) num=(num*i)%MOD;
	long long den=1;
	for(int i=1;i<=r;i++) den=(den*i)%MOD;
	return (num*inverse_euler(den))%MOD;
}

int main()
{
	cin>>n>>a>>b;

	long long ans=(power(2,n)-1-c(n,a)-c(n,b))%MOD;
	if(ans<0) ans+=MOD;
	cout<<ans;
}

Measured memory_bytes: 256
N, L = map(int, input().rstrip().split())

full = int(N*L + N*(N+1)/2 - N)
absdiff = []
diff = []
for i in range(1,N+1):
    absdiff.append(abs(L+i-1))
    diff.append(full-(L+i-1))

print(diff[absdiff.index(min(absdiff))])

Measured memory_bytes: 3060
import java.util.*;
import java.io.*;

class Main {

	static int n;
	static int[] d;
	static int[] f;
	static int[][] adj;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		n = Integer.parseInt(br.readLine());
		adj = new int[n][n];

		for (int i=0; i<n; i++) {
			String line = br.readLine();
			String[] str = line.split(" ");
			for (int j=2; j<str.length; j++) {
				adj[Integer.parseInt(str[0])-1][Integer.parseInt(str[j])-1] = 1;
			}
		}

		Queue<Integer> que = new LinkedList<Integer>();

		int[] d = new int[n];
		Arrays.fill(d,-1);
		d[0] = 0;
		que.add(0);
		while (que.size() != 0) {
			int now = que.poll();
			for (int i=0; i<n; i++) {
				if (adj[now][i] == 1 && i != now && d[i] == -1){
					que.add(i);
					d[i] = d[now]+1;
				}
			}
		}

		for (int i=0; i<n; i++) {
			System.out.println((i+1)+" "+d[i]);
		}

		br.close();
	}

}

Measured memory_bytes: 19200
#include<bits/stdc++.h>
using namespace std;
int main() 
{
    int n, ans = 1e9, i;
    vector <pair<int, int> > v, w;
    map <int, int> mp1, mp2;
    map <int, int>::iterator it;
    scanf("%d", &n);
    for (i = 0; i < n; i++) 
	{
        int x;
        scanf("%d", &x);
        if (i % 2 == 0) 
            mp1[x]++;
        else 
            mp2[x]++;
    }
    mp1[1e9] = 0;
    mp2[1e9] = 0;
    for (it = mp1.begin(); it != mp1.end(); it++) 
		v.push_back(make_pair(it->second, it->first));
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    for (it = mp2.begin(); it != mp2.end(); it++) 
		w.push_back(make_pair(it->second, it->first));
    sort(w.begin(), w.end());
    reverse(w.begin(), w.end());
    /*for (i = 0; i < v.size(); i++) 
	{
        int p = 0;
        if (v[i].second == w[0].second)
			p = 1;
        ans = min(ans, n - (v[i].first + w[p].first));
    }*/
    if(v[0].second!=w[0].second)
    	ans=v[0].first+w[0].first;
    else
    	ans=max(v[0].first+w[1].first,v[1].first+w[0].first);
    printf("%d\n",n-ans);
    return 0;
}

Measured memory_bytes: 6136
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const long long INF = 1LL << 60;
const long long 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;
}
//以上テンプレ
vl dp(100010,INF);

ll q(ll a){
    if(a<0) return INF;
    if(dp.at(a)<INF) return dp.at(a);
    if(a==0) return 0;

    ll re=1+min({q(a-1),q(a-6),q(a-36),q(a-216),q(a-1296),q(a-7776),q(a-46656),q(a-9),q(a-81),q(a-729),q(a-6561),q(a-59049)});
    return dp.at(a)=re;
}

int main(){
ll N;
cin>>N;
cout<<q(N)<<endl;
}


Measured memory_bytes: 13568
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;



int main() {

	string S;
	int check=0;
	cin >> S;

	//偶数でR?
	for (int i = 0; i < S.size(); i += 2) {
		if (S.at(i) == 'L') {
			check = 1;
			break;
		}
	}
	//奇数でL?
	for (int i = 1; i < S.size(); i += 2) {
		if (S.at(i) == 'R') {
			check = 1;
			break;
		}
	}

	if (check == 1)
		cout << "No" << endl;
	else if(check==0)
		cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
(setf *read-default-float-format* 'double-float)
(let ((n (read))
      (k (read))
      temp
      (ans 0))
  (loop for i from 1 upto n do
        (setf temp 0)
        (loop for j from 0 upto 20
              while (< (* i (expt 2 j)) k) do (incf temp))
        (incf ans (/ 1 (* n (expt 2 temp)))))
  (format t "~A~%" (/ ans 1.0)))


Measured memory_bytes: 13028
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    a,b,x = LI()
    ok = 0
    ng = 90

    while ng - ok >= 10**(-8):
        middle = (ng+ok) /2
        volume = 0

        if a*math.tan(math.radians(middle)) <= b:
            volume = a**2*b - a**3*math.tan(math.radians(middle))/2
        else:
            volume = a*b**2/(2*math.tan(math.radians(middle)))
        if volume >= x:
            ok = middle
        else:
            ng = middle
    
    ans = ok
    print(ans)
main()


Measured memory_bytes: 75184
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long n; cin >> n;
	long long a = 1, b;
	for (long long i = 2; i * i <= n; i++){
		if(n % i == 0) a = i;
	}
	b = n / a;
	cout << a + b - 2 << endl;
	return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5,mod=1e9+7;
int n,m,x[N],a[N],b[N],c[N],w[N],X,Y;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define re(i,a,b) for(int i=(a);i<(b);i++)
int fa[N];
int getf(int x){return fa[x]==x?x:fa[x]=getf(fa[x]);}
#define w1 first 
#define pb push_back
#define w2 second
typedef pair<int,int> pa;
typedef long long ll;
int mnv[N],mni[N];
vector<int>vec[N],son[N];
vector<pa>oo;
ll qpow(ll a,ll b,ll mod){ll res=1;for(;b;b>>=1,a=a*a%mod)if(b&1)res=res*a%mod;return res;}
ll fac[N],ifac[N];
int main(){
	scanf("%d%d%d",&n,&X,&Y);
	rep(i,1,n)fa[i]=i;
	fac[0]=1;
	rep(i,1,n)fac[i]=fac[i-1]*i%mod;
	ifac[n]=qpow(fac[n],mod-2,mod);
	repd(i,n-1,0)ifac[i]=ifac[i+1]*(i+1)%mod;
	rep(i,1,n){
		scanf("%d%d",&c[i],&w[i]);
		if(!mni[c[i]]||mnv[c[i]]>w[i])mni[c[i]]=i,mnv[c[i]]=w[i];
		vec[c[i]].push_back(i);
	}
	rep(i,1,n)if(vec[i].size()){
		re(j,0,vec[i].size())if(mnv[i]+w[vec[i][j]]<=X){
			fa[getf(vec[i][j])]=getf(mni[i]);
		}
	}
	rep(i,1,n)if(mni[i])oo.pb(pa(mnv[i],mni[i]));
	sort(oo.begin(),oo.end());
	if(oo.size()>1){
		rep(i,1,n){
			int id=oo[0].w2;
			if(c[id]!=c[i])if(w[i]+w[id]<=Y)
				fa[getf(i)]=getf(id);
			id=oo[1].w2;
			if(c[id]!=c[i])if(w[i]+w[id]<=Y)
				fa[getf(i)]=getf(id);
		}
	}
	rep(i,1,n)son[getf(i)].pb(i);
	ll ans=1;
	rep(i,1,n)if(son[i].size()){
		map<int,int>mp;map<int,int>::iterator it;
		re(j,0,son[i].size())mp[c[son[i][j]]]++;
		ans=ans*fac[son[i].size()]%mod;
		for(it=mp.begin();it!=mp.end();it++)
			ans=ans*ifac[it->w2]%mod;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 31600
#include<bits/stdc++.h>
using namespace std;
int n,a[200001];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=2;i<=n;i++)if(a[i]==a[i-1])
	{
		puts("NO");
		return 0;
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 1024
#include"bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.141592653589793238

int main() {
	string S;
	cin >> S;
	int count0 = 0;
	rep(i, S.size()) {
		if (S[i] == '0') {
			count0++;
		}
	}
	cout << min(count0, (int)S.size() - count0) * 2 << endl;
	return 0;
}

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

A_divisor = set()
for i in range(1, A+1):
    if divmod(A,i)[1] == 0:
        A_divisor.add(i)

B_divisor = set()
for i in range(1, B+1):
    if divmod(B,i)[1] == 0:
        B_divisor.add(i)

Intersection = list(A_divisor & B_divisor)
print(sorted(Intersection, reverse=True)[C-1])


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <list>
#include<utility>
#include <new>
#include <string>
#include<cmath>
#include<unordered_set>
#include<iomanip>
#include <stack>
#include<queue>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define loop(i,x,z) for (int i=x;i<z;i++)
using ll =  long long int;
#define mod 1000000007
/*bool cmp(pair<ll,ll>a,pair<ll,ll>b){
return a.second<b.second;
}*/
int main()
{
    int n;
    cin>>n;
    vector<int>a(n);
    loop(i,0,n){
    cin>>a[i];
    }
    long long ans=0;
    vector<int>dp(n,0);
    dp[n-1]=a[n-1];
    for(int i=n-2;i>=1;i--){
        dp[i]=dp[i+1]+a[i];
        dp[i]=dp[i]%mod;
    }
    loop(i,0,n-1){
            ans+=(ll)a[i]*dp[i+1];
            ans=ans%mod;
        }
cout<<ans;
	return 0;
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define ip pair<ll,ll>
#define ff first
#define ss second
#define MAX 100005
const ll MOD = 1000000007;

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

	ll n,k;
	cin>>n>>k;
	ll a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=k;i<n;i++){
		if(a[i] > a[i-k])
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}
}

Measured memory_bytes: 5204
import java.util.*;
import java.io.*;
class Main{
    public static void main(String[] args){
	try{
	    BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
	    String st;
	    while((st=s.readLine())!=null){
		int count = 0, n = Integer.valueOf(st);
		int[] x = new int[n+1];
		for(int i=2; i<=Math.sqrt(n); i++)
		    if(x[i]==0)
			for(int j=i*i; j<=n; j+=i)
			    x[j]=1;
		for(int i=2; i<=n; i++)
		    if(x[i]==0)
			count++;
		System.out.println(count);
	    }
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
}

Measured memory_bytes: 13000
#include<bits/stdc++.h>
char s[100002];
using namespace std;
int main()
{
	scanf("%s",&s);
	int len=strlen(s),z=0;
	for(int i=0;i<len;i++)
	  {
	  	if(s[i]=='p')
	  	  z++;
	  }
	cout<<len/2-z;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll ar[3][3];
    for(ll i=0;i<3;i++)
    {
        for(ll j=0;j<3;j++) 
            cin>>ar[i][j];
    }
    ll n;
    cin>>n;
    ll b[n];
    for(ll i=0;i<n;i++)
        cin>>b[i];
    for(ll i=0;i<3;i++)
    {
        for(ll j=0;j<3;j++)
        {
            for(ll k=0;k<n;k++)
            {
                if(b[k]==ar[i][j])
                    ar[i][j]=0;
            }
        }
    }
    ll flag=0;
    for(ll i=0;i<3;i++)
    {
        if(ar[i][0]==0 && ar[i][1]==0 && ar[i][2]==0)
            flag=1;
    }
    for(ll i=0;i<3;i++)
    {
        if(ar[0][i]==0 && ar[1][i]==0 && ar[2][i]==0)
            flag=1;
    }
    if(ar[0][0]==0 && ar[1][1]==0 && ar[2][2]==0)
        flag=1;
    if(ar[0][2]==0 && ar[1][1]==0 && ar[2][0]==0)
        flag=1;
    if(flag==1)
        cout<<"Yes";
    else
        cout<<"No";
}

Measured memory_bytes: 256
from itertools import combinations as comb

B = [0,0,0,0,0]
for i in range(int(input())):
    z = input()[0]
    if z == 'M':
        B[0] += 1
    elif z == 'A':
        B[1] += 1
    elif z == 'R':
        B[2] += 1
    elif z == 'C':
        B[3] += 1
    elif z == 'H':
        B[4] += 1
ans = 0
for b in list(comb(B,3)):
    ans += b[0]*b[1]*b[2]
print(ans)

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

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

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

    ll a,b,c;
    cin >> a >> b >> c;

    if(a==b)
    {
    	if(a==c)
    	{
    		cout << "Yes" << endl;
    		return 0;
    	}
    }

    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>

char s[20];
int main()
{
	scanf("%s", s + 1);
	for (int i = 1; i <= 19; ++i)
		if (s[i] == ',')
			s[i] = ' ';
	printf("%s", s + 1);
	return 0;
}

Measured memory_bytes: 128
s=input().rstrip().split(' ')
x=int(s[0])
n=int(s[1])

if(n>0):
    s=input().rstrip().split(' ')
    p=[]
    
    for i in s:
        p.append(int(i))
    
    p.sort()
    cur1=x
    count1=0
    
    if(p[n-1]>x):
        while(cur1 in p):
            cur1+=1
            count1+=1
    elif(p[n-1]==x):
        cur1+=1
        count1+=1
        
    cur2=x
    count2=0
    
    if(p[0]<x):
        while(cur2 in p):
            cur2-=1
            count2+=1
    elif(p[n-1]==x):
        cur2-=1
        count2+=1
        
    if(count1>=count2):
        print(cur2)
    else:
        print(cur1)
        
else:
    print(x)

Measured memory_bytes: 9252
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
using ll = long long; using ld = long double; const char nl = '\n';
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

#include <bits/extc++.h>
namespace pbds =  __gnu_pbds;
template <typename key, typename val=pbds::null_type, typename comp=less<key>>
using ostree=pbds::tree<key,val,comp,pbds::rb_tree_tag,pbds::tree_order_statistics_node_update>;
using vi = vector< int >; using vll = vector< ll >;
#define all(x) std::begin(x), std::end(x)
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename...Args, template<typename...> typename T> string to_string(T<Args...> const&);
string to_string(string const&s){return '"'+s+'"';}
string to_string(char const &c) {return to_string(string(1,c));}
string to_string(char const *c) {return to_string(string(c));}
string to_string(bool const &b) {return (b ? "1" : "0");}
template<typename... Args> string to_string(pair<Args...> const&p)
{return "("+to_string(p.first)+", "+to_string(p.second)+")";}
template <typename...Args, template<typename...> typename T> string to_string(T<Args...> const&S)
{string s = "{"; for(auto const& e: S)s+=" "+to_string(e);s+=" }"; return s;}
template<typename Tail> void debug_out(Tail t) {cerr<<" "<<to_string(t)<<" ]"<<endl;}
template<typename Head, typename... Tail> void debug_out(Head h, Tail... t)
{cerr << " " << to_string(h) << ","; debug_out(t...);}
#define pr(...) cerr<<"["<<(#__VA_ARGS__)<<"] : [", debug_out(__VA_ARGS__)
template <typename T> void dbr(T lb, T ub)
{cerr<<'{';for(auto it=lb; it!=ub; it++)cerr<<' '<<to_string(*it); cerr<<" }"<<endl;}
template<typename T, typename Comp=less<T>> bool smin(T &mem, T const&v, Comp const&cmp=Comp())
{return cmp(v, mem) ? mem = v, true : false;}
template<typename T, typename Comp=less<T>> bool smax(T &mem, T const&v, Comp const&cmp=Comp())
{return cmp(mem, v) ? mem = v, true : false;}
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

int const N = 2010;
ll dp[N][N];
ll const mod = 7+(ll)1e9;
int n, k;
int r, b;


ll modular_exponentiation(ll x, ll p, ll mod) {
  ll y = 1;
  for(; p>0; p>>=1, x = (x*x)%mod) if( p & 1 ) y = (y*x)%mod;
  return y;
}


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

  cin >> n >> k;
  b = k, r = n-k;

  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  for(int parts=1; parts<=b; parts++) {
    ll z[N]; z[0] = dp[parts-1][0];
    for(int i=1; i<=b; i++) z[i] = (z[i-1] + dp[parts-1][i]) % mod;
    for(int j=1; j<=b; j++) {
      dp[parts][j] = z[j-1] % mod;
    }
  }

  ll N = r+1, D = 1, F = N;
  for(int segs=1; segs<=b; segs++) {

    ll ans = dp[segs][b];
    ans = (ans * F) % mod;
    cout << ans << nl;

    N--, D++;
    F = (F * N) % mod;
    F = (F * modular_exponentiation(D, mod-2, mod))%mod;
  }

}
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */


Measured memory_bytes: 31872
#ifndef _UNICODE
#define _UNICODE
#endif
#ifndef UNICODE
#define UNICODE
#endif

#include <stdio.h>
#include <wchar.h>

#include <algorithm>
#include <bitset>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <unordered_map>

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define int_pair second
#define SZ(X) ((int64_t)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define S1(X) scanf("%d", &(X))
#define S2(X, Y) scanf("%d%d", &(X), &(Y))
#define S3(X, Y, Z) scanf("%lld%lld%lld", &(X), &(Y), &(Z))
#define P1(X) printf("%lld", (X))
#define P2(X) printf("%lld\n", (X))
#define _ printf(" ");
#define __ printf("\n");
#define LEN(X) strlen(X)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define MOD 1000000007
#define EPS 1e-9
#define gcd(a, b) __gcd(a, b)
#define IOS ios_base::sync_with_stdio(0);
#define EACH(I, V) for (auto I : V)
#define REP(I, N) for (int64_t I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int64_t I = (A); I < (B); ++I)
#define REPPP(i, begin, end)                                                   \
  for (__typeof(end) i = (begin) - ((begin) > (end));                          \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

template<class T>
size_t choose(T a, T b, size_t src1, size_t src2) {
#if defined(__clang__) && defined(__x86_64)
  size_t res = src1;
  asm("cmpq %1, %2; cmovaeq %4, %0"
  :
  "=q" (res)
  :
  "q" (a),
  "q" (b),
  "q" (src1),
  "q" (src2),
  "0" (res)
  :
  "cc");
  return res;
#else
  return b >= a ? src2 : src1;
#endif
}

#define FOR(x, xs) for (__typeof( (xs).begin() ) x = (xs).begin(); x != (xs).end(); x++)

int64_t u = pow(10, 11) * 2;
int v = pow(u, 2.0 / 3);
int w = sqrt(u);

int64_t sum = 0;
vector<bool> isPrime(v + 1);

int nextPrime(int p) {
  while (!isPrime[++p]) {
  }
  return p;
}

vector<int64_t> divisors(vector<int64_t> &ps) {
  vector<int64_t> ds(1, 1), tmp; // 1 is divisor
  int64_t q = 1;
  FOR(p, ps) {
    if (*p != q) {
      tmp.clear();
      FOR(d, ds) {
        tmp.push_back(*d);
      } // tmp <- ds
    }
    FOR(t, tmp) {
      *t *= *p; // tmp <- map (p*) tmp
      ds.push_back(*t);
    }
    q = *p;
  }
  sort(ds.begin(), ds.end());
  return ds;
}

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

  int n, x;
  cin >> n;
  vector<int> arr;
  for (int i = 0; i < n; i++) {
    cin >> x;
    arr.push_back(x);
  }
  long long count = 0;
  map<int, int> _map;
  for (int i = 0; i < n; i++) {
    int v = arr[i] - (n - i);
    int find = i - arr[i] - n;
    if (_map.count(find)) {
      count += _map[find];
    }
    _map[v]++;
  }
  cout << count << '\n';
}


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

typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';


int N, p[200001], dist[200001], dep[200001], c[200001];
ll pow_2[200002], res;
vector<int>v[200001], u[200001];
pair<ll, ll>P[200001];
bool b[200001];

ll pw(ll x, int y) {
	ll a = 1;
	while (y) {
		if (y & 1)a = a*x%mod;
		x = x*x%mod;
		y /= 2;
	}
	return a;
}

ll modinv(ll x) {
	return pw(x, mod - 2);
}

void dfs(int x) {
	b[x] = false;
	if (u[x].empty()) {
		P[x] = { 1,1 };
	}
	else {
		P[x] = { 0,0 };
		ll a = 1;
		ll b = 1;
		for (int i : u[x]) {
			dfs(i);
			a *= P[i].second;
			a %= mod;
			b *= P[i].first + P[i].second;
			b %= mod;
		}
		for (int i : u[x]) {
			P[x].first += a*P[i].first%mod*modinv(P[i].second);
			P[x].first %= mod;
		}
		P[x].second = (mod + b - P[x].first) % mod;
	}
	u[x].clear();
}

int main() {
	cin >> N;
	pow_2[0] = 1;
	for (int i = 0; i <= N; i++) {
		pow_2[i + 1] = pow_2[i] * 2 % mod;
	}
	for (int i = 1; i <= N; i++) {
		cin >> p[i];
		dep[i] = dep[p[i]] + 1;
		c[p[i]]++;
	}
	for (int i = 0; i <= N; i++) {
		v[dep[i]].push_back(i);
	}
	for (int i = 0; i <= N; i++) {
		if (v[i].empty())break;
		queue<int>q;
		for (int j : v[i]) {
			q.push(j);
			b[j] = true;
		}
		while (!q.empty()) {
			int t = q.front();
			q.pop();
			if (t == 0)continue;
			if (!b[p[t]]) {
				b[p[t]] = true;
				q.push(p[t]);
			}
			u[p[t]].push_back(t);
		}
		dfs(0);
		res += P[0].first*pow_2[N + 1 - v[i].size()];
		res %= mod;
		for (int j : v[i]) {
			int t = j;
			while (c[t] == 0) {
				t = p[t];
				c[t]--;
			}
		}
		for (int j : v[i]) {
			if (p[j] != 0 && c[p[j]] == 1) {
				p[j] = p[p[j]];
			}
		}
	}
	cout << res << endl;
}

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

const int maxn = 2e5;
int a[maxn + 11],b[maxn + 11],c[maxn + 11];

int main(){
	int n;
	scanf("%d",&n);
	for (int i = 1; i <= n; i++) {
		scanf("%d",&a[i]);
	} 
	for (int i = 1; i <= n; i++) { 
		scanf("%d",&b[i]);
		c[i] = b[i];
	} 
	int ans = 0;
	for (int i = 0; i <= 28; i++){
		for (int j = 1; j <= n; j++) b[j] = b[j] % (1 << (i + 1));
		sort(b + 1, b + 1 + n);
		int cnt = 0;
		for (int j = 1; j <= n; j++) {
			int val = a[j] % (1 << (i + 1));
			if (b[n] >= (1 << i) - val){
				int e;
				if (b[n] < (1 << (i + 1)) - val) e = n;
				else e = lower_bound(b + 1 , b + 1 + n , (1 << (i + 1)) - val) - b - 1;
				int s = lower_bound(b + 1 , b + 1 + n , (1 << i) - val) - b;
				if (e - s + 1 > 0) cnt = (cnt + e - s + 1) % 2;
			}
			if (b[n] >= (1 << (i + 1)) + (1 << i) - val) {
				int ind = lower_bound(b + 1 , b + 1 + n , (1 << (i + 1)) + (1 << i) - val) - b;
				cnt = (cnt + n - ind + 1) % 2;
			}
		}
		if (cnt == 1) ans += (1 << i);
		for (int j = 1; j <= n; j++) b[j] = c[j];
	} 
	printf("%d\n",ans);
} 


Measured memory_bytes: 2560
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  n <- getInt
  as <- getIntVec n
  let s = V.sum as

      solve i x res
        | i == n - 1 = res
        | otherwise = let x' = x + as V.! i
                          y = s - x'
                          d = abs (x' - y)
                      in solve (i+1) x' (min res d)

      ans = solve 0 0 inf

  print ans

Measured memory_bytes: 6396
import copy
N,M=(int(x) for x in input().split())
H=[]
H.extend((int(x) for x in input().split()))
h=copy.copy(H)
for i in range(M):
    A,B=(int(x) for x in input().split())
    a=A-1
    b=B-1
    if H[a]<H[b]:
        h[a]=0
    elif H[a]>H[b]:
        h[b]=0
    else:
        h[a]=0
        h[b]=0
print(len([i for i in h if i!=0]))

Measured memory_bytes: 20880
#include "bits/stdc++.h"
#define rep(i,N) for (int (i) = 0; (i) < (N); (i)++)

int main() {

	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);
	
	int N, A, B; std::cin >> N >> A >> B;
	std::cout << (N * A > B ? B : N * A);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()

template<typename T>
struct Dijkstra{
  struct edge{
    int to;
    T cost;
  };
  int V;
  std::vector<std::vector<edge>>Edges;
  const T Inf = 1e9;

  Dijkstra(int V):V(V),Edges(V){}

  void add_edge(int from, int to, T cost){
    Edges[from].push_back({to, cost});
  }
  
  std::vector<T> execution(int s){
    std::vector<T> dist(V,Inf);
    std::priority_queue<std::pair<T,int>,std::vector<std::pair<T,int>>,std::greater<>>que;
    dist[s] = 0;
    que.push(std::make_pair(0, s));
    while(!que.empty()){
      int v = que.top().second;
      T cost = que.top().first;
      que.pop();
      if(dist[v] < cost)continue;
      for(auto e:Edges[v]){
	if(dist[e.to] > dist[v] + e.cost){
	  dist[e.to] = dist[v] + e.cost;
	  que.push(std::make_pair(dist[e.to], e.to));
	}
      }
    }
    return dist;
  }
};

int main(){
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  ll v,e,r;std::cin>>v>>e>>r;
  Dijkstra<int>dijkstra(v);
  for(int i=0;i<e;i++){
    ll a,b,c;std::cin>>a>>b>>c;
    dijkstra.add_edge(a,b,c);
  }
  for(auto e:dijkstra.execution(r)){
    if(e == INF)std::cout<<"INF"<<std::endl;
    else std::cout<<e<<std::endl;
    // std::cout<<((e == INF)?e:"INF")<<std::endl;
  }
  return 0;
}



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

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,si 2)

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))
int main()
{
    LL int i,j,n,m,a[100002]= {0};
    cin>>n;
    for(i=0; i<n; i++)
        cin>>a[i];
    sort(a,a+i,greater<int>());
    LL int ma=0,num=0;
    for(i=0; i<n-1; i++)
    {
        if(a[i]==a[i+1])
        {
            if(num==0)
                ma=a[i];
            else
                ma*=a[i];
            num++;
            i++;
        }
        if(num>=2)
            break;
    }
    if(num>=2)
        cout<<ma;
    else
        cout<<0;
}


Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;
using System.Runtime.InteropServices.ComTypes;
using System.Xml.Schema;
using System.ComponentModel.DataAnnotations;
using System.Security.Cryptography;
using System.Drawing;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (r, D,xi) = Slice3<long>();

            for (var i = 0; i < 10; ++i)
            {
                xi = r * xi - D;
                WriteLine(xi);
            }
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static public (T a, T b, T c, T d) Slice4<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)),
            (T)Convert.ChangeType(t[3], typeof(T)));
        }
    }
}

Measured memory_bytes: 27568