akhauriyash/Code-Regression huggingface dataset:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    A = LI()
    c = Counter(A)
    if N % 2 != 0 and c[0] != 1:
        print(0)
        exit()
        
    for i in range(1,(N + 1) // 2):
        if c[i*2-(N%2==0)] != 2:
            print(0)
            exit()
    print(pow(2,N//2,mod))
if __name__ == '__main__':
    main()

Measured memory_bytes: 55896
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#define LL long long
const int maxn = 1e5 + 5;
const int maxP = 1e4;
using namespace std;
LL a[maxn], b[maxn]; int n;
map <LL, int> m;
vector <LL> p;
bool f[maxn];
void install(){
	for (int i = 2; i <= maxP; i++){
		if (!f[i]) p.push_back(i);
		for (int j = 0; j < p.size() && i * p[j] <= maxP; j++){
			f[i * p[j]] = 1;
			if (i % p[j] == 0) continue;
		}
	}
}
LL split(LL &x){
	LL res1 = 1, res2 = 1;
	for (int i = 0; i < p.size(); i++){
		if (x % p[i] != 0) continue;
		int cnt = 0;
		while (x % p[i] == 0) ++cnt, x /= p[i];
		cnt %= 3;
		if (cnt == 2) res1 = res1 * p[i] * p[i], res2 = res2 * p[i];
		else if (cnt == 1) res1 = res1 * p[i], res2 = res2 * p[i] * p[i];
	}
	if (x != 1){
		if ((LL)sqrt(x) * (LL)sqrt(x) == x) res1 *= x, res2 *= (LL)sqrt(x);
		else res1 *= x, res2 *= x * x;
	}
	x = res1;
	return res2;
} 
int main(){
	scanf("%d", &n); install();
//	for (int i = 0; i < 20; i++) printf("%d\n", p[i]);
	for (int i = 1; i <= n; i++){
		scanf("%lld", a + i);
		b[i] = split(a[i]);
		m[a[i]]++;
	} int ans = (m[1] != 0); m[1] = 0;
	for (int i = 1; i <= n; i++){
		if (m[b[i]] != 0) ans += max(m[a[i]], m[b[i]]), m[a[i]] = 0, m[b[i]] = 0;
		else ans += m[a[i]], m[a[i]] = 0;
	} printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 14336
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
cnt = 0
ans = False
for i in range(n):
    if d[i][0] == d[i][1]:
        cnt += 1
        if cnt >= 3:
            ans = True
            print('Yes')
            exit()
    else:
        cnt = 0
print('No')


Measured memory_bytes: 9116
#97 B - Exactly N points
N = int(input())

A = []
num = 1
cnt = 0
for _ in range(N):
    A.append(num)
    cnt += 1
    if num == cnt:
        cnt = 0
        num += 1

ans = [A[-1]]
tgt = N - A[-1]

for i in range(A[-1]-1,0,-1):
    tgt -= i
    if tgt == 0:
        ans.append(i)
        break
    if tgt < 0:
        tgt += i
        continue
    ans.append(i)

for a in ans:
    print(a)

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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
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; }

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


int main() {
    cout<<fixed<<setprecision(10);

    ll n; cin>>n;
    n = n%10;

    set<ll> s1 = {2 , 4 , 5 , 7 , 9};
    set<ll> s2 = {0,1,6,8};

    if(s1.count(n)) puts("hon");
    else if(s2.count(n)) puts("pon");
    else puts("bon");

    return 0;

}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if ((A+B) > (C+D)) {
    cout << "Left" << endl;
  } 
  else if ((A+B) < (C+D)) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
def Lucas(n):
    L = [0]*(n+1)
    if n==0:
        return 2
    elif n == 1:
        return 1
    else:
        L[0]=2
        L[1]=1
        i=2
        while i < (n+1):
            L[i] = L[i-1]+L[i-2]
            i += 1
    return L[n]
N=int(input())
print(Lucas(N))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REV(v) reverse(v.begin(), v.end());
#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, start, stop) for (int i = start; i < stop; i++)
#define FORR(i, start, stop) for (int i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<int>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<int>());
#define REMOVE(v,n) remove(vector<int> v,v+v.size(),int n)
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }

//vector< vector<int> > v (size1, vector<int>(size2) );

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll S;
    cin>>S;
    ll a=S/1000000000;
    ll b=S%1000000000;
    ll c=-1;
    if(a!=1000000000)cout<<1<<' '<<0<<' '<<a+1<<' '<<b<<' '<<0<<' '<<1000000000<<endl;
    else cout<<0<<' '<<0<<' '<<1000000000<<' '<<0<<' '<<0<<' '<<1000000000<<endl;
    
}
//601


Measured memory_bytes: 256
h,w=io.read("*n","*n","*l")
s={}
for i=1,h+2 do
    s[i]={}
    if i~=1 and i~=h+2 then
        x=io.read()
    end
    for j=1,w+2 do
        if i==1 or i==h+2 then
            s[i][j]="."
        else
            if j==1 or j==w+2 then
                s[i][j]="."
            else
                s[i][j]=x:sub(j-1,j-1)
            end
        end
    end
end

for i=2,h+1 do
    for j=2,w+1 do
        if s[i][j]=="." then
            bom_counter=0
            for k=i-1,i+1 do
                for l=j-1,j+1 do
                    if s[k][l]=="#" then
                        bom_counter=bom_counter+1
                    end
                end
            end
            s[i][j]=bom_counter
        end
    end
end

for i=2,h+1 do
    print(table.concat(s[i],"",2,w+1))
end

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_b() {
	ll n, m;
	ll x, y;
	ll a, b, c;
	ll k;
	ll l;
	string s, t;
	ll l_ans = 0;
	float f_ans = 0;
	string s_ans;

	cin >> a >> b >> c >> k;

	ll cnt = 0;
	if (a < b && b < c) {
		s_ans = "Yes";
	}
	else {
		while (a >= b) {
			b *= 2;
			cnt++;
			if (b > a) {
				break;
			}
		}
		while (b >= c) {
			c *= 2;
			cnt++;
			if (c > b) {
				break;
			}
		}
		if (cnt <= k) {
			s_ans = "Yes";
		}
		else {
			s_ans = "No";
		}
	}

	cout << s_ans << "\n";
}

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

	solve_abc_b();

	return 0;
}


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

