akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <array>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
using namespace std;
template <typename T> istream & operator >> (istream & is, vector<T> & vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;
using VI = vector<int>;

int n, a, b, c;
VI t;

int rec(int i, int A, int B, int C) {
	if (i == n) {
		if (!A or !B or !C) { return 9999999; }
		return abs(a - A) + abs(b - B) + abs(c - C);
	}

	int tmp = rec(i + 1, A, B, C);

	tmp = min(tmp, rec(i + 1, A + t[i], B, C) + (A ? 10 : 0));
	tmp = min(tmp, rec(i + 1, A, B + t[i], C) + (B ? 10 : 0));
	tmp = min(tmp, rec(i + 1, A, B, C + t[i]) + (C ? 10 : 0));
	
	return tmp;
}

int main() {
	CI n >> a >> b >> c;
	t.resize(n); CI t;

	CO rec(0, 0, 0, 0) EN;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 20
#define MAX2 200

int keisan(int,int);
int a[MAX],b[MAX2],count=0,sum,n;
int main() {
int h,i,j;
int m,key,v;
scanf("%d",&n);
for(i=0;i<n;i++){
    scanf("%d",&a[i]);
}
scanf("%d",&m);
for(i=0;i<m;i++){
    scanf("%d",&b[i]);
  v=keisan(0,b[i]);
     if(v==1) printf("yes\n");
     else printf("no\n");
}
  return 0;
}
  int keisan(int x,int y){
    if(y == 0) return 1;
      if(x >= n) return 0;
      return keisan(x + 1,y) || keisan(x + 1,y - a[x]);
  }



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ll long long
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
const ll mod=1000000007;
int gcd(int a, int b){
    if(a%b == 0){
        return b;
    }else{
    return gcd(b, a%b);
    }
}

ll powmod(ll x,ll y){
    ll res=1;
    rep(i,y){
        res=res*x%mod;
    }
    return res;
}
int main(){
    ll n;
    cin >> n;
    ll ans=powmod(10,n)-powmod(9,n)-powmod(9,n)+powmod(8,n);
    //A=0,A=9となるiがそれぞれ存在しないのは9^N通り、
    //A=0,A-9となるiがともに存在しないのは8^N通り、
    //A=0,A=9となるiが少なくとも一方は存在しないのは9^N+9^N-8^N通り
    //全ての選び方は10^N通り
    ans%=mod;
    ans=(ans+mod)%mod;
    cout << ans << endl;
    /*nP2通りの選び方、かつn-2分の0~9の10通りの選び方を実装したかった
    unsigned ll n,sum;
    unsigned ll temp=1,ans;
    cin >> n;
    sum=n*(n-1);
    cout << sum << endl;
    if(n==1){
        cout << 0 << endl;
        return 0;
    }else{
        for(int i=1;i<=n-2;i++){
            temp*=10;
        }
    }
    cout << temp << endl;
    ans=sum*temp%mod;
    cout << sum*temp%mod << endl;
    */
    return 0;
}


Measured memory_bytes: 3628
import Data.Bits

f :: Int -> Int ->[Int]->[Int]->Int->Int
f _ _ [] [] ans=ans
f n c (_:xs) [] ans=f n (c-1) xs [] (ans+c)
f n c xs2@(x:xs) ys2@(y:ys) ans
       |(Data.Bits.xor n y)==n+y=f (n+y) (c+1) xs2 ys ans
       |otherwise=f (n-x) (c-1) xs ys2 (ans+c)

main = do
       e<-getLine
       e2<-getLine
       let xs=map read (words e2)::[Int]
       print $ f 0 0 xs xs 0

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

int main() {
  ll N,K;cin>>N>>K;
  
  cout << min(N%K,K-N%K) << endl;
}
		

Measured memory_bytes: 3616
#include<cstdio>
#include<cstring>
#include<algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int n,m,a[10],len;
char ID[100001];

int f(int a){ a*=2; return a<10?a:a/10+a%10; }

int dp[100000][10];
int dfs(int i,int sum){
	if(i==len) return sum%10==0?1:0;

	if(dp[i][sum%10]!=-1) return dp[i][sum%10];

	int res=0;
	if(ID[i]=='*'){
		if(i%2==0) rep(j,m) res+=dfs(i+1,sum+a[j]);
		else       rep(j,m) res+=dfs(i+1,sum+f(a[j]));
	}
	else{
		if(i%2==0) res=dfs(i+1,sum+ID[i]-'0');
		else       res=dfs(i+1,sum+f(ID[i]-'0'));
	}
	return dp[i][sum%10]=res;
}

int main(){
	scanf("%d%s%d",&n,ID,&m);
	rep(i,m) scanf("%d",a+i);

	len=strlen(ID);
	reverse(ID,ID+len);

	memset(dp,-1,sizeof dp);
	printf("%d\n",dfs(0,0));

	return 0;
}

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

int main(){
    int w, h;
    while(1){
       cin >> h >> w;
       if(w == 0 && h == 0) break;
       for(int a = 0; a < h; a++){
         for(int b = 0; b < w;b++){
            if( a == 0 || a == h - 1){
                cout << "#";
             }else{
               if( b == 0 || b == w - 1){
                 cout << "#";
                 }else{
                   cout << ".";
                  }    
                }  
               }  
             cout << endl;
             }
           cout << endl;
          }
       return 0;
      }

Measured memory_bytes: 1152
a=input().split()
a=list(map(int,a))
ini=a[0]
obj=a[1]
poss=0
i=1
divini=1
pot=0
posini=i/ini
while i<=ini:
  pot=0
  divini=i
  if divini>=obj:
    poss=poss+(1/ini)
  else:  
    while divini<obj:
      divini=divini*2
      pot+=1
    pg=(1/2)**pot
    poss=poss+(pg*posini)
  i+=1  
print(poss)

Measured memory_bytes: 3064
using System;

namespace CS_Competit
{
  class Program
  {
    private float pointer = 0;
    static void Main(string[] args)
    {
      float a = float.Parse(Console.ReadLine());
      Program program = new Program();
      program.Calc(a, 3);
      Console.WriteLine(program.Pointer);
    }

    public float Calc(float num, int exp)
    {
      if (exp == 0)
      {
        pointer = 0;
        return 1;
      }

      float result = num * Calc(num, exp - 1);
      pointer += result;
      return result;
    }

    public float Pointer
    {
      get { return pointer; }
    }
  }
}


Measured memory_bytes: 27612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#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++)
int INF=1e9+7;

int main() {
  int N,M;
  cin >> N >> M;
  vi L(M),R(M);
  int mi=N,ma=1;
  rep(i,M) {
    cin >> L[i] >> R[i];
    ma=max(ma,L[i]);
    mi=min(mi,R[i]);
  }
  
  cout << max(0,mi-ma+1) << endl;
}

Measured memory_bytes: 4052
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
#define N 1000000

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    ll a,b; cin>>a>>b;
    ll ans=0;
    if(a%2==1)ans^=a,a++;
    if(b%2==0)ans^=b,b--;
    ans^=(b-a+1)/2%2==1;
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<iostream>
    #include<map>
    #include<deque>
    #include<algorithm>
    #include<string>
    #include<cctype>
    using namespace std;
    #define REP(i,b,e) for(int i=(int)b;i<(int)e;i++)
    #define rep0(i,n) REP(i,0,n)
    #define rep1(i,n) REP(i,1,n+1)
    typedef long long ll;
    ll longinf=1ll<<60;
     
    string s;
    int n;
    string ans;
    int main(){
        cin>>s>>n;
        rep0(i,s.size()){
            if(i%n==0){
                ans+=s[i];
            }
        }
        cout<<ans<<endl;
     
        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
const int INF = 1e+9;

int main(){
	int n,m;
	while( cin >> n >> m , n||m ){
		int d[2][101][101];
		for(int i=0 ; i < 101 ; i++ ){
			for(int j=0 ; j < 101 ; j++ ){
				d[0][i][j] = (i==j)? 0 : INF;
				d[1][i][j] = (i==j)? 0 : INF;
			}
		}

		for(int i=0 ; i < n ; i++ ){
			int a,b,cost,time;
			cin >> a >> b >> cost >> time;
			d[0][a][b] = cost;
			d[0][b][a] = cost;
			d[1][a][b] = time;
			d[1][b][a] = time;
		}
		for(int k=1 ; k <= m ; k++ ){
			for(int i=1 ; i <= m ; i++ ){
				for(int j=1 ; j <= m ; j++ ){
					d[0][i][j] = min( d[0][i][j] , d[0][i][k]+d[0][k][j] );
					d[1][i][j] = min( d[1][i][j] , d[1][i][k]+d[1][k][j] );
				}
			}
		}
		int k;
		cin >> k;
		for(int i=0 ; i < k ; i++ ){
			int p,q,r;
			cin >> p >> q >> r;
			cout << d[r][p][q] << endl;
		}
	}
}


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

using namespace std;

const long long MOD = 1e9 + 7;

bool check(int a, int b, int c, int d) {
    return ((b == 0 and c == 1 and d == 2) or // XAGC:X012
            (b == 0 and c == 2 and d == 1) or // XACG:X021
            (b == 1 and c == 0 and d == 2) or // XGAC:X102
            (a == 0 and c == 1 and d == 2) or // AXGC:0X12
            (a == 0 and b == 1 and d == 2));  // AGXC:01X2
}

// dp[n][a][b][c]：n個目まで見る。末尾がabc
// A:0, G:1, C:2, T:3
long long dp[105][4][4][4];

int main() {
    int n;
    cin >> n;
    
    dp[0][3][3][3] = 1;// 番兵として先頭にTTTをつける
    for (int len = 0; len < n + 1; ++len) {
        for (int c1 = 0; c1 < 4; ++c1) {
            for (int c2 = 0; c2 < 4; ++c2) {
                for (int c3 = 0; c3 < 4; ++c3) {
                    if (dp[len][c1][c2][c3] == 0) continue;
                    for (int a = 0; a < 4; ++a) {
                        if (check(c1, c2, c3, a)) continue;
                        dp[len + 1][c2][c3][a] += dp[len][c1][c2][c3];
                        dp[len + 1][c2][c3][a] %= MOD;
                    }
                }
            }
        }
    }

    long long ans = 0;
    for (int c1 = 0; c1 < 4; ++c1) {
        for (int c2 = 0; c2 < 4; ++c2) {
            for (int c3 = 0; c3 < 4; ++c3) {
                ans += dp[n][c1][c2][c3];
                ans %= MOD;
            }
        }
    }

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


Measured memory_bytes: 256
#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int main()
{
	string s, t;
	cin >> s >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

	cout << ((s < t) ? "Yes" : "No") << endl;
}


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

int main()
{
    ll n;
    cin >> n;
    vector<ll> x(n);
    vector<ll> y(n);
    vector<ll> h(n);
    rep(i, n)
    {
        cin >> x[i] >> y[i] >> h[i];
    }

    rep(i, 100 + 1)
    {
        int flag = 1;
        rep(j, 100 + 1)
        {
            ll H = 0;
            ll u = 0 - 1; //過去の値を格納する場所
            flag = 1;
            ll min1 = INF;
            rep(k, n)
            {
                if (h[k] == 0)
                {
                    min1 = min(min1, h[k] + labs(x[k] - i) + labs(y[k] - j));
                    continue;
                }
                H = h[k] + labs(x[k] - i) + labs(y[k] - j);
                if (u == -1 && H <= min1)
                {
                    u = H;
                    continue;
                }
                if (u != H || H > min1 || u > min1)
                {

                    flag = 0;
                    break;
                }
            }
            if (H > min1)
            {
                flag = 0;
            }
            if (flag == 1)
            {
                cout << i << " " << j << " " << H;
                break;
            }
        }
        if (flag == 1)
        {
            break;
        }
    }
}


Measured memory_bytes: 256
import std.stdio, std.string;

void main() {
	string input = chomp(readln());
	
	char lastChar = ' ';
	byte count = 1;
	
	foreach(char i; input) {
		if(lastChar == ' ') {
			lastChar = i;
			continue;
		}
		if(lastChar == i) {
			count++;
		} else {
			count = 1;
			lastChar = i;
		}
		if(count >= 3) {
			writeln("Yes");
			return;
		}
	}
	
	writeln("No");
	return;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e10;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 21;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k = -1;
    cin >> n;
    rep(i,1,1000){
        if (n == i*(i-1)/2){
            k = i;
            break;
        }
    }
    if (k == -1){
        PRINT("No");
        return 0;
    }
    vector<vector<int>> ans(k);
    int cnt = 1;
    rep(i,k-1){
        rep(j,i+1,k){
            ans[i].push_back(cnt);
            ans[j].push_back(cnt);
            cnt++;
        }
    }
    PRINT("Yes");
    PRINT(k);
    rep(i,k){
        cout << k-1 << " ";
        array_output(all(ans[i]));
    }
}


Measured memory_bytes: 2304
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N, M, C[1 << 18];

int main() {
	cin >> N >> M;
	for (int i = 1; i <= M; i++) {
		int num; cin >> num;
		for (int j = 1; j <= num; j++) {
			int e; cin >> e; C[e] = 1;
		}
	}

	int cnt = 0;
	for (int i = 1; i <= N; i++) {
		if (C[i] == 0) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(){
  int n,v=1<<16,i,j,k,l,a,b,x,y,z,bit,d;
  cin>>n;
  int h[n],w[n],dp[v],used[v];
  for(i=0;i<n;i++) cin>>h[i]>>w[i];
  string s[4],c="RGB";;
  for(i=0;i<4;i++) cin>>s[i];
  memset(dp,-1,sizeof(dp));
  memset(used,0,sizeof(used));
  queue<P> q;
  q.push(P(0,0));
  while(!q.empty()){
    bit=q.front().first,d=q.front().second;
    q.pop();
    if(~dp[bit]) continue;
    dp[bit]=d;
    for(i=0;i<n;i++)
      for(j=-h[i]+1;j<4;j++)
	for(k=-w[i]+1;k<4;k++)
	  for(l=0;l<3;l++){
	    for(z=bit,a=max(0,-j);a<min(h[i],4-j);a++)
	      for(b=max(0,-k);b<min(w[i],4-k);b++){
		y=j+a,x=k+b;
		if(s[y][x]==c[l]) z|=1<<(y*4+x);
		else z&=v-1-(1<<(y*4+x));
	      }
	    if(dp[z]<0&&!used[z]) q.push(P(z,d+1)),used[z]=1;
	  }
  }
  cout<<dp[v-1]<<endl;
  return 0;
}

Measured memory_bytes: 3836
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    deque <long long> a;
    forn (i, 1, 10)
        a.pb(i);
    forn (i, 0, n - 1) {
        long long v = a.front();
        //cout << v << " ";
        a.pop_front();
        int lst = v % 10;
        if (lst - 1 >= 0)
            a.pb(10 * v + lst - 1);
        a.pb(10 * v + lst);
        if (lst + 1 < 10)
            a.pb(10 * v + lst + 1);
    }
    cout << a.front();
    return 0;
}

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

void print(string A[], int N) {
    for (int k = 0; k < N-1; k++) {
        cout << A[k] << " ";
    }
    cout << A[N-1] << "\n";

}
void selectionSort(string A[], int N) {
    int count = 0;
    for (int i = 0; i < N; i++) {
        int minj = i;
        for (int j = i; j < N; j++) {
            if (A[j][1] < A[minj][1]) {
                minj = j;
            }
        }
        if (minj != i) {
            swap(A[i], A[minj]);
            count++;
        }

    }
    print(A, N);
    //cout << count << "\n";
}
void bubbleSort(string A[], int N) {
    int flag = true;
    int count = 0, i = 0;
    while (flag) {
        flag = false;
        for (int j = N - 1; j >= i + 1; j--) {
            if (A[j][1] < A[j - 1][1]) {
                swap(A[j], A[j - 1]);
                count++;
                flag = true;
            }
        }
        i++;
    }
    print(A, N);
    //cout << count << "\n";

}

void Stable(string A[], string C[], int n) {
    bool F = true;
    for (int i = 0; i < n; i++) {
        if (A[i] != C[i]) {
            F = false;
        }
    }
    if (F) {
        cout << "Stable" << "\n";
    }
    else {
        cout << "Not stable" << "\n";
    }

}
static string A[36],B[36],C[36],D[36];
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
        B[i] = A[i];
        C[i] = A[i];
        D[i] = A[i];
    }
    

    bubbleSort(A, n);
    Stable(A, A,n);
    selectionSort(B, n);
    Stable(B, A,n);
    return 0;

}




Measured memory_bytes: 3212
x=input()
x=[i for i in x]
n=len(x)
y=['1']
a=0
b=0
for i in range(n-1):
    if i%2==0:
        y.append('0')
    else:
        y.append('1')
z=['0']
for i in range(n-1):
    if i%2==0:
        z.append('1')
    else:
        z.append('0')
for i in range(n):
    if x[i]!=y[i]:
        a+=1
    if x[i]!=z[i]:
        b+=1
print(min(a,b))


Measured memory_bytes: 5532
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main()
{
	int c=0;
	string a,b;
	cin>>a>>b;
	for(int i=0;i<a.size();i++)
	{
		if(a[i]!=b[i])
			c++;
	}
	cout<<c;
	return 0;
}

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

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  string ans = "";
  for (int i = 0; i < ty - sy; i++) {
    ans += 'U';
  }
  for (int i = 0; i < tx - sx; i++) {
    ans += 'R';
  }
  for (int i = 0; i < ty - sy; i++) {
    ans += 'D';
  }
  for (int i = 0; i < tx - sx + 1; i++) {
    ans += 'L';
  }
  for (int i = 0; i < ty - sy + 1; i++) {
    ans += 'U';
  }
  for (int i = 0; i < tx - sx + 1; i++) {
    ans += 'R';
  }
  ans += 'D';
  ans += 'R';
  for (int i = 0; i < ty - sy + 1; i++) {
    ans += 'D';
  }
  for(int i = 0; i < tx - sx + 1; i++) {
    ans += 'L';
  }
  ans += 'U';
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 636
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        int N = input.nextInt();
        int R = input.nextInt();
        if(N>=10)
        {
            System.out.println(R);
        }
        else if(N>=1&&N<10)
        {
            int A = 100*(10-N);
            System.out.println(A+R);
        }
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[11][11];
    int i,j,n,d,ans,chek,cnt=0;
    cin>>n>>d;
    for(i=0;i<n;i++){
        for(j=0;j<d;j++) cin>>a[i][j];
    }
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            ans=0;
            for(int k=0;k<d;k++){
                ans+=((a[i][k]-a[j][k])*(a[i][k]-a[j][k]));
            }
            chek=sqrt(ans);
            if(chek*chek==ans) cnt++;
        }
    }
    cout<<cnt;
}


