akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(a,b,c) for (int a=b;a<=c;a++)
#define per(a,b,c) for (int a=b;a>=c;a--)
#define go(u) for (int o=ft[u],v;v=E[o].t,o;o=E[o].n)
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> par;
typedef double dob;
const int N=70010,lim=70000,P=1000000007;
int n,m,a[20],all;
LL ans,f[N],g[N];
LL inv[N],s1[N],s2[N];
LL dw(int n,int m){
	if (m>n) return 0;
	return s1[n]*s2[n-m]%P;
}
void preset(){
	inv[1]=1;
	rep(i,2,lim) inv[i]=inv[P%i]*(P-P/i)%P;
	s1[0]=s2[0]=1;
	rep(i,1,lim){
		s1[i]=s1[i-1]*i%P;
		s2[i]=s2[i-1]*inv[i]%P;
	}
}
#define hav(s,p) (s&(1<<(p-1)))
#define ins(s,p) (s|(1<<(p-1)))
int main(){
	preset();
	scanf("%d%d",&n,&m);
	rep(i,1,m) scanf("%d",a+i);
	f[0]=1;
	all=(1<<n)-1;
	per(_,m,1){
		memcpy(g,f,sizeof(f));
		rep(i,0,all) if (f[i]){
			rep(j,1,n) if (hav(i,j)==0){
				LL tp=-dw(all-a[_]+1-i,(1<<(j-1))-1)*(1<<(j-1))%P;
				int k=ins(i,j);
				g[k]=(g[k]+f[i]*tp)%P;
			}
		}
		swap(f,g);
	}
	rep(i,0,all){
		LL tp=dw(all^i,all^i);
		ans=(ans+f[i]*tp)%P;
	}
	ans*=1<<n;
	ans=(ans%P+P)%P;
	printf("%lld\n",ans);
	return 0;
}


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

using namespace std;

int main(int argc, char **argv)
{
	string s;
	cin >> s;

	int counter = 0; 
	for (int i = 0; i < 3; ++i)
	{
		if (s[i] == '1') ++counter;
	}
	std::cout << counter << std::endl;
}


Measured memory_bytes: 256
// Try Hitachi Hokudai Labo & Hokkaido University Contest 2019-1
// author: Leonardone @ NEETSDKASU

fn main() {
    use std::io::{stdin, stdout, BufRead, Write};
    let stdin = stdin();
    let mut stdin = stdin.lock();
    let stdout = stdout();
    let mut stdout = stdout.lock();

    let mut get_line = || {
        let mut line = String::new();
        stdin.read_line(&mut line).unwrap();
        line
    };

    let (_, e) = {
        let line = get_line();
        let mut tokens = line.split_whitespace();
        let v = tokens.next().unwrap().parse::<usize>().unwrap();
        let e = tokens.next().unwrap().parse::<usize>().unwrap();
        (v, e)
    };

    for _ in 0 .. e {
        get_line();
    }

    let freqs: Vec<_> = get_line()
        .split_whitespace()
        .map(|v| v.parse::<usize>().unwrap())
        .collect();

    let t_max = if freqs[0] != 0 { freqs[0] } else {
        get_line().trim().parse().unwrap()
    };

    if freqs[0] != 0 {
        for _ in 0 .. t_max {
            let n_new = get_line().trim().parse::<usize>().unwrap();
            for _ in 0 .. n_new {
                get_line();
            }
        }
        for _ in 0 .. t_max {
            println!("-1");
        }
        stdout.flush().unwrap();

    } else {

        for _ in 0 .. t_max {

            let n_new = get_line().trim().parse::<usize>().unwrap();
            for _ in 0 .. n_new {
                get_line();
            }

            let n_put = get_line().trim().parse::<usize>().unwrap();
            for _ in 0 .. n_put {
                get_line();
            }

            println!("-1");
            stdout.flush().unwrap();

            if get_line().trim() != "OK" {
                break;
            }

            let n_ach = get_line().trim().parse::<usize>().unwrap();
            for _ in 0 .. n_ach {
                get_line();
            }
        }
    }
}


Measured memory_bytes: 5456
#include <stdio.h>
#include <math.h>
#include <time.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
	int a, b;
	char op;

	scanf("%d %c %d", &a, &op, &b);

	if (op == '+') {
		printf("%d", a + b);
	}
	else {
		printf("%d", a - b);
	}
}

Measured memory_bytes: 1648
#include <stdio.h>

int main() {
   int N , M;
   int S = 0, V = 0;
   int A[102];
   scanf("%d %d", &N, &M);

   for(int i = 1; i <= N; i++) {
      scanf("%d", A+i);
      V += A[i];
      A[i] *= 4*M;
   }
   for(int i = 1; i <= N; i++) {
      if(A[i] >= V) {
         S++;
      }
   }
   if(S >= M) {
      printf("Yes");
   }else {
      printf("No");
   }
   printf("\n");
   return 0;
}


Measured memory_bytes: 1724
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