int main(){
    int N;
    cin >> N;
    int *A;
    A = new int[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    int now_height = 0;
    long long int sum = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] >= now_height) {
            now_height = A[i];
        } else {
            sum += (now_height - A[i]);
        }
    }
    cout << sum;

    delete[] A;
    return 0;
}

Measured memory_bytes: 3988
#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline ll read() {
    ll x=0,f=1; char ch=getchar();
    for(;ch<'0'||ch>'9';ch=getchar())
        if(ch=='-')f=-f;
    for(;ch>='0'&&ch<='9';ch=getchar())
        x=x*10+ch-'0';
    return x*f;
}
inline void chkmin( int &a,int b ) { if(a>b) a=b; }
inline void chkmax( int &a,int b ) { if(a<b) a=b; }
#define _ read()
int main() {
	int n=_; double res=0;
	while( n-- ) {
		double x; string s;
		cin>>x>>s;
		if(s[0]=='J') res+=x;
		else res+=380000*x;
	}
	//cout<<res;
	printf("%.8f",res);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int a[maxn];
int n,m;
int main(){
	scanf("%d%d",&n,&m);
	while(m--){
		int u,v;
		scanf("%d%d",&u,&v);
		a[u]++;
		a[v]++;
	}
	for(int i=2;i<=n;i++)if(a[i]%2){
		puts("NO");
		return 0;
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 640
/*input
4
3 4 2 1
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<ll,ll>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll INF64=4e15;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
const ll maxn=6*1e4+5;
const ll maxlg=__lg(maxn)+2;

int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    REP(i,n) cin>>v[i];
    sort(ALL(v));
    int ans=0;
    REP(i,n){
        for(int j=i+1;j<n;j++){
            int x=v[i]+v[j],y=v[j]-v[i];

            int z=lower_bound(ALL(v),x)-v.begin();
            int z2=max((j+1),(int)(lower_bound(ALL(v),y)-v.begin()));
            ans+=max(0,z-z2);
        }
    }
    cout<<ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
struct edge{
    int to,cap,cost,rev;
};
typedef vector<edge> ve;
typedef vector<ve> vve;
class MCF{  //Minimum Cost Flow
    public:
    int n;
    vve G;
    vi h,dist,prev,pree;
    MCF(int size){
        n=size;
        G=vve(n);
        h=dist=prev=pree=vi(n);
    }
    void add_edge(int s,int t,int ca,int co){
      edge e={t,ca,co,int(G[t].size())};
        G[s].pb(e);
        edge ee={s,0,-co,int(G[s].size()-1)};
        G[t].pb(ee);
    }
    int mcf(int s,int t,int f){
        int out=0;
        h=vi(n);
        while(f>0){          
            priority_queue<pii,vector<pii> >q;
            dist=vi(n,inf);
            dist[s]=0;
            q.push(pii(0,s));
            while(!q.empty()){
                pii p=q.top();q.pop();
                int v=p.second;
                if(dist[v]<-p.first)continue;
                rep(i,G[v].size()){
                    edge &e=G[v][i];
                    if(e.cap>0&&dist[e.to]>dist[v]+e.cost+h[v]-h[e.to]){
                        dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
                        prev[e.to]=v;
                        pree[e.to]=i;
//                      cout<<" "<<dist[e.to]<<endl;
                        q.push(pii(-dist[e.to],e.to));
                    }
                }
            }
//          rep(i,n)dist[i]*=-1;
//          rep(i,n)cout<<dist[i]<<endl;
            if(dist[t]==inf)return -1;
            rep(i,n)h[i]+=dist[i];
            int d=f;
            for(int v=t;v!=s;v=prev[v])d=min(d,G[prev[v]][pree[v]].cap);
            f-=d;
            out+=d*h[t];
            for(int v=t;v!=s;v=prev[v]){
                edge &e=G[prev[v]][pree[v]];
                e.cap-=d;
                G[v][e.rev].cap+=d;
            }
//          cout<<f<<endl;
        }
        return out; 
    }
};

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  vector<int> b(n);
  MCF mcf(5000);
  map<int,int> f;
  int index=1;
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
    if(!f.count(a[i])) f[a[i]]=index++;
    if(!f.count(b[i])) f[b[i]]=index++;
  }
  
  const int goal=4999;
  for(int i=0;i<f.size();i++) mcf.add_edge(0,i+1,1,0);
  mcf.add_edge(0,f.size()+1,inf,0);
  for(int i=0;i<n;i++){
    mcf.add_edge(f[a[i]],i+f.size()+2,1,a[i]);
    mcf.add_edge(f[b[i]],i+f.size()+2,1,b[i]);
    mcf.add_edge(f.size()+1,i+f.size()+2,1,a[i]+b[i]);
    mcf.add_edge(i+f.size()+2,goal,1,0);
  }
  
  int sum=0;
  for(int i=0;i<n;i++){
    sum+=a[i]+b[i];
  }

  int res=mcf.mcf(0,goal,n);
  cout<<sum-res<<endl;
  return 0;
}

Measured memory_bytes: 3528
#include<iostream>
#include<cassert>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)
#define MAX 100 
using namespace std;

struct You
{//手の位置は自分の座標にdx[(dir+1)%4],dy[(dir+1)%4]を加えた場所
  int x,y,dir;
  You(int x=-inf,int y=-inf):x(x),y(y),dir(0){}
};

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

void init()
{
  rep(i,MAX)rep(j,MAX)G[i][j] = '.';
}

void makeGraph()
{
  string line;
  int x;
  REP(y,1,10)
    {//odd -> yoko, even -> tate
      cin >> line;
      x = (y%2?1:0);
      rep(i,line.size())
	{
	  if(line[i] == '1')
	    {
	      G[y][x] = (y%2?'-':'|');
	      if(y%2) G[y][x-1] = G[y][x+1] = 'o';
	      else    G[y+1][x] = G[y-1][x] = 'o';
	    }
	  x += 2;
	}
    }
}

void print()
{
  rep(i,11)
    {
      rep(j,11)
	{
	  cout << G[i][j];
	}
      cout << endl;
    }
  cout << endl;
}

void compute()
{
  You you(0,0);
  bool fir = true;
  while(true)
    {
      int x = you.x,y = you.y,dir = you.dir;
      //cout << "cur  | (" << x << "," << y << ") = " << G[y][x] << endl;
      int hx = x + dx[(dir+1)%4],hy = y + dy[(dir+1)%4];
      //cout << "hand | (" << hx << "," << hy <<") = " << G[hy][hx]<< endl;
      if(!fir && hx == 0 && hy == 1)
	{
	  cout << '\n';
	  return;
	}
      fir = false;

      int nx = x + dx[dir],ny = y + dy[dir];
      hx += dx[dir],hy += dy[dir];
      assert(G[ny][nx] != 'o');

      if(G[ny][nx] == '|' || G[ny][nx] == '-')
	{
	  dir = (dir + 3)%4;
	  you.dir = dir;
	}
      else if(G[hy][hx] == '.')
	{
	  dir = (dir + 1)%4;
	  you.x = nx + dx[dir], you.y = ny + dy[dir],you.dir = dir;	  
	}
      else if(G[hy][hx] == 'o' || G[hy][hx] == '-' || G[hy][hx] == '|')
	{
	  you.x += dx[dir],you.y += dy[dir];
	}

      hx = you.x + dx[(dir+1)%4], hy = you.y + dy[(dir+1)%4];

      if(G[hy][hx] != 'o')
	cout << (dir==0?'R':(dir==1?'D':(dir==2?'L':'U')));
      //cout << endl;
    }
}

int main()
{
  init();
  makeGraph();
  compute();
  //print();
  return 0;
}

Measured memory_bytes: 1168
M = (10 ** 9) + 7
n = int(input())

if n < 2:
    ans = 0
elif n == 2:
    ans = 2
else:
    ans = (10 ** n % M) - (9 ** n % M) - (9 ** n % M) + (8 ** n % M)

print(ans % M)

Measured memory_bytes: 10772
count=[]
for _ in range(int(input())):
    a,b=map(int,raw_input().split())
    if a==b:
        count.append(_)
flag=False
# print count
for i in range(1,len(count)-1):
    if count[i]-1==count[i-1] and count[i]+1==count[i+1]:
        flag=True
        print "Yes"
        break
if flag==False:
    print "No"





Measured memory_bytes: 64628
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    string s;
    cin>>s;
    for (int i=0; i<s.size()-2; i++) {
        if(s.at(i)==s.at(i+1) && s.at(i+1)==s.at(i+2)){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

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

#define rep(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a);i>(b);i--)
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  string s; cin >> s;

  ROF(i,s.size()/2 - 1,0)
    if(s.substr(0,i) + s.substr(0,i) == s.substr(0,2*i)){
      cout << s.substr(1,2*i).size() << endl;
      break;
    }
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,n) for(lli i=0;i<n;i++)
#define repb(i,n) for(lli i=n-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define bg() begin()
#define en() end()
#define ft first
#define sc second
#define vect_lli_it vector<lli>::iterator
#define set_lli_it set<lli>::iterator
#define inf 1e18
#define all(X) X.begin(),X.end()
#define iterate(X) for(it=X.begin();it!=X.end();it++)
#define mod 1000000007
lli combi(lli n,lli k)
{
    lli ans=1;
    k=k>n-k?n-k:k;
    lli j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
lli findlcm(vector <lli> arr, lli n)
{
    lli ans = arr[0];
    for (lli i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));

    return ans;
}
lli power(lli x, lli y) 
{ 
    lli res = 1;      // Initialize result 
  
    x = x % mod;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % mod; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % mod; 
    } 
    return res; 
} 
  
// Returns n^(-1) mod p 
lli modInverse(lli n) 
{ 
    return power(n, mod-2); 
} 
  
// Returns nCr % p using Fermat's little 
// theorem. 
lli fac[4001]; 
lli nCrModPFermat(lli n, lli r) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
  
    return (((fac[n]* modInverse(fac[r])) % mod) * 
            modInverse(fac[n-r]) % mod) % mod; 
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n,k;
    cin>>n>>k;
    fac[0]=1;
    for(lli i=1;i<=n+k;i++){
    	fac[i]=(fac[i-1]*i)%mod;
    	//cout<<fac[i]<<" ";
	}
	//cout<<"\n";
    lli red=n-k;
    lli blue=k;
    lli now=(red+1);
    cout<<now<<"\n";
    for(lli mov=2;mov<=k;mov++){
    	if(mov<=n-k+1){
    	lli red_b=red-(mov-1);
    	now=((nCrModPFermat(blue-mov+mov-1,mov-1))*(nCrModPFermat(red_b+mov+1-1,mov)))%mod;
    	cout<<now<<"\n";
    	}
    	else
    	cout<<"0\n";
	}
    return 0;
}


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

using namespace std;

using ll = long long;

constexpr ll MOD = 1000000007;

#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
#else
#define print(...)
#endif

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

    ll k;
    string s,ans;

    cin >> k >> s;

    ans = s;

    if(ans.length() > k){
        ans = ans.substr(0,k);
        ans = ans + "...";
    }

    cout << ans << endl;

    return 0;
}

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

#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define rep(i, n) for(int i = 0; i < n; i++)
#define run(i, a, b) for(int i = a; i < b; i++)
#define cinarr(arr, n) rep(_i, n) cin >> arr[_i]
#define cinset(st, n) int _t; rep(i, n) {cin >> _t; st.insert(_t);}
#define coutarr(arr, n) rep(_i, n) cout << arr[_i] << " "; cout << endl
#define coutvec(vec) for(auto _e: vec) cout << _e << " "; cout << endl;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpii vector<pii>
#define vpll vector<pll>
#define F first
#define S second
#define pb push_back
#define popb pop_back
#define pf push_front
#define popf pop_front

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

int main() {
    FAST_IO

    int T;
    cin >> T;

    while (T--) {
        cout << "ACL";
    }
    cout << endl;
}


Measured memory_bytes: 3584
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
const int P=1e9+7,N=3010,i2=(P+1)>>1;
int n,Q,a[N],dp[N][N],tmp[N][N],ans,tot=1;
int main(){
    scanf("%d%d",&n,&Q);
    rep(i,1,n) scanf("%d",a+i);
    rep(i,1,n) rep(j,1,n) dp[i][j]=a[i]>a[j];
    while(Q--){
        int x,y;scanf("%d%d",&x,&y);
        rep(i,1,n) if((i^x)&&(i^y)) tmp[i][x]=dp[i][y],tmp[x][i]=dp[y][i],tmp[i][y]=dp[i][x],tmp[y][i]=dp[x][i];
        rep(i,1,n) if((i^x)&&(i^y))
            dp[i][x]=1ll*i2*(dp[i][x]+tmp[i][x])%P,
            dp[i][y]=1ll*i2*(dp[i][y]+tmp[i][y])%P,
            dp[x][i]=1ll*i2*(dp[x][i]+tmp[x][i])%P,
            dp[y][i]=1ll*i2*(dp[y][i]+tmp[y][i])%P;
        rep(i,1,n) if((i^x)&&(i^y)) tmp[i][x]=tmp[i][y]=tmp[x][i]=tmp[y][i]=0;
        dp[x][y]=dp[y][x]=1ll*i2*(dp[x][y]+dp[y][x])%P;
        tot=2ll*tot%P;
    }
    rep(i,1,n-1) rep(j,i+1,n) ans=(ans+dp[i][j])%P;
    printf("%lld\n",1ll*ans*tot%P);
    return 0;
}

Measured memory_bytes: 71040
#![allow(dead_code)]
#![allow(non_snake_case)]


fn main(){
    let nm: Vec<usize> = input_vec();
    let ab: Vec<Vec<usize>> = input_vec2(nm[1]);

    let mut connection = vec![Vec::<usize>::new(); nm[0]+1];
    let mut next_room = vec![0; nm[0]+1];
    next_room[1] = 1;

    for elem in &ab {
        connection[elem[0]].push(elem[1]);
        connection[elem[1]].push(elem[0]);
    }

    let mut parent_room = vec![1usize; 1];
    let mut parent_room0 = [].to_vec();

    while parent_room.len() > 0 {
        for &parent in &parent_room {
            for &elem in &connection[parent] {
                if next_room[elem]>0 { continue; }
                next_room[elem] = parent;
                parent_room0.push(elem);
            }
        }
        parent_room = parent_room0.to_vec();
        parent_room0.clear();
    }

    for i in 2..=nm[0] {
        if next_room[i]==0 {
            println!("No");
            return;
        }
    }

    println!("Yes");
    for i in 2..=nm[0] {
        println!("{}", next_room[i]);
    }
}



/*
 *
 * input functions
 *
 */
 fn input<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}


fn input_vec<T: std::str::FromStr>() -> Vec<T> {
    input::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap()).collect()
}

fn input_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| input_vec()).collect()
}

