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

using namespace std;
bool is_pal(string s, int l, int r){
    while (l < r) {
        if (s[l] != s[r]) {
            return false;
        }
        l++, r--;
    }
    return true;
}
int main(){
    std::string S;
    cin >> S;
    int l = S.size();
    // int mid = (l-1)/2;
    bool yes = true;
    // for (int i=0;i<mid;i++){
    //     if ((S.at(i) == S.at(l-1-i)) && (S.at(i) == S.at(mid-i-1))) continue;
    //     else {
    //         yes = false;
    //         break;
    //     }
    // }
    yes = is_pal(S, 0, l-1) * is_pal(S, 0, (l-3)/2) * is_pal(S, (l+1)/2, l-1);
    if (yes) cout << "Yes";
    else cout << "No";
}

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

#define IO  ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define endl '\n'
#define f first
#define s second
#define ll long long
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
using namespace std;
int main() {
    IO
    int n;
    cin>>n;
    double head[n+5],tail[n+5],dp[n+5][n+5]={},ans=0.0;
    for(int i=0;i<n;i++){
        cin>>head[i];
        tail[i]=1.0-head[i];
    }
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=n;j++){
            if(j==0){
                dp[i][j]=tail[i-1]*dp[i-1][j];
            }
            else{
                dp[i][j]=head[i-1]*dp[i-1][j-1]+tail[i-1]*dp[i-1][j];
            }
        }
    }
    for(int i=n;i>n/2;i--){
        ans+=dp[n][i];
    }
    cout<<fixed<<setprecision(10)<<ans;
    return 0;
}


Measured memory_bytes: 74304
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let abk=readInts()
var a=abk[0]
var b=abk[1]
var k=abk[2]
var rest=k
if a-k>=0{
  a-=k
}else{
  rest=k-a
  a=0
  if b-rest>=0{
    b-=rest
  }else{
    b=0
  }
}
print(a,b)

Measured memory_bytes: 8284
#include<iostream>
#include<cstdio>
#include<sstream>
#include<vector>
#include<cmath>
using namespace std;

typedef long long ll;

ll Fliegel(ll y,ll m, ll d){
  if(m<=2){ y--; m+=12; }
  return (ll)floor(365.25*y) + y/400 - y/100 + floor(30.59*(m-2)) + d - 678912;
}

int main(){
  string s;
  ll a[3],b[5];
  ll base = Fliegel(2012,12,21);
  ll ul[] = {20,18,20,20,13};
  ll month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

  while(cin >> s, s!="#"){
    int num = 0;
    for(int i=0;i<s.size();i++)if(s[i]=='.'){
	s[i] = ' '; num++;
      }

    if(num==2){
      stringstream ss(s);
      ss >> a[0] >> a[1] >> a[2];
      ll days = Fliegel(a[0],a[1],a[2]) - base;
      days %= 1872000;
      for(int i=0;i<5;i++){
	b[4-i] = days % ul[i]; days /= ul[i];
      }
      printf("%lld.%lld.%lld.%lld.%lld\n",b[0],b[1],b[2],b[3],b[4]);
    }else{
      stringstream ss(s);
      ss >> b[0] >> b[1] >> b[2] >> b[3] >> b[4];
      ll days = 0, k = 1;
      for(int i=0;i<5;i++){
	days += b[4-i] * k; k *= ul[i];
      }
      
      a[0] = 2012; a[1] = 12; a[2] = 21;
      while(days--){
	a[2]++;
	if(a[1] == 2){
	  if(!(a[0]%400)){
	    if(a[2]>29){ a[1]++; a[2] = 1; }
	  }else if(!(a[0]%100)){
	    if(a[2]>28){ a[1]++; a[2] = 1; }
	  }else if(!(a[0]%4)){
	    if(a[2]>29){ a[1]++; a[2] = 1; }
	  }else{
	    if(a[2]>28){ a[1]++; a[2] = 1; }
	  }
	}else{
	  if(a[2]>month[a[1]]){ a[1]++; a[2] = 1; }
	}
	if(a[1]>12){ a[0]++; a[1] = 1; }
      }
      printf("%lld.%lld.%lld\n",a[0],a[1],a[2]);
    }
  }
}

Measured memory_bytes: 1228
n = int(input())
can = []
for i in range(n):
  raw = input()
  now = []
  for j in range(len(raw)):
    now.append(raw[j])
  now.sort()
  can.append(now)
can.sort()
cnt = 0
ans = 0
for i in range(1,n):
  if can[i-1] == can[i]:
    cnt += 1
    ans += cnt
  else:
    cnt = 0
print(ans)

Measured memory_bytes: 24624
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)


def input():
    return stdin.readline().strip()

