akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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



void func(long long N, std::vector<long long> a){

    map<lli,lli> d;

    REP(i,0,N){
        d[a[i]-1]++;
        d[a[i]]++;
        d[a[i]+1]++;
    }

    lli ans = 0;
    for(auto e:d){
        chmax(ans,e.second);
    }
    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    func(N, std::move(a));
    return 0;
}


Measured memory_bytes: 6912
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<string>
#include<set>
#include<utility>
#include<vector>

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

int solve(){
  int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;  cin >> k; k--;
  cout << a[k] << endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
int main() {
	static int n,a[200005],b[200005];
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",a+i);
	if(n&1) {
		b[n/2+1]=a[1];
		int cnt=1;
		rep(i,1,n/2)
			b[n/2+i+1]=a[++cnt],
			b[n/2-i+1]=a[++cnt];
	}
	else {
		b[n/2+1]=a[1];
		int cnt=1;
		rep(i,1,n/2) {
			b[n/2+1-i]=a[++cnt];
			if(i!=n/2) b[n/2+1+i]=a[++cnt];
		}
	}
	rep(i,1,n-1) printf("%d ",b[i]);
	printf("%d\n",b[n]);
	return 0;
}

Measured memory_bytes: 3712
<?php

  $N = trim(fgets(STDIN));

  if ($N % 2 == 0) {

        echo "0.5000000000";

}   else {

     $ki  = ($N / 2) + 0.5;
     $num = $ki / $N;

      echo number_format($num, 10);

}
  

?>

Measured memory_bytes: 4728
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int t = in.nextInt();

            int min = Integer.MAX_VALUE;
            for (int i = 0; i < n; i++) {
                int c = in.nextInt();
                int time = in.nextInt();

                if (time <= t) min = Math.min(min, c);
            }

            out.println(min == Integer.MAX_VALUE ? "TLE" : min);
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}



Measured memory_bytes: 23252
// #pragma GCC optimize("Ofast,no-stack-protector")//
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
#include<bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using ld = long double;
using ull = unsigned long long;
 
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define int long long
void accell() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}
const int N = 70;
vector<int> g[N];
int color[N]; 
int s[N];
int p[N];
int d[N];
int rs = 0;
void dfs(int v, int par = -1) {
    p[v] = par;
    for (auto to : g[v]) {
        if (to != par) {
            d[to] = d[v] + 1;
            dfs(to, v);
            s[v] += s[to];
            if (s[to] != 0)
                rs++;
        }
    }
}
int get_lca(int a, int b) {
    if (d[a] < d[b])
        swap(a, b);
    while (d[a] > d[b])
        a = p[a];
    if (a == b) return a;
    while (a != b) {
        a = p[a], b = p[b];
    }
    return a;
}
int lca[N];
 
signed main() {
    accell();
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int n;
    cin >> n;
    for (int i = 0; i + 1 < n; ++i) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        g[a].push_back(b);
        g[b].push_back(a);
    } 
    dfs(0);
    int m;
    cin >> m;
    vector<pair<int, int> > bx(m);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        lca[i] = get_lca(a, b);
        // cout << lca[i] << endl;
        bx[i] = {a, b};
        if (d[a] < d[b])
            swap(bx[i].F, bx[i].S);
    }
    int res = 0;
    for (int i = 1; i < (1 << m); ++i) {
        fill(s, s + N, 0);
        rs = 0;
        for (int j = 0; j < m; ++j) {
            if ((1 << j) & i) {
                // cout << j << ' ' << lca[j] << ' ';
                if (bx[j].S == lca[j]) {
                    s[bx[j].S]--;
                    s[bx[j].F]++;
                } else {
                    s[lca[j]] -= 2;
                    s[bx[j].F]++;
                    s[bx[j].S]++;
                }
            }
        }
        dfs(0);
        int x = __builtin_popcount(i);
        // cout << "    " << i << ' ' << x << ' ' << rs << endl;
        if (x & 1)
            res += (1LL << (n - 1 - rs));
        else
            res -= (1LL << (n - 1 - rs));
    }
    // cout << res << endl;
    cout << (1LL << (n - 1)) - res << '\n';
    return 0;
}
 


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<deque>
#include<climits>
#include<cassert>
#include<cmath>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define MAX 110

using namespace std;

int V,E,ans;
vector<int> G[MAX];
int COST[MAX][MAX];
bool used[MAX];

void dfs(int node,deque<int>& deq,int sp){
  if(node >= 15)return;

  if(node >= 2){
    auto check = [&]()mutable->int{
      int ret = 0,len = deq.size();
      int mincost[len];
      //for(int& i : mincost)i = IINF;
      rep(i,len)mincost[i] = IINF;
      for(int i=0;i<len;i++){
	for(int j=i+1;j<len;j++){
	  int cost = COST[deq[i]][deq[j]];
	  if(cost==0)return -1;
	  mincost[i] = min(mincost[i],cost);
	  mincost[j] = min(mincost[j],cost);
	}
      }
      //for(int& i : mincost) ret += i;
      rep(i,len) ret += mincost[i];
      return ret;
    };
    int tmp = check();
    if(tmp != -1)ans = max(ans,tmp);
  }

  REP(i,sp,V){
    if(used[i])continue;
    if(G[i].size() < node)continue;
    used[i] = true;
    deq.push_back(i);
    dfs(node+1,deq,i+1);
    deq.pop_back();
    used[i] = false;
  }
}