Measured memory_bytes: 3644
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Policy;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var s = input.ReadLine()[0];

        if('a' <= s && s <= 'z') return "a";
        else return "A";
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        if(n == 0) return ret;
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 25788
#include <iostream>

using namespace std;

int dp[100001][3],a[100001][3];

int main(){
  int i,N,j;
  cin >> N;
  for (i=1;i<=N;++i) {
    for (j=0;j<3;++j) {
      cin >> a[i][j];
    }
  }
  for (j=0;j<3;++j) {
    dp[0][j]=0;
  }
  for (i=1;i<=N;++i) {
    dp[i][0]=max(dp[i-1][1]+a[i][0], dp[i-1][2]+a[i][0]);
    dp[i][1]=max(dp[i-1][0]+a[i][1], dp[i-1][2]+a[i][1]);
    dp[i][2]=max(dp[i-1][0]+a[i][2], dp[i-1][1]+a[i][2]);
  }
  cout << max(max(dp[N][0],dp[N][1]),dp[N][2]) << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <tuple>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

using T = tuple<ll,ll>;
using Graph = vector<vector<T>>;

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

    long long a;
    long double b;
    cin >> a >> b;

    cout << (ll)(a * b + 0.001) << endl;

    return 0;
}


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

int main(){
        string o,e;
        string ans="";
        cin >> o >> e;
        for (int i=0;i<o.size()+e.size()-abs(o.size()-e.size());i++){
                if (i%2) ans+=e[i/2];
                else ans+=o[i/2];
        }
        if (o.size()>e.size()) ans+=o[o.size()-1];
        //if (e.size()>o.size()) ans+=e[e.size()-1];
        cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    char s[4][4];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> s[i][j];
        }
    }
    
    cout << s[0][0] << s[1][1] << s[2][2] << endl;
    return 0;
    
    
}


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

arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
	if temp%i==0:
		cnt=0
		while temp%i==0:
			cnt+=1
			temp //= i
		arr.append([i, cnt])
if temp!=1:
	arr.append([temp, 1])
if arr==[]:
	arr.append([n, 1])

if n == 1:
	arr = []

nums = []
for i in arr:
	nums.append(i[0])

for f in arr:
	i = 2
	while f[1]>i:
		nums.append(f[0]**i)
		f[1] -= i
		i += 1

nums.sort()

ln = len(nums)

cnt = 0
ans = 0

while n >= 1 and cnt<ln:
	if n%nums[cnt] == 0:
		n /= nums[cnt]
		ans += 1
	cnt += 1

print(ans)

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

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

    vector<ll> v(1e5);
    for (ll i = 0; i < N; ++i) {
        ll a, b;
        cin >> a >> b;
        v[a - 1] += b;
    }

    ll ans = 0;
    for (ll i = 0; i < v.size(); ++i) {
        K -= v[i];
        if (K <= 0) {
            ans = i + 1;
            break;
        }
    }

    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw				"\n"


int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0;
	cin>>n;
	int arr[n];
	for(auto &i:arr)
		cin>>i;
	sort(arr,arr+n);
	cout<<arr[n/2]-arr[n/2-1];

}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
 
