akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define ip pair<ll,ll>
#define vii vector<ll>
#define vpp vector<ip>
#define vdd vector<ld>
#define vb vector<bool>
#define pi  pair<ll,ip>
#define sc(x) scanf("%lli",&x)
#define c(x) cin >> x
#define fo(i,k,n) for( int i=k;i<n;i++)
#define hu 200010
#define pq priotity_queue<ll>
#define pqs priority_queue<ll,vii,greater<ll>>
#define ppq priority_queue<ip,vpp,greater<ip>>
#define INF INT_MAX
#define ff first
#define ss second
using namespace std;
const ll M = 1000000000+7;
//Grid Movement
ll dx[] = {-1, 0, 1, 0};
ll dy[] = {0, -1, 0, 1};

ld Pi= acos(-1);

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

ll mex(ll x, ll y) 
{ 
	ll res = 1;	  
	x = x % M; 
	if (x == 0) return 0; 
	while (y > 0) 
	{ 
		if (y & 1) 
		res = (res*x) % M; 
		y = y>>1; 
		x = (x*x) % M; 
	} 
	return res; 
} 

bool comp(ll comp1,ll comp2)
{
    return comp1>comp2;
}

void yes()
{
    printf("YES\n");
}

void no()
{
    printf("NO\n");
}

ll inv(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
 
    if (m == 1)
      return 0;
 
    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
 
    if (x < 0)
       x += m0;
 
    return x;
}

void sieve(ll n)
{
    vii primes(n+1);
    vb is_prime(n+1);
	is_prime.resize(n+1);
	primes.resize(n+1);
 
	is_prime[0] = is_prime[1] = false;
	for(int i = 2; i<=n; i++)
	{
	    if(is_prime[i])
	    {
	    	primes.pb(i);
	        for (int j = i*i; j<=n; j+=i)
	            is_prime[j] = false;
	    }
	}
}
ll n,m;
vii vec[hu];
ll vis[hu] ={0};

ll siz = 0;
void dfs(ll node)
{
    vis[node] = 1;
    for(auto it:vec[node])
    {
        if(!vis[it])
        {
            siz++;
            dfs(it);
        }
        
    }
    
}
void solve()
{
   sc(n);
   sc(m);
   fo(i,0,m)
   {
       ll a,b;
       sc(a);
       sc(b);
       vec[a].pb(b);
       vec[b].pb(a);
   }
  ll cnt = 0;
   fo(i,1,n+1)
   {
       if(!vis[i])
       {
           siz = 1;
           dfs(i);
           cnt = max(cnt,siz);
       }
       
   }
   
   cout << cnt;
   
}

int main()
{
//	ios_base::sync_with_stdio(0); cin.tie(0);
    ll t=1;
 //   sc(t);
    while(t--) solve();
}





Measured memory_bytes: 22412
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdio>
#include <list>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecstr vector<string>
#define vecch vector<char>
#define vecpii vector<pii>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
int main(){
    int h=in(),w=in();
    queue<pair<pair<int,int>,int>> q;
    vector<vector<bool>> done(h,vector<bool>(w,false));
    rep(i,h){
        string s=stin();
        rep(j,s.length())if(s.at(j)=='#'){
            q.push(make_pair(make_pair(i,j),0));
            done[i][j]=true;
        }
    }
    int ans=0;
    while(!q.empty()){
        int x=q.front().first.first,y=q.front().first.second,z=q.front().second;
        q.pop();
        ans=max(ans,z);
        if(x>0)if(!done[x-1][y]){
            q.push(make_pair(make_pair(x-1,y),z+1));
            done[x-1][y]=true;
        }
        if(y>0)if(!done[x][y-1]){
            q.push(make_pair(make_pair(x,y-1),z+1));
            done[x][y-1]=true;
        }
        if(x<h-1)if(!done[x+1][y]){
            q.push(make_pair(make_pair(x+1,y),z+1));
            done[x+1][y]=true;
        }
        if(y<w-1)if(!done[x][y+1]){
            q.push(make_pair(make_pair(x,y+1),z+1));
            done[x][y+1]=true;
        }
    }
    cout<<ans<<endl;
}

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

using namespace std;

int main(){
    int N,ans=0,maxcom=0;
    string s,t;
    cin >> N;
    cin >> s >> t;

    for(int i=0;i<N;i++){
        int j=0;
        if(t[0]==s[N-1-i]){
            while(t[j]==s[N-1-i+j] && j!=i+1){
                    j++;
            }
            if(j==i+1){
                maxcom = i+1;
            }
        }
    }

    cout << 2*N - maxcom << endl;
}

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

