akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007




void solve() {
	
	int f[10000005] {};
	
	for(int i = 1; i <= 10000000; ++i) {
		for(int j = i; j <= 10000000; j += i) {
			f[j]++;
		}
	}
	
	int n;
	
	cin >> n;
	
	int sm = 0;
	
	for(int i = 1; i <= n; ++i) {
		sm += i*f[i];
	}
	
	cout <<sm;
}

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 81732
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 
  typedef pair<PLL,int> PPLLI;

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  vector<PLL> v(N);
  rep(i,N) cin >> v[i].second;
  rep(i,N) cin >> v[i].first;
  sort(all(v));
  priority_queue<PLI,vector<PLI>,greater<PLI>> unsatque;
  rep(i,N) unsatque.push(PLI(v[i].second,i));
  priority_queue<PLI> pque;

  int count = 0;
  bool sat = true;

  rep(i,N){
    if(v[i].first>=v[i].second)continue;
    while(!unsatque.empty()){
      PLI p = unsatque.top();
      if(p.first > v[i].first) break;
      int index = p.second;
      pque.push(PLI(v[index].first,index));
      unsatque.pop();
    }

    while(true){
      if(pque.empty()){
        sat = false;
        break;
      }
      PLI p = pque.top();
      pque.pop();
      int index = p.second;
      ll vf = v[index].first;
      ll vs = v[index].second;
      if(index<i) continue;
      /*
      if(vf <= v[i].first){
        sat = false;
        break;
      }
      */
      ++count;
      swap(v[index].second,v[i].second);
      unsatque.push(PLI(v[index].second,index));
      break;
    }
    if(!sat) break;
  }
  if(count>N-2)sat = false;
  YesNo(sat);
  return 0;
}


Measured memory_bytes: 6512
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;

int main() {
	int d,m;
	cin >> d;
	vector<int> c(26), l(26), t(d);
	rep(i, 26) cin >> c[i];

	vector<vector<int>> s(d, vector<int>(26));
	rep(i, d)rep(j, 26) cin >> s[i][j];
	rep(i, d) {
		cin >> t[i];
		t[i]--;
	}
	cin >> m;
	vector<P> M(m);
	rep(i, m) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		M[i].first = x;
		M[i].second = y;
	}
	
	rep(mi, m) {
		t[M[mi].first] = M[mi].second;

		int ans = 0;
		rep(i, d) {
			ans += s[i][t[i]];
			l[t[i]] = i + 1;
			rep(j, 26) {
				if (j == t[i])continue;
				ans -= c[j] * (i + 1 - l[j]);
			}
		}
		cout << ans << endl;
		l = vector<int>(26);
	}
}

Measured memory_bytes: 4040
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ND = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var N = ND[0];
            var D = ND[1];
            var XList = Enumerable.Range(0, N).Select(_ => Console.ReadLine().Split(' ').Select(int.Parse).ToArray()).ToArray();

            var output = 0;
            for (var i = 0; i < N; i++)
            {
                for (var j = 0; j < i; j++)
                {
                    var xi = XList[i];
                    var xj = XList[j];

                    var dis = Math.Sqrt(xi.Zip(xj, (f, s) => (f - s) * (f - s)).Sum());
                    if (dis == (int)dis)
                    {
                        output++;
                    }
                }
            }

            Console.WriteLine(output);
        }

        static int NumberOfDigits(long x)
        {
            if (x < 10) return 1;

            var result = 0;
            while (x > 0)
            {
                result++;
                x /= 10;
            }

            return result;
        }

        static int SumOfDigits(int x)
        {
            var sum = 0;
            while (x > 0)
            {
                sum += x % 10;
                x /= 10;
            }

            return sum;
        }
    }
}


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