N, M = map(int, input().split())
H = list(map(int, input().split()))
g = [list() for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

ans = 0
for i in range(N):
    good = True
    for j in g[i]:
        if H[i] <= H[j]:
            good = False

    ans += good

print(ans)


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

using namespace std;

int main(){
  int N;
  scanf("%d", &N);
  
  vector<long long> plus(N), minus(N);
  for(int i = 0; i < N; i++){
    long long A;
    scanf("%lld", &A);
    plus[i] = i + 1 + A;
    minus[i] = i + 1 - A;
  }
  sort(plus.begin(), plus.end());
  sort(minus.begin(), minus.end());
  map<int, long long> minus_map;
  for(int i = 0; i < N; i++){
    minus_map[minus[i]]++;
  }
  
  long long p = 0;
  
  for(int i = 0; i < N; i++){
    p += minus_map[plus[i]];
  }
  
  cout << p << endl;
  
  return 0;
}

Measured memory_bytes: 29020
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{
    long long int a, b, k;
    scanf("%lld %lld %lld", &a, &b, &k);

    if (k <= a){
        a -= k;
    }
    else if(k <= a+b){
        b = a+b-k;
        a = 0;
    }
    else{
        a = 0;
        b = 0;
    }


    printf("%lld %lld\n", a, b);


    

    return 0;
} 



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

int main() {
	// your code goes here
	int n,a=0,b=0,c=0,d=0;
	cin>>n;
	string s;
	while(n--)
	{
	    cin>>s;
	    if(s=="AC")
	    a++;
	    else if(s=="WA")
	    b++;
	    else if(s=="TLE")
	    c++;
	    else
	    d++;
	}
	cout<<"AC"<<" "<<"x"<<" "<<a<<endl;
	cout<<"WA"<<" "<<"x"<<" "<<b<<endl;
	cout<<"TLE"<<" "<<"x"<<" "<<c<<endl;
	cout<<"RE"<<" "<<"x"<<" "<<d<<endl;
	return 0;
}

Measured memory_bytes: 3640
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;



int main()
{
   
    int t;
    cin >> t;
    if (t)cout << 0 << endl;
    else cout << 1 << endl;
    
   
    return 0;

}

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

int main(){
  int N;cin>>N;
  string S;cin>>S;
  int ans=0;
  for(int i=0;i<N-1;i++){
    string L=S.substr(i,3);
    if(L=="ABC") ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int a[50];
int p[30][100010];
main()
{
    string s;
    cin>>s;
    int i,j,k,n=s.size();
    for(i=0;i<n;i++)
    {
        p[s[i]-'a'][a[s[i]-'a']++]=i;
    }

    for(i=0;i<26;i++)
    {
        for(j=1;j<a[i];j++)
        {
            k=p[i][j]-p[i][j-1];
            if(k-1<2)
            {
                cout<<p[i][j-1]+1<<' '<<p[i][j]+1;
                return 0;
            }

            if(j-2>=0)
            {
                k=p[i][j]-p[i][j-2];
                if(k-2<3)
                {
                    cout<<p[i][j-2]+1<<' '<<p[i][j]+1;
                    return 0;
                }
            }
        }
    }

    cout<<-1<<' '<<-1;
}





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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n,q; scanf("%d",&n);
    vector<int> a(n);
    rep(i,0,n)scanf("%d",&a[i]);
    vector<int> b(n);
    rep(i,0,n)b[i]=a[i];
    sort(ALL(b));
    int cnt=0;
    rep(i,0,n)if(a[i]==b[i])cnt++;
    if(cnt==n){
        printf("0\n"); return 0;
    }
    scanf("%d",&q);
    rep(rot,0,q){
        int i,j; scanf("%d%d",&i,&j); i--; j--; 
        if(a[i]==b[i])cnt--;
        if(a[j]==b[j])cnt--;
        swap(a[i],a[j]);
        if(a[i]==b[i])cnt++;
        if(a[j]==b[j])cnt++;
        if(cnt==n){
            printf("%d\n",rot+1);
            return 0;
        }
    }
    printf("-1\n");
    return 0;
}


Measured memory_bytes: 5204
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;

#define fori(x) for(int i=0;i<x;++i)
#define forj(x) for(int j=0;j<x;++j)

constexpr int maximum = 100100;


int main() {
	int n; int a[200100];
	cin >> n;
	bool f = true;
	fori(n) { cin>>a[i]; }
	sort(a, a + n);
	int hoge = a[0];
	for (int i = 1; i < n;++i) {
		if (a[i] == hoge) {
			f = false;
			break;
		}
		hoge = a[i];
	}
	cout << ((f) ? "YES" : "NO");

	return 0;
}

Measured memory_bytes: 1024
N,K = map(int,input().split())
A = list(map(int,input().split()))

max_len = max(len(bin(K)[2:]),len(bin(max(A))[2:]))
one = [0]*max_len
for a in A:
    for i,b in enumerate(bin(a)[2:].zfill(max_len)):
        if b == "1":
            one[i] += 1
one = one[::-1]
# print(one)
x = 0
for i in range(max_len-1,-1,-1):
    if x+2**i <= K and one[i] < (N+1)//2:
        x += 2**i
# print(x)
ans = 0
for a in A:
    ans += a^x
print(ans)


Measured memory_bytes: 69392
import math

k = int(input())
gcd_bc = []
gcd_bb = []

for b in range(1, k + 1):
    gcd_bb.append(b)
    for c in range(b + 1, k + 1):
        gcd_bc.append(math.gcd(b, c))

total = 0
for a in range(1, k + 1):
    for d in gcd_bc:
        total += math.gcd(a, d) * 2

    for b in gcd_bb:
        total += math.gcd(a, b)

print(total)


Measured memory_bytes: 9248
def main():
  pc1, pc2, pc3 = map(int, input().split())
  for i in range(2):
    c1, c2, c3 = map(int, input().split())
    if (c1-pc1)==(c2-pc2) and (c2-pc2)==(c3-pc3):
      pc1, pc2, pc3 = c1, c2, c3
      
    else:
      return 'No'
    
  return 'Yes'

print(main())


Measured memory_bytes: 2940
<?php
$n = (int)trim(fgets(STDIN));

$input = explode(' ', trim(fgets(STDIN)));
$cnt = [];
foreach ($input as $val) {
	$tmp = (int)$val;
	if (isset($cnt[$tmp])) {
		$cnt[$tmp]+=1;
	}else{
		$cnt[$tmp]=1;
	}
}

$sum = 0;
foreach ($cnt as $k => $v) {
	if ($k > $v) {
		$sum += $v;
	}elseif($k < $v){
		$diff = $v - $k;
		$sum += min($v, $diff);
	}
}
echo $sum;



Measured memory_bytes: 19188
//#pragma GCC optimize ("O3")
//#pragma GCC target ("tune=native")
//#pragma GCC target ("avx")
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PPI;
typedef pair<ll,P> PIP;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
#define PQ(T) priority_queue<T,vector<T>,greater<T>>
#define PQ2(T) priority_queue<T>
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) ((x)=min((x),(y)))
#define chmax(x,y) ((x)=max((x),(y)))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
#define DEBUG(x) cerr<<"line ("<<__LINE__<<")  "<<#x<<": "<<x<<endl;
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

typedef vector<ll> vec;
typedef vector<vec> mat;
#define M 100010
ll n, m;
ll d[M];

void mul(mat &A, mat &B){
	int n = A.size();
	mat C(n, vec(n, 0));
	rep(k, n) rep(i, n) rep(j, n) C[i][j]+=A[i][k]*B[k][j]%mod;
	A.swap(C);
	rep(i, n) rep(j, n) A[i][j] %= mod;
}

int main(){
	scanf("%lld%lld", &n, &m);
	rep(i, m) scanf("%lld",d+i+1);
	d[m+1] = n;
	mat A(3, vec(3, 1));
	A[0][0] = A[0][1] = 2;
	A[2][1] = 0;
	mat B(A);
	rep(i, 3) B[i][0]--;
	mat X(3, vec(3, 0));
	rep(i, 3) X[i][i] = 1;
	rep(i, m+1){
		if(i) mul(X, B);
		ll t = d[i+1]-d[i]-1;
		mat C(A);
		while(t){
			if(t&1) mul(X, C);
			mul(C, C);
			t >>= 1;
		}
	}
	ll res = 0;
	rep(i, 3) res += X[0][i];
	printf("%lld\n", (res+mod)%mod);
	return 0;
}


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

int main() {
  string s, a = "abcdefghijklmnopqrstuvwxyz";
  cin >> s;

  for (int i = 0; i < s.size(); i++)
    if (a.find(s[i]) != string::npos) a.erase(a.find(s[i]), 1);

  if (a.size() == 0)
    cout << "None" << endl;
  else
    cout << a[0] << endl;
}


Measured memory_bytes: 512
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] abcd = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int a = abcd[0];
            int b = abcd[1];
            int c = abcd[2];
            int d = abcd[3];
            string message = "";
            while (true)
            {
                c = c - b;
                if(c <= 0)
                {
                    message = "Yes";
                    break;
                }
                a = a - d;
                if(a <= 0)
                {
                    message = "No";
                    break;
                }
            }
            Console.WriteLine(message);
        }
    }
}

