akhauriyash/Code-Regression huggingface dataset:
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split(' ')))
    A.sort()
    A.reverse()
    total = sum(A)
    for i in range(M):
        if total / (4 * M) <= A[i]:
            continue
        print('No')
        return
    print('Yes')

main()

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

int main() {
  int a, b, x;
  cin >> a >> b;
  x = a * b % 2;
  if (x == 1) {
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mo 1000000007
using namespace std;
long long w,h,x,y,flag;
double ans,l,r,mid1,mid2;
long long ksm(long long u,long long v){
	long long o=1;
	while(v){
		if(v&1)
			o=o*u%mo;
		u=u*u%mo;
		v>>=1;
	}
	return o;
}
int main(){
	cin>>w>>h>>x>>y;
	if(x*2==w&&y*2==h){
		ans=w*h/2.0;
		cout<<ans<<" 1"<<endl;
	}
	else{
		ans=w*h/2.0;
		cout<<ans<<" 0"<<endl;
	}
    return 0;
}

Measured memory_bytes: 256
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	string s, t, u; int a, b; cin >> s >> t >> a >> b >> u;
	if(u == s) a--;
	else b--;
	cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

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; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int H, W, h, w;
  cin >> H >> W >> h >> w;

  int ans = H * W;
  ans -= h * W;
  ans -= w * H - h * w;

  cout << ans << endl;

  return 0;
}


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

int main(){
	priority_queue<int> Q;
	for(int i=0;i<10;i++){
		int h;
		cin >> h;
		Q.push(h);
	}
	for(int i=0;i<3;i++){
		cout << Q.top() << endl;
		Q.pop();
	}
}


Measured memory_bytes: 3160
unittest
{
	assert( [ "0 75 25 100" ].parse.expand.solve == 50 );
	assert( [ "0 33 66 99" ].parse.expand.solve == 0 );
	assert( [ "10 90 20 80" ].parse.expand.solve == 60 );
	
	assert( [ "66 99 0 33" ].parse.expand.solve == 0 );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto abcd = input.front.split.to!( long[] );
	return tuple( abcd[ 0 ], abcd[ 1 ], abcd[ 2 ], abcd[ 3 ] );
}

auto solve( long a, long b, long c, long d )
{
	if( b <= c || d <= a ) return 0;
	else                   return min( b, d ) - max( a, c );
}


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

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

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

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

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

    int n;
    cin >> n;

    vector<int> a(n);
    int m = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        m = max(m, a[i]);
    }
    sort(all(a));

    if(n == 1){
        cout << 1 << "\n";
        return 0;
    }

    if(a[0] == a[n-1]){
        cout << 0 << "\n";
        return 0;
    }

    vector<int> b(m+1);
    b[0] = false;
    for (int i = 0; i < n; ++i) {

        int j = a[i], x = 1;
        while(j <= m){
            b[j]++;
            x++;
            j = a[i] * x;
        }
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if(b[a[i]] > 1){
            ans++;
        }
    }

    ans = n - ans;
    cout << ans << "\n";

    return 0;
}


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

