akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.StringTokenizer;

class Main{
	static int max;
	static int[][] mjs;
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		String s=sc.next();
		int[] alp=new int[26];
		Arrays.fill(alp, 0);
		for(int i=0; i<s.length(); i++) {
			alp[s.charAt(i)-97]++;
		}
		mjs=new int[s.length()][s.length()];
		for(int i=0; i<s.length(); i++) {
			Arrays.fill(mjs[i],-1);
		}
		for(int i=0; i<s.length(); i++) {
			mjs[0][i]=s.charAt(i)-97;
		}
		int answ=114514;
		for(max=0; max<26; max++) {
			for(int i=1; i<s.length(); i++) {
				for(int j=0; j<s.length()-i; j++) {
					if(mjs[i-1][j]!=max && mjs[i-1][j+1]!=max) {
						if(mjs[i-1][j+1]==-1) {
							mjs[i][j]=mjs[i-1][j];
						}
						else {
							mjs[i][j]=mjs[i-1][j];
						}
					}
					if(mjs[i-1][j]==max || mjs[i-1][j+1]==max) {
						mjs[i][j]=max;
					}
				}
			}
			for(int i=0; i<s.length(); i++) {
				boolean ans=ac(i);
				if(ans) {
					answ=Math.min(i, answ);
				}
			}
		}
		pl(answ);