void solve(){
    int N; cin >> N;
    int a[N];
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    long long ans = 1LL << 60;
    for(int i = -100; i <= 100; ++i){
        long long sum = 0;
        for(int j = 0; j < N; ++j){
            sum += (a[j]-i) * (a[j]-i);
        }
        if(sum < ans) ans = sum;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3608
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<time.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INI(n) scanf("%d",&n)
#define INL(n) scanf("%lld",&n)
#define INF 10000000000
#define mod 1000000007
#define X 100000
#define N 20
#define M 46
typedef long long int ll;
ll finv[X];
ll fac[X];
ll inv[X];
ll usort(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll dsort(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll ssort(const void *a, const void *b){return strcmp((char*)a,(char*)b);}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll z(ll a){return max(a,-a);}
ll gcd(ll a,ll b){if(!b){return a;}else{return gcd(b,a%b);}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll kt(ll a){
  ll sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
ll ks(ll a){
  ll sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
void nCrReady(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (ll i=2;i<X;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 nCr(ll n,ll k){return fac[n]*(finv[k]*finv[n-k]%mod)%mod;}

ll x[200001];
int main(void){
  char s[7];
  scanf("%s",s);
  char c[2][4]={"No","Yes"};
  PRS(c[s[2]==s[3]&&s[4]==s[5]]);
  return 0;
}

Measured memory_bytes: 1640
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int r;
	cin >> r;
	cout << r * r << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")

#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pii>
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define clr(x, y) memset(x,y,sizeof(x));
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define rep(i, m, n) for(int i=m ; i<n ; i++)
#define forr(i, m, n) for(int i=m ; i<=n ; i++)
#define endl '\n'
#define pb push_back
#define re return
const int N = 1e5 + 5;
const ll mod = 1e9 + 7;
using namespace std;

int main() {
    IO;
    int n, x = -1, y = -1,xx=-1,yy=-1, cnt = 1;
    cin >> n;
    vi a(n), b(n), arr(n);
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, n) cin >> b[i];
    arr = a;
    sort(all(arr));
    do {

        if (x == -1) {
            if (arr == a) {
                x = cnt;
            }
        }
        if (y == -1) {
            if (arr == b) {
                y = cnt;
            }
        }
        cnt++;

    } while (next_permutation(all(arr)));

    cout << abs(x - y);


}


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

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

  ll T1, T2, A1, A2, B1, B2;
  cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
  ll C1 = A1 - B1, C2 = A2 - B2;

  if (C1 > 0 && C2 > 0) {
    cout << 0 << '\n';
    return 0;
  }
  if (C1 < 0 && C2 < 0) {
    cout << 0 << '\n';
    return 0;
  }
  if (C1 < 0) {
    C1 = -1 * C1; C2 = -1 * C2;
  }
  ll TOP1 = T1 * C1, BOTTOM1 = TOP1 + T2 * C2, TOP2 = BOTTOM1 + T1 * C1;
  if (BOTTOM1 > 0) {
    cout << 0 << '\n';
    return 0;
  }
  if (TOP1 == TOP2) {
    cout << "infinity" << '\n';
    return 0;
  }

  ll BET = TOP1 - TOP2;
  ll times = TOP1 / BET;
  ll ans = 0;
  if (TOP1 % BET == 0) {
    ans = times * 2;
  } else {
    ans = times * 2 + 1;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
//C - たくさんの数式
//Hiia
#include <stdio.h>
typedef long long ll;

int llruijou(long long int base,long long int exponent){long long int ii,answer=1;ii=exponent;while(ii!=0){answer=answer*base;--ii;}return answer;}//ruijou base^exponent
long long int llketasuu(long long int x){
  ll jjj=0;
  while(x!=0){
    x/=10;
    jjj++;
  }
  return(jjj);
}

int main()
{
  ll s,ans=0;
  scanf("%lld", &s);
  ll keta=llketasuu(s);
  for(ll i=1;i<=keta;i++){
    if(i==1){
      ans+=(s%10)*llruijou(2,keta-1);
    }
    else{
      ans+=((s/llruijou(10,i-1))%10)*llruijou(2,keta-2)*((9*llruijou(5,i-1) - 1)/4);
    }
  }
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 1680
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 123456;
const LL MOD = (LL)1e9 + 7;
char S[MAXN * 2];

void NO() {
     puts("0");
     exit(0);
}

int main() {
    int N;
    scanf("%d", &N);
    scanf("%s", S);
    LL ans = 1, cnt1 = 0;
    if (S[0] == 'W') NO();
    for (int i = 0; i < 2 * N; i++) {
        int cur = 0;
        if (S[i] == 'B') cur = 1;
        int type = cur ^ (cnt1 % 2);
        if (type) {
           if (cnt1 + 1 > (2 * N - i)) NO();
           cnt1++;
        } else {
           ans = (ans * cnt1) % MOD;
           cnt1--;
        }
        //printf("i = %d cnt1 = %lld\n", i, cnt1);
    }
    for (int i = 1; i <= N; i++) {
        ans = (ans * i) % MOD;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 384
def main():
    N = int(input())

    def trial_division(n):
        divs = []
        for i in range(1, int(n**0.5)+1):
            if n % i == 0 and i != n//i:
                divs.append((i, n//i))
            elif n % i == 0 and i == n//i:
                divs.append((i, i))
        return divs
    divs = trial_division(N)
    ans = 10**13
    for d1, d2 in divs:
        ans = min(ans, d1 + d2 - 2)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39152
n=int(input())
l=[0]*6
for i in range(n):
    k=float(input())
    if k<165:l[0]=l[0]+1
    else:
        l[int((k-160)//5)]=l[int((k-160)//5)]+1
for i in range(6):
    m=f"{i+1}:"
    for j in range(l[i]):
        m+="*"
    print(m)


Measured memory_bytes: 5632
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a = [str(input()) for _ in range(5)]

n = 10
cnt = 0

for i in range(len(a)):
	if int(a[i][-1]) < n and int(a[i][-1]) != 0 :
		n = int(a[i][-1])
		cnt = i

for i in range(len(a)):
	if i == cnt:
		a[i] = int(a[i])
	elif int(a[i][-1]) == 0:
		a[i] = int(a[i])
	else:
		a[i] = (int(a[i])//10 + 1)*10

print(sum(a))

Measured memory_bytes: 9224
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>

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

void solve()
{
	unsigned long long int N, A, B;
	cin >> N >> A >> B;
	if (N == 1)
	{
		if (A == B)
		{
			cout << 1 << endl;
			return;
		}
		cout << 0 << endl;
		return;
	}
	if (A > B)
	{
		cout << 0 << endl;
		return;
	}
	N -= 2;
	unsigned long long int minSum = A * N;
	unsigned long long int maxSum = B * N;
	cout << maxSum - minSum + 1 << endl;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }
ll mod = 1000000007;
ll modsize;

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

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a%mod;
		a = a * a%mod;
		b >>= 1;
	}
	return ans;
}

vector<ll> fac(modsize + 5);
vector<ll> inv(modsize + 5);
vector<ll> facinv(modsize + 5);

void modcalc() {
	fac[0] = fac[1] = 1; inv[1] = 1;
	facinv[0] = facinv[1] = 1;
	for (int i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0) return 0;
	if (n == 0 && k == 0) return 1;
	return modcomb(n + k - 1, k);
}

template<class T>
class segtree {
	int n;
	vector<T> data;
	T def;
	function<T(T, T)> operation;
	function<T(T, T)> update;
	T _query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return def;
		if (a <= l && r <= b) return data[k];
		T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
		T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
		return operation(c1, c2);
	}
public:
	segtree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update)
		:def(_def), operation(_operation), update(_update) {
		n = 1;
		while (n < _n) {
			n *= 2;
		}
		data = vector<T>(2 * n - 1, def);
	}
	void change(int i, T x) {
		i += n - 1;
		data[i] = update(data[i], x);
		while (i > 0) {
			i = (i - 1) / 2;
			data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
		}
	}
	T query(int a, int b) {
		return _query(a, b, 0, 0, n);
	}
	T operator[](int i) {
		return data[i + n - 1];
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();
	
	int n, h, w;
	cin >> n >> h >> w;
	int ans = 0;
	int a, b;
	rep(i, n) {
		cin >> a >> b;
		ans += (a >= h)&(b >= w);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
/*
【入場料金】
	アイヅ温泉には、浴場とプールがあり、
	浴場を利用するには入浴券(nyuyoku_ticket)を、
	プールを利用するにはプール券(pool_ticket)をそれぞれ買う必要があります。
	これらの券の値段は、日によって変わるかもしれません。
	また、アイヅ温泉には以下のようなルールがあります。
		券は購入当日１回の利用に限り有効。
		「入浴券５枚以上かつプール券２枚以上」でまとめて買うと、すべての券が２割引になる。
	
	温泉好きの貞吉さんとその友人たちは、アイヅ温泉に毎日のように通っています。
	彼らは皆気まぐれで、日によって使う枚数は異なります。
	アイヅ温泉には割引ルールがあるため、グループで協力して上手に買えば、
	合計料金を安く済ますことができるかもしれません。
	
	入浴券とプール券の料金、使用する入浴券の枚数とプール券の枚数が入力として与えられたとき、
	最も安い合計料金を出力するプログラムを作成してください。
	ただし、使用する枚数より多く券を買うことで合計料金が安くなるなら、
	買った券すべてを使わなくともよいものとします。
	
	１行目のN(1 ? N ? 365)は料金を計算したい日数である。
	続くN行に、i日目の入浴券の料金xi(100 ? xi ? 1000)、
	プール券の料金yi(100 ? yi ? 1000)、
	使用する入浴券の枚数bi(0 ? bi ? 6)、					←最大6人
	使用するプール券の枚数pi(0 ? pi ? 6)が与えられる。		←最大6人
	入浴券とプール券共に料金は50円刻みである。
	
	それぞれの日について最も安い合計料金を１行に出力する。
*/

#include <stdio.h>
#define		DAYS	365		// 最大何日か？

int main(void)
{
	int n, i;
	int nyuyoku_ticket[DAYS], pool_ticket[DAYS];
	int	nyuyoku_member[DAYS], pool_member[DAYS];
	int seiki_ryoukin[DAYS], waribiki_ryoukin[DAYS], saiyasune[DAYS];
	
	scanf( "%d", &n );
	for( i = 0; i < n; i++ )
	{
		scanf( "%d %d %d %d", &nyuyoku_ticket[i], &pool_ticket[i], &nyuyoku_member[i], &pool_member[i] );
		if( nyuyoku_member[i] >= 5 && pool_member[i] >= 2 )
		{
			seiki_ryoukin[i] = ( ( ( nyuyoku_ticket[i] * nyuyoku_member[i] ) + ( pool_ticket[i] * pool_member[i] ) ) * 8 ) / 10;
			saiyasune[i] = seiki_ryoukin[i];
		}
		else if( nyuyoku_member[i] >= 5 )
		{
			seiki_ryoukin[i] = ( nyuyoku_ticket[i] * nyuyoku_member[i] ) + ( pool_ticket[i] * pool_member[i] );
			waribiki_ryoukin[i] = ( ( ( nyuyoku_ticket[i] * nyuyoku_member[i] ) + ( pool_ticket[i] * 2 ) ) * 8 ) / 10;
			if( seiki_ryoukin[i] >= waribiki_ryoukin[i] )
			{
				saiyasune[i] = waribiki_ryoukin[i];
			}
			else
			{
				saiyasune[i] = seiki_ryoukin[i];
			}
		}
		else if( pool_member[i] >= 2 )
		{
			seiki_ryoukin[i] = ( nyuyoku_ticket[i] * nyuyoku_member[i] ) + ( pool_ticket[i] * pool_member[i] );
			waribiki_ryoukin[i] = ( ( ( nyuyoku_ticket[i] * 5 ) + ( pool_ticket[i] * pool_member[i] ) ) * 8 ) / 10;
			if( seiki_ryoukin[i] >= waribiki_ryoukin[i] )
			{
				saiyasune[i] = waribiki_ryoukin[i];
			}
			else
			{
				saiyasune[i] = seiki_ryoukin[i];
			}
		}
		else
		{
			seiki_ryoukin[i] = ( nyuyoku_ticket[i] * nyuyoku_member[i] ) + ( pool_ticket[i] * pool_member[i] );
			waribiki_ryoukin[i] = ( ( ( nyuyoku_ticket[i] * 5 ) + ( pool_ticket[i] * 2 ) ) * 8 ) / 10;
			if( seiki_ryoukin[i] >= waribiki_ryoukin[i] )
			{
				saiyasune[i] = waribiki_ryoukin[i];
			}
			else
			{
				saiyasune[i] = seiki_ryoukin[i];
			}
		}
	}
	for( i = 0; i < n; i++ )
	{
		printf( "%d\n", saiyasune[i] );
	}
	return 0;
}


Measured memory_bytes: 2124
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

X, Y = map(int, input().split())
mod = 10**9 + 7

x,xm = divmod(X*2-Y, 3)
y,ym = divmod(-X+Y*2, 3)
if (xm == 0) & (ym==0)& (x>=0) & (y>=0):
    print(combination(x+y, x, mod))
else:
    print(0)



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

int main() {
	int s,cnt = 1;
	bool t = true;
	cin >> s;
	if (s == 4 || s == 2 || s == 1) {
		cout << 4 << endl;
		t = false;
	}
	while (true){
		if (s % 2 == 0) {
			s = s / 2;
		} else {
			s = 3 * s + 1;
		}
		cnt++;
		if (s == 4) {
			break;
		}
	}
	if (t) {
		cout << cnt + 3 << endl;
	}
}


Measured memory_bytes: 256
a = int(input())

if 400 <= a <= 599:
    print("8")
if 600 <= a <= 799:
    print("7")
if 800 <= a <= 999:
    print("6")
if 1000 <= a <= 1199:
    print("5")
if 1200 <= a <= 1399:
    print("4")
if 1400 <= a <= 1599:
    print("3")
if 1600 <= a <= 1799:
    print("2")
if 1800 <= a <= 1999:
    print("1")


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

using namespace std;

int main(void) {
	int n, k;
	int total = 0;
	int x[101];

	cin >> n >> k;
	
	for (int i = 1; i <= n; i++) {
		cin >> x[i];
	}

	for (int i = 1; i <= n; i++) {
		total += min(2 * x[i], 2 * abs(x[i] - k));
	}

	cout << total << endl;

	return 0;
}

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

int main() {
  ll N,M;
  cin >> N >> M;
  
  cout << N*(N-1)/2+M*(M-1)/2 << endl;
  return 0;
}

Measured memory_bytes: 3548
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;
typedef pair<int, int> pii;

vector<pii> normalize(vector<pii> v){
	const int n = v.size(), xofs = v[0].first, yofs = v[0].second;
	for(int i = 0; i < n; ++i){
		v[i].first -= xofs;
		v[i].second -= yofs;
	}
	if(v[1].first == 0){
		if(v[1].second > 0){
			for(int i = 0; i < n; ++i){
				v[i] = pii(v[i].second, -v[i].first);
			}
		}else{
			for(int i = 0; i < n; ++i){
				v[i] = pii(-v[i].second, v[i].first);
			}
		}
	}else if(v[1].first < 0){
		for(int i = 0; i < n; ++i){
			v[i] = pii(-v[i].first, -v[i].second);
		}
	}
	return v;
}

int main(){
	while(true){
		int n;
		cin >> n;
		if(n == 0){ break; }
		vector< vector<pii> > lines(n + 1);
		for(int i = 0; i <= n; ++i){
			int m;
			cin >> m;
			lines[i].resize(m);
			for(int j = 0; j < m; ++j){
				cin >> lines[i][j].first >> lines[i][j].second;
			}
			lines[i] = normalize(lines[i]);
			if(i > 0){
				vector<pii> rline = lines[i];
				reverse(rline.begin(), rline.end());
				rline = normalize(rline);
				if(lines[i] == lines[0] || rline == lines[0]){
					cout << i << endl;
				}
			}
		}
		cout << "+++++" << endl;
	}
	return 0;
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
#define maxn 200005
#define LL long long
using namespace std;

LL a,b,c;

int main(){
	scanf("%lld%lld%lld",&a,&b,&c);
	LL t = min(a,c);
	a-=t,c-=t;
	t = min(b,c);
	b-=t,c-=t;
	printf("%lld %lld\n",a,b);
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n;
  int64 k;
  cin >> n >> k;

  vector<int64> xs(n);
  vector<int64> ys(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> ys[i];
  }
  sort(xs.begin(), xs.end());
  sort(ys.begin(), ys.end());
  reverse(ys.begin(), ys.end());

  int64 x_sum = 0;
  for (int64 x : xs) x_sum += x;
  if (x_sum <= k) {
    cout << 0 << endl;
    return 0;
  }
  

  const int64 MAX = 1E12;
  int64 l = 0;
  int64 r = MAX;
  while (r - l >= 2) {
    int64 m = (l + r) / 2;
    int64 sum = 0;
    for (int i = 0; i < n; i++) {
      int64 x = m / ys[i];
      if (x < xs[i]) {
        sum += xs[i] - x;
      }
    }
    if (sum <= k) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << r << endl;
}

Measured memory_bytes: 3456
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A = int(readline())

    x = N % 500

    if x <= A:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 61852
#define _USE_MATH_DEFINES
#include <cmath>
#include<iostream>
#include<string>
using namespace std;
int main() {
	int A, B, ans;
	cin >> A >> B;
	ans = A + B;
	if (ans < A - B) {
		ans = A - B;
	}
	if (ans < A*B) {
		ans = A * B;
	}
	cout << ans << endl;
	
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    bool check = true;
    for(int i = 1; i < n; i++){
        if(s[i] != '9'){
            check = false;
            break;
        }
    }
    if(check){
        cout << s[0]-'0' + 9*(n-1) << endl;
    }else{
        cout << s[0]-'1' + 9*(n-1) << endl;
    }
    return 0;
}


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

int main(){
  int a, b, C;
  double pi, c, S, L, h;
  cin >> a >> b >> C;
  pi=acos(-1);
  S=a*b*sin(C*pi/180)/2;
  c=sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(C*pi/180));
  L=a+b+c;
  h=2*S/a;
  printf("%.5f\n%.5f\n%.5f\n",S,L,h);
  return 0;
}


Measured memory_bytes: 3344
#include <bits/stdc++.h>
typedef long long lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	string input;
	int count, ans;
	cin >> N;
	cin >> input;

	count = 0;

	for (int i = 1; i < N; i++)
	{
		if (input[i] == 'E')
		{
			count++;
		}
	}

	ans = count;

	for (int i = 0; i < N - 1; i++)
	{
		if (input[i] == 'W')
		{
			count++;
		}
		if (input[i + 1] == 'E')
		{
			count--;
		}
		ans = min(count, ans);
	}

	cout << ans << endl;

	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define drep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
// #pragma GCC optimize ("-O3")
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 _main() {
    int K, S;
    cin >> K >> S;
    int count = 0;
    rep(x, 0, K + 1) {
        rep(y, 0, K + 1) {
            int z = S - (x + y);
            if (z <= K && 0 <= z) count++;
        }
    }
    cout << count << endl;
}

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

int main() {
	int n = 0;
	int j = 0;
	scanf("%d", &n);
	for (int i = 1; i < 10; i++) {
		 if (n % i == 0 && n / i < 10) {
			printf("Yes");
			j++;
			break;
		}
	}
	if (j == 0)
		printf("No");

	return 0;
}

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

signed main(){

  int sx,sy,tx,ty; cin >> sx >> sy >> tx >> ty;

  queue<char> que;
  for(int i = 0; i < (tx-sx); i++){
    que.push('R');
    cout << que.back();
  }
  for(int i = 0; i < (ty-sy); i++){
    que.push('U');
    cout << que.back();
  }
  for(; !que.empty();que.pop()){
    cout << (que.front() == 'R' ? 'L' : 'D');
  }

  //2回目　
  cout << 'D';
  for(int i = 0; i < (tx-sx)+1; i++) cout << 'R';
  for(int i = 0; i < (ty-sy)+1; i++) cout << 'U';
  cout << 'L';

  cout << 'U';
  for(int i = 0; i < (tx-sx)+1; i++) cout << 'L';
  for(int i = 0; i < (ty-sy)+1; i++) cout << 'D';
  cout << 'R';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

vector <ll> v1,v2;
ll a[505],d[505],n,k,sum=0;

ll fn(ll x){
  forn(i,0,n) d[i]=a[i]%x;
  sort(d,d+n);
  ll l=0,r=n-1,steps=0,rem=0;
  while(l<=r){
    if(rem>=0){
      rem-=d[l];
      steps+=d[l];
      l++;
    }else{
      rem+=(x-d[r]);
      steps+=(x-d[r]);
      r--;
    }
  }
  if(rem!=0) return 0;
  if(steps>2*k) return 0;
  return 1;
}

int main()
{
  //ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  cin>>n>>k;
  forn(i,0,n) {cin>>a[i];sum+=a[i];}
  for(ll i=1;i*i<=sum;i++){
    if(sum%i==0){
      if(i*i==sum){
        v1.pb(i);
      }else{
        v1.pb(i);
        v2.pb(sum/i);
      }
    }
  }
  if(v2.size()!=0)
  forn_d(i,v2.size()-1,0){
    v1.pb(v2[i]);
  }
  //for(auto it:v1) cout<<it<<" ";
  //cout<<endl;
  ll ans=1;
  forn(i,0,sz(v1)){
    if(fn(v1[i])) ans=max(ans,v1[i]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <climits>
#include <utility>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int (i)=1;(i)<=(n);(i)++)

using namespace std;

int main(int argc, char const* argv[])
{
    size_t N,M;
    cin >> N >> M;
    vector<pair<int, int>> room(N+1);
    for(auto& elem : room){
        elem = make_pair(-1, -1);
    }
    room[1] = make_pair(-1, 0);
    unordered_map<size_t, vector<size_t>> room_dict;
    rep(i,M){
        size_t A,B;
        cin >> A >> B;
        room_dict[A].push_back(B);
        room_dict[B].push_back(A);
    }

    queue<size_t> q;
    unordered_set<size_t> memory;
    unordered_set<size_t> tabu;
    q.push(1);

    while(!q.empty()){
        size_t i = q.front();
        q.pop();
        memory.insert(i);
        size_t order = room[i].second;
        if(tabu.find(i) == tabu.end()){
            for(size_t adj_i : room_dict[i]){
                if(room[adj_i].second == -1 || order < room[adj_i].second){
                    room[adj_i] = make_pair(i, order + 1);
                    q.push(adj_i);
                }
            }
        }
        tabu.insert(i);
    }

    if(memory.size() != N){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
        for(int i=2; i<=N; i++){
            cout << room[i].first << endl;
        }
    }

    return 0;
}

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

using namespace std;

typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	int mn = 30;
	for(int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		for(int j = 30; j >= 0; j--)
			if(a % (1 << j) == 0){
				mn = min(mn, j);
				break;
			}
	}
	cout << mn;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
long a,save;
long sum = 0;
long n = 0;
int main() {
	scanf("%ld", &a);
	save = a;
	for (int i = 8; i >= 0; i--) {
		sum+=a/(long)pow(10, i);
		a = a%(long)pow(10, i);
	}
	if (save%sum == 0)printf("Yes");
	else printf("No");
}

Measured memory_bytes: 128
K = int(input())
N = len(input())

mod = 10 ** 9 + 7
div = pow(26, -1, mod)
comb_i = pow(26, K, mod)
ans = comb_i
for i in range(1, K + 1):
  comb_i = (comb_i * (N - 1 + i) * pow(i, -1, mod)) % mod
  comb_i = (comb_i * 25 * div) % mod
  ans = (ans + comb_i) % mod
  
print(ans)

Measured memory_bytes: 10892
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

template<typename T>
vector<vector<T>> add_banpei(const vector<vector<T>>& arr, const T& banpei) {
    int h = arr.size();
    int w = arr[0].size();
    vector<vector<T>> ret(h+2);
    ret[0] = vector<T>(w+2, banpei);
    ret.back() = vector<T>(w+2, banpei);
    rep(i, h) {
        ret[i+1] = arr[i];
        ret[i+1].insert(ret[i+1].begin(), banpei);
        ret[i+1].push_back(banpei);
    }
    return ret;
}

vector<string> add_banpei(const vector<string>& arr, const char& banpei) {
    int h = arr.size();
    int w = arr[0].size();
    vector<string> ret(h+2);
    ret[0] = string(w+2, banpei);
    ret.back() = string(w+2, banpei);
    rep(i, h) {
        ret[i+1] = string(1, banpei) + arr[i] + string(1, banpei);
    }
    return ret;
}
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};



int main(){
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    s = add_banpei(s, '#');
    h += 2;
    w += 2;
    queue<pii> q;
    q.push({1, 1});
    vl d(h*w, INF);
    d[w+1] = 0;
    while(!q.empty()) {
        auto p = q.front();
        q.pop();
        int y = p.fi, x = p.se;
        int cur = y * w + x;
        rep(i, 4) {
            int ny = y + dy[i], nx = x + dx[i];
            if(s[ny][nx] == '#') continue;
            int nxt = ny*w + nx;
            if(d[cur]+1 < d[nxt]) {
                d[nxt] = d[cur]+1;
                q.push({ny, nx});
            }
        }
    }
    auto dist = d[h*w-w-2];
    if(dist == INF) {
        cout << -1 << endl;
        return 0;
    }
    int cnt = 0;
    rep(i, h) rep(j, w) if(s[i][j] == '#') cnt++;
    cout << h*w-cnt-dist-1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)

bool solve(int N, vi &A){
	int c2 = 0;
	int c4 = 0;
	rp(i,0,N){
		if(A[i]%4==0) c4++;
		else if(A[i]%2==0) c2++;
	}
	bool ans = N/2 <= c4+c2/2;
	return ans;
}

int main(){
	int N; cin>>N;
	vi A(N);
	rp(i, 0, N) cin>>A[i];
	ote(solve(N, A)? "Yes":"No");
}


Measured memory_bytes: 640
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

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

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

const size_t N = 18;

int n, a[N];
map<pair<int, int>, LL> mp[N][N];

LL dfs(int l, int r, int x, int y) {
    if (l + 1 == r) return 0;
    auto it = mp[l][r].find({x, y});
    if (it != mp[l][r].end()) {
        return it->second;
    }
    LL &ret = mp[l][r][{x, y}] = numeric_limits<LL>::max();
    int sum = x + y;
    for (int i = l + 1; i < r; ++i) {
        ret = min(ret, dfs(l, i, x, sum) +
                       dfs(i, r, sum, y) +
                       (LL) sum * a[i]);
    }
    return ret;
}

int main() {
    generate_n(a, n = read(), read);
    cout << dfs(0, n - 1, 1, 1) + a[0] + a[n - 1];
    return 0;
}


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

int main()
{
	char s[3];
	while (cin>>s)
	{
		char s1,s2,s3;
		s1=s[0];
		s2=s[1];
		s3=s[2];
		
		if (s1==s2&&s2==s3)
		cout<<"No"<<"\n";
		else 
		cout<<"Yes"<<"\n";
	}
 } 

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

int n , a[500001] ;
long long s;
//void print(){
//	for(int i = 0 ; i < n ; i++) cout << a[i] << ' ';
//	cout << endl;
//}

void merge( int l1 ,int m1 ,int r1){
	int n1 = m1 - l1 + 1;
	int n2 = r1 - m1;
	int L[250001] ; int R[250001];
	for(int i = 0; i < n1 ; i++){
		L[i] = a[l1 + i];
	}
	for(int i = 0; i < n2; i++){
		R[i] = a[m1+1 + i];
	}
	L[n1] = 2e9;
	R[n2] = 2e9;
//	cout << l1 << ' ' << m1 << ' ' << r1 << ' ' << n1 << ' ' << n2 << endl;
//	print();
	int i = 0; int j = 0;
	for(int k = l1 ; k <= r1 ; k++){
		if(L[i] < R[j]){
			a[k] = L[i];
			i++;
			s++;
		}
		else{
			a[k] = R[j];
			j++;
			s++;
		}
	}
	
//	print();
//	cout << "###############\n";
}
void msort( int l ,int r){
	if(l < r){
		int m = (l + r) / 2;
		msort(l , m);
		msort(m + 1 , r);
		merge(l , m , r);
	}
}

int main(){
	cin>>n;
	for(int i = 0 ; i < n; i++){
		cin>>a[i];
	}
	msort(0 , n - 1);
	for(int i = 0 ; i < n; i++){
		if(i != 0){
			cout<<' '<<a[i];
		}
		else cout<<a[i];
	}
	cout<<endl;
	cout<<s<<endl;
}
/*
10
8 5 9 2 6 3 7 1 10 4
*/


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

using namespace std;

int main()
{   string s;
    int i ;
    string news="";
    cin>>s;
    for (i=0;i<19;i++){
        if (s[i]== ','){
            s[i]=' ';
            news=news+s[i];}
        else{
            news=news+s[i];
        }}
        cout<<news;


    return 0;
}


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

int k, R, L;
double p, e, t;

const double EPS = 1e-10;

inline double ABS(double a){
  return a > 0.0 ? a : -a;
}

double search(int n, double l, double r){
  double tt = (l + r) / 2;

  if(n == k){
    if(ABS(tt - t) < e + EPS) return 1.0;
    else return 0.0;
  }

  if(t + e < l + EPS || t - e + EPS > r){
    return 0.0;
  }
  if(t - e + EPS < l && t + e > r + EPS){
    //printf("t:%.2f e: %.2f l:%.2f r:%.2f\n", t, e, l, r);
    return 1.0;
  }

  if(tt + EPS > t){
    //printf("%.1f %.1f: big\n", l, r);
    return (1.0 - p) * search(n+1, l, tt) + p * search(n+1, tt, r);
  }else{
    //printf("%.1f %.1f: small\n", l, r);
    return (1.0 - p) * search(n+1, tt, r) + p * search(n+1, l, tt);
  }
}

int main(){
  scanf("%d%d%d", &k, &L, &R);
  scanf("%lf%lf%lf", &p, &e, &t);

  double ans = search(0, L, R);

  printf("%.6f\n", ans);

  return 0;
}

Measured memory_bytes: 0
n,k=map(int,input().split())
pl=list(map(int,input().split()))

cuml=[]
cum=0
for i in range(n):
    cum+=(pl[i]+1)/2
    cuml.append(cum)
mx=0
for i in range(n-(k-1)):
    if i==0:
        mx=max(cuml[i+k-1],mx)
    else:
        mx=max(cuml[i+k-1]-cuml[i-1],mx)
print('{:.9f}'.format(mx))


Measured memory_bytes: 25060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define INF 1007654321
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<typename U, typename V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

const int MAXN = 1e5 + 50;
vector<int> adj[MAXN];
int dist[MAXN];
int parent[MAXN];
int siz[MAXN];

int dfs(int curr, int prev) {
    parent[curr] = prev;
    siz[curr] = 1;
    for(auto &next : adj[curr]) {
        if(next != prev && parent[next] == -1) {
            dist[next] = dist[curr] + 1;
            siz[curr] += dfs(next, curr);
        }
    }
    return siz[curr];
}

int main() {
    FAST_IO();
    int N; cin >> N;
    rep(i, N - 1) {
        int u, v; cin >> u >> v;
        adj[u-1].push_back(v-1);
        adj[v-1].push_back(u-1);
    } 
    memset(parent, -1, sizeof(parent));
    dist[0] = 0;
    dfs(0, -1);
    int u = N - 1;
    rep(i, (dist[N-1]-1)/2) {
        u = parent[u];
    }
    if(siz[u] < N - siz[u]) cout << "Fennec\n";
    else cout << "Snuke\n";
}

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

int main(){
  int H, W;
  cin >> H >> W;
  char a[H][W];
  char b[H][W];
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++) cin >> a[i][j];
  }
  int flag=0;
  for(int i=0; i<H-1; i++){
    for(int j=0; j<W-1; j++){
      if(a[i][j]=='.' && a[i+1][j]=='#' && a[i][j+1]=='#' && a[i+1][i+1]=='#') flag++;
      else if(a[i][j]=='#' && a[i+1][j]=='#' && a[i][j+1]=='#' && a[i+1][j+1]=='#') flag++;
      else if(a[i][j]=='#' && a[i+1][j]=='#' && a[i][j+1]=='#' && a[i+1][j+1]=='.') flag++;
    }
  }
  if(flag>0) cout << "Impossible" << endl;
  else cout << "Possible" << endl;
}


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

class Class_
{
	void Test()
	{
		var N = A_Int_()[0];
		int a = 1;
		long sum = 1;
		long o = 1000000000 + 7;

		while (N>=a) {
			sum = sum * a;
			sum = sum % o;
			a++;
		}
		
		Console.WriteLine(sum);

	}

	static void Main(string[] args)
  {
    new Class_().Test();
  }

  #region

  string S_String_()
  {
    return Console.ReadLine();
  }

	//
	string[] A_String_()
  {
    return Console.ReadLine().Split();
  }

  int[] A_Int_(int n)
  {
    var x = new int[n];
    for (var i = 0; i < n; i++)
    {
      x[i] = int.Parse(Console.ReadLine());
    }
    return x;
  }

	//
	int[] A_Int_()
  {
    var ss = Console.ReadLine().Split();

    var x = new int[ss.Length];
    for (var i = 0; i < ss.Length; i++)
      x[i] = int.Parse(ss[i]);

    return x;
  }
  #endregion
}

Measured memory_bytes: 11092
import heapq

n, m = map(int, input().split())
a = list(map(int, input().split()))
heapq.heapify(a)
bc = [list(map(int, input().split())) for _ in range(m)]
bc = sorted(bc, key=lambda x: -x[1])
for b, c in bc:
    for _ in range(b):
        x = heapq.heappop(a)
        if c > x:
            heapq.heappush(a, c)
        else:
            heapq.heappush(a, x)
            break
print(sum(a))

Measured memory_bytes: 36944
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int fc(int n){
  int res = 0;
  while(n != 0 && n % 2 == 0){
    res++;
    n /= 2;
  }
  return res;
}

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  ll ans = 0;
  rep(i, n) ans += fc(a.at(i));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3660
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << '\n';
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) {
        std::cout << i << ' ';
        vdeb(da[i]);
    }
    std::cout << '\n';
}

struct UnionFind{
    int size;
    std::vector<int> par;
    std::vector<int> rank;
    UnionFind(int x){
        size=x;
        par=std::vector<int> (x);
        rank=std::vector<int> (x,1);
        for (int i=0;i<x;i++) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        else return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        x=root(x);y=root(y);
        if(x==y) return;
        if(rank[x]<rank[y]) par[x]=y;
        else par[y]=x;
        if(rank[x]==rank[y]) rank[x]++;
    }
    bool check(int x,int y){
        return root(x)==root(y);
    }
    void initialize(){
        for (int i=0;i<size;i++){
            par[i]=i;rank[i]=1;
        }
    }
};

using namespace std;


int main() {
    int n,q; cin >> n >> q;
    UnionFind uf(n);
    rip(i,q,0) {
        int id, u, v; cin >> id >> u >> v;
        if(id == 0) {
            uf.unite(u, v);
        }
        else  {
            if(uf.check(u,v)) {
                printf("1\n");
            }
            else {
                printf("0\n");
            }
        }
    }
}

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

int main() {
    int N; cin >> N;
    int t, x, y;
    t = 0; x = 0; y = 0;
    int t2, x2, y2;
    for (int i = 0; i < N; i++){
        cin >> t2 >> x2 >> y2;
        if (abs(x2 - x) + abs(y2 - y) > t2 - t || (abs(x2 - x) + abs(y2 - y)) % 2 != (t2 - t) % 2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


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

int main()
{
  int N, M;
  cin >> N >> M;

  vector<int> roadCount(N);
  int cityA, cityB;
  for (int i = 0; i < M; i++)
  {
    cin >> cityA >> cityB;
    roadCount.at(cityA - 1)++;
    roadCount.at(cityB - 1)++;
  }

  for (int i = 0; i < N; i++) {
    cout << roadCount.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define v(T) vector<T>
#define vv(T) v(v(T))
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

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

int i, j, k;
int main()
{
	string s;
	cin >> s;
	v(char) d;
	rep(i, s.size()) {
		if (s[i] == '0' || s[i] == '1') {
			d.push_back(s[i]);
		} else {
			if (d.size())
				d.pop_back();
		}
	}
	rep(i, d.size()) {
		cout << d[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
<?php

$s = trim(fgets(STDIN));

$i = 0;
$len = strlen($s);
$no = false;

for ($i = 0; $i < $len; $i++) {
    if ($i % 2 === 0 && $s[$i] === 'L' || $i % 2 === 1 && $s[$i] === 'R') {
        $no = true;
        break;
    }
}

echo $no ? 'No' : 'Yes';

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

#define wait() system("pause")

const int maxn = 110;

int n, m;
char s[1000], t[1000];

int check(int k) {
	for(int i=k; i-k<m; i++) {
		if(s[i] != t[i-k+1] and s[i] != '?') return 0;
	}
	return 1;
}

int prep() {
	for(int i=n-m+1; i>=1; i--) {
		if(check(i)) {
			for(int j=i, c=1; c<=m; c++, j++) {
				s[j] = t[c];
			}
			return 1;
		}
	}
	return 0;
}

int32_t main() {
	//getchar();
	scanf("%s", s+1);
        scanf("%s", t+1);
	//gets(t+1);
	n = strlen(s+1);
	m = strlen(t+1);
	if(prep()) {
		for(int i=1; i<=n; i++) {
			if(s[i] == '?') cout<<'a';
			else cout<<s[i];
		}
		cout<<endl;
	}
	else {
		cout<<"UNRESTORABLE"<<endl;
	}
	//wait();
    return 0;
}

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

const int INF = 1001001001;
//const ll INF = 1000000000000000000;

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

	int left_w = 0, right_r = 0;
	rep(i,s.size()) {
		if (s[i] == 'R') right_r++;
	}
	int ans = max(left_w, right_r);
	rep(i,s.size()) {
		if (s[i] == 'W') left_w++;
		else right_r--;
		ans = min(ans, max(left_w, right_r));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3756