//24579 =  hon
//0168 = pon
//3 = bon
//long n = long.Parse(Console.ReadLine());
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

//Console.WriteLine(cnt);
//Console.ReadKey();


Measured memory_bytes: 28192
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

signed main()
{
    IOS;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
    
    int n; cin>>n;
    int ar[n];
    repa(i,0,n-1)
        cin>>ar[i];
    int ans = 0;
    repa(i,0,n-1)
    {
        repa(j,i+1,n-1)
        {
            repa(k,j+1,n-1)
            {
                
                vector<int>v = {ar[i],ar[j],ar[k]};
                set<int>x(all(v));
                sort(all(v));
                ans+=( (v[0] + v[1] > v[2]) && x.size()==3 );
            }
        }
    } 
    cout<< ans <<endl;   
}

Measured memory_bytes: 3656
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <utility>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <math.h>
#include <stdio.h>
#include <deque>

using namespace std;

#define REP(i,n,m) for( long long int i = (n); i < (m); i++ )
#define REV(v) for (auto itr = v.rbegin(); itr != v.rend(); itr++)
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define SORT(v) sort( ALL(v) );
#define LAST(v) v[v.size()-1]
#define ZERO(a) memset(a,0,sizeof(a));
#define MINUS(a) memset(a,-1,sizeof(a));
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pi pair<int, int>
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define IIN(a) int a; cin >> a;
#define LIN(a) ll a; cin >> a;
#define SIN(a) string a; cin >> a;
#define VL(v,n) vector<ll> v(n);
#define Read_VL(v,n) vector<ll> v(n);REP(i,0,n)cin>>v[i];
#define sumV(v,n) Vl(acm,n) REP(i,0,n) acm[i] = v[i] + ( i == 0 ? 0 : acm[i - 1]);
#define EPS (1e-10)
#define INF 1000000000000LL

void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}


template<class T=ll>struct Graph{
	int n;
	vector<vector<tuple<ll,T>>>edge;
	Graph(int N=1):n(N){edge.resize(n);}
	void add(ll f,ll t,T c,bool d=false){
		edge[f].emplace_back(t,c);
		if(!d)edge[t].emplace_back(f,c);
	}
	void view(){
		REP(i,0,n)for(auto&e:edge[i])
			puta(i,"=>",get<0>(e),", cost :",get<1>(e));
	}
};

bool cmp( ll a, ll b ){
  return a>b;
}

bool length_cmp( string &a, string &b ){
  return a.size() < b.size();
}

ll StoLL( string s )
{
	ll num=0;
  REP( i, 0, s.size() ){
    num = num * 10 + ( s[i] ^ 48 );
  }
  return num;
}

ll CtoLL( char c )
{
	if( 'a' <= c && c <= 'z'){
		return (ll)( c ^ 96 ) ;
	}
	else if( 'A' <= c && c <= 'Z'){
		return (ll)( c ^ 64 );
	}
  return 0;
}

ll MOD=1000000007;
ll dx[4] = { 1, 0, -1, 0 };
ll dy[4] = { 0, 1, 0, -1 };
//I ASCII code: '0' = 48; 'A' = 65; 'a' = 97