Measured memory_bytes: 23264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    string s0[n];
    rep(0,i,n)s0[i]=s.substr(i,1);
    ll ans=0;
    ll r=0,g=0,b=0;
    rep(0,i,n){
        if(s0[i]=="R")++r;
        if(s0[i]=="B")++b;
        if(s0[i]=="G")++g;
        rep(i+1,j,n){
            ll x=j-i;
            if(j+x<n){
                if(s0[i]!=s0[j]&&s0[i]!=s0[j+x]&&s0[j]!=s0[j+x])++ans;
            }
        }
    }
    ans=r*g*b-ans;
    cout<<ans;
}

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


using namespace std;
int power(int y)
{
    int p=1;
    for(int i=0;i<y;i++)
    {
        p*=10;
    }
    return p;
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


    int n;cin>> n;
    int m=n;
    int i=0;
    int sum=0;
    while(n)
    {
        n/=10;
        i++;
    }
    int ten=1;
    for(int j=1;j<i;j+=2)
    {
        sum+=(9*ten);
        ten*=100;
    }
    if(i%2){
    int p=power(i-1);
    int temp=m-p;
    sum+=temp+1;
    }

    cout << sum;
}


Measured memory_bytes: 256
S = input()
T = input()

ans = len(T)

for S_start in range(len(S) - len(T) + 1):
    correct = 0
    for i in range(len(T)):
        if T[i] != S[S_start + i]:
            correct += 1
    ans = min(ans, correct)
    #print(ans)