int main(){
  int a,b,c;
  cin >> a >> b;
  if(a<=5){
      c=0;
  }
  else if(a<=12){
      c = b/2;
  }
  else{
      c = b;
  }
	cout << c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void pr(A a){cout << a << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;p(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;p(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;p(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {}

int main(void) {
  int n,d;cin>>n>>d;
  if (n%(2*d+1)==0) pr(n/(2*d+1));
  else pr(n/(2*d+1)+1);
  return 0;
}


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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

void solve() {
    int N;
    cin >> N;
    set<string> s;
    REP(i,N) {
        string S;
        cin >> S;
        s.insert(S);
    }

    cout << s.size() << endl;
}

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


Measured memory_bytes: 19204
# -*- coding: utf-8 -*-
import random
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline

INF = 10**11

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def warshall_floyd(g):
    d = g
    N = len(g)
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d


def slv(N, M, L, ABC, Q, ST):
    g = [[INF]*(N) for _ in range(N)]

    for a, b, c in ABC:
        if c > L:
            continue
        g[a-1][b-1] = c
        g[b-1][a-1] = c

    d = warshall_floyd(g)

    gg = [[INF]*(N) for _ in range(N)]
    for u in range(N):
        for v in range(N):
            if d[u][v] <= L:
                gg[u][v] = 1

    d = warshall_floyd(gg)

    for s, t in ST:
        c = d[s-1][t-1]
        if c != INF:
            print(c-1)
        else:
            print(-1)


def main():
    N, M, L = read_int_n()
    ABC = [read_int_n() for _ in range(M)]
    Q = read_int()
    ST = [read_int_n() for _ in range(Q)]

    (slv(N, M, L, ABC, Q, ST))


if __name__ == '__main__':
    main()


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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define MAXX 500005
#define INF INT_MAX

#define PI   3.14159265358979323846264338327950

#define PB push_back
#define PF push_front
#define F first
#define S second

#define fixx(n) fixed << setprecision(n)

#define ll 	 long long

#define mod  1000000007



int main()
{
	FAST;
	int cnt[MAXX] = {0};
	int n;
	cin >> n;
	int a[n+6];
	bool fl = false;
	for(int i = 0; i < n; i ++){
		cin >> a[i];
		if(a[i] == 1){
			fl = true;
		}
	}
	if(!fl){
		cout << -1;
		return 0;
	}
	int h = 1;
	for(int i = 0; i < n; i ++){
		if(a[i] == h){
			h ++;
		}
	}
	cout << n - h + 1;
	return 0;
}

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

using namespace std;

inline bool isPa(char *ch,int st,int ed) {
	while (ed >= st) {
		if (ch[ed] != ch[st])
			return 0;
		st++;
		ed--;
	}
	return 1;
}

struct St {
	int tag,len,ty;
	long long cost;
	St(int tag,int len,int ty,long long cost):tag(tag),len(len),ty(ty),cost(cost){
	}
	bool operator <(const St &r) const {
		return cost > r.cost;
	} 
	
};
char sha[101];
char s[55][55];
int c[101010],l[55];
inline bool chk1(int i1,int i2,int ed1,int len) {
	for (int i = 1;i <= len; i++)
		sha[i] = s[i1][i];
	for (int i = 1;i <= len; i++)
		sha[i+len] = s[i2][ed1-len+i];
//	cout << i1 << " " << i2 << " " << len << " " << ed1 << endl;
//	for (int i = 1;i <= len+len; i++)
//		cout << sha[i];
//	cout << endl;
	return isPa(sha,1,len+len);
}
inline bool chk2(int i1,int i2,int st,int len) {
	for (int i = 1;i <= len; i++)
		sha[i] = s[i1][i+l[i1]-len];
	for (int i = 1;i <= len; i++)
		sha[i+len] = s[i2][st+i-1];
	return isPa(sha,1,len+len);
}

bool vis[55][55][5];
priority_queue<St> q;

int main() {
	int n;
	scanf("%d",&n);
	for (int i = 1;i <= n; i++) {
		scanf("%s%d",s[i]+1,&c[i]);
		int len = strlen(s[i]+1);
		l[i] = len;
		for (int j = 0;j <= len; j++) {
			if (isPa(s[i],j+1,len)) {
				q.push(St(i,j,1,c[i]));
			}
			if (isPa(s[i],1,j))
				q.push(St(i,len-j,2,c[i]));
		}
	}
	
	while (!q.empty()) {
		St t = q.top();
		q.pop();
		if (t.len == 0) {
			printf("%lld",t.cost);
			return 0;
		}
		if (vis[t.tag][t.len][t.ty])
			continue;
	//	cout << t.tag << " " << t.len << " " << t.ty << " " << t.cost << "--------------" << endl;
		vis[t.tag][t.len][t.ty]=1;
		for (int i = 1;i <= n; i++) {
			if (t.ty == 1) {
				if (chk1(i,t.tag,t.len,min(t.len,l[i]))) {
					if (l[i] >= t.len)
						q.push(St(i,l[i]-t.len,2,c[i]+t.cost));
					else
						q.push(St(t.tag,t.len-l[i],1,c[i]+t.cost));
				}
			}
			else if (chk2(i,t.tag,l[t.tag]-t.len+1,min(t.len,l[i]))) {
				if (l[i] >= t.len)
					q.push(St(i,l[i]-t.len,1,c[i]+t.cost));
				else
					q.push(St(t.tag,t.len-l[i],2,c[i]+t.cost));
			}
		}
	}
	printf("-1");
	return 0;
} 
/*
5
abcd 1
cbaef 10
rpfe 100
prao 1000
oa 10000
*/

Measured memory_bytes: 3796
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");
        String s = arr01[0];
        int l = s.length();

        int cnt1 = 0;
        int cnt2 = 0;
        for (int i = 0; i < l; i++) {
            if (s.substring(i, i + 1).equals("0")) {
                cnt1 += 1;
            } else {
                cnt2 += 1;
            }
        }

        System.out.println(l - Math.abs(cnt1 - cnt2));

    }

}


Measured memory_bytes: 27348
n, k, q = map(int, input().split())
a = list()
for i in range(0, q):
    a.append(int(input()))

score = [k - q]*n

for i in a:
    score[i-1] += 1

for x in score:
    if x > 0:
        print("Yes")
    else:
        print("No")



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

int main()
{
  char a[101]={},b[101]={};
  int i;
  int l_a,l_b;

  scanf("%s",a);
  scanf("%s",b);
 
  l_a=strlen(a);
  l_b=strlen(b);
  
  for(i=0;i<l_a;i++)
  {
      if(a[i]>b[i]&&l_a>=l_b)
      {
        printf("GREATER\n");
        return 0;
      }
      else if(a[i]<b[i]&&l_a<=l_b)
      {
        printf("LESS\n");
        return 0;
      }
  }
  
  printf("EQUAL\n");
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;

int main()
{
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    a--;
    b--;
    c--;
    d--;
    string s;
    cin >> s;
    if(c < d){
        for(int i = a; i < d; i++){
            if(s[i] == '#' && s[i+1] == '#'){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    }else if (c > d){
        for(int i = b; i < d+1; i++){
            if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.'){
                cout << "Yes" << endl;
                return 0;
            }
        }
        cout << "No" << endl;
    }else if (c == d){
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3712
number = input().split(" ")
a = int(number[0])
b = int(number[1])
c = int(number[2])
d = int(number[3])

x = a*c
y = a*d
z = b*c
s = b*d

ans = [x,y,z,s]
ans.sort()
print(ans[3])

Measured memory_bytes: 9000
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
char a[10001];
int main()
{
	cin>>a;
	int lenth=strlen(a)-2;
	int lenth1=strlen(a);
	cout<<a[0]<<lenth<<a[lenth1-1]<<endl;
}

Measured memory_bytes: 256
S = input()
N = len(S)

ans = [0] * N
dist = [0] * N

def ceil(x, y) :
    return (x + y - 1) // y

nowIndex = 0
while nowIndex < N :
    leftL = nowIndex
    while leftL < N and S[leftL] == 'R' :
        leftL += 1
    nextR = leftL
    while nextR < N and S[nextR] == 'L' :
        nextR += 1
    ans[leftL - 1] = ceil(leftL - nowIndex, 2) + (nextR - leftL) // 2
    ans[leftL] = nextR - nowIndex - ans[leftL - 1]
    nowIndex = nextR

print(*ans)

Measured memory_bytes: 7168
fun main(args: Array<String>) {
    val (n, m, x, y) = readLine()!!.split(" ").map(String::toInt)
    val xs = readLine()!!.split(" ").map(String::toInt)
    val ys = readLine()!!.split(" ").map(String::toInt)

    val maxXn = xs.max()!!
    val minYn = ys.min()!!

    val nowar = maxXn < minYn && (x + 1) <= minYn && maxXn <= (y - 2)

    val ans = if (nowar) {
        "No War"
    } else {
        "War"
    }
    println(ans)
}

Measured memory_bytes: 37948
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int x, n;
    cin >> x >> n;
    set<int> s;
    rep(i, n) cin >> s;

    rep(i, 1000) {
        int j = x - i;
        if (!contain(s, j)) {
            cout << j << endl;
            ret();
        }
        int k = x + i;
        if (!contain(s, k)) {
            cout << k << endl;
            ret();
        }
    }

}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	int count=3;
	if(a==b){
		count--;
	}
	if(a==c){
		count--;
	}
	if(b==c){
		count--;
	}
	if(a==b && b==c){
		cout << 1 << endl;
	}else{
	cout << count << endl;
}
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://agc016.contest.atcoder.jp/tasks/agc016_a>
問題文============================================================
 すぬけ君は、次のルールに従い、長さ N の文字列 t を長さ N−1 の文字列 t' へ変えることができます。
 
 各 i (1≤i≤N−1) について、t' の i 文字目は t の i, i+1 文字目のどちらかである。
 
 英小文字のみからなる文字列 s があります。
 すぬけ君の目標は、s に上記の操作を繰り返し行い、s が単一の文字のみからなるようにすることです。
 目標を達成するために必要な操作回数の最小値を求めてください。

=================================================================

解説=============================================================

================================================================
*/

int ans = INF;
void dfs(string s,int dep,char c){
    string tmp = s;
    tmp.erase(unique(tmp.begin(),tmp.end()),tmp.end());
    if(tmp.length() == 1){
        ans = min(ans,dep);
        return ;
    }
    for(int i = 0; i < (int)s.length() - 1;i++){
        if(s[i] == c || s[i+1] == c){
            s[i] = c;
        }
    }
    s.pop_back();
    dfs(s,dep+1,c);
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    string s; cin >> s;
    bool alpha[26] = {false};
    for(auto c:s) alpha[c-'a'] = true;
    for(int i = 0; i < 26;i++){
        if(alpha[i]){
            dfs(s,0,'a'+i);
        }
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
const int inf = 1000000000; //10^9
const ll MOD = 1e9 + 7;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
int main()
{
    int x;
    cin >> x;
    if(x < 1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    string s,t,u;
    int a,b;
    cin>>s>>t;
    cin>>a>>b;
    cin>>u;
    if(s==u)
        a--;
    else if (t==u)
        b--;
    cout<<a<<" "<<b;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	int a,b,c,d;
	cin >> a;
	cin >> b;
	//cin >> c;

	a % 500 <=b?cout <<"Yes"<< endl: cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define INF 1000000007
#define LINF 1000000000000000007
#define MOD 1000000007
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout << #X << ": " << X << " ";
#define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " ";
#define END cout << endl;
#else
#define DEB(X) \
    {          \
    }
#define ARDEB(i, X) \
    {               \
    }
#define END \
    {       \
    }
#endif
typedef pair<int, int> P;
struct edge{int to,cost;};
typedef long long ll;

int ans,ans2;

int extgcd(int a,int b,int &x,int &y){
	int g=a;
	x=1,y=0;
	if(b!=0){
		g=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}
	return g;
}
 
// �t��
int mod_inverse(int a,int m){
	int x, y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}
 
// �K��
std::vector<int>fact;
void mod_fact(int n, int m){
	fact.resize(n+1);
	fact[0]=1;
	for(int i=1;i<=n;i++){
		fact[i]=fact[i-1]*i%m;
	}
}
 
// nCk mod p
int mod_nCr(int n, int k, int m){
	if(n<k)return 0;
	return fact[n]*mod_inverse(fact[k]*fact[n-k]%m,m)%m;
}



signed main(){

    int n,k;
    cin>>n>>k;

    mod_fact(n+1000,MOD);
    for(int i=1;i<=k;i++){
        cout<<mod_nCr(n-k+1,i,MOD)*mod_nCr(k-1,i-1,MOD)%MOD<<endl;
    } 
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;

/*Question
/???????????????????¨???????????????????????????????????????????????¨???°????????°??????????????°??????????¨???°???????¨??????§??????
/????????°????????¬?????????????¨??????§?¨???°???????????°??? (1+2)*(5+4) ?????????????????????????¨??????§??? 1 2 + 5 4 + * ??¨?¨???°???????????????
/???????????????????¨??????§?????????????¨??????§????????¨????????¬??§???????????§???????????¨????????????????????????????????????
/???????????????????¨??????§?????????????????°???????¨???????????????????????????????????????? 
*/

/*Input
/???????????°??????????????????????????????????????£?¶?????????????????????????????????????????????????????????????????????????????????§???????????????????????????????????? 
*/

public class Main {
	public static void main(String[] args) throws Exception {
		int i = Calc();
		System.out.println(i);
	}

	/*Calc????????????
	/Unicode????????????????????§?????°???????¨???????????????§???????????§????????§??????????????°???????¨???????????????????
	/??°?????????x??????????????????
	/??°?????????????????????????????????????¨??????????????????????x?????????????????¨???????????§?¨????????????°??????
	/?¨??????????????????????2?????´???????????????????????????????????????????????\??????????????????????¶?????????????
	*/

	static int Calc() throws Exception {
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		//???????????????????????°???????´????????????????????´???¨
		List<Integer> x = new ArrayList<Integer>();
		//???????????£??¨
		int t;
		//??\???
		String[] s = sc.readLine().split(" ");
		//?¨??????????????????°???????????????????????????
		for (int i = 0;i < s.length;i++){
			if (s[i].compareToIgnoreCase("-") > 0) {
				x.add(Integer.parseInt(s[i]));
			}else {
				if(s[i].equals("*")){
					t = (x.get(x.size()-2)*x.get(x.size()-1));
					if (x.size() > 2) {
						x.remove(x.size()-1);
						x.remove(x.size()-1);
					}else x.clear();
					x.add(t);
				}else if(s[i].equals("+")){
					t = (x.get(x.size()-2)+x.get(x.size()-1));
					if (x.size() > 2) {
						x.remove(x.size()-1);
						x.remove(x.size()-1);
					}else x.clear();
					x.add(t);
				}else if(s[i].equals("-")){
					t = (x.get(x.size()-2)-x.get(x.size()-1));
					if (x.size() > 2) {
						x.remove(x.size()-1);
						x.remove(x.size()-1);
					}else x.clear();
					x.add(t);
				}
			}
		}
		return x.get(x.size()-1);
	}
}

Measured memory_bytes: 24472
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

template<class T>struct SegTree{
	T *dat, *lazy;
	int n;
	SegTree(int size = 1000000){
		for(n = 1; n < size; n *= 2);
		dat = new T[2 * n - 1];
		lazy= new T[2 * n - 1];
		init();
	}
	~SegTree(){ delete [] dat; delete [] lazy; }
	
	void init(){
		rep(i, 2 * n - 1) dat[i] = 0;
		rep(i, 2 * n - 1) lazy[i]= 0;
	}
	void add(int a, int b, ll v, int k, int l, int r){
		if(r <= a || b <= l) return;
		if(a <= l && r <= b){ lazy[k] += v; return; }
		if(lazy[k]){
			lazy[k * 2 + 1] += lazy[k];
			lazy[k * 2 + 2] += lazy[k]; lazy[k] = 0;
		}
		add(a, b, v, k * 2 + 1, l, (l + r) / 2);
		add(a, b, v, k * 2 + 2, (l + r) / 2, r);
		dat[k] = min(dat[k * 2 + 1] + lazy[k * 2 + 1], dat[k * 2 + 2] + lazy[k * 2 + 2]);
	}
	T query(int a, int b, int k, int l, int r){
		if(r <= a || b <= l) return inf;
		if(a <= l && r <= b) return dat[k] + lazy[k];
		if(lazy[k]){
			lazy[k * 2 + 1] += lazy[k];
			lazy[k * 2 + 2] += lazy[k]; lazy[k] = 0;
		}
		T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
	T query(int a, int b){ return query(a, b, 0, 0, n); }
	void add(int a, int b, ll v){ add(a, b, v, 0, 0, n); }
};
int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, len; cin >> n >> len;
	string s, t; cin >> s >> t;
	
	vi ans(n + 1);
	SegTree<int> seg(n + 2);
	rep(i, n){
		int best = inf;
		if(s[i] == t[i]) best = ans[i];
		if(i && t[i - 1] != t[i]) seg.add(0, i, 1);
		best = min(best, (seg.query(max(0, i + 1 - len), i + 1) + 1) / 2 + 1);
		
		seg.add(i + 1, i + 2, 2 * best);
		ans[i + 1] = best;
	}
	cout << ans[n] << endl;
	return 0;
}

Measured memory_bytes: 14696
#%%
n = int(input())
s = list(input())

lb, lw, rb, rw = 0, 0, s.count('#'), s.count('.')

ans = lb+rw
for i in range(n):
    if s[i] == '#':
        lb += 1
        rb -= 1
    else:
        lw += 1
        rw -= 1
    ans = min(ans, lb+rw)

print(ans)
    


Measured memory_bytes: 4840
def comb(val):
    if(val > 0):
        return int(val*(val-1) / 2)
    else:
        return 0
    
def make_map(balls):
    balls_map = {}
    for ball in balls:
        if(ball in balls_map):
            balls_map[ball] += 1
        else:
            balls_map[ball] = 1
    return balls_map

def main():
    args = input().rstrip().split(' ')
    N = int(args[0])
    balls = [val for val in input().rstrip().split(' ')]
    balls_map = make_map(balls)
    
    sum_ = 0
    for val in balls_map.values():
        sum_ += comb(val)
    for ball in balls:
        print(sum_ - (balls_map[ball]-1))
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 26636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        System.out.println(z + " " + x + " " + y);
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
bool bo[100];
#define ll long long 
#define mod 1000000007
int main()
{
	ll n;
	cin>>n;
	ll sum=1;
	for(ll i=1;i<=n;i++)
	{
		sum*=i;
		sum=sum%mod;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
import itertools

a = input()
b = input()
c = input()
d = input()
e = input()
l = map(int, [a, b, c, d, e])
ans = 1001001001
for i in itertools.permutations(l):
    *f, g = i
    h = 0
    for j in f:
        h += j
        while h%10 != 0: h += 1
    h += g
    ans = min(ans, h)
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

const int maxn = 100 + 5;
const int maxw = 10000 + 5;
int v[maxn];
int w[maxn];
int dp[maxw];

int main()
{
    int n, W;
    while (scanf("%d %d", &n, &W) != EOF)
    {
        for (int i = 1; i <= n; i++)
            scanf("%d %d", &v[i], &w[i]);

        memset(dp, 0, sizeof(dp));
        for (int i = 1; i <= n; i++)
            for (int j = W; j >= w[i]; j--)
            dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
        printf("%d\n", dp[W]);
    }
    return 0;
}



Measured memory_bytes: 3256
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
using namespace std;
#include <bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb(X) push_back(X)
#define x first
#define int long long
#define y second
#define all(x) (x).begin(), (x).end()
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
typedef long long ll;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef pair<int, int> pii;
//ll powmod(ll a,ll b) {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;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


const int INF = 1e9 + 7;
int _;

signed main() {
	INIT
	int n, k;
	cin >> n >> k;
	VI A(n);
	rep (i, 0, k) {
		cin >> A[i];
	}
	rep (i, k, n) {
		cin >> A[i];
		if (A[i] > A[i - k]) {
			cout << "Yes\n";
		} else {
			cout << "No\n";
		}
	}


	return 0;
}

Measured memory_bytes: 4780
n=int(input())
mod=10**9+7
ans=0
temp1=1
temp2=1
temp3=pow(2,n,mod)
for i in range(n-1):
    ans+=(((temp1*temp2)%mod)*(temp3%mod-2))%mod
    temp1=((temp1*(n-i))*pow(i+1,mod-2,mod))%mod
    temp2=(temp2*8)%mod
    temp3=pow(2,n-i-1,mod)
    

print(ans%mod)

Measured memory_bytes: 68228
S=list(input())

ans = [] #答え用意

for s in S:
  if s != 'B':
    ans.append(s) #末尾に要素追加
  elif len(ans) != 0: #長さ
    del ans[-1] #指定した位置(今回は末尾:-1)の要素を削除
    
print("".join(ans))

Measured memory_bytes: 61428
#                         author:  kagemeka 
#                         created: 2019-11-08 02:12:52(JST)
## internal modules
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## external modules
# import scipy.special   # if use comb function on AtCoder, 
# import scipy.misc      # select scipy.misc.comb (old version) 

def main():
    a, b = (int(x) for x in sys.stdin.readline().split())
    diff = b - a
    altitude = (1 + diff - 1) * (diff - 1) // 2 - a
    print(altitude)



if __name__ == "__main__":
    # execute only if run as a script
    main()


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

int N, A, B, C;

int dfs(vector<int> &l, int k, int a, int b, int c, int mp) {
    if (k >= l.size()) {
        if (!a || !b || !c) return INT_MAX;
        return mp + abs(A-a) + abs(B-b) + abs(C-c);
    }

    int ans = INT_MAX;
    ans = min(ans, dfs(l, k+1, a+l[k], b, c, mp+10));
    ans = min(ans, dfs(l, k+1, a, b+l[k], c, mp+10));
    ans = min(ans, dfs(l, k+1, a, b, c+l[k], mp+10));
    ans = min(ans, dfs(l, k+1, a, b, c, mp));
    return ans;
}

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

    cin >> N >> A >> B >> C;

    vector<int> l(N);
    for (int i=0; i<N; ++i) cin >> l[i];

    cout << dfs(l, 0, 0, 0, 0, 0) - 30 << endl;

    return 0;
}

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

int main() {
	// your code goes here
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,i,j,k;
	cin>>n;
	int dp[n][3];
	for(i=0;i<n;i++)
	{
		cin>>dp[i][0]>>dp[i][1]>>dp[i][2];
		if(i>0)
		{
			for(j=0;j<3;j++)
			{
				dp[i][j]=dp[i][j]+max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
			}
		}
	}

	cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
	
	
	return 0;
}


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

int main() {
    string s;
    cin >> s;
    rep(i,s.size())cout << "x" ;
    cout << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<(x)<<endl;
#define mod 1000000007
#define pb push_back
#define endl '\n'

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

	string s;
	cin>>s;
	for(auto &it:s)
	{
		it = 'x';
	}
	cout<<s<<endl;

	
	
	
	



}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5;
int f[N+10];
int sz[N+10];
int find(int x){
	return x==f[x]?x:f[x]=find(f[x]);
}
int merge(int u,int v){
	int uf=find(u);
	int vf=find(v);
	if(uf!=vf){
		sz[uf]+=sz[vf];
		sz[vf]=0;
		f[vf]=uf;
	}
	return sz[uf];
}
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)f[i]=i,sz[i]=1;
	int ans=1;
	while(m--){
		int a,b;
		cin>>a>>b;
		ans=max(ans,merge(a,b));
	}
	cout<<ans;
}

Measured memory_bytes: 5124
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
s = 0
for i in range(n):
  t = 0
  a = list(map(int, input().split()))
  for j in range(m):
    t += a[j] * b[j]
  if t + c > 0:
    s += 1
print(s)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long int
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
double find(double s) 
{ 
    // finding length 
    double length = s / 3; 
  
    s -= length; 
  
    // finding breadth 
    double breadth = s / 2; 
  
    // finding height 
    double height = s - breadth; 
  
    return length * breadth * height; 
} 
int main() {
	double n;
	cin>>n;
	cout<<fixed<<showpoint<<setprecision(6);
	cout<<find(n);






	return 0;
}

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

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

int main() {
	int a = -1, b = -1, c = -1;
	LL N, Y;
	cin >> N >> Y;
	for(int i:range(N+1))for (int j : range(N+1)) {
		int k = N - i - j;
		if (k < 0)continue;
		if (i * 10000 + j * 5000ll + k * 1000==Y) {
			a = i, b = j, c = k;
		}
	}
	cout << a << " " << b << " " << c << endl;
	return 0;
}


Measured memory_bytes: 256
n=int(input())
lc=list(input())
r=lc.count("R")
w=lc.count("W")

l=["R" for i in range(r)]+["W" for i in range(w)]

p=0
q=0
for i in range(r):
    if l[i]!=lc[i]:
        p+=1
for i in range(w):
    if l[r+i]!=lc[r+i]:
        q+=1
m=max(p,q)
print(min(m,r,w))


Measured memory_bytes: 93132
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i,n){
    cin >> p[i];
  }
  vector<int> q(n);
  rep(i,n){
    cin >> q[i];
  }

  vector<int> v(0);
  rep1(i,n){
    v.push_back(i);
  }

  int cnt=1;
  int a,b;
  do{
    bool fp = true;
    rep(i,n){
      if(p[i]!=v[i]){
	fp = false;
	break;
      }
    }
    if(fp) a=cnt;
    bool fq = true;
    rep(i,n){
      if(q[i]!=v[i]){
	fq = false;
	break;
      }
    }
    if(fq) b=cnt;
    cnt++;
  }while(next_permutation(v.begin(), v.end()));

  int ans = abs(a-b);
  cout << ans << "\n";
  
  return 0;
}


Measured memory_bytes: 256
//
//AtCoder Beginner Contest 141
//A - Weather Prediction
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    vector<string> ws;
    ws.push_back("Sunny");
    ws.push_back("Cloudy");
    ws.push_back("Rainy");
    
    string s;

    cin >> s;

    int idx = 0;
    REP(i, ws.size()){
        if(s==ws[i]) {
            idx = i + 1;
            if (idx>=ws.size()) idx=0;
            break;
        }
    }

    cout << ws[idx] << endl;

    return 0;
}


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

//#define getchar getchar_unlocked
//#define putchar putchar_unlocked
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define ff first
#define ss second
#define err stderr
#define out stdout

typedef long long int ll;
typedef long double ld;
typedef short int sh;

inline void readI(int *i)
{
	register int t=0;
	register char z=getchar();
	int znak=1;
	if (z=='-')
	{
		znak=-1;
	}
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
		if (z=='-')
		{
			znak=-1;
		}
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*i=(t*znak);
}
inline void readUI(int *i)
{
	register int t=0;
	register char z=getchar();
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*i=t;
}
inline void readL(ll *l)
{
	register ll t=0;
	register char z=getchar();
	int znak=1;
	if (z=='-')
	{
		znak*=-1;
	}
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
		if (z=='-')
		{
			znak=-1;
		}
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*l=(t*znak);
}
inline void readUL(ll *l)
{
	register ll t=0;
	register char z=getchar();
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*l=t;
}
inline void writeL(ll l)
{
	if (l==0)
	{
		putchar(48);
	}
	else
	{
		if (l<0)
		{
		   l*=-1;
		   putchar(45);
		}
		int _tab[21];
		int wsk=0;
		while (l>0)
		{
			++wsk;
			_tab[wsk]=(l%10)+48;
			l/=10;
		}
		for (int j=wsk; j>=1; --j)
		{
			putchar(_tab[j]);
		}
	}
}
inline void writeS(string s)
{
	int l=s.length();
	for (int i=0; i<l; ++i)
	{
		putchar(s[i]);
	}
}
inline void space()
{
	putchar(32);
}
inline void endl()
{
	putchar(10);
}

#define debug if(1)
#define debug2 if(1)
#define debug3 if(1)
#define debug4 if(1)
#define MAXN (int)(1e5)+5

int n, m, a, b, wynik;
vector <int> v[MAXN];
int d[MAXN];
bitset <MAXN> odw;

void dfs(int x)
{
	odw[x]=true;
	int l=v[x].size();
	for (int i=0; i<l; ++i)
	{
		if (!odw[v[x][i]])
		{
			dfs(v[x][i]);
		}
		d[x]=max(d[x], d[v[x][i]]+1);
	}
	wynik=max(wynik, d[x]);
}
int main()
{
	readUI(&n);
	readUI(&m);
	for (int i=1; i<=m; ++i)
	{
		readUI(&a);
		readUI(&b);
		v[a].eb(b);
	}
	for (int i=1; i<=n; ++i)
	{
		if (!odw[i])
		{
			dfs(i);
		}
	}
	fprintf (out, "%d\n", wynik);
	return 0;
}
/*
*/




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

int main()
{ 
  int n ;
  cin >> n ;
  if(n < 105)
  {
    cout << 0 << endl ;
    return 0 ;
  }
  else if(n == 105)
  {
    cout << 1 << endl ;
    return 0 ;
  }
  

  int answer = 1 ;
  for(int i = 106 ; i <= n ; i++)
  {
    if(i % 2 == 0)
    {
      continue ;
    }
    int count = 0 ;
    for(int j = 1 ; j <= i ; j++)
    {
      if(i % j == 0)
      {
        count++ ;
      }
    }

    if(count == 8)
    {
      //cout << i << endl ;
      answer++ ;
    }
  }

  cout << answer << endl ;
}


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

typedef long long ll;
typedef pair<int,int> P;
#define fr first
#define sc second

int n;
vector<P> G[100010];
int color[100010];
void dfs(int v,int p,int c){
	color[v] = c;
	for(int i = 0 ; i < G[v].size() ; i ++){
		if(G[v][i].fr == p)continue;
		dfs(G[v][i].fr,v,(c+G[v][i].sc)&1);
	}
}

int main(){
	scanf("%d",&n);
	for(int i = 0 ; i < n-1 ; i ++){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		G[u].push_back(P(v,w));
		G[v].push_back(P(u,w));
	}
	dfs(1,0,0);
	for(int i = 1 ; i <= n ; i ++){
		printf("%d\n",color[i]);
	}
}

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

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

        static void Solve()
        {
            var (N, M) = Slice2<long>();
            var Ai = Sarray();
            var BC = new (long B, long C)[M];
            for (var i = 0; i < M; ++i)
                BC[i] = Slice2<long>();
            Array.Sort(Ai);
            Array.Sort(BC, (l, r) => l.C.CompareTo(r.C)); Array.Reverse(BC);
            for (long i = 0, j = 0; i < N && j < M; ++j)
            {
                for (var k = 0; k < BC[j].B && i < N; ++k)
                    Ai[i] = Max(Ai[i++], BC[j].C);
            }
            WriteLine(Ai.Sum());
        }

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

Measured memory_bytes: 51272
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
#define Maxn 500010
int head[Maxn],v[Maxn],nxt[Maxn],tot=0;
int ans[Maxn],in[Maxn];
char c[Maxn];
int Q[Maxn],hd,tl;

inline void add_edge(int s,int e){
	tot++;v[tot]=e;nxt[tot]=head[s];head[s]=tot;
    in[e]++;
}

int main(){
	scanf("%s",c+1);
	n=strlen(c+1)+1;
	for(int i=1;i<n;++i)
	    if(c[i]=='<')add_edge(i,i+1);
	    else add_edge(i+1,i);
	for(int i=1;i<=n;++i)
	    if(!in[i]){
	    	Q[tl++]=i;
	    	ans[i]=-1;
		}
	long long sum=0;
	while(hd<tl){
		int u=Q[hd];
		hd++;
		ans[u]++;
		sum+=ans[u];
		for(int i=head[u];i;i=nxt[i]){
			in[v[i]]--;
			ans[v[i]]=max(ans[v[i]],ans[u]);
		    if(!in[v[i]])Q[tl++]=v[i];
	    }
	}
	printf("%lld\n",sum);
	return 0;
} 

Measured memory_bytes: 12416
//I Guds namn
#include <iostream>
#include <string>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	string s; cin >> s;
	char ch;
	int pos, ans = 1000, cans = 1000, n = s.size();
	for(int i = 0;i < 26;i++)
	{
		ch = (char)('a' + i);
		pos = -1;
		cans = 0;
		for(int j = 0;j < s.size();j++)
			if(s[j] == ch)
			{
				cans = max(cans, j - pos - 1);
				pos = j;
			}
		cans = max(cans, n - 1 - pos);
		ans = min(ans, cans);
	}
	cout << ans << endl;
	return 0;
}

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

//    int n=132;
//    bitset<16>binar(n);
//    int a = bitset<16>(binar).to_ulong();
//    cout<<a;

#define int long long
#define pb push_back
#define rep(i,a,b) for ( int i = a; i < b; i++)
#define all(c) (c).begin(),(c).end()

using namespace std;

signed main()
{
   int x;
   cin>>x;
   int P=100;
   int A=0;
   while(P<x){
   	P = P+(P/100);
   	A++;
   }
   cout<<A;
}
        
        
    

    





Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,r;
    cin >>n>>r;
    if(n<10) cout <<r+(100*(10-n))<<'\n';
    else cout <<r<<'\n';
    return (0);
}


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

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define V vector<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>


int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int n, m;      cin >> n >> m;
	vector<set<int>>  edge(n);
    REP(i, m){
      int a, b;  cin >> a >> b;
      edge[a-1].insert(b-1);
      edge[b-1].insert(a-1);
    }

    ll ans = 0;
    vector<int>  node(n);  REP(i, n)  node[i] = i;
    do{
      	bool flag = true;
      	for(int i = 0 ; i < n-1 ; i++)
          if(edge[node[i]].count(node[i+1]) != 1){  flag = false;  break;  }
      	
      	if(flag)  ans++;
    }while(next_permutation(node.begin(), node.end()) && node[0] == 0);

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


Measured memory_bytes: 256