akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = unsigned long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
constexpr Int Mod = 1e9+7;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) v.begin(),v.end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,st,en) for(int i=st; i<=en; i++)
#define gnr(i,l,r) for(int i=int(r)-1; i>=int(l); i--)
#define eb emplace_back
#define pri1(a) cout<<a<<'\n'
#define pri2(a,n) rep(i,n)cout<<a[i]<<'\n'
#define pri3(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n'
#define prip(p) cout<<p.first<<' '<<p.second<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q,key;
string s,sb;
bool ok;

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

  cin>>n; int a[n+1],b[n+1]; a[n]=b[n]=0;
	rep(i,n){cin>>a[i]; b[i]=a[i];}
	sort(a,a+n); sort(b,b+n);
	rep(i,n){
		if(i%2){a[i]=24-a[i];}
		else b[i]=24-b[i];
	}
	int a1=100,a2=100;
	rep(i,n+1)rer(j,i+1,n){
		cmin(a1,min(abs(a[i]-a[j]),24-abs(a[i]-a[j])));
		cmin(a2,min(abs(b[i]-b[j]),24-abs(b[i]-b[j])));
	}
	pri1(max(a1,a2));
}

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

using namespace std;

int main() {
  long long n;
  cin>>n;
  vector<long long> vec(n);
  for(long long i=0;i<n;i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  if(n==2){
    cout<<vec.at(0)<<endl;
    return 0;
  }
  if(n==3){
    cout<<vec.at(0)+vec.at(1)<<endl;
    return 0;
  }
  long long ans=vec.at(0);
  long long i=2;
  long long j=1;
  
  while(i<n){
    ans+=vec.at(j);
    i++;
    
    if(i%2==0){
      j++;
    }
  
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) {
    ll g = GCD(a, b);
    return a / g * b;
}


int main() {
    int n; cin >> n;
    bool ok = true;
    rep(i, n) {
        int a; cin >> a;
        if (a %2 == 0) {
            if (a % 3 != 0 && a % 5 != 0) {
                ok = false;
                break;
            }
        }
    }
    cout << ((ok) ? "APPROVED" : "DENIED") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
   
int main(void)
{
    int i, a, b, tmt, r;
   
    scanf("%d %d", &a, &b);
   
    if (a < b) {
        tmt = b;
		b = a;
		a = tmt;
	}

	while (b > 0) {
		r = a % b;
		a = b;
		b = r;
	}
   
    
   
    printf("%d\n", a);
   
    return 0;
}


Measured memory_bytes: 2140
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

from bisect import bisect_left

#Binary Indexed Tree（区間加算）
#1-indexed
class Range_BIT():
    def __init__(self, N):
        self.size = N
        self.data0 = [0]*(N+1)
        self.data1 = [0]*(N+1)

    def _add(self, data, k, x):
        while k <= self.size:
            data[k] += x
            k += k & -k

    # 区間[l,r)にxを加算
    def add(self, l, r, x):
        self._add(self.data0, l, -x*(l-1))
        self._add(self.data0, r, x*(r-1))
        self._add(self.data1, l, x)
        self._add(self.data1, r, -x)

    def _get(self, data, k):
        s = 0
        while k:
            s += data[k]
            k -= k & -k
        return s

    # 区間[l,r)の和を求める
    def query(self, l, r):
        return self._get(self.data1, r-1)*(r-1)+self._get(self.data0, r-1)\
                -self._get(self.data1, l-1)*(l-1)-self._get(self.data0, l-1)

N,M = II()
A = III()
A.sort()

def is_ok(x):
    num = 0
    for a in A:
        p = bisect_left(A,x-a)
        num += N-p
    if num>=M:
        return True
    else:
        return False

#l：その値以上の幸福度の握手がM通り以上ある最大値
l = 0
r = 2*10**5 + 1
while abs(r-l)>1:
    mid = (l+r)//2
    if is_ok(mid):
        l = mid
    else:
        r = mid

#値l以上の握手で用いるA[i]の個数を調べる
bit = Range_BIT(N)
for i in range(1,N+1):
    p = bisect_left(A,l-A[i-1])
    if p!=N:
        bit.add(p+1,N+1,1)
        bit.add(i,i+1,N-p)
x = [0]*N
for i in range(N):
    x[i] = bit.query(i+1,i+2)

ans = 0
for i in range(N):
    ans += A[i]*x[i]

#握手の回数がM回になるように調整
ans -= l*((sum(x)-2*M)//2)

print(ans)

Measured memory_bytes: 63512
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<iomanip>
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18

using namespace std;
using ll = long long int;
 
int main(void) {
    int n, W; cin >> n >> W;
    vector<int> w(n), v(n);
    REP(i, n) cin >> w[i] >> v[i];
    vector<vector<ll>> dp(n + 1, vector<ll>(W + 1));
    REP(i, n) {
        REP(j, W + 1) {
            if (j >= w[i]) dp[i + 1][j] = max(dp[i][j - w[i]] + v[i], dp[i][j]);
            else dp[i + 1][j] = dp[i][j];
            //cout << dp[i + 1][j] << " ";
        }
        //cout << endl;
    }
    cout << dp[n][W] << endl;
}

Measured memory_bytes: 80256
// Problem : E - Colorful Blocks
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

long long gcdExtended(long long a, long long b, long long *x, long long *y) 
{ 
    if (a == 0) { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    long long x1, y1; 
    long long gcd = gcdExtended(b % a, a, &x1, &y1); 
  
    *x = y1 - b / a * x1; 
    *y = x1; 
  
    return gcd; 
} 

long long modInverse(long long a, long long m) 
{ 
    long long x, y; 
    long long g = gcdExtended(a, m, &x, &y); 
    if (g != 1) return -1; 
    else return (x % m + m) % m; 
} 

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

    long long const modulo = 998244353;
    long long n, m, k;
    cin >> n >> m >> k;
    
    vector<long long> pows(n);
    pows[0] = 1;
    for (long i = 1; i < n; i++) pows[i] = (pows[i-1] * (m-1)) % modulo;
    
    vector<long long> factorials(n);
    factorials[0] = 1;
    for (long i = 1; i < n; i++) factorials[i] = (factorials[i-1] * i) % modulo;
    
    vector<long long> invFactorials(n);
    for (long i = 0; i < n; i++) invFactorials[i] = modInverse(factorials[i], modulo);
    
    long long s = 0;
    for (long i = 0; i <= k; i++) {
        long long comb = (((factorials[n-1] * invFactorials[i]) % modulo) * invFactorials[n-1-i]) % modulo;
        s = (s + (comb * ((m * pows[n-i-1]) % modulo) % modulo)) % modulo; 
    } 
    
    cout << s << "\n";
    
    return 0;
}


Measured memory_bytes: 7952
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

li = LI()
for l in li:
  if l != li.index(l) + 1:
    print(li.index(l) + 1)

Measured memory_bytes: 61660
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for i in range(N):
	ans += B[i]
	if i >= 1:
		if A[i] == A[i-1]+1:
			ans += C[A[i-1]-1]
print(ans)

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for(int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  string o, e;
  cin >> o >> e;

  re(i, e.size()) {
    cout << o[i] << e[i];
  }
  if(o.size() != e.size()) cout << o.back();
  cout << endl;

  return 0;
}


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

int main()
{
    int H, W;
    
    while (1) {
        cin >> H >> W;
        if (H == 0 && W == 0)
            break;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (i == 0 || i == H - 1 || j == 0 || j == W - 1)
                    cout << '#';
                else
                    cout << '.';
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3104
import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())

n=input()
x=0
for i in n:
    x+=int(i)
    x%=9
if x==0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 68208
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF 1e9+7
#define rep(i,n) for(ll i=0;i<n;i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
const int maxn = 1000000;
ll mod = INF;

int main(){
    ll a,b,c,d;
    cin >> a>>b>>c>>d;
    cout << max(max(a*d,b*c),max(b*d,a*c))<<endl;

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int popcount(ll t){
	int res = 1;
	while(t > 0){
		ll k = t;
		int e_res = 0;
		while(k>0){
			if(k % 2 == 1)++e_res;
			k /= 2;
		}
		t %= e_res;
		++res;
	}
	return res;
}

ll rep_power_modM(ll a, ll n, ll M = MOD){
    if(n == 0)return 1;
    if(n%2 == 0){ll tmp = rep_power_modM(a,n/2,M); return tmp*tmp%M;}
    return a*rep_power_modM(a,n-1,M)%M;
}

int main(){
	int N; cin>>N;
	string s; cin>>s;
	int p = 0, need;
	rep(i,N)if(s[i] == '1')++p;
	ll default_plus = 0, default_minus = 0;
	ll mp = p+1, mm = p-1;
	for(int i = 0; i<N; ++i){
		if(mp != 1)default_plus += rep_power_modM(2,i,mp)*(s[N-1-i] == '1');
		if(mm != 0)default_minus += rep_power_modM(2,i,mm)*(s[N-1-i] == '1');
		if(mp != 1)default_plus %= mp;
		if(mm != 0)default_minus %= mm;
	}
	rep(i,N){
		int res;
		if(s[i] == '1'){
			if(mm == 0){cout<<0<<endl; continue;}
			ll use = default_minus - rep_power_modM(2, N-1-i, mm);
			use %= mm;
			if(use < 0) use += mm;
			res = popcount(use);
		}else{
			if(mp == 1){cout<<1<<endl; continue;}
			ll use = default_plus + rep_power_modM(2, N-1-i, mp);
			use %= mp;
			if(use < 0)use += mp;
			res = popcount(use);
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 3732
import copy
n, m = map(int, input().split())
adjacent_list = [[] for i in range(n+1)]
for i in range(m):
    a, b = map(int, input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
ans = 0

def dfs(node, finished):
    #print("node {}  finished {}".format(node, finished))
    finished.add(node)
    global ans
    if len(finished) == n:
        ans += 1
    else:
        for i in adjacent_list[node]:
            if i not in finished: 
                passed = copy.deepcopy(finished)
                dfs(i, passed)
dfs(1,set([1]))
print(ans)


Measured memory_bytes: 57944
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a>>b;
    int max;
    if(a+b<a-b){
        max=a-b;
    }
    else if(a+b>a-b){
        max=a+b;
    }
    if(max<a*b){
        max=a*b;
    }
    cout<<max;
}

Measured memory_bytes: 256
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    c = 7
    count = 1
    while True:
        if c % k == 0:
            print(count)
            break
        else:
            c = (10 * c + 7) % k
            count += 1

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int R;
	cin >> R;

	co(3 * R * R);

	Would you please return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define ub upper_bound
#define lb lower_bound
#define F first
#define S second

struct abcd{
    int a,b,c,d;
};

ll ans = 0;
vector<abcd> v(55);
int n,m,q;

void checkAll(int arr[], int m, int n, int index, int ma){
    if(n==0){
        ll lans = 0;
        for(int i=0; i<q; i++){
            if(arr[v[i].b-1] - arr[v[i].a-1] == v[i].c) lans += v[i].d;
        }
        ans = max(lans, ans);
    }
    if(n>0){
        for(int i=ma; i<=m; i++){
            arr[index] = i;
            checkAll(arr, m, n-1, index+1, i);
        }
    }
}

int main(){
    fastio;
    cin >> n >> m >> q;

    for(int i=0; i<q; i++){
        cin >> v[i].a >> v[i].b >> v[i].c >> v[i].d;
    }
 
    int arr[10];

    checkAll(arr, m, n, 0, 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> n = new ArrayList<>();
    for (int i = 0; i < 3; i++) {
      n.add(sc.nextInt());
    }
    int k = sc.nextInt();

    Collections.sort(n);
    for (int i = 0; i < k; i++)
      n.set(2, ((Integer) n.get(2) * 2));
    int ans = 0;
    for (Integer num : n)
      ans += num;
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
using ll = long long;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b)a=b;};

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

  Int n;
  while(cin>>n,n){
    vector<Int> as(n),bs(n);
    for(Int i=0;i<n;i++) cin>>as[i];
    for(Int i=0;i<n;i++) cin>>bs[i];

    priority_queue<Int, vector<Int>, greater<Int> > pq;
    for(Int a:as) pq.emplace(a);

    Int add=0;
    while(!pq.empty()&&(pq.top()+add==0)) pq.pop();

    sort(bs.rbegin(),bs.rend());
    Int flg=1;
    for(Int i=0;i<n;i++){
      //cout<<pq.size()<<" "<<bs[i]<<endl;
      if((Int)pq.size()!=bs[i]){
        flg=0;
        break;
      }
      add--;
      while(!pq.empty()&&(pq.top()+add==0)) pq.pop();
    }
    flg&=!!pq.empty();
    cout<<(flg?"Yes":"No")<<endl;
  }
  return 0;
}



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

// #define multitest 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;
auto TimeStart = chrono::steady_clock::now();

const int nax = 2e5 + 10;

void solve()
{
	int n;
	cin >> n;
	vector<int> A(n);
	for (int i = 0; i < n; ++i)
		cin >> A[i];
	multiset<int> M;
	for (int i = 0; i < n; ++i)
	{
		auto it = M.lower_bound(A[i]);
		if (it != M.begin())
		{
			--it;
			M.erase(it);
		}
		M.insert(A[i]);
	}
	cout << M.size();
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
#ifdef TIME
	cerr << "\n\nTime elapsed: " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " seconds.\n";
#endif
	return 0;
}

Measured memory_bytes: 5376
import itertools

def calcsum(s, ary):
    converted = ''
    for i, d in enumerate(s):
        converted += d
        if i in ary:
            converted += '+'
    return eval(converted)


def sumup(s):
    count = 0
    for n in range(len(s)):
        for lst_index_pos in itertools.combinations(range(len(s) - 1), n):
            count += calcsum(s, lst_index_pos)

    return count


s = input()
print(sumup(s))

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007

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

    if(a>0&&b>0){
        cout<<"Positive"<<endl;
    }
    else if(a<0&&b<0){
        if((b-a+1)%2==0){
            cout<<"Positive"<<endl;
        }
        else {
            cout<<"Negative"<<endl;
        }
    }
    else {
        cout<<"Zero"<<endl;
    }
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename FI,typename Compare>
pair<FI,FI> search_continuous(FI first,FI last,Compare comp){
	FI top = find_if(first,last,comp);
	if(top==last){
		return make_pair(last,last);
	}
	FI end = find_if_not(top,last,comp);
	return make_pair(top,end);
}

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

	string S=in<string>();
	vector<int> SI(S.size()),ans(S.size(),0);
	REP(i,S.size()){
		if(S[i]=='R') SI[i]=0;
		else SI[i]=1;
	}
	
	auto Ritr=SI.begin();
	while(Ritr!=SI.end()){
		auto Rres = search_continuous(Ritr,SI.end(),[](int v){return v==0;});
		auto Lres = search_continuous(Rres.second,SI.end(),[](int v){return v==1;});

		int Rstart = distance(SI.begin(),Rres.first);
		int Lstart = distance(SI.begin(),Rres.second);
		int Lend = distance(SI.begin(),Lres.second);
		int Rcount=0,Lcount=0;
		for(int i=Rstart;i<Lend;i++){
			if(!(abs(Lstart-i)%2)) Lcount++;
			else Rcount++;
		}

		ans[Lstart-1] = Rcount;
		ans[Lstart] = Lcount;

		Ritr = Lres.second;
	}

	REP(i,S.size()-1){
		cout << ans[i] << ' ';
	}
	out(ans[S.size()-1]);
	return 0;
}


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

using namespace std;

#define REP(a, b, c) for (register int a = b, _n = c; a <= _n; ++a)
#define DREP(a, b, c) for (register int a = b, _n = c; a >= _n; --a)
#define FOR(a, b, c) for (register int a = b, _n = c; a < _n; ++a)
#define DFOR(a, b, c) for (register int a = b, _n = c; a > _n; --a)
#define EREP(a, b) for (register int a = head[b]; a; a = edge[a].nxt)

inline int rd () {
	int x = 0; char IO = getchar();
	bool f = 0;
	while ((IO < '0' || IO > '9') && IO != '-') IO = getchar();
	if (IO == '-') f = 1, IO = getchar();
	while (IO >= '0' && IO <= '9') x = (x << 3) + (x << 1) + (IO ^ 48), IO = getchar();
	return f ? -x : x;
}

const int SIZE = 100005;

int n;
int a[SIZE], b[SIZE];

int main () {
   scanf ("%d", &n);

   int ans = 1;
   scanf ("%d", &a[1]);

   int num = 1;
   REP (i, 2, n) {
      scanf ("%d", a + i);
      if (a[i] <= a[i - 1]) ++num;
      else num = 1;
      ans = max(ans, num);
   }

   printf ("%d\n", ans - 1);
	return 0;
}


Measured memory_bytes: 640
N = int(input())
H = [int(i) for i in input().split()]

s = H[0]
t = 0
for i in range(1, N):
    if s <= H[i]:
        s = max(s, H[i] - 1)
    else:
        t = 1
        break

if t == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 20608
#include<stdio.h>

int main(void){
  char str[7];
  scanf("%s",str);
  
  if(str[2] == str[3]){
    if(str[4] == str[5]){
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  
 return 0;
}

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

int main()
{
    /*B
    string S, V = "";
    cin >> S;
    rep(i, 0, S.length())
    {
        V += "x";
    }
    cout << V << endl;
    /*/
    //C
    int N;
    cin >> N;
    vector<int> A(N);
    bool flag = false;
    rep(i, 0, N) cin >> A[i];
    sort(A.begin(), A.end());
    rep(i, 1, N)
    {
        if (A[i] == A[i - 1])
        {
            flag = true;
            break;
        }
    }
    if (flag)
        cout << "NO" << endl;
    else
        cout << "YES" << endl;
}

Measured memory_bytes: 1024
h, w = gets.split.map(&:to_i)
a = []
h.times do |i|
  s = gets.chomp
  a.push(s) if s.count('.') != w
end
(w - 1).downto(0) do |i|
  f = a.all?{|x| x[i] == '.'}
  if f
    a.each do |x|
      x[i] = ''
    end
  end
end
puts a

Measured memory_bytes: 1788
Q = int(input())
LR = [list(map(int, input().split())) for _ in range(Q)]
 
 
def is_prime(n):
    if n == 3/2:
        return False
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
 
 
min_num = 100000
max_num = 1
for i in range(Q):
    if LR[i][0] < min_num:
        min_num = LR[i][0]
    if max_num < LR[i][1]:
        max_num = LR[i][1]
 
 
ruiseki = [0 for _ in range(min_num, max_num+1)]
for j in range(min_num, max_num+1):
    if is_prime(j) == True and is_prime((j+1)/2) == True:
        if j == min_num:
            ruiseki[min_num - min_num] = 1
        else:
            ruiseki[j - min_num] = ruiseki[j - min_num -1] + 1
    else:
        ruiseki[j - min_num] = ruiseki[j - min_num -1]
 
ruiseki.insert(0,0)
for query in range(Q):
    r = LR[query][1]
    l = LR[query][0]
    print(ruiseki[r-min_num+1] - ruiseki[l-min_num])

Measured memory_bytes: 29452
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

signed main()
{
  int N;
  cin >> N;
  vector<pair<int, int>> a(N);
  for (int i = 0; i < N; i++)
  {
    int a0;
    cin >> a0;
    a.at(i) = make_pair(a0, i + 1);
  }
  
  sort(a.begin(), a.end());

  int ans = 0;
  set<int> b;
  b.emplace(0);
  b.emplace(N + 1);
  for (int i = 0; i < N; i++)
  {
    int x = a.at(i).first;
    int y = a.at(i).second;

    auto itr = b.lower_bound(y);
    itr--;
    int y0 = *itr;
    itr++;
    int y1 = *itr;
    b.emplace(y);
    
    ans += x * (y1 - y) * (y - y0);
  }
  
  cout << ans << endl;
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	int a;
	cin >> a;
	int ans = n - (2 * a);
	if(ans <= 0) {
		cout << 0 << endl;
	} else {
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
namespace ztd{
    using namespace std;
    #define reg register
    #define ms(a) memset(a,0,sizeof(a))
    #define count(x) __builtin_popcountll(x)
    #define smallest_one(x) __builtin_ffsll(x)
    typedef long long ll;
    typedef unsigned long long ull;
    typedef unsigned int uint;
    typedef double db;
    //basic I/O
    template<typename T> inline T read(T& t) {//fast read
        t=0;short f=1;char ch=getchar();double d = 0.1;
        while (ch<'0'||ch>'9') {if (ch=='-') f=-f;ch=getchar();}
        while (ch>='0'&&ch<='9') t=t*10+ch-'0',ch=getchar();
        if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
        t*=f;
        return t;
    }
    bool is_prime(ll x){
        for(ll i = 2; i*i <= x; ++i) if(!(x%i)) return 0;
        return x >= 2;
    }
    ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}

    void exgcd(int a, int b, int &x, int &y){
        if(!b) {x = 1, y = 0; return;}
        exgcd(b,a%b,x,y);
        int p = x; x = y; y = p-a/b*y;
     }
    inline ll ksm(ll x, ll y, ll mod){
        ll ret = 1;
        while(y){if(y & 1) ret = ret * x % mod; y >>= 1; x = x*x%mod;}
        return ret;
    }
    inline ll inv(ll x, ll mod){return ksm(x,mod-2,mod);}
}
using namespace ztd;
const int maxn = 5e5+7;
int n, q, a[maxn];
struct node{
	int id, l, r;
}qry[maxn];
bool cmp(node x, node y){
	if(x.r != y.r) return x.r < y.r;
	return x.l < y.l;
}
int last[maxn];
int t[maxn<<1];
int lowbit(int x){return x & -x;}
void add(int x, int k){
	while(x <= n){
		t[x] += k;
		x += lowbit(x);
	}
}
int sum(int x){
    int ans = 0;
    while(x){
    	ans += t[x];
        x -= lowbit(x);
    }
    return ans;
}
int ans[maxn];
signed main(){
	read(n); read(q);
	for(int i = 1; i <= n; ++i){
		read(a[i]);
	}
	int l, r;
	for(int i = 1; i <= q; ++i){
		read(qry[i].l); read(qry[i].r);
		qry[i].id = i;
	}
	sort(qry+1, qry+q+1, cmp);
	int prev = 1;
	for(int i = 1; i <= q; ++i){
		for(int j = prev; j <= qry[i].r; ++j){
			if(last[a[j]]) add(last[a[j]], -1);
			add(j,1);
			last[a[j]] = j;
		}
		prev = qry[i].r+1;
        ans[qry[i].id] = sum(qry[i].r)-sum(qry[i].l-1);
	}
	output:;
	for(int i = 1; i <= q; ++i) printf("%d\n", ans[i]);
}

Measured memory_bytes: 17396
#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()
{
    ll x;
    int y = 0;
    cin >> x;
    ll ans = 100;
    while (x > ans)
    {
        ans *= 1.01;
        y++;
    }
    cout << y << endl;
    return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;




public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int M=sc.nextInt();
    	int X=sc.nextInt();

    	int[] A=new int[M];

    	for(int i=0;i<M;i++) {
    		A[i]=sc.nextInt();
    	}

    	int counter=0;
    	for(int i=0;i<M;i++) {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	}

    	int cost=Math.min(counter,A.length-counter);

    	System.out.println(cost);


    }



}



Measured memory_bytes: 22612
/*================================================
# ~  file:A.cpp
# ~~ date:2020-03-22
# ~~~author: Accelerator
#        |everybody finds love,in the end|
#   人の運命か,人の希望は悲しみにつづられているね
=================================================*/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define ll long long
const int N=1e6+10;
using namespace std;
typedef pair<int,int>PII;

int n,m;

int main(){
 ios::sync_with_stdio(false);
  cin>>n>>m;
   cout<<n*(n-1)/2+m*(m-1)/2<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[10000+1];
        for(int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int total = 0;
        for(int k = 0; k < q; k++) {
            int key = sc.nextInt();
            if(search(S, n, key)) total++;
        }
        System.out.println(total);
    }
    public static boolean search(int a[], int n, int key) {
        int i = 0;
        a[n] = key;
        while(a[i] != key) i++;
        return i != n;
    }
}



Measured memory_bytes: 40472
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n;
  cin>>n;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i)
  {
    cin>>a[i];    
  }
  sort(a.begin(), a.end());

  if(n%2==0){
    for (int i = 1; i < n; i+=2)
    {
      auto u=upper_bound(a.begin(), a.end(),i);
      auto l=lower_bound(a.begin(), a.end(),i);
      if(u-l!=2) {
        cout<<0;
        return 0;
      }
    }
  }
  else{
    if(upper_bound(a.begin(), a.end(),0)-a.begin()!=1){
      cout<<0;
      return 0;
    }
    for (int i = 2; i < n; i+=2)
    {
      auto u=upper_bound(a.begin(), a.end(),i);
      auto l=lower_bound(a.begin(), a.end(),i);
      if(u-l!=2){
        cout<<0;
        return 0;
      }
    }
  }

  if(n%2!=0) n--;
  int64_t ans=1;
  for (int i = 0; i < n/2; ++i)
  {
    ans*=2;
    ans%=mod;
  }
  cout<<ans;

}

Measured memory_bytes: 640
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		String input = sc.nextLine();
		char judge =' ';
		int res = 0;
		for(int i = 0 ; i<input.length(); i++){
			if(input.charAt(i)!=judge){
				res++;
			}
			judge = input.charAt(i);
		}
		System.out.println(res);
	}
}


Measured memory_bytes: 28244
local n, m, x, y = string.match(io.read(), "(%d+) (%d+) ([+-]?%d+) ([+-]?%d+)")
n, m = tonumber(n), tonumber(m)
local xn = { tonumber(x) }
local ym = { tonumber(y) }

for v in string.gmatch(io.read(), "([+-]?%d+)") do
	table.insert(xn, tonumber(v))
end
for v in string.gmatch(io.read(), "([+-]?%d+)") do
	table.insert(ym, tonumber(v))
end

table.sort(xn)
table.sort(ym)

if(xn[#xn] >= ym[1]) then
    print("War")
else
    print("No War")
end

Measured memory_bytes: 1008
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,K;
    cin >> N >> K;
    vector<int>A(N+1);
    vector<int>flag(N+1,-1);
    vector<int>B;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    int tugi = 1;
    flag[1] = 0;
    int cnt1 = -1;
    int cnt2 = -1;
    for (int i = 1; i <= N+1; i++) {
        B.push_back(tugi);
        if (flag[A[tugi]] != -1) {
            cnt1 = flag[A[tugi]];
            cnt2 = (i - flag[A[tugi]]);
            break;
        }
        flag[A[tugi]] = i;
        tugi = A[tugi];
    }
    if (cnt1 > K) {
        cout << B[K] << endl;
    }
    else {
        int X = (K-cnt1)%cnt2;
        cout << B[cnt1+X] << endl;
    }
}

Measured memory_bytes: 8484
#include<stdio.h>

int main() {
  
   int N[100];
   int n,i;
   
   scanf("%d\n",&n);
    
   for (i=0; i<n; i++) {
      scanf("%d",&N[ i ]);
   }
  
   for (i=n-1; i>=0; i--) {
      printf("%d",N[ i ]); 
      if (i!=0) {
         printf(" ");
      }
   }
   printf("\n"); 

   return 0;

}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=0,i[10];
	string xx[]={"0","7","5","3"};
	cin >> n;
	for(i[0]=0;i[0]<4;i[0]++)
	for(i[1]=0;i[1]<4;i[1]++)
	for(i[2]=0;i[2]<4;i[2]++)
	for(i[3]=0;i[3]<4;i[3]++)
	for(i[4]=0;i[4]<4;i[4]++)
	for(i[5]=0;i[5]<4;i[5]++)
	for(i[6]=0;i[6]<4;i[6]++)
	for(i[7]=0;i[7]<4;i[7]++)
	for(i[8]=0;i[8]<4;i[8]++)
	{
		bool add = true;
		bool x3,x5,x7;
		x3 = x5 = x7 = false;
		string k;
		for(int j=0;j<9;j++){
			k += xx[i[j]];
			if(i[j]==0&&(x3|x5|x7)!=0)
				add = false;
			if(i[j]==1)x7=true;
			if(i[j]==2)x5=true;
			if(i[j]==3)x3=true;
		}
		if(add&&x7&&x5&&x3&&(stoi(k)<=n))ans++;
	}
	cout << ans << endl;
}

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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    int n,w;
    cin>>n>>w;

    vector<pair<ll,ll>> v;

    for(int i=0;i<n;i++)
    {
    	ll x,y;
    	cin>>x>>y;
    	v.push_back(make_pair(x,y));
    }

    sort(v.begin(),v.end());

    ll dp[n+1][w+1];

    for(int i=0;i<n+1;i++)
    {
    	for(int j=0;j<w+1;j++)
    		if(i==0 || j==0)
    			dp[i][j]=0;
    }

    for(int i=1;i<n+1;i++)
    {
    	for(int j=1;j<w+1;j++)
    	{
    		ll a=v[i-1].first;
    		ll b=v[i-1].second;
    		if(j>=a)
	    		dp[i][j]=max(dp[i-1][j-a]+b,dp[i-1][j]);
	    	else
	    		dp[i][j]=dp[i-1][j];
    	}
    }

    cout<<dp[n][w];
}

Measured memory_bytes: 79232
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int A, B; cin>>A>>B;
  cout << max(0, A-2*B) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    #include <string.h>
     
    int in(void){
    	int i;scanf("%d",&i);
    	return i;
    }
    long long llin(void){
    	long long i;scanf("%lld",&i);
    	return i;
    }
    void print(int a){
    	printf("%d\n",a);
    }
    void llprint(long long a){
    	printf("%lld\n",a);
    }
    void print2(int a,int b){
    	printf("%d %d\n",a,b);
    }
    long long max(long long a,long long b){
    	return a>b?a:b;
    }
    long long min(long long a,long long b){
    	return a<b?a:b;
    }
     
    int main(void){
    	char a[102],b[102];
    	scanf("%s",a);
    	scanf("%s",b);
    	if(strlen(a)!=strlen(b)){
    		puts(strlen(a)>strlen(b)?"GREATER":"LESS");
    	}
    	else{
    		int i;
    		for(i=0;i<strlen(a);i++){
    			if(a[i]!=b[i]){
    				puts(a[i]>b[i]?"GREATER":"LESS");
    				break;
    			}
    		}if(i==strlen(a))puts("EQUAL");
    	}
    	return 0;
    }

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

int main() {

	int n;
	cin >> n;
	string s; cin >> s;
	if (n == 1) {
		cout << "No\n";
		return 0;
	}
	n /= 2;
	string tmp = s.substr(0, n);
	cout << ((tmp + tmp == s) ? "Yes" : "No") << '\n';

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
#define il inline
#define re register
#define fo(i,j,k) for(register int i=j;i<=k;i++)
#define do(i,j,k) for(register int i=j;i>=k;i--) 
#define inf 0x7fffffff
typedef long long ll;
using namespace std;
il ll read()
{
	ll x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return f*x;	
}
int n,m,cnt; 
int a[200005];
ll sum;
/*int h[200010],dis[200010],v[200010];
int dp[1005][1005];
struct edge
{
	int v,w,next;
}e[200010*2];
il void add(int u,int v)
{
	e[++cnt].v=v;
//	e[cnt].w=w;
	e[cnt].next=h[u];
	h[u]=cnt;
}*/ 
int main()
{
	n=read();
	fo(i,1,n-1)
	{
		int x=read();
		a[x]++;
	}
	fo(i,1,n)
	{
		printf("%d\n",a[i]);
	}	 
	return 0;
}

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

struct Node{
    int x,y;
    bool operator < (struct Node &w){
        return x < w.x;
    }
}a[100000];



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


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

int main() {
  long long n;
  cin >> n;
  long long a[n],b[n],i,j,cna=0,cnb=0;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  for(i=0;i<n;i++)cin >> b[i];
  for(i=0;i<n;i++){
    if(a[i]-b[i]>0)cna += a[i]-b[i];
    else cnb += (b[i]-a[i])/2;
  }
  if(cnb >= cna)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 384
#include<stdio.h> 

int main(void){ 

int a=0; 

int W,H,x,y,r=0; 

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r); 

if(x-r>=0&&x+r<=W){ 

if(y-r>=0&&y+r<=H){ a=1; } } 

else{ a=0; } 

if(a==1){ 

printf("Yes\n"); } 

else if(a==0){ 

printf("No\n"); } 

return 0; 

} 

Measured memory_bytes: 584
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset>
using namespace std;
typedef long long ll;
ll l[2004];
int main(void)
{
	ll n;
	scanf("%lld",&n);
	for(ll i=0;i<n;i++) scanf("%lld",&l[i]);
	sort(l,l+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(l[i]!=l[j]&&l[j]!=l[k]&&l[k]!=l[i])
				{
					if(l[i]+l[j]>l[k]&&l[i]+l[k]>l[j]&&l[j]+l[k]>l[i]) ans++;
				}
			}
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 3828
#include <stdio.h>
#include <math.h>
 
int main()
{
  int in;
  int syou,amari;
  int kai;
  double out;
  
  scanf("%d",&in);
  
  syou = in/2;
  amari = in%2;
  kai = syou + amari;
  
  out = (double)kai/(double)in;
  printf("%f\n",out);
  
  return 0;  
}

Measured memory_bytes: 128
#include <stdio.h>



 int main(){

   int b,f,r,v;
   int n;
   int i,j,k;
   int room[5][4][11];


   for (i = 1;i<=4;i++){
     for(j=1;j<=3;j++){
       for(k = 1;k<=10;k++)
        room[i][j][k]=0;
      }
   }


    scanf("%d",&n);

   for (i = 0;i<n;i++){
    scanf("%d %d %d %d\n",&b,&f,&r,&v);
    room[b][f][r]=room[b][f][r]+v;
   }

    //printf("%d %d %d",room[0][3][])


   for (i = 1;i<=4;i++){
     for(j=1;j<=3;j++){
       for(k = 1;k<=10;k++){
        printf(" %d", room[i][j][k]);
      }
      printf("\n");
      }
      if(i != 4){
        printf("####################\n");
      }
   }












  //printf("\n");



return(0);
}

Measured memory_bytes: 616
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <queue>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a[LIMIT2]={0};
  char s[LIMIT1];
  ll tmp,count;
  vector<ll> yaku;
  
  scanf("%lld",&n);
  tmp=0;
  for(i=2;i<=sqrtl(n);i++){//nの素数判定
    if(n%i==0){
      tmp = n;
      break;
    }
  }
  if(n==1) result=0;
  else if(tmp==0 && n>=2){
    result=1;//nが素数
  }else{
    tmp = n;
    for(i=2;i<=sqrtl(n) && tmp>=1;i++){
      j=i;
      while(tmp%j==0){
        tmp /= j;
        yaku.push_back(j);
      }
    }
    if(tmp>=2) yaku.push_back(tmp);
    m = yaku.size();
    count=1;
    rep(i,m){
      if(i != m-1 && yaku[i]==yaku[i+1]){
        count++;
      }else{
        j=1;
        while(count>=1){
          count -= j;
          j++;
          if(count>=0) result++;
        }
        count=1;
      }
    }
    //rep(i,m) printf("%lld%c",yaku[i],(i==m-1 ? '\n' : ' '));
  }
  printf("%lld",result);
  return 0;
}

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

int main()
{
	char S[101];
	long long K;
	scanf("%s", S);
	scanf("%lld", &K);
	
	int i;
	for (i = 0; S[i] == '1'; i++);
	
	if (K <= i) printf("1\n");
	else printf("%d\n", S[i] - '0');
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<stdbool.h>
#define int long long
#define elif else if
#define mod 1000000007

int maxx(int a, int b)
{
	return (a>b)?a:b;
}
int main(void)
{
	int n,w;
	scanf("%lld %lld",&n,&w);
	int wt[n],val[n];
	for(int i = 0;i<n;i++)
	{
		scanf("%lld %lld",wt+i,val+i);
	}

	int dp[n+1][w+1];
	memset(dp,0,sizeof(dp));

	for(int i = 0;i<=n;i++)
	{
		for(int j = 0;j<=w;j++)
		{
			if(i==0||j==0)
				dp[i][j] = 0;
			else if(wt[i-1]<=j)
				dp[i][j] = maxx((val[i-1]+dp[i-1][j-wt[i-1]]), dp[i-1][j]);
			else
				dp[i][j] = dp[i-1][j];
		}
	}

	printf("%lld\n",dp[n][w]);
	return 0;
}


Measured memory_bytes: 79104
def primenum(n):
  if n==2:
    return True
  elif n<2 or n%2==0:
    return False
  else:
    for i in range(3,int(n**0.5)+1,2):
      if n%i==0:
        return False
    return True

x = int(input())
for i in range(x,x**2):
  if primenum(i):
    print(i)
    break

Measured memory_bytes: 3060
def main():
    X, K, D = map(int, input().split())
    if abs(X) == D:
        if K % 2 == 0:
            print(abs(X))
        else:
            print(0)
        return

    diff = K * D - abs(X)
    if abs(diff) <= D:
        print(abs(diff))
        return
    elif diff < 0:
        print(abs(diff))
        return
    count_minus = abs(diff // (2 * D))
    if X > 0:
        dest = X - (K - count_minus) * D + count_minus * D
        dest2 = X - (K - count_minus - 1) * D + (count_minus + 1) * D
    else:
        dest = X + (K - count_minus) * D - count_minus * D
        dest2 = X + (K - count_minus - 1) * D - (count_minus + 1) * D

    print(abs(dest) if abs(dest) < abs(dest2) else abs(dest2))

if __name__ == '__main__':
    main()


Measured memory_bytes: 61908
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	ll N;
	cin >> N;
	ll ans = 0;
	for(ll A = 1; A < N; A++){
		for(ll B = 1; A*B < N; B++){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  long long int count=1;
  int n;
  int x=0,y=0,z=0;
  cin >> n;
  for (int i=0; i<n; i++) {
    int num;
    cin >> num;
    int temp_count=0;
    if (x==num) {
      temp_count++;
      x++;
      if (y==num) {
        temp_count++;
      }
      if (z==num) {
        temp_count++;
      }
    }
    else if (y==num) {
      temp_count++;
      y++;
      if (z==num) {
        temp_count++;
      }
    }
    else if (z==num) {
      temp_count++;
      z++;
    }
    count *= temp_count;
    count %= 1000000007;
  }
  cout << count;
}

Measured memory_bytes: 384
n, A, B = map(int, input().split())
a, b = 0, 0
s = input()
for i in range(n):
    s_i = s[i]
    if s_i == 'a':
        if (a + b) < (A + B):
            a += 1
            print('Yes')
        else:
            print('No')
    elif s_i == 'b':
        if ((a + b) < (A + B)) & (b < B):
            b += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')
    


Measured memory_bytes: 9212
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef double db;
const int MAXN = 1e5 + 5, MAXM = 2e6 + 5, BOUND = 2e5, MOD = 1e9 + 7, INF = 0x3f3f3f3f, inv2 = 500000004;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0), eps = 1e-6;
#define mid l + ((r-l)>>1)
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define lc(x) c[x][0]
#define PII pair<int,int>
#define rc(x) c[x][1]
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
char gdffsaw;
#define G gdffsaw=getchar()
#define GO G;while(gdffsaw<'-')G
#define in(z) GO;z=gdffsaw&15;G;while(gdffsaw>'-')z*=10,z+=gdffsaw&15,G
int read() {
	int x = 0, f = 1; char ch = getchar();
	while (ch<'0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
	while (ch >= '0'&&ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
int n, cnt[MAXN];
char str[MAXN];
ll qPwo(ll a, ll b) {
	ll ans = 1;
	for (; b; b >>= 1, a = a * a%MOD)if (b & 1)ans = ans * a%MOD;
	return ans;
}
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n >> (str + 1);
	ll ans = 0, temp;
	rep(i, 1, n) {
		temp = 1;
		rep(j, 'a', 'z') {
			if (j == str[i])continue;
			temp = temp * (cnt[j] + 1) % MOD;
		}
		ans = (ans + temp) % MOD;
		cnt[str[i]]++;
	}
	cout << ans << '\n';
	return 0;
}

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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 1000000000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
  ll N;cin >> N;
  vector<ll> A(N);
  ll sum = 0;
  for(ll i = 0;i < N;i++){
      cin >> A[i];
      sum += A[i];
  }
  ll d = INF;
  ll memo = 0;
  for(ll i = 0;i < N;i++){
    memo += A[i];
    d = min(abs(sum/2-memo),d);
  }
  if(sum % 2 == 0){
   cout << sum - 2 * (sum/2- d) << endl;
  }else{
    memo = 0;
    A[0] += 1;
    sum += 1;
    for(ll i = 0;i < N;i++){
    memo += A[i];
    d = min(abs(sum/2-memo),d);
    }
    ll a = 2*d+1;
    A[0] -= 1;sum -= 1;
    memo = 0;


    A[N-1]++;sum++;
    for(ll i = 0;i < N;i++){
    memo += A[i];
    d = min(abs(sum/2-memo),d);
    }
    ll b = 2 * d + 1;
    A[N-1]--;sum--;
    memo = 0;

    ll c = INF;
    if(A[0] != 1){
      A[0]--;sum--;
      for(ll i = 0;i < N;i++){
    memo += A[i];
    d = min(abs(sum/2-memo),d);
    }
    c = 2*d+1;
    A[0]++;sum++;
    }


    ll e = INF;
    memo = 0;
    if(A[N-1] != 1){
      A[N-1]--;sum--;
      for(ll i = 0;i < N;i++){
    memo += A[i];
    d = min(abs(sum/2-memo),d);
    }
    e = 2*d + 1;
    A[0]++;sum++;
    }
    //cout << a << b << c << e << endl;
    cout << min({a,b,c,e}) << endl;
  }
}


Measured memory_bytes: 1792