print(ans)

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

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

int N;
const int mod = 1000000007;
const int size = 100100;

constexpr int mod_pow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)res *= a;
        a *= a;
        a %= mod;
        res %= mod;
        b >>= 1;
    }
    return res;
}

template<int SIZE>
struct Factorial {
    int fact[SIZE];

    constexpr Factorial() : fact() {
        fact[0] = 1;
        for (int i = 1; i < SIZE; ++i) {
            fact[i] = fact[i - 1] * i % mod;
        }
    }
};

template<int SIZE>
struct Inverse_factorial {
    int inv[SIZE];

    constexpr Inverse_factorial() : inv() {
        inv[0] = 1;
        for (int i = 1; i < SIZE; ++i) {
            inv[i] = inv[i - 1] * mod_pow(i, mod - 2) % mod;
        }
    }
};

constexpr Factorial<size> fac;
constexpr Inverse_factorial<size> inv;

constexpr int combination(int n, int k) {
    if (k > n)return 0;
    if (k < 0)return 0;
    int res = fac.fact[n] * inv.inv[n - k] % mod * inv.inv[k] % mod;
    return res;
}

int A[size];
int l, r;

void input() {
    cin >> N;
    rep(i, N + 1) {
        int a;
        cin >> a;
        if (!A[a])A[a] = i + 1;
        else {
            l = A[a] - 1;
            r = N - i;
            break;
        }
    }
}