		/*for(int i=0; i<s.length(); i++) {
			for(int j=0; j<s.length(); j++) {
				p(mjs[i][j]+" ");
			}
			pl();
		}*/
	}
	public static boolean ac(int a) {
		for(int i=0; i<mjs[0].length; i++) {
			if(mjs[a][i]!=-1 && max!=mjs[a][i]) {
				return false;
			}
			else if(mjs[a][i]==-1) {
				break;
			}
		}
		return true;
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1000000007;
const int MAXS = 2100;
int64_t dp[1010][MAXS];

int main()
{
  int64_t S;
  cin >> S;
  dp[0][0] = 1;
  for (int i = 0; i < 1000; i++)
  {
    for (int j = 0; j <= 2000; j++)
    {
      (dp[i + 1][j + 3] += dp[i][j]) %= MOD;
    }
    for (int j = 1; j < MAXS; j++)
    {
      (dp[i + 1][j] += dp[i + 1][j - 1]) %= MOD;
    }
  }
  int64_t ans = 0;
  for (int i = 0; i < 1000; i++)
  {
    (ans += dp[i][S]) %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 20040
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n = int(input())

if 1800 <= n < 2000:
    print(1)
elif 1600 <= n <= 1800:
    print(2)
elif 1400 <= n <= 1600:
    print(3)
elif 1200 <= n <= 1400:
    print(4)
elif 1000 <= n <= 1200:
    print(5)
elif 800 <= n <= 1000:
    print(6)
elif 600 <= n <= 800:
    print(7)
elif 400 <= n <= 600:
    print(8)

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> a(n);
  std::cin >> a;

  int64_t b = 0;
  int64_t cur = 1;

  for (int64_t i = 0; i < n; i++) {
    if (a[i] == cur) {
      cur++;
    } else {
      b++;
    }
  }

  if (cur == 1) {
    b = -1;
  }
  std::cout << b << std::endl;
  return 0;
}

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

bool ok(vector<int> x){
	int dif = x[1] - x[0];
	for(int i = 0;i < x.size();i++){
		x[i] -= dif*i;
	}
	for(int i = 0;i < x.size();i++){
		if(x[i] != x[0])return false;
	}
	return true;
}

int a[10800];
int main(){
	int n;
	while(cin >> n, n){
		n++;
		for(int i = 0;i < n;i++)cin >> a[i];
		for(int i = 0;i < n;i++){
			vector<int> res;
			for(int j = 0;j < n;j++){
				if(i == j)continue;
				res.push_back(a[j]);
			}
			if(ok(res)){
				cout << a[i] << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1216
#![allow(unused_imports, non_snake_case)]
use proconio::{
    input, fastout,
    marker::{Chars, Bytes, Usize1}
};

#[fastout]
fn main() {
    input!{
        N: usize,
        A:[usize; N],
        mut B:[usize; N],
    }
    B.reverse();
    let mut f = vec![false; N];
    let mut idx = 0;
    for i in 0..N {
        if A[i] != B[i] { continue };
        while idx < N && (A[idx] == A[i] || B[idx] == B[i] || f[i]) {
            idx += 1;
        }
        if idx >= N {
            println!("No");
            return;
        }
        B.swap(i, idx);
        f[i] = true;
        f[idx] = true;
        idx += 1;
    }
    println!("Yes");
    for &x in &B {
        print!("{} ", x);
    }
    println!();
}


Measured memory_bytes: 8076
#include <iostream>
#include <vector>
#include <map>
using namespace std;

const int divisor = 1000000007;

int main(){
	vector<int> ansvec;

	// 100000!までの数をdivisorで割った余りを格納しておく
	long long* factmodary = new long long[100001];
	long long fact = 1;
	for (int i = 1; i <= 100000; i++){
		fact *= i;
		fact %= divisor;
		factmodary[i] = fact;
	}

	for (;;){
		int N, R;
		cin >> N;
		if (N == 0) break;
		cin >> R;

		int* word = new int[N];
		for (int i = 0; i < N; i++) word[i] = i + 1; //まず0番目の単語を入れておく

		for (int i = 0; i < R; i++){
			int s, t;
			cin >> s >> t;
			/* swap */
			int tmp = word[s - 1]; word[s - 1] = word[t - 1]; word[t - 1] = tmp;
		}

		//word[i]をkey, word[i]より小さい数がそれ以前にいくつ使われていたかをvalueとして格納するmap
		map<int, int> bubblehist;
		bubblehist[word[0]] = 0;

		long long ans = factmodary[N-1] * (word[0] - 1);

		for (int i = 1; i < N; i++){
			int facttime = word[i] - 1;
			int bubblenum;
			map<int, int>::iterator it = bubblehist.lower_bound(word[i]);

			if (it != bubblehist.end()){
				bubblenum = it->second;
			}
			else {
				bubblenum = bubblehist.rbegin()->second + 1;
			}
			pair<int, int> p;
			p.first = word[i];
			p.second = bubblenum;
			bubblehist.insert(--it, p);
			for (map<int, int>::iterator it2 = bubblehist.upper_bound(word[i]); it2 != bubblehist.end(); it2++) ++(it2->second);

			facttime -= bubblenum;
			ans += factmodary[N - (i + 1)] * facttime;
			ans %= divisor;
		}

		delete[] word;
		ansvec.push_back((int)ans);
	}

	for (vector<int>::iterator it = ansvec.begin(); it != ansvec.end(); it++){
		cout << *it << endl;
	}

	delete[] factmodary;
	return 0;
}

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

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

int main() {
	int i, N, d[100000], ans;

	scanf("%d", &N);

	for (i = 0; i < N; i++) scanf("%d", &d[i]);

	qsort((void *)d, N, sizeof(d[0]), asc);

	ans = d[N / 2] - d[N / 2 - 1];

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

	return 0;
}

Measured memory_bytes: 892
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
#define int long long
vector<int> tera, shine;
int near_tera(int now) {
	int top = tera.size()-1;
	int bot = 0;
	int ans = LONG_INF;
	while (top - bot > 1) {
		int mid = (top + bot) / 2;
		if (tera[mid] >= now) {
			top = mid;
		}
		else {
			bot = mid;
		}
	}
	ans = min(ans,llabs(tera[bot] - now));
	ans = min(ans, llabs(tera[top] - now));
	top = tera.size()-1;
	bot = 0;
	while (top - bot > 1) {
		int mid = (top + bot) / 2;
		if (tera[mid] <= now) {
			bot = mid;
		}
		else {
			top = mid;
		}
	}
	ans = min(ans, llabs(tera[bot] - now));
	ans = min(ans, llabs(tera[top] - now));
	return ans;
}
int near_shine(int now) {
	int bot = 0;
	int top = shine.size()-1;
	while (top - bot > 1) {
		int mid = (top + bot) / 2;
		if (shine[mid] >= now) {
			top = mid;
		}
		else {
			bot = mid;
		}
	}
	int ans = LONG_INF;
	if (shine[bot] >= now) {
		ans = min(ans, llabs(shine[bot] - now) + near_tera(shine[bot]));
	}
	else if (shine[top] >= now) {
		ans = min(ans, llabs(shine[top] - now) + near_tera(shine[top]));
	}
	bot = 0;
	top = shine.size() - 1;
	while (top - bot > 1) {
		int mid = (top + bot) / 2;
		if (shine[mid] <= now) {
			bot = mid;
		}
		else {
			top = mid;
		}
	}
	if (shine[top] <= now) {
		ans = min(ans, llabs(now - shine[top]) + near_tera(shine[top]));
	}
	else if (shine[bot] <= now) {
		ans = min(ans, llabs(now - shine[bot]) + near_tera(shine[bot]));
	}
	return ans;
}
#undef int 
int main() {
#define int long long
	int a, b,query;
	cin >> a >> b >> query;
	REP(i, a) {
		int c;
		cin >> c;
		shine.push_back(c);
	}
	REP(i, b) {
		int c;
		cin >> c;
		tera.push_back(c);
	}
	for (int i = 0; i < query; ++i) {
		int c;
		cin >> c;
		long long ans = LONG_INF;
		REP(nya, 2) {
			ans = min(ans, near_shine(c));
			swap(a, b);
			swap(tera, shine);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3060
nums = gets.chomp.chars.map(&:to_i)

(0..7).each do |n|
  pm = n.to_s(2).rjust(3, "0").gsub("0","-").gsub("1","+")
  evaluation = "#{nums[0]}#{pm[0]}#{nums[1]}#{pm[1]}#{nums[2]}#{pm[2]}#{nums[3]}"
  if eval(evaluation) == 7
    puts "#{evaluation}=7"
    exit
  end
end

Measured memory_bytes: 1788
#include <iostream>
using namespace std;
int main(void){
    int N;
    int i;
    cin>>N;
    for(i=1;i<=N;i++){
        int k,p;
        cin>>k>>p;
        int a;
        if(k%p==0){
            cout<<p;
        }
        else{
        a=k%p;
        cout<<a;
        }
        cout<<endl;
    }
}



Measured memory_bytes: 3084
#include <iostream>

using namespace std;

int main() {
    int A, B, C, D;

    cin >> A >> B >> C >> D;

    while(A > 0 && C > 0) {
        C -= B;
        A -= D;
    }

    if(C > 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
constexpr long N = 300000;
constexpr long mod = 998244353;

long mpow(long a, long p){
    long x=a;
    long y=1;
    while(p>0){
        if((p&1)==1){
            y=x*y%mod;
        }
        x=x*x%mod;
        p>>=1;
    }
    return y;
}

long minv(long a){
    return mpow(a, mod-2);
}

long fact[N+1];
long ncr[N+1];
void init_ncr(long n){
    long t=1;
    fact[0]=1;
    for(long i=1; i<=N; i++){
        t=t*i%mod;
        fact[i]=t;
    }
    for(long r=0; r<=n/2; r++){
        ncr[r] = fact[n]*minv(fact[n-r]*fact[r]%mod)%mod;
    }
    for(long r=0; r<=n/2; r++){
        ncr[n-r] = ncr[r];
    }
}

int main(void){
    long n, a, b, k;
    scanf("%ld %ld %ld %ld", &n, &a, &b, &k);
    init_ncr(n);
    long sum = 0;
    long s = max(0l, (k-n*b)/a);
    long e = min(n, k/a);
    for(long i=s; i<=e; i++){
        long q=(k-a*i)/b;
        long m=(k-a*i)%b;
        if(m==0){
            sum = (sum+ncr[i]*ncr[q])%mod;
        }
    }
    if(sum==0)sum++;
    printf("%ld\n", sum);
    return 0;
}


Measured memory_bytes: 4992
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int M = in.nextInt();

        System.out.println(24+24-M);

        in.close();
    }
}


Measured memory_bytes: 21332
import java.util.*;

public class Main {
	public static void main(String[] args) {  
  		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
      	int B = sc.nextInt();
		int push = 0;
      
      	for(int i = 0; i < 2; i++) {
	        if(A > B) {
    	        push += A;
        	    A -= 1;
          	} else {
            	push += B;
              	B -= 1;
          	}
        }
      	System.out.println(push);
    }
}

Measured memory_bytes: 23124
#include<iostream>
#include<string>
#include<cstdlib>
#include<algorithm>
using namespace std;
int main(){
	int n;
	string s;
	int a,b;
	cin>>n;
	while(n--){
		cin>>s;
		sort(s.begin(),s.end());
		a = atoi(s.c_str());
		reverse(s.begin(),s.end());
		b = atoi(s.c_str());
		cout<<b-a<<endl;
	}
	return 0;
}

Measured memory_bytes: 1228
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Main {

	private static List<Integer>[] G;
	private static List<Integer>[] rG;
	private static ArrayList<Integer> vs = new ArrayList<Integer>();
	private static boolean[] used;
	private static int[] cmp;

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		int V = nextInt();
		int E = nextInt();

		G = new List[V];
		rG = new List[V];
		for (int i = 0; i < V; i++) {
			G[i] = new ArrayList<Integer>();
			rG[i] = new ArrayList<Integer>();
		}

		for (int i = 0; i < E; i++) {
			int from = nextInt();
			int to = nextInt();
			G[from].add(to);
			rG[to].add(from);
		}

		used = new boolean[V];
		cmp = new int[V];
		for (int i = 0; i < V; i++) {
			if (!used[i]) {
				dfs(i);
			}
		}

		used = new boolean[V];
		int k = 0;
		for (int i = vs.size() - 1; i >= 0; i--) {
			if (!used[vs.get(i)]) {
				rdfs(vs.get(i), k++);
			}
		}

		int Q = nextInt();
		for (int i = 0; i < Q; i++) {
			int u = nextInt();
			int v = nextInt();
			if (cmp[u] == cmp[v]) {
				System.out.println(1);
			} else {
				System.out.println(0);
			}
		}

	}

	static void dfs(int v) {
		used[v] = true;
		for (int i = 0; i < G[v].size(); i++) {
			if (!used[G[v].get(i)]) {
				dfs(G[v].get(i));
			}
		}
		vs.add(v);
	}

	static void rdfs(int v, int k) {
		used[v] = true;
		cmp[v] = k;
		for (int i = 0; i < rG[v].size(); i++) {
			if (!used[rG[v].get(i)]) {
				rdfs(rG[v].get(i), k);
			}
		}
	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return -1;
	}

}

Measured memory_bytes: 41672
/*
    Author      : Dinesh Verra
    College     : ABV-IIITM
    Date        : 14/08/2020
*/
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision; 
using namespace std;
typedef long long ll;
// #define ll int
typedef unsigned long long ull;
#define cu continue
#define br break
#define pb push_back
#define eb emplace_back
#define mod 1000000007
#define inf 1000000000000
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define F first
#define S second
#define vll vector <ll>
#define vpll vector <pll>
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define all(v) v.begin(),v.end()
#define nl cout<<'\n'

template <typename A1>
void prn(A1&& arg)
{
	cout<<arg<<'\n';
}
template <typename A1, typename... A>
void prn(A1&& arg, A&&... args)
{
	cout<<arg<<' ';
	prn(args...);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);


	ll n;
	cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		for(ll j=i+1;j<n;j++)
		{
			for(ll k=j+1;k<n;k++)
			{
				if(a[i]==a[j] || a[j]==a[k] || a[k]==a[i]) cu;
				if(((a[i]+a[j])>a[k]) && ((a[j]+a[k])>a[i]) && ((a[i]+a[k])>a[j])) ans++;
			}
		}
	}
	prn(ans);
}

Measured memory_bytes: 3656
#include<stdio.h>
#define MAX 100000
int main(){
  int n,i;
  int A[MAX+1];
  scanf("%d",&n);
  for(i=1;i<=n;i++)scanf("%d",&A[i]);

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i/2>=1)printf("parent key = %d, ",A[i/2]);
    if(i*2<=n)printf("left key = %d, ",A[i*2]);
    if(i*2+1<=n)printf("right key = %d, ",A[i*2+1]);
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2044
#include<stdio.h>
int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a>c){
	int x,y;
	x = a, y = c;
	a = y, c = x;
}
if(b>c){
	int q,r;
	q = b, r = c;
	b = r, c = q;
}
if(a>b){
	int n,m;
	n = a, m = b;
	a = m, b = n;
}
printf("%d %d %d\n",a,b,c);
	return 0;
}

Measured memory_bytes: 596
a = list(map(int, input().split()))
a.sort()
ans1 = a[2]-a[1]
dum = a[2]-(a[0]+ans1)
if dum % 2 == 0: ans2 = int(dum/2)
else: ans2 = int(dum/2)+2
print(ans1+ans2)

Measured memory_bytes: 3060
def minHeapify x
  l = 2*x
  r = 2*x+1
  if l <= $n && $heap[l][0] < $heap[x][0]
    minimum = l
  else
    minimum = x
  end
  if r <= $n && $heap[r][0] < $heap[minimum][0]
    minimum = r
  end
  if minimum != x
    $heap[x], $heap[minimum] = $heap[minimum], $heap[x]
    minHeapify(minimum)
  end
end
 
def extract
  key = $heap[1]
  $heap[1] = $heap[$n]
  $n -= 1
  minHeapify(1)
  key
end
 
def insert key
  $n += 1
  $heap[$n] = key
  i = $n
  while i > 1 && $heap[i/2][0] > $heap[i][0]
    $heap[i], $heap[i/2] = $heap[i/2], $heap[i]
    i /= 2
  end
end

def dijkstra(n, l, route, cost_d, cost_e)
  done = (n+1).times.map{ [false] * (l+1) }
  while true
    p = extract
    e, s, r = p
    return e if s == n
    next if done[s][r]
    done[s][r] = true
    route[s].each do |t|
      insert [e + cost_e[s][t], t, r]
      if r >= cost_d[s][t]
        insert [e, t, r - cost_d[s][t]]
      end
    end
  end
end

loop do
  n, m, l = gets.split.map(&:to_i)
  break if n == 0
  $heap = []
  $n = 0
  route = (n+1).times.map{ [] }
  cost_d = (n+1).times.map{ [0] * (n+1) }
  cost_e = (n+1).times.map{ [0] * (n+1) }
  m.times.map do
    s, t, d, e = gets.split.map(&:to_i)
    route[s] << t
    route[t] << s
    cost_d[s][t] = cost_d[t][s] = d
    cost_e[s][t] = cost_e[t][s] = e
  end
  insert [0, 1, l]
  p dijkstra(n, l, route, cost_d, cost_e)
end

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

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

    int a;
    map<int, int> m;
    for (int i = 0; i < n; i++) {
        cin >> a;
        m[a - 1]++;
        m[a + 1]++;
        m[a]++;
    }

    int max_cnt = 0;
    for (auto p : m) {
        if (p.second > max_cnt) max_cnt = p.second;
    }

    cout << max_cnt << endl;

    return 0;
}

Measured memory_bytes: 4736
import kotlin.math.min

fun main() {
    tenka1_2019c()
}

fun tenka1_2019c() {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    if (!s.contains('#') || !s.contains('.')) {
        println(0)
        return
    }
    var rw = s.count { it == '.' }
    var count = rw
    var lb = 0
    for (i in 0 until n) {
        if (s[i] == '.') {
            rw--
        } else {
            lb++
        }
        count = min(count, rw + lb)
    }
    println(count)
}

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

int N;
using lint = long long;
lint D, a[300005];

int main() {
	cin >> N >> D;
	for (int i=0; i<N; ++i) {
		cin >> a[i];
		--a[i];
	}
	
	int ans = 0;
	for (int i=0; i<N; ++i) ans ^= (a[i] % (D + 1));
	puts(ans != 0 ? "First" : "Second");
}



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

int dp[105][4][2];

int main(){
  string s;
  cin >> s;
  int n = s.size();
  int K;
  cin >> K;
  
  dp[0][0][0] = 1;
  
  rep(i,n)rep(j,4)rep(k,2){
  	
  	 // nの今調べている桁
  	 int nd = s[i]-'0';
  	 
  	 //次の桁の数をdとして全て調べる
  	 rep(d,10){
  	 	 int ni = i+1, nj = j, nk = k;
  	 	  if(d != 0) nj++;
  	 	  if(nj > K) continue;
  	 	  if(nk == 0){
  	 	  	 if(d > nd) continue;
  	 	  	 if(d < nd) nk = 1;
  	 	  }
  	 	 dp[ni][nj][nk] += dp[i][j][k]; 
  	 }
  }
  int ans = dp[n][K][0] + dp[n][K][1];
  cout << ans << endl;
  return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    int n;
    cin >> n;
    cout << pow(n, 3) << "\n";
}


Measured memory_bytes: 256
N = int(input())
red = [list(map(int, input().split())) for _ in range(N)]
blue = [list(map(int, input().split())) for _ in range(N)]
blue = sorted(blue, key=lambda x: x[0])

used = []
for i in range(N):
    c, d = blue[i]
    m, tmp = -1, -1
    for j in range(N):
        if j in used:
            continue
        a, b = red[j]
        if a < c and b < d:
            if b > m:
                m = b
                tmp = j
    if tmp != -1:
        used.append(tmp)
print(len(used))

Measured memory_bytes: 9212
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>

using namespace std;

long long choose2(long long n){
    return n * (n - 1) / 2;
}

int main()
{
    int K;
    cin >> K;
    vector<long long> x;
    for (int i = 1; i <= 9; ++i){
        x.push_back(i);
    }
    while( true ){
        if( K<= x.size()){
            cout << x.at(K - 1) << endl;
            return 0;
        }
        K -= x.size();
        vector<long long> old;
        swap(old, x);
        for(long long a: old){
            for (int i = -1; i <= 1; ++i){
                int d = a % 10 + i;
                if( d<0 or d>9)
                    continue;
                long long nx = a * 10 + d;
                x.push_back(nx);
            }
        }
    }
        return 0;
}

Measured memory_bytes: 1712
#include<iostream>

using namespace std;
int main()
{
    char s1[10],s2[10],s3[10];
    cin>>s1>>s2>>s3;
    s1[0]='A'+s1[0]-'a';
    s2[0]='A'+s2[0]-'a';
    s3[0]='A'+s3[0]-'a';
    cout<<s1[0]<<s2[0]<<s3[0];
    return 0;

}


Measured memory_bytes: 256
package main

import "fmt"

const divisor = 1000000000 + 7

func main() {
        var n int
        fmt.Scan(&n)
        level := 1
        for i := 0; i < n; i++ {
                level = level * (i + 1) % divisor
        }
        fmt.Printf("%d\n", level)
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<bitset>
using namespace std;

int n,k;
int a[5005];

int C(int x)
{
    bitset<5005> dp;
    if(a[x]>=k) return 1;
    dp.reset();
    dp[0]=1;
    for(int i=0;i<n;++i)
    {
        if(i==x) continue;
        dp|=(dp<<a[i]);
    }
    for(int i=k-1;i>=k-a[x];--i)
        if(dp[i]) return 1;
    return 0;
}

int main()
{
    while(~scanf("%d %d",&n,&k))
    {
        for(int i=0;i<n;++i)
            scanf("%d",&a[i]);
        sort(a,a+n);
//        int l=-1,r=n+1;
//        while(l<r)
//        {
//            int m=(l+r)/2;
//            if(C(m)) r=m;
//            else l=m+1;
//        }
        int lo = -1, hi = n;
    while(hi-lo>1){
        int m = (lo+hi)/2;
        if(C(m)) hi = m;
        else lo = m;
    }
    //return hi;
        //if(!C(l)) l--;
        printf("%d\n",hi);
    }
}


Measured memory_bytes: 256
n = gets.to_i
arr = gets.split(' ').map(&:to_i)
answer = arr[n-1]

dp = Array.new(n).map { Array.new(21, 0) }
dp[0][arr[0]] = 1
1.upto(n-2) do |i|
  0.upto(20) do |j|
    next if dp[i-1][j] == 0
    vp = j + arr[i]
    vm = j - arr[i]

    dp[i][vp] += dp[i-1][j] if vp <= 20
    dp[i][vm] += dp[i-1][j] if vm >= 0
  end
end

puts dp[n-2][answer]

Measured memory_bytes: 6132
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    string ans = "";

    rep(i, S.length()) {
        //cout << ans << endl;
        if(S[i] == 'B') {
            if (ans.size()) ans.pop_back();
        }
        else ans.push_back(S[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
n, m = map(int, input().split())

while m:
    n, m = m, n % m

pf = {}
for i in range(2, int(n**0.5)+1):
    while n % i == 0:
        pf[i] = pf.get(i, 0)+1
        n //= i
if n > 1:
    pf[n] = 1

if pf == {}:
    print(1)
else:
    print(len(pf)+1)


Measured memory_bytes: 40044
#include<iostream>
using namespace std;
int main() {
	int N, M, count = 0;
	int A[100000], B[100000], H[100000];
	int number[100000] = {};
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}
	for (int j = 0; j < M; j++) {
		cin >> A[j] >> B[j];
	}
	for (int k = 0; k < M; k++) {
		if (H[A[k] - 1] < H[B[k] - 1]) {
			number[A[k] - 1] = 1;
		}
        else if(H[A[k]-1]==H[B[k]-1]){
            number[A[k]-1]=1;
            number[B[k]-1]=1;
        }
		else {
			number[B[k] - 1] = 1;
		}
	}
	for (int l = 0; l < N; l++) {
		if (number[l] == 0) {
			count = count + 1;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 5184
/**
 *    author:  Mohamad Milhem
**/

#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define MOD ll(1000000007)
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<endl;
#define decimalpoint cout << std::fixed << setprecision(5)


void solve(){
	int n;
	cin >> n;
	vector<long long> v(n);
	long long sum = 0;


	lp(i, 0 , n){
		cin >> v[i];
		sum+= v[i];
	}


	long long bigsum = 0;


	lp(i , 0 , n){
		sum-= v[i];
		long long l = (v[i]%MOD * (sum%MOD)) % MOD;
		bigsum = (bigsum%MOD + l%MOD)%MOD;
	}

	cout << bigsum << endl;

}



int main()
{
    FAST;
    int t;
    t = 1;

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


Measured memory_bytes: 4752
#[allow(unused_imports)]
use {
    proconio::{fastout, input, marker::*},
    std::cmp::*,
    std::collections::*,
    std::ops::*,
};

fn main() {
    input! {
        h: usize,
        w: usize,
        ab: [(Usize1, usize); h]
    }

    let mut set = BTreeSet::<(usize, usize)>::new();
    let mut val = BTreeSet::<(usize, usize)>::new();
    for i in 0..w {
        set.insert((i, i));
        val.insert((0, i));
    }

    for (i, &(a, b)) in ab.iter().enumerate() {
        let update = set
            .range((a, 0)..(b, w))
            .map(|&t| t)
            .collect::<Vec<(usize, usize)>>();
        if !update.is_empty() {
            let mut x = 0;
            for (end, start) in update {
                x = max(start, x);
                set.remove(&(end, start));
                val.remove(&(end - start, start));
            }
            if b != w {
                set.insert((b, x));
                val.insert((b - x, x));
            }
        }
        if let Some(&(v, _)) = val.iter().next() {
            println!("{}", v + i + 1);
        } else {
            println!("-1");
        }
    }
}


Measured memory_bytes: 22096
n = int(input())
s = input()

ans = s.count('R')*s.count('G')*s.count('B')

c = 0
for i in range(n):
    for j in range(n):
        k = 2*j - i
        if 0 <= k <= n-1:
            if i < j and j < k:
                if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
                    c += 1
print(ans-c)

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

using namespace std;

const int MAX = 100;

int arr[MAX][MAX];

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		arr[x][y] += 1;
		arr[y][x] += 1;
	}
	for (int i = 1; i <= n; i++) {
		int ans = 0;
		for (int j = 1; j <= n; j++) {
			ans += arr[i][j];
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int NODE[100][100] = {0};


int main() {
	int n,u, k;
	int id;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d %d", &u, &k);
		for (int j = 0; j < k; j++) {
			scanf("%d", &id);
			NODE[u][id] = 1;
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			printf("%d", NODE[i][j]);
			if (j != n)printf(" ");
		}
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 2104
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
#define inf 1e200
typedef long long ll;
ll a[200003][2];
ll n;
ll GetManhattan(ll p[][2], ll n, ll dem)
{
	ll ans = 0, Min, Max;
	ll i, j, k;
	for (i = 0; i < (1 << (dem)); i++) {    //用二进制形式遍历所有可能的运算情况
		Min = inf, Max = -inf;
		for (j = 0; j < n; j++) {    //遍历每一个点
			ll sum = 0;
			for (k = 0; k < 2; k++) {    //因为是五维的，所以有4个运算符
				//提取当前运算符
				ll t = i & 1 << k;    //1为+，0为-
				if (t) sum += p[j][k];
				else sum -= p[j][k];
			}
			if (sum > Max) Max = sum;
			if (sum < Min) Min = sum;
		}
		if (Max - Min > ans)
			ans = Max - Min;
	}
	return ans;
}
#pragma warning(disable:4996)
int main() {
	scanf("%d", &n);
	{
		for (ll i = 0; i < n; i++)
			for (ll j = 0; j < 2; j++) scanf("%lld", &a[i][j]);
		ll ans = GetManhattan(a, n, 2);
		printf("%lld\n", ans);
	}
	return 0;
}

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

  int gcd(int a, int b) {
    //a,bの小さい方(a)から大きい順に割り切れる数を検索する
    for (int i = a; i >= 1; --i) {
      if (a%i == 0 && b%i == 0) {
        return i;
      }
    }
    return 1;
  }

int main() {
  int a,b;
  cin >> a >> b;
  //最小公倍数を求める式はa*b/最大公約数
  ll ans =ll(a)*b / gcd(a,b);

  cout << ans << endl;

}

Measured memory_bytes: 256
fn main() {
    proconio::input! {
        n: usize,
        a_s: [usize; n],
    }
    let mut money = 1000usize;
    let mut stock = 0usize;
    for w in a_s.windows(2) {
        match (stock, w[0].cmp(&w[1])) {
            (0, std::cmp::Ordering::Less) => {
                stock += money / w[0];
                money -= stock * w[0];
            }
            (0, std::cmp::Ordering::Equal) => {}
            (0, std::cmp::Ordering::Greater) => {}
            (_, std::cmp::Ordering::Less) => {}
            (_, std::cmp::Ordering::Equal) => {}
            (_, std::cmp::Ordering::Greater) => {
                money += stock * w[0];
                stock = 0;
            }
        }
    }
    money += stock * a_s.last().unwrap();
    println!("{}", money);
}


Measured memory_bytes: 2128
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M); vector<vector<ll> > v(4);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()), sort(v.rbegin(), v.rend()); //sort
// char '' str ""
int main(void)
{
    int a,b,c;cin>>a>>b>>c;
    int d = max(max(a,b),c);
    int res;
    if(d==a) res = d*10+b+c;
    else if(d==b) res = d*10+a+c;
    else if(d==c) res = d*10+b+a; 

    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define INF 1000000000
#define MOD 1000000007
#define PI acos(-1)
#define M 998244353
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define endl "\n"
#define fori(i, a, b) for(i=a; i<b; i++)
#define ford(i, a, b) for(i=a; i>b; i--)
using namespace std;
const ll N = 500043;
ll fact[N];
ll add(ll x, ll y)
{
	x += y;
	while(x >= MOD) x -= MOD;
	while(x < 0) x += MOD;
	return x;
}
ll mul(ll x, ll y)
{
	return (x * 1ll * y) % MOD;
}
ll mulmod(ll a, ll b)
{
    ll res = 0;
    a = a % MOD;
    while (b>0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
        a = (a * 2) % MOD;
        b /= 2;
    }
    return res % MOD; 
}
ll binpow(ll x, ll y)
{
	ll z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = mul(z, x);
		x = mul(x, x);
		y /= 2;
	}
	return z;
}
ll inv(ll x)
{
	return binpow(x, MOD - 2);
}
ll divide(ll x, ll y)
{
	return mul(x, inv(y));
}
void precalc()
{
	fact[0] = 1;
	ll i;
	fori(i, 1, N)
		fact[i] = mul(i, fact[i - 1]);
}
ll C(ll n, ll k)
{
	if(k > n)
	    return 0;
	return divide(fact[n], mul(fact[n-k], fact[k]));
}
int arr[10000000];
void printString(ll n) 
{ 
    memset(arr, 0, sizeof(arr));
    ll i = 0;
    while(n>0)
    { 
        arr[i] = n%26;
        n = n/26;
        i++;
    }
    for(ll j=0; j<i-1; j++)
    { 
        if (arr[j] <= 0)
        { 
            arr[j] += 26; 
            arr[j+1] = arr[j+1] - 1;
        } 
    } 
    for(ll j=i; j>=0; j--)
    { 
        if (arr[j] > 0)
            cout << char('a' + arr[j] - 1);
    }
    cout << endl;
}

void solve()
{
    ll n;
    cin >> n;
    printString(n);
}
signed main()
{
    io
    int t;
    t=1;
    // cin >> t;
    while(t--)
        // cout << solve() << endl;
        solve();
    return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()

typedef long long lint;
typedef pair<int, int> pii;

int n, m;
int b[550], r[550];

int gcd(int _a, int _b) {
	return _b != 0 ? gcd(_b, _a % _b) : _a;
}

typedef int flow_type;

struct DN_Edge {
	int to; flow_type cost; int rev;
	DN_Edge(int _to, flow_type _cost, int _rev) : to(_to), cost(_cost), rev(_rev) {}
};

struct Dinic {
	int V;
	vector< vector< DN_Edge > > edges;
	vector<int> level, iter;
	
	Dinic(int _n) : V(_n), edges(_n, vector<DN_Edge>()), level(_n, -1), iter(_n, 0) {}
	
	void add_edge(int _f, int _t, flow_type _c) {
		edges[_f].push_back(DN_Edge(_t, _c, size_of(edges[_t])));
		edges[_t].push_back(DN_Edge(_f, 0, size_of(edges[_f]) - 1));
	}
	
	void bfs(int _s) {
		fill(allof(level), -1);
		queue<int> q; q.push(_s);
		level[_s] = 0;
		
		while (!q.empty()) {
			int v = q.front(); q.pop();
			int e_size = size_of(edges[v]);
			
			for_(i,0,e_size) {
				DN_Edge e = edges[v][i];
				if (e.cost > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					q.push(e.to);
				}
			}
		}
	}
	
	flow_type dfs(int _v, int _t, flow_type _f) {
		if (_v == _t) return _f;
		int e_size = size_of(edges[_v]);
		
		for (int &i = iter[_v]; i < e_size; ++i) {
			DN_Edge &e = edges[_v][i];
			
			if (e.cost > 0 && level[_v] < level[e.to]) {
				flow_type d = dfs(e.to, _t, min(_f, e.cost));
				if (d > 0) {
					e.cost -= d;
					edges[e.to][e.rev].cost += d;
					return d;
				}
			}
		}
		
		return -1;
	}
	
	flow_type max_flow(int _s, int _t) {
		flow_type flow = flow_type();
		while (1) {
			bfs(_s);
			if (level[_t] < 0) return flow;
			fill(allof(iter), 0);
			flow_type f;
			while ((f = dfs(_s, _t, (int)1e9)) > 0) {
				flow += f;
			}
		}
	}
};


void solve() {
	Dinic dinic(n + m + 10);
	for_(i,0,m) dinic.add_edge(n + m + 1, i, 1);
	for_(i,0,n) dinic.add_edge(m + i, n + m + 2, 1);
	for_(i,0,m) for_(j,0,n) if (gcd(b[i], r[j]) != 1) dinic.add_edge(i, m + j, 1);
	
	cout << dinic.max_flow(n + m + 1, n + m + 2) << endl;
}

int main() {
	while (cin >> m >> n, n) {
		for_(i,0,m) cin >> b[i];
		for_(i,0,n) cin >> r[i];
		solve();
	}
	return 0;
}

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

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

  if((N%1==0&&N<=9)||(N%2==0&&N<=10)||(N%3==0&&N<=27)||(N%4==0&&N<=36)||(N%5==0&&N<=45)||(N%6==0&&N<=54)||(N%7==0&&N<=63)||(N%8==0&&N<=72)||(N%9==0&&N<=81))

{  cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

}


Measured memory_bytes: 256
n,x=gets.chomp.split(" ").map(&:to_i);
nums = gets.chomp.split(" ").map(&:to_i);

ball_x = 0
i=1

for num in nums do
    ball_x = ball_x + num
    if x < ball_x
        break
    end
    i = i+1
end

print("#{i}")

Measured memory_bytes: 1788
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, m;
string s, t;

int main(){
	cin >> s >> t;
	n = s.size();
	m = t.size();
	
    ll fl[n][26];
	memset(fl, 0, sizeof(fl));
	
	for(ll i = n-1; i > 0; i--){
		for(ll j = 0; j < 26; j++){
			if(j == s[i]-'a'){
				fl[i-1][j] = 1;
			}
			else{
				if(fl[i][j] != 0){
					fl[i-1][j] = fl[i][j]+1;
				}
			}
		}
	}
	
	for(ll j = 0; j < 26; j++){
		if(fl[n-1][j] == 0 && fl[0][j] != 0){fl[n-1][j] = fl[0][j]+1;}
	}
	fl[n-1][s[0]-'a'] = 1;
	
	for(ll i = n-1; i > 0; i--){
		for(ll j = 0; j < 26; j++){
			if(fl[i-1][j] == 0 && fl[i][j] != 0){
				fl[i-1][j] = fl[i][j]+1;
			}
		}
	}
	
	for(ll j = 0; j < m; j++){
		if(fl[0][t[j]-'a'] == 0){
			cout << -1 << endl;
			return 0;
		}
	}

	ll ans = 0;
	if(s[0] != t[0]){
		ans += fl[0][t[0]-'a'];
	}
	for(ll k = 1; k < m; k++){
		ans += fl[ans%n][t[k]-'a'];
	}
	cout << ans+1 << endl;
	return 0;
}

Measured memory_bytes: 20864
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int c[26] = {0,};
    string str;
    cin >> str;
    for (int i=0; i<str.length(); i++) {
        c[str[i]-'a']++;
    }
    
    bool flg=false;
    for (int i=0; i<str.length(); i++) {
        if (c[i]>1) flg=true;
    }
    
    if (flg) cout << "no";
    else    cout << "yes";
}


Measured memory_bytes: 256
#include<bits/stdc++.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)
using ll = long long;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll MOD=1e9+7 ;
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; }

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int n;
    cin >> n;
    if (n%2==0)
    {
        cout << 0.5 << endl;
    }
    else
    {
        cout << (double) (n/2+1)/n << endl;
    }
    
}


Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

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

int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535      
#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}


#pragma endregion

//ABC 132 -A 
static int b[26];
int main(void) {
	char a[5];
	int  i;

	scanf("%s", a);

	for (i = 0; i < 4; i++)
		b[a[i] - 'A']++;
	int cnt = 0;
	for (i = 0; i < 26; i++) {
		if (!b[i])continue;
		if (b[i] != 2) {
			printf("No\n"); return 0;
		}
		else cnt++;
	}
	if(cnt==2)
	    printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define ill long long
#define fcout cout << fixed << setprecision(10)
using namespace std;

int main() {
  char a;
  cin >> a;
  if(a <= 'z' && a >= 'a') {
    cout << 'a';
  } else {
    cout << 'A';
  }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x1,x2,y1,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int rx = x2-x1;
  int ry = y2-y1;
  int x3 = x2 - ry;
  int y3 = y2 + rx;
  cout << x3 << ' ' << y3 << ' ';
  int x4 = x3 - rx;
  int y4 = y3 - ry;
  cout << x4 << ' ' << y4 << endl;
}

Measured memory_bytes: 256
code = r"""
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
from libcpp.vector cimport vector
cdef extern from "<atcoder/scc>" namespace "atcoder" nogil:
    cdef cppclass scc_graph:
        scc_graph(int n)
        void add_edge(int fr, int to)
        vector[vector[int]] scc()
from libc.stdio cimport getchar, printf
cdef inline int read():
    cdef int b, c = 0
    while 1:
        b = getchar() - 48
        if b < 0: return c
        c = c * 10 + b
cdef int n = read(), m = read(), a, b, i, j
cdef scc_graph *g = new scc_graph(n)
for i in range(m):
    a = read()
    b = read()
    g.add_edge(a, b)
cdef vector[vector[int]] res = g.scc()
m = res.size()
printf('%d', m)
for i in range(m):
    m = res[i].size()
    printf('\n%d', m)
    for j in range(m): printf(' %d', res[i][j])
"""
import os, sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    open('solve.pyx', 'w').write(code)
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 44660
n = gets.to_i
node_counts = [0]
n.times do |i|
  node_counts[i + 1] = node_counts[i] + i + 1
end
node_count = node_counts.sum
edge_count = 0
(n - 1).times do |i|
  u, v = gets.split.map(&:to_i)
  edge_count += [u, v].min * (n - [u, v].max + 1)
end
puts node_count - edge_count


Measured memory_bytes: 16228
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
 
#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS resize
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);
 
#define MOD 1000000007
void init();
void solve();

signed main()
{
	init();
	solve();
}

bool dp[5010][10010];
vector<int> A;
int N, K;

void init()
{
	cin >> N >> K;
	rep(i, N) {
		int t;
		cin >> t;
		if (t < K) A.PB(t);
	}
	N = A.size();
	sort(all(A));
}

bool isok(int pos)
{
	bool dp[2][5010];
	rep(i, 2) rep(j, 5010) dp[i][j] = false;
	dp[0][0] = true;
	int now = 1;
	rep(i, N) {
		if (i == pos) continue;
		int pre = 1 - now;
		rep(j, K) {
			if (dp[pre][j]) {
				dp[now][j] = true;
				if (j + A[i] < K) {
					dp[now][j+A[i]] = true;
					if (j + A[i] >= K - A[pos]) return true;
				}
			}
		}
		now = pre;
	}
	return false;
}

void solve()
{
	int ok = N;
	int ng = -1;
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		if (isok(mid)) ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
}



Measured memory_bytes: 256
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N = inp()
P = inlist()
c = 0
m = 200000000

for i in range(N):
    if P[i] < m:
        m = P[i]
    if m >= P[i]:
        c += 1


print(c)


Measured memory_bytes: 25716
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n, m;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> m;
  priority_queue<int> que;

  REP(i, n) {
    int a;
    cin >> a;
    que.push(a);
  }

  REP(i, m) {
    int t = que.top(); que.pop();
    que.push((t / 2));
  }

  ll sum = 0;
  while(!que.empty()) {
    sum += que.top(); que.pop();
  }
  cout << sum << endl;
}


Measured memory_bytes: 3876
n,m=map(int,input().split())
st=[list(map(int,input().split())) for i in range(n)]
cheak=[list(map(int,input().split())) for i in range(m)]
# print(st)
# print(cheak)
ans=[]
for i in st:
    for k in cheak:
        res=abs(i[0]-k[0])+abs(i[1]-k[1])
        ans.append(res)
    x=min(ans)
    print(ans.index(x)+1)
    ans.clear()



        

Measured memory_bytes: 3060