#define rng(x) x.begin(), x.end()
#define pb push_back
#define F first
#define S second
#define el '\n'
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.F << "," << P.S << ")"; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ "; for(auto v : V) os << v << " "; return os << "]"; }
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ "; for(auto s:S) os<<s<<" "; return os<<"}"; }
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ "; for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") "; return os<<"}";}
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout<<name<<" : "<<arg1<<'\n';}
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...);}
typedef long long ll; typedef pair<int,int> pi; 
typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi;
 
/*-----------------------------Code begins----------------------------------*/

const int N = 1e5;
vi adj[N];
vector <bool> vis(N);

void dfs(int node){
    vis[node] = true;
    for(int child : adj[node]){
        if(vis[child]) continue;
        dfs(child);
    }
}

void solve(){
    int n, m; cin>>n>>m;
    for (int i = 0; i < m; ++i){
        int u, v; cin>>u>>v;
        u--, v--;
        adj[u].pb(v);
        adj[v].pb(u);
    }

    int comps = 0;
    for (int i = 0; i < n; ++i){
        if(vis[i]) continue;
        comps++;
        dfs(i);
    }

    cout<<comps-1<<el;
}
 
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int T=1, tc = 1;
    // cin>>T; 
    while(T--){
        solve();
    }
    return 0; 
}