int K(int k) {
    int res = combination(N + 1, k) - combination(l + r, k - 1);
    res += mod;
    res %= mod;
    return res;
}

signed main() {
    input();
    rep(k, N + 1) {
        cout << K(k + 1) << endl;
    }
    return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
#define ll long long
#define ld long double


int main(){

int a,b,c,d;
cin>>a>>b>>c>>d;

cout<<min(a,b)+min(c,d);
}

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

#define pb push_back
#define ff first
#define ss second
#define N 200005
#define mod 1000000007
#define fo(n) for(int i=1;i<=n;i++)
typedef pair<int,int> pii;
typedef long long int ll;
typedef long int li;
int mod1 = 998244353;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    double n;
    cin>>n;
    n = n/3.0;
    cout<<setprecision(10)<<(n*n*n);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define all(v) v.begin(),v.end()
#define PB push_back
#define PI 3.1415926535897932384626433832795
#define what(x) cout<<#x<<" is "<<x<<endl;
using namespace std;


template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
const ll M=1e9+7;
ll powmod(ll a,ll b,ll mod) {
    ll res=1;a%=mod;
    //assert(b>=0);
    for(;b;b>>=1){
        if(b&1)res=res*a%mod;a=a*a%mod;
    }
    return res;
}

void solve(){
	int n;
	cin>>n;
	vector<ll> vp(n);
	ll tot=0;
	for(ll &a:vp){
		cin>>a;
		tot+=a;
	}
	tot%=M;
	ll ans=0;
	for(int i=0;i<n;i++){
		ans+=((vp[i])*(M+tot-vp[i]))%M;
		ans%=M;
	}
	ans=(ans*powmod(2,M-2,M))%M;

	cout<<ans<<'\n';

}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tc=1;
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	#endif
	// cin>>tc;
    while(tc--)solve();
}


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

