akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
#define pii pair<int,int>
#define pll pair<long long,long long>
#define usi unordered_set<int>
#define usl unordered_set<long long>
#define umii unordered_map<int,int>
#define umsi unordered_map<string,int>
#define umll unordered_map<long long,long long>
#define fi first
#define sec second
#define pub push_back
#define pob pop_back
#define B begin
#define E end
#define mp make_pair
#define vi vector<int>
#define vl vector<long long>
#define vii vector<pii>
#define vll vector<pll>
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define endl '\n'
#define PIE 3.141592653
#define MOD 1000000007
#define f(i,a,b,c) for(ll i=a;i<=b;i+=c)
#define frev(i,n,b,c)  for(ll i=n;i>=b;i-=c)
const ll inf = 1000000000000000000;
using namespace std;
 
//            < = = = = =    GCD     = = = = = >
 
ll gcd(ll a,ll b)
{
    if(a<b) gcd(b,a);
    if(b==0)    return a;
    return gcd(b,a%b);
}
 
//            < = = = = =    LCM     = = = = = >
 
ll lcm(ll a,ll b) 
{ 
    ll x=(a/gcd(a,b))*b; 
    return x;
}
 
//            < = = = = =    power  x^n     = = = = = >
 
ll power(ll x , ll n , ll m=inf){
    if(x==0){
        return 0;
    }
    if(n==0){
        return 1;
    }
    ll ans;
    if(n%2==0){
        ll smallAns = power(x,n/2,m);
        ans = (smallAns*smallAns)%m;        
    } else {
        ll smallAns = power(x,n-1,m);
        ans = x;
        ans = (ans*smallAns)%m;
    }
    // for negative values also
    return (ans+m)%m;
    
}
 
//            < = = = = =    CHECK FOR PRIME     = = = = = >
 
bool isprime(int n){
   if(n==2){
        return true;
    }
    else if(n%2==0){
        return false;
    }
    else{
        for(int i=3;i*i<=n;i+=2){
            if(n%i==0){
                return false;
            }
        }
        return true;
    }
}
 
//            < = = = = =    SOLVE    = = = = = >
 
 //  void generate() {
//     memset(div, 0, sizeof div);
//     for (int i = 1; i <= N; i++) {
//         for (int j = i; j <= N; j += i) {
//             divisors[j] += 1;
//         }
//     }
// }

// bool cmp(pll x, pll y){
//     ll dx = min(2*(x.first),x.second)-min(x.first,x.second);
//     ll dy = min(2*(y.first),y.second)-min(y.first,y.second);
//     return dx>dy;
// }
 
// void rec(int ){
//     if(){

//         return 0;
//     }

//     return ;
// }
 
int solve() {fastio
       string s;
       cin>>s;
       bool vbn=1;
       int ia=0,iz=0;
       f(i,0,s.length()-1,1){
        if(vbn && s[i]=='A'){
            ia=i;
            vbn=0;
        }
        if(s[i]=='Z')iz=i;
       }
       cout<<iz-ia + 1;
    return 0;
}
    
//            < = = = = =    MAIN     = = = = = >
 
