akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
#define int ll
signed  main(){
    int n,c,k; cin>>n>>c>>k;
    vi v(n,0); rep(i,n)cin>>v[i];
    sort(all(v));
    int ans=1;
    int now=0;int last=0;
    for(int i=0; i<n;i++){
        if(!i){now=1; last=v[i]; continue;}
        if(now==c){ans++; now=1;last=v[i];continue;}
        if(v[i]-last>k){now=1; ans++; last=v[i]; continue;}
        now++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

vector<double>v;
int main() {
	double n;
	while (cin >> n) { v.push_back(n); }
	sort(all(v));
	cout << setprecision(20) << v[v.size() - 1] - v[0] << endl;
}


Measured memory_bytes: 3288
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a>=0&&b<=0||a<=0&&b>=0)
		cout<<"Zero";
	else
		if(a>0&&b>0)
			cout<<"Positive";
		else
			if(abs(a-b)%2!=0)
				cout<<"Positive";
			else
				cout<<"Negative";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;


int main() {
  int n, W;
  cin >> n >> W;
  vl w(n+10);
  vi v(n+10);
  rrep(i,n){
    cin >> w[i] >> v[i];
  }
  
  ll dp[n+10][100010];
  dp[0][0] = 0;
  rrep(i,100010){
    dp[0][i]=LINF;
  }
  rrep(i,n){
    rep(j,100011){
      if(j>=v[i]){
        dp[i][j] = min(dp[i-1][j], dp[i-1][j-v[i]]+w[i]);
      }
      else dp[i][j] = dp[i-1][j];
    }
  }
  int ans=0;
  rrep(i,n){
    rep(j,100011){
      if(dp[i][j]!=0 && dp[i][j]<=W){
        ans = max(ans, j);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 80896
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	char s[51];
	char *t="AKIHABARA";
	scanf("%s", s);
	int i=0, j=0;
	int f=0;
	while(1){
		if(t[j]==0){
			if(s[i]!=0) f=1;
			break;
		}else if(t[j]==s[i]){
			i++, j++;
		}else{
			if(t[j]=='A'){
				j++;
			}else{
				f=1;
				break;
			}
		}
	}
	puts(f==0?"YES":"NO");
}


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

int main() {
    int N; cin >> N;
    set<int> a;
    for (int i = 0; i < N; i++)
    {
        int b; cin >> b;
        if(a.count(b)) a.erase(b);
        else a.emplace(b);
    }

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

Measured memory_bytes: 4864
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;

int main()
{
    int n;
    cin >>n;
    int p[n];
    int a[n+1];
    for(int i=0;i<n;i++){
        cin >> p[i];
        a[i]=0;
    }
    int m=10000000;
    int b=0;
    while(b<=p[0]){
        int form=b;
        a[0]=b;
        for(int i=0;i<n;i++){
            a[i+1]=max(p[i]-a[i],0);
        }
        form+=a[n];
        for(int i=1;i<n;i++)
            form+=(a[i]*2);
        m=min(m,form);
        b++;
    }
    cout << m << endl;
    return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define LF "\n"

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;

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

int to_a(char c)
{
	if (c == 'a') return 0;
	return 'z' - c + 1;
}

char s[101010];
ll K;

int main(){
	FAST;

	cin >> s;
	cin >> K;
	ll L = strlen(s);

	rep(i, L-1) {
		if(to_a(s[i])<=K) {
			K -= to_a(s[i]);
			s[i] = 'a';
		}
	}
	K %= 26;
	rep(i,K) {
		s[L-1]++;
		if(s[L-1]>'z') s[L-1] = 'a';
	}
	
	cout<< s << LF;

	return 0;
}

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

int main(){
    int n;
    cin >> n;
    double sum=0;
    double a;
    for(int i=0;i<n;i++){
        cin >> a;
        sum+=1.0/(double)a;
    }  
    cout <<setprecision(9)<<1.0/sum <<endl;
    return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE OverloadedStrings #-}
--{-# LANGUAGE OverloadedLists   #-}
{-# LANGUAGE BangPatterns      #-} --引数に!
{-# LANGUAGE MultiWayIf        #-}
{-# LANGUAGE TupleSections     #-}

import Data.Maybe (fromJust)
import Data.List
import Data.Array  --変数衝突
import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.ST
--import Data.Vector as V　--変数衝突
import qualified Data.ByteString.Lazy.Char8 as B
import qualified Data.Vector.Unboxed as V
import Control.Monad
import Control.Monad.ST
--import Debug.Trace

type DP s = STUArray s (Int,Int,Bool) Int

--O(10*D)
dp_i :: DP s -> [Int] -> Int -> Int -> ST s ()
dp_i dparr ks d cnt = sub dparr ks cnt
 where
   sub :: DP s -> [Int] -> Int -> ST s ()
   sub dparr [] _ = return ()
   sub dparr (k:ks) cnt = do
     let modd n = if n < d then n else mod n d
     forM_ [0..d-1] $ \i -> do
       forM_ [0..k-1] $ \j -> do
         a1 <- readArray dparr (cnt,i,False)
         a2 <- readArray dparr (cnt,i,True)
         c <- readArray dparr (cnt+1,modd $ i+j,False)
         writeArray dparr (cnt+1,modd $ i+j,False) (mod' $ a1+a2+c)
       forM_ [False,True] $ \bool -> do -- j == k
         a <- readArray dparr (cnt,i,bool)
         c <- readArray dparr (cnt+1,modd $ i+k,bool)
         writeArray dparr (cnt+1,modd $ i+k,bool) (mod' a+c)
       forM_ [k+1..9] $ \j -> do
         a <- readArray dparr (cnt,i,False)
         c <- readArray dparr (cnt+1,modd $ i+j,False)
         writeArray dparr (cnt+1,modd $ i+j,False) (mod' a+c)
     sub dparr ks (cnt+1)

solve :: [Int] -> Int -> ST s Int -- length ks == n
solve ks d = do
  dparr <- newArray ((0,0,False),(length ks,d-1,True)) 0
  writeArray dparr (0,0,True) 1
  dp_i dparr ks d 0
  ans <- forM [False,True] $ \bool -> readArray dparr (length ks,0,bool)
  return $ mod' $ (sum ans) - 1 -- K >= 1　より全部ゼロを除く

main0 :: B.ByteString -> Int
main0 cont =
   let remLines0 = map B.words (B.lines cont)
       [k']:remLines1 = remLines0
       ks = map readBInt $ B.groupBy (\_ _ -> False) k'
       [d']:remLines2 = remLines1
       d = readBInt d'
   in runST $ solve ks d

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

main :: IO ()
main = print . main0 =<< B.getContents

mod' :: Int -> Int
mod' n = if n < 1000000007 then n else mod n 1000000007


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

int main() {
    long long N, A, B;
    cin >> N >> A >> B;
    long long cnt = (N/(A+B))*A;
    long long sa = N - (A+B)*(N/(A+B));
    if (sa>=A) cnt+=A;
    else cnt+=sa;
    cout << cnt;
}

Measured memory_bytes: 256
import kotlin.math.min

fun main() {
    val (n, m, x) = readLine()!!.split(' ').map { it.toInt() }
    val books = (0 until n).map { readLine()!!.split(' ').map { it.toInt() } }
    var ans = -1
    for (bits in (0 until (1 shl n))) {
        var cost = 0
        val a = IntArray(m)
        for (i in 0 until n) {
            if ((bits shr i) and 1 == 1) {
                cost += books[i][0]
                for (j in 0 until m) {
                    a[j] += books[i][j + 1]
                }
            }
        }

        if (a.all { it >= x }) {
            ans = if (ans == -1) cost else min(cost, ans)
        }
    }
    println(ans)
}


Measured memory_bytes: 39596
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;// 任意長整数型
using bint = mp::cpp_int;// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;// ついでに有理数型
using rat = boost::rational<bint>;
*/
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
ll W,H,x,y,r;  
int main(){ //srand((unsigned)time(NULL));
  cin >> W >> H >> x >> y >> r;
  cout << (0 <= y-r && y+r <= H && 0 <= x-r && x+r <= W ? "Yes" : "No") << endl;
}



Measured memory_bytes: 3132
#include <stdio.h>

int main(void)
{
  int kazu;
  int suchi[10001];
  int i;
  long min, max, sum;

  scanf("%d", &kazu);
  
  for(i = 0;i < kazu;i++){
    scanf("%d", &suchi[i]);
  }

  min = 1000000;
  for(i = 0;i < kazu;i++){
    if(min > suchi[i]){
      min = suchi[i];
    }
  }

  max = -1000000;
  for(i = 0;i < kazu;i++){
    if(max < suchi[i]){
      max = suchi[i];
    }
  }

  sum = 0;
  for(i = 0;i < kazu;i++){
    sum += suchi[i];
  }

  printf("%ld %ld %ld\n", min, max, sum);

  return 0;
}

Measured memory_bytes: 636
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
	int a[105];
	memset(a,0,sizeof(a));
	int n,x;
	cin>>n>>x;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	int num=0;
	for(int i=1;i<=n-1;i++){
		if(x>=a[i]){
			num++;
			x-=a[i];
		}
	}
	if(x==a[n])
	num++;
	cout<<num;
	return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] a = new int[n];
    int[] b = new int[n]; 

    for(int i = 0; i < n; i++){
      a[i] = sc.nextInt();
      b[i] = a[i];
    }

    Arrays.sort(b);

    for(int i = 0; i < n; i++){
      if(a[i] != b[n - 1]){
        System.out.println(b[n - 1]);
      } else {
        System.out.println(b[n - 2]);
      }
    }
  }
}


Measured memory_bytes: 93944
# coding: utf-8
import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        N = int(input())
        B = np.asarray(list(map(int, input().split())))
    else:
        pass
    A = np.asarray(range(N))
    A += 1
    res = np.asarray([])
    for _ in range(N):
        for i in range(B.size)[::-1]:
            if A[i] == B[i]:
                res = np.append(res,A[i])
                #print(A[:B.size]!=A[i],i,B)
                B = B[A[:B.size]!=A[i]]
                break
        else:
            print(-1)
            exit()
    
    for i in range(N)[::-1]:
        print(int(res[i]))

if __name__ =='__main__':
    main()

Measured memory_bytes: 22004
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

int main(){
    long long N,K;
    cin >> N >> K;
    long long ans=min(abs(N%K-K),N%K);
    cout << ans << endl;
}

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

int main() {
    const int MOD = 1000000007;

    int N;
    cin >> N;
    map<int, ll> p;

    for (int i = 1; i <= N; i++) {

        int x = i;
        for (int j = 2; j <= sqrt(N); j++) {
            if (x % j != 0) continue;
            ll ext = 0;
            while ( x % j == 0) {
                x /= j;
                ext++;
            }
            p[j] += ext;
        }
        if (x != 1) p[x]++;
    }

    ll cnt = 1;
    for (auto x : p) {
        ll y = (x.second + 1) % MOD;
        cnt *= y;
        cnt %= MOD;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 3636
import math
L = int(input())
r = math.floor(math.log2(L))
N = r+1
graph = []
for i in range(1,r+1):
    graph.append([i,i+1,0])
    graph.append([i,i+1,2**(i-1)])
for t in range(N-1,0,-1):
    if L-2**(t-1) >= 2**r:
        graph.append([t,N,L-2**(t-1)])
        L -= 2**(t-1)

print(N,len(graph))
for g in graph:
    print(*g)


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

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

    cout << (a >= 3200 ? s : "red" ) << endl;

    return 0;
}


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

#define sz(a) (int)a.size()
#define re return
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(), a.end()
#define gr greater <int>

#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")

using namespace std;

typedef long long ll;
typedef string str;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;

///!!!<3<3<3<3<3!!!
void ProdamGaraje () {
   str s;
   cin >> s;
   if (s[0] == '7' || s[1] == '7' || s[2] == '7')
      cout << "Yes";
   else
      cout << "No";
}
///!!!<3<3<3<3<3!!!
int main () {
   //freopen ("input.txt", "r", stdin);
   //freopen ("output.txt", "w", stdout);
   ios::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);
   int tt = 1;
   //cin >> tt;
   while (tt--)
      ProdamGaraje ();
}
///GOOOOOOSE!!!!
/*
     ▄▀▀▀▄
▄███▀░0░░░▌
    ▌░░░░░▐
    ▌░░░░░▐
     ▌▌ ▌▌
     ▌▌ ▌▌
     ▌▌ ▌▌
     ▌▌ ▌▌
     ▌▌ ▌▌
   ▄▄▌▌▄▌▌        */


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

int main(){
  int N,ex=0,cnt=0;
  vector<int> c(8,0);
  cin>>N;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    if(a<3200) c[a/400]++;
    else ex++;
  }
  for(int i=0;i<8;i++){
    if(c[i]>0) cnt++;
  }

  if(cnt==0) cout<<"1 ";
  else cout<<cnt<<" ";
  if(ex==0) cout<<cnt<<endl;
  else cout<<cnt+ex<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a 
#define vb vector<long long int> b
const ll M = 998244353;
const ll inf = 1e18+5;
const ll INF=INT_MAX;
using namespace std;
void fast(){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
ll bs(ll arr[], ll l, ll r, ll x){
	ll mid=0;
    if (r >= l){
		if (arr[mid] == x) return mid; 
        if (arr[mid] > x) return bs(arr, l, mid - 1, x); 
        return bs(arr, mid + 1, r, x); 
    }
    return -1;
}
ll power(ll x,ul y,ll p){
	ll res = 1;
	x = x % p;
	if(x == 0) return 0;
	while (y > 0){
		if (y & 1) res = (res*x) % p;
		y = y>>1;
		x = (x*x) % p;
		}
	return res;
}
const int max1=500001;
pair<int,int>st[4*max1];
int arr[max1],arr1[max1];
void buildtree(int si,int ss,int se){
	if(ss==se){
        st[si].first=arr1[ss];
        st[si].second=arr1[ss];
		return;
	}
	int mid=ss+(se-ss)/2;
	buildtree(2*si,ss,mid);
	buildtree(2*si+1,mid+1,se);
	if(arr1[mid]>arr1[mid+1]) st[si].first=st[2*si].first+st[2*si+1].first;
    else st[si].second=st[2*si].second+st[2*si+1].second;
	
}
int query(int si,int ss,int se,int qs,int qe){
	if(qs>se || qe<ss) //completely outside
		return INF;
	if(ss>=qs && se<=qe)
		return st[si].first;
	int mid=ss+(se-ss)/2;
	int l=query(2*si,ss,mid,qs,qe);
	int r=query(2*si+1,mid+1,se,qs,qe);
	return min(l,r);
}
int geteven(int si,int ss,int se,int qs,int qe){
	if(ss>qe || se<qs) //completely outside
		return 0;
	if(ss>=qs && se<=qe)
		return st[si].second;
	int mid=ss+(se-ss)/2;
	int l=geteven(2*si,ss,mid,qs,qe);
	int r=geteven(2*si+1,mid+1,se,qs,qe);
	return l+r;
}
int getodd(int si,int ss,int se,int qs,int qe){
	if(qs>se || qe<ss) //completely outside
		return 0;
	if(ss>=qs && se<=qe)
		return st[si].first;
	int mid=ss+(se-ss)/2;
	int l=getodd(2*si,ss,mid,qs,qe);
	int r=getodd(2*si+1,mid+1,se,qs,qe);
	return l+r;
}
void update(int si,int ss,int se,int qi,int newval){
	if(ss==se){
        if(arr[ss]%2==1) st[si]={0,1};
        else st[si]={1,0};
		arr[ss]=newval;
		return;
	}
	int mid=ss+(se-ss)/2;
	if(qi<=mid) update(2*si,ss,mid,qi,newval);
	else update(2*si+1,mid+1,se,qi,newval);
	st[si].first=st[2*si].first+st[2*si+1].first;
    st[si].second=st[2*si].second+st[2*si+1].second;
}
void solve(){
	double n,k,m;
	cin>>n>>k>>m;
	if(n/m<=k) cout<<"Yes\n";
	else cout<<"No\n";
 }
int main(){
	fast();
	ll t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 3740
#include <iostream>
#include <vector>
#include<map>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<typeinfo>
#include<queue>
#include<iomanip>
using namespace std;
int main() {
	int N, K, R, S, P;
	string T;
	cin >> N >> K >> R >> S >> P >> T;
	string mem;
	int ans=0;
	for (int i = 0; i < N; i++) {
		if (i < K) {
			if (T[i] == 's') {
				ans += R;
				mem.push_back('r');
			}else if (T[i] == 'p') {
				ans += S;
				mem.push_back('s');
			}
			else {
				ans += P;
				mem.push_back('p');
			}
		}
		else {
			if (T[i] == 's') {
				if (mem[i - K] == 'r') {
					if (K + i < N && T[i + K] == 'p') {
						mem.push_back('p');
					}
					else {
						mem.push_back('s');
					}
				}
				else {
					ans += R;
					mem.push_back('r');
				}
			}
			else if (T[i] == 'r') {
				if (mem[i - K] == 'p') {
					if (K + i < N && T[i + K] == 's') {
						mem.push_back('s');
					}
					else {
						mem.push_back('r');
					}
				}
				else {
					ans += P;
					mem.push_back('p');
				}
			}
			else {
				if (mem[i - K] == 's') {
					if (K + i < N && T[i + K] == 'r') {
						mem.push_back('r');
					}
					else {
						mem.push_back('p');
					}
				}
				else {
					ans += S;
					mem.push_back('s');
				}
			}
		}
	}
	cout << ans;
}


Measured memory_bytes: 512
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		for(int i=1;i<=3;i++){
			if((A * B * i) % 2 == 1){
				Console.WriteLine("Yes");
				return;
			}
		}
		Console.WriteLine("No");
	}
	int A,B;
	public Sol(){
		var d = ria();
		A = d[0]; B = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#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 SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    string s; cin >> s;
    ll seg = 1;

    REP(i, s.size()) {
        if (i != 0) {
            if (s[i] != s[i-1]) {
                seg++;
            }
        }
    }
    cout << seg - 1 << endl;

    return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
    cin >> n;
    vector<int> l(n);
    for(int i = 0; i < n; ++i) {
        cin >> l.at(i);
    }

    sort(l.begin(), l.end());
    int cnt = 0;
    for(int i = 0; i < n; ++i) {
        int sum = l.at(i);
        for(int j = i+1; j < n; ++j) {
            sum += l.at(j);
            for(int k = j+1; k < n; ++k) {
                if(sum > l.at(k)) {
                    cnt++;
                }else {
                    break;
                }
            }
            sum -= l.at(j);
        }
    }
    cout << cnt << endl;
}

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

int main() {
  int h,w;
  cin >> h >> w;
  
  int ih, iw;
  vector<string> vec;
  
  string sline = "";
  string kakomi = "#";
  string line;
  
  for (int i = 0; i < w + 2; i++) {
    sline += kakomi;
  }
  
  cout << sline << endl;
  for (int ih = 0; ih < h; ih++) {
    cin >> line;
    cout << kakomi + line + kakomi << endl;
  }
  cout << sline << endl;
}

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

using namespace std;

main() {
	char str[100];
	int len=0;
	int i;
	scanf("%s",str);

	len=0;
	while(str[len] != '\0') {
	len++;
		}

	for(i=len-1;i>=0;i--) {
	printf("%c",str[i]);
		}
	printf("\n");
	
}


Measured memory_bytes: 3056
/*g++ main.cpp -o main.out*/
/*./main.out*/

#include<bits/stdc++.h>
using namespace std;

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

int m[200005];

int main()
{
    int n,a;
    cin>>n;
    rer(i,2,n)
    {
        cin>>a;
        m[a]++;
    }
    rer(i,1,n)cout<<m[i]<<endl;
    return 0;
}












Measured memory_bytes: 4368
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  vector<int>v(5);
  rep(i,5)cin>>v[i];
  sort(v.begin(),v.end(),greater<int>());
  rep(i,5){
    cout<<v[i];
    if(i<4)cout<<' ';
  }
  cout<<endl;
  return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll a, b, c;
	cin >> a >> b >> c;
	ll take = min(a-b,c);
	cout << c-take << endl;

}



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

int main() {
    int H, W;
    cin >> H >> W;
    string s;
    for (int i = 0; i < H; i++){
        cin >> s;
        cout << s << endl;
        cout << s << endl;
     }
}


Measured memory_bytes: 256
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

function main() {
    let N = +cin.shift();
    let M = +cin.shift();
    let X = +cin.shift();
    let C = [];
    for (let i = 0; i < N; i++) {
        let kakaku = +cin.shift();
        let A = [];
        for (let j = 0; j < M; j++) {
            A[j] = +cin.shift();
        }
        C.push({ kakaku: kakaku, A: A });
    }
    C = C.sort((x, y) => x.kakaku - y.kakaku);
    let all_comb = 2 ** C.length;
    let ans = -1;
    //console.log(C);
    for (let i = 1; i <= all_comb; i++) {
        let temp = (('000000000000000') + i.toString(2)).slice(-N).split("");
        //console.log(temp);
        let nedan = 0;
        let noryoku = Array(M).fill(0);
        for (let j = 0; j < temp.length; j++) {
            if (temp[j] == '1') {
                //console.log(C[j]);
                nedan += C[j].kakaku;
                for (let k = 0; k < M; k++) {
                    noryoku[k] += C[j].A[k];
                }
            }
        }
        //console.log({ noryoku })
        // すべての能力がX以上かつansよりnedanが小さい場合
        if (noryoku.every(v => v >= X) && (ans == -1 || nedan < ans)) {
            ans = nedan;
        }
    }
    console.log(ans);

}
main();


Measured memory_bytes: 33752
n = int(input())
a = [num for num in map(int, input().split(' '))]

# print(n, a)

ans = [0] * (n+1)

for i in range(n):
  # 後ろから走査するための index
  target_i = n - i
  a_targt = a[n-i-1]
  
  # a の倍数の箱のボールの個数を計算
  baisu = 2
  ball_count = 0
  while True:
    baisu_i = target_i * baisu
    if baisu_i > n:
      break
    if ans[baisu_i] == 1:
      ball_count += 1
    baisu += 1
  # 倍数の箱のボールの総数 % 2 が a[i]と異なる場合、箱にボールを入れる必要がある
  if ball_count % 2 != a_targt:
    ans[target_i] = 1

ans_array = []

for i in range(1, n+1):
  if ans[i] == 1:
    ans_array.append(i)
print(len(ans_array))
if len(ans_array) > 0:
  print(' '.join(map(str, ans_array)))
# print(ans)

Measured memory_bytes: 82788
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#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;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

const int MXN = 2e5, IINF = 1e9 + 10, INF = 1e18 + IINF + 10, MOD = 1000000007;
const ld PI = 4.0 * atanl(1.0), PREC = .000001;
const char nl = '\n';

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.end(), x.begin()
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define ins insert

int n, m, t, a[MXN];

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

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

string rot(string s) {
  if (s.size() > 0) return s.substr(1) + s[0];
  return s;
}

int main() {
  fast();
  string s, t;
  cin >> s >> t;
  // simulate
  int x = 0;
  while (x < s.length()) {
    s = rot(s);
    if (s == t) {
      cout << "Yes";
      return 0;
    }
    ++x;
  }
  cout << "No";
  return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#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 push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head
 
void solve(){
    int n, x;
    cin >> n >> x;
    int d = 0;
    vector<int> l(n);
    for (int i = 0; i < n; i++) cin >> l[i];

    int i = 1;
    while (i <= n && d + l[i-1] <= x){
        d = d + l[i-1];
        i++;
    }
    cout << i << '\n';
}

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

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

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int n; 
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        ++a.at(x - 1);
    }
    sort(a.begin(), a.end());
    vector<int> s(n + 1);
    for (int i = 0; i < n; ++i) s.at(i + 1) = s.at(i) + a.at(i);
    for (int k = 1; k <= n; ++k) {
        int l = 0, r = n / k + 1;
        while (l + 1 < r) {
            int c = (l + r) / 2;
            bool ok = [&](int c) {
                int i = lower_bound(a.begin(), a.end(), c) - a.begin();
                int sum = c * (n - i) + s.at(i);
                return (sum >= c * k);
            }(c);
            if (ok) l = c; else r = c;
        }
        cout << l << endl;
    }
    return 0;
}

Measured memory_bytes: 3200
import java.util.*;
import java.io.*;

public class Main{
 public static void main(String[] args){
  Scanner s = new Scanner(System.in);
   int a = s.nextInt();
   int b = s.nextInt();
   int c = s.nextInt();
   
   if(a>b){
     System.out.print(0);
   }
   else{
   int result = Math.min(c, b/a);
   System.out.print(result);
   
   }
   }
}

Measured memory_bytes: 21716
# 2019-11-12 13:20:54(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, *l = (int(x) for x in sys.stdin.read().split())
    l.sort()
    if l[-1] < sum(l[:-1]):
        ans = 'Yes'
    else:
        ans = 'No'
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
S=input()
isOK=True
for i in range(len(S)):
  if((i+1)%2==1):
    if(S[i]=="L"):
      isOK=False
  else:
    if(S[i]=="R"):
      isOK=False
      
if(isOK):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9108
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
    long int N;
    cin >> N;
    vector<long int> vec(N);
    for(long int i = 0; i < N; i++){
        cin >> vec[i];
    }
    
    sort(vec.begin(),vec.end());

    cout << vec[N/2] - vec[(N/2 -1)] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
	int H,W;
	

		
		while (1){
			cin >> W >> H;
			if (H == 0 && W == 0)break;
			for (int a = 0; a < W; a++){
				for (int a = 0; a < H; a++){
					cout << "#";
				}
				cout << endl;
			}
			cout << endl;
		}
	

	return 0;
}

Measured memory_bytes: 3080
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

// ユークリッドの互除法
LL extgcd(LL a, LL b, LL& x, LL& y)
{
	LL g = a; x = 1; y = 0;
	if (b != 0)
	{
		g = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	return g;
}

// 逆元
LL mod_inverse(LL a, LL m)
{
	LL x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

// 階乗
std::vector<LL>fact;
void mod_fact(LL n, LL m)
{
	fact.resize(n + 1);
	fact[0] = 1;
	for (LL i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i % m;
}

const LL mod = 1000000007;
LL N, K;
std::vector<std::vector<LL>>G;

LL mod_perm(LL n, LL r)
{
	if (n - r < 0) return 0;
	return (fact[n] * mod_inverse(fact[n - r], mod)) % mod;
}

LL dfs(LL v, LL p)
{
	LL res;
	if (p == 0) res = (K * mod_perm(K - 1, G[v].size())) % mod;
	else res = mod_perm(K - 2, (LL)G[v].size() - 1);
	for (LL u : G[v])
	{
		if (u != p) (res *= dfs(u, v)) %= mod;
	}
	return res;
}

int main()
{
	in >> N >> K;
	std::vector<LL>a(N - 1), b(N - 1);
	rep(i, N - 1) in >> a[i] >> b[i];

	G.resize(N + 1);
	rep(i, N - 1)
	{
		G[a[i]].push_back(b[i]);
		G[b[i]].push_back(a[i]);
	}

	mod_fact(std::max(N, K), mod);
	out << dfs(1, 0) << std::endl;
}


Measured memory_bytes: 12800
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define SZ(x) ((int)(x).size())
#define TC(tc) while (tc--)
#define VI vector<int>
#define PII pair<int, int>
#define trav(a,x) for (auto& a : x)
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;

int main()
{
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n; cin >> n;
	int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
	while (n--)
	{
		string s; cin >> s;
		if (s == "AC") c1++;
		else if (s == "WA") c2++;
		else if (s == "TLE") c3++;
		else if (s == "RE") c4++;
	}
	cout << "AC x " << c1 << "\n";
	cout << "WA x " << c2 << "\n";
	cout << "TLE x " << c3 << "\n";
	cout << "RE x " << c4 << "\n";
	return 0;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long

using namespace std;

ll Eucleadean(vector<ll> &vec){
	while (true) {
		ll min = *min_element(vec.begin(), vec.end());
		bool flag = true;
		for (auto i = vec.begin(); i < vec.end(); i++){
			if (*i%min == 0){
				*i = min;
			} else {
				*i %= min; flag = false;
			}
		}
		if (flag){
			return min;
		}
	}
}

int main(){
	ll n, x;
	cin >> n >> x;
	vector<ll> xi(n+1);
	REP(i, n){cin >> xi[i];}
	xi[n] = x;
	sort(xi.begin(), xi.end());
	vector<ll> diff(n);
	REP(i, n){diff[i] = xi[i+1] - xi[i];}
	ll ans = Eucleadean(diff);
	cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    
    rep(i, h) {
        rep(ii, w) {
            if (((ii < a) && (i < b)) || ((ii >= a) && (i >= b))) {
                printf("0");
            }
            else {
                printf("1");
            }
        }
        
        printf("\n");
    }
    
    return 0;
}


Measured memory_bytes: 1280
H, W = [int(i) for i in input().split()]
Grid = [input() for _ in range(H)]

field = [[0] * W for _ in range(H)]
field[0][0] = 1

for h in range(H):
    for w in range(W):
        if Grid[h][w] == '.' and w + 1 < W and Grid[h][w + 1] == '.':
            field[h][w + 1] += field[h][w]
        if Grid[h][w] == '.' and h + 1 < H and Grid[h + 1][w] == '.':
            field[h + 1][w] += field[h][w]
print(field[H - 1][W - 1] % (10**9 + 7))

Measured memory_bytes: 157428
# include<iostream>

int main(){
    using namespace std;
    int a, b;
    cin >> a >> b;
    int diff;
    diff = b - a;

    int sum=0;
    for(int i=1; i<diff; i++){
        sum += i;
    }

    cout << sum - a << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<sstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<numeric>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define np string::npos
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define repc(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto n :(array))

typedef long long ll ;
typedef deque<int> di ;
typedef deque<ll> dl ;
typedef map<string,int> dict;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
const double PI = atan(1.0) * 4 ;
double eps = 1e-10 ;

template <typename T>
void out(deque < T > d)
{
  for(size_t i = 0; i < d.size(); i++)
  {
    debug(d[i]);
  }
}

template<typename T>
T ston(string str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  deque<string> dstr ={"light fly","fly","bantam","feather","light","light welter","welter","light middle","middle","light heavy","heavy"} ;
  double wei;
  int suf;
  while(cin >> wei){
    suf = 0;
    if(wei>91.00){
      ++suf ;
    }
    if(wei>81.00){
      ++suf;
    }
    if(wei>75.00){
      ++suf ;
    }
    if(wei>69.00){
      ++suf;
    }
    if(wei>64.00){
      ++suf ;
    }
    if(wei>60.00){
      ++suf;
    }
    if(wei>57.00){
      ++suf ;
    }
    if(wei>54.00){
      ++suf;
    }
    if(wei>51.00){
      ++suf ;
    }
    if(wei>48.00){
      ++suf;
    }
    cout << dstr[suf] << endl;
  }
  return 0;
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(k) rep(author_is_masa,k)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/

signed main(){
	string s,t;
	cin>>s>>t;
	int ans=0;
	rep(i,3) ans+=s[i]==t[i];
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3604
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		String s = sc.next();
		String t = sc.next();
		sc.close();
		out.printf("%s%s%n", t, s);
	}
}


Measured memory_bytes: 22356
fun main(args : Array<String>) {
    val (a, b, n) = readLine()!!.split(" ").map { it.toDouble() }

    var x = 0.0
    if (b <= n) {
        x = b - 1.0
    } else {
        x = n
    }

    println(((a * x)/b).toLong() - (x/b).toLong())
}

Measured memory_bytes: 36532
from math import ceil
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
f=sorted(list(map(int,input().split())),reverse=True)
l=[]
for i in range(n):
  l.append([f[i]*a[i],a[i],f[i]])
l.sort()
ng=-1
ok=l[n-1][0]
while ok-ng>1:
  mid=(ok+ng)//2
  cnt=0
  for i in range(n):
    if l[i][0]>mid:
      cnt+=ceil((l[i][0]-mid)/l[i][2])
  if cnt<=k:
    ok=mid
  else:
    ng=mid
print(ok)


Measured memory_bytes: 127052
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim S As String = NextString()

        Dim cnt As Integer = 0
        Dim j As Integer = S.Length - 1

        For i As Integer = S.Length - 1 To 0 Step -1
            If j - i > "dreamer".Length Then Exit For
            For Each dd As String In New String() {"dream", "dreamer", "erase", "eraser"}
                If Mid(S, i + 1, j - i + 1) = dd Then
                    j = i - 1
                    cnt += dd.Length
                End If
            Next
        Next

        If S.Length = cnt Then
            WriteLine("YES")
        Else
            WriteLine("NO")
        End If
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function
End Module


Measured memory_bytes: 27464