using namespace std;

typedef long long ll;
const ll INF = LLONG_MAX/4;

bool c(ll x, int idx, vector<ll> &B)
{    
    int N = B.size() / 2;
    int p1 = lower_bound(B.begin(), B.end(), x + B[idx]) - B.begin();
    if (p1 - idx > N) return 0;
    int p2 = lower_bound(B.begin(), B.end(), x + B[p1]) - B.begin();
    if (p2 - idx > N) return 0;
    int p3 = lower_bound(B.begin(), B.end(), x + B[p2]) - B.begin();    
    return (p3 - idx <= N) && (B[p3] - B[p2] >= x);
}

int main()
{
    int N;
    cin >> N;
    vector<ll> A(N), B(2*N, 0);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        B[i] = A[i] + (i > 0 ? B[i-1] : 0);
    }
    for (int i = 0; i < N; i++) {
        B[N+i] = B[N+i-1] + A[i];
    }
    ll res = 0;
    for (int i = 0; i < N; i++) {
        ll lb = 0, ub = INF;
        while (ub - lb > 1) {
            ll mid = (lb + ub) / 2;
            if (c(mid, i, B)) {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        res = max(res, lb);
    }
    cout << res << endl;
    return 0;
}

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

using namespace std;
     
int main(){
    int numero;
    cin >> numero;
     
    int total = 0;
     
    while(numero){
        total = total + numero % 10;
        numero = numero / 10;
    }
     
    if(total == 1){
        cout << 10 << endl;

    }else{
        cout << total << endl;
        
    }
    return 0;
}

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

typedef long long ll;

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

int main() {

    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    //cout << lcm( c, d) << '\n';
    ll x =  b - a + 1;
    ll l =  (a-1)/c + ( a - 1)/d - (a-1)/lcm(c,d);
    ll r = b/c + b/d - b/lcm(c,d);

    cout << x -  r + l << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>qq;
const ll maxn=1e6+5;
ll a[maxn];
ll v[maxn];
ll cc[3];
priority_queue<qq>que;
int main()
{
    ios::sync_with_stdio(false);
    ll x,y,a,b,c,zz;
    cin>>x>>y>>a>>b>>c;
    for(ll i=0; i<a; i++)
    {
        cin>>zz;
        que.push(make_pair(zz,0));
    }
    for(ll i=0; i<b; i++)
    {
        cin>>zz;
        que.push(make_pair(zz,1));
    }
    for(ll i=0; i<c; i++)
    {
        cin>>zz;
        que.push(make_pair(zz,2));
    }
    ll cnt=0;
    while(!que.empty())
    {
        qq u=que.top();
        que.pop();
        cc[u.second]++;
        if(cc[0]<=x&&cc[1]<=y&&cc[0]+cc[1]+cc[2]<=x+y)
        {
            cnt+=u.first;
        }
        else
        {
            cc[u.second]--;
        }
    }
    cout<<cnt;
    return 0;
}
/*
10 6
8 3 7 8 2 9 3 8 2 4


20 20
*/


Measured memory_bytes: 10348
#include <iostream>
#include <algorithm>

#define rep(var, start, end)  for(int var = start; var <= end; ++var)
#define drep(var, start, end) for(int var = start; var >= end; --var)

using namespace std;

int main() {

    long long X;
    long long m = 100, cnt = 0;

    cin >> X;

    while (m < X) {
        m = (long long)(m * 1.01);
        ++cnt;
    }

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

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll d, n;
    cin >> d >> n;
    cout << (ll)pow(100, d) * (n==100?101:n) << endl;
}

Measured memory_bytes: 256
import java.util.*;


class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int A = sc.nextInt();
        if(X < A){
            X=0;
        }
        else{
            X=10;
        }
        System.out.println(X);
    }
}

Measured memory_bytes: 21716
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll L_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;
// const double PI = M_PI;