int main() {fastio

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

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

    return 0;
}


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

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    priority_queue<int>h;
    for(int i=0 ; i<n ; i++){
        int x;
        cin>>x;
        h.push(x);
    }
    long long ans=0;
    if(k>=n)
        ans=0;
    else{
        while(k--){
            h.pop();
        }
        while(!h.empty()){
            ans+=h.top();
            h.pop();
        }
    }
    cout<<ans;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {

  int N;cin>>N;
  
  int check=0;
  
  for(int i=1;i<=9;i++){
    if(N%i==0){
    if(N/i<10){
      check++;
    }
    else{
      check+=0;
    }
    }
    else{
      check+=0;
    }
  }
  
  if(check!=0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
N=int(input())

L = list(map(int, input().split()))

re1=0
re2=0
i=0
for i in range(N-1):
    if L[i] >= L[i+1]:
        re2 += 1
    else:
        if re2 > re1:
            re1 = re2
        re2=0

if re2 > re1:
    re1 = re2
print(re1)



Measured memory_bytes: 63984
#!/usr/bin/env python3
import sys


def solve(L: int):
    print((L/3) ** 3)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    solve(L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
/*
n=int(input())
mod=10**9+7
s=input()
l=len(s)

dp=[[0]*(n+3)  for i in range(n+1)]
#dp[n][x] := n回操作して文字列長x 

dp[0][0]=1
for i in range(1,n+1): #i回操作
    for j in range(i+1): #長さ j
        if j==0:
            dp[i][j]= dp[i-1][1]+dp[i-1][0]
        else:
            dp[i][j]= dp[i-1][j-1]*2+ dp[i-1][j+1]
#print(dp)
ans=dp[n][l]
waru = pow(2,l,mod)
ans= ans* pow(waru,-1,mod)
print(ans)
*/
#include <bits/stdc++.h>
using namespace std;
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main() {
  //vector<vector<int>> dp(5020, vector<int>(5020));

  int n,l;
  long long mod = 1000000007;
  string s;
  cin>> n;
  cin>> s;
  l = s.length();
    long long dp[5020][5020];
    for (int i=0 ; i<5020 ; i++){
    for ( int j=0; j<5020 ; j++){
      dp[i][j]=0;}}
  // cout<< n<<s<<l<<endl;

  dp[0][0]=1;
  for (int i=1 ; i<n+1 ; i++){
    for ( int j=0; j<i+1 ; j++){
      if (j==0){
        dp[i][j]= (dp[i-1][1] + dp[i-1][0])%mod; }
      else{
        dp[i][j]= (2* dp[i-1][j-1] + dp[i-1][j+1])%mod;
      }
    }
  }
  long long ans = dp[n][l];
  //cout<< ans <<endl;
  
  for (int i=0 ; i<l ; i++){
    ans= ans* modinv(2,mod) % mod;
  }
  
  cout<< ans<<endl;
}

Measured memory_bytes: 200476
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
int main(){
	fast;
	ll t,n; cin>>n;
	if(n%1000==0){
		cout<<0<<'\n';
		return 0;
	}
	cout<<1000-n%1000<<'\n';
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#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++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll A,B,M;
  cin>>A>>B>>M;
  vl a(A);
  vl b(B);
  rep(i,A) cin>>a[i];
  rep(i,B) cin>>b[i];
  ll ans=INF;
  ll x[M],y[M],c[M];
  rep(i,M){
    cin>>x[i]>>y[i]>>c[i];
    ans=min(ans,a[x[i]-1]+b[y[i]-1]-c[i]);
  }
  sort(all(a));
  sort(all(b));
  ans=min(ans,a[0]+b[0]);
  cout<<ans<<endl;
  
}

Measured memory_bytes: 7192
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
#include <limits.h>
#include <assert.h>
using namespace std;

#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define null NULL
#define ll long long

#define fast cin.sync_with_stdio(0);cin.tie(0);
#define tr(c, itr) for(itr = (c).begin(); itr != (c).end(); itr++)
#define present(container, element) (container.find(element) != container.end()) //for set,map,etc
#define cpresent(container, element) (find(all(container),element) != container.end()) //for vectors
#define all(c) c.begin(),c.end() //eg sort(all(v));
//Initialization
#define clr(a) memset(a,0,sizeof(a))
#define ini(a) memset(a,-1,sizeof(a))

//Input Output
#define inp(n) scanf("%d",&n)
#define inp2(n,m) inp(n), inp(m)
#define inps(s) scanf("%s",s)
#define inpc(n) scanf("%c",&n)
#define inplf(n) scanf("%lf",&n)
#define inpll(n) scanf("%lld",&n)
#define inpll2(n,m) scanf("%lld%lld",&n,&m)

#define out(n) printf("%d\n",n)
#define out2(n,m) printf("%d %d\n",n,m)
#define outs(d) printf("%s\n",d)
#define sout(n) printf("%d ",n)
#define outll(n) printf("%lld\n",n)
#define soutll(n) printf("%lld ",n)
#define outll2(n,m) printf("%lld %lld\n",n,m)
#define nl printf("\n");

//loops
#define rep(i,n) for(long long i=0;i<n;i++)
#define REP(i,a,b) for(long long i=a;i<=b;i++)
#define PER(i,a,b) for(long long i=b;i>=a;i--)

//const
#define MOD 1000000007
#define MOD_INV 1000000006
#define MAX 1000000009
#define INF 1000000000000
#define PI 3.14159265358979323846264338327

//cases
#define aaa ll t;cin>>t;while(t--)

//time limit clock
//const clock_t TLE=0.98*CLOCKS_PER_SEC;
//clock_t START=clock();

ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0){if (exp & 1) result = (result * base) % modulus;
base = (base * base) % modulus;exp >>= 1;}return result;}

int main()
{
	#ifndef ONLINE_JUDGE
		 //freopen("in.txt", "r", stdin);
		 //freopen("out.txt", "w", stdout);
	#endif
	ll n;
	inpll(n);
	ll a[n];
	rep(i,n)
	{
		inpll(a[i]);
	}
	sort(a,a+n);
	ll i = n-2;
	ll j = 0;
	ll b[2];
	b[0] = b[1] = 0;
	while(i>=0)
	{
		if(j>=2)
		{
			break;
		}
		//cout<<i<<" "<<a[i]<<" "<<a[i+1]<<endl;
		if(a[i] == a[i+1])
		{
			b[j] = a[i];
			j++;
			i-=2;
		}
		else
		{
			i--;
		}
	}
	outll(b[1]*b[0]);
	return 0;
}


//raise tle exception
/*
if(clock() - START >=TLE)
{
	break;
	}*/


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

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
 
int main(void){
    for(int a, b, n, s; s = 0, cin >> a >> b >> n; cout << s << endl)
        while(n --) s += ((a %= b) *= 10) / b;
 
    return 0;
}

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

int main(){
    int K, N, ans = 0;
    cin >> N >> K;
    vector<int>p(N);
    for (int i = 0; i < N; i++) {
        cin >> p.at(i);
    }
    sort(p.begin(), p.end());
    for (int i = 0; i < K; i++) {
        ans += p.at(i);
    }
    cout << ans;
} 

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef long long int ll;
typedef vector<pair<ll,ll> > vpl;
typedef vector<pair<int,int> > vpi;
typedef vector<ll> vll;
typedef vector<int>vin;
typedef map<ll,ll> mp;
ll GCD(ll a,ll b)
{
    if(a == 0)
    {
        return b;
    }
    return GCD(b%a,a);
}
int main()
{
    FastIO;
    int q = 1;
    while(q--)
    {
        int x;
        cin >> x;
        cout << !x << endl;
    }
}




Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define flash ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
ll a[23][23];
ll dp[10000000]={0};
int main()
{
    flash
    ll n;cin>>n;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++)
        {
            cin>>a[i][j];
        }
    }
    ll x=1<<n;
    dp[0]=1;
    for(ll i=0;i<x-1;i++)
    {
        ll copy=i;ll mandone=0;
        while(copy>0)
        {
          ll d=copy%2;if(d==1)mandone++;
          copy/=2;  
        }
        for(ll k=0;k<n;k++)
            {
                ll fat=(1<<k)&i;
                if((a[mandone][k]==1)&&(fat==0))
                {
                
                ll iu=i+(1<<k);ll top=1e9+7;
                dp[iu]=(dp[iu]+dp[i])%top;
                }
            }
        
    }
    cout<<dp[(1<<n)-1]<<endl;
}

