akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Random;


public class Main {
	
	public static void main(String[] args) {
		new Main().run();
	}
	
	final long MOD=(long)1e9+7;

	long ADD(long a,long b) {
		return a+b>=MOD?a+b-MOD:a+b;
	}

	void run() {
		FastScanner sc=new FastScanner();
		long X=sc.nextLong();
		long cur=100;
		for (int i=1;;++i) {
			cur=BigInteger.valueOf(cur).multiply(BigInteger.valueOf(101)).divide(BigInteger.valueOf(100)).longValue();
			if (cur>=X) {
				System.out.println(i);
				return;	
			}
		}
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}




class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
    	return (int)nextLong();
    }
}

Measured memory_bytes: 34816
#include <stdio.h>

int main(void){
    int A, B, C, K;
    int sum = 0;

    scanf("%d%d%d%d", &A, &B, &C, &K);

    if(K < A){
        sum = K;
    }else if(K - A < B){
        sum = A;
    }else{
        sum = A - (K - A - B);
    }

    printf("%d\n", sum);

    return 0;
}


Measured memory_bytes: 1708
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

class Solver {
};
	int main() {
		int now = 0;
		int max = 300000;
		vector<int> vals;
		while (true) {
			if (now * 7 + 1 > max)break;
			vals.emplace_back(now * 7 + 1);
			if (now * 7 + 6 > max)break;
			vals.emplace_back(now * 7 + 6);
			now++;
		}

		vector<bool> isPrime(vals.size(), true);
		vector<int> primes;
		for (int i = 1; i < vals.size(); i++) {
			if (isPrime[i])primes.emplace_back(vals[i]);

			for (int j = i; j < vals.size(); j++) {
				int div1 = vals[i] / 7;
				int div2 = vals[j] / 7;
				int margin1 = vals[i] % 7;
				int margin2 = vals[j] % 7;
				int nextI = (7 * div1 * div2 + div1 * margin2 + div2 * margin1
					+ (margin1 * margin2) / 7) * 2;
				if ((margin1 * margin2) % 7 == 6)nextI++;
				if (nextI >= isPrime.size())break;
				isPrime[nextI] = false;
			}
		}

		while (true) {
			int n;
			cin >> n;
			if (n == 1)break;

			cout << n << ':';
			for (int i = 0; i < primes.size(); i++) {
				if (primes[i] > n)break;
				if (n % primes[i] > 0)continue;

				cout << ' ' << primes[i];
			}
			cout << endl;
		}
	}



