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

#define tt template<typename T> ostream& operator <<(ostream& os, const
#define tuv template<typename U, typename V> ostream& operator<<(ostream& os, const
tt vector<T>& v)            { os << "["; for(auto & x : v) os << " " << x; os << " ]"; return os; }
tt vector<vector<T> >& m)   { for(auto & x : m) { for(auto & y : x) os << y << " "; os << "\n"; } return os; }
tt set<T>& s)               { os << "{"; for(auto & x : s) os << " " << x; os << " }"; return os; }
tt unordered_set<T>& s)     { os << "{"; for(auto & x : s) os << " " << x; os << " }"; return os; }
tt queue<T>& q)             { queue<T> q2(q); while(!q2.empty()) { os << q2.front() << " "; q2.pop(); } return os; }
tt stack<T>& s)             { stack<T> s2(s); while(!s2.empty()) { os << s2.top() << " "; s2.pop(); } return os; }
tuv pair<U,V>& p)           { os << "(" << p.first << "," << p.second << ")"; return os; }
tuv map<U,V>& m)            { os << "{ "; for(auto & x : m) os << x.first << ":" << x.second << " "; os << "}"; return os; }
tuv unordered_map<U,V>& um) { os << "{ "; for(auto & x : um) os << x.first << ":" << x.second << " "; os << "}"; return os; }


int main(int argc, char * argv[])
{
    std::ios_base::sync_with_stdio(false);    
    std::cin.tie(NULL);

    long long n, k;
    std::cin >> n >> k;

    long long minimum = n;
    for(int i = 0; i < 10000; ++i)
    {
	
	if(n > k)
	{
	    long long m = n/k;
	    n = n - m*k;
	}
	else
	{
	    n = k - n;
	}
	if(n < minimum) minimum = n;
    }
    std::cout << minimum << std::endl;

    return 0;
}


Measured memory_bytes: 3656
import sys
n=int(input())
if n==1:
    print(0)
    sys.exit()
def f(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
tmp=f(n)
ans=0
for i in tmp:
    dd=i[1]
    tt=1
    while dd>0:
        if dd-tt>=0:
            dd-=tt
            tt+=1
            ans+=1
        else:
            break
print(ans)

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

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

#define INF 10000
#define EPS 1e-8

typedef vector<double> vec;
typedef vector<vec> mat;

vec gauss_jordan(const mat& A,const vec& b){
  int n=A.size();
  mat B(n,vec(n+1));
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      B[i][j]=A[i][j];
    }
    B[i][n]=b[i];
  }

  for (int k = 0; k < n-1; k++) {
    for (int i = k + 1; i < n; i++) {
      double d = B[i][k] / B[k][k];
      for (int j = k + 1; j <= n; j++){
        B[i][j] -= B[k][j] * d;
      }
    }
  }

  for (int i = n - 1; i >= 0; i--) {
    double d = B[i][n];
    for (int j = i + 1; j < n; j++){
      d -= B[i][j] * B[j][n];
    }
    B[i][n] = d / B[i][i];
  }

  vec x(n);
  for(int i=0;i<n;i++)x[i]=B[i][n];
  return x;
}


int N,S,T;
int q[101];
int a[101][101],dist[101][101];

int main(){
  while(1){
    cin>>N>>S>>T;
    if(N==0&&S==0&&T==0)break;
    S--;T--;
    rep(i,N)cin>>q[i];
    rep(i,N)rep(j,N){
      cin>>a[i][j];
      if(a[i][j]==0&&i!=j)a[i][j]=INF;
    }
    memcpy(dist,a,sizeof(a));
    rep(k,N)rep(i,N)rep(j,N)minch(dist[i][j],dist[i][k]+dist[k][j]);

    if(dist[S][T]==INF){
      cout<<"impossible"<<endl;
      return 0;
    }

    mat A(N,vec(N,0));
    vec B(N,0);

    rep(i,N){
      if(i==T||dist[i][T]==INF){
        A[i][i]=1;
        continue;
      }
      int mov=0,sum=0;
      if(q[i]){
        rep(j,N){
          if(i==j)continue;
          if(a[i][j]!=INF&&dist[i][T]==a[i][j]+dist[j][T]){
            A[i][j]=-1;
            mov++;
            sum+=a[i][j];
          }
        }
      }else{
        rep(j,N){
          if(i==j)continue;
          if(a[i][j]!=INF){
            A[i][j]=-1;
            mov++;
            sum+=a[i][j];
          }
        }
      }
      A[i][i]=mov;
      B[i]=sum;
    }

    vec res=gauss_jordan(A,B);
    printf("%.10f\n", res[S]);
  }
  return 0;
}