Measured memory_bytes: 20016
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
using ll = long long;
ll mx(ll a,ll m){
	ll mx = max((a+1)*m,a+m);
	ll x = (a+m+1)/2;
	if(a+1<=x && x<=a+m) chmax(mx,x*(a+m+1-x));
	return mx;
}
int main(){
	int Q;
	cin>>Q;
	rep(qt,Q){
		ll a,b;
		cin>>a>>b;
		if(a>b) swap(a,b);
		ll res = a-1;
		ll ub = b, lb = 0;
		while(ub-lb>1){
			ll m = (ub+lb)/2;
			if(mx(a,m) < a*b) lb = m;
			else ub = m;
		}
		res += lb;
		cout<<res<<endl;
	}
}


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

int main(void)
{
  int n,m,i,j,min,a[51],b[51],c[51],d[51],min_j,temp=0;
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++)
    {
      scanf("%d %d",&a[i],&b[i]);
    }
  for(i=0;i<m;i++)
    {
      scanf("%d %d",&c[i],&d[i]);
    }

  for(i=0;i<n;i++)
    {
      min = INT_MAX;
      for(j=0;j<m;j++)
	{
	  temp = abs(c[j]-a[i]) + abs(d[j]-b[i]);
	  if(min > temp)
	    {
	      min = temp;
	      min_j = j+1;
	    }
	}
      printf("%d\n",min_j);
    }
  return 0;
}
      

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

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

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