int main() {
  int N, K, l;
  cin >> N >> K;
  vector<int> vec(N);
  int ans = 0;

  for(int i = 0; i < N; i++){
    cin >> l;
    vec.at(i) = l;
  }
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  for(int i = 0; i < K; i++){
    ans += vec.at(i);
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
s = input()
for i in range(2**(len(s)-1)):
    ans = s[0]
    for j in range(len(s)-1):
        if i >> j & 1:
            ans += "+"
        else: ans += "-"
        ans += s[j+1]
    if eval(ans) == 7:print(ans+"=7");exit()

Measured memory_bytes: 3060
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    a, b = mi()
    print(a+b) if b % a == 0 else print(b-a)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main() {
	int N, A[100], B[100], i, j, k, sum, sumsave;
	sumsave = 0;
	cin >> N;
	for (i = 0;i < N;i++) {
		cin >> A[i];
	}
	for (i = 0;i < N;i++) {
		cin >> B[i];
	}
	for (i = 0;i < N;i++) {
		for (j = 0;j <= i;j++) {
			sum = sum + A[j];
		}
		for (k = i;k < N;k++) {
			sum = sum + B[k];
		}
		if (sumsave < sum) {
			sumsave = sum;
		}
		sum = 0;
	}
	cout << sumsave << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long ans=0;
		ans+=n-1;
		long count=2;
		if(n==2){
			System.out.println(0);
			return;
		}
		while(true){
			if((n-count)/count<=count){
					break;
			}
			if((n-count)%count==0){
				ans+=(n-count)/count;
			}
			count++;
			
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
	using namespace std;
	#define M 1000000007
	#define U 998244353
	#define N 1000005
	#define int long long
	#define sz(c) (int)c.size()
	#define fr first
	#define ll long long 
	#define sc second
	#define pb push_back
	#define ppb pop_back
	#define mp make_pair
	#define all(a) (a).begin(),(a).end()
	#define rep(i,a,n) for(int i=a ; i<n ; i++)
	#define r0 return 0;
	#define endl '\n'
	#define INF (int)1e15
	#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		std::cerr << name << " : " << arg1 << endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
	signed main()
	{
		ios_base::sync_with_stdio(0);
		int TESTS=1;
		// cin>>TESTS;
		while(TESTS--)
		{   
			string s;
			cin>>s;
			vector<pair<int,int>> v;
			int cur=0, curt = 1;
			rep(i,0,sz(s)){
				if(s[i]=='<' && curt==1) cur++;
				if(s[i]=='<' && curt==-1){
					v.pb({cur,curt});
					curt = 1;
					cur = 1;
				}
				if(s[i]=='>' && curt==-1) cur++;
				if(s[i]=='>' && curt==1){
					v.pb({cur,curt});
					curt = -1;
					cur = 1;
				}
			}
			// for(auto j:v) cout<<j.fr<<" "<<j.sc<<endl;
			if(cur) v.pb({cur,curt});
			int ans = 0;
			rep(i,0,sz(v)){
				ans += (v[i].fr*(v[i].fr+1))/2;
				if(i!=0 && v[i].sc==-1){
					// trace(i);
					if(v[i].fr<=v[i-1].fr){
						// trace(i);
						ans -= v[i].fr;
					}
				}
				if(i!=sz(v)-1 && v[i].sc==1){
					// trace(i);
					if(v[i+1].fr>v[i].fr){
						// trace(i);
						ans-= v[i].fr;
					}
				}
			}
			cout<<ans;
		}   
	}     

Measured memory_bytes: 7316
n, d=map(int, input().split())
l=[]
cnt=0
for _ in range(n):
  l.append(list(map(int, input().split())))
for i in range(n-1):
  for j in range(i+1, n):
    calc=0
    for h in range(d):
      calc+=(l[i][h]-l[j][h])**2
    if int(calc**0.5)==calc**0.5:
      cnt+=1
print(cnt)

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H,W,N,fix,fiy;
    string act,def;
    cin >> H >> W >> N >> fix >> fiy >> act >> def;
    ll left = fiy,right = W-fiy+1,up = fix,down = H-fix+1;
    ll r=0,l=0,u=0,d=0;
    bool on = 1;
    REP(i,N){
        if(act.at(i) == 'U'){
            u++;
            if(u==up){
                on = 0;
                break;
            }
        }
        if(act.at(i) == 'D'){
            d++;
            if(d==down){
                on = 0;
                break;
            }
        }
        if(act.at(i) == 'R'){
            r++;
            if(r==right){
                on = 0;
                break;
            }
        }
        if(act.at(i) == 'L'){
            l++;
            if(l==left){
                on = 0;
                break;
            }
        }
        if(def.at(i) == 'U'){
            d--;
            if(abs(d)==up)d++;
        }
        if(def.at(i) == 'D'){
            u--;
            if(abs(u)==down)u++;
        }
        if(def.at(i) == 'R'){
            l--;
            if(abs(l)==right)l++;
        }
        if(def.at(i) == 'L'){
            r--;
            if(abs(r)==left)r++;
        }
    }
    if(on == 0)std::cout << "NO" << "\n";
    else std::cout << "YES" << "\n";
}

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

using namespace std;

const int MAX_N = 110;
const int MAX_EXTRA_W = 3 * MAX_N;

int64_t dp[2][MAX_N][MAX_EXTRA_W];

int main() {
  int N;
  int64_t W;
  cin >> N >> W;
  memset(dp, -1LL, sizeof(dp));

  int64_t w0, v0;
  cin >> w0 >> v0;
  int prev = 0;
  int next = 1;
  dp[1][0][0] = 0;
  dp[1][1][0] = v0;

  for (int i = 1; i < N; i++) {
    swap(prev, next);
    memcpy(dp[next], dp[prev], sizeof(dp[next]));

    int64_t w, v;
    cin >> w >> v;
    int extraW = w - w0;

    for (int totalN = 1; totalN <= i + 1; totalN++) {
      for (int prevExtraW = 0; prevExtraW + extraW <= 3 * totalN;
           prevExtraW++) {
        if (dp[prev][totalN - 1][prevExtraW] == -1) continue;
        if (dp[next][totalN][prevExtraW + extraW] >
            dp[prev][totalN - 1][prevExtraW] + v) {
          continue;
        }

        dp[next][totalN][prevExtraW + extraW] =
            dp[prev][totalN - 1][prevExtraW] + v;
      }
    }
  }

  int64_t maxValue = 0LL;
  for (int n = 1; n <= N; n++) {
    for (int64_t extraW = 0; extraW < MAX_EXTRA_W; extraW++) {
      int64_t totalW = w0 * n + extraW;
      if (totalW <= W) {
        maxValue = max(maxValue, dp[N & 1][n][extraW]);
      }
    }
  }
  printf("%ld\n", maxValue);

  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

int main(int argc, char const* argv[])
{
	int n, s[1000];
	double m, a2;
	while (cin >> n && n != 0) {
		m = 0;
		for (int i = 0; i < n; i++) {
			cin >> s[i];
			m += s[i];
		}
		m = (double)m / (double)n;
		a2 = 0;
		for (int i = 0; i < n; i++) {
			a2 += (s[i] - m) * (s[i] - m);
		}
		a2 = a2 / n;
		cout.precision(8);
		cout << fixed << sqrt( a2 ) << endl;
	}
	return 0;
}


Measured memory_bytes: 1240
#include<cstdio>
using namespace std;

typedef long long lint;

lint gcd(lint a,lint b){
    if(b==0)return a;
    return gcd(b,a%b);
}

lint lcm(lint a,lint b){
    lint g=gcd(a,b);
    return a/g*b;
}

int main(void){
    int n;
    scanf("%d",&n);
    lint ans=1;
    while(n--){
        lint x;
        scanf("%lld",&x);
        ans=lcm(x,ans);
    }
    printf("%lld\n",ans);
    return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;

string s,w;

vector<int> z;

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

   cin >> n >> m;
   if(Abs(n,m)!=1 && Abs(n,m)!=0){
       Cout(0);
   }
   else{
       rrrep(i,n,0){
               ans*=i;
               ans%=1000000007;
           }
           rrrep(i,m,0){
               anss*=i;
               anss%=1000000007;
           }
           if(n==m){
               Cout((2*(ans*anss)%MOD)%MOD);
           }
           else{
               Cout((ans*anss)%MOD);
           }
   }
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
void view(vector<int64_t> rem) {
  cout << "rem = {";
  for (int i = 0; i < 13; i++) {
    cout << rem[i] << ", ";
  }
  cout << "}" << endl;
}
 
void view_5(vector<int64_t> rem) {
  cout << "rem[5] = " << rem[5] << endl;
}
 
// 数が書いてある場合
void proceed_constant(vector<int64_t> &rem, int d) {
  // 10倍の処理と1の位の処理
  vector<int64_t> temp(13);
  for (int i = 0; i < 13; i++) {
    temp[(i * 10 + d) % 13] = rem[i];
  }
  rem = temp;
//  view_5(rem);
}
 
// ?の場合
void proceed_variant(vector<int64_t> &rem) {
  // 10倍の処理
  vector<int64_t> temp(13, 0);
  for (int i = 0; i < 13; i++) {
    temp[(i * 10) % 13] = rem[i];
  }
  rem = temp;
  
  temp = vector<int64_t>(13, 0);
  // 1の位の処理
  for (int i = 0; i < 13; i++) {
    for (int j = 0; j <= 9; j++) {
      temp[(i + j) % 13] += rem[i];
    }
  }
  
  for (int i = 0; i < 13; i++) {
    temp[i] = temp[i] % (1000 * 1000 * 1000 + 7);
  }
  
  rem = temp;
}
 
int main() {
  string S;
  cin >> S;
  // 整数の個数を13で割った余りごとに数えるための配列
  vector<int64_t> rem = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  
  for (char c : S) {
    if (c != '?') {
      proceed_constant(rem, c - '0'); // 文字'0'と整数0は一致しないので一工夫
    } else {
      proceed_variant(rem);
    }
  }
  
  cout << rem[5];
}

Measured memory_bytes: 512
#include <iostream>


using namespace std;


int main(void)
{
    unsigned long long x;
    cin >> x;

    if (x % 11 == 0) {
        cout << (x / 11) * 2 << endl;
        return 0;
    }

    unsigned long long y = x / 11;
    if (x <= y * 11 + 6) {
        cout << y * 2 + 1 << endl;
    } else if (x > y * 11 + 6) {
        cout << y * 2 + 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def gcd(a,b):
  if b == 0:
    return(a)
  else:
    return(gcd(b,a%b))

n = int(input())
a = [int(i) for i in input().split()]
a.sort()

tmp = a[0]
for i in range(1,n):
  tmp = gcd(a[i],tmp)

ans = tmp
print(ans)

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

int main()
{
    string N;
    cin >> N;
    int digit = N.size();
    int ans = 0;

    int x = 0;
    reverse(N.begin(), N.end());
    rep(i, N.size()) {
        x += (N.at(i) - '0') * pow(10,i);
    }
    if (digit % 2 == 0) {
        ans = 9;
        if (digit == 2) {
            ans = 9;
        } else {
            int z = digit - (digit/2 + 1);
            rep(i, z) {
                ans += 900 * pow(100, i);
            }
        }
    } else {
            ans = 9;
        if (digit == 1) {
            ans = x;
        } else {
            int y = digit - (digit/2 + 2);
            rep(i, y) {
                ans += 900 * pow(10, i);
            }
            ans += x - (pow(10, (digit-1)) - 1);
        }
    }
    cout << ans << endl;
}

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

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX];

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

ll pow_kai(ll a,ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a%MOD;
    }
    a = a*a%MOD;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll tmp=1;
    for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

    return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
}

void type2(string S){
    
}


int main()
{
    ll Q,T,F,cot=0;
    string S,S1="",S2="",c;
    
    
    cin >> S >> Q;

    rep(i,Q){
        cin >>T;
        if(T==1){
            cot++;
            
        }else{
            cin >> F >> c;
            if( (F==1&&cot%2==0) ||(F==2&&cot%2==1) ){
            
                S1 = c + S1;
            }else{
                S2 = S2 + c;
            }
        }
    }

    S = S1 + S + S2;

    if(cot%2==1){
        reverse(S.begin(),S.end());
    }

    cout <<S <<endl;




 
    return 0;

}

Measured memory_bytes: 1464
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <set>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
int n,k;
int vis[300010];
int main() {
	rd(n),rd(k);
	if(3*n-1-k<n/2+2*n-1) {
		printf("-1");
		return 0;
	}
	int p2=2*n-1;
	int p1=n/2;
	for(int i=3*n-1;i>=2*n;--i) {
		printf("%d %d %d\n",p1+k,p2+k,i+k);
		p2-=2;
		if(p2<n) p2=2*n-2;
		p1++;
		if(p1==n) p1=0;
	}
	return 0;
}

Measured memory_bytes: 2304
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }





int main() {
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    REP(i, n){
        cin >> a[i + 1];
    }
    sort(a.begin(), a.end());
    a[0] = 0;
    for(ll i = 1; i <= n; i++){
        if((a[i] - a[i - 1]) % 2 == 0){
            a[i] = min(a[i], a[i - 1] + 2);
        }
        else{
            a[i] = min(a[i], a[i - 1] + 1);
        }
    }
    
    vector<ll> imos(300005);
    REP(i, n){
        imos[1]++;
        imos[a[i + 1] + 1]--;
    }
    
    ll res = 0;
    for(ll i = 1; i < 300004; i++){
        imos[i] += imos[i - 1];
        res ^= imos[i];
    }
    if(res != 0){
        cout << "first" << endl;
    }
    else{
        cout << "second" << endl;
    }
}


Measured memory_bytes: 3328
import collections


def main():
    count = int(input())
    lis = list(map(int, input().split()))
    dic = collections.Counter(lis)
    for i in range(1,count + 1):
        if dic[i]:
            print(dic[i])
        else:
            print(0)



if __name__ == '__main__':
    main()


Measured memory_bytes: 116788
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int p = x1 - x2;
  int q = y1 - y2;
  cout << x2 + q << ' ';
  cout << y2 - p << ' ';
  cout << x1 + q << ' ';
  cout << y1 - p << endl;
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };



void solve() {
    ll a, b, c, d, e , m, n, k, x, y, l,r, h, w;
    string s, t;
    ll ans = 0;
    double dans = 0;
    string sans = "Yes";
    vector<ll> ar;
    vector<string> sr;
    vector<vector<char>> arr;

    cin >> n;

    double _l = n/(double)3;
    dans = pow(_l,3);




    std::cout << dans << endl;

    // std::cout << sans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 512
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn keta_sum(s: &str) -> u32 {
    s.chars().map(|c| {
        c.to_digit(10).unwrap()
    }).collect::<Vec<u32>>().iter().sum()
}

fn main() {
    loop {
        let s: String = read();
        if s == "0" {
            break;
        }
        println!("{}", keta_sum(&s));
    }
}



Measured memory_bytes: 5032
# B - Voting Judges
# https://atcoder.jp/contests/agc041/tasks/agc041_b
# https://atcoder.jp/contests/agc041/submissions/12183756

# にぶたん　二分探索
n, m, v, p = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

ok = p - 1
ng = n

while abs(ok - ng) > 1:
  mid = (ok + ng) // 2
  if A[mid] + m < A[p - 1]:
    ng = mid
    continue

  used = m * p
  for i in range(p - 1, n):
    if i != mid:
      used += min(m, max(0, A[mid] + m - A[i]))
      if used >= m * v:
        break

  if used >= m * v:
    ok = mid
  else:
    ng = mid

print(ok + 1)

Measured memory_bytes: 14484
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


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

    ll a, b, x;
    cin >> a >> b >> x;

    ll res = 0;
    ll l = (a+x-1)/x;
    ll r = b/x;

    res = r - l + 1;

    //cout << l sp r << endl;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int cnt = 0;
    for(int i = 0; i < s.size(); i++) if(s[i] == 'o') cnt++;
    int t = 15 - s.size();
    cout << (t + cnt >= 8 ? "YES" : "NO") << endl;
    return 0;
}



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

using namespace std;

int main() {
	int N;
	cin >> N;
	++N;
	int ans = 0;
	for (int i = 1; i < N; i += 2) {
		int count = 0;
		for (int j = 1; j <= i; ++j) {
			if (i % j == 0)++count;
		}
		if (count == 8) {
			++ans;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define ll long long 
#define ull unsigned long long 
#define ld long double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define er erase
#define line cout<<"\n";
#define mod  1000000007


int main()
{ 
   fast
   ll n;
   cin>>n;
   ll sum=0;
   for(ll x=1; x<n; x++)
   {
       for(ll j=1; j<n; j++)
       {
           if(x*j<n)
           sum++;
           else
           break;
       }
   }
   cout<<sum<<"\n";
return 0;
}


Measured memory_bytes: 3620
import java.util.Scanner;
public class Main {
@SuppressWarnings("resource")
public static void main(String[] args) {
	Scanner sc =new Scanner(System.in);
	int H=sc.nextInt();
	int A=sc.nextInt();
	if(H%A!=0) {
		System.out.println((H/A)+1);
	}else{
		System.out.println(H/A);
	}
}
}

Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  map<int, int> mp;
  ll ans = 0;
  while (n--) {
    int ai; cin >> ai;
    ++mp[ai];
    ans += ai;
  }
  int q; cin >> q;
  while (q--) {
    int b, c; cin >> b >> c;
    ans -= 1LL * b * mp[b];
    ans += 1LL * c * mp[b];
    mp[c] += mp[b];
    mp.erase(b);
    cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 6580
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define mod 1000000007
#define int long long int
int gcd(int a,int b){
	return b==0 ? a : gcd(b,a%b);
}


int32_t main(){
    
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	int t=1;
	// cin>>t;
	while(t--){
		int n;
		cin>>n;
		vector<int> a(1000000,1);
		for(int i=2;i<n;i++){
			for(int j=i;j<n;j+=i){
				a[i]++;
			}
		}
		int ans = 0;
		for(int i=1;i<n;i++){
			ans+=a[n-i];
		}
		cout<<ans;
	}	
}
    



Measured memory_bytes: 11172
#include "bits/stdc++.h"
using namespace std;

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

    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<pair<char, char> >com;

    for (int i = 0; i < q; i++)
    {
        char t, d;
        cin >> t >> d;
        com.push_back(make_pair(t, d));
    }

    // 右の落ちる限界
    int rlb = n;//絶対落ちる
	int rub = -1;//必ず落ちない
    while (rlb - rub > 1)
    {
        int mid = (rlb + rub) / 2;//真ん中をとる
        bool f = false;
        int pos = mid;//スタート(最初にmidの位置にいる後ゴーレムを検証、midは落ちないやつと落ちるやつの真ん中)
        for (int i = 0; i < q; i++)
        {
            char t = com[i].first, d = com[i].second;
            if (!f)
            {
                if (s[pos] == t)
                {
                    if (d == 'L')
                        pos--;
                    else
                        pos++;
                    if (n <= pos)
                        f = true;
                }
            }
        }
        if (f)
            rlb = mid;
        else
            rub = mid;
    }
    // 左の落ちる限界
    int llb = -1; //絶対落ちる
	int lub = n; //絶対落ちない
    while (lub - llb > 1)
    {
        int mid = (llb + lub) / 2;
        bool f = false;
        int pos = mid;
        for (int i = 0; i < q; i++)
        {
            char t = com[i].first, d = com[i].second;
            if (!f)
            {
                if (s[pos] == t)
                {
                    if (d == 'L')
                        pos--;
                    else
                        pos++;
                    if (pos < 0)
                        f = true;
                }
            }
        }
        if (f)
            llb = mid;
        else
            lub = mid;
    }

    cout << max(0, n - (n-rlb) - (llb+1)) << endl;
}


Measured memory_bytes: 1100
#include<bits/stdc++.h>
#define INF (1e17)
#define N 100005
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,m,x,h[N];
vector<P> G[N];
priority_queue<P,vector<P>,greater<P> > q;
 
ll dijkstra(){
  bool used[N]={};
  q.push(P(0,0));
  while(!q.empty()){
    P temp=q.top(); q.pop();
    ll cost=temp.first;
    ll node=temp.second;
    if(node==n-1)return cost+max(cost-x+h[node],0LL);
    if(used[node])continue;
    used[node]=1;
    for(int i=0;i<G[node].size();i++){
      ll nnode=G[node][i].first;
      ll ncost=G[node][i].second+cost;
      ncost+=max(x-ncost-h[nnode],0LL);
      q.push(P(ncost,nnode));
    }
  }
  return -1;
}
 
int main(){
   
  cin>>n>>m>>x;
   
  for(int i=0;i<n;i++)scanf("%lld",&h[i]);
 
  ll a,b,c;
  for(int i=0;i<m;i++){
    scanf("%lld%lld%lld",&a,&b,&c);
    a--,b--;
    if(h[a]>=c)G[a].push_back(P(b,c));
    if(h[b]>=c)G[b].push_back(P(a,c));
  }
 
  cout<<dijkstra()<<endl;
   
  return 0;
}

Measured memory_bytes: 29808
#include <iostream>
#include <cmath>

using namespace std;

const int LIM = 1000001;
const int SQRT = sqrt(LIM);
bool dp[LIM];
bool is_prime[LIM];

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    for(int i = 0; i < LIM; ++i) {
        is_prime[i] = true;
    }
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <= SQRT; ++i) {
        if(is_prime[i]) {
            for(int j = i*i; j < LIM; j += i) {
                is_prime[j] = false;
            }
        }
    }
    while(true) {
        int N, X;
        cin >> N >> X;
        if(!N && !X) break;
        for(int i = 0; i <= X; ++i) {
            dp[i] = false;
        }
        dp[0] = true;
        int ans = -1;
        while(N--) {
            int A;
            cin >> A;
            for(int i = A; i <= X; ++i) {
                if(dp[i-A]) {
                    dp[i] = true;
                    if(is_prime[i]) ans = max(ans, i);
                }
            }
        }
        if(ans == -1) cout << "NA" << endl;
        else cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3148
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<functional>
#include<numeric>
 
using namespace std;
  
int main() {	
	int n;
	cin >> n;
	vector<int> a(n);
	for (auto& e : a) cin >> e;
	a.push_back(0xFFFFF);
	int asum{ 0 };
	int j = 0;
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		while (!(asum&a[j]) && j<n) {
			asum += a[j];
			j++;
		}
		ans += j - i;
		asum -= a[i];
	}

	cout << ans << endl;


	return 0;
}

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

using namespace std;

map<pair<int,int>,int>mp;
vector<pair<int,int> >v;

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

    int n,x,y,i,j,px,py,tot=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>x>>y;
        v.push_back({x,y});
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            if(v[j].first==v[i].first && v[j].second==v[i].second)
                continue;
            mp[{v[j].first-v[i].first,v[j].second-v[i].second}]++;
        }
    }
    for(auto it = mp.begin();it!=mp.end();it++)tot=max(tot,it->second);
    cout<<n-tot<<'\n';
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) (find(all(v),x)!=v.end())
#define incls(s,c) (s.find(c)!=string::npos)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(all(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; cin >> x; return x;}
inline ll lin() { ll x; cin >> x; return x;}
inline char chin() { char x; cin >> x; return x;}
inline string stin() { string x; cin >> x; return x;}
inline double din() { double x; cin >> x; return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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; }
char itoa(int n) { return n + '0';}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int n = in();
  vi p(n);
  rep(i,n) cin >> p[i];
  vi q(n);
  rep(i,n) cin >> q[i];

  vi vec(n);
  rep(i,n) vec[i] = i+1;
  int i = 0;
  int a, b;
  do {
    i++;
    if (vec == p) a = i;
    if (vec == q) b = i;
  } while (next_permutation(all(vec)));

  int ans = abs(a-b);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <iterator>
#include <math.h>
#include <cmath>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <regex>
#include <stdexcept>
#include <unordered_set>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <cassert>
#include <time.h>
#include <numeric>
#include <complex>
  
using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
  
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define fill(x, y) memset(x, y, sizeof(x))
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define rep(i, x)  for(int i = 0; i < (x); i++)
#define rrep(i, x) for(int i = (x - 1); i >= 0; i--)
#define y1 y1_1234413
#define j1 j1_235
#define y0 y0_235
#define j0 j0_256
#define fi first
#define se second
#define itn int
#define re return
#define prev PREV
#define next NEXT
  
#define sz(x) ((int)x.size())
  
const int inf = 2e9;
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const int MAXN = 1e5;
#define FILENAME ""
const double eps = 1e-6;
const int maxn = 1001;


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    //freopen("unionday.in", "r", stdin);
    //freopen("unionday.out", "w", stdout);
    ll n;
    cin >> n;
    ll mini = 1000000000000000 + 10	;
    for (int i = 0; i < 5; i++) {
    	ll x;
    	cin >> x;
    	mini = min(mini, x);
    }
    cout << (n - 1)/mini + 5;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;

int main(){
    ll N, K;
    cin >> N >> K;
    vector<P> v(N);
    for(P &u : v) cin >> u.first >> u.second;
    ll ok = 3 * pow(10, 18), ng = 0;
    while(ok - ng > 1){
        ll mid = (ok + ng) / 2;
        ll cnt = 0;
        for(const auto &u : v) cnt += (mid >= u.first) + max<ll>(0, mid - u.first) / u.second;
        if(cnt >= K) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<cmath>
#include<cstdio>
using namespace std;
double s(double a){
	return a*a;
}
double d(double a,double b,double c){
	return s(a)+s(b)+s(c);
}
int main(void){
	int n,m;
		double ans=0;
		cin>>n>>m;
		vector<double> l(n),a(l),b(l);
		for(int i=0;i<n;i++){
			cin>>l[i]>>a[i]>>b[i];
		}
		vector<vector<double> > map(n,vector<double>(n,0));
		for(int i=0;i<n;i++){
			for(int j=0;j<i;j++){
				map[i][j]=d(l[i]-l[j],a[i]-a[j],b[i]-b[j]);
			}
		}
		
		int t=0;
		for(int i=0;i<pow(2,n)+0.5;i++){
			
			int count=0;
			int k=i;
			vector<int> c;
			for(int j=0;j<n;j++){
				if(k%2==1){
				count++;
				c.push_back(j);
				
			}
			k/=2;
			}
			double an=0;
			if(count==m){
				
				for(int j=0;j<m;j++){
					for(int l=0;l<j;l++){
						an+=map[c[j]][c[l]];
					}
				}
				
				ans=max(ans,an);
			}

		}
		
	//	cout<<ans<<endl;
	printf("%0.7lf",ans);	
	return 0;
}

Measured memory_bytes: 3448
#include<bits/stdc++.h>
using namespace std;
int a[11],i;
char c;
int main(){
	while(cin>>c){
		switch(c){
			case '1':a[i++]=1;break;
			case '0':a[i++]=-1;break;
			case 'B':if(i)a[--i]=0;break;
		}
	}
	for(int j=0;j<i;j++)cout<<((a[j]+1)>>1);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;

using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a > b) cout << 2 * a - 1 << endl;
	else if (a == b) cout << a + b << endl;
	else cout << 2 * b - 1 << endl;
	return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> X(M);
  for (int i = 0; i < M; i++) cin >> X[i];
  sort(X.begin(), X.end());
  vector<int> D(M-1);
  for (int i = 0; i < M-1; i++) {
    D[i] = abs(X[i] - X[i+1]);
  }
  sort(D.begin(), D.end(), greater<int>());
  long ans = 0;
  for (int i = N-1; i < M-1; i++) {
    ans += D[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
X,Y=map(int,input().split())
flg=False

if Y%2!=0 :
    print('No')
    flg=True
else:
    for i in range(0,X+1):
        j=X-i
        if i*2+j*4 == Y or j*2+i*4 == Y:
            print("Yes")
            flg=True
            break

if flg==False:
    print('No')

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int a,b;
  cin>>a>>b;
  cout<<((a+b+1)/2)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<map>
#include<queue>
using namespace std;
int main() {
	int n;
	cin >> n;
	int sum = 0;
	for (int i = 1;; i++) {
		sum += i;
		if (sum >= n) {
			cout << i;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define lli long long int 
#define pb push_back 
#define im (int i = 0 ; i < m ; i++)
#define jx (int j = 0 ; j < x ; j++)
#define kn (int k = 0 ; k < n ; k++)
#define ln (int l = 0 ; l < n ; l++)
#define wq while (q--)


int main ()
{
    int m1 , d1 , m2 , d2 ;
    cin >> m1 >> d1 >> m2 >> d2;

    if(m1 == 1 && d1 == 31)
    {
        printf("1\n");
        return 0 ;
    }  
    else if(m1 == 2 && d1 == 28)
    {
        printf("1\n");
        return 0 ;
    }
    else if(m1 == 3 && d1 == 31)
    {
        printf("1\n");
        return 0 ;
    }
    else if(m1 == 4 && d1 == 30)
    {
        printf("1\n");
        return 0 ;
    }
    else if(m1 == 5 && d1 == 31)
    {
        printf("1\n");
        return 0 ;
    }
    else if(m1 == 6 && d1 == 30)
    {
        printf("1\n");
        return 0 ;
    }
    else if(m1 == 7 && d1 == 31)
    {
        printf("1\n");
        return 0 ;
    }
    else if(m1 == 8 && d1 == 31)
    {
        printf("1\n");
        return 0 ;
    }
    else if(m1 == 9 && d1 == 30)
    {
        printf("1\n");
        return 0 ;
    }
    else if(m1 == 10 && d1 == 31)
    {
        printf("1\n");
        return 0 ;
    }
    else if(m1 == 11 && d1 == 30)
    {
        printf("1\n");
        return 0 ;
    }
    else if(m1 == 12 && d1 == 31)
    {
        printf("1\n");
        return 0 ;
    }
    else
    {
        printf("0\n");
        return 0 ;
    }
      
    return 0 ;
}

Measured memory_bytes: 256
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 int main()
 {
   int N;
   cin>>N;
   while(N--)
   {
     string a,b,sum;
     cin>>a>>b;
     bool flag=false;
     if(a.length()>80||b.length()>80) flag=true;
     else
     {
       int up=0;
       int i;
       for(int j=0;j<a.length()/2;j++) swap(a[j],a[a.length()-j-1]);
       for(int j=0;j<b.length()/2;j++) swap(b[j],b[b.length()-j-1]);
       for(i=0;i<a.length()&&i<b.length();i++)
       {
         sum+=(((a[i]-'0')+(b[i]-'0')+up)%10)+'0'; 
         if(a[i]-'0'+b[i]-'0'+up>=10) up=1;   
         else up=0;  
       }          
       while(i<a.length()) 
       {
         sum+=((a[i]-'0'+up)%10)+'0';
         if(a[i]-'0'+up>=10) up=1; 
         else up=0;         
         i++;          
       }
       while(i<b.length()) 
       {
         sum+=((b[i]-'0'+up)%10)+'0';
         if(b[i]-'0'+up>=10) up=1; 
         else up=0;
         i++;                   
       }
       if(up==1) sum+='1';
       if(sum.length()>80) flag=true;
     }
     if(flag) cout<<"overflow"<<endl;
     else
     {
       for(int i=sum.length()-1;i>=0;i--) cout<<sum[i];
       cout<<endl;    
     }
   }
   //while(1);      
   return 0;    
 }
 
 
 
 
 

Measured memory_bytes: 3008