int main()
{
  int test[4];
  for(int& i : test)i = IINF;
  cin >> V >> E;
  rep(i,V)G[i].clear();
  rep(i,E){
    int u,v,f;
    cin >> u >> v >> f;
    u--,v--;
    G[u].push_back(v);
    G[v].push_back(u);
    COST[u][v] = COST[v][u] = f;
  }

  deque<int> deq;
  dfs(0,deq,0);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1264
# editorialを参考にした
from functools import reduce
from operator import mul
import math
import sys
sys.setrecursionlimit(1000000)
X, Y = map(int, input().split())


def choose(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


if (X + Y) % 3 != 0:
    print(0)
else:
    numof21 = (-Y+2*X)//3
    numof12 = (-X + 2 * Y) // 3
    #print(numof12, numof21)

    if numof12 < 0 or numof21 < 0:
        print(0)
    else:
        mod = 10**9+7  # 出力の制限
        N = numof12+numof21
        g1 = [1, 1]  # 元テーブル
        g2 = [1, 1]  # 逆元テーブル
        inverse = [0, 1]  # 逆元テーブル計算用テーブル

        for i in range(2, N + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod//i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        # A = (math.factorial(numof12 + numof21))  # % (10**9+7)
        # B = math.factorial(numof21)  # % (10**9+7)
        # C = math.factorial(numof12)  # % (10 ** 9 + 7)
        # D = (B*C)  # % (10**9+7)
        # ans = (A//D) % (10**9+7)
        ans = choose((numof12+numof21), min(numof12, numof21),mod) % (10**9+7)
        print(ans)


Measured memory_bytes: 82768
//***The night is the darkest just before the dawn***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

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

    ll n=s.length();
    for(ll i=0;i<(n);i++) t1.push_back(t[i]);
    //cout<<t1<<",,";
    if(s==t1) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3600
#include <iostream>
using namespace std;
int main(){
  int N,X,T,nokori,i;
  i=0;
  cin >> N;
  cin >> X;
  cin >> T;
  nokori=N;
  while(true){
    if(nokori-X>0){
      nokori-=X;
      i++; 
    }else{
      i++;
      break;
    }
  }
  cout<<i*T;
}

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

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

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
/****************************************************************************************************************************************************/

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define MOD 1000000007
/********************************************************************************************************************************************************/


const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
/*********************************************************************************************************************************************************/
const ll mx=1e5+3;
ll s,n,w[mx];
ll dp[mx];
ll ks(ll i)
{
    if(i>=n)
    return 0;
    if(dp[i]!=-1)
        return dp[i];
    ll c=INT_MAX,c1=INT_MAX;
    if(i+1<=n)
        c1=abs(w[i]-w[i+1])+ks(i+1);
    if(i+2<=n)
        c=abs(w[i]-w[i+2])+ks(i+2);
    return dp[i]=min(c,c1);
}

int main()
{
    optimize();
    for(int i=0;i<mx;i++){
            dp[i]=-1;
    }
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>w[i];
    cout<<ks(1)<<endl;

    return 0;
}






Measured memory_bytes: 9904
#include<bits/stdc++.h>
#define REP(i,x) for(ll i=0;i<x;i++)
#define INF 1e18
typedef long long ll;
using namespace std;

int main(){
    int N,R;
    cin>>N>>R;
    if(N>=10)cout<<R<<endl;
    else cout<<R+(100*(10-N))<<endl;
}

Measured memory_bytes: 764
N,M=gets.split.map(&:to_i)
A,B={},{}
C=M.times.map{|i|
  a,b=gets.split.map(&:to_i)
  (A[a-1]||=[])<<b
  [a,b]
}
A.values.each{|v|v.sort.each_with_index{|y,i|B[y]=i+1}}
C.each{|a,b|puts "%06d%06d"%[a,B[b]]}


Measured memory_bytes: 30076
#include <iostream>
#include <string>
#include <cassert>

int main() {
    const char alphabet_first = 'A';
    const char alphabet_last = 'Z';
    const int number_of_alphabets = alphabet_last - alphabet_first + 1;
    const int number_of_apperance_of_alphabet = 2;

    std::string S;
    std::cin >> S;

    int A[number_of_alphabets] = {};

    for (int i=0; i<S.length(); i++) {
        assert(alphabet_first <= S.at(i) && S.at(i) <= alphabet_last);
        A[S.at(i)-alphabet_first]++;
    }

    bool accepted = true;

    for (int i=0; i<number_of_alphabets; i++) {
        if (! accepted) break;
        if (0 < A[i] && A[i] < number_of_apperance_of_alphabet) accepted = false;
        if (number_of_apperance_of_alphabet < A[i]) accepted = false;
    }

    std::cout << (accepted ? "Yes" : "No") << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>

#define LL long long

using namespace std;

inline LL read() {
    LL x = 0, f = 1;
    char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while('0' <= c && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

int main() {
    LL x = read();
    LL now = 100;
    int cnt = 0;
    while(now < x) {
        now *= 1.010;
        ++cnt;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3596
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 5000;
int n, k;
int p[MAX_N + 1];
ll c[MAX_N + 1];
bool vis[MAX_N + 1];

void clear() {
    fill_n(vis, MAX_N + 1, false);
}

pli dfs1(int u) {
    if (vis[u]) return mp(0, 0);

    vis[u] = true;

    auto [x, y] = dfs1(p[u]);
    return mp(x + c[u], y + 1);
}

ll dfs2(int u, int k) {
    if (k == 0)
        return 0;
    else {
        ll res = dfs2(p[u], k - 1);
        return max(c[u], c[u] + res);
    }
}

int main() {
    fastio();

    cin >> n >> k;
    forn1(i, n) cin >> p[i];
    forn1(i, n) cin >> c[i];

    ll ans = LLONG_MIN;

    forn1(i, n) {
        clear();
        auto [x, y] = dfs1(i);
        //cout << i << " " << x << " " << y << endl;

        ll a = k / y;
        ll b = k % y;

        chmax(ans, x * a + dfs2(i, b));

        if (a > 0) {
            chmax(ans, x * (a - 1) + dfs2(i, min(k, y)));
        }

        chmax(ans, dfs2(i, min(k, y)));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3764
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

using P = pair<LL, LL>;

const LL MOD = 1000000007;

map<P, LL>memo;
LL dp(LL S, LL X)
{
	if (memo.count(P(S, X)))
		return memo[P(S, X)];
	if (S == 0)return 1;
	if (X == 0)return S / 2;
	if (S == 1)return 2;
	LL yet = dp(S / 2, X / 2) + dp((S - 1) / 2, (X - 1) / 2) + dp((S - 2) / 2, X / 2);
	yet %= MOD;
	return memo[P(S, X)] = yet;
}

int main()
{
	//memo[P(0, 0)] = memo[P(0, 1)] = memo[P(1, 0)] = 1ll;
	//memo[P(1, 1)] = 2ll;
	LL N;
	cin >> N;
	LL ans = dp(N, N);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int n;
string str;
bool check(int num) {
	int a = 0, b = 0, c = 0;
	for (int i = n - 1; i > -1; --i) {
		if (str[i] == 'I') {
			if (a < num)++a;
			else if (c < b)++c;
		}
		else if (str[i] == 'O') {
			if (b < a) {
				++b;
			}
		}
		else if (c < b)++c;
	}
	if (c >= num)return true;
	else return false;
}
int main() {
	cin >> n >> str;
	int ni = 1, na = n / 3 + 1;
	while (ni < na) {
		int nd = (ni + na) / 2;
		if (check(nd)) {
			ni = nd + 1;
		}
		else {
			na = nd;
		}
	}
	cout << ni - 1 << endl;
	return 0;
}

Measured memory_bytes: 3796
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<i32>();
    let (n, r) = (line[0], line[1]);

    if n < 10{
        println!("{}", r + 100*(10-n));
    }else{
        println!("{}", r);
    }
}


Measured memory_bytes: 4352
/******************************************************************************

                         بسم الله الرحمن الرحيم
                     Author: Mst: Mhamuda Khatun
                               RUCSE27

*******************************************************************************/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mod 1000000007
#define MAX 1000000000000
#define N 305

int main()
{
    fastio;
    ll n,c500,r500,c5;
    cin>>n;

    c500=n/500;
    r500=n%500;
    c5=r500/5;

    cout<<c500*1000+c5*5;
    cout<<"\n";
    return 0;   //:D
}




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

int main()
{
  int A, B, C, X, Y, r, AorB;
  int ans = 0;
  bool flagA = true;

  cin >> A >> B >> C >> X >> Y;
  r = X - Y;
  if (r < 0)
    flagA = false;
  AorB = (A * flagA + B * (1 - flagA));
  if (2 * C <= AorB)
  {
    if (AorB <= C)
      ans = 2 * C * abs(r) + AorB * min(r, max(X, Y) - abs(r)) + min(2 * C, A + B) * max(max(X, Y) - 2 * abs(r), 0) / 2;
    else
      ans = 2 * C * abs(r) + min(2 * C, A + B) * (X + Y - abs(r)) / 2;
  }
  else
    ans = AorB * abs(r) + min(2 * C, A + B) * (X + Y - abs(r)) / 2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>

using namespace std;
string S[100010];


int main(void){
    int N;
    cin>>N;
    for (int i = 0; i < N; ++i) {
        cin>>S[i];
    }



    for (int i = 0; i < N; ++i) {
        sort(S[i].begin(), S[i].end());
    }

    long long ans=0;

    sort(S, S+N);


//    for (int j = 0; j < N; ++j) {
//        cout<<S[j]<<endl;
//    }


    long long  count = 1;
    string temp = S[0];
    for (int i = 1; i < N; ++i) {
        if(temp == S[i]){
            count++;
        }else{
            temp = S[i];
            if(count>1){
                ans += (count * (count-1)) / 2;
                count = 1;
            }
        }
    }

    if(count>1){
        ans += (count * (count-1)) / 2;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  	int N,K;
    cin >> N >> K;
	int M = K/2;
    int sum = 0;
      
  	for(int i=0;i<N;i++){
    	int x;
      	cin >> x;
      	if(K-x <= M)
        	sum += 2*(K-x);
      	else
        	sum += 2*x;
    }
  cout << sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 100005
using namespace std;
 
int main(){
  int n;
  long long l, a[MAX];
  bool t = false;
  scanf("%d%lld%lld", &n, &l, &a[0]);
  for(int i = 1; i < n; i++){
    scanf("%lld", &a[i]);
    if(a[i-1] + a[i] >= l){
      printf("Possible\n");
      for(int j = 1; j < i; j++) printf("%d\n", j);
      for(int j = n-1; j > i; j--) printf("%d\n", j);
      printf("%d\n", i);
      return 0;
    }
  }
  printf("Impossible\n");
}

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

int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if(a-b>=0){
    cout << "delicious" << endl;
  }else if(a+x>=b){
    cout << "safe" << endl;
  }else{
    cout << "dangerous" << endl;
  }  
}

Measured memory_bytes: 256
use std::io::Read;

#[allow(non_snake_case)]
struct Input {
    D: usize,          // Days
    s: Vec<Vec<i64>>,  // score(day, contest)
    c: Vec<i64>        // cost(contest)
}

fn compute_score(input: &Input, out: &Vec<usize>) -> i64 {
    let mut score = 0;
    let mut last = vec![0; 26];
    for d in 0..out.len() {
        score += input.s[d][out[d]];
        last[out[d]] = d + 1;
        for i in 0..26 {
            score -= input.c[i] * (d + 1 - last[i]) as i64;
        }
    }
    score
}


#[allow(non_snake_case)]
fn main() {
    let mut buffer = String::new();
    std::io::stdin().read_to_string(&mut buffer).unwrap();
    let mut iter = buffer.split_whitespace();

    let D: usize = iter.next().unwrap().parse().unwrap();
    let c: Vec<i64> = (0..26)
        .map(|_| iter.next().unwrap().parse().unwrap()).collect();
    let s: Vec<Vec<i64>> = (0..D)
        .map(|_| (0..26)
            .map(|_| iter.next().unwrap().parse().unwrap()).collect()
        )
        .collect();
    let input = Input{ D, s, c };

    let mut out: Vec<usize> = (0..D)
        .map(|_| (iter.next().unwrap().parse::<i64>().unwrap() - 1) as usize).collect();

    let M: usize = iter.next().unwrap().parse().unwrap();
    let queries: Vec<(usize, usize)> = (0..M)
        .map(|_| (
            (iter.next().unwrap().parse::<i64>().unwrap() - 1) as usize,
            (iter.next().unwrap().parse::<i64>().unwrap() - 1) as usize,
        )).collect();

    for i in 0..M {
        out[queries[i].0] = queries[i].1;
        let score = compute_score(&input, &out);
        println!("{}", score);
    }
}


Measured memory_bytes: 4208
#include<iostream>
#include<vector>

struct youso {
	int parent = -1;
	int count = 0;
	std::vector<int> edge;
	//std::vector<int> child;
};
youso y[200000];
void maketree(int parent,int ima) {
	y[ima].parent = parent;
	for (int i = 0; i < y[ima].edge.size(); i++) {
		if (parent == y[ima].edge[i]) continue;
		else {
			maketree(ima, y[ima].edge[i]);
			//y[ima].child.push_back(y[ima].edge[i]);
		}
	}
}
void countup(int ima,int x) {
	y[ima].count += x;
	for (int i = 0; i < y[ima]./*child*/edge.size(); i++) {
		if (y[ima].parent != y[ima].edge[i]) {
			countup(y[ima]./*child*/edge[i], y[ima].count);
		}
	}
}

int main() {
	int n, q, a, b, p, x;//a,b,pは引く１する必要がある
	std::cin >> n >> q;
	for (int i = 0; i < n-1; i++) {
		std::cin >> a >> b;
		y[a-1].edge.push_back(b-1);
		y[b-1].edge.push_back(a-1);
	}
	maketree(-1, 0);
	for (int i = 0; i < q; i++) {
		std::cin >> p >> x;
		y[p-1].count += x;
	}
	countup(0,0);
	std::cout << y[0].count;
	for (int i = 1; i < n; i++) {
		std::cout << ' ' << y[i].count;
	}
	std::cout << std::endl;
}


Measured memory_bytes: 24320
N = int(input())
A = list(map(int,input().split()))
cn4 = 0
cn2 = 0

for a in A:
    if a % 4 == 0:
        cn4 += 1
    elif a % 2 == 0:
        cn2 += 1

if N // 2 <= cn4:
    print("Yes")
    exit()
if N - cn4*2  <= cn2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 15020
#include <cstdio>
#include <cstring>

typedef long long i64;

enum {
  MAXN = 1000 + 5
};

const int MOD = 1e9+7;

int N, A, B, C, D;

int dp[MAXN];
int dp0[MAXN];
int fac[MAXN];
int ifac[MAXN];

int fpm(int x, int exp) {
  int res(1);
  for (; exp; exp>>=1, x=(i64)x*x%MOD)
    if (exp&1)
      res = (i64) res*x % MOD;
  return res;
}

void exec() {
  dp[0] = 1;
  int i, j, k, tmp, FROM;
  for (fac[0]=ifac[0]=1,i=1; i<MAXN; ++i) {
    fac[i] = (i64) fac[i-1] * i % MOD;
    ifac[i] = (i64) ifac[i-1] * fpm(i, MOD-2) % MOD;
  }
  scanf("%d%d%d%d%d", &N, &A, &B, &C, &D);
  for (i=A; i<=B; ++i) {
    memcpy(dp0, dp, sizeof dp);
    FROM = 1;
    for (j=1; j<C; ++j)
      FROM = (i64) FROM*ifac[i] % MOD;
    for (k=0; k<N; ++k) {
      if (!dp[k]) continue;
      tmp = FROM;
      for (j=C; j<=D && (i64)i*j <= N-k; ++j) {
	tmp = (i64) tmp*ifac[i] % MOD;
	(dp0[k+i*j] += (i64) dp[k] * fac[N-k] % MOD * ifac[N-k-j*i] % MOD * tmp % MOD * ifac[j] % MOD) %= MOD;
      }
    }
    memcpy(dp, dp0, sizeof dp0);
  }
  printf("%d\n", dp[N]);
}

int main() {
  if (fopen("E.in", "r") != NULL) {
    freopen("E.in", "r", stdin);
    freopen("E.out", "w", stdout);
  }
  exec();
  return 0;
}


Measured memory_bytes: 128
l, r = map(int, input().split())

if r-l>=2019 :
    print(0)
    exit()

l = l%2019
r = r%2019

if l == 0 or r == 0 :
    print(0)
    exit()

if l > r:
    r += 2019

# print(l, r)

list_score = []
for i in range(l+1, r+1):
    for j in range(l, i):
        # print(i, j)
        list_score.append(i*j%2019)
# print(list_score)
print(int(min(list_score)))

Measured memory_bytes: 75416
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int o = Integer.parseInt(sc.next());
        System.out.println(Math.min(n * m, o));
    }
}


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

double sq(double a) { return a * a; }

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int n, m;
  cin >> n >> m;
  vector<array<double, 3>> a(n);
  for (auto&& e : a) {
    cin >> e[0] >> e[1] >> e[2];
  }
  double mx = 0;
  for (int bt = 0; bt < 1 << n; ++bt) {
    if (__builtin_popcount(bt) == m) {
      double cur = 0;
      for (int j = 0; j < n; ++j) {
        if (~bt >> j & 1) {
          continue;
        }
        for (int i = 0; i < j; ++i) {
          if (~bt >> i & 1) {
            continue;
          }
          cur += sq(a[j][0] - a[i][0]) + sq(a[j][1] - a[i][1]) + sq(a[j][2] - a[i][2]);
        }
      }
      mx = max(mx, cur);
    }
  }
  cout << mx << '\n';
}



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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

//-----------------------------------------------------------------------------

int n,mi=INF,r,ans=-INF;

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

	cin>>n;
	cin>>mi;
	REP(i,n-1) {
		cin>>r;
		ans=max(ans,r-mi);
		mi=min(mi,r);
	}
	cout<<ans<<endl;

	return 0;
}



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

string MCXI("mcxi");

int get_integer(string str,int i){
	if(i-1 < 0) return 1;
	if(isdigit(str[i-1])){
		return str[i-1] - '0';
	} else {
		return 1;
	}
}

vector<int> parse_MCXI(string str){
	vector<int> ret(4);
	for(int unsigned i = 0;i<str.size();i++){
		for(int j=0;j<4;j++){
			if(str[i] == MCXI[j]) ret[j] = get_integer(str,i);
		}
	}
	return ret;
}

int main(){
	int n;cin >> n;
	for(int i=0;i<n;i++){
		string s1,s2;
		cin >> s1 >> s2;
		vector<int> v1 = parse_MCXI(s1);
		vector<int> v2 = parse_MCXI(s2);
		vector<int> ans(4,0);
		for(int i=3;i>=0;i--){
			if(ans[i] + v1[i] + v2[i] <= 9){
				ans[i] += v1[i] + v2[i];
			} else {
				ans[i] = (ans[i] + v1[i] + v2[i])%10;
				ans[i-1] += 1;
			}
		}
		for(int i=0;i<4;i++){
			if(ans[i]){
				if(ans[i] != 1){
					cout << ans[i];
				}
				cout << MCXI[i];
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3144
import math

A,B,H,M = map(int,input().split())

kakudo = abs((H*30+0.5*M-M*6)) 

if kakudo >= 180:
    kakudo = 360 - kakudo

a = (A**2 + B**2 - 2*A*B*math.cos(math.radians(kakudo)))
print(math.sqrt(a))


Measured memory_bytes: 9380
#include <bits/stdc++.h>
using namespace std;
int main(void){
    double t500,t1000;
    while (cin>>t500>>t1000) {
        if (t500<35.50&&t1000<71.00) {
            cout<<"AAA"<<endl;
        } else if (t500<37.50&&t1000<77.00) {
            cout<<"AA"<<endl;
        } else if (t500<40.00&&t1000<83.00) {
            cout<<"A"<<endl;
        } else if (t500<43.00&&t1000<89.00) {
            cout<<"B"<<endl;
        } else if (t500<50.00&&t1000<105.00) {
            cout<<"C"<<endl;
        } else if (t500<55.00&&t1000<116.00) {
            cout<<"D"<<endl;
        } else if (t500<70.00&&t1000<148.00) {
            cout<<"E"<<endl;
        } else {
            cout<<"NA"<<endl;
        }
    }
}



Measured memory_bytes: 3216
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using ll=long long int;

int main() {
    ll a, b, q;
    cin >> a >> b >> q;
    vector<ll> s(a+1), t(b+1);
    s[0] = -1e16; t[0] = -1e16;
    for (int i = 1; i <= a; ++i) cin >> s[i];
    for (int i = 1; i <= b; ++i) cin >> t[i];

    while (q--) {
        ll x;
        cin >> x;
        ll sp[2], tp[2];
        auto sit = lower_bound(s.begin(), s.end(), x);
        auto tit = lower_bound(t.begin(), t.end(), x);
        sp[0] = *(sit-1); sp[1] = *sit;
        tp[0] = *(tit-1); tp[1] = *tit;
        ll ans = 1e16;
        for (auto &&se: sp) for (auto &&te: tp) {
            ans = min(ans, abs(se-te) + min(abs(se-x), abs(te-x)));
        }
        cout << ans << endl;
    }

    return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,l;
  cin >> n >> l;
  VLL a(n);
  rep(i,n) cin >> a[i];
  rep(i,n-1){
    if(a[i]+a[i+1] >= l){
      cout << "Possible" << endl;
      rep(j,i){
        cout << j+1 << endl;
      }
      for(ll j = n-2; j >= i+1; j--){
        cout << j+1 << endl;
      }
      cout << i+1 << endl;
      return 0;
    }
  }
  cout << "Impossible" << endl;
  return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdio>
#include <algorithm>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

int main()
{
    int n;
    while (1) {
        int cnt[13] = { 0 };
        cin >> n;
        if (n == 0) break;
        REP(i, n) cin >> cnt[i];
        int pre[13] = { 0 };
        for(int k = 0, f = 1; ; k++, f = 1) {
            int sum[100] = { 0 };
            REP(i, n) {
                pre[i] = cnt[i];
                sum[pre[i]]++;
            }
            REP(i, n) {
                cnt[i] = sum[pre[i]];
                if (cnt[i] != pre[i]) f = 0;
            }
            if (f) {
                cout << k << endl;
                REP(i, n) {
                    if (i < n - 1) printf("%d ", cnt[i]);
                    else printf("%d\n", cnt[i]);
                }
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3192
#include<stdio.h>
int main(){
	int n,i;
	int m,e;
	int myScore,enemyScore;
	while(1){
		myScore=0;enemyScore=0;
		scanf("%d",&n);
		if(!n)break;
		for(i=0;i<n;i++){
			scanf("%d %d",&m,&e);
			if(m>e)myScore += m+e;
			else if(m<e)enemyScore += m+e;
			else {
				myScore+=m;
				enemyScore+=e;
			}
		}
		printf("%d %d\n",myScore,enemyScore);
	}
	return 0;
}

Measured memory_bytes: 0
i = []
5.times do |hoge|
    i[hoge] = gets.to_i
end
f = gets.to_i
a = 0
l = true
while a < 4 do
    (4 - a).times do |hoge|
        l = false if (i[hoge] - i[a + 1]).abs > f
    end
    a += 1
end 
puts l ? "Yay!" : ":("

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

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

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  string n;cin>>n;
  int sum=0;
  rep(i,n.size()){
    sum+=n[i]-'0';
  }
  //cout<<sum<<endl;
  //cout<<stoi(n)<<endl;
  cout<<(stoi(n)%sum==0 ?"Yes":"No")<<endl;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < SIZE; ++i) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL 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] % MOD)) % MOD;

}

LL Bin(LL n, LL k) {
    if(k < 0 || n < k) {
        return 0;

    }
    LL ret = 1;
    for(LL i = 1; i <= k; ++i) {
        ret *= n--;
        ret /= i;

    }
    return ret;
}

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

    combInit();
    LL n, m, k;
    cin >> n >> m >> k;
    
    LL res = 0;
    for(int i = 0; i <= n - 1; ++i) {
        for(int j = 0; j <= m - 1; ++j) {
            LL tmp = (n - i) * (m - j) * (i + j) % MOD;
            if(i != 0 && j != 0) tmp *= 2;
            res += tmp;
            res %= MOD;

        }
    }
    cout << res * comb(n * m - 2, k - 2) % MOD << endl;

    return 0;
}



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


int main() {
    int a, b, x;
    cin >> a >> b >> x;
    if (a <= x && x - a < b) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=5e3+7;
const int mod=1e9+7;

int n;
int head[N],to[N*2],nx[N*2],ec=1;
inline void add(int a,int b){
	nx[++ec]=head[a]; head[a]=ec; to[ec]=b;
}

int f[N][N],g[N],sz[N],tmp[N];
void dfs(int fa,int x){
	for(int i=head[x];i;i=nx[i]) if(to[i]!=fa) dfs(x,to[i]);
	f[x][1]=1; sz[x]=1;
	for(int i=head[x];i;i=nx[i]){
		int t=to[i];
		if(t==fa) continue;
		for(int u=1;u<=sz[x];++u)
			for(int v=0;v<=sz[t];++v)
				tmp[u+v]=(tmp[u+v]+1ll*f[x][u]*f[t][v])%mod;
		sz[x]+=sz[t];
		for(int u=1;u<=sz[x];++u) f[x][u]=tmp[u],tmp[u]=0;
	}
	for(int i=2;i<=sz[x];i+=2) f[x][0]=(f[x][0]+(mod-1ll)*f[x][i]%mod*g[i])%mod;
}

int main(){
	scanf("%d",&n); g[0]=1;
	for(int i=1;i<n;++i){
		int x,y; scanf("%d%d",&x,&y);
		add(x,y); add(y,x);
	}
	for(int i=2;i<=n;i+=2) g[i]=g[i-2]*(i-1ll)%mod;
	dfs(0,1); printf("%d\n",mod-f[1][0]);
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    priority_queue<int, vector<P>, function<bool(P, P)>> q([](P a, P b)->int {
        if(a.second==b.second) {
            return a.first<b.first;
        } else {
            return a.second>b.second;
        }
    });
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        q.push(mp(a,b));
    }


    ll time = 0;
    ll work = 0;
    string s = "Yes";

    while(!q.empty()){
        P p = q.top();
        time = p.se;
        work += p.fi;
//        dbg(work);
//        dbg(time);
        if(work>time){
            s = "No";

            break;
        }
        q.pop();
    }
    cout<<s<<endl;
    return  0;
}


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

int main(){
  int a,b;
  cin >> a >> b;
  
  if(a % 3 == 0 || b % 3 == 0 || (a+b)%3 == 0){
    cout << "Possible" <<endl;
  }else{
    cout << "Impossible" <<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int x, c = 9;
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> x;
	if(400 <= x) c--;
	if(600 <= x) c--;
	if(800 <= x) c--;
	if(1000 <= x) c--;
	if(1200 <= x) c--;
	if(1400 <= x) c--;
	if(1600 <= x) c--;
	if(1800 <= x) c--;
	if(2000 <= x) c--;
	cout << c;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int n,cnt[10005],a,v[10005],ans;
void fs(int x)
{
	if(x==13)
    {
        int rtn=24;
        for (int i=0;i<24;i++)
            for (int j=i+1;j<24;j++)
                if(v[i]&&v[j])
                    rtn=min(rtn,min(j-i,24-j+i));
        ans=max(ans,rtn);
        return ;
    }
    if (cnt[x]==2)
        v[x]=v[24-x]=1,fs(x+1);
    else if(cnt[x])
    {
        v[x]=1,fs(x+1),v[x]=0;
        if(x) v[24-x]=1,fs(x+1),v[24-x]=0;
    }
    else fs(x+1);
}
int main()
{
	scanf("%d",&n); for(int i=1;i<=n;i++)
	{
		scanf("%d",&a);cnt[a]++;
	} cnt[0]++;
	for(int i=1;i<12;i++)
        if (cnt[i]>2)
            return puts("0"),0;
    if(cnt[12]>1||cnt[0]>1)
        return puts("0"),0;
    fs(0);
    return printf("%d\n",ans),0;
}

/*
AKIHABARA
*/

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

int main() {
  string S;
  cin >> S;
  for (int i = 0; i < S.size(); i++) cout << 'x';
  cout << endl;
  return 0;
}


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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<30)
#define INFLL (1LL<<62LL)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll N, x;
ll a[2001];
ll b[2001];

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

  cin >> N >> x;
  rep(i, N) {
    cin >> a[i];
    b[i] = INFLL;
  }

  ll ans = INFLL;
  rep(k, N) {
    ll cost = k * x;
    rep(i, N) {
      b[i] = min(b[i], a[i-k<0?i-k+N:i-k]);
      cost += b[i];
    }
    ans = min(ans, cost);
  }
  cout << ans << endl;

  return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long  n,x;
   cin>>n>>x;
   int ans=1;
   while(1)
   {
    	if(ans*x>=n)
    	{
    	   cout<<ans<<endl;
    	   return 0;
       }
       ans++;
   }
}


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

int main() {
  llint n;
  cin >> n;
  llint a[n+1], b[n];
  for (int i = 0; i < n + 1; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  llint count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] >= b[i]) {
      count += b[i];
    }
    else {
      count += a[i];
      if (a[i+1] >= b[i] - a[i]) {
        a[i+1] -= (b[i] - a[i]);
        count += b[i] - a[i];
      }
      else {
        count += a[i+1];
        a[i+1] = 0;
      }
    }
  }
  printf("%lld\n", count);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define ll long long
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll> p(N);
  vector<ll> data(N);
  rep(i,N){
    cin>>p.at(i);
    data.at(i)=(p.at(i)+1);
  }
  if(N==1){
    cout<<(long double)data.at(0)/2.0<<endl;
    return 0;
  }
  ll a=0;
  rep(i,K){
    a+=data.at(i);
  }
  ll ans=a;
  ll i=K;
  while(true){
    if(N==K){
      break;
    }
    a=a+data.at(i)-data.at(i-K);
    ans=max(a,ans);
    if(i==N-1){
      break;
    }
    i++;
  }
  long double an=ans/2.0;
  cout<<fixed<<setprecision(10)<<an<<endl;
  return 0;
}


Measured memory_bytes: 3456
#051_C
sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
st1='U'*dy+'R'*dx
ts1='D'*dy+'L'*dx
st2='L'+'U'*(dy+1)+'R'*(dx+1)+'D'
ts2='R'+'D'*(dy+1)+'L'*(dx+1)+'U'
print(st1+ts1+st2+ts2)

Measured memory_bytes: 3060
H, W, K = [int(x) for x in input().split()]
C = []

for h in range(H):
    C += input()


Cw = 2 ** W
Ch = 2 ** H
ans = 0

C_tmp= C.copy()

for Y in range(Ch):
    C_tmp =[]
    for j in range(H):
        if Y >> j & 1:
            C_tmp += C[j*W:(j+1)*W]

    for X in range(Cw):
        C_tmp2 =[]
        for i in range(W):
            if X >> i & 1:
                C_tmp2 += C_tmp[i::W]

        if C_tmp2.count('#') == K:
            ans += 1

print(ans)

Measured memory_bytes: 9224
n = gets.to_i
arr = n.times.map{gets.split}

$root = {}
$none = {}

def insert(k)
  y = $none
  x = $root
  z = {}

  z[:key] = k
  z[:left] = $none
  z[:right] = $none

  while x != $none
    y = x
    if z[:key] < x[:key]
      x = x[:left]
    else
      x = x[:right]
    end
  end

  z[:parent] = y
  if y == $none
    $root = z
  else
    if z[:key] < y[:key]
      y[:left] = z
    else
      y[:right] = z
    end
  end
end

def inorder(u)
  return if u[:key].nil?
  inorder(u[:left])
  print " #{u[:key]}"
  inorder(u[:right])
end

def preorder(u)
  return if u[:key].nil?
  print " #{u[:key]}"
  preorder(u[:left])
  preorder(u[:right])
end

arr.each do |a|
  if a[0] == 'insert'
    insert(a[1].to_i)
  elsif a[0] == 'print'
    inorder($root)
    print "\n"
    preorder($root)
    print "\n"
  end
end


Measured memory_bytes: 206904
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<queue>
#include<set>
#include<unordered_map>
#include<stack>
#include<map>
#include<bitset>
#include <cstdlib>
#include<cstring>
#define ll long long;
#define pb push_back
const int MOD = 1e9 + 7;
const int qq = 1e5 + 10;
const int INF = 1e9 + 10;
const double eps = 1e-11;
const double pi = acos(-1.0); 
const double PI = 3.1415926535897932384;
using namespace std;
#define ma = 2147483647;
#define mi = -2147483647;
int main()
{

	ios::sync_with_stdio(0); cin.tie(0);

	long double a, b, h, m;
	cin >> a >> b >> h >> m;

	double md = double( m) * 6.0;
	double hd = double(h) * 30.0 + (double(m) / 60.0 ) * 30.0;
	double de = md - hd;
	if (de < 0)de *= -1.0;
	if (de >= 180.0)
	de = 360.0 - de;
	double ans = sqrt(-2.0 * double(a) * double(b) * cos(de * PI / 180) + double(a) * double(a) + double(b) * double(b));

	printf("%.20lf", ans);


	
	return 0;
}

Measured memory_bytes: 4240