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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    ll N, M;
    cin >> N >> M;

    if(N>M) swap(N, M);
    if(N==1 && M==1){
    	cout << 1 << endl;
    }else if(N==1){
    	cout << M-2 << endl;
    }else{
    	cout << (N-2)*(M-2) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

main(){
	int mid,final,re;
	
	while(1){
		scanf("%d%d%d",&mid,&final,&re);
		if(mid==-1&&final==-1&&re==-1)break;
		
		if(mid==-1||final==-1){
			printf("F\n");
		}
		
		else if(mid+final>=80){
			printf("A\n");
		}
		else if(mid+final>=65){
			printf("B\n");
		}
		else if(mid+final>=50){
			printf("C\n");
		}
		else if(mid+final>=30&&re>=50){
			printf("C\n");
		}
		else if(mid+final>=30){
			printf("D\n");
		}
		else if(mid+final<30){
			printf("F\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 584
while True:
    w = int(input())
    if w == -1: break
    last = 4280
    if w <= 10:
        a = 1150
    elif w <= 20:
        a = 1150 + (w-10)*125
    elif w <= 30:
        a = 1150 + 10*125 + (w-20)*140
    else:
        a = 1150 + 10*125 + 10*140 + (w-30)*160
    print(last - a)


Measured memory_bytes: 5592
#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 main() {
    int N, M, K, S;
    cin >> N >> M;
    vector<int> s(M, 0), p(M);
    rep(i, M) {
        cin >> K;
        rep(j, K) {
            cin >> S;
            s[i] |= (1 << (S - 1));
        }
    }
    rep(i, M) cin >> p[i];

    int ans = 0;
    for (int bit = 0; bit < (1 << N); ++bit) {
        int ok = 1;
        rep(i, M) {
            ok ^= (__builtin_popcount(bit & s[i]) % 2 ^ p[i]);
            if (!ok) break;
        }
        if (ok) ++ans;
    }
    cout << ans << endl;
}

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

int  main()
{
	int a , b;
	cin >> a >> b;
	if (b == 1)
	{
		cout << 0; return 0;
	}
	b -= a; a--;
	int cnt = 1;
	while (b > 0)
	{
		b -= a;
		cnt++;
	}
	cout << cnt << endl;
	return (0);
}


Measured memory_bytes: 256
using System;
class test{
	static void Main(){
		Int64 n = Int64.Parse(Console.ReadLine());
    	string[] tmp = Console.ReadLine().Split();
		Int64[] num1 = new Int64[n+1];
		for(Int64 cnt=0;cnt<n+1;cnt++){num1[cnt]=Int64.Parse(tmp[cnt]);}
      	tmp = Console.ReadLine().Split();
      	Int64[] num2 = new Int64[n];
      	Int64 sum=0;
      	for(Int64 cnt=0;cnt<n;cnt++){num2[cnt]=Int64.Parse(tmp[cnt]);}
      	for(Int64 cnt=0;cnt<n;cnt++){
          if(num2[cnt] <= num1[cnt]){
            sum+=num2[cnt];
          }else{
            sum+=num1[cnt];
            num2[cnt]-=num1[cnt];
            if(num2[cnt]<=num1[cnt+1]){
              sum+=num2[cnt];
              num1[cnt+1]-=num2[cnt];
            }else{
              sum+=num1[cnt+1];
              num1[cnt+1]=0;
            }
          }
        }
		Console.Write(sum);
    }
}

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

using namespace std;



int main()
{   
    int n, k;
    cin>>n>>k;
    int a[n];
    for ( int i =0 ; i<= n-1; i++)
    {
        cin>>a[i];
    }
    int dp[n+1];
    memset(dp,0,sizeof(dp));
    dp[0] = 0;
    dp[1] = abs(a[0]-a[1]);
    for ( int i = 2; i<= n-1; i++)
    {
        int t = 0, m= INT_MAX, r = max(0,i-k);
        for ( int j = 0; j<= min(k-1,i-1); j++)
        {
            t  = dp[i-j-1] + abs(a[i]-a[i-j-1]);
            // cout<<dp[i-j-1]<<'.'<<t<<' ';
            if ( t< m)
                m = t;
        }
        // cout<<'\n';
            dp[i] =  m;
    }
    // for ( int i = 0; i<= n-1; i++)
    //     cout<<dp[i]<<' ';
    // cout<<'\n';
    cout<<dp[n-1];
}


Measured memory_bytes: 4372
#include<cmath>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<functional>
#define INF 1e16
#define N (1000000007)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> Q;


ll sum[200010];

int A(int x){
    if(x>=0)return x;
    else return -x;
}

int main(void){
    int x,n;
    cin>>x>>n;
    set<int>s;
    for(int i=0;i<n;i++){
        int p;
        cin>>p;
        s.insert(p);
    }
    int ans = 10000, tmp = 10000;
    for(int i=-200;i<=200;i++){
        if(s.count(i)==0){
            int t = A(i-x);
            if(t<tmp){
                ans = i;
                tmp = A(i-x);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
std::vector<int> Factorial(5e6),Finverse(5e6);
inline void Cinit(){// limit is 5e6 /// write pw /// this takes 792ms at AtCoder
  Factorial[0]=1;
  for(int i=1;i<5e6;i++)Factorial[i]=Factorial[i-1]*i%MOD;
  for(int i=0;i<5e6;i++)Finverse[i]=pw(Factorial[i],MOD-2);
}
int nCk(int n,int k){
  if(n<k)return 0;if(k<0)return 0;
  if(!Factorial[0])Cinit();
  int res=Factorial[n];
  res*=Finverse[k];res%=MOD;
  res*=Finverse[n-k];res%=MOD;
  return res;
}

signed main(){
  int n,k;cin>>n>>k;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  sort(v.begin(),v.end());
  int ans=0;
  for(int i=0;i<n;i++){
    if(n-1-i>=k-1)ans+=MOD-nCk(n-1-i,k-1)*v[i]%MOD;
    if(i>=k-1)ans+=nCk(i,k-1)*v[i]%MOD;
    ans%=MOD;
  }
  cout<<ans<<endl;
}


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

using namespace std;

const long long mod = 1e9+7;

int main() {
    long long n;
    cin>>n;
    vector <int> a(n,0);
    char c;
    int otv = 0;
    vector <vector <int> > b(n,a);
    vector <vector <int> > bb(n,a);
    for (int i=0; i<n; i++){
        for (int j=0; j<n; j++){
            cin>>c;
            b[i][j] = c-'a';
            bb[i][j] = c -'a';
        }
    }
    for (int i = 0; i<n; i++){
        int f = 1;
        for (int j=0; j<n; j++){
            for (int q=0; q<n; q++){
                b[j][q] = bb[j][(q+i)%n];
            }
        }
        for (int j=0; j<n; j++){
            if (f==0) break;
            for (int q=0; q<n; q++){
                if(b[j][q]!=b[q][j]){
                    f=0;
                    break;
                }
            }
        }
        if (f) otv++;
    }
    cout << otv*n;
    return 0;
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

type point struct {
	x int
	y int
}

var points []point
var distances []float64

func main() {
	sc.Split(bufio.ScanWords)
	n := readInt()

	points = make([]point, n)
	rest := make([]int, n)
	for i := 0; i < n; i++ {
		points[i].x = readInt()
		points[i].y = readInt()
		rest[i] = i
	}

	perm([]int{}, rest)

	ans := 0.0
	for _, d := range distances {
		ans += d
	}
	fmt.Printf("%0.10f\n", ans/float64(len(distances)))
}

func perm(head, rest []int) []int {
	if len(rest) == 0 {
		distances = append(distances, getDistance(head))
		return head
	}
	res := make([]int, len(rest))
	for i := 0; i < len(rest); i++ {
		restx := make([]int, len(rest))
		copy(restx, rest)

		headx := make([]int, len(head))
		copy(headx, head)

		headx = append(headx, restx[i])
		restx = append(restx[:i], restx[i+1:]...)
		res = perm(headx, restx)
	}
	return res
}

func getDistance(perms []int) float64 {
	n := len(perms)
	d := 0.0
	for i := 0; i < n-1; i++ {
		dx := points[perms[i]].x - points[perms[i+1]].x
		dy := points[perms[i]].y - points[perms[i+1]].y
		d += math.Hypot(float64(dx), float64(dy))
	}
	return float64(d)
}


Measured memory_bytes: 7680
n = int(input())
s = input()
a = s.count("R")
b = s.count("G")
c = s.count("B")
z = a*b*c
R=[]
G=[]
B=[]
for i in range(n):
  if s[i]=="R":
    R.append(i)
  elif s[i]=="G":
    G.append(i)
  else:
    B.append(i)
x = 0
for i in R:
  for j in G:
    if 0 <= 2*j-i <= n-1 and s[2*j-i]=="B":
      x+=1
    if 0 <= 2*i-j <= n-1 and s[2*i-j]=="B":
      x+=1
    if (i+j)%2==0 and s[(i+j)//2]=="B":
      x+=1
print(z-x)


Measured memory_bytes: 9236
n = int(input())
a = list(map(int, input().split()))

a.append(0)
a.insert(0, 0)
s = sum([abs(a[i+1]-a[i]) for i in range(n+1)])

for i in range(1, n+1):
    print(s + abs(a[i+1] - a[i-1]) - (abs(a[i]-a[i-1]) + abs(a[i+1]-a[i])))



Measured memory_bytes: 14048
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	public static void main(String[] args) {
		int	a=sc.nextInt();
		int b=sc.nextInt();
		p(Math.max(a+b, Math.max(a-b, a*b)));
		
		
	}
	
	
	
	
	/*static boolean v(int i,long sum1,long sum2) {
		if(i==N) {
			long b=Math.abs(sum1-sum2);
			if(b==0) {
				if(sum1<=K) {
					return true;
				}else return false;
			}else if(b%D==0) {
				if(Math.max(sum1, sum2)<=K)return true;
				else return false;
			}
			else return false;
		}
		
		if(v(i+1,sum1,sum2+v[i]%D))return true;
		
		if(v(i+1,sum1+D-v[i]%D,sum2))return true;
		return false;
		
	}*/
	
	
	
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 21844
#include <cstdio>
#include <cctype>
#include <utility>
#include <cmath>
#include <algorithm>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _sc _il bool scan
_T T in(int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_il int in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _ot _il void out
#define _ol _il void outl
_ot(bool b) {pcu('0'+b);}
_ot(const char *s){while(*s)pcu(*s++);}
_ot(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_ot(string s){for(char c:s)pcu(c);}
#endif
_T _ot(T n){static char b[20];char *p=b,m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=n%10*m+'0',n/=10;while(p!=b)pcu(*--p);}
_ol(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _ot(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _ot(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _ol(T&&... t){out(move(t)...);outl();}

template<int N>
struct sieve {
	bool s[N];
	int v[N], l = -1;
	constexpr sieve() : s(), v() {
		s[2] = true;
		for (int i = 3; i < N; i += 2)
			s[i] = true;
		for (int i = 9; i < N; i += 6)
			s[i] = false;
		for (int i = 6, e = sqrt(N); i <= e; i += 6) {
			for (int j : {i - 1, i + 1})
				if (s[j])
					for (int k = j * j; k < N; k += j)
						s[k] = false;
		}
		for (int i = 2; i < N; i++)
			if (s[i])
				v[++l] = i;;
	}
};

int main() {
	constexpr sieve<32000> s;
	int n = in();
	out(n, ':');
	for (const int *i = s.v; n != 1 && *i <= sqrt(n); i++)
		while (n % *i == 0) {
			n /= *i;
			out(' ', *i);
		}
	if (n != 1)
		outl(' ', n);
	else
		outl();
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(n * a, b) << endl;
  return 0;
}


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

using namespace std;
int mini(int a,int b){
if(a<b)return a;
return b;
}
int minCostdown(int*h,int n,int k){
    int* dp = new int[n];
    dp[0] = 0;
    for(int i = 1;i<n;i++)
        dp[i] = INT_MAX;
    for(int i = 1;i<n;i++){
        for(int j = 1;j<=k;j++){
            if(i-j<0)
                break;
            dp[i] = mini(dp[i],dp[i-j] + abs(h[i]-h[i-j]));
        }
    }
    return dp[n-1];
}
int main()
{
    int n,k;
    cin>>n>>k;
    int* h = new int[n];
    for(int i = 0;i<n;i++)
        cin>>h[i];
    //cout<<minCost(h,0,n)<<endl;
    cout<<minCostdown(h,n,k)<<endl;
    return 0;
}


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

ans = 0
for i in range(1, N+1):
    tmp = 0
    check = i
    for j in range(1, 100):
        if check >= K:
            ans += 1 / (N * 2 ** tmp)
            break
        tmp += 1
        check *= 2

print(ans)

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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
bool check(const vector<ll>& v) {
    const ll n = v.size();
    ll g = v[0];
    rep(i, n) g = gcd(g, v[i]);
    if (g != 1) {
        return false;
    }
    ll sum = 0;
    rep(i, n) sum += v[i];
    rep(i, n) {
        if (gcd(sum - v[i], v[i]) == 1) {
            // cerr << v << endl;
            // cerr << i << " " << v[i] << endl;
            return false;
        }
    }
    return true;
}
const ll M = 30000;
void solve(ll n) {
    vector<ll> np;
    rep(i, 2, M+1) {
        if (i % 2 == 0 || i % 3 == 0) {
        // if (!is_prime[i]) {
            np.pb(i);
        // }
        }
    }
    assert(np.size() >= n-1);
    vector<ll> v;
    rep(i, n) {
        v.pb(np[i]);
    }
    // cout << v << endl;
    rep(i, v[n-3]+1, min(M+1, v[n-3]+100)) {
        rep(j, i+1, min(M+1, i+100)) {
            v[n-2] = i;
            v[n-1] = j;
            if (check(v)) {
                cout << v << endl;
                return;
            }
        }
    }
    assert(false);
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    // rep(i, 3, M+1) {
    //     cout << i << endl;
    //     solve(i);
    // }
    solve(n);
    // cout << -1 << endl;
    // vector<ll> v;
    // rep(i, 2, 100) rep(j, 2, 100) rep(k, 2, 100) {
    //     if (check({i, j, k})) {
    //         cout << i << " " << j << " " << k << endl;
    //         return 0;
    //     }
    // }
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX


int n,memo[200001],ans;


signed main() {
    cin >> n;
    rep(i,n) {
        int p;
        cin >> p;
        memo[p] = memo[p-1]+1;
        ans = max(ans, memo[p]);
    }
    cout << n-ans << endl;
}




Measured memory_bytes: 1792
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int k;
  cin >> k;
  int ans = 0;

  for(int a = 1; a<k+1; a++) {
    for(int b = 1; b<k+1; b++) {
      for(int c = 1; c<k+1; c++) {
        ans += gcd(a,gcd(b,c));
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3188
N=int(input())
room=[[[0]*10 for _ in range(3)] for _ in range(4)]

for _ in range(N):
    b,f,r,v=map(int,input().split())
    room[b-1][f-1][r-1]+=v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" {}".format(room[i][j][k]), end="")
        print()
    if i!=3:
        print("####################")



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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);
 
    string A,B; cin >>A>>B;
    string ans;
    if (A.size() < B.size()) {
        ans = "LESS";
    } else if (A.size() > B.size()) {
        ans = "GREATER";
    } else if (A < B) {
        ans = "LESS";
    } else if (A > B) {
        ans = "GREATER";
    }  else {
        ans = "EQUAL";
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define iiii tuple<int, int, int, int>
#define iii tuple<int, int, int>
#define ii pair<int, int>
#define dd pair<double, double>
#define fi first
#define vi vector<int>
#define vvi vector<vector<int>>
#define se second

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int M = 1e3;

double f(vector<ii>& a, double x, double y) {
    double res = 0;
    for (auto& i : a)
        res = max(res, (i.fi - x) * (i.fi - x) + (i.se - y) * (i.se - y));
    return res;
}

int check(vector<ii>& a, vector<dd>& go, double L, double x, double y) {
    double org = f(a, x, y);
    int res = -1;
    for (int i = 0; i < go.size(); ++i) {
        double tmp = f(a, x + L * go[i].fi, y + L * go[i].se);
        if (tmp < org) {
            org = tmp;
            res = i;
        }
    }
    return res;
}

void solve() {
    int n;
    cin >> n;
    vector<ii> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i].fi >> a[i].se;
    vector<pair<double, double>> go(360);
    const double PI = acos(-1);
    for (int i = 0; i < 360; ++i) {
        go[i].fi = sin(PI * i / 180);
        go[i].se = cos(PI * i / 180);
    }
    double L = 1000, cnt = 100;
    double x = 0, y = 0;
    while (cnt--) {
        int cnt_check = 10, t = check(a, go, L, x, y);
        while (t == -1 && cnt_check--) {
            L /= 2;
            t = check(a, go, L, x, y);
        }
        x += go[t].fi * L;
        y += go[t].se * L;
    }
    cout << fixed << setprecision(15) << sqrt(f(a, x, y)) << '\n';
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    // freopen("in", "r", stdin);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
vector<int> v={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 i;
 cin >> i;
 cout << v.at(i-1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    string MARCH = "MARCH";
    int N; cin >> N;

    map<char, ll> mp;
    for(int i=0; i<N; ++i){
        string s; cin >> s;
        mp[s[0]]++;
    }

    ll ans = 0;
    for(int bit=0; bit<1<<5; ++bit){
        ll cnt = 0;
        for(int i=0; i<5; ++i) if(bit&1<<i) ++cnt;
        if(cnt != 3) continue;
        
        ll tmp = 1;
        for(int i=0; i<5; ++i) if(bit&1<<i) tmp *= mp[MARCH[i]];
        ans += tmp;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    
    long int n,a,b,i,min;
    long int k,num[100000]={},sum=0;
    
    scanf("%ld %ld",&n,&k);
    
    for(i=0;i<n;i++){
        scanf("%ld %ld",&a,&b);
        num[a-1]+=b;
    }
    for(i=0;i<100000;i++){
        min = i+1;
        sum+=num[i];
        if(sum>=k)break;
    }
    printf("%ld\n",min);
    
    return 0;
}

Measured memory_bytes: 896
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define ll long long
#define INFTY 1 << 21

int main() {
  double W, H, x, y;
  cin >> W >> H >> x >> y;
  double area = W * H;

  printf("%lf ", area / 2);

  double a = (0 - H) / W;

  // xかyが長さの半分
  if (x == W / 2 && y == H / 2) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    
 
#define bp __builtin_popcountll
#define inf 1e18
    
const int N=50+5;
const int MOD=1e9+7;

void solve()
{
	int x;
	cin>>x;
	if(x<=599)
	cout<<8<<endl;
	else if(x<=799)
	cout<<7;
	else if(x<=999)
	cout<<6;
	else if(x<=1199)
	cout<<5;
	else if(x<=1399)
	cout<<4;
	else if(x<=1599)
	cout<<3;
	else if(x<=1799)
	cout<<2;
	else 
	cout<<1;
}
 
signed main()
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": "<<endl;
    	solve();
    }
}


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

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        List<int> plist = new List<int>();
        for (int i = 0; i < n; i++)
        {
            plist.Add(int.Parse(Console.ReadLine()));
        }
        int max = plist.Max();
        int sum = plist.Sum();
        sum = sum - max + max / 2;

        Console.WriteLine(sum);
    }
}


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

using namespace std;
typedef long long ll;
int main(){
  ll n,i,j;
  cin >> n;
  ll a[n+1];
  ll dp[n+2];
  for(i=0;i<n+2;i++)dp[i]=1e13;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  a[n]=0;
  dp[0]=0;
  for(i=0;i<n-1;i++){
    dp[i+1]=min(dp[i+1],dp[i]+abs(a[i+1]-a[i]));
    dp[i+2]=min(dp[i+2],dp[i]+abs(a[i+2]-a[i]));
  }
  cout << dp[n-1] << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>


using namespace std;



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

    cin >> N;
    string str;
    cin >> str;
    ll ca = 0,cb = 0;
    ll a = 0;
    ll _min = 2*100000;

    vector<int> arr;
    char tmp = '.';
    int countwh = 0;
    int count = 0;
    arr.push_back(0);
    for(int i = 0;i < N; i++){
        if(str[i] == '.'){
            countwh++;
        }
    }
    for(int i = 0;i < N; i++){
        if(str[i] == tmp){
            count++;
        }else{
            arr.push_back(count);
            count = 1;
            tmp = str[i];
        }
    }
    arr.push_back(count);
    if(str[N-1] == '#') arr.push_back(0);
    // for(int i = 0;i < arr.size();i++){
    //     cout << arr[i] << endl;
    // }
    count = countwh;
    int mi = 100000;
    for(int i = 0;i < arr.size();i=i+2){
        count += arr[i];
        count -= arr[i+1];
        mi = min(count,mi);
    }

    cout << mi << endl;
    return 0;
}

Measured memory_bytes: 1552
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(ll i=0;i<N;++i)
typedef long long int ll;
const ll INF = 1<<30;

int main(){
    ll N; cin >> N;
    vector<ll> A(N+1);
    ll cnt2 = 0,cnt4 = 0;
    rep(i,N){
        cin >> A[i];
        if(A[i] % 4 == 0){
            cnt4++;
        }else if(A[i] % 2 == 0){
            cnt2++;
        }
    }
    if(cnt4 >= (N/2)){
        cout << "Yes" << endl;
        return 0;
    }
    N -= (cnt4 * 2);
    if(cnt2 >= N){
        cout << "Yes" << endl;
    }else cout << "No" << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

bool asec(int *a, int n){
	int temp = a[0];
	for (int i = 1; i < n; i++) {
		if (a[i] < temp) {
			return false;
		}
		temp = a[i];
	}
	return true;
}

int main(){
	int n, i, j;
	n = 0;
	cin >> n;

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

	int temp;
	if (asec(a, n)) {
		cout << "YES";
		return 0;
	}
	for (i = 0; i < n - 1; i++) {
		for (j = i + 1; j < n; j++) {
			temp = a[i];
			a[i] = a[j];
			a[j] = temp;
			if (asec(a, n)) {
				cout << "YES";
				return 0;
			}
			temp = a[i];
			a[i] = a[j];
			a[j] = temp;
		}
	}

	cout << "NO";
	return 0;
}
  

Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

int cv(int a) {
  return a;
}

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  vi v(n);
  vector<map<int, int>> ct(2, map<int, int>());
  rep(i, n) {
    cin >> v[i];
    if(ct[i%2].find(v[i]) == ct[i%2].end()){
      ct[i%2].emplace(v[i], 1);  
    } else {
      ct[i%2][v[i]]++;
    }
  }
  
  vector<vpii> ct2(2, vpii());
  rep(i, 2) {
    for(auto v : ct[i]) {
      ct2[i].push_back(mp(v.second, v.first));
    }
    
    sort(all(ct2[i]));
    reverse(all(ct2[i]));
  }
  
  //次
  auto eitr = ct2[0].begin();
  auto oitr = ct2[1].begin();
  if((*eitr).second != (*oitr).second) {
    //OK
    int r = (n/2 - cv((*eitr).first)) + (n/2 - cv((*oitr).first));
    fin(r);
    return 0;
  }
  
  eitr++;
  oitr++;
  
  // if(ep.first == op.first)
  //どっちかを変える
  if(ct2[0].size() == 1) {
    //ct2 = 1を変える
    if(ct2[1].size() == 1) {
      fin(n/2);
      return 0;
    }
    
    fin(n/2 - cv((*oitr).first));
  } else {
    if(ct2[1].size() == 1) {
      fin(n/2 - cv((*eitr).first));
      return 0;
    }
    
    int r1 = (n/2 - (*eitr).first) + (n/2 - (*(ct2[1].begin())).first);
    int r2 = (n/2 - (*(ct2[0].begin())).first) + (n/2 - (*oitr).first);
    fin(min(r1, r2));
  }
}

Measured memory_bytes: 6524
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/


const int MAXN = 3100;
int n;
string s;
ll dp[MAXN];
ll dp2[MAXN];
const ll MOD = 1e9 + 7;

void add(ll &a, ll b) {
	a = (a + b) % MOD;
}

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n >> s;
	dp[0] = 1;
	for (int i = 1; i < n; ++i) {
		memset(dp2, 0, sizeof(dp2));
		if (s[i - 1] == '<') {
			ll now = 0;
			for (int j = 1; j <= i; ++j) {
				add(now, dp[j - 1]);
				dp2[j] = now;
			}
		}
		else {
			ll now = 0;
			for (int j = i - 1; j >= 0; --j) {
				add(now, dp[j]);
				dp2[j] = now;
			}
		}
		memcpy(dp, dp2, sizeof(dp));
	}
	ll ans = 0;
	for (int i = 0; i < n; ++i)
		add(ans, dp[i]);
	cout << ans << "\n";
	return 0;
}




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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

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

int mypow(int x, int y) {
	int res = 1;
	FOR(i,y) {
		if (res*x/x != res) return INF;
		res *= x;
	}
	return res;
}

int main() {
    int n = ri();
	int a[n];
	INPUT(a);
	
	int l = 0;
	int r = 200001;
	while (r-l > 1) {
		int m = (l+r)/2;
		map<int,int> cur;
		int size = a[0];
		bool res = true;
		if (m == 1) {
			UPTO(i,1,n-1) if (a[i]<= a[i-1]) res = false;
		} else {
			UPTO(i,1,n-1) {
				if (a[i] > a[i-1]) {
					size = a[i];
				} else if (a[i] < a[i-1]) {
					for (auto j = cur.begin(); j != cur.end();) {
						if (j->fi >= a[i]) j = cur.erase(j);
						else j++;
					}
					size = a[i];
					int pos = size-1;
					while(1) {
						cur[pos]++;
						if (cur[pos] < m) break;
						if (!pos) {
							res = false;
							break;
						}
						cur[pos] = 0;
						pos--;
					}
				} else {
					int pos = size-1;
					while(1) {
						cur[pos]++;
						if (cur[pos] < m) break;
						if (!pos) {
							res = false;
							break;
						}
						cur[pos] = 0;
						pos--;
					}
				}
				if (!res) break;
			}
		}
		if (res) r = m;
		else l = m;
	}
	cout << r << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  string num = "";
  for(int i=0;i<n;i++){
    num = num + "a";
  }
  int s;
  char c;
  for(int i=0;i<m;i++){
    cin >> s >> c;
    if(num[s-1]=='a'||num[s-1]==c){
      if(s==1&&c=='0'&&n!=1){
        cout << -1 << endl;
        return 0;
      }
      num[s-1]=c;
    }else{
      cout << -1 << endl;
      return 0;
    }
  }
  for(int i=0;i<n;i++){
    if(num[i]=='a'){
      if(i==0&&n!=1){
        num[i]='1';
      }else{
        num[i]='0';
      }
    }
  }
  cout << num << endl;
  return 0;
}


Measured memory_bytes: 256
IN = input()
IN = list(map(int, IN))



if IN[0]+IN[1]+IN[2]+IN[3] ==7:
    print(str(IN[0])+"+"+str(IN[1])+"+"+str(IN[2])+"+"+str(IN[3])+"=7")
elif IN[0]-IN[1]+IN[2]+IN[3] ==7:
    print(str(IN[0])+"-"+str(IN[1])+"+"+str(IN[2])+"+"+str(IN[3])+"=7")
elif IN[0]+IN[1]-IN[2]+IN[3] ==7:
    print(str(IN[0])+"+"+str(IN[1])+"-"+str(IN[2])+"+"+str(IN[3])+"=7")
elif IN[0]-IN[1]-IN[2]+IN[3] ==7:
    print(str(IN[0])+"-"+str(IN[1])+"-"+str(IN[2])+"+"+str(IN[3])+"=7")
elif IN[0]+IN[1]+IN[2]-IN[3] ==7:
    print(str(IN[0])+"+"+str(IN[1])+"+"+str(IN[2])+"-"+str(IN[3])+"=7")
elif IN[0]-IN[1]+IN[2]-IN[3] ==7:
    print(str(IN[0])+"-"+str(IN[1])+"+"+str(IN[2])+"-"+str(IN[3])+"=7")
elif IN[0]+IN[1]-IN[2]-IN[3] ==7:
    print(str(IN[0])+"+"+str(IN[1])+"-"+str(IN[2])+"-"+str(IN[3])+"=7")
else: 
    print(str(IN[0])+"+"+str(IN[1])+"+"+str(IN[2])+"-"+str(IN[3])+"=7")




Measured memory_bytes: 9276
#include <stdio.h>

int main(){
	double a;
	while(scanf("%lf",&a) != EOF){
		if(a <= 48){
			printf("light fly\n");
		}else if(a <= 51){
			printf("fly\n");
		}else if(a <= 54){
			printf("bantam\n");
		}else if(a <= 57){
			printf("feather\n");
		}else if(a <= 60){
			printf("light\n");
		}else if(a <= 64){
			printf("light welter\n");
		}else if(a <= 69){
			printf("welter\n");
		}else if(a <= 75){
			printf("light middle\n");
		}else if(a <= 81){
			printf("middle\n");
		}else if(a <= 91){
			printf("light heavy\n");
		}else{
			printf("heavy\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1036
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

ll N;

void rec(string s, ll l) {
  if(l>=N) {
    pt(s);
    return;
  }
  
  ll cnt[26]={};
  for(ll i=0; i<s.size(); i++) {
    cnt[s[i]-'a']++;
  }
  
  ll t=0;
  for(ll i=0; i<26; i++) if(cnt[i]) t++;
  
  for(char c='a'; c<='a'+t; c++) {
    rec(s+c, l+1);
  }
  
}

int main(void) {
  ll i, j, k;
  cin >> N;
  
  rec("a", 1);
  
}



Measured memory_bytes: 1536
#include <stdio.h>
int main() {
    int k, a, b, flag = 0;
    scanf("%d", &k);
    scanf("%d %d", &a, &b);
    for (int i = 1; i <= b; i++) {
        int test = k * i;
        if (test >= a && test <= b) {
            flag = 1;
            break;
        }
    }
    if (flag) {
        printf("OK");
    } else {
        printf("NG");
    }
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define all(x) (x).begin(), (x).end()
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)

const int MOD = 1e9+7;
const int MAXN = 5e5+3;
const int INF = 1e9;


int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    string s; cin >> s;
    int r=0,b=0,g=0;
    for(char c: s) {
        if(c == 'R') r++;
        else if(c == 'B') b++;
        else g++;
    }

    LL ans = 1LL*r*b*g;
    fore(l,1,n) {
        fori(i,n) {
            int j = i+l;
            int k = j+l;
            if(k >= n) break;
            set<char> sc;
            sc.insert(s[i]);
            sc.insert(s[j]);
            sc.insert(s[k]);
            if(sc.size() == 3) ans--;
        }
    }

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


Measured memory_bytes: 3652
#include<iostream>

using namespace std;

int main(){
  int n, m;
  int data[128];
  char x, y;
  char z;
  while(1){
    cin >> n;
      if (n == 0) break;
      else {
	for(int i = 0; i< 128; i++){
	  data[i] = i;
	}
	for(int i = 0; i< n; i++){
	  cin >> x >> y;
	  data[static_cast<int>(x)] = static_cast<int>(y);
	}
	
	cin >> m;
	for (int i= 0; i< m; i++){
	  cin >> z;
	  cout<< static_cast<char>(data[static_cast<int>(z)]);
	}
	cout <<"\n";
      }
  }
  return 0;
}

Measured memory_bytes: 1120
#include <bits/stdc++.h>
using namespace std;
int n, c[101], ans;
int main() {
	scanf ("%d", &n);
	for (int i = 1; i <= n; i++) scanf ("%d", &c[i]);
	for (int i = 2; i <= n; i++) {
		if (c[i - 1] == c[i]) {
			c[i]++;
			ans++;
			while (c[i] == c[i + 1]) {
				c[i]++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
ll strtoint(string str);
int main(){
	fast;
	ll n; cin>>n;
	vector<ll> arr(n-1);
	map<ll,ll> mp;
	for(auto i=0;i<n-1;++i){cin>>arr[i];
		++mp[arr[i]];
	}
	for(auto i=1;i<=n;++i){
		cout<<mp[i]<<'\n';
	}
	return 0;
}
ll strtoint(string str){
	ll x=0;
	stringstream ss;
	ss<<str;
	ss>>x;
	return x;
}

Measured memory_bytes: 17244
#include <iostream>

using namespace std;

int main(void){

	string targetWord, word;
	int num = 0;
	int ans = 0;

	cin >> targetWord;
	cin >> num;

	for(int i  = 0 ; i < num ; ++i){
		cin >> word;
		word = word + word;
		for(int j = 0 ; j < word.size(); ++j){
			if( word.find(targetWord) != -1 ){
				++ans;
				break;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1212
import numpy as np

H, W = map(int, input().split())
A = np.array([list(input()) for h in range(H)])

def delete_rows(A):
  del_list = []
  for i, a in enumerate(A):
    if (a == '.').all():
      del_list.append(i)
  return np.delete(A, del_list, axis=0)


A = delete_rows(delete_rows(A).T).T
for a in A:
  print(''.join(a))

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

int main(){ 
    string s;
    cin>>s;
    if((s.at(0)==s.at(1)&&s.at(2)==s.at(3)&&(s.at(0)!=s.at(2)))||(s.at(0)==s.at(2)&&s.at(1)==s.at(3)&&(s.at(0)!=s.at(1)))||(s.at(0)==s.at(3)&&s.at(1)==s.at(2))&&(s.at(0)!=s.at(1))){
        cout <<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
# import sys
# input = sys.stdin.readline


def main():
    H = int(input())

    i = 0
    count = 0
    h = H

    while h > 0:
        h = h // 2
        count += 2**i
        i += 1

    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <set>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <iomanip>
#include <numeric>

using namespace std;

typedef long long ll;

#define forn(i, n) for(int i = 0; i < int(n);++i)
#define pb push_back
#define vi vector<int>
#define pll pair<ll,ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vpll vector<pll>
#define vll vector<ll>
#define vvll vector<vll>
#define sz(x) (int)x.size()
#define ff first
#define ss second

void solve() {

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    /*ll t = 1;
    cin >> t;
    while (t--) {
        solve();
    }*/
    ll n;
    cin >> n;
    vector<double> a(n);
    forn(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    double ans = 0;
    ans = a[0];
    for (int i = 1; i < n; i++) {
        ans = (ans + a[i]) / 2;
    }
    cout << fixed << setprecision(5);
    cout << ans;
    return 0;
}


Measured memory_bytes: 256