Measured memory_bytes: 3360
s = gets.chomp.split(//)

s.each_with_index do |c, i|
  if (i+1).odd?
    if c == 'L'
      puts 'No'
      exit
    end
  else
    if c == 'R'
      puts 'No'
      exit
    end
  end
end

puts 'Yes'

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

typedef pair<int,int> pi;
typedef vector<int> vi;

const int INF=123456789;

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

    int w,h;
    while(cin >>w >>h,w)
    {
        vector<string> s(h);
        rep(i,h) cin >>s[i];

        vector<pi> tiles;
        rep(i,h)rep(j,w) if(s[i][j]=='o') tiles.pb(pi(i,j));
        rep(i,h)rep(j,w) if(s[i][j]=='*') tiles.pb(pi(i,j));

        int T=tiles.size();

        int d[11][11]={0};

        #define IN(x,y) (0<=x && x<w && 0<=y && y<h)
        rep(i,T)
        {
            vector<vi> dist(h,vi(w,INF));
            dist[tiles[i].fi][tiles[i].se]=0;
            queue<pi> que;
            que.push(pi(tiles[i]));
            while(!que.empty())
            {
                pi now=que.front();
                que.pop();
                rep(j,4)
                {
                    int nx=now.se+dx[j], ny=now.fi+dy[j];
                    if(IN(nx,ny) && s[ny][nx]!='x' && dist[ny][nx]>dist[now.fi][now.se]+1)
                    {
                        dist[ny][nx]=dist[now.fi][now.se]+1;
                        que.push(pi(ny,nx));
                    }
                }
            }

            rep(j,T)
            {
                if(i==j) continue;
                d[i][j]=dist[tiles[j].fi][tiles[j].se];
            }
        }

        int dp[2048][11];
        fill(dp[0],dp[2048],INF);
        dp[1][0]=0;
        for(int i=1; i<(1<<T); ++i)rep(j,T)if(i>>j&1)rep(k,T)if(!(i>>k&1))
        {
            int nx=i+(1<<k);
            dp[nx][k]=min(dp[nx][k],dp[i][j]+d[j][k]);
        }

        int ans=INF;
        rep(i,T) ans=min(ans,dp[(1<<T)-1][i]);
        if(ans==INF) ans=-1;
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 3224
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			a.add(sc.nextInt());
		}
		Collections.sort(a, Collections.reverseOrder());

		int aliceScore = 0;
		int bobScore = 0;
		for(int i = 0; i < N; i++) {
			if(i%2 == 0) {
				aliceScore += a.get(i);
			} else {
				bobScore += a.get(i);
			}
		}

		System.out.println(aliceScore-bobScore);
	}
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int num = 1;
    vector<int> V;
    V.push_back(1);
    for(int i = 6;i <= 1000000;i *= 6){
        V.push_back(i);
    }
    for(int i = 9;i <= 1000000;i *= 9){
        V.push_back(i);
    }
    
    int N;
    cin >> N;

    vector<int> dp(N+10,INF);
    dp[0] = 0;
    rep(i,0,N){
        for(auto j:V){
            if(i + j <= N)dp[i + j] = min(dp[i + j], dp[i] + 1);
        }
    }
    cout << dp[N] << endl;

}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	lint N;
	lint A[100010]={};
	
	cin >> N;
	for(int i=0;i<N;i++)
		cin >> A[i];
	
	A[N]=0;
	lint ans=0;
	for(int i=0;i<N;i++)
	{
		ans+=A[i]/2;
		A[i]%=2;
		if(A[i]>0 && A[i+1]>0)
		{
			ans++;
			A[i]--;
			A[i+1]--;
		}
	}

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



Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    public class Prog
    {
        const int MOD = 1000000007;
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Prog().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            var n = cin.ReadInt;
            var a = cin.ReadIntArray(n + 1);
            var b = cin.ReadIntArray(n);

            var ans = 0L;
            for (int i = 0; i < n; i++)
            {
                var defeat = Math.Min(a[i], b[i]);
                ans += defeat;
                b[i] -= defeat;
                defeat = Math.Min(a[i + 1], b[i]);
                ans += defeat;
                a[i + 1] -= defeat;
            }

            Console.WriteLine(ans);
        }
    }
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; } }
    }
}


Measured memory_bytes: 31836
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int n;
  scanf("%d", &n);
  int judge = 1;
  char s[101][11];
  scanf("%s", s[0]);
  char last = s[0][strlen(s[0]) - 1];
  rep(i, 1, n) {
    scanf("%s", s[i]);
    int len = strlen(s[i]);
    rep(j, 0, i) {
      if (strcmp(s[j], s[i]) == 0) judge = 0;
    }
    if (last != s[i][0]) judge = 0;
    last = s[i][len - 1];
  }
  printf(judge ? "Yes\n": "No\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    int ans = 0;
    int c = 0;
    f(i,0,s.size()){
        if(s[i] == 'R'){
            c = 1;
            int j = i+1;
            while(j < s.size() and s[j] == 'R'){
                j++;
                c++;
            }
            ans = max(ans,c);
        }
    }
    ans = max(ans,c);
    cout << ans;
    return 0;
}
 

Measured memory_bytes: 3564
while True:
    li = input().split()
    li[0] = int(li[0])
    li[1] = int(li[1])
    
    if li[0] == li[1] and int(li[0]) == 0:
        break
    else:
        li.sort()
        print(int(li[0]),int(li[1]))