Measured memory_bytes: 3508
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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




int a, b, c, d;

int main() {

	cin >> a >> b >> c >> d;

	int i = 0;
	while (true) {
		if (i % 2 == 0) {
			c -= b;
			if (c <= 0) {
				cout << "Yes" << endl;
				break;
			}
		}
		else {
			a -= d;
			if (a <= 0) {
				cout << "No" << endl;
				break;
			}
		}
		i++;
	}

	return 0;
}


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

const ll MAX = 2000005;
const ll MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

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

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

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

int main(){
  // 前処理
  COMinit();
  
  ll K;
  cin >> K;
  string S;
  cin >> S;
  ll slen = S.length();
  ll ans = 0;
  REP(i,K+1) {
    // Sの最後の文字より手前に i 文字挿入している場合
    // Sの最後の文字より後は自由なので 26^(K-i)
    // Sの最後の文字より前は、25^(i)
    // Sを全体の部分文字列として、その部分列が最短で見つける場合の貪欲処理の反対を考える
    ll knum = modpow(25, i, MOD);
    knum = (knum * modpow(26, K-i, MOD)) % MOD;
    knum = (knum * COM( i+slen-1, slen-1)) % MOD;
    ans = (ans + knum) % MOD;
//    cout << knum << " : " << ans << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 52176
#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define int long long
#define inf 1000000007
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
double pi = 3.141592653589793;
//使うやつはここから下に置こうな
signed main() {
    int a,b,c,k;cin>>a>>b>>c>>k;
    if(k%2)cout<<b-a<<endl;
    else cout<<a-b<<endl;
    return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(d)  (d).begin(),(d).end()
#define RALL(d) (d).rbegin(), (d).rend()
#define PB push_back
#define MP make_pair
#define SZ(d) int((d).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,d,b) for(int i=(d);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(d) memset((d), 0 ,sizeof(d))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int T;

struct f
{
	double l_, r_, v_;
	f() {}
	f(double l, double r, double v): l_(l), r_(r), v_(v) {}
	double operator()(double x)
	{
		if (0 <= x && x <= l_) return v_ + l_ - x;
		else if (l_ <= x && x <= r_) return v_;
		else return v_ + x - r_;
	}
};

int main()
{
	int n;
	cin >> n;
	VI t(n), v(n);
	REP(i, n) cin >> t[i];
	REP(i, n) cin >> v[i];
	T = 0;
	REP(i, n) T += t[i];

	vector<f> fs(n + 1);
	vector<double> vmax(2 * T + 1);
	const double inf = 10000000.;
	int sum_t = 0;
	fs[0] = f(0, 0, 0);
	REP(i, n) {
		fs[i+1] = f(sum_t, sum_t + t[i], v[i]);
		sum_t += t[i];
	}
	fs.push_back(f(T, T, 0));

	REP(i, 2 * T + 1) vmax[i] = inf;
	REP(i, 2 * T + 1)
	{
		REP(j, n + 2) vmax[i] = min(vmax[i], fs[j](double(i) * 0.5));
	}
	double l = 0;
	REP(i, 2 * T)
	{
		l += (vmax[i] + vmax[i + 1]) * 0.5 * 0.5;
	}
	cout << setprecision(10) << l << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <cmath>

inline int ctoi(char c){
  return c - '0';
}

int main(void){
  std::string s;
  std::cin >> s;

  int count_top_white = 0;
  int count_top_black = 0;
  for(int i=0; i<s.size(); i++){
    if(i%2 == ctoi(s[i])){
      count_top_white++;
    }else{
      count_top_black++;
    }
  }
  std::cout << std::min(count_top_white, count_top_black) << std::endl;
  return 0;
  
}


Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>
int main (void){
        int a,b;
        scanf("%d %d",&a,&b);
        if(b<10) {
                a=10*a+b;
        }else if(10<=b&&b<100) {
                a=100*a+b;
        }else{
                a=1000*a+b;
        }
        b=sqrt(a);
        //printf("%d\n",a);
        if ((b*b)==a) {
                printf("Yes");
        }else{
                printf("No");
        }
        return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main()
{
int a,b,c,i,count=0,j;
int arr[3];
scanf("%d%d%d",&a,&b,&c);
arr[0]=a;
arr[1]=b;
arr[2]=c;
for(i=0;i<3;i++)
    for(j=i+1;j<3;j++)
    if(arr[i]!=arr[j])
        count++;
        if(count==0)
            count=1;
        printf("%d",count);
    return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>
 
using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
 
 
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
 
//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
 
void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll a,b,k;
	cin>>a>>b>>k;

	if(a>=k){
		cout<<a-k<<" "<<b<<endl;
	}else{
		b=b+a-k;
		cout<<0<<" "<<max(0LL,b)<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(W: int, a: int, b: int):
    print(max(0, abs(a - b) - W))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(W, a, b)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
    	if(str.equals("ABC")){
    		System.out.println("ARC");
    	}else {
    		System.out.println("ABC");
    	}
    }
}

Measured memory_bytes: 26976
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        char[] cArray = s.toCharArray();
        
        String result = "Yes";
        
        for(int i=0;i<cArray.length;i++) {
            if(i%2==0) {
                //奇数文字目
                if(cArray[i]=='L') {
                    result = "No";
                }
            }else {
                //偶数文字目
                if(cArray[i]=='R') {
                    result = "No";
                }
            }
        }
        
        System.out.println(result);

    }

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }



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

  int n = s.length();
  cout << s.substr(0, n - 8) << endl;


  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
ll a[100010];
int main(){
	int n;
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[i];
	}
	int maxn=0;
	int lmax=0;
	for(int i=1;i<n;i++){
		if(a[i+1]<=a[i]){
			lmax++;
		}
		else{
			lmax=0;
		}
		if(maxn<lmax) maxn=lmax;
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 1024
using System;
class MyMain
{
    static void Main()
    {
        string s = System.Console.ReadLine().Trim();
        int flag=0;
        for(int i=0;i < s.Length;i++)
        {
            if (s.Length - s.Replace(s[i].ToString(), "").Length > 1) { flag = 1; break; }
        }
        System.Console.WriteLine(flag == 0 ? "yes" : "no");
        System.Console.ReadLine();
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
    int n,d,x;
    cin >> n >> d >> x;
    vector<vector<int>> price(d,vector<int>(n));
    for(int i=0 ; i<d; i++){
        for(int j=0; j<n ; j++){
            cin >> price[i][j];
        }
    }
    int ans = x;
    int tmp;
    for(int i=0; i<d-1; i++){
        vector<vector<int>> dp(n, vector<int>(100001,-10000000));
        tmp = ans;
        for(int j=0;j<n;j++){
            dp[j][tmp] = tmp;
            int p= price[i+1][j] - price[i][j];
            for(int k = tmp; k>=0  ; k-- ){
                if(j!=0){
                    if(k+price[i][j] > tmp){
                        dp[j][k] = dp[j-1][k];
                    } else {
                        dp[j][k] = max(max(dp[j-1][k+price[i][j]],dp[j][k+price[i][j]]) + p,dp[j-1][k]); 
                    }
                }else{
                    if(k+price[i][j] > tmp){
                    } else {
                        dp[j][k] = dp[j][k+price[i][j]] + p;
                    }
                }
                ans = max(ans,dp[j][k]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 7188
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

using namespace std;

int main()
{
    long N;
    cin >> N;

    set<long> S;
    for (int digit = 3; digit < 10; digit++)
    {
        for (int seven = 1; seven < digit - 1; seven++)
        {
            for (int five = 1; five < digit - seven; five++)
            {
                int three = digit - seven - five;

                vector<char> C;
                for (int _ = 0; _ < three; _++)
                {
                    C.push_back('3');
                }
                for (int _ = 0; _ < five; _++)
                {
                    C.push_back('5');
                }
                for (int _ = 0; _ < seven; _++)
                {
                    C.push_back('7');
                }

                do
                {
                    string s(C.begin(), C.end());
                    S.insert(stol(s));
                } while (next_permutation(C.begin(), C.end()));
            }
        }
    }

    vector<long> A;
    copy(S.begin(), S.end(), back_inserter(A));
    A.push_back(N);
    sort(A.begin(), A.end());

    for (int i = A.size() - 1; i >= 0; i--)
    {
        if (A.at(i) == N)
        {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 1920
n = gets.to_i
a = gets.split.map!(&:to_i)
x = n % 2

num = Hash.new(0)
a.each do |e|
    num[e] += 1
    if num[e] > 2 || e > n - 1 || e % 2 == x
        puts 0
        exit
    end
end

if x == 1
    if num[0] == 1
        num.delete(0)
    else
        puts 0
        exit
    end
end

unless num.values.all?{|x| x == 2}
    puts 0
    exit
end

n /= 2
ans = 1
n.times{ans = ans * 2 % (10 ** 9 + 7)}

puts ans

Measured memory_bytes: 10892
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

int n, t, l, b;

int x(int f, int t) {
    if (f+t <= n) return f+t;
    else return n-(f+t-n);
}

int main(void){
    while (cin>>n>>t>>l>>b && n) {
        vector<int> g(n+1, 0);
        int a;
        for (int i = 0; i < l; i++) {
            cin >> a;
            g[a] = 1;
        }
        for (int i = 0; i < b; i++) {
            cin >> a;
            g[a] = 2;
        }
    
        vector<vector<double> > dp(t+2, vector<double>(n+1, 0));
        dp[0][0] = 1;
        vector<double> back(t+2, 0);
        for (int i = 0; i < t; i++) {
            for (int j = 0; j < n; j++) {
                if (dp[i][j] == 0) continue;
                for (int k = 1; k < 7; k++) {
                    int a = x(j, k);
                    switch (g[a]) {
                        case 0:
                        dp[i+1][a] += dp[i][j]/6;
                        break;
                        case 1:
                        dp[i+2][a] += dp[i][j]/6;
                        break;
                        case 2:
                        dp[i+1][0] += dp[i][j]/6;
                        break;
                    }
                }
            }
        }
        double ans = 0;
        for (int i = 0; i < t+1; i++) ans += dp[i][n];
        printf("%.12lf\n", ans);
    }
}

Measured memory_bytes: 3156
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


def check_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if len(divisors) > 2:
                return False
            if i != n // i:
                divisors.append(n//i)
    return True


a, b = map(int, input().split())
a_list = make_divisors(a)
b_list = make_divisors(b)
div = set(a_list) & set(b_list)
count = 0

for i in div:
    if check_divisors(i):
        count += 1
print(count)

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


int main(){
    int n;
    ll x;
    cin>>n>>x;
    ll y[100005];
    for(int i=0;i<n;i++){
        cin>>y[i];
        y[i]-=x;
        y[i]=abs(y[i]);
    }
    sort(y,y+n);
    ll ans=1;
    int d=1;
    for(int j=0;j<n;j++){
        if(y[j]%y[0]!=0){
            d*=0;
        }
    }
    if(d==1){
        ans=y[0];
        cout<<ans<<endl;
        return 0;
    }
    for(ll i=y[0]/2;i>=1;i--){
        if(y[0]%i==0){
            int d=1;
            for(int j=0;j<n;j++){
                if(y[j]%i!=0){
                    d*=0;
                }
            }
            if(d==1){
                ans=i;
                cout<<ans<<endl;
                return 0;
            }
        }
        
    }
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll x,res =2;
    cin>>x;
    for(int i=2;i<=1000000;i++){
        int flag =1;
        for(int j=2;j*j<=i;j++){
            if(i%j==0) flag =0;
        }
        if(flag&&i>=x){
            res =i;
            break;
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
n = int(input())
h = [int(e) for e in input().split()]
for i in range(n - 2, 0, -1):
  if h[i] > h[i + 1]:
    h[i] -= 1
  if h[i] > h[i + 1]:
    print('No')
    sys.exit()
print('Yes')

Measured memory_bytes: 14252
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    int n;
    cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
    }
    else {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
}

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

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

using namespace std;

int main(){
	int n,m;
	char s[100002]; scanf("%d%d%s",&n,&m,s);

	vector<int> cost(n+1,-1);
	cost[n]=0;
	for(int x=n;x>0;) if(s[x]=='0') {
		int next=-1;
		for(int d=1;d<=m;d++) if(x-d>=0 && s[x-d]=='0') {
			cost[x-d]=cost[x]+1;
			next=x-d;
		}
		x=next;
	}

	if(cost[0]==-1) return puts("-1"),0;

	for(int x=0;x<n;){
		int pre=x;
		for(;cost[x]+1!=cost[pre];x++);
		printf("%d ",x-pre);
	}

	return 0;
}


Measured memory_bytes: 896
#include <stdio.h>

int main(){
 
  int i,j,a=0,b=0;
  char str[100000];
  scanf("%s",str);
  for(i=0;str[i]!='\0';i++){
  if(i%2==0){
  if(str[i]=='0'){a++;}
    else {b++;}
  }
    else{
   if(str[i]=='1'){a++;}
    else {b++;}
    }
  }
  
  if(a<b){printf("%d",a);}
  	else {printf("%d",b);}
  
  return 0;
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define speedio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

#define ll         long long
#define int        long long
#define pb         push_back
#define ff         first
#define sec        second
#define eb         emplace_back
#define SORT(a)      sort(a.begin(),a.end())
#define SORTR(a)     sort(a.rbegin(),a.rend())
#define all(x)       x.begin(),x.end()
#define sz(v)        ((int)(v.size()))
#define mem(a,val)   memset(&a,val,sizeof(a))
#define mid(s,e)     ((s)+((e)-(s))/2)
#define endl       '\n'


typedef vector<int>     vi;
typedef vector<bool>    vb;
typedef vector<vi>      vvi;
typedef vector<string>  vs;

typedef pair<int, int>  pii;
typedef vector< pii >   vpii;

#define fo(i,a,b)     for(ll i = (int)(a); i <= (int)(b); ++i)
#define fr(i,b)       for(ll i = (int)0; i < (int)(b); ++i)
#define rf(i,a,b)     for(ll i = (ll)(a); i >= (ll)(b); --i)
#define read(a,n)     for(int i=0;i<n;++i)cin>>a[i];
#define show(a,n)     for(int i=0;i<n;++i)cout<<a[i]<<' ';cout<<endl;

const int MOD = 1e9 + 7 ;
const int INF = 1e18    ;


void add(ll &x, ll y) { x += y; if (x >= MOD) x -= MOD; if (x < 0) x += MOD; }

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;


void solve() {

	int n ; cin >> n ; int d ; cin >> d;
	int c = 0;
	for ( int i = 0 ; i < n ; i++ ) {

		int x , y ; cin >> x >> y;

		double dis = sqrt(pow(x, 2) + pow(y, 2));
		if (dis <= d) c++;
	}
	cout << c << endl;
}


int32_t main() {
	speedio; cout << fixed << setprecision(12);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/

	int T = 1; //cin>>T;
	while (T--) {
		solve();
	}

	return 0;
}


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

int n;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    vector <int> a(n+1);
    
    for (int i=1; i<=n; i++)
        cin>>a[i];
    
    
    vector <int> frec(n+1,0);
    
    for (int i=1; i<=n; i++)
        frec[a[i]]+=1;
    
    for (int i=1; i<=n; i++){
        cout<<frec[i]<<"\n";
    }
    
    
    
    return 0;
}

Measured memory_bytes: 4780
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var A = ReadArrayLong();
            var S = A.Sum();
            var X = new long[N];
            X[0] = S;
            for (int i = 1; i < N; i += 2) X[0] -= A[i] * 2;
            for (int i = 1; i < N; i++) X[i] = A[i - 1] * 2 - X[i - 1];

            Console.WriteLine(string.Join(" ", X));
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 29020
#include <stdio.h>
#include <iostream>
#include <string>

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

using namespace std;

int main()
{
    int i = 0;
    string buf[3];

    REP(i, 3)
    {
        cin >> buf[i];
    }

    REP(i, 3)
    printf("%c", buf[i][i]);

    printf("\n");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

// Memo
// 値の候補は[1, 10e9]だから取りうる中央値を全探索するのは無理っぽいことは分かる。
// A, BはXの範囲であるので、中央値の最小と最大を考えてみる。
// 中央値の最小は Xi = Aiのときで、Xi = Biのときは最大になる。
// 次に最小値より1つ大きい値が中央値になることが分かる。
// これを試してみると最小と最大の間は全部作れることがわかる

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  repr(i, n, 0) {
    cin >> a[i] >> b[i];
  }
  int m, M;
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());

  int mid = n / 2;
  if (n % 2 == 0) {
    // 偶数
    int t1 = mid - 1;
    int t2 = mid;
    double m = (a[t1] + a[t2]) / 2.0;
    double M = (b[t1] + b[t2]) / 2.0;
    int p1 = ceil(m);
    int p2 = floor(M);
    int total = (p2 - p1) * 2 + 1;
    if (m - p1 != 0) total += 1;
    if (M - p2 != 0) total += 1;
    cout << total << endl;
  } else {
    // 奇数
    m = a[mid];
    M = b[mid];
    cout << (M - m) + 1 << endl;
  }
}

/**
 * X1 , 1 2, X1 = 1, 2
 * X2 , 2 3, X2 = 2, 3
 * 1 1 1 1 2 2 2 2 2 3
 * 1 2 3
 * 1.5
 * 2 2.5 3 3.5 4
 */


Measured memory_bytes: 4852
n = int(input())

sps = []
for i in range(n):
    s, p = input().split()
    p = int(p)
    sps.append({
        "city": s,
        "score": p,
        "index": i
    })
# sps.sort()

cities = {}
for sp in sps:
    if not sp["city"] in cities:
        cities[sp["city"]] = []
    cities[sp["city"]].append(sp)

# [v.sort() for k, v in cities.items()]
rest_sorted_cities = {}
for k, v in cities.items():
    rest_sorted_cities[k] = sorted(v, key=lambda x:x["score"], reverse=True)

sorted_cities = sorted(rest_sorted_cities.items(), key=lambda x: x[0])

for k, city in sorted_cities:
    [print(rest["index"] + 1) for rest in city]


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

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

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;


int main(){
  string S;
  cin >> S;
  ll n = S.length();
  ll dp[n+1][13];
  rep(i, n+1) rep(j, 13) dp[i][j] = 0;
  dp[0][0] = 1;

  rep(i, n){
    ll tmp[13] = {};
    rep(k, 13) tmp[(k * 10) % 13] += dp[i][k];
    rep(k, 13) dp[i][k] = tmp[k];
    if(S[i] == '?'){
      rep(d, 10){
        rep(k, 13)
          dp[i+1][k] = (dp[i+1][k] + dp[i][(k-d+13)%13]) % MOD;
      }
    }
    else{
      ll d = S[i] - '0';
      rep(k, 13)
        dp[i+1][k] = (dp[i+1][k] + dp[i][(k-d+13)%13]) % MOD;
    }
  }
  cout << dp[n][5] << endl;
  return 0;
}


Measured memory_bytes: 10624
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int32_t main()
{
	int a,b;
	cin >> a >> b;
	int gcd = __gcd(a,b);
	int lcm = (a*1LL*b)/gcd;
	cout<<lcm;
}


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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}

// end of Template

str s,t;
vector <str> ans;
void test (int x){
    bool valid = true;
    for(int i=x;i<x+t.size();i++){
        if(s[i]!='?'){
            if(s[i]==t[i-x]){continue;}
            else{valid=false;break;}
        }
    }

    if(valid){
        str temp = s;
        for(int i=x;i<x+t.size();i++){
            temp[i] = t[i-x];
        }

        for(int i=0;i<temp.size();i++){
            if(temp[i]=='?')temp[i]='a';
        }
        ans.pb(temp);
    }

}
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>s;
    cin>>t;
    int idx = 0;
    while(idx + t.size() - 1 < s.size()){
        test(idx);idx++;
    }
    if(ans.empty())ans.pb("UNRESTORABLE");
    sort(ans.begin(),ans.end());
    cout<<ans[0]<<newl;
}


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

typedef pair<int,int> P;

int N,M;
vector<P> H;

struct edge{
  int to,from,c;
  bool operator<(const edge& e) const{
    return c < e.c;
  }
};

vector<edge> E;

struct uni{
  int d[222];
  void init(){ memset(d,-1,sizeof(d)); }
  int find(int a){ return d[a]<0?a:(d[a]=find(d[a])); }
  void marge(int a,int b){
    a = find(a); b = find(b);
    if( a == b ) return;
    if( d[a] > d[b] ) swap(a,b);
    d[a]+=d[b]; d[b] = a;
  }
  bool same(int a,int b){ return find(a)==find(b); }
  int size(int a){ return -d[find(a)]; }
};

uni U;

bool used[333];
int main(){
  while( cin >> N >> M && (N||M) ){
    U.init();
    H.clear();
    E.clear();
    for(int i=0;i<N;i++) {
      H.push_back(P(i,i));
      cin >> H[i].first;
    }
    sort(H.rbegin(),H.rend());
    for(int i=0;i<M;i++){
      int a,b,c;
      cin >> a >> b >> c;
      --a; --b;
      E.push_back( (edge){a,b,c} );
    }
    sort(E.begin(),E.end());


    int start = N+1;
    for(int i=N;i>1;i--){
      int id=H[0].second;
      if( H[i-1].first == H[i].first && i < N ) continue;
      memset(used,0,sizeof(used));
      for(int j=0;j<i;j++) 
	used[H[j].second] = true;    
      uni up;
      up.init();
      for(int j=0;j<M;j++){
	if( used[E[j].to] && used[E[j].from] ) {
	  if( !up.same(E[j].to,E[j].from) ) {
	    up.marge(E[j].to,E[j].from);
	  }
	}
      }  
      if( up.size(id) == i ) start = i;
      else break;
    }

    long long res = 0;
    for(int i=start;i<=N;i++){
      if( H[i-1].first == H[i].first ) 
	continue;
      for(int j=0;j<i;j++)
	used[H[j].second] = true;
      
      //      cout << id << endl;
      for(int j=0;j<M;j++){
	if( used[E[j].to] && used[E[j].from] ) {
	  if( !U.same(E[j].to,E[j].from) ) {
	    //   cout << E[j].to << " "<< E[j].from << " "<< E[j].c << endl;
	    res+=(long long)E[j].c;
	    U.marge(E[j].to,E[j].from);
	  }
	}
      }    
    }
    
    cout << res << endl;
  }
}

Measured memory_bytes: 1704
N, D = gets.strip.split.map(&:to_i)
a = N.times.map { gets.strip.split.map(&:to_i) }

c = 0
N.times do |i|
  (i + 1..(N - 1)).each do |j|
    sum = 0
    D.times do |k|
      sum += (a[i][k] - a[j][k]).abs ** 2
    end   
    c += 1 if Math.sqrt(sum).to_s[-2,2].eql?('.0') 
  end
end

puts c


Measured memory_bytes: 1788
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<math.h>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n,k;
    cin >> n >> k;
    double answer = 0;
    FOR(i,1,n+1){
        if(i >= k){
            answer+=(double)1/n;
            continue;
        }
        answer += ((double)1/n)/pow(2,ceil(log2((double)k/i)));
    }

    printf("%.12f\n",answer);

    return 0;
}

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

int main(void) {
  int d, w, h, n, r;

  while (1) {
    scanf("%d%d%d", &d, &w, &h);
    if (h == 0) break;

    scanf("%d", &n);
    while (n--) {
      scanf("%d", &r);
      if (sqrt(d * d + w * w) / 2 < r)
	printf("OK\n");
      else if (sqrt(w * w + h * h) / 2 < r)
	printf("OK\n");
      else if (sqrt(d * d + h * h) / 2 < r)
	printf("OK\n");
      else
	printf("NA\n");
    }
  }
  return 0;
}

Measured memory_bytes: 588
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);

ll mod_pow(ll x, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x % m;
		x = x * x % m; n >>= 1;
	}
	return res;
}
struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n % mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint& a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint& a, modint b) { a.n = ((ll)a.n * b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a * a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 19;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

void solve() {
	int a, b, c, k; cin >> a >> b >> c >> k;
	int x = 0;
	while (b <= a) {
		b *= 2; x++;
	}
	while (c <= b) {
		c *= 2; x++;
	}
	if (x <= k) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}




signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init_f();
	//cout << grandy(2, 3, false, false) << "\n";
	//init();
	//int t; cin >> t; rep(i, t)
	solve();
	return 0;
}


Measured memory_bytes: 11848
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
template<typename T> ll min(ll a, const T&& b) { return a < b ? a : b; }
template<typename T> ll min(const T&& a, ll b) { return a < b ? a : b; }
template<typename T> ll max(ll a, const T&& b) { return a > b ? a : b; }
template<typename T> ll max(const T&& a, ll b) { return a > b ? a : b; }
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  ll n; cin >> n;
  string s; cin >> s;
  vector<ll> cnt(26);
  each(c, s) cnt[c-'A']++;
  cout << (cnt['R'-'A'] > cnt[1]) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * <p>Description: </p>
 *
 * @author yong.zhang
 * @version 1.0.0
 * @date 2019/11/14 9:17
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        System.out.println((N - 1) / 2);
    }
}


Measured memory_bytes: 22996
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn f1(a: &Vec<i64>, K: usize) -> i64 {
    let mut ret = std::i64::MIN;
    let sum: i64 = a.iter().sum();
    let mut s = 0;
    for i in 0..min(K, a.len()) {
        s += a[i];
        if sum > 0 {
            let s2 = sum * max(0, ((K - i - 1) / a.len()) as i64);
            ret = max(ret, s + s2);
        }
        ret = max(ret, s);
    }

    return ret;
}

fn main() {
    input! {
       N: usize,
       K:usize,
       P:[Usize1;N],
       C:[i64;N],
    }

    let mut ans = std::i64::MIN;
    for i in 0..N {
        let mut next = i;
        let mut tmp = vec![];
        loop {
            tmp.push(C[next]);
            next = P[next];
            if i == next {
                break;
            }
        }

        ans = max(ans, f1(&tmp, K));
    }

    echo!(ans);
}


Measured memory_bytes: 2392