bool chkmax(int &x,int y){return x<y?x=y,true:false;}
bool chkmin(int &x,int y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int n,m;
int a[100005],cnt[100005];

int main(){
	n=readint(); m=readint();
	a[1]=1;
	for(int i=1;i<=n;i++) cnt[i]=1;
	int x,y;
	for(int i=1;i<=m;i++){
		x=readint(); y=readint();
		if(!cnt[x]) continue;
		cnt[y]++,cnt[x]--;
		if(cnt[x]==0&&a[x]) a[x]=0,a[y]=1;
		else if(a[x]) a[y]=1;
	}
	int ans=0;
	for(int i=1;i<=n;i++) ans+=a[i];
	cout<<ans<<endl;
	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++)

int main(){
    int x;
    cin >> x;
    if(x == 7 || x==5 || x==3){
        cout<<"YES";
    }
    else{
        cout<<"NO";
    }
    cout<<endl;
}

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

int main(void){
  int H,W;
  cin >> H >> W;
  string field[H];
  for(int i=0;i<H;i++){
    cin>>field[i];
  }
  int c;
  for(int y=0;y<H;y++){
    for(int x=0;x<W;x++){
      c=0;
      c+=(y!=0 && field[y-1][x]=='#')?1:0;
      c+=(y!=H-1 && field[y+1][x]=='#')?1:0;
      c+=(x!=0 && field[y][x-1]=='#')?1:0;
      c+=(x!=W-1 && field[y][x+1]=='#')?1:0;
      c+=(y*x!=0 && field[y-1][x-1]=='#')?1:0;
      c+=(y!=0 && x!=W-1 && field[y-1][x+1]=='#')?1:0;
      c+=(y!=H-1 && x!=W-1 && field[y+1][x+1]=='#')?1:0;
      c+=(y!=H-1 && x!=0 && field[y+1][x-1]=='#')?1:0;
      if(field[y][x]=='#'){
        cout << "#";
      }else{
        cout << c;
      }
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
//Don't give up too easy bhai
#pragma GCC optimize("-O3")
 
#include<bits/stdc++.h>
using namespace std;

#define int long long int
#define double long double
#define inf 1e18

typedef pair<int,int> pii;
 
#define forall(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define fs first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define minv(a) *min_element(all(a))
#define maxv(a) *max_element(all(a))
#define vi vector<int>
#define vd vector<double>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007
#define br cout<<"\n"
#define whatis(x) cerr << "var "<<#x << " ==> " << x<<"\n"
#define inputv(a) forall(i,0,a.size()) cin>>a[i]
#define outputv(a) for(auto i:a) cout<<i<<" ";br;
#define T int __t;cin>>__t;while(__t--)

void solve()
{
    
}

signed main()
{
    fast;

    int n,m;cin>>n>>m;
    int ans = 0;

    forall(i,0,n)
    {
        int x,y;cin>>x>>y;

        double d = (sqrt(x*x+y*y));
        // whatis(d);
        if(d<=float(m)) ans++;
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 3700
#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 n;
    ll large_num = 1e9+7;
    cin >> n;
    ll a=1;
    ll b=1;
    ll c=1;
    rep(i, n){
        a *= 10;
        b *= 9;
        c *= 8;
        a %= large_num;
        b %= large_num;
        c %= large_num;
    }
    b *= 2;
    b %= large_num;
    ll d = b - c;
    if (d<0) d += large_num;
    d %= large_num;
    ll ans = a-d;
    if (ans<0) ans += large_num;
    cout << ans%large_num << endl;

    return 0;
}


Measured memory_bytes: 3596
/**
    AUTHOR:JUNSH
    TIME:19/5/25
**/
#include<bits/stdc++.h>
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define rev(i,a,b) for(ll i=(a);i>=(b);--i)
using namespace std;
typedef long long ll;
inline ll read(){
    ll f=1,x=0;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return f*x;
}
const ll inf=0x3f3f3f3f;
priority_queue<ll> Left;
priority_queue<ll,vector<ll>,greater<ll> >Right;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t;
    cin>>t;
    ll sum=0;
    ll lt=0,rt=0;
    while(t--){
        ll op;
        cin>>op;
        if(op==1){
            ll a,b;
            cin>>a>>b;
            sum+=b;
            if(Left.empty()||a<=Left.top()){
                Left.push(a);
                lt+=a;
            }
            else {
                Right.push(a);
                rt+=a;
            }
            ll ls=Left.size();
            ll rs=Right.size();
            if(ls-rs>1){
                ll x=Left.top();
                Left.pop();
                lt-=x;
                Right.push(x);
                rt+=x;
            }
            else if(rs-ls>1){
                ll x=Right.top();
                rt-=x;
                Right.pop();
                Left.push(x);
                lt+=x;
            }
        }
        else{
            ll tot=Left.size()+Right.size();
            if(tot&1){
                ll mid;
                ll llt=lt,rrt=rt;
                if(Left.size()>Right.size()){
                    mid=Left.top();
                    llt=lt-mid;
                }
                else {
                    mid=Right.top();
                    rrt=rt-mid;
                }
                cout<<mid<<" "<<sum+rrt-llt<<endl;
            }
            else{
                cout<<Left.top()<<" "<<sum+rt-lt<<endl;
            }
        }
    }
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define OUT(s) cout << s << "\n";
using namespace std;

long N,K;
vector<int> A(100);
int s;
map<int, int> mp;
// https://atcoder.jp/contests/abc166
void Main()
{
    OUT(N-mp.size())
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    int t;
    cin >> N >> K;
    REP(i, K) {
        cin >> s;
        REP(ii, s) {
            cin >> t;
            mp[t] = 1;
        }
    }
    Main();
    return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

class Team{
	public:
		int num;
		int score;
		Team(int n, int s){
			num = n;
			score = s;
		}
		friend bool operator < ( const Team& a, const Team& b){
			return a.score < b.score;
		}
		friend bool operator > ( const Team& a, const Team& b){
			return a.score > b.score;
		}
};

int main(){
	vector<Team> teams;
	int n, score;
	while (~scanf("%d,%d", &n, &score)) {
		if(n == 0 && score == 0){
			break;
		}
		teams.push_back(Team(n, score));
	}
	
	sort(teams.begin(), teams.end(), greater<Team>());

	while (cin >> n) {
		int lastScore = -1;
		int rank = 0;
		for (int i = 0; i < teams.size(); i++) {
			if (lastScore != teams[i].score) {
				rank++;
				lastScore = teams[i].score;
			}
			if (n == teams[i].num) {
				cout << rank << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
int test[213456], cnt[213456], ok[213456];
signed main() {
	int n, a, mi = 0, ma = 0, ans = 0; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> test[h]; cnt[test[h]]++;
	}
	for (int h = 1; h < 213456; h++) {
		ok[h] = ok[h - 1] + cnt[h];
	}
	for (int h = 0; h < n; h++) {
		for (int i = h + 1; i < n; i++) {
			mi = min(test[h], test[i]); ma = max(test[h], test[i]);
			ans += ok[mi + ma - 1] - ok[ma - mi];
			if (ma - mi + 1 <= mi && mi <= mi + ma - 1) { ans--; }
			if (ma - mi + 1 <= ma && ma <= mi + ma - 1) { ans--; }
		}
	}
	cout << ans / 3 << endl;
	cin >> n;
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    set<string> s;
    int n; cin>>n;
    while(n--){
        string x; cin>>x;
        s.insert(x);
    }
    cout<<s.size()<<endl;
}



Measured memory_bytes: 19164
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 20002
struct Node{
	vector<int> adj;
};
int main(){
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	// #endif

	int n,m;
	int a,b;
	bool p=false;
	vector<int> g1,gn;

	cin>>n>>m;
	
	for(int i=0;i<m;++i){
		
		cin>>a>>b;
		if(b==n)
			gn.push_back(a);
		
		if(a==1)
			g1.push_back(b);
		
		// if(b==1)
		// 	g1.push_back(a);
		// if(a==n)
		// 	gn.push_back(b);
	}
	
	sort(g1.begin(),g1.end());
	sort(gn.begin(),gn.end());
	
	for(int i=0,j=0;i<g1.size() && j<gn.size();){
		if(g1[i]==gn[j]){
			p = true;
			break;
		}else if(g1[i]>gn[j]){
			j++;
		}else{
			i++;
		}
	}
	
	if(p)
		cout<<"POSSIBLE";
	else
		cout<<"IMPOSSIBLE";
	return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>

using namespace std;



int main() {
   
    long long n;
    vector <long long> a;
    cin >> n;
    for (long long i=0;i<n;i++){
        long long p;
        cin >> p;
        a.push_back(p);
    }
    long long sum = 0;
    vector <long long>::iterator q;
    for (q = a.begin(); q != a.end(); q++){
        sum += *q;
    }
    long long snuke = a[0];
    long long minv = abs(2*snuke - sum);
    for (long long i=1;i<n-1;i++){
        snuke += a[i];
        if(abs(2*snuke - sum) < minv){
            minv = abs(2*snuke-sum);
        }
    }
    cout << minv << endl;
}

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

#define int long long

const int inf = 1000000000000000019;

int n, t, q;
int a[101010];
bool d[101010];
int l[101010];

main()
{
  cin >> n >> t >> q;
  for (int i = 0; i < n; i++){
    int D;
    cin >> a[i] >> D;
    d[i] = (D - 1 ? true : false);
  }

  for (int i = 0; i < n; i++){
    l[i] = - inf;
  }


  bool f = false;
  for (int i = 0; i < n; i++){
    if (!f && d[i]) {
      l[i] = l[i - 1] = (a[i] + a[i - 1]) / 2;
    } else if (f && d[i]){
      l[i] = l[i - 1];
    }

    f = d[i];
  }

  for (int i = n - 2; i >= 0; i--){
    if (!f && !d[i]) l[i] = l[i + 1];
    f = d[i];
  }


  for (int i = 0; i < q; i++){
    int x;
    cin >> x;
    x--;

    if (abs(a[x] - l[x]) < t){
      cout << l[x] << endl;
      continue;
    }
    cout << a[x] + (d[x] ? -1 : 1) * t << endl;
  }

  for (int i = 0; i < n; i++){
    //cout << l[i] << endl;
  }
}

Measured memory_bytes: 4764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
    ll res1 = 0, res2 = 0;
    ll a;
    rep(i, 4) {
        cin >> a;
        res1 += a;
    }
    rep(i, 4) {
        cin >> a;
        res2 += a;
    }
    cout << max(res1, res2) << endl;
}


Measured memory_bytes: 3104
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 3000+1;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
    return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}

ll dp[Max+2][Max+2][4];
ll ara[Max+2][Max+2];

ll n,m;

ll call(ll i,ll j,ll cnt)
{
   // if(i==1 && j==2 || (i==2 && j==1))

  // cout<<i<<" "<<j<<" "<<cnt<<" "<<val<<endl;
    if(i>n || j>m )
        return 0;

        ll &ret=dp[i][j][cnt];


        if(~ret)return ret;

        ret=0;

        if(cnt==3)
        {
            ret=(call(i+1,j,0));
        }
        else
        {
            if(ara[i][j])
            {
ret=max3(ara[i][j]+call(i,j+1,cnt+1),call(i,j+1,cnt),ara[i][j]+call(i+1,j,0));
            }
            else{

            ret=max(call(i+1,j,0),call(i,j+1,cnt));
            }
        }

        return ret;

}
int main()
{

    fastread();

    ll i,j,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r;

    bool flag=false;

    string str;

    cin>>n>>m>>k;

    while(k--)
    {
        cin>>a>>b>>c;

        ara[a][b]=c;
    }
    memset(dp,-1,sizeof(dp));

    cout<<call(1,1,0)<<endl;






}



Measured memory_bytes: 356424
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main(int argc,char const* argv[])
{
  int n;
  long long T;
  cin >> n >> T;
  vector <long long> t(n,0);
  int point;
  long long time=0;
  for(int i=0;i<n;i++)
    {
      cin >> t[i];
    }
  for(int i=0;i<n-1;i++)
    {
      time +=min(T,t[i+1]-t[i]);
    }
  time+=T;
  cout << time << endl;
  return 0;
}


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

int main() {
  int a,b,k;
  cin >> a>> b>> k;
  
  int n,c=0;
  n = min(a,b);
  
  for (int i = n; i>=1;i--){
    if (a%i==0 && b%i==0){
      k--;
      if (k==0){
        cout << i << endl;
        break;
      }
    }
  }
}

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

void code()
{
    ll n,r;
    cin>>n>>r;
    ll cnt=0;
    while(n>0)
    {
        n/=r;
        cnt++;
    }
    cout<<cnt<<endl;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--)
    {
        code();
    }
}


Measured memory_bytes: 256
import java.util.*; 
public class Main{
public static void main(String ... string){
  Scanner sc = new Scanner(System.in); 
  int x = sc.nextInt(),a=sc.nextInt(),b=sc.nextInt(); 
  if(-a+b <= 0)
    System.out.println("delicious"); 
  else if(-a+b <= x) 
    System.out.println("safe"); 
  else System.out.println("dangerous");
}
}

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

const int RGB[] = { 'R','G','B' };


long long solve(int N, string S, int r, int g, int b) {
	int R = 0;
	int G = 0;
	int B = 0;
	long long cnt1 = 0;
	long long cnt2 = 0;

	for (int i = 0; i < N; i++) {
		if (S[i] == RGB[b])B++;
	}

	for (int i = 0; i < N; i++) {
		if (S[i] == RGB[r]) {
			R++;
		}
		if (S[i] == RGB[g]) {
			cnt1 += R * B;
		}
		if (S[i] == RGB[b]) {
			B--;
		}
	}

	for (int i = 0; i < N; i++) {
		if (S[i] == RGB[g]) {
			int left = i - 1;
			int right = i + 1;
			while (0 <= left && right < N) {
				if (S[left] == RGB[r] && S[right] == RGB[b])cnt2++;
				left--;
				right++;
			}
		}
	}

	return cnt1 - cnt2;
}

int main()
{
	int N;
	string S;

	cin >> N >> S;

	long long ans = 0;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (i != j && j != k && k != i) {
					ans += solve(N, S, i, j, k);
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3200
#include <cstdio>
#include <algorithm>
#include <bitset>

using namespace std;

bitset <4000010> dp, aux;

int main ()
{
 //   freopen ("file.in", "r", stdin);

    int n;
    scanf ("%d", &n);

    dp[0] = 1;

    int sum = 0;
    for (int i = 1; i <= n; ++i)
    {
        int x;
        scanf ("%d", &x);
        sum += x;

        aux = dp;
        aux <<= x;
        dp |= aux;
    }

    for (int i = (sum + 1) / 2;; ++i)
        if (dp[i])
        {
            printf ("%d\n", i);
            return 0;
        }

    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
int main(){
    int k,x;
    cin>>k>>x;
    if(k*500>=x) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

using namespace std;

int main() {
    int n, m, a, sum = 0;
    cin >> n >> m;
    while (m--) {
        cin >> a;
        sum += a;
    }
    int diff = n - sum;
    if (diff < 0) cout << -1;
    else cout << diff;
}


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

int main(){
    int N; 
    cin >> N;
    for (int i= 0; i <N; i++){
        int A;
        cin >> A;
        if(A%2==0){
            //偶数がだめなとき
            if(A%3 != 0 && A%5 != 0){
                cout << "DENIED" <<endl;
                return 0;
            }
        }
    }
    //偶数が全部おｋだったら
    cout << "APPROVED" <<endl;
}

Measured memory_bytes: 3580
using System;



namespace hello_cs

{

    class Program

    {

        static void Main(string[] args)

        {

            var s = Console.ReadLine().Split(" ");

            var days = System.Console.ReadLine().Split(" ");



            var n = int.Parse(s[0]);

            var m = int.Parse(s[1]);



            var rdy = 0;

            for(var i = 0; i < m; i++){

                rdy += int.Parse(days[i]);

            }



            var day = rdy > n ? -1 : n - rdy;



            System.Console.WriteLine(day);



        }

    }

}



Measured memory_bytes: 28272
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b,c = li()
print("Yes" if a==b==c else "No")

Measured memory_bytes: 3316
package main

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

func main() {
	var n int

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()

	n, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	m := make(map[string]struct{}, n)

	for i := 0; i < n; i++ {
		sc.Scan()
		in := strings.Split(sc.Text(), " ")
		cmd := in[0]
		key := in[1]
		switch cmd {
		case "insert":
			m[key] = struct{}{}
		case "find":
			if _, ok := m[key]; ok {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		}
	}
}


Measured memory_bytes: 73980
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int

int main()
{
    int a, b;
    cin >> a >> b;
    if ((a * b) % 2 == 0)
        cout << "Even" << endl;
    else
        cout << "Odd" << endl;
}


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

using ll = long long;
using ld = long double;
using P = pair<int, int>;
//using P = pair<double, double>;
using edge = struct {int to; ll cost;};

#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

const int di[] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int dj[] = {0, -1, 0, 1, 1, -1, 1, -1};
const int INF = 1e9+100;
const ll INF64 = 7e18l;

const int mod = 1000000007;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
      fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
      ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
      return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

void solve()
{
  int h, w;
  cin >> h >> w;
  string s[h];
  rep(i, h) cin >> s[i];
  rep(si, h) rep(sj, w) {
    if(s[si][sj] == '.') continue;
    bool ok = false;
    rep(dir, 4) {
      int ni = si+di[dir], nj = sj+dj[dir];
      if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
      if(s[ni][nj] == '#') ok = true;
    }
    if(!ok) {
      cout << "No" << "\n"; 
      return;
    }
  }
  cout << "Yes" << "\n";
}

int main()
{
  solve();
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  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;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1; 
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int sosu[1000] = {};
int uenososu[1000020] = {};
int main() {
	int n, x, t;
	cin >> n >> x >> t;
	cout << (n + x - 1) / x * t;
}

Measured memory_bytes: 3608
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)


def read_values():
    return map(int, input().split())


def read_index():
    return map(lambda x: x - 1, map(int, input().split()))


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def functional(N, mod):
    F = [1] * (N + 1)
    for i in range(N):
        F[i + 1] = (i + 1) * F[i] % mod
    return F


def inv(a, mod):
    return pow(a, mod - 2, mod)


def P(a, b, mod):
    res = 1
    for i in range(a, b + 1):
        res *= i
        res %= mod
    return res


def C(a, b, mod):
    return P(a - b + 1, a, mod) * inv(P(1, b, mod), mod) % mod


def main():
    N, A, B = read_values()
    mod = 10 ** 9 + 7 
    res = pow(2, N, mod) - 1

    p1 = P(N - A + 1, N, mod)
    p2 = p1 * P(N - B + 1, N - A, mod) % mod
    p3 = P(1, A, mod)
    p4 = p3 * P(A + 1, B, mod) % mod
    res -= p1 * inv(p3, mod) % mod
    res -= p2 * inv(p4, mod) % mod
    print(res % mod)


if __name__ == "__main__":
    main()

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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  string L;
  cin >> L;
  int N = L.size();

  vector<ll> dp1(N, 0), dp2(N,0);

  dp1[0] = 1;
  dp2[0] = 2;

  for(int i = 0; i < N-1; i++){
    int num = L[i+1] - '0';
    if(num == 1){
      dp1[i+1] += dp2[i]; // 00
      dp1[i+1] %= MOD;
      dp2[i+1] += dp2[i] * 2; // 01 or 10
      dp2[i+1] %= MOD;
    } else { 
      dp2[i+1] += dp2[i]; // 00
      dp2[i+1] %= MOD;
    }
  }

  for(int i = 0; i < N-1; i++){
    dp1[i+1] += dp1[i] * 3; // 00 01 10 
    dp1[i+1] %= MOD;
  }

  cout << (dp1[N-1] + dp2[N-1]) % MOD << endl;
}


Measured memory_bytes: 2048
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define e endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
map<ll,ll>check;
map<ll,ll>visit;
vector<ll>ans;

int main()
{
    ll r;
    cin>>r;
    double n=2*pi*r;
    printf("%.20f\n",n);
return 0;
}


Measured memory_bytes: 3764
import java.util.*;

class Main{
  static int n;
  static int m;
  static boolean[] sw;
  static int[][] a;
  static int[] p;
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    n=sc.nextInt();
    m=sc.nextInt();
    a=new int[m][];
    for(int i=0;i<m;i++){
      int k=sc.nextInt();
      a[i]=new int[k];
      for(int j=0;j<k;j++){
        a[i][j]=sc.nextInt()-1;
      }
    }
    p=new int[m];
    for(int i=0;i<m;i++){
      p[i]=sc.nextInt();
    }
    sw=new boolean[n];
    System.out.println(calc(0));
  }
  static int calc(int fixed){
    if(fixed<n){
      int res=0;
      res+=calc(fixed+1);
      sw[fixed]=true;
      res+=calc(fixed+1);
      sw[fixed]=false;
      return res;
    }
    for(int i=0;i<m;i++){
      int cnt=0;
      for(int j=0;j<a[i].length;j++){
        if(sw[a[i][j]]){
          cnt++;
        }
      }
      if((cnt&1)!=p[i]){
        return 0;
      }
    }
    return 1;
  }
}

Measured memory_bytes: 22612
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<signed(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 20000000000;
typedef std::pair<int,int> P;


	ll ans=INF;
	ll N;
int main(){
	ios_base::sync_with_stdio(false);
	cin>>N;
	REP(i,N+1){
		ll t=i,cnt=0;
		while(t/9>0)cnt+=t%9,t/=9;
		cnt+=t%9;
		int a=N-i;
		while(a/6>0)cnt+=a%6,a/=6;
		cnt+=a%6;
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int time, num, cards[4][13];
    char suits[] = {'S', 'H', 'C', 'D'};
    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < 13; j++) {
            cards[i][j] = 0;
        }
    }
    char suit;
    scanf("%d", &time);
    for(int i = 1; i <= time; i++) {
        scanf(" %c %d", &suit, &num);
        for(int j = 0; j < 4; j++) {
            if(suit == suits[j]) cards[j][num - 1] = 1;
        }
    }
    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < 13; j++) {
            if(cards[i][j] == 0) printf("%c %d\n", suits[i], j+1);
        }
    }
}


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

typedef long long int ll;

int main(){
	
	int h, n; cin>>h>>n;
	int a[n+1];
	int b[n+1];
	a[0] = b[0] = 0;
	int dp[h+1][n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i];
		
	}
	
	
	for(int i=1;i<=h;i++){
		dp[i][0] = INT_MAX;
	}
	for(int i=0;i<=n;i++) dp[0][i] = 0;
	
	for(int i=1;i<=h;i++){
		for(int j=1;j<=n;j++){
			int p1 = dp[i][j-1];
			int p2 = b[j];
			if(i>=a[j]){
				p2 += dp[i-a[j]][j];
			}
			dp[i][j] = min(p1, p2);
			//~ printf("%d\t",dp[i][j]);
		}
		//~ printf("\n");
	}
	cout<<dp[h][n];
}




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

int main(){
    int N;
    int W;
    cin >> N >> W;
    vector<long long int>weight(110);
    vector<long long int>value(110);
    for(int i=0; i<N;i++){
        cin >> weight.at(i) >> value.at(i);
    }
    vector<vector<long long int>>dp(110,vector<long long int>(100100,0));
    
    //ちょうどWのときの最大の価値を計算
    for(int i=0; i<N; i++){
        for(int j=0; j<=W; j++){
            if(j-weight.at(i)>=0){
            dp.at(i+1).at(j) = max(dp.at(i).at(j-weight.at(i))+value.at(i),dp.at(i+1).at(j));
            }
            dp.at(i+1).at(j) = max(dp.at(i+1).at(j),dp.at(i).at(j));
            
        }
    }
    cout << dp.at(N).at(W) << endl;
}

Measured memory_bytes: 90368