const int MAX_N = 100000;

// 数列に対し, ある要素に値を加える操作と,
// 区間和を求める操作をそれぞれ対数時間で行うことが出来るデータ構造。
// 計算量: O(logN)
//
// sum: 区間[1, i]の合計を求める。
// add: 要素iに値xを加える。

// [1, n]
int bit[MAX_N + 1];
int n;
int q;

int sum(int i) {
  int s = 0;
  while (i > 0) {
    s += bit[i];
    i -= i & -i;
  }
  return s;
}

void add(int i, int x) {
  while (i <= n) {
    bit[i] += x;
    i += i & -i;
  }
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> q;
  while (q > 0) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com == 0) {
      add(x, y);
    } else {
      cout << sum(y) - sum(x - 1) << endl;
    }
    q--;
  }
  return 0;
}



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

int main(void){
	string s, t;
	int m, max = 0;
	cin >> s >> t;
	for(int i = 0; i < (int)s.size()-(int)t.size()+1; i++){
		m = 0;
		for(int j = 0; j < (int)t.size(); j++){
			if(s[i+j] == t[j]) m++;
		}
		if(max < m) max = m;
	}
	cout << (int)t.size() - max << endl;
	return 0;
}


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

using namespace std;

string to_string(int N){
    stringstream ss;
    ss<<N;
    string ret;
    ss>>ret;
    return ret;
}

bool isCorrect(int n, string s)
{
    string solution;
    if (n % 3 == 0 && n % 5 == 0) solution = "FizzBuzz";
    else if (n % 3 == 0) solution = "Fizz";
    else if (n % 5 == 0) solution = "Buzz";
    else solution = to_string(n);
    return solution == s;
}