ll dp[10000][10000];
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
		LIN(n) LIN(q) SIN(s)
		vector<ll> sum( s.size() );
		sum[0] = 0;
		REP( i, 1, s.size() ){
			if( s[i - 1] == 'A' && s[i] == 'C' ){
				sum[i] = 1;
			}
		}
		REP( i, 1, s.size() ){
			sum[i] += sum[i - 1];
		}
		REP( i, 0, q ){
			LIN(l) LIN(r)
			puta( sum[r - 1] - sum[l - 1] );
		}
    return 0;
}


Measured memory_bytes: 1872
#include<stdio.h>
#define MAX 10000
int main(){
  int S[MAX],T[MAX];
  int i,j,cnt=0,n,q;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++) scanf("%d",&T[i]);
  
  for(i=0;i<q;i++){
    for(j=0;j<n;j++){
      if(T[i]==S[j]){
      cnt++;
      break;
      }
    }
  }
  printf("%d\n",cnt);

  return 0;
}

Measured memory_bytes: 644
#include <iostream>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#define llint long long

using namespace std;

llint p;
llint a[3005];
llint dp[3005][3005];
llint ans[3005];
llint b[3005];
llint beki[3005][3005];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%p) * (modpow(a, n-1)%p)) % p;
	}
	else{
		return modpow((a*a)%p, n/2) % p;
	}
}

int main(void)
{
	cin >> p;
	for(int i = 0; i < p; i++) cin >> a[i];
	
	dp[0][0] = 1;
	for(int i = 0; i < p; i++){
		for(int j = 0; j <= p; j++){
			dp[i+1][j] += dp[i][j] * (p-i) % p, dp[i+1][j] %= p;
			if(j+1 <= p) dp[i+1][j+1] += dp[i][j], dp[i+1][j+1] %= p;
		}
	}
	
	for(int i = 0; i < p; i++){
		beki[i][0] = 1;
		for(int j = 1; j < p; j++){
			beki[i][j] = beki[i][j-1] * i % p;
		}
	}
	
	//for(int i = 0; i <= p; i++) cout<< dp[p][i] << " "; cout << endl;
	
	for(int i = 0; i < p; i++){
		if(a[i] == 0) continue;
		
		if(i > 0){
			llint inv = modpow(p-i, p-2);// cout << inv << endl;
			b[0] = dp[p][0] * inv, b[0] %= p;
			for(int j = 1; j < p; j++){
				llint t = (dp[p][j] - b[j-1] + p) % p;// cout << t << endl;
				b[j] = t * inv % p;
			}
		}
		else for(int j = 0; j < p; j++) b[j] = dp[p][j+1];
		
		
		llint tmp = 0;
		for(int j = 0; j < p; j++){
			tmp += b[j] * beki[i][j] % p, tmp %= p;
		}
		llint inv = modpow(tmp, p-2);
		for(int j = 0; j < p; j++) ans[j] += b[j] * inv % p, ans[j] %= p;
		
		//cout << i << endl;
		//for(int j = 0; j < p; j++) cout << b[j] << " "; cout << endl;
	}
	
	for(int i = 0; i < p; i++) cout << ans[i] << " "; cout << endl;
	
	return 0;
}

Measured memory_bytes: 141440
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
typedef struct{
    int a,b,c;
}data;

//昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//構造体降順
int comp( const void *c1, const void *c2 )
{
  data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.b;   /* b を基準とする */
  int tmp2 = test2.b;
  return tmp2 - tmp1;
}

#define MAXSIZE 200000
int list[MAXSIZE];
int tail;

void Init(void){
    tail=0;
}
int Top(void){
    return 0;
}

int Next(int pos){
    if(pos<tail-1){
        return pos+1;
    }else{
        return -1;
    }
}
int Count(void){
    return tail;
}

int Item(int pos){
    if((pos>=0)&&(pos<tail)){
        return list[pos];
    }else{
        return 0;
    }
}
void Add(int value){
    if(tail<MAXSIZE){
        list[tail]=value;
        tail++;
    }
}
void Delete(int pos){
    if((pos>=0)&&(pos<tail)){
        int i;
        for(i=pos;i<tail-1;i++){
            list[i]=list[i+1];
        }
        tail--;
    }
}
int kai(int n){
    if(n==0){
        return 1;
    }
    int sum=1;
    for(int i=1;i<=n;i++){
        sum*=i;
    }
    return sum;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long row[N];
    rep(i,N){
        scanf("%lld",&row[i]);
    }
    int cnt=0;
    while(1){
        int temp=0;
        rep(i,N){
            if((row[i]%2)==0){
                temp++;
            }else{
                ;
            }
        }
        if(temp==N){
            rep(i,N){
                row[i]/=2;
            }
            cnt++;
        }else {
            printf("%d",cnt);
            return 0;
        }
    }
}




Measured memory_bytes: 1712
from collections import deque

K = int(input())

deq = deque([(1, 1)])
history = set()

while True:
	to = deq.popleft()
	if to[0] == 0:
		print(to[1])
		break
	elif to[0] not in history:
		history.add(to[0])
		deq.appendleft((to[0] * 10 % K, to[1]))
		deq.append((to[0] + 1, to[1] + 1))

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

using namespace std;

typedef long long ll;

const int MX = 77;
const ll MOD = 1000000007;

template <typename T> void cmin(T &x, const T &y)
{
	if(y < x) x = y;
}

template <typename T> void cmax(T &x, const T &y)
{
	if(y > x) x = y;
}