Measured memory_bytes: 9648
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define dump(o) { cerr << #o << " " << o << endl; }
#define dumpc(o) { cerr << #o; for (auto &e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

#define MAX 10001

signed main() {
	//while (true) {
	int N; cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	ll ans = 0, tmp = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] == 0) {
			ans += tmp / 2;
			tmp = 0;
		}
		else {
			tmp += A[i];
		}
	}
	ans += tmp / 2;
	cout << ans << endl;
	//}
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define ull uint64_t
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mx5 100005
#define mx6 1000005
#define mod 1000000007
#define nfs ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int main() {
    nfs
    int i, j, n, k, a[101] = {};
    bool out[mx5] = {};
    cin >> n >> k;
    for (i = 0; i < n; i++) {
        cin >> a[i];
    }
    out[0] = 0;
    for (i = 1; i <= k; i++) {
        for (j = 0; j < n && a[j] <= i; j++) {
            if (!out[i - a[j]]) {
                out[i] = 1;
                break;
            }
        }
    }
    cout << (out[k] ? "First" : "Second");
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	string S; cin >> S;

	int len = 0, ans = 0;;
	for (int i = 0;i < S.size();i++){
		if(S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') len++;
		else len = 0;
		ans = max(ans,len);
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<set>
#include<bitset>
#include<cmath>
#include<numeric>
#include<limits>
#include<functional>
#include <bitset>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
#define INFTY 1<<29
using namespace std;
typedef long long ll;
typedef long long int lli;
// static const int MOD = 10000007;
// static const int MAX = 100005;
static const int NMAX = 1005;



// typedef priority_queue<int, greater<int>> RevQ;
int N, M;
int a, b, x;
vector<int> q[NMAX], p(NMAX), C(NMAX);


// lli gcd(lli a, lli b) {
//   return b ? gcd(b, a%b) : a;
// }

int main(){
  cin >> a >>  b >> x;
  double half = (pow(a,2)*b)/(2.0);
  double theta, v;
  if (x > half) {
    v = 2.0*(b*pow(a,2) - x)/(pow(a, 3));
    theta = atan(v)*(180/3.14159265359);
    // cout << "half: " << half << "  " << v << endl;
  } else {
    v = a*pow(b,2)/(2.0*x);
    theta = atan(v)*(180/3.14159265359);
    // cout << "half2: " << half << "  " << v << endl;;
  }
  printf("%.8lf \n", theta);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
#pragma warning (disable: 4996)

int N, A[1 << 18], C[3];
long long sum = 1;

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];

	for (int i = 1; i <= N; i++) {
		long long cnt = 0, id = -1;
		if (A[i] == C[0]) { cnt++; id = 0; }
		if (A[i] == C[1]) { cnt++; id = 1; }
		if (A[i] == C[2]) { cnt++; id = 2; }
		/*if (id == -1) {
			cout << "0" << endl;
			return 0;
		}*/
		sum *= cnt; C[id]++;
		sum %= 1000000007;
	}
	cout << sum << endl;
	return 0;
}


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

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

  return 0;
}

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