int main()
{
    int M, N;
    while (cin >> M >> N, N || M)
    {
        bool isExist[1000] = {};
        fill_n(isExist, 1000, true);
        int cnt = M, p = 0;
        for (int i = 1; i <= N; i++, p = (p + 1) % M)
        {
            while (!isExist[p]) p = (p + 1) % M;
            string s;
            cin >> s;
            if (!isCorrect(i, s))
            {
                isExist[p] = false;
                if (--cnt == 1)
                {
                    while (++i <= N) cin >> s;
                }
            }
        }

        vector<int> ans;
        for (int i = 0; i < M; i++)
        {
            if (isExist[i]) ans.push_back(i);
        }
        if (ans.size() == 0)
        {
            while (true) {}
        }
        printf("%d", ans[0] + 1);
        for (int i = 1; i < ans.size(); i++)
        {
            printf(" %d", ans[i] + 1);
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 1288
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

using namespace std;

int cnt[2000];

int main(void){
    for(int i=0;i<2000;i++){
        cnt[i]=0;
    }
    int sunuke,n,d,temp,s_count;
    cin>>sunuke>>n;
    for(int i=0;i<n;i++){
        cin>>s_count;
        for(int j=0;j<s_count;j++){
            cin>>temp;
            cnt[temp-1]++;
        }
    }
    int ans=0;
    for(int i=0;i<sunuke;i++){
        if(cnt[i]==0)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll N;
    string s,t;
    cin >> N;
    cin >> s;
    cin >> t;
    ll ans = LINF;
    if(s == t) {
        ans = N;
    } else {
        ans = N*2;
        for (int i = 1; i <= N; i++) {
            bool flg = true;
            for (int j = 0; j < i; j++) {
                if(s[N-i+j] != t[j]){
                    flg = false;
                    break;
                }
            }
            if(flg){
                ans = min(ans,N*2-i);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
const int MAXN=310;
const int mod=998244353;
bitset<MAXN>a[MAXN],b[MAXN];
int n,m,x,ans;
long long poww(long long x,long long y)
{
	long long ans=1;
	for (;y;y>>=1,x=(x*x)%mod) if (y&1) ans=(ans*x)%mod;
	return ans;
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
	{
	for (int j=1;j<=m;j++) 
	{
		scanf("%d",&x);
		if (x==1) a[i].set(j);
	}
	}    for (int i=1;i<=n;i++)
    {
    	for (int j=1;j<=m;j++) 
    		if (!a[i][j]) continue;
    	else
    		if (!b[j].any()) {
    			b[j]=a[i]; break;
    		}
    		else a[i]^=b[j];
    }
    for (int i=1;i<=max(n,m);i++) if (b[i].any()) ans++;
    cout << (poww(2,n)-poww(2,n-ans)+mod)%mod*poww(2,m-1)%mod << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() { 
   long long n;
   cin>>n;
   vector<long> h(n);
   for(int i=0;i<n;i++){
     cin>>h[i];
   }
   long ans=0;
   for(int i=0;i<n;i++){
     long bad=0;
     for(int j=0;j<i;j++){
       if(h[i]<h[j]){
         bad++;
         break;
       }
     }
     if(bad==0){
       ans++;
     }
   }
   cout<<ans<<endl;
     
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int x,n,i,num;
    scanf("%d %d",&x,&n);
    if(n==0)
    {
        printf("%d",x);
    }
    else
    {
        int diff,re;
        int ara[103]= {0};
        for(i=0; i<n; i++)
        {
            scanf("%d",&num);
            ara[num]=1;
        }
        for(i=x,diff=0;;diff++)
        {
            if(ara[x-diff]==0)
            {
                re=x-diff;
                break;
            }
            else if(ara[x+diff]==0)
            {
                re=x+diff;
                break;
            }
        }
        printf("%d",re);
    }
    return 0;
}


Measured memory_bytes: 1728
import bisect


def main():
  x = [int(input()) for _ in range(int(input()))]
  c = [x[-1]]

  for i in range(len(x) - 2, -1, -1):
    j = bisect.bisect(c, x[i])

    if j == len(c):
      c.append(x[i])
    else:
      c[j] = x[i]

  print(len(c))


if __name__ == '__main__':
  main()


Measured memory_bytes: 56280
(lambda A:(lambda N:(lambda
C:(lambda d:(lambda B:print
(["No","Yes"][3 in{sum(B[2:
8:2]),sum(B[::4])}|{sum(B[i
*3:i*3+3])for i in range(3)
} | { sum(B[i::3] )for i in
range(3)} ] ) ) ( list(map(
lambda x:d[x],A))))([x in C
for x in range(101)]))({int
(input())for x in range(N)}
))(int(input())))(list(map(
int,input().split()))+list(
map(int,input().split())) +
list(map(int,input().split())))

Measured memory_bytes: 38384
#include <cstdio>
#include <algorithm>
 
int a, b;
 
int main() {
    scanf("%d%d", &a, &b);
    if (a > b) std::swap(a, b);
    for (int i = 0; i < b; ++i) printf("%d", a);
    puts("");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


///////////////////////////////////////////////////

int main()
{
    int N, D;
    io >> N >> D;
    vi x(N), y(N);
    for (int i = 0; i < N; i++)
        io >> x[i] >> y[i];

    ll DD = (ll)D * D;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if ((ll)x[i]*x[i] + (ll)y[i]*y[i] <= DD)
            ++ans;
    }
    cout << ans << BR;
}

Measured memory_bytes: 4840
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=25;
const int MOD=1000000007;

int n,m,p,c[N][N],f[2][21][1048580],bin[N];

int read()
{
	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;
}

void updata(int &x,int y)
{
	x+=y;x-=x>=MOD?MOD:0;
}

int modify(int s,int i)
{
	if (s&bin[i]) return s;
	int w=s&(bin[n]-bin[i]);
	if (w) s-=w&(-w);
	return s+bin[i];
}

int main()
{
	n=read()-1;m=read();p=read();
	for (int i=1;i<=m;i++)
		for (int j=1;j<=n;j++)
			c[i][j]=-1;
	for (int i=1;i<=p;i++)
	{
		int x=read(),y=read(),z=read();
		c[x][y]=z;
	}
	bin[0]=1;
	for (int i=1;i<=n;i++) bin[i]=bin[i-1]*2;
	int now=0;
	f[0][0][0]=1;
	for (int i=1;i<=m;i++)
	{
		for (int j=0;j<n;j++)
			for (int s=0;s<bin[n];s++)
			{
				if (!f[now][j][s]) continue;
				if (c[i][j+1]<=0&&!(s&bin[j])) updata(f[now][j+1][s],f[now][j][s]);
				if (c[i][j+1]!=0) updata(f[now][j+1][modify(s,j)],f[now][j][s]);
			}
		memset(f[now^1],0,sizeof(f[now^1]));
		for (int s=0;s<bin[n];s++) updata(f[now^1][0][s],f[now][n][s]);
		now^=1;
	}
	int ans=0;
	for (int s=0;s<bin[n];s++) updata(ans,f[now][0][s]);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 172288
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;
#define LL long long

int H,W,ans=0;
char S[2222][2222];
vector<int>hor[2222],var[2222];

int main() {
	cin>>H>>W;
	for(int i=1;i<=H;i++){
		hor[i].push_back(0);
		hor[i].push_back(W+1);
	}
	for(int i=1;i<=W;i++){
		var[i].push_back(0);
		var[i].push_back(H+1);
	}
	for(int i=1;i<=H;i++)for(int j=1;j<=W;j++){
		cin>>S[i][j];
		if(S[i][j]=='#'){
			hor[i].push_back(j);
			var[j].push_back(i);
		}
	}
	for(int i=1;i<=H;i++)sort(hor[i].begin(),hor[i].end());
	for(int i=1;i<=W;i++)sort(var[i].begin(),var[i].end());
	for(int i=1;i<=H;i++)for(int j=1;j<=W;j++){
		if(S[i][j]=='#')continue;
		auto hi=lower_bound(hor[i].begin(),hor[i].end(),j);
		auto vi=lower_bound(var[j].begin(),var[j].end(),i);
		ans=max(ans,*hi-*(hi-1)+*vi-*(vi-1)-3);
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 38656