template <typename T> void read(T &x)
{
	x = 0; char c = getchar(); bool f = 0;
	while(!isdigit(c) && c!='-') c = getchar();
	if(c == '-') f = 1, c = getchar();
	while(isdigit(c)) x = x*10+c-'0', c = getchar();
	if(f) x = -x;
}

int n, k;
char str[MX];
ll inv[MX*3], fac[MX*3], faci[MX*3];

void init()
{
	inv[0] = fac[0] = faci[0] = 1;
	inv[1] = fac[1] = faci[1] = 1;
	for(int i=2; i<MX*3; i++)
	{
		inv[i] = (MOD*MOD - (MOD/i) * inv[MOD%i]) % MOD;
		fac[i] = fac[i-1] * i % MOD;
		faci[i] = faci[i-1] * inv[i] % MOD;
	}
}

ll binom(int x, int y)
{
	if(x<0 || y<0 || x<y) return 0;
	else return fac[x] * faci[y] % MOD * faci[x-y] % MOD;
}

void input()
{
	read(n), read(k);
	scanf("%s", str+1);
}

vector<vector<int> > sta;

void dfs(vector<int> cur)
{
	int len = cur.size()-1;
	for(auto i : cur)
		if(i == 0) len++;
		else len += i*2-1;
	if(len > n) return;
	sta.push_back(cur);
	for(int i=0; i<=(cur.size() ? cur.back() : (n+1)/2); i++)
	{
		vector<int> tmp = cur;
		tmp.push_back(i);
		dfs(tmp);
	}
}

bool check(vector<int> s)
{
	int sum[MX];
	fill(sum+1, sum+k+1, 1);
	vector<int> can;
	int rem = 0, r = 1, b = 1, bpos[MX];
	for(int i=0; i<s.size(); i++)
	{
		if(s[i])
		{
			while(r<=k && str[r]!='r') r++;
			if(r > k) return false;
			while(b<=k && (str[b]!='b' || b<=r)) b++;
			if(b > k) return false;
			sum[r] = sum[b] = 0;
			bpos[i] = b;
			r++, b++;
		}
	}
	for(int i=0; i<s.size(); i++)
	{
		if(!s[i])
		{
			while(r<=k && str[r]!='r') r++;
			if(r > k) return false;
			sum[r] = 0;
			r++;
		}
	}
	for(int i=k-1; i>=1; i--) sum[i] += sum[i+1];
	for(int i=0; i<s.size(); i++) if(s[i]) can.push_back(sum[bpos[i]]);
	reverse(can.begin(), can.end());
	while(s.size() && !s.back()) s.pop_back();
	reverse(s.begin(), s.end());
	int tmp = 0;
	for(int i=0; i<can.size(); i++)
	{
		tmp += max(s[i]-1, 0);
		if(tmp > can[i]) return false;
	}
	return true;
}

ll calc(vector<int> s)
{
	ll ret = fac[s.size()];
	int cnt = 1;
	for(int i=1; i<s.size(); i++)
		if(s[i] != s[i-1])
			ret = ret*faci[cnt] % MOD, cnt = 1;
		else cnt++;
	ret = ret*faci[cnt] % MOD;
	int up = n+1, dn = 0;
	for(auto v : s)
	{
		dn += 2*v+2;
		up += (v>=1)*2;
	}
	return ret * binom(up, dn) % MOD;
}

void work()
{
	ll ans = 0;
	dfs(vector<int>());
	for(auto s : sta)
		if(check(s))
			ans = (ans + calc(s)) % MOD;
	printf("%lld\n", ans);
}

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

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

#define int long long
#define double long double
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())
#define fr first
#define sc second
typedef long long ll;
typedef pair<int,int> pii;



void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << ' ' << b << ' ' << c << endl;
}


int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef DK
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    while (cin.peek() != EOF) {
        solve();
        cout << endl << endl;
        string s("#");
        do getline(cin, s);
        while (!cin.eof() && !s.empty());
        while (isspace(cin.peek())) cin.get();
    }
#else
    solve();
#endif
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/reversed.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
using boost::adaptors::reversed;
struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
template<class T> void trace_(const char* s, const T& v) { cerr << s << "=" << v; }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { for (; *s != ','; ++s) { cerr << *s; } cerr << "=" << v << ","; trace_(++s, vs...); }
#define TRACE(...) (cerr << "\033[2m\033[33m", trace_(#__VA_ARGS__, __VA_ARGS__), cerr << "\033[0m\n")
#else
#define TRACE(...)
#endif

int main() {
    int n;
    cin >> n;
    using rb_t = pair<ll, ll>;
    vector<rb_t> xl(n);
    cin >> xl;
    sort(xl.begin(), xl.end(), [](const rb_t& a, const rb_t& b) {
        return a.first + a.second < b.first + b.second;
    });
    ll max_right = numeric_limits<ll>::min();
    int ans = 0;
    for (const auto& rb : xl) {
        if (max_right <= rb.first - rb.second) {
            max_right = rb.first + rb.second;
            ans++;
            TRACE(rb, max_right);
        }        
    }
    cout << ans << nl;
}


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