K, N = na()
A = na()
A.append(A[0]+K)
t = [A[i+1] - A[i] for i in range(N)]
print(sum(t) - max(t))
    



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

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        public static List<long> GeneratePrime(long max)
        {
            long prime;
            double sqrtMax = Math.Sqrt(max);
            var primeList = new List<long>();

            List<long> searchList = new List<long>();
            for (long i = 2; i <= max - 1; i++)
            {
                searchList.Add(i);
            }

            do
            {
                prime = searchList.First();
                primeList.Add(prime);
                searchList.RemoveAll(n => n % prime == 0);
            } while (prime < sqrtMax);

            primeList.AddRange(searchList);

            return primeList;
        }

        void Omame()
        {
            cin = new Scanner();
            long H = cin.nextLong();
            long A = cin.nextLong();

            if (H % A == 0)
            {
                Console.WriteLine(H / A);
            }
            else
            {
                Console.WriteLine((H / A) + 1);
            }
        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
int main(){
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  int n;
  int a;
  cin>>n;
  int c=0;
  for(int i=0;i<n;i++){
    cin>>a;
    if(a%2==0){
      if((a%3==0)||(a%5==0)){

      }
      else
        c=1;
    }
  }
  if(c==1)
    cout<<"DENIED";
  else
    cout<<"APPROVED";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  if (k == 0) {
    ans = n * n;
  } else {
    for (ll b = 1; b < n + 1; b++) {
      ll cycle = n / b;
      ll amari = n % b;
      ll cnt_in_cycle = max(b - k, (ll)0);
      ll cnt_in_amari = max((amari + 1) - k, (ll)0);
      ans += cycle * cnt_in_cycle + cnt_in_amari;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3592
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

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 <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long int lo;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define inf (lo)1e10 + 7
#define FOR for(lo i = 0 ; i < n ; i++)
#define FORV for(lo i = 0 ; i < (lo)v.size() ; i++)
#define ii pair<lo,lo>
#define iii pair<lo, pair<lo,lo> >
#define si pair<string,lo>
lo a,b,c,d,e,n,m,k,t,h,x,y,a1[20][20],a2[100005];
char c1,c2,c3,c4;
string s1,s2,s3,s4;
double d1,d2,d3;
vector <lo> v;
map <lo,lo> mp1;
map <lo,lo> mp2;
set <lo> stt;
queue <lo> q;
priority_queue <lo> pq;
lo vis [10000];
int main() {
    // freopen("gir.gir", "r", stdin);
    // freopen("cik.cik", "w", stdout);
    cin >> s1;
    if(s1[2] == s1[3] && s1[4] == s1[5]){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 764
//
//  respect the past, embrace the future
//

#include  <algorithm>
#include  <iostream>
#include  <climits>
#include  <cstdlib>
#include  <cstring>
#include  <cmath>
#include  <cstdio>
#include  <unordered_map>
#include  <map>
#include  <set>
#include  <stack>
#include  <string>
#include  <vector>
#include  <queue>

using namespace :: std;

using vpll = vector <pair <long long, long long> >;
using pll = pair <long long, long long>;
using vll = vector <long long>;
using ll = long long;

#define W (ll) (5e3 + 7)
#define N (ll) (2e6 + 7)
#define M (ll) (1e9 + 7)
#define INF (ll) (2e18)
#define F first
#define S second

inline void fastInputOutput () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
}

inline void ReadWriteFromFile () {
  freopen("../in.txt", "r", stdin);
  freopen("../out.txt", "w", stdout);
}

int n, m, a, p[N];
bool h[N];

int32_t main (int argc, char *argv[]) {
  fastInputOutput();
  // ReadWriteFromFile();
  
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a;
    h[a] = 1;
  }
  p[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (i != 1 && !h[i - 2])
      p[i] = (p[i] + p[i - 2]) % M;
    if (!h[i - 1])
      p[i] = (p[i] + p[i - 1]) % M;
  }
  cout << p[n];
}

Measured memory_bytes: 2560
#include<stdio.h>
#define MOD 1000000007

int main(){
	int H,W;
	scanf("%d%d",&H,&W);
	char a[H][W+1];
	int p[H][W];
	p[0][0]=1;
	
	for(int i=0;i<H;i++)scanf("%s",a[i]);
	
	for(int i=1;i<H+W;i++){
		for(int h=0;h<=i;h++){
			int w=i-h;
			if(h>=H || w>=W)continue;
			int u=0,l=0;
			if(h>0 && a[h-1][w]=='.')u=p[h-1][w];
			if(w>0 && a[h][w-1]=='.')l=p[h][w-1];
			p[h][w]=(u+l)%MOD;
		}
	}
	printf("%d\n",p[H-1][W-1]);
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n, m;
    cin >> n >> m;

    if (n>=2) n -= 2;
    if (m>=2) m -= 2;

    cout << n * m << endl;

    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> p;
typedef pair<p,ll> pl;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e17

int n,m;
pl es[2222];
ll sc[2222];

int main(){
	cin.sync_with_stdio(false);
  cin>>n>>m;
  rep(i,m){
    ll a,b,c;
    cin>>a>>b>>c;
    es[i]=pl(p(--a,--b),c);
  }
  rep(i,2222)sc[i]=-INF;
  sc[0]=0;
  rep(hoge,n+10){
    rep(i,m){
      pl e=es[i];
      if(sc[e.fi.fi]!=-INF){
        maxch(sc[e.fi.se],sc[e.fi.fi]+e.se);
      }
    }
  }
  ll res=sc[n-1];
  rep(hoge,n+10){
    rep(i,m){
      pl e=es[i];
      if(sc[e.fi.fi]!=-INF){
        maxch(sc[e.fi.se],sc[e.fi.fi]+e.se);
      }
    }
  }
  if(res==sc[n-1])cout<<res<<endl;
  else cout<<"inf"<<endl;
	return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        long lcm = (long)a * b / gcd(a,b);
        System.out.println(lcm);
    }

    private static int gcd(int a, int b) {
        int t;
        while (a%b != 0) {
            t = b;
            b = a%b;
            a = t;
        }
        return b;
    }
}


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


int main(){
    int N,M,C;
    cin>>N>>M>>C;
    int B[M];
    for(int i=0;i<M;i++)cin>>B[i];
    int A[N][M];
    int ans=0;

    for(int i=0;i<N;i++){
        int s=0;
        for(int j=0;j<M;j++){
            cin>>A[i][j];
            s+=A[i][j]*B[j];
        }
        if(s+C>0)ans++;
    }

    cout<<ans<<endl;
    
}

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

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

#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define REP(i,n) for(int i=0;i<n;i++)
#define pb push_back


// vectorの中身をcout << vs;で表示
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
    o << "{";
    for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
    o << "}";
    return o;
}

int main(void) {
	// cin, coutの結びつきを解除し、速くする
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	string s, t; cin >> s >> t;
	if (s == t) {
		Yes;
		return 0;
	}
	REP(i, s.size()) {
		string s1 = s.substr(0, i + 1);
		string s2 = s.substr(i+1, s.size() - i);
		// cout << "s1:"<< s1 << "s2:" << s2 << endl;

		string buf = s2 + s1;
		// cout << "buf:" <<  buf << endl;
		if (buf == t) {
			Yes;
			return 0;
		}
	}

	No;



}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

vector<string> v;

void dfs(string s, int j, int len) {
  if (j == len-1) {
    v.push_back(s);
    return;
  }

  for (int i = j; i < len; i++) {
    swap(s[i], s[j]);
    dfs(s, j + 1, len);
    swap(s[i], s[j]);
  }
}

int main() {
  int N;
  cin >> N;
  char p, q;
  string P, Q;
  rep(i,0,N-1) cin >> p, P += p;
  rep(i,0,N-1) cin >> q, Q += q;

  string s;
  rep(i,1,N) s += to_string(i);
  dfs(s, 0, s.size());

  sort(v.begin(), v.end());
  int a = distance(v.begin(), find(v.begin(), v.end(), P)) + 1;
  int b = distance(v.begin(), find(v.begin(), v.end(), Q)) + 1;

  int ans = a - b;
  if (ans < 0) ans = -ans;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2424
H, W, K = map(int, input().split())
b = [input() for i in range(H)]

ans = 0

def foo(x,y):
  sx = set()
  i = 0
  while x > 0:
    if x % 2 == 1:
      sx.add(i)
    i += 1
    x //= 2
  sy = set()
  i = 0
  while y > 0:
    if y % 2 == 1:
      sy.add(i)
    i += 1
    y //= 2

  r = 0
  for i in range(H):
    for j in range(W):
      if b[i][j] == '#':
        if i not in sx and j not in sy:
          r += 1
  if r == K:
    return 1
  else:
    return 0

for i in range(2**H):
  for j in range(2**W):
    ans += foo(i,j)
print(ans)

Measured memory_bytes: 9228
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
using namespace std;
using ll=long long;
using R=double;


int main(){
	int K;
	cin >> K;
	ll A[K];
	for(int i = 0; i < K; i++){
		cin >> A[i];
	}

	if(A[K-1] != 2){
		puts("-1");
		return 0;
	}

	ll mini = 2;
	ll maxi = 2;
	for(int i = K-1; i>=0; i--){
		if(A[i] >= mini*2){
			puts("-1");
			return 0;
		}
		// for mini
		if(mini <= A[i]){
			mini = A[i];
		}else{
			ll s_m = mini / A[i];
			if(mini%A[i] != 0){
				mini = A[i] * (s_m + 1);
			}
		}

		// for maxi
		ll s_x = maxi / A[i];
		maxi = A[i] * (s_x + 1) - 1;
		//printf("maxi : %d\n", maxi);
	}

	if(maxi < mini){
		puts("-1");
		return 0;
	}

	cout << mini << " " << maxi << endl;
	return 0;

}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
 
using namespace std;
 
int main(void)
{
    double x1, y1, x2, y2;
    double l;
 
 
    cin >> x1 >> y1 >> x2 >> y2;
 
    l = sqrt(pow(x2-x1, 2) + pow(y2-y1, 2));
 
    printf("%.8f\n", l);
 
    return 0;
}

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

void solve(long long X, long long A)
{
    if (X < A)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 10 << endl;
    }
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long X;
    scanf("%lld", &X);
    long long A;
    scanf("%lld", &A);
    solve(X, A);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long int  ll;
typedef pair<ll, ll> P;

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }
 
template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }
 

//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll 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;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


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

int main() {
ll a;
cin>>a;
double b;
cin>>b;
b*=(double)100.0;
b+=(double)0.000001;
ll bb=b-0;
ll ans=bb*a;
ans/=100;

cout<<ans<<endl;


}




Measured memory_bytes: 3720
#include<stdio.h>
#include <stdlib.h>

int main(){
    int n,i,j,k,x,swap,A[100000];

    scanf("%d",&n);

   // A = (int *) malloc ( sizeof(int) * n);

    for(j=0;j<n;j++) scanf("%d",&A[j]);

    i=-1;

    for(j=0;j<n-1;j++){
        if(A[j] <= A[n-1]) {
            i++;
            swap=A[i];
            A[i]=A[j];
            A[j]=swap;
        }
    }

    swap=A[i+1];
    A[i+1]=A[n-1];
    A[n-1]=swap;

    for(j=0;j<=i;j++) printf("%d ",A[j]);
    printf("[%d]",A[i+1]);
    for(j=i+2;j<n;j++) printf(" %d",A[j]);
    printf("\n");

    return 0;    
}


Measured memory_bytes: 2120
#include <iostream>
#include <string>
using namespace std;
int alpha[26];

int main(){
    string s; cin >> s;
    for(int i = 0; i < 4; i++){
        alpha[s[i]-'A']++;
    }
    bool twice = true;
    for(int i = 0; i < 4; i++){
        if(alpha[s[i]-'A']!=2) twice = false;
    }
    cout << (twice ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (a <= c && c <= b) {
			System.out.print("Yes");
		} else {
			System.out.print("No");
		}
	}
}


Measured memory_bytes: 21844
import scala.io.{StdIn => in}
import java.lang.{Character => char}

object Main extends App {
  val n = in.readInt
  val s = in.readLine
  val k = in.readInt - 1
  val t = s(k)
  val ans = Array.fill(n)('*')
  for(i <- 0 until n) {
    if(s(i) == t) ans(i) = char.valueOf(t)
  }
  println(ans.mkString)
}

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

using namespace std;


#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))
#define  nl "\n";

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




template <class T> inline T biton(T n, T pos)
{
	return n | ((T)1 << pos);
}
template <class T> inline T bitoff(T n, T pos)
{
	return n & ~((T)1 << pos);
}
template <class T> inline T ison(T n, T pos)
{
	return (bool)(n & ((T)1 << pos));
}
template <class T> inline T gcd(T a, T b)
{
	while (b)
	{
		a = a % b;
		swap(a, b);
	}
	return a;
}
template <class T> inline T bigmod(T p, T e, T m)
{
	T ret = 1;
	for (; e > 0; e >>= 1)
	{
		if (e & 1)
			ret = (ret * p) % m;
		p = (p * p) % m;
	}
	return (T)ret;
};


#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
	cerr << name << " is " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " is " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define debug(...)
#endif

long long dp[101][100005];
int n, tw;
vector<pair<long long, long long>> items;

long long recur(int pos, int w) {

	if (pos == n) {
		return 0;
	}

	if (dp[pos][w] != -1) {
		return dp[pos][w];
	}

	long long mx = 0;

	if (w + items[pos].first <= tw) {
		mx = max(mx, items[pos].second + recur(pos + 1, w + items[pos].first));
	}

	mx = max(mx, recur(pos + 1, w));

	return dp[pos][w] = mx;
}

void solve()
{
	SET(dp);

	cin >> n >> tw;

	items.resize(n);

	for (int i = 0; i < n; i++) {
		cin >> items[i].first >> items[i].second;
	}

	cout << recur(0, 0) << nl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cout.setf(ios::fixed);
	cout.precision(10);
	cout.tie(nullptr);
	cin.tie(nullptr);

	int t = 1;

	while (t--)
	{
		solve();
	}

	return 0;
}

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

#define DEBUG

#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

//#define int long long
typedef long long ll;
//constexpr int INF = 1e9;
//constexpr int MOD = 1000000007;

decltype(1) main() {
    //cin.tie(nullptr);
    //ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    for (auto& c : s) {
        if (c =='7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << std::endl;
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod =1000000007;
const int maxn=100010;
struct point
{
	int index,x,y; 	
}p[maxn];
struct edge
{
	int u,v;
	int len;
}e[maxn*2];
int fa[maxn],tot,n;
void init()
{
	scanf("%d",&n);
	for(int i=0;i<maxn;i++)
		fa[i]=i;
	tot=0;
}
int get_fa(int x)
{
	if(x==fa[x])	return x;
	else return fa[x]=get_fa(fa[x]);
}
void addedge(point u,point v)
{
	e[tot].u=u.index;
	e[tot].v=v.index;
	e[tot++].len=min(abs(u.x-v.x),abs(u.y-v.y));
}
bool cmp1(point a,point b)
{
	return a.x<b.x;
}
bool cmp2(point a,point b)
{
	return a.y<b.y;
}
bool cmp(edge a,edge b)
{
	return a.len<b.len;	
}
ll fun()
{
	ll ans=0;
	int m=tot,t=0;
	sort(e,e+m,cmp);
	for(int i=0;i<m;i++)
	{
		int x=get_fa(e[i].u);
		int y=get_fa(e[i].v);
		if(x!=y)
		{
			ans+=e[i].len;
			fa[x]=y;
			t++;
			if(t==n-1)
				return ans;
		}
	}
	return ans;
}
int main()
{
	init();
	for(int i=0;i<n;i++)
		scanf("%d%d",&p[i].x,&p[i].y),p[i].index=i;
	sort(p,p+n,cmp1);
	for(int i=0;i<n-1;i++)
		addedge(p[i],p[i+1]);
	sort(p,p+n,cmp2);
	for(int i=0;i<n-1;i++)
		addedge(p[i],p[i+1]);
	ll ans=fun();
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4224
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
#define maxn (1<<8)+100
#define INF 0x7fffffff
template <typename T>inline T read()
{
    register T sum=0;
    char cc=getchar();
    int sym=1;
    while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
    if(cc=='-')sym=-1,cc=getchar();
    sum=sum*10+cc-'0';
    cc=getchar();
    while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
    return sym*sum;
}
template <typename T>inline T read(T &a)
{
    a=read<T>();
    return a;
}
template <typename T,typename... Others> inline void read(T& a, Others&... b)
{
    a=read(a);
    read(b...);
}
int n,ans=INF,a,b,c,num[maxn],f[maxn],cost[maxn];
int main()
{
	read(n,a,b,c);
	for(int i=0;i<n;i++)num[i]=read<int>();
	for(int i=1;i<(1<<n);i++)
		for(int j=0;j<n;j++)
			if(i&(1<<j))
				f[i]+=num[j],cost[i]+=10;
	for(int i=1;i<(1<<n);i++)
		for(int j=1;j<(1<<n);j++)
			if((i&j)==0)
				for(int k=1;k<(1<<n);k++)
					if((i&k)==0&&(j&k)==0)
					{
						int a1=f[i],a2=f[j],a3=f[k],tmp=0;
						if(a1>a)tmp+=a1-a;
						else tmp+=a-a1;
						if(a2>b)tmp+=a2-b;
						else tmp+=b-a2;
						if(a3>c)tmp+=a3-c;
						else tmp+=c-a3;
						ans=min(ans,tmp+cost[i]+cost[j]+cost[k]-30);
					}
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(void){
    long count=0;
    long A,B,C;
    scanf("%ld %ld %ld",&A,&B,&C);

    
    while(A%2==0 && B%2==0 && C%2==0){
        if(A==B && B==C){
            printf("-1\n");
            return 0;
        }
        int splitA=A/2;
        int splitB=B/2;
        int splitC=C/2;
        A=splitB+splitC;
        B=splitA+splitC;
        C=splitA+splitB;
        count++;
    }

    printf("%ld\n",count);

    return 0;
}

Measured memory_bytes: 1700
n=int(input())
a=list(map(int,input().split()))
i=0
con=1
mod=10**18
ans=1
why=0
while con==1:
  ans=ans*a[i]
  i+=1
  if ans>mod and i!=n:
    ans=1
    why=1
  elif ans>mod and i==n:
    con=0
    ans=1
    why=1
  elif i==n:
    con=0
if ans==0:
  print(0)
elif why==1:
  print(-1)
else:
  print(ans)


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


int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> C(H,vector<char>(W));
  vector<vector<char>> C2(2*H,vector<char>(W));
  
  for(int i = 0;i<H;i++){
    for(int j = 0;j<W;j++){
      cin >> C[i][j];
    }
  }
  for(int i = 0;i<H;i++){
    for(int j = 0;j<W;j++){
      C2[2*i][j] = C[i][j];
      C2[2*i+1][j] = C[i][j];
    }
  }
   for(int i = 0;i<2*H;i++){
    for(int j = 0;j<W;j++){
  cout << C2[i][j];
      if(j == W-1) cout << endl;
    }
   }
}

  
  

Measured memory_bytes: 256
wo1 = gets.chomp.split("")
wo2 = gets.chomp.split("")
ans = Array.new(26, "+")
leng = wo1.length
count = 0

for i in 0..leng - 1
  if wo1[i] == "a"
    count = 0
  elsif wo1[i] == "b"
    count = 1
  elsif wo1[i] == "c"
    count = 2
  elsif wo1[i] == "d"
    count = 3
  elsif wo1[i] == "e"
    count = 4
  elsif wo1[i] == "f"
    count = 5
  elsif wo1[i] == "g"
    count = 6
  elsif wo1[i] == "h"
    count = 7
  elsif wo1[i] == "i"
    count = 8
  elsif wo1[i] == "j"
    count = 9
  elsif wo1[i] == "k"
    count = 10
  elsif wo1[i] == "l"
    count = 11
  elsif wo1[i] == "m"
    count = 12
  elsif wo1[i] == "n"
    count = 13
  elsif wo1[i] == "o"
    count = 14
  elsif wo1[i] == "p"
    count = 15
  elsif wo1[i] == "q"
    count = 16
  elsif wo1[i] == "r"
    count = 17
  elsif wo1[i] == "s"
    count = 18
  elsif wo1[i] == "t"
    count = 19
  elsif wo1[i] == "u"
    count = 20
  elsif wo1[i] == "v"
    count = 21
  elsif wo1[i] == "w"
    count = 22
  elsif wo1[i] == "x"
    count = 23
  elsif wo1[i] == "y"
    count = 24
  elsif wo1[i] == "z"
    count = 25
  end
  if ans[count] == "+"
    ans[count] = wo2[i]
  else
    if wo2[i] != ans[count]
      puts "No"
      exit
    end
  end
end

ans = Array.new(26, "+")

for i in 0..leng - 1
  if wo2[i] == "a"
    count = 0
  elsif wo2[i] == "b"
    count = 1
  elsif wo2[i] == "c"
    count = 2
  elsif wo2[i] == "d"
    count = 3
  elsif wo2[i] == "e"
    count = 4
  elsif wo2[i] == "f"
    count = 5
  elsif wo2[i] == "g"
    count = 6
  elsif wo2[i] == "h"
    count = 7
  elsif wo2[i] == "i"
    count = 8
  elsif wo2[i] == "j"
    count = 9
  elsif wo2[i] == "k"
    count = 10
  elsif wo2[i] == "l"
    count = 11
  elsif wo2[i] == "m"
    count = 12
  elsif wo2[i] == "n"
    count = 13
  elsif wo2[i] == "o"
    count = 14
  elsif wo2[i] == "p"
    count = 15
  elsif wo2[i] == "q"
    count = 16
  elsif wo2[i] == "r"
    count = 17
  elsif wo2[i] == "s"
    count = 18
  elsif wo2[i] == "t"
    count = 19
  elsif wo2[i] == "u"
    count = 20
  elsif wo2[i] == "v"
    count = 21
  elsif wo2[i] == "w"
    count = 22
  elsif wo2[i] == "x"
    count = 23
  elsif wo2[i] == "y"
    count = 24
  elsif wo2[i] == "z"
    count = 25
  end
  if ans[count] == "+"
    ans[count] = wo1[i]
  else
    if wo1[i] != ans[count]
      puts "No"
      exit
    end
  end
end


puts "Yes"


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

int n, cnt = 0, now;
bool ch[100005] = {0};
int a[100005] = {0};

int main() {
  cin >> n;
  for(int i = 1; i <= n; ++i) cin >> a[i];
  now = 1;
  while(!ch[now]) {
    ch[now] = 1;
    now = a[now];
    ++cnt;
    if(now == 2) {
      cout << cnt << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 768
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	final int N, A, B, C, D;
	final char[] S;
	final Set<String> checked = new HashSet<String>();

	Main(int n, int a, int b, int c, int d, char[] s) {
		N = n;
		A = a;
		B = b;
		C = c;
		D = d;
		S = s;
	}

	public static void main(String[] args) {
		Main m;
		try (Scanner s = new Scanner(System.in)) {
			m = new Main(s.nextInt(),
					s.nextInt(),
					s.nextInt(),
					s.nextInt(),
					s.nextInt(),
					s.next().toCharArray());
		}

		if (m.move(m.A, m.B)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	boolean move(int a, int b) {
		if (a == C && b == D) {
			return true;
		}

		if ((a < b && checked.contains("*," + b)) || (a > b && checked.contains(a + ",*"))) {
			return false;
		}

		if (a > C) {
			return false;
		}

		if (b > D) {
			return false;
		}

		if (a == b) {
			return false;
		}

		if (S[b - 1] == '#') {
			return false;
		}

		if (S[a - 1] == '#') {
			return false;
		}

		boolean x = move(a + 2, b);
		if (!x) {
			if (a >= b) {
				checked.add((a + 2) + ",*");
			}
			x = move(a, b + 2);
		}
		if (!x) {
			if (a <= b) {
				checked.add("*," + (b + 2));
			}
			x = move(a + 1, b);
		}
		if (!x) {
			if (a >= b) {
				checked.add((a + 1) + ",*");
			}
			x = move(a, b + 1);
		}
		if (!x) {
			if (a <= b) {
				checked.add("*," + (b + 1));
			}
		}
		return x;
	}
}


Measured memory_bytes: 127824
N,K = map(int,input().split())
h = list(map(int,input().split()))

INF = float('inf')

#DPテーブル
dp = [INF] * N

#最初のコストは0
dp[0] = 0
dp[1] = abs(h[1]-h[0])
#最小化問題
#i番目のコストの最小値は、i-1 から i -k 番目までのコストから
# iまでのコストを足したものの中から最も小さいも
for i in range(2,N):
    for j in range(1,K+1):
        if i - j < 0:
            continue
        dp[i] = min(dp[i],dp[i-j] + abs(h[i]-h[i-j]))

print(dp[N-1])


Measured memory_bytes: 55392
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define Test(tt) cout << "Case #" << tt << ": "

using namespace std;



int main() {
#ifdef HOME
    ifstream cin("A.in");
    ofstream cout("A.out");
#endif
    //int ;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
	
	string str;
	cin >> str;
	for(auto it : str) {
		if(it == '?') {
			cout << 'D';
		}
		else {
			cout << it;
		}
	}

    return 0;
}


Measured memory_bytes: 3748
#include "bits/stdc++.h"
using namespace std;
#define LL long long

bool Check(string s,LL n){
    string r=s;
    reverse(r.begin(),r.end());
    if(s==r)return true;
    else return false;
}
 

void solve() {
    LL n;
    scanf("%lld",&n);
     double m=n/3.0;
    //cout<<setprecision(12)<<(n/3)
    printf("%.12lf\n",m*m*m);
}

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

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

int main(){
    int t;
    cin >> t;
    double d[t+1] = {};
    for(int i = 0; i < t+1; i++){
        int n, m;
        cin >> n >> m;
        double a[m], b[m], sum = 0.0;
        for(int j = 0; j < m; j++){
            cin >> a[j] >> b[j];
            sum += b[j];
        }
        for(int j = 0; j < m; j++){
            d[i] += a[j]*b[j]/sum;
        }
    }
    for(int i = 0; i < t; i++){
        if(d[i] > d[t]+0.0000001){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define all(v) v.begin(), v.end()
    

int main(){
  ll N,ma=0,mi=INF,k=1;
  cin >> N;
  vec A(N);
  rep(i,N){
    cin >> A.at(i);
    if(ma==A.at(i)){
      k++;
    }else if(A.at(i)>ma){
      ma=max(ma,A.at(i));
      k=1;
    }
    mi=min(mi,A.at(i));
  }
  if(ma-mi>1){
    cout << "No" << endl;
    return 0;
  }
  if(ma-mi==0){
    if(N/2>=ma||N==ma+1){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }else{
    if(ma>N-k&&2*(ma-N+k)<=k){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 4008
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  int h,w;
  cin >> h >> w;
  rep(i,h){
    rep(j,w){
      string s;
      cin >> s;
      if (s=="snuke"){
        char t='A'+j;
        string g=to_string(i+1);
        cout << t << g << endl;
      }
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define T second.first
#define C second.second
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int,pair<int,int>> piii;

const int N= 1e5+5, L = 14, OO = 0x3f3f3f3f;
const ll M=10 ;
const double ESP = 1e-8;

int n;
int A[N], dp[N];
int main(){
    FIO
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    cin>>n;
    for(int i=0; i<n; i++)cin>>A[i];
    memset(dp, OO, sizeof dp);
    dp[0] = 0;
    for(int i=0; i<n; i++){
        if(i+1<n){
            dp[i+1] = min(dp[i+1], dp[i] + abs(A[i]-A[i+1]));
        }
        if(i+2<n){
            dp[i+2] = min(dp[i+2], dp[i] + abs(A[i]- A[i+2]));
        }
    }
    cout<<dp[n-1];

}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

struct Edge {
  int to, cost, time;
  Edge(int to, int cost, int time) : to(to), cost(cost), time(time) {}
};

i64 dp[50][2551];

void solve() {
  int n, m, s;
  cin >> n >> m >> s;
  amin(s, 2500);
  vector<vector<Edge>> g(n);
  rep(i, m) {
    int u, v, a, b;
    cin >> u >> v >> a >> b;
    u--, v--;
    g[u].emplace_back(v, a, b);
    g[v].emplace_back(u, a, b);
  }
  vi32 cs(n), ds(n);
  rep(i, n) {
    int c, d;
    cin >> c >> d;
    cs[i] = c, ds[i] = d;
  }
  rep(i, 50) repc(j, 2550) dp[i][j] = 1e18;
  pqasc<tuple<i64, int, int>> q;
  q.emplace(0, s, 0);
  while (sz(q)) {
    i64 t;
    int s, u;
    tie(t, s, u) = q.top(), q.pop();
    if (dp[u][s] != 1e18) continue;
    dp[u][s] = t;
    if (s + cs[u] <= 2550 && dp[u][s + cs[u]] == 1e18) {
      q.emplace(t + ds[u], s + cs[u], u);
    }
    each(e, g[u]) {
      if (s - e.cost < 0) continue;
      if (dp[e.to][s - e.cost] != 1e18) continue;
      q.emplace(t + e.time, s - e.cost, e.to);
    }
  }
  reps(i, n - 1) {
    i64 ans = 1e18;
    repc(j, 2550) amin(ans, dp[i][j]);
    cout << ans << endl;
  }
}

Measured memory_bytes: 8360
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


//https://www.instagram.com/p/B_Z9Oxdp-Kh/
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int pwmd(int a, int n)
{
	if (!n)
		return 1;
	int pt = pwmd(a, n / 2);
	pt *= pt, pt %= mod;
	if (n & 1)
		pt *= a, pt %= mod;
	return pt;
}
int pow(int a,int b)
{
	int ans=1;
	while(b>0)
	{
		if(b&1)
			ans*=a;
		a*=a;
		b=b>>1;
	}
	return ans;
}
vector<pair<int,int>> vec;
bool compare(pair<int,int> v1,pair<int,int> v2)
{
	return v1.ss<v2.ss;
}
int32_t main()
{       
    FIO;
    int a1[3],a2[3];
    cin>>a1[1]>>a2[1]>>a1[2]>>a2[2];
    int c=1;

    while(true)
    {
    	if(a1[c]<=0)
    	{
    		if(c==1)
    			cout<<"No";
    		else
    			cout<<"Yes";
    		return 0;
    	}

    	a1[3-c]-=a2[c];
    	c=3-c;
    }

}

Measured memory_bytes: 3656
n,x = map(int,input().split(" "))

array = list(map(int,input().split(" ")))
array = sorted(array)
ans = 0
for i in range(n-1):
    x = x - array[i]
    if x < 0:
        break
    ans += 1
if x == array[-1]:
    ans += 1
print(ans)

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

using namespace std;

const int MAX = 200000; // 欲しい最大数に応じて変動
const int MOD = 1000000007; // 10^9+7用mod

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

int main() {
  
  COMinit();
  
  int h,w,a,b;
  cin >> h >> w >> a >> b;
  int count=0;
  int small=min((h-a),(w-b));
  
  for(int i=0; i<small; i++){
    count = ( count + COM((b+h-a-1),(b+i))%MOD * COM((a+w-b-1),(a+i))%MOD )%MOD;
  }
  
  cout << count << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define INF 1e18
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N, D;
    cin >> N >> D;

    print(ceil((float)N/(2*D+1)));
}

int main()
{
    solve();

    return 0;
}


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

#define vll vector<ll>
#define max_heap priority_queue<int>
#define min_heap priority_queue<int , vector<int>, greater<int> >
#define pb push_back

#define all(container) container.begin(), container.end()

int main()
{

	int a,b;

	cin >> a >> b;

	if ( a != 2 && b != 2 )
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	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 = -1;
		int x = -1;
		int ans = 0;

		while(true){
			ans = 0;
			n = sc.nextInt();
			x = sc.nextInt();
			if(n == 0 && x == 0){
				break;
			}
			for(int i = 1; i <= n; i++){
				for(int j = i + 1; j <= n; j++){
					for(int k = j + 1; k <= n; k++){
						if(!( i == k || j == k || i == j)){
							if(i + j + k == x){
								ans++;
							}
						}
					}
				}
			}
			System.out.println(ans);
		}
	}
}




Measured memory_bytes: 26704
#include <stdio.h>
int main()
{
  int dice[6],q,ins[2],p0,p1,p2;
  int vector[6][4]={{4,2,1,3},{0,2,5,3},{0,4,5,1},{0,1,5,4},{0,3,5,2},{1,2,4,3}};
  int i,j;
  for(i=0;i<6;i++)
  {
    scanf(" %d",&dice[i]);
  }
  scanf(" %d",&q);
  for(i=0;i<q;i++)
  {
    for(j=0;j<2;j++)
    {
      scanf(" %d",&ins[j]);
    }
    for(j=0;j<6;j++)
    {
      if(dice[j]==ins[0])p0=j;
    }
    for(j=0;j<6;j++)
    {
      if(dice[j]==ins[1])p1=j;
    }
    for(j=0;j<4;j++)
    {
      if(vector[p0][j]==p1)p2=j;
    }
    if(p2==0)printf("%d\n",dice[vector[p0][3]]);
    else printf("%d\n",dice[vector[p0][p2-1]]);
  }
  return 0;
}


Measured memory_bytes: 2056
x, y=map(int, input().split())
map={1:300000, 2:200000, 3:100000}
a=0
if x==1 and y==1:
  a+=1000000
elif x in [1,2,3]:
  a+=map[x]
  if y in [1,2,3]:
    a+=map[y]
else:
  if y in [1,2,3]:
    a+=map[y]
    
print(a)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<bitset>
#include<iomanip>
using namespace std;
const int inf = 1001001000;

void print(vector<vector<int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}



//深さ優先探索のテンプレ.デフォルトでは参照渡ししたsetに探索済みの頂点が格納される.
//graphは隣接リスト.vは探索開始地点.seenは空のセット
void dfs(vector<vector<int>> &graph, int v, set<int> &seen, vector<int> &counter, int px){
	seen.insert(v);
	counter[v] += px;
	for (int i=0;i<graph[v].size();i++){
		int nxt = graph[v][i];
		if (seen.count(nxt)) continue;
		dfs(graph, nxt, seen, counter, counter[v]);
	}
}

int main(){
	int n, q; cin >> n >> q;
	vector<vector<int>> graph(n,vector<int>());
	vector<int> counter(n,0);
	for (int i = 0; i < n-1; i++){
		int a, b; cin >> a >> b;
		graph[a-1].push_back(b-1);
		graph[b-1].push_back(a-1);
	}
	for (int i = 0; i < q; i++){
		int p, x; cin >> p >> x;
		counter[p-1] += x;
	}
	set<int> seen;
	dfs(graph, 0, seen, counter, 0);
	print(counter);


	return 0;
}

Measured memory_bytes: 36736
use std::io;

fn read<T: std::str::FromStr>() -> Vec<T> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().split(' ').flat_map(str::parse).collect()
}

fn main() {
    let mut l1 = read::<u32>();

    l1.sort();

    let a = l1[0];
    let b = l1[1];
    let c = l1[2];

    println!("{} {} {}", a, b, c);
}



Measured memory_bytes: 5028
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[m];
        int[] b = new int[m];
        for(int i = 0; i < m; i++){
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        int count = 0;
        for(int i = 1; i <= n; i++){
            for(int j = 0; j < m; j++){
                if(a[j] == i || b[j] == i){
                    count++;
                }
            }
            System.out.println(count);
            count = 0;
        }
    }
}

Measured memory_bytes: 23636
N = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

ans = 0
for i in range(N):
    b = b_list[i]
    a1 = a_list[i]
    a2 = a_list[i+1]

    if b >= a1:
        tmp = a1
        ans += tmp
        b -= tmp
        if b > 0:
            if b >= a2:
                tmp2 = a2
                ans += tmp2
                a_list[i+1] -= tmp2
            else:
                ans += b
                a_list[i+1] -= b
    else:
        ans += b

print(ans)


Measured memory_bytes: 18624