Measured memory_bytes: 5612
#include<bits/stdc++.h>
#define st first
#define nd second

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
const int mod = 998244353, inv = 499122177;
int mul(int a, int b){
	return 1LL * a * b % mod;
}
int add(int a, int b){
	a += b;
	a %= mod;
	if(a < 0) a += mod;
	return a;
}
int f_pow(int num, int idx){
	if(idx == 0) return 1;
	if(idx == 1) return num;
	int k = f_pow(num, idx >> 1);
	k = mul(k, k);
	if(idx & 1) k = mul(num, k);
	return k;
}
int dp[3005];

int main(){
	int n, s, x;
	scanf("%d %d", &n, &s);
	dp[0] = 1;
	for(int i = 1; i <= n; i++){
		scanf("%d", &x);
		for(int i = s; i >= 0; i--){
			dp[i] = mul(2, dp[i]);
			if(i - x >= 0) dp[i] = add(dp[i], dp[i - x]);	
			//printf("%d ", dp[i]);
		}
	}
	printf("%d", dp[s]);

}

Measured memory_bytes: 3820
#include <iostream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <limits>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#include <cmath>
#include <complex>
// #include "utiltime.hpp"

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

const int INFL = (int)1e9;
const ll INFLL = (ll)1e18;
const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loopll(i, n) for(ll i = 0; i < (ll)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopll1(i, n) for(ll i = 1; i <= (ll)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = (ll)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define Looprll1(i, n) for(ll i = (ll)n; i >= 1; i--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(i, vector.size()) { cout << vector[i] << " "; } cout << endl;
#define printmx(matrix) Loop(i, matrix.size()) { Loop(j, matrix[i].size()) { cout << matrix[i][j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(double x) { ll m = (ll)sqrt(x); return m + (m * m <= (ll)(x) ? 0 : -1); }
ll ceilsqrt(double x) { ll m = (ll)sqrt(x); return m + ((ll)x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }

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

struct edge {
	int s;
	int t;
	int c;
};

int main() {
	int k; cin >> k;
	int a = 1;
	int n = 0;
	while (k >= a) {
		a *= 2;
		n++;
	}
	a /= 2;
	vector<P> lst;
	while (k - a > 0) {
		k -= a;
		lst.push_back({ a + (lst.size() ? lst.back().first : 0), (int)log2(k) });
		a = 1 << (int)log2(k);
	}
	vector<edge> edges;
	Loop(i, n - 1) {
		if (i == n - 2) {
			edges.push_back({ 1, n - i, 1 << i });
			edges.push_back({ 1, n - i, 0 });
		}
		else {
			edges.push_back({ n - i - 1, n - i, 1 << i });
			edges.push_back({ n - i - 1, n - i, 0 });
		}
	}
	Loop(i, lst.size()) {
		edges.push_back({ 1, n - lst[i].second, lst[i].first });
	}
	cout << n << " " << edges.size() << endl;
	Loop(i, edges.size()) {
		cout << edges[i].s << " " << edges[i].t << " " << edges[i].c << endl;
	}
}

Measured memory_bytes: 384
#include <cstdio>
    #include <cmath>
    #include <cstdlib>
    #include <cstring>
    #include <algorithm>
    #include <iostream>
     
    using namespace std;
    int main()
    {
    	int n;	
    	int o , p ,q ,w;
    /*	while(~scanf("%d", &n))
    	{*/
        	scanf("%d", &n);
    		o = n / 1000;
    		p = n / 100 - o * 10;
    		q = n / 10 - p *10 - o * 100;
    		w = n % 10;
    	//	printf("%d %d %d %d\n",o ,p , q,w);
    		if((o == p) && (p == q) &&( q== w))
    			printf("Yes\n");
    		else if((o == p)&& (p == q))
    			printf("Yes\n");
    	//	else if((o == p) && (p == w))
    	//		printf("Yes\n");
    		else if((p == q) && (q== w))
    			printf("Yes\n");
    	//	else if((o == q) && (q == w))
    	//		printf("Yes\n");
    		else
    			printf("No\n");
    	return 0;
    	
    }

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

int main(void){
    int x,h,m,s;
    cin >> x;

    h = x/3600;
    m = x%3600 / 60;
    s = x%3600 % 60;

    cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3084
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

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


	ll h, w;
	cin >> h >> w;
	ll ans = 0;
	if (h == 1 || w == 1) {
		cout << 1;
		return 0;
	}
	ans += (w + 1) / 2 * ((h + 1) / 2);
	ans += w / 2 * (h / 2);
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
N, x = map(int, input().split())
a = list(map(int, input().split()))
c = 0
if a[0]>x:
  c = a[0] - x
  a[0] = x

for i in range(N-1):
  if a[i]+a[i+1]>x:
    c += (a[i]+a[i+1]-x)
    a[i+1] = x - a[i]

print(c)

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

int main(){
  list<int> lst;
  int n;
  cin >> n;
  rep(i, n){
    char s[20];
    int in;
    scanf("%s", s);
    if(strcmp(s, "deleteFirst") == 0){
      lst.pop_front();
    }else if(strcmp(s, "deleteLast") == 0){
      lst.pop_back();
    }else if(strcmp(s, "insert") == 0){
      scanf("%d", &in);
      lst.push_front(in);
    }else if(strcmp(s, "delete") == 0){
      scanf("%d", &in);
      for(list<int>::iterator itr = lst.begin(); itr != lst.end(); itr++){
        if(*itr == in){
          lst.erase(itr);
          break;
        }
      }
    }
  }
  int count = 0;
  for(list<int>::iterator itr = lst.begin(); itr != lst.end(); itr++, count++){
    if(count != 0) cout << " ";
    cout << *itr;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 34412
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
long long X;
cin>>X;
long long dp[100010]={};
dp[100]+=1;
dp[101]+=1;
dp[102]+=1;
dp[103]+=1;
dp[104]+=1;
dp[105]+=1;
if(X>110){
for(int i=110;i<=X;i++){
  if(dp[i-100]+dp[i-101]+dp[i-102]+dp[i-103]+dp[i-104]+dp[i-105]>0){
    dp[i]=1;
  }
}}
if(dp[X]>0){
  cout<<1<<"\n";
}
else{
  cout<<0<<"\n";
}
return 0;
}


Measured memory_bytes: 1152
#include <utility>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <numeric>
#include <limits>
#include <queue>
#define ll long long int
#define rep(i,rept) for (ll i = 0; i < rept; i++)
#define Yes(b) std::cout<< (b ? "Yes" : "No")<<std::endl
#define YES(b) std::cout<< (b ? "YES" : "NO")<<std::endl
#define fr first
#define se second
#define se second
#define lolo 92233720368547757
#define susu 1000000007

using namespace std;
int main() {

	int a, b;
	cin >> a >> b;
	if (a%b == 0) {
		cout << 0;
		return 0;
	}
	cout << 1;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      double n = sc.nextDouble();
      double k = sc.nextDouble();

      double ans = 0;

      for(int i=1;i<=n;i++){
        int xn = 0;
        while(i*(Math.pow(2,xn))<k){
          xn++;
        }
        ans += (1/n)*(Math.pow(0.5,xn));
        xn = 0;
      }


      System.out.println(ans);

    }
}


Measured memory_bytes: 25044
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String line = sc.nextLine();
        int[] h = new int[n];
        String[] ll = line.split(" ");

        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(ll[i]);
        }

        boolean isLiner = true;
        int max = h[0];
        for (int i = 0; i < n; i++) {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        }

        if (isLiner) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        return;
    }
}


Measured memory_bytes: 48176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }


int main() {
    ll n;
    cin >> n;
    
    int ans = 20;
    for (int i = 1; (ll)i * i <= n; ++i) {
        if (n % i == 0) {
            chmin(ans, max(sz(to_string(i)), sz(to_string(n / i))));
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
//AtCoder ABC054 A - One Card Poker
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    int A,B;
    cin>>A>>B;
    int as=A==1?14:A;
    int bs=B==1?14:B;
    if(as==bs){
        cout<<"Draw"<<endl;
    }else if(as>bs){
        cout<<"Alice"<<endl;
    }else{
        cout<<"Bob"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;


int32_t main(){
	ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vi a(5);
    REP(i,0,5){
        cin>>a[i];
    }
    sort(a.begin(),a.end());int small=a[0];
    int ans;
    ans=5;
    int div=(n-1)/a[0];
    // deb(div);
    ans+=div;
    // deb(ans);
    cout<<ans<<"\n";


	return 0;
}

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

#define F first
#define S second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())

//#define ZERO(p) memset(p, 0, sizeof(p))
//#define MINUS(p) memset(p, -1, sizeof(p))
//INT_MAX
//INT_MIN
//LLONG_MAX
//LLONG_MIN
//DBL_MIN
//DBL_MAX
//LDBL_MIN
//LDBL_MAX

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int n, m;
    cin >> n >> m;
    string s;
    vector<string> a(n), b(m);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }
    bool flag = false;
    for (int i = 0; i < n && !flag; i++) {
        for (int j = 0; j < n && !flag; j++) {
            if (a[i][j] == b[0][0]) {
                flag = true;
                for (int k = 0; k < m && flag; k++) {
                    for (int l = 0; l < m && flag; l++) {
                        if (i + k < n && j + l < n) {
                            if (a[i+k][j+l] != b[k][l]) {
                                flag = false;
                            }
                        }else{
                            flag = false;
                        }
                    }
                }
            }
        }
    }
    if (flag) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


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

template <
    typename TYPE,
    std::size_t SIZE>
std::size_t a_len(const TYPE (&array)[SIZE])
{
    return SIZE;
}

using namespace std;
using ll = long long int;
using vi = vector<ll>;

#define REPS(a, i, n) for (ll(i) = a; (i) < (n); ++(i))
#define REP(i, n) REPS(0, i, n)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 912345678;

int n;

int main()
{
    int ans = 0;
    cin >> n;
    REP(i, n)
    {
        int l, r;
        cin >> l >> r;
        ans += r - l + 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll n,m;
vl a;

ll f(ll x){
	ll res=0;
	for(int i=0;i<n;i++){
		res+=a.end()-lower_bound(a.begin(),a.end(),x-a[i]);
	}
	return res;
}

int main(){
	cin>>n>>m;
	a=vl(n);
	for(auto &i:a) cin>>i;
	sort(a.begin(),a.end());
	ll l=0,r=inf;
	while(r-l>1){
		ll mid=(l+r)/2;
		if(f(mid)>=m) l=mid;
		else r=mid;
	}
	ll res=(m-f(r))*l;
	for(int i=0;i<n;i++){
		res+=2*a[i]*(a.end()-lower_bound(a.begin(),a.end(),r-a[i]));
	}
	cout<<res<<endl;
}

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

int gcd(int a, int b){
  if(a>b)swap(a, b);
  if(a==0)return b;
  return gcd(b%a, a);
}

int main(){
  int ans=1;
  int n;cin>>n;
  vector<int> a(n);
  vector<int> gl(n), gr(n);
  for(int i=0;i<n;i++)cin>>a.at(i);
  for(int i=0;i<n;i++){
    if(i==0){
      gl.at(i)=a.at(i);
      continue;
    }
    if(a.at(i)%gl.at(i-1)==0){
      gl.at(i)=gl.at(i-1);
    }else{
      gl.at(i)=gcd(gl.at(i-1), a.at(i));
    }
  }
  for(int i=n-1;i>=0;i--){
    if(i==n-1){
      gr.at(i)=a.at(i);
      continue;
    }
    if(a.at(i)%gr.at(i+1)==0){
      gr.at(i)=gr.at(i+1);
    }else{
      gr.at(i)=gcd(gr.at(i+1), a.at(i));
    }
  }
  for(int i=0;i<n;i++){
    int tmp;
    if(i==0)tmp=gr.at(1);
    else if(i==n-1)tmp=gl.at(n-2);
    else tmp = gcd(gr.at(i+1), gl.at(i-1));
    ans=max(ans, tmp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
/*
http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2331961#2
http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2331969#2
http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2331970#2
http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2332101#2
http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2333449#2
*/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <algorithm>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define SREP(i,a,n)	for(int i=a;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define fst	first
#define scn second

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;
const ld eps = 1e-9;

const int val[] = { 1,5,10,50,100,500 };

int main() {
	while (true) {
		int p;	cin >> p;
		vint a(6, 0);
		rep(i, 6)	cin >> a[i];
		if (p == 0)	break;
		int ret = mod;
		for (int i = p; i <= p + 500; i++) {
			//i?????????
			int left = i;
			int tmp = 0;
			for (int j = 5; j >= 0; j--) {
				int add = min(left / val[j], a[j]);
				tmp += add;
				left -= add*val[j];
			}
			if (left != 0)	tmp = mod;
			left = i - p;
			for (int j = 5; j >= 0; j--) {
				int add = left / val[j];
				tmp += add;
				left -= add*val[j];
			}
			ret = min(ret, tmp);
		}
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 2996
N, M = map(int, input().split())

# 一回の試行にかかる時間
total_time = M*1900+(N-M)*100

e = 0
err = 10**(-3)  # 許容誤差(答えが整数だから、いい感じに近くなったら打ち切って、四捨五入)
prev = -1
i = 0

while abs(prev-e) > err:
    prev = e
    e += (1-(1/2)**M)**i*(1/2)**M*total_time*(i+1)
    i += 1


def floor(x, y):
    return ((-x)//y)*(-1)


print(int(floor(e, 1)))


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
  	string s;
  	cin>>s;
  	for (int i = 0; i < SZ(s); ++i)
  		{
  			cout<<"x";
  		}
  		cout<<endl;	

   return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s[s.length() - 1] == '2' || s[s.length() - 1] == '4' || s[s.length() - 1] == '5' || s[s.length() - 1] == '7' || s[s.length() - 1] == '9'){
    cout << "hon";
  }
  else if(s[s.length() - 1] == '0' || s[s.length() - 1] == '1' || s[s.length() - 1] == '6' || s[s.length() - 1] == '8'){
    cout << "pon";
  }
  else
    cout << "bon";
  return 0;
}

Measured memory_bytes: 3628
n, a, b = map(int, input().split())
h = [int(input()) for i in range(n)]

left = 0
right = 10**10
mid = (left + right) // 2
while right - left > 1:
    mid = (left + right) // 2
    count = 0
    for i in range(n):
        if h[i] - mid * b > 0:
            if (h[i] - mid * b) % (a - b) == 0:
                count += (h[i] - mid * b) // (a - b)
            else:
                count += (h[i] - mid * b) // (a - b) + 1
    if mid - count >= 0:
        right = mid
    else:
        left = mid
print(right)

Measured memory_bytes: 52636
#include <iostream>

int main()
{

  int bingo[9];
  bool hit[9];
  
  for(int i=0;i<3;++i){
  	for(int j=0;j<3;++j){
    	std::cin>>bingo[i*3+j];
      hit[i*3+j]=false;
    }
    std::cout<<std::endl;
  }
  
  int n=0;
  std::cin>>n;
  std::cout<<std::endl;
  
  for(int i=0;i<n;++i){
  	int num;
    std::cin>>num;
    std::cout<<std::endl;
    for(int i=0;i<9;++i){
    	if(bingo[i]==num)
          hit[i]=true;
    }
  }
 
  if(hit[4]){
  	for(int i=1;i<5;++i){
    	if(hit[4-i]&&hit[4+i]){
        std::cout<<"Yes"<<std::endl;
          return 0;
        }
          
    }
  }
  if(hit[0]&&hit[1]&&hit[2]){
            std::cout<<"Yes"<<std::endl;
          return 0;
  }
  
    if(hit[0]&&hit[3]&&hit[6]){
            std::cout<<"Yes"<<std::endl;
          return 0;
  }
    if(hit[2]&&hit[5]&&hit[8]){
            std::cout<<"Yes"<<std::endl;
          return 0;
  }
    if(hit[6]&&hit[7]&&hit[8]){
            std::cout<<"Yes"<<std::endl;
          return 0;
  }
  
  std::cout<<"No"<<std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	int T;
	scanf("%d", &T);
	while (T--) {
		char c[2];
		scanf("%s", c);
		if (c[0] == 'Y') return !printf("Four\n");
	}
	return !printf("Three\n");
}

Measured memory_bytes: 384
import random
 
def calc(D, s, t):
  last = [0 for _ in range(26)]
 
  value = 0
  for i in range(D):
    day = i + 1
    value += s[i][t[i]-1]
    last[t[i]-1] = day
    for j in range(26):
      value -= c[j] * (day - last[j])
  return value
 
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [random.randint(1,26) for _ in range(D)]
 
val = calc(D, s, t)
for _ in range(45000):
  d_rand = random.randint(1,D)
  q_rand = random.randint(1,26)
  old = t[d_rand-1]
  t[d_rand-1] = q_rand
  if val > calc(D, s, t):
    t[d_rand-1] = old
  else:
    val = calc(D, s, t)
for i in range(D):
  print(t[i])

Measured memory_bytes: 81584
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	ll n;
	cin>>n;
	n = n%1000;
	if(n==0)cout<<n;
	else cout<<1000-n;
}


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(void){
	int a, b;

	cin >> a >> b;

	if (a % 3 == b % 3 && a % 3 != 0)
		cout << "Impossible" << endl;
	else
		cout << "Possible" << endl;	
}

Measured memory_bytes: 256
N, M = map(int, input().split())
llim = 0
rlim = N + 1
for _ in range(M):
    L, R = map(int, input().split())
    llim = max(llim, L)
    rlim = min(rlim, R)
print(max(0, rlim + 1 - llim))


Measured memory_bytes: 43864
A, B, K = list(map(int, input().split(' ')))
# print(str(A-k) + ' ' + str(K-A-B))
if A + B <= K:
    print('0 0')
elif A >= K:
    print(str(A-K) + ' ' + str(B))
else:
    print('0 ' + str(A+B-K))


Measured memory_bytes: 9052
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    A.sort(key=lambda x:abs(x))
    cnt = 0
    ans = 0
    for a in A:
        ans += abs(a)
        cnt += a<0
    if(cnt&1):
        ans-=abs(A[0])*2
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 86172
void main()
{
    long n, q;
    rdVals(n, q);

    auto st = SegTree!("a + b", long, 0)(n);

    foreach (i; 0 .. q)
    {
        long com, x, y;
        rdVals(com, x, y);

        --x;
        if (com) st.query(x, y).writeln;
        else st.update(x, st[x]+y);
    }
}

struct SegTree(alias pred, T, T init)
{
    import core.bitop;
    alias F = binaryFun!pred;

    long n;
    T[] tree;

    this(long n)
    {
        this.n = n == 1 ? 1 : 1L << bsr(n-1) + 2;
        tree.length = this.n << 1;
        tree[] = init;
    }

    ref T opIndex(long idx) pure nothrow
    {
        return tree[idx+this.n];
    }

    void update(long idx, T x)
    {
        idx += this.n;
        this.tree[idx] = x;
        while (idx >>= 1)
        {
            tree[idx] = F(tree[(idx<<1)], tree[(idx<<1)+1]);
        }
    }

    T query(long x, long y)
    {
        T l = init, r = init;
        for (x += this.n, y += this.n; x < y; x >>= 1, y >>= 1)
        {
            if (x & 1) l = F(l, tree[x++]);
            if (y & 1) r = F(tree[--y], r);
        }
        return F(l, r);
    }
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;


Measured memory_bytes: 7432
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
		
		int ans = 0;
		for(int i = A;i <= B;++i) {
			String s = String.valueOf(i);
			boolean flag = true;
			for(int j = 0;j < s.length()/2;++j) {
				if(s.charAt(j) != s.charAt(s.length()-1-j)) {
					flag = false;
					break;
				}
			}
			if(flag)
				ans++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 28372
#include<stdio.h>
#include<string.h>

#define MAX 1000

int main(){
  int i,j,k,tlen,plen,flag;
  char T[MAX],P[MAX];

  scanf("%s",T);
  scanf("%s",P);

  tlen = strlen(T);
  plen = strlen(P);

  for(i=0;i<tlen;i++){
    flag = 0;
    if(T[i] == P[0]){
      k = i;
      flag = 1;
      for(j=1;j<plen;j++)
	if(T[++k] != P[j])flag = 0;
    }
    if(flag == 1)printf("%d\n",i);
  }

  return 0;
}

Measured memory_bytes: 540
# coding: utf-8
N = input()
A = ['2', '4', '5', '7', '9']
B = ['0', '1', '6', '8']
if N[-1] in A:
    print('hon')
elif N[-1] in B:
    print('pon')
elif N[-1] == '3':
    print('bon')

Measured memory_bytes: 9112
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

char s[3][110];
int main()
{
  scanf("%s", s[0]);
  scanf("%s", s[1]);
  ll n = strlen(s[0]), m = strlen(s[1]);
  int flag;
  if(n>m) flag=1;
  else if(n<m) flag=-1;
  else flag = strcmp(s[0], s[1]);
  puts(flag > 0 ? "GREATER" : flag < 0 ? "LESS" : "EQUAL");
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int int_sort(const void* a, const void* b) {
  return *( int * )a - *( int * )b;
}

int main(void) {
	int T[100000];
	int S[50000];
	int R[500];
	int i,j,k,n,q,t;

	scanf("%d\n", &n);
	for(i=0;i<n;i++) {
		scanf("%d", &T[i]);
	}

	scanf("%d\n", &q);
	for(i=0;i<q;i++) {
		scanf("%d", &S[i]);
	}
	
	qsort((void*)T, n, sizeof(T[0]), int_sort);
	qsort((void*)S, q, sizeof(S[0]), int_sort);
	
	i=j=k=0;
	while(i<n&&j<q) {
		if(T[i] == S[j]) {
			R[k] = T[i];
			i++;j++;k++;
		} else if(T[i] > S[j]) {
			j++;
		} else if(T[i] < S[j]) {
			i++;
		}
	}
	printf("%d\n", k);

	return 0;
}


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

#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;

int L[MAX/2+2],R[MAX/2+2];

llong merge(int A[],int n,int left,int mid,int right){
    int i,j,k;
    llong cnt=0;
    int n1=mid-left;
    int n2=right-mid;
    for(i=0;i<n1;i++) L[i]=A[left+i];
    for(i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1]=R[n2]=SENTINEL;
    i=j=0;
    for(k=left;k<right;k++){
        if(L[i]<=R[j]){
            A[k]=L[i++];
        }else{
            A[k]=R[j++];
            cnt+=n1-i;  //=mid+j-k-1
        }
    }
    return cnt;
}

llong mergeSort(int A[],int n,int left,int right){
    int mid;
    llong v1,v2,v3;
    if(left+1<right){
        mid=(left+right)/2;
        v1=mergeSort(A,n,left,mid);
        v2=mergeSort(A,n,mid,right);
        v3=merge(A,n,left,mid,right);
        return v1+v2+v3;
    }else return 0;
}

int main(){
    int A[MAX],n,i;
    
    cin>>n;
    for(i=0;i<n;i++){
        cin>>A[i];
    }
    
    llong ans=mergeSort(A,n,0,n);
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 4600
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define endl '\n'
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

ll f(ll b,ll n){
    if(n < b)return n;
    else return f(b,n/b) + (n%b);
}
int main(){
    ll a,b;cin >> a >>b;
    if(abs(a-b) <= 1)cout << "Brown" << endl;
    else cout << "Alice" << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right


X = read_ints()
print(X.index(0) + 1)


Measured memory_bytes: 65316
#include<bits/stdc++.h>
using namespace std;
long long int a[200005];
int main(){
	int n;
	cin>>n;
	long long int temp=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<n;i++){
		if(a[i+1]<a[i]){
			temp+=abs(a[i+1]-a[i]);
			a[i+1]=a[i];
		}
	}
	cout<<temp<<endl;
}

Measured memory_bytes: 5072