int main(){
  string S;
  cin >> S;
  int L=S.size();
  string T="keyence";
  int A=0;
  for(int i=1; i<=7; i++){
    if(S.substr(0, i)==T.substr(0, i)){
      A=i;
    }
  }
  if(A==7){
    cout << "YES" << endl;
  }
  else{
    if(S.substr(L-7+A, 7-A)==T.substr(A, 7-A)){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxN 100002
#define inf 100000001
#define pii pair < int, int >
#define mp make_pair
#define son e.first
using namespace std;

//FILE *fin = freopen("d.in", "r", stdin);

/* ----------------------------------------- */
int n;
vector < pii > V[maxN];
/* ----------------------------------------- */
int sub[maxN], centr, subst;
/* ----------------------------------------- */
long long ans;

void dfs(int nod, int par)
{
    sub[nod] = 1;
    bool pos = 1;
    for (pii e : V[nod])
        if (son != par)
        {
            dfs(son, nod);
            sub[nod] += sub[son];
            ans += 2LL * e.second * min(sub[son], n - sub[son]);
            if (2 * min(sub[son], n - sub[son]) == n)
                subst = subst ? -1 : e.second;
            pos &= (sub[son] * 2 <= n);
        }
    pos &= (n - sub[nod]) * 2 <= n;
    if (pos)
        centr = nod;
}


bool CentrEdge()
{
    if (!subst || subst == -1)
        return 0;
    else
    {
        ans -= subst;
        return 1;
    }
}
int main()
{
    scanf("%d", &n);
    for (int i = 1; i < n; ++ i)
    {
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        V[a].push_back(mp(b, c));
        V[b].push_back(mp(a, c));
    }
    dfs(1, 0);

    if (CentrEdge())
        printf("%lld\n", ans);
    else
    {
        int minc = inf;
        for (pii e : V[centr])
            minc = min(minc, e.second);
        printf("%lld\n", ans - minc);
    }
    return 0;
}


Measured memory_bytes: 12800
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>

using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int s = a + b + c;
	if (s >= 22) {
		cout << "bust" << endl;
	}
	else {
		cout << "win" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
vector <int> x(10000);
int main() {
    int x , a , b;
    cin >> x >> a >> b;
    if(abs(x - a) > abs(x - b)){
        cout << 'B' << endl;
    }
    if(abs(x - a) < abs(x - b)){
        cout << 'A' << endl;
    }
}

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

#define foru(i, l, r) for(int i = (l); i <= (r); ++i)
#define ford(i, l, r) for(int i = (l); i >= (r); --i)

#define maxn 1000010

const ll mod = 1e9 + 7;

ll dp[2111];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);
    int s; cin >> s;
    if (s < 3) return cout << 0, 0;
    dp[0] = 1;
    for (int i = 1; i <= s; ++i) {
      if (i >= 3)
      for (int j = i - 3; j >= 0; j--) dp[i] = (dp[i] + dp[j]) % mod;
    }
    cout << dp[s];
    return 0;
}


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

int main()
{
  int a, b, c, d, e, f;
  while (cin >> a >> b>> c >> d >> e >> f) {
    if ((a|b|c|d|e|f) == 0)
      break;
    int ans = 0;
    for (int i = 0; i < 3; ++i) {
      if (a+d >= i && b+e >= i && c+f >=i)
	ans = max(ans, (a+d-i)/3+(b+e-i)/3+(c+f-i)/3+i);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 864
#include<stdio.h>
int main(void){
  int w,h,x,y,r=0;
  scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
  if((x+r>w)||(y+r>h)){
    puts("No");
  }else if((x-r<0)||(y-r<0)){
    puts("No");
  }else{
    puts("Yes");
  }
  return 0;
}



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

int main() {
    int N;
    cin >> N;
    vector<int> P(N), Q(N);
    rep(i,N) cin >> P[i];
    rep(i,N) cin >> Q[i];
    vector<int> A(N);
    rep(i,N) A[i] = i+1;

    map<vector<int>, int> mp;
    do {
        mp[A] = mp.size();
    } while (next_permutation(A.begin(), A.end()));

    int ans = abs(mp[P] - mp[Q]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5248
from collections import deque

n,m = map(int,input().split())
map_li = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    map_li[a].append(b)
    map_li[b].append(a)

ans_li = [-1]*n
queue=deque()
queue.append(0)

while queue:
    now = queue.popleft()
    for c in map_li[now]:
        if ans_li[c]==-1:
            ans_li[c]=now
            queue.append(c)

if -1 in ans_li[1:]:
    print('No')
else:
    print('Yes')
    for ans in ans_li[1:]:
        print(ans+1)

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

int n,m,t,p,d,c,ls=0,bs=0,rs,us,x,y;
vector<int> ans;
int main(){
    for(int i=0;i<1000;i++){
        scanf("%d%d%d%d",&n,&m,&t,&p);
        if(n==0&&m==0&&t==0&&p==0)break;

        vector<int> hline(n,1);
        vector<int> vline(m,1);

        for(int k=0;k<t;k++){
            scanf("%d%d",&d,&c);
            if(d==1){
                vector<int> hl(n,0);
                int cnt=max(c,n-c);
                for(int l=0;l<cnt;l++)
                    hl[l]=(  (c-l-1<0)? 0 : hline[c-l-1] )+( (c+l>=n)?0:hline[c+l] );
                for(int l=0;l<n;l++)
                    hline[l]=hl[l];
            }else{
                vector<int> vl(m,0);
                int cnt=max(c,m-c);
                for(int l=0;l<cnt;l++)
                    vl[l]= ( (c-l-1<0)? 0 : vline[c-l-1] )+( (c+l>=m)?0:vline[c+l] );
                for(int l=0;l<m;l++)
                    vline[l]=vl[l];
            }
        }
        for(int k=0;k<p;k++){
            scanf("%d%d",&x,&y);
            ans.push_back(hline[x]*vline[y]);
        }
    }
    for(int i=0;i<ans.size();i++){
        printf("%d\n",ans[i]);
    }
    return 0;
}


Measured memory_bytes: 3276
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
    cin >> s;
  for(int i = 0; i < s.size(); i++)
  {
  	if(i == 5 || i == 13)
    	cout << " ";
    else
      cout << s[i];
  }
  cout << endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int sum=0;
  rep(i,n){
    for(int j=i+1;j<n;j++){
      sum += a[i]*a[j];
    }
  }
  
  cout << sum << endl;
  
  return(0);
}

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

class ufds_t {
public:
  using ints_t = vector<int>;

  ufds_t(int n) {
    _parents.resize(n+1);
    iota(_parents.begin(), _parents.end(), 0);
    _sizes.assign(n+1, 1);
    _ranks.assign(n+1, 0);
    _disjoint_sets_nb = n;
    _n = n;
  }

  int get_parent(int u) {
    if(_parents[u] == u) {
      return u;
    } else {
      _parents[u] = get_parent(_parents[u]);
      return _parents[u];
    }
  }

  void add(int u, int v) {
    int p_u = get_parent(u);
    int p_v = get_parent(v);

    if(p_u == p_v) {
      return;
    }

    if(_ranks[p_u] > _ranks[p_v]) {
      _parents[p_v] = _parents[p_u];
      _sizes[p_u] += _sizes[p_v];
    } else {
      _parents[p_u] = _parents[p_v];
      _sizes[p_v] += _sizes[p_u];
    }

    if(_ranks[p_u] == _ranks[p_v]) {
      ++_ranks[p_v];
    }
    --_disjoint_sets_nb;
  }

  int disjoint_sets_nb() {
    return _disjoint_sets_nb;
  }

  void trace() {
    cout << "i: ";
    for(int i = 1; i <= _n; ++i) {
      cout << setw(2) << i << " ";
    }
    cout << "\n";
    cout << "p: ";
    for(int i = 1; i <= _n; ++i) {
      cout << setw(2) << _parents[i] << " ";
    }
    cout << "\n";
    cout << "r: ";
    for(int i = 1; i <= _n; ++i) {
      cout << setw(2) << _ranks[i] << " ";
    }
    cout << "\n";
    cout << "s: ";
    for(int i = 1; i <= _n; ++i) {
      cout << setw(2) << _sizes[i] << " ";
    }
    cout << "\n";
  }

protected:
  ints_t _parents, _sizes, _ranks;
  int _disjoint_sets_nb;
  int _n;
};

int main() {
  int n, m;
  cin >> n >> m;

  ufds_t ufds(n);
  while(m--) {
    int u, v;
    cin >> u >> v;

    ufds.add(u, v);
  }

  //ufds.trace();

  int disjoint_sets_nb = ufds.disjoint_sets_nb();
  if(disjoint_sets_nb > 0) {
    cout << disjoint_sets_nb - 1 << "\n";
  } else {
    cout << "\n";
  }

  return 0;
}

Measured memory_bytes: 4548
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long 
#define int long long 
#define vll vector<long long>
#define pii pair<long long ,long long > 
#define vvi vector< vector<long long > > 
#define vpii vector<pair<int,int>> 
#define pll  pair<long long ,long long > 
#define pb  push_back
#define ff  first 
#define sec second  
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend()) 
#define m_p make_pair
#define all(x)   (x.begin(),x.end()) 
#define sz(v)     ((int)(v.size()))
#define INF 1e9+7
typedef vector< long long > vi ;
const int MOD=1e9 +7 ;
int size=10000000; 


int32_t main(){
  fast; 
  
   int n , m ; cin>>n>>m; 

   vi a(n); 
   int sum=0 ;
   for(int i=0;i<n;i++){
      cin>>a[i]; 
      sum+=a[i]; 
   }

   SORT(a); int count=0;  int loc=0; 
   
   for(int i=n-1;i>=0;i--){

    if(count==m) { loc=1; 
      break; 
    }
    else{

      if((double)sum/(4*m) <= a[i]) {
        count++;
      } 
    }

   
   }

   if(count==m)loc=1; 

   if(loc) cout<<"Yes"<<endl; 
   else cout<<"No"<<endl; 


  
  return 0; 

}

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

using namespace std;

int main(){
    double sum=0;
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        int p=i;
        double mult=1;
        while(p<k){
            p*=2;
            mult/=2;
        }
        sum+=(mult);
    }
    sum/=n;
    cout<<setprecision(12);
    cout<<sum;
    return 0;
}

Measured memory_bytes: 256
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-01-03 17:18:04
*/

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

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int a, b;
    cin >> a >> b;

    int ans = 4 + 2 + 1;
    ans -= (1<<(a-1));
    ans -= (1<<(b-1));

    for (int i = 0; i < 3; i++) {
        if (ans == (1<<i)) {
            ans = i+1;
            break;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <iostream>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

typedef long long ll;

int N;
double memo[310][310][310];
bool visited[310][310][310];
double solve(int i1, int i2, int i3) {
  double &res = memo[i1][i2][i3];
  if(!visited[i1][i2][i3]) {
    visited[i1][i2][i3] = true;
    if(i1 == 0 && i2 == 0 && i3 == 0) {
      res = 0;
    } else {
      // res = i1/N * (1+solve(i1-1, i2, i3)) + i2/N * (1+solve(i1+1, i2-1, i3)) + i3/N * (1+solve(i1, i2+1, i3-1)) + (N-i1-i2-i3)/N*(1+res);
      // (i1+i2+i3)*res = N + i1*solve(i1-1, i2, i3) + i2*solve(i1+1, i2-1, i3) + i3*solve(i1, i2+1, i3-1);
      double c1 = i1 == 0 ? 0 : i1 * solve(i1-1, i2, i3);
      double c2 = i2 == 0 ? 0 : i2 * solve(i1+1, i2-1, i3);
      double c3 = i3 == 0 ? 0 : i3 * solve(i1, i2+1, i3-1);
      res = (N + c1 + c2 + c3) / (i1+i2+i3);
    }
  }
  return res;
}

int main(void) {
  int cs[4] = {};
  scanf("%d", &N);
  REP(i, N) {
    int a;
    scanf("%d", &a);
    cs[a]++;
  }
  double res = solve(cs[1], cs[2], cs[3]);
  
  printf("%.10f\n", res);
  return 0;
}


Measured memory_bytes: 256256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		
		String s = scanner.next();
		
		scanner.close();
		
		int year  = Integer.valueOf(s.substring(0, 4));
		int month = Integer.valueOf(s.substring(5, 7));
		int day   = Integer.valueOf(s.substring(8, 10));
		
		int value = year*10000 + month*100 + day;

		if (value <= 20190430) {
			System.out.println("Heisei");
		} else {
			System.out.println("TBD");
		}
	}

}

Measured memory_bytes: 22356
#include <stdio.h>
int main(){
	int n;
	scanf("%d", &n);
	
	int a[n], b[n];
	
	for(int i = (n-1); i >= 0; i--){
		scanf("%d", &a[i]);
	}
	for(int i = 0; i < n; i++){
		if( i == (n-1))
			printf("%d\n", a[i]);
		else
		printf("%d ", a[i]);
	}
	
  return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env ruby

(n, x) = gets.chomp.split(/ /).map(&:to_i)

cities = gets.chomp.split(/ /).map(&:to_i)

def soinsu(num)
  n = num
  soinsu = Array.new
  (2..n).each do |i|
    if (num % i == 0)
      soinsu << i
      num /= i
    end
    redo if num % i == 0
  end
  soinsu
end

if (n == 1)
  puts (cities[0] - x).abs
  exit
end
sabun = Array.new
cities.each do |c|
  sabun << (c - x).abs
end

m = sabun.min
soi = soinsu(m)

res = 1
soi.each do |s|
  sabun2 = []
  sabun.each do |sa|
    if sa % s == 0
      sabun2 << sa / s
    end
  end
  if sabun.size == sabun2.size
    sabun = sabun2
  res *= s
  end
end

puts res

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

int dp[3005][3005][3];

int main() {
	string s,t;
	cin>>s>>t;
	for(int i=1;i<=s.length();i++)
		for(int j=1;j<=t.length();j++){
			if(s[i-1]==t[j-1]) dp[i][j][0]=dp[i-1][j-1][0]+1,dp[i][j][1]=i-1,dp[i][j][2]=j-1;
			else{
				dp[i][j][1]=i,dp[i][j][2]=j;
				if(dp[i-1][j][0]>dp[i][j-1][0]) dp[i][j][0]=dp[i-1][j][0],dp[i][j][1]=i-1;
				else dp[i][j][0]=dp[i][j-1][0],dp[i][j][2]=j-1;
			}
		}
	//for(int i=0;i<=s.length();cout<<'\n',i++)
	//	for(int j=0;j<=t.length();j++)
	//		cout<<dp[i][j][0]<<' ';
	//cout<<dp[s.length()][t.length()][0]<<'\n';

	string ans="";
	if(s[s.length()-1]==t[t.length()-1]) ans+=s[s.length()-1];
	for(int i=dp[s.length()][t.length()][1],j=dp[s.length()][t.length()][2];i>0 && j>0;){
		//cout<<i-1<<' '<<j-1<<' '<<s[i-1]<<' '<<t[j-1]<<'\n';
		if(s[i-1]==t[j-1]) ans+=s[i-1];
		//cout<<ans<<'\n';
		int o=dp[i][j][1],g=dp[i][j][2];
		i=o,j=g;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<'\n';
}

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

#define NIL NULL

struct node {
  int key;
  struct node *left;
  struct node *right;
  struct node *parent;
};
struct node *root;

void inorder(struct node *);
void preorder(struct node *);
void insert(int);

int main()
{
  int i, x, n;
  char s[10];

  scanf("%d", &n);
  for(i=0; i<n; i++) {
    scanf("%s", s);
    if(strcmp("insert", s) == 0) {
      scanf("%d", &x);
      insert(x);
    }
    else if(strcmp("print", s) == 0) {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void inorder(struct node *T)
{
  if(T != NIL) {
    if(T->left != NIL)
      inorder(T->left);
    printf(" %d", T->key);
    if(T->right != NIL)
      inorder(T->right);
  }
}

void preorder(struct node *T)
{
  printf(" %d", T->key);
  if(T != NIL) {
    if(T->left != NIL)
      preorder(T->left);
    if(T->right != NIL)
      preorder(T->right);
  }
}

void insert(int key)
{
  struct node *y = NIL;
  struct node *x = root;
  struct node *z;

  z = (struct node *)malloc(sizeof(struct node));
  z->key = key;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL) {
    y = x;
    if(z->key < x->key)
      x = x->left;
    else
      x = x->right;
  }
  z->parent = y;
  if(y == NIL)
    root = z;
  else if(z->key < y->key)
    y->left = z;
  else
    y->right = z;
}

Measured memory_bytes: 24040
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    string b;
    cin >> b;
    int i = 0;
    if((b.at(0)=='0'&&b.at(1)!='0') ||(b.at(0) == '1' && (b.at(1) == '0'|| b.at(1) == '1'|| b.at(1) == '2')))i++;
    if ((b.at(2) == '0' && b.at(3) != '0') || (b.at(2) == '1' && (b.at(3) == '0' || b.at(3) == '1' || b.at(3) == '2')))i+=2;
    if (i == 3) { cout << "AMBIGUOUS" << endl; }
        if(i==2){ cout << "YYMM" << endl; }
        if (i == 1) { cout << "MMYY" << endl; }
        if (i == 0) { cout << "NA" << endl; }
}

Measured memory_bytes: 256