akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main() {
	int N = 0;
	int K = 0;
	cin >> N;
	cin >> K;

	int curr = 1;
	int ansA;
	int ansB;
	for (int i = 0; N > i; i++) {
		ansA = curr * 2;
		ansB = curr + K;
		curr = (ansA > ansB) ? ansB : ansA;
	}

	cout << curr << endl;
	
	return 0;
}


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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

const int MAX = 510000;
const int P = 1000000007; //shuoud be prime

long long fac[MAX], finv[MAX], inv[MAX];

void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % P;
        inv[i] = P - inv[P%i] * (P / i) % P;
        finv[i] = finv[i - 1] * inv[i] % P;
    }
}

long long COMB(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % P) % P;
}

int N, M;
int A[100002] = {0};

long long calc(int s, int e){
	if(e - s <= 1){
		return 1;
	}
	if(e - s == 2){
		return 2;
	}
	long long ret = 1;
	int c = (e - s)/2;
	for(int k=1; k<=c; k++){
		ret += COMB(e - s - k, k);
		ret = ret % P;
	}
	ret = ret % P;
	return ret;
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> M;
	for(int i=1; i<=M; i++){
		cin >>A[i];
		if(i > 1 && A[i] == A[i-1]+1){
			cout << "0" << endl;
			return 0;
		}
	}
	A[M+1] = N+1;
	A[0] = 0;

	COMBinit();
	long long ans = 1;
	ans = calc(0, A[1]-1);
	for(int i=1; i<=M; i++){
		ans *= calc(A[i]+1, A[i+1]-1);
		ans = ans % P;
	}
	ans = ans % P;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12416
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#include <queue>
#define ll long long
#define MAX 25 * 1e13

using namespace std;
int MOD = 1000000007;
int h,w;
vector<string> maze( 40 );
vector<vector<int>> has(30,vector<int> (30));
vector<vector<int>> dist(30,vector<int> (30));

int movex[] = {-1,1,0,0};
int movey[] = {0,0,-1,1};
int maxv = 0;
int bfs( int x , int y , int len ){
    // maxv = max( maxv , len);
    
    queue<vector<int>> q;
    has[x][y] = 1;
    q.push({x,y});
    while( !q.empty()){
        auto pa = q.front();
        q.pop();
        int x = pa[0];
        int y = pa[1];
        
        //q.pop();
        for( int i = 0 ; i < 4 ; i++ ){
            int nx = x + movex[i];
            int ny = y + movey[i];
            if( nx >= 0 && nx < h && ny >= 0 && ny< w ){
                if( maze[nx][ny] == '.' && has[nx][ny] == 0 ){
                    has[nx][ny] = 1;
                    dist[nx][ny] = dist[x][y] + 1;
                    maxv = max(maxv,dist[nx][ny]);
                    q.push({nx,ny});
                }
            }
        }
    }
    return 0;
}
int main(){
    cin >> h >> w;
    for(int i = 0 ; i < h ; i++ ){
        cin >>  maze[i];
    }
    
    for(int i = 0 ; i < h ; i++ ){
        for(int j = 0 ; j < w ; j++){
            if( maze[i][j] == '.'){
                // init has
                for( int k = 0 ; k < h ; k++ ){
                    for( int l = 0 ; l < w ; l++ ){
                        has[k][l] = 0;
                        dist[k][l]  = 0;
                    }
                }
                bfs(i,j,0);
                //cout << "complete " << i << " " << j << endl;
            }
        }
    }
    cout << maxv << endl;
    return 0;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MN = 2010;
const ll MOD = 1000000007;

ll comb[MN][MN];
ll psum[MN][MN], psum2[MN][MN];

void init() {
	rep(i, MN) {
		comb[i][0] = comb[i][i] = 1;
		for (int j = 1; j < i; ++j) {
			comb[i][j] = (comb[i-1][j-1] + comb[i-1][j]);
			if (comb[i][j] >= MOD) comb[i][j] -= MOD;
		}
	}

	rep(i, MN) {
		rep(j, MN-1) {
			psum[i][j+1] = (psum[i][j] + comb[i][j]) % MOD;
			psum2[i][j+1] = (psum2[i][j] + psum[i][j+1]) % MOD;
		}
	}
}

int main() {
	int A, B; cin >> A >> B;
	init();

	ll ans = 0;

	for (int a = 0; a <= A; ++a) {
		for (int b = 0; b < B; ++b) {
			if (a + b > A) continue;

			ll p = 0;
			if (b == 0) {
				p = 1;
			} else {
				int t = min(a, b-1);
				p = psum2[b-1][t+1];
				if (a >= b) {
					p = (p + psum[b-1][b] * (a - b + 1)) % MOD;
				}
/*
				for (int c = 0; c <= a; ++c) {
					for (int d = 0; d <= min(c, b-1); ++d) {
						p += comb[b-1][d];
						p %= MOD;
					}
				}
				*/
			}

			ll q = comb[B-1][b];

		//	cerr << a << " " << b << " " << p << " " << q << endl;
			ans = (ans + p * q) % MOD;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 94976
size = 3
A_list = [[]] * size
A_list[0] = list(map(int, input().split(' ')))
A_list[1] = list(map(int, input().split(' ')))
A_list[2] = list(map(int, input().split(' ')))
N = int(input())
b_list = [int(input()) for _ in range(N)]
bingo_flag = False
for i in range(size):
    count = 0
    for j in range(size):
        if A_list[i][j] in b_list:
            count += 1
        else:
            break
    if count == size:
        bingo_flag = True
        break
if not bingo_flag:
    for j in range(size):
        count = 0
        for i in range(size):
            if A_list[i][j] in b_list:
                count += 1
            else:
                break
        if count == size:
            bingo_flag = True
            break
if not bingo_flag:
    count = 0
    for i in range(size):
        if A_list[i][i] in b_list:
            count += 1
        else:
            break
    if count == 3:
        bingo_flag = True
if not bingo_flag:
    count = 0
    for i in range(size):
        j = size - 1 - i
        if A_list[i][j] in b_list:
            count += 1
        else:
            break
    if count == size:
        bingo_flag = True
if bingo_flag:
    print('Yes')
else:
    print('No')




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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a[3];
	for(int i = 0; i < 3; i++){
		cin >> a[i];
	}
	int k;cin >> k;
	bool flag = false;
	for(int i = 0; i <= k; i++){
		for(int j = 0; i+j <= k; j++){
			int l = k-j-i;
			int tmpa[3];
			for(int m = 0; m < 3; m++){
				tmpa[m] = a[m];
			}
			for(int m = 0; m < i; m++){
				tmpa[0] *= 2;
			}
			for (int m = 0; m < j; m++){
				tmpa[1] *= 2;
			}
			for (int m = 0; m < l; m++){
				tmpa[2] *= 2;
			}
			if(tmpa[0] < tmpa[1] && tmpa[1] < tmpa[2]){
				flag = true;
				break;
			}
		}
	}
	cout << (flag?"Yes":"No") << endl;
	return 0;
}


Measured memory_bytes: 3604
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

ll n, k, ans, l[100];

int main() {
	cin >> n >> k;
	repi(i, 0, n) rd(l[i]);
	sort(l, l + n);
	reverse(l, l + n);
	repi(i, 0, k) ans += l[i];
	wrln(ans);
	return 0;
}

Measured memory_bytes: 256
import Data.List
main = interact $ unlines . map (show' . is_convex . map (read::String->Float) . splitOn ',') . lines
 where show' p = case p of {True -> "NO"; False -> "YES"}

splitOn c xs
 | null xs = []
 | head xs == c = splitOn c (tail xs)
 | otherwise = (takeWhile (/= c)) xs : splitOn c (dropWhile (/= c) xs)

point_in_a_triangle (x1,y1) (x2,y2) (x3,y3) (xp,yp) =
 (compare ((x3-x1)*d12+y1) y3 == compare ((xp-x1)*d12+y1) yp) &&
 (compare ((x1-x2)*d23+y2) y1 == compare ((xp-x2)*d23+y2) yp) &&
 (compare ((x2-x3)*d31+y3) y2 == compare ((xp-x3)*d31+y3) yp)
  where
   d12 = (y2-y1)/(x2-x1)
   d23 = (y3-y2)/(x3-x2)
   d31 = (y1-y3)/(x1-x3)

is_convex [xa,ya,xb,yb,xc,yc,xd,yd] = 
 point_in_a_triangle (xa,ya) (xb,yb) (xc,yc) (xd,yd) ||
 point_in_a_triangle (xb,yb) (xc,yc) (xd,yd) (xa,ya) ||
 point_in_a_triangle (xc,yc) (xd,yd) (xa,ya) (xb,yb) ||
 point_in_a_triangle (xa,yd) (xa,ya) (xb,yb) (xc,yc)

Measured memory_bytes: 4256
program name
    implicit none
    integer(4):: n
    integer(4):: i,j
    integer(4):: ai, aj, fst, lst, mdl
    integer(8):: cnt
    integer(4),allocatable:: l(:)

    read*, n
    allocate(l(n))
    read*, l(:)

    call merge_sort(l,1,n)
    cnt = 0
    do i=1,n-2
        ai = l(i)
        do j=i+1,n-1
            aj = l(j)
            if (l(j+1) >= ai+aj) cycle
            if (l(n) < ai+aj) then
                cnt=cnt+(n-j)
                cycle
            end if

            fst = j+1
            lst = n
            do while(lst-fst > 1)
                mdl = (fst+lst)/2
                if (l(mdl) < ai+aj) then
                    fst = mdl
                else
                    lst = mdl
                end if
            end do
            cnt=cnt+fst-j
        end do
    end do
    print*, cnt
    
contains
subroutine swap(x,y)
    integer(4),intent(inout):: x,y
    integer(4):: tmp
    tmp=x
    x=y
    y=tmp
end subroutine


recursive subroutine merge_sort(ar, fst, lst)
    integer(4),intent(inout):: ar(:)
    integer(4), intent(in):: fst,lst
    integer(4):: mdl

    if (lst - fst <= 1) then
        if (ar(fst) > ar(lst)) call swap(ar(fst), ar(lst))
        return
    end if

    mdl = (fst+lst)/2
    call merge_sort(ar,fst,mdl)
    call merge_sort(ar,mdl+1,lst)
    call merge_(ar,fst,mdl,lst)
end subroutine


subroutine merge_(ar,fst,mdl,lst)
    integer(4),intent(inout):: ar(:)
    integer(4),intent(in):: fst, mdl, lst
    integer(4),allocatable:: tmp(:)
    integer(4):: li, ri, ti

    allocate(tmp(lst-fst+1))
    li=fst
    ri=mdl+1
    ti=1

    do while(li <= mdl .and. ri <= lst)
        if (ar(li) <= ar(ri)) then
            tmp(ti) = ar(li)
            li=li+1
        else
            tmp(ti) = ar(ri)
            ri=ri+1
        end if
        ti=ti+1
    end do
    
    if (li <= mdl) then
        tmp(ti:) = ar(li:mdl)
    else
        tmp(ti:) = ar(ri:lst)
    end if

    ar(fst:lst) = tmp(:)
    deallocate(tmp)
end subroutine
end program name

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll INF=1LL<<60;
const ll MOD=1e9+7;

int main(){
    int N; cin >> N;
    ll res=0;
    for(int i=1; i<=N; i++){
        int a, b=i;
        a=i%10;
        while(b >= 10) b/=10;
        if(a == 0) continue;
        if(a == b) res++;
        int val=10*(a+1), c=0;
        while(val-10+b <= N){
            res+=(ll)pow(10, c);
            val*=10;
            c++;
        }
        for(int j=val/(a+1)*a+b; j<=N; j+=10){
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

static const ll INF = 1e17;

ll dp[200005][4];

int main(){
  int N;
  cin >> N;
  vector<ll> v;
  rep(i,N){
    ll a;
    cin >> a;
    v.push_back(a);
  }

  rep(i,200005){
    rep(j,4){
      dp[i][j] = -INF;
    }
  }

  dp[0][0] = 0;

  int K = N%2 + 1;
  rep(i,N){
    rep(j,K+1){
      // xを1つ挿入
      dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]);
      // oまたはxを挿入
      if((i+j)%2 == 0){
        dp[i+1][j] = max(dp[i+1][j], dp[i][j] + v[i]);
      }else{
        dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
      }
    }
  }
  
  cout << dp[N][K] << endl;
  return 0;
}


Measured memory_bytes: 11128
#include<stdio.h>
int main(){
  int n,x,t,answer=0,i,counter=0;
  scanf("%d %d %d",&n,&x,&t);
  while(n-x>=0){
      n=n-x;
      counter=counter+1;
    }
  if(n>0){
    counter=counter+1;
  }
  answer=t*counter;
  printf("%d",answer);
  return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    string str,ptr;
    cin>>str>>ptr;
    int mx=1e9;
    for(int i=0; i<=str.size()-ptr.size(); i++)
    {
        int cnt=0;
        int x=i;
        for(int j=0; j<ptr.size(); j++)
        {
            if(x<str.size() && str[x]==ptr[j])
            {

            }
            else
            {
                cnt++;
            }
            x++;

        }

        mx=min(cnt,mx);
    }
    cout<<mx<<endl;



}


Measured memory_bytes: 3604
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0028
{
    class Program
    {
        static void Main(string[] args)
        {
            string rstr = Console.ReadLine();

            int N = int.Parse(rstr.Split(' ')[0]);
            int K = int.Parse(rstr.Split(' ')[1]);

            rstr = Console.ReadLine();

            var Nums = rstr.Split(' ');

            int result = 0;

            for (int i = 0; i < Nums.Length; i++)
            {
                if(K <= int.Parse(Nums[i]))
                {
                    result++;
                }
            }

            Console.WriteLine(result);
        }
    }
}


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

int main() {
  long double a, b,c;
  cin >> a >> b >> c;
  long double eps = 1.0E-14;
  if(sqrt(a) + sqrt(b) + eps < sqrt(c)) puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (((ll)1<<31)-1)
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
int n;
string s;
int a[26];
int dp[26];
signed main(){
	cin>>n>>s;
	rep(i,n){
		a[s[i]-'a']++;
	}
	int ans=1;
	rep(i,26){
		ans*=(a[i]+1);
		ans%=moder;
	}
	cout<<ans-1<<endl;
	return 0;
}

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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 11;

int n, m;
char s[MAXN][MAXN];
bool okr[MAXN][MAXN], okc[MAXN][MAXN], dp[MAXN][MAXN];

void init ();
void input ();
void work ();



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here
	
	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method
	
	scanf ( "%d%d", &n, &m );
	lpi ( i, 1, n ) scanf ( "%s", s[i]+1 );
}

void work ()
{
	// main work
	
	lpi ( i, 1, n ) okr[i][0] = true;
	lpi ( i, 1, m ) okc[0][i] = true;
	lpi ( i, 1, n ) lpi ( j, 1, m ) okr[i][j] = okr[i][j-1] & ( s[i][j] == '.' ), okc[i][j] = okc[i-1][j] & ( s[i][j] == '.' );
	
	dp[1][1] = true;
	lpi ( i, 1, n ){
		lpi ( j, 1, m ){
			if ( dp[i][j] ){
				if ( i < n && okr[i+1][j-1] ) dp[i+1][j] = true;
				if ( j < m && okc[i-1][j+1] ) dp[i][j+1] = true;
			}
		}
	}
	
	cout << ( dp[n][m] ? "Possible\n" : "Impossible\n" ) << endl;
}

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

int n,k;
int main(){
    cin >> n >> k;
    multiset<long long> h;
    long long sum=0;
    vector<long long> H(n);
    for(int i=0;i<n;i++) cin >> H[i];
    if(n<=k){
        cout << 0 << endl;
        return 0;
    } 
    for(int i=0;i<n;i++) h.insert(H[i]);
    auto itr = h.begin();
    for(int i=0;i<n-k;i++){
        sum += *itr;
        itr++;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define INF 1000000000
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	string s;
	cin>>s;
	int a=s[0]-48,b=s[1]-48,c=s[2]-48,d=s[3]-48;
	if(a+b+c+d==7)cout<<a<<"+"<<b<<"+"<<c<<"+"<<d;
	else if(a-b-c-d==7)cout<<a<<"-"<<b<<"-"<<c<<"-"<<d;
	else if(a+b+c-d==7)cout<<a<<"+"<<b<<"+"<<c<<"-"<<d;
	else if(a+b-c-d==7)cout<<a<<"+"<<b<<"-"<<c<<"-"<<d;
	else if(a+b-c+d==7)cout<<a<<"+"<<b<<"-"<<c<<"+"<<d;
	else if(a-b+c+d==7)cout<<a<<"-"<<b<<"+"<<c<<"+"<<d;
	else if(a-b+c-d==7)cout<<a<<"-"<<b<<"+"<<c<<"-"<<d;
	else cout<<a<<"-"<<b<<"-"<<c<<"+"<<d;
	
	cout<<"=7"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdint>
#include <iostream>

using namespace std;

uint32_t comb(uint32_t n, uint32_t s, uint32_t i, uint32_t k, uint32_t sum) {
  if (k == 0 && s == sum) {
    return 1;
  } else if (i > n || k == 0) {
    return 0;
  } else {
    return comb(n, s, i + 1, k, sum) + comb(n, s, i + 1, k - 1, sum + i);
  }
}

int32_t main() {
  while (true) {
    uint32_t n, k, s;
    cin >> n >> k >> s;
    if (n == 0) break;
    cout << comb(n, s, 1, k, 0) << endl;
  }

  return 0;
}

Measured memory_bytes: 3068
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

double heron(double i, double j, double k){
    double s = (i+j+k)/2;
    return sqrt(s * (s-i) * (s-j) * (s-k));
}

int main(){
    int a, l, x;
    while(cin >> a >> l >> x){
        cout << fixed << setprecision(10) << heron(a,l,l) + 2*heron(l, (l+x)/2.0, (l+x)/2.0) << endl;
    }
    return 0;
}


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x, a, b; cin >> x >> a >> b;
  cout << (abs(x-a)<abs(x-b) ? 'A' : 'B') << "\n";
  return 0;
}


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

#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

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

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int n,m;
    cin>>n>>m;


    cout<<n*m<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

ll n;
ll a, b, c, d;  
map<ll, ll> memo;

ll f(ll x){
    if(!x)  return 0;
    if(x==1) return d;
    if(memo.count(x)) return memo[x];
    ll res = LINF;
    
    //x*d<LINFの場合は更新
    if(x < LINF/d) res = x*d;
    //切り捨てしてからかけて左右を求める
    ll l2 = (x/2)*2;
    ll r2 = ((x+1)/2)*2;
    ll l3 = (x/3)*3;
    ll r3 = ((x+2)/3)*3;
    ll l5 = (x/5)*5;
    ll r5 = ((x+4)/5)*5;
    res = min(res, labs(x-l2)*d+a+f(l2/2));
    res = min(res, labs(x-r2)*d+a+f(r2/2));
    res = min(res, labs(x-l3)*d+b+f(l3/3));
    res = min(res, labs(x-r3)*d+b+f(r3/3));
    res = min(res, labs(x-l5)*d+c+f(l5/5));
    res = min(res, labs(x-r5)*d+c+f(r5/5));
    return memo[x] = res;

}




int main(){
    int t;  cin >> t;
    REP(T, t){
        cin >> n;
        cin >> a >> b >> c >> d;
        
        
        memo = map<ll, ll>();
        
        cout << f(n) << endl;
    }

}


Measured memory_bytes: 4296
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define double long double
#define minheapair priority_queue<pair<int,int>, vector<pair<int,int>> , greater<pair<int,int>> >
#define maxheapair priority_queue<pair<int,int>>
#define minheap priority_queue<int,vector<int>,greater<int>>
#define vi vector<int>
#define vpi vector<pair<int,int> >
#define mii map<int,int>
#define mpi map<pair<int,int>,int>
#define msi map<string,int>
#define set set<int>
#define u_set unordered_set<int>
#define pb push_back
#define endl "\n"
#define ll long long int
#define vll vector<long long int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define umap unordered_map
#define mod 1000000007
#define fori(a,n) for(int i=a;i<n;i++)
#define forj(a,n) for(int j=a;j<n;j++)
// #define MAX 300303
#define V vector
#define inf 9219999999999999999
using namespace std;
//  inline bool operator<(const data& lhs, const data& rhs)
//  {
//      if(lhs.val< rhs.val)return 1;
//      return 0;
//  }
// inline bool operator>(const data& lhs, const data& rhs)
//  {
//      if(lhs.val > rhs.val)return 1;
//      return 0;
//  }
ll modexp(ll x,ll y,ll m){
    ll ans = 1;
    while(y>0){
        if(y&1){
            ans *= x;
            ans %= m;
            --y;
        }
        else{
            y /= 2;
            x *= x;
            x %= m;
        }
    }
    return ans;
}
ll minv(ll a,ll m){
    return modexp(a,m-2,m);
}
void Z(string s,vector<int>&z){
    int L = 0, R = 0;
    int n = s.size();
    for (int i = 1; i < n; i++) 
    {
        if (i > R) 
        {
            L = R = i;
            while (R < n && s[R-L] == s[R]) 
            {
                R++;
            }
            z[i] = R-L; 
            R--;
        } 
        else 
        {
            int k = i-L;
            if (z[k] < R-i+1) 
            {
                z[i] = z[k];
            } 
            else 
            {
                L = i;
                while (R < n && s[R-L] == s[R]) 
                {
                    R++;
                }
                z[i] = R-L; 
                R--;
            }
        }
    }
}

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
class comp{
    public:
    bool operator () (pair<ll,ll>a,pair<ll,ll>b){return 1LL*a.first*a.second <= 1LL*b.first*b.second;}
};
using namespace std;

int main() {
    io
    int tt = 1;
    // cin>>tt;
    while(tt--){
        ll n,x;
        ll mx = 0;
        ll ans = 0;
        cin>>n;
        for(int i=0;i<n;++i){
            cin>>x;
            x<mx?ans += mx-x:0==0;
            mx = max(mx,x);
        }
        cout<<ans<<endl;
    }
}
/*
1                                 
7  
1 2
1 3  
2 4
2 5
3 6
3 7
0010010
*/










Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		int R = s.nextInt();
		int G = s.nextInt();
		System.out.println(2*G-R);
		
	}

}

Measured memory_bytes: 23252
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    println!("{}",if a%1000%111==0||a/10%111==0{"Yes"}else{"No"})
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int mod=1e9+7;
int main() {
	int N;
   cin>>N;
   vector<ll> m(26,1);
   string S;
   cin>>S;
   ll count=1;
   
   for(int i=0;i<N;i++){
      m.at(S.at(i)-'a')++;
   }
 for(int i=0;i<26;i++){
    count*=m.at(i);
    if(count>=mod){
      count%=mod;
    }
 }
 count--;
 cout<<count<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    int N;
    cin >> N;
    map<int,int> A;
  
    
    for (int i = 2; i <= N; i++) {
        int n = i;
        for (auto p : A) {
            while (n%p.first == 0) {
                A[p.first]++;
                n/=p.first;
            }
        }
        if(n != 1) A[n] = 1;
    }
    
    
  
    
    ll ans = 1;
    const ll mod = 1000000007;
    for (auto p : A) {
        ans *= (p.second+1);
        ans %= mod;
    }
    
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (ll i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    int N;
    cin >> N;
    int ans = 0;
    vector<int> d(N);
    rep(i, N){
        cin >> d[i];
    }
    for(int i=0; i<N-1; ++i){
        for(int j=i+1; j<N; ++j) ans += d[i]*d[j];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from collections import Counter

MOD = 998244353

N = int(input())
Ds = list(map(int, input().split()))

if Ds[0] != 0 or min(Ds[1:]) == 0:
    print(0)
    sys.exit()

cnt = Counter(Ds)

ans = 1
for d in range(1, max(Ds)+1):
    if cnt[d] == 0:
        ans = 0
        break
    ans *= pow(cnt[d-1], cnt[d], MOD)
    ans %= MOD

print(ans)


Measured memory_bytes: 19936
#include<cstdio>
using namespace std;
int main(){
    int n;
    while(~scanf("%d",&n)){
        int i,x;
        int ans,con,z;
        ans=con=z=0;
        for(i=0;i<n;i++){
            scanf("%d",&x);
            if(x%4==0) con++;
            else if(x%2==0) ans++;
            else if(x%2) z++;
        }
//        printf("%d %d %d\n",ans,con,z);
        if(ans%2+z>con+1) printf("No\n");
        else printf("Yes\n");
    }
return 0;}


Measured memory_bytes: 128
import Control.Monad
import Control.Monad.ST
import Control.Applicative
import Data.List
import Data.STRef
import qualified Data.Vector.Mutable as MVector

data Operation a = PushBack a | RandomAccess a | PopBack

showOp :: Operation Int -> String
showOp op =
    case op of
    PushBack x -> "PushBack " ++ (show x)
    RandomAccess p -> "RandomAccess " ++ (show p)
    PopBack -> "PopBack"

runOperation :: [Operation Int] -> [Int]
runOperation ops = runST $ do
    idx <- newSTRef 0
    vec <- MVector.new (length ops)
    res <- newSTRef []
    forM_ ops (\op ->
        case op of
        PushBack x -> do
            i <- readSTRef idx
            MVector.write vec i x
            writeSTRef idx (i + 1)
        RandomAccess p -> do
            rs <- readSTRef res
            val <- MVector.read vec p
            writeSTRef res (val : rs)
        PopBack -> do
            i <- readSTRef idx
            writeSTRef idx (i - 1))
    rs <- readSTRef res
    return (reverse rs)

-- reads an Operation, input i is dummy.
readOperation :: Int -> IO (Operation Int)
readOperation i = do
    opStr <- getLine
    let opList = (map read (words opStr)) :: [Int]
    let op = case (head opList) of
                0 -> PushBack (opList !! 1)
                1 -> RandomAccess (opList !! 1)
                _ -> PopBack
    return op

readOperations :: IO [Operation Int]
readOperations = do
    qStr <- getLine
    let q = read qStr :: Int
    ops <- mapM (\i -> readOperation i) [1..q]
    return ops

main = do
    ops <- readOperations
    let res = runOperation ops
    forM_ res print



Measured memory_bytes: 192836
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    int l = 101,r = 1;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        l = min(l,a[i]);
        r = max(r,a[i]);
    }
    long ans = 10e9 + 1;
    for(int i = l;i <= r;i++){
        long cost = 0;
        for(int j = 0;j < n;j++){
            cost += (a[j] - i) * (a[j] - i);
        }
        ans = min(ans,cost);
    }
    cout << ans << endl;
}


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

using namespace std;


int main()
{
   int n,sum=0;
   cin>>n;
   int t[n],x[n],g[n];
   for(int i=1;i<=n;i++)
        {cin>>t[i];
        x[i]=i;}
         for(int i=1;i<=n;i++)
        {
            g[i]=t[i];
        }

   int m;
   cin>>m;
   int p[m];
   int a[m];
   for(int i=1;i<=m;i++)
   {
       cin>>p[i]>>a[i];
   }
   for(int i=1;i<=m;i++)
   {
       for(int j=1;j<=n;j++)
       {
           if(p[i]==x[j])
            {
                t[j]=a[i];
              for(int i=1;i<=n;i++)
             sum+=t[i];

             cout<<sum<<endl;
             sum=0;
             t[j]=g[j];
            }
       }


   }

     return 0;
}


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

int main(){
    int n; cin >> n;
    vector<int> l;
    for(int i=0;i<n;i++){
        int li;
        cin >> li;
        l.push_back(li);
    }
    sort(l.begin(),l.end());
    int max = l[n-1];
    int su = accumulate(l.begin(),l.end(),0);

    if(max<(su-max)){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

def main():
    N, A, B = map(int, readline().rstrip().split())
    X = list(map(int, readline().rstrip().split()))
    res = 0
    for i in range(N-1):
        res += min((X[i+1] - X[i]) * A, B)
    
    print(res)

if __name__ == '__main__':
    main()

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

using namespace std;

int n;
int arr[100];

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int joining = sc.nextInt();
		int displayRating = sc.nextInt();

		if(joining < 10 ){
			int result = 100*(10-joining);
			int results01 = displayRating + result;
			System.out.println(results01);
		}else{
			System.out.println(displayRating);
		}
		sc.close();
		}
  }

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

using namespace std;

typedef long long ll;

int n, m;
bool vis[10];
vector<vector<int>> eg(10);
int ans;

void dfs(int v){
	vis[v] = true;

	bool ok = false;
	for(auto x : eg[v]){
		if(!vis[x]){
			ok = true;
			dfs(x);
		}
	}

	if(!ok){
		ok = true;
		for(int i=1; i<=n; i++)
			if(!vis[i]){
				ok = false;
				break;
			}
		if(ok)
			ans++;
	}

	vis[v] = false;
}

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for(int i=0, x, y; i<m; i++){
		cin >> x >> y;
		eg[x].push_back(y);
		eg[y].push_back(x);
	}
	dfs(1);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(void)
{
	long long int a, b,c,d;
	long long int lc, ld,min;
	long long int count = 0;
	long long int count2 = 0;
	cin >> a >> b>>c>>d;
	count = b / c;
	count = count + b / d;
	//cとdの最小公倍数の判定
	long long int lci=1;
	long long int ldi = 1;
	lc = c;
	ld = d;
	while (1)
	{
		
		if (lc < ld)
		{
			lci++;
			lc = c * lci;
		}
		else if (lc == ld)
		{
			min = lc;
			break;
		}
		else if (lc > ld)
		{
			ldi++;
			ld = d * ldi;
		}

}
	count = count - b / min;
	count2 = (a - 1) / c;
	count2 = count2 + (a - 1) / d;
	count2 = count2 - (a - 1) / min;
	count = b - count;
	count2 = a-1 - count2;
	count = count - count2;
	cout << count << endl;
	
	return 0;

}


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

#define ll long long
#define ull unsigned long long

using namespace std;

const ll INF = 100100100100;

int main() {
	ll N, C;
	cin >> N >> C;

	vector<vector<ll>> D(C, vector <ll> (C));
	for (int ii = 0; ii < C; ++ii){
		for (int jj = 0; jj < C; ++jj){
			cin >> D[ii][jj];
		}
	}

	//3クラスそれぞれに対してカウンタを計算
	vector<vector<ll>> cnt(3, vector <ll> (C));
	for (int ii = 0; ii < N; ++ii){
		for (int jj = 0; jj < N; ++jj){
			ll c;
			cin >> c;
			c--;
			ll idx = (ii+jj)%3;
			cnt[idx][c]++;
		}
	}

	ll ans = INF;
	for (int ii = 0; ii < C; ++ii){	//マス1の色
		for (int jj = 0; jj < C; ++jj){	//マス2の色
			for (int kk = 0; kk < C; ++kk){	//マス3の色
				if ( (ii==jj) || (jj==kk) || (kk==ii) ) continue;
				ll score = 0;
				for (int c = 0; c < C; ++c){
					score += cnt[0][c]*D[c][ii];
					score += cnt[1][c]*D[c][jj];
					score += cnt[2][c]*D[c][kk];
				}
				ans = min(ans, score);
			}
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  int h[n],c[n],i;
  for(i=0;i<n;i++)
    cin >> h[i];
  c[0]=0;c[1]=abs(h[0]-h[1]);
  for(i=2;i<n;i++)
  {
    c[i]=min(abs(h[i]-h[i-1])+c[i-1],abs(h[i]-h[i-2])+c[i-2]);
  }
  cout<<c[n-1];
}

Measured memory_bytes: 1024
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline


def main():
    n, k = map(int, input().split())
    l = list(map(int, input().split()))

    l.sort(reverse=True)

    ans = 0
    for i in range(k):
        ans += l[i]

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
const int INF = 1e9;
const int MODk = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define COUTDOUBLE(v) cout << std::setprecision(10)<<(v)<<endl;
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#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;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl
#define f first
#define s second

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};




int main(){
    LCIN(X);
    LL ans = X/(6+5)*2;
    if(X%(11) > 6){
        ans +=2;
    }else if(X%11 != 0){
        ans += 1;
    }
    COUT(ans);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

//AtCoder Beginner Contest 153
//B - Common Raccoon vs Monster
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = Integer.parseInt(sc.next());
		int N = Integer.parseInt(sc.next());
		long sumA = 0;
		for (int i = 0; i < N; i++) {
			sumA += Integer.parseInt(sc.next());
		}
		sc.close();

		if (H <= sumA) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 44864
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto ma = 10^^5;
  auto p = primes(10^^5);

  auto b = new bool[](ma+1);
  foreach (pi; p) b[pi] = true;

  auto c = new bool[](ma+1);
  foreach (i; 0..ma+1) c[i] = (i&1) && b[i] && b[(i+1)/2];

  auto d = new int[](ma+1);
  foreach (i; 0..ma+1) d[i] = d[i-1]+c[i];

  auto q = readln.chomp.to!int;
  foreach (_; 0..q) {
    auto rd = readln.splitter;
    auto l = rd.front.to!int-1; rd.popFront();
    auto r = rd.front.to!int;
    writeln(d[r]-d[l]);
  }
}

pure T[] primes(T)(T n)
{
  import std.algorithm, std.bitmanip, std.conv, std.range;

  auto sieve = BitArray();
  sieve.length((n + 1) / 2);
  sieve = ~sieve;

  foreach (p; 1..((nsqrt(n) - 1) / 2 + 1))
    if (sieve[p])
      for (auto q = p * 3 + 1; q < (n + 1) / 2; q += p * 2 + 1)
        sieve[q] = false;

  auto r = sieve.bitsSet.map!(to!T).map!("a * 2 + 1").array;
  r[0] = 2;

  return r;
}

pure T nsqrt(T)(T n)
{
  import std.algorithm, std.conv, std.range, core.bitop;
  if (n <= 1) return n;
  T m = 1 << (n.bsr / 2 + 1);
  return iota(1, m).map!"a * a".assumeSorted!"a <= b".lowerBound(n).length.to!T;
}


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

int main()
{
  int n;
  string ans="Yes";
  cin>>n;
  vector<string> s(n);
  for(int i=0;i<n;i++)
  {
    cin>>s.at(i);
    for(int j=0;j<i;j++)
    {
      if(s.at(i)==s.at(j))
      {
        ans="No";
        break;
      }
    }
  }
  for(int i=0;i<n-1;i++)
  {
    if(s.at(i).at(s.at(i).size()-1)!=s.at(i+1).at(0))
    {
      ans="No";
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3620
#include<stdio.h>

int main(){
	int a, b, c;
	int i;
	int N = 0;
	scanf("%d %d %d", &a, &b, &c);
	for (i = a; i <= b; i++){
		if (c%i == 0){ N++; }
	}
	printf("%d\n", N);
	return 0;
}


Measured memory_bytes: 2000
#!/usr/bin/env python3
import sys
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x):
        return -self.parents[self.find(x)]
        
    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}



def solve(N: int, M: int, X: "List[int]", Y: "List[int]", Z: "List[int]"):
    uf = UnionFind(N)
    
    for i in range(M):
        uf.union(X[i]-1,Y[i]-1)
    
    print(uf.group_count())
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    X = [int()] * (M)  # type: "List[int]"
    Y = [int()] * (M)  # type: "List[int]"
    Z = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        X[i] = int(next(tokens))
        Y[i] = int(next(tokens))
        Z[i] = int(next(tokens))
    solve(N, M, X, Y, Z)

if __name__ == '__main__':
    main()


Measured memory_bytes: 16524
#include <cmath>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#define ll long long
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	string s;
	string t[4] = {"eraser", "erase", "dreamer", "dream"};
	bool p = true, q;
	cin >> s;
	int pos = s.length() - 1;
	while (pos >= 0)
	{
		q = false;
		//cout << "pos = " << pos << endl;
		for (int kk = 0; kk < 4; ++kk)
		{
			if (pos - t[kk].length() + 1 < 0) continue;
			int i, j;
			p = true;
			for (i = 0, j = t[kk].length() - 1; j >= 0; ++i,--j)
			{
				if (s[pos - i] != t[kk][j])
				{
					p = false;
					break;
				}
			}
			if (j >= 0) 
			{
				p = false;
			}
			if (p)
			{
				q = true;
				pos = pos - t[kk].length();
				break;
			}
			//cout << "kk = " << kk << " p = " << p << endl;
		}
		if (!q) break;
	}
	if (q)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
	return 0;
} 

Measured memory_bytes: 512
#include<iostream>
using namespace std;
using uint = unsigned int;

int main() {

	uint A1, A2, A3;
	cin >> A1 >> A2 >> A3;
	
	if(A1 + A2 + A3 > 21) {
		cout << "bust";
	} else {
		cout << "win";
	}
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LI()
    if a <= c <= b:
        print("Yes")
        return
    print("No")
    return

#B
def B():
    n, m = LI()
    e = defaultdict(int)
    for i in range(1, n + 1): e[i] = 0
    for i in range(m):
        a, b = LI()
        e[a] += 1
        e[b] += 1
    for i in e.values():
        print(i)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 38512
#include <iostream>

using namespace std;

int main()
{
  int a[5];
  for (int i = 0; i < 5; i++)
    cin >> a[i];

  for (int i = 0; i < 4; i++) {
    int max = i;
    for (int j = i + 1; j< 5; j++) {
      if ((a[max] % 10) < (a[j] % 10))
        max = j;
    }
    int tmp = a[max];
    a[max] = a[i];
    a[i] = tmp;
  }
  
  if (a[0] % 10 == 0) {
  } else {
    for (int i = 1; i < 5; i++) {
      if (a[i] % 10 == 0) {
        int tmp = a[i];
        for (int j = i; j > 0; j--)
          a[j] = a[j - 1];
        a[0] = tmp;
      }
    }
  }
  
  int time = 0;
  for (int i = 0; i < 4; i++) {
    time += a[i];
    if (time % 10 != 0)
      time += (10 - (time % 10));
  }
  time += a[4];
  cout << time << endl;

  return 0;
}

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

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	int maxx, minn;

	maxx = min(a, b);
	minn = (a + b) - n;
	if (minn < 0) {
		minn = 0;
	}

	cout << maxx << " " << minn << endl;

	return 0;
}

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

int main(){
  cin >> n;
  int dp[n+1];
  // 初期化
  for (int i = 0; i <= n; i++){dp[i] = 0;}
  for ( int i = 0; i <= n; i++){
    if ( i <= 1 ){dp[i] = 1;}
    else {
      dp[i] = dp[i-1] + dp[i-2];
    }
  }

  cout << dp[n] << endl;

  return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int n;
string ans;
void Print(int len,int mx)
{
	if(len==n)
	{
		printf("%s\n",ans.c_str());
		return;
	}
	for(int i=0;i<=mx;i++)
	{
		ans.push_back('a'+i);
		Print(len+1,i==mx?i+1:mx);
		ans.pop_back();
	}
}
int main()
{
	scanf("%d",&n);
	Print(0,0);
	return 0; 
}

Measured memory_bytes: 1536
N = int(input())
S = input()
w = 0
r = 0
for s in S:
    if s == "W":
        w += 1
    else:
        r += 1

res = r
rcnt = [0 for i in range(N+1)]
wcnt = [0 for i in range(N+1)]

for i in range(N):
    if S[i] == "W":
        wcnt[i+1] = wcnt[i] + 1
        rcnt[i+1] = r
    else:
        r -= 1
        rcnt[i+1] = r
        wcnt[i+1] = wcnt[i]
    res = min(res, max(wcnt[i+1], rcnt[i+1]))
print(res)

Measured memory_bytes: 18948
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll N, M;
    cin >> N >> M;
    ll ans = 0;
    if (N == 1 && M == 1) {
        ans = 1;
    } else if (N == 1) {
        ans = M - 2;
    } else if (M == 1) {
        ans = N - 2;
    } else {
        ans = (N-2) * (M-2);
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256