#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)

using namespace std;

#define MAX 1000000

bool flg[MAX]={0};

void init(){
    flg[1] = true;
    reep(i,2,MAX){
        bool f=true;
        reep(k,2,sqrt(i)){
            if(i%k==0){
                f=false;
                break;
            }
        }
        if(f){
            for(int k=i+i;k<MAX;k+=i){
                flg[k]=true;
            }
        }
    }
}

int main(){
    init();
    int n;
    while(scanf("%d",&n)!=EOF){
        int ans=0;
        reep(i,1,n+1){
            if(!flg[i]){
                ans++;
            }
        }
        printf("%d\n",ans);
    }
}

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

int main() {
  int N, K, a;
  a=1;
  cin >> N >> K;
  for (int i=0; i<10000; i++) {
    if (N/K>=1) {
      N /= K;
      a++;
    }
    else {
      cout << a << endl;
      break;
    }
  }
}

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

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    
    int a[26] = {0}, b[26] = {0};
    for(int i = 1; i < n; i++){
        int cnt = 0;
        for(int j = 0; j < i; j++){
            a[s[j] - 'a']++;
        }
        for(int j = i; j < n; j++){
            b[s[j] - 'a']++;
        }
        for(int j = 0; j < 26; j++){
            if(a[j] >= 1 && b[j] >= 1){
                cnt++;
            }
        }
        ans = max(ans,cnt);
        for(int j = 0; j < 26; j++){
            a[j] = 0;
            b[j] = 0;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N,M,X,Y;
    cin >>N>>M>>X>>Y;
    int Xp[N];
    int Yp[M];
    for(int i = 0;i < N;i++) cin >> Xp[i];
    for(int i = 0;i < M;i++) cin >> Yp[i];
    bool frag = 0;
    for(int i = X+1;i < Y;i++){
        bool frag2 = 1;
        for(int j = 0;j < N;j++){
            if(Xp[j] >= i)frag2 = 0;
        }
        for(int j = 0;j < M;j++){
            if(Yp[j] < i)frag2 = 0;
        }
        if(frag2 == 1)frag = 1; 
    }
    if(frag) cout << "No War" << endl;
    else cout << "War" << endl;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#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 reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
 
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int N;
int K;
ll a[114514];
ll dp[405][405];
ll sum[114514];
int res;

int main(){
	cin>>N;
	rep(i,N)cin>>a[i];
	sum[0]=0;
	rep(i,N+1)rep(j,N+1)dp[i][j]=INF;
	rep(i,N)sum[i+1]=sum[i]+a[i];
	for(int len=1;len<=N;len++){
		for(int i=0;i<=N-len;i++){
			int j=i+len;
			if(j==i+1)dp[i][j]=0;
			else{
				for(int k=i+1;k<j;k++){
					mins(dp[i][j],dp[i][k]+dp[k][j]+sum[j]-sum[i]);
					//cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
				}
			}
		}
	}
	//rep(i,N)cout<<i<<" "<<sum[i]<<endl;
	cout<<dp[0][N]<<endl;
}

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

int main()
{
	int pre_x, pre_y, x = 1, y = 0, z = 0, w = 1, sgn = -1;
	int q, r = 1;
	int pre_a, pre_b, a, b;
	scanf("%d %d", &a, &b);
	pre_a = a, pre_b = b;
	while(r > 0){    // a > b, a < b, a = b, all okey.
		q = a / b;
		r = a % b;
		if(r){
			pre_x = x, pre_y = y;
			x = z,  z = pre_x + z * q;
			y = w,  w = pre_y + w * q;
			sgn *= -1;
		}
		a = b, b = r;
	};
	a = pre_a, b = pre_b;

	int ans_x = sgn * z, ans_y = (-1) * sgn * w;  // recycle x, y. another answer.
	if(sgn < 0){ x = ans_x + b, y = ans_y - a; }
	else{ x = ans_x - b, y = ans_y + a; }

	int crit = 2 * (z + w) - a - b;
	if(crit < 0 || (crit == 0 && ans_x <= ans_y)){ printf("%d %d\n", ans_x, ans_y); }
	else{ printf("%d %d", x, y); }

	return 0;
}

Measured memory_bytes: 1192
a, b, c, d = [int(i) for i in input().split()]
# abの通信可能性判定
if abs(a - b) <= d:
    ab = True
else:
    ab = False
# bcの通信可能性判定
if abs(b - c) <= d:
    bc = True
else:
    bc = False
# acの通信可能性判定
if abs(a - c) <= d:
    ac = True
else:
    ac = False

if ac == True or (ab == True and bc == True):
    print("Yes")
else:
    print("No")

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

 using namespace std;

 int main() {
   int H, W;

   cin >> H >> W;

   vector<vector<char>> a(H, vector<char>(W));

   for (int i = 0; i < H; i++) {
     for (int j = 0; j < W; j++) {
       cin >> a.at(i).at(j);
     }
   }

   for (int i = 0; i < H; i++) {
     bool judge = true;
     for (int j = 0; j < W; j++) {
       if (a.at(i).at(j) == '#') {
         judge = false;
         break;
       }
     }
     if (judge) {
       for (int j = 0; j < W; j++) a.at(i).at(j) = 'D';
     }
   }

   for (int j = 0; j < W; j++) {
     bool judge = true;
     for (int i = 0; i < H; i++) {
       if (a.at(i).at(j) == '#') {
         judge = false;
         break;
       }
     }
     if (judge) {
       for (int i = 0; i < H; i++) a.at(i).at(j) = 'D';
     }
   }

   for (int i = 0; i < H; i++) {
     int counter = 0;
     for (int j = 0; j < W; j++) {
       if (a.at(i).at(j) != 'D') {
         cout << a.at(i).at(j);
         counter++;
       }
     }
     if (counter > 0) cout << endl;
   }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;




//   a/b mod c
ll moddiv(ll a,ll b){
	ll x0=MOD,x1=b,x2,n0=0LL,n1=1LL,n2,t=a%b,m,ans;
	if (t==0) return a/b;
		for(int i=0;i<900;i++){
      m=x0/x1;
      x2=x0-x1*m;
      n2=(n0-m*n1)%MOD;
      if (x2==1){
        ans=(n2+MOD)%MOD;
        break;
      }
      x0=x1;x1=x2;
      n0=n1;n1=n2;
    }
	return (a+((t*ans)%MOD)*b-t)/b;
}
//剰余の割ざん

//aのn乗 mod c
ll expmod(ll a,ll n){
  ll ans=1LL,aa=a,beki=n;
  for(int i=0;i<64;i++){
    if (beki%2==1) ans=ans*aa%MOD;
    aa=aa*aa%MOD;
    beki/=2;
    if (beki==0)break;
  }
  return ans;
}


vi s(500000);

ll sov(ll waku,ll nin){
  ll ou=1;
  if (nin==0)return 1;
  if (waku==1)return 1;

  ou=moddiv(s[waku+nin-1],s[waku-1]);
  ou=moddiv(ou,s[nin]);
  return ou;
}


int main(){
  ll ans=0;
  cin >> n >> k;

  
  
  s[0]=1;
  s[1]=1;
  for(ll i=2;i<500000;i++){
    s[i]=s[i-1]*i%MOD;
  }


  ans=0;
  
  ll waku=n;
  ll nin=0;
  ll kk=1;
  for(ll i=0;i<=n;i++){
    //cout<<sov(waku,nin)<<endl;
    ans=ans+sov(waku,nin)*kk%MOD;
    ans%=MOD;

    kk=kk*(n-i)%MOD;
    kk=moddiv(kk,i+1);
    //cout<<kk<<endl;
    if (waku==(n-k))break;
    if (waku==1)break;
    waku--;
    nin++;
  }

//cout<<sov(3,1)<<endl;
  cout<<ans<<endl;
  return 0;
}






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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int T=1;
    //cin >> T;
    while(T--){
        string s;
        cin>>s;
        if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes"<<el;
        else cout<<"No"<<el;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <set>
#include <utility>
#include <functional>
#include<cstring>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int,pii> P;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
const int MAXN = 100000;
const int MAXE = 100000;
const int MAXV = 10000;
const int inf = 1e9;
const ll INF = 2e18;
const ll MOD = 1e9 + 7;

struct UnionFind{
    vector<int> par,rank;
    UnionFind(int n):par(n),rank(n){
        for(int i=0;i<n;++i) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[ry]>rank[rx]) par[rx]=ry;
        else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};

vector<ll> fac,inv,finv;

void initcom(){
    fac=inv=finv=vector<ll>(1e6);
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[0]=finv[1]=1;
    for(ll i=2;i<1e6;++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;
    }
}

ll com(int n,int k){
    if(n<0||k<0) return 0;
    if(n<k) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll x,ll y){
    if(y==0) return x;
    return gcd(y,x%y);
}
ll mopow(ll a,ll x,ll mod){
    ll res=1;
    while(x>0){
        if(x&1) res=res*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return res;
}

bool warp[5][5];
int maze[3010][3010];
int cnt[3010][3010];
int h,w;
vector<string> s;
int c;
void dfs(int y,int x){
    cnt[y][x]=c;
    for(int i=0;i<4;++i){
        int ny=y+dy[i],nx=x+dx[i];
        if(!(ny>=0&&ny<h&&nx>=0&&ny<w)) continue;
        if(s[ny][nx]=='#') continue;
        if(cnt[y][x]>0) continue;
        dfs(ny,nx);
    }
}
int main(){
    int n,m;cin>>n>>m;
    vector<int> a(m),b(m);
    UnionFind uf(n);
    for(int i=0;i<m;++i){
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
        uf.unite(a[i],b[i]);
    }
    map<int,int> pnt;
    for(int i=0;i<n;++i){
        pnt[uf.root(i)]++;
    }
    int ans=0;
    for(auto it:pnt) ans=max(ans,it.second);
    cout<<ans<<endl;
}



Measured memory_bytes: 13848
n, m = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort(reverse=True)

limit = sum(a)/(4*m)
canselect = True
for i in range(0, m):
    if a[i] < limit:
        canselect = False

if canselect:
    print("Yes")
else:
    print("No")    

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static int n;

        static void Main(string[] args)
        {
            //[summary]C - Green Bin
            n = int.Parse(Console.ReadLine());

            //読み込んだ文字列をそれぞれソートする
            var words = GetWords().ToList();

            //文字列を種類ごとにDictionaryにまとめる
            var summary = SummarizeWords(words);
            long count = 0;

            for(int i = n - 1; i >= 0; i--)
            {
                var key = words[i];
                summary[key]--;

                count += summary[key];
            }

            Console.WriteLine(count);
        }

        static Dictionary<string,int> SummarizeWords(List<string> words)
        {
            var summary = new Dictionary<string, int>();

            foreach(var word in words)
            {
                if (!summary.ContainsKey(word))
                {
                    summary.Add(word, 1);
                }
                else
                {
                    summary[word]++;
                }
            }

            return summary;
        }

        static IEnumerable<string> GetWords()
        {
            for (int i = 0; i < n; i++)
            {
                var s = Console.ReadLine().ToCharArray();
                yield return String.Join("", s.OrderBy(x => x));
            }
        }

    }
}

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

int main(){
	long int n,x;
	cin>>n;
	vector<long int> V;
	for(int i=0; i<n; i++){
		cin>>x;
		V.push_back(x);
	}
	sort(V.begin(), V.end());
	long int h,l;
	h=n/2;
	l=h-1;
	cout<<(V[h]-V[l])<<endl;

}

Measured memory_bytes: 1400
#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    = = = = = >
 
// bool cmp(pair<double,int> x, pair<double,int> y){
//     if(x.first==y.first){
//         return x.second<y.second;
//     }
//     return x.first>y.first;
// }

// void rec(int ){
//     if(){
        
//         return;
//     }

//     return;
// }
 
int solve() {fastio
    int n,k;
    cin>>n>>k;
    map<int,int>m;
    f(i,1,k,1){
        int d;
        cin>>d;
        for (int i = 0; i < d; i++) {
            int e;
            cin>>e;
            m[e]++;
        }
    }
    cout<<n-m.size();
    return 0;
}

//            < = = = = =    MAIN     = = = = = >
 
int main() {fastio
    
 	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
    
